Your IP : 3.139.80.107
JCEC.prototype.BuildWeekDaysTable=function(){var e=this.Tabs["week"],t=e.pBodyCont.rows[0],i=e.pBodyCont.rows[1],s=e.pBodyCont.rows[2],o,a;for(o=0;o<7;o++){t.insertCell(o+1);a=i.insertCell(o+1);a.innerHTML='<div class="bxec-wdv-more-ev"> </div>'}s.cells[0].colSpan="9";e.pTimelineCont=BX(this.id+"-week-timeline-wrap");this.ResizeTabTitle(e)};JCEC.prototype.ResizeTabTitle=function(e){var t=bxInt(e.pBodyCont.parentNode.offsetWidth)-40-16,i,s;if(e.id=="week"){e.dayColWidth=Math.round(t/7);e.arDayColWidth=[];i=t-e.dayColWidth*7;for(s=0;s<7;s++){e.arDayColWidth[s]=e.dayColWidth;if(i<0){e.arDayColWidth[s]--;i++}else if(i>0){e.arDayColWidth[s]++;i--}}}else if(e.id=="day"){e.dayColWidth=t;e.arDayColWidth=[e.dayColWidth]}};JCEC.prototype.FillWeekDaysTitle=function(e){this.dragDrop.Reset();var t=this.Tabs[e.tabId],i=t.pBodyCont,s=i.rows[0],o=i.rows[1],a=e.startDate,r=[],l=this,n,d,h,c,y,T,m,f,p,C,u,D,b;t.curDay=false;for(n=1;n<=e.count;n++){y=this.ConvertDayIndex(a.getDay());T=a.getDate();m=a.getMonth();f=a.getFullYear();h=this.days[y][1]+", "+a.getDate();c=this.days[y][0]+", "+a.getDate()+" "+this.arConfig.month_r[m]+" "+f;u=s.cells[n];D=o.cells[n];u.setAttribute("data-bx-day-ind",n-1);D.setAttribute("data-bx-day-ind",n-1);b=BX.create("A",{props:{className:"bxec-day-link",href:"javascript:void(0)",title:EC_MESS.GoToDay},html:h});BX.cleanNode(u);u.style.width=t.arDayColWidth[n-1]-2+"px";u.appendChild(this.CreateStrut(t.arDayColWidth[n-1]-2));u.appendChild(b);b.onmousedown=function(e){return BX.PreventDefault(e)};b.onclick=function(e){var i=t.arDays[this.parentNode.cellIndex-1];l.SetTab("day",false,{bSetDay:false});l.SetDay(i.date,i.month,i.year);return BX.PreventDefault(e)};u.title=c;C=(this.week_holidays[y]||this.year_holidays[T+"."+m])&&!this.year_workdays[T+"."+m];p=T==this.currentDate.date&&m==this.currentDate.month&&f==this.currentDate.year;d="";if(p||C){if(p){d="bxec-cur-day";t.curDay={cellInd:n}}if(C)d+=" bxec-hol-day"}u.className=D.className=d;r.push({day:y,date:T,month:m,year:f,bHoliday:C,bCurDay:p,pWnd:u,pMoreEvents:D,Events:{begining:[],hidden:[],all:[]},EventsCount:0});if(!this.bReadOnly){u.onmousedown=D.onmousedown=function(){l.DayTitleOnMouseDown(this,e.tabId)};u.onmouseup=D.onmouseup=function(t){if(!l.dragDrop.IsDragDropNow()){l.DayTitleOnMouseUp(this,e.tabId);BX.PreventDefault(t)}};u.onmouseover=D.onmouseover=function(){l.DayTitleOnMouseOver(this,e.tabId)}}a.setDate(a.getDate()+1);if(n==1)t.activeFirst=new Date(f,m,T).getTime();if(n==e.count)t.activeLast=new Date(f,m,T,23,59).getTime();this.dragDrop.RegisterTitleDay(u,D,t.id)}return r};JCEC.prototype.BuildTimelineGrid=function(e,t){var i=BX.create("TABLE",{props:{className:"bxec-wdv-timeline-tbl"}}),s="",o="",a=this,r=e.id,l,n,d,h,c,y,T,m,f,p,C=this.arConfig.workTime[0].split("."),u=this.arConfig.workTime[1].split("."),D=bxIntEx(C[0]),b=bxIntEx(C[1]),w=bxIntEx(u[0]),v=bxIntEx(u[1]);e.arDays=t;if(e.pTimelineCont)BX.cleanNode(e.pTimelineCont);for(l=0;l<24;l++){f=l<D+1&&b==30||l>=w&&v==0||l>w||l<D;p=l>=w&&v==30||l<D||l>=w;s=f?" bxec-wdv-hol-row":"";o=p?" bxec-wdv-hol-row":"";d=i.insertRow(-1);d.className="bxec-half-time-row1"+s;c=d.insertCell(-1);c.innerHTML=this.FormatTimeByNum(l);c.rowSpan="2";c.className="bxec-time";h=i.insertRow(-1);h.className="bxec-half-time-row2"+o;for(n=0;n<e.daysCount;n++){y=d.insertCell(-1);if(l==0){y.style.width=e.arDayColWidth[n]-2+"px";y.appendChild(this.CreateStrut(e.arDayColWidth[n]-2))}T=h.insertCell(-1);if(!this.bReadOnly){y.onmousedown=T.onmousedown=function(){a.TimeCellOnMouseDown(this,r)};y.onmouseup=T.onmouseup=function(){a.TimeCellOnMouseUp(this,r)};y.onmouseover=T.onmouseover=function(){a.TimeCellOnMouseOver(this,r)}}m=t[n];if(!m.bHoliday&&!m.bCurDay)continue;if(m.bHoliday){BX.addClass(y,"bxec-time-hol-c1");BX.addClass(T,"bxec-time-hol-c2")}if(m.bCurDay){BX.addClass(y,"bxec-time-cur-c1");BX.addClass(T,"bxec-time-cur-c2")}}}i.rows[0].cells[0].appendChild(this.CreateStrut(40));if(BX.browser.IsIE()){setTimeout(function(){try{var t=i.rows[0].cells[i.rows[0].cells.length-1];var s=e.pBodyCont.rows[0].cells[e.pBodyCont.rows[0].cells.length-2];if(t.offsetLeft-s.offsetLeft>2)t.style.width=e.dayColWidth+50+"px"}catch(e){}},500)}e.pTimelineTable=i;e.pTimelineCont.appendChild(i);i.parentNode.style.width="100%";setTimeout(function(){e.pTimelineCont.scrollTop=40*bxInt(D);if(e.id=="week"){var t=3;if(BX.browser.IsChrome()||BX.browser.IsSafari())t=6;i.style.width=e.pBodyCont.offsetWidth-t+"px";i.parentNode.style.width=e.pBodyCont.offsetWidth-t+"px"}},0);if(e.curDay)setTimeout(function(){a.ShowCurTimePointer(r)},100);else this.HideCurTimePointer(r);this.dragDrop.RegisterTimeline(e.pTimelineCont,e);this.BuildWeekEventHolder()};JCEC.prototype.TimeCellOnMouseOver=function(e,t){if(this.selectTimeMode){this.selectTimeEndObj=e;this.SelectTime(t)}};JCEC.prototype.TimeCellOnMouseDown=function(e,t){this.selectTimeMode=true;this.selectTimeStartObj=this.selectTimeEndObj=e;if(e.className.indexOf("bxec-time-selected")==-1)return this.SelectTime(t);this.selectTimeMode=false;this.DeSelectTime(t);this.CloseAddEventDialog()};JCEC.prototype.TimeCellOnMouseUp=function(){if(!this.selectTimeMode)return;this.ShowAddEventDialog();this.selectTimeMode=false};JCEC.prototype.DayTitleOnMouseOver=function(e,t){if(this.selectTimeMode&&!this.selectDayTMode){var i=this.__GetRelativeCell(e);this.selectTimeEndObj=this.Tabs[t].pTimelineTable.rows[i.rowInd].cells[i.cellInd];this.SelectTime(t);return}if(this.selectDayTMode){this.selectDayTEndObj=e;this.SelectDaysT(t)}};JCEC.prototype.DayTitleOnMouseDown=function(e,t){this.selectDayTMode=true;this.selectDayTStartObj=this.selectDayTEndObj=e;if(e.className.indexOf("bxec-day-t-selected")==-1){if(this.arSelectedTime&&this.arSelectedTime.length>0)this.SelectTime(t);this.SelectDaysT(t);return}this.selectDayTMode=false;this.DeSelectDaysT();this.CloseAddEventDialog()};JCEC.prototype.DayTitleOnMouseUp=function(e,t){if(this.selectTimeMode&&!this.selectDayTMode){var i=this.__GetRelativeCell(e);this.selectTimeEndObj=this.Tabs[t].pTimelineTable.rows[i.rowInd].cells[i.cellInd];this.TimeCellOnMouseOver(this.selectTimeEndObj,t);this.TimeCellOnMouseUp(this.selectTimeEndObj,t);return}if(!this.selectDayTMode)return;this.ShowAddEventDialog();this.selectDayTMode=false};JCEC.prototype.__GetRelativeCell=function(e){var t=e.cellIndex,i=0;if(t>this.__ConvertCellIndex(this.selectTimeStartObj.parentNode.rowIndex,this.selectTimeStartObj.cellIndex)){t--;i=47}return{cellInd:t,rowInd:i}};JCEC.prototype.SelectDaysT=function(e){if(!this.arSelectedDaysT)this.arSelectedDaysT=[];if(!this.selectDayTStartObj||!this.selectDayTEndObj)return;if(this.arSelectedDaysT.length>0)this.DeSelectDaysT();var t=this.Tabs[e],i=this.selectDayTStartObj,s=this.selectDayTEndObj,o=i.cellIndex,a=s.cellIndex,r=t.pBodyCont,l=r.rows[0],n=r.rows[1],d;if(o>a){i=this.selectDayTEndObj;s=this.selectDayTStartObj;o=i.cellIndex;a=s.cellIndex}this.curDayTSelection={sDay:t.arDays[o-1],eDay:t.arDays[a-1]};for(d=o;d<=a;d++){c1=l.cells[d];c2=n.cells[d];BX.addClass(c1,"bxec-day-t-selected");BX.addClass(c2,"bxec-day-t-selected");this.arSelectedDaysT.push({pCell1:c1,pCell2:c2})}};JCEC.prototype.DeSelectDaysT=function(){if(!this.arSelectedDaysT)return;var e,t;for(e=0,t=this.arSelectedDaysT.length;e<t;e++){BX.removeClass(this.arSelectedDaysT[e].pCell1,"bxec-day-t-selected");BX.removeClass(this.arSelectedDaysT[e].pCell2,"bxec-day-t-selected")}this.arSelectedDaysT=[]};JCEC.prototype.SelectTime=function(e){if(!this.arSelectedTime)this.arSelectedTime=[];if(!this.selectTimeStartObj||!this.selectTimeEndObj)return;if(this.arSelectedTime.length>0)this.DeSelectTime(e);var t=this.Tabs[e],i=this.selectTimeStartObj,s=i.parentNode.rowIndex,o=this.__ConvertCellIndex(s,i.cellIndex),a=this.selectTimeEndObj,r=a.parentNode.rowIndex,l=this.__ConvertCellIndex(r,a.cellIndex),n={sDay:t.arDays[o-1],eDay:t.arDays[l-1],sTime:s/2,eTime:r/2+.5},d,h,c,y,T,m,f;if(s>r&&o==l||o>l){n.sTime+=.5;n.eTime-=.5}n.sHour=Math.floor(n.sTime);n.eHour=Math.floor(n.eTime);n.sMin=(n.sTime-n.sHour)*60;n.eMin=(n.eTime-n.eHour)*60;this.curTimeSelection=n;if(o==l){this._SelectTime({sRow:s,eRow:r,col:o,bShowNotifier:true,tabId:e,oDays:n})}else{if(o<l){h=o;c=l;m=s;f=r}else{h=l;c=o;m=r;f=s;_d=n.sDay;n.sDay=n.eDay;n.eDay=_d;_t=n.sTime;n.sTime=n.eTime;n.eTime=_t}for(d=h;d<=c;d++){y=d==h?m:0;T=d==c?f:47;this._SelectTime({sRow:y,eRow:T,col:d,bShowNotifier:d==h,tabId:e,oDays:n})}}};JCEC.prototype._SelectTime=function(e){var t=this.Tabs[e.tabId].pTimelineTable,i=Math.min(e.eRow,e.sRow),s=Math.max(e.eRow,e.sRow),o,a;for(o=i;o<=s;o++){a=t.rows[o].cells[this.__ConvertCellIndex(o,e.col,true)];BX.addClass(a,"bxec-time-selected");this.arSelectedTime.push({pCell:a})}if(e.bShowNotifier){if(i==e.eRow&&e.eRow!=e.sRow){var r=e.oDays.sDay;e.oDays.sDay=e.oDays.eDay;e.oDays.eDay=r;var l=e.oDays.sTime;e.oDays.sTime=e.oDays.eTime;e.oDays.eTime=l}this.ShowSelectTimeNotifier({tabId:e.tabId,rowInd:i,colInd:e.col,oDays:e.oDays})}};JCEC.prototype.__ConvertCellIndex=function(e,t,i){if(e/2!==Math.round(e/2))t+=i?-1:1;return t};JCEC.prototype.DeSelectTime=function(e){if(!this.arSelectedTime)return;var t,i;for(t=0,i=this.arSelectedTime.length;t<i;t++)BX.removeClass(this.arSelectedTime[t].pCell,"bxec-time-selected");this.HideSelectTimeNotifier({tabId:e});this.arSelectedTime=[]};JCEC.prototype.ShowSelectTimeNotifier=function(e,t){var i=this.Tabs[e.tabId],s=i.pTimelineTable,o=s.rows[e.rowInd].cells[this.__ConvertCellIndex(e.rowInd,e.colInd,true)],a=bxInt(o.offsetLeft),r=bxInt(o.offsetTop),l=Math.floor(e.oDays.sTime),n=Math.floor(e.oDays.eTime),d=(e.oDays.sTime-l)*60,h=(e.oDays.eTime-n)*60,c=e.oDays.sDay,y=e.oDays.eDay,T=-19,m=15,f,p,C;if(n==24)n="00";if(!i.pSTNotifier)i.pSTNotifier=s.parentNode.appendChild(BX.create("DIV",{props:{className:"bxec-st-notifier"}}));p=this.FormatTimeByNum(l,d);C=this.FormatTimeByNum(n,h);if(e.oDays.sDay==e.oDays.eDay)f="<nobr>"+p+" - "+C+"</nobr>";else f="<nobr>"+bxFormatDate(c.date,c.month+1,c.year)+" "+p+" - "+bxFormatDate(y.date,y.month+1,y.year)+" "+C+"</nobr>";if(bxInt(l)<=0)T=20;i.pSTNotifier.innerHTML='<img class="bxec-iconkit" src="/bitrix/images/1.gif">'+f;i.pSTNotifier.style.left=a+m+"px";i.pSTNotifier.style.top=r+T+"px";i.pSTNotifier.style.display="block"};JCEC.prototype.HideSelectTimeNotifier=function(e){var t=this.Tabs[e.tabId];if(!t.pSTNotifier)return;t.pSTNotifier.style.display="none"};JCEC.prototype.BuildSingleDayTable=function(){var e=this.Tabs["day"],t=e.pBodyCont,i=t.rows[0],s=t.rows[1],o=t.rows[2],a;i.insertCell(1);a=s.insertCell(1);a.innerHTML='<div class="bxec-wdv-more-ev"> </div>';o.cells[0].colSpan="3";e.pTimelineCont=o.cells[0].firstChild;this.ResizeTabTitle(e)};JCEC.prototype.ShowCurTimePointer=function(e){var t=this,i=this.Tabs[e];if(!i.oCurTimePointer)this.CreateCurTimePointer(e);function s(){var e=new Date,s=bxInt(e.getHours()),o=bxInt(e.getMinutes()),a=i.pTimelineTable.rows[s*2].cells[1],r=a.offsetTop+Math.round(a.offsetHeight*2*o/6)/10-(BX.browser.IsSafari()?3:4);i.oCurTimePointer.pWnd.style.top=r+"px";i.oCurTimePointer.pWnd.title=EC_MESS.CurTime+" - "+t.FormatTimeByNum(s,o)}var o=i.oCurTimePointer,a=i.pTimelineTable.rows[0].cells[i.curDay.cellInd];if(!a)return;i.pTimelineCont.appendChild(o.pWnd);o.pWnd.style.display="block";o.pWnd.style.left=bxInt(a.offsetLeft)+"px";o.pWnd.style.width=bxInt(a.offsetWidth)+"px";o.interval=setInterval(s,6e4);s()};JCEC.prototype.CreateCurTimePointer=function(e){this.Tabs[e].oCurTimePointer={pWnd:BX.create("DIV",{props:{className:"bxec-time-pointer"},html:'<img class="bxec-iconkit" src="/bitrix/images/1.gif">'})}};JCEC.prototype.HideCurTimePointer=function(e){var t=this.Tabs[e];if(!t.oCurTimePointer)return;if(t.oCurTimePointer.interval)clearInterval(t.oCurTimePointer.interval);t.oCurTimePointer.pWnd.style.display="none"};JCEC.prototype.SetWeek=function(e,t,i){var s=this.Selector.OnChange(i,t,e),o=s.monthTo,a=s.yearTo,r=this.GetWeekByDate({date:s.dateTo,month:s.monthTo,year:s.yearTo});if(!this.arLoadedMonth[o+"."+a])return this.LoadEvents(o,a,{week:e,month:t,year:i});var l=(new Date).getTime();if(l>=s.weekStartDate.getTime()&&l<=s.weekEndDate.getTime()){o=this.currentDate.month;a=this.currentDate.year;r=this.GetWeekByDate(this.currentDate)}var n=this.activeDate.month!=o||this.activeDate.year!=a;this.activeDate.week=r;this.activeDate.month=o;this.activeDate.year=a;if(n)this.SetTabNeedRefresh("week",true);this.BuildTimelineGrid(this.Tabs["week"],this.FillWeekDaysTitle({tabId:"week",count:7,startDate:s.weekStartDate}))};JCEC.prototype.SetDay=function(e,t,i){var s=this.Selector.OnChange(i,t,false,e),o=s.month,a=s.year;if(!this.arLoadedMonth[o+"."+a])return this.LoadEvents(o,a,{date:e,month:t,year:i});var r=this.activeDate.month!=s.month||this.activeDate.year!=s.year;this.activeDate.date=s.date;this.activeDate.month=s.month;this.activeDate.year=s.year;if(r)this.SetTabNeedRefresh("day",true);var l=this.FillWeekDaysTitle({tabId:"day",count:1,startDate:s.oDate});this.BuildTimelineGrid(this.Tabs["day"],l)};