<!-- debut du script



function verification(){



if (window.document.calc.revenu.value == 0 || window.document.calc.revenu_2.value == ""){

	alert("Vous devez entrer votre revenu brut.")

	window.document.calc.revenu_2.focus();}

else

{

	calcul()

}



}





function place(that, maxlong,champcible2) {



var tour=0;

var trouve="false";

var temp = that.value;

var longueur = temp.length;

var pospoint=0;

var point='false';

var sous="";

var dollars="";



while(tour<longueur){

	caractere = temp.charAt(tour)

	if (caractere==","){

		avant = temp.substring(0,tour);

		apres = temp.substring(tour+1,longueur);

		temp = avant + "." + apres;

		point = 'true';

		pospoint = tour;

	}

	if (caractere==" "){

		avant = temp.substring(0,tour);

		apres = temp.substring(tour+1,longueur);

		temp=avant + apres;		

		tour=tour-1;

		longueur=longueur-1;

	}

	if (caractere=="."){

		point = 'true';

		pospoint = tour;

	}



	tour=tour+1;

};

if (point == 'true'){





	if (longueur == pospoint+1){

		sous = ",00";



		tour=0

		if (longueur>4){

			while (tour<longueur-4){

				dollars = dollars + temp.charAt(tour)

				tour=tour+1;

			}

			dollars = dollars + " " + temp.charAt(tour) + temp.charAt(tour+1) + temp.charAt(tour+2)

		}

		else

		{

			tour=0

			while (tour<longueur-1){

				dollars = dollars + temp.charAt(tour)

				tour=tour+1;

			}

		}

	}

	else

	{

		if (temp.charAt(pospoint+1) != "" ){

			sous = "," + temp.charAt(pospoint+1)



			if (temp.charAt(pospoint+2) != "" ){

			

				tour=0

				sous = sous + temp.charAt(pospoint+2)

				if (longueur>6){

					while (tour<longueur-6){

						dollars = dollars + temp.charAt(tour)

						tour=tour+1;

					}

					dollars = dollars + " " + temp.charAt(tour) + temp.charAt(tour+1) + 					temp.charAt(tour+2)

	

				}

				else

				{	

					tour=0

						while (tour<longueur-3){

						dollars = dollars + temp.charAt(tour)

						tour=tour+1;

						}

				}

			}

			else

			{

				sous = sous + "0"

				tour=0

				if (longueur>5){

					while (tour<longueur-5){

						dollars = dollars + temp.charAt(tour)

						tour=tour+1;

					}

					dollars = dollars + " " + temp.charAt(tour) + temp.charAt(tour+1) + 					temp.charAt(tour+2)	

				}

				else

				{

					tour=0

					while (tour<longueur-2){

						dollars = dollars + temp.charAt(tour)

						tour=tour+1;

					}

				}

			}

		}

	}

}

else

{

	sous = ",00"

	tour=0

	if (longueur>3){

		while (tour<(longueur-3)){

			dollars = dollars + temp.charAt(tour)

			tour=tour+1;

		}

		dollars = dollars + " " + temp.charAt(tour) + temp.charAt(tour+1) + temp.charAt(tour+2)

	}

	else

	{

		tour=0

		while (tour<longueur){

			dollars = dollars + temp.charAt(tour)

			tour=tour+1;

		}

	}	

}



if (dollars==""){

	dollars="0";

}



var temp2 = dollars + sous;



if (champcible2=='revenu'){

	window.document.calc.revenu_2.value = temp2;

	window.document.calc.revenu.value = temp;

}

if (champcible2=='paiement1'){

	window.document.calc.paiement1_2.value = temp2;

	window.document.calc.paiement1.value = temp;

}

if (champcible2=='paiement2'){

	window.document.calc.paiement2_2.value = temp2;

	window.document.calc.paiement2.value = temp;

}

if (champcible2=='paiement3'){

	window.document.calc.paiement3_2.value = temp2;

	window.document.calc.paiement3.value = temp;

}

if (champcible2=='capital1'){

	window.document.calc.capital1_2.value = temp2;

	window.document.calc.capital1.value = temp;

}

if (champcible2=='capital2'){

	window.document.calc.capital2_2.value = temp2;

	window.document.calc.capital2.value = temp;

}

if (champcible2=='capitalan1'){

	window.document.calc.capitalan1_2.value = temp2;

	window.document.calc.capitalan1.value = temp;

}

if (champcible2=='capitalan2'){

	window.document.calc.capitalan2_2.value = temp2;

	window.document.calc.capitalan2.value = temp;

}

}



function calcul(){



for (i=0; i < window.document.calc.frequence.length; i++)

	{  

	if(window.document.calc.frequence[i].selected==true)

		{

		frequence = parseFloat(window.document.calc.frequence[i].value)

		}

	}



revenu = parseFloat(window.document.calc.revenu.value)

paiement1 = parseFloat(window.document.calc.paiement1.value) * 12

paiement2 = parseFloat(window.document.calc.paiement2.value) * 12

paiement3 = parseFloat(window.document.calc.paiement3.value) * 12



capital1 = parseFloat(((revenu-paiement1-paiement2-paiement3)*0.32));

capital2 = parseFloat(((revenu-paiement1-paiement2-paiement3)*0.37));



var capitalan1_2=0;

var capitalan2_2=0;



window.document.calc.capitalan1_2.value = (Math.round((capital1)*100))/100;

place(window.document.calc.capitalan1_2,10,'capitalan1');



window.document.calc.capitalan2_2.value = (Math.round((capital2)*100))/100;

place(window.document.calc.capitalan2_2,10,'capitalan2');



window.document.calc.capital1_2.value = (Math.round((capital1/frequence)*100))/100;

place(window.document.calc.capital1_2,10,'capital1');



window.document.calc.capital2_2.value = (Math.round((capital2/frequence)*100))/100;

place(window.document.calc.capital2_2,10,'capital2');



if(window.document.calc.frequence[0].selected==true){

window.document.calc.frequence2.value = "hebdomadaire";

}

if(window.document.calc.frequence[1].selected==true){

window.document.calc.frequence2.value = "bi-hebdomadaire";

}

if(window.document.calc.frequence[2].selected==true){

window.document.calc.frequence2.value = "mensuel";

}

if(window.document.calc.frequence[3].selected==true){

window.document.calc.frequence2.value = "annuel";

}







}



//  Fin du script -->