var color;

function reset_color_menu() {
	
	objs = document.getElementsByTagName("UL");
	
	for(var f = 0; f < objs.length; f++) {
	
		if(objs[f].getElementsByTagName("UL").length > 0) {
			
			for(var g = 0; g < objs[f].childNodes.length; g++) {
			
				if(objs[f].childNodes[g].nodeName == "LI") {
					
					objs[f].childNodes[g].childNodes[0].style.backgroundColor = "";
					
				}
				
			}
			
		}
		
	}
	
}

function init_color_menu() {
	
	document.getElementById("right_wrapper").onmouseover = function() {
			reset_color_menu();
	}
	
	objs = document.getElementsByTagName("UL");
	
	for(var i = 0; i < objs.length; i++) {
	
		if(objs[i].getElementsByTagName("UL").length > 0) {
			
			for(var j = 0; j < objs[i].childNodes.length; j++) {
			
				if(objs[i].childNodes[j].nodeName == "LI") {
					
					objs[i].childNodes[j].childNodes[0].onmouseover = function() {
						reset_color_menu();
					}
					
					objs[i].childNodes[j].childNodes[0].onmousemove = function() {
						color = getStyle(this);
					}
						
					objs[i].childNodes[j].childNodes[0].onmouseout = function() {
						if(this.parentNode.getElementsByTagName("UL").length > 0)
							if(this.parentNode.getElementsByTagName("UL")[0].style.visibility == "visible")
								this.style.backgroundColor = color;					
					}
				
				}
				
			}
			
		}	
		
	}
	
}


function getStyle(obj) {   
  var Farbe;
  if(window.getComputedStyle)
     Farbe= window.getComputedStyle(obj,"").getPropertyValue("background-color");
  else if(obj.currentStyle)
     Farbe= obj.currentStyle.backgroundColor;
     
  return Farbe;
}
