function amortization(){
	if(!validateField(document.getElementById('amountOfLoan'),'amount', 'the Amount of Loan'))return false;
	if(!validateField(document.getElementById('repaymentPeriod'),'years', 'the Repayment Period'))return false;
  	if(!validateField(document.getElementById('interestRate'),'rate', 'the Interest Rate'))return false;
	
	r = document.getElementById('interestRate').value/100;
	n = 12;
	var answer = (document.getElementById('amountOfLoan').value*(r/n))/(1-Math.pow(1+(r/n),-n*document.getElementById('repaymentPeriod').value))
	document.getElementById('answerPaymentAmount').style.display='block';
	document.getElementById('paymentAmount').value=currencyFormat(answer);
	return true; 
}

function collegeTuitionPlanner(){
 	if(!validateField(document.getElementById('currentAnnualCost_1'),'years', 'the Current Annual Cost of at least one child'))return false;
 	if(!validateField(document.getElementById('yearsUntilCollege_1'),'years', 'the number of Years Until College for at least one child'))return false;
 	if(!validateField(document.getElementById('yearsAtCollege_1'),'years', 'the number of Years at least one child will attend College'))return false;
 	if(!validateField(document.getElementById('currentSavings'),'amount', 'your Current Savings to Invest or 0 if none'))return false;
 	if(!validateField(document.getElementById('inflationRate'),'rate', 'the Annual Inflation Rate'))return false;
 	if(!validateField(document.getElementById('growthRate'),'rate', 'the Annual Investment Growth Rate'))return false;

	currentAnnualCost_1 = document.getElementById('currentAnnualCost_1').value;
	yearsUntilCollege_1 = document.getElementById('yearsUntilCollege_1').value;
	yearsAtCollege_1 = document.getElementById('yearsAtCollege_1').value;
	currentAnnualCost_2 = document.getElementById('currentAnnualCost_2').value;
	yearsUntilCollege_2 = document.getElementById('yearsUntilCollege_2').value;
	yearsAtCollege_2 = document.getElementById('yearsAtCollege_2').value;
	currentAnnualCost_3 = document.getElementById('currentAnnualCost_3').value;
	yearsUntilCollege_3 = document.getElementById('yearsUntilCollege_3').value;
	yearsAtCollege_3 = document.getElementById('yearsAtCollege_3').value;
	currentAnnualCost_4 = document.getElementById('currentAnnualCost_4').value;
	yearsUntilCollege_4 = document.getElementById('yearsUntilCollege_4').value;
	yearsAtCollege_4 = document.getElementById('yearsAtCollege_4').value;
	inflation = document.getElementById('inflationRate').value;
	LS = document.getElementById('currentSavings').value;
	r = document.getElementById('growthRate').value;

	inflation = inflation/100;
	r = r/100;
	var projectedCollegeExpenses = 0;
	var savingsNeededAtBeginning = 0;

	var leastNumberOfYearsUntilCollege = yearsUntilCollege_1;
	if(parseInt(yearsUntilCollege_2)<parseInt(leastNumberOfYearsUntilCollege) && !yearsUntilCollege_2=='')leastNumberOfYearsUntilCollege=yearsUntilCollege_2;
	if(parseInt(yearsUntilCollege_3)<parseInt(leastNumberOfYearsUntilCollege) && !yearsUntilCollege_3=='')leastNumberOfYearsUntilCollege=yearsUntilCollege_3;
	if(parseInt(yearsUntilCollege_4)<parseInt(leastNumberOfYearsUntilCollege) && !yearsUntilCollege_4=='')leastNumberOfYearsUntilCollege=yearsUntilCollege_4;

	for(i=yearsUntilCollege_1; i<(parseInt(yearsUntilCollege_1)+parseInt(yearsAtCollege_1)); i++){
		projectedCollegeExpenses += currentAnnualCost_1*Math.pow((1+inflation),i);
		savingsNeededAtBeginning += returnPresentValueFutureValue('',i-parseInt(leastNumberOfYearsUntilCollege)+1, r, currentAnnualCost_1*Math.pow((1+inflation),i));
	}

	for(i=yearsUntilCollege_2; i<(parseInt(yearsUntilCollege_2)+parseInt(yearsAtCollege_2)); i++){
		projectedCollegeExpenses += currentAnnualCost_2*Math.pow((1+inflation),i);
		savingsNeededAtBeginning += returnPresentValueFutureValue('',i-parseInt(leastNumberOfYearsUntilCollege)+1, r, currentAnnualCost_2*Math.pow((1+inflation),i));
	}

	for(i=yearsUntilCollege_3; i<(parseInt(yearsUntilCollege_3)+parseInt(yearsAtCollege_3)); i++){
		projectedCollegeExpenses += currentAnnualCost_3*Math.pow((1+inflation),i);
		savingsNeededAtBeginning += returnPresentValueFutureValue('',i-parseInt(leastNumberOfYearsUntilCollege)+1, r, currentAnnualCost_3*Math.pow((1+inflation),i));
	}

	for(i=yearsUntilCollege_4; i<(parseInt(yearsUntilCollege_4)+parseInt(yearsAtCollege_4)); i++){
		projectedCollegeExpenses += currentAnnualCost_4*Math.pow((1+inflation),i);
		savingsNeededAtBeginning += returnPresentValueFutureValue('',i-parseInt(leastNumberOfYearsUntilCollege)+1, r, currentAnnualCost_4*Math.pow((1+inflation),i));
	}

	var futureValueOfCurrentSavings = returnPresentValueFutureValue(LS, leastNumberOfYearsUntilCollege, r);
	var monthlySavingsNeeded = Math.round(((savingsNeededAtBeginning-futureValueOfCurrentSavings)*(r/12))/(Math.pow((1+r/12),(12*leastNumberOfYearsUntilCollege))-1));
  	var additionalLS = Math.round(returnPresentValueFutureValue('',leastNumberOfYearsUntilCollege,r,savingsNeededAtBeginning)-LS);
	
	document.getElementById('answerCollegeTuitionPlanner').style.display='block';
	
	document.getElementById('projectedCollegeExpenses').value = currencyFormat(projectedCollegeExpenses);
	document.getElementById('savingsNeededAtBeginning').value = currencyFormat(savingsNeededAtBeginning);
	document.getElementById('futureValueCurrentSavings').value = currencyFormat(futureValueOfCurrentSavings);
	document.getElementById('reconcileSavings').value = currencyFormat(savingsNeededAtBeginning-futureValueOfCurrentSavings);
	document.getElementById('monthlySavingsNeeded').value = currencyFormat(monthlySavingsNeeded);
	document.getElementById('additionalLumpSum').value = currencyFormat(additionalLS);
}
  
function returnCollegeTuitionPlanner(currentAnnualCost_1, yearsUntilCollege_1, yearsAtCollege_1, currentAnnualCost_2, yearsUntilCollege_2, yearsAtCollege_2, currentAnnualCost_3, yearsUntilCollege_3, yearsAtCollege_3, currentAnnualCost_4, yearsUntilCollege_4, yearsAtCollege_4, inflation, LS, r){

	inflation = inflation/100;
	r = r/100;
	var projectedCollegeExpenses = 0;
	var savingsNeededAtBeginning = 0;

	var leastNumberOfYearsUntilCollege = yearsUntilCollege_1;
	if(parseInt(yearsUntilCollege_2)<parseInt(leastNumberOfYearsUntilCollege) && !yearsUntilCollege_2=='')leastNumberOfYearsUntilCollege=yearsUntilCollege_2;
	if(parseInt(yearsUntilCollege_3)<parseInt(leastNumberOfYearsUntilCollege) && !yearsUntilCollege_3=='')leastNumberOfYearsUntilCollege=yearsUntilCollege_3;
	if(parseInt(yearsUntilCollege_4)<parseInt(leastNumberOfYearsUntilCollege) && !yearsUntilCollege_4=='')leastNumberOfYearsUntilCollege=yearsUntilCollege_4;

	for(i=yearsUntilCollege_1; i<(parseInt(yearsUntilCollege_1)+parseInt(yearsAtCollege_1)); i++){
		projectedCollegeExpenses += currentAnnualCost_1*Math.pow((1+inflation),i);
		savingsNeededAtBeginning += returnPresentValueFutureValue('',i-parseInt(leastNumberOfYearsUntilCollege)+1, r, currentAnnualCost_1*Math.pow((1+inflation),i));
	}

	for(i=yearsUntilCollege_2; i<(parseInt(yearsUntilCollege_2)+parseInt(yearsAtCollege_2)); i++){
		projectedCollegeExpenses += currentAnnualCost_2*Math.pow((1+inflation),i);
		savingsNeededAtBeginning += returnPresentValueFutureValue('',i-parseInt(leastNumberOfYearsUntilCollege)+1, r, currentAnnualCost_2*Math.pow((1+inflation),i));
	}

	for(i=yearsUntilCollege_3; i<(parseInt(yearsUntilCollege_3)+parseInt(yearsAtCollege_3)); i++){
		projectedCollegeExpenses += currentAnnualCost_3*Math.pow((1+inflation),i);
		savingsNeededAtBeginning += returnPresentValueFutureValue('',i-parseInt(leastNumberOfYearsUntilCollege)+1, r, currentAnnualCost_3*Math.pow((1+inflation),i));
	}

	for(i=yearsUntilCollege_4; i<(parseInt(yearsUntilCollege_4)+parseInt(yearsAtCollege_4)); i++){
		projectedCollegeExpenses += currentAnnualCost_4*Math.pow((1+inflation),i);
		savingsNeededAtBeginning += returnPresentValueFutureValue('',i-parseInt(leastNumberOfYearsUntilCollege)+1, r, currentAnnualCost_4*Math.pow((1+inflation),i));
	}

	var futureValueOfCurrentSavings = returnPresentValueFutureValue(LS, leastNumberOfYearsUntilCollege, r);
	var monthlySavingsNeeded = Math.round(((savingsNeededAtBeginning-futureValueOfCurrentSavings)*(r/12))/(Math.pow((1+r/12),(12*leastNumberOfYearsUntilCollege))-1));
  	var additionalLS = Math.round(returnPresentValueFutureValue('',leastNumberOfYearsUntilCollege,r,savingsNeededAtBeginning)-LS);
	
	return projectedCollegeExpenses;
}

