/*
 * dropmenu.js - implements an dropdown menu based on a HTML list
 */

var currentMenu = null;

if (!document.getElementById)
    document.getElementById = function() { return null; }

function initializeMenu(menuId, doitId, goawayId, gonowId, goodbyId) {
    var menu = document.getElementById(menuId);
    var doit = document.getElementById(doitId);
    var goaway = document.getElementById(goawayId);
    var gonow = document.getElementById(gonowId);
    var goodby = document.getElementById(goodbyId);

    if (menu == null || doit == null) return;

    doit.onmouseover = function() {
		document.btn1.src = "art/portfoli-on.gif";
        if (currentMenu == null) {
            this.showMenu();
        }
        else {
            currentMenu.style.visibility = "hidden";
            currentMenu = null;
        }

        return false;
	}


    goaway.onmouseover = function() {
            document.btn2.src = "art/services-on.gif";
            document.btn1.src = "art/portfoli-off.gif";
        if (currentMenu == menu) {
            currentMenu.style.visibility = "hidden";
            currentMenu = null;
        	}
	}
    goaway.onmouseout = function() {
            document.btn2.src = "art/services-off.gif";
	}
    gonow.onmouseover = function() {
            document.btn3.src = "art/about-on.gif";
            document.btn1.src = "art/portfoli-off.gif";
        if (currentMenu == menu) {
            currentMenu.style.visibility = "hidden";
            currentMenu = null;
        	}
	}
    gonow.onmouseout = function() {
            document.btn3.src = "art/about-off.gif";
	}
    goodby.onmouseover = function() {
            document.btn4.src = "art/contact-on.gif";
            document.btn1.src = "art/portfoli-off.gif";
        if (currentMenu == menu) {
            currentMenu.style.visibility = "hidden";
            currentMenu = null;
        	}
	}
    goodby.onmouseout = function() {
            document.btn4.src = "art/contact-off.gif";
	}

    menu.onclick = function() {
        if (currentMenu == menu) {
            currentMenu.style.visibility = "hidden";
            currentMenu = null;
        	}
	}

    doit.showMenu = function() {
        menu.style.visibility = "visible";
        currentMenu = menu;
    }
}

