    function load() {
	  //set initial map conditions, including controls, icon etc.
      map = new google.maps.Map2(document.getElementById("etravelmap"));
	  map.addControl(new google.maps.LargeMapControl());  
	  map.addControl(new google.maps.ScaleControl()); 
	  map.setCenter(new google.maps.LatLng(39.7, -3.6), 5); 
	  geocoder = new google.maps.ClientGeocoder();
	  var etravelicon = new GIcon(G_DEFAULT_ICON);
	  etravelicon.image = "favicon.ico";
	  etravelicon.iconSize = new GSize(16, 16);
	  etravelicon.iconAnchor = new GPoint(8,8);
	  etravelicon.shadowSize = new GSize(0,0);
	  markerOptions = { icon: etravelicon };
	  debugmode = 0;
	  //loadmap structured as a function as it will be rerun when a marker is clicked to load a new list of points
	 function loadmap(url){
	  if (debugmode == 1) {
	  alert("Map, assemble!");
	  }
	  GDownloadUrl(url, function GetJSON(data, responseCode) {
		var markers = eval("(" + data + ")");
		if (debugmode == 1) {
		alert("Processing JSON");
		}
		//doGeocode will geocode a point and then add a marker onto the map. It will process the next point after receiving a result from google for the one it is currently processing. Therefore i is set to 0 initially for it to run against the first point
		i = 0;
		doGeocode(i);
		
		function doGeocode(i) {
			//markers.marker object parameters set to variables so that this function can own closure, otherwise the listener function will fail to work correctly
			var address = markers.marker[i].Location;
			var description = markers.marker[i].description;			
			var image = markers.marker[i].image;
			var zoom = parseInt(markers.marker[i].zoom);
		
			if (debugmode == 1) {
			alert(address+" "+image+" "+zoom);
			}
			
			geocoder.getLocations(address, function dostuff(response){
			
				if (response.Status.code == G_GEO_SUCCESS) {
					place = response.Placemark[0];
					point = new google.maps.LatLng(place.Point.coordinates[1],
										place.Point.coordinates[0]);
					marker = new google.maps.Marker(point, markerOptions);
					marker.tooltip = "<div class='tooltip'>"+address+"</div>";
					map.addOverlay(marker);
					//added to deal with text articles
					if  (description.match(".htm") == ".htm"){
						GDownloadUrl(description, function (data, responsecode){
							getArticle(data);
						});
						function getArticle(data){
							description = data;
							listener(marker, point, description, zoom, address, image);
						}
					}
					else {
						listener(marker, point, description, zoom, address, image);
					}
				}
				
				if (response.Status.code == G_GEO_TOO_MANY_QUERIES) {
					if (debugmode == 1){
						alert("Timeout Reached");
					}
					//not sure if setTimeout works anymore tbh... The script seems to deal with this case gracefully however.
					window.setTimeout(function(){doGeocode(i);},1000);
				}
				
			});
		function listener (marker, point, description, zoom, address, image) {
			google.maps.Event.addListener(marker, "click", function dostuff2 (response) {
			if (debugmode == 1) {
				alert("Listener "+description+zoom);
			}
			var imghtml = "";
			if (image != "") {
				imghtml = "<img src= \""+image+" \"width=\"200\" height=\"132\" class=\"thumbnail_right\" />";
			}
			var html = "<p>" + imghtml + description + "</p>";
			document.getElementById("mapdesc").innerHTML= html;
			if (zoom != "NaN"){
				document.getElementById("mapdesc").innerHTML= html;
				map.setCenter(point);
				map.setZoom(zoom, true);
			}
			//loadmap(hotelfile);
			});
			var tooltip = document.createElement("div");
			document.getElementById("etravelmap").appendChild(tooltip);
			tooltip.style.visibility="hidden";
			google.maps.Event.addListener(marker, "mouseover", function (response) {
			showTooltip(marker);
			});
			function showTooltip(marker) {
				tooltip.innerHTML = marker.tooltip;
				var point=map.getCurrentMapType().getProjection().fromLatLngToPixel(map.getBounds().getSouthWest(),map.getZoom());
				var offset=map.getCurrentMapType().getProjection().fromLatLngToPixel(marker.getPoint(),map.getZoom());
				var anchor=marker.getIcon().iconAnchor;
				var width=marker.getIcon().iconSize.width;
				var pos = new GControlPosition(G_ANCHOR_BOTTOM_LEFT, new GSize(offset.x - point.x - anchor.x + width,- offset.y + point.y +anchor.y)); 
				pos.apply(tooltip);
				tooltip.style.visibility="visible";
      }
			google.maps.Event.addListener(marker, "mouseout", function (response) {
			tooltip.style.visibility="hidden"
			});
			if (i < markers.marker.length){
				i = i + 1;
				doGeocode(i)
			}
		}
	}
		
	
	
			});
		}
		loadmap(hotelfile);

	}
