// JavaScript Document
function imageOver(cible){
	cible.src="structure/menu/" + cible.name + "_hover.gif";
}

function imageOut(cible){
	cible.src="structure/menu/" + cible.name + ".gif";
}


function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;

    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpacMoin(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpacPlus(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
}

//change the opacity for different browsers
function changeOpacMoin(opacity, id) {
    var object = document.getElementById(id).style;
	if (opacity==0){
		document.getElementById(id).style.visibility = 'hidden';
		if(id=="cadrePhoto")
			document.getElementById("photo").src="#";
	}
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
} 

function changeOpacPlus(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 + ")";
} 

function afficherPhoto(photo){
	curseurPhoto=0;	
	document.getElementById("conteneurPhotos").style.overflow = "hidden";
	document.getElementById("conteneurPhotos").style.visibility="hidden";
	while((curseurPhoto<tabPhoto.length) && (tabPhoto[curseurPhoto]!=photo)) curseurPhoto++;
	//document.getElementById("tele").style.visibility="hidden";
	document.getElementById("photo").src="structure/photos/photos/iris_besse_"+photo+".jpg";
	changeOpacPlus(0,"masque");
	document.getElementById("masque").style.visibility="visible";
	opacity('masque', 0, 100, 300);
	changeOpacPlus(0,"cadrePhoto");
	document.getElementById("cadrePhoto").style.visibility="visible";
	opacity('cadrePhoto', 0, 100, 100);
	document.getElementById("menuPhoto").style.visibility="visible";	
}

function fermerPhoto(){
	document.getElementById("conteneurPhotos").style.overflow = "auto";
	document.getElementById("conteneurPhotos").style.visibility="visible";
	//document.getElementById("tele").style.visibility="visible";
	opacity('masque', 100, 0, 300);
	opacity('cadrePhoto', 100, 0, 300);
	document.getElementById("menuPhoto").style.visibility="hidden";	
}

function precedantePhoto(){
	document.getElementById("photo").src="#";
	curseurPhoto--;
	if(curseurPhoto==-1) curseurPhoto = tabPhoto.length-1;
	document.getElementById("photo").src="structure/photos/photos/iris_besse_"+tabPhoto[curseurPhoto]+".jpg";
}

function suivantePhoto(){
	document.getElementById("photo").src="#";
	curseurPhoto++;
	if(curseurPhoto==tabPhoto.length) curseurPhoto = 0;
	document.getElementById("photo").src="structure/photos/photos/iris_besse_"+tabPhoto[curseurPhoto]+".jpg";
}


var tabPhoto = [14,5,9,2,10,7,11,12,3,8,1,4,13];
var curseurPhoto=0;