var fe={recurringPeriod:30000,loaded:false,connected:false,errors:0,USER_TYPE_GUEST:1,USER_TYPE_USER:2,USER_TYPE_PRO:3,USER_TYPE_ADMIN:100,USER_TYPE_SUPERADMIN:101,onLoad:function(){if(this.loaded){this.init()}else{this.loaded=true}},onUnload:function(){this.saveStats();geewa.messenger.call("disconnect");if(this.page&&this.page.onUnload){this.page.onUnload()}},onError:function(){this.infoBar.show("Chyba ve stránce: "+arguments[0],this.infoBar.STATUS.ERROR,true,5);if(this.errors<global.reportErrors&&typeof(arguments[0]=="string")&&arguments[0].indexOf("Error loading script")==-1){this.errors++;var B=[];for(var A=0;A<arguments.length;A++){B.push(arguments[A])}this.reportError("hry.cz","Error",B.join("; "))}return true},reportError:function(){try{var C=[];var B=12;C.push("version: "+B);if(session&&session.userType){C.push("user: "+session.nick+", "+session.userType)}C.push("URL: "+window.location.href);C.push("UA: "+navigator.userAgent);C.push("Screen: "+screen.availWidth+"x"+screen.availHeight+"x"+screen.colorDepth);C.push("Flash: "+geewa.debug.flashVersion().toString().replace(/,/g,"."));if(geewa.debug._profilerStart){C.push("Time: "+(new Date().valueOf()-geewa.debug._profilerStart)+"ms")}if(geewa.loader){var F=geewa.loader;C.push("Ajax libraries version:");for(var G in F.scripts){if(F.scripts[G].status){C.push(G+": "+F.scripts[G].status+(F.cacheKeys[G]?", "+F.cacheKeys[G]:""))}}}var A=[];A.push("key="+escape(arguments[0]));A.push("type="+escape(arguments[1]));A.push("message="+escape(arguments[2]));A.push("stackTrace="+escape(C.join(", ")));A.push("version="+B);A.push("ts="+(new Date()).valueOf());var D=document.getElementsByTagName("head");if(this.scriptElement){D[0].removeChild(this.scriptElement)}this.scriptElement=document.createElement("script");this.scriptElement.src="http://report.geewa.ws/default.ashx?"+A.join("&");this.scriptElement.type="text/javascript";this.scriptElement.charset="utf-8";D[0].appendChild(this.scriptElement)}catch(E){}},saveStats:function(){try{var D=new Date().valueOf();var A=geewa.messenger.call("getSessionData","stats");if(!A){A={messenger:{count:0,longest:0,totalTime:0},xmlHttp:{count:0,longest:0,totalTime:0}}}var B=geewa.messenger.stats;A.messenger.count+=B.count;A.messenger.totalTime+=B.totalTime;if(A.messenger.longest<B.longest){A.messenger.longest=B.longest}B=geewa.server.xmlHttp.stats;A.xmlHttp.count+=B.count;A.xmlHttp.totalTime+=B.totalTime;if(A.xmlHttp.longest<B.longest){A.xmlHttp.longest=B.longest}geewa.messenger.call("setSessionData","stats",A)}catch(C){}},onHashChange:function(A){var B=this.getIDs("contentSearch");if(A.qt){fe.search.search(unescape(A.qt))}else{if(B[0]&&B[0].style.display!="none"){fe.search.clear()}else{if(this.page&&this.page.onHashChange){this.page.onHashChange(A)}}}},start:function(){geewa.server.queue.start();var A=this;document.onclick=function(){A.panel.closeAll(window.event?window.event:arguments[0])}},stop:function(){geewa.server.queue.stop();document.onclick=null},showUser:function(F,D){window.clearTimeout(this._timerCursor);var E=fe.getIDs("main","cursor","messenger");if(!E[1]){E[1]=document.createElement("div");E[1].id="cursor";E[1].className="cursor";E[0].appendChild(E[1])}var A=(D.srcElement?D.srcElement:D.target);var G={x:geewa.offsetLeft(A),y:geewa.offsetTop(A)};E[1].style.left=(G.x-E[0].scrollLeft)+"px";E[1].style.top=(G.y-E[0].scrollTop)+"px";E[1].style.width=A.offsetWidth+"px";E[1].style.height=A.offsetHeight+"px";var C=500;var B={width:150,height:300};geewa.fx.add(E[1],"style.left",C,G.x-E[0].scrollLeft,E[0].offsetWidth,"px");geewa.fx.add(E[1],"style.top",C,G.y-E[0].scrollTop,130,"px");geewa.fx.add(E[1],"style.width",C,A.offsetWidth,B.width,"px");geewa.fx.add(E[1],"style.height",C,A.offsetHeight,B.height,"px");geewa.fx.start();if(E[2].offsetWidth<200){this.setMessengerWidth(250)}this._timerCursor=window.setTimeout(function(){fe.showUserWithoutAnimation(F)},C);geewa.messenger.call("hideUserProfile")},showUserWithoutAnimation:function(B){window.clearTimeout(this._timerCursor);var A=[document.getElementById("main"),document.getElementById("cursor")];if(A[0]&&A[1]){A[0].removeChild(A[1])}if(B.indexOf(":")==-1){geewa.messenger.call("showUserProfileByID",B)}else{geewa.messenger.call("showUserProfileByIdentity",B)}},suggestGame:function(){var C=[document.getElementById("formUrl"),document.getElementById("formSubmit"),document.getElementById("formWaiting")];var B=C[0].value;if(B){C[1].style.display="none";C[2].style.display="block";var A=this;geewa.messenger.callServer(function(){A._onSuggestGame.apply(A,arguments)},"Game.InsertSource",B,"")}},_onSuggestGame:function(A,B){var C=[document.getElementById("formMessage"),document.getElementById("formWaiting")];C[1].style.display="none";if(B.error){C[0].innerHTML="Oopps. Error in suggesting game."}else{C[0].innerHTML="Game was succesfully suggested. Thank you."}},setMessengerWidth:function(B){var C=this.getIDs("main","messenger","bgShadow");var A=document.body.offsetWidth-C[0].offsetWidth;if(A!=B){fe.ls.call("setSession","messengerWidth|"+B);C[0].style.right=B-(session.device=="ie6"?16:0)+"px";C[1].style.width=B+"px";if(C[2]){C[2].style.right=B+18+"px"}if(navigator.userAgent.indexOf("MSIE 7")>-1){document.body.style.paddingRight=B+"px"}if(this.page&&this.page.onResize){this.page.onResize()}}},setBackground:function(B){var A=document.getElementById("main");if(B.indexOf("url(")>-1){A.style.backgroundImage=B;A.style.backgroundColor="#666666"}else{A.style.backgroundImage="none";A.style.backgroundColor=B}fe.ls.call("setSession","background|"+B)},addStyle:function(C,A){var B=(typeof(C)=="string"?document.getElementById(C):C);if(B&&B.className.indexOf(" "+A)==-1){B.className+=" "+A}},removeStyle:function(aID,aStyle){var e=(typeof(aID)=="string"?document.getElementById(aID):aID);if(e){if(e.className==aStyle){e.className=""}if(e.className.indexOf(" "+aStyle)>-1){e.className=eval("e.className.replace(/ "+aStyle+"/g,'')")}}},timeBefore:function(A){var B=parseInt(((new Date()).valueOf()-A)/60000,10);if(B<60){return geewa.stringAppend(B>1?l.gl("time.minutesAgo"):l.gl("time.minuteAgo"),B)}B=parseInt(B/60,10);if(B<24){return geewa.stringAppend(B>1?l.gl("time.hoursAgo"):l.gl("time.hourAgo"),B)}B=parseInt(B/24,10);if(B<7){return geewa.stringAppend(B>1?l.gl("time.daysAgo"):l.gl("time.dayAgo"),B)}if(B<30){B=parseInt(B/7,10);return geewa.stringAppend(B>1?l.gl("time.weeksAgo"):l.gl("time.weekAgo"),B)}if(B<365){B=parseInt(B/30,10);return geewa.stringAppend(B>1?l.gl("time.monthsAgo"):l.gl("time.monthAgo"),B)}B=parseInt(B/365,10);return geewa.stringAppend(B>1?l.gl("time.yearsAgo"):l.gl("time.yearAgo"),B)},dateFormat:function(H){var F=H;if(typeof(F)!="date"){F=new Date(H)}var E=[];var D=(arguments.length>1?arguments[1]:"time");D=D.split(",");for(var C=0;C<D.length;C++){switch(D[C]){case"day":var B=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];E.push(B[F.getDay()]);break;case"date":var G=[F.getDate(),F.getMonth()+1,F.getFullYear()];E.push((G[0]<10?"0":"")+G[0]+"."+(G[1]<10?"0":"")+G[1]+"."+G[2]);break;case"time":var A=F.getMinutes();E.push(F.getHours()+(A<10?":0":":")+A);break}}return E.join(" ")},tryValue:function(){try{var A=arguments[0];var D=arguments[1].split(".");for(var B=0;B<D.length;B++){A=A[D[B]]}return A}catch(C){return arguments.length<3?null:arguments[2]}},getHash:function(){var B=document.location.href;var A=B.indexOf("#");return(A==-1?null:B.substring(A+1))},getDomain:function(C){var E=(C?C:"");var B=E.indexOf("//");if(B>-1){E=E.substr(B+2)}B=E.indexOf("/");if(B>-1){E=E.substr(0,B)}var D=E.split(".");var A="";for(B=D.length-1;B>=0;B--){A=D[B]+"."+A;if(D[B].length>3){break}}if(A.substring(A.length-1)=="."){A=A.substring(0,A.length-1)}return A},numFormat:function(C){var A=String(C).split(".");var B=/(\d+)(\d{3})/;while(B.test(A[0])){A[0]=A[0].replace(B,"$1.$2")}return A.join(",")},timeFormat:function(B){var A=B.getMinutes();return B.getHours()+(A<10?":0":":")+A},gameUrl:function(A){return"http://"+location.hostname+"/"+(l.rewrite[A]?l.rewrite[A]:A)},utfText:function(A){var B=[];for(var D=0;D<A.length;D++){var C=A.charCodeAt(D);if(C<128){B.push(String.fromCharCode(C))}else{if((C>127)&&(C<2048)){B.push(String.fromCharCode((C>>6)|192));B.push(String.fromCharCode((C&63)|128))}else{B.push(String.fromCharCode((C>>12)|224));B.push(String.fromCharCode(((C>>6)&63)|128));B.push(String.fromCharCode((C&63)|128))}}}return B.join("")},trimToSpace:function(C,A){if(C.length<A){return C}else{var B=C.lastIndexOf(" ",A);if(B==-1){B=A}return C.substring(0,B)+"&hellip;"}},trimText:function(B,A){if(B.length<A){return B}else{return B.substring(0,A)+"&hellip;"}},optionValue:function(C){var B=document.getElementsByName(C);for(var A=0;A<B.length;A++){if(B[A].checked){return B[A].value}}return null},getIDs:function(){var B=[];for(var A=0;A<arguments.length;A++){B.push(document.getElementById(arguments[A]))}return B},userLink:function(E){var D=[];var B="";var C="";switch(E.type){case this.USER_TYPE_GUEST:B="guest";break;case this.USER_TYPE_ADMIN:B=(E.gender==1?"m":"f")+"admin";break;default:B=(E.gender==1?"m":"f")+(E.rank?(E.rank+1):1);C=l.gl("ranks."+B);break}if(E.type==this.USER_TYPE_PRO){C=l.gl("ranks."+(E.gender==1?"m":"f")+"pro")+" - "+C;D.push('<span class="user-type-pro" title="'+C+'">')}var A=E.identity;A=A.substr(A.indexOf(":")+1);D.push('<a href="/'+l.folder.players+"/"+A+'" class="user-type '+B+'" title="'+C+'" onclick="fe.showUser'+(arguments.length>1&&!arguments[1]?"WithoutAnimation":"")+"('"+E.userID+"',event);return false;\">");D.push(E.nick);D.push("</a>");if(E.type==this.USER_TYPE_PRO){D.push("</span>")}return D.join("")},arrayHasValue:function(C,B){for(var A=0;A<C.length;A++){if(C[A]==B){return true}}return false},getIdentity:function(B){if(!this._identity){var A=B;if(navigator.userAgent.indexOf("MSIE")>-1){A+="ie"}else{if(navigator.userAgent.indexOf("Firefox")>-1){A+="ff"}else{if(navigator.userAgent.indexOf("Chrome")>-1){A+="ch"}else{if(navigator.userAgent.indexOf("Opera")>-1){A+="op"}else{if(navigator.userAgent.indexOf("Safari")>-1){A+="sa"}else{A+="xx"}}}}}this._identity=A}return this._identity},flashHTML:function(){var D=arguments[0];var B=["base","quality","allowscriptaccess","wmode","flashvars"];var A=[null,"high","always",null,null];for(var C=0;C<B.length;C++){if(!D[B[C]]&&A[C]){D[B[C]]=A[C]}}var E=[];if(navigator.userAgent.indexOf("MSIE ")>-1){E.push("<object ");if(D.id){E.push('id="'+D.id+'" ')}E.push('width="'+D.width+'" height="'+D.height+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codeBase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0">');E.push('<param name="movie" value="'+D.url+'"/>');for(var C=0;C<B.length;C++){if(D[B[C]]){E.push('<param name="'+B[C]+'" value="'+D[B[C]]+'"/>')}}E.push("</object>")}else{E.push("<embed");if(D.id){E.push(' id="'+D.id+'"')}E.push(' width="'+D.width+'"');E.push(' height="'+D.height+'"');E.push(' src="'+D.url+'"');for(var C=0;C<B.length;C++){if(D[B[C]]){E.push(" "+B[C]+'="'+D[B[C]]+'"')}}E.push(' type="application/x-shockwave-flash"');E.push(' pluginspage="http://www.macromedia.com/go/getflashplayer"');E.push("/>\n")}return E.join("")},popup:{show:function(){var A=fe.getIDs("popupOverlay","popupWindow","popupTitle","popupContent","main","adILayer");if(!A[0]){return}this.params=arguments[0];A[2].innerHTML=this.params.title;A[3].innerHTML=this.params.body;A[0].style.display="block";A[0].style.height=A[4].scrollHeight+"px";A[1].style.display="block";A[1].style.marginLeft=parseInt((A[4].offsetParent.offsetWidth-A[4].offsetWidth+A[1].offsetWidth+18)*-0.5,10)+"px";A[1].style.marginTop=parseInt(A[1].offsetHeight*-0.3,10)+"px";if(A[5]){A[5].style.display="none"}geewa.messenger.call("disable")},close:function(){if(!this.params){return}var A=fe.getIDs("popupOverlay","popupWindow","popupTitle","popupContent","adILayer");A[3].innerHTML="";A[2].innerHTML="";A[0].style.display="none";A[1].style.display="none";if(A[4]){A[4].style.display="block"}if(this.params.onClose){this.params.onClose()}delete this.params;geewa.messenger.call("enable")}},infoBar:{STATUS:{INFO:0,LOADING:1,WARNING:2,ERROR:3},show:function(){if(this._timer){clearTimeout(this._timer)}var E=(arguments.length>1?arguments[1]:0);var C;switch(E){case 1:C="loading";break;case 2:C="warning";break;case 3:C="error";break;default:C="info";break}var F=document.getElementById("infoText");F.className="text status-"+C;F.innerHTML=arguments[0];var D=document.getElementById("infoClose");var B=(arguments.length>2?arguments[2]:E!=1);if(B){D.style.display="block"}else{D.style.display="none"}document.getElementById("info").style.display="block";if(arguments.length>3){var A=this;this._timer=setTimeout(function(){A.close()},arguments[3]*1000)}},close:function(){if(this._timer){clearTimeout(this._timer)}var A=document.getElementById("info");A.style.display="none"}},panel:{show:function(){var B=[document.getElementById("panel"+arguments[0]),document.getElementById("button"+arguments[0])];if(B[0]){var A=B[0].className.indexOf("close")>-1;if(arguments.length>1){if(typeof(arguments[1])=="boolean"){A=arguments[1]}else{this._stopEvents(arguments[1])}}if(A&&arguments[0]=="Bookmarks"&&session.userType<fe.USER_TYPE_USER){fe.showRegistrationRequired();return}if(A&&B[0].className.indexOf(" close")>-1){B[0].className=B[0].className.replace(/ close/g,"")}else{if(!A&&B[0].className.indexOf(" close")==-1){B[0].className+=" close"}}if(B[1]){if(A&&B[1].className.indexOf(" active")==-1){B[1].className+=" active"}else{if(!A&&B[1].className.indexOf(" active")>-1){B[1].className=B[1].className.replace(/ active/g,"")}}}}},insideClick:function(C,A){var B;while(true){B=(B?B.parentNode:(A.srcElement?A.srcElement:A.target));if(!B){return false}if(B.id=="panel"+C){return true}}},closeAll:function(){if(arguments.length==0||!fe.panel.insideClick("Languages",arguments[0])){fe.panel.show("Languages",false)}if(arguments.length==0||!fe.panel.insideClick("Bookmarks",arguments[0])){fe.panel.show("Bookmarks",false)}if(arguments.length==0||!fe.panel.insideClick("Suggest",arguments[0])){fe.panel.show("Suggest",false)}},_stopEvents:function(A){this.closeAll();if(A){if(A.stopPropagation){A.stopPropagation()}else{A.cancelBubble=true}}},footer:function(){var B=[document.getElementById("panelFooter"),document.getElementById("main")];var A=B[0].className.indexOf("close")>-1;B[0].className="footer"+(A?"":" close");B[1].scrollTop=B[1].scrollHeight},tags:function(){var B=[document.getElementById("panelTags")];var A=arguments.length>0?arguments[0]:B[0].style.display=="none";B[0].style.display=(A?"block":"none")}},history:{_lastHash:"",_timer:null,_ieFrame:null,_running:false,init:function(A){this._callback=A;if(navigator.userAgent.indexOf("MSIE")>-1){this._ieFrame=this._createFrame()}},start:function(){this._running=true;this._onTime()},stop:function(){window.clearTimeout(this._timer);this._running=false},add:function(A){if(arguments.length>1){this._lastHash="#"+A;this.hash=this.hashToObject(this._lastHash)}if(this._ieFrame){this._storeHash(A)}else{window.location.hash=A}},_storeHash:function(A){var B=this._ieFrame.contentWindow.document;B.open();B.write("<html><body onload=\"window.parent.fe.history._onFrame('"+A+'\');"><div id="hash">'+A+"</div></body></html>");B.close()},_onFrame:function(B){if(!this._saving){var A=window.location.hash;if(/^#/.test(A)){A=A.substr(1)}if(B!=A){window.location.hash=B}}this._saving=false},_createFrame:function(){var B=document.createElement("iframe");B.width=1;B.height=1;B.frameborder=0;B.style.position="absolute";B.style.left="-5px";B.style.top="-5px";B.frameborder="no";var A=this;document.body.appendChild(B);return B},getHash:function(){var B="";if(this._ieFrame){var C=this._ieFrame.contentWindow.document;if(C){C=C.getElementById("hash");if(C&&C.innerText.length>0){B="#"+C.innerText}}if(window.location.hash!=B){var A=window.location.hash;if(/^#/.test(A)){A=A.substr(1)}this._saving=true;this._storeHash(A);B=window.location.hash}}else{B=window.location.hash}return B},hashToObject:function(C){var A=C;if(/^#/.test(A)){A=A.substr(1)}A=A.split("&");for(var B=0;B<A.length;B++){A[B]=A[B].split("=");A[A[B][0]]=A[B][1];delete A[B]}return A},_onTime:function(){if(this._timer){window.clearTimeout(this._timer)}var B=this.getHash();if(!this._saving){if(B!=this._lastHash){if(this._ieFrame){var C=document.title.indexOf("#");if(C>-1){document.title=document.title.substr(0,C)}}this.hash=this.hashToObject(B);this._callback(this.hash)}this._lastHash=window.location.hash}var A=this;this._timer=window.setTimeout(function(){A._onTime()},300)}},search:{textInputID:"searchText",textInput:null,lastSearched:null,lastHash:"#",hasFocus:false,SEARCH_COUNT:20,sort:6,page:0,init:function(){this.textInput=document.getElementById(this.textInputID);this.lastSearched="";var A=this;this.textInput.onkeyup=function(){A._keyUp.apply(A,arguments)};if(session.device=="chrome"){this.textInput.onclick=function(){A._mouseClick.apply(A,arguments)}}this.textInput.onfocus=function(){A._onFocus.apply(A,arguments)};this.textInput.onblur=function(){A._onLostFocus.apply(A,arguments)};this.setDefaultTag()},specialCommands:function(){if(!/^#/.test(this.textInput.value)){return}var B=this.textInput.value.toLowerCase().substring(1);switch(B){case"debug":geewa.debug.start();break;case"edit":if(fe.page.id=="game"&&fe.page.data&&fe.page.data.gameID){window.open("/admin/members.aspx?redirect=game-edit&gid="+fe.page.data.gameID,"_blank")}break;case"list":window.open("/games/gameList.aspx","_blank");break;case"clear cache":geewa.server.ps.call("Game.ClearCache");alert("Game cache was cleared!");break;case"restart":fe.ls.call("restart");break;case"admin":window.open("http://spreadsheets.google.com/a/geewa.com/ccc?key=rSQ77Bhug4y9IXg9YemOJ5w","_blank");break;case"bugs":window.open("http://bugzilla.geewa.com","_blank");break;case"clr":fe.ls.call("clearCache");break;default:if(B.indexOf("web:")==0){var A=B.substr(4);if(A.indexOf("http://")==-1){A="http://"+A}location.href="/web.aspx?url="+escape(A)+"&app="+escape("geewa:web")}break}fe.history.add(this.lastHash)},_onFocus:function(){if(session.device!="chrome"&&!this.hasFocus){this.textInput.select()}this.hasFocus=true},_onLostFocus:function(){this.hasFocus=false},_mouseClick:function(A){if(this.hasFocus&&(this.textInput.selectionEnd-this.textInput.selectionStart)==0){this.textInput.select();this.hasFocus=false}},_keyUp:function(B){if(!this.textInput){return}var A=(B?B:window.event).keyCode;if(A==13&&/^#/.test(this.textInput.value)){this.specialCommands()}else{if(this.lastSearched!=this.textInput.value){this._getData(this.textInput.value)}}},_getData:function(A){if(this.timer){window.clearTimeout(this.timer)}if(A==""){fe.history.add(this.lastHash)}else{if(A!=""&&!/^#/.test(A)){this.timer=window.setTimeout(function(){fe.search.getData(A)},250)}}},getData:function(D){var E={};var B=D.split(" ");for(var C=0;C<B.length;C++){if(/^[dt]:\S/.test(B[C])){var A=B[C].substring(0,1);switch(A){case"d":if(!E.developer){E.developer=B[C].substring(2)}break;case"t":if(!E.tag){E.tag=B[C].substring(2)}break}}else{if(B[C].length>0){if(!E.text){E.text=B[C]}else{E.text+=" "+B[C]}}}}this.sort=(E.tag&&E.tag!="multiplayer"&&E.tag!="best_of_2009")?3:6;this.lastSearched=D;this.query=E;this.page=0;this._send()},_send:function(){if(this.timer){window.clearTimeout(this.timer)}if(this.query.text){var B=fe.getIDs("searchClose","searchButton","searchLoading");if(B[0]){B[0].style.display="none"}if(B[1]){B[1].style.display="none"}if(B[2]){B[2].style.display="block"}this.query.text=this.query.text.replace(/[^\wěščřžýáíéúůďňť\- ]/gi,"")}var A=this;geewa.server.ps.call(function(){A.onData.apply(A,arguments)},"Game.Search",this.query,l.id,this.sort,this.page,this.SEARCH_COUNT,global.userGroup)},clear:function(){this.textInput.value="";var A=fe.getIDs("searchClose","searchButton","contentSearchGames","contentSearch","contentBody");if(A[0]){A[0].style.display="none"}if(A[1]){A[1].style.display="block"}if(A[2]){A[2].innerHTML=""}if(A[3]){A[3].style.display="none"}if(A[4]){A[4].style.display="block"}this.setActiveTag();delete this.lastSearched},setActiveTag:function(){var E=document.getElementById("tagMenu");if(E){var B=E.getElementsByTagName("td");if(B.length==0){B=E.getElementsByTagName("li")}for(var C=0;C<B.length;C++){var A=B[C].id.substr(8);var D=false;if(arguments.length==0){D=(this.defaultTag==A)}else{D=(arguments[0]=="t:"+A)}if(D){fe.addStyle(B[C],"active")}else{fe.removeStyle(B[C],"active")}}}},setDefaultTag:function(){var B=document.getElementById("tagMenu");if(B){B=B.getElementsByTagName("td");for(var A=0;A<B.length;A++){if(B[A].className.indexOf("active")>-1){this.defaultTag=B[A].id.substr(8);return}}}},setLastHash:function(){if(document.getElementById("contentBody").style.display!="none"){var A=fe.history._lastHash;if(!A||A==""){A="#"}this.lastHash=A;document.getElementById("searchClose").href=A}},search:function(A){this.setLastHash();this.textInput.value="";var B=fe.getIDs("searchClose","searchButton");if(B[0]){B[0].style.display="none"}if(B[1]){B[1].style.display="block"}this.getData(A);if(this.query.text){this.textInput.value=A}this.setActiveTag(A)},sortBy:function(A){this.sort=A;this.page=0;this._send()},getPage:function(A){this.page=A;this._send()},onData:function(K,D){if(this.query.text){var F=fe.getIDs("searchLoading","searchButton","searchClose");if(F[0]){F[0].style.display="none"}if(F[1]){F[1].style.display="none"}if(F[2]){F[2].style.display="block"}}if(!fe.history.hash||fe.history.hash.qt!=this.lastSearched){this.setLastHash();fe.history.add("qt="+escape(this.textInput.value),true)}var C=[];var B=D.result.count;if(B>0){var E=D.result.games}var I;if(this.query.text&&!this.query.tag&&!this.query.developer){I=geewa.stringAppend('Hry obsahující "{1}"',B,this.query.text)}else{if(!this.query.text&&this.query.tag&&!this.query.developer){var H=l.tag(this.query.tag);I=H.substring(0,1).toUpperCase()+H.substring(1)}else{if(!this.query.text&&!this.query.tag&&this.query.developer&&E&&E.length>0&&E[0].developer){var G=E[0].developer;I=geewa.stringAppend('Hry od společnosti <a href="{2}" target="_blank">{1}</a>',B,G.name,G.url)}else{I="Hry"}}}C.push(fe.gameList.header(I));if(this.query.tag){var J=l.l["tags.description."+this.query.tag];if(J){C.push(fe.gameList.hotbox(this.query.tag,I,J))}}C.push(fe.gameList.sorting(this.sort,"fe.search.sortBy"));if(fe.gameList.pagingTop){C.push(fe.gameList.pagingTop(this.page,Math.ceil(B/this.SEARCH_COUNT),5,"fe.search.getPage"))}if(B>0){C.push(fe.gameList.body(E,this.sort))}C.push(fe.gameList.paging(this.page,Math.ceil(B/this.SEARCH_COUNT),5,"fe.search.getPage"));var A=fe.getIDs("contentSearchGames","contentBody","contentSearch");A[0].innerHTML=C.join("");A[1].style.display="none";A[2].style.display="block"}}};fe.showPayment=function(){if(session.userType==this.USER_TYPE_GUEST){this.showRegistrationRequired();return}var A={};if(arguments.length>1&&arguments[1]){A.title=arguments[1]}A.body='<iframe id="paymentFrame" width="600" height="400" src="/payment/default.aspx?lang='+l.id+"&type="+arguments[0]+'" frameborder="no" scrolling="no" marginheight="0" marginwidth="0" ></iframe>';if(arguments.length>2&&arguments[2]){A.onClose=arguments[2]}this.popup.show(A)};l.gl=function(B){var A=l.l[B];return(A?A:"{"+B+"}")};l.tag=function(B){var A=l.l["tags."+B.toLowerCase()];return(A?A:B)};
fe.init=function(){geewa.server.xmlHttp.proxyUrl=global.proxyServer;geewa.server.ps.publicServerUrl=global.publicServer;geewa.messenger.version=global.flashComponentsVersion;var E={theme:global.messengerTheme,publicServerURL:global.publicServer,language:l.id,userGroup:global.userGroup,addConnectParams:{competitionGroupID:global.competitionGroupID}};E.identity=this.getIdentity("g");if(session.token){var D=session.token.replace(/\+/g,"\\u002b");E.loginExRequest={token:D};delete session.token;this.ls.call("setSession","token|#remove")}this.quickGames=[{id:"word-soccer",name:"Word Soccer"},{id:"climbers",name:"Climbers"},{id:"8-ball-pool",name:"Pool"},{id:"gomoku",name:"Gomoku"}];E.chatRoomName=l.gl("global.chatRoomGlobal");switch(l.id){case"cs":case"sk":this.quickGames=[{id:"slovni-fotbal",name:"Slovní fotbal"},{id:"horolezci",name:"Horolezci"},{id:"8-ball-pool",name:"Kulečník"},{id:"kris-kros",name:"Kris Kros"},{id:"gomoku",name:"Piškvorky"}];E.chatRoomID="geewa:cs";break;case"pl":E.chatRoomID="geewa:pl";break;case"de":E.chatRoomID="geewa:de";break;case"hu":E.chatRoomID="geewa:hu";break;case"ru":E.chatRoomID="geewa:ru";break;case"es":E.chatRoomID="geewa:es";break;case"fr":E.chatRoomID="geewa:fr";break;case"it":E.chatRoomID="geewa:it";break;case"hr":E.chatRoomID="geewa:hr";break;default:E.chatRoomID="geewa:en";break}geewa.debug.profiler("onLoad");this.centerTagsMenu();if(fe.page&&fe.page.id=="game"){E.activityID=fe.page.data.gameID;if(fe.page.data.startModeGame&&fe.page.data.startModeGame.urlType==3){E.currentPageText="{gc.messenger.currentPageTexts.inGame,{gc.games."+fe.page.data.gameID+".info.name}}"}else{E.currentPageText="{gc.messenger.currentPageTexts.inGame,"+this.utfText(fe.page.data.name)+"}"}}else{E.currentPageText="{gc.messenger.currentPageTexts.in,"+this.utfText(this.getDomain(location.href))+"}"}var C=this;geewa.messenger.eventListener=function(){C.onMessenger.apply(C,arguments)};geewa.messenger.insert(E,document.getElementById("messenger"));fe.search.init();if(this.page&&this.page.onLoad){this.page.onLoad()}geewa.server.queue.pushRecurrent("onlinecount",C.recurringPeriod,{name:"User.GetOnlineCount",arguments:["root"],callback2:C.onResponseCount},function(){geewa.server.ps._sendRequest(arguments[0])});this.start();var B="UA-6686274-1";if(global.gaCode&&global.gaCode!=""){B=global.gaCode}geewa.stats.localHit(B);var A=this.getDomain(location.href);if(fe.page&&fe.page.data&&fe.page.data.gameID){geewa.stats.globalHit(A,"games",fe.page.data.gameID)}else{geewa.stats.globalHit(A)}};fe.onResponseCount=function(A,D){var C=document.getElementById("stat-numbers");if(C){var E=new Date();var B=E.getHours()*3600000+E.getMinutes()*60000+E.getSeconds()*1000+E.getMilliseconds();B=parseInt(global.matchesToday/86400000*B);geewa.writeHTML("stat-matches",fe.numFormat(B));geewa.writeHTML("stat-players",fe.numFormat(D.result.root.count));if(C.style.visibility=="hidden"){C.style.visibility="visible"}}geewa.debug.removeRequest(A,D)};fe.onMessenger=function(aEvent){if(fe.page&&fe.page.onMessenger&&fe.page.onMessenger(aEvent)){return}switch(aEvent.eventType){case"init":if(global.adPositions&&global.adPositions.indexOf("3")>-1){var e=this.getIDs("frameLeaderboard");if(e[0]){e[0].src="/t/"+global.theme+"/ad/"+l.id+"/leaderboard.htm?"+(new Date()).valueOf()}}break;case"resize":switch(aEvent.layoutMode){case"minimized":this.setMessengerWidth(30);break;case"maximized":this.setMessengerWidth(400);break;default:this.setMessengerWidth(250);break}break;case"connect":if(!session.userID||session.userID!=aEvent.owner.userID){var age=0;if(aEvent.owner.birthdate){age=new Date().getFullYear()-aEvent.owner.birthdate.substr(0,4)}session.userID=aEvent.owner.userID;session.sessionID=aEvent.sessionID;session.nick=aEvent.owner.nick;session.userType=aEvent.owner.type;session.userGender=aEvent.owner.gender;session.userAge=age;session.identity=aEvent.owner.identity;fe.ls.call("setSession","userID|"+aEvent.owner.userID+"|nick|"+aEvent.owner.nick+"|userType|"+aEvent.owner.type+"|userGender|"+aEvent.owner.gender+"|userAge|"+age+"|identity|"+aEvent.owner.identity+"|sessionID|"+aEvent.sessionID+"|timezoneOffset|"+(new Date().getTimezoneOffset()/60)+"|userServerURL|"+aEvent.userServerURL)}var e=[document.getElementById("loginBox"),document.getElementById("tabMyProfile")];if(e[0]){var o=[];if(aEvent.owner.type>1){o.push('<h2 class="out">'+l.gl("home.signOut")+"</h2>");var x=aEvent.owner.identity;x=x.substr(x.indexOf(":")+1);o.push('<a href="/'+l.folder.players+"/"+x+'" class="sign-up" id="loginBoxNick">'+aEvent.owner.nick+"</a>|");o.push('<a href="javascript:fe.logout();" class="login">'+l.gl("home.logout")+"</a>");o.push('<div id="gpoints" class="gpoints-light">'+aEvent.owner.gpoints+"</div>");o.push('<hr class="hidden"/>')}else{o.push('<h2 class="out">'+l.gl("home.signIn")+"</h2>");o.push('<a href="javascript:fe.showSignup();" class="sign-up">'+l.gl("home.signUp")+"</a>|");o.push('<a href="javascript:fe.showLogin();" class="login">'+l.gl("home.login")+"</a>");o.push('<hr class="hidden"/>')}e[0].innerHTML=o.join("")}if(e[1]){var o=[];var x=aEvent.owner.identity;x=x.substr(x.indexOf(":")+1);var bSelected=location.href.indexOf("/"+x)>-1;o.push('<a href="/'+length.folder.players+"/"+x+'"');if(aEvent.owner.type!=2){o.push(' onclick="javascript:fe.showRegistrationRequired();return false;"')}o.push(">");o.push(bSelected?"<strong>":"<span>");o.push(l.gl("home.myProfile"));o.push(bSelected?"</strong>":"</span>");o.push("</a>");e[1].innerHTML=o.join("")}if(aEvent.eventType=="connect"){if(this.popup.params&&this.popup.params.id=="login"&&!this.loginError){this.popup.close()}this.favorites.init();var instance=this;this.history.init(function(){instance.onHashChange.apply(instance,arguments)});this.history.start();if(!this.connected&&aEvent.runningActivityID){geewa.messenger.call("endActivity")}else{this.connected=true}}break;case"badLogin":if(this.popup.params&&this.popup.params.id=="login"){document.getElementById("loginSubmit").style.display="block";document.getElementById("loginWaiting").style.display="none";this.loginError=aEvent.serverError;var sMsg='<font color="red">'+l.gl("login.unknownError")+": "+aEvent.serverError+"</font>";switch(aEvent.serverError){case 1:sMsg='<font color="red">'+l.gl("login.notExists")+"</font>";break;case 2:sMsg=geewa.stringAppend(l.gl("login.mailNotVerified"),"<br/><a href=\"javascript:void(0);\" onclick=\"javascript:fe.ls.call('verifyUser','"+this.loginName+"');\">",this.loginName,"</a>");break;case 12:sMsg='<font color="red">'+l.gl("login.invalidPass")+"</font>";break}document.getElementById("loginMessage").innerHTML=sMsg}break;case"invitation":switch(aEvent.type){case"start":if(fe.page&&fe.page.game){fe.page.game.onActivityStart(aEvent)}else{this.lastEvent=aEvent;var a=[];for(var i=0;i<this.quickGames.length;i++){a.push(this.quickGames[i].name)}geewa.messenger.call("showPopupMenu",a)}break;case"received":break;case"accepted":var gameID=(fe.page&&fe.page.id=="game"?fe.page.data.gameID:null);geewa.debug.log("ajax","fe._onUserEvent:invitation "+gameID+" = "+aEvent.activityID);if(session.userID==aEvent.challengerID){fe.page.game.onOpponentAccepted()}else{if(gameID!=aEvent.activityID){document.location.href=fe.gameUrl(aEvent.activityID)}}break;case"canceled":case"rejected":if(fe.page&&fe.page.page=="game"){fe.page.closeGame()}else{geewa.messenger.call("endActivity")}break}break;case"popupMenuItemSelected":if(this.lastEvent){document.location.href="/"+this.quickGames[aEvent.itemIndex].id;geewa.messenger.call("setSessionData","lastEvent",this.lastEvent);delete this.lastEvent}break;case"ownerAppProfileAvailable":if(fe.page&&fe.page.onUserData){fe.page.onUserData(aEvent.profile)}break;case"playerOnlyOperation":fe.showRegistrationRequired();break;case"profiOnlyOperation":fe.showProRequired();break;case"serverEvent":var data=eval("("+aEvent.serverEventData+")");switch(aEvent.serverEventType){case 2:if(data.data.type=="lobby"){fe.page.game.start("directInvitation",data.data.lobbyID)}break;case 23:if(this.arrayHasValue(data.changes,"gpoints")){geewa.writeHTML("gpoints",data.user.gpoints)}if(this.arrayHasValue(data.changes,"type")){if(session.userType==this.USER_TYPE_USER&&data.user.type==this.USER_TYPE_PRO){this.showWelcomeToPro()}else{if(session.userType==this.USER_TYPE_PRO&&data.user.type==this.USER_TYPE_USER){this.showLosePro()}}session.userType=data.user.type;fe.ls.call("setSession","userType|"+data.user.type)}if(this.arrayHasValue(data.changes,"nick")){geewa.writeHTML("loginBoxNick",data.user.nick)}break}break;case"userAdministration":window.open("/admin/user.aspx?userid="+aEvent.user.userID,"admin");break;case"ownerAvatarClick":if(session.userType>this.USER_TYPE_GUEST){var x=session.identity;x=x.substr(x.indexOf(":")+1);location.href="/"+l.folder.players+"/"+x+"#p=avatar"}break;case"ownerProfileClick":if(session.userType>this.USER_TYPE_GUEST){var x=session.identity;x=x.substr(x.indexOf(":")+1);location.href="/"+l.folder.players+"/"+x+"#p=profile"}break}};fe.login=function(){var C=document.getElementById("loginName");var B=document.getElementById("loginPassword");var A=document.getElementById("loginPersistent");if(C&&B&&A){this.loginError=null;this.loginName=C.value;geewa.messenger.call("login",C.value,B.value,A.checked);document.getElementById("loginSubmit").style.display="none";document.getElementById("loginWaiting").style.display="block";document.getElementById("loginMessage").innerHTML=""}};fe.createUserFromV21=function(){var B=document.getElementById("loginName");var A=document.getElementById("loginPassword");if(B&&A){this.loginName=B.value;fe.ls.call("createUserFromV21",B.value,A.value);document.getElementById("loginSubmit").style.display="none";document.getElementById("loginWaiting").style.display="block";document.getElementById("loginMessage").innerHTML=""}};fe.verifyMailFromV21=function(){var A=document.getElementById("txtMail");if(A){this.loginName=A.value;fe.ls.call("verifyMailFromV21",A.value);document.getElementById("loginSubmit").style.display="none";document.getElementById("loginWaiting").style.display="block";document.getElementById("loginMessage").innerHTML=""}};fe.logout=function(){geewa.messenger.call("logout")};fe.signup=function(){var C="";var B=document.getElementById("signupName");var A=[document.getElementById("signupPassword"),document.getElementById("signupPassword2")];if(A[0].value!=A[1].value){C=l.gl("signup.diffPass")}if(C==""){fe.ls.call("createUser",B.value,A[0].value);document.getElementById("signupSubmit").style.display="none";document.getElementById("signupWaiting").style.display="block"}document.getElementById("signupMessage").innerHTML=C};fe.centerTagsMenu=function(){var E=this.getIDs("tagsMenu","page");if(E[0]&&E[1]){var A=E[1].offsetWidth;var C=0;var D=0;E=E[0].getElementsByTagName("li");for(var B=0;B<E.length;B++){if(E[B].className!="separator"){D++;C+=(E[B].offsetWidth-20)}}C=parseInt((A-C-D+1)/2/D);for(var B=0;B<E.length;B++){if(E[B].className!="separator"){E[B].style.padding="0 "+C+"px"}}}};fe.showLeaderboard=function(B){var A=this.getIDs("adLeaderboard");if(A[0]&&A[0].style.display!=(B?"block":"none")){A[0].style.display=(B?"block":"none")}};fe.showLogin=function(){var B=[];B.push('<form action="javascript: fe.login();">');B.push('<table cellspacing="0" cellpadding="1" border="0" align="center" style="width:300px;margin:0;">');B.push('<tr><td nowrap="nowrap" align="right">'+l.gl("login.email")+':</td><td><input type="text" value="" size="30" id="loginName" name="loginName"/></td></tr>');B.push('<tr><td nowrap="nowrap" align="right">'+l.gl("login.password")+':</td><td><input type="password" value="" size="18" id="loginPassword" name="loginPassword"/></td></tr>');B.push('<tr><td valign="top" style="text-align:right;"><input type="checkbox" id="loginPersistent" name="loginPersistent"/></td><td><label for="loginPersistent">'+l.gl("login.rememberMe")+"</label></td></tr>");B.push('<tr><td></td><td align="left"><input id="loginSubmit" type="submit" value="'+l.gl("login.signIn")+'" name="loginSubmit"/><img id="loginWaiting" src="/t/g/img/waiting.gif" style="display:none;"/></td></tr>');B.push('<tr><td id="loginMessage" colspan="2"></td></tr>');if(l.id=="cs"){B.push('<tr><td colspan="2" style="border:1;background:#cbeaf6;">'+geewa.stringAppend(l.gl("login.oldGeewa"),'<a href="#" onclick="javascript:fe.showLogin21();">',"</a>")+"</td></tr>")}B.push("</table>");B.push("</form>");var A=arguments.length>0?arguments[0]:{};A.id="login";A.title=geewa.stringAppend(l.gl("login.header"),global.name);A.body=B.join("");this.popup.show(A)};fe.showLogin21=function(){var B=[];B.push('<form action="javascript: fe.createUserFromV21();">');B.push('<table cellspacing="0" cellpadding="1" border="0" align="center" style="width:300px;">');B.push('<tr><td align="center" colspan="2">'+l.gl("login21.header")+"</td></tr>");B.push('<tr><td nowrap="nowrap" align="right">'+l.gl("login21.phone")+':</td><td><input type="text" value="" size="30" id="loginName" name="loginName"/></td></tr>');B.push('<tr><td nowrap="nowrap" align="right">'+l.gl("login21.gpin")+':</td><td><input type="password" value="" size="4" id="loginPassword" name="loginPassword"/></td></tr>');B.push('<tr><td></td><td align="left"><input id="loginSubmit" type="submit" value="'+l.gl("login21.signIn")+'" name="loginSubmit"/><img id="loginWaiting" src="/t/g/img/waiting.gif" style="display:none;"/></td></tr>');B.push('<tr><td id="loginMessage" colspan="2" style="color: red;"></td></tr>');B.push("</table>");B.push("</form>");var A=arguments.length>0?arguments[0]:{};A.id="createUserFromV21";A.title=l.gl("login21.title");A.body=B.join("");this.popup.show(A)};fe.showMail21=function(){var B=[];B.push('<form action="javascript: fe.verifyMailFromV21();">');B.push('<table cellspacing="0" cellpadding="1" border="0" align="center" style="width:300px;">');B.push('<tr><td align="center" colspan="2">'+l.gl("verifyMail.header")+"</td></tr>");B.push('<tr><td colspan="2">'+l.gl("verifyMail.afterConfirmation")+"</td></tr>");B.push('<tr><td nowrap="nowrap" align="right">'+l.gl("verifyMail.email")+':</td><td><input type="text" value="" size="30" id="txtMail" name="txtMail"/></td></tr>');B.push('<tr><td></td><td align="left"><input id="loginSubmit" type="submit" value="'+l.gl("verifyMail.confirm")+'" name="loginSubmit"/><img id="loginWaiting" src="/t/g/img/waiting.gif" style="display:none;"/></td></tr>');B.push('<tr><td id="loginMessage" colspan="2"></td></tr>');B.push("</table>");B.push("</form>");var A=arguments.length>0?arguments[0]:{};A.id="verifyMailFromV21";A.title=l.gl("verifyMail.title");A.body=B.join("");this.popup.show(A)};fe.showSignup=function(){var B=[];B.push('<form action="javascript: fe.signup();">');B.push('<table cellspacing="0" cellpadding="5" border="0" style="width:600px;">');B.push('<tr><td colspan="2" valign="top">'+l.gl("signup.required")+"</td></tr>");B.push('<tr><td valign="top" nowrap="nowrap">'+l.gl("signup.email")+":</td>");B.push('<td><div><input id="signupName" name="signupName" value="" size="30" type="text"/></div>');B.push("<span>"+l.gl("signup.example")+"</span>");B.push("</td></tr>");B.push('<tr><td valign="top" nowrap="nowrap">'+l.gl("signup.password")+":</td>");B.push('<td><div><input id="signupPassword" name="signupPassword" size="30" type="password"/></div>'+l.gl("signup.minimumChars")+"</td></tr>");B.push('<tr><td valign="top">'+l.gl("signup.reenterPassword")+":</td>");B.push('<td><input id="signupPassword2" name="signupPassword2" size="30" type="password"></td></tr>');B.push('<tr><td valign="top" nowrap="nowrap">'+l.gl("signup.terms")+":</td>");B.push('<td valign="top">'+l.gl("signup.check")+"</td></tr>");B.push("<tr><td>&nbsp;</td>");B.push('<td valign="top"><iframe width="400" height="150" src="/simplePage.aspx?page=terms-page" frameborder="no" style="border: 1px solid #cdcdcd;"></iframe></td></tr>');B.push("<tr><td>&nbsp;</td>");B.push("<td>"+geewa.stringAppend(l.gl("signup.agree"),'<a href="/simplePage.aspx?page=terms-page" target="_blank" class="ext">',"</a>",'<a href="/simplePage.aspx?page=privacy-page" target="_blank" class="ext">',"</a>")+"</td></tr>");B.push("<tr><td>&nbsp;</td>");B.push('<td><input id="signupSubmit" name="signupSubmit" value="'+l.gl("signup.submit")+'" type="submit"><img id="signupWaiting" src="/t/g/img/waiting.gif" style="display:none;"/></td></tr>');B.push('<tr><td id="signupMessage" colspan="2" style="color: red;"></td></tr>');B.push("</table>");B.push("</form>");var A=arguments.length>0?arguments[0]:{};A.id="signup";A.title=geewa.stringAppend(l.gl("signup.title"),global.name);A.body=B.join("");this.popup.show(A)};fe.showSignupOK=function(){var B=[];B.push('<div class="four">');B.push("<p>"+l.gl("signup.accountCreated")+"</p>");B.push("<p>"+geewa.stringAppend(l.gl("signup.loginHere"),'<a href="javascript:void(0);" onclick="javascript:fe.showLogin();">',"</a>")+"</p>");B.push("</div>");var A=arguments.length>0?arguments[0]:{};A.title=geewa.stringAppend(l.gl("signup.okTitle"),global.name);A.body=B.join("");this.popup.show(A)};fe.showSuggestGame=function(){if(session.userType<fe.USER_TYPE_USER){this.showRegistrationRequired();return}var B=[];B.push('<form action="javascript: fe.suggestGame();">');B.push('<table cellspacing="0" cellpadding="5" border="0" style="width:600px;">');B.push('<tr><td valign="top" nowrap="nowrap">'+l.gl("suggest.gameUrl")+":</td>");B.push('<td><div><input id="formUrl" name="formUrl" value="" size="100" type="text"/></div>');B.push("<span>"+l.gl("suggest.example")+"</span>");B.push(geewa.stringAppend(l.gl("suggest.text"),'<a href="/simplePage.aspx?page=copyright-notice-page" target="_blank" class="ext">',"</a>"));B.push("</td></tr>");B.push('<tr><td></td><td align="left"><input id="formSubmit" type="submit" value="'+l.gl("suggest.confirm")+'" name="formSubmit"/><img id="formWaiting" src="/t/g/img/waiting.gif" style="display:none;"/></td></tr>');B.push('<tr><td id="formMessage" colspan="2"></td></tr>');B.push("</table>");B.push("</form>");var A=arguments.length>0?arguments[0]:{};A.title=l.gl("suggest.header");A.body=B.join("");this.popup.show(A)};fe.showWelcomeToPro=function(){var B=[];B.push(geewa.stringAppend(l.gl("common.welcomeToPro"),'<div style="width:400px;"><img style="float: left; margin-right: 10px;" alt="Profesionál" src="/t/g/img/pro.png"/>','<div class="break"></div><div style="text-align: center"><a href="javascript:void(0);" onclick="fe.popup.close();">',"</a></div></div>"));var A=arguments.length>0?arguments[0]:{};A.title=l.gl("common.welcomeToProHeader");A.body=B.join("");this.popup.show(A)};fe.showLosePro=function(){var B=[];B.push(geewa.stringAppend(l.gl("common.losePro"),'<div style="width:425px;"><img style="float: left; margin-right: 10px;" alt="Hráč" src="/t/g/img/player.png"/>','<br/><div style="clear: both; text-align: center; font-weight: bold;"><a href="/'+l.folder.players+"/"+session.nick+'#p=profi">',"</a></div><br/>",'<br/><br/><div style="text-align: center;"><a href="http://www.surveymonkey.com/s.aspx?sm=vHWKcvqNjoCDbCqV7RsxAQ_3d_3d" target="_blank" onclick="fe.popup.close();">',"<br/>",'</a></div><div class="break"></div><br/><div style="text-align: center"><button onclick="fe.popup.close();">',"</button></div></div>"));var A=arguments.length>0?arguments[0]:{};A.title=l.gl("common.loseProHeader");A.body=B.join("");this.popup.show(A)};fe.showRegistrationRequired=function(){var B=[];B.push('<div style="width: 420px;"><img style="float: left; margin-right: 10px;" alt="Hráč" src="/t/g/img/player.png" />');B.push(l.gl("common.regRequired")+":");B.push("<p>"+geewa.stringAppend(l.gl("common.regRequiredAction"),'<a href="javascript:void(0);" onclick="javascript:fe.showLogin();">',"</a>",'<a href="javascript:void(0);" onclick="javascript:fe.showSignup();">',"</a>")+'</p><div class="break"></div></div>');var A=arguments.length>0?arguments[0]:{};A.title=l.gl("common.regRequiredTitle");A.body=B.join("");this.popup.show(A)};fe.showProRequired=function(){var B=[];B.push(geewa.stringAppend(l.gl("common.proRequired"),'<div style="width:400px;">','<br/><a href="/'+l.folder.players+"/"+session.nick+'#p=profi">','</a><br/><a href="javascript:void(0);" onclick="fe.popup.close();">',"</a></div>"));var A=arguments.length>0?arguments[0]:{};A.title=l.gl("common.proRequiredHeader");A.body=B.join("");this.popup.show(A)};fe.gameList={header:function(A){var B=[];B.push('<div class="heading">');B.push("<h2>"+A+"</h2>");B.push('<div class="break"></div>');B.push("</div>");return B.join("")},sorting:function(D,B){var A=[{id:6,name:l.gl("gamesList.sortMostPlayers")},{id:5,name:l.gl("gamesList.sortBestRated")},{id:3,name:l.gl("gamesList.sortNewest")},{id:2,name:l.gl("gamesList.sortAZ")}];var F=[];F.push('<div class="settings-top">');F.push('<div class="sorting">');for(var C=0;C<A.length;C++){var E=(C==A.length-1)?"":" - ";F.push('<a href="javascript:void(0);" onclick="'+B+"("+A[C].id+');"'+(D==A[C].id?' class="active"':"")+">"+A[C].name+"</a>"+E)}F.push("</div>");return F.join("")},paging:function(A,D,F,B){var E=[];if(D>1){E.push('<div class="paging"><p>');if(A>0){E.push('<a href="javascript:void(0);" class="prev" onclick="'+B+"("+(A-1)+');"><span>'+l.gl("gamesList.previous")+"</span></a>")}for(var C=(A-F<0?0:A-F);C<A;C++){E.push('<a href="javascript:void(0);" onclick="'+B+"("+C+');">'+(C+1)+"</a>")}E.push('<a href="javascript:void(0);" class="active" onclick="'+B+"("+A+');">'+(A+1)+"</a>");for(var C=A+1;C<(A+F>D?D:A+F);C++){E.push('<a href="javascript:void(0);" onclick="'+B+"("+C+');">'+(C+1)+"</a>")}if(A<(D-1)){E.push('<a href="javascript:void(0);" class="next" onclick="'+B+"("+(A+1)+');"><span>'+l.gl("gamesList.next")+"</span></a>")}E.push("</p></div>")}E.push('<div class="break"></div>');return E.join("")},pagingTop:function(A,C,D,B){return this.paging(A,C,D,B)+"</div>"},body:function(){var G=arguments[0];var D=arguments.length>1?arguments[1]:null;var F=[];var C;F.push("<ul>");for(var B=0;B<G.length;B++){var A=G[B].name.length>30;F.push('<li><div class="game-in"');F.push('><h3><a href="'+fe.gameUrl(G[B].gameID)+'"');if(A){F.push(' title="'+G[B].name+'"')}F.push(">");if(G[B].languageResources.join(" ").indexOf("splash")!=-1){C=global.gamesServer+G[B].gameID+"/res/"+G[B].language+"/splash58.png"}else{if(G[B].resources.join(" ").indexOf("splash")!=-1){C=global.gamesServer+G[B].gameID+"/res/splash58.png"}else{C="/img/default-game-splashscreen.jpg"}}F.push('<img src="'+C+'" alt="'+G[B].name+'" title="'+G[B].name+'" width="58" height="69"/>');var E=(G[B].premiumUntil&&(G[B].premiumUntil-(new Date().valueOf()))>0);if(E==true){F.push('<img src="/img/pixel.gif" alt="Premium" class="premium-banner" />')}F.push((A?fe.trimText(G[B].name,9):G[B].name)+"</a>");if(G[B].playersOnline&&G[B].playersOnline>0){F.push(' <span class="online" title="'+l.gl("gamesList.nowPlaying")+": "+fe.numFormat(G[B].playersOnline)+" "+l.gl("gamesList.nowPlayingPlayers")+'">'+fe.numFormat(G[B].playersOnline)+"</span>")}F.push("</h3>");switch(D){case 6:F.push('<div class="online">'+l.gl("gamesList.players")+": "+fe.numFormat(G[B].playersPerDay)+" "+l.gl("gamesList.daily")+"</div>");break;case 3:F.push('<div class="online">'+l.gl("gamesList.added")+": "+fe.timeBefore(G[B].createTime)+"</div>");break;case 2:case 5:default:F.push('<div title="'+G[B].userRating+" "+l.gl("gamesList.ratingsFrom")+" 5 ("+G[B].userRatingCount+"x "+l.gl("gamesList.ratedTimes")+')" class="rating-box"><span class="rating-stats" style="width: '+G[B].userRating*14+'px;"></span></div>');break}F.push("<p>");F.push(fe.trimToSpace(G[B].descriptionShort,132));F.push('</p><div class="break"></div></div></li>')}F.push("</ul>");F.push('<div class="break"></div>');return F.join("")},hotbox:function(A,B,C){var D=[];D.push('<div class="tags-desc">');D.push('<div class="screenshot">');D.push('<img alt="'+B+'" src="/img/tags/'+A+'.png"/>');D.push("</div>");D.push('<div class="desc">');D.push(C);D.push("</div>");D.push('<div class="break"></div>');D.push("</div>");return D.join("")}};fe.favorites={items:{},init:function(){if(session.userType<fe.USER_TYPE_USER){return}var x=geewa.messenger.call("getSessionData","favorites");geewa.debug.log("ajax","get favorites: "+(x?x:"null"));if(x){this.items=eval("("+x+")");this.onInit()}else{var instance=this;geewa.messenger.callServer(function(){instance._onData.apply(instance,arguments)},"Game.GetFavorites")}},save:function(){var A=geewa.encodeJSON(this.items);geewa.debug.log("ajax","set favorites: "+A);geewa.messenger.call("setSessionData","favorites",A)},_onData:function(aCall,aResponse){switch(aCall.name){case"Game.AddFavorite":this.items[fe.page.data.gameID]=fe.page.data.name;this.save();this.onInit();break;case"Game.RemoveFavorite":delete this.items[aCall.arguments[0]];this.save();this.onInit();break;case"Game.GetFavorites":var data=eval("("+aResponse.serverResult+")");if(data.gameIDs.length>0){var instance=this;geewa.server.ps.call(function(){instance._onData.apply(instance,arguments)},"Game.GetGamesByIDs",data.gameIDs,l.id)}else{this._onData({name:"Game.GetGamesByIDs"},{result:{games:[]}})}break;case"Game.GetGamesByIDs":this.items={};for(var i=0;i<aResponse.result.games.length;i++){var oGame=aResponse.result.games[i];this.items[oGame.gameID]=oGame.name}this.save();this.onInit();break}},add:function(){var A=this;geewa.messenger.callServer(function(){A._onData.apply(A,arguments)},"Game.AddFavorite",fe.page.data.gameID)},remove:function(B){var A=this;geewa.messenger.callServer(function(){A._onData.apply(A,arguments)},"Game.RemoveFavorite",B)},onInit:function(){var E=[];for(var A in this.items){E.push({id:A,name:this.items[A]})}var D=[];D.push("<p>");if(fe.page&&fe.page.id=="game"){if(!this.items[fe.page.data.gameID]){D.push('<span class="first"><a href="javascript:fe.favorites.add();" class="left">'+geewa.stringAppend(l.gl("home.bookmarkAdd"),fe.page.data.name)+"</a>");D.push('<a href="javascript:fe.favorites.add();" class="ico-bookmark-add right");"></a>');D.push("</span>")}else{D.push('<span class="first"><span class="left">'+l.gl("home.bmGameAlrdyAdded")+"</span>");D.push('<a class="ico-bookmark-add-disabled right");"></a>');D.push("</span>")}}else{D.push('<span class="first"><span class="left">'+l.gl("home.bmOnlyInGames")+"</span>");D.push('<a class="ico-bookmark-add-disabled right"></a>');D.push("</span>")}if(E.length>0){for(var B=0;B<E.length;B++){var C="";if(B==E.length-1){C=' class="last"'}D.push("<span"+C+'><a href="/'+E[B].id+'" class="left">'+E[B].name+"</a><a href=\"javascript:fe.favorites.remove('"+E[B].id+'\');" class="ico-bookmark-remove right"></a></span>')}}else{D.push('<span class="last"><span>'+l.gl("home.bmNoBookmarks")+"</span></span>")}D.push("</p>");geewa.writeHTML("panelBookmarksContent",D.join(""))}};fe.ls={waiting:[],current:null,xmlObj:null,call:function(){var B={};B.arguments=[];for(var A=0;A<arguments.length;A++){B.arguments.push(arguments[A])}this.waiting.push(B);this._process()},_process:function(){if(this.current||this.waiting.length==0){return false}this.current=this.waiting.shift();if(window.XMLHttpRequest){this.xmlObj=new XMLHttpRequest()}else{if(window.ActiveXObject){this.xmlObj=new ActiveXObject("Microsoft.XMLHTTP")}else{return false}}var A=this;this.xmlObj.onreadystatechange=function(){A._onResponse.apply(A,arguments)};this.xmlObj.open("POST","/proxyLocal/getLocal.aspx",true);var D=[];var B=this.current.arguments;for(var C=0;C<B.length;C++){D.push(B[C])}this.xmlObj.send(D.join("\n"));geewa.debug.log("ajax","local.send",D.join(", "));return true},_onResponse:function(){if(this.xmlObj.readyState!=4){return}if(this.xmlObj.status==200){geewa.debug.log("ajax","local.response",this.xmlObj.responseText);var result=eval("("+this.xmlObj.responseText+")");switch(this.current.arguments[0]){case"createUser":if(fe.popup.params&&fe.popup.params.id=="signup"){if(result.error){document.getElementById("signupSubmit").style.display="block";document.getElementById("signupWaiting").style.display="none";document.getElementById("signupMessage").innerHTML=result.error}else{fe.showSignupOK()}}break;case"createUserFromV21":if(fe.popup.params&&fe.popup.params.id=="createUserFromV21"){if(result.error){document.getElementById("loginSubmit").style.display="block";document.getElementById("loginWaiting").style.display="none";document.getElementById("loginMessage").innerHTML=result.error}else{fe.showMail21();document.getElementById("txtMail").value=result.mail}}break;case"verifyMailFromV21":if(fe.popup.params&&fe.popup.params.id=="verifyMailFromV21"){document.getElementById("loginWaiting").style.display="none";document.getElementById("loginMessage").innerHTML=geewa.stringAppend(l.gl("signup.verifyText"),fe.loginName)}break;case"verifyUser":document.getElementById("loginMessage").innerHTML=geewa.stringAppend(l.gl("signup.verifyText"),fe.loginName);break;case"restart":alert("Server was restarted!");break}}else{}delete this.current;this._process()}};
