<script type="text/javascript">
var ti=0, colorincrement=6;
var titlecolor=['#ff0000', '#0000bb', '#ff8833', '#000000', '#00aa00'];
function fadeto(divid, colorto)
{
var onediv = document.getElementById(divid);
var colorfrom = onediv.style.color;
if (colorfrom.length==0) colorfrom ='#000000';
if (colorfrom.substr(0, 3) == 'rgb') {
colorfrom = colorfrom.replace(/rgb\(/g, "").replace(/\)/g, "");
hexvalue = false;
}
else {
colorfrom = colorfrom.substr(1);
hexvalue = true;
}
var redfrom = (hexvalue) ? eval('0x' + colorfrom.substr(0,2)) : parseInt(colorfrom.split(",")[0], 10);
var greenfrom = (hexvalue) ? eval('0x' + colorfrom.substr(2,2)) : parseInt(colorfrom.split(",")[1], 10);
var bluefrom = (hexvalue) ? eval('0x' + colorfrom.substr(4,2)) : parseInt(colorfrom.split(",")[2], 10);
if (colorto.indexOf('#') == 0) {
colorto=colorto.substr(1);
hexvalue = true;
}
else if (colorto.substr(0, 3) == 'rgb') {
colorto = colorto.replace(/rgb\(/g, "").replace(/\)/g, "");
hexvalue = false;
}
else {
hexvalue = true;
}
var redto = (hexvalue) ? eval('0x' + colorto.substr(0,2)) : parseInt(colorfrom.split(",")[0], 10);
var greento = (hexvalue) ? eval('0x' + colorto.substr(2,2)) : parseInt(colorfrom.split(",")[1], 10);
var blueto = (hexvalue) ? eval('0x' + colorto.substr(4,2)) : parseInt(colorfrom.split(",")[2], 10);
var reddirection = 1;
var greendirection = 1;
var bluedirection = 1;
if (redto < redfrom) reddirection = -1;
if (greento < greenfrom) greendirection = -1;
if (blueto < bluefrom) bluedirection = -1;
if (Math.abs(redto - redfrom) < colorincrement)
{redfrom=redto;}
else
{redfrom += reddirection * colorincrement;}
if (Math.abs(greento - greenfrom) < colorincrement)
{greenfrom=greento;}
else
{greenfrom += greendirection * colorincrement;}
if (Math.abs(blueto - bluefrom) < colorincrement)
{bluefrom=blueto;}
else
{bluefrom += bluedirection * colorincrement;}
var newcolor = rgb(redfrom, greenfrom, bluefrom);
onediv.style.color = newcolor;
//if (onediv.style.color.indexOf('#') == -1)
{
// alert(newcolor);
// alert(onediv.style.color);
}
var timeout = 50;
if (redfrom == redto && (greenfrom==greento && bluefrom == blueto))
{
ti++;
ti %= titlecolor.length;
colorto=titlecolor[ti];
timeout=1000;
}
setTimeout('fadeto("' + divid + '", "' + colorto + '")', timeout);
}
function rgb(red, green, blue)
{
var rgbcolor='';
var hexdigit='0123456789abcdef';
rgbcolor += hexdigit.charAt(Math.floor(red / 16));
rgbcolor += hexdigit.charAt(red % 16);
rgbcolor += hexdigit.charAt(Math.floor(green / 16));
rgbcolor += hexdigit.charAt(green % 16);
rgbcolor += hexdigit.charAt(Math.floor(blue / 16));
rgbcolor += hexdigit.charAt(blue % 16);
return rgbcolor;
}
setTimeout('fadeto("bigskytitle", "' + titlecolor[0] + '")', 3000);
</script>
<div id="bigskytitle">BIG SKY</div>