function setupmap() {
  if (GBrowserIsCompatible()) {
    var map = new GMap2(document.getElementById("map"));
    map.addControl(new GLargeMapControl());
    map.addControl(new GMapTypeControl());
    map.addControl(new DreamcatcherOptionsControl());
    var point = new GLatLng(-34.207413,150.610515);
    map.setCenter(point, 13);
    var marker = new GMarker(point);
    map.addOverlay(marker);
    showInfo(marker, null);
    GEvent.addListener(map, "click", showInfo);
  }
}

function showInfo(marker, point) {
   if (marker) {
      marker.openInfoWindowHtml("<b>Dreamcatcher Lodge</b><br/>2330 Remembrance Drv,<br/>Picton, NSW 2571");
   }
}

window.onload = setupmap;
window.unload = GUnload;

function DreamcatcherOptionsControl() {
}
DreamcatcherOptionsControl.prototype = new GControl();

DreamcatcherOptionsControl.prototype.initialize = function(map) {
  var container = document.createElement("div");

  var localZoomDiv = document.createElement("div");
  this.setButtonStyle_(localZoomDiv);
  container.appendChild(localZoomDiv);
  localZoomDiv.appendChild(document.createTextNode("Show Picton"));
  GEvent.addDomListener(localZoomDiv, "click", function() {
    goHome(map,13);
  });

  var stateZoomDiv = document.createElement("div");
  this.setButtonStyle_(stateZoomDiv);
  container.appendChild(stateZoomDiv);
  stateZoomDiv.appendChild(document.createTextNode("Show Sydney"));
  GEvent.addDomListener(stateZoomDiv, "click", function() {
    goHome(map,8);
  });

  map.getContainer().appendChild(container);
  return container;
}

function goHome(map, zoomLevel) {
    var point = new GLatLng(-34.207413,150.610515);
    map.setCenter(point, zoomLevel);
}

// By default, the control will appear in the bottom right corner of the
// map with 7 pixels of padding.
DreamcatcherOptionsControl.prototype.getDefaultPosition = function() {
  return new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(7, 15));
}

// Sets the proper CSS for the given button element.
DreamcatcherOptionsControl.prototype.setButtonStyle_ = function(button) {
  button.style.textDecoration = "underline";
  button.style.color = "#0000cc";
  button.style.backgroundColor = "white";
  button.style.font = "x-small Arial";
  button.style.border = "1px solid black";
  button.style.padding = "2px";
  button.style.marginBottom = "3px";
  button.style.textAlign = "center";
  button.style.width = "8em";
  button.style.cursor = "pointer";
}
