function carrousel(id, width, nb, vitesse)
{
	jQuery('#'+id).append('<span id="span'+id+'" style="display:none;">1</span>');
	
	jQuery('#'+id+' a.next').bind('click',
		function()
		{
			var current;
			var total;
			var left;
			
			current=jQuery('#span'+id).html();
			total=jQuery('#'+id+' .item').length+1-nb;
			left=parseInt(jQuery('#'+id+' .items').css('left'));
			
			jQuery('#'+id+' .items').animate({left:'-='+width},vitesse);
			current++;
			
			if(current==total)
				jQuery('#'+id+' a.next').hide();
			if(current>1)
				jQuery('#'+id+' a.prev').show();
		
			jQuery('#span'+id).html(current);
			return false;
		}
	);
	
	jQuery('#'+id+' a.prev').bind('click',
		function()
		{
			var current;
			var total;
			var left;
			
			current=jQuery('#span'+id).html();
			total=jQuery('#'+id+' .item').length+1-nb;
			left=parseInt(jQuery('#'+id+' .items').css('left'));
			
			jQuery('#'+id+' .items').animate({left:'+='+width},vitesse);
			
			current--;
			
			if(current==1)
				jQuery('#'+id+' a.prev').hide();
			if(current<total)
				jQuery('#'+id+' a.next').show();
			
			jQuery('#span'+id).html(current);
			return false;
		}
	);

}


jQuery('document').ready(function(){
  // Fonctions du genre document.getElementById('balise') qui marchent,
  // on peut accéder aux éléments.

	carrousel('mon-carrousel',150,6,1000);

  jQuery('#SendCV').click(function(){
		jQuery('#divCV').show("slow");
		jQuery('#SendCV').hide("slow");
		return false;
  });
  
  jQuery('#SendMsg').click(function(){
		jQuery('#divMsg').show("slow");
		jQuery('#SendMsg').hide("slow");
		return false;
  });
 
   jQuery('#fakeLink').click(function(){
	   jQuery('#formCV').submit();
	 return false;
  });
 
  jQuery('#fakeLinkMsg').click(function(){
	   jQuery('#formMsg').submit();
	 return false; 
  });
});

