function init_menu()
{var data=parse_url();var page=data['page'];$(".menu a").removeClass("active");$(".menu_acc a").removeClass("active");$(".menu_admin a").removeClass("active");$(".menu").find("[href='/"+page+"']").addClass("active");$(".menu_acc").find("[href='/"+page+"']").addClass("active");$(".menu_admin").find("[href='/"+page+"']").addClass("active");};function popup_open(set_popup)
{$('#'+set_popup).slideDown('slow');};function popup_close(set_popup)
{$('#'+set_popup).slideUp('slow');};function popup_open2(set_popup)
{$('#'+set_popup).addClass('active').next().addClass('active');};function popup_close2(set_popup)
{$('#'+set_popup).removeClass('active').next().removeClass('active');};function smsg_open()
{$('.system_msg').addClass('active');};function smsg_close()
{$('.system_msg').removeClass('active');};$(document).ready(function(){init_menu();$('body').on('click',".switch",function(e){var i=+$(this).index();var id=$(this).attr('data-sw');$(this).parent().find('[data-sw='+id+']').removeClass('active');$(this).addClass('active');$('[data-swb='+id+']').hide();$('[data-swb='+id+']:eq('+i+')').show();});$('body').on('click',".popup .close",function(e){$(this).parent().removeClass('active').prev().removeClass('active');});$('body').on('click',".bgpopup",function(e){$(this).removeClass('active').next().removeClass('active');});if($('.scroll_left').length){$(".scroll_left").mCustomScrollbar({theme:"dark-thin"});}
$(".answer_captcha").click(function()
{var v=$(this).text();$(".captcha_val").val(v);$(this).parent().parent().submit();});$(".captcha_img").click(function(event)
{$(this).attr("src",$(this).attr("src")+"&"+Math.random());});$(".ads_insert").click(function()
{var id=$(this).attr("data-id");$(".id_ads").val(id);popup_open2('form_in_serf');});$(".ads_edit").click(function()
{var id=$(this).attr("data-id");$(".id_ads").val(id);$(".ads_title").val($(".ads_"+id+"_title").val());$(".ads_url").val($(".ads_"+id+"_url").val());popup_open2('form_edit_serf');});$(".ads_delete").click(function()
{var id=$(this).attr("data-id");call_ajax({"module":"Ads","action":"delete","id":id});});$(".ads_start_stop").click(function()
{var id=$(this).attr("data-id");call_ajax({"module":"Ads","action":"stop_start","id":id});});if($(".mcd").length>0)
start_main_timer();});function call_stop_start(data)
{$('.status_'+data.status2+'_'+data.id).removeClass('hidden').hide();$('.status_'+data.status1+'_'+data.id).removeClass('hidden').show();}
function call_ads_insert(data)
{$(".ads_"+data.id+"_money").text(data.money);$(".ads_"+data.id+"_cnt_real").text(data.cnt);popup_close2('form_in_serf');}
function call_edit(data)
{$(".ads_"+data.id+"_title").val(data.title);$(".ads_"+data.id+"_title2").text(data.title);$(".ads_"+data.id+"_url").val(data.urlt);popup_close2('form_edit_serf');}
function call_delete(data)
{$('.ads_id[data-id='+data.id+']').hide();}
function update_tarif()
{$(".tarif_price").text((tarif.price*tarif_val).toFixed(4));$(".tarif_per_h").text((tarif.per_h*tarif_val).toFixed(4));$(".tarif_per_w").text((tarif.per_w*tarif_val).toFixed(4));$(".tarif_per_m").text((tarif.per_m*tarif_val).toFixed(4));}
function anim_humans()
{$(".main_hum2").removeClass("test_anim_start");$(".main_hum1").removeClass("test_anim_rev");$(".main_hum2").removeClass("test_anim2_rev");$(".main_hum1").addClass("test_anim");$(".main_hum2").addClass("test_anim2");}
function anim_humans_rev()
{$(".main_hum1").removeClass("test_anim");$(".main_hum2").removeClass("test_anim2");$(".main_hum1").addClass("test_anim_rev");$(".main_hum2").addClass("test_anim2_rev");}
function main_timer_tick()
{setTimeout(function(){main_timer_tick();},1000);c_real_time+=1;var t=m_to_time(c_real_time);$(".mcd").text(t[3]);$(".mch").text(t[2]);$(".mcm").text(t[1]);$(".mcs").text(t[0]);}
function start_main_timer()
{c_real_time-=c_start_time;main_timer_tick();}