﻿// JScript File
var menuItems = new Array("contactMenu","resumeMenu","pubMenu","curResMenu","linksMenu");
var divList = new Array("contactDiv","resumeDiv", "pubDiv", "curResDiv", "linksDiv");

function g(objName)
{
    return document.getElementById(objName);
}

function dispOver(objName)
{
    var obj = g(objName);
    var backColor = obj.style.backgroundColor;
    obj.style.backgroundColor = 'White';
    obj.style.cursor = 'pointer';
    obj.oldBackColor = backColor;
}

function dispOut(objName)
{
    var obj = g(objName);
    if(obj.style.backgroundColor == 'silver')
        return;
    obj.style.backgroundColor = obj.oldBackColor;
    obj.style.cursor = 'default';
}

function dispClicked(objName, objDiv)
{
    dispClearOthers(objName, objDiv);
    var obj = g(objName);
    var objDiv = g(objDiv);
    obj.style.backgroundColor = 'silver';
    objDiv.style.display = 'block';
}

function dispClearOthers(objName, objDiv)
{
    //Revert background color of everything other than objName
    for(i = 0; i < menuItems.length; i++)
    {
        if(menuItems[i].valueOf() != objName)
        {
            var toChange = g(menuItems[i]);
            if(toChange.style.backgroundColor == 'silver')
                toChange.style.backgroundColor = '#E2EAF9';
        }     
    }
    //make all divs invisible apart from what's clicked
    for(i = 0; i < divList.length; i++)
    {
        if(divList[i].valueOf() != objDiv)
        {
            var toChange = g(divList[i]);
            if(toChange.style.display == 'block')
                toChange.style.display = 'none';
        }
    }
}

function pageLoad()
{
    //mark contact menu as selected
    dispClicked('contactMenu','contactDiv');
}
