function onLoad(lon,lat) { if (GBrowserIsCompatible()) { var map = new GMap(document.getElementById("map")); map.addControl(new GSmallMapControl()); //map.addControl(new GMapTypeControl()); map.centerAndZoom(new GPoint(lon,lat), 4); // Add 10 random markers in the map viewport using the default icon. var bounds = map.getBoundsLatLng(); var width = bounds.maxX - bounds.minX; var height = bounds.maxY - bounds.minY; var point = new GPoint(lon,lat); var marker = new GMarker(point); map.addOverlay(marker); } } var localSearch = new GlocalSearch(); function usePointFromPostcode(postcode, callbackFunction) { 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{ alert("Postcode not found!"); } }); localSearch.execute(postcode + ", UK"); }