ASPxSchedulerFormType = _aspxCreateClass(null, { 
});
ASPxSchedulerFormType.None = "None",
ASPxSchedulerFormType.Appointment = "Appointment",
ASPxSchedulerFormType.AppointmentInplace = "AppointmentInplace", 
ASPxSchedulerFormType.GotoDate = "GotoDate";
ASPxSchedulerFormVisibility = _aspxCreateClass(null, {
});
ASPxSchedulerFormVisibility.None = "None",
ASPxSchedulerFormVisibility.PopupWindow = "PopupWindow",
ASPxSchedulerFormVisibility.FillControlArea = "FillControlArea";
ASPxSchedulerSmartTagType = _aspxCreateClass(null, {
});
ASPxSchedulerSmartTagType.Appointment = 1;
ASPxSchedulerSmartTagType.Selection = 2;
ASPxClientRecurrenceRange = _aspxCreateClass(null, {
});
ASPxClientRecurrenceRange.NoEndDate = "NoEndDate";
ASPxClientRecurrenceRange.OccurrenceCount = "OccurrenceCount";
ASPxClientRecurrenceRange.EndByDate = "EndByDate";
ASPxClientRecurrenceType = _aspxCreateClass(null, {
});
ASPxClientRecurrenceType.Daily = "Daily";
ASPxClientRecurrenceType.Weekly = "Weekly";
ASPxClientRecurrenceType.Monthly = "Monthly";
ASPxClientRecurrenceType.Yearly = "Yearly";
ASPxClientRecurrenceType.Hourly = "Hourly";
ASPxClientWeekDays = _aspxCreateClass(null, {
});
ASPxClientWeekDays.Sunday = 1;
ASPxClientWeekDays.Monday = 2;
ASPxClientWeekDays.Tuesday = 4;
ASPxClientWeekDays.Wednesday = 8;
ASPxClientWeekDays.Thursday = 16;
ASPxClientWeekDays.Friday = 32;
ASPxClientWeekDays.Saturday = 64;
ASPxClientWeekDays.WeekendDays = ASPxClientWeekDays.Sunday | ASPxClientWeekDays.Saturday;
ASPxClientWeekDays.WorkDays = ASPxClientWeekDays.Monday | ASPxClientWeekDays.Tuesday | ASPxClientWeekDays.Wednesday | ASPxClientWeekDays.Thursday | ASPxClientWeekDays.Friday;
ASPxClientWeekDays.EveryDay = ASPxClientWeekDays.WeekendDays | ASPxClientWeekDays.WorkDays;
ASPxClientWeekOfMonth = _aspxCreateClass(null, {
});
ASPxClientWeekOfMonth.None = 0;
ASPxClientWeekOfMonth.First = 1;
ASPxClientWeekOfMonth.Second = 2;
ASPxClientWeekOfMonth.Third = 3;
ASPxClientWeekOfMonth.Fourth = 4;
ASPxClientWeekOfMonth.Last = 5;
ASPxSchedulerDateTimeHelper = _aspxCreateClass(null, {
});
ASPxSchedulerDateTimeHelper.DaySpan = 24 * 60 * 60 * 1000; 
ASPxSchedulerDateTimeHelper.TruncToDate = function(dateTime) {
 return new Date(dateTime.getFullYear(), dateTime.getMonth(), dateTime.getDate()); 
}
ASPxSchedulerUtils = _aspxCreateClass(null, { 
});
ASPxSchedulerUtils.IsAppointmentResourcesEmpty = function(appointmentResources) {
 if(appointmentResources.length == 0)
  return true;
 if(appointmentResources.length == 1 && appointmentResources[0] == "null") 
  return true;
 else
  return false;
}
ASPxClientSchedulerRelatedControlBase = _aspxCreateClass(ASPxClientControl, {
 constructor: function(name) {
  this.constructor.prototype.constructor.call(this, name);
  this.schedulerControlId = "";
  this.standalone = true;
 },
 GetMainElement: function() { 
  if(!_aspxIsExistsElement(this.mainElement))
   this.mainElement = _aspxGetElementById(this.name + "_mainCell");
  return this.mainElement;
 },
 CreateLoadingDiv: function(parentNode, offsetNode) {
  if(this.standalone)
   return this.constructor.prototype.CreateLoadingDiv.call(this, parentNode, offsetNode);
  return null;  
 },
 GetLoadingDiv: function(){
  return _aspxGetElementById(this.schedulerControlId + "_LD");
 } 
});
function aspxSchedulerSetRecurrenceControlsVisibility(controlsIds, recurrenceControlContainerId, visibleIndex) {
 var count = controlsIds.length;
 for(var i = 0; i < count; i++) {
  var ctl = _aspxGetElementById(controlsIds[i]);
  if(_aspxIsExistsElement(ctl)) {
   _aspxSetElementDisplay(ctl, visibleIndex == i);
  }
 }
 var container = _aspxGetElementById(recurrenceControlContainerId);
 if (_aspxIsExists(container.rbcControlsSizeCorrected)) {
  if (container.rbcControlsSizeCorrected[visibleIndex])
   return;
 } else {
  container.rbcControlsSizeCorrected = [ ];
 }
 container.rbcControlsSizeCorrected[visibleIndex] = true;
 if (_aspxIsExistsElement(container))
  aspxGetControlCollection().AdjustControls(container, __aspxCheckSizeCorrectedFlag);
}
function aspxSchedulerChangeElementVisibility(id){
 var ctl = _aspxGetElementById(id);
 if(_aspxIsExistsElement(ctl))
  _aspxSetElementDisplay(ctl, !_aspxGetElementDisplay(ctl));  
}
function _aspxArrayClone(src) {
 return new Array(src);
}
function _aspxArrayContains(array, element) { 
 return _aspxArrayIndexOf(array, element) >= 0;
}
function _aspxArrayEqual(array1, array2) {
 var count1 = array1.length;
 var count2 = array2.length;
 if(count1 != count2)
  return false;
 for(var i = 0; i < count1; i++)
  if(array1[i] != array2[i])
   return false;
 return true;
}
ASPxSchedulerMeasurer = {
 SetCustomDateHeaderContent: function(headers, dates, headerCaptions, headerToolTips) {
  var count = headers.length;
  if (count <= 0)
   return;
  this.EnsureFormatter();
  this.formatter.SetFormatString("d MMMM yyyy");
  var toolTipHelper = new ASPxSchedulerSimpleToolTipHelper(headerToolTips);
  for (var i = 0; i < count; i++) {
   var header = headers[i];
   var toolTip = toolTipHelper.GetToolTip(i, this.formatter.Format(dates[i]));
   header.setAttribute("title", toolTip);
   header.innerHTML = headerCaptions[i];
  }
 },
 SetCustomDayOfWeekHeaderContent: function(headers, days, headerCaptions, headerToolTips) {
  var count = headers.length;
  if (count <= 0)
   return;
  this.EnsureFormatter();
  this.formatter.SetFormatString("d MMMM yyyy");
  var toolTipHelper = new ASPxSchedulerSimpleToolTipHelper(headerToolTips);
  for (var i = 0; i < count; i++) {
   var header = headers[i];
   var toolTip = toolTipHelper.GetToolTip(i, this.GetDayName(days[i]));
   header.setAttribute("title", toolTip);
   header.innerHTML = headerCaptions[i];
  }
 },
 SetOptimalDayNumberHeaderContent: function(headers, dates, formats, headerToolTips) {
  var count = headers.length;
  if (count <= 0)
   return;
  this.EnsureFormatter();
  var toolTipHelper = new ASPxSchedulerSimpleToolTipHelper(headerToolTips);
  this.formatter.SetFormatString("d MMMM yyyy");
  for(var i=0; i < count; i++) {
   var header = headers[i];
   var toolTip = toolTipHelper.GetToolTip(i, this.formatter.Format(dates[i]));
   header.setAttribute("title", toolTip);
   header.innerHTML = dates[i].getDate();
  }
 },
 SetOptimalDayOfWeekHeadersContent: function(headers, days, headerToolTips) {
  if (headers.length <= 0)
   return;
  if (count <= 0)
   return;
  var toolTipHelper = new ASPxSchedulerSimpleToolTipHelper(headerToolTips);
  this.EnsureFormatter();
  var measureDiv = this.CreateMeasureDiv(headers[0]);
  var headerTexts = [];
  var headerContentWidths = [];
  var count = headers.length;
  for (var i = 0; i <count; i++) {
   var day = days[i];
   var toolTip = toolTipHelper.GetToolTip(i, this.GetDayName(day));
   this.SetOptimalDayOfWeekHeader(headers[i], day, measureDiv, toolTip);
  }
  _aspxRemoveChildFromParent(document.body, measureDiv);          
 },
 SetOptimalDayOfWeekHeader: function(header, day, measureDiv, toolTip) {
  var fullDayName = this.GetDayName(day);
  measureDiv.innerHTML = fullDayName;
  var width = measureDiv.clientWidth;
  var desiredWidth = header.clientWidth;
  if (width <= desiredWidth)
   header.innerHTML = fullDayName;
  else
   header.innerHTML = this.GetAbbrDayName(day);
  header.setAttribute("title", toolTip);
 },
 GetDayName: function(day) {
  var dayNames = __aspxCultureInfo.dayNames;
  return (day == 8) ? dayNames[6] + "/" + dayNames[0] : dayNames[day];
 },
 GetAbbrDayName: function(day) {
  var dayNames = __aspxCultureInfo.abbrDayNames;
  return (day == 8) ? dayNames[6] + "/" + dayNames[0] : dayNames[day];
 },
 SetOptimalHeadersContent: function(headers, dates, formats, headerToolTips) {
  if (headers.length <= 0)
   return;
  this.EnsureFormatter();
  var measureDiv = this.CreateMeasureDiv(headers[0]);
  var headerTexts = [];
  var headerContentWidths = [];
  this.InitializeHeadersIntermediateInfo(headers, headerTexts, headerContentWidths);
  var count = formats.length;
  for (var i = 0; i < count; i++) { 
   this.formatter.SetFormatString(formats[i]);
   this.SetOptimalHeadersContentCore(headers, dates, headerTexts, headerContentWidths, measureDiv);
  }
  this.SetNewHeadersContent(headers, headerTexts, dates, headerToolTips);
  _aspxRemoveChildFromParent(document.body, measureDiv);
 },
 InitializeHeadersIntermediateInfo: function(headers, headerTexts, headerContentWidths) {
  var count = headers.length;
  for (var i = 0; i < count; i++) {
   _aspxArrayPush(headerTexts, "&hellip;");
   _aspxArrayPush(headerContentWidths, -1);
  }
 },
 SetNewHeadersContent: function(headers, headerTexts, dates, headerToolTips) {
  var toolTipHelper = new ASPxSchedulerSimpleToolTipHelper(headerToolTips);
  var count = headers.length;
  this.formatter.SetFormatString("d MMMM yyyy");
  for (var i = 0; i < count; i++) {
   var header = headers[i];
   var toolTip = toolTipHelper.GetToolTip(i, this.formatter.Format(dates[i]));
   header.setAttribute("title", toolTip);
   header.innerHTML = headerTexts[i];
  }
 },
 SetOptimalHeadersContentCore: function(headers, dates, headerTexts, headerContentWidths, measureDiv) {
  var count = headers.length;
  for (var i = count - 1; i >= 0; i--) {
   var text = this.formatter.Format(dates[i]);
   measureDiv.innerHTML = text;
   var width = measureDiv.clientWidth;
   var desiredWidth = headers[i].clientWidth;
   if (width <= desiredWidth && headerContentWidths[i] == -1) {
     headerContentWidths[i] = width;
     headerTexts[i] = text;
   }
  }
 },
 CreateMeasureDiv: function(element) {
  var result = document.createElement("div");   
  document.body.appendChild(result);
  result.style.cssText = element.style.cssText;
  result.style.position = "absolute";
  result.style.top = "-100px";
  result.style.width = "";
  result.className = element.className;
  return result;
 },
 EnsureFormatter: function() {
  if (!_aspxIsExists(this.formatter))
   this.formatter = new ASPxDateFormatter();
 }
}
ASPxSchedulerSimpleToolTipHelper = _aspxCreateClass(null, {
 constructor: function(toolTips) {
  this.toolTips = toolTips;
  this.useToolTipFromServer = _aspxIsExists(toolTips);
 },
 GetToolTip: function(toolTipIndex, defaultToolTip) {
  if (this.useToolTipFromServer)
   return this.toolTips[toolTipIndex];
  return defaultToolTip;
 }
});
function _aspxSetSchedulerDivDisplay(appointmentDiv, visible) {
 appointmentDiv.style.display = visible ? "block" : "none";
}
ASPxSchedulerPropertyApplyController = _aspxCreateClass(null, {
 constructor: function(scheduler) {
  this.scheduler = scheduler;
  this.createPropertyValueHandlers = new Object();
  this.createPropertyValueHandlers["interval"] = this.CreateIntervalPropertyValue;
 },
 CreateIntervalPropertyValue: function(property, value) {
  return new ASPxClientTimeInterval(value.start, value.duration);
 },
 ApplyProperties: function(obj, dictionary) {
  for (var property in dictionary) {
   var propertyValue = dictionary[property];
   var createValueHandler = this.createPropertyValueHandlers[property];
   if (createValueHandler) 
    propertyValue = createValueHandler(property, propertyValue);
   obj[property] = propertyValue;
  }
 } 
});
ASPxClientAppointmentPropertyApplyController = _aspxCreateClass(ASPxSchedulerPropertyApplyController, {
 constructor: function(scheduler) {
  this.constructor.prototype.constructor.call(this, scheduler);
  this.createPropertyValueHandlers["pattern"] = this.CreatePatternPropertyValue;
  this.createPropertyValueHandlers["recurrenceInfo"] = this.CreateRecurrenceInfoPropertyValue;
 },
 CreatePatternPropertyValue: function(property, value) {
  var pattern = this.scheduler.GetAppointment(value.appointmentId);
  if (pattern == null) 
   pattern = new ASPxClientAppointment();
  var propertyController = new ASPxClientAppointmentPropertyApplyController(this.scheduler);
  propertyController.ApplyProperties(pattern, value);
  this.scheduler.AddAppointmentPattern(pattern);
  return pattern;
 },
 CreateRecurrenceInfoPropertyValue: function(property, value) {
  var recurrenceInfo = new ASPxClientRecurrenceInfo();
  var propertyController = new ASPxClientRecurrenceInfoPropertyApplyController(this.scheduler);
  propertyController.ApplyProperties(recurrenceInfo, value);
  return recurrenceInfo;
 }
});
ASPxClientRecurrenceInfoPropertyApplyController = _aspxCreateClass(ASPxSchedulerPropertyApplyController, {
 constructor: function(scheduler) {
  this.constructor.prototype.constructor.call(this, scheduler);
 }
});
