/*
  function to place mini affiches into the cotisation page
*/

var affiches = {

photoSource:new Array(	"images/affiche_p1.jpg", 
			"images/affiche_p2.jpg",
			"images/affiche_p3.jpg",
			"images/affiche_p4.jpg",
			"images/affiche_p5.jpg",
			"images/affiche_p6.jpg",
			"images/affiche_p7.jpg",
			"images/affiche_p8.jpg",
			"images/affiche_p9.jpg",
			"images/affiche_p10.jpg",
			"images/affiche_p11.jpg",
			"images/affiche_p12.jpg"),

images:new Array(), photoId:null, step:1, shift:0,

read:function()
{
  for(var k = 0; k < 12; k++)
  {
    this.images[k] = new Image();

    this.images[k].src = this.photoSource[k];
  }
},

start:function()
{
  this.photoId = document.getElementById('photos');

  var text = '';

  var left = 0;

  var number = 0;

  for(var i = 0; i < 24; i++)
  {
    text += '<a href="images/affiche_pub' + (number + 1) + '.jpg" target="_blank">';
 
    text += '<img src="" style="position:absolute; left:' + left + 'px; top:0px; width:65px; height:80px; border:none" id="photo' + i + '"></a>';

    left += 70;

    number = ++number % 12; 
  }

  this.photoId.innerHTML = text;

  for(var i = 0; i < 24; i++)
  {
    k = i % 12;

    document.getElementById('photo' + i).src = this.images[k].src;
  }

  this.move();
},

move:function()
{
  this.shift = (this.shift + this.step) % 840;

  this.photoId.style.left = -this.shift;

  setTimeout("affiches.move()",40);
},

suspend:function()
{
  this.step = 0;
},

resume:function()
{
  this.step = 1;
}
}

affiches.read();
