function compteur(finish, start_year, start_month, start_day, start_hour, start_minute, start_second, end_year, end_month, end_day, end_hour, end_minute, end_second) {
	
	var start = new Date(start_year, start_month-1, start_day, start_hour, start_minute, start_second);
	
	var end = new Date(end_year, end_month-1, end_day, end_hour, end_minute, end_second);
	
	var affiche_compteur = "";
	var laps_repeat = 1000;
	
	date_start = start.getTime();
	date_end = end.getTime();

	var nb_milliseconde = temps_milliseconde(date_start,date_end);
	var nb_seconde = temps_seconde(nb_milliseconde);
	var reste_seconde = recup_seconde(nb_seconde);
	var nb_minute = temps_minute(nb_seconde,reste_seconde);
	var reste_minute = recup_minute(nb_minute);
	var nb_heure = temps_heure(nb_minute,reste_minute);
	
	if(nb_heure != '' ){
		if(nb_heure < 10) {
			nb_heure = '0'+nb_heure;
		}
		affiche_compteur += nb_heure+"h ";
	}
	
	if(reste_minute != '' || reste_minute==0) {
		if(reste_minute < 10) {
			reste_minute = '0'+reste_minute;
		}
		affiche_compteur += reste_minute+"mn ";
	}
	
	if(reste_seconde != '' || reste_seconde==0) {
		if(reste_seconde < 10) {
			reste_seconde = '0'+reste_seconde;
		}
		affiche_compteur += reste_seconde+"s";
	}	
	
	if(finish == 'N')
	{
		$('compteur').innerHTML = '<a href="../tirage/tirage_loto.php" id="a_compteur">En cours...</a>';
		
		if($('text_info_tirage'))
		{
			$('text_info_tirage').innerHTML = 'Tirage en cours...';
		}
	}else
	{
		//$('compteur').innerHTML = '<a href="../tirage/tirage_loto.php" id="a_compteur">'+affiche_compteur+'</a>';
		$('compteur').innerHTML = '<span class="color10">'+affiche_compteur+'</span>';	
		
		if($('text_info_tirage')) {
			//$('text_info_tirage').innerHTML = 'Prochain tirage dans <span id="compteur"><a href="../tirage/tirage_loto.php" id="a_compteur">'+affiche_compteur+'</a></span><br />';
			$('text_info_tirage').innerHTML = 'Prochain tirage dans <span id="compteur">'+affiche_compteur+'</span><br />';
		}
	}
	
	if(nb_milliseconde == 0)
	{
		window.location = "../tirage/tirage_loto.php";
	}
	
	cpt_no_activities++;
	
	if(cpt_no_activities >= 1800 && nb_milliseconde < 300000)
	{
		window.location.reload();
	}
	
	start.setTime(start.getTime()+laps_repeat);
	
	
	start_year = start.getFullYear();
	start_month = start.getMonth();
		start_month = start_month+1;
	start_day = start.getDate();
	start_hour = start.getHours();
	start_minute = start.getMinutes();
	start_second = start.getSeconds();
	
	setTimeout("compteur('"+finish+"', "+start_year+","+start_month+","+start_day+","+start_hour+","+start_minute+","+start_second+","+end_year+","+end_month+","+end_day+","+end_hour+","+end_minute+","+end_second+")", laps_repeat);
	
}

function temps_milliseconde(depart,arriver){ var temps_milliseconde = arriver-depart; return temps_milliseconde; }
function temps_seconde(nb_milliseconde){ var nb_seconde = nb_milliseconde/1000; return parseInt(nb_seconde); }
function temps_minute(nb_minute,reste_minute){ var temps_minute = (nb_minute-reste_minute)/60; return temps_minute; }
function temps_heure(nb_minute,reste_minute){ var temps_heure = (nb_minute-reste_minute)/60; return temps_heure; }
function recup_seconde(nb_seconde){ var reste_seconde = nb_seconde%60; return reste_seconde; }
function recup_minute(nb_minute){ var reste_minute = nb_minute%60; return reste_minute; }