
// --- Global variable stuff here
       var theItemCount;
       var theCurrentStory;
       var theCurrentLength;
       var theStorySummary;
       var theTargetLink;
       var theCharacterTimeout;
       var theStoryTimeout;
       var theBrowserVersion;
       var theWidgetOne;
       var theWidgetTwo;
       var theSpaceFiller;
       var theLeadString;
       var theStoryState;

	var objIncoming
	
	

// --- Check for old browser and force applet
       theBrowserVersion = parseInt(navigator.appVersion);

   



// --- Only run for V4 browsers (check browser again here - some old browsers won't do this inline)
       function startTicker()
       {
	   
		theBrowserVersion = parseInt(navigator.appVersion);
		//alert(document.body.children.incoming);		
		objIncoming=document.getElementById('incoming');		

// ------ Check and fixup incoming data block
         
		
         



// ------ Set up initial values
          theCharacterTimeout =   60;
          theStoryTimeout     = 10000;
          theWidgetOne        =  "_";
          theWidgetTwo        =  "-";



// ------ Set up initial values
          theStoryState       = 1;
          theItemCount        = objIncoming.children.properties.children.itemcount.innerText;
          theCurrentStory     = -1;
          theCurrentLength    = 0;
          theLeadString       = "";
          //theSpaceFiller      = " &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<BR><BR><BR>";
          theSpaceFiller      = "";

// ------ Begin the ticker       
          runTheTicker();
       }



// --- The basic rotate function
       function runTheTicker()
       {
          if(theStoryState == 1)
          {
		try {
			setupNextStory();
		} catch(e) {
		}
          }

          if(theCurrentLength != theStorySummary.length)
          {
             drawStory();
          }
          else
          {
             closeOutStory();
          }
       }



// --- Index to next story
       function setupNextStory()
       {
       
		//objIncoming=document.getElementById('incoming');
		theStoryState = 0;
		
		theCurrentStory++;
		
		theCurrentStory = theCurrentStory % theItemCount;
		
		theStorySummary = objIncoming.children.stories.children[theCurrentStory].children.Summary.innerText;
		
		theTargetLink   = objIncoming.children.stories.children[theCurrentStory].children.SiteLink.innerText;
		
		if(theTargetLink == "")
		{
			theTargetLink = objIncoming.children.stories.children[theCurrentStory].children.UrlLink.innerText;
		}
		
		theCurrentLength = 0;
		
		document.all.hottext.href = theTargetLink;
       }



// --- Draw a teletype line
       function drawStory()
       {
          var myWidget;
          
          if((theCurrentLength % 2) == 1)
          {
             myWidget = theWidgetOne;
          }
          else
          {
             myWidget = theWidgetTwo;
          }
          document.all.hottext.innerHTML = theLeadString + theStorySummary.substring(0,theCurrentLength) + myWidget + theSpaceFiller;
          theCurrentLength++;
          setTimeout("runTheTicker()", theCharacterTimeout);
       }



// --- Finalise the item
       function closeOutStory()
       {
          document.all.hottext.innerHTML = theLeadString + theStorySummary + theSpaceFiller;
          theStoryState = 1;
          setTimeout("runTheTicker()", theStoryTimeout);
       }

