
var timerId = -1;
var imgIsLoaded = false;
// =======================================
// set the following variables
// =======================================

// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 5000

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

// =======================================
// do not edit anything below this line
// =======================================

var curImg = 0
var p = Pic.length

ads=[]; ct=-1;
   ads[0] = new Image;
   ads[0].src = Pic[0];
   ads[p-1] = new Image;
   ads[p-1].src = Pic[p-1];

function changeSlide2(){
   var n=(ct+1)%p;
   if (ads[n] && (ads[n].complete || ads[n].complete==null)) {
      document.images.SlideShow.src = ads[ct=n].src
   }
   ads[n=(ct+1)%p] = new Image;
   ads[n].src = Pic[n];
}

function changeSlide(){
   if (document.all){
      document.images.SlideShow.style.filter="blendTrans(duration=2)"
      document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)"
      document.images.SlideShow.filters.blendTrans.Apply()
   }
   var n=(ct+1)%p;
   if (ads[n] && (ads[n].complete || ads[n].complete==null)) {
      document.images.SlideShow.src = ads[ct=n].src
   }
   
   ads[n=(ct+1)%p] = new Image;
   ads[n].src = Pic[n];
   if (document.all){
      document.images.SlideShow.filters.blendTrans.Play()
   }
}

function forward(){
   if (document.all){
      document.images.SlideShow.style.filter="blendTrans(duration=2)"
      document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)"
      document.images.SlideShow.filters.blendTrans.Apply()
   }
   var n=(ct+1)%p;
   if (ads[n] && (ads[n].complete || ads[n].complete==null)) {
      document.images.SlideShow.src = ads[ct=n].src
   }
  
   ads[n=(ct+1)%p] = new Image;
   ads[n].src = Pic[n];
   if (document.all){
      document.images.SlideShow.filters.blendTrans.Play()
   }
}

function forward2(){   
   var n=(ct+1)%p;
   if (ads[n] && (ads[n].complete || ads[n].complete==null)) {
      document.images.SlideShow.src = ads[ct=n].src
   }
	  
   ads[n=(ct+1)%p] = new Image;
   ads[n].src = Pic[n];
}
function rewind(){   
    ct--;
    if (ct < 0)
       ct = p - 1;

   var n=ct;
   if (ads[n] && (ads[n].complete || ads[n].complete==null)) {
      document.images.SlideShow.src = ads[ct=n].src
   }
   
   ads[n=(ct-1)] = new Image;
   ads[n].src = Pic[n];
}

function rewind2(){   
   ct--;
    if (ct < 0)
       ct = p - 1;

   var n=ct;
   if (ads[n] && (ads[n].complete || ads[n].complete==null)) {
      document.images.SlideShow.src = ads[ct=n].src
   }
   
   ads[n=(ct-1)] = new Image;
   ads[n].src = Pic[n];
}


function runSlideShow() {
//   timerId = setTimeout('forward()', slideShowSpeed);
   timerId = window.setInterval('forward();', slideShowSpeed);
}

function stop()
{
    window.clearInterval(timerId);
    timerId = -1;
    imgIsLoaded = true;
}

function setButton(direction)
{
    imgIsLoaded = true;
}

