    if (GBrowserIsCompatible()) {
      var gmarkers = [];
      var htmls = [];
      var i = 0;
      // arrays to hold variants of the info window html with get direction forms open
      var to_htmls = [];

      // A function to create the marker and set up the event window
      function createMarker(point,name,html) {
        var marker = new GMarker(point);

        // The info window version with the "to here" form open
        to_htmls[i] = html + '<br /><br />Start address:<form action="javascript:getDirections()">' +
           '<input type="text" size="40" maxlength="40" name="saddr" id="saddr" value="" /><br />' +
           '<input value="Get Directions" type="submit">' +
           '<input type="hidden" id="daddr" value="'+name+"@"+ point.lat() + ',' + point.lng() + 
           '"/>';
        // The inactive version of the direction info
        html = html + '<br /><br /><a href="javascript:tohere('+i+')">Get directions</a>';

        GEvent.addListener(marker, "click", function() {
          marker.openInfoWindowHtml(html);
        });
        // save the info we need to use later for the side_bar
        gmarkers[i] = marker;
        htmls[i] = html;
        i++;
        return marker;
      }

      // ===== request the directions =====
      function getDirections() {
        var saddr = document.getElementById("saddr").value
        var daddr = document.getElementById("daddr").value
        gdir.load("from: "+saddr+" to: "+daddr);
      }

      // This function picks up the click and opens the corresponding info window
      function myclick(i) {
        gmarkers[i].openInfoWindowHtml(htmls[i]);
      }

      // functions that open the directions forms
      function tohere(i) {
        gmarkers[i].openInfoWindowHtml(to_htmls[i]);
      }

      // create the map
      var map = new GMap2(document.getElementById("map"));
        map.setCenter(new GLatLng(54.482805,-4.658203), 5);
		map.addControl(new GLargeMapControl());
		map.addControl(new GScaleControl());
		map.enableDoubleClickZoom();
		map.enableContinuousZoom();

      // === create a GDirections Object ===
      var gdir=new GDirections(map, document.getElementById("directions"));

      // === Array for decoding the failure codes ===
      var reasons=[];
      reasons[G_GEO_SUCCESS]            = "Success";
      reasons[G_GEO_MISSING_ADDRESS]    = "Missing Address: The address was either missing or had no value.";
      reasons[G_GEO_UNKNOWN_ADDRESS]    = "Unknown Address:  No corresponding geographic location could be found for the specified address.";
      reasons[G_GEO_UNAVAILABLE_ADDRESS]= "Unavailable Address:  The geocode for the given address cannot be returned due to legal or contractual reasons.";
      reasons[G_GEO_BAD_KEY]            = "Bad Key: The API key is either invalid or does not match the domain for which it was given";
      reasons[G_GEO_TOO_MANY_QUERIES]   = "Too Many Queries: The daily geocoding quota for this site has been exceeded.";
      reasons[G_GEO_SERVER_ERROR]       = "Server error: The geocoding request could not be successfully processed.";
      reasons[G_GEO_BAD_REQUEST]        = "A directions request could not be successfully parsed.";
      reasons[G_GEO_MISSING_QUERY]      = "No query was specified in the input.";
      reasons[G_GEO_UNKNOWN_DIRECTIONS] = "The GDirections object could not compute directions between the points.";

      // === catch Directions errors ===
      GEvent.addListener(gdir, "error", function() {
        var code = gdir.getStatus().code;
        var reason="Code "+code;
        if (reasons[code]) {
          reason = reasons[code]
        } 

        alert("Failed to obtain directions, "+reason);
      });



		// Chertsey
		var point = new GLatLng(51.385642,-0.49139);
        var marker = createMarker(point,'KT16 8HG','Fordwater Trading Estate,<br />Ford Road,<br />Chertsey,<br />Surrey KT16 8HG<br /><br />Tel: 01932 579600<br />Fax: 01932 579601<br /><a href="mailto:chertsey@expressreinforcements.co.uk">chertsey@expressreinforcements.co.uk</a>');
		map.addOverlay(marker);
		
		// Neath
		var point = new GLatLng(51.653186,-3.814852);
        var marker = createMarker(point,'SA11 1NJ','Eaglesbush Works,<br />Milland Road, Neath<br />West Glamorgan SA11 1NJ<br /><br />Tel: 01639 645555<br />Fax: 01639 645558<br /><a href="mailto:neath@expressreinforcements.co.uk">neath@expressreinforcements.co.uk</a>');
		map.addOverlay(marker);
		
		// Brownhills
		var point = new GLatLng(52.644844,-1.950288);
        var marker = createMarker(point,'WS8 7EU','Collier Close,<br />Brownhills,<br />West Midlands WS8 7EU<br /><br />Tel: 01543 453359<br />Fax: 01543 454485<br /><a href="mailto:brownhills@expressreinforcements.co.uk">brownhills@expressreinforcements.co.uk</a>');
		map.addOverlay(marker);

		// Newcastle
		var point = new GLatLng(54.959504,-1.683038);
        var marker = createMarker(point,'NE16 3AS','Hannington Works,<br />Longrigg, Swalwell,<br />Tyne and Wear NE16 3AS<br /><br />Tel: 0191 4956060<br />Fax: 0191 4956078<br /><a href="mailto:newcastle@expressreinforcements.co.uk">newcastle@expressreinforcements.co.uk</a>');
		map.addOverlay(marker);

		// Rainham
		var point = new GLatLng(51.517629,0.171989);
        var marker = createMarker(point,'RM13 8EU','Basepoint Business Centre,<br />CEME Campus,<br />Marsh Way,<br />Rainham,<br />Essex RM13 8EU<br /><br /><a href="mailto:rainham@expressreinforcements.co.uk">rainham@expressreinforcements.co.uk</a>');
		map.addOverlay(marker);
    }

    else {
      alert("Sorry, the Google Maps API is not compatible with this browser");
    }

    // This Javascript is based on code provided by the
    // Blackpool Community Church Javascript Team
    // http://www.commchurch.freeserve.co.uk/   
    // http://www.econym.demon.co.uk/googlemaps/