function calculate() {
      var nInvoice = parseFloat(document.lease.invoice.value);
	  var nT = document.lease.length.selectedIndex;
      var nMonths = parseFloat(document.lease.length[nT].value);
      var nP = document.lease.province.selectedIndex;
      var nProvtax = parseFloat(document.lease.province[nP].value);
      var nReduction = parseFloat(document.lease.reduction.value);
      var nDeposit = parseFloat(document.lease.deposit.value);
      var nResidual = parseFloat(document.lease.residual.value);
      var nRate = parseFloat(document.lease.rate.value); 
	  
      var nGst=0;
      var nPst=0;
   

 
    var nTotal = (nReduction + nDeposit);
    var nCharge = nRate/2400 * (nInvoice + nResidual); 
    var nDepreciation = (nInvoice - nResidual) / nMonths;
    var nPayment =( nCharge + nDepreciation)-nReduction/nMonths;
	  if (nP==0) {
         nGst = (nPayment/100) * 5;
         nPst = ((nPayment + nGst)/100) * nProvtax;
        }
     else if (nP == 1) {
        nGst = 0;
        nPst = (nPayment / 100) * nProvtax;
        }
     else if (nP == 2) {
        nGst = 0;
        nPst = (nPayment /100) * nProvtax;
       }
     else if (nP == 3) {
        nGst = 0;
        nPst = (nPayment /100) * nProvtax;
      }
     else if (nP == 4) {
        nGst =(nPayment /100) * 5;
        nPst =((nPayment + nGst)/100) * nProvtax;
   
        }
    else if (nP == 7) {
        nGst =(nPayment /100) * 5;
        nPst =(nPayment / 100) * nProvtax;
      }
   else if (nP == 13) {
        nGst=0;
     }
    else {
        nGst = (nPayment / 100) * 5;
        nPst = (nPayment  / 100) * nProvtax;
     }
    var nEnd =( nCharge + nDepreciation + nPst + nGst )- nReduction/nMonths;
  
    document.lease.total.value = Math.round(nTotal);
    document.lease.charge.value = Math.round(nCharge);
    document.lease.payment.value = Math.round(nPayment);
	document.lease.end.value = Math.round(nEnd);
	document.lease.gst.value=Math.round(nGst);
	document.lease.pst.value=Math.round(nPst);
}
 