var productMenu_inactive = new Array();
productMenu_inactive[0] = "media/design/smallTabs/LMI.gif";
productMenu_inactive[1] = "media/design/smallTabs/OI.gif";
productMenu_inactive[2] = "media/design/smallTabs/OI.gif";
productMenu_inactive[3] = "media/design/smallTabs/OI.gif";
productMenu_inactive[4] = "media/design/smallTabs/OI.gif";
productMenu_inactive[5] = "media/design/smallTabs/RMI.gif";

var productMenu_activeRight = new Array();
productMenu_activeRight[0] = "media/design/smallTabs/LMA.gif";
productMenu_activeRight[1] = "media/design/smallTabs/ORA.gif";
productMenu_activeRight[2] = "media/design/smallTabs/ORA.gif";
productMenu_activeRight[3] = "media/design/smallTabs/ORA.gif";
productMenu_activeRight[4] = "media/design/smallTabs/ORA.gif";
productMenu_activeRight[5] = "media/design/smallTabs/RMA.gif"; 

var productMenu_activeLeft = new Array();
productMenu_activeLeft[0] = "media/design/smallTabs/LMA.gif";
productMenu_activeLeft[1] = "media/design/smallTabs/OLA.gif";
productMenu_activeLeft[2] = "media/design/smallTabs/OLA.gif";
productMenu_activeLeft[3] = "media/design/smallTabs/OLA.gif";
productMenu_activeLeft[4] = "media/design/smallTabs/OLA.gif";
productMenu_activeLeft[5] = "media/design/smallTabs/RMA.gif"; 

function GetPage()
{
	var url = window.location.href.toLowerCase();
	var page = url.substr(url.lastIndexOf('/') + 1);
	if (page == "")
		page = "default.aspx";
	else
	{
		if (page.indexOf('?') > -1)
			page = page.substr(0, 12);
	}
	return page;
}

function productMenuClick(span, action)
{
	var index;
	var prefix = "productMenu_separator";
	var id;
	productMenuInactivateTabs();
	span.className = "active";

	id = span.previousSibling.id;
	index = id.substr(prefix.length);
	span.previousSibling.src = productMenu_activeRight[index];

	id = span.nextSibling.id;
	index = id.substr(prefix.length);
	span.nextSibling.src = productMenu_activeLeft[index];
	var activeTab = document.getElementById("productMenuActiveTab");
	activeTab.value = span.id;
	setTimeout("productMenu_OnClick('" + action + "');", 0);
	setTimeout("saveActiveTab('" + span.id + "');", 0);
}

function productMenuInactivateTabs()
{
	var menu = document.getElementById("productMenu");
	var index;
	var id;
	var prefix = "productMenu_separator";
	for (i = 0; i < menu.childNodes.length; i++)
	{
		id = String(menu.childNodes[i].id);
		if (id.indexOf(prefix) > -1)
		{
			index = id.substr(prefix.length);
			menu.childNodes[i].src = productMenu_inactive[index];
		}
		else if (menu.childNodes[i].className == "active")
			menu.childNodes[i].className = "inactive"
	}
}

function productMenu_hidePanels()
{
	document.getElementById("pnlOverview").style.display = "none";
	document.getElementById("pnlSpec").style.display = "none";
	document.getElementById("pnlSupport").style.display = "none";
	document.getElementById("pnlDownload").style.display = "none";
	document.getElementById("pnlAccessories").style.display = "none";
}

function productMenu_OnClick(pnl)
{
	productMenu_hidePanels();
	document.getElementById(pnl).style.display = "block";
}

function productMenuInit()
{
	var activeTab = document.getElementById("productMenuActiveTab");
	if (activeTab.value == "")
	{
		switch (GetPage())
		{
			case "spec.aspx" :
				activeTab.value = "lblSpec";
				break;
			case "support.aspx" :
				activeTab.value = "lblSupport";
				break;
			case "download.aspx" :
				activeTab.value = "lblDownload";
				break;
			case "accessories.aspx" :
				activeTab.value = "lblAccessories";
				break;
			default :
				activeTab.value = "lblOverview";
		}
	}
	var tab = document.getElementById(activeTab.value);
	if (tab)
		tab.onclick();
}


function saveActiveTab(tab)
{
	Anthem_InvokePageMethod(
			"SaveActiveTab", 
			[tab],
			function (result)
			{
			}
	); 
}

// Anthem Exception indicator function
function Anthem_Error(result) {
	//alert('Anthem_Error was invoked with the following error message: ' + result.error);
}
