    
    //<![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 = "LE2 7SR";
      
      
      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, 15);
        var marker = createMarker(point, '<div style="width: 400px"><strong>City Cricket Academy</strong><br/>8 Commercial Square<br/>Freemans Common<br/>Leicester<br />LE2 7SR<br/>UK<br/><br/><strong>Tel:</strong> 0116 254 3333<br/><strong>Fax:</strong>0116 254 3387<br/><strong>Mobile:</strong> 07931 838 422<br/> <strong>Email:</strong> <a href=\"mailto:contact@citycricketacademy.co.uk\">contact@citycricketacademy.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 = "google_map_icon.png";
      icon.shadow = "google_map_icon_shadow.png";
      icon.iconSize = new GSize(60, 41);
      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);
    }
