<!--

function slideShowCreatePic(aPicName, filePrefix) {
  l= aPicName.length;
  pic= new Array();
  for(i= 0; i<l; i++) {
    pic1= new Image();
    pic1.src= filePrefix+aPicName[i];
    pic[i]= pic1;
  }
  return pic;
}

function createSlideShowRow(
  aItemInterval, // time interval between 2 image changes in milliseconds
  aFadeInterval, // fading duration in seconds
  aObjName, // global name of created object for setTimeout
  aPicName, // array of picture file names
  aPicWinIndex, // array of picture index in each window
  aTotalMove // duration of automatic work (number of image changes)
) {
  this.itemInterval= aItemInterval;
  this.fadeInterval= aFadeInterval;
  this.objName= aObjName;
  this.totalMove= aTotalMove;
  this.moveIndex= 0;
  this.running= false;
  this.start= slideShowStart;
  this.stop= slideShowStop;
  this.fade= slideShowFade;
  this.continueShow= slideShowContinueShow;
  //this.pic= slideShowCreatePic(aPicName, "images/slide/pic1/");
  this.pic= slideShowCreatePic(aPicName, "");

  this.picWinIndex= aPicWinIndex;
  this.winNumber= this.picWinIndex.length;
  this.winIndex= 0;
  this.tic= slideShowRowTic;
}

function slideShowStart() {
  if (! this.running) {
    this.running= true;
    this.tic();
  }
}

function slideShowFade(img, src) {
  if (document.all){
    img.style.filter="blendTrans(duration="+this.fadeInterval+")";
    img.filters.blendTrans.Apply();
  }
  img.src = src;
  if (document.all){
    img.filters.blendTrans.Play();
  }
}

function slideShowRowTic() {
  this.picWinIndex[this.winIndex]++;
  if (this.picWinIndex[this.winIndex] >= this.pic.length)
    this.picWinIndex[this.winIndex]= 0;

  img= document.images["slide_"+this.winIndex];
  this.fade(img, this.pic[this.picWinIndex[this.winIndex]].src);

  if (++this.winIndex >= this.winNumber)
    this.winIndex= 0;
  this.continueShow();
}

function slideShowContinueShow() {
  this.moveIndex++;
  if (this.moveIndex < this.totalMove || this.totalMove == 0)
    this.timeout = setTimeout(this.objName+".tic()", this.itemInterval);
  else   
    this.stop();
}

function slideShowStop() {
  if (this.timeout) {
    clearTimeout(this.timeout);
  }
  this.moveIndex= 0;
  this.running= false;
}

function createSlideShowPlayer(
  aItemInterval, // time interval between 2 image changes in milliseconds
  aFadeInterval, // fading duration in seconds
  aObjName, // global name of created object for setTimeout
  aPicName, // array of picture file names
  aTotalMove, // duration of automatic work (number of image changes)
  aImgObj, // rotated image 
  aAutoplayButton // play button object
) {
  this.itemInterval= aItemInterval;
  this.fadeInterval= aFadeInterval;
  this.objName= aObjName;
  this.totalMove= aTotalMove;
  this.moveIndex= 0;
  this.running= false;
  this.fade= slideShowFade;
  this.continueShow= slideShowContinueShow;
  this.pic= slideShowCreatePic(aPicName, "");
  //this.pic= slideShowCreatePic(aPicName, "images/slide/pic2/");

  this.picIndex= 0;
  this.fadePlayer= slideShowFadePlayer;
  this.img= aImgObj;
  this.autoplayButton= aAutoplayButton;
  this.tic= slideShowPlayerTic;
  this.prev= slideShowPrev;
  this.next= slideShowNext;
  this.first= slideShowFirst;
  this.last= slideShowLast;
  this.start= slideShowStartButton;
  this.start1= slideShowStart;
  this.stop= slideShowStopButton;
  this.stop1= slideShowStop;
  this.autoplay= slideShowAutoplay;
}

function slideShowFadePlayer() {
  this.fade(this.img, this.pic[this.picIndex].src);
}

function slideShowPlayerTic() {
  this.next();
  this.continueShow();
}

function slideShowPrev() {
  this.picIndex--;
  if (this.picIndex < 0)
    this.last();
  else
    this.fadePlayer();
}

function slideShowNext() {
  this.picIndex++;
  if (this.picIndex >= this.pic.length)
    this.first();
  else
    this.fadePlayer();
}

function slideShowFirst() {
  this.picIndex= 0;
  this.fadePlayer();
}

function slideShowLast() {
  this.picIndex= this.pic.length - 1;
  this.fadePlayer();
}

function slideShowAutoplay() {
  if (this.autoplayButton) {
    if ("Start" == this.autoplayButton.value) this.start();
    else this.stop();
  }
}

function slideShowStopButton() {
  this.stop1();
  if (this.autoplayButton) {
    this.autoplayButton.value= "Start";
  }
}

function slideShowStartButton() {
  this.start1();
  if (this.autoplayButton) {
    this.autoplayButton.value= "Stop";
  }
}

//--> 