/*
  Javascript for marquee text

  the marquee's text must be specified separately below this object in the variable  marquee.content

  marquee speed is 1 pixel/20ms, suspended when mouse over
*/

var marquee = { 

marqueewidth:0, marqueeID:null, content:null, contentwidth:0, speed:1, copyspeed:0, shift:0,

textA:'Placez le curseur sur le bandeau pour suspendre le défilement.',
textB:'Placez le curseur en dehors du bandeau pour continuer le défilement.',

start:function()
{
  this.marqueewidth = parseInt( document.getElementById('marquee1').style.width ); 

  this.marqueeID = document.getElementById('marquee2');

  this.marqueeID.innerHTML = '<nobr>' + this.content + '</nobr>';

  this.contentwidth = this.marqueeID.offsetWidth;

  this.marqueeID.style.left = this.marqueewidth;

  this.copyspeed = this.speed;

  this.shift = this.marqueewidth;

  this.decorate();

  this.move();
},

decorate:function()
{
  var text = '';

  for(var k = 0, p = 1.0, q = 100; k <= 98; k += 2, p -= 0.02, q -= 2)
  {
    text += '<div style="position:absolute; left:' + k + 'px; top:0px; width:2px; height:30px; background-color:rgb(255,255,255); overflow:hidden; opacity:'+ p + '; filter:alpha(opacity=' + q + ')"></div>';

    var l = this.marqueewidth - k;

    text += '<div style="position:absolute; left:' + l + 'px; top:0px; width:2px; height:30px; background-color:rgb(255,255,255); overflow:hidden; opacity:'+ p + '; filter:alpha(opacity=' + q + ')"></div>';
  }

  document.getElementById('shadow').innerHTML = text;
},

move:function()
{
  if(this.shift < -this.contentwidth)
    this.shift = this.marqueewidth;

  this.shift -= this.speed;

  this.marqueeID.style.left = this.shift;

  setTimeout("marquee.move()",20);
},

suspend:function()
{
  this.speed = 0;

  document.getElementById('suspend').innerHTML = this.textB;
},

resume:function()
{
  this.speed = this.copyspeed;

  document.getElementById('suspend').innerHTML = this.textA;
}
}



