/*
 * menuExpandable2.js - implements an expandable menu based on a HTML list
 * Author: Dave Lindquist (dave@gazingus.org)
 */
var C_collapse=0, C_expand=1;
 
if (!document.getElementById)
    document.getElementById = function() { return null; }

	 
function SetState(menu, actuator, expand) {
	//actuator.parentNode.style.backgroundImage =(expand) ? "url(/modules/taxonomy_dhtml/minus.gif)" : "url(/modules/taxonomy_dhtml/plus.gif)";
	if(actuator != null)
	{
		actuator.src =(expand) ? "/modules/taxonomy_dhtml/minus.gif" : "/modules/taxonomy_dhtml/plus.gif";
   	if(menu != null)
			menu.style.display = (expand) ? "block" : "none";
	}
}
 
function initializeMenu(menuId, actuatorId, expand) {
    var menu = document.getElementById(menuId);
    var actuator = document.getElementById(actuatorId);

    if (menu == null || actuator == null) return;

    // if (window.opera) return; // Opera 7 works well, so commenting this

	 SetState(menu, actuator, expand);

    actuator.onclick = function() {
        var display = menu.style.display;
		  if (display == "block") 	 SetState(menu, actuator, C_collapse);
		  else SetState(menu, actuator, C_expand);
        return false;
    }
}

function ExpandCurrentElement() {
    var a=ExpandCurrentElement;
   // alert(a.arguments[0] + ";"+ a.arguments[a.arguments.length-1]+ "!");

    for(i=0;i<=a.arguments.length;i++) {
            var menu = document.getElementById("menu_"+ a.arguments[i]);
            var actuator = document.getElementById('actuator'+ a.arguments[i]);
           SetState(menu, actuator, C_expand);
			  /* if(menu != null)
                        menu.style.display = "block";
            if(actuator != null)
                        //actuator.parentNode.style.backgroundImage = "url(/modules/taxonomy_dhtml/minus.gif)";
								actuator.src = "/modules/taxonomy_dhtml/minus.gif";*/
    }
}

function ExpandAll(start, end)
{
	for(i=start+1; i<end; i++) {
	   var menu = document.getElementById("menu_"+ i);
      var actuator = document.getElementById('actuator'+ i);
		SetState(menu, actuator, C_expand);
	}
}

function CollapseAll(start, end)
{
	for(i=start+1; i<end; i++) {
	   var menu = document.getElementById("menu_"+ i);
      var actuator = document.getElementById('actuator'+ i);
		SetState(menu, actuator, C_collapse);
	}
}
