﻿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.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;
};
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.RadScheduler.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.RadScheduler._fixIEBottom(_c);
this.End.setTime(this.Start.getTime());
this.End.addMilliseconds(_6);
},startDrag:function(){
var _d=this.DomElement;
var _e=this.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(){
Telerik.Web.DomElement.addCssClass(this.DomElement,"rsAptSelected");
this.Selected=true;
},unselect:function(){
Telerik.Web.DomElement.removeCssClass(this.DomElement,"rsAptSelected");
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.RadScheduler.get_element();
if(_12&&_12.style){
this.RadScheduler.get_element().style.cursor="";
}
if(this._originalParent.parentNode!=_10&&!_11){
var _13=this.RadScheduler._getRowTimeFromDomElement(this._originalParent.parentNode);
var _14=this.RadScheduler._getRowTimeFromDomElement(_10);
var _15;
var _16=this.getDuration();
if(this.RadScheduler.ViewType=="MonthView"){
this.Start.addMilliseconds(_14-_13);
_14=this.Start;
}
var _17=new Date(_14.getTime());
_17.addMilliseconds(_16);
var _18="Move";
if(this.RadScheduler.getRowIndex(_10)==-1){
_14.addHours(0,this.RadScheduler.MinutesPerRow);
_18="MoveToAllDay";
}else{
if(this.RadScheduler.getRowIndex(this._originalParent.parentNode)==-1){
var _17=new Date(_14.getTime());
_17.addHours(0,this.RadScheduler.MinutesPerRow*2);
}
}
_15={Command:_18,AppointmentID:this.ID,StartDate:_14,EndDate:_17};
this.RadScheduler.postback(_15);
}
}};
Telerik.Web.UI.SchedulerAppointment.registerClass("Telerik.Web.UI.SchedulerAppointment");


if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();