//****************************************************************************
// Class MenuItem
//****************************************************************************
function MenuItem()
{
	this.m_Name;
	this.m_Link;
	this.m_IsSubMenu;
	this.m_SubMenu;
	this.Render = MenuItemRenderImpl;
}

function MenuItemRenderImpl()
{
	var HTMLContent = "<tr>";

	if (this.m_IsSubMenu) {
		HTMLContent = HTMLContent + "<td onmouseover=\"document.getElementById('" + this.m_SubMenu.m_ContainerId + "').style.display='inline'\">";
		HTMLContent = HTMLContent + this.m_Name;
	} else {
		HTMLContent = HTMLContent + "<td class='MenuItem' onmouseover='this.className=\"MenuItemHighlight\";' onmouseout='this.className=\"MenuItem\";'><a href=\"" + this.m_Link + "\">";
		HTMLContent = HTMLContent + this.m_Name;
		HTMLContent = HTMLContent + "<\a>";
	}
	HTMLContent = HTMLContent + "</td></tr>";
	return HTMLContent;
}

//****************************************************************************
// Class Menu
//****************************************************************************
function Menu() 
	{
    this.m_ContainerId;
	this.m_Items = new Array();
	this.AddItem = AddItemImpl;
	this.Show = ShowImpl;
	this.Hide = HideImpl;
	this.Render = RenderImpl;
}

function AddItemImpl(p_Item)
{
	 this.m_Items[this.m_Items.length] = p_Item;
}

function ShowImpl() 
{

	document.getElementById(this.m_ContainerId).style.display = "block";
}

function HideImpl() 
{
	document.getElementById(this.m_ContainerId).style.display = "none";
}

function RenderImpl()
{
    var HTMLContent;
	HTMLContent = "<table class=\'Menu\'>";
	for (i = 0; i < this.m_Items.length; ++i) {
		var item = this.m_Items[i];
		HTMLContent = HTMLContent + item.Render();
	}
    HTMLContent = HTMLContent + "</table>";
	document.getElementById(this.m_ContainerId).innerHTML = HTMLContent;
}
