var texts = new Array(
"<font color='{COLOR}' face='Arial Narrow' size='5'>Bunker services in over 2500 ports, across 145 countries</font>",
"<font color='{COLOR}' face='Arial Narrow' size='5'>Complete global coverage and greater customer choice</font>",
"<font color='{COLOR}' face='Arial Narrow' size='5'>First class service, 24 hours a day, 365 days a year</font>",
"<font color='{COLOR}' face='Arial Narrow' size='5'>Ensuring continuous service through expert in-house support</font>",
"<font color='{COLOR}' face='Arial Narrow' size='5'>Genuinely worldwide in over 2,500 ports</font>",
"<font color='{COLOR}' face='Arial Narrow' size='5'>Financial strength and international status</font>"
);

var bgcolor = "#FFFFFF";
var fcolor = "#000000";
var steps = 40;
var show = 500;
var sleep = 30;
var loop = true;

var colors = new Array(steps);
getFadeColors(bgcolor,fcolor,colors);
var color = 0;
var text = 0;
var step = 1;

function fade()
{
var text_out = texts[text].replace("{COLOR}", colors[color]);
document.getElementById('fader').innerHTML = text_out;
color += step;

if (color >= colors.length-1)
{
step = -1;
if (!loop && text >= texts.length-1) return;
}


if (color == 0)
{
step = 1;
text += 1;
if (text == texts.length) text = 0;
}

setTimeout("fade()", (color == colors.length-2 && step == -1) ? show : ((color == 1 && step == 1) ? sleep : 50));
}

function getFadeColors(ColorA, ColorB, Colors)
{
len = Colors.length;

if (ColorA.charAt(0)=='#') ColorA = ColorA.substring(1);
if (ColorB.charAt(0)=='#') ColorB = ColorB.substring(1);

var r = HexToInt(ColorA.substring(0,2));
var g = HexToInt(ColorA.substring(2,4));
var b = HexToInt(ColorA.substring(4,6));
var r2 = HexToInt(ColorB.substring(0,2));
var g2 = HexToInt(ColorB.substring(2,4));
var b2 = HexToInt(ColorB.substring(4,6));
var rStep = Math.round((r2 - r) / len);
var gStep = Math.round((g2 - g) / len);
var bStep = Math.round((b2 - b) / len);

for (i = 0; i < len-1; i++)
{
Colors[i] = "#" + IntToHex(r) + IntToHex(g) + IntToHex(b);
r += rStep;
g += gStep;
b += bStep;
}
Colors[len-1] = ColorB;
}

function IntToHex(n)
{
var result = n.toString(16);
if (result.length==1) result = "0"+result;
return result;
}

function HexToInt(hex)
{
return parseInt(hex, 16);
}
