var preActive = null;
tabTopActiveBack = "#609000";
tabTopActiveAlign = "center";
tabTopActiveVAlign = "middle";
tabCurveActiveBack = "#609000";
tabMiddleActiveBack = "#609000";
textTopActiveColor = "#FFFFFF";
textTopActiveStyle = "normal";
textTopActiveSize = "13px";
textTopActiveWeight = "bold";
textTopActiveFamily = "Arial";

tabTopInactiveBack = "#306090";
tabTopInactiveAlign = "center";
tabTopInactiveVAlign = "middle";
tabCurveInactiveBack = "#306090";
tabMiddleInactiveBack = "#90C800";
textTopInactiveColor = "#FFFFFF";
textTopInactiveStyle = "normal";
textTopInactiveSize = "13px";
textTopInactiveWeight = "normal";
textTopInactiveFamily = "Arial";

tabTopHight = "18px";
tabCurveHeight = "18px";
tabCurveWidth = "1px";
tabMiddleHeight = "1px";

function getObjectRef(obj)
{
	for (var s = 0; s < document.styleSheets.length; s++) {
		if (document.all) {
			for (var r = 0; r < document.styleSheets[s].rules.length; r++) {
				if (document.styleSheets[s].rules[r].selectorText ==  obj) {
				   return document.styleSheets[s].rules[r];
				}
			}
		} else if (document.getElementById) {
			for (var r = 0; r < document.styleSheets[s].cssRules.length; r++) {
				if (document.styleSheets[s].cssRules[r].selectorText ==  obj) {
					return document.styleSheets[s].cssRules[r];					
				}
			}
		}
	}
}

