<!--
  /**************************************************************************
  * File : texte_defilant.js
  * Description : 
  * 
  * Next Files : 
  * 
  * Writers history : 
  *  Marjorie Lazaro
  * Last modification : 2005/01/20 (iut_toulon v.1)
  **************************************************************************/


function remplaceStr(chaine1,chaine2,chaine3){
  if ((chaine1 == "") || (chaine2 == "")) return false;
  valeur = chaine1.indexOf(chaine2);
  if (valeur == -1) return chaine1;
  strFinale = "";
  strTmp = chaine1;
  while (valeur != -1) {
    strFinale = strFinale.concat(strTmp.substring(0,valeur)).concat(chaine3);
    strTmp = strTmp.substr(valeur+chaine2.length);
    valeur = strTmp.indexOf(chaine2);
  }
  strFinale = strFinale.concat(strTmp);
  return strFinale;
}


function ecritCalque(idCalque,texte){
  if (document.all) document.all[idCalque].innerHTML = texte;
  if (document.layers) {
    document.layers[idCalque].document.open();
    document.layers[idCalque].document.write(texte);
    document.layers[idCalque].document.close();
  }
  if (document.getElementById) document.getElementById(idCalque).innerHTML = texte;
}


function styleCalque(idCalque) {
  if (document.all) calqueStyle = document.all[idCalque].style;
  if (document.layers) calqueStyle = document.layers[idCalque];
  if (document.getElementById) calqueStyle = document.getElementById(idCalque).style;
  return calqueStyle;
}


indScrollH = 0;


function scrollH(idCalque,taille,classe) {
  strTmp = "";
  tailleWithSpace = taille * 2;
  while (strTmp.length < tailleWithSpace) {
    strTmp = strTmp + " ";
  }
  strFin = strTmp + messageScrollH;
  tailleAff = Math.round(tailleWithSpace - (indScrollH / 2.5));
  if (tailleAff < taille) tailleAff = taille;
  strAff = strFin.substr(indScrollH,tailleAff);
  //if (strAff.length < tailleAff) strAff = strAff + strTmp.substr(0,tailleAff-strAff.length);
  strAff = remplaceStr(strAff," ","&nbsp;");
  strAff = "<SPAN CLASS='" + classe + "' align='right'>" + strAff + "</SPAN>";
  ecritCalque(idCalque,strAff);
  if (indScrollH < strFin.length-1) indScrollH++;
  else indScrollH = 0;
  setTimeout("scrollH('"+idCalque+"',"+taille+",'"+classe+"')",200);
}

