// Déclaration et initialisation des variables 
var tab_img = new Array;    //tableau contenant les images
var num=0;                  //numéro de l'image jouée

//Ajout d'un compte à rebours afin de jouer le diaporama
var timer_diapo = setInterval("diaporama('boite_diapo','img_diapo',1000)",4000);

/* 
	Explication des paramètres 
	'boite_diapo' : identifiant de la boite du diaporama. NE PAS MODIFIER
	'img_diapo'   : identifiant de l'image contenu dans la boite diaporama. NE PAS MODIFIER.
	1000           : temps (en milliseconde) de l'effet fondu entre 2 images. 1 seconde = 1000 millisecondes.
	4000          : interval de temps entre 2 images. 1 seconde = 1000 millisecondes.	
*/

//Fonction qui permet de jouer le diaporama
function diaporama(divid, imageid, millisec){ 
	var speed = Math.round(millisec / 100); 
	var timer = 0;	  
	document.getElementById(divid).style.cursor = "pointer"; 
	document.getElementById(divid).style.backgroundImage = "url(" + tab_img[num] + ")"; 
	changeOpac(0, imageid); 
	if (num>(tab_img.length-2)){num = -1;}
	document.getElementById(imageid).style.backgroundImage = "url(" + tab_img[num+1] + ")"; 	   
	for(i = 0; i <= 100; i++){ 
		setTimeout("changeOpac(" + i + ",'" + imageid+ "')",(timer * speed));
		timer++; 
	}
	document.getElementById(divid).onclick = function(){ window.open(tab_url[num]); }
	num++;
}

//Fonction qui attribue l'opacité à l'objet "image_diapo"
function changeOpac(opacity, id){
	var object = document.getElementById(id).style;
	object.opacity = (opacity / 100);
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + opacity + ")";
}