function show_input_error(input_name,text,time){if(time==null){time=2000;}
	if(text==null){text='';}
	$("#"+input_name).next(".error_message").remove();$("#"+input_name).addClass("input_error");$("#"+input_name).after("<div class='error_message'>"+text+"</div>");if(time==99999){$("#"+input_name).attr("disabled","");}else{setTimeout(function(){$("#"+input_name).removeClass("input_error");$("#"+input_name).next(".error_message").fadeOut();},time);}}
function show_input_success(input_name,text,time){if(text==null){text='';}
	$("#"+input_name).next(".success_message").remove();$("#"+input_name).addClass("input_success");$("#"+input_name).after("<div class='success_message'>"+text+"</div>");setTimeout(function(){$("#"+input_name).removeClass("input_success");$("#"+input_name).next(".success_message").fadeOut();},time);}
function show_ok(){var scrollTop=window.pageYOffset?window.pageYOffset:(document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop);if(scrollTop>50){$(".result_ok_b").fadeIn();setTimeout(function(){$(".result_ok_b").fadeOut();},1500);}else{$(".result_ok").fadeIn();setTimeout(function(){$(".result_ok").fadeOut();},1500);}}
function show_error(){var scrollTop=window.pageYOffset?window.pageYOffset:(document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop);if(scrollTop>50){$(".result_error_b").fadeIn();setTimeout(function(){$(".result_error_b").fadeOut();},1500);}else{$(".result_error").fadeIn();setTimeout(function(){$(".result_error").fadeOut();},1500);}}
function scrollToBox(argument){$("html, body").animate({scrollTop:$(argument).offset().top+"px"},{duration:500,easing:"swing"});}
function reset_page(){location.reload();}
function go_to(link){location.href=link;}
function send_value(id,value){document.getElementById(id).value=value;}
function off_button(btn,text){$(btn).addClass('disabled');$(btn).attr('onclick','');$(btn).val(text);}
function clean_tiny(area){tinymce.get(area).setContent('');}
function focus_input(id){if($("#"+id).size()>0){$("#"+id).focus();}}
function play_sound(file,volume){audio=new Audio();audio.src=file;audio.volume=volume;audio.autoplay=true;}
function set_cookie(name,value,expires,path,domain,secure){document.cookie=name+"="+escape(value)+((expires)?"; expires="+expires:"")+((path)?"; path="+path:"")+((domain)?"; domain="+domain:"")+((secure)?"; secure":"");}
function get_cookie(name){var cookie=" "+document.cookie;var search=" "+name+"=";var str=null;var offset=0;var end=0;if(cookie.length>0){offset=cookie.indexOf(search);if(offset!=-1){offset+=search.length;end=cookie.indexOf(";",offset);if(end==-1){end=cookie.length;}
	str=unescape(cookie.substring(offset,end));}}
	return(str);}
function dell_block(id){$("#"+id).remove();}
function set_enter(input,func){$(input).keydown(function(event){if(event.which==13&&!event.shiftKey){event.preventDefault();eval(func);}});}
function send_form(form,func){$(form).submit(function(event){event.preventDefault();eval(func);});}
function create_material(data,dataType){dataType=dataType||0;data['phpaction']=1;data['token']=$('#token').val();var material='';if(dataType==0){$.each(data,function(key,value){material=material+key+'='+encodeURIComponent(value)+'&';});material.substring(0,material.length-1);}else{material=new FormData();$.each(data,function(key,value){material.append(key,value);});}
	return material;}
$(document).ajaxComplete(function(event,xhr){if(xhr.responseText.indexOf('Доступно только администраторам')+1){reset_page();}});function admin_login(){var captcha=null;if(typeof grecaptcha!="undefined"){captcha=grecaptcha.getResponse();}
	var token=$('#token').val();var password=$('#password').val();password=encodeURIComponent(password);$.ajax({type:"POST",url:"../ajax/actions.php",data:"phpaction=1&token="+token+"&admin_login=1&password="+password+"&captcha="+captcha,success:function(html){$("#result").html(html);}});}
