Type.registerNamespace("Telerik.Web.UI.Scheduling");
(function(){var e=$telerik.$;
var b=Telerik.Web.UI;
var d=b.Scheduler.DateTime;
var g=60000;
var a=g*60;
var i=a*24;
var j=2147483647;
var f=new Date("9000/01/01");
var h=10000;
var c="";
Telerik.Web.UI.Scheduling.AdvancedTemplate=function(o,m,k){this._scheduler=$find(o.id);
this._schedulerElement=o;
this._formElement=m;
this._schedulerElementId=this._schedulerElement.id;
this._isModal=k;
this._eventNamespace=o.id;
var n=e("div.rsAdvBasicControls",m);
if(n.length==0){return;
}var l=n[0].id;
this._templateId=l.substring(0,l.lastIndexOf("_"));
};
Telerik.Web.UI.Scheduling.AdvancedTemplate._adjustHeight=function(l){var k=e("div.rsAdvancedEdit:visible",l);
var m=e(".rsAdvContentWrapper",k);
var r=k.outerHeight()-k.height();
r+=m.outerHeight()-m.height();
var o=e("div.rsAdvTitle:visible",l).outerHeight({margin:true});
var p=e("div.rsAdvancedSubmitArea",k);
var q=p.outerHeight({margin:true});
var n=e(l).height()-o-q-r;
e(".rsAdvOptionsScroll",k).height(n+"px");
if(p[0]){p[0].style.cssText=p[0].style.cssText;
}};
Telerik.Web.UI.Scheduling.AdvancedTemplate.prototype={initialize:function(){var k=this._scheduler;
k.add_disposing(Function.createDelegate(this,this.dispose));
e("div.rsAdvancedSubmitArea a",this._formElement).attr("onclick","");
if(k.get_overflowBehavior()==1&&!this._isModal){Telerik.Web.UI.Scheduling.AdvancedTemplate._adjustHeight(this._schedulerElement);
}this._initializePickers();
this._initializeAdvancedFormValidators();
this._initializeAllDayCheckbox();
var m=e("#"+this._templateId+"_RecurrencePanel").length>0;
if(m){this._initializeRecurrenceCheckbox();
this._initializeResetExceptions();
this._initializeRecurrenceRadioButtons();
this._initializeLinkedRecurrenceControls();
}if($telerik.isIE){var l=this._getSubjectTextBox().get_element();
l.style.cssText=l.style.cssText;
}e(".riUp, .riDown",this._formElement).attr("tabindex","-1");
},dispose:function(){if(!this._formElement){return;
}e("*",this._formElement).unbind();
e(document).unbind("."+this._eventNamespace);
this._pickers=null;
this._scheduler=null;
this._schedulerElement=null;
this._formElement=null;
},populate:function(k,n){if(!this._clientMode){this._initializeClientMode();
}this._appointment=k;
this._isInsert=n;
var m=d.getTimeOfDay(k.get_start())==0&&d.getTimeOfDay(k.get_end())==0;
var o=d.getDate(k.get_end());
if(m){o=d.add(o,-i);
}this._getSubjectTextBox().set_value(k.get_subject());
var l=this._getDescriptionTextBox();
if(l){l.set_value(k.get_description());
}this._pickers.startDate.set_selectedDate(d.getDate(k.get_start()));
this._pickers.startTime.set_selectedDate(k.get_start());
this._pickers.endDate.set_selectedDate(o);
this._pickers.endTime.set_selectedDate(k.get_end());
this._populateResources();
this._populateAttributes();
this._initalizeResetExceptionsClientMode();
var p=e("#"+this._templateId+"_AllDayEvent");
if(m!=p[0].checked){p[0].checked=m;
this._onAllDayCheckBoxClick(m,false);
}this._populateRecurrence();
},_initializeClientMode:function(){this._clientMode=true;
var k=this;
e("a.rsAdvEditSave",this._formElement).click(function(l){k._saveClicked();
$telerik.cancelRawEvent(l);
}).attr("href","#");
e("a.rsAdvEditCancel, a.rsAdvEditClose",this._formElement).click(function(l){k._cancelClicked();
$telerik.cancelRawEvent(l);
}).attr("href","#");
},_initalizeResetExceptionsClientMode:function(){var k=e("span.rsAdvResetExceptions > a",this._formElement);
var n=this._appointment.get_recurrenceRule().indexOf("EXDATE")!=-1;
k.unbind();
if(n){var l=this;
var m=this._scheduler.get_localization();
k.attr("href","#").text(m.AdvancedReset).click(function(){l._getRemoveExceptionsDialog().set_onActionConfirm(function(){l._scheduler.removeRecurrenceExceptions(l._appointment);
k.text(m.AdvancedDone);
}).show();
return false;
});
}else{k.text("");
}},_saveClicked:function(){if(typeof(Page_ClientValidate)!="undefined"){var r=this._scheduler.get_validationGroup()+(this._isInsert?"Insert":"Edit");
if(!Page_ClientValidate(r)){return;
}}var k=this._appointment;
k.set_subject(this._getSubjectTextBox().get_value());
var l=this._getDescriptionTextBox();
if(l){k.set_description(l.get_value());
}var m=$get(this._templateId+"_AllDayEvent").checked;
var n=this._pickers.startDate.get_selectedDate();
var q=d.getTimeOfDay(this._pickers.startTime.get_selectedDate());
k.set_start(d.add(n,m?0:q));
var p=this._pickers.endDate.get_selectedDate();
var o=d.getTimeOfDay(this._pickers.endTime.get_selectedDate());
k.set_end(d.add(p,m?i:o));
this._saveResources(k);
this._saveAttributes(k);
this._saveRecurrenceRule(k);
if(this._isInsert){this._scheduler.insertAppointment(k);
}else{this._scheduler.updateAppointment(k);
}this._scheduler.hideAdvancedForm();
},_cancelClicked:function(){this._scheduler.hideAdvancedForm();
},_saveResources:function(m){var l=this;
var k=this._scheduler.get_resources();
this._scheduler.get_resourceTypes().forEach(function(t){var u=t.get_name();
var q=l._templateId+"_Res"+u+c;
var r=k.getResourcesByType(u);
if(t.get_allowMultipleValues()){var p=e(String.format("input[id*='{0}']",q),this._formElement);
if(p.length>0){m.get_resources().removeResourcesByType(u);
}for(var n=0;
n<p.length;
n++){if(p[n].checked&&r.get_count()>=n){m.get_resources().add(r.getResource(n));
}}}else{var s=$find(q);
if(!s){return;
}m.get_resources().removeResourcesByType(u);
if(s.get_selectedIndex()==0){return;
}var v=s.get_selectedItem().get_value();
var o=k.findAll(function(w){return w.get_type()==u&&w._getInternalKey()==v;
}).getResource(0)||null;
if(o){m.get_resources().add(o);
}}});
},_saveAttributes:function(m){var k=this;
var l=m.get_attributes();
e.each(this._scheduler.get_customAttributeNames(),function(){var n=this.toString();
var o=$find(k._templateId+"_Attr"+n);
if(!o){return;
}l.removeAttribute(n);
l.setAttribute(n,o.get_value());
});
},_getResourceIndex:function(l){var n=this._scheduler.get_resources().getResourcesByType(l.get_type());
var m,k;
for(m=0,k=n.get_count();
m<k;
m++){var o=n.getResource(m);
if(o.get_type()==l.get_type()&&o.get_key()==l.get_key()){return m;
}}return -1;
},_populateResources:function(){var k=this;
var l=this._scheduler.get_resourceTypes();
l.forEach(function(o){var n=k._templateId+"_Res"+o.get_name()+c;
if(o.get_allowMultipleValues()){e(String.format("input[id*='{0}']",n),this._formElement).each(function(){this.checked=false;
});
}else{var m=$find(n);
if(m){m.get_items().getItem(0).select();
}}});
this._appointment.get_resources().forEach(function(p){var q=k._templateId+"_Res"+p.get_type()+c;
var m=l.getResourceTypeByName(p.get_type());
if(m&&m.get_allowMultipleValues()){var o=k._getResourceIndex(p);
var r=$get(q+"_"+o);
if(r){r.checked=true;
}}else{var n=$get(q);
if(n){k._selectDropDownValue(n,p._getInternalKey());
}}});
},_saveRecurrenceRule:function(m){var k=b.RecurrenceRule.fromPatternAndRange(this._getPattern(),this._getRange(m));
if(!k){m.set_recurrenceRule("");
return;
}var l=b.RecurrenceRule.parse(m.get_recurrenceRule());
if(l){Array.addRange(k.get_exceptions(),l.get_exceptions());
}m.set_recurrenceRule(k.toString());
},_populateAttributes:function(){var k=this;
this._appointment.get_attributes().forEach(function(m,l){var n=$find(k._templateId+"_Attr"+m);
if(!n){return;
}n.set_value(l);
});
},_populateRecurrence:function(){if(!this._getRecurrentCheckBox()){return;
}var o=this._appointment.get_recurrenceRule()!="";
this._getRecurrentCheckBox().checked=o;
var n=e("#"+this._templateId+"_RecurrencePanel");
if(!o){if(n.length>0){n.hide();
this._prefillRecurrenceControls();
}return;
}var l=b.RecurrenceRule.parse(this._appointment.get_recurrenceRule());
if(!l){n.hide();
this._getRecurrentCheckBox().checked=false;
return;
}var k=l.get_pattern();
var p=k.get_interval().toString();
var m=k.get_daysOfWeekMask();
switch(k.get_frequency()){case b.RecurrenceFrequency.Hourly:e(this._getElement("RepeatFrequencyHourly")).trigger("click");
this._getControl("HourlyRepeatInterval").set_value(p);
break;
case b.RecurrenceFrequency.Daily:e(this._getElement("RepeatFrequencyDaily")).trigger("click");
if(k.get_daysOfWeekMask()==b.RecurrenceDay.WeekDays){this._getElement("RepeatEveryWeekday").checked=true;
this._getElement("RepeatEveryNthDay").checked=false;
}else{this._getElement("RepeatEveryWeekday").checked=false;
this._getElement("RepeatEveryNthDay").checked=true;
this._getControl("DailyRepeatInterval").set_value(p);
}break;
case b.RecurrenceFrequency.Weekly:e(this._getElement("RepeatFrequencyWeekly")).trigger("click");
this._getControl("WeeklyRepeatInterval").set_value(p);
this._getElement("WeeklyWeekDayMonday").checked=(b.RecurrenceDay.Monday&m)==b.RecurrenceDay.Monday;
this._getElement("WeeklyWeekDayTuesday").checked=(b.RecurrenceDay.Tuesday&m)==b.RecurrenceDay.Tuesday;
this._getElement("WeeklyWeekDayWednesday").checked=(b.RecurrenceDay.Wednesday&m)==b.RecurrenceDay.Wednesday;
this._getElement("WeeklyWeekDayThursday").checked=(b.RecurrenceDay.Thursday&m)==b.RecurrenceDay.Thursday;
this._getElement("WeeklyWeekDayFriday").checked=(b.RecurrenceDay.Friday&m)==b.RecurrenceDay.Friday;
this._getElement("WeeklyWeekDaySaturday").checked=(b.RecurrenceDay.Saturday&m)==b.RecurrenceDay.Saturday;
this._getElement("WeeklyWeekDaySunday").checked=(b.RecurrenceDay.Sunday&m)==b.RecurrenceDay.Sunday;
break;
case b.RecurrenceFrequency.Monthly:e(this._getElement("RepeatFrequencyMonthly")).trigger("click");
if(0<k.get_dayOfMonth()){this._getElement("RepeatEveryNthMonthOnDate").checked=true;
this._getElement("RepeatEveryNthMonthOnGivenDay").checked=false;
this._getControl("MonthlyRepeatDate").set_value(k.get_dayOfMonth());
this._getControl("MonthlyRepeatIntervalForDate").set_value(p);
}else{this._getElement("RepeatEveryNthMonthOnDate").checked=false;
this._getElement("RepeatEveryNthMonthOnGivenDay").checked=true;
this._selectDropDownValue(this._getElement("MonthlyDayOrdinalDropDown"),k.get_dayOrdinal());
this._selectDropDownValue(this._getElement("MonthlyDayMaskDropDown"),m.toString());
this._getControl("MonthlyRepeatIntervalForGivenDay").set_value(p);
}break;
case b.RecurrenceFrequency.Yearly:e(this._getElement("RepeatFrequencyYearly")).trigger("click");
if(0<k.get_dayOfMonth()){this._getElement("RepeatEveryYearOnDate").checked=true;
this._getElement("RepeatEveryYearOnGivenDay").checked=false;
this._getControl("YearlyRepeatDate").set_value(k.get_dayOfMonth());
this._selectDropDownValue(this._getElement("YearlyRepeatMonthForDate"),b.RecurrenceMonth.toString(k.get_month()));
}else{this._getElement("RepeatEveryYearOnDate").checked=false;
this._getElement("RepeatEveryYearOnGivenDay").checked=true;
this._selectDropDownValue(this._getElement("YearlyDayOrdinalDropDown"),k.get_dayOrdinal());
this._selectDropDownValue(this._getElement("YearlyDayMaskDropDown"),m.toString());
this._selectDropDownValue(this._getElement("YearlyRepeatMonthForGivenDay"),b.RecurrenceMonth.toString(k.get_month()));
}break;
}this._populateRecurrenceRange(l.get_range());
n.show();
},_prefillRecurrenceControls:function(){var n=this._appointment.get_start();
var k=n.getDay();
this._getElement("WeeklyWeekDaySunday").checked=k==b.DayOfWeek.Sunday;
this._getElement("WeeklyWeekDayMonday").checked=k==b.DayOfWeek.Monday;
this._getElement("WeeklyWeekDayTuesday").checked=k==b.DayOfWeek.Tuesday;
this._getElement("WeeklyWeekDayWednesday").checked=k==b.DayOfWeek.Wednesday;
this._getElement("WeeklyWeekDayThursday").checked=k==b.DayOfWeek.Thursday;
this._getElement("WeeklyWeekDayFriday").checked=k==b.DayOfWeek.Friday;
this._getElement("WeeklyWeekDaySaturday").checked=k==b.DayOfWeek.Saturday;
var l=n.getDate();
this._getControl("MonthlyRepeatDate").set_value(l);
var m=n.getMonth()+1;
this._selectDropDownValue(this._getElement("YearlyRepeatMonthForDate"),b.RecurrenceMonth.toString(m));
this._getControl("YearlyRepeatDate").set_value(l);
this._selectDropDownValue(this._getElement("YearlyRepeatMonthForGivenDay"),b.RecurrenceMonth.toString(m));
},_populateRecurrenceRange:function(m){var n=m.get_maxOccurrences()!=j;
var l=m.get_recursUntil().getTime()!=f.getTime();
if(!n&&!l){this._getElement("RepeatIndefinitely").checked=true;
this._getElement("RepeatGivenOccurrences").checked=false;
this._getElement("RepeatUntilGivenDate").checked=false;
}else{if(n){this._getElement("RepeatIndefinitely").checked=false;
this._getElement("RepeatGivenOccurrences").checked=true;
this._getElement("RepeatUntilGivenDate").checked=false;
this._getControl("RangeOccurrences").set_value(m.get_maxOccurrences());
}else{this._getElement("RepeatIndefinitely").checked=false;
this._getElement("RepeatGivenOccurrences").checked=false;
this._getElement("RepeatUntilGivenDate").checked=true;
var k=this._scheduler.utcToDisplay(m.get_recursUntil());
if(!this._getElement("AllDayEvent").checked){k=d.add(k,-i);
}this._pickers.rangeEndDate.set_selectedDate(k);
}}},_selectDropDownValue:function(k,l){var m=$find(k.id);
if(m&&b.RadComboBox.isInstanceOfType(m)){m.get_items().forEach(function(n){if(n.get_value()==l){n.select();
}});
}else{e.each(k.options,function(){if(this.value==l){this.selected=true;
return false;
}});
}},_getFrequency:function(){if(!this._getRecurrentCheckBox().checked){return b.RecurrenceFrequency.None;
}if(this._getElement("RepeatFrequencyHourly").checked){return b.RecurrenceFrequency.Hourly;
}if(this._getElement("RepeatFrequencyDaily").checked){return b.RecurrenceFrequency.Daily;
}if(this._getElement("RepeatFrequencyWeekly").checked){return b.RecurrenceFrequency.Weekly;
}if(this._getElement("RepeatFrequencyMonthly").checked){return b.RecurrenceFrequency.Monthly;
}if(this._getElement("RepeatFrequencyYearly").checked){return b.RecurrenceFrequency.Yearly;
}return b.RecurrenceFrequency.None;
},_getInterval:function(){switch(this._getFrequency()){case b.RecurrenceFrequency.Hourly:return parseInt(this._getElement("HourlyRepeatInterval").value,10);
case b.RecurrenceFrequency.Daily:if(this._getElement("RepeatEveryNthDay").checked){return parseInt(this._getElement("DailyRepeatInterval").value,10);
}break;
case b.RecurrenceFrequency.Weekly:return parseInt(this._getElement("WeeklyRepeatInterval").value,10);
case b.RecurrenceFrequency.Monthly:if(this._getElement("RepeatEveryNthMonthOnDate").checked){return parseInt(this._getElement("MonthlyRepeatIntervalForDate").value,10);
}else{return parseInt(this._getElement("MonthlyRepeatIntervalForGivenDay").value,10);
}}return 0;
},_getDaysOfWeekMask:function(){switch(this._getFrequency()){case b.RecurrenceFrequency.Daily:return this._getElement("RepeatEveryWeekday").checked?b.RecurrenceDay.WeekDays:b.RecurrenceDay.EveryDay;
case b.RecurrenceFrequency.Weekly:var k=b.RecurrenceDay.None;
k|=this._getElement("WeeklyWeekDayMonday").checked?b.RecurrenceDay.Monday:k;
k|=this._getElement("WeeklyWeekDayTuesday").checked?b.RecurrenceDay.Tuesday:k;
k|=this._getElement("WeeklyWeekDayWednesday").checked?b.RecurrenceDay.Wednesday:k;
k|=this._getElement("WeeklyWeekDayThursday").checked?b.RecurrenceDay.Thursday:k;
k|=this._getElement("WeeklyWeekDayFriday").checked?b.RecurrenceDay.Friday:k;
k|=this._getElement("WeeklyWeekDaySaturday").checked?b.RecurrenceDay.Saturday:k;
k|=this._getElement("WeeklyWeekDaySunday").checked?b.RecurrenceDay.Sunday:k;
return k;
break;
case b.RecurrenceFrequency.Monthly:if(this._getElement("RepeatEveryNthMonthOnGivenDay").checked){return parseInt(this._getControl("MonthlyDayMaskDropDown").get_value(),10);
}break;
case b.RecurrenceFrequency.Yearly:if(this._getElement("RepeatEveryYearOnGivenDay").checked){return parseInt(this._getControl("YearlyDayMaskDropDown").get_value(),10);
}break;
}return b.RecurrenceDay.None;
},_getDayOfMonth:function(){switch(this._getFrequency()){case b.RecurrenceFrequency.Monthly:return this._getElement("RepeatEveryNthMonthOnDate").checked?parseInt(this._getElement("MonthlyRepeatDate").value,10):0;
case b.RecurrenceFrequency.Yearly:return this._getElement("RepeatEveryYearOnDate").checked?parseInt(this._getElement("YearlyRepeatDate").value,10):0;
}return 0;
},_getDayOrdinal:function(){switch(this._getFrequency()){case b.RecurrenceFrequency.Monthly:if(this._getElement("RepeatEveryNthMonthOnGivenDay").checked){return parseInt(this._getControl("MonthlyDayOrdinalDropDown",10).get_value());
}break;
case b.RecurrenceFrequency.Yearly:if(this._getElement("RepeatEveryYearOnGivenDay").checked){return parseInt(this._getControl("YearlyDayOrdinalDropDown",10).get_value());
}break;
}return 0;
},_getMonth:function(){if(this._getFrequency()!=b.RecurrenceFrequency.Yearly){return b.RecurrenceMonth.None;
}var k;
if(this._getElement("RepeatEveryYearOnDate").checked){k=this._getControl("YearlyRepeatMonthForDate").get_value();
}else{k=this._getControl("YearlyRepeatMonthForGivenDay").get_value();
}return b.RecurrenceMonth.parse(k,true);
},_getPattern:function(){if(!this._getRecurrentCheckBox()||!this._getRecurrentCheckBox().checked){return null;
}var k=new b.RecurrencePattern();
k.set_frequency(this._getFrequency());
k.set_interval(this._getInterval());
k.set_daysOfWeekMask(this._getDaysOfWeekMask());
k.set_dayOfMonth(this._getDayOfMonth());
k.set_dayOrdinal(this._getDayOrdinal());
k.set_month(this._getMonth());
if(k.get_frequency()==b.RecurrenceFrequency.Weekly){k.set_firstDayOfWeek(this._scheduler.get_firstDayOfWeek());
}return k;
},_getRange:function(n){if(!this._getRecurrentCheckBox()||!this._getRecurrentCheckBox().checked){return null;
}var k=this._scheduler.displayToUtc(n.get_start());
var o=this._scheduler.displayToUtc(n.get_end());
var m=new b.RecurrenceRange();
m.set_start(k);
m.set_eventDuration(d.subtract(o,k));
m.set_maxOccurrences(0);
m.set_recursUntil(f);
if(this._getElement("RepeatGivenOccurrences").checked){var l=parseInt(this._getElement("RangeOccurrences").value,10);
if(!isNaN(l)){m.set_maxOccurrences(l);
}}if(this._getElement("RepeatUntilGivenDate").checked&&!this._pickers.rangeEndDate.isEmpty()){m.set_recursUntil(this._scheduler.displayToUtc(this._pickers.rangeEndDate.get_selectedDate()));
if(!this._getElement("AllDayEvent").checked){m.set_recursUntil(d.add(m.get_recursUntil(),i));
}}return m;
},_getSubjectTextBox:function(){return $find(this._templateId+"_Subject");
},_getDescriptionTextBox:function(){return $find(this._templateId+"_Description");
},_getElement:function(k){return $get(this._templateId+"_"+k);
},_getControl:function(k){return $find(this._templateId+"_"+k);
},_getRecurrentCheckBox:function(){return this._getElement("RecurrentAppointment");
},_initializePickers:function(){var l=Function.createDelegate(this,this._showPopup);
var n=this._templateId;
this._pickers={startDate:$find(n+"_StartDate"),endDate:$find(n+"_EndDate"),rangeEndDate:$find(n+"_RangeEndDate"),startTime:$find(n+"_StartTime"),endTime:$find(n+"_EndTime")};
e.each(this._pickers,function(){if(this&&this.get_dateInput){this.get_dateInput().add_focus(l);
}});
var k=[$get(this._pickers.startDate.get_element().id+"_wrapper"),$get(this._pickers.startTime.get_element().id+"_wrapper"),$get(this._pickers.startTime.get_element().id+"_timeView_wrapper"),$get(this._pickers.endDate.get_element().id+"_wrapper"),$get(this._pickers.endTime.get_element().id+"_wrapper"),$get(this._pickers.endTime.get_element().id+"_timeView_wrapper"),$get(this._templateId+"_SharedCalendar")];
if(this._pickers.rangeEndDate){Array.add(k,$get(this._pickers.rangeEndDate.get_element().id+"_wrapper"));
}var o=this;
var m="focusin";
e(this._formElement).bind(m,function(t){var q=false;
for(var p=0,r=k.length;
p<r;
p++){var s=k[p];
if($telerik.isDescendantOrSelf(s,t.target)){q=true;
break;
}}if(!q){o._hidePickerPopups();
}});
e(this._formElement).bind("formMoving",function(){o._hidePickerPopups();
});
if(this._isModal){e(document).bind("scroll."+this._eventNamespace,function(){o._hidePickerPopups();
});
}},_initializeAdvancedFormValidators:function(){var l=this._createValidatorToolTip();
if(typeof(Page_Validators)=="undefined"){return;
}for(var k=0;
k<Page_Validators.length;
k++){var n=Page_Validators[k];
if(this._validatorIsInTemplate(n)){var m=e("#"+n.controltovalidate);
if(m.length==0){break;
}if(m.parent().is(".rsAdvDatePicker")||m.parent().is(".rsAdvTimePicker")){e("#"+n.controltovalidate+"_dateInput_text").bind("focus",{toolTip:l},this._showToolTip).bind("blur",{toolTip:l},this._hideToolTip)[0].errorMessage=n.errormessage;
}else{m.addClass("rsValidatedInput");
}m[0].errorMessage=n.errormessage;
this._updateValidator(n,m);
}}var p=this;
var o=ValidatorUpdateDisplay;
ValidatorUpdateDisplay=function(q){if(p._validatorIsInTemplate(q)&&q.controltovalidate){p._updateValidator(q);
}else{o(q);
}};
e(".rsValidatedInput",this._formElement).bind("focus",{toolTip:l},this._showToolTip).bind("blur",{toolTip:l},this._hideToolTip);
},_initializeAllDayCheckbox:function(){var p=e("#"+this._templateId+"_AllDayEvent");
var q=e(p[0].parentNode.parentNode.parentNode);
var n=q.find(".rsAdvTimePicker");
if($telerik.isIE6||$telerik.isIE7){e(".rsAdvTimePicker, .rsAdvDatePicker",this._formElement).css({display:"inline",zoom:1,width:""});
}else{e(".rsAdvTimePicker, .rsAdvDatePicker",this._formElement).css({display:"inline-block",width:""});
}var s=e("#"+this._templateId+"_StartTime_dateInput_text").outerWidth();
n.width(s);
var k=e(".rsTimePick",this._formElement).eq(0).outerWidth();
var r=k-s;
var l=$get(this._templateId+"_StartTimeValidator");
var t=$get(this._templateId+"_StartTimeValidator");
var o=this;
q.find(".rsAdvTimePicker > input").css("display","none");
var m=function(u,x){var v=function(){if($telerik.isSafari||$telerik.isOpera){n.css("display","inline-block");
}else{n.show();
}};
if(!u){v();
}q.find(".rsTimePick").each(function(){if(x){e(this).stop();
if(u){e(this).animate({width:r},"fast","linear",function(){n.hide();
});
}else{e(this).animate({width:k},"fast");
}}else{if(u){n.hide();
e(this).width(r);
}else{e(this).width(k);
}}});
if(typeof(ValidatorEnable)!="undefined"){ValidatorEnable(l,!u);
ValidatorEnable(t,!u);
}var y=o._pickers.startTime;
y.set_enabled(!u);
var w=o._pickers.endTime;
w.set_enabled(!u);
};
this._onAllDayCheckBoxClick=m;
m(p[0].checked,false);
p.click(function(){m(this.checked,true);
});
},_initializeRecurrenceCheckbox:function(){var l=e("#"+this._templateId+"_RecurrencePanel");
var k=e("#"+this._templateId+"_RecurrentAppointment");
if(k[0].checked){l.show();
}k.click(function(){l.stop(false,true).animate({height:"toggle"},"slow");
});
},_initializeResetExceptions:function(){var k=e("#"+this._templateId+"_ResetExceptions");
if(k.length==0){return;
}var l=this._scheduler;
var m=this;
var o=l.get_localization();
var n=o.AdvancedDone;
if(k[0].innerHTML.indexOf(n)>-1){k.click(function(){return false;
});
window.setTimeout(function(){k.fadeOut("slow");
},2000);
}else{k.click(function(){var p=m._getRemoveExceptionsDialog();
p.set_onActionConfirm(function(){k[0].innerHTML=o.AdvancedWorking;
window.location.href=k[0].href;
p.dispose();
}).show();
return false;
});
}},_getRemoveExceptionsDialog:function(){var k=this._scheduler.get_localization();
return $telerik.$.modal(this._formElement).initialize().set_content({title:k.ConfirmResetExceptionsTitle,content:k.ConfirmResetExceptionsText,ok:k.ConfirmOK,cancel:k.ConfirmCancel});
},_initializeRecurrenceRadioButtons:function(){var l=[$get(this._templateId+"_RepeatFrequencyHourly"),$get(this._templateId+"_RepeatFrequencyDaily"),$get(this._templateId+"_RepeatFrequencyWeekly"),$get(this._templateId+"_RepeatFrequencyMonthly"),$get(this._templateId+"_RepeatFrequencyYearly")];
var p=e("#"+this._templateId+"_RecurrencePatternPanel .rsAdvPatternPanel");
var o=function(q){var r=q.value.replace("RepeatFrequency","RecurrencePattern")+"Panel";
return p.filter("[id$='"+r+"']");
};
for(var k=0,n=l.length;
k<n;
k++){var m=l[k];
if(m.checked){o(m).show();
}e(m).click(function(){var q=e(o(this));
if(q.css("display")=="none"){p.hide();
q.show();
}});
}},_initializeLinkedRecurrenceControls:function(){var m={};
var l=this._templateId;
var k="#"+l;
m[l+"_RepeatEveryNthDay"]=[e(k+"_DailyRepeatInterval"),e(k+"_DailyRepeatInterval_SpinUpButton"),e(k+"_DailyRepeatInterval_SpinDownButton")];
m[l+"_RepeatEveryNthMonthOnDate"]=[e(k+"_MonthlyRepeatDate"),e(k+"_MonthlyRepeatDate_SpinUpButton"),e(k+"_MonthlyRepeatDate_SpinDownButton"),e(k+"_MonthlyRepeatIntervalForDate"),e(k+"_MonthlyRepeatIntervalForDate_SpinUpButton"),e(k+"_MonthlyRepeatIntervalForDate_SpinDownButton")];
m[l+"_RepeatEveryNthMonthOnGivenDay"]=[e(k+"_MonthlyDayOrdinalDropDown"),e(k+"_MonthlyDayMaskDropDown"),e(k+"_MonthlyRepeatIntervalForGivenDay"),e(k+"_MonthlyRepeatIntervalForGivenDay_SpinUpButton"),e(k+"_MonthlyRepeatIntervalForGivenDay_SpinDownButton")];
m[l+"_RepeatEveryYearOnDate"]=[e(k+"_YearlyRepeatMonthForDate"),e(k+"_YearlyRepeatDate"),e(k+"_YearlyRepeatDate_SpinUpButton"),e(k+"_YearlyRepeatDate_SpinDownButton")];
m[l+"_RepeatEveryYearOnGivenDay"]=[e(k+"_YearlyDayOrdinalDropDown"),e(k+"_YearlyDayMaskDropDown"),e(k+"_YearlyRepeatMonthForGivenDay")];
m[l+"_RepeatGivenOccurrences"]=[e(k+"_RangeOccurrences"),e(k+"_RangeOccurrences_SpinUpButton"),e(k+"_RangeOccurrences_SpinDownButton")];
m[l+"_RepeatUntilGivenDate"]=[e(k+"_RangeEndDate_dateInput_text")];
e.each(m,function(n){var p=e("#"+n);
var o=m[n][0];
p.click(function(){if(o.css("visibility")=="hidden"){var q=e("#"+o[0].id+"_text");
if(q){q.focus();
}}else{o.focus();
}});
e.each(m[n],function(){e(this).focus(function(){p[0].checked=true;
});
});
});
},_updateValidator:function(l){var k=e("#"+l.controltovalidate);
if(k.is(".rsValidatedInput")){k=k.parent();
}if(!l.isvalid){k.addClass("rsInvalid");
}else{k.removeClass("rsInvalid");
}},_validatorIsInTemplate:function(k){return e(k).parents().is("#"+this._schedulerElementId);
},_createValidatorToolTip:function(){return e("<div></div>").hide().appendTo(e(".rsAdvancedEdit",$get(this._schedulerElementId)));
},_showToolTip:function(s){var l=s.data.toolTip;
var q=e(this);
var o=false;
var k=q.parent();
if(q.is("textarea")){o=true;
q=k;
}var p=q.is(".rsInvalid");
p=p||k.parent().children().is(".rsInvalid");
if(p){l.css("visibility","hidden").text(this.errorMessage).addClass("rsValidatorTooltip");
var r=q;
if(k.is(".riCell")){r=k;
}var m=r.position();
var n=m.left+"px";
if(o){n=(m.left+r.outerWidth()-l.outerWidth())+"px";
}var t=(m.top-l.outerHeight())+"px";
l.css({top:t,left:n,zIndex:h,visibility:"visible"}).fadeIn("fast");
}},_hideToolTip:function(k){var l=k.data.toolTip;
l.hide();
},_hidePickerPopups:function(){if(!this._pickers){return;
}for(var l in this._pickers){var k=this._pickers[l];
if(!k){continue;
}if(k.hideTimePopup){k.hideTimePopup();
}else{k.hidePopup();
}}},_showPopup:function(k){this._hidePickerPopups();
if(k.Owner.showTimePopup){k.Owner.showTimePopup();
}else{k.Owner.showPopup();
}}};
})();
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();