<script type="text/javascript"> 
    window.addEvent('domready', function() { 
         
        var menuid = '#acmenu'; // Set menu id  
        var parents = $$(menuid+' li.parent'); // Get all main level parents 
        var children = $$(menuid+' li.parent ul'); // Get all second level childs 
        var num =-1; // Temporary variable to set what menu has to be open by default 
         
        // The loop below is used to determine which menu is current 
        for (var i=0; i<parents.length; i++) {  
            var cid = parents[i].id; 
            if (cid  == 'current') { 
                num = i; 
                break; 
            } 
            var lis = $ES('ul li',parents[i]); 
 
            for (var j=0; j<lis.length; j++) { 
                if (lis[j].id  == 'current') { 
                    num = i; 
                    break; 
                } 
            } 
 
        } 
        //make the accordion 
        var accordion = new Accordion(parents,children, { 
            opacity: 50, 
            display: num, 
            alwaysHide: false, 
            onActive: function(toggler,element) {  
                element.setStyle('padding-left', '20px');   
                toggler.addClass('active'); 
            }, 
            onBackground: function(toggler,element) {  
                toggler.removeClass('active');   
            } 
        }); 
 
        //make it open on hover 
        $$(menuid+' li').addEvent('mouseenter', function() { this.fireEvent('click'); }); 
    });
</script>
