

function random(wN){
return Math.round(Math.random()*wN);
}

function init_photos(nPhots){
//arg [0] = nombre d'images
//les suivants= nombres de fichiers  jour par images
//initialisation des maximums (var maxN)
var maxP=arguments[0];
for (i=1; i<=maxP;i++){
eval('var max'+i+'='+arguments[i]);
//alert ('max'+i+'='+(eval ('max'+i)));
}
//O se trouvent les images
var rootpath='photos_collection/PH_';
//Format des images
var phot_format='.gif';

//Initialisation des tableaux
for (i=1; i<=9;i++){
eval('phots_url_'+i+'=new Array();');
}



//PH1
phots_url_1[0]=rootpath+'1_1'+phot_format;
phots_url_1[1]=rootpath+'1_2'+phot_format;
phots_url_1[2]=rootpath+'1_3'+phot_format;
phots_url_1[3]=rootpath+'1_4'+phot_format;
phots_url_1[4]=rootpath+'1_5'+phot_format;
photo_cur_1=0;

//PH2
phots_url_2[0]=rootpath+'2_1'+phot_format;
phots_url_2[1]=rootpath+'2_2'+phot_format;
phots_url_2[2]=rootpath+'2_3'+phot_format;
//phots_url_2[2]=rootpath+'2_3'+phot_format;
photo_cur_2=0;

//PH3
phots_url_3[0]=rootpath+'3_1'+phot_format;
phots_url_3[1]=rootpath+'3_2'+phot_format;
phots_url_3[2]=rootpath+'3_3'+phot_format;
phots_url_3[3]=rootpath+'3_4'+phot_format;
phots_url_3[4]=rootpath+'3_5'+phot_format;
photo_cur_3=0;

//PH4
phots_url_4[0]=rootpath+'4_1'+phot_format;
phots_url_4[1]=rootpath+'4_2'+phot_format;
phots_url_4[2]=rootpath+'4_3'+phot_format;
phots_url_4[3]=rootpath+'4_4'+phot_format;
phots_url_4[4]=rootpath+'4_5'+phot_format;
photo_cur_4=0;

//PH5
phots_url_5[0]=rootpath+'5_1'+phot_format;
phots_url_5[1]=rootpath+'5_2'+phot_format;
phots_url_5[2]=rootpath+'5_3'+phot_format;
//phots_url_2[2]=rootpath+'2_3'+phot_format;

//PH6
phots_url_6[0]=rootpath+'6_1'+phot_format;
phots_url_6[1]=rootpath+'6_2'+phot_format;
phots_url_6[2]=rootpath+'6_3'+phot_format;

//PH7
phots_url_7[0]=rootpath+'7_1'+phot_format;
phots_url_7[1]=rootpath+'7_2'+phot_format;
phots_url_7[2]=rootpath+'7_3'+phot_format;
phots_url_7[3]=rootpath+'7_4'+phot_format;
phots_url_7[4]=rootpath+'7_5'+phot_format;

//PH8
phots_url_8[0]=rootpath+'8_1'+phot_format;
phots_url_8[1]=rootpath+'8_2'+phot_format;
phots_url_8[2]=rootpath+'8_3'+phot_format;

//PH9
phots_url_9[0]=rootpath+'9_1'+phot_format;
phots_url_9[1]=rootpath+'9_2'+phot_format;
phots_url_9[2]=rootpath+'9_3'+phot_format;
phots_url_9[3]=rootpath+'9_4'+phot_format;
phots_url_9[4]=rootpath+'9_5'+phot_format;
}


//Slide 1
function timeout1(){
//alert ('toto');
rdPhoto=random(4)
//alert (rdPhoto+"phots_url_1[rdPhoto] = "+phots_url_1[rdPhoto]);
document.PH_1.src=phots_url_1[rdPhoto];
setTimeout("timeout1();",(random(1000)));
//setTimeout("timeout1();",7000);
}

//Slide 2
function timeout2(){
/*if ( photo_cur_2+1==phots_url_2.length){
photo_cur_2=0;
}
else{
photo_cur_2++;
}*/
rdPhoto=random(2);
document.PH_2.src=phots_url_2[rdPhoto];
setTimeout("timeout2();",random(7000));
}

//Slide 3
function timeout3(){

/*if ( photo_cur_3+1==phots_url_3.length){
photo_cur_3=0;
}
else{
photo_cur_3++;
}*/

rdPhoto=random(4);
//alert (rdPhoto3);
document.PH_3.src=phots_url_3[rdPhoto];
setTimeout("timeout3();",(random(3000)));
}

//Slide 4
function timeout4(){
/*if ( photo_cur_4+1==phots_url_4.length){
photo_cur_4=0;
}
else{
photo_cur_4++;
}*/
rdPhoto=random(4);
document.PH_4.src=phots_url_4[rdPhoto];
setTimeout("timeout4();",random(11000));
}
//Slide 5
function timeout5(){
rdPhoto=random(1);
document.PH_5.src=phots_url_5[rdPhoto];
setTimeout("timeout5();",random(7000));
}
//Slide 6
function timeout6(){
rdPhoto=random(2);
document.PH_6.src=phots_url_6[rdPhoto];
setTimeout("timeout6();",random(3000));
}
//Slide 7
function timeout7(){
rdPhoto=random(4);
document.PH_7.src=phots_url_7[rdPhoto];
setTimeout("timeout7();",random(2000));
}
//Slide 8
function timeout8(){
rdPhoto=random(2);
document.PH_8.src=phots_url_8[rdPhoto];
setTimeout("timeout8();",random(3500));
}
//Slide 9
function timeout9(){
rdPhoto=random(4)
document.PH_9.src=phots_url_9[rdPhoto];
setTimeout("timeout9();",(random(3500)));
}
function playSlide(){
init_photos(4,3,3,3,3);
//document.PH_1.src=phots_url_1[photo_cur_1];
//document.PH_1.src='images/photos_collection/PH_3_3.gif';

setTimeout("timeout1();",7000);
setTimeout("timeout2();",5000);
setTimeout("timeout3();",3000);
setTimeout("timeout4();",2500);
setTimeout("timeout5();",1500);
setTimeout("timeout6();",5500);
setTimeout("timeout7();",3500);
setTimeout("timeout8();",2500);
setTimeout("timeout9();",4500);
}

		
