Timeout/sleep in jQuery?

Timeout/sleep in jQuery?

I've made a drop-down menu with jQuery which works great, except that on mouseout the menu disappears instantly. I'd like it if there was a delay before the menu disappeared, in case the user moves the mouse out slightly by accident (or when moving to other parts of the menu).

Here is my current code:

jQuery.noConflict();
jQuery(document).ready( function($) {
   $("#main-menu ul.menu li")
      .mouseover( function() {
         $(this).children("ul").css("display","block");
      })
      .mouseout( function() {
         $(this).children("ul").css("display","none");
      });
});


I was originally using the fadeIn/fadeOut effect but it proved problematic. So I'd just like to call a timeout in the mouseout function, followed by the code to hide the menu.