var geocoder;
var ok = false;

function load() {
  if (GBrowserIsCompatible()) {
    geocoder = new GClientGeocoder();
  }
}

function searchLocations() {

 var address = document.getElementById('fdPostCode').value;
 
 if(address == "") { 
   
   alert("Please enter a post code / town.");
   return false;
   
 } else {
  
    geocoder.getLatLng(address + ", UK", function(latlng) {

      var form = document.getElementById('srcDealers');
      var lngInput = document.getElementById('lngInput');
      var latInput = document.getElementById('latInput');
  
      if (latlng) {
        lngInput.value = latlng.lng();
        latInput.value = latlng.lat();
        ok = true;
      } else {
        alert("Sorry but we can not find the address: \n\n'" + address + "'\n\nPlease try again. If you continue to have problems, please contact us.");
        ok = false;
      }

   });

  if(ok) {
    return true;
  } else {
    return false;
  }
  
 }

}