/*-----------------------------------------------------------
    Toggles tabs - Closes any open tabs, and then opens current tab
    Input:     1.The number of the current tab
                    2.The number of tabs
                    3.(optional)The number of the tab to leave open
                    4.(optional)Pass in true or false whether or not to animate the open/close of the tabs
    Output: none 
    ---------------------------------------------------------*/


function toggleTab(num,numelems)
{
    changeHeaderStyle(num,numelems);
    changeStyleBodyText(num,numelems);    
}


function changeHeaderStyle(i,listLength)
{
    for(var x=0; x<listLength; x++)
    {
        var headerName = 'tabHeader'+(x+1)
        if(x == i-1)
        {
            window.document.getElementById(headerName).className = 'activeTab';
        }
        else
        {
            window.document.getElementById(headerName).className = 'none';
        }
    }
}

function changeStyleBodyText(i,listLength)
{
    for(var x=0; x<listLength; x++)
    {
        var contentID = 'tabMainContent'+(x+1)
        if(x == i-1)
        {
            window.document.getElementById(contentID).className = 'tabContentActive';
        }
        else
        {
            window.document.getElementById(contentID).className = 'tabContent';
        }
    }
}
