if (Calculators == undefined) {
	var Calculators = {};
}
if (Calculators.report == undefined) {
	Calculators.report = {};
}
Calculators.report.PlannerReport = function PlannerReport(planner){
	this.planner = planner;
	
	this.getBody = function() {
		var body = new Array();
        body.push("    <table width=\"100%\" cellspacing=\"0\">\n");
        body.push("      <tr>\n");
        body.push("        <th width=\"5%\" align=\"right\">Age</th>\n");
        body.push("        <th width=\"15%\" align=\"right\">Beginning Balance</th>\n");
        body.push("        <th width=\"15%\" align=\"right\">Growth</th>\n");
        body.push("        <th width=\"15%\" align=\"right\">Contributions</th>\n");
        body.push("        <th width=\"15%\" align=\"right\">Expenses</th>\n");
        body.push("        <th width=\"15%\" align=\"right\">Withdrawals</th>\n");
        body.push("        <th width=\"15%\" align=\"right\">Ending Balance</th>\n");
        body.push("      </tr>\n");

	    var yearlySnapshots = planner.getYearlySnapshots();
		var startingPoint = planner.getStartingAge();
		var endingPoint = planner.getEndingAge();
		
        for (var i = startingPoint; i < endingPoint; ++i) {
            if (i % 2 == 0) {
                body.push("      <tr>\n");
            } else {
                body.push("      <tr class=\"highlightStripe\">\n");
            }
            body.push("        <td style=\"border-top:1px solid black; text-align: right;\">");
				body.push(i);
			body.push("</td>\n");
            body.push("        <td style=\"border-top:1px solid black; text-align: right;\">");
				body.push(yearlySnapshots[i].getBeginningBalance().formatted());
			body.push("</td>\n");
            body.push("        <td style=\"border-top:1px solid black; text-align: right;\">");
			body.push(yearlySnapshots[i].getInvestmentGrowth().formatted());
			body.push("</td>\n");
            body.push("        <td style=\"border-top:1px solid black; text-align: right;\">");
			body.push(yearlySnapshots[i].getContributions().formatted());
			body.push("</td>\n");
            body.push("        <td style=\"border-top:1px solid black; text-align: right;\">");
			body.push(yearlySnapshots[i].getExpenses().formatted());
			body.push("</td>\n");
            body.push("        <td style=\"border-top:1px solid black; text-align: right;\">");
			body.push(yearlySnapshots[i].getWithdrawal().formatted());
			body.push("</td>\n");
            body.push("        <td style=\"border-top:1px solid black; text-align: right;\">");
			body.push(yearlySnapshots[i].getEndingBalance().formatted());
			body.push("</td>\n");
            body.push("      </tr>\n");
        }

        body.push("    </table>\n");
		
        return body.join("");
	}
	
	this.getTitle = function() {
		return "Report";
	}
}
Calculators.report.PlannerReport.prototype = new Calculators.report.Report();

