//--- JavaScript Document
var theTickerText = new Array();
var theTickerLinks = new Array();

theTickerText[0] = "UBI ACE WINS THE LISTED HURDLE AT SANDOWN UNDER A GREAT RIDE FROM ROBERT WALFORD"
theTickerText[1]  = "Ubi Ace proves himself winning the Tote Scoop 6 hurdle race at Wetherby  "
//theTickerLinks[0] = "http://horses.sportinglife.com" ;



theTickerText[2] ="Medieval Bishop and yearlings by Motivator, Mujadil and Avonbridge join the team "
//theTickerLinks[1] ="http://horses.sportinglife.com"

theTickerText[3]  ="Chadford wins his 2nd hurdle race under a penalty in the colours of Chasing Gold "
theTickerText[4] ="Follow us on Twitter" 


theTickerText[5] ="What a week wins for Chadford, Ubi Ace, Granwood, and Fentara" 
//theTickerLinks[3] = "http://horses.sportinglife.com ";


//theTickerLinks[4] ="http://horses.sportinglife.com" 

var Inc = new Number(0);      // used to itterate through array
var theCharacterTimeout = 40; //pause tween chars
var theStoryTimeout = 3000;   //pause at end of line
var theEnumerator = 0;        //used to iterate through the individual strings


// --- Run the ticker
function start()
{
doTheTicker();
}



function doTheTicker()
{
if(Inc > (theTickerText.length - 1)){Inc=0;}

   if((theEnumerator % 2) == 1)
   {
      writeTicker("|",Inc);
   }
   else
   {
      writeTicker("|",Inc);
   }

   theEnumerator++;
	
   if(theEnumerator == theTickerText[(Inc)].length+1)
   {
      writeTicker("",Inc);
      theEnumerator = 0;
      Inc++;
      setTimeout('doTheTicker()', theStoryTimeout); 
          
   }
   else
   {
      setTimeout('doTheTicker((Inc))', theCharacterTimeout);
   }
}

function writeTicker(aWidget,vn)
{
   
   var hrefstr = new String();
   var endhrefstr = new String();
   
   hrefstr = "<a href=' " + theTickerLinks[vn] + " ' >";
   endhrefstr = "</a>";
   document.getElementById("hottext").innerHTML = hrefstr + theTickerText[vn].substring(0,theEnumerator) + aWidget + endhrefstr;
}

