function load() {
	var directionsPanel;

	if (GBrowserIsCompatible()) {
		var map = new GMap2(document.getElementById("map"));
		var geocoder = new GClientGeocoder();
		//geocoder.setBaseCountryCode("NL");
		
		//add controls
		map.addControl(new GMapTypeControl());
		map.addControl(new GSmallMapControl());
		map.setCenter(new GLatLng(52.598582, 4.759862), 12);
		
		//create randomnumber to prevent caching and retrieve xml file
		var randomnumber=Math.floor(Math.random()*11111)
		GDownloadUrl("locations.xml?random="+randomnumber, function(data, responseCode) {
			var xml = GXml.parse(data);

			//store markers in markers array
			var markers = xml.documentElement.getElementsByTagName("marker");

			// create marker icon
			var icon = new GIcon();
			icon.image = "http://test.anematrucks.nl/images/google_anema.png";
			icon.iconSize = new GSize(200, 65);
			icon.iconAnchor = new GPoint(175, 60);
			icon.infoWindowAnchor = new GPoint(5, 1);

			//loop over the markers array
			for (var i = 0; i < markers.length; i++) {
				var address = markers[i].getAttribute("address");
				var html = markers[i].getAttribute("html");
				showAddress(map,geocoder,address,html,icon);
			}
	}

		);
		function createMarker(point,html,icon){
		  var marker = new GMarker(point, icon);
		  GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html);});
          
			//GEvent.addListener(marker, "click", function() {marker.openInfoWindowHtml(html);});
			//GEvent.addListener(marker, "click", function() {marker.openInfoWindowHtml(html,{maxUrl:"/google/details_alkmaar.html"});});
			return marker;
		}
		function showAddress(map,geocoder,address,html,icon) {
			geocoder.getLatLng(address, function(point) {
		      	if (!point) {
					alert(address + " niet gevonden");
				} else {
					var marker = createMarker(point,html+'<br/><br/>'+address,icon);
					map.addOverlay(marker);
					map.addControl(new GMapTypeControl());


					directionsPanel = document.getElementById("routelink");
					directionsPanel.innerHTML += "<a href='http://maps.google.com/maps?daddr=" + point.lat() + "," + point.lng() + "' target='_blank'>Click here for the directions</a>"
          //directions = new GDirections(map, directionsPanel);
          //directions.load("from: 500 Memorial Drive, Cambridge, MA to: 4 Yawkey Way, Boston, MA 02215 (Fenway Park)");

					
				}
			});
		}
	} //close GBrowserIsCompatible
} //close load
