  var varExpLabels=new Array("Supplies","Wages","Distribution","Marketing","Other Variable");var fixExpLabels=new Array("Location","Salaries","Administration","Interest","Other Fixed");var assetLabels=new Array("Business Assets","Life of Assets");var indLabels=new Array("Market Strength","Business Market Position","Level of Competition","Goods and Services","Salaries and Wages","Interest Rates","Variable Expenses Efficiency","Fixed Expenses Efficiency","Fixed Expense Flow-on");var valLabels=new Array("Owners Earning Power","Required Return %");var npvLabels=new Array("NPV Discount Rate %","Net Present Value");var revLabels=new Array("Annual Revenue");var headVarLabels=new Array("Variable Expenses");var totVarLabels=new Array("Total Variable","Gross Profit","Mark-Up %");var headFixLabels=new Array("Fixed Expenses");var totFixLabels=new Array("Total Fixed");var totLabels=new Array("Total Expenses","Profit/Surplus");var depLabels=new Array("Depreciation");var retLabels=new Array("Business Return");var headIndLabels=new Array("Relative Indicators");var senPerLabels=new Array("Sensitivity %");var senLabels=new Array("Optimistic","Expected","Pessimistic");var headValLabels=new Array("Valuation Data");var headPriceLabels=new Array("Breakeven Data","Price Data");var breakLabels=new Array("Average Sale Price","Number of Sales");var breakCalcLabels=new Array("Breakeven Revenue","Breakeven Number of Sales","Breakeven Total Variable","Breakeven Total Fixed","Breakeven Profit/Surplus");var priceLabels=new Array("Sale Price Change %","Number of Sales Change %");var setLabels=new Array("Format","Input Type","Forecast Years");var selNameLabel="Business Name";var selExampleLabel="Example Business";var curValLabel="Applied Valuation";var resetLabel="Reset";var curIrrLabel="Applied NPV %";var zeroNpvLabel="0 NPV";var valSectLabel="Valuation";var npvSectLabel="Net Present Value";var inputType1="Monetary";var inputType2="Percent";var allYCol = new Array ("#009900","#ff0000","#0000ff");var standSize=12;var smallSize=10;var labSize=12;var labColor="#660000";var lowSize=10;var lowColor="#cccc99";var linkColor="#000066";var linkColor="#333399";var contColor="#333399";var contBackColor="#ffcc00";var totSize=12;var totColor="#000000";var resColor="#003300";var helpColor="#cccccc";var menuDefBackColor="#ffcc00";var menuActBackColor="#ffffcc";var leftStart=20;var topBase=100;var topStep=25;var helpLeft=3;var labelWidth=200;var labelStep=220+leftStart;var colWidth=130;var colStep=150;var formatDecimals=2;var forecastYears=3;var maxYears=10;var numSep=" ";window.onerror=errorSupress;function errorSupress(){return true;}var inputType=inputType1;var inputNames=new Array("Input");var modNames=new Array("Forecast","Valuation","Breakeven","Price");var sectNames=new Array("Chart","Subscription");var hiddenNames=new Array("Settings");var buildNames=inputNames.concat(modNames,sectNames,hiddenNames);var mesId="Mes";var idInputLabels=new Array("Save","Load","Delete","Export","Import");var cntInputLabels=new Array("Compress","Format","Print");var cntForecastLabels=new Array("Compress","Print");var cntValuationLabels=new Array("Print");var cntBreakLabels=new Array("Print","Plot Breakeven");var cntPriceLabels=new Array("Print","Plot Price");var cntChartLabels=new Array("Clear","Print");var enterSubEmailLabel="Subscription Email Address";var enterDbEmailLabel="Email Address used to Subscribe";var enterSubCodeLabel="Subscription Code";var plotAreaLabel="plotArea";var topStart=topBase;var topVarExp=topStart;var topFixExp=topStart;var maxWidth=window.screen.availWidth-(2*leftStart);var maxHeight=window.screen.availHeight-topBase-200;var helpFile="http://www.businessperformanceanalysis.com/Help.html";var inputHelpFile="http://www.businessperformanceanalysis.com/Input-Help.html";var forecastHelpFile="http://www.businessperformanceanalysis.com/Forecast-Help.html";var valuationHelpFile="http://www.businessperformanceanalysis.com/Valuation-Help.html";var breakHelpFile="http://www.businessperformanceanalysis.com/Breakeven-Help.html";var priceHelpFile="http://www.businessperformanceanalysis.com/Price-Help.html";var chartHelpFile="http://www.businessperformanceanalysis.com/Chart-Help.html";var divNode = document.createElement("div");divNode.style.fontSize = standSize+"px";divNode.style.position = "relative";divNode.style.left = leftStart+"px";var normNode = document.createElement("span");normNode.style.fontSize = standSize+"px";normNode.style.position = "absolute";normNode.style.textAlign = "right";normNode.style.left = leftStart+"px";normNode.style.width = colWidth+"px";var labNode = normNode.cloneNode(true);labNode.style.fontWeight = "bold";labNode.style.fontSize = labSize+"px";labNode.style.color = labColor;labNode.style.width = labelWidth+"px";var subNode = labNode.cloneNode(true);subNode.style.textAlign = "left";var headNode = labNode.cloneNode(true);headNode.style.textAlign = "center";headNode.style.width = colWidth+"px";headNode.style.color = totColor;headNode.style.backgroundColor = contBackColor;var linkNode = labNode.cloneNode(true);linkNode.style.textDecoration="underline";linkNode.style.cursor="pointer";linkNode.setAttribute("title","Click to activate.");linkNode.style.textAlign="right";linkNode.style.color = linkColor;linkNode.style.width = colWidth+"px";var controlNode = document.createElement("span");controlNode.style.fontSize = standSize+"px";controlNode.style.position = "relative";controlNode.style.fontWeight = "bold";controlNode.style.textDecoration="underline";controlNode.style.cursor="pointer";controlNode.setAttribute("title","Click to use Control.");controlNode.style.float = "left";controlNode.style.margin = "2px";controlNode.style.padding = "2px";controlNode.style.color = contColor;controlNode.style.backgroundColor = contBackColor;var inNode = document.createElement("input");inNode.style.fontSize = standSize+"px";inNode.setAttribute("type","text");inNode.style.position = "absolute";inNode.style.width = colWidth+"px";inNode.style.textAlign = "right";var inHidNode = document.createElement("input");inHidNode.setAttribute("type","hidden");var selNode = document.createElement("select");selNode.style.fontSize = standSize+"px";selNode.style.position = "absolute";selNode.style.width = colWidth+"px";selNode.style.textAlign = "right";var optNode = document.createElement("option");var totNode = normNode.cloneNode(true);totNode.style.fontWeight = "bold";totNode.style.textDecoration="underline";totNode.style.fontSize = totSize+"px";totNode.style.color = totColor;var helpNode = document.createElement("a");helpNode.style.fontSize = standSize+"px";helpNode.style.position = "absolute";helpNode.style.textDecoration="none";helpNode.style.fontWeight = "normal";helpNode.style.left = labelWidth+helpLeft+leftStart+"px";helpNode.style.color = helpColor;helpNode.setAttribute("target","Help");helpNode.setAttribute("tabIndex","-1");helpNode.style.cursor="pointer";helpNode.setAttribute("title","Click for Help.");var helpTextNode = document.createTextNode("?");helpNode.appendChild(helpTextNode);var divCentNode=document.createElement("div");divCentNode.style.width = "100%";divCentNode.style.margin = "0px";divCentNode.style.padding = "1px";divCentNode.style.textAlign = "center";divCentNode.style.position = "absolute";divCentNode.style.left = "0px";divCentNode.style.fontSize = standSize+"px";divCentNode.style.fontWeight = "normal";var revVal=0;var inputSurplus=0;var calcSurplus=0;var inputTotal=0;var calcTotal=0;var senVal=0;var clearMs=15000;var fValLabel="FY";var fPerLabel="FP";var vRevLabel="VR";var vValLabel="VY";var vPerLabel="P";var ancMk="a";var fValMk="v";var fPerMk="p";var vValMk="s";var vPerMk="r";var senDisLabId="senDisLab";var senDisValId="senDisVal";var parentNode=null;var inputMesNode=null;var subMesNode=null;var setMesNode=null;var selNameNode=null;var selNameSel=null;var setLabel=null;var impName=null;var forecastLabels=new Array();var useArray=new Array();var moveArray=new Array();var label;var encLabel;var curValCk=false;var curIrrCk=false;var allPlotYs=new Array();var allPlotX=new Array();var optRevArray=new Array();var expRevArray=new Array();var pesRevArray=new Array();var optArray=new Array();var expArray=new Array();var pesArray=new Array();var optPerArray=new Array();var expPerArray=new Array();var pesPerArray=new Array();var optPrice;var optSales;var optRev;var optVar;var optFix;var subAct=false;var forecastAct=false;var valuationAct=false;var breakAct=false;var priceAct=false;var http_request=false;var xmlDataSet="Data_Set";var xmlDoc=null;var subDbUrl="%0F9BF%12YtqV%07B%7FpA%40%1D%1B6%112%0E%23SED%1AP%26%02.%15%20WXT%0FT%3A%05-%1E%3E_E%19%09Z9As!%3ECT%19%1A%5D%24";var softwareversion="2.0";var softwarebuild="20090220";var softwareid="bpam";var softwaretitle="%258E_Y%0FF'AsW%1DSDQ%05G9%05%2F%04(%13%04%07%2B%5B5%088%14%24E%13%05Zx%3B%004%0B(E";var evaldays = "P";var extradays = "P";var vendorname="%258E_Y%0FF'4%24%15%2BYDZ%0B%5B7%01%00%09%2CZOD%03Fz%07.%0A";var vendordomain="%058E_Y%0FF'%14%24%15%2BYDZ%0B%5B7%01%20%09%2CZOD%03Fz%07.%0A";var suburl="%0F9BF%12YtqV%07B%7FpA%40%1D%1B6%112%0E%23SED%1AP%26%02.%15%20WXT%0FT%3A%05-%1E%3E_E%19%09Z9As!%1ECTD%09G%3D%06%24I%25B%5B%5B";var enaval= ")%0C";var encdec = "gM667j5TdA";var pNoSubNode = document.createElement("p");pNoSubNode.style.textAlign = "center";pNoSubNode.style.fontSize = standSize+"px";var newTextNode = document.createTextNode("This module is not currently activated. Subscription is required to active. Trial subscription is available for free. ");pNoSubNode.appendChild(newTextNode);var newTextNode = document.createTextNode("Click here to Subscribe.");var newANode = document.createElement("a");newANode.setAttribute("title","Subscribe to fully activate the analysis modules.");newANode.style.cursor="pointer";newANode.setAttribute("href",d(suburl));newANode.setAttribute("target","BusinessPerformanceAnalysis");newANode.appendChild(newTextNode);pNoSubNode.appendChild(newANode);var cookSub = encodeURIComponent(softwareid+"Sub");var cookVar = encodeURIComponent(softwareid+"Var");var cookName = cookSub;var cookVal = "";var subEmail;var subCode;var subModName;var subExp;var subNum;var curTime = new Date();var curMs = curTime.getTime();var devaldays=parseInt(d(evaldays));var evalMs=curMs+(devaldays*86400*1000);var dextradays=parseInt(d(extradays));var expdays=devaldays+dextradays;var evalDay;function menu(){var parentNode=document.getElementById("menu");for(var i = 0;i < buildNames.length-hiddenNames.length;i++){var aNode = document.createElement("a");var aTextNode = document.createTextNode(buildNames[i]);aNode.appendChild(aTextNode);aNode.setAttribute("id",ancMk+buildNames[i]);if(i<inputNames.length||i>modNames.length){aNode.className="menutopact";}else{aNode.className="menutop";}aNode.setAttribute("tabIndex","-1");aNode.setAttribute("href","javascript:void(0);");aNode.onclick = section;parentNode.appendChild(aNode);}var label="Help";var href="http://www.businessperformanceanalysis.com/Help.html";var target="Help";var aNode = document.createElement("a");var aTextNode = document.createTextNode(label);aNode.appendChild(aTextNode);aNode.setAttribute("id",ancMk+label);aNode.className="menutopact";aNode.setAttribute("tabIndex","-1");aNode.setAttribute("href",href);aNode.setAttribute("target",target);parentNode.appendChild(aNode);var label="BusinessPerformanceAnalysis.com";var href="http://www.businessperformanceanalysis.com/";var target="BusinessPerformanceAnalysis";var aNode = document.createElement("a");var aTextNode = document.createTextNode(label);aNode.appendChild(aTextNode);aNode.setAttribute("id",ancMk+label);aNode.className="menutopact";aNode.setAttribute("tabIndex","-1");aNode.setAttribute("href",href);aNode.setAttribute("target",target);parentNode.appendChild(aNode);}function build(){var initMes="Running Initiation Script...";var parentNode=document.getElementById("form");for(var i = 0;i < buildNames.length;i++){var divNode = document.createElement("div");divNode.className="section";divNode.setAttribute("id",buildNames[i]);if(buildNames[i]==inputNames[0]||buildNames[i]==sectNames[1]||buildNames[i]==hiddenNames[0]){var spanNode = normNode.cloneNode(true);spanNode.style.textAlign = "left";spanNode.style.left = leftStart+"px";spanNode.style.top = topBase-topStep+"px";spanNode.style.top = "50px";spanNode.style.width = maxWidth-leftStart+"px";spanNode.className="high";spanNode.setAttribute("id",buildNames[i]+mesId);var textNode = document.createTextNode(initMes);spanNode.appendChild(textNode);divNode.appendChild(spanNode);}if(i<=inputNames.length+modNames.length){var spanNode = normNode.cloneNode(true);spanNode.style.textAlign = "left";spanNode.style.left = leftStart+"px";spanNode.style.width = maxWidth+"px";spanNode.setAttribute("id","cnt"+buildNames[i]);divNode.appendChild(spanNode)}parentNode.appendChild(divNode);}}function init(){if (document.getElementById){cookName = cookSub;if(document.cookie.indexOf(cookName)>-1){cookRead();var cookVals=cookVal.split(":");if(cookVals.length>1&&cookVals[0]!=enaval){subEmail=d(cookVals[0]);subCode=d(cookVals[1]);subVerify('init');}}else{cookVal=enaval+':'+enaval;cookSave();}subCk();subDis();load();}else{alert("This software applies the Document Object Model (DOM) and to function correctly your system should include a 5th Generation browser with JavaScript / Active Content enabled. Mozilla FireFox from version 1.0 or Microsoft Internet Explorer from version 5.5 are recommended. Netscape Navigator from version 7.0 is also supported. Your browser may be blocking or disabling JavaScript or restricting Active Content. If this is the case please follow your browser help instructions to unblock/enable JavaScript or Allow Blocked Content. Internet Explorer users may need to Allow Blocked Content if a yellow message bar regarding Active Content appears at the top of the window. Data and Subscription Details are saved as encoded Cookies and Cookies should be enabled. Your current browser does not appear to meet these requirements.");}}function load(){inputMesNode=document.getElementById(inputNames[0]+mesId).firstChild;subMesNode=document.getElementById(sectNames[1]+mesId).firstChild;setMesNode=document.getElementById(hiddenNames[0]+mesId).firstChild;subMesNode.nodeValue="Status: Loading...";forecastLabels=revLabels.concat(headVarLabels,varExpLabels,totVarLabels,headFixLabels,fixExpLabels,totFixLabels,totLabels,depLabels,valLabels[0],retLabels);inputSelBuild();selName();if(cookName){cookRead();cookSetLoad();}inputExpBuild();inputForecastBuild();inputIndBuild();inputRetBuild();inputBreakBuild();inputPriceBuild();inputFooterBuild();if(!cookName){inputDefLoad();}else{cookInputLoad();}expCalc();forecastBuild();forecastCalc();valuationBuild();valuationCalc();breakBuild();breakCalc();priceBuild();priceCalc();cntBuild(0);if(forecastAct==true||subAct==false){cntBuild(1);}if(valuationAct==true||subAct==false){cntBuild(2);}if(breakAct==true||subAct==false){cntBuild(3);}if(priceAct==true||subAct==false){cntBuild(4);}cntBuild(5);subMesNode.nodeValue="Status: Ready.";inputMesNode.nodeValue="Status: Ready.";clearMes();section(sectNames[1]);}function setBuild(virt){var addWidth=0;if(virt=="EnterSub"){if(subEmail!=null&&subEmail.indexOf("@")>-1 ){setLabel=enterSubCodeLabel;}else{setLabel=enterSubEmailLabel;}}else if(virt=="EnterDb"){if(subEmail==null||subEmail.indexOf("@")==-1 ){setLabel=enterDbEmailLabel;}}var relNode = document.getElementById(hiddenNames[0]);var relNodeLen=relNode.childNodes.length;for(var childNum=1;childNum<relNodeLen;childNum++){relNode.removeChild(relNode.lastChild);}topStart=topBase;var inputNode = inNode.cloneNode(true);inputNode.setAttribute("id","setValue");inputNode.onfocus=inSelect;inputNode.style.top = topStart+"px";inputNode.style.left = labelStep+"px";if(setLabel==idInputLabels[0]||setLabel==idInputLabels[2]){label=decodeURIComponent(setLabel)+" Confirm";encLabel=encodeURIComponent(label);selNameSel=selNameNode.options[selNameNode.selectedIndex].firstChild.nodeValue;if(selNameSel==selExampleLabel||selNameSel==""){inputNode.value="";if(setLabel==idInputLabels[0]){setMesNode.nodeValue="Action: Input "+selNameLabel+" and click "+label+".";}else{setMesNode.nodeValue="Error: "+setLabel+" "+selNameSel+" Fail, value is not valid.";}}else{inputNode.value=selNameSel;setMesNode.nodeValue="Action: To "+setLabel+" "+selNameSel+" click "+label+".";}}else if(setLabel==encodeURIComponent(setLabels[0])||setLabel==encodeURIComponent(setLabels[2])){var setVal='';if(setLabel==encodeURIComponent(setLabels[0])){setVal=formatDecimals;}else if(setLabel==encodeURIComponent(setLabels[2])){setVal=forecastYears;var addMes=" The maximum valid value is "+maxYears+".";}label=decodeURIComponent(setLabel)+" Confirm";encLabel=encodeURIComponent(label);setMesNode.nodeValue="Action: Current "+decodeURIComponent(setLabel)+" is "+setVal+", to change input a new value and click "+label+"."+addMes;inputNode.value=setVal;}else if(setLabel==enterSubEmailLabel||setLabel==enterSubCodeLabel){var addWidth=150;inputNode.value="";inputNode.style.width = addWidth+colWidth+"px";label=setLabel+" Confirm";encLabel=encodeURIComponent(label);setMesNode.nodeValue="Action: Input your "+setLabel+" exactly as confirmed by email and click "+label+".";}else if(setLabel==enterDbEmailLabel){var addWidth=150;inputNode.value="";inputNode.style.width = addWidth+colWidth+"px";label=setLabel+" Confirm";encLabel=encodeURIComponent(label);setMesNode.nodeValue="Action: Input your "+setLabel+" and click "+label+".";}else if(setLabel==idInputLabels[4]){var addWidth=150;inputNode.style.width = addWidth+colWidth+"px";inputNode.setAttribute("type","file");inputNode.setAttribute("enctype","multipart/form-data");label=setLabel+" Confirm";encLabel=encodeURIComponent(label);setMesNode.nodeValue="Action: Browse for the "+setLabel+" file then click "+label+".";}relNode.appendChild(inputNode);var abNode = document.createElement("div");abNode.style.position = "absolute";abNode.style.top = topStart+"px";abNode.style.left = addWidth+labelStep+colStep+"px";abNode.style.width = null;abNode.style.textAlign = "left";var spanNode = linkNode.cloneNode(true);spanNode.setAttribute("id",encLabel);spanNode.onclick=evtClick;spanNode.style.position = "relative";spanNode.style.top = "0px";spanNode.style.left = "0px";spanNode.style.float = "left";textNode = document.createTextNode(label);spanNode.appendChild(textNode);abNode.appendChild(spanNode);var qLabel=label.replace(/ /g,"-");questNode = helpNode.cloneNode(true);questNode.setAttribute("href",inputHelpFile+"#"+qLabel);questNode.style.position = "relative";questNode.style.top = "0px";var leftCount=1;questNode.style.left = leftCount*helpLeft+"px";questNode.style.float = "left";abNode.appendChild(questNode);relNode.appendChild(abNode);section("Settings");if(setLabel!=idInputLabels[2]){document.getElementById("setValue").focus();}clearMes();}function setConfirm(){setValueNode=document.getElementById("setValue");setValue = setValueNode.value;if(setLabel==idInputLabels[0]||setLabel==idInputLabels[2]){if(setValue!=selExampleLabel&&setValue!=""&&setValue!=null){selNameUse=encodeURIComponent(setValue);cookName=cookVar+selNameUse;if(setLabel==idInputLabels[0]){if(inputType!=inputType1){inputTypeChange(inputType1);}cookInput();}else if(setLabel==idInputLabels[2]){if(cookName){cookDelete();}}selNameBuild();if(setLabel==idInputLabels[0]){selNameNode.value=setValue;}section(inputNames[0]);if(setLabel!=idInputLabels[0]){inputMesNode.nodeValue="Status: "+setLabel+" "+setValue+" Complete.";}}else{setMesNode.nodeValue="Error: "+setLabel+" "+setValue+" Fail, value is not valid.";}}else if(setLabel==encodeURIComponent(setLabels[0])||setLabel==encodeURIComponent(setLabels[2])){if(isNaN(setValue)===false&&setValue>=0&&setValue!==null){if(setLabel==encodeURIComponent(setLabels[0])){formatDecimals=parseInt(setValue);formatInput();inputMesNode.nodeValue="Status: "+decodeURIComponent(setLabel)+" "+formatDecimals+" Complete.";section(inputNames[0]);}else if(setLabel==encodeURIComponent(setLabels[2])){forecastYears=parseInt(setValue);if(forecastYears>maxYears){setMesNode.nodeValue="Error: "+decodeURIComponent(setLabel)+" maximum value allowed is "+maxYears+".";}else{expand();inputIndYearsReset();inputIndBuild();inputRetBuild();inputBreakBuild();inputPriceBuild();forecastReset();forecastBuild();forecastCalc();valuationCalc();breakCalc();inputMesNode.nodeValue="Status: "+decodeURIComponent(setLabel)+" "+parseInt(setValue)+" Complete.";section(inputNames[0]);}}}else{setMesNode.nodeValue="Error: "+decodeURIComponent(setLabel)+" "+setValue+" Fail, value is not valid. Input a positive integer value.";}}else if(setLabel==enterSubEmailLabel){subEmail = setValue;if(subEmail=="reset"){cookDelete();}else{setBuild("EnterSub");}}else if(setLabel==enterSubCodeLabel){subCode = setValue;subVerify();}else if(setLabel==enterDbEmailLabel){subEmail = setValue;subCk();}clearMes();}function cookDetails(){var disDetails="Size is "+document.cookie.length+" bytes.\n\n";disDetails+=document.cookie;alert(disDetails);}function cookDelAll(){if(document.cookie){var expDate = new Date();expDate.setTime(expDate.getTime() - 1000);var cookDels=document.cookie.split(";");for(var delNum=0;delNum<cookDels.length;delNum=delNum+1){var cookDelNames=cookDels[delNum].split("=");cookName=cookDelNames[0];document.cookie = cookName + "=;expires=" + expDate.toUTCString();}}window.location.reload();inputMesNode.nodeValue="Status: Delete All Complete.";clearMes();}function selNameBuild(){var relNode = document.getElementById(inputNames[0]);label=selNameLabel;encLabel=encodeURIComponent(label);if(document.getElementById(encLabel)){var removeNode=document.getElementById(encLabel);removeNode.parentNode.removeChild(removeNode);}selNameNode = selNode.cloneNode(true);selNameNode.setAttribute("id",encLabel);selNameNode.style.width = colStep+colWidth+"px";selNameNode.style.top = topBase+"px";selNameNode.style.left = labelStep+"px";selNameOptNode = optNode.cloneNode(true);textNode = document.createTextNode(selExampleLabel);selNameOptNode.appendChild(textNode);selNameNode.appendChild(selNameOptNode);relNode.appendChild(selNameNode);selNameDis();}function selNameDis(){if(document.cookie.indexOf(cookVar)>-1){var selNames=document.cookie.split(cookVar);for(var selNum=1;selNum<selNames.length;selNum++){var useSelNames=selNames[selNum].split("=");var selName=decodeURIComponent(useSelNames[0]);if(selName){var selNameOptNode = optNode.cloneNode(true);selNameOptNode.setAttribute("value",selName);var textNode = document.createTextNode(selName);selNameOptNode.appendChild(textNode);var nextNode=selNameNode.firstChild;selNameNode.insertBefore(selNameOptNode,nextNode);if(selNum==selNames.length-1){selNameNode.value=selName;}}}}}function selName(){cookName='';selNameSel=selNameNode.options[selNameNode.selectedIndex].firstChild.nodeValue;if(selNameSel!=""&&selNameSel!=null&&selNameSel!=null&&selNameSel!=selExampleLabel){selNameUse=encodeURIComponent(selNameSel);cookName=cookVar+selNameUse;}}function cookInput(){cookVal="";var inputNodes=document.getElementById(inputNames[0]).getElementsByTagName("input");for(var i = 0;i < inputNodes.length;i++){var inputVal=strToNum(inputNodes[i].value);if(i==0){cookVal=e(inputVal);discook=inputVal;}else{cookVal=cookVal+':'+e(inputVal);discook=discook+':'+inputVal;}}cookVal=cookVal+':'+e(formatDecimals)+':'+e(forecastYears);cookSave();}function cookSave(){cookDelete();var expDate = new Date();expDate.setTime(expDate.getTime() + 20 * 365 * 24 * 60 * 60 * 1000);var cookUsed=document.cookie.length;var cookLeft=4000-cookUsed;var cookNew=cookVal.length;var cookRem=cookLeft-cookNew;var cookSplits=document.cookie.split(";");var cookReg=cookSplits[0].length;var cookIds=cookUsed+cookNew-cookReg;var cookNum=cookSplits.length;var cookAv=cookIds/cookNum;var cookNumRem=parseInt(cookRem/cookAv);if(cookRem>0){document.cookie = cookName + "=" + cookVal + ";expires=" + expDate.toUTCString();if(cookName.indexOf(cookVar)>-1){if(document.cookie.indexOf(cookName)>-1){inputMesNode.nodeValue="Status: Save Complete. "+cookRem+" bytes of storage remain, approximately "+cookNumRem+" Data Sets.";}else{inputMesNode.nodeValue="Error: Save Fail. Unable to save Cookie";}}}else{inputMesNode.nodeValue="Error: Save Fail. Insufficient Cookie Storage remaining.";}clearMes();}function cookRead(){if(document.cookie.indexOf(cookName)>-1){var cookSta= document.cookie.indexOf(cookName);var cookEnd=document.cookie.indexOf(";",cookSta);if (cookEnd==-1){cookEnd=document.cookie.length;}cookVal = document.cookie.substring(cookSta+cookName.length+1,cookEnd);}else{cookVal='';inputMesNode.nodeValue="Fail: Load "+selNameSel+" Failed. This data set has not been Saved.";}clearMes();}function inputDefLoad(){var inputNodes=document.getElementById(inputNames[0]).getElementsByTagName("input");var defCurVals=new Array(1000000,100000,200000,50000,50000,50000,40000,50000,50000,10000,20000,100000,8);var defMSRIs=new Array(2,3,2);var defMPRIs=new Array(3,5,2);var defLCRIs=new Array(2,0,-3);var defGSRIs=new Array(2,2,3);var defSWRIs=new Array(0,3,2);var defIRRIs=new Array(0,3,-5);var defVERIs=new Array(3,3,2);var defFERIs=new Array(0,2,2);var defFFRIs=new Array(20,20,20);var defValRIs=new Array(25,100000,30);var defPriVals=new Array(100,20,-15);var defInputVals=defCurVals.concat(defMSRIs,defMPRIs,defLCRIs,defGSRIs,defSWRIs,defIRRIs,defVERIs,defFERIs,defFFRIs,defValRIs,defPriVals);var inputNodes=document.getElementById(inputNames[0]).getElementsByTagName("input");var defVal=0;for(var i = 0;i < inputNodes.length;i++){defVal=defInputVals[i];inputNodes[i].value=numToStr(defVal);}inputMesNode.nodeValue="Status: Load "+selExampleLabel+" Complete.";clearMes();}function cookSetLoad(){if(cookVal!=''){var cookVals=cookVal.split(":");for(var i = cookVals.length-2;i < cookVals.length;i++){if(cookVals[i]!=enaval){if(i==cookVals.length-2){formatDecimals=d(cookVals[i]);}else if(i==cookVals.length-1){forecastYears=d(cookVals[i]);}}}}}function cookInputLoad(){var defVal=0;if(cookVal!=''){var cookVals=cookVal.split(":");var inputNodes=document.getElementById(inputNames[0]).getElementsByTagName("input");for(var i = 0;i < inputNodes.length;i++){if(cookVals[i]!=enaval){inputNodes[i].value=numToStr(d(cookVals[i]));}}}else{inputDefLoad();}}function cookDelete(){var expDate = new Date();expDate.setTime(expDate.getTime() - 1000);document.cookie = cookName + "=;expires=" + expDate.toUTCString();}function cookShow(inputNum){cookName=cookVar;if(document.cookie.indexOf(cookName)>-1){var cookShowVal="";var cookSta= document.cookie.indexOf(cookName);var cookEnd=document.cookie.indexOf(";",cookSta);if (cookEnd==-1){cookEnd=document.cookie.length;}var reqCook = document.cookie.substring(cookSta+cookName.length+1,cookEnd);var saveValues=reqCook.split(":");if(isNaN(inputNum)===false){var cookTo=inputNum;}else{var cookTo=saveValues.length;}for(var i = 0;i < cookTo;i++){cookShowVal+=" - "+d(saveValues[i]);}inputMesNode.nodeValue="Status: Load Complete.";}else{alert("No variable data is available to load.");}clearMes();}function inputSelBuild(){var relNode = document.getElementById(inputNames[0]);label=selNameLabel;encLabel=encodeURIComponent(label);var spanNode = labNode.cloneNode(true);spanNode.style.top = topStart+"px";var textNode = document.createTextNode(label);spanNode.appendChild(textNode);relNode.appendChild(spanNode);var qLabel=label.replace(/ /g,"-");var questNode = helpNode.cloneNode(true);questNode.setAttribute("href",inputHelpFile+"#"+qLabel);questNode.style.top = topStart+"px";relNode.appendChild(questNode);selNameBuild();var abNode = document.createElement("div");abNode.style.position = "absolute";abNode.style.top = topStart+"px";abNode.style.left = labelStep+colStep+colStep+"px";abNode.style.width = null;abNode.style.textAlign = "left";var leftCount=0;for(var i = 0;i < idInputLabels.length;i++){label=idInputLabels[i];encLabel=encodeURIComponent(label);spanNode = linkNode.cloneNode(true);spanNode.setAttribute("id",encLabel);spanNode.onclick=evtClick;spanNode.style.position = "relative";spanNode.style.width="auto";spanNode.style.left = leftCount*helpLeft+"px";spanNode.style.float = "left";textNode = document.createTextNode(label);spanNode.appendChild(textNode);abNode.appendChild(spanNode);leftCount+=1;qLabel=label.replace(/ /g,"-");questNode = helpNode.cloneNode(true);questNode.setAttribute("href",inputHelpFile+"#"+qLabel);questNode.style.position = "relative";questNode.style.top = "0px";questNode.style.left = leftCount*helpLeft+"px";questNode.style.float = "left";abNode.appendChild(questNode);leftCount+=2;}relNode.appendChild(abNode);}function inputExpBuild(){var relNode = document.getElementById(inputNames[0]);topStart+=2*topStep;label=revLabels[0];encLabel=encodeURIComponent(label);var spanNode = labNode.cloneNode(true);spanNode.style.top = topStart+"px";var textNode = document.createTextNode(label);spanNode.appendChild(textNode);relNode.appendChild(spanNode);var qLabel=label.replace(/ /g,"-");questNode = helpNode.cloneNode(true);questNode.setAttribute("href",inputHelpFile+"#"+qLabel);questNode.style.top = topStart+"px";relNode.appendChild(questNode);inputNode = inNode.cloneNode(true);inputNode.setAttribute("id",encLabel);inputNode.onchange=evtChange;inputNode.onfocus=inSelect;inputNode.style.top = topStart+"px";inputNode.style.left = labelStep+"px";inputNode.value="-";relNode.appendChild(inputNode);topStart+=topStep;label=inputType1;encLabel=encodeURIComponent(label);spanNode = linkNode.cloneNode(true);spanNode.setAttribute("id",encLabel);spanNode.onclick=evtClick;spanNode.style.top = topStart+"px";spanNode.style.left = labelStep+"px";textNode = document.createTextNode(label);spanNode.appendChild(textNode);relNode.appendChild(spanNode);qLabel=label.replace(/ /g,"-");questNode = helpNode.cloneNode(true);questNode.setAttribute("href",inputHelpFile+"#"+qLabel);questNode.style.top = topStart+"px";questNode.style.left = labelStep+colWidth+helpLeft+"px";relNode.appendChild(questNode);label=inputType2;encLabel=encodeURIComponent(label);spanNode = linkNode.cloneNode(true);spanNode.setAttribute("id",encLabel);spanNode.onclick=evtClick;spanNode.style.top = topStart+"px";spanNode.style.left = labelStep+colStep+"px";textNode = document.createTextNode(label);spanNode.appendChild(textNode);relNode.appendChild(spanNode);qLabel=label.replace(/ /g,"-");questNode = helpNode.cloneNode(true);questNode.setAttribute("href",inputHelpFile+"#"+qLabel);questNode.style.top = topStart+"px";questNode.style.left = labelStep+colStep+colWidth+helpLeft+"px";relNode.appendChild(questNode);topStart+=topStep;label=headVarLabels[0];encLabel=encodeURIComponent(label);spanNode = subNode.cloneNode(true);spanNode.style.top = topStart+"px";textNode = document.createTextNode(label);spanNode.appendChild(textNode);relNode.appendChild(spanNode);qLabel=label.replace(/ /g,"-");questNode = helpNode.cloneNode(true);questNode.setAttribute("href",inputHelpFile+"#"+qLabel);questNode.style.top = topStart+"px";relNode.appendChild(questNode);topVarExp=topStart;for(var i = 0;i < varExpLabels.length;i++){topStart+=topStep;label=varExpLabels[i];encLabel=encodeURIComponent(label);spanNode = labNode.cloneNode(true);spanNode.style.top = topStart+"px";textNode = document.createTextNode(label);spanNode.appendChild(textNode);relNode.appendChild(spanNode);qLabel=label.replace(/ /g,"-");questNode = helpNode.cloneNode(true);questNode.setAttribute("href",inputHelpFile+"#"+qLabel);questNode.style.top = topStart+"px";relNode.appendChild(questNode);}inputCalcBuild("varExpLabels");topStart+=topStep;label=totVarLabels[0];encLabel=encodeURIComponent(label);spanNode = labNode.cloneNode(true);spanNode.style.top = topStart+"px";textNode = document.createTextNode(label);spanNode.appendChild(textNode);relNode.appendChild(spanNode);qLabel=label.replace(/ /g,"-");questNode = helpNode.cloneNode(true);questNode.setAttribute("href",inputHelpFile+"#"+qLabel);questNode.style.top = topStart+"px";relNode.appendChild(questNode);inputCalcTotBuild(totVarLabels[0]);topStart+=topStep;label=headFixLabels[0];encLabel=encodeURIComponent(label);spanNode = subNode.cloneNode(true);spanNode.style.top = topStart+"px";textNode = document.createTextNode(label);spanNode.appendChild(textNode);relNode.appendChild(spanNode);qLabel=label.replace(/ /g,"-");questNode = helpNode.cloneNode(true);questNode.setAttribute("href",inputHelpFile+"#"+qLabel);questNode.style.top = topStart+"px";relNode.appendChild(questNode);topFixExp=topStart;for(var i = 0;i < fixExpLabels.length;i++){topStart+=topStep;label=fixExpLabels[i];encLabel=encodeURIComponent(label);spanNode = labNode.cloneNode(true);spanNode.style.top = topStart+"px";textNode = document.createTextNode(label);spanNode.appendChild(textNode);relNode.appendChild(spanNode);qLabel=label.replace(/ /g,"-");questNode = helpNode.cloneNode(true);questNode.setAttribute("href",inputHelpFile+"#"+qLabel);questNode.style.top = topStart+"px";relNode.appendChild(questNode);}inputCalcBuild("fixExpLabels");topStart+=topStep;label=totFixLabels[0];encLabel=encodeURIComponent(label);spanNode = labNode.cloneNode(true);spanNode.style.top = topStart+"px";textNode = document.createTextNode(label);spanNode.appendChild(textNode);relNode.appendChild(spanNode);qLabel=label.replace(/ /g,"-");questNode = helpNode.cloneNode(true);questNode.setAttribute("href",inputHelpFile+"#"+qLabel);questNode.style.top = topStart+"px";relNode.appendChild(questNode);inputCalcTotBuild(totFixLabels[0]);topStart+=topStep;label=totLabels[0];encLabel=encodeURIComponent(label);spanNode = labNode.cloneNode(true);spanNode.style.top = topStart+"px";textNode = document.createTextNode(label);spanNode.appendChild(textNode);relNode.appendChild(spanNode);qLabel=label.replace(/ /g,"-");questNode = helpNode.cloneNode(true);questNode.setAttribute("href",inputHelpFile+"#"+qLabel);questNode.style.top = topStart+"px";relNode.appendChild(questNode);inputCalcTotBuild(totLabels[0]);topStart+=topStep;label=totLabels[1];encLabel=encodeURIComponent(label);spanNode = labNode.cloneNode(true);spanNode.style.top = topStart+"px";textNode = document.createTextNode(label);spanNode.appendChild(textNode);relNode.appendChild(spanNode);qLabel=label.replace(/ /g,"-");questNode = helpNode.cloneNode(true);questNode.setAttribute("href",inputHelpFile+"#"+qLabel);questNode.style.top = topStart+"px";relNode.appendChild(questNode);inputCalcTotBuild(totLabels[1]);}function inputCalcBuild(buildArray){var relNode = document.getElementById(inputNames[0]);useArray=new Array();if(buildArray=="varExpLabels"){useArray=varExpLabels;topStart=topVarExp;}else if(buildArray=="fixExpLabels"){useArray=fixExpLabels;topStart=topFixExp;}if(inputType==inputType1){leftInput=labelStep;leftCalc=labelStep+colStep;}else{leftInput=labelStep+colStep;leftCalc=labelStep;}for(var i = 0;i < useArray.length;i++){topStart+=topStep;var inputVal="-";var calcVal="-";if(document.getElementById(encodeURIComponent(useArray[i]))){var inputNode=document.getElementById(encodeURIComponent(useArray[i]));var calcNode=document.getElementById(encodeURIComponent(useArray[i])+"Calc");inputVal=calcNode.firstChild.nodeValue;calcVal=inputNode.value;inputNode.style.left = leftInput+"px";inputNode.value=inputVal;calcNode.style.left = leftCalc+"px";calcNode.firstChild.nodeValue=calcVal;}else{var inputNode = inNode.cloneNode(true);inputNode.setAttribute("id",encodeURIComponent(useArray[i]));inputNode.onchange=evtChange;inputNode.onfocus=inSelect;inputNode.style.top = topStart+"px";inputNode.style.left = leftInput+"px";inputNode.value=inputVal;relNode.appendChild(inputNode);var calcNode= normNode.cloneNode(true);calcNode.setAttribute("id",encodeURIComponent(useArray[i])+"Calc");calcNode.style.top = topStart+"px";calcNode.style.left = leftCalc+"px";var textNode = document.createTextNode(calcVal);calcNode.appendChild(textNode);relNode.appendChild(calcNode);}}}function inputCalcTotBuild(buildArray){var relNode = document.getElementById(inputNames[0]);useArray=new Array();if(buildArray==totVarLabels[0]){useArray.push(totVarLabels[0]);}else if(buildArray==totFixLabels[0]){useArray.push(totFixLabels[0]);}else if(buildArray==totLabels[0]){useArray.push(totLabels[0]);}else if(buildArray==totLabels[1]){useArray.push(totLabels[1]);}if(inputType==inputType1){leftInput=labelStep;leftCalc=labelStep+colStep;}else{leftInput=labelStep+colStep;leftCalc=labelStep;}for(var i = 0;i < useArray.length;i++){var inputVal="-";var calcVal="-";if(document.getElementById(encodeURIComponent(useArray[i]))){var inputNode=document.getElementById(encodeURIComponent(useArray[i]));var calcNode=document.getElementById(encodeURIComponent(useArray[i])+"Calc");inputVal=calcNode.firstChild.nodeValue;calcVal=inputNode.firstChild.nodeValue;inputNode.style.left = leftInput+"px";inputNode.firstChild.nodeValue=inputVal;calcNode.style.left = leftCalc+"px";calcNode.firstChild.nodeValue=calcVal;}else{var inputNode = totNode.cloneNode(true);inputNode.setAttribute("id",encodeURIComponent(useArray[i]));inputNode.style.top = topStart+"px";inputNode.style.left = leftInput+"px";inputNode.setAttribute("align","right");inputNode.style.textAlign = "right";inputValNode = document.createTextNode(inputVal);inputNode.appendChild(inputValNode);relNode.appendChild(inputNode);var calcNode = totNode.cloneNode(true);calcNode.setAttribute("id",encodeURIComponent(useArray[i])+"Calc");calcNode.style.top = topStart+"px";calcNode.style.left = leftCalc+"px";calcNode.setAttribute("align","right");calcNode.style.textAlign = "right";calcValNode = document.createTextNode(calcVal);calcNode.appendChild(calcValNode);relNode.appendChild(calcNode);}}}function inputForecastBuild(){var relNode = document.getElementById(inputNames[0]);topStart+=2*topStep;for(var i = 0;i < assetLabels.length;i++){label=assetLabels[i];encLabel=encodeURIComponent(label);var spanNode = labNode.cloneNode(true);spanNode.style.top = topStart+"px";var textNode = document.createTextNode(label);spanNode.appendChild(textNode);relNode.appendChild(spanNode);var inputNode = inNode.cloneNode(true);inputNode.setAttribute("id",encLabel);inputNode.onchange=evtChange;inputNode.onfocus=inSelect;inputNode.style.top = topStart+"px";inputNode.style.left = labelStep+"px";inputNode.value="-";relNode.appendChild(inputNode);var qLabel=label.replace(/ /g,"-");questNode = helpNode.cloneNode(true);questNode.setAttribute("href",inputHelpFile+"#"+qLabel);questNode.style.top = topStart+"px";relNode.appendChild(questNode);topStart+=topStep;}topStart+=topStep;label=headIndLabels[0];encLabel=encodeURIComponent(label);spanNode = subNode.cloneNode(true);spanNode.style.top = topStart+"px";spanNode.setAttribute("id",encLabel);textNode = document.createTextNode(label);spanNode.appendChild(textNode);relNode.appendChild(spanNode);qLabel=label.replace(/ /g,"-");questNode = helpNode.cloneNode(true);questNode.setAttribute("href",inputHelpFile+"#"+qLabel);questNode.style.top = topStart+"px";relNode.appendChild(questNode);topStart+=topStep;label=setLabels[2];encLabel=encodeURIComponent(label);spanNode = linkNode.cloneNode(true);spanNode.style.width = labelWidth+"px";spanNode.setAttribute("id",encLabel);spanNode.onclick=evtClick;spanNode.style.top = topStart+"px";textNode = document.createTextNode(label);spanNode.appendChild(textNode);relNode.appendChild(spanNode);qLabel=label.replace(/ /g,"-");questNode = helpNode.cloneNode(true);questNode.setAttribute("href",inputHelpFile+"#"+qLabel);questNode.style.top = topStart+"px";relNode.appendChild(questNode);topInd=topStart;}function inputIndYearsReset(){for(var y = forecastYears*1+1;y <= forecastYears+10;y++){if(document.getElementById(encodeURIComponent("Year"+y))){var removeNode=document.getElementById(encodeURIComponent("Year"+y));removeNode.parentNode.removeChild(removeNode);for(var i = 0;i < indLabels.length;i++){removeNode=document.getElementById(encodeURIComponent(indLabels[i])+y);removeNode.parentNode.removeChild(removeNode);}label=senLabels[1]+" "+retLabels[0];encLabel=encodeURIComponent(label);removeNode=document.getElementById(encLabel+y);removeNode.parentNode.removeChild(removeNode);}}}function inputIndFullReset(){for(var y = 1;y <= 10;y++){if(document.getElementById(encodeURIComponent("Year"+y))){var removeNode=document.getElementById(encodeURIComponent("Year"+y));removeNode.parentNode.removeChild(removeNode);for(var i = 0;i < indLabels.length;i++){removeNode=document.getElementById(encodeURIComponent(indLabels[i])+y);removeNode.parentNode.removeChild(removeNode);}label=senLabels[1]+" "+retLabels[0];encLabel=encodeURIComponent(label);removeNode=document.getElementById(encLabel+y);removeNode.parentNode.removeChild(removeNode);}else{break;}}label=senPerLabels[0];encLabel=encodeURIComponent(label);if(document.getElementById(encLabel)){removeNode=document.getElementById(encLabel);removeNode.parentNode.removeChild(removeNode);}for(var i = 0;i < valLabels.length;i++){label=valLabels[i];encLabel=encodeURIComponent(label);if(document.getElementById(encLabel)){removeNode=document.getElementById(encLabel);removeNode.parentNode.removeChild(removeNode);}}}function inputIndBuild(){var relNode = document.getElementById(inputNames[0]);topStart=topInd;for(var i = 0;i < indLabels.length;i++){topStart+=topStep;label=indLabels[i];encLabel=encodeURIComponent(label);if(!document.getElementById(encLabel)){spanNode = labNode.cloneNode(true);spanNode.setAttribute("id",encLabel);spanNode.style.top = topStart+"px";textNode = document.createTextNode(label);spanNode.appendChild(textNode);relNode.appendChild(spanNode);qLabel=label.replace(/ /g,"-");questNode = helpNode.cloneNode(true);questNode.setAttribute("href",inputHelpFile+"#"+qLabel);questNode.style.top = topStart+"px";relNode.appendChild(questNode);}}topStart=topInd;var inputVal=0;for(var i = 0;i < indLabels.length;i++){topStart+=topStep;for(var y = 1;y <= forecastYears;y++){if(!document.getElementById(encodeURIComponent("Year"+y))&&i==0){var spanNode = headNode.cloneNode(true);spanNode.style.top = topInd+"px";spanNode.style.left = labelStep+((y-1)*colStep)+"px";spanNode.setAttribute("id",encodeURIComponent("Year"+y));var textNode = document.createTextNode(y);spanNode.appendChild(textNode);relNode.appendChild(spanNode);}curInVal=null;if(document.getElementById(encodeURIComponent(indLabels[i])+y)){curInVal=document.getElementById(encodeURIComponent(indLabels[i])+y).value;var removeNode=document.getElementById(encodeURIComponent(indLabels[i])+y);removeNode.parentNode.removeChild(removeNode);}var inputNode = inNode.cloneNode(true);inputNode.setAttribute("id",encodeURIComponent(indLabels[i])+y);if(curInVal){inputVal=curInVal;}else if(y>1){preY=y-1;inputVal=document.getElementById(encodeURIComponent(indLabels[i])+preY).value;}else{inputVal=0;}inputNode.onchange=evtChange;inputNode.onfocus=inSelect;inputNode.style.top = topStart+"px";inputNode.style.left = labelStep+((y-1)*colStep)+"px";inputNode.value=numToStr(inputVal);relNode.appendChild(inputNode);}}if(valuationAct==true||subAct==false){var topAdd=(indLabels.length+4)*topStep;}else{var topAdd=(indLabels.length+2)*topStep;}for(var y = 1;y <= forecastYears;y++){label=senLabels[1]+" "+retLabels[0];encLabel=encodeURIComponent(label);if(!document.getElementById(encLabel+y)){var calcNode = totNode.cloneNode(true);calcNode.setAttribute("id",encLabel+y);calcNode.style.top = topInd+topAdd+"px";calcNode.style.left = labelStep+((y-1)*colStep)+"px";calcNode.setAttribute("align","right");calcNode.style.textAlign = "right";calcValNode = document.createTextNode("-");calcNode.appendChild(calcValNode);relNode.appendChild(calcNode);}}topStart+=topStep;label=senPerLabels[0];encLabel=encodeURIComponent(label);if(!document.getElementById("t"+encLabel)){var spanNode = labNode.cloneNode(true);spanNode.setAttribute("id","t"+encLabel);spanNode.style.top = topStart+"px";var textNode = document.createTextNode(label);spanNode.appendChild(textNode);relNode.appendChild(spanNode);}curInVal=0;if(document.getElementById(encLabel)){curInVal=document.getElementById(encLabel).value;var removeNode=document.getElementById(encLabel);removeNode.parentNode.removeChild(removeNode);}var inputNode = inNode.cloneNode(true);inputNode.setAttribute("id",encLabel);inputNode.style.top = topStart+"px";inputNode.style.left = labelStep+"px";inputNode.value=curInVal;relNode.appendChild(inputNode);if(!document.getElementById("q"+encLabel)){var qLabel=label.replace(/ /g,"-");questNode = helpNode.cloneNode(true);questNode.setAttribute("id","q"+encLabel);questNode.setAttribute("href",inputHelpFile+"#"+qLabel);questNode.style.top = topStart+"px";relNode.appendChild(questNode);}}function inputRetBuild(){var relNode = document.getElementById(inputNames[0]);if(valuationAct==true||subAct==false){topStart+=topStep;label=headValLabels[0];encLabel=encodeURIComponent(label);if(!document.getElementById("t"+encLabel)){spanNode = subNode.cloneNode(true);spanNode.style.top = topStart+"px";spanNode.setAttribute("id","t"+encLabel);textNode = document.createTextNode(label);spanNode.appendChild(textNode);relNode.appendChild(spanNode);}if(!document.getElementById("q"+encLabel)){qLabel=label.replace(/ /g,"-");questNode = helpNode.cloneNode(true);questNode.setAttribute("id","q"+encLabel);questNode.setAttribute("href",inputHelpFile+"#"+qLabel);questNode.style.top = topStart+"px";relNode.appendChild(questNode);}for(var i = 0;i < valLabels.length;i++){topStart+=topStep;if(i==1){topStart+=topStep;}label=valLabels[i];encLabel=encodeURIComponent(label);if(!document.getElementById("t"+encLabel)){var spanNode = labNode.cloneNode(true);spanNode.style.top = topStart+"px";spanNode.setAttribute("id","t"+encLabel);var textNode = document.createTextNode(label);spanNode.appendChild(textNode);relNode.appendChild(spanNode);}curInVal=0;if(document.getElementById(encLabel)){curInVal=document.getElementById(encLabel).value;var removeNode=document.getElementById(encLabel);removeNode.parentNode.removeChild(removeNode);}var inputNode = inNode.cloneNode(true);inputNode.setAttribute("id",encLabel);inputNode.onchange=evtChange;inputNode.onfocus=inSelect;inputNode.style.top = topStart+"px";inputNode.style.left = labelStep+"px";inputNode.value=curInVal;relNode.appendChild(inputNode);if(!document.getElementById("q"+encLabel)){var qLabel=label.replace(/ /g,"-");questNode = helpNode.cloneNode(true);questNode.setAttribute("id","q"+encLabel);questNode.setAttribute("href",inputHelpFile+"#"+qLabel);questNode.style.top = topStart+"px";relNode.appendChild(questNode);}if(i==1){if(!document.getElementById(senLabels[i]+"ValIn")){var writeNode = normNode.cloneNode(true);writeNode.style.top = topStart+"px";writeNode.style.textAlign = "right";writeNode.style.left = labelStep+colStep+"px";writeNode.style.width = colWidth+colStep+"px";writeNode.style.fontWeight = "bold";writeNode.style.color = resColor;var textNode = document.createTextNode("Calculated Expected Valuation ");writeNode.appendChild(textNode);relNode.appendChild(writeNode);var writeNode = normNode.cloneNode(true);writeNode.setAttribute("id",senLabels[i]+"ValIn");writeNode.style.top = topStart+"px";writeNode.style.textAlign = "right";writeNode.style.left = labelStep+(3*colStep)+"px";writeNode.style.width = colWidth+"px";writeNode.style.fontWeight = "bold";writeNode.style.color = resColor;var textNode = document.createTextNode("-");var bNode = document.createElement("b");bNode.appendChild(textNode);writeNode.appendChild(bNode);relNode.appendChild(writeNode);}}}}else{for(var i = 0;i < valLabels.length;i++){label=valLabels[i];encLabel=encodeURIComponent(label);curInVal=0;if(document.getElementById(encLabel)){curInVal=document.getElementById(encLabel).value;var removeNode=document.getElementById(encLabel);removeNode.parentNode.removeChild(removeNode);}var inputNode = inHidNode.cloneNode(true);inputNode.setAttribute("id",encLabel);inputNode.value=curInVal;relNode.appendChild(inputNode);}}label=senLabels[1]+" "+retLabels[0];encLabel=encodeURIComponent(label);if(!document.getElementById(encLabel)){if(valuationAct==true||subAct==false){topStart-=topStep;}else{topStart+=topStep;}var spanNode = labNode.cloneNode(true);spanNode.style.top = topStart+"px";spanNode.setAttribute("id",encLabel);var textNode = document.createTextNode(label);spanNode.appendChild(textNode);relNode.appendChild(spanNode);var qLabel=label.replace(/ /g,"-");questNode = helpNode.cloneNode(true);questNode.setAttribute("href",inputHelpFile+"#"+qLabel);questNode.style.top = topStart+"px";relNode.appendChild(questNode);}topStart+=2*topStep;}function inputBreakBuild(){var relNode = document.getElementById(inputNames[0]);if(breakAct==true||subAct==false){topStart+=topStep;label=headPriceLabels[0];encLabel=encodeURIComponent(label);if(!document.getElementById("t"+encLabel)){spanNode = subNode.cloneNode(true);spanNode.style.top = topStart+"px";spanNode.setAttribute("id","t"+encLabel);textNode = document.createTextNode(label);spanNode.appendChild(textNode);relNode.appendChild(spanNode);qLabel=label.replace(/ /g,"-");questNode = helpNode.cloneNode(true);questNode.setAttribute("id","q"+encLabel);questNode.setAttribute("href",inputHelpFile+"#"+qLabel);questNode.style.top = topStart+"px";relNode.appendChild(questNode);}else{topStart-=topStep;}for(var i = 0;i < breakLabels.length;i++){topStart+=topStep;label=breakLabels[i];encLabel=encodeURIComponent(label);if(!document.getElementById("t"+encLabel)){spanNode = labNode.cloneNode(true);spanNode.style.top = topStart+"px";spanNode.setAttribute("id","t"+encLabel);textNode = document.createTextNode(label);spanNode.appendChild(textNode);relNode.appendChild(spanNode);qLabel=label.replace(/ /g,"-");questNode = helpNode.cloneNode(true);questNode.setAttribute("href",inputHelpFile+"#"+qLabel);questNode.style.top = topStart+"px";relNode.appendChild(questNode);}curInVal=0;if(document.getElementById(encLabel)){curInVal=document.getElementById(encLabel).value;var removeNode=document.getElementById(encLabel);removeNode.parentNode.removeChild(removeNode);if(i==0&&valuationAct==false&&subAct==true){topStart=topStart+2*topStep;}}if(i==0){inputNode = inNode.cloneNode(true);inputNode.setAttribute("id",encLabel);inputNode.onchange=evtChange;inputNode.onfocus=inSelect;inputNode.style.top = topStart+"px";inputNode.style.left = labelStep+"px";inputNode.value=curInVal;relNode.appendChild(inputNode);}else{var writeNode = normNode.cloneNode(true);writeNode.setAttribute("id",encLabel);writeNode.style.top = topStart+"px";writeNode.style.textAlign = "right";writeNode.style.left = labelStep+"px";writeNode.style.width = colWidth+"px";var textNode = document.createTextNode("-");writeNode.appendChild(textNode);relNode.appendChild(writeNode);}}}}function inputPriceBuild(){var relNode = document.getElementById(inputNames[0]);if(priceAct==true||subAct==false){topStart+=topStep;label=headPriceLabels[1];encLabel=encodeURIComponent(label);if(!document.getElementById("t"+encLabel)){spanNode = subNode.cloneNode(true);spanNode.style.top = topStart+"px";spanNode.setAttribute("id","t"+encLabel);textNode = document.createTextNode(label);spanNode.appendChild(textNode);relNode.appendChild(spanNode);qLabel=label.replace(/ /g,"-");questNode = helpNode.cloneNode(true);questNode.setAttribute("id","q"+encLabel);questNode.setAttribute("href",inputHelpFile+"#"+qLabel);questNode.style.top = topStart+"px";relNode.appendChild(questNode);}for(var i = 0;i < priceLabels.length;i++){topStart+=topStep;label=priceLabels[i];encLabel=encodeURIComponent(label);if(!document.getElementById("t"+encLabel)){spanNode = labNode.cloneNode(true);spanNode.style.top = topStart+"px";spanNode.setAttribute("id","t"+encLabel);textNode = document.createTextNode(label);spanNode.appendChild(textNode);relNode.appendChild(spanNode);qLabel=label.replace(/ /g,"-");questNode = helpNode.cloneNode(true);questNode.setAttribute("href",inputHelpFile+"#"+qLabel);questNode.style.top = topStart+"px";relNode.appendChild(questNode);}curInVal=0;if(document.getElementById(encLabel)){curInVal=document.getElementById(encLabel).value;var removeNode=document.getElementById(encLabel);removeNode.parentNode.removeChild(removeNode);}inputNode = inNode.cloneNode(true);inputNode.setAttribute("id",encLabel);inputNode.onchange=evtChange;inputNode.onfocus=inSelect;inputNode.style.top = topStart+"px";inputNode.style.left = labelStep+"px";inputNode.value=curInVal;relNode.appendChild(inputNode);}}}function inputFooterBuild(){var relNode = document.getElementById(inputNames[0]);topStart+=3*topStep;label="inputFooter";encLabel=encodeURIComponent(label);if(!document.getElementById(encLabel)){spanNode = normNode.cloneNode(true);spanNode.style.top = topStart+"px";spanNode.style.width = "100%";spanNode.style.textAlign = "left";spanNode.setAttribute("id","t"+encLabel);textNode = document.createTextNode("For analysis results select the required module from the top menu.");spanNode.appendChild(textNode);relNode.appendChild(spanNode);}}function forecastBuild(){topStart=topBase;var relNode = document.getElementById(modNames[0]);if(forecastAct==false){var noSubNode = pNoSubNode.cloneNode(true);noSubNode.setAttribute("id","forecastNoAct");relNode.appendChild(noSubNode);}if(forecastAct==true||subAct==false){spanNode = linkNode.cloneNode(true);spanNode.setAttribute("id",senDisLabId);spanNode.style.textAlign="left";spanNode.onclick=evtClick;spanNode.style.top = topStart+"px";textNode = document.createTextNode(senLabels[1]);spanNode.appendChild(textNode);relNode.appendChild(spanNode);spanNode = normNode.cloneNode(true);spanNode.setAttribute("id",senDisValId);spanNode.style.top = topStart+"px";spanNode.style.textAlign = "left";spanNode.style.left = labelWidth-80+"px";textNode = document.createTextNode("");spanNode.appendChild(textNode);relNode.appendChild(spanNode);var qLabel=senLabels[1]+"-"+senLabels[0]+"-"+senLabels[2];questNode = helpNode.cloneNode(true);questNode.setAttribute("href",forecastHelpFile+"#"+qLabel);questNode.style.top = topStart+"px";relNode.appendChild(questNode);for(var i = 0;i < forecastLabels.length;i++){if(forecastLabels[i]==valLabels[0]&&(valuationAct==false&&subAct==true)){continue;}topStart+=topStep;var spanNode = labNode.cloneNode(true);spanNode.style.top = topStart+"px";if(forecastLabels[i]==revLabels[0]||forecastLabels[i]==headVarLabels[0]||forecastLabels[i]==headFixLabels[0]||forecastLabels[i]==totLabels[0]||forecastLabels[i]==totLabels[1]){spanNode.style.textAlign = "left";}label=forecastLabels[i];encLabel=encodeURIComponent(label);if(forecastLabels[i]!=headVarLabels[0]&&forecastLabels[i]!=headFixLabels[0]){spanNode.setAttribute("id",fValMk+encLabel);spanNode.onclick=plotData;spanNode.style.cursor="pointer";spanNode.setAttribute("title","Click to Plot.");}var textNode = document.createTextNode(label);spanNode.appendChild(textNode);relNode.appendChild(spanNode);qLabel=label.replace(/ /g,"-");questNode = helpNode.cloneNode(true);questNode.setAttribute("href",forecastHelpFile+"#"+qLabel);questNode.style.top = topStart+"px";relNode.appendChild(questNode);if(forecastLabels[i]!=revLabels[0]&&forecastLabels[i]!=headVarLabels[0]&&forecastLabels[i]!=headFixLabels[0]&&forecastLabels[i]!=totVarLabels[2]){var spanNode = labNode.cloneNode(true);spanNode.style.top = topStart+Math.floor(0.5*topStep)+"px";spanNode.style.color = lowColor;spanNode.style.fontSize = lowSize+"px";spanNode.style.fontWeight = "normal";if(forecastLabels[i]==totLabels[0]||forecastLabels[i]==totLabels[1]){spanNode.style.textAlign = "left";}if(forecastLabels[i]!=headVarLabels[0]&&forecastLabels[i]!=headFixLabels[0]){spanNode.setAttribute("id",fPerMk+encLabel);spanNode.onclick=plotData;spanNode.style.cursor="pointer";spanNode.setAttribute("title","Click to Plot.");}var textNode = document.createTextNode("% Revenue");spanNode.appendChild(textNode);relNode.appendChild(spanNode);}}}}function forecastReset(){var relNode = document.getElementById(modNames[0]);var relNodeLen=relNode.childNodes.length;for(var childNum=1;childNum<relNodeLen;childNum++){relNode.removeChild(relNode.lastChild);}}function forecastCalc(){if(forecastAct==true||subAct==false){if(inputType!=inputType1){inputTypeChange(inputType1);}var relNode = document.getElementById(modNames[0]);topStart=topBase;var topYear=topBase;var valPre="-";var valCur="-";var revPre="-";var revCur="-";var totVar=0;var selSens=document.getElementById(senDisLabId).firstChild.nodeValue;var senUseArray = senLabels.slice(0);for(var s = 0;s < senUseArray.length;s++){if(senUseArray[s]==selSens){senUseArray.splice(s,1);senUseArray.push(selSens);}}var senSetVal=strToNum(document.getElementById(encodeURIComponent(senPerLabels[0])).value);optRevArray=new Array();expRevArray=new Array();pesRevArray=new Array();optArray=new Array();expArray=new Array();pesArray=new Array();optPerArray=new Array();expPerArray=new Array();pesPerArray=new Array();for(var s = 0;s < senUseArray.length;s++){var curSens=senUseArray[s];if(curSens==senLabels[1]){senVal=0;}else if(curSens==senLabels[2]){senVal=-senSetVal;}else{senVal=senSetVal;}for(var i = 0;i < forecastLabels.length;i++){if(forecastLabels[i]==valLabels[0]&&(valuationAct==false&&subAct==true)){continue;}topStart+=topStep;if(forecastLabels[i]==headVarLabels[0]||forecastLabels[i]==headFixLabels[0]){continue;}for(var y = 0;y <= forecastYears;y++){if(!document.getElementById(encodeURIComponent(fValLabel+y))&&i==0){var spanNode = headNode.cloneNode(true);spanNode.style.top = topYear+"px";spanNode.style.left = labelStep+(y*colStep)+"px";spanNode.setAttribute("id",encodeURIComponent(fValLabel+y));if(y==0){var useText="Current Year";}else{var useText="Year "+y;}var textNode = document.createTextNode(useText);spanNode.appendChild(textNode);relNode.appendChild(spanNode);}if(!document.getElementById(encodeURIComponent(forecastLabels[i])+fValLabel+y)){var calcNode= normNode.cloneNode(true);calcNode.setAttribute("id",encodeURIComponent(forecastLabels[i])+fValLabel+y);calcNode.style.top = topStart+"px";calcNode.style.left = labelStep+(y*colStep)+"px";textNode = document.createTextNode("-");calcNode.appendChild(textNode);relNode.appendChild(calcNode);if(i>0&&forecastLabels[i]!=totVarLabels[2]){var calcNode= normNode.cloneNode(true);calcNode.setAttribute("id",encodeURIComponent(forecastLabels[i])+fPerLabel+y);calcNode.style.top = topStart+Math.floor(0.5*topStep)+"px";calcNode.style.color = lowColor;calcNode.style.fontSize = lowSize+"px";calcNode.style.fontWeight = "normal";calcNode.style.left = labelStep+(y*colStep)+"px";textNode = document.createTextNode("-");calcNode.appendChild(textNode);relNode.appendChild(calcNode);}}if(y==0){if(forecastLabels[i]==totVarLabels[0]||forecastLabels[i]==totFixLabels[0]||forecastLabels[i]==totLabels[0]||forecastLabels[i]==totLabels[1]){valCur=strToNum(document.getElementById(encodeURIComponent(forecastLabels[i])).firstChild.nodeValue);}else if(forecastLabels[i]==totVarLabels[1]){revCur=strToNum(document.getElementById(encodeURIComponent(forecastLabels[0])+fValLabel+y).firstChild.nodeValue);valCur=revCur-strToNum(document.getElementById(encodeURIComponent(forecastLabels[i-1])).firstChild.nodeValue);}else if(forecastLabels[i]==totVarLabels[2]){revCur=strToNum(document.getElementById(encodeURIComponent(forecastLabels[0])+fValLabel+y).firstChild.nodeValue);valCur=(revCur/strToNum(document.getElementById(encodeURIComponent(forecastLabels[i-2])).firstChild.nodeValue)-1)*100;}else if(forecastLabels[i]==depLabels[0]){var depCur=strToNum(document.getElementById(encodeURIComponent(assetLabels[0])).value)/strToNum(document.getElementById(encodeURIComponent(assetLabels[1])).value);valCur=depCur;}else if(forecastLabels[i]==retLabels[0]){var surCur=strToNum(document.getElementById(encodeURIComponent(totLabels[1])).firstChild.nodeValue);var depCur=strToNum(document.getElementById(encodeURIComponent(assetLabels[0])).value)/strToNum(document.getElementById(encodeURIComponent(assetLabels[1])).value);if(valuationAct==true||subAct==false){var ownCur=strToNum(document.getElementById(encodeURIComponent(valLabels[0])).value);}else{var ownCur=0;}valCur=surCur-depCur-ownCur;if(curSens==senLabels[0]){optArray.push(valCur);}else if(curSens==senLabels[2]){pesArray.push(valCur);}else{expArray.push(valCur);}}else{valCur=strToNum(document.getElementById(encodeURIComponent(forecastLabels[i])).value);if(forecastLabels[i]==revLabels[0]){if(curSens==senLabels[0]){optRevArray.push(valCur);}else if(curSens==senLabels[2]){pesRevArray.push(valCur);}else{expRevArray.push(valCur);}}}}else{var preYear=y-1;valPre=strToNum(document.getElementById(encodeURIComponent(forecastLabels[i])+fValLabel+preYear).firstChild.nodeValue);if(i>0){revPre=strToNum(document.getElementById(encodeURIComponent(forecastLabels[0])+fValLabel+preYear).firstChild.nodeValue);revCur=strToNum(document.getElementById(encodeURIComponent(forecastLabels[0])+fValLabel+y).firstChild.nodeValue);}if(forecastLabels[i]==revLabels[0]){var marStrInd = 0;var busPosInd = 1;var levComInd = 2;var marStrPer = strToNum(document.getElementById(encodeURIComponent(indLabels[marStrInd])+y).value)/100;var marStrSign = 1;if(marStrPer<0){marStrSign = -1;}var marStrSenPer = marStrPer + marStrSign * marStrPer * senVal/100;var busPosPer = strToNum(document.getElementById(encodeURIComponent(indLabels[busPosInd])+y).value)/100;var busPosSign = 1;if(busPosPer<0){busPosSign = -1;}var busPosSenPer = busPosPer + busPosSign * busPosPer * senVal/100;var levComPer = strToNum(document.getElementById(encodeURIComponent(indLabels[levComInd])+y).value)/100;var levComSign = -1;if(levComPer<0){levComSign = 1;}var levComSenPer = levComPer + levComSign * levComPer * senVal/100;revPre=strToNum(document.getElementById(encodeURIComponent(forecastLabels[i])+fValLabel+preYear).firstChild.nodeValue);revCur=revPre + (revPre * marStrSenPer) + (revPre * busPosSenPer) - (revPre * levComSenPer);valCur=revCur;if(curSens==senLabels[0]){optRevArray.push(valCur);}else if(curSens==senLabels[2]){pesRevArray.push(valCur);}else{expRevArray.push(valCur);}}else if(forecastLabels[i]==varExpLabels[0]||forecastLabels[i]==varExpLabels[1]||forecastLabels[i]==varExpLabels[2]||forecastLabels[i]==varExpLabels[3]||forecastLabels[i]==varExpLabels[4]){if(forecastLabels[i]==varExpLabels[1]){var appInd=4;}else{var appInd=3;}var varCostPer = strToNum(document.getElementById(encodeURIComponent(indLabels[appInd])+y).value)/100;var varCostSign = 1;if(varCostPer<0){varCostSign = -1;}var varCostSenPer = varCostPer + varCostSign * varCostPer * senVal/100;var effInd=6;var varEffPer = strToNum(document.getElementById(encodeURIComponent(indLabels[effInd])+y).value)/100;var varEffSign = -1;if(varEffPer<0){varEffSign = 1;}var varEffSenPer = varEffPer + varEffSign * varEffPer * senVal/100;valCur=(valPre + (valPre * varCostSenPer) - (valPre*varEffSenPer)) * (revCur/revPre);}else if(forecastLabels[i]==totVarLabels[0]||forecastLabels[i]==totFixLabels[0]){var subTotExp=0;if(forecastLabels[i]==totVarLabels[0]){useArray=varExpLabels;}else{useArray=fixExpLabels;}for(var e = 0;e < useArray.length;e++){subTotExp+=strToNum(document.getElementById(encodeURIComponent(useArray[e])+fValLabel+y).firstChild.nodeValue);}valCur=subTotExp;}else if(forecastLabels[i]==totVarLabels[1]){valCur=revCur-strToNum(document.getElementById(encodeURIComponent(forecastLabels[i-1]+fValLabel+y)).firstChild.nodeValue);}else if(forecastLabels[i]==totVarLabels[2]){valCur=(revCur/strToNum(document.getElementById(encodeURIComponent(forecastLabels[i-2]+fValLabel+y)).firstChild.nodeValue)-1)*100;}else if(forecastLabels[i]==totVarLabels[2]){valCur=(revCur/strToNum(document.getElementById(encodeURIComponent(forecastLabels[i-2]+fValLabel+y)).firstChild.nodeValue)-1)*100;}else if(forecastLabels[i]==fixExpLabels[0]||forecastLabels[i]==fixExpLabels[1]||forecastLabels[i]==fixExpLabels[2]||forecastLabels[i]==fixExpLabels[3]||forecastLabels[i]==fixExpLabels[4]||forecastLabels[i]==depLabels[0]||forecastLabels[i]==valLabels[0]){if(forecastLabels[i]==fixExpLabels[1]||forecastLabels[i]==valLabels[0]){var appInd=4;}else if(forecastLabels[i]==fixExpLabels[3]){var appInd=5;}else{var appInd=3;}var fixCostPer = strToNum(document.getElementById(encodeURIComponent(indLabels[appInd])+y).value)/100;var fixCostSign = 1;if(fixCostPer<0){fixCostSign = -1;}var fixCostSenPer = fixCostPer + fixCostSign * fixCostPer * senVal/100;var effInd=7;var fixEffPer = strToNum(document.getElementById(encodeURIComponent(indLabels[effInd])+y).value)/100;var fixEffSign = -1;if(fixEffPer<0){fixEffSign = 1;}var fixEffSenPer = fixEffPer + fixEffSign * fixEffPer * senVal/100;var floInd=8;var fixFloPer = strToNum(document.getElementById(encodeURIComponent(indLabels[floInd])+y).value)/100;var fixFloSign = 1;if(fixFloPer<0){fixFloSign = -1;}var fixFloSenPer = fixFloPer + fixFloSign * fixFloPer * senVal/100;if(forecastLabels[i]==valLabels[0]){valCur=valPre + (valPre * fixCostSenPer);if(valuationAct==true||subAct==false){var ownCur=valCur;}else{var ownCur=0;continue;}}else{valCur=(valPre + (valPre * fixCostSenPer) - (valPre*fixEffSenPer)) * (1 + (revCur-revPre)/revPre*fixFloSenPer);}if(forecastLabels[i]==depLabels[0]){depCur=valCur;}}else if(forecastLabels[i]==totLabels[0]){var totExp=strToNum(document.getElementById(encodeURIComponent(totVarLabels[0])+fValLabel+y).firstChild.nodeValue);totExp+=strToNum(document.getElementById(encodeURIComponent(totFixLabels[0])+fValLabel+y).firstChild.nodeValue);valCur=totExp;}else if(forecastLabels[i]==totLabels[1]){valCur=revCur-strToNum(document.getElementById(encodeURIComponent(totLabels[0])+fValLabel+y).firstChild.nodeValue);}else if(forecastLabels[i]==retLabels[0]){var surCur=strToNum(document.getElementById(encodeURIComponent(totLabels[1])+fValLabel+y).firstChild.nodeValue);valCur=surCur-depCur-ownCur;if(curSens==senLabels[0]){optArray.push(valCur);}else if(curSens==senLabels[2]){pesArray.push(valCur);}else{expArray.push(valCur);label=senLabels[1]+" "+retLabels[0];encLabel=encodeURIComponent(label);document.getElementById(encLabel+y).firstChild.nodeValue=numToStr(valCur);}}}document.getElementById(encodeURIComponent(forecastLabels[i])+fValLabel+y).firstChild.nodeValue=numToStr(valCur);if(i>0&&forecastLabels[i]!=totVarLabels[2]){revCur=strToNum(document.getElementById(encodeURIComponent(forecastLabels[0])+fValLabel+y).firstChild.nodeValue);var perRev=(valCur/revCur)*100;document.getElementById(encodeURIComponent(forecastLabels[i])+fPerLabel+y).firstChild.nodeValue=numToStr(perRev);if(forecastLabels[i]==retLabels[0]){if(curSens==senLabels[0]){optPerArray.push(perRev);}else if(curSens==senLabels[2]){pesPerArray.push(perRev);}else{expPerArray.push(perRev);}}}}}}}}function forecastCompress(){if(document.getElementById(encodeURIComponent('Compress1'))){var relNode = document.getElementById(modNames[0]);var showArray=new Array();var topAdj=0;var preRow="0";var showRow="0";var firstRun=true;var firstHideRow="0";var halfStep=Math.floor(0.5*topStep);for(var i = 1;i < relNode.childNodes.length;i++){var nodeText=relNode.childNodes[i].firstChild.nodeValue;var curRow=relNode.childNodes[i].style.top;if(nodeText==headVarLabels[0]){firstHideRow=curRow;topAdj=parseInt(firstHideRow);}if(firstHideRow=="0"){continue;}if(parseInt(curRow)<parseInt(preRow)){firstRun=false;preRow="0";topAdj=parseInt(firstHideRow);showRow="0";moveArray = showArray.slice(0);}if(parseInt(curRow)>=parseInt(firstHideRow)){if(firstRun==true){if(nodeText==totVarLabels[0]||nodeText==totFixLabels[0]||nodeText==totLabels[0]||nodeText==totLabels[1]||nodeText==retLabels[0]){relNode.childNodes[i].style.top=topAdj+"px";topAdj+=topStep;showArray.push(curRow);}else if(curRow==showArray[showArray.length-1]){relNode.childNodes[i].style.top=topAdj-topStep+"px";}else if(parseInt(curRow)==parseInt(showArray[showArray.length-1])+halfStep){relNode.childNodes[i].style.top=topAdj-halfStep-1+"px";}else{relNode.childNodes[i].style.visibility="hidden";}preRow=curRow;}else{if(curRow==showArray[0]){relNode.childNodes[i].style.top=topAdj+"px";showRow=curRow;showArray.splice(0,1);topAdj+=topStep;}else if(curRow==showRow){relNode.childNodes[i].style.top=topAdj-topStep+"px";}else if(parseInt(curRow)==parseInt(showRow)+halfStep){relNode.childNodes[i].style.top=topAdj-halfStep-1+"px";}else{relNode.childNodes[i].style.visibility="hidden";}}}}document.getElementById(encodeURIComponent('Compress1')).firstChild.nodeValue="Expand";document.getElementById(encodeURIComponent('Compress1')).id="Expand1";}}function forecastExpand(){if(document.getElementById(encodeURIComponent('Expand1'))){var relNode = document.getElementById(modNames[0]);var moveAdj=0;var preRow="0";var showRow="0";var firstHideRow="0";var halfStep=Math.floor(0.5*topStep);for(var i = 1;i < relNode.childNodes.length;i++){var nodeText=relNode.childNodes[i].firstChild.nodeValue;var curRow=relNode.childNodes[i].style.top;if(nodeText==headVarLabels[0]){firstHideRow=curRow;}if(firstHideRow=="0"){continue;}if(parseInt(curRow)<parseInt(preRow)){var moveAdj=0;preRow="0";showRow="0";}if(parseInt(curRow)>=parseInt(firstHideRow)){if(relNode.childNodes[i].style.visibility!="hidden"){if(curRow==showRow){relNode.childNodes[i].style.top=moveArray[moveAdj-1];}else if(parseInt(curRow)==parseInt(showRow)+halfStep){relNode.childNodes[i].style.top=parseInt(moveArray[moveAdj-1])+halfStep+"px";}else{showRow=curRow;relNode.childNodes[i].style.top=moveArray[moveAdj];moveAdj++;preRow=curRow;}}}}for(var i = 0;i < relNode.childNodes.length;i++){if(relNode.childNodes[i].style.visibility=="hidden"){relNode.childNodes[i].style.visibility="visible"}}document.getElementById(encodeURIComponent('Expand1')).firstChild.nodeValue="Compress";document.getElementById(encodeURIComponent('Expand1')).id="Compress1";}}function valuationBuild(){topStart=topBase;var relNode = document.getElementById(modNames[1]);if(valuationAct==false){var noSubNode = pNoSubNode.cloneNode(true);noSubNode.setAttribute("id","valuationNoAct");relNode.appendChild(noSubNode);}if(valuationAct==true||subAct==false){topStart+=topStep;label=retLabels[0];encLabel=encodeURIComponent(label);var spanNode = labNode.cloneNode(true);spanNode.style.top = topStart+"px";spanNode.style.textAlign = "left";var textNode = document.createTextNode(label);spanNode.appendChild(textNode);relNode.appendChild(spanNode);relNode.appendChild(subNode);qLabel=label.replace(/ /g,"-");questNode = helpNode.cloneNode(true);questNode.setAttribute("href",valuationHelpFile+"#"+qLabel);questNode.style.top = topStart+"px";relNode.appendChild(questNode);label=valSectLabel;encLabel=encodeURIComponent(label);var topSteps=5;var spanNode = labNode.cloneNode(true);spanNode.style.top = topStart+(topSteps*topStep)+"px";spanNode.style.textAlign = "left";var textNode = document.createTextNode(label);spanNode.appendChild(textNode);relNode.appendChild(spanNode);qLabel=label.replace(/ /g,"-");questNode = helpNode.cloneNode(true);questNode.setAttribute("href",valuationHelpFile+"#"+qLabel);questNode.style.top = topStart+(topSteps*topStep)+"px";relNode.appendChild(questNode);label=npvSectLabel;encLabel=encodeURIComponent(label);topSteps+=5;var spanNode = labNode.cloneNode(true);spanNode.style.top = topStart+(topSteps*topStep)+"px";spanNode.style.textAlign = "left";var textNode = document.createTextNode(label);spanNode.appendChild(textNode);relNode.appendChild(spanNode);qLabel=label.replace(/ /g,"-");questNode = helpNode.cloneNode(true);questNode.setAttribute("href",valuationHelpFile+"#"+qLabel);questNode.style.top = topStart+(topSteps*topStep)+"px";relNode.appendChild(questNode);topSteps-=5;for(var i = 0;i < senLabels.length;i++){topSteps=6;topStart+=topStep;label=senLabels[i];encLabel=encodeURIComponent(label);var spanNode = labNode.cloneNode(true);spanNode.style.top = topStart+"px";spanNode.setAttribute("id",vValMk+encLabel);spanNode.onclick=plotData;spanNode.style.cursor="pointer";spanNode.setAttribute("title","Click to Plot.");var textNode = document.createTextNode(label);spanNode.appendChild(textNode);relNode.appendChild(spanNode);qLabel=label.replace(/ /g,"-");questNode = helpNode.cloneNode(true);questNode.setAttribute("href",valuationHelpFile+"#"+qLabel);questNode.style.top = topStart+"px";relNode.appendChild(questNode);var spanNode = labNode.cloneNode(true);spanNode.style.top = topStart+(0.5*topStep)+"px";spanNode.style.color = lowColor;spanNode.style.fontSize = lowSize+"px";spanNode.style.fontWeight = "normal";spanNode.setAttribute("id",vPerMk+encLabel);spanNode.onclick=plotData;spanNode.style.cursor="pointer";spanNode.setAttribute("title","Click to Plot.");var textNode = document.createTextNode("% Return on Investment");spanNode.appendChild(textNode);relNode.appendChild(spanNode);var writeNode = normNode.cloneNode(true);writeNode.style.top = topStart+(topSteps*topStep)+"px";writeNode.style.width = labelStep+colWidth-leftStart+"px";writeNode.style.textAlign = "right";if(senLabels[i]==senLabels[1]){writeNode.style.fontWeight = "bold";writeNode.style.color = resColor;}var textNode = document.createTextNode(senLabels[i]+" return results in a Valuation of ");writeNode.appendChild(textNode);relNode.appendChild(writeNode);label=senLabels[i]+' Valuation';qLabel=label.replace(/ /g,"-");questNode = helpNode.cloneNode(true);questNode.setAttribute("href",valuationHelpFile+"#"+qLabel);questNode.style.top = topStart+(topSteps*topStep)+"px";questNode.style.left = labelStep+colWidth+helpLeft+"px";relNode.appendChild(questNode);if(senLabels[i]==senLabels[1]){label=curValLabel;encLabel=encodeURIComponent(label);var writeNode = normNode.cloneNode(true);writeNode.style.top = topStart+(topSteps*topStep)+"px";writeNode.style.left = labelStep+(2*colStep)-10+"px";writeNode.style.width = colWidth+25+"px";writeNode.style.textAlign = "right";var textNode = document.createTextNode(label);writeNode.appendChild(textNode);relNode.appendChild(writeNode);var inputNode = inNode.cloneNode(true);inputNode.setAttribute("id",encLabel);inputNode.onchange=evtChange;inputNode.onfocus=inSelect;inputNode.style.top = topStart+(topSteps*topStep)+"px";inputNode.style.left = labelStep+(3*colStep)+"px";inputNode.style.width = colWidth+"px";inputNode.value="-";relNode.appendChild(inputNode);var qLabel=label.replace(/ /g,"-");questNode = helpNode.cloneNode(true);questNode.setAttribute("href",valuationHelpFile+"#"+qLabel);questNode.style.top = topStart+(topSteps*topStep)+"px";questNode.style.left = labelStep+(3*colStep)+colWidth+helpLeft+helpLeft+"px";relNode.appendChild(questNode);label=resetLabel+' '+curValLabel;encLabel=encodeURIComponent(label);spanNode = linkNode.cloneNode(true);spanNode.style.left = labelStep+(4*colStep)+"px";spanNode.style.width = colStep+colWidth+"px";spanNode.style.textAlign = "left";spanNode.setAttribute("id",encLabel);spanNode.onclick=evtClick;spanNode.style.top = topStart+(topSteps*topStep)+"px";textNode = document.createTextNode(resetLabel);spanNode.appendChild(textNode);relNode.appendChild(spanNode);qLabel=label.replace(/ /g,"-");questNode = helpNode.cloneNode(true);questNode.setAttribute("href",valuationHelpFile+"#"+qLabel);questNode.style.top = topStart+(topSteps*topStep)+"px";questNode.style.left = labelStep+(4*colStep)+helpLeft+35+"px";relNode.appendChild(questNode);}topSteps=11;var writeNode = normNode.cloneNode(true);writeNode.style.top = topStart+(topSteps*topStep)+"px";writeNode.style.width = labelStep+colWidth-leftStart+"px";var textNode = document.createTextNode(senLabels[i]+" return results in a "+npvLabels[1]+" of");writeNode.appendChild(textNode);relNode.appendChild(writeNode);label=senLabels[i]+' NPV';qLabel=label.replace(/ /g,"-");questNode = helpNode.cloneNode(true);questNode.setAttribute("href",valuationHelpFile+"#"+qLabel);questNode.style.top = topStart+(topSteps*topStep)+"px";questNode.style.left = labelStep+colWidth+helpLeft+"px";relNode.appendChild(questNode);}var topStepBy=8;var colStepBy=4;var helpOffSet=60;label=curIrrLabel;encLabel=encodeURIComponent(label);var writeNode = normNode.cloneNode(true);writeNode.style.top = topStart+(topStepBy*topStep)+"px";writeNode.style.left = labelStep+(2*colStep)-10+"px";writeNode.style.width = colWidth+25+"px";writeNode.style.textAlign = "right";var textNode = document.createTextNode(label);writeNode.appendChild(textNode);relNode.appendChild(writeNode);var inputNode = inNode.cloneNode(true);inputNode.setAttribute("id",encLabel);inputNode.onchange=evtChange;inputNode.onfocus=inSelect;inputNode.style.top = topStart+(topStepBy*topStep)+"px";inputNode.style.left = labelStep+(3*colStep)+"px";inputNode.style.width = colWidth+"px";inputNode.value="-";relNode.appendChild(inputNode);var qLabel=label.replace(/ /g,"-");questNode = helpNode.cloneNode(true);questNode.setAttribute("href",valuationHelpFile+"#"+qLabel);questNode.style.top = topStart+(topStepBy*topStep)+"px";questNode.style.left = labelStep+(3*colStep)+colWidth+helpLeft+helpLeft+"px";relNode.appendChild(questNode);label=resetLabel+' '+curIrrLabel;encLabel=encodeURIComponent(label);spanNode = linkNode.cloneNode(true);spanNode.style.left = labelStep+(4*colStep)+"px";spanNode.style.width = colStep+colWidth+"px";spanNode.style.textAlign = "left";spanNode.setAttribute("id",encLabel);spanNode.onclick=evtClick;spanNode.style.top = topStart+(topStepBy*topStep)+"px";textNode = document.createTextNode(resetLabel);spanNode.appendChild(textNode);relNode.appendChild(spanNode);qLabel=label.replace(/ /g,"-");questNode = helpNode.cloneNode(true);questNode.setAttribute("href",valuationHelpFile+"#"+qLabel);questNode.style.top = topStart+(topStepBy*topStep)+"px";questNode.style.left = labelStep+(4*colStep)+helpLeft+35+"px";relNode.appendChild(questNode);label=zeroNpvLabel;encLabel=encodeURIComponent(label);var topStepBy=10;var colStepBy=4;spanNode = linkNode.cloneNode(true);spanNode.style.left = labelStep+(colStepBy*colStep)+"px";spanNode.style.width = colStep+colWidth+"px";spanNode.style.textAlign = "left";spanNode.setAttribute("id",encLabel);spanNode.onclick=evtClick;spanNode.style.top = topStart+(topStepBy*topStep)+"px";textNode = document.createTextNode(label);spanNode.appendChild(textNode);relNode.appendChild(spanNode);qLabel=label.replace(/ /g,"-");questNode = helpNode.cloneNode(true);questNode.setAttribute("href",valuationHelpFile+"#"+qLabel);questNode.style.top = topStart+(topStepBy*topStep)+"px";questNode.style.left = labelStep+(4*colStep)+helpLeft+40+"px";relNode.appendChild(questNode);}}function valuationCalc(){if(valuationAct==true||subAct==false){var relNode = document.getElementById(modNames[1]);topStart=topBase;var topYear=topBase;var valPre="-";var valCur="-";var useRevArray=new Array();var usePerArray=new Array();for(var y = 0;y <= 10;y++){if(document.getElementById(encodeURIComponent(vValLabel+y))){var removeNode=document.getElementById(encodeURIComponent(vValLabel+y));removeNode.parentNode.removeChild(removeNode);for(var i = 0;i < senLabels.length;i++){removeNode=document.getElementById(encodeURIComponent(senLabels[i])+vValLabel+y);removeNode.parentNode.removeChild(removeNode);removeNode=document.getElementById(encodeURIComponent(senLabels[i])+vPerLabel+y);removeNode.parentNode.removeChild(removeNode);}}else{break;}}topStart+=topStep;for(var i = 0;i < senLabels.length;i++){topStart+=topStep;if(senLabels[i]==senLabels[0]){useRevArray=optRevArray;useArray=optArray;usePerArray=optPerArray;}else if(senLabels[i]==senLabels[2]){useRevArray=pesRevArray;useArray=pesArray;usePerArray=pesPerArray;}else{useRevArray=expRevArray;useArray=expArray;usePerArray=expPerArray;}colYears=parseInt(forecastYears)+1;var sumRev=0;for(var y = 0;y <=colYears;y++){if(!document.getElementById(encodeURIComponent(vValLabel+y))&&i==0){var spanNode = headNode.cloneNode(true);spanNode.style.top = topYear+"px";spanNode.style.left = labelStep+(y*colStep)+"px";spanNode.setAttribute("id",encodeURIComponent(vValLabel+y));if(y==0){var useText="Current Year";}else if(y==colYears){var useText="Average";}else{var useText="Year "+y;}var textNode = document.createTextNode(useText);spanNode.appendChild(textNode);relNode.appendChild(spanNode);}if(!document.getElementById(encodeURIComponent(senLabels[i])+vValLabel+y)){var calcNode=normNode.cloneNode(true);calcNode.setAttribute("id",encodeURIComponent(senLabels[i])+vValLabel+y);calcNode.style.top = topStart+"px";calcNode.style.left = labelStep+(y*colStep)+"px";textNode = document.createTextNode("-");calcNode.appendChild(textNode);relNode.appendChild(calcNode);var calcNode= normNode.cloneNode(true);calcNode.setAttribute("id",encodeURIComponent(senLabels[i])+vPerLabel+y);calcNode.style.top = topStart+(0.5*topStep)+"px";calcNode.style.color = lowColor;calcNode.style.fontSize = lowSize+"px";calcNode.style.fontWeight = "normal";calcNode.style.left = labelStep+(y*colStep)+"px";textNode = document.createTextNode("-");calcNode.appendChild(textNode);relNode.appendChild(calcNode);}if(y==colYears){valCur=0;for (s=1;s<useArray.length;s++){valCur+=useArray[s];}var valPer=(valCur/sumRev)*100;usePerArray.push(valPer);valCur=valCur/(colYears-1);}else{if(y>0){sumRev+=useRevArray[y];}valCur=useArray[y];}document.getElementById(encodeURIComponent(senLabels[i])+vValLabel+y).firstChild.nodeValue=numToStr(valCur);}}topStart+=3*topStep;if(document.getElementById("VRR")){removeNode=document.getElementById("VRR");removeNode.parentNode.removeChild(removeNode);}var curPer=strToNum(document.getElementById(encodeURIComponent(valLabels[1])).value);label=valLabels[1];encLabel=encodeURIComponent(label);var writeNode = normNode.cloneNode(true);writeNode.setAttribute("id","VRR");writeNode.style.top = topStart+"px";writeNode.style.width = labelStep+colWidth-leftStart+"px";var textNode = document.createTextNode("For a "+forecastYears+" year Average "+label+" of ");writeNode.appendChild(textNode);relNode.appendChild(writeNode);if(document.getElementById("VRRVal")){removeNode=document.getElementById("VRRVal");removeNode.parentNode.removeChild(removeNode);}var writeNode = normNode.cloneNode(true);writeNode.setAttribute("id","VRRVal");writeNode.style.top = topStart+"px";writeNode.style.textAlign = "right";writeNode.style.left = labelStep+colStep+"px";writeNode.style.width = colWidth+"px";var textNode = document.createTextNode(numToStr(curPer));var bNode = document.createElement("b");bNode.appendChild(textNode);writeNode.appendChild(bNode);relNode.appendChild(writeNode);for(var i = 0;i < senLabels.length;i++){if(document.getElementById(encodeURIComponent(senLabels[i])+"Val")){removeNode=document.getElementById(encodeURIComponent(senLabels[i])+"Val");removeNode.parentNode.removeChild(removeNode);}topStart+=topStep;var senAv=strToNum(document.getElementById(encodeURIComponent(senLabels[i])+vValLabel+colYears).firstChild.nodeValue);var calcVal=senAv/(curPer/100);var writeNode = normNode.cloneNode(true);writeNode.setAttribute("id",senLabels[i]+"Val");writeNode.style.top = topStart+"px";writeNode.style.textAlign = "right";writeNode.style.left = labelStep+colStep+"px";writeNode.style.width = colWidth+"px";if(senLabels[i]==senLabels[1]){writeNode.style.fontWeight = "bold";writeNode.style.color = resColor;}var textNode = document.createTextNode(numToStr(calcVal));var bNode = document.createElement("b");bNode.appendChild(textNode);writeNode.appendChild(bNode);relNode.appendChild(writeNode);if(senLabels[i]==senLabels[1]){label=senLabels[i]+"ValIn";encLabel=encodeURIComponent(label);document.getElementById(encLabel).firstChild.firstChild.nodeValue=numToStr(calcVal);if(curValCk==false){label=curValLabel;encLabel=encodeURIComponent(label);document.getElementById(encLabel).value=numToStr(calcVal);}if(curIrrCk==false){label=curIrrLabel;encLabel=encodeURIComponent(label);curPer=strToNum(document.getElementById(encodeURIComponent(valLabels[1])).value);document.getElementById(encLabel).value=numToStr(curPer);}}}topStart+=2*topStep;if(document.getElementById("NRR")){removeNode=document.getElementById("NRR");removeNode.parentNode.removeChild(removeNode);}label=curIrrLabel;encLabel=encodeURIComponent(label);var curPer=strToNum(document.getElementById(encLabel).value);label=npvLabels[0];encLabel=encodeURIComponent(label);var writeNode = normNode.cloneNode(true);writeNode.setAttribute("id","NRR");writeNode.style.top = topStart+"px";writeNode.style.width = labelStep+colWidth-leftStart+"px";var textNode = document.createTextNode("For a "+forecastYears+" year period "+label+" of ");writeNode.appendChild(textNode);relNode.appendChild(writeNode);if(document.getElementById("NRRVal")){removeNode=document.getElementById("NRRVal");removeNode.parentNode.removeChild(removeNode);}var writeNode = normNode.cloneNode(true);writeNode.setAttribute("id","NRRVal");writeNode.style.top = topStart+"px";writeNode.style.textAlign = "right";writeNode.style.left = labelStep+colStep+"px";writeNode.style.width = colWidth+"px";var textNode = document.createTextNode(numToStr(curPer));var bNode = document.createElement("b");bNode.appendChild(textNode);writeNode.appendChild(bNode);relNode.appendChild(writeNode);for(var i = 0;i < senLabels.length;i++){if(document.getElementById(encodeURIComponent(senLabels[i])+"Npv")){removeNode=document.getElementById(encodeURIComponent(senLabels[i])+"Npv");removeNode.parentNode.removeChild(removeNode);}topStart+=topStep;var calcVal=0;for(var y = 1;y <colYears;y++){var senVal=strToNum(document.getElementById(encodeURIComponent(senLabels[i])+vValLabel+y).firstChild.nodeValue);var denom=Math.pow(1+(curPer/100),y);calcVal+=senVal/denom;}var retVal=strToNum(document.getElementById(encodeURIComponent(senLabels[i])+vValLabel+(colYears-1)).firstChild.nodeValue);var saleVal=retVal/(curPer/100);var denom=Math.pow(1+(curPer/100),colYears-1);var saleValPv=saleVal/denom;label=curValLabel;encLabel=encodeURIComponent(label);var appVal=strToNum(document.getElementById(encLabel).value);calcVal=calcVal-appVal+saleValPv;var senVal=strToNum(document.getElementById(encodeURIComponent(senLabels[i])+"Val").firstChild.firstChild.nodeValue);var varPer=calcVal/senVal*100;var writeNode = normNode.cloneNode(true);writeNode.setAttribute("id",senLabels[i]+"Npv");writeNode.setAttribute("title","Future Sale Price is "+numToStr(saleVal)+", with a Present Value of "+numToStr(saleValPv));writeNode.style.top = topStart+"px";writeNode.style.textAlign = "right";writeNode.style.left = labelStep+colStep+"px";writeNode.style.width = colWidth+"px";var textNode = document.createTextNode(numToStr(calcVal));var bNode = document.createElement("b");bNode.appendChild(textNode);writeNode.appendChild(bNode);relNode.appendChild(writeNode);if(document.getElementById(encodeURIComponent(senLabels[i])+"NpvVar")){removeNode=document.getElementById(encodeURIComponent(senLabels[i])+"NpvVar");removeNode.parentNode.removeChild(removeNode);}var calcNode= normNode.cloneNode(true);calcNode.setAttribute("id",encodeURIComponent(senLabels[i])+"NpvVar");calcNode.style.top = topStart+"px";calcNode.style.textAlign = "left";calcNode.style.width=colWidth+colStep+"px";calcNode.style.color = lowColor;calcNode.style.fontSize = lowSize+"px";calcNode.style.fontWeight = "normal";calcNode.style.left = labelStep+(2*colStep)+"px";textNode = document.createTextNode(numToStr(varPer)+"% Variance to Valuation");calcNode.appendChild(textNode);relNode.appendChild(calcNode);}for(var y = 0;y <=colYears;y++){label=curValLabel;encLabel=encodeURIComponent(label);var curVal=strToNum(document.getElementById(encLabel).value);for(var i = 0;i < senLabels.length;i++){valCur=strToNum(document.getElementById(encodeURIComponent(senLabels[i])+vValLabel+y).firstChild.nodeValue);var retInsVal=valCur/curVal*100;document.getElementById(encodeURIComponent(senLabels[i])+vPerLabel+y).firstChild.nodeValue=numToStr(retInsVal);}}}}function breakBuild(){topStart=topBase;topStart-=topStep;var relNode = document.getElementById(modNames[2]);if(breakAct==false){var noSubNode = pNoSubNode.cloneNode(true);noSubNode.setAttribute("id","breakNoAct");relNode.appendChild(noSubNode);}if(breakAct==true||subAct==false){var breakBuildLabels=revLabels.concat(breakLabels,totVarLabels[0],totFixLabels,totLabels[1],breakCalcLabels);for(var i = 0;i < breakBuildLabels.length;i++){topStart+=topStep;if(breakBuildLabels[i]==breakCalcLabels[0]){topStart+=topStep;}var spanNode = labNode.cloneNode(true);spanNode.style.top = topStart+"px";label=breakBuildLabels[i];encLabel=encodeURIComponent(label);var textNode = document.createTextNode(label);spanNode.appendChild(textNode);relNode.appendChild(spanNode);qLabel=label.replace(/ /g,"-");questNode = helpNode.cloneNode(true);questNode.setAttribute("href",breakHelpFile+"#"+qLabel);questNode.style.top = topStart+"px";relNode.appendChild(questNode);if(breakBuildLabels[i]==totVarLabels[0]||breakBuildLabels[i]==totFixLabels[0]||breakBuildLabels[i]==totLabels[1]||breakBuildLabels[i]==breakCalcLabels[2]||breakBuildLabels[i]==breakCalcLabels[3]||breakBuildLabels[i]==breakCalcLabels[4]){var spanNode = labNode.cloneNode(true);spanNode.style.top = topStart+Math.floor(0.5*topStep)+"px";spanNode.style.color = lowColor;spanNode.style.fontSize = lowSize+"px";spanNode.style.fontWeight = "normal";var textNode = document.createTextNode("% Revenue");spanNode.appendChild(textNode);relNode.appendChild(spanNode);}}}}function breakCalc(){if(breakAct==true||subAct==false){topStart=topBase-topStep;var relNode = document.getElementById(modNames[2]);var curRev=strToNum(document.getElementById(encodeURIComponent(revLabels[0])).value);var curPri=strToNum(document.getElementById(encodeURIComponent(breakLabels[0])).value);var curSal=numToStr(curRev/curPri);document.getElementById(encodeURIComponent(breakLabels[1])).firstChild.nodeValue=curSal;curSal=strToNum(document.getElementById(encodeURIComponent(breakLabels[1])).firstChild.nodeValue);var curVar=strToNum(document.getElementById(encodeURIComponent(totVarLabels[0])).firstChild.nodeValue);var curFix=strToNum(document.getElementById(encodeURIComponent(totFixLabels[0])).firstChild.nodeValue);var curSur=strToNum(document.getElementById(encodeURIComponent(totLabels[1])).firstChild.nodeValue);var beRev=curFix/(1-(curVar/curSal/curPri));var beSal=beRev/curPri;var beVar=beSal*(curVar/curSal);var beFix=curFix;var beSur=beRev-(beVar+beFix);var curVals=new Array(curRev,curPri,curSal,curVar,curFix,curSur,beRev,beSal,beVar,beFix,beSur);for(var i = 0;i < curVals.length;i++){topStart+=topStep;if(i==6){topStart+=topStep;}if(document.getElementById("bre"+i)){removeNode=document.getElementById("bre"+i);removeNode.parentNode.removeChild(removeNode);}var writeNode = normNode.cloneNode(true);writeNode.setAttribute("id","bre"+i);writeNode.style.top = topStart+"px";writeNode.style.width = colWidth+"px";writeNode.style.left = labelStep+"px";var textNode = document.createTextNode(numToStr(curVals[i]));writeNode.appendChild(textNode);relNode.appendChild(writeNode);if(document.getElementById("breper"+i)){removeNode=document.getElementById("breper"+i);removeNode.parentNode.removeChild(removeNode);}if((i>2&&i<6)||(i>7)){if(i>7){var useRev=beRev;}else{var useRev=curRev;}var calcNode= normNode.cloneNode(true);calcNode.setAttribute("id","breper"+i);calcNode.style.top = topStart+(0.5*topStep)+"px";calcNode.style.color = lowColor;calcNode.style.fontSize = lowSize+"px";calcNode.style.fontWeight = "normal";calcNode.style.left = labelStep+"px";var perVal=numToStr(curVals[i]/useRev*100);textNode = document.createTextNode(perVal);calcNode.appendChild(textNode);relNode.appendChild(calcNode);}}if(document.getElementById("breCalc")){removeNode=document.getElementById("breCalc");removeNode.parentNode.removeChild(removeNode);}topStart+=2*topStep;var writeNode = normNode.cloneNode(true);writeNode.setAttribute("id","breCalc");writeNode.style.top = topStart+"px";writeNode.style.textAlign = "left";writeNode.style.width=maxWidth-(2*leftStart)+"px";var textNode = document.createTextNode("The current "+breakCalcLabels[0]+" is "+numToStr(beRev)+" from a "+breakCalcLabels[1]+" of "+numToStr(beSal)+".");writeNode.appendChild(textNode);relNode.appendChild(writeNode);var label=cntBreakLabels[1];var encLabel=encodeURIComponent(label)+"Bot";if(document.getElementById(encLabel)){removeNode=document.getElementById(encLabel);removeNode.parentNode.removeChild(removeNode);}topStart+=2*topStep;spanNode = linkNode.cloneNode(true);spanNode.setAttribute("id",encLabel);spanNode.onclick=evtClick;spanNode.style.top = topStart+"px";spanNode.style.textAlign = "left";spanNode.style.width="auto";textNode = document.createTextNode(label);spanNode.appendChild(textNode);textNode = document.createTextNode(" displays breakeven analysis in the Chart.");spanNode.appendChild(textNode);relNode.appendChild(spanNode);}}function priceBuild(){topStart=topBase;topStart-=topStep;var relNode = document.getElementById(modNames[3]);if(priceAct==false){var noSubNode = pNoSubNode.cloneNode(true);noSubNode.setAttribute("id","priceNoAct");relNode.appendChild(noSubNode);}if(priceAct==true||subAct==false){var priceBuildLabels=breakLabels.concat(revLabels,totVarLabels[0],totFixLabels,totLabels[1]);for(var i = 0;i < priceBuildLabels.length;i++){topStart+=topStep;var spanNode = labNode.cloneNode(true);spanNode.style.top = topStart+"px";label="Optimum "+priceBuildLabels[i];encLabel=encodeURIComponent(label);var textNode = document.createTextNode(label);spanNode.appendChild(textNode);relNode.appendChild(spanNode);qLabel=label.replace(/ /g,"-");questNode = helpNode.cloneNode(true);questNode.setAttribute("href",priceHelpFile+"#"+qLabel);questNode.style.top = topStart+"px";relNode.appendChild(questNode);if(i>2){var spanNode = labNode.cloneNode(true);spanNode.style.top = topStart+Math.floor(0.5*topStep)+"px";spanNode.style.color = lowColor;spanNode.style.fontSize = lowSize+"px";spanNode.style.fontWeight = "normal";var textNode = document.createTextNode("% Revenue");spanNode.appendChild(textNode);relNode.appendChild(spanNode);}}}}function priceCalc(){if(priceAct==true||subAct==false){topStart=topBase-topStep;plotPrice("calc");var relNode = document.getElementById(modNames[3]);var optVals=new Array(optPrice,optSales,optRev,optVar,optFix,optSur);for(var i = 0;i < optVals.length;i++){topStart+=topStep;if(i==6){topStart+=topStep;}if(document.getElementById("opt"+i)){removeNode=document.getElementById("opt"+i);removeNode.parentNode.removeChild(removeNode);}var writeNode = normNode.cloneNode(true);writeNode.setAttribute("id","opt"+i);writeNode.style.top = topStart+"px";writeNode.style.width = colWidth+"px";writeNode.style.left = labelStep+"px";var textNode = document.createTextNode(numToStr(optVals[i]));writeNode.appendChild(textNode);relNode.appendChild(writeNode);if(document.getElementById("priper"+i)){removeNode=document.getElementById("priper"+i);removeNode.parentNode.removeChild(removeNode);}if(i>2){var calcNode= normNode.cloneNode(true);calcNode.setAttribute("id","priper"+i);calcNode.style.top = topStart+(0.5*topStep)+"px";calcNode.style.color = lowColor;calcNode.style.fontSize = lowSize+"px";calcNode.style.fontWeight = "normal";calcNode.style.left = labelStep+"px";var perVal=numToStr(optVals[i]/optRev*100);textNode = document.createTextNode(perVal);calcNode.appendChild(textNode);relNode.appendChild(calcNode);}}if(document.getElementById("priCalc")){removeNode=document.getElementById("priCalc");removeNode.parentNode.removeChild(removeNode);}var curSur=strToNum(document.getElementById(encodeURIComponent(totLabels[1])).firstChild.nodeValue);var surDif=optSur-curSur;var surPer=numToStr(surDif/curSur);topStart+=2*topStep;var writeNode = normNode.cloneNode(true);writeNode.setAttribute("id","priCalc");writeNode.style.top = topStart+"px";writeNode.style.textAlign = "left";writeNode.style.width=maxWidth-(2*leftStart)+"px";var textNode = document.createTextNode("The optimun "+breakLabels[0]+" of "+numToStr(optPrice)+" results in a optimum "+totLabels[1]+" of "+numToStr(optSur)+".");writeNode.appendChild(textNode);relNode.appendChild(writeNode);if(document.getElementById("optCalc")){removeNode=document.getElementById("optCalc");removeNode.parentNode.removeChild(removeNode);}topStart+=2*topStep;var writeNode = normNode.cloneNode(true);writeNode.setAttribute("id","optCalc");writeNode.style.top = topStart+"px";writeNode.style.textAlign = "left";writeNode.style.width=maxWidth-(2*leftStart)+"px";var textNode = document.createTextNode("The optimum "+totLabels[1]+" of "+numToStr(optSur)+" is "+numToStr(surDif)+" or "+ numToStr(surPer*100) + "% greater than the current "+totLabels[1]+" of "+numToStr(curSur)+".");writeNode.appendChild(textNode);relNode.appendChild(writeNode);if(document.getElementById("optAdj")){removeNode=document.getElementById("optAdj");removeNode.parentNode.removeChild(removeNode);}topStart+=2*topStep;var writeNode = normNode.cloneNode(true);writeNode.setAttribute("id","optAdj");writeNode.style.top = topStart+"px";writeNode.style.textAlign = "left";writeNode.style.width=maxWidth-(2*leftStart)+"px";writeNode.style.fontWeight = "bold";writeNode.style.color = resColor;var textNode = document.createTextNode("Consider adjusting your "+breakLabels[0]+" to "+numToStr(optPrice)+" for a "+totLabels[1]+" increase of "+numToStr(surDif)+"." );writeNode.appendChild(textNode);relNode.appendChild(writeNode);var label=cntPriceLabels[1];var encLabel=encodeURIComponent(label)+"Bot";if(document.getElementById(encLabel)){removeNode=document.getElementById(encLabel);removeNode.parentNode.removeChild(removeNode);}topStart+=2*topStep;spanNode = linkNode.cloneNode(true);spanNode.setAttribute("id",encLabel);spanNode.onclick=evtClick;spanNode.style.top = topStart+"px";spanNode.style.textAlign = "left";spanNode.style.width="auto";textNode = document.createTextNode(label);spanNode.appendChild(textNode);textNode = document.createTextNode(" displays price analysis in the Chart.");spanNode.appendChild(textNode);relNode.appendChild(spanNode);}}function compress(){if(document.getElementById(encodeURIComponent('Compress0'))){var relNode = document.getElementById(inputNames[0]);var label=selNameLabel;encLabel=encodeURIComponent(label);var firstHideRow=document.getElementById(encLabel).style.top;label=headIndLabels[0];encLabel=encodeURIComponent(label);var firstShowRow=document.getElementById(encLabel).style.top;var topAdj=parseInt(firstShowRow)-parseInt(firstHideRow);for(var i = 2;i < relNode.childNodes.length;i++){var curRow=relNode.childNodes[i].style.top;if(parseInt(curRow)>=parseInt(firstHideRow)&&parseInt(curRow)<parseInt(firstShowRow)){relNode.childNodes[i].style.visibility="hidden";}else if(parseInt(curRow)>0){var useAdj = parseInt(curRow)-topAdj;relNode.childNodes[i].style.top=useAdj+"px";}}document.getElementById(encodeURIComponent('Compress0')).firstChild.nodeValue="Expand";document.getElementById(encodeURIComponent('Compress0')).id="Expand0";}}function expand(){if(document.getElementById(encodeURIComponent('Expand0'))){var relNode = document.getElementById(inputNames[0]);var label=selNameLabel;encLabel=encodeURIComponent(label);var firstHideRow=document.getElementById(encLabel).style.top;var lastHideRow=0;var topAdj=0;for(var i = 2;i < relNode.childNodes.length;i++){var curRow=relNode.childNodes[i].style.top;if(parseInt(curRow)>0){if(relNode.childNodes[i].style.visibility=="hidden"){relNode.childNodes[i].style.visibility="visible";if(parseInt(curRow)>lastHideRow){lastHideRow=parseInt(curRow);topAdj=lastHideRow-parseInt(firstHideRow)+2*topStep;}}else{var useAdj = parseInt(curRow)+topAdj;relNode.childNodes[i].style.top=useAdj+"px";}}}document.getElementById(encodeURIComponent('Expand0')).firstChild.nodeValue="Compress";document.getElementById(encodeURIComponent('Expand0')).id="Compress0";}}function cntBuild(m){cntNode=document.getElementById("cnt"+buildNames[m]);var useFile=inputHelpFile;if(m==0){useArray=cntInputLabels;useFile=inputHelpFile;}else if(m==1){useArray=cntForecastLabels;useFile=forecastHelpFile;}else if(m==2){useArray=cntValuationLabels;useFile=valuationHelpFile;}else if(m==3){useArray=cntBreakLabels;useFile=breakHelpFile;}else if(m==4){useArray=cntPriceLabels;useFile=priceHelpFile;}else if(m==5){useArray=cntChartLabels;useFile=chartHelpFile;}var leftCount=0;for(var i = 0;i < useArray.length;i++){label=useArray[i];encLabel=encodeURIComponent(label);spanNode = linkNode.cloneNode(true);if(label==cntInputLabels[0]){spanNode.setAttribute("id",encLabel+m);}else{spanNode.setAttribute("id",encLabel);}spanNode.onclick=evtClick;spanNode.style.position = "relative";spanNode.style.top = -(topStep*.75)+"px";spanNode.style.width = "auto";spanNode.style.left = leftCount*helpLeft+"px";spanNode.style.float = "left";textNode = document.createTextNode(label);spanNode.appendChild(textNode);cntNode.appendChild(spanNode);leftCount++;qLabel=label.replace(/ /g,"-");questNode = helpNode.cloneNode(true);questNode.setAttribute("href",useFile+"#"+qLabel);questNode.style.position = "relative";questNode.style.top = -(topStep*.75)+"px";questNode.style.left = leftCount*helpLeft+"px";questNode.style.float = "left";cntNode.appendChild(questNode);leftCount=leftCount+2;}}function inSelect(){this.select();}function evtClick(){if(this.id==idInputLabels[0]||this.id==idInputLabels[2]||this.id==idInputLabels[4]||this.id==encodeURIComponent(setLabels[0])||this.id==encodeURIComponent(setLabels[2])){setLabel=this.id;setBuild();}else if(this.id==encodeURIComponent(idInputLabels[0]+" Confirm")||this.id==encodeURIComponent(idInputLabels[2]+" Confirm")||this.id==encodeURIComponent(setLabels[0]+" Confirm")||this.id==encodeURIComponent(setLabels[2]+" Confirm")||this.id==encodeURIComponent(enterSubEmailLabel+" Confirm")||this.id==encodeURIComponent(enterSubCodeLabel+" Confirm")||this.id==encodeURIComponent(enterDbEmailLabel+" Confirm")){setConfirm();}else if(this.id==encodeURIComponent(idInputLabels[4]+" Confirm")){xmlImport();}else if(this.id==idInputLabels[1]){if(inputType!=inputType1){inputTypeChange(inputType1);}expand();inputIndFullReset();cookName='';selName();if(cookName){cookRead();cookSetLoad();inputIndBuild();inputRetBuild();inputBreakBuild();inputPriceBuild();if(cookVal!=''){cookInputLoad();inputMesNode.nodeValue="Status: "+idInputLabels[1]+" "+selNameSel+" Complete.";}}else if(selNameSel==selExampleLabel){formatDecimals=2;forecastYears=3;inputIndBuild();inputRetBuild();inputBreakBuild();inputPriceBuild();inputDefLoad();inputMesNode.nodeValue="Status: "+idInputLabels[1]+" "+selNameSel+" Complete.";}else{inputMesNode.nodeValue="Error: "+idInputLabels[1]+" "+selNameSel+" Fail.";}expCalc();forecastCalc();valuationCalc();breakCalc();priceCalc();}else if(this.id==idInputLabels[3]){xmlExport();}else if(this.id==inputType1&&inputType!=inputType1){inputTypeChange(this.id);}else if(this.id==inputType2&&inputType!=inputType2){inputTypeChange(this.id);}else if(this.id=="Details"){cookDetails();}else if(this.id=="Show"){cookName=cookVar;cookShow();}else if(this.id==encodeURIComponent('Delete All')){cookDelAll();}else if(this.id==encodeURIComponent('Compress0')){compress();}else if(this.id==encodeURIComponent('Expand0')){expand();}else if(this.id==encodeURIComponent('Compress1')){forecastCompress();}else if(this.id==encodeURIComponent('Expand1')){forecastExpand();}else if(this.id==encodeURIComponent(resetLabel+' '+curValLabel)){curValCk=false;valuationCalc();}else if(this.id==encodeURIComponent(resetLabel+' '+curIrrLabel)){curIrrCk=false;valuationCalc();}else if(this.id==encodeURIComponent(zeroNpvLabel)){var expNpv=strToNum(document.getElementById(encodeURIComponent(senLabels[1])+"Npv").firstChild.firstChild.nodeValue);label=curValLabel;encLabel=encodeURIComponent(label);var calcVal=strToNum(document.getElementById(encLabel).value);calcVal=calcVal+expNpv;document.getElementById(encLabel).value=numToStr(calcVal);curValCk=true;valuationCalc();}else if(this.id==senDisLabId){var senCur=document.getElementById(senDisLabId).firstChild.nodeValue;if(senCur==senLabels[1]){document.getElementById(senDisLabId).firstChild.nodeValue=senLabels[0];senVal=document.getElementById(encodeURIComponent(senPerLabels[0])).value;document.getElementById(senDisValId).firstChild.nodeValue="+"+senVal+"%";}else if(senCur==senLabels[0]){document.getElementById(senDisLabId).firstChild.nodeValue=senLabels[2];senVal=-document.getElementById(encodeURIComponent(senPerLabels[0])).value;document.getElementById(senDisValId).firstChild.nodeValue=senVal+"%";}else if(senCur==senLabels[2]){document.getElementById(senDisLabId).firstChild.nodeValue=senLabels[1];senVal=0;document.getElementById(senDisValId).firstChild.nodeValue="";}forecastCalc();}else if(this.id==cntChartLabels[0]){plotReset();}else if(this.id==cntInputLabels[2]){window.print();}else if(this.id==encodeURIComponent(cntBreakLabels[1])||this.id==encodeURIComponent(cntBreakLabels[1])+"Bot"){plotBreak();}else if(this.id==encodeURIComponent(cntPriceLabels[1])||this.id==encodeURIComponent(cntPriceLabels[1])+"Bot"){plotPrice();}clearMes();}function evtChange(){if(subAct==true){if(this.id==encodeURIComponent(curValLabel)){curValCk=true;}else if(this.id==encodeURIComponent(curIrrLabel)){curIrrCk=true;}else if(this.id==encodeURIComponent(breakLabels[0])){var curSal=strToNum(document.getElementById(encodeURIComponent(revLabels[0])).value)/strToNum(this.value);var curSal=numToStr(curSal);document.getElementById(encodeURIComponent(breakLabels[1])).firstChild.nodeValue=curSal;}else if(this.id==encodeURIComponent(revLabels[0])){document.getElementById(encodeURIComponent(breakLabels[1])).firstChild.nodeValue=numToStr(strToNum(this.value)/strToNum(document.getElementById(encodeURIComponent(breakLabels[0])).value));}var inVal=strToNum(this.value);this.value=numToStr(inVal);expCalc();forecastCalc();valuationCalc();breakCalc();}else{inputDefLoad();inputMesNode.nodeValue="Error: Only Example Inputs can be used without a valid Subscription. A free trial is provided when you subscribe. Click Subscription from the top Control Menu to Subscribe.";alert("Error: Only Example Inputs can be used without a valid Subscription. A free trial is provided when you subscribe. Click Subscription from the top Control Menu to Subscribe.");clearMes();}}function evtMouseOver(){this.style.color = contBackColor;this.style.backgroundColor=contColor;}function inputTypeChange(inputTypeTo){inputType=inputTypeTo;inputCalcBuild("varExpLabels");inputCalcTotBuild(totVarLabels[0]);inputCalcBuild("fixExpLabels");inputCalcTotBuild(totFixLabels[0]);inputCalcTotBuild(totLabels[0]);inputCalcTotBuild(totLabels[1]);}function evtMouseOut(){this.style.color = contColor;this.style.backgroundColor=contBackColor;}function expCalc(){var label=revLabels[0];revVal=strToNum(document.getElementById(encodeURIComponent(label)).value);if(inputType==inputType2){inputSurplus=100;calcSurplus=revVal;}else{inputSurplus=revVal;calcSurplus=100;}inputTotal=0;calcTotal=0;useArray=varExpLabels;sumExp();var inputTotVarExp=inputTotal;var calcTotVarExp=calcTotal;label=totVarLabels[0];document.getElementById(encodeURIComponent(label)).firstChild.nodeValue=numToStr(inputTotal);document.getElementById(encodeURIComponent(label)+"Calc").firstChild.nodeValue=numToStr(calcTotal);inputTotal=0;calcTotal=0;useArray=fixExpLabels;sumExp();var inputTotFixExp=inputTotal;var calcTotFixExp=calcTotal;label=totFixLabels[0];document.getElementById(encodeURIComponent(label)).firstChild.nodeValue=numToStr(inputTotal);document.getElementById(encodeURIComponent(label)+"Calc").firstChild.nodeValue=numToStr(calcTotal);label=totLabels[0];var inputTotExp=inputTotVarExp+inputTotFixExp;var calcTotExp=calcTotVarExp+calcTotFixExp;document.getElementById(encodeURIComponent(label)).firstChild.nodeValue=numToStr(inputTotExp);document.getElementById(encodeURIComponent(label)+"Calc").firstChild.nodeValue=numToStr(calcTotExp);label=totLabels[1];inputSurplus-=inputTotExp;calcSurplus-=calcTotExp;document.getElementById(encodeURIComponent(label)).firstChild.nodeValue=numToStr(inputSurplus);document.getElementById(encodeURIComponent(label)+"Calc").firstChild.nodeValue=numToStr(calcSurplus);}function sumExp(){for(var i = 0;i < useArray.length;i++){var inputVal=strToNum(document.getElementById(encodeURIComponent(useArray[i])).value);if(isNaN(inputVal)===false){if(inputType==inputType2){var calcVal=inputVal/100*revVal;}else{var calcVal=inputVal/revVal*100;}document.getElementById(encodeURIComponent(useArray[i])+"Calc").firstChild.nodeValue=numToStr(calcVal);inputTotal+=inputVal;calcTotal+=calcVal;}}}function formatInput(){useArray=revLabels;useArray=useArray.concat(assetLabels,valLabels,breakLabels[0],priceLabels);for(var i = 0;i < useArray.length;i++){document.getElementById(encodeURIComponent(useArray[i])).value=numToStr(document.getElementById(encodeURIComponent(useArray[i])).value);}document.getElementById(encodeURIComponent(breakLabels[1])).firstChild.nodeValue=numToStr(document.getElementById(encodeURIComponent(breakLabels[1])).firstChild.nodeValue);useArray=varExpLabels;useArray=useArray.concat(fixExpLabels);for(var i = 0;i < useArray.length;i++){document.getElementById(encodeURIComponent(useArray[i])).value=numToStr(document.getElementById(encodeURIComponent(useArray[i])).value);document.getElementById(encodeURIComponent(useArray[i])+"Calc").firstChild.nodeValue=numToStr(document.getElementById(encodeURIComponent(useArray[i])+"Calc").firstChild.nodeValue);}useArray=totLabels;useArray=useArray.concat(totVarLabels[0],totFixLabels);for(var i = 0;i < useArray.length;i++){document.getElementById(encodeURIComponent(useArray[i])).firstChild.nodeValue=numToStr(document.getElementById(encodeURIComponent(useArray[i])).firstChild.nodeValue);document.getElementById(encodeURIComponent(useArray[i])+"Calc").firstChild.nodeValue=numToStr(document.getElementById(encodeURIComponent(useArray[i])+"Calc").firstChild.nodeValue);}for(var i = 0;i < indLabels.length;i++){for(var y = 1;y <= forecastYears;y++){document.getElementById(encodeURIComponent(indLabels[i])+y).value=numToStr(document.getElementById(encodeURIComponent(indLabels[i])+y).value);}}document.getElementById(encodeURIComponent(senPerLabels[0])).value=numToStr(document.getElementById(encodeURIComponent(senPerLabels[0])).value);for(var y = 1;y <= forecastYears;y++){document.getElementById(encodeURIComponent(senLabels[1]+" "+retLabels[0])+y).firstChild.nodeValue=numToStr(document.getElementById(encodeURIComponent(senLabels[1]+" "+retLabels[0])+y).firstChild.nodeValue);}if(document.getElementById(encodeURIComponent(senLabels[1])+"ValIn")){document.getElementById(encodeURIComponent(senLabels[1])+"ValIn").firstChild.firstChild.nodeValue=numToStr(document.getElementById(encodeURIComponent(senLabels[1])+"ValIn").firstChild.firstChild.nodeValue);}}function numToStr(pasCh){if(isNaN(pasCh)){pasCh=pasCh+'';pasCh=pasCh.replace(/ /g,"");}if(!isNaN(pasCh)){retCh=parseFloat(pasCh);retCh=retCh.toFixed(formatDecimals);retCh+='';chBits = retCh.split('.');ch1 = chBits[0];ch2 = chBits.length > 1 ? '.' + chBits[1] : '';var re = /(\d+)(\d{3})/;while (re.test(ch1)){ch1 = ch1.replace(re, '$1' +numSep+ '$2');}return ch1+ch2;}else{return pasCh;}}function strToNum(pasCh){retCh=''+pasCh;retCh=retCh.replace(/ /g,"");retCh=parseFloat(retCh);if(!isNaN(retCh)){return retCh;}else{return pasCh;}}function section(sectionId){if(this.id){sectionId=this.id.substring(1);}var ancNodeId=ancMk+sectionId;var allDivNode=document.getElementsByTagName("div");for(var divNum=0;divNum< allDivNode.length;divNum++){if(allDivNode[divNum].className){var divClass = allDivNode[divNum].className;}if(divClass=="section"){if(allDivNode[divNum].id){divId = allDivNode[divNum].id;if(divId==sectionId){allDivNode[divNum].style.display="block";if(sectionId==modNames[0]&&(forecastAct==true||subAct==false)){forecastCalc();}else if(sectionId==modNames[1]&&(valuationAct==true||subAct==false)){valuationCalc();}else if(sectionId==modNames[2]&&(breakAct==true||subAct==false)){breakCalc();}else if(sectionId==modNames[3]&&(priceAct==true||subAct==false)){priceCalc();}else if(sectionId==sectNames[0]&&document.getElementById(sectNames[0]).childNodes.length==1){var plotSectNode = document.getElementById(sectNames[0]);plotAreaNode = document.createElement('div');plotAreaNode.setAttribute('id',plotAreaLabel);plotAreaNode.className=plotAreaLabel;var divNode = divCentNode.cloneNode(true);var textNode = document.createTextNode("From the "+modNames[0]+" or "+modNames[1]+" modules mouseover and click the required label to plot the associated data set. Repeat to add multiple data sets. Or from the "+modNames[2]+" or "+modNames[3]+" modules click the Plot control at the top of the module.");divNode.appendChild(textNode);plotAreaNode.appendChild(divNode);plotSectNode.appendChild(plotAreaNode);}if(document.getElementById(ancMk+divId)){if(document.getElementById(ancMk+divId).className=="menutopact"){document.getElementById(ancMk+divId).className="menutopactsel";}else if(document.getElementById(ancMk+divId).className=="menutop"){document.getElementById(ancMk+divId).className="menutopsel";}}}else{allDivNode[divNum].style.display="none";if(document.getElementById(ancMk+divId)){if(document.getElementById(ancMk+divId).className=="menutopactsel"){document.getElementById(ancMk+divId).className="menutopact";}else if(document.getElementById(ancMk+divId).className=="menutopsel"){document.getElementById(ancMk+divId).className="menutop";}}}}}}}function c(useVal){var chUse = "";var codeUse = 0;var chAll = "";for (var i=0;i < useVal.length;i++){chUse = useVal.charAt(i).charCodeAt(0);chEnDe = chUse^encdec.charCodeAt(codeUse);codeUse =(codeUse+1)%encdec.length;chAll = chAll.concat(String.fromCharCode(chEnDe));}return(chAll);}function d(deVal){var  deVal=decodeURIComponent(deVal);var allDe = c(deVal);allDe = decodeURIComponent(allDe);return(allDe);}function e(enVal){var enVal = encodeURIComponent(enVal);var allEn = c(enVal);allEn = encodeURIComponent(allEn);return (allEn);}function subCk(mk){var subId='';var n='';var v='';var urlq = window.location.search;if(urlq){urlq=urlq.substr(1);var pairs=urlq.split("&");for (var p=0;p < pairs.length;p++){nvs=pairs[p].split("=");for (var i=0;i < nvs.length;i=i+2){if(nvs[i]=="e"){subEmail=decodeURI(nvs[i+1]);}else if(nvs[i]=="i"){subId=decodeURI(nvs[i+1]);}}}}if(subId){n='i';v=subId;}else if(subEmail){n='e';v=subEmail;}else if(mk=='manual'){setBuild('EnterDb');}if(n&&v){var postString=n+"="+v;if (window.XMLHttpRequest){http_request=new XMLHttpRequest();}else if (window.ActiveXObject){http_request=new ActiveXObject("Microsoft.XMLHTTP");}if(http_request){try{http_request.onreadystatechange = processReqChange;http_request.open('POST',d(subDbUrl), true);http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");http_request.setRequestHeader("Content-length", postString.length);http_request.setRequestHeader("Connection", "close");http_request.send(postString);}catch(err){if(subMesNode){subMesNode.nodeValue="Status: Unable to access database.";}section(sectNames[1]);clearMes();}}}}function processReqChange(){if (http_request.readyState == 4){if (http_request.status == 200){var res=http_request.responseText;if(res.search("&")>-1){var ecs=res.split("&");subEmail=ecs[0];subEmail=subEmail.replace(/^\s+|\s+$/g, '');subCode=ecs[1];subCode=subCode.replace(/^\s+|\s+$/g, '');subVerify('ck');}else{if(subMesNode){subMesNode.nodeValue="Status: "+res;}}section(sectNames[1]);clearMes();}}}function subVerify(callid){var encEmail=e(subEmail);var encSubCode=e(subCode);var encEmailNum=encEmail.replace(/[^1-9]+/g,'');encEmailNum=encEmailNum.substr(0,6);var encEmailNum1=encEmailNum.substr(0,3);var encEmailNum2=encEmailNum.substr(3,3);var codes=subCode.split("-");var modCk1=codes[0]%encEmailNum1;var modCk2=codes[1]%encEmailNum2;if(modCk1==0 && modCk2==0 && subCode && subEmail){var subBase1=codes[0]/encEmailNum1;var subBase2=codes[1]/encEmailNum2;subBase1=""+subBase1;subBase2=""+subBase2;var expDayFir=subBase1.substring(0,2);var modDec=subBase1.substring(2);var expDayLasLen=subBase2.length-3;var expDayLas=subBase2.substring(0,expDayLasLen);if(expDayLas.length==1){expDayLas="00"+expDayLas;}else if (expDayLas.length==2){expDayLas="0"+expDayLas;}subNum=subBase2.substring(3);subNum=parseInt(subNum);subDay=""+expDayFir+expDayLas;var curTime=new Date();var curMs=curTime.getTime();var curDay=parseInt(curMs/86400/1000);subExp = new Date();subExp.setTime(subDay*86400*1000);subExp. toUTCString();if(curDay<=subDay){subAct=true;subModName='';var sepMk='';for(var i = modNames.length;i >0;i--){var modInd=Math.pow(2,i-1);if(modDec-modInd>=0){if(subModName!=''){sepMk=",";}subModName=modNames[i-1]+sepMk+subModName;var ancNodeId=ancMk+modNames[i-1];modDec=modDec-modInd;if(document.getElementById(ancNodeId)){if(i==1){forecastAct=true;if(document.getElementById("forecastNoAct")){var removeNode=document.getElementById("forecastNoAct");removeNode.parentNode.removeChild(removeNode);}}else if(i==2){valuationAct=true;if(document.getElementById("valuationNoAct")!=null){var removeNode=document.getElementById("valuationNoAct");removeNode.parentNode.removeChild(removeNode);}}else if(i==3){breakAct=true;if(document.getElementById("breakNoAct")!=null){var removeNode=document.getElementById("breakNoAct");removeNode.parentNode.removeChild(removeNode);}}else if(i==4){priceAct=true;if(document.getElementById("priceNoAct")!=null){var removeNode=document.getElementById("priceNoAct");removeNode.parentNode.removeChild(removeNode);}}document.getElementById(ancNodeId).className='menutopact';}}}}else{callid='exp';}if(callid=='ck'){cookVal=encEmail+":"+encSubCode;cookName=cookSub;cookSave();subMesNode.nodeValue="Status: Subscription Details refreshed.";subDis();}else if(callid=='exp'){cookVal=encEmail+':'+enaval;cookName=cookSub;cookSave();subMesNode.nodeValue="Status: Subscription Details have expired. Please renew your subscription.";alert('Subscription Details have expired. Please renew your subscription. To manually input your subscription details input the Subscription Email Address, and the Subscription Code exactly as confirmed in the Subscription details email. Subscription details are emailed when you Subscribe from the Subscribe page at BusinessPerformanceAnalysis.com.');}else if(callid!='init'){cookVal=encEmail+":"+encSubCode;cookName=cookSub;cookSave();if(document.cookie.indexOf(encodeURIComponent(cookName)) <= -1){document.getElementById("menu").style.display="block";alert('Subscription details cannot be saved locally. Subscription details are saved locally as encoded Cookies and Cookies should be enabled. Subscription details will also be sourced from the online database if possible (internet connection required). If you would prefer to use this software without enabling Cookies and no internet connection is available please manually input your Subscription details for each session.');subMesNode.nodeValue="Warning: Subscription details cannot be saved locally.";subDis();}else{alert("Thank you for supporting the ongoing development of this service. Your subscription details have been verified.");subMesNode.nodeValue="Status: Subscription Details verified.";window.location.reload();}}}else{cookVal=enaval+':'+enaval;cookName=cookSub;cookSave();if(subMesNode){subMesNode.nodeValue="Error: Subscription details are not valid.";}alert('Subscription details are not valid. Please ensure that you have a current subscription. To manually input your subscription details input the Subscription Email Address, and the Subscription Code exactly as confirmed in the Subscription details email. Subscription details are emailed when you Subscribe from the Subscribe page at BusinessPerformanceAnalysis.com.');}clearMes();}function subClear(){cookName=cookSub;cookVal=enaval+':'+enaval;cookSave();subMesNode.nodeValue="Subscription Details Cleared.";subEmail="";subCode="";window.location.reload();}function subDis(){divpos=75;xdes=395;divTextCol="#000000";divBgCol="#ffffff";divHighCol="#000066";regNode=document.getElementById(sectNames[sectNames.length-1]);regNodeLen=regNode.childNodes.length;for(var childNum=1;childNum<regNodeLen;childNum++){regNode.removeChild(regNode.lastChild);}divCentNode.style.top = divpos+"px";divCentNode.style.color = divTextCol;divCentNode.style.backgroundColor = divBgCol;divLeftNode = divCentNode.cloneNode(true);divLeftNode.style.width = xdes+"px";divLeftNode.style.textAlign = "right";divLeftNode.style.fontSize = "16px";newTextNode = document.createTextNode('-');divLeftNode.appendChild(newTextNode);divRightNode = divLeftNode.cloneNode(true);divRightNode.style.left = xdes+10+"px";divRightNode.style.textAlign = "left";divRightNode.style.fontWeight = "bold";newDivNode = divCentNode.cloneNode(true);newDivNode.style.fontSize = "16px";newDivNode.style.fontWeight = "bold";newDivNode.style.color = divHighCol;newDivNode.style.top = divpos+"px";newTextNode = document.createTextNode(d(softwaretitle));newDivNode.appendChild(newTextNode);regNode.appendChild(newDivNode);divpos=divpos+20;newDivNode = divCentNode.cloneNode(true);newDivNode.style.top = divpos+"px";newTextNode = document.createTextNode("from ");newDivNode.appendChild(newTextNode);newANode = document.createElement("a");venurl = "http://www."+d(vendordomain)+"/";newANode.setAttribute("href",venurl);newANode.setAttribute("target","BusinessPerformanceAnalysis");newTextNode = document.createTextNode(d(vendorname));newANode.appendChild(newTextNode);newDivNode.appendChild(newANode);regNode.appendChild(newDivNode);divpos=divpos+30;divCentNode.style.fontSize = "10px";newDivNode = divCentNode.cloneNode(true);newDivNode.style.top = divpos+"px";newTextNode = document.createTextNode("Controls are at the top, start at Input, click Help or a ? for instructions. Subscription returns to this section.");newDivNode.appendChild(newTextNode);regNode.appendChild(newDivNode);var cookVals=cookVal.split(":");if(cookVals.length==2&&cookVals[0]!=enaval&&cookVals[1]!=enaval){divpos=divpos+30;newNode = divLeftNode.cloneNode(true);newNode.style.top = divpos+"px";newNode.firstChild.nodeValue = 'Subscription Email:';regNode.appendChild(newNode);useCookVal=d(cookVals[0]);newNode = divRightNode.cloneNode(true);newNode.style.top = divpos+"px";newNode.firstChild.nodeValue = useCookVal;regNode.appendChild(newNode);divpos=divpos+30;newNode = divLeftNode.cloneNode(true);newNode.style.top = divpos+"px";newNode.firstChild.nodeValue = 'Subscription Modules:';regNode.appendChild(newNode);var modNames = subModName.split(",");for (var modName=0;modName < modNames.length;modName++){useModName=modNames[modName];newNode = divRightNode.cloneNode(true);newNode.style.top = divpos+"px";newNode.firstChild.nodeValue = useModName;regNode.appendChild(newNode);divpos = divpos+25;}divpos=divpos+15;newNode = divLeftNode.cloneNode(true);newNode.style.top = divpos+"px";newNode.style.fontSize = "12px";newNode.firstChild.nodeValue = 'Subscription Code Expires:';regNode.appendChild(newNode);newNode = divRightNode.cloneNode(true);newNode.style.top = divpos+"px";newNode.style.fontSize = "12px";newNode.firstChild.nodeValue = subExp;regNode.appendChild(newNode);divpos = divpos+45;newNode = divLeftNode.cloneNode(true);newNode.style.top = divpos+"px";newNode.style.fontSize = "12px";newNode.firstChild.nodeValue = 'Number of Subscribers:';regNode.appendChild(newNode);newNode = divRightNode.cloneNode(true);newNode.style.top = divpos+"px";newNode.style.fontSize = "12px";newNode.firstChild.nodeValue = subNum;regNode.appendChild(newNode);divpos = divpos+30;divpos=divpos+10;divLeftNode.style.fontSize = "12px";newNode = divLeftNode.cloneNode(true);newNode.style.top = divpos+"px";newNode.firstChild.nodeValue = "Support:";regNode.appendChild(newNode);divRightNode.style.fontSize = "12px";newNode = divRightNode.cloneNode(false);newNode.style.top = divpos+"px";newANode = document.createElement("a");newANode.setAttribute("href",venurl);newANode.setAttribute("target","BusinessPerformanceAnalysis");newTextNode = document.createTextNode(venurl);newANode.appendChild(newTextNode);newNode.appendChild(newANode);regNode.appendChild(newNode);divpos=divpos+20;newNode = divLeftNode.cloneNode(true);newNode.style.top = divpos+"px";newNode.firstChild.nodeValue = "Version:";regNode.appendChild(newNode);newNode = divRightNode.cloneNode(true);newNode.style.top = divpos+"px";newNode.firstChild.nodeValue = softwareversion;regNode.appendChild(newNode);divpos=divpos+20;newNode = divLeftNode.cloneNode(true);newNode.style.top = divpos+"px";newNode.firstChild.nodeValue = "Build:";regNode.appendChild(newNode);newNode = divRightNode.cloneNode(true);newNode.style.top = divpos+"px";newNode.firstChild.nodeValue = softwarebuild;regNode.appendChild(newNode);divpos=divpos+30;newDivNode = divCentNode.cloneNode(true);newDivNode.style.top = divpos+"px";newTextNode = document.createTextNode("If required");newDivNode.appendChild(newTextNode);regNode.appendChild(newDivNode);divpos=divpos+20;newDivNode = divCentNode.cloneNode(true);newDivNode.style.top = divpos+"px";newANode = document.createElement("a");newANode.setAttribute("href","javascript:subCk('manual')");newTextNode = document.createTextNode("Refresh Subscription Details from online Database");newANode.appendChild(newTextNode);newDivNode.appendChild(newANode);newTextNode = document.createTextNode(" or ");newDivNode.appendChild(newTextNode);newANode = document.createElement("a");newANode.setAttribute("href","javascript:setBuild('EnterSub')");newTextNode = document.createTextNode("Manually Enter Subscription Details");newANode.appendChild(newTextNode);newDivNode.appendChild(newANode);regNode.appendChild(newDivNode);}else{divCentNode.style.fontSize = "12px";divCentNode.style.position = "absolute";divpos=divpos+30;newDivNode = divCentNode.cloneNode(true);newDivNode.style.top = divpos+"px";newDivNode.style.fontWeight = "bold";newTextNode = document.createTextNode("You can review the Analysis Modules using an Example Business data set right now, click Input to start.");newDivNode.appendChild(newTextNode);regNode.appendChild(newDivNode);divpos=divpos+20;newDivNode = divCentNode.cloneNode(true);newDivNode.style.top = divpos+"px";newDivNode.style.fontWeight = "bold";newTextNode = document.createTextNode("A free fully activated trial period allowing you to input and analyze your business is available when you Subscribe.");newDivNode.appendChild(newTextNode);regNode.appendChild(newDivNode);divpos=divpos+20;newDivNode = divCentNode.cloneNode(true);newDivNode.style.top = divpos+"px";newANode = document.createElement("a");newANode.setAttribute("href",d(suburl));newANode.setAttribute("target","BusinessPerformanceAnalysis");newTextNode = document.createTextNode("Click here to Subscribe");newANode.appendChild(newTextNode);newDivNode.appendChild(newANode);regNode.appendChild(newDivNode);divpos=divpos+20;newDivNode = divCentNode.cloneNode(true);newDivNode.style.top = divpos+"px";newTextNode = document.createTextNode(" and then if required ");newDivNode.appendChild(newTextNode);regNode.appendChild(newDivNode);divpos=divpos+20;newDivNode = divCentNode.cloneNode(true);newDivNode.style.top = divpos+"px";newANode = document.createElement("a");newANode.setAttribute("href","javascript:subCk('manual')");newTextNode = document.createTextNode("Refresh Subscription Details from online Database");newANode.appendChild(newTextNode);newDivNode.appendChild(newANode);newTextNode = document.createTextNode(" or ");newDivNode.appendChild(newTextNode);newANode = document.createElement("a");newANode.setAttribute("href","javascript:setBuild('EnterSub')");newTextNode = document.createTextNode("Manually Enter Subscription Details");newANode.appendChild(newTextNode);newDivNode.appendChild(newANode);regNode.appendChild(newDivNode);divCentNode.style.fontSize = "12px";divpos=divpos+40;newDivNode = divCentNode.cloneNode(true);newDivNode.style.top = divpos+"px";newTextNode = document.createTextNode("When you Subscribe you are provided with Subscription Details.");newDivNode.appendChild(newTextNode);regNode.appendChild(newDivNode);divpos=divpos+20;newDivNode = divCentNode.cloneNode(true);newDivNode.style.top = divpos+"px";newTextNode = document.createTextNode("Subscription Details fully activate the Analysis Modules.");newDivNode.appendChild(newTextNode);regNode.appendChild(newDivNode);}divCentNode.style.fontSize = "10px";divpos=divpos+60;newDivNode = divCentNode.cloneNode(true);newDivNode.style.top = divpos+"px";newANode = document.createElement("a");newANode.setAttribute("href","javascript:subClear()");newTextNode = document.createTextNode("Clear Subscription Details");newANode.appendChild(newTextNode);newDivNode.appendChild(newANode);regNode.appendChild(newDivNode);divpos=divpos+20;newDivNode = divCentNode.cloneNode(true);newDivNode.style.top = divpos+"px";newANode = document.createElement("a");newANode.setAttribute("href","http://www.paypal.com");newTextNode = document.createTextNode("Cancel Existing Subscription via PayPal");newANode.appendChild(newTextNode);newDivNode.appendChild(newANode);regNode.appendChild(newDivNode);divpos=divpos+30;newDivNode = divCentNode.cloneNode(true);newDivNode.style.top = divpos+"px";newTextNode = document.createTextNode("Modules which are not correctly licensed expose individuals and business to serious risk.");newDivNode.appendChild(newTextNode);regNode.appendChild(newDivNode);divpos=divpos+20;newDivNode = divCentNode.cloneNode(true);newDivNode.style.top = divpos+"px";newTextNode = document.createTextNode("Copyright "+d(vendorname)+". All rights reserved.");newDivNode.appendChild(newTextNode);regNode.appendChild(newDivNode);}function plotBreak(){plotReset();var allPlotY1=new Array();var allPlotY2=new Array();allPlotX=new Array();allPlotX.push(breakLabels[1]);allPlotY1.push(revLabels[0]);allPlotY2.push(totLabels[0]);var curPri=strToNum(document.getElementById(encodeURIComponent(breakLabels[0])).value);var curRev=strToNum(document.getElementById(encodeURIComponent(revLabels[0])).value);var curSal=curRev/curPri;var curVar=strToNum(document.getElementById(encodeURIComponent(totVarLabels[0])).firstChild.nodeValue);var curFix=strToNum(document.getElementById(encodeURIComponent(totFixLabels[0])).firstChild.nodeValue);var allPlotSteps=new Array(0,.5,1,1.5,2);for (var y=0;y <= allPlotSteps.length-1;y++){allPlotX.push(allPlotSteps[y]*curSal);plotVal1= allPlotSteps[y]*curRev;allPlotY1.push(plotVal1);plotVal2= (allPlotSteps[y]*curVar)+curFix;allPlotY2.push(plotVal2);}allPlotYs.push(allPlotY1);allPlotYs.push(allPlotY2);plot();allPlotYs=new Array();allPlotX=new Array();}function plotPrice(x){if(x!="calc"){plotReset();}var allPlotY1=new Array();var allPlotY2=new Array();allPlotX=new Array();allPlotX.push(breakLabels[0]);allPlotY1.push(revLabels[0]);allPlotY2.push(totLabels[1]);var curPri=strToNum(document.getElementById(encodeURIComponent(breakLabels[0])).value);var curRev=strToNum(document.getElementById(encodeURIComponent(revLabels[0])).value);var curSal=curRev/curPri;var curVar=strToNum(document.getElementById(encodeURIComponent(totVarLabels[0])).firstChild.nodeValue);var curFix=strToNum(document.getElementById(encodeURIComponent(totFixLabels[0])).firstChild.nodeValue);var curPriCh=strToNum(document.getElementById(encodeURIComponent(priceLabels[0])).value);var curSalCh=strToNum(document.getElementById(encodeURIComponent(priceLabels[1])).value);var salPriRatio=curSalCh/curPriCh;optSur=-1000000000;optPrice=0;var allPlotSteps=new Array(.5,.6,.7,.8,.9,1,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,2.0);for (var y=0;y <= allPlotSteps.length-1;y++){var plotY=allPlotSteps[y]*curPri;plotY=plotY.toFixed(formatDecimals);allPlotX.push(plotY);var salesAdj=(allPlotSteps[y]-1)*salPriRatio;var salesNum=(1+salesAdj)*curSal;var plotVal1=plotY*salesNum;plotVal1=plotVal1.toFixed(formatDecimals);allPlotY1.push(plotVal1);var plotVal2=plotVal1-(curFix+(salesNum*(curVar/curSal)));plotVal2=plotVal2.toFixed(formatDecimals);allPlotY2.push(plotVal2);optSur=Math.max(optSur,plotVal2);if(optSur==plotVal2){optPrice=plotY;optSales=salesNum.toFixed(formatDecimals);optRev=plotVal1;optVar=(salesNum*(curVar/curSal)).toFixed(formatDecimals);optFix=curFix.toFixed(formatDecimals);}}allPlotYs.push(allPlotY1);allPlotYs.push(allPlotY2);if(x!="calc"){plot();}allPlotYs=new Array();allPlotX=new Array();}function plotData(){var allPlotY=new Array();allPlotX=new Array();allPlotX.push("Year");var curSens = strToNum(document.getElementById(encodeURIComponent(senDisLabId)).firstChild.nodeValue);var dataLab=decodeURIComponent(this.id.substring(1));if(this.id.substring(0,1)==fValMk){var useLabel=fValLabel;allPlotY.push(curSens+" "+dataLab);}else if(this.id.substring(0,1)==fPerMk){var useLabel=fPerLabel;allPlotY.push(curSens+" "+dataLab+" %");}else if(this.id.substring(0,1)==vValMk){var useLabel=vValLabel;allPlotY.push(dataLab+" "+retLabels[0]);}else if(this.id.substring(0,1)==vPerMk){var useLabel=vPerLabel;allPlotY.push(dataLab+" ROI %");}for (var y=0;y <= forecastYears;y++){allPlotX.push(y);plotVal= strToNum(document.getElementById(encodeURIComponent(dataLab)+useLabel+y).firstChild.nodeValue);allPlotY.push(plotVal);}allPlotYs.push(allPlotY);plot();}function plotClear(){var dataLab=decodeURIComponent(this.id.substring(1));for (var y=0;y < allPlotYs.length;y++){if(allPlotYs[y][0]==dataLab){allPlotYs.splice(y,1);break;}}plot();}function plot(){var winTRed = 50;var winBRed = 200;var winLRed = 20;var winRRed = 20;var axisBorder = 70;var axisThick = 2;var axisTitFont = 12;var axisLabFont = 10;var lineThick = 1;var axisCol = "#0000ff";var zeroCol = "#ccffff";var plotAreaCol = "#ffffff";var markLen=10;var pointHW=5;var yMarkNum=4;section(sectNames[0]);var plotSectNode = document.getElementById(sectNames[0]);if(document.getElementById(plotAreaLabel)){removeNode=document.getElementById(plotAreaLabel);removeNode.parentNode.removeChild(removeNode);}plotAreaNode = document.createElement('div');plotAreaNode.setAttribute('id',plotAreaLabel);plotAreaNode.className=plotAreaLabel;plotSectNode.appendChild(plotAreaNode);var viewW = window.screen.availWidth;var viewH = window.screen.availHeight;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 allPlotXLen=allPlotX.length;var allPlotYsLen=allPlotYs.length;var xMarkSp=Math.round(plotW/(allPlotXLen-2));var maxY=0;var minY=0;for (var y=0;y < allPlotYsLen;y++){var allPlotYLen = allPlotYs[y].length;for (var i=1;i < allPlotYLen;i++){var testY = parseFloat(allPlotYs[y][i]);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.style.top=zeroY+"px";newZeroAxisNode.style.left=plotLOff+"px";newZeroAxisNode.style.width=plotW+"px";newZeroAxisNode.style.position="absolute";newZeroAxisNode.style.height=axisThick+"px";newZeroAxisNode.style.backgroundColor=zeroCol;newZeroAxisNode.style.fontSize = axisThick+"px";plotAreaNode.appendChild(newZeroAxisNode);var newXAxisNode = document.createElement('div');newXAxisNode.style.top=xAxisY+"px";newXAxisNode.style.left=plotLOff+"px";newXAxisNode.style.width=plotW+"px";newXAxisNode.style.position="absolute";newXAxisNode.style.height=axisThick+"px";newXAxisNode.style.backgroundColor=axisCol;newXAxisNode.style.fontSize = axisThick+"px";plotAreaNode.appendChild(newXAxisNode);var newYAxisNode = document.createElement('div');newYAxisNode.style.top=plotTOff+"px";newYAxisNode.style.left=plotLOff+"px";newYAxisNode.style.height=plotH+"px";newYAxisNode.style.position="absolute";newYAxisNode.style.width=axisThick+"px";newYAxisNode.style.backgroundColor=axisCol;newYAxisNode.style.fontSize = axisThick+"px";plotAreaNode.appendChild(newYAxisNode);var newXAxisTitNode = document.createElement('div');newXAxisTitNode.style.top=xAxisY+(markLen*3)+'px';newXAxisTitNode.style.left=plotLOff+plotW/2 +'px';newXAxisTitNode.style.position="absolute";newXAxisTitNode.style.fontSize = axisTitFont+"px";newXAxisTitNode.style.fontWeight = "bold";newXAxisTitNode.style.textAlign = "right";newTextNode = document.createTextNode(allPlotX[0]);newXAxisTitNode.appendChild(newTextNode);plotAreaNode.appendChild(newXAxisTitNode);for(var y=0;y<yMarkNumAd+1;y++){var newYMarkNode = document.createElement('div');newYMarkNode.style.top=plotTOff+yMarkSp*y+'px';newYMarkNode.style.left=plotLOff-markLen+'px';newYMarkNode.style.width=markLen+'px';newYMarkNode.style.position="absolute";newYMarkNode.style.fontSize = axisThick+"px";newYMarkNode.style.height=axisThick+'px';newYMarkNode.style.textAlign = "center";newYMarkNode.style.backgroundColor=axisCol;plotAreaNode.appendChild(newYMarkNode);var newYLabNode = document.createElement('div');newYLabNode.style.top=plotTOff+yMarkSp*y+'px';newYLabNode.style.left=plotLOff-axisBorder+'px';newYLabNode.style.position="absolute";newYLabNode.style.fontSize = axisLabFont+"px";newTextNode = document.createTextNode(spaceY*(yTopMark-y));newYLabNode.appendChild(newTextNode);plotAreaNode.appendChild(newYLabNode);}for(var x=0;x<allPlotXLen;x++){for (var y=0;y < allPlotYsLen;y++){var yPlot=allPlotYs[y][x];var yColNum=y%allYCol.length;var yCol=allYCol[yColNum];if(x==0){if(y==0){var newYAxisTitNode = document.createElement('div');newYAxisTitNode.style.top=plotTOff-20+'px';newYAxisTitNode.style.left=plotLOff-axisBorder +'px';newYAxisTitNode.style.position="absolute";newYAxisTitNode.style.fontSize = axisTitFont+"px";newYAxisTitNode.style.fontWeight = "bold";newYAxisTitNode.style.textAlign = "right";var newYAxisSpanNode = document.createElement('span');newYAxisSpanNode.style.color=yCol;newYAxisSpanNode.setAttribute("id","c"+encodeURIComponent(yPlot));newYAxisSpanNode.style.cursor="pointer";newYAxisSpanNode.setAttribute("title","Click to Clear.");newYAxisSpanNode.onclick=plotClear;var newTextNode = document.createTextNode(yPlot);newYAxisSpanNode.appendChild(newTextNode);newYAxisTitNode.appendChild(newYAxisSpanNode);plotAreaNode.appendChild(newYAxisTitNode);}else{newTextNode = document.createTextNode(" - ");newYAxisTitNode.appendChild(newTextNode);newYAxisSpanNode = document.createElement('span');newYAxisSpanNode.style.color=yCol;newYAxisSpanNode.setAttribute("id","c"+encodeURIComponent(yPlot));newYAxisSpanNode.style.cursor="pointer";newYAxisSpanNode.setAttribute("title","Click to Clear.");newYAxisSpanNode.onclick=plotClear;newTextNode = document.createTextNode(yPlot);newYAxisSpanNode.appendChild(newTextNode);newYAxisTitNode.appendChild(newYAxisSpanNode);}}else{var newXMarkNode = document.createElement('div');newXMarkNode.style.top=xAxisY+'px';newXMarkNode.style.left=plotLOff+(xMarkSp*(x-1))+'px';newXMarkNode.style.height=markLen+'px';newXMarkNode.style.position="absolute";newXMarkNode.style.fontSize = axisThick+"px";newXMarkNode.style.width=axisThick+'px';newXMarkNode.style.textAlign = "center";newXMarkNode.style.backgroundColor=axisCol;plotAreaNode.appendChild(newXMarkNode);var newXLabNode = document.createElement('div');newXLabNode.style.top=xAxisY+markLen+'px';newXLabNode.style.left=plotLOff+(xMarkSp*(x-1))+'px';newXLabNode.style.position="absolute";newXLabNode.style.fontSize = axisLabFont+"px";var newTextNode = document.createTextNode(allPlotX[x]);newXLabNode.appendChild(newTextNode);plotAreaNode.appendChild(newXLabNode);yScale = Math.round(zeroY - (yPlot/rangeY * plotH));var newPointNode = document.createElement('div');newPointNode.style.width=pointHW+'px';newPointNode.style.height=pointHW+'px';newPointNode.style.backgroundColor=yCol;newPointNode.style.position="absolute";newPointNode.style.fontSize = pointHW+"px";newPointNode.style.cursor="pointer";newPointNode.style.top=yScale-Math.floor(pointHW/2)+'px';newPointNode.style.left=plotLOff+(xMarkSp*(x-1))-Math.floor(pointHW/2)+'px';newPointNode.setAttribute('title',yPlot);plotAreaNode.appendChild(newPointNode);if(x<allPlotXLen-1){var lineX1=plotLOff+(xMarkSp*(x-1));var lineX2=lineX1+xMarkSp;var plotY1=allPlotYs[y][x];var plotY2=allPlotYs[y][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.style.top= Math.round(lineY1+(slope*(xP-lineX1)))+'px';newLineNode.style.left=xP + 'px';newLineNode.style.backgroundColor=yCol;newLineNode.style.width=lineThick+'px';newLineNode.style.height=lineThick+'px';newLineNode.style.fontSize = lineThick+"px";newLineNode.style.position="absolute";plotAreaNode.appendChild(newLineNode);}}}}}plotSectNode.appendChild(plotAreaNode);section("Chart");}function plotReset(){if(document.getElementById(plotAreaLabel)){removeNode=document.getElementById(plotAreaLabel);removeNode.parentNode.removeChild(removeNode);}allPlotYs=new Array();allPlotX=new Array();section(sectNames[0]);}function clearMes(){if(typeof(clearTime)=='number'){clearTimeout(clearTime);}clearTime=setTimeout('inputMesNode.nodeValue="";subMesNode.nodeValue="";setMesNode.nodeValue="";',clearMs);}function xmlExport(){setMesNode.nodeValue="Status: XML Export";var xmlCont='<?xml version="1.0" encoding="UTF-8"?>\n';xmlCont+='<'+xmlDataSet+'>';var title=selNameLabel.replace(/ /g,"_");xmlCont+='<'+title+'>';var val=document.getElementById(encodeURIComponent(selNameLabel)).value;xmlCont+=val;xmlCont+='</'+title+'>';var inputNodes=document.getElementById(inputNames[0]).getElementsByTagName("input");for(var i = 0;i < inputNodes.length;i++){title=decodeURIComponent(inputNodes[i].id);title=title.replace(/ /g,"_");title=title.replace(/%/g,"Per");xmlCont+='<'+title+'>';val=strToNum(inputNodes[i].value);if(val===''){val="-";}xmlCont+=val;xmlCont+='</'+title+'>';}var title=setLabels[0].replace(/ /g,"_");xmlCont+='<'+title+'>';xmlCont+=formatDecimals;xmlCont+='</'+title+'>';var title=setLabels[2].replace(/ /g,"_");xmlCont+='<'+title+'>';xmlCont+=forecastYears;xmlCont+='</'+title+'>';xmlCont+='</'+xmlDataSet+'>';var relNode = document.getElementById(hiddenNames[0]);var relNodeLen=relNode.childNodes.length;for(var childNum=1;childNum<relNodeLen;childNum++){relNode.removeChild(relNode.lastChild);}topStart=topBase;section(hiddenNames[0]);var disNode=document.createElement('textarea');disNode.setAttribute("id", "textarea");disNode.style.width=maxWidth-(2*leftStart)+"px";disNode.style.height=maxHeight/2+"px";disNode.style.position = "absolute";disNode.style.top = topStart+"px";disNode.style.left = leftStart+"px";relNode.appendChild(disNode);disNode.value=xmlCont;disNode.select();var butNode=document.createElement('button');butNode.style.position = "absolute";butNode.style.top = topStart+(maxHeight/2)+topStep+"px";butNode.style.left = leftStart+"px";butNode.style.width=colWidth+"px";butNode.setAttribute("type","button");butNode.onclick = selectta;var textNode = document.createTextNode("Select All");butNode.appendChild(textNode);relNode.appendChild(butNode);setMesNode.nodeValue="Action: Data exported to TextArea. Right Click and Copy TextArea. Paste data to a text editor and Save As an xml file (*.xml)";clearMes();}function selectta(ta){document.getElementById("textarea").select();}function xmlImport(){if(subAct==true){var setValueNode=document.getElementById("setValue");var setValue = setValueNode.value;var useFile= "file:///"+setValue;setMesNode.nodeValue="Status: XML Import.";if (document.implementation && document.implementation.createDocument){xmlDoc = document.implementation.createDocument("", "", null);xmlDoc.onload = xmlInputLoad;}else if (window.ActiveXObject){xmlDoc = new ActiveXObject("Microsoft.XMLDOM");xmlDoc.async="false";xmlDoc.onreadystatechange = function (){if (xmlDoc.readyState == 4) xmlInputLoad()};}else{setMesNode.nodeValue="Error: XML Import Fail. The browser is unable to import the XML file.";return;}xmlDoc.load(useFile);}else{inputDefLoad();inputMesNode.nodeValue="Error: Only Example Inputs can be used without a valid Subscription. A free trial is provided when you subscribe. Click Subscription from the top Control Menu to Subscribe.";alert("Error: Only Example Inputs can be used without a valid Subscription. A free trial is provided when you subscribe. Click Subscription from the top Control Menu to Subscribe.");}clearMes();}function xmlInputLoad(){dataNodes=xmlDoc.getElementsByTagName(xmlDataSet);formatDecimals=parseInt(dataNodes[0].childNodes[dataNodes[0].childNodes.length-2].firstChild.nodeValue);forecastYears=parseInt(dataNodes[0].childNodes[dataNodes[0].childNodes.length-1].firstChild.nodeValue);expand();inputIndFullReset();inputIndBuild();inputRetBuild();inputBreakBuild();inputPriceBuild();formatInput();var inputNodes=document.getElementById(inputNames[0]).getElementsByTagName("input");for(var i = 0;i < dataNodes[0].childNodes.length-2;i++){var xmlVal=dataNodes[0].childNodes[i].firstChild.nodeValue;if(i==0){impName=xmlVal;selNameBuild();var dupName=false;if(document.cookie.indexOf(cookVar)>-1){var selNames=document.cookie.split(cookVar);for(var selNum=1;selNum<selNames.length;selNum++){var useSelNames=selNames[selNum].split("=");var selName=decodeURIComponent(useSelNames[0]);if(selName==impName){var dupName=true;break;}}}if(dupName==false){var selNameOptNode = optNode.cloneNode(true);selNameOptNode.setAttribute("value",xmlVal);var textNode = document.createTextNode(xmlVal);selNameOptNode.appendChild(textNode);var nextNode=selNameNode.firstChild;selNameNode.insertBefore(selNameOptNode,nextNode);selNameNode.value=xmlVal;var inputMesAd="";}else{var inputMesAd="Warning: A local "+impName+" data set already exists. If you Save "+impName+" imported data will overwrite local data. ";}}else{inputNodes[i-1].value=numToStr(xmlVal);}}forecastReset();forecastBuild();forecastCalc();inputMesNode.nodeValue=inputMesAd + "Status: XML Import Complete.";section(inputNames[0]);clearMes();}