var menu = document.getElementById('menu');
//add 'hover' classname  to LI's when hovered
for ( var i=0; i<menu.childNodes.length; i++ ) {
  var li = menu.childNodes[i];
  if ( li.nodeName != 'LI' ) continue;
  li.onmouseover = function(){this.className='hover';};
  li.onmouseout  = function(){this.className='';};
  //disable clicking when there are subitems
  if(li.getElementsByTagName('ul').length > 0)
    li.childNodes[0].onclick = function(){return false;};
}
menu = li = null;

