// JavaScript Document

//slider

  window.addEvent('domready', function() {
	
	
	var spans = $$('#articleTestimonial span.full');
    var buttons = $$('#articleTestimonial a.testimonialToggle');

    var sliders = new Array();
		
    buttons.each( function(button, i) {
	  //create slide effect and hide it				   
	  var slider = new Fx.Slide(spans[i]).hide();
	  //add it to the array
	  sliders[i] = slider;
	  //add event listener
	  button.onclick = function(){							  
        slider.toggle();
        return false;
	  }
	
	  // When slide effect ends its transition, check for its status
      slider.addEvent('complete', function() {
        if (slider.open == 1) {
	      button.setStyle("background-position", "0 -20px");
        } else {
	      button.setStyle("background-position", "0 0");
        }					   
      });
    });
  
   //collapse all
    if ($('collapseAll')) { 
    $('collapseAll').onclick = function(){
      buttons.each( function(button, i) {
      sliders[i].hide();
	  button.setStyle("background-position", "0 0");
        });
     }
	}

     //expand all
	 if ($('expandAll')) {
	 $('expandAll').onclick = function(){
       buttons.each( function(button, i) {
       sliders[i].show();
	   button.setStyle("background-position", "0 -20px");
       });
     }
	 }
	
  });