function estateTax(){
	if(document.getElementById('includeSpouse').checked==true){spouse=1;}else {spouse=0;} 
	if(spouse==1&&parseInt(document.getElementById('assumedYearOfDeath').value)>=parseInt(document.getElementById('assumedYearOfDeathSpouse').value)){alert("The death of your spouse should not precede yours."); document.getElementById('assumedYearOfDeathSpouse').focus(); return false; }
	
 	if(!validateField(document.getElementById('assumedYearOfDeath'),'years', 'the Assumed Year of Death'))return false;
 	if(!validateField(document.getElementById('estateValue'),'amount', "Today's Estate Value"))return false;
 	if(!validateField(document.getElementById('growthRate'),'rate', 'the Growth Rate'))return false;

 	if(spouse==1&&!validateField(document.getElementById('assumedYearOfDeathSpouse'),'years', 'the Assumed Year of Death for your spouse'))return false;
 	if(spouse==1&&!validateField(document.getElementById('estateValueSpouse'),'amount', "Today's Estate Value for your spouse"))return false;
 	if(spouse==1&&!validateField(document.getElementById('growthRateSpouse'),'rate', 'the Growth Rate for your spouse'))return false;

	today = new Date();
	thisYear = today.getFullYear();

	yearOfDeath = document.getElementById('assumedYearOfDeath').value;
	yearOfDeathSpouse = document.getElementById('assumedYearOfDeathSpouse').value;
	
	estateValue = document.getElementById('estateValue').value;
	estateValueSpouse = document.getElementById('estateValueSpouse').value;
	
	numberOfYearsBeforeDeath = yearOfDeath - thisYear;
	numberOfYearsBeforeDeathSpouse = yearOfDeathSpouse - thisYear;
	
	adjustedTaxableGifts = parseInt(document.getElementById('adjustedTaxableGifts').value);
	adjustedTaxableGiftsSpouse = parseInt(document.getElementById('adjustedTaxableGiftsSpouse').value);
	
	giftTaxesPaid = document.getElementById('giftTaxesPaid').value;
	giftTaxesPaidSpouse = document.getElementById('giftTaxesPaidSpouse').value;
	
	r = document.getElementById('growthRate').value/100;
	rSpouse = document.getElementById('growthRateSpouse').value/100;
	
	// check for spouse
	switch(spouse) {
		case 0:
			switch(yearOfDeath) {
				default:
					estateValueAtDeath = returnPresentValueFutureValue(estateValue, numberOfYearsBeforeDeath, r);
					estateValueAtDeathSpouse = 'n/a';
					martialDeduction = 'n/a';
					martialDeductionSpouse = 'n/a'
					totalTaxableEstate = estateValueAtDeath+adjustedTaxableGifts;
					totalTaxableEstateSpouse = 'n/a';
					tentativeFederalEstateTax = calculateEstateTax(totalTaxableEstate, yearOfDeath);
					tentativeFederalEstateTaxSpouse = 'n/a';
					if(yearOfDeath==2011){
						federalCreditAmount = 1730800;
					} else if(yearOfDeath==2012) {
						federalCreditAmount = 1774550;
					} else {
						federalCreditAmount = 345000;
					}
					federalCreditAmountSpouse = 'n/a';
					netFederalEstateTaxDue = tentativeFederalEstateTax-federalCreditAmount-giftTaxesPaid;
					netFederalEstateTaxDueSpouse = 'n/a';
					break;
			}
			break;
		case 1:
			switch(yearOfDeath) {
				default:
					estateValueAtDeath = returnPresentValueFutureValue(estateValue, numberOfYearsBeforeDeath, r);
					estateValueAtDeathSpouse = returnPresentValueFutureValue(estateValueSpouse, numberOfYearsBeforeDeathSpouse, rSpouse);
					martialDeduction = 'n/a';
					martialDeductionSpouse = returnPresentValueFutureValue(estateValueAtDeath, numberOfYearsBeforeDeathSpouse-numberOfYearsBeforeDeath, rSpouse);
					totalTaxableEstate = 0;
					totalTaxableEstateSpouse = estateValueAtDeathSpouse+martialDeductionSpouse+adjustedTaxableGifts+adjustedTaxableGiftsSpouse;
					tentativeFederalEstateTax = 'n/a';
					tentativeFederalEstateTaxSpouse = calculateEstateTax(totalTaxableEstateSpouse, yearOfDeathSpouse);
					federalCreditAmount = 'n/a';
					if(yearOfDeath==2011){
						federalCreditAmountSpouse = eval(1730800*2);
					} else if(yearOfDeath==2012) {
						federalCreditAmountSpouse = eval(1774550*2);
					} else {
						federalCreditAmountSpouse = eval(345000*2);
					}
					netFederalEstateTaxDue = 'n/a';
					netFederalEstateTaxDueSpouse = tentativeFederalEstateTaxSpouse-federalCreditAmountSpouse-giftTaxesPaid-giftTaxesPaidSpouse;
					break;
			}
			break;
	}

	document.getElementById('answerEstateTax').style.display='block';

	document.getElementById('estateValueAtDeath').value=currencyFormat(estateValueAtDeath);
	document.getElementById('estateValueAtDeathSpouse').value=currencyFormat(estateValueAtDeathSpouse);
	document.getElementById('martialDeduction').value=currencyFormat(martialDeduction);
	document.getElementById('martialDeductionSpouse').value=currencyFormat(martialDeductionSpouse);
	document.getElementById('totalTaxableEstate').value=currencyFormat(totalTaxableEstate);
	document.getElementById('totalTaxableEstateSpouse').value=currencyFormat(totalTaxableEstateSpouse);
	document.getElementById('tentativeFederalEstateTax').value=currencyFormat(tentativeFederalEstateTax);
	document.getElementById('tentativeFederalEstateTaxSpouse').value=currencyFormat(tentativeFederalEstateTaxSpouse);
	document.getElementById('federalCreditAmount').value=currencyFormat(federalCreditAmount);
	document.getElementById('federalCreditAmountSpouse').value=currencyFormat(federalCreditAmountSpouse);
	document.getElementById('netFederalEstateTaxDue').value=currencyFormat(netFederalEstateTaxDue);
	document.getElementById('netFederalEstateTaxDueSpouse').value=currencyFormat(netFederalEstateTaxDueSpouse);
//document.getElementById('futureValue').value=currencyFormat(answer);
}
  
function futureValueOfRegularPayments(){

 	if(!validateField(document.getElementById('annualContribution'),'amount', 'the Annual Contribution'))return false;
 	if(!validateField(document.getElementById('interestRate'),'rate', 'the Interest Rate'))return false;
 	if(!validateField(document.getElementById('investmentPeriod'),'years', 'the Investment Period'))return false;

	A = document.getElementById('annualContribution').value;
	r = document.getElementById('interestRate').value;
	Y = document.getElementById('investmentPeriod').value;
	paymentTiming = document.getElementsByName('paymentTiming');

	r = r/100;
	n = getRadioValue(paymentTiming);
	var temp = parseInt(Y) + parseInt(n);
  	var PV = A*((1-(1/(Math.pow(1+r,Y))))/r)
	var answer = PV*Math.pow(1+r,temp);
	document.getElementById('answerFutureValue').style.display='block';
	document.getElementById('futureValue').value=currencyFormat(answer);
}