function replace_password(){if(typeof grecaptcha!="undefined"){var captcha=grecaptcha.getResponse();}else{var captcha=null;}
var token=$('#token').val();var replace_email=$('#replace_email_input').val();email=encodeURIComponent(replace_email);$.ajax({type:"POST",url:"../ajax/actions.php",data:"phpaction=1&token="+token+"&replace_password=1&replace_email="+email,success:function(html){$("#result_replace").html(html);}});}
function admin_exit(){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&admin_exit=1",success:function(){location.href='../admin/';}});}
function edit_site_name(){var token=$('#token').val();var site_name=$('#site_name').val();site_name=encodeURIComponent(site_name);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&edit_site_name=1&site_name="+site_name,success:function(html){$("#edit_site_name_result").html(html);}});}
function edit_email_site(){var token=$('#token').val();var email_site=$('#email_site').val();email_site=encodeURIComponent(email_site);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&edit_email_site=1&email_site="+email_site,success:function(html){$("#edit_site_email_result").html(html);}});}
function edit_is_auth(type) {var token = $('#token').val();$.ajax({type: "POST",url: "../ajax/actions_panel.php",data: "phpaction=1&token=" + token + "&edit_is_auth=1&type=" + type});}
function edit_sprotected(type) {var token = $('#token').val();$.ajax({type: "POST",url: "../ajax/actions_panel.php",data: "phpaction=1&token=" + token + "&edit_sprotected=1&type=" + type});}
function edit_ip_protect(type){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&edit_ip_protect=1&type="+type});}
function edit_copyright_key(){var token=$('#token').val();var copyright_key=$('#copyright_key').val();copyright_key=encodeURIComponent(copyright_key);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&edit_copyright_key=1&copyright_key="+copyright_key,success:function(html){$("#edit_copyright_key_result").html(html);}});}
function edit_site_time_zone(){var token=$('#token').val();var time_zone=$('#time_zone').val();time_zone=encodeURIComponent(time_zone);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&edit_site_time_zone=1&time_zone="+time_zone,success:function(html){$("#edit_time_zone_result").html(html);}});}
function developer_mode_on(type){NProgress.start();NProgress.done();if(type==1){var key=$('#dev_key').val();var host=$('#host').val();var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions.php",data:"phpaction=1&get_md5=1&token="+token+"&val="+host,dataType:"json",success:function(result){if(key==result.answer){change_value('config','developer_mode','1','1');setTimeout(show_ok,500);}else{setTimeout(show_error,500);}}});}else{change_value('config','developer_mode','2','1');setTimeout(show_ok,500);}}
function edit_mon_api(type){NProgress.start();var token=$('#token').val();var mon_key=$('#mon_key').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&edit_mon_api=1&mon_key="+mon_key+"&type="+type,dataType:"json",success:function(result){NProgress.done();if(result.status==1){setTimeout(show_ok,500);load_servers();if(type==1){$('#mon_gap').val('180');$('#btn_mon_gap').addClass('disabled');$('#mon_gap').attr("disabled","");}else{$('#btn_mon_gap').removeClass('disabled');$("#mon_gap").removeAttr("disabled");$("[onclick *= 1]").removeClass('active');$("[onclick *= 2]").addClass('active');}}else{if(type==1){$("[onclick *= 2]").addClass('active');$("[onclick *= 1]").removeClass('active');}else{$("[onclick *= 1]").addClass('active');$("[onclick *= 2]").removeClass('active');}
setTimeout(show_error,500);show_input_error(result.input,null,null);}}});}
function edit_stat_number(){var token=$('#token').val();var stat_number=$('#stat_number').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&edit_stat_number=1&stat_number="+stat_number,success:function(html){$("#edit_stat_number_result").html(html);}});}
function edit_mon_gap(){NProgress.start();var token=$('#token').val();var mon_gap=$('#mon_gap').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&edit_mon_gap=1&mon_gap="+mon_gap,dataType:"json",success:function(result){NProgress.done();if(result.status==1){setTimeout(show_ok,500);}else{setTimeout(show_error,500);}}});}
function dell_all_chat_messages(){NProgress.start();var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&dell_all_chat_messages=1",success:function(html){$("#chat_number").text("0");NProgress.done();setTimeout(show_ok,500);}});}
function edit_violations_number(){var token=$('#token').val();var violations_number=$('#violations_number').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&edit_violations_number=1&violations_number="+violations_number,success:function(html){$("#edit_violations_number_result").html(html);}});}
function edit_vk_group_id(){var token=$('#token').val();var vk_group_id=$('#vk_group_id').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&edit_vk_group_id=1&vk_group_id="+vk_group_id,success:function(html){$("#edit_vk_group_result").html(html);}});}
function edit_vk_admin_id(){var token=$('#token').val();var vk_admin_id=$('#vk_admin_id').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&edit_vk_admin_id=1&vk_admin_id="+vk_admin_id,success:function(html){$("#edit_vk_admin_result").html(html);}});}
function edit_admins_ids(){var token=$('#token').val();var admins_ids=$('#admins_ids').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&edit_admins_ids=1&admins_ids="+admins_ids,success:function(html){$("#edit_admins_ids_result").html(html);}});}
function edit_off_message(){var token=$('#token').val();var off_message=$('#off_message').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&edit_off_message=1&off_message="+off_message,success:function(html){$("#edit_off_message_result").html(html);}});}
function edit_violations_delta(){var token=$('#token').val();var violations_delta=$('#violations_delta').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&edit_violations_delta=1&violations_delta="+violations_delta,success:function(html){$("#edit_violations_delta_result").html(html);}});}
function edit_ban_time(){var token=$('#token').val();var ban_time=$('#ban_time').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&edit_ban_time=1&ban_time="+ban_time,success:function(html){$("#edit_ban_time_result").html(html);}});}
function edit_show_news(){NProgress.start();var token=$('#token').val();var show_news=$('#show_news').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&edit_show_news=1&show_news="+show_news,dataType:"json",success:function(result){NProgress.done();if(result.status==1){setTimeout(show_ok,500);}else{setTimeout(show_error,500);}}});}
function edit_show_events(){NProgress.start();var token=$('#token').val();var show_events=$('#show_events').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&edit_show_events=1&show_events="+show_events,dataType:"json",success:function(result){NProgress.done();if(result.status==1){setTimeout(show_ok,500);}else{setTimeout(show_error,500);}}});}
function dell_stat_log(){NProgress.start();var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&dell_stat_log=1",success:function(html){$("#edit_stat_number_result").html(html);$("#stat").fadeOut();NProgress.done();setTimeout(show_ok,500);}});}
function edit_site_password(){var token=$('#token').val();var old_password=$('#old_password').val();var password=$('#password').val();var password2=$('#password2').val();old_password=encodeURIComponent(old_password);password=encodeURIComponent(password);password2=encodeURIComponent(password2);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&edit_site_password=1&old_password="+old_password+"&password="+password+"&password2="+password2,success:function(html){$("#edit_password_result").html(html);}});}
function edit_paginator(){var data={}
data['edit_paginator']='1';data['users_lim']=$('#users_lim').val();data['bans_lim']=$('#bans_lim').val();data['bans_lim2']=$('#bans_lim2').val();data['muts_lim']=$('#muts_lim').val();data['news_lim']=$('#news_lim').val();data['stats_lim']=$('#stats_lim').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:create_material(data),dataType:"json",success:function(result){$("#edit_paginator_result").html(result.data);}});}
function set_current_time(){$('#publish_date').datetimepicker('setDate',(new Date()));$('#ui-datepicker-div').fadeOut();}
function edit_protocol(){NProgress.start();var token=$('#token').val();var protocol=$('#protocol').val();protocol=encodeURIComponent(protocol);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&edit_protocol=1&protocol="+protocol,dataType:"json",success:function(result){if(result.status==1){NProgress.done();setTimeout(show_ok,500);}else{NProgress.done();setTimeout(show_error,500);}}});}
function fast_admin_action(name){NProgress.start();var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&"+name+"=1",success:function(html){NProgress.done();setTimeout(show_ok,500);}});}
function edit_vk_api(){var token=$('#token').val();var vk_id=$('#vk_id').val();var vk_key=$('#vk_key').val();var vk_service_key=$('#vk_service_key').val();vk_id=encodeURIComponent(vk_id);vk_key=encodeURIComponent(vk_key);vk_service_key=encodeURIComponent(vk_service_key);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&edit_vk_api=1&vk_id="+vk_id+"&vk_key="+vk_key+"&vk_service_key="+vk_service_key,success:function(html){$("#edit_vk_result").html(html);}});}
function edit_steam_api(){var token=$('#token').val();var steam_key=$('#steam_key').val();steam_key=encodeURIComponent(steam_key);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&edit_steam_api=1&steam_key="+steam_key,success:function(html){$("#edit_steam_result").html(html);}});}
function edit_fb_api(){var token=$('#token').val();var fb_id=$('#fb_id').val();var fb_key=$('#fb_key').val();fb_id=encodeURIComponent(fb_id);fb_key=encodeURIComponent(fb_key);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&edit_fb_api=1&fb_id="+fb_id+"&fb_key="+fb_key,success:function(html){$("#edit_fb_result").html(html);}});}
function recount(){NProgress.start();var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&recount=1&token="+token,success:function(){NProgress.done();setTimeout(show_ok,500);}});}
function edit_freekassa(){var token=$('#token').val();var fk_login=$('#fk_login').val();var fk_pass1=$('#fk_pass1').val();var fk_pass2=$('#fk_pass2').val();fk_login=encodeURIComponent(fk_login);fk_pass1=encodeURIComponent(fk_pass1);fk_pass2=encodeURIComponent(fk_pass2);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&edit_freekassa=1&token="+token+"&fk_login="+fk_login+"&fk_pass1="+fk_pass1+"&fk_pass2="+fk_pass2,success:function(html){$("#edit_freekassa_result").html(html);}});}
function edit_robokassa(){var token=$('#token').val();var rb_login=$('#rb_login').val();var rb_pass1=$('#rb_pass1').val();var rb_pass2=$('#rb_pass2').val();rb_login=encodeURIComponent(rb_login);rb_pass1=encodeURIComponent(rb_pass1);rb_pass2=encodeURIComponent(rb_pass2);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&edit_robokassa=1&token="+token+"&rb_login="+rb_login+"&rb_pass1="+rb_pass1+"&rb_pass2="+rb_pass2,success:function(html){$("#edit_robokassa_result").html(html);}});}
function edit_webmoney(){var token=$('#token').val();var wb_login=$('#wb_login').val();var wb_pass1=$('#wb_pass1').val();var wb_num=$('#wb_num').val();wb_login=encodeURIComponent(wb_login);wb_pass1=encodeURIComponent(wb_pass1);wb_num=encodeURIComponent(wb_num);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&edit_webmoney=1&token="+token+"&wb_login="+wb_login+"&wb_pass1="+wb_pass1+"&wb_num="+wb_num,success:function(html){$("#edit_webmoney_result").html(html);}});}
function edit_yandexmoney(){var token=$('#token').val();var ya_num=$('#ya_num').val();var ya_key=$('#ya_key').val();ya_num=encodeURIComponent(ya_num);ya_key=encodeURIComponent(ya_key);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&edit_yandexmoney=1&token="+token+"&ya_num="+ya_num+"&ya_key="+ya_key,success:function(html){$("#edit_yandexmoney_result").html(html);}});}
function edit_unitpay(){var token=$('#token').val();var up_login=$('#up_login').val();var up_pass1=$('#up_pass1').val();var up_pass2=$('#up_pass2').val();up_login=encodeURIComponent(up_login);up_pass1=encodeURIComponent(up_pass1);up_pass2=encodeURIComponent(up_pass2);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&edit_unitpay=1&token="+token+"&up_login="+up_login+"&up_pass1="+up_pass1+"&up_pass2="+up_pass2,success:function(html){$("#edit_unitpay_result").html(html);}});}
function edit_paysera(){var token=$('#token').val();var ps_num=$('#ps_num').val();var ps_pass=$('#ps_pass').val();ps_num=encodeURIComponent(ps_num);ps_pass=encodeURIComponent(ps_pass);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&edit_paysera=1&token="+token+"&ps_num="+ps_num+"&ps_pass="+ps_pass,success:function(html){$("#edit_paysera_result").html(html);}});}
function edit_interkassa(){var token=$('#token').val();var ik_login=$('#ik_login').val();var ik_pass1=$('#ik_pass1').val();ik_login=encodeURIComponent(ik_login);ik_pass1=encodeURIComponent(ik_pass1);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&edit_interkassa=1&token="+token+"&ik_login="+ik_login+"&ik_pass1="+ik_pass1,success:function(html){$("#edit_interkassa_result").html(html);}});}
function edit_walletone(){var token=$('#token').val();var wo_login=$('#wo_login').val();var wo_pass=$('#wo_pass').val();wo_login=encodeURIComponent(wo_login);wo_pass=encodeURIComponent(wo_pass);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&edit_walletone=1&token="+token+"&wo_login="+wo_login+"&wo_pass="+wo_pass,success:function(html){$("#edit_walletone_result").html(html);}});}
function edit_discount(){var token=$('#token').val();var discount=$('#discount').val();discount=encodeURIComponent(discount);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&edit_discount=1&token="+token+"&discount="+discount,success:function(html){$("#edit_discount_result").html(html);}});}
function edit_min_amount(){var token=$('#token').val();var min_amount=$('#min_amount').val();min_amount=encodeURIComponent(min_amount);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&edit_min_amount=1&token="+token+"&min_amount="+min_amount,success:function(html){$("#edit_min_amount_result").html(html);}});}
function edit_stand_balance(){var token=$('#token').val();var stand_balance=$('#stand_balance').val();stand_balance=encodeURIComponent(stand_balance);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&edit_stand_balance=1&token="+token+"&stand_balance="+stand_balance,success:function(html){$("#edit_stand_balance_result").html(html);}});}
function edit_referral_percent(){var token=$('#token').val();var referral_percent=$('#referral_percent').val();referral_percent=encodeURIComponent(referral_percent);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&edit_referral_percent=1&token="+token+"&referral_percent="+referral_percent,success:function(html){$("#edit_referral_percent_result").html(html);}});}
function edit_stickers(){var token=$('#token').val();var price4=$('#price4').val();price4=encodeURIComponent(price4);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&edit_stickers=1&token="+token+"&price4="+price4,success:function(html){$("#edit_stickers_result").html(html);}});}
function load_stickers(){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&load_stickers=1",success:function(html){$("#stickers_body").html(html);}});}
function load_new_srickers(id){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&load_new_srickers=1&id="+id,success:function(html){$("#stickers_box"+id).html(html);}});}
function add_stickers(){NProgress.start();var token=$('#token').val();var name=$('#stickers_name').val();name=encodeURIComponent(name);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&add_stickers=1&name="+name,dataType:"json",success:function(result){NProgress.done();if(result.status==1){setTimeout(show_ok,500);load_stickers();}else{setTimeout(show_error,500);}}});}
function delete_stickers(id){if(confirm("Вы уверены?")){NProgress.start();var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&delete_stickers=1&id="+id,dataType:"json",success:function(result){NProgress.done();if(result.status==1){$("#stickers_"+id).fadeOut();NProgress.done();setTimeout(show_ok,500);}else{setTimeout(show_error,500);}}});}}
function delete_sticker(path,id){if(confirm("Вы уверены?")){NProgress.start();var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&delete_sticker=1&path="+path,dataType:"json",success:function(result){NProgress.done();if(result.status==1){$("#"+id).fadeOut();NProgress.done();setTimeout(show_ok,500);}else{setTimeout(show_error,500);}}});}}
function load_vouchers(load_val){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&load_vouchers=1&token="+token+"&load_val="+load_val,success:function(html){if(load_val=='first'){$("#vouchers_body").html(html);}else{dell_block("loader_"+load_val);$("#vouchers_body").append(html);}}});}
function add_vouchers(){NProgress.start();var token=$('#token').val();var voucher_val=$('#voucher_val').val();voucher_val=encodeURIComponent(voucher_val);var voucher_col=$('#voucher_col').val();voucher_col=encodeURIComponent(voucher_col);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&add_vouchers=1&voucher_val="+voucher_val+"&voucher_col="+voucher_col,dataType:"json",success:function(result){NProgress.done();if(result.status==1){setTimeout(show_ok,500);$("#add_vouchers_result").html(result.data);load_vouchers('first');}else{setTimeout(show_error,500);$("#add_vouchers_result").html(result.data);}}});}
function delete_voucher(id){NProgress.start();var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&delete_voucher=1&id="+id,dataType:"json",success:function(result){NProgress.done();if(result.status==1){$("#voucher_"+id).fadeOut();NProgress.done();setTimeout(show_ok,500);}else{setTimeout(show_error,500);}}});}
function load_bank_info(type){var token=$('#token').val();if($("#bank_info"+type).html()==''){$("#bank_info"+type).append('Построение...');$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&load_bank_info=1&type="+type,success:function(html){$('#bank'+type).modal('show');$("#bank_info"+type).html(html);}});}else{$('#bank'+type).modal('show');}}
function get_shilings_operations(load_val){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&get_shilings_operations=1&token="+token+"&load_val="+load_val,success:function(html){if(load_val=='first'){$("#operations").html(html);}else{dell_block("loader"+load_val);$("#operations").append(html);}}});}
function edit_unban(){var token=$('#token').val();var price1=$('#price1').val();var price2=$('#price2').val();var price3=$('#price3').val();price1=encodeURIComponent(price1);price2=encodeURIComponent(price2);price3=encodeURIComponent(price3);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&edit_unban=1&token="+token+"&price1="+price1+"&price2="+price2+"&price3="+price3,success:function(html){$("#edit_unban_result").html(html);}});}
function edit_unmute(){var token=$('#token').val();var price1=$('#price2_1').val();var price2=$('#price2_2').val();var price3=$('#price2_3').val();price1=encodeURIComponent(price1);price2=encodeURIComponent(price2);price3=encodeURIComponent(price3);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&edit_unmute=1&token="+token+"&price1="+price1+"&price2="+price2+"&price3="+price3,success:function(html){$("#edit_unmute_result").html(html);}});}
function edit_col_pass(){var token=$('#token').val();var col_pass=$('#col_pass').val();col_pass=encodeURIComponent(col_pass);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&edit_col_pass=1&col_pass="+col_pass,success:function(html){$("#edit_col_pass_result").html(html);}});}
function edit_col_nick(){var token=$('#token').val();var col_nick=$('#col_nick').val();col_nick=encodeURIComponent(col_nick);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&edit_col_nick=1&col_nick="+col_nick,success:function(html){$("#edit_col_nick_result").html(html);}});}
function edit_col_type(){var token=$('#token').val();var col_type=$('#col_type').val();col_type=encodeURIComponent(col_type);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&edit_col_type=1&col_type="+col_type,success:function(html){$("#edit_col_type_result").html(html);}});}
function edit_col_login(){var token=$('#token').val();var col_login=$('#col_login').val();col_login=encodeURIComponent(col_login);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&edit_col_login=1&col_login="+col_login,success:function(html){$("#edit_col_login_result").html(html);}});}
function dell_user(id,on_page,type){if(confirm("Вы уверены?")){type=type||'none';NProgress.start();var token=$('#token').val();if(type=='none'){var type=$('#clear_type').val();if(type==undefined){type=1;}}
$.ajax({type:"POST",url:"../ajax/actions_z.php",data:"phpaction=1&dell_user=1&token="+token+"&id="+id+"&type="+type,dataType:"json",success:function(result){if(result.status==1){if(on_page==1){if(type==1){go_to('../admin/users');}
if(type==2){reset_page();}}
dell_block(id);NProgress.done();setTimeout(show_ok,500);}else{NProgress.done();setTimeout(show_error,500);}}});}}
function dell_multi_account_relation(id,id_second){NProgress.start();var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_z.php",data:"phpaction=1&dell_multi_account_relation=1&token="+token+"&id="+id+"&id_second="+id_second,success:function(html){NProgress.done();setTimeout(show_ok,500);}});}
function get_user_shilings_operations(id){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_z.php",data:"phpaction=1&get_user_shilings_operations=1&token="+token+"&id="+id+"&type=1",success:function(html){$("#operations").html(html);}});}
function admin_load_users(start){var token=$('#token').val();var group=$('#groups').val();group=encodeURIComponent(group);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&load_users=1&start="+start+"&group="+group,success:function(html){$("#users").html(html);}});}
function admin_search_login(start){var token=$('#token').val();var login=$('#search_login').val();var group=$('#groups').val();group=encodeURIComponent(group);login=encodeURIComponent(login);if(login==""){admin_load_users(start);}else{$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&search_login=1&login="+login+"&group="+group,success:function(html){$("#pagination1").empty();$("#pagination2").empty();$("#users").html(html);}});}}
function change_value(table,attr,value,id,inputs){inputs=inputs||'none';if(inputs!='none'){inputs=inputs.split(',');for(var i=0;i<inputs.length;i++){if($('#'+inputs[i]).val()==''){show_input_error(inputs[i],'Заполните',1500);}}}
var token=$('#token').val();value=encodeURIComponent(value);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&change_value=1&table="+table+"&attr="+attr+"&value="+value+"&id="+id,success:function(html){}});}
function change_value2(table,attr,value,id){var token=$('#token').val();value=encodeURIComponent(value);$.ajax({type:"POST",url:"../ajax/actions_z.php",data:"phpaction=1&token="+token+"&change_value=1&table="+table+"&attr="+attr+"&value="+value+"&id="+id,success:function(html){}});}
function admin_change_group(id){NProgress.start();var token=$('#token').val();var group=$('#user_group').val();$.ajax({type:"POST",url:"../ajax/actions_z.php",data:"phpaction=1&admin_change_group=1&token="+token+"&id="+id+"&group="+group,dataType:"json",success:function(result){if(result.status==1){NProgress.done();setTimeout(show_ok,500);}else{NProgress.done();setTimeout(show_error,500);}}});}
function admin_change_login(id){NProgress.start();var token=$('#token').val();var user_login=$('#user_login').val();$.ajax({type:"POST",url:"../ajax/actions_z.php",data:"phpaction=1&admin_change_login=1&token="+token+"&id="+id+"&user_login="+user_login,dataType:"json",success:function(result){if(result.status==1){NProgress.done();setTimeout(show_ok,500);}else{NProgress.done();$("#login_result").html(result.data);setTimeout(show_error,500);}}});}
function admin_change_password(id){NProgress.start();var token=$('#token').val();var user_password=$('#user_password').val();$.ajax({type:"POST",url:"../ajax/actions_z.php",data:"phpaction=1&admin_change_password=1&token="+token+"&id="+id+"&user_password="+user_password,dataType:"json",success:function(result){if(result.status==1){NProgress.done();setTimeout(show_ok,500);}else{NProgress.done();$("#password_result").html(result.data);setTimeout(show_error,500);}}});}
function admin_change_name(id){NProgress.start();var name=$('#user_name').val();change_value2("users","name",name,id);NProgress.done();setTimeout(show_ok,500);}
function admin_change_nick(id){NProgress.start();var token=$('#token').val();var user_nick=$('#user_nick').val();$.ajax({type:"POST",url:"../ajax/actions_z.php",data:"phpaction=1&admin_change_nick=1&token="+token+"&id="+id+"&user_nick="+user_nick,dataType:"json",success:function(result){if(result.status==1){NProgress.done();setTimeout(show_ok,500);}else{NProgress.done();setTimeout(show_error,500);if(result.data!=''||result.data!=undefined){alert(result.data);}}}});}
function admin_change_steam_id(id){NProgress.start();var steam_id=$('#user_steam_id').val();change_value2("users","steam_id",steam_id,id);NProgress.done();setTimeout(show_ok,500);}
function admin_change_skype(id){NProgress.start();var skype=$('#user_skype').val();change_value2("users","skype",skype,id);NProgress.done();setTimeout(show_ok,500);}
function admin_change_telegram(id){NProgress.start();var telegram=$('#user_telegram').val();change_value2("users","telegram",telegram,id);NProgress.done();setTimeout(show_ok,500);}
function admin_change_email(id){NProgress.start();var email=$('#user_email').val();change_value2("users","email",email,id);NProgress.done();setTimeout(show_ok,500);}
function admin_change_discord(id){NProgress.start();let discord=$('#user_discord').val();change_value2("users","discord",discord,id);NProgress.done();setTimeout(show_ok,500);}
function admin_change_gag(id){NProgress.start();let gag=$('#user_gag').val();change_value2("users","gag",gag,id);NProgress.done();setTimeout(show_ok,500);}
function admin_change_vk(id){NProgress.start();var token=$('#token').val();var vk=$('#user_vk').val();$.ajax({type:"POST",url:"../ajax/actions_z.php",data:"phpaction=1&token="+token+"&admin_change_vk=1&user_vk="+vk+"&id="+id,success:function(html){if(html==''){NProgress.done();setTimeout(show_ok,500);}else{alert(html);NProgress.done();setTimeout(show_error,500);}}});}
function admin_change_fb(id){NProgress.start();var token=$('#token').val();var fb=$('#user_fb').val();$.ajax({type:"POST",url:"../ajax/actions_z.php",data:"phpaction=1&token="+token+"&admin_change_fb=1&user_fb="+fb+"&id="+id,success:function(html){if(html==''){NProgress.done();setTimeout(show_ok,500);}else{alert(html);NProgress.done();setTimeout(show_error,500);}}});}
function admin_change_signature(id){NProgress.start();var token=$('#token').val();var signature=tinymce.get("signature").getContent();signature=$.trim(signature);$.ajax({type:"POST",url:"../ajax/actions_z.php",data:"phpaction=1&token="+token+"&admin_change_signature=1&signature="+signature+"&id="+id,dataType:"json",success:function(result){NProgress.done();if(result.status==1){setTimeout(show_ok,500);}else{setTimeout(show_error,500);if(result.data!=''||result.data!=undefined){alert(result.data);}}}});}
function admin_activate_user(id){NProgress.start();var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_z.php",data:"phpaction=1&token="+token+"&admin_activate_user=1&id="+id,dataType:"json",success:function(result){NProgress.done();if(result.status==1){setTimeout(show_ok,500);$('#activate_user').html("<p class='text-success'>Пользователь активирован</p>");setTimeout(function(){$('#activate_user').fadeOut();},2000);}else{setTimeout(show_error,500);if(result.data!=''||result.data!=undefined){alert(result.data);}}}});}
function admin_change_birth(id){NProgress.start();var token=$('#token').val();var birth_day=$('#birth_day').val();var birth_month=$('#birth_month').val();var birth_year=$('#birth_year').val();$.ajax({type:"POST",url:"../ajax/actions_z.php",data:"phpaction=1&token="+token+"&admin_change_birth=1&birth_day="+birth_day+"&birth_month="+birth_month+"&birth_year="+birth_year+"&id="+id,dataType:"json",success:function(result){if(result.status==1){NProgress.done();setTimeout(show_ok,500);}else{NProgress.done();setTimeout(show_error,500);if(result.data!=''||result.data!=undefined){alert(result.data);}}}});}
function load_page_image(id){NProgress.start();var data=new FormData($("#image"+id)[0]);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:data,contentType:false,processData:false,}).done(function(html){eval(html);$("#image"+id)[0].reset();NProgress.done();});}
function save_page(id){NProgress.start();var data={}
data['save_page']='1';data['id']=id;data['title']=$('#title'+id).val();data['description']=$('#description'+id).val();data['keywords']=$('#keywords'+id).val();data['kind']=$('#kind'+id).val();data['robots']=$('#robots'+id).val();data['privacy']=$('#privacy'+id).val();data['active']=$('#active'+id).val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:create_material(data),dataType:"json",success:function(result){NProgress.done();if(result.status==1){setTimeout(show_ok,500);}else{setTimeout(show_error,500);if(result.data!=''&result.data!=undefined){alert(result.data);}}}});}
function create_page(){var data={}
data['create_page']='1';data['class']=$('#input_class').val();data['privacy']=$('#input_privacy').val();data['robots']=$('#input_robots').val();data['active']=$('#input_active').val();data['url']=$('#input_url').val();data['title']=$('#input_title').val();data['description']=$('#input_description').val();data['keywords']=$('#input_keywords').val();data['image']=$('#input_image').val();data['content']=CKEDITOR.instances.input_content.getData();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:create_material(data),success:function(html){$("#create_page_result").html(html);}});}
function page_edit(id){var data={}
data['page_edit']='1';data['page_id']=id;data['class']=$('#input_class').val();data['privacy']=$('#input_privacy').val();data['robots']=$('#input_robots').val();data['active']=$('#input_active').val();data['url']=$('#input_url').val();data['title']=$('#input_title').val();data['description']=$('#input_description').val();data['keywords']=$('#input_keywords').val();data['content']=CKEDITOR.instances.input_content.getData();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:create_material(data),success:function(html){$("#edit_page_result").html(html);}});}
function load_pages(type){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&load_pages=1&type="+type,success:function(html){if(type==1){block='engine_pages';}else{block='user_pages';}
$("#"+block).html(html);}});}
function dell_page(number){if(confirm('Вы уверены?')){NProgress.start();var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&dell_page=1&number="+number,success:function(html){load_pages(2);NProgress.done();setTimeout(show_ok,500);}});}}
function create_menu(){NProgress.start();var token=$('#token').val();var input_name=$('#input_name').val();var input_link=$('#input_link').val();var checbox=$('#checbox').val();input_name=encodeURIComponent(input_name);input_link=encodeURIComponent(input_link);checbox=encodeURIComponent(checbox);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&create_menu=1&input_name="+input_name+"&input_link="+input_link+"&checbox="+checbox,dataType:"json",success:function(result){if(result.status==1){NProgress.done();setTimeout(show_ok,500);load_menu();}else{NProgress.done();setTimeout(show_error,500);}}});}
function load_menu(){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&load_menu=1",success:function(html){$("#menu").html(html);}});}
function dell_menu(number){if(confirm('Вы уверены?')){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&dell_menu=1&number="+number,success:function(html){dell_block("menu_1_"+number);}});}}
function edit_menu(number){NProgress.start();var token=$('#token').val();var input_name=$('#edit_name_1'+number).val();var input_link=$('#edit_link_1'+number).val();var checbox=$('#checbox_1_'+number).val();input_name=encodeURIComponent(input_name);input_link=encodeURIComponent(input_link);checbox=encodeURIComponent(checbox);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&edit_menu=1&input_name="+input_name+"&checbox="+checbox+"&input_link="+input_link+"&number="+number,dataType:"json",success:function(result){if(result.status==1){NProgress.done();setTimeout(show_ok,500);}else{NProgress.done();setTimeout(show_error,500);}}});}
function up_menu(number){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&up_menu=1&number="+number,success:function(html){load_menu(number);}});}
function down_menu(number){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&down_menu=1&number="+number,success:function(html){load_menu(number);}});}
function create_sliding_menu(){NProgress.start();var token=$('#token').val();var input_name=$('#input_sliding_name').val();var sliding_checbox=$('#sliding_checbox').val();input_name=encodeURIComponent(input_name);sliding_checbox=encodeURIComponent(sliding_checbox);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&create_sliding_menu=1&input_name="+input_name+"&sliding_checbox="+sliding_checbox,dataType:"json",success:function(result){if(result.status==1){NProgress.done();setTimeout(show_ok,500);load_menu();}else{NProgress.done();setTimeout(show_error,500);}}});}
function load_menu__sub(number){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&load_menu__sub=1&number="+number,success:function(html){$("#menu__sub_links_"+number).html(html);}});}
function create_menu_pod(number){NProgress.start();var token=$('#token').val();var input_name=$('#input_name_pod_'+number).val();var input_link=$('#input_link_pod_'+number).val();var checbox=$('#sliding_pod_checbox_'+number).val();input_name=encodeURIComponent(input_name);input_link=encodeURIComponent(input_link);checbox=encodeURIComponent(checbox);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&create_menu_pod=1&input_name="+input_name+"&input_link="+input_link+"&checbox="+checbox+"&number="+number,dataType:"json",success:function(result){if(result.status==1){NProgress.done();setTimeout(show_ok,500);load_menu__sub(number);}else{NProgress.done();setTimeout(show_error,500);}}});}
function dell_pod_menu(number,menu){if(confirm('Вы уверены?')){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&dell_pod_menu=1&number="+number+"&menu="+menu,success:function(html){dell_block("pod_menu_1_"+number);}});}}
function edit_pod_menu(number,menu){NProgress.start();var token=$('#token').val();var input_name=$('#edit_pod_name_1_1_'+number).val();var input_link=$('#edit_pod_link_1_1_'+number).val();var checbox=$('#sliding_pod_checbox_1_1_'+number).val();input_name=encodeURIComponent(input_name);input_link=encodeURIComponent(input_link);checbox=encodeURIComponent(checbox);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&edit_pod_menu=1&input_name="+input_name+"&checbox="+checbox+"&input_link="+input_link+"&number="+number+"&menu="+menu,dataType:"json",success:function(result){if(result.status==1){NProgress.done();setTimeout(show_ok,500);load_menu__sub(number);}else{NProgress.done();setTimeout(show_error,500);}}});}
function up_pod_menu(number,menu){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&up_pod_menu=1&number="+number+"&menu="+menu,success:function(html){load_menu__sub(menu);}});}
function down_pod_menu(number,menu){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&down_pod_menu=1&number="+number+"&menu="+menu,success:function(html){load_menu__sub(menu);}});}
function load_logs(){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&load_logs=1",success:function(html){$("#logs").html(html);}});}
function load_error_logs(){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&load_error_logs=1",success:function(html){$("#error_logs").html(html);}});}
function load_pdo_errors(){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&load_pdo_errors=1",success:function(html){$("#pdo_errors").html(html);}});}
function load_payment_successes(){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&load_payment_successes=1",success:function(html){$("#payment_successes").html(html);}});}
function load_payment_errors(){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&load_payment_errors=1",success:function(html){$("#payment_errors").html(html);}});}
function load_services_log(){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&load_services_log=1",success:function(html){$("#services_log").html(html);}});}
function dell_logs(){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&dell_logs=1",success:function(html){$("#logs").html(html);}});}
function dell_error_logs(){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&dell_error_logs=1",success:function(html){$("#error_logs").html(html);}});}
function dell_pdo_errors(){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&dell_pdo_errors=1",success:function(html){$("#pdo_errors").html(html);}});}
function dell_payment_successes(){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&dell_payment_successes=1",success:function(html){$("#payment_successes").html(html);}});}
function dell_payment_errors(){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&dell_payment_errors=1",success:function(html){$("#payment_errors").html(html);}});}
function dell_services_log(){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&dell_services_log=1",success:function(html){$("#services_log").html(html);}});}
function load_banned_ip(){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&load_banned_ip=1&token="+token,success:function(html){$("#banned_ip").html(html);}});}
function dell_banned_ip(id){NProgress.start();var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&dell_banned_ip=1&token="+token+"&id="+id,success:function(html){$("#ban"+id).fadeOut();NProgress.done();setTimeout(show_ok,500);}});}
function add_banned_ip(){NProgress.start();var token=$('#token').val();var ip=$('#ip').val();ip=encodeURIComponent(ip);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&add_banned_ip=1&token="+token+"&ip="+ip,dataType:"json",success:function(result){if(result.status==1){NProgress.done();load_banned_ip();setTimeout(show_ok,500);}else{NProgress.done();setTimeout(show_error,500);}}});}
function edit_template(type,name){NProgress.start();var token=$('#token').val();if(type==1){var template=$('#template').val();}else if(type==2){var template=$('#template_mobile').val();}else if(type==3){var template=$('#template_prsonal').val();}
if(name!=undefined){template=name;}
template=encodeURIComponent(template);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&edit_template=1&template="+template+"&type="+type,dataType:"json",success:function(result){if(result.status==1){NProgress.done();setTimeout(show_ok,500);reset_page();}else{NProgress.done();setTimeout(show_error,500);}}});}
function get_content_tpl(name,type){if(type=='img'){$("#img").html('<img class="img-thumbnail black" src="../'+name+'" alt="'+name+'">');$("#name2").html(' ('+name+')');$("#img_name").val(name);$('#img_send').fadeIn();$("#btn").val("Заменить");$("#folder").val("");$("#data").val("");}else{var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&get_content_tpl=1&name="+name,dataType:"json",success:function(result){if(result.status=='1'){$("#name1").html(' ('+name+')');$("#editor").html("<textarea id='code'>"+result.content+"</textarea>");$("#warning").html(result.warning);$('#file_name').val(name);$('#save_code').attr('class','btn btn-default');$('#save_code').attr('onclick','save_code("'+name+'");');editor=CodeMirror.fromTextArea(document.getElementById('code'),{lineNumbers:'true',scrollbarStyle:'simple',mode:'text/'+type,theme:'monokai',extraKeys:{'F11':function(cm){cm.setOption('fullScreen',!cm.getOption('fullScreen'));},'Esc':function(cm){if(cm.getOption('fullScreen'))cm.setOption('fullScreen',false);}}});editor.on('change',function(){on_save_editor_button();});}else{alert(result.message);}}});}}
function save_code(name){NProgress.start();var token=$('#token').val();var content=editor.getValue();content=encodeURIComponent(content);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&save_code=1&name="+name+"&content="+content,dataType:"json",success:function(result){if(result.status=='1'){$('#save_code').attr('onclick','');$('#save_code').attr('class','btn btn-default disabled');$('#save_code').text('Сохранение...');setTimeout("$('#save_code').text('Сохранено')",500);NProgress.done();setTimeout(show_ok,500);}else{alert(result.message);NProgress.done();setTimeout(show_error,500);}}});}
function on_save_editor_button(){var name=$('#file_name').val();if(name!='none'){$('#save_code').attr('class','btn btn-default');$('#save_code').attr('onclick','save_code("'+name+'");');$('#save_code').text('Сохранить');}}
function upload_template_img(folder,data){$("#img").empty();$("#name2").html(' (Для загрузки выбрана папка '+folder+')');$("#folder").val(folder);$("#data").val(data);$('#img_send').fadeIn();$("#btn").val("Загрузить");}
function install_template_by_key(){NProgress.start();var token=$('#token').val();var key=$('#template_key').val();key=encodeURIComponent(key);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&install_template_by_key=1&token="+token+"&key="+key,dataType:"json",success:function(result){NProgress.done();if(result.status==1){setTimeout(show_ok,500);edit_template(1,result.message);}else{setTimeout(show_error,500);$("#installing_result").html("<p class='text-danger m-0'>"+result.message+"</p>");}}});}
function load_news_adm(){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&load_news_adm=1",success:function(html){$("#news").html(html);}});}
function server(type,id){type=type||'none';if(type=='add'||type=='edit'){NProgress.start();var data={};if(type=='add'){id='';}else{data['id']=id;}
	data['server_act']=1;data['func_type']=type;data['name']=$('#name'+id).val();data['address']=$('#address'+id).val();data['ip']=$('#ip'+id).val();data['port']=$('#port'+id).val();data['ftp_host']=$('#ftp_host'+id).val();data['ftp_login']=$('#ftp_login'+id).val();data['ftp_pass']=$('#ftp_pass'+id).val();data['ftp_port']=$('#ftp_port'+id).val();data['db_host']=$('#db_host'+id).val();data['db_user']=$('#db_user'+id).val();data['db_pass']=$('#db_pass'+id).val();data['db_db']=$('#db_db'+id).val();data['db_prefix']=$('#db_prefix'+id).val();data['db_code']=$('#db_code'+id).val();data['type']=$('#type'+id).val();data['game']=$('#game'+id).val();data['ftp_string']=$('#ftp_string'+id).val();data['st_type']=$('#st_type'+id).val();data['st_db_host']=$('#st_db_host'+id).val();data['st_db_user']=$('#st_db_user'+id).val();data['st_db_pass']=$('#st_db_pass'+id).val();data['st_db_db']=$('#st_db_db'+id).val();data['st_db_code']=$('#st_db_code'+id).val();data['st_sort_type']=$('#st_sort_type'+id).val();data['st_db_table']=$('#st_db_table'+id).val();data['pass_prifix']=$('#pass_prifix'+id).val();data['discount']=$('#discount'+id).val();data['show']=$('#show'+id).val();data['import_settings']=$('#import_settings'+id).val();data['bind_nick_pass']=$('#bind_nick_pass'+id).prop("checked");data['bind_steam']=$('#bind_steam'+id).prop("checked");data['bind_steam_pass']=$('#bind_steam_pass'+id).prop("checked");$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:create_material(data),error:function(){NProgress.done();var ansver="<p class='text-danger'>Ошибка! Вероятнее всего отсутствует разрешение на удаленное подключение к базе данных!</p>";if(type=='add'){$("#add_serv_result").html(ansver);}else{$("#edit_serv_result"+id).html(ansver);}},success:function(html){NProgress.done();if(type=='add'){$("#add_serv_result").html(html);load_servers();}else{$("#edit_serv_result"+id).html(html);}}});}}
function load_servers(){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&load_servers=1&token="+token,success:function(html){$("#servers").html(html);}});}
function dell_server(id){if(confirm('Вы уверены? Администраторы сервера будут удалены из базы движка, но оставлены в базе сервера.')){NProgress.start();var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&dell_server=1&token="+token+"&id="+id,dataType:"json",success:function(result){NProgress.done();if(result.status==1){setTimeout(show_ok,500);$("#serv_"+id).fadeOut();}else{setTimeout(show_error,500);}}});}}
function select_serv_type(type,id){$('#none_'+id).attr('class','disp-n');$('#ftp'+id).attr('class','disp-n');$('#db'+id).attr('class','disp-n');$('#tip1_'+id).attr('class','disp-n');$('#tip2_'+id).attr('class','disp-n');$('#tip3_'+id).attr('class','disp-n');$('#tip4_'+id).attr('class','disp-n');$('#tip5_'+id).attr('class','disp-n');$('#tip6_'+id).attr('class','disp-n');if(type==0){$('#none_'+id).attr('class','disp-b');$('#import'+id).attr('class','disp-n');$('#import_settings'+id).val(0);}
	if(type==1){$('#tip1_'+id).attr('class','disp-b');$('#ftp'+id).attr('class','disp-b');}
	if(type==2){$('#tip2_'+id).attr('class','disp-b');$('#db'+id).attr('class','disp-b');}
	if(type==3){$('#tip3_'+id).attr('class','disp-b');$('#db'+id).attr('class','disp-b');$('#ftp'+id).attr('class','disp-b');}
	if(type==4){$('#tip4_'+id).attr('class','disp-b');$('#db'+id).attr('class','disp-b');}
	if(type==5){$('#tip5_'+id).attr('class','disp-b');$('#db'+id).attr('class','disp-b');}
	if(type==6){$('#tip6_'+id).attr('class','disp-b');$('#db'+id).attr('class','disp-b');}
	if(type!=0){$('#import'+id).attr('class','disp-b');$('#auth_prefix'+id).attr('class','disp-b');}else{$('#auth_prefix'+id).attr('class','disp-n');}}
function select_stat_type(type,id){$('#st_none_'+id).attr('class','disp-n');$('#st_tip1_'+id).attr('class','disp-n');$('#st_db_table_input'+id).attr('class','disp-n');$('#st_sort_type'+id+' option[value=0]').attr('class','disp-n');$('#st_sort_type'+id+' option[value=1]').attr('class','disp-n');$('#st_sort_type'+id+' option[value=2]').attr('class','disp-n');$('#st_sort_type'+id+' option[value=3]').attr('class','disp-n');$('#st_sort_type'+id+' option[value=4]').attr('class','disp-n');$('#st_sort_type'+id+' option[value=5]').attr('class','disp-n');$('#st_sort_type'+id+' option[value=6]').attr('class','disp-n');$('#st_sort_type'+id+' option[value=7]').attr('class','disp-n');$('#st_sort_type'+id+' option[value=8]').attr('class','disp-n');if(type==0){$('#st_none_'+id).attr('class','disp-b');}
if(type==1||type==2||type==3||type==4||type==5||type==6){$('#st_tip1_'+id).attr('class','disp-b');}
if(type==1||type==2||type==3||type==4||type==5){$('#st_sort_type'+id+' option[value=0]').attr('class','disp-b');$('#st_sort_type'+id+' option[value=1]').attr('class','disp-b');$('#st_sort_type'+id+' option[value=2]').attr('class','disp-b');$('#st_sort_type'+id+' option[value=3]').attr('class','disp-b');$('#st_sort_type'+id+' option[value=4]').attr('class','disp-b');}
if(type==1||type==2){$('#st_sort_type'+id+' option[value=5]').attr('class','disp-b');$('#st_sort_type'+id+' option[value=6]').attr('class','disp-b');}
if(type==6){$('#st_sort_type'+id+' option[value=7]').attr('class','disp-b');$('#st_sort_type'+id+' option[value=8]').attr('class','disp-b');}
if(type==3||type==5||type==6){$('#st_db_table_input'+id).attr('class','disp-b');}}
function up_server(id){NProgress.start();var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&up_server=1&token="+token+"&id="+id,dataType:"json",success:function(result){NProgress.done();if(result.status==1){load_servers();setTimeout(show_ok,500);}else{setTimeout(show_error,500);}}});}
function down_server(id){NProgress.start();var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&down_server=1&token="+token+"&id="+id,dataType:"json",success:function(result){NProgress.done();if(result.status==1){load_servers();setTimeout(show_ok,500);}else{setTimeout(show_error,500);}}});}
function clear_banlist(id){if(confirm('Вы уверены?')){NProgress.start();var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&clear_banlist=1&id="+id,dataType:"json",success:function(result){NProgress.done();if(result.status==1){setTimeout(show_ok,500);}else{setTimeout(show_error,500);}}});}}
function clear_mutlist(id){if(confirm('Вы уверены?')){NProgress.start();var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&clear_mutlist=1&id="+id,dataType:"json",success:function(result){NProgress.done();if(result.status==1){setTimeout(show_ok,500);}else{setTimeout(show_error,500);}}});}}
function save_server_commands(id){NProgress.start();var data={}
data['save_server_commands']='1';data['reload_admins']=$('#reload_admins'+id).val();data['kick']=$('#kick'+id).val();data['ban']=$('#ban'+id).val();data['rcon_password']=$('#rcon_password'+id).val();data['rcon']=$('#rcon'+id).val();data['id']=id;$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:create_material(data),success:function(html){NProgress.done();$("#edit_server_command_result"+id).html(html);}});}
function do_rcon_command(id){NProgress.start();var data={}
data['do_rcon_command']='1';data['command']=$('#command'+id).val();data['id']=id;$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:create_material(data),success:function(html){NProgress.done();$("#do_rcon_command_result"+id).html(html);}});}
function add_nick_input(){var i=$('#bad_nicks_list>.input-group:last>input').attr('name');if(i!=undefined){i=i.replace('nick','');}else{i=-1;}
i++;$('#bad_nicks_list').append('<div class="input-group" id="input_nick_'+i+'"><span class="input-group-btn"><button class="btn btn-default" type="button" onclick="dell_nick_input('+i+');">Удалить</button></span><input type="text" name="nick'+i+'" maxlength="32" placeholder="Введите ник" class="form-control"></div>');}
function dell_nick_input(i){$('#input_nick_'+i).detach();}
function save_bad_nicks(){NProgress.start();var token=$('#token').val();var data=$('#bad_nicks_list').serialize();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&save_bad_nicks=1&token="+token+"&"+data,dataType:"json",success:function(result){NProgress.done();if(result.status==1){setTimeout(show_ok,500);}else{setTimeout(show_error,500);}}});}
function load_bad_nicks(){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&load_bad_nicks=1&token="+token,success:function(html){$("#bad_nicks_list").html(html);}});}
function add_bonus_input(){var i=$('#bonuses_list>.input-group:last>input').attr('name');if(i!=undefined){i=i.replace('bonus','');}else{i=-1;}
i++;$('#bonuses_list').append('<div class="input-group" id="input_bonus_'+i+'"><span class="input-group-btn"><button class="btn btn-default" type="button" onclick="dell_bonus_input('+i+');">Удалить</button></span><input type="text" name="bonus_start_'+i+'" maxlength="5" placeholder="Начало диапазона" class="form-control w-25"><input type="text" name="bonus_end_'+i+'" maxlength="5" placeholder="Конец диапазона" class="form-control w-25"><select name="type_'+i+'" class="form-control w-25"><option value="1">Бонус - N рублей</option><option value="2">Бонус - N% от пополненной суммы</option></select><input type="text" name="bonus_'+i+'" maxlength="5" placeholder="Введите значение N" class="form-control w-25"></div>');}
function dell_bonus_input(i){$('#input_bonus_'+i).detach();}
function save_bonuses(){NProgress.start();var token=$('#token').val();var data=$('#bonuses_list').serialize();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&save_bonuses=1&token="+token+"&"+data,dataType:"json",success:function(result){NProgress.done();if(result.status==1){setTimeout(show_ok,500);}else{setTimeout(show_error,500);}}});}
function load_bonuses(){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&load_bonuses=1&token="+token,success:function(html){$("#bonuses_list").html(html);}});}
function add_service(){NProgress.start();var token=$('#token').val();var server=$('#server').val();var name=$('#name').val();var flags=$('#flags').val();var text=tinymce.get("text").getContent();var immunity=$("#immunity").val();var sale=$("#sale").val();var user_groups=$("#user_groups").val();var group=$("#group").val();var flags_or_group=$("#flags_or_group").val();var show=$("#show").val();var discount=$("#discount").val();text=$.trim(text);server=encodeURIComponent(server);name=encodeURIComponent(name);flags=encodeURIComponent(flags);text=encodeURIComponent(text);immunity=encodeURIComponent(immunity);sale=encodeURIComponent(sale);user_groups=encodeURIComponent(user_groups);group=encodeURIComponent(group);flags_or_group=encodeURIComponent(flags_or_group);show=encodeURIComponent(show);discount=encodeURIComponent(discount);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&add_service=1&token="+token+"&server="+server+"&group="+group+"&flags_or_group="+flags_or_group+"&name="+name+"&show="+show+"&discount="+discount+"&flags="+flags+"&text="+text+"&immunity="+immunity+"&sale="+sale+"&user_groups="+user_groups,dataType:"json",success:function(result){if(result.status==1){NProgress.done();setTimeout(show_ok,500);get_services();get_services2();}else{NProgress.done();setTimeout(show_error,500);show_input_error(result.input,result.reply,null);}}});}
function edit_service(id){NProgress.start();var token=$('#token').val();var name=$('#name'+id).val();var flags=$('#flags'+id).val();var text=tinymce.get("text"+id).getContent();var immunity=$('#immunity'+id).val();var sale=$('#sale'+id).val();var user_groups=$("#user_groups"+id).val();var group=$("#group"+id).val();var flags_or_group=$("#flags_or_group"+id).val();var show=$("#show"+id).val();var discount=$("#discount"+id).val();text=$.trim(text);name=encodeURIComponent(name);flags=encodeURIComponent(flags);text=encodeURIComponent(text);immunity=encodeURIComponent(immunity);sale=encodeURIComponent(sale);user_groups=encodeURIComponent(user_groups);group=encodeURIComponent(group);flags_or_group=encodeURIComponent(flags_or_group);show=encodeURIComponent(show);discount=encodeURIComponent(discount);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&edit_service=1&token="+token+"&name="+name+"&group="+group+"&flags_or_group="+flags_or_group+"&show="+show+"&discount="+discount+"&flags="+flags+"&text="+text+"&immunity="+immunity+"&id="+id+"&sale="+sale+"&user_groups="+user_groups,dataType:"json",success:function(result){if(result.status==1){NProgress.done();setTimeout(show_ok,500);get_services();}else{NProgress.done();setTimeout(show_error,500);show_input_error(result.input+id,result.reply,null);}}});}
function add_tarif(){NProgress.start();var data={}
data['add_tarif']='1';data['service']=$('#services').val();data['pirce']=$('#pirce').val();data['time']=$('#time').val();data['discount']=$('#tarif_discount').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:create_material(data),dataType:"json",success:function(result){if(result.status==1){NProgress.done();setTimeout(show_ok,500);get_services2();}else{NProgress.done();setTimeout(show_error,500);show_input_error(result.input,result.reply,null);}}});}
function dell_service(id){NProgress.start();var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&dell_service=1&token="+token+"&id="+id,success:function(html){$("#service"+id).fadeOut();get_services();NProgress.done();setTimeout(show_ok,500);}});}
function edit_tarif(id){NProgress.start();var data={}
data['edit_tarif']='1';data['id']=id;data['pirce']=$('#pirce'+id).val();data['time']=$('#time'+id).val();data['discount']=$('#tarif_discount'+id).val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:create_material(data),dataType:"json",success:function(result){if(result.status==1){NProgress.done();setTimeout(show_ok,500);}else{NProgress.done();setTimeout(show_error,500);show_input_error(result.input+id,result.reply,null);}}});}
function dell_tarif(id){NProgress.start();var data={}
data['dell_tarif']='1';data['id']=id;$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:create_material(data),success:function(html){$("#tarif"+id).fadeOut();NProgress.done();setTimeout(show_ok,500);}});}
function get_services(){var token=$('#token').val();var id=$('#server').val();id=encodeURIComponent(id);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&get_services=1&token="+token+"&id="+id,success:function(html){$("#services").html(html);}});}
function get_services2(tiny_code){if(typeof tinymce!="undefined"){tinymce.remove();}
	if(typeof tinymce!="undefined"){init_tinymce('text',tiny_code,'lite',1);}
	var token=$('#token').val();var id=$('#server').val();id=encodeURIComponent(id);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&get_services2=1&token="+token+"&id="+id,success:function(html){$("#services2").html(html);}});}
function up_service(id){NProgress.start();var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&up_service=1&token="+token+"&id="+id,dataType:"json",success:function(result){NProgress.done();if(result.status==1){get_services2();setTimeout(show_ok,500);}else{setTimeout(show_error,500);}}});}
function down_service(id){NProgress.start();var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&down_service=1&token="+token+"&id="+id,dataType:"json",success:function(result){NProgress.done();if(result.status==1){get_services2();setTimeout(show_ok,500);}else{setTimeout(show_error,500);}}});}
function change_store_bind_type(type){if(!$('#player_nick').hasClass('disp-n')){$('#player_nick').addClass('disp-n');}
if(!$('#player_steam_id').hasClass('disp-n')){$('#player_steam_id').addClass('disp-n');}
if(!$('#player_pass').hasClass('disp-n')){$('#player_pass').addClass('disp-n');}
if(type==1){$('#player_nick').removeClass('disp-n');$('#player_pass').removeClass('disp-n');}
if(type==2){$('#player_steam_id').removeClass('disp-n');}
if(type==3){$('#player_pass').removeClass('disp-n');$('#player_steam_id').removeClass('disp-n');}}
function change_admin_bind_type(type,id){if(!$('#input_name'+id).hasClass('disp-n')){$('#input_name'+id).addClass('disp-n');}
if(!$('#input_pass'+id).hasClass('disp-n')){$('#input_pass'+id).addClass('disp-n');}
if(type==1){$('#input_name'+id).removeClass('disp-n');$('#input_pass'+id).removeClass('disp-n');}
if(type==2){$('#input_name'+id).removeClass('disp-n');}
if(type==3){$('#input_name'+id).removeClass('disp-n');$('#input_pass'+id).removeClass('disp-n');}}
function load_servers_admins(){var token=$('#token').val();var id=$('#store_server').val();id=encodeURIComponent(id);$.ajax({type:"POST",url:"../ajax/actions_z.php",data:"phpaction=1&load_servers_admins=1&actions_panel=1&token="+token+"&id="+id,success:function(html){$("#admins").html(html);}});}
function get_admin_info(id){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_z.php",data:"phpaction=1&actions_panel=1&get_admin_info=1&token="+token+"&id="+id,success:function(html){$("#admin_info"+id).html(html);}});}
function timing_serv_type(type){$('#db').attr('class','disp-n');$('#ftp').attr('class','disp-n');$('#none').attr('class','disp-n');if(type==1||type==3){$('#ftp').attr('class','disp-b');}
if(type==2||type==4){$('#db').attr('class','disp-b');}
if(type==5||type==6||type==0){$('#none').attr('class','disp-b');}}
function import_admins(){if(confirm("Вы уверены?")){NProgress.start();var token=$('#token').val();var id=$('#store_server').val();id=encodeURIComponent(id);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&import_admins=1&token="+token+"&id="+id,dataType:"json",success:function(result){NProgress.done();if(result.status==1){setTimeout(show_ok,500);load_servers_admins();}else{setTimeout(show_error,500);}}});}}
function export_admins(){if(confirm("Вы уверены?")){NProgress.start();var id=$('#store_server').val();var token=$('#token').val();id=encodeURIComponent(id);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&export_admins=1&id="+id,dataType:"json",success:function(result){NProgress.done();if(result.status==1){setTimeout(show_ok,500);}else{setTimeout(show_error,500);}}});}}
function edit_admin(id,type){NProgress.start();var data={}
data['edit_admin']='1';data['type']=type;data['id']=id;if(type=='type'){data['param']=$('#store_type_'+id).val();}
if(type=='name'){data['param']=$('#player_name_'+id).val();}
if(type=='pass'){data['param']=$('#player_pass_'+id).val();}
if(type=='user_id'){data['param']=$('#player_user_id_'+id).val();}
if(type=='comment'){data['param']=$('#player_comment_'+id).val();}
$.ajax({type:"POST",url:"../ajax/actions_z.php",data:create_material(data),dataType:"json",success:function(result){NProgress.done();if(result.status==1){setTimeout(show_ok,500);if(type=='user_id'||type=='name'){load_edit_admin_result(id);}}else{setTimeout(show_error,500);alert(result.reply);}}});}
function load_edit_admin_result(id){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_z.php",data:"phpaction=1&load_edit_admin_result=1&token="+token+"&id="+id,dataType:"json",success:function(result){$("#new_name_"+id).html(result.name);$("#new_user_"+id).html(result.user);$("#new_services_"+id).html(result.services);}});}
function stop_adm(id){var token=$('#token').val();var cause=prompt("Причина (обязательно)","");if(cause!=null&&cause!=''){var link=prompt("Ссылка на доказательства (не обязательно)","");if(link!=null){var pirce=prompt("Стоимость разблокировки (обязательно)","100");if(cause!=''){cause=encodeURIComponent(cause);link=encodeURIComponent(link);pirce=encodeURIComponent(pirce);$.ajax({type:"POST",url:"../ajax/actions_z.php",data:"phpaction=1&stop_adm=1&token="+token+"&id="+id+"&cause="+cause+"&link="+link+"&pirce="+pirce,dataType:"json",success:function(result){if(result.status==1){$('#admin'+id).addClass("danger");setTimeout(function(){get_admin_info(id);},500);}else{if(result.data!=''&&result.data!=undefined){alert(result.data);}}}});}else{NProgress.done();setTimeout(show_error,500);}}else{NProgress.done();setTimeout(show_error,500);}}else{NProgress.done();setTimeout(show_error,500);}}
function start_adm(id){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_z.php",data:"phpaction=1&start_adm=1&token="+token+"&id="+id,dataType:"json",success:function(result){if(result.status==1){setTimeout(function(){$('#admin'+id).removeClass("danger");get_admin_info(id);},500);}else{if(result.data!=''&&result.data!=undefined){alert(result.data);}}}});}
function pause_admin(id){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_z.php",data:"phpaction=1&pause_admin=1&token="+token+"&id="+id,dataType:"json",success:function(result){if(result.status==1){setTimeout(function(){$('#admin'+id).addClass("warning");get_admin_info(id);},500);}else{if(result.data!=''&&result.data!=undefined){alert(result.data);}}}});}
function resume_admin(id){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_z.php",data:"phpaction=1&resume_admin=1&token="+token+"&id="+id,dataType:"json",success:function(result){if(result.status==1){setTimeout(function(){$('#admin'+id).removeClass("warning");get_admin_info(id);},500);}else{if(result.data!=''&&result.data!=undefined){alert(result.data);}}}});}
function add_admin(check1,check2){$('#store_buy_btn').attr('onclick','');var data={};data['add_admin']='1';data['server']=$('#store_server').val();data['service']=$('#store_services').val();data['tarifs']=$('#store_tarifs').val();data['type']=$('#store_type').val();data['nick']=$('#player_nick').val();data['pass']=$('#player_pass').val();data['steam_id']=$('#player_steam_id').val();data['user_id']=$('#player_user_id').val();data['check1']=check1;data['check2']=check2;$.ajax({type:"POST",url:"../ajax/actions_z.php",data:create_material(data),dataType:"json",success:function(result){NProgress.done();if(result.status==1){setTimeout(show_ok,500);$("#add_result").html("<p class='text-success'>"+result.data+"</p>");reset_admin_adding(1);load_servers_admins();}
		if(result.status==2){setTimeout(show_error,500);show_input_error(result.input,result.reply,null);reset_admin_adding(1);}
		if(result.status==3){setTimeout(show_error,500);$("#add_result").html("<p class='text-danger'>"+result.data+"</p>");reset_admin_adding(1);}
		if(result.status==4){$("#add_result").html("<p class='text-danger'>На сервере уже имеется услуга, прикрепленная к данному игровому аккаунту. Желаете совместить услуги?</p>");$('#store_answer_btn').removeClass('disp-n');$('#store_answer_btn').attr('onclick','reset_admin_adding();');$("#store_buy_btn").html("Да");$('#store_buy_btn').attr('onclick','add_admin(1,0);');}
		if(result.status==5){$("#add_result").html('<p class="text-danger">Предложено изменить группу пользователя на "'+result.group+'". Принять предложение?</p>');$('#store_answer_btn').removeClass('disp-n');$('#store_answer_btn').attr('onclick','add_admin(1,2);');$("#store_buy_btn").html("Да");$('#store_buy_btn').attr('onclick','add_admin(1,1);');}}});}
function reset_admin_adding(type){if(type!=1){$("#add_result").empty();}
	$("#store_answer_btn").addClass('disp-n');$('#store_answer_btn').attr('onclick','');$('#store_buy_btn').attr('onclick','add_admin();');$("#store_buy_btn").html("Выдать");}
function dell_admin(id){if(confirm("Вы уверены?")){NProgress.start();var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_z.php",data:"phpaction=1&dell_admin=1&token="+token+"&id="+id,dataType:"json",success:function(result){NProgress.done();if(result.status==1){setTimeout(show_ok,500);$("#admin"+id).fadeOut();$('#admin_modal'+id).modal('hide');}else{setTimeout(show_error,500);}}});}}
function change_admin_days(id,id2){NProgress.start();var date=$('#date_end'+id).val();var token=$('#token').val();date=encodeURIComponent(date);$.ajax({type:"POST",url:"../ajax/actions_z.php",data:"phpaction=1&change_admin_days=1&token="+token+"&id="+id+"&date="+date,dataType:"json",success:function(result){if(result.status==1){NProgress.done();setTimeout(show_ok,500);get_admin_info(id2);$('#ui-datepicker-div').fadeOut();}else{NProgress.done();setTimeout(show_error,500);}}});}
function change_admin_flags(id,id2,type){NProgress.start();var token=$('#token').val();if(type=='none'){var flags='none';}else{var flags=$('#service_flags'+id).val();flags=encodeURIComponent(flags);}
$.ajax({type:"POST",url:"../ajax/actions_z.php",data:"phpaction=1&change_admin_flags=1&token="+token+"&id="+id+"&flags="+flags,dataType:"json",success:function(result){if(result.status==1){NProgress.done();setTimeout(show_ok,500);if(type=='none'){get_admin_info(id2);}}else{NProgress.done();setTimeout(show_error,500);}}});}
function dell_admin_service(id){if(confirm("Вы уверены?")){NProgress.start();var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_z.php",data:"phpaction=1&dell_admin_service=1&token="+token+"&id="+id,dataType:"json",success:function(result){NProgress.done();if(result.status==1){setTimeout(show_ok,500);$("#"+id).fadeOut();if(result.dell==1){$("#admin"+result.id).fadeOut();$('#admin_modal'+result.id).modal('hide');}else{load_edit_admin_result(result.id);}}else{setTimeout(show_error,500);}}});}}
function set_admin_date_forever(id){$('#date_end'+id).val('00.00.0000 00:00');}
function get_services_adm(id){var data={}
data['get_services']='1';data['id']=id;$.ajax({type:"POST",url:"../ajax/actions_z.php",data:create_material(data),dataType:"json",success:function(result){if(result.status==1){$("#store_services").html(result.data);get_tarifs_adm(result.service);}}});}
function get_tarifs_adm(id){var data={}
data['get_tarifs']='1';data['id']=id;$.ajax({type:"POST",url:"../ajax/actions_z.php",data:create_material(data),dataType:"json",success:function(result){if(result.status==1){$("#store_tarifs").html(result.data);}}});}
function show_tarifs(id){if($('#extend_block'+id).is(":visible")){$('#extend_block'+id).fadeOut();}else{$('#extend_block'+id).fadeIn();}}
function add_service_to_admin(id){var name=$('#player_name_'+id).val();var pass=$('#player_pass_'+id).val();var type=$('#store_type_'+id).val();var user_id=$('#player_user_id_'+id).val();$('#player_type').val(type);show_input_success("type",null,1000);if(user_id!=''&user_id!=undefined){$('#player_user_id').val(user_id);show_input_success("player_user_id",null,1000);}else{show_input_error("player_user_id",null,1000);}
change_store_bind_type(type);$('#store_type').val(type);show_input_success("store_type",null,1000);if(type==1){$('#player_nick').val(name);$('#player_pass').val(pass);show_input_success("player_nick",null,1000);show_input_success("player_pass",null,1000);}
if(type==2){$('#player_steam_id').val(name);show_input_success("player_steam_id",null,1000);}
if(type==3){$('#player_steam_id').val(name);$('#player_pass').val(pass);show_input_success("player_steam_id",null,1000);show_input_success("player_pass",null,1000);}
$("#"+id).fadeOut();$('html, body').stop().animate({scrollTop:$("#add_admin_area").offset().top},1500,'easeInOutExpo');}
function edit_email_settings(){var data={}
data['edit_email_settings']='1';data['email_username']=$('#email_username').val();data['email_host']=$('#email_host').val();data['email_port']=$('#email_port').val();data['email_password']=$('#email_password').val();data['email_charset']=$('#email_charset').val();data['from_email']=$('#from_email').val();data['verify_peers']=$('#verify_peers').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:create_material(data),success:function(html){$("#edit_email_settings_result").html(html);}});}
function send_test_mail(){$('#subject').val('Test message');CKEDITOR.instances.text.setData('Test content');$('#dubug').val(1);$('#dubug_value').val(1);show_input_success("dubug",null,1000);show_input_success("subject",null,1000);show_input_success("dubug_value",null,1000);}
function send_email_message(){NProgress.start();var data={}
data['send_email_message']='1';data['email']=$('#email').val();data['subject']=$('#subject').val();data['text']=CKEDITOR.instances.text.getData();data['dubug']=$('#dubug').val();data['dubug_value']=$('#dubug_value').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:create_material(data),error:function(html){NProgress.done();$('#result').html("<p class='text-danger mt-10 mb-0'>Ошибка отправки сообщения, включите debug режим, чтобы установить причину.</p>");},success:function(html){NProgress.done();$('#result').html(html);}});}
function onMailer() {NProgress.start();var data = {};data['onMailer'] = '1';data['sendTitle'] = $('#sendTitle').val();data['sendMessage'] = $('#sendMessage').val();$.ajax({type: "POST",url: "../ajax/actions_panel.php",data: create_material(data),success: function(html) {NProgress.done();$("#resultMailer").html(html);}});}
function try_connect() {NProgress.start();var key = $('#key').val();var host = $('#host').val();var base = $('#base').val();var user = $('#user').val();var pass = $('#pass').val();key = encodeURIComponent(key);host = encodeURIComponent(host);base = encodeURIComponent(base);user = encodeURIComponent(user);pass = encodeURIComponent(pass);$.ajax({type: "POST",url: "../modules/install/installer.php",data: "key=" + key + "&try_connect=1&host=" + host + "&base=" + base + "&user=" + user + "&pass=" + pass,dataType: "json",success: function (result) {NProgress.done();if (result.status == 1) {setTimeout(show_ok, 500);$('#result1').html("<div class=\"alert alert-success\" role=\"alert\">" + result.data + "</div>");} else {setTimeout(show_error, 500);$('#result1').html("<div class=\"alert alert-danger\" role=\"alert\">" + result.data + "</div>");}}});}
function install() {NProgress.start();var key = $('#key').val();var host = $('#host').val();var base = $('#base').val();var user = $('#user').val();var pass = $('#pass').val();var name = $('#name').val();var email = $('#email').val();var password = $('#password').val();	$.ajax({type: "POST",url: "../modules/install/installer.php",data: "key=" + key + "&install=1&host=" + host + "&base=" + base + "&user=" + user + "&pass=" + pass + "&name=" + name + "&password=" + password + "&email=" + email,dataType: "json",success: function (result) {NProgress.done();if (result.status == 1) {setTimeout(show_ok, 500);$('#result2').html("<div class=\"alert alert-success\" role=\"alert\">" + result.data + "</div>");setTimeout(reset_page, 2500);} else {setTimeout(show_error, 500);$('#install').attr('onclick', 'install();');$('#result2').html("<div class=\"alert alert-danger\" role=\"alert\">" + result.data + "</div>");}}});}
function on_install(){var title=document.getElementById("checbox").title;if(title=='dont_agree'){document.getElementById("checbox").title='agree';$('#install').removeClass('disabled');$('#install').attr('onclick','install();');}else{document.getElementById("checbox").title='dont_agree';$('#install').addClass('disabled');$('#install').attr('onclick','');}}
function add_group(){NProgress.start();var token=$('#token').val();var name=$('#name').val();var rights=$('#rights').val();var color=$('#color').val();var style=$('#style').val();name=encodeURIComponent(name);rights=encodeURIComponent(rights);color=encodeURIComponent(color);style=encodeURIComponent(style);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&add_group=1&name="+name+"&rights="+rights+"&color="+color+"&style="+style,dataType:"json",success:function(result){NProgress.done();if(result.status==1){setTimeout(show_ok,500);$('#result').empty();get_groups();}else{setTimeout(show_error,500);$('#result').html("<p class='text-danger'>"+result.data+"</p>");}}});}
function edit_group(id){NProgress.start();var token=$('#token').val();var name=$('#name'+id).val();var rights=$('#rights'+id).val();var color=$('#color'+id).val();var style=$('#style'+id).val();name=encodeURIComponent(name);rights=encodeURIComponent(rights);color=encodeURIComponent(color);style=encodeURIComponent(style);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&edit_group=1&name="+name+"&rights="+rights+"&color="+color+"&style="+style+"&id="+id,dataType:"json",success:function(result){NProgress.done();if(result.status==1){setTimeout(show_ok,500);$('#result'+id).empty();}else{setTimeout(show_error,500);$('#result'+id).html("<p class='text-danger'>"+result.data+"</p>");}}});}
function dell_group(id){NProgress.start();var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&dell_group=1&id="+id,dataType:"json",success:function(result){NProgress.done();if(result.status==1){setTimeout(show_ok,500);$('#result'+id).empty();get_groups();}else{setTimeout(show_error,500);$('#result'+id).html("<p class='text-danger'>"+result.data+"</p>");}}});}
function get_groups(){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&get_groups=1&token="+token,success:function(html){$("#groups").html(html);}});}
function change_group(){NProgress.start();var token=$('#token').val();var group=$('#users_group').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&change_group=1&token="+token+"&group="+group,dataType:"json",success:function(result){if(result.status==1){NProgress.done();setTimeout(show_ok,500);}else{NProgress.done();setTimeout(show_error,500);}}});}
function load_modules(){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&load_modules=1",success:function(html){$("#modules").html(html);}});}
function dell_module(id){if(confirm("Вы действительно хотите удалить модуль?")){NProgress.start();var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&dell_module=1&id="+id,dataType:"json",success:function(result){NProgress.done();if(result.status==1){$("#"+id).fadeOut();NProgress.done();setTimeout(show_ok,500);}else{setTimeout(show_error,500);}}});}}
function on_module(id){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&on_module=1&id="+id,dataType:"json",success:function(result){NProgress.done();if(result.status==1){load_modules();setTimeout(show_ok,500);}else{setTimeout(show_error,500);}}});}
function off_module(id){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&off_module=1&id="+id,dataType:"json",success:function(result){NProgress.done();if(result.status==1){load_modules();setTimeout(show_ok,500);}else{setTimeout(show_error,500);}}});}
function install_module_by_key(){NProgress.start();var token=$('#token').val();var key=$('#module_key').val();key=encodeURIComponent(key);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&install_module_by_key=1&token="+token+"&key="+key,dataType:"json",success:function(result){NProgress.done();if(result.status==1){setTimeout(show_ok,500);load_modules();$("#installing_result").html("<p class='text-success m-0'>"+result.message+"</p>");}else{setTimeout(show_error,500);$("#installing_result").html("<p class='text-danger m-0'>"+result.message+"</p>");}}});}
function get_main_info(){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&get_main_info=1",dataType:"json",success:function(result){$("#version").html(result.version);if(result.message!=""){$("#message").html(result.message);$('#message').fadeIn();}}});}
function get_update_description(){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&get_update_description=1",success:function(html){$("#update_description").html(html);}});}
function get_update(){if(confirm("Вы действительно хотите скачать и установить обновление? Установка займет несколько минут. Обязательно: выставить права 777 на все каталоги и все файлы движка, также рекомендуется предварительно сделать резервную копию проекта")){NProgress.start();var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&get_update=1&token="+token,dataType:"json",success:function(result){if(result.status==1){NProgress.done();setTimeout(show_ok,500);setTimeout(install_update,1000);}else{NProgress.done();setTimeout(show_error,500);alert(result.message);}}});}}
function install_update(){NProgress.start();var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/update_installer.php",data:"phpaction=1&install_update=1&token="+token,dataType:"json",success:function(result){if(result.status==1){NProgress.done();setTimeout(show_ok,500);reset_page();}else{NProgress.done();setTimeout(show_error,500);alert(result.message);}}});}
function add_class(type){NProgress.start();var token=$('#token').val();var class_name=$('#class_name').val();class_name=encodeURIComponent(class_name);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&add_class=1&class_name="+class_name+"&type="+type,dataType:"json",success:function(result){NProgress.done();if(result.status==1){setTimeout(show_ok,500);load_classes(type);}else{setTimeout(show_error,500);if(result.reply!=''&result.reply!=undefined){alert(result.reply);}}}});}
function load_classes(type){var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&load_classes=1&type="+type,dataType:"json",success:function(result){$("#classes").html(result.data);}});}
function dell_class(id,type){if(confirm("Вы уверены? Все элементы данной категории будут удалены!")){NProgress.start();var token=$("#token").val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&dell_class=1&id="+id+"&type="+type,dataType:"json",success:function(result){NProgress.done();if(result.status==1){setTimeout(show_ok,500);$("#"+id).fadeOut();}else{setTimeout(show_error,500);if(result.reply!=''&result.reply!=undefined){alert(result.reply);}}}})}}
function change_class(id,type){NProgress.start();var token=$('#token').val();var class_name=$('#input'+id).val();class_name=encodeURIComponent(class_name);$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&change_class=1&class_name="+class_name+"&id="+id+"&type="+type,dataType:"json",success:function(result){NProgress.done();if(result.status==1){setTimeout(show_ok,500);}else{setTimeout(show_error,500);if(result.reply!=''&result.reply!=undefined){alert(result.reply);}}}});}
function edit_captcha(type){NProgress.start();var token=$('#token').val();var captcha=$('#captcha').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&token="+token+"&edit_captcha=1&captcha="+captcha+"&type="+type,dataType:"json",success:function(result){NProgress.done();if(result.status==1){setTimeout(show_ok,500);}else{setTimeout(show_error,500);show_input_error(result.input,result.reply,null);}}});}
function init_tinymce(id,code,type){if(type=='lite'){plugins="advlist autolink lists link image charmap print  hr  pagebreak insertdatetime media nonbreaking save contextmenu directionality "+"paste textcolor colorpicker textpattern responsivefilemanager";toolbar="undo redo removeformat | bold italic underline strikethrough | alignleft aligncenter alignright alignjustify "+"| fontsizeselect | bullist numlist | outdent indent | link unlink | image media responsivefilemanager | insertdatetime | forecolor backcolor | hr";}
if(type=='full'){plugins="advlist autolink lists link image charmap print preview hr anchor pagebreak searchreplace "+"visualblocks visualchars fullscreen insertdatetime media nonbreaking save table contextmenu "+"directionality paste textcolor colorpicker textpattern codesample spoiler responsivefilemanager";toolbar="undo redo removeformat | bold italic underline strikethrough | alignleft aligncenter alignright alignjustify "+"| fontsizeselect | searchreplace | bullist numlist | outdent indent blockquote | link unlink anchor "+"| image media responsivefilemanager | codesample spoiler-add | insertdatetime | forecolor backcolor "+"| hr | subscript superscript | charmap | fullscreen | ltr rtl";}
if(typeof tinymce!="undefined"){tinymce.init({selector:'#'+id,language:'ru',plugins:[plugins],toolbar1:toolbar,image_advtab:true,menubar:false,toolbar_items_size:'small',external_filemanager_path:"../modules/editors/tinymce/filemanager/",filemanager_title:"Файловый менеджер",external_plugins:{"filemanager":"filemanager/plugin.min.js"},filemanager_access_key:code+'*admin',});}}
function save_forum_settings(id){NProgress.start();var data={}
data['save_forum_settings']='1';var sec_data=$('#forum_settings').serialize();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:create_material(data)+'&'+sec_data,dataType:"json",success:function(result){NProgress.done();if(result.status==1){setTimeout(show_ok,500);}else{setTimeout(show_error,500);if(result.data!=''&result.data!=undefined){show_input_error(result.input,result.data,null);}}}});}
function dell_new(id,type){if(confirm("Вы уверены?")){NProgress.start();var token=$("#token").val();$.ajax({type:"POST",url:"../ajax/actions_c.php",data:"phpaction=1&token="+token+"&dell_new=1&id="+id,dataType:"json",success:function(result){NProgress.done();if(result.status==1){setTimeout(show_ok,500);$("#news #"+id).fadeOut();}else{setTimeout(show_error,500);}}})}}
function server_rcon_log(id,type){type=type||'none';if(type=='get'||type=='dell'){var data={}
data['server_rcon_logs']='1';data['id']=id;data['type']=type;$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:create_material(data),dataType:"json",success:function(result){if(result.status==1){if(type=='get'){$("#server_rcon_log_data"+id).html(result.data);}else{$("#server_rcon_log_data"+id).html('Лог пуст');NProgress.start();NProgress.done();setTimeout(show_ok,500);}}else{setTimeout(show_error,500);if(result.data!=''&result.data!=undefined){alert(result.data);}}}});}else{setTimeout(show_error,500);}}
function switch_widgets_type(type){NProgress.start();var data={}
data['switch_widgets_type']='1';data['type']=type;$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:create_material(data),dataType:"json",success:function(result){NProgress.done();if(result.status==1){setTimeout(show_ok,500);$("#vk_group_selector label:nth-child(1)").removeClass('active');$("#vk_admin_selector label:nth-child(1)").removeClass('active');$("#vk_group_selector label:nth-child(2)").addClass('active');$("#vk_admin_selector label:nth-child(2)").addClass('active');}else{setTimeout(show_error,500);if(result.data!=''&result.data!=undefined){alert(result.data);}}}});}
function switch_widget(type,input){NProgress.start();var data={}
data['switch_widget']='1';data['type']=type;data['input']=input;$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:create_material(data),dataType:"json",success:function(result){NProgress.done();if(result.status==1){setTimeout(show_ok,500);}else{setTimeout(show_error,500);if(result.data!=''&result.data!=undefined){alert(result.data);}}}});}
function edit_protect(type){NProgress.start();var token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&edit_protect=1&token="+token+"&type="+type,dataType:"json",success:function(result){NProgress.done();if(result.status==1){setTimeout(show_ok,500);}else{if(result.status==2){setTimeout(show_error,500);if(result.info!=''||result.info!=undefined){alert(result.info);}}}}});}
function admin_change_prefix(id){NProgress.start();var prefix=$('#user_prefix').val();change_value2("users","prefix",prefix,id);NProgress.done();setTimeout(show_ok,500);}
function onQiwiPaymentSystem(){var data={};data['onQiwiPaymentSystem']='1';$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:create_material(data),success:function(html){$("#edit_qiwi_result").html(html);}});}
function editQiwiPaymentSystem(){var data={};data['editQiwiPaymentSystem']='1';data['qw_pass']=$('#qw_pass').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:create_material(data),success:function(html){$("#edit_qiwi_result").html(html);}});}
function editLiqPayPaymentSystem(){let data={};data['editLiqPayPaymentSystem']='1';data['lp_public_key']=$('#lp_public_key').val();data['lp_private_key']=$('#lp_private_key').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:create_material(data),success:function(html){$("#edit_liqpay_result").html(html);}});}
function editAnyPayPaymentSystem(){let data={};data['editAnyPayPaymentSystem']='1';data['ap_project_id']=$('#ap_project_id').val();data['ap_private_key']=$('#ap_private_key').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:create_material(data),success:function(html){$("#edit_anypay_result").html(html);}});}
function addForbiddenWordInput(){let i=$('#forbidden-words-list>.input-group:last>input').attr('name');if(i!==undefined){i=i.replace('forbidden-word','');}else{i=-1;}
	i++;$('#forbidden-words-list').append('<div class="input-group" id="input-forbidden-word-'+i+'"><span class="input-group-btn"><button class="btn btn-default" type="button" onclick="dellForbiddenWordInput('+i+');">Удалить</button></span><input type="text" name="forbidden-word'+i+'" maxlength="100" placeholder="Введите слово" class="form-control"></div>');}
function dellForbiddenWordInput(i){$('#input-forbidden-word-'+i).detach();}
function saveForbiddenWords(){NProgress.start();let token=$('#token').val();let data=$('#forbidden-words-list').serialize();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&saveForbiddenWords=1&token="+token+"&"+data,dataType:"json",success:function(result){NProgress.done();if(result.status==1){setTimeout(show_ok,500);}else{setTimeout(show_error,500);}}});}
function loadForbiddenWords(){let token=$('#token').val();$.ajax({type:"POST",url:"../ajax/actions_panel.php",data:"phpaction=1&loadForbiddenWords=1&token="+token,success:function(html){$("#forbidden-words-list").html(html);}});}
function addCategoryPoints() {NProgress.start();var name = $('#categoryName').val();var code = $('#categoryCode').val();$.ajax({type: "POST",url: "../ajax/actions_d.php",data: "phpaction=1&add_category_points=1&name=" + name + "&code=" + code,dataType: "json",success: function (result) {NProgress.done();if (result.status == 1) {var toast = new Toasty({classname: "toast", transition: "fade", insertBefore: false, progressBar: true, enableSounds: true});toast.info(result.message);setTimeout(function() {window.location.href = "/admin/points";}, 1000);} else {var toast = new Toasty({classname: "toast", transition: "fade", insertBefore: false, progressBar: true, enableSounds: true});toast.error(result.message);}}});}
function delPoints(index) {$.ajax({type: "POST",url: "../ajax/actions_d.php",data: "phpaction=1&del_point=1&index=" + index,dataType: "json",success: function (result) {NProgress.done();if (result.status == 1) {var toast = new Toasty({classname: "toast", transition: "fade", insertBefore: false, progressBar: true, enableSounds: true});toast.info(result.message);setTimeout(function() {window.location.href = "/admin/points";}, 1000);}else {var toast = new Toasty({classname: "toast", transition: "fade", insertBefore: false, progressBar: true, enableSounds: true});toast.error(result.message);}}});}
function delCategoryPoints() {NProgress.start();var category = $('#delIndexCategory').val();$.ajax({type: "POST",url: "../ajax/actions_d.php",data: "phpaction=1&del_category_points=1&index=" + category,dataType: "json",success: function (result) {NProgress.done();if (result.status == 1) {var toast = new Toasty({classname: "toast", transition: "fade", insertBefore: false, progressBar: true, enableSounds: true});toast.info(result.message);setTimeout(function() {window.location.href = "/admin/points";}, 1000);}else {var toast = new Toasty({classname: "toast", transition: "fade", insertBefore: false, progressBar: true, enableSounds: true});toast.error(result.message);}}});}
function addProductPoints() {NProgress.start();var image = $('#filePoints').prop('files')[0];var form_data = new FormData();form_data.append('file', image);$.ajax({url: '../ajax/actions_d.php?uploadImage=1&uip=1',dataType: 'json',cache: false,contentType: false,processData: false,data: form_data,type: 'POST',success: function (result) {NProgress.done();if (result.status == 1) {NProgress.start();var name = $('#prodName').val();var category = $('#prodCategory').val();var price = $('#prodPrice').val();$.ajax({type: "POST",url: "../ajax/actions_d.php",data: "phpaction=1&add_product_points=1&name=" + name + "&category=" + category + "&price=" + price + "&file=" + result.filename,dataType: "json",success: function (result) {NProgress.done();if (result.status == 1) {var toast = new Toasty({classname: "toast", transition: "fade", insertBefore: false, progressBar: true, enableSounds: true});toast.info(result.message);setTimeout(function() {window.location.href = "/admin/points";}, 1000);}else {var toast = new Toasty({classname: "toast", transition: "fade", insertBefore: false, progressBar: true, enableSounds: true});toast.error(result.message);}}});}else {var toast = new Toasty({classname: "toast", transition: "fade", insertBefore: false, progressBar: true, enableSounds: true});toast.error(result.message);}}});}
function enable_verification(index, enable, user_id) {$.ajax({type: "POST",url: "../ajax/actions_panel.php",data: "phpaction=1&verification=1&index=" + index + "&enable=" + enable + "&user_id=" + user_id,dataType: "json",success: function (result) {NProgress.done();if (result.status == 1) {var toast = new Toasty({classname: "toast", transition: "fade", insertBefore: false, progressBar: true, enableSounds: true});toast.info(result.message);}else {var toast = new Toasty({classname: "toast", transition: "fade", insertBefore: false, progressBar: true, enableSounds: true});toast.error(result.message);}$("#list_verifications").html(result.body);}});}
function cBonusGive() {NProgress.start();var c_id = $('#cBonusUser').val();var c_value = $('#cBonusValue').val();$.ajax({type: "POST",url: "../ajax/actions_panel.php",data: "phpaction=1&give_bonus=1&user_id=" + c_id + "&value=" + c_value,dataType: "json",success: function (result) {NProgress.done();if (result.status == 1) {var toast = new Toasty({classname: "toast", transition: "fade", insertBefore: false, progressBar: true, enableSounds: true});toast.info(result.message);}else {var toast = new Toasty({classname: "toast", transition: "fade", insertBefore: false, progressBar: true, enableSounds: true});toast.error(result.message);}}});}
function edit_verification_time() {NProgress.start();var timeleft = $('#time_verification').val();$.ajax({type: "POST",url: "../ajax/actions_panel.php",data: "phpaction=1&edit_verification_time=1&timeleft=" + timeleft,dataType: "json",success: function (result) {NProgress.done();if (result.status == 1) {var toast = new Toasty({classname: "toast", transition: "fade", insertBefore: false, progressBar: true, enableSounds: true});toast.info(result.message);}else {var toast = new Toasty({classname: "toast", transition: "fade", insertBefore: false, progressBar: true, enableSounds: true});toast.error(result.message);}}});}
function edit_verification_img() {NProgress.start();var url_image = $('#url_image').val();$.ajax({type: "POST",url: "../ajax/actions_panel.php",data: "phpaction=1&edit_verification_img=1&url_image=" + url_image,dataType: "json",success: function (result) {NProgress.done();if (result.status == 1) {var toast = new Toasty({classname: "toast", transition: "fade", insertBefore: false, progressBar: true, enableSounds: true});toast.info(result.message);}else {var toast = new Toasty({classname: "toast", transition: "fade", insertBefore: false, progressBar: true, enableSounds: true});toast.error(result.message);}}});}