//<![CDATA[

        // Create a base icon for all of our markers that specifies the
        // shadow, icon dimensions, etc.
        
		var baseIcon = new GIcon();


          // create the map
      var map = new GMap2(document.getElementById("map-holder"));

      var drivingDirections_html = '';
      var placesOfInterest_html = '';

	var point = new GPoint(-0.778392, 51.149048);

          // === create a GDirections Object ===
      var gdir=new GDirections(map, document.getElementById("drivingDirections"));

 jQuery(document).ready(function() {

    if (GBrowserIsCompatible()) 
    {
        baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
        baseIcon.iconSize = new GSize(20, 34);
        baseIcon.shadowSize = new GSize(37, 34);
        baseIcon.iconAnchor = new GPoint(9, 34);
        baseIcon.infoWindowAnchor = new GPoint(9, 2);
        baseIcon.infoShadowAnchor = new GPoint(18, 25);


      map.addControl(new GLargeMapControl());
      map.addControl(new GMapTypeControl());
      map.setCenter(new GLatLng(51.149048, -0.778392), 11);
      map.setMapType(G_NORMAL_MAP);
         
      var text = "<h3>Millais Nurseries</h3> <br/>  Crosswater Lane<br/> Churt<br/>Farnham <br/>Surrey <br/>GU10 2JN <br/>UK";
      map.addOverlay(createMarker(point, 1, text));


      drivingDirections_html += "&nbsp;<br /><b>Directions:</b><br />";      
      drivingDirections_html += '1. <a href="javascript:GetDirectionsFromFarnham()">From Farnham</a><br />';
      drivingDirections_html += '2. <a href="javascript:GetDirectionsFromFarnborough()">From Farnborough</a><br />';
      drivingDirections_html += '3. <a href="javascript:GetDirectionsFromGuildford()">From Guildford</a><br />';
      drivingDirections_html += '4. <a href="javascript:GetDirectionsFromBasingstoke()">From Basingstoke</a><br />';
      drivingDirections_html += '5. <a href="javascript:Reset()">Reset</a><br />';

      document.getElementById("drivingDirections").innerHTML = drivingDirections_html;






      // === 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.";
    }


 });


       function createMarker(point, index, description) {
          var letteredIcon = new GIcon(baseIcon);

          // Set up our GMarkerOptions object
          var marker = new GMarker(point);

          GEvent.addListener(marker, "click", function() {
            marker.openInfoWindowHtml("<b>" + description + "</b>");
          });
          return marker;
        }

    function GetDirectionsFromFarnham() {
        map.clearOverlays();
        gdir.load("from: 51.214127, -0.795706 to: 51.149048, -0.778392");
    }

    function GetDirectionsFromFarnborough() {
        map.clearOverlays();
        gdir.load("from: 51.294001, -0.754624 to: 51.149048, -0.778392");
    }

    function GetDirectionsFromGuildford() {
        map.clearOverlays();
        gdir.load("from: 51.23397741636765, -0.5702590942382812 to: 51.149048, -0.778392");
    }

    function GetDirectionsFromBasingstoke() {
        map.clearOverlays();
        gdir.load("from: 51.26374094053775, -1.0840415954589844 to: 51.149048, -0.778392");
    }

    function Reset() {
        map.clearOverlays();
        map.setCenter(new GLatLng(51.149048, -0.778392), 11);
        document.getElementById("drivingDirections").innerHTML = drivingDirections_html;
          var point = new GPoint(-0.778392, 51.149048);
          var text = "<h3>Millais Nurseries</h3> <br/>  Crosswater Lane<br/> Churt<br/>Farnham <br/>Surrey <br/>GU10 2JN <br/>UK";
          map.addOverlay(createMarker(point, 1, text));
    }

    //]]>