function lifeInsuranceNeeds(){

 	if(!validateField(document.getElementById('annualGrossIncome'),'amount', 'your Annual Gross Income or 0 if none'))return false;
 	if(!validateField(document.getElementById('otherAnnualFamilyIncome'),'amount', 'your Other Annual Family Income or 0 if none'))return false;
 	if(!validateField(document.getElementById('outstandingMortgagBalance'),'amount', 'your Outstanding Mortgage Balance or 0 if none'))return false;
 	if(!validateField(document.getElementById('estimatedMonthlyLivingExpenses'),'amount', 'your Estimated Monthly Living Expenses'))return false;
 	if(!validateField(document.getElementById('loanCreditDebts'),'amount', 'your Loan and Credit Debts or 0 if none'))return false;
 	if(!validateField(document.getElementById('finalExpenses'),'amount', 'your Medical Costs, Probate & Funeral Expenses or 0 if none'))return false;
 	if(!validateField(document.getElementById('otherDebt'),'amount', 'your Other Debt or 0 if none'))return false;
 	if(!validateField(document.getElementById('estimateOfLiquidAssets'),'amount', 'an Estimate of your Liquid Assets or 0 if none'))return false;
 	if(!validateField(document.getElementById('estimateOfRetirementAssets'),'amount', 'an Estimate of your Retirement Assets or 0 if none'))return false;
 	if(!validateField(document.getElementById('existingLifeInsuranceCoverage'),'amount', 'your Total Existing Life Insurance Coverage or 0 if none'))return false;
 	if(!validateField(document.getElementById('lifestyleMaintenance'),'amount', "the number of years you'd like to Maintain your Lifestyle"))return false;

	estimatingFor=document.getElementById('estimatingFor').value;
	annualGrossIncome=document.getElementById('annualGrossIncome').value;
	annualGrossIncomeSpouse=document.getElementById('annualGrossIncomeSpouse').value;
	otherAnnualFamilyIncome=document.getElementById('otherAnnualFamilyIncome').value;
	outstandingMortgageBalance=document.getElementById('outstandingMortgagBalance').value;
	outstandingMortgageBalanceCovered=document.getElementsByName('mortgageCoveredFor');
	estimatedMonthlyLivingExpenses=document.getElementById('estimatedMonthlyLivingExpenses').value;
	estimatedMonthlyLivingCovered=document.getElementsByName('livingExpensesCoveredFor');
	loanCreditDebts=document.getElementById('loanCreditDebts').value;
	loanCreditDebtsCovered=document.getElementsByName('loanCreditDebtsCoveredFor');
	finalExpenses=document.getElementById('finalExpenses').value;
	otherDebt=document.getElementById('otherDebt').value;
	otherDebtCovered=document.getElementsByName('otherDebtCoveredFor');
	inflationRate=document.getElementById('inflationRate').value;
	estimateOfLiquidAssets=document.getElementById('estimateOfLiquidAssets').value;
	estimateOfRetirementAssets=document.getElementById('estimateOfRetirementAssets').value;
	estimateOfRetirementAssetsSpouse=document.getElementById('estimateOfRetirementAssetsSpouse').value;
	existingLifeInsuranceCoverage=document.getElementById('existingLifeInsuranceCoverage').value;
	existingLifeInsuranceCoverageSpouse=document.getElementById('existingLifeInsuranceCoverageSpouse').value;
	lifestyleMaintenance=document.getElementById('lifestyleMaintenance').value;
	numberOfChildren=document.getElementById('numberOfChildren').value;
	childsAge_1=document.getElementById('childsAge_1').value;
	additionalMonthlyCosts_1=document.getElementById('additionalMonthlyCosts_1').value;
	numberOfYears_1=document.getElementById('numberOfYears_1').value;
	annualCollegeCosts_1=document.getElementById('annualCollegeCosts_1').value;
	numberOfYearsInCollege_1=document.getElementById('numberOfYearsInCollege_1').value;
	childsAge_2=document.getElementById('childsAge_2').value;
	additionalMonthlyCosts_2=document.getElementById('additionalMonthlyCosts_2').value;
	numberOfYears_2=document.getElementById('numberOfYears_2').value;
	annualCollegeCosts_2=document.getElementById('annualCollegeCosts_2').value;
	numberOfYearsInCollege_2=document.getElementById('numberOfYearsInCollege_2').value;
	childsAge_3=document.getElementById('childsAge_3').value;
	additionalMonthlyCosts_3=document.getElementById('additionalMonthlyCosts_3').value;
	numberOfYears_3=document.getElementById('numberOfYears_3').value;
	annualCollegeCosts_3=document.getElementById('annualCollegeCosts_3').value;
	numberOfYearsInCollege_3=document.getElementById('numberOfYearsInCollege_3').value;
	childsAge_4=document.getElementById('childsAge_4').value;
	additionalMonthlyCosts_4=document.getElementById('additionalMonthlyCosts_4').value;
	numberOfYears_4=document.getElementById('numberOfYears_4').value;
	annualCollegeCosts_4=document.getElementById('annualCollegeCosts_4').value;
	numberOfYearsInCollege_4=document.getElementById('numberOfYearsInCollege_4').value;
	additionalMonthlyCostsCovered=document.getElementsByName('childcareCoveredFor');
	annualCollegeCostsCovered=document.getElementsByName('collegeCostsCoveredFor');
	annualIncreaseInCollegeTuition=document.getElementById('annualIncreaseInCollegeTuition').value;

	switch(document.getElementById('numberOfChildren').value){
		case '0':
  			break;

		case '1':
  			if(!document.getElementById('childsAge_1').value){alert("Please enter Child 1's Age."); document.getElementById('childsAge_1').focus(); return false; }
  			if(!document.getElementById('additionalMonthlyCosts_1').value){alert("Please enter the Additional Monthly Costs if Somone Dies for Child 1's Age."); document.getElementById('additionalMonthlyCosts_1').focus(); return false; }
  			if(!document.getElementById('numberOfYears_1').value){alert("Please enter the Number of Years Child 1 will attend college."); document.getElementById('numberOfYears_1').focus(); return false; }
  			break;

		case '2':
  			if(!document.getElementById('childsAge_1').value){alert("Please enter Child 1's Age."); document.getElementById('childsAge_1').focus(); return false; }
  			if(!document.getElementById('additionalMonthlyCosts_1').value){alert("Please enter the Additional Monthly Costs if Somone Dies for Child 1's Age."); document.getElementById('additionalMonthlyCosts_1').focus(); return false; }
  			if(!document.getElementById('numberOfYears_1').value){alert("Please enter the Number of Years Child 2 will attend college."); document.getElementById('numberOfYears_1').focus(); return false; }
  			if(!document.getElementById('childsAge_2').value){alert("Please enter Child 2's Age."); document.getElementById('childsAge_2').focus(); return false; }
  			if(!document.getElementById('additionalMonthlyCosts_2').value){alert("Please enter the Additional Monthly Costs for Child 2 if Somone Dies."); document.getElementById('additionalMonthlyCosts_2').focus(); return false; }
  			if(!document.getElementById('numberOfYears_2').value){alert("Please enter the Number of Years Child 2 will attend college."); document.getElementById('numberOfYears_2').focus(); return false; }
  			break;

		case '3':
  			if(!document.getElementById('childsAge_1').value){alert("Please enter Child 1's Age."); document.getElementById('childsAge_1').focus(); return false; }
  			if(!document.getElementById('additionalMonthlyCosts_1').value){alert("Please enter the Additional Monthly Costs if Somone Dies for Child 1's Age."); document.getElementById('additionalMonthlyCosts_1').focus(); return false; }
  			if(!document.getElementById('numberOfYears_1').value){alert("Please enter the Number of Years Child 2 will attend college."); document.getElementById('numberOfYears_1').focus(); return false; }
  			if(!document.getElementById('childsAge_2').value){alert("Please enter Child 2's Age."); document.getElementById('childsAge_2').focus(); return false; }
  			if(!document.getElementById('additionalMonthlyCosts_2').value){alert("Please enter the Additional Monthly Costs for Child 2 if Somone Dies."); document.getElementById('additionalMonthlyCosts_2').focus(); return false; }
  			if(!document.getElementById('numberOfYears_2').value){alert("Please enter the Number of Years Child 2 will attend college."); document.getElementById('numberOfYears_2').focus(); return false; }
  			if(!document.getElementById('childsAge_3').value){alert("Please enter Child 3's Age."); document.getElementById('childsAge_3').focus(); return false; }
  			if(!document.getElementById('additionalMonthlyCosts_3').value){alert("Please enter the Additional Monthly Costs for Child 3 if Somone Dies."); document.getElementById('additionalMonthlyCosts_3').focus(); return false; }
  			if(!document.getElementById('numberOfYears_3').value){alert("Please enter the Number of Years Child 3 will attend college."); document.getElementById('numberOfYears_3').focus(); return false; }
  			break;

		case '4':
  			if(!document.getElementById('childsAge_1').value){alert("Please enter Child 1's Age."); document.getElementById('childsAge_1').focus(); return false; }
  			if(!document.getElementById('additionalMonthlyCosts_1').value){alert("Please enter the Additional Monthly Costs if Somone Dies for Child 1's Age."); document.getElementById('additionalMonthlyCosts_1').focus(); return false; }
  			if(!document.getElementById('numberOfYears_1').value){alert("Please enter the Number of Years Child 2 will attend college."); document.getElementById('numberOfYears_1').focus(); return false; }
  			if(!document.getElementById('childsAge_2').value){alert("Please enter Child 2's Age."); document.getElementById('childsAge_2').focus(); return false; }
  			if(!document.getElementById('additionalMonthlyCosts_2').value){alert("Please enter the Additional Monthly Costs for Child 2 if Somone Dies."); document.getElementById('additionalMonthlyCosts_2').focus(); return false; }
  			if(!document.getElementById('numberOfYears_2').value){alert("Please enter the Number of Years Child 2 will attend college."); document.getElementById('numberOfYears_2').focus(); return false; }
  			if(!document.getElementById('childsAge_3').value){alert("Please enter Child 3's Age."); document.getElementById('childsAge_3').focus(); return false; }
  			if(!document.getElementById('additionalMonthlyCosts_3').value){alert("Please enter the Additional Monthly Costs for Child 3 if Somone Dies."); document.getElementById('additionalMonthlyCosts_3').focus(); return false; }
  			if(!document.getElementById('numberOfYears_3').value){alert("Please enter the Number of Years Child 3 will attend college."); document.getElementById('numberOfYears_3').focus(); return false; }
  			if(!document.getElementById('childsAge_4').value){alert("Please enter Child 4's Age."); document.getElementById('childsAge_4').focus(); return false; }
  			if(!document.getElementById('additionalMonthlyCosts_4').value){alert("Please enter the Additional Monthly Costs for Child 4 if Somone Dies."); document.getElementById('additionalMonthlyCosts_4').focus(); return false; }
  			if(!document.getElementById('numberOfYears_4').value){alert("Please enter the Number of Years Child 4 will attend college."); document.getElementById('numberOfYears_4').focus(); return false; }
  			break;

		default:
			break;
	}

	inflationRate = inflationRate/100;
	
	if(getRadioValue(outstandingMortgageBalanceCovered)=='0' || getRadioValue(outstandingMortgageBalanceCovered)=='2'){answerOutstandingMortgageBalance = outstandingMortgageBalance;}else answerOutstandingMortgageBalance = 0;
	if(getRadioValue(outstandingMortgageBalanceCovered)=='0' || getRadioValue(outstandingMortgageBalanceCovered)=='1'){answerOutstandingMortgageBalanceSpouse = outstandingMortgageBalance;}else answerOutstandingMortgageBalanceSpouse = 0;
	if(getRadioValue(estimatedMonthlyLivingCovered)=='0' || getRadioValue(estimatedMonthlyLivingCovered)=='2'){answerMonthlyLivingExpenses6Months = estimatedMonthlyLivingExpenses*6;}else answerMonthlyLivingExpenses6Months = 0;
	if(getRadioValue(estimatedMonthlyLivingCovered)=='0' || getRadioValue(estimatedMonthlyLivingCovered)=='1'){answerMonthlyLivingExpenses6MonthsSpouse = estimatedMonthlyLivingExpenses*6;}else answerMonthlyLivingExpenses6MonthsSpouse = 0;
	if(getRadioValue(loanCreditDebtsCovered)=='0' || getRadioValue(loanCreditDebtsCovered)=='2'){answerLoanCreditDebts = loanCreditDebts;}else answerLoanCreditDebts = 0;
	if(getRadioValue(loanCreditDebtsCovered)=='0' || getRadioValue(loanCreditDebtsCovered)=='1'){answerLoanCreditDebtsSpouse = loanCreditDebts;}else answerLoanCreditDebtsSpouse = 0;
	if(getRadioValue(otherDebtCovered)=='0' || getRadioValue(otherDebtCovered)=='2'){answerOtherDebt = otherDebt;}else answerOtherDebt = 0;
	if(getRadioValue(otherDebtCovered)=='0' || getRadioValue(otherDebtCovered)=='1'){answerOtherDebtSpouse = otherDebt;}else answerOtherDebtSpouse = 0;

	var totalDebt = parseInt(answerOutstandingMortgageBalance)+parseInt(answerMonthlyLivingExpenses6Months)+parseInt(answerLoanCreditDebts)+parseInt(finalExpenses)+parseInt(answerOtherDebt);
	var totalDebtSpouse = parseInt(answerOutstandingMortgageBalanceSpouse)+parseInt(answerMonthlyLivingExpenses6MonthsSpouse)+parseInt(answerLoanCreditDebtsSpouse)+parseInt(finalExpenses)+parseInt(answerOtherDebtSpouse);

	if(getRadioValue(additionalMonthlyCostsCovered)=='0' || getRadioValue(additionalMonthlyCostsCovered)=='2'){
		tempPV = additionalMonthlyCosts_1*((1-(1/(Math.pow(1+(inflationRate/12),numberOfYears_1*12))))/(inflationRate/12)); tempAdditionalMonthlyChildcareCosts = tempPV*Math.pow(1+inflationRate,numberOfYears_1);
		tempPV = additionalMonthlyCosts_2*((1-(1/(Math.pow(1+(inflationRate/12),numberOfYears_2*12))))/(inflationRate/12)); tempAdditionalMonthlyChildcareCosts += tempPV*Math.pow(1+inflationRate,numberOfYears_2);
		tempPV = additionalMonthlyCosts_3*((1-(1/(Math.pow(1+(inflationRate/12),numberOfYears_3*12))))/(inflationRate/12)); tempAdditionalMonthlyChildcareCosts += tempPV*Math.pow(1+inflationRate,numberOfYears_3);
		tempPV = additionalMonthlyCosts_4*((1-(1/(Math.pow(1+(inflationRate/12),numberOfYears_4*12))))/(inflationRate/12)); tempAdditionalMonthlyChildcareCosts += tempPV*Math.pow(1+inflationRate,numberOfYears_4);
	} else {
		tempPV = 0; tempAdditionalMonthlyChildcareCosts=0;
	} 
	
	additionalMonthlyChildcareCosts = tempAdditionalMonthlyChildcareCosts;
	
	if(getRadioValue(additionalMonthlyCostsCovered)=='0' || getRadioValue(additionalMonthlyCostsCovered)=='1'){
		tempPV = additionalMonthlyCosts_1*((1-(1/(Math.pow(1+(inflationRate/12),numberOfYears_1*12))))/(inflationRate/12)); tempAdditionalMonthlyChildcareCosts = tempPV*Math.pow(1+inflationRate,numberOfYears_1);
		tempPV = additionalMonthlyCosts_2*((1-(1/(Math.pow(1+(inflationRate/12),numberOfYears_2*12))))/(inflationRate/12)); tempAdditionalMonthlyChildcareCosts += tempPV*Math.pow(1+inflationRate,numberOfYears_2);
		tempPV = additionalMonthlyCosts_3*((1-(1/(Math.pow(1+(inflationRate/12),numberOfYears_3*12))))/(inflationRate/12)); tempAdditionalMonthlyChildcareCosts += tempPV*Math.pow(1+inflationRate,numberOfYears_3);
		tempPV = additionalMonthlyCosts_4*((1-(1/(Math.pow(1+(inflationRate/12),numberOfYears_4*12))))/(inflationRate/12)); tempAdditionalMonthlyChildcareCosts += tempPV*Math.pow(1+inflationRate,numberOfYears_4);
	} else {
		tempPV = 0; tempAdditionalMonthlyChildcareCosts=0;
	} 
	
	additionalMonthlyChildcareCostsSpouse = tempAdditionalMonthlyChildcareCosts;
	
	if(getRadioValue(annualCollegeCostsCovered)=='0' || getRadioValue(annualCollegeCostsCovered)=='2'){
		var collegeCosts = returnCollegeTuitionPlanner(annualCollegeCosts_1, 18-childsAge_1, numberOfYearsInCollege_1, annualCollegeCosts_2, 18-childsAge_2, numberOfYearsInCollege_2, annualCollegeCosts_3, 18-childsAge_3, numberOfYearsInCollege_3, annualCollegeCosts_4, 18-childsAge_4, numberOfYearsInCollege_4, annualIncreaseInCollegeTuition, '', inflationRate*100);
	} else {
		var collegeCosts = 0;
	}
	
	if(getRadioValue(annualCollegeCostsCovered)=='0' || getRadioValue(annualCollegeCostsCovered)=='1'){
		var collegeCostsSpouse = returnCollegeTuitionPlanner(annualCollegeCosts_1, 18-childsAge_1, numberOfYearsInCollege_1, annualCollegeCosts_2, 18-childsAge_2, numberOfYearsInCollege_2, annualCollegeCosts_3, 18-childsAge_3, numberOfYearsInCollege_3, annualCollegeCosts_4, 18-childsAge_4, numberOfYearsInCollege_4, annualIncreaseInCollegeTuition, '', inflationRate*100);
	} else {
		var collegeCostsSpouse = 0;
	}	
	
	var totalChildNeeds = parseInt(collegeCosts) + parseInt(additionalMonthlyChildcareCosts);
	var totalChildNeedsSpouse = parseInt(collegeCostsSpouse) + parseInt(additionalMonthlyChildcareCostsSpouse);

	var cashReserve = annualGrossIncome*lifestyleMaintenance;
	var cashReserveSpouse = annualGrossIncomeSpouse*lifestyleMaintenance;
	
	var totalProtectionNeeded = parseInt(cashReserve)+parseInt(totalChildNeeds)+parseInt(totalDebt);
	var totalProtectionNeededSpouse = parseInt(cashReserveSpouse)+parseInt(totalChildNeedsSpouse)+parseInt(totalDebtSpouse);

	var totalAssets = parseInt(estimateOfLiquidAssets)+parseInt(estimateOfRetirementAssets)+parseInt(existingLifeInsuranceCoverage);
	var totalAssetsSpouse = parseInt(estimateOfLiquidAssets)+parseInt(estimateOfRetirementAssetsSpouse)+parseInt(existingLifeInsuranceCoverageSpouse);
	
	var recommendedCoverage = parseInt(totalProtectionNeeded)-parseInt(totalAssets);
	var recommendedCoverageSpouse = parseInt(totalProtectionNeededSpouse)-parseInt(totalAssetsSpouse);
	
	document.getElementById('answerLifeInsuranceNeeds').style.display='block';
	document.getElementById('answerMortgageDebt').value=currencyFormat(answerOutstandingMortgageBalance);
	document.getElementById('answerMortgageDebtSpouse').value=currencyFormat(answerOutstandingMortgageBalanceSpouse);
	document.getElementById('answerMonthlyBills6Months').value=currencyFormat(answerMonthlyLivingExpenses6Months);
	document.getElementById('answerMonthlyBills6MonthsSpouse').value=currencyFormat(answerMonthlyLivingExpenses6MonthsSpouse);
	document.getElementById('answerLoanAndCreditCards').value=currencyFormat(answerLoanCreditDebts);
	document.getElementById('answerLoanAndCreditCardsSpouse').value=currencyFormat(answerLoanCreditDebtsSpouse);
	document.getElementById('answerFinalExpenses').value=currencyFormat(finalExpenses);
	document.getElementById('answerOtherDebt').value=currencyFormat(answerOtherDebt);
	document.getElementById('answerOtherDebtSpouse').value=currencyFormat(answerOtherDebtSpouse);
	document.getElementById('answerTotalDebt').value=currencyFormat(totalDebt);
	document.getElementById('answerTotalDebtSpouse').value=currencyFormat(totalDebtSpouse);
	document.getElementById('answerAdditionalMonthlyChildcareCosts').value=currencyFormat(additionalMonthlyChildcareCosts);
	document.getElementById('answerAdditionalMonthlyChildcareCostsSpouse').value=currencyFormat(additionalMonthlyChildcareCostsSpouse);
	document.getElementById('answerCollegeCosts').value=currencyFormat(collegeCosts);
	document.getElementById('answerCollegeCostsSpouse').value=currencyFormat(collegeCostsSpouse);
	document.getElementById('answerTotalChildNeeds').value=currencyFormat(totalChildNeeds);
	document.getElementById('answerTotalChildNeedsSpouse').value=currencyFormat(totalChildNeedsSpouse);
	document.getElementById('answerCashReserve').value=currencyFormat(cashReserve);
	document.getElementById('answerCashReserveSpouse').value=currencyFormat(cashReserveSpouse);
	document.getElementById('answerTotalProtectionNeeded').value=currencyFormat(totalProtectionNeeded);
	document.getElementById('answerTotalProtectionNeededSpouse').value=currencyFormat(totalProtectionNeededSpouse);
	document.getElementById('answerLiquidAssets').value=currencyFormat(estimateOfLiquidAssets);
	document.getElementById('answerLiquidAssetsSpouse').value=currencyFormat(estimateOfLiquidAssets);
	document.getElementById('answerRetirementAssets').value=currencyFormat(estimateOfRetirementAssets);
	document.getElementById('answerRetirementAssetsSpouse').value=currencyFormat(estimateOfRetirementAssetsSpouse);
	document.getElementById('answerLifeInsuranceCoverageCurrentlyInForce').value=currencyFormat(existingLifeInsuranceCoverage);
	document.getElementById('answerLifeInsuranceCoverageCurrentlyInForceSpouse').value=currencyFormat(existingLifeInsuranceCoverageSpouse);
	document.getElementById('answerTotalAssets').value=currencyFormat(totalAssets);
	document.getElementById('answerTotalAssetsSpouse').value=currencyFormat(totalAssetsSpouse);
	document.getElementById('answerRecommendedAmountOfAdditionalLifeInsurance').value=currencyFormat(recommendedCoverage);
	document.getElementById('answerRecommendedAmountOfAdditionalLifeInsuranceSpouse').value=currencyFormat(recommendedCoverageSpouse);
}

