var __test_log={};var __test_ver=11;var __test_log_cnt=1;function setCookie(b,e,a,g,d,f){var c=b+"="+encodeURIComponent(e)+((a)?"; expires="+a.toUTCString():"")+((g)?"; path="+g:"")+((d)?"; domain="+d:"")+((f)?"; secure":"");document.cookie=c}function getCookie(c){var b=document.cookie;var e=c+"=";var d=b.indexOf("; "+e);if(d==-1){d=b.indexOf(e);if(d!=0){return null}}else{d+=2}var a=document.cookie.indexOf(";",d);if(a==-1){a=b.length}return decodeURIComponent(b.substring(d+e.length,a))}function deleteCookie(a,c,b){if(getCookie(a)){document.cookie=a+"="+((c)?"; path="+c:"")+((b)?"; domain="+b:"")+"; expires=Thu, 01-Jan-70 00:00:01 GMT"}}var prefs_ver=2;function setPrefCookie(a,g){var h=getCookie("__prefs"+prefs_ver);var j=new Object();if(h){var f=h.split("|");for(var e=0;e>>0;if(typeof b!="function"){throw new TypeError()}var e=new Array();var d=arguments[1];for(var c=0;ca+mouseX+5-(document.body.scrollLeft?document.body.scrollLeft:document.documentElement.scrollLeft)){return mouseX+5+"px"}else{return mouseX-5-a+"px"}};WindowSize.getPopupTop=function(a){if(WindowSize.height()>a+mouseY+5-(document.body.scrollTop?document.body.scrollTop:document.documentElement.scrollTop)){return mouseY+5+"px"}else{return mouseY-5-a+"px"}};WindowSize.setPopupPos=function(a){a.style.left=WindowSize.getPopupLeft(a.getWidth());a.style.top=WindowSize.getPopupTop(a.getHeight())};function submitLogin(a,d){var c=document.createElement("FORM");var e=window.location;c.setAttribute("action","/login?redirect="+encodeURI(e));c.setAttribute("method","POST");var b=document.createElement("INPUT");b.setAttribute("name","login");b.setAttribute("value",a);b.setAttribute("type","hidden");c.appendChild(b);var b=document.createElement("INPUT");b.setAttribute("name","pass");b.setAttribute("value",d);b.setAttribute("type","hidden");c.appendChild(b);var b=document.createElement("INPUT");b.setAttribute("name","submit_login");b.setAttribute("value","1");b.setAttribute("type","hidden");c.appendChild(b);document.documentElement.appendChild(c);c.submit();$("register_block").hide()}function logout(){var b=document.createElement("FORM");b.setAttribute("method","POST");var a=document.createElement("INPUT");a.setAttribute("name","submit_logout");a.setAttribute("value",1);a.setAttribute("type","hidden");b.appendChild(a);document.documentElement.appendChild(b);b.submit()}function dbg(a){((window.console&&console.log)||(window.opera&&opera.postError)||window.alert).call(this,a)}function clone(c){if(c==null||typeof(c)!="object"){return c}if(c&&typeof c.length==="number"&&!(c.propertyIsEnumerable("length"))&&typeof c.splice==="function"){var a=new Array()}else{var a=new Object()}for(var b in c){a[b]=clone(c[b])}return a}function showProfile(id){return;var obj=$("popup");var content=$("popup_content");if(profilesCache[id]==undefined){content.update(strLoading);profilesCache[id]=0;new Ajax.Request("/profile/"+id+".popup",{method:"get",parameters:url_params,onSuccess:function(transport){eval("var json="+transport.responseText+";");profilesCache[json.id]=json.html;$("popup_content").update(profilesCache[json.id])}})}else{if(profilesCache[id]!=0){content.update(profilesCache[id])}}obj.style.left=mouseX+10+"px";obj.style.top=mouseY+10+"px";obj.show()}function changeGametypeClick(){$("gametype-link").hide();var a=$("gametype-select");a.show();a.absolutize();a.style.width="auto";a.style.height="auto";a.focus()}function changeGametypeBlur(){$("gametype-select").hide();$("gametype-link").show()}function changeGametypeSelect(){var b=$("gametype-select");var f=$("gametype-link");b.hide();var g="";var c="";for(var d=0;d"+invite.invited_by.login+" приглашает вас присоединиться к "+f+" "+invite.gametype_html+"."+c+"";var b="Присоединиться";var a=function(){new Ajax.Request("/play/"+invite.game_id+".inviteReceive");window.location="/play/?gmid="+invite.game_id};var e=function(){closed_invites.push(invite.timestamp);new Ajax.Request("/play/"+invite.game_id+".inviteReceive")};top_popup(g,b,a,e)}var mail_popup=null;function showMailPopup(){var c='Вам пришло личное сообщение от пользователя '+mail_popup.name+".";var b="Прочитать";var a=function(){window.location="/profile/"+__user__+"/mail/in/"};top_popup(c,b,a)}function initLoginForm(){$$("#login-form .close").last().observe("click",function(){$("login-form").hide()})}function changePin(){if(getPrefCookie("userpanel_pinned")){deletePrefCookie("userpanel_pinned");$$(".userpanel").last().style.position="static";$("pin").removeClassName("active");$("userpanel-dummy").hide()}else{var a=new Date();a.setTime(a.getTime()+3*365*24*3600*1000);setPrefCookie("userpanel_pinned",1);$$(".userpanel").last().style.position="fixed";$("pin").addClassName("active");$("userpanel-dummy").show()}}Effect.NumberChange=Class.create();Object.extend(Object.extend(Effect.NumberChange.prototype,Effect.Base.prototype),{initialize:function(b,d){var a=arguments[2]||{};this.element=$(b);this.startVal=parseInt(this.element.innerHTML);this.finishVal=d;this.delta=(this.finishVal-this.startVal);var c=Math.abs(this.delta*1.5/100);a.duration=a.duration||(c>2?2:c);this.start(a)},update:function(a){var b=parseInt(this.startVal+(this.delta*a)).toString();Element.update(this.element,b)}});function pluralForm(d,b,a,c){d=Math.abs(d)%100;n1=d%10;if(d>10&&d<20){return c}if(n1>1&&n1<5){return a}if(n1==1){return b}return c}String.prototype.encodeHTMLEntities=function(){var a=this;a=a.replace(/\&/g,"&");a=a.replace(/\5){return}setTimeout(function(){new Ajax.Request("/ajax/check-competition",{onSuccess:function(transport){eval("var json="+transport.responseText+";");if(json.result=="ok"){if(game&&game.id==json.info.game_id){return}top_popup("Соревнование по расписанию с рейтингом x"+json.info.rate+" скоро начнется.","Войти в игру",function(){window.location="/play/?gmid="+json.info.game_id},null);setTimeout(function(){close_top_popup()},30000)}else{checkCompetitionAlert(0,tryNum+1)}}})},timeout*1000+10000)}function tlog(c,b){if(!__testmode){return}var a=new Date;if(!b){b=null}__test_log[__test_log_cnt+" ["+a.toString()+"] "+c]=clone(b);__test_log_cnt++}if(typeof(JSON)=="undefined"||typeof(JSON.stringify)=="undefined"){var JSON={};JSON.stringify=function(a){return Object.toJSON(a)}}else{delete Array.prototype.toJSON;delete Object.prototype.toJSON;delete Number.prototype.toJSON;delete String.prototype.toJSON}function showTestLog(){if(!__testmode){return}var b={URL:document.location.href,remote_addr:__remote_addr,browsers:clone(Prototype.Browser),prefs:getCookie("__prefs2").split("|"),log:__test_log};var a=window.open("about:blank","testlog","width=500,height=300,toolbar=no,status=no,scrollbars=yes,location=no,menubar=yes");a.document.write("Версия лога: "+__test_ver+"
"+JSON.stringify(b).encodeHTMLEntities()+"");a.focus()}function __dump_item(b,c,f){var e="";var d="";for(var a=0;a [i]null[/i]"}else{e+="\n"+d+"[:i]"+b+"[/:i] [richinfo "+(f+1)+"]";e+=dump(c,f+1);e+="[/richinfo "+(f+1)+"]"}}else{if(typeof(c)!="function"){e+="\n"+d+"[:i]"+b+"[/:i] => "+c+""}}return e}function dump(a,g){var f="";var e="";if(!g){g=0}for(var b=0;b [i]null[/i]"}else{e+="\n"+f+"[:i]"+c+"[/:i] [richinfo "+(g+1)+"]";e+=dump(d,g+1);e+="[/richinfo "+(g+1)+"]"}}else{if(typeof(d)!="function"){e+="\n"+f+"[:i]"+c+"[/:i] => "+d+""}}}}else{e="===>"+a+"<===("+typeof(a)+")"}if(g==0){return"[richinfo "+g+"]"+e+"[/richinfo "+g+"]"}else{return e}}Ajax.Responders.register({onCreate:function(b){if(b.options.timeout){b.timeoutId=window.setTimeout(function(){if(b.transport.readyState>=1&&b.transport.readyState<=3){b.transport.abort();if(b.options.onFailure){b.options.onFailure(b.transport,b.json)}}},b.options.timeout)}if(b.options.tries&&b.options.tries>1){var a=b.options.onFailure?b.options.onFailure:null;b.options.onFailure=function(d,c){setTimeout(function(){var e=b.options;e.tries--;e.onFailure=a;new Ajax.Request(b.url,e)},500)}}},onComplete:function(a){if(a.options.timeout){window.clearTimeout(a.timeoutId)}}});function getMovie(a){if(navigator.appName.indexOf("Microsoft")!=-1){return window[a]}else{return document[a]}}$selection={getText:function(){var a="";if(a=window.getSelection){a=window.getSelection().toString()}else{a=document.selection.createRange().text}return a}};function initBBWidgets(){$$(".hidetop").each(function(a){a.onclick=function(){var b=this.id.match(/hidetop-(.+)/);if(this.nextSibling.id=="hidecont-"+b[1]){Effect.toggle(this.nextSibling,"slide",{duration:0.3})}this.toggleClassName("expanded")}})}$c=(function(){var b={};var a=0;return function(c){a++;return(b[c]||(b[c]=$(c)))}})();Effect.PlayerEnterRace=Class.create();Object.extend(Object.extend(Effect.PlayerEnterRace.prototype,Effect.Base.prototype),{initialize:function(b){var a=arguments[1]||{};this.element=$(b);this.startX=-40;this.finishX=0;this.startOpacity=0;this.finishOpacity=1;this.deltaX=(this.finishX-this.startX);this.deltaOpacity=(this.finishOpacity-this.startOpacity);a.duration=a.duration||1;a.transition=Effect.Transitions.linear;this.update(0);this.start(a)},update:function(b){var a=this.finishX-this.deltaX*Math.exp(-b*5);var c=this.finishOpacity-this.deltaOpacity*Math.exp(-b*5);if(b==1){a=this.finishX;c=this.finishOpacity}this.element.setStyle({left:a+"px",opacity:c})}});Effect.DropIn=function(b){b=$(b);var a={top:b.getStyle("top"),opacity:b.getInlineOpacity()};b.setStyle({top:parseFloat(b.getStyle("top"))-100+"px",opacity:0});return new Effect.Parallel([new Effect.MoveY(b,{y:100,sync:true}),new Effect.Opacity(b,{sync:true,from:0,to:1})],Object.extend({duration:0.5,beforeSetup:function(c){c.effects[0].element.makePositioned()},afterFinishInternal:function(c){c.effects[0].element.undoPositioned().setStyle(a)}},arguments[1]||{}))};Effect.DropOut=function(b){b=$(b);var a={top:b.getStyle("top"),left:b.getStyle("left"),opacity:b.getInlineOpacity()};return new Effect.Parallel([new Effect.MoveY(b,{y:100,sync:true}),new Effect.Opacity(b,{sync:true,to:0})],Object.extend({duration:0.5,beforeSetup:function(c){c.effects[0].element.makePositioned()},afterFinishInternal:function(c){c.effects[0].element.hide().undoPositioned().setStyle(a)}},arguments[1]||{}))};Effect.MoveY=Class.create(Effect.Base,{initialize:function(b){this.element=$(b);if(!this.element){throw (Effect._elementDoesNotExistError)}var a=Object.extend({y:0,mode:"relative"},arguments[1]||{});this.start(a)},setup:function(){this.element.makePositioned();this.originalTop=parseFloat(this.element.getStyle("top")||"0");if(this.options.mode=="absolute"){this.options.y=this.options.y-this.originalTop}},update:function(a){this.element.setStyle({top:(this.options.y*a+this.originalTop).round()+"px"})}});function drop_message(c,a){a=a||{};var b=$("drop_message").down(".popup-box");b.down(".c").update(c);new Effect.DropIn(b);$("drop_message").show();b.show();if(a.autohide){var d=setTimeout(function(){new Effect.DropOut(b)},a.autohide*1000)}$("drop_message").down(".close").onclick=function(){if(d){clearInterval(d)}new Effect.DropOut(b)}}function postUrl(a){var b=document.createElement("FORM");b.method="POST";b.action=a;$$("body")[0].appendChild(b);b.submit()};