liste_diapo = [];

function Diaporama(elt,tempo) {
	var temporisation = tempo; //en ms
	this.name = elt;
	var liste = new Array;
	var nombre = 0;
	var idx = 0;
	// On enregistre le diporama dans la liste
	liste_diapo[this.name] = this;	
	
	this.add = function Diaporama_add(path){
		var img =	new Image(60,60);
		img.src = path;
		liste[nombre] = img;
		nombre++;			
	} // fin fonction add
	
	this.start = function Diaporama_start(){
		var cmd = "liste_diapo['" + this.name + "'].change()";
		window.setInterval(cmd,temporisation);
	} // fin fonction start

	this.change = function Diaporama_change(){
		var n = idx % nombre;
		var img = liste[n];
		this.getId().src=img.src;
				
		idx++;

	} // fin fonction change
	
	this.getId = function Diaporama_GetId() {
		return document.getElementById( this.name );
	} // fin GetId
	
}  // fin classe Diaporama



