//*******************************************//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 #:2167-513-67-496//Commercial Licence Date:2005-01-06//*******************************************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 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) {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.payRate.value == 0) {      alert("Please enter the number of years you plan to stay in this property.");      form.payRate.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) {computeForm(form);var part1 = ("<HEAD><TITLE>Rent Vs. Buy Report</TITLE></HEAD>" + "<BODY BGCOLOR = '#FFFFFF'><BR><BR><CENTER></CENTER>");var part2 = ("<CENTER><TABLE BORDER=1 CELLSPACING=0 CELLPADDING=4><TR><TD COLSPAN=2 ALIGN=CENTER><font face='arial'><big><b>Rent</b></big></TD><TD ALIGN=CENTER><font face='arial'><big><b>vs.</b></big></TD><TD COLSPAN=2 ALIGN=CENTER><font face='arial'><big><b>Buy</b></big></TD></TR><TR><TD COLSPAN=2 VALIGN=TOP><font face='arial'><small><b>Monthly Rent Payment: $" + formatNumber(form.moRent.value) + "<BR>Annual Return on Investment: " + formatNumber(form.saveRate.value) + "%</b></small></TD><TD></TD><TD COLSPAN=2><font face='arial'><small><b>Purchase Price: $" + formatNumber(form.homeCost.value) + "<BR>Down Payment: $" + formatNumber(form.downPmt.value) + "<BR>Mortgage Term: " + form.noYears.value + " years<BR>Interest Rate: " + formatNumber(form.payRate.value) + "%<BR>Monthly Mortgage Payment: $" + formatNumber(form.moPmt.value) + "<BR></b></small></TD></TR><TR><TD COLSPAN=5><CENTER><font face='arial'><big><b>Cost Benefit Analysis</b></big><BR><font face='arial'><small><small>Calculations are based upon a " + form.inflateRate.value + "% annual inflation rate over the course of " + form.stayYrs.value + " years (the time between now and when you estimate you would sell the home). Please allow for slight rounding differences.</small></small></CENTER></TD></TR><TR BGCOLOR=\"#CCCCCC\"><TD><font face='arial'><small><b>Renting Costs</b></small></TD><TD><font face='arial'><small><b>Amount</b></small></TD><TD> </TD><TD><font face='arial'><small><b>Buying Costs</b></small></TD><TD><font face='arial'><small><b>Amount</b></small></TD></TR>");var row1 = "<TR><TD><font face='arial'><small>Total Rent & Insurance Payments:</small></TD><TD ALIGN=RIGHT><font face='arial'><small>$" + formatNumber(form.totRent.value) + "</small></TD><TD> </TD><TD><font face='arial'><small>Total of Interest Payments:</small></TD><TD ALIGN=RIGHT><font face='arial'><small>$" + formatNumber(form.accumInt.value) + "</small></TD></TR>";var row2 = "<TR><TD ALIGN=RIGHT> </TD><TD> </TD><TD> </TD><TD><font face='arial'><small>Total Closing Costs:</small></TD><TD ALIGN=RIGHT><font face='arial'><small>$" + formatNumber(form.closeCosts.value) + "</small></TD></TR>";var row3 = "<TR><TD ALIGN=RIGHT> </TD><TD> </TD><TD> </TD><TD><font face='arial'><small>Total Property Tax Costs:</small></TD><TD ALIGN=RIGHT><font face='arial'><small>$" + formatNumber(form.totPropTax.value) + "</small></TD></TR>";var row4 = "<TR><TD ALIGN=RIGHT> </TD><TD> </TD><TD> </TD><TD><font face='arial'><small>Total Maintenance Costs:</small></TD><TD ALIGN=RIGHT><font face='arial'><small>$" + formatNumber(form.totMaintCost.value) + "</small></TD></TR>";var row5 = "<TR><TD ALIGN=RIGHT> </TD><TD> </TD><TD> </TD><TD><font face='arial'><small>Total Homeowner's Insurance Costs:</small></TD><TD ALIGN=RIGHT><font face='arial'><small>$" + formatNumber(form.totHomeInsCost.value) + "</small></TD></TR>";var row6 = "<TR><TD ALIGN=RIGHT> </TD><TD> </TD><TD> </TD><TD><font face='arial'><small>Total Association Dues:</small></TD><TD ALIGN=RIGHT><font face='arial'><small>$" + formatNumber(form.totAssocDues.value) + "</small></TD></TR>";var row7 = "<TR><TD ALIGN=RIGHT> </TD><TD> </TD><TD> </TD><TD><font face='arial'><small>Total PMI Costs:</small></TD><TD ALIGN=RIGHT><font face='arial'><small>$" + formatNumber(form.pmiCost.value) + "</small></TD></TR>";var row7B = "<TR><TD ALIGN=RIGHT> </TD><TD> </TD><TD> </TD><TD><font face='arial'><small>Cost of selling home:</small></TD><TD ALIGN=RIGHT><font face='arial'><small>$" + formatNumber(form.sellCost.value) + "</small></TD></TR>";var row8 = "<TR><TD ALIGN=RIGHT><font face='arial'><small><B>Total Costs</B></small></TD><TD ALIGN=RIGHT><font face='arial'><small><B>$" + formatNumber(form.totRentCosts.value) + "</B></small></TD><TD> </TD><TD ALIGN=RIGHT><font face='arial'><small><B>Total Costs</B></small></TD><TD ALIGN=RIGHT><font face='arial'><small><B>$" + formatNumber(form.totBuyCosts.value) + "</B></small></TD></TR>";var spacer = "<TR><TD ALIGN=RIGHT> </TD><TD> </TD><TD> </TD><TD> </TD><TD ALIGN=RIGHT> </TD></TR>";var row9 = "<TR BGCOLOR=\"#CCCCCC\"><TD><font face='arial'><small><B>Renting Benefits</B></small></TD><TD><font face='arial'><small><B>Amount</B></small></TD><TD> </TD><TD><font face='arial'><small><B>Buying Benefits</B></small></TD><TD><font face='arial'><small><B>Amount</B></small></TD></TR>";var row10 = "<TR><TD><font face='arial'><small>Interest Earned on Invested Funds:</small></TD><TD ALIGN=RIGHT><font face='arial'><small>$" + formatNumber(form.investPrin.value) + "</small></TD><TD> </TD><TD><font face='arial'><small>Tax Savings:</small></TD><TD ALIGN=RIGHT><font face='arial'><small>$" + formatNumber(form.totTaxSave.value) + "</small></TD></TR>";var row11 = "<TR><TD ALIGN=RIGHT> </TD><TD> </TD><TD> </TD><TD><font face='arial'><small>Home Appreciation:</small></TD><TD ALIGN=RIGHT><font face='arial'><small>$" + formatNumber(form.netGain.value) + "</small></TD></TR>";var row12 = "<TR><TD ALIGN=RIGHT><font face='arial'><small><B>Total Benefits</B></small></TD><TD ALIGN=RIGHT><font face='arial'><small><B>$" + formatNumber(form.totRentBenefits.value) + "</B></small></TD><TD> </TD><TD ALIGN=RIGHT><font face='arial'><small><B>Total Benefits</B></small></TD><TD ALIGN=RIGHT><font face='arial'><small><B>$" + formatNumber(form.totBuyBenefits.value) + "</B></small></TD></TR>";var row13 = "<TR><TD ALIGN=RIGHT><font face='arial'><small><B>NET COST OF RENTING:</B></small></TD><TD ALIGN=RIGHT><font face='arial'><small><B>" + form.netRentCost.value + "</B></small></TD><TD> </TD><TD ALIGN=RIGHT><font face='arial'><small><B>NET COST OF BUYING:</B></small></TD><TD ALIGN=RIGHT><font face='arial'><small><B>" + form.netBuyCost.value + "</B></small></TD></TR>";var summary = "<TR BGCOLOR=\"#CCCCCC\"><TD COLSPAN=5><font face='arial'><small><B>Summary:</B> " + form.results.value + "</small></TD></TR>";var part4 = ("</TABLE><BR><CENTER><FORM METHOD='POST'><INPUT TYPE=\'BUTTON\' VALUE=\'Close\' onClick=\'window.close()\'></FORM></CENTER></BODY></HTML>");var schedule = (part1 + "" + part2 + "" + row1 + "" + row2 + "" + row3 + "" + row4 + "" + row5 + "" + row6 + "" + row7 + "" + row7B + "" + row8 + "" + spacer + "" + row9 + "" + row10 + "" + row11 + "" + row12 + "" + spacer + "" + row13 + "" + summary + "" + part4 + "");  reportWin = window.open("","","width=600,height=400,toolbar=yes,menubar=yes,scrollbars=yes");  reportWin.document.write(schedule);  reportWin.document.close();}function showHelp(form) {var title = "";var explain = "";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 the costs of rent, insurance, maintenance, dues and property taxes for 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 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 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 rate of your mortgage. Each point represents 1% of your mortgage 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 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, 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).";} 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. 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% 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 closing costs you will invest if you decide to rent instead of buy. 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. 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 considering. Typically, if you plan to move out of a home in less than 5 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 real estate agent or broker when it's time to sell your home. Enter 7% simply as 7 (do not include percent sign).";}var part1 = ("<HEAD><TITLE>Help Screen</TITLE></HEAD>" + "<BODY BGCOLOR = '#FFFFFF'><BR><BR><CENTER><TABLE><TR><TD><font face='arial'><small><B>" + title + ":</B> " + explain + "</small></TD></TR></TABLE></CENTER>");var part4 = ("<BR><CENTER><FORM METHOD='POST'><INPUT TYPE=\'BUTTON\' VALUE=\'Close\' onClick=\'window.close()\'></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();}