function periodicWithdrawlsFromALumpSum(){
	LS=document.getElementById('lumpSum').value;
	r=document.getElementById('interestRate').value
	n=document.getElementById('numberOfWithdrawls').value
	Y=document.getElementById('withdrawlPeriod').value
	
  	if(!validateField(document.getElementById('lumpSum'),'amount', 'the Lump Sum Invested'))return false;
  	if(!validateField(document.getElementById('interestRate'),'rate', 'the Annual Interest Rate'))return false;
  	if(!validateField(document.getElementById('numberOfWithdrawls'),'amount', 'the Number of Withdrawls'))return false;
  	if(!validateField(document.getElementById('withdrawlPeriod'),'years', 'the Withdrawl Period'))return false;

	r = r/100;
	document.getElementById('answerAmountOfEachWithdrawl').style.display='block';
  	document.getElementById('amountOfEachWithdrawl').value = currencyFormat(LS*((r/n)/(1-Math.pow((1+(r/n)),(-n*Y)))));
}

function returnPeriodicWithdrawlsFromALumpSum(LS, r, n, Y){
  	return LS*((r/n)/(1-Math.pow((1+(r/n)),(-n*Y))));
}

function presentValueFutureValue(PV, Y, r, FV){
  	if(!validateField(document.getElementById('years'),'years', 'the Years You Will Maintain Your Investment'))return false;
  	if(!validateField(document.getElementById('growthRate'),'rate', 'the Annual Investment Growth Rate'))return false;

  	if(!document.getElementById('currentValue').value && !document.getElementById('futureValueOfInvestment').value){alert("Please enter either the Current Value of Your Investment or the Future Value of Your Investment."); document.getElementById('currentValue').focus(); return false; }
  	if(document.getElementById('currentValue').value && document.getElementById('futureValueOfInvestment').value){alert("Please leave either the Current Value of Your Investment or the Future Value of Your Investment blank."); document.getElementById('currentValue').focus(); return false; }

  	if(document.getElementById('currentValue').value&&!validateField(document.getElementById('currentValue'),'rate', 'the Current Value of Your Investment'))return false;
  	if(document.getElementById('futureValueOfInvestment').value&&!validateField(document.getElementById('futureValueOfInvestment'),'rate', 'the Future Value of Your Investment'))return false;


	r = r/100;
	switch(PV){
		case '':
  			document.getElementById('currentValue').value = Math.round(FV/Math.pow((1+r), Y));
  			break;

		default:
  			document.getElementById('futureValueOfInvestment').value = Math.round(PV*Math.pow((1+r), Y));
	}
}

