function load() {
	if (GBrowserIsCompatible()) {
		actionLoad();
	}

	function actionLoad(){
		//--init map object
        var map = new GMap2(document.getElementById("map"),{size: new GSize(mapSizeWidth,mapSizeHeight)});

 		//--add controls that are specified
		if (addTypeControl == "True")
			map.addControl(new GMapTypeControl());
		if (addMapControl == "True")
			map.addControl(new GSmallMapControl());
 		if (enableMwScroll == "True")
			map.enableScrollWheelZoom();

		//--go get the XML data
		GDownloadUrl(localXMLURL, function(data, responseCode) {

			if (responseCode == 200)
			{
				//--if we got here, then the HTTP result was 200 which is nice
				//--read the XML and create a new array for the data to be stored
				var xml = GXml.parse(data);
				var data = xml.documentElement.getElementsByTagName("data");
				var vessel_data= new Array();

				//--obtain the list of vessels
				var vessels = data[0].getElementsByTagName("vessel");

				//--go through each vessel in turn
				for (var i=0;i<vessels.length;i++ )
				{
					//--make a new associative array at this index
					//--and fill it with this vessel's information
					vessel_data[i] = new Array();
					//--vessel name, id and report time
					vessel_data[i]["vesselname"] = vessels[i].getElementsByTagName("vesselname");
					vessel_data[i]["vesselid"] = vessels[i].getElementsByTagName("vesselid");
					vessel_data[i]["fixTime"] = vessels[i].getElementsByTagName("fixtime");
					vessel_data[i]["fixDate"] = vessels[i].getElementsByTagName("fixdate");

					//--speed and heading
					vessel_data[i]["speed"] = vessels[i].getElementsByTagName("speed");
					vessel_data[i]["heading"] = vessels[i].getElementsByTagName("heading");

					//--icon information taken from the config
					vessel_data[i]["icon"] = markerMainIcons[i];
					vessel_data[i]["icon_shadow"] = markerShadowIcons[i];

					//--coordinate information
					vessel_data[i]["longDeg"] = vessels[i].getElementsByTagName("longdeg");
					vessel_data[i]["longMin"] = vessels[i].getElementsByTagName("longmin");
					vessel_data[i]["longSec"] = vessels[i].getElementsByTagName("longsec");
					vessel_data[i]["longHemisphere"] = vessels[i].getElementsByTagName("longhemisphere");
					vessel_data[i]["longDecimal"] = vessels[i].getElementsByTagName("longdecimal");
					vessel_data[i]["latDeg"] = vessels[i].getElementsByTagName("latdeg");
					vessel_data[i]["latMin"] = vessels[i].getElementsByTagName("latmin");
					vessel_data[i]["latSec"] = vessels[i].getElementsByTagName("latsec");
					vessel_data[i]["latHemisphere"] = vessels[i].getElementsByTagName("lathemisphere");
					vessel_data[i]["latDecimal"] = vessels[i].getElementsByTagName("latdecimal");

					//--check that the coordinate data is valid, otherwise delete this index so it isn't shown
					//--it will cause inline errors otherwise!
					if (!vessel_data[i]["longDeg"].length || !vessel_data[i]["longMin"].length || !vessel_data[i]["longSec"].length || !vessel_data[i]["longHemisphere"].length || !vessel_data[i]["latDeg"].length || !vessel_data[i]["latMin"].length || !vessel_data[i]["latSec"].length || !vessel_data[i]["latHemisphere"].length)
					{
						alert ("Could not obtain coordinate data from XML!" );
						delete vessel_data[i];
					}
				}

				//--now go through the arrays of validated data and sort out longitudes/latitudes
				//--and prepare the gIcon objects
				var longitudes = new Array();
				var latitudes = new Array();

				for (var i=0;i<vessel_data.length;i++)
				{
					longitudes[i] = 0;
					latitudes[i] = 0;

					//--turn the coordinates into decimal form
					longitudes[i] = vessel_data[i]["longDecimal"][0].firstChild.nodeValue;
					latitudes[i]  = vessel_data[i]["latDecimal"][0].firstChild.nodeValue;

					//--negate values if south or west
					if (vessel_data[i]["longHemisphere"][0].firstChild.nodeValue == "west")
						longitudes[i] = -longitudes[i];

					if (vessel_data[i]["latHemisphere"][0].firstChild.nodeValue == "south")
						latitudes[i] = -latitudes[i];

					//--set the center temporarily to this location
					map.setCenter(new GLatLng(parseFloat(latitudes[i]), parseFloat(longitudes[i])), mapZoomLevel);

					//--check if this is the marker to center upon (if centerasaverage is not enabled)
					if (centerAsAverage == "False")
					{
						if (vessel_data[i]["vesselid"][0].firstChild.nodeValue == "vessel."+centerToMarker)
							var centerCoordIdx = i;
					}
					//--Create the marker icon object for this vessel
					eval("var icon"+i+" = new GIcon()");
					eval("icon"+i+".image = vessel_data[i][\"icon\"]");
					eval("icon"+i+".shadow = vessel_data[i][\"icon_shadow\"]");
					eval("icon"+i+".iconSize = new GSize(12, 20)");
					eval("icon"+i+".shadowSize = new GSize(22, 20)");
					eval("icon"+i+".iconAnchor = new GPoint(6, 20)");
					eval("icon"+i+".infoWindowAnchor = new GPoint(5, 1)");

					//--replace the variables in the files with the required values
					vesselDescFiles[i] = vesselDescFiles[i].replace(/%%VESSELNAME%%/, vessel_data[i]["vesselname"][0].firstChild.nodeValue); 
					vesselDescFiles[i] = vesselDescFiles[i].replace(/%%LASTPOSREPORTDATE%%/, vessel_data[i]["fixDate"][0].firstChild.nodeValue);
					vesselDescFiles[i] = vesselDescFiles[i].replace(/%%LASTPOSREPORTTIME%%/, vessel_data[i]["fixTime"][0].firstChild.nodeValue);
					vesselDescFiles[i] = vesselDescFiles[i].replace(/%%LATDEG%%/, vessel_data[i]["latDeg"][0].firstChild.nodeValue);
					vesselDescFiles[i] = vesselDescFiles[i].replace(/%%LATMIN%%/, vessel_data[i]["latMin"][0].firstChild.nodeValue);
					vesselDescFiles[i] = vesselDescFiles[i].replace(/%%LATSEC%%/, vessel_data[i]["latSec"][0].firstChild.nodeValue);
					vesselDescFiles[i] = vesselDescFiles[i].replace(/%%LATHEM%%/, vessel_data[i]["latHemisphere"][0].firstChild.nodeValue);
					vesselDescFiles[i] = vesselDescFiles[i].replace(/%%LONGDEG%%/, vessel_data[i]["longDeg"][0].firstChild.nodeValue);
					vesselDescFiles[i] = vesselDescFiles[i].replace(/%%LONGMIN%%/, vessel_data[i]["longMin"][0].firstChild.nodeValue);
					vesselDescFiles[i] = vesselDescFiles[i].replace(/%%LONGSEC%%/, vessel_data[i]["longSec"][0].firstChild.nodeValue);
					vesselDescFiles[i] = vesselDescFiles[i].replace(/%%LONGHEM%%/, vessel_data[i]["longHemisphere"][0].firstChild.nodeValue);
					vesselDescFiles[i] = vesselDescFiles[i].replace(/%%SPEED%%/, vessel_data[i]["speed"][0].firstChild.nodeValue);
					vesselDescFiles[i] = vesselDescFiles[i].replace(/%%HEADING%%/, vessel_data[i]["heading"][0].firstChild.nodeValue);

					
					//--create an info popup overlay object and set it up with the above desc value
					//--checking that the array is not already emptied

					var popupHtml = "";                 //--proper intialisation added
					if (i+1 > vesselDescFiles.length)   //--changed test from >= to >
						popupHtml = "no data";
					else
						popuphtml = vesselDescFiles[i];
					eval("var popup"+i+" = [new GInfoWindowTab(\"popup "+i+"\", popuphtml)]");


					//--create a new marker object,set this to the position of the map
					//--and add the popup with a listener
					eval("var marker"+i+" = new GMarker(map.getCenter(), icon"+i+")");
					eval("GEvent.addListener(marker"+i+", \"click\", function(){marker"+i+".openInfoWindowTabsHtml(popup"+i+");})");
					eval("map.addOverlay(marker"+i+")");
				}

				//--set the map type
				if (typeOfMap == "SATELLITE")
					map.setMapType(G_SATELLITE_MAP);
				if (typeOfMap == "HYBRID")
					map.setMapType(G_HYBRID_MAP);

				//--check if centerAsAverage is set, and if so work out the center point
				//--otherwise, center on the specified marker, and raise a warning if this is not present
				if (centerAsAverage == "True")
					map.setCenter(new GLatLng(parseFloat(((parseFloat(latitudes.sort()[latitudes.length-1]) - parseFloat(latitudes.sort()[0])) / 2) + parseFloat(latitudes.sort()[0])), parseFloat(((parseFloat(longitudes.sort()[longitudes.length-1]) - parseFloat(longitudes.sort()[0])) / 2) + parseFloat(longitudes.sort()[0]))), mapZoomLevel);
				else
				{
					if (typeof(centerCoordIdx) != "undefined")
						map.setCenter(new GLatLng(parseFloat(latitudes[centerCoordIdx]), parseFloat(longitudes[centerCoordIdx])), mapZoomLevel);
					else
						alert("center to marker is active, yet specified marker was not found - Check config\nMap is centered on the last parsed vessel");
				}
 			}
			else  //--if we got here, then the HTTP result wasn't 200 which is not nice, raise an error
				alert ("Could not obtain XML, result code: " + responseCode );

		});

	}
}
