var gLines, gCurLine, gTickerTO;

function tickerAnimate() {
	loadRemoteData("/ticker.php");
	gLines = req.responseText.split('\r\n');
	gCurLine = 0;
	animateTicker();
}

function animateTicker() {
	var e = document.getElementById('tickers');
	linkTitle = gLines[gCurLine].split('\t');
	e.innerHTML = '<a href="' + linkTitle[0] + '" onMouseOver="delTickerOut()" onMouseOut="addTickerOut()">' + linkTitle[1] + '</a>';
	gTickerTO = setTimeout(animateTickerOut, 5000);
}

function animateTickerOut() {
	var e = document.getElementById('tickers');
	e.innerHTML = '';
	gCurLine++;
	if (gCurLine >= gLines.length)
		gCurLine = 0;
	setTimeout(animateTicker, 500);
}

function delTickerOut() {
	if (gTickerTO != undefined)
		clearTimeout(gTickerTO);
}

function addTickerOut() {
	gTickerTO = setTimeout(animateTickerOut, 5000);
}
