function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    } else {
        window.onload = function() {
            oldonload();
            func();
        }
    }
}

var objTabTimer;
var intNumberOfTabs = 6; //0-based
var intCurrentTab = 0;
var intPreviousTab = null;

initGlobalnav = function() {
    if (document.all&&document.getElementById) {
        navRoot = document.getElementById("promoNavigation");
        for (i=0; i<navRoot.childNodes.length; i++) {
            node = navRoot.childNodes[i];
            if (node.childNodes.length > 0) {
                for (j=0; j<node.childNodes.length; j++) {
                    thisChildNode = node.childNodes[j];
                    if (thisChildNode.nodeName=="LI") {
                        thisChildNode.onmouseover=function() {
                            this.className+=" over";
                        }
                        thisChildNode.onmouseout=function() {
                            this.className=this.className.replace(" over", "");
                        }
                    }
                }
            }
        }
    }
}

startList = function() {
    initializeTabContent();
    objTabTimer = setTimeout("startTabTimer()",5000);
}

addLoadEvent(initGlobalnav);
addLoadEvent(startList);

function startTabTimer() {
    setTabContent(intCurrentTab);
    objTabTimer = setTimeout("startTabTimer()",5000);
}

function clearTabTimer() {
    clearTimeout(objTabTimer);
}

function initializeTabContent() {
    setTabContent(intCurrentTab);
}

function setTabContent(whichTab, fromClick) {
    if (fromClick) {
        clearTabTimer();
    }
    if (intPreviousTab != null && document.getElementById("promolink" + (intPreviousTab + 1)) != null) {
        document.getElementById("promolink" + (intPreviousTab + 1)).className = "";
    }
    intPreviousTab = intCurrentTab;
    intCurrentTab = whichTab;
    
    if (document.getElementById("promolink" + (whichTab + 1)) != null)
    {
    	document.getElementById("promolink" + (whichTab + 1)).className = "";
    	document.getElementById("promolink" + (whichTab + 1)).className+="on";
    }
    if (intCurrentTab != intPreviousTab) {
        document.getElementById("promolink" + (intPreviousTab + 1)).className = "";
    }

    if (fromClick != "true") {
        if (intCurrentTab < intNumberOfTabs) {
            intCurrentTab++;
            if (document.getElementById("promolink" + (intCurrentTab +1)) == null)
            {
                intCurrentTab = 0;
            }
        } else {
            intCurrentTab = 0;
        }
    }
}