var intCharacterTimeout = 30;
var intTickerTimeout     = 4000;
var objAnchor, strOldText;
var intEndCharacter = 0;
var strTickerText = ""
var aryEndCharacters = new Array(" ", "_", "-");
var aryTickerText = new Array(); var aryTickerLink = new Array(); var aryTickerTooltip = new Array();

addTicker("Need an upgrade? We offer a comprehensive service to suit your needs...", "services.asp?section=upgrades", "Upgrades");
addTicker("PC broken down? We will collect, repair and redeliver. No fix, no fee.", "services.asp?section=repairs", "Repairs");
addTicker("Prevent data-loss. Get peace of mind with our full backup/restore service...", "services.asp?section=backup", "Backup");
addTicker("Lost your data? Try our data-recovery service for hard drives and digital cameras...", "services.asp?section=recovery", "Data Recovery");

function addTicker(strTicker, strLink, strTooltip)
{
	aryTickerText[aryTickerText.length] = strTicker;
	aryTickerLink[aryTickerLink.length] = strLink;
	aryTickerTooltip[aryTickerTooltip.length] = strTooltip;
}

function startTicker()
{
	
	intCurrentTicker    = Math.round(Math.random() * aryTickerText.length);

	intCurrentLength    = 0;

	if (document.getElementById) 
	{	
		objAnchor		= document.getElementById("tickerAnchor");
		runTheTicker();   	
	}
}

function runTheTicker()
{
	var intTimeout, strEndCharacter, strChar;
	// Go for the next story data block
	if(intCurrentLength == 0)
	{
		intCurrentTicker	= (++intCurrentTicker) % aryTickerText.length;
		strOldText			= strTickerText;
		strTickerText		= aryTickerText[intCurrentTicker].replace(/&quot;/g,'"');
		objAnchor.href		= aryTickerLink[intCurrentTicker];
		objAnchor.title		= aryTickerTooltip[intCurrentTicker];
	}

	// Get the ticker last character
	if(intCurrentLength >= strTickerText.length)
	{
		strEndCharacter = aryEndCharacters[0];
	}
	else
	{
		strEndCharacter = aryEndCharacters[(++intEndCharacter % 2)+1];
	}
	
	// Stuff the current ticker text into the anchor
	objAnchor.innerHTML = strTickerText.substring(0,intCurrentLength) + strEndCharacter;
	
	
	// Modify the length for the substring and define the timer
	if(intCurrentLength < strTickerText.length)
	{
		intCurrentLength++;
		intTimeout = intCharacterTimeout;
	}
	else
	{
		intCurrentLength = 0;
		intTimeout = intTickerTimeout;
	}

	// Call up the next cycle of the ticker
	setTimeout("runTheTicker()", intTimeout);
}
