
function countdownTimer(year, month, day, hour, minute, id){
	
	html = '<span id="tmr'+id+'" class="timer"></span>';
	document.write(html);

	countdown(year, month, day, hour, minute, id);                
}
         
function countdown(year, month, day, hour, minute, id){
	
	var timer = 'tmr'+id;
	today = new Date();
	todayYear = today.getFullYear();
	todayMonth = today.getMonth() + 1;                  
                           
	todayDate = (new Date(todayYear, todayMonth, today.getDate(),
	today.getHours(), today.getMinutes(), today.getSeconds())).getTime();                                 
	eventDate = (new Date(year, month, day, hour, minute, 00)).getTime();                  
                 
	timeLeft = Math.round((eventDate - todayDate) / 1000);

	if(timeLeft < 0){
		timeLeft = 0;
	}

	days = Math.floor(timeLeft / (60 * 60 * 24)) + 1; 
	timeLeft %= (60 * 60 * 24);
	
	hours = Math.floor(timeLeft / (60 * 60));
	timeLeft %= (60 * 60);
	
	minutes = Math.floor(timeLeft / 60);
	timeLeft %= 60;
	
	seconds = timeLeft;
	

	if(days>1){
		document.getElementById(timer).innerHTML = "<span>Reste </span>" + days + "<span> jours</span>";
	
	}else{

		if(seconds == 0 && minutes == 0 && hours == 0 && days == 1){
			document.getElementById(timer).innerHTML = '';
		}else{
			document.getElementById(timer).innerHTML = hours + '<span>h </span>';
			document.getElementById(timer).innerHTML += minutes + '<span>m </span>';
			document.getElementById(timer).innerHTML += seconds + '<span>s</span>';
		}
	}

setTimeout('countdown(' + year + ',' + month + ',' + day + ',' + hour + ',' + minute + ',' + id + ');', 1000);
} 
