window.onerror=errorSupress;function errorSupress(){return true;};function analTab(){var alltrNode=calcTabNode.getElementsByTagName('tr');var allTitleTopNode=alltrNode[0].getElementsByTagName('td');var allTitleBotNode=alltrNode[alltrNode.length-1].getElementsByTagName('td');for(var titNum=0;titNum<allTitles.length;titNum++){allTitleTopNode[titNum].firstChild.nodeValue=allTitles[titNum];allTitleBotNode[titNum].firstChild.nodeValue=allTitles[titNum];if(titNum>0){var newplotVal=allTitles[titNum];var newOptionNode=document.createElement('option');newOptionNode.setAttribute('value',newplotVal);var newTextNode=document.createTextNode(newplotVal);newOptionNode.appendChild(newTextNode);plotSelectNode.appendChild(newOptionNode);}};plotSelectNode.getElementsByTagName('option')[0].setAttribute('selected',true);};function analysisReset(){var trNum=calcTabNode.getElementsByTagName('tr').length;var trKeepNum=5;var trBotNum=3;if(trNum>trKeepNum){for(var y=2;y<trNum-trBotNum;y++){calcTabNode.deleteRow(2);}};var alltrNode=calcTabNode.getElementsByTagName('tr');var allTitleTopNode=alltrNode[0].getElementsByTagName('td');var allTitleBotNode=alltrNode[alltrNode.length-1].getElementsByTagName('td');allTitleTopNode[0].firstChild.nodeValue=allTitles[0];allTitleBotNode[0].firstChild.nodeValue=allTitles[0];document.getElementById('sumDesc').firstChild.nodeValue="";document.getElementById('tabDesc').firstChild.nodeValue="";};function addData(){addTest=true;loadSel();analysis();addTest=false;};function addDataOK(){if(document.getElementById('tdYear').firstChild.nodeValue!="Investment Profile"){if(document.getElementById('tdY0').firstChild.nodeValue!="-"){if(document.getElementById('addCompSelect').value!="Select Investment Profile"&&document.getElementById('addCompSelect').value!=""){plsWait();setTimeout("addData()",10);}else{alert("Please Select Investment Profile to Add from the drop down list.");document.getElementById('addCompSelect').focus();}}else{alert("First you must Build an inital Analysis Table. Then you can Add the Selected Investment Profile");}}else{alert("You cannot Add to the Summary Table. First you must Build an inital Analysis Table. Then you can Add the Selected Investment Profile");}};function analData(){analTest=true;analysisReset();analysis();analTest=false;};function analDataOK(){plsWait();setTimeout("analData()",10);};function analysis(){descVal=document.getElementById('ProfileDescription').value;var purAmoVal=parseInt(document.getElementById('PurchaseAmount').value);if(isNaN(purAmoVal)){purAmoVal='0';document.getElementById('PurchaseAmount').value=purAmoVal;};var purExpVal=parseInt(document.getElementById('PurchaseExpense').value);if(isNaN(purExpVal)){purExpVal='0';document.getElementById('PurchaseExpense').value=purExpVal;};var gthPerVal=parseFloat(document.getElementById('GrowthPercent').value);if(isNaN(gthPerVal)){gthPerVal='0.00';document.getElementById('GrowthPercent').value=gthPerVal;};var addCapVal=parseInt(document.getElementById('AdditionalCapital').value);if(isNaN(addCapVal)){addCapVal='0';document.getElementById('AdditionalCapital').value=addCapVal;};var addExpVal=parseInt(document.getElementById('AdditionalExpense').value);if(isNaN(addExpVal)){addExpVal='0';document.getElementById('AdditionalExpense').value=addExpVal;};var incTypeVal=document.getElementById('IncomeType').value;var incPerVal=parseFloat(document.getElementById('IncomePercent').value);if(isNaN(incPerVal)){incPerVal='0.00';document.getElementById('IncomePercent').value=incPerVal;};var incBaseInVal=parseInt(document.getElementById('IncomeBase').value);if(isNaN(incBaseInVal)){incBaseInVal='0';document.getElementById('IncomeBase').value=incBaseInVal;};var expTypeVal=document.getElementById('ExpenseType').value;var expPerVal=parseFloat(document.getElementById('ExpensePercent').value);if(isNaN(expPerVal)){expPerVal='0.00';document.getElementById('ExpensePercent').value=expPerVal;};var expBaseInVal=parseInt(document.getElementById('ExpenseBase').value);if(isNaN(expBaseInVal)){expBaseInVal='0';document.getElementById('ExpenseBase').value=expBaseInVal;};var loanAmoVal=parseInt(document.getElementById('LoanAmount').value);if(isNaN(loanAmoVal)){loanAmoVal='0';document.getElementById('LoanAmount').value=loanAmoVal;};var intPerVal=parseFloat(document.getElementById('InterestPercent').value);if(isNaN(intPerVal)){intPerVal='0.00';document.getElementById('InterestPercent').value=intPerVal;};var loanRepVal=parseInt(document.getElementById('AnnualRepay').value);if(isNaN(loanRepVal)){loanRepVal='0';document.getElementById('AnnualRepay').value=loanRepVal;};var yearsVal=parseInt(document.getElementById('Years').value);if(isNaN(yearsVal)){yearsVal='0';document.getElementById('Years').value=yearsVal;};var indPerVal=parseInt(document.getElementById('IndexPercent').value);if(isNaN(indPerVal)){indPerVal='0.00';document.getElementById('IndexPercent').value=indPerVal;};var taxPerVal=parseInt(document.getElementById('TaxPercent').value);if(isNaN(taxPerVal)){taxPerVal='0.00';document.getElementById('TaxPercent').value=taxPerVal;};yearVal=0;assetVal=purAmoVal;intVal=0;loanVal=loanAmoVal;equVal=purAmoVal-loanAmoVal;equeqVal=equVal;incVal=0;expVal=purExpVal;surVal=-expVal;sureqVal=surVal;surtaxVal=surVal*(1-taxPerVal/100);surtaxeqVal=surtaxVal;cashVal=surtaxVal-equVal;casheqVal=cashVal;retVal=surtaxVal;retperVal=retVal/equVal*100;if(isNaN(retperVal)){retperVal='0.00';}else{retperVal=forNumRet(retperVal,2);};var realretVal=retVal;realretperVal=realretVal/equeqVal*100;if(isNaN(realretperVal)){realretperVal="0.00";}else{realretperVal=forNumRet(realretperVal,2);}var firNode=calcTabNode.getElementsByTagName('tr')[1];firNode.setAttribute('id','y0');var allFirtd=firNode.getElementsByTagName('td');var yearCur=yearVal;var assetCur=assetVal;var intCur=intVal;var loanCur=loanVal;var equCur=equVal;var equeqCur=equeqVal;var incCur=incVal;var expCur=expVal;var surCur=surVal;var sureqCur=sureqVal;var surtaxCur=surtaxVal;var surtaxeqCur=surtaxeqVal;var cashCur=cashVal;var casheqCur=casheqVal;var retCur=retVal;var retperCur=retperVal;var realretCur=realretVal;var realretperCur=realretperVal;var assetPre=assetCur;var equDiffCur;var equDiff;allCur=new Array(yearCur,assetCur,loanCur,equCur,equeqCur,incCur,expCur,intCur,surCur,sureqCur,surtaxCur,surtaxeqCur,cashCur,casheqCur,retCur,retperCur,realretCur,realretperCur);if(analTest==true){allFirtd[yearCol].firstChild.nodeValue=yearVal;allFirtd[assetCol].firstChild.nodeValue=assetVal;allFirtd[intCol].firstChild.nodeValue=intVal;allFirtd[loanCol].firstChild.nodeValue=loanVal;allFirtd[equCol].firstChild.nodeValue=equVal;allFirtd[equeqCol].firstChild.nodeValue=equeqVal;allFirtd[incCol].firstChild.nodeValue=incVal;allFirtd[expCol].firstChild.nodeValue=expVal;allFirtd[surCol].firstChild.nodeValue=surVal;allFirtd[sureqCol].firstChild.nodeValue=sureqVal;allFirtd[surtaxCol].firstChild.nodeValue=surtaxVal;allFirtd[surtaxeqCol].firstChild.nodeValue=surtaxeqVal;allFirtd[cashCol].firstChild.nodeValue=cashVal;allFirtd[casheqCol].firstChild.nodeValue=casheqVal;allFirtd[retCol].firstChild.nodeValue=retVal;allFirtd[retperCol].firstChild.nodeValue=retperVal;allFirtd[realretCol].firstChild.nodeValue=realretVal;allFirtd[realretperCol].firstChild.nodeValue=realretperVal;assetTot=0;loanTot=0;equTot=0;equeqTot=0;incTot=0;expTot=expVal;intTot=0;surTot=surVal;sureqTot=sureqVal;surtaxTot=surtaxVal;surtaxeqTot=surtaxeqVal;cashTot=cashVal;casheqTot=casheqVal;retTot=retVal;realretTot=realretVal;}if(addTest==true){allFirtd[yearCol].firstChild.nodeValue=yearVal;allFirtd[assetCol].firstChild.nodeValue=assetVal+parseInt(allFirtd[assetCol].firstChild.nodeValue);allFirtd[intCol].firstChild.nodeValue=intVal;allFirtd[loanCol].firstChild.nodeValue=loanVal+parseInt(allFirtd[loanCol].firstChild.nodeValue);allFirtd[equCol].firstChild.nodeValue=equVal+parseInt(allFirtd[equCol].firstChild.nodeValue);allFirtd[equeqCol].firstChild.nodeValue=equeqVal+parseInt(allFirtd[equeqCol].firstChild.nodeValue);allFirtd[incCol].firstChild.nodeValue=incVal;allFirtd[expCol].firstChild.nodeValue=expVal+parseInt(allFirtd[expCol].firstChild.nodeValue);allFirtd[surCol].firstChild.nodeValue=surVal+parseInt(allFirtd[surCol].firstChild.nodeValue);allFirtd[sureqCol].firstChild.nodeValue=sureqVal+parseInt(allFirtd[sureqCol].firstChild.nodeValue);allFirtd[surtaxCol].firstChild.nodeValue=surtaxVal+parseInt(allFirtd[surtaxCol].firstChild.nodeValue);allFirtd[surtaxeqCol].firstChild.nodeValue=surtaxeqVal+parseInt(allFirtd[surtaxeqCol].firstChild.nodeValue);allFirtd[cashCol].firstChild.nodeValue=cashVal+parseInt(allFirtd[cashCol].firstChild.nodeValue);allFirtd[casheqCol].firstChild.nodeValue=casheqVal+parseInt(allFirtd[casheqCol].firstChild.nodeValue);allFirtd[retCol].firstChild.nodeValue=retVal+parseInt(allFirtd[retCol].firstChild.nodeValue);allFirtd[retperCol].firstChild.nodeValue=retperVal;allFirtd[realretCol].firstChild.nodeValue=realretVal+parseInt(allFirtd[realretCol].firstChild.nodeValue);allFirtd[realretperCol].firstChild.nodeValue=realretperVal;assetTot=0;loanTot=0;equTot=0;equeqTot=0;incTot=0;expTot=parseInt(allFirtd[expCol].firstChild.nodeValue);intTot=0;surTot=parseInt(allFirtd[surCol].firstChild.nodeValue);sureqTot=parseInt(allFirtd[sureqCol].firstChild.nodeValue);surtaxTot=parseInt(allFirtd[surtaxCol].firstChild.nodeValue);surtaxeqTot=parseInt(allFirtd[surtaxeqCol].firstChild.nodeValue);cashTot=parseInt(allFirtd[cashCol].firstChild.nodeValue);casheqTot=parseInt(allFirtd[casheqCol].firstChild.nodeValue);retTot=parseInt(allFirtd[retCol].firstChild.nodeValue);realretTot=parseInt(allFirtd[realretCol].firstChild.nodeValue);}if(compPlotTest==true){allCompPlotY.push(allTitles[compPlottdCol]);allCompPlotY.push(allCur[compPlottdCol]);assetTot=0;loanTot=0;equTot=0;equeqTot=0;incTot=0;expTot=expVal;intTot=0;surTot=surVal;sureqTot=sureqVal;surtaxTot=surtaxVal;surtaxeqTot=surtaxeqVal;cashTot=cashVal;casheqTot=casheqVal;retTot=retVal;realretTot=realretVal;}for(var y=1;y<yearsVal+1;y++){if(compPlotTest==false){var trNum=calcTabNode.getElementsByTagName('tr').length;var copyNode=calcTabNode.getElementsByTagName('tr')[y];var tdNum=copyNode.getElementsByTagName('td').length;if(addTest==true&&trNum>=y+5){var newNode=calcTabNode.getElementsByTagName('tr')[y+1];stillAdd=true;}else{var newNode=copyNode.cloneNode(true);newNode.setAttribute('id','y'+y);stillAdd=false;}var allNewtd=newNode.getElementsByTagName('td');allNewtd[yearCol].firstChild.nodeValue=y;}allCur[yearCol]=y;assetPre=assetCur;assetCur=Math.round((1+gthPerVal/100)*assetCur+addCapVal);if(addTest==true&&stillAdd==true){assetVal=assetCur+parseInt(allNewtd[assetCol].firstChild.nodeValue);}else{assetVal=assetCur;};allCur[assetCol]=assetCur;if(compPlotTest==false){assetTot=assetTot+assetVal;allNewtd[assetCol].firstChild.nodeValue=assetVal;};var intBal=0;var repBal=0;var intCur=0;var repCur=0;var loanRepMth=0;var mthInt=0;if(loanCur>0){loanRepMth=loanRepVal/12;for(var i=0;i<12;i++){mthInt=loanCur*intPerVal/12/100;intBal=intBal+mthInt;if(loanCur<loanRepMth){loanRepMth=loanCur;}repBal=repBal+loanRepMth;loanCur=loanCur+mthInt-loanRepMth;}}intCur=Math.round(mthInt);intBal=Math.round(intBal);repBal=Math.round(repBal);loanCur=Math.round(loanCur);if(addTest==true&&stillAdd==true){loanVal=loanCur+parseInt(allNewtd[loanCol].firstChild.nodeValue);}else{loanVal=loanCur;}allCur[loanCol]=loanCur;if(compPlotTest==false){loanTot=loanTot+loanVal;allNewtd[loanCol].firstChild.nodeValue=loanVal;}equCur=Math.round(assetCur-loanCur);if(addTest==true&&stillAdd==true){equVal=equCur+parseInt(allNewtd[equCol].firstChild.nodeValue);}else{equVal=equCur;}allCur[equCol]=equCur;if(compPlotTest==false){equTot=equTot+equVal;allNewtd[equCol].firstChild.nodeValue=equVal;}equeqCur=Math.round(equCur/(Math.pow(1+(indPerVal/100),y)));if(addTest==true&&stillAdd==true){equeqVal=equeqCur+parseInt(allNewtd[equeqCol].firstChild.nodeValue);}else{equeqVal=equeqCur;}allCur[equeqCol]=equeqCur;if(compPlotTest==false){equeqTot=equeqTot+equeqVal;allNewtd[equeqCol].firstChild.nodeValue=equeqVal;}if(incTypeVal=="Asset"){incCur=Math.round((incPerVal/100)*(assetCur+assetPre)/2);if(addTest==true&&stillAdd==true){incVal=incCur+parseInt(allNewtd[incCol].firstChild.nodeValue);}else{incVal=incCur;}}else{if(y==1){incCur=incBaseInVal;if(addTest==true&&stillAdd==true){incVal=incCur+parseInt(allNewtd[incCol].firstChild.nodeValue);}else{incVal=incCur;}}else{incCur=Math.round((1+incPerVal/100)*incCur);if(addTest==true&&stillAdd==true){incVal=incCur+parseInt(allNewtd[incCol].firstChild.nodeValue);}else{incVal=incCur;}}};allCur[incCol]=incCur;if(compPlotTest==false){incTot=incTot+incVal;allNewtd[incCol].firstChild.nodeValue=incVal;};if(expTypeVal=="Asset"){expCur=Math.round((expPerVal/100)*(assetCur+assetPre)/2+addExpVal);if(addTest==true&&stillAdd==true){expVal=expCur+parseInt(allNewtd[expCol].firstChild.nodeValue);}else{expVal=expCur;}}else{if(y==1){expCur=expBaseInVal+addExpVal;if(addTest==true&&stillAdd==true){expVal=expCur+parseInt(allNewtd[expCol].firstChild.nodeValue);}else{expVal=expCur;}}else{expCur=Math.round((1+expPerVal/100)*(expCur-addExpVal)+addExpVal);if(addTest==true&&stillAdd==true){expVal=expCur+parseInt(allNewtd[expCol].firstChild.nodeValue);}else{expVal=expCur;}}}allCur[expCol]=expCur;if(compPlotTest==false){expTot=expTot+expVal;allNewtd[expCol].firstChild.nodeValue=expVal;}intCur=intBal;if(addTest==true&&stillAdd==true){intBal=intBal+parseInt(allNewtd[intCol].firstChild.nodeValue);}allCur[intCol]=intCur;if(compPlotTest==false){intTot=intTot+intBal;allNewtd[intCol].firstChild.nodeValue=intBal;}surCur=Math.round(incCur-expCur-intCur);if(addTest==true&&stillAdd==true){surVal=surCur+parseInt(allNewtd[surCol].firstChild.nodeValue);}else{surVal=surCur;}allCur[surCol]=surCur;if(compPlotTest==false){surTot=surTot+surVal;allNewtd[surCol].firstChild.nodeValue=surVal;}sureqCur=Math.round(surCur/Math.pow(1+(indPerVal/100),y));if(addTest==true&&stillAdd==true){sureqVal=sureqCur+parseInt(allNewtd[sureqCol].firstChild.nodeValue);}else{sureqVal=sureqCur;}allCur[sureqCol]=sureqCur;if(compPlotTest==false){sureqTot=sureqTot+sureqVal;allNewtd[sureqCol].firstChild.nodeValue=sureqVal;}surtaxCur=Math.round(surCur*(1-taxPerVal/100));if(addTest==true&&stillAdd==true){surtaxVal=surtaxCur+parseInt(allNewtd[surtaxCol].firstChild.nodeValue);}else{surtaxVal=surtaxCur;};allCur[surtaxCol]=surtaxCur;if(compPlotTest==false){surtaxTot=surtaxTot+surtaxVal;allNewtd[surtaxCol].firstChild.nodeValue=surtaxVal;};surtaxeqCur=Math.round(surtaxCur/Math.pow(1+(indPerVal/100),y));if(addTest==true&&stillAdd==true){surtaxeqVal=surtaxeqCur+parseInt(allNewtd[surtaxeqCol].firstChild.nodeValue);}else{surtaxeqVal=surtaxeqCur;};allCur[surtaxeqCol]=surtaxeqCur;if(compPlotTest==false){surtaxeqTot=surtaxeqTot+surtaxeqVal;allNewtd[surtaxeqCol].firstChild.nodeValue=surtaxeqVal;};cashCur=surtaxCur-addCapVal-repBal+intCur;if(addTest==true&&stillAdd==true){cashVal=cashCur+parseInt(allNewtd[cashCol].firstChild.nodeValue);}else{cashVal=cashCur;};allCur[cashCol]=cashCur;if(compPlotTest==false){cashTot=cashTot+cashVal;allNewtd[cashCol].firstChild.nodeValue=cashVal;};casheqCur=Math.round(cashCur/Math.pow(1+(indPerVal/100),y));if(addTest==true&&stillAdd==true){casheqVal=casheqCur+parseInt(allNewtd[casheqCol].firstChild.nodeValue);}else{casheqVal=casheqCur;};allCur[casheqCol]=casheqCur;if(compPlotTest==false){casheqTot=casheqTot+casheqVal;allNewtd[casheqCol].firstChild.nodeValue=casheqVal;};retCur=Math.round((gthPerVal/100*assetPre)+surtaxCur);if(addTest==true&&stillAdd==true){retVal=retCur+parseInt(allNewtd[retCol].firstChild.nodeValue);}else{retVal=retCur;}allCur[retCol]=retCur;if(compPlotTest==false){retTot=retTot+retVal;allNewtd[retCol].firstChild.nodeValue=retVal;}retperVal=retVal/equVal*100;if(isNaN(retperVal)){retperVal='0.00';}else{retperVal=forNumRet(retperVal,2);};allCur[retperCol]=retperVal;if(compPlotTest==false){allNewtd[retperCol].firstChild.nodeValue=retperVal;};if(addTest==true&&stillAdd==true){equDiffCur=equCur-equCur/(1+indPerVal/100);realretCur=Math.round((retCur-equDiffCur)/Math.pow(1+(indPerVal/100),y));realretVal=realretCur+parseInt(allNewtd[realretCol].firstChild.nodeValue);}else{equDiff=equVal-equVal/(1+indPerVal/100);realretCur=Math.round((retVal-equDiff)/Math.pow(1+(indPerVal/100),y));realretVal=realretCur;};allCur[realretCol]=realretCur;if(compPlotTest==false){realretTot=realretTot+realretVal;allNewtd[realretCol].firstChild.nodeValue=realretVal;};realretperVal=realretVal/equeqVal*100;if(isNaN(realretperVal)){realretperVal="0.00";}else{realretperVal=forNumRet(realretperVal,2);}allCur[realretperCol]=realretperVal;if(compPlotTest==false){allNewtd[realretperCol].firstChild.nodeValue=realretperVal;}if(compPlotTest==false){if(addTest!=true||trNum<y+5){var nextNode=calcTabNode.getElementsByTagName('tr')[trNum-3];calcTabNode.insertBefore(newNode,nextNode);}}else{allCompPlotY.push(allCur[compPlottdCol]);}}if(compPlotTest==false){var allCalctrNode=calcTabNode.getElementsByTagName('tr');var trNum=allCalctrNode.length;var totalNode=calcTabNode.getElementsByTagName('tr')[trNum-3];var allTotaltd=totalNode.getElementsByTagName('td');allTotaltd[yearCol].firstChild.firstChild.nodeValue='Final';allTotaltd[yearCol].lastChild.firstChild.nodeValue=' / Total';allTotaltd[assetCol].firstChild.firstChild.nodeValue=Math.round(assetVal);allTotaltd[loanCol].firstChild.firstChild.nodeValue=Math.round(loanVal);allTotaltd[equCol].firstChild.firstChild.nodeValue=Math.round(equVal);allTotaltd[equeqCol].firstChild.firstChild.nodeValue=Math.round(equeqVal);allTotaltd[incCol].firstChild.nodeValue=Math.round(incTot);allTotaltd[expCol].firstChild.nodeValue=Math.round(expTot);allTotaltd[intCol].firstChild.nodeValue=Math.round(intTot);allTotaltd[surCol].firstChild.nodeValue=Math.round(surTot);allTotaltd[sureqCol].firstChild.nodeValue=Math.round(sureqTot);allTotaltd[surtaxCol].firstChild.nodeValue=Math.round(surtaxTot);allTotaltd[surtaxeqCol].firstChild.nodeValue=Math.round(surtaxeqTot);allTotaltd[cashCol].firstChild.nodeValue=Math.round(cashTot);allTotaltd[casheqCol].firstChild.nodeValue=Math.round(casheqTot);allTotaltd[retCol].firstChild.nodeValue=Math.round(retTot);allTotaltd[retperCol].firstChild.nodeValue="-";allTotaltd[realretCol].firstChild.nodeValue=Math.round(realretTot);allTotaltd[realretperCol].firstChild.nodeValue="-";var avNode=calcTabNode.getElementsByTagName('tr')[trNum-2];var allAvtd=avNode.getElementsByTagName('td');if(yearsVal>0){allAvtd[yearCol].firstChild.nodeValue='Average';allAvtd[assetCol].firstChild.nodeValue='-';allAvtd[loanCol].firstChild.nodeValue='-';allAvtd[equCol].firstChild.nodeValue=Math.round(equTot/yearsVal);allAvtd[equeqCol].firstChild.nodeValue=Math.round(equeqTot/yearsVal);allAvtd[incCol].firstChild.nodeValue=Math.round(incTot/yearsVal);allAvtd[expCol].firstChild.nodeValue=Math.round(expTot/yearsVal);allAvtd[intCol].firstChild.nodeValue=Math.round(intTot/yearsVal);allAvtd[surCol].firstChild.nodeValue=Math.round(surTot/yearsVal);allAvtd[sureqCol].firstChild.nodeValue=Math.round(sureqTot/yearsVal);allAvtd[surtaxCol].firstChild.nodeValue=Math.round(surtaxTot/yearsVal);allAvtd[surtaxeqCol].firstChild.nodeValue=Math.round(surtaxeqTot/yearsVal);allAvtd[cashCol].firstChild.nodeValue=Math.round(cashTot/yearsVal);allAvtd[casheqCol].firstChild.nodeValue=Math.round(casheqTot/yearsVal);allAvtd[retCol].firstChild.nodeValue=Math.round(retTot/yearsVal);retperVal=retTot/equTot*100;if(isNaN(retperVal)){retperVal="0.00";}else{retperVal=forNumRet(retperVal,2);}allAvtd[retperCol].firstChild.nodeValue=retperVal;allAvtd[realretCol].firstChild.nodeValue=Math.round(realretTot/yearsVal);realretperVal=realretTot/equeqTot*100;if(isNaN(realretperVal)){realretperVal="0.00";}else{realretperVal=forNumRet(realretperVal,2);}allAvtd[realretperCol].firstChild.nodeValue=realretperVal;}if(addTest==true){descVal=document.getElementById('sumDesc').firstChild.nodeValue+" + "+descVal;}document.getElementById('sumDesc').firstChild.nodeValue=descVal;document.getElementById('sumDesc').style.color=allYCol[0];document.getElementById('tabDesc').firstChild.nodeValue=descVal;document.getElementById('tabDesc').style.color=allYCol[0];document.getElementById('sumRealRetPer').firstChild.nodeValue=realretperVal;var realRetCk=Math.round(realretTot/yearsVal);if(isNaN(realRetCk)){realRetCk=0;}document.getElementById('sumRealRetAv').firstChild.nodeValue=forComRet(realRetCk);document.getElementById('sumEqu').firstChild.nodeValue=forComRet(Math.round(equVal));document.getElementById('sumEquEq').firstChild.nodeValue=forComRet(Math.round(equeqVal));document.getElementById('sumRetTot').firstChild.nodeValue=forComRet(Math.round(retTot));document.getElementById('sumRealRetTot').firstChild.nodeValue=forComRet(Math.round(realretTot));}delete allCur;section('analysis');}function basePlot(){plotData();plot();document.getElementById('plotDesc1').firstChild.nodeValue=document.getElementById('tabDesc').firstChild.nodeValue;document.getElementById('plotDesc1').style.color=allYCol[0];document.getElementById('plotDescV').firstChild.nodeValue="";document.getElementById('plotDesc2').firstChild.nodeValue="";}function basePlotOK(){if(document.getElementById('tdYear').firstChild.nodeValue!="Investment Profile"){if(document.getElementById('tdY0').firstChild.nodeValue!="-"){if(plotSelectNode.value!="Plot Analysis Column"&&plotSelectNode.value!=""){plsWait();setTimeout("basePlot()",10);}else{alert("Please select a Plot Analysis Column to Plot from the drop down list.");plotSelectNode.focus();}}else{alert("First you must Build an inital Analysis Table. Then you can Plot.");}}else{alert("You cannot Plot from the Summary Table. First you must Build an inital Analysis Table. Then you can Plot.");}}function clearPlot(){plotSectionNode.removeChild(plotSectionNode.lastChild);newPlotNode=document.createElement('div');newPlotNode.setAttribute('id','plotArea');plotSectionNode.appendChild(newPlotNode);}function compPlot(){plotData();compPlotTest=true;allCompPlotX=new Array();allCompPlotY=new Array();for(var tdCol=0;tdCol<tdNum;tdCol++){var colTitle=calcTabNode.getElementsByTagName('tr')[0].getElementsByTagName('td')[tdCol].firstChild.nodeValue;var optSel=allPlotOptNode[tdCol].selected;if(optSel==true){compPlottdCol=tdCol;break;}}loadSel();analysis();var tabYearNum=allPlot[0].length;var compYearNum=allCompPlotX.length;allPlot.push(allCompPlotY);plot();document.getElementById('plotDesc1').firstChild.nodeValue=document.getElementById('tabDesc').firstChild.nodeValue;document.getElementById('plotDesc1').style.color=allYCol[0];document.getElementById('plotDescV').firstChild.nodeValue=" versus ";document.getElementById('plotDesc2').firstChild.nodeValue=document.getElementById('addCompSelect').value;document.getElementById('plotDesc2').style.color=allYCol[1];delete allCompPlotX;delete allCompPlotY;compPlotTest=false;}function compPlotOK(){if(document.getElementById('tdYear').firstChild.nodeValue!="Investment Profile"){if(document.getElementById('tdY0').firstChild.nodeValue!="-"){if(document.getElementById('addCompSelect').value!="Select Investment Profile"&&document.getElementById('addCompSelect').value!=""){if(plotSelectNode.value!="Plot Analysis Column"&&plotSelectNode.value!=""){plsWait();setTimeout("compPlot()",10);}else{alert("Please select a Plot Analysis Column to Compare from the drop down list.");plotSelectNode.focus();}}else{alert("Select Investment Profile from the drop down list to Compare.");document.getElementById('addCompSelect').focus();}}else{alert("First you must Build an inital Analysis Table. Then you can Compare.");}}else{alert("You cannot Compare from the Summary Table. First you must Build an inital Analysis Table. Then you can Compare.");}}function del(){var loadSelVal=loadSelectNode.value;var found=false;if(dataTest==true){var dataNode=dataDoc.getElementsByTagName('Data')[0];var allInputNode=document.getElementsByTagName('input');var firInputTag=allInputNode[0].id;var allFirNode=dataNode.getElementsByTagName(firInputTag);var firNode;if(allFirNode.length>0){for(var i=0;i<allFirNode.length;i++){var docFirVal=allFirNode[i].firstChild.nodeValue;if(docFirVal==loadSelVal){firNode=allFirNode[i];found=true;break;}}}if(found==true){var invNode=firNode.parentNode;dataNode.removeChild(invNode);var delConfirm=confirm("Are you sure you wish to delete the investment profile "+loadSelVal+"?");if(delConfirm==true){dataDoc.save(dataFile);}}else{alert("The investment profile "+loadSelVal+" could not be found.");return;}}else if(document.cookie!=''){var allCook=document.cookie.split(";");for(var cookNum=0;cookNum<allCook.length;cookNum++){var cookNameEnd=allCook[cookNum].indexOf('=',0);var cookName=allCook[cookNum].substring(0,cookNameEnd);var deCookName=decodeURIComponent(cookName);softSWOTMkEnd=deCookName.indexOf(softSWOTMk)+softSWOTMk.length;deCookName=deCookName.substring(softSWOTMkEnd,deCookName.length);if(deCookName==loadSelVal){var proCook=allCook[cookNum];found=true;break;}}if(found==true){var delConfirm=confirm("Are you sure you wish to delete the investment profile "+loadSelVal+"?");if(delConfirm==true){var expDate=new Date();expDate.setTime(expDate.getTime()-1*365*24*60*60*1000);document.cookie=cookName+"=;expires="+expDate.toUTCString();}}else{alert("The investment profile "+loadSelVal+" could not be found.");return;}}else{alert("The investment profile "+loadSelVal+" could not be found.");return;}profileSet();}function forNum(inid,dec){var numFor=document.getElementById(inid).value*1;var powNum=Math.pow(10,dec);numFor=Math.round(numFor*powNum)/powNum;numFor=new String(numFor);if(numFor.indexOf(".")==-1){numFor=numFor+".";}while(numFor.length-numFor.indexOf(".")-1<dec){numFor+="0";}document.getElementById(inid).value=numFor;}function forNumRet(numFor,dec){var powNum=Math.pow(10,dec);var numFor=Math.round(numFor*powNum)/powNum;numFor=new String(numFor);if(numFor.indexOf(".")==-1){numFor=numFor+".";}while(numFor.length-numFor.indexOf(".")-1<dec){numFor+="0";}return(numFor);}function forComRet(numFor){var numRem=new String(numFor);var numCom=new String("");var neg=new Boolean(false);if(numRem.substr(0,1)=="-"){numRem=numRem.slice(1,numRem.length);neg=true;}var numRemLen=numRem.length;while(numRemLen>3){numCom=","+numRem.substr(numRemLen-3,3)+numCom;numRem=numRem.slice(0,numRemLen-3);numRemLen=numRem.length;}numCom=numRem+numCom;if(neg==true){numCom="-"+numCom;}return(numCom);}function hideECom(e){var trigNode;if(!e)var e=window.event;if(e.target)trigNode=e.target;else if(e.srcElement)trigNode=e.srcElement;var helpNode=trigNode.parentNode.lastChild;trigNode.style.backgroundColor='#ffffff';helpNode.style.display='none';}function hideMoCom(trigId){clearTimeout(moComWait);moComWait=null;var trigNode=document.getElementById(trigId);trigNode.parentNode.style.backgroundColor='#ffffff';trigNode.parentNode.lastChild.style.display='none';trigNode.parentNode.style.zIndex='1';trigNode.parentNode.lastChild.style.zIndex='1';if(trigNode.id=="addSpan"||trigNode.id=="compSpan"){document.getElementById('addCompSelect').style.backgroundColor='#ffffff';}if(trigNode.id=="plotSpan"||trigNode.id=="compSpan"){document.getElementById('plotSelect').style.backgroundColor='#ffffff';}if(trigNode.id=="delSpan"){document.getElementById('loadSelect').style.backgroundColor='#ffffff';}}function hideTabCom(trigId){clearTimeout(tabComWait);tabComWait=null;var trigNode=document.getElementById(trigId);trigNode.style.backgroundColor='#f0f8ff';var helpId=trigNode.id;var helpNode=document.getElementById('help'+helpId);helpNode.style.zIndex='1';helpNode.style.display='none';}function hideTabComWh(trigId){clearTimeout(tabComWait);tabComWait=null;var trigNode=document.getElementById(trigId);trigNode.style.backgroundColor='#ffffff';var helpId=trigNode.id;var helpNode=document.getElementById('help'+helpId);helpNode.style.zIndex='1';helpNode.style.display='none';}function hideTabCol(tdHide){var alltrNode=calcTabNode.getElementsByTagName('tr');var alltdNode=alltrNode[0].getElementsByTagName('td');var trigId=alltrNode[0].getElementsByTagName('td')[tdHide].id;hideTabCom(trigId);for(var trHideNum=0;trHideNum<alltrNode.length;trHideNum++){var alltdNode=alltrNode[trHideNum].getElementsByTagName('td');alltdNode[tdHide].style.display='none';}var hideSelectNode=document.getElementById('hideSelect');var newhideVal=allTitles[tdHide];var newOptionNode=document.createElement('option');newOptionNode.setAttribute('value',newhideVal);var newTextNode=document.createTextNode(newhideVal);newOptionNode.appendChild(newTextNode);hideSelectNode.appendChild(newOptionNode);hideSelectNode.getElementsByTagName('option')[0].setAttribute('selected',true);}function hideVal(e){var trigNode;if(!e)var e=window.event;if(e.target)trigNode=e.target;else if(e.srcElement)trigNode=e.srcElement;var helpNode=trigNode.parentNode.lastChild;helpNode.style.zIndex='1';helpNode.style.display='none';}function init(){allTitles=new Array("Year","Asset Value","Loan Balance","Asset Equity","Asset Equity Equivalent","Income","Expense","Interest Expense","Surplus","Surplus Equivalent","Surplus Tax Adjusted","Surplus Tax Adjusted Equivalent","Cash Flow","Cash Flow Equivalent","Appparent Return","Apparent Return %","Actual Return Equivalent","Actual Return Equivalent %");allCol=new Array("yearCol","assetCol","loanCol","equCol","equeqCol","incCol","expCol","intCol","surCol","sureqCol","surtaxCol","surtaxeqCol","cashCol","casheqCol","retCol","retperCol","realretCol","realretperCol");allYCol=new Array('#ff0000','#009900');yearCol=0;assetCol=1;loanCol=2;equCol=3;equeqCol=4;incCol=5;expCol=6;intCol=7;surCol=8;sureqCol=9;surtaxCol=10;surtaxeqCol=11;cashCol=12;casheqCol=13;retCol=14;retperCol=15;realretCol=16;realretperCol=17;calcTabNode=document.getElementById('calcTable').getElementsByTagName('tbody')[0];loadSelectNode=document.getElementById('loadSelect');addCompSelectNode=document.getElementById('addCompSelect');plotSelectNode=document.getElementById('plotSelect');plotSectionNode=document.getElementById('plot');analTest=false;addTest=false;stallAdd=false;dataTest=false;compPlotTest=false;sumTest=false;if(useXML==true){dataDoc=new ActiveXObject("Microsoft.XMLDOM");dataFile="Data.xml";dataTest=dataDoc.load(dataFile);}perType('Income','Asset');perType('Expense','Asset');analTab();profileSet();document.getElementById('loadSelect').focus();}function loadSel(){if(addTest==true||compPlotTest==true){var loadSelVal=document.getElementById('addCompSelect').value;}else if(sumTest==true){var loadSelVal=sumSelVal;}else{var loadSelVal=document.getElementById('loadSelect').value;}var found=false;var allInputNode=document.getElementsByTagName('input');if(dataTest==true){var dataNode=dataDoc.getElementsByTagName('Data')[0];var firInputTag=allInputNode[0].id;var allFirNode=dataNode.getElementsByTagName(firInputTag);if(allFirNode.length>0){for(var i=0;i<allFirNode.length;i++){var docFirVal=allFirNode[i].firstChild.nodeValue;if(docFirVal==loadSelVal){var firNode=allFirNode[i];found=true;break;}}}if(found==true){var invNode=firNode.parentNode;for(var i=0;i<allInputNode.length;i++){var inputTag=allInputNode[i].id;var allLoadNode=invNode.getElementsByTagName(inputTag);var loadVal=allLoadNode[0].firstChild.nodeValue;allInputNode[i].value=loadVal;}}else{alert("The investment profile "+loadSelVal+" could not be found.");return;}}else if(document.cookie!=''){var allCook=document.cookie.split(";");for(var cookNum=0;cookNum<allCook.length;cookNum++){var cookNameEnd=allCook[cookNum].indexOf('=',0);var cookName=allCook[cookNum].substring(0,cookNameEnd);var deCookName=decodeURIComponent(cookName);softSWOTMkEnd=deCookName.indexOf(softSWOTMk)+softSWOTMk.length;deCookName=deCookName.substring(softSWOTMkEnd,deCookName.length);if(deCookName==loadSelVal){var proCook=allCook[cookNum];found=true;break;}}if(found==true){var allCookIn=proCook.split(":");allInputNode[0].value=deCookName;for(var i=1;i<allCookIn.length;i++){allInputNode[i].value=allCookIn[i];}}else{alert("The investment profile "+loadSelVal+" could not be found.");return;}}else{alert("The investment profile "+loadSelVal+" could not be found.");return;}perSet();section('input');}function multiSort(a,b){var retA=parseFloat(a[allPro.length-1]);var retB=parseFloat(b[allPro.length-1]);if(retA>retB){return(1);}else if(retA<retB){return(-1);}else{return(0);}}function openHelp(){var helpWin=window.open('Help.html','Help');helpWin.focus();}function opensoftSWOT(){var softSWOTWin=window.open('http://www.softswot.com','softSWOT');softSWOTWin.focus();}function perType(typ,per){if(per=='Asset'){document.getElementById(typ+'Type').value='Asset';document.getElementById(typ+'BaseSpan').style.display='none';document.getElementById(typ+'AssetCheck').checked=true;}else{document.getElementById(typ+'Type').value='Base';document.getElementById(typ+'BaseSpan').style.display='block';document.getElementById(typ+'BaseCheck').checked=true;}}function perSet(){if(document.getElementById('IncomeAssetCheck').value==true){perType('Income','Asset');}else{perType('Income','Base');}if(document.getElementById('ExpenseAssetCheck').value==true){perType('Expense','Asset');}else{perType('Expense','Base');}}function plsWait(){var messNode=document.getElementById('waitMess');var viewW=window.screen.availWidth;var viewH=window.screen.availHeight;messNode.style.width="300px";messNode.style.top=viewH/3+"px";var leftPos=(viewW/2)-150;messNode.style.left=leftPos+"px";section('mess');}function plot(){clearPlot();var dataSetNum=allPlot.length;var dataElemNum=0;for(var setNum=0;setNum<dataSetNum;setNum++){dataElemNum=Math.max(dataElemNum,allPlot[setNum].length);}var viewW=window.screen.availWidth;var viewH=window.screen.availHeight;var winTRed=50;var winBRed=200;var winLRed=20;var winRRed=20;var axisBorder=70;var xMarkH=10;var yMarkW=10;var pointHW=9;var yMarkNum=4;var plotTOff=winTRed+axisBorder;var plotBOff=winBRed+axisBorder;var plotLOff=winLRed+axisBorder;var plotROff=winRRed+axisBorder;var plotW=viewW-plotLOff-plotROff;var plotH=viewH-plotTOff-plotBOff;var xAxisY=plotTOff+plotH;var xMarkSp=Math.round(plotW/dataElemNum);var maxY=0;var minY=0;for(var dataSet=0;dataSet<dataSetNum;dataSet++){for(var dataElem=1;dataElem<allPlot[dataSet].length;dataElem++){var testY=parseFloat(allPlot[dataSet][dataElem]);maxY=Math.max(maxY,testY);minY=Math.min(minY,testY);}};if(maxY>=0){var limY=new String(Math.ceil(maxY));var digNum=limY.length-1;var digEnd="";for(var digAdd=0;digAdd<digNum;digAdd++){digEnd=digEnd+"0";};var digFir=limY.substr(0,1);digFir=parseInt(digFir)+1;limY=new String(digFir+digEnd);limY=parseInt(limY);}else{limY=0;};if(minY<0){var lowY=new String(Math.ceil(Math.abs(minY)));var digNum=lowY.length-1;var digEnd="";for(var digAdd=0;digAdd<digNum;digAdd++){digEnd=digEnd+"0";};var digFir=lowY.substr(0,1);digFir=parseInt(digFir)+1;lowY=new String(digFir+digEnd);lowY=-parseInt(lowY);}else{lowY=0;};var bigTop=true;if(limY>=Math.abs(lowY)){bigY=limY;litY=Math.abs(lowY);}else{bigY=Math.abs(lowY);litY=limY;bigTop=false;};var spaceY=bigY/yMarkNum;var addYMark=0;while(litY>(bigY/yMarkNum)*addYMark){addYMark=addYMark+1;};var yMarkNumAd=yMarkNum+addYMark;var rangeY=bigY/yMarkNum*yMarkNumAd;var yMarkSp=Math.round(plotH/yMarkNumAd);if(bigTop==true){var zeroY=plotTOff+yMarkSp*yMarkNum;var yTopMark=yMarkNum;}else{var zeroY=plotTOff+yMarkSp*addYMark;var yTopMark=addYMark;};var newZeroAxisNode=document.createElement('div');newZeroAxisNode.setAttribute('id','zeroAxis');newZeroAxisNode.style.top=zeroY+"px";newZeroAxisNode.style.left=plotLOff+"px";newZeroAxisNode.style.width=plotW+"px";newPlotNode.appendChild(newZeroAxisNode);var newXAxisNode=document.createElement('div');newXAxisNode.setAttribute('id','xAxis');newXAxisNode.style.top=xAxisY+"px";newXAxisNode.style.left=plotLOff+"px";newXAxisNode.style.width=plotW+"px";newPlotNode.appendChild(newXAxisNode);var newYAxisNode=document.createElement('div');newYAxisNode.setAttribute('id','yAxis');newYAxisNode.style.top=plotTOff+"px";newYAxisNode.style.left=plotLOff+"px";newYAxisNode.style.height=plotH+"px";newPlotNode.appendChild(newYAxisNode);for(var x=1;x<dataElemNum;x++){var newXMarkNode=document.createElement('div');newXMarkNode.setAttribute('id','xMark');newXMarkNode.style.top=xAxisY+'px';newXMarkNode.style.left=plotLOff+xMarkSp*(x)+'px';newXMarkNode.style.height=xMarkH+'px';newPlotNode.appendChild(newXMarkNode);var newXLabNode=document.createElement('div');newXLabNode.setAttribute('id','xLab');newXLabNode.style.top=xAxisY+xMarkH+'px';newXLabNode.style.left=plotLOff+xMarkSp*(x)+'px';var newTextNode=document.createTextNode(x-1);newXLabNode.appendChild(newTextNode);newPlotNode.appendChild(newXLabNode);for(var dataSet=0;dataSet<dataSetNum;dataSet++){if(x<allPlot[dataSet].length){var yPlot=allPlot[dataSet][x];yScale=Math.round(zeroY-(yPlot/rangeY*plotH));var newPointNode=document.createElement('div');newPointNode.className='valItem';newPointNode.onmouseover=showVal;newPointNode.onmouseout=hideVal;var newPointVNode=document.createElement('div');newPointVNode.setAttribute('id','pointV');newPointVNode.style.top=yScale-Math.floor(pointHW/2)+'px';newPointVNode.style.left=plotLOff+xMarkSp*(x)+'px';newPointVNode.style.height=pointHW+'px';newPointVNode.style.backgroundColor=allYCol[dataSet];newPointNode.appendChild(newPointVNode);var newPointHNode=document.createElement('div');newPointHNode.setAttribute('id','pointH');newPointHNode.style.top=yScale+'px';newPointHNode.style.left=plotLOff+xMarkSp*(x)-Math.floor(pointHW/2)+'px';newPointHNode.style.width=pointHW+'px';newPointHNode.style.backgroundColor=allYCol[dataSet];newPointNode.appendChild(newPointHNode);var newPointComNode=document.createElement('div');newPointComNode.setAttribute('id','val');newPointComNode.style.top=yScale-30+'px';newPointComNode.style.left=plotLOff+xMarkSp*(x)-10+'px';var newTextNode=document.createTextNode(yPlot);newPointComNode.appendChild(newTextNode);newPointNode.appendChild(newPointComNode);newPlotNode.appendChild(newPointNode);if(x<allPlot[dataSet].length-1){var lineX1=plotLOff+xMarkSp*(x);var lineX2=lineX1+xMarkSp;var plotY1=allPlot[dataSet][x];var plotY2=allPlot[dataSet][x+1];var lineY1=zeroY-(plotY1/(rangeY))*plotH;var lineY2=zeroY-(plotY2/(rangeY))*plotH;var slope=(lineY1-lineY2)/(lineX1-lineX2);for(var xP=lineX1;xP<lineX2;xP++){var newLineNode=document.createElement('div');newLineNode.setAttribute('id','line');newLineNode.style.top=Math.round(lineY1+(slope*(xP-lineX1)))+'px';newLineNode.style.left=xP+'px';newLineNode.style.backgroundColor=allYCol[dataSet];newPlotNode.appendChild(newLineNode);}}};plotSectionNode.appendChild(newPlotNode);}};for(var y=0;y<yMarkNumAd+1;y++){var newYMarkNode=document.createElement('div');newYMarkNode.setAttribute('id','yMark');newYMarkNode.style.top=plotTOff+yMarkSp*y+'px';newYMarkNode.style.left=plotLOff-yMarkW+'px';newYMarkNode.style.width=yMarkW+'px';newPlotNode.appendChild(newYMarkNode);var newYLabNode=document.createElement('div');newYLabNode.setAttribute('id','yLab');newYLabNode.style.top=plotTOff+yMarkSp*y+'px';newYLabNode.style.left=plotLOff-axisBorder+'px';newTextNode=document.createTextNode(spaceY*(yTopMark-y));newYLabNode.appendChild(newTextNode);newPlotNode.appendChild(newYLabNode);};var newYAxisTitNode=document.createElement('div');newYAxisTitNode.setAttribute('id','axisTit');newYAxisTitNode.style.top=plotTOff-20+'px';newYAxisTitNode.style.left=plotLOff-axisBorder+'px';newTextNode=document.createTextNode(allPlot[0][0]);newYAxisTitNode.appendChild(newTextNode);newPlotNode.appendChild(newYAxisTitNode);var newXAxisTitNode=document.createElement('div');newXAxisTitNode.setAttribute('id','axisTit');newXAxisTitNode.style.top=xAxisY+(xMarkH*3)+'px';newXAxisTitNode.style.left=plotLOff+plotW/2+'px';newTextNode=document.createTextNode('Year');newXAxisTitNode.appendChild(newTextNode);newPlotNode.appendChild(newXAxisTitNode);plotSectionNode.appendChild(newPlotNode);delete allPlot;delete allDataSet;section('plot');}function plotData(){allPlot=new Array();allDataSet=new Array();allPlotOptNode=document.getElementById('plotSelect').getElementsByTagName('option');var trNum=calcTabNode.getElementsByTagName('tr').length;tdNum=calcTabNode.getElementsByTagName('tr')[0].getElementsByTagName('td').length;for(var tdCol=0;tdCol<tdNum;tdCol++){var colTitle=calcTabNode.getElementsByTagName('tr')[0].getElementsByTagName('td')[tdCol].firstChild.nodeValue;var optSel=allPlotOptNode[tdCol].selected;if(optSel==true){allDataSet=new Array();for(var trRow=0;trRow<trNum-3;trRow++){var dataNode=calcTabNode.getElementsByTagName('tr')[trRow].getElementsByTagName('td')[tdCol];allDataSet.push(dataNode.firstChild.nodeValue);}allPlot.push(allDataSet);}}}function printRun(){hideMoCom('printSpan');var menuNode=document.getElementById('menu');menuNode.style.display='none';var menuAnalNode=document.getElementById('menuAnal');menuAnalNode.style.display='none';var menuShowNode=document.getElementById('menuShow');menuShowNode.style.display='none';window.print();menuNode.style.display='block';menuAnalNode.style.display='block';menuShowNode.style.display='block';}function profileSet(){var loadOptionNum=loadSelectNode.childNodes.length;for(var i=1;i<loadOptionNum;i++){loadSelectNode.removeChild(loadSelectNode.lastChild);addCompSelectNode.removeChild(addCompSelectNode.lastChild);}var allInputNode=document.getElementsByTagName('input');var firInputTag=allInputNode[0].id;if(dataTest==true){var dataNode=dataDoc.getElementsByTagName('Data')[0];var allFirNode=dataDoc.getElementsByTagName(firInputTag);for(var i=0;i<allFirNode.length;i++){var newLoadVal=allFirNode[i].firstChild.nodeValue;var newOptionNode=document.createElement('option');newOptionNode.setAttribute('value',newLoadVal);var newTextNode=document.createTextNode(newLoadVal);newOptionNode.appendChild(newTextNode);loadSelectNode.appendChild(newOptionNode);newLoadVal=allFirNode[i].firstChild.nodeValue;newOptionNode=document.createElement('option');newOptionNode.setAttribute('value',newLoadVal);newTextNode=document.createTextNode(newLoadVal);newOptionNode.appendChild(newTextNode);addCompSelectNode.appendChild(newOptionNode);}}else if(document.cookie!=''){var allCook=document.cookie.split(";");for(var cookNum=0;cookNum<allCook.length;cookNum++){var skipName=encodeURIComponent(softSWOTMk+"Config");var requireMk=encodeURIComponent(softSWOTMk);var skipSta=allCook[cookNum].indexOf(skipName);if(allCook[cookNum].indexOf(skipName)==-1&&allCook[cookNum].indexOf(requireMk)>-1){var cookNameEnd=allCook[cookNum].indexOf('=',0);var cookName=allCook[cookNum].substring(0,cookNameEnd);var deCookName=decodeURIComponent(cookName);softSWOTMkEnd=deCookName.indexOf(softSWOTMk)+softSWOTMk.length;deCookName=deCookName.substring(softSWOTMkEnd,deCookName.length);var newOptionNode=document.createElement('option');newOptionNode.setAttribute('value',deCookName);var newTextNode=document.createTextNode(deCookName);newOptionNode.appendChild(newTextNode);loadSelectNode.appendChild(newOptionNode);newOptionNode=document.createElement('option');newOptionNode.setAttribute('value',deCookName);newTextNode=document.createTextNode(deCookName);newOptionNode.appendChild(newTextNode);addCompSelectNode.appendChild(newOptionNode);}}}else{alert("The data could not be found.");}}function savePro(){var newFir=true;if(dataTest==true){var dataNode=dataDoc.getElementsByTagName('Data')[0];var allInputNode=document.getElementsByTagName('input');var firInputTag=allInputNode[0].id;var allFirNode=dataDoc.getElementsByTagName(firInputTag);var inputFirVal=allInputNode[0].value;if(allFirNode.length>0){for(var i=0;i<allFirNode.length;i++){var docFirVal=allFirNode[i].firstChild.nodeValue;if(docFirVal==inputFirVal){var firNode=allFirNode[i];newFir=false;break;}}}if(newFir==true){var newInvNode=dataDoc.createElement("Investment");var newFirNode=dataDoc.createElement(firInputTag);var newTextNode=dataDoc.createTextNode(inputFirVal);newFirNode.appendChild(newTextNode);newInvNode.appendChild(newFirNode);}else{invNode=firNode.parentNode;}for(var eachIn=1;eachIn<allInputNode.length;eachIn++){var inputTag=allInputNode[eachIn].id;var inputVal=allInputNode[eachIn].value;if(!inputVal){inputVal="0";}if(newFir==true){var newInputNode=dataDoc.createElement(inputTag);var newTextNode=dataDoc.createTextNode(inputVal);newInputNode.appendChild(newTextNode);newInvNode.appendChild(newInputNode);}else{var allAdjInputNode=invNode.getElementsByTagName(inputTag);allAdjInputNode[0].firstChild.nodeValue=inputVal;}}if(newFir==true){dataNode.appendChild(newInvNode);}dataDoc.save(dataFile);if(newFir==true){alert("The Investment Profile "+inputFirVal+" has been saved.");}else{alert("The Investment Profile "+inputFirVal+" has been updated.");}}else if(document.cookie!=''){var allInputNode=document.getElementsByTagName('input');var decCookName=allInputNode[0].value;var proCook='';var cookName=encodeURIComponent(softSWOTMk+decCookName);if(document.cookie.indexOf(cookName)>-1){newFir=false;}for(var eachIn=1;eachIn<allInputNode.length;eachIn++){proCook=proCook+':'+encodeURIComponent(allInputNode[eachIn].value);}var expDate=new Date();expDate.setTime(expDate.getTime()+20*365*24*60*60*1000);document.cookie=cookName+"="+proCook+"; expires="+expDate.toUTCString();if(document.cookie.indexOf(cookName)>-1){if(newFir==true){alert("The Investment Profile "+decCookName+" has been saved.");}else{alert("The Investment Profile "+decCookName+" has been updated.");}}else{alert("The Investment Profile "+decCookName+" cannot be saved. Cookies must be enabled.");}}else{alert("If you run this software as a HTML Application (file extension .hta) with Microsoft Internet Explorer 5.5 or later then Data and Configuration details will be saved as XML files otherwise they will be saved as Cookies and Cookies must be enabled.");}profileSet();}function section(sectionId){var allDivNode=document.getElementsByTagName('div');if(sectionId=='comm'){document.getElementById('menu').style.display='none';}else{document.getElementById('menu').style.display='block';}for(var divNum=0;divNum<allDivNode.length;divNum++){var divClass=allDivNode[divNum].className;if(divClass=='section'){var divId=allDivNode[divNum].id;if(divId==sectionId){allDivNode[divNum].style.display='block';}else{allDivNode[divNum].style.display='none';}}}}function showMoCom(posLeftT,posTopT,trigIdT){posLeft=posLeftT;posTop=posTopT;trigId=trigIdT;moComWait=setTimeout('showMoComDo()',1000);}function showMoComDo(){if(moComWait){var trigNode=document.getElementById(trigId);trigNode.parentNode.style.backgroundColor='#ffd700';trigNode.parentNode.lastChild.style.left=parseInt(posLeft)+'px';trigNode.parentNode.lastChild.style.top=parseInt(posTop)+'px';trigNode.parentNode.style.zIndex='10';trigNode.parentNode.lastChild.style.display='block';if(trigNode.id=="addSpan"||trigNode.id=="compSpan"){document.getElementById('addCompSelect').style.backgroundColor='#ffd700';}if(trigNode.id=="plotSpan"||trigNode.id=="compSpan"){document.getElementById('plotSelect').style.backgroundColor='#ffd700';}if(trigNode.id=="delSpan"){document.getElementById('loadSelect').style.backgroundColor='#ffd700';}}}function showTabCom(comWidT,posLeftT,posTopT,trigIdT){comWid=comWidT;posLeft=posLeftT;posTop=posTopT;trigId=trigIdT;tabComWait=setTimeout('showTabComDo()',1000);}function showTabComDo(){if(tabComWait){var trigNode=document.getElementById(trigId);var xOffSet=trigNode.offsetLeft;var yOffSet=trigNode.offsetTop;trigNode.style.backgroundColor='#ffd700';var helpNode=document.getElementById('help'+trigId);helpNode.style.width=parseInt(comWid)+'px';helpNode.style.zIndex='10';helpNode.style.left=xOffSet+parseInt(posLeft)+'px';helpNode.style.top=yOffSet+parseInt(posTop)+'px';helpNode.style.display='block';}}function showTabCol(){var hideSelVal=document.getElementById('hideSelect').value;var optDesVal=document.getElementById('hideSelect').getElementsByTagName('option')[0].firstChild.nodeValue;var showAllVal=document.getElementById('hideSelect').getElementsByTagName('option')[1].firstChild.nodeValue;var alltrNode=calcTabNode.getElementsByTagName('tr');var allTitleTopNode=alltrNode[0].getElementsByTagName('td');for(var titNum=0;titNum<allTitles.length;titNum++){if(hideSelVal==allTitleTopNode[titNum].firstChild.nodeValue||hideSelVal==showAllVal){for(var trHideNum=0;trHideNum<alltrNode.length;trHideNum++){var alltdNode=alltrNode[trHideNum].getElementsByTagName('td');if(alltdNode[titNum].style.display=='none'){try{alltdNode[titNum].style.display='table-cell';}catch(e){alltdNode[titNum].style.display='block';}}}if(hideSelVal!=showAllVal){break;}}}if(hideSelVal!=showAllVal&&hideSelVal!=optDesVal){var hideSelectNode=document.getElementById('hideSelect');var allHideOpt=hideSelectNode.getElementsByTagName('option');for(var optNum=0;optNum<allHideOpt.length;optNum++){if(hideSelVal==allHideOpt[optNum].value){hideSelectNode.removeChild(allHideOpt[optNum]);break;}}}}function showVal(e){var trigNode;if(!e)var e=window.event;if(e.target)trigNode=e.target;else if(e.srcElement)trigNode=e.srcElement;trigNode.parentNode.lastChild.style.zIndex='10';trigNode.parentNode.lastChild.style.display='block';}function summary(){sumTest=true;var allCompNode=loadSelectNode.getElementsByTagName('option');allComp=new Array();allTotal=new Array();var newNode;var allNewtd;var nextNode;for(var compNum=1;compNum<allCompNode.length;compNum++){sumSelVal=allCompNode[compNum].value;loadSel();analData();var yearsVal=parseInt(document.getElementById('Years').value);if(yearsVal>0){allPro=new Array(descVal,Math.round(assetVal),Math.round(loanVal),Math.round(equVal),Math.round(equeqVal),Math.round(incTot),Math.round(expTot),Math.round(intTot),Math.round(surTot),Math.round(sureqTot),Math.round(surtaxTot),Math.round(surtaxeqTot),Math.round(cashTot),Math.round(casheqTot),Math.round(retTot),"-",Math.round(realretTot),"-","-","-",Math.round(equTot/yearsVal),Math.round(equeqTot/yearsVal),Math.round(incTot/yearsVal),Math.round(expTot/yearsVal),Math.round(intTot/yearsVal),Math.round(surTot/yearsVal),Math.round(sureqTot/yearsVal),Math.round(surtaxTot/yearsVal),Math.round(surtaxeqTot/yearsVal),Math.round(cashTot/yearsVal),Math.round(casheqTot/yearsVal),Math.round(retTot/yearsVal),retperVal,Math.round(realretTot/yearsVal),realretperVal);}else{allPro=new Array(descVal,Math.round(assetVal),Math.round(loanVal),'0','0','0','0','0','0','0','0','0','0','0','0','0.00','0','0.00','-','-','0','0','0','0','0','0','0','0','0','0','0','0','0.00','0','0.00');};allComp.push(allPro);};allComp.sort(multiSort);analysisReset();var trNum=calcTabNode.getElementsByTagName('tr').length;document.getElementById('tdYear').firstChild.nodeValue="Investment Profile";document.getElementById('yTitBot').firstChild.nodeValue="Investment Profile";var copyNode=calcTabNode.getElementsByTagName('tr')[1];var tdNum=copyNode.getElementsByTagName('td').length;for(var compNum=0;compNum<allComp.length;compNum++){if(compNum!=0){var newNode=copyNode.cloneNode(true);}else{var newNode=copyNode;};newNode.setAttribute('id','comp'+compNum+1);var allNewtd=newNode.getElementsByTagName('td');allNewtd[0].firstChild.nodeValue=allComp[compNum][0];for(tdCnt=1;tdCnt<tdNum;tdCnt++){allNewtd[tdCnt].firstChild.nodeValue=" ";};if(compNum!=0){var nextNode=calcTabNode.getElementsByTagName('tr')[1];calcTabNode.insertBefore(newNode,nextNode);};newNode=copyNode.cloneNode(true);newNode.setAttribute('id','compTot'+compNum+1);allNewtd=newNode.getElementsByTagName('td');allNewtd[0].firstChild.nodeValue="Final / Total";allNewtd[0].className="calcTitleLeft";for(var tdCnt=1;tdCnt<tdNum;tdCnt++){allNewtd[tdCnt].firstChild.nodeValue=allComp[compNum][tdCnt];};nextNode=calcTabNode.getElementsByTagName('tr')[trNum-3];calcTabNode.insertBefore(newNode,nextNode);newNode=copyNode.cloneNode(true);newNode.setAttribute('id','compAv'+compNum+1);allNewtd=newNode.getElementsByTagName('td');allNewtd[0].firstChild.nodeValue="Average";allNewtd[0].className="calcTitleLeft";for(var tdCnt=1;tdCnt<tdNum;tdCnt++){allNewtd[tdCnt].firstChild.nodeValue=allComp[compNum][tdNum+tdCnt-1];};calcTabNode.insertBefore(newNode,nextNode);};var trNum=calcTabNode.getElementsByTagName('tr').length;newNode=copyNode.cloneNode(true);newNode.setAttribute('id','compTotBk');allNewtd=newNode.getElementsByTagName('td');allNewtd[0].firstChild.nodeValue="All Profiles";for(var tdCnt=1;tdCnt<tdNum;tdCnt++){allNewtd[tdCnt].firstChild.nodeValue=" ";};nextNode=calcTabNode.getElementsByTagName('tr')[trNum-3];calcTabNode.insertBefore(newNode,nextNode);trNum=calcTabNode.getElementsByTagName('tr').length;var totalNode=calcTabNode.getElementsByTagName('tr')[trNum-3];var allTotaltd=totalNode.getElementsByTagName('td');var avNode=calcTabNode.getElementsByTagName('tr')[trNum-2];var allAvtd=avNode.getElementsByTagName('td');allTotaltd[0].firstChild.firstChild.nodeValue='Sum of Final';allTotaltd[0].lastChild.firstChild.nodeValue=' / Sum of Total';allAvtd[0].firstChild.nodeValue='Sum of Average';for(var tdCnt=1;tdCnt<tdNum;tdCnt++){var curTot=0;for(var compNum=0;compNum<allComp.length;compNum++){curTot=curTot+parseInt(allComp[compNum][tdCnt]);};if(tdCnt==tdNum-3||tdCnt==tdNum-1){allTotaltd[tdCnt].firstChild.nodeValue="-";}else if(tdCnt==1||tdCnt==2||tdCnt==3||tdCnt==4){allTotaltd[tdCnt].firstChild.firstChild.nodeValue=Math.round(curTot);if(tdCnt==equCol){equVal=curTot;};if(tdCnt==equeqCol){equeqVal=curTot;}}else{allTotaltd[tdCnt].firstChild.nodeValue=Math.round(curTot);if(tdCnt==retCol){retTot=curTot;};if(tdCnt==realretCol){realretTot=curTot;}}};for(var tdCnt=1;tdCnt<tdNum;tdCnt++){curTot=0;for(var compNum=0;compNum<allComp.length;compNum++){curTot=curTot+parseInt(allComp[compNum][tdNum+tdCnt-1]);};if(tdCnt==1||tdCnt==2){allAvtd[tdCnt].firstChild.nodeValue='-';}else if(tdCnt==tdNum-3){retperVal=parseInt(allAvtd[retCol].firstChild.nodeValue)/parseInt(allAvtd[equCol].firstChild.nodeValue)*100;if(isNaN(retperVal)){retperVal='0.00';}else{retperVal=forNumRet(retperVal,2);}allAvtd[tdCnt].firstChild.nodeValue=retperVal;}else if(tdCnt==tdNum-1){realretperVal=parseInt(allAvtd[realretCol].firstChild.nodeValue)/parseInt(allAvtd[equeqCol].firstChild.nodeValue)*100;if(isNaN(realretperVal)){realretperVal='0.00';}else{realretperVal=forNumRet(realretperVal,2);};allAvtd[tdCnt].firstChild.nodeValue=realretperVal;}else{allAvtd[tdCnt].firstChild.nodeValue=Math.round(curTot);if(tdCnt==realretCol){realretVal=curTot;}}};document.getElementById('sumDesc').firstChild.nodeValue="Summary";document.getElementById('sumDesc').style.color=allYCol[0];document.getElementById('tabDesc').firstChild.nodeValue="Summary";document.getElementById('tabDesc').style.color=allYCol[0];document.getElementById('sumRealRetPer').firstChild.nodeValue=realretperVal;document.getElementById('sumRealRetAv').firstChild.nodeValue=forComRet(Math.round(realretVal));document.getElementById('sumEqu').firstChild.nodeValue=forComRet(Math.round(equVal));document.getElementById('sumEquEq').firstChild.nodeValue=forComRet(Math.round(equeqVal));document.getElementById('sumRetTot').firstChild.nodeValue=forComRet(Math.round(retTot));document.getElementById('sumRealRetTot').firstChild.nodeValue=forComRet(Math.round(realretTot));sumTest=false;};function summaryOK(){plsWait();setTimeout("summary()",10);}

