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

    function initialize() {
      if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map_canvas"));
        gdir = new GDirections(map, document.getElementById("directions"));
        GEvent.addListener(gdir, "load", onGDirectionsLoad);
        GEvent.addListener(gdir, "error", handleErrors);


        map.setCenter(new GLatLng(51.395656,3.571000), 15);
		map.openInfoWindow(map.getCenter(),"<span style='color:#000000'>Jachthaven Breskens<br />Oosthavendam 1<br />4511 AZ Breskens<br />Nederland</span>");

		var mapControl = new GMapTypeControl();
map.addControl(mapControl);
map.addControl(new GLargeMapControl());

      }
    }

    function setDirections(fromAddress, toAddress, locale) {
      gdir.load("from: " + fromAddress + " to: " + toAddress ,
                { "locale": locale });
    }

    function handleErrors(){
	   if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
	     alert("Geen adres gevonden. Controleer of het adres juist is ingevoerd.\nError code: " + gdir.getStatus().code);
	   else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
	     alert("Een goede berekening kon niet worden gemaakt, de precieze reden daarvan is niet bekend, neem contact op met helpdesk@vinto.nl.\n Error code: " + gdir.getStatus().code);

	   else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
	     alert("U heeft geen waarde ingevoerd, om een routebeschrijving te maken moet u een adres ingeven.\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("De api sleutel klopt niet, neem aub contact op met info@agrods.nl. \n Error code: " + gdir.getStatus().code);

	   else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
	     alert("De routebeschrijving kon niet worden gemaakt.\n Error code: " + gdir.getStatus().code);

	   else alert("Een onbekende fout heeft plaatsgevonden, neem aub contact op met helpdesk@vinto.nl");

	}

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

