var map = null;
var geocoder = null;
var address = '13 East 124th street, New York, NY 10035';
var address2 = '85 Broadway, Monticello, NY';
geocoder = new GClientGeocoder();
function initialize() {
	if (GBrowserIsCompatible()) {
		// define the crosshair tile layer and its required functions
		var crossLayer = new GTileLayer(new GCopyrightCollection(""), 0, 15);
		crossLayer.getTileUrl = function(tile, zoom) {
			return "./include/tile_crosshairs.png";
		}
		crossLayer.isPng = function() {
			return true;
		}

		// Create a new map type incorporating the tile layer
		var layerTerCross = [ G_PHYSICAL_MAP.getTileLayers()[0], crossLayer ];
		var mtTerCross = new GMapType(layerTerCross, G_PHYSICAL_MAP
				.getProjection(), "Ter+");
		// --------------------------------------------------------------------
		// newyork map
		var map = new GMap2(document.getElementById("left_map_canvas"), {
			size : new GSize(340, 280)
		});
		map.addMapType(G_PHYSICAL_MAP);
		map.addMapType(mtTerCross);
		geocoder.getLatLng(address, function(point) {
			if (!point) {
				alert("can not parsing: " + address);
			} else {
				map.setCenter(point, 13);
				var marker = new GMarker(point);
				map.addOverlay(marker);

			}
		});
		map.addControl(new GLargeMapControl())

		// --------------------------------------------------------------------
		// upstate map

		var map2 = new GMap2(document.getElementById("right_map_canvas"), {
			size : new GSize(340, 280)
		});
		map2.addMapType(G_PHYSICAL_MAP);
		map2.addMapType(mtTerCross);
		geocoder.getLatLng(address2, function(point) {
			if (!point) {
				alert("can not parsing: " + address2);
			} else {
				map2.setCenter(point, 13);
				var marker = new GMarker(point);
				map2.addOverlay(marker);

			}
		});
		map2.addControl(new GLargeMapControl())

		// ---------------------------------------------------------------------

		var mapControl = new GHierarchicalMapTypeControl();

		// Set up map type menu relationships
		mapControl.clearRelationships();
		mapControl.addRelationship(G_SATELLITE_MAP, G_HYBRID_MAP, "Labels",
				false);
		mapControl.addRelationship(G_PHYSICAL_MAP, mtTerCross, "Crosshairs");

		// Add control after you've specified the relationships
		map.addControl(mapControl);
		map2.addControl(mapControl);
	}
}
