// ces deux tableaux sont desormais declare dans le php
// var photos=new Array()
// var photoslink=new Array()


// on recupere la liste des images via php, voir la page incluant le script
/*
photos[0]="1.jpg"
photos[1]="2.jpg"
photos[2]="3.jpg"
photos[3]="4.jpg"
photos[4]="5.jpg"
*/

/*
photoslink[0]="1.jpg"
photoslink[1]="2.jpg"
photoslink[2]="3.jpg"
photoslink[3]="4.jpg"
photoslink[4]="5.jpg"
*/

var linkornot=1;
var which=0;

function preload_img(){
var preloadedimages=new Array();
var i = which+1;
{
preloadedimages[i]=new Image();
preloadedimages[i].src=photos[i];
}
}
preload_img();

/*
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)+" of "+photos.length;
}

// fonction pour recuperer la taille de l image et en calculer le ratio afin que la hauteur soit fixe et que la largeure s'adapte


// fonction permettant d'inclure dans la page generee les liens contenant les images precedentes et suivantes encessaire a lightbox
function prevnext(){
// PART 1
var prevlinks='';
var i=0;
while(i<which)
     {
      prevlinks=prevlinks+'<a href="'+photoslink[i]+'" rel="lightbox[image]"></a>';
      i++
     }
// PART 2
var nextlinks='';
var i=(which+1);
while(i<photoslink.length)
     {
      nextlinks=nextlinks+'<a href="'+photoslink[i]+'" rel="lightbox[image]"></a>';
      i++;
     }
// envoi des elements entre les div concernés
document.getElementById("liensprec").innerHTML=prevlinks;
document.getElementById("lienssuiv").innerHTML=nextlinks;
}

function backward(){
if (which>0){
which--
document.getElementById("photoslider").src=photos[which];
document.getElementById("photoslider").height=photo_height[which];
document.getElementById("photoslider").width=photo_width[which];
document.getElementById("photoopen").href=photos[which];
// playeffect();
keeptrack();
prevnext();
preload_img();
}
}
function forward(){
if (which<photos.length-1){
which++
// document.images.photoslider.src=photos[which];
document.getElementById("photoslider").src=photos[which];
document.getElementById("photoslider").height=photo_height[which];
document.getElementById("photoslider").width=photo_width[which];
document.getElementById("photoopen").href=photos[which];
// playeffect();
keeptrack();
prevnext();
preload_img();
}
}

function transport(){
window.location=photoslink[which]
}

