// ====================================================================
// Slide Javascript 
// ====================================================================

var pos;
	var speed 			= 1;
	var pos_initial;
	var time_speed 		= 20;
	var top 			= ''; // En haut de la div container 
	var bottom 			= ''; // En bas de la div container
	var position 		= top; // Choisir bottom ou top 
	
	var add_check 		= -200;
	var id_img 			= 1;
	
 
function startSlide(nb_item,new_id) {
	var e = document.getElementById('imgcontainer');
	
	var bottom = e.clientHeight + 10; // Bottom de la div container
	var top = e.style.top; // Bottom de la div container
	
	pos_initial = top;
	
	pos = pos_initial;
	setInterval('slide()', time_speed);
}
function slide() {
	var e = document.getElementById('imglist');
	e.style.visibility = 'visible';
	e.style.top = Math.floor(pos) + 'px';
	pos = pos - speed;
	if(pos < -e.clientHeight) pos = pos_initial;
	//console.log(e.style.top);
	
	//console.log(pos);
	if(pos == add_check) 
	{
		
		var img = $('#'+id_img).html();
		
		//
		if(id_img >= 7)
		{
			$('#'+id_img - nb_item).remove();
		}
		
		$('#imgcontainer ul').append('<li id="'+new_id+'">' + img + '</li>');
		
		add_check = add_check - 200;
		id_img += 1;
		new_id += 1; 
		
	} 
}
window.onload = function() {
  var e = document.getElementById('imgcontainer');
  e.onmouseover = function() { speed = 0; };
  e.onmouseout = function() { speed = 1; };
  
 	
  
  
};

