var photosvisibles=1;

	var descriptions=Array();

	var suite=Array();

	function voirunephoto(num){

				voirphotos();

				window.setTimeout("chargerphoto("+num+")",1000);

	}

	function chargerphoto(num){

		suivant=0;
		precedent=0;
		for(i=0;i<suite.length;i++){
			if(suite[i]==num) trouve=i;
		}

		if(trouve-1>=0) precedent=suite[trouve-1];
		else  precedent=suite[suite.length-1];

		if(trouve+1<suite.length) suivant=suite[trouve+1];
		else suivant=suite[0];

		texte="<table border=0 cellpadding=0 cellspacing=0><tr valign=top>";
		texte+="<td width=480 rowspan=2>";
		texte+="<img src='photos/grandes/"+num+".jpg' border=0>";
		texte+="</td>";

		texte+="<td width=460 style='padding-left:30px;text-align:justify;'><span class=description>"+descriptions[num]+"</span></td>";

		texte+="</tr>";

		texte+="<tr valign=bottom height=35>";
		texte+="<td align=right  height=35>";
			texte+="<a href='javascript:voirunephoto("+precedent+");'><img src='images/left.gif' border=0></a>";
				texte+="<a href='javascript:voirindex2();'><img src='images/home.gif' border=0></a>";
			texte+="<a href='javascript:voirunephoto("+suivant+");'><img src='images/right.gif' border=0></a>";

		texte+="</td>";
		texte+="</tr>";
		
		texte+="</table>";


		document.getElementById('contenu').innerHTML=texte;
		document.getElementById('hautbas').innerHTML="";

		voirphotos();
	}


	function voirphotos(){
			
			if(photosvisibles==0){
					opacity('photos', 100, 0, 500);
					photosvisibles=1;


			}
			else{

				
				opacity('photos', 0, 100, 500);
				photosvisibles=0;

				
			}
	}

function voirindex2(){
	voirphotos();

	window.setTimeout("voirindex()",1000);
}

var leslignes=new Array();

var depart=1;

function voirindex(){
					
					
				voirindex2();

				voirphotos();
				

}



function haut(){
	if(depart>1){
		opacity('photos', 100, 0, 200);
		depart=depart-3;

		window.setTimeout("voirindex2();",200);

		window.setTimeout("opacity('photos', 0, 100, 500);",400);
	}
}

function bas(){
	
	//if(depart<2){
		opacity('photos', 100, 0, 200);
		depart=depart+3;

		window.setTimeout("voirindex2();",200);

		window.setTimeout("opacity('photos', 0, 100, 500);",400);
	//}
}


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("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
		}
	
		
	} else if(opacStart < opacEnd) {
		for(i = opacStart; i <= opacEnd; i++)
			{
			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
		}
	}
}

//change the opacity for different browsers
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 + ")";
}


