function computeForm(form)
 {
   if (dollarCheck(form.principal, "Principal Amount", false, false))
    {
      var principal = form.principal.value.replace(/[ ,\$]/g, "");

      if (percentCheck(form.interest, "Interest", false, false))
       {
         if (numberCheck(form.years, "Number of Years", false, false))
          {
            var payments = form.years.value;

            payments = payments * 12;

            var i = form.interest.value.replace(/[ %]/g, "");
	    
            if (i > 1.0)
             {
               i = i / 100.0;

               //form.interest.value = i;
             }

            i /= 12;

            var pow = 1;

            for (var j = 0; j < payments; j++)
             {
               pow = pow * (1 + i);
             }

            var hold = (principal * pow * i) / (pow - 1)

            hold *= 100;

            hold = Math.round(hold);

            form.payment.value = "$" + hold/100.0;
          }
         else
          {
            form.years.select();
            form.years.focus();
          }
       }
      else
       {
         form.interest.select();
         form.interest.focus();
       }
    }
   else
    {
      form.principal.select();
      form.principal.focus();
    }

}

function NewWindow(sURL, iHeight, iWidth)
{
  var x, y;

  if ((screen.availWidth-iWidth) > 0)
    x = (screen.availWidth-iWidth)/2;
  else
    x = 0;

  if ((screen.availHeight-iHeight) > 0)
    y = (screen.availHeight-iHeight)/2;
  else
    y = 0;

  link = window.open(sURL, "NewWindow",
              "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0," +
              "width="+(iWidth+25)+",height="+(iHeight+35)+",left="+x+",top="+y);

  link.opener = this.window;

}

function NewWindowFixed(sURL, iWidth, iHeight)
{
  var x, y;

  if ((screen.availWidth-iWidth) > 0)
    x = (screen.availWidth-iWidth)/2;
  else
    x = 0;

  if ((screen.availHeight-iHeight) > 0)
    y = (screen.availHeight-iHeight)/2;
  else
    y = 0;

  link = window.open(sURL, "NewWindow",
              "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0," +
              "width="+iWidth+",height="+iHeight+",left="+x+",top="+y);

  link.opener = this.window;
}
