var map;var baseIcon;var geocoder;var marker;function load(){if(GBrowserIsCompatible()){map=new GMap2(document.getElementById("map"));baseIcon=new GIcon();baseIcon.shadow="http://www.google.com/mapfiles/shadow50.png";baseIcon.iconSize=new GSize(15,26);baseIcon.shadowSize=new GSize(26,26);baseIcon.iconAnchor=new GPoint(7,26);baseIcon.infoWindowAnchor=new GPoint(9,2);baseIcon.infoShadowAnchor=new GPoint(18,25);geocoder=new GClientGeocoder();map.setCenter(new GLatLng(50.733608,7.097952),10);map.addControl(new GLargeMapControl());map.addControl(new GMapTypeControl());map.addControl(new GOverviewMapControl());map.enableContinuousZoom();map.enableDoubleClickZoom()}}function findAddress(a){if(marker!=null){map.removeOverlay(marker)}if(geocoder){geocoder.getLatLng(a,function(b){if(!b){alert(a+" nicht gefunden")}else{marker=new GMarker(b,{clickable:true,draggable:true});info="<br /><b>"+a+"</b><br />Geocode: "+marker.getPoint().toUrlValue();newpoint=marker.getPoint();lonDMS=Math.floor(newpoint.x)+"\u00b0 "+Math.floor((newpoint.x-Math.floor(newpoint.x))*60)+"' "+(((newpoint.x-Math.floor(newpoint.x))*60)-Math.floor((newpoint.x-Math.floor(newpoint.x))*60))*60+'"';latDMS=Math.floor(newpoint.y)+"\u00b0 "+Math.floor((newpoint.y-Math.floor(newpoint.y))*60)+"' "+(((newpoint.y-Math.floor(newpoint.y))*60)-Math.floor((newpoint.y-Math.floor(newpoint.y))*60))*60+'"';re=/(\.\d{4})\d+/g;latDMS=latDMS.replace(re,"$1");lonDMS=lonDMS.replace(re,"$1");latDeg=newpoint.y.toFixed(6);lonDeg=newpoint.x.toFixed(6);document.getElementById("geocoord").value=latDeg+", "+lonDeg;document.getElementById("geoxml").value='lat="'+latDeg+'" lon="'+lonDeg+'"';document.getElementById("latdeg").value=latDeg;document.getElementById("londeg").value=lonDeg;document.getElementById("latdms").value=latDMS;document.getElementById("londms").value=lonDMS;GEvent.addListener(marker,"dragend",function(){newpoint=marker.getPoint();info="<br /><b>"+a+"</b><br />Geocode (<i>modifiziert</i>): "+marker.getPoint().toUrlValue();lonDMS=Math.floor(newpoint.x)+"\u00b0 "+Math.floor((newpoint.x-Math.floor(newpoint.x))*60)+"' "+(((newpoint.x-Math.floor(newpoint.x))*60)-Math.floor((newpoint.x-Math.floor(newpoint.x))*60))*60+'"';latDMS=Math.floor(newpoint.y)+"\u00b0 "+Math.floor((newpoint.y-Math.floor(newpoint.y))*60)+"' "+(((newpoint.y-Math.floor(newpoint.y))*60)-Math.floor((newpoint.y-Math.floor(newpoint.y))*60))*60+'"';re=/(\.\d{4})\d+/g;latDMS=latDMS.replace(re,"$1");lonDMS=lonDMS.replace(re,"$1");latDeg=newpoint.y.toFixed(6);lonDeg=newpoint.x.toFixed(6);document.getElementById("geocoord").value=latDeg+", "+lonDeg;document.getElementById("geoxml").value='lat="'+latDeg+'" lon="'+lonDeg+'"';document.getElementById("latdeg").value=latDeg;document.getElementById("londeg").value=lonDeg;document.getElementById("latdms").value=latDMS;document.getElementById("londms").value=lonDMS;marker.openInfoWindowHtml(info);GEvent.addListener(marker,"click",function(){marker.openInfoWindowHtml(info)})});GEvent.addListener(marker,"click",function(){marker.openInfoWindowHtml(info)});map.panTo(b);map.setCenter(b,13);map.addOverlay(marker);marker.openInfoWindowHtml(info)}})}};
