var TTcpttournant=0;                             // compteur toujours initialisé à 0
var TTclicked=0;                                 // reçoit un click
var TTtimeout;
var TTinterval;

function Affiche_texte(texte,ref)
  {
  var elm = document.getElementById("TextedegradeDiv" );   // l element qui doit etre dégradé
  if (!elm) {elm = document.getElementById("TextedegradeDivp");}
   
  elm.style.fontFamily=TTFontFamily;
  elm.style.fontSize=TTFontSize;
  elm.style.textAlign=TTAlignHorizontale;
  //elm.style.verticalAlign=TTAlignVerticale;
  elm.style.color="#FFFFFF";
  if (TTFontBold==1)   elm.style.fontWeight="bold";
  if (TTFontItalic==1) elm.style.fontStyle="Italic";
    
  elm.innerHTML="";
  elm.innerHTML='<br><span style="text-decoration:underline;cursor:pointer">'+texte+'</span>';
  elm.texte=texte;
  elm.href=ref;  
         
  var startColor = [TTCouleurTextDebut_R,TTCouleurTextDebut_V,TTCouleurTextDebut_B];     
  var stopColor  = [TTCouleurTextFinale_R,TTCouleurTextFinale_V,TTCouleurTextFinale_B];  


  var rDelta = Math.ceil((stopColor[0]-startColor[0])/TTnbTrans);
  var gDelta = Math.ceil((stopColor[1]-startColor[1])/TTnbTrans);
  var bDelta = Math.ceil((stopColor[2]-startColor[2])/TTnbTrans);     // on cree les variables ou vont etre stockees les couleurs temporaires    
  var rTemp = startColor[0];    
  var gTemp = startColor[1];    
  var bTemp = startColor[2];     // setInterval pour que la fonction se repete d elle meme    

  var TTinterval = setInterval(function() 
                             {        
                             rTemp += rDelta;        
                             gTemp += gDelta;        
                             bTemp += bDelta;                                                          
                             elm.style.color = "rgb("+rTemp+","+gTemp+","+bTemp+" )"; 
                             if (rTemp<0 || gTemp<0 || bTemp<0|| rTemp>255 || gTemp>255 || bTemp>255 ) 
                                {                                   
                                clearInterval(TTinterval);                                            
                                elm.style.color = "rgb("+stopColor[0]+","+stopColor[1]+","+stopColor[2]+" )";
                                }   
                             },TTdelay); 
  return TTinterval;
  }    

function Texte_tournant() {
      clearInterval(TTinterval);
      clearTimeout(TTtimeout); 
      TTinterval=Affiche_texte(Textes[TTcpttournant][0],Textes[TTcpttournant][1]);
      TTcpttournant=TTcpttournant+1; 
      if (TTcpttournant>Textes.length-1) TTcpttournant=0;      
      TTtimeout=setTimeout("Texte_tournant()",10000);
   }

function Click_texte(texte,wURL) {
    TTclicked=1;  
    if (wURL!="")   
       {window.open(wURL);}
    else
       alert("Aucun lien n'a été défini pour : \n" + texte);
    clearInterval(TTinterval);
    clearTimeout(TTtimeout); 
    Texte_tournant();
}  

function TTattente()
  {
  TTclicked=1;  
  }

function TTreprise()
  {
  clearInterval(TTinterval);
  clearTimeout(TTtimeout); 
  Texte_tournant();
  }   
