function checkPointCategory(e,a,t){if($(e).prop("checked"))var o="on";else o="off";setSession(a,o),"on"==o?addLayer(a):removeLayer(a)}function checkPointType(e,a,t){if($(e).prop("checked"))var o="on";else o="off";setSession(a,o),"on"==o?addLayer(a):removeLayer(a)}function setSession(e,a){$.ajax({url:"/ajax.action.php?n="+e+"&v="+a})}function addLayer(e){removeLayersFromMap(),removeLayer(e),activelayers[activelayers.length]=new Array(e,markers[e]),addLayersToMap()}function removeLayer(e){removeLayersFromMap();for(var a=new Array,t=0;t]+)>)/gi,"").split(">"),t=new Array,o=a.length-1;0<=o;o--)t[t.length]=a[o];document.title=t.join(", ")})}function viewInfo(){$("#map_info").dialog({width:640,position:["center","bottom"]}),$("#map_info").css("top","1px")}function giraffe_onstart(){$("#searchform").submit(function(){return $("#searchform input").blur(),$.ajax({url:"/ajax.search.php?search="+$("#searchform input").val()}).done(function(e){$("#map_header span").html($("#searchform input").val()),$("#map_info").html(""),$("#searchresult").html(e),openmain()}),!1}),$("#linkto").click(function(){$(this).select()}),$("#infolink input").click(function(){$(this).select()}),$("#menulink").click(function(){return"none"==$("#menu").css("display")?$("#menu").show("slow"):$("#menu").hide("slow"),!1})}function giraffe_onstart_async(){try{giraffe_onstart()}catch(e){console.log("onstart"),window.setTimeout("giraffe_onstart();",300)}}function switchmap(e,a){mapstart(),maptype=e,map.eachLayer(function(e){try{e.setUrl("dummy"),map.removeLayer(e)}catch(e){}}),"experimental"==e?L.tileLayer("http://www.kartogiraffe.de/tiles/tile6.php?nocache=1&zoom={z}&x={x}&y={y}&type="+e,{attribution:'© OpenStreetMap contributors | Impressum / Imprint '}).addTo(map).bringToBack():e?L.tileLayer("http://www.kartogiraffe.de/tiles/tile.php?zoom={z}&x={x}&y={y}&type="+e,{attribution:'© OpenStreetMap contributors | Impressum / Imprint '}).addTo(map).bringToBack():L.tileLayer("http://www.kartogiraffe.de/tiles/tile.php?zoom={z}&x={x}&y={y}",{attribution:'© OpenStreetMap contributors | Impressum / Imprint '}).addTo(map).bringToBack(),a&&$("#menu").hide("slow")}function getDistanceFromLatLon(e,a,t,o){var r=deg2rad(t-e),n=deg2rad(o-a),i=Math.sin(r/2)*Math.sin(r/2)+Math.cos(deg2rad(e))*Math.cos(deg2rad(t))*Math.sin(n/2)*Math.sin(n/2);return 6371e3*(2*Math.atan2(Math.sqrt(i),Math.sqrt(1-i)))}function deg2rad(e){return e*(Math.PI/180)}function geolocationHA(){if(mapstart(),gps_watchposition)return gps_watchposition=!1,gps_off=!0,$(".gps_spin").removeClass("w3-spin"),$(".kartospeed").html(""),void navigator.geolocation.clearWatch(geolocator_watchHA);$(".gps_spin").addClass("w3-spin"),geolocator_watchHA=navigator.geolocation.watchPosition(geolocation_new_position,geolocationLA,{enableHighAccuracy:!0,timeout:3e4,maximumAge:3e4})}function geolocationLA(e){mapstart(),geolocator_watchLA=navigator.geolocation.getCurrentPosition(geolocation_new_position,geoposition_error)}function geolocation_new_position(e){if(!gps_off||(gps_watchposition=!1,gps_off=!1,!geolocator_watchHA)){L.GiraffeMarkers.icon({icon:"coffee",markerColor:"gray",character:" "});try{map.removeLayer(positionmarker)}catch(e){}if(lastposition){var a=getDistanceFromLatLon(lastposition.coords.latitude,lastposition.coords.longitude,e.coords.latitude,e.coords.longitude),t=(new Date).getTime(),o=Math.round(3600*a/(t-lastpositiontime));o=100"+Math.round(.621371*o)+" mph")}lastposition=e,lastpositiontime=(new Date).getTime();try{"1"==$("#haperm").val()&&!0}catch(e){}positionmarker=L.marker([e.coords.latitude,e.coords.longitude]).addTo(map),map.panTo([e.coords.latitude,e.coords.longitude]),closemain(),gps_watchposition=!0;try{if("1"==$("#haperm").val()){window.setTimeout("geolocationHAperm(true);",5e3),hapoints[hapoints.length]=[e.coords.longitude,e.coords.latitude];var r={type:"Feature",geometry:{type:"LineString",coordinates:hapoints}};L.geoJSON(r,{style:{color:"#000000",weight:2,opacity:1}}).addTo(map)}else hapoints=new Array}catch(e){alert(e)}$("#menu").hide("slow")}}function geolocationHAperm(e){e||("1"==$("#haperm").val()?($("#haperm").val("0"),$("#map_switch_geolocation_perm").removeClass("w3-black").addClass("w3-light-gray")):($("#haperm").val("1"),$("#map_switch_geolocation_perm").addClass("w3-black").removeClass("w3-light-gray")),hapermid||(hapermid=Math.round(1e7*Math.random()))),"1"==$("#haperm").val()&&geolocationHA()}function geoposition_error(e){if(1==e.code){var a=!1,t=location.hostname.split(".");"www"==t[0]&&(a=!0),t[0]="www",t=t.join(".");var o=document.location.href;o.search("#")&&(o=(o=o.split("#"))[0]),o=(o=o.replace(location.hostname,t)).replace("http://",""),console.log(o),a||(o=4<(o=o.split("/")).length?(o.pop(),o.pop(),o.join("/")+"/"):o.join("/")),document.location.href="https://"+o+"#gps"}else 2==e.code?alert("Position unavailable."):3==e.code?alert("Timeout expired."):alert("ERROR:"+e.message);$("#menu").hide("slow")}function checkPointCategory(e,a,t){if($(e).prop("checked"))var o="on";else o="off";setSession(a,o),"on"==o?addLayer(a):removeLayer(a)}function checkPointType(e,a,t){if($(e).prop("checked"))var o="on";else o="off";setSession(a,o),"on"==o?addLayer(a):removeLayer(a)}function setSession(e,a){$.ajax({url:"/ajax.action.php?n="+e+"&v="+a})}function addLayer(e){removeLayersFromMap(),removeLayer(e),activelayers[activelayers.length]=new Array(e,markers[e]),addLayersToMap()}function removeLayer(e){removeLayersFromMap();for(var a=new Array,t=0;t