var Maps = {
	Setup : function()
	{
		if (window.GUnload) 
		{
			if(Maps.CreateMapContainer('map-text'))
			{
				Maps.Mapload();
			}
		} 
	}
	,
	CreateMapContainer : function(elemName) 
	{
		
		/**
		 * Creates a <div id="map"> to hold a new Google Map.  This div should be styled to an appropriate size.
		 * 
		 * @param {Node} elem a Node DOM element, containing no non-text child nodes, that will be replaced by the new <div>.
		 * 
		 */
		 
		var elem = document.getElementById(elemName);
		
		if(elem)
		{
			var mapDiv = document.createElement('div');
			mapDiv.id = 'map';
			mapDiv.title = (elem.firstchild && elem.firstChild.nodeValue) || null;

			elem.parentNode.replaceChild(mapDiv, elem);
			
			return true;
		}
	}
	,
	Mapload : function() 
	{
		/**
		 * Loads a new Google Map into a pre-existing DOM element <div id="map">
		 * 
		 */

		document.getElementsByTagName('body')[0].onunload=GUnload;
		if (GBrowserIsCompatible()) {
			var map = new GMap2(document.getElementById('map'));
			map.addControl(new GSmallMapControl());
			//map.addControl(new GMapTypeControl());

			var center = new GLatLng(21.101557,-75.929947);
			map.setCenter(center, 7);

			map.setMapType(G_NORMAL_MAP);
			var point = new GLatLng(21.101557,-75.929947);
			map.addOverlay(new GMarker(point));
			
			//map.openInfoWindowHtml(point, content);
		}
	}
}
window.addToOnload(Maps.Setup);
