// JavaScript Document

jQuery(document).ready(function(){

	var timeout         = 500;
	var closetimer		= 0;
	var ddmenuitem      = 0;
	
	function jsddm_open()
	{	jsddm_canceltimer();
		jsddm_close();
		ddmenuitem = jQuery(this).find('ul').eq(0).css('display', 'block');}
	
	function jsddm_close()
	{	if(ddmenuitem) ddmenuitem.css('display', 'none');}
	
	function jsddm_timer()
	{	closetimer = window.setTimeout(jsddm_close, timeout);}
	
	function jsddm_canceltimer()
	{	if(closetimer)
		{	window.clearTimeout(closetimer);
			closetimer = null;}}
	
	jQuery(document).ready(function()
	{	jQuery('#nav > li').bind('mouseover', jsddm_open);
		jQuery('#nav > li').bind('mouseout',  jsddm_timer);});
	
	document.onclick = jsddm_close;
	
	
	
	jQuery("#language-sub").hide();
	
	jQuery("#lang").mouseover(function(){
		jQuery('#language-sub').hide();
    	clearTimeout(jQuery("#lang").data('timeoutId'));
    	jQuery("#language-sub").show();
	}).mouseout(function(){
		var timeoutId = setTimeout(function(){ jQuery("#language-sub").hide();}, 100);
		jQuery("#lang").data('timeoutId', timeoutId); //set the timeoutId, allowing us to clear this trigger if the mouse comes back over
	});
	
	jQuery("#language-sub").mouseover(function(){
    	clearTimeout(jQuery("#lang").data('timeoutId'));
    	jQuery("#language-sub").show();
	}).mouseout(function(){
		var timeoutId = setTimeout(function(){ jQuery("#language-sub").hide();}, 100);
		jQuery("#lang").data('timeoutId', timeoutId); //set the timeoutId, allowing us to clear this trigger if the mouse comes back over
	});
	
	
	
	/* BEGIN: rollover-hero  */
	
	
	jQuery("#roll-hero-over").hide();
	
	jQuery("#roll-hero-id").mouseover(function(){
    	clearTimeout(jQuery("#roll-hero-id").data('timeoutId'));
    	jQuery("#roll-hero-over").show("slide", { direction: "right" }, 500);
	});
	
	jQuery("#roll-hero-over").mouseover(function(){
    	clearTimeout(jQuery("#roll-hero-id").data('timeoutId'));
    
	}).mouseout(function(){
		var timeoutId = setTimeout(function(){ jQuery("#roll-hero-over").hide("slide", { direction: "right" }, 500);}, 100);
		jQuery("#roll-hero-id").data('timeoutId', timeoutId); //set the timeoutId, allowing us to clear this trigger if the mouse comes back over
	
	});

	
	/* END: rollover-hero */
	
	
	
	/* BEGIN: rollover-news */
	
	jQuery("#news-sub").hide();
	
	jQuery("#newsid").mouseover(function(){
    	clearTimeout(jQuery("#newsid").data('timeoutId'));
    	jQuery("#news-sub").show("slide", { direction: "right" }, 500);
	});
	
	jQuery("#news-sub").mouseover(function(){
    	clearTimeout(jQuery("#newsid").data('timeoutId'));
    
	}).mouseout(function(){
		var timeoutId = setTimeout(function(){ jQuery("#news-sub").hide("slide", { direction: "right" }, 500);}, 100);
		jQuery("#newsid").data('timeoutId', timeoutId); //set the timeoutId, allowing us to clear this trigger if the mouse comes back over
	});
	
	/* END: rollover-news */
	
	/* BEGIN: rollover-info */
	
	
	jQuery("#info-sub").hide();
	
	jQuery("#infoid").mouseover(function(){
    	clearTimeout(jQuery("#infoid").data('timeoutId'));
    	jQuery("#info-sub").show("slide", { direction: "right" }, 500);
	});
	
	jQuery("#info-sub").mouseover(function(){
    	clearTimeout(jQuery("#infoid").data('timeoutId'));
    
	}).mouseout(function(){
		var timeoutId = setTimeout(function(){ jQuery("#info-sub").hide("slide", { direction: "right" }, 500);}, 100);
		jQuery("#infoid").data('timeoutId', timeoutId); //set the timeoutId, allowing us to clear this trigger if the mouse comes back over
	});
	
	/* END: rollover-info */
	
	/* BEGIN: rollover-termine */
	
	
	jQuery("#termine-sub").hide();
	
	jQuery("#termine-id").mouseover(function(){
    	clearTimeout(jQuery("#termine-id").data('timeoutId'));
    	jQuery("#termine-sub").show("slide", { direction: "right" }, 500);
	});
	
	jQuery("#termine-sub").mouseover(function(){
    	clearTimeout(jQuery("#termine-id").data('timeoutId'));
    
	}).mouseout(function(){
		var timeoutId = setTimeout(function(){ jQuery("#termine-sub").hide("slide", { direction: "right" }, 500);}, 100);
		jQuery("#termine-id").data('timeoutId', timeoutId); //set the timeoutId, allowing us to clear this trigger if the mouse comes back over
	});
	
	/* END: rollover-termine */
	
	/* BEGIN: rollover-management */
	
	
	jQuery("#management-sub").hide();
	
	jQuery("#management-id").mouseover(function(){
    	clearTimeout(jQuery("#management-id").data('timeoutId'));
    	jQuery("#management-sub").show("slide", { direction: "right" }, 500);
	});
	
	jQuery("#management-sub").mouseover(function(){
    	clearTimeout(jQuery("#management-id").data('timeoutId'));
    
	}).mouseout(function(){
		var timeoutId = setTimeout(function(){ jQuery("#management-sub").hide("slide", { direction: "right" }, 500);}, 100);
		jQuery("#management-id").data('timeoutId', timeoutId); //set the timeoutId, allowing us to clear this trigger if the mouse comes back over
	});
	
	/* END: rollover-management */
	
	/* BEGIN: rollover-facebook */
	
	
	jQuery("#facebook-sub").hide();
	
	jQuery("#facebook-id").mouseover(function(){
    	clearTimeout(jQuery("#facebook-id").data('timeoutId'));
    	jQuery("#facebook-sub").show("slide", { direction: "right" }, 500);
	});
	
	jQuery("#facebook-sub").mouseover(function(){
    	clearTimeout(jQuery("#facebook-id").data('timeoutId'));
    
	}).mouseout(function(){
		var timeoutId = setTimeout(function(){ jQuery("#facebook-sub").hide("slide", { direction: "right" }, 500);}, 100);
		jQuery("#facebook-id").data('timeoutId', timeoutId); //set the timeoutId, allowing us to clear this trigger if the mouse comes back over
	});
	
	/* END: rollover-facebook */
	
	/* BEGIN: rollover-rooms */
	
	
	jQuery("#rooms-sub").hide();
	
	jQuery("#rooms-id").mouseover(function(){
    	clearTimeout(jQuery("#rooms-id").data('timeoutId'));
    	jQuery("#rooms-sub").show("slide", { direction: "right" }, 500);
	});
	
	jQuery("#rooms-sub").mouseover(function(){
    	clearTimeout(jQuery("#rooms-id").data('timeoutId'));
    
	}).mouseout(function(){
		var timeoutId = setTimeout(function(){ jQuery("#rooms-sub").hide("slide", { direction: "right" }, 500);}, 100);
		jQuery("#rooms-id").data('timeoutId', timeoutId); //set the timeoutId, allowing us to clear this trigger if the mouse comes back over
	});
	
	/* END: rollover-rooms */


});
