//OPEN ###############################
function toggleInfo(e) {

if(navigator.appName.indexOf("Explorer") != -1){
    var node = e.parentNode.nextSibling;
}
else{
    var node = e.parentNode.nextSibling;
}

	var count = 0;
	while(count < 3) {
		if (node.nodeName == "DIV") {
					//toggle
					if(node.style.display == "none"){
						node.setAttribute("style", "display:block;");
						node.style.display = "block";
					}
					else {
						node.setAttribute("style", "display:none;");
						node.style.display = "none";
					}
		changeImages(e);	
		return;
		}
		
		node = node.nextSibling;
		count++;
	}
}

// JavaScript Document

function changeImages (e) {
	
	var cls = "class";
	if(navigator.userAgent.indexOf("MSIE")>0) {
		cls = "className";	
	}
	
	var changeImages = e.parentNode;
	//alert (changeImages.getAttribute(cls));
	 var allChildren = changeImages.childNodes;
	 
	 for (var i=0; i<allChildren.length; i++) {
	 					
		if (allChildren[i].nodeType == 1) {
			var classes = allChildren[i].firstChild.getAttribute(cls);
			
			switch (classes) {
				case "toggleelement_icon":
				path = allChildren[i].firstChild.firstChild.getAttribute("src");
				result = path.search(/close.+/);
				
				//IE sucks!
					if (result != -1) {
						allChildren[i].firstChild.firstChild.src = "fileadmin/templates/img/toggleelement_icon_open.gif";
						allChildren[i].firstChild.firstChild.setAttribute("src", "fileadmin/templates/img/toggleelement_icon_open.gif");
					}
					else {
						allChildren[i].firstChild.firstChild.src = "fileadmin/templates/img/toggleelement_icon_closed.gif";
						allChildren[i].firstChild.firstChild.setAttribute("src", "fileadmin/templates/img/toggleelement_icon_closed.gif");
					}
					
					break;
				case "toggleelement_titel":
					break;
				case "button":
					if (allChildren[i].firstChild.style.display == "block") {
						allChildren[i].firstChild.style.display = "none";
						allChildren[i].firstChild.setAttribute("style", "display:none;");
					}
					else if (allChildren[i].firstChild.style.display == "none") {
						allChildren[i].firstChild.style.display = "block";
						allChildren[i].firstChild.setAttribute("style", "display:block;");
					}
					
					break;
				
				default:
					break;
			}
			
		}
	 }
	
}

