function aximPaymentToolsPage(fx_page) {
	ajaxGetData('/axiomfinancial/pages/calculators/payment-cal/ajax_calculate.cxp?p=s&', "", 'cnxDisplayBox','cnxDisplayBox', 1)
}

function aximPaymentShow() {
    var var_postdata = ajaxGetFormVars(document.getElementById('frmcxaPaymentCal'));
    ajaxGetData('/axiomfinancial/pages/calculators/payment-cal/ajax_validate_calculate.cxp?p=s', var_postdata, 'PaymentResults','PaymentResults', 1)
}
function updatePaymentPropTax(fx_price)
{
    var var_PropertyTax = fx_price * 0.015
    document.getElementById('Fld_PropertyTax').value = var_PropertyTax.toFixed(2);
}
function paymentCalculate(fx_price, fx_years, fx_downpayment, fx_rate, fx_propertytax, fx_insurance){
    
	var loan_life = fx_years;			// years to pay off the loan
    var var_Frequency = 12;			// how many payments a year
    var avg_tax_rate = 0.015;	// the average yearly % for property tax
    var var_Periods = loan_life * var_Frequency;	// the number of periods (and payments) in the loan
    var var_IntRate = fx_rate  // interest rate
    var var_Principal = fx_price - fx_downpayment
    var var_PeriodRate = var_IntRate/(var_Frequency * 100);
    var var_TaxInsur = (fx_propertytax + fx_insurance)/12;
    
	var var_PrincDen = ( Math.pow( 1 + var_PeriodRate, var_Periods ) - 1 )
                	/
		( var_PeriodRate *  Math.pow( 1 + var_PeriodRate, var_Periods ) )
	;
	
    var var_Payment = var_Principal / var_PrincDen;
	var var_Total = var_Payment + var_TaxInsur;
	
    if (var_IntRate == 0){
	    document.getElementById('Fld_Rates').style.backgroundColor="FEDEDE";
    }
    if (fx_price == 0){
	    document.getElementById('Fld_Price').style.backgroundColor="FEDEDE";
    }
	document.getElementById('Fld_Principal').value = var_Payment.toFixed(2);
    document.getElementById('Fld_TaxInsur').value = var_TaxInsur.toFixed(2);
    document.getElementById('Fld_Total').value = var_Total.toFixed(2);
}


xpsJSPage = 'ran';



