		//<![CDATA[
		// this variable will collect the html which will eventually be placed in the sidebar
		var sidebar_html = "";

		// arrays to hold copies of the markers and html used by the sidebar
		// because the function closure trick doesnt work there
		var arrGMarkers = [];
		var arrInfoWindowHtmlTab1 = [];
		var arrInfoWindowHtmlTab2 = [];
		var i = 0;

		// This function picks up the click from the side bar html and opens the corresponding info window
		function openGMapPopupWindow(i)
		{
			var tab1Html = arrInfoWindowHtmlTab1[i];
			var tab2Html = arrInfoWindowHtmlTab2[i];

			if (tab2Html == "")
			{
				arrGMarkers[i].openInfoWindowHtml(tab1Html);
			}
			else
			{
				var infoTabs = [
				  new GInfoWindowTab("Team", tab1Html),
				  new GInfoWindowTab("Contact", tab2Html)
				];
				arrGMarkers[i].openInfoWindowTabsHtml(infoTabs);
			}
		}

		function load()
		{
			if (GBrowserIsCompatible())
			{

				// Create a base icon for all of our markers that specifies the
				// shadow, icon dimensions, etc.
				var largeBaseIcon = new GIcon();
				largeBaseIcon.shadow = "/map/shadow50.png";
				largeBaseIcon.iconSize = new GSize(20, 34);
				largeBaseIcon.shadowSize = new GSize(37, 34);
				largeBaseIcon.iconAnchor = new GPoint(9, 34);
				largeBaseIcon.infoWindowAnchor = new GPoint(9, 2);
				largeBaseIcon.infoShadowAnchor = new GPoint(18, 25);

				// Create our "large yellow" marker icon
				var largeYellowIcon = new GIcon(largeBaseIcon);
				largeYellowIcon.image = "/map/yellowmarker.png";

				// Create our "large green" marker icon
				var largeGreenIcon = new GIcon(largeBaseIcon);
				largeGreenIcon.image = "/map/greenmarker.png";

				// Create our "large red" marker icon
				var largeRedIcon = new GIcon(largeBaseIcon);
				largeRedIcon.image = " /map/redmarker.png";

				// Creates a marker at the given point with the given infoWindowHtml label
				function createMarker(point, label, infoWindowHtmlTab1, infoWindowHtmlTab2, iconId)
				{
					var marker;
					if (iconId == 1)
					{
						marker = new GMarker(point, largeRedIcon);
					}
					else if (iconId == 2)
					{
						marker = new GMarker(point, largeGreenIcon);
					}
					else if (iconId == 3)
					{
						marker = new GMarker(point, largeYellowIcon);
					}
					else
					{
						marker = new GMarker(point, largeRedIcon);
					}
					GEvent.addListener(marker, "click", function() {
						if (infoWindowHtmlTab2 == "")
						{
							marker.openInfoWindowHtml(infoWindowHtmlTab1);
						}
						else
						{
							var infoTabs = [
							  new GInfoWindowTab("Team", infoWindowHtmlTab1),
							  new GInfoWindowTab("Contact", infoWindowHtmlTab2)
							];
							marker.openInfoWindowTabsHtml(infoTabs);
						}
					});

					// save the info we need to use later for the sidebar
					arrGMarkers[i] = marker;
					arrInfoWindowHtmlTab1[i] = infoWindowHtmlTab1;
					arrInfoWindowHtmlTab2[i] = infoWindowHtmlTab2;

					return marker;
				}

				var m = document.getElementById("map");
				m.style.height = "400px";
				m.style.width = "540px";

				var map = new GMap2(document.getElementById("map"));
				map.addControl(new GLargeMapControl());

				// Add a listener to check if the map has been moved
				// and output the location at the bottom of the page
				GEvent.addListener(map, "moveend", function() {
					var center = map.getCenter();
				});

				map.setCenter(new GLatLng(54.59310225392637, -5.927038192749023), 15);

				// Download the data in data.xml and load it on the map. The format we
				// expect is:
				// <markers>
				//   <marker lat="37.441" lng="-122.141"/>
				//   <marker lat="37.322" lng="-121.213"/>
				// </markers>
				GDownloadUrl("/map/data.txt", function(data) {
					// === split the document into lines ===
					lines = data.split("\n");
					for (var i=0; i<lines.length; i++)
					{
						if (lines[i].length > 1)
						{
							// === split each line into parts separated by "|" and use the contents ===
							parts = lines[i].split("|");
							var lat = parseFloat(parts[0]);
							var lng = parseFloat(parts[1]);
							var infoWindowHtmlId = parts[2];
							var icon = parts[3];
							var label = parts[4];
							var info1 = parts[5];
							var info2 = parts[6];
							var point = new GLatLng(lat,lng);
							// create the marker
							var marker = createMarker(point,label,info1,info2,icon);
							map.addOverlay(marker);
						}
					}
					// put the assembled sidebar_html contents into the sidebar div
				});

			}
		}

		//]]>
