function updateTotals()
{
  var theForm = document.forms[1];
  var fedTax = getValue(theForm.federalTaxRate.value)/100;
  var stateTax = getValue(theForm.stateTaxRate.value)/100;
  ssTax =.0765;
  var taxRate = fedTax + stateTax + ssTax;


  //validate the form
  strErrors = validateForm(theForm);

  if(strErrors.length == 0)
  {
    //update Taxable Income
    theForm.woTaxIncome.value = formatCurrency(theForm.totalIncome.value);
    theForm.wTaxIncome.value = formatCurrency(parseFloat(getValue(theForm.totalIncome.value)) - parseFloat(getValue(theForm.depExpenses.value)));

    //update taxes witheld
    theForm.woTaxWithheld.value = formatCurrency(getValue(theForm.woTaxIncome.value) * taxRate);
    theForm.wTaxWithheld.value = formatCurrency(getValue(theForm.wTaxIncome.value) * taxRate);

    //
    theForm.woDepCareExpenses.value = formatCurrency(getValue(theForm.depExpenses.value));
  
  
    //update resulting take home pay
    theForm.woTakeHome.value = formatCurrency(getValue(theForm.woTaxIncome.value) - getValue(theForm.woTaxWithheld.value));
    theForm.wTakeHome.value = formatCurrency(getValue(theForm.wTaxIncome.value) - getValue(theForm.wTaxWithheld.value));

    //update disposable income
    theForm.woDisposableIncome.value = formatCurrency(getValue(theForm.woTakeHome.value) - getValue(theForm.woDepCareExpenses.value));
    theForm.wDisposableIncome.value = formatCurrency(getValue(theForm.wTakeHome.value));

    //update difference in disposable income
    theForm.TaxSavings.value = formatCurrency(getValue(theForm.wDisposableIncome.value) - getValue(theForm.woDisposableIncome.value));

  }
  else
  {
  
    alert("The following fields need to be corrected:" + "\n" + strErrors);

    //clear out fields
    theForm.woTaxIncome.value = "";
    theForm.wTaxIncome.value = "";
    theForm.woTaxWithheld.value = "";
    theForm.wTaxWithheld.value = "";
    theForm.woDepCareExpenses.value = "";
    theForm.woTakeHome.value = "";
    theForm.wTakeHome.value = "";
	theForm.woDisposableIncome.value = "";
	theForm.wDisposableIncome.value = "";
    theForm.TaxSavings.value = "";
    

  }
  
}


function validateForm(theForm)
{
  var strResponse = "";
  
  //must enter total income
  if(getValue(theForm.totalIncome.value)<=0)
  {
    //blnValid = false;
    strResponse = ' - Total Income is required' + '\n';
  }


  //contribution must be less than total income
  if(getValue(theForm.depExpenses.value) > getValue(theForm.totalIncome.value))
  {
    strResponse = strResponse + ' - Dependent Care expenses must be less than total income' + '\n';
  }
  

  //contribution < 5,000
  if(getValue(theForm.depExpenses.value)>5000)
  {
    strResponse = strResponse + ' - Contribution cannot be greater than $5,000' + '\n';
  }
  
  
  //Federal Tax <= 40
  if(getValue(theForm.federalTaxRate.value)>40)
  {
    strResponse = strResponse + ' - Federal tax rate cannot be greater than 40%' + '\n';
  }

  //State Tax <= 15
  if(getValue(theForm.stateTaxRate.value)>15)
  {
    strResponse = strResponse + ' - State tax rate cannot be greater than 15%' + '\n';
  }

  return strResponse;

}