﻿
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 theBrowserAgent;
var isIE;

theBrowserAgent = navigator.userAgent.toLowerCase();
theBrowserVersion = parseInt(navigator.appVersion);
isIE =  ((theBrowserAgent.indexOf("msie") != -1) && (theBrowserAgent.indexOf("opera") == -1));

function startTicker()
{
theBrowserAgent = navigator.userAgent.toLowerCase();
theBrowserVersion = parseInt(navigator.appVersion);
isIE =  ((theBrowserAgent.indexOf("msie") != -1) && (theBrowserAgent.indexOf("opera") == -1));
if (theBrowserVersion < 4 || ! isIE)
          {
             
             return;
          }

          theCharacterTimeout = 60;
          theStoryTimeout     = 3000;
          theWidgetOne        =  "_";
          theWidgetTwo        =  "-";
          theStoryState       = 1;
          theItemCount        = 4;
          theCurrentStory     = -1;
          theCurrentLength    = 0;
          theLeadString       = "&nbsp;";
          theSpaceFiller      = "";
          runTheTicker();
       }
	   setArray();
       function runTheTicker()
       {
          if(theStoryState == 1)
          {
             setupNextStory();
          }

          if(theCurrentLength != theStorySummary.length)
          {
             drawStory();
          }
          else
          {
             closeOutStory();
          }
       }
       function setupNextStory()
       {
          nArray=new Array(2);
		  
		  theStoryState = 0;

          theCurrentStory++;
		  
		  theCurrentStory = theCurrentStory % theItemCount;
		  
		  nArray=textArray[theCurrentStory].split("|");
          
          theStorySummary = nArray[0];

          theTargetLink   = nArray[1];

          if(theTargetLink == "")
          {
             theTargetLink = document.body.children.incoming.children.stories.children[theCurrentStory].children.UrlLink.innerText;
          }
		  
		  if(theTargetLink == "/default.stm") {
		  	theTargetLink = top.location;
		  }

          theCurrentLength = 0;

          document.all.hottext.href = theTargetLink;
       }
       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);
       }
       function closeOutStory()
       {
          document.all.hottext.innerHTML = theLeadString + theStorySummary + theSpaceFiller;
          theStoryState = 1;
          setTimeout("runTheTicker()", theStoryTimeout);
       }
startTicker();