// display selection table
// table # passed as 'table'

var lastId = null;	// holds the element ID (as a string) of the currently-displayed select table div
			// from the time that the display fires until it disappears
var idName;		// saves the table ID as a string
var selectTimer = null;	// holds active select table timer handle while visibility is sweeping
var saveTable;		// saves table ID from the initial mouseover until the display fires
var width = 0;		// saves interim width of select table display during sweep
var latch = false;	// true when a mouseover starts timer for display request
			// reset by body click to clear display or a new display fire
var latchTimer = null;	// holds active latch timer handle
var hold = true;	// hold select table displays if true (set for first 1/2 sec of page load
			// unless reset by page explicitly before then)
			
window.setTimeout("resetHold()", 500);

// here on first mousemove to reset display hold

function resetHold()
{
	hold = false;
}

// here on mouseover to start latch timer
// arg contains select id requested as an int

function select(table)
{
	// if initial page hold is set, ignore request
	if (hold == true)
		return;
	
	// if there is an active latch timing down, cancel it
	
	if (latchTimer != null)
		window.clearTimeout(latchTimer);
	
	// set latch and a new timer
	// also save the requested id of the div for the requested select table (as an int)
	
	latch = true;
	latchTimer = window.setTimeout("startDisplay()", 500);
	saveTable = table;
}

// here on a mouseout event to cancel a pending display fire

function cancelLatch()
{
	// if a mouseover has started a display request timeout
	// cancel it - this was just a flyover event
	
	if (latch == true)
	{
		if (latchTimer != null)
		{
			window.clearTimeout(latchTimer);
			latchTimer = null;
		}
	}
	latch = false;
}

// here when latch times out indicating a new table is to be displayed

function startDisplay()
{
	// see if there is an existing table being displayed
	// remove it if so
	
	if (lastId != null)
	{
		document.getElementById(lastId).style.display = "none";
		lastId = null;
	}
	
	// set up the display params and an interval timer
	// and display the initial div frame
	
	selectTimer = window.setInterval("displayTable();", 15);
	idName = "select" + saveTable;
	document.getElementById(idName).style.width = "10px";
	width = 10;
	document.getElementById(idName).style.display = "block";
	lastId = idName;
}

// here to increment the display table div to the next frame

function displayTable()
{
	if (width >= 800)
	{
		window.clearInterval(selectTimer);
		selectTimer = null;

		return;
	}
	width = width + 10;
	document.getElementById(idName).style.width = width + "px";
}

function clearSelects()
{
	if (lastId != null)
		document.getElementById(lastId).style.display = "none";
	lastId = null;
	latch = null;
}

function goPage(page)
{
	window.location = page + ".shtml";
}
