function vehicleCalculator(amt, rate, months) {
    if(amt > 0 && rate > 0 && months > 0) {
	var r = ( rate * .01 ) / 12;
	price = ( amt * r ) / ( 1 - ( 1 / ( EXP( 1 + r, months ) ) ) );
        document.getElementById('vehicle_calculator_price').innerHTML = '$ ' + price.toFixed(2);
        document.getElementById('vehicle_calculator_price').style.display = 'block';
        document.getElementById('vehicle_calculator_error').style.display = 'none';
    } else {
        document.getElementById('vehicle_calculator_price').style.display = 'none';
        document.getElementById('vehicle_calculator_error').style.display = 'block';
    } 
}

function EXP(a,b) {
    var t = 1;
    for(x = 1; x <= b; x++) { 
        t = t * a;
    }
    ret = t;
    return(t);
}

function vehicleCalculator1(amt, rate, months) {
    if(amt > 0 && rate > 0 && months > 0) {
	var r = ( rate * .01 ) / 12;
	price = ( amt * r ) / ( 1 - ( 1 / ( EXP( 1 + r, months ) ) ) );
        document.getElementById('vehicle_calculator_price1').innerHTML = '$ ' + price.toFixed(2);
        document.getElementById('vehicle_calculator_price1').style.display = 'block';
        document.getElementById('vehicle_calculator_error1').style.display = 'none';
    } else {
        document.getElementById('vehicle_calculator_price1').style.display = 'none';
        document.getElementById('vehicle_calculator_error1').style.display = 'block';
    } 
}

function EXP(a,b) {
    var t = 1;
    for(x = 1; x <= b; x++) { 
        t = t * a;
    }
    ret = t;
    return(t);
}


