document.observe("dom:loaded", function () {
    $('drop_down_menu1').select(".lvl1").each(function (elm) {
        if (!$(elm).previous("dd.lvl0").down("a").hasClassName("selected")) {
            $(elm).hide();
        }
    });
    $('drop_down_menu1').select(".lvl0").each(function (el) {
        if ($(el).next('dd')) {
            if ($(el).next('dd').hasClassName('lvl1')) {
                $(el).down('a').writeAttribute("href", "javascript:void(0);");
            }
        }
        var nid = $(el).down('a').innerHTML.strip().toLowerCase();
        nid = nid.replace(/\s+/g, '');
        nid = nid.replace('&amp;', '');
        $(el).id = 'lvl0_' + nid;
    });
    $('drop_down_menu1').select(".lvl0").each(function (e) {
        $(e).observe("click", function () {
            $('drop_down_menu1').select(".lvl1").invoke("hide");
            if ($(e).next('dd').hasClassName('lvl1')) { 
                $(e).nextSiblings("dd").each(function (el) {
                    new Effect.BlindDown(el, {
                        duration: 0.4
                    });
                    if ($(el).hasClassName("last")) throw $break;
                });
            }
        })
    });
});
