
function simulfree()
{
var x,error='',num,val;
if (document.form.ca.value.length==0)
error+='Enter your turnover.\n';
else
{
 num= parseFloat(document.form.ca.value);
 if ((isNaN(num))||(num==0))
   {error+='The turnover field must comprise a value > 0.\n';}
	else
	{
	 num= parseFloat(document.form.fm.value);
	 if (isNaN(num))
	   {error+='The assignment fee field must comprise a value.\n';}
	   else
	   {
	   if ((document.form.fm.value)>((document.form.ca.value)*0.15 ))
	      {
			  // plus de blocage ici désormais
			  //error+='Expenses may not exceed 30% of the gross wage (approx. 15% of the TO exc. tax).\n';
			}}}}

if (error){
	alert(error);
}
else
{
	tfg=0;
	if (document.form.ca.value<1000)
	{
		tfg=10;
	}
	else 
	{
		if (document.form.ca.value<2000)
		{
			tfg=9;
		}
		else 
		{
			if (document.form.ca.value<3000)
			{
				tfg=8;
			}
			else
			{
				if (document.form.ca.value<6000)
				{
					tfg=7;
				}
				else
				{
					if (document.form.ca.value<9000)
					{
						tfg=6;	
					}
					else
					{
						tfg=5;	
					}
				}
			}
	}
}
		 
bcs=Math.round((document.form.ca.value)-(((document.form.ca.value)*(tfg))/100)-(document.form.fm.value));
cp=Math.round(bcs*0.3055);
cs=Math.round(bcs*0.1517);
ct=(cp+cs);
document.form.tfg.value=Math.round(tfg)+"%";
document.form.sn.value=Math.round(bcs*0.5428);
document.form.ct.value=Math.round(ct);
document.form.rn.value=Math.round(parseFloat(document.form.fm.value)+parseFloat(document.form.sn.value));
document.form.pr.value=Math.round(((document.form.rn.value)/(document.form.ca.value))*100)+"%";
}
document.returnValue=(error=='');
}

function simulcom()
{
var x,error='',num,val;
if (document.form.ca.value.length==0)
error+='Enter your turnover.\n';
else
{
 num= parseFloat(document.form.ca.value);
 if ((isNaN(num))||(num==0))
   {error+='The turnover field must comprise a value > 0.\n';}}

if (error)
	alert(error);
	else
	{tfg=0;
	 if (document.form.ca.value<1000)
	 tfg=50;
	   else 
	   {if (document.form.ca.value<2000)
	    tfg=51;
	      else 
	      {if (document.form.ca.value<3000)
	       tfg=52;
	         else
			 {if (document.form.ca.value<4000)
	          tfg=53;
	           else
			    {if (document.form.ca.value<5000)
	             tfg=54;
	              else
				   {if (document.form.ca.value<6000)
			        tfg=55;
					 else
					  {if (document.form.ca.value<7000)
					   tfg=56;
					    else
						 {if (document.form.ca.value<8000)
						  tfg=57;
						  else
						   {if (document.form.ca.value<9000)
						    tfg=58;
							 else
							  tfg=59;}}}}}}}}

		 
document.form.fm.value=Math.round((document.form.ca.value)*0.13);
document.form.rn.value=Math.round((document.form.ca.value*tfg)/100);
document.form.sn.value=Math.round(document.form.rn.value-document.form.fm.value);
document.form.pr.value=Math.round(((document.form.rn.value)/(document.form.ca.value))*100)+"%";
}
document.returnValue=(error=='');
}
