var bauto = 0;
var num = 0;
var	remplir = '';
var photo = new Array;




for (i=0; i<nombrephotos; i++)
{
	j=i+1;
	photo[i] = photos+j;
	remplir += '<div id="'+photo[i]+'" class="prechargement-image"><img src="diaporama/'+photo[i]+'.jpg" /></div>';
}



hauteurmax = 0;
document.image_chargee = new Array();
function chargement() {
	for (i=0; i<nombrephotos; i++) {
	document.image_chargee[i] = new Image;
	document.image_chargee[i].src = "diaporama/'+photo[i]+'.jpg";
	hauteur = document.getElementById(photo[i]).offsetHeight;
	if (hauteur > hauteurmax) hauteurmax = hauteur + 10;
	}
	aff_photos()
}

function suivante() {
num += 1;
if (num > nombrephotos-1) num = 0;
aff_photos();
}

function precedente() {
num -= 1;
if (num < 0) num = nombrephotos - 1;
aff_photos();
}

function changer() {
num += 1;
if (num > nombrephotos-1) num = 0;
aff_photos();
if (pause <1 ) pause = 1;
roll=setTimeout("changer()", (pause*1000));
}

function initial() {
window.clearTimeout(roll);
}

function auto() {
if (bauto == 0) {
bauto =1; changer();
document.getElementById("auto").innerHTML = '<a href="#contenu-gauche" onclick="auto();">Arr\352t</a>';
} 
else {
bauto =0; initial();
document.getElementById("auto").innerHTML = '<a href="#contenu-gauche" onclick="auto();">Diaporama</a>';
}
}

function aff_photos() {
			document.getElementById("diaporama").style.height= hauteurmax + 'px';
			hauteur = document.getElementById(photo[num]).offsetHeight;
			hauteur = parseInt((hauteurmax - hauteur)/2) + 'px';
			document.getElementById("diaporama").innerHTML = '<img id="image-diaporama" src="diaporama/'+photo[num]+'.jpg" alt="diaporama" />';
			document.getElementById("image-diaporama").style.marginTop=hauteur;
}
