function HeT2Str(het)
{
if (het==0)
   {str = "0"};
if (het==1)
   {str = "1"};
if (het==2)
   {str = "2"};
if (het==3)
   {str = "3"};
if (het==4)
   {str = "4"};
if (het==5)
   {str = "5"};
if (het==6)
   {str = "6"};
if (het==7)
   {str = "7"};
if (het==8)
   {str = "8"};
if (het==9)
   {str = "9"};
if (het==10)
   {str = "A"};
if (het==11)
   {str = "B"};
if (het==12)
   {str = "C"};
if (het==13)
   {str = "D"};
if (het==14)
   {str = "E"};
if (het==15)
   {str = "F"};

return (str);
}


function HN2Bx(num)
{
return (num % 0x100);
}


function HN2Gx(num)
{
return (((num - (num % 0x100)) / 0x100) % 0x100);
}


function HN2Rx(num)
{
return ((num - (num % 0x10000)) / 0x10000);
}


function Xx2HiS(Xx)
{
Xl = Xx % 0x10;
Xh = (Xx - Xl) / 0x10;
return (HeT2Str(Xh)+HeT2Str(Xl));
} 


function BarevRet(ret, BarOd, BarDo)
{
del=ret.length;
/*del = del + (16 - (del % 16)); //Nutné, jinak blbnou barvy!*/
Rx = HN2Rx(BarOd);
Rk = (HN2Rx(BarDo) - Rx) / del;
Gx = HN2Gx(BarOd);
Gk = (HN2Gx(BarDo) - Gx) / del;
Bx = HN2Bx(BarOd);
Bk = (HN2Bx(BarDo) - Bx) / del;

for (i=0; i<del;i=i+1)
    {
    p=ret.substr(i,1);
    document.write(p.fontcolor(Xx2HiS(Math.round(Rx))+Xx2HiS(Math.round(Gx))+Xx2HiS(Math.round(Bx))) /*+Xx2HiS(Rx)+Xx2HiS(Gx)+Xx2HiS(Bx)*/);
    Rx = Rx + Rk;
    Gx = Gx + Gk;
    Bx = Bx + Bk;
    };
}