function returnPresentValueFutureValue(PV, Y, r, FV){
	switch(PV){
		case '':
  			return Math.round(FV/Math.pow((1+r), Y));
  			break;

		default:
  			return Math.round(PV*Math.pow((1+r), Y));
	}
}

function retirementSavingsCalculator(CS, inflation, Y, RI, MS, SS, PI, LS, RORB, RORA){
  	if(!validateField(document.getElementById('currentSalary'),'amount', 'your Current Salary'))return false;
  	if(!validateField(document.getElementById('yearsToRetirement'),'years', 'the number of Years to Retirement'))return false;
  	if(!validateField(document.getElementById('replacementIncome'),'amount', 'your desired Replacement Income Percentage'))return false;
  	if(!validateField(document.getElementById('pensionIncome'),'amount', 'your Pension Income or 0 if none'))return false;
  	if(!validateField(document.getElementById('currentSavings'),'amount', 'your Current Savings or 0 if none'))return false;
  	if(!validateField(document.getElementById('afterTaxRateOfReturnBefore'),'rate', 'the estimated After-tax Rate of Return before Retirement'))return false;
  	if(!validateField(document.getElementById('afterTaxRateOfReturnAfter'),'rate', 'the estimated After-tax Rate of Return after Retirement'))return false;
	
  	i = inflation/100;
  	RI = RI/100;
  	RORA = RORA/100;
  	RORB = RORB/100;
	var salaryAtRetirement = returnPresentValueFutureValue(CS, Y, i);
	var pensionIncomeAtRetirement = returnPresentValueFutureValue(PI, Y, i);
	
	if(getRadioValue(SS)=="1" && getRadioValue(MS)=="1") socialSecurityPayments=salaryAtRetirement*RI*.389572;
	if(getRadioValue(SS)=="1" && getRadioValue(MS)=="0") socialSecurityPayments=salaryAtRetirement*RI*.259715;
	if(getRadioValue(SS)=="0") socialSecurityPayments = 0;
	if(PI) pensionIncomeAtRetirement = returnPresentValueFutureValue(PI, Y, i);
	else pensionIncomeAtRetirement = 0;
	var annualRetirementIncomeGap = salaryAtRetirement*RI-socialSecurityPayments-pensionIncomeAtRetirement;
	if(annualRetirementIncomeGap <= 0)annualRetirementIncomeGap='none';
	
	var savingsNeededAtRetirement = annualRetirementIncomeGap/RORA;
	if(savingsNeededAtRetirement <= 0)savingsNeededAtRetirement='none';

	var valueOfSavingsAtRetirement = returnPresentValueFutureValue(LS, Y, RORB);
	var savingsGap = savingsNeededAtRetirement-valueOfSavingsAtRetirement;
	if(savingsGap <= 0)savingsGap='none';

	var monthlySavingsNeeded = Math.round(((savingsGap)*(RORA/12))/(Math.pow((1+RORA/12),(12*Y))-1));
	if(monthlySavingsNeeded <= 0)monthlySavingsNeeded='none';

	document.getElementById('answerRetirementSavings').style.display='block';
	document.getElementById('answerSalaryAtRetirement').value=currencyFormat(salaryAtRetirement);
	document.getElementById('answerIncomeRequiredAtRetirement').value=currencyFormat(salaryAtRetirement*RI);
	document.getElementById('answerSocialSecurityPayments').value=currencyFormat(socialSecurityPayments);
	document.getElementById('answerAnnualPensionIncome').value=currencyFormat(pensionIncomeAtRetirement);
	document.getElementById('answerAnnualRetirementIncomeGap').value=currencyFormat(annualRetirementIncomeGap);
	document.getElementById('answerSavingsNeededAtRetirement').value=currencyFormat(savingsNeededAtRetirement);
	document.getElementById('answerValueOfCurrentSavingsAtRetirement').value=currencyFormat(valueOfSavingsAtRetirement);
	document.getElementById('answerSavingsGap').value=currencyFormat(savingsGap);
	document.getElementById('answerMonthlyInvestmentNeeded').value=currencyFormat(monthlySavingsNeeded);
	return true; 
}

