/*This script is written by Paul Marx
/*marx_paul@web.de 
/*http://marx-paul.fromru.com
/*
/*it can only be distributet "as is"
/* Creation date: 10.03.2002 */
var CloseAll=true;	//CloseAll true=enable false=disable close menus on menu open
var img1 = new Image();
img1.src = "images/plus.gif";		// path to a picture: closed folder 
var img2 = new Image();
img2.src = "images/minus.gif";	// path to a picture: opened folder
var menuID="menu";		//id="menu"
var hostID="menuHost";	//id="menuHost"
var picID="pic";		//id="pic"



function findParentByID(o,name){
//looks for a parent object with an id=name 
var o, name;
if(o.id!=name){ 		// if fn show was called with another pointer as "this"
	do	
	o=o.parentNode; 
	while (o.id!=name);
}
return o;
}//fcn end


function findChildByID(o,name){
//looks for a child object with an id=name 
var o, k, i, name;
if (o.childNodes.length){
	for (i=0; i<o.childNodes.length; i++){
		if (o.childNodes[i].id==name){o=o.childNodes[i]; break;}
		else{
			k=findChildByID(o.childNodes[i],name);
			if (k.id==name){o=k; break;}
		}
	}//for end
}//if end
return o;
}//fcn end


function hidemenus(){
// used to hide all menus and change all folders' images to closed 
var i;
/////////////////////////////////////////////////////////////////////////////////
hidesubmenus();//////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////

if (window.menu)if (!menu.length)menu.style.display="none";
	else{
		for (i=0; i < menu.length; i++){
			menu[i].style.display="none";
		}
	}
if (window.pic)if (!pic.length)pic.src=img1.src;
	else{
		for (i=0; i < pic.length; i++){
			pic[i].src=img1.src;
		}
	}
}	//fcn end


function imageShowHide(o){
// shows image of an opened/closed folder on menu open/close
var o;
o=findChildByID(o,picID);
if(o.src==img2.src)o.src=img1.src;
else o.src=img2.src;
}	//fcn end


function show(o){
// shows and hides active folders
var o,i;

o=findParentByID(o,hostID);    //looks for Parent wint a name hostID
for (i=0; i< o.childNodes.length; i++){	
	if(o.childNodes[i])
	if(o.childNodes[i].id==menuID){
    	if (o.childNodes[i].style.display=="none"){//open
			if (CloseAll)hidemenus();
			o.childNodes[i].style.display = "";
			imageShowHide(o);
		}	
		else {//close
			if (CloseAll)hidemenus();
			else{o.childNodes[i].style.display = "none";imageShowHide(o);}
		}
	}
}	//for end
}	//fcn end


function openMenu(menuIndex){
//shows menu with number of order "menuIndex"
var menuIndex;

menuIndex --;
if(window.menu)if (!menu.length)menu.style.display="";
	else{if(menu[menuIndex])menu[menuIndex].style.display="";}
if(window.pic)if (!pic.length)pic.src=img2.src;
	else{if(pic[menuIndex])pic[menuIndex].src=img2.src;}
}


function donothing(){}
