			var map;
			var gdir;
			var geocoder = null;
			var addressMarker;
			var point;
			var locale;
				
			function initialize() 
			{
				if (GBrowserIsCompatible()) 
				{    
					locale = 'nl_NL';
 
					map = new GMap2(document.getElementById("map"));
					gdir = new GDirections(map, document.getElementById("route"));
					GEvent.addListener(gdir, "load", onGDirectionsLoad);
					GEvent.addListener(gdir, "error", handleErrors);
					
					var icon = new GIcon(G_DEFAULT_ICON);
					
					/*map.setCenter(new GLatLng(52.9050596,5.8449072), 13);
					/*point = new GLatLng(52.9050596,5.8449072);
					map.addOverlay(new GMarker(point,icon));*/
					map.addControl(new GLargeMapControl());
					
					geocoder = new GClientGeocoder();
					geocoder.getLocations( $("#gm_adres").val() , addToMap);
					
					map.addMapType(G_NORMAL_MAP);
					map.addMapType(G_SATELLITE_MAP);
					map.addMapType(G_HYBRID_MAP);
					map.addMapType(G_PHYSICAL_MAP);
					
					map.setMapType(G_HYBRID_MAP);
					
					map.addControl(new GMapTypeControl());	
				}
			}
			
			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]);
			    
			      // Create a marker
			      marker = new GMarker(point);
			      map.setCenter(point, 13);

			      // Add the marker to map
			      map.addOverlay(marker);

			  
			   }
			
			function planRoute(fromAddress) {
				map.clearOverlays();
				toAddress = $("#gm_adres").val();
				gdir.load("from: " + fromAddress + " to: " + toAddress, { "locale": locale });		
			}
			
			function handleErrors()
			{
				if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
					alert("Het opgegeven adres kon niet teruggevonden worden, dat kan te wijten zijn aan het feit dat het een recent of onjuist adres is");
				else if (document.getElementById("address").value=="")
					alert('Gelieve een adres op te geven...');
				else 
					alert("Unknow error");
			}
			
			function onGDirectionsLoad()
			{
				//plaats hier acties tijdens het laden van de route
			}

			
			window.onunload = GUnload;
