// ---------------------------------------------- //
// ProductMenu Global Variables
// ---------------------------------------------- //
var _productMenu_menuTimer;

// ---------------------------------------------- //
// Event Handling Methods
// ---------------------------------------------- //
function productMenu_over(cell)
{
	productMenu_clearMenuTimer();
	productMenu_showSubMenu(productMenu_getSubMenu(cell));
}

function productMenu_out(cell)
{
	productMenu_setMenuTimer();
}

// ---------------------------------------------- //
// Utility Methods
// ---------------------------------------------- //
function productMenu_setMenuTimer()
{
	_productMenu_menuTimer = setTimeout("productMenu_closeAll()", 1000);
}

function productMenu_clearMenuTimer()
{
	clearTimeout(_productMenu_menuTimer);
}

function productMenu_getSubMenu(cell)
{
	for (var j = 0; j < cell.childNodes.length; j++)
	{
		if (cell.childNodes[j].tagName == "TABLE")
		{
			return cell.childNodes[j];
		}
	}
}

function productMenu_closeAll()
{
	var productMenu = document.getElementById("__productMenu");
	var menuRows = productMenu.tBodies[0];
	
	for (var i = 0; i < menuRows.rows.length; i += 1)
	{
		var subMenu = productMenu_getSubMenu(menuRows.rows[i].cells[0]);
		
		if (subMenu != null)
		{
			subMenu.style.display = "none";
		}
	}
}

function productMenu_showSubMenu(subMenu)
{
	productMenu_closeAll();
	
	if (subMenu != null)
	{
		subMenu.style.display = "block";
	}
}
