var obj = null;

function checkHover() 
{
  if (obj) 
  {
    obj.find('ul').fadeOut(); 
    obj.children('a').removeClass('hover');
  } 
}

$(document).ready(function() 
{
  $('#menu > li').hover(function() 
  {
    if (obj) 
    {
      obj.find('ul').fadeOut();
      obj.children('a').removeClass('hover');
      obj = null;
    }
    
    $(this).find('ul').fadeIn('fast');
    $(this).children('a').addClass('hover');
    $(this).addClass('hover');
  }, 
  function() 
  {
    obj = $(this);
    setTimeout(
      "checkHover()",
      0
    ); 
  });
});
