if (typeof Prototype !== undefined) {
    document.observe('dom:loaded', function() {
        $$('ul#nav > li > a').each(function(a) {
            if (a.hasClassName('active') || a.hasClassName('activeright')) return;
            a.onmouseover = function() {
                if (a.readAttribute('id') == 'nav_home') {
                    $('navwrapper').toggleClassName('homelink');
                }
                if (a.hasClassName('activeleft') || a.hasClassName('dblactive')) {
                    a.toggleClassName('activeleft');
                    a.toggleClassName('dblactive');
                }
                else if (a.hasClassName('right')) {
                    a.toggleClassName('activeright');
                }
                else {
                    a.toggleClassName('active');
                }
                if (a.up().previous()) {
                    if (a.up().previous().down().hasClassName('active')) {
                        a.up().previous().down().toggleClassName('dblactive');
                    }
                    else {
                        a.up().previous().down().toggleClassName('activeleft');
                    }
                }
            }
            a.onmouseout = a.onmouseover;
        });

        imageObj = new Image();
        ['navbgactiveleft.png','navbgright.png','navbgactiveright.png','navbgactive.png','navbgdblactive.png'].each(function(img) {
            imageObj.src = '/images/' + img;
        });
    });
}

