    var map;
    var geocoder;
    var markers;
    var address = "Fritz-Kirsch-Zeile 8, Berlin";
    var toAddress =  address;
    var fromAddress;

    var info = '<h3><span style="color:red">javanita<\/span> <span style="color:grey">engineering<\/span><\/h3>Ingenieurbüro A.Krüger';

  function makeMarker(){
         var baseIcon = new GIcon();
         baseIcon.iconSize = new GSize(27, 27);
         baseIcon.iconAnchor = new GPoint(9, 34);
         baseIcon.infoWindowAnchor = new GPoint(9, 2);

         var myIcon = new GIcon(baseIcon);
         myIcon.image = "/images/red.png";

       // Set up our GMarkerOptions object
       	markerOptions = { icon:myIcon };
         return markerOptions ;
  }

   // On page load, call this function
   function initialize()
   {

      // Create new map object
      map = new GMap2(document.getElementById("map_canvas"));

      // Create new geocoding object
      geocoder = new GClientGeocoder();
      geocoder.getLocations(address, addToMap);

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

   // This function adds the point to the map

   function addToMap(response)
   {
      // Retrieve the object
      place = response.Placemark[0];

      // Retrieve the latitude and longitude
      point = new GLatLng(place.Point.coordinates[1],
                          place.Point.coordinates[0]);
      lat =  place.Point.coordinates[1];
      lng =  place.Point.coordinates[0];

      map.setCenter(point, 13);
      map.addControl(new GSmallMapControl());
      map.addControl(new GMapTypeControl());
      var custommarker = makeMarker();

      // Create a marker
      marker = new GMarker(point, custommarker);

      // Add the marker to map
      map.addOverlay(marker);
     marker.openInfoWindowHtml(info);
   }

   // Ausgangspunkt setzen
   function setFromaddress(street, number, place){
         fromAddress = street + " " + number +"," + place;
         setDirections(fromAddress, toAddress, "de_DE")
   }
   // Routenbetrechnungsfunktionen
   function setDirections(fromAddress, toAddress, locale) {
      gdir.load("from: " + fromAddress + " to: " + toAddress,
                { "locale": locale });
    }

    function handleErrors(){
           if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
alert("Adresse existiert nicht (evtl. mit Latitude und Longitude versuchen)!\n Fehler: " + gdir.getStatus().code);
else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
alert("Adresse wurde nicht gefungen (evtl. mit Latitude und Longitude versuchen)!\n Fehler: " + gdir.getStatus().code);

else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
alert("Adresse vollständig angeben!\n Fehler: " + gdir.getStatus().code);

else if (gdir.getStatus().code == G_GEO_BAD_KEY)
alert("Google Maps API Key nicht gültig! Bitte nicht kopieren! Key kann auf http://www.google.com/apis/maps/signup.html beantragt werden! \n Fehler: " + gdir.getStatus().code);
else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
alert("Fehler bei der Berechnung. Bitte nochmal versuchen!\n Fehler: " + gdir.getStatus().code);

else alert("Unbekannter Fehler!\n Fehler: " + gdir.getStatus().code);
     }

      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...

     }