Hi and thanK you in advance for your help.

I have created a 3 level menu in wordpress and wp_nav_menu

so in my theme i get something like this

<ul id="menu" class="menu">
<li><a>Sub item A</a>
<ul class="submenu">
<li>sub sub item a</li>
<li>sub sub item b</li>
<li>sub sub item c</li>
</ul>
</li>

<li><a>Sub item b</a>
<ul class="submenu">
<li>sub sub item e</li>
<li>sub sub item f</li>
<li>sub sub item g</li>
</ul>
</li>
</ul>


And I use this jquery to make it behave like an accordion

$(".sub-menu").hide();
$(".current_page_item .sub-menu").show();
$('#menu li a').click(
function() {
var checkElement = $(this).next();
if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
return false;
}
if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
$('#menu ul:visible').slideUp('normal');
checkElement.slideDown('normal');
return false;
}
}
);
}
$(document).ready(function() {initMenu();});

.current_page_item is the class that wordpress automatically assigns to the current menu item, and I use the above jquery code to make the First level submenu to appear a selected and open when the user navigates in the current page

But when user is selecting a second level menu although the second level list is expanded the first level hides again....

This is a newbie javascript question, please some advice will be hellpfull

Thank you in advance