﻿// JScript File

function TabConfigurator()
{
}


TabConfigurator.prototype.TabIds = null;
TabConfigurator.prototype.AreasToShowHide = null;
TabConfigurator.prototype.SelectedTabIndex = "";
TabConfigurator.prototype.SetTabByIndex = TabConfiguator_SetTabByIndex;


    function TabConfiguator_SetTabByIndex(ndxSelectedTab)
    {
        this.SelectedTabIndex = this.TabIds[ndxSelectedTab];
        
        var isActiveTab = false;
        var idOfAreaToShowHide;
        var totalTabLinks = this.TabIds.length;
        var totalTabAreasToShowHide = 0;
        
        if( this.AreasToShowHide )
        {
           totalTabAreasToShowHide = this.AreasToShowHide.length;
        }
        
        // Set up the tabs.
        for (var ndx = 0; ndx < totalTabLinks; ndx++)
        {
            var currentTab = this.TabIds[ndx];
            isActiveTab = (ndx == ndxSelectedTab);
            
            ConfigureTab(currentTab, isActiveTab);
                        
            if( totalTabAreasToShowHide > 0 )
            {
                idOfAreaToShowHide = this.AreasToShowHide[ndx];
                // Now set up areas to show/hide 
                ShowHideItem(idOfAreaToShowHide, isActiveTab);            
            }
        }
    }
    
    
    function ConfigureTab(idLink, isActive) 
    { 
        var className = "tabInactive"; 
        if(isActive) 
            className = "current"
            //className = "tabActive"; 
        
        document.getElementById(idLink).className = className;
    }