var clickX, clickY;
var myParentID;
var timerID = null;
var timerOn = false;
var timecount = 1000;


function showmenu(whichCol){
	show = 1;
	whichArray = eval(whichCol+"list");
	if(show == 1)
	{
		myPosX = findPosX(document.getElementById(whichCol));
		myPosY = findPosY(document.getElementById(whichCol));
  		text = '<table width="100%" cellspacing="0" cellpadding="4" class="bordertable">';
  		for(i=0;i<whichArray.length;i++){
  			text += '<tr valign="top"><td class="tooltip" onmouseover=showLayer();this.className="tooltip_over" onmouseout=hideLayer();this.className="tooltip" onClick=location.href="'+whichArray[i][1]+'">'+whichArray[i][0]+'</td></tr>'
      	}
    	text +='</table>';
		x = document.getElementById('Layer1');
		x.innerHTML = '';
		x.innerHTML = text;
		document.getElementById('Layer1').style.visibility = "visible";
		document.getElementById('Layer1').style.left = myPosX + 22;
		document.getElementById('Layer1').style.top = myPosY;
	}
}

function hidemenu(){
	show = 0;
	document.getElementById('Layer1').style.visibility = "hidden";
	stopTime();
}

function showLayer(){
	stopTime();
	document.getElementById('Layer1').style.visibility = "visible";
}

function hideLayer(){
	document.getElementById('Layer1').style.visibility = "hidden";
}

//This function is use to cause a delay in hidding the menu
function startTime() {
 	if (timerOn == false) {
		 timerID=setTimeout( "hidemenu()" , timecount);
		 timerOn = true;
 	}
 }

function stopTime() {
	if (timerOn) {
 		clearTimeout(timerID);
 		timerID = null;
 		timerOn = false;
 	}
 }

//This function is used to get the position for the rollover a href
function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent){
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)	curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent){
		while (obj.offsetParent){
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)	curtop += obj.y;
	return curtop;
}