function FES_EventCalendarMap()
{
	var mapNode = $Node('FES-EventCalendarMap');
	var switches = null;
	var gApiReady = (typeof(GBrowserIsCompatible) != 'undefined' && GBrowserIsCompatible());
	var gMap = null;
	var gMarker = null;

	mapNode.IsOpen = function()
	{
		return (this.style.visibility == 'visible');
	}
	
	mapNode.Move = function(pSwitch)
	{
		gMap.setCenter(new GLatLng(pSwitch.latitude, pSwitch.longitude), 15);
		gMarker.setLatLng(gMap.getCenter());
		gMarker.bindInfoWindowHtml(pSwitch.html);
		gMarker.openInfoWindowHtml(pSwitch.html);
		this.style.left
			= $OffsetLeft(pSwitch.node)
			- pSwitch.node.offsetLeft + 'px';
		this.style.top
			= $OffsetTop(pSwitch.node)
			+ pSwitch.node.offsetHeight + 'px';
	}
	
	mapNode.Show = function()
	{
		this.style.visibility = 'visible';
	}
	
	mapNode.Hide = function()
	{
		this.style.visibility = 'hidden';
	}

	this.Initialize = function()
	{
		gMap = new GMap2(mapNode);
		gMap.setCenter(new GLatLng(0, 0), 15);
		gMap.addControl(new GSmallMapControl());
		gMap.addControl(new GMapTypeControl());
		gMap.addControl(new GOverviewMapControl());
		gMarker = new GMarker(new GLatLng(0, 0));
		gMap.addOverlay(gMarker);
		switches = new Array();
		document.onkeypress = function(pEvent)
		{
			var keyASCII = window.event ? window.event.keyCode : pEvent.keyCode;
			
			if (keyASCII == 27)
			{
				if (mapNode.IsOpen())
				{
					mapNode.Hide();
					for (nodeId in switches)
					{
						switches[nodeId].node.innerHTML = 'show map';
						switches[nodeId].isShowing = false;
					}
				}
			}
		}
	}
	
	this.Show = function(pSwitchNode, pEventID, pLatitude, pLongitude, pTitle, pDateHTML, pVenue, pCity)
	{
		if (!gMap) return;
	
		if(!switches[pEventID])
		{
			switches[pEventID] = new Object();
			switches[pEventID].node = pSwitchNode;
			switches[pEventID].isShowing = false;
			switches[pEventID].latitude = pLatitude;
			switches[pEventID].longitude = pLongitude;
			switches[pEventID].html = '<div id="FES-EventCalendarMapInfo">';
			switches[pEventID].html += '<div class="scTitle">' + pTitle + '</div>'
			switches[pEventID].html += pDateHTML.replace('-<br />', '&ndash; ');
			switches[pEventID].html += '<div class="scVenue">' + pVenue + '</div>';
			switches[pEventID].html += '<div class="scCity">' + pCity + '</div>';
			switches[pEventID].html += '</div>';
		}
		
		// Open own map
		if (!switches[pEventID].isShowing
			&& !mapNode.IsOpen())
		{
			mapNode.Move(switches[pEventID]);
			mapNode.Show();
			switches[pEventID].node.innerHTML = 'hide map [Esc]';
			switches[pEventID].isShowing = true;
		}
		// Close own map
		else if (switches[pEventID].isShowing
			&& mapNode.IsOpen())
		{
			mapNode.Hide()
			switches[pEventID].node.innerHTML = 'show map';
			switches[pEventID].isShowing = false;
		}
		// Take over other map
		else if (!switches[pEventID].isShowing
			&& mapNode.IsOpen())
		{
			for (nodeId in switches)
			{
				switches[nodeId].node.innerHTML = 'show map';
				switches[nodeId].isShowing = false;
			}
			mapNode.Move(switches[pEventID]);
			switches[pEventID].node.innerHTML = 'hide map [Esc]';
			switches[pEventID].isShowing = true;
		}
	}
}