function asCalc(){

var numericExpression = /^[0-9]+([\.]?[0-9]+){0,1}$/;
var asLAB = document.getElementById('asLAB').value;
var asDV = document.getElementById('asDV').value;
var asOFE = document.getElementById('asOFE').value;
var asLog = document.getElementById('asLog').value;
var asComm = document.getElementById('asComm').value;
var asAssur = document.getElementById('asAssur').value;
var asHP = document.getElementById('asHP').value;
//var asCompta =  document.getElementById('asCompta').value;
var asCOB =  document.getElementById('asCOB').value;
var asPDA =  document.getElementById('asPDA').value;
var asAutres =  document.getElementById('asAutres').value;
var as3Profit = document.getElementById('as3Profit').value;
	
	asLAB=asLAB.replace(/,/g,'.');
	asDV=asDV.replace(/,/g,'.');
	asOFE=asOFE.replace(/,/g,'.');
	asLog=asLog.replace(/,/g,'.');
	asComm=asComm.replace(/,/g,'.');
	asAssur=asAssur.replace(/,/g,'.');
	asHP=asHP.replace(/,/g,'.');
	//asCompta=asCompta.replace(/,/g,'.');
	asCOB=asCOB.replace(/,/g,'.');
	asPDA=asPDA.replace(/,/g,'.');
	asAutres=asAutres.replace(/,/g,'.');
	as3Profit=as3Profit.replace(/,/g,'.');

	
	if (!(as3Profit.match(numericExpression))){
		as3Profit = 0;}
	if (!(asLAB.match(numericExpression))){
		asLAB = 0;
		}
	
	if (!(asDV.match(numericExpression))){
		asDV = 0;}
	if (!(asOFE.match(numericExpression))){
		asOFE = 0;}
	if (!(asLog.match(numericExpression))){
		asLog = 0;}
	if (!(asComm.match(numericExpression))){
		asComm = 0;}
	if (!(asAssur.match(numericExpression))){
		asAssur = 0;}
	if (!(asHP.match(numericExpression))){
		asHP = 0;}
	//if (!(asCompta.match(numericExpression))){
	//	asCompta = 0;}
	if (!(asPDA.match(numericExpression))){
		asPDA = 0;}
	if (!(asCOB.match(numericExpression))){
		asCOB = 0;}
	if (!(asAutres.match(numericExpression))){
		asAutres = 0;}
	as3Profit=parseFloat(as3Profit);
	asLAB=parseFloat(asLAB);
	asDV=parseFloat(asDV);
	asOFE=parseFloat(asOFE);
	asLog=parseFloat(asLog);
	asComm=parseFloat(asComm);
	asAssur=parseFloat(asAssur);
	asHP=parseFloat(asHP);
	//asCompta=parseFloat(asCompta);
	asCOB=parseFloat(asCOB);
	asPDA=parseFloat(asPDA);
	asAutres=parseFloat(asAutres);
	
	total = asLAB+asDV+asOFE+asLog+asComm+asHP+asAssur+asCOB+asPDA+asAutres+as3Profit;
	response = total;
	document.getElementById('astotal').value = response.toFixed(2);
	document.getElementById('astotal').innerHTML = response.toFixed(2)+"$";
	//document.getElementById("asStatusDisplay").innerHTML = "Dépenses d'affaire :" +" "+response+"$"; 
}
function asCalc2(){

var numericExpression = /^[0-9]+([\.]?[0-9]+){0,1}$/;
var as2FS = document.getElementById('as2FS').value;
var as2HL = document.getElementById('as2HL').value;
var as2ALA = document.getElementById('as2ALA').value;
var as2Loisir = document.getElementById('as2Loisir').value;
var as2VV = document.getElementById('as2VV').value;
var as2AP = document.getElementById('as2AP').value;
var as2CReer = document.getElementById('as2CReer').value;
var as2IAP =  document.getElementById('as2IAP').value;
var as2Autres =  document.getElementById('as2Autres').value;

	
as2FS=as2FS.replace(/,/g,'.');
as2HL=as2HL.replace(/,/g,'.');
as2ALA=as2ALA.replace(/,/g,'.');
as2Loisir=as2Loisir.replace(/,/g,'.');
as2VV=as2VV.replace(/,/g,'.');
as2AP=as2AP.replace(/,/g,'.');
as2CReer=as2CReer.replace(/,/g,'.');
as2IAP=as2IAP.replace(/,/g,'.');
as2Autres=as2Autres.replace(/,/g,'.');		
	
	
	if (!(as2FS.match(numericExpression))){
		as2FS = 0;}
	
	if (!(as2HL.match(numericExpression))){
		as2HL = 0;}
	
	if (!(as2ALA.match(numericExpression))){
		as2ALA = 0;}
	
	if (!(as2Loisir.match(numericExpression))){
		as2Loisir = 0;}
	if (!(as2VV.match(numericExpression))){
		as2VV = 0;}
	
	if (!(as2AP.match(numericExpression))){
		as2AP = 0;}
	
	if (!(as2CReer.match(numericExpression))){
		as2CReer = 0;}
	
	if (!(as2IAP.match(numericExpression))){
		as2IAP = 0;}
	
	if (!(as2Autres.match(numericExpression))){
		as2Autres = 0;}
	
	as2FS=parseFloat(as2FS);
	as2HL=parseFloat(as2HL);
	as2ALA=parseFloat(as2ALA);
	as2Loisir=parseFloat(as2Loisir);
	as2VV=parseFloat(as2VV);
	as2AP=parseFloat(as2AP);
	as2CReer=parseFloat(as2CReer);
	as2IAP=parseFloat(as2IAP);
	as2Autres=parseFloat(as2Autres);
	
	total = as2FS+as2HL+as2ALA+as2Loisir+as2VV+as2AP+as2CReer+as2IAP+as2Autres;
	response = total;
	
	document.getElementById('astotal2').value = response.toFixed(2);
	document.getElementById('astotal2').innerHTML = response.toFixed(2)+"$";
	//document.getElementById("asStatusDisplay2").innerHTML = "Dépenses personnel :" +" "+response+"$"; 
}
function asCalc3(){

var numericExpression = /^[0-9]+([\.]?[0-9]+){0,1}$/;
var floatexp =/^[0-9]+([\.]?[0-9]+){0,1}$/
var semaine = /^[0-7]+([\.]?[0-9]+){0,1}$/;
var as3NBJT = document.getElementById('as3NBJT').value;

as3NBJT=as3NBJT.replace(/,/g,'.');
var as3NBVS = document.getElementById('as3NBVS').value;
var as3NBJCF = document.getElementById('as3NBJCF').value;
var as3NBJMP = document.getElementById('as3NBJMP').value;
as3NBVS=as3NBVS.replace(/,/g,'.');
as3NBJCF=as3NBJCF.replace(/,/g,'.');
as3NBJMP=as3NBJMP.replace(/,/g,'.');

	
		
	if ((as3NBJT.match(floatexp))){
		if (!(as3NBJT.match(semaine))){
		as3NBJT = 7;
		document.getElementById('as3NBJT').value=7;}
	}else{as3NBJT = 0;}
	
	if (!(as3NBVS.match(numericExpression))){
		as3NBVS = 0;}
	
	if (!(as3NBJCF.match(numericExpression))){
		as3NBJCF = 0;}
	
	if (!(as3NBJMP.match(numericExpression))){
		as3NBJMP = 0;}
	
	
	as3NBJT=parseFloat(as3NBJT);
	as3NBVS=parseFloat(as3NBVS);
	as3NBJCF=parseFloat(as3NBJCF);
	as3NBJMP=parseFloat(as3NBJMP);
	
	
	total = (as3NBJT*52)-as3NBVS-as3NBJCF-as3NBJMP;
	response = total;
	document.getElementById("asStatusDisplay3").innerHTML = "Nombre de jours disponibles pour travailler :";
	document.getElementById('astotal3').innerHTML = response.toFixed(2); 
	document.getElementById('astotal3').value = response.toFixed(2); 
	
}

