//*******************************************
//DO NOT REMOVE THIS COPYWRITE INFO!
//Mortgage Qualification Calculator V1.1
//2003 Daniel C. Peterson ALL RIGHTS RESERVED
//Created: 07/08/2003
//Last Modified: 07/08/2003
//This script may not be copied, edited, distributed or reproduced
//without express written permission from
//Daniel C. Peterson of Web Winder Website Services
//For commercial use rates, contact:
//Dan Peterson:
//Web Winder Website Services
//P.O. Box 11
//Bemidji, MN  56619
//dan@webwinder.com
//http://www.webwinder.com
//Commercial User Licence #:2046-475-104-461
//Commercial Licence Date:2004-10-27
//*******************************************



function stripNum(num) {

var iPercent
var iDollar
var iSpace
var iComma
var numLength = num.length

//lalalla Line #114

if(numLength > 0) {

   num=num.toString();

   iPercent = num.indexOf("%");
   if(iPercent >= 0) {
      num=num.substring(0,iPercent) + "" + num.substring(iPercent + 1,numLength);
      numLength=num.length;
      }
   iDollar = num.indexOf("$");
   if(iDollar >= 0) {
      num=num.substring(0,iDollar) + "" + num.substring(iDollar + 1,numLength);
      numLength=num.length;
      }
   iSpace = num.indexOf(" ");
   if(iSpace >= 0) {
      num=num.substring(0,iSpace) + "" + num.substring(iSpace + 1,numLength);
      numLength=num.length;
      }
   iComma = num.indexOf(",");
   if(iComma >= 0) {
      while(iComma >=1) {
         num=num.substring(0,iComma) + "" + num.substring(iComma + 1,numLength);
         numLength=num.length;
         iComma = num.indexOf(",");
      }
      }

      num = eval(num);


} else {

num = 0;

}

return num;

}




function computeMonthlyPayment(prin, numPmts, intRate) {

var pmtAmt = 0;

if(intRate == 0) {
   pmtAmt = prin / numPmts;
} else {

   if (intRate >= 1.0) {
     intRate = intRate / 100.0;
   }
   intRate /= 12;

   var pow = 1;
   for (var j = 0; j < numPmts; j++)
      pow = pow * (1 + intRate);

   pmtAmt = (prin * pow * intRate) / (pow - 1);

}

return pmtAmt;

}




function formatNumberDec(num, places, comma) {

var isNeg=0;

    if(num < 0) {
       num=num*-1;
       isNeg=1;
    }

    var myDecFact = 1;
    var myPlaces = 0;
    var myZeros = "";
    while(myPlaces < places) {
       myDecFact = myDecFact * 10;
       myPlaces = eval(myPlaces) + eval(1);
       myZeros = myZeros + "0";
    }

	onum=Math.round(num*myDecFact)/myDecFact;

	integer=Math.floor(onum);

	if (Math.ceil(onum) == integer) {
		decimal=myZeros;
	} else{
		decimal=Math.round((onum-integer)* myDecFact)
	}
	decimal=decimal.toString();
	if (decimal.length<places) {
        fillZeroes = places - decimal.length;
	   for (z=0;z<fillZeroes;z++) {
        decimal="0"+decimal;
        }
     }

   if(places > 0) {
      decimal = "." + decimal;
   }

   if(comma == 1) {
	integer=integer.toString();
	var tmpnum="";
	var tmpinteger="";
	var y=0;

	for (x=integer.length;x>0;x--) {
		tmpnum=tmpnum+integer.charAt(x-1);
		y=y+1;
		if (y==3 & x>1) {
			tmpnum=tmpnum+",";
			y=0;
		}
	}

	for (x=tmpnum.length;x>0;x--) {
		tmpinteger=tmpinteger+tmpnum.charAt(x-1);
	}


	finNum=tmpinteger+""+decimal;
   } else {
      finNum=integer+""+decimal;
   }

    if(isNeg == 1) {
       finNum = "-" + finNum;
    }

	return finNum;
}


