var tabList = new Array();

function RegisterTab(tabBodyId, tabHeaderId, tabHeaderAltId, tabButtonId)
{
    var obj = document.getElementById(tabBodyId);
    if (obj)
    {
        obj.tabHeader = document.getElementById(tabHeaderId);
        obj.tabHeaderAlt = document.getElementById(tabHeaderAltId);
        obj.tabButton = document.getElementById(tabButtonId);
		SetCssClass(obj, "tabHeader", "tabHeaderSelected", "tabBody", "tabBodySelected");

        tabList[tabBodyId] = obj;
    }
}

function SetCssClass(obj, normalHeader, selectedHeader, normalBody, selectedBody)
{
	obj.normalHeaderCss = normalHeader;
	obj.selectedHeaderCss = selectedHeader;
	obj.normalBodyCss = normalBody;
	obj.selectedBodyCss = selectedBody;
}

function ShowTab(tabBodyId)
{
    for (var i in tabList)
    {
        if (i == tabBodyId)
        {
            tabList[i].className = tabList[i].selectedBodyCss;
            if (tabList[i].tabHeader)
                tabList[i].tabHeader.className = tabList[i].selectedHeaderCss;
            if (tabList[i].tabHeaderAlt)
                tabList[i].tabHeaderAlt.className = tabList[i].selectedHeaderCss + "Alt";
            if (tabList[i].tabButton)
                tabList[i].tabButton.className = tabList[i].selectedBodyCss;
        }
        else
        {
            tabList[i].className = tabList[i].normalBodyCss;
            if (tabList[i].tabHeader)
                tabList[i].tabHeader.className = tabList[i].normalHeaderCss;
            if (tabList[i].tabHeaderAlt)
                tabList[i].tabHeaderAlt.className = tabList[i].normalHeaderCss + "Alt";
            if (tabList[i].tabButton)
                tabList[i].tabButton.className = tabList[i].normalBodyCss;
        }
    }
    
    document.forms[0].selectedTab.value = tabBodyId;
}

