﻿if (GBrowserIsCompatible())
{

var icon = new GIcon();
var map = new GMap(document.getElementById("gMap"));	
var geocoder = null;     
geocoder = new GClientGeocoder();	
	
map.addControl(new GLargeMapControl());
map.setCenter(new GLatLng(50.4217, -4.1888), 8);
icon.image = "http://www.vispring.co.uk/images/layout/vispring_google_pin.png";
icon.iconSize = new GSize(18, 25);
icon.shadowSize = new GSize(22, 20);
icon.iconAnchor = new GPoint(6, 20);
icon.infoWindowAnchor = new GPoint(5, 1);
}

else
    
{
  alert("Sorry, the Google Maps API is not compatible with this browser"); 
}

function plotOffice(postcode,detail) {
      if (geocoder) {
        geocoder.getLatLng(
          postcode,
          function(point) {
            if (!point) {
              alert(postcode + " not found");
            } else {
              var marker = new GMarker(point,icon);
              GEvent.addListener(marker, "click",
              function() 
              {
			        marker.openInfoWindowHtml(detail);
			        }
			        );                     
              map.addOverlay(marker);
              
              marker.openInfoWindowHtml(detail);  
            }
          }
        );
      }
    }
    
function plotOfficeLatLng(latitude, longitude, detail)
{    
  var point = new GLatLng(latitude,longitude);
	var marker = new GMarker(point,icon);
	
  GEvent.addListener(marker, "click",
  function() 
    {
	    marker.openInfoWindowHtml(detail);
    }
    );

  map.addOverlay(marker);	
  marker.openInfoWindowHtml(detail);                
}

