// JavaScript Document
var testdiv;
//Top main menu variables
var curPgId=parseInt(pageId.substr(0,1));
var curSubPgId=parseInt(pageId.substr(1,1));
var TMMtable;						//position of top main menu
var TMMobj;							//top main menu pointer image obj
var TMMcurCell;					//location of top main menu pointer image
var TMMseekTimer;				//seek timer for top main menu
var TMMmovIndex=0;			//used to time moves
var TMMmovStart;				//Starting point of move
var TMMchange;					//amount of change for move
var TMMduration=1000;		//Duration for move
var TMMcellLocs = new Array();					//Location of center of cells
var numTopMenuItems=4;
//Top main menu
function TMMinit()
	{
	TMMtable = document.getElementById("TopMenu");
	for (var i=0; i<TMMtable.rows[0].cells.length; i++)
		{
		TMMcellLocs[i] = parseInt(TMMtable.offsetLeft + TMMtable.rows[0].cells[i].offsetLeft + (TMMtable.rows[0].cells[i].offsetWidth/2));
		}
	TMMobj = document.getElementById("TMMPointer");
	TMMcurCell = curPgId;
	if (TMMcurCell>(numTopMenuItems-1)) TMMcurCell=0;
	TMMobj.src="images/MenuPointerUp.gif";
	TMMobj.style.left=TMMcellLocs[TMMcurCell]+"px";
	TMMobj.style.top=TMMtable.offsetTop+27+"px";
	}
//Top main menu move functions
function TMMover(cell)
	{
	clearInterval(TMMseekTimer);												//stop any previous move
	if (curPgId>(numTopMenuItems-1))
		{
		TMMobj.style.left=TMMcellLocs[0]+"px";
		TMMobj.style.display="inline";											//turn on in case not current menu
		}
	TMMmovIndex=0;
	TMMmovStart = parseInt(TMMobj.style.left);					//capture starting point
	TMMchange=TMMcellLocs[cell]-TMMmovStart;
	TMMseekTimer=setInterval("TMMseek()",10);
	}
function TMMout()
	{
	clearInterval(TMMseekTimer);									//stop any previous move
	TMMmovIndex=0;
	TMMmovStart = parseInt(TMMobj.style.left);		//capture starting point
	TMMchange=TMMcellLocs[TMMcurCell]-TMMmovStart;
	TMMseekTimer=setInterval("TMMseek()",10);
	if (curPgId>(numTopMenuItems-1))	TMMobj.style.display="none";						//turn off if not current menu
	}
function TMMseek() 
	{
	var tIndex = TMMmovIndex;
	TMMobj.style.left = parseInt(TMMchange * ((tIndex = tIndex / TMMduration - 1) * tIndex * tIndex * tIndex * tIndex + 1) + TMMmovStart)+"px";		//(EaseOutStrong)
	TMMmovIndex+=10;
	if (TMMmovIndex >= TMMduration) clearInterval(TMMseekTimer);
	}

//Top sub menu variables
var TSMtable;						//position of top main menu
var TSMobj;							//top main menu pointer image obj
var TSMcurCell;					//location of top main menu pointer image
var TSMseekTimer;				//seek timer for top main menu
var TSMmovIndex=0;			//used to time moves
var TSMmovStart;				//Starting point of move
var TSMchange;					//amount of change for move
var TSMduration=1000;		//Duration for move
var TSMcellLocs = new Array();					//Location of center of cells
//Top sub menu
function TSMinit()
	{
	TSMtable = document.getElementById("TopSubMenu");
	if (TSMtable != null)
		{
		for (var i=0; i<TSMtable.rows[0].cells.length; i++)
			{
			TSMcellLocs[i] = parseInt(TSMtable.rows[0].cells[i].offsetLeft + (TSMtable.rows[0].cells[i].offsetWidth/2));
			}
		TSMobj = document.getElementById("TSMPointer");
		TSMcurCell = curSubPgId-1;
		if (TSMcurCell<0) TSMcurCell=0;
		TSMobj.src="images/MenuPointerDown.gif";
		TSMobj.style.left = TSMcellLocs[TSMcurCell]+"px";
		TSMobj.style.top=TSMtable.offsetTop-3+"px";
		}
	}
