var columns = 10; // the amount of columns
var colorHighLighted = "#FF8C00";
var colorNormal = "#00008B";
var delay = 170;
//~~~~~~~~~~~~~~~~
var column=0;	// current highlighted column
var run=false;
var waitingTime = 500;
//~~~~~~~~~~~~~~~~
function startAnim(text) {
	run=true;
	setTimeout('startNow();',waitingTime);
	setText(text);
}

function setText(text) {
	if(text != "") document.getElementById("idleMessage").innerHTML = text;
}

function startNow() {
	if(run) for(var i = 0; i < columns;i++) document.getElementById("t"+i).style.backgroundColor = colorNormal;
	infinityLoop(column);
}

function stopAnim(text) {
	run=false;
	if(text != "")
		setText(text);
	else
		setText("&nbsp;");
	for(var i = 0; i < columns;i++) document.getElementById("t"+i).style.backgroundColor = "transparent";
}

function doColoring(column) {
	if(parseInt(column) == 0) {
		document.getElementById("t"+(columns-1)).style.backgroundColor = colorNormal;
		document.getElementById("t0").style.backgroundColor = colorHighLighted;
	} else {
		document.getElementById("t"+(column-1)).style.backgroundColor = colorNormal;
		document.getElementById("t"+column).style.backgroundColor = colorHighLighted;
	}
}

function infinityLoop(column) {
	if(run) {
		if(column  >= (columns-1)) column = 0;
		else column++;
		setTimeout("infinityLoop("+column+");",delay);
		doColoring(column);
	}
}