$().ready(function(){
    $('#nav li:has(ul)').each(function(){
        var $t = $(this), $c = $t.children('ul');
        $t.mouseenter(function(){ $c.show(); }).mouseleave(function(){ $c.hide(); });
    });
});
