function borloo(){
var totalpay = 0;
var Qtmi;
var total = 0;
var total1 = 0;
var total2 = 0;
var total3 = 0;
var credtaux = 0;
var credass = 0;
var loytot = 0;
var investot = 0;

var borlooArray = xmldata( 0, core + 'extend/ext_wsquery.php?swtype=object&objectName=borlooArray' );
borlooArray = borlooArray.split(",")

borlooTcoef1 = borlooArray[0];
borlooTcoef2 = borlooArray[1];
borlooTcoef3 = borlooArray[2];
defonMax = borlooArray[3];

totalpay = eval(document.devis.vala.value);
statusmar = eval(document.devis.statype.value);
perchargnb = eval(document.devis.pernb.value);

Qtmi = QtmiCoefCal(FamCoefCalc((totalpay * 0.9),statusmar,perchargnb));
timp = TotalImpotCalc((totalpay * 0.9),statusmar,perchargnb);

if(totalpay > 0){
	document.getElementById("realcost").innerHTML = "Déduction 10% : " + FormatNumber(totalpay * 0.1) + " \u20AC";
	document.getElementById("baseimpots").innerHTML = "Impots avant défiscalisation : " + timp + " \u20AC";
}

investot = eval(document.devis.val01.value);

if(investot > 0){
	total1 = investot * borlooTcoef1;
	total2 = investot * borlooTcoef2;
	total3 = investot * borlooTcoef3;
}

if(eval(document.devis.defloyer.value)){
	if(eval(document.devis.defcharge.value))
		loytot = (eval(document.devis.defloyer.value) * 0.7) - eval(document.devis.defcharge.value);
	else
		loytot = (eval(document.devis.defloyer.value) * 0.7);
	
	if(loytot > total1){
		totalpay = totalpay + (loytot - total1);
	}
}

totcred = investot - eval(document.devis.perapp.value);

credtaux = (eval(document.devis.crtaux.value) / 100);
credass = (eval(document.devis.crass.value) / 100);

pertaux = credtaux / 12;
asscost = totcred * (credass / 12);
credlen = eval(document.devis.crtime.value);
credmo = credlen * 12;
ech = ((totcred * pertaux) / (1 - Math.pow((1 + pertaux), -credmo))) + asscost;
credcost = (ech * credmo) - totcred;

if(totcred >= 0)
	document.getElementById("creditotal").innerHTML = "Montant emprunté : " + FormatNumber(totcred) + " \u20AC"; 

if(credcost >= 0)
	document.getElementById("coutcredit").innerHTML = "Coût du crédit : " + FormatNumber(credcost) + " \u20AC"; 

if(ech >= 0)
	document.getElementById("echeance").innerHTML = "Echéance : " + FormatNumber(ech) + " \u20AC / mois"; 

if((timp > 0) && (total1 > 0)){
	for(ynb=0 ; ynb<15 ; ynb++){
		intcred = 0;
		if(totcred > 0){
			for(mnb=0 ; mnb<12 ; mnb++){
				if((pertaux > 0) && (totcred > 0))
					intcred = intcred + ((totcred * pertaux) + asscost);
			
				if(totcred > ech)
					totcred = totcred - ech + ((totcred * pertaux) + asscost);
				else
					totcred = 0;
			}
		}
		mnb = 0;
		
		if(ynb < 7)
			reddero = total1;
		if((ynb > 6) && (ynb < 9))
			reddero = total2;
		if(ynb > 8)
			reddero = total3;
		
		dedtotal = (reddero + intcred)
		
		defon = dedtotal - loytot;
		
		if(defon > defonMax)
			defon = defonMax;
				
		derobded = Qtmi * defon;
		
		if(derobded < 0)
			derobded = 0;
		
		document.getElementById("ecoannu" + (ynb + 1)).innerHTML =  "- Année N°" + (ynb + 1) + " : " + FormatNumber(derobded)  + " \u20AC";
		total = total + derobded;
		derobded = 0;
	}
	
	if(total > 0)
		document.getElementById("ecototal").innerHTML = "Soit une économie totale de " + FormatNumber(total) + " \u20AC sur 15 ans.";
}

}