
var i=0;var myRequest="no";var vprocesse=0;var loading_now=0;var timer;var myObj={};var perpage=1;var perpage_activity=1;var was_id=0;var Timer=0;function pljusuem(chto,naskoko,type){if(type==1){price=parseFloat(chto.innerHTML);var num=new Number(price);price+=naskoko;chto.innerHTML=price.toFixed(1);}else{price=parseInt(chto.innerHTML);price+=naskoko;chto.innerHTML=price;}}
function get_txt(obj){txt="<b>";if(obj.get('level')){txt+="<span style='color:#ffc12c;'>";}else{txt+="<span style='color:#fff;'>";}
txt+=obj.get('name');if(obj.get('level')){txt+=" [<span style='color:#fff'>"+obj.get('level')+"</span>]";}
txt+="</b></span>";if(obj.get('desc')){add='<br><br>'+obj.get('desc');}else{add="";st=obj.get('stats').split('_');if(st[0]==st[1]&&st[1]==st[2]&&st[2]==st[3]&&st[3]==st[4]&&st[0]>0){plusall=1;}else{plusall=0;}
stuff=stats_javascript;for(i=0;i<=stuff.length-1;i++){if(parseFloat(st[i])>0){if(i==7||i==8||i==11||i==12){b="%";}else{b="";}
if(i==0||i==1||i==2||i==3||i==4){if(plusall!=1){add=add+stuff[i]+" +"+st[i]+b+"<br>";}else{if(i==4){add=add+'+'+st[i]+' ко всем основным навыкам<br>';}}}else{add=add+stuff[i]+" +"+st[i]+b+"<br>";}}}
if(add){txt=txt+"<br><br>";}}
txt+=add;return txt;}
function getRandomInt(min,max){return Math.floor(Math.random()*(max-min+1))+min;}
function pet_item_hover(){$(document.body).getElements('[attr2=pet_text]').addEvents({'mouseenter':function(){txt=this.get('info');$('pet_info_hover_text').innerHTML=txt;},'mousemove':function(event){if(txt){pos=get_cursor_position(event);$('pet_info_hover').setStyles({'top':pos[1]+10,'left':pos[0]+15});}else{this.fireEvent('mouseenter');}},'mouseleave':function(event){$('pet_info_hover').setStyles({'top':'-300px','left':'-300px'});$('pet_info_hover_text').innerHTML='';}});}
function start_regen_hp(){Timer=clearInterval(Timer);tmp_hp=0;if($type($('pet_about'))&&$('pet_about').get('pet_doing')!=1){max_hp=parseInt($('pet_about').get('max_hp'));curr_hp=parseInt($('pet_about').get('curr_hp'));per_min=parseInt($('pet_about').get('hp_per_minute'));period=10000;if(curr_hp<max_hp){Timer=hp_regen.periodical(period,0,[max_hp,per_min,period]);}}}
function hp_regen(max_hp,per_min,period){curr_hp=parseInt($('pet_about').get('curr_hp'));if(curr_hp<max_hp){tmp_hp=tmp_hp+per_min/(60000/period);new_curr=curr_hp+Math.round(tmp_hp);if(new_curr>max_hp){new_curr=max_hp;Timer=clearInterval(Timer);}
if($type($('pet_current_hp'))){$('pet_current_hp').innerHTML=new_curr;}
new_width=((118*new_curr)/max_hp);if($type($('tpet_hp'))){$('tpet_hp').setStyle('width',new_width+'px');}}}
function blog_hover(){$('userinfo').setStyles({top:myObj.myVar1,left:myObj.myVar2});$('change').innerHTML=myObj.myVar3;$('userinfo').setStyle('opacity','0');$('userinfo').setStyle('display','block');new Fx.Tween('userinfo',{duration:300,transition:Fx.Transitions.Quart.easeInOut}).start("opacity",0,1);}
function start_timeout(){timer=setTimeout("blog_hover()",300);}
function stop_timeout(){clearTimeout(timer);}
if(screen.width>1024){c_start=getCookie('show_fixed');if(!c_start){if($type($('fixme'))){$('fixme').setStyle('display','block');}
var myCookie=Cookie.write('show_fixed','1',{duration:365});}}else{var myCookie=Cookie.write('show_fixed','0',{duration:365});}
var testfunc=function(event){pos=get_cursor_position(event);$('loader').setStyles({top:pos[1],left:pos[0]+16});}
function getCookie(c_name)
{if(document.cookie.length>0)
{c_start=document.cookie.indexOf(c_name+"=");if(c_start!=-1)
{c_start=c_start+c_name.length+1;c_end=document.cookie.indexOf(";",c_start);if(c_end==-1)c_end=document.cookie.length;return unescape(document.cookie.substring(c_start,c_end));}}
return"";}
function start_loading(){$('bbody').addEvent('mousemove',testfunc);}
function stop_loading(){$('bbody').removeEvent('mousemove',testfunc);$('loader').setStyles({top:-200,left:-200});}
function get_cursor_position(event){event=event||window.event;if(event.pageX||event.pageY){x=event.pageX;y=event.pageY;}else{x=event.client.x+
(document.documentElement.scrollLeft||document.body.scrollLeft)-
document.documentElement.clientLeft;y=event.client.y+
(document.documentElement.scrollTop||document.body.scrollTop)-
document.documentElement.clientTop;}
var pos=new Array();pos[0]=x;pos[1]=y;return pos;}
function htmlspecialchars(html){html=html.replace(/&/g,"&amp;");html=html.replace(/</g,"&lt;");html=html.replace(/>/g,"&gt;");html=html.replace(/"/g,"&quot;");return html;}
function esc(str){str=escape(str);return str.replace(/[*+\/@]|%20/g,function(s){switch(s){case"*":s="%2A";break;case"+":s="%2B";break;case"/":s="%2F";break;case"@":s="%40";break;case"%20":s="+";break;}
return s;});}
function findPos(obj){var curleft=curtop=0;if(obj.offsetParent){do{curleft+=obj.offsetLeft;curtop+=obj.offsetTop;}while(obj=obj.offsetParent);}
return[curleft,curtop];}
function admin_photo_preview(){$$('.admin_photo_preview').addEvents({'mousemove':function(e){broke=this.get('attr').split('#');pos=get_cursor_position(e);$('admin_photo_preview').setStyles({'top':pos[1]+5,'left':pos[0]+10,'background-image':"url(gallery/"+broke[0]+"/"+broke[1]+".jpg)"});},'mouseleave':function(){$('admin_photo_preview').setStyles({'top':-200,'left':-200,'background-image':"url()"});}});}
var myfunc=function(){$('full').setStyle('top',window.getScroll().y+"px");}
window.addEvent('scroll',function(){myfunc();});window.addEvent('domready',function(){if($type($('game_search'))){var search_input=1;$('game_search').addEvents({'keydown':function(event){if(event.key=="enter"){clearTimeout(search_input);gogo();}else{if(search_input){clearTimeout(search_input);}
search_input=setTimeout(gogo,500);}}});var gogo=function(){if($('game_search').value!=""&&$('game_search').value.length>1){$('game_search_field').setStyle('display','block');$('game_loading').innerHTML="<img src=files/loading2.gif>";myRequest=new Request({url:home+'ajax.php',method:"get",onSuccess:function(response){$('game_search_close').setStyle('display','block');$('game_loading').innerHTML="";$('game_search_field').innerHTML=response;$$(".game_search_item").addEvents({'mouseenter':function(){if(this.getStyle('padding-left')=="5px"){this.setStyle('background-color','#ddebf4');}},'mouseleave':function(){if(this.getStyle('padding-left')=="5px"){this.setStyle('background-color','#f8fbfd');}},'click':function(){if(this.get('class')!="game_search_selected"){this.setStyle('background-color','#ccecce');this.set('class','game_search_selected');$('del_'+this.get('id')).setStyle('display','block');myRequest2=new Request({url:home+'ajax.php',method:"post",onSuccess:function(){$('added_games').fireEvent('domready');}}).send('type=5&str='+this.get('id'));}}});$$(".game_search_selected").addEvents({'mouseenter':function(){if(this.getStyle('background-color')=='#f8fbfd'){this.setStyle('background-color','#ddebf4');}},'mouseleave':function(){if(this.getStyle('background-color')=='#ddebf4'){this.setStyle('background-color','#f8fbfd');}},'click':function(){if(this.get('class')!="game_search_selected"){this.setStyle('background-color','#ccecce');this.set('class','game_search_selected');$('del_'+this.get('id')).setStyle('display','block');myRequest2=new Request({url:home+'ajax.php',method:"post",onSuccess:function(){$('added_games').fireEvent('domready');}}).send('type=5&str='+this.get('id'));}}});$$(".game_search_delete").addEvents({'click':function(event){broke=this.get('id').split('_');this.setStyle('display','none');$('game_'+broke[2]).set('class','game_search_item');$('game_'+broke[2]).setStyle('background-color','#f8fbfd');myRequest2=new Request({url:home+'ajax.php',method:"post",onSuccess:function(){$('added_games').fireEvent('domready');}}).send('type=6&str='+broke[2]);return false;}});$$('.delete_game_overall').addEvents({'click':function(){id=this.get('id');if(confirm('Вы уверены?')){myRequest2=new Request({url:home+'ajax.php',method:"post",onSuccess:function(){$(id).tween('opacity',0);}}).send('type=39&id='+id);}
return false;}});$$('.set_game_release').addEvents({'click':function(){id=this.get('id');var reply=prompt("Введите дату выхода (03.11.2010)","");if(reply){myRequest=new Request({url:home+'ajax.php',method:"post"}).send('type=60&id='+id+'&date='+reply);}
return false;}});}}).send('type=4&str='+encodeURIComponent($('game_search').value));}}
$('game_search_close').addEvents({'click':function(){$('game_search_field').innerHTML='';$('game_search_field').setStyle('display','none');$('game_search_close').setStyle('display','none');}});var stopmove=0;$('added_games').addEvents({'domready':function(){myRequest=new Request({url:home+'ajax.php',method:"get",onSuccess:function(response){$('added_games').innerHTML=response;$$('.stars_hover').addEvents({'mouseover':function(event){stopmove=0;},'mousemove':function(event){if(stopmove==0){shirina=event.page.x-(this.getPosition().x);zvezda=16;for(i=1;i<=10;i++){if(shirina>((i*zvezda)-12)){new_shirina=i*zvezda;}}
if(shirina<8){new_shirina=0;}
pos=findPos(this);this.setStyles({'background-position':(new_shirina-160)});}},'mouseleave':function(){if(stopmove==0){this.setStyles({'background-position':-160});}},'click':function(){start_loading();if(new_shirina>=16&&new_shirina<=160){stopmove=1;broke=this.get('id').split('_');myRequest2=new Request({url:home+'ajax.php',method:"post",onSuccess:function(response){stop_loading();$('rating_'+broke[1]).innerHTML=new_shirina/16;}}).send('type=7&str='+(new_shirina/16)+'&str2='+broke[1]);}}});$$('.game_stuff').addEvents({'click':function(){start_loading();myval=this.get('id');myRequest2=new Request({url:home+'ajax.php',method:"post",onSuccess:function(response){stop_loading();if(response==1){$(myval).setStyle('background','url(files/accept.png) no-repeat');}else if(response==2){$(myval).setStyle('background','url(files/accept2.png) no-repeat');}else if(response==3){$(myval).setStyle('background','url(files/favicon.png) no-repeat');}else if(response==4){$(myval).setStyle('background','url(files/play2.png) no-repeat');}else if(response==5){$(myval).setStyle('background','url(files/heart.png) no-repeat');}else if(response==6){$(myval).setStyle('background','url(files/heart2.png) no-repeat');}
$(myval).setStyle('background-color','#f0fafe');}}).send('type=9&str='+this.get('id'));},'mouseenter':function(){this.setStyle('background-color','#f0fafe');},'mouseleave':function(){this.setStyle('background-color','#ffffff');}});$$('.button_delete').addEvents({'click':function(){if(confirm('Вы уверены?')){broke=this.get('id').split('_');new Fx.Tween("game_full_"+broke[1],{duration:300,transition:Fx.Transitions.Quart.easeInOut,onComplete:function(){myRequest2=new Request({url:home+'ajax.php',method:"post",onSuccess:function(response){$('added_games').fireEvent('domready');gogo();}}).send('type=10&str='+broke[1]);}}).start("opacity",1,0);}
return false;}});}}).send('type=8');}});}
if($type($('mydiv'))){$('mydiv').addEvents({'click':function(){st="16px";end="36px";settext="<div style='padding-top:5px'>"+"<input id=logfocus class=log name=login style='margin-right:5px'>"+"<input class=log name=pass type=password style='margin-right:12px'>"+"<input type=image src='files/login.png' value=subm></div>";i=1;$('mydiv').tween('opacity',[1,0]);new Fx.Tween('moving',{duration:500,transition:Fx.Transitions.Quart.easeInOut,onChainComplete:function(){$('loginform_appear').innerHTML=settext;$('logfocus').focus();}}).start("height",st,end);return false;}});}
$$('.cell').addEvents({'mouseenter':function(){this.setStyle('background-image','url("files/s2.png")');},'mouseleave':function(){this.setStyle('background-image','url("files/s1.png")');},'click':function(){this.get('id');broke=this.get('id').split('_');if(broke[1]){location.href='a/'+broke[1];}else{location.href=home;}}});if($type($('searchf'))){$('searchf').addEvents({'focus':function(){if(this.get('value')=='Поиск по сайту')this.set('value','');},'blur':function(){if(this.get('value')=='')this.set('value','Поиск по сайту');}});}
if($type($('searchforum'))){$('searchforum').addEvents({'focus':function(){if(this.get('value')=='Искать по форуму')this.set('value','');},'blur':function(){if(this.get('value')=='')this.set('value','Искать по форуму');}});}
if($type($('close_button'))){$('close_button').addEvents({'click':function(){var myCookie=Cookie.write('closed_motivator','1',{duration:365});new Fx.Tween('motivator',{duration:200,transition:Fx.Transitions.Quart.easeInOut,onComplete:function(){$('below_motivator').tween('margin-top',0,"-220px");}}).start("opacity",1,0);}});}
if($type($('question_input'))){$('question_input').addEvents({'focus':function(){if(this.get('value')=='Напиши свой вопрос')this.set('value','');new Fx.Tween('question_input',{duration:500,transition:Fx.Transitions.Quart.easeInOut}).start("color","#bbb","#000");new Fx.Tween('question_input',{duration:500,transition:Fx.Transitions.Quart.easeInOut}).start("border-color","#bbb","#000");},'blur':function(){if(this.get('value')=='')this.set('value','Напиши свой вопрос');new Fx.Tween('question_input',{duration:500,transition:Fx.Transitions.Quart.easeInOut}).start("color","#000","#bbb");new Fx.Tween('question_input',{duration:500,transition:Fx.Transitions.Quart.easeInOut}).start("border-color","#000","#bbb");}});}
$$('.notlogged').addEvents({'mousemove':function(event){pos=get_cursor_position(event);x=pos[0];y=pos[1];$('notloggedin').setStyles({top:y+10,left:x-250});},'mouseleave':function(){$('notloggedin').setStyles({top:'-200px',left:'-200px'});return false;},'click':function(){return false;}});$('logo').addEvents({'click':function(){location.href=home;}});if($type($('regform_1'))){$('regform_1').addEvents({'focus':function(){var mod='regdesc_1';this.setStyle("border-color","#000");if(!(this.value)){$(mod).setStyle("color","#000");$(mod).innerHTML='3-20 символов. Русский и латинский алфавит, цифры, пробел, точка.';}},'blur':function(){this.setStyle("border-color","#E8E8E8");myRequest=new Request({url:home+'ajax.php',method:"get",onSuccess:function(response){var mod='regdesc_1';if(response){$(mod).setStyle("color","red");if(response==1){$(mod).innerHTML='Слабовато. Минимальная длина ника - 3 символа.';}else if(response==4){$(mod).innerHTML='Ну ты разогнался! Максимальная длина ника - 15 символов.';}else if(response==2){$(mod).innerHTML='Нее, так не пойдёт! Разрешены только буквы русского и латинского алфавита, цифры, пробел и точка.';}else if(response==3){$(mod).innerHTML='Кто-то оказался проворнее тебя, этот ник уже занят!';}}else{$(mod).setStyle("color","green");$(mod).innerHTML='Во, в самый раз!';}}}).send('type=2&str='+encodeURIComponent(this.value));},'domready':function(){if(this.value||reg_posted){$('regform_1').fireEvent('blur');}}});$('regform_2').addEvents({'focus':function(){var mod='regdesc_2';this.setStyle("border-color","#000");if(!(this.value)){$(mod).setStyle("color","#000");$(mod).innerHTML='Указывайте реальный мейл, без него регистрация невозможна.';}},'blur':function(){this.setStyle("border-color","#E8E8E8");myRequest=new Request({url:home+'ajax.php',method:"get",onSuccess:function(response){var mod='regdesc_2';if(response){$(mod).setStyle("color","red");if(response==1){$(mod).innerHTML='Мейл обязателен. Соберись!';}else if(response==2){$(mod).innerHTML='Этот мейл кто-то уже использует. Уж не ты ли? ;)';}
return false;}else{$(mod).setStyle("color","green");$(mod).innerHTML='С пивом потянет.';}}}).send('type=3&str='+encodeURIComponent(this.value));},'domready':function(){if(this.value||reg_posted){$('regform_2').fireEvent('blur');}}});$('regform_3').addEvents({'focus':function(){var mod='regdesc_3';this.setStyle("border-color","#000");if(!(this.value)){$(mod).setStyle("color","#000");$(mod).innerHTML='Минимум 5 символов.';}},'blur':function(){this.setStyle("border-color","#E8E8E8");if(($('regform_3').value.length)<5){$('regdesc_3').setStyle("color","red");$('regdesc_3').innerHTML="5 символов минимум. Потом ещё спасибо скажешь ;)";}else{$('regdesc_3').setStyle("color","green");$('regdesc_3').innerHTML="Что ж, ты почти у цели.";}},'domready':function(){if(this.value||reg_posted){$('regform_3').fireEvent('blur');}}});$('regform_4').addEvents({'focus':function(){var mod='regdesc_4';this.setStyle("border-color","#000");if(!(this.value)){$(mod).setStyle("color","#000");$(mod).innerHTML='Ещё разок, вдруг ошиблись? ;)';}},'blur':function(){this.setStyle("border-color","#E8E8E8");var mod='regdesc_4';if($('regform_4').value!=$('regform_3').value){$(mod).setStyle("color","red");$(mod).innerHTML="А пароли-то не совпадают!";}else if(($('regform_4').value.length)<5){$(mod).setStyle("color","red");$(mod).innerHTML="5 символов минимум. Потом ещё спасибо скажешь ;)";}else{$(mod).setStyle("color","green");$(mod).innerHTML="Готово! Ещё парочка кликов..";}},'domready':function(){if(this.value||reg_posted){$('regform_4').fireEvent('blur');}}});}
$$('.right_corner').addEvents({'click':function(){broke=this.get('id').split('_');if($('friend_field_'+broke[2]).getStyle('color')!='#d7ffdf'){myRequest2=new Request({url:home+'ajax.php',method:"post",onSuccess:function(response){$('friend_field_'+broke[2]).setStyle('color','#d7ffdf');$('friend_field_'+broke[2]).innerHTML='приглашен в друзья&nbsp;';}}).send('type=11&str='+broke[2]);}
return false;}});if($type($('notify_field'))){$('notify_field').addEvents({'domready':function(){myRequest=new Request({url:home+'ajax.php',method:"get",onSuccess:function(response){$('notify_field').innerHTML=response;$$('.notify_delete_button').addEvents({'click':function(){broke=this.get('id').split('_');new Fx.Tween("notify_"+broke[1],{duration:300,transition:Fx.Transitions.Quart.easeInOut,onComplete:function(){myRequest2=new Request({url:home+'ajax.php',method:"post",onSuccess:function(response){$('notify_field').fireEvent('domready');}}).send('type=14&str='+broke[1]);}}).start("opacity",1,0);}});$$('.acceptfriend').addEvents({'click':function(){broke=this.get('id').split('_');new Fx.Tween("notify_"+broke[1],{duration:300,transition:Fx.Transitions.Quart.easeInOut,onComplete:function(){myRequest2=new Request({url:home+'ajax.php',method:"post",onSuccess:function(response){$('notify_field').fireEvent('domready');}}).send('type=15&str='+broke[1]);}}).start("opacity",1,0);return false;}});$$('.denyfriend').addEvents({'click':function(){broke=this.get('id').split('_');new Fx.Tween("notify_"+broke[1],{duration:300,transition:Fx.Transitions.Quart.easeInOut,onComplete:function(){myRequest2=new Request({url:home+'ajax.php',method:"post",onSuccess:function(response){$('notify_field').fireEvent('domready');}}).send('type=18&str='+broke[1]);}}).start("opacity",1,0);return false;}});$$('.accept_gift').addEvent('click',function(){id=this.get('id');attr=this.get('attr');myRequest=new Request({url:home+'ajax.php',method:"post",onSuccess:function(response){$('notify_field').fireEvent('domready');}}).send('type=59&id='+id+'&attr='+attr);});admin_photo_preview();help_text();}}).send('type=12');}});}
$$('.notify_delete_all').addEvents({'click':function(){myRequest=new Request({url:home+'ajax.php',method:"post",onSuccess:function(response){$('notify_field').fireEvent('domready');}}).send('type=13');return false;}});if($type($('admin_friends'))){$('admin_friends').addEvents({'domready':function(){myRequest=new Request({url:home+'ajax.php',method:"get",onSuccess:function(response){$('admin_friends').innerHTML=response;$$('.delete_friend').addEvents({'click':function(){if(confirm('Вы уверены?')){broke=this.get('id').split('_');myRequest2=new Request({url:home+'ajax.php',method:"post",onSuccess:function(response){$('admin_friends').fireEvent('domready');}}).send('type=17&str='+broke[1]);}
return false;}});}}).send('type=16');}});}
$$('.platform_bg').addEvents({'click':function(){myval=this.get('id');broke=myval.split('_');if($(myval).getStyle('font-weight')=="bold"){$(myval).setStyle('font-weight','normal');$(myval).setStyle('background','url("files/platform_bg.png")');}else{$(myval).setStyle('font-weight','bold');$(myval).setStyle('background','url("files/platform_bg2.png")');}
myRequest=new Request({url:home+'ajax.php',method:"post",onSuccess:function(response){}}).send('type=19&str='+broke[1]);}});if($type($('ask_field'))){var search_input=1;$('ask_field').addEvents({'keydown':function(event){if(event.key=="enter"){clearTimeout(search_input);gogo2();}else{if(search_input){clearTimeout(search_input);}
search_input=setTimeout(gogo2,300);}}});}
var gogo2=function(){start_loading();if($('ask_field').value!=""&&$('ask_field').value.length>1){myRequest=new Request({url:home+'ajax.php',method:"get",onSuccess:function(response){stop_loading();$('ask_field_done').innerHTML='';$('ask_field_done').setStyle('display','block');$('ask_field_done').innerHTML=response;$$('.ask_search_item').addEvents({'mouseenter':function(){this.setStyle('background-color','#d4d4d4');},'mouseleave':function(){this.setStyle('background-color','#ffffff');},'click':function(){$('ask_field').set('value',this.get('text'));$('ask_field_done').setStyle('display','none');}});}}).send('type=20&str='+encodeURIComponent($('ask_field').value));}};if($type($('sort'))){$('sort').addEvents({'change':function(){location.href=this.get('value');}});}
$$('.add_delete').addEvents({'mouseenter':function(){this.setStyle('background-color','#f0fafe');},'mouseleave':function(){this.setStyle('background-color','#ffffff');},'click':function(){gid=this.get('id');broke=gid.split('_');start_loading();if($(gid).get('attr')=="cancel"){myRequest=new Request({url:home+'ajax.php',method:"post",onSuccess:function(response){stop_loading();alert(response);$(gid).set('attr','accept');$(gid).setStyle('background-image','url(files/accept.png)');$(gid+"_text").set('text','Добавить в коллекцию');}}).send('type=6&str='+broke[1]);}else{myRequest=new Request({url:home+'ajax.php',method:"post",onSuccess:function(response){stop_loading();$(gid).set('attr','cancel');$(gid).setStyle('background-image','url(files/cancel.png)');$(gid+"_text").set('text','Удалить из коллекции');}}).send('type=5&str='+gid);}}});if($type($('game_desc_click'))){$('game_desc_click').addEvents({'click':function(){$('game_desc').innerHTML='<textarea id=game_page_textarea></textarea><div class=spacer_5px></div><input id=add_game_description type=image src="files/add_game_description.png">';$('game_page_textarea').focus();$('add_game_description').addEvents({'click':function(){myRequest=new Request({url:home+'ajax.php',method:"post",onSuccess:function(response){$('game_desc').innerHTML="<b>Описание появится на сайте после проверки модератором</b>";}}).send('type=21&str='+encodeURIComponent($('game_page_textarea').value)+'&game_id='+$('game_desc_id').value);}});return false;}});}
function comments_edit(){$$('.answer_edit').addEvents({'click':function(event){start_loading();myval=this.get('id').split('_');$('answeredit_'+myval[1]).setStyle('display','none');if(this.get('attr')=="comment"){send_comment="&comment=1";}else if(this.get('attr')=="wall"){send_comment="&comment=2";}else{send_comment="";}
myRequest=new Request({url:home+'ajax.php',method:"get",onSuccess:function(response){stop_loading();if(response){$('answer_'+myval[1]).innerHTML="<textarea id=answerfield_"+myval[1]+" class=answer_edit_active>"+(response)+"</textarea><input id=edit_submit style='margin-top:8px' type=image src=files/edit_submit.png>";$('answerfield_'+myval[1]).focus();$('edit_submit').addEvents({'click':function(){start_loading();myRequest2=new Request({url:home+'ajax.php',method:"post",onSuccess:function(response){stop_loading();$('answeredit_'+myval[1]).setStyle('display','block');$("answer_"+myval[1]).innerHTML=response;}}).send('type=23&str='+encodeURIComponent($("answerfield_"+myval[1]).value)+'&id='+myval[1]+send_comment);}});}}}).send('type=22&str='+myval[1]+send_comment);}});}
if($type($('radio2'))){$('radio2').addEvents({'click':function(){$('img_related_game').setStyle('display','block');this.blur();}});}
if($type($('radio1'))){$('radio1').addEvents({'click':function(){$('img_related_game').setStyle('display','none');this.blur();}});}
if($type($('image_form'))){$('image_form').addEvents({'submit':function(){$('img_add').innerHTML='<img src=files/image_loading.gif height=41>';$('image_form').submit();}});}
$$('.profile_pictures').addEvents({'click':function(){myval=this.get('id').split('_');if(this.get('attr')=="video"){location.href=home+'a/vid/'+myval[1];}else{location.href=home+'a/pic/'+myval[1];}}});if($type($('picture_bg'))){$('picture_bg').addEvents({'mouseover':function(){if($type($('picture_prev'))){$('picture_prev').setStyle('display','block');}
if($type($('picture_next'))){$('picture_next').setStyle('display','block');}},'mouseleave':function(){if($type($('picture_prev'))){$('picture_prev').setStyle('display','none');}
if($type($('picture_next'))){$('picture_next').setStyle('display','none');}}});}
if($type($('prev_button'))){$('prev_button').addEvents({'mouseover':function(){this.src='files/picture_prev2.png';},'mouseleave':function(){this.src='files/picture_prev.png';}});}
if($type($('next_button'))){$('next_button').addEvents({'mouseover':function(){this.src='files/picture_next2.png';},'mouseleave':function(){this.src='files/picture_next.png';}});}
$$('.gallery_pictures').addEvents({'click':function(){myval=this.get('id').split('_');if(this.get('attr')=="video"){location.href=home+'a/vid/'+myval[1];}else{location.href=home+'a/pic/'+myval[1];}}});myval=location.href.split('#');if(myval[1]=="last"){var myFx=new Fx.Scroll($(document.body),{duration:500,wait:false}).start(0,$('last_comment').getPosition().y);}
var opened=0;if($type($('full'))){$('fixme').addEvents({'mouseenter':function(){if(opened==0){$('add_content_div').setStyles({'height':'0px','display':'block','padding':'0px 7px 5px 7px'});new Fx.Tween('add_content_div',{duration:200,transition:Fx.Transitions.Quart.easeInOut}).start('height',"0px","100px");}
opened=1;}});$('full').addEvents({'mouseleave':function(){opened=0;$('add_content_div').setStyles({'height':'0px','display':'none','padding':'0px'});}});}
if($type($('wall_form'))){$('wall_form').addEvents({'submit':function(){start_loading();if($('wall_add_text').value){myRequest2=new Request({url:home+'ajax.php',method:"post",onSuccess:function(response){myRequest=new Request({url:home+'ajax.php',method:"get",onSuccess:function(response){stop_loading();$('wall').innerHTML=response;$('wall_add_text').value='';vmore();}}).send('type=25&komu='+($('wall_komu').value));}}).send('type=26&str='+encodeURIComponent($('wall_add_text').value)+'&komu='+($('wall_komu').value));}else{stop_loading();}
return false;}});}
function vmore(){$$('.view_more').addEvents({'click':function(){perpage=perpage+1;this.innerHTML='<img src=files/image_loading.gif>';this.setStyle('background','url()');myRequest=new Request({url:home+'ajax.php',method:"get",onSuccess:function(response){stop_loading();$('wall').innerHTML=response;over_avatar();comments_edit();vmore();delete_stuff();}}).send('type=25&komu='+($('wall_komu').value)+'&perpage='+perpage);}});}
$$('.delete_photo').addEvents({'click':function(){start_loading();if(confirm('Вы уверены?')){broke=this.get('id').split('_');if(broke[0]=="vid"){deleted="video_deleted";}else{deleted="deleted";}
myRequest=new Request({url:home+'ajax.php',method:"post"}).send('type=27&str='+this.get('id'));$('gallery_active').fade(0.3);this.fade(0);new Fx.Tween('picture_delete',{transition:Fx.Transitions.Quart.easeInOut,onComplete:function(){stop_loading();$('picture_delete').innerHTML='<div style="padding:30px;clear:both;"><img src=files/'+deleted+'.png></div>';$('picture_delete').fade('in');}}).start("opacity",1,0);}
return false;}});$$('.jokevote').addEvents({'click':function(){gid=this.get('id');attr=this.get('attr');start_loading();myRequest=new Request({url:home+'ajax.php',method:"post",onSuccess:function(response){stop_loading();$('joke_voting_hide_'+gid).innerHTML='';}}).send('type=28&str='+gid+'&attr='+attr);}});$$('.joke_sort').addEvents({'change':function(){location.href='a/jumor/'+this.get('value');}});$$('.users_sort').addEvents({'change':function(){location.href='a/users/'+this.get('value');}});$$('.best_answer').addEvents({'click':function(){if(confirm('Имейте ввиду, что накрутка лучших ответов аккаунтами-клонами запрещена и может привести к блоку аккаунта.')){start_loading();gid=this.get('id');myRequest=new Request({url:home+'ajax.php',method:"post",onSuccess:function(response){stop_loading();if(response=="done"){$(document.body).getElements('.best_answer').setStyle('display','none');$('qtop_'+gid).setStyle('background','url("files/answer_top2.png")');$('qmid_'+gid).setStyle('background','url("files/answer_bg2.png")');$('qbot_'+gid).setStyle('background','url("files/answer_bottom2.png")');}else if(response=="err1"){alert('Ваш IP совпадает с IP ответившего.');}}}).send('type=29&str='+gid);}}});if($type($('textarea-1'))){var myMooEditableInstance=$('textarea-1').mooEditable({actions:'bold italic underline strikethrough | urlimage'});}
if($type($('admin_activity_menu'))){attribute=$('admin_activity_menu').get('attr');$('admin_activity_menu').getElements('li').addEvents({'click':function(){perpage_activity=1;if(vprocesse==0){vprocesse=1;new_width=this.getComputedSize().totalWidth;$$('.admin_activity_active').set('class','admin_activity_item');sdvig=this.getPosition().x-$('admin_activity_menu').getPosition().x;this_id=this.get('id');new Fx.Tween('admin_activity_div',{duration:300}).start("left",sdvig);new Fx.Tween('admin_activity_div',{duration:300,onComplete:function(){start_loading();$(this_id).set('class','admin_activity_active');if(!attribute){myRequest=new Request({url:home+'ajax.php',method:"get",onSuccess:function(response){stop_loading();vprocesse=0;$('admin_activity_body').innerHTML=response;admin_photo_preview();admin_activity_gameclick();vmore_activity();help_text();}}).send('type=30&str='+this_id);}else if(attribute=="shop"){myRequest=new Request({url:home+'ajax.php',method:"get",onSuccess:function(response){stop_loading();vprocesse=0;$('vivod_magazina').innerHTML=response;shop_slot_hover();if($type($('scrollbar1'))){makeScrollbar($('content1'),$('scrollbar1'),$('handle1'));}
shop_item_buy();shop_item_sell();pet_item_hover();fight_item_hover();sell_count_hover();shop_slot_vibor();}}).send('type=50&mode='+this_id+'&z1='+z1);}}}).start("width",new_width);}
return false;}});}
function admin_activity_gameclick(){$$('.admin_activity_gamename').addEvents({'click':function(){if(!this.get('opened')){this.set('opened',1);start_loading();attr=this.get('attr');myelem='game_activity_'+attr;myRequest=new Request({url:home+'ajax.php',method:"get",onSuccess:function(response){stop_loading();$(myelem).innerHTML=response;var size=$(myelem).measure(function(){return this.getComputedSize().totalHeight;});$(myelem).setStyle('height','0px');$(myelem).setStyle('display','block');new Fx.Tween(myelem,{duration:300,transition:Fx.Transitions.Expo.easeOut}).start('height','0px',size-2);admin_photo_preview();}}).send('type=31&str='+attr);}else{this.set('opened',null);myelem='game_activity_'+this.get('attr');$(myelem).setStyle('display','none');}}});}
function over_avatar(){$$('.avatar').addEvents({'mouseenter':function(){$('userinfo').setStyle('opacity',0);var coord=this.getCoordinates();ftop=coord.top+(coord.height);fleft=coord.left+(coord.width/2)-100;$('userinfo').setStyles({top:ftop,left:fleft});var gid=this.get('id');myRequest=new Request({url:home+'ajax.php',method:"get",onSuccess:function(response){$('change').innerHTML=response;new Fx.Tween('userinfo',{duration:300,transition:Fx.Transitions.Quart.easeInOut}).start("opacity",0,1);}}).send('type=1&id='+gid);},'mouseleave':function(){if(myRequest!="no"){myRequest.cancel();}
$('userinfo').setStyles({top:'-200px',left:'-200px'});$('change').innerHTML='<div>&nbsp;</div>';}});}
$$('.main_blog_list').addEvents({'mouseenter':function(){attr=this.get('attr');attr2=this.get('attr2');var coord=this.getCoordinates();ftop=coord.top+(coord.height);fleft=coord.left-87;myRequest=new Request({url:home+'ajax.php',method:"get",onSuccess:function(response){myObj.myVar1=ftop;myObj.myVar2=fleft;myObj.myVar3=response;start_timeout();}}).send('type=32&str='+attr+'&ifop='+attr2);},'mouseleave':function(timer){stop_timeout();if(myRequest!="no"){myRequest.cancel();}
$('userinfo').setStyle('opacity','0');$('userinfo').setStyles({top:-200,left:-200});}});$$('.refresh_mnenie').addEvents({'mouseenter':function(){this.setStyle('background-position','0px 0px');},'mouseleave':function(){this.setStyle('background-position','-16px 0px');},'click':function(){var size_original=$('mnenie').measure(function(){return this.getComputedSize().totalHeight;});attr=this.get('attr');if($type($('last_mnenie'))){last_mn=$('last_mnenie').get('val');}
new Fx.Tween($('close_opinion_left'),{duration:400,transition:Fx.Transitions.Quart.easeInOut}).start('width','0px','270px');new Fx.Tween($('close_opinion_right'),{duration:400,transition:Fx.Transitions.Quart.easeInOut,onComplete:function(){myRequest=new Request({url:home+'ajax.php',method:"get",onSuccess:function(response){$('mnenie_temp').innerHTML=response;var size_new=$('mnenie_temp').measure(function(){return this.getComputedSize().totalHeight;});new Fx.Tween($('mnenie'),{duration:500,transition:Fx.Transitions.Quart.easeInOut,onComplete:function(){$('mnenie').setStyle('height','auto');$('mnenie').innerHTML=response;new Fx.Tween($('close_opinion_left'),{duration:400,transition:Fx.Transitions.Quart.easeInOut}).start('width','270px','0px');new Fx.Tween($('close_opinion_right'),{duration:400,transition:Fx.Transitions.Quart.easeInOut}).start('width','270px','0px');}}).start('height',size_original+'px',size_new+'px');}}).send('type=34&str='+attr+'&last_mnenie='+last_mn);}}).start('width','0px','270px');}});$$('.desc_readmore').addEvents({'click':function(){$('smalldesc').innerHTML=$('bigdesc').value;return false;}});function delete_stuff(){$$('.delete_stuff').addEvents({'click':function(){start_loading();attr=this.get('attr');id=this.get('id');myRequest=new Request({url:home+'ajax.php',method:"post",onSuccess:function(response){stop_loading();if(attr=="answer"||attr=="comment"||attr=="forumpost"||attr=="forumtheme"){$(id).tween('opacity','1','0');}else if(attr=="wall"){new Fx.Tween($('wall_'+id),{duration:400,transition:Fx.Transitions.Quart.easeInOut,onComplete:function(){$('wall_'+id).setStyle('display','none');}}).start('opacity','1','0');}else{new Fx.Tween($('hide_if_delete'),{duration:400,transition:Fx.Transitions.Quart.easeInOut,onComplete:function(){$('hide_if_delete').innerHTML="Удалёно";$('hide_if_delete').setStyle('opacity',1);}}).start('opacity','1','0');}}}).send('type=35&id='+id+'&attr='+attr);}});}
function vmore_activity(){$$('.view_more_activity').addEvents({'click':function(){perpage_activity=perpage_activity+1;this.innerHTML='<img src=files/image_loading.gif>';this.setStyle('background','url()');id=this.get('id');myRequest=new Request({url:home+'ajax.php',method:"get",onSuccess:function(response){stop_loading();$('admin_activity_body').innerHTML=response;admin_photo_preview();admin_activity_gameclick();vmore_activity();}}).send('type=30&str='+id+'&perpage='+perpage_activity);}});}
$$('.answer_answer').addEvents({'click':function(){id=this.get('id');$(id).setStyle('display','none');$('answer_answer_'+id).innerHTML="<div class=reg_spacer1></div><textarea id=answer_answer_textarea_"+id+" style='width:472px;height:60px'></textarea>"+"<div class=clear></div><input class=answer_answer_add type=image src=files/add_comment.png style='margin-top:10px'>";$('answer_answer_textarea_'+id).focus();$$('.answer_answer_add').addEvents({'click':function(){this.setStyle('display','none');start_loading();myRequest=new Request({url:home+'ajax.php',method:"post",onSuccess:function(response){stop_loading();if(response){$('answer_answer_'+id).innerHTML=response;}}}).send('type=36&str='+encodeURIComponent($('answer_answer_textarea_'+id).value)+'&id='+id);}});}});$$('.level_info').addEvents({'click':function(event){id=this.get('id');$('level_info_bg').setStyle('display','block');middle_x=$(document.body).getCoordinates().width/2;middle_y=$(document.body).getCoordinates().height/2;middle_y=middle_y+($(document.body).getScroll().y);popup_width=500;popup_height=600;pos=get_cursor_position(event);new Element('div',{id:'level_info_popup','styles':{'position':'absolute','top':pos[1]+'px','left':pos[0]+'px','z-index':99999,'background-color':'#fff','text-align':'left','padding':'7px 7px 10px 10px'}}).inject($('bbody'));new Fx.Tween($('level_info_popup'),{duration:250}).start('width','0px',popup_width+'px');new Fx.Tween($('level_info_popup'),{duration:250}).start('height','0px',popup_height+'px');new_x=middle_x-(popup_width/2);new_y=middle_y-(popup_height/2);new Fx.Tween($('level_info_popup'),{duration:250}).start('left',new_x+'px');new Fx.Tween($('level_info_popup'),{duration:250,onComplete:function(){myRequest=new Request({url:home+'ajax.php',method:"get",onSuccess:function(response){stop_loading();if(response){$('level_info_popup').innerHTML=response;$('level_info_close').addEvents({'click':function(){$('level_info_bg').fireEvent('click');}});}}}).send('type=37&id='+id);}}).start('top',new_y+'px');$('level_info_bg').addEvents({'click':function(){$('level_info_bg').setStyle('display','none');$('level_info_popup').destroy();}});}});$$('.accept_friend').addEvents({'click':function(){start_loading();id=this.get('id');myRequest2=new Request({url:home+'ajax.php',method:"post",onSuccess:function(response){new Fx.Tween($('fr_'+id),{duration:400,transition:Fx.Transitions.Quart.easeInOut,onComplete:function(){stop_loading();$('fr_'+id).setStyle('display','none');}}).start('opacity','1','0');}}).send('type=40&str='+id);return false;}});$$('.tpet_exp_hover').addEvents({'mousemove':function(event){pos=get_cursor_position(event);$('tpet_hover').setStyles({'top':pos[1]+5,'left':pos[0]+10});},'mouseleave':function(event){$('tpet_hover').setStyles({'top':'-300px','left':'-300px'});}});$$('.tpet_hp_hover').addEvents({'mousemove':function(event){pos=get_cursor_position(event);$('tpet_hp_hover').setStyles({'top':pos[1]+5,'left':pos[0]+10});},'mouseleave':function(event){$('tpet_hp_hover').setStyles({'top':'-300px','left':'-300px'});}});if($type($('editor_new'))){function fn_bold(){$('editor_textarea').insertAroundCursor({before:"[b]",after:"[/b]",defaultMiddle:""});}
function fn_underline(){$('editor_textarea').insertAroundCursor({before:"[u]",after:"[/u]",defaultMiddle:""});}
function fn_italic(){$('editor_textarea').insertAroundCursor({before:"[i]",after:"[/i]",defaultMiddle:""});}
function fn_center(){$('editor_textarea').insertAroundCursor({before:"[center]",after:"[/center]",defaultMiddle:""});}
function fn_image(){var reply=prompt("Введите ссылку на рисунок","");if(reply){$('editor_textarea').insertAtCursor("[img]"+reply+"[/img]",false);}}
function fn_video(){var reply=prompt("Введите ссылку на видео с Youtube","");if(reply){$('editor_textarea').insertAtCursor("[video]"+reply+"[/video]",false);}}
var myKeyboardEvents=new Keyboard({defaultEventType:'keydown',events:{'alt+b':fn_bold,'alt+u':fn_underline,'alt+i':fn_italic,'alt+m':fn_image}});$('editor_new').getElements('li').addEvents({'click':function(){attr=this.get('attr');if(attr=="bold"){fn_bold();}else if(attr=="underline"){fn_underline();}else if(attr=="italic"){fn_italic();}else if(attr=="image"){fn_image();}else if(attr=="video"){fn_video();}else if(attr=="center"){fn_center();}}});$('preview_button').addEvents({'click':function(){if($type($('editor_name'))){nm=encodeURIComponent($('editor_name').value)}else{nm='';}
$('editor_preview').innerHTML="<img src=files/image_loading.gif><br><br>";attr=this.get('attr');myRequest=new Request({url:home+'ajax.php',method:"post",onSuccess:function(response){if(attr=="forum"||attr=="theme"){$('editor_preview').innerHTML=response+"<br><br>";}else{$('editor_preview').innerHTML=""+"<div style='width:100%;height:1px;background-color:#dbdbdb'></div>"+"<br>"+response+"<br>"+"<div style='width:100%;height:1px;background-color:#dbdbdb'></div><br>";}}}).send('type=44&str='+encodeURIComponent($('editor_textarea').value)+'&name='+nm+'&attr='+attr);}});}
function help_text(){$(document.body).getElements('[attr2=help_text]').addEvents({'mouseenter':function(){$('help_popup').innerHTML=this.get('info');},'mousemove':function(event){pos=get_cursor_position(event);if(this.get('info')){$('help_popup').setStyles({'top':pos[1]+10,'left':pos[0]+15});}},'mouseleave':function(event){$('help_popup').setStyles({'top':'-300px','left':'-300px'});$('help_popup').innerHTML='';}});}
function pagination_blogs(){$$('.pagination_blogs').addEvents({'click':function(){start_loading();broke=this.get('id').split('_');myRequest=new Request({url:home+'ajax.php',method:"get",onSuccess:function(response){stop_loading();$('poslednie_voprosi').innerHTML=response;pagination_blogs();}}).send('type=33&page='+broke[1]+'&user='+broke[0]);return false;}});}
var txt=0;function fight_item_hover(){$$('.fight_item').addEvents({'mouseenter':function(){txt=get_txt(this);if(this.get('item_class')){txt=txt+'<br><img src=files/slot_'+this.get('item_class')+'.png>';}
$('pet_info_hover_text').innerHTML=txt;},'mousemove':function(event){if(txt){pos=get_cursor_position(event);$('pet_info_hover').setStyles({'top':pos[1]+5,'left':pos[0]+10});}else{this.fireEvent('mouseenter');}},'mouseleave':function(){$('pet_info_hover').setStyles({'top':'-300px','left':'-300px'});$('pet_info_hover_text').innerHTML='';}});}
fight_item_hover();k=0;interval=1;nomore=0;typer=0;function calculate_lost_hp(type){lost_hp=$('lost_hp_count').get('attr').split('_');if(type==1){tmp=$('lost_hp_count_both').get('attr').split(';');hp_arr=new Array();hp_arr[1]=tmp[0].split('_');hp_arr[2]=tmp[1].split('_');}
if(type==1){count=2;}else{count=1;}
for(i=1;i<=count;i++){if(type==1){lost_hp=hp_arr[i];}
if(lost_hp[1]>0){curr_hp=parseInt($('pet_current_hp_'+lost_hp[0]).innerHTML);max_hp=parseInt($('pet_max_hp_'+lost_hp[0]).innerHTML);curr_hp=curr_hp-lost_hp[1];if(curr_hp<0){curr_hp=0;}
$('pet_current_hp_'+lost_hp[0]).innerHTML=curr_hp;prc=(118*Math.round(curr_hp*100/max_hp))/100;width=$('fight_hp_'+lost_hp[0]).getStyle('width');$('fight_hp_'+lost_hp[0]).setStyle('background','url("files/pet_stats_red2.png")');new Fx.Tween('fight_hp_'+lost_hp[0],{duration:700,transition:Fx.Transitions.Quart.easeInOut,onComplete:function(){if(type==1){$('fight_hp_'+hp_arr[1][0]).setStyle('background','url("files/pet_stats_red.png")');$('fight_hp_'+hp_arr[2][0]).setStyle('background','url("files/pet_stats_red.png")');}else{$('fight_hp_'+lost_hp[0]).setStyle('background','url("files/pet_stats_red.png")');}}}).start("width",width,prc+'px');}}}
if($type($('show_full_fight'))){var destr=function(){moves_fight(1);return false;}}
function hide_show_fight(){$('show_full_fight').removeEvent('click',destr);$('show_full_fight').addEvent('click',function(){return false});}
function moves_fight(typer){if(typer==1){hide_show_fight();clearTimeout(interval);show_full=1;}else{show_full=0;}
attr=$('fight_hidden_id').get('attr');myRequest=new Request({url:home+'ajax.php',method:"get",onSuccess:function(response){if(response){k++;$('fight_moves').innerHTML=response;calculate_lost_hp(typer);$('lost_hp_count').destroy();var size_original=$('fight_moves').measure(function(){return this.getComputedSize().totalHeight;});new Fx.Tween('fight_moves_margin',{duration:300,transition:Fx.Transitions.Quart.easeInOut,onComplete:function(){$('fight_moves').setStyle('opacity','0');$('fight_moves_margin').setStyle('margin-bottom','0px');$('fight_moves').setStyle('display','block');$('fight_moves').tween('opacity',1);$('fight_moves').set('id','newid'+k);var fm=new Element('div',{id:'fight_moves'});fm.inject($('newid'+k),'before');$('fight_moves_margin').destroy();var fmm=new Element('div',{id:'fight_moves_margin'});fmm.inject($('fight_moves'),'after');if(show_full!=1){interval=setTimeout(function(){moves_fight(0)},2000);}else{hide_show_fight();}}}).start("margin-bottom",'0px',size_original+'px');}}}).send('type=47&fight_id='+attr+'&move='+k+'&show_full='+show_full);}
$$('.refresh_stats').addEvents({'mouseenter':function(){this.setStyle('background-position','0px 0px');},'mouseleave':function(){this.setStyle('background-position','-16px 0px');}});if($type($('invite_link'))){$('invite_link').addEvents({'click':function(){this.select();}});}
$$('.mg_plus_icon').addEvent('click',function(){start_loading();id=this.get('id');myRequest=new Request({url:home+'ajax.php',method:"post",onSuccess:function(response){stop_loading();if(response=='err1'){alert('Нельзя голосовать за собственный блог');}else if(response=='err2'){alert('Вы уже голосовали за этот блог');}else if(response=='err3'){alert('С вашего IP за этот блог уже голосовали');}else{$(id).setStyle('display','none');$('mg_pluses_'+id).innerHTML="+"+response;}}}).send('type=62&id='+id);});if($type($('smiles'))){$('smiles').getElements('li').addEvent('click',function(){$('editor_textarea').insertAtCursor("{s"+this.get('id')+"}",false);});}
$$('.add_quote').addEvent('click',function(){broke=this.get('id').split('_');$('editor_textarea').insertAtCursor("[quote="+this.get('login')+"]"+$('quote_'+broke[1]).value+"[/quote]",false);});function shop_slot_vibor(){$$('.shop_slot_vibor').addEvent('click',function(){attr=this.get('attr');id=this.get('id');start_loading();myRequest=new Request({url:home+'ajax.php',method:"get",onSuccess:function(response){stop_loading();$('vivod_magazina').innerHTML=response;$(document.body).getElements('.shop_slot_vibor').setStyles({'background-color':'#f3f7fb','border-color':'#BAD5DF'});$(id).setStyles({'background-color':'#dcefff','border-color':'#71bbd6'});if($type($('scrollbar1'))){makeScrollbar($('content1'),$('scrollbar1'),$('handle1'));}
shop_slot_hover();shop_item_buy();shop_item_sell();pet_item_hover();fight_item_hover();sell_count_hover();shop_slot_vibor();}}).send('type=50&mode=mode0&z1='+z1+'&slot='+attr);});}
$$('.dobavivshie').addEvents({'mouseenter':function(){$('user_game_'+this.get('id')).setStyle('display','block');$('user_game_hover_'+this.get('id')).setStyle('display','block');},'mouseleave':function(){$('user_game_'+this.get('id')).setStyle('display','none');$('user_game_hover_'+this.get('id')).setStyle('display','none');}});if($type($('show_full_fight'))){$('show_full_fight').addEvent('click',destr);}
if($type($('fight_moves'))){interval=setTimeout(function(){moves_fight(0)},1000);}
tmp_hp=0;start_regen_hp();$$('.pet_say').addEvent('click',function(){window.location.href=home+'a/myaccount/pet/notify';});$$('.change_game_picture').addEvent('click',function(){$('game_picture').setStyle('display','block');});pagination_blogs();help_text();delete_stuff();comments_edit();admin_photo_preview();over_avatar();vmore();vmore_activity();admin_activity_gameclick();pet_item_hover();shop_slot_vibor();});