
/*
	newsTicker v.1.0
	
	Written by Design Technologist
		- Seth Van Booven [svanbooven@sacbee.com]
		
	Copyright © The Sacramento Bee
	Created by the New Media Department
	Created: September 01, 2001 (sv)  /  Last update: 03/11/02 (sv)

	PC-Tested for 
		- Internet Explorer 4.0, 5.0, 5.5, 6.01b
		- Netscape 4.08, 4.61, 4.7, 6.01
	Mac-Tested for
		- Internet Explorer 5.0, 5.1b
		- Netscape 4.5, 4.73, 6.01
		
	****************************************************
		IF YOU DON'T KNOW WHAT YOU ARE DOING
		THEN YOU DON'T BELONG HERE.
		.........................CLOSE IMMEDIATELY!
	****************************************************
------------------------------------------------------------*/

var ticker   = 0;      // used to init the Ticker - in combination with scripts.js
var fDelay   = 0;
var inx      = 0;
var num      = 20;     // 20 nums fading process
var hex      = myHex;  // Initial color value.

var swTemp   = self.innerWidth * .5;
var ttLeft   = swTemp - 370;

var beginTxt = '<span class="f9B">';
var endTxt   = '</span>';

var tickerSkin = null;

if (ieX || ie4 || ns6) document.write('<div id="tick" style="text-align:' + tAlign + ';"></div>');
if (ns4) document.write('&nbsp;<span id="tick"></span>');

function initTick() 
{
	tickerSkin = (ieX || ns6) ? document.getElementById('tick') 
		: (ie4) ? document.all('tick') 
		: (ns4) ? document.tick 
		: null;
};

if (ns4 && tAlign == 'right') document.write(beginTxt + feed[inx] + endTxt);

function fade() 
{
	if(num > 0) 
	{
		hex -= 12;
		if (ieX || ie4 || ns6) tickerSkin.style.color = 'rgb(' + hex + ', ' + hex + ', ' + hex + ')';
		num--;
		setTimeout('fade()', 20);
	}
	else 
	{
		if (ieX || ie4 || ns6) tickerSkin.style.color = 'rgb(0, 0, 0)';
		num = 20;
		hex = 204;
	}
};

function changecontent()
{
	initTick();
	if (tickerSkin) 
	{
		if (inx >= feed.length) inx = 0;
		if (ieX || ie4 || ns6)
		{
			tickerSkin.style.color = 'rgb(' + hex + ', ' + hex + ', ' + hex + ')';
			tickerSkin.innerHTML   = feed[inx];
			fDelay = 2000;
			fade();
		}
		if (ns4 && tAlign != 'right')
		{
			tickerSkin.left = ttLeft;
			tickerSkin.document.open();
			tickerSkin.document.write(beginTxt + feed[inx] + endTxt);
			tickerSkin.document.close();
		}
		inx++;
		setTimeout('changecontent()', 4000 + fDelay);		
	}
};
