var ordre = new Array(); //classement des photos
var photos = new Array();
ordre [1]=-1;
var which=0
var preloadedimages=new Array();

function init(nb,chemin)
{ 
  for (i=1; i<nb; i++) // remplit le tableau ordre[] avec des numéros au hasard
	{ nombre = Math.floor(Math.random() * (nb-1))+1; // nombre entre 1 et (nb-1) inclus
	  trouve=0;
	  for (j=1; j<i; j++)
	    { if (ordre[j]==nombre) trouve=1; }
	  if (trouve==1) 
	     {i=i-1;}
	  else 
		{ ordre[i]=nombre;
	    }
    }
  for (i=1; i<nb; i++) // remplit le tableau photos
  { photos[i]=chemin+"/photo"+ordre[i]+".jpg";}

}

for (i=0;i<ordre.length;i++){
  preloadedimages[i]=new Image()
  preloadedimages[i].src=photos[i];}

function backward(){
   if (which>0){
   window.defaultStatus="Photo n°"+which
   which--
  //applyeffect()
  document.images.photoslider.src=photos[which]
  //playeffect()
  //keeptrack() 
}
}

function forward(){
  if (which<photos.length-1){
  which++
  numero=which+1 
  window.defaultStatus="Photo n°"+numero
  //applyeffect()
  document.images.photoslider.src=photos[which]
  //playeffect()
  //keeptrack() 
}
}


function applyeffect(){
if (document.all && photoslider.filters){
photoslider.filters.revealTrans.Transition=Math.floor(Math.random()*23)
photoslider.filters.revealTrans.stop()
photoslider.filters.revealTrans.apply()
}
}

function playeffect(){
if (document.all && photoslider.filters)
photoslider.filters.revealTrans.play()
}

function keeptrack(){
window.status="Image "+(which+1)+" sur "+ photos.length
}
