function SubmitForm() { document.estimate.submit(); } function TotalPage() { var legal = /[^0-9.]/ var tempText, result, total, errorInd; total = 0; errorInd = 0; for(var i=0; i < 8; i++) { tempText = document.estimate.elements[i].value; if(tempText.length > 0) { result = tempText.match(legal); if(result != null) { alert("You have entered characters that are not numeric (example, a decimal point). Enter numbers only.."); document.estimate.elements[i].focus(); errorInd = 1; break; } else { total = total + parseFloat(tempText); } } } if(errorInd != 1) { document.estimate.total.value = currency(total); document.estimate.yearcont.value = total; } } function CheckDed() { var legalamount = /[^0-9.]/; var legalperiods = /[^0-9]/; var amount, checkamount, periods, checkperiods, deduction; amount = document.estimate.yearcont.value; periods = document.estimate.nopaychk.value; if(periods != "") { checkamount = amount.match(legalamount); checkperiods = periods.match(legalperiods); if(checkamount == null) { if(checkperiods == null) { deduction = amount/periods; document.estimate.dedamt.value = currency(deduction); if(document.estimate.adjgross.value != "") TaxSaved(); } else { alert("You have entered characters that are not numeric (example, a decimal point). Enter numbers only."); document.estimate.dedamt.value = ""; document.estimate.nopaychk.focus(); } } else { alert("You have entered characters that are not numeric (example, a decimal point). Enter numbers only."); document.estimate.dedamt.value = ""; document.estimate.yearcont.focus(); } } else document.estimate.dedamt.value = ""; } function TaxSaved() { var legal = /[^0-9.]/; var i, salary, checksalary, progamount, checkamount, paycheck, filingStatus; var NumBracket, nameNumBracket, nameHighBracket, HighBracketLimit; var NumElements = document.estimate.length; salary = document.estimate.adjgross.value; progamount = document.estimate.yearcont.value; filingStatus = document.estimate.taxstatus.options[document.estimate.taxstatus.selectedIndex].value; nameNumBracket = "status" + filingStatus + "num"; for(i = 0; i < NumElements; i++) { if(document.estimate.elements[i].name == nameNumBracket) { NumBracket = document.estimate.elements[i].value - 1; break; } } //filingStatus = 1; //NumBracket = 1; // Set field names to search for in the form. nameHighBracket = "status" + filingStatus + "high" + NumBracket; // Loop through the form elements to find the field names set above which hold the // lower and upper limits for the tax bracket. for(i = 0; i < NumElements; i++) { if(document.estimate.elements[i].name == nameHighBracket) { HighBracketLimit = parseFloat(document.estimate.elements[i].value); break; } } if(salary == "" || progamount == "") { if(salary != "" && paycheck == "" && progamount == "") alert("You must have values in the \"Desired Year Contibutions\" and\nin the \"Annual Salary Boxes\""); } else if(salary > HighBracketLimit) { alert("Please contact FlexBen for details."); } else { // If any charaters besides those listed in legal exist then result will contain the // first bad character. If all characters are legal result will be null. checksalary = salary.match(legal); checkamount = progamount.match(legal); if(checksalary == null) { if(checkamount == null) { // All checks passed, perform calculations //alert("Savings Fed Tax: " + (getFedTaxSavings(salary, progamount)) ); //alert("Savings FICA Tax: " + (getFICASavings(salary, progamount))); document.estimate.estsav.value = currency((getFedTaxSavings(salary, progamount)) + (getFICASavings(salary, progamount))); } else { alert("You have entered characters that are not numeric (example, a decimal point). Enter numbers only."); document.estimate.yearcont.focus(); } } else { alert("You have entered characters that are not numeric (example, a decimal point). Enter numbers only."); document.estimate.adjgross.focus(); } } } function getFICASavings(income, progamount) { var excess, ficatax, progficatax, progsalary, progexcess, salarybreak; salarybreak = parseFloat(document.estimate.ficasalarybreak.value); income = parseFloat(income); // check if income level over the FICA tax salary break point if(income > salarybreak) { // over break point, calculate how much over excess = income - salarybreak; // calculate the amount of fica tax ficatax = (salarybreak * parseFloat(document.estimate.ficalowrate.value/100)) + (excess * parseFloat(document.estimate.ficahighrate.value/100)); // compute after program salary progsalary = income - parseFloat(progamount); // check to see if the program salary is over the break point if(progsalary > salarybreak) { // program salary over break point, calculate how much over progexcess = progsalary - salarybreak; // compute fica tax based off program salary progficatax = (salarybreak * parseFloat(document.estimate.ficalowrate.value/100)) + (progexcess * parseFloat(document.estimate.ficahighrate.value/100)); } else // program salary not over break point, compute simple fica tax from program salary progficatax = progsalary * parseFloat(document.estimate.ficalowrate.value/100); // return difference between fica tax based on regular salary and that based on the // program salary return (ficatax - progficatax); } else // base salary not over fica break point, return the program amount multiplied by the // lower salary range fica tax rate return (progamount * parseFloat(document.estimate.ficalowrate.value/100)); } function getFedTaxSavings(income, progamount) { var i, j, NumBrackets, nameHighBracket, nameLowBracket; var TaxRate, nameTaxBracket, LowBracketLimit, HighBracketLimit; // filiing status is the value selected from the drop down box var filingStatus = document.estimate.taxstatus.options[document.estimate.taxstatus.selectedIndex].value; // the field name of the number of tax brackets for the filing status var nameNumBrackets = "status" + filingStatus + "num"; // NumElements will hold the number of elements on the form. This will be used to set the // upper limit on loops used to search for a particular filed name. var NumElements = document.estimate.length; // convert passed in values for use in mathematical equations income = parseFloat(income); progamount = parseFloat(progamount); // Loop through the filed of the form to find an element with a name matching the value // of NumBrackets set above. Then, get the number of tax brackets associated with the // filing status selected and assign this to a variable. for(i = 0; i < NumElements; i++) { if(document.estimate.elements[i].name == nameNumBrackets) { NumBrackets = document.estimate.elements[i].value; break; } } // Loop through the number of tax brackets to check which Tax Rate to use for calculating // the tax savings. for(j = 0; j < NumBrackets; j++) { // Set field names to search for in the form. nameLowBracket = "status" + filingStatus + "low" + j; nameHighBracket = "status" + filingStatus + "high" + j; // Loop through the form elements to find the field names set above which hold the // lower and upper limits for the tax bracket. for(i = 0; i < NumElements; i++) { if(document.estimate.elements[i].name == nameLowBracket) { LowBracketLimit = parseFloat(document.estimate.elements[i].value); } if(document.estimate.elements[i].name == nameHighBracket) { HighBracketLimit = parseFloat(document.estimate.elements[i].value); } } // check if income falls into range, if so get the tax rate associated with the range if((income > LowBracketLimit) && (income <= HighBracketLimit)) { nameTaxBracket = "status" + filingStatus + "taxrate" + j; for(i = 0; i < NumElements; i++) { if(document.estimate.elements[i].name == nameTaxBracket) { TaxRate = parseFloat(document.estimate.elements[i].value); break; } } break; } } // return tax savings return (progamount * (TaxRate/100)); } function currency(anynum) { //-- Returns passed number as string in $xxx,xxx.xx format. anynum=eval(anynum) workNum=Math.abs((Math.round(anynum*100)/100));workStr=""+workNum if (workStr.indexOf(".")==-1){workStr+=".00"} dStr=workStr.substr(0,workStr.indexOf("."));dNum=dStr-0 pStr=workStr.substr(workStr.indexOf(".")) while (pStr.length < 3){pStr+="0"} //--- Adds comma in thousands place. if (dNum >= 1000) { dLen=dStr.length dStr=parseInt(""+(dNum/1000))+","+dStr.substring(dLen-3,dLen) } //-- Adds comma in millions place. if (dNum >= 1000000) { dLen=dStr.length dStr=parseInt(""+(dNum/1000000))+","+dStr.substring(dLen-7,dLen) } retval = dStr + pStr //-- Put numbers in parentheses if negative. if (anynum < 0) {retval="("+retval+")"} return "$"+retval }

Health Care Flexible Spending Account (FSA) Calculator

This calculator will help you estimate your annual out-of-pocket, uncovered health care expenses. It will also provide an estimated tax savings if you use a health care account.

Use the tab key to move between the fields.

Amount

$
$
$
$
$
$
$
$
 
$
 
 
$
 
 

]]>