if (typeof(ASPERITY) == 'undefined') {
	ASPERITY	= {};
	ASPERITY.UI	= {};
}

ASPERITY.UI.Map	= function()
{
	var mapID = 'map_canvas';
	var map;
	
	var init	= function() {
		
		var obj = document.getElementById(mapID);
		var geocoder = new GClientGeocoder();
		
		if (obj) {
			map = new GMap2(obj);
			address = obj.getAttribute('title');
			
			geocoder.getLatLng(address, function(point) {
				if (point) {
					var icon   = new GIcon(G_DEFAULT_ICON);
					// icon.image = '/img/map-pin.png';
					// icon.iconSize = new GSize(43.0, 72.0);
					// icon.shadowSize = new GSize(0, 0);
					// icon.iconAnchor = new GPoint(36, 72);
					
					map.setCenter(point, 13);
					var marker = new GMarker(point, {icon:icon});
					map.addOverlay(marker);
				}
			});
			
			map.addControl(new GSmallMapControl());
			map.addControl(new GMapTypeControl());
		}
		
	};
	
	return {
		init: init
	};
	
}();

jQuery(function($) { ASPERITY.UI.Map.init(); });