//<![CDATA[

function load() {
	var map = new GMap2(document.getElementById('map'));

	var icon = new GIcon();
	icon.image = '/assets/pin.png';
	icon.shadow = '/assets/pin-shadow.png';
	icon.iconSize = new GSize(12, 28);
	icon.shadowSize = new GSize(28, 28);
	icon.iconAnchor = new GPoint(6, 27);
	icon.infoWindowAnchor = new GPoint(6, 0);
	icon.infoShadowAnchor = new GPoint(6, 28);

	//map.addControl(new GLargeMapControl());
	map.addControl(new GSmallMapControl());
	map.addControl(new GMapTypeControl());
	
	var address = '5030 S Liberty Street, New Orleans, LA 70115';
	var info = '<p>The Urban Conservancy<br />5030 S Liberty Street<br/>New Orleans, LA<br />70115</p>'
	
	showAddress(address, map, icon, info);
	
}

function showAddress(address, map, icon, info) {
	var geocoder = new GClientGeocoder();
	geocoder.getLatLng(
		address,
		function(point) {
			if (!point) {
				alert(address + ' not found');
			} else {
				map.setCenter(point, 13, G_MAP_TYPE);
				addMarker(map, point, icon, info);
			}
		}
	);
}

function addMarker(map, point, icon, info) {
	var marker = new GMarker(point, icon);
	map.addOverlay(marker);
	GEvent.addListener(marker, 'click', function() {
		marker.openInfoWindowHtml(info);
	});
}

//]]>