/***********************************************
* Fading Ticker Tape Script- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

//default speed is 4.5 seconds, Change that as desired
var speed=4500


//expand or shorten this list of messages as desired

var first=true;
var hex=255;
var startcolor="rgb(255,255,255)";
var endcolor="rgb(0,0,0)";
var frame=15;

var ie=document.all;
var ns6=document.getElementById;
var ns4=document.layers;

var newsid=0;
var tickerobject;

function regenerate(){
	window.location.reload()
}
function regenerate2(){
	if (document.layers) setTimeout("window.onresize=regenerate",450)
}
function cms_js_debug(m) {
	e=gE('js_debug');
	e.innerHTML+='<br />'+m;
}
function updatecolorrec(e,c) {
	if (e.childNodes.length) {
		for (j=0; j<e.childNodes.length; j++) {
			if (e.childNodes[j].style) {
				e.childNodes[j].style.color="rgb("+c+","+c+","+c+")"; // Set color value.
				if (e.childNodes[j].tagName == 'A') {
					e.childNodes[j].onmouseover = function() {
						this.color="rgb(204,0,0)";
					}
				}
				updatecolorrec(e.childNodes[j],c);
			}
		}
	}	
}

function updatecolor(c) {
	updatecolorrec(tickerobject,c);
}

function bgcolorfade(direction) {	         	
	// 20 frames fading process
	if(frame>0) {	
		hex=(direction==1)? hex-17 : hex+17; // increase or decrease color value depd on fadescheme
		updatecolor(hex);
		frame--;
		setTimeout("bgcolorfade("+direction+")",100);	
	} else {
		//updatecolor(hex);
		frame=15;
		if (direction == 1) {
			hex=0;
			setTimeout("updatecontent()",speed);
		} else {
			hex=255;
			updatetext();
		}
	}
}

function updatetext() {
	if (ns4){
		tickerobject.news_ticker_sub.document.write('<span class="news_ticker_content">'+news[newsid++]+'</span>');
		tickerobject.news_ticker_sub.document.close();
	} else {
		tickerobject.innerHTML=news[newsid++];
	}
	if (newsid>=news.length) {
		newsid=0;
	}
	bgcolorfade(1);
}

function updatecontent(){
	tickerobject=(ie || ns6)?document.getElementById("news_ticker_sub"):document.news_ticker.document;
	if (first == true) {
		updatecolor(255);
		updatetext();
		first=false;
	} else {
		bgcolorfade(0);
	}
}