function initMenu()
{
	for(i=0; i<total;i++)
	{
		if(i != activeInd) 
		{
			makeInactive(i);
		}
	}
	if(document.all)
	{
		document.all("subMenu_"+activeInd).style.display = "inline";          
	}
	else if(document.getElementById)
	{
		document.getElementById("subMenu_"+activeInd).style.display = "inline";          
	}
}
function makeActive(id)
{
	if(document.all)
	{
		if(preActive != null)
		{
			makeInactive(preActive);
			document.all("subMenu_"+preActive).style.display = "none";          
		}
		document.all("subMenu_"+activeInd).style.display = "none";          
		document.all["Tab_"+id].style["backgroundColor"] = tabTopActiveBack;
		document.all["Tab_"+id].style["textAlign"] = tabTopActiveAlign;
		document.all["Tab_"+id].style["verticalAlign"] = tabTopActiveVAlign;
		document.all["Tab_"+id].style["height"] = tabTopHight;

		document.all["Tab_"+id+"_CurveTop"].style["backgroundColor"] = tabCurveActiveBack;
		document.all["Tab_"+id+"_CurveTop"].style["height"] = tabCurveHeight;
		document.all["Tab_"+id+"_CurveTop"].style["width"] = tabCurveWidth;

		document.all["Tab_"+id+"_CurveBottom"].style["backgroundColor"] = tabCurveActiveBack;
		document.all["Tab_"+id+"_CurveBottom"].style["height"] = tabCurveHeight;
		document.all["Tab_"+id+"_CurveBottom"].style["width"] = tabCurveWidth;

		document.all["Tab_"+id+"_Middle"].style["backgroundColor"] = tabMiddleActiveBack;
		document.all["Tab_"+id+"_Middle"].style["height"] = tabMiddleHeight;

		document.all["Tab_"+id+"_Text"].style["color"] = textTopActiveColor;
		document.all["Tab_"+id+"_Text"].style["fontStyle"] = textTopActiveStyle;
		document.all["Tab_"+id+"_Text"].style["fontSize"] = textTopActiveSize;
		document.all["Tab_"+id+"_Text"].style["fontWeight"] = textTopActiveWeight;
		document.all["Tab_"+id+"_Text"].style["fontFamily"] = textTopActiveFamily;

		document.all("subMenu_"+id).style.display = "inline";	
	}
	else if(document.getElementById)
	{
		if(preActive != null)
		{
			makeInactive(preActive);
			document.getElementById("subMenu_"+preActive).style.display = "none";          
		}
		document.getElementById("subMenu_"+activeInd).style.display = "none";          

		document.getElementById("Tab_"+id).style["backgroundColor"] = tabTopActiveBack;
		document.getElementById("Tab_"+id).style["textAlign"] = tabTopActiveAlign;
		document.getElementById("Tab_"+id).style["verticalAlign"] = tabTopActiveVAlign;
		document.getElementById("Tab_"+id).style["height"] = tabTopHight;

		document.getElementById("Tab_"+id+"_CurveTop").style["backgroundColor"] = tabCurveActiveBack;
		document.getElementById("Tab_"+id+"_CurveTop").style["height"] = tabCurveHeight;
		document.getElementById("Tab_"+id+"_CurveTop").style["width"] = tabCurveWidth;

		document.getElementById("Tab_"+id+"_CurveBottom").style["backgroundColor"] = tabCurveActiveBack;
		document.getElementById("Tab_"+id+"_CurveBottom").style["height"] = tabCurveHeight;
		document.getElementById("Tab_"+id+"_CurveBottom").style["width"] = tabCurveWidth;

		document.getElementById("Tab_"+id+"_Middle").style["backgroundColor"] = tabMiddleActiveBack;
		document.getElementById("Tab_"+id+"_Middle").style["height"] = tabMiddleHeight;

		document.getElementById("Tab_"+id+"_Text").style["color"] = textTopActiveColor;
		document.getElementById("Tab_"+id+"_Text").style["fontStyle"] = textTopActiveStyle;
		document.getElementById("Tab_"+id+"_Text").style["fontSize"] = textTopActiveSize;
		document.getElementById("Tab_"+id+"_Text").style["fontWeight"] = textTopActiveWeight;
		document.getElementById("Tab_"+id+"_Text").style["fontFamily"] = textTopActiveFamily;

		//for(i=0; i<total;i++)
		//{
		//	document.getElementById("subMenu_"+i).style.display = "none";          	
		//}
		document.getElementById("subMenu_"+id).style.display = "inline";	
	}
}
function makeInactive(id)
{
	if(document.all)
	{
		document.all["Tab_"+id].style["backgroundColor"] = tabTopInactiveBack;
		document.all["Tab_"+id].style["textAlign"] = tabTopInactiveAlign;
		document.all["Tab_"+id].style["verticalAlign"] = tabTopInactiveVAlign;
		document.all["Tab_"+id].style["height"] = tabTopHight;

		document.all["Tab_"+id+"_CurveTop"].style["backgroundColor"] = tabCurveInactiveBack;
		document.all["Tab_"+id+"_CurveTop"].style["height"] = tabCurveHeight;
		document.all["Tab_"+id+"_CurveTop"].style["width"] = tabCurveWidth;

		document.all["Tab_"+id+"_CurveBottom"].style["backgroundColor"] = tabCurveInactiveBack;
		document.all["Tab_"+id+"_CurveBottom"].style["height"] = tabCurveHeight;
		document.all["Tab_"+id+"_CurveBottom"].style["width"] = tabCurveWidth;

		document.all["Tab_"+id+"_Middle"].style["backgroundColor"] = tabMiddleInactiveBack;
		document.all["Tab_"+id+"_Middle"].style["height"] = tabMiddleHeight;

		document.all["Tab_"+id+"_Text"].style["color"] = textTopInactiveColor;
		document.all["Tab_"+id+"_Text"].style["fontStyle"] = textTopInactiveStyle;
		document.all["Tab_"+id+"_Text"].style["fontSize"] = textTopInactiveSize;
		document.all["Tab_"+id+"_Text"].style["fontWeight"] = textTopInactiveWeight;
		document.all["Tab_"+id+"_Text"].style["fontFamily"] = textTopInactiveFamily;
	}
	else if(document.getElementById)
	{
    	document.getElementById("Tab_"+id).style["backgroundColor"] = tabTopInactiveBack;
		document.getElementById("Tab_"+id).style["textAlign"] = tabTopInactiveAlign;
		document.getElementById("Tab_"+id).style["verticalAlign"] = tabTopInactiveVAlign;
		document.getElementById("Tab_"+id).style["height"] = tabTopHight;

		document.getElementById("Tab_"+id+"_CurveTop").style["backgroundColor"] = tabCurveInactiveBack;
		document.getElementById("Tab_"+id+"_CurveTop").style["height"] = tabCurveHeight;
		document.getElementById("Tab_"+id+"_CurveTop").style["width"] =tabCurveWidth;

		document.getElementById("Tab_"+id+"_CurveBottom").style["backgroundColor"] = tabCurveInactiveBack;
		document.getElementById("Tab_"+id+"_CurveBottom").style["height"] = tabCurveHeight;
		document.getElementById("Tab_"+id+"_CurveBottom").style["width"] = tabCurveWidth;

		document.getElementById("Tab_"+id+"_Middle").style["backgroundColor"] = tabMiddleInactiveBack;
		document.getElementById("Tab_"+id+"_Middle").style["height"] = tabMiddleHeight;

		document.getElementById("Tab_"+id+"_Text").style["color"] = textTopInactiveColor;
		document.getElementById("Tab_"+id+"_Text").style["fontStyle"] = textTopInactiveStyle;
		document.getElementById("Tab_"+id+"_Text").style["fontSize"] = textTopInactiveSize;
		document.getElementById("Tab_"+id+"_Text").style["fontWeight"] = textTopInactiveWeight;
		document.getElementById("Tab_"+id+"_Text").style["fontFamily"] = textTopInactiveFamily;
	}
}

function showActiveSubMenu()
{
	if(preActive != null)
	{
		makeInactive(preActive);
		if(document.all)
		{
			document.all("subMenu_"+preActive).style.display = "none"; 
		}
		else if(document.getElementById)
		{
			document.getElementById("subMenu_"+preActive).style.display = "none"; 
		}
	}
	//for(i=0; i<total;i++)
	//{
	//	document.all("subMenu_"+i).style.display = "none";          
	//}
		if(document.all)
		{
			document.all("subMenu_"+activeInd).style.display = "inline";	
		}
		else if(document.getElementById)
		{
			document.getElementById("subMenu_"+activeInd).style.display = "inline";	
		}
	
}
function setPreviosActive(preActiveInd)
{
	preActive = preActiveInd;
}
