


//// VARIABLES AND FUNCTION FOR AUTO SPIFF FEATURE

var running = true;

var interval = 4000; // 1000 = 1 sec

var nextViewIndex = -1; 

    

    function spiffAutoScroll(){

    

    if (running){

    

    var hotAutoTabs = document.getElementById('hotSpiffTabs');

    var autoLinks = hotAutoTabs.getElementsByTagName('a');

        for (var y=0;y < autoLinks.length;y++){

                if(nextViewIndex >= 0)

                {   

                    if(nextViewIndex == y)

                    {

                        //set viewable

                        var autoCurrentTab = autoLinks[y].id;

                        //set icons

                        autoLinks[y].className = "active";

                        //swap tab for zone to get id

                        var autoTempZone = autoCurrentTab.replace("tab","zone");

                        //set background

                        document.getElementById(autoTempZone).className = "visible"

        

                    } else {

                        //set viewable

                        var autoCurrentTab = autoLinks[y].id;

                        //set icons

                        autoLinks[y].className = "non-active";

                        //swap tab for zone to get id

                        var autoTempZone = autoCurrentTab.replace("tab","zone");

                        //set background

                        document.getElementById(autoTempZone).className = "hidden"

                    }

                } 

                

                if (nextViewIndex == -1 && ((autoLinks.length - 1) == y))

                {

                    nextViewIndex = 0;

                }



        }

            nextViewIndex++;

            if (nextViewIndex > (autoLinks.length - 1))

            {

                nextViewIndex = 0;

            }       

        

    setTimeout("spiffAutoScroll();",interval)

    }

    

}




/// WAIT FOR THE PAGE TO LOAD.

window.onload = function(){ 





    

//// CALL AUTO SPIFF FEATURE

    spiffAutoScroll();



    

//// MANUAL CLICK SPIFF FEATURE



    var hotSpiffTabs = document.getElementById('hotSpiffTabs');

    var spiffLinks = hotSpiffTabs.getElementsByTagName('a');

    var spiffCounter = spiffLinks.length;

   

    for (var i=0;i < spiffLinks.length;i++){

    

    spiffLinks[i].onclick = function() {

    /// Activate Tab

    

    /// STOP AUTO PLAY OF THE SPIFF's

    running = false;

    

    var currentSpiffTab = this.id;

    this.className = "active"

    

    /// Activate Zone /// SWAP OUT TAB FOR ZONE

    var newSpiffZone = currentSpiffTab.replace("tab","zone")

    document.getElementById(newSpiffZone).className = "visible"

    

    /// Loop through all links and disable enable the classes

    for (var y=0;y < spiffCounter;y++){

                

                /// If Not the clicked link 

                if(spiffLinks[y].id != currentSpiffTab){

                

                /// make sure all the non clicked tabs are off

                spiffLinks[y].className = "visible"

                

                /// make sure all the accociated zones are off

                var spiffCurrentTab = spiffLinks[y].id

                /// Swap out tab for zone

                var spiffNewZone = spiffCurrentTab.replace("tab","zone")

                document.getElementById(spiffNewZone).className = "hidden"

                

                }

                //alert(status);

                    

    }       

    return false; // This disables the redirect of the live link if javascript is enabled. 

    };

    }



}
