function ImageGallery() {
	this.resize = "";
	this.entityName = "";
	this.gChemin01 = "inclus";
	this.gChemin02 = "images/";
	this.gCompteur;
	this.gSection = 0;
	this.tPhotos = new Array();



	// Affichage de l'image.
	this.fAffichage_image = function(pNumero) {
		if (pNumero < this.tPhotos.length) {
			this.fArret_affichage_automatique();
			this.gNumero_image = pNumero;
			// Modèle de visionneuse 1.
			document.getElementById("iImage" + this.entityName + "01").src = this.gChemin02 + this.tPhotos[pNumero] + this.resize;
			var objTmp = this;
			if ((pNumero + 1) < this.tPhotos.length) {
				document.getElementById("iImage" + this.entityName + "01").onclick = function() { objTmp.fAffichage_image(pNumero + 1) };
			}
			else {
				document.getElementById("iImage" + this.entityName + "01").onclick = function() { objTmp.fAffichage_image(0) };
			}
			document.getElementById("iDescription" + this.entityName + "01").innerHTML = document.getElementById("iDescription" + this.entityName + pNumero).innerHTML;
			var navRoot = document.getElementById('iNavigation' + this.entityName + '01');
			var selContain = false;
			for (i = 0; i < navRoot.getElementsByTagName("li").length; i++) {
				if (navRoot.getElementsByTagName("li")[i].getElementsByTagName("a")[0].innerHTML != "" + (pNumero + 1)) {
					(navRoot.getElementsByTagName("li")[i]).className = "unselected";
				}
				else {
					(navRoot.getElementsByTagName("li")[i]).className = "selected";
					selContain = true;
				}
			}
			if (!selContain) {
				this.fChangement_boutons((Math.ceil((pNumero) / 5.0) * 5));
			}
		}
		// TEST
		this.fAffichage_fleches();
	}
	// Changement de section.
	this.fChangement_section = function(pDirection) {
		this.fArret_affichage_automatique();
		if (pDirection == 0) {
			if (this.gSection > 0) {
				this.gSection -= 5;
			}
			this.fChangement_boutons(this.gSection);
		} else if (pDirection == 1) {
			if (this.gSection < this.tPhotos.length - 5) {
				this.gSection += 5;
			}
			this.fChangement_boutons(this.gSection);
		}
		// TEST
		this.fAffichage_fleches();
	}
	// Changement de plage de boutons.
	this.fChangement_boutons = function(gSection) {
		this.gSection = gSection;
		var vMenu = "<li id='iFleche_gauche" + this.entityName + "'><a href='javascript:" + this.entityName + ".fChangement_section(0)'>&#60;</a></li>";
		for (i = 0; i + this.gSection < this.tPhotos.length && i < 5; i++) {
			if (this.gNumero_image == i + this.gSection) {
				vMenu += "<li class='selected'><a href='javascript:" + this.entityName + ".fAffichage_image(" + (this.gSection + i) + ");'>" + (this.gSection + i + 1) + "</a></li>";
			}
			else {
				vMenu += "<li><a href='javascript:" + this.entityName + ".fAffichage_image(" + (this.gSection + i) + ");'>" + (this.gSection + i + 1) + "</a></li>";
			}
		}
		vMenu += "<li id='iFleche_droite" + this.entityName + "'><a href='javascript:" + this.entityName + ".fChangement_section(1)'>&#62;</a></li>";
		// Modèle de visionneuse 1.
		document.getElementById('iNavigation' + this.entityName + '01').innerHTML = vMenu;
	}
	this.gNumero_image = 0;
	this.gDelai = 1000;
	this.gAffichage_automatique = false;
	this.gNombre_images = this.tPhotos.length;

	// Affichage automatique de la banque d'images.
	this.fAffichage_automatique_images = function() {
		this.gAffichage_automatique = true;
		var vImage_suivante = this.fSelection_image_suivante();
		//document.getElementById("iImage" + this.entityName + "01").src = this.gChemin02 + this.tPhotos[vImage_suivante] + this.resize;
		//document.getElementById("iDescription" + this.entityName + "01").innerHTML = document.getElementById("iDescription" + this.entityName + "" + vImage_suivante).innerHTML;
		this.fAffichage_image(vImage_suivante);
		var vRappel = "" + this.entityName + ".fAffichage_automatique_images('" + vImage_suivante + "')";
		this.gCompteur = setTimeout(vRappel, this.gDelai);
	}
	// Sélection de l'image suivante.
	this.fSelection_image_suivante = function() {
		if (this.gNumero_image <= (this.tPhotos.length - 2)) {
			this.gNumero_image += 1;
		} else {
			this.gNumero_image = 0;
		}
		return (this.gNumero_image);
	}

	// Arrêt de l'affichage automatique des images.
	this.fArret_affichage_automatique = function() {
		if (this.gAffichage_automatique == true) {
			clearTimeout(this.gCompteur);
		}
	}

	// Affichage des flèches gauche et droite.
	this.fAffichage_fleches = function() {
		var vTotal = (this.tPhotos.length - 5);
		//window.alert(this.gSection);
		//window.alert(vTotal);
		if (this.gSection >= 1) {
			document.getElementById('iFleche_gauche' + this.entityName).style.visibility = 'visible';
		} else {
			document.getElementById('iFleche_gauche' + this.entityName).style.visibility = 'hidden';
		}
		if (this.gSection >= vTotal) {
			document.getElementById('iFleche_droite' + this.entityName).style.visibility = 'hidden';
		} else {
			document.getElementById('iFleche_droite' + this.entityName).style.visibility = 'visible';
		}
	}
}

