/*****************************************
(C) http://www.calculator.net all right reserved.  
*****************************************/
function calc(){showquickmsg("calculating...",true);salary=trimAll(gObj("salary").value);pension=trimAll(gObj("pension").value);investment=trimAll(gObj("investment").value);otherincome=trimAll(gObj("otherincome").value);mortgage=trimAll(gObj("mortgage").value);propertytax=trimAll(gObj("propertytax").value);rental=trimAll(gObj("rental").value);autoloan=trimAll(gObj("autoloan").value);otherloan=trimAll(gObj("otherloan").value);grocery=trimAll(gObj("grocery").value);utilities=trimAll(gObj("utilities").value);transportation=trimAll(gObj("transportation").value);clothing=trimAll(gObj("clothing").value);childcare=trimAll(gObj("childcare").value);entertainment=trimAll(gObj("entertainment").value);otherliving=trimAll(gObj("otherliving").value);ira401k=trimAll(gObj("ira401k").value);collegesaving=trimAll(gObj("collegesaving").value);stockbond=trimAll(gObj("stockbond").value);othersavings=trimAll(gObj("othersavings").value);medicalinsurance=trimAll(gObj("medicalinsurance").value);medicalspending=trimAll(gObj("medicalspending").value);tuition=trimAll(gObj("tuition").value);othereducation=trimAll(gObj("othereducation").value);if(!isNumber(salary)){showquickmsg("salary & earned income need to be numeric",true);return }else{if(!isNumber(pension)){showquickmsg("pension & social security need to be numeric",true);return }else{if(!isNumber(investment)){showquickmsg("investment & saving need to be numeric",true);return }else{if(!isNumber(otherincome)){showquickmsg("other income need to be numeric",true);return }else{if(!isNumber(mortgage)){showquickmsg("mortgage need to be numeric",true);return }else{if(!isNumber(propertytax)){showquickmsg("property tax need to be numeric",true);return }else{if(!isNumber(rental)){showquickmsg("rental need to be numeric",true);return }else{if(!isNumber(autoloan)){showquickmsg("auto loan need to be numeric",true);return }else{if(!isNumber(otherloan)){showquickmsg("other loan and liability need to be numeric",true);return }else{if(!isNumber(grocery)){showquickmsg("grocery items need to be numeric",true);return }else{if(!isNumber(utilities)){showquickmsg("utilities need to be numeric",true);return }else{if(!isNumber(transportation)){showquickmsg("transportation need to be numeric",true);return }else{if(!isNumber(clothing)){showquickmsg("clothing need to be numeric",true);return }else{if(!isNumber(childcare)){showquickmsg("child & personal care need to be numeric",true);return }else{if(!isNumber(entertainment)){showquickmsg("entertainment need to be numeric",true);return }else{if(!isNumber(otherliving)){showquickmsg("other living expenses need to be numeric",true);return }else{if(!isNumber(ira401k)){showquickmsg("401k & IRA need to be numeric",true);return }else{if(!isNumber(collegesaving)){showquickmsg("college saving need to be numeric",true);return }else{if(!isNumber(stockbond)){showquickmsg("stock, bond, & funds need to be numeric",true);return }else{if(!isNumber(othersavings)){showquickmsg("other savings need to be numeric",true);return }else{if(!isNumber(medicalinsurance)){showquickmsg("medical insurance need to be numeric",true);return }else{if(!isNumber(medicalspending)){showquickmsg("medical spending need to be numeric",true);return }else{if(!isNumber(tuition)){showquickmsg("tuition need to be numeric",true);return }else{if(!isNumber(othereducation)){showquickmsg("other education spending need to be numeric",true);return }}}}}}}}}}}}}}}}}}}}}}}}salary=parseFloat(salary);pension=parseFloat(pension);investment=parseFloat(investment);otherincome=parseFloat(otherincome);mortgage=parseFloat(mortgage);propertytax=parseFloat(propertytax);rental=parseFloat(rental);autoloan=parseFloat(autoloan);otherloan=parseFloat(otherloan);grocery=parseFloat(grocery);utilities=parseFloat(utilities);transportation=parseFloat(transportation);clothing=parseFloat(clothing);childcare=parseFloat(childcare);entertainment=parseFloat(entertainment);otherliving=parseFloat(otherliving);ira401k=parseFloat(ira401k);collegesaving=parseFloat(collegesaving);stockbond=parseFloat(stockbond);othersavings=parseFloat(othersavings);medicalinsurance=parseFloat(medicalinsurance);medicalspending=parseFloat(medicalspending);tuition=parseFloat(tuition);othereducation=parseFloat(othereducation);totalIncome=salary+pension+investment+otherincome;totalhousingandotherdebt=mortgage+propertytax+rental+autoloan+otherloan;totallivingexpenses=grocery+utilities+transportation+clothing+childcare+entertainment+otherliving;totalsavingandinvestment=ira401k+collegesaving+stockbond+othersavings;totalhealthcare=medicalinsurance+medicalspending;totaleducation=tuition+othereducation;totalexpense=totalhousingandotherdebt+totallivingexpenses+totalsavingandinvestment+totalhealthcare+totaleducation;netIncome=totalIncome-totalexpense;outPutStr="<table class='cinfoT'><tr><td class='cinfoHd' colspan='3'>Results</td></tr>";outPutStr+="<tr><td>total income</td><td class='cinfoBodL' align='right'><b>"+totalIncome.toFixed(2)+"</b></td><td class='cinfoBodL'>&nbsp;</td></tr>";outPutStr+="<tr><td>total expenses</td><td class='cinfoBodL' align='right'><b>"+totalexpense.toFixed(2)+"</b></td><td class='cinfoBodL'>&nbsp;</td></tr>";if(netIncome<0){outPutStr+="<tr><td><b>net</b></td><td class='cinfoBodL' align='right'><font color=red><b>"+netIncome.toFixed(2)+"</b></font></td><td class='cinfoBodL'>&nbsp;</td></tr>"}else{outPutStr+="<tr><td>net</td><td class='cinfoBodL' align='right'><font color=green><b>"+netIncome.toFixed(2)+"</b></font></td><td class='cinfoBodL'>&nbsp;</td></tr>"}if(totalIncome>0){totalhousingandotherdebtpercent=100*totalhousingandotherdebt/totalIncome;totallivingexpensespercent=100*totallivingexpenses/totalIncome;totalsavingandinvestmentpercent=100*totalsavingandinvestment/totalIncome;totalhealthcarepercent=100*totalhealthcare/totalIncome;totaleducationpercent=100*totaleducation/totalIncome;ginicoefficient=grocery/totalIncome;outPutStr+="<tr><td>total housing & other debt expense</td><td class='cinfoBodL' align='right'><b>"+totalhousingandotherdebt.toFixed(2)+"</b>";if(totalhousingandotherdebtpercent>0.01){outPutStr+="</td><td class='cinfoBodL'>"+totalhousingandotherdebtpercent.toFixed(2)+"% of income";if(totalhousingandotherdebtpercent>30){outPutStr+=", <font color=red>recommend 30% or lower</font>"}}else{outPutStr+="</td><td class='cinfoBodL'>&nbsp"}outPutStr+="</td></tr>";outPutStr+="<tr><td>total living expenses</td><td class='cinfoBodL' align='right'><b>"+totallivingexpenses.toFixed(2)+"</b>";if(totallivingexpensespercent>0.01){outPutStr+="</td><td class='cinfoBodL'>"+totallivingexpensespercent.toFixed(2)+"% of income"}else{outPutStr+="</td><td class='cinfoBodL'>&nbsp"}outPutStr+="</td></tr>";outPutStr+="<tr><td>total savings & investments</td><td class='cinfoBodL' align='right'><b>"+totalsavingandinvestment.toFixed(2)+"</b>";outPutStr+="</td><td class='cinfoBodL'>"+totalsavingandinvestmentpercent.toFixed(2)+"% of income";if(totalsavingandinvestmentpercent<15){outPutStr+=", <font color=red>recommend 15% or higher</font>"}outPutStr+="</td></tr>";outPutStr+="<tr><td>healthcare expenses</td><td class='cinfoBodL' align='right'><b>"+totalhealthcare.toFixed(2)+"</b>";if(totalhealthcarepercent>0.01){outPutStr+="</td><td class='cinfoBodL'>"+totalhealthcarepercent.toFixed(2)+"% of income"}else{outPutStr+="</td><td class='cinfoBodL'>&nbsp"}outPutStr+="</td></tr>";outPutStr+="<tr><td>education expenses</td><td class='cinfoBodL' align='right'><b>"+totaleducation.toFixed(2)+"</b>";if(totaleducationpercent>0.01){outPutStr+="</td><td class='cinfoBodL'>"+totaleducationpercent.toFixed(2)+"% of income"}else{outPutStr+="</td><td class='cinfoBodL'>&nbsp"}outPutStr+="</td></tr>"}outPutStr+="</table>";showquickmsg(outPutStr,false)};