/******************************************************************************/
/* Nom          : fadding_scroller.js                                         */
/* Auteur       : Dièse Include d'après                                       */
/*  Fading Scroller- © Dynamic Drive DHTML code library (www.dynamicdrive.com)*/
/*  This notice MUST stay intact for legal use                                */
/*  Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code  */
/* Date         : juin 2007                                                   */
/* Projet       : Include Framework                                           */
/* Objet        : Permet la gestion d'un scrolling de données dans un clip    */
/******************************************************************************/

// Fonction permettant de changer le contenu
function changecontent(){
  if (index>=fcontent.length)
    index=0
  if (DOM2){
    document.getElementById("fscroller").style.color="rgb("+startcolor[0]+", "+startcolor[1]+", "+startcolor[2]+")"
    document.getElementById("fscroller").innerHTML=begintag+fcontent[index]+closetag
    if (fadelinks)
      linkcolorchange(1);
    colorfade(1, 15);
  }
  else if (ie4)
    document.all.fscroller.innerHTML=begintag+fcontent[index]+closetag;
  index++
}

// colorfade() partially by Marcio Galli for Netscape Communications.  ////////////
// Modified by Dynamicdrive.com

function linkcolorchange(step){
  var obj=document.getElementById("fscroller").getElementsByTagName("A");
  if (obj.length>0){
    for (i=0;i<obj.length;i++)
      obj[i].style.color=getstepcolor(step);
  }
}

function colorfade(step) {
  if(step<=maxsteps) {	
    document.getElementById("fscroller").style.color=getstepcolor(step);
    if (fadelinks)
      linkcolorchange(step);
    step++;
    fadecounter=setTimeout("colorfade("+step+")",stepdelay);
  }else{
    clearTimeout(fadecounter);
    document.getElementById("fscroller").style.color="rgb("+endcolor[0]+", "+endcolor[1]+", "+endcolor[2]+")";
    setTimeout("changecontent()", delay);
	
  }   
}

/*Rafael Raposo's new function*/
function getstepcolor(step) {
  var diff
  var newcolor=new Array(3);
  for(var i=0;i<3;i++) {
    diff = (startcolor[i]-endcolor[i]);
    if(diff > 0) {
      newcolor[i] = startcolor[i]-(Math.round((diff/maxsteps))*step);
    } else {
      newcolor[i] = startcolor[i]+(Math.round((Math.abs(diff)/maxsteps))*step);
    }
  }
  return ("rgb(" + newcolor[0] + ", " + newcolor[1] + ", " + newcolor[2] + ")");
}

/******************************************************************************/
/* Nom          : translucide                                                 */
/******************************************************************************/
function moveslide(){
  if (curpos>0){
    curpos=Math.max(curpos-degree,0)
    tempobj.style.top=curpos+"px"
  }
  else{
    clearInterval(dropslide)
    if (crossobj.filters)
      crossobj.filters.alpha.opacity=100
    else if (crossobj.style.MozOpacity)
      crossobj.style.MozOpacity=1
    nextcanvas=(curcanvas=="canvas0")? "canvas0" : "canvas1"
    tempobj=ie4? eval("document.all."+nextcanvas) : document.getElementById(nextcanvas)
    tempobj.innerHTML=scrollercontent[curindex]
    nextindex=(nextindex<scrollercontent.length-1)? nextindex+1 : 0
    setTimeout("rotateslide()",pause)
  }
}

function rotateslide(){
  if (ie4||dom){
    resetit(curcanvas)
    crossobj=tempobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
    crossobj.style.zIndex++
    if (crossobj.filters)
      document.all.canvas0.filters.alpha.opacity=document.all.canvas1.filters.alpha.opacity=20
    else if (crossobj.style.MozOpacity)
      document.getElementById("canvas0").style.MozOpacity=document.getElementById("canvas1").style.MozOpacity=0.2
    var temp='setInterval("moveslide()",50)'
    dropslide=eval(temp)
    curcanvas=(curcanvas=="canvas0")? "canvas1" : "canvas0"
  }
  else if (document.layers){
    crossobj.document.write(scrollercontent[curindex])
    crossobj.document.close()
  }
  curindex=(curindex<scrollercontent.length-1)? curindex+1 : 0
}

function resetit(what){
  curpos=parseInt(scroller_height)*(1)
  var crossobj=ie4? eval("document.all."+what) : document.getElementById(what)
  crossobj.style.top=curpos+"px"
}

function startit(){
  crossobj=ie4? eval("document.all."+curcanvas) : dom? document.getElementById(curcanvas) : document.tickernsmain.document.tickernssub
  if (ie4||dom){
    crossobj.innerHTML=scrollercontent[curindex]
    rotateslide()
  }
  else{
    document.tickernsmain.visibility='show'
    curindex++
    setInterval("rotateslide()",pause)
  }
}

