
sactivo = false;
stiempo = 1;

function scrolllist(listId,av) {

	if(!sactivo){

		sactivo = true;
	  list = document.getElementById(listId);
	 	elem = list.firstChild.firstChild;

		sdistancia = elem.clientWidth / 5; /** funciona ok con 5 ó 10 (mas lento) */
				
		inicio = list.scrollLeft;
		//n = elem.clientWidth;
		n = list.clientWidth;
		if(av){ //avance
			fin = inicio + n;
			timer = setInterval('avright(fin, list, timer)', stiempo);
		}else{
			fin = inicio - n;
			timer = setInterval('avleft(fin, list, timer)', stiempo);
		}
	}
}

function avright(fin,list,timer){
	if(list.scrollLeft < fin && (fin <= list.scrollWidth - list.clientWidth)){
		list.scrollLeft += sdistancia;
	}else{
		clearInterval(timer);
		sactivo = false;
	}
}
function avleft(fin,list,timer){
	if(list.scrollLeft > fin && fin >= 0){
		list.scrollLeft -= sdistancia;
	}else{
		clearInterval(timer);
		sactivo = false;
	}
}






