$(document).ready(function(){
   if ($("#active").parent().parent().is("ul.child")) { 
      return false;
   } else {
      $("#menu ul").hide();
      
      $("#menu li").mouseover(function () {
         $(this).children("ul").show();
      });
      $("#menu li").mouseout(function () {
         $(this).children("ul").hide();
      });
   }
});


