fe.page={id:"game",onLoad:function(){if(this.activity){geewa.lite.params.activityID=this.activity.activityID;if(this.activity.type==2){geewa.lite.params.challengeRoomID="facebook:"+this.activity.activityID}}if(this.game.id=="duel"||this.game.id=="duel2"||this.game.id=="ghost"){geewa.lite.params.emotion="#cpt:{gc.messenger.currentPageTexts.inGame,{gc.games."+this.data.gameID+".info.name}}"}else{geewa.lite.params.emotion="#cpt:{gc.messenger.currentPageTexts.inGame,"+fe.utfText(this.data.name)+"}"}if(!this.gameBackground&&fe.mode==fe.MODE_WEB){this.gameBackground="url(/img/bg/geewa-blue.png) repeat"}var D=["live","casino","download","girls","kids"];var A;for(var C=0;C<this.data.tags.length;C++){for(var B=0;B<D.length;B++){if(this.data.tags[C]==D[B]){A=D[B]}}if(A){break}}if(A&&fe.pt){fe.pt._setCustomVar(5,"section",A,3)}},onUserServerReady:function(){if(this.page=="friends"){this.friends.show()}else{if(!this.page){this.page="home"}}this.share.init();if(this.competitions&&this.competitions.length>0){if(this.activity.type==1||this.activity.type==3){this.league.data=fe.getFirstFromArray(this.competitions,"type","ghostLeague")}else{if(this.activity.type==2){this.league.data=fe.getFirstFromArray(this.competitions,"type","duelLeague")}}}fe.fixPageHeight()},onLikeButton:function(){geewa.server.user.call("Game.InsertToLikes",this.data.gameID);if(fe.pt){fe.pt._trackEvent("facebook","like",this.data.gameID)}},onFacebookSession:function(){var A=fe.getIDs("likeGame");if(A[0]){A[0].innerHTML='<fb:like href="'+fe.gameUrl(this.data.gameID)+'" layout="standard" show_faces="false" width="380" action="like" colorscheme="light" on-create="fe.page.onLikeButton();"></fb:like>';FB.XFBML.parse(A[0])}},onEventServer:function(E,B){if(E.events){for(var G=0;G<E.events.length;G++){var A=E.events[G];switch(A.type){case 95:if(A.data.roomID==geewa.lite.params.challengeRoomID){this.challenge.onCount(A.data.activeChallenges)}break;case 96:if(A.data.roomID==geewa.lite.params.challengeRoomID){for(var F=A.data.messages.length-1;F>-1;F--){var D=A.data.messages[F];if(D.messageID>this.challenge._lastMessageID){switch(D.type){case 1:switch(D.data.type){case"createChallenge":case"acceptChallenge":case"removeChallenge":this.challenge.onMessage(D);break}break}this.challenge._lastMessageID=D.messageID}}}break;case 100:if(A.data.activityID==this.activity.activityID&&A.data.groupID==global.competitionGroupID){var C=[fe.tryValue(A,"data.league.scores.daily.value"),fe.tryValue(A,"data.league.scores.overall.value")];if(C[1]){var H=fe.tryValue(A,"data.league.scores.overall.dataID");var I="fe.page.publish.score({score:"+C[1]+(H?",dataID:'"+H+"'":"")+",type:4,from:'menu'});";this.share.addLink({id:"overallHighscore",title:l.gl("livegames.share.alltimeHighscoreText")+" "+fe.numFormat(C[1]),onclick:"fe.page.share.close();"+I})}if(C[0]&&C[0]<C[1]){var H=fe.tryValue(A,"data.league.scores.daily.dataID");var I="fe.page.publish.score({score:"+C[0]+(H?",dataID:'"+H+"'":"")+",type:1,from:'menu'});";this.share.addLink({id:"dailyHighscore",title:l.gl("livegames.share.dailyHighscoreText")+" "+fe.numFormat(C[0]),onclick:"fe.page.share.close();"+I})}this.league.data.myProfile=A.data;if(this.page!="game"&&this.page=="league"){this.league.show()}}break;case 102:if(this.league){this.league.data.myProfile=A.data;if(this.page!="game"){if(this.page=="friends"){this.friends.show()}else{if(this.page=="league"){this.league.show()}}}}if(A.data.activityID==this.activity.activityID&&A.data.groupID==global.competitionGroupID){this.matchResult.data=A.data;if(this.page!="game"&&global.theme=="lg"){this.matchResult.show()}}break}}}if(this.game.call){if(!B.body&&B.json){B.body=geewa.encodeJSON(B.json)}this.game.call("handleServerEvents",B.body)}},onHashChange:function(B){geewa.debug.log("ajax","fe.page.game.onHashChange");if(fe.mode==fe.MODE_FACEBOOK_APP&&!this.initGameSize()){return}if(this.page=="game"&&B.p!="game"){this.closeGame(true)}if(B.invite){this.game.start({type:"external",mode:"join",lobbyID:B.invite})}else{if(B.p){if(B.p=="game"&&this.page!="game"&&this.activity&&(this.activity.type==1||this.activity.type==2)){while(true){if(session.user.type!=fe.USER_TYPE_PRO&&this.data.premiumUntil&&(new Date()).valueOf()<this.data.premiumUntil){var A=this;fe.showProRequired({onClose:function(){location.href="#p="+A.page}});break}if(B.m=="invite"){this.game.start({type:"external",mode:"invite"});break}if(B.m=="shoutout"){this.game.start({type:"external",mode:"shoutout"});break}if(B.m=="league"){if(session.user.type<fe.USER_TYPE_USER){var A=this;fe.showRegistrationRequired({onClose:function(){location.href="#p="+A.page}});break}if(fe.tryValue(this,"league.data.myProfile.league.left")===0){var A=this;fe.page.showMatchesLimit({onClose:function(){location.href="#p="+A.page}});break}if(B.duel){this.game.start({ghostDataID:B.duel})}else{this.game.start({type:"league"})}break}this.game.start();break}}else{if(this.game.id=="ganymede"&&(B.p=="game"||B.p=="results")&&session.user.type<fe.USER_TYPE_USER){var C=this.page;fe.showRegistrationRequired({onClose:function(){location.href="#p="+C}})}else{if(B.p!=this.page||(B.m&&B.p==this.page&&B.m!=this.pageMode)){if(B.m){this.showPage(B.p,B.m)}else{this.showPage(B.p)}}}}}}},getRoom:function(){if(this.activity&&(this.activity.type==1||this.activity.type==2)){return{id:"hry:"+this.data.gameID}}var C=["casino","action","puzzle","simulation","shooting","sport","arcade","czech"];for(var B=0;B<this.data.tags.length;B++){for(var A=0;A<C.length;A++){if(this.data.tags[B]==C[A]){return{id:"hry:tag:"+C[A]}}}}return null},onResize:function(){if(document.getElementById("__geewa_ad")){this.onResizeAd()}else{if(this.game._onResize){this.game._onResize()}}},onResizeAd:function(){var D=fe.getIDs("page","__geewa_ad","messenger","__geewa_ad_main");if(!(D[0]&&D[1])){return}var C=D[3].offsetWidth;var A=D[3].offsetHeight;var B=(typeof(window.innerWidth)=="undefined"?document.documentElement.clientWidth:window.innerWidth)-(D[2]?D[2].offsetWidth:0);var E=(fe.mode==fe.MODE_FACEBOOK_APP?767:(typeof(window.innerHeight)=="undefined"?document.documentElement.clientHeight:window.innerHeight));D[1].style.width=C+"px";D[1].style.height=A+"px";D[0].style.top=parseInt((E-A)/2,10)+"px";D[0].style.left=parseInt((B-C)/2,10)+"px";D[0].style.width=(parseInt(C)+10)+"px";if(D[0].style.visibility=="hidden"){D[0].style.visibility="visible"}},showPage:function(A){if(A!="game"&&A!="buy"){var B=fe.getIDs(this.page+"Body",this.page+"Tab",A+"Body",A+"Tab");if(B[0]){B[0].style.display="none";if(B[1]){fe.removeStyle(B[1],"active")}}if(B[2]){B[2].style.display="block";if(B[3]){fe.addStyle(B[3],"active")}}fe.fixPageHeight()}if(fe.page.challenge){fe.page.challenge.setListeners(A=="challenge"?2:1)}switch(A){case"game":if(this.game){if(arguments.length>1&&arguments[1]=="league"){this.game.start({type:"league"})}else{this.game.start()}}break;case"friends":this.friends.show();break;case"challenge":this.challenge.show();break;case"league":if(session.user.type===fe.USER_TYPE_GUEST||fe.tryValue(this,"league.data.myProfile")){this.league.show()}break;case"comments":this.comments.show();break;case"stats":this.stats.show();break;case"shop":this.shop.show();break;case"buy":if(this.game){this.game.buy()}break;case"bonus":this.bonus.show();case"results":if(arguments.length>1){this.game.results(arguments[1])}else{this.game.results()}break;case"rules":this.game.showRules();break;case"gameplay":this.game.showGameplay();break}if(A=="game"&&this.game.id=="window"){location.href="#p="+this.page}else{if(fe.refreshAds){fe.refreshAds(A=="home")}this.page=A;if(arguments.length>1){this.pageMode=arguments[1]}}},inviteFriends:function(){var C="http://"+global.domain+"/"+fe.page.data.gameID+(fe.mode===fe.MODE_FACEBOOK_APP?"?fb_sig_in_iframe=1&fb_sig_added=1":"");var E=global.facebookAppUrl+this.data.gameID+"?from=inviteFriends";while(true){if(this.activity.type==2){var D=l.replaceTokens(l.gl("livegames.share.inviteFriends.live"),'<a href="'+E+'">'+this.data.name+"</a>");break}if(this.activity.type==1||this.activity.type==3){var B=fe.tryValue(this.league,"data.myProfile.league.scores.overall.value");if(B){var D=l.replaceTokens(l.gl("livegames.share.inviteFriends.highscore"),fe.numFormat(B),'<a href="'+E+'">'+this.data.name+"</a>");break}}var D=l.replaceTokens(l.gl("livegames.share.inviteFriends.highscore"),'<a href="'+E+'">'+this.data.name+"</a>");break}D+='<fb:req-choice url="'+E+'" label="'+l.gl("livegames.share.inviteFriends.actionButton")+'" />';D=D.replace(/"/g,"&quot;");var G=[];G.push('<div id="fbmlContent" style="width:620px;">');G.push("<fb:serverfbml>");G.push('<script type="text/fbml">');G.push('<fb:fbml style="width:600px;">');G.push('<fb:request-form action="'+C+'"');G.push(' method="POST"');G.push(' invite="true"');G.push(' type="Live Games"');G.push(' content="'+D+'">');G.push('<fb:multi-friend-selector showborder="false" actiontext="'+l.replaceTokens(l.gl("livegames.share.inviteFriends.actionText"),this.data.name)+'" cols="4" rows="3" bypass="cancel" email_invite="false" exclude_ids=""></fb:multi-friend-selector>');G.push("</fb:request-form>");G.push("</fb:fbml>");G.push("<\/script>");G.push("</fb:serverfbml>");G.push("</div>");var F={};F.title=l.gl("livegames.share.inviteFriends.title");F.body=G.join("");fe.popup.show(F);FB.XFBML.parse(document.getElementById("fbmlContent"));var A=this;setTimeout(A._changeFBML,2000)},_changeFBML:function(){try{var A=document.getElementById("fbmlContent").getElementsByTagName("iframe");if(A.length>0){A[0].style.width="620px"}}catch(A){}},sendToChat:function(A){if(global.competitionGroupID=="2hry"||global.theme=="c"){var E=[];E.push('<div style="width:550px;">');E.push("1. "+l.gl("game.friends.invitationStep1")+":");var B="http://"+global.domain+"/"+fe.page.data.gameID+"#invite="+A+"&from=invite";E.push('<br/><input id="invitatitonUrl" type="text" value="'+B+'" onclick="this.select();" style="width: 540px;"/>');if(typeof(clipboardData)!="undefined"&&clipboardData.setData){E.push(' <input id="embed-button" type="button" value="Copy" onclick="clipboardData.setData(\'Text\',\''+B+"');\"/>")}E.push('<div style="margin-top: 15px;">2. '+l.gl("game.friends.invitationStep2")+"</div>");E.push('<div style="margin-top: 15px;">3. '+l.gl("game.friends.invitationStep3")+"</div>");E.push("</div>");var D={};D.title=l.gl("game.friends.invitationTitle");D.body=E.join("");var C=this.page;D.onClose=function(){fe.page.game.show()};fe.popup.show(D);document.getElementById("invitatitonUrl").select()}else{var E=[];E.push('<div style="width:550px;">');E.push("1. "+l.gl("game.friends.invitationStep1")+":");var B=global.facebookAppUrl+fe.page.data.gameID+"?invite="+A+"&from=fb-invite";E.push('<br/><input id="invitatitonUrl" type="text" value="'+B+'" onclick="this.select();" style="width: 540px;"/>');if(typeof(clipboardData)!="undefined"&&clipboardData.setData){E.push(' <input id="embed-button" type="button" value="Copy" onclick="clipboardData.setData(\'Text\',\''+B+"');\"/>")}E.push('<div style="margin-top: 15px;">2. '+l.gl("game.friends.invitationStep2")+":</div>");E.push('<div style="width:550px;height:320px;margin:15px 0;">');E.push('<div id="chatWindowLoading"><img src="/img/loader.gif" alt="Loading" style="vertical-align: middle;" /> '+l.gl("livegames.loadingFBChat")+"</div>");E.push('<div id="chatWindow" style="display:none;"><iframe src="http://www.facebook.com/presence/popout.php" frameborder="0" align="left" marginwidth="0" marginheight="0" scrolling="no" style="width: 550px; height: 320px; border: 1px solid #BDC7D8;" onload="fe.page.onLoadChat();"></iframe></div>');E.push("</div>");E.push(l.gl("game.friends.invitationStep3"));E.push("</div>");var D={};D.title=l.gl("game.friends.invitationTitle");D.body=E.join("");D.onClose=function(){fe.page.game.show()};fe.popup.show(D);document.getElementById("invitatitonUrl").select()}},shoutOut:function(A){var C=[];C.push('<div style="width:580px;">');C.push('<img src="/img/share/invite.png" style="float: left; margin-right: 30px;" />');C.push(l.gl("game.popup.shoutOutBody"));C.push('<div class="break"></div></div>');var B={};B.title=l.gl("game.popup.shoutOutTitle");B.body=C.join("");B.onClose=function(){fe.page.game.show()};B.buttons='<input type="button" value="'+l.gl("game.friends.next")+'" onclick="fe.popup.close(true);fe.page.publish.invitation(\''+A+'\');"/><input type="button" value="'+l.gl("game.close")+'" onclick="fe.popup.close();" class="inputaux"/>';fe.popup.show(B)},onLoadChat:function(){var A=fe.getIDs("chatWindow","chatWindowLoading");if(A[0]&&A[1]){A[0].style.display="block";A[1].style.display="none"}},initGameSize:function(){if((this.data.profile.type=="frame")||(this.data.profile.width>738&&this.data.profile.resize=="none")){var D=[];D.push('<div style="width:430px; text-align: center;">');D.push("You can play <strong>"+this.data.name+"</strong> only in fullscreen mode!");var A="http://"+global.domain+"/"+(l.rewrite[this.data.gameID]?l.rewrite[this.data.gameID]:this.data.gameID)+"#p=game";D.push('<br/><a href="'+A+'" target="_top">Continue in fulscreen</a>');D.push('<br/><a href="javascript:void(0);" onclick="fe.popup.close();">Return back</a>');var C={};C.title="Fullscreen game";C.body=D.join("");C.onClose=function(){location.href="#p=home"};fe.popup.show(C);return false}if(!this._sizeInitialized){if(this.data.profile.width>738&&(this.data.profile.resize=="ratio"||this.data.profile.resize=="full")){this.data.profile.height=738*this.data.profile.height/this.data.profile.width;this.data.profile.width=738;this.data.profile.resize="none"}this.frameHeight=767;var B=parseInt(this.data.profile.height,10)+124;if(B>this.frameHeight){this.frameHeight=B}this._sizeInitialized=true}return true},startGame:function(){this.onPlay(false);fe.bubble.close();var B=fe.getIDs("main","mainPage","mainGame");this.gamePage=arguments[0];this.backPage=fe.page.page;if(fe.mode===fe.MODE_WEB){B[0].style.overflowY="hidden";if(session.messengerWidth===0){document.body.style.overflow="hidden"}if(this.gameBackground){document.body.style.background=this.gameBackground}}B[1].style.display="none";B[2].style.display="block";if(geewa.server.event&&this.game.id!="duel2"){geewa.server.event.setState(2)}this.page="game";if(global.adPositions&&global.adPositions.indexOf("0")>-1&&typeof(geewa.Ad)!="undefined"&&this.data.advertisement&&this.data.advertisement.preRoll=="none"&&session.user.type!=fe.USER_TYPE_PRO){var C=[];C.push('<div id="page" class="start-game x-shadows y-shadows" style="visibility:hidden;">');C.push('<div id="pageHeader" class="header"><div class="header-l"><div class="header-r"></div></div><hr class="hidden" /></div>');C.push('<div class="content"><div class="content-r">');C.push('<div id="__geewa_ad"></div>');C.push('</div><hr class="hidden" /></div>');C.push('<div id="pageFooter" class="footer"><div class="footer-l"><div class="footer-r"></div></div></div>');C.push("</div>");B[2].innerHTML=C.join("");geewa.ad=geewa.Ad.create();C=[];C.push('<div style="text-align: center; line-height: 25px; margin: 5px 0 10px 0;">');C.push('<span class="pro">&nbsp;</span> <a href="/help/professional-account" target="_blank" style="color:#000;" onclick="try{fe.pt._trackEvent(\'click\',\'no-ads\',\'preroll\'}catch(e){}">'+l.gl("game.noAds")+'</a> <span class="pro">&nbsp;</span>');C.push("</div>");geewa.ad.bottomHTML=C.join("");geewa.ad.language=l.id;var A=this;geewa.ad.onFinish=function(){A.onPreRollFinish.apply(A,arguments)};geewa.ad.insert("/t/"+global.theme+"/ad/"+l.id+"/preGame.aspx?gameID="+this.data.gameID,"__geewa_ad",function(){A.onResizeAd.apply(A,arguments)});if(fe.pt){fe.pt._trackEvent("ad","preroll")}}else{this.onPreRollFinish()}var A=this;if(fe.mode==fe.MODE_FACEBOOK_APP){fe.setFrameHeight(A.frameHeight);this.onResize()}else{window.onresize=function(){A.onResize.apply(A,arguments)}}},onPreRollFinish:function(){var B=fe.getIDs("mainGame","__geewa_ad");B[0].innerHTML=this.gamePage;if(global.adPositions&&global.adPositions.indexOf("4")>-1&&this.activity&&(this.activity.type==1||this.activity.type==2||this.activity.type==3||(!this.activity.type&&fe.tryValue(this.data,"profile.type")!="ganymede"))){this.ad.setBackground()}this.ad.start();delete this.gamePage;geewa.server.user.call("User.SetState",4,null);if(fe.pt){if(this.game.id=="duel"||this.game.id=="duel2"){fe.pt._trackEvent("game",this.data.gameID,this.game.data.type+(this.game.data.mode?"-"+this.game.data.mode:""))}else{fe.pt._trackEvent("game",this.data.gameID)}}if(typeof(pp_gemius_identifier)!="undefined"){try{geewa.stats.imageHit(pp_gemius_host+(new Date()).getTime()+"/rexdot.gif?l=30&id="+pp_gemius_identifier+gemius_parameters())}catch(B){}}if(typeof(gemiusStream)!="undefined"){try{gemiusStream.newStream("game",this.data.gameID,-1,[{name:"NAZEV",value:this.data.name},{name:"TYP",value:"Hra"},{name:"CIL",value:global.domain},{name:"KATEGORIE",value:"081"}],null,"pzCQ0nNSN3GI2DJFxVD2_sTWDorBFFsVM34b7EBrMlb.E7","http://scz.hit.gemius.pl");this.startTime=new Date().valueOf();gemiusStream.event("game",this.data.gameID,0,"playing")}catch(B){}}var A=this;window.setTimeout(function(){A.onResize.apply(A,arguments)},0)},closeGame:function(){geewa.server.user.call("User.SetState",3,null);if(typeof(pp_gemius_identifier)!="undefined"){try{geewa.stats.imageHit(pp_gemius_host+(new Date()).getTime()+"/rexdot.gif?l=30&id="+pp_gemius_identifier+gemius_parameters())}catch(C){}}if(typeof(gemiusStream)!="undefined"){try{var B=parseInt((new Date().valueOf()-this.startTime)/1000,10);gemiusStream.event("game",this.data.gameID,B,"complete");gemiusStream.closeStream("game",this.data.gameID,B)}catch(C){}}if(arguments.length==0&&global.adPositions&&global.adPositions.indexOf("1")>-1&&typeof(geewa.Ad)!="undefined"&&this.data.advertisement&&this.data.advertisement.postRoll=="none"&&session.user.type!=fe.USER_TYPE_PRO){var D=[];D.push('<div id="page" class="start-game x-shadows y-shadows" style="visibility:hidden;">');D.push('<div id="pageHeader" class="header"><div class="header-l"><div class="header-r"></div></div><hr class="hidden" /></div>');D.push('<div class="content"><div class="content-r">');D.push('<div id="__geewa_ad"></div>');D.push('</div><hr class="hidden" /></div>');D.push('<div id="pageFooter" class="footer"><div class="footer-l"><div class="footer-r"></div></div></div>');D.push("</div>");var C=fe.getIDs("mainGame");if(fe.mode===fe.MODE_WEB&&this.gameBackground){document.body.style.background=this.gameBackground}C[0].innerHTML=D.join("");geewa.ad=geewa.Ad.create();D=[];D.push('<div style="text-align: center; line-height: 25px; margin: 5px 0 10px 0;">');D.push('<span class="pro">&nbsp;</span> <a href="/help/professional-account" target="_blank" style="color:#000;" onclick="try{fe.pt._trackEvent(\'click\',\'no-ads\',\'postroll\'}catch(e){}">'+l.gl("game.noAds")+'</a> <span class="pro">&nbsp;</span>');D.push("</div>");geewa.ad.bottomHTML=D.join("");geewa.ad.language=l.id+"Post";geewa.ad.skipTime=0;if(global.theme=="h"){geewa.ad.bigSkipText="přeskoč tuto reklamu &raquo;"}geewa.ad.dontClickTime=1000;var A=this;geewa.ad.onFinish=function(){A.onPostRollFinish.apply(A,arguments)};geewa.ad.insert("/t/"+global.theme+"/ad/"+l.id+"/postGame.aspx?gameID="+this.data.gameID,"__geewa_ad",function(){A.onResizeAd.apply(A,arguments)});if(fe.pt){fe.pt._trackEvent("ad","postroll")}}else{this.onPostRollFinish()}},onPostRollFinish:function(){if(fe.mode===fe.MODE_FACEBOOK_APP&&this.game.id=="duel"&&this.game.data&&this.game.data.type=="external"&&this.game.data.mode=="join"){top.location.href=fe.fbGameUrl(this.data.gameID);return}document.location.href="#p="+this.backPage;var A=fe.getIDs("main","mainPage","mainGame");if(fe.mode===fe.MODE_WEB){A[0].style.overflowY="auto";if(session.messengerWidth===0){document.body.style.overflow=""}}document.body.style.background="";A[1].style.display="block";A[2].style.display="none";A[2].innerHTML="";this.page=this.backPage;delete this.backPage;if(fe.mode==fe.MODE_WEB){window.onresize=null}else{fe.setFrameHeight(document.body.offsetHeight)}if(geewa.server.event){geewa.server.event.setState(1)}fe.search.init();if(global.theme=="lg"){this.matchResult.show()}fe.updateUserPanel();switch(this.page){case"friends":this.friends.show();break;case"league":this.league.show();break;case"challenge":if(this.challenge){this.challenge.show()}break}if(fe.refreshAds){fe.refreshAds(this.page=="home")}},onPlay:function(B){var A=fe.getIDs("splash"+this.mode);if(B){fe.addStyle("splash","hover");fe.addStyle("playNow","hover")}else{fe.removeStyle("splash","hover");fe.removeStyle("playNow","hover")}},showMatchesLimit:function(){var B=[];B.push('<div style="width:400px;">'+geewa.stringAppend(l.gl("game.league.matchesLimit"),fe.page.data.name));B.push("</div>");var A=arguments.length>0?arguments[0]:{};A.title=l.gl("game.matchesLimit");A.body=B.join("");A.buttons='<input type="button" value="'+l.gl("game.close")+'" onclick="fe.popup.close();" class="inputaux"/>';fe.popup.show(A)},rateShow:function(A){document.getElementById("ratingMessage").innerHTML=l.gl("game.rating."+A)},rateClear:function(A){document.getElementById("ratingMessage").innerHTML=l.gl("game.rating."+A)},rateSet:function(B){if(session.user.type<fe.USER_TYPE_USER){fe.showRegistrationRequired();return}if(this.data.gameID&&session.user.userID){var A=this;geewa.server.user.call("Game.InsertRating",this.data.gameID,parseInt(arguments[0],10))}},reportServerUrl:"http://report.geewa.ws/action.ashx",actionStats:function(C,A,E,F,B){var D=[];D.push("userID="+session.user.userID);D.push("domain="+C);D.push("gameID="+fe.page.data.gameID);D.push("content="+escape(A+":"+E));D.push("action="+escape(F+"/"+B));geewa.stats.imageHit(this.reportServerUrl+"?"+D.join("&"))},topPanel:{show:function(){if((fe.page.data.gameID=="pool-2"||fe.page.data.gameID=="8-ball-pool")&&!session.topPanel){var A=fe.getIDs("topPanel");if(A[0]&&A[0].style.display!="block"){A[0].style.display="block"}}},close:function(){var A=fe.getIDs("topPanel");if(A[0]){A[0].style.display="none";fe.ls.call("setSession","topPanel|1")}}},comments:{PAGE_SIZE:20,page:0,MAX_CHARS:1024,disabled:false,show:function(){var A=[];A.push('<h5 id="commentLabel"></h5>');A.push('<textarea id="commentText" cols="80" rows="6" onkeypress="return fe.page.comments.onText(event);" onkeyup="fe.page.comments.checkLength(event);" style="width: 100%;"></textarea>');if(global.theme=="h"){A.push('<p class="button25-blue" style="float: right"><a href="/help/faq/'+fe.page.data.gameID+'" target="hryhelp">'+l.gl("comments.faq")+"</a></p>")}A.push('<p class="button25-orange"><a href="javascript:void(0);" onclick="fe.page.comments.send();" id="commentSubmit" >'+l.gl("comments.send")+"</a>");A.push(' <img id="commentSending" src="/img/loader.gif" style="display:none;"/>');A.push(' <span id="commentCharsLeft">'+geewa.stringAppend(l.gl("comments.charsLeft"),this.MAX_CHARS)+"</span></p>");A.push('<div id="commentList" class="comments"></div>');geewa.writeHTML("commentsBody",A.join(""));this.getPage(0)},onText:function(B){var A=(B?B:window.event).charCode;return(!this.disabled||A==0)},checkLength:function(){var A=fe.getIDs("commentText","commentCharsLeft","commentSubmit");if(A[0]&&A[1]&&A[2]){A[1].innerHTML=geewa.stringAppend(l.gl("comments.charsLeft"),this.MAX_CHARS-A[0].value.length);this.disabled=(this.MAX_CHARS-1)<A[0].value.length;A[2].disabled=this.disabled}},getPage:function(B){this.page=B;var A=this;geewa.server.ps.call(function(){A.onPage.apply(A,arguments)},"Game.GetComments",fe.page.data.gameID,l.id,false,0,B,this.PAGE_SIZE)},onPage:function(B,D){var F=fe.getIDs("commentLabel","commentList","commentsCount");if(F[2]){F[2].innerHTML="("+D.result.totalCount+")"}F[0].innerHTML=(D.result.count==0?l.gl("comments.noComments"):l.gl("comments.addYour"));var H=[];if(D.result.count>0){H.push("<h4>"+geewa.stringAppend(l.gl("comments.found"),D.result.totalCount)+"</h4>");var G=D.result.comments;for(var C=0;C<G.length;C++){var A=(C%2==0?"even":"odd");H.push('<div class="comment '+A+'">');var E=G[C].user.identity;E=E.substring(0,E.indexOf(":"));H.push("<div>");H.push(fe.userLink(G[C].user)+" "+fe.getFlag(G[C].user)+': <small class="date">'+fe.timeBefore(G[C].createTime)+(E==global.userGroup?"":" ("+E+")")+"</small>");if(session.user.userID==G[C].user.userID||session.user.type==fe.USER_TYPE_ADMIN||session.user.type==fe.USER_TYPE_SUPERADMIN){H.push('&nbsp;<small><a href="javascript:void(0);" onclick="fe.page.comments.remove('+G[C].commentID+');">'+l.gl("common.delete")+"</a></small>")}H.push("</div>");H.push("<div>"+G[C].text+"</div>");if(global.showAbuseLinks){H.push('<div class="report"><a href="http://'+global.domain+"/help/contact-form?nick="+escape(G[C].user.nick)+"&amp;userID="+G[C].user.userID+'" target="_blank">report abuse</a></div>')}H.push("</div>")}}H.push(this.paging(this.page,Math.ceil(D.result.count/this.PAGE_SIZE),5,"fe.page.comments.getPage"));F[1].innerHTML=H.join("");fe.fixPageHeight()},paging:function(A,D,F,B){var E=[];if(D>1){E.push('<p class="center">\n');if(A>0){E.push('<a href="javascript:void(0);" onclick="'+B+"("+(A-1)+');">&laquo; '+l.gl("gamesList.previous")+"</a> |\n")}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> |\n")}E.push("<strong>"+(A+1)+"</strong>\n");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>\n")}if(A<(D-1)){E.push('| <a href="javascript:void(0);" onclick="'+B+"("+(A+1)+');">'+l.gl("gamesList.next")+" &raquo;</a>\n")}E.push("</p>")}return E.join("")},send:function(){if(session.user.type<fe.USER_TYPE_USER){fe.showRegistrationRequired();return}var B=fe.getIDs("commentText","commentSubmit","commentSending");if(B[0].value){var A=this;geewa.server.user.call(function(){A.onSend.apply(A,arguments)},"Game.InsertComment",fe.page.data.gameID,l.id,1,geewa.encodeXML(B[0].value));B[1].style.display="none";B[2].style.display="inline-block"}},onSend:function(A,B){var C=fe.getIDs("commentText","commentSubmit","commentSending");C[1].style.display="inline-block";C[2].style.display="none";if(B.error){fe.popup.show({title:"Chyba",body:"Komentář se nepodařilo z důvodu chyby odeslat:<br/>"+B.error.message})}else{C[0].value="";this.checkLength();this.getPage(0)}},remove:function(B){var A=this;geewa.server.user.call(function(){A.onRemove.apply(A,arguments)},"Game.RemoveComment",fe.page.data.gameID,B)},onRemove:function(){this.getPage(this.page)}},stats:{show:function(){var B=[];B.push("<div>");var A={width:694,height:400,movie:"/amline/amline.swf?data_file="+escape("http://public.geewa.ws/stats.ashx?activityIDs="+fe.page.activity.activityID+"&format=csv&tag=daily")+"&settings_file=/amline/amline_settings.xml"};B.push("<h2>"+l.gl("game.stats.usersDaily")+"</h2>");if(navigator.userAgent.indexOf("MSIE ")>-1){B.push('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+A.width+'" height="'+A.height+'" align="middle">');B.push('<param name="allowScriptAccess" value="sameDomain" />');B.push('<param name="movie" value="'+A.movie+'"/>');B.push('<param name="quality" value="high" />');B.push('<param name="wmode" value="transparent" />');B.push('<param name="bgcolor" value="#ffffff"/>');B.push("</object>")}else{B.push('<embed src="'+A.movie+'" quality="high" wmode="transparent" bgcolor="#ffffff" width="'+A.width+'" height="'+A.height+'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />')}B.push("</div>");geewa.writeHTML("statsBody",B.join(""));fe.fixPageHeight()}},share:{init:function(){if(this.links){return}this.links=[];if(global.theme=="h"||global.theme=="c"){var A="http://"+global.domain+"/"+(l.rewrite[fe.page.data.gameID]?l.rewrite[fe.page.data.gameID]:fe.page.data.gameID);var B=fe.page.data.name;this.links.push({id:"game",title:"Facebook",onclick:"fe.page.share.close();fe.page.publish.game();",img:"/img/ico/sharing/facebook.png"});this.links.push({id:"myspace",title:"MySpace",href:geewa.stringAppend("http://www.myspace.com/Modules/PostTo/Pages/?u={0}&t={1}&c={2}&l=2",A,B,escape(fe.page.data.descriptionShort)),img:"/img/ico/sharing/myspace.png"});this.links.push({id:"digg",title:"Digg",href:geewa.stringAppend("http://digg.com/submit?url={0}&title={1}&topic=playable_web_games",A,B),img:"/img/ico/sharing/digg.png"});this.links.push({id:"delicious",title:"Delicious",href:geewa.stringAppend("http://del.icio.us/post?url={0}&title={1}",A,B),img:"/img/ico/sharing/delicious.png"});this.links.push({id:"stumble",title:"StumbleUpon",href:geewa.stringAppend("http://www.stumbleupon.com/submit?url={0}&title={1}",A,B),img:"/img/ico/sharing/stumble.png"});this.links.push({id:"linkuj",title:"Linkuj",href:geewa.stringAppend("http://linkuj.cz/?id=linkuj&url={0}&title={1}",A,B),img:"/img/ico/sharing/linkuj.png"});this.links.push({id:"jagg",title:"Jagg",href:geewa.stringAppend("http://www.jagg.cz/bookmarks.php?action=add&address={0}&title={1}",A,B),img:"/img/ico/sharing/Jagg.png"})}else{this.links.push({id:"game",title:l.gl("livegames.share.link"),onclick:"fe.page.share.close();fe.page.publish.game();",img:"/img/ico/sharing/facebook.png"});this.links.push({id:"embed",title:l.replaceTokens(l.gl("game.embedGame"),fe.page.data.name),onclick:"fe.page.showEmbed();"})}},click:function(){if(fe.page.activity&&fe.page.activity.type){return}fe.page.publish.game()},mouseover:function(){try{if(l.id!="cs"&&(!fe.page.activity||!fe.page.activity.type)){return}this.show()}catch(A){}},mouseout:function(){try{if(l.id!="cs"&&(!fe.page.activity||!fe.page.activity.type)){return}var D=document.getElementById("shareList");if(window.event){var C=window.event.toElement;if(C==D||C==D.firstChild){return}for(var B=0;B<D.firstChild.childNodes.length;B++){if(D.firstChild.childNodes[B]==C){return}}}this.close()}catch(A){}},show:function(){if(!this.links){return}var A=fe.getIDs("shareButton","shareList");if(A[0].className.indexOf("hover")==-1){A[1].innerHTML=this.getMenuHTML();fe.addStyle("shareButton","hover")}},close:function(){fe.removeStyle("shareButton","hover")},getMenuHTML:function(){var B=[];B.push('<ul class="reset">');for(var A=0;A<this.links.length;A++){B.push("<li>");if(this.links[A].img){B.push('<img src="'+this.links[A].img+'" alt="'+this.links[A].title+'" />&nbsp;')}B.push('<a href="'+(this.links[A].href?this.links[A].href:"javascript:void(0);")+'"');B.push(' onclick="'+(this.links[A].onclick?this.links[A].onclick:"")+";try{fe.pt._trackEvent('share','"+this.links[A].id+"','"+fe.page.data.gameID+"')}catch(e){};\">"+this.links[A].title+"</a>");B.push("</li>")}B.push("</ul>");return B.join("")},addLink:function(A){fe.removeFirstFromArray(this.links,"id",A.id);this.links.unshift(A)}},bonus:{show:function(){var A=[];A.push('<p style="line-height: 1.5;">Congratulations to all those players who made the <strong>Top 10</strong> last week! You have received your special award - <strong>7 days</strong><span class="pro">&nbsp;</span> <strong>membership</strong> - today. Extra special mention goes to the winner of the league, <strong> Mario</strong>, who is the very lucky recipient of one whole <strong>month of</strong><span class="pro">&nbsp;</span> <strong>membership!</strong> A full table with last week\'s league positions can be found on league tab - section "Previous".<br /><br />To find out exactly what being a<span class="pro">&nbsp;</span> on Live Games means, please visit <a href="'+fe.getTopUrl()+'pages/professional-account" target="_top">About Professional Accounts</a> section.</p>');geewa.writeHTML("bonusBody",A.join(""))}},publish:{init:function(){if(this.splashUrl){return}if(fe.page.data.languageResources.join(" ").indexOf("splash")!=-1){this.splashUrl=global.gamesServer+fe.page.data.gameID+"/res/"+fe.page.data.language+"/splash58.png"}else{if(fe.page.data.resources.join(" ").indexOf("splash")!=-1){this.splashUrl=global.gamesServer+fe.page.data.gameID+"/res/splash58.png"}else{this.splashUrl="http://www.geewa.com/img/default-game-splashscreen.jpg"}}this.gameUrl=global.facebookAppUrl+fe.page.data.gameID;this.imgShareUrl="http://livegames.geewa.com/img/share/"},invitation:function(B){this.init();var A=this;var E=l.gl("livegames.share.invitation.sTitle1");var C=this.addStats(this.gameUrl+"?invite="+B+"&from=shoutout","invitation");var D={method:"stream.publish",attachment:{name:l.replaceTokens(l.gl("livegames.share.invitation.sName1"),fe.page.data.name),href:C,description:l.replaceTokens(l.gl("livegames.share.invitation.sDesc1"),session.user.nick,fe.page.data.name),media:[{type:"image",src:A.imgShareUrl+"invite.png",href:C}]},action_links:[{text:l.gl("game.friends.acceptChallenge"),href:C}],user_message_prompt:E};if(global.shareInPopup){D.display="popup"}FB.ui(D,function(){A.onResponse.apply(A,arguments)})},lastWin:function(B){this.init();var J=this;var F="latestWin";var G=["winner.png","winner.png","winner.png","champ.png","champ.png","champ.png"];var A=this.getText(F,G.length,B.textIndex);var E=A.index;var H=l.replaceTokens(A.title,fe.page.data.name);var C=this.addStats(this.gameUrl,F);var D=G[E];if(fe.page.data.gameID=="8-ball-pool"){D=J.imgShareUrl+"winnerPool.png"}else{if(D){D=J.imgShareUrl+D}else{D=J.splashUrl}}var I={method:"stream.publish",attachment:{name:l.replaceTokens(A.name,session.user.nick,fe.page.data.name),href:C,description:l.replaceTokens(A.description,session.user.nick,fe.page.data.name,B.opponent,fe.page.data.descriptionShort),media:[{type:"image",src:D,href:C}]},action_links:[{text:l.replaceTokens(l.gl("game.friends.ptwPlay"),fe.page.data.name),href:C}],user_message_prompt:H};if(global.shareInPopup){I.display="popup"}FB.ui(I,function(){var K=Array.prototype.slice.call(arguments);K.push({type:F,i:E,state:B});J.onResponse.apply(J,K)})},score:function(state){var i;var title;var name;var description;var image;var type;var friendsID=null;if(state.type){if(state.beatenFriend){var bFriend=eval("("+state.beatenFriend+")");type="beatenFriends";var images=["highscore.png","highscore.png","highscore.png","highscore2.png","highscore2.png"];var r=this.getText(type,images.length,state.textIndex);i=r.index;title=l.replaceTokens(r.title,{friendGender:(bFriend.gender==2?"f":"m")},fe.page.data.name);name=r.name;description=l.replaceTokens(r.description,{friendGender:(bFriend.gender==2?"f":"m")},session.user.nick,bFriend.nick,fe.page.data.name);image=images[i];friendsID=bFriend.identity.replace("geewa:fb-","")}else{if(state.type==4){type="alltimeHighscore";var images=["highscore.png","highscore.png","highscore2.png","highscore2.png","highscore3.png"];var r=this.getText(type,images.length,state.textIndex);i=r.index;title=l.replaceTokens(r.title,fe.page.data.name);name=l.replaceTokens(r.name,session.user.nick,fe.page.data.name);description=l.replaceTokens(r.description,session.user.nick,fe.numFormat(state.score),fe.page.data.name);image=images[i]}else{type="dailyHighscore";var images=["unstoppable.png","yippee.png","yippee.png","yippee.png","yippee.png","yippee.png"];var r=this.getText(type,images.length,state.textIndex);i=r.index;title=l.replaceTokens(r.title,fe.page.data.name);name=l.replaceTokens(r.name,session.user.nick,fe.page.data.name);description=l.replaceTokens(r.description,fe.page.data.descriptionShort,session.user.nick);image=images[i]}}this.init();var instance=this;var title=title;var url=instance.gameUrl;if(state.dataID){url+="?duel="+state.dataID}if(image){image=instance.imgShareUrl+image}else{image=instance.splashUrl}url=this.addStats(url,type);var post={method:"stream.publish",attachment:{name:name,href:url,description:description,media:[{type:"image",src:image,href:url}]},action_links:[{text:l.gl("game.friends.beatThis"),href:url}],user_message_prompt:title,target_id:friendsID};if(global.shareInPopup){post.display="popup"}FB.ui(post,function(){var args=Array.prototype.slice.call(arguments);args.push({type:type,i:i,state:state});instance.onResponse.apply(instance,args)})}},game:function(){this.init();var A=this;var B={method:"stream.publish",attachment:{name:fe.page.data.name,href:A.gameUrl,description:fe.page.data.descriptionShort,media:[{type:"image",src:A.splashUrl,href:this.addStats(A.gameUrl,"game")}]},action_links:[{text:l.replaceTokens(l.gl("game.friends.ptwPlay"),fe.page.data.name),href:A.gameUrl}],user_message_prompt:l.replaceTokens(l.gl("game.friends.ptwDefaultTitle"),fe.page.data.name)};if(global.shareInPopup){B.display="popup"}FB.ui(B,function(){A.onResponse.apply(A,arguments)})},firstLeagueMatch:function(C){var F="enteringLeague";var G=["league.png"];var A=this.getText(F,G.length,C.textIndex);var E=A.index;this.init();var J=this;var H=l.replaceTokens(A.title,fe.page.data.name);var D=G[E];var B=this.addStats(J.gameUrl,F);if(D){D=J.imgShareUrl+D}else{D=J.splashUrl}var I={method:"stream.publish",attachment:{name:l.replaceTokens(A.name,session.user.nick,fe.page.data.name),href:B,description:l.replaceTokens(A.description,fe.page.data.name,fe.page.data.descriptionShort),media:[{type:"image",src:D,href:B}]},action_links:[{text:l.replaceTokens(l.gl("game.friends.ptwPlay"),fe.page.data.name),href:B}],user_message_prompt:H};if(global.shareInPopup){I.display="popup"}FB.ui(I,function(){var K=Array.prototype.slice.call(arguments);K.push({type:F,i:E,state:C});J.onResponse.apply(J,K)})},leaguePosition:function(C){this.init();var L=this;var F;var I;var D;var K;var E;var H;if(C.position==1){H="beingFirstInLeague";var G=["league1.png","league1.png"];var A=this.getText(H,G.length,C.textIndex);F=A.index;I=A.title;D=l.replaceTokens(A.name,session.user.nick,fe.page.data.name);K=l.replaceTokens(A.description,session.user.nick,C.points);E=G[F]}else{if(C.position==2){H="beingSecondInLeague";var G=["league2.png","league2.png"];var A=this.getText(H,G.length,C.textIndex);F=A.index;I=A.title;D=l.replaceTokens(A.name,session.user.nick);K=l.replaceTokens(A.description,session.user.nick,fe.page.data.name,fe.page.data.descriptionShort);E=G[F]}else{if(C.position==3){H="beingThirdInLeague";var G=["leagueTop10.png","leagueTop10.png","leagueTop10.png","leagueTop10.png","leagueTop10.png","leagueTop10.png"];var A=this.getText(H,G.length,C.textIndex);F=A.index;I=A.title;D=l.replaceTokens(A.name,session.user.nick,fe.page.data.name);K=l.replaceTokens(A.description,session.user.nick,fe.page.data.name,fe.page.data.descriptionShort);E=G[F]}else{if(C.position>=4&&C.position<=10){H="beingFourthToTenthInLeague";var G=["leagueTop10.png","leagueTop10.png","leagueTop10.png","leagueTop10.png","leagueTop10.png","leagueTop10.png"];var A=this.getText(H,G.length,C.textIndex);F=A.index;I=A.title;D=l.replaceTokens(A.name,fe.page.data.name,session.user.nick,C.position);K=l.replaceTokens(A.description,session.user.nick,fe.page.data.name,fe.page.data.descriptionShort);E=G[F]}else{H="moveXPositionsInLeague";var G=["congrats.png","congrats.png","league.png","league.png"];var A=this.getText(H,G.length,C.textIndex);F=A.index;I=A.title;D=l.replaceTokens(A.name,session.user.nick,C.positionsMoved,fe.page.data.name);K=l.replaceTokens(A.description,session.user.nick,C.positionsMoved,fe.page.data.name);E=G[F]}}}}var B=this.addStats(L.gameUrl,H);if(E){E=L.imgShareUrl+E}else{E=L.splashUrl}var J={method:"stream.publish",attachment:{name:D,href:B,description:K,media:[{type:"image",src:E,href:B}]},action_links:[{text:l.replaceTokens(l.gl("game.friends.ptwPlay"),fe.page.data.name),href:B}],user_message_prompt:I};if(global.shareInPopup){J.display="popup"}FB.ui(J,function(){var M=Array.prototype.slice.call(arguments);M.push({type:H,i:F,state:C});L.onResponse.apply(L,M)})},trophy:function(C){if(C=="debug"){C={trophy:{name:"Loose Cannon",trophyID:"looseCannon",description:"potopen\u00ed koule jinou vlastn\u00ed koul\u00ed",profile:{imageURL:"http://gc001.geewa.com/games3/pool-2/res/trophies/default_{medal}.png",medalRanges:[1,10,25]},priority:23,imageUrl:"deprecated"},eventType:"shareTrophy",count:3}}this.init();var K=this;var G;for(var E=0;E<C.trophy.profile.medalRanges.length;E++){if(C.count>=C.trophy.profile.medalRanges[E]){G=E}}var F;switch(G){case 1:F="silver";break;case 2:F="gold";break;default:F="bronze";break}var H=l.replaceTokens("trophy.{0}.{1}.{2}",fe.page.data.gameID,C.trophy.trophyID,F);var I=C.trophy.profile.imageURL.replace(/\{medal\}/g,G)+"?cacheKey="+fe.page.data.profile.custom.cacheKey;var D=0;if(G<C.trophy.profile.medalRanges.length-1){D=C.trophy.profile.medalRanges[G+1]-C.count}var A=this.getText(l.replaceTokens("trophy.{0}.{1}",fe.page.data.gameID,F),1);E=A.index;this.init();var K=this;var B=this.addStats(K.gameUrl,H);var J={method:"stream.publish",attachment:{name:l.replaceTokens(A.name,session.user.nick,C.trophy.name),href:B,description:l.replaceTokens(A.description,session.user.nick,C.trophy.name,C.trophy.description,D),media:[{type:"image",src:I,href:B}]},action_links:[{text:l.replaceTokens(l.gl("game.friends.ptwPlay"),fe.page.data.name),href:B}],user_message_prompt:A.title};if(global.shareInPopup){J.display="popup"}FB.ui(J,function(){var L=Array.prototype.slice.call(arguments);L.push({type:H,i:0,from:"game"});K.onResponse.apply(K,L)})},onResponse:function(){var B=fe.getIDs("mainGame");if(B[0].style.display=="block"&&fe.page.game.show){fe.page.game.show()}if(arguments[0]&&arguments[0]!="null"){var A=arguments[1];if(A){var C;if(A.state&&A.state.from){C=A.state.from}else{C="unknown"}fe.page.actionStats(global.domain,A.type,(A.i+1),C,"publish")}}},getText:function(C,D){var B=(typeof(arguments[2])!="undefined"?arguments[2]:(D>1?Math.round(Math.random()*(D-1)):0));var A={index:B,title:l.gl("livegames.share."+C+".sTitle"+(B+1)),name:l.gl("livegames.share."+C+".sName"+(B+1)),description:l.gl("livegames.share."+C+".sDesc"+(B+1))};return A},addStats:function(A,B){A+=(A.indexOf("?")>-1?"&":"?");A+="utm_source=facebook&utm_medium=stream&utm_content="+B+"&utm_campaign="+fe.page.data.gameID;return A}},matchResult:{imgShareUrl:"/img/share/",show:function(){if(!this.data||fe.page.page=="game"){return}var A=this.data;if(A.type.indexOf("ghost")>-1){if(A.highScore){this.highscore()}}else{if(A.type.indexOf("duel")>-1){while(true){if(A.type.indexOf("league")>-1){if(A.league.total==1){this.firstLeagueMatch();break}if(A.league.total>5){var B=[fe.tryValue(A,"league_previous.points.position"),fe.tryValue(A,"league.points.position")];if(B[1]<B[0]){this.leaguePosition();break}}}if(A.match.result==2){this.lastWin();break}break}}}delete this.data},highscore:function(){if(arguments[0]=="debug"){this.data={activityID:"wild-west",groupID:"livegames",userID:"1101@8589951306",type:"ghost|league|friend",league_previous:{scores:{overall:{position:7,time:1261398060000,value:38755,duelID:"386"}}},league:{createTime:1260880380000,accessTime:1266399660000,matchCounts:{daily:1,weekly:1,monthly:1,overall:4},scores:{daily:{position:1,time:1266399848767,value:38840,duelID:"5255",dataID:"800@261993426204"},weekly:{position:2,time:1266399848767,value:38840,duelID:"5255",dataID:"800@261993426204"},monthly:{position:3,time:1266399848767,value:38840,duelID:"5255",dataID:"800@261993426204"},overall:{position:7,time:1266399848767,value:38840,duelID:"5255",dataID:"800@261993426204"}},points:{position:1,time:1266399848767,value:100000}},match:{duelID:"5255",startTime:1266399660000,endTime:1266399848252,status:8,score:38840,result:2,points:2,dataID:"800@261993426204",opp_user:{userID:"1101@8589955042",identity:"geewa:fb-100000536230769",type:3,rank:6,nick:"Rastislav",gender:1,avatar:"http://resu-cz.geewa.ws/2/042/8589955042.png?a=8l&v=24",device:"pc|WinNT|5.0|web",domain:"beta.livegames.geewa.com",language:"en",location:{latitude:50.083,longitude:14.467,alpha3:"CZE",country:"Czech Republic",region:"52",city:"Prague"},reputation:50,state:{status:1}},opp_duelID:"4614"},highScore:4,beatenFriends:[{activityID:"wild-west",groupID:"livegames",user:{userID:"1101@8589955042",identity:"geewa:fb-100000536230769",type:3,rank:6,nick:"Rastislav",gender:1,avatar:"http://resu-cz.geewa.ws/2/042/8589955042.png?a=8l&v=24",device:"pc|WinNT|5.0|web",domain:"beta.livegames.geewa.com",language:"en",location:{latitude:50.083,longitude:14.467,alpha3:"CZE",country:"Czech Republic",region:"52",city:"Prague"},reputation:50,state:{status:1}},league:{createTime:1264177260000,accessTime:1266399660000,matchCounts:{daily:1,weekly:1,monthly:17,overall:28},scores:{monthly:{position:12,time:1265887140000,value:11466,duelID:"4614",dataID:"800@261993123698"},overall:{position:9,time:1264180620000,value:37446,duelID:"2947",dataID:"800@249108562842"}}}},{activityID:"wild-west",groupID:"livegames",user:{userID:"1101@8589954960",identity:"geewa:fb-100000532209325",type:2,rank:3,nick:"Tibor",gender:1,avatar:"http://gc001.geewa.com/flash/club/dev/avatar/defaultAvatars/boy.png?a=9z8k&v=6",device:"pc|WinNT|5.0|web",domain:"livegames.geewa.com",language:"en",location:{latitude:50.083,longitude:14.467,alpha3:"CZE",country:"Czech Republic",region:"52",city:"Prague"},reputation:50,state:{status:1}},league:{createTime:1263829380000,accessTime:1266103140000,matchCounts:{daily:0,weekly:0,monthly:6,overall:16},scores:{monthly:{position:9,time:1266103238013,value:14303,duelID:"4921",dataID:"800@261993256982"},overall:{position:12,time:1264723800000,value:33176,duelID:"3401",dataID:"800@253403407194"}}}}]}}var D=this.data.match.score;var N=this.data.match.dataID;var G;var H;var M;var P;var E;var K;if(this.data.beatenFriends){K="beatenFriends";var J=["highscore.png","highscore.png","highscore2.png","highscore2.png","highscore3.png"];var A=this.getText(K,J.length);H=A.index;M=A.title;P=A.text;E=J[H];if(this.data.beatenFriends.length==1){var I=this.data.beatenFriends[0].user;var L=geewa.encodeJSON(I);L=L.replace(/"/g,"&quot;");M=l.replaceTokens(M,I.nick);P=l.replaceTokens(P,"<strong>"+I.nick+"</strong>","<strong>"+I.nick+"</strong>");G="fe.page.publish.score({score:"+D+(N?",dataID:'"+N+"'":"")+",type:"+this.data.highScore+",textIndex:"+H+",beatenFriend:"+L+",from:'popup'});"}else{var C=[];C.push("<select id=\"beatenList\" onchange=\"if (document.getElementById('beatenFriend')) document.getElementById('beatenFriend').innerHTML = this[this.selectedIndex].text;\">");for(var F=0;F<this.data.beatenFriends.length;F++){var I=this.data.beatenFriends[F].user;var L=geewa.encodeJSON(I);L=L.replace(/"/g,"&quot;");C.push('<option value="'+L+'">'+I.nick+"</option>")}C.push("</select>");M=l.replaceTokens(M,l.gl("livegames.share.beatenFriends.yourFriends"));P=l.replaceTokens(P,C.join(""),'<strong><span id="beatenFriend">'+this.data.beatenFriends[0].user.nick+"</span></strong>");G="var list = document.getElementById('beatenList'); fe.page.publish.score({score:"+D+(N?",dataID:'"+N+"'":"")+",type:"+this.data.highScore+",textIndex:"+H+",beatenFriend:list[list.selectedIndex].value,from:'popup'});"}}else{if(this.data.highScore==4){K="alltimeHighscore";var J=["highscore.png","highscore.png","highscore2.png","highscore2.png","highscore3.png"];var A=this.getText(K,J.length);H=A.index;M=A.title;P=l.replaceTokens(A.text,session.user.nick,fe.page.data.name);E=J[H];G="fe.page.publish.score({score:"+D+(N?",dataID:'"+N+"'":"")+",type:"+this.data.highScore+",textIndex:"+H+",from:'popup'});"}else{K="dailyHighscore";var J=["unstoppable.png","yippee.png","yippee.png","yippee.png","yippee.png","yippee.png"];var A=this.getText(K,J.length);H=A.index;M=A.title;P=l.replaceTokens(A.text,fe.page.data.name);E=J[H];G="fe.page.publish.score({score:"+D+(N?",dataID:'"+N+"'":"")+",type:"+this.data.highScore+",textIndex:"+H+",from:'popup'});"}}fe.removeFirstFromArray(fe.page.share.links,"id","dailyHighscore");fe.removeFirstFromArray(fe.page.share.links,"id","overallHighscore");var D=[fe.tryValue(this.data,"league.scores.daily.value"),fe.tryValue(this.data,"league.scores.overall.value")];if(D[1]){var N=fe.tryValue(this.data,"league.scores.overall.dataID");var O="fe.page.publish.score({score:"+D[1]+(N?",dataID:'"+N+"'":"")+",type:4,from:'menu'});";fe.page.share.links.push({id:"overallHighscore",title:l.gl("livegames.share.alltimeHighscoreText")+" "+fe.numFormat(D[1]),onclick:"fe.page.share.close();"+O})}if(D[0]&&D[0]<D[1]){var N=fe.tryValue(this.data,"league.scores.daily.dataID");var O="fe.page.publish.score({score:"+D[0]+(N?",dataID:'"+N+"'":"")+",type:1,from:'menu'});";fe.page.share.links.push({id:"dailyHighscore",title:l.gl("livegames.share.dailyHighscoreText")+" "+fe.numFormat(D[0]),onclick:"fe.page.share.close();"+O})}var C=[];C.push('<div style="width:400px; text-align: center;">');if(E){C.push('<img src="'+this.imgShareUrl+E+'" alt="High Score" style="float: left;" />')}C.push('<div style="float: left; width: 250px; margin-top: 10px; margin-left: 25px;">');C.push(P);C.push('</div><div class="break"></div></div>');var B={};B.title=M;B.body=C.join("");B.buttons='<input type="button" value="'+l.gl("game.share")+'" onclick="'+G+"fe.popup.close();fe.page.actionStats('"+global.domain+"', '"+K+"', "+(H+1)+", 'popup', 'click');\"/><input type=\"button\" value=\""+l.gl("game.close")+'" onclick="fe.popup.close();" class="inputaux"/>';fe.popup.show(B);fe.page.actionStats(global.domain,K,(H+1),"popup","view")},lastWin:function(){if(arguments[0]=="debug"){this.data={activityID:"gomoku",groupID:"livegames",userID:"1101@8589954960",type:"duel|league|friend",league_previous:{points:{position:20,time:1264519523667,value:6},elo:{position:2,time:1264519523696,value:1015.97}},league:{createTime:1260882180000,accessTime:1264519560000,left:11,total:4,wins:3,draws:0,losts:0,matchCounts:{daily:4,weekly:4,monthly:4,overall:8},points:{position:5,time:1264519699285,value:6},elo:{position:7,time:1264519689117,value:997.72}},match:{duelID:"55662",startTime:1264519560000,endTime:1264519590454,status:8,points:0,opp_user:{userID:"1101@8589951933",identity:"geewa:fb-699764770",type:2,rank:2,nick:"Tibi",gender:1,avatar:"http://resu-cz.geewa.ws/2/933/8589951933.png?a=8lz13&v=11",device:"pc|WinNT|5.0|web",domain:"livegames.mygeewa.com",language:"en",location:{latitude:50.083,longitude:14.467,alpha3:"CZE",country:"Czech Republic",region:"52",city:"Prague"},reputation:50,state:{status:1}},opp_status:8,opp_duelID:"55661"}}}var E=fe.tryValue(this.data,"match.opp_user.nick","player");var G="latestWin";var H=["winner.png","winner.png","winner.png","champ.png","champ.png","champ.png"];var A=this.getText(G,H.length);var F=A.index;var I=l.replaceTokens(A.title,session.user.nick);var J=l.replaceTokens(A.text,E,fe.page.data.name);var D=(fe.page.data.gameID=="8-ball-pool"?"winnerPool.png":H[F]);fe.removeFirstFromArray(fe.page.share.links,"id","lastWin");fe.page.share.links.push({id:"lastWin",title:l.replaceTokens(l.gl("livegames.share.lastWin"),E),onclick:"fe.page.share.close();fe.page.publish.lastWin({opponent:'"+E+"',from:'menu'});"});var C=[];C.push('<div style="width:420px; text-align: center;">');if(D){C.push('<img src="'+this.imgShareUrl+D+'" alt="Winner" style="float: left;" />')}C.push('<div style="float: left; width: 270px; margin-top: 10px; margin-left: 25px;">');C.push(J);C.push('</div><div class="break"></div></div>');var B={};B.title=I;B.body=C.join("");B.buttons='<input type="button" value="'+l.gl("game.share")+'" onclick="fe.popup.close();fe.page.publish.lastWin({opponent:\''+E+"',textIndex:"+F+",from:'popup'});fe.page.actionStats('"+global.domain+"', '"+G+"', "+(F+1)+", 'popup', 'click');\"/><input type=\"button\" value=\""+l.gl("game.close")+'" onclick="fe.popup.close();" class="inputaux"/>';fe.popup.show(B);fe.page.actionStats(global.domain,G,(F+1),"popup","view")},leaguePosition:function(){if(arguments[0]=="debug"){this.data={activityID:"wild-west",groupID:"livegames",userID:"1101@8589951306",type:"ghostLeague",league_previous:{points:{value:20,position:15},scores:{overall:{position:1,time:1261398060000,value:38755,duelID:"386"}}},league:{createTime:1260880380000,accessTime:1264507980000,matchCounts:{daily:1,weekly:1,monthly:1,overall:3},points:{position:11,value:25},scores:{overall:{position:2,time:1261398060000,value:38755,duelID:"386",dataID:"800@236223345588"}}},match:{duelID:"3167",startTime:1264507980000,endTime:1264508003736,status:8,score:1528,result:2,points:2,dataID:"800@253403265344"}}}var I=[fe.tryValue(this.data,"league_previous.points.position"),fe.tryValue(this.data,"league.points.position")];if(!I[1]||(I[0]&&I[1]>=I[0])){return}var L;var F;var J;var K;var D;var G;if(I[1]==1){G="beingFirstInLeague";var H=["league1.png","league1.png"];var A=this.getText(G,H.length);F=A.index;J=A.title;K=l.replaceTokens(A.text,fe.page.data.name);D=H[F];L="fe.page.publish.leaguePosition({position:"+I[1]+",textIndex:"+F+",points:"+fe.tryValue(this.data,"league.points.value",0)+",from:'popup'});"}else{if(I[1]>=2&&I[1]<=10){if(I[1]==2){G="beingSecondInLeague";var H=["league2.png","league2.png"];var A=this.getText(G,H.length);F=A.index;J=A.title;K=l.replaceTokens(A.text,fe.page.data.name);D=H[F];L="fe.page.publish.leaguePosition({position:"+I[1]+",textIndex:"+F+",from:'popup'});"}else{if(I[1]==3){G="beingThirdInLeague";var H=["league3.png"];var A=this.getText(G,H.length);F=A.index;J=A.title;K=l.replaceTokens(A.text,session.user.nick,fe.page.data.name);D=H[F];L="fe.page.publish.leaguePosition({position:"+I[1]+",textIndex:"+F+",from:'popup'});"}else{G="beingFourthToTenthInLeague";var H=["leagueTop10.png","leagueTop10.png","leagueTop10.png","leagueTop10.png","leagueTop10.png","leagueTop10.png"];var A=this.getText(G,H.length);F=A.index;J=A.title;K=l.replaceTokens(A.text,I[1],fe.page.data.name,session.user.nick);D=H[F];L="fe.page.publish.leaguePosition({position:"+I[1]+",textIndex:"+F+",from:'popup'});"}}}else{if(I[0]&&I[1]<I[0]&&I[0]-I[1]>=25){G="moveXPositionsInLeague";var H=["congrats.png","congrats.png","league.png","league.png"];var A=this.getText(G,H.length);F=A.index;var E=(I[0]-I[1]);J=l.replaceTokens(A.title,fe.page.data.name);K=l.replaceTokens(A.text,E,fe.page.data.name,session.user.nick);D=H[F];L="fe.page.publish.leaguePosition({position:"+I[1]+",textIndex:"+F+",positionsMoved:"+E+",from:'popup'});"}else{return}}}var C=[];C.push('<div style="width:420px; text-align: center;">');if(D){C.push('<img src="'+this.imgShareUrl+D+'" alt="League Position" style="float: left;" />')}C.push('<div style="float: left; width: 270px; margin-top: 10px; margin-left: 25px;">');C.push(K);C.push('</div><div class="break"></div></div>');var B={};B.title=J;B.body=C.join("");B.buttons='<input type="button" value="'+l.gl("game.share")+'" onclick="fe.popup.close();'+L+"fe.page.actionStats('"+global.domain+"', '"+G+"', "+(F+1)+", 'popup', 'click');\"/><input type=\"button\" value=\""+l.gl("game.close")+'" onclick="fe.popup.close();" class="inputaux"/>';fe.popup.show(B);fe.page.actionStats(global.domain,G,(F+1),"popup","view")},firstLeagueMatch:function(){var F="enteringLeague";var G=["league.png"];var A=this.getText(F,G.length);var E=A.index;var J="fe.page.publish.firstLeagueMatch({textIndex:"+E+",from:'popup'});";var H=l.replaceTokens(A.title,fe.page.data.name);var I=l.replaceTokens(A.text,fe.page.data.name);var D=G[E];var C=[];C.push('<div style="width:420px; text-align: center;">');if(D){C.push('<img src="'+this.imgShareUrl+D+'" alt="First League Match" style="float: left;" />')}C.push('<div style="float: left; width: 270px; margin-top: 10px; margin-left: 25px;">');C.push(I);C.push('</div><div class="break"></div></div>');var B={};B.title=H;B.body=C.join("");B.buttons='<input type="button" value="'+l.gl("game.share")+'" onclick="fe.popup.close();'+J+"fe.page.actionStats('"+global.domain+"', '"+F+"', "+(E+1)+", 'popup', 'click');\"/><input type=\"button\" value=\""+l.gl("game.close")+'" onclick="fe.popup.close();" class="inputaux"/>';fe.popup.show(B);fe.page.actionStats(global.domain,F,(E+1),"popup","view")},getText:function(C,D){var B=(typeof(arguments[2])!="undefined"?arguments[2]:(D>1?Math.round(Math.random()*(D-1)):0));var A={index:B,title:l.gl("livegames.share."+C+".pTitle"+(B+1)),text:l.gl("livegames.share."+C+".pBody"+(B+1))};return A}},ad:{getOpenX:function(A){return'<iframe id="__geewa_ad_frame" width="574" height="80" frameborder="0" scrolling="no" src="/t/'+global.theme+"/ad/"+l.id+"/"+A+".aspx?cacheKey="+(new Date()).valueOf()+'"></iframe>'},showAd:function(){return(l.id=="cs"&&session.user.type!=fe.USER_TYPE_PRO)},getTopHTML:function(){var B=[];if(this.showAd()){try{fe.pt._trackEvent("ad","game-takeover_2010-08_Vodafone")}catch(A){}B.push('<div id="adTop" style="display: block; width: 574px; height: 80px; position: absolute; top: -90px; left: 50%; margin-left: -287px;" title="Stránka se otevře do nového okna, hra nebude narušena">');B.push(this.getOpenX("takeoverTop"));B.push("</div>")}return B.join("")},getBottomHTML:function(){var A=[];if(this.showAd()){A.push('<div id="adBottom" style="display: block; width: 574px; height: 80px;position: absolute; bottom: -90px; left: 50%; margin-left: -287px;" title="Stránka se otevře do nového okna, hra nebude narušena">');A.push(this.getOpenX("takeoverBottom"));A.push("</div>")}return A.join("")},getLogo:function(){var A=[];if(this.showAd()){A.push('<img src="/ad/takeover/vodafone/logo_vf.jpg" alt="Vodafone" style="display: block; position: absolute; bottom: 0; left: 0; z-index: -1;" />')}return A.join("")},setBackground:function(){if(this.showAd()){document.body.style.background="#fff url(/ad/takeover/vodafone/background.jpg) repeat scroll top left"}},start:function(){}},showEmbed:function(){var B=[];B.push('<textarea cols="100" rows="14" readonly="readonly" style="width: 98%;" onclick="this.select();">');B.push("&lt;!-- BEGIN - EMBED GAME FROM GEEWA.COM --&gt;\n");B.push('&lt;script type="text/javascript"&gt;\n');B.push("//YOU CAN CHANGE these game parameters\n");B.push("var __geewa_game = {};\n");B.push("__geewa_game.id = '"+fe.page.data.gameID+"';\n");B.push("__geewa_game.language = '"+fe.page.data.language+"';\n");B.push("//DON'T CHANGE!!!!!!!!\n");B.push("document.open();\n");B.push("document.write('&lt;scr' + 'ipt type=\"text/javascript\" src=\"http://gc001.geewa.com/ajax/common/insertGame.js?' + (new Date()).valueOf() + '\"&gt;&lt;/scr' + 'ipt&gt;');\n");B.push("document.close();\n");B.push("&lt;/script&gt;\n");B.push('&lt;noscript&gt;Free multiplayer games at &lt;a href="http://www.geewa.com"&gt;Geewa.com&lt;/a&gt;!&lt;/noscript&gt;\n');B.push("&lt;!-- END - EMBED GAME FROM GEEWA.COM --&gt;");B.push("</textarea>");var A={};A.title=l.replaceTokens(l.gl("game.embedGame"),fe.page.data.name);A.body=B.join("");A.buttons='<input type="button" value="'+l.gl("game.close")+'" onclick="fe.popup.close();" class="inputaux"/>';fe.popup.show(A)}};
fe.page.game={id:"ghost",sizeMode:0,start:function(){this.data=arguments.length>0?arguments[0]:{};this.sizeMode=(fe.page.data.profile.resize=="alwaysRatio"||fe.page.data.profile.resize=="alwaysFull")?2:0;this.hidden=false;this.startGame()},startGame:function(){var A=[];if(global.adPositions&&global.adPositions.indexOf("4")>-1&&session.user.type!=fe.USER_TYPE_PRO){A.push(fe.page.ad.getLogo())}A.push('<div id="page" class="game" style="visibility:hidden;padding:0;position:absolute;border:none;">');if(global.adPositions&&global.adPositions.indexOf("5")>-1&&session.user.type!=fe.USER_TYPE_PRO){A.push(fe.page.ad.getTopHTML())}A.push(geewa.game.getHTML(this.gameParams()));if(global.adPositions&&global.adPositions.indexOf("6")>-1&&session.user.type!=fe.USER_TYPE_PRO){A.push(fe.page.ad.getBottomHTML())}A.push("</div>");if(fe.mode===fe.MODE_FACEBOOK_APP){A.push('<div class="privacy-terms"><a href="http://'+global.domain+'/help/contact-form?type=abuse" target="_blank">Report abuse</a> | <a href="http://'+global.domain+'/help/privacy-policy" target="_blank">Privacy Policy</a> | <a href="http://'+global.domain+'/help/terms-of-use" target="_blank">Terms of Use</a></div>')}fe.page.startGame(A.join(""))},hide:function(){var A=fe.getIDs("page","__geewa_game_object");if(!(A[0]&&A[1])){return}A[1].width="1px";A[1].height="1px";this.hidden=true},show:function(){this.hidden=false;this._onResize()},_onResize:function(){if(this.hidden){return}var D=fe.getIDs("page",this.hidden?"__geewa_game_image":"__geewa_game_object","messenger");if(!(D[0]&&D[1])){return}var C=parseInt(fe.page.data.profile.width,10);var A=parseInt(fe.page.data.profile.height,10);var E=this.sizeMode;var B=(typeof(window.innerWidth)=="undefined"?document.documentElement.clientWidth:window.innerWidth)-(D[2]?D[2].offsetWidth:0);var F=(fe.mode==fe.MODE_FACEBOOK_APP?767:(typeof(window.innerHeight)=="undefined"?document.documentElement.clientHeight:window.innerHeight));switch(E){case 0:D[1].width=C+"px";D[1].height=A+"px";D[0].style.top=parseInt((F-A)/2,10)+"px";D[0].style.left=parseInt((B-C)/2,10)+"px";if(fe.page.data.profile.resize&&(D[0].offsetTop<0||D[0].offsetLeft<0)){this.sizeMode=11;this._onResize();return}break;case 11:if(B>C&&F>A){this.sizeMode=0;this._onResize();return}case 1:if(B/F>C/A){D[1].width=F*C/A;D[1].height=F;D[0].style.top=0;D[0].style.left=parseInt((B-D[1].width)/2,10)+"px"}else{D[1].width=B;D[1].height=B*A/C;D[0].style.top=parseInt((F-D[1].height)/2,10)+"px";D[0].style.left=0}break;case 2:D[1].width=B+"px";D[1].height=F+"px";D[0].style.top=0;D[0].style.left=0;break}D[0].style.width=parseInt(D[1].width,10)+"px";if(D[0].style.visibility=="hidden"){D[0].style.visibility="visible";if(D[1]){D[1].focus()}}},gameParams:function(){geewa.game.version=global.flashComponentsVersion;var B={};B.identity=fe.getIdentity();B.language=l.id;B.statsGlobal=false;B.statsLocal=null;B.gameID=fe.page.data.gameID;B.runMode="simple";B.publicServerURL=global.publicServer;B.cacheKey=global.cacheKey;B.resizeMode=(fe.page.data.profile.resize!="none");B.closeButton=true;B.resizeButton=(fe.page.data.profile.resize!="none");B.externalEventListener="__geewa_onEvent";if(session){B.userServerSessionID=session.sessionID;if(session.user){B.userPictureURL="http://static.geewa.ws/t/?dest=jpg&url="+escape(session.user.avatar)}}var A=fe.tryValue(fe.page,"activity.profile.roomServerUrl");if(A){B.userServerURL=A}B.matchParams={groupID:global.competitionGroupID,typeID:"ghostLeague"};if(this.data.ghostDataID){B.matchParams.dataID=this.data.ghostDataID}B.minScoreForChallengeSave=0;if(B.gameID=="sudoku"){B.preloadGameProfile=true;B.gameProfileParams="M1"}return B},onEvent:function(){geewa.debug.log("ajax","fe.page.game.onEvent: "+arguments[0].eventType,geewa.encodeJSON(arguments[0]));switch(arguments[0].eventType){case"init":var A=fe.getIDs("__geewa_game_object");A[0].focus();break;case"close":fe.page.closeGame();break;case"resize":if(this.sizeMode==0){switch(fe.page.data.profile.resize){case"ratio":this.sizeMode=1;break;case"full":this.sizeMode=2;break}}else{this.sizeMode=0}this._onResize();break}}};fe.page.friends={FILTER_NONE:0,FILTER_FRIENDS:1,FIRST_PAGE_SIZE:10,PAGE_SIZE:20,scoreFilter:1,scoreType:4,page:0,sortBy:2,show:function(){var A=fe.getIDs("friendsBody");if(A[0]&&A[0].innerHTML==""){var B=[];B.push('<p class="l sort">');B.push("<strong>"+l.gl("game.league.friendsHighscore")+":</strong>");B.push('<a id="friends1" href="javascript:void(0);" onclick="fe.page.friends.getPage(1,0,2);" class="first">'+l.gl("game.league.daily")+"</a>");B.push('<a id="friends2" href="javascript:void(0);" onclick="fe.page.friends.getPage(2,0,2);">'+l.gl("game.league.weekly")+"</a>");B.push('<a id="friends3" href="javascript:void(0);" onclick="fe.page.friends.getPage(3,0,2);">'+l.gl("game.league.monthly")+"</a>");B.push('<a id="friends4" href="javascript:void(0);" onclick="fe.page.friends.getPage(4,0,2);">'+l.gl("game.league.longTerm")+"</a>");B.push("</p>");B.push('<p class="r sort">');B.push('<a id="friendsFilter1" href="javascript:void(0);" onclick="fe.page.friends.setFilter(1);" class="first active">'+l.gl("game.friends.modeFriends")+"</a>");B.push('<a id="friendsFilter0" href="javascript:void(0);" onclick="fe.page.friends.setFilter(0);">'+l.gl("game.friends.modeGlobal")+"</a>");B.push("</p>");B.push('<div class="break"></div>');B.push('<div id="friendsBodyContent" class="players-list"></div>');A[0].innerHTML=B.join("")}this.getPage()},setFilter:function(){this.scoreFilter=arguments[0];for(var A=0;A<2;A++){var B=document.getElementById("friendsFilter"+A);if(A==this.scoreFilter){fe.addStyle(B,"active")}else{fe.removeStyle(B,"active")}}this.getPage()},getPage:function(){if(arguments.length>0){this.scoreType=arguments[0]}if(arguments.length>1){this.page=arguments[1]}if(arguments.length>2){this.sortBy=arguments[2]}for(var B=1;B<5;B++){var C=document.getElementById("friends"+B);if(B==this.scoreType){fe.addStyle(C,"active")}else{fe.removeStyle(C,"active")}}var A=this;if(this.scoreFilter==this.FILTER_FRIENDS){geewa.server.user.call(function(){A.onPage.apply(A,arguments)},"Competition.GetFriends",this.scoreType,this.page,this.PAGE_SIZE,this.sortBy)}else{geewa.server.ps.call(function(){A.onPage.apply(A,arguments)},"Competition.GetScoresTable",fe.page.activity.activityID,global.competitionGroupID,this.scoreType,this.page,this.PAGE_SIZE)}},onPage:function(J,B){var G=fe.getIDs("friendsBodyContent");var A=[];if(B.result&&B.result.items&&B.result.items.length>0){var E=fe.page.activity.profile.score||fe.page.activity.profile.scores;var I="friend-better";A.push('<ul class="reset clearfix">');for(var F=0;F<B.result.items.length;F++){var H;var K=B.result.items[F];var D="";A.push('<li><div class="in">');if(K.user.userID==session.user.userID){I="default";D=" highlight"}else{if(I=="default"){I="friend-worse"}}A.push(fe.avatar.getHTML(K.user,"left:10px;top:0;",I));A.push('<p class="clearfix nick'+D+'">');H=(this.scoreFilter==this.FILTER_FRIENDS?F+1:fe.tryValue(K,"score.position"));A.push('<strong class="rank">'+(H?H+".":"")+"</strong>");A.push('<strong class="rank2">'+(H?H+".":"")+"</strong>");A.push("<strong>"+fe.userLink(K.user)+"</strong>");A.push('<span class="state">'+fe.getFlag(K.user)+"</span>");A.push("</p>");var C=fe.tryValue(K,this.scoreFilter==this.FILTER_FRIENDS?"league.score.value":"score.value");A.push('<p class="clearfix"><span class="l">'+l.gl("game.score")+':</span><strong class="r">'+(C>=0?fe.numFormat(C):"")+"</strong></p>");H=fe.tryValue(K,this.scoreFilter==this.FILTER_FRIENDS?"league.score.dataID":"score.dataID");if(K.user.userID==session.user.userID){A.push('<p class="share"><a href="javascript:void(0);"');A.push(' onclick="fe.page.publish.score({score:'+C+(H?",gameID:'"+H+"'":"")+",type:"+this.scoreType+'});"');A.push(">"+l.gl("game.share")+"</a></p>")}else{if(H){A.push('<p class="button22-orange"><a href="#p=game&amp;m=league&amp;duel='+H+'">'+l.gl("game.friends.beatThis")+"</a></p>")}}A.push("</div></li>")}A.push("</ul>")}else{A.push(geewa.stringAppend(l.gl("game.friends.highscoreDefaultMessage"),fe.page.data.name))}G[0].innerHTML=A.join("");fe.fixPageHeight()},paging:function(A,D,F,B){var E=[];if(D>1){E.push('<p class="center">\n');if(A>0){E.push('<a href="javascript:void(0);" onclick="'+B+"("+(A-1)+');">&laquo; '+l.gl("gamesList.previous")+"</a> |\n")}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> |\n")}E.push("<strong>"+(A+1)+"</strong>\n");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>\n")}if(A<(D-1)){E.push('| <a href="javascript:void(0);" onclick="'+B+"("+(A+1)+');">'+l.gl("gamesList.next")+" &raquo;</a>\n")}E.push("</p>")}return E.join("")}},fe.page.league={PAGE_SIZE:20,show:function(){var B=[];B.push('<div class="my-results" style="float: left;">');B.push('<table border="0">');var A=fe.tryValue(this,"data.myProfile.league.points.position");B.push("<tr><td>"+l.gl("game.league.currentPosition")+":</td>");if(A){B.push("<td><strong>"+A+".</strong></td>")}else{if(fe.tryValue(this,"data.myProfile.league.total")){B.push('<td><strong onmouseover="fe.bubble.show(this, l.gl(\'bubble.game.na\'));" onmouseout="fe.bubble.close(this);">NA</strong></td>')}else{B.push('<td><strong onmouseover="fe.bubble.show(this, l.gl(\'bubble.game.dns\'));" onmouseout="fe.bubble.close(this);">DNS</strong></td>')}}B.push("</tr>");A=fe.tryValue(this,"data.myProfile.league.matchCounts.daily",0);B.push("<tr><td>"+l.gl("game.league.dailyLimit")+":</td><td>"+geewa.stringAppend(l.gl("game.league.noLimit"),A)+"</td></tr>");B.push('<tr><td><a href="javascript:void(0);" onclick="fe.user.show(session.user,event);">'+l.gl("game.league.showMyMatches")+"</a></td><td>&nbsp;</td></tr>");B.push("</table>");B.push("</div>");B.push('<p class="buttons button50-orange" style="margin: 0 0 20px 20px; float: right;"><a href="#p=game&amp;m=league" onmouseover="fe.bubble.show(this, l.gl(\'bubble.game.leaguePlayLeagueGhost\'), \'bubble-orange\');" onmouseout="fe.bubble.close(this);">'+l.gl("game.playLeague")+"</a></p>");B.push('<div class="break"></div>');B.push('<div class="break"></div>');B.push('<p class="l sort">');B.push("<strong>"+l.gl("game.league.leagueText")+":</strong>");B.push('<a id="ranking1" href="javascript:void(0);" onclick="fe.page.league.showRanking(1);" class="first">'+l.gl("game.league.actual")+"</a>");B.push('<a id="ranking2" href="javascript:void(0);" onclick="fe.page.league.showRanking(2);">'+l.gl("game.league.previous")+"</a>");B.push("</p>");if(fe.page.activity.profile.score||fe.page.activity.profile.scores){B.push('<p class="l sort">');B.push("<strong>"+l.gl("game.league.globalHighscore")+":</strong>");B.push('<a id="ranking3" href="javascript:void(0);" onclick="fe.page.league.showRanking(3);" class="first">'+l.gl("game.league.daily")+"</a>");B.push('<a id="ranking4" href="javascript:void(0);" onclick="fe.page.league.showRanking(4);">'+l.gl("game.league.weekly")+"</a>");B.push('<a id="ranking5" href="javascript:void(0);" onclick="fe.page.league.showRanking(5);">'+l.gl("game.league.monthly")+"</a>");B.push('<a id="ranking6" href="javascript:void(0);" onclick="fe.page.league.showRanking(6);">'+l.gl("game.league.longTerm")+"</a>");B.push("</p>")}B.push('<p class="r sort">');B.push('<a id="ranking7" href="javascript:void(0);" onclick="fe.page.league.showRanking(7);" class="first">'+l.gl("game.league.hallOfFame")+"</a>");B.push("</p>");B.push('<div class="break"></div>');B.push('<div id="rankingTable" class="rank-list"></div>');geewa.writeHTML("leagueBody",B.join(""));this.showRanking(1)},showRanking:function(B){for(var C=1;C<8;C++){var D=document.getElementById("ranking"+C);if(C==B){fe.addStyle(D,"active")}else{fe.removeStyle(D,"active")}}var A=this;switch(B){case 1:this.type="points";this.subType=2;break;case 2:this.type="points";this.subType=4;break;case 3:this.type="scores";this.subType=1;break;case 4:this.type="scores";this.subType=2;break;case 5:this.type="scores";this.subType=3;break;case 6:this.type="scores";this.subType=4;break;case 7:this.type="points";this.subType=3;break}this.getPage(0)},getPage:function(B){this.page=B;var A=this;switch(this.type){case"points":geewa.server.ps.call(function(){A.onResponse.apply(A,arguments)},"Competition.GetPointsTable",fe.page.activity.activityID,global.competitionGroupID,this.subType==4?2:this.subType,B,this.PAGE_SIZE,this.subType==4?{league:"previous"}:null);break;case"scores":geewa.server.ps.call(function(){A.onResponse.apply(A,arguments)},"Competition.GetScoresTable",fe.page.activity.activityID,global.competitionGroupID,this.subType,B,this.PAGE_SIZE);break}},onResponse:function(J,C){var B=[];if(C.result.items){if(J.name=="Competition.GetScoresTable"){var G=["time","day,time","date,time","date,time"];B.push("<table>");B.push('<col width="8%" />');B.push('<col width="30%" />');B.push('<col width="5%" />');B.push('<col width="22%" />');B.push('<col width="15%" />');B.push('<col width="20%" />');B.push("<thead>");B.push("<tr>");B.push('<th align="center">'+l.gl("game.league.position")+"</th>");B.push('<th align="left">'+l.gl("game.league.nick")+"</th>");B.push("<th>&nbsp;</th>");B.push('<th align="right">'+l.gl("game.league.time")+"</th>");B.push('<th align="right">'+l.gl("game.league.score")+"</th>");B.push("<th>&nbsp;</th>");B.push("</tr>");B.push("</thead>");B.push("<tbody>");var H;for(var E=0;E<C.result.items.length;E++){var A=C.result.items[E];var K="";if(A.user.userID==session.user.userID){K="highlight"}if(E%2==1){K+=" even"}B.push('<tr class="'+K+'">');B.push('<td align="center">'+(!H||H!=A.score.position?A.score.position+".":"")+"</td>");H=A.score.position;B.push('<td align="left">'+fe.userLink(A.user)+"</td>");B.push('<td align="center">'+fe.getFlag(A.user)+"</td>");B.push('<td align="right">'+fe.timeBefore(new Date(A.score.time))+"</td>");B.push('<td align="right"><strong>'+fe.numFormat(A.score.value)+"</strong></td>");B.push("<td>"+(A.score.dataID?'<a href="#p=game&amp;m=league&amp;duel='+A.score.dataID+'">'+l.gl("game.friends.beatThis")+"</a>":"")+"</strong></td>");B.push("</tr>")}B.push("</tbody>");B.push("</table>");B.push('<p class="center small">'+l.gl("game.league.modified")+": "+fe.timeFormat(new Date(C.result.modified))+"</p>");B.push(this.paging(this.page,Math.ceil(C.result.count/this.PAGE_SIZE),5,"fe.page.league.getPage"));if(l.l["description.highScore"]){B.push('<div style="margin-top:20px;">'+l.gl("description.highScore")+"</div>")}}else{if(J.name=="Competition.GetPointsTable"&&J.arguments[2]==2){var I=[l.gl("global.monday"),l.gl("global.tuesday"),l.gl("global.wednesday"),l.gl("global.thursday"),l.gl("global.friday"),l.gl("global.saturday"),l.gl("global.sunday")];B.push("<table>");B.push('<col width="10%" />');B.push('<col width="25%" />');B.push('<col width="5%" />');B.push('<col width="7%" />');B.push('<col width="7%" />');B.push('<col width="7%" />');B.push('<col width="7%" />');B.push('<col width="7%" />');B.push('<col width="7%" />');B.push('<col width="7%" />');B.push('<col width="11%" />');B.push("<thead>");B.push("<tr>");B.push('<th align="center">'+l.gl("game.league.position")+"</th>");B.push('<th align="left">'+l.gl("game.league.nick")+"</th>");B.push("<th>&nbsp;</th>");for(var E=0;E<I.length;E++){B.push('<th align="right">'+I[E].substring(0,2)+"</th>")}B.push('<th align="right">'+l.gl("game.league.points")+"</th>");B.push("</tr>");B.push("</thead>");B.push("<tbody>");var H;for(var E=0;E<C.result.items.length;E++){var A=C.result.items[E];var K="";if(A.user.userID==session.user.userID){K="highlight"}if(E%2==1){K+=" even"}B.push('<tr class="'+K+'">');B.push('<td align="center">'+(!H||H!=A.points.position?A.points.position+".":"")+"</td>");H=A.points.position;B.push('<td align="left">'+fe.userLink(A.user)+"</td>");B.push('<td align="center">'+fe.getFlag(A.user)+"</td>");for(var D=1;D<=I.length;D++){var F=fe.getFirstFromArray(A.rounds,"round",D);F=F?F.points.value:"-";B.push('<td align="right">'+F+"</td>")}B.push('<td align="right"><strong>'+fe.numFormat(A.points.value)+"</strong></td>");B.push("</tr>")}B.push("</tbody>");B.push("</table>");B.push('<p class="center small">'+l.gl("game.league.modified")+": "+fe.timeFormat(new Date(C.result.modified))+"</p>");B.push(this.paging(this.page,Math.ceil(C.result.count/this.PAGE_SIZE),5,"fe.page.league.getPage"));if(l.l["description.league"]){B.push('<div style="margin-top:20px;">'+l.l["description.league"]+"</div>")}}else{if(J.name=="Competition.GetPointsTable"&&J.arguments[2]==3){B.push("<table>");B.push('<col width="10%" />');B.push('<col width="55%" />');B.push('<col width="5%" />');B.push('<col width="30%" />');B.push("<thead>");B.push("<tr>");B.push('<th align="center">'+l.gl("game.league.position")+"</th>");B.push('<th align="left">'+l.gl("game.league.nick")+"</th>");B.push("<th>&nbsp;</th>");B.push('<th align="right">'+l.gl("game.league.points")+"</th>");B.push("</tr>");B.push("</thead>");B.push("<tbody>");var H;for(var E=0;E<C.result.items.length;E++){var A=C.result.items[E];var K="";if(A.user.userID==session.user.userID){K="highlight"}if(E%2==1){K+=" even"}B.push('<tr class="'+K+'">');B.push('<td align="center">'+(!H||H!=A.points.position?A.points.position+".":"")+"</td>");H=A.points.position;B.push('<td align="left">'+fe.userLink(A.user)+"</td>");B.push('<td align="center">'+fe.getFlag(A.user)+"</td>");B.push('<td align="right"><strong>'+fe.numFormat(A.points.value)+"</strong></td>");B.push("</tr>")}B.push("</tbody>");B.push("</table>");B.push('<p class="center small">'+l.gl("game.league.modified")+": "+fe.timeFormat(new Date(C.result.modified))+"</p>");B.push(this.paging(this.page,Math.ceil(C.result.count/this.PAGE_SIZE),5,"fe.page.league.getPage"));if(l.l["description.hallOfFame"]){B.push('<div style="margin-top:20px;">'+l.l["description.hallOfFame"]+"</div>")}}}}}geewa.writeHTML("rankingTable",B.join(""));fe.fixPageHeight()},paging:function(A,D,F,B){var E=[];if(D>1){E.push('<p class="center">\n');if(A>0){E.push('<a href="javascript:void(0);" onclick="'+B+"("+(A-1)+');">&laquo; '+l.gl("gamesList.previous")+"</a> |\n")}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> |\n")}E.push("<strong>"+(A+1)+"</strong>\n");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>\n")}if(A<(D-1)){E.push('| <a href="javascript:void(0);" onclick="'+B+"("+(A+1)+');">'+l.gl("gamesList.next")+" &raquo;</a>\n")}E.push("</p>")}return E.join("")}};fe.page.getUserData=function(A,B){geewa.server.ps.call(function(){fe.page.onUserData(arguments[0],arguments[1],B)},"Competition.GetMatches",fe.page.activity.activityID,global.competitionGroupID,fe.page.league.data.type,A)};fe.page.onUserData=function(J,B,C){var A=[];A.push('<table style="margin-bottom: 1em;">');x=fe.tryValue(B,"result.competition.scores.overall");if(x){A.push('<tr><td style="padding-right: 10px;"><strong>'+l.gl("game.league.playerInfo.bestScore")+":</strong></td><td>"+x.value+" "+l.gl("game.league.playerInfo.points")+", "+x.position+". "+l.gl("game.league.playerInfo.position")+", "+l.gl("game.league.playerInfo.reached")+" "+fe.timeBefore(x.time)+"</td></tr>")}x=fe.tryValue(B,"result.competition.points");if(x){A.push("<tr><td><strong>"+l.gl("game.league.playerInfo.league")+":</strong></td><td>"+x.value+" "+l.gl("game.league.playerInfo.points")+", "+x.position+". "+l.gl("game.league.playerInfo.position")+"</td></tr>")}A.push("<tr><td><strong>"+l.gl("game.league.playerInfo.matchesPlayed")+":</strong></td><td>"+fe.tryValue(B,"result.competition.matchCounts.overall",0)+" "+l.gl("game.league.playerInfo.total")+", "+fe.tryValue(B,"result.competition.matchCounts.daily",0)+" "+l.gl("game.league.playerInfo.today")+"</td></tr>");A.push("</table>");var F=B.result.competition.matches;if(fe.page.league.data&&F){var I=[l.gl("global.sunday"),l.gl("global.monday"),l.gl("global.tuesday"),l.gl("global.wednesday"),l.gl("global.thursday"),l.gl("global.friday"),l.gl("global.saturday")];A.push('<div class="league-my-results" style="margin-top: 10px; padding-top: 10px;">');A.push('<div class="actual-round" style="width: 100%; margin: 0;">');A.push('<table style="width: 630px; margin: 0; border-bottom:1px solid #CCCCCC;">');A.push('<col width="20%"/>');A.push('<col width="20%"/>');A.push('<col width="60%"/>');A.push("<tr>");A.push('<th align="left">#</th>');A.push('<th align="center">'+l.gl("game.league.time")+"</th>");A.push('<th align="right">'+l.gl("game.league.score")+"</th>");A.push("</tr>");A.push("</table>");A.push('<div id="holderMatches" style="height:270px; overflow-y:scroll; overflow-x: hidden;">');A.push('<table id="listMatches" style="width: 630px; margin: 0;">');A.push('<col width="20%"/>');A.push('<col width="20%"/>');A.push('<col width="60%"/>');var H;for(var E=0;E<F.length;E++){var D=F[E];var K=new Date(D.startTime);if(K.getDay()!=H){H=K.getDay();A.push('<tr><td colspan="3" style="font-weight: bold; background-color: #eee;">'+I[H]+"</td></tr>")}A.push("<tr>");A.push('<td align="left">'+(E+1)+"</td>");A.push('<td align="center">'+fe.timeFormat(K)+"</td>");A.push('<td align="right">'+(typeof(D.score)!=="undefined"?fe.numFormat(D.score):"-")+"</td>");A.push("</tr>")}A.push("</table></div>");A.push("</div>");A.push("</div>");A.push('<div class="break"></div>')}else{A.push(l.gl("game.league.noMatchesInLeagueUser"))}geewa.writeHTML(C,A.join(""));var G=fe.getIDs("holderMatches","listMatches");if(G[0]&&G[1]){G[0].scrollTop=G[1].offsetHeight}};function __geewa_onEvent(){var A=arguments;window.setTimeout(function(){fe.page.game.onEvent.apply(fe.page.game,A)},0)};
