 //<![CDATA[

    function load() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map"));
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
        map.setCenter(new GLatLng(53.1051876000, -2.0219910000), 7);
        // Langbridge 51.3970606000, -2.3453825000
        // Previous 53.587421, -4.634971
        // Gees 53.1051876000, -2.0219910000
		// Create a base icon for all of our markers that specifies the
		// shadow, icon dimensions, etc.
		//baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png"; 
		//baseIcon.iconSize = new GSize(20, 34);
		//baseIcon.shadowSize = new GSize(37, 34);
		//baseIcon.iconAnchor = new GPoint(9, 34);
		//baseIcon.infoWindowAnchor = new GPoint(9, 2);
		//baseIcon.infoShadowAnchor = new GPoint(18, 25);

		var baseIcon = new GIcon();
		baseIcon.shadow = "http://www.homehardware.org.uk/skin/templateimages/mm_20_shadow.png";
		baseIcon.iconSize = new GSize(16, 25);
		baseIcon.shadowSize = new GSize(27.5, 25);
		baseIcon.iconAnchor = new GPoint(7.5, 25);
		baseIcon.infoWindowAnchor = new GPoint(5, 1);

		//baseIcon.iconSize = new GSize(12, 20);
		//baseIcon.iconAnchor = new GPoint(7.5, 25);
		//baseIcon.shadowSize = new GSize(27.5, 25);
		//baseIcon.infoWindowAnchor = new GPoint(5, 1);


		// Creates a marker at the given point with the given number label
		function createMarker(point, index, store, address1, address2, address3, address4, postcode, tel, web, corp) {
  				// Create a lettered icon for this point using our icon class
				var letter = String.fromCharCode("A".charCodeAt(0) + index);
				var icon = new GIcon(baseIcon);
				//icon.image = "http://www.google.com/mapfiles/marker.png";
				//icon.image = "http: //maps.gstatic.com/mapfiles/ridefinder-images/mm_20_blue.png";

				if (corp == "yes") {
				    icon.image = "http://www.homehardware.org.uk/skin/templateimages/mm_20_blue.png";
				}
				else {
				    icon.image = "http://www.homehardware.org.uk/skin/templateimages/mm_20_red.png";
				};
				var marker = new GMarker(point, icon); 
				GEvent.addListener(marker, "click", function () {
				    var winHTMLstr;
				    winHTMLstr = "<b>" + store + "</b><br />";
				    if (address1 != null && address1 != '') { winHTMLstr += address1 + "<br />" };
				    if (address2 != null && address2 != '') { winHTMLstr += address2 + "<br />" };
				    if (address3 != null && address3 != '') { winHTMLstr += address3 + "<br />" };
				    if (address4 != null && address4 != '') { winHTMLstr += address4 + "<br />" };
				    if (postcode != null && postcode != '') { winHTMLstr += postcode + "<br />" };
				    if (tel != null && tel != '') { winHTMLstr += "Tel: " + tel + "<br />" };
				    //winHTMLstr += "corp: " + corp + "<br />";
				    if (web != null && web != '') { winHTMLstr += "<a href=\'http://" + web + "\' target=\'blank\' >" + web + "<a/>"};
				    marker.openInfoWindowHtml(winHTMLstr);
				});

  			return marker;
			}	
		
		
        // 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>
		var myRand = parseInt(Math.random() * 9999999999999999);
		  GDownloadUrl("storeMapData.asp?rnd=" + myRand, function (data) {
          var xml = GXml.parse(data);
          var markers = xml.documentElement.getElementsByTagName("marker");
          for (var i = 0; i < markers.length; i++) {
            var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")),
                                    parseFloat(markers[i].getAttribute("lng")));
            map.addOverlay(createMarker(point, i, markers[i].getAttribute("store"), markers[i].getAttribute("address1"), markers[i].getAttribute("address2"), markers[i].getAttribute("address3"), markers[i].getAttribute("address4"), markers[i].getAttribute("postcode"), markers[i].getAttribute("telephone"), markers[i].getAttribute("web"), markers[i].getAttribute("corp")));

          }
        });
      }
    }

    //]]>
