function Timer(product_id,url) 
{ 
	this.pid = product_id;
	this.urld = url;
	Timer.prototype.bissextile = function(annee)
	{
		if (annee%4==0 && annee %100!=0 || annee%400==0) return true; else return false
	};
	
	Timer.prototype.nb_01_01 = function(date){
		nb_mois=new Array(13);
		nb_mois=[,0,31,59,90,120,151,181,212,243,273,304,334];
		j=eval(date[0]) ;
		m=eval(date[1])+1 ;
		a=eval(date[2]) ;
		nb=nb_mois[m]+j-1 ;
		if (this.bissextile(a) && m>2) nb++;
		return nb;
	};
	
	Timer.prototype.nb_jour_annee = function(a1,a2){
		n=0;
		if (a1==a2) n=0 ; else
		for (i=a1; i<a2; i++) {n += 365; if (this.bissextile(i)) n++}
		return n;
	};
	
	Timer.prototype.nb_jour = function(date1,date2){
		a1=eval(date1[2]) ; a2=eval(date2[2]) ;
		nb=this.nb_jour_annee(date1[2],date2[2]) - this.nb_01_01(date1) + this.nb_01_01(date2);
		return nb;
	};
	
	Timer.prototype.tictac = function(){
		this.jours=Math.floor( this.total/86400 )
		this.hours=Math.floor( (this.total-86400*this.jours)/3600 )
		this.minutes=Math.floor( (this.total-86400*this.jours-3600*this.hours)/60 )
		this.seconds=Math.floor( (this.total-86400*this.jours-3600*this.hours-60*this.minutes) )
		if(this.hours<0 || this.hours>24){this.hours=0}
		if(this.minutes<0 || this.minutes>59){this.minutes=0}
		if(this.seconds<0 || this.seconds>59){this.seconds=0}
		this.affiche(this.jours,this.hours,this.minutes,this.seconds)
		this.total=this.total-1
		if(this.total<0){
			window.location.reload()
		}

		var _this = this;
		setTimeout(function(){_this.tictac();},1000);
	};
	
	Timer.prototype.affiche = function(j,h,m,s){
	if(j>99)
	{
		$("aj"+this.pid).src=eval("this.c"+j.toString().charAt(0)+".src")
		$("bj"+this.pid).src=eval("this.c"+j.toString().charAt(1)+".src")
		$("cj"+this.pid).src=eval("this.c"+j.toString().charAt(2)+".src")
	} else
	{
		if (j<=9){
			$("bj"+this.pid).src=this.c0.src
			$("cj"+this.pid).src=eval("this.c"+j+".src")}
		else {
			$("bj"+this.pid).src=eval("this.c"+Math.floor(j/10)+".src")
			$("cj"+this.pid).src=eval("this.c"+(j%10)+".src")}
	}
	if (h<=9){
		$("a"+this.pid).src=this.c0.src
		$("b"+this.pid).src=eval("this.c"+h+".src")}
	else {
		$("a"+this.pid).src=eval("this.c"+Math.floor(h/10)+".src")
		$("b"+this.pid).src=eval("this.c"+(h%10)+".src")}
	if (m<=9){
		$("d"+this.pid).src=this.c0.src
		$("e"+this.pid).src=eval("this.c"+m+".src")}
	else {
		$("d"+this.pid).src=eval("this.c"+Math.floor(m/10)+".src")
		$("e"+this.pid).src=eval("this.c"+(m%10)+".src")}
	if (s<=9){
		$("g"+this.pid).src=this.c0.src
		$("h"+this.pid).src=eval("this.c"+s+".src")}
	else {
		$("g"+this.pid).src=eval("this.c"+Math.floor(s/10)+".src")
		$("h"+this.pid).src=eval("this.c"+(s%10)+".src")}
	};
	
	Timer.prototype.initimg = function(){
		var total=1;
		this.c1=new Image();this.c1.src = this.urld + "flash-1.gif";
		this.c2=new Image();this.c2.src = this.urld + "flash-2.gif";
		this.c3=new Image();this.c3.src = this.urld + "flash-3.gif";
		this.c4=new Image();this.c4.src = this.urld + "flash-4.gif";
		this.c5=new Image();this.c5.src = this.urld + "flash-5.gif";
		this.c6=new Image();this.c6.src = this.urld + "flash-6.gif";
		this.c7=new Image();this.c7.src = this.urld + "flash-7.gif";
		this.c8=new Image();this.c8.src = this.urld + "flash-8.gif";
		this.c9=new Image();this.c9.src = this.urld + "flash-9.gif";
		this.c0=new Image();this.c0.src = this.urld + "flash-0.gif";
	};
	
	Timer.prototype.inittime = function(a,m,j,h,i,s,as,ms,js,hs,is,ss)
	{
		this.DateFin=new Date(a,m,j,h,i,s);
		this.serveurhour=new Date(as,ms,js,hs,is,ss);
		this.Digital=this.serveurhour;
		this.nbdayfin= this.nb_jour([this.Digital.getDate(), this.Digital.getMonth(), this.Digital.getYear()], [this.DateFin.getDate(), this.DateFin.getMonth(), this.DateFin.getYear()]);
		this.total=(86400*this.nbdayfin+3600*this.DateFin.getHours()-3600*this.Digital.getHours()+60*this.DateFin.getMinutes()-60*this.Digital.getMinutes()+this.DateFin.getSeconds()-this.Digital.getSeconds());
		this.initimg();
	};

}



