Your IP : 3.23.100.107


Current Path : /home/bitrix/ext_www/klimatlend.ua/bitrix/js/calendar/
Upload File :
Current File : /home/bitrix/ext_www/klimatlend.ua/bitrix/js/calendar/cal-controlls.min.js

var ECUserControll=function(e){this.oEC=e.oEC;var t=this;this.count=0;this.countAgr=0;this.countDec=0;this.bEditMode=e.view!==true;this.pAttendeesCont=e.AttendeesCont;this.pAttendeesList=e.AttendeesList;this.pParamsCont=e.AdditionalParams;this.pSummary=e.SummaryCont;this.pCount=this.pSummary.appendChild(BX.create("A",{props:{className:"bxc-count",href:"javascript:void(0)"}}));this.pCountArg=this.pSummary.appendChild(BX.create("A",{props:{className:"bxc-count-agr",href:"javascript:void(0)"}}));this.pCountDec=this.pSummary.appendChild(BX.create("A",{props:{className:"bxc-count-dec",href:"javascript:void(0)"}}));this.pCount.onclick=function(){t.ListMode("all")};this.pCountArg.onclick=function(){t.ListMode("agree")};this.pCountDec.onclick=function(){t.ListMode("decline")};this._getFromDate=e.fromDateGetter&&typeof e.fromDateGetter=="function"?e.fromDateGetter:function(){return false};this._getToDate=e.toDateGetter&&typeof e.toDateGetter=="function"?e.toDateGetter:function(){return false};this._getEventId=e.eventIdGetter&&typeof e.eventIdGetter=="function"?e.eventIdGetter:function(){return false};this.ListMode("all");this.Attendees={};if(this.bEditMode){this.pLinkCont=e.AddLinkCont;var i=this.pLinkCont.appendChild(BX.create("I")),n=this.pLinkCont.appendChild(BX.create("SPAN",{text:EC_MESS.AddAttendees}));i.onclick=n.onclick=BX.proxy(this.OpenSelectUser,this);var s=[{text:EC_MESS.AddGuestsDef,onclick:BX.proxy(this.OpenSelectUser,this)}];if(!this.oEC.bExtranet&&this.oEC.type=="group")s.push({text:EC_MESS.AddGroupMemb,title:EC_MESS.AddGroupMembTitle,onclick:BX.proxy(this.oEC.AddGroupMembers,this.oEC)});if(s.length>1){pMore=this.pLinkCont.appendChild(BX.create("A",{props:{href:"javascript: void(0);",className:"bxec-add-more"}}));pMore.onclick=function(){BX.PopupMenu.show("bxec_add_guest_menu",t.pLinkCont,s,{events:{onPopupClose:function(){BX.removeClass(pMore,"bxec-add-more-over")}}});BX.addClass(pMore,"bxec-add-more-over")}}BX.addCustomEvent(window,"onUserSelectorOnChange",BX.proxy(this.UserOnChange,this))}};ECUserControll.prototype={SetValues:function(e){var t,i=e.length,n;BX.cleanNode(this.pAttendeesList);this.Attendees={};this.count=0;this.countAgr=0;this.countDec=0;for(t=0;t<i;t++){n=e[t];n.key=n.id||n.email;if(n&&n.key&&!this.Attendees[n.key])this.DisplayAttendee(n)}if(this.bEditMode){this.DisableUserOnChange(true,true);O_BXCalUserSelect.setSelected(e)}this.UpdateCount()},GetValues:function(){return this.Attendees},SetEmpty:function(e){if(this.bEmpty===e)return;BX.onCustomEvent(this,"SetEmpty",[e]);if(e){BX.addClass(this.pAttendeesCont,"bxc-att-empty");if(this.pParamsCont)this.pParamsCont.style.display="none"}else{BX.removeClass(this.pAttendeesCont,"bxc-att-empty");if(this.pParamsCont)this.pParamsCont.style.display=""}this.bEmpty=e},UpdateCount:function(){this.pCount.innerHTML=EC_MESS.AttSumm+" - "+(parseInt(this.count)||0);if(this.countAgr>0){this.pCountArg.innerHTML=EC_MESS.AttAgr+" - "+parseInt(this.countAgr);this.pCountArg.style.display=""}else{this.pCountArg.style.display="none"}if(this.countDec>0){this.pCountDec.innerHTML=EC_MESS.AttDec+" - "+parseInt(this.countDec);this.pCountDec.style.display=""}else{this.pCountDec.style.display="none"}this.SetEmpty(this.count==0)},OpenSelectUser:function(e){if(BX.PopupMenu&&BX.PopupMenu.currentItem)BX.PopupMenu.currentItem.popupWindow.close();if(!e)e=window.event;if(!this.SelectUserPopup){var t=this;this.SelectUserPopup=BX.PopupWindowManager.create("bxc-user-popup",this.pLinkCont,{offsetTop:1,autoHide:true,closeByEsc:true,content:BX("BXCalUserSelect_selector_content"),className:"bxc-popup-user-select",buttons:[new BX.PopupWindowButton({text:EC_MESS.Add,events:{click:function(){t.SelectUserPopup.close();for(var e in t.selectedUsers){if(t.selectedUsers.hasOwnProperty(e)){e=parseInt(e);if(!isNaN(e)&&e>0){if(!t.Attendees[e]&&t.selectedUsers[e]){t.selectedUsers[e].key=e;t.DisplayAttendee(t.selectedUsers[e])}else if(t.Attendees[e]&&!t.selectedUsers[e]){t.RemoveAttendee(e,false)}}}}BX.onCustomEvent(t,"UserOnChange");t.UpdateCount()}}}),new BX.PopupWindowButtonLink({text:EC_MESS.Close,className:"popup-window-button-link-cancel",events:{click:function(){t.SelectUserPopup.close()}}})]})}if(this.bEditMode){this.selectedUsers={};var i=[],n;for(n in this.Attendees){if(this.Attendees[n]&&this.Attendees[n].type!="ext")i.push(this.Attendees[n].User)}O_BXCalUserSelect.setSelected(i)}this.SelectUserPopup.show();BX.PreventDefault(e)},AddByEmail:function(e){var t=this;if(BX.PopupMenu&&BX.PopupMenu.currentItem)BX.PopupMenu.currentItem.popupWindow.close();if(!e)e=window.event;if(!this.EmailPopup){var i=BX.create("DIV",{props:{className:"bxc-email-cont"},html:'<label class="bxc-email-label">'+EC_MESS.UserEmail+":</label>"});this.pEmailValue=i.appendChild(BX.create("INPUT",{props:{className:"bxc-email-input"}}));this.EmailPopup=BX.PopupWindowManager.create("bxc-user-popup-email",this.pLinkCont,{offsetTop:1,autoHide:true,content:i,className:"bxc-popup-user-select-email",closeIcon:{right:"12px",top:"5px"},closeByEsc:true,buttons:[new BX.PopupWindowButton({text:EC_MESS.Add,className:"popup-window-button-accept",events:{click:function(){var e=BX.util.trim(t.pEmailValue.value);if(e!=""&&!t.Attendees[e]){var i={name:e,key:e,type:"ext",status:"Y"};t.DisplayAttendee(i);t.UpdateCount()}t.EmailPopup.close()}}}),new BX.PopupWindowButtonLink({text:EC_MESS.Close,className:"popup-window-button-link-cancel",events:{click:function(){t.EmailPopup.close()}}})]})}this.EmailPopup.show();setTimeout(function(){BX.focus(t.pEmailValue)},50);BX.PreventDefault(e)},DisableUserOnChange:function(e,t){this.bDisableUserOnChange=e===true;if(t)setTimeout(BX.proxy(this.DisableUserOnChange,this),300)},UserOnChange:function(e){if(this.bDisableUserOnChange)return;this.selectedUsers=e},DisplayAttendee:function(e,t){this.count++;if(e.status=="Y")this.countAgr++;else if(e.status=="N")this.countDec++;else e.status="Q";if(t&&e.id&&this.Attendees[e.id]){}else{var i=this,n=false,s=e.status.toLowerCase(),o=this.pAttendeesList.appendChild(BX.create("SPAN",{props:{className:"bxc-attendee-row bxc-att-row-"+s}})),a=o.appendChild(BX.create("I",{props:{className:"bxc-stat-"+s,title:EC_MESS["GuestStatus_"+s]+(e.desc?" - "+e.desc:"")}}));if(e.type=="ext")pName=o.appendChild(BX.create("span",{props:{className:"bxc-name"},text:e.name||e.email}));else pName=o.appendChild(BX.create("A",{props:{href:this.oEC.GetUserHref(e.id),className:"bxc-name"},text:e.name}));if(this.bEditMode&&e.type!="ext")n=o.appendChild(BX.create("SPAN",{props:{className:"bxc-busy"}}));o.appendChild(BX.create("SPAN",{props:{className:"bxc-comma"},html:","}));if(this.bEditMode){o.appendChild(BX.create("A",{props:{id:"bxc-att-key-"+e.key,href:"javascript:void(0)",title:EC_MESS.Delete,className:"bxc-del-att"}})).onclick=function(e){i.RemoveAttendee(this.id.substr("bxc-att-key-".length));return BX.PreventDefault(e||window.event)}}this.Attendees[e.key]={User:e,pRow:o,pBusyCont:n}}},RemoveAttendee:function(e,t){t=t!==false;if(this.Attendees[e]){this.Attendees[e].pRow.parentNode.removeChild(this.Attendees[e].pRow);if(this.Attendees[e].User.status=="Y")this.countAgr--;if(this.Attendees[e].User.status=="N")this.countDec--;this.count--;this.Attendees[e]=null;delete this.Attendees[e];if(this.bEditMode){var i=[];for(k in this.Attendees){if(this.Attendees[k]&&this.Attendees[k].type!="ext")i.push(this.Attendees[k].User)}this.DisableUserOnChange(true,true);if(t)O_BXCalUserSelect.setSelected(i)}}this.UpdateCount()},ListMode:function(e){if(this.mode==e)return;if(this.mode){BX.removeClass(this.pAttendeesList,"bxc-users-mode-"+this.mode);BX.removeClass(this.pSummary,"bxc-users-mode-"+this.mode)}this.mode=e;BX.addClass(this.pAttendeesList,"bxc-users-mode-"+this.mode);BX.addClass(this.pSummary,"bxc-users-mode-"+this.mode)}};var ECSyncPannel=function(e){this.oEC=e;if(!this.oEC.arConfig.syncInfo)return;this.Display();if(!window.jsOutlookUtils)return BX.loadScript("/bitrix/js/calendar/outlook.js")};ECSyncPannel.prototype={Display:function(){var e=this,t;this.syncList=[{id:"google",label:EC_MESS.syncGoogle,className:"bxec-sect-access-for-google",active:!!this.oEC.arConfig.syncInfo.google.active,connected:!!this.oEC.arConfig.syncInfo.google.connected,syncDate:this.oEC.arConfig.syncInfo.google.syncDate,connectHandler:function(t){BX.util.popup(e.oEC.arConfig.googleCalDavStatus.authLink,500,600);return BX.PreventDefault(t||window.event)},disconnectHandler:function(t){e.DisconnectGoogle(t);return BX.PreventDefault(t||window.event)}},{id:"macosx",className:"bxec-sect-access-for-macosx",label:EC_MESS.syncMac,active:!!this.oEC.arConfig.syncInfo.macosx.active,connected:!!this.oEC.arConfig.syncInfo.macosx.connected,syncDate:this.oEC.arConfig.syncInfo.macosx.syncDate,connectHandler:function(t){e.ConnectMacOSX();return BX.PreventDefault(t||window.event)},disconnectHandler:function(t){e.DisconnectMacOSX();return BX.PreventDefault(t||window.event)}},{id:"iphone",className:"bxec-sect-access-for-iphone",label:EC_MESS.syncIphone,active:!!this.oEC.arConfig.syncInfo.iphone.active,connected:!!this.oEC.arConfig.syncInfo.iphone.connected,syncDate:this.oEC.arConfig.syncInfo.iphone.syncDate,connectHandler:function(t){e.ConnectIphone();return BX.PreventDefault(t||window.event)},disconnectHandler:function(t){e.DisconnectIphone();return BX.PreventDefault(t||window.event)}},{id:"android",className:"bxec-sect-access-for-android",label:EC_MESS.syncAndroid,active:!!this.oEC.arConfig.syncInfo.android.active,connected:!!this.oEC.arConfig.syncInfo.android.connected,syncDate:this.oEC.arConfig.syncInfo.android.syncDate,connectHandler:function(t){e.ConnectAndroid();return BX.PreventDefault(t||window.event)},disconnectHandler:function(t){e.DisconnectAndroid();return BX.PreventDefault(t||window.event)}},{id:"outlook",className:"bxec-sect-access-for-outlook",label:EC_MESS.syncOutlook,active:!!this.oEC.arConfig.syncInfo.outlook.active&&!BX.browser.IsMac(),connected:!!this.oEC.arConfig.syncInfo.outlook.connected,syncDate:this.oEC.arConfig.syncInfo.outlook.syncDate,connectHandler:function(t){e.ConnectOutlook();return BX.PreventDefault(t||window.event)},disconnectHandler:function(t){e.DisconnectOutlook();return BX.PreventDefault(t||window.event)}},{id:"office365",className:"bxec-sect-access-for-office365",label:EC_MESS.syncOffice365,active:!!this.oEC.arConfig.syncInfo.office365.active,connected:!!this.oEC.arConfig.syncInfo.office365.connected,syncDate:this.oEC.arConfig.syncInfo.office365.syncDate},{id:"exchange",className:"bxec-sect-access-for-exchange",label:EC_MESS.syncExchange,active:!!this.oEC.arConfig.syncInfo.exchange.active,connected:!!this.oEC.arConfig.syncInfo.exchange.connected,syncDate:this.oEC.arConfig.syncInfo.exchange.syncDate,connectHandler:function(t){e.ConnectExchange();return BX.PreventDefault(t||window.event)},disconnectHandler:function(t){e.DisconnectExchange();return BX.PreventDefault(t||window.event)}}];this.pWrap=BX(this.oEC.id+"-sync-inner-wrap");BX.cleanNode(this.pWrap);this.brightMode=true;var i=0;var n=0;for(t=0;t<this.syncList.length;t++){if(this.syncList[t].active){if(this.syncList[t].connected){this.brightMode=false;i++}else{n++}}}if(this.brightMode){for(t=0;t<this.syncList.length;t++){this.BuildSyncItem(this.syncList[t])}}else{for(t=0;t<this.syncList.length;t++){if(this.syncList[t].connected)this.BuildSyncItem(this.syncList[t])}this.showMoreLink=this.pWrap.appendChild(BX.create("DIV",{props:{className:"bxec-sect-access-view-all"}})).appendChild(BX.create("A",{props:{href:""},text:EC_MESS.connectMore.replace(/#COUNT#/gi,n)}));BX.bind(this.showMoreLink,"click",function(t){e.showMoreLink.style.display="none";e.hiddenWrap.style.height=n*41+"px";if(!e.hideMoreLink){e.hideMoreLink=e.pWrap.appendChild(BX.create("DIV",{props:{className:"bxec-sect-access-view-all"}})).appendChild(BX.create("A",{props:{href:""},text:EC_MESS.showLess}));BX.bind(e.hideMoreLink,"click",function(t){e.hideMoreLink.style.display="none";e.showMoreLink.style.display="";e.hiddenWrap.style.height=0;return BX.PreventDefault(t||window.event)})}else{e.hideMoreLink.style.display=""}return BX.PreventDefault(t||window.event)});this.hiddenWrap=this.pWrap.appendChild(BX.create("DIV",{props:{className:"bxec-sect-access-hidden-wrap"}}));for(t=0;t<this.syncList.length;t++){if(!this.syncList[t].connected)this.BuildSyncItem(this.syncList[t],this.hiddenWrap)}}},SyncSectionWithOutlook:function(id){var oSect=this.oEC.oSections[id];if(oSect&&oSect.OUTLOOK_JS&&oSect.OUTLOOK_JS.length>0)try{eval(oSect.OUTLOOK_JS)}catch(e){}},DisconnectGoogle:function(e){if(confirm(EC_MESS.googleDisconnectConfirm)){var t,i=null,n=this;for(t=0;t<this.oEC.arConnections.length;t++){i=this.oEC.arConnections[t];if(i.account_type=="caldav_google_oauth"){break}}if(i&&i.id){this.oEC.Request({postData:this.oEC.GetReqData("disconnect_google",{connectionId:i.id}),handler:function(){window.location=window.location}})}}return BX.PreventDefault(e||window.event)},ConnectOutlook:function(){var e=0,t=this,i,n,s,o;for(i=0;i<this.oEC.arSections.length;i++){n=this.oEC.arSections[i];if(n.ACTIVE!=="N"&&this.oEC.IsCurrentViewSect(n)&&n.OUTLOOK_JS){e++;s=n}}if(e==1&&s){this.SyncSectionWithOutlook(s.ID)}else{var a=this.GetSyncItem("outlook");if(!this.outlookPopup){a.popupCont=BX.create("DIV",{props:{className:"bxec-sync-popup-wrap"}});for(i=0;i<this.oEC.arSections.length;i++){n=this.oEC.arSections[i];if(this.oEC.IsCurrentViewSect(n)&&n.OUTLOOK_JS){o=a.popupCont.appendChild(BX.create("DIV",{props:{id:"ecpp_"+n.ID,className:"bxec-sync-popup-item"+(n.bDark?" bxec-dark":"")},style:{backgroundColor:n.COLOR},text:n.NAME}));o.onclick=function(){t.SyncSectionWithOutlook(this.id.substr("ecpp_".length))}}}this.outlookPopup=BX.PopupWindowManager.create(this.oEC.id+"-outlook-sync-popup",a.pConnectLink,{autoHide:true,closeByEsc:true,offsetTop:-1,offsetLeft:1,lightShadow:true,content:a.popupCont})}this.outlookPopup.show(true);BX.addCustomEvent(this.outlookPopup,"onPopupClose",function(){if(t.outlookPopup&&t.outlookPopup.destroy){t.outlookPopup.destroy();t.outlookPopup=null}})}},ConnectIphone:function(){this.oEC.ShowMobileSyncDialog("iphone")},ConnectMacOSX:function(){this.oEC.ShowMobileSyncDialog("macosx")},ConnectAndroid:function(){this.oEC.ShowMobileSyncDialog("android")},DisconnectIphone:function(){this.oEC.Request({postData:this.oEC.GetReqData("clear_sync_info",{sync_type:"iphone"})});var e=this.GetSyncItem("iphone");if(e&&e.pDisconnectLink){var t=this;this.ShowInfoPopup(e.pDisconnectLink,EC_MESS.disconnectIphone,function(){t.oEC.arConfig.syncInfo.iphone.connected=false;t.oEC.arConfig.syncInfo.iphone.syncDate=false;t.Display()})}},DisconnectMacOSX:function(){this.oEC.Request({postData:this.oEC.GetReqData("clear_sync_info",{sync_type:"mac"})});var e=this.GetSyncItem("macosx");if(e&&e.pDisconnectLink){var t=this;this.ShowInfoPopup(e.pDisconnectLink,EC_MESS.disconnectMac,function(){t.oEC.arConfig.syncInfo.macosx.connected=false;t.oEC.arConfig.syncInfo.macosx.syncDate=false;t.Display()})}},DisconnectAndroid:function(){this.oEC.Request({postData:this.oEC.GetReqData("clear_sync_info",{sync_type:"android"})});var e=this.GetSyncItem("android");if(e&&e.pDisconnectLink){var t=this;this.ShowInfoPopup(e.pDisconnectLink,EC_MESS.disconnectAndroid,function(){t.oEC.arConfig.syncInfo.android.connected=false;t.oEC.arConfig.syncInfo.android.syncDate=false;t.Display()})}},DisconnectOutlook:function(){this.oEC.Request({postData:this.oEC.GetReqData("clear_sync_info",{sync_type:"outlook"})});var e=this.GetSyncItem("outlook");if(e&&e.pDisconnectLink){var t=this;this.ShowInfoPopup(e.pDisconnectLink,EC_MESS.disconnectOutlook,function(){t.oEC.arConfig.syncInfo.outlook.connected=false;t.oEC.arConfig.syncInfo.outlook.syncDate=false;t.Display()})}},ShowInfoPopup:function(e,t,i){var n=BX.PopupWindowManager.create(this.oEC.id+"-disconnect-popup",e,{autoHide:true,closeByEsc:true,offsetTop:-1,offsetLeft:1,lightShadow:true,content:BX.create("DIV",{props:{className:"bxec-disconnect-popup-wrap"},html:t})});n.show(true);function s(){if(i&&typeof i=="function")i();if(n&&n.destroy){BX.removeCustomEvent(n,"onPopupClose",s);n.destroy();n=null}}BX.addCustomEvent(n,"onPopupClose",s)},ConnectExchange:function(){var e=this.GetSyncItem("exchange");if(e&&e.pConnectLink){this.ShowInfoPopup(e.pConnectLink,EC_MESS.connectExchange)}},DisconnectExchange:function(){var e=this.GetSyncItem("exchange");if(e&&e.pDisconnectLink){this.ShowInfoPopup(e.pDisconnectLink,EC_MESS.disconnectExchange)}},SyncExchange:function(){this.oEC.Request({postData:this.oEC.GetReqData("exchange_sync"),handler:function(e){var t=e.result;setTimeout(function(){if(t===true)top.window.location=top.window.location;else if(t===false)alert(EC_MESS.ExchNoSync)},100)}})},BuildSyncItem:function(e,t){if(!t)t=this.pWrap;if(e.active){e.pOuter=t.appendChild(BX.create("DIV",{props:{className:"bxec-sect-access-el "+(e.className||"")}}));e.pInner=e.pOuter.appendChild(BX.create("DIV",{props:{className:"bxec-sect-access-el-block"}}));if(!e.connected&&e.connectHandler){e.pConnectLink=e.pInner.appendChild(BX.create("A",{props:{className:"bxec-sect-access-connect-link"},text:EC_MESS.syncConnect}));BX.bind(e.pConnectLink,"click",e.connectHandler)}e.pIcon=e.pInner.appendChild(BX.create("DIV",{props:{className:"bxec-sect-access-icon"}}));e.pTextWrap=e.pInner.appendChild(BX.create("DIV",{props:{className:"bxec-sect-access-text-wrap"},text:e.label}));if(!this.brightMode||e.connected)BX.addClass(e.pOuter,"bxec-sect-access-connected");if(e.connected){e.pInner.appendChild(BX.create("DIV",{props:{className:"bxec-sect-access-allowed-icon"}}));e.pInfoCont=e.pOuter.appendChild(BX.create("DIV",{props:{className:"bxec-sect-access-block-info bxec-sect-access-el-block-active"}}));var i=e.pInfoCont.appendChild(BX.create("TABLE",{props:{className:"bxec-sect-access-el-table"}}));var n=i.insertRow(-1);BX.adjust(n.insertCell(-1),{props:{className:"bxec-sect-access-status"},html:EC_MESS.syncOk});var s=BX.adjust(n.insertCell(-1),{style:{textAlign:"right"}});if(e.syncDate){e.pSyncDate=s.appendChild(BX.create("DIV",{props:{className:"bxec-sect-access-status-time"}}));e.pSyncDate.innerHTML=e.syncDate}if(e.disconnectHandler){e.pDisconnectLink=s.appendChild(BX.create("SPAN",{props:{className:"bxec-sect-access-disconnect-link"},html:EC_MESS.syncDisconnect}));BX.bind(e.pDisconnectLink,"click",e.disconnectHandler)}if(e.id=="exchange"&&this.oEC.arConfig.bExchange){e.pTextWrap.style.cursor="pointer";e.pTextWrap.title=EC_MESS.syncExchangeTitle;BX.bind(e.pTextWrap,"click",BX.proxy(this.SyncExchange,this))}}}},GetSyncItem:function(e){var t;for(t=0;t<this.syncList.length;t++){if(this.syncList[t].active&&this.syncList[t].id==e){return this.syncList[t]}}}};var ECMonthSelector=function(e){this.oEC=e;this.Build();this.content={month:"",week:"",day:""}};ECMonthSelector.prototype={Build:function(){var e=this;this.pPrev=BX(this.oEC.id+"selector-prev");this.pNext=BX(this.oEC.id+"selector-next");this.pCont=BX(this.oEC.id+"selector-cont");this.pContInner=BX(this.oEC.id+"selector-cont-inner");this.pPrev.onclick=function(){e.ChangeValue(false)};this.pNext.onclick=function(){e.ChangeValue(true)}},ChangeMode:function(e){this.mode=e||this.oEC.activeTabId;if(this.mode=="month"){this.pCont.className="bxec-sel-but";this.pCont.onclick=BX.proxy(this.ShowMonthPopup,this)}else{this.pCont.className="bxec-sel-text";this.pCont.onclick=BX.False}},OnChange:function(e,t,i,n){t=parseInt(t,10);e=parseInt(e);var s,o;this.pNext.style.marginLeft=this.mode=="month"&&BX.browser.IsIE()&&!BX.browser.IsIE9()?"10px":"";if(this.mode=="month"){if(t<0||t>11)return alert("Error! Incorrect month");this.content.month=this.oEC.arConfig.month[t]+",&nbsp;"+e+'<span class="bxec-sel-but-arr">'}else if(this.mode=="week"){var a=new Date;a.setFullYear(e,t,1);o=this.oEC.GetWeekDayOffset(this.oEC.GetWeekDayByInd(a.getDay()));if(o>0)a.setDate(a.getDate()-o);if(i!=0)a.setDate(a.getDate()+7*i);var r=new Date(a.getTime());r.setDate(r.getDate()+6);var c,h=this.oEC.arConfig.month_r,l=a.getDate(),d=a.getMonth(),p=a.getFullYear(),u=r.getDate(),f=r.getMonth(),E=r.getFullYear();if(d==f)c=l+"&nbsp;-&nbsp;"+u+"&nbsp;"+h[d]+"&nbsp;"+p;else if(p==E)c=l+"&nbsp;"+h[d]+"&nbsp;-&nbsp;"+u+"&nbsp;"+h[f]+"&nbsp;"+p;else c=l+"&nbsp;"+h[d]+"&nbsp;"+p+"&nbsp;-&nbsp;"+u+"&nbsp;"+h[f]+"&nbsp;"+E;this.content.week="<nobr>"+c+"</nobr>";s={dateFrom:l,monthFrom:d,yearFrom:p,weekStartDate:a,monthTo:f,yearTo:E,dateTo:u,weekEndDate:r}}else if(this.mode=="day"){var C=new Date;C.setFullYear(e,t,n);day=this.oEC.ConvertDayIndex(C.getDay());n=C.getDate(),t=C.getMonth(),e=C.getFullYear();this.content.day="<nobr>"+this.oEC.arConfig.days[day][0]+",&nbsp;"+n+"&nbsp;"+this.oEC.arConfig.month_r[t]+"&nbsp;"+e+"</nobr>";s={date:n,month:t,year:e,oDate:C}}this.Show(this.mode);return s},Show:function(e){this.pContInner.innerHTML=this.content[e]},ChangeValue:function(e){var t=e?1:-1;this.oEC.bJustRedraw=false;if(this.mode=="month"){var i=bxInt(this.oEC.activeDate.month)+t;var n=this.oEC.activeDate.year;if(i<0){i+=12;n--}else if(i>11){i-=12;n++}this.oEC.SetMonth(i,n)}else if(this.mode=="week"){this.oEC.SetWeek(this.oEC.activeDate.week+t,this.oEC.activeDate.month,this.oEC.activeDate.year)}else if(this.mode=="day"){this.oEC.SetDay(this.oEC.activeDate.date+t,this.oEC.activeDate.month,this.oEC.activeDate.year)}},ShowMonthPopup:function(){if(!this.oMonthWin){var e=this;this.oMonthWin=new BX.PopupWindow(this.oEC.id+"bxc-month-sel",this.pCont,{overlay:{opacity:1},autoHide:true,offsetTop:1,offsetLeft:0,lightShadow:true,contentColor:"white",contentNoPaddings:true,content:BX("bxec_month_win_"+this.oEC.id)});this.oMonthWin.CAL={DOM:{Year:BX(this.oEC.id+"md-year"),MonthList:BX(this.oEC.id+"md-month-list")},curYear:parseInt(this.oEC.activeDate.year)};this.oMonthWin.CAL.DOM.Year.innerHTML=this.oMonthWin.CAL.curYear;BX(this.oEC.id+"md-selector-prev").onclick=function(){e.oMonthWin.CAL.DOM.Year.innerHTML=--e.oMonthWin.CAL.curYear};BX(this.oEC.id+"md-selector-next").onclick=function(){e.oMonthWin.CAL.DOM.Year.innerHTML=++e.oMonthWin.CAL.curYear};var t,i,n,s=[0,4,8,1,5,9,2,6,10,3,7,11];for(t=0;t<12;t++){i=s[t];n=this.oMonthWin.CAL.DOM.MonthList.appendChild(BX.create("DIV",{props:{id:"bxec_ms_m_"+s[t],className:"bxec-month-div"+(s[t]==this.oEC.activeDate.month?" bxec-month-act":"")+" bxec-"+this.GetSeason(s[t])},html:"<span>"+this.oEC.arConfig.month[s[t]]+"</span>",events:{click:function(){e.oEC.bJustRedraw=false;BX.removeClass(e.oMonthWin.CAL.DOM.curMonth,"bxec-month-act");BX.addClass(this,"bxec-month-act");e.oMonthWin.CAL.DOM.curMonth=this;e.oEC.SetMonth(parseInt(this.id.substr("bxec_ms_m_".length)),e.oMonthWin.CAL.curYear);e.oMonthWin.close()}}}));if(s[t]==this.oEC.activeDate.month)this.oMonthWin.CAL.DOM.curMonth=n}}this.oMonthWin.show()},GetSeason:function(e){switch(e){case 11:case 0:case 1:return"winter";case 2:case 3:case 4:return"spring";case 5:case 6:case 7:return"summer";case 8:case 9:case 10:return"autumn"}}};var ECCalendarAccess=function(e){BX.Access.Init();if(!window.EC_MESS)EC_MESS={};this.bind=e.bind;this.GetAccessName=e.GetAccessName;this.pTbl=e.pCont.appendChild(BX.create("TABLE",{props:{className:"bxc-access-tbl"}}));this.pSel=BX("bxec-"+this.bind);var t=this;this.delTitle=e.delTitle||EC_MESS.Delete;this.noAccessRights=e.noAccessRights||EC_MESS.NoAccessRights;this.inputName=e.inputName||false;e.pLink.onclick=function(){BX.Access.ShowForm({callback:BX.proxy(t.InsertRights,t),bind:t.bind})}};ECCalendarAccess.prototype={InsertRights:function(e){var t,i;for(t in e)for(i in e[t])this.InsertAccessRow(BX.Access.GetProviderName(t)+" "+e[t][i].name,i)},InsertAccessRow:function(e,t,i){var n=this,s,o,a,r;if(this.pTbl.rows[0]&&this.pTbl.rows[0].cells[0]&&this.pTbl.rows[0].cells[0].className.indexOf("bxc-access-no-vals")!=-1)this.DeleteRow(0);s=this.pTbl.insertRow(-1);o=BX.adjust(s.insertCell(-1),{props:{className:"bxc-access-c-l"},html:e+":"});a=BX.adjust(s.insertCell(-1),{props:{className:"bxc-access-c-r"}});r=a.appendChild(this.pSel.cloneNode(true));r.id="BXEC_ACCESS_"+t;if(i)r.value=i;pDel=a.appendChild(BX.create("A",{props:{className:"access-delete",href:"javascript:void(0)",title:this.delTitle},events:{click:function(){n.DeleteRow(this.parentNode.parentNode.rowIndex)}}}));if(this.inputName){r.name=this.inputName+"["+t+"]"}},DeleteRow:function(e){if(this.pTbl.rows[e])this.pTbl.deleteRow(e)},GetValues:function(){var e,t,i={},n=this.pTbl.getElementsByTagName("SELECT"),s,o=n.length;for(s=0;s<o;s++){e=n[s].id.substr("BXEC_ACCESS_".length);t=n[s].value;i[e]=t}return i},SetSelected:function(e){if(!e)e={};while(this.pTbl.rows[0])this.pTbl.deleteRow(0);var t,i={};for(t in e){this.InsertAccessRow(this.GetTitleByCode(t),t,e[t]);i[t]=true}if(this.pTbl.rows.length<=0)BX.adjust(this.pTbl.insertRow(-1).insertCell(-1),{props:{className:"bxc-access-no-vals",colSpan:2},html:"<span>"+this.noAccessRights+"</span>"});BX.Access.SetSelected(i,this.bind)},GetTitleByCode:function(e){return this.GetAccessName(e)}};function ECColorPicker(e){this.bOpened=false;this.zIndex=5e3;this.id="";this.Popups={};this.Conts={}}ECColorPicker.prototype={Create:function(){var e=this;var t=document.body.appendChild(BX.create("DIV",{props:{className:"ec-colpick-cont"},style:{zIndex:this.zIndex}}));var i=["#3AD0FF","#A6DC00","#FF5C5A","#B47153","#2FC7F7","#04B4AB","#FFA801","#5CD1DF","#6E54D1","#29AD49","#FE5957","#DAA187","#78D4F1","#43DAD2","#EECE8F","#AEE5EC","#FF0000","#FFFF00","#00FF00","#00FFFF","#0000FF","#FF00FF","#FFFFFF","#EBEBEB","#E1E1E1","#D7D7D7","#CCCCCC","#C2C2C2","#B7B7B7","#ACACAC","#A0A0A0","#959595","#EE1D24","#FFF100","#00A650","#00AEEF","#2F3192","#ED008C","#898989","#7D7D7D","#707070","#626262","#555","#464646","#363636","#262626","#111","#000000","#F7977A","#FBAD82","#FDC68C","#FFF799","#C6DF9C","#A4D49D","#81CA9D","#7BCDC9","#6CCFF7","#7CA6D8","#8293CA","#8881BE","#A286BD","#BC8CBF","#F49BC1","#F5999D","#F16C4D","#F68E54","#FBAF5A","#FFF467","#ACD372","#7DC473","#39B778","#16BCB4","#00BFF3","#438CCB","#5573B7","#5E5CA7","#855FA8","#A763A9","#EF6EA8","#F16D7E","#EE1D24","#F16522","#F7941D","#FFF100","#8FC63D","#37B44A","#00A650","#00A99E","#00AEEF","#0072BC","#0054A5","#2F3192","#652C91","#91278F","#ED008C","#EE105A","#9D0A0F","#A1410D","#A36209","#ABA000","#588528","#197B30","#007236","#00736A","#0076A4","#004A80","#003370","#1D1363","#450E61","#62055F","#9E005C","#9D0039","#790000","#7B3000","#7C4900","#827A00","#3E6617","#045F20","#005824","#005951","#005B7E","#003562","#002056","#0C004B","#30004A","#4B0048","#7A0045","#7A0026"],n,s,o,a=BX.create("TABLE",{props:{className:"ec-colpic-tbl"}}),r,c=i.length;n=a.insertRow(-1);s=n.insertCell(-1);s.colSpan=8;var h=s.appendChild(BX.create("SPAN",{props:{className:"ec-colpic-def-but"},text:EC_MESS.DefaultColor}));h.onmouseover=function(){this.className="ec-colpic-def-but ec-colpic-def-but-over";o.style.backgroundColor="#FF0000"};h.onmouseout=function(){this.className="ec-colpic-def-but"};h.onmousedown=function(t){e.Select("#FF0000")};o=n.insertCell(-1);o.colSpan=8;o.className="ec-color-inp-cell";o.style.backgroundColor=i[38];for(r=0;r<c;r++){if(Math.round(r/16)==r/16)n=a.insertRow(-1);s=n.insertCell(-1);s.innerHTML="&nbsp;";s.className="ec-col-cell";s.style.backgroundColor=i[r];s.id="lhe_color_id__"+r;s.onmouseover=function(e){this.className="ec-col-cell ec-col-cell-over";o.style.backgroundColor=i[this.id.substring("lhe_color_id__".length)]};s.onmouseout=function(e){this.className="ec-col-cell"};s.onmousedown=function(t){var n=this.id.substring("lhe_color_id__".length);e.Select(i[n])}}t.appendChild(a);this.Conts[this.id]=t},Open:function(e){this.id=e.id+Math.round(Math.random()*1e6);this.key=e.key;this.OnSelect=e.onSelect;if(!this.Conts[this.id])this.Create();if(!this.Popups[this.id]){this.Popups[this.id]=BX.PopupWindowManager.create("bxc-color-popup"+this.id,e.pWnd,{autoHide:true,offsetTop:1,offsetLeft:0,lightShadow:true,content:this.Conts[this.id]})}this.Popups[this.id].show()},Close:function(){this.Popups[this.id].close();this.Popups[this.id].destroy()},OnKeyPress:function(e){if(!e)e=window.event;if(e.keyCode==27)this.Close()},Select:function(e){if(this.OnSelect&&typeof this.OnSelect=="function")this.OnSelect(e);this.Close()}};window.BxEditEventGridSetLinkName=function(e){var t=BX("event-grid-dest-add-link");if(t)t.innerHTML=BX.SocNetLogDestination.getSelectedCount(e)>0?BX.message("BX_FPD_LINK_2"):BX.message("BX_FPD_LINK_1")};window.BxEditEventGridSelectCallback=function(e,t,i){var n=t;prefix="S";if(t=="sonetgroups")prefix="SG";else if(t=="groups"){prefix="UA";n="all-users"}else if(t=="users")prefix="U";else if(t=="department")prefix="DR";BX("event-grid-dest-item").appendChild(BX.create("span",{attrs:{"data-id":e.id},props:{className:"event-grid-dest event-grid-dest-"+n},children:[BX.create("input",{attrs:{type:"hidden",name:"EVENT_DESTINATION["+prefix+"][]",value:e.id}}),BX.create("span",{props:{className:"event-grid-dest-text"},html:e.name}),BX.create("span",{props:{className:"feed-event-del-but"},attrs:{"data-item-id":e.id,"data-item-type":t}})]}));BX.onCustomEvent("OnDestinationAddNewItem",[e]);BX("event-grid-dest-input").value="";BxEditEventGridSetLinkName(editEventDestinationFormName)};window.BxEditEventGridUnSelectCallback=function(e,t,i){var n=BX.findChildren(BX("event-grid-dest-item"),{attribute:{"data-id":""+e.id+""}},true);if(n!=null){for(var s=0;s<n.length;s++)BX.remove(n[s])}BX.onCustomEvent("OnDestinationUnselect");BX("event-grid-dest-input").value="";BxEditEventGridSetLinkName(editEventDestinationFormName)};window.BxEditEventGridOpenDialogCallback=function(){BX.style(BX("event-grid-dest-input-box"),"display","inline-block");BX.style(BX("event-grid-dest-add-link"),"display","none");BX.focus(BX("event-grid-dest-input"))};window.BxEditEventGridCloseDialogCallback=function(){if(!BX.SocNetLogDestination.isOpenSearch()&&BX("event-grid-dest-input").value.length<=0){BX.style(BX("event-grid-dest-input-box"),"display","none");BX.style(BX("event-grid-dest-add-link"),"display","inline-block");BxEditEventGridDisableBackspace()}};window.BxEditEventGridCloseSearchCallback=function(){if(!BX.SocNetLogDestination.isOpenSearch()&&BX("event-grid-dest-input").value.length>0){BX.style(BX("event-grid-dest-input-box"),"display","none");BX.style(BX("event-grid-dest-add-link"),"display","inline-block");BX("event-grid-dest-input").value="";BxEditEventGridDisableBackspace()}};window.BxEditEventGridDisableBackspace=function(e){if(BX.SocNetLogDestination.backspaceDisable||BX.SocNetLogDestination.backspaceDisable!=null)BX.unbind(window,"keydown",BX.SocNetLogDestination.backspaceDisable);BX.bind(window,"keydown",BX.SocNetLogDestination.backspaceDisable=function(e){if(e.keyCode==8){BX.PreventDefault(e);return false}});setTimeout(function(){BX.unbind(window,"keydown",BX.SocNetLogDestination.backspaceDisable);BX.SocNetLogDestination.backspaceDisable=null},5e3)};window.BxEditEventGridSearchBefore=function(e){return BX.SocNetLogDestination.searchBeforeHandler(e,{formName:editEventDestinationFormName,inputId:"event-grid-dest-input"})};window.BxEditEventGridSearch=function(e){return BX.SocNetLogDestination.searchHandler(e,{formName:editEventDestinationFormName,inputId:"event-grid-dest-input",linkId:"event-grid-dest-add-link",sendAjax:true})};(function(e){e.EditEventPopupController=function(e){this.config=e;this.id=this.config.id;this.oEC=this.config.oEC;this.oEvent=this.config.oEvent;this.Form=this.config.form;this.Init()};e.EditEventPopupController.prototype={Init:function(){this.InitDateTimeControls();var t=this,i=this.oEC.id+"_event_editor",n=e["BXHtmlEditor"].Get(i);if(n&&n.IsShown()){this.CustomizeHtmlEditor(n)}else{BX.addCustomEvent(e["BXHtmlEditor"],"OnEditorCreated",function(e){if(e.id==i){t.CustomizeHtmlEditor(e)}})}if(this.oEC.allowMeetings)this.InitDestinationControls();this.FillFormFields()},SaveForm:function(e,t){var i,n,s=this,o=parseInt(this.oEC.activeDate.month,10),a=this.oEC.activeDate.year,r=this.oEC.actionUrl,c=Math.round(Math.random()*1e6);r+=r.indexOf("?")==-1?"?":"&";r+="action=edit_event&bx_event_calendar_request=Y&sessid="+BX.bitrix_sessid()+"&reqId="+c;this.Form.action=r;if(BX.util.trim(this.pFromTime.value)!=""||BX.util.trim(this.pFromDate.value)!=""){i=this.oEC.ParseDate(BX.util.trim(this.pFromDate.value)+(this.pFullDay.checked?"":" "+BX.util.trim(this.pFromTime.value)))}if(BX.util.trim(this.pToTime.value)!=""||BX.util.trim(this.pToDate.value)!=""){n=this.oEC.ParseDate(BX.util.trim(this.pToDate.value)+(this.pFullDay.checked?"":" "+BX.util.trim(this.pToTime.value)))}if(e.recurentEventEditMode){BX("event-current-date-from"+this.id).value=this.oEvent.DATE_FROM;BX("event-rec-edit-mode"+this.id).value=e.recurentEventEditMode}else{BX("event-current-date-from"+this.id).value="";BX("event-rec-edit-mode"+this.id).value=""}BX("event-location-old"+this.id).value=this.Loc.OLD||false;BX("event-location-new"+this.id).value=this.Loc.NEW;if(this.Loc.NEW.substr(0,5)=="ECMR_"&&this.RepeatCheck.checked){alert(EC_MESS.reservePeriodWarn);return false}if(!this.CheckUserAccessibility()){alert(EC_MESS.EC_BUSY_ALERT);return}if(this.Loc.NEW.substr(0,5)=="ECMR_"&&!e.bLocationChecked){if(n&&this.pFullDay.checked){n=new Date(n.getTime()+864e5)}if(i&&n){this.oEC.CheckMeetingRoom({id:this.oEvent.ID||0,from:s.oEC.FormatDateTime(i),to:s.oEC.FormatDateTime(n),location_new:this.Loc.NEW,location_old:this.Loc.OLD||false},function(t){if(!t)return alert(EC_MESS.MRReserveErr);if(t=="reserved")return alert(EC_MESS.MRNotReservedErr);e.bLocationChecked=true;s.SaveForm(e)});return false}}if(i&&BX.util.trim(this.pFromTime.value)!="")this.pFromTime.value=this.oEC.FormatTime(i,true);if(n&&BX.util.trim(this.pToTime.value)!="")this.pToTime.value=this.oEC.FormatTime(n,true);BX("event-id"+this.id).value=this.oEvent.ID||0;BX("event-month"+this.id).value=o+1;BX("event-year"+this.id).value=a;if(this.RepeatCheck.checked){var h=this.RepeatSelect.value;if(this.RepeatDiapTo.value==EC_MESS.NoLimits)this.RepeatDiapTo.value="";if(h=="WEEKLY"){var l=[],d;for(d=0;d<7;d++)if(this.RepeatWeekDaysCh[d].checked)l.push(this.RepeatWeekDaysCh[d].value);if(l.length==0)this.RepeatSelect.value="NONE";else BX("event-rrule-byday"+this.id).value=l.join(",")}}if(this.oEvent.ID&&this.oEC.Event.IsRecursive(this.oEvent)&&!t){if(this.CheckForSignificantChanges()){this.oEC.ShowConfirmEditDialog(this.oEvent,{params:e});return false}}BX.ajax.submit(this.Form,function(){if(e.recurentEventEditMode){s.oEC.Event.ReloadAll(false)}else{var t=top.BXCRES[c];if(t){if(t.eventIds&&t.eventIds.length>0){for(var i=0;i<t.eventIds.length;i++){s.oEC.Event.UnDisplay(t.eventIds[i],false)}}s.oEC.HandleEvents(t.events,t.attendees);s.oEC.arLoadedMonth[o+"."+a]=true;s.oEC.Event.Display()}}});var p=this.pSectSelect.value,u=s.oEC.oSections&&s.oEC.oSections[p]?s.oEC.oSections[p]:{},f=this.TextColor,E=this.Color;if(!u.COLOR||u.COLOR&&u.COLOR.toLowerCase()!=E.toLowerCase())BX(this.id+"_bxec_color").value=E;if(!u.TEXT_COLOR||u.TEXT_COLOR&&u.TEXT_COLOR.toLowerCase()!=f.toLowerCase())BX(this.id+"_bxec_text_color").value=f;if(!this.oEC.arConfig.userTimezoneName){this.config.userTimezoneName=this.oEC.arConfig.userTimezoneName=this.pDefTimezone.value}if(e.callback)e.callback()},CheckUserAccessibility:function(){var e,t=true;if(this.plannerData){for(e in this.plannerData.entries){if(this.plannerData.entries.hasOwnProperty(e)&&this.plannerData.entries[e].id&&this.plannerData.entries[e].status!="h"&&this.plannerData.entries[e].strictStatus&&!this.plannerData.entries[e].currentStatus){t=false;break}}}return t},CheckForSignificantChanges:function(){var e=false;if(!e&&this.oEvent.NAME!==this.Form.name.value)e=true;if(!e&&this.oEvent.DESCRIPTION!==this.Form.desc.value)e=true;if(!e&&this.oEvent.LOCATION!==this.Loc.NEW)e=true;if(!e&&this.oEvent.displayColor!==this.Color)e=true;if(!e&&this.oEvent.displayTextColor!==this.TextColor)e=true;if(!e&&this.oEvent.DT_SKIP_TIME=="Y"!=this.Form.skip_time.checked)e=true;if(!e){var t=this.pFromDate.value,i=this.pToDate.value;if(this.oEvent.DT_SKIP_TIME!="Y"){if(!e&&(this.oEvent.TZ_FROM!=this.Form.tz_from.value||this.oEvent.TZ_TO!=this.Form.tz_to.value))e=true;t+=" "+this.pFromTime.value;i+=" "+this.pToTime.value;if(!e){var n=this.oEC.ParseDate(this.oEvent["~DATE_FROM"]),s=this.oEC.ParseDate(this.oEvent["~DATE_TO"]),o=this.oEC.ParseDate(t),a=this.oEC.ParseDate(i);if(!n||!s||!o||!a)e=true;if(!e&&Math.abs(n.getTime()-o.getTime())>1e3||Math.abs(s.getTime()-a.getTime())>1e3)e=true}}else{if(!e&&(this.oEvent["~DATE_FROM"]!=t||this.oEvent["~DATE_TO"]!=i))e=true}}if(!e&&this.plannerData){var r,c={},h=0;if(this.oEvent.IS_MEETING&&this.oEvent["~ATTENDEES"]){for(r in this.oEvent["~ATTENDEES"]){if(this.oEvent["~ATTENDEES"].hasOwnProperty(r)&&this.oEvent["~ATTENDEES"][r]["USER_ID"]){c[this.oEvent["~ATTENDEES"][r]["USER_ID"]]=true;h++}}}for(r in this.plannerData.entries){if(this.plannerData.entries.hasOwnProperty(r)&&this.plannerData.entries[r].type=="user"&&this.plannerData.entries[r].id){if(c[this.plannerData.entries[r].id]){c[this.plannerData.entries[r].id]="+"}else{e=true;break}}}if(!e&&c){for(r in c){if(c.hasOwnProperty(r)&&c[r]!=="+"){e=true;break}}}}if(!e&&this.oEvent.RRULE.FREQ!=this.RepeatSelect.value)e=true;if(!e&&this.oEvent.RRULE.INTERVAL!=this.RepeatCount.value)e=true;if(!e&&this.oEvent.RRULE.FREQ=="WEEKLY"&&this.oEvent.RRULE.BYDAY){var l=[];for(r in this.oEvent.RRULE.BYDAY){if(this.oEvent.RRULE.BYDAY.hasOwnProperty(r)){l.push(this.oEvent.RRULE.BYDAY[r])}}if(l.join(",")!=BX("event-rrule-byday"+this.id).value)e=true}return e},InitDestinationControls:function(){BX.addCustomEvent("OnDestinationAddNewItem",BX.proxy(this.CheckPlannerState,this));BX.addCustomEvent("OnDestinationUnselect",BX.proxy(this.CheckPlannerState,this));BX.addCustomEvent("OnSetTab",BX.proxy(this.OnPlannerTabShow,this));this.pMeetingParams=BX("event-grid-meeting-params"+this.id);this.pDestValuesCont=BX("event-grid-dest-item");this.pPlannerCont=BX("event-grid-planner-cont"+this.id);this.plannerId=this.id+"_Planner";BX.addCustomEvent("OnCalendarPlannerSelectorChanged",BX.proxy(this.OnCalendarPlannerSelectorChanged,this));BX.addCustomEvent("OnCalendarPlannerScaleChanged",BX.proxy(this.OnCalendarPlannerScaleChanged,this));BX.bind(this.pDestValuesCont,"click",function(e){var t=e.target||e.srcElement;if(t.className=="feed-event-del-but"){BX.SocNetLogDestination.deleteItem(t.getAttribute("data-item-id"),t.getAttribute("data-item-type"),editEventDestinationFormName);BX.PreventDefault(e)}});BX.bind(this.pDestValuesCont,"mouseover",function(e){var t=e.target||e.srcElement;if(t.className=="feed-event-del-but")BX.addClass(t.parentNode,"event-grid-dest-hover")});BX.bind(this.pDestValuesCont,"mouseout",function(e){var t=e.target||e.srcElement;if(t.className=="feed-event-del-but")BX.removeClass(t.parentNode,"event-grid-dest-hover")});if(this.oEvent.IS_MEETING){this.pMeetingParams.style.display="block"}this.AddMeetTextLink=BX(this.id+"_add_meet_text");this.HideMeetTextLink=BX(this.id+"_hide_meet_text");this.MeetTextCont=BX(this.id+"_meet_text_cont");this.MeetText=BX(this.id+"_meeting_text");this.OpenMeeting=BX(this.id+"_ed_open_meeting");this.NotifyStatus=BX(this.id+"_ed_notify_status");this.Reinvite=BX(this.id+"_ed_reivite");this.ReinviteCont=BX(this.id+"_ed_reivite_cont");if(this.oEvent.IS_MEETING){this.OpenMeeting.checked=!!(this.oEvent.MEETING&&this.oEvent.MEETING.OPEN);this.NotifyStatus.checked=!!(this.oEvent.MEETING&&this.oEvent.MEETING.NOTIFY);this.Reinvite.checked=this.oEvent.MEETING.REINVITE===true}this.AddMeetTextLink.parentNode.style.display="none"},OnCalendarPlannerSelectorChanged:function(e){this.pFromDate.value=this.oEC.FormatDate(e.dateFrom);this.pFromTime.value=this.oEC.FormatTime(e.dateFrom);this.pToDate.value=this.oEC.FormatDate(e.dateTo);this.pToTime.value=this.oEC.FormatTime(e.dateTo);this.pFullDay.checked=!!e.fullDay;this.FullDay(false,!e.fullDay)},OnCalendarPlannerScaleChanged:function(e){this.UpdatePlanner({entrieIds:e.entrieIds,entries:e.entries,from:e.from,to:e.to,location:this.Loc&&this.Loc.NEW?this.Loc.NEW:"",roomEventId:this.Loc&&this.Loc.OLD_mrevid?parseInt(this.Loc.OLD_mrevid):"",focusSelector:e.focusSelector===true})},DestroyDestinationControls:function(){BX.removeCustomEvent("OnDestinationAddNewItem",BX.proxy(this.CheckPlannerState,this));BX.removeCustomEvent("OnDestinationUnselect",BX.proxy(this.CheckPlannerState,this));BX.removeCustomEvent("OnCalendarPlannerSelectorChanged",BX.proxy(this.OnCalendarPlannerSelectorChanged,this));BX.removeCustomEvent("OnCalendarPlannerScaleChanged",BX.proxy(this.OnCalendarPlannerScaleChanged,this));BX.removeCustomEvent("OnSetTab",BX.proxy(this.OnPlannerTabShow,this));BX.onCustomEvent("OnCalendarPlannerDoUninstall",[{plannerId:this.plannerId}])},OnPlannerTabShow:function(e,t){if(t&&e.tab==BX(this.id+"ed-tab-2")){var i="",n=this.oEC.ParseLocation(this.Loc.NEW,true);if(n.mrid)i=this.Loc.NEW;if(this.plannerLoadedTimezone!==this.pFromTz.value||this.plannerLoadedlocation!==i){this.CheckPlannerState()}else{this.RefreshPlannerState()}}},CheckPlannerState:function(){var e,t={codes:[]},i=this.oEC.ParseDate(BX.util.trim(this.pFromDate.value)),n=this.oEC.ParseDate(BX.util.trim(this.pToDate.value)),s=this.pDestValuesCont.getElementsByTagName("INPUT"),o=this.oEC.ParseLocation(this.Loc.NEW,true),a=o.mrind==undefined?false:o.mrind;for(e=0;e<s.length;e++){t.codes.push(s[e].value)}if(o.mrid)t.location=this.Loc.NEW;t.locationMrind=a;if(this.Loc&&this.Loc.OLD_mrevid)t.roomEventId=this.Loc.OLD_mrevid;if(i&&n&&i.getTime&&n.getTime&&i.getTime()<=n.getTime()&&(t.location||t.codes.length>0)){t.from=BX.date.format(this.oEC.DATE_FORMAT,(i.getTime()-this.oEC.dayLength*3)/1e3);t.to=BX.date.format(this.oEC.DATE_FORMAT,(n.getTime()+this.oEC.dayLength*10)/1e3);this.UpdatePlanner(t)}else if(this.pPlannerCont&&BX.hasClass(this.pPlannerCont,"event-grid-planner-cont-shown")){this.HidePlanner()}},UpdatePlanner:function(e){if(!e)e={};this.plannerLoadedTimezone=e.tzFrom||this.pFromTz.value;this.plannerLoadedlocation=e.location||"";var t=this,i=e.eventId||this.oEvent.ID||0,n=!i||!this.oEvent||!this.oEvent.IS_MEETING;this.oEC.Request({getData:this.oEC.GetReqData("update_planner",{codes:e.codes||[],cur_event_id:i,date_from:e.dateFrom||e.from||"",date_to:e.dateTo||e.to||"",timezone:this.plannerLoadedTimezone,location:this.plannerLoadedlocation,roomEventId:e.roomEventId||"",entries:e.entrieIds||false,add_cur_user_to_list:n?"Y":"N"}),handler:function(i){var n=!!(e.entries||i.entries&&i.entries.length>0),s=BX.hasClass(t.pPlannerCont,"event-grid-planner-cont-shown");if(n){var o={show:n&&!s};if(e.entries){i.entries=e.entries;o.scaleFrom=e.from;o.scaleTo=e.to}o.loadedDataFrom=e.from;o.loadedDataTo=e.to;o.data={entries:i.entries,accessibility:i.accessibility};o.focusSelector=e.focusSelector==undefined?false:e.focusSelector;t.ShowPlannerAnimation();t.RefreshPlannerState(o)}else if(!n&&s){t.HidePlanner()}}})},RefreshPlannerState:function(e){if(!e||typeof e!=="object")e={};this.plannerData=e.data;var t,i,n=this.pFullDay.checked,s={},o,a,r,c,h=this.pPlannerCont&&BX.hasClass(this.pPlannerCont,"event-grid-planner-cont-shown");if(e.focusSelector==undefined)e.focusSelector=true;if(n){t=this.oEC.ParseDate(BX.util.trim(this.pFromDate.value));i=this.oEC.ParseDate(BX.util.trim(this.pToDate.value))||t}else{t=this.oEC.ParseDate(BX.util.trim(this.pFromDate.value)+" "+BX.util.trim(this.pFromTime.value));if(this.pToDate.value=="")this.pToDate.value=this.pFromDate.value;i=this.oEC.ParseDate(BX.util.trim(this.pToDate.value)+" "+BX.util.trim(this.pToTime.value))}if(t&&i&&t.getTime&&i.getTime&&t.getTime()<=i.getTime()){if(!h&&!e.data){this.CheckPlannerState()}else{if(e.show){BX.addClass(this.pPlannerCont,"event-grid-planner-cont-shown");this.pMeetingParams.style.display="block";a=this.pPlannerCont.offsetWidth-8;if(!h&&e.show){e.focusSelector=true}}if(n){r=new Date(t.getTime());r=e.scaleFrom||new Date(r.getTime()-this.oEC.dayLength*3);c=e.scaleTo||new Date(r.getTime()+this.oEC.dayLength*10);s.scaleType="1day";s.scaleDateFrom=r;s.scaleDateTo=c;s.adjustCellWidth=false}else{s.changeFromFullDay={scaleType:"1hour",timelineCellWidth:40};s.shownScaleTimeFrom=parseInt(this.config.workTimeStart);s.shownScaleTimeTo=parseInt(this.config.workTimeEnd)}s.entriesListWidth=170;s.width=a;var l=false;if(this.RepeatCheck.checked){l={FREQ:this.RepeatSelect.value,INTERVAL:this.RepeatCount.value,UNTIL:this.RepeatDiapTo.value};if(l.UNTIL==EC_MESS.NoLimits)l.UNTIL="";if(l.FREQ=="WEEKLY"){l.WEEK_DAYS=[];for(o=0;o<7;o++){if(this.RepeatWeekDaysCh[o].checked){l.WEEK_DAYS.push(this.RepeatWeekDaysCh[o].value)}}if(!l.WEEK_DAYS.length){l=false}}}BX.onCustomEvent("OnCalendarPlannerDoUpdate",[{plannerId:this.plannerId,config:s,focusSelector:e.focusSelector,selector:{from:t,to:i,fullDay:!!this.pFullDay.checked,RRULE:l,animation:true,updateScaleLimits:true},data:e.data||false,loadedDataFrom:e.loadedDataFrom,loadedDataTo:e.loadedDataTo,show:!!e.show}])}}else if(h){this.HidePlanner()}},HidePlanner:function(){var e=this;this.pPlannerCont.style.opacity=1;this.pPlannerCont.style.display="";this.pPlannerCont.style.height=this.pPlannerCont.offsetHeight+"px";this.pPlannerCont.style.overflow="hidden";BX.onCustomEvent("OnCalendarPlannerDoUpdate",[{plannerId:this.plannerId,hide:true}]);this.pMeetingParams.style.display="none";new BX.easing({duration:600,start:{opacity:100,height:parseInt(this.pPlannerCont.offsetHeight),padding:14},finish:{opacity:0,height:0,padding:0},transition:BX.easing.makeEaseOut(BX.easing.transitions.quad),step:function(t){e.pPlannerCont.style.opacity=t.opacity/100;e.pPlannerCont.style.height=t.height+"px"},complete:function(){e.pPlannerCont.removeAttribute("style");BX.removeClass(e.pPlannerCont,"event-grid-planner-cont-shown")}}).animate()},ShowPlannerAnimation:function(){var e=this;this.pPlannerCont.style.opacity=0;this.pPlannerCont.style.display="";new BX.easing({duration:300,start:{opacity:0},finish:{opacity:100},transition:BX.easing.makeEaseOut(BX.easing.transitions.quad),step:function(t){e.pPlannerCont.style.opacity=t.opacity/100},complete:function(){e.pPlannerCont.removeAttribute("style")}}).animate()},InitDateTimeControls:function(){this.pFromToCont=BX("feed-cal-from-to-cont"+this.id);this.pFromDate=BX("feed-cal-event-from"+this.id);this.pToDate=BX("feed-cal-event-to"+this.id);this.pFromTime=BX("feed_cal_event_from_time"+this.id);this.pToTime=BX("feed_cal_event_to_time"+this.id);this.pFullDay=BX("event-full-day"+this.id);this.pDefTimezone=BX("event-tz-def"+this.id);this.pDefTimezoneWrap=BX("event-tz-def-wrap"+this.id);this.pDefTimezone.onchange=BX.proxy(this.DefaultTimezoneOnChange,this);this.pFromTz=BX("event-tz-from"+this.id);this.pToTz=BX("event-tz-to"+this.id);this.pTzOuterCont=BX("event-tz-cont-outer"+this.id);this.pTzSwitch=BX("event-tz-switch"+this.id);this.pTzCont=BX("event-tz-cont"+this.id);this.pTzInnerCont=BX("event-tz-inner-cont"+this.id);this.pTzSwitch.onclick=BX.proxy(this.TimezoneSwitch,this);this.pFromTz.onchange=BX.proxy(this.TimezoneFromOnChange,this);this.pToTz.onchange=BX.proxy(this.TimezoneToOnChange,this);new BX.CHint({parent:BX("event-tz-tip"+this.id),hint:EC_MESS.eventTzHint});new BX.CHint({parent:BX("event-tz-def-tip"+this.id),hint:EC_MESS.eventTzDefHint});this.pReminderCont=BX("feed-cal-reminder-cont"+this.id);this.pReminder=BX("event-reminder"+this.id);this.pRemType=BX("event_remind_type"+this.id);this.pRemCount=BX("event_remind_count"+this.id);this.pFullDay.onclick=BX.proxy(this.FullDay,this);this.pReminder.onclick=BX.proxy(this.Reminder,this);var t=this;this.pFromDate.onclick=function(){BX.calendar({node:this.parentNode,field:this,bTime:false})};this.pToDate.onclick=function(){BX.calendar({node:this.parentNode,field:this,bTime:false})};this.pFromDate.onchange=function(){if(t._FromDateValue){var e=BX.parseDate(t._FromDateValue),i=BX.parseDate(t.pFromDate.value),n=BX.parseDate(t.pToDate.value);if(i&&e){var s=n.getTime()-e.getTime();if(s<0)s=0;n=new Date(i.getTime()+s);if(n)t.pToDate.value=bxFormatDate(n.getDate(),n.getMonth()+1,n.getFullYear())}}t._FromDateValue=t.pFromDate.value};this.pFromTime.parentNode.onclick=this.pFromTime.onclick=e["bxShowClock_"+"feed_cal_event_from_time"+t.id];this.pToTime.parentNode.onclick=this.pToTime.onclick=e["bxShowClock_"+"feed_cal_event_to_time"+t.id];this.pFromTime.onchange=function(){var e=t.oEC.ParseDate(BX.util.trim(t.pFromDate.value)+" "+BX.util.trim(t.pFromTime.value));if(t.pToDate.value=="")t.pToDate.value=t.pFromDate.value;var i=t.oEC.ParseDate(BX.util.trim(t.pToDate.value)+" "+BX.util.trim(t.pToTime.value));if(t._FromTimeValue){var n=t.oEC.ParseDate(BX.util.trim(t.pFromDate.value)+" "+t._FromTimeValue);var s=i.getTime()-n.getTime();if(s<0)s=36e5;var o=new Date(e.getTime()+s);t.pToDate.value=t.oEC.FormatDate(o);t.pToTime.value=t.oEC.FormatTime(o)}t._FromTimeValue=t.pFromTime.value};var i,n;if(this.oEvent.ID){this.pFullDay.checked=this.bFullDay=this.oEvent.DT_SKIP_TIME=="Y";this.pFullDay.onclick();i=BX.parseDate(this.oEvent["~DATE_FROM"]||this.oEvent.DATE_FROM);n=BX.parseDate(this.oEvent["~DATE_TO"]||this.oEvent.DATE_TO);this.pFromDate.value=this.oEC.FormatDate(i);this.pToDate.value=this.oEC.FormatDate(n);if(this.oEvent.DT_SKIP_TIME!=="Y"){this.pFromTime.value=this.oEC.FormatTime(i);this.pToTime.value=this.oEC.FormatTime(n);this.pFromTz.value=this.oEvent.TZ_FROM||"";this.pToTz.value=this.oEvent.TZ_TO||"";if(this.oEvent.TZ_TO!==this.oEvent.TZ_FROM||this.oEvent.TZ_TO!==this.config.userTimezoneName||parseInt(this.oEvent["~USER_OFFSET_FROM"])>0||parseInt(this.oEvent["~USER_OFFSET_TO"])>0){this.pTzCont.style.height=this.pTzInnerCont.offsetHeight+"px";BX.addClass(this.pTzOuterCont,"bxec-timezone-outer-wrap-opened")}}if(this.oEvent.REMIND&&this.oEvent.REMIND.length>0){this.pReminder.checked=true;this.pRemType.value=this.oEvent.REMIND[0].type;this.pRemCount.value=this.oEvent.REMIND[0].count;this.Reminder(false,true)}else{this.pReminder.checked=false;this.pRemType.value="min";this.pRemCount.value="15";this.Reminder(false,false)}if(this.config.userTimezoneName){this.pDefTimezoneWrap.style.display="none"}else{this.pDefTimezoneWrap.style.display="";this.pDefTimezone.value=this.config.userTimezoneDefault||""}}else{i=this.oEC.GetUsableDateTime((new Date).getTime(),15);n=this.oEC.GetUsableDateTime(i.getTime()+36e5,15);this.pFromDate.value=this.oEC.FormatDate(i);this.pFromTime.value=this.oEC.FormatTime(i);this.pToDate.value=this.oEC.FormatDate(n);this.pToTime.value=this.oEC.FormatTime(n);if(this.config.userTimezoneName){this.pDefTimezoneWrap.style.display="none";this.pDefTimezone.value=this.config.userTimezoneName;this.pFromTz.value=this.pToTz.value=this.config.userTimezoneName}else{this.pDefTimezoneWrap.style.display="";this.pFromTz.value=this.pToTz.value=this.pDefTimezone.value=this.config.userTimezoneDefault||""}this.pFullDay.checked=false;this.FullDay(false,true);this.pReminder.checked=true;this.pRemType.value="min";this.pRemCount.value="15";this.Reminder(false,true)}this.linkFromToTz=this.pFromTz.value==this.pToTz.value;this.linkFromToDefaultTz=this.pFromTz.value==this.pToTz.value&&this.pFromTz.value==this.pDefTimezone.value;this._FromTimeValue=this.pFromTime.value;this._FromDateValue=this.pFromDate.value},FillFormFields:function(){var e=this;this.pName=BX(this.id+"_edit_ed_name");this.pName.value=this.oEvent.NAME||"";this.Title=this.config.Title;this.pName.onkeydown=this.pName.onchange=function(){if(this._titleTimeout)clearTimeout(this._titleTimeout);this._titleTimeout=setTimeout(function(){var t=BX.util.htmlspecialchars(e.pName.value);e.Title.innerHTML=(e.oEvent.ID?EC_MESS.EditEvent:EC_MESS.NewEvent)+(t!=""?": "+t:"")},20)};this.Location=new BXInputPopup({id:this.id+"loc_1",values:this.oEC.bUseMR?this.oEC.meetingRooms:false,input:BX(this.id+"_planner_location1"),defaultValue:EC_MESS.SelectMR,openTitle:EC_MESS.OpenMRPage,className:"calendar-inp calendar-inp-time",noMRclassName:"calendar-inp calendar-inp-time"});this.Loc={};BX.addCustomEvent(this.Location,"onInputPopupChanged",BX.proxy(this.LocationOnChange,this));if(this.oEvent.ID){var t=BX.util.htmlspecialcharsback(this.oEvent.LOCATION);this.Loc.OLD=t;this.Loc.NEW=t;var i=this.oEC.ParseLocation(t,true);if(i.mrid&&i.mrevid){this.Location.Set(i.mrind,"");this.Loc.OLD_mrid=i.mrid;this.Loc.OLD_mrevid=i.mrevid}else{this.Location.Set(false,t)}}else{this.Location.Set(false,"")}this.pAccessibility=BX(this.id+"_bxec_accessibility");if(this.pAccessibility)this.pAccessibility.value=this.oEvent.ACCESSIBILITY||"busy";this.pPrivate=BX(this.id+"_bxec_private");if(this.pPrivate)this.pPrivate.checked=this.oEvent.PRIVATE_EVENT||false;this.pImportance=BX(this.id+"_bxec_importance");if(this.pImportance)this.pImportance.value=this.oEvent.IMPORTANCE||"normal";this.pSectSelect=BX(this.id+"_edit_ed_calend_sel");var n=this.oEvent.SECT_ID||this.oEC.GetLastSection();if(!this.oEC.oSections[n]){n=this.oEC.arSections[0].ID;this.oEC.SaveLastSection(n)}this.oEC.BuildSectionSelect(this.pSectSelect,n);this.pSectSelect.onchange=function(){var t=this.value;if(e.oEC.oSections[t]){e.oEC.SaveLastSection(t);e.ColorControl.Set(e.oEC.oSections[t].COLOR,e.oEC.oSections[t].TEXT_COLOR)}};this.RepeatCheck=BX(this.id+"_edit_ed_rep_check");this.RepeatSelect=BX(this.id+"_edit_ed_rep_sel");this.RepeatCont=BX(this.id+"_edit_ed_rep_cont");this.RepeatPhrase1=BX(this.id+"_edit_ed_rep_phrase1");this.RepeatPhrase2=BX(this.id+"_edit_ed_rep_phrase2");this.RepeatWeekDays=BX(this.id+"_edit_ed_rep_week_days");this.RepeatCount=BX(this.id+"_edit_ed_rep_count");this.RepeatEndsOnNever=BX(this.id+"edit-ev-rep-endson-never");this.RepeatEndsOnCount=BX(this.id+"edit-ev-rep-endson-count");this.RepeatEndsOnUntil=BX(this.id+"edit-ev-rep-endson-until");this.RepeatDiapTo=BX(this.id+"edit-ev-rep-diap-to");this.RepeatCountInp=BX(this.id+"edit-ev-rep-endson-count-input");this.RepeatSelect.onchange=function(){e.RepeatSelectOnChange(this.value)};this.RepeatCount.onmousedown=function(){e.bEditEventDialogOver=true};this.RepeatCheck.onclick=function(){if(this.checked)BX.addClass(e.RepeatCont,"bxec-popup-row-repeat-show");else BX.removeClass(e.RepeatCont,"bxec-popup-row-repeat-show")};BX.bind(this.RepeatEndsOnNever,"change",BX.proxy(this.EndsOnChange,this));BX.bind(this.RepeatEndsOnCount,"change",BX.proxy(this.EndsOnChange,this));BX.bind(this.RepeatEndsOnUntil,"change",BX.proxy(this.EndsOnChange,this));BX.bind(this.RepeatDiapTo,"click",BX.proxy(function(){this.RepeatEndsOnUntil.checked="checked";BX.calendar({node:this.RepeatDiapTo,field:this.RepeatDiapTo,bTime:false});BX.focus(this.RepeatDiapTo);this.EndsOnChange()},this));BX.bind(this.RepeatCountInp,"click",BX.proxy(function(){this.RepeatEndsOnCount.checked="checked";BX.focus(this.RepeatCountInp);this.EndsOnChange()},this));if(this.oEC.Event.IsRecursive(this.oEvent)){this.RepeatCheck.checked=true;this.RepeatSelect.value=this.oEvent.RRULE.FREQ}else{this.RepeatCheck.checked=false}this.RepeatCheck.onclick();this.RepeatSelect.onchange();this.ColorControl=this.oEC.InitColorDialogControl("event",function(t,i){e.Color=t;e.TextColor=i});if(!this.oEvent.displayColor&&this.oEC.oSections[n])this.oEvent.displayColor=this.oEC.oSections[n].COLOR;if(!this.oEvent.displayTextColor&&this.oEC.oSections[n])this.oEvent.displayTextColor=this.oEC.oSections[n].TEXT_COLOR;if(this.oEvent.displayColor)this.ColorControl.Set(this.oEvent.displayColor,this.oEvent.displayTextColor);else if(this.oEC.oSections[n])this.ColorControl.Set(this.oEC.oSections[n].COLOR,this.oEC.oSections[n].TEXT_COLOR)},EndsOnChange:function(){if(this.RepeatEndsOnNever.checked){this.RepeatCountInp.value="";this.RepeatDiapTo.value=""}else if(this.RepeatEndsOnCount.checked){this.RepeatDiapTo.value="";if(!this.RepeatCountInp.value)this.RepeatCountInp.value=this.RepeatCountInp.placeholder;BX.focus(this.RepeatCountInp);this.RepeatCountInp.select()}else{this.RepeatCountInp.value="";BX.focus(this.RepeatDiapTo);this.RepeatDiapTo.select()}},LocationOnChange:function(e,t,i){this.Loc.NEW=t===false?i||"":"ECMR_"+this.oEC.meetingRooms[t].ID},RepeatSelectOnChange:function(e){var t,i,n;e=e.toUpperCase();if(e=="NONE"){}else{this.RepeatPhrase2.innerHTML=EC_MESS.DeDot;if(e=="WEEKLY"){this.RepeatPhrase1.innerHTML=EC_MESS.EveryF;this.RepeatPhrase2.innerHTML+=EC_MESS.WeekP;this.RepeatWeekDays.style.display=e=="WEEKLY"?"inline-block":"none";i={};if(!this.RepeatWeekDaysCh){this.RepeatWeekDaysCh=[];for(t=0;t<7;t++)this.RepeatWeekDaysCh[t]=BX(this.id+"bxec_week_day_"+t)}if(this.oEvent&&this.oEvent.ID&&this.oEvent.RRULE&&this.oEvent.RRULE.BYDAY){i=this.oEvent.RRULE.BYDAY}else{n=BX.parseDate(this.pFromDate.value);if(!n)n=bxGetDateFromTS(this.oEvent.DT_FROM_TS);if(n)i[this.oEC.GetWeekDayByInd(n.getDay())]=true}for(t=0;t<7;t++)this.RepeatWeekDaysCh[t].checked=!!i[this.RepeatWeekDaysCh[t].value]}else{if(e=="YEARLY")this.RepeatPhrase1.innerHTML=EC_MESS.EveryN;else this.RepeatPhrase1.innerHTML=EC_MESS.EveryM;if(e=="DAILY")this.RepeatPhrase2.innerHTML+=EC_MESS.DayP;else if(e=="MONTHLY")this.RepeatPhrase2.innerHTML+=EC_MESS.MonthP;else if(e=="YEARLY")this.RepeatPhrase2.innerHTML+=EC_MESS.YearP;this.RepeatWeekDays.style.display="none"}var s=this.oEvent&&this.oEC.Event.IsRecursive(this.oEvent);this.RepeatCount.value=!this.oEvent.ID||!s?1:this.oEvent.RRULE.INTERVAL;if(!this.oEvent.ID||!s){this.RepeatEndsOnNever.checked=true}else{if(this.oEvent.RRULE&&this.oEvent.RRULE.COUNT>0){this.RepeatCountInp.value=parseInt(this.oEvent.RRULE.COUNT);this.RepeatEndsOnCount.checked=true}else if(this.oEvent.RRULE&&this.oEvent.RRULE["~UNTIL"]){this.RepeatDiapTo.value=this.oEvent.RRULE["~UNTIL"];this.RepeatEndsOnUntil.checked=true}else{this.RepeatEndsOnNever.checked=true}this.EndsOnChange()}}},CustomizeHtmlEditor:function(e){if(e.toolbar.controls&&e.toolbar.controls.spoiler){BX.remove(e.toolbar.controls.spoiler.pCont)}},FullDay:function(e,t){if(t==undefined)t=!this.bFullDay;if(t&&this.pFromDate.value!==""&&this.pFromTime.value===""&&this.pToDate.value!==""&&this.pToTime.value===""){var i=BX.parseDate(this.pFromDate.value),n=BX.parseDate(this.pToDate.value),s=i.getTime()===n.getTime();if(i){i.setHours(12);i.setMinutes(0);this.pFromTime.value=this.oEC.FormatTime(i)}if(n){n.setHours(s?13:12);n.setMinutes(0);this.pToTime.value=this.oEC.FormatTime(n)}this.UpdateAccessibility()}if(t&&this.config.userTimezoneName&&(this.pFromTz.value==""||this.pToTz.value=="")){this.pFromTz.value=this.pToTz.value=this.pDefTimezone.value=this.config.userTimezoneName}if(t){BX.removeClass(this.pFromToCont,"feed-cal-full-day")}else{BX.addClass(this.pFromToCont,"feed-cal-full-day")}this.bFullDay=t},Reminder:function(e,t){if(t==undefined)t=!this.bReminder;this.pReminderCont.className=t?"bxec-reminder":"bxec-reminder-collapsed";this.bReminder=t},TimezoneSwitch:function(){if(this.pTzCont.offsetHeight>0){this.pTzCont.style.height=0;BX.removeClass(this.pTzOuterCont,"bxec-timezone-outer-wrap-opened")}else{this.pTzCont.style.height=this.pTzInnerCont.offsetHeight+"px";BX.addClass(this.pTzOuterCont,"bxec-timezone-outer-wrap-opened")}},DefaultTimezoneOnChange:function(){var e=this.pDefTimezone.value;BX.userOptions.save("calendar","timezone_name","timezone_name",e);if(this.linkFromToDefaultTz)this.pToTz.value=this.pFromTz.value=this.pDefTimezone.value},TimezoneFromOnChange:function(){if(this.linkFromToTz)this.pToTz.value=this.pFromTz.value;this.linkFromToDefaultTz=false},TimezoneToOnChange:function(){this.linkFromToTz=false;this.linkFromToDefaultTz=false},UpdateAccessibility:function(e){var t=this;if(e!==false){if(this.updateAccessibilityTimeout)this.updateAccessibilityTimeout=clearTimeout(this.updateAccessibilityTimeout);this.updateAccessibilityTimeout=setTimeout(function(){t.UpdateAccessibility(false)},500);return}},ParseDateFromTo:function(){var e=this.pFromDate.value,t=this.pToDate.value;if(!this.pFullDay.checked){e+=" "+this.pFromTime.value;t+=" "+this.pToTime.value}return{from:this.oEC.ParseDate(e),to:this.oEC.ParseDate(t)}}};e.ECDragDropControl=function(e){this.oEC=e.calendar;this.enabled=true};e.ECDragDropControl.prototype={Reset:function(){jsDD.Reset()},RegisterDay:function(e){if(!this.enabled)return;var t=this;jsDD.registerDest(e);e.onbxdestdragfinish=function(i,n,s){if(t.oDiv){var o=parseInt(t.oDiv.getAttribute("data-bx-event-ind")),a=new Date(t.oEC.activeDateDays[t.oEC.GetDayIndexByElement(e.parentNode)].getTime());if(!isNaN(o)&&t.oEC.arEvents[o])t.MoveEventToNewDate(t.oEC.arEvents[o],a,"day");BX.removeClass(e,"bxc-day-drag")}t.OnDragFinish();return true};e.onbxdestdraghover=function(i,n,s){if(t.oDiv)BX.addClass(e,"bxc-day-drag")};e.onbxdestdraghout=function(i,n,s){if(t.oDiv)BX.removeClass(e,"bxc-day-drag")}},RegisterTitleDay:function(e,t,i){if(!this.enabled)return;var n=this;jsDD.registerDest(e);jsDD.registerDest(t);e.onbxdestdragfinish=t.onbxdestdragfinish=function(s,o,a){if(n.oDiv){var r=parseInt(n.oDiv.getAttribute("data-bx-event-ind")),c=parseInt(e.getAttribute("data-bx-day-ind")),h=n.oEC.Tabs[i].arDays[c],l=new Date;l.setFullYear(h.year,h.month,h.date);if(!isNaN(r)&&n.oEC.arEvents[r])n.MoveEventToNewDate(n.oEC.arEvents[r],l,"day")}BX.removeClass(e,"bxc-day-drag");BX.removeClass(t,"bxc-day-drag");n.OnDragFinish();return true};e.onbxdestdraghover=t.onbxdestdraghover=function(i,n,s){BX.addClass(e,"bxc-day-drag");BX.addClass(t,"bxc-day-drag")};e.onbxdestdraghout=t.onbxdestdraghout=function(i,n,s){BX.removeClass(e,"bxc-day-drag");BX.removeClass(t,"bxc-day-drag")}},RegisterTimeline:function(e,t){if(!this.enabled)return;var i=this;jsDD.registerDest(e);e.onbxdestdragfinish=function(n,s,o){if(i.oDiv){var a=parseInt(i.oDiv.getAttribute("data-bx-event-ind"));if(isNaN(a)||!i.oEC.arEvents[a])return;var r=i.oEC.arEvents[a];if(n.getAttribute("data-bx-event-resizer")=="Y"){var c=parseInt(i.oDiv.getAttribute("data-bx-original-height"),10),h=i.oDiv.offsetHeight-c,l=parseInt((h-1)/40*3600);i.ResizeEventTimeline(r,l)}else{var d=i.oDiv.getAttribute("data-bx-day-index");if(d!=undefined&&t.arDays[d]){var p=t.arDays[d],u=parseInt(i.oDiv.style.top,10)-BX.pos(e).top+e.scrollTop,f=Math.max((u-1)/42*60,0);f=Math.round(f/10)*10;var E=parseInt(f/60,10),C=Math.max(f-E*60,0),m=new Date;m.setFullYear(p.year,p.month,p.date);m.setHours(E);m.setMinutes(C);m.setSeconds(0);if(i.oDiv.getAttribute("data-bx-title-event")){r.DT_SKIP_TIME="N";i.MoveEventToNewDate(r,m,"timeline",36e5)}else i.MoveEventToNewDate(r,m,"timeline")}}}i.OnDragFinish();return true};e.onbxdestdraghover=function(n,s,o){i.timeLineEventOver=true;i.PrepareTimelineDaysPos(e,t);BX.addClass(e,"bxec-timeline-div-drag")};e.onbxdestdraghout=function(t,n,s){i.ClearTimeline(e)};e.onbxdestdragstop=function(t,n,s){i.ClearTimeline(e)}},ClearTimeline:function(e){this.timeLineEventOver=false;BX.removeClass(e,"bxec-timeline-div-drag");jsDD.current_dest_index=false},GetTimelinePos:function(e){return e.__bxpos},PrepareTimelineDaysPos:function(e,t){this.timeLinePos=this.GetTimelinePos(e);var i=t.pTimelineTable.rows[0];var n,s,o;this.arDays=[];for(var s=1;s<i.cells.length;s++){n=i.cells[s];o=BX.pos(n);o._left=o.left-this.timeLinePos[0];o._right=o.right-this.timeLinePos[0];this.arDays.push(o)}if(!this.activeDayDrop){this.activeDayDrop=BX.create("DIV",{props:{className:"bxec-timeline-active-day-drag-selector"}});this.activeDayDrop.style.height=parseInt(t.pTimelineTable.offsetHeight,10)+"px"}if(this.activeDayDrop.parentNode!=e)e.appendChild(this.activeDayDrop);if(!this.timelineDragOverlay){this.timelineDragOverlay=BX.create("DIV",{props:{className:"bxec-timeline-drag-overlay"}});this.timelineDragOverlay.style.height=parseInt(t.pTimelineTable.offsetHeight,10)+"px"}if(this.timelineDragOverlay.parentNode!=e)e.appendChild(this.timelineDragOverlay)},CheckTimelineOverPos:function(e,t){if(this.timeLineEventOver){this.activeDayDrop.style.display="block";var i,n=this.arDays.length;for(i=0;i<n;i++){if(e>=this.arDays[i].left&&e<=this.arDays[i].right){this.activeDayDrop.style.left=this.arDays[i]._left-1+"px";this.activeDayDrop.style.width=this.arDays[i].width-1+"px";this.oDiv.style.width=this.arDays[i].width-5+"px";this.oDiv.style.left=this.arDays[i].left+1+"px";this.oDiv.style.top=t-10+"px";this.oDiv.setAttribute("data-bx-day-index",i);break}}}else{if(this.activeDayDrop)this.activeDayDrop.style.display="none"}},RegisterEvent:function(e,t,i){if(!this.enabled)return;var n=t["~TYPE"]=="tasks"||!this.oEC.Event.CanDo(t,"edit");if(this.oEC.Event.IsMeeting(t)&&!this.oEC.Event.IsHost(t))n=true;if(t.PRIVATE_EVENT&&!this.oEC.Personal())n=true;var s=this;jsDD.registerObject(e);e.setAttribute("data-bx-title-event",true);e.onbxdragstart=function(){if(n){s.oDiv=null;document.body.style.cursor="default";s.ShowDenyNotice(e,t)}else{s.oDiv=e.cloneNode(true);s.oDiv.className="bxec-event bxec-event-drag";document.body.appendChild(s.oDiv);s.oDiv.style.top="-1000px";s.oDiv.style.left="-1000px";var i=s.oEC.MoreEventsWin;if(i){i.close();i.destroy();i=null}}};e.onbxdrag=function(e,t){if(s.oDiv){s.oDiv.style.left=e-20+"px";s.oDiv.style.top=t-10+"px";if(i=="week_title"){s.CheckTimelineOverPos(e,t)}}};e.onbxdragstop=function(e,t){if(s.oDiv){setTimeout(function(){if(s.oDiv&&s.oDiv.parentNode){s.oDiv.parentNode.removeChild(s.oDiv);s.oDiv=null}},100)}s.OnDragFinish()};e.onbxdragfinish=function(e,t,i){s.OnDragFinish();return true}},RegisterTimelineEvent:function(e,t,i){if(!this.enabled)return;var n=t["~TYPE"]=="tasks"||!this.oEC.Event.CanDo(t,"edit");if(this.oEC.Event.IsMeeting(t)&&!this.oEC.Event.IsHost(t))n=true;if(t.PRIVATE_EVENT&&!this.oEC.Personal())n=true;var s=this;jsDD.registerObject(e);e.onbxdragstart=function(){if(n){s.oDiv=null;document.body.style.cursor="default";s.ShowDenyNotice(e,t)}else{s.oDiv=e.cloneNode(true);s.oDiv.className="bxec-tl-event bxec-event-drag";document.body.appendChild(s.oDiv);s.oDiv.style.top="-1000px";s.oDiv.style.left="-1000px"}};e.onbxdrag=function(e,t){if(!s.oDiv)return;if(s.timeLineEventOver){var i,n=s.arDays.length;for(i=0;i<n;i++){if(e>=s.arDays[i].left&&e<=s.arDays[i].right){s.oDiv.style.width=s.arDays[i].width-15+"px";s.oDiv.style.left=s.arDays[i].left+1+"px";s.oDiv.style.top=t-10+"px";s.oDiv.setAttribute("data-bx-day-index",i);break}}}};e.onbxdragstop=function(e,t){s.OnDragFinish();if(!s.oDiv)return;setTimeout(function(){if(s.oDiv&&s.oDiv.parentNode){s.oDiv.parentNode.removeChild(s.oDiv);s.oDiv=null}},100)};e.onbxdragfinish=function(e,t,i){s.OnDragFinish()}},RegisterTimelineEventResizer:function(t,i,n,s){if(!this.enabled)return;var o=n["~TYPE"]=="tasks"||!this.oEC.Event.CanDo(n,"edit");t.setAttribute("data-bx-event-resizer","Y");BX.bind(t,"mousedown",function(t){var n=BX.GetWindowSize();t=t||e.event;a.timelineResize={oDiv:i,startY:t.clientY+n.scrollTop,height:parseInt(i.offsetHeight)}});var a=this;jsDD.registerObject(t);t.onbxdragstart=function(){if(o){a.oDiv=null;document.body.style.cursor="default";a.ShowDenyNotice(t,n);return}document.body.style.cursor="s-resize";a.oDiv=i;BX.removeClass(a.oDiv,"bxec-tl-ev-hlt")};t.onbxdrag=function(e,t){if(a.oDiv&&a.timeLineEventOver){var i=a.timelineResize.height+t-a.timelineResize.startY+5;if(i<=0)i=5;a.timelineResize.oDiv.style.height=i+"px"}};t.onbxdragstop=function(e,t){a.OnDragFinish();if(!a.oDiv)return};t.onbxdragfinish=function(e,t,i){a.OnDragFinish()}},ResizeEventTimeline:function(e,t){var i=[],n=this;e.DT_LENGTH=Math.max(parseInt(e.DT_LENGTH,10)+t,0);e.DT_LENGTH=Math.round(e.DT_LENGTH/600)*600;e.dateTo.setTime(e.dateFrom.getTime()+e.DT_LENGTH*1e3);e.DATE_TO=this.oEC.FormatDateTime(e.dateTo);if(this.oEC.Event.IsMeeting(e)){e["~ATTENDEES"].forEach(function(e){i.push(e["USER_ID"])})}var s=e.TZ_FROM!=this.oEC.arConfig.userTimezoneName||e.TZ_TO!=this.oEC.arConfig.userTimezoneName;this.oEC.Request({postData:this.oEC.GetReqData("move_event_to_date",{id:e.ID,current_date_from:e.DATE_FROM,recursive:this.oEC.Event.IsRecursive(e)?"Y":"N",is_meeting:this.oEC.Event.IsMeeting(e)?"Y":"N",attendees:i,date_from:e.DATE_FROM,date_to:e.DATE_TO,section:e.SECT_ID,skip_time:e.DT_SKIP_TIME,timezone:s?this.oEC.arConfig.userTimezoneName:e.TZ_FROM,set_timezone:s?"Y":"N"}),errorText:EC_MESS.EventSaveError,handler:function(t){if(t.reload||n.oEC.Event.IsRecursive(e))n.oEC.Event.ReloadAll(false);return true}});this.oEC.Event.PreHandle(e);this.oEC.Event.Display()},MoveEventToNewDate:function(e,t,i,n){var s=[],o=this,a=864e5,r;if(i=="day"&&e.DT_SKIP_TIME=="N"){t.setHours(e.dateFrom.getHours()||0);t.setMinutes(e.dateFrom.getMinutes()||0)}if(n){r=new Date(t.getTime()+n)}else if(e.DT_SKIP_TIME=="N"){r=new Date(t.getTime()+e.DT_LENGTH*1e3)}else if(e.DT_SKIP_TIME=="Y"){r=new Date(t.getTime()+e.DT_LENGTH*1e3-a)}var c=e.DATE_FROM;e.DATE_FROM=e.DT_SKIP_TIME=="Y"?this.oEC.FormatDate(t):this.oEC.FormatDateTime(t);e.DATE_TO=e.DT_SKIP_TIME=="Y"?this.oEC.FormatDate(r):this.oEC.FormatDateTime(r);if(this.oEC.Event.IsMeeting(e)){e["~ATTENDEES"].forEach(function(e){s.push(e["USER_ID"])})}var h=e.TZ_FROM!=this.oEC.arConfig.userTimezoneName||e.TZ_TO!=this.oEC.arConfig.userTimezoneName;this.oEC.Request({postData:this.oEC.GetReqData("move_event_to_date",{id:e.ID,current_date_from:c,recursive:this.oEC.Event.IsRecursive(e)?"Y":"N",is_meeting:this.oEC.Event.IsMeeting(e)?"Y":"N",attendees:s,date_from:e.DATE_FROM,date_to:e.DATE_TO,section:e.SECT_ID,skip_time:e.DT_SKIP_TIME,timezone:h?this.oEC.arConfig.userTimezoneName:e.TZ_FROM,set_timezone:h?"Y":"N"}),errorText:EC_MESS.EventSaveError,handler:function(t){if(t.reload||o.oEC.Event.IsRecursive(e))o.oEC.Event.ReloadAll(false);if(o.oEC.Event.IsMeeting(e)&&t.busy_warning){alert(EC_MESS.EC_BUSY_ALERT)}return true}});if(e.DT_SKIP_TIME=="N"){e["~USER_OFFSET_FROM"]=0;e["~USER_OFFSET_TO"]=0;e.TZ_FROM=e.TZ_TO=this.oEC.arConfig.userTimezoneName}if(n!=undefined)e.DT_LENGTH=parseInt(n,10)/1e3;this.oEC.Event.PreHandle(e);this.oEC.Event.Display()},ShowDenyNotice:function(e,t){if(!this.pNotice)this.pNotice=document.body.appendChild(BX.create("DIV",{props:{className:"bxec-event-drag-deny-notice"}}));if(this.bNoticeShown)this.HideDenyNotice();if(t["~TYPE"]=="tasks")this.pNotice.innerHTML=EC_MESS.ddDenyTask;else this.pNotice.innerHTML=EC_MESS.ddDenyEvent;var i=BX.align(e,250,50,"top");this.pNotice.style.left=i.left+"px";this.pNotice.style.top=i.top+"px";this.pNotice.style.display="block";this.bNoticeShown=true;BX.bind(document,"mouseup",BX.proxy(this.HideDenyNotice,this))},HideDenyNotice:function(){if(this.bNoticeShown){this.bNoticeShown=false;if(this.pNotice)this.pNotice.style.display="none";BX.unbind(document,"mouseup",BX.proxy(this.HideDenyNotice,this))}},OnDragFinish:function(){},IsDragDropNow:function(){return jsDD.bStarted}}})(window);