/*
 * menuExpandable.js - implements an expandable menu based on a HTML list
 * Author: Dave Lindquist (dave@gazingus.org)
 */

if (!document.getElementById)
    document.getElementById = function() { return null; }

function initializeMenu(menuId, actuatorId) {
    var menu = document.getElementById(menuId);
    var actuator = document.getElementById(actuatorId);

    if (menu == null || actuator == null) return;

    //if (window.opera) return; // I'm too tired

    actuator.parentNode.style.listStyleImage = "url(http://www.kentrygiel.com/a/dynetek/images/plus.gif)";
    actuator.onclick = function() {
        var display = menu.style.display;
        this.parentNode.style.listStyleImage =
            (display == "block") ? "url(http://www.kentrygiel.com/a/dynetek/images/plus.gif)" : "url(http://www.kentrygiel.com/a/dynetek/images/minus.gif)";
        menu.style.listStyleImage = "url(http://www.kentrygiel.com/a/dynetek/images/square.gif)";
        menu.style.display = (display == "block") ? "none" : "block";

        return false;
    }
}


function initializeMenu2(menuId, actuatorId) {
    var menu = document.getElementById(menuId);
    var actuator = document.getElementById(actuatorId);

    if (menu == null || actuator == null) return;

    //if (window.opera) return; // I'm too tired

    actuator.parentNode.style.listStyleImage = "url(http://www.kentrygiel.com/a/dynetek/images/minus.gif)";
    actuator.onclick = function() {
        var display = menu.style.display;
        this.parentNode.style.listStyleImage =
            (display == "none") ? "url(http://www.kentrygiel.com/a/dynetek/images/minus.gif)" : "url(http://www.kentrygiel.com/a/dynetek/images/plus.gif)";
        menu.style.listStyleImage = "url(http://www.kentrygiel.com/a/dynetek/images/square.gif)";
        menu.style.display = (display == "none") ? "block" : "none";

        return false;
    }
}

function initializeFootnote(menuId, actuatorId, footnote2, footnote3, footnote4) {
    var footnote = document.getElementById(menuId);
    var footnote2 = document.getElementById(footnote2);
    var footnote3 = document.getElementById(footnote3);
    var footnote4 = document.getElementById(footnote4);    
    var footnoteActuator = document.getElementById(actuatorId);

    if (footnote == null || footnoteActuator == null) return;

    //if (window.opera) return; // I'm too tired

    footnoteActuator.onclick = function() {
        var display = footnote.style.display;

        footnote.style.display = (display == "block") ? "block" : "block";
        footnote2.style.display = "none";
        footnote3.style.display = "none";
        footnote4.style.display = "none";
        
        return false;
    }
}
