// JavaScript Document
function change_offres(ID_elem, x, y) {
	var attributes = {
		scroll: { to: [x,y] }
	};
	var anim = new YAHOO.util.Scroll(ID_elem, attributes, 0.5, YAHOO.util.Easing.easeOut);
	anim.animate();
}

var pos_height = 0;
var pos_width = 0;
function automatic_change(ID_elem, nb_annonces, tps_secondes, attente) {
	if(nb_annonces) {
		if(!attente) {
			pos_height += 158;
			pos_width = 0;
			
			if(pos_height >= (158*nb_annonces)) {
				pos_height = 0;
			}
			
			change_offres(ID_elem,pos_width,pos_height);
		}
		else {
			tps_secondes *= 1000;
		}
		
		setTimeout("automatic_change('"+ID_elem+"', "+nb_annonces+", "+tps_secondes+", 0)", tps_secondes);
	}
}