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-image');
    //set the effect
    toggler.fx = new Fx.Style(toggler, 'background-image');
  });

  accordionContents = document.getElementsByClassName('accContent');

  accordion = new Fx.Accordion(accordionTogglers, accordionContents,{
  start: 'all-closed',
     transition: Fx.Transitions.quadOut,
    //when an element is opened change the background color to blue
    onActive: function(toggler){
      toggler.setStyle('background','#E6F3F9 url(/images/arrows/arrow_actionDown.gif) 0 50% no-repeat');
    },
    onBackground: function(toggler){
      //change the background color to the original (green)
      //color when another toggler is pressed
      toggler.setStyle('background','url(/images/arrows/arrow_action.gif) 0 50% no-repeat', toggler.origColor);
    }
  });
};
