// JavaScript Document

function showHideSubitems() {

	var args = showHideSubitems.arguments;

	var url = args[0];
	var rootVZ = args[1];
	var id = args[2];
	var idIn = id;

	var show;
	
	if(document.getElementById("itemlist"+id)) {
		//alert("id="+id+"; "+document.getElementById("itemlist"+id).className);
	
		if(document.getElementById("itemlist"+id).className == "itemlist V") {
			document.getElementById("itemlist"+id).className = "itemlist H";
			if(document.images["Expander"+id]) { document.images["Expander"+id].src = rootVZ+"images/struktur/navistruktur_plus.png"; }
		}
		else {
			showHideAllSubitems(rootVZ,false);
	
			for(var i=2; i<args.length; i++) {
				id = args[i];
				showHideItem(rootVZ,id,true);
			}
		}
	}
	
	if(url.length>0) {
		var idpath = "";
		for(var i=3; i<args.length; i++) {
			idpath+=args[i]+",";
			//if(i<args.length-1) { idpath+=","; }
		}
		idpath+= idIn;
		document.location.href=url+"?id="+id+"&idpath="+idpath;
	
	}

}

function showHideSubitems2() {
	var args = showHideSubitems2.arguments;
	var rootVZ = args[0];

	showHideAllSubitems(rootVZ,false);
	for(var i=1; i<args.length; i++) {
			id = args[i];
			showHideItem(rootVZ,id,true);
	}
}


function showHideAllSubitems(rootVZ,show) {
	var tagname, id;
	for(var i=0; i<document.getElementsByTagName("ul").length; i++) {
		tagname = document.getElementsByTagName("ul")[i].id;
		if(tagname.indexOf("itemlist")!=-1) {
			id = tagname.substr(8,tagname.length);
			showHideItem(rootVZ,id,show);
		}
	}
}



function showHideItem(rootVZ,id,show) {
	if(document.getElementById("itemlist"+id)) {
		if(document.getElementById("itemlist"+id).className != "itemlist V0") {
			if(show) {
				document.getElementById("itemlist"+id).className = "itemlist V";
				if(document.images["Expander"+id]) { document.images["Expander"+id].src = rootVZ+"images/struktur/navistruktur_minus.png"; }
			}
			else {
				document.getElementById("itemlist"+id).className = "itemlist H";
				if(document.images["Expander"+id]) { document.images["Expander"+id].src = rootVZ+"images/struktur/navistruktur_plus.png"; }
			}
		}
	}
}


