if(window.location.hash!=""&&window.location.hash.substr(0,2)=="#/"){window.location.href=window.location.hash.substr(1)}else{var bergfexMap=null;var fnDocumentWrite=null;var apiLoaded=false;jssm.inline();$(document).ready(function(){var c=$("#mapactions-text").text();$("#mapaction_help").bind("click",function(d){Infobar.show("javascript performance index: "+getJSPerformance())});$("#mapaction_link").bind("click",function(e){if(bergfexMap!=null){var d=bergfexMap.getUrlFromLocation();Infobar.show('Link: <a style="font-weight: normal;" href="'+d+'">'+d+"</a>")}});$("#mapaction_up").bind("click",function(d){if(bergfexMap!=null){bergfexMap.increaseMapHeight(-50)}});$("#mapaction_down").bind("click",function(d){if(bergfexMap!=null){bergfexMap.increaseMapHeight(50)}});$("#mapaction_full").bind("click",function(d){if(bergfexMap!=null){bergfexMap.toggleFullscreen()}});$("#mapaction_close").bind("click",function(d){if(bergfexMap!=null){bergfexMap.setFullscreen(false);unloadMap()}});$(".map_enable").bind("click",function(d){loadMap()});$("#infobar-close").bind("click",function(d){Infobar.hide()});$("#mapaction_help").bind("mouseover",function(d){$("#mapactions-text").text("Hilfe und Beschreibung")});$("#mapaction_link").bind("mouseover",function(d){$("#mapactions-text").text("Link zur Kartenposition")});$("#mapaction_up").bind("mouseover",function(d){$("#mapactions-text").text("Kartenausschnitt verkleinern")});$("#mapaction_down").bind("mouseover",function(d){$("#mapactions-text").text("Kartenausschnitt vergrößern")});$("#mapaction_full").bind("mouseover",function(d){$("#mapactions-text").text("Vollbild")});$("#mapaction_close").bind("mouseover",function(d){$("#mapactions-text").text("Karte ausblenden")});$(".map_enable").bind("mouseover",function(d){$("#mapactions-text").text("Karte einblenden")});$("#mapaction_help,#mapaction_link,#mapaction_up,#mapaction_down,#mapaction_full,#mapaction_close,.map_enable").bind("mouseout",function(d){$("#mapactions-text").text(c)});$("#map-search-close-container").bind("click",function(d){$("#map-search-result-container").fadeOut(300)});$("#map-search-close-minimized").bind("click",function(d){$("#map-search-result-minimized").fadeOut(300);$("#mapfullscreen").css("right","6px")});$("#map-search-maximize").bind("click",function(d){showMapSearch()});var a=($("meta[name=geonomap]").attr("content")==1);var b=getJSPerformance();if(window.location.href.indexOf("mapstate=")!=-1||(mapEnabled&&!a&&$(window).height()>660&&b>4)){loadMap()}else{if(!a){$("#mapactions-text").html("<div style='color: green; font-size: 10px;'>Karte einblenden?</div>")}}$("a[rel=colorbox]").colorbox({transition:"elastic",speed:250,current:"{current} von {total}"});$().bind("cbox_open",function(){$("#adzone2").hide()});$().bind("cbox_closed",function(){$("#adzone2").show()})})}function getPageUri(){var a=null;if(window.location.hash!=""&&window.location.hash.substr(0,2)=="#/"){a="http://"+window.location.hostname+window.location.hash.substr(1)}else{a=window.location.href}return a}function getJSPerformance(){if(typeof getJSPerformance.jsindex=="undefined"){var d=new Date();var a=d.getTime();for($i=0;$i<25;$i++){var b=$("div").length}var c=new Date();var e=c.getTime()-a;getJSPerformance.jsindex=Math.round(1/(e/b))}return getJSPerformance.jsindex}function loadMap(b){if(!b&&!$.cookie("skipSpeedCheck")){var a=getJSPerformance();if(a<8){Infobar.show("Bei älteren Internetbrowsern ist die Navigation möglicherweise eingeschränkt. <a href='' onclick='Infobar.hide(); loadMap(true); return false;'>Trotzdem einblenden?</a>");return false}}else{$.cookie("skipSpeedCheck",true)}$("#home_header").hide("blind",{},400,function(){$("#home_header").remove()});$("#map").height(mapHeight);$("#map").show("blind",{},400);if(!apiLoaded){$.getScript("http://www.google.com/jsapi?key="+gMapKey,loadMapsAPI)}else{setupMap()}return true}function loadMapsAPI(){google.load("maps","2.s",{callback:loadLibs})}function loadLibs(){$.getScript("/include/js/map/gmap-libs.js",loadBergfexMapType)}function loadBergfexMapType(){$.getScript("/include/js/map/bergfexmaptype.js",loadOsmMapType)}function loadOsmMapType(){$.getScript("/include/js/map/osmmaptype.js",loadBergfexMap)}function loadBergfexMap(){$.getScript("/include/js/map/bergfexmap.js",setupMap)}function setupMap(){if(typeof(BergfexMap)=="undefined"){return}$("#mapaction_help,#mapaction_link,#mapaction_up,#mapaction_down,#mapaction_full,#mapaction_close").show();$(".map_enable").hide();bergfexMap=new BergfexMap("map_canvas","map");bergfexMap.setResizable(true);bindLinks();$.post("/ajax/cookies/",{bergfexMapEnabled:"true"});$(document).trigger("maploaded");return false}function unloadMap(a){if(a===undefined){a=true}GUnload();$(".map_enable").show();$("#mapaction_help,#mapaction_link,#mapaction_up,#mapaction_down,#mapaction_full,#mapaction_close").hide();$("a[href!=]").unbind("click");$("a[href!=]").each(function(){if(jQuery.isFunction(this.onclick)&&this.onclick.toString().indexOf("loadPage")!=-1){this.onclick=null}});bergfexMap.unload();bergfexMap=null;if(a){$.post("/ajax/cookies/",{bergfexMapEnabled:"false"})}$("#map").hide("blind",{},500);return false}function loadTrack(type,id){if(bergfexMap!=null&&bergfexMap.isLoaded()&&!bergfexMap.isOverlayLoaded(type+id)){$.getScript("/ajax/gmap/gpx/?type="+type+"&id="+id,function(data,textStatus){eval(data);if(typeof trackpoints!="undefined"){var polyline=new GPolyline(trackpoints,"#ff0000",4);bergfexMap.addOverlay(type+id,polyline)}})}else{$(document).bind("maploaded",function(){loadTrack(type,id)})}}function toggleMap(){effect="blind";if($("#map").is(":visible")){$("#map").hide(effect,{},600);$("#togglemap").html("einblenden");document.title="Karte ausgeblendet"}else{$("#map").show(effect,{},600);$("#togglemap").html("ausblenden");document.title="Karte eingeblendet"}}function posMapSearch(b,a){$("#map-search-result-container").hide("slide",{direction:"right"},200);$("#map-search-result-minimized").show();$("#mapfullscreen").css("right","20px");window.setTimeout(function(){setTarget(b,a,13,"b")},300)}function setTarget(d,b,c,a){if(bergfexMap==null){$().bind("maploaded",function(){setTarget(d,b,c,a);if($(window).scrollTop()>120){window.scrollTo(0,$("#map").position().top)}});loadMap()}else{bergfexMap.setCenter(new GLatLng(d,b),c);bergfexMap.setTarget(new GLatLng(d,b));if(typeof a!="undefined"){bergfexMap.setMapTypeById(a)}if($(window).scrollTop()>120){window.scrollTo(0,$("#map").position().top)}}return false}function showMapSearch(){$("#map-search-result-minimized").hide();$("#mapfullscreen").css("right","6px");$("#map-search-result-container").show("slide",{direction:"right"},300)}function sortByDistance(d,c){if(d.distance>c.distance){r=1}else{if(d.distance<c.distance){r=-1}else{r=0}}return r}function doMapSearch(){var a=document.mapsearch.q.value;if(a!=""){$.post("/ajax/gmap/names/",{q:a},function(c){var f=c.data;$("#map-search-result-container").fadeIn(500);$("#map-search-result-minimized").hide();$("#mapfullscreen").css("right","6px");var d="";if(c.count==0){d="<div class='h2'>Keine Eintr&auml;ge gefunden.</h2>"}else{if(c.count>300){d="<div class='h2'>Es wurden "+c.count+" Eintr&auml;ge gefunden. Bitte Suche verfeinern.</h2>"}else{var e=[];if(bergfexMap.map.getZoom()>12){var e=[];for(i=0;i<f.length;i++){var g=f[i];var b=bergfexMap.map.getCenter();g.distance=b.distanceFrom(new GLatLng(g.GeoBreite,g.GeoLaenge));if(g.distance<25000){e.push(g)}}e.sort(sortByDistance)}if(e.length>0){d="<div class='h2'>Lokale Suchergebnisse (Entfernung < 25km)</div>";for(i=0;i<e.length;i++){d+=getMapSearchLine(e[i])}}d+="<div class='h2'>Alle "+c.count+" Suchergebnisse</div>";for(i=0;i<f.length;i++){d+=getMapSearchLine(f[i])}}}$("#map-search-result").html(d)},"json")}return false}function getMapSearchLine(b){var a="<div class='map-search-line'>";a+="<a href='' onclick='posMapSearch("+b.GeoBreite+","+b.GeoLaenge+"); ";if(b.Link){a+='loadPage("'+b.Link+'");'}a+="return false; '>"+b.Name+"</a>";if(b.Region){a+=" <span class='region'>("+b.Region+")</span>"}a+=" - <span class='type'>";if(b.Seehoehe&&b.Seehoehe!=0){a+=" "+b.Seehoehe+"m - "}a+=b.Typ+"</span>";a+="</div>";return a}function loadPage(a){if(a.match(/(link|images|shop|login)/)){location.href=a;return true}var b=a.replace(/http:\/\/[^\/]*/,"");jssm.setHash(b);bergfexMap.setFullscreen(false);return false}function getPage(a){$("#loading-indicator").show();$.post(a,{isAjax:1},function(g,c){var d=new RegExp("<title>([^<]*)</title>");var f=d.exec(g);if(f!==null){document.title=f[1]}var h=getMetaData("geoposition",g);var b=getMetaData("geocontext",g);var k=getMetaData("geonomap",g);var j=getMetaData("geotarget",g);if(h&&(h!=0)){bergfexMap.setPosition(h,b,j)}if(k==1){unloadMap(false)}var l=g.substring(g.indexOf("<!--page-top-->"),g.indexOf("<!--/page-top-->")-1);var e=g.substring(g.indexOf("<!--page-bottom-->"),g.indexOf("<!--/page-bottom-->")-20);if(l&&e){$("#page-top").html(l);$("#page-bottom").html(e);if(k!=1){bindLinks()}}else{window.location.href=a}$("a[class*=lightbox]").lightBox();$("a[rel=colorbox]").colorbox({transition:"elastic",speed:250,current:"{current} von {total}"});addMetaData("geocontext",b);addMetaData("geotarget",j);addMetaData("geonomap",k);addMetaData("geoposition",h);$("#loading-indicator").hide()});if(bergfexMap!==null){bergfexMap.setFullscreen(false)}return false}function bindLinks(a){if(typeof a=="undefined"){a=""}else{a+=" "}$(a+"a[href^='/'],a[href*='"+location.hostname+"']").not("[href*=/link/]").not("[class=lightbox]").not("[rel=nojs]").not("[href*=/shop/]").not("[rel=colorbox]").not("[href*=/login/]").jssm("click")}function getMetaData(b,c){var a=false;var d=new RegExp('meta name="'+b+'" content="([^"]*)">');var e=d.exec(c);if(e!=null){a=e[1]}return a}function addMetaData(a,b){if(b===false){b=0}if(b===true){b=1}if($("meta[name="+a+"]").length==0){$("head").append('<meta name="'+a+'" content="">')}$("meta[name="+a+"]").attr({content:b})}function on(c){if(document.images){regexp=/(\/on\/)+/gi;path=document[c].src.replace(regexp,"/");var a=path.split("/");a[a.length-1]="on/"+a[a.length-1];path=a.join("/");var b=new Image();b.src=path;document[c].src=path}}function off(b){if(document.images){regexp=/(\/on\/)+/gi}path=document[b].src.replace(regexp,"/");var a=new Image();a.src=path;document[b].src=path}function switchTeaserDetail(a){divDetail=document.getElementById(a+"_detail");divTeaser=document.getElementById(a+"_teaser");if(divDetail){divDetail.style.display="block"}if(divTeaser){divTeaser.style.display="none"}}function switchImage(b,c){if(document.images){var a=new Image();a.src=c;document[b].src=c}}function search_focus(b,a){if(b.defaultValue==null){b.defaultValue=b.value}if(b.value==b.defaultValue){b.value=""}b.onblur=function(){search_blur(this,a)};b=null;document.getElementById(a).className="focused"}function search_blur(b,a){if(b.value==""){b.value=b.defaultValue}b.onblur=null;b.onkeydown=null;document.getElementById(a).className=""}function searchbutton_focus(b,a){document.getElementById(a).className="focused";b.onblur=function(){search_blur(this,a)}}function searchbutton_blur(b,a){document.getElementById(a).className="focused";b.onblur=null}function getAjaxAdByZone(d,a){var b=new Date();var c="http://openx.bergfex.at/delivery/jsonp.php?zoneid="+d+"&source="+a+"&loc="+escape(window.location)+"&ts="+b.getTime()+"&isAjax=1&jsoncallback=?";if(!$.browser.opera){$.getJSON(c,function(e,h){if(e.html.length>0){if(d==5){$("#adzone"+d).html(e.html);$("#adzone"+d).show()}else{var f=e.cache;if(e.html.substring(0,7)=="adsense"){f=getPageUri();if(f.indexOf("?")!=-1){f=f.substring(0,f.indexOf("?"))}var g=e.html.substring(8,28);f+="?adsense="+g+"&nolog"}$("#adzone"+d).show();$("#adzone"+d).append('<iframe id="iframe'+d+'" marginwidth="0" marginheight="0" scrolling="no" frameborder="0"></iframe>');$("#iframe"+d).attr({src:f,width:e.width,height:e.height})}}})}}$(document).ready(function(){$("div[id^=adzone]").each(function(){if($(this).width()>0){$(this).show()}})});