/* DATE DE CREATION: 28-09-2000 */

function makearray(n) {
  this.length = n;
  for(var i = 1; i <= n; i++)
    this[i] = 0;
  return this;
}

hexa = new makearray(16);
function fade(sr, sg, sb, er, eg, eb, step) {
  for(var i = 0; i < 10; i++)
    hexa[i] = i;
  hexa[10]="a"; hexa[11]="b"; hexa[12]="c";
  hexa[13]="d"; hexa[14]="e"; hexa[15]="f";
  for(var i = 0; i <= step; i++) {
    setbgColor(
    Math.floor(sr * ((step-i)/step) + er * (i/step)),
    Math.floor(sg * ((step-i)/step) + eg * (i/step)),
    Math.floor(sb * ((step-i)/step) + eb * (i/step)));
  }
}

function hex(i) {
  if (i < 0)
    return "00";
  else if (i > 255)
    return "ff";
  else return "" + hexa[Math.floor(i/16)] + hexa[i%16];
}

function setbgColor(r, g, b) {
  var hr = hex(r), hg = hex(g), hb = hex(b);
  document.bgColor = "#"+hr+hg+hb;
}

function tableau (n) {
  var nb;
  this.length = n;
  for (var i = 1; i <=n; i++)
    if (i<10) {
      nb = i+"";
      nb = nb.substring(0,1);   	
      this[i] = nb;
    }
  return this;
}

function conversion(couleur) {
  var hexa1;
  var hexa2;
  var couleurHexa;
  tabHex = new tableau(16);
  tabHex[10]="A"; tabHex[11]="B"; tabHex[12]="C"; tabHex[13]="D"; 			tabHex[14]="E"; tabHex[15]="F";
  indice = 1;
  hexa2 = (couleur%16);
  hexa1 = parseInt(couleur/16);
  hexa2 = tabHex[hexa2];
  if (hexa2 == null)
    hexa2 = "0";
  hexa1 = tabHex[hexa1];
  if (hexa1 == null)
    hexa1 = "0";
  couleurHexa = hexa1 + hexa2;
  return couleurHexa;
}

function degrade(texte, taille, police, RGB) {
  var facteur = 256/(texte.length+1);
  var i;
  var c1,c2,c3;

  for (i=0;i<texte.length;i++)   {
    ton=facteur*i;
    if (RGB == 0) {
      c1 = 'FF'
      c2 = conversion(ton);
      c3 = c2;
    }
    else if (RGB == 1) {
      c1 = conversion(ton);
      c2 = 'FF'
      c3 = c1;
    }
    else {
      c1 = conversion(ton);
      c2 = c1;
      c3 = 'FF'
    }
   document.write ('<FONT SIZE=' + taille + ' FACE="' + police + '" COLOR="#' + c1 + c2 + c3 + '">' + texte.substring (i,i+1) + '</FONT>');
  } 
}

function netie(net, ie) {
  if ((navigator.appVersion.substring(0,3) >= net && navigator.appName == 'Netscape' && net != -1) || (navigator.appVersion.substring(0,3) >= ie && navigator.appName.substring(0,9) == 'Microsoft' && ie != -1))
    return true;
  else return false;
}

function loadImage()  {
  imageEffect.filters.item(0).Apply();
  imageEffect.style.visibility = "visible";
  imageEffect.filters.item(0).Play();
}
