/* auteur: webimage */
/* Date de création: 16/07/2009 */

//alert('test :'+pic[0]);

var preLoad = new Array();
var Load = new Array();

for (i = 0; i < pp; i++){
   preLoad[i] = new Image();
   preLoad[i].src = pic[i];
   Load[i] = new Image();
   Load[i].src = tit[i];

}


function runBGSlideShow(){
   if (document.photo){
   document.photo.src = pic[j];
   document.photo.width = larg[j];
   document.photo.height = haut[j];
   if (document.titre){
   document.titre.src = tit[j];
   }
}
   
   jp = jp + 1;
   if (jp > (pp-1)) jp=0;
speed = 3000;
   tp = setTimeout('runBGSlideShow()', speed);

   
}

//slideshow en fondu
var tp
var jp = 0
//var p = Pic.length*/

/*var preLoad = new Array()
for (i = 0; i < p; i++){
preLoad[i] = new Image()
preLoad[i].src = Pic[i]
}*/
// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 4000

// Duration of crossfade (seconds)
var crossFadeDuration = 3


//fonction simple fondu
function runSlideShow(){
if (document.all){
document.images.photo.style.filter="blendTrans(duration=2)"
document.images.photo.style.filter="blendTrans(duration=crossFadeDuration)"
document.images.photo.filters.blendTrans.Apply() 
}
if (document.all){
document.images.photo.filters.blendTrans.Play()
}
document.images.photo.src = pic[jp];
document.images.photo.width = larg[jp];
document.images.photo.height = haut[jp];
   if (document.images.titre){
document.images.titre.width = largtit[jp];
document.images.titre.height = hauttit[jp];
document.images.titre.src = tit[jp];
   }

jp = jp + 1
if (jp > (pp-1)) jp=0
tp = setTimeout('runSlideShow()', slideShowSpeed)
//clearTimeout('runSlideShow()');
}

//diaporama à directions avec fondu
//Fade :
function fondu(){
if (document.all){
document.images.pagimg.style.filter="blendTrans(duration=2)"
document.images.pagimg.style.filter="blendTrans(duration=crossFadeDuration)"
document.images.pagimg.filters.blendTrans.Apply() 
}
if (document.all){
document.images.pagimg.filters.blendTrans.Play()
}

}

var ip = 0;

function next(ip){ // forward one image
//i=document.suite.ic.value;
ip++
//if(i <= p){
if(pic[ip]){
fondu();
//if([i]<p){
document.images.pagimg.src = pic[ip];
document.images.pagimg.width = larg[ip];
document.images.pagimg.height = haut[ip];

/*
!! php
if($pop!=''){
echo "document.suite.pop.value = pop[i];\n";
}*/

document.suite.ic.value= ip;
//document.suite.slide.selectedIndex = ++current;
}
else{first();}
}

function previous(ip){ // back on image
i=document.suite.ic.value;
if((ip-1) >= 0){
fondu();
document.images.pagimg.src = pic[ip-1];
document.images.pagimg.width = larg[ip-1];
document.images.pagimg.height = haut[ip-1];
/*
!! php
if($pop!=''){
echo "document.suite.pop.value = pop[i-1];\n";
}*/
document.suite.ic.value= --ip;
//document.suite.slide.selectedIndex= --current;
}
else{last();}
}

function first(){ // jump to first image
//current=0;
fondu();
document.images.pagimg.src = pic[0];
document.images.pagimg.width = larg[0];
document.images.pagimg.height = haut[0];
/*
!! php
if($pop!=''){
echo "document.suite.pop.value = pop[0];\n";
}*/
document.suite.ic.value= 0;
//document.suite.slide.selectedIndex=0;
}

function last(){ // this is jump to last image
//current=(document.suite.slide.length-1);
ip=(pp-1);
fondu();
document.images.pagimg.src = pic[pp-1];
document.images.pagimg.width = larg[pp-1];
document.images.pagimg.height = haut[pp-1];
/*
!! php
if($pop!=''){
echo "document.suite.pop.value = pop[p-1];\n";
}*/
document.suite.ic.value= ip;
//document.suite.slide.selectedIndex=current;
}

function ap(text){ // this controls the auto-play and/or auto-stop
document.suite.slidebutton.value=(text == diastop) ? diago : diastop;
rotate();}

/*function change(){ // this is for the pulldown menu
//current=document.suite.slide.selectedIndex;
i=document.suite.ic.value;
document.images.photo.src = pic[i];
document.images.photo.width = larg[i];
document.images.photo.height = haut[i];
}*/

function rotate() {

/*if (document.all){
document.images.photo.style.filter="blendTrans(duration=2)"
document.images.photo.style.filter="blendTrans(duration=crossFadeDuration)"
document.images.photo.filters.blendTrans.Apply() 
}*/
if (document.suite.slidebutton.value == diastop ||!document.suite.slidebutton.value) {
fondu();
ip = (ip >= pp-1) ? 0 : ip+1;
/*if (document.all){
document.images.photo.filters.blendTrans.Play()
}*/
document.images.pagimg.src = pic[ip];
document.images.pagimg.width = larg[ip];
document.images.pagimg.height = haut[ip];
/*
!! php
if($pop!=''){
echo "document.suite.pop.value = pop[i];\n";
}*/
document.suite.ic.value= ip;
//document.suite.slide.selectedIndex = current;
window.setTimeout("rotate()", 3000);}}

