var cMaxExpense = 14;

//constructor
function RetireNeed(setDefaults)
{
	//inputs
	this.todayExpense = new Array(cMaxExpense);
	this.retireExpense = new Array(cMaxExpense);
	for (var j=0; j < cMaxExpense; j++)
	{
		this.todayExpense[j] = "0";
		this.retireExpense[j] = "0";
	}

	if (setDefaults == 0) {

		this.iCurrentAge = "";
		this.iRetirementAge = "";
		this.dInflation = "";

	} 
	else 
	{

		this.iCurrentAge = "47";
		this.iRetirementAge = "64";
		this.dInflation = "3";
	}
	

	//intermediate calcs

	//outputs
	this.dCurrentExpenses = "";
	this.dRetireExpensesToday = "";
	this.dRetireExpensesFuture = "";	

	//methods
	this.mDoCalc = DoCalc;

	return true;
}

function DoCalc()
{

	this.dCurrentExpenses = 0;
	this.dRetireExpensesToday = 0;	
	for (var j=0; j < cMaxExpense; j++)
	{
		this.dCurrentExpenses = this.dCurrentExpenses + this.todayExpense[j];
		this.dRetireExpensesToday = this.dRetireExpensesToday + this.retireExpense[j];
	}

	this.dRetireExpensesFuture = this.dRetireExpensesToday 
					* Math.pow(1+this.dInflation/100,this.iRetirementAge-this.iCurrentAge);	
	
	return true;
}


