$(document).ready(function(){
	s_syst = new slider_suppt("#conteneur_suppt");
});

var slider_suppt = function(id){
	var self = this;
	this.div = $(id);
	this.largeurCache = this.div.width();
	this.largeur=-10000;
	this.div.find('div').each(function(){
		self.largeur+=$(this).width();
		self.largeur+=40;
	});
	this.largeur-=64;
	this.largeur-=120;
	this.slider = this.div.find(".slider_suppt");
	this.prec = this.div.find(".prec_suppt");
	this.suiv = this.div.find(".suiv_suppt");
	this.lien1 = this.div.find(".suppt1");
	this.lien2 = this.div.find(".suppt2");
	
	this.saut = 612;
	this.nombre_saut = 0;
	this.courant=0;
	
	this.suiv.click(function(){
		if(self.courant<=self.nombre_saut)
		{
			self.courant++;
			self.slider.animate({
				left:40-(self.courant*self.saut)
			},1000);
		}
	});
	
	this.prec.click(function(){
		if(self.courant>0)
		{
			self.courant--;
			self.slider.animate({
				left:40-(self.courant*self.saut)
			},1000);
		}
	});
	
	this.lien1.click(function(){
		if(self.courant>0)
		{
			nbrSaut = self.courant;
			for(i=0;i<nbrSaut;i++){
				self.courant--;
				self.slider.animate({
					left:40-(self.courant*self.saut)
				},1000);
			}
		}
	});
	
	this.lien2.click(function(){
		if(self.courant<1)
		{
			nbrSaut = 1-self.courant;
			for(i=0;i<nbrSaut;i++){
				self.courant++;
				self.slider.animate({
					left:40-(self.courant*self.saut)
				},1000);
			}
		}
		if(self.courant>1)
		{
			nbrSaut = self.courant-1;
			for(i=0;i<nbrSaut;i++){
				self.courant--;
				self.slider.animate({
					left:40-(self.courant*self.saut)
				},1000);
			}
		}
	});
}
