    var map;
    var gdir;
    var geocoder = null;
    var addressMarker;
		var marker;  
//		var marker = new GMarker(point);  


    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);
				// positie Gendt, laatste getal staat voor zoomdiepte
				map.setCenter(new GLatLng(51.888862, 5.849061), 12);
				// positie marker
				var point = new GLatLng(51.888862, 5.849061);

				map.addOverlay(createMarker(point));
				// Text in marker

				return marker;
			}
    }

function createMarker(point) {  
// Create our "tiny" marker icon
        var blueIcon = new GIcon(G_DEFAULT_ICON);
        blueIcon.image = "http://www.barenbrug.nl/images/blank.png";
		
		// Set up our GMarkerOptions object
		markerOptions = { icon:blueIcon };
				// Klik optie voor marker
var marker = new GMarker(point,markerOptions);  
var message = ["This","is","the","secret","message"];  
//marker.value = "R";  
GEvent.addListener(marker, "click", function() {    
var myHtml = "Barenbrug Holding B.V.<br/>Stationsstraat 40<br/>NL-6679 AD OOSTERHOUT GEM NIJMEGEN<br/>Telefoon: +31 (0) 24-3488100<br/>Fax +31 (0) 186-655040<br/>E-Mail <a href='mailto:info@barenbrug.com'>info@barenbrug.com</a><br/><img src='http://www.barenbrug.nl/images/logo_google.gif'/>";    
map.openInfoWindowHtml(point, myHtml);  });  return marker;
}
    
    function setDirections(fromAddress, toAddress, locale) {
      gdir.load("from: " + fromAddress + " to: " + toAddress,
                { "locale": locale });
    }

    function handleErrors(){
	   if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
	     alert("Er kan geen plaats gevonden worden. U heeft waarschijnlijk geen juist adres ingevoerd. \nError code: " + gdir.getStatus().code);
	   else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
	     alert("Er is een fout opgetreden.\n Error code: " + gdir.getStatus().code);
	   
	   else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
	     alert("Vul aub een adres in.\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("The given key is either invalid or does not match the domain for which it was given. \n Error code: " + gdir.getStatus().code);

	   else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
	     alert("A directions request could not be successfully parsed.\n Error code: " + gdir.getStatus().code);
	    
	   else alert("Er heeft zich een fout voor gedaan.");
	   
	}

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