// Google Map Store Mapper by Address
// 2008.08.05 Dan Gronitz

var map = null;
var geocoder = null;

if(GBrowserIsCompatible()){
  geocoder = new GClientGeocoder();

  if(geocoder){
    geocoder.getLatLng(
      address,
      function(point){
        if(!point){
            alert(address + " cannot be found.");
        }else{

          // Custom map marker
          var pIcon = new GIcon(G_DEFAULT_ICON);
//          pIcon.image = "marker1.png";
          markerOptions = { icon:pIcon };

          // Map and center point
          map = new GMap2(document.getElementById(MAP_ID));
          map.setCenter(point, 14);

          // Load custom 'P' marker on map
          var marker = new GMarker(point, markerOptions);
          map.addOverlay(marker);

          // Information bubble on marker
          marker.openInfoWindowHtml(infoBubble);

          // Add map controls
          map.addControl(new GMapTypeControl(), new GControlPosition(G_ANCHOR_BOTTOM_LEFT, new GSize(10,10)));
          map.addControl(new GLargeMapControl(), new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(10,10)));
        }
      }
    );
  }
}
