function calc_payments() {
  vp = Number($('#vehicle_price').attr('value').replace(/[A-Za-z\$,]/g,''));
  tm = Number($('#term').attr('value').replace(/[A-Za-z\$,]/g,''));
  ir = Number($('#interest_rate').attr('value').replace(/[A-Za-z\$,]/g,''));
  tv = Number($('#trade_in_value').attr('value').replace(/[A-Za-z\$,]/g,''));
  dp = Number($('#down_payment').attr('value').replace(/[A-Za-z\$,]/g,''));
  st = Number($('#sales_tax').attr('value').replace(/[A-Za-z\$,]/g,''));
  mp = 0.00;
  tc = 0.00;

  // Defaults
  if (vp == null || vp == '') vp = 0.00; // Vehicle Price
  if (tm == null || tm == '') tm = 1.00; // Term
  if (ir == null || ir == '') ir = 0.0001; // Interest Rate
  if (tv == null || tv == '') tv = 0.00; // Trade In
  if (dp == null || dp == '') dp = 0.00; // Down Payment
  if (st == null || st == '') st = 0.00; // Sales Tax

  fp = vp;
  fp = fp - dp;
  fp = fp - tv;
  fp = fp + fp * (st / 100);
  
  ir = (ir / 1200.0);
  mp = (fp * ir) / (1 - Math.pow(1 + ir, -tm));
  tc = (mp * tm) + (dp + tv);

  $('#monthly_payment').html(Math.round(mp*Math.pow(10,0))/Math.pow(10,0));
  $('#bimonthly_payment').html((Math.round(mp*Math.pow(10,0))/Math.pow(10,0)) / 2);
  $('#total_cost').html(Math.round(tc*Math.pow(10,0))/Math.pow(10,0));

  return false;
}
calc_payments();
