
function classeDefilementImages(serieImagesVar, nomObjetVar) {

	/*****************************************************************/
	/* Bien vérifier la présence des styles suivants dans les images */
	/*   - img129a : "opacity:100; filter:alpha(opacity=100);"       */
	/*   - img129b : "opacity:0;   filter:alpha(opacity=0);"         */
	/*****************************************************************/

	this.index = 0;
	this.mesImages = new Array();
	this.enLecture = false;

	this.nouvelleImage = false;
	this.opaciteA = 100;
	this.opaciteB = 0;
	this.tempsBoucle = 25;
	this.tempsChargementImage = 1000;
	this.tempsRestantImage = 0;
	
	this.nomImageA = "";
	this.nomImageB = "";
	this.nomObjet = nomObjetVar;

	switch (serieImagesVar) {
		case 129:
			this.nomImageA = "img129a";
			this.nomImageB = "img129b";
			this.mesImages = new Array(
				"http://res.etumignon.com/img/129/plat_1.jpg" ,
				"http://res.etumignon.com/img/129/plat_2.jpg" ,
				"http://res.etumignon.com/img/129/plat_3.jpg" ,
				"http://res.etumignon.com/img/129/plat_4.jpg" ,
				"http://res.etumignon.com/img/129/plat_5.jpg" ,
				"http://res.etumignon.com/img/129/plat_6.jpg" ,
				"http://res.etumignon.com/img/129/plat_7.jpg" ,
				"http://res.etumignon.com/img/129/plat_8.jpg" ,
				"http://res.etumignon.com/img/129/plat_9.jpg" ,
				"http://res.etumignon.com/img/129/plat_10.jpg",
				"http://res.etumignon.com/img/129/plat_11.jpg",
				"http://res.etumignon.com/img/129/plat_12.jpg"
			);
			break;
		case 163:
			this.nomImageA = "img163a";
			this.nomImageB = "img163b";
			this.mesImages = new Array(
				"http://res.etumignon.com/img/163/plat-1.jpg" ,
				"http://res.etumignon.com/img/163/plat-2.jpg" ,
				"http://res.etumignon.com/img/163/plat-3.jpg" ,
				"http://res.etumignon.com/img/163/plat-4.jpg" ,
				"http://res.etumignon.com/img/163/plat-5.jpg" ,
				"http://res.etumignon.com/img/163/plat-6.jpg"
			);
			break;
	}

	this.defilerImage = function (indexImage) {
		imageA = document.getElementById(this.nomImageA);
		imageB = document.getElementById(this.nomImageB);
		if (this.nouvelleImage) {
			imageB.src = this.mesImages[indexImage];
			this.nouvelleImage = false;
		}
		if (imageB.src == imageA.src) {
			return false;
		}
		this.tempsRestantImage -= this.tempsBoucle;
		if (this.tempsRestantImage<=0) {
			this.opaciteA -= 5;
			this.opaciteB += 5;
		}
		if (document.all && !window.opera) {
			imageA.style.filter = 'alpha(opacity = ' + this.opaciteA + ');' ;
			imageB.style.filter = 'alpha(opacity = ' + this.opaciteB + ');';
		} else {
			imageA.style.opacity = this.opaciteA/100;
			imageB.style.opacity = this.opaciteB/100;
		}
		if (this.opaciteB >= 100) {
			this.opaciteA = 100;
			this.opaciteB = 0;
			this.tempsRestantImage = this.tempsChargementImage;
			imageA.src = imageB.src;
			return false;
		}
		window.setTimeout(this.nomObjet+".defilerImage()", this.tempsBoucle);
	}

	this.imageSuivante = function () {
		this.index++;
		if (this.index >= this.mesImages.length) { this.index = 0; }
		document.getElementById(this.nomImageA).src = this.mesImages[this.index];
		document.getElementById(this.nomImageB).src = this.mesImages[this.index];
		
		this.resetTimer();
	}
	
	this.imagePrecedente = function () {
		this.index--;
		if (this.index < 0) { this.index = this.mesImages.length - 1; }
		document.getElementById(this.nomImageA).src = this.mesImages[this.index];
		document.getElementById(this.nomImageB).src = this.mesImages[this.index];
		
		this.resetTimer();
	}
	
	this.imageSuivanteAuto = function () {
		this.index++;
		if (this.index >= this.mesImages.length) { this.index = 0; }
		this.nouvelleImage = true;
		this.defilerImage(this.index);
		
		this.resetTimer();
	}

	this.resetTimer = function () {
		if (this.enLecture) {
			this.stopTimer();
			this.startTimer();
		}
	}

	this.startTimer = function () {
		this.enLecture = true;
		this.myTimer = window.setTimeout(this.nomObjet+".imageSuivanteAuto()", 4000);
	}

	this.stopTimer = function () {
		window.clearTimeout(this.myTimer);
	}

	this.lecture = function () {
		this.imageSuivanteAuto();
		this.startTimer();
	}

	this.pause = function () {
		this.enLecture = false;
		this.stopTimer();
	}
	
}
