(function ($) {
	$(document).ready(function() {
	  // Set active-trail visible on page load
	  // This only sets the secondary list of the active trail to visible
	  $('ul.nice-menu li.active-trail ul').show();
	  $('ul.nice-menu li.active-trail ul').css('visibility', 'visible');
			 
	  // Bind the menu to mouseleave to set active-trail visible when done navigating
	  // Suckerfish will hide all secondary lists for you when hovering the main menu
	  // So we want to repeat the initial behavior when done navigating
	  $('ul.nice-menu').bind("mouseleave", function(){
	    var $active = $('ul.nice-menu li.active-trail ul');
	
	    // Set the timer to the value specified in the admin settings
	    // This prevents overlap of the secondary menu items
	    // The trick to make it work is that we set the active trail to visible inside the function
	    $active(function() {
	      $('ul.nice-menu li.active-trail ul').css('visibility', 'visible');
	      $('ul.nice-menu li.active-trail ul').show();
	    });
		
	  });
	
	});
	
})(jQuery);;

