/**
 * @author ceo-zan
 */

var RotatingTreatment = Class.create ();
RotatingTreatment.prototype = {
	initialize: function( slidesarr ){		
		this.slides = slidesarr;
		this.idx = 0; 
		this.wait = 4000;
	},
	
	slideShow: function (){		
		
		if ( $(this.slides[this.idx]) != null )
			Effect.Fade(this.slides[this.idx], { duration:2, from:1.0, to:0.0 });
			 
		this.idx++;
	 	if (this.idx == this.slides.length) 
			this.idx = 0;
		 
		if ( $(this.slides[this.idx]) != null )
			Effect.Appear(this.slides[this.idx], { duration:2, from:0.0, to:1.0 });
	 }	
}

rotatingTreatment = new RotatingTreatment (new Array(
						'trt_botox', 
						'trt_lux', 
						'trt_co2', 						
						'trt_fillers',
						'trt_thermage',
						'trt_intense',
						'trt_hair',
						'trt_vbeam'						
						));

Event.observe (window, 'load', function(event){
		setInterval('rotatingTreatment.slideShow()',rotatingTreatment.wait);
	}
);