function pmt(rate, per, nper, pv, fv)
{
   fv = parseFloat(fv);
   nper = parseFloat(nper);
   pv = parseFloat(pv);
   per = parseFloat(per);
   if (( per == 0 ) || ( nper == 0 )){ 
      alert("Calculating with zeros will show you zero!");
      return(0);
   }
   rate = eval((rate)/(per * 100));
   if ( rate == 0 )    // Interest rate is 0
   {
       pmt_value =  (fv + pv)/nper;
   }
   else 
   {
       x = Math.pow(1 + rate,nper);
                   pmt_value = ((rate * (fv + x * pv))/(-1 + x));
   }
   pmt_value = "$" + conv_number(pmt_value,2);               


   return (pmt_value);
}
function conv_number(expr, decplaces) 
{      
     var str = "" + Math.round(eval(expr) * Math.pow(10,decplaces));
     while (str.length <= decplaces) {
           str = "0" + str;
     }
     var decpoint = str.length - decplaces;
     return (str.substring(0,decpoint) + "." + str.substring(decpoint,str.length));}
