var NS6=(document.getElementById && !document.all) ? true : false;
var tickerNewsDiv; 
var timerID1,timerID2;
var theCurrentStory = -1;
var theItemCount = theSummaries.length;
var theStorySummary, theTargetLink;
var text1,text2,text3;
var textTicker,posTextTicker;
if (document.all) 
	isIE = true;
else
	isIE = false;

function startTicker(){
	if (NS6)
		tickerNewsDiv = document.getElementById("theTicker");
	else 
		tickerNewsDiv = document.all.theTicker;
	runTheTicker();
}	

function applyDivText(value){
	if(value==1){
		tickerNewsDiv.innerHTML = text1;
		timerID2 = setTimeout("applyDivText(2)", 20);
	}else if(value==2){
		tickerNewsDiv.innerHTML = text2;
	}
}
function tickerAddChars(){
	if(posTextTicker >= theStorySummary.length){
		setTimeout("applyDivText(2);", 20);
		setTimeout("runTheTicker()", 4000);
	}else{
		//clearTimeout(timerID1);
		//clearTimeout(timerID2);
		text1 = '<a href="'+ theTargetLink +'" id="newsscroll">'+textTicker+'_</a>';
		if(isIE){
			textTicker += theStorySummary.charAt(posTextTicker);
			posTextTicker++;
			textTicker += theStorySummary.charAt(posTextTicker);
			posTextTicker++;			
		}
		textTicker += theStorySummary.charAt(posTextTicker);
		text2 = '<a href="'+ theTargetLink +'" id="newsscroll">'+textTicker+'</a>';
		
		posTextTicker++;
		setTimeout("applyDivText(1);", 20);
		
		setTimeout("tickerAddChars()", 60);
		
	}	
}
function runTheTicker(){
	theCurrentStory++;
	theCurrentStory      = theCurrentStory % theItemCount;
	theStorySummary      = theSummaries[theCurrentStory];
	theTargetLink        = theSiteLinks[theCurrentStory];
	posTextTicker = 0;
	textTicker = '';
	tickerAddChars();
}

setTimeout("startTicker();", 3000);
