var opaciteMax = 100;
var opaciteMin = 0;
var opacite=opaciteMin;
var sensAfficher=true;
var imgCourante = document.getElementById("vignettePhoto");
var imgProchaine = document.createElement('img');
var prochainePhoto = Math.floor(Math.random()*maxPhotos)+1;
imgProchaine.src = "/phototheque/vignettes/"+prochainePhoto+".jpg";
var isIE = (navigator.appName == "Microsoft Internet Explorer");
		
function fadePic(){		
	if (opacite<opaciteMax && sensAfficher){opacite+=2;}
	if (opacite>opaciteMin && !sensAfficher){opacite-=2;}
	if (opacite>=opaciteMax){sensAfficher=false;}
	if (opacite<=opaciteMin){sensAfficher=true;}
	if (isIE) {
		document.getElementById("vignettePhoto").style.filter = "alpha(opacity="+opacite+")";

		}
	else {
		document.getElementById("vignettePhoto").style.opacity=opacite/100;
		}
	
	if (opacite == 0) {defilementVignettes();}
}

var maxPhotos = 17;
var prochainePhoto =  Math.floor(Math.random()*maxPhotos)+1;

function defilementVignettes() {
	imgCourante.src = "/phototheque/vignettes/"+prochainePhoto+".jpg";
	var anciennePhoto = prochainePhoto;
	do {
		prochainePhoto = Math.floor(Math.random()*maxPhotos)+1;
		}
	while (prochainePhoto == anciennePhoto);
	imgProchaine.src = "/phototheque/vignettes/"+prochainePhoto+".jpg";
	}
