var map = new Array();
var geocoder = new Array();
map[1] = null;
geocoder[1] = null;
map[2] = null;
geocoder[2] = null;


function initialize(addr, addr2, name) {
if(GBrowserIsCompatible()) {
	map[1] = new GMap2(document.getElementById("map_canvas1"));
	map[1].addControl(new GSmallMapControl());

	if(addr2) {
		map[2] = new GMap2(document.getElementById("map_canvas2"));
		map[2].addControl(new GSmallMapControl());
		}
	//map.addControl(new GMapTypeControl());

	/*
	var myexIcon = new GIcon();myexIcon.image = "/images/icon-ask.gif";
	myexIcon.iconSize = new GSize(38, 29);
	myexIcon.iconAnchor = new GPoint(19, 14);
	myexIcon.infoWindowAnchor = new GPoint(5, 5);
	markerOptions = { icon:myexIcon };
	*/
	

	geocoder[1] = new GClientGeocoder();
	showAddress(addr, name, 1)
	if(addr2) {
		geocoder[2] = new GClientGeocoder();
		showAddress(addr, name, 2)
		}
	//showAddress(addr, name, markerOptions)
	}
}

function showAddress(address, name, num, markerOptions) {
if(geocoder[num]) {
geocoder[num].getLatLng(
		address,
		function(point) {
			if(!point) {
				i = 1;
				} else {
					map[num].setCenter(point, 16);
					var marker = new GMarker(point, markerOptions);
					map[num].addOverlay(marker);
					marker.openInfoWindowHtml('<b>' + name + '</b><br />' + address);
					}
				}
		);
	}
}