﻿Type.registerNamespace("Telerik.Web.UI");
Telerik.Web.UI.SchedulerAppointment=function(_1,_2,_3){
this.Start=_1.Start;
this.End=_1.End;
this.ID=_1.ID;
this._internalID=_1.InternalID;
this.Subject=_1.Subject;
this.ToolTip=_1.ToolTip;
this._visible=_1.Visible;
this._recurrenceState=_1.RecurrenceState;
this._recurrenceParentID=_1.RecurrenceParentID;
this._domElements=_1.DomElements;
this._domElement=null;
if(_1.DomElements.length>0){
this._domElement=$get(this._domElements[0]);
}
this._radScheduler=_2;
this._oldZIndex=null;
this._originalParent=null;
this._selected=false;
this._allowEdit=null;
if(typeof (_1.AllowEdit)!="undefined"){
this._allowEdit=_1.AllowEdit;
}
this._allowDelete=null;
if(typeof (_1.AllowDelete)!="undefined"){
this._allowDelete=_1.AllowDelete;
}
};
Telerik.Web.UI.SchedulerAppointment.DragDataType="SchedulerAppointment";
Telerik.Web.UI.SchedulerAppointment.prototype={_getDuration:function(){
return this.End-this.Start;
},_setDuration:function(_4,_5){
this._setDuration((_4*3600000)+(_5*60000));
},_setDuration:function(_6){
var _7=_6/60000;
var _8=this._domElement.parentNode.parentNode.offsetHeight;
var _9=TelerikCommonScripts.getBorderWidth(this._domElement.parentNode.parentNode,Telerik.Web.BoxSide.Bottom);
var _a=((_7/this.get_RadScheduler().get_MinutesPerRow())*_8)-_9;
var _b=parseInt(this._domElement.style.paddingBottom);
if(isNaN(_b)){
_b=0;
}
this._domElement.style.height=_a-_b+"px";
var _c=Telerik.Web.DomElement.getElementByClassName(this._domElement,"rsAptBottom","div");
this.get_RadScheduler()._fixIEBottom(_c);
this.End.setTime(this.Start.getTime());
Telerik.Web.UI.RadScheduler.IncrementMilliseconds(this.End,_6);
},_startDrag:function(){
var _d=this._domElement;
var _e=this.get_RadScheduler().get_element();
this._dragTimeout=window.setTimeout(function(){
Telerik.Web.DomElement.setOpacity(_d,0.8);
_e.style.cursor="move";
},100);
this._oldZIndex=this._domElement.style.zIndex;
this._domElement.style.zIndex=999;
this._originalParent=this._domElement.parentNode;
Telerik.Web.DomElement.removeCssClass(_d,"rsWAppointmentDelete");
},_endDrag:function(_f){
this._finishDrag(_f,false);
},_abortDrag:function(){
this._originalParent.appendChild(this._domElement);
this._finishDrag(null,true);
},_select:function(){
this._selected=true;
},_unselect:function(){
this._selected=false;
},_finishDrag:function(_10,_11){
window.clearTimeout(this._dragTimeout);
Telerik.Web.DomElement.setOpacity(this._domElement,1);
this._domElement.style.zindex=this._oldZIndex;
var _12=this.get_RadScheduler().get_element();
if(_12&&_12.style){
this.get_RadScheduler().get_element().style.cursor="";
}
if(this._originalParent.parentNode!=_10&&!_11){
var _13=this.get_RadScheduler()._getCellTimeFromDomElement(this._originalParent.parentNode);
var _14=this.get_RadScheduler()._getCellTimeFromDomElement(_10);
var _15;
var _16=this._getDuration();
if(this.get_RadScheduler().get_SelectedView()=="MonthView"){
Telerik.Web.UI.RadScheduler.IncrementMilliseconds(this.Start,_14-_13);
_14=this.Start;
}
var _17=new Date(_14.getTime());
Telerik.Web.UI.RadScheduler.IncrementMilliseconds(_17,_16);
var _18="Move";
if(this.get_RadScheduler().getRowIndex(_10)==-1){
Telerik.Web.UI.RadScheduler.IncrementTime(_14,0,this.get_RadScheduler().get_MinutesPerRow());
_18="MoveToAllDay";
}else{
if(this.get_RadScheduler().getRowIndex(this._originalParent.parentNode)==-1){
var _17=new Date(_14.getTime());
Telerik.Web.UI.RadScheduler.IncrementTime(_17,0,this.get_RadScheduler().get_MinutesPerRow()*2);
}
}
_15={Command:_18,AppointmentID:this._internalID,StartDate:_14,EndDate:_17};
if(this.get_RadScheduler().get_SelectedView()=="ResourceView"&&this.get_RadScheduler().get_Resources()){
var _19=this.get_RadScheduler()._getCellCoordinates(_10).cellIndex;
_15.ResourceKey=this.get_RadScheduler().get_Resources()[_19].InternalKey;
var _1a=this.get_RadScheduler()._getCellCoordinates(this._originalParent).cellIndex;
_15.OldResourceKey=this.get_RadScheduler().get_Resources()[_1a].InternalKey;
}
this.get_RadScheduler().postback(_15);
}
},get_Start:function(){
return this.Start;
},get_End:function(){
return this.End;
},get_Subject:function(){
return this.Subject;
},get_ToolTip:function(){
return this.ToolTip;
},set_ToolTip:function(_1b){
this.ToolTip=_1b;
},get_RadScheduler:function(){
return this._radScheduler;
},set_AllowEdit:function(_1c){
this._allowEdit=_1c;
},get_AllowEdit:function(){
return this._allowEdit;
},set_AllowDelete:function(_1d){
this._allowDelete=_1d;
},get_AllowDelete:function(){
return this._allowDelete;
}};
Telerik.Web.UI.SchedulerAppointment.registerClass("Telerik.Web.UI.SchedulerAppointment");


if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();