var map = null;
var geocoder = null;

function load() {
  if (GBrowserIsCompatible()) {
    map = new GMap2(document.getElementById("map"));
    map.addControl(new GSmallMapControl());
    map.addControl(new GMapTypeControl());
    map.setCenter(new GLatLng(39.0853, -94.5804), 2);
    geocoder = new GClientGeocoder();
  }
}

function loadSpecific(myMap) {
  if (GBrowserIsCompatible()) {
    map = new GMap2(myMap);
    map.addControl(new GSmallMapControl());
    map.addControl(new GMapTypeControl());
    map.setCenter(new GLatLng(39.0853, -94.5804), 2);
    geocoder = new GClientGeocoder();
  }
}

function showAddress(address, displayText) {
  if (geocoder) {
    geocoder.getLatLng(
      address,
      function(point) {
        if (!point) {
          map.openInfoWindow(map.getCenter(), document.createTextNode(address + " not found"));
        } else {
          map.setCenter(point, 15);
          var marker = new GMarker(point);
          map.addOverlay(marker);
          if(displayText == null || displayText == "")
            { displayText = address; }
          marker.openInfoWindowHtml(displayText);
        }
      }
    );
  }
}
