function popupImage(img, titre) {
	w=open("",'image','width=500,height:300,toolbar=no,scrollbars=no,resizable=yes');	
	w.document.write("<html><head><title>'"+titre+"'</title></head>");
	w.document.write("<script language=javascript>function checksize()  { if (document.images[0].complete) {  window.resizeTo(document.images[0].width+10,document.images[0].height+40); window.focus();} else { setTimeout('check()',250) } }</"+"script>");
	w.document.write("<body onload='checksize()' leftMargin=0 topMargin=0 marginwidth=0 marginheight=0><img src='"+img+"' border=0>");
	w.document.write("</body></html>");
	w.document.close();
}
/*
// paramètre chemin absolu à modifier
var chemin = "http://www.teenergy.ch/images/nos-studios/";
// paramètre tabNom à modifier selon le nombre d'images, nommmer la dernière "imgder.jpg"
var tabNom = new Array("teenergy-studio-1", "teenergy-studio-2", "teenergy-studio-3", "teenergy-studio-4", "teenergy-studio-5", "teenergy-studio-6", "img7", "img8", "img9", "img10", "img11", "img12", "img13", "img14", "imgder"); // tableau du nom des fichiers images dans le répertoire courant
*/
var numPrechargee = 0; 
var imagesTab; 
var numImgAffichee = 0;
var cbCochee; // boolean true quand la case est cochee
var cbJusteCochee; // booleen true quand la case vient d'être cochee

function setCbJusteCochee(bool) {
	cbJusteCochee = bool;
}
function setCbCochee(bool) {
	cbCochee = bool;
}
function imgSuivante() {
	if (document.images) {
		if (numImgAffichee <= tabNom.length-1) {
		//alert(document.images["imgAffichee"].src);
			if (document.images["imgAffichee"].src == chemin + tabNom[tabNom.length-1] + ".jpg") {
			//alert("passé");
				numImgAffichee = 0;
				// l'image doit être complete pour être affichée
				//while(!imagesTab[numImgAffichee].complete) {}
			}
			else {
				numImgAffichee += 1;
			}
			document.images["imgAffichee"].src = chemin + tabNom[numImgAffichee] + ".jpg";
		}
	}
}
function imgPrecedente() {
	if (document.images) {
		if (document.images["imgAffichee"].src == chemin + tabNom[0] + ".jpg") {
				numImgAffichee = tabNom.length - 1;
		}
		else {
			numImgAffichee -= 1;
		}
		document.images["imgAffichee"].src = chemin + tabNom[numImgAffichee] + ".jpg";
	}
}
function cycleAuto() {
	if (document.images) {
		if (cbCochee) {
			if (!cbJusteCochee) {
				if (document.images["imgAffichee"].src == chemin + tabNom[tabNom.length]) 
					numImgAffichee = 0;
				imgSuivante();			
			}
			setTimeout("cycleAuto()", 5000);
			cbJusteCochee = false;
		}
	}
}