
function calcul_tarif(tarif,duree)
	{
	total=Math.floor(tarif*duree);	
	if(total%10!=0) total=total-(total%10)+10; 
	else total=total-(total%10); 
	du=Math.floor((total*30)/100);
	
	document.getElementById("totalapayer").value = total;
	if(du%10!=0) document.getElementById("du").value = du-(du%10)+10;  
	else document.getElementById("du").value = du-(du%10);  
	document.getElementById("reste").value = total-document.getElementById("du").value;  
	}

function calcul_tarif_new(type,formation)
	{
	var tarif_base=document.getElementById("TAR_Par_" + type + "-0").value;
	var duree=document.getElementById("Duree" + formation).value;
	var pourcentage=document.getElementById("TAR_Par_" + type + "-" + duree).value;
	
	//alert(duree + '-->' + pourcentage + '*' + tarif_base);
	
	total=(tarif_base*pourcentage/100)*duree;
	if(total%10!=0 && total%10<=5) total=total-(total%10); 
	else if(total%10!=0 && total%10>5) total=total-(total%10)+10; 
	else total=total-(total%10); 
	
	du=(total*30)/100;
	if(du%10!=0) du=du-(du%10); 
	
	document.getElementById("totalapayer").value = total;
	document.getElementById("du").value = du;  
	document.getElementById("reste").value = total-document.getElementById("du").value;  
	}

function calcul_tarif_dif(tarif,duree)
	{
	total=Math.floor(tarif*duree);	
	if(total%10!=0) total=total-(total%10)+10; 
	else total=total-(total%10); 
	du=Math.floor((total*30)/100);
	
	document.getElementById("totalapayer_dif").value = total;
	if(du%10!=0) document.getElementById("du_dif").value = du-(du%10)+10; 
	else document.getElementById("du_dif").value = du-(du%10); 
	document.getElementById("reste_dif").value = total-document.getElementById("du_dif").value;  
	}

function calcul_tarif_dif_new(type,formation)
	{
	var tarif_base=document.getElementById("TAR_Dif_" + type + "-0").value;
	var duree=document.getElementById("Duree_dif" + formation).value;
	var pourcentage=document.getElementById("TAR_Dif_" + type + "-" + duree).value;
	
	//alert(duree + '-->' + pourcentage + '*' + tarif_base);
	
	total=(tarif_base*pourcentage/100)*duree;
	if(total%10!=0 && total%10<=5) total=total-(total%10); 
	else if(total%10!=0 && total%10>5) total=total-(total%10)+10; 
	else total=total-(total%10); 
	
	du=(total*30)/100;
	if(du%10!=0) du=du-(du%10); 
	
	document.getElementById("totalapayer_dif").value = total;
	document.getElementById("du_dif").value = du; 
	document.getElementById("reste_dif").value = total-document.getElementById("du_dif").value;
	}
