I have a mortgage calculator which can produce the following table when "Gen P.I. in new window" is selected (options were 20,000 at 5% for 6 years):
Code:
    Date      Payment   Interest    AppPrin  Principal

  04/21/13                                    20000.00
  05/21/13     322.10      83.33     238.77   19761.23
  06/21/13     322.10      82.34     239.76   19521.47
  07/21/13     322.10      81.34     240.76   19280.71
  08/21/13     322.10      80.34     241.76   19038.95
  09/21/13     322.10      79.33     242.77   18796.18
  10/21/13     322.10      78.32     243.78   18552.40
  11/21/13     322.10      77.30     244.80   18307.60
  12/21/13     322.10      76.28     245.82   18061.78
  01/21/14     322.10      75.26     246.84   17814.94
  02/21/14     322.10      74.23     247.87   17567.07
---------------snip-------------------
If the user wants to change the monthly amount at a future date, I would like to put a link under the date or Principal so these values are filled in. For example, if the user picks 10/21/13 (or 18552.40), I would like for the principal and loan date to change in the parent window. If I could close the PI window at the same time it would be that much better.

This is my current PI function:
Code:
function genpi(parm) {
  var appprin
  var piprin = principal
  var monthlyint
  var pimonthly = monthly
  var lastTarget = monthly / (1 + interest);
  var html = "<html><head><title>PI Report</title></head><body><pre>\n";
  html = html + "    Date      Payment   Interest    AppPrin  Principal\n\n  " +
               formatDate(m1,d1,y1) + "                                   " +
               Nformat(round(piprin)) + "\n"
  while (piprin > 0) {
    monthlyint = piprin * interest;
    if (piprin <= lastTarget) {
      pimonthly = round(piprin + monthlyint)
      appprin = piprin
      piprin = 0;
    }
    else {
      appprin = pimonthly - monthlyint
      piprin -= round(appprin)
    }
    ++m1;
    if (m1 > 12)
      ++y1,m1=1;
    html = html + "  " + formatDate(m1,d1,y1) + "  " +Nformat(pimonthly) + "  " +
                  Nformat(round(monthlyint)) + "  " + Nformat(round(appprin)) +
                  "  " + Nformat(round(piprin)) + "\n"
  }
  html = html + "</pre></body></html>";
  if (parm == "0")
    document.write(html);
  else {
    var wHeight = 85 + payments * 16
    var wWidth  = 475
    var AvailWidth  = window.screen.availWidth
    var hOffset = parseInt(AvailWidth/2) - parseInt(wWidth/2)
    var wOption = "resizable,status,scrollbars,width=" + wWidth + ",height=" + wHeight +
                  ",left=" + hOffset

    var w = window.open("","gentable",wOption);
    w.document.write (html);
    w.document.close();
  }
  monthly = ""; //  To force recalculation for different values
}
TIA