//  pour la démo
/*sHTML = "<TABLE CELLPADDING=0 CELLSPACING=2 BORDER=0 CLASS='MenuTable' bgcolor=black>"
  for (i=1; i<=10; i++){
    sHTML += "<TR bgcolor='white'><TD ID='MnuCell_" + i + "' onmouseover=\"gradient(0,'MnuCell_" + i + "')\" CLASS='MenuCell'><A HREF=\"#\">Page " + i + "</A></TD></TR>"
  }
sHTML += "</TABLE>"
document.write(sHTML)*/

var Colors = new Array()
Colors = InitColors("#94bfe5","#FFFFFF",30)
function gradient(i, id){
  if (i<Colors.length){document.getElementById(id).style.backgroundColor  = "#" + Colors[i]
  setTimeout("gradient("+(i+1)+",'"+id+"')",11)
  }
}
//  convertion decimal ver hexa
function Hexa(Dec){
  var nb = Dec.toString(16)
  if (nb.length < 2) {nb = "0" + nb}
  return(nb)
}
//  creation du tableau de couleurs
function InitColors(ColorStart, ColorEnd, Steps){
  //  si les couleurs viennent d'une propriété de style :
  Start = ColorStart.replace("#","")
  End = ColorEnd.replace("#","")
  
  var StartRed = parseInt(Start.substring(0, 2),16)
  var StartGreen = parseInt(Start.substring(2, 4),16)
  var StartBlue = parseInt(Start.substring(4, 6),16)
  var EndRed = parseInt(End.substring(0, 2),16)
  var EndGreen = parseInt(End.substring(2, 4),16)
  var EndBlue = parseInt(End.substring(4, 6),16)
  var Colors = new Array()
  cr=StartRed; cg=StartGreen; cb=StartBlue
  sr = (EndRed - StartRed)/Steps  // rouge
  sg = (EndGreen - StartGreen)/Steps  // vert
  sb = (EndBlue - StartBlue)/Steps  // bleu
  for (var x = 0; x <= Steps; x++) {
    Colors[x] = Hexa(Math.floor(cr)) + Hexa(Math.floor(cg)) + Hexa(Math.floor(cb))
    cr += sr; cg += sg; cb += sb
  }
  return(Colors)
}
