// JavaScript Document

// ticker setup
var charDelay = 50;
var storyDelay = 5000;
var numStories = 4;
// two dimensional array to hold stories and links



function InitTicker()
{
// Default values
currentStory = -1;
currentLength = 0;
//The top stories anchor tag
oAnchor = document.getElementById("tickerHREF");
NewsTicker();
}

window.onload = InitTicker;

function NewsTicker()
{
var delay;
// Get next story if title is done from previous
if(currentLength == 0) // length of title being written out
{
currentStory++;
currentStory = currentStory % numStories;
// use HTML entity for quotes so we don't mess up the anchor
currentTitle = storyMatrix[0][currentStory].replace(/&quot;/g,'"');
oAnchor.href = storyMatrix[1][currentStory];
}
// Write title to anchor
oAnchor.innerHTML = currentTitle.substring(0, currentLength);
// adjust length of substring and set delays
if(currentLength != currentTitle.length)
{
currentLength++;
delay = charDelay;
}
else
{
currentLength = 0;
delay = storyDelay;
}
// Recurse ticker
setTimeout("NewsTicker()", delay);
}
