
// On page load, call this function
function mapload() {
  // Turn the map display on
  var theMap = document.getElementById("mapblock");
  theMap.style.display = "block";

  // Create new map object
  map = new GMap2(document.getElementById("unitmap"));
  map.addControl(new GSmallMapControl());
  map.addControl(new GMapTypeControl());
  map.addControl(new GScaleControl());
  // Create new geocoding object
  geocoder = new GClientGeocoder();

  // Retrieve location information, pass it to addToMap()
  geocoder.getLocations(address, addToMap);
}

// Add the point to the map
function addToMap(response) {
  if (response.Placemark) {
    // Retrieve the object
    place = response.Placemark[0];

    // Retrieve the latitude and longitude
    point = new GLatLng(place.Point.coordinates[1],
                        place.Point.coordinates[0]);

    // Center the map on this point
    map.setCenter(point, 14);
    map.setZoom(15);

    // Create a marker
    marker = new GMarker(point);

    // Add the marker to map
    map.addOverlay(marker);

    // Add address information to marker
    marker.openInfoWindowHtml(rental);
  } else {
    // Turn the map display off
    var theMap = document.getElementById("mapblock");
    theMap.style.display = "none";
  }
  
}

