$(document).ready(function() {


  // Multimenu
  $('.multilevel-menu a').hover(function() {
    
    // Check theres no more visible rows below the current one
    var parent=$(this).parents('.multilevel-menu');//.nextAll().hide();
    parent.nextAll('.multilevel-menu').hide();
  
    // Show the new one
  
    var CategoryId=$(this).attr('rel');
    var hoverid='menuhover_' + CategoryId;
  
    if($('#'+hoverid).length > 0) {   
            
      // Move the hover after the parent multi
      var newhover=$('#'+hoverid);
      newhover.before(parent);      
      
      $('#'+hoverid).show();
    }
      
  });

  $('#menu div a').hover(function() {
    
    $('.multilevel-menu').hide();
  
    var CategoryId=$(this).attr('rel');
    var hoverid='menuhover_' + CategoryId;
    
  
    if($('#'+hoverid).length > 0) {   
      $('#'+hoverid).show();
    }
  
  });


  $('.multilevel-menu').hover(function() {
  
    $('.multilevel-menu').stop(true,false);
  
  }, function() {
  
    $(this).animate({ opacity: 1.0 }, 1500 , function() {
      $('.multilevel-menu.hoverover').hide();
      
      $('.multilevel-menu.default').show();
      
    });
  
  });


});
