// Ticker startup function startTicker() { // Define run time values currentItem = -1; currentLength = 0; // Locate base objects if (document.getElementById) { anchorObject = document.getElementById("tickerAnchor"); runTicker(); } } // Ticker main run loop function runTicker() { var myTimeout; // Go for the next story data block if(currentLength == 0) { currentItem++; currentItem = currentItem % theItemCount; tickerText = arTickerText[currentItem].replace(/"/g,'"'); tickerLink = arItemLinks[currentItem]; anchorObject.href = tickerLink; // thePrefix = "News: "; } // Stuff the current ticker text into the anchor anchorObject.innerHTML = //thePrefix + tickerText.substring(0,currentLength) + getTickerCursor(); // Modify the length for the substring and define the timer if(currentLength != tickerText.length) { currentLength++; myTimeout = tickerCharTimeout; } else { currentLength = 0; myTimeout = tickerTimeout; } // Call up the next cycle of the ticker setTimeout("runTicker()", myTimeout); } function getTickerCursor() { if(currentLength == tickerText.length) { return ""; } if((currentLength % 2) == 1) { return "_"; } else { return "-"; } } var tickerCharTimeout = 50; var tickerTimeout = 5000; var arTickerText = new Array(); var arItemLinks = new Array(); var theItemCount = 4; arTickerText[0] = "Winter Deals @ Craigielaw Pro Shop"; arItemLinks[0] = "webpages/news_item.php?id=33"; arTickerText[1] = "Pro Shop NEW ARRIVALS"; arItemLinks[1] = "webpages/news_item.php?id=34"; arTickerText[2] = "Annual Club Dinner & Prizegiving"; arItemLinks[2] = "webpages/news_item.php?id=30"; arTickerText[3] = "Fixture List 2009"; arItemLinks[3] = "webpages/news_item.php?id=29"; startTicker();