var recycleDiv = document.createElement("DIV");
function _aspxRemoveChildFromParent(parentNode, element) {  
 parentNode.removeChild(element);
 if(__aspxIE) {  
  recycleDiv.appendChild(element);
  recycleDiv.innerHTML = "";
  element = null;
 }
}
function _aspxRecycleNode(element) {
 var parentNode = element.parentNode;
 if(_aspxIsExists(parentNode)) {
  parentNode.removeChild(element);
 }
 if(!__aspxIE)
  return;
 recycleDiv.appendChild(element);
 recycleDiv.innerHTML = "";
 element = null;
}
function _aspxDateIncrease(date, spanInMilliseconds) {
 return new Date(date.valueOf() + spanInMilliseconds);  
}
function _aspxDateIncreaseWithUtcOffset(date, spanInMilliseconds) {
 var result = _aspxDateIncrease(date, spanInMilliseconds);
 var utcDiff = (result.getTimezoneOffset() - date.getTimezoneOffset()) * 60000;
 return _aspxDateIncrease(result, utcDiff);
}
function _aspxDateDiffInMilliseconds(date1, date2) {
 return date1 - date2;
}
function _aspxDateSubsWithTimezone(date1, date2) {
 return date1 - date2 + (date2.getTimezoneOffset() - date1.getTimezoneOffset()) * 60000;
}
function _aspxDateTimeToMilliseconds(dateTime) {
 var result = dateTime.valueOf();
 result -= 60000 * dateTime.getTimezoneOffset();
 return result;
}
function _aspxDateTimeMinValue(value1, value2) {
 return value1 < value2 ? value1 : value2;
}
function _aspxDateTimeMaxValue(value1, value2) {
 return value1 > value2 ? value1 : value2;
}
function _aspxGetShiftKey(evt) { 
 if(__aspxIE) return (event != null) ? event.shiftKey : false;
 else return (evt != null) ? evt.shiftKey : false;
}
function _aspxGetCtrlKey(evt) { 
 if(__aspxIE) return (event != null) ? event.ctrlKey : false;
 else return (evt != null) ? evt.ctrlKey : false;
}
function aspxIsLeftKey(evt) {
 return evt.keyCode == 0x25;
}
function aspxIsUpKey(evt) {
 return evt.keyCode == 0x26;
}
function aspxIsRightKey(evt) {
 return evt.keyCode == 0x27;
}
function aspxIsDownKey(evt) {
 return evt.keyCode == 0x28;
}
function _aspxGetIsRightButtonPressed(evt){
 evt = _aspxGetEvent(evt);
 if(!_aspxIsExists(evt)) return false;
 if(__aspxIE)
  return evt.button == 2;
 else if(__aspxNetscapeFamily || __aspxWebKitFamily)
  return evt.which == 3;
 else if (__aspxOpera)
  return evt.button == 1;
 return true;
}
function _aspxFindParentElement(element, testFunc){
 if (!_aspxIsExists(testFunc)) return null;
 while(element != null && element.tagName != "BODY"){
  if(testFunc(element))
   return element;
  element = element.parentNode;
 }
 return null;
}
function _aspxGetOnMouseOutEventTarget(evt){
 evt = _aspxGetEvent(evt);
 if(!_aspxIsExists(evt)) return null; 
 return __aspxIE ? evt.toElement : evt.relatedTarget;
}
function _aspxSetTableCellOffsetWidth(tableCell, newOffsetWidth) {
 if (newOffsetWidth <=0 ) {
  return;
 }
 tableCell.style.width = newOffsetWidth + "px";
 _aspxRefreshTableCell(tableCell);
 var delta = tableCell.clientWidth - newOffsetWidth;
 var correctedWidth = newOffsetWidth - delta;
 if (correctedWidth > 0 ) 
  tableCell.style.width = correctedWidth + "px";
 else
  tableCell.style.width = "0px";
 _aspxRefreshTableCell(tableCell);
}
function _aspxRefreshTableCell(tableCell) {
 if (__aspxOpera) { 
  tableCell.style.display = "none";
  tableCell.style.display = "table-cell";
 }
}
function _aspxChangeTableLayout(table, layout) {
  if (__aspxIE) {
   table.style.tableLayout = layout;
   return;
  } 
  var parent = table.parentNode;
  var nextSibling = table.nextSibling;
  parent.removeChild(table);
  table.style.tableLayout = layout;
  if(_aspxIsExists(nextSibling))  
   parent.insertBefore(table, nextSibling);
  else
   parent.appendChild(table);
}
function _aspxGetItemByLocation(parentTable, location) {
 return parentTable.rows[location[0]].cells[location[1]];
}
function aspxSchedulerNavBtnClick(name, startTime, duration, resourceId) {
 var scheduler = aspxGetControlCollection().Get(name);
 if(scheduler != null)
  scheduler.NavBtnClick(startTime, duration, resourceId);
}
function aspxSchedulerMainDivMouseDown(name, evt) {
 var scheduler = aspxGetControlCollection().Get(name);
 if(scheduler != null)
  scheduler.MainDivMouseDown(evt);
}
function aspxSchedulerFuncCallback(name, result) {
 var scheduler = aspxGetControlCollection().Get(name);
 if(scheduler != null)
  scheduler.OnFuncCallback(unescape(result));
}
function aspxSchedulerEmptyFuncCallbackHandler() {
}
function aspxAppointmentSave(controlId) {
 var control = aspxGetControlCollection().Get(controlId);
 if (_aspxIsExists(control)) {
  if (ASPxClientEdit.ValidateEditorsInContainerById(controlId + "_formBlock_innerContent"))
   control.RaiseCallback("APTSAVE|");
 }
}
function aspxAppointmentCancel(controlId) {
 var control = aspxGetControlCollection().Get(controlId);
 if (_aspxIsExists(control)) {
  control.CancelFormChangesAndClose(control.aptFormVisibility, "APTCANCEL|");
 }
}
function aspxAppointmentDelete(controlId) {
 var control = aspxGetControlCollection().Get(controlId);
 if (_aspxIsExists(control)) {
  control.RaiseCallback("APTDEL|");
 }
}
function aspxInplaceEditorSave(controlId) {
 var control = aspxGetControlCollection().Get(controlId);
 if (_aspxIsExists(control)) {
  control.RaiseCallback("INPLACESAVE|");
 }
}
function aspxInplaceEditorEditForm(controlId) {
 var control = aspxGetControlCollection().Get(controlId);
 if (_aspxIsExists(control)) {
  control.RaiseCallback("INPLACEFORM|");
 }
}
function aspxShowInplacePopupWindow(name, popupId, aptId) {
 var control = aspxGetControlCollection().Get(name);
 if (_aspxIsExists(control)) {
  control.SaveCurrentPopupContainer(popupId);
  control.ShowInplacePopupWindow(popupId, aptId);
 }
}
function aspxShowFormPopupWindow(name, popupId) {
 var control = aspxGetControlCollection().Get(name);
 if (_aspxIsExists(control)) {
  control.SaveCurrentPopupContainer(popupId);
  control.ShowFormPopupWindow(popupId);
 }
}
function aspxGotoDateApply(controlId) {
 var control = aspxGetControlCollection().Get(controlId);
 if (_aspxIsExists(control)) {
  control.RaiseCallback("GOTODATEFORM|");
 }
}
function aspxGotoDateCancel(controlId) {
 var control = aspxGetControlCollection().Get(controlId);
 if (_aspxIsExists(control)) {
  control.CancelFormChangesAndClose(control.gotoDateFormVisibility, "GOTODATEFORMCANCEL|");
 }
}
function aspxRecurrentAptDeleteCancel(controlId) {
 var control = aspxGetControlCollection().Get(controlId);
 if (_aspxIsExists(control)) 
  control.CancelFormChangesAndClose(control.recurrentAppointmentDeleteFormVisibility, "RECURAPTDELETECANCEL|");
}
function aspxRecurrentAptDelete(controlId) {
 var control = aspxGetControlCollection().Get(controlId);
 if (_aspxIsExists(control)) 
     return control.RaiseCallback("RECURAPTDELETE|");
}
function aspxRecurrentAptEditCancel(controlId) {
 var control = aspxGetControlCollection().Get(controlId);
 if (_aspxIsExists(control)) 
  control.CancelFormChangesAndClose(control.recurrentAppointmentDeleteFormVisibility, "RECURAPTEDITCANCEL|");
}
function aspxRecurrentAptEdit(controlId) {
 var control = aspxGetControlCollection().Get(controlId);
 if (_aspxIsExists(control)) 
     return control.RaiseCallback("RECURAPTEDIT|");
}
function aspxSchedulerDateTimeComparer(dateTime1, dateTime2) {
 var dif = dateTime2 - dateTime1;
 if (dif == 0)
  return 0;
 return dif < 0 ? 1 : -1;
}
function aspxMoreButtonClickEvent(evt) { 
 function isMoreButtonDiv(element) {
  return _aspxIsExists(element.isMoreButton) ? element.isMoreButton : false;
 }
 var srcMoreButtonDiv = _aspxFindParentElement(_aspxGetEventSource(evt), isMoreButtonDiv);
 var control = srcMoreButtonDiv.schedulerControl;
 var args = new MoreButtonClickedEventArgs(srcMoreButtonDiv.targetDateTime, srcMoreButtonDiv.interval, srcMoreButtonDiv.resource);
 control.RaiseMoreButtonClickedEvent(args);
 if (args.handled)
  return;    
 var intervalArgs = _aspxDateTimeToMilliseconds(srcMoreButtonDiv.interval.GetStart()) + "," + srcMoreButtonDiv.interval.GetDuration();
 var targetDateTimeArg = _aspxDateTimeToMilliseconds(srcMoreButtonDiv.targetDateTime);
 control.RaiseCallback("MOREBTN|" + targetDateTimeArg + "," +  intervalArgs + "," + srcMoreButtonDiv.resource);
}
function aspxCancelRemindersForm(controlId) {
 var control = aspxGetControlCollection().Get(controlId);
 if (_aspxIsExists(control)) 
  control.RaiseCallback("CLSREMINDERSFRM|");
}
function aspxReminderAlerted(controlId) {
 var control = aspxGetControlCollection().Get(controlId);
 if (_aspxIsExists(control) && control.reminderTimerId != null) {
  if (control.enableReminderTimer) {
   control.menuManager.HideMenu();
   return control.RaiseCallback("PROCESSREMINDER|");
   }
  else 
   control.suspendedCallAspxReminderAlerted = true;
  return null;
 }
}
function aspxDismissReminders(controlId) {
 var control = aspxGetControlCollection().Get(controlId);
 if (_aspxIsExists(control)) 
     return control.RaiseCallback("DSMSREMINDER|");
}
function aspxDismissAllReminders(controlId) {
 var control = aspxGetControlCollection().Get(controlId);
 if (_aspxIsExists(control)) 
     return control.RaiseCallback("DSMSALLREMINDERS|");
}
function aspxSnoozeReminders(controlId) {
 var control = aspxGetControlCollection().Get(controlId);
 if (_aspxIsExists(control)) 
     return control.RaiseCallback("SNZREMINDERS|");
}