function rothIRAConversion(){
	today = new Date();
	thisYear = today.getFullYear();

  	if(!validateField(document.getElementById('age'),'years', 'your Current Age'))return false;
  	if(!validateField(document.getElementById('ageWhenIncomeStarts'),'years', 'the Number of Years you expect to Receive Income'))return false;
  	if(!validateField(document.getElementById('numberOfYearsToReceiveIncome'),'amount', 'the Number of Years you expect to Receive Income'))return false;
  	if(!validateField(document.getElementById('accumulationROR'),'rate', 'the Accumulation Phase Rate of Return'))return false;
  	if(!validateField(document.getElementById('distributionROR'),'rate', 'the Distribution Phase Rate of Return'))return false;
  	if(!validateField(document.getElementById('accumulationIncomeTaxBracket'),'rate', 'your Income Tax Rate During the Accumulation Phase'))return false;
  	if(!validateField(document.getElementById('distributionIncomeTaxBracket'),'rate', 'your Income Tax Rate During the Distribution Phase'))return false;
  	if(!validateField(document.getElementById('currentIRABalance'),'amount', 'your Current IRA Balance'))return false;
  	if(!validateField(document.getElementById('nonDeductiblePortionOfIRA'),'amount', 'the Non-Deductible Portion of the IRA'))return false;

	howPayCoversionTax=document.getElementById('howPayConversionTax').value; 
	//delayTaxPayments=document.getElementById('delayTaxPayments').value;
	delayTaxPayments=0;

	age=document.getElementById('age').value;
	ageWhenIncomeStarts=document.getElementById('ageWhenIncomeStarts').value;
	numberOfYearsToReceiveIncome=document.getElementById('numberOfYearsToReceiveIncome').value;
	accumulationROR=document.getElementById('accumulationROR').value;
	distributionROR=document.getElementById('distributionROR').value;
	accumulationIncomeTaxBracket=document.getElementById('accumulationIncomeTaxBracket').value;
	distributionIncomeTaxBracket=document.getElementById('distributionIncomeTaxBracket').value;
	currentIRABalance=document.getElementById('currentIRABalance').value;
	nonDeductiblePortionOfIRA=document.getElementById('nonDeductiblePortionOfIRA').value;
	nonDeductiblePortionOfIRARoth='n/a';

	accumulationROR = accumulationROR/100;
	distributionROR = distributionROR/100;
	accumulationIncomeTaxBracket = accumulationIncomeTaxBracket/100;
	distributionIncomeTaxBracket = distributionIncomeTaxBracket/100;

	currentIRABalanceDeductible = currentIRABalance - nonDeductiblePortionOfIRA;
	currentIRABalanceDeductibleRoth = 'n/a';

	if(delayTaxPayments==0){
		investmentSavingsDelayedPayments=0;
		investmentSavingsDelayedPaymentsRoth=0;
	} else {
		if(howPayCoversionTax==1){
			//investmentSavingsDelayedPayments=returnPresentValueFutureValue(currentIRABalanceDeductible*accumulationIncomeTaxBracket, 2012-thisYear, accumulationROR*(1-accumulationIncomeTaxBracket))-currentIRABalanceDeductible*accumulationIncomeTaxBracket;
			//investmentSavingsDelayedPayments=(returnPresentValueFutureValue(nonDeductiblePortionOfIRA, (2012-thisYear), accumulationROR))-nonDeductiblePortionOfIRA;
			//firstYearSavings=returnPresentValueFutureValue(25000, .75, .08*.75)-12500;
			//secondYearSavings=returnPresentValueFutureValue(firstYearSavings, 1, .08*.75)-12500;
			//investmentSavingsDelayedPayments=secondYearSavings;
			investmentSavingsDelayedPayments=0;
			investmentSavingsDelayedPaymentsRoth=0;
		} else {
			investmentSavingsDelayedPayments=0;
			investmentSavingsDelayedPaymentsRoth=0;
			//investmentSavingsDelayedPaymentsRoth=returnPresentValueFutureValue(currentIRABalanceDeductible*accumulationIncomeTaxBracket, 2012-thisYear, accumulationROR*(1-accumulationIncomeTaxBracket))-currentIRABalanceDeductible*accumulationIncomeTaxBracket;
			//investmentSavingsDelayedPaymentsRoth=(returnPresentValueFutureValue(nonDeductiblePortionOfIRA, (2012-thisYear), accumulationROR))-nonDeductiblePortionOfIRA;
			//firstYearSavings=returnPresentValueFutureValue(25000, .75, .08*.75)-12500;
			//secondYearSavings=returnPresentValueFutureValue(firstYearSavings, 1, .08*.75)-12500;
			//investmentSavingsDelayedPaymentsRoth=secondYearSavings;
		}
	}
	//alert(delayTaxPayments+" "+investmentSavingsDelayedPayments+" "+investmentSavingsDelayedPaymentsRoth);

	if(howPayCoversionTax==1){
		
		sideAccount=currentIRABalanceDeductible*accumulationIncomeTaxBracket;
		sideAccountRoth='n/a';
		
		lessConversionTaxLiability = 'n/a';
		lessConversionTaxLiabilityRoth = 0;
		
		adjustedBeginningComparisonBalance = parseInt(currentIRABalanceDeductible)+parseInt(nonDeductiblePortionOfIRA)+parseInt(sideAccount)+parseInt(investmentSavingsDelayedPayments);
		adjustedBeginningComparisonBalanceRoth = currentIRABalance-lessConversionTaxLiabilityRoth+parseInt(investmentSavingsDelayedPaymentsRoth);
		
		estimatedSideAccount=returnPresentValueFutureValue(sideAccount, ageWhenIncomeStarts-age, accumulationROR*(1-accumulationIncomeTaxBracket));
		estimatedSideAccountRoth='n/a';
		
		estimatedIRABalanceDeductible = returnPresentValueFutureValue(currentIRABalanceDeductible, ageWhenIncomeStarts-age, accumulationROR)
		estimatedIRABalanceNonDeductible = returnPresentValueFutureValue(nonDeductiblePortionOfIRA, ageWhenIncomeStarts-age, accumulationROR)
		estimatedRothIRABalance = returnPresentValueFutureValue(adjustedBeginningComparisonBalanceRoth, ageWhenIncomeStarts-age, accumulationROR)
		
	} else {
		
		sideAccount=0;
		sideAccountRoth='n/a';
		
		lessConversionTaxLiability = 'n/a';
		lessConversionTaxLiabilityRoth = currentIRABalanceDeductible*accumulationIncomeTaxBracket;
		
		adjustedBeginningComparisonBalance = parseInt(currentIRABalanceDeductible)+parseInt(nonDeductiblePortionOfIRA)+parseInt(sideAccount)+parseInt(investmentSavingsDelayedPayments);
		adjustedBeginningComparisonBalanceRoth = currentIRABalance-lessConversionTaxLiabilityRoth+parseInt(investmentSavingsDelayedPaymentsRoth);

		estimatedIRABalanceDeductible = returnPresentValueFutureValue(currentIRABalanceDeductible, ageWhenIncomeStarts-age, accumulationROR)
		estimatedIRABalanceNonDeductible = returnPresentValueFutureValue(nonDeductiblePortionOfIRA, ageWhenIncomeStarts-age, accumulationROR)
		estimatedRothIRABalance = returnPresentValueFutureValue(adjustedBeginningComparisonBalanceRoth, ageWhenIncomeStarts-age, accumulationROR)
		
		estimatedSideAccount=0;
		estimatedSideAccountRoth='n/a';
		
	}
	
	estimatedValueAtRetirement = parseInt(estimatedIRABalanceDeductible) + parseInt(estimatedIRABalanceNonDeductible) + parseInt(estimatedSideAccount)
	estimatedValueAtRetirementRoth = parseInt(estimatedRothIRABalance)
	
	yearlyIncomeDeductible = returnPeriodicWithdrawlsFromALumpSum(estimatedIRABalanceDeductible, distributionROR, 1, numberOfYearsToReceiveIncome)*(1-distributionIncomeTaxBracket);
	yearlyIncomeDeductibleRoth = 'n/a';
	
	yearlyIncomeNondeductible = returnPeriodicWithdrawlsFromALumpSum(estimatedIRABalanceNonDeductible, distributionROR, 1, numberOfYearsToReceiveIncome)*(1-distributionIncomeTaxBracket);
	yearlyIncomeNondeductibleRoth = 'n/a';

	yearlySideAccountIncome = returnPeriodicWithdrawlsFromALumpSum(estimatedSideAccount, distributionROR*(1-distributionIncomeTaxBracket), 1, numberOfYearsToReceiveIncome);
	yearlySideAccountIncomeRoth = 'n/a';

	yearlyRothIRAIncome = 'n/a';
	yearlyRothIRAIncomeRoth = returnPeriodicWithdrawlsFromALumpSum(estimatedRothIRABalance, distributionROR, 1, numberOfYearsToReceiveIncome);

	annualAfterTaxIncome = parseInt(yearlyIncomeDeductible)+parseInt(yearlyIncomeNondeductible)+parseInt(yearlySideAccountIncome);
	annualAfterTaxIncomeRoth = yearlyRothIRAIncomeRoth;

	monthlyAfterTaxIncome = annualAfterTaxIncome/12;
	monthlyAfterTaxIncomeRoth = yearlyRothIRAIncomeRoth/12;

	document.getElementById('answerRothIRAConversion').style.display='block';
	
	document.getElementById('currentIRABalanceDeductible').value = currencyFormat(currentIRABalanceDeductible);
	document.getElementById('currentIRABalanceDeductibleRoth').value = currencyFormat(currentIRABalanceDeductibleRoth);
	
	document.getElementById('currentIRABalanceNondeductible').value = currencyFormat(nonDeductiblePortionOfIRA);
	document.getElementById('currentIRABalanceNondeductibleRoth').value = currencyFormat(nonDeductiblePortionOfIRARoth);
	
	document.getElementById('sideAccount').value = currencyFormat(sideAccount);
	document.getElementById('sideAccountRoth').value = currencyFormat(sideAccountRoth);
	
	document.getElementById('rothConversionAmount').value = 'n/a';
	document.getElementById('rothConversionAmountRoth').value = currencyFormat(currentIRABalance);
	
	document.getElementById('lessConversionTaxLiability').value = lessConversionTaxLiability;
	document.getElementById('lessConversionTaxLiabilityRoth').value = currencyFormat(lessConversionTaxLiabilityRoth);
	
	//document.getElementById('investmentSavingsDelayedPayments').value = currencyFormat(investmentSavingsDelayedPayments);
	//document.getElementById('investmentSavingsDelayedPaymentsRoth').value = currencyFormat(investmentSavingsDelayedPaymentsRoth);
	
	document.getElementById('adjustedBeginningComparisonBalance').value = currencyFormat(adjustedBeginningComparisonBalance);
	document.getElementById('adjustedBeginningComparisonBalanceRoth').value = currencyFormat(adjustedBeginningComparisonBalanceRoth);
	
	document.getElementById('estimatedIRABalanceDeductible').value = currencyFormat(estimatedIRABalanceDeductible);
	document.getElementById('estimatedIRABalanceDeductibleRoth').value = 'n/a';
	
	document.getElementById('estimatedIRABalanceNondeductible').value = currencyFormat(estimatedIRABalanceNonDeductible);
	document.getElementById('estimatedIRABalanceNondeductibleRoth').value = 'n/a';
	
	document.getElementById('estimatedSideAccount').value = currencyFormat(estimatedSideAccount);
	document.getElementById('estimatedSideAccountRoth').value = currencyFormat(estimatedSideAccountRoth);

	document.getElementById('estimatedRothIRABalance').value = 'n/a';
	document.getElementById('estimatedRothIRABalanceRoth').value = currencyFormat(estimatedRothIRABalance);

	document.getElementById('estimatedValueAtRetirement').value = currencyFormat(estimatedValueAtRetirement);
	document.getElementById('estimatedValueAtRetirementRoth').value = currencyFormat(estimatedValueAtRetirementRoth);

	document.getElementById('yearlyIncomeDeductible').value = currencyFormat(yearlyIncomeDeductible);
	document.getElementById('yearlyIncomeDeductibleRoth').value = currencyFormat(yearlyIncomeDeductibleRoth);
	
	document.getElementById('yearlyIncomeNonDeductible').value = currencyFormat(yearlyIncomeNondeductible);
	document.getElementById('yearlyIncomeNonDeductibleRoth').value = currencyFormat(yearlyIncomeNondeductibleRoth);
	
	document.getElementById('sideAccountIncome').value = currencyFormat(yearlySideAccountIncome);
	document.getElementById('sideAccountIncomeRoth').value = currencyFormat(yearlySideAccountIncomeRoth);
	
	document.getElementById('rothIRAIncome').value = currencyFormat(yearlyRothIRAIncome);
	document.getElementById('rothIRAIncomeRoth').value = currencyFormat(yearlyRothIRAIncomeRoth);
	
	document.getElementById('annualAfterTaxIncome').value = currencyFormat(annualAfterTaxIncome);
	document.getElementById('annualAfterTaxIncomeRoth').value = currencyFormat(yearlyRothIRAIncomeRoth);
	
	document.getElementById('monthlyAfterTaxIncome').value = currencyFormat(monthlyAfterTaxIncome);
	document.getElementById('monthlyAfterTaxIncomeRoth').value = currencyFormat(monthlyAfterTaxIncomeRoth);
}
  
