﻿var map = null;
var geocoder = null;


function mapload(address,divid,gheight,gwidth) {
if (GBrowserIsCompatible()) {
     //this is the construct you need to use to get the map to display correctly:
     var map = new GMap2(document.getElementById(divid),
                        {size: new GSize(gwidth,gheight)});  //this is where the height and width are set.
    
  geocoder = new GClientGeocoder();
  
   //map.removeMapType(G_HYBRID_MAP);
   //map.addMapType(G_PHYSICAL_MAP);
  map.addMapType(G_HYBRID_MAP);
  
  
  //var mapControl = new GMapTypeControl();
   
  //map.addControl(mapControl);
  //map.addControl(new GSmallMapControl());
  
  if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
              if (!point) {
                  alert(address + " not found");
              } else {
                  map.setCenter(point, 14);
                  var marker = new GMarker(point);
                  map.addOverlay(marker);
                  //marker.openInfoWindowHtml(address);

              }
          }
        );
  }
  
 //map.setCenter(new GLatLng(lat,lon),13,G_PHYSICAL_MAP);
 // Add marker
 //var point = new GLatLng(lat,lon);
//map.addOverlay(new GMarker(point));
 return true;
}
}


function initialize(divid) {
    if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById(divid));
        map.setCenter(new GLatLng(37.4419, -122.1419), 13);
        geocoder = new GClientGeocoder();
    }
}

function showAddress(address) {
    if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
              if (!point) {
                  alert(address + " not found");
              } else {
                 
                  var marker = new GMarker(point);
                  map.addOverlay(marker);
                  //marker.openInfoWindowHtml(address);
                 map.setCenter(point, 9);
              }
          }
        );
    }
}



