var timeout    = 0;
var opentimeout = 400;
var closetimer = 0;
var ddmenuitem = 0;

function jsddm_open()
{  jsddm_canceltimer();
   jsddm_close();
   ddmenuitem = $(this).find('ul').css('visibility', 'visible');}

function jsddm_close()
{  if(ddmenuitem) ddmenuitem.css('visibility', 'hidden');}

function jsddm_timer()
{  closetimer = window.setTimeout(jsddm_close, timeout);}

function jsddm_canceltimer()
{  if(closetimer)
   {  window.clearTimeout(closetimer);
      closetimer = null;}}

function newsHover() {

$(document).ready(function() {
	$('.news').mouseover(function() {
		$(this).css("background-color","#FF9933");			
	});
	$('.news').mouseout(function() {
		$(this).css("background-color","transparent");
	});
	$('.news').click(function(){
		window.location=$(this).find("a").attr("href"); 
		return false;
	});	
	
	$('.artikelbox').mouseover(function() {
		$(this).css("background-color","#FF9933");	
		$(this).css("background-image","none");			
	});
	$('.artikelbox').mouseout(function() {
		$(this).css("background-color","transparent");
		$(this).css("background-image","url(http://www.freizeitpark-welt.de/layout/AttrKlein1.jpg)");	
	});
					   
});
}

function navTitleOverlay() {
	
$(document).ready(function() {
	//$("li a").append("<em></em>");

	$("li a").hover(function() {
	  $(this).prev("em").animate({opacity: "show", left: "150"}, "slow");
	  //var hoverText = $(this).attr("title");
	  //$(this).next("em").text(hoverText);
	}, function() {
	  $(this).prev("em").animate({opacity: "hide", left: "130"}, "fast");
	});
						   
});
}

function buttonOverlay() {
	
$(document).ready(function() {
	//$("li a").append("<em></em>");

	$("#infolinks li a").hover(function() {
	  $(this).next("em").animate({opacity: "show"}, "slow");
	  //var hoverText = $(this).attr("title");
	  //$(this).next("em").text(hoverText);
	}, function() {
	  $(this).next("em").animate({opacity: "hide"}, "fast");
	});
						   
});
}

function preisOverlay() {
	
$(document).ready(function() {
	//$("li a").append("<em></em>");

	$("tr").hover(function() {
	  $(this).next("em").animate({opacity: "show"}, "slow");
	  //var hoverText = $(this).attr("title");
	  //$(this).next("em").text(hoverText);
	}, function() {
	  $(this).next("em").animate({opacity: "hide"}, "fast");
	});
						   
});
}

function preisSlider() {
$(document).ready(function() {
	var trigger1 = false;
	var trigger2 = false;
	var trigger3 = false;
	$('.preiskasten .Teintritt2').hide();
	$('.preiskasten .Teintrittj').hide();
	
	$('#zweitagbutton').click(function() {
		
		if (!trigger1) {
			$(this).parent().nextAll('.Teintritt2').show();
			$(this).text("2-Tageskarten ausblenden");
			trigger1 = true;
		}
		else {
			$(this).parent().nextAll('.Teintritt2').hide();
			$(this).text("2-Tageskarten einblenden");
			trigger1 = false;
		}
	});
	$('#zweitagwinterbutton').click(function() {
		
		if (!trigger3) {
			$(this).parent().nextAll('.Teintritt2').show();
			$(this).text("2-Tageskarten ausblenden");
			trigger3 = true;
		}
		else {
			$(this).parent().nextAll('.Teintritt2').hide();
			$(this).text("2-Tageskarten einblenden");
			trigger3 = false;
		}
	});
	$('#jahrbutton').click(function() {
		
		if (!trigger2) {
			$('.preiskasten .Teintrittj').show();
			$(this).text("Jahreskarten ausblenden");
			trigger2 = true;
		}
		else {
			$('.preiskasten .Teintrittj').hide();
			$(this).text("Jahreskarten einblenden");
			trigger2 = false;
		}
	});	
});	
}

