var text = new Array();
var color = new Array();
color[0] = 'FFFFFF';
color[1] = 'CCCCCC';
color[2] = '999999';
color[3] = '666666';
color[4] = '333333';
color[5] = '000000';

var duration = 2;
var elementid = 'scroller';
var duration = duration * 1000;
var fadeStage = 0;
var fade = 'up';
var msg = 0;

function addText(txt){
text.push(txt);
}

function fadeText(){
if(fade=='up')
fadeStage++;
else
fadeStage--;
setStyle('color', color[fadeStage]);
if(fadeStage==(color.length-1)){
fade = 'down';
clearInterval(f);
t = setTimeout('startFade()', duration);
}
else if(fadeStage==0){
fade = 'up';
setText();
}
}


function startFade(){
f = setInterval('fadeText()', 100);
}


function setStyle(p, val){
if(document.getElementById)
eval("parent.document.getElementById('scroller').style."+p+"='#"+val+"'");
else 
eval("parent.document.getElementById('scroller')."+p+"='#"+val+"'");
}

function setText(){
parent.document.getElementById('scroller').innerHTML = text[msg];
if((text.length-1)==msg)
msg=0;
else
msg++;

}
var f,t;
function start(){
setText();
startFade();
}
