    var map;
    var gdir;
    var geocoder = null;
    var addressMarker;

    function load() {
      if (GBrowserIsCompatible()) {      
        map = new GMap2(document.getElementById("keyvisual"));

        gdir = new GDirections(map, document.getElementById("directions"));
        GEvent.addListener(gdir, "load", onGDirectionsLoad);
        GEvent.addListener(gdir, "error", handleErrors);

        //setDirections("San Francisco", "Mountain View", "en_US");
        
        geocoder = new GClientGeocoder();
        map.addControl(new GLargeMapControl());
    map.addControl(new GMapTypeControl());
    showAddress("Emil-Figge-Straße 76-80,Dortmund,Deutschland", "getit GmbH<br>Emil-Figge-Straße 76-80<br>44227&nbsp;Dortmund</p>");
      }
    }
    
    function setDirections(fromAddress, toAddress, locale) {
      gdir.load("from: " + fromAddress + " to: " + toAddress,
                { "locale": "de" });
    }
    
    function showAddress(address, popUpHtml) {
      if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (!point) {
              alert(address + " nicht gefunden");
            } else {
              map.setCenter(point, 13);
              var marker = new GMarker(point);
              map.addOverlay(marker);
              marker.openInfoWindowHtml(popUpHtml);
            }
          }
        );
      }
    }

    function handleErrors(){
    if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
      alert("Start- oder auch Zieladresse konnten nicht gefunden werden. Entweder sind sie nicht bekannt, nicht eindeutig oder die Eingabe ist nicht korrekt. Bitte überprüfen Sie die Eingabe.\nError code: " + gdir.getStatus().code);
    else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
      alert("Die Route konnte nicht berechnet werden.\n Error code: " + gdir.getStatus().code);
    
    else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
      alert("Bitte geben Sie eine Startadresse ein.\n Error code: " + gdir.getStatus().code);

//   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("Falscher Google Maps Key. \n Error code: " + gdir.getStatus().code);

    else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
      alert("Die Anfrage konnte nicht geparsed werden.\n Error code: " + gdir.getStatus().code);
     
    else alert("Unbekannter Fehler. Bitte überprüfen Sie die Eingabe.");
    
}

function onGDirectionsLoad(){ 
          // Use this function to access information about the latest load()
          // results.

          // e.g.
   // document.getElementById("getStatus").innerHTML = gdir.getStatus().code;
   // and yada yada yada...
}

