// 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 = 5; arTickerText[0] = "Course Update 2012"; arItemLinks[0] = "webpages/news_item.php?id=76"; arTickerText[1] = "Course Open 10th December"; arItemLinks[1] = "webpages/news_item.php?id=75"; arTickerText[2] = "2011 Captains Report"; arItemLinks[2] = "webpages/news_item.php?id=74"; arTickerText[3] = "Ladies lunch Golf and clinic on the 26th November"; arItemLinks[3] = "webpages/news_item.php?id=73"; arTickerText[4] = "AGM of Members Liaison Committee"; arItemLinks[4] = "webpages/news_item.php?id=72"; startTicker();