Making an accordion from a multi-level HTML list
It'll be good if you can provide your HTML markup. Without it I can do this:

jQuery(function($) {
    $('.s4-ql li ul').hide();
    $('.s4-ql ul li').hover(function() {
        $(this).find('a:first').next().slideToggle();
    }, function() {
        $(this).find('a:first').next().slideToggle();
    }).find('ul').each(function(index) {
        var $this = $(this);
        $this.parent().find('a:first .menu-item-text').append(['&lt;span style=\'float:right;font-size:0.8em;\'&gt;(', $this.children().length, ')&lt;/span&gt;'].join(''));
    });;
});