function savingsGoalPlanner(t, goal, inflation, r, LS){

	if(!validateField(document.getElementById('years'),'years', 'the Years You Can Wait To Achieve Your Goal'))return false;
	if(!validateField(document.getElementById('goalAmount'),'amount', "the Goal Amount in Today's Dollars"))return false;
	if(!validateField(document.getElementById('inflationRate'),'rate', "the Annual Inflation Rate"))return false;
	if(!validateField(document.getElementById('growthRate'),'rate', 'the Annual Investment Growth Rate'))return false;
	if(!validateField(document.getElementById('savingsToInvest'),'amount', 'the Savings You Can Invest Now'))return false;

	r = r/100;
	inflation = inflation/100;

	var futureValueLS = Math.round(returnPresentValueFutureValue(LS, t, r));
  	var futureValueGoal = Math.round(returnPresentValueFutureValue(goal, t, inflation));
  	var additionalLS = Math.round(returnPresentValueFutureValue('',t,r,futureValueGoal)-LS);
	var monthlyPayments = Math.round(((futureValueGoal-futureValueLS)*(r/12))/(Math.pow((1+r/12),(12*t))-1));

	document.getElementById('answerSavingsGoalPlanner').style.display='block';

	document.getElementById('futureValueCurrentSavings').value = currencyFormat(futureValueLS);
	document.getElementById('futureValueGoalAmount').value = currencyFormat(futureValueGoal);
	document.getElementById('additionalLumpSum').value = currencyFormat(additionalLS);
	document.getElementById('monthlySavingsNeeded').value = currencyFormat(monthlyPayments);
}

function taxDeferredAccumulation(LS, t, taxRate, r){
	if(!validateField(document.getElementById('investmentAmount'),'amount', 'the Investment Amount'))return false;
	if(!validateField(document.getElementById('years'),'years', 'the Number of Years Invested'))return false;
	if(!validateField(document.getElementById('taxRate'),'rate', 'the Marginal Income Tax Rate'))return false;
	if(!validateField(document.getElementById('growthRate'),'rate', 'the Annual Investment Growth Rate Before Taxes'))return false;

	r = r/100;
	taxRate = taxRate/100;
	var taxable = LS*(Math.pow((1+r*(1-taxRate)),t));
  	var taxDeferred = LS*Math.pow((1+r),t);

	document.getElementById('answerTaxDeferredAccumulation').style.display='block';

	document.getElementById('futureValueTaxable').value = currencyFormat(taxable);
	document.getElementById('futureValueTaxDeferred').value = currencyFormat(taxDeferred);
}
  
function getRadioValue(radioField){
	for (var i=0; i < radioField.length; i++){
	   	if (radioField[i].checked){
			return radioField[i].value;
		}
	}
}

function currencyFormat(num){
	if(num=='n/a'){
		return 'n/a';
	} else {
		num = num.toString().replace(/\$|\,/g,'');
		if(isNaN(num))
			num = "0";
		sign = (num == (num = Math.abs(num)));
		num = Math.floor(num*100+0.50000000001);
		cents = num%100;
		num = Math.floor(num/100).toString();
		if(cents<10)
			cents = "0" + cents;
		for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
			num = num.substring(0,num.length-(4*i+3))+','+
		num.substring(num.length-(4*i+3));
		return (((sign)?'':'-') + '$' + num);
	}
}

