//*******************************************
//DO NOT REMOVE THIS COPYWRITE INFO!
//Rent Vs. Buy Calculator
//2002 Daniel C. Peterson ALL RIGHTS RESERVED
//Created: 04/06/2002
//Last Modified: 07/30/2002
//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 #:5114-1170-67-1128
//Commercial Licence Date:2007-12-22
//*******************************************



function stripNum(num) {

   num=num.toString();


   var len = num.length;
   var rnum = "";
   var test = "";
   var j = 0;

   var b = num.substring(0,1);
   if(b == "-") {
      rnum = "-";
   }

   for(i = 0; i <= len; i++) {

      b = num.substring(i,i+1);

      if(b == "0" || b == "1" || b == "2" || b == "3" || b == "4" || b == "5" || b == "6" || b == "7" || b == "8" || b == "9" || b == ".") {
         rnum = rnum + "" + b;

      }

   }

   if(rnum == "" || rnum == "-") {
      rnum = 0;
   }

   rnum = Number(rnum);

   return rnum;

}



function formatNumber(num) {

var isNeg=0;

    if(num < 0) {
       num=num*-1;
       isNeg=1;
    }

    
	onum=Math.round(num*100)/100;
		
	integer=Math.floor(onum);

	if (Math.ceil(onum) == integer) {
		decimal="00";
	} else{
		decimal=Math.round((onum-integer)*100)
	}
	decimal=decimal.toString();
	if (decimal.length<2) decimal="0"+decimal;

	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;

    if(isNeg == 1) {
       finNum = "-" + finNum;
    }

	return finNum;
}


