/* DHTML-Bibliothek */

var DHTML = false;
var DOM = false;
var MSIE4 = false;
var NS4 = false;
var OP = false;

if (document.getElementById) {
  DHTML = true;
  DOM = true;
} else {
  if (document.all) {
    DHTML = true;
    MSIE4 = true;
  } else {
    if (document.layers) {
      DHTML = true;
      NS4 = true;
    }
  }
}
if (window.opera) {
  OP = true;
}

/* Menüfunktionen */
function initTree(id){
	if(!MSIE4 & DOM){
		var links = document.getElementsByTagName("a");
		var nodes = document.getElementsByTagName("ul");
		for(i=0; i<nodes.length; i++){
			if(nodes[i].className == "SubLevelTwo"){
				nodes[i].style.display = "none";
			}
		}
		for(i=0; i<links.length; i++){
			if(links[i].className == "showTreeLink"){
				links[i].style.display = "block";
			}
		}
		if(id != "") showActualPath("MID_"+id);
	}else{
		/* older MSIE versions - maybe following prevent program crash down */
		var links = document.all.tags("a");
		var nodes = document.all.tags("ul");
		for(i=0; i<nodes.length; i++){
			if(nodes[i].className == "SubLevelTwo"){
				nodes[i].style.display = "none";
			}
		}
		for(i=0; i<links.length; i++){
			if(links[i].className == "showTreeLink"){
				links[i].style.display = "block";
			}
		}
		if(id != "") showActualPath("MID_"+id);
	}
}

function showActualPath(id){
	if(!MSIE4 & DOM){
		var act_node = document.getElementById(id);
		var i = true;
		while(i){
			switch(act_node.tagName){
				case "UL":
					act_node.style.display = "block";
					if(act_node.className == "SubLevelTwo"){
						act_node.parentNode.childNodes[2].style.display = "block";
						act_node.parentNode.childNodes[1].style.display = "none";
					}
					act_node = act_node.parentNode;
					break;
				case "LI":
					act_node = act_node.parentNode;
					break;
				default:
					i = false;
					break;
			}
		}
	}else{
		/* older MSIE versions - maybe following prevent program crash down */
		var act_node = document.all[id];
		var i = true;
		while(i){
			switch(act_node.tagName){
				case "UL":
					act_node.style.display = "block";
					/* search for TreeLinks and show/hide them */
					if(act_node.className == "SubLevelTwo"){
						/* actual LI element */
						parent_id = act_node.parentElement.sourceIndex;
						/* search following elements of class hideTreeLink and showTreeLink */
						var j = true;
						while(j){
							parent_id++;
							switch(document.all[parent_id].className){
								case "showTreeLink":
									document.all[parent_id].style.display = "none";
									break;
								case "hideTreeLink":
									document.all[parent_id].style.display = "block";
									j = false;
									break;
								default:
									break;
							}
						}
					}
					act_node = act_node.parentElement;
					break;
				case "LI":
					act_node = act_node.parentElement;
					break;
				default:
					i = false;
					break;
			}
		}
	}
}

function showNode(id){
	if(!MSIE4 & DOM){
		document.getElementById(id).style.display = "block";
		document.getElementById("show"+id).style.display = "none";
		document.getElementById("hide"+id).style.display = "inline";
	}else{
		document.all[id].style.display = "block";
		document.all["show"+id].style.display = "none";
		document.all["hide"+id].style.display = "inline";
	}
}

function hideNode(id){
	if(!MSIE4 & DOM){
		document.getElementById(id).style.display = "none";
		document.getElementById("show"+id).style.display = "inline";
		document.getElementById("hide"+id).style.display = "none";
	}else{
		document.all[id].style.display = "none";
		document.all["show"+id].style.display = "inline";
		document.all["hide"+id].style.display = "none";
	}
}