function computeForm(form) {

//IF REQUIRED FIELDS EMPTY, ALERT AND KILL SCRIPT
if(form.grossPay.value == "" || form.grossPay.value == 0) {
   alert("Please enter your gross annual income.");
   form.grossPay.focus();
   } else
if(form.downPay.value == "" || form.downPay.value == 0) {
   alert("Please enter the amount you have available for the down payment. You will likely need at least 5 percent of the purchase price in order to qualify for the mortgage.");
   form.downPay.focus();
   } else
if(form.intRate.value == "" || form.intRate.value == 0) {
   alert("Please enter the annual interest rate you expect to pay.");
   form.intRate.focus();
   } else {
//START REQUIRED FIELD VARIFICATION

//SET OPTIONAL BLANK FIELDS EQUAL TO ZERO;
var VmonthlyDebtPmts = stripNum(form.moDebts.value);
var VmoInsurance = stripNum(form.moInsurance.value);
var VmoPropTax = stripNum(form.moPropTax.value);



//COMPUTE MONTHLY INCOME BASED ON ANNUAL INCOME
var VgrossPay = stripNum(form.grossPay.value);
var monthlyIncome = VgrossPay /12;

//MORTGAGE PAYMENT CAN'T EXCEED 28% OF MONTHLY INCOME
var VpmtRatio = stripNum(form.pmtRatio.value);
if(VpmtRatio >= 1) {
   VpmtRatio /= 100;
}
var maxIncomePmt = monthlyIncome * VpmtRatio;

//MORTGAGE PAYMENT PLUS DEBT PMTS CAN'T EXCEED 36% OF MONTHLY INCOME
var VdebtRatio = stripNum(form.debtRatio.value);
if(VdebtRatio >= 1) {
   VdebtRatio /= 100;
}
var maxDebtToIncomePmt = eval(VdebtRatio * monthlyIncome) - eval(VmonthlyDebtPmts);

//USE THE LOWER OF 28% OR 36% AS MAXIMUM HOUSE PAYMENT
var maxHousePmt = 0;
if(maxIncomePmt > maxDebtToIncomePmt) {
   maxHousePmt = maxDebtToIncomePmt;
   } else {
   maxHousePmt = maxIncomePmt;
   }

//IF MAX HOUSE PAYMENT IS LESS THAN $1, ALERT & KILL SCRIPT
if(maxHousePmt < 1) {
   form.downPay2.value = "";
   form.loanAmt.value = "";
   form.homePrice.value = "";
   form.moPay.value = "";
   alert("Based on industry standards you would not qualify for a home mortgage. In order to qualify you will need to either increase your annual income or lower your monthly debt payments, or a combination of both.")
   } else {
//START HOUSE PAYMENT VERIFICATION

//ADJUST HOUSE PAYMENT DOWN TO REFLECT MONTHLY PMI, INSURANCE & TAX
var VmoPMIPercent = stripNum(form.moPMIPercent.value);
VmoPMIPercent /= 100;
VmoPMIOneDollar = eval(1) - eval(VmoPMIPercent);

maxHousePmt = eval(maxHousePmt) - (eval(VmoInsurance) + eval(VmoPropTax));

maxHousePmt = eval(maxHousePmt * VmoPMIOneDollar);

//GATHER VARIABLES FOR PAYMENT AND PRINCIPLE COMPUTATIONS
var VintRate = stripNum(form.intRate.value);
     if(VintRate >= 1) {
     VintRate = VintRate / 100;
     } else {
     VintRate = VintRate;
     }

    VintRate = VintRate / 12;


    var Vterm = 0;
    if(form.term.selectedIndex == 0) {
       Vterm = 180;
       } else
       if(form.term.selectedIndex == 1) {
       Vterm = 240;
       } else {
       Vterm = 360;
       }

//COMPUTE PRINCIPAL PAID ON MAXIMUM MONTHLY PAYMENT
var pow = 1;

for (var j = 0; j < Vterm; j++)
    pow = pow * (1 + VintRate);

var maxLoanAmt = ((pow - 1) * maxHousePmt) / (pow * VintRate);


var VdownPay2 = stripNum(form.downPay.value);
//ENTER TOTALS
form.downPay2.value = "$" + formatNumberDec(VdownPay2,2,1);
form.loanAmt.value = "$" + formatNumberDec(maxLoanAmt,2,1);
form.homePrice.value = "$" + formatNumberDec(eval(VdownPay2) + eval(maxLoanAmt),2,1);
form.moPay.value = "$" + formatNumberDec(maxHousePmt,2,1);

//DISPLAY SUMMARY
form.enterHelp.value = ("After testing your entries against mortgage industry standards the highest priced house you could qualify for is " + form.homePrice.value + ".  Obviously this amount is merely an estimate.  The actual amount will vary from lender to lender.")

//DISPLAY SUMMARY
form.resultHelp.value = ("Place your mouse over the question marks at left to see an explanation of each result.")

//END HOUSE PAYMENT VERIFICATION
      }

//END REQUIRED FIELD VARIFICATION
   }

}

