﻿Type.registerNamespace("Telerik.Web.UI.Scheduler.Rendering");
(function(e,a){var k=a.Scheduler,h=k.Rendering,i=k.DateTime,d=Telerik.Web.StringBuilder,c=60000,g=c*60,l=g*24,b=7,j=4;
h.WeekViewRenderer=function(m){this._model=m;
this._owner=m._owner;
this._resizableAllDays=false;
this._shouldAddAllDayWraps=true;
this._ownerElement=this._owner.get_element();
this._owner.add_propertyChanged(Function.createDelegate(this,this._onSchedulerPropertyChanged));
};
h.WeekViewRenderer.prototype={renderAppointment:function(m){var n=this._getAppointmentParts(m);
var o=this;
m._parts=n;
e.each(n,function(){o._model.addToBlocks(this);
if(this.isAllDay){o._addAllDayAppointmentPart(this,m);
}else{o._addAppointmentPart(this,m);
}});
this._recalcAppointmentsStyles();
},refreshView:function(){this._activateView();
this._updateHeaders();
this._updateColumnHeaders();
this._updateViewTabs();
this._updateFooter();
this._updateShowFullTimeStatus();
},refreshIndicatorState:function(){if(this._model._settings&&this._model._settings.hiddenAptsIndicator===false){return;
}if(!this._owner.get_showFullTime()){this._updateIndicators();
}else{this._clearIndicators();
}},_updateIndicators:function(){var u=[],s=[];
var m=this._model._getFirstDayStart();
var o=k.DateTime.add(k.DateTime.getDate(m),this._model.get_effectiveDayEndTime());
for(var n=0,q=this._model.get_numberOfDays();
n<q;
n++){var r=this._owner.get_appointments().getAppointmentsInRange(k.DateTime.getDate(m),m);
var t=r.find(function(v){return v.get_end()<=m;
})!=null;
var p=this._owner.get_appointments().getAppointmentsStartingInRange(o,(new Date(o)).setHours(24)).get_count()>0;
u[n]=t+0;
s[n]=p+0;
m=k.DateTime.add(m,l);
o=k.DateTime.add(o,l);
}this._owner._updateHiddenAppointmentsIndicator(u,"top");
this._owner._updateHiddenAppointmentsIndicator(s,"bottom");
},_clearIndicators:function(){this._owner._removeIndicatorsTable("rsTopIndicator");
this._owner._removeIndicatorsTable("rsBottomIndicator");
},_updateShowFullTimeStatus:function(){var n=e("div.rsTopWrap table.rsContentTable",this._ownerElement)[0];
var p=n.rows.length;
var o=this._model.get_effectiveDayEndTime()-this._model.get_effectiveDayStartTime();
var m=this._owner.get_minutesPerRow()*c;
var q=o/m;
if(p!=q){if(this._owner.get_showFullTime()){this.showFullTime();
}else{this.showBusinessTime();
}}},_updateFooter:function(){e("div.rsFooter",this._ownerElement).css("display","");
},_updateViewTabs:function(){if(e(".rsHeader ul .rsFirst",this._ownerElement).length==0){return;
}var p=e(".rsHeader ul li.rsSelected",this._ownerElement);
var m=e(this._getViewTabElement());
if(m.is(".rsSelected")){return;
}p.removeClass("rsSelected");
m.addClass("rsSelected");
var s=e("em",p);
var n=e("a",m);
var r=n.find("span");
var o=s[0].className;
s[0].className=n[0].className;
n[0].className=o;
var q=s.text();
s.text(r.text());
r.text(q);
p.append(n.clone());
m.append(s);
n.remove();
},_getViewTabElement:function(){return e(".rsHeader ul .rsHeaderWeek",this._ownerElement).parent()[0];
},_activateView:function(){var p=this._getContentElement();
if(e(p).parent().is(".rsTopWrap")){return;
}var m=e(this._ownerElement);
var q=m.find("div.rsHiddenViews");
var o=e("div.rsTopWrap",m);
var r=e("div.rsContent",o);
var n=e("div.rsHeader",o);
if(n.length>0){n.after(p);
}else{o.prepend(p);
}q.append(r);
},showBusinessTime:function(){var n=e("div.rsTopWrap table.rsContentTable",this._ownerElement);
var m=e("div.rsTopWrap table.rsVerticalHeaderTable",this._ownerElement);
this._removePrependedRows(n,m);
this._removeAppendedRows(n,m);
var o=this._owner.get_localization().Show24Hours;
e("div.rsFooter a.rsFullTime",this._ownerElement).text(o);
},_removeAppendedRows:function(n,m){var p=(l-this._model.get_dayEndTime())/(this._owner.get_minutesPerRow()*c);
var o=e(n[0].rows);
var q=o.length-p-1;
o.filter(":gt("+(q)+")").remove();
m.find("tr:gt("+(q)+")").remove();
},_removePrependedRows:function(n,m){var o=this._model.get_dayStartTime()/(this._owner.get_minutesPerRow()*c);
var p=e(n[0].rows);
p.filter(":lt("+(o)+")").remove();
m.find("tr:lt("+(o)+")").remove();
},showFullTime:function(){var n=e("div.rsTopWrap table.rsContentTable",this._ownerElement);
var m=e("div.rsTopWrap table.rsVerticalHeaderTable",this._ownerElement);
var p=this._owner.get_rowHeight();
var q=n[0].rows[0].cells.length;
this._addRows(n,m,p,q,true);
this._addRows(n,m,p,q);
this._refreshRowHeaders();
var o=this._owner.get_localization().ShowBusinessHours;
e("div.rsFooter a.rsFullTime",this._ownerElement).text(o);
if($telerik.isSafari){n.appendTo(n.parent());
m.appendTo(m.parent());
}},_refreshRowHeaders:function(){var m=e("div.rsTopWrap table.rsVerticalHeaderTable",this._ownerElement);
var n=this._owner.get_timeLabelRowSpan();
var o=this;
m.find("tr").each(function(q){var p=e(this);
if(q%n==0){p.find("div").html(o._getRowHeaderText(q));
}else{p.find("div").html("");
}if(q%n==n-1){p.addClass("rsAlt");
}else{p.removeClass("rsAlt");
}});
},_getRowHeaderText:function(o){var n=new Date(0);
n.setHours(0);
n.setMinutes(0);
var p=this._owner.get_minutesPerRow()*c;
var q=i.add(n,p*o);
var m=this._owner.get_hoursPanelTimeFormat().replace("tt","'<span class=\"rsAmPm\">'tt'</span>'");
return this._getFormattedDateText(q,m);
},_onSchedulerPropertyChanged:function(m,n){if(n.get_propertyName()=="timeLabelRowSpan"){this._refreshRowHeaders();
}},_getDayOfWeek:function(n){var m=this._owner.get_firstDayOfWeek()+n;
if(m>6){m-=7;
}return m;
},_getCellClass:function(n){var m=this._getDayOfWeek(n);
if(m==a.DayOfWeek.Saturday){return"rsSatCol";
}if(m==a.DayOfWeek.Sunday){return"rsSunCol";
}return"";
},_addRows:function(m,o,y,x,v){var p=0;
if(v){p=this._getNumberOfRowsToPrepend();
}else{p=this._getNumberOfRowsToAppend();
}for(var t=0;
t<p;
t++){var r=[];
r[r.length]='<tr style="height:';
r[r.length]=y;
r[r.length]='"></tr>';
var n=e(r.join(""));
var w=n.clone();
var q=[];
q[q.length]="<th><div>";
q[q.length]="</div></th>";
if(v){w.prependTo(o);
}else{w.appendTo(o);
}w.append(q.join(""));
if((v&&t%2==0)||(!v&&t%2!=0)){n.addClass("rsAlt");
}for(var u=0;
u<x;
u++){var s=[];
s[s.length]='<td class="';
s[s.length]=this._getCellClass(u);
s[s.length]='">&nbsp;</td>';
n.append(e(s.join("")));
}if(v){m.prepend(n);
}else{m.append(n);
}}},_getNumberOfRowsToAppend:function(){return(l-this._model.get_dayEndTime())/(this._owner.get_minutesPerRow()*c);
},_getNumberOfRowsToPrepend:function(){return this._model.get_dayStartTime()/(this._owner.get_minutesPerRow()*c);
},_getContentElement:function(){return e(".rsContent.rsWeekView",this._ownerElement)[0];
},_getFormatString:function(){var m=this._getHeaderDateFormat();
return"{0:"+m+"} - {1:"+m+"}";
},_getHeaderDateFormat:function(){return this._model.get_headerDateFormat();
},_getHeaderDateText:function(){var o=this._getHeaderDateFormat();
var q=this._model.get_visibleRangeStart();
var n=this._getFormattedDateText(q,o);
var m=k.DateTime.add(this._model.get_visibleRangeEnd(),-l);
var p=this._getFormattedDateText(m,o);
return String.format("{0} - {1}",n,p);
},_updateHeaders:function(){var m=this._getHeaderDateText();
e("div.rsTopWrap div.rsHeader h2",this._ownerElement).text(m);
},_updateColumnHeaders:function(){var o=this._model.get_columnHeaderDateFormat();
var m=this._model.get_visibleRangeStart();
var n=e("div.rsTopWrap table.rsHorizontalHeaderTable",this._ownerElement);
if(n.length>0){e.each(n[0].rows[0].cells,function(){e(this).html("<a class='rsDateHeader' href='#'>"+m.localeFormat(o)+"</a>");
m=k.DateTime.add(m,l);
});
}},_recalcAppointmentsStyles:function(){var m=this;
this._model._blockCollection.forEach(function(n){e(n.element).css({width:m._getWidthPercent(n)+"%",left:m._getLeftPercent(n)+"%"});
});
},_getVisibleDuration:function(q,p){var m=new i(q.get_startTime()).get_date().add(this._model.get_effectiveDayStartTime()).toDate();
var n=new i(q.get_startTime()).get_date().add(this._model.get_effectiveDayEndTime()).toDate();
var o=Math.max(p.get_start(),m);
var r=Math.min(p.get_end(),n);
return Math.min(r-o,p.get_duration());
},_getAppointmentElementHeight:function(n){var o=Math.ceil(n/(this._owner.get_minutesPerRow()*c));
var m=o*parseInt(this._owner.get_rowHeight());
m-=j;
return m;
},_addAppointmentPart:function(r,t){var p=r.start;
var m=r.end;
var v=this._model._getTimeSlotForAppointmentPart(r);
var q=e(v.get_domElement());
if(q.children().length==0){q.html("<div class='rsWrap'></div>");
}var n=m-p;
var u=this._buildAptStyles(t);
u.rsApt.push("width: ",this._getWidthPercent(r),"%;");
u.rsApt.push("left: ",this._getLeftPercent(r),"%;");
var s=this._getAppointmentElementHeight(n)+"px";
var o=e(this.getAppointmentHtml(t,true,s,u))[0];
r.element=o;
Array.add(t._domElements,o);
if(t.get_start()<p){this._addArrow(o,"Top");
}if(t.get_end()>m){this._removeResizeGrip(t);
this._addArrow(o,"Bottom");
}q.children(":first").append(o);
},_mapAppointmentStyles:function(m,n,o){e.each(o,function(p,r){var q=m[r];
if(q){n.push(p,": ",q,";");
}});
},_buildAptStyles:function(o){var s=this._owner.get_appointmentStyleMode();
var m=this._appointmentHasCustomColor(o);
var p=this._appointmentHasBorder(o);
var n={rsApt:[],rsAptContent:[],rsAptOut:[],rsAptIn:[],rsAptMid:[]};
var q=o.get_backColor()?["background-color:",o.get_backColor(),";"].join(""):"";
var r=o.get_borderColor()?["border-color:",o.get_borderColor(),";"].join(""):"";
if(s==a.AppointmentStyleMode.Default||(s==a.AppointmentStyleMode.Auto&&!m)){if(r||q){n.rsAptMid.push(q,r);
n.rsAptIn.push(q,r);
n.rsAptContent.push(q,r);
}}else{n.rsApt.push(q);
}if(p&&(s==a.AppointmentStyleMode.Simple||s==a.AppointmentStyleMode.Auto)){this._mapAppointmentStyles(o,n.rsApt,{"border-top-color":"_borderColor","border-bottom-color":"_borderColor","border-top-width":"_borderWidth","border-bottom-width":"_borderWidth","border-top-style":"_borderStyle","border-bottom-style":"_borderStyle"});
this._mapAppointmentStyles(o,n.rsAptOut,{"border-left-color":"_borderColor","border-right-color":"_borderColor","border-left-width":"_borderWidth","border-right-width":"_borderWidth","border-left-style":"_borderStyle","border-right-style":"_borderStyle"});
}return n;
},_appointmentHasBorder:function(m){return m.get_borderColor()||m.get_borderWidth();
},_appointmentHasBackground:function(m){return m.get_backColor();
},_appointmentHasCustomColor:function(m){return this._appointmentHasBackground(m)||this._appointmentHasBorder(m);
},_getLeftPercent:function(m){var n=m.column;
if(!n){return 0;
}return n.get_left();
},_getWidthPercent:function(m){var n=m.column;
if(!n){return 100;
}return n.get_width();
},_addAllDayAppointmentPart:function(q,r){var p=q.start;
var m=q.end;
var s=this._model._getAllDayTimeSlotForAppointmentPart(q);
var o=this._getTargetWrapper(s,q.rowIndex);
if(!o){return;
}var n=this._createAllDayAppointmentElement(m-p,r)[0];
q.element=n;
if(!r._domElement){r._domElement=n;
}Array.add(r._domElements,n);
if(r.get_start()<this._model.get_visibleRangeStart()){this._addArrow(n,"Left");
}if(this._model.get_visibleRangeEnd()<r.get_end()){this._removeResizeGrip(r);
this._addArrow(n,"Right");
}o.append(n);
if(this._shouldAddAllDayWraps){e(s.get_domElement()).append(e(this.getWrapperHtml()));
}},_createAllDayAppointmentElement:function(p,m){var o=(Math.ceil((p/l))*100);
var n=(parseInt(this._owner._rowHeight)-j)+"px";
var q=this._buildAptStyles(m);
q.rsApt.push("width: ",o,"%;");
return e(this.getAppointmentHtml(m,this._resizableAllDays,n,q));
},_getAppointmentParts:function(m){var q=[];
var t=this._model;
var x=t._owner.get_showAllDayRow();
var u=k.DateTime.getDate(t.get_visibleRangeStart());
for(var s=0,w=t.get_numberOfDays();
s<w;
s++){var y=k.DateTime.add(u,l*s);
var v=k.DateTime.add(y,l);
if(x&&m._rangeIsInsideAppointment(y,v)){Array.add(q,{isAllDay:true,start:y,end:v,appointment:m});
}else{var r=k.DateTime.add(y,t.get_effectiveDayStartTime());
var o=k.DateTime.add(y,t.get_effectiveDayEndTime());
if(m._isInRange(r,o)){var p=new Date(Math.max(r,m.get_start()));
var n=new Date(Math.min(o,m.get_end()));
Array.add(q,{isAllDay:false,start:p,end:n,appointment:m});
}}}return this._mergeAllDayParts(q);
},_mergeAllDayParts:function(n){var m=[];
e.each(n,function(p){if(p==0){Array.add(m,this);
return;
}var o=m[m.length-1];
if(this.isAllDay&&o.isAllDay){o.end=this.end;
}else{Array.add(m,this);
}});
return m;
},_removeResizeGrip:function(m){e(m.get_element()).find("div.rsAptResize").remove();
},_getRowIndex:function(m){return m._getRowIndex();
},_addAllDayWraps:function(p,n){var m=n.children().length;
var o=(p+1)-m;
for(var q=0;
q<o;
q++){n.append(this.getWrapperHtml());
}},_getTargetWrapper:function(n,p){var m=e(n.get_domElement());
if(this._shouldAddAllDayWraps){this._addAllDayWraps(p,m);
}var o=m.children().eq(p);
if(o.length==0){return;
}o[0].style.zIndex=m[0].parentNode.cells.length-m[0].cellIndex;
return o;
},_addArrow:function(o,m){var n=e(o).find("div.rsAptIn");
n.append(String.format('<a style="z-index: 80;" href="#" class="rsArrow{0}">{1}</a>',m,m.toLowerCase()));
n.addClass(String.format("rsWArrow{0}",m));
},removeAppointment:function(o){if(!o._parts){return;
}var n=this;
var m=null;
if(o._originalParent){m=o._originalParent.parentNode;
}e.each(o._parts,function(){if(this.isAllDay&&n._shouldAddAllDayWraps){n._removeAllDayWrappers(this,m);
}if(this.element){var p=this.element.parentNode;
if(p){p.removeChild(this.element);
}}n._model.removeFromBlock(this);
});
},_removeAllDayWrappers:function(p,m){var r=m||p.element.parentNode.parentNode;
if(!r){return;
}var q=e(r);
var u=q.parent().children().index(q);
var o=p.end-p.start;
var v=Math.ceil(o/l);
var t=q.parent().children().slice(u,u+v);
var s=p.rowIndex;
var n=t.children("div:nth-child("+(s+1)+")");
n.not(":only-child").remove();
},getWrapperHtml:function(){var m=[];
m[m.length]="<div class='rsWrap' style='height:";
m[m.length]=this._owner._rowHeight;
m[m.length]="'></div>";
return m.join("");
},getAppointmentHtml:function(r,m,o,p){var q=new d().append("<div class='").append(this._getClassName(r)).append("' id='").append(this._getUniqueID());
var n=r.get_toolTip();
if(n){q.append("' title='").append(n);
}p.rsApt.push("height: ",o,";");
p.rsAptOut.push("height: ",o,";");
q.append("' style='",p.rsApt.join(""),"'>").append("<div class='rsAptOut' style='",p.rsAptOut.join(""),"'>").append("<div class='rsAptMid' style='",p.rsAptMid.join(""),"'>").append("<div class='rsAptIn' style='",p.rsAptIn.join(""),"'>").append("<div class='rsAptContent' style='",p.rsAptContent.join(""),"'>").append(this._getRecurrenceIconHtml(r)).append(r.get_subject()).append("<a href='#' class='rsAptDelete' style='visibility: hidden;'>delete</a></div></div>").append(m?"<div class='rsAptResize'></div>":"").append("</div></div></div>");
return q.toString();
},_getClassName:function(n){var o=[];
var p=this;
o.push("rsApt");
var r=n.get_cssClass();
if(r){o.push(r);
}n.get_resources().forEach(function(t){p._addUniqueClassName(o,t.get_cssClass());
var u=n.get_owner();
if(u){e.each(u.get_resourceStyles().getMatchingClasses(t),function(){p._addUniqueClassName(o,this);
});
var s=u.get_resources().getResourceByTypeAndKey(t.get_type(),t.get_key());
if(s){p._addUniqueClassName(o,s.get_cssClass());
}}});
var q=this._owner.get_appointmentStyleMode();
var m=this._appointmentHasCustomColor(n);
if(q==a.AppointmentStyleMode.Simple||(q==a.AppointmentStyleMode.Auto&&m)){o.push("rsAptSimple");
}if(q==a.AppointmentStyleMode.Default&&this._appointmentHasBackground(n)){o.push("rsAptColor");
}return o.join(" ");
},_addUniqueClassName:function(m,n){if(n&&Array.indexOf(m,n)==-1){m.push(n);
}},_getRecurrenceIconHtml:function(n){var m=n.get_recurrenceState();
if(m!=a.RecurrenceState.NotRecurring){if(m==a.RecurrenceState.Exception){return'<div class="rsAptRecurrenceException"></div>';
}else{return'<div class="rsAptRecurrence"></div>';
}}return"";
},_getUniqueID:function(){return Math.abs((new Date()).getTime()^Math.floor(Math.random()*100000000)).toString();
},_getFormattedDateText:function(q,n){var m=q.getDate();
var p=q.getMonth()+1;
var o=q.getFullYear();
if(Sys.CultureInfo.CurrentCulture&&Sys.CultureInfo.CurrentCulture.name=="en-US"){switch(n){case"dd":if(m<10){return"0"+m;
}else{return m;
}break;
case"d":return String.format("{0}/{1}/{2}",p,m,o);
break;
}}return q.localeFormat(n);
}};
h.WeekViewRenderer.registerClass("Telerik.Web.UI.Scheduler.Rendering.WeekViewRenderer");
h.DayViewRenderer=function(m){h.DayViewRenderer.initializeBase(this,[m]);
};
h.DayViewRenderer.prototype={_getHeaderDateText:function(){var m=this._model.get_visibleRangeStart();
return m.localeFormat(this._getHeaderDateFormat());
},_getContentElement:function(){return e(".rsContent.rsDayView",this._ownerElement)[0];
},_getViewTabElement:function(){return e(".rsHeader ul .rsHeaderDay",this._ownerElement).parent()[0];
},_updateColumnHeaders:function(){}};
h.DayViewRenderer.registerClass("Telerik.Web.UI.Scheduler.Rendering.DayViewRenderer",h.WeekViewRenderer);
h.TimelineViewRenderer=function(m){h.TimelineViewRenderer.initializeBase(this,[m]);
this._resizableAllDays=true;
};
h.TimelineViewRenderer.prototype={_updateFooter:function(){e("div.rsFooter",this._ownerElement).css("display","none");
},_updateShowFullTimeStatus:function(){},_recalcAppointmentsStyles:function(){},_updateIndicators:function(){},_clearIndicators:function(){},_getAppointmentParts:function(n){var m=[];
var o=this._model;
for(var r=0,q=o._getNumberOfSlots();
r<q;
r++){var p=k.DateTime.add(o.get_visibleRangeStart(),o._getSlotDuration()*r);
var s=k.DateTime.add(p,o._getSlotDuration());
if(n._isInRange(p,s)){Array.add(m,{isAllDay:true,start:p,end:s,appointment:n});
}}return this._mergeAllDayParts(m);
},_createAllDayAppointmentElement:function(p,m){var o=(Math.ceil((p/this._model._getSlotDuration()))*100)+"%";
var n=(parseInt(this._owner._rowHeight)-j)+"px";
var q=this._buildAptStyles(m);
q.rsApt.push("width: ",o,";");
return e(this.getAppointmentHtml(m,this._resizableAllDays,n,q));
},_updateColumnHeaders:function(){this._updateDateColumnHeaders(e("div.rsTopWrap table.rsHorizontalHeaderTable th",this._ownerElement));
},_updateDateColumnHeaders:function(p){var n=this._model._getSlotDuration();
var m=this._model.get_visibleRangeStart();
var q=this._model._getTimeLabelSpan();
var o=this;
p.each(function(){var r=o._getColumnHeaderText(m);
e(this).text(r);
m=new i(m).add(n*q).toDate();
});
},_getColumnHeaderText:function(m){return this._getFormattedDateText(m,this._model.get_columnHeaderDateFormat());
},_getContentElement:function(){return e(".rsContent.rsTimelineView",this._ownerElement)[0];
},_getViewTabElement:function(){return e(".rsHeader ul .rsHeaderTimeline",this._ownerElement).parent()[0];
},_getHeaderDateText:function(){var o=this._getHeaderDateFormat();
var q=this._model.get_visibleRangeStart();
var n=this._getFormattedDateText(q,o);
var m=k.DateTime.add(this._model.get_visibleRangeEnd(),-this._model._getSlotDuration());
var p=this._getFormattedDateText(m,o);
return String.format("{0} - {1}",n,p);
}};
h.TimelineViewRenderer.registerClass("Telerik.Web.UI.Scheduler.Rendering.TimelineViewRenderer",h.WeekViewRenderer);
h.MonthViewRenderer=function(m){h.MonthViewRenderer.initializeBase(this,[m]);
this._weekLength=this._model.get_weekLength();
this._shouldAddAllDayWraps=false;
this._contentElement=e(".rsContent.rsMonthView",this._ownerElement)[0];
this._contentTables=e("table tr td.rsContentWrapper table.rsContentTable",this._contentElement);
};
h.MonthViewRenderer.prototype={_updateIndicators:function(){},_clearIndicators:function(){},refreshView:function(){var p=k.DateTime.subtract(this._model.get_visibleRangeEnd(),this._model.get_visibleRangeStart());
var o=Math.ceil(p/l);
var n=Math.ceil(o/b);
var m=e("table.rsContentTable:first tr",this._getContentElement()).length;
if(m<n){this._addContentRows(n-m);
}else{if(m>n){this._removeContentRows(m-n);
}}e("div.rsShowMore",this._contentElement).removeClass("rsShowMore").html("");
h.MonthViewRenderer.callBaseMethod(this,"refreshView");
},_recalcAppointmentsStyles:function(){},_updateShowFullTimeStatus:function(){},_updateFooter:function(){e("div.rsFooter",this._ownerElement).css("display","none");
},_getTargetWrapper:function(m,n){return h.MonthViewRenderer.callBaseMethod(this,"_getTargetWrapper",[m,n+1]);
},_updateColumnHeaders:function(){var p=this;
var o=this._model.get_dayHeaderDateFormat();
var m=this._model.get_firstDayHeaderDateFormat();
var n=p._owner.get_selectedDate().getMonth();
var q=p._model.get_visibleRangeStart();
e.each(this._contentTables,function(){var s=e("td div.rsDateWrap div.rsDateBox a",this);
var u=q;
var r=0;
var t=new Date(u.getTime());
s.each(function(){var w=i.subtract(u,q)==0&&u.getMonth()==n;
var v;
if(u.getDate()==1||w){v=u.localeFormat(m);
}else{v=p._getFormattedDateText(u,o);
}this.innerHTML=v;
var y=n!=u.getMonth();
var x=this.parentNode.parentNode.parentNode;
e(x).toggleClass("rsOtherMonth",y);
if(r==p._weekLength-1){t=i.add(t,7*l);
u=new Date(t.getTime());
r=0;
}else{u=i.add(u,l);
r++;
}p._clearExtraWraps(x);
});
});
},_getAppointmentParts:function(n){var o=[];
var t=this._model;
var x=this._weekLength;
var y=i.subtract(t.get_visibleRangeEnd(),t.get_visibleRangeStart())/l;
var w=t.get_visibleAppointmentsPerDay();
for(var B=0,m=y/x;
B<m;
B++){var u=[];
var z=i.add(t.get_visibleRangeStart(),b*B*l);
var q=k.DateHelper.getStartOfWeek(z,this._owner.get_firstDayOfWeek(),x);
for(var s=0;
s<x;
s++){var A=i.add(q,s*l);
var v=i.add(A,l);
if(n._isInRange(A,v)){var r=this._getSlotForDay(n,A);
var p=this._getAppointmentsInDay(A,v);
if(p<=w){this._ensureWraps(r,p+1);
Array.add(u,{isAllDay:true,start:A,end:v,appointment:n});
}else{this._renderShowMore(r);
}}}u=this._mergeAllDayParts(u);
Array.addRange(o,u);
}return o;
},_getAppointmentsInDay:function(m,n){return this._owner.get_appointments().getAppointmentsInRange(m,n).findAll(function(o){return(o.get_visible());
}).get_count();
},_getSlotForDay:function(o,m){var n=o.clone();
n.set_start(m);
return this._model.getTimeSlotForAppointment(n);
},_renderShowMore:function(m){var o=e(".rsLastWrap",m.get_domElement());
var n=this._owner.get_localization().ShowMore;
if(e(".rsApt",o).length==0){o.addClass("rsShowMore").text(n);
}else{var p=e("<div class='rsLastWrap rsWrap rsShowMore'>"+n+"</div>");
o.removeClass("rsLastWrap").after(p);
}},_ensureWraps:function(p,q){var r=p.get_domElement();
var o=e("div.rsWrap",r).length;
var s=q-o;
if(s<=0){return;
}for(var m=0;
m<s;
m++){var n=e("<div class='rsWrap'></div>");
e("div.rsLastWrap",r).removeClass("rsLastWrap").after(n);
n.addClass("rsLastWrap");
}},_clearExtraWraps:function(p){var m=4;
var o=e("div.rsWrap",p).length-m;
if(o>0){for(var n=0;
n<o;
n++){e("div.rsWrap:nth(1)",p).remove();
}}},removeAppointment:function(m){var n=this._model;
e("div.rsShowMore",this._contentElement).each(function(){var o=n.getTimeSlotFromDomElement(this);
if(o&&m._isInRange(o.get_startTime(),o.get_endTime())){e(this).removeClass("rsShowMore");
this.innerHTML="";
}});
h.MonthViewRenderer.callBaseMethod(this,"removeAppointment",[m]);
},_addContentRows:function(n){for(var m=0;
m<n;
m++){e("div.rsTopWrap table.rsContentTable",this._ownerElement).append(this._getMonthRowHtml());
}},_removeContentRows:function(n){for(var m=0;
m<n;
m++){e("div.rsTopWrap table.rsContentTable tr:last-child",this._ownerElement).remove();
}},_getMonthRowHtml:function(){var o=[];
o[o.length]="<tr class='rsRow'>";
for(var m=0;
m<this._weekLength;
m++){o[o.length]="<td>";
for(var n=0;
n<4;
n++){o[o.length]="<div class='rsWrap";
if(n==0){o[o.length]=" rsDateWrap";
}if(n==3){o[o.length]=" rsLastWrap";
}o[o.length]="'>";
if(n==0){o[o.length]="<div class='rsDateBox'><a class='rsDateHeader' href='#'></a></div>";
}o[o.length]="</div>";
}o[o.length]="</td>";
}o[o.length]="</tr>";
return o.join("");
},_getContentElement:function(){return this._contentElement;
},_getRowIndex:function(m){return m._getRowIndex()+1;
},_getHeaderDateText:function(){var n=this._getHeaderDateFormat();
var m=this._owner.get_selectedDate();
return m.localeFormat(n);
},_getFormatString:function(){var m=this._getHeaderDateFormat();
return"{0:"+m+"}";
},_getViewTabElement:function(){return e(".rsHeader ul .rsHeaderMonth",this._ownerElement).parent()[0];
}};
h.MonthViewRenderer.registerClass("Telerik.Web.UI.Scheduler.Rendering.MonthViewRenderer",h.WeekViewRenderer);
h.ResourceGroupedWeekViewRenderer=function(m){h.ResourceGroupedWeekViewRenderer.initializeBase(this,[m]);
};
h.ResourceGroupedWeekViewRenderer.prototype={_updateIndicators:function(){},_clearIndicators:function(){},_getAppointmentParts:function(m){return f.call(this,m);
},_recalcAppointmentsStyles:function(){var m=this;
e.each(this._model._weekModels,function(){this._blockCollection.forEach(function(n){e(n.element).css({width:m._getWidthPercent(n)+"%",left:m._getLeftPercent(n)+"%"});
});
});
},_updateShowFullTimeStatus:function(){if(!this._model._isVertical){h.ResourceGroupedWeekViewRenderer.callBaseMethod(this,"_updateShowFullTimeStatus",[]);
}},_updateColumnHeaders:function(){if(this._model._isVertical){h.ResourceGroupedWeekViewRenderer.callBaseMethod(this,"_updateColumnHeaders",[]);
return;
}var s=this._model.get_columnHeaderDateFormat();
var m=e("div.rsTopWrap table.rsHorizontalHeaderTable",this._ownerElement);
var p=this._model.get_numberOfDays();
var t=this._model.get_visibleRangeStart();
var o=t;
if(m.length>0){var r=m[0].rows;
var q=r[r.length-1];
var n=0;
e.each(q.cells,function(){this.innerHTML=o.localeFormat(s);
o=k.DateTime.add(o,l);
if(n++==p-1){o=t;
n=0;
}});
}}};
h.ResourceGroupedWeekViewRenderer.registerClass("Telerik.Web.UI.Scheduler.Rendering.ResourceGroupedWeekViewRenderer",h.WeekViewRenderer);
h.ResourceGroupedDayViewRenderer=function(m){h.ResourceGroupedDayViewRenderer.initializeBase(this,[m]);
};
h.ResourceGroupedDayViewRenderer.prototype={_updateIndicators:function(){},_clearIndicators:function(){},_getAppointmentParts:function(m){return f.call(this,m);
},_recalcAppointmentsStyles:function(){var m=this;
e.each(this._model._weekModels,function(){this._blockCollection.forEach(function(n){e(n.element).css({width:m._getWidthPercent(n)+"%",left:m._getLeftPercent(n)+"%"});
});
});
},_updateShowFullTimeStatus:function(){if(!this._model._isVertical){h.ResourceGroupedDayViewRenderer.callBaseMethod(this,"_updateShowFullTimeStatus",[]);
}}};
h.ResourceGroupedDayViewRenderer.registerClass("Telerik.Web.UI.Scheduler.Rendering.ResourceGroupedDayViewRenderer",h.DayViewRenderer);
h.ResourceGroupedTimelineViewRenderer=function(m){h.ResourceGroupedTimelineViewRenderer.initializeBase(this,[m]);
};
h.ResourceGroupedTimelineViewRenderer.prototype={_updateIndicators:function(){},_clearIndicators:function(){},renderAppointment:function(m){h.ResourceGroupedTimelineViewRenderer.callBaseMethod(this,"renderAppointment",[m]);
if(this._model._isVertical){var n=e(m.get_element()).parents("tr:first")[0].rowIndex;
this._updateRowHeaderHeight(n);
}},_getAppointmentParts:function(m){return f.call(this,m);
},removeAppointment:function(m){if(!m._parts){return;
}var o=e(m.get_element()).parents("tr:first")[0];
h.ResourceGroupedTimelineViewRenderer.callBaseMethod(this,"removeAppointment",[m]);
if(!o){return;
}var n=o.rowIndex;
if(this._model._isVertical){this._updateRowHeaderHeight(n);
}},refreshView:function(){h.ResourceGroupedTimelineViewRenderer.callBaseMethod(this,"refreshView",[]);
if(this._model._isVertical){for(var m=0;
m<this._model._timelineModels.length;
m++){this._updateRowHeaderHeight(m);
}}},_updateRowHeaderHeight:function(q){var p=e("div.rsTopWrap table.rsVerticalHeaderTable",this._ownerElement);
if(p.length==0){return;
}var r=e("div.rsTopWrap table.rsAllDayTable",this._ownerElement)[0].rows[q];
var o=0;
e.each(r.cells,function(){o=Math.max(e("div.rsWrap",this).length,o);
});
var n=parseInt(this._owner.get_rowHeight());
var m=(n*o)+"px";
e(p[0].rows[q].cells[0]).css("height",m);
},_updateColumnHeaders:function(){if(this._model._isVertical){h.ResourceGroupedTimelineViewRenderer.callBaseMethod(this,"_updateColumnHeaders");
return;
}var p=this._model._getNumberOfSlots();
var o=e("div.rsTopWrap table.rsHorizontalHeaderTable tr:eq(1) th",this._ownerElement);
for(var m=0,n=o.length;
m<n;
m+=p){this._updateDateColumnHeaders(o.slice(m,m+p));
}}};
h.ResourceGroupedTimelineViewRenderer.registerClass("Telerik.Web.UI.Scheduler.Rendering.ResourceGroupedTimelineViewRenderer",h.TimelineViewRenderer);
h.ResourceGroupedMonthViewRenderer=function(m){h.ResourceGroupedMonthViewRenderer.initializeBase(this,[m]);
};
h.ResourceGroupedMonthViewRenderer.prototype={_getAppointmentParts:function(m){return f.call(this,m);
}};
h.ResourceGroupedMonthViewRenderer.registerClass("Telerik.Web.UI.Scheduler.Rendering.ResourceGroupedMonthViewRenderer",h.MonthViewRenderer);
h.DateGroupedWeekViewRenderer=h.WeekViewRenderer;
h.DateGroupedMonthViewRenderer=h.MonthViewRenderer;
h.DateGroupedTimelineViewRenderer=h.TimelineViewRenderer;
function f(p){var m=[];
var o=this._model;
var n=this;
p.get_resources().forEach(function(r){var q=o._resources.getResourceByTypeAndKey(r.get_type(),r.get_key());
if(q){var s=o._resources.indexOf(q);
var t=Object.getType(n).callBaseMethod(n,"_getAppointmentParts",[p]);
e.each(t,function(){this.modelIndex=s;
});
Array.addRange(m,t);
}});
return m;
}})($telerik.$,Telerik.Web.UI);

if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();