function postcodeToLatLon()
    {
    var postcode = document.getElementById('postcode').value;
    var button = document.getElementById('searchButton');
    button.style.display ="none";
    var status = document.getElementById('labelSearching');
    status.style.display ="";
    var form = document.getElementById('formSearchServices');
    //search for postcode
    //converts posctode to longitude and latitude
    if (postcode != "")
      {
      if (isPostcodeValid(postcode) == false)
          {
          button.style.display ="";
          status.style.display ="none";
          return 0;
          }
      var localSearch = new GlocalSearch();
      localSearch.setSearchCompleteCallback(null, function() {
          result = localSearch.results[0];
          if (result != undefined)
            {
            lat = document.getElementById('latitude');
            lat.value = result.lat;
            lng = document.getElementById('longitude');
            lng.value = result.lng;
            form.submit();
            }
          else
            {
            alert('Postcode cannot be found!');
            button.style.display ="";
            status.style.display ="none";
            return 0;
            }
          });
      localSearch.execute(postcode);
      return 1;
      }
    else
      {
      form.submit();
      return 1;
      }
}

function isPostcodeValid(postcode)
{
    if (window.RegExp)
    {
        var rxPostcode = new RegExp("^\\s*([Gg][Ii][Rr]\\s*0[Aa]{2}|([A-Za-z](([A-Za-z]\\d\\w?)|(\\d\\w?))\\s*\\d[A-Za-z]{2}))\\s*$");
        if (!rxPostcode.test(postcode))
        {
            alert("'"+ postcode +"' is not in the correct format. " +
              "Valid forms are: LD DLL, LDD DLL, LLD DLL, LLDD DLL, LDL DLL, LLDL DLL,"+
              "where L - letter, D - digit");
            return false;
        }
    }
    return true;
}

url = "http://www.cds.coop"
// Create marker icon
var you_icon = new GIcon();
you_icon.image = url + "/cooperative_marker.png";
you_icon.shadow = url + "/cooperative_shadow.png";
you_icon.iconSize = new GSize(20, 34);
you_icon.shadowSize = new GSize(37, 34);
you_icon.iconAnchor = new GPoint(9, 34);
you_icon.infoWindowAnchor = new GPoint(9, 2);

function addYouInCenter(map)
{
    var you_marker = new GMarker(map.getCenter(), you_icon);
    map.addOverlay(you_marker);
}
