  
 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 = "BH12 1DJ";

	
	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>Creativebyte<br />1 Dalling Road<br />Branksome<br />Poole<br />Dorset<br />BH12 1DJ</div>', icon)

        // add pointer
		var thehtml = "<div>Creativebyte<br />1 Dalling Road<br />Branksome<br />Poole<br />Dorset<br />BH12 1DJ</div>";

		//map.openInfoWindowHtml(map.getCenter(),(thehtml));
        map.addOverlay(marker);

      }

      

      // initiate objects

      var map = new GMap2(document.getElementById("gmap"));

      var directions = new GDirections(map, document.getElementById('map_directions'));

      var geoCoder = new GClientGeocoder();

      var localSearch = new GlocalSearch();

		map.setMapType(G_NORMAL_MAP);
		map.removeMapType(G_HYBRID_MAP);
		map.removeMapType(G_SATELLITE_MAP);

      //set destination point

      var point;

      getDestination();

      // initiate map controls

      map.addControl(new GLargeMapControl());

      map.addControl(new GMapTypeControl());

      map.addControl(new GOverviewMapControl());  

      // set icon properties
	  //var icon = new GIcon(G_DEFAULT_ICON);
     // 

      var icon = new GIcon();
		icon.image = "images/cone_red.png";
        icon.iconAnchor = new GPoint(30, 55);
        icon.infoWindowAnchor = new GPoint(40, 65);
        icon.iconSize = new GSize(60, 68);
        icon.shadow = "images/cone_shad_red.png";
        icon.shadowSize = new GSize(60, 68);

    }

    

    // 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);

    }

	
	  
	
	
	