function prettyPhoto() {
	$(document).ready(function() {
$("a[rel^='lightbox']").prettyPhoto({
				  animationSpeed: 'normal', /* fast/slow/normal */
				  padding: 40, /* padding for each side of the picture */
				  opacity: 0.50, /* Value betwee 0 and 1 */
				  showTitle: true, /* true/false */
				  allowresize: true, /* true/false */
				  counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
				  theme: 'dark_rounded', /* light_rounded / dark_rounded / light_square / dark_square */
				  hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */
				  modal: false, /* If set to true, only the close button will close the window */
				  changepicturecallback: function(){}, /* Called everytime an item is shown/changed */
				  callback: function(){} /* Called when prettyPhoto is closed */
			  });	
});
}

function galerieHover(){

$(document).ready(function() {
	$('.galerieverweis a img').fadeTo("fast", 0.5);							
								
	//Galerielinks
	$('.galeriebox').mouseover(function() {
		$(this).css("background-color","#FF9933");			
	});
	$('.galeriebox').mouseout(function() {
		$(this).css("background-color","#FFFF99");
	});
	
	
	//Galerieverweise
	$('.galerieverweis').mouseover(function() {
		$(this).css("background-color","#FF9933");		
		$(this).children('a').css("color","black");	
	});
	$('.galerieverweis').mouseout(function() {
		$(this).css("background-color","#003300");
		$(this).children('a').css("color","#66CC66");
	});
	
	$('.galerieverweis a img').mouseover(function() {
		$(this).fadeTo("slow", 1);												   
	});
	$('.galerieverweis a img').mouseout(function() {
		$(this).fadeTo("slow", 0.5);												   
	});
});
	
}

function inputclear(field) {
	if (field.value!='') field.value='';
}

function showDropDown(){
$(document).ready(function()
{  
$('#topnavcapmenu > li').bind('mouseover', jsddm_open)
$('#topnavcapmenu > li').bind('mouseout',  jsddm_timer)

$('#topnavcapmenu > li.topnavcap > ul').mouseover(function() {
	$(this).prev('a').css('background','url(http://www.freizeitpark-welt.de/layout/topnavcaphover.png) repeat-x');
});
$('#topnavcapmenu > li.topnavcap > ul').mouseout(function() {
	$(this).prev('a').css('background','url(http://www.freizeitpark-welt.de/layout/topnavcap.png) repeat-x');
});
$('#topnavcapmenu > li.topnavcap > a').mouseover(function() {
	$(this).css('background','url(http://www.freizeitpark-welt.de/layout/topnavcaphover.png) repeat-x');
});
$('#topnavcapmenu > li.topnavcap > a').mouseout(function() {
	$(this).css('background','url(http://www.freizeitpark-welt.de/layout/topnavcap.png) repeat-x');
});




});

document.onclick = jsddm_close;
}

function showDropDownHistory(){
$(document).ready(function()
{  
$('#topnavcapmenu > li').bind('mouseover', jsddm_open)
$('#topnavcapmenu > li').bind('mouseout',  jsddm_timer)

$('#topnavcapmenu > li.topnavcap > ul').mouseover(function() {
	$(this).prev('a').css('background','url(http://www.freizeitpark-welt.de/layout/topnavcaphover.png) repeat-x');
});
$('#topnavcapmenu > li.topnavcap > ul').mouseout(function() {
	$(this).prev('a').css('background','url(http://www.freizeitpark-welt.de/layout/topnavcapH.png) repeat-x');
});
$('#topnavcapmenu > li.topnavcap > a').mouseover(function() {
	$(this).css('background','url(http://www.freizeitpark-welt.de/layout/topnavcaphover.png) repeat-x');
});
$('#topnavcapmenu > li.topnavcap > a').mouseout(function() {
	$(this).css('background','url(http://www.freizeitpark-welt.de/layout/topnavcapH.png) repeat-x');
});

});

document.onclick = jsddm_close;
}
