	   Event.observe(window, 'load',function(){
	    	googleMaps();	    
	     });
	    
	    Event.observe(window, 'unloaded', function(){
	    	GUnload();
	    
	    });
	    
	    var map;
	    var geocoder;
	
	    function showMap() {
	      map = new GMap2(document.getElementById("map"));
		  map.addControl(new GMapTypeControl());
		  map.addControl(new GLargeMapControl());
		  map.setCenter(new GLatLng(52.359516, 4.901274), 16);
		  map.setMapType(G_HYBRID_MAP);
		  //map.setMapType(G_NORMAL_MAP);
	 	  geocoder = new GClientGeocoder();
	    }
	
	    // addAddressToMap() is called when the geocoder returns an
	    // answer.  It adds a marker to the map with an open info window
	    // showing the nicely formatted version of the address and the country code.
	    function addAddressToMap(response) {
	      map.clearOverlays();
	      if (!response || response.Status.code != 200) {
	        alert("Sorry, we were unable to geocode that address");
	      } else {
	        place = response.Placemark[0];
	        point = new GLatLng(place.Point.coordinates[1],
	                            place.Point.coordinates[0]);
		  	map.setCenter(point, 16);
		  	marker = new GMarker(point);
	        map.addOverlay(marker);
	        var html = '<div style="width: 190px; height: 30px; padding-right: 0px;"><strong>Net Effect Holding BV</strong><br />Voer de vier cijfers van uw postcode in.<form action="javascript:doRoute();" name="form"><input type="text" name="postcode" value="1111" size="5" maxlength="4" \/><input type="button" name="button" value="Route" onclick="javascript:doRoute();" \/><\/form><\/div>'
	        marker.openInfoWindowHtml(html);
	      }
	    }
		
		function doRoute() {
				document.forms.route.saddr.value = document.forms.form.postcode.value;
				document.forms.route.submit();
			}
		 
		 // findLocation() is used to enter the sample addresses into the form.
		 function findLocation(address) {
			  geocoder.getLocations(address, addAddressToMap);
			}
		
		 function googleMaps() {
		    	showMap();
		    	findLocation(document.forms.route.daddr.value);
		    	
		    }
	 