function mapEvent(id,addr,latitude,longitude,mtype) {
	if(latitude && longitude) showGeo(id,latitude,longitude,mtype);
	else showAddress(id,addr,mtype);
}

function showGeo(id,latitude,longitude,mtype) {
	var point = new GLatLng(latitude, longitude);
	if (GBrowserIsCompatible()) {
		//var mapControl = new GMapTypeControl();
		var marker = new GMarker(point);
		if(mtype == 'us') map.setCenter(new GLatLng(37.09024, -95.712891), 4);
		else if(mtype == 'state') map.setCenter(point, 6);
		else map.setCenter(point, 13);
		map.addOverlay(marker);
		//map.addControl(mapControl);
		//map.addControl(new GSmallMapControl());
		GEvent.addListener(marker, "click", function() {
			marker.openInfoWindowHtml(locs[id]);
		});
	}
}

function showAddress(id,address,mtype) {
	geocoder = new GClientGeocoder();
	geocoder.getLatLng(
		address,
		function(point) {
			//console.log(address);
			//console.log(point);
			if (!point) {
				//alert(address + " not found");
				//console.log(address + " not found");
			} else {
				var marker = new GMarker(point);
				//var mapControl = new GMapTypeControl();
				if(mtype == 'us') map.setCenter(new GLatLng(37.09024, -95.712891), 4);
				else if(mtype == 'state') map.setCenter(point, 6);
				else map.setCenter(point, 13);
				map.addOverlay(marker);
				//map.addControl(mapControl);
				//map.addControl(new GSmallMapControl());
				GEvent.addListener(marker, "click", function() {
					marker.openInfoWindowHtml(locs[id]);
				});
			}
		}
	);
}