function computeForm(form, lang) {

if(form.moRent.value == "" || form.moRent.value == 0) {
   alert("Please enter the amount of your monthly rent payment.");
   form.moRent.focus();
   } else
      if(form.homeCost.value == "" || form.homeCost.value == 0) {
      alert("Please enter the purchase price of the home.");
      form.homeCost.focus();
   } else
      if(form.noYears.value == "" || form.noYears.value == 0) {
      alert("Please your number of years you are financing the home for.");
      form.noYears.focus();
   } else
      if(form.payRate.value == "" || form.payRate.value == 0) {
      alert("Please enter the mortgage's annual interest rate.");
      form.payRate.focus();
   } else
      if(form.stayYrs.value == "" || form.stayYrs.value == 0) {
      alert("Please enter the number of years you plan to stay in this property.");
      form.stayYrs.focus();
   } else {

//GET RENTAL INFO
var VmoRent = stripNum(form.moRent.value);
var VtotRent = 0;

var VmoRentIns = stripNum(form.moRentIns.value);
if(VmoRentIns == "" || VmoRentIns == 0) {
VmoRentIns = 0
}

var VinflateRate = stripNum(form.inflateRate.value);
if(VinflateRate == "" || VinflateRate == 0) {
VinflateRate = 0
} else
if(VinflateRate >= 1) {
VinflateRate = VinflateRate / 100;
}
VinflateRate = eval(VinflateRate) + eval(1);

//GET TIME INFO & CONVERT TO MONTHS
var VstayYrs = stripNum(form.stayYrs.value);
var VstayMonths = VstayYrs * 12;
var count = 0;

//GET LOAN INFO
var i = stripNum(form.payRate.value);
if (i > 1.0) {
  i = i / 100.0;
 }
i /= 12;

var VhomeCost = stripNum(form.homeCost.value);
var VnoYears = stripNum(form.noYears.value);

var VdownPmt = stripNum(form.downPmt.value);

var VorigPrin = eval(VhomeCost) - eval(VdownPmt);
var intPort = 0;
var VaccumInt = 0;
var prinPort = 0;
var prin = VorigPrin;

//CALULCATE MONTHLY MORTGAGE PAYMENT
var noMonths = VnoYears * 12;

var pow = 1;
for (var j = 0; j < noMonths; j++)
   pow = pow * (1 + i);

var VmoPmt = (VorigPrin * pow * i) / (pow - 1);

//GET HOME APPRECIATION INFO
var VapprecRate = stripNum(form.apprecRate.value);
if(VapprecRate == "" || VapprecRate == 0) {
VapprecRate = 0;
} else
if(VapprecRate >= 0) {
VapprecRate = VapprecRate / 100;
}
VapprecRate = eval(VapprecRate) + eval(1);
var VaccumApprec = VhomeCost * VapprecRate;

//GET PMI (PRIVATE MORTGAGE INSURANCE) INFO
var Vpmi = stripNum(form.pmi.value);
if(Vpmi == 0 || Vpmi == "") {
Vpmi = 0;
} else
if(Vpmi >= .01) {
Vpmi = Vpmi / 100;
}
Vpmi = Vpmi / 12;
var pmiYN = 0;
var VaccumPmi = 0;
var downPayPerc = VdownPmt / VhomeCost;
if(downPayPerc < .20) {
pmiYN = 1;
VaccumPmi = 0;
}

//*******CALCULATE CLOSING COSTS

//POINTS
var Vfees = stripNum(form.fees.value);
if(Vfees == 0 || Vfees == "") {
Vfees = 0;
} else
if(Vfees >= 1 ) {
Vfees = Vfees / 100;
}
var VfeeCost = VorigPrin * Vfees;

//ORIGINATION FEE
var Vpoints = stripNum(form.points.value);
if(Vpoints == 0 || Vpoints == "") {
Vpoints = 0;
} else
if(Vpoints >= 1 ) {
Vpoints = Vpoints / 100;
}
var VpointCost = VorigPrin * Vpoints;

//OTHER LOAN COSTS
var VloanCosts= stripNum(form.loanCosts.value);
if(VloanCosts == 0 || VloanCosts == "") {
VloanCosts = 0;
}

//TOTAL CLOSING COSTS
var VclosingCosts = eval(VpointCost) + eval(VfeeCost) + eval(VloanCosts);

//GET INVESTMENT INFO
var VinvestIntPort = 0;
var VinvestPrin = eval(VdownPmt) + eval(VclosingCosts);

var earnInt = stripNum(form.saveRate.value);
if (earnInt >= 1.0) {
  earnInt = earnInt / 100.0;
 }
earnInt /= 12;

//INITIATE INFLATION FACTOR
var VaccumInflate = 1;

//*****CYCLE THROUGH NUMBER OF MONTHS
while(count < VstayMonths) {

//ACCUMULATE RENT PAYMENTS & INSURANCE & APPRECIATION
if(count > 0 && count % 12 == 0) {
VaccumApprec = VaccumApprec * VapprecRate;
VmoRent = VmoRent * VinflateRate;
VaccumInflate = VaccumInflate * VinflateRate;
}
VtotRent = eval(VtotRent) + eval(VmoRent);
VtotRent = eval(VtotRent) + eval(VmoRentIns);

//ACCUMULATE INTEREST PAYMENTS
if(count < noMonths) {
   intPort = prin * i;
   VaccumInt = eval(VaccumInt) + eval(intPort)
   prinPort = eval(VmoPmt) - eval(intPort);
   prin = eval(prin) - eval(prinPort);
}

//IF PMI APPLICABLE, ACCUMULATE
if(pmiYN == 1) {
VaccumPmi = eval(VaccumPmi) + eval(Vpmi * prin);
}

//AMORTIZE INVESTED DOWNPAYMENT AND CLOSING COSTS
VinvestIntPort = earnInt * VinvestPrin;
VinvestPrin = eval(VinvestPrin) + eval(VinvestIntPort);

//INCREASE COUNT
count = eval(count) + eval(1);
}

//CALCULATE TOTAL ASSOCIATION DUES
var VassocDues = stripNum(form.assocDues.value);
if(VassocDues == "" || VassocDues == 0) {
VassocDues = 0;
}
var VtotAssocDues = VassocDues * 12 * VstayYrs * VaccumInflate;

//CALCULATE TOTAL PROPERTY TAXES
var VpropTax = stripNum(form.propTax.value);
if(VpropTax == "" || VpropTax == 0) {
VpropTax = 0;
}
var VtotPropTax = VpropTax * VstayYrs * VaccumInflate;

//CALCULATE TOTAL MAINTENANCE COSTS
var Vmaint = form.maint.value;
if(Vmaint == "" || Vmaint == 0) {
Vmaint = 0;
}
var VtotMaintCost = Vmaint * 12 * VstayYrs * VaccumInflate;

//CALCULATE TOTAL HOMEOWNER INSURANCE COSTS
var VhomeIns = stripNum(form.homeIns.value);
if(VhomeIns == "" || VhomeIns == 0) {
VhomeIns = 0;
} else
if(VhomeIns >= .01) {
VhomeIns = VhomeIns / 100;
}
var VtotHomeInsCost = VhomeIns * VhomeCost * VstayYrs * VaccumInflate;

//CALCULATE NET GAIN ON HOME
var VnetGain = eval(VaccumApprec) - eval(VhomeCost);

//CALCULATE TAX SAVINGS ON INTEREST, POINTS AND PROPERTY TAXES
var VtotTaxDeduct = eval(VaccumInt) + eval(VtotPropTax) + eval(VfeeCost);
var VincomeTax = stripNum(form.incomeTax.value);
if(VincomeTax == 0 || VincomeTax == "") {
VincomeTax = 0;
} else
if(VincomeTax >= 1) {
VincomeTax = VincomeTax / 100;
}
var VtotTaxSave = VincomeTax * VtotTaxDeduct;

//CALCULATE REALTOR COMMISSION ON SALE OF HOME
var VrealtorCom = stripNum(form.realtorCom.value);
if(VrealtorCom == 0 || VrealtorCom == "") {
VrealtorCom = 0;
} else
if(VrealtorCom >= 1) {
VrealtorCom = VrealtorCom / 100;
}
var VsellCost = VaccumApprec * VrealtorCom;

//CALCULATE NET EARNINGS ON INVESTMENT
var VinvestEarn = eval(VinvestPrin) - eval(VdownPmt) - eval(VclosingCosts);

form.totRent.value = VtotRent;
form.moPmt.value = VmoPmt;
form.accumInt.value = VaccumInt;
form.closeCosts.value = VclosingCosts;
form.totPropTax.value = VtotPropTax;
form.totMaintCost.value = VtotMaintCost;
form.totHomeInsCost.value = VtotHomeInsCost;
form.netGain.value = VnetGain;
form.pmiCost.value = VaccumPmi;
form.investPrin.value = VinvestEarn;
form.totAssocDues.value = VtotAssocDues;
form.totTaxSave.value = VtotTaxSave;
form.sellCost.value = VsellCost;

var VtotRentCosts = VtotRent;
form.totRentCosts.value = VtotRentCosts;
var VtotRentBenefits = VinvestEarn;
form.totRentBenefits.value = VtotRentBenefits;
var VnetRentCost = eval(VtotRent) - eval(VinvestEarn);

var VtotBuyCosts = eval(VaccumInt) + eval(VclosingCosts) + eval(VtotPropTax) + eval(VtotMaintCost) + eval(VtotHomeInsCost) + eval(VaccumPmi) + eval(VtotAssocDues) + eval(VsellCost);
form.totBuyCosts.value = VtotBuyCosts;

var VtotBuyBenefits = eval(VnetGain) + eval(VtotTaxSave);
form.totBuyBenefits.value = VtotBuyBenefits;
var VnetBuyCost = eval(VtotBuyCosts) - eval(VtotBuyBenefits);


form.netRentCost.value = "$" + formatNumber(VnetRentCost);
form.netBuyCost.value = "$" + formatNumber(VnetBuyCost);

var diff = 0;
var Vsummary = "";
if(VnetRentCost > VnetBuyCost) {
diff = eval(VnetRentCost) - eval(VnetBuyCost);
Vsummary = "You will save $" + formatNumber(diff) + " if you buy instead of rent."
} else {
diff = eval(VnetBuyCost) - eval(VnetRentCost);
Vsummary = "You will save $" + formatNumber(diff) + " if you rent instead of buy."
}

form.results.value = Vsummary;

}

}

