Accordion.implement({
    showAll: function() {
        var obj = {};
        this.previous = -1;                  //  Added this line
        this.elements.each(function(el, i){
            obj[i] = {};
            this.fireEvent('onActive', [this.togglers[i], el]);
            for (var fx in this.effects) obj[i][fx] = el[this.effects[fx]];
        }, this);
        return this.start(obj);
    },
    hideAll: function() {
        var obj = {};
        this.previous = -1;                  //  Added this line
        this.elements.each(function(el, i){
            obj[i] = {};
            this.fireEvent('onBackground', [this.togglers[i], el]);
            for (var fx in this.effects) obj[i][fx] = 0;
        }, this);
        return this.start(obj);
    }
});

window.addEvent('domready', function() {

	$$('#menu ul li ul').removeClass('hide');

	var myAccordion = new Accordion($('menu'), 'a.toggler', 'ul.element', {
		opacity: false,
		show: show - 1,
		alwaysHide: true,
		onActive: function(toggler, element){
			toggler.addClass('active');
		},
		onBackground: function(toggler, element){
			toggler.removeClass('active');
		}
	});

	if (show == 0)
		myAccordion.hideAll();

	//$$('a.toggler').addEvent('mouseenter', function() { this.fireEvent('click'); });
});
