
var Testimonial = {
	currentTestimonial : 0,
	slideDuration : 500,
	
	init : function() {
    Testimonial.createTestimonials();
		Testimonial.swapTestimonial();
    },
	
	createTestimonials : function() {
		Testimonial.fx = [];
        Testimonial.testimonialFrames = $$('#testimonialSliderContainer blockquote');		
        Testimonial.testimonialFrames.each(function(frame, i) {							
	        Testimonial.fx[i] = new Fx.Tween(frame, {duration: Testimonial.slideDuration, property: 'top'}); 	        
        });
    },
	
    swapTestimonial : function() {
		Testimonial.fx[Testimonial.currentTestimonial].start(0,-280);
		
		if(Testimonial.currentTestimonial < Testimonial.testimonialFrames.length - 1)
		{
			Testimonial.fx[Testimonial.currentTestimonial + 1].start(280, 0);
			Testimonial.currentTestimonial++;
		}
		else
		{
			Testimonial.currentTestimonial = 0;
			Testimonial.fx[Testimonial.currentTestimonial].start(280, 0);
		}
		
		Testimonial.swapTestimonial.delay(10000);
    }
};

window.addEvent('domready', function() {
  if($('testimonialSliderContainer') != null) {
    Testimonial.init();
  }
});