var theCharacterTimeout = 25;
var theStoryTimeout     = 3000;
var theWidgetOne        = " |";
var theWidgetTwo        = " |";
var theWidgetNone       = "";
var theItemCount	
	
theItemCount = TickerCounter

// Ticker startup
function startTicker()
{
	
	// Define run time values
	theCurrentStory     = -1;
	theCurrentLength    = 0;
	// Locate base objects
	if (document.getElementById) {	
		    theAnchorObject     = document.getElementById("tickerAnchor");
			runTheTicker();   	
		 }
	else {
            document.write("<style>.tickerContent{display:none;}.ticko{border:0px; padding:0px;}</style>");
            return true;
	}
}
var myTimeout
// Ticker main run loop
function runTheTicker()
{
	// Go for the next story data block
	
	if(theCurrentLength == 0)
	{
		myTimeout = theCharacterTimeout;
		
		if (theCurrentStory!=theItemCount)
			theCurrentStory++;
		else
			theCurrentStory=0;
		
		theCurrentStory      = theCurrentStory % theItemCount;
		theStorySummary      = theSummaries[theCurrentStory].replace(/&quot;/g,'"');		
		theNewsID			 = theNewsIDs[theCurrentStory];
		
		
		if(theNewsID!="0" && theNewsID!="")
		{
		theTargetLink         = "news.php?news_id="+theNewsID;
		theAnchorObject.href  = theTargetLink;
		theAnchorObject.style.cursor = "hand";
		theAnchorObject.style.color = "#E4E4E4";
		theAnchorObject.target = "_top";
		}
		else
		{
		theAnchorObject.href = "#";
		theAnchorObject.style.cursor = "text";
		//theAnchorObject.style.color = "#FE3637";
		theAnchorObject.style.textDecoration = "none";
		theAnchorObject.target = "_self";
		}
				
	}
	
	// Stuff the current ticker text into the anchor
	theAnchorObject.innerHTML = theStorySummary.substring(0,theCurrentLength) + whatWidget();
	// Modify the length for the substring and define the timer
	if(theCurrentLength == theStorySummary.length)
	{
		myTimeout = theStoryTimeout;
		theCurrentLength = 0;
	}
	else
	{
		myTimeout = theCharacterTimeout;
		theCurrentLength++;
	}
	setTimeout("runTheTicker()", myTimeout);
}



// Widget generator
function whatWidget()
{
	if(theCurrentLength == theStorySummary.length)
	{
		return theWidgetNone;
	}

	if((theCurrentLength % 2) == 1)
	{
		return theWidgetOne;
	}
	else
	{
		return theWidgetTwo;
	}
}


startTicker();
	
//-->

