/*****************************************
(C) http://www.calculator.net all right reserved.  
*****************************************/
function showquickobjmsg(C,B,A){if(B){C="<font color=red>"+C+"</font>"}gObj(A).innerHTML=C}function calc1(){Yl=trimAll(gObj("personalconsumption").value+"");lk=trimAll(gObj("grossinvestment").value+"");wk=trimAll(gObj("governmentconsumption").value+"");TW=trimAll(gObj("exportv").value+"");dU=trimAll(gObj("importv").value+"");if(!isNumber(Yl)){showquickmsg("personal consumption need to be numeric",true);return }else{if(!isNumber(lk)){showquickmsg("gross investment need to be numeric",true);return }else{if(!isNumber(wk)){showquickmsg("government consumption need to be numeric",true);return }else{if(!isNumber(TW)){showquickmsg("export need to be numeric",true);return }else{if(!isNumber(dU)){showquickmsg("import need to be numeric",true);return }}}}}Yl=parseFloat(Yl);lk=parseFloat(lk);wk=parseFloat(wk);TW=parseFloat(TW);dU=parseFloat(dU);Pt=Yl+lk+wk+TW-dU;pc="<table><tr><td><b>item</b></td><td align=right><b>value</b></td></tr>";pc+="<tr><td>personal consumption:</td><td align=right>"+Yl+"</td></tr>";pc+="<tr><td>gross investment:</td><td align=right>"+lk+"</td></tr>";pc+="<tr><td>government consumption:</td><td align=right>"+wk+"</td></tr>";pc+="<tr><td>export:</td><td align=right>"+TW+"</td></tr>";pc+="<tr><td>import:</td><td align=right>"+dU+"</td></tr>";pc+="<tr><td><b>GDP:</b></td><td align=right><font color=green><b>"+Pt+"</b></font></td></tr></table>";showquickmsg(pc,false)}function calc2(){fq=trimAll(gObj("employeecompensation").value+"");SJ=trimAll(gObj("proprietorsincome").value+"");sj=trimAll(gObj("rents").value+"");BC=trimAll(gObj("corporateprofits").value+"");Co=trimAll(gObj("interestincome").value+"");Hl=trimAll(gObj("indirectbusinesstaxes").value+"");eY=trimAll(gObj("depreciation").value+"");au=trimAll(gObj("netincomeofforeigners").value+"");if(!isNumber(fq)){showquickobjmsg("employee compensation need to be numeric",true,"coutput2");return }else{if(!isNumber(SJ)){showquickobjmsg("proprietors' income need to be numeric",true,"coutput2");return }else{if(!isNumber(sj)){showquickobjmsg("rents need to be numeric",true,"coutput2");return }else{if(!isNumber(BC)){showquickobjmsg("corporate profits need to be numeric",true,"coutput2");return }else{if(!isNumber(Co)){showquickobjmsg("interest income need to be numeric",true,"coutput2");return }else{if(!isNumber(Hl)){showquickobjmsg("indirect business taxes need to be numeric",true,"coutput2");return }else{if(!isNumber(eY)){showquickobjmsg("depreciation need to be numeric",true,"coutput2");return }else{if(!isNumber(au)){showquickobjmsg("net income of foreigners need to be numeric",true,"coutput2");return }}}}}}}}fq=parseFloat(fq);SJ=parseFloat(SJ);sj=parseFloat(sj);BC=parseFloat(BC);Co=parseFloat(Co);Hl=parseFloat(Hl);eY=parseFloat(eY);au=parseFloat(au);dj=fq+SJ+sj+BC+Co;Pt=dj+Hl+eY+au;pc="<table><tr><td><b>item</b></td><td align=right><b>value</b></td></tr>";pc+="<tr><td>employee compensation:</td><td align=right>"+fq+"</td></tr>";pc+="<tr><td>proprietors' income:</td><td align=right>"+SJ+"</td></tr>";pc+="<tr><td>rents:</td><td align=right>"+sj+"</td></tr>";pc+="<tr><td>corporate profits:</td><td align=right>"+BC+"</td></tr>";pc+="<tr><td>interest income:</td><td align=right>"+Co+"</td></tr>";pc+="<tr><td><b>GNP:</b></td><td align=right><font color=green><b>"+dj+"</b></font></td></tr>";pc+="<tr><td>indirect business taxes:</td><td align=right>"+Hl+"</td></tr>";pc+="<tr><td>depreciation:</td><td align=right>"+eY+"</td></tr>";pc+="<tr><td>net income of foreigners:</td><td align=right>"+au+"</td></tr>";pc+="<tr><td><b>GDP:</b></td><td align=right><font color=green><b>"+Pt+"</b></font></td></tr></table>";showquickobjmsg(pc,false,"coutput2")};