var closing = false;
var timer = null;

closeAll = function() {
  closing = false;
  if (document.getElementById) {
    navRoot = document.getElementById("lists_ul");
    navRoot.onmouseout = function() {
      }
    for (i=0; i<navRoot.childNodes.length; i++) {
      node = navRoot.childNodes[i];
      if (node.nodeName=='LI') {
        node.className = node.className.replace("over", ""); 
	}
      }
    }
  }

startList = function() {
  if (document.getElementById) {
    navRoot = document.getElementById("lists_ul");
    navRoot.onmouseout = function() {
      }
    for (i=0; i<navRoot.childNodes.length; i++) {
      node = navRoot.childNodes[i];
      if (node.nodeName=="LI") {
        node.onmouseover = function() {
	  stopTimer();
	  closeAll();
          this.className = "over";
	  }
	node.onmouseout = function(event) {
          if (!event) {
            event = window.event;
	    }
	  var target = (window.event) ? event.srcElement : event.target;
	  if (target.nodeName != 'LI') {
            return;
	    }
          var related = (event.currentTarget) ? event.currentTarget : event.toElement;
	  while ((related != target) && (related.nodeName!='BODY')) {
            related = related.parentNode;
	    }
	  if (related==target) {
            return;
	    }
          /* we have a mouseout event */	
          /* this.className = this.className.replace("over", "");  */
	  startTimer();
	  }
	/* give all the mouse submenus stopTimers */
	for (j=0;j<node.childNodes.length;j++) {
          subnode = node.childNodes[j];
	  if (subnode.nodeName=='UL') {
            subnode.onmouseover = function() {
	      stopTimer()
	      }; 
            subnode.onmouseout = function() {
	      startTimer()
	      }; 
	    }
	  }
        }
      }
    }
  }

stopTimer = function() {
  if (closing) {
    clearTimeout(timer);
    closing = false;
    }
  }

startTimer = function() {
  stopTimer();
  timer = setTimeout('closeAll()', 500);
  closing = true;
  }


function show(arr) {
  res = '';
  for (var k in arr) {
    res = res +  k + ':'+ arr[k]+'\n';
    }
  return res;
  }
		
