﻿
var oProductGroupIds = new Array();
var oCategoryContentDivHidden = false;
var oActiveProductGroupId = 0;

function addProductGroupId(id)
{
    oProductGroupIds.push(id);
}

function hideAllProductGroups()
{

    var index;
    var max;
    var ctl;
    
    max = oProductGroupIds.length;
    index = 0;
    while (index < max)
    {
        ctl = document.getElementById("ProductGroupContentDiv_" + oProductGroupIds[index]);
        ctl.style.display = "none";
        index++;
    }

}

function showProductGroup(id)
{
    var ctl;
    var deActivateId;
    
    hideAllProductGroups();
    
    if (oCategoryContentDivHidden == false)
    {    
        oCategoryContentDivHidden = true;
        
        ctl = document.getElementById("CategoryContentDiv");
        ctl.style.display = "none";
                
        ctl = document.getElementById("ProductGroupContentDiv");
        ctl.style.display = "block";                
    }
    
    ctl = document.getElementById("ProductGroupContentDiv_" + id);
    ctl.style.display = "block";
    
    
    if ((oActiveProductGroupId != 0) && (oActiveProductGroupId != id))
    {
        deActivateId = oActiveProductGroupId;        
    }
    else
    {
        deActivateId = 0;
    }
    
    oActiveProductGroupId = id;
    
    if ((deActivateId != 0) && (deActivateId != oActiveProductGroupId))
    {
        setProductGroupLinkIdle(deActivateId);
    }

    document.getElementById("DefaultSelectTextBox").focus();
    //window.focus();
}


function setProductGroupLinkActive(categoryId)
{
    document.getElementById("IdleLinkImage_" + categoryId).style.display = "none";
    document.getElementById("ActiveLink_" + categoryId).style.display = "block";
    
    document.getElementById("LinkText_" + categoryId).style.backgroundImage = "url('../../media/Images/white_back.gif')";
}

function setProductGroupLinkIdle(categoryId)
{
    if (categoryId != oActiveProductGroupId)
    {            
        document.getElementById("ActiveLink_" + categoryId).style.display = "none";   
        document.getElementById("IdleLinkImage_" + categoryId).style.display = "block";     
        
        document.getElementById("LinkText_" + categoryId).style.backgroundImage = "url('../../media/Images/blue_back.gif')";
    }
}


function openFeature(featureAlias)
{
    window.open("Feature.aspx?feature=" + featureAlias, "", "width=400,height=400");
}

