// JavaScript Document
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 to blue
                onActive: function(toggler){
                        toggler.fx.toColor('#6899CE');
                },
                onBackground: function(toggler){
                        //change the background color to the original (green) 
                        //color when another toggler is pressed
                        toggler.setStyle('background-color', toggler.origColor);
                }               
        });
}
