var map
var localSearch = new GlocalSearch()

var icon = new GIcon();
icon.image = "http://www.google.com/mapfiles/marker.png"
icon.shadow = "http://www.google.com/mapfiles/shadow50.png"
icon.iconSize = new GSize(20, 34)
icon.shadowSize = new GSize(37, 34)
icon.iconAnchor = new GPoint(10, 34)

function mapLoad() {
	if (GBrowserIsCompatible()) {
		map = new GMap2($("map"))
		map.addControl(new GSmallMapControl())
		map.addControl(new GMapTypeControl())
	}
		
	localSearch.setSearchCompleteCallback(null, 
		function() {			
		if (localSearch.results[0]) {		
			resultLat = localSearch.results[0].lat
			resultLng = localSearch.results[0].lng
			point = new GLatLng(resultLat, resultLng)
			map.setCenter(point, 17)
			marker = new GMarker(point, icon)
			map.addOverlay(marker)
			map.setZoom(12)
		}
	})
	
	localSearch.execute(postcode)
}

GSearch.setOnLoadCallback(mapLoad)