var map = null;
var geocoder = null;

function initialize() {
      google.load("maps", "2");
	  
	  
	  if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map_canvas"));
        map.setCenter(new GLatLng(37.4419, -122.1419), 13);
        geocoder = new GClientGeocoder();
      }
}

function initialize(div) {
      if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById(div));
        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 {
              map.setCenter(point, 13);
              var marker = new GMarker(point);
              map.addOverlay(marker);
              marker.openInfoWindowHtml(address);
            }
          }
        );
      }
}



function buildingShow(address, div) {
	var map_canvas = document.getElementById(div);	
	if (map_canvas.style.display == "block") {
		new Effect.Fade(div);	
		return;
	}
	
	
	map_canvas.style.display = "block"; 
	
	initialize(div); 
	showAddress(address); 
	
	
}


/*
* ECO FRIENDLY
*/
function addLocation(address, div) {
	
	var map_canvas = document.getElementById(div);	
	if (map_canvas.style.display == "block") {
		new Effect.Fade(div);	
		return;
	}
	
	
	map_canvas.style.display = "block"; 
	
	initialize(div); 
	showAddress(address); 
	
	
}
