///////////////////////////////////////////////////////////////
//
//  Script: Google Maps
//  Version: 1.0
//  Author: Craig Nelson / Classic Labs Development
//
//  Notes: oo version
//

  var FC = FC || {};
  
  FC.Map = function (config) {
    var that = this; // scope adjustment
    this.map = null;
    this.geocoder = null;
    this.address = config.address || "";
    
    // elements
    this.mapDisplay = config.mapDisplay || null;
    
    // methods
    this.initializeMap = function () {
      if (GBrowserIsCompatible()) {
        if (this.mapDisplay !=  null) {
          this.map = new GMap2(this.mapDisplay);
          //map.setCenter(new GLatLng(37.4419, -122.1419), 13);
          this.geocoder = new GClientGeocoder();
        }
      }
      return;
    }; // initializeMap()
    
    this.showAddress = function (address) {
      if (this.geocoder) {
        this.geocoder.getLatLng(
          address,
          function(point) {
            if (!point) {
              alert(address + " not found");
            } else {
              that.map.setCenter(point, 13);
              var marker = new GMarker(point);
              that.map.addOverlay(marker);
              //marker.openInfoWindowHtml(address);
              that.map.addControl(new GSmallMapControl());
              that.map.addControl(new GMapTypeControl());
            }
          }
        );
      }
      return;
    }; // showAddress()
    
    this.initializeMap();
    this.showAddress(this.address);
  } // constructor