function showChildrenInput(){
	switch(document.getElementById('numberOfChildren').value){
		case '0':
			document.getElementById('childCareCosts').style.display = 'none';
  			break;

		case '1':
 			document.getElementById('childCareCosts').style.display = 'block';
 			document.getElementById('child_1').style.display = 'block';
 			document.getElementById('child_2').style.display = 'none';
  			document.getElementById('child_3').style.display = 'none';
  			document.getElementById('child_4').style.display = 'none';
 			document.getElementById('child_1College').style.display = 'block';
 			document.getElementById('child_2College').style.display = 'none';
  			document.getElementById('child_3College').style.display = 'none';
  			document.getElementById('child_4College').style.display = 'none';
 			break;

		case '2':
 			document.getElementById('childCareCosts').style.display = 'block';
 			document.getElementById('child_1').style.display = 'block';
 			document.getElementById('child_2').style.display = 'block';
  			document.getElementById('child_3').style.display = 'none';
  			document.getElementById('child_4').style.display = 'none';
 			document.getElementById('child_1College').style.display = 'block';
 			document.getElementById('child_2College').style.display = 'block';
  			document.getElementById('child_3College').style.display = 'none';
  			document.getElementById('child_4College').style.display = 'none';
 			break;

		case '3':
 			document.getElementById('childCareCosts').style.display = 'block';
 			document.getElementById('child_1').style.display = 'block';
 			document.getElementById('child_2').style.display = 'block';
 			document.getElementById('child_3').style.display = 'block';
  			document.getElementById('child_4').style.display = 'none';
 			document.getElementById('child_1College').style.display = 'block';
 			document.getElementById('child_2College').style.display = 'block';
 			document.getElementById('child_3College').style.display = 'block';
  			document.getElementById('child_4College').style.display = 'none';
 			break;

		case '4':
 			document.getElementById('childCareCosts').style.display = 'block';
 			document.getElementById('child_1').style.display = 'block';
 			document.getElementById('child_2').style.display = 'block';
 			document.getElementById('child_3').style.display = 'block';
 			document.getElementById('child_4').style.display = 'block';
 			document.getElementById('child_1College').style.display = 'block';
 			document.getElementById('child_2College').style.display = 'block';
 			document.getElementById('child_3College').style.display = 'block';
 			document.getElementById('child_4College').style.display = 'block';
  			break;
	}
}
function showSpouseInput(){
	switch(document.getElementById('estimatingFor').value){
		case '0':
			document.getElementById('spouseRowHeading').style.display = 'none';
			document.getElementById('spouseRowHeading_2').style.display = 'none';

			document.getElementById('annualGrossIncomeSpouse').style.display = 'none';
			document.getElementById('estimateOfRetirementAssetsSpouse').style.display = 'none';
			document.getElementById('existingLifeInsuranceCoverageSpouse').style.display = 'none';
			document.getElementById('mortgageCoveredForFieldset').style.display = 'none';
			document.getElementById('livingExpensesCoveredForFieldset').style.display = 'none';
			document.getElementById('loanCreditDebtsCoveredForFieldset').style.display = 'none';
			document.getElementById('otherDebtCoveredForFieldset').style.display = 'none';
			document.getElementById('childcareCoveredForFieldset').style.display = 'none';
			document.getElementById('collegeCostsCoveredForFieldset').style.display = 'none';
 
			document.getElementById('answerMortgageDebtSpouseDiv').style.display = 'none';
			document.getElementById('answerMonthlyBills6MonthsSpouseDiv').style.display = 'none';
			document.getElementById('answerLoanAndCreditCardsSpouseDiv').style.display = 'none';
			document.getElementById('answerOtherDebtSpouseDiv').style.display = 'none';
			document.getElementById('answerTotalDebtSpouseDiv').style.display = 'none';
			document.getElementById('answerAdditionalMonthlyChildcareCostsSpouseDiv').style.display = 'none';
			document.getElementById('answerCollegeCostsSpouseDiv').style.display = 'none';
			document.getElementById('answerTotalChildNeedsSpouseDiv').style.display = 'none';
			document.getElementById('answerCashReserveSpouseDiv').style.display = 'none';
			document.getElementById('answerTotalProtectionNeededSpouseDiv').style.display = 'none';
			document.getElementById('answerLiquidAssetsSpouseDiv').style.display = 'none';
			document.getElementById('answerRetirementAssetsSpouseDiv').style.display = 'none';
			document.getElementById('answerLifeInsuranceCoverageCurrentlyInForceSpouseDiv').style.display = 'none';
			document.getElementById('answerTotalAssetsSpouseDiv').style.display = 'none';
			document.getElementById('answerRecommendedAmountOfAdditionalLifeInsuranceSpouseDiv').style.display = 'none';
			break;

		case '1':
			document.getElementById('spouseRowHeading').style.display = 'block';
			document.getElementById('spouseRowHeading_2').style.display = 'block';

			document.getElementById('annualGrossIncomeSpouse').style.display = 'inline';
			document.getElementById('estimateOfRetirementAssetsSpouse').style.display = 'inline';
			document.getElementById('existingLifeInsuranceCoverageSpouse').style.display = 'inline';
			document.getElementById('mortgageCoveredForFieldset').style.display = 'block';
			document.getElementById('livingExpensesCoveredForFieldset').style.display = 'block';
			document.getElementById('loanCreditDebtsCoveredForFieldset').style.display = 'block';
			document.getElementById('otherDebtCoveredForFieldset').style.display = 'block';
			document.getElementById('childcareCoveredForFieldset').style.display = 'block';
			document.getElementById('collegeCostsCoveredForFieldset').style.display = 'block';

			document.getElementById('answerMortgageDebtSpouseDiv').style.display = 'block';
			document.getElementById('answerMonthlyBills6MonthsSpouseDiv').style.display = 'block';
			document.getElementById('answerLoanAndCreditCardsSpouseDiv').style.display = 'block';
			document.getElementById('answerOtherDebtSpouseDiv').style.display = 'block';
			document.getElementById('answerTotalDebtSpouseDiv').style.display = 'block';
			document.getElementById('answerAdditionalMonthlyChildcareCostsSpouseDiv').style.display = 'block';
			document.getElementById('answerCollegeCostsSpouseDiv').style.display = 'block';
			document.getElementById('answerTotalChildNeedsSpouseDiv').style.display = 'block';
			document.getElementById('answerCashReserveSpouseDiv').style.display = 'block';
			document.getElementById('answerTotalProtectionNeededSpouseDiv').style.display = 'block';
			document.getElementById('answerLiquidAssetsSpouseDiv').style.display = 'block';
			document.getElementById('answerRetirementAssetsSpouseDiv').style.display = 'block';
			document.getElementById('answerLifeInsuranceCoverageCurrentlyInForceSpouseDiv').style.display = 'block';
			document.getElementById('answerTotalAssetsSpouseDiv').style.display = 'block';
			document.getElementById('answerRecommendedAmountOfAdditionalLifeInsuranceSpouseDiv').style.display = 'block';
break;

	}
}

function showSpouseInputEstateTax(){
	switch(document.getElementById('includeSpouse').checked){
		case false:
			document.getElementById('rowHeadingEstateTax').style.display = 'none';
			document.getElementById('assumedYearOfDeathSpouse').style.display = 'none';
			document.getElementById('estateValueSpouse').style.display = 'none';
			document.getElementById('growthRateSpouseSpan').style.display = 'none';
			document.getElementById('adjustedTaxableGiftsSpouseSpan').style.display = 'none';
			document.getElementById('giftTaxesPaidSpouseSpan').style.display = 'none';
			break;
		case true:
			document.getElementById('rowHeadingEstateTax').style.display = 'block';
			document.getElementById('assumedYearOfDeathSpouse').style.display = 'inline';
			document.getElementById('estateValueSpouse').style.display = 'inline';
			document.getElementById('growthRateSpouseSpan').style.display = 'inline';
			document.getElementById('adjustedTaxableGiftsSpouseSpan').style.display = 'inline';
			document.getElementById('giftTaxesPaidSpouseSpan').style.display = 'inline';
		break;

	}
}

function calculateEstateTax(num, yearOfDeath){
	switch(yearOfDeath){
		case '2011':
			if(num<=10000)return (num-10000)*.18;
			if(num>10000 && num<=20000)return (num-10000)*.20+1800;
			if(num> 20000 && num<=40000)return (num-20000)*.22+3800;
			if(num> 40000 && num<=60000)return (num-40000)*.24+8200;
			if(num> 60000 && num<=80000)return (num-60000)*.26+13000;
			if(num> 80000 && num<=100000)return (num-80000)*.28+18200;
			if(num> 100000 && num<=150000)return (num-100000)*.30+23800;
			if(num> 150000 && num<=250000)return (num-150000)*.32+38800;
			if(num> 250000 && num<=500000)return (num-250000)*.34+70800;
			if(num> 500000)return (num-500000)*.35+155800;
			break;
		case '2012':
			if(num<=10000)return (num-10000)*.18;
			if(num>10000 && num<=20000)return (num-10000)*.20+1800;
			if(num> 20000 && num<=40000)return (num-20000)*.22+3800;
			if(num> 40000 && num<=60000)return (num-40000)*.24+8200;
			if(num> 60000 && num<=80000)return (num-60000)*.26+13000;
			if(num> 80000 && num<=100000)return (num-80000)*.28+18200;
			if(num> 100000 && num<=150000)return (num-100000)*.30+23800;
			if(num> 150000 && num<=250000)return (num-150000)*.32+38800;
			if(num> 250000 && num<=500000)return (num-250000)*.34+70800;
			if(num> 500000)return (num-500000)*.35+155800;
			break;
		default:
			if(num<=1000000)return (num-1000000)*.345;
			if(num>1000000 && num<=1250000)return (num-1000000)*.41+345000;
			if(num>1250000 && num<=1500000)return (num-1250000)*.43+447500;
			if(num> 1500000 && num<=2000000)return (num-1500000)*.45+555000;
			if(num> 2000000 && num<=2500000)return (num-2000000)*.49+780000;
			if(num> 2500000 && num<=3000000)return (num-2500000)*.50+1025000;
			if(num> 3000000 && num<=10000000)return (num-3000000)*.55+1275000;
			if(num> 10000000 && num<=17184000)return (num-10000000)*.60+5125000;
			if(num> 17840000)return (num-17840000)*.55+9435400;
			break;
		
	}
}

function validateField(field, type, description){
	switch(type){
		case 'amount':
			if(field.value>=0){ 
			  //valid integer 
			} else {
				alert("Please enter a positive number for "+ description +"."); 
				field.focus(); 
				return 0;			
			}
			if(field.value.match(/^\d+$/)){ 
			  //valid integer 
			} else {
				alert("Please enter a number for "+ description +"."); 
				field.focus(); 
				return 0;		
			}
			if(field.value){ 
			  //valid integer 
			} else {
				alert("Please enter a number for "+ description +"."); 
				field.focus(); 
				return 0;			
			}
			return 1;
		break;

		case 'years':
			if(field.value>=0){ 
			  //valid integer 
			} else {
				alert("Please enter a positive number for "+ description +"."); 
				field.focus(); 
				break; 			
			}
			if(field.value.match(/^\d+$/)){ 
			  //valid integer 
			} else {
				alert("Please enter a number for "+ description +"."); 
				field.focus(); 
				break; 			
			}
			if(field.value){ 
			  //valid integer 
			} else {
				alert("Please enter a number for "+ description +"."); 
				field.focus(); 
				break; 			
			}
			return 1;
		break;

		case 'rate':
			if(field.value>=0){ 
			  //valid integer 
			} else {
				alert("Please enter a positive number for "+ description +"."); 
				field.focus(); 
				break; 			
			}
			if(field.value.match(/^\d+$/) || field.value.match(/^\d+\.\d+$/)){ 
			  //valid float 
			} else {
				alert("Please enter a number for "+ description +"."); 
				field.focus(); 
				break; 			
			}
			if(field.value){ 
			  //valid integer 
			} else {
				alert("Please enter a number for "+ description +"."); 
				field.focus(); 
				break; 			
			}
		  return 1;
	}

}

window.onload = function() {
	if(document.getElementById('estimatingFor')){
		showSpouseInput();
	}
	if(document.getElementById('includeSpouse')){
		showSpouseInputEstateTax();
	}
	
}

