// JavaScript Document

function showmethemap(){
    if (GBrowserIsCompatible()) { 

      // A function to create the marker and set up the event window
      // Dont try to unroll this function. It has to be here for the function closure
      // Each instance of the function preserves the contents of a different instance
      // of the "marker" and "html" variables which will be needed later when the event triggers.    
      function createMarker(point,html) {
        var marker = new GMarker(point);
        GEvent.addListener(marker, "click", function() {
          marker.openInfoWindowHtml(html);
        });
        return marker;
      }

      // Display the map, with some controls and set the initial location 
      var map = new GMap2(document.getElementById("map"));
      map.addControl(new GLargeMapControl());
      map.addControl(new GMapTypeControl());
      map.setCenter(new GLatLng(51.6679,-1.2830 ),17);
    
      // Set up three markers with info windows 
    
      var point = new GLatLng(51.6685,-1.2842 );
      var marker = createMarker(point,"Car Park")
      map.addOverlay(marker);

      var point = new GLatLng(51.6680,-1.2836 );
      var marker = createMarker(point,"St. Helen's Church Centre")
      map.addOverlay(marker);

      var point = new GLatLng(51.6679,-1.2830 );
      var marker = createMarker(point,"St. Helen's Church, Abingdon")
      map.addOverlay(marker);

    }
    
    // display a warning if the browser was not compatible
    else {
      alert("Sorry, the Google Maps API is not compatible with this browser");
    }
}