var activeSection = "";
var debugMenus = 0;

function alphaDebug(text) {
	if (debugMenus == 0)
		return;

	text = "Alpha debug: " + text;

	if (debugMenus == 2)
		alert(text);
	else if (debugMenus == 1)
		window.status = text;
}

function alphaShowMenu(section) {

    activeSection = section;

    alphaClearMenus();

    sectionDivName = "menu_div_" + section;
    sectionDiv = document.getElementById(sectionDivName);

    //sectionDiv.style.display = 'inline';
	sectionDiv.style.visibility = 'visible';

	alphaDebug("alphaShowMenu('" + section + "')");
}

function alphaLeaveMenu(section) {
    activeSection = "";

    setTimeout("alphaClearMenus()", 4000);

	alphaDebug("alphaLeaveMenu('" + section + "')");
}

function alphaClearMenus() {

	alphaDebug("alphaClearMenus(activeSection = '" + activeSection + "')");

    all=document.getElementsByTagName('div');

    for (i=0; i<all.length; i++) {
        if (all[i].id.indexOf("menu_div") > -1) {
            if ((activeSection != "") && (all[i].id.indexOf(activeSection) > -1)) {
                /*  This is the active section - leave it open
                 */
            } else {
                /*  Hide this section menu
                 */

                //all[i].style.display = 'none';
                all[i].style.visibility = 'hidden';
            }
        }
    }
}
