var bgi={};
$(document).ready(function ()
{
	loadContent("home.html");
	/* Treeview */
	/* http://bassistance.de/jquery-plugins/jquery-plugin-treeview/ */
	// $("#bgi_nav_list").Treeview({collapsed: true});
	// $("#bgi_skeleton").corner("20px");
});

loadContent = function (src, showLoading,elemId)
{
	if (showLoading) $("#bgi_loading").show(); 
	$('#bgi_container').load(src,undefined,function(responseText)
							{

								// $('h1').after(($('h1').clone().addClass("front"))).addClass("back");
								if (responseText) $("#bgi_loading").hide();
							});
    $(".nav_button").each(function(){
                                if(this.id != elemId) {
                                    $("#" + this.id).removeClass("nav_button_active");
                                };
                            });
    $("#"+elemId).addClass("nav_button_active");
}

/*
 * fadeToggle shows or hides the blocker-div
 * Example: fadeToggle("bgi_blocker_content","fast", 0.9)
 * @param eltId: element id of element that should be shown/hidden on the "blocker" div
 * @param speed: speed of the animation in milliseconds or "fast","medium", "slow"
 * @param opacity: opacity of the element that should be shown/hidden on the "blocker" div
 */

function fadeToggle(eltId,speed,opacity)
{
	eltId="#"+eltId;
	if($(eltId).css("opacity")==opacity)
	{ 
		$(eltId).fadeOut(speed
						, function () 
						{
							$(eltId).css({opacity: 0});
							$("#bgi_blocker").fadeOut(speed).hide();
						} );
	}
	else
	{
		$(eltId).css({opacity: 0}).show().fadeTo(speed, opacity);
		$("#bgi_blocker").css({opacity: 0}).show().fadeTo(speed, 0.9);
	}
}

