﻿/*
 * Provide tab-style navigation.
 *
 * Notes:
 * Ensure that the ID attributes of the tab "button" spans are in the format
 * tabX, where X is an integer starting at 1.
 * 
 * Ensure that the ID attributes of the tab content divs are in the format
 * tabContentX, where X is an integer starting at 1 and corresponding to the
 * appropriate Tab ID.
 *
 * Parameters:
 * tabID: Integer number of the tab ID.
 * numberOfTabs: Number of tabs in the entire set.
 */
function displayTab(tabID, numberOfTabs)
{
    for (var i = 1; i <= numberOfTabs; i++)
    {
        // tab display
        var tab = document.getElementById("tab" + i);
        if (tab != null)
        {
            if (i == tabID)
            {
                // 2 definitions -- one regular, one MS-flavored
                tab.setAttribute("class", "activeTab");
                tab.setAttribute("className", "activeTab");
            }
            else
            {
                // 2 definitions -- one regular, one MS-flavored
                tab.setAttribute("class", "inactiveTab");
                tab.setAttribute("className", "inactiveTab");
            }
        }
        
        // content display
        var content = document.getElementById("tabContent" + i);
        if (content != null)
        {
            if (i == tabID)
            {
                content.style.visibility = "visible";
                content.style.display = "block";
            }
            else
            {
                content.style.visibility = "hidden";
                content.style.display = "none";
            }
        }
    }
}
