function SinDecimales(Num)

{
    with (Math) {
        var ADevolver=round(Num);
    }

   return ADevolver;
}



function CalculaDeuda(form)

{

	//Calculo de ingresos


    var Total1=form.Ingreso1.value*form.Pagas1.value/12;
    var Total2=form.Ingreso2.value*form.Pagas2.value/12;
    var Total3=form.Ingreso3.value*form.Pagas3.value/12;

	var Incremento=(((Total1+Total2+Total3)/300)-1)*0.01;

    var Total5=(Total1+Total2+Total3)*(0.40+Incremento);
    var Interes=(nEuribor+2)/100/12;
    var AuxCDeuda=1+Interes;
    
	form.Ingreso1p.value=SinDecimales(form.Ingreso1.value*166.386);
	form.Ingreso2p.value=SinDecimales(form.Ingreso2.value*166.386);
	form.Ingreso3p.value=SinDecimales(form.Ingreso3.value*166.386);

    form.Resultado.value=Dosdecimales(Total5);
    form.ResultadoP.value=SinDecimales(form.Resultado.value*166.386);

    
    form.Capital15.value=Dosdecimales(Total5*((Math.pow(AuxCDeuda,15*12)-1))/(Interes*Math.pow(AuxCDeuda,15*12)));
    form.Capital20.value=Dosdecimales(Total5*((Math.pow(AuxCDeuda,20*12)-1))/(Interes*Math.pow(AuxCDeuda,20*12)));
    form.Capital25.value=Dosdecimales(Total5*((Math.pow(AuxCDeuda,25*12)-1))/(Interes*Math.pow(AuxCDeuda,25*12)));
    form.Capital30.value=Dosdecimales(Total5*((Math.pow(AuxCDeuda,30*12)-1))/(Interes*Math.pow(AuxCDeuda,30*12)));

    form.Capital15p.value=SinDecimales(form.Capital15.value*166.386);
    form.Capital20p.value=SinDecimales(form.Capital20.value*166.386);
    form.Capital25p.value=SinDecimales(form.Capital25.value*166.386);
    form.Capital30p.value=SinDecimales(form.Capital30.value*166.386);


    return;

}

