﻿
function PortalNav()
{
    this.COOKIE_NAME = "PortalNavTabCookie";
    this.TAB_ELEM_ID_PREFIX = "topNav";   // Defined in the portal navigation xsl file.
    this.ACTIVE_TAB_CLASS_NAME = "active";
}

PortalNav.prototype.click = function(tabID)
{
    var expires = "";

    if(tabID)
    {
        createCookie(this.COOKIE_NAME, tabID, null);
    }
}

PortalNav.prototype.initialize = function()
{
    if(Utilities.qs('Cmd') == "LogOut")
    {
        deleteCookie(this.COOKIE_NAME); 
        return;
    } 

    var tabID = readCookie(this.COOKIE_NAME);
    
    if(tabID)
    {
        var portalTabElem = document.getElementById(this.TAB_ELEM_ID_PREFIX+tabID);
        if(portalTabElem)
        {
            portalTabElem.className = this.ACTIVE_TAB_CLASS_NAME;
        }
        else alert(tabID);
    }
}