//Top sub menu move functions
function TSMover(cell)
	{
	clearInterval(TSMseekTimer);																		//stop any previous move
	TSMmovIndex=0;
	TSMmovStart = parseInt(TSMobj.style.left);											//capture starting point
	TSMchange=TSMcellLocs[cell]-TSMmovStart;
	TSMseekTimer=setInterval("TSMseek()",10);
	if (curSubPgId == 0)	TSMobj.style.display="inline";	//turn on in case not current menu
	}
function TSMout()
	{
	clearInterval(TSMseekTimer);																		//stop any previous move
	TSMmovIndex=0;
	TSMmovStart = parseInt(TSMobj.style.left);											//capture starting point
	TSMchange=TSMcellLocs[TSMcurCell]-TSMmovStart;
	TSMseekTimer=setInterval("TSMseek()",10);
	if (curSubPgId == 0)	TSMobj.style.display="none";		//turn off if not current menu
	}
function TSMseek() 
	{
	var tIndex = TSMmovIndex;
	TSMobj.style.left = parseInt(TSMchange * ((tIndex = tIndex / TSMduration - 1) * tIndex * tIndex * tIndex * tIndex + 1) + TSMmovStart)+"px";		//(EaseOutStrong)
	TSMmovIndex+=10;
	if (TSMmovIndex >= TSMduration) clearInterval(TSMseekTimer);
	}

//Bottom main menu variables
var BMMtable;						//position of top main menu
var BMMobj;							//top main menu pointer image obj
var BMMcurCell;					//location of top main menu pointer image
var BMMseekTimer;				//seek timer for top main menu
var BMMmovIndex=0;			//used to time moves
var BMMmovStart;				//Starting point of move
var BMMchange;					//amount of change for move
var BMMduration=1000;		//Duration for move
var BMMcellLocs = new Array();					//Location of center of cells
//Bottom main menu
function BMMinit()
	{
	BMMtable = document.getElementById("BottomMenu");
	for (var i=0; i<BMMtable.rows[0].cells.length; i++)
		{
		BMMcellLocs[i] = parseInt(BMMtable.offsetLeft + BMMtable.rows[0].cells[i].offsetLeft + (BMMtable.rows[0].cells[i].offsetWidth/2));
		}
	BMMobj = document.getElementById("BMMPointer");
	BMMcurCell = curPgId-numTopMenuItems;
	if (BMMcurCell < 0)	BMMcurCell =0;
	BMMobj.src="images/MenuPointerDown.gif";
	BMMobj.style.left=BMMcellLocs[BMMcurCell]+"px";
	BMMobj.style.top=BMMtable.offsetTop+"px";
	}
//Bottom main menu move functions
function BMMover(cell)
	{
	clearInterval(BMMseekTimer);									//stop any previous move
	if (curPgId<numTopMenuItems)
		{
		BMMobj.style.left=BMMcellLocs[0]+"px";
		BMMobj.style.display="inline";							//turn on in case not current menu
		}
	BMMmovIndex=0;
	BMMmovStart = parseInt(BMMobj.style.left);		//capture starting point
	BMMchange=BMMcellLocs[cell]-BMMmovStart;
	BMMseekTimer=setInterval("BMMseek()",10);
	}
function BMMout()
	{
	clearInterval(BMMseekTimer);									//stop any previous move
	BMMmovIndex=0;
	BMMmovStart = parseInt(BMMobj.style.left);		//capture starting point
	BMMchange=BMMcellLocs[BMMcurCell]-BMMmovStart;
	BMMseekTimer=setInterval("BMMseek()",10);
	if (curPgId<numTopMenuItems)	BMMobj.style.display="none";						//turn off if not current menu
	}
