function TopNavi(){this.state='closed';this.activeObject=null;this.currentTimeout=null;this.setState=function(state){this.state=state;return this;}
this.getState=function(){return this.state;}
this.setActiveObject=function(activeObject){this.activeObject=activeObject;return this;}
this.getActiveObject=function(){return this.activeObject;}
this.getTeaserContentObject=function(naviTeaser){if(naviTeaser==null){return jQuery('');}
var contentClass=naviTeaser.attr('rev');if(contentClass!=''){return jQuery('#naviTeaser .body .'+contentClass);}else{return null;}}
this.action=function(naviTeaser){var that=this;if(this.getState()=='closed'){this.open(naviTeaser);}else if(this.getState()=='open'&&naviTeaser.attr('rev')!==this.getActiveObject().attr('rev')){this.close();this.currentTimeout=setTimeout(function(){that.open(naviTeaser)},750);this.open(naviTeaser);}else{if(this.getState()=='opening'){this.close(true);clearTimeout(this.currentTimeout);setTimeout(function(){that.open(naviTeaser)},750);}}}
this.beforeOpen=function(){return true;}
this.open=function(navObject){this.beforeOpen();if(this.getState()!='closed'){return false;}
this.getTeaserContentObject(navObject).show();this.setState('opening');this.setActiveObject(navObject);var that=this;jQuery('#naviTeaser').slideDown('slow',function(){that.setState('open');});this.afterOpen();return true;}
this.afterOpen=function(){return true;}
this.beforeClose=function(){return true;}
this.close=function(force){this.beforeClose();if(this.getState()!='open'&&!force)return;if(this.getState()=='opening')jQuery('#naviTeaser').stop();this.getTeaserContentObject(this.getActiveObject()).hide();this.setState('closing');this.setActiveObject(null);var that=this;jQuery('#naviTeaser').slideUp('fast',function(){that.setState('closed');});this.afterClose();}
this.afterClose=function(){return true;}
this.log=function(value){if(typeof(console)=='object'){console.log(value);}}};BavarianAlpsTopNavi=function(){this.beforeOpen=function(){$("#secnavi").fadeOut('slow');return true;}
this.afterClose=function(){$("#secnavi").fadeIn('slow');return true;}}
BavarianAlpsTopNavi.prototype=new TopNavi();var topNavi=new BavarianAlpsTopNavi();$(document).ready(function(){$("#front li").mouseenter(function(){$('div:last-child',this).doTimeout('hover',250,'fadeIn','slow');$('span',this).addClass('hover');});$("#front li").mouseleave(function(){$('div:last-child',this).doTimeout('hover',250,'hide','fast');$('span',this).doTimeout('hover',250,'removeClass','hover');});var navLatency=null;$("#naviTop li").children("a[rel='hasTeaser']").bind({mouseenter:function(){window.clearTimeout(navLatency);var that=this;navLatency=window.setTimeout(function(){topNavi.action(jQuery(that))},350);},mouseleave:function(){if(navLatency!=null){window.clearTimeout(navLatency);navLatency=window.setTimeout(function(){topNavi.close()},350);}}});jQuery('#naviTeaser div.body div.teaser').bind({mouseenter:function(){window.clearTimeout(navLatency);}});jQuery('#naviFix,#keyvisual').bind({mouseenter:function(){navLatency=window.setTimeout(function(){topNavi.close()},500);}});$(function(){$("div.carousel_item div.hover").css("opacity","0");$("div.carousel_item").hover(function(){$('div:last-child',this).stop().animate({opacity:0.8},'slow');$('div:first-child',this).removeClass('default').addClass('active');},function(){$('div:last-child',this).stop().animate({opacity:0},'slow');$('div:first-child',this).removeClass('active').addClass('default');});});$('#gallery').galleryView({frame_width:53,frame_height:31,overlay_position:'top',pause_on_hover:false});$('#galleryPaginator a.stop').click(function(){$(document).stopTime("transition");});$('#galleryPaginator a.go').click(function(){$('.nav-next').click();});$('div.ie a.prev').click(function(){$('.nav-prev').click();});$('div.ie a.next').click(function(){$('.nav-next').click();});$("a#showMap").click(function(){if($("#globalSearch").is(":visible")){$('#globalSearch').hide();$('#client_ID').hide();$('#logo').hide();$('#keyvisual img').fadeOut('slow');$('#layerMap').fadeOut('slow');$('#keyvisual').addClass('lower');$('#secnavi').animate({top:"-20px"},500);$("ul#main").slideUp();$("div.toggler a").hide();$("div.mapToggler").show();$('div#secnavi').addClass('naviHover');$("div.logoMap").show();$('div#secnavi').hide();$('div#client_Contest').hide();$('div#header-video').hide();if(typeof(ET_Event)=='object')ET_Event.eventStart('Map/'+language.toUpperCase(),'','show_map','');}else{$('#globalSearch').show();$('#logo').show('fast');$('#layerMap').fadeIn('slow');$('#keyvisual img').fadeIn('slow');$('#keyvisual').removeClass('lower');$('#secnavi').animate({top:"40px"},500);$("ul#main").slideDown();$("div.toggler a").show();$("div.mapToggler").hide();$('div#secnavi').removeClass('naviHover');$('#client_ID').show();$('div#secnavi').show();$('div#client_Contest').show();$('div#header-video').show();if(typeof(ET_Event)=='object')ET_Event.eventStart('Map/'+language.toUpperCase(),'','close_map','');}});$("a#hideMap").click(function(){$('#globalSearch').show();$('#client_ID').show();$('#logo').show();$('#layerMap').fadeIn('slow');$('#keyvisual img').fadeIn('slow');$('#keyvisual').removeClass('lower');$('#secnavi').animate({top:"40px"},500);$("ul#main").slideDown();$("div.toggler a").show();$("div.mapToggler").hide();$('div#secnavi').removeClass('naviHover');$('div#secnavi').show();$('div#client_Contest').show();$('div#header-video').show();if(typeof(ET_Event)=='object')ET_Event.eventStart('Map/'+language.toUpperCase(),'','close_map','');});$(".legendToggler").click(function(){if($("#legend ul").is(":visible")){$("#legend ul").hide();$("#legend").animate({width:"150px"},500);$(this).animate({width:"106px"},500);$(".legendToggler div").animate({width:"80%"},500);$(".legendToggler div").html("Legende").css({'cursor':'pointer'});$('.legendToggler a').css({"background-position":"0 -41px"}).attr({title:"Legende öffnen"});}else{$("#legend ul").show(300);$("#legend").animate({width:"265px"},300);$(this).animate({width:"221px"},300);$(".legendToggler div").animate({width:"80%"},300);$(".legendToggler div").html("Auf Karte zeigen:").css({'cursor':'text'});$('.legendToggler a').css({'background-position':'0 2px'}).attr({title:"Legende schließen"});}});$('#map_container').mouseenter(function(){if($("div.logoMap").is(":visible")){$("div.logoMap").fadeOut('slow');}});$('#map_container').mouseleave(function(){if($("div.logoMap").is(":hidden")){$("div.logoMap").fadeIn('slow');}});$('#banner_facebook').css({'-moz-border-radius':'5px','-khtml-border-radius':'5px'});jQuery('.jsShowHotelsOnMap').click(function(){jQuery(this).attr('href','javascript://');topNavi.close(true);if($("#globalSearch").is(":visible"))jQuery('a#showMap').click();jQuery('div#mapLarge').ready(function(){if(!jQuery('input#gMapP_163').is(':checked')){jQuery('input#gMapP_163').click();jQuery('input#gMapP_163').change();}});return false;});});
