jQuery.noConflict();
jQuery(document).ready(function(){ 

    jQuery("ul.sf-menu").superfish({ 
        delay: 500,                               // delay on mouseout 
        animation: {opacity:'show',height:'show'},    // fade-in and slide-down animation 
        speed: 'fast',                            // faster animation speed 
        autoArrows: false,                             // disable generation of arrow mark-up 
        dropShadows: false,                             // disable drop shadows 
		pathLevels: 3,                  				// the number of levels of submenus that remain open or are restored using pathClass 
		pathClass: 'current_page_item',				// the class you have applied to list items that lead to the current page 
		disableHI: false,
		onInit: function(){
				//reveal the persitent item sub menu
				jQuery('.sf-menu li.current-menu-ancestor').addClass('current_page_item current_page_ancestor sfHover sf-breadcrumb');
				//toplevel
				jQuery('.sf-menu li.current-menu-item ul.sub-menu').show();
				jQuery('.sf-menu li.current-menu-item ul.sub-menu').css('visibility', 'visible');
				//second level
				jQuery('.sf-menu li.current_page_ancestor ul.sub-menu').show();
				jQuery('.sf-menu li.current_page_ancestor ul.sub-menu').css('visibility', 'visible');
				
			},
		onShow: function(){
				if(!jQuery(this).parent().hasClass('current_page_ancestor')){
					jQuery('.sf-menu li.current_page_ancestor ul.sub-menu').hide();
					jQuery('.sf-menu li.current_page_ancestor ul.sub-menu').css('visibility', 'hidden');
				} 
			},
		onHide: function(){
				if(!jQuery(this).parent().hasClass('current_page_ancestor')){
					jQuery('.sf-menu li.current_page_ancestor ul.sub-menu').show();
					jQuery('.sf-menu li.current_page_ancestor ul.sub-menu').css('visibility', 'visible');
				}
			}
    }); 
	
});
