var current = 1;
var t;

function startLoop() {
	if (location.pathname.indexOf('index.htm') != -1 ||
			(location.pathname.indexOf('.htm') == -1 &&
			 location.pathname.indexOf('.php') == -1)
		) {
		limit = 5;
	} else {
		limit = 4;
	}
	id = (current+1 > limit)?1:current+1;
	clearTimeout(t);
	t = setTimeout(function() { changeArticle(id,1); },10000);
}

function changeArticle(id,doLoop) {
	document.getElementById("l"+current).style.color = "#ffffff";
	document.getElementById("l"+current).style.background = "#994400";
	document.getElementById("article"+current).style.display = "none";
	document.getElementById("l"+id).style.color = "#994400";
	document.getElementById("l"+id).style.background = "#ffffff";
	document.getElementById("article"+id).style.display = "block";
	current = id;
	(doLoop==1)?startLoop():stopLoop();
}

function stopLoop() {
	clearTimeout(t);
}