//GIVE ENTRY INSTRUCTIONS
function help01(form) {
document.mortCalc.enterHelp.value = ("ENTER: Your gross annual household income.  This is the amount before taxes are deducted.");
}

function skipTo(form) {
form.enterHelp.value = "";
form.downPay.focus();
}

function help02(form) {
document.mortCalc.enterHelp.value = ("ENTER: The total of your non-mortgage monthly debt payments. This would include car loans, student loans, credit card payments and so on.");
}

function help03(form) {
document.mortCalc.enterHelp.value = ("ENTER: The amount you have available to cover the mortgage down payment and closing costs.");
}

function help04(form) {
document.mortCalc.enterHelp.value = ("ENTER: The annual interest rate you expect to pay on this mortgage. You can enter the rate either as a percentage (8.25) or as a decimal (.0825), whichever you prefer.");
}

function help05(form) {
document.mortCalc.enterHelp.value = ("ENTER: The monthly Private Mortgage Insurance (PMI) you expect to pay. If your downpayment is less than 20% of the value of the home you are buying, you may be required to pay mortgage insurance of somewhere between 0.2% and 0.5% of your principal balance each month. Enter .04% simply as .4 (do not include percent sign).");
}

function help06(form) {
document.mortCalc.enterHelp.value = ("ENTER: The monthly insurance payment you expect to pay. As a rule of thumb, you can expect to pay .125% (home price X .00125) of the purchase price per month.");
}

function help07(form) {
document.mortCalc.enterHelp.value = ("ENTER: The monthly property tax payment you expect to pay. As a rule of thumb, you can expect to pay .027% (home price X .00027) of the purchase price per month.");
}

function help08(form) {
document.mortCalc.enterHelp.value = ("ENTER: Your area's maximum mortgage payment to income ratio. The default ratio is 28%, in which case your mortgage payment cannot exceed 28% of your monthly income.");
}

function help09(form) {
document.mortCalc.enterHelp.value = ("ENTER: Your area's maximum mortgage payment plus debt payments to income ratio. The default ratio is 36%, in which case your mortgage payment plus your debt payments cannot exceed 36% of your monthly income.");
}



//GIVE RESULT EXPLANATIONS
function help10(form) {
document.mortCalc.resultHelp.value = ("RESULT: This is your original down payment amount.");
}

function help11(form) {
document.mortCalc.resultHelp.value = ("RESULT: This is the maximum mortgage you would qualify for based on your current entries.");
}

function help12(form) {
document.mortCalc.resultHelp.value = ("RESULT: This is home price you could afford (the total of your down payment and your maximum mortgage amount.");
}

function help13(form) {
document.mortCalc.resultHelp.value = ("RESULT: This is your maximum monthly mortgage payment based upon your current entries.");
}

