function changeImages()
{
        if (document.images)
        {
                document.getElementById(this.o).src = this.oImg;
        }
}

function cancelHide()
{
        if (this.tid) clearTimeout(this.tid);
}

function show()
{
        this.cancelHide();

        if (prevMenu && prevMenu!=this.oID)
        {
                eval(prevMenu+"Obj.hideCallback();");
                eval(prevMenu+"Obj.cancelHide();");
        }

        prevMenu = this.oID;
        document.getElementById(this.oID).style.display = "";
        this.oImg = "http://www.adventistchip.org/images/" + this.o + "_on.gif";
        this.changeImages();
}

function hide()
{
        this.tid = eval("setTimeout('"+this.oID+"Obj.hideCallback()', 2000);");
}

function hideCallback()
{
        document.getElementById(this.oID).style.display = 'none';
        this.oImg = "http://www.adventistchip.org/images/" + this.o + ".gif";
        this.changeImages();
}

//first object attempt
function menuMaker(oID, o)
{
        //properties
        this.oID = oID;
        this.o = o;
        this.oImg;
        this.tid;

        //methods
        this.show = show;
        this.hide = hide;
        this.hideCallback = hideCallback;
        this.cancelHide = cancelHide;
        this.changeImages = changeImages;
}

//when mouseover on non-dropdown buttons
//hide all the dropdowns that might be showing
function hideAll()
{
        document.getElementById('ddnav_about_chip').style.display = 'none';
        document.getElementById('ddnav_program').style.display = 'none';
        document.getElementById('ddnav_resources').style.display = 'none';
        document.getElementById('nav_about_chip').src= "http://www.adventistchip.org/images/nav_about_chip.gif";
        document.getElementById('nav_program').src= "http://www.adventistchip.org/images/nav_program.gif";
        document.getElementById('nav_resources').src= "http://www.adventistchip.org/images/nav_resources.gif";
}

