﻿    function initialize() {      if (GBrowserIsCompatible()) {              map = new GMap2(document.getElementById("map_canvas"));        gdir = new GDirections(map, document.getElementById("directions"));        GEvent.addListener(gdir, "error", handleErrors);		geocoder = new GClientGeocoder();			  if (geocoder) {        geocoder.getLatLng(address, function(point) {            if (!point) {              alert(address + " not found");            } else {              map.setCenter(point, 17);              map.enableDoubleClickZoom();    	      map.enableScrollWheelZoom();                     	      map.enableContinuousZoom();              map.addControl(new GMapTypeControl());              map.addControl(new GLargeMapControl());	      map.addControl(new GScaleControl());               var marker = new GMarker(point, markerOptions);              map.addOverlay(marker);            }          }        );      }      }    }        function setDirections(fromAddress) {      gdir.load("from: " + fromAddress + " to: " + address, "locale: de_DE" );	  return false;    }    	function getPoint(address) {	  geocoder.getLatLng(	    address,	    function(point) {	      if (!point) {	        alert(address + " nicht gefunden");	      } else {	        return point;	      }	    }	  );	}	    function handleErrors(){	   if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)	     alert(unescape("Die eingegebene Adresse wurde nicht gefunden. Bitte vergewissere dich%2C dass du sie auch richtig geschrieben hast. Das ben%F6tigte Format lautet%3A Strasse%2C Hausnummer%2C Stadt"));	   else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)	     alert(unescape("Server Fehler. Wom%F6glich sind die Google-Server gerade %FCberlastet"));	   	   else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)	     alert("Bitte gebe eine Adresse ein!");	//   else if (gdir.getStatus().code == G_UNAVAILABLE_ADDRESS)  <--- Doc bug... this is either not defined, or Doc is wrong	//     alert("The geocode for the given address or the route for the given directions query cannot be returned due to legal or contractual reasons.\n Error code: " + gdir.getStatus().code);	     	   else if (gdir.getStatus().code == G_GEO_BAD_KEY)	     alert(unescape("Server Fehler. Wom%F6glich sind die Google-Server gerade %FCberlastet"));	   else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)	     alert(unescape("Server Fehler. Wom%F6glich sind die Google-Server gerade %FCberlastet"));	    	   else alert(unescape("Server Fehler. Wom%F6glich sind die Google-Server gerade %FCberlastet"));	   	}		function showAddress(address) {      if (geocoder) {        geocoder.getLatLng(          address,          function(point) {            if (!point) {              alert(address + " nicht gefunden");            } else {              map.setCenter(point, 17);              var marker = new GMarker(point, markerOptions);              map.addOverlay(marker);            }          }        );      }    }
