function getcoordinates(txtpostcode, txtlatitude, txtlongitude, txtgoogledesc, formid) {

	var localSearch = new GlocalSearch();

	if (document.getElementById(txtpostcode).value != "")
	{
		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);
	
					document.getElementById(txtlatitude).value = point.lat();
					document.getElementById(txtlongitude).value = point.lng();
					document.getElementById(txtgoogledesc).value = localSearch.results[0].titleNoFormatting;	
					document.getElementById(formid).submit();
					
				} else {	
					alert("WARNING : Postcode not found!");
				}
			});
		
		localSearch.execute(document.getElementById(txtpostcode).value + ", UK");
		
		return false; // stop form being posted prematurely
	} else {
		return true; 
	}
}

function setFocus(txtfld){
     document.getElementById(txtfld).focus();
}