    var localSearch = new GlocalSearch();
    var map = null;
    var geocoder = null;
	//var mapaddress = "$googlemapaddress"
   
   	// Uses GlocalSearch to locate postcode longitude and latitude and if that fails then uses google maps geocodeing.
    function initialize(mapaddress) {
	  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);
			callbackFunction(point);
		  }else{
			callbackFunctionMapGeo(mapaddress);
			//alert("Postcode not found!");
		  }
		});  
	  localSearch.execute(mapaddress + ", UK");
	}
	  
	function callbackFunction(point){
	  if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("gmap"));
	    map.setUIToDefault();
      	map.setCenter(point, 15);
		var marker = new GMarker(point);
		map.addOverlay(marker);
		}
	}
	
	function callbackFunctionMapGeo(mapaddress){
	  if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("gmap"));
        map.setUIToDefault();
      	geocoder = new GClientGeocoder();
		if (geocoder) {
			geocoder.getLatLng(
			  mapaddress,
			  function(point) {
				if (!point) {
				  alert(mapaddress + " not found");
				} else {
				  map.setCenter(point, 15);
				  var marker = new GMarker(point);
				  map.addOverlay(marker);
				  //marker.openInfoWindowHtml(mapaddress);
				}
			  }
			);
		  }
	  }
	 }
	 
	 function initializeWithLngLat(myLat,myLng)
	 {
		 if(GBrowserIsCompatible())
		 {
			 var myGeographicCoordinates = new GLatLng(myLat, myLng);
			 var map = new GMap2(document.getElementById("gmap"));
			 map.setCenter(myGeographicCoordinates, 15);
			 map.setUIToDefault();
			 var marker = new GMarker(myGeographicCoordinates);
			 map.addOverlay(marker);
		 }
	 }

