    function initMenus() {
    $('ul.menu_pasek ul').hide();
    $.each($('ul.menu_pasek'), function(){
    $('#' + this.id + '.expandfirst ul:first').show();
    });
    $('ul.menu_pasek li a').click(
    function() {
    var checkElement = $(this).next();
    var parent = this.parentNode.parentNode.id;
    if($('#' + parent).hasClass('noaccordion')) {
    $(this).next().slideToggle('normal');
    return false;
    }
    if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
    if($('#' + parent).hasClass('collapsible')) {
    $('#' + parent + ' ul:visible').slideUp('normal');
    }
    return false;
    }
    if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
    $('#' + parent + ' ul:visible').slideUp('normal');
    checkElement.slideDown('normal');
    return false;
    }
    }
    );
    }
    $(document).ready(function() {initMenus();});


function hideAll() {
    var navList = document.getElementById("lista_rozw");
    for (var i=0; i<navList.childNodes.length; i++) {
        var node = navList.childNodes[i];
        if (node.tagName == "LI") {
            node.className = node.className.replace(new RegExp("\s?active", "i"), "");
        }
    }
}

window.onload = function () {
    var navList = document.getElementById("lista_rozw");
    for (var i=0; i<navList.childNodes.length; i++) {
        var node = navList.childNodes[i];
        if (node.tagName == "UL") {
            node.onclick = function() {
                hideAll();
                this.className += " active";
            }
        }
    }
}