function showReport(form, lang) {

computeForm(form, lang);

var part1 = "<HEAD><TITLE>Rent Vs. Buy Report</TITLE>";
part1 += "</HEAD>" + "<BODY BGCOLOR = '#FFFFFF'><BR><BR><CENTER></CENTER>";

var part2 = "<CENTER><TABLE BORDER=1 CELLSPACING=0 CELLPADDING=4><TR>";
part2 += "<TD COLSPAN=2 ALIGN=CENTER><font face='arial'><big><b>Rent</b></big></font>";
part2 += "</TD><TD ALIGN=CENTER><font face='arial'><big><b>vs.</b></big></font></TD>";
part2 += "<TD COLSPAN=2 ALIGN=CENTER><font face='arial'><big><b>Buy</b></big></font>";
part2 += "</TD></TR><TR><TD COLSPAN=2 VALIGN=TOP><font face='arial'><small><b>";
part2 += "Monthly Rent Payment: $" + formatNumber(form.moRent.value) + "<BR>";
part2 += "Annual Return on Investment: " + formatNumber(form.saveRate.value) + "%</b>";
part2 += "</small></font></TD><TD> </TD><TD COLSPAN=2><font face='arial'><small><b>";
part2 += "Purchase Price: $" + formatNumber(form.homeCost.value) + "<BR>Down ";
part2 += "Payment: $" + formatNumber(form.downPmt.value) + "<BR>Mortgage ";
part2 += "Term: " + form.noYears.value + " years<BR>Interest ";
part2 += "Rate: " + formatNumber(form.payRate.value) + "%<BR>Monthly Mortgage ";
part2 += "Payment: $" + formatNumber(form.moPmt.value) + "<BR></b></small></font>";
part2 += "</TD></TR><TR><TD COLSPAN=5><CENTER><font face='arial'><big><b>Cost Benefit ";
part2 += "Analysis</b></big></font><BR><font face='arial'><small><small>Calculations ";
part2 += "are based upon a " + form.inflateRate.value + "% annual inflation rate over ";
part2 += "the course of " + form.stayYrs.value + " years (the time between now and ";
part2 += "when you estimate you would sell the home). Please allow for slight rounding";
part2 += " differences.</small></small></font></CENTER></TD></TR><TR BGCOLOR=\"#CCCCCC\">";
part2 += "<TD><font face='arial'><small><b>Renting Costs</b></small></font></TD><TD>";
part2 += "<font face='arial'><small><b>Amount</b></small></font></TD><TD> </TD><TD>";
part2 += "<font face='arial'><small><b>Buying Costs</b></small></font></TD><TD>";
part2 += "<font face='arial'><small><b>Amount</b></small></font></TD></TR>";

var rows = "";
rows += "<TR><TD><font face='arial'><small>Total Rent & Insurance Payments:</small>";
rows += "</font></TD><TD ALIGN=RIGHT><font face='arial'>";
rows += "<small>$" + formatNumber(form.totRent.value) + "</small></font></TD>";
rows += "<TD> </TD><TD><font face='arial'><small>Total of Interest Payments:</small>";
rows += "</font></TD><TD ALIGN=RIGHT><font face='arial'>";
rows += "<small>$" + formatNumber(form.accumInt.value) + "</small></font></TD></TR>";

rows += "<TR><TD ALIGN=RIGHT> </TD><TD> </TD><TD> </TD><TD>";
rows += "<font face='arial'><small>Total Closing Costs:</small></font></TD>";
rows += "<TD ALIGN=RIGHT><font face='arial'>";
rows += "<small>$" + formatNumber(form.closeCosts.value) + "</small></font></TD></TR>";

rows += "<TR><TD ALIGN=RIGHT> </TD><TD> </TD><TD> </TD><TD>";
rows += "<font face='arial'><small>Total Property Tax Costs:</small></font></TD>";
rows += "<TD ALIGN=RIGHT><font face='arial'>";
rows += "<small>$" + formatNumber(form.totPropTax.value) + "</small></font></TD></TR>";

rows += "<TR><TD ALIGN=RIGHT> </TD><TD> </TD><TD> </TD><TD>";
rows += "<font face='arial'><small>Total Maintenance Costs:</small></font></TD>";
rows += "<TD ALIGN=RIGHT><font face='arial'>";
rows += "<small>$" + formatNumber(form.totMaintCost.value) + "</small></font></TD></TR>";

rows += "<TR><TD ALIGN=RIGHT> </TD><TD> </TD><TD> </TD><TD>";
rows += "<font face='arial'><small>Total Homeowner's Insurance Costs:</small>";
rows += "</font></TD><TD ALIGN=RIGHT><font face='arial'>";
rows += "<small>$" + formatNumber(form.totHomeInsCost.value) + "</small></font></TD></TR>";

rows += "<TR><TD ALIGN=RIGHT> </TD><TD> </TD><TD> </TD><TD>";
rows += "<font face='arial'><small>Total Association Dues:</small></font></TD>";
rows += "<TD ALIGN=RIGHT><font face='arial'>";
rows += "<small>$" + formatNumber(form.totAssocDues.value) + "</small></font></TD></TR>";

rows += "<TR><TD ALIGN=RIGHT> </TD><TD> </TD><TD> </TD><TD>";
rows += "<font face='arial'><small>Total PMI Costs:</small></font></TD>";
rows += "<TD ALIGN=RIGHT><font face='arial'>";
rows += "<small>$" + formatNumber(form.pmiCost.value) + "</small></font></TD></TR>";

rows += "<TR><TD ALIGN=RIGHT> </TD><TD> </TD><TD> </TD><TD>";
rows += "<font face='arial'><small>Cost of selling home:</small></font></TD>";
rows += "<TD ALIGN=RIGHT><font face='arial'>";
rows += "<small>$" + formatNumber(form.sellCost.value) + "</small></font></TD></TR>";

rows += "<TR><TD ALIGN=RIGHT><font face='arial'><small><B>Total Costs</B></small>";
rows += "</font></TD><TD ALIGN=RIGHT><font face='arial'><small>";
rows += "<B>$" + formatNumber(form.totRentCosts.value) + "</B></small></font></TD>";
rows += "<TD> </TD><TD ALIGN=RIGHT><font face='arial'><small><B>Total Costs</B>";
rows += "</small></font></TD><TD ALIGN=RIGHT><font face='arial'><small>";
rows += "<B>$" + formatNumber(form.totBuyCosts.value) + "</B></small></font></TD></TR>";

rows += "<TR><TD ALIGN=RIGHT> </TD><TD> </TD><TD> </TD><TD> </TD>";
rows += "<TD ALIGN=RIGHT> </TD></TR>";

rows += "<TR BGCOLOR=\"#CCCCCC\"><TD><font face='arial'><small><B>Renting Benefits</B>";
rows += "</small></font></TD><TD><font face='arial'><small><B>Amount</B></small></font>";
rows += "</TD><TD> </TD><TD><font face='arial'><small><B>Buying Benefits</B></small>";
rows += "</font></TD><TD><font face='arial'><small><B>Amount</B></small></font></TD></TR>";

rows += "<TR><TD><font face='arial'><small>Interest Earned on Invested Funds:</small>";
rows += "</font></TD><TD ALIGN=RIGHT><font face='arial'>";
rows += "<small>$" + formatNumber(form.investPrin.value) + "</small></font></TD>";
rows += "<TD> </TD><TD><font face='arial'><small>Tax Savings:</small></font></TD>";
rows += "<TD ALIGN=RIGHT><font face='arial'>";
rows += "<small>$" + formatNumber(form.totTaxSave.value) + "</small></font></TD></TR>";

rows += "<TR><TD ALIGN=RIGHT> </TD><TD> </TD><TD> </TD><TD>";
rows += "<font face='arial'><small>Home Appreciation:</small></font></TD><TD ALIGN=RIGHT>";
rows += "<font face='arial'><small>$" + formatNumber(form.netGain.value) + "</small>";
rows += "</font></TD></TR>";

rows += "<TR><TD ALIGN=RIGHT><font face='arial'><small><B>Total Benefits</B></small></font>";
rows += "</TD><TD ALIGN=RIGHT><font face='arial'><small>";
rows += "<B>$" + formatNumber(form.totRentBenefits.value) + "</B></small></font></TD>";
rows += "<TD> </TD><TD ALIGN=RIGHT><font face='arial'><small><B>Total Benefits</B>";
rows += "</small></font></TD><TD ALIGN=RIGHT><font face='arial'><small>";
rows += "<B>$" + formatNumber(form.totBuyBenefits.value) + "</B></small></font></TD></TR>";

rows += "<TR><TD ALIGN=RIGHT><font face='arial'><small><B>NET COST OF RENTING:</B>";
rows += "</small></font></TD><TD ALIGN=RIGHT><font face='arial'><small>";
rows += "<B>" + form.netRentCost.value + "</B></small></font></TD><TD> </TD>";
rows += "<TD ALIGN=RIGHT><font face='arial'><small><B>NET COST OF BUYING:</B></small>";
rows += "</font></TD><TD ALIGN=RIGHT><font face='arial'><small>";
rows += "<B>" + form.netBuyCost.value + "</B></small></font></TD></TR>";

rows += "<TR BGCOLOR=\"#CCCCCC\"><TD COLSPAN=5><font face='arial'><small><B>";
rows += "Summary:</B> " + form.results.value + "</small></font></TD></TR>";

var part4 = "</TABLE><BR><CENTER><FORM METHOD='POST'>";
part4 += "<INPUT TYPE=\'BUTTON\' VALUE=\'Close\' onClick=\'window.close()\'>";
part4 += "</FORM></CENTER></BODY></HTML>";

var schedule = (part1 + "" + part2 + "" + rows + "" + part4 + "");

  reportWin = window.open("","","width=600,height=400,toolbar=yes,menubar=yes,scrollbars=yes");
  reportWin.document.write(schedule);
  reportWin.document.close();

}

