function menushow(element) {
  var ulelement = element.lastChild;
	var aelement = element.firstChild;
  if (ulelement.tagName == 'UL') {
    var act = ulelement;
  }
  else {
    act = false;
  }
  
	if (act) {
		var gesamthoehe = 0;
		var classname = element.className;
		var knotenanzahl = act.childNodes.length;
		var instring = classname.search('active_sub');
		
		var active_sub = document.getElementById('active_sub');
		
		element.style.zIndex = '20';
		
		if (instring != -1) {
			aelement.style.backgroundPosition = '0 -100%';					
			active_sub.lastChild.style.display = 'block';
			element.style.height = '20px';
			gesamthoehe = abstop(act) + (knotenanzahl * 20);
			
			if(gesamthoehe > 200) {
				//act.style.top = 20-(knotenanzahl * 20) + 'px';
				act.style.top = '-20px';
				if(abstop(act) < 129) {
					act.style.top = '-20px';
				}
			}
		} else {
			act.style.display = 'block';
			
			if (active_sub) {
				active_sub.lastChild.style.display = 'none';
				active_sub.firstChild.style.backgroundPosition = '0 -200%';
			}
			
			aelement.style.backgroundPosition = '0 -100%';
			element.style.height = '20px';
			gesamthoehe = abstop(act) + (knotenanzahl * 20);
			
			if(gesamthoehe > 200) {
				//act.style.top = 20 - (knotenanzahl * 20) + 'px';
				act.style.top = '-20px';
				if(abstop(act) < 129) {
					act.style.top = '-20px';
				}
			}
		}
  }
}

function menuhide(element) {
  var ulelement = element.lastChild;
	var aelement = element.firstChild;
  if (ulelement) {
    if (ulelement.tagName == 'UL') {
      var act = ulelement;
    }
    else {
      act = false;
    }
    if (act) {
			var classname = element.className;
			
			var instring = classname.search('active_sub');
		
			var active_sub = document.getElementById('active_sub');
		
			if (instring != -1) {
				aelement.style.backgroundPosition = '0 -100%';
				element.style.height = '20px';
			} else {
				aelement.style.backgroundPosition = '0 0';
				
				if (active_sub) {
					active_sub.lastChild.style.display = 'block';
					active_sub.firstChild.style.backgroundPosition = '0 -100%';
				}
				
				act.style.display='none';
				element.style.zIndex = '10';
				element.style.height = '20px';
			}
    }
  }
}

//Funktion zur bestimmung der Y-Position
function abstop(i) { 
	return (i.offsetParent) ? i.offsetTop+abstop(i.offsetParent) : i.offsetTop; 
}