
function simulfree()
{
var x,error='',num,val;
if (document.form.ca.value.length==0)
error+='Saisissez votre chiffre d\'affaires.\n';
else
{
 num= parseFloat(document.form.ca.value);
 if ((isNaN(num))||(num==0))
   {error+='Le champ chiffre d\'affaires doit être un nombre > 0.\n';}
	else
	{
	 num= parseFloat(document.form.fm.value);
	 if (isNaN(num))
	   {error+='Le champ frais de mission doit être un nombre.\n';}
	   else
	   {
	   if ((document.form.fm.value)>((document.form.ca.value)*0.15 ))
	      {
			  // plus de blocage ici désormais
			  //error+='Les frais ne doivent pas dépasser 30 % du salaire brut (environ 15 % du CA HT).\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<10000)
					{
						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.2963);
cs=Math.round(bcs*0.1523);	
document.form.tfg.value=Math.round(tfg)+"%";
document.form.sb.value=Math.round(bcs*0.7067);
document.form.sn.value=Math.round(bcs*0.5544);
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+='Saisissez votre chiffre d\'affaires.\n';
else
{
 num= parseFloat(document.form.ca.value);
 if ((isNaN(num))||(num==0))
   {error+='Le champ chiffre d\'affaires doit être un nombre > 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
						   {if (document.form.ca.value<10000)
						    tfg=59;
							 else
							  tfg=60;}}}}}}}}}

		 
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.sb.value=Math.round(document.form.sn.value*1.275);
document.form.pr.value=Math.round(((document.form.rn.value)/(document.form.ca.value))*100)+"%";
}
document.returnValue=(error=='');
}