var chat_enabled=false,chat_started=false,chat_data_last="",chat_update_started=false,chat_youtube_started=false,chat_visible=false,chat_load_visible=false,youtube_playing=false,timer_chat_show=1000,timer_chat_show_id="",timer_chat_resize=100,timer_chat_resize_id="",timer_youtube_getid=300000,timer_youtube_getid_id="",timer_chat_update=60000,timer_chat_update_id="",timer_chat_warning=500,timer_chat_warning_id="",vibro_count=0,timer_chat_button_send_id="",chat_lastid=0,chat_first=1,chat_user="",chat_scroll=true,chat_scroll_auto=false,chat_values={};function chat_resize(){var $chat=$('#chat');if($chat.length==0)return false;var $chat_view=$chat.find('.chat-frame-chat-view'),$chat_message=$chat.find('#chat-message');if(chat_visible)$chat_view.hide().css('min-width','').css('max-width','');if(chat_visible)$chat_message.hide().css('max-width','');var chat_with_object_view=(typeof object_view_visible!=='undefined'&&object_view_visible)?200:0,width=Math.floor(($(window).innerWidth()-web_width)/2),height=$(window).innerHeight()-$('#topline').outerHeight()-chat_with_object_view;width=minmax(350,width,500);height=minimum(400,height);$chat.attr('chat-width',width).height(height);if(chat_visible)$chat.width(width);var content_width=width-$chat.find('.chat-button-side').outerWidth()-8,content_height=$chat.find('.chat-content').outerHeight(),$youtube_video=$chat.find('.chat-youtube-video'),$youtube_video_iframe=$chat.find('.chat-youtube-video iframe'),youtube_video_height=Math.floor(content_width*9/16),$chat_load=$chat.find('.chat-load'),$chat_content=$chat.find('.chat-content'),$chat_frame=$chat.find('.chat-frame-chat'),$chat_form=$chat.find('.chat-frame-chat-form');$youtube_video.css('display',((youtube_id!='')?'block':'none'));$youtube_video_iframe.height(youtube_video_height);$chat_load.css('left',width/2-$chat_load.outerWidth()/2+32).css('top',content_height/2-$chat_load.height()/2);$chat_content.css('min-width',(chat_visible)?content_width+8:0);$chat_form.css('max-height',$chat_frame.innerHeight());$chat_view.css('max-height',$chat_frame.innerHeight()).css('min-width',$chat_frame.width()).css('max-width',$chat_frame.width()).show();if(chat_visible)$chat_message.css('max-width',$('.chat-frame-input-td').width()-18).css('max-height',$chat_frame.innerHeight()/2).show();chat_scroll_bottom()}function chat_scroll_freeze(){if(typeof scroll_freeze==='function')scroll_freeze()}function chat_scroll_unfreeze(){if(typeof scroll_unfreeze==='function')scroll_unfreeze()}function chat_load(show){if(chat_load_visible==show)return false;var $chat=$('#chat');if($chat.length==0)return false;chat_load_visible=show;if(show)$chat.find('.chat-load').show();else $chat.find('.chat-load').fadeOut(200)}function chat_click(){var $chat=$('#chat');if($chat.length==0)return false;if(chat_visible)chat_hide(true);else chat_show()}function chat_show(){var $chat=$('#chat');if($chat.length==0)return false;if(!chat_visible){chat_load(true);chat_warning_stop();chat_visible=true;$chat.animate({'width':$chat.attr('chat-width')},500,'easeOutBounce',function(){$(this).find('.chat-close').show();$(this).find('.chat-youtube-title-text').css('visibility','visible').css('margin-left',(($(this).find('.chat-youtube-subs').length>0)?'-138px':''));youtube_play(true)});if(web_city!='')setCookie('chat-show','1',1,'/',domain);if(web_city!=''&&chat_lastid>0)setCookie('chat-lastid',chat_lastid.toString(),7,'/',domain)}youtube_online()}function chat_hide(savecookie){var $chat=$('#chat');if($chat.length==0)return false;if(chat_visible){chat_visible=false;$chat.find('.chat-close,.chat-youtube-subs').hide();$chat.find('.chat-youtube-title-text').css('visibility','hidden');$chat.animate({'width':$('.chat-button-side').outerWidth()},500,'easeOutBounce',function(){youtube_play(false);chat_form_close()});if(web_city!=''&&savecookie)setCookie('chat-show','0',1,'/',domain)}youtube_online()}function chat_get_cookies(){chat_lastid=getCookie('chat-lastid');if(chat_lastid==undefined)chat_lastid=0;}function chat_start(){if(!chat_enabled)return false;var $chat=$('#chat');if($chat.length==0)return false;if(!chat_started){chat_started=true;if(web_banned){$chat.hide();return false;}chat_get_cookies();$chat.find('.chat-button-side').click(function(){chat_click()});if($('body').css('overflow-y')=='overlay'){$chat.width(50).find('.chat-button-side').width(50);$chat.find('.chat-button-text').css('margin-top','85px');$chat.find('.chat-frame').css('padding-right','16px');$chat.find('.chat-close').css('right','18px')}$chat.find('.chat-close').click(function(){chat_hide(true)});$chat.fadeIn(500,function(){chat_resize();if(!web_mainpage&&!web_demopage&&!web_banned&&!is_mobile&&getCookie('chat-show')!='0'&&$(window).outerWidth()>web_width+100)timer_chat_show_id=setTimeout(chat_show,timer_chat_show)})}if(!chat_youtube_started)timer_youtube_getid_id=setTimeout(youtube_getid,2000);if(!chat_update_started)timer_chat_update_id=setTimeout(chat_update,2100)}function youtube_getid(){chat_youtube_started=true;clearTimeout(timer_youtube_getid_id);if(!document_active()&&youtube_id!=""){timer_youtube_getid_id=setTimeout(youtube_getid,2000);return false;}if(youtube_id!='')return false;$.post(ajax_url,{version:web_version,page:'chat',unit:'youtube'}).done(function(data){if(data==site403)return console.log(data);if(data.substring(0,8)=="