    
    //<![CDATA[
    
    if (GBrowserIsCompatible()) {
      
      // This is the location used to centre the map and position the pointer
      // it can be a full address, postcode, lat-long co-ord, anything that gives the desired location in google maps
      var mapLocation = "mitchell road, corby";
      
      
      function createMarker(point, html, icon) {
        var marker = new GMarker(point, icon);
        GEvent.addListener(marker, "click", function() {
          marker.openInfoWindowHtml(html);
        });
        return marker;
      }
      
      function getDestination(){
        localSearch.setSearchCompleteCallback(null,
          function() {          
            if (localSearch.results[0]) {    
              var resultLat = localSearch.results[0].lat;
              var resultLng = localSearch.results[0].lng;
              setMap(new GLatLng(resultLat,resultLng));
            }else{
              alert("Postcode not found!");
            }
          });  
        localSearch.execute(mapLocation);
      }
      
      function setMap(GLatLng){
        point = GLatLng; 
        map.setCenter(point, 10);
        var marker = createMarker(point, '<div style="width: 400px"><img src=\"/images/structure/google_map_logo.jpg\" style=\"float: left; padding-right: 10px;\" alt=\"Donington Park Logo\" title=\"Donington Park Logo\" /><strong>Donington Park Grand Prix Circuit</strong><br/>Castle Donington<br/>Derby<br/>DE74 2RP<br/>UK<br/><br/><strong>Tel:</strong> + 44 (0) 1332 810 048<br/><strong>Fax:</strong> + 44 (0) 1332 850 422<br/><strong>Email:</strong> <a href=\"mailto: reception@donington-park.co.uk\">reception@donington-park.co.uk</a></div>', icon)
        // add pointer
        map.addOverlay(marker);
      }
      
      // initiate objects
      var map = new GMap2(document.getElementById("map"));
      var icon = new GIcon();
      var directions = new GDirections(map, document.getElementById('map_directions'));
      var geoCoder = new GClientGeocoder();
      var localSearch = new GlocalSearch();
      
      //set destination point
      var point;
      getDestination();
      
      // initiate map controls
      map.addControl(new GLargeMapControl());
      map.addControl(new GMapTypeControl());
      map.addControl(new GOverviewMapControl());  
 
      // set icon properties
      icon.image = "/images/structure/google_map_icon.png";
      icon.shadow = "/images/structure/google_map_icon_shadow.png";
      icon.iconSize = new GSize(56, 52);
      icon.shadowSize = new GSize(85, 52);
      icon.iconAnchor = new GPoint(28, 52);
      icon.infoWindowAnchor = new GPoint(50, 1);
    }
    
    // display a warning if the browser was not compatible
    else 
    {
      alert("Sorry, the Google Maps API is not compatible with this browser");
    }
    
    function getDirections(postcode){
      localSearch.setSearchCompleteCallback(null,
        function() {          
          if (localSearch.results[0]) {    
            var resultLat = localSearch.results[0].lat;
            var resultLng = localSearch.results[0].lng;
            var point = new GLatLng(resultLat,resultLng);
            showDirections(point);
          }else{
            alert("Postcode not found!");
          }
        });  
      localSearch.execute(postcode + ", UK");
    }
    
    function showDirections(GLatLng){
      var to = point.lat()+", "+point.lng();
      var fromTo = 'from: '+GLatLng.lat()+', '+GLatLng.lng()+' to: '+mapLocation+'@'+to;
      directions.load(fromTo);
    }
