function calculate_payment(PV, IR, NP) 
{
  var PMT = (PV * IR) / (1 - Math.pow(1 + IR, -NP))
  return Math.round(PMT)
}

function small_loan_calculation()
{
	var objPrice = document.getElementById('small_loan_price');
	var objPrice2 = document.getElementById('small_loan_price2');
	var objPeriod = document.getElementById('small_loan_period');
	var objPeriod2 = document.getElementById('small_loan_period2');
	var objIntress = document.getElementById('small_loan_intress');
	var objPayment = document.getElementById('small_loan_payment');
	
	if (objPrice == null || objPeriod == null && objIntress == null || objPayment == null) return;
		
	var payment = calculate_payment(objPrice.value, objIntress.value / 1200, objPeriod.value);

	objPrice2.value = objPrice.value;
	objPeriod2.value = objPeriod.value;
	
	objPayment.value = payment;
}
