				
function compteARebour(div, year, month, day){
	document.getElementById(div).innerHTML = delai (year, month, day,23,59);
	setTimeout("compteARebour('" + div + "', " + year + ", " + month + ", " + day + ")", 1000);
}

function add_zero(val)
{
	var tmpval;
	if (val < 10)
		tmpval = '0' + val;
	else
		tmpval = val;
	return (tmpval);
}

function delai(annee,mois,jour,heure,min)
{
	var date_fin = new Date(annee,mois-1,jour,heure,min)
	var date_jour = new Date();
	var tps = (date_fin.getTime() - date_jour.getTime()) / 1000; // nb secondes restantes
	var j = Math.floor(tps / (3600 * 24)); // récupere le nb de jour
	tps = tps % (3600 * 24); // secondes restantes après soustraction jours
	var h = add_zero(Math.floor(tps / 3600)); // recupère le nb d'heure
	tps = tps % 3600;
	var m = add_zero(Math.floor(tps/60)); // récupère le nb minute
	tps = tps % 60
	var s = add_zero(Math.floor(tps));
	
	var txt = "";
	if (j > 0) {
		txt = j + "j " + h + "h " + m + "mn " + s + "s";
	}
	return txt;
}
