function E(){}E.prototype.id="";E.prototype.name="";E.prototype.register=function(ai){if(ai==null)return;if(this.loaded!=null)ai.call(this);if(this.loaded!=true){if(this.onload==null)this.onload=[];this.onload.push(ai);}};E.prototype.notify=function(){if(this.onload==null)return;var ai=this;this.onload.foreach(function(aj){aj.call(ai);});if(this.loaded)delete this.onload;};function F(ai){this.id=ai;this.name=ai;}F.prototype=new E();function G(ai){this.objectType=ai;}G.prototype=new E();function H(ai,aj){this.id=ai;this.name=aj;this.comments="";this.items={};this.lots=[];}H.prototype=new G("Collection");H.prototype.clear=function(){this.items={};this.lots={};};H.prototype.get=function(ai,aj){var ak=this.items[ai];if(ak==null)return 0;var al=ak[aj];return (al==null?0:al);};H.prototype.set=function(ai,aj,ak){var al=this.items[ai];if(al==null){al={};this.items[ai]=al;}if(ak==0)delete al[aj];else al[aj]=ak;};H.prototype.getQty=function(ai){var aj=0;this.lots.foreach(function(ak){aj+=ak.getQty(ai);});return aj;};I.prototype.addLot=function(){var ai=new I();this.lots.push(ai);return ai;};function I(){this.name="";this.cost=null;this.comments="";this.entries={};}I.prototype.getQty=function(ai){var aj=this.entries[ai];if(aj==null)return 0;var ak=0;aj.foreach(function(al){ak+=al.qty;});return ak;};I.prototype.addEntry=function(ai){var aj=this.entries[ai];if(aj==null)this.entries[ai]=aj=[];var ak=new J();aj.push(ak);return ak;};function J(){this.qty=0;this.location="";this.cost=null;this.comments="";}function K(ai,aj){this.type=ai;this.id=aj;this.qty=0;}function L(ai){this.id=ai;this.entries={};}L.prototype=new G("Roster");L.prototype.name="A Roster";L.prototype.isEmpty=function(){return true;};L.prototype.clear=function(){delete this.name;this.entries={};};function M(ai,aj){this.id=ai;this.name=aj;this.rules=[];this.variables={};this.fields=[];}M.prototype=new G("Ruleset");M.prototype.description="";M.prototype.addField=function(ai,aj){var ak=new N(ai,aj);this.fields.push(ak);return ak;};M.prototype.addVariable=function(ai,aj,ak){var al=new O(aj,ak);this.variables[ai]=al;return al;};function N(ai,aj){this.label=ai;this.value=aj;}function O(ai,aj){this.type=ai;this.dfault=aj;}function P(ai,aj,ak){this.test=ai;if(aj)this.pass=aj;if(ak)this.fail=ak;}function Q(ai){this.text=ai;this.options=[];}Q.prototype.addOption=function(ai){var aj=new R(ai);this.options.push(aj);return aj;};function R(ai){this.text=ai;}function S(ai,aj,ak){this.id=ai;this.name=aj;this.style=ak;this.group=new T("and");}function T(ai){this.type=ai;this.criteria=[];}T.prototype.addCriterium=function(ai,aj,ak,al){this.criteria.push({property:ai,op:aj,value:ak,not:al});};T.prototype.addGroup=function(ai){var aj=new T(ai);this.criteria.push(aj);return aj;};var System={};System.setup=function(ai,aj,ak,al,am,an,ao,ap,aq,ar,as,at,au){delete this.setup;var av=this;var aw={};var ax=[];var ay=[];var az;var aA="";var aB;var aC;var aD;var aE=new B.Parser();var aF;var aG;var aH;var aI;var aJ;var aK;var aL;var aM;var aN;var aO;var aP;var aQ;var aR;var aS;var aT;var aU;var aV;var aW;var aX=[];var aY=0;var aZ;var ba;var bb;var bc;var bd;var be;var bf;av.settings={};av.collections={};av.rulesets={};av.notices={};av.ruleset=null;av.collection=null;av.roster=new L("1");av.focus=null;av.init=function(){delete av.init;var ch=document.getElementById("-loading-");var ci=document.getElementById("-loading-progress-");var cj=ci.parentNode.offsetWidth;var ck=0;var cl=0;var cm=0;cn();co();function cn(){var cy=100;var cz=setInterval(cA,50);ck+=cy;var cB=0;var cC=new XMLHttpRequest();cC.open("GET","io?init",true);cC.send(null);function cA(){if(cy==0&&cC.readyState==4){clearInterval(cz);bY(cC.responseText);return;}if(cC.readyState==4){cl+=cy;cy=0;}else  if(cy>0){cl++;cy--;}}}function co(){var cy=setInterval(function(){if(cm<=cl){cm+=(cl>=ck?2:0.25);ci.style.width=(cj*Math.min(cm,ck)/ck)+"px";}else  if(cm>ck){clearInterval(cy);cp();}},1);}function cp(){ax.push(document.getElementById("-tdA-"));ax.push(document.getElementById("-tdB-"));ax.push(document.getElementById("-tdC-"));aC=document.title;aD=document.getElementById("-main-");aJ=document.getElementById("-balloon-leftArrow-");aK=document.getElementById("-balloon-left-");aL=document.getElementById("-balloon-rightArrow-");aM=document.getElementById("-balloon-right-");aw.balloon={box:document.getElementById("-balloon-"),reset:c};aw.balloon.box.onmouseover=bT;aO=document.getElementById("-summary-");aP=document.getElementById("-tabs-");aQ=document.getElementById("-counts-");aR=document.getElementById("-counts-collection-");aS=document.getElementById("-counts-roster-");aT=bH(document.getElementById("-inRosterButtons-"));aU=bL(document.getElementById("-inRosterButtons-"));var cy=document.getElementById("-dossier-");cy.oninit=bg;ay.push(cy);aw.dossier={frame:cy,title:document.getElementById("-pageTitle-"),subtitle:document.getElementById("-pageSubtitle-"),icon:document.getElementById("-pageIcon-"),iconText:document.getElementById("-pageIconText-"),inCollection:document.getElementById("-inCollection-"),inRoster:document.getElementById("-inRoster-")};aW=document.getElementById("-leftPane-");aZ=document.getElementById("-leftPane-prev-");ba=document.getElementById("-leftPane-next-");aw.browsePane={panels:aX,addPanel:by,prepareList:bw};bb=document.getElementById("-rosterOptions-");var cz=u(bb,"");o(cz,"fixed","list-options","dn");cz.title="Ruleset";cz.style.marginBottom="6px";cz.onmousedown=cr;cz.panel=new w();cz.panel.owner=cz;r(cz.panel);var cA=0;var cB="";for(var cC in av.rulesets){var cD=av.rulesets[cC];cq(cz,cD);if(cD.initial||!cB)cB=cD.id;cA++;}if(cA<=1)cz.style.display="none";bd=document.getElementById("-validatorA-");be=document.getElementById("-validatorB-");bf=document.getElementById("-validatorMessages-");var cE=document.getElementById("-buildOptions-");r(cE);cE.onmousedown=cu;cE.panel=w();cE.panel.content.style.minWidth="60px";r(cE.panel);ct(cE,"Clear",cw);ct(cE,"Print...",cx);var cF=document.getElementById("-build-");cF.oninit=bh;ay.push(cF);aw.buildPane={};au["Home"]=new cd();au["Stuff"]=new ce();aj(aw);for(var cG in au){var cH=au[cG];cH.tabstrip=new cg(aP,cH.tabstrip);cH.summary=document.getElementById(cG);cH.summary.removeAttribute("id");cH.summary.parentNode.removeChild(cH.summary);if(cH.initialize)cH.initialize();}av.populateChildPage(cy.contentWindow);av.populateChildPage(cF.contentWindow);if(av.onload!=null)av.onload();ch.style.display="none";aD.style.display="";ca();var cI=cz.panel.content.firstChild;while(cI){if(cI.ruleset==cB){cI.onclick();break;}cI=cI.nextSibling;}window.onresize=av.resize;document.onmousedown=w.hide;setInterval(ca,333);}function cq(cy,cz){var cA=h(cy.panel.content,"div","menu-item",cz.name);cA.panel=cy.panel;cA.ruleset=cz.id;cA.onclick=cs;return cA;}function cr(cy){cy=s(this,cy);cy.stopPropagation();this.panel.show(this,"dn-lf");}function cs(){this.panel.hide();this.panel.owner.text.innerHTML=this.innerHTML;av.setRuleset(this.ruleset);}function ct(cy,cz,cA,cB){var cC=h(cy.panel.content,"div","menu-item",cz);cC.panel=cy.panel;cC.title=cB||"";cC.action=cA;cC.onclick=cv;return cC;}function cu(cy){cy=s(this,cy);cy.stopPropagation();this.panel.show(this,"up-lf");}function cv(){this.panel.hide();if(this.action)this.action();}function cw(){ap(av.roster);}function cx(){window.open(ai.printRosterPage);}};function bg(){var ch=this.contentWindow;var ci=ch.document;ch.onresize=cc;aV=ci.getElementById("-content-");for(var cj in au){var ck=au[cj];ck.content=ci.getElementById(cj);ck.content.removeAttribute("id");ck.content.parentNode.removeChild(ck.content);}if(aB){aV.appendChild(aB.content);bi();var cl=aB.tabstrip.focusTab;var cm=ci.getElementById(cl.tabId);cm.style.display="";}}function bh(){var ch=this.contentWindow.document;ch.onmouseover=bT;bc=ch.getElementById("-list-");al(bc);}av.registerTd=function(ch){ax.push(ch);};av.resize=function(){var ch=ax.length;var ci=ay.length;ax.sort(function(cr,cs){return (cs.offsetHeight-cr.offsetHeight);});for(var cj=0;cj<ci;cj++){var ck=ay[cj];var cl=ck.contentWindow.document;if(cl.body)ck.prevBodyScrollTop=cl.body.scrollTop||0;if(cl.documentElement)ck.prevDocScrollTop=cl.documentElement.scrollTop||0;}for(var cj=0;cj<ch;cj++){var cm=ax[cj];cb(cm);}var cn=window.innerHeight||document.documentElement.clientHeight;var co=aD.offsetHeight;var cp=co-cn;if(cp!=0){for(var cj=0;cj<ch;cj++){var cm=ax[cj];try{cm.style.height=(cm.offsetHeight-cp)+"px";}catch(cq){}}for(var cj=0;cj<ci;cj++){var ck=ay[cj];var cl=ck.contentWindow.document;if(cl.body)cl.body.scrollTop=ck.prevBodyScrollTop;if(cl.documentElement)cl.documentElement.scrollTop=ck.prevDocScrollTop;}}};av.getSettings=function(ch){var ci=av.settings[ch];if(ci==null){ci=new F(ch);av.settings[ch]=ci;}return ci;};av.replicateTheme=function(ch){var ci=ch.document.getElementById("-theme-");if(ci){var cj=document.getElementById("-theme-").href;ci.href=cj;}};av.populateChildPage=function(ch){ay.some(function(ci){if(ci.contentWindow.init===ch.init){ci.contentWindow.document.onmousedown=w.hide;if(ci.oninit)ci.oninit();return true;}});};av.populatePrintRosterPage=function(ch){at(ch);};av.showObject=function(ch){if(!ch||ch===av.focus)return;if(aB)bl();av.focus=ch;var ci=(typeof ch=="string"?ch:ch.objectType);var cj=aB;var ck=au[ci];if(ck!==cj){if(cj){cj.tabstrip.style.display="none";cj.summary.parentNode.removeChild(cj.summary);cj.content.parentNode.removeChild(cj.content);}ck.tabstrip.style.display="";aO.appendChild(ck.summary);aV.appendChild(ck.content);aB=ck;}if(ci=="Home"){document.title="Battleplan for "+ai.gameName;bi();aA=ch;}else  if(ci=="Stuff"){document.title="Your Stuff - "+aC;bi();aA=ch;}else {document.title=ch.name+" - "+aC;bi();aA=as(ch);}if(aA=="Home"){if(location.hash)location.hash="#";}else  if(location.hash!="#"+aA){location.hash="#"+aA;}try{pageTracker._trackEvent(ai.gameId+"/ShowObject",aA);}catch(cl){}if(!aB.tabstrip.focusTab){for(var cm in aB.tabstrip.tabs){av.setDossierTab(cm);break;}}else {bk();}am(bc,av.roster);bj();aX[aY].update();av.resize();};av.setDossierTab=function(ch){var ci=aw.dossier.frame.contentWindow.document;var cj=aB.tabstrip.tabs[ch];if(cj==null){return;}var ck=aB.tabstrip.focusTab;if(cj===ck)return;if(ck){bl();var cl=ci.getElementById(ck.tabId);ck.clearFocus();cl.style.display="none";}var cm=ci.getElementById(cj.tabId);cj.setFocus();cm.style.display="";aB.tabstrip.focusTab=cj;bk();ci.window.focus();};av.setRuleset=function(ch){aG&&aG.foreach(function(cm){cm.parentNode.removeChild(cm);});var ci=av.rulesets[ch];av.ruleset=ci;aG=[];aH={};ci.fields.foreach(function(cm){var cn=new v(bb,cm.label);cn.field=cm;aG.push(cn);});for(var cj in ci.variables){var ck=ci.variables[cj];var cl=ck.dfault;if(cl==null){if(ck.type=="Boolean")cl=false;else cl=0;}aH[cj]=ck.dfault;}bo();};av.setCollection=function(ch){var ci=av.collections[ch];av.collection=ci;if(ci){ci.register(bo);bW(ci);}};function bi(){if(aB.populateDossier)aB.populateDossier();}function bj(){if(aB.updateDossier)aB.updateDossier();if(av.focus.isEnlistable){aS.style.display="";aT.object=av.focus;aT.update();aU.object=av.focus;aU.update();}else {aS.style.display="none";}if(aR.style.display=="none"&&aS.style.display=="none"){aQ.style.display="none";}else {aQ.style.display="";var ch=aQ.parentNode.parentNode;ch.style.width=(aP.parentNode.offsetWidth+aQ.parentNode.offsetWidth+3)+"px";}}function bk(){if(aB.activateDossierTab)aB.activateDossierTab();}function bl(){if(aB.deactivateDossierTab)aB.deactivateDossierTab();}aw.generateLayoutHtml=bm;function bm(ch){if(ch==null)return "";return ch.meld("",function(ci){var cj="";switch(ci.type){case "columns":var ck=ci["columnA"];var cl=ci["columnB"];var cm=ci["columnC"];cj="<table cellspacing=\"0\" class=\"block\"><tr>";switch(ci["layout"]){case "25-75":cj+="<td class=\"cL w25\">"+bm(ck)+"</td>"+"<td class=\"cR w75\">"+bm(cl)+"</td>";break;case "33-66":cj+="<td class=\"cL w33\">"+bm(ck)+"</td>"+"<td class=\"cR w66\">"+bm(cl)+"</td>";break;case "40-60":cj+="<td class=\"cL w40\">"+bm(ck)+"</td>"+"<td class=\"cR w60\">"+bm(cl)+"</td>";break;case "50-50":cj+="<td class=\"cL w50\">"+bm(ck)+"</td>"+"<td class=\"cR w50\">"+bm(cl)+"</td>";break;case "60-40":cj+="<td class=\"cL w60\">"+bm(ck)+"</td>"+"<td class=\"cR w40\">"+bm(cl)+"</td>";break;case "66-33":cj+="<td class=\"cL w66\">"+bm(ck)+"</td>"+"<td class=\"cR w33\">"+bm(cl)+"</td>";break;case "75-25":cj+="<td class=\"cL w75\">"+bm(ck)+"</td>"+"<td class=\"cR w25\">"+bm(cl)+"</td>";break;case "25-50-25":cj+="<td class=\"cL w25\">"+bm(ck)+"</td>"+"<td class=\"cM w50\">"+bm(cl)+"</td>"+"<td class=\"cR w25\">"+bm(cm)+"</td>";break;case "33-33-33":cj+="<td class=\"cL w33\">"+bm(ck)+"</td>"+"<td class=\"cM w33\">"+bm(cl)+"</td>"+"<td class=\"cR w33\">"+bm(cm)+"</td>";break;}cj+="</tr></table>";break;case "text":cj="<div class=\"block\">"+"<h2>"+ci["caption"]+"</h2>"+ci["body"]+"</div>";break;case "#news":cj="<div class=\"block\">"+"<h2>News</h2>"+"<iframe id=\"feed\" src=\"/feed\" style=\"display: none;\"></iframe>"+"</div>";break;case "#tip":try{var cn=av.settings["Dossier/Home/Summary/Tip"]["tip"];cj="<div class=\"block\">"+"<h2>Tip</h2>"+"<p>"+cn+"</p>"+"</div>";}catch(co){}break;}return cj;});}aw.patchHtml=bn;function bn(ch,ci){if(ci!=null)ch.innerHTML=ci;switch(ch.nodeName){case "A":var cj=ch.getAttribute("oref");if(cj){ch.removeAttribute("oref");ch.setAttribute("href",location.pathname+"#"+cj);ch.setAttribute("target","_top");ch.onclick=ck;}else {ch.setAttribute("target","_blank");}break;}for(var cl=0,cm=ch.childNodes.length;cl<cm;cl++){var cn=ch.childNodes[cl];if(cn.nodeType==1)bn(cn);}function ck(){var co=this.href.split("#")[1];location.hash=co;return false;}}aw.updateRoster=bo;function bo(){var ch=av.ruleset;var ci=av.roster.isEmpty();aF=new B.Interpreter(ch.constants,aH,aw.getRosterValues());aI={};var cj=aF.root;aG.foreach(function(cp){var cq=cp.field;cp.value.innerHTML=bq(cq.value,cj);br(cp.value);q(cp,!ci&&cq.warn&&cj.eval(cq.warn),"warn");});bf.innerHTML="";if(!ci){var ck=ch.rules;ck&&cl(ck,cj);}if(bf.innerHTML==""){bd.style.display="none";be.style.display="none";}else {bd.style.display="";be.style.display="";}am(bc,av.roster);bj();aX[aY].update();av.resize();function cm(cp,cq){var cr=true;cp.foreach(function(cs){if(cs instanceof Array)cr&=cl(cs,cq);else cr&=cn(cs,cq);});return cr;}function cl(cp,cq){return !cp.some(function(cr){if(cr instanceof Array)return !cm(cr,cq);else return !cn(cr,cq);});}function cn(cp,cq){if(cp.constants)cq=cq.createScope(cp.constants);var cr=cq.eval(cp.test);if(cr){if(cp.pass&&cp.pass.text)co(cp.pass.text,cp.pass.details,cq);return true;}else {if(cp.fail&&cp.fail.text)co(cp.fail.text,cp.fail.details,cq);return false;}}function co(cp,cq,cr){cp=bq(cp,cr);cq=bq(cq||"",cr);var cs=h(bf,"div",null,cp);cs.title=cq;cs.style.color="#F5D2CE";cs.style.background="#C21";cs.style.textIndent="-10px";cs.style.borderRadius="2px";cs.style.MozBorderRadius="2px";cs.style.margin="1px 0";cs.style.padding="0 2px 0 12px";}}var bp=/{.*?}/g;function bq(ch,ci){var cj=ch.match(bp);cj&&cj.foreach(function(ck){var cl=ck.substr(1,ck.length-2);var cm=ci.resolve(cl);ch=ch.replace(ck,cm);});return ch;}function br(ch){if(ch.nodeName=="A"){var ci=ch.getAttribute("var");if(ci){var cj=ch.parentNode;var ck=h(cj,"span","udot");h(ck,"span",null,ch.innerHTML);ck.varname=ci;cl(ch,ck,"title");ck.onclick=bs;cj.insertBefore(ck,ch);cj.removeChild(ch);}}var cm=ch.childNodes;for(var cn=0,co=cm.length;cn<co;cn++)br(cm[cn]);function cl(cp,cq,cr){var cs=cp.getAttribute(cr);if(cs)cq.setAttribute(cr,cs);}}function bs(){var ch=av.ruleset;var ci=this.varname;var cj=aF.root;var ck=aH[ci];if(ck==Infinity)ck="";var cl=ch.variables[ci];var cm=bq(cl.query,cj);var cn=[ "Did you do that on purpose?", "Please have another go at it.", "But I'm sure you'll get it right next time.", "But don't worry, you'll get to you try it again.", "If at first you don't succeed, try, try again.", "Oh, and number words don't work, FYI.", "Just take your time entering it. I'm not in a hurry." ];while(true){var ck=prompt(cm,ck);if(ck==null)return;if(ck==""){ck=Infinity;break;}var co=Number(ck);if(!isNaN(co)){ck=co.toInt();break;}alert("\""+ck+"\" is not a valid number. "+cn[Math.floor(Math.random()*cn.length)]);}if(cl.min!=null){var cp=cj.eval(cl.min);if(ck<cp)ck=cp;}if(cl.max!=null){var cq=cj.eval(cl.max);if(ck>cq)ck=cq;}aH[ci]=ck;bo();}aw.setupListRow=bt;function bt(ch,ci,cj){if(!cj)cj=function(ck){return ck;};ch.value=ci;ch.onclick=function(){av.showObject(cj(ch.value));bT();};ch.onselectstart=d;ch.onmousedown=d;return ch;}aw.setupListRowWithBalloon=bu;function bu(ch,ci,cj,ck){if(!cj)cj=function(cl){return cl;};var ch=bt(ch,ci,cj);ch.onmouseover=function(cl){cl=s(this,cl);cl.stopPropagation();var cm=aw.balloon;var cn=cj(ch.value);if(cm.box.style.display==""){if(av.focus===cn)bT();else co();}else {clearTimeout(az);if(av.focus!==cn)az=setTimeout(co,750);}function co(){bS(cm,cn,ch,ck);}};ch.onmouseout=function(cl){cl=s(this,cl);bT();};return ch;}aw.groupItems=bv;function bv(ch,ci,cj,ck){var cl=bv(0,ch);if(cl==null){var cm=[];for(var cn in ch)cm.push(ch[cn]);cm.sort(cj);cl=[ { text: ck, items: cm } ];}return cl;function bv(co,cp){var cq=ci[co];for(var cr=co-1;cr>=0;cr--){if(ci[cr]===cq){cq=null;break;}}co++;if(!cq){if(co<ci.length)var cs=bv(co,cp);else var cs=null;}else {var cs=cq.getGroups(cp,cj);if(co<ci.length)ct(co,cs);}return cs;function ct(cu,cv){cv.foreach(function(cw){if(cw.subgroups!=null)ct(cu,cw.subgroups);else cw.subgroups=bv(cu,cw.items);});}}}function bw(ch,ci,cj,ck,cl){if(cl==null)cl=true;k(ch);var cm=new W(ch);ch.list=cm;cn();var co=cm.addDivider(null,null,"note");co.cellA.innerHTML=cj;cm.note=co;ci.foreach(function(cr){cp(null,cr);});function cn(){var cr=bt(cm.addItem(),"Home");cr.cellA.innerHTML="Briefing Room";cr.special=true;cm.addDivider(null,null,"line");}function cp(cr,cs){var ct=cm.addGroup(cr);ct.style.display="none";ct.visibleItems=0;ct.groupText=cs.text;if(cs.subgroups!=null){cs.subgroups.foreach(function(cu){var cv=cp(ct,cu);});ct.spacer=ct;}else {cs.items.foreach(function(cu){cq(ct,cu);});ct.spacer=cm.addDivider(ct,null,"space");ct.spacer.style.display="none";}return ct;}function cq(cr,cs){var ct=(cl?bu(cm.addItem(cr),cs):bt(cm.addItem(cr),cs));ct.style.display="none";ck(ct,ct.cellA,0,cs);ck(ct,ct.cellB,1,cs);return ct;}}function bx(ch,ci){if(!ch)return;var cj=ch.list;var ck=cj.rows;var cl=ck.length;var cm=cl;for(var cn=0;cn<cl;cn++){var co=ck[cn];if(co.type!="I"){cm--;continue;}var cp=co.value;if(co.special){cm--;}else {var cq=ci(cp);if(cq>=3){cr(co);cm--;continue;}}cs(co);var ct="";switch(cq){case 1:break;case 2:o(co,"faded");break;default:p(co,"light","faded");break;}q(co,(cp===av.focus),"focus");if(co.update)co.update();}cj.note.style.display=(cm>0?"none":"");function cs(cu){if(cu.style.display!="none")return;cu.style.display="";var cv=cu.parent;while(cv){cv.visibleItems++;cv.style.display="";cv.spacer.style.display="";cv.cellA.innerHTML=cv.groupText+" ["+cv.visibleItems+"]";cv=cv.parent;}}function cr(cu){if(cu.style.display=="none")return;cu.style.display="none";var cv=cu.parent;while(cv){cv.visibleItems--;if(cv.visibleItems>0){cv.cellA.innerHTML=cv.groupText+" ["+cv.visibleItems+"]";}else {cv.style.display="none";cv.spacer.style.display="none";}cv=cv.parent;}}}function by(ch,ci){var cj=new cf(aW,ch);cj.update=bz;cj.setFilter=bA;aX.push(cj);ay.push(cj.iframe);if(aX.length>1){if(ci){var ck=aX[aY];ck.table.style.visibility="hidden";ck.table.style.zIndex=-1;aY=aX.length-1;}else {cj.table.style.visibility="hidden";cj.table.style.zIndex=-1;}aZ.style.display="";aZ.onclick=bB;aZ.onselectstart=d;aZ.onmousedown=d;ba.style.display="";ba.onclick=bC;ba.onselectstart=d;ba.onmousedown=d;}return cj;}function bz(){switch(this.filter){case "f":var ch=function(ci){return (bE(ci).substr(0,1)=="~"?2:0);};break;case "h":var ch=function(ci){return (bE(ci).substr(0,1)=="~"?3:0);};break;default:var ch=function(ci){return 0;};break;}bx(this.list,ch);}function bA(ch){if(ch!=this.filter){this.filter=ch;this.update();}}function bB(){bD(aY-1);}function bC(){bD(aY+1);}function bD(ch){if(ch==aY)return;var ci=aX.length;if(ch<0)ch+=ci;else  if(ch>=ci)ch-=ci;var cj=aX[ch];cj.table.style.visibility="";cj.table.style.zIndex="";cj.update();var cj=aX[aY];cj.table.style.visibility="hidden";cj.table.style.zIndex=-1;aY=ch;}function bE(ch){var ci=aI[ch.id];if(ci==null){ci=aF.root.resolve(av.ruleset.queryObjectStatus,[ ch ]);aI[ch.id]=ci;}return ci;}aw.canAddToRoster=bF;function bF(ch){var ci=bE(ch);return (ci.substr(0,1)!="-");}aw.canRemoveFromRoster=bG;function bG(ch){var ci=bE(ch);return (ci.substr(1,1)!="-");}aw.createAddToRosterButton=bH;function bH(ch,ci,cj,ck){var cl=h(ch,"img");cl.src="/res/o.gif";cl.alt="+";cl.className="add disabled";cl.onmouseover=bP;cl.onclick=bQ;cl.ondblclick=bR;cl.update=bK;if(ci)cl.object=ci;cl.queryStatus=cj||bI;cl.activate=ck||bJ;cl.update();return cl;}function bI(){if(!aF||!this.object)return 0;var ch=bE(this.object);switch(ch.substr(0,1)){case "-":return 0;case "~":return -1;default:return 1;}}function bJ(){an(this.object,av.roster);}function bK(){var ch=(this.queryStatus?this.queryStatus():0);if(!ch){o(this,"disabled");p(this,"inapt");this.title="";}else  if(ch<0){p(this,"disabled");o(this,"inapt");this.title="Add one (will invalidate)";}else {p(this,"disabled","inapt");this.title="Add one";}}aw.createRemoveFromRosterButton=bL;function bL(ch,ci,cj,ck){var cl=h(ch,"img");cl.src="/res/o.gif";cl.alt="-";cl.className="remove disabled";cl.onmouseover=bP;cl.onclick=bQ;cl.ondblclick=bR;cl.update=bO;if(ci)cl.object=ci;cl.queryStatus=cj||bM;cl.activate=ck||bN;cl.update();return cl;}function bM(){if(!aF||!this.object)return 0;var ch=bE(this.object);switch(ch.substr(1,1)){case "-":return 0;case "~":return -1;default:return 1;}}function bN(){ao(this.object,av.roster);}function bO(){var ch=(this.queryStatus?this.queryStatus():0);if(!ch){o(this,"disabled");p(this,"inapt");this.title="";}else  if(ch<0){p(this,"disabled");o(this,"inapt");this.title="Remove one (will invalidate)";}else {p(this,"disabled","inapt");this.title="Remove one";}}function bP(ch){bR.call(this,ch);bT();}function bQ(ch){bR.call(this,ch);if(this.activate)this.activate();}function bR(ch){var ch=s(this,ch);ch.stopPropagation();}function bS(ch,ci,cj,ck){clearTimeout(az);if(ci===aN)return;aN=ci;aK.style.height="";aM.style.height="";var cl=ch.box;cl.style.display="";var cm=au[ci.objectType];if(!cm)alert("Error! No view for type '"+ci.objectType+"'.");else  if(cm.populatePopupBalloon)cm.populatePopupBalloon(ch,ci);cb(aK);cb(aM);var cn=t(cj,true);var co=cn.top+cj.offsetHeight/2;var cp=cl.offsetHeight;var cq=cp/2;var cr=window.top.clientHeight||window.document.documentElement.clientHeight;if(ck){var cs=aL;var ct=aM;var cu=aJ;cl.style.left=(cn.left-cl.offsetWidth)+"px";}else {var cs=aJ;var ct=aK;var cu=aL;cl.style.left=(cn.left+cj.offsetWidth)+"px";}if(co-cq<0){if(cl.className!="balloon-top-adjust")cl.className="balloon-top-adjust";cl.style.top=co+"px";ct.style.verticalAlign="top";}else  if(co+cq>cr){if(cl.className!="balloon-bottom-adjust")cl.className="balloon-bottom-adjust";cl.style.top=(co-cp)+"px";ct.style.verticalAlign="bottom";}else {if(cl.className!="")cl.className="";cl.style.top=(co-cq)+"px";ct.style.verticalAlign="middle";}cs.style.visibility="";cu.style.visibility="hidden";cl.style.visibility=(ci===av.focus?"hidden":"");}function bT(){clearTimeout(az);az=setTimeout(function(){aw.balloon.box.style.visibility="hidden";clearTimeout(az);az=setTimeout(function(){aw.balloon.box.style.display="none";z(aw.balloon.box);aN=null;},250);},1);}aw.waitForObjectDetails=bU;function bU(ch,ci,cj){if(cj)var ck=setTimeout(cl,125);if(ci)ch.register(cm);function cl(){if(av.focus!==ch)return;cj();}function cm(){if(av.focus!==ch||!ch.loaded)return;clearTimeout(ck);ci();}}aw.loadObjectDetails=bV;function bV(ch,ci){if(ch.loaded!=null)return;ch.loaded=false;ch.notify();var cj=new XMLHttpRequest();cj.onreadystatechange=ck;cj.open("GET",ci,true);cj.send(null);function ck(){if(this.readyState==4){if(this.status==200)bY(this.responseText);else ch.loaded=null;ch.notify();}}}function bW(ch){ch.clear();var ci="io?cid="+ch.id;bV(ch,ci);}function bX(ch){var ci="io?sid="+ch.id;bV(ch,ci);}function bY(ch){var ci=JSON.parse(ch);var cj=ci["collection-list"];cj&&cj.foreach(function(ck){var cl=ck[0];var cm=ck[1];var cn=new H(cl,cm);av.collections[cl]=cn;});var cj=ci["collection-details"];cj&&cj.foreach(function(ck){if(!ck)return;var cl=ck["id"];if(!cl)return;var cm=av.collections[cl];if(!cm)return;cm.loaded=true;});var cj=ci["notices"];cj&&cj.foreach(function(ck){var cl=ck["id"];if(!cl)return;var cm=ck["text"]||"";av.notices[cl]=cm;});var cj=ci["ruleset-details"];cj&&cj.foreach(function(ck){if(!ck)return;var cl=ck["id"];if(!cl)return;var cm=ck["name"];var cn=new M(cl,cm);cn.description=ck["description"]||"";cn.initial=ck["initial"]||false;var co=ck["fields"];co&&co.foreach(function(cE){var cF=cE["label"];var cG=cE["value"];var cH=cE["options"];var cI=cE["warn"];var cE=cn.addField(cF,cG);if(cH)cE.options=cH;if(cI)cE.warn=aE.parse(cI,"");});var cp=ck["rules"];cp&&cq(cp,cn.rules);var cr=ck["filter"];if(cr)cn.filter=cs(cr,"");var ct=ck["variables"];if(ct){for(var cm in ct){var cu=ct[cm];var cv=cu["type"];var cw=cu["default"];var cx=cu["min"];var cy=cu["max"];var cz=cu["query"];switch(cv){case "Boolean":cw=Boolean(cw);break;case "Integer":cw=Number(cw).toInt();break;case "Number":cw=Number(cw);break;default:cw=0;}var cu=cn.addVariable(cm,cv,cw);if(cz)cu.query=cz;if(cx!=null)cu.min=aE.parse(cx,"");if(cy!=null)cu.max=aE.parse(cy,"");}}var cA=ck["constants"];if(cA)cn.constants=cB(cA);var cC=ck["queryObjectStatus"];if(cC)cn.queryObjectStatus=cC;av.rulesets[cl]=cn;function cq(cE,cF){cE.foreach(function(cG){if(cG instanceof Array){var cH=[];cF.push(cH);cq(cG,cH);return;}var cI=cG["test"];var cJ=cG["pass"];var cK=cG["fail"];var cL=cG["constants"];cI=aE.parse(cI,"");if(cJ)cJ=cD(cJ);if(cK)cK=cD(cK);var cG=new P(cI,cJ,cK);if(cL)cG.constants=cB(cL);cF.push(cG);});}function cD(cE){var cF=cE["text"];var cG=cE["details"];var cH=cE["cause"];var cI=cE["options"];var cJ=cE["subrules"];var cK=cE["constants"];var cE=new Q(cF);if(cG)cE.details=cG;if(cH)cE.cause=cs(cH);if(cK)cE.constants=cB(cK);cI&&cI.foreach(function(cL){var cM=cL["for"];var cN=cL["as"];var cO=cL["text"];var cP=cL["add"];var cQ=cL["remove"];var cR=cL["assign"];var cS=cL["constants"];var cL=cE.addOption(cO);if(cP)cL.add=cs(cP);if(cQ)cL.remove=cs(cQ);if(cS)cL.constants=cB(cS);if(cM){cL.forExpr=aE.parse(cM,"");cL.asVar=cN;}if(cR){cL.assign={};for(var cT in cR){var cU=cR[cT];cL.assign.push({lval:aE.parse(cT),rval:aE.parse(cU)});}}});if(cJ){cE.subrules=[];cq(cJ,cE.subrules);}return cE;}function cB(cE){var cF={};for(var cG in cE)cF[cG]=cs(cE[cG],"");return cF;}function cs(cE){if(typeof cE=="string")return aE.parse(cE,"");cE["return"]=aE.parse(cE["return"],"");var cF=cE["constants"];if(cF){for(var cG in cF)cF[cG]=aE.parse(cF[cG],"");}return cE;}});var cj=ci["settings"];cj&&cj.foreach(function(ck){if(!ck)return;var cl=ck["id"];if(!cl)return;var cm=av.getSettings(cl);for(var cn in ck)cm[cn]=ck[cn];cm.loaded=true;});ak(ci);}function bZ(ch,ci,cj){var ck=cj;ch.foreach(function(cm){var cn=cm.criteria.some(function(co){return cl(co,ci);});if(cn)ck=bZ(cm.subrules,ci,cm.style);});return ck;function cl(cm,cn){var co=aq(cn,cm.property);if(co==null)return false;var cp=cm.value;switch(cp){case "false":cp=0;break;case "true":cp=1;break;case "collection.qty":case "army.qty":case "army.remainingPoints":case "army.remainingSpaces":cp=aq(cn,cp);break;}if(typeof(co)=="number"){co=Number(co);cp=Number(cp);}else {co=co.toString().toLowerCase();cp=cp.toString().toLowerCase();}var cq=false;switch(cm.op){case "=":cq=(co==cp);break;case ">":cq=(co>cp);break;case "<":cq=(co<cp);break;case "s*":cq=co.startsWith(cp);break;case "*s":cq=co.endsWith(cp);break;case "s?":cq=(co.indexOf(cp)!=-1);break;default:return false;}return (cm.not?!cq:cq);}}function ca(){av.resize();var ch=location.hash.substr(1)||"Home";if(ch!=aA){if(ch=="Home"||ch=="Stuff"){var ci=ch;}else {ch=ch.split("/");var ci=(ch.length==1?ar("",ch[0]):ar(ch[0],ch[1]));if(ci==null)ci="Home";}av.showObject(ci);}}function cb(ch){var ci=ch.parentNode.parentNode.parentNode;var cj=ci.parentNode;if(ci.offsetHeight<cj.offsetHeight){var ck=ci.offsetHeight-ch.offsetHeight;try{ch.style.height=(cj.offsetHeight-ck)+"px";}catch(cl){}}}function cc(){if(aB&&aB.resizeDossier)aB.resizeDossier();}function cd(){this.tabstrip={"summary":"Summary"};this.populateDossier=function(){var ch=aw.dossier;ch.title.innerHTML="Briefing Room";ch.subtitle.innerHTML="";ch.icon.src="res/icon.png";ch.icon.alt="";ch.icon.title="";ch.iconText.style.display="none";ch.iconText.innerHTML="";};this.updateDossier=function(){};this.activateDossierTab=function(){switch(this.tabstrip.focusTab.tabId){case "summary":var ch=av.getSettings("Dossier/Home/Summary");ch.register(function(){if(this.loaded){var ci=aB.content.ownerDocument;var cj=ci.getElementById("summary");cj.innerHTML=bm(ch["layout"]);bn(cj);}});bX(ch);break;case "playing":break;}};}function ce(){this.tabstrip={"settings":"Settings","collections":"Collections"};this.populateDossier=function(){var ch=aw.dossier;ch.title.innerHTML="Your Stuff";ch.subtitle.innerHTML="";ch.icon.src="res/icon.png";ch.icon.alt="";ch.icon.title="";ch.iconText.style.display="none";ch.iconText.innerHTML="";};this.updateDossier=function(){};}function cf(ch,ci){var cj=h(ch,"table","panel");cj.cellSpacing=0;cj.cellPadding=0;this.table=cj;var ck=h(cj,"tbody");var cl=h(ck,"tr");var cm=h(cl,"td","caption",ci);cm.style.height="1px";this.caption=cm;var cl=h(ck,"tr");var cm=h(cl,"td","info");cm.style.height="1px";var cn=h(cm,"div");cn.style.width="100%";this.options=cn;co(ck);this.iframe=cp(ck);this.list=this.iframe.contentWindow.document.getElementById("-list-");this.update=c;function co(cq){var cr=h(cq,"tr");var cs=h(cr,"td","vsplit");h(cs,"div");return cr;}function cp(cq){var cr=h(cq,"tr");var cs=h(cr,"td");System.registerTd(cs);var ct=cs.ownerDocument.createElement("iframe");ct.style.display="block";ct.style.width="100%";ct.style.height="100%";ct.frameBorder="no";ct.allowTransparency="true";ct.src="?r=list";cs.appendChild(ct);return ct;}}function cg(ch,ci){var cj={};var ck=ch.insertRow(-1);r(ck);ck.style.display="none";ck.tabs=cj;var cl=ck.insertCell(-1);cl.className="tab-lend";h(cl,"div");var cm=0;for(var cn in ci)cm++;if(cm==1){for(var cn in ci){var co=ck.insertCell(-1);co.className="tab-name";co.innerHTML="<nobr>"+ci[cn]+"</nobr>";co.tabId=cn;co.onclick=function(){System.setDossierTab(this.tabId);};co.setFocus=cp;co.clearFocus=cq;var cl=ck.insertCell(-1);cl.className="tab-rend";h(cl,"div");cj[cn]=co;}}else {var cr=0;for(var cn in ci){var co=ck.insertCell(-1);co.className="tab-name";co.innerHTML="<nobr>"+ci[cn]+"</nobr>";co.tabId=cn;co.onclick=function(){System.setDossierTab(this.tabId);};var cl=ck.insertCell(-1);h(cl,"div");if(cr==0){co.setFocus=cs;co.clearFocus=ct;cl.className="tab-lend";}else  if(cr==cm-1){co.setFocus=cu;co.clearFocus=cv;cl.className="tab-rend";}else {co.setFocus=cw;co.clearFocus=cx;cl.className="tab-mid";}cj[cn]=co;cr++;}}return ck;function cp(){this.className="tab-name focused";this.previousSibling.className="tab-lend focused";this.nextSibling.className="tab-rend focused";}function cs(){this.className="tab-name focused";this.previousSibling.className="tab-lend focused";this.nextSibling.className="tab-mid focusedR";}function cw(){this.className="tab-name focused";this.previousSibling.className="tab-mid focusedL";this.nextSibling.className="tab-mid focusedR";}function cu(){this.className="tab-name focused";this.previousSibling.className="tab-mid focusedL";this.nextSibling.className="tab-rend focused";}function cq(){this.className="tab-name";this.previousSibling.className="tab-lend";this.nextSibling.className="tab-rend";}function ct(){this.className="tab-name";this.previousSibling.className="tab-lend";this.nextSibling.className="tab-mid";}function cx(){this.className="tab-name";this.previousSibling.className="tab-mid";this.nextSibling.className="tab-mid";}function cv(){this.className="tab-name";this.previousSibling.className="tab-mid";this.nextSibling.className="tab-rend";}}};function U(ai,aj){var ak=[];ai.style.cursor="default";var al={};var am=ai.insertRow(-1);al.row=am;var an=am.insertCell(-1);an.style.width="1px";an.style.verticalAlign="middle";var ao=h(an,"img","expand");ao.src="/res/o.gif";ao.alt="";var ap=ao;var an=am.insertCell(-1);an.style.padding="1px 2px 0";an.innerHTML=aj[0];al.label=an;var an=am.insertCell(-1);an.style.padding="1px 0 0";an.style.textAlign="right";al.value=an;ak.push(al);var aq=ai.insertRow(-1);var an=aq.insertCell(-1);var an=aq.insertCell(-1);an.colSpan=2;var ar=1;while(ar < aj.length){var as=aj[ar];var al={};var at=h(an,"div");at.style.marginBottom="1px";at.style.paddingLeft="3px";at.style.fontSize="8pt";at.style.background="#F2F2F2";al.row=at;var au=h(at,"div",null,as);au.style.cssFloat="left";au.style.styleFloat="left";al.label=au;var au=h(at,"div",null,"-");au.style.textAlign="right";al.value=au;ak.push(al);ar++;}am.onclick=function(){if(aq.style.display=="none"){ap.className="collapse";aq.style.display="";}else {ap.className="expand";aq.style.display="none";}System.resize();};aq.style.display="none";ak[0].toggle=am.onclick;return ak;}function V(ai,aj,ak){var al=this;var am;var an=ai.insertRow(-1);an.className="options"+(ak?" "+ak:"");al.row=an;var ao=an.insertCell(-1);ao.className="label";ao.style.width="1px";ao.innerHTML=aj;al.label=ao;var ao=an.insertCell(-1);ao.className="value";var ap=u(ao,aj);o(ap,"fixed","list-options","rt");ap.onmousedown=aq;var ar=w();ar.content.style.minWidth="150px";r(ar);al.add=as;al.enable=at;al.select=au;al.onchange=c;function as(ax,ay,az){var aA=h(ar.content,"div","menu-item",ax);aA.title=az||"";aA.value=ay;aA.onclick=av;return aA;}function at(ax){if(ax){p(ap,"disabled");ap.onmousedown=aq;}else {ar.hide();o(ap,"disabled");ap.onmousedown=null;}}function au(ax){if(ax<ar.content.childNodes.length){aw(ar.content.childNodes[ax]);al.value=am.value;al.onchange();}}function aq(ax){ax=s(this,ax);ax.stopPropagation();o(ap,"op");ar.show(ap,"rt-dn");ar.onhide=function(){p(ap,"op");};}function av(){aw(this);ar.hide();var ax=this.value;setTimeout(function(){al.value=ax;al.onchange();},1);}function aw(ax){if(am)p(am,"selected");am=ax;o(am,"selected");ap.text.innerHTML=am.innerHTML;}}function W(ai){var aj=h(ai,"table","list");aj.cellSpacing=0;aj.cellPadding=0;h(aj,"col","colL");h(aj,"col","colR");var ak=h(aj,"tbody");aj.addDivider=function(am,an,ao){return (!am?al(null,"D",0,ao):al(am,"D",(an==null?am.indent+1:an),ao));};aj.addMetaGroup=function(am,an,ao){return (!am?al(null,"M",0,ao):al(am,"M",(an==null?am.indent+1:an),ao));};aj.addGroup=function(am,an,ao){return (!am?al(null,"G",0,ao):al(am,"G",(an==null?am.indent+1:an),ao));};aj.addItem=function(am,an,ao){return (!am?al(null,"I",0,ao):al(am,"I",(an==null?am.indent+1:an),ao));};aj.addInfo=function(am,an,ao){return al(am,"N",(an==null?am.indent:an),ao);};aj.addOptions=function(am,an,ao){return al(am,"O",(an==null?am.indent:an),ao);};aj.addSubitem=function(am,an,ao){return al(am,"S",(an==null?am.indent+1:an),ao);};aj.show=function(am){am.style.display="";am.visible=true;if(am.onvisiblechange)am.onvisiblechange();};aj.hide=function(am){am.style.display="none";am.visible=false;if(am.onvisiblechange)am.onvisiblechange();};aj.getNextSibling=function(am,an){var ao=am.parent;var ap=am.level;var aq=am.nextSibling;if(typeof an=="function"){while(aq){if(aq.level<ap)break;if(aq.level==ap&&an(aq))return aq;aq=aq.nextSibling;}}else {while(aq){if(aq.level<ap)break;if(aq.level==ap)return aq;aq=aq.nextSibling;}}return null;};aj.getNextDescendent=function(am,an,ao){if(am!=null){var ap=am.level;var aq=(an?an.nextSibling:am.nextSibling);}else {var ap=-1;var aq=ak.firstChild;}if(ao){while(aq){if(aq.level<ap)break;if(aq.level>ap&&ao(aq))return aq;aq=aq.nextSibling;}}else {while(aq){if(aq.level<ap)break;if(aq.level>ap)return aq;aq=aq.nextSibling;}}return null;};aj.getLastDescendent=function(am,an){if(am!=null){var ao=am.level;var ap=(an?an.nextSibling:am.nextSibling);}else {var ao=-1;var ap=ak.firstChild;}var aq=null;while(ap){if(ap.level<=ao)break;aq=ap;ap=ap.nextSibling;}return aq;};return aj;function al(am,an,ao,ap){var aq=ak.ownerDocument;var ar=aq.createElement("tr");ar.parent=am;ar.type=an;ar.level=(am?am.level+1:0);ar.indent=ao;ar.visible=true;if(am){var as=aj.getLastDescendent(am);ak.insertBefore(ar,(as?as.nextSibling:am.nextSibling));}else {ak.appendChild(ar);}switch(an){case "I":var at=" item";break;case "G":var at=" group";break;case "S":var at=" subitem";break;case "M":var at=" metagroup";break;case "N":var at=" info";break;case "O":var at=" options";break;case "D":var at=" divider";break;default:var at="";break;}ar.className="level"+ao+at+(ap?" "+ap:"");switch(an){case "I":case "S":var au=av(ar,"td");au.className="itemL";au.style.width="100%";var aw=av(au,"div");var aw=av(aw,"div");var aw=av(aw,"div");aw.className="content";ar.cellA=aw;var au=av(ar,"td");au.className="itemR";var ax=av(au,"nobr");ar.cellB=ax;break;case "G":case "M":case "D":var au=av(ar,"td");au.colSpan="2";var aw=av(au,"div");aw.className="content";ar.cellA=aw;break;case "N":var au=av(ar,"td");au.colSpan="2";var aw=av(au,"div");var aw=av(aw,"div");aw.className="content";ar.cellA=aw;break;case "O":var au=av(ar,"td");au.colSpan="2";var aw=av(au,"div");aw.className="sizer";ar.sizer=aw;var aw=av(aw,"div");aw.className="content";ar.cellA=aw;break;}return ar;function av(ay,az){return ay.appendChild(aq.createElement(az));}}}function X(ai,aj,ak,al,am){return function(an,ao){var ap=[];var aq={};var ar=null;if(typeof an.push=="function"){for(var as=0,at=an.length;as<at;as++)au(an[as]);}else {for(var as in an)au(an[as]);}if(al)ap=ap.filter(al);if(ao)ap.foreach(function(av){av.items.sort(ao);});ap.sort(ak);if(ar)ar.text="<i>"+(am?am:"None")+"</i>";return ap;function au(av){var aw=ai(av);if(aw==null)aw=[ "" ];else  if(typeof aw.push!="function")aw=[ aw ];var ax=(aj?aj(av):[]);if(ax==null)ax=[];else  if(typeof aw.push!="function")ax=[ ax ];aw.foreach(function(ay,az){var aA=aq[ay];if(aA==null){aA={text:ay,items:[]};if(ax[az])aA.object=ax[az];ap.push(aA);aq[ay]=aA;if(ay==="")ar=aA;}aA.items.push(av);});}};}function Y(ai,aj){return ai.text.localeCompare(aj.text);}function Z(ai,aj){return ai.text-aj.text;}