var map = null;
var geocoder = null;

function GInitialize() {
	if (GBrowserIsCompatible()) {
		map = new GMap2(document.getElementById("map_canvas"));
		map.setCenter(new GLatLng(37.4419, -122.1419), 13);
		map.addControl(new GSmallMapControl());
        //map.addControl(new GMapTypeControl());
		geocoder = new GClientGeocoder();
	}
}

function GShowAddress(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 checkLoad() {
	if (document.getElementById('map_canvas')) {
		if (document.currentAddress) {
			GInitialize();
			GShowAddress(document.currentAddress);
		}
	}
}

function checkUnLoad() {
	/*
	if (document.getElementById('map_canvas')) {
		GUnload();
	}
	*/
}