function BMMseek() 
	{
	var tIndex = BMMmovIndex;
	BMMobj.style.left = parseInt(BMMchange * ((tIndex = tIndex / BMMduration - 1) * tIndex * tIndex * tIndex * tIndex + 1) + BMMmovStart)+"px";		//(EaseOutStrong)
	BMMmovIndex+=10;
	if (BMMmovIndex >= BMMduration) clearInterval(BMMseekTimer);
	}

//Bottom sub menu variables
var BSMtable;						//position of top main menu
var BSMobj;							//top main menu pointer image obj
var BSMcurCell;					//location of top main menu pointer image
var BSMseekTimer;				//seek timer for top main menu
var BSMmovIndex=0;			//used to time moves
var BSMmovStart;				//Starting point of move
var BSMchange;					//amount of change for move
var BSMduration=1000;		//Duration for move
var BSMcellLocs = new Array();					//Location of center of cells
//Bottom sub menu
function BSMinit()
	{
	BSMtable = document.getElementById("BottomSubMenu");
	if (BSMtable != null)
		{
		for (var i=0; i<BSMtable.rows[0].cells.length; i++)
			{
			BSMcellLocs[i] = parseInt(BSMtable.rows[0].cells[i].offsetLeft + (BSMtable.rows[0].cells[i].offsetWidth/2));
			}
		BSMobj = document.getElementById("BSMPointer");
		BSMcurCell = curSubPgId-1;
		if (BSMcurCell<0) BSMcurCell=0;
		BSMobj.src="images/MenuPointerUp.gif";
		BSMobj.style.left = BSMcellLocs[BSMcurCell]+"px";
		BSMobj.style.top=BSMtable.offsetTop+25+"px";
		}
	}
//Bottom sub menu move functions
function BSMover(cell)
	{
	clearInterval(BSMseekTimer);																		//stop any previous move
	BSMmovIndex=0;
	BSMmovStart = parseInt(BSMobj.style.left);											//capture starting point
	BSMchange=BSMcellLocs[cell]-BSMmovStart;
	BSMseekTimer=setInterval("BSMseek()",10);
	if (curSubPgId == 0)	BSMobj.style.display="inline";	//turn on in case not current menu
	}
function BSMout()
	{
	clearInterval(BSMseekTimer);																		//stop any previous move
	BSMmovIndex=0;
	BSMmovStart = parseInt(BSMobj.style.left);											//capture starting point
	BSMchange=BSMcellLocs[BSMcurCell]-BSMmovStart;
	BSMseekTimer=setInterval("BSMseek()",10);
	if (curSubPgId == 0)	BSMobj.style.display="none";		//turn off if not current menu
	}
function BSMseek() 
	{
	var tIndex = BSMmovIndex;
	BSMobj.style.left = parseInt(BSMchange * ((tIndex = tIndex / BSMduration - 1) * tIndex * tIndex * tIndex * tIndex + 1) + BSMmovStart)+"px";		//(EaseOutStrong)
	BSMmovIndex+=10;
	if (BSMmovIndex >= BSMduration) clearInterval(BSMseekTimer);
	}
function findPos(obj) 	//find current position of element on screen
	{
	var curleft = curtop = 0;
	if (obj.offsetParent) 
		{
		do {
		curleft += obj.offsetLeft;
		curtop += obj.offsetTop;
		} while (obj = obj.offsetParent);
		}
	return [curleft,curtop];
	}
function MenuInit()
	{
	TMMinit();
	TSMinit();
	BMMinit();
	BSMinit();
	if (parseInt(pageId.substr(0,1))<numTopMenuItems) 
			{
			TMMobj.style.display="inline";	//Top menu
			if (TSMobj != null) TSMobj.style.display = (pageId.substr(1,1) == "0")?"none":"inline";	//Top sub menu
			}
		else
			{
			BMMobj.style.display="inline";	//Bottom menu
			if (BSMobj != null)	BSMobj.style.display = (pageId.substr(1,1) == "0")?"none":"inline";	//Top sub menu
			}
	}

