var scrWidth, scrCenter, menuPosLeft, menuPosTop, menuWidth, menuID, tblWidth, topSpc, colWidth, tblMiddle, tblZero, tblAlign, pageDir, noOfMenus, subMenuItemHeight
// The height of the top bar
topSpc = 220;
// The height of each menu Item
menuItemHeight = 30;
// The width of the main table
tblWidth = 500;
// The width of the cell contains the menu -// padding right or left
//colWidth = 150;
colWidth = 0;
// Calculates the middle pixel of the main table (in case the main table is centered)
tblMiddle = tblWidth/2;
// Specify the alignment of the main table
tblAlign = 'center';
// Specify the page direction
pageDirecrion = 'ltr';
// Number of Total Sub Menus
noOfMenus = 3;
// Defines menu indentation
menuIndent= -45;

// Defines sub menu items height
subMenuItemHeight = 21;
// Defines sub menu indentation
subMenuIndent = menuIndent + 5;


// This function locates where the menues should appear
function locateMenu(menuID,menuItem,docWidth)
{
var menuItemCount,menuWidth,layerWidth,scrWidth,menuDir
scrWidth = docWidth;
tblZero = (scrWidth-tblWidth)/2;
scrCenter = scrWidth/2;
menuItemCount = menuItem-1
menuPosTop = (menuItemCount*menuItemHeight) + topSpc;
menuWidth =  document.getElementById(menuID);
layerWidth = menuWidth.offsetWidth;

var menuPosLeft
	if(tblAlign=="center")
	{
		menuPosLeft = tblZero+colWidth-menuIndent;
	}
	else
	{
		menuPosLeft = colWidth-menuIndent;
	}


document.all(menuID).style.visibility = 'visible';
document.all(menuID).style.top = menuPosTop;

	if(pageDirecrion=='rtl')
	{
		document.all(menuID).style.right = menuPosLeft;
	}
	else
	{
		document.all(menuID).style.left = menuPosLeft;
	}
}


function locateSubMenu(menuID,menuItem,subMenuItem,subMenuID,docWidth)
{
var menuWidth, layerWidth, subMenuDir, menuItemCount, subMenuItemCount, subMenuPosTop, subMenuPosLeft
menuWidth =  document.getElementById(menuID);
layerWidth = menuWidth.offsetWidth;
menuItemCount = menuItem

subMenuItemCount = subMenuItem - 1


subMenuPosTop = (menuItemCount*subMenuItemCount*subMenuItemHeight) + topSpc;
scrWidth = docWidth;
tblZero = (scrWidth-tblWidth)/2;

subMenuPosLeft = tblZero + colWidth + layerWidth - subMenuIndent;




document.all(subMenuID).style.visibility = 'visible';
document.all(subMenuID).style.top = subMenuPosTop;
	if(pageDirecrion=='rtl')
	{
		document.all(subMenuID).style.right = subMenuPosLeft;
	}
	else
	{
		document.all(subMenuID).style.left = subMenuPosLeft;
	}

}




function hideMenu(menuID) { 
document.all(menuID).style.visibility = 'hidden';
}

function keepVisible(menuID)
{
document.all(menuID).style.visibility = 'visible';
}

function hideMe(menuID)
{
document.all(menuID).style.visibility = 'hidden';
}