function amortSchedule(form) {

if(document.mortCalc.loanAmt.value.length == 0) {

   alert("Please calculate the form before attempting to create the amortization schedule.");
   document.mortCalc.grossPay.focus();
} else

if(document.mortCalc.intRate.value == 0) {
   alert("Please calculate the form before attempting to create the amortization schedule.");
   document.mortCalc.intRate.focus();

} else {

var Vprincipal = stripNum(document.mortCalc.loanAmt.value);

var VintRate = stripNum(document.mortCalc.intRate.value);

var VnumYears = document.mortCalc.term.options[document.mortCalc.term.selectedIndex].value;

var VnumPmts = VnumYears * 12;



var pmtAmt = stripNum(document.mortCalc.moPay.value);


var prin = Vprincipal;

var Vint = VintRate;

if(Vint >= 1) {

   Vint /= 100;

   }

Vint /= 12;



var nPer = VnumPmts;



var intPort = 0;

var accumInt = 0;

var prinPort = 0;

var accumPrin = 0;

var count = 0;

var pmtRow = "";

var pmtNum = 0;



var today = new Date();

var dayFactor = today.getTime();

var pmtDay = today.getDate();

var loanMM = today.getMonth() + 1;

var loanYY = today.getYear();
if(loanYY < 1900) {
   loanYY += 1900;
}

var loanDate = (loanMM + "/" + pmtDay + "/" + loanYY);

var monthMS = 86400000 * 30.4;

var pmtDate = 0;

var displayPmtAmt = 0;

var accumYearPrin = 0;
var accumYearInt = 0;

while(count < nPer) {

   if(count < (nPer - 1)) {

      intPort = prin * Vint;
      intPort *= 100;
      intPort = Math.round(intPort);
      intPort /= 100;

      accumInt = eval(accumInt) + eval(intPort);
      accumYearInt = eval(accumYearInt) + eval(intPort);

      prinPort = eval(pmtAmt) - eval(intPort);
      prinPort *= 100;
      prinPort = Math.round(prinPort);
      prinPort /= 100;

      accumPrin = eval(accumPrin) + eval(prinPort);
      accumYearPrin = eval(accumYearPrin) + eval(prinPort);

      prin = eval(prin) - eval(prinPort);

      displayPmtAmt = eval(prinPort) + eval(intPort);

   } else {

      intPort = prin * Vint;
      intPort *= 100;
      intPort = Math.round(intPort);
      intPort /= 100;

      accumInt = eval(accumInt) + eval(intPort);
      accumYearInt = eval(accumYearInt) + eval(intPort);

      prinPort = prin;

      accumPrin = eval(accumPrin) + eval(prinPort);
      accumYearPrin = eval(accumYearPrin) + eval(prinPort);

      prin = 0;

      //pmtAmt = eval(intPort) + eval(prinPort);
      displayPmtAmt = eval(prinPort) + eval(intPort);
   }

   count = eval(count) + eval(1);

   pmtNum = eval(pmtNum) + eval(1);

   dayFactor = eval(dayFactor) + eval(monthMS);

   pmtDate = new Date(dayFactor);

   pmtMonth = pmtDate.getMonth();

   pmtMonth = pmtMonth + 1;

   pmtYear = pmtDate.getYear();
   if(pmtYear < 1900) {
      pmtYear += 1900;
   }


   pmtString = (pmtMonth + "/" + pmtDay + "/" + pmtYear);

   pmtRow = ("" + pmtRow + "<tr><td align=right><font face='arial'><small>" + pmtNum + "</small></font></td><td align=right><font face='arial'><small>" + pmtString + "</small></font></td><td align=right><font face='arial'><small>" + formatNumberDec(prinPort,2,1) + "</small></font></td><td align=right><font face='arial'><small>" + formatNumberDec(intPort,2,1) + "</small></font></td><td align=right><font face='arial'><small>" + formatNumberDec(displayPmtAmt,2,1) + "</small></font></td><td align=right><font face='arial'><small>" + formatNumberDec(prin,2,1) + "</small></font></td></tr>");

   if(pmtMonth == 12 || count == nPer) {

pmtRow = ("" + pmtRow + "<tr bgcolor='#dddddd'><td align=right><font face='arial'><small>Total</small></font></td><td align=left><font face='arial'><small>" + pmtYear + "</small></font></td><td align=right><font face='arial'><small>" + formatNumberDec(accumYearPrin,2,1) + "</small></font></td><td align=right><font face='arial'><small>" + formatNumberDec(accumYearInt,2,1) + "</small></font></td><td align=right><font face='arial'><small> </small></font></td><td align=right><font face='arial'><small> </small></font></td></tr>");

   accumYearPrin = 0;
   accumYearInt = 0;

   }

      if(count > 600) {

         alert("Using your current entries you will never pay off this loan.");

         break;

         } else {

         continue;

         }

    }



var part1 = ("<head><title>Amortization Schedule</title></head>" + "<body bgcolor= '#FFFFFF'><br><br><center><font face='arial'><big><b>Amortization Schedule</b></big></font></center>");



var part2 = ("<center><table border=1 cellpadding=2 cellspacing=0><tr><td colspan=6><font face='arial'><small><b>Loan Date: " + loanDate + "<br>Principal: $" + formatNumberDec(Vprincipal,2,1) + "<br># of Payments: " + nPer + "<br>Interest Rate: " + formatNumberDec(VintRate,3,0) + "%<br>Payment: $" + formatNumberDec(pmtAmt,2,1) + "</b></small></font></td></tr><tr><td colspan=6><center><font face='arial'><b>Schedule of Payments</b></font><br><font face='arial'><small><small>Please allow for slight rounding differences.</small></small></font></center></td></tr><tr bgcolor='silver'><td align='center'><font face='arial'><small><b>Pmt #</b></small></font></td><td align='center'><font face='arial'><small><b>Date</b></small></font></td><td align='center'><font face='arial'><small><b>Principal</b></small></font></td><td align='center'><font face='arial'><small><b>Interest</b></small></font></td><td align='center'><font face='arial'><small><b>Payment</b></small></font></td><td align='center'><font face='arial'><small><b>Balance</b></small></font></td></tr>");



var part3 = ("" + pmtRow + "");



var part4 = ("<tr><td colspan='2'><font face='arial'><small><b>Grand Total</b></small></font></td><td align=right><font face='arial'><small><b>" + formatNumberDec(accumPrin,2,1) + "</b></small></font></td><td align=right><font face='arial'><small><b>" + formatNumberDec(accumInt,2,1) + "</b></small></font></td><td> </td><td> </td></tr></table><br><center><form method='post'><input type='button' value='Close Window' onClick='window.close()'></form></center></body></html>");



var schedule = (part1 + "" + part2 + "" + part3 + part4 + "");



  reportWin = window.open("","","width=500,height=400,toolbar=yes,menubar=yes,scrollbars=yes");

  reportWin.document.write(schedule);

  reportWin.document.close();



   }



}

