// GOOGLE MAP GOODNESS
// At this point, we're assuming that we only have one Google Map up at a time.
var map = null;
var address = null;

function gmap(addr, map_canvas_id) {
	address = addr;
	map = new GMap2(document.getElementById(map_canvas_id));
	var geocoder = new GClientGeocoder();
	geocoder.setBaseCountryCode('us');
	geocoder.setViewport(new GLatLngBounds(new GLatLng(43.34, 89.34), new GLatLng(49.23, 97.12)));
	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('<b>' + address + '</b>');
    	}
  	}
	);
	return map;
}

function gdirection(to_addr, dir_canvas_id) {
  var dirs = new GDirections(map, document.getElementById(dir_canvas_id));
  dirs.load(to_addr + ' to ' + address);
}
