// Date : 9/2/2006		Created by : Wong C. K.
// Description:
// All the menu control script.
//
var d=document;
var loading=true;
var Netscape=d.layers;
var Explorer=d.all;
var Dom=(d.getElementsByTagName) ? d.getElementsByTagName('div') : null;
var time=0;
var ticker=false;
var vis='visible';
var hid='hidden';

if(Netscape){hid='hide';vis='show';}

var olddivstyle=false;
var alldivs=Netscape || Explorer || Dom;
var delaying=true;
var ondelay=false;

function TMstayon(num)
{
	TMoff();
	nom = "menu"+num;
	thediv = alldivs[nom];
	
	if(thediv)
	{
		thedivstyle=thediv.style || thediv;
		thedivstyle.visibility=vis;
		olddivstyle=thedivstyle;
	};
	
	ticker=true;
}

function TMon(num)
{
	if(loading)
	{
		setTimeout('TMon("'+num+'")',10);
		return false;
	}
	ondelay=setTimeout("TMstayon("+num+")",0);
	return true;
}

function TMoff()
{
	clearTimeout(ondelay);
	if (olddivstyle){olddivstyle.visibility=hid;}
}

function timer()
{
	ticker=false;
	clearTimeout(time);
	time=window.setTimeout("TMoff2()",500);
}

function TMoff2()
{
	if (!ticker) TMoff();
}

d.onclick=TMoff;