pageIsLoaded = false;

var buttons = new Array("home", "about", "hdk", "services", "markets", "platforms", "clients", "partners", "resources", "careers");
var states = new Array("on", "off", "dn");

function makeImages(buttonList, states)
    {
    for (button in buttonList)
        {
        for (state in states)
            {
            var buttonName = buttonList[button] + "_" + states[state];
            eval(buttonName + " = new Image();");
            eval(buttonName + ".src = \"images/nav/" + buttonName + ".gif\";");
            }
        }
    pageIsLoaded = true;
    setAtState();
    }

function swapImage(which, state)
    {
    if (!pageIsLoaded)
        {
        return false;
        }
    eval("document." + which + ".src = " + which + "_" + state + ".src;");
    }
    
function setAtState()
    {
    if (arguments.length == 0)
        {
        var urlParts = document.location.href.split("/");
        var fileName = urlParts[urlParts.length - 1];
        var fileNameParts = fileName.split(".");
        var fileNameOnly = fileNameParts[0];
        if (fileNameOnly == "index")
            {
            fileNameOnly = "home";
            }
        }
        else
        {
        fileNameOnly = arguments[0];
        }
    imageToChange = document.getElementById(fileNameOnly);
    if (imageToChange)
        {
        eval("imageToChange.src = \"images/nav/" + fileNameOnly + "_at.gif\";");
        eval(fileNameOnly + "_on.src = \"images/nav/" + fileNameOnly + "_at.gif\";");
        eval(fileNameOnly + "_off.src = \"images/nav/" + fileNameOnly + "_at.gif\";");
        eval(fileNameOnly + "_dn.src = \"images/nav/" + fileNameOnly + "_at.gif\";");
        }
    }    
    
// function for changing the background colors of the side navigation for mouse up and mouse down
function changeColor(obj, color)
    {
    if (obj.style)
        {
        obj.style.backgroundColor = color;
        }
    
    if (obj.firstChild)
        {
        changeColor(obj.firstChild, color);
        }
    }

    