    function TextualZoomControl() {
    }
    TextualZoomControl.prototype = new GControl();

    TextualZoomControl.prototype.initialize = function(map) {
      var container = document.createElement("div");

      var zoomInDiv = document.createElement("div");
      this.setButtonStyle_(zoomInDiv);
      container.appendChild(zoomInDiv);
      zoomInDiv.appendChild(document.createTextNode("Reset Map"));
      GEvent.addDomListener(zoomInDiv, "click", function() {
        initialize();
 });
      map.getContainer().appendChild(container);
      return container;
    }

    // By default, the control will appear in the top left corner of the
    // map with 7 pixels of padding.
    TextualZoomControl.prototype.getDefaultPosition = function() {
      return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(5, 5));
    }

    // Sets the proper CSS for the given button element.
    TextualZoomControl.prototype.setButtonStyle_ = function(button) {
      button.style.textDecoration = "none";
      button.style.color = "#000000";
      button.style.backgroundColor = "white";
      button.style.font = "small Arial";
      button.style.border = "1px solid black";
      button.style.padding = "2px";
      button.style.marginBottom = "3px";
      button.style.textAlign = "center";
      button.style.width = "6em";
      button.style.cursor = "pointer";
    }

function initialize() {
  if (GBrowserIsCompatible()) {
    var map = new GMap2(document.getElementById("map"));
        //map.addControl(new GMapTypeControl());
        //map.addControl(new GSmallZoomControl());
        map.setCenter(new GLatLng(50.97604804521897, -3.231182098388672), 15);
        GDownloadUrl("markerPoints.json", function( data, responseCode ){ parseJson(data); });
        map.setMapType(G_NORMAL_MAP);
        map.addControl(new TextualZoomControl());

        function makeIcon (image) {
        var icon = new GIcon();
        icon.image = image;
        icon.iconSize = new GSize(27, 27);
        icon.shadowSize = new GSize(24, 16);
        icon.iconAnchor = new GPoint(13, 13);
        icon.infoShadowAnchor = new GPoint(0, 0);
        icon.infoWindowAnchor = new GPoint(8, 1);
        return icon;
        }

        function createMarker(input) { 
              var marker = new PdMarker(input.point, makeIcon(input.icon) );
              marker.setTooltip( input.name );
              GEvent.addListener(marker, "click", function() {

        if (marker.getMouseOutEnabled())
        {
                marker.setMouseOutEnabled(false);
                map.setCenter((input.point), 19);
                map.setMapType(G_SATELLITE_MAP);
        }
        else
        {
                marker.setMouseOutEnabled(true); 
                map.setCenter(new GLatLng(50.97604804521897, -3.231182098388672), 15);
                map.setMapType(G_NORMAL_MAP);
        }
        });


        return marker;


        }

        function parseJson (doc) {
              var jsonData = eval("(" + doc + ")");
                for (var i = 0; i< jsonData.places.length; i++) {
                var marker = createMarker(jsonData.places[i]);
        map.addOverlay(marker); }
        }

  }

}

window.onload = initialize;
window.onunload = GUnload;