function showHelp(form, lang) {

var title = "";
var explain = "";

if (lang==null || lang == "en") {

	if(form.help[0].checked) {
	title = "Monthly rent";
	explain = "Enter the amount of the monthly rent payment.";
	} else
	if(form.help[1].checked) {
	title = "Monthly rental insurance";
	explain = "Enter the monthly rental insurance premium.";
	} else
	if(form.help[2].checked) {
	title = "Expected annual inflation rate";
	explain = "Enter the annual inflation rate. Enter 4% as 4. This is used to inflate ";
	explain += "the costs of rent, insurance, maintenance, dues and property taxes for ";
	explain += "the length of time you will own the home.";
	} else
	if(form.help[3].checked) {
	title = "Purchase price of home";
	explain = "Enter the total purchase price of the home -- not including closing costs.";
	} else
	if(form.help[4].checked) {
	title = "Down payment amount";
	explain = "Enter the amount you will have available to put down on the house after ";
	explain += "you have set aside the cash you will need to pay the closing costs.";
	} else
	if(form.help[5].checked) {
	title = "Length of mortgage term";
	explain = "Enter the number of years you are financing the home for.";
	} else
	if(form.help[6].checked) {
	title = "Mortgage's annual interest rate";
	explain = "Enter the annual interest rate of the morgage. Enter 8% as ";
	explain += "simply 8 (do not include percent sign).";
	} else
	if(form.help[7].checked) {
	title = "Discount points on purchase of the home";
	explain = "Discount points are paid up front in order to reduce the interest ";
	explain += "rate of your mortgage. Each point represents 1% of your mortgage ";
	explain += "balance. Enter 1% as simply 1 (do not include percent sign).";
	} else
	if(form.help[8].checked) {
	title = "Origination fees";
	explain = "The percentage (often as high as 1% of the loan amount) that a lending ";
	explain += "institution charges for processing and originating a loan.";
	} else
	if(form.help[9].checked) {
	title = "Other loan costs";
	explain = "The total of other loan related costs, such as filing fees, appraiser fees, etc.";
	} else
	if(form.help[10].checked) {
	title = "Mortgage Insurance (PMI)";
	explain = "If your downpayment is less than 20% of the value of the home you are buying, ";
	explain += "you may be required to pay mortgage insurance of somewhere between 0.2% and 0.5% of ";
	explain += "your principal balance each month. Enter .04% simply as .4 (do not include percent sign).";
	} else
	if(form.help[11].checked) {
	title = "Homeowner's insurance rate";
	explain = "Your homeowner's insurance rate -- entered as a percentage of your home's value. ";
	explain += "Typical rate is 0.5%. Enter .5% simply as .5 (do not include percent sign).";
	} else
	if(form.help[12].checked) {
	title = "Monthly association dues";
	explain = "If you are a member of a homeowner's association, enter your monthly dues in this field.";
	} else
	if(form.help[13].checked) {
	title = "Average monthly maintenance";
	explain = "Enter the amount you expect to spend on repairing and maintaining your home.";
	} else
	if(form.help[14].checked) {
	title = "Annual property tax";
	explain = "Enter the amount of property taxes you expect to pay each year.";
	} else
	if(form.help[15].checked) {
	title = "State plus Federal income tax rate";
	explain = "Enter your combined state and federal income tax percentage rate. Enter 28% ";
	explain += "simply as 28 (do not include percent sign).";
	} else
	if(form.help[16].checked) {
	title = "Interest rate you expect to earn on savings";
	explain = "Enter the annual interest rate you expect to earn on the down payment and ";
	explain += "closing costs you will invest if you decide to rent instead of buy. ";
	explain += "Enter 7% simply as 7 (do not include percent sign).";
	} else
	if(form.help[17].checked) {
	title = "Expected percentage your home will appreciate by each year";
	explain = "Enter the percentage amount you expect your house to appreciate by each year. ";
	explain += "Enter 3% simply as 3 (do not include percent sign).";
	} else
	if(form.help[18].checked) {
	title = "Number of years you will stay at this property";
	explain = "Enter the number of years you expect to rent or own the property you are ";
	explain += "considering. Typically, if you plan to move out of a home in less than 5 ";
	explain += "years from the date of purchase, you may be better off renting.";
	} else
	if(form.help[19].checked) {
	title = "Realtor commission rate";
	explain = "Enter the percentage of your home's selling price that you expect to pay a ";
	explain += "real estate agent or broker when it's time to sell your home. Enter 7% ";
	explain += "simply as 7 (do not include percent sign).";
	}

	var part1 = "<HEAD><TITLE>Help Screen</TITLE></HEAD>" + "<BODY BGCOLOR = '#FFFFFF'>";
	part1 += "<BR><BR><CENTER><TABLE><TR><TD><font face='arial'><small>";
	part1 += "<B>" + title + ":</B> " + explain + "</small></font></TD></TR></TABLE></CENTER>";

	var part4 = "<BR><CENTER><FORM METHOD='POST'>";
	part4 += "<INPUT TYPE=\'BUTTON\' VALUE=\'Close\' onClick=\'window.close()\'>";
	part4 += "</FORM></CENTER></BODY></HTML>";

} else if (lang=="es") {

	if(form.help[0].checked) {
	title = "Renta mensual";
	explain = "Anote el monto del pago de la renta mensual.";
	} else
	if(form.help[1].checked) {
	title = "Seguro de renta mensual";
	explain = "Anote el monto mensual de la prima del seguro de renta.";
	} else
	if(form.help[2].checked) {
	title = "Tasa anual de inflaci&oacute;n estimada";
	explain = "Tasa anual de inflación estimada: Anote la tasa anual de inflación. Anote 4% como 4. Esto se utiliza para inflar los costos de la renta, seguros, mantenimiento, cuotas, e impuestos sobre la propiedad por el periodo de tiempo que usted será dueño de la casa.";
	} else
	if(form.help[3].checked) {
	title = "Precio de compra de la casa";
	explain = "Anote el precio de compra total de la casa -- sin incluir los castos de cierre.";
	} else
	if(form.help[4].checked) {
	title = "Monto del pago inicial (enganche)";
	explain = "Anote la cantidad que usted tendrá disponible para el pago inicial de la casa , después de que haya separado el efectivo que va a necesitar para cubrir los costos de cierre.";
	} else
	if(form.help[5].checked) {
	title = "Periodo de tiempo de la vigencia de la hipoteca";
	explain = "Anote el número de años por los que usted está refinanciando la casa.";
	} else
	if(form.help[6].checked) {
	title = "Tasa de interés anual de la hipoteca";
	explain = "Anote la tasa de interés anual de la hipoteca. Anote 8% simplemente como 8 (no incluya el signo de porcentaje).";
	} else
	if(form.help[7].checked) {
	title = "Puntos de descuento en la compra de la casa";
	explain = "Los puntos de descuento se pagan al inicio, con objeto de reducir la tasa de interés de su hipoteca. Cada punto representa 1% del saldo de su hipoteca. Anote 1% simplemente como 1 (no incluya el signo de porcentaje).";
	} else
	if(form.help[8].checked) {
	title = "Cargo por apertura";
	explain = "El porcentaje (a menudo tan alto como el 1% del monto del préstamo) que una institución de crédito carga por procesar e iniciar un préstamo.";
	} else
	if(form.help[9].checked) {
	title = "Otros costos del préstamo";
	explain = "El total de otros costos relacionados con el préstamo, tales como honorarios de registro, honorarios del valuador, etc.";
	} else
	if(form.help[10].checked) {
	title = "Seguro de Hipoteca (PMI)";
	explain = "Si su pago inicial (enganche) es menor al 20% del valor de la casa que usted está comprando, se le puede requerir que pague un seguro de hipoteca de entre 0.2% y 0.5% de su saldo de capital cada mes. Anote .04% simplemente como 4 (no incluya el signo de porcentaje).";
	} else
	if(form.help[11].checked) {
	title = "Tasa de seguro de propietarios de casa";
	explain = "Su tasa de seguro de propietarios de casa -- anotado como porcentaje del valor de su casa. La tasa típica es 0.5. Anote 5% simplemente como 5 (no incluya el signo de porcentaje).";
	} else
	if(form.help[12].checked) {
	title = "Cuota mensual de asociación";
	explain = "Si usted es miembro de una asociación de propietarios de casa, anote su cuota mensual en este campo.";
	} else
	if(form.help[13].checked) {
	title = "Mantenimiento mensual promedio";
	explain = "Anote la cantidad que usted espera gastar en reparaciones y mantenimiento de su casa.";
	} else
	if(form.help[14].checked) {
	title = "Impuesto sobre la propiedad anual";
	explain = "Anote el monto de impuesto sobre la propiedad que usted estima pagar cada año.";
	} else
	if(form.help[15].checked) {
	title = "Tasa de Impuesto Sobre la Renta Estatal más Federal";
	explain = "Anote su tasa porcentual combinada de impuesto sobre la renta estatal y federal. Anote 28% simplemente como 28 (no incluya el signo de porcentaje).";
	} else
	if(form.help[16].checked) {
	title = "Tasa de interés que usted estima ganar sobre los ahorros";
	explain = "Anote la tasa de interés anual que usted espera ganar sobre el pago inicial (enganche) y costos de cierre que usted invertirá si se decide a rentar en vez de comprar. Anote 7% simplemente como 7 (no incluya el signo de porcentaje).";
	} else
	if(form.help[17].checked) {
	title = "Porcentaje estimado en que su casa se revaluará cada año";
	explain = "Anote la cantidad porcentual que usted estima se revaluará su casa cada año. Anote 3% simplemente como 3 (no incluya el signo de porcentaje).";
	} else
	if(form.help[18].checked) {
	title = "Número de años que usted permanecerá en esta propiedad";
	explain = "Anote el número de años que usted espera rentar o poseer la propiedad que está considerando. Típicamente, si usted planea mudarse de una  casa  en menos de 5 años a partir de la fecha de compra, a usted podría convenirle más rentar.";
	} else
	if(form.help[19].checked) {
	title = "Tasa de comisión del Agente Inmobiliario";
	explain = "Anote el porcentaje del precio de venta de su casa que usted estima pagar a un agente inmobiliario o corredor (broker) cuando sea el momento de vender su casa. Anote 7% simplemente como 7 (no incluya el signo de porcentaje).";
	}

	var part1 = "<HEAD><TITLE>Ayuda de pantalla</TITLE></HEAD>" + "<BODY BGCOLOR = '#FFFFFF'>";
	part1 += "<BR><BR><CENTER><TABLE><TR><TD><font face='arial'><small>";
	part1 += "<B>" + title + ":</B> " + explain + "</small></font></TD></TR></TABLE></CENTER>";

	var part4 = "<BR><CENTER><FORM METHOD='POST'>";
	part4 += "<INPUT TYPE=\'BUTTON\' VALUE=\'Cerrar\' onClick=\'window.close()\'>";
	part4 += "</FORM></CENTER></BODY></HTML>";

}
var schedule = (part1 + "" + part4 + "");

  reportWin = window.open("","","width=300,height=200,toolbar=yes,menubar=yes,scrollbars=yes");
  reportWin.document.write(schedule);
  reportWin.document.close();

}




