var currentFrame;
var currentR;
var currentG;
var currentB;
var fadeR = (endR - startR) / frames;
var fadeG = (endG - startG) / frames;
var fadeB = (endB - startB) / frames;

var ie = document.all;
var ns6 = document.getElementById;
var ns4 = document.layers;

var i = 0;
var tickerobject = ie? subtickertape: ns6? document.getElementById("subtickertape") : document.tickertape.document;

function regenerate(){
	if (document.layers)
		setTimeout("window.onresize=regenerate",450)
}

function bgcolorfade() {
	if(currentFrame>0) {
		//adjust color by the fade amount
		var newR = currentR + fadeR;
		var newG = currentG + fadeG;
		var newB = currentB + fadeB;

		//update background color		
		tickerobject.style.backgroundColor="rgb(" + Math.round(newR) + "," + Math.round(newG) + "," + Math.round(newB) + ")";

		currentR = newR;
		currentG = newG;
		currentB = newB;
		currentFrame--;
		setTimeout("bgcolorfade()",transitionSpeed);	
	} else {
		tickerobject.style.backgroundColor="rgb(" + endR + "," + endG + "," + endB + ")";
		currentFrame = frames;
	}   
}

function updateContent(){
	if (ie||ns6)
		currentR = startR;
		currentG = startG;
		currentB = startB;
		currentFrame = frames;
		bgcolorfade();
	if (ns4){
		tickerobject.subtickertape.document.write('<span class="subtickertapefont">'+news[i]+'</span>');
		tickerobject.subtickertape.document.close();
	} else 
		tickerobject.innerHTML=news[i];

	if (i<news.length-1)
		i++;
	else
		i=0;
	setTimeout("updateContent()",slideSpeed);
}

