// Vehicle Specification JavaScript


// IE fix for lack of getElementById:
if ((document.all) && (!document.getElementById))
    document.getElementById = function(id)
    {
        return document.all[id];
    };
      

function showSpec(id, show)
{
    var linkExpand = document.getElementById("expand"+id);
    var linkClose  = document.getElementById("close"+id);
    var tableSpecs = document.getElementById("spec"+id);
    
    if ((!linkExpand) || (!linkClose) || (!tableSpecs)) return false;
    
    if (show) {
        linkExpand.className = "f_right expandLink hide";
        linkClose.className  = "f_right closeLink";
        tableSpecs.className = "";
    } else {
        linkExpand.className = "f_right expandLink";
        linkClose.className  = "f_right closeLink hide";
        tableSpecs.className = "hide";
    }
    
    return true;
}


function closeAllSpecs()
{
    var id = 1;
    while (true) {
        if (!showSpec(id, false)) return;
        id++;
    }
}


function openAllSpecs()
{
    var id = 1;
    while (true) {
        if (!showSpec(id, true)) return;
        id++;
    }
}


function openSpec(id)
{
    showSpec(id, true);
}

function closeSpec(id)
{
    showSpec(id, false);
}


function selectModel()
{
    var url = document.getElementById("modelSelect").value;
    window.location.href = url;
}