function asCalc4(){
	
	asCalc();
	asCalc2();
	asCalc3();
	var numericExpression = /^[0-9]+([\.]?[0-9]+){0,1}$/;
	var floatexp =/^[0-9]+([\.]?[0-9]+){0,1}$/;
	
	var depense = document.getElementById('astotal').value;
	var depense2 = document.getElementById('astotal2').value;
	var jours = document.getElementById('astotal3').value;
	var gros_total = parseFloat(depense)+parseFloat(depense2);
	var as3CHTJ = document.getElementById('as3CHTJ').value;
	as3CHTJ=as3CHTJ.replace(/,/g,'.');
	if (!(as3CHTJ.match(floatexp))){
		document.getElementById('as3CHTJ').value =0;
		as3CHTJ = 0;}
	if (as3CHTJ >24)
	{	document.getElementById('as3CHTJ').value=24;
		as3CHTJ =24;
		}
	var as3Fact = document.getElementById('as3Fact').value;
	if (!(as3Fact.match(numericExpression))){
		as3Fact = 0;}
	if (as3Fact == '' || as3Fact == 0) 
		{as3Fact =1;
			document.getElementById('as3Fact').value=1}
	
	var taux_min = (gros_total) / ((parseFloat(jours) * (parseFloat(as3CHTJ)/100))*parseFloat(as3Fact));
	if ( taux_min <1 )
	{//	document.getElementById("asStatusDisplay4").innerHTML = "Impossible de calculer le taux mininum, veuillez revoir les informations entrées."; 
		
		}
	else{
	//document.getElementById("asStatusDisplay4").innerHTML = "le seuil minimum de vos honoraires : "; 
	document.getElementById("taux").innerHTML = taux_min.toFixed(2) +"$"; 
	}
}
	



