﻿// Google map.
var map = null;
var geocoder = null;
var address = null;
var point = null;

function initialize() {
  if (GBrowserIsCompatible()) {
    map = new GMap2(document.getElementById("map"));
    //map.setCenter(new GLatLng(37.4419, -122.1419), 13);
    map.addControl(new GSmallMapControl());
    map.addControl(new GMapTypeControl());
    geocoder = new GClientGeocoder();
  }
}

function showAddress(address) {
    if (address == 'N/A') {
        document.getElementById("map").style.display = 'none';
        document.getElementById("placeholder").style.display = 'block';
   } else {
        if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (point) {
              map.setCenter(point, 13);
              var marker = new GMarker(point);
              map.addOverlay(marker);
              marker.openInfoWindowHtml("<br />" + address);
            }
          }
        );
      }  
   }
}

// Resize images that are larger than 640 in width.
function resize() {
    var image = document.getElementById('image');
    
    if (image) {
        if ((image.width - 640) > 0) {
            var percent = ((image.width - 640) / image.width);
            var width = image.width - (image.width * percent);
            var height = image.height - (image.height * percent);
            image.width = width;
            image.height = height;
        }     
    }          
}

