//	This script is for displaying the collapsable menu of places.
//
var g_oLastItemShown	= null;


function highlightById(strId, fDirect)	{ highlightRegion( document.getElementById( strId ), fDirect ); }
function highlightByEvent(evt, fDirect)	{ highlightRegion( GetEventSrc(evt), fDirect ); }

function hideById(strId)		{ hideRegion( document.getElementById( strId ) ); }
function hideByEvent(evt)		{ hideRegion( GetEventSrc(evt) ); }


//
//
function highlightRegion(oArea)
{
	try
	{
		var oSpan	= document.getElementById("spnTitle");

		//	Show the title of the area
		//
		if (null != oSpan)
			oSpan.innerHTML	= oArea.title;
		//else
		//	oSpan.innerHTML	= "?";

		//	Next, highlight the area in the small map
		//
		if  (!IsNetscape())
		{
			oArea.focus();
		}
	}
	catch (ex)
	{
		emitEx(ex, "highlighting region '" );//+ oArea.title);
	}
}


//
//
function hideRegion(oArea)
{
	try
	{
		var oSpan	= document.getElementById("spnTitle");

		//	Next, highlight the area in the small map
		//
		if  (!IsNetscape())
			oArea.blur();

		//	Show the title of the area
		//
		if (null != oSpan)
			oSpan.innerHTML	= "&#160;";
	}
	catch (ex)
	{
		emitEx(ex, "hiding region '" );//+ oArea.title);
	}
}


//	Shows one.  If it's already showing, it LEAVES it as showing.
//
//
function showInfoDiv(oDiv)
{
	//
	//
	if (null == oDiv)
		return;

	//	Allow passing as object or as string ID of object
	//
	if (null != oDiv.length)
		oDiv	= document.getElementById( oDiv );


	//	Toggles to on or off.
	//
	showObject(oDiv);//swapDisplay(oDiv);


	//	Try to hide the PREVIOUS div, only if:
	//		1. there WAS one
	//		2. It wasn't THIS one
	//
	//	If it's the same, then it means we
	//	just turned it off--so we're back
	//	to the original state of no 'last'
	//	object
	//
	if (oDiv != g_oLastItemShown)
	//	g_oLastItemShown	= null;

	//else
	{
		//	Hide the previous item
		//
		if (null != g_oLastItemShown)
	    		hideObject( g_oLastItemShown);//swapDisplay( g_oLastItemShown );

		//	Remember the current item for
		//	next time, as the 'last' item.
		//
		g_oLastItemShown	= oDiv;
	}



	//	Scroll to give the focus to this object
	//
	//oDiv.parentElement.scrollTop	= oDiv.offsetTop;
}

