//////////////////////////////////////////////////////////////////////////
//  Program: support.js
//  Purpose: Support Area JavaScript Functions
//   Author: Robert W. Murray, robert.murray@gateway.com (and past others)
//
//////////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////////////
//  Used by the product support page to control the expanding/collapsing
//  lists for user guides, drivers, and specs.   *rwm*050216
//
function showExpand(n)
    {
    document.getElementById(n+"_picon").style.display = "none";
    document.getElementById(n+"_micon").style.display = "block";
    document.getElementById(n+"_content").style.display = "block";
    }

function hideExpand(n)
    {
    document.getElementById(n+"_picon").style.display = "block";
    document.getElementById(n+"_micon").style.display = "none";
    document.getElementById(n+"_content").style.display = "none";
    }


//////////////////////////////////////////////////////////////////////////
//  These three functions are used by the product support page for the
//  drop-down menu selection controls for user guides, drivers and specs.
//

//-------------------------------------------------------------------------
//  NEW functions for the product support drop-down lists.
//



//////////////////////////////////////////////////////////////////////////
//
//  These three functions are used by the product support page for the
//  drop-down menu selection controls fro user guides, drivers and specs.
//  Changed to enable/disable other controls downstream for the eMachines
//  redesign.
//
var supportPage = "/support/product_support.html";
    
function initPS() 
    {
    if (!document.getproduct.cat.value)  {
        disable(2); 
        disable(3); 
        }
    else if (!document.getproduct.subcat.value)  {
        disable(3); 
        document.getproduct.subcat.selected = true;
        document.getproduct.subcat.focus();
        }
    else if (!document.getproduct.model.value)  {
        document.getproduct.model.selected = true;
        document.getproduct.model.focus();
        }
    /* document.getElementById("tblSelectors").visibility = "visible"; */
    }

function gotCat() 
    {
    var cat = document.getproduct.cat.value;
    var goURL = ""
    if (cat) goURL = "?cat="+[cat];
    if (document.getproduct.subcat) document.getproduct.subcat.value = '';
    enable(2);
    disable(3);
    top.location.href = [supportPage]+[goURL];
    }

function gotSubcat() 
    {
    var cat    = document.getproduct.cat.value;
    var subcat = document.getproduct.subcat.value;
    var goURL  = "";
    if (subcat) goURL = "?cat="+[cat]+"&subcat="+[subcat];
    if (document.getproduct.model) document.getproduct.model.value = '';
    enable(3);
    top.location.href = [supportPage]+[goURL];
    }   
 
function gotModel() 
    {
    var cat    = document.getproduct.cat.value;
    var subcat = document.getproduct.subcat.value;
    var model  = document.getproduct.model.value;
    var goURL  = "";
    if (model) goURL  = "?cat="+[cat]+"&subcat="+[subcat]+"&model="+[model];
    top.location.href = [supportPage]+[goURL];
    }

function enable(dropper)    { psDropperUpdate(dropper,'en');  }

function disable(dropper)   { psDropperUpdate(dropper,'dis'); }

function psDropperUpdate(dropper, ableflag)
    {
    var dropable = false;
    var fontwate = "normal";

    if (ableflag == 'en')  {
        dropable = true;
        fontwate = "bold";
        }
        
    switch (dropper)
        {
        case 1: 
            document.getElementById("cat").disabled = !dropable;
            document.getElementById("lblCat").style.fontWeight = fontwate;
            break;
        case 2: 
            document.getElementById("subcat").disabled = !dropable;
            document.getElementById("lblSubcat").style.fontWeight = fontwate;
            break;
        case 3: 
            document.getElementById("model").disabled = !dropable;
            document.getElementById("lblModel").style.fontWeight = fontwate;
            break;
        }
    }


