var bankBS;var hhBS;var coBS;var treasBS;var cbBS;var psBS;var govBS;var aggBS;function bsOnload(){var b=document.getElementsByTagName("button");for(var a=0;a<b.length;a++){b[a].disabled=false}initialize();selectionChanged(document.getElementById("opSelect"))}function setUpBalanceSheets(){var a=105;var P=250;var O=570;var h=35;var l=15;var b=5;var N=10;var d=15;var q=l-N;var o=P+20;var r=totalBSWidth*2+h+N*2;var c=O-o+20;var x=l+totalBSWidth*2+h*2-N;var w=P+20;var s=totalBSWidth*3+h*2+N*2;var y=O-w+20;var D=l+totalBSWidth+h-N;var C=a+20;var u=totalBSWidth*2+h+N*2;var p=P-C+10;var n=l+totalBSWidth*1.5+h*1.5-N;var m=b+10;var J=totalBSWidth+N*2;var j=a-m+10;var I=l+(totalBSWidth+h)*3.5-N-20;var H=a+20;var k=columnWidth*3+statGap*2+N*2;var e=P-H+10;var M="#E8E8E8";var z=null;z=createSVGRect(q,o,r,c,M);svgRoot.appendChild(z);z=createSVGRect(x,w,s,y,M);svgRoot.appendChild(z);z=createSVGRect(D,C,u,p,M);svgRoot.appendChild(z);z=createSVGRect(n,m,J,j,M);svgRoot.appendChild(z);z=createSVGRect(I,H,k,e,"#FFFFC0");svgRoot.appendChild(z);var v=null;v=createSVGText(x+s+5,w+15,"Scale: 1/1");v.setAttribute("style","font-size: 12px; font-style: italic; font-family: arial,sans-serif; fill: black;");svgRoot.appendChild(v);v=createSVGText(D+u+5,C+15,"Scale: 1/4");v.setAttribute("style","font-size: 12px; font-style: italic; font-family: arial,sans-serif; fill: black;");svgRoot.appendChild(v);v=createSVGText(n+J+5,m+15,"Scale: 1/8");v.setAttribute("style","font-size: 12px; font-style: italic; font-family: arial,sans-serif; fill: black;");svgRoot.appendChild(v);v=createSVGText(I+k+5,H+15,"Scale: 1/2");v.setAttribute("style","font-size: 12px; font-style: italic; font-family: arial,sans-serif; fill: black;");svgRoot.appendChild(v);var A=l;treasBS=new BalanceSheet("Treasury (Federal Government)",A,O);treasBS.setEquityInfoText("Without the treasury's negative equity (liabilities exceeding financial assets), it would not be possible for the private sector to have a positive financial net worth. Note that this entire visualizer excludes tangible assets in order to focus on financials.");treasBS.addAssetBlock(BlockType.Reserves,40,"reserves","T.Deposits","Treasury Deposits are the Treasury's account balance at the Central Bank, used for government spending. The size is small and sovereign governments are not dependent on 'saving up' in order to spend in the future.");treasBS.addLiabilityBlock(BlockSubType.Treasuries,210,"treasuries","Treasuries","The Treasury's Liabilities (bonds, bills and notes) facilitate private sector savings. The private sector's savings desires predominantly determine the size of the treasury's debt (liabilities), assisted by the automatic stabilizers. Treasury liabilities exceed financial assets by design!");bsList.push(treasBS);svgRoot.appendChild(treasBS.bsElem);A+=totalBSWidth+h;cbBS=new BalanceSheet("Central Bank (Federal Government)",A,O);cbBS.setEquityInfoText("Central Banks maintain a small positive buffer of equity (capital). Their solvency is never a concern because (a) they hold mostly high quality assets that earn income, (b) they need not mark assets to market, and (c) various forms of recapitalization by treasury are possible if ever they were needed.");cbBS.addAssetBlock(BlockSubType.Treasuries,170,"treasuries","Treasuries",'One role of central banks is to "transform" treasury liabilities into currency, so they hold treasuries as assets. They may also hold private sector securities. The income from these assets adds to equity, so central banks periodically remit these earnings to the treasury.');cbBS.addLiabilityBlock(BlockSubType.Currency,40,"currency","Currency","Currency (physical notes and coins) is a liability of the central bank.");cbBS.addLiabilityBlock(BlockSubType.Reserves,120,"reserves","Deposits","The majority of the central bank's deposits are reserve balances held within the banking system, though the treasury also has an account at the central bank.");bsList.push(cbBS);svgRoot.appendChild(cbBS.bsElem);A+=totalBSWidth+h;bankBS=new BalanceSheet("Banks",A,O);bankBS.setEquityInfoText("Bank Equity is specifically referred to as Capital. A bank becomes insolvent if its assets (typically loans) fall too far in value, turning equity negative (or at least below regulatory minimums.) Bank lending is capital constrained (temporarily, capital can be injected) but never reserve constrained.");bankBS.addAssetBlock(BlockSubType.Currency,40,"currency","Currency","Banks hold currency (physical notes and coins) in vaults in a sufficient quantity to meet the withdrawal demands of their customers. Currency and reserve balances are interchangeable from the central bank as needed.");bankBS.addAssetBlock(BlockSubType.Reserves,80,"reserves","Reserves",'Bank reserve balances are electronic accounting entries and liabilities of the central bank, and are equivalent to currency. Reserve balances provide interbank liquidity for the payments system (e.g., a when a check clears reserves are transferred between banks.) Banks never "lend out" reserves!');bankBS.addAssetBlock(BlockSubType.Treasuries,0,"treasuries","Treasuries","Banks may hold treasuries and other assets in addition to their loans, currency, and reserve balances.");bankBS.addAssetBlock(BlockSubType.Loans,0,"loans","Loans","When banks make loans they may hold them as assets on their balance sheets (or loans can be packaged and sold as securities). Interest paid by borrowers is a source of bank earnings. Writedowns and defaults shrink the value of loans, reducing bank capital (equity).");bankBS.addLiabilityBlock(BlockSubType.Deposits,80,"deposits","Deposits","Customer deposits are the primary source of funding for banks, though they can also borrow in other ways (e.g., issuing bonds). Banks usually pay customers interest on their deposits, but make up for this cost via earning higher interest rates on loans, charging fees to customers, etc.");bsList.push(bankBS);svgRoot.appendChild(bankBS.bsElem);A+=totalBSWidth+h;hhBS=new BalanceSheet("Households",A,O);hhBS.setEquityInfoText("Household net worth is usually positive, because on aggregate households are generally net savers. Within the household sector, some households have negative net worth (e.g., students with loans, 'underwater' homeowners, etc) while others have positive net worth (e.g., retirees with savings accounts.)");hhBS.addAssetBlock(BlockSubType.Currency,0,"currency","Currency","Households may choose to hold physical currency (notes and coins) either to use for cash transactions or simply as a form of savings.");hhBS.addAssetBlock(BlockSubType.Deposits,40,"deposits","Deposits","Most households have one or more checking or savings accounts at banks, and these assets are called bank deposits. The bank based payment system credits and debits various depositors' accounts as payments are made by check, electronic transfer, etc.");hhBS.addAssetBlock(BlockSubType.Treasuries,40,"treasuries","Treasuries","Households may hold government treasuries as one form of savings.");hhBS.addAssetBlock(BlockSubType.Bonds,0,"bonds","Bonds","Households may buy corporate bonds and hold them as a form of savings.");hhBS.addLiabilityBlock(BlockSubType.Loans,0,"loans","Loans","Households often borrow to make purchases (e.g., cars, homes, education, furniture, etc.) The loans are a liability that must be paid off over time and on which regular interest payments are usually due.");bsList.push(hhBS);svgRoot.appendChild(hhBS.bsElem);A+=totalBSWidth+h;coBS=new BalanceSheet("Companies (+ foreign sector, misc)",A,O);coBS.setEquityInfoText("Companies usually have positive net worth because profits add to balance sheet equity. (But consistently unprofitable companies may become insolvent.)");coBS.addAssetBlock(BlockSubType.Currency,0,"currency","Currency","Companies may choose to hold some assets as physical currency (notes and coins). An example would be businesses that accept cash payments.");coBS.addAssetBlock(BlockSubType.Deposits,40,"deposits","Deposits","Like households, companies hold some assets as bank deposits that they can use for buying inventory, paying employees, making investments, etc.");coBS.addAssetBlock(BlockSubType.Treasuries,0,"treasuries","Treasuries","Like households, companies may choose to hold government treasuries as one form of asset.");coBS.addAssetBlock(BlockSubType.Bonds,0,"securitizedloans","Secur. Loans","A securitized loan is one that has been transferred from a bank's balance sheet to an investor's (or investment company's) balance sheet, typically as part of a pooled purchase. It is similar to a bond in that it is a form of private debt/borrowing that on net does not increase the broad money supply.");coBS.addLiabilityBlock(BlockSubType.Loans,0,"loans","Loans","Like households, companies can borrow from banks.");coBS.addLiabilityBlock(BlockSubType.Bonds,0,"bonds","Bonds","Some companies can issue bonds to fund themselves. Other possible forms of borrowing or funding include money markets, bank loans, and capital raises (not shown here).");bsList.push(coBS);svgRoot.appendChild(coBS.bsElem);treasBS.linkBlocks("treasuries",cbBS,"treasuries");treasBS.linkBlocks("treasuries",bankBS,"treasuries");treasBS.linkBlocks("treasuries",hhBS,"treasuries");treasBS.linkBlocks("treasuries",coBS,"treasuries");cbBS.linkBlocks("reserves",treasBS,"reserves");cbBS.linkBlocks("reserves",bankBS,"reserves");cbBS.linkBlocks("currency",bankBS,"currency");cbBS.linkBlocks("currency",hhBS,"currency");cbBS.linkBlocks("currency",coBS,"currency");bankBS.linkBlocks("deposits",hhBS,"deposits");bankBS.linkBlocks("deposits",coBS,"deposits");hhBS.linkBlocks("loans",bankBS,"loans");coBS.linkBlocks("securitizedloans",hhBS,"loans");coBS.linkBlocks("loans",bankBS,"loans");coBS.linkBlocks("bonds",hhBS,"bonds");A=l+totalBSWidth+h;govBS=new BalanceSheetAggregate("Federal Government Sector (aggregate)",A,P,[treasBS,cbBS]);govBS.setScale(4);bsList.push(govBS);svgRoot.appendChild(govBS.bsElem);var g=A;A+=totalBSWidth+h;psBS=new BalanceSheetAggregate("Private Sector (aggregate)",A,P,[bankBS,hhBS,coBS]);psBS.setScale(4);bsList.push(psBS);svgRoot.appendChild(psBS.bsElem);var G=A;A=l+totalBSWidth+h+(totalBSWidth+h)/2;aggBS=new BalanceSheetAggregate("Total Economy (aggregate)",A,a,[psBS,govBS]);aggBS.setScale(8);bsList.push(aggBS);svgRoot.appendChild(aggBS.bsElem);var B=A;var F=createSVGGroup();var L="green";var f=null;f=createSVGLine(q,q+r,o,o,L);F.appendChild(f);f=createSVGLine(q,q,o,o+d,L);F.appendChild(f);f=createSVGLine(q+r,q+r,o,o+d,L);F.appendChild(f);f=createSVGLine(g+Math.round(totalBSWidth/2),g+Math.round(totalBSWidth/2),o,o-10,L);F.appendChild(f);f=createSVGLine(x,x+s,w,w,L);F.appendChild(f);f=createSVGLine(x,x,w,w+d,L);F.appendChild(f);f=createSVGLine(x+s,x+s,w,w+d,L);F.appendChild(f);f=createSVGLine(G+Math.round(totalBSWidth/2),G+Math.round(totalBSWidth/2),P+20,P+10,L);F.appendChild(f);f=createSVGLine(D,D+u,C,C,L);F.appendChild(f);f=createSVGLine(D,D,C,C+d,L);F.appendChild(f);f=createSVGLine(D+u,D+u,C,C+d,L);F.appendChild(f);f=createSVGLine(n+Math.round(totalBSWidth/2),n+Math.round(totalBSWidth/2),C,C-10,L);F.appendChild(f);svgRoot.appendChild(F);A=I+N;var E=new MacroStat("Base Money",A,P,MacroStatType.BaseMoney,[bankBS,hhBS,coBS]);E.setScale(2);bsList.push(E);svgRoot.appendChild(E.bsElem);A+=columnWidth+statGap;var K=new MacroStat("Broad Money",A,P,MacroStatType.BroadMoney,[hhBS,coBS]);K.setScale(2);bsList.push(K);svgRoot.appendChild(K.bsElem);A+=columnWidth+statGap;var t=new MacroStat("Private Debt",A,P,MacroStatType.PrivateDebt,[bankBS,hhBS,coBS]);t.setScale(2);bsList.push(t);svgRoot.appendChild(t.bsElem);E.linkBlocks("stat",bankBS,"currency");E.linkBlocks("stat",bankBS,"reserves");E.linkBlocks("stat",hhBS,"currency");E.linkBlocks("stat",coBS,"currency");K.linkBlocks("stat",hhBS,"currency");K.linkBlocks("stat",coBS,"currency");K.linkBlocks("stat",hhBS,"deposits");K.linkBlocks("stat",coBS,"deposits");t.linkBlocks("stat",hhBS,"loans");t.linkBlocks("stat",coBS,"bonds");t.linkBlocks("stat",coBS,"bonds")}function getOperationAmount(){var b=document.getElementById("opAmountText");var a=0;if(b!=null&&b.value!=undefined&&b.value!=null){a=parseInt(b.value)}if(a==0){a=30}return a}function resetBalanceSheetsClick(){resetBalanceSheets();trackEvent("BS Manual","Reset Diagram")}function resetBalanceSheets(){resetBS();clearInvalidOperation();setButtonEnabled("replayOpButton",false)}function initialize(){svgRoot=document.getElementsByTagNameNS(svgns,"svg")[0];setUpBalanceSheets();var a=getQuerystringParam("op");if(a!=null&&a!=""){showOp(a)}return true}function getOperationName(){return document.getElementById("opSelect").value}function doOperation(a){var b=getOperationName();switch(b){case"privatespending":doPrivateSpending(a);break;case"governmentspending":doGovernmentSpending(a);break;case"governmenttaxes":doGovernmentTaxes(a);break;case"governmentdebtissuance":doGovernmentDebtIssuance(a);break;case"consolidatedgovernmentspending":doConsolidatedGovernmentSpending(a);break;case"governmentspendingnobonds":doGovernmentSpendingNoBonds(a);break;case"withdrawcurrency":doWithdrawCurrency(a);break;case"depositcurrency":doDepositCurrency(a);break;case"bankloan":doBankLoan(a);break;case"bankloaninterest":doBankLoanInterest(a);break;case"bankloanrepayment":doBankLoanRepayment(a);break;case"bankloandefault":doBankLoanDefault(a);break;case"bondissuance":doBondIssuance(a);break;case"bondinterest":doBondInterest(a);break;case"bondrepayment":doBondRepayment(a);break;case"bonddefault":doBondDefault(a);break;case"bankloansecuritize":doBankLoanSecuritize(a);break;case"qe":doQE(a);break;case"qebanks":doQEBanks(a);break;case"omoraiserates":doOMORaiseRates(a);break;case"omolowerrates":doOMOLowerRates(a);break}}function doActionClick(){doAction();trackEvent("BS Manual","Op Run",getOperationName())}function doAction(){doOperation(getOperationAmount());setButtonEnabled("replayOpButton",true)}function reverseActionClick(){reverseAction();setButtonEnabled("replayOpButton",false);trackEvent("BS Manual","Op Reverse",getOperationName())}function reverseAction(){doOperation(0-getOperationAmount())}function replayActionClick(){replayAction();trackEvent("BS Manual","Op Replay",getOperationName())}function replayAction(){isAnimationDisabled=true;reverseAction();isAnimationDisabled=false;if(checkLastOperationValidity()){doAction()}}function alertInvalidOperation(){var a=document.getElementById("errorLabel");a.style.display="block";trackEvent("BS Manual","Error Op Invalid",getOperationName())}function clearInvalidOperation(){var a=document.getElementById("errorLabel");a.style.display="none"}function checkLastOperationValidity(){var a=document.getElementById("errorLabel");return(a.style.display=="none")}function resizeBlocksWithAnim(g){if(currJSInterval!=null){return false}var b=true;for(var f=0,a=g.length;f<a;f++){var d=g[f][0];var c=g[f][1];var e=g[f][2];b&=d.canResize(c,e)}if(b){clearInvalidOperation();hideAllChangeText();for(var f=0,a=bsList.length;f<a;f++){bsList[f].addDataToHistory()}for(var f=0,a=g.length;f<a;f++){var d=g[f][0];var c=g[f][1];var e=g[f][2];d.resizeBlockWithAnim(c,e)}startAnimation()}else{alertInvalidOperation()}return b}function doPrivateSpending(a){var b=new Array();b.push([hhBS,"deposits",-a]);b.push([coBS,"deposits",a]);resizeBlocksWithAnim(b)}function doGovernmentSpending(a){var b=new Array();b.push([treasBS,"reserves",-a]);b.push([hhBS,"deposits",a]);b.push([bankBS,"reserves",a]);b.push([bankBS,"deposits",a]);resizeBlocksWithAnim(b)}function doGovernmentTaxes(a){var b=new Array();b.push([treasBS,"reserves",a]);b.push([hhBS,"deposits",-a]);b.push([bankBS,"reserves",-a]);b.push([bankBS,"deposits",-a]);resizeBlocksWithAnim(b)}function doGovernmentDebtIssuance(a){var b=new Array();b.push([treasBS,"reserves",a]);b.push([treasBS,"treasuries",a]);b.push([hhBS,"deposits",-a]);b.push([bankBS,"reserves",-a]);b.push([bankBS,"deposits",-a]);b.push([hhBS,"treasuries",a]);resizeBlocksWithAnim(b)}function doConsolidatedGovernmentSpending(a){var b=new Array();b.push([treasBS,"treasuries",a]);b.push([hhBS,"treasuries",a]);resizeBlocksWithAnim(b)}function doGovernmentSpendingNoBonds(a){var b=new Array();b.push([treasBS,"treasuries",a]);b.push([cbBS,"treasuries",a]);b.push([cbBS,"reserves",a]);b.push([bankBS,"reserves",a]);b.push([bankBS,"deposits",a]);b.push([hhBS,"deposits",a]);resizeBlocksWithAnim(b)}function doWithdrawCurrency(a){var b=new Array();b.push([hhBS,"deposits",-a]);b.push([hhBS,"currency",a]);b.push([bankBS,"currency",-a]);b.push([bankBS,"deposits",-a]);resizeBlocksWithAnim(b)}function doDepositCurrency(a){var b=new Array();b.push([hhBS,"deposits",a]);b.push([hhBS,"currency",-a]);b.push([bankBS,"currency",a]);b.push([bankBS,"deposits",a]);resizeBlocksWithAnim(b)}function doBankLoan(a){var b=new Array();b.push([bankBS,"loans",a]);b.push([bankBS,"deposits",a]);b.push([hhBS,"deposits",a]);b.push([hhBS,"loans",a]);resizeBlocksWithAnim(b)}function doBankLoanInterest(a){var b=new Array();b.push([hhBS,"deposits",-a]);b.push([bankBS,"deposits",-a]);resizeBlocksWithAnim(b)}function doBankLoanRepayment(a){var b=new Array();b.push([bankBS,"loans",-a]);b.push([bankBS,"deposits",-a]);b.push([hhBS,"deposits",-a]);b.push([hhBS,"loans",-a]);resizeBlocksWithAnim(b)}function doBankLoanDefault(a){var b=new Array();b.push([bankBS,"loans",-a]);b.push([hhBS,"loans",-a]);resizeBlocksWithAnim(b)}function doBondIssuance(a){var b=new Array();b.push([coBS,"deposits",a]);b.push([coBS,"bonds",a]);b.push([hhBS,"deposits",-a]);b.push([hhBS,"bonds",a]);resizeBlocksWithAnim(b)}function doBondInterest(a){var b=new Array();b.push([coBS,"deposits",-a]);b.push([hhBS,"deposits",a]);resizeBlocksWithAnim(b)}function doBondRepayment(a){var b=new Array();b.push([coBS,"deposits",-a]);b.push([coBS,"bonds",-a]);b.push([hhBS,"deposits",a]);b.push([hhBS,"bonds",-a]);resizeBlocksWithAnim(b)}function doBondDefault(a){var b=new Array();b.push([coBS,"bonds",-a]);b.push([hhBS,"bonds",-a]);resizeBlocksWithAnim(b)}function doBankLoanSecuritize(a){var b=new Array();b.push([bankBS,"loans",-a]);b.push([bankBS,"deposits",-a]);b.push([coBS,"deposits",-a]);b.push([coBS,"securitizedloans",a]);resizeBlocksWithAnim(b)}function doQE(a){var b=new Array();b.push([cbBS,"treasuries",a]);b.push([cbBS,"reserves",a]);b.push([hhBS,"deposits",a]);b.push([hhBS,"treasuries",-a]);b.push([bankBS,"reserves",a]);b.push([bankBS,"deposits",a]);resizeBlocksWithAnim(b)}function doQEBanks(a){var b=new Array();b.push([cbBS,"treasuries",a]);b.push([cbBS,"reserves",a]);b.push([bankBS,"treasuries",-a]);b.push([bankBS,"reserves",a]);resizeBlocksWithAnim(b)}function doOMORaiseRates(a){var b=new Array();b.push([cbBS,"treasuries",-a]);b.push([cbBS,"reserves",-a]);b.push([bankBS,"treasuries",a]);b.push([bankBS,"reserves",-a]);resizeBlocksWithAnim(b)}function doOMOLowerRates(a){var b=new Array();b.push([cbBS,"treasuries",a]);b.push([cbBS,"reserves",a]);b.push([bankBS,"treasuries",-a]);b.push([bankBS,"reserves",a]);resizeBlocksWithAnim(b)}function showOp(b){var c=document.getElementById("opSelect");for(var d=0,a=c.length;d<a;d++){if(c[d].value==b){c.selectedIndex=d;selectionChanged(c[d]);break}}}function selectionChangedClick(a){selectionChanged(a);trackEvent("BS Manual","Op Select",a.value)}var lastSelection="privatespending";function selectionChanged(b){if(b==null){document.getElementById("explanationArea").style.display="none";return}else{document.getElementById("explanationArea").style.display="block"}if(lastSelection!=null){var c=document.getElementById(lastSelection);if(c!=null){c.style.display="none"}}lastSelection=(b!=null?b.value:null);if(lastSelection!=null){var c=document.getElementById(lastSelection);if(c!=null){c.style.display="block"}}var a=HTMLUtility.getSelectControlTextByValue(document.getElementById("opSelect"),getOperationName());document.getElementById("opDetailsOpName").innerHTML=" ("+a+")";setButtonEnabled("replayOpButton",false)}function setButtonEnabled(c,b){var a=document.getElementById(c);if(b){a.removeAttribute("disabled")}else{a.setAttribute("disabled","disabled")}}var isWizardModeActive=false;function toggleWizardMode(){if(isWizardModeActive){resetBalanceSheets();document.getElementById("wizardToggleButton").innerHTML=document.getElementById("wizardToggleButton").innerHTML.replace("OFF","ON");document.getElementById("wizardArea").style.display="none";document.getElementById("controlArea").style.display="block";document.getElementById("explanationArea").style.display="block";isWizardModeActive=false;trackEvent("BS Wizard","Wizard Off")}else{resetBalanceSheets();document.getElementById("wizardToggleButton").innerHTML=document.getElementById("wizardToggleButton").innerHTML.replace("ON","OFF");document.getElementById("wizardArea").style.display="block";document.getElementById("controlArea").style.display="none";BalanceSheetWizard.reset();document.getElementById("opAmountText").value="30";isWizardModeActive=true;trackEvent("BS Manual","Wizard On");alert("Please click the 'Run This' button in the box below the balance sheet diagrams. Repeatedly clicking this button will walk you through all the macroeconomic operations, one at a time.")}}var BalanceSheetWizard={currentStepIndex:-1,steps:[["privatespending",true,"To start, observe how spending transfers assets (and financial net worth) between balance sheets within the private sector."],["governmentspending",true,"Government spending results in an equivalent transfer of assets (and financial net worth) TO the private sector."],["governmenttaxes",true,"Government taxation reduces the financial net worth of the private sector so as to limit potential spending and inflationary pressures. When available economic capacity is limited, taxation can also make room for the politically desired level of government spending."],["governmentspending",true,"For this step the government will spend again in preparation for the next step."],["governmentdebtissuance",true,"Government bond issuance comes after government spending and simply gives the private sector a longer duration asset in exchange for money (i.e., it's an asset swap)."],["consolidatedgovernmentspending",true,"A combined operation (government spending plus debt issuance) shows how government deficits supply the private sector with financial savings in the form of government liabilities."],["consolidatedgovernmentspending",false,"This step runs the combined operation in reverse so the balance sheets don't grow too large for this visualizer."],["governmentspendingnobonds",true,"A sovereign government does not need to 'raise money' before it can spend, and this combined operation demonstrates why."],["governmentspendingnobonds",false,"This step runs the combined operation in reverse so the balance sheets don't grow too large for this visualizer."],["governmentspending",true,"For this step the government will spend again in preparation for later steps."],["withdrawcurrency",true,"Customers can withdraw physical cash from their bank deposit accounts."],["depositcurrency",true,"Customers can deposit physical cash into bank accounts."],["bankloan",true,"Banks make loans to credit-worthy borrowers (thus creating deposits) and lending is never constrained by how many reserves banks have!"],["bankloaninterest",true,"Borrowers make regular interest payments to banks. [In real life, interest payments would be much smaller relative to original loan size than shown here.]"],["bankloanrepayment",true,"Borrowers repay loan principal over time, typically as they earn the necessary income, thus reversing the balance sheet impacts of the original loan."],["bankloan",true,"This step creates another bank loan in preparation for the next step."],["bankloandefault",true,"Borrower defaults on bank loans are comparable to a gift of balance sheet net worth from banks to borrowers, which is why banks only want to lend to credit-worthy borrowers."],["bondissuance",true,"When they need money, companies can issue bonds as an alternative to borrowing from banks. (There are additional funding options also, such as the commercial paper market)."],["bondinterest",true,"Companies make interest payments on their outstanding bonds. [In real life, interest payments would be much smaller relative to original bond size than shown here.]"],["bondrepayment",true,"Companies repay the principal on bonds as the bonds come due (bonds have fixed duration)."],["bondissuance",true,"This step enacts another corporate bond issuance in preparation for the next step."],["bonddefault",true,"Companies can default on their bond obligations just like bank borrowers can default on bank loans."],["bankloan",true,"This step creates another bank loan in preparation for the next step."],["bankloansecuritize",true,"Securitization packages loans as bond-like securities that can be sold to investors."],["qe",true,"Quantitative easing by a central bank is essentially an asset swap that replaces long duration assets in the private sector with short duration assets (either reserves or bank deposits plus reserves)."],["omoraiserates",true,"Central banks traditionally use open market operations to defend their current target overnight interest rate. While the rate is below target, the central bank sells treasuries (withdrawing reserves) to drive the rate up toward target."],["omolowerrates",true,"Conversely, while the overnight rate is above target, the central bank adds buys treasuries (adding reserves to the banking system) to drive the rate down toward target."]],reset:function(){this.currentStepIndex=-1;this.displayStep()},stepNext:function(){if(isAnimationActive()){return}if(this.currentStepIndex==(this.steps.length-1)){alert("At last step already");return}this.currentStepIndex++;this.displayStep();var a=this.steps[this.currentStepIndex][1];if(a){doAction()}else{reverseAction()}trackEvent("BS Wizard",(a?"Op Run":"Op Reverse"),getOperationName());if(this.currentStepIndex==(this.steps.length-1)){trackEvent("BS Wizard","Wizard Completed")}},stepReplay:function(){if(isAnimationActive()){return}isAnimationDisabled=true;var a=this.steps[this.currentStepIndex][1];if(a){reverseAction()}else{doAction()}isAnimationDisabled=false;if(a){doAction()}else{reverseAction()}trackEvent("BS Wizard","Op Replay",getOperationName())},stepPrev:function(){if(isAnimationActive()){return}if(this.currentStepIndex==-1){alert("At first step already");return}isAnimationDisabled=true;var a=this.steps[this.currentStepIndex][1];if(a){reverseAction()}else{doAction()}this.currentStepIndex--;this.setActiveOperationFromWizard();if(this.currentStepIndex>=0){a=this.steps[this.currentStepIndex][1];if(a){reverseAction()}else{doAction()}if(a){doAction()}else{reverseAction()}}isAnimationDisabled=false;this.displayStep();trackEvent("BS Wizard","Op Back")},displayStep:function(){document.getElementById("wizardTotalSteps").innerHTML="("+(this.steps.length+1)+" total steps)";document.getElementById("wizardPrevStepNum").innerHTML=(this.currentStepIndex+1);document.getElementById("wizardCurrStepNum").innerHTML=(this.currentStepIndex+2);document.getElementById("wizardNextStepNum").innerHTML=(this.currentStepIndex+3);document.getElementById("wizardPrevStepOp").innerHTML=this.getStepOp(this.currentStepIndex-1);document.getElementById("wizardCurrStepOp").innerHTML=this.getStepOp(this.currentStepIndex);document.getElementById("wizardNextStepOp").innerHTML=this.getStepOp(this.currentStepIndex+1);document.getElementById("wizardPrevStepComments").innerHTML=this.getStepComments(this.currentStepIndex-1);document.getElementById("wizardCurrStepComments").innerHTML=this.getStepComments(this.currentStepIndex);document.getElementById("wizardNextStepComments").innerHTML=this.getStepComments(this.currentStepIndex+1);this.setActiveOperationFromWizard();if(this.currentStepIndex<1){document.getElementById("wizardPrevButton").setAttribute("disabled","disabled")}else{document.getElementById("wizardPrevButton").removeAttribute("disabled")}if(this.currentStepIndex<0){document.getElementById("wizardReplayButton").setAttribute("disabled","disabled")}else{document.getElementById("wizardReplayButton").removeAttribute("disabled")}if(this.currentStepIndex>=(this.steps.length-1)){document.getElementById("wizardNextButton").setAttribute("disabled","disabled")}else{document.getElementById("wizardNextButton").removeAttribute("disabled")}},setActiveOperationFromWizard:function(){if(this.currentStepIndex>=0&&this.currentStepIndex<this.steps.length){HTMLUtility.setSelectControlByValue(document.getElementById("opSelect"),this.steps[this.currentStepIndex][0]);selectionChanged(document.getElementById("opSelect"))}else{selectionChanged(null)}},getStepOp:function(a){var b="";if(a>=0&&a<this.steps.length){b=HTMLUtility.getSelectControlTextByValue(document.getElementById("opSelect"),this.steps[a][0]);if(!this.steps[a][1]){b+=" (REVERSAL)"}}return b},getStepComments:function(a){var b="";if(a<0){b="[Starting point]"}else{if(a>=this.steps.length){b="[Ending point]"}else{b=this.steps[a][2]}}return b}};function trackEvent(b,d,a,c){if(a&&c){_gaq.push(["_trackEvent",b,d,a,c])}else{if(a){_gaq.push(["_trackEvent",b,d,a])}else{_gaq.push(["_trackEvent",b,d])}}}var HTMLUtility={setSelectControlByValue:function(b,a){for(i=0;i<b.length;i++){if(b[i].value==a){b.selectedIndex=i;break}}},getSelectControlTextByValue:function(b,a){var c=null;for(i=0;i<b.length;i++){if(b[i].value==a){c=b.options[i].text;break}}return c}};
