function ByteToHex(Bte) 
{
  var hexa1;
  var hexa2;
  var Hexa;
  tabHex= new Array(16);
  
  tabHex[0]="0"; tabHex[1]="1"; tabHex[2]="2"; tabHex[3]="3"; tabHex[4]="4";
  tabHex[5]="5"; tabHex[6]="6"; tabHex[7]="7"; tabHex[8]="8"; tabHex[9]="9";
  tabHex[10]="A"; tabHex[11]="B"; tabHex[12]="C"; tabHex[13]="D"; tabHex[14]="E"; tabHex[15]="F";

  Bte= parseInt(Bte);

  hexa1 = parseInt(Bte/16);
  hexa1 = tabHex[hexa1];
  if (hexa1 == null)
    hexa1 = "0";
  hexa2 = (Bte%16);
  hexa2 = tabHex[hexa2];
  if (hexa2 == null)
    hexa2 = "0";
	
  Hexa = hexa1 + hexa2;
  return Hexa;
}

function GetFadeColor(R1, G1, B1, R2, G2, B2, r)
{
  cR = ByteToHex((R2-R1)*r+R1);
  cG = ByteToHex((G2-G1)*r+G1);
  cB = ByteToHex((B2-B1)*r+B1);
  return "#"+cR+cG+cB;  
}

function TextColorShade(text, R1, G1, B1, R2, G2, B2) 
{
  var i;
  var cR,cG,cB;

  for (i=0;i<text.length;i++)   
  {
    cR = ByteToHex((R2-R1)*i/(text.length-1)+R1);
    cG = ByteToHex((G2-G1)*i/(text.length-1)+G1);
    cB = ByteToHex((B2-B1)*i/(text.length-1)+B1);
    document.write('<FONT COLOR="#'+cR + cG + cB + '">');

    if (text.substr(i,1)== '&') 
    {
      document.write('&');
      do
      { 
        i++;
        document.write(text.substr(i,1));
      }
      while (text.substr(i,1)!= ';');
    }
    else
      document.write(text.substr(i,1));
    document.write('</FONT>');
  } 
}

