var diapos = new Array();
function Mini_diapo(images, frame1, frame2, delai, pause)
  {
  this.images = images;
  this.img1 = document.getElementById (frame1);
  this.img2 = document.getElementById (frame2);
  this.img2.src=this.images[0];
  this.delai = delai;
  this.pause = pause;
  var parDiv = this.img2.parentNode;
  if (parDiv.tagName != 'DIV')parDiv = parDiv.parentNode;
  this.l = parseInt(parDiv.style.width);
  this.h = parseInt(parDiv.style.height);
  this.curImg = 0;
  this.iter = -1;
  this.mode = 7;
  this.diapoNum = diapos.length;
  diapos.push(this);
  this.nextIter()
  }

Mini_diapo.prototype.nextIter = function ()
  {
  if(this.iter-- <=0) 
    {
    this.initIter();
    return;
    }
  switch(this.mode)
    {
    case 0:{this.x = -this.iter;break;}
    case 1:{this.x = -this.iter;this.y = - Math.floor(this.h*this.iter/this.l);break;}
    case 2:{this.y = - Math.floor(this.h*this.iter/this.l);break;}
    case 3:{this.x = this.iter;this.y = - Math.floor(this.h*this.iter/this.l);}
    case 4:{this.x = this.iter;break;}
    case 5:{this.x = this.iter;this.y = Math.floor(this.h*this.iter/this.l);break;}
    case 6:{this.y = Math.floor(this.h*this.iter/this.l);break;}
    case 7:{this.x = -this.iter;this.y = Math.floor(this.h*this.iter/this.l);break;}
    }
  window.setTimeout("diapo_animate(" + this.diapoNum + ")", this.delai);
  }
Mini_diapo.prototype.initIter = function ()
  {
  this.mode = Math.floor(Math.random()*8);
  switch(this.mode)
    {
    case 0:{this.x = -this.l;this.y = 0;break;}
    case 1:{this.x = -this.l;this.y = 0;break;}
    case 2:{this.x = 0;this.y = -this.h;break;}
    case 3:{this.x = this.l;this.y = -this.h;break;}
    case 4:{this.x = this.l;this.y = 0;break;}
    case 5:{this.x = this.l;this.y = this.h;break;}
    case 6:{this.x = 0;this.y = this.h;break;}
    case 7:{this.x = -this.l;this.y = this.h;break;}
    }
  this.img1.src=this.images[this.curImg++];
  if(this.curImg == this.images.length) this.curImg = 0;
  this.img2.src=this.images[this.curImg];
  this.img1.style.visibility="visible";
  this.iter = this.l;
  //mode++;
  if (this.mode == 8) this.mode = 0;
  window.setTimeout("diapo_animate(" + this.diapoNum + ")", this.pause);
  }
function diapo_animate (diapoNum)
  {
  diapos[diapoNum].nextIter();
  diapos[diapoNum].img2.style.left = diapos[diapoNum].x + "px";
  diapos[diapoNum].img2.style.top = diapos[diapoNum].y + "px";
  }
