var accordion;
var accordionTogglers;
var accordionContents;

window.onload = function() {
    accordionTogglers = document.getElementsByClassName('accToggler');
    accordionTogglers.each(function(toggler){
        //remember the original color
        toggler.origColor = toggler.getStyle('background-color');
        //set the effect
        toggler.fx = new Fx.Color(toggler, 'background-color');
    });

    accordionContents = document.getElementsByClassName('accContent');
    accordion = new Fx.Accordion(accordionTogglers, accordionContents,{
                    //when an element is opened change the background color
                    onActive: function(toggler){ toggler.fx.toColor('#6e0a0a'); },

                    //change the background color to the original
                    //color when another toggler is pressed
                    onBackground: function(toggler){ toggler.setStyle('background-color', toggler.origColor); }
                    });
}
