var timeout    = 250;
var closetimer = 0;
var menuItem = 0;

function dropDown_open()
{  dropDown_canceltimer();
   dropDown_close();
   menuItem = $(this).find('ul').css('visibility', 'visible');}

function dropDown_close()
{  if(menuItem) menuItem.css('visibility', 'hidden');}

function dropDown_timer()
{  closetimer = window.setTimeout(dropDown_close, timeout);}

function dropDown_canceltimer()
{  if(closetimer)
   {  window.clearTimeout(closetimer);
      closetimer = null;}}

$(document).ready(function()
{  $('#dropDown > li').bind('mouseover', dropDown_open)
   $('#dropDown > li').bind('mouseout',  dropDown_timer)});

document.onclick = dropDown_close;
