/*
 * menuExpandable3.js - implements an expandable menu based on a HTML list
 * Author: Dave Lindquist (http://www.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.backgroundImage = "url(/Immagini/plus.gif)";
    actuator.onclick = function() 
	{
        var display = menu.style.display;
        
		//ricavo la chiave dall'id dell'elemento
		//var chiave=menu.id.substr(0,menu.id.length-4)//Es. 3Menu chiave=3
		var chiave=menu.id.substr(menu.id.length-1,1)//Es. Menu3 chiave=3

		if(display=="block") 
		{
			//Chiudo il nodo
			this.parentNode.style.backgroundImage="url(/Immagini/plus.gif)" 
			menu.style.display="none";
			tmp=objServer.SetMenu("closed",chiave)
		}
		else
		{
			//Apro il nodo
			this.parentNode.style.backgroundImage="url(/Immagini/minus.gif)";
			menu.style.display="block";
			tmp=objServer.SetMenu("open",chiave)
		}
        return false;
    }
}