function printFriendForm(form) {


var printRows = "";

printRows = printRows + "<TR>";
printRows = printRows + "<TD colspan='2'>";
printRows = printRows + "<font face='arial'><small><b>";
printRows = printRows + "Inputs";
printRows = printRows + "</b></small></font>";
printRows = printRows + "</TR>";

printRows = printRows + "<TR>";
printRows = printRows + "<TD>";
printRows = printRows + "<font face='arial'><small>";
printRows = printRows + "Gross annual income:";
printRows = printRows + "</small></font>";
printRows = printRows + "</TD>";
printRows = printRows + "<TD align='right'>";
printRows = printRows + "<font face='arial'><small>";

var VgrossPay = stripNum(form.grossPay.value);
printRows = printRows + "$" + formatNumberDec(VgrossPay,2,1);

printRows = printRows + "</small></font>";
printRows = printRows + "</TD>";
printRows = printRows + "</TR>";


printRows = printRows + "<TR>";
printRows = printRows + "<TD>";
printRows = printRows + "<font face='arial'><small>";
printRows = printRows + "Monthly debt payments:";
printRows = printRows + "</small></font>";
printRows = printRows + "</TD>";
printRows = printRows + "<TD align='right'>";
printRows = printRows + "<font face='arial'><small>";

var VmoDebts = stripNum(form.moDebts.value);
printRows = printRows + "$" + formatNumberDec(VmoDebts,2,1);

printRows = printRows + "</small></font>";
printRows = printRows + "</TD>";
printRows = printRows + "</TR>";


printRows = printRows + "<TR>";
printRows = printRows + "<TD>";
printRows = printRows + "<font face='arial'><small>";
printRows = printRows + "Down payment:";
printRows = printRows + "</small></font>";
printRows = printRows + "</TD>";
printRows = printRows + "<TD align='right'>";
printRows = printRows + "<font face='arial'><small>";

var VdownPay = stripNum(form.downPay.value);
printRows = printRows + "$" + formatNumberDec(VdownPay,2,1);

printRows = printRows + "</small></font>";
printRows = printRows + "</TD>";
printRows = printRows + "</TR>";


printRows = printRows + "<TR>";
printRows = printRows + "<TD>";
printRows = printRows + "<font face='arial'><small>";
printRows = printRows + "Annual interest rate:";
printRows = printRows + "</small></font>";
printRows = printRows + "</TD>";
printRows = printRows + "<TD align='right'>";
printRows = printRows + "<font face='arial'><small>";

var VintRate = stripNum(form.intRate.value);
printRows = printRows + "" + formatNumberDec(VintRate,3,0) + "%";

printRows = printRows + "</small></font>";
printRows = printRows + "</TD>";
printRows = printRows + "</TR>";


printRows = printRows + "<TR>";
printRows = printRows + "<TD>";
printRows = printRows + "<font face='arial'><small>";
printRows = printRows + "Monthly Private Mortgage Insurance (PMI %):";
printRows = printRows + "</small></font>";
printRows = printRows + "</TD>";
printRows = printRows + "<TD align='right'>";
printRows = printRows + "<font face='arial'><small>";

var VmoPMIPercent = stripNum(form.moPMIPercent.value);
printRows = printRows + "" + formatNumberDec(VmoPMIPercent,2,0) + "%";

printRows = printRows + "</small></font>";
printRows = printRows + "</TD>";
printRows = printRows + "</TR>";


printRows = printRows + "<TR>";
printRows = printRows + "<TD>";
printRows = printRows + "<font face='arial'><small>";
printRows = printRows + "Monthly insurance:";
printRows = printRows + "</small></font>";
printRows = printRows + "</TD>";
printRows = printRows + "<TD align='right'>";
printRows = printRows + "<font face='arial'><small>";

var VmoInsurance = stripNum(form.moInsurance.value);
printRows = printRows + "$" + formatNumberDec(VmoInsurance,2,1);

printRows = printRows + "</small></font>";
printRows = printRows + "</TD>";
printRows = printRows + "</TR>";


printRows = printRows + "<TR>";
printRows = printRows + "<TD>";
printRows = printRows + "<font face='arial'><small>";
printRows = printRows + "Monthly property tax:";
printRows = printRows + "</small></font>";
printRows = printRows + "</TD>";
printRows = printRows + "<TD align='right'>";
printRows = printRows + "<font face='arial'><small>";

var VmoPropTax = stripNum(form.moPropTax.value);
printRows = printRows + "$" + formatNumberDec(VmoPropTax,2,1);

printRows = printRows + "</small></font>";
printRows = printRows + "</TD>";
printRows = printRows + "</TR>";



printRows = printRows + "<TR>";
printRows = printRows + "<TD>";
printRows = printRows + "<font face='arial'><small>";
printRows = printRows + "Length of the mortgage:";
printRows = printRows + "</small></font>";
printRows = printRows + "</TD>";
printRows = printRows + "<TD align='right'>";
printRows = printRows + "<font face='arial'><small>";

var Vterm = form.term.options[form.term.selectedIndex].value;
printRows = printRows + "" + Vterm;

printRows = printRows + "</small></font>";
printRows = printRows + "</TD>";
printRows = printRows + "</TR>";


printRows = printRows + "<TR>";
printRows = printRows + "<TD>";
printRows = printRows + "<font face='arial'><small>";
printRows = printRows + "Maximum mortgage payment to income ratio (%):";
printRows = printRows + "</small></font>";
printRows = printRows + "</TD>";
printRows = printRows + "<TD align='right'>";
printRows = printRows + "<font face='arial'><small>";

var VpmtRatio = stripNum(form.pmtRatio.value);
printRows = printRows + "" + formatNumberDec(VpmtRatio,2,1) + "%";

printRows = printRows + "</small></font>";
printRows = printRows + "</TD>";
printRows = printRows + "</TR>";


printRows = printRows + "<TR>";
printRows = printRows + "<TD>";
printRows = printRows + "<font face='arial'><small>";
printRows = printRows + "Maximum debt payments to income ratio (%):";
printRows = printRows + "</small></font>";
printRows = printRows + "</TD>";
printRows = printRows + "<TD align='right'>";
printRows = printRows + "<font face='arial'><small>";

var VdebtRatio = stripNum(form.debtRatio.value);
printRows = printRows + "" + formatNumberDec(VdebtRatio) + "%";

printRows = printRows + "</small></font>";
printRows = printRows + "</TD>";
printRows = printRows + "</TR>";

printRows = printRows + "<TR>";
printRows = printRows + "<TD colspan='2'>";
printRows = printRows + "<font face='arial'><small><b>";
printRows = printRows + "Results";
printRows = printRows + "</b></small></font>";
printRows = printRows + "</TR>";


printRows = printRows + "<TR>";
printRows = printRows + "<TD>";
printRows = printRows + "<font face='arial'><small>";
printRows = printRows + "Downpayment:";
printRows = printRows + "</small></font>";
printRows = printRows + "</TD>";
printRows = printRows + "<TD align='right'>";
printRows = printRows + "<font face='arial'><small>";

var VdownPay2 = stripNum(form.downPay2.value);
printRows = printRows + "$" + formatNumberDec(VdownPay2,2,1);

printRows = printRows + "</small></font>";
printRows = printRows + "</TD>";
printRows = printRows + "</TR>";


printRows = printRows + "<TR>";
printRows = printRows + "<TD>";
printRows = printRows + "<font face='arial'><small>";
printRows = printRows + "Loan Amount:";
printRows = printRows + "</small></font>";
printRows = printRows + "</TD>";
printRows = printRows + "<TD align='right'>";
printRows = printRows + "<font face='arial'><small>";

var VloanAmt = stripNum(form.loanAmt.value);
printRows = printRows + "$" + formatNumberDec(VloanAmt,2,1);

printRows = printRows + "</small></font>";
printRows = printRows + "</TD>";
printRows = printRows + "</TR>";



printRows = printRows + "<TR>";
printRows = printRows + "<TD>";
printRows = printRows + "<font face='arial'><small>";
printRows = printRows + "Home Price:";
printRows = printRows + "</small></font>";
printRows = printRows + "</TD>";
printRows = printRows + "<TD align='right'>";
printRows = printRows + "<font face='arial'><small>";

var VhomePrice = stripNum(form.homePrice.value);
printRows = printRows + "$" + formatNumberDec(VhomePrice,2,1);

printRows = printRows + "</small></font>";
printRows = printRows + "</TD>";
printRows = printRows + "</TR>";


printRows = printRows + "<TR>";
printRows = printRows + "<TD>";
printRows = printRows + "<font face='arial'><small>";
printRows = printRows + "Monthly Payment:";
printRows = printRows + "</small></font>";
printRows = printRows + "</TD>";
printRows = printRows + "<TD align='right'>";
printRows = printRows + "<font face='arial'><small>";

var VmoPay = stripNum(form.moPay.value);
printRows = printRows + "$" + formatNumberDec(VmoPay,2,1);

printRows = printRows + "</small></font>";
printRows = printRows + "</TD>";
printRows = printRows + "</TR>";

var part1 = ("<head><title>Calculator Results</title></head>" + "<body bgcolor= '#FFFFFF'><br><br><center><font face='arial'><big><b>Mortgage Qualification Calculations</b></big></font></center>");



var part2 = ("<center><table border=1 cellpadding=2 cellspacing=0>");



var part3 = ("" + printRows + "");



var part4 = ("</table><br><center><form method='post'><input type='button' value='Close Window' onClick='window.close()'></form></center></body></html>");



var schedule = (part1 + "" + part2 + "" + part3 + part4 + "");



  reportWin = window.open("","","width=500,height=400,toolbar=yes,menubar=yes,scrollbars=yes");

  reportWin.document.write(schedule);

  reportWin.document.close();


}