Your IP : 3.135.194.165
(function(t){if(t.BX.MessengerWindow)return;var e=t.BX;var s=function(){this.popupConfirm=null;this.BXIM={};this.popup=null;this.backgroundSelector=null;this.content=null;this.contentFullWindow=true;this.contentBodyWindow=false;this.contentMenu=null;this.contentAvatar=null;this.contentTab=null;this.contentTabContent=null;this.currentTab="";this.currentTabTarget="";this.lastTab="";this.lastTabTarget="";this.tabItems={};this.tabRedrawTimeout=null;this.userInfo={id:0,name:"",gender:"M",avatar:"",profile:""};this.inited=false;this.width=914;this.height=454;this.initWidth=914;this.initHeight=454;this.minWidth=515;this.minHeight=384};s.prototype.init=function(s){s=s||{};if(this.inited){return true}this.inited=true;this.BXIM=s.bxim||{};this.context=s.context||"DESKTOP";this.design=s.design||"DESKTOP";if(this.context=="FULLSCREEN"||this.context=="POPUP-FULLSCREEN"||this.context=="PAGE"||this.context=="DIALOG"||this.context=="LINES"){if(this.context=="FULLSCREEN"||this.context=="PAGE"||this.context=="POPUP-FULLSCREEN"){this.contentBodyWindow=true}this.popup=e("im-workarea-popup");this.popupBackground=this.popup;this.content=e("im-workarea-content");this.apps=e("im-workarea-apps");this.backgroundSelector=e("im-workarea-backgound-selector");if(!this.content){this.popup=e("workarea-popup");this.content=e("workarea-content")}if(this.popup){e.addClass(this.popup,"bx-im-fullscreen-closed");e.bind(this.popup,"click",e.delegate(this.closePopup,this))}else{this.popupBackground=e("im-workarea-popup-bg")}if(this.context=="PAGE"){var i=t.innerWidth-document.documentElement.clientWidth;e.onCustomEvent(t,"onMessengerWindowBodyOverflow",[this,i]);e.addClass(document.body,"bx-im-fullscreen-block-scroll")}if(this.backgroundSelector){e.bind(this.backgroundSelector.parentNode,"click",e.delegate(e.PreventDefault,this));e.bind(this.backgroundSelector,"change",e.delegate(function(t){this.backgroundChange();e.localStorage.set("imFullscreenBackground",this.backgroundSelector.value,3e6);return e.PreventDefault(t)},this));var n=e.localStorage.get("imFullscreenBackground");if(n!==null){this.backgroundSelector.value=n}this.backgroundChange()}if(!this.content){this.content=e.create("div",{attrs:{className:"bx-desktop"}});document.body.insertBefore(this.content,document.body.firstChild)}if(this.apps){e.bind(this.apps,"click",e.delegate(e.MessengerCommon.preventDefault,this))}e.bind(this.content,"click",e.delegate(e.MessengerCommon.preventDefault,this));if(!e.hasClass(this.content,"bx-desktop")){e.addClass(this.content,"bx-desktop")}if(this.context=="LINES"||this.context=="DIALOG"){this.contentFullWindow=false}else if(this.context!="POPUP-FULLSCREEN"){if(this.content.offsetWidth<this.minWidth){e.style(this.content,"width",this.minWidth+"px")}}}else{this.content=e.create("div");document.body.insertBefore(this.content,document.body.firstChild)}if(e.desktop&&e.desktop.apiReady&&!e.desktop.enableInVersion(29)){e.PULL.tryConnectSet(null,false);e.desktop.notSupported();e.desktop.apiReady=false;e.desktop.disableLogin=true;return false}if(e.browser.SupportLocalStorage()){e.addCustomEvent(t,"onLocalStorageSet",e.delegate(this.storageSet,this))}if(e.MessengerCommon.isDesktop()){e.MessengerWindow.addTab({id:"exit",title:e.message("BXD_LOGOUT"),order:1100,target:false,events:{open:e.delegate(function(){this.logout(false,"exit_tab")},this)}})}e.bind(t,"resize",e.delegate(function(){this.adjustSize()},this))};s.prototype.browse=function(s){if(e.MessengerCommon.isDesktop()){e.desktop.browse(s)}else if(this.context=="POPUP-FULLSCREEN"){location.href=s}else{t.open(s,"_blank")}};s.prototype.getCurrentUrl=function(){return document.location.protocol+"//"+document.location.hostname+(document.location.port==""?"":":"+document.location.port)};s.prototype.windowReload=function(){location.reload()};s.prototype.logout=function(t,s,i){if(typeof BXDesktopSystem=="undefined"||typeof BXDesktopWindow=="undefined"){location.href="/?logout=yes";return true}if(e.desktop&&e.desktop.apiReady){e.desktop.logout(t,s,i)}return true};s.prototype.adjustSize=function(s,i){if(this.context=="POPUP-FULLSCREEN"&&e.hasClass(this.popup,"bx-im-fullscreen-closed")){return false}var n=0;var o=0;var a=false;if(this.contentBodyWindow){if(!this.popupFullscreenSizeTop&&!this.popupFullscreenSizeBottom){var r=e.pos(e.MessengerWindow.content.parentNode);this.popupFullscreenSizeTop=r.top;this.popupFullscreenSizeBottom=t.innerHeight-r.top-r.height}o=Math.max(t.innerHeight-this.popupFullscreenSizeTop-this.popupFullscreenSizeBottom,this.initHeight);n=e.MessengerWindow.content.offsetWidth}else if(this.contentFullWindow){n=t.innerWidth;o=t.innerHeight}else{try{e.style(document.body,"height",t.innerHeight+"px")}catch(t){setTimeout(function(){e.MessengerWindow.adjustSize(s,i)},500)}n=Math.max(this.content.offsetWidth,this.minWidth);o=Math.max(this.content.offsetHeight,this.minHeight)}if(e.desktop&&e.desktop.apiReady&&(!s||!i)&&(o<this.minHeight||n<this.minWidth)){BXDesktopWindow.SetProperty("clientSize",{Width:this.width,Height:this.height});return false}if(this.context=="POPUP-FULLSCREEN"&&e.browser.IsMobile()){this.height=this.initHeight;this.width=this.initWidth}else{e.addClass(this.content,"bx-im-fullscreen-adaptive");this.width=s?s:n;this.height=i?i:o}e.style(this.contentMenu,"height",this.height+"px");e.style(this.contentTabContent,"height",this.height+"px");e.style(this.content,"max-width",t.innerWidth+"px");return true};s.prototype.openConfirm=function(t,s,i){if(this.popupConfirm!=null)this.popupConfirm.destroy();if(typeof t=="object")t='<div class="bx-desktop-confirm-title">'+t.title+"</div>"+t.message;i=i!==false;if(typeof s=="undefined"||typeof s=="object"&&s.length<=0){s=[new e.PopupWindowButton({text:e.message("BXD_CONFIRM_CLOSE"),className:"popup-window-button-decline",events:{click:function(t){this.popupWindow.close();e.PreventDefault(t)}}})]}this.popupConfirm=new e.PopupWindow("bx-desktop-confirm",null,{zIndex:200,autoHide:s===false,buttons:s,closeByEsc:s===false,overlay:i,events:{onPopupClose:function(){this.destroy()},onPopupDestroy:e.delegate(function(){this.popupConfirm=null},this)},content:e.create("div",{props:{className:s===false?" bx-desktop-confirm-without-buttons":"bx-desktop-confirm"},html:t})});this.popupConfirm.show();e.bind(this.popupConfirm.popupContainer,"click",e.PreventDefault);e.bind(this.popupConfirm.contentContainer,"click",e.PreventDefault);e.bind(this.popupConfirm.overlay.element,"click",e.PreventDefault);return true};s.prototype.addSeparator=function(t){t.type="separator";t.id="sep"+ +new Date;this.tabItems[t.id]=t;this.drawTabs()};s.prototype.addTab=function(t){if(!t||!t.id||!t.title)return false;if(!t.order)t.order=500;t.hide=t.hide?true:false;if(parseInt(t.badge)>0){t.badge=parseInt(t.badge)}else{t.badge=0}if(!t.initContent||!e.type.isDomNode(t.initContent))t.initContent=null;if(!t.events)t.events={};if(typeof t.target=="undefined")t.target=t.id;if(!t.events.open)t.events.open=function(){};if(!t.events.close)t.events.close=function(){};if(!t.events.init)t.events.init=function(){};t.type="item";this.tabItems[t.id]=t;this.drawTabs()};s.prototype.hideTab=function(t){if(!t||!this.tabItems[t])return false;this.tabItems[t].hide=true;this.drawTabs()};s.prototype.showTab=function(t){if(!t||!this.tabItems[t])return false;this.tabItems[t].hide=false;this.drawTabs()};s.prototype.existsTab=function(t){return this.tabItems[t]};s.prototype.drawTabs=function(t){if(!t){clearTimeout(this.tabRedrawTimeout);this.tabRedrawTimeout=setTimeout(e.delegate(function(){this.drawTabs(true)},this),100);return true}if(!this.contentTabContent){if(!this.drawAppearance())return false}this.contentTab.innerHTML="";var s=e.util.objectSort(this.tabItems,"order","asc");for(var i=0;i<s.length;i++){this.drawTab(s[i])}e.onCustomEvent(this,"OnDesktopTabsInit");if(this.currentTab==""){if(s[0].id=="exit"){if(typeof s[1]!="undefined"){this.changeTab(s[1].id)}}else{this.changeTab(s[0].id)}}if(e.desktop&&e.desktop.apiReady){e.desktop.updateTabBadge()}return true};s.prototype.drawTab=function(t){if(t.type=="separator"){this.contentTab.appendChild(e.create("div",{attrs:{"data-id":t.id,id:"bx-desktop-sep-"+t.id},props:{className:"bx-desktop-separator"}}))}else{this.contentTab.appendChild(e.create("div",{attrs:{"data-id":t.id,id:"bx-desktop-tab-"+t.id,title:t.title},props:{className:"bx-desktop-tab bx-desktop-tab-"+t.id+(this.currentTab==t.id?" bx-desktop-tab-active":"")+(t.hide?" bx-desktop-tab-hide":"")},children:[e.create("span",{props:{className:"bx-desktop-tab-counter"},html:t.badge>0?'<span class="bx-desktop-tab-counter-digit">'+(t.badge>50?"50+":t.badge)+"</span>":""}),e.create("div",{props:{className:"bx-desktop-tab-icon bx-desktop-tab-icon-"+t.id}})]}));if(!e("bx-desktop-tab-content-"+t.id)&&t.id==t.target){var s=false;if(this.currentTab==t.id||this.tabItems[this.currentTab]&&this.tabItems[this.currentTab].target==t.id){s=true}this.contentTabContent.appendChild(e.create("div",{attrs:{"data-id":t.id,id:"bx-desktop-tab-content-"+t.id},props:{className:"bx-desktop-tab-content bx-desktop-tab-content-"+t.id+(s?" bx-desktop-tab-content-active":"")},children:t.initContent?[t.initContent]:[]}));t.events.init()}}return true};s.prototype.drawAppearance=function(){if(!this.content)return false;this.content.innerHTML="";this.content.appendChild(this.contentBox=e.create("div",{props:{className:"bx-desktop-appearance"},style:{minHeight:this.minHeight+"px"},children:[this.contentMenu=e.create("div",{props:{className:"bx-desktop-appearance-menu"},children:[this.contentAvatar=e.create("div",{props:{className:"bx-desktop-appearance-avatar"}}),this.contentTab=e.create("div",{props:{className:"bx-desktop-appearance-tab"}})]}),this.contentTabContent=e.create("div",{props:{className:"bx-desktop-appearance-content"}})]}));e.bindDelegate(this.contentTab,"click",{className:"bx-desktop-tab"},e.delegate(function(t){this.changeTab(t,false);e.PreventDefault(t)},this));this.adjustSize();e.onCustomEvent(t,"onMessengerWindowInit",[this,this.BXIM]);return true};s.prototype.changeTab=function(t,s,i){s=typeof s=="undefined"?true:s;i=typeof i=="undefined"?false:i;if(typeof t=="object"){if(!e.proxy_context){return false}t=e.proxy_context.getAttribute("data-id")}if(!this.tabItems[t])return false;if(this.tabItems[t].target){var n=false;if(!s||this.currentTab!=t){this.lastTab=this.currentTab;this.lastTabTarget=this.currentTabTarget;this.currentTab=this.tabItems[t].id;this.currentTabTarget=this.tabItems[t].target;n=true}if(e("bx-desktop-tab-"+this.lastTab))e.removeClass(e("bx-desktop-tab-"+this.lastTab),"bx-desktop-tab-active");if(e("bx-desktop-tab-"+t))e.addClass(e("bx-desktop-tab-"+t),"bx-desktop-tab-active");if(e("bx-desktop-tab-content-"+this.lastTab)){e.removeClass(e("bx-desktop-tab-content-"+this.lastTab),"bx-desktop-tab-content-active")}else if(e("bx-desktop-tab-content-"+this.lastTabTarget)){e.removeClass(e("bx-desktop-tab-content-"+this.lastTabTarget),"bx-desktop-tab-content-active")}if(e("bx-desktop-tab-content-"+this.currentTab)){e.addClass(e("bx-desktop-tab-content-"+this.currentTab),"bx-desktop-tab-content-active")}else if(e("bx-desktop-tab-content-"+this.currentTabTarget)){e.addClass(e("bx-desktop-tab-content-"+this.currentTabTarget),"bx-desktop-tab-content-active")}if(n&&!i){if(this.tabItems[this.lastTab]){this.tabItems[this.lastTab].events.close()}if(this.tabItems[this.currentTab]){e.onCustomEvent(this,"OnDesktopTabChange",[this.currentTab,this.lastTab]);this.tabItems[this.currentTab].events.open()}}}else if(!i){this.tabItems[t].events.open()}return true};s.prototype.closeTab=function(t){t=t||this.getCurrentTab();if(!this.tabItems[t]||this.getCurrentTab()!=t)return false;if(this.tabItems[t].target!=this.currentTabTarget){this.changeTab(t,false)}else{if(e("bx-desktop-tab-"+this.currentTab))e.removeClass(e("bx-desktop-tab-"+this.currentTab),"bx-desktop-tab-active");if(e("bx-desktop-tab-"+this.lastTab))e.addClass(e("bx-desktop-tab-"+this.lastTab),"bx-desktop-tab-active");var s=this.lastTab;this.lastTab=this.currentTab;this.currentTab=s}};s.prototype.setTabBadge=function(t,s){if(!this.tabItems[t])return false;s=parseInt(s);this.tabItems[t].badge=s>0?s:0;if(s>50)s="50+";if(e("bx-desktop-tab-"+t)){var i=e.findChild(e("bx-desktop-tab-"+t),{className:"bx-desktop-tab-counter"},true);if(i)i.innerHTML=s?'<span class="bx-desktop-tab-counter-digit">'+s+"</span>":""}if(e.desktop&&e.desktop.apiReady){e.desktop.updateTabBadge()}};s.prototype.setTabContent=function(t,s){if(!this.tabItems[t])return false;if(e("bx-desktop-tab-content-"+t)){if(e.type.isDomNode(s)){e("bx-desktop-tab-content-"+t).innerHTML="";e("bx-desktop-tab-content-"+t).appendChild(s)}else{e("bx-desktop-tab-content-"+t).innerHTML=s}}else{this.tabItems[t].initContent=s}return true};s.prototype.getCurrentTab=function(){return this.currentTab};s.prototype.getCurrentTabTarget=function(){return this.currentTabTarget};s.prototype.setUserInfo=function(t){if(!this.userInfo){if(!t||!t.id||!t.name)return false}if(t){if(!t.gender)t.gender="M";if(!t.avatar||!t.profile)t.avatar="";this.userInfo=t}if(!this.contentAvatar){if(!this.drawAppearance())return false}var s={};s.click=function(t){BXIM.openMessenger(BXIM.userId);return e.PreventDefault(t)};this.contentAvatar.innerHTML="";this.contentAvatar.appendChild(e.create("a",{attrs:{href:this.userInfo.profile,title:e.util.htmlspecialcharsback(this.userInfo.name),target:"_blank"},props:{className:"bx-desktop-avatar"},events:s,children:[e.create("img",{attrs:{src:this.userInfo.avatar,style:e.MessengerCommon.isBlankAvatar(this.userInfo.avatar)?"background-color: "+this.userInfo.color:""},props:{className:"bx-desktop-avatar-img bx-desktop-avatar-img-default"}})]}));return true};s.prototype.updateUserInfo=function(t){for(var e in t){this.userInfo[e]=t[e]}return this.setUserInfo(this.userInfo)};s.prototype.getUserInfo=function(){return this.userInfo};s.prototype.isPopupShow=function(){if(this.context=="DESKTOP")return true;else if(this.context=="POPUP-FULLSCREEN"&&!e.hasClass(this.popup,"bx-im-fullscreen-closed"))return true;return false};s.prototype.backgroundChange=function(){var t=this.backgroundSelector.value;if(t=="transparent"){e.removeClass(this.popupBackground,"bx-im-fullscreen-popup-bitrix24");e.addClass(this.popupBackground,"bx-im-fullscreen-popup-transparent");e.style(this.popupBackground,"background","");e.style(this.popupBackground,"backgroundSize","")}else if(t>0){e.removeClass(this.popupBackground,"bx-im-fullscreen-popup-bitrix24");e.removeClass(this.popupBackground,"bx-im-fullscreen-popup-transparent");e.style(this.popupBackground,"background","url(/bitrix/js/im/images/bg-image-"+t+".jpg) #ccc");e.style(this.popupBackground,"backgroundSize","cover")}else{e.removeClass(this.popupBackground,"bx-im-fullscreen-popup-transparent");e.addClass(this.popupBackground,"bx-im-fullscreen-popup-bitrix24");e.style(this.popupBackground,"background","");e.style(this.popupBackground,"backgroundSize","")}};s.prototype.showPopup=function(s){if(this.isPopupShow())return false;this.popupTimestart=+new Date;clearTimeout(this.popupTimeout);var i=t.innerWidth-document.documentElement.clientWidth;e.onCustomEvent(t,"onMessengerWindowBodyOverflow",[this,i]);e.addClass(document.body,"bx-im-fullscreen-block-scroll");e.addClass(this.popup,"bx-im-fullscreen-opening");e.removeClass(this.popup,"bx-im-fullscreen-closing");e.removeClass(this.popup,"bx-im-fullscreen-closed");this.adjustSize();this.BXIM.desktop.initHeight=e.MessengerWindow.content.offsetHeight;this.popupTimeout=setTimeout(e.delegate(function(){e.removeClass(this.popup,"bx-im-fullscreen-opening");e.addClass(this.popup,"bx-im-fullscreen-open");if(this.BXIM.webrtc.callOverlay){e.style(this.BXIM.webrtc.callOverlay,"height",this.BXIM.messenger.popupMessengerFullHeight-1+"px")}},this),400);e.onCustomEvent(this,"OnMessengerWindowShowPopup",[s]);return true};s.prototype.closePopup=function(){if(!this.isPopupShow()||this.BXIM.webrtc.callInit)return false;if(this.popupTimestart+400>+new Date)return false;clearTimeout(this.popupTimeout);e.removeClass(document.body,"bx-im-fullscreen-block-scroll");e.onCustomEvent(this,"OnMessengerWindowClosePopup",[]);e.onCustomEvent(t,"onMessengerWindowBodyOverflow",[this,0]);e.addClass(this.popup,"bx-im-fullscreen-open");e.addClass(this.popup,"bx-im-fullscreen-closing");e.removeClass(this.popup,"bx-im-fullscreen-opening");this.popupTimeout=setTimeout(e.delegate(function(){e.removeClass(this.popup,"bx-im-fullscreen-closing");e.removeClass(this.popup,"bx-im-fullscreen-open");e.addClass(this.popup,"bx-im-fullscreen-closed")},this),400);return true};s.prototype.storageSet=function(t){if(t.key=="imFullscreenBackground"){this.backgroundSelector.value=t.value;this.backgroundChange()}};e.MessengerWindow=new s})(window);