// JavaScript Document
// 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>.ticki{display:none;}.ticko{border:0px; padding:0px;}</style>");
            return true;
	}
}
// Ticker main run loop
function runTheTicker()
{
	var myTimeout;  
	// Go for the next story data block
	if(theCurrentLength == 0)
	{
		theCurrentStory++;
		theCurrentStory      = theCurrentStory % theItemCount;
		
		//theStorySummary      = theSummaries[theCurrentStory].replace(/é/g ,'&eacute;');	
		//alert(theSummaries[theCurrentStory].indexOf("é"));
		
		theStorySummary      = theSummaries[theCurrentStory].replace(/&quot;/g,'"');	
		
			
		theTargetLink        = theSiteLinks[theCurrentStory];
		theAnchorObject.href = theTargetLink;
		thePrefix 	     = "<span class=\"tickls\">" + theLeadString + "</span>";
	}
	// Stuff the current ticker text into the anchor
	theAnchorObject.innerHTML = thePrefix + theStorySummary.substring(0,theCurrentLength) + whatWidget();
	// Modify the length for the substring and define the timer
	if(theCurrentLength != theStorySummary.length)
	{
		theCurrentLength++;
		myTimeout = theCharacterTimeout;
		/*if(theCurrentLength!=0)
		{
			var string = theStorySummary.substring(0,theCurrentLength+1)
			var character = theStorySummary.charCodeAt(theCurrentLength);
			alert(string + " |||character: "+character);
		}*/
		
	}
	else
	{
		theCurrentLength = 0;
		myTimeout = theStoryTimeout;
	}
	// Call up the next cycle of the ticker
	setTimeout("runTheTicker()", myTimeout);
}
// Widget generator
function whatWidget()
{
	if(theCurrentLength == theStorySummary.length)
	{
		return theWidgetNone;
	}

	if((theCurrentLength % 2) == 1)
	{
		return theWidgetOne;
	}
	else
	{
		return theWidgetTwo;
	}
}



// JavaScript Document
// Ticker startup
function startTicker2()
{

	// Define run time values
	theCurrentStory2     = -1;
	theCurrentLength2    = 0;
	// Locate base objects
	if (document.getElementById) {	
		    theAnchorObject2     = document.getElementById("tickerAnchor2");
			runTheTicker2();   	
		 }
	else {
            document.write("<style>.ticki{display:none;}.ticko{border:0px; padding:0px;}</style>");
            return true;
	}
}
// Ticker main run loop
function runTheTicker2()
{
	var myTimeout2;  
	// Go for the next story data block
	if(theCurrentLength2 == 0)
	{
		theCurrentStory2++;
		theCurrentStory2      = theCurrentStory2 % theItemCount2;
		
		//theStorySummary      = theSummaries[theCurrentStory].replace(/é/g ,'&eacute;');	
		//alert(theSummaries[theCurrentStory].indexOf("é"));
		
		theStorySummary2      = theSummaries2[theCurrentStory2].replace(/&quot;/g,'"');	
		
			
		theTargetLink2        = theSiteLinks2[theCurrentStory2];
		theAnchorObject2.href = theTargetLink2;
		thePrefix 	     = "<span class=\"tickls\">" + theLeadString2 + "</span>";
	}
	// Stuff the current ticker text into the anchor
	theAnchorObject2.innerHTML = thePrefix + theStorySummary2.substring(0,theCurrentLength2) + whatWidget2();
	// Modify the length for the substring and define the timer
	if(theCurrentLength2 != theStorySummary2.length)
	{
		theCurrentLength2++;
		myTimeout2 = theCharacterTimeout2;
		/*if(theCurrentLength2!=0)
		{
			var string = theStorySummary.substring(0,theCurrentLength2+1)
			var character = theStorySummary.charCodeAt(theCurrentLength2);
			alert(string + " |||character: "+character);
		}*/
		
	}
	else
	{
		theCurrentLength2 = 0;
		myTimeout2 = theStoryTimeout2;
	}
	// Call up the next cycle of the ticker
	setTimeout("runTheTicker2()", myTimeout2);
}
// Widget generator
function whatWidget2()
{
	if(theCurrentLength2 == theStorySummary2.length)
	{
		return theWidgetNone2;
	}

	if((theCurrentLength2 % 2) == 1)
	{
		return theWidgetOne2;
	}
	else
	{
		return theWidgetTwo2;
	}
}