var n = 0;//Photo courante, par défaut 0
var photos = document.getElementById('nav_mosaic') ;//Liste des photos
var liens = photos.getElementsByTagName('a') ;//Tableau contenant les liens vers les images
var big_photo = document.getElementById('big_pict') ;//Grande image
var titre_photo = document.getElementById('grande_img').getElementsByTagName('dt')[0] ;//Légende




//Changement de la grande photo quand on clique sur une petite
for (var i = 0 ; i < liens.length ; i++) {
	liens[i].onclick = function() {
		big_photo.src = this.href;
		big_photo.alt = this.title;
		titre_photo.firstChild.nodeValue = this.title;
		n = this.i;
		return false;
	};
	liens[i].i = i;
}



//Fonction pour aller à la photo suivante
function suivant()
{
	//Si la photo est la dernière on revient au début
	if(n == (liens.length-1))	n = 0;
	else		n++;
	
	//Modifications
	big_photo.src = liens[n].href;
	big_photo.alt = liens[n].title;
	titre_photo.firstChild.nodeValue = liens[n].title;
}



//Fonction pour aller à la photo précédente
function precedent()
{
	//Si la photo est la première on revient à la fin
	if(n ==0)		n = (liens.length-1);
	else		n--;
	
	//Modification
	big_photo.src = liens[n].href;
	big_photo.alt = liens[n].title;
	titre_photo.firstChild.nodeValue = liens[n].title;
}


