/**
 * Fonction : Slides Show
 *
 * @Description :  Faire un dossier modeling dans le dossier images. Image Default = SlideShowDefault.jpg Images SlideShow = setA-X (remplacer X par un chiffre croissant)
 * @Fonctionnement : Mettre l'image dans un <div id="SlideZone">
 * @Dependency : prototype.js
 *   
 */
var Slides_ShowArray = new Array(); 
 
function Slides_Show(divID){
	
	this.slides_divID = divID;
	
	this.slides_currentIndex = 0;
				
	this.slides_images = new Array();
	
	this.slides_delay = 5;
	
	this.slides_appear = 0.7;		
	
	this.slides_classname = null;	
				
	this.slides_periodicalExecuter = null;
	
	this.slides_repeat = true;
	
	this.slides_config = function(images, delay, appear, classname){
		this.slides_images = images;
		this.slides_delay = delay;
		this.slides_appear = appear;
		this.slides_classname = classname;
	}
	
	this.slides_switch = function(){
	
		this.slides_currentIndex++;
		
		if(this.slides_currentIndex>=this.slides_images.length){
			this.slides_currentIndex = 0;
		}
		
		this.slides_imagemake(this.slides_images[this.slides_currentIndex]);	
	
	}
	
	this.slides_back = function(){
		
		if(this.slides_periodicalExecuter!=null)
			this.slides_periodicalExecuter.stop();
		
		this.slides_currentIndex--;
		
		if(this.slides_currentIndex<0){
			this.slides_currentIndex = this.slides_images.length-1;
		}
		
		this.slides_imagemake(this.slides_images[this.slides_currentIndex]);	
		
	}
	
	this.slides_next = function(){
		
		if(this.slides_periodicalExecuter!=null)
			this.slides_periodicalExecuter.stop();
		
		this.slides_currentIndex++;
		
		if(this.slides_currentIndex>=this.slides_images.length){
			this.slides_currentIndex = 0;
		}
		
		this.slides_imagemake(this.slides_images[this.slides_currentIndex]);	
		
	}
	
	this.slides_imagemake = function(path){
		//alert();
		$(this.slides_divID).update('<img src="' + path + '" alt="" align="absmiddle" id="SlideImg" />');// style="display:none;" class="' + this.slides_classname + '" />');
		
		//eval("Effect.Appear('" + this.slides_divID + "', { duration: " + this.slides_appear + " })");
		
	}
	
	Slides_ShowArray[divID] = this;
	
	//Event.observe(window, 'load', function(event){	
	this.slides_timeout = function(){
		
		setTimeout(function(){ Slides_ShowArray[divID].slides_switch(); if(Slides_ShowArray[divID].slides_repeat==true){ Slides_ShowArray[divID].slides_timeout(); } }, 1000*this.slides_delay);
	
	}
	
	this.slides_timeout();
	//});	

}

/**
 * Fonction End : Slides Show
 */