$(document).ready(function()
{
	
	//Wrap all objects (Videos)
	
	$('object').wrap('<div class="video" />');
	$('object').each(function () { 
		$('div .video').css('width', $(this).width());
	});

	
	$(".section-title").nextAll("li").addClass("sub");
		  
	// First we hide all exhibitis 
	$("#menu ul li.section-title").nextAll().hide();
	
	// then the active exhibit is showed
	$("#menu ul").each(function()
	{
	$(this).find("li.active").prevAll().nextAll().show();
	});
	
	// This is the toggle function
	// first it hides all sections
	$("#menu ul li.section-title").css({cursor:"pointer"}).click(function()
	{
		$(this).nextAll().slideToggle("fast");
		$("#menu ul li.section-title").not(this).nextAll().hide(100);
	});
	
	
	

if ($.browser.msie) { // WENN BROWSER = IE dann nicht faden!
	if ($gallery==true){

		var $over=false;
		$("#img-container").hover(function(){
			$over=true;
			$("#overlay").show();
			$("h2").show();
		}).mouseleave(function(){
			$over=true;
			$("#overlay").hide();
			$("h2").hide();
		});

		/*3 sekunden nach laden der Seite wird overlay eingefahren */
		$.timer(3000, function (timer) {
		    if ($over==false){
			    $("#overlay").hide();
			    $("h2").hide();
		    };
		    timer.stop();
		});   
    
	}
} else {
	if ($gallery==true){

		var $over=false;
		$("#img-container").mouseenter(function(){
		
			$("#overlay").fadeTo("normal",.8);
			$("h2").fadeTo("normal",.8);
		}).mouseleave(function(){
			$over=true;
			$("#overlay").fadeTo("normal",0);
			$("h2").fadeTo("normal",0);
		});
		
		
		
		$("div#overlay").mouseleave(function(){
			$("#overlay").fadeTo("normal",0);
			$("h2").fadeTo("normal",0);
			$over=true;
		}).mouseenter(function(){
			$("#overlay").fadeTo("normal",.8);
			$("h2").fadeTo("normal",.8);
		});
		
	
	     
		/*3 sekunden nach laden der Seite wird overlay eingefahren */
		$.timer(3000, function (timer) {
		    if ($over==false){
			    $("#overlay").fadeTo("normal",0);
			    $("h2").fadeTo("normal",0);
		    };
		    timer.stop();
		});   
    
	}
}

	
	

	
});

