Sunday, February 26, 2012

GW LT ASYLUMSERVE


// ==UserScript==
// @name           GW LT ASYLUMSERVE
// @namespace      http://www.asylum-serve.com/
// @version        20120225
// @include        *.globalwarfaregame.com/*main_src.php*
// @include        *globalwarfaregame.com/*fb.php*
// @include        *apps.facebook.com/globalwarfaregame/*
// @include        *globalwarfaregame.com/src/*
// @include        *plus.google.com/games/216622099218/*
// @include        *.googleusercontent.com/*
// @email    support@asylum-serve.com
// @license    GNU GPL
// @copyright      2011 2012 ASYLUMSERVE COMMUNICATIONS INC & Evrenser & Tiestoale[ITA]
// @icon           http://www.asylum-serve.com/gw/icon.png
// ==/UserScript==

var Version="20120225",ENABLE_OVERVIEW=!0,ENABLE_TOWER=!0,ENABLE_TRANSPORT=!0,ENABLE_ARTEFACTS=!0,ENABLE_SEARCH=!0,ENABLE_PLAYER=!0,ENABLE_BUILD=!0,ENABLE_TRAIN=!0,ENABLE_OPTIONS=!0,ENABLE_HELP=!1,ENABLE_FAKE_TAB=!1,ENABLE_DEBUG=!1,DEBUG_TRACE=!1,is_chrome=-1<navigator.userAgent.toLowerCase().indexOf("chrome"); if(is_chrome&&(window.unsafeWindow||(unsafeWindow=function(){var c=document.createElement("p");c.setAttribute("onclick","return window;");return c.onclick()}()),!GM_getValue||GM_getValue.toString&&-1<GM_getValue.toString().indexOf("not supported")))GM_getValue=function(c,e){return localStorage[c]||e},GM_setValue=function(c,e){return localStorage[c]=e},GM_deleteValue=function(c){return delete localStorage[c]};var JSON;JSON||(JSON={}); (function(){function c(c){return 10>c?"0"+c:c}function e(c){f.lastIndex=0;return f.test(c)?'"'+c.replace(f,function(c){var d=l[c];return"string"===typeof d?d:"\\u"+("0000"+c.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+c+'"'}function d(c,g){var f,l,B,z,C=h,F,A=g[c];A&&"object"===typeof A&&"function"===typeof A.toJSON&&(A=A.toJSON(c));"function"===typeof o&&(A=o.call(g,c,A));switch(typeof A){case "string":return e(A);case "number":return isFinite(A)?""+A:"null";case "boolean":case "null":return""+ A;case "object":if(!A)return"null";h+=j;F=[];if("[object Array]"===Object.prototype.toString.apply(A)){z=A.length;for(f=0;f<z;f+=1)F[f]=d(f,A)||"null";B=0===F.length?"[]":h?"[\n"+h+F.join(",\n"+h)+"\n"+C+"]":"["+F.join(",")+"]";h=C;return B}if(o&&"object"===typeof o){z=o.length;for(f=0;f<z;f+=1)l=o[f],"string"===typeof l&&(B=d(l,A))&&F.push(e(l)+(h?": ":":")+B)}else for(l in A)Object.hasOwnProperty.call(A,l)&&(B=d(l,A))&&F.push(e(l)+(h?": ":":")+B);B=0===F.length?"{}":h?"{\n"+h+F.join(",\n"+h)+"\n"+ C+"}":"{"+F.join(",")+"}";h=C;return B}}"function"!==typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+c(this.getUTCMonth()+1)+"-"+c(this.getUTCDate())+"T"+c(this.getUTCHours())+":"+c(this.getUTCMinutes())+":"+c(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()});var g=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, f=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,h,j,l={"\u0008":"\\b","\t":"\\t","\n":"\\n","\u000c":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},o;"function"!==typeof JSON.stringify&&(JSON.stringify=function(c,e,g){var f;j=h="";if("number"===typeof g)for(f=0;f<g;f+=1)j+=" ";else"string"===typeof g&&(j=g);if((o=e)&&"function"!==typeof e&&("object"!==typeof e||"number"!==typeof e.length))throw Error("JSON.stringify");return d("", {"":c})});"function"!==typeof JSON.parse&&(JSON.parse=function(c,d){function e(c,f){var g,h,j=c[f];if(j&&"object"===typeof j)for(g in j)Object.hasOwnProperty.call(j,g)&&(h=e(j,g),void 0!==h?j[g]=h:delete j[g]);return d.call(c,f,j)}var f,c=""+c;g.lastIndex=0;g.test(c)&&(c=c.replace(g,function(c){return"\\u"+("0000"+c.charCodeAt(0).toString(16)).slice(-4)}));if(/^[\],:{}\s]*$/.test(c.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return f=eval("("+c+")"),"function"===typeof d?e({"":f},""):f;throw new SyntaxError("JSON.parse");})})(); var JSON2=JSON,DEFAULT_ALERT_SOUND_URL="http://www.asylum-serve.com/gw/alarm.mp3",SWF_PLAYER_URL="http://www.asylum-serve.com/gw/alarmplayer.swf",CHAT_BG_IMAGE="http://www.asylum-serve.com/gw/chat.png",Options={ptWinIsOpen:!0,ptWinDrag:!0,ptWinPos:{},ptTrackOpen:!0,ptsoundoff:!0,ptWinWidth:700,overviewFontSize:11,pbgoldenable:!1,pblastgoldcollect:[0,0,0,0,0,0,0,0],pbGoldLimit:100,pboilenable:!0,pblastoilcollect:0,pbfoodenable:!0,pblastfoodcollect:0,pbnukeenable:!0,pblastnukecollect:0,pblauncherenable:!0, pblastlaunchercollect:0,pbradarenable:!0,pblastradarcollect:0,pbdailyenable:!0,pblastdailycollect:0,pbgiftenable:!0,pblastgiftcollect:0,pbahelpenable:!0,pbahelphide:!0,pbrmmotdEnable:!0,pbiconsEnable:!0,pbitemsuse:!0,pbartcity:"",pbarttype:"w",pbartklist:"",pbartx:0,pbarty:0,pbartinterval:30,pbartenergysave:0,pbarthidemodal:!0,pbartdeletereport:!0,pbartu1:0,pbartu2:0,pbartu3:0,pbartu4:0,pbartu5:0,pbartu6:0,pbartu7:0,pbartu8:0,pbartu9:0,pbartu10:0,pbartu11:0,pbartu12:0,pbartu13:0,pbartu14:0,pbartu15:0, pbartu16:0,pbartu17:0,pbartu18:0,pbartu19:0,pbartu20:0,pbartu21:0,pbartu22:0,pbartu23:0,pbartu24:0,pbsearchtype:"u",pbsearchx:0,pbsearchy:0,pbsearchradius:20,pbsearchsector:"s1",pbsearchblockmax:100,pbsearchterrormin:"7",pbsearchterrormax:"10",pbsearchterrorclick:!0,pbsearchwildmin:"7",pbsearchwildmax:"10",pbsearchwildgrass:!0,pbsearchwildriver:!0,pbsearchwildoil:!1,pbsearchwildstone:!1,pbsearchwildsteel:!1,pbsearchwildplain:!1,pbsearchwildwaste:!1,pbsearchwildsr:!1,pbsearchwildfree:!0,pbsearchwildoccupied:!0, pbsearchwildnoalli:!1,pbsearchwildplayer:"",pbsearchwildalliance:"",pbsearchwildhostile:!0,pbsearchwildfriendly:!0,pbsearchwildneutral:!0,pbsearchwildfryou:!0,pbsearchwildfrthem:!0,pbsearchwildselfalli:!0,pbsearchwilddiplnoa:!0,pbsearchwildclick:!0,pbsearchcityplayer:"",pbsearchcityalliance:"",pbsearchcityminmight:"0",pbsearchcitymaxmight:"200000000",pbsearchcityhostile:!0,pbsearchcityfriendly:!0,pbsearchcityneutral:!0,pbsearchcityfryou:!0,pbsearchcityfrthem:!0,pbsearchcityselfalli:!0,pbsearchcitydiplnoa:!0, pbsearchcitynormal:!0,pbsearchcitybeginner:!0,pbsearchcitypeace:!0,pbsearchcityclick:!0,pbtrain:{},alertSound:{enabled:!0,soundUrl:DEFAULT_ALERT_SOUND_URL,repeat:!0,playLength:300,repeatDelay:2,volume:100,alarmActive:!0,expireTime:0},alertConfig:{aChat:!0,aPrefix:"******* UNDER ATTACK..!! *******",scouting:!0,wilds:!0,defend:!0,minTroops:0,lastAttack:0,hireGeneral:!0,useBoostAttack:!1,useBoostHealth:!1},encRemaining:!1,pbFoodAlert:!0,pbChatOnRight:!1,pbEveryEnable:!1,pbEveryMins:25,transportinterval:60, minwagons:10,lasttransport:0,deletetransports:!0},Logs={globallog:[],artlog:[],searchlog:[],buildlog:[],trainlog:[],translog:[]},r=GM_getValue("pbReloadNow");null==r&&GM_setValue("pbReloadNow","0");0<=document.URL.search(/apps.facebook.com\/globalwarfaregame/i)&&facebookInstance();0<=document.URL.search(/globalwarfaregame.com\/fb.php/i)&&GWwideScreen(); function GWwideScreen(){var c=GM_getValue("pbReloadNow");if("0"!=c){var e=document.getElementsByTagName("div");if(e)for(var d=0;d<e.length;d++)"kb-gw-gift-items"==e[d].className&&(GM_setValue("pbReloadHit","OK"),reloadGW(c))}if(c=document.getElementsByTagName("IFRAME"))for(d=0;d<c.length;d++)c[d].style.width="100%";d=document.createElement("style");d.innerHTML="body {margin:0; width:100%;}";document.getElementsByTagName("head")[0].appendChild(d)} function facebookInstance(){function c(){var e=document.getElementById("iframe_canvas");if(e){for(e.style.width="100%";null!=(e=e.parentNode);)"DIV"==e.tagName&&(e.style.width="100%",e.style.border="0",e.style.padding="0",e.style.margin="0");document.getElementById("globalContainer").style.left="0px";try{document.getElementById("rightCol").style.display="none",document.getElementById("leftColContainer").style.display="none",document.getElementById("pagelet_canvas_footer_content").style.display="none", document.getElementById("globalContainer").parentNode.style.overflowX="hidden"}catch(d){}if(e=document.getElementById("mainContainer")){e.parentNode.style.width="100%";for(i=0;i<e.childNodes.length;i++)if("contentCol"==e.childNodes[i].id){e.childNodes[i].style.margin="0px";break}}if(e=document.getElementById("pageHead"))e.style.width="100%",e.style.margin="0 10px";if(e=document.getElementById("bottomContent"))e.style.padding="0"}else setTimeout(c,500)}c()} var Seed=unsafeWindow.seed,Tabs={},mainPop,Cities={},ptStartupTimer=null,CPopUpTopClass="ptPopTop",uW=unsafeWindow; function ptStartup(){clearTimeout(ptStartupTimer);if(!unsafeWindow.ptLoaded){var c=getClientCoords(document.getElementById("main_engagement_tabs"));if(null==c.width||0==c.width)ptStartupTimer=setTimeout(ptStartup,1E3);else{unsafeWindow.ptLoaded=!0;document.getElementById("gw-promo-main").style.display="none";Seed=unsafeWindow.seed;window.name="PT";readOptions();readLogs();setCities();if(null==Options.ptWinPos||null==Options.ptWinPos.x||""==Options.ptWinPos.x||isNaN(Options.ptWinPos.x))c=getClientCoords(document.getElementById("gor_menu_bar")), Options.ptWinPos.x=c.x+4,Options.ptWinPos.y=c.y,saveOptions();mainPop=new CPopup("pt",Options.ptWinPos.x,Options.ptWinPos.y,Options.ptWinWidth,1200,Options.ptWinDrag,function(){tabManager.hideTab();Options.ptWinIsOpen=!1;saveOptions()});mainPop.autoHeight(!0);mainPop.getMainDiv().innerHTML='<style type="text/css">.ptTabs {color:black; font-size:12px; font-family: arial,verdana;}.xtab {padding-right: 5px; border:none; background:none; white-space:nowrap;}.xtabBR {padding-right: 5px; border:none; background:none;}table.ptTab tr td {border:none; background:none; white-space:nowrap; padding:0px}.hostile td { background:red; }.friendly td{background:lightgreen; }.ally td{background:lightblue; }table.ptTabPadNW tr td {border:none; background:none; white-space:nowrap; padding: 2px 4px 2px 8px;}table.ptTabBR tr td {border:none; background:none;}table.ptTabLined tr td {border:1px none none solid none; padding: 2px 5px; white-space:nowrap;}table.ptOptions tr td {border:1px none none solid none; padding: 1px 3px; white-space:nowrap;}table.ptSrchResults tr td {border:1px none none solid none; padding: 1px 3px; white-space:nowrap;}table.ptTabSome tr td {border:none; background:none; padding: 1px 3px; white-space:nowrap;}table.ptTabBR tr td {border:none; background:none;}table.ptTabLined tr td {border:1px none none solid none;}table.ptTabOverview tr td {border-left:1px solid #ccc; white-space:nowrap; padding: 1px 2px;}table.ptTabOverview {border:1px solid #ccc; border-collapse: collapse}table.ptTabOverview tr.odd {background-color:#e8e8e8;}table.ptTabPad tr td.ptentry {background-color:#ffeecc; padding-left: 8px;}table.ptNoPad tr td {border:none; background:none; white-space:nowrap; padding:0px}.ptDetLeft {padding:0 5px 0 0 !important; font-weight:bold; text-align:right}.ptOddrow {background-color:#eee}table.ptStat{border:1px solid #357; border-collapse: collapse}table.ptStat tr td {padding: 2px 2px;}.ptStat {border:1px solid; border-color:#ffffff; font-weight:bold; padding-top:2px; padding-bottom:2px; text-align:center; color:#ffffff; background-color:#357}.ptStatLight {color:#ddd}table td.nobr {white-space:nowrap;}.ptentry {padding: 7px; border:1px solid; border-color:#000000; background-color:#ffeecc; white-space:nowrap;}.ptErrText {font-weight:bold; color:#600000}button::-moz-focus-inner, input[type="submit"]::-moz-focus-inner { border: none; }span.whiteOnRed {padding-left:3px; padding-right:3px; background-color:#700; color:white; font-weight:bold}span.boldRed {color:#800; font-weight:bold}input.ptDefButOn {cursor:pointer; border:1px solid black; background-color:red;}input.ptDefButOff {cursor:pointer; border:1px solid black; background-color:#0a0;}input.ptButton20 {height:27px; width:80px}table.ptMainTab {empty-cells:show; border-collapse: separate; border-spacing:2px}table.ptMainTab tr td {padding: 4px 5px 3px 5px; text-align: center;}table.ptMainTab tr td a {color:inherit }table.ptMainTab tr td {font-family:arial,verdana,sans-serif; empty-cells:show; white-space:nowrap; border: 1px solid blue;}table.ptMainTab tr td.sel    {font-weight:bold; font-size:12px; background-color:#eed; color:black}table.ptMainTab tr td.notSel {font-weight:bold; font-size:12px; background-color:#1e66bd; color:white; border-color:black;}tr.ptPopTop td { background-color:#0AF; border:none; height: 21px;  padding:0px; }tr.ptretry_ptPopTop td { background-color:#a00; color:#fff; border:none; height: 21px;  padding:0px; }tr.ptMainPopTop td { background-color:#0AF; border:none; height: 42px;  padding:0px; }tr.ptretry_ptMainPopTop td { background-color:#a00; color:#fff; border:none; height: 42px;  padding:0px; }.CPopup .CPopMain { background-color:#f8f8f8; padding:6px; overflow:auto;}.CPopup  {border:2px ridge #666}span.ptTextFriendly {color: #080}span.ptTextHostile {color: #800}td.ptkoords:hover {background-color: silver; cursor:pointer;}td.ptkoordslist:hover {background-color: maroon; color: white;cursor:pointer;}table.ptTrain td {padding: 1px 2px 1px 2px;}.ptButCancel {background-color:#a00; font-weight:bold; color:#fff}div#font11 {font: normal 10px arial}div.indent25 {padding-left:25px}</style>'; AddMainTabLink("GW-LT",eventHideShow,mouseMainTab);tabManager.init(mainPop.getMainDiv());Options.ptWinIsOpen&&Options.ptTrackOpen&&(mainPop.show(!0),tabManager.showTab());window.addEventListener("beforeunload",onUnload,!1);ChatPane.init();Tabs.Options.onoffMotd();Tabs.Options.onoffIcons();Tabs.Options.sound();AutoEvents.init();FoodAlerts.init();Gifts.init();ItemsUse.init();ChatOnRight.init();RefreshEvery.init();setInterval(Buildcheck,5E3);"OK"==GM_getValue("pbReloadHit")&&(GM_setValue("pbReloadHit", ""),Logbuch.eintrag(Logs.globallog,"Gifts for page reload successfully prevented"));GM_setValue("pbReloadNow","0");c=unsafeWindow.Constant.Version.VERSION_NUMBER;c=c.split("_").join(".");Logbuch.eintrag(Logs.globallog,"GW LT ASYLUMSERVE: "+Version+")")}}} function Buildcheck(){var c=unixTime(),e;for(e in Seed.queue_con){var d=Seed.queue_con[e][0],g=e.substr(4);if(null!=d&&parseInt(d[4])<c){var f=d[0],h=d[1],j=Seed.buildings[e]["pos"+d[7]];j[3]==d[2]&&j[0]==f&&parseInt(h)>parseInt(j[1])&&(j[1]=h,Seed.queue_con[e]=[],g==unsafeWindow.currentcityid&&unsafeWindow.update_bdg())}}} Tabs.Overview={tabOrder:1,tabLabel:"GENERAL",cont:null,displayTimer:null,tabDisabled:!ENABLE_OVERVIEW,Overview:function(){},init:function(c){this.cont=c},hide:function(){clearTimeout(Tabs.Overview.displayTimer)},show:function(){function c(c,d,e){f++%2?(style="",style2=' style="background-color:#AFF;text-align:right;"',style3=' style="text-align:right;"'):(style=' style="background-color:#e8e8e8;"',style2=' style="background-color:#1BF;text-align:right;"',style3=' style="background-color:#e8e8e8;text-align:right;"'); var g=0,h=[];h.push('<tr style="background-color:#fff;"');h.push(style);h.push("><td");h.push(style);h.push("><b>");h.push(c);h.push(" &nbsp; </td>");if(e)h.push("<td"),h.push(style2),h.push(">&nbsp;</td>");else{for(i=0;i<d.length;i++)g+=d[i];h.push("<td"+style2+">");0>g?h.push('<span class="boldRed">'+addCommas(g)+"</span>"):h.push(addCommas(g));h.push("</td>")}for(i=0;i<d.length;i++)h.push("<td"),h.push(style3),h.push(">"),0>d[i]?h.push('<span class="boldRed">'+addCommas(d[i])+"</span>"):h.push(addCommas(d[i])), h.push("</td>");h.push("</tr>");return h.join("")}function e(){return'<tr><td colspan="'+(Cities.numCities+2)+'">&nbsp;</td></tr>'}function d(c){document.getElementById("overMainDiv").style.fontSize=c.target.value+"px";Options.overviewFontSize=c.target.value;saveOptions()}function g(c){mainPop.div.style.width=c.target.value+"px";Options.ptWinWidth=c.target.value;saveOptions()}var f=0,h=Tabs.Overview;clearTimeout(h.displayTimer);h.updatemarches();try{var j=unixTime();str='<div class="ptstat" style="margin-top:5px; margin-bottom:5px;"><table cellspacing="0" cellpadding="0" class="ptTab ptStat" width="100%"><tr><td colspan="8" style="text-align:center;"><b>GW LT ASYLUMSERVE: '+ Version+'</b></td></tr><tr><td><span class="ptStatLight">POWER:</span> '+addCommas(Seed.player.might)+'</td><td style="text-align:center;"><span class="ptStatLight">Level:</span> '+Seed.player.title+'</td><td style="text-align:right;"><span class="ptStatLight">Alliance:</span> '+getMyAlliance()[1]+'</td><td style="text-align:right;"><span class="ptStatLight">Area:</span> '+unsafeWindow.domainName+"</td></tr></table></div>";str+='<div id="overMainDiv" style="font-size:'+Options.overviewFontSize+'px"><table class="ptTabOverview" cellpadding="0" cellspacing="0"><tr valign="top" align="right"><td width="65"></td><td width="88" style="background: #AFF; text-align:right;"><b>TOTAL</b></td>'; for(i=0;i<Cities.numCities;i++)str+='<td width="81" style="text-align:right;"><b>'+Cities.cities[i].name.substring(0,11)+"</b><br>"+Cities.cities[i].x+","+Cities.cities[i].y+"<br>"+unsafeWindow.provincenames["p"+Cities.cities[i].provId]+"</td>";str+="</tr>";str+='<tr valign="top"><td></td><td style="background-color: #AFF"></td>';for(i=0;i<Cities.numCities;i++)cityID="city"+Cities.cities[i].id,Gate=parseInt(Seed.citystats[cityID].gate),str=0==Gate?str+'<td style="text-align:right;">City</td>':str+ '<td style="text-align:right;"><span class="boldRed"><blink>Defending</blink></span></td>';rows=[[]];for(i=0;i<Cities.numCities;i++)cityID="city"+Cities.cities[i].id,rows[0][i]=parseInt(Seed.citystats[cityID].gold[0]);for(r=1;9>r;r++){rows[r]=[];for(i=0;i<Cities.numCities;i++)cityID="city"+Cities.cities[i].id,rows[r][i]=parseInt(Seed.resources[cityID]["rec"+r][0]/3600)}str+=c("GOLD:",rows[0]);str+=c("FOOD:",rows[1]);str+=c("OIL:",rows[2]);str+=c("STONE:",rows[3]);str+=c("STEEL:",rows[4]);str+=c("TITANIUM:", rows[5]);str+=c("GRAPHENE:",rows[6]);str+=e();for(r=1;25>r;r++){rows[r]=[];for(i=0;i<Cities.numCities;i++)cityID="city"+Cities.cities[i].id,rows[r][i]=Seed.units[cityID]["unt"+r]?parseInt(Seed.units[cityID]["unt"+r]):0}f=0;str+=c("Supply Truck:",rows[1]);str+=c("Infantry:",rows[5]);str+=c("Sniper:",rows[6]);str+=c("Anti-Tank:",rows[4]);str+=c("Special Forces:",rows[18]);str+=c("SAM:",rows[7]);str+=c("Elite SAM:",rows[21]);str+=c("Tank:",rows[8]);str+=c("Predator Drone:",rows[17]);str+=c("Supply Chopper:", rows[9]);str+=c("Gunship:",rows[11]);str+=c("Elite Gunship:",rows[24]);str+=c("Fighter:",rows[10]);str+=c("Bomber:",rows[12]);str+=c("Cargo Plane:",rows[19]);str+=c("Hell-Fire Tank:",rows[16]);str+=c("Stealth Bomber:",rows[13]);str+=c("Nuclear Weapons:",rows[15]);str+=c("Ion Cannon:",rows[20]);str+=e();for(r=52;57>=r;r++){rows[r]=[];for(i=0;i<Cities.numCities;i++)cityID="city"+Cities.cities[i].id,rows[r][i]=Seed.fortifications[cityID]["fort"+r]?parseInt(Seed.fortifications[cityID]["fort"+r]):0}f= 0;str+=c("Mines:",rows[53]);str+=c("Stinger Missiles:",rows[52]);str+=c("Artillery:",rows[54]);str+=c("Anti-Air Guns:",rows[55]);str+=c("Railguns:",rows[56]);str+=c("Laser Turrets:",rows[57]);str+=e();z=[];row2=[];row3=[];row4=[];row5=[];row6=[];for(i=0;i<Cities.numCities;i++){var l=getResourceProduction(Cities.cities[i].id),o=parseInt(Seed.resources["city"+Cities.cities[i].id].rec1[3]),q=1;Seed.bonus.bC1150.bT1151>j&&(q=2);o=parseInt(o/q);row3[i]=o;row2[i]=l[1];z[i]=l[1]-o;row4[i]=l[2];row5[i]=l[3]; row6[i]=l[4]}f=0;str+=c("Production:",row2);str+=c("Maintenance:",row3);str+=c("Food Expenses:",z);for(i=0;i<Cities.numCities;i++)if(0<=z[i])z[i]="&infin;";else{var v=3600*(parseInt(Seed.resources["city"+Cities.cities[i].id].rec1[0])/3600/(0-z[i]));z[i]=86313600<v?"> ----":timestrShort(v)}str+=c("Food Production:",z,!0);str+=c("Oil Production:",row4);str+=c("Stone Production:",row5);str+=c("Steel Production:",row6);str+=e();z=[];for(i=0;i<Cities.numCities;i++){l=0;dat=Seed.wilderness["city"+Cities.cities[i].id]; if(null!=dat&&"object"==matTypeof(dat))for(k in dat)++l;var w=parseInt(Seed.buildings["city"+Cities.cities[i].id].pos0[1]);11==w&&(w=13);z[i]=l<w?'<span class="boldRed">'+l+"/"+w+"</span>":l+"/"+w}f=0;str+=c("Lands:",z,!0);z=[];for(i=0;i<Cities.numCities;i++){totKnights=0;dat=Seed.knights["city"+Cities.cities[i].id];for(k in dat)++totKnights;GLevel=0;var E=Seed.buildings["city"+Cities.cities[i].id],B;for(B in E)b=E[B],7==parseInt(b[0])&&(GLevel=parseInt(b[1]));GMax=2*GLevel;z[i]=totKnights<GMax?'<span class="boldRed">'+ totKnights+"/"+GMax+"</span>":totKnights+"/"+GMax}str+=c("Generals:",z,!0);str+=e();var j=unixTime(),z=[];for(i=0;i<Cities.numCities;i++){var C=0,F=Seed.queue_con["city"+Cities.cities[i].id][0];null!=F?(C=parseInt(F[4])-j,0>C&&(C=0),z[i]=timestr(C)):z[i]=timestr(0)}f=0;str+=c("Construction:",z,!0);z=[];for(i=0;i<Cities.numCities;i++)C=0,F=Seed.queue_tch["city"+Cities.cities[i].id][0],null!=F?(C=parseInt(F[3])-j,0>C&&(C=0),z[i]=timestr(C)):z[i]=" ";str+=c("Research:",z,!0);z=[];for(i=0;i<Cities.numCities;i++){C= 0;F=Seed.training_queue["c"+Cities.cities[i].id];for(qs in F)qe=F[qs],0!=parseInt(qe.status)&&parseInt(qe.eta)>j&&(C=parseInt(qe.ticker)<j?C+(parseInt(qe.eta)-j):C+(parseInt(qe.eta)-parseInt(qe.ticker)));z[i]=timestr(C)}str+=c("Training:",z,!0);z=[];for(i=0;i<Cities.numCities;i++){C=0;F=Seed.fortify_queue["c"+Cities.cities[i].id];for(qs in F)qe=F[qs],0!=parseInt(qe.status)&&parseInt(qe.eta)>j&&(C=parseInt(qe.ticker)<j?C+(parseInt(qe.eta)-j):C+(parseInt(qe.eta)-parseInt(qe.ticker)));z[i]=timestr(C)}str+= c("Defense:",z,!0);str+="<tr></table>";str+='<br><div style="text-align:center;">Font Size: '+htmlSelector({9:9,10:10,11:11,12:12},Options.overviewFontSize,'id="ptoverfont"')+"&nbsp;&nbsp;Resize the menu: "+htmlSelector({650:650,700:700,750:750,800:800,850:850},Options.ptWinWidth,'id="ptWinWidth"')+"</div></div>";Tabs.Overview.cont.innerHTML=str;document.getElementById("ptoverfont").addEventListener("change",d,!1);document.getElementById("ptWinWidth").addEventListener("change",g,!1)}catch(A){Tabs.Overview.cont.innerHTML= "<pre>"+A.name+" : "+A.message+" : S\u0131ra:"+A.lineNumber+"</pre>"}h.displayTimer=setTimeout(h.show,5E3)},updatemarches:function(){for(var c=unixTime(),e=0;e<Cities.numCities;e++){var d=Cities.cities[e].id,g=Seed.outgoing_marches["c"+d],f;for(f in g){var h=g[f];if(0!=h.marchStatus&&(1==h.marchType||4==h.marchType)&&h.returnUnixTime<c){h.marchStatus=0;0!=h.knightId&&Seed.knights["city"+d]["knt"+h.knightId]&&(Seed.knights["city"+d]["knt"+h.knightId].knightStatus=1);for(var j=1==h.marchType?"Count": "Return",l=1;25>l;l++)Seed.units["city"+d]["unt"+l]+=parseInt(h["unit"+l+j])}0==h.marchStatus&&0!=h.knightId&&Seed.knights["city"+d]["knt"+h.knightId]&&(Seed.knights["city"+d]["knt"+h.knightId].knightStatus=1,h.knightId=0)}}}}; Tabs.tower={tabOrder:3,tabLabel:"Tower",myDiv:null,generateIncomingFunc:null,fixTargetEnabled:!1,secondTimer:null,soundPlaying:!1,defMode:{},soundRepeatTimer:null,soundStopTimer:null,towerMarches:[],tabDisabled:!ENABLE_TOWER,uu:{u1:"Supply Truck:",u2:"uncertain:",u3:"uncertain:",u4:"Tank:",u5:"Infantry:",u6:"Sniper:",u7:"SAM:",u8:"Tank:",u9:"Supply Chopper:",u10:"Fighter:",u11:"Gunship:",u12:"Bomber:",u13:"Stealth Bomber:",u14:"uncertain:",u15:"Nuclear Weapons:",u16:"Anti-Tank:",u17:"Predator Drone:", u18:"Special Forces:",u19:"Cargo Plane:",u20:"Ion Cannon:",u21:"Elite SAM:",u22:"uncertain:",u23:"uncertain:",u24:"Elite Gunship:"},init:function(c){function e(c,d){c.addEventListener("click",function(){g.butToggleDefMode(d)},!1)}function d(c,d){document.getElementById(d).addEventListener("click",function(){g.showTowerIncoming(c)},!1)}var g=Tabs.tower;g.myDiv=c;unixTime();c=[];c.push('<table class="ptTab ptStat" width="100%">');c.push("<tr>");c.push('<td style="text-align:center;">');c.push("<b>TOWER MENU</b>"); c.push("</td>");c.push("</tr>");c.push("</table>");c.push("<br>");c.push('<table class="pbTab" width="100%">');c.push("<tr>");for(var f=0;f<Cities.cities.length;f++)c.push('<td style="text-align:center"><span id="pbtacity_'+f+'"><b>'+Cities.cities[f].name+"</b></span></td>");c.push("</tr>");c.push("<tr>");for(var h in Cities.byID)c.push('<td style="text-align:center"><input type="submit" id="pbtabut_'+h+'" value=""></td>');c.push("</tr>");c.push("<tr>");for(h in Cities.byID)c.push('<td style="text-align:center"><input id="pbattackqueue_'+ h+'" type="submit" value="DETAIL"></td>');c.push("</tr>");c.push("<tr>");for(h in Cities.byID)c.push('<td style="text-align:center" id="camo'+h+'"></td>');c.push("</tr>");c.push("</table>");c.push("<br>");c.push("<b>VERSION:</b> GW LT ASYLUMSERVE");c.push("<br><hr>");c.push('<div id="pbitems"></div>');c.push("<hr><br>");c.push('<div style="text-align:center;">');c.push('<input id="pbSoundStop" type="submit" value="Silence The Alarm">');c.push("</div>");c.push('<div id="pbSwfPlayer"></div>');c.push("<br>"); c.push('<div class="pbStat">&nbsp;<b>SETTINGS</b></div><br>');c.push('<table class="pbTab">');c.push("<tr>");c.push("<td>");c.push('<input id="pbalertEnable" type="checkbox" '+(Options.alertConfig.aChat?'checked="checked" ':"")+">");c.push("</td>");c.push("<td>Automatically Sends Report of Attack to Alliance Chat..!<br>&nbsp;</td>");c.push("</tr>");c.push("<tr>");c.push("<td>&nbsp;</td>");c.push("<td>");c.push("<table>");c.push("<tr>");c.push("<td>Message Content:</td>");c.push("<td>");c.push('<input id="pbalertPrefix" type="text" size="40" value="'+ Options.alertConfig.aPrefix+'">');c.push("</td>");c.push("</tr>");c.push("<tr>");c.push("<td>Land Attack Alert:</td>");c.push("<td>");c.push('<input id="pbalertWild" type="checkbox" '+(Options.alertConfig.wilds?'checked="checked" ':"")+">");c.push("</td>");c.push("</tr>");c.push("<tr>");c.push("<td>Status of Defense:&nbsp;&nbsp;</td>");c.push("<td>");c.push('<input id="pbalertDefend" type="checkbox" '+(Options.alertConfig.defend?'checked="checked" ':"")+">");c.push("</td>");c.push("</tr>");c.push("<tr>"); c.push("<td>Minimum Number of Troops:</td>");c.push("<td>");c.push('<input id="pbalertTroops" type="text" size="5" value="'+Options.alertConfig.minTroops+'">');c.push('&nbsp;&nbsp;<span id="pbalerterr"></span>');c.push("</td>");c.push("</tr>");c.push("</table>");c.push("</td>");c.push("</tr>");c.push("<tr><td><br></td></tr>");c.push("<tr>");c.push("<td>");c.push('<input id="pbSoundEnable" type="checkbox" '+(Options.alertSound.enabled?'checked="checked" ':"")+">");c.push("</td>");c.push("<td>Set the given below link as alarm sound.!!<br>&nbsp;</td>"); c.push("</tr>");c.push("<tr>");c.push("<td>&nbsp;</td>");c.push("<td>");c.push('<div id="pbLoadingSwf">Or FlashPlayer MUST upload SWF Player for Work..!!</div>');c.push('<div style="display:none" id="pbSoundOpts">');c.push("<table>");c.push("<tr>");c.push("<td>Audio File:&nbsp;</td>");c.push("<td>");c.push('<input id="pbsoundFile" type="text" size="31" value="'+Options.alertSound.soundUrl+'">&nbsp;');c.push('<input id="pbSoundLoad" type="submit" value="Upload">&nbsp;');c.push('<input id="pbSoundDefault" type="submit" value="Default">&nbsp;<span id="pbLoadStat">Loading ..</span><br>&nbsp;'); c.push("</td>");c.push("</tr>");c.push("<tr>");c.push('<td><span style="position:relative; top:-6px;">Volume Adjustment:</span>&nbsp;</td>');c.push("<td>");c.push("<table><tr>");c.push('<td style="vertical-align: middle;"><span style="display:inline;" id="pbVolSlider"></span></td>');c.push('<td style="vertical-align: middle;">&nbsp;&nbsp;&nbsp;<span id="pbVolOut">0</span>&nbsp;&nbsp;&nbsp;');c.push("</td>");c.push("</tr></table>");c.push("</td>");c.push("</tr>");c.push("<tr>");c.push("<td>&nbsp;</td>"); c.push("<td>&nbsp;<br>");c.push('<input id="pbSoundRepeat" type="checkbox" '+(Options.alertSound.repeat?'checked="checked"':"")+">");c.push('&nbsp;Repetition time <input style="text-align:center;" id="pbSoundEvery" type="text" size="2" value="'+Options.alertSound.repeatDelay+'"> Minute');c.push("<br>");c.push('S\u00fcresince: <input style="text-align:center;" id="pbSoundLength" type="text" size="3" value="'+Options.alertSound.playLength+'"> Second');c.push("<br><br>");c.push('<input type="submit" value="LISTEN" id="pbPlayNow">'); c.push("</td>");c.push("</tr>");c.push("</table>");c.push("</div><br>&nbsp;");c.push("</td>");c.push("</tr>");c.push("<tr>");c.push("<td>");c.push('<input id="pbTowerGeneral" type="checkbox" '+(Options.alertConfig.hireGeneral?'checked="checked" ':"")+">");c.push("</td>");c.push("<td>Auto-Appoint a chief of staff (chooses highest general free with at least two energy points).!!</td>");c.push("</tr>");c.push("<tr>");c.push("<td>");c.push('<input id="pbTowerAttackBoost" type="checkbox" '+(Options.alertConfig.useBoostAttack? 'checked="checked" ':"")+">");c.push("</td>");c.push("<td>Auto-Use an attack amplifier (extra ammo or additional weapons). The articles are used only when necessary and available.!!</td>");c.push("</tr>");c.push("<tr>");c.push("<td>");c.push('<input id="pbTowerHealthBoost" type="checkbox" '+(Options.alertConfig.useBoostHealth?'checked="checked" ':"")+">");c.push("</td>");c.push("<td>Auto-Use health amplifier (kevlar vest or armor). The articles are used only when necessary and available.!!</td>"); c.push("</tr>");c.push("</table>");c.push("<br>");m=c.join("");g.myDiv.innerHTML=m;g.mss=new CmatSimpleSound(SWF_PLAYER_URL,null,{height:0,width:0},g.e_swfLoaded,"debug=n");g.mss.swfDebug=function(c){actionLog("SWF: "+c)};g.mss.swfPlayComplete=g.e_soundFinished;g.mss.swfLoadComplete=g.e_soundFileLoaded;unsafeWindow.matSimpleSound01=g.mss;g.volSlider=new SliderBar(document.getElementById("pbVolSlider"),200,21,0);g.volSlider.setChangeListener(g.e_volChanged);document.getElementById("pbTowerGeneral").addEventListener("change", function(c){Options.alertConfig.hireGeneral=c.target.checked},!1);document.getElementById("pbTowerAttackBoost").addEventListener("change",function(c){Options.alertConfig.useBoostAttack=c.target.checked},!1);document.getElementById("pbTowerHealthBoost").addEventListener("change",function(c){Options.alertConfig.useBoostHealth=c.target.checked},!1);document.getElementById("pbPlayNow").addEventListener("click",function(){g.playSound(!1)},!1);document.getElementById("pbSoundStop").addEventListener("click", g.stopSoundAlerts,!1);document.getElementById("pbSoundRepeat").addEventListener("change",function(c){Options.alertSound.repeat=c.target.checked},!1);document.getElementById("pbSoundEvery").addEventListener("change",function(c){Options.alertSound.repeatDelay=c.target.value},!1);document.getElementById("pbSoundLength").addEventListener("change",function(c){Options.alertSound.playLength=c.target.value},!1);document.getElementById("pbSoundEnable").addEventListener("change",function(c){Options.alertSound.enabled= c.target.checked},!1);document.getElementById("pbSoundStop").disabled=!0;document.getElementById("pbalertEnable").addEventListener("change",g.e_alertOptChanged,!1);document.getElementById("pbalertPrefix").addEventListener("change",g.e_alertOptChanged,!1);document.getElementById("pbalertWild").addEventListener("change",g.e_alertOptChanged,!1);document.getElementById("pbalertDefend").addEventListener("change",g.e_alertOptChanged,!1);document.getElementById("pbalertTroops").addEventListener("change", g.e_alertOptChanged,!1);document.getElementById("pbsoundFile").addEventListener("change",function(){Options.alertSound.soundUrl=document.getElementById("pbsoundFile").value;g.loadUrl(Options.alertSound.soundUrl)},!1);document.getElementById("pbSoundDefault").addEventListener("click",function(){document.getElementById("pbsoundFile").value=DEFAULT_ALERT_SOUND_URL;Options.alertSound.soundUrl=DEFAULT_ALERT_SOUND_URL;g.loadUrl(DEFAULT_ALERT_SOUND_URL)},!1);for(h in Cities.byID)c=document.getElementById("pbtabut_"+ h),e(c,h),g.defMode[h]=parseInt(Seed.citystats["city"+h].gate),g.displayDefMode(h),d(h,"pbattackqueue_"+h);setInterval(g.eachSecond,1E3);g.items();setInterval(g.items,1E4)},show:function(){},hide:function(){},items:function(){var c=document.getElementById("pbitems"),e=unixTime(),d;d="<b>DETAILS</b><br><br><table><tr><td><b>ATTACK (+20%):</b>&nbsp;&nbsp;&nbsp;</td>";if(parseInt(Seed.bonus.bC2600.bT2601)>e){var g=parseInt(Seed.bonus.bC2600.bT2601)-e;d+="<td>"+timestr(g)+"&nbsp;&nbsp;&nbsp;</td>"}else d+= "<td>-----&nbsp;&nbsp;&nbsp;</td>";d+="<td>Extra ammo for 24 hours, 7 Days Extra Weapons</td></tr><tr><td><b>DEFENSE (+20%):</b>&nbsp;&nbsp;&nbsp;</td>";parseInt(Seed.bonus.bC2700.bT2701)>e?(g=parseInt(Seed.bonus.bC2700.bT2701)-e,d+="<td>"+timestr(g)+"&nbsp;&nbsp;&nbsp;</td>"):d+="<td>-----&nbsp;&nbsp;&nbsp;</td>";d+="<td>Kevlar vest for 24 hours, 7 Day Body Armor</td></tr><tr><td><b>Peace Treaty:</b>&nbsp;&nbsp;&nbsp;</td>";3==Seed.player.warStatus&&parseInt(Seed.player.truceExpireUnixTime)>e?(g= parseInt(Seed.player.truceExpireUnixTime)-e,d+="<td>"+timestr(g)+"&nbsp;&nbsp;&nbsp;</td>"):d+="<td>-----&nbsp;&nbsp;&nbsp;</td>";d+="<td>Peace Treaty of 12 hour, 7 day Peace Treaty</td></tr><tr><td><b>Ration: (-50%):</b>&nbsp;&nbsp;&nbsp;</td>";parseInt(Seed.bonus.bC1150.bT1151)>e?(g=parseInt(Seed.bonus.bC1150.bT1151)-e,d+="<td>"+timestr(g)+"&nbsp;&nbsp;&nbsp;</td>"):d+="<td>-----&nbsp;&nbsp;&nbsp;</td>";c.innerHTML=d+"<td>Ration for 8 hours, 24 hour ration, 3 day ration</td></tr></table>";for(var f in Cities.byID)c= document.getElementById("camo"+f),parseInt(Seed.antiscouting["city"+f])>e?(g=parseInt(Seed.antiscouting["city"+f])-e,c.innerHTML="&nbsp;<br>Camouflage ("+timestr(g)+")"):c.innerHTML="&nbsp;<br>No Camouflage",c.innerHTML=0!=Seed.leaders["city"+f].combatKnightId?c.innerHTML+("<br>General (Lvl.: "+Seed.knights["city"+f]["knt"+Seed.leaders["city"+f].combatKnightId].knightLevel+")"):c.innerHTML+"<br>No Generals!"},loadUrl:function(c){Tabs.tower.mss.load(1,c,!0);document.getElementById("pbLoadStat").innerHTML= "Loading ..."},e_swfLoaded:function(){var c=Tabs.tower;document.getElementById("pbLoadingSwf").style.display="none";document.getElementById("pbSoundOpts").style.display="inline";c.volSlider.setValue(Options.alertSound.volume/100);c.loadUrl(Options.alertSound.soundUrl);setTimeout(function(){c.mss.setVolume(1,Options.alertSound.volume)},500);Options.alertSound.alarmActive&&Options.alertSound.expireTime>unixTime()&&c.soundTheAlert()},e_alertOptChanged:function(){Options.alertConfig.aChat=document.getElementById("pbalertEnable").checked; Options.alertConfig.aPrefix=document.getElementById("pbalertPrefix").value;Options.alertConfig.scouting=document.getElementById("pbalertScout").checked;Options.alertConfig.wilds=document.getElementById("pbalertWild").checked;Options.alertConfig.defend=document.getElementById("pbalertDefend").checked;var c=parseInt(document.getElementById("pbalertTroops").value);1>c||1E5<c?(document.getElementById("pbalertTroops").value=Options.alertConfig.minTroops,document.getElementById("pbalerterr").innerHTML= '<b style="color:#600000;">Invalid</b>',setTimeout(function(){document.getElementById("pbalerterr").innerHTML=""},2E3)):(Options.alertConfig.minTroops=c,saveOptions())},e_volChanged:function(c){var e=Tabs.tower;document.getElementById("pbVolOut").innerHTML=parseInt(100*c);Options.alertSound.volume=parseInt(100*c);e.mss.setVolume(1,Options.alertSound.volume)},butToggleDefMode:function(c){var e=Tabs.tower,d=1;0!=Seed.citystats["city"+c].gate&&(d=0);e.ajaxSetDefMode(c,d,function(d){e.defMode[c]=d;e.displayDefMode(c)})}, displayDefMode:function(c){var e=Tabs.tower,d=document.getElementById("pbtabut_"+c);e.defMode[c]?(d.className="pbDefButOn",d.value="Defense=ON"):(d.className="pbDefButOff",d.value="Defense=OFF")},eachSecond:function(){var c=Tabs.tower,e;for(e in Cities.byID)Seed.citystats["city"+e].gate!=c.defMode[e]&&(c.defMode[e]=Seed.citystats["city"+e].gate,c.displayDefMode(e));e=unixTime();if("array"!=matTypeof(Seed.queue_atkinc))for(var d in Seed.queue_atkinc){var g=Seed.queue_atkinc[d];parseIntNan(g.arrivalTime)> e&&g.departureTime>Options.alertConfig.lastAttack&&(Options.alertConfig.lastAttack=g.departureTime,c.newIncoming(g))}Options.alertSound.alarmActive&&e>Options.alertSound.expireTime&&c.stopSoundAlerts();c.towerMarches=[];for(g=0;g<Cities.cities.length;g++){var f=Cities.cities[g].id;c["attackCount_"+f]=0;c["scoutCount_"+f]=0}if("array"!=matTypeof(Seed.queue_atkinc))for(d in Seed.queue_atkinc)g=Seed.queue_atkinc[d],parseIntNan(g.arrivalTime)>e&&c.handleTowerData(g);for(g=0;g<Cities.cities.length;g++)f= Cities.cities[g].id,document.getElementById("pbattackqueue_"+f).value="DETAILS"+c["attackCount_"+f]},e_soundFinished:function(c){1==c&&!Options.alertSound.alarmActive&&(document.getElementById("pbSoundStop").disabled=!0)},e_soundFileLoaded:function(c,e){1==c&&(e?document.getElementById("pbLoadStat").innerHTML="ERROR.!!":document.getElementById("pbLoadStat").innerHTML="Completed ..")},playSound:function(c){var e=Tabs.tower;document.getElementById("pbSoundStop").disabled=!1;clearTimeout(e.soundStopTimer); clearTimeout(e.soundRepeatTimer);e.mss.play(1,0);e.soundStopTimer=setTimeout(function(){e.mss.stop(1);e.e_soundFinished(1)},1E3*Options.alertSound.playLength);c&&Options.alertSound.repeat?e.soundRepeatTimer=setTimeout(function(){e.playSound(!0)},6E4*Options.alertSound.repeatDelay):Options.alertSound.alarmActive=!1},soundTheAlert:function(){var c=Tabs.tower;Options.alertSound.alarmActive=!0;c.playSound(!0)},stopSoundAlerts:function(){var c=Tabs.tower;c.mss.stop(1);clearTimeout(c.soundStopTimer);clearTimeout(c.soundRepeatTimer); document.getElementById("pbSoundStop").disabled=!0;Options.alertSound.alarmActive=!1;Options.alertSound.expireTime=0},newIncoming:function(c){var e=Tabs.tower,d=c.toCityId;Options.alertConfig.hireGeneral&&0==Seed.leaders["city"+d].combatKnightId&&e.hireGeneral(d);var g=unixTime();Options.alertConfig.useBoostAttack&&parseInt(Seed.bonus.bC2600.bT2601)<g&&e.attackBoost(d);Options.alertConfig.useBoostHealth&&parseInt(Seed.bonus.bC2700.bT2701)<g&&e.attackHealth(d);e.postToChat(c)},attackHealth:function(c){i24h= Seed.items.i271;i7d=Seed.items.i272;if(0==i24h&&0==i7d)Logbuch.eintrag(Logs.globallog,"Boost your defenses <b>Kevlar Vest</b> OR <b>Body Armor</b>.");else{var e=0<i24h?271:272,d=unsafeWindow.Object.clone(unsafeWindow.g_ajaxparams);d.cid=c;d.iid=e;new MyAjaxRequest(unsafeWindow.g_ajaxpath+"boostCombat.php"+unsafeWindow.g_ajaxsuffix,{method:"post",parameters:d,onSuccess:function(c){if(c.ok){c=parseInt(c.expire,10);0===Seed.playerEffects.length&&(Seed.playerEffects={});if(261===e||262===e)Seed.bonus.bC2600.bT2601= c;else if(271===e||272===e)Seed.bonus.bC2700.bT2701=c;Seed.items["i"+e]--;unsafeWindow.update_boosts();Logbuch.eintrag(Logs.globallog,"Extra Defense Item <b>"+(271==e?"Kevlar Vest":"Body Armor")+"</b> Used ..")}else c=printLocalError(c.error_code||null,c.msg||null,c.feedback||null),Logbuch.eintrag(Logs.globallog,'Use Extra Defense Item FAILED.!<br><span class="boldRed">'+c+"</span>")},onFailure:function(){alert("Using Extra Defense Item.!")}})}},attackBoost:function(c){i24h=Seed.items.i261;i7d=Seed.items.i262; if(0==i24h&&0==i7d)Logbuch.eintrag(Logs.globallog,"Strengthening attack <b>Extra ammunition</b> more <b>Extra weapons</b>.");else{var e=0<i24h?261:262,d=unsafeWindow.Object.clone(unsafeWindow.g_ajaxparams);d.cid=c;d.iid=e;new MyAjaxRequest(unsafeWindow.g_ajaxpath+"boostCombat.php"+unsafeWindow.g_ajaxsuffix,{method:"post",parameters:d,onSuccess:function(c){if(c.ok){c=parseInt(c.expire,10);0===Seed.playerEffects.length&&(Seed.playerEffects={});if(261===e||262===e)Seed.bonus.bC2600.bT2601=c;else if(271=== e||272===e)Seed.bonus.bC2700.bT2701=c;Seed.items["i"+e]--;unsafeWindow.update_boosts();Logbuch.eintrag(Logs.globallog,"Extra Attack Item <b>"+(261==e?"Extra Ammo":"Extra Weapons")+"</b> IS USED ..")}else c=printLocalError(c.error_code||null,c.msg||null,c.feedback||null),Logbuch.eintrag(Logs.globallog,'Use Extra Attack Item FAILED.!<br><span class="boldRed">'+c+"</span>")},onFailure:function(){alert("Extra Sald\u0131r\u0131 \u00d6\u011fesini Kullanma.!")}})}},hireGeneral:function(c){var e=Seed.leaders["city"+ c].resourcefulnessKnightId,d=Seed.leaders["city"+c].politicsKnightId,g=Seed.leaders["city"+c].combatKnightId,f=Seed.leaders["city"+c].intelligenceKnightId,h=Seed.knights["city"+c],j=0,l=0,o;for(o in h)if(!(h[o].knightId==e||h[o].knightId==d||h[o].knightId==g||h[o].knightId==f)&&!(2>h[o].knightEnergy)&&1==h[o].knightStatus&&parseInt(h[o].experience)>l)j=h[o].knightId,l=parseInt(h[o].experience);0==j?Logbuch.eintrag(Logs.globallog,"NO IDLE GENERAL.! "+Cities.byID[c].name+" Fallible Chief of Staff..!"): (e=unsafeWindow.Object.clone(unsafeWindow.g_ajaxparams),e.cid=c,e.kid=j,e.pos=13,new MyAjaxRequest(unsafeWindow.g_ajaxpath+"assignknight.php"+unsafeWindow.g_ajaxsuffix,{method:"post",parameters:e,onSuccess:function(d){d.ok?(d=Seed.knights["city"+c],d["knt"+j].knightEnergy--,Seed.leaders["city"+c].combatKnightId=j.toString(),Seed.leaders["city"+c].leaderCombat=d["knt"+j].knightLevel,Logbuch.eintrag(Logs.globallog,"General "+d["knt"+j].knightName+" wurde in "+Cities.byID[c].name+" Fallible Chief of Staff..!")): (d=printLocalError(d.error_code||null,d.msg||null,d.feedback||null),Logbuch.eintrag(Logs.globallog,"Appointment of General Error Has Occurred..! "+Cities.byID[c].name+'.<br><span class="boldRed">'+d+"</span>"))},onFailure:function(){alert("Appointment of General Error Has Occurred..!")}}))},sendalert:function(c){var e=Tabs.tower;unixTime();Options.alertSound.enabled&&(e.soundTheAlert(c),c.arrivalTime>Options.alertSound.expireTime&&(Options.alertSound.expireTime=c.arrivalTime))},ajaxSetDefMode:function(c, e,d){var g=unsafeWindow.Object.clone(unsafeWindow.g_ajaxparams);g.cid=c;g.state=e;new MyAjaxRequest(unsafeWindow.g_ajaxpath+"gate.php"+unsafeWindow.g_ajaxsuffix,{method:"post",parameters:g,onSuccess:function(f){f.ok&&(Seed.citystats["city"+c].gate=e,d(e))},onFailure:function(){alert("Error Has Occurred..!")}})},onUnload:function(){},postToChat:function(c){var e=Tabs.tower,d,g;if(4==c.marchType){var f=Cities.byID[c.toCityId];if(f.tileId==c.toTileId)d="City Coordinate: ("+f.x+","+f.y+")";else{if(!Options.alertConfig.wilds)return; d="Wild Coordinate:";for(k in Seed.wilderness["city"+c.toCityId])if(Seed.wilderness["city"+c.toCityId][k].tileId==c.toTileId){d+=" den ("+Seed.wilderness["city"+c.toCityId][k].xCoord+","+Seed.wilderness["city"+c.toCityId][k].yCoord+")";break}}g=Seed.players["u"+c.pid]?Seed.players["u"+c.pid].n:c.players&&c.players["u"+c.pid]?c.players["u"+c.pid].n:"Attacker";c.fromXCoord&&(g+=" from ("+c.fromXCoord+","+c.fromYCoord+")");var h=c.players["u"+c.pid].a;g+=" ("+(Seed.allianceNames["a"+h]?Seed.allianceNames["a"+ h]+", ":"")+getDiplomacy(h)+")";h=Options.alertConfig.aPrefix+" ";h+="My "+d+" Me Attack Type: Attack The Person Who: "+g+"Soldiers To Reach My City: "+unsafeWindow.timestr(parseInt(c.arrivalTime-unixTime()))+"'var.Type and Number of Troops: ";d=0;for(k in c.unts)parseInt(k.substr(1)),h+=addCommas(c.unts[k])+" "+e.uu[k]+", ",d+=c.unts[k];if(!(d<Options.alertConfig.minTroops)){h=h.slice(0,-2);h+=".";if(f.tileId==c.toTileId&&(f=getCityBuilding(c.toCityId,17),0<f.count)){d=f.maxLevel;for(k in Seed.queue_atkinc)2== Seed.queue_atkinc[k].marchType&&Seed.queue_atkinc[k].toCityId==c.toCityId&&null==Cities.byID[Seed.queue_atkinc[k].fromCityId]&&--d;h+=" My embassy currently: "+d+" My Embassy Level with space and position: "+f.maxLevel+" 'dur.";0==e.defMode[c.toCityId]&&!0==Options.alertConfig.defend&&(h+=" My Soldiers Shelter.!!");1==e.defMode[c.toCityId]&&!0==Options.alertConfig.defend&&(h+=" My Soldiers Defense.!!")}try{e.sendalert(c)}catch(j){}Options.alertConfig.aChat&&sendChat("/a "+h)}}},handleTowerData:function(c){var e= Tabs.tower,d=unixTime(),g,f,h,j,l;g=Cities.byID[c.toCityId];if(4==c.marchType){e["attackCount_"+c.toCityId]++;if(g.tileId==c.toTileId)g="This is my CITY "+g.x+","+g.y;else for(k in g="TARGET",Seed.wilderness["city"+c.toCityId])if(Seed.wilderness["city"+c.toCityId][k].tileId==c.toTileId){g+=" den "+Seed.wilderness["city"+c.toCityId][k].xCoord+","+Seed.wilderness["city"+c.toCityId][k].yCoord;break}var o=[];for(i=1;25>i;i++)o[i]=0;for(k in c.unts)f=parseInt(k.substr(1)),o[f]=c.unts[k];Seed.players["u"+ c.pid]?(f=Seed.players["u"+c.pid].n,h=Seed.players["u"+c.pid].m,j=["a"+Seed.players["u"+c.pid].a],l=Seed.allianceNames[j]?Seed.allianceNames[j]:"n.A.",j=getDiplomacy(j)):c.players&&c.players["u"+c.pid]?(f=c.players["u"+c.pid].n,h=parseInt(c.players["u"+c.pid].m),j="a"+c.players["u"+c.pid].a,l=Seed.allianceNames[j]?Seed.allianceNames[j]:"n.A.",j=getDiplomacy(j)):j=l=h=f="n.A.";var q=c.fromXCoord?c.fromXCoord+","+c.fromYCoord:"n.A.",v=new Date;v.setTime(1E3*c.arrivalTime);e.towerMarches[e.towerMarches.length+ 1]={added:d,cityId:c.toCityId,target:g,arrival:parseIntNan(c.arrivalTime),atkType:"ATTACK",who:f,attackermight:h,allianceName:l,diplomacy:j,rtime:unsafeWindow.timestr(parseInt(c.arrivalTime-unixTime())),arrivingDatetime:v,source:q,units:o}}},showTowerIncoming:function(c){var e=Tabs.tower,d=Tabs.build.getCityNameById(c);null==e.popTowerIncoming&&(e.popTowerIncoming=new CPopup("pbtower_"+c,0,0,1200,500,!0,function(){clearTimeout(e.timer)}));e.popTowerIncoming.show(!1);e.popTowerIncoming.getMainDiv().innerHTML= '<div id="pbCityTowerContent" style="max-height:460px; height:460px; overflow-y:auto"></div>';e.popTowerIncoming.getTopDiv().innerHTML='<b style="position:relative; top:4px; left: 6px;">Attack Details Showing your city: '+d+"</b>";e.addCityData2Pop(c);e.popTowerIncoming.show(!0);clearTimeout(e.timer);e.timer=setTimeout(function(){e.showTowerIncoming(c)},5E3)},addCityData2Pop:function(c){var e=Tabs.tower,d="Supply Truck,Anti-Tank,Infantry,Sniper,SAM,Tank,Supply Chopper,Fighter,Gunship,Bomber,Stealth Bomber,Nuclear Weapons,Hell-Fire Tank,Predator Drone,Special Forces,Cargo Plane,Ion Cannon,Elite SAM,Elite Gunship".split(","); enc={};numSlots=0;document.getElementById("pbCityTowerContent").innerHTML="";if("array"!=matTypeof(Seed.queue_atkinc))for(k in Seed.queue_atkinc){var g=Seed.queue_atkinc[k];if(2==g.marchType){numSlots++;city=g.toCityId;from=g.fromPlayerId;enc[city]||(enc[city]={});enc[city][from]||(enc[city][from]=[]);k=[];k[0]=parseInt(g.knightCombat);for(i=1;25>i;i++)k[i]=Options.encRemaining?parseInt(g["unit"+i+"Return"]):parseInt(g["unit"+i+"Count"]);k[100]=parseInt(g.marchStatus);var f=unixTime();k[101]=parseInt(g.destinationUnixTime)- f;enc[city][from].push(k)}}var h=f="",j=[];for(i=0;25>i;i++)j[i]=0;g='<style> .oben{background:white; padding: 2px;} .tot{background:#f0e0f8; padding: 2px;} .city1{background:#ffffaa; padding: 2px;} .attack{background:#FF9999; padding: 2px;} .own{background:#66FF66; padding: 2px;}</style><table width="100%"><tr><td class="oben">&nbsp;</td>';for(k=0;k<d.length;k++)g+='<td style="text-align:right;" class="oben" width="5%"><b>'+d[k]+"</b></td>";g+="</tr>";dest=c;if(enc[dest])for(p in enc[dest]){try{player= Seed.players["u"+p].n}catch(l){player="???"}for(o=0;o<enc[dest][p].length;o++){knight="";0<enc[dest][p][o][0]&&(knight=" (Gen.: "+enc[dest][p][o][0]+")");stat="x";1==enc[dest][p][o][100]&&(stat=" ("+timestr(enc[dest][p][o][101])+")",stat=0>enc[dest][p][o][101]?" (Savunan)":" ("+timestr(enc[dest][p][o][101])+")");2==enc[dest][p][o][100]&&(stat=" (Savunan)");g+='<tr><td class="city1">';g+="<b>"+player+"</b>"+stat+knight;g+="</td>";for(i=1;25>i;i++)2==i||3==i||14==i||22==i||23==i||(num=enc[dest][p][o][i], g+='<td style="text-align:right;" class="city1">'+addCommas(num)+"</td>");g+="</tr>"}}else{g+='<tr><td class="city1"><b>Reinforcement Associations:</b></td>';for(i=1;25>i;i++)2==i||3==i||14==i||22==i||23==i||(g+='<td style="text-align:right;" class="city1">0</td>');g+="</tr>"}g+='<tr><td colspan="25"><br></tr><tr><td class="own"><B>Your own Military Associations:</b></td>';for(r=1;25>r;r++)2==r||3==r||14==r||22==r||23==r||(cityString="city"+c,num=parseInt(Seed.units[cityString]["unt"+r]),g+='<td style="text-align:right;" class="own">'+ addCommas(num)+"</td>");h+='<td class="city"></td><tr><td colspan="18"><br></td></tr><tr><td class="tot"><b>Content from the INTRUSION:</b></td>';if(0<e.towerMarches.length)for(k in e.towerMarches)if("undefined"!=typeof e.towerMarches[k].atkType&&e.towerMarches[k].cityId==c){h+="<table>";h+='<tr><td colspan="2">&nbsp;</td></tr>';h+="<tr>";h+="<td><b>Sira:&nbsp;&nbsp;</b></td>";h+="<td>"+e.towerMarches[k].target+"</td>";h+="</tr>";h+="<tr>";h+="<td><b>General:&nbsp;&nbsp;</b></td>";h+="<td>"+e.towerMarches[k].who+ "</td>";h+="</tr>";h+="<tr>";h+="<td><b>From Here:&nbsp;&nbsp;</b></td>";h+="<td>"+e.towerMarches[k].source+"</td>";h+="</tr>";h+="<tr>";h+="<td><b>Walking:&nbsp;&nbsp;</b></td>";h+="<td>"+addCommas(e.towerMarches[k].attackermight)+"</td>";h+="</tr>";h+="<tr>";h+="<td><b>Alliance:&nbsp;&nbsp;</b></td>";h+="<td>"+e.towerMarches[k].allianceName+"</td>";h+="</tr>";h+="<tr>";h+="<td><b>Diplomacy:&nbsp;&nbsp;</b></td>";h+="<td>"+e.towerMarches[k].diplomacy+"</td>";h+="</tr>";h+="<tr>";h+="<td><b>Incoming:&nbsp;&nbsp;</b></td>"; h+="<td>"+e.towerMarches[k].rtime+"</td>";h+="</tr>";h+="</table>";h+='<table cellspacing="0" width="100%"><tr><td style="text-align:left;">&nbsp;</td>';for(n=0;n<d.length;n++)h+='<td style="text-align:right;" width="5%"><b>'+d[n]+"</b></td>";var h=h+'</tr><tr><td class="attack" style="text-align:left;"><b>Units:</b></td>',o=Seed.queue_atkinc;for(u=1;25>u;u++)2==u||3==u||14==u||22==u||23==u||(num=e.towerMarches[k].units[u],h+='<td class="attack" style="text-align:right;">'+addCommas(parseInt(num))+ "</td>",j[u]+=parseInt(num));h+="</tr></table>"}f+='<tr><td colspan="18"><br></td></tr><tr><td class="attack"><b>Attacker:</b></td>';for(a=1;25>a;a++)2==a||3==a||14==a||22==a||23==a||(f+='<td class="attack" style="text-align:right;">'+addCommas(j[a])+"</td>");document.getElementById("pbCityTowerContent").innerHTML=g+f+h},sendReinforcmentHome:function(c,e,d,g,f){var h=Object.clone(g_ajaxparams);h.mid=c;h.cid=e;h.fromUid=d;h.fromCid=g;new Ajax.Request(g_ajaxpath+"ajax/kickoutReinforcements.php"+g_ajaxsuffix, {method:"post",parameters:h,onSuccess:function(e){e=eval("("+e.responseText+")");if(e.ok){Modal.showAlert(g_js_strings.kickout_allies.troopshome);seed.resources["city"+currentcityid].rec1[3]=parseInt(seed.resources["city"+currentcityid].rec1[3])-f;if(parseInt(d)==parseInt(tvuid)){var e=seed.queue_atkp["city"+g]["m"+c],h=Math.abs(parseInt(e.destinationUnixTime)-parseInt(e.eventUnixTime));e.returnUnixTime=unixTime()+h;e.marchStatus=8}delete seed.queue_atkinc["m"+c]}else Modal.showAlert(printLocalError(e.error_code|| null,e.msg||null,e.feedback||null))},onFailure:function(){}})}}; Tabs.transport={tabOrder:2,tabLabel:"Transport",tabDisabled:!ENABLE_TRANSPORT,myDiv:null,timer:null,traderState:[],lTR:[],tradeRoutes:[],checkdotradetimeout:null,count:0,check:!1,uu:{u1:"Supply Truck:",u9:"Supply Chopper:",u19:"Cargo Plane:"},reportTimer:null,init:function(c){var e=Tabs.transport;e.myDiv=c;e.traderState={running:!1};e.readTraderState();e.readTradeRoutes();c=[];c.push('<table class="ptTab ptStat" width="100%">');c.push("<tr>");c.push('<td style="text-align:center;">');c.push("<b>TRANSPORT MENU</b>"); c.push("</td>");c.push("</tr>");c.push("</table>");c.push("<br>");c.push('<table width="100%">');c.push("<tr>");c.push('<td style="text-align:center;">');!1==e.traderState.running?c.push('<input id="pbTraderState" type="submit" value="Transport = OPEN/CLOSE">'):(c.push('<input id="pbTraderState" type="submit" value="Transport = OPEN/CLOSE">'),e.report());c.push('&nbsp;&nbsp;&nbsp;<input id="pbShowRoutes" type="submit" value="Show Records">');c.push("</td>");c.push("</tr>");c.push("</table>");c.push("<br>"); c.push('<table class="ptTab ptStat" width="100%">');c.push("<tr>");c.push('<td style="text-align:center;">');c.push("<b>Auto Transport Options</b>");c.push("</td>");c.push("</tr>");c.push("</table>");c.push("<br>");c.push('<table width="100%">');c.push("<tr>");c.push("<td>");c.push("Transport Control TIME IN: ");c.push('<input id="pbtransportinterval" style="text-align:center;" type="text" size="2" value="'+Options.transportinterval+'"> Minutes checked..:');c.push("</td>");c.push("</tr>");c.push("<tr>"); c.push("<td>");c.push("Carrying Amount Allows unit to be entered in the box .. ");c.push('<input id="pbminwagons" style="text-align:center;" type="text" size="2" value="'+Options.minwagons+'">');c.push("</td>");c.push("</tr>");c.push("<tr>");c.push("<td>");c.push('<input id="ptdeletereports" type="checkbox"'+(Options.deletetransports?' checked="checked"':"")+">&nbsp;");c.push("Click in the box to DELETE the Transport Reports..!");c.push("</td>");c.push("</tr>");c.push("</table>");c.push("<br>");c.push('<table class="ptTab ptStat" width="100%">'); c.push("<tr>");c.push('<td style="text-align:center;">');c.push("<b>Auto Transport</b>");c.push("</td>");c.push("</tr>");c.push("</table>");c.push("<br>");c.push("<br>");c.push("<br>");c.push('<table id="pbaddtraderoute">');c.push("<tr>");c.push("<td>From here:&nbsp;</td>");c.push('<td><span id="ptrescity"></span></td>');c.push("</tr>");c.push("<tr>");c.push("<td>To here:&nbsp;</td>");c.push('<td><span id="ptcityTo"></span></td>');c.push("</tr>");c.push("<tr>");c.push("<td>OR, Coordinate:&nbsp;</td>"); c.push("<td>");c.push('<input id="ptcityX" style="text-align:center;" type="text" size="3">&nbsp;/&nbsp;');c.push('<input id="ptcityY" style="text-align:center;" type="text" size="3">');c.push("</td>");c.push("</tr>");c.push("</table>");c.push("<br>");c.push('<table id="pbaddtraderoute">');c.push("<tr>");c.push("<td>Unit HSE:&nbsp;</td>");c.push("<td>");c.push('<select id="TransportTroop">');for(y in e.uu){var d=e.uu[y];c.push('<option value="'+findoptvalue(y)+'">');c.push(d);c.push("</option>")}c.push("</select>"); c.push("</td>");c.push("<td>&nbsp;&nbsp;With:&nbsp;");c.push('<span id="TroopAmount"></span>');c.push("&nbsp;/&nbsp;Capacity:&nbsp;");c.push('<span id="CarryAmount"></span>');c.push("</td>");c.push("</tr>");c.push("<tr>");c.push("<td>Quantity:&nbsp;</td>");c.push("<td>");c.push('<input id="TroopsToSend" style="text-align:center;" type="text" size="6" maxlength="9" value="0">');c.push("&nbsp;&nbsp;");c.push('<input id="MaxTroops" type="submit" value="MAX">');c.push("</td>");c.push("<td>");c.push('&nbsp;&nbsp;<input id="FillInMax" type="submit" value="DELETE">&nbsp;'); c.push('<span id="Calc"></span>');c.push("</td>");c.push("</tr>");c.push("</table>");c.push("<br>");c.push('<table id="pbaddtraderoute" width="100%">');c.push("<tr>");c.push("<td><b>Material Number:&nbsp;</b></td>");c.push('<td style="text-align:right;"><b>From here</b></td>');c.push('<td style="text-align:right;"><b>To here</b></td>');c.push('<td style="text-align:center;">&nbsp;<b>ACTIVE??</b>&nbsp;</td>');c.push("<td><b>KEEP</b></td>");c.push("<td><b>Amount to be moved</b></td>");c.push("<td>&nbsp;</td>"); c.push("</tr>");c.push("<tr>");c.push("<td>FOOD:&nbsp;</td>");c.push('<td id="TransRec1" style="text-align:right;"></td>');c.push('<td id="HaveRec1" style="text-align:right;"></td>');c.push('<td style="text-align:center;"><input id="pbshipFood" type="checkbox" unchecked="true"></td>');c.push('<td><input id="pbtargetamountFood" type="text" size="9" maxlength="15" value="0" disabled="true"></td>');c.push('<td><input id="pbtradeamountFood" type="text" size="9" maxlength="15" value="0"></td>');c.push('<td><input id="MaxFood" type="submit" value="MAX"></td>'); c.push("</tr>");c.push("<tr>");c.push("<td>OIL:&nbsp;</td>");c.push('<td id="TransRec2" style="text-align:right;"></td>');c.push('<td id="HaveRec2" style="text-align:right;"></td>');c.push('<td style="text-align:center;"><input id="pbshipOil" type="checkbox" unchecked="true"></td>');c.push('<td><input id="pbtargetamountOil" type="text" size="9" maxlength="15" value="0" disabled="true"></td>');c.push('<td><input id="pbtradeamountOil" type="text" size="9" maxlength="15" value="0"></td>');c.push('<td><input id="MaxOil" type="submit" value="MAX"></td>'); c.push("</tr>");c.push("<tr>");c.push("<td>STONE:&nbsp;</td>");c.push('<td id="TransRec3" style="text-align:right;"></td>');c.push('<td id="HaveRec3" style="text-align:right;"></td>');c.push('<td style="text-align:center;"><input id="pbshipStone" type="checkbox" unchecked="true"></td>');c.push('<td><input id="pbtargetamountStone" type="text" size="9" maxlength="15" value="0" disabled="true"></td>');c.push('<td><input id="pbtradeamountStone" type="text" size="9" maxlength="15" value="0"></td>');c.push('<td><input id="MaxStone" type="submit" value="MAX"></td>'); c.push("</tr>");c.push("<tr>");c.push("<td>STEEL:&nbsp;</td>");c.push('<td id="TransRec4" style="text-align:right;"></td>');c.push('<td id="HaveRec4" style="text-align:right;"></td>');c.push('<td style="text-align:center;"><input id="pbshipSteel" type="checkbox" unchecked="true"></td>');c.push('<td><input id="pbtargetamountSteel" type="text" size="9" maxlength="15" value="0" disabled="true"></td>');c.push('<td><input id="pbtradeamountSteel" type="text" size="9" maxlength="15" value="0"></td>');c.push('<td><input id="MaxSteel" type="submit" value="MAX"></td>'); c.push("</tr>");c.push("<tr>");c.push("<td>TITANIUM:&nbsp;</td>");c.push('<td id="TransRec5" style="text-align:right;"></td>');c.push('<td id="HaveRec5" style="text-align:right;"></td>');c.push('<td style="text-align:center;"><input id="pbshipTita" type="checkbox" unchecked="true"></td>');c.push('<td><input id="pbtargetamountTita" type="text" size="9" maxlength="15" value="0" disabled="true"></td>');c.push('<td><input id="pbtradeamountTita" type="text" size="9" maxlength="15" value="0"></td>');c.push('<td><input id="MaxTita" type="submit" value="MAX"></td>'); c.push("</tr>");c.push("<tr>");c.push("<td>GRAPHENE:&nbsp;</td>");c.push('<td id="TransRec6" style="text-align:right;"></td>');c.push('<td id="HaveRec6" style="text-align:right;"></td>');c.push('<td style="text-align:center;"><input id="pbshipGraph" type="checkbox" unchecked="true"></td>');c.push('<td><input id="pbtargetamountGraph" type="text" size="9" maxlength="15" value="0" disabled="true"></td>');c.push('<td><input id="pbtradeamountGraph" type="text" size="9" maxlength="15" value="0"></td>'); c.push('<td><input id="MaxGraph" type="submit" value="MAX"></td>');c.push("</tr>");c.push("<tr>");c.push("<td>GOLD:&nbsp;</td>");c.push('<td id="TransGold" style="text-align:right;"></td>');c.push('<td id="HaveGold" style="text-align:right;"></td>');c.push('<td style="text-align:center;"><input id="pbshipGold" type="checkbox" unchecked="true"></td>');c.push('<td><input id="pbtargetamountGold" type="text" size="9" maxlength="15" value="0" disabled="true"></td>');c.push('<td><input id="pbtradeamountGold" type="text" size="9" maxlength="15" value="0"></td>'); c.push('<td><input id="MaxGold" type="submit" value="MAX"></td>');c.push("</tr>");c.push("</table>");c.push("<br>");c.push('<div id="pbTraderDivDRoute" style="text-align:center;">');c.push('<input id="pbSaveRoute" type="submit" value="Registration ADD!">&nbsp;&nbsp;');c.push('<input id="pbManualSend" type="submit" value="MANUALLY MOVE">');c.push("</div>");c.push("<br>");c.push('<div id="errorSpace"></div>');c.push("<hr>");c.push('<table width="100%">');c.push("<tr>");c.push("<td><b>Department of Transport Activity Monitoring:</b><br><br></td>"); c.push('<td style="text-align: right;">');c.push('<input id="ptButClearTransLog" type="submit" name="ClearBLog" value="CLEAR">');c.push("</td>");c.push("</tr>");c.push("<tr>");c.push('<td colspan="2">');c.push('<div id="pbtranslog" style="height: 150px; overflow: auto;"></div>');c.push("</td>");c.push("</tr>");c.push("</table>");e.myDiv.innerHTML=c.join("");try{e.e_tradeRoutes()}catch(g){}document.getElementById("TransportTroop").value="unt19";e.tcp=new CdispCityPicker("pttrader",document.getElementById("ptrescity"), !0,e.updateResources,0);e.tcpto=(new CdispCityPicker("pttraderTo",document.getElementById("ptcityTo"),!0,e.clickCitySelect)).bindToXYboxes(document.getElementById("ptcityX"),document.getElementById("ptcityY"));document.getElementById("ptdeletereports").addEventListener("click",function(){!0==document.getElementById("ptdeletereports").checked?(document.getElementById("ptdeletereports").checked=!0,Options.deletetransports=!0):(document.getElementById("ptdeletereports").checked=!1,Options.deletetransports= !1);saveOptions()},!1);document.getElementById("TransportTroop").addEventListener("change",function(){e.updateTroops()},!1);document.getElementById("pbTraderState").addEventListener("click",function(){e.toggleTraderState(this)},!1);document.getElementById("pbSaveRoute").addEventListener("click",function(){e.addTradeRoute()},!1);document.getElementById("pbManualSend").addEventListener("click",function(){e.ManualTransport()},!1);document.getElementById("pbShowRoutes").addEventListener("click",function(){e.showTradeRoutes()}, !1);document.getElementById("FillInMax").addEventListener("click",function(){document.getElementById("TroopsToSend").value=e.TroopsNeeded},!1);document.getElementById("MaxTroops").addEventListener("click",function(){var c=e.getRallypoint("city"+e.tcp.city.id),d=e.Troops;e.Troops>1E4*c&&(d=1E4*c);document.getElementById("TroopsToSend").value=d},!1);document.getElementById("MaxFood").addEventListener("click",function(){e.Food=0;document.getElementById("pbtradeamountFood").value=e.MaxLoad-(e.Food+e.Oil+ e.Stone+e.Steel+e.Gold+e.Graph+e.Tita)},!1);document.getElementById("MaxOil").addEventListener("click",function(){e.Oil=0;document.getElementById("pbtradeamountOil").value=e.MaxLoad-(e.Food+e.Oil+e.Stone+e.Steel+e.Gold+e.Graph+e.Tita)},!1);document.getElementById("MaxStone").addEventListener("click",function(){e.Stone=0;document.getElementById("pbtradeamountStone").value=e.MaxLoad-(e.Food+e.Oil+e.Stone+e.Steel+e.Gold+e.Graph+e.Tita)},!1);document.getElementById("MaxSteel").addEventListener("click", function(){e.Steel=0;document.getElementById("pbtradeamountSteel").value=e.MaxLoad-(e.Food+e.Oil+e.Stone+e.Steel+e.Gold+e.Graph+e.Tita)},!1);document.getElementById("MaxGraph").addEventListener("click",function(){e.Graph=0;document.getElementById("pbtradeamountGraph").value=e.MaxLoad-(e.Food+e.Oil+e.Stone+e.Steel+e.Gold+e.Graph+e.Tita)},!1);document.getElementById("MaxTita").addEventListener("click",function(){e.Tita=0;document.getElementById("pbtradeamountTita").value=e.MaxLoad-(e.Food+e.Oil+e.Stone+ e.Steel+e.Gold+e.Graph+e.Tita)},!1);document.getElementById("MaxGold").addEventListener("click",function(){e.Gold=0;document.getElementById("pbtradeamountGold").value=e.MaxLoad-(e.Food+e.Oil+e.Stone+e.Steel+e.Gold+e.Graph+e.Tita)},!1);document.getElementById("pbtransportinterval").addEventListener("keyup",function(){isNaN(document.getElementById("pbtransportinterval").value)&&(document.getElementById("pbtransportinterval").value=60);Options.transportinterval=document.getElementById("pbtransportinterval").value; saveOptions()},!1);document.getElementById("pbtargetamountFood").addEventListener("keyup",function(){isNaN(document.getElementById("pbtargetamountFood").value)&&(document.getElementById("pbtargetamountFood").value=0)},!1);document.getElementById("pbtargetamountOil").addEventListener("keyup",function(){isNaN(document.getElementById("pbtargetamountOil").value)&&(document.getElementById("pbtargetamountOil").value=0)},!1);document.getElementById("pbtargetamountStone").addEventListener("keyup",function(){isNaN(document.getElementById("pbtargetamountStone").value)&& (document.getElementById("pbtargetamountStone").value=0)},!1);document.getElementById("pbtargetamountSteel").addEventListener("keyup",function(){isNaN(document.getElementById("pbtargetamountSteel").value)&&(document.getElementById("pbtargetamountSteel").value=0)},!1);document.getElementById("pbtargetamountGraph").addEventListener("keyup",function(){isNaN(document.getElementById("pbtargetamountGraph").value)&&(document.getElementById("pbtargetamountGraph").value=0)},!1);document.getElementById("pbtargetamountTita").addEventListener("keyup", function(){isNaN(document.getElementById("pbtargetamountTita").value)&&(document.getElementById("pbtargetamountTita").value=0)},!1);document.getElementById("pbtargetamountGold").addEventListener("keyup",function(){isNaN(document.getElementById("pbtargetamountGold").value)&&(document.getElementById("pbtargetamountGold").value=0)},!1);document.getElementById("pbtradeamountFood").addEventListener("keyup",function(){isNaN(document.getElementById("pbtradeamountFood").value)&&(document.getElementById("pbtradeamountFood").value= 0)},!1);document.getElementById("pbtradeamountOil").addEventListener("keyup",function(){isNaN(document.getElementById("pbtradeamountOil").value)&&(document.getElementById("pbtradeamountOil").value=0)},!1);document.getElementById("pbtradeamountStone").addEventListener("keyup",function(){isNaN(document.getElementById("pbtradeamountStone").value)&&(document.getElementById("pbtradeamountStone").value=0)},!1);document.getElementById("pbtradeamountSteel").addEventListener("keyup",function(){isNaN(document.getElementById("pbtradeamountSteel").value)&& (document.getElementById("pbtradeamountSteel").value=0)},!1);document.getElementById("pbtradeamountGraph").addEventListener("keyup",function(){isNaN(document.getElementById("pbtradeamountGraph").value)&&(document.getElementById("pbtradeamountGraph").value=0)},!1);document.getElementById("pbtradeamountTita").addEventListener("keyup",function(){isNaN(document.getElementById("pbtradeamountTita").value)&&(document.getElementById("pbtradeamountTita").value=0)},!1);document.getElementById("pbtradeamountGold").addEventListener("keyup", function(){isNaN(document.getElementById("pbtradeamountGold").value)&&(document.getElementById("pbtradeamountGold").value=0)},!1);document.getElementById("pbminwagons").addEventListener("keyup",function(){isNaN(document.getElementById("pbminwagons").value)&&(document.getElementById("pbminwagons").value=100);Options.minwagons=parseInt(document.getElementById("pbminwagons").value);saveOptions()},!1);document.getElementById("pbshipFood").addEventListener("click",function(){!1==document.getElementById("pbshipFood").checked? document.getElementById("pbtargetamountFood").disabled=!0:document.getElementById("pbtargetamountFood").disabled=!1},!1);document.getElementById("pbshipOil").addEventListener("click",function(){!1==document.getElementById("pbshipOil").checked?document.getElementById("pbtargetamountOil").disabled=!0:document.getElementById("pbtargetamountOil").disabled=!1},!1);document.getElementById("pbshipStone").addEventListener("click",function(){!1==document.getElementById("pbshipStone").checked?document.getElementById("pbtargetamountStone").disabled= !0:document.getElementById("pbtargetamountStone").disabled=!1},!1);document.getElementById("pbshipSteel").addEventListener("click",function(){!1==document.getElementById("pbshipSteel").checked?document.getElementById("pbtargetamountSteel").disabled=!0:document.getElementById("pbtargetamountSteel").disabled=!1},!1);document.getElementById("pbshipGraph").addEventListener("click",function(){!1==document.getElementById("pbshipGraph").checked?document.getElementById("pbtargetamountGraph").disabled=!0: document.getElementById("pbtargetamountGraph").disabled=!1},!1);document.getElementById("pbshipTita").addEventListener("click",function(){!1==document.getElementById("pbshipTita").checked?document.getElementById("pbtargetamountTita").disabled=!0:document.getElementById("pbtargetamountTita").disabled=!1},!1);document.getElementById("pbshipGold").addEventListener("click",function(){!1==document.getElementById("pbshipGold").checked?document.getElementById("pbtargetamountGold").disabled=!0:document.getElementById("pbtargetamountGold").disabled= !1},!1);document.getElementById("ptButClearTransLog").addEventListener("click",function(){Logs.translog=[];saveLogs();e.logbuch()},!1);Logs.translog||(Logs.translog=[],saveLogs());e.logbuch()},logbuch:function(){var c=Logbuch.ausgabe(Logs.translog);document.getElementById("pbtranslog").innerHTML=c},updateResources:function(){for(var c=Tabs.transport,e=null,d=1;6>=d;d++)document.getElementById("TransRec"+d).innerHTML=addCommas(parseInt(Seed.resources["city"+c.tcp.city.id]["rec"+d][0]/3600));document.getElementById("TransGold").innerHTML= addCommas(parseInt(Seed.citystats["city"+c.tcp.city.id].gold[0]));for(ii in Seed.cities)Seed.cities[ii][2]==document.getElementById("ptcityX").value&&Seed.cities[ii][3]==document.getElementById("ptcityY").value&&(e=Seed.cities[ii][0]);for(d=1;6>=d;d++)null!=e?document.getElementById("HaveRec"+d).innerHTML=addCommas(parseInt(Seed.resources["city"+e]["rec"+d][0]/3600)):document.getElementById("HaveRec"+d).innerHTML="----";null!=e?document.getElementById("HaveGold").innerHTML=addCommas(parseInt(Seed.citystats["city"+ e].gold[0])):document.getElementById("HaveGold").innerHTML="----"},updateTroops:function(){var c=Tabs.transport,e="black";c.Food=parseInt(document.getElementById("pbtradeamountFood").value);c.Oil=parseInt(document.getElementById("pbtradeamountOil").value);c.Stone=parseInt(document.getElementById("pbtradeamountStone").value);c.Steel=parseInt(document.getElementById("pbtradeamountSteel").value);c.Graph=parseInt(document.getElementById("pbtradeamountGraph").value);c.Tita=parseInt(document.getElementById("pbtradeamountTita").value); c.Gold=parseInt(document.getElementById("pbtradeamountGold").value);var d=document.getElementById("TransportTroop").value;c.Troops=parseInt(Seed.units["city"+c.tcp.city.id][d]);var g=parseInt(Seed.tech.tch10),d=parseInt(unsafeWindow.unitstats[d]["5"]),g=g*10*(d/100)+d,d=c.Troops*g;c.MaxLoad=parseInt(document.getElementById("TroopsToSend").value)*g;c.TroopsNeeded=(c.Food+c.Oil+c.Stone+c.Steel+c.Graph+c.Tita+c.Gold)/g;c.TroopsNeeded=c.TroopsNeeded.toFixed(0);c.TroopsNeeded<(c.Food+c.Oil+c.Stone+c.Steel+ c.Graph+c.Tita+c.Gold)/g&&c.TroopsNeeded++;c.TroopsNeeded>c.Troops&&(e="red");0<c.Troops?document.getElementById("TroopAmount").innerHTML='<span style="color:'+e+'">'+addCommas(c.Troops)+"</span>":document.getElementById("TroopAmount").innerHTML=0;0<d?document.getElementById("CarryAmount").innerHTML=addCommas(d):document.getElementById("CarryAmount").innerHTML=0;document.getElementById("Calc").innerHTML="Material Number: "+addCommas(c.Food+c.Oil+c.Stone+c.Steel+c.Gold+c.Graph+c.Tita)+" / "+addCommas(c.MaxLoad)+ "&nbsp;(Number of Units: "+addCommas(c.TroopsNeeded)+")"},getRallypoint:function(c){for(var e in Seed.buildings[c]){var d=parseInt(Seed.buildings[c][e][0]),g=parseInt(Seed.buildings[c][e][1]);if(12==d)return parseInt(g)}return 0},e_tradeRoutes:function(){var c=Tabs.transport,e=new Date;!0==c.traderState.running&&(e=(new Date).getTime()/1E3,e=e.toFixed(0),e>parseInt(Options.lasttransport)+60*Options.transportinterval&&c.checkdoTrades());setTimeout(function(){c.e_tradeRoutes()},1E3*Options.transportinterval)}, delTradeRoutes:function(){Tabs.transport.tradeRoutes=[]},checkcoords:function(c){var e=Tabs.transport;"pbok"==c.id&&(e.check=!0,e.addTradeRoute())},addTradeRoute:function(){var c=Tabs.transport,e=c.tcp.city.id;if(0==document.getElementById("ptcityX").value&&0==document.getElementById("ptcityY").value&&!c.check)document.getElementById("errorSpace").innerHTML='<span class="boldRed">0,0 Want to coordinate Walking. Are you sure??!!</span>',setTimeout(function(){document.getElementById("errorSpace").innerHTML= ""},5E3);else{var d=document.getElementById("pbshipFood").checked,g=document.getElementById("pbshipOil").checked,f=document.getElementById("pbshipStone").checked,h=document.getElementById("pbshipSteel").checked,j=document.getElementById("pbshipGraph").checked,l=document.getElementById("pbshipTita").checked,o=document.getElementById("pbshipGold").checked,q=document.getElementById("pbtargetamountFood").value,v=document.getElementById("pbtargetamountOil").value,w=document.getElementById("pbtargetamountStone").value, E=document.getElementById("pbtargetamountSteel").value,B=document.getElementById("pbtargetamountGraph").value,z=document.getElementById("pbtargetamountTita").value,C=document.getElementById("pbtargetamountGold").value,F=document.getElementById("pbtradeamountFood").value,A=document.getElementById("pbtradeamountOil").value,G=document.getElementById("pbtradeamountStone").value,H=document.getElementById("pbtradeamountSteel").value,I=document.getElementById("pbtradeamountGraph").value,L=document.getElementById("pbtradeamountTita").value, D=document.getElementById("pbtradeamountGold").value,M=document.getElementById("ptcityX").value,N=document.getElementById("ptcityY").value,O=document.getElementById("TransportTroop").value;c.tradeRoutes.push({city:e,ship_Food:d,target_Food:q,trade_Food:F,ship_Oil:g,target_Oil:v,trade_Oil:A,ship_Stone:f,target_Stone:w,trade_Stone:G,ship_Steel:h,target_Steel:E,trade_Steel:H,ship_Graph:j,target_Graph:B,trade_Graph:I,ship_Tita:l,target_Tita:z,trade_Tita:L,ship_Gold:o,target_Gold:C,trade_Gold:D,target_x:M, target_y:N,TroopType:O,route_state:"true"});document.getElementById("pbTraderDivDRoute").style.background="maroon";setTimeout(function(){document.getElementById("pbTraderDivDRoute").style.background=""},1E3)}},showTradeRoutes:function(){var c=Tabs.transport;c.popTradeRoutes=new CPopup("pbShowTrade",0,0,550,500,!0,function(){clearTimeout(1E3)});c.popTradeRoutes.getMainDiv().innerHTML='<div style="max-height:460px; height:460px; overflow-y:auto"><table width="100%"><tr><td id="pbRoutesQueue"></td></tr></table></div>'; c.popTradeRoutes.getTopDiv().innerHTML='<b style="position:relative; top:4px; left: 6px;">Registered transportations:</b>';c.paintTradeRoutes();c.popTradeRoutes.show(!0)},paintTradeRoutes:function(){for(var c=Tabs.transport,e=c.tradeRoutes,d,g=null,f='<br><table id="paintRoutes" width="99%">',h=0;h<e.length;h++){for(var g=null,j=0;j<Seed.cities.length;j++)parseInt(Seed.cities[j][0])==e[h].city&&(d=Seed.cities[j][1]),parseInt(Seed.cities[j][2])==e[h].target_x&&parseInt(Seed.cities[j][3])==e[h].target_y&& (g=Seed.cities[j][1]);var j=h,g=null==g?e[h].target_x+","+e[h].target_y:g,l=e[h].route_state?'<span style="color:green;">ACTIVE</span>':'<span style="color:red;">PASSIVE</span>',o=void 0==e[h].TroopType?"unt9":e[h].TroopType,o="u"+o.substring(3),f=f+('<tr><td style="width:20px; border-top:1px solid silver;padding-top:10px;">'+(h+1)+"</td>"),f=f+('<td style="border-top:1px solid silver;padding-top:10px;"><input type="submit" onclick="traceEdit('+j+')" value="CLEAR">&nbsp;&nbsp;'),f=f+('<input type="submit" onclick="traceDelete('+ j+')" value="DELETE!">&nbsp;&nbsp;'),f=f+(l+"</td>"),f=f+'<td style="border-top:1px solid silver;padding-top:10px;">&nbsp;</td>',f=f+"</tr>",f=f+"<tr>",f=f+"<td>&nbsp;</td>",f=f+"<td>",f=f+"<br><table>",f=f+'<tr><td style="padding-bottom:5px;"><b>MATERIAL&nbsp;</b></td><td style="text-align:right;padding-bottom:5px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>KEEP</b></td><td style="text-align:right;padding-bottom:5px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>Amount to be moved</b></td></tr>';e[h].ship_Food&&(f+= '<tr><td>FOOD:&nbsp;</td><td style="text-align:right;">'+addCommas(e[h].target_Food)+'</td><td style="text-align:right;">'+addCommas(e[h].trade_Food)+"</td></tr>");e[h].ship_Oil&&(f+='<tr><td>OIL:&nbsp;</td><td style="text-align:right;">'+addCommas(e[h].target_Oil)+'</td><td style="text-align:right;">'+addCommas(e[h].trade_Oil)+"</td></tr>");e[h].ship_Stone&&(f+='<tr><td>STONE:&nbsp;</td><td style="text-align:right;">'+addCommas(e[h].target_Stone)+'</td><td style="text-align:right;">'+addCommas(e[h].trade_Stone)+ "</td><tr>");e[h].ship_Steel&&(f+='<tr><td>STEEL:&nbsp;</td><td style="text-align:right;">'+addCommas(e[h].target_Steel)+'</td><td style="text-align:right;">'+addCommas(e[h].trade_Steel)+"</td></tr>");e[h].ship_Tita&&(f+='<tr><td>TITANIUM:&nbsp;</td><td style="text-align:right;">'+addCommas(e[h].target_Tita)+'</td><td style="text-align:right;">'+addCommas(e[h].trade_Tita)+"</td></tr>");e[h].ship_Graph&&(f+='<tr><td>GRAPHENE:&nbsp;</td><td style="text-align:right;">'+addCommas(e[h].target_Graph)+'</td><td style="text-align:right;">'+ addCommas(e[h].trade_Graph)+"</td></tr>");e[h].ship_Gold&&(f+='<tr><td>GOLD:&nbsp;</td><td style="text-align:right;">'+addCommas(e[h].target_Gold)+'</td><td style="text-align:right;">'+addCommas(e[h].trade_Gold)+"</td></tr>");f+="</table><br>";f+="</td>";f+='<td style="padding-left:50px;">';f+="<br><table>";f+="<tr><td><b>From here:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td>"+d+"</td></tr>";f+="<tr><td><b>To here:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td>"+g+"</td></tr>";f+="<tr><td><b>Unit:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td>"+ c.uu[o]+"</td></tr>";f+="</table><br>";f+="</td>";f+="</tr>"}document.getElementById("pbRoutesQueue").innerHTML=f+"</table>";unsafeWindow.traceEdit=c.editQueueElement;unsafeWindow.traceDelete=c.cancelQueueElement},cancelQueueElement:function(c){var e=Tabs.transport,c=parseInt(c);e.tradeRoutes.splice(c,1);e.showTradeRoutes()},editQueueElement:function(c){for(var e=Tabs.transport,d=e.tradeRoutes,c=parseInt(c),g,f=null,h=0;h<Seed.cities.length;h++)parseInt(Seed.cities[h][0])==d[c].city&&(g=Seed.cities[h][1]), parseInt(Seed.cities[h][2])==d[c].target_x&&parseInt(Seed.cities[h][3])==d[c].target_y&&(f=Seed.cities[h][1]);f=null==f?d[c].target_x+","+d[c].target_y:f;g='<div><b>Editing Options:</b></div><br><table id="editRoutes"><tr><td><b>From Here:</b>&nbsp;</td>'+("<td>"+g+"</td></tr>")+"<tr><td><b>To Here:</b>&nbsp;</td>"+("<td>"+f+"</td></tr>")+'<tr><td><b>ACTIVE:</b>&nbsp;&nbsp;&nbsp;</td><td><input id="TradeStatus" type="checkbox"></td></tr><tr><td><b>Volume Contents:</b>&nbsp;&nbsp;&nbsp;</td><td><select id="pbbTransportTroop">'; for(h in e.uu)f=e.uu[h],g+='<option value="'+findoptvalue(h)+'">',g+=f,g+="</option>";document.getElementById("pbRoutesQueue").innerHTML=g+'</select></td></tr></table><br><br><table id="editRoutes"><tr><td style="padding-bottom:5px;"><b>MATERIAL</b>&nbsp;&nbsp;</td><td style="text-align:center;padding-bottom:5px;">&nbsp;&nbsp;<b>ACTIVE??</b>&nbsp;&nbsp;</td><td style="padding-bottom:5px;"><b>KEEP</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td style="padding-bottom:5px;"><b>Amount to be moved</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td></tr><tr><td>FOOD:&nbsp;</td><td style="text-align:center;"><input id="pbbshipfood" type="checkbox"></td><td><input id="pbbtargetamountfood" type="text" size="9" maxlength="15" value="0"></td><td><input id="pbbtradeamountfood" type="text" size="9" maxlength="15" value="0"></td></tr><tr><td>OIL:&nbsp;</td><td style="text-align:center;"><input id="pbbshipOil" type="checkbox"></td><td><input id="pbbtargetamountOil" type="text" size="9" maxlength="15" value="0"></td><td><input id="pbbtradeamountOil" type="text" size="9" maxlength="15" value="0"></td></tr><tr><td>STONE:&nbsp;</td><td style="text-align:center;"><input id="pbbshipstone" type="checkbox"></td><td><input id="pbbtargetamountstone" type="text" size="9" maxlength="15" value="0"></td><td><input id="pbbtradeamountstone" type="text" size="9" maxlength="15" value="0"></td></tr><tr><td>STEEL:&nbsp;</td><td style="text-align:center;"><input id="pbbshipSteel" type="checkbox"></td><td><input id="pbbtargetamountSteel" type="text" size="9" maxlength="15" value="0"></td><td><input id="pbbtradeamountSteel" type="text" size="9" maxlength="15" value="0"></td></tr><tr><td>TITANIUM:&nbsp;</td><td style="text-align:center;"><input id="pbbshiptita" type="checkbox"></td><td><input id="pbbtargetamounttita" type="text" size="9" maxlength="15" value="0"></td><td><input id="pbbtradeamounttita" type="text" size="9" maxlength="15" value="0"></td></tr><tr><td>GRAPHENE:&nbsp;</td><td style="text-align:center;"><input id="pbbshipgraph" type="checkbox"></td><td><input id="pbbtargetamountgraph" type="text" size="9" maxlength="15" value="0"></td><td><input id="pbbtradeamountgraph" type="text" size="9" maxlength="15" value="0"></td></tr><tr><td>GOLD:&nbsp;</td><td style="text-align:center;"><input id="pbbshipgold" type="checkbox"></td><td><input id="pbbtargetamountgold" type="text" size="9" maxlength="15" value="0"></td><td><input id="pbbtradeamountgold" type="text" size="9" maxlength="15" value="0"></td></tr></table><BR><table id="editRoutes"><tr><td><input id="Cancel" type="submit" value="CANCEL">&nbsp;&nbsp;&nbsp;<input id="Save" type="submit" value="SAVE"></td></tr></table>'; document.getElementById("TradeStatus").checked=d[c].route_state;h=void 0==d[c].TroopType?"unt19":d[c].TroopType;document.getElementById("pbbTransportTroop").value=h;document.getElementById("pbbshipfood").checked=d[c].ship_Food;document.getElementById("pbbshipOil").checked=d[c].ship_Oil;document.getElementById("pbbshipstone").checked=d[c].ship_Stone;document.getElementById("pbbshipSteel").checked=d[c].ship_Steel;document.getElementById("pbbshipgraph").checked=d[c].ship_Graph;document.getElementById("pbbshiptita").checked= d[c].ship_Tita;document.getElementById("pbbshipgold").checked=d[c].ship_Gold;document.getElementById("pbbtargetamountfood").value=d[c].target_Food;document.getElementById("pbbtargetamountOil").value=d[c].target_Oil;document.getElementById("pbbtargetamountstone").value=d[c].target_Stone;document.getElementById("pbbtargetamountSteel").value=d[c].target_Steel;document.getElementById("pbbtargetamountgraph").value=d[c].target_Graph;document.getElementById("pbbtargetamounttita").value=d[c].target_Tita; document.getElementById("pbbtargetamountgold").value=d[c].target_Gold;document.getElementById("pbbtradeamountfood").value=d[c].trade_Food;document.getElementById("pbbtradeamountOil").value=d[c].trade_Oil;document.getElementById("pbbtradeamountstone").value=d[c].trade_Stone;document.getElementById("pbbtradeamountSteel").value=d[c].trade_Steel;document.getElementById("pbbtradeamountgraph").value=d[c].trade_Graph;document.getElementById("pbbtradeamounttita").value=d[c].trade_Tita;document.getElementById("pbbtradeamountgold").value= d[c].trade_Gold;document.getElementById("Cancel").addEventListener("click",function(){e.showTradeRoutes()},!1);document.getElementById("Save").addEventListener("click",function(){d[c].route_state=document.getElementById("TradeStatus").checked;d[c].TroopType=document.getElementById("pbbTransportTroop").value;d[c].ship_Food=document.getElementById("pbbshipfood").checked;d[c].ship_Oil=document.getElementById("pbbshipOil").checked;d[c].ship_Stone=document.getElementById("pbbshipstone").checked;d[c].ship_Steel= document.getElementById("pbbshipSteel").checked;d[c].ship_Graph=document.getElementById("pbbshipgraph").checked;d[c].ship_Tita=document.getElementById("pbbshiptita").checked;d[c].ship_Gold=document.getElementById("pbbshipgold").checked;d[c].target_Food=document.getElementById("pbbtargetamountfood").value;d[c].target_Oil=document.getElementById("pbbtargetamountOil").value;d[c].target_Stone=document.getElementById("pbbtargetamountstone").value;d[c].target_Steel=document.getElementById("pbbtargetamountSteel").value; d[c].target_Graph=document.getElementById("pbbtargetamountgraph").value;d[c].target_Tita=document.getElementById("pbbtargetamounttita").value;d[c].target_Gold=document.getElementById("pbbtargetamountgold").value;d[c].trade_Food=document.getElementById("pbbtradeamountfood").value;d[c].trade_Oil=document.getElementById("pbbtradeamountOil").value;d[c].trade_Stone=document.getElementById("pbbtradeamountstone").value;d[c].trade_Steel=document.getElementById("pbbtradeamountSteel").value;d[c].trade_Graph= document.getElementById("pbbtradeamountgraph").value;d[c].trade_Tita=document.getElementById("pbbtradeamounttita").value;d[c].trade_Gold=document.getElementById("pbbtradeamountgold").value;e.showTradeRoutes()},!1)},saveTradeRoutes:function(){var c=Tabs.transport,e=getServerId();GM_setValue("tradeRoutes_"+e+"_"+unsafeWindow.g_ajaxsuffix.substr(3),JSON2.stringify(c.tradeRoutes))},readTradeRoutes:function(){var c=Tabs.transport,e=getServerId();s=GM_getValue("tradeRoutes_"+e+"_"+unsafeWindow.g_ajaxsuffix.substr(3)); if(null!=s)for(k in route=JSON2.parse(s),route)c.tradeRoutes[k]=route[k]},saveTraderState:function(){var c=Tabs.transport,e=getServerId();GM_setValue("traderState_"+e+"_"+unsafeWindow.g_ajaxsuffix.substr(3),JSON2.stringify(c.traderState))},readTraderState:function(){var c=Tabs.transport,e=getServerId();s=GM_getValue("traderState_"+e+"_"+unsafeWindow.g_ajaxsuffix.substr(3));if(null!=s)for(k in state=JSON2.parse(s),state)c.traderState[k]=state[k]},toggleTraderState:function(c){var e=Tabs.transport; !0==e.traderState.running?(e.traderState.running=!1,c.value="Transport = OFF",clearTimeout(e.checkdotradetimeout),e.count=0):(e.traderState.running=!0,c.value="Transport = ON",e.e_tradeRoutes(),e.report())},checkdoTrades:function(){var c=Tabs.transport;if(0!=c.tradeRoutes.length)if(c.doTrades(c.count),c.count++,c.count<c.tradeRoutes.length)c.checkdotradetimeout=setTimeout(function(){c.checkdoTrades()},5E3);else{var e=(new Date).getTime()/1E3,e=e.toFixed(0);Options.lasttransport=e;saveOptions();c.count= 0}},doTrades:function(c){var e=Tabs.transport;if(0!=e.tradeRoutes.length&&e.tradeRoutes[c].route_state){var d=unsafeWindow.Object.clone(unsafeWindow.g_ajaxparams);d.gold=0;d.r1=0;d.r2=0;d.r3=0;d.r4=0;d.r5=0;d.r6=0;var g=d.kid=0,f=e.tradeRoutes[c].city,h="city"+f;if(Cities.byID[f]){var j=e.tradeRoutes[c].target_x,l=e.tradeRoutes[c].target_y,o=e.tradeRoutes[c].trade_Food,q=e.tradeRoutes[c].trade_Oil,v=e.tradeRoutes[c].trade_Stone,w=e.tradeRoutes[c].trade_Steel,E=e.tradeRoutes[c].trade_Graph,B=e.tradeRoutes[c].trade_Tita, z=e.tradeRoutes[c].trade_Gold,C=e.tradeRoutes[c].target_Food,F=e.tradeRoutes[c].target_Oil,A=e.tradeRoutes[c].target_Stone,G=e.tradeRoutes[c].target_Steel,H=e.tradeRoutes[c].target_Graph,I=e.tradeRoutes[c].target_Tita,L=e.tradeRoutes[c].target_Gold,D=e.tradeRoutes[c].ship_Food,M=e.tradeRoutes[c].ship_Oil,N=e.tradeRoutes[c].ship_Stone,O=e.tradeRoutes[c].ship_Steel,R=e.tradeRoutes[c].ship_Graph,S=e.tradeRoutes[c].ship_Tita,T=e.tradeRoutes[c].ship_Gold,U=parseInt(Seed.resources[h].rec1[0]/3600),V=parseInt(Seed.resources[h].rec2[0]/ 3600),W=parseInt(Seed.resources[h].rec3[0]/3600),X=parseInt(Seed.resources[h].rec4[0]/3600),J=parseInt(Seed.resources[h].rec5[0]/3600),Y=parseInt(Seed.resources[h].rec6[0]/3600),Q=parseInt(Seed.citystats[h].gold),C=U-C,F=V-F,A=W-A,G=X-G,H=Y-H,I=J-I,J=0;if(0>C||!1==D)C=0;if(0>F||!1==M)F=0;if(0>A||!1==N)A=0;if(0>G||!1==O)G=0;if(0>H||!1==R)H=0;if(0>I||!1==S)I=0;0<o&&C>o&&(C=parseInt(o));0<q&&F>q&&(F=parseInt(q));0<v&&A>v&&(A=parseInt(v));0<w&&G>w&&(G=parseInt(w));0<E&&H>E&&(H=parseInt(E));0<B&&I>B&& (I=parseInt(B));o=void 0==e.tradeRoutes[c].TroopType?parseInt(Seed.units[h].unt19):parseInt(Seed.units[h][e.tradeRoutes[c].TroopType]);q=e.getRallypoint(h);parseInt(o)>parseInt(1E4*q)&&(o=1E4*q);var K=void 0==e.tradeRoutes[c].TroopType?"unt19":e.tradeRoutes[c].TroopType,h=parseInt(Seed.units[h][K]);parseInt(h)>parseInt(o)&&(h=o);c=parseInt(Seed.tech.tch10);q=parseInt(unsafeWindow.unitstats[K]["5"]);c=c*10*(q/100)+q;h*=c;if(!(0>=o)){for(o=0;o<Seed.cities.length;o++)if(parseInt(Seed.cities[o][0])== f)var P=Seed.cities[o][1];o=h/6;q=h/6;v=h/6;w=h/6;E=h/6;B=h/6;if(0>h-C-F-A-G-H-I){D=0;C<o&&(D+=o-C,o=C);F<q&&(D+=q-F,q=F);A<v&&(D+=v-A,v=A);G<w&&(D+=w-G,w=G);H<E&&(D+=E-H,E=H);I<B&&(D+=B-I,B=I);for(;1<D;)C<o+D?(D-=C,o=C):(o+=D,D-=D),F<q+D?(D-=F,q=F):(q+=D,D-=D),A<v+D?(D-=A,v=A):(v+=D,D-=D),G<w+D?(D-=G,w=G):(w+=D,D-=D),H<E+D?(D-=H,E=H):(E+=D,D-=D),I<B+D?(D-=I,B=I):(B+=D,D-=D);C=o;F=q;A=v;G=w;H=E;I=B}h>C+F+A+G+H+I&&!0==T&&(h-(C+F+A+G+H+I)>Q-L?(J=Q-L,0>J&&(J=0)):J=h-(C+F+A+G+H+I),0<z&&J>z&&(J=parseInt(z))); g=(C+F+A+G+H+I+J)/c;g=g.toFixed(0);g<(C+F+A+G+H+I+J)/c&&g++;if(g<Options.minwagons)Logbuch.eintrag(Logs.translog,"Skipped Found Sufficient material for Shipping .."),e.logbuch();else{z=unsafeWindow.Object.values(Seed.outgoing_marches["c"+f]).detect(function(c){return c.marchId&&parseInt(c.marchStatus,10)===unsafeWindow.Constant.MarchStatus.INACTIVE});d.cid=f;d.mid=z.marchId;d.type="1";d.kid="0";d.xcoord=j;d.ycoord=l;d.r1=C;d.r2=F;d.r3=A;d.r4=G;d.r5=I;d.r6=H;d.gold=J;switch(K){case "unt1":d.u1=g;break; case "unt9":d.u9=g;break;case "unt19":d.u19=g}var Z=unixTime();0<C+F+A+G+H+I+J&&new MyAjaxRequest(unsafeWindow.g_ajaxpath+"march.php"+unsafeWindow.g_ajaxsuffix,{method:"post",parameters:d,onSuccess:function(c){if(c.ok){for(var f="",h=0;h<Seed.cities.length;h++)parseInt(Seed.cities[h][2])==j&&parseInt(Seed.cities[h][3])==l&&(f=Seed.cities[h][1]);f=""!=f?"Carrying the City <b>"+P+"</b>'To <b>"+f+"</b>'e<br>"+addCommas(g)+" "+e.uu["u"+K.substr(3)]+" Per Unit "+addCommas(d.r1+d.r2+d.r3+d.r4+d.r5+d.r6+ d.gold)+" Source Transport you are finished..!":"Carrying the City <b>"+P+"</b>'To <b>"+j+","+l+"</b>'e<br>"+addCommas(g)+" "+e.uu["u"+K.substr(3)]+" Per Unit "+addCommas(d.r1+d.r2+d.r3+d.r4+d.r5+d.r6+d.gold)+" Source Transport you are finished..!";Logbuch.eintrag(Logs.translog,f);e.logbuch();for(f=1;25>f;f++)d["u"+f]&&(Seed.units["city"+d.cid]["unt"+f]-=d["u"+f]);f=unixTime();h={destinationUnixTime:2*f-Z+c.oneway,marchUnixTime:f,returnUnixTime:c.returnEta,toXCoord:d.xcoord,toYCoord:d.ycoord,marchType:1, knightId:0,marchStatus:1,marchId:d.mid};h.gold=d.gold;for(f=1;7>f;f++)h["resource"+f]=d["r"+f];for(;25>f;f++)h.unit1Count=d["u"+f]?d["u"+f]:0,h.unit1Return=0;c.tileId&&(h.toTileId=c.tileId,h.toTileType=c.tileType,h.toTileLevel=c.tileLevel);Seed.outgoing_marches["c"+d.cid]["m"+d.mid]=h}else c=unsafeWindow.printLocalError(c.error_code||null,c.msg||null,c.feedback||null),Logbuch.eintrag(Logs.translog,"Transport Processes not be your city: "+P+'<br><span class="boldRed">'+c+"</span>"),e.logbuch()},onFailure:function(){alert("Error Has Occurred During Transport.!!")}})}}}}}, ManualTransport:function(){var c=Tabs.transport;if(!(""==document.getElementById("ptcityX").value||""==document.getElementById("ptcityY").value||c.TroopsNeeded>c.Troops)){var e=c.tcp.city.id,d=unsafeWindow.Object.clone(unsafeWindow.g_ajaxparams),g=document.getElementById("TransportTroop").value;parseInt(Seed.tech.tch10);parseInt(unsafeWindow.unitstats[g]["5"]);parseInt(unsafeWindow.unitstats[g]["5"]);parseInt(Seed.units["city"+e][g]);document.getElementById("errorSpace").innerHTML="";if(0==document.getElementById("TroopsToSend").value)document.getElementById("errorSpace").innerHTML= '<span style="color:red;">Soldiers selecting Transport..!!</span>',setTimeout(function(){document.getElementById("errorSpace").innerHTML=""},5E3);else{var f=unsafeWindow.Object.values(Seed.outgoing_marches["c"+e]).detect(function(c){return c.marchId&&parseInt(c.marchStatus,10)===unsafeWindow.Constant.MarchStatus.INACTIVE});d.cid=e;d.mid=f.marchId;d.kid=0;d.type="1";d.xcoord=parseInt(document.getElementById("ptcityX").value);d.ycoord=parseInt(document.getElementById("ptcityY").value);d.r1=parseInt(document.getElementById("pbtradeamountFood").value); d.r2=parseInt(document.getElementById("pbtradeamountOil").value);d.r3=parseInt(document.getElementById("pbtradeamountStone").value);d.r4=parseInt(document.getElementById("pbtradeamountSteel").value);d.r5=parseInt(document.getElementById("pbtradeamountTita").value);d.r6=parseInt(document.getElementById("pbtradeamountGraph").value);d.gold=parseInt(document.getElementById("pbtradeamountGold").value);var h=parseInt(document.getElementById("TroopsToSend").value);switch(g){case "unt1":d.u1=h;break;case "unt9":d.u9= h;break;case "unt19":d.u19=h}var j=unixTime();0<d.r1+d.r2+d.r3+d.r4+d.r5+d.r6+d.gold&&new MyAjaxRequest(unsafeWindow.g_ajaxpath+"march.php"+unsafeWindow.g_ajaxsuffix,{method:"post",parameters:d,onSuccess:function(e){if(e.ok){for(var f=0;f<Seed.cities.length;f++)if(parseInt(Seed.cities[f][0])==d.cid)var q=Seed.cities[f][1];for(var v="",f=0;f<Seed.cities.length;f++)parseInt(Seed.cities[f][2])==d.xcoord&&parseInt(Seed.cities[f][3])==d.ycoord&&(v=Seed.cities[f][1]);f=""!=v?"Hand carry the City: <b>"+ q+"</b> To <b>"+v+"</b><br>"+addCommas(h)+" "+c.uu["u"+g.substr(3)]+"  "+addCommas(d.r1+d.r2+d.r3+d.r4+d.r5+d.r6+d.gold)+" Were the amount of resource to carry ..!":"Hand carry the City: <b>"+q+"</b> To <b>"+d.xcoord+","+d.ycoord+"</b><br>"+addCommas(h)+" "+c.uu["u"+g.substr(3)]+"  "+addCommas(d.r1+d.r2+d.r3+d.r4+d.r5+d.r6+d.gold)+" Were the amount of resource to carry ..!";Logbuch.eintrag(Logs.translog,f);c.logbuch();for(f=1;25>f;f++)d["u"+f]&&(Seed.units["city"+d.cid]["unt"+f]-=d["u"+f]);f=unixTime(); q={destinationUnixTime:2*f-j+e.oneway,marchUnixTime:f,returnUnixTime:e.returnEta,toXCoord:d.xcoord,toYCoord:d.ycoord,marchType:1,knightId:0,marchStatus:1,marchId:d.mid};q.gold=d.gold;for(f=1;7>f;f++)q["resource"+f]=d["r"+f];for(;25>f;f++)q.unit1Count=d["u"+f]?d["u"+f]:0,q.unit1Return=0;e.tileId&&(q.toTileId=e.tileId,q.toTileType=e.tileType,q.toTileLevel=e.tileLevel);Seed.outgoing_marches["c"+d.cid]["m"+d.mid]=q;document.getElementById("pbtradeamountFood").value=0;document.getElementById("pbtradeamountOil").value= 0;document.getElementById("pbtradeamountStone").value=0;document.getElementById("pbtradeamountSteel").value=0;document.getElementById("pbtradeamountGold").value=0;document.getElementById("pbtradeamountGraph").value=0;document.getElementById("pbtradeamountTita").value=0;document.getElementById("TroopsToSend").value=0}else f='<span style="color:red;">ERROR: '+unsafeWindow.printLocalError(e.error_code||null,e.msg||null,e.feedback||null)+"</span>",Logbuch.eintrag(Logs.translog,f),c.logbuch()},onFailure:function(){alert("Error Has Occurred During Transport.!!")}})}}}, show:function(){var c=Tabs.transport;clearTimeout(c.timer);c.updateTroops();c.updateResources();c.timer=setTimeout(c.show,1E3)},hide:function(){clearTimeout(Tabs.transport.timer)},report:function(){var c=Tabs.transport;clearTimeout(c.reportTimer);if(Options.deletetransports&&c.traderState.running){var e=unsafeWindow.Object.clone(unsafeWindow.g_ajaxparams);e.pageNo=1;e.showAll=0;new MyAjaxRequest(unsafeWindow.g_ajaxpath+"listMarchReport.php"+unsafeWindow.g_ajaxsuffix,{method:"post",parameters:e,onSuccess:function(d){c.reportlist(d)}, onFailure:function(d){c.reportlist(d)}})}c.reportTimer=setTimeout(c.report,6E5)},reportlist:function(c){var e=Tabs.transport;if(c.ok){var d=[],g;for(g in c.arReports){var f=c.arReports[g];"1"==f.marchType&&f.side1PlayerId==unsafeWindow.g_ajaxsuffix.substr(3)&&f.side0PlayerId==unsafeWindow.g_ajaxsuffix.substr(3)&&d.push(f.marchReportId)}if(0<d.length){c=unsafeWindow.Object.clone(unsafeWindow.g_ajaxparams);c.s0rids="";c.eventids="";c.s1rids=d.join(",");var h=d.length;new MyAjaxRequest(unsafeWindow.g_ajaxpath+ "deleteCheckedReports.php"+unsafeWindow.g_ajaxsuffix,{method:"post",parameters:c,onSuccess:function(c){e.deletereports(c,h)},onFailure:function(c){e.deletereports(c,h)}})}}},deletereports:function(c,e){var d=Tabs.transport;c.ok&&(Seed.newReportCount=parseInt(Seed.newReportCount)-e,1==e?Logbuch.eintrag(Logs.translog,e+" Transport Report has been DELETED..!!"):Logbuch.eintrag(Logs.translog,e+" DELETED Transport Reports..!!"),d.logbuch())}}; Tabs.Artefacts={tabOrder:6,tabLabel:"Attack",cont:null,tabDisabled:!ENABLE_ARTEFACTS,displayTimer:null,attackTimer:null,artifactTimer:null,modalTimer:null,reportTimer:null,startUnixTime:0,koordlist:[],koordlistpointer:0,attack:!0,started:!1,setstarted:!1,startvalue:"Attack ON/OFF",artset:"Artifacts ON/OFF",id:{},read:!0,wildtypes:{"0":"Wasteland",10:"River",11:"Lake",12:"Peak",20:"Oil",30:"Land",40:"Mountain",50:"Barrens",51:"Terrorist Camp",52:"Wreckage",53:"Camouflaged City",201:"Titanium",202:"Graphene", 203:"Uranium",204:"Diamond"},stopreload:!1,popart:null,popaarttimer:null,setonly:0,init:function(c){var e=Tabs.Artefacts;e.cont=c;var c={},d="";for(i=0;i<Cities.numCities;i++)c["c"+Cities.cities[i].id]=Cities.cities[i].name,0==i&&(d="c"+Cities.cities[i].id);if(!Options.pbartcity||""==Options.pbartcity)Options.pbartcity=d,saveOptions();d=[];d.push('<table class="ptTab ptStat" width="100%">');d.push("<tr>");d.push('<td style="text-align:center;">');d.push("<b>ATTACK MENU</b>");d.push("</td>");d.push("</tr>"); d.push("</table>");d.push("<br>");d.push('<table class="ptTab" width="100%">');d.push("<tr>");d.push('<td style="text-align:center;">');d.push('<input id="ptartstart" type="submit" name="ArtButton" value="'+e.startvalue+'"> ');d.push('<input id="ptartset" type="submit" name="ArtSet" value="'+e.artset+'">');d.push('<input id="ptartsetview" type="submit" name="ArtSetView" value="Inventory Function">');d.push("</td>");d.push("</tr>");d.push("</table>");d.push("<br>");d.push('<table class="ptTab">'); d.push("<tr>");d.push("<td><b>CITY:</b></td>");d.push("<td>"+htmlSelector(c,Options.pbartcity,'id="ptartcity"')+"&nbsp;&nbsp;");d.push('<span id="ptenergy"></span></td>');d.push("</tr>");d.push("<tr>");d.push("<td><b>Attack Type:&nbsp;</b></td>");d.push("<td>"+htmlSelector({w:"Single Attack",f:"Continuous Attack"},Options.pbarttype,'id="ptarttype"')+"&nbsp;&nbsp;");d.push('<span id="pttypehint"></span></td>');d.push("</tr>");d.push("<tr>");d.push("<td><b>OR, Coordinate (xxx,yyy):</b></td>");d.push('<td><input id="ptartx" type="text" size="2" maxlength="3" style="text-align: center;">'); d.push(" / ");d.push('<input id="ptarty" type="text" size="2" maxlength="3" style="text-align: center;">&nbsp;&nbsp;');d.push('<span id="ptdist"></span>');d.push('<span id="ptfieldinfo"></span></td>');d.push("</tr>");d.push("<tr>");d.push('<td style="vertical-align: top;"><b style="position: relative; top: 5px;">ADD Coordinates:&nbsp;</b>');d.push("<br><br>xxx,yyy<br>xxx,yyy<br>xxx,yyy<br>vs...</td>");d.push('<td><textarea id="ptartklist" rows="5" cols="20"></textarea>');d.push('<br><input id="ptartkcheck" type="submit" name="KoordCheck" value="SAVE Coordinates.!!">&nbsp;'); d.push('<span id="ptcheckinfo">Selected Coordinates</span></td>');d.push("</tr>");d.push("<tr>");d.push("<td><b>Interval:</b></td>");d.push('<td><input id="ptartinterval" type="text" size="2" maxlength="3" style="text-align: center;">:: Enter Attack Time Interval in the box.!! / (Must remain at least 6 seconds ..)</td>');d.push("</tr>");d.push("<tr>");d.push("<td><b>Reserve:</b></td>");d.push('<td><input id="ptartenergysave" type="text" size="2" maxlength="3" style="text-align: center;">:: Conserve energy points of the Generals (Total)</td>'); d.push("</tr>");d.push("<tr>");d.push("<td><b>Note:</b></td>");d.push('<td><input id="ptarthidemodal" type="checkbox"> Note the window at the found artifact set will close automatically.</td>');d.push("</tr>");d.push("<tr>");d.push("<td><b>Report:</b></td>");d.push('<td><input id="ptartdeletereport" type="checkbox"> Delete battle reports (only terrorists and wilds).</td>');d.push("</tr>");d.push("</table>");d.push("<br>");d.push('<table class="ptTab">');d.push("<tr>");d.push('<td colspan="8"><b><u>MILITARY UNITS:</u></b><br>&nbsp;</td>'); d.push("</tr>");d.push("<tr>");d.push("<td><b>Supply Truck:</b>&nbsp;</td>");d.push('<td>&nbsp;<input id="ptartu1" type="text" size="5" maxlength="6" style="text-align: center;">&nbsp;</td>');d.push('<td width="50">&nbsp;</td>');d.push("<td><b>Infantry:</b>&nbsp;</td>");d.push('<td>&nbsp;<input id="ptartu5" type="text" size="5" maxlength="6" style="text-align: center;">&nbsp;</td>');d.push('<td width="50">&nbsp;</td>');d.push("<td><b>Sniper:</b>&nbsp;</td>");d.push('<td>&nbsp;<input id="ptartu6" type="text" size="5" maxlength="6" style="text-align: center;">&nbsp;</td>'); d.push("</tr>");d.push("<tr>");d.push("<td><b>Anti-Tank:</b>&nbsp;</td>");d.push('<td>&nbsp;<input id="ptartu4" type="text" size="5" maxlength="6" style="text-align: center;">&nbsp;</td>');d.push('<td width="50">&nbsp;</td>');d.push("<td><b>Special Forces:</b>&nbsp;</td>");d.push('<td>&nbsp;<input id="ptartu18" type="text" size="5" maxlength="6" style="text-align: center;">&nbsp;</td>');d.push('<td width="50">&nbsp;</td>');d.push("<td><b>SAM:</b>&nbsp;</td>");d.push('<td>&nbsp;<input id="ptartu7" type="text" size="5" maxlength="6" style="text-align: center;">&nbsp;</td>'); d.push("</tr>");d.push("<tr>");d.push("<td><b>Tank:</b>&nbsp;</td>");d.push('<td>&nbsp;<input id="ptartu8" type="text" size="5" maxlength="6" style="text-align: center;">&nbsp;</td>');d.push('<td width="50">&nbsp;</td>');d.push("<td><b>Hell-Fire Tank:</b>&nbsp;</td>");d.push('<td>&nbsp;<input id="ptartu16" type="text" size="5" maxlength="6" style="text-align: center;">&nbsp;</td>');d.push('<td width="50">&nbsp;</td>');d.push("<td><b>Predator Drone:</b>&nbsp;</td>");d.push('<td>&nbsp;<input id="ptartu17" type="text" size="5" maxlength="6" style="text-align: center;">&nbsp;</td>'); d.push("</tr>");d.push("<tr>");d.push("<td><b>Supply Chopper:</b>&nbsp;</td>");d.push('<td>&nbsp;<input id="ptartu9" type="text" size="5" maxlength="6" style="text-align: center;">&nbsp;</td>');d.push('<td width="50">&nbsp;</td>');d.push("<td><b>Gunship:</b>&nbsp;</td>");d.push('<td>&nbsp;<input id="ptartu11" type="text" size="5" maxlength="6" style="text-align: center;">&nbsp;</td>');d.push('<td width="50">&nbsp;</td>');d.push("<td><b>Fighter:</b>&nbsp;</td>");d.push('<td>&nbsp;<input id="ptartu10" type="text" size="5" maxlength="6" style="text-align: center;">&nbsp;</td>'); d.push("</tr>");d.push("<tr>");d.push("<td><b>Bomber:</b>&nbsp;</td>");d.push('<td>&nbsp;<input id="ptartu12" type="text" size="5" maxlength="6" style="text-align: center;">&nbsp;</td>');d.push('<td width="50">&nbsp;</td>');d.push("<td><b>Stealth Bomber:</b>&nbsp;</td>");d.push('<td>&nbsp;<input id="ptartu13" type="text" size="5" maxlength="6" style="text-align: center;">&nbsp;</td>');d.push('<td width="50">&nbsp;</td>');d.push("<td><b>Cargo Plane:</b>&nbsp;</td>");d.push('<td>&nbsp;<input id="ptartu19" type="text" size="5" maxlength="6" style="text-align: center;">&nbsp;</td>'); d.push("</tr>");d.push("<tr>");d.push("<td><b>Elite SAM:</b>&nbsp;</td>");d.push('<td>&nbsp;<input id="ptartu21" type="text" size="5" maxlength="6" style="text-align: center;">&nbsp;</td>');d.push('<td width="50">&nbsp;</td>');d.push("<td><b>Elite Gunship:</b>&nbsp;</td>");d.push('<td>&nbsp;<input id="ptartu24" type="text" size="5" maxlength="6" style="text-align: center;">&nbsp;</td>');d.push('<td width="50">&nbsp;</td>');d.push("<td>&nbsp;</td>");d.push("<td>&nbsp;</td>");d.push("</tr>");d.push("</table>"); d.push("<br>");d.push("<hr>");d.push('<table width="100%">');d.push("<tr>");d.push("<td><b>RESEARCH AND ATTACK OPERATIONS MONITORING MENU:</b><br><br></td>");d.push('<td style="text-align: right;">');d.push('<input id="ptButClearALog" type="submit" name="ClearELog" value="CLEAR">');d.push("</td>");d.push("</tr>");d.push("<tr>");d.push('<td colspan="2">');d.push('<div id="ptartlog" style="height: 120px; overflow: auto;">');d.push("</div>");d.push("</td>");d.push("</tr>");d.push("</table>");e.cont.innerHTML= d.join("");e.id.ptartcity=document.getElementById("ptartcity");e.id.ptarttype=document.getElementById("ptarttype");e.id.ptartklist=document.getElementById("ptartklist");e.id.ptartx=document.getElementById("ptartx");e.id.ptarty=document.getElementById("ptarty");e.id.ptartinterval=document.getElementById("ptartinterval");e.id.ptartenergysave=document.getElementById("ptartenergysave");e.id.ptarthidemodal=document.getElementById("ptarthidemodal");e.id.ptartdeletereport=document.getElementById("ptartdeletereport"); e.id.ptartu1=document.getElementById("ptartu1");e.id.ptartu4=document.getElementById("ptartu4");e.id.ptartu5=document.getElementById("ptartu5");e.id.ptartu6=document.getElementById("ptartu6");e.id.ptartu7=document.getElementById("ptartu7");e.id.ptartu8=document.getElementById("ptartu8");e.id.ptartu9=document.getElementById("ptartu9");e.id.ptartu10=document.getElementById("ptartu10");e.id.ptartu11=document.getElementById("ptartu11");e.id.ptartu12=document.getElementById("ptartu12");e.id.ptartu13=document.getElementById("ptartu13"); e.id.ptartu16=document.getElementById("ptartu16");e.id.ptartu17=document.getElementById("ptartu17");e.id.ptartu18=document.getElementById("ptartu18");e.id.ptartu19=document.getElementById("ptartu19");e.id.ptartu21=document.getElementById("ptartu21");e.id.ptartu24=document.getElementById("ptartu24");e.id.ptButClearALog=document.getElementById("ptButClearALog");e.id.ptartstart=document.getElementById("ptartstart");e.id.ptartset=document.getElementById("ptartset");e.id.ptartkcheck=document.getElementById("ptartkcheck"); e.id.ptenergy=document.getElementById("ptenergy");e.id.ptdist=document.getElementById("ptdist");e.id.pttypehint=document.getElementById("pttypehint");e.id.ptartlog=document.getElementById("ptartlog");e.id.ptcheckinfo=document.getElementById("ptcheckinfo");e.id.ptfieldinfo=document.getElementById("ptfieldinfo");e.id.ptartsetview=document.getElementById("ptartsetview");e.finfo();e.id.ptartcity.addEventListener("change",function(c){Options.pbartcity=c.target.value;saveOptions();e.show()},!1);e.id.ptarttype.addEventListener("change", function(c){Options.pbarttype=c.target.value;saveOptions();e.show()},!1);e.changeOpt(e.id.ptartklist,"pbartklist");e.changeOpt(e.id.ptartx,"pbartx");e.changeOpt(e.id.ptarty,"pbarty");e.changeOpt(e.id.ptartinterval,"pbartinterval");e.changeOpt(e.id.ptartenergysave,"pbartenergysave");e.togOpt(e.id.ptarthidemodal,"pbarthidemodal");e.togOpt(e.id.ptartdeletereport,"pbartdeletereport");e.changeOpt(e.id.ptartu1,"pbartu1");e.changeOpt(e.id.ptartu4,"pbartu4");e.changeOpt(e.id.ptartu5,"pbartu5");e.changeOpt(e.id.ptartu6, "pbartu6");e.changeOpt(e.id.ptartu7,"pbartu7");e.changeOpt(e.id.ptartu8,"pbartu8");e.changeOpt(e.id.ptartu9,"pbartu9");e.changeOpt(e.id.ptartu10,"pbartu10");e.changeOpt(e.id.ptartu11,"pbartu11");e.changeOpt(e.id.ptartu12,"pbartu12");e.changeOpt(e.id.ptartu13,"pbartu13");e.changeOpt(e.id.ptartu16,"pbartu16");e.changeOpt(e.id.ptartu17,"pbartu17");e.changeOpt(e.id.ptartu18,"pbartu18");e.changeOpt(e.id.ptartu19,"pbartu19");e.changeOpt(e.id.ptartu21,"pbartu21");e.changeOpt(e.id.ptartu24,"pbartu24");e.id.ptButClearALog.addEventListener("click", e.ClearALog,!1);e.id.ptartstart.addEventListener("click",e.AttackOnOff,!1);e.id.ptartset.addEventListener("click",function(){Tabs.Artefacts.setonly=0;e.setcollectinit()},!1);e.id.ptartkcheck.addEventListener("click",e.klistcheck,!1);e.id.ptartsetview.addEventListener("click",e.popartview,!1);e.show()},show:function(){var c=Tabs.Artefacts;c.id.ptartstart.value=c.startvalue;c.id.ptartset.value=c.artset;!c.started&&!c.setstarted&&(c.id.ptartcity.disabled=!1,c.id.ptartx.disabled=!1,c.id.ptarty.disabled= !1,c.id.ptarttype.disabled=!1,c.id.ptartklist.disabled=!1,c.id.ptartkcheck.disabled=!1,c.id.ptartinterval.disabled=!1,c.id.ptartenergysave.disabled=!1,c.id.ptarthidemodal.disabled=!1,c.id.ptartdeletereport.disabled=!1,c.id.ptartu1.disabled=!1,c.id.ptartu4.disabled=!1,c.id.ptartu5.disabled=!1,c.id.ptartu6.disabled=!1,c.id.ptartu7.disabled=!1,c.id.ptartu8.disabled=!1,c.id.ptartu9.disabled=!1,c.id.ptartu10.disabled=!1,c.id.ptartu11.disabled=!1,c.id.ptartu12.disabled=!1,c.id.ptartu13.disabled=!1,c.id.ptartu16.disabled= !1,c.id.ptartu17.disabled=!1,c.id.ptartu18.disabled=!1,c.id.ptartu19.disabled=!1,c.id.ptartu21.disabled=!1,c.id.ptartu24.disabled=!1);Options.pbartu2="0";Options.pbartu3="0";Options.pbartu14="0";Options.pbartu15="0";Options.pbartu20="0";Options.pbartu22="0";Options.pbartu23="0";c.id.ptenergy.innerHTML=c.freeEnergy()+" Actual Number of Attacks";for(var e=0,d=0;d<Cities.numCities;d++)Cities.cities[d].id==Options.pbartcity.substr(1)&&(e=d);var d=parseInt(Seed.cities[e][2]),g=parseInt(Seed.cities[e][3]), f=parseInt(Options.pbartx),h=parseInt(Options.pbarty),d=(Math.round(100*Math.sqrt((d-f)*(d-f)+(g-h)*(g-h)))/100).toString();c.id.ptdist.innerHTML="Distance: "+d+" from "+Seed.cities[e][1];"w"==Options.pbarttype?(c.id.pttypehint.innerHTML="Sends Wave Attack on Target",c.id.ptartx.disabled=!1,c.id.ptarty.disabled=!1,c.id.ptartklist.disabled=!0,c.id.ptartkcheck.disabled=!0):(c.id.pttypehint.innerHTML="Attack Target List",c.id.ptartx.disabled=!0,c.id.ptarty.disabled=!0,c.id.ptartklist.disabled=!1,c.id.ptartkcheck.disabled= !1);c.id.ptartlog.innerHTML=Logbuch.ausgabe(Logs.artlog);if(c.started||c.setstarted)c.id.ptartcity.disabled=!0,c.id.ptartx.disabled=!0,c.id.ptarty.disabled=!0,c.id.ptarttype.disabled=!0,c.id.ptartklist.disabled=!0,c.id.ptartkcheck.disabled=!0,c.id.ptartinterval.disabled=!0,c.id.ptartenergysave.disabled=!0,c.id.ptarthidemodal.disabled=!0,c.id.ptartdeletereport.disabled=!0,c.id.ptartu1.disabled=!0,c.id.ptartu4.disabled=!0,c.id.ptartu5.disabled=!0,c.id.ptartu6.disabled=!0,c.id.ptartu7.disabled=!0,c.id.ptartu8.disabled= !0,c.id.ptartu9.disabled=!0,c.id.ptartu10.disabled=!0,c.id.ptartu11.disabled=!0,c.id.ptartu12.disabled=!0,c.id.ptartu13.disabled=!0,c.id.ptartu16.disabled=!0,c.id.ptartu17.disabled=!0,c.id.ptartu18.disabled=!0,c.id.ptartu19.disabled=!0,c.id.ptartu21.disabled=!0,c.id.ptartu24.disabled=!0},popartview:function(){var c=Tabs.Artefacts;null==c.popart&&(c.popart=new CPopup("popartview",50,50,940,1E3,!0),c.popart.getTopDiv().innerHTML='<b style="position:relative; top:4px; left: 6px;">Content of the Inventory Overview</b>', c.popartlive());c.popart.show(!0)},popartlive:function(){var c=Tabs.Artefacts;if(null==c.popart)c.poparttimer=null;else{var e=[];e.push('<table width="100%" style="border:1px solid silver; border-collapse: collapse;"><tr>');e.push('<td style="background-color: #e0e0e0; border:1px solid silver; padding: 2px;text-align:center;"><b>&nbsp;</b></td>');e.push('<td style="background-color: #e0e0e0; border:1px solid silver; padding: 2px;"><b>ITEMS</b></td>');e.push('<td style="background-color: #e0e0e0; border:1px solid silver; padding: 2px;text-align:center;"><b>PCS</b></td>'); e.push('<td style="background-color: #e0e0e0; border:1px solid silver; padding: 2px;"><b>REQUIREMENTS</b></td>');e.push("</tr>");var d=unsafeWindow.artifactData.artifactSets,g=unsafeWindow.arStrings.artifactPieceName,f=unsafeWindow.arStrings,h=[],j;for(j in d)h.push(j);h.sort();h.reverse();for(var l=0;l<h.length;l++){e.push("<tr>");j=h[l];for(var o=d[j],q=f.artifactSetName["a"+j],v=1E5,w=0;w<o.length;w++){var E=o[w],B=Seed.items["i"+E]?Seed.items["i"+E]:0;parseInt(B)<v&&(v=B)}var z=1;20360==parseInt(j)&& (v=parseInt(v/5),z=5);20380==parseInt(j)&&(v=parseInt(v/10),z=10);20395==parseInt(j)&&(v=parseInt(v/3),z=3);w="pbarts_"+j;0<v?(c.started||c.setstarted?e.push('<td style="border:1px solid silver; padding: 2px;"><input id="'+w+'" type="submit" value="ADD" style="padding:0 1px;margin:0;font-size:10px;" disabled="disabled"></td>'):e.push('<td style="border:1px solid silver; padding: 2px;"><input id="'+w+'" type="submit" value="ADD" title="Complete set" style="padding:0 1px;margin:0;font-size:10px;"></td>'), e.push('<td style="border:1px solid silver; padding: 2px;"><span class="boldRed">'+q+"</span></td>"),e.push('<td style="border:1px solid silver; padding: 2px;text-align:center;"><span class="boldRed">'+v+"</span></td>")):(e.push('<td style="border:1px solid silver; padding: 2px;"><input id="'+w+'" type="submit" value="ADD" style="padding:0 1px;margin:0;font-size:10px;" disabled="disabled"></td>'),e.push('<td style="border:1px solid silver; padding: 2px;">'+q+"</td>"),e.push('<td style="border:1px solid silver; padding: 2px;text-align:center;">'+ v+"</td>"));e.push('<td style="border:1px solid silver; padding: 2px;">');q="";for(w=0;w<o.length;w++)E=o[w],B=Seed.items["i"+E]?Seed.items["i"+E]:0,q=B>=z?q+(g["a"+E]+' (<span class="boldRed">'+B+"/"+z+"</span>), "):q+(g["a"+E]+" ("+B+"/"+z+"), ");e.push(q.slice(0,-2));e.push("</td>");e.push("</tr>")}e.push("</table>");e.push('<br>Table is updated every two seconds... <span class="boldRed">   ADD   </span>When you click the button to add the current item inventory ..');c.popart.getMainDiv().innerHTML= e.join("");for(l=0;l<h.length;l++)document.getElementById("pbarts_"+h[l]).addEventListener("click",function(){Tabs.Artefacts.setonly=this.id.split("_")[1];c.setcollectinit()},!1);c.poparttimer=setTimeout(c.popartlive,2E3)}},klistcheck:function(){var c=Tabs.Artefacts,e=0;c.koordlist=[];for(var d=Options.pbartklist.split("\n"),g=0;g<d.length;g++){var f=d[g].split(","),h=parseInt(f[0],10),f=parseInt(f[1],10);if(!isNaN(h)&&!isNaN(f)&&!(1>h||800<h))1>f||800<f||(c.koordlist.push(h+","+f),e++)}Options.pbartklist= c.koordlist.join("\n");saveOptions();c.id.ptcheckinfo.innerHTML=e+" Coordinate in number of added..!!";c.id.ptartklist.value=Options.pbartklist;return 0<e?!0:!1},modal:function(){var c=Tabs.Artefacts;clearTimeout(c.modalTimer);if(c.started||c.setstarted)Options.pbarthidemodal&&unsafeWindow.Modal.hideModalAll(),c.modalTimer=setTimeout(c.modal,2500)},setcollectinit:function(){var c=Tabs.Artefacts;c.started?Logbuch.eintrag(Logs.artlog,"Stopped auto attack...!!"):c.setstarted?(c.setstarted=!1,c.artset= "SET Completion=OFF",clearTimeout(c.artifactTimer),clearTimeout(c.modalTimer),c.stopreload&&(c.stopreload=!1,Options.pbEveryEnable=!0,RefreshEvery.setEnable(!0),Logbuch.eintrag(Logs.artlog,"Update In Progress .."),c.id.ptartlog.innerHTML=Logbuch.ausgabe(Logs.artlog))):(c.setstarted=!0,c.artset="SET Completion=ON",Options.pbEveryEnable&&(c.stopreload=!0,Options.pbEveryEnable=!1,RefreshEvery.setEnable(!1),Logbuch.eintrag(Logs.artlog,"Update STOPPED.!!"),c.id.ptartlog.innerHTML=Logbuch.ausgabe(Logs.artlog)), c.setcollect(),c.modal());c.show()},setcollect:function(){var c=Tabs.Artefacts;clearTimeout(c.artifactTimer);var e=unsafeWindow.artifactData.artifactSets,d=[];if(0==c.setonly)for(var g in e)d.push(g);else d.push(c.setonly);d.sort();d.reverse();for(var f=0;f<d.length;f++){g=d[f];if(0==c.setonly){if(20410==g&&Seed.items.i1203&&1<=parseInt(Seed.items.i1203))continue;if(20430==g&&Seed.items.i1204&&1<=parseInt(Seed.items.i1204))continue;if(20440==g&&Seed.items.i1205&&1<=parseInt(Seed.items.i1205))continue; if(20450==g&&Seed.items.i1206&&1<=parseInt(Seed.items.i1206))continue}for(var h=e[g],j=1E5,l=0;l<h.length;l++){var o=h[l],o=Seed.items["i"+o]?Seed.items["i"+o]:0;parseInt(o)<j&&(j=o)}20360==parseInt(g)&&(j=parseInt(j/5));20380==parseInt(g)&&(j=parseInt(j/10));20395==parseInt(g)&&(j=parseInt(j/3));if(0<j){e=unsafeWindow.Object.clone(unsafeWindow.g_ajaxparams);e.setid=g;new MyAjaxRequest(unsafeWindow.g_ajaxpath+"completeArtifactSet.php"+unsafeWindow.g_ajaxsuffix,{method:"post",parameters:e,onSuccess:function(d){c.artsetrslt(d, g)},onFailure:function(d){c.artsetrslt(d,g)}});c.artifactTimer=setTimeout(c.setcollect,3E4);return}}Logbuch.eintrag(Logs.artlog,"NO SET R & D Center to be completed.!! ..");c.stopreload&&(c.stopreload=!1,Options.pbEveryEnable=!0,RefreshEvery.setEnable(!0),Logbuch.eintrag(Logs.artlog,"Updated..!"),c.id.ptartlog.innerHTML=Logbuch.ausgabe(Logs.artlog));c.setstarted=!1;c.artset="SET Completion ON/OFF";c.show()},artsetrslt:function(c,e){var d=Tabs.Artefacts,g=unsafeWindow.artifactData.artifactSets,f=unsafeWindow.arStrings.artifactSetName["a"+ e],h=unsafeWindow.artifactData.artifactSetsMightRewards[e];if(c.ok){var g=g[e],j=1;20360==parseInt(e)&&(j=5);20380==parseInt(e)&&(j=10);for(var l=0;l<g.length;l++)Seed.items["i"+l]&&0<Seed.items["i"+l]&&(Seed.items["i"+l]-=j);f="The: <b>"+f+"</b> Completed Kit..! <b>"+h+" XP</b>. Wait 30 seconds .."}else f="Failed to complete the set.!: "+f+"<br>",h=unsafeWindow.printLocalError(c.error_code||null,c.msg||null,c.feedback||null),f+='<span class="boldRed">'+h+"</span>";Logbuch.eintrag(Logs.artlog,f); d.id.ptartlog.innerHTML=Logbuch.ausgabe(Logs.artlog)},freeEnergy:function(){var c="city"+Options.pbartcity.substr(1),e=Seed.leaders[c].resourcefulnessKnightId,d=Seed.leaders[c].politicsKnightId,g=Seed.leaders[c].combatKnightId,f=Seed.leaders[c].intelligenceKnightId,h=0,c=Seed.knights[c],j=[],l;for(l in Seed.outgoing_marches[Options.pbartcity]){var o=Seed.outgoing_marches[Options.pbartcity][l];2==o.marchType&&2==o.marchStatus&&0!=o.knightId&&j.push(o.knightId)}for(var q in c)c[q].knightId==e||c[q].knightId== d||c[q].knightId==g||c[q].knightId==f||0<j.length&&j.exists(q.substr(3))||(h+=parseInt(c[q].knightEnergy));return h},ClearALog:function(){var c=Tabs.Artefacts;Logs.artlog=[];saveLogs();clearTimeout(c.displayTimer);c.show()},AttackOnOff:function(){var c=Tabs.Artefacts;if(c.setstarted)Logbuch.eintrag(Logs.artlog,"Upon completion retry the SET.!");else if(c.started)c.started=!1,c.startvalue="START attack",clearTimeout(c.attackTimer),clearTimeout(c.modalTimer),clearTimeout(c.reportTimer),c.stopreload&& (c.stopreload=!1,Options.pbEveryEnable=!0,RefreshEvery.setEnable(!0),Logbuch.eintrag(Logs.artlog,"Update In Progress .."),c.id.ptartlog.innerHTML=Logbuch.ausgabe(Logs.artlog));else{var e=!0,d="";Options.pbartx=parseInt(Options.pbartx);Options.pbarty=parseInt(Options.pbarty);if("w"==Options.pbarttype){if(1>Options.pbartx||800<Options.pbartx)d+="XXX coordinate must be between 100 and 800..!!<br>",e=!1;if(1>Options.pbarty||800<Options.pbarty)d+="YYY coordinate must be between 100 and 800..!!<br>",e= !1}else c.klistcheck()||(d+="Being Registered Coord. At the same coord. Input current.!!<br>",e=!1);Options.pbartinterval=parseInt(Options.pbartinterval);6>Options.pbartinterval&&(d+="The minimum time between attacks should be 6 seconds.!!<br>",e=!1);Options.pbartenergysave=parseInt(Options.pbartenergysave);for(var g=!1,f=1;25>f;f++)Options["pbartu"+f]=parseInt(Options["pbartu"+f]),0<Options["pbartu"+f]&&(g=!0);g||(d+="You must be logged Military Unit..!!<br>",e=!1);for(var g=!0,h="city"+Options.pbartcity.substr(1), f=1;25>f;f++)Seed.units[h]["unt"+f]<Options["pbartu"+f]&&(e=g=!1);g||(d+="You do not have enough troops..!!<br>");e?(c.started=!0,c.startvalue="STOP attack",c.koordlistpointer=0,Options.pbEveryEnable&&(c.stopreload=!0,Options.pbEveryEnable=!1,RefreshEvery.setEnable(!1),Logbuch.eintrag(Logs.artlog,"Update STOPPED.!!"),c.id.ptartlog.innerHTML=Logbuch.ausgabe(Logs.artlog)),c.attackStart(),c.modal(),c.startUnixTime=unixTime(),c.reportTimer=setTimeout(c.report,5E3)):(Logbuch.eintrag(Logs.artlog,d),c.id.ptartlog.innerHTML= Logbuch.ausgabe(Logs.artlog))}c.show()},attackStart:function(){var c=Tabs.Artefacts;clearTimeout(c.attackTimer);c.updatemarches();if(c.started){if(c.attack){var e=Options.pbartcity.substr(1),d="city"+e,g=unixTime(),f=0,h=Seed.outgoing_marches[Options.pbartcity],j;for(j in h)if(0==parseInt(h[j].marchStatus)){f=h[j].marchId;break}if(0==f){Logbuch.eintrag(Logs.artlog,"Please try again later ..");c.attackTimer=setTimeout(c.attackStart,5E3);c.id.ptartlog.innerHTML=Logbuch.ausgabe(Logs.artlog);return}if(c.freeEnergy()> Options.pbartenergysave){var l=Seed.leaders[d].resourcefulnessKnightId,o=Seed.leaders[d].politicsKnightId,q=Seed.leaders[d].combatKnightId,v=Seed.leaders[d].intelligenceKnightId,w=Seed.knights[d],E=h=0,B=0,z=0,C=[];for(j in Seed.outgoing_marches[Options.pbartcity]){var F=Seed.outgoing_marches[Options.pbartcity][j];2==F.marchType&&2==F.marchStatus&&0!=F.knightId&&C.push(F.knightId)}for(var A in w)if(!(w[A].knightId==l||w[A].knightId==o||w[A].knightId==q||w[A].knightId==v)&&!(0<C.length&&C.exists(A.substr(3))))1== w[A].knightStatus&&w[A].knightEnergy>E&&(E=w[A].knightEnergy,h=w[A].knightId,B=w[A].experience),1==w[A].knightStatus&&E==w[A].knightEnergy&&parseInt(w[A].experience)<parseInt(B)&&(h=w[A].knightId,B=w[A].experience),1!=w[A].knightStatus&&0<w[A].knightEnergy&&(z=1);if(0==h){if(0==z){Logbuch.eintrag(Logs.artlog,"General not available with Energy.!!");c.id.ptartlog.innerHTML=Logbuch.ausgabe(Logs.artlog);e=!0;f=Seed.outgoing_marches[Options.pbartcity];for(j in f)0!=parseInt(f[j].marchStatus)&&(e=!1);e? (Logbuch.eintrag(Logs.artlog,"Successful attacks occurred on all targets in memory.!!"),c.started=!1,c.startvalue="START attack",c.stopreload&&(c.stopreload=!1,Options.pbEveryEnable=!0,RefreshEvery.setEnable(!0),Logbuch.eintrag(Logs.artlog,"Update In Progress .."),c.id.ptartlog.innerHTML=Logbuch.ausgabe(Logs.artlog)),c.show()):c.attackTimer=setTimeout(c.attackStart,5E3)}else Logbuch.eintrag(Logs.artlog,"Finished. No Generals or Energy. Refresh your page .."),c.id.ptartlog.innerHTML=Logbuch.ausgabe(Logs.artlog), c.attackTimer=setTimeout(c.attackStart,5E3);return}}else{Logbuch.eintrag(Logs.artlog,"No Generals with Energy.!!");c.id.ptartlog.innerHTML=Logbuch.ausgabe(Logs.artlog);e=!0;f=Seed.outgoing_marches[Options.pbartcity];for(j in f)2==parseInt(f[j].marchStatus)&&2==parseInt(f[j].marchType)||0!=parseInt(f[j].marchStatus)&&(e=!1);e?(Logbuch.eintrag(Logs.artlog,"Successful attacks occurred on all targets in memory.!!"),c.started=!1,c.startvalue="START attack",c.stopreload&&(c.stopreload=!1,Options.pbEveryEnable= !0,RefreshEvery.setEnable(!0),Logbuch.eintrag(Logs.artlog,"Update In Progress .."),c.id.ptartlog.innerHTML=Logbuch.ausgabe(Logs.artlog)),c.show()):c.attackTimer=setTimeout(c.attackStart,5E3);return}for(A=1;25>A;A++)if(Seed.units[d]["unt"+A]&&Seed.units[d]["unt"+A]<Options["pbartu"+A]){Logbuch.eintrag(Logs.artlog,"Insufficient military troops. Please wait .. ");c.id.ptartlog.innerHTML=Logbuch.ausgabe(Logs.artlog);c.attackTimer=setTimeout(c.attackStart,5E3);return}if("f"==Options.pbarttype&&c.koordlistpointer>= c.koordlist.length){Logbuch.eintrag(Logs.artlog,"The coordinates are added to memory PROCESSING..! Please wait ..");c.id.ptartlog.innerHTML=Logbuch.ausgabe(Logs.artlog);e=!0;f=Seed.outgoing_marches[Options.pbartcity];for(j in f)0!=f[j].marchStatus&&(e=!1);e?(Logbuch.eintrag(Logs.artlog,"Successful attacks occurred on all targets in memory.!!"),c.started=!1,c.startvalue="START attack",c.show()):c.attackTimer=setTimeout(c.attackStart,5E3);return}"w"==Options.pbarttype?(j=Options.pbartx,d=Options.pbarty): (d=c.koordlist[c.koordlistpointer].split(","),j=parseInt(d[0],10),d=parseInt(d[1],10));var G=unsafeWindow.Object.clone(unsafeWindow.g_ajaxparams);G.cid=e;G.type=4;G.kid=h;G.mid=f;G.xcoord=j;G.ycoord=d;for(A=1;25>A;A++)0<parseInt(Options["pbartu"+A])&&(G["u"+A]=Options["pbartu"+A]);G.gold=0;for(A=1;7>A;A++)G["r"+A]=0;c.attack=!1;g=unixTime();new MyAjaxRequest(unsafeWindow.g_ajaxpath+"march.php"+unsafeWindow.g_ajaxsuffix,{method:"post",parameters:G,onSuccess:function(d){c.marchout(d,G,g)},onFailure:function(){alert("ERROR Occurred..!!")}})}e= parseInt(1E3*Options.pbartinterval)+parseInt(1E3*Math.random()*(1.5*Options.pbartinterval-Options.pbartinterval));c.attackTimer=setTimeout(c.attackStart,e)}},marchout:function(c,e,d){var g=Tabs.Artefacts;if(c.ok){var f=Seed.knights["city"+e.cid]["knt"+e.kid];f.knightStatus=10;f.knightEnergy-=1;for(f=1;25>f;f++)e["u"+f]&&(Seed.units["city"+e.cid]["unt"+f]-=e["u"+f]);f=unixTime();d={destinationUnixTime:2*f-d+c.oneway,marchUnixTime:f,returnUnixTime:c.returnEta,toXCoord:e.xcoord,toYCoord:e.ycoord,marchType:4, knightId:e.kid,marchStatus:1,gold:0,marchId:e.mid};for(f=0;9>f;f++)d["resource"+f]=0;for(;25>f;f++)d.unit1Count=e["u"+f]?e["u"+f]:0,d.unit1Return=0;c.tileId&&(d.toTileId=c.tileId,d.toTileType=c.tileType,d.toTileLevel=c.tileLevel);Seed.outgoing_marches["c"+e.cid]["m"+e.mid]=d;"f"==Options.pbarttype&&g.koordlistpointer++;e="Coordinate attacked: "+e.xcoord+","+e.ycoord+" Submitted!. General: "+Seed.knights["city"+e.cid]["knt"+e.kid].knightName}else c=unsafeWindow.printLocalError(c.error_code||null,c.msg|| null,c.feedback||null),e="Initiative failed attack:"+e.xcoord+","+e.ycoord+". General: "+Seed.knights["city"+e.cid]["knt"+e.kid].knightName+'<br><span class="boldRed">'+c+"</span>";Logbuch.eintrag(Logs.artlog,e);g.id.ptartlog.innerHTML=Logbuch.ausgabe(Logs.artlog);g.attack=!0;g.id.ptenergy.innerHTML=g.freeEnergy()+" Actual Number of Attacks"},updatemarches:function(){for(var c=unixTime(),e=0;e<Cities.numCities;e++){var d=Cities.cities[e].id,g=Seed.outgoing_marches["c"+d],f;for(f in g){var h=g[f]; if(0!=h.marchStatus&&(1==h.marchType||4==h.marchType)&&h.returnUnixTime<c){h.marchStatus=0;0!=h.knightId&&Seed.knights["city"+d]["knt"+h.knightId]&&(Seed.knights["city"+d]["knt"+h.knightId].knightStatus=1);for(var j=1==h.marchType?"Count":"Return",l=1;25>l;l++)Seed.units["city"+d]["unt"+l]+=parseInt(h["unit"+l+j])}0==h.marchStatus&&0!=h.knightId&&Seed.knights["city"+d]["knt"+h.knightId]&&(Seed.knights["city"+d]["knt"+h.knightId].knightStatus=1,h.knightId=0)}}},hide:function(){clearTimeout(Tabs.Artefacts.displayTimer)}, togOpt:function(c,e){Options[e]&&(c.checked=!0);c.addEventListener("change",function(){Options[e]=this.checked;saveOptions()},!1)},changeOpt:function(c,e){var d=Tabs.Artefacts;c.value=Options[e];c.addEventListener("change",function(){Options[e]=this.value;saveOptions();if("pbartx"==e||"pbarty"==e)d.finfo(),d.show()},!1)},finfo:function(){var c=Tabs.Artefacts,e=c.id.ptfieldinfo;if(1>Options.pbartx||800<Options.pbartx||1>Options.pbarty||800<Options.pbarty)e.style.display="block",e.style.width="540px", e.style.whiteSpace="normal",e.style.padding="6px",e.style.backgroundColor="#dddddd",e.innerHTML="<b>Coordinates: ("+Options.pbartx+","+Options.pbarty+"):</b> The coordinates are invalid..!!";else if(e.style.display="block",e.style.width="540px",e.style.whiteSpace="normal",e.style.padding="6px",e.style.backgroundColor="#dddddd",e.innerHTML="<b>Coordinate ("+Options.pbartx+","+Options.pbarty+"):</b> Waiting for the server ...",c.read){var e=5*parseInt((parseInt(Options.pbartx)-1)/5),d=5*parseInt((parseInt(Options.pbarty)- 1)/5),e="bl_"+e+"_bt_"+d,d=unsafeWindow.Object.clone(unsafeWindow.g_ajaxparams);d.blocks=e;c.read=!1;new MyAjaxRequest(unsafeWindow.g_ajaxpath+"fetchMapTiles.php"+unsafeWindow.g_ajaxsuffix,{method:"post",parameters:d,onSuccess:function(d){c.mapresult(d)},onFailure:function(){alert("Map Data Query was not successful..!!")}})}},mapresult:function(c){var e=Tabs.Artefacts;if(c.ok){var d="<table><tr><td><b>Coordinate: ("+Options.pbartx+","+Options.pbarty+"):</b>&nbsp;&nbsp;</td><td>",g;for(g in c.data){var f= c.data[g];f.xCoord!=Options.pbartx||f.yCoord!=Options.pbarty||("51"==f.tileType?"0"==f.tileUserId?d+="Terrorist Camp Position: "+f.tileLevel+"</td>":(d+="City Position: "+f.tileLevel+"</td>",d+="</tr><tr><td><b>Name:</b></td><td>"+f.cityName+"</td>",d+="</tr><tr><td><b>General:</b></td><td>"+c.userInfo["u"+f.tileUserId].n,d+=" (Walking: "+addCommas(c.userInfo["u"+f.tileUserId].m)+", Level: "+c.userInfo["u"+f.tileUserId].t+")</td>","0"==f.tileAllianceId?d+="</tr><tr><td><b>Alliance:</b></td><td>NO!</td>": (d+="</tr><tr><td><b>Alliance:</b></td><td>"+c.allianceNames["a"+f.tileAllianceId],d+=" (Walking: "+addCommas(c.allianceMights["a"+f.tileAllianceId])+")</td>")):(d+=e.wildtypes[f.tileType]+" Level "+f.tileLevel+"</td>","0"!=f.tileType&&("0"==f.tileUserId?d+="</tr><tr><td><b>Situation:</b></td><td>Free</td>":(d+="</tr><tr><td><b>Situation:</b></td><td>Proprietary</td>",d+="</tr><tr><td><b>General:</b></td><td>"+c.userInfo["u"+f.tileUserId].n,d+=" (Walking: "+addCommas(c.userInfo["u"+f.tileUserId].m)+ ", Level: "+c.userInfo["u"+f.tileUserId].t+")</td>","0"==f.tileAllianceId?d+="</tr><tr><td><b>Alliance:</b></td><td>NO":(d+="</tr><tr><td><b>Alliance:</b></td><td>"+c.allianceNames["a"+f.tileAllianceId],d+=" (Walking: "+addCommas(c.allianceMights["a"+f.tileAllianceId])+")</td>")))))}e.id.ptfieldinfo.innerHTML=d+"</tr></table>"}else e.id.ptfieldinfo.innerHTML="<b>Coordinate ("+Options.pbartx+","+Options.pbarty+"):</b> Data found on the server.!";e.read=!0},report:function(){var c=Tabs.Artefacts;clearTimeout(c.reportTimer); if(c.started||c.setstarted){if(Options.pbartdeletereport){var e=unsafeWindow.Object.clone(unsafeWindow.g_ajaxparams);e.pageNo=1;e.showAll=0;new MyAjaxRequest(unsafeWindow.g_ajaxpath+"listMarchReport.php"+unsafeWindow.g_ajaxsuffix,{method:"post",parameters:e,onSuccess:function(d){c.reportlist(d)},onFailure:function(){alert("Import Error Reports")}})}c.reportTimer=setTimeout(c.report,15E3)}},reportlist:function(c){var e=Tabs.Artefacts;if(c.ok){var d=[],g;for(g in c.arReports){var f=c.arReports[g];"4"== f.marchType&&f.side1PlayerId==unsafeWindow.g_ajaxsuffix.substr(3)&&("51"==f.side0TileType&&"0"==f.side0CityId&&"0"==f.side0PlayerId&&d.push(f.marchReportId),("10"==f.side0TileType||"12"==f.side0TileType||"20"==f.side0TileType||"30"==f.side0TileType||"40"==f.side0TileType||"50"==f.side0TileType)&&d.push(f.marchReportId))}if(0<d.length){c=unsafeWindow.Object.clone(unsafeWindow.g_ajaxparams);c.s0rids="";c.eventids="";c.s1rids=d.join(",");var h=d.length;new MyAjaxRequest(unsafeWindow.g_ajaxpath+"deleteCheckedReports.php"+ unsafeWindow.g_ajaxsuffix,{method:"post",parameters:c,onSuccess:function(c){e.deletereports(c,h)},onFailure:function(){alert("Delete failed reports.!")}})}}},deletereports:function(c,e){var d=Tabs.Artefacts;c.ok&&(Seed.newReportCount=parseInt(Seed.newReportCount)-e,1==e?Logbuch.eintrag(Logs.artlog,e+" Deleted War Report.!!"):Logbuch.eintrag(Logs.artlog,e+" Deleted Combat Reports.!!"),d.id.ptartlog.innerHTML=Logbuch.ausgabe(Logs.artlog))}}; Tabs.Search={tabOrder:7,tabLabel:"Search",cont:null,tabDisabled:!ENABLE_SEARCH,id:{},sectors:{s1:"Alpha",s2:"Bravo",s3:"Charlie",s4:"Delta",s5:"Echo",s6:"Foxtrot",s7:"Golf",s8:"Hotel",s9:"India",s10:"Juliet",s11:"Kilo",s12:"Lima",s13:"Mike",s14:"November",s15:"Oscar",s16:"Papa"},sectorkoords:{s1:{x:0,y:0},s2:{x:200,y:0},s3:{x:400,y:0},s4:{x:600,y:0},s5:{x:0,y:200},s6:{x:200,y:200},s7:{x:400,y:200},s8:{x:600,y:200},s9:{x:0,y:400},s10:{x:200,y:400},s11:{x:400,y:400},s12:{x:600,y:400},s13:{x:0,y:600}, s14:{x:200,y:600},s15:{x:400,y:600},s16:{x:600,y:600}},blocklist:[],blockmax:100,blockpointer:0,blockread:!1,mapread:!1,blockreadtimer:null,map:{data:{},userInfo:{},allianceNames:{},allianceMights:{}},counter:{terror:0,wasteland:0,grassland:0,riverlake:0,oil:0,hills:0,mountain:0,plain:0,sr:0,city:0,user:0,alliance:0,fields:0,timer:0},popterror:null,popwild:null,popcity:null,popganda:null,wildtypes:{"0":"Barrens",10:"Meadow",11:"xxxx",12:"River",20:"Oil",30:"Peak",40:"Mountain",50:"Wasteland",51:"Terrorist Camp", 52:"xxx",53:"xxxxx",201:"Titanium",202:"Graphene",203:"Uranium",204:"Diamond"},diplomacyNames:{"0":"Neutral",1:"Friendly",2:"Hostile",3:"Friendly Against Them",4:"Friendly Against You",5:"Own Alliance"},warstatus:{1:"Normal",2:"Artifacts",3:"Peace Treaty"},init:function(c){var e=Tabs.Search;Logs.searchlog=[];e.cont=c;var d=[];d.push('<table class="ptTab ptStat" width="100%">');d.push("<tr>");d.push('<td style="text-align:center;">');d.push("<b>SEARCH MENU</b>");d.push("</td>");d.push("</tr>");d.push("</table>"); d.push("<br>");d.push('<table class="ptTab" width="100%">');d.push("<tr>");d.push("<td>");d.push("<b>Search Format:&nbsp;</b>");d.push("</td>");d.push("<td>");d.push(htmlSelector({u:"Normal",s:"Sector",g:"Total Map"},Options.pbsearchtype,'id="ptsearchtype"'));d.push('&nbsp;<span id="ptsearchhint"></span>');d.push("</td>");d.push("</tr>");d.push("<tr>");d.push("<td>");d.push("<b>Center:&nbsp;</b>");d.push("</td>");d.push("<td>");d.push('<input id="ptsearchx" type="text" size="2" maxlength="3" style="text-align: center;">'); d.push(" / ");d.push('<input id="ptsearchy" type="text" size="2" maxlength="3" style="text-align: center;">');d.push("&nbsp;Cities:");for(c=0;c<Cities.numCities;c++)d.push('&nbsp;<input id="ptcity'+c+'" type="submit" name="c'+c+'" value="'+(c+1)+'" title="'+Cities.cities[c].name+'" style="padding-left:2px;padding-right:2px;">');d.push('&nbsp;&nbsp;<b><span id="ptsearchcityhint"></span></b></td>');d.push("</tr>");d.push("<tr>");d.push("<td>");d.push("<b>Search Distance:&nbsp;</b>");d.push("</td>"); d.push("<td>");d.push('<input id="ptsearchradius" type="text" size="2" maxlength="3" style="text-align: center;">&nbsp;');d.push("</td>");d.push("</tr>");d.push("<tr>");d.push("<td>");d.push("<b>Province:&nbsp;</b>");d.push("</td>");d.push("<td>");d.push(htmlSelector(e.sectors,Options.pbsearchsector,'id="ptsearchsector"'));d.push("</td>");d.push("</tr>");d.push("<tr>");d.push("<td>");d.push("<b>Sector Search:&nbsp;</b>");d.push("</td>");d.push("<td>");d.push(htmlSelector({9:9,20:20,50:50,100:100, 150:150},Options.pbsearchblockmax,'id="ptsearchblockmax"'));d.push("</td>");d.push("</tr>");d.push("<tr>");d.push('<td colspan="2" style="white-space:normal;">');d.push("<br>Sector Search Advanced Search Options allows you to search .. <br> call the smallest value is the most detailed, less detailed search to finish and the highest values\u200b\u200b. Choose the one that suits your search filter ...<br>");d.push("</td>");d.push("</tr>");d.push("<tr>");d.push('<td colspan="2">');d.push('<input id="ptsearchbutton" type="submit" name="search" value="Search ON/OFF"><br><br>'); d.push("</td>");d.push("</tr>");d.push("<tr>");d.push('<td colspan="2">');d.push('<div id="ptsearchlog" style="height:70px; overflow:auto;"></div>');d.push("</td>");d.push("</tr>");d.push("</table>");d.push("<hr>");d.push('<div id="ptsearchstat"></div>');d.push("<hr>");d.push('<div style="text-align:center;">');d.push('<input id="ptsearchterror" type="submit" name="terror" value="SHOW Terrorist Camps!">&nbsp;&nbsp;&nbsp;');d.push('<input id="ptsearchwild" type="submit" name="wild" value="SHOW Wilds!">&nbsp;&nbsp;&nbsp;'); d.push('<input id="ptsearchcity" type="submit" name="city" value="SHOW Cities!">');d.push("</div>");e.cont.innerHTML=d.join("");e.id.ptsearchtype=document.getElementById("ptsearchtype");e.id.ptsearchx=document.getElementById("ptsearchx");e.id.ptsearchy=document.getElementById("ptsearchy");e.id.ptsearchhint=document.getElementById("ptsearchhint");for(c=0;c<Cities.numCities;c++)d="ptcity"+c,e.id[d]=document.getElementById(d);e.id.ptsearchradius=document.getElementById("ptsearchradius");e.id.ptsearchsector= document.getElementById("ptsearchsector");e.id.ptsearchblockmax=document.getElementById("ptsearchblockmax");e.id.ptsearchbutton=document.getElementById("ptsearchbutton");e.id.ptsearchlog=document.getElementById("ptsearchlog");e.id.ptsearchstat=document.getElementById("ptsearchstat");e.id.ptsearchterror=document.getElementById("ptsearchterror");e.id.ptsearchwild=document.getElementById("ptsearchwild");e.id.ptsearchcity=document.getElementById("ptsearchcity");e.id.ptsearchcityhint=document.getElementById("ptsearchcityhint"); e.shortstat();e.show()},hide:function(){},show:function(){var c=Tabs.Search;c.changeOpt(c.id.ptsearchtype,"pbsearchtype");c.changeOpt(c.id.ptsearchx,"pbsearchx");c.changeOpt(c.id.ptsearchy,"pbsearchy");c.changeOpt(c.id.ptsearchradius,"pbsearchradius");c.changeOpt(c.id.ptsearchsector,"pbsearchsector");c.changeOpt(c.id.ptsearchblockmax,"pbsearchblockmax");if("u"==Options.pbsearchtype){c.id.ptsearchhint.innerHTML="Version: GW LT ASYLUMSERVE";c.id.ptsearchhint.style.display="block";c.id.ptsearchhint.style.width= "500px";c.id.ptsearchhint.style.whiteSpace="normal";c.id.ptsearchhint.style.padding="6px";c.id.ptsearchx.disabled=!1;c.id.ptsearchy.disabled=!1;for(i=0;i<Cities.numCities;i++){var e="ptcity"+i;c.id[e].disabled=!1}c.id.ptsearchradius.disabled=!1;c.id.ptsearchsector.disabled=!0;c.id.ptsearchblockmax.disabled=!1}if("s"==Options.pbsearchtype){c.id.ptsearchhint.innerHTML="Alliances";c.id.ptsearchhint.style.display="block";c.id.ptsearchhint.style.width="500px";c.id.ptsearchhint.style.whiteSpace="normal"; c.id.ptsearchhint.style.padding="6px";c.id.ptsearchx.disabled=!0;c.id.ptsearchy.disabled=!0;for(i=0;i<Cities.numCities;i++)e="ptcity"+i,c.id[e].disabled=!0;c.id.ptsearchradius.disabled=!0;c.id.ptsearchsector.disabled=!1;c.id.ptsearchblockmax.disabled=!1}if("g"==Options.pbsearchtype){c.id.ptsearchhint.innerHTML='Fast Internet connection if possible to perform the selected search criteria.<br><br><span class="boldRed">CAUTION: Your Search And freezing may lead to overload..!!</span><br><br>May need to refresh your page ..'; c.id.ptsearchhint.style.display="block";c.id.ptsearchhint.style.width="500px";c.id.ptsearchhint.style.whiteSpace="normal";c.id.ptsearchhint.style.padding="6px";c.id.ptsearchx.disabled=!0;c.id.ptsearchy.disabled=!0;for(i=0;i<Cities.numCities;i++)e="ptcity"+i,c.id[e].disabled=!0;c.id.ptsearchradius.disabled=!0;c.id.ptsearchsector.disabled=!0;c.id.ptsearchblockmax.disabled=!1}for(i=0;i<Cities.numCities;i++)e="ptcity"+i,c.id[e].addEventListener("click",c.city,!1);c.id.ptsearchbutton.addEventListener("click", c.startsearch,!1);c.id.ptsearchterror.addEventListener("click",c.terrorview,!1);c.id.ptsearchwild.addEventListener("click",c.wildview,!1);c.id.ptsearchcity.addEventListener("click",c.cityview,!1)},wildview:function(){function c(c,d){var e=Tabs.Search;Options[d]&&(c.checked=!0);c.addEventListener("change",function(){Options[d]=this.checked;saveOptions();e.tableview("wild",e.id.wildlist,e.id.wildcomment)},!1)}function e(c,d){var e=Tabs.Search;c.value=Options[d];c.addEventListener("change",function(){Options[d]= this.value.trim();this.value=this.value.trim();"pbsearchwildmin"==d&&parseInt(Options.pbsearchwildmin)>parseInt(Options.pbsearchwildmax)&&(Options.pbsearchwildmax=Options.pbsearchwildmin,e.id.ptsearchwildmax.value=Options.pbsearchwildmax);"pbsearchwildmax"==d&&parseInt(Options.pbsearchwildmax)<parseInt(Options.pbsearchwildmin)&&(Options.pbsearchwildmin=Options.pbsearchwildmax,e.id.ptsearchwildmin.value=Options.pbsearchwildmin);saveOptions();e.tableview("wild",e.id.wildlist,e.id.wildcomment)},!1)} function d(){}var g=Tabs.Search;if(null==g.popwild){g.popwild=new CPopup("wild",50,50,1E3,600,!0);g.popwild.getTopDiv().innerHTML='<b style="position:relative; top:4px; left: 6px;">DETAILED STRATEGIC RESOURCE LANDS DISPLAY and MENU</b>';var f=[];f.push('<table><tr><td style="vertical-align:top; padding-right:10px;">');f.push('<table><tr><td colspan="2" style="padding-bottom:3px;"><b>Level:</b></td></tr><tr><td>Min.&nbsp;</td><td style="padding-bottom:3px;">');f.push(htmlSelector({1:"1",2:"2",3:"3", 4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",10:"10"},Options.pbsearchwildmin,'id="ptsearchwildmin"'));f.push("</td></tr><tr><td>Max.&nbsp;</td><td>");f.push(htmlSelector({1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",10:"10"},Options.pbsearchwildmax,'id="ptsearchwildmax"'));f.push("</td></tr></table></td>");f.push('<td style="vertical-align:top; padding-right:10px; padding-left:10px; border-left:1px dotted black;"><table><tr><td colspan="4" style="padding-bottom:3px;"><b>&nbsp;Site Content:</b></td></tr>'); f.push("<tr>");f.push('<td><input type="checkbox" id="ptsearchwildgrass"></td><td>Meadow&nbsp;&nbsp;</td>');f.push('<td><input type="checkbox" id="ptsearchwildriver"></td><td>River&nbsp;&nbsp;</td>');f.push("</tr>");f.push("<tr>");f.push('<td><input type="checkbox" id="ptsearchwildoil"></td><td>Oil&nbsp;&nbsp;</td>');f.push('<td><input type="checkbox" id="ptsearchwildstone"></td><td>Peak&nbsp;&nbsp;</td>');f.push("</tr>");f.push("<tr>");f.push('<td><input type="checkbox" id="ptsearchwildsteel"></td><td>Mountain&nbsp;&nbsp;</td>'); f.push('<td><input type="checkbox" id="ptsearchwildplain"></td><td>Wasteland&nbsp;&nbsp;</td>');f.push("</tr>");f.push("<tr>");f.push('<td><input type="checkbox" id="ptsearchwildsr"></td><td>Strategic Resources&nbsp;&nbsp;</td>');f.push('<td><input type="checkbox" id="ptsearchwildwaste"></td><td>Barrens</td>');f.push("<tr>");f.push("</table></td>");f.push('<td style="vertical-align:top; padding-right:10px; padding-left:10px; border-left:1px dotted black;"><table><tr><td colspan="2" style="padding-bottom:3px;"><b>&nbsp;Situation:</b></td></tr>'); f.push("<tr>");f.push('<td><input type="checkbox" id="ptsearchwildfree"></td><td>Free</td>');f.push("</tr>");f.push("<tr>");f.push('<td><input type="checkbox" id="ptsearchwildoccupied"></td><td>Proprietary</td>');f.push("</tr>");f.push("<tr>");f.push('<td><input type="checkbox" id="ptsearchwildnoalli"></td><td>Alliances</td>');f.push("</tr>");f.push("</table></td>");f.push('<td style="vertical-align:middle; padding-right:10px; padding-left:10px; border-left:1px dotted black;"><table>');f.push("<tr>"); f.push('<td style="padding-bottom:3px;"><b>Alliance:&nbsp;</b></td>');f.push('<td style="padding-bottom:3px;"><input type="text" id="ptsearchwildalliance" style="width:120px;"></td>');f.push("</tr>");f.push("<tr>");f.push('<td style="padding-bottom:3px;"><b>General:&nbsp;</b></td>');f.push('<td style="padding-bottom:3px;"><input type="text" id="ptsearchwildplayer" style="width:120px;"></td>');f.push("</tr>");f.push("<tr>");f.push("<td>&nbsp;</td>");f.push('<td><input type="submit" id="ptsearchwildchange" value="CLEAR"></td>'); f.push("</tr>");f.push("</table></td>");f.push('<td style="vertical-align:top; padding-right:10px; padding-left:10px; border-left:1px dotted black;"><table><tr><td colspan="6" style="padding-bottom:3px;"><b>&nbsp;Status of Alliance Diplomacy:</b></td></tr>');f.push("<tr>");f.push('<td><input type="checkbox" id="ptsearchwildhostile"></td><td>Hostile&nbsp;&nbsp;</td>');f.push('<td><input type="checkbox" id="ptsearchwildfriendly"></td><td>Friendly&nbsp;&nbsp;</td>');f.push("</tr>");f.push("<tr>");f.push('<td><input type="checkbox" id="ptsearchwildneutral"></td><td>Neutral&nbsp;&nbsp;</td>'); f.push('<td><input type="checkbox" id="ptsearchwildfryou"></td><td>Friendly Against You&nbsp;&nbsp;</td>');f.push("</tr>");f.push("<tr>");f.push('<td><input type="checkbox" id="ptsearchwildselfalli"></td><td>Own Alliance&nbsp;&nbsp;</td>');f.push('<td><input type="checkbox" id="ptsearchwildfrthem"></td><td>Friendly Against Them</td>');f.push("</tr>");f.push("<tr>");f.push('<td><input type="checkbox" id="ptsearchwilddiplnoa"></td><td>Alliances&nbsp;&nbsp;</td>');f.push("<td>&nbsp;</td><td>&nbsp;</td>"); f.push("</tr>");f.push("</table></td>");f.push('<td style="vertical-align:middle; padding-left:10px; border-left:1px dotted black;"><input type="checkbox" id="ptsearchwildclick">&nbsp;Attack Menu Coordinates Reports</td>');f.push("</tr></table>");f.push("<hr>");f.push('<div id="wildlist" style="max-height:435px; height:435px; overflow-y:auto;"></div>');f.push("<hr>");f.push('<div id="wildcomment"></div>');g.popwild.getMainDiv().innerHTML=f.join("");g.id.ptsearchwildmin=document.getElementById("ptsearchwildmin"); g.id.ptsearchwildmax=document.getElementById("ptsearchwildmax");g.id.ptsearchwildgrass=document.getElementById("ptsearchwildgrass");g.id.ptsearchwildriver=document.getElementById("ptsearchwildriver");g.id.ptsearchwildsr=document.getElementById("ptsearchwildsr");g.id.ptsearchwildoil=document.getElementById("ptsearchwildoil");g.id.ptsearchwildstone=document.getElementById("ptsearchwildstone");g.id.ptsearchwildsteel=document.getElementById("ptsearchwildsteel");g.id.ptsearchwildplain=document.getElementById("ptsearchwildplain"); g.id.ptsearchwildwaste=document.getElementById("ptsearchwildwaste");g.id.ptsearchwildfree=document.getElementById("ptsearchwildfree");g.id.ptsearchwildoccupied=document.getElementById("ptsearchwildoccupied");g.id.ptsearchwildnoalli=document.getElementById("ptsearchwildnoalli");g.id.ptsearchwildalliance=document.getElementById("ptsearchwildalliance");g.id.ptsearchwildplayer=document.getElementById("ptsearchwildplayer");g.id.ptsearchwildchange=document.getElementById("ptsearchwildchange");g.id.wildlist= document.getElementById("wildlist");g.id.wildcomment=document.getElementById("wildcomment");g.id.ptsearchwildhostile=document.getElementById("ptsearchwildhostile");g.id.ptsearchwildfriendly=document.getElementById("ptsearchwildfriendly");g.id.ptsearchwildneutral=document.getElementById("ptsearchwildneutral");g.id.ptsearchwildfryou=document.getElementById("ptsearchwildfryou");g.id.ptsearchwildfrthem=document.getElementById("ptsearchwildfrthem");g.id.ptsearchwildselfalli=document.getElementById("ptsearchwildselfalli"); g.id.ptsearchwilddiplnoa=document.getElementById("ptsearchwilddiplnoa");g.id.ptsearchwildclick=document.getElementById("ptsearchwildclick");e(g.id.ptsearchwildmin,"pbsearchwildmin");e(g.id.ptsearchwildmax,"pbsearchwildmax");c(g.id.ptsearchwildgrass,"pbsearchwildgrass");c(g.id.ptsearchwildriver,"pbsearchwildriver");c(g.id.ptsearchwildsr,"pbsearchwildsr");c(g.id.ptsearchwildoil,"pbsearchwildoil");c(g.id.ptsearchwildstone,"pbsearchwildstone");c(g.id.ptsearchwildsteel,"pbsearchwildsteel");c(g.id.ptsearchwildplain, "pbsearchwildplain");c(g.id.ptsearchwildwaste,"pbsearchwildwaste");c(g.id.ptsearchwildfree,"pbsearchwildfree");c(g.id.ptsearchwildoccupied,"pbsearchwildoccupied");c(g.id.ptsearchwildnoalli,"pbsearchwildnoalli");e(g.id.ptsearchwildalliance,"pbsearchwildalliance");e(g.id.ptsearchwildplayer,"pbsearchwildplayer");c(g.id.ptsearchwildhostile,"pbsearchwildhostile");c(g.id.ptsearchwildfriendly,"pbsearchwildfriendly");c(g.id.ptsearchwildneutral,"pbsearchwildneutral");c(g.id.ptsearchwildfryou,"pbsearchwildfryou"); c(g.id.ptsearchwildfrthem,"pbsearchwildfrthem");c(g.id.ptsearchwildselfalli,"pbsearchwildselfalli");c(g.id.ptsearchwilddiplnoa,"pbsearchwilddiplnoa");c(g.id.ptsearchwildclick,"pbsearchwildclick");g.id.ptsearchwildchange.addEventListener("click",d,!1)}g.popwild.show(!0);g.tableview("wild",g.id.wildlist,g.id.wildcomment)},cityview:function(){function c(c,d){var e=Tabs.Search;Options[d]&&(c.checked=!0);c.addEventListener("change",function(){Options[d]=this.checked;saveOptions();e.tableview("city",e.id.citylist, e.id.citycomment)},!1)}function e(c,d){var e=Tabs.Search;c.value=Options[d];c.addEventListener("change",function(){Options[d]=this.value.trim();this.value=this.value.trim();saveOptions();e.tableview("city",e.id.citylist,e.id.citycomment)},!1)}function d(){}var g=Tabs.Search;if(null==g.popcity){g.popcity=new CPopup("city",50,50,1200,600,!0);g.popcity.getTopDiv().innerHTML='<b style="position:relative; top:4px; left: 6px;">MENU DISPLAY MORE CITIES</b>';var f=[];f.push("<table><tr>");f.push('<td style="vertical-align:middle; padding-right:10px;"><table>'); f.push("<tr>");f.push('<td style="padding-bottom:3px;"><b>Alliance:&nbsp;</b></td>');f.push('<td style="padding-bottom:3px;"><input type="text" id="ptsearchcityalliance" style="width:120px;"></td>');f.push("</tr>");f.push("<tr>");f.push('<td style="padding-bottom:3px;"><b>General:&nbsp;</b></td>');f.push('<td style="padding-bottom:3px;"><input type="text" id="ptsearchcityplayer" style="width:120px;"></td>');f.push("</tr>");f.push("<tr>");f.push("<td>&nbsp;</td>");f.push('<td><input type="submit" id="ptsearchcitychange1" value="CLEAR"></td>'); f.push("</tr>");f.push("</table></td>");f.push('<td style="vertical-align:middle; padding-right:10px; padding-left:10px; border-left:1px dotted black;"><table>');f.push("<tr>");f.push('<td style="padding-bottom:3px;"><b>Min.POWER:&nbsp;</b></td>');f.push('<td style="padding-bottom:3px;"><input type="text" id="ptsearchcityminmight" style="width:120px;"></td>');f.push("</tr>");f.push("<tr>");f.push('<td style="padding-bottom:3px;"><b>Max.POWER:&nbsp;</b></td>');f.push('<td style="padding-bottom:3px;"><input type="text" id="ptsearchcitymaxmight" style="width:120px;"></td>'); f.push("</tr>");f.push("<tr>");f.push("<td>&nbsp;</td>");f.push('<td><input type="submit" id="ptsearchcitychange2" value="CLEAR"></td>');f.push("</tr>");f.push("</table></td>");f.push('<td style="vertical-align:top; padding-right:10px; padding-left:10px; border-left:1px dotted black;"><table><tr><td colspan="6" style="padding-bottom:3px;"><b>&nbsp;Status of Alliance Diplomacy:</b></td></tr>');f.push("<tr>");f.push('<td><input type="checkbox" id="ptsearchcityhostile"></td><td>Hostile&nbsp;&nbsp;</td>'); f.push('<td><input type="checkbox" id="ptsearchcityfriendly"></td><td>Friendly&nbsp;&nbsp;</td>');f.push("</tr>");f.push("<tr>");f.push('<td><input type="checkbox" id="ptsearchcityneutral"></td><td>Neutral&nbsp;&nbsp;</td>');f.push('<td><input type="checkbox" id="ptsearchcityfryou"></td><td>Friendly Against You&nbsp;&nbsp;</td>');f.push("</tr>");f.push("<tr>");f.push('<td><input type="checkbox" id="ptsearchcityselfalli"></td><td>Own Alliance&nbsp;&nbsp;</td>');f.push('<td><input type="checkbox" id="ptsearchcityfrthem"></td><td>Friendly Against Them</td>'); f.push("</tr>");f.push("<tr>");f.push('<td><input type="checkbox" id="ptsearchcitydiplnoa"></td><td>Alliances&nbsp;&nbsp;</td>');f.push("<td>&nbsp;</td><td>&nbsp;</td>");f.push("</tr>");f.push("</table></td>");f.push('<td style="vertical-align:top; padding-right:10px; padding-left:10px; border-left:1px dotted black;"><table><tr><td colspan="2" style="padding-bottom:3px;"><b>&nbsp;Situation:</b></td></tr>');f.push("<tr>");f.push('<td><input type="checkbox" id="ptsearchcitynormal"></td><td>Normal&nbsp;&nbsp;</td>'); f.push("</tr>");f.push("<tr>");f.push('<td><input type="checkbox" id="ptsearchcitybeginner"></td><td>Artifacts&nbsp;&nbsp;</td>');f.push("</tr>");f.push("<tr>");f.push('<td><input type="checkbox" id="ptsearchcitypeace"></td><td>Peace Treaty&nbsp;&nbsp;</td>');f.push("</tr>");f.push("</table></td>");f.push('<td style="vertical-align:middle; padding-left:10px; border-left:1px dotted black;"><input type="checkbox" id="ptsearchcityclick">&nbsp;Attack Menu Coordinates Reports</td>');f.push("</tr></table>"); f.push("<hr>");f.push('<div id="citylist" style="max-height:435px; height:435px; overflow-y:auto;"></div>');f.push("<hr>");f.push('<div id="citycomment"></div>');g.popcity.getMainDiv().innerHTML=f.join("");g.id.ptsearchcityalliance=document.getElementById("ptsearchcityalliance");g.id.ptsearchcityplayer=document.getElementById("ptsearchcityplayer");g.id.ptsearchcitychange1=document.getElementById("ptsearchcitychange1");g.id.ptsearchcityminmight=document.getElementById("ptsearchcityminmight");g.id.ptsearchcitymaxmight= document.getElementById("ptsearchcitymaxmight");g.id.ptsearchcitychange2=document.getElementById("ptsearchcitychange2");g.id.citylist=document.getElementById("citylist");g.id.citycomment=document.getElementById("citycomment");g.id.ptsearchcityhostile=document.getElementById("ptsearchcityhostile");g.id.ptsearchcityfriendly=document.getElementById("ptsearchcityfriendly");g.id.ptsearchcityneutral=document.getElementById("ptsearchcityneutral");g.id.ptsearchcityfryou=document.getElementById("ptsearchcityfryou"); g.id.ptsearchcityfrthem=document.getElementById("ptsearchcityfrthem");g.id.ptsearchcityselfalli=document.getElementById("ptsearchcityselfalli");g.id.ptsearchcitydiplnoa=document.getElementById("ptsearchcitydiplnoa");g.id.ptsearchcitynormal=document.getElementById("ptsearchcitynormal");g.id.ptsearchcitybeginner=document.getElementById("ptsearchcitybeginner");g.id.ptsearchcitypeace=document.getElementById("ptsearchcitypeace");g.id.ptsearchcityclick=document.getElementById("ptsearchcityclick");e(g.id.ptsearchcityalliance, "pbsearchcityalliance");e(g.id.ptsearchcityplayer,"pbsearchcityplayer");e(g.id.ptsearchcityminmight,"pbsearchcityminmight");e(g.id.ptsearchcitymaxmight,"pbsearchcitymaxmight");c(g.id.ptsearchcityhostile,"pbsearchcityhostile");c(g.id.ptsearchcityfriendly,"pbsearchcityfriendly");c(g.id.ptsearchcityneutral,"pbsearchcityneutral");c(g.id.ptsearchcityfryou,"pbsearchcityfryou");c(g.id.ptsearchcityfrthem,"pbsearchcityfrthem");c(g.id.ptsearchcityselfalli,"pbsearchcityselfalli");c(g.id.ptsearchcitydiplnoa, "pbsearchcitydiplnoa");c(g.id.ptsearchcitynormal,"pbsearchcitynormal");c(g.id.ptsearchcitybeginner,"pbsearchcitybeginner");c(g.id.ptsearchcitypeace,"pbsearchcitypeace");c(g.id.ptsearchcityclick,"pbsearchcityclick");g.id.ptsearchcitychange1.addEventListener("click",d,!1);g.id.ptsearchcitychange2.addEventListener("click",d,!1)}g.popcity.show(!0);g.tableview("city",g.id.citylist,g.id.citycomment)},terrorview:function(){function c(c,d){var e=Tabs.Search;Options[d]&&(c.checked=!0);c.addEventListener("change", function(){Options[d]=this.checked;saveOptions();e.tableview("terror",e.id.terrorlist,e.id.terrorcomment)},!1)}function e(c,d){var e=Tabs.Search;c.value=Options[d];c.addEventListener("change",function(){Options[d]=this.value;"pbsearchterrormin"==d&&parseInt(Options.pbsearchterrormin)>parseInt(Options.pbsearchterrormax)&&(Options.pbsearchterrormax=Options.pbsearchterrormin,e.id.ptsearchterrormax.value=Options.pbsearchterrormax);"pbsearchterrormax"==d&&parseInt(Options.pbsearchterrormax)<parseInt(Options.pbsearchterrormin)&& (Options.pbsearchterrormin=Options.pbsearchterrormax,e.id.ptsearchterrormin.value=Options.pbsearchterrormin);saveOptions();e.tableview("terror",e.id.terrorlist,e.id.terrorcomment)},!1)}var d=Tabs.Search;if(null==d.popterror){d.popterror=new CPopup("terror",50,50,450,600,!0);d.popterror.getTopDiv().innerHTML='<b style="position:relative; top:4px; left: 6px;">Terrorist Camps Views and TRANSFER Menu:</b>';var g=[];g.push('<table><tr><td style="vertical-align:middle;">');g.push("Level: ");g.push(htmlSelector({1:"1", 2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",10:"10"},Options.pbsearchterrormin,'id="ptsearchterrormin"'));g.push(" / ");g.push(htmlSelector({1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",10:"10"},Options.pbsearchterrormax,'id="ptsearchterrormax"'));g.push("</td>");g.push('<td>&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id="ptsearchterrorclick">&nbsp;Attack Menu Coordinates Reports</td>');g.push("</tr></table>");g.push("<hr>");g.push('<div id="terrorlist" style="max-height:480px; height:480px; overflow-y:auto;"></div>'); g.push("<hr>");g.push('<div id="terrorcomment"></div>');d.popterror.getMainDiv().innerHTML=g.join("");d.id.ptsearchterrormin=document.getElementById("ptsearchterrormin");d.id.ptsearchterrormax=document.getElementById("ptsearchterrormax");d.id.terrorlist=document.getElementById("terrorlist");d.id.terrorcomment=document.getElementById("terrorcomment");d.id.ptsearchterrorclick=document.getElementById("ptsearchterrorclick");e(d.id.ptsearchterrormin,"pbsearchterrormin");e(d.id.ptsearchterrormax,"pbsearchterrormax"); c(d.id.ptsearchterrorclick,"pbsearchterrorclick")}d.popterror.show(!0);d.tableview("terror",d.id.terrorlist,d.id.terrorcomment)},tableview:function(c,e,d){var g=Tabs.Search;e.innerHTML="Processing Continues ... ...";d.innerHTML="Please wait ...";if("terror"==c){var f=[];f.push('<table id="pbterrortable" width="100%" class="zebra ptTabOverview" cellpadding="0" cellspacing="0">');f.push("<thead>");f.push('<tr style="background-color:#1BF;">');f.push('<td style="text-align:left;" class="no_sort"><b>Content</b></td>'); f.push('<td style="text-align:center;"><b>Level</b></td>');Options.pbsearchterrorclick?f.push('<td class="ptkoordslist no_sort" id="searchkoordslistT" title="Found automatically when you click here Attack, or Transfers all results..!!" style="text-align:center;"><b>Coordinate Reports</b></td>'):f.push('<td class="no_sort" style="text-align:center;"><b>Coordinate Report</b></td>');"u"==Options.pbsearchtype&&f.push('<td style="text-align:center;"><b>Order</b></td>');f.push("</tr>");f.push("</thead>"); f.push("<tbody>");var h=0,j;for(j in g.map.data){var l=g.map.data[j];if("51"==l.type&&"0"==l.userid&&!(parseInt(l.level)<parseInt(Options.pbsearchterrormin)||parseInt(l.level)>parseInt(Options.pbsearchterrormax))){var o=g.distance(parseInt(l.x),parseInt(l.y));"u"==Options.pbsearchtype&&o>parseInt(Options.pbsearchradius)||(style=h++%2?"odd":"",3E3<h||(f.push('<tr class="'+style+'">'),f.push('<td style="text-align:left;"><b>Terrorist Camp</b></td>'),f.push('<td style="text-align:center;">'+parseInt(l.level)+ "</td>"),Options.pbsearchterrorclick?f.push('<td class="ptkoords" title="When you click the Attack Function passes a selection here..!" style="text-align:center;" id="search'+h+'T">'+parseInt(l.x)+" , "+parseInt(l.y)+"</td>"):f.push('<td style="text-align:center;">'+parseInt(l.x)+" , "+parseInt(l.y)+"</td>"),"u"==Options.pbsearchtype&&f.push('<td my_key="'+o+'" style="text-align:center;">'+formatZahl(o,2,!0)+"</td>"),f.push("</tr>")))}}f.push("</tbody>");f.push("</table>");if(0==h){e.innerHTML="No results available ..."; d.innerHTML="Check your selection and try again ..";return}e.innerHTML=f.join("");d.innerHTML=3E3>=h?"Quantity: "+addCommas(h)+" Found.":'<span class="boldRed">3000 Results for the Performance Impairment out more livable.. '+addCommas(h)+"</span>";if(Options.pbsearchterrorclick){for(f=1;f<=h;f++){var q=document.getElementById("search"+f+"T");q.addEventListener("click",function(){var c=this.innerHTML.split(","),d=parseInt(c[0],10),c=parseInt(c[1],10);Options.pbartx=d;Options.pbarty=c;document.getElementById("ptartx").value= d;document.getElementById("ptarty").value=c;saveOptions();Tabs.Artefacts.finfo();alert("Desired Coordinate Attack: "+d+","+c+" And this is only attack will be transferred to the Coordinate..!!")},!1)}h=document.getElementById("searchkoordslistT");h.addEventListener("click",function(){for(var c=document.getElementById("pbterrortable").tBodies[0],d=c.rows,c=c.rows.length,e=[],f=0;f<c;f++)e.push(d[f].cells[2].innerHTML);Options.pbartklist=e.join("\n");Tabs.Artefacts.klistcheck();alert(addCommas(c)+" By clicking here automatically exist in the attack, or transfers all results..!!")}, !1)}new SortTable(document.getElementById("pbterrortable"))}if("wild"==c){q=g.diplomacy();f=[];f.push('<table id="pbwildtable" width="100%" class="zebra ptTabOverview" cellpadding="0" cellspacing="0">');f.push("<thead>");f.push('<tr style="background-color:#1BF;">');f.push('<td style="text-align:left;"><b>Content</b></td>');f.push('<td style="text-align:center;"><b>Level</b></td>');Options.pbsearchwildclick?f.push('<td class="ptkoordslist no_sort" id="searchkoordslistW" title="By clicking here automatically exist in the attack, or transfers all results..!!" style="text-align:center;"><b>Coordinate Reports</b></td>'): f.push('<td class="no_sort" style="text-align:center;"><b>Coordinate Reports</b></td>');"u"==Options.pbsearchtype&&f.push('<td style="text-align:center;"><b>Order</b></td>');f.push('<td class="sort_string" style="text-align:left;" ignore_case="ignore_case"><b>General</b></td>');f.push('<td style="text-align:right;"><b>POWER</b></td>');f.push('<td class="sort_string" style="text-align:left;" ignore_case="ignore_case"><b>Alliance</b></td>');f.push('<td style="text-align:right;"><b>Alli.POWER</b></td>'); q&&f.push('<td style="text-align:left;"><b>Diplomacy</b></td>');f.push('<td style="text-align:left;"><b>Province</b></td>');f.push("</tr>");f.push("</thead>");f.push("<tbody>");var h=0,v="";if(""!=Options.pbsearchwildplayer){var l=Options.pbsearchwildplayer.toLowerCase(),w;for(w in g.map.userInfo)if(o=g.map.userInfo[w].name.toLowerCase(),o==l){v=w.substr(1);break}}var E="";if(""!=Options.pbsearchwildalliance){var l=Options.pbsearchwildalliance.toLowerCase(),B;for(B in g.map.allianceNames)if(o=g.map.allianceNames[B].toLowerCase(), o==l){E=B.substr(1);break}}for(j in g.map.data)if(l=g.map.data[j],!(""!=Options.pbsearchwildplayer&&l.userid!=v)&&!(""!=Options.pbsearchwildalliance&&l.allianceid!=E)&&"51"!=l.type&&(Options.pbsearchwildwaste||"0"!=l.type))if(Options.pbsearchwildgrass||"10"!=l.type)if(Options.pbsearchwildriver||"12"!=l.type)if(Options.pbsearchwildoil||"20"!=l.type)if(Options.pbsearchwildstone||"30"!=l.type)if(Options.pbsearchwildsteel||"40"!=l.type)if(Options.pbsearchwildplain||"50"!=l.type)if(Options.pbsearchwildsr|| !("201"==l.type||"202"==l.type||"203"==l.type||"204"==l.type))if(!(parseInt(l.level)<parseInt(Options.pbsearchwildmin)||parseInt(l.level)>parseInt(Options.pbsearchwildmax)))if(Options.pbsearchwildfree||"0"!=l.userid)if(Options.pbsearchwildoccupied||"0"==l.userid){if("0"!=l.allianceid){if(Options.pbsearchwildnoalli)continue;var z=g.map.allianceDiplomacy["a"+l.allianceid];if(!Options.pbsearchwildneutral&&0==z)continue;if(!Options.pbsearchwildfriendly&&1==z)continue;if(!Options.pbsearchwildhostile&& 2==z)continue;if(!Options.pbsearchwildfrthem&&3==z)continue;if(!Options.pbsearchwildfryou&&4==z)continue;if(!Options.pbsearchwildselfalli&&5==z)continue}else if(!Options.pbsearchwilddiplnoa)continue;o=g.distance(parseInt(l.x),parseInt(l.y));"u"==Options.pbsearchtype&&o>parseInt(Options.pbsearchradius)||(style=h++%2?"odd":"",3E3<h||(f.push('<tr class="'+style+'">'),f.push('<td style="text-align:left;"><b>'+g.wildtypes[l.type]+"</b></td>"),f.push('<td style="text-align:center;">'+parseInt(l.level)+ "</td>"),Options.pbsearchwildclick?f.push('<td class="ptkoords" title="By clicking here automatically exist in the attack, or transfers all results..!!" style="text-align:center;" id="search'+h+'W">'+parseInt(l.x)+" , "+parseInt(l.y)+"</td>"):f.push('<td style="text-align:center;">'+parseInt(l.x)+" , "+parseInt(l.y)+"</td>"),"u"==Options.pbsearchtype&&f.push('<td  my_key="'+o+'" style="text-align:center;">'+formatZahl(o,2,!0)+"</td>"),"0"!=l.userid?(w=g.map.userInfo["u"+l.userid],f.push('<td style="text-align:left;">'+ w.name+"</td>"),f.push('<td my_key="'+w.might+'" style="text-align:right;">'+addCommas(w.might)+"</td>")):(f.push('<td style="text-align:left;">---</td>'),f.push('<td my_key="-1" style="text-align:right;">---</td>')),"0"!=l.allianceid?(B=g.map.allianceNames["a"+l.allianceid],o=g.map.allianceMights["a"+l.allianceid],f.push('<td style="text-align:left;">'+B+"</td>"),f.push('<td my_key="'+o+'" style="text-align:right;">'+addCommas(o)+"</td>"),q&&f.push('<td style="text-align:left;">'+g.diplomacyNames[z]+ "</td>")):(f.push('<td style="text-align:left;">---</td>'),f.push('<td my_key="-1" style="text-align:right;">---</td>'),q&&f.push('<td style="text-align:left;">---</td>')),f.push('<td style="text-align:left;">'+g.sectors["s"+l.sectorid]+"</td>"),f.push("</tr>")))}f.push("</tbody>");f.push("</table>");if(0==h){e.innerHTML="No results available ...";d.innerHTML="Check your selections and try again ..";return}e.innerHTML=f.join("");d.innerHTML=3E3>=h?"Wilds: "+addCommas(h)+" Found ...":'<span class="boldRed">3000 Results for the Performance Impairment out more livable.. '+ addCommas(h)+" </span>";if(Options.pbsearchwildclick){for(f=1;f<=h;f++)q=document.getElementById("search"+f+"W"),q.addEventListener("click",function(){var c=this.innerHTML.split(","),d=parseInt(c[0],10),c=parseInt(c[1],10);Options.pbartx=d;Options.pbarty=c;document.getElementById("ptartx").value=d;document.getElementById("ptarty").value=c;saveOptions();Tabs.Artefacts.finfo();alert("Desired Coordinate Attack: "+d+","+c+" And this is only attack will be transferred to the Coordinate..!!")},!1);h=document.getElementById("searchkoordslistW"); h.addEventListener("click",function(){for(var c=document.getElementById("pbwildtable").tBodies[0],d=c.rows,c=c.rows.length,e=[],f=0;f<c;f++)e.push(d[f].cells[2].innerHTML);Options.pbartklist=e.join("\n");Tabs.Artefacts.klistcheck();alert(addCommas(c)+" By clicking here automatically exist in the attack, or transfers all results..!!")},!1)}new SortTable(document.getElementById("pbwildtable"))}if("city"==c){q=g.diplomacy();f=[];f.push('<table id="pbcitytable" width="100%" class="zebra ptTabOverview" cellpadding="0" cellspacing="0">'); f.push("<thead>");f.push('<tr style="background-color:#1BF;">');f.push('<td style="text-align:left;"><b>Content</b></td>');f.push('<td style="text-align:center;"><b>Level</b></td>');f.push('<td style="text-align:left;"><b>Name</b></td>');Options.pbsearchcityclick?f.push('<td class="ptkoordslist no_sort" id="searchkoordslistC" title="By clicking here automatically exist in the attack, or transfers all results..!!" style="text-align:center;"><b>Coordinate Reports</b></td>'):f.push('<td class="no_sort" istyle="text-align:center;"><b>Coordinate Reports</b></td>'); "u"==Options.pbsearchtype&&f.push('<td style="text-align:center;"><b>Order</b></td>');f.push('<td class="sort_string" style="text-align:left;" ignore_case="ignore_case"><b>General</b></td>');f.push('<td style="text-align:right;"><b>POWER</b></td>');f.push('<td style="text-align:center;"><b>Gnr.Level</b></td>');f.push('<td class="sort_string" style="text-align:left;" ignore_case="ignore_case"><b>Alliance</b></td>');f.push('<td style="text-align:right;"><b>Alli.POWER</b></td>');q&&f.push('<td style="text-align:left;"><b>Diplomacy</b></td>'); f.push('<td style="text-align:left;"><b>Situation</b></td>');f.push('<td style="text-align:left;"><b>Province</b></td>');f.push("</tr>");f.push("</thead>");f.push("<tbody>");h=0;v="";if(""!=Options.pbsearchcityplayer)for(w in l=Options.pbsearchcityplayer.toLowerCase(),g.map.userInfo)if(o=g.map.userInfo[w].name.toLowerCase(),o==l){v=w.substr(1);break}E="";if(""!=Options.pbsearchcityalliance)for(B in l=Options.pbsearchcityalliance.toLowerCase(),g.map.allianceNames)if(o=g.map.allianceNames[B].toLowerCase(), o==l){E=B.substr(1);break}for(j in g.map.data)if(l=g.map.data[j],!(""!=Options.pbsearchcityplayer&&l.userid!=v)&&!(""!=Options.pbsearchcityalliance&&l.allianceid!=E)&&"51"==l.type&&"0"!=l.userid&&(w=g.map.userInfo["u"+l.userid],!(""!=Options.pbsearchcityminmight&&parseInt(w.might)<parseInt(Options.pbsearchcityminmight))&&!(""!=Options.pbsearchcitymaxmight&&parseInt(w.might)>parseInt(Options.pbsearchcitymaxmight))&&(Options.pbsearchcitynormal||"1"!=w.warstatus)))if(Options.pbsearchcitybeginner||"2"!= w.warstatus)if(Options.pbsearchcitypeace||"3"!=w.warstatus){if("0"!=l.allianceid){z=g.map.allianceDiplomacy["a"+l.allianceid];if(!Options.pbsearchcityneutral&&0==z)continue;if(!Options.pbsearchcityfriendly&&1==z)continue;if(!Options.pbsearchcityhostile&&2==z)continue;if(!Options.pbsearchcityfrthem&&3==z)continue;if(!Options.pbsearchcityfryou&&4==z)continue;if(!Options.pbsearchcityselfalli&&5==z)continue}else if(!Options.pbsearchcitydiplnoa)continue;o=g.distance(parseInt(l.x),parseInt(l.y));"u"==Options.pbsearchtype&& o>parseInt(Options.pbsearchradius)||(style=h++%2?"odd":"",3E3<h||(f.push('<tr class="'+style+'">'),f.push('<td style="text-align:left;"><b>City</b></td>'),f.push('<td style="text-align:center;">'+parseInt(l.level)+"</td>"),f.push('<td style="text-align:left;">'+l.cityname+"</td>"),Options.pbsearchcityclick?f.push('<td class="ptkoords" title="By clicking here automatically exist in the attack, or transfers all results..!!" style="text-align:center;" id="search'+h+'C">'+parseInt(l.x)+" , "+parseInt(l.y)+ "</td>"):f.push('<td style="text-align:center;">'+parseInt(l.x)+" , "+parseInt(l.y)+"</td>"),"u"==Options.pbsearchtype&&f.push('<td my_key="'+o+'" style="text-align:center;">'+formatZahl(o,2,!0)+"</td>"),f.push('<td style="text-align:left;">'+w.name+"</td>"),f.push('<td my_key="'+w.might+'" style="text-align:right;">'+addCommas(w.might)+"</td>"),f.push('<td style="text-align:center;">'+w.level+"</td>"),"0"!=l.allianceid?(B=g.map.allianceNames["a"+l.allianceid],o=g.map.allianceMights["a"+l.allianceid], f.push('<td style="text-align:left;">'+B+"</td>"),f.push('<td my_key="'+o+'" style="text-align:right;">'+addCommas(o)+"</td>"),q&&f.push('<td style="text-align:left;">'+g.diplomacyNames[z]+"</td>")):(f.push('<td style="text-align:left;">---</td>'),f.push('<td my_key="-1" style="text-align:right;">---</td>'),q&&f.push('<td style="text-align:left;">---</td>')),f.push('<td style="text-align:left;">'+g.warstatus[w.warstatus]+"</td>"),f.push('<td style="text-align:left;">'+g.sectors["s"+l.sectorid]+"</td>"), f.push("</tr>")))}f.push("</tbody>");f.push("</table>");if(0==h)e.innerHTML="No results available...",d.innerHTML="Check your selections and try again ..";else{e.innerHTML=f.join("");d.innerHTML=3E3>=h?"Per Week "+addCommas(h)+" Found ...":'<span class="boldRed">3000 Results for the Performance Impairment out more livable.. '+addCommas(h)+" </span>";if(Options.pbsearchcityclick){for(f=1;f<=h;f++)q=document.getElementById("search"+f+"C"),q.addEventListener("click",function(){var c=this.innerHTML.split(","), d=parseInt(c[0],10),c=parseInt(c[1],10);Options.pbartx=d;Options.pbarty=c;document.getElementById("ptartx").value=d;document.getElementById("ptarty").value=c;saveOptions();Tabs.Artefacts.finfo();alert("Desired Coordinate Attack: "+d+","+c+" And this is only attack will be transferred to the Coordinate..!!")},!1);h=document.getElementById("searchkoordslistC");h.addEventListener("click",function(){for(var c=document.getElementById("pbcitytable").tBodies[0],d=c.rows,c=c.rows.length,e=[],f=0;f<c;f++)e.push(d[f].cells[3].innerHTML); Options.pbartklist=e.join("\n");Tabs.Artefacts.klistcheck();alert(addCommas(c)+" By clicking here automatically exist in the attack, or transfers all results..!!")},!1)}new SortTable(document.getElementById("pbcitytable"))}}},diplomacy:function(){var c=Tabs.Search,e=Seed.allianceDiplomacies;c.map.allianceDiplomacy={};try{var d=e.allianceId}catch(g){return!1}for(var f in c.map.allianceNames){var h=!1;c.map.allianceDiplomacy[f]=0;for(var j in e.friendly)f==j&&(c.map.allianceDiplomacy[f]=1,h=!0);if(!h)for(j in e.hostile)f== j&&(c.map.allianceDiplomacy[f]=2,h=!0);if(!h)for(j in e.friendlyToThem)f==j&&(c.map.allianceDiplomacy[f]=3,h=!0);if(!h)for(j in e.friendlyToYou)f==j&&(c.map.allianceDiplomacy[f]=4,h=!0);!h&&f=="a"+d&&(c.map.allianceDiplomacy[f]=5)}return!0},startsearch:function(){var c=Tabs.Search,e="";if("u"==Options.pbsearchtype){Options.pbsearchx=parseInt(Options.pbsearchx);Options.pbsearchy=parseInt(Options.pbsearchy);Options.pbsearchradius=parseInt(Options.pbsearchradius);if(1>Options.pbsearchx||800<Options.pbsearchx)e+= "You must enter a number between 1 to 800 X Box..!!<br>";if(1>Options.pbsearchy||800<Options.pbsearchy)e+="You must enter a number between 1 to 800 of Y-Box..!!<br>";if(20>Options.pbsearchradius||100<Options.pbsearchradius)e+="Input Range Wrong DONE!! Maximum 100 Distance to Search..<br>"}if(0<e.length)Logbuch.eintrag(Logs.searchlog,e),c.logbuch();else if(c.mapread)c.mapread=!1,c.id.ptsearchtype.disabled=!1,c.id.ptsearchbutton.value="Start Search",c.show();else{c.mapread=!0;c.id.ptsearchtype.disabled= !0;c.id.ptsearchx.disabled=!0;c.id.ptsearchy.disabled=!0;for(i=0;i<Cities.numCities;i++)c.id["ptcity"+i].disabled=!0;c.id.ptsearchradius.disabled=!0;c.id.ptsearchsector.disabled=!0;c.id.ptsearchblockmax.disabled=!0;c.id.ptsearchbutton.value="stop calling";Logs.searchlog=[];saveLogs();c.map.data={};c.map.userInfo={};c.map.allianceNames={};c.map.allianceMights={};c.counter.terror=0;c.counter.wasteland=0;c.counter.grassland=0;c.counter.riverlake=0;c.counter.oil=0;c.counter.hills=0;c.counter.mountain= 0;c.counter.plain=0;c.counter.sr=0;c.counter.city=0;c.counter.user=0;c.counter.alliance=0;c.counter.fields=0;c.counter.timer=0;c.shortstat();if("u"==Options.pbsearchtype){var d=parseInt(Options.pbsearchx)-1,g=parseInt(Options.pbsearchy)-1,f=parseInt(Options.pbsearchradius),e=5*parseInt((d-f)/5),d=5*parseInt((d+f)/5);0>e&&(e=0);795<d&&(d=795);var h=5*parseInt((g-f)/5),g=5*parseInt((g+f)/5);0>h&&(h=0);795<g&&(g=795);c.buildblocks(e,h,d,g)}"s"==Options.pbsearchtype&&(e=c.sectorkoords[Options.pbsearchsector].x, h=c.sectorkoords[Options.pbsearchsector].y,c.buildblocks(e,h,e+195,h+195));"g"==Options.pbsearchtype&&c.buildblocks(0,0,795,795);c.blockpointer=0;c.blockread=!0;c.readmap()}},readmap:function(){var c=Tabs.Search;clearTimeout(c.blockreadtimer);if(c.mapread&&c.blockread&&c.blockpointer<c.blocklist.length){var e=unsafeWindow.Object.clone(unsafeWindow.g_ajaxparams);e.blocks=c.blocklist[c.blockpointer];c.blockread=!1;Logbuch.eintrag(Logs.searchlog,"Request "+(c.blockpointer+1)+" / "+c.blocklist.length+ " Processing..");c.logbuch();new MyAjaxRequest(unsafeWindow.g_ajaxpath+"fetchMapTiles.php"+unsafeWindow.g_ajaxsuffix,{method:"post",parameters:e,onSuccess:function(d){c.mapresult(d)},onFailure:function(d){c.mapresult(d)}})}c.blockpointer>=c.blocklist.length?(Logbuch.eintrag(Logs.searchlog,"Operation completed successfully..!!"),c.logbuch(),c.mapread=!1,c.id.ptsearchtype.disabled=!1,c.id.ptsearchbutton.value="stop calling",c.show()):c.blockreadtimer=setTimeout(c.readmap,250)},mapresult:function(c){var e= Tabs.Search;if(c.ok){for(var d in c.data){var g=c.data[d];if(!("u"==Options.pbsearchtype&&e.distance(parseInt(g.xCoord),parseInt(g.yCoord))>parseInt(Options.pbsearchradius))){e.map.data[d]||(e.map.data[d]={},e.counter.fields++);var f=e.map.data[d];f.x=g.xCoord;f.y=g.yCoord;f.type=g.tileType;f.level=g.tileLevel;f.userid=g.tileUserId;f.allianceid=g.tileAllianceId;f.sectorid=g.tileProvinceId;f.cityname=g.cityName;"51"==f.type&&("0"==f.userid?e.counter.terror++:e.counter.city++);("201"==f.type||"202"== f.type||"203"==f.type||"204"==f.type)&&e.counter.sr++;"0"==f.type&&e.counter.wasteland++;"10"==f.type&&e.counter.grassland++;"12"==f.type&&e.counter.riverlake++;"20"==f.type&&e.counter.oil++;"30"==f.type&&e.counter.hills++;"40"==f.type&&e.counter.mountain++;"50"==f.type&&e.counter.plain++}}for(d in c.userInfo)g=c.userInfo[d],e.map.userInfo[d]||(e.map.userInfo[d]={},e.counter.user++),f=e.map.userInfo[d],f.name=g.n,f.level=g.t,f.might=g.m,f.warstatus=g.w,f.allianceId=g.a;for(d in c.allianceNames)g= c.allianceNames[d],e.map.allianceNames[d]||(e.map.allianceNames[d]=g,e.counter.alliance++);for(d in c.allianceMights)g=c.allianceMights[d],e.map.allianceMights[d]||(e.map.allianceMights[d]=g);Logbuch.eintrag(Logs.searchlog,"processing "+(e.blockpointer+1)+" / "+e.blocklist.length+" successful ...");e.logbuch();e.blockpointer++;e.shortstat()}else Logbuch.eintrag(Logs.searchlog,"There were problems during operation..!! "+(e.blockpointer+1)+"/"+e.blocklist.length),e.logbuch();e.blockread=!0},shortstat:function(){var c= Tabs.Search,e=[];e.push('<table width="100%"><tr><td colspan="10"><b>Overview:</b></td></tr>');e.push('<tr><td colspan="10">&nbsp;</td></tr>');e.push("<tr>");e.push("<td>Terorist Camp:&nbsp;&nbsp;</td>");e.push('<td style="text-align:right;">'+addCommas(c.counter.terror)+"</td>");e.push('<td width="20" style="border-right:1px dotted black;">&nbsp;</td>');e.push('<td width="20">&nbsp;</td>');e.push("<td>City:&nbsp;</td>");e.push('<td style="text-align:right;">'+addCommas(c.counter.city)+"</td>");e.push('<td width="20" style="border-right:1px dotted black;">&nbsp;</td>'); e.push('<td width="20">&nbsp;</td>');e.push("<td>Meadow:&nbsp;&nbsp;&nbsp;</td>");e.push('<td style="text-align:right;">'+addCommas(c.counter.grassland)+"</td>");e.push("</tr>");e.push("<tr>");e.push("<td>River:&nbsp;</td>");e.push('<td style="text-align:right;">'+addCommas(c.counter.riverlake)+"</td>");e.push('<td width="20" style="border-right:1px dotted black;">&nbsp;</td>');e.push('<td width="20">&nbsp;</td>');e.push("<td>Oil:&nbsp;&nbsp;&nbsp;&nbsp;</td>");e.push('<td style="text-align:right;">'+ addCommas(c.counter.oil)+"</td>");e.push('<td width="20" style="border-right:1px dotted black;">&nbsp;</td>');e.push('<td width="20">&nbsp;</td>');e.push("<td>Peak:&nbsp;</td>");e.push('<td style="text-align:right;">'+addCommas(c.counter.hills)+"</td>");e.push("</tr>");e.push("<tr>");e.push("<td>Mountain:&nbsp;</td>");e.push('<td style="text-align:right;">'+addCommas(c.counter.mountain)+"</td>");e.push('<td width="20" style="border-right:1px dotted black;">&nbsp;</td>');e.push('<td width="20">&nbsp;</td>'); e.push("<td>Wasteland:&nbsp;</td>");e.push('<td style="text-align:right;">'+addCommas(c.counter.plain)+"</td>");e.push('<td width="20" style="border-right:1px dotted black;">&nbsp;</td>');e.push('<td width="20">&nbsp;</td>');e.push("<td>Flatness:&nbsp;</td>");e.push('<td style="text-align:right;">'+addCommas(c.counter.wasteland)+"</td>");e.push("</tr>");e.push("<tr>");e.push("<td>Titanium/Graphene:&nbsp;</td>");e.push('<td style="text-align:right;">'+addCommas(c.counter.sr)+"</td>");e.push('<td width="20" style="border-right:1px dotted black;">&nbsp;</td>'); e.push('<td width="20">&nbsp;</td>');e.push("<td>Generals:&nbsp;</td>");e.push('<td style="text-align:right;">'+addCommas(c.counter.user)+"</td>");e.push('<td width="20" style="border-right:1px dotted black;">&nbsp;</td>');e.push('<td width="20">&nbsp;</td>');e.push("<td>Alliances:&nbsp;</td>");e.push('<td style="text-align:right;">'+addCommas(c.counter.alliance)+"</td>");e.push("</tr>");e.push("<tr>");e.push('<td colspan="10">&nbsp;</td>');e.push("</tr>");e.push("<tr>");e.push('<td colspan="10">Corresponding Section: '+ addCommas(c.counter.fields)+" ("+parseInt(1E3*(c.counter.fields/64E4))/10+"%) Total of 640,000 boxes of Map Loaded.</td>");e.push("</tr>");0!=c.counter.timer&&(e.push("<tr>"),e.push('<td colspan="10">&nbsp;</td>'),e.push("</tr>"),e.push("<tr>"),e.push('<td colspan="10">Database: '+c.counter.timer+"</td>"),e.push("</tr>"));e.push("</table");c.id.ptsearchstat.innerHTML=e.join("")},buildblocks:function(c,e,d,g){var f=Tabs.Search,h=[],j=1;for(f.blocklist=[];c<=d;c+=5)for(var l=e;l<=g;l+=5)h.push("bl_"+ c+"_bt_"+l),j++,j>Options.pbsearchblockmax&&(f.blocklist.push(h.join(",")),h=[],j=1);0<h.length&&f.blocklist.push(h.join(","))},logbuch:function(){var c=Tabs.Search,e=Logbuch.ausgabe(Logs.searchlog);c.id.ptsearchlog.innerHTML=e},distance:function(c,e){var d=parseInt(Options.pbsearchx),g=parseInt(Options.pbsearchy),d=d-c,g=g-e;return parseInt(100*Math.sqrt(d*d+g*g))/100},city:function(){var c=Tabs.Search,e=parseInt(this.value)-1,d=Cities.cities[e].y;Options.pbsearchx=Cities.cities[e].x;Options.pbsearchy= d;c.id.ptsearchcityhint.innerHTML=Cities.cities[e].name;saveOptions();c.show()},togOpt:function(c,e){Options[e]&&(c.checked=!0);c.addEventListener("change",function(){Options[e]=this.checked;saveOptions()},!1)},changeOpt:function(c,e){var d=Tabs.Search;c.value=Options[e];c.addEventListener("change",function(){Options[e]=this.value;saveOptions();d.show()},!1)}}; Tabs.build={tabOrder:4,tabLabel:"Build",myDiv:null,timer:null,buildTab:null,koc_buildslot:null,koc_buildmenu:null,currentBuildMode:null,buildStates:[],loaded_bQ:[],lbQ:[],tabDisabled:!ENABLE_BUILD,errorcounter:0,init:function(c){function e(c,e){document.getElementById(e).addEventListener("click",function(){d.showBuildQueue(c,!0)},!1)}var d=Tabs.build;d.myDiv=c;d.koc_buildslot=unsafeWindow.Building.buildSlot;d.koc_buildmenu=unsafeWindow.Building.buildMenu;d.currentBuildMode="build";d.buildStates={running:!1, help:!1};d.readBuildStates();for(c=0;c<Cities.cities.length;c++)if(d["bQ_"+Cities.cities[c].id]=JSON2.parse(GM_getValue("bQ_"+getServerId()+"_"+unsafeWindow.g_ajaxsuffix.substr(3)+"_"+Cities.cities[c].id,"[]")),"undefined"==typeof d["bQ_"+Cities.cities[c].id]||""==d["bQ_"+Cities.cities[c].id])d["bQ_"+Cities.cities[c].id]=[];for(var g="<DIV id=pbBuildDivF class=ptStat>AUTO BUILD SETUP</div><TABLE id=pbbuildfunctions width=100% height=0% class=ptTab><TR>",g=!1==d.buildStates.running?g+'<TD><INPUT id=pbBuildRunning type=submit value="Building=OFF"></td>': g+'<TD><INPUT id=pbBuildRunning type=submit value="Building=ON"></td>',g=g+'<TD><INPUT id=pbBuildMode type=submit value="Construction-Queue=ON/OFF"></td><TD>Construction Content: <SELECT id="pbBuildType"><OPTION value="build">Up one level</option><OPTION value="max">Max Level RAISE</option><OPTION value="destruct">DEMOLITION</option></select></td>'+("<TD><INPUT id=pbHelpRequest type=checkbox "+(d.buildStates.help?" CHECKED":"")+"></td><TD>REQUEST Help??</td>"),g=g+'</tr></table></div><div id="pbBuildDivQ" class="ptStat">OVERVIEW OF THE CONSTRUCTION</div><table id="pbbuildqueues" width="100%" class="ptentry"><tr><td>&nbsp</td>', c=0;c<Cities.cities.length;c++)g+='<td style="text-align:center;"><b>'+Cities.cities[c].name+"</b></td>";g+="</tr><tr><td>&nbsp</td>";for(c=0;c<Cities.cities.length;c++)g+='<TD style="text-align:center;"><input id="pbbuild_'+Cities.cities[c].id+'" type="submit" value="SHOW"></td>';g+="</tr><tr><td>&nbsp</td>";for(c=0;c<Cities.cities.length;c++)g+="<td>&nbsp;</td>";g+="</tr><tr><td><b>Place:</b>&nbsp;</td>";for(c=0;c<Cities.cities.length;c++)g+='<td style="text-align:center;" id="pbbuildcount_'+Cities.cities[c].id+ '">'+d["bQ_"+Cities.cities[c].id].length+"</td>";g+="</tr><tr><td><b>Total time:</b>&nbsp;</td>";for(c=0;c<Cities.cities.length;c++){d["totalTime_"+Cities.cities[c].id]=0;cbQ=d["bQ_"+Cities.cities[c].id];if("undefined"!=typeof cbQ){for(var f=0;f<cbQ.length;f++)d["totalTime_"+Cities.cities[c].id]=parseInt(d["totalTime_"+Cities.cities[c].id])+parseInt(cbQ[f].buildingTime);timestring=timestr(d["totalTime_"+Cities.cities[c].id])}g+='<td style="text-align:center;" id="pbbuildtotal_'+Cities.cities[c].id+ '">'+timestring+"</td>"}d.myDiv.innerHTML=g+'</tr></table><span class="boldRed" id="pbbuildError"></span><hr><table width="100%"><tr><td><b>Department of Construction Monitoring Menu:</b><br><br></td><td style="text-align: right;"><input id="ptButClearBLog" type="submit" name="ClearBLog" value="CLEAR"></td></tr><tr><td colspan="2"><div id="pbbuildlog" style="height: 250px; overflow: auto;"></div></td></tr></table>';d.logbuch();for(c=0;c<Cities.cities.length;c++)g=Cities.cities[c].id,e(g,"pbbuild_"+ g),d.showBuildQueue(g,!1);d.e_autoBuild();document.getElementById("ptButClearBLog").addEventListener("click",function(){Logs.buildlog=[];saveLogs();d.logbuch()},!1);document.getElementById("pbBuildType").addEventListener("change",function(){d.setBuildMode(this.value)},!1);document.getElementById("pbBuildRunning").addEventListener("click",function(){d.toggleStateRunning(this)},!1);document.getElementById("pbBuildMode").addEventListener("click",function(){d.toggleStateMode(this)},!1);document.getElementById("pbHelpRequest").addEventListener("change", function(){d.buildStates.help=document.getElementById("pbHelpRequest").checked;d.saveBuildStates()},!1)},setBuildMode:function(c){Tabs.build.currentBuildMode=c},e_autoBuild:function(){var c=Tabs.build;document.getElementById("pbbuildError").innerHTML="";if(!0==c.buildStates.running)for(var e=unixTime(),d=0;d<Cities.cities.length;d++){var g=Cities.cities[d].id,f=!1,h=Seed.queue_con["city"+g];"array"==matTypeof(h)&&0<h.length&&(parseInt(h[0][4])>e?f=!0:h.shift());f||0<c["bQ_"+g].length&&c.doOne(c["bQ_"+ g][0])}setTimeout(c.e_autoBuild,1E4)},doOne:function(c){var e=Tabs.build,d=parseInt(c.cityId);e.getCityNameById(d);var g=parseInt(c.buildingTime),f=parseInt(c.buildingMult);parseInt(c.buildingAttempt);var h=c.buildingMode,j=parseInt(c.buildingPos);if(void 0!=Seed.buildings["city"+d]["pos"+j]&&void 0!=Seed.buildings["city"+d]["pos"+j][0]){var l=parseInt(c.buildingType),o=parseInt(Seed.buildings["city"+d]["pos"+j][0]),q=parseInt(c.buildingLevel),v=parseInt(Seed.buildings["city"+d]["pos"+j][1]),w=parseInt(c.buildingId), E=parseInt(Seed.buildings["city"+d]["pos"+j][3]);if(8<v&&"build"==h)e.cancelQueueElement(0,d,g,!1);else if(isNaN(v))e.cancelQueueElement(0,d,g,!1);else if(l!=o)e.cancelQueueElement(0,d,g,!1);else if(w!=E)e.cancelQueueElement(0,d,g,!1);else if(q<v)e.cancelQueueElement(0,d,g,!1);else if(q>v&&"build"==h)e.requeueQueueElement(c);else{if("destruct"==h){var B=unsafeWindow.Object.clone(unsafeWindow.g_ajaxparams);B.cid=d;B.bid="";B.pos=j;B.lv=v-1;1<=v&&(B.bid=E);B.type=o;new MyAjaxRequest(unsafeWindow.g_ajaxpath+ "destruct.php"+unsafeWindow.g_ajaxsuffix,{method:"post",parameters:B,onSuccess:function(f){f.ok?(Seed.queue_con["city"+d].push([o,0,parseInt(f.buildingId),unsafeWindow.unixtime(),unsafeWindow.unixtime()+g,0,g,j]),B.cid==unsafeWindow.currentcityid&&unsafeWindow.update_bdg(),e.cancelQueueElement(0,d,g,!1),msg="The destruction of our city:<b>"+Cities.byID[d].name+"</b> Building Content: (<b>"+unsafeWindow.arStrings.buildingName["b"+o]+"</b>)",Logbuch.eintrag(Logs.buildlog,msg),e.logbuch(),saveLogs()): (f=unsafeWindow.printLocalError(f.error_code||null,f.msg||null,f.feedback||null),e.requeueQueueElement(c),msg="Demolition fail!! <b>"+Cities.byID[d].name+"</b> (<b>"+unsafeWindow.arStrings.buildingName["b"+o]+'</b>)<br><span class="boldRed">'+f+"</span>",Logbuch.eintrag(Logs.buildlog,msg),e.logbuch(),saveLogs(),e.errorcounter++,!Tabs.Artefacts.started&&!Tabs.Artefacts.setstarted&&5<=e.errorcounter&&(msg='<span class="boldRed">No more than 5 Automatic error occurred during Construction..!!</span>', Logbuch.eintrag(Logs.buildlog,msg),e.logbuch(),saveLogs(),reloadGW()))},onFailure:function(){document.getElementById("pbbuildError").innerHTML="Demolition in action Please try again later. Construction Error Has Occurred."}})}if("build"==h){h=!1;l=unsafeWindow.checkreq("b",o,v);for(q=0;q<l[3].length;q++)0==l[3][q]&&(h=!0);!1==h?(B=unsafeWindow.Object.clone(unsafeWindow.g_ajaxparams),B.cid=d,B.pos=j,B.lv=v+1,9<B.lv?e.cancelQueueElement(0,d,g,!1):(1<B.lv&&(B.bid=E),B.type=o,new MyAjaxRequest(unsafeWindow.g_ajaxpath+ "construct.php"+unsafeWindow.g_ajaxsuffix,{method:"post",parameters:B,onSuccess:function(h){if(h.ok){if(Seed.resources["city"+d].rec1[0]-=3600*parseInt(unsafeWindow.buildingcost["bdg"+o][1])*f,Seed.resources["city"+d].rec2[0]-=3600*parseInt(unsafeWindow.buildingcost["bdg"+o][2])*f,Seed.resources["city"+d].rec3[0]-=3600*parseInt(unsafeWindow.buildingcost["bdg"+o][3])*f,Seed.resources["city"+d].rec4[0]-=3600*parseInt(unsafeWindow.buildingcost["bdg"+o][4])*f,Seed.resources["city"+d].rec5[0]-=3600*parseInt(unsafeWindow.buildingcost["bdg"+ o][5])*f,Seed.resources["city"+d].rec6[0]-=3600*parseInt(unsafeWindow.buildingcost["bdg"+o][6])*f,Seed.resources["city"+d].rec7[0]-=3600*parseInt(unsafeWindow.buildingcost["bdg"+o][7])*f,Seed.resources["city"+d].rec8[0]-=3600*parseInt(unsafeWindow.buildingcost["bdg"+o][8])*f,Seed.queue_con["city"+d].push([o,v+1,parseInt(h.buildingId),unsafeWindow.unixtime(),unsafeWindow.unixtime()+g,0,g,j]),B.cid==unsafeWindow.currentcityid&&unsafeWindow.update_bdg(),e.cancelQueueElement(0,d,g,!1),msg="Planned Building Your City: <b>"+ Cities.byID[d].name+"</b> The building was constructed: (<b>"+unsafeWindow.arStrings.buildingName["b"+o]+"</b> Level <b>"+B.lv+"</b>)",Logbuch.eintrag(Logs.buildlog,msg),e.logbuch(),saveLogs(),!0==document.getElementById("pbHelpRequest").checked)try{e.bot_gethelp(B.bid,d)}catch(l){msg='<span class="boldRed">Pages on this Facebook welded construction has resulted Bad Request Help.!</span>',Logbuch.eintrag(Logs.buildlog,msg),Logbuch.eintrag(Logs.buildlog,l.name+" : "+l.message+" : Row:"+l.lineNumber), e.logbuch(),saveLogs()}}else h=unsafeWindow.printLocalError(h.error_code||null,h.msg||null,h.feedback||null),e.requeueQueueElement(c),msg="Construction FAILED! <b>"+Cities.byID[d].name+"</b> (<b>"+unsafeWindow.arStrings.buildingName["b"+o]+"</b> Level <b>"+B.lv+'</b>)<br><span class="boldRed">'+h+"</span>",Logbuch.eintrag(Logs.buildlog,msg),e.logbuch(),saveLogs(),e.errorcounter++,!Tabs.Artefacts.started&&!Tabs.Artefacts.setstarted&&5<=e.errorcounter&&(msg='<span class="boldRed">More than 5 error has occurred during Auto-Building Process.REFRESH PAGE.!</span>', Logbuch.eintrag(Logs.buildlog,msg),e.logbuch(),saveLogs(),reloadGW())},onFailure:function(){document.getElementById("pbbuildError").innerHTML="Construction in action Please try again later. Connection Error Has Occurred."}}))):e.requeueQueueElement(c)}}}else e.cancelQueueElement(0,d,g,!1)},logbuch:function(){var c=Logbuch.ausgabe(Logs.buildlog);document.getElementById("pbbuildlog").innerHTML=c},requeueQueueElement:function(c){var e=Tabs.build,d=c.cityId,g=parseInt(c.buildingPos),f=parseInt(c.buildingId), h=parseInt(c.buildingLevel),j=parseInt(c.buildingType),l=parseInt(c.buildingTime),o=parseInt(c.buildingMult),q=parseInt(c.buildingAttempts);e.addQueueItem(d,g,j,f,l,h,q+1,o,c.buildingMode);e.cancelQueueElement(0,d,l,!1)},show:function(){},bot_buildslot:function(c){var e=Tabs.build,d=e.getCurrentCityId(),g=parseInt(Seed.buildings["city"+d]["pos"+c][0]),f=parseInt(Seed.buildings["city"+d]["pos"+c][1]),h=parseInt(Seed.buildings["city"+d]["pos"+c][3]),j=e["bQ_"+d],l="undefined"!=typeof Seed.queue_con["city"+ d][0]?Seed.queue_con["city"+d][0][2]:"";if(0==j.length&&""!=l)"NaN"!=l&&l==h&&(f+=1);else{""!=l&&l==h&&(f+=1);for(l=0;l<j.length;l++){var o=j[l].cityId,q=j[l].buildingPos;q==c&&o==d&&(f+=1);if("destruct"==j[l].buildingMode&&q==c&&o==d){e.modalmessage("Already have added during demolition.!");return}}}if("build"==e.currentBuildMode){if(9<=f){e.modalmessage("Level 10, and 11 buildings you can build only Manually.!");return}var l="build",v=e.calculateQueueValues(d,f,g,l),o=v[0],v=v[1],q=j.length;e.addQueueItem(d, c,g,h,v,f,0,o,l);e._addTab(q,d,g,v,f,0,l)}if("max"==e.currentBuildMode)for(var l="build",w=f;9>w;w++)q=j.length,v=e.calculateQueueValues(d,w,g,l),o=v[0],v=v[1],e.addQueueItem(d,c,g,h,v,w,0,o,l),e._addTab(q,d,g,v,w,0,l);"destruct"==e.currentBuildMode&&(l="destruct",v=e.calculateQueueValues(d,f,g,l),o=v[0],v=v[1],q=j.length,e.addQueueItem(d,c,g,h,v,f,0,o,l),e._addTab(q,d,g,v,f,0,l))},calculateQueueValues:function(c,e,d,g){unixTime();if("build"==g)var f=Math.pow(2,e);"destruct"==g&&(f=Math.pow(2,e-2)); c=unsafeWindow.constructionData["b"+d].c[10]*f;6>parseInt(d)&&0<parseInt(d)&&1==f&&(c=5);"build"==g&&(c=parseInt(c/(1+unsafeWindow.General.politicsBonus()+unsafeWindow.Research.bonusForType(unsafeWindow.Constant.Research.CRANES))));"destruct"==g&&(c/=1+unsafeWindow.General.politicsBonus()+unsafeWindow.Research.bonusForType(unsafeWindow.Constant.Research.CRANES),0<c%1&&(c=parseInt(c)));return[f,c]},bot_gethelp:function(c,e){if(Seed.allianceDiplomacies.allianceId){for(var d=qlist=Seed.queue_con["city"+ e],g=0,f=0,h=0;h<d.length;h++)if(parseInt(d[h][2])==parseInt(c)){g=parseInt(d[h][0]);f=parseInt(d[h][1]);break}b=[["REPLACE_LeVeLbUiLdInG",f],["REPLACE_BuIlDiNgNaMe",unsafeWindow.arStrings.buildingName["b"+g]],["REPLACE_LeVeLiD",f],["REPLACE_AsSeTiD",c]];d=unsafeWindow.Object.clone(unsafeWindow.g_ajaxparams);d.level=f;d.id=c;d.name=unsafeWindow.arStrings.buildingName["b"+g];d.type="building";d.cid=e;new MyAjaxRequest(unsafeWindow.g_ajaxpath+"sendAllianceHelpBuildMessage.php"+unsafeWindow.g_ajaxsuffix, {method:"post",parameters:d,onSuccess:function(c){c.ok?(c=c.newChat,unsafeWindow.Chat.addToChat(c[0],c[1].comment,!0)):(c=unsafeWindow.printLocalError(c.error_code||null,c.msg||null,c.feedback||null),Logbuch.eintrag(Logs.buildlog,'Your help request has failed..!!<br><span class="boldRed">'+c+"</span>"),t.logbuch(),saveLogs())},onFailure:function(){alert("Error Occurred..!")}});unsafeWindow.common_postToProfile("95",b,null,"95_helpbuild")}},addQueueItem:function(c,e,d,g,f,h,j,l,o){var q=Tabs.build; q["bQ_"+c].push({cityId:c,buildingPos:e,buildingType:d,buildingId:g,buildingTime:f,buildingLevel:h,buildingAttempts:j,buildingMult:l,buildingMode:o});q.modifyTotalTime(c,"increase",f)},modalmessage:function(c){unsafeWindow.Modal.showAlert(c)},modifyTotalTime:function(c,e,d){var g=Tabs.build,f=document.getElementById("pbbuildcount_"+c),h=parseInt(f.innerHTML);"increase"==e&&(g["totalTime_"+c]+=d,h+=1);"decrease"==e&&(g["totalTime_"+c]-=d,h-=1);f.innerHTML=h;document.getElementById("pbbuildtotal_"+ c).innerHTML=timestr(g["totalTime_"+c])},hide:function(){},onUnload:function(){for(var c=Tabs.build,e=0;e<Cities.cities.length;e++)GM_setValue("bQ_"+getServerId()+"_"+unsafeWindow.g_ajaxsuffix.substr(3)+"_"+Cities.cities[e].id,JSON2.stringify(c["bQ_"+Cities.cities[e].id]));c.saveBuildStates()},_addTab:function(c,e,d,g,f,h,j){var l=Tabs.build,o=document.getElementById("pbCityQueueContent").insertRow(0);o.vAlign="top";o.insertCell(0).innerHTML=c;"destruct"==j?o.insertCell(1).innerHTML="Demolition": o.insertCell(1).innerHTML="Building";o.insertCell(2).innerHTML=unsafeWindow.arStrings.buildingName["b"+d];o.insertCell(3).innerHTML=timestr(g);"destruct"==j?o.insertCell(4).innerHTML=0:o.insertCell(4).innerHTML=f+1;o.insertCell(5).innerHTML=h;o.insertCell(6).innerHTML='<input type=button id="queuecancel_'+c+'" value="CANCELLED">';document.getElementById("queuecancel_"+c).addEventListener("click",function(){l.cancelQueueElement(c,e,g,!0)},!1)},cancelQueueElement:function(c,e,d,g){var f=Tabs.build, c=parseInt(c);f["bQ_"+e].splice(c,1);f.modifyTotalTime(e,"decrease",d);!0==g&&f.showBuildQueue(e,!1)},showBuildQueue:function(c,e){var d=Tabs.build;clearTimeout(d.timer);var g=d.getCityNameById(c);null==d.popBuildQueue&&(d.popBuildQueue=new CPopup("pbbuild_"+c,0,0,450,500,!0,function(){clearTimeout(d.timer)}));d.popBuildQueue.getMainDiv().innerHTML='<DIV style="max-height:460px; height:460px; overflow-y:auto"><TABLE width="100%" id="pbCityQueueContent"></table></div>';d.popBuildQueue.getTopDiv().innerHTML= '<TD width="200px">&nbsp;<B>Construction Sequence: '+g+'</b></td><TD>&nbsp;<INPUT id=pbOptimizeByTime type=submit value="Sort by Time"></td>';d.paintBuildQueue(c);e&&d.popBuildQueue.show(!0);document.getElementById("pbOptimizeByTime").addEventListener("click",function(){d.clearBuildQueue();d.paintBuildQueue(c,!0)},!1);d.timer=setTimeout(function(){d.showBuildQueue(c,!1)},5E3)},paintBuildQueue:function(c,e){var d=Tabs.build,g=d["bQ_"+c];!0==e&&g.sort(function(c,d){return c.buildingTime-d.buildingTime}); d["bQ_"+c]=g;for(var f=0;f<g.length;f++)d._addTab(f,g[f].cityId,g[f].buildingType,g[f].buildingTime,g[f].buildingLevel,g[f].buildingAttempts,g[f].buildingMode)},clearBuildQueue:function(){for(var c=document.getElementById("pbCityQueueContent"),e=c.rows;e.length;)c.deleteRow(e.length-1)},getCurrentCityId:function(){return!unsafeWindow.currentcityid?null:unsafeWindow.currentcityid},saveBuildStates:function(){var c=Tabs.build,e=getServerId();GM_setValue("buildStates_"+e+"_"+unsafeWindow.g_ajaxsuffix.substr(3), JSON2.stringify(c.buildStates))},readBuildStates:function(){var c=Tabs.build,e=getServerId();s=GM_getValue("buildStates_"+e+"_"+unsafeWindow.g_ajaxsuffix.substr(3));if(null!=s)for(k in states=JSON2.parse(s),states)c.buildStates[k]=states[k]},toggleStateRunning:function(c){var e=Tabs.build;!0==e.buildStates.running?(e.buildStates.running=!1,e.saveBuildStates(),c.value="AUTO-Building=OFF"):(e.buildStates.running=!0,e.saveBuildStates(),c.value="AUTO-Building=ON")},toggleStateMode:function(c){var e=Tabs.build; "Construction-Queue=OFF"==c.value?(unsafeWindow.Building.buildSlot=e.bot_buildslot,unsafeWindow.Building.buildMenu=e.bot_buildslot,c.value="Construction-Queue=ON"):(unsafeWindow.Building.buildSlot=e.koc_buildslot,unsafeWindow.Building.buildMenu=e.koc_buildmenu,c.value="Construction-Queue=OFF")},getCityNameById:function(c){return Cities.byID[c].name}}; Tabs.Player={tabOrder:8,tabLabel:"Player",cont:null,TabDisabled:!ENABLE_PLAYER,dat:[],fetchTEST:function(c,e){var d=unsafeWindow.Object.clone(unsafeWindow.g_ajaxparams);d.pageNo=1;d.numPerPage=100;d.perPage=100;d.results=100;d.numResults=100;new MyAjaxRequest(unsafeWindow.g_ajaxpath+"ajax/allianceGetMembersInfo.php"+unsafeWindow.g_ajaxsuffix,{method:"post",parameters:d,onSuccess:function(c){e(c)},onFailure:function(){e({errorMsg:"AJAX error"})}})},init:function(c){var e=Tabs.Player;e.cont=c;c=[]; c.push('<table class="ptTab ptStat" width="100%">');c.push("<tr>");c.push('<td style="text-align:center;">');c.push("<b>City, Wild and TC SEARCH</b>");c.push("</td>");c.push("</tr>");c.push("</table>");c.push("<br>");c.push('<table class="ptTab" width="100%">');c.push("<tr>");c.push("<td>");c.push("<b>Aran\u0131lan:&nbsp;</b>");c.push("</td>");c.push("<td>");c.push(htmlSelector({u:"Search Radius",s:"Search Sector",g:"Entire Map"},Options.pbsearchtype,'id="ptsearchtype"'));c.push('&nbsp;<span id="ptsearchhint"></span>'); c.push("</td>");c.push("</tr>");c.push("<tr>");c.push("<td>");c.push("<b>Call Center:&nbsp;</b>");c.push("</td>");c.push("<td>");c.push('<input id="ptsearchx" type="text" size="2" maxlength="3" style="text-align: center;">');c.push(" / ");c.push('<input id="ptsearchy" type="text" size="2" maxlength="3" style="text-align: center;">');c.push("&nbsp;Cities:");for(var d=0;d<Cities.numCities;d++)c.push('&nbsp;<input id="ptcity'+d+'" type="submit" name="c'+d+'" value="'+(d+1)+'" title="'+Cities.cities[d].name+ '" style="padding-left:2px;padding-right:2px;">');c.push('&nbsp;&nbsp;<b><span id="ptsearchcityhint"></span></b></td>');c.push("</tr>");c.push("<tr>");c.push("<td>");c.push("<b>Search Distance:&nbsp;</b>");c.push("</td>");c.push("<td>");c.push('<input id="ptsearchradius" type="text" size="2" maxlength="3" style="text-align: center;">&nbsp;(20 - 100)');c.push("</td>");c.push("</tr>");c.push("<tr>");c.push("<td>");c.push("<b>Province:&nbsp;</b>");c.push("</td>");c.push("<td>");c.push(htmlSelector(e.sectors, Options.pbsearchsector,'id="ptsearchsector"'));c.push("</td>");c.push("</tr>");c.push("<tr>");c.push('<td colspan="2">');c.push('<br><input id="ptsearchbutton" type="submit" name="search" value="SEARCH"><br><br>');c.push("</td>");c.push("</tr>");c.push("<tr>");c.push('<td colspan="2">');c.push('<div id="ptsearchlog" style="height:70px; overflow:auto;"></div>');c.push("</td>");c.push("</tr>");c.push("</table>");c.push("<hr>");c.push('<div id="ptsearchstat"></div>');c.push("<hr>");c.push('<div style="text-align:center;">'); c.push('<input id="ptsearchterror" type="submit" name="terror" value="Terrorist Camps SHOW">&nbsp;&nbsp;&nbsp;');c.push('<input id="ptsearchwild" type="submit" name="wild" value="Wilds SHOW">&nbsp;&nbsp;&nbsp;');c.push('<input id="ptsearchcity" type="submit" name="city" value="Cities SHOW">');c.push("</div>");unsafeWindow.PTgetMembers=e.eventGetMembers;unsafeWindow.PTpd=e.clickedPlayerDetail;unsafeWindow.PTpl=e.clickedPlayerLocator;unsafeWindow.PTalClickPrev=e.eventListPrev;unsafeWindow.PTpl2=e.clickedPlayerLeaderboard; unsafeWindow.PTalClickNext=e.eventListNext;unsafeWindow.PCplo=e.clickedPlayerGetLastLogin;Lastlogin=0;e.show()},hide:function(){},show:function(){var c=Tabs.Player;if(null==c.state){if(0==getMyAlliance()[0])c.cont.innerHTML="<BR><BR><CENTER>To use this feature must be members of the Alliance..!!</center>";else{var e='<DIV class=ptentry><TABLE width=100% cellpadding=0><TR><TD class=xtab align=right></td><TD class=xtab>Player Name: &nbsp;</td><TD width=80% class=xtab><INPUT id=allPlayName size=20 type=text /> &nbsp; <INPUT id=playSubmit type=submit value="SEARCH" /></td><TD class="xtab ptErrText"><SPAN id=ptplayErr></span></td></tr><TR><TD class=xtab></td><TD class=xtab> Alliance: &nbsp;</td><TD class=xtab><INPUT id=allAllName type=text /> &nbsp; <INPUT id=allSubmit type=submit value="SEARCH" /></td><TD class="xtab ptErrText"><SPAN id=ptallErr></span></td></tr><TR><TD class=xtab></td><TD class=xtab> &nbsp;</td><TD class=xtab><INPUT align=right id=idMyAllSubmit type=submit value="'+ getMyAlliance()[1]+'"/><TD class=xtab><span align=right <b>Distance Calculation: </b></span></td><TD class=xtab ><div><select id="idFindETASelect"><option value="0,250" > -- Selection -- </option><option value="0,180" > Supply Truck </option><option value="0,200" > Infantry </option><option value="0,320" > Sniper </option><option value="0,300" > Anti-Tank </option><option value="0,275" > Special Forces </option><option value="0,250" > SAM </option><option value="1,1000" > Tank </option><option value="1,750" > Predator Drone </option><option value="1,150" > Supply Chopper </option><option value="1,100" > Gunship </option><option value="1,120" > Fighter </option><option value="1,280" > Bomber </option><option value="1,85" > Cargo Plane </option><option value="1,90" > Hell-Fire Tank</option><option value="1,80" > Stealth Bomber </option><option value="1,380" > Nuclear Weapons </option><option value="1,680" > Ion Cannon </option></select></div></td></tr></table><span style="vertical-align:middle;" id=altInput></span></div><SPAN id=allListOut></span>'; c.cont.innerHTML=e;document.getElementById("allSubmit").addEventListener("click",c.eventSubmit,!1);document.getElementById("playSubmit").addEventListener("click",c.eventPlayerSubmit,!1);document.getElementById("allAllName").addEventListener("focus",function(){document.getElementById("ptallErr").innerHTML=""},!1);document.getElementById("allPlayName").addEventListener("focus",function(){document.getElementById("ptplayErr").innerHTML=""},!1);document.getElementById("idMyAllSubmit").addEventListener("click", c.showMyAlliance,!1);document.getElementById("idFindETASelect").addEventListener("click",c.handleEtaSelect,!1);document.getElementById("idFindETASelect").disabled=!0;c.ModelCity=Cities.cities[0];c.curPage=0;c.MaxPage=-1}c.state=1}},pName:"",eventPlayerSubmit:function(){var c=Tabs.Player;document.getElementById("ptplayErr").innerHTML="";var e=document.getElementById("allPlayName").value;c.pName=e;3>e.length?document.getElementById("ptplayErr").innerHTML="To search entries should be made at least 3 characters.!!": (document.getElementById("altInput").innerHTML="",document.getElementById("allListOut").innerHTML="<BR><BR><CENTER>Wanted ....</center>",c.fetchPlayerList(e,c.eventGotPlayerList))},eventGotPlayerList:function(c){var e=Tabs.Player;if(c.ok){e.playerList=c.matchedUsers;var d=[];for(k in c.matchedUsers)d.push(c.matchedUsers[k].userId);e.fetchPlayerStatus(d,function(c){e.eventGotPlayerOnlineList(c)})}else document.getElementById("allListOut").innerHTML=c.errorMsg},eventGotPlayerOnlineList:function(c){var e= Tabs.Player;if(c.ok){var d='<DIV class=ptstat>Showing Player: <B>"'+e.pName+'"</b></div><DIV style="height:575px; max-height:575px; overflow-y:auto"><TABLE width=100% align=center class=ptTab cellspacing=5><TR style="font-weight:bold"><TD width=25%>Player Name</td><TD align=right width=15%>POWER</td><TD width=15%> &nbsp; Online</td><TD width=15%>Facebook Prfl.&nbsp;</td><TD width=75%>General</td></tr>',g=0,f="";for(k in e.playerList)var h=e.playerList[k],f=++g%2?"class=ptOddrow ":"",d=d+("<TR "+f+ 'valign=top><TD><SPAN onclick="PTpl(this, '+h.userId+')"><A style="color:#1D0AF2">'+h.genderAndName+"</a></td><TD align=right>"+addCommasInt(h.might)+"</td><TD>"+(c.data[h.userId]?"&nbsp;<SPAN class=boldRed><blink><b>ONLINE</b></blink></span>":"")+'</td><div style="width:100%;filter:Glow(color=#F20A15, strength=12)"><TD align=center><A style="color:#1D0AF2" target="_tab" href="http://www.facebook.com/profile.php?id='+h.Fbuid+'">Facebook Profile</a></div></td><TD><SPAN onclick="PTpd(this, '+h.userId+ ')"><A style="color:#1D0AF2">Details</a> &nbsp; <BR></span><SPAN onclick="PCplo(this, \''+h.userId+'\')"><A style="color:#1D0AF2">Last Login:</a></span></td></tr>');document.getElementById("allListOut").innerHTML=d+"</table></div>"}else document.getElementById("allListOut").innerHTML=c.errorMsg},clickedPlayerDetail:function(c,e){var d=Tabs.Player;c.onclick="";c.innerHTML="detail is reached ...";d.fetchPlayerInfo(e,function(e){d.gotPlayerDetail(e,c)})},clickedPlayerLocator:function(c,e){var d=Tabs.Player; d.fetchPlayerInfo2(e,function(e){d.gotPlayerInfo2(e,c)})},clickedPlayerGetLastLogin:function(c,e){var d=Tabs.Player;c.onclick="";c.innerHTML="detail is reached ...";d.fetchPlayerLastLogin(e,function(e){d.gotPlayerLastLogin(e,c)})},gotPlayerInfo2:function(c,e){var d=Tabs.Player;if(c.ok)if(0==c.totalResults)e.innerHTML="<B>Leader Board:</b> Not found! (misted?)";else{getMyAlliance();d.dat=[];actionLog("gotPlayerLeaderboard -1 "+JSON2.stringify(c));var g=c.data,f;for(f in c.data.cities)alert(f);for(f= 0;f<g.cities.length;f++)d.dat.push([g.player.generalName,parseInt(g.player.power),"xx",parseInt(g.numCities),parseInt(g.cities[f].tileLevel),"xx","xx",g.cities[f].cityName,0,1,0,g.userId]);alert(g.cities[1].progress);d.setDistances(Cities.cities[0].x,Cities.cities[0].y);d.ModelCity=Cities.cities[0];d.setEta();d.fetchPlayerLastLogin(uid,function(c){d.displayPlayer(g.allianceName,c)});d.fetchPlayerLastLogin();d.displayPlayer(g.allianceId)}else e.innerHTML=c.errorMsg},clickedPlayerLeaderboard:function(c, e){var d=my.Player;c.onclick="";c.innerHTML="detail is reached ...";d.fetchLeaderboard(e,function(e){d.gotPlayerLeaderboard(e,c)})},fetchLeaderboard:function(c,e){unsafeWindow.AjaxCall.gPostRequest("getUserLeaderboard.php",{action:"view_player_detail",player_id:c},function(c){e(c)},function(c){e(c)})},gotPlayerDetail:function(c,e){if(c.ok){var d=c.userInfo[0],g="None";d.allianceName&&(g=d.allianceName+" ("+getDiplomacy(d.allianceId)+")");for(var g="<TABLE cellspacing=0 class=ptTab><TR><TD>Alliance: "+ g+" &nbsp; Cities: "+d.cities+" &nbsp; Population: "+d.population+"</td></tr><TR><TD>Province: ",d=d.provinceIds.split(","),f=[],h=0;h<d.length;h++)f.push(unsafeWindow.provincenames["p"+d[h]]);e.innerHTML=g+f.join(", ")+"</td></tr></table>"}else e.innerHTML=c.errorMsg},eventMyAllianceSubmit:function(){var c=Tabs.Player;document.getElementById("allListOut").innerHTML="<BR><BR><CENTER>Wanted  ...</center>";c.fetchAllianceMemberList(getMyAlliance()[0],null,c.eventGotMemberList)},aName:"",eventSubmit:function(){var c= Tabs.Player;document.getElementById("ptallErr").innerHTML="";c.aName=document.getElementById("allAllName").value;if(3>c.aName.length)document.getElementById("ptallErr").innerHTML="To make calls from at least 3 Character Should Be.!!";else{var e=getMyAlliance();document.getElementById("altInput").innerHTML="";document.getElementById("allListOut").innerHTML="<BR><BR><CENTER>Wanted  ...</center>";0!=e[0]&&0<=e[1].toLowerCase().indexOf(c.aName.toLowerCase())?c.fetchAllianceList(c.aName,e[0],c.eventGotAllianceList): c.fetchAllianceList(c.aName,null,c.eventGotAllianceList)}},showMyAlliance:function(){var c=Tabs.Player,e=getMyAlliance();document.getElementById("allListOut").innerHTML="<BR><BR><CENTER> ...</center>";0!=e[0]?c.eventGetMembers(e[0]):document.getElementById("allListOut").innerHTML="To use this feature must be members of the Alliance..!!"},fetchPlayerInfo2:function(c,e){var d=unsafeWindow.Object.clone(unsafeWindow.g_ajaxparams);d.tvuid=c;d.uid=c;new MyAjaxRequest(unsafeWindow.g_ajaxpath+"getSeed.php?u="+ unsafeWindow.g_ajaxsuffix,{method:"post",parameters:d,onSuccess:function(c){e(c)},onFailure:function(){e({errorMsg:"AJAX error"})}})},fetchMapTiles:function(c,e){var d=unsafeWindow.Object.clone(unsafeWindow.g_ajaxparams);d.action="show_all_players";new MyAjaxRequest(unsafeWindow.g_ajaxpath+"getUserLeaderboard.php"+unsafeWindow.g_ajaxsuffix,{method:"post",parameters:d,onSuccess:function(c){e(c);alert(c)},onFailure:function(c){e({errorMsg:"AJAX error"});alert(c)}})},fetchAllianceList:function(c,e,d){var g= Tabs.Player,f=unsafeWindow.Object.clone(unsafeWindow.g_ajaxparams);f.allianceName=c;new MyAjaxRequest(unsafeWindow.g_ajaxpath+"allianceGetSearchResults.php"+unsafeWindow.g_ajaxsuffix,{method:"post",parameters:f,onSuccess:function(c){null!=e&&0<e?g.fetchMyAllianceInfo(function(e){a:{if(!c.ok){if(0!=c.msg.indexOf("To use this feature must be members of the Alliance..!!")||!e.ok){d(c);break a}c.ok=!0;c.count=0;c.alliancesMatched={}}e.ok&&(c.alliancesMatched["a"+e.allianceInfo.allianceId]={allianceId:e.allianceInfo.allianceId, allianceName:e.allianceInfo.allianceName,membersCount:e.allianceInfo.members,relation:null,might:e.allianceInfo.might,ranking:e.allianceInfo.ranking},++c.count);d(c)}}):d(c)},onFailure:function(){d({errorMsg:"AJAX error"})}})},fetchOtherAllianceInfo:function(c,e){var d=unsafeWindow.Object.clone(unsafeWindow.g_ajaxparams);d.pageNo=c;d.cityId=unsafeWindow.currentcityid;new MyAjaxRequest(unsafeWindow.g_ajaxpath+"allianceGetOtherInfo.php"+unsafeWindow.g_ajaxsuffix,{method:"post",parameters:d,onSuccess:function(c){e(c)}, onFailure:function(){e({errorMsg:"AJAX error"})}})},fetchMyAllianceInfo:function(c){var e=unsafeWindow.Object.clone(unsafeWindow.g_ajaxparams);new MyAjaxRequest(unsafeWindow.g_ajaxpath+"allianceGetInfo.php"+unsafeWindow.g_ajaxsuffix,{method:"post",parameters:e,onSuccess:function(d){c(d)},onFailure:function(){c({errorMsg:"AJAX error"})}})},fetchPlayerList:function(c,e){var d=unsafeWindow.Object.clone(unsafeWindow.g_ajaxparams);d.searchName=c;d.subType="ALLIANCE_INVITE";new MyAjaxRequest(unsafeWindow.g_ajaxpath+ "searchPlayers.php"+unsafeWindow.g_ajaxsuffix,{method:"post",parameters:d,onSuccess:function(c){e(c)},onFailure:function(){e({errorMsg:"AJAX error"})}})},fetchPlayerInfo:function(c,e){var d=unsafeWindow.Object.clone(unsafeWindow.g_ajaxparams);d.uid=c;new MyAjaxRequest(unsafeWindow.g_ajaxpath+"getUserGeneralInfo.php"+unsafeWindow.g_ajaxsuffix,{method:"post",parameters:d,onSuccess:function(c){e(c)},onFailure:function(){e({errorMsg:"AJAX error"})}})},fetchPlayerStatus:function(c,e){var d=unsafeWindow.Object.clone(unsafeWindow.g_ajaxparams); d.checkArr=c.join(",");new MyAjaxRequest(unsafeWindow.g_ajaxpath+"getOnline.php"+unsafeWindow.g_ajaxsuffix,{method:"post",parameters:d,onSuccess:function(c){e(c)},onFailure:function(){e({errorMsg:"AJAX error"})}})},fetchPlayerGetLastLogin:function(c,e){var d=my.Player;c.onclick="";c.innerHTML="Aran\u0131yor ...";d.fetchPlayerLastLogin(e,function(e){d.gotPlayerLastLogin(e,c)})},fetchPlayerLastLogin:function(c,e){var d=unsafeWindow.Object.clone(unsafeWindow.g_ajaxparams);d.pid=c;new MyAjaxRequest(unsafeWindow.g_ajaxpath+ "viewCourt.php"+unsafeWindow.g_ajaxsuffix,{method:"post",parameters:d,onSuccess:function(c){e(c)},onFailure:function(){e({errorMsg:"AJAX error"})}})},gotPlayerLastLogin:function(c,e){if(c.ok){var d=c.playerInfo.lastLogin;m=d?'<span style="color:black">Last Login: '+d+"</span>":'<span style="color:red">Last Login: '+d+"</span>";e.innerHTML=m+""}else e.innerHTML=c.errorMsg},displayPlayer:function(c,e){var d=Tabs.Player;unsafeWindow.PTalClickSort=function(c){var d=Tabs.Player,e=c.id.substr(8);document.getElementById("clickCol"+ d.sortColNum).className="clickable";c.className="clickable clickableSel";e==d.sortColNum?d.sortDir*=-1:d.sortColNum=e;d.reDisp()};var g='<STYLE>.clickable{background-color:#ddd; border:2px outset; border-color:#555; padding-left:5px; padding-right:5px}.clickableSel{background-color:#AFF;}.xxtab{background-color:none; padding-left:5px; padding-right:5px;} </style><DIV class=ptstat ><TABLE id=tabAllMembers cellpadding=0  width=100%><TR font-weight:bold"><TD class=xtab>Alliance: '+c+"</td><TD class=xtab width=80% align=center>Last login: <SPAN id=lastlogin>"+ e.playerInfo.lastLogin+'</span></td><TD class=xtab align=right></td></tr></table></div><div style="max-height:470px; height:470px; overflow-y:auto;"><TABLE id=tabAllMembers align=center cellpadding=0 cellspacing=0><THEAD style="overflow-y:hidden;"><TR style="font-weight:bold"><TD id=clickCol0 onclick="PTalClickSort(this)" class=clickable><A><DIV>Player</div></a></td><TD id=clickCol1 onclick="PTalClickSort(this)" class=clickable align=center><A><DIV>Power</a></div></td><TD id=clickCol3 onclick="PTalClickSort(this)" class=clickable><A><DIV>Cities</a></div></td><TD id=clickCol2 onclick="PTalClickSort(this)" class=clickable align=center><A><DIV>Order</a></div></td><TD id=clickCol9 onclick="PTalClickSort(this)" class=clickable align=center><A><DIV>ONLINE</a></div></td><TD id=clickCol7 onclick="PTalClickSort(this)" class=clickable><A><DIV>City Name</a></div></td><TD id=clickCol4 onclick="PTalClickSort(this)" class=clickable><A><DIV>Level</a></div></td><TD id=clickCol5 onclick="PTalClickSort(this)" class=clickable><A><DIV>Coordinate</a></div></td><TD id=clickCol8 onclick="PTalClickSort(this)" class=clickable><A><DIV>Distance</a></div></td><TD id=clickCol10 onclick="PTalClickSort(this)" class=clickable><A><DIV>Distance Calc.</a></div></td><TD class=clickable><A><DIV>Last Login</a></div></td></tr></thead><TBODY id=allBody style="background-color:#ffffff;"></tbody></table></div><DIV  width:100%; style="top:670px; left:0px; position:absolute; background-color:#ffffff; border-top:1px solid; margin-top:8px; color:#700; font-weight:bold;">'; document.getElementById("allListOut").innerHTML=g;document.getElementById("altInput").innerHTML="<HR><TABLE width=100% cellpaddding=0><TR align=center><TD class=xtab>Distance Calculation: &nbsp; X: <INPUT size=2 type=text id=plyrX /> Y: <INPUT size=2 type=text id=plyrY /> &nbsp; OR, City Selection: <span id=dmcoords></span></td></tr></table>";document.getElementById("clickCol"+d.sortColNum).className="clickable clickableSel";d.reDisp()},reDisp:function(){var c=Tabs.Player;c.dat.sort(function(c,d){var e= Tabs.Player;return"number"==typeof c[e.sortColNum]?0<e.sortDir?c[e.sortColNum]-d[e.sortColNum]:d[e.sortColNum]-c[e.sortColNum]:"boolean"==typeof c[e.sortColNum]?0:0<e.sortDir?c[e.sortColNum].localeCompare(d[e.sortColNum]):d[e.sortColNum].localeCompare(c[e.sortColNum])});for(var e="",d=0;d<c.dat.length;d++)e+="<TR "+cl+'valign=top><TD><SPAN onclick="PTpl(this, '+u.userId+')"><A style="color:#1D0AF2">'+u.genderAndName+"</a></td><TD align=right>"+addCommasInt(u.might)+"</td><TD>"+(rslt.data[u.userId]? "&nbsp;<SPAN class=boldDarkRed><blink>ONLINE</blink></span>":"")+'</td><div style="width:100%;filter:Glow(color=#F20A15, strength=12)"><TD align=center><A style="color:#1D0AF2" target="_tab" href="http://www.facebook.com/profile.php?id='+u.Fbuid+'">Facebook Profile</a></div></td><TD><SPAN onclick="PTpd(this, '+u.userId+')"><A style="color:#1D0AF2">Detail</a> &nbsp; <BR></span><SPAN onclick="PCplo(this, \''+u.userId+'\')"><A style="color:#1D0AF2">Last Login</a></span></td></tr>';c=document.getElementById("allBody"); c.style.maxHeight="";c.innerHTML=e;470<parseInt(c.clientHeight)&&(c.style.height="470px",c.style.maxHeight="470px")}}; Tabs.Train={tabOrder:5,tabLabel:"Train",cont:null,tabDisabled:!ENABLE_TRAIN,id:{},uu:{u1:"Supply Truck",u5:"Infantry",u6:"Sniper",u4:"Anti-Tank",u18:"Special Forces",u7:"SAM",u8:"Tank",u17:"Predator Drone",u9:"Supply Chopper",u11:"Gunship",u10:"Fighter",u12:"Bomber",u19:"Cargo Plane",u16:"Hell-Fire Tank",u13:"Stealth Bomber",u15:"Nuclear Weapons",u20:"Ion Cannon",u21:"Elite SAM",u24:"Elite Gunship",f53:"Mines",f52:"Stinger Missiles",f54:"Artillery",f55:"Anti-Air Guns",f56:"Railguns",f57:"Laser Turrets"}, trData:unsafeWindow.trainingData,foData:unsafeWindow.fortifyingData,gr:{},trainqueue:[],init:function(c){var e=Tabs.Train;e.cont=c;c=[];c.push('<table class="ptTab ptStat" width="100%">');c.push("<tr>");c.push('<td style="text-align:center;">');c.push("<b>Military Unit and Defense Training Menu</b>");c.push("</td>");c.push("</tr>");c.push("</table>");c.push("<br>");c.push("<b>INFORMATION:</b> GREEN = These units can be built, RED = you do not meet the necessary requirements (building, research, etc.), Blue = You have the reached the maximum levels of defense."); c.push("<br><br>");c.push('<table class="ptTrain" style="border:1px solid silver; border-collapse:collapse;">');c.push("<tr>");c.push('<td style="border-right:1px solid silver;border-left:1px solid silver;">&nbsp;</td>');for(var d=0;d<Cities.cities.length;d++)c.push('<td style="text-align:center;border-right:1px solid silver;">&nbsp;<br><b>'+Cities.cities[d].name+"</b></td>");c.push("</tr>");c.push("<tr>");c.push('<td style="border-right:1px solid silver;border-left:1px solid silver;">&nbsp;</td>'); for(d=0;d<Cities.cities.length;d++)c.push('<td style="text-align:center;border-right:1px solid silver;">'),Options.pbtrain["c"+d]||(Options.pbtrain["c"+d]=0),0==Options.pbtrain["c"+d]?c.push('&nbsp;<input type="submit" id="pttc'+d+'" value=" OFF ">&nbsp;'):c.push('&nbsp;<input type="submit" id="pttc'+d+'" value=" ON ">&nbsp;'),c.push("<br>&nbsp;</td>");c.push("</tr>");for(var g in e.uu){d=e.uu[g];"f53"==g&&c.push('<tr><td  style="border-right:1px solid silver;border-left:1px solid silver;" colspan="'+ (Cities.cities.length+1)+'">&nbsp;</td></tr>');c.push("<tr>");c.push('<td style="border-right:1px solid silver;border-left:1px solid silver;"><b>'+d+":</b>&nbsp;&nbsp;</td>");for(d=0;d<Cities.cities.length;d++)c.push('<td style="text-align:center;border-right:1px solid silver;">'),c.push('&nbsp;<input type="text" id="pttc'+d+g+'" value="" style="width:50px; text-align:center;">&nbsp;'),c.push("</td>");c.push("</tr>")}c.push("</table>");c.push("<hr>");c.push('<table width="100%">');c.push("<tr>"); c.push("<td><b>Department of Defense Monitoring:</b><br><br></td>");c.push('<td style="text-align: right;">');c.push('<input id="ptButClearTRLog" type="submit" name="ClearTRLog" value="CLEAR">');c.push("</td>");c.push("</tr>");c.push("<tr>");c.push('<td colspan="2">');c.push('<div id="pttrainlog" style="height: 120px; overflow: auto;">');c.push("</div>");c.push("</td>");c.push("</tr>");c.push("</table>");e.cont.innerHTML=c.join("");for(d=0;d<Cities.cities.length;d++)e.id["pttc"+d]=document.getElementById("pttc"+ d),e.id["pttc"+d].addEventListener("click",function(){var c=this.id.substr(-1);0==Options.pbtrain["c"+c]?(Options.pbtrain["c"+c]=1,this.value=" ON ",Logbuch.eintrag(Logs.trainlog,"Auto Training ON City: <b>"+Cities.cities[c].name+"</b> ACTIVE")):(Options.pbtrain["c"+c]=0,this.value=" OFF ",Logbuch.eintrag(Logs.trainlog,"Auto Training OFF City: <b>"+Cities.cities[c].name+"</b> PASSIVE"));e.id.pttrainlog.innerHTML=Logbuch.ausgabe(Logs.trainlog);saveOptions()},!1);for(g in e.uu){d=e.uu[g];for(d=0;d< Cities.cities.length;d++)e.id["pttc"+d+g]=document.getElementById("pttc"+d+g),e.changeOpt(e.id["pttc"+d+g],"c"+d+g)}e.id.pttrainlog=document.getElementById("pttrainlog");e.id.pttrainlog.innerHTML=Logbuch.ausgabe(Logs.trainlog);e.id.ptButClearTRLog=document.getElementById("ptButClearTRLog");e.id.ptButClearTRLog.addEventListener("click",e.ClearTRLog,!1);e.greenred();setInterval(e.training,1E4);setInterval(e.gotrain,3E3)},hide:function(){},show:function(){},changeOpt:function(c,e){Options.pbtrain[e]|| (Options.pbtrain[e]=0);c.value=parseInt(Options.pbtrain[e]);c.addEventListener("change",function(){this.value=parseIntNan(this.value);Options.pbtrain[e]=this.value;saveOptions()},!1)},ClearTRLog:function(){var c=Tabs.Train;Logs.trainlog=[];c.id.pttrainlog.innerHTML=Logbuch.ausgabe(Logs.trainlog);saveLogs()},greenred:function(){for(var c=Tabs.Train,e=parseInt(Seed.player.title),d=Cities.cities.length,g=0;g<Cities.cities.length;g++){var f=Cities.cities[g].id,h={},j;for(j in c.uu){var l=!0;if("u"==j.substr(0, 1)){var o=c.trData[j].r[0].r1,q;for(q in o){var v=parseInt(o[q][1]);if(!h[q]){var w=getCityBuilding(f,q.substr(1));h[q]=parseInt(w.maxLevel)}v>h[q]&&(l=!1)}var o=c.trData[j].r.r2,E;for(E in o)v=parseInt(o[E][1]),v>parseInt(Seed.tech["tch"+E.substr(1)])&&(l=!1);c.trData[j].r[0].r11.p2&&(v=c.trData[j].r[0].r11.p2[1],v>e&&(l=!1));c.trData[j].r[0].r11.p3&&(v=c.trData[j].r[0].r11.p3[1],v>d&&(l=!1));if(c.trData[j].r[0].r8.i1401&&(v=c.trData[j].r[0].r8.i1401[1],!Seed.items.i1401||v>Seed.items.i1401))l=!1; if(c.trData[j].r[0].r8.i1402&&(v=c.trData[j].r[0].r8.i1402[1],!Seed.items.i1402||v>Seed.items.i1402))l=!1;if(c.trData[j].r[0].r8.i1403&&(v=c.trData[j].r[0].r8.i1403[1],!Seed.items.i1403||v>Seed.items.i1403))l=!1}else{o=c.foData[j].r[0].r1;for(q in o)v=parseInt(o[q][1]),h[q]||(w=getCityBuilding(f,q.substr(1)),h[q]=parseInt(w.maxLevel)),v>h[q]&&(l=!1);o=c.foData[j].r[0].r2;for(E in o)v=parseInt(o[E][1]),v>parseInt(Seed.tech["tch"+E.substr(1)])&&(l=!1);c.foData[j].r[0].r11.p2&&(v=c.foData[j].r[0].r11.p2[1], v>e&&(l=!1));c.foData[j].r[0].r11.p3&&(v=c.foData[j].r[0].r11.p3[1],v>d&&(l=!1))}!0===l?(c.gr["c"+g+j]=!0,c.id["pttc"+g+j].style.backgroundColor="#ccffcc"):(c.gr["c"+g+j]=!1,c.id["pttc"+g+j].style.backgroundColor="#ffcccc");c.id["pttc"+g+j].style.border="1px solid silver"}v=h.b19;h=unsafeWindow.Constant.Building.DEFENSE.WALL[v];l=unsafeWindow.Constant.Building.DEFENSE.FIELD[v];v=unsafeWindow.Constant.Building.DEFENSE.CITY[v];o=parseInt(Seed.fortifications["city"+f].fort53)+parseInt(Seed.fortifications["city"+ f].fort52);w=parseInt(Seed.fortifications["city"+f].fort54)+parseInt(Seed.fortifications["city"+f].fort55);f=parseInt(Seed.fortifications["city"+f].fort56)+parseInt(Seed.fortifications["city"+f].fort57);h<=o&&(!0===c.gr["c"+g+"f52"]&&(c.gr["c"+g+"f52"]=!1,c.id["pttc"+g+"f52"].style.backgroundColor="#ccccff"),!0===c.gr["c"+g+"f53"]&&(c.gr["c"+g+"f53"]=!1,c.id["pttc"+g+"f53"].style.backgroundColor="#ccccff"));l<=w&&(!0===c.gr["c"+g+"f54"]&&(c.gr["c"+g+"f54"]=!1,c.id["pttc"+g+"f54"].style.backgroundColor= "#ccccff"),!0===c.gr["c"+g+"f55"]&&(c.gr["c"+g+"f55"]=!1,c.id["pttc"+g+"f55"].style.backgroundColor="#ccccff"));v<=f&&(!0===c.gr["c"+g+"f56"]&&(c.gr["c"+g+"f56"]=!1,c.id["pttc"+g+"f56"].style.backgroundColor="#ccccff"),!0===c.gr["c"+g+"f57"]&&(c.gr["c"+g+"f57"]=!1,c.id["pttc"+g+"f57"].style.backgroundColor="#ccccff"))}},training:function(){var c=Tabs.Train;c.greenred();for(var e=unixTime(),d=0;d<Cities.cities.length;d++)if(0!=Options.pbtrain["c"+d]){var g=!1,f=Seed.training_queue["c"+Cities.cities[d].id]; for(qs in f)if(qe=f[qs],0!=parseInt(qe.status)&&parseInt(qe.eta)>e){g=!0;break}var h=!1,f=Seed.fortify_queue["c"+Cities.cities[d].id];for(qs in f)if(qe=f[qs],0!=parseInt(qe.status)&&parseInt(qe.eta)>e){h=!0;break}for(var j in c.uu)!1!==c.gr["c"+d+j]&&(f=Options.pbtrain["c"+d+j],0!=f&&("u"==j.substr(0,1)?!1===g&&c.trainqueue.push({cid:Cities.cities[d].id,type:j,quant:f,start:e}):!1===h&&c.trainqueue.push({cid:Cities.cities[d].id,type:j,quant:f,start:e})))}},gotrain:function(){var c=Tabs.Train,e=unixTime(); if(0<c.trainqueue.length){var d=c.trainqueue.shift();if(!(d.now+60<e)){var g=d.type.substr(0,1);if("u"==g){var f=c.trData[d.type].c,h=parseInt(Seed.resources["city"+d.cid].rec1[0]/3600);if(h<f[1]*d.quant+1E6)return;h=parseInt(Seed.resources["city"+d.cid].rec2[0]/3600);if(h<f[2]*d.quant+1E6)return;h=parseInt(Seed.resources["city"+d.cid].rec3[0]/3600);if(h<f[3]*d.quant+1E6)return;h=parseInt(Seed.resources["city"+d.cid].rec4[0]/3600);if(h<f[4]*d.quant+1E6)return;h=parseInt(Seed.resources["city"+d.cid].rec5[0]/ 3600);if(h<f[5]*d.quant)return;h=parseInt(Seed.resources["city"+d.cid].rec6[0]/3600);if(h<f[6]*d.quant)return;h=parseInt(Seed.resources["city"+d.cid].rec7[0]/3600);if(h<f[7]*d.quant)return;h=parseInt(Seed.resources["city"+d.cid].rec8[0]/3600);if(h<f[8]*d.quant)return;var h=parseInt(Seed.citystats["city"+d.cid].pop[0]),j=parseInt(Seed.citystats["city"+d.cid].pop[3]);if(h-j<f[9]*d.quant)return}else{f=c.foData[d.type].c;h=parseInt(Seed.resources["city"+d.cid].rec1[0]/3600);if(h<f[1]*d.quant+1E6)return; h=parseInt(Seed.resources["city"+d.cid].rec2[0]/3600);if(h<f[2]*d.quant+1E6)return;h=parseInt(Seed.resources["city"+d.cid].rec3[0]/3600);if(h<f[3]*d.quant+1E6)return;h=parseInt(Seed.resources["city"+d.cid].rec4[0]/3600);if(h<f[4]*d.quant+1E6)return;h=parseInt(Seed.resources["city"+d.cid].rec5[0]/3600);if(h<f[5]*d.quant)return;h=parseInt(Seed.resources["city"+d.cid].rec6[0]/3600);if(h<f[6]*d.quant)return;h=parseInt(Seed.resources["city"+d.cid].rec7[0]/3600);if(h<f[7]*d.quant)return;h=parseInt(Seed.resources["city"+ d.cid].rec8[0]/3600);if(h<f[8]*d.quant)return}if("u"==g){var j=0,f=Seed.training_queue["c"+d.cid],l;for(l in f)if(h=f[l],0==parseInt(h.status)&&parseInt(h.eta)<=e){j=h.id;break}if(0==j)return;d.tid=j}else{j=0;f=Seed.fortify_queue["c"+d.cid];for(l in f)if(h=f[l],0==parseInt(h.status)&&parseInt(h.eta)<=e){j=h.id;break}if(0==j)return;d.fid=j}var o=unsafeWindow.Object.clone(unsafeWindow.g_ajaxparams);o.cid=d.cid;o.type=d.type.substr(1);o.quant=d.quant;o.items=0;"u"==g?(o.tid=d.tid,e="train.php"):(o.fid= d.fid,e="fortify.php");new MyAjaxRequest(unsafeWindow.g_ajaxpath+e+unsafeWindow.g_ajaxsuffix,{method:"post",parameters:o,onSuccess:function(d){if(d.ok)if("u"==g){var e=Seed.training_queue["c"+o.cid]["t"+o.tid];e.eta=parseInt(d.initTS,10)+parseInt(d.timeNeeded,10);e.needed=d.ticksNeeded;e.progress=0;e.quant=o.quant;e.status=d.status;e.ticker=d.initTS;e.type=o.type;Logbuch.eintrag(Logs.trainlog,"Trained Unit <b>"+Cities.byID[o.cid].name+"</b> Began (<b>"+addCommas(o.quant)+" "+c.uu["u"+o.type]+", "+ timestr(parseInt(d.timeNeeded,10))+"</b>)")}else e=Seed.fortify_queue["c"+o.cid]["f"+o.fid],e.eta=parseInt(d.initTS,10)+parseInt(d.timeNeeded,10),e.needed=d.ticksNeeded,e.progress=0,e.quant=o.quant,e.status=d.status,e.ticker=d.initTS,e.type=o.type,Logbuch.eintrag(Logs.trainlog,"Produced Defense Unit <b>"+Cities.byID[o.cid].name+"</b> Began (<b>"+addCommas(o.quant)+" "+c.uu["f"+o.type]+", "+timestr(parseInt(d.timeNeeded,10))+"</b>)");else d='<span class="boldRed">'+unsafeWindow.printLocalError(d.error_code|| null,d.msg||null,d.feedback||null)+"</span>","u"==g?Logbuch.eintrag(Logs.trainlog,"Training Error: <b>"+Cities.byID[o.cid].name+"</b> (<b>"+addCommas(o.quant)+" "+c.uu["f"+o.type]+"</b>)<br>"+d):Logbuch.eintrag(Logs.trainlog,"Produced Defense Unit Error: <b>"+Cities.byID[o.cid].name+"</b> (<b>"+addCommas(o.quant)+" "+c.uu["f"+o.type]+"</b>)<br>"+d);c.id.pttrainlog.innerHTML=Logbuch.ausgabe(Logs.trainlog)},onFailure:function(){alert("Error Occurred.!")}})}}}}; Tabs.Options={tabOrder:10,tabLabel:"Options",cont:null,displayTimer:null,tabDisabled:!ENABLE_OPTIONS,init:function(c){var e=Tabs.Options;e.cont=c;e.cont.innerHTML='<table class="ptTab ptStat" width="100%"><tr><td style="text-align:center;"><b>SETTINGS:</b></td></tr></table><br><table class="ptTab"><tr><table class="ptTab ptStat" width="100%"><tr><td style="text-align:center;"></td><td><a target=_blank href="http://www.facebook.com/l.php?u=http%3A%2F%2Fapps.facebook.com%2Fglobalwarfaregame%2F%3Fpage%3DclaimStuff%26s%3D28%26step%3D2%26lang%253EN%26lp%3D12&h=qAQD4NfQv"><b><u>CLICK HERE FOR THE RIGHT TO THIRD DAY COIN..!!</u></b></a></td></tr></table><br><table class="ptTab"></tr><tr><td><input id="ptAllowWinMove" type="checkbox" /></td><td>Menu is checked, you can move ..</td></tr><tr><td><input id="ptahelpenable" type="checkbox" /></td><td>Automatically wishes Construction and Research Publications ..</td></tr><tr><td><input id="ptahelphide" type="checkbox" /></td><td>Hides and Helps Automated Help Requests Posted To Alliance ..</td></tr><tr><td><input id="ptrmmotdEnable" type="checkbox" /></td><td>City Event and Promotional Posts hides your icons appearing below ..</td></tr><tr><td><input id="pticonsEnable" type="checkbox" /></td><td>Hides events and other icons on the left side ..</td></tr>        <tr><td><input id="ptsoundoff" type="checkbox" /></td><td>The music is automatically stopped..(Currently not used)</td></tr><tr><td><input id="ptgoldenable" type="checkbox" /></td><td>Auto Gold Collect.. <input id="ptgoldLimit" type="text" size="2" maxlength="3" style="text-align: center;" > % </td></tr><tr><td><input id="ptoilenable" type="checkbox" /></td><td>Auto Oil Collect..</td></tr><tr><td><input id="ptfoodenable" type="checkbox" /></td><td>Auto Food Collect</td></tr><tr><td><input id="ptnukeenable" type="checkbox" /></td><td>Auto WarHead Collect</td></tr><tr><td><input id="ptlauncherenable" type="checkbox" /></td><td>Auto Launch Vehicle Collect</td></tr><tr><td><input id="ptradarenable" type="checkbox" /></td><td>Auto Targeting Radar Crate Collect</td></tr><tr><td><input id="ptdailyenable" type="checkbox" /></td><td>Auto Collect Daily Bonus.</td></tr><tr><td><input id="ptgiftenable" type="checkbox" /></td><td>Auto Accept Gifts..</td></tr><tr><td><input id="ptitemuse" type="checkbox" /></td><td>To use automated inventory Located Production Enhancer Elements..<br>NOT: Items collected will be transferred to the main your city..(40.000 equipment which is based.)</td></tr><tr><td><input id="ptfoodtoggle" type="checkbox" /></td><td>Food Alert..! (10 Minutes to Check Automatically..)</td></tr><tr><td><input id="pbChatREnable" type="checkbox" /></td><td>WideScreen.. Keep off on Google Plus</td></tr><tr><td><input id="pbEveryEnable" type="checkbox" /></td><td>Page Refresh uses FaceBook link keep off on Google Plus</td><td>Page Refresh: <input id="pbeverymins" type="text" size="2" maxlength="3" style="text-align:center;"> minutes..</td></tr><tr><table class="ptTab ptStat" width="100%"><tr><td style="text-align:center;"></td><td style="text-align:center;"></td><td><a target=_blank href="http://www.userscripts.org/scripts/source/117903.user.js"><b><u>GW LT ASYLUMSERVE CLICK HERE FOR SCRIPT UPDATES ..!!</b></a></u></td></tr></table><br><table class="ptTab"></tr><td colspan="2">&nbsp;</td></tr><tr><td colspan="2" style="text-align:right;"><input id="ptButDebug" type="submit" name="SEED" value="DEBUG"></td></tr></table><hr><table width="100%"><tr><td><b>GW LT ASYLUMSERVE Monitoring Menu:</b><br><br></td><td style="text-align: right;"><input id="ptButClearGLog" type="submit" name="ClearELog" value="CLEAR"></td></tr><tr><td colspan="2"><div id="ptoptlog" style="height: 250px; overflow: auto;"></div></td></tr></table>'; e.togOpt("ptAllowWinMove","ptWinDrag",mainPop.setEnableDrag);e.togOpt("ptahelpenable","pbahelpenable");e.togOpt("ptahelphide","pbahelphide");e.togOpt("ptrmmotdEnable","pbrmmotdEnable",e.onoffMotd);e.togOpt("pticonsEnable","pbiconsEnable",e.onoffIcons);e.togOpt("ptsoundoff","ptsoundoff",e.sound);e.togOpt("ptgoldenable","pbgoldenable");e.changeOpt("ptgoldLimit","pbGoldLimit");e.togOpt("ptoilenable","pboilenable");e.togOpt("ptfoodenable","pbfoodenable");e.togOpt("ptnukeenable","pbnukeenable");e.togOpt("ptlauncherenable", "pblauncherenable");e.togOpt("ptradarenable","pbradarenable");e.togOpt("ptdailyenable","pbdailyenable");e.togOpt("ptgiftenable","pbgiftenable");e.togOpt("ptitemuse","pbitemuse");e.togOpt("ptfoodtoggle","pbFoodAlert");e.togOpt("pbChatREnable","pbChatOnRight");e.changeOpt("pbeverymins","pbEveryMins",RefreshEvery.setTimer);e.togOpt("pbEveryEnable","pbEveryEnable",RefreshEvery.setEnable);document.getElementById("ptButClearGLog").addEventListener("click",function(){e.ClearGLog()},!1);document.getElementById("ptButDebug").addEventListener("click", function(){debugWin.doit()},!1);e.show()},hide:function(){},show:function(){var c=Tabs.Options;clearTimeout(c.displayTimer);document.getElementById("ptoptlog").innerHTML=Logbuch.ausgabe(Logs.globallog);c.displayTimer=setTimeout(c.show,1E4)},togOpt:function(c,e,d){c=document.getElementById(c);Options[e]&&(c.checked=!0);c.addEventListener("change",function(){Options[e]=this.checked;saveOptions();d&&d(this.checked)},!1)},changeOpt:function(c,e,d){c=document.getElementById(c);c.value=Options[e];c.addEventListener("change", function(){Options[e]=this.value;saveOptions();d&&d(this.value)},!1)},sound:function(){if(Options.ptsoundoff)try{unsafeWindow.bgMusic.setVolume(0);var c=document.getElementById("btn-sound-toggle");c.setAttribute("class","off")}catch(e){}else try{unsafeWindow.bgMusic.setVolume(100),c=document.getElementById("btn-sound-toggle"),c.setAttribute("class","")}catch(d){}},onoffMotd:function(){Options.pbrmmotdEnable?document.getElementById("motd-widget").style.display="none":document.getElementById("motd-widget").style.display= "block"},onoffIcons:function(){Options.pbiconsEnable?document.getElementById("gw-notification").style.display="none":document.getElementById("gw-notification").style.display="block"},ClearGLog:function(){Logs.globallog=[];saveLogs();clearTimeout(Tabs.Options.displayTimer);Tabs.Options.show()}}; Tabs.F={tabLabel:"Fake",tabOrder:11,tabDisabled:!ENABLE_FAKE_TAB,cont:null,init:function(c){var e=Tabs.F;e.cont=c;for(var c='<select id="ptfakecity">',d=0;d<Cities.numCities;d++)aCity=Cities.cities[d].name+" ("+Cities.cities[d].x+","+Cities.cities[d].y+")",c+='<option value="'+d+'">'+aCity+"</option>";c+="</select>";d=[];d.push('<table class="ptTab ptStat" width="100%">');d.push("<tr>");d.push('<td style="text-align:center;">');d.push("<b>FALSE ATTACK MENU</b>");d.push("</td>");d.push("</tr>");d.push("</table>"); d.push("<br>");d.push("Version: GW LT ASYLUMSERVE ");d.push("<br>");d.push("<br>");d.push('<table class="ptTab">');d.push("<tr>");d.push("<td><b>Type of attack:</b></td>");d.push("<td>");d.push(htmlSelector({1:"false Attack",2:"Land Attack Fake"},"",'id="ptfaketype"'));d.push("</td>");d.push("</tr>");d.push("<tr>");d.push("<td><b>City:</b></td>");d.push("<td>");d.push(c);d.push("</td>");d.push("</tr>");d.push("<tr>");d.push("<td><b>Schedule:</b></td>");d.push("<td>");d.push('<input type="text" id="ptfakeseconds" value="300" size="4"> Level'); d.push("</td>");d.push("</tr>");d.push("<tr>");d.push("<td><b>Attacking Fake Name:</b></td>");d.push("<td>");d.push('<input type="text" id="ptfakename" value="General Name" size="13">');d.push("</td>");d.push("</tr>");d.push("<tr>");d.push("<td><b>Alliance Fake Name:</b>&nbsp;&nbsp;</td>");d.push("<td>");d.push('<input type="text" id="ptfakealliance" value="Alliance Name" size="13">');d.push("</td>");d.push("</tr>");d.push("</table>");d.push("<br>");d.push('<table class="ptTab">');d.push("<tr>"); d.push('<td colspan="8"><b><u>Units:</u></b><br>&nbsp;</td>');d.push("</tr>");d.push("<tr>");d.push("<td><b>Supply Truck:</b>&nbsp;</td>");d.push('<td>&nbsp;<input id="ptfakeu1" value="0" type="text" size="5" maxlength="6" style="text-align: center;">&nbsp;</td>');d.push('<td width="50">&nbsp;</td>');d.push("<td><b>Infantry:</b>&nbsp;</td>");d.push('<td>&nbsp;<input id="ptfakeu5" value="0" type="text" size="5" maxlength="6" style="text-align: center;">&nbsp;</td>');d.push('<td width="50">&nbsp;</td>'); d.push("<td><b>Sniper:</b>&nbsp;</td>");d.push('<td>&nbsp;<input id="ptfakeu6" value="0" type="text" size="5" maxlength="6" style="text-align: center;">&nbsp;</td>');d.push("</tr>");d.push("<tr>");d.push("<td><b>Anti-Tank:</b>&nbsp;</td>");d.push('<td>&nbsp;<input id="ptfakeu4" value="0" type="text" size="5" maxlength="6" style="text-align: center;">&nbsp;</td>');d.push('<td width="50">&nbsp;</td>');d.push("<td><b>Special Forces:</b>&nbsp;</td>");d.push('<td>&nbsp;<input id="ptfakeu18" value="0" type="text" size="5" maxlength="6" style="text-align: center;">&nbsp;</td>'); d.push('<td width="50">&nbsp;</td>');d.push("<td><b>SAM:</b>&nbsp;</td>");d.push('<td>&nbsp;<input id="ptfakeu7" value="0" type="text" size="5" maxlength="6" style="text-align: center;">&nbsp;</td>');d.push("</tr>");d.push("<tr>");d.push("<td><b>Tank:</b>&nbsp;</td>");d.push('<td>&nbsp;<input id="ptfakeu8" value="0" type="text" size="5" maxlength="6" style="text-align: center;">&nbsp;</td>');d.push('<td width="50">&nbsp;</td>');d.push("<td><b>Hell-Fire Tank:</b>&nbsp;</td>");d.push('<td>&nbsp;<input id="ptfakeu16" value="0" type="text" size="5" maxlength="6" style="text-align: center;">&nbsp;</td>'); d.push('<td width="50">&nbsp;</td>');d.push("<td><b>Predator Drone:</b>&nbsp;</td>");d.push('<td>&nbsp;<input id="ptfakeu17" value="0" type="text" size="5" maxlength="6" style="text-align: center;">&nbsp;</td>');d.push("</tr>");d.push("<tr>");d.push("<td><b>Supply Chopper:</b>&nbsp;</td>");d.push('<td>&nbsp;<input id="ptfakeu9" value="0" type="text" size="5" maxlength="6" style="text-align: center;">&nbsp;</td>');d.push('<td width="50">&nbsp;</td>');d.push("<td><b>Elite Gunship:</b>&nbsp;</td>"); d.push('<td>&nbsp;<input id="ptfakeu11" value="0" type="text" size="5" maxlength="6" style="text-align: center;">&nbsp;</td>');d.push('<td width="50">&nbsp;</td>');d.push("<td><b>Fighter:</b>&nbsp;</td>");d.push('<td>&nbsp;<input id="ptfakeu10" value="0" type="text" size="5" maxlength="6" style="text-align: center;">&nbsp;</td>');d.push("</tr>");d.push("<tr>");d.push("<td><b>Bomber:</b>&nbsp;</td>");d.push('<td>&nbsp;<input id="ptfakeu12" value="0" type="text" size="5" maxlength="6" style="text-align: center;">&nbsp;</td>'); d.push('<td width="50">&nbsp;</td>');d.push("<td><b>Stealth Bomber:</b>&nbsp;</td>");d.push('<td>&nbsp;<input id="ptfakeu13" value="0" type="text" size="5" maxlength="6" style="text-align: center;">&nbsp;</td>');d.push('<td width="50">&nbsp;</td>');d.push("<td><b>Cargo Plane:</b>&nbsp;</td>");d.push('<td>&nbsp;<input id="ptfakeu19" value="0" type="text" size="5" maxlength="6" style="text-align: center;">&nbsp;</td>');d.push("</tr>");d.push("<tr>");d.push("<td><b>Nuclear Weapons:</b>&nbsp;</td>"); d.push('<td>&nbsp;<input id="ptfakeu15" value="0" type="text" size="5" maxlength="6" style="text-align: center;">&nbsp;</td>');d.push('<td width="50">&nbsp;</td>');d.push("<td><b>Orb.\u0130yon Topu:</b>&nbsp;</td>");d.push('<td>&nbsp;<input id="ptfakeu20" value="0" type="text" size="5" maxlength="6" style="text-align: center;">&nbsp;</td>');d.push('<td width="50">&nbsp;</td>');d.push("<td><b>Elite SAM:</b>&nbsp;</td>");d.push('<td>&nbsp;<input id="ptfakeu21" value="0" type="text" size="5" maxlength="6" style="text-align: center;">&nbsp;</td>'); d.push('<td width="50">&nbsp;</td>');d.push("<td><b>Elite Gunship:</b>&nbsp;</td>");d.push('<td>&nbsp;<input id="ptfakeu24" value="0" type="text" size="5" maxlength="6" style="text-align: center;">&nbsp;</td>');d.push('<td width="50">&nbsp;</td>');d.push("<td>&nbsp;</td>");d.push("<td>&nbsp;</td>");d.push("</tr>");d.push("</table>");d.push("<br>");d.push('<input type="submit" id="ptfakestart" value="START">&nbsp;&nbsp;');d.push('<input type="submit" id="ptfakestop" value="STOP">');d.push("<br>"); d.push("<br>");e.cont.innerHTML=d.join("");document.getElementById("ptfakestart").addEventListener("click",e.clickFakeAttack,!1);document.getElementById("ptfakestop").addEventListener("click",e.clickFakeStop,!1)},clickFakeStop:function(){for(m in Seed.queue_atkinc)Seed.queue_atkinc[m].fake&&(Seed.queue_atkinc[m]={},delete Seed.queue_atkinc[m]);Tabs.tower.stopSoundAlerts()},hide:function(){},show:function(){},createFakeAttack:function(c,e,d,g,f,h){var j="m"+(88888+Math.floor(11111*Math.random())), l={fake:1};"array"==matTypeof(Seed.queue_atkinc)&&(Seed.queue_atkinc={});l.marchType=4;l.toCityId=Cities.cities[e].id;2==c?(keys=unsafeWindow.Object.keys(Seed.wilderness["city"+Cities.cities[e].id]),l.toTileId=Seed.wilderness["city"+Cities.cities[e].id][keys[0]].tileId):l.toTileId=Cities.cities[e].tileId;d=parseInt(d);l.arrivalTime=unixTime()+d;l.departureTime=unixTime()-10;l.unts={};for(c=1;25>c;c++)2==c||3==c||14==c||22==c||23==c||0<h[c]&&(l.unts["u"+c]=h[c]);h=15E6+Math.floor(11111111*Math.random()); c=1E5+Math.floor(1E5*Math.random());l.pid=h;l.score=9;l.mid=j.substr(1);l.players={};l.players["u"+h]={};l.players["u"+h].n=g;l.players["u"+h].t=100;l.players["u"+h].m=12345678;l.players["u"+h].s="M";l.players["u"+h].w=1;l.players["u"+h].a=c;l.players["u"+h].i=5;Seed.queue_atkinc[j]=l;Seed.players["u"+h]=l.players["u"+h];Seed.allianceNames["a"+c]=f},clickFakeAttack:function(){var c=Tabs.F,e=document.getElementById("ptfaketype").value,d=document.getElementById("ptfakecity").value,g=parseInt(document.getElementById("ptfakeseconds").value), f=document.getElementById("ptfakename").value,h=document.getElementById("ptfakealliance").value,j=[];j[1]=parseInt(document.getElementById("ptfakeu1").value);j[4]=parseInt(document.getElementById("ptfakeu4").value);j[5]=parseInt(document.getElementById("ptfakeu5").value);j[6]=parseInt(document.getElementById("ptfakeu6").value);j[7]=parseInt(document.getElementById("ptfakeu7").value);j[8]=parseInt(document.getElementById("ptfakeu8").value);j[9]=parseInt(document.getElementById("ptfakeu9").value);j[10]= parseInt(document.getElementById("ptfakeu10").value);j[11]=parseInt(document.getElementById("ptfakeu11").value);j[12]=parseInt(document.getElementById("ptfakeu12").value);j[13]=parseInt(document.getElementById("ptfakeu13").value);j[15]=parseInt(document.getElementById("ptfakeu15").value);j[16]=parseInt(document.getElementById("ptfakeu16").value);j[17]=parseInt(document.getElementById("ptfakeu17").value);j[18]=parseInt(document.getElementById("ptfakeu18").value);j[19]=parseInt(document.getElementById("ptfakeu19").value); j[20]=parseInt(document.getElementById("ptfakeu20").value);j[21]=parseInt(document.getElementById("ptfakeu21").value);j[24]=parseInt(document.getElementById("ptfakeu24").value);(1==e||2==e)&&c.createFakeAttack(e,d,g,f,h,j)}}; var AutoEvents={timer:null,colCityName:null,colCityNumber:0,init:function(){var c=AutoEvents;clearTimeout(c.timer);c.tick()},tick:function(){var c=AutoEvents;clearTimeout(c.timer);for(var e=unixTime(),d=0;d<Cities.numCities;d++){var g=Cities.cities[d];if(c.kasino(g.id)&&Options.pbgoldenable&&Options.pblastgoldcollect[d]<e-300){var f=Seed.coliseumEvents["city"+g.id]["1"].finish-e;if(Seed.citystats["city"+g.id].pop[2]>=Options.pbGoldLimit&&0>=f){c.colCityName=g.name;c.ajaxCollectGold(g,c.e_ajaxDoneGold); break}}if(Options.pboilenable&&Options.pblastoilcollect<e-300&&(f=Seed.petroleumLabEvents["city"+g.id]["1"].finish,0<f&&(f-=e,0>=f))){c.colCityName=g.name;c.ajaxCollectOil(g,c.e_ajaxDoneOil);break}if(Options.pbfoodenable&&Options.pblastfoodcollect<e-300&&(f=Seed.greenhouseEvents["city"+g.id]["1"].finish,0<f&&(f-=e,0>=f))){c.colCityName=g.name;c.ajaxCollectFood(g,c.e_ajaxDoneFood);break}if(Options.pbnukeenable&&Options.pblastnukecollect<e-300&&(f=Seed.warheadFactoryEvents["city"+g.id]["1"].finish, 0<f&&(f-=e,0>=f))){c.colCityName=g.name;c.ajaxCollectNuke(g,c.e_ajaxDoneNuke);break}if(Options.pblauncherenable&&Options.pblastlaunchercollect<e-300&&(f=Seed.missionControlEvents["city"+g.id]["1"].finish,0<f&&(f-=e,0>=f))){c.colCityName=g.name;c.ajaxCollectLauncher(g,c.e_ajaxDoneLauncher);break}if(Options.pbradarenable&&Options.pblastradarcollect<e-300&&(f=Seed.radarStationEvents["city"+g.id]["1"].finish,0<f&&(f-=e,0>=f))){c.colCityName=g.name;c.ajaxCollectRadar(g,c.e_ajaxDoneRadar);break}if(Options.pbdailyenable&& Options.pblastdailycollect<e-300&&!0===Seed.dailyResourceRewardStatus&&0==d){c.colCityName=g.name;c.ajaxCollectDaily(g,c.e_ajaxDoneDaily);break}}c.timer=setTimeout(c.tick,1E4)},e_ajaxDoneGold:function(c){var e=AutoEvents;c.ok?c=addCommas(c.gained.gold)+" Gold Quantity Collected "+e.colCityName:(c=unsafeWindow.printLocalError(c.error_code||null,c.msg||null,c.feedback||null),c="ERROR! Collecting Gold! "+e.colCityName+'<br><span class="boldRed">'+c+"</span>");Options.pblastgoldcollect[e.colCityNumber]= unixTime();Logbuch.eintrag(Logs.globallog,c)},ajaxCollectGold:function(c,e){var d=unsafeWindow.Object.clone(unsafeWindow.g_ajaxparams);d.cid=c.id;d.eventid=1;new MyAjaxRequest(unsafeWindow.g_ajaxpath+"coliseumEvent.php"+unsafeWindow.g_ajaxsuffix,{method:"post",parameters:d,onSuccess:function(c){e&&e(c)},onFailure:function(c){e&&e(c)}})},e_ajaxDoneOil:function(c){var e=AutoEvents;c.ok?e=addCommas(c.gained.resource2)+" Oil Quantity Collected "+e.colCityName:(c=unsafeWindow.printLocalError(c.error_code|| null,c.msg||null,c.feedback||null),e="ERROR Collecting Oil!: "+e.colCityName+'<br><span class="boldRed">'+c+"</span>");Options.pblastoilcollect=unixTime();Logbuch.eintrag(Logs.globallog,e)},ajaxCollectOil:function(c,e){var d=unsafeWindow.Object.clone(unsafeWindow.g_ajaxparams);d.cid=c.id;d.eventid=1;new MyAjaxRequest(unsafeWindow.g_ajaxpath+"petroleumLabEvent.php"+unsafeWindow.g_ajaxsuffix,{method:"post",parameters:d,onSuccess:function(c){e&&e(c)},onFailure:function(c){e&&e(c)}})},e_ajaxDoneFood:function(c){var e= AutoEvents;c.ok?e=addCommas(c.gained.resource1)+" Food Quantity Collected "+e.colCityName:(c=unsafeWindow.printLocalError(c.error_code||null,c.msg||null,c.feedback||null),e="ERROR Collecting Food!: "+e.colCityName+'<br><span class="boldRed">'+c+"</span>");Options.pblastfoodcollect=unixTime();Logbuch.eintrag(Logs.globallog,e)},ajaxCollectFood:function(c,e){var d=unsafeWindow.Object.clone(unsafeWindow.g_ajaxparams);d.cid=c.id;d.eventid=1;new MyAjaxRequest(unsafeWindow.g_ajaxpath+"greenhouseEvent.php"+ unsafeWindow.g_ajaxsuffix,{method:"post",parameters:d,onSuccess:function(c){e&&e(c)},onFailure:function(c){e&&e(c)}})},e_ajaxDoneNuke:function(c){var e=AutoEvents;c.ok?e="Collected nuclear warheads. "+e.colCityName:(c=unsafeWindow.printLocalError(c.error_code||null,c.msg||null,c.feedback||null),e="ERROR! Collecting a nuclear warhead. "+e.colCityName+'<br><span class="boldRed">'+c+"</span>");Options.pblastnukecollect=unixTime();Logbuch.eintrag(Logs.globallog,e)},ajaxCollectNuke:function(c,e){var d= unsafeWindow.Object.clone(unsafeWindow.g_ajaxparams);d.cid=c.id;d.eventid=1;new MyAjaxRequest(unsafeWindow.g_ajaxpath+"warheadFactoryEvent.php"+unsafeWindow.g_ajaxsuffix,{method:"post",parameters:d,onSuccess:function(c){e&&e(c)},onFailure:function(c){e&&e(c)}})},e_ajaxDoneLauncher:function(c){var e=AutoEvents;c.ok?e="Launch Vehicle Mission Control Building were mounted "+e.colCityName:(c=unsafeWindow.printLocalError(c.error_code||null,c.msg||null,c.feedback||null),e="ERROR! Launch Vehicle could not be installed. "+ e.colCityName+'<br><span class="boldRed">'+c+"</span>");Options.pblastlaunchercollect=unixTime();Logbuch.eintrag(Logs.globallog,e)},ajaxCollectLauncher:function(c,e){var d=unsafeWindow.Object.clone(unsafeWindow.g_ajaxparams);d.cid=c.id;d.eventid=1;new MyAjaxRequest(unsafeWindow.g_ajaxpath+"missionControlEvent.php"+unsafeWindow.g_ajaxsuffix,{method:"post",parameters:d,onSuccess:function(c){e&&e(c)},onFailure:function(c){e&&e(c)}})},e_ajaxDoneRadar:function(c){var e=AutoEvents;c.ok?e="Targeting Radar Crate Generation Radar Station Building Completed.. "+ e.colCityName:(c=unsafeWindow.printLocalError(c.error_code||null,c.msg||null,c.feedback||null),e="ERROR! Radar Targeting to generate..! "+e.colCityName+'<br><span class="boldRed">'+c+"</span>");Options.pblastradarcollect=unixTime();Logbuch.eintrag(Logs.globallog,e)},ajaxCollectRadar:function(c,e){var d=unsafeWindow.Object.clone(unsafeWindow.g_ajaxparams);d.cid=c.id;d.eventid=1;new MyAjaxRequest(unsafeWindow.g_ajaxpath+"radarStationEvent.php"+unsafeWindow.g_ajaxsuffix,{method:"post",parameters:d,onSuccess:function(c){e&& e(c)},onFailure:function(c){e&&e(c)}})},e_ajaxDoneDaily:function(c){var e=AutoEvents;c.ok?e="Collected Daily Bonus ...  "+e.colCityName:(c=unsafeWindow.printLocalError(c.error_code||null,c.msg||null,c.feedback||null),e="ERROR: Collecting Daily Bonus ..!! "+e.colCityName+'<br><span class="boldRed">'+c+"</span>");Seed.dailyResourceRewardStatus=!1;Options.pblastdailycollect=unixTime();Logbuch.eintrag(Logs.globallog,e)},ajaxCollectDaily:function(c,e){var d=unsafeWindow.Object.clone(unsafeWindow.g_ajaxparams); d.cid=c.id;new MyAjaxRequest(unsafeWindow.g_ajaxpath+"claimDailyReward.php"+unsafeWindow.g_ajaxsuffix,{method:"post",parameters:d,onSuccess:function(c){e&&e(c)},onFailure:function(c){e&&e(c)}})},kasino:function(c){var e=!1,c=Seed.buildings["city"+c],d;for(d in c)b=c[d],6==parseInt(b[0])&&(e=!0);return e}},Logbuch={max:100,eintrag:function(c,e){var d='<tr><td class="nobr">'+(new Date).toLocaleTimeString()+" Schedule&nbsp;-&nbsp;</td><td>"+e+"</td></tr>";for(c.push(d);c.length>Logbuch.max;)c.shift(); saveLogs()},ausgabe:function(c){var e="";0<c.length?(c=c.slice(),c.reverse(),e+="<table>"+c.join("")+"</table>"):e+="<table><tr><td>Monitor cleared ....</td></tr></table>";return e}},ChatOnRight={init:function(){t=ChatOnRight;if(Options.pbChatOnRight){var c=document.getElementById("kocmain_bottom").childNodes[5],e=document.getElementById("kocmain").childNodes[16];(!c||"mod_comm"!=c.className)&&setTimeout(function(){t.init()},1E3);c.style.top="-548px";c.style.left="760px";c.style.height="700px";c.style.width= "350px";c.style.background='url("'+CHAT_BG_IMAGE+'")';e.style.top="55px";e.style.left="760px";e.style.height="550px";e.style.width="315px";document.getElementById("mod_comm_list1").style.height="3000px";document.getElementById("mod_comm_list2").style.height="3000px"}}},FoodAlerts={init:function(){FoodAlerts.e_eachMinute()},minuteTimer:null,e_eachMinute:function(){var c=FoodAlerts;unixTime();row=[];for(i=0;i<Cities.numCities;i++){var e=getResourceProduction(Cities.cities[i].id),d=parseInt(parseInt(Seed.resources["city"+ Cities.cities[i].id].rec1[0])/3600),g=e[1]-parseInt(Seed.resources["city"+Cities.cities[i].id].rec1[3]);row[i]=e[1]-g;var e=3600*(parseInt(Seed.resources["city"+Cities.cities[i].id].rec1[0])/3600/(0-g)),f="";0>g&&Options.pbFoodAlert&&14400>e&&(f+="This is my city "+Cities.cities[i].name+" ("+Cities.cities[i].x+","+Cities.cities[i].y+")",f+=" Eating at Critical Level.. CAUTION..!! Send me URGENT Food..!! "+addCommas(d)+"Quantity eating there and drain remaining time: "+timestrShort(e)+"Hourly Go Food: "+ addCommas(g)+".",sendChat("/a "+f),Logbuch.eintrag(Logs.globallog,f))}c.minuteTimer=setTimeout(c.e_eachMinute,6E5)}};function sendChat(c){document.getElementById("mod_comm_input").value=c;unsafeWindow.Chat.sendChat()} var Gifts={user_gifts:[],gTimer:null,init:function(){setInterval(Gifts.checkGifts,6E5)},checkGifts:function(){if(Options.pbgiftenable){var c=Gifts,e=unsafeWindow.Object.clone(unsafeWindow.g_ajaxparams);new MyAjaxRequest(unsafeWindow.g_ajaxpath+"getRequests.php"+unsafeWindow.g_ajaxsuffix,{method:"post",parameters:e,onSuccess:function(d){if(d.ok){if(c.user_gifts=[],0<d.gifts.length){for(var e=0;e<d.gifts.length;e++)c.user_gifts.push(d.gifts[e]);clearInterval(c.gTimer);c.gTimer=setInterval(c.claimGifts, 7E3)}}else d=printLocalError(d.error_code||null,d.msg||null,d.feedback||null),Logbuch.eintrag(Logs.globallog,'ERROR: There was a problem retrieving a Gift..!<br><span class="boldRed">'+d+"</span>")},onFailure:function(){Logbuch.eintrag(Logs.globallog,"ERROR: There was a problem retrieving a Gift..!")}})}},claimGifts:function(){var c=Gifts;if(0==c.user_gifts.length)clearInterval(c.gTimer);else{var e=c.user_gifts.shift();e.giftInviteId&&(c=unsafeWindow.Object.clone(unsafeWindow.g_ajaxparams),c.accepted= 1,c.giid=e.giftInviteId,new MyAjaxRequest(unsafeWindow.g_ajaxpath+"acceptGift.php"+unsafeWindow.g_ajaxsuffix,{method:"post",parameters:c,onSuccess:function(c){c.ok?Logbuch.eintrag(Logs.globallog,"Gift: <b>"+unsafeWindow.arStrings.itemName["i"+e.itemId]+"</b> Sender: "+e.firstname+" "+e.lastname+" 'Admission from your transaction has been completed..!"):(c=printLocalError(c.error_code||null,c.msg||null,c.feedback||null),Logbuch.eintrag(Logs.globallog,"Gift: <b>"+unsafeWindow.arStrings.itemName["i"+ e.itemId]+"</b> Sender: "+e.firstname+" "+e.lastname+' \'Unable to accept from..!<br><span class="boldRed">'+c+"</span>"))},onFailure:function(){Logbuch.eintrag(Logs.globallog,"ERROR: Problem encountered while Accepting Gift..!")}}))}}},ItemsUse={iTimer:null,itemlist:[101,103,111,113,121,123,131,133,141,143,1001,1002,1003,1004,1005,1011,1012,1013,1014,1015,1021,1022,1023,1024,1025,1031,1032,1033,1034,1035,1041,1042,1043,1044,1045],init:function(){setInterval(ItemsUse.checkItems,6E4)},checkItems:function(){if(Options.pbitemuse){var c= ItemsUse,e=unsafeWindow.Constant.ResorceBoostIds,d=0;for(i=0;i<c.itemlist.length&&!(d=c.itemlist[i],Seed.items["i"+d]&&0<Seed.items["i"+d]);i++);0<d&&(1E3>d?(c=unsafeWindow.Object.clone(unsafeWindow.g_ajaxparams),c.cid=Cities.cities[0].id,c.iid=d,new MyAjaxRequest(unsafeWindow.g_ajaxpath+"boostProduction.php"+unsafeWindow.g_ajaxsuffix,{method:"post",parameters:c,onSuccess:function(c){c.ok?(Logbuch.eintrag(Logs.globallog,"Extra Attack Boost: <b>"+unsafeWindow.arStrings.itemName["i"+d]+"</b> Items Are Used .."), c=parseInt(c.expire,10),0===Seed.playerEffects.length&&(Seed.playerEffects={}),e.GOLD.include(d)&&(Seed.bonus.bC1000.bT1001=c),e.FOOD.include(d)&&(Seed.bonus.bC1100.bT1101=c),e.LUMBER.include(d)&&(Seed.bonus.bC1200.bT1201=c),e.STONE.include(d)&&(Seed.bonus.bC1300.bT1301=c),e.IRON.include(d)&&(Seed.bonus.bC1400.bT1401=c),unsafeWindow.MyItems.subtractItem(d),unsafeWindow.update_boosts()):(c=printLocalError(c.error_code||null,c.msg||null,c.feedback||null),Logbuch.eintrag(Logs.globallog,"Extra Attack Boost:: <b>"+ unsafeWindow.arStrings.itemName["i"+d]+'</b>ERROR: If an item could not be used..!<br><span class="boldRed">'+c+"</span>"))},onFailure:function(){Logbuch.eintrag(Logs.globallog,"ERROR: If an item could not be used..!")}})):(c=unsafeWindow.Object.clone(unsafeWindow.g_ajaxparams),c.cid=Cities.cities[0].id,c.iid=d,new MyAjaxRequest(unsafeWindow.g_ajaxpath+"resourceCrate.php"+unsafeWindow.g_ajaxsuffix,{method:"post",parameters:c,onSuccess:function(c){c.ok?(Logbuch.eintrag(Logs.globallog,"Gift of raw materials: <b>"+ unsafeWindow.arStrings.itemName["i"+d]+"</b> Used .."),unsafeWindow.Resource.addToSeed(c.rtype,c.amt),unsafeWindow.MyItems.subtractItem(d)):(c=printLocalError(c.error_code||null,c.msg||null,c.feedback||null),Logbuch.eintrag(Logs.globallog,"Gift of raw materials:: <b>"+unsafeWindow.arStrings.itemName["i"+d]+'</b> ERROR: could not be used..!<br><span class="boldRed">'+c+"</span>"))},onFailure:function(){Logbuch.eintrag(Logs.globallog,"ERROR: If an item could not be used..!")}})))}}},ChatPane={init:function(){setInterval(ChatPane.HandleChatPane, 2500)},HandleChatPane:function(){var c=ChatPane;if(Options.pbahelpenable)for(var e=document.getElementById("mod_comm_list2").getElementsByTagName("a"),d=0;d<e.length;d++){var g=e[d],f=g.getAttribute("class");if(!("helpBuild"!=f&&"helpResearch"!=f)&&!g.getAttribute("clicked")){g.setAttribute("clicked","true");f=/(Building.helpBuild\(.*\);)/;f=f.exec(g.getAttribute("onclick"));if(null!=f){d=f[0];c.ajaxhelpBuild(g,d);return}f=/(Research.helpResearch\(.*\);)/;f=f.exec(g.getAttribute("onclick"));if(null!= f){d=f[0];c.ajaxhelpResearch(g,d);return}}}if(Options.pbahelphide){d=document.getElementById("mod_comm_list1");g=document.getElementById("mod_comm_list2");c=d.getElementsByTagName("a");e=g.getElementsByTagName("a");for(d=0;d<c.length;d++)g=c[d],f=g.getAttribute("class"),"helpBuild"!=f&&"helpResearch"!=f||g.parentNode.parentNode.parentNode.parentNode.parentNode.removeChild(g.parentNode.parentNode.parentNode.parentNode);for(d=0;d<e.length;d++)g=e[d],f=g.getAttribute("class"),"helpBuild"!=f&&"helpResearch"!= f||g.parentNode.parentNode.parentNode.parentNode.parentNode.removeChild(g.parentNode.parentNode.parentNode.parentNode)}},ajaxhelpBuild:function(c,e){var d=e.split(",");if(parseInt(d[1])!=unsafeWindow.g_ajaxsuffix.substr(3)){var g=unsafeWindow.Object.clone(unsafeWindow.g_ajaxparams);g.cid=parseInt(d[4]);g.id=parseInt(d[2]);g.level=parseInt(d[3]);g.inviterId=parseInt(d[1]);new MyAjaxRequest(unsafeWindow.g_ajaxpath+"helpAllianceFriendBuild.php"+unsafeWindow.g_ajaxsuffix,{method:"post",parameters:g,onSuccess:function(d){c.innerHTML= d.msg},onFailure:function(d){c.innerHTML=d.msg}})}},ajaxhelpResearch:function(c,e){var d=e.split(",");if(parseInt(d[1])!=unsafeWindow.g_ajaxsuffix.substr(3)){var g=unsafeWindow.Object.clone(unsafeWindow.g_ajaxparams);g.cid=parseInt(d[4]);g.id=parseInt(d[2]);g.level=parseInt(d[3]);g.inviterId=parseInt(d[1]);new MyAjaxRequest(unsafeWindow.g_ajaxpath+"helpAllianceFriendResearch.php"+unsafeWindow.g_ajaxsuffix,{method:"post",parameters:g,onSuccess:function(d){c.innerHTML=d.msg},onFailure:function(d){c.innerHTML= d.msg}})}}},RefreshEvery={timer:null,PaintTimer:null,NextRefresh:0,box:null,target:null,init:function(){RefreshEvery.creatediv();1>Options.pbEveryMins&&(Options.pbEveryMins=1);RefreshEvery.setEnable(Options.pbEveryEnable)},creatediv:function(){var c=RefreshEvery;c.target=document.getElementById("comm_tabs");null==c.target?setTimeout(c.creatediv,2E3):(c.box=document.createElement("div"),c.box.id="font11",c.target.appendChild(c.box))},setEnable:function(c){var e=RefreshEvery;clearTimeout(e.timer);c? (e.NextRefresh=unixTime()+60*Options.pbEveryMins,e.timer=setTimeout(e.Paint,1E3)):(e.timer=null,e.NextRefresh=0,e.box.innerHTML='<br><b style="color:white;">&nbsp;&nbsp;'+getMyAlliance()[1]+"</b>")},doit:function(){Logbuch.eintrag(Logs.globallog,"Refreshed: ("+Options.pbEveryMins+" It is within the range of..)");reloadGW()},setTimer:function(){clearTimeout(RefreshEvery.timer);1>Options.pbEveryMins&&(Options.pbEveryMins=1);RefreshEvery.setEnable(Options.pbEveryEnable)},Paint:function(){var c=RefreshEvery; if(null!=c.timer){now=unixTime();var e="",d=parseInt(c.NextRefresh-now);0>d&&(d=0,c.doit());e=60>d?e+('<br>&nbsp;&nbsp;<span style="color:white;">Refresh: </span><b style="color:red;">'+timestr(d)+"</b>"):e+('<br>&nbsp;&nbsp;<span style="color:white;">Refresh: </span><b style="color: white;">'+timestr(d)+"</b>");c.box.innerHTML=e;c.timer=setTimeout(c.Paint,1E3)}}}; function reloadGW(c){c=c?c:getServerId();GM_setValue("pbReloadNow",c);"??"==c&&window.location.reload(!0);var c='<form target="_top" action="'+(window.location.protocol+"//apps.facebook.com/globalwarfaregame/?s="+c)+'" method="post"><input id="xxpbButReload" type="submit" value="UPDATED"><input type="hidden" name="s" value="'+c+'"</form>',e=document.createElement("div");e.innerHTML=c;document.body.appendChild(e);setTimeout(function(){document.getElementById("xxpbButReload").click()},100)} function findoptvalue(c){return"unt"+c.substring(1)}function getDiplomacy(c){return null==Seed.allianceDiplomacies?"Neutral":Seed.allianceDiplomacies.friendly&&null!=Seed.allianceDiplomacies.friendly["a"+c]?"Friendly":Seed.allianceDiplomacies.hostile&&null!=Seed.allianceDiplomacies.hostile["a"+c]?"Hostile":c==Seed.allianceDiplomacies.allianceId?"Own Alliance":"Neutral"} function getCityBuilding(c,e){for(var d=Seed.buildings["city"+c],g={count:0,maxLevel:0},f=1;200>f;f++)d["pos"+f]&&d["pos"+f][0]==e&&(++g.count,parseInt(d["pos"+f][1])>g.maxLevel&&(g.maxLevel=parseInt(d["pos"+f][1])));return g} function CmatSimpleSound(c,e,d,g,f){var h=this;this.player=null;this.volume=100;this.isLoaded=!1;this.onSwfLoaded=null;d=document.createElement("div");this.onSwfLoaded=g;navigator.appName.toLowerCase().indexOf("microsoft")+1?(d.innerHTML='<object width="0" height="0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"><param name="movie" value="'+c+'"><param name="quality" value="high"></object>',this.player= d.getElementsByTagName("object")[0]):(d.innerHTML='<embed width="0" height="0" src="'+c+'"  bgcolor="#eeeeee" allowfullscreen=false FlashVars="'+f+'" quality="high" allowscriptaccess="always" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" ></embed>',this.player=d.getElementsByTagName("embed")[0].wrappedJSObject);e?e.appendChild(d):document.body.appendChild(d);this.setVolume=function(c,d){h.isLoaded&&(h.player.jsSetVolume(c,d),volume=d)};this.load=function(c, d,e,f,g){h.player.jsLoad(c,d,e,f,g)};this.play=function(c,d){h.player.jsPlay(c,d)};this.stop=function(c){h.player.jsStop(c)};this.getStatus=function(c){return h.player.jsGetStatus(c)};this.debugFunc=function(){};this.swfDebug=function(c){h.debugFunc("SWF: "+c)};this.swfLoaded=function(){h.isLoaded=!0;h.debugFunc("playerIsReady");if(h.onSwfLoaded)h.onSwfLoaded()};this.swfPlayComplete=function(){};this.swfLoadComplete=function(){}} function SliderBar(c,e,d,g,f,h){function j(c){c=c.clientX-q.divLeft;0>c&&(c=0);c>q.sliderWidth&&(c=q.sliderWidth);q.knob.style.left=c-q.knob.clientWidth/2+"px";q.sliderL.style.width=c+"px";q.value=c/q.sliderWidth;q.listener&&q.listener(q.value)}function l(c){j(c);q.div.removeEventListener("mousemove",o,!0);document.removeEventListener("mouseup",l,!0)}function o(c){j(c)}var q=this;this.listener=null;null==g&&(g=0);h||(h=parseInt(0.05*e));this.value=g;20>e&&(e=20);5>d&&(d=5);if(null==f)var f="slider", v=!0;var g=parseInt(d/2),w=parseInt(d/4);this.sliderWidth=e-2*h;this.div=document.createElement("div");this.div.style.height=d+"px";this.div.style.width=e+"px";this.div.className=f+"Cont";v&&(this.div.style.backgroundColor="#ddd");this.slider=document.createElement("div");this.slider.setAttribute("style","position:relative;");this.slider.style.height=g+"px";this.slider.style.top=w+"px";this.slider.style.width=this.sliderWidth+"px";this.slider.style.left=h+"px";this.slider.className=f+"Bar";this.slider.draggable= !0;v&&(this.slider.style.backgroundColor="#fff");this.sliderL=document.createElement("div");this.sliderL.setAttribute("style","width:100px; height:100%; position:relative; ");this.sliderL.className=f+"Part";this.sliderL.draggable=!0;v&&(this.sliderL.style.backgroundColor="#0c0");this.knob=document.createElement("div");this.knob.setAttribute("style","width:3px; position:relative; left:0px; background-color:#222");this.knob.style.height=d+"px";this.knob.style.top=0-w+"px";this.knob.className=f+"Knob"; this.knob.draggable=!0;this.slider.appendChild(this.sliderL);this.sliderL.appendChild(this.knob);this.div.appendChild(this.slider);c.appendChild(this.div);this.div.addEventListener("mousedown",function(c){var d=q.slider;for(q.divLeft=0;d.offsetParent;)q.divLeft+=d.offsetLeft,d=d.offsetParent;j(c);document.addEventListener("mouseup",l,!0);q.div.addEventListener("mousemove",o,!0)},!1);this.getValue=function(){return q.value};this.setValue=function(c){var d=c*q.sliderWidth;q.sliderL.style.width=d+"px"; q.knob.style.left=d+"px";q.value=c;q.listener&&q.listener(q.value)};this.setChangeListener=function(c){q.listener=c}} function getResourceProduction(c){var e=[0,0,0,0,0,0,0,0,0],d=unixTime(),g=[0,0,0,0,0,0,0,0,0],f=Seed.wilderness["city"+c],h;for(h in f){var j=parseInt(f[h].tileType);10==j||11==j||12==j?g[1]+=parseInt(f[h].tileLevel):g[j/10]+=parseInt(f[h].tileLevel)}h=0;if(j=Seed.knights["city"+c])(j=j["knt"+Seed.leaders["city"+c].resourcefulnessKnightId])&&(h=parseInt(j.knightLevel));var j=1,l=parseInt(Seed.citystats["city"+c].pop[0]),f=parseInt(Seed.citystats["city"+c].pop[3]);f>l&&(j=l/f);var l=f=0,o=Seed.buildings["city"+ c],q;for(q in o){var v=o[q];22==parseInt(v[0])&&(f=parseInt(v[1]));23==parseInt(v[0])&&(l=parseInt(v[1]))}10==f&&(f=12);10==l&&(l=12);for(q=1;5>q;q++){o=Seed.resources["city"+c]["rec"+q];v=0;parseInt(Seed.bonus["bC1"+q+"00"]["bT1"+q+"01"])>d&&(v=0.25);var w=Seed.tech["tch"+q],E=0;0<f&&2==q&&(E=f);0<l&&1==q&&(E=l);grundverbrauch=o[2];e[q]=parseInt(grundverbrauch*(1+w/10+h/100+v+E/10+g[q]/20)*j)}return e} var debugWin={popDebug:null,dbDefaultNot:"",dbSelect:{},doit:function(){function c(){for(var c=document.getElementById("dbpoplist"),d=0;d<c.childNodes.length;d++)if(c.childNodes[d].type&&"checkbox"==c.childNodes[d].type){var e=c.childNodes[d].name.substr(6);c.childNodes[d].checked=j.dbSelect[e]}}function e(){for(var d in j.dbSelect)j.dbSelect[d]=!0;c()}function d(){for(var d in j.dbSelect)j.dbSelect[d]=!1;c()}function g(){for(o in j.dbSelect)j.dbSelect[o]=!1;for(var d=j.dbDefaultNot.split(","),e= 0;e<d.length;e++)j.dbSelect[d[e]]=!1;c()}function f(){for(var c=new Date,d=unsafeWindow.Object.clone(Seed),e=document.getElementById("dbpoplist"),f=0;f<e.childNodes.length;f++)if(e.childNodes[f].type&&"checkbox"==e.childNodes[f].type){var g=e.childNodes[f].name.substr(6);e.childNodes[f].checked||delete d[g]}WinLog.write("seed @ "+unixTime()+" ("+c+")\n\n"+inspect(d,8,1))}function h(){for(var c=document.getElementsByTagName("script"),d=0;d<c.length;d++)null!=c[d].src&&""!=c[d].src&&WinLog.write('<A style="color:black; text-decoration:underline;" TARGET=_tab HREF="'+ c[d].src+'">'+c[d].src+"</a>")}var j=debugWin;if(null==j.popDebug){j.popDebug=new CPopup("db",0,0,400,500,!0);j.popDebug.getTopDiv().innerHTML="DEBUG";j.popDebug.getMainDiv().innerHTML='<DIV><INPUT type=submit id=dbsuball value=ALL> &nbsp; <INPUT type=submit id=dbsubnone value=NONE> &nbsp; <INPUT type=submit id=dbdefaults value=DEFAULTS> &nbsp; <INPUT type=submit id=dbsubdo value=SHOW> &nbsp; <INPUT type=submit id=dbsubscripts value=SCRIPTS></div><DIV id=dbpoplist style="max-height:400px; height:400px; overflow-y:auto"></div>'; var l=document.getElementById("dbpoplist"),o;for(o in Seed)j.dbSelect[o]=!0;for(var q=j.dbDefaultNot.split(","),v=0;v<q.length;v++)j.dbSelect[q[v]]=!1;q=[];for(o in j.dbSelect)q.push("<INPUT type=checkbox "),q.push('name="dbpop_'),q.push(o),q.push('"> &nbsp; '),q.push(o),q.push("<BR>");l.innerHTML=q.join("");document.getElementById("dbsuball").addEventListener("click",e,!1);document.getElementById("dbsubnone").addEventListener("click",d,!1);document.getElementById("dbdefaults").addEventListener("click", g,!1);document.getElementById("dbsubdo").addEventListener("click",f,!1);document.getElementById("dbsubscripts").addEventListener("click",h,!1);c()}j.popDebug.show(!0)}};function readOptions(){var c=getServerId();s=GM_getValue("Options_"+c+"_"+unsafeWindow.g_ajaxsuffix.substr(3));if(null!=s)for(k in opts=JSON2.parse(s),opts)if("object"==matTypeof(opts[k]))for(kk in opts[k])Options[k][kk]=opts[k][kk];else Options[k]=opts[k]} function readLogs(){var c=getServerId();s=GM_getValue("Logs_"+c+"_"+unsafeWindow.g_ajaxsuffix.substr(3));if(null!=s)for(k in opts=JSON2.parse(s),opts)if("object"==matTypeof(opts[k]))for(kk in opts[k])Logs[k][kk]=opts[k][kk];else Logs[k]=opts[k]}function saveOptions(){var c=getServerId();setTimeout(function(){GM_setValue("Options_"+c+"_"+unsafeWindow.g_ajaxsuffix.substr(3),JSON2.stringify(Options))},0)} function saveLogs(){var c=getServerId();setTimeout(function(){GM_setValue("Logs_"+c+"_"+unsafeWindow.g_ajaxsuffix.substr(3),JSON2.stringify(Logs))},0)}function onUnload(){Options.ptWinPos=mainPop.getLocation();saveOptions();saveLogs();Tabs.transport.saveTradeRoutes();Tabs.transport.saveTraderState();Tabs.build.onUnload()} function getClientCoords(c){if(null==c)return{x:null,y:null,width:null,height:null};for(ret={x:0,y:0,width:c.clientWidth,height:c.clientHeight};null!=c.offsetParent;)ret.x+=c.offsetLeft,ret.y+=c.offsetTop,c=c.offsetParent;return ret} function formatZahl(c,e,d){e||(e=0);var g="",f=Math.pow(10,e),c=""+parseInt(c*f+0.5*(0<c?1:-1))/f,h=c.indexOf(".");d&&(c+=(-1==h?".":"")+f.toString().substring(1));(d=0>c)&&(c=c.substring(1));h=c.indexOf(".");for(-1==h?h=c.length:g=","+c.substr(h+1,e);0<h;)g=0<h-3?"."+c.substring(h-3,h)+g:c.substring(0,h)+g,h-=3;return(d?"-":"")+g}function parseIntNan(c){x=parseInt(c,10);return isNaN(x)?0:x}function parseIntZero(c){c=c.trim();return""==c?0:parseInt(c,10)} var WinManager={wins:{},didHide:[],get:function(c){return WinManager.wins[c]},add:function(c,e){WinManager.wins[c]=e;null==unsafeWindow.cpopupWins&&(unsafeWindow.cpopupWins={});unsafeWindow.cpopupWins[c]=e},hideAll:function(){var c=WinManager;c.didHide=[];for(k in c.wins)c.wins[k].isShown()&&(c.didHide.push(c.wins[k]),c.wins[k].show(!1))},restoreAll:function(){for(var c=WinManager,e=0;e<c.didHide.length;e++)c.didHide[e].show(!0)},dele:function(c){delete WinManager.wins[c];delete unsafeWindow.cpopupWins[c]}}; function CPopup(c,e,d,g,f,h,j){var l=WinManager.get(c);if(l)return l.show(!1),l;this.BASE_ZINDEX=2E5;this.show=function(c){c?(o.div.style.display="block",o.focusMe()):o.div.style.display="none";return c};this.toggleHide=function(c){return"block"==c.div.style.display?c.show(!1):c.show(!0)};this.getTopDiv=function(){return document.getElementById(this.prefix+"_top")};this.getMainDiv=function(){return document.getElementById(this.prefix+"_main")};this.getLayer=function(){return parseInt(o.div.style.zIndex)- this.BASE_ZINDEX};this.setLayer=function(c){o.div.style.zIndex=""+(this.BASE_ZINDEX+c)};this.setEnableDrag=function(c){o.dragger.setEnable(c)};this.getLocation=function(){return{x:parseInt(this.div.style.left),y:parseInt(this.div.style.top)}};this.setLocation=function(c){o.div.style.left=c.x+"px";o.div.style.top=c.y+"px"};this.focusMe=function(){o.setLayer(5);for(k in unsafeWindow.cpopupWins)k!=o.prefix&&unsafeWindow.cpopupWins[k].unfocusMe()};this.unfocusMe=function(){o.setLayer(-5)};this.centerMe= function(c){var d=null==c?getClientCoords(document.body):getClientCoords(c),c=(d.width-parseInt(o.div.style.width))/2+d.x,d=(d.height-parseInt(o.div.style.height))/2+d.y;0>c&&(c=0);0>d&&(d=0);o.div.style.left=c+"px";o.div.style.top=d+"px"};this.destroy=function(){document.body.removeChild(o.div);WinManager.dele(o.prefix)};this.autoHeight=function(c){o.div.style.height=c?"":o.div.style.maxHeight};this.div=document.createElement("div");this.prefix=c;this.onClose=j;var o=this;this.div.className="CPopup ptTabs "+ c+"_CPopup";this.div.id=c+"_outer";this.div.style.background="#fff";this.div.style.zIndex=this.BASE_ZINDEX;this.div.style.display="none";this.div.style.width=g+"px";this.div.style.height="";this.div.style.maxHeight=f+"px";this.div.style.position="absolute";this.div.style.top=d+"px";this.div.style.left=e+"px";topClass=null==CPopUpTopClass?"CPopupTop "+c+"_CPopupTop":CPopUpTopClass+" "+c+"_"+CPopUpTopClass;e=[];e.push('<table cellspacing="0" width="100%" height="100%">');e.push('<tr id="'+c+'_bar" class="'+ topClass+'">');e.push('<td valign="bottom">');e.push('<span id="'+c+'_top"></span>');e.push("</td>");e.push("<td id="+c+'_X valign="top" onmouseover="this.style.cursor=\'pointer\'" style="width:13px; text-align:center; color:#fff; background:#333; font-weight:bold; font-size:14px; padding:0px 5px">X</td>');e.push("</tr>");e.push("<tr>");e.push('<td height="100%" valign="top" class="'+c+'_CPopMain" colspan="2">');e.push('<div class="CPopMain '+c+'_CPopMain" id="'+c+'_main"></div>');e.push("</td>"); e.push("</tr>");e.push("</table>");document.body.appendChild(this.div);this.div.innerHTML=e.join("");document.getElementById(c+"_X").addEventListener("click",function(){o.show(!1);if(null!=o.onClose)o.onClose()},!1);this.dragger=new CWinDrag(document.getElementById(c+"_bar"),this.div,h);this.div.addEventListener("mousedown",function(){o.focusMe()},!1);WinManager.add(c,this)} function CWinDrag(c,e,d){function g(c){c.body.removeEventListener("mousemove",c.moveHandler,!0);c.body.removeEventListener("mouseout",c.outHandler,!0);c.moving=!1}var f=this;this.setEnable=function(d){d!=f.enabled&&(d?(c.addEventListener("mousedown",f.downHandler,!1),f.body.addEventListener("mouseup",f.upHandler,!1)):(c.removeEventListener("mousedown",f.downHandler,!1),f.body.removeEventListener("mouseup",f.upHandler,!1)),f.enabled=d)};this.setBoundRect=function(){this.boundRect=boundRect;this.bounds= null};this.debug=function(c,d){logit("*************** "+c+" ****************");logit("clientWidth, Height: "+d.clientWidth+","+d.clientHeight);logit("offsetLeft, Top, Width, Height (parent): "+d.offsetLeft+","+d.offsetTop+","+d.offsetWidth+","+d.offsetHeight+" ("+d.offsetParent+")");logit("scrollLeft, Top, Width, Height: "+d.scrollLeft+","+d.scrollTop+","+d.scrollWidth+","+d.scrollHeight)};this.dispEvent=function(c,d){logit(c+" Button:"+d.button+" Screen:"+d.screenX+","+d.screenY+" client:"+d.clientX+ ","+d.clientY+" rTarget: "+d.relatedTarget)};this.lastY=this.lastX=null;this.enabled=!0;this.moving=!1;this.theDiv=e;this.body=document.body;this.ce=c;this.moveHandler=(new function(c){this.handler=function(c){if(d.enabled&&!d.wentOut){var e=parseInt(d.theDiv.style.top)+c.clientY-d.lastY,f=parseInt(d.theDiv.style.left)+c.clientX-d.lastX;e<d.bounds.top?(e=d.bounds.top,g(d)):f<d.bounds.left?(f=d.bounds.left,g(d)):f>d.bounds.right?(f=d.bounds.right,g(d)):e>d.bounds.bot&&(e=d.bounds.bot,g(d));d.theDiv.style.top= e+"px";d.theDiv.style.left=f+"px";d.lastX=c.clientX;d.lastY=c.clientY}};var d=c}(this)).handler;this.outHandler=(new function(c){this.handler=function(c){0==c.button&&d.moveHandler(c)};var d=c}(this)).handler;this.upHandler=(new function(c){this.handler=function(c){0==c.button&&d.moving&&g(d)};var d=c}(this)).handler;this.downHandler=(new function(d){this.handler=function(d){null==e.bounds&&(e.clickableRect=getClientCoords(c),e.bodyRect=getClientCoords(document.body),null==e.boundRect&&(e.boundRect= e.clickableRect),e.bounds={top:10-e.clickableRect.height,bot:e.bodyRect.height-25,left:40-e.clickableRect.width,right:e.bodyRect.width-25});0==d.button&&e.enabled&&(e.body.addEventListener("mousemove",e.moveHandler,!0),e.body.addEventListener("mouseout",e.outHandler,!0),e.lastX=d.clientX,e.lastY=d.clientY,e.moving=!0)};var e=d}(this)).handler;this.bounds=this.boundRect=this.clickableRect=null;this.enabled=!1;null==d&&(d=!0);this.setEnable(d)} function inspect(c,e,d,g){var f="",h,j;null==d&&(d=0);null==e&&(e=1);if(1>e)return"Inspect Error: Levels number must be > 0";if(null==c)return"ERROR: Object is NULL\n";var l="";for(j=0;j<d;j++)l+="  ";for(property in c)try{if(h=matTypeof(c[property]),!0==g&&"function"==h?f+=l+"("+h+") "+property+"[FUNCTION]\n":"function"!=h&&(f+=l+"("+h+") "+property+(null==c[property]?": null":"")+" = "+c[property]+"\n"),("object"==h||"array"==h)&&null!=c[property]&&d+1<e)f+=inspect(c[property],e,d+1,g)}catch(o){j= "string"==typeof o?o:o.message?o.message:o.description?o.description:"Unknown",f+="(Error) "+property+": "+j+"\n"}return f+"\n"}Array.prototype.compare=function(c){if(this.length!=c.length)return!1;for(var e=0;e<c.length;e++)if(this[e].compare&&!this[e].compare(c[e])||this[e]!==c[e])return!1;return!0};Array.prototype.exists=function(c){for(var e=0;e<this.length;e++)if(this[e]===c)return!0;return!1};String.prototype.entityTrans={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039"}; String.prototype.htmlSpecialChars=function(){var c=this.toString();for(k in this.entityTrans)c=c.split(k).join(this.entityTrans[k]);return c};String.prototype.htmlSpecialCharsDecode=function(){var c=this.toString();for(k in this.entityTrans)c=c.split(this.entityTrans[k]).join(k);return c};String.prototype.trim=function(c){if(!this.length)return"";var e=this.stripNL().ltrim().rtrim();return c?e.replace(/ +/g," "):e};String.prototype.rtrim=function(){return!this.length?"":this.replace(/\s+$/g,"")}; String.prototype.ltrim=function(){return!this.length?"":this.replace(/^\s+/g,"")};String.prototype.stripNL=function(){return!this.length?"":this.replace(/[\n\r]/g,"")};String.prototype.stripTags=function(){return this.replace(/(<.*['"])([^'"]*)(['"]>)/g,function(c,e,d,g){return e+g}).replace(/<\/?[^>]+>/gi,"")};function mouseMainTab(c){2==c.button&&(c=getClientCoords(document.getElementById("gor_menu_bar")),mainPop.setLocation({x:c.width+4,y:0}))} function eventHideShow(){mainPop.toggleHide(mainPop)?(tabManager.showTab(),Options.ptWinIsOpen=!0):(tabManager.hideTab(),Options.ptWinIsOpen=!1);saveOptions()}function createButton(c){var e=document.createElement("a");e.className="tab buttontab";e.innerHTML='<span class="left"></span><span class="right"></span>';e.innerHTML+='<span class="mid">'+c+"</span>";e.style.width="78px";return e} function AddMainTabLink(c,e,d){var g=document.getElementById("kochead");if(!g&&(g=document.getElementById("gor_menu_bar")))g=g.parentNode;g||setTimeout(function(){AddMainTabLink(c,e,d)},200);if(g){for(var f=createButton(c),h=g.parentNode,j=null,l=0;l<h.childNodes.length;l++){var o=h.childNodes[l];if(o.tagName&&"DIV"==o.tagName&&"tabs_engagement"==o.className&&"main_engagement_tabs"!=o.id){j=o;break}}null==j&&(j=document.createElement("div"),j.className="tabs_engagement",g.parentNode.insertBefore(j, g),j.style.whiteSpace="nowrap",j.style.width="90px",j.style.height="22px",j.style.padding="0",j.style.position="absolute",j.style.top="45px",j.style.left="760px",j.style.zIndex="160000",j.lang="de_PB");j.appendChild(f);f.addEventListener("click",e,!1);null!=d&&f.addEventListener("mousedown",d,!0);return f}return null} function AjaxRequest(c,e,d){var g={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":unsafeWindow.Prototype.Version,Accept:"text/javascript, text/html, application/xml, text/xml, */*","Content-type":"application/x-www-form-urlencoded; charset=UTF-8"};d||(d=3E4);var f=null,h=null,h=new XMLHttpRequest;h.onreadystatechange=function(){if(4==h.readyState){if(clearTimeout(f),200<=h.status&&305>h.status)if(e.onSuccess)e.onSuccess(h);else if(e.onFailure)e.onFailure(h)}else if(e.onChange)e.onChange(h)}; h.open("POST",c,!0);for(var j in g)h.setRequestHeader(j,g[j]);if("object"==matTypeof(e.requestHeaders))for(j in e.requestHeaders)h.setRequestHeader(j,e.requestHeaders[j]);c=[];for(j in e.parameters)if("object"==matTypeof(e.parameters[j]))for(var l in e.parameters[j])c.push(j+"["+l+"] ="+e.parameters[j][l]);else c.push(j+"="+e.parameters[j]);f=setTimeout(function(){h=null;Logbuch.eintrag(Logs.globallog,'AJAX ERROR: <span class="boldRed">Or the server meets the requirements is too late is not sufficient!!</span>'); if(e.onFailure)e.onFailure(h)},d);h.send(c.join("&"))} function MyAjaxRequest(c,e){function d(){++j;j>=l?Logbuch.eintrag(Logs.globallog,'AJAX ERROR: <span class="boldRed">Has had many repetitions ..!</span>'):(new AjaxRequest(c,g),o*=1.25)}var g=unsafeWindow.Object.clone(e),f=e.onSuccess,h=e.onFailure,j=0,l=3,o=4,q=!0===q?!0:!1;g.onSuccess=function(c){c=eval("("+c.responseText+")");window.EmulateAjaxError&&(c.ok=!1,c.error_code=8);if(c.ok){try{c.updateSeed&&unsafeWindow.update_seed(c.updateSeed)}catch(e){}f(c)}else c.errorMsg=unsafeWindow.printLocalError(c.error_code|| null,c.msg||null,c.feedback||null),!q&&(0==c.error_code||1==c.error_code||3==c.error_code||8==c.error_code)?(Logbuch.eintrag(Logs.globallog,'AJAX ERROR: Automatically request will be repeated ...<br><span class="boldRed">'+c.errorMsg+"</span>"),setTimeout(d,parseInt(1E3*o))):f(c)};g.onFailure=function(){h({ok:!1,errorMsg:"AJAX ERROR"})};new AjaxRequest(c,g)} function getMyAlliance(){return null==Seed.allianceDiplomacies||null==Seed.allianceDiplomacies.allianceName?[0,"None"]:[Seed.allianceDiplomacies.allianceId,Seed.allianceDiplomacies.allianceName]}var myServerId=null;function getServerId(){if(null==myServerId){var c=/^[a-zA-Z]+([0-9]+)\./.exec(document.location.hostname);myServerId=c?c[1]:"??"}return myServerId} function setCities(){Cities.numCities=Seed.cities.length;Cities.cities=[];Cities.byID={};for(i=0;i<Cities.numCities;i++)city={},city.idx=i,city.id=parseInt(Seed.cities[i][0]),city.name=Seed.cities[i][1],city.x=parseInt(Seed.cities[i][2]),city.y=parseInt(Seed.cities[i][3]),city.tileId=parseInt(Seed.cities[i][5]),city.provId=parseInt(Seed.cities[i][4]),Cities.cities[i]=city,Cities.byID[Seed.cities[i][0]]=city} var tabManager={tabList:{},currentTab:null,init:function(c){var e=tabManager,d=[];for(k in Tabs)Tabs[k].tabDisabled||(e.tabList[k]={},e.tabList[k].name=k,e.tabList[k].obj=Tabs[k],e.tabList[k].label=null!=Tabs[k].tabLabel?Tabs[k].tabLabel:k,null!=Tabs[k].tabOrder?d.push([Tabs[k].tabOrder,e.tabList[k]]):d.push([1E3,e.tabList[k]]),e.tabList[k].div=document.createElement("div"));d.sort(function(c,d){return c[0]-d[0]});for(var g='<table cellspacing="1" class="ptMainTab"><tr>',f=0;f<d.length;f++)g+='<td style="text-align:center;" class="notSel" id="pttc'+ d[f][1].name+'"><a><span>'+d[f][1].label+"</span></a></td>";mainPop.getTopDiv().innerHTML=g+"</tr></table>";for(k in e.tabList){e.tabList[k].name==Options.currentTab&&(e.currentTab=e.tabList[k]);document.getElementById("pttc"+k).addEventListener("click",this.e_clickedTab,!1);g=e.tabList[k].div;g.style.display="none";g.style.height="100%";c.appendChild(g);try{e.tabList[k].obj.init(g)}catch(h){g.innerHTML="Initialize: <pre>"+h.name+" : "+h.message+" : Row:"+h.lineNumber+"</pre>"}}null==e.currentTab&& (e.currentTab=d[0][1]);e.setTabStyle(document.getElementById("pttc"+e.currentTab.name),!0);e.currentTab.div.style.display="block"},hideTab:function(){tabManager.currentTab.obj.hide()},showTab:function(){tabManager.currentTab.obj.show()},setTabStyle:function(c,e){c.className=e?"sel":"notSel"},e_clickedTab:function(c){var e=tabManager;newTab=e.tabList[c.target.parentNode.parentNode.id.substring(4)];e.currentTab.name!=newTab.name&&(e.setTabStyle(document.getElementById("pttc"+e.currentTab.name),!1), e.setTabStyle(document.getElementById("pttc"+newTab.name),!0),e.currentTab.obj.hide(),e.currentTab.div.style.display="none",e.currentTab=newTab,newTab.div.style.display="block",Options.currentTab=newTab.name);newTab.obj.show()}};function hideMe(){mainPop.show(!1);tabManager.hideTab();Options.ptWinIsOpen=!1;saveOptions()}function showMe(){mainPop.show(!0);tabManager.showTab();Options.ptWinIsOpen=!0;saveOptions()}function objectName(c){c=c.toString();return c.substr(7,c.length-8)} function matTypeof(c){return"object"==typeof c?c?0<=c.constructor.toString().indexOf("Array")&&"function"==typeof c.splice?"array":"object":"null":typeof c}function addCommasInt(c){nStr=parseInt(c)+"";for(c=/(\d+)(\d{3})/;c.test(nStr);)nStr=nStr.replace(c,"$1.$2");return nStr}function addCommas(c){x=(c+"").split(".");x1=x[0];x2=1<x.length?"."+x[1]:"";for(c=/(\d+)(\d{3})/;c.test(x1);)x1=x1.replace(c,"$1.$2");return x1+x2} function htmlSelector(c,e,d){m=[];m.push("<select");d&&(m.push(" "),m.push(d));m.push(">");for(k in c)m.push("<option "),k==e&&m.push('selected="selected" '),m.push('value="'),m.push(k),m.push('">'),m.push(c[k]),m.push("</option>");m.push("</select>");return m.join("")}function unixTime(){return parseInt((new Date).getTime()/1E3)+unsafeWindow.g_timeoff}function htmlOptions(c,e){m="";for(k in c)m+='<option value="'+k+'"'+(k==e?' selected="selected"':"")+">"+c[k]+"</option>";return m} function getFunctionName(c){c=/\W*function\s+([\w\$]+)\(/.exec(c);return!c?"":c[1]}function findAllBetween(c,e,d){for(var g=[],f=0;0<=(i1=c.indexOf(e,f))&&0<=(i2=c.indexOf(d,i1));)g.push(c.substring(i1+e.length,i2)),f=i2+d.length;return g}function strUpTo(c,e){var d=c.indexOf(e);return 0<d?c.substr(0,d):c}function timestrShort(c){c=parseInt(c);if(86400<c){var e=[],c=c/3600;e.push(parseInt(c/24));e.push("D ");e.push(parseInt(c%24));e.push("H ");return e.join("")}return timestr(c)} function timestr(c,e){var c=parseInt(c),d=[],g=c;if(61>g)return g+"S ";86400<g&&(d.push(parseInt(g/86400)),d.push("D "),g%=86400);if(3600<g||3600<c)d.push(parseInt(g/3600)),d.push("H "),g%=3600;d.push(parseInt(g/60));d.push("M ");if(e||3600>=c)d.push(" "),d.push(g%60),d.push("S ");return d.join("")} function logit(c,e){if(!DEBUG_TRACE&&!e)return!1;var d=new Date,c=getServerId()+" @ "+d.toTimeString().substring(0,8)+"."+d.getMilliseconds()+" : "+c;if("undefined"!==typeof GM_log)return GM_log(c),!0;return"undefined"!==typeof console&&console.log?(console.log(c),!0):!1} var WINLOG_MAX_ENTRIES=1E3,WinLog={state:null,win:null,eOut:null,lastE:null,enabled:!0,reverse:!0,busy:!1,isOpening:!1,open:function(){function c(){var c=WinLog;c.lastE=null;c.eOut.innerHTML=""}function e(){var c=WinLog;if(!c.busy){c.busy=!0;c.reverse?(c.win.document.getElementById("wlRev").value="Top",c.reverse=!1):(c.win.document.getElementById("wlRev").value="Bottom",c.reverse=!0);var d=c.eOut.childNodes.length;if(!(2>d)){for(i=d-2;0<=i;i--)c.eOut.appendChild(c.eOut.childNodes[i]);c.busy=!1}}} var d=WinLog;if(!d.win||d.win.closed)d.isOpening=!0,d.win=new CPopup("ptwinlog",0,0,500,800,!0,function(){d.win.destroy();d.win=null;d.win.closed=!0}),d.win.show(!0),d.isOpening=!1,d.state=null;null==d.state&&(d.win.getMainDiv().innerHTML='<STYLE>pre{margin:0px} hr{margin:3px; height:1px; border:0px; color:#cee; background-color:#cee}</style><BODY style="margin:0px; padding:0px; border:none"><DIV id=winlogtop style="background-color:#d0d0d0; margin:0px; padding:0px; border:1px solid"><INPUT id=wlClear type=submit value="Clear"> &nbsp; <INPUT id=wlRev type=submit value="Bottom"></div><DIV id=wlOut style="overflow-y:auto; overflow-x:auto; max-height:800px; width:600px"></div></body>', d.win.getTopDiv().innerHTML="Info",document.getElementById("wlClear").addEventListener("click",c,!1),document.getElementById("wlRev").addEventListener("click",e,!1),d.eOut=document.getElementById("wlOut"),d.lastE=null,d.state=1)},writeText:function(c){WinLog.write(c.htmlEntities())},write:function(c){var e=WinLog;if(e.enabled&&!e.isOpening){e.open();var d=document.createElement("pre"),g=new Date,f=[],h=g.getMilliseconds();f.push(g.toTimeString().substring(0,8));f.push(".");100>h&&f.push("0");10>h&& f.push("0");f.push(h);f.push(": ");f.push(c);d.innerHTML=f.join("");e.reverse?(null==e.lastE?(e.eOut.appendChild(d),e.lastE=d):e.eOut.insertBefore(d,e.lastE),c=document.createElement("hr"),e.eOut.insertBefore(c,d),e.lastE=c):(e.eOut.appendChild(d),e.eOut.appendChild(document.createElement("hr")))}}}; function SortTable(c){function e(){var c="ignore_case"==this.getAttribute("ignore_case"),d=!(!this.getAttribute||!/\bsort_string\b/i.test(this.getAttribute)),e=this.getAttribute("sortsp"),f=this.getAttribute("sortsd");if(g(e,f,c,d)){for(c=0;c<v.length;c++)v[c].style.color=j;this.style.color=l}}function d(c,d,e){if(c.getAttribute("my_key"))return parseFloat(c.getAttribute("my_key"));c=c.innerHTML.stripTags().trim();return e?d?c.toLowerCase():c:c==parseFloat(c)?parseFloat(c):c}function g(c,e,f,g){try{for(var h= [],j=q.rows,l=q.rows.length,v=0;v<l;v++)h.push({elem:j[v],value:d(j[v].cells[c],f,g)});h.sort(function(c,d){return c.value.localeCompare?e*c.value.localeCompare(d.value):c.value==d.value?0:c.value>d.value?e:-e});for(var w=q.cloneNode(!1),v=0;v<l;v++)o&&(h[v].elem.className=h[v].elem.className.replace(/( ?odd)/,""),v%2&&(h[v].elem.className+=" odd")),w.appendChild(h[v].elem);q.parentNode.replaceChild(w,q);q=w;return!0}catch(z){alert("General: EvrenSerdar :-))")}}for(var f=String.fromCharCode(9660), h=String.fromCharCode(9650),j="#000",l="red",o=/\bzebra\b/i.test(c.className),q=c.tBodies[0],v=[],c=c.tHead.rows[0].cells,w=0;w<c.length;w++)if(!c[w].className||!/\bno_sort\b/i.test(c[w].className)){var E=c[w].getAttribute("ignore_case"),B=c[w].className,z=document.createElement("span");z.style.fontFamily="Arial";z.style.fontSize="70%";z.style.color=j;z.innerHTML=" "+h;var C=c[w].appendChild(z);C.style.cursor="pointer";C.setAttribute("sortsp",w);C.setAttribute("sortsd","1");C.setAttribute("ignoreCase", E);C.setAttribute("forceString",B);C.addEventListener("click",e,!1);z=document.createElement("span");z.style.fontFamily="Arial";z.style.fontSize="70%";z.style.color=j;z.innerHTML=" "+f;z=c[w].appendChild(z);z.style.cursor="pointer";z.setAttribute("sortsp",w);z.setAttribute("sortsd","-1");z.setAttribute("ignoreCase",E);z.setAttribute("forceString",B);z.addEventListener("click",e,!1);v.push(C);v.push(z)}} function CdispCityPicker(c,e,d,g,f){this.selectBut=function(c){document.getElementById(this.id+"_"+c).click()};this.bindToXYboxes=function(c,d){this.coordBoxX=c;this.coordBoxY=d;var e=new function(e){this.eventChange=function(){var c=/^\s*([0-9]+)[\s,]+([0-9]+)/.exec(e.coordBoxX.value.trim());c&&(e.coordBoxX.value=c[1],e.coordBoxY.value=c[2]);var c=parseInt(e.coordBoxX.value,10),d=parseInt(e.coordBoxY.value,10);isNaN(c)||0>c||750<c?e.coordBoxX.style.backgroundColor="#ff8888":isNaN(d)||0>d||750<d? e.coordBoxY.style.backgroundColor="#ff8888":(e.coordBoxX.style.backgroundColor="#ffffff",e.coordBoxY.style.backgroundColor="#ffffff",null!=e.notify&&e.notify(null,c,d))};e.city&&(c.value=e.city.x,d.value=e.city.y)}(this);c.size=2;c.maxLength=10;d.size=2;d.maxLength=3;c.addEventListener("change",e.eventChange,!1);d.addEventListener("change",e.eventChange,!1)};this.coordBoxY=this.coordBoxX=null;this.id=c;this.dispName=d;this.prefixLen=c.length+1;this.notify=g;this.city=this.selected=null;for(var h= "",g=0;g<Cities.cities.length;g++)h+='<INPUT class="ptcastleBut ptcastleButNon" id="'+c+"_"+g+'" value="'+(g+1)+'" type=submit >';d&&(h+=' &nbsp; <SPAN style="display:inline-block; width:85px; font-weight:bold;" id='+c+"cname></span>");e.innerHTML=h;e=new function(c){this.clickedCityBut=function(d){null!=c.selected&&(c.selected.className="ptcastleBut ptcastleButNon");c.city=Cities.cities[d.target.id.substr(c.prefixLen)];c.dispName&&(document.getElementById(c.id+"cname").innerHTML=c.city.name);d.target.className= "ptcastleBut ptcastleButSel";c.selected=d.target;c.coordBoxX&&(c.coordBoxX.value=c.city.x,c.coordBoxY.value=c.city.y,c.coordBoxX.style.backgroundColor="#ffffff",c.coordBoxY.style.backgroundColor="#ffffff");null!=c.notify&&c.notify(c.city,c.city.x,c.city.y)}}(this);for(g=0;g<Cities.cities.length;g++)document.getElementById(c+"_"+g).addEventListener("click",e.clickedCityBut,!1);null!=f&&this.selectBut(f)}setTimeout(ptStartup,5E3);

0 comments:

Post a Comment