    //<![CDATA[
    //
    // Use the Google Map V2 interface to show Group Locations in the District
    //
    // Author: John Murray
    //
    var map;
    var mgr;

    //
    // This function gets called when the page is loaded
    //
    function load() {
      if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("localmap"));
        map.addControl(new GLargeMapControl());
        map.addControl(new GOverviewMapControl());
        map.addControl(new GMapTypeControl());
        map.setCenter(new GLatLng(51.429875, -1.238231), 12); // centre map here as scale 12
        map.enableDoubleClickZoom(); // allow double clicks to zoom in
        map.setMapType(G_NORMAL_MAP); // more interesting if it's got pictures
        window.setTimeout(setupLocationMarkers, 0); // 0 second timer 
      }
    }

    //
    // Data is held in a JSON format structure and this function walks the structure
    // creating markers as needed.
    //
    function setupLocationMarkers() {
      mgr = new GMarkerManager(map);
      var markers = []; // array to collect the markers
      for (var i in tacehamLocations) {
        var posn = new GLatLng(tacehamLocations[i]["posn"][0], tacehamLocations[i]["posn"][1]);
        var link = tacehamLocations[i]["link"];
        var name = tacehamLocations[i]["name"];
        markers.push(createMarker(posn, link, name));
      }
      mgr.addMarkers(markers, 0, 17);
      mgr.refresh();
    }
    
    //
    // Need to do this in a separate function in order to use closures.
    // You get into all sorts of messes if you try this in the loop in the function above :-)
    //
    function createMarker(posn, link, name) {
    	var marker = new GMarker(posn);
    	GEvent.addListener(marker, "mouseover", function() {
    	    var htmlText = "<b>"
                         + name
	    	         + "</b> Scout Group.<br/>To find out more about this<br/>Group click " 
       	    	         + "<a href='"
       		         + link
       		         + "'>"
       		         + "here!"
       		         + "</a>";
    	    marker.openInfoWindowHtml(htmlText);
        });        
	return marker;			
    }
    //]]>