var map = null;
var geocoder = null;
  
/**
 * Init Google Map.
 */
function initialise() {
  if (GBrowserIsCompatible()) {
    map = new GMap2(document.getElementById("map"));
    map.addControl(new GLargeMapControl());
    map.addControl(new GMapTypeControl());
    map.addControl(new GScaleControl());
    map.setCenter(new GLatLng(-42.882743, 147.330234), 11); // init at Hobart,Tasmania,Australia
    geocoder = new GClientGeocoder();

    addMarkers();
  }
}

/**
 * Put markers on Google Map using lookup of property address (callback for Geocode).
 * doCentre is deprecated.
 */
var centred = false;
function showAddress(address) {
  if (geocoder) {
    geocoder.getLatLng(
      address.fullAddress,
      function(point) {
        if (!point) {
          window.status = address.fullAddress + " not found";
        } else {
          var marker = new GMarker(point, {title: address.title});                   
          map.addOverlay(marker);
                    
          if (!centred) { // center on this result
            map.setCenter(point);
            centred = true;
          }
        }
      }
    );
  }
}

// property location object
function propertyLocation(title,url) {
  this.title = title;
  this.url = url;
  this.fullAddress = this.title + ", Tasmania, Australia";
}
