/*
 * menuExpandable2.js - implements an expandable menu based on a HTML list
 * Author: Dave Lindquist (dave@gazingus.org)
 *
 * updated by Rey Echevarria
 */

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;
	
	menu.style.display = 'none';

    if (actuator.className == 'single'){
		actuator.onclick = function(){
			var menu_items = document.getElementsByTagName('menu');
			for (var i=0; i<menu_items.length; i++){
				if(menu_items[i].id.search(/_Menu/) != -1){
					menu_items[i].style.display = 'none';
				}
			}	
			menu.style.display = 'block';
			return;
		}
    }
	if (actuator.className == 'multiple'){
		actuator.onclick = function() {
        	var display = menu.style.display;
        	//menu.parentNode.style.backgroundImage = (display == "block") ? "url()" : "url()";
        	menu.style.display = (display == 'block') ? 'none' : 'block';
        	return false;
		}
    }
}

function expandMenu(menuId) {
	var menu = document.getElementById(menuId);
	if ( menu == null ) return;
	menu.style.display = 'block';
	//currentMenu.parentNode.style.backgroundImage ="url()";
}
function showOnlyMenu(menuId){
	var menu = document.getElementById(menuId);
	var menu_items = document.getElementsByTagName('menu');
		for (var i=0; i<menu_items.length; i++){
			if(menu_items[i].id.search(/_Menu/) != -1){
				menu_items[i].style.display = 'none';
			}
		}
		menu.style.display = 'block';
	return;
}
function hideMenu(menuId) {
	var menu = document.getElementById(menuId);
	if ( menu == null ) return;
	menu.style.display = 'none';
	//currentMenu.parentNode.style.backgroundImage ="url()";
}