function banner(id, action){
	killAjax();
	callAjax('/script/banners.php?id='+id+'&action='+action,null,null);
}

var divs = null;
var letime = null;
var viewed = new Array();
var nextInd = null;

function initScrollBanner(speed){
	if(document.getElementById("moreshow")){
		divs = document.getElementById("moreshow").getElementsByTagName("DIV");
		for(i=0;i<divs.length;i++){
			if(divs[i].className=="encours"){
				letime = window.setTimeout("changeShow(" + i + "," + speed + ");", speed);
			}
		}
	}
}

function changeShow(ind,nspeed){
	clearTimeout(letime);
	if(document.getElementById("show_0")){
		nextInd = ind;
		document.getElementById("show_0").onmouseover = function(){
			clearTimeout(letime);
		}
		document.getElementById("show_0").onmouseout = function(){
			letime = window.setTimeout("changeShow(" + nextInd + "," + nspeed + ");", nspeed);
		}
		nextInd = nextInd+1;
		if(nextInd==divs.length) nextInd = 0;
		if(viewed[nextInd]!="oui"){
			var baID = parseInt(divs[nextInd].title);
			banner(baID, "view");
			viewed[nextInd] = "oui";
		}
		if(divs[nextInd]){
			document.getElementById("show_0").innerHTML = divs[nextInd].innerHTML;
			letime = window.setTimeout("changeShow(" + nextInd + "," + nspeed + ");", nspeed);
		}
	}
}