var __aspxClientValidationStateNameSuffix = "$CVS";
ASPxClientEditBase = _aspxCreateClass(ASPxClientControl, {
 constructor: function(name) {
  this.constructor.prototype.constructor.call(this, name);
 },
 InlineInitialize: function(){
  this.InitializeEnabled(); 
 },
 InitializeEnabled: function() {
  this.SetEnabledInternal(this.clientEnabled, true);
 },
 GetValue: function() {
  var element = this.GetMainElement();
  if(_aspxIsExistsElement(element))
   return element.innerHTML;
  return "";
 },
 GetValueString: function(){
  var value = this.GetValue();
  return (value == null) ? null : value.toString();
 },
 SetValue: function(value) {
  if(value == null)
   value = "";
  var element = this.GetMainElement();
  if(_aspxIsExistsElement(element))
   element.innerHTML = value;
 },
 GetEnabled: function(){
  return this.enabled && this.clientEnabled;
 },
 SetEnabled: function(enabled){
  if(this.clientEnabled != enabled) {
   var errorFrameRequiresUpdate = this.GetIsValid && !this.GetIsValid();
   if(errorFrameRequiresUpdate && !enabled)
    this.UpdateErrorFrameAndFocus(false , null , true );
   this.clientEnabled = enabled;
   this.SetEnabledInternal(enabled, false);
   if(errorFrameRequiresUpdate && enabled)
    this.UpdateErrorFrameAndFocus(false );
  }
 },
 SetEnabledInternal: function(enabled, initialization){
  if(!this.enabled) return;
  if(!initialization || !enabled)
   this.ChangeEnabledStateItems(enabled);
  this.ChangeEnabledAttributes(enabled);
 },
 ChangeEnabledAttributes: function(enabled){
 },
 ChangeEnabledStateItems: function(enabled){
 }
});
ASPxValidationPattern = _aspxCreateClass(null, {
 constructor: function(errorText) {
  this.errorText = errorText;
 }
});
ASPxRequiredFieldValidationPattern = _aspxCreateClass(ASPxValidationPattern, {
 constructor: function(errorText) {
  this.constructor.prototype.constructor.call(this, errorText);
 },
 EvaluateIsValid: function(value) {
  return value != null && (value.constructor == Array || _aspxTrim(value.toString()) != "");
 }
});
ASPxRegularExpressionValidationPattern = _aspxCreateClass(ASPxValidationPattern, {
 constructor: function(errorText, pattern) {
  this.constructor.prototype.constructor.call(this, errorText);
  this.pattern = pattern;
 },
 EvaluateIsValid: function(value) {
  if (value == null) 
   return true;
  var strValue = value.toString();
  if (_aspxTrim(strValue).length == 0)
   return true;
  var regEx = new RegExp(this.pattern);
  var matches = regEx.exec(strValue);
  return matches != null && strValue == matches[0];
 }
});
function _aspxIsEditorFocusable(inputElement) {
 return _aspxIsFocusableCore(inputElement, function(container) {
  return container.getAttribute("errorFrame") == "errorFrame";
 });
}
var __aspxInvalidEditorToBeFocused = null;
ASPxValidationType = {
 PersonalOnValueChanged: "ValueChanged",
 PersonalViaScript: "CalledViaScript",
 MassValidation: "MassValidation"
};
ASPxErrorFrameDisplay = {
 None: "None",
 Static: "Static",
 Dynamic: "Dynamic"
};
ASPxEditElementSuffix = {
 ExternalTable: "_ET",
 ControlCell: "_CC",
 ErrorCell: "_EC",
 ErrorTextCell: "_ETC",
 ErrorImage: "_EI"
};
ASPxClientEdit = _aspxCreateClass(ASPxClientEditBase, {
 constructor: function(name) {
  this.constructor.prototype.constructor.call(this, name);
  this.isASPxClientEdit = true;
  this.inputElement = null;
  this.elementCache = { };
  this.convertEmptyStringToNull = true;
  this.readOnly = false;
  this.focused = false;
  this.focusEventsLocked = false;
  this.receiveGlobalMouseWheel = true;
  this.styleDecoration = null;
  this.widthCorrectionRequired = false;
  this.heightCorrectionRequired = false;
  this.customValidationEnabled = false;
  this.display = ASPxErrorFrameDisplay.Static;
  this.initialErrorText = "";
  this.causesValidation = false;
  this.validateOnLeave = true;
  this.validationGroup = "";
  this.sendPostBackWithValidation = null;
  this.validationPatterns = [];
  this.setFocusOnError = false;
  this.errorDisplayMode = "it";
  this.errorText = "";
  this.isValid = true;
  this.errorImageIsAssigned = false;
  this.clientValidationStateElement = null;
  this.notifyValidationSummariesToAcceptNewError = false;
  this.enterProcessed = false;
  this.keyDownHandlers = {};
  this.keyPressHandlers = {};
  this.keyUpHandlers = {};
  this.specialKeyboardHandlingUsed = false;
  this.onKeyDownHandler = null;
  this.onKeyPressHandler = null;
  this.onKeyUpHandler = null;
  this.onGotFocusHandler = null;
  this.onLostFocusHandler = null;
  this.GotFocus = new ASPxClientEvent();
  this.LostFocus = new ASPxClientEvent();
  this.Validation = new ASPxClientEvent();
  this.ValueChanged = new ASPxClientEvent();
  this.KeyDown = new ASPxClientEvent();
  this.KeyPress = new ASPxClientEvent();
  this.KeyUp = new ASPxClientEvent();
  ASPxClientEdit.controls.push(this);
 },
 Initialize: function() {
  this.initialErrorText = this.errorText;
  ASPxClientEditBase.prototype.Initialize.call(this);
  this.InitializeKeyHandlers();
  this.UpdateClientValidationState();
  this.UpdateValidationSummaries(null , true );
 },
 InlineInitialize: function() {
  ASPxClientEditBase.prototype.InlineInitialize.call(this);
  if(this.styleDecoration != null)
   this.styleDecoration.Update();
 }, 
 InitSpecialKeyboardHandling: function(){
  this.onKeyDownHandler = _aspxCreateEventHandlerFunction("aspxKBSIKeyDown", this.name, true);
  this.onKeyPressHandler = _aspxCreateEventHandlerFunction("aspxKBSIKeyPress", this.name, true);
  this.onKeyUpHandler = _aspxCreateEventHandlerFunction("aspxKBSIKeyUp", this.name, true);
  this.onGotFocusHandler = _aspxCreateEventHandlerFunction("aspxESGotFocus", this.name, false);
  this.onLostFocusHandler = _aspxCreateEventHandlerFunction("aspxESLostFocus", this.name, false);
  this.specialKeyboardHandlingUsed = true;
  this.InitializeDelayedSpecialFocus();
 },
 InitializeKeyHandlers: function() {
 },
 AddKeyDownHandler: function(key, handler) {
  this.keyDownHandlers[key] = handler;
 },
 ChangeSpecialInputEnabledAttributes: function(element, method){
  element.autocomplete = "off";
  if(this.onKeyDownHandler != null)
   method(element, "keydown", this.onKeyDownHandler);
  if(this.onKeyPressHandler != null)
   method(element, "keypress", this.onKeyPressHandler);
  if(this.onKeyUpHandler != null)
   method(element, "keyup", this.onKeyUpHandler);
  if(this.onGotFocusHandler != null)
   method(element, "focus", this.onGotFocusHandler);
  if(this.onLostFocusHandler != null)
   method(element, "blur", this.onLostFocusHandler);
 },
 UpdateClientValidationState: function() {
  if(!this.customValidationEnabled)
   return;
  var mainElement = this.GetMainElement();
  if (_aspxIsExists(mainElement)) {
   var hiddenField = this.GetClientValidationStateHiddenField();
   if(_aspxIsExists(hiddenField))
    hiddenField.value = _aspxEncodeHtml(!this.GetIsValid() ? ("-" + this.GetErrorText()) : "");
  }
 },
 UpdateValidationSummaries: function(validationType, initializing) {
  if(typeof(ASPxClientValidationSummary) != "undefined") {
   var summaryCollection = aspxGetClientValidationSummaryCollection();
   summaryCollection.OnEditorIsValidStateChanged(this, validationType, initializing && this.notifyValidationSummariesToAcceptNewError);
  }
 },
 GetCachedElementByIdSuffix: function(idSuffix) {
  var element = this.elementCache[idSuffix];
  if(!_aspxIsExistsElement(element)) {
   element = _aspxGetElementById(this.name + idSuffix);
   this.elementCache[idSuffix] = element;
  }
  return element;
 },
 FindInputElement: function(){
  return null;
 },
 GetInputElement: function(){
  if(!_aspxIsExistsElement(this.inputElement))
   this.inputElement = this.FindInputElement();
  return this.inputElement;
 },
 GetErrorImage: function() {
  return this.GetCachedElementByIdSuffix(ASPxEditElementSuffix.ErrorImage);
 },
 GetExternalTable: function() {
  return this.GetCachedElementByIdSuffix(ASPxEditElementSuffix.ExternalTable);
 },
 GetControlCell: function() {
  return this.GetCachedElementByIdSuffix(ASPxEditElementSuffix.ControlCell);
 },
 GetErrorCell: function() {
  return this.GetCachedElementByIdSuffix(ASPxEditElementSuffix.ErrorCell);
 },
 GetErrorTextCell: function() {
  return this.GetCachedElementByIdSuffix(this.errorImageIsAssigned ?
   ASPxEditElementSuffix.ErrorTextCell : ASPxEditElementSuffix.ErrorCell);
 },
 GetClientValidationStateHiddenField: function() {
  if(!_aspxIsExists(this.clientValidationStateElement))
   this.clientValidationStateElement = this.CreateClientValidationStateHiddenField();
  return this.clientValidationStateElement;
 },
 CreateClientValidationStateHiddenField: function() {
  var mainElement = this.GetMainElement();
  var hiddenField = _aspxCreateHiddenField(this.uniqueID + __aspxClientValidationStateNameSuffix);
  mainElement.parentNode.appendChild(hiddenField);
  return hiddenField;
 },
 SetVisible: function(isVisible){
  if(this.clientVisible == isVisible)
   return;
  if(this.customValidationEnabled) {
   var errorFrame = this.GetExternalTable();
   if(_aspxIsExists(errorFrame)) {
    _aspxSetElementDisplay(errorFrame, isVisible);
    var isValid = !isVisible ? true : void(0);
    this.UpdateErrorFrameAndFocus(false , true , isValid );
   }
  }
  ASPxClientControl.prototype.SetVisible.call(this, isVisible);
 },
 GetValueInputToValidate: function() {
  return this.GetInputElement();
 },
 IsVisible: function() {
  if (!this.clientVisible)
   return false;
  var element = this.GetMainElement();
  while(_aspxIsExists(element) && element.tagName != "BODY") {
   if (element.getAttribute("errorFrame") != "errorFrame" && (!_aspxGetElementVisibility(element) || !_aspxGetElementDisplay(element)))
    return false;
   element = element.parentNode;
  }
  return true;
 },
 AdjustControlCore: function() {
  this.CollapseControl();
  if (this.WidthCorrectionRequired())
   this.CorrectEditorWidth();
  else
   this.UnstretchInputElement();
  if (this.heightCorrectionRequired)
   this.CorrectEditorHeight();
 },
 WidthCorrectionRequired: function() {
  var mainElement = this.GetMainElement();
  if(_aspxIsExistsElement(mainElement)) {
   var mainElementCurStyle = _aspxGetCurrentStyle(mainElement);
   return this.widthCorrectionRequired && mainElementCurStyle.width != "" && mainElementCurStyle.width != "auto";
  }
  return false;
 },
 CorrectEditorWidth: function() {
 },
 CorrectEditorHeight: function() {
 },
 UnstretchInputElement: function() {
 },
 UseDelayedSpecialFocus: function() {
  return false;
 },
 GetDelayedSpecialFocusTriggers: function() {
  return [ this.GetMainElement() ];
 },
 InitializeDelayedSpecialFocus: function() {
  if(!this.UseDelayedSpecialFocus())
   return;
  this.specialFocusTimer = -1;    
  var instance = this;
  var handler = function() {
   window.setTimeout(function() { instance.SetFocus(); }, 0);
  };
  var triggers = this.GetDelayedSpecialFocusTriggers();
  for(var i = 0; i < triggers.length; i++)
   _aspxAttachEventToElement(triggers[i], "mousedown", handler);
 },
 IsFocusEventsLocked: function() {
  return this.focusEventsLocked;
 },
 LockFocusEvents: function() {
  if(!this.focused) return;
  this.focusEventsLocked = true;
 },
 UnlockFocusEvents: function() {
  this.focusEventsLocked = false;
 },
 ForceRefocusEditor: function() {
  this.LockFocusEvents();
  var inputElement = this.GetInputElement();
  if(inputElement && inputElement.blur)
   inputElement.blur();
  window.setTimeout("aspxGetControlCollection().Get('" + this.name + "').SetFocus();", 0);
 },
 IsEditorElement: function(element) {
  return this.GetMainElement() == element || _aspxGetIsParent(this.GetMainElement(), element);
 },
 OnFocusCore: function() {
  if(this.UseDelayedSpecialFocus())
   window.clearTimeout(this.specialFocusTimer);
  if (!this.IsFocusEventsLocked()){
   this.focused = true;
   ASPxClientEdit.SetFocusedEditor(this);
   if(this.styleDecoration != null && !this.readOnly)
    this.styleDecoration.Update();
   if(this.isInitialized)
    this.RaiseFocus();
  }
  else
   this.UnlockFocusEvents();
 },
 OnLostFocusCore: function() {
  if (!this.IsFocusEventsLocked()){
   this.focused = false;
   ASPxClientEdit.SetFocusedEditor(null);
   if(this.styleDecoration != null && !this.readOnly)
    this.styleDecoration.Update();
   this.RaiseLostFocus();
   if (this.validateOnLeave)
    this.SetFocusOnError();
  }
 },
 OnFocus: function() {
  if (!this.specialKeyboardHandlingUsed)
   this.OnFocusCore();
 },
 OnLostFocus: function() {
  if (this.isInitialized && !this.specialKeyboardHandlingUsed)
   this.OnLostFocusCore();
 },
 OnSpecialFocus: function() {
  if (this.isInitialized)
   this.OnFocusCore();
 },
 OnSpecialLostFocus: function() {
  if (this.isInitialized)
   this.OnLostFocusCore();
 },
 OnMouseWheel: function(evt){
 },
 OnValidation: function(validationType) {
  if(this.customValidationEnabled && this.isInitialized && _aspxIsExistsElement(this.GetMainElement()) &&
   (this.display == ASPxErrorFrameDisplay.None || _aspxIsExists(this.GetExternalTable()))) {
   this.BeginErrorFrameUpdate();
   try {
    this.SetIsValid(true, true );
    this.SetErrorText(this.initialErrorText, true );
    if(this.validateOnLeave || validationType != ASPxValidationType.PersonalOnValueChanged) {
     this.ValidateWithPatterns();
     this.RaiseValidation();
    }
    this.UpdateErrorFrameAndFocus(validationType == ASPxValidationType.PersonalOnValueChanged && this.validateOnLeave && !this.GetIsValid());
   } finally {
    this.EndErrorFrameUpdate();
   }
   this.UpdateValidationSummaries(validationType);
  }
 },
 OnValueChanged: function() {
  var processOnServer = this.RaiseValidationInternal();
  processOnServer = this.RaiseValueChangedEvent() && processOnServer;
  if (processOnServer)
   this.SendPostBackInternal("");
 },
 ParseValue: function() {
 },
 RaisePersonalStandardValidation: function() {
  if (_aspxIsFunction(window.ValidatorOnChange)) {
   var inputElement = this.GetValueInputToValidate();
   if (_aspxIsExists(inputElement.Validators))
    window.ValidatorOnChange({ srcElement: inputElement });
  }
 },
 RaiseValidationInternal: function() {
  if (this.autoPostBack && this.causesValidation && this.validateOnLeave)
   return ASPxClientEdit.ValidateGroup(this.validationGroup);
  else {
   this.OnValidation(ASPxValidationType.PersonalOnValueChanged);
   return this.GetIsValid();
  }
 },
 RaiseValueChangedEvent: function(){
  return this.RaiseValueChanged();
 },
 SendPostBackInternal: function(postBackArg) {
  if (_aspxIsFunction(this.sendPostBackWithValidation))
   this.sendPostBackWithValidation(postBackArg);
  else
   this.SendPostBack(postBackArg);
 },
 SetElementToBeFocused: function() {
  if (this.IsVisible())
   __aspxInvalidEditorToBeFocused = this;
 },
 SetFocus: function(){
  var inputElement = this.GetInputElement();
  if (!_aspxIsExists(inputElement)) return; 
  if (_aspxGetActiveElement() != inputElement && _aspxIsEditorFocusable(inputElement)) 
   _aspxSetFocus(inputElement);
 },
 SetFocusOnError: function() {
  if (__aspxInvalidEditorToBeFocused == this) {
   this.SetFocus();
   __aspxInvalidEditorToBeFocused = null;
  }
 },
 BeginErrorFrameUpdate: function() {
  if(!this.errorFrameUpdateLocked)
   this.errorFrameUpdateLocked = true;
 },
 EndErrorFrameUpdate: function() {
  this.errorFrameUpdateLocked = false;
  var args = this.updateErrorFrameAndFocusLastCallArgs;
  if(args) {
   this.UpdateErrorFrameAndFocus(args[0], args[1]);
   delete this.updateErrorFrameAndFocusLastCallArgs;
  }
 },
 UpdateErrorFrameAndFocus: function(setFocusOnError, ignoreVisibilityCheck, isValid) {
  if(!this.GetEnabled() || !ignoreVisibilityCheck && !this.GetVisible())
   return;
  if(this.errorFrameUpdateLocked) {
   this.updateErrorFrameAndFocusLastCallArgs = [ setFocusOnError, ignoreVisibilityCheck ];
   return;
  }
  if(this.styleDecoration != null)
   this.styleDecoration.Update();
  if(typeof(isValid) == "undefined")
   isValid = this.GetIsValid();
  var externalTable = this.GetExternalTable();
  var isStaticDisplay = this.display == ASPxErrorFrameDisplay.Static;
  var isErrorFrameDisplayed = this.display != ASPxErrorFrameDisplay.None;
  if(isValid && isErrorFrameDisplayed) {
   if(isStaticDisplay) {
    externalTable.style.visibility = "hidden";
   } else {
    this.HideErrorCell();
    this.SaveErrorFrameStyles();
    this.ClearErrorFrameElementsStyles();
   }
  } else {
   var editorLocatedWithinVisibleContainer = this.IsVisible();
   if(isErrorFrameDisplayed) {
    if(this.widthCorrectionRequired) {
     if(editorLocatedWithinVisibleContainer)
      this.CollapseControl(); 
     else
      this.sizeCorrectedOnce = false;
    }
    this.UpdateErrorCellContent();
    if(isStaticDisplay) {
     externalTable.style.visibility = "visible";
    } else {
     this.EnsureErrorFrameStylesLoaded();
     this.RestoreErrorFrameElementsStyles();
     this.ShowErrorCell();
    }
   }
   if(editorLocatedWithinVisibleContainer) {
    if(isErrorFrameDisplayed && this.widthCorrectionRequired)
     this.AdjustControl(); 
    if(setFocusOnError && this.setFocusOnError && __aspxInvalidEditorToBeFocused == null)
     this.SetElementToBeFocused();
   }
  }
 },
 ShowErrorCell: function() {
  var errorCell = this.GetErrorCell();
  if(_aspxIsExists(errorCell))
   _aspxSetElementDisplay(errorCell, true);
 },
 HideErrorCell: function() {
  var errorCell = this.GetErrorCell();
  if(_aspxIsExists(errorCell))
   _aspxSetElementDisplay(errorCell, false);
 },
 SaveErrorFrameStyles: function() {
  this.EnsureErrorFrameStylesLoaded();
 },
 EnsureErrorFrameStylesLoaded: function() {
  if(typeof(this.errorFrameStyles) == "undefined") {
   var externalTable = this.GetExternalTable();
   var controlCell = this.GetControlCell();
   this.errorFrameStyles = {
    errorFrame: {
     cssClass: externalTable.className,
     style: this.ExtractElementStyleStringIgnoringVisibilityProps(externalTable)
    },
    controlCell: {
     cssClass: controlCell.className,
     style: this.ExtractElementStyleStringIgnoringVisibilityProps(controlCell)
    }
   };
  }
 },
 ClearErrorFrameElementsStyles: function() {
  this.ClearElementStyle(this.GetExternalTable());
  this.ClearElementStyle(this.GetControlCell());
 },
 RestoreErrorFrameElementsStyles: function() {
  var externalTable = this.GetExternalTable();
  externalTable.className = this.errorFrameStyles.errorFrame.cssClass;
  externalTable.style.cssText = this.errorFrameStyles.errorFrame.style;
  var controlCell = this.GetControlCell();
  controlCell.className = this.errorFrameStyles.controlCell.cssClass;
  controlCell.style.cssText = this.errorFrameStyles.controlCell.style;
 },
 ExtractElementStyleStringIgnoringVisibilityProps: function(element) {
  var savedVisibility = element.style.visibility;
  var savedDisplay = element.style.display;
  element.style.visibility = "";
  element.style.display = "";
  var styleStr = element.style.cssText;
  element.style.visibility = savedVisibility;
  element.style.display = savedDisplay;
  return styleStr;
 },
 ClearElementStyle: function(element) {
  if(!_aspxIsExists(element))
   return;
  element.className = "";
  var excludedAttrNames = [
   "width", "display", "visibility",
   "position", "left", "top", "z-index",
   "margin", "margin-top", "margin-right", "margin-bottom", "margin-left",
   "float", "clear"
  ];
  var savedAttrValues = { };
  for(var i = 0; i < excludedAttrNames.length; i++) {
   var attrName = excludedAttrNames[i];
   var attrValue = element.style[attrName];
   if(attrValue)
    savedAttrValues[attrName] = attrValue;
  }
  element.style.cssText = "";
  for(var styleAttrName in savedAttrValues)
   element.style[styleAttrName] = savedAttrValues[styleAttrName];
 },
 UpdateErrorCellContent: function() {
  if (this.errorDisplayMode.indexOf("t") > -1)
   this.UpdateErrorText();
  if (this.errorDisplayMode == "i")
   this.UpdateErrorImage();
 },
 UpdateErrorImage: function() {
  var image = this.GetErrorImage();
  if (_aspxIsExistsElement(image)) {
   image.alt = this.errorText;
   image.title = this.errorText;
  } else {
   this.UpdateErrorText();
  }
 },
 UpdateErrorText: function() {
  var errorTextCell = this.GetErrorTextCell();
  if(_aspxIsExistsElement(errorTextCell))
   errorTextCell.innerHTML = _aspxEncodeHtml(this.errorText);
 },
 ValidateWithPatterns: function() {
  if (this.validationPatterns.length > 0) {
   var value = this.GetValue();
   for (var i = 0; i < this.validationPatterns.length; i++) {
    var validator = this.validationPatterns[i];
    if (!validator.EvaluateIsValid(value)) {
     this.SetIsValid(false, true );
     this.SetErrorText(validator.errorText, true );
     return;
    }
   }
  }
 },
 OnSpecialKeyDown: function(evt){
  this.RaiseKeyDown(evt);
  var handler = this.keyDownHandlers[evt.keyCode];
  if(_aspxIsExists(handler)) 
   return this[handler](evt);
  return false;
 },
 OnSpecialKeyPress: function(evt){
  this.RaiseKeyPress(evt);
  var handler = this.keyPressHandlers[evt.keyCode];
  if(_aspxIsExists(handler)) 
   return this[handler](evt);
  if(__aspxNetscapeFamily || __aspxOpera){
   if(evt.keyCode == ASPxKey.Enter)
    return this.enterProcessed;
  }
  return false;
 },
 OnSpecialKeyUp: function(evt){
  this.RaiseKeyUp(evt);
  var handler = this.keyUpHandlers[evt.keyCode];
  if(_aspxIsExists(handler)) 
   return this[handler](evt);
  return false;
 },
 OnKeyDown: function(evt) {
  if(!this.specialKeyboardHandlingUsed)
   this.RaiseKeyDown(evt);
 },
 OnKeyPress: function(evt) {
  if(!this.specialKeyboardHandlingUsed)
   this.RaiseKeyPress(evt);
 },
 OnKeyUp: function(evt) {
  if(!this.specialKeyboardHandlingUsed)
   this.RaiseKeyUp(evt);
 },
 RaiseKeyDown: function(evt){
  if(!this.KeyDown.IsEmpty()){
   var args = new ASPxClientEditKeyEventArgs(evt);
   this.KeyDown.FireEvent(this, args);
  }
 },
 RaiseKeyPress: function(evt){
  if(!this.KeyPress.IsEmpty()){
   var args = new ASPxClientEditKeyEventArgs(evt);
   this.KeyPress.FireEvent(this, args);
  }
 },
 RaiseKeyUp: function(evt){
  if(!this.KeyUp.IsEmpty()){
   var args = new ASPxClientEditKeyEventArgs(evt);
   this.KeyUp.FireEvent(this, args);
  }
 },
 RaiseFocus: function(){
  if(!this.GotFocus.IsEmpty()){
   var args = new ASPxClientEventArgs();
   this.GotFocus.FireEvent(this, args);
  }
 },
 RaiseLostFocus: function(){
  if(!this.LostFocus.IsEmpty()){
   var args = new ASPxClientEventArgs();
   this.LostFocus.FireEvent(this, args);
  }
 },
 RaiseValidation: function() {
  if(this.customValidationEnabled && !this.Validation.IsEmpty()) {
   var currentValue = this.GetValue();
   var args = new ASPxClientEditValidationEventArgs(currentValue, this.errorText, this.GetIsValid());
   this.Validation.FireEvent(this, args);
   this.SetErrorText(args.errorText, true );
   this.SetIsValid(args.isValid, true );
   if(args.value != currentValue)
    this.SetValue(args.value);
  }
 },
 RaiseValueChanged: function(){
  var processOnServer = this.autoPostBack;
  if(!this.ValueChanged.IsEmpty()){
   var args = new ASPxClientProcessingModeEventArgs(processOnServer);
   this.ValueChanged.FireEvent(this, args);
   processOnServer = args.processOnServer;
  }
  return processOnServer;  
 },
 RequireStyleDecoration: function() {
  this.styleDecoration = new ASPxClientEditStyleDecoration(this);
  this.PopulateStyleDecorationPostfixes();
 }, 
 PopulateStyleDecorationPostfixes: function() {
  this.styleDecoration.AddPostfix("");
 },
 Focus: function(){
  this.SetFocus();
 },
 GetIsValid: function(){
  if((ASPxIdent.IsASPxClientRadioButtonList(this) || _aspxIsExistsElement(this.GetInputElement())) &&
   (this.display == ASPxErrorFrameDisplay.None || _aspxIsExistsElement(this.GetExternalTable())  ))
   return this.isValid;
  else
   return true;
 },
 GetErrorText: function(){
  return this.errorText;
 },
 SetIsValid: function(isValid, validating){
  if (this.customValidationEnabled) {
   this.isValid = isValid;
   this.UpdateErrorFrameAndFocus(false );
   this.UpdateClientValidationState();
   if(!validating)
    this.UpdateValidationSummaries(ASPxValidationType.PersonalViaScript);
  }
 },
 SetErrorText: function(errorText, validating){
  if (this.customValidationEnabled) {
   this.errorText = errorText;
   this.UpdateErrorFrameAndFocus(false );
   this.UpdateClientValidationState();
   if(!validating)
    this.UpdateValidationSummaries(ASPxValidationType.PersonalViaScript);
  }
 },
 Validate: function(){
  this.ParseValue();
  this.OnValidation(ASPxValidationType.PersonalViaScript);
 }
});
ASPxClientEdit.controls = [];
ASPxClientEdit.focusedEditorName = "";
ASPxClientEdit.GetFocusedEditor = function(){
 var focusedEditor = aspxGetControlCollection().Get(ASPxClientEdit.focusedEditorName);
 if(focusedEditor && !focusedEditor.focused){
  ASPxClientEdit.SetFocusedEditor(null);
  focusedEditor = null;
 }
 return focusedEditor;
}
ASPxClientEdit.SetFocusedEditor = function(editor){
 ASPxClientEdit.focusedEditorName = editor ? editor.name : "";
}
ASPxClientEdit.ClearEditorsInContainer = function(container, validationGroup, clearInvisibleEditors) {
 __aspxInvalidEditorToBeFocused = null;
 _aspxProcessEditorsInContainer(container, _aspxClearProcessingProc, _aspxClearChoiceCondition, validationGroup, clearInvisibleEditors, true );
}
ASPxClientEdit.ClearEditorsInContainerById = function(containerId, validationGroup, clearInvisibleEditors) {
 var container = document.getElementById(containerId);
 this.ClearEditorsInContainer(container, validationGroup, clearInvisibleEditors);
}
ASPxClientEdit.ClearGroup = function(validationGroup, clearInvisibleEditors) {
 return this.ClearEditorsInContainer(null, validationGroup, clearInvisibleEditors);
}
ASPxClientEdit.ValidateEditorsInContainer = function(container, validationGroup, validateInvisibleEditors) {
 var summaryCollection;
 if(typeof(ASPxClientValidationSummary) != "undefined") {
  summaryCollection = aspxGetClientValidationSummaryCollection();
  summaryCollection.AllowNewErrorsAccepting(validationGroup);
 }
 var validationResult = _aspxProcessEditorsInContainer(container, _aspxValidateProcessingProc, _aspxValidateChoiceCondition, validationGroup, validateInvisibleEditors,
  false );
 if(_aspxIsExistsType(typeof(aspxGetGlobalEvents))) {
  if(typeof(validateInvisibleEditors) == "undefined")
   validateInvisibleEditors = false;
  if(typeof(validationGroup) == "undefined")
   validationGroup = null;
  validationResult.isValid = aspxGetGlobalEvents().OnValidationCompleted(container, validationGroup,
   validateInvisibleEditors, validationResult.isValid, validationResult.firstInvalid, validationResult.firstVisibleInvalid);
 }
 if(summaryCollection)
  summaryCollection.ForbidNewErrorsAccepting(validationGroup);
 return validationResult.isValid;
}
ASPxClientEdit.ValidateEditorsInContainerById = function(containerId, validationGroup, validateInvisibleEditors) {
 var container = document.getElementById(containerId);
 return this.ValidateEditorsInContainer(container, validationGroup, validateInvisibleEditors);
}
ASPxClientEdit.ValidateGroup = function(validationGroup, validateInvisibleEditors) {
 return this.ValidateEditorsInContainer(null, validationGroup, validateInvisibleEditors);
}
ASPxClientEdit.AreEditorsValid = function(containerOrContainerId, validationGroup, checkInvisibleEditors) {
 var container = typeof(containerOrContainerId) == "string" ? document.getElementById(containerOrContainerId) : containerOrContainerId;
 var checkResult = _aspxProcessEditorsInContainer(container, _aspxEditorsValidProcessingProc, _aspxEditorsValidChoiceCondition, validationGroup,
  checkInvisibleEditors, false );
 return checkResult.isValid;
}
ASPxClientEditKeyEventArgs = _aspxCreateClass(ASPxClientEventArgs, {
 constructor: function(htmlEvent) {
  this.constructor.prototype.constructor.call(this);
  this.htmlEvent = htmlEvent;
 }
});
ASPxClientEditValidationEventArgs = _aspxCreateClass(ASPxClientEventArgs, {
 constructor: function(value, errorText, isValid) {
  this.constructor.prototype.constructor.call(this);
  this.errorText = errorText;
  this.isValid = isValid;
  this.value = value;
 }
});
ASPxClientEditStyleDecoration = _aspxCreateClass(null, {
 constructor: function(editor) {
  this.editor = editor;
  this.postfixList = [ ];
  this.styles = { };
  this.innerStyles = { };
 },
 GetStyleSheet: function() {
  if(!ASPxClientEditStyleDecoration.__sheet)
   ASPxClientEditStyleDecoration.__sheet = _aspxCreateStyleSheet();
  return ASPxClientEditStyleDecoration.__sheet;
 },
 AddPostfix: function(value, applyClass, applyBorders, applyBackground) {
  this.postfixList.push(value);
 },
 AddStyle: function(key, className, cssText) {
  this.styles[key] = this.CreateRule(className, cssText);
  this.innerStyles[key] = this.CreateRule("", this.FilterInnerCss(cssText));
 },
 CreateRule: function(className, cssText) { 
  return _aspxTrim(className + " " + _aspxCreateImportantStyleRule(this.GetStyleSheet(), cssText));
 },
 Update: function() {
  for(var i = 0; i < this.postfixList.length; i++) {
   var postfix = this.postfixList[i];
   var inner = postfix.length > 0;
   var element = _aspxGetElementById(this.editor.name + postfix);
   if(!element) continue;
   if(this.HasDecoration("I")) {
    var isValid = this.editor.GetIsValid();
    this.ApplyDecoration("I", element, inner, !isValid);
   }
   if(this.HasDecoration("F"))
    this.ApplyDecoration("F", element, inner, this.editor.focused);
   if(this.HasDecoration("N")) {
    var apply = !this.editor.focused;
    if(apply) {
     var value = this.editor.GetValue();
     apply = apply && (value == null || value == "" && this.editor.convertEmptyStringToNull);
    }    
    this.ApplyDecoration("N", element, inner, apply);
   }
  }   
 },
 HasDecoration: function(key) {
  return !!this.styles[key];
 },
 ApplyDecoration: function(key, element, inner, active) {
  var value = inner ? this.innerStyles[key] : this.styles[key];
  element.className = element.className.replace(value, "");
  if(active)
   element.className = _aspxTrim(element.className + " " + value);
 },
 FilterInnerCss: function(css) {
  return css.replace(/(border|background-image)[^:]*:[^;]+/gi, "");
 }
});
function aspxEGotFocus(name){
 var edit = aspxGetControlCollection().Get(name); 
 if(edit != null)
  edit.OnFocus();
}
function aspxELostFocus(name){
 var edit = aspxGetControlCollection().Get(name);
 if(edit != null) 
  edit.OnLostFocus();
}
function aspxESGotFocus(name){
 var edit = aspxGetControlCollection().Get(name); 
 if(edit != null)
  edit.OnSpecialFocus();
}
function aspxESLostFocus(name){
 var edit = aspxGetControlCollection().Get(name);
 if(edit == null)
  return;
 if(edit.UseDelayedSpecialFocus())
  edit.specialFocusTimer = window.setTimeout(function() { edit.OnSpecialLostFocus(); }, 30);
 else
  edit.OnSpecialLostFocus();
}
function aspxEValueChanged(name){
 var edit = aspxGetControlCollection().Get(name);
 if(edit != null)
  edit.OnValueChanged();
}
_aspxAttachEventToDocument("mousedown", aspxEMouseDown);
function aspxEMouseDown(evt) {
 var editor = ASPxClientEdit.GetFocusedEditor();
 var evtSource = _aspxGetEventSource(evt);
 if (editor != null && editor.IsEditorElement(evtSource) && evtSource != editor.GetInputElement())
  editor.ForceRefocusEditor();
}
_aspxAttachEventToDocument(__aspxNetscapeFamily ? "DOMMouseScroll" : "mousewheel", aspxEMouseWheel);
function aspxEMouseWheel(evt) {
 var editor = ASPxClientEdit.GetFocusedEditor();
 if (editor != null && _aspxIsExistsElement(editor.GetMainElement()) && editor.focused && editor.receiveGlobalMouseWheel)
  editor.OnMouseWheel(evt);
}
function aspxKBSIKeyDown(name, evt){
 var control = aspxGetControlCollection().Get(name);
 if(control != null){
  var isProcessed = control.OnSpecialKeyDown(evt);
  if(isProcessed)
   return _aspxPreventEventAndBubble(evt);
 }
}
function aspxKBSIKeyPress(name, evt){
 var control = aspxGetControlCollection().Get(name);
 if(control != null){
  var isProcessed = control.OnSpecialKeyPress(evt);
  if(isProcessed)
   return _aspxPreventEventAndBubble(evt);
 }
}
function aspxKBSIKeyUp(name, evt){
 var control = aspxGetControlCollection().Get(name);
 if(control != null){
  var isProcessed = control.OnSpecialKeyUp(evt);
  if(isProcessed)
   return _aspxPreventEventAndBubble(evt);
 }
}
function aspxEKeyDown(name, evt){
 var edit = aspxGetControlCollection().Get(name);
 if(edit != null)
  edit.OnKeyDown(evt);
}
function aspxEKeyPress(name, evt){
 var edit = aspxGetControlCollection().Get(name);
 if(edit != null)
  edit.OnKeyPress(evt);
}
function aspxEKeyUp(name, evt){
 var edit = aspxGetControlCollection().Get(name);
 if(edit != null)
  edit.OnKeyUp(evt);
}
ASPxValidationResult = _aspxCreateClass(null, {
 constructor: function(isValid, firstInvalid, firstVisibleInvalid) {
  this.isValid = isValid;
  this.firstInvalid = firstInvalid;
  this.firstVisibleInvalid = firstVisibleInvalid;
 }
});
function _aspxProcessEditorsInContainer(container, processingProc, choiceCondition, validationGroup, processInvisibleEditors, processDisabledEditors) {
 var allProcessedSuccessfull = true;
 var firstInvalid = null;
 var firstVisibleInvalid = null;
 var invalidEditorToBeFocused = null;
 aspxGetControlCollection().ForEachControl(function(control) {
  if (ASPxIdent.IsASPxClientEdit(control) && (processDisabledEditors || control.GetEnabled())) {
   var mainElement = control.GetMainElement();
   if (_aspxIsExists(mainElement) &&
    (container == null || _aspxGetIsParent(container, mainElement)) &&
    (processInvisibleEditors || control.IsVisible()) &&
    choiceCondition(control, validationGroup)) {
    var isSuccess = processingProc(control);
    if(!isSuccess) {
     allProcessedSuccessfull = false;
     if(firstInvalid == null)
      firstInvalid = control;
     var isVisible = control.IsVisible();
     if(isVisible && firstVisibleInvalid == null)
      firstVisibleInvalid = control;
     if (control.setFocusOnError && invalidEditorToBeFocused == null && isVisible)
      invalidEditorToBeFocused = control;
    }
   }
  }
 }, this);
 if (invalidEditorToBeFocused != null)
  invalidEditorToBeFocused.SetFocus();
 return new ASPxValidationResult(allProcessedSuccessfull, firstInvalid, firstVisibleInvalid);
}
function _aspxClearChoiceCondition(edit, validationGroup) {
 return !_aspxIsExists(validationGroup) || (edit.validationGroup == validationGroup);
}
function _aspxValidateChoiceCondition(edit, validationGroup) {
 return _aspxClearChoiceCondition(edit, validationGroup) && edit.customValidationEnabled;
}
function _aspxEditorsValidChoiceCondition(edit, validationGroup) {
 return _aspxValidateChoiceCondition(edit, validationGroup);
}
function _aspxClearProcessingProc(edit) {
 edit.SetValue(null);
 edit.SetIsValid(true);
 return true;
}
function _aspxValidateProcessingProc(edit) {
 edit.OnValidation(ASPxValidationType.MassValidation);
 return edit.GetIsValid();
}
function _aspxEditorsValidProcessingProc(edit) {
 return edit.GetIsValid();
}
function _aspxSetSelectionCore(inputElement, startPos, endPos) {
 if (__aspxIE) {
  var range = inputElement.createTextRange();
  range.collapse(true);
  range.moveStart("character", startPos);
  range.moveEnd("character", endPos - startPos);
  range.select();
 } else
  inputElement.setSelectionRange(startPos, endPos);
}
function _aspxSetSelection(inputElement, startPos, endPos, scrollToSelection) {
 var textLen = inputElement.value.length;
 if (endPos == -1 || endPos > textLen) 
  endPos = textLen;
 if (startPos > textLen) 
  startPos = textLen;
 if (startPos > endPos)
  return;
 _aspxSetSelectionCore(inputElement, startPos, endPos);
 if (scrollToSelection && inputElement.tagName == 'TEXTAREA') {
  var scrollHeight = inputElement.scrollHeight;
  var approxCaretPos = startPos;
  var scrollTop = Math.max(Math.round(approxCaretPos * scrollHeight / textLen  - inputElement.clientHeight / 2), 0);
  inputElement.scrollTop = scrollTop;
 }
}
function _aspxSetCaretPosition(inputElement, caretPos, scrollToSelection) {
 if(!scrollToSelection)
  scrollToSelection = true;
 if (caretPos == -1)
  caretPos = inputElement.value.length;
 _aspxSetSelection(inputElement, caretPos, caretPos, scrollToSelection);
}
var __aspxLabelValueSuffix = "_V";
ASPxClientStaticEdit = _aspxCreateClass(ASPxClientEditBase, { 
 constructor: function(name) {
  this.constructor.prototype.constructor.call(this, name);
  this.Click = new ASPxClientEvent();
 },
 OnClick: function(htmlEvent) {
  this.RaiseClick(this.GetMainElement(), htmlEvent);
 },
 RaiseClick: function(htmlElement, htmlEvent){
  if(!this.Click.IsEmpty()){
   var args = new ASPxClientEditClickEventArgs(htmlElement, htmlEvent);
   this.Click.FireEvent(this, args);
  }
 },
 ChangeEnabledAttributes: function(enabled){
  this.ChangeMainElementAttributes(this.GetMainElement(), _aspxChangeAttributesMethod(enabled));
 },
 ChangeEnabledStateItems: function(enabled){
  aspxGetStateController().SetElementEnabled(this.GetMainElement(), enabled);
 },
 ChangeMainElementAttributes: function(element, method){
  method(element, "onclick");
 }
});
ASPxClientEditClickEventArgs = _aspxCreateClass(ASPxClientEventArgs, {
 constructor: function(htmlElement, htmlEvent){
  this.constructor.prototype.constructor.call(this);
  this.htmlElement = htmlElement;
  this.htmlEvent = htmlEvent;
 }
});
ASPxClientHyperLink = _aspxCreateClass(ASPxClientStaticEdit, {
 constructor: function(name) {
  this.constructor.prototype.constructor.call(this, name);
  this.sizingConfig.allowSetWidth = false;
  this.sizingConfig.allowSetHeight = false;
 },
 GetNavigateUrl: function(){
  var element = this.GetMainElement();
  if(_aspxIsExistsElement(element))
   return element.href;
  return "";
 },
 SetNavigateUrl: function(url){
  var element = this.GetMainElement();
  if(_aspxIsExistsElement(element))
   element.href = url;
 },
 GetText: function(){
  return this.GetValue();
 },
 SetText: function(value){
  this.SetValue(value);
 },
 ChangeMainElementAttributes: function(element, method){
  ASPxClientStaticEdit.prototype.ChangeMainElementAttributes.call(this, element, method);
  method(element, "href");
 }
});
ASPxClientHyperLink.Cast = ASPxClientControl.Cast;
ASPxClientImageBase = _aspxCreateClass(ASPxClientStaticEdit, {
 constructor: function(name) {
  this.constructor.prototype.constructor.call(this, name);
  this.imageWidth = "";
  this.imageHeight = "";
 },
 GetWidth: function(){
  return this.GetSize(true);
 },
 GetHeight: function(){
  return this.GetSize(false);
 },
 SetWidth: function(width) {
  this.SetSize(width, this.GetHeight());
 },
 SetHeight: function(height) {
  this.SetSize(this.GetWidth(), height);
 },
 SetSize: function(width, height){
  this.imageWidth = width + "px";
  this.imageHeight = height + "px";
  var image = this.GetMainElement();
  if(_aspxIsExistsElement(image))
   ASPxImageUtils.SetSize(image, width, height);
 },
 GetSize: function(isWidth){
  var image = this.GetMainElement();
  if(_aspxIsExistsElement(image))
   return ASPxImageUtils.GetSize(image, isWidth);
  return -1;
 }
});
ASPxClientImage = _aspxCreateClass(ASPxClientImageBase, {
 constructor: function(name) {
  this.constructor.prototype.constructor.call(this, name);
  this.emptyImageUrl = "";
  this.emptyImageToolTip = "";
  this.emptyImageWidth = "";
  this.emptyImageHeight = "";
  this.imageAlt = "";
  this.imageToolTip = "";
  this.isEmpty = false;
 },
 GetValue: function() {
  if(!this.isEmpty) {
   var image = this.GetMainElement();
   if(_aspxIsExistsElement(image))
    return ASPxImageUtils.GetImageSrc(image);
  }
  return "";
 },
 SetValue: function(value) {
  if(value == null) value = "";
  this.isEmpty = (value == "");
  var image = this.GetMainElement();
  if(_aspxIsExistsElement(image)){
   if(this.emptyImageUrl != ""){
    if(value == "")
     this.ApplyImageProperties(image, this.emptyImageUrl, this.emptyImageWidth, this.emptyImageHeight, this.emptyImageAlt, this.emptyImageToolTip);
    else
     this.ApplyImageProperties(image, value, this.imageWidth, this.imageHeight, this.imageAlt, this.imageToolTip);
   }
   else
    ASPxImageUtils.SetImageSrc(image, value);
  }
 },
 ApplyImageProperties: function(imageElement, url, width, height, alt, toolTip){
  ASPxImageUtils.SetImageSrc(imageElement, url);
  imageElement.style.width = width;
  imageElement.style.height = height;
  imageElement.alt = alt;
  imageElement.title = toolTip;
 },
 GetImageUrl: function(url){
  return this.GetValue();
 },
 SetImageUrl: function(url){
  this.SetValue(url);
 }
});
ASPxClientImage.Cast = ASPxClientControl.Cast;
ASPxClientBinaryImage = _aspxCreateClass(ASPxClientImageBase, {
 constructor: function(name) {
  this.constructor.prototype.constructor.call(this, name);
 },
 GetValue: function() {
  return "";
 },
 SetValue: function(value) {
 }
});
ASPxClientBinaryImage.Cast = ASPxClientControl.Cast;
ASPxClientLabel = _aspxCreateClass(ASPxClientStaticEdit, {
 constructor: function(name) {
  this.constructor.prototype.constructor.call(this, name);
  this.sizingConfig.allowSetWidth = false;
  this.sizingConfig.allowSetHeight = false;         
 },
 GetValue: function() { 
  var element = this.GetMainElement();
  if(_aspxIsExistsElement(element))
   return element.innerHTML;
 },
 SetValue: function(value) {
  if(value == null)
   value = "";
  var element = this.GetMainElement();
  if(_aspxIsExistsElement(element)) 
   element.innerHTML = value;
 },
 SetVisible: function(visible){
  if(this.clientVisible != visible){
   this.clientVisible = visible;
   var element = this.GetMainElement();
   if(!visible)
    element.style.display = "none";
   else if((element.style.width != "" || element.style.height != "") && !__aspxNetscapeFamily)
    element.style.display = "inline-block";
   else
    element.style.display = "";
  }
 },
 GetText: function(){
  return this.GetValue();
 },
 SetText: function(value){
  this.SetValue(value);
 },
 ChangeMainElementAttributes: function(element, method){
  ASPxClientStaticEdit.prototype.ChangeMainElementAttributes.call(this, element, method);
  method(element, "htmlFor");
 }
});
ASPxClientLabel.Cast = ASPxClientControl.Cast;
function aspxSEClick(name, evt){
 var edit = aspxGetControlCollection().Get(name);
 if(edit != null) 
  edit.OnClick(evt);
}
var __aspxDragHelper = null;
ASPxClientDragHelper = _aspxCreateClass(null, {
 constructor: function(e, root, clone){
  if(__aspxDragHelper != null) __aspxDragHelper.cancelDrag();
  this.dragArea = 5;
  this.lastX = e.clientX + _aspxGetDocumentScrollLeft();
  this.lastY = e.clientY + _aspxGetDocumentScrollTop();
  this.canDrag = true; 
  if(typeof(root) == "string") 
   root = _aspxGetParentByTagName(_aspxGetEventSource(e), root);
  this.obj = root && root != null ? root : _aspxGetEventSource(e);
  this.clone = clone;
  this.dragObj = null; 
  this.additionalObj = null;
  this.onDoClick = new Function();
  this.onEndDrag = new Function();
  this.onCancelDrag = new Function();
  this.onDragDivCreating = new Function();
  this.onCloneCreating = null;
  this.onCloneCreated = new Function();
  this.dragDiv = null;
  __aspxDragHelper = this;
  this.clearSelectionOnce = false;
 }, 
 drag: function(e) {
  if(!this.canDrag) return;
  if(!this.isDragging()) {
   if(!this.isOutOfDragArea(e.clientX, e.clientY)) 
    return;
   this.startDragCore(e);
  }
  if(__aspxIE && !_aspxGetIsLeftButtonPressed(e)) {
   this.cancelDrag(e);
   return;
  }
  this.clearSelection();
  if(!__aspxIE)
   _aspxSetElementSelectionEnabled(document.body, false);
  this.dragCore(e);
 },
 clearSelection: function() {
  if(!window.getSelection) return;
  var sel = window.getSelection(); 
  if(sel && sel.removeAllRanges) {
   sel.removeAllRanges() ; 
  }
 },
 startDragCore: function(e) {  
  this.dragObj = this.clone != true ? this.obj : this.createClone();
 },
 dragCore: function(e) {    
  var x = e.clientX + _aspxGetDocumentScrollLeft();
  var y = e.clientY + _aspxGetDocumentScrollTop();  
  var nx = this.dragObj.offsetLeft + x - this.lastX;
  var ny = this.dragObj.offsetTop + y - this.lastY;
  this.dragObj.style.left = nx + "px";
  this.dragObj.style.top = ny + "px";
  this.lastX = x;
  this.lastY = y;
 },
 endDrag: function(e) { 
  if(!this.isDragging() && !this.isOutOfDragArea(e.clientX, e.clientY)) 
   this.onDoClick(this);
  else this.onEndDrag(this);
  this.cancelDrag();
 },
 cancelDrag: function() {
  if(this.dragDiv != null) {
   document.body.removeChild(this.dragDiv);
   this.dragDiv = null;
  }
  this.onCancelDrag(this);
  __aspxDragHelper = null;
  if(!__aspxIE)
   _aspxSetElementSelectionEnabled(document.body, true);
 },
 isDragging: function() {
  return this.dragObj != null;
 },
 createClone: function() {
  this.dragDiv = document.createElement("div");
  this.onDragDivCreating(this, this.dragDiv);
  this.dragDiv.style.position = "absolute";
  this.dragDiv.style.cursor = "move";
  this.dragDiv.style.left = _aspxGetAbsoluteX(this.obj) + "px";
  this.dragDiv.style.top = _aspxGetAbsoluteY(this.obj) + "px";
  this.dragDiv.style.width = this.obj.offsetWidth + "px";
  this.dragDiv.style.height = this.obj.offsetHeight + "px";
  this.dragDiv.select = DragHelper_onselectstart;
  this.dragDiv.style.zIndex = 20000; 
  this.dragDiv.style.padding = "0px";
  this.dragDiv.style.margin = "0px";
  this.dragDiv.style.borderStyle = "none";
  this.dragDiv.style.borderWidth = "0px";
  this.dragDiv.style.backgroundColor = "transparent";
  var clone = this.creatingClone();
  this.onCloneCreated(clone);
  this.dragDiv.appendChild(clone);
  document.body.appendChild(this.dragDiv);
  return this.dragDiv;
 },
 creatingClone: function() {
  var clone = this.obj.cloneNode(true);
  if(!_aspxIsExists(this.onCloneCreating)) return clone;
  return this.onCloneCreating(clone);
 },
 addElementToDragDiv: function(element) {
  if(this.dragDiv == null) return;
  this.additionalObj = element.cloneNode(true);
  this.additionalObj.style.visibility = "visible";
  this.additionalObj.style.display = "";
  this.additionalObj.style.top = "";
  this.dragDiv.appendChild(this.additionalObj);
 },
 removeElementFromDragDiv: function() {
  if(this.additionalObj == null || this.dragDiv == null) return;
  this.dragDiv.removeChild(this.additionalObj);
  this.additionalObj = null;
 },
 isOutOfDragArea: function(newX, newY) {
  return Math.max(
   Math.abs(newX + _aspxGetDocumentScrollLeft() - this.lastX), 
   Math.abs(newY + _aspxGetDocumentScrollTop() - this.lastY)) >= this.dragArea;
 }
});
function DragHelper_onmouseup(e) {
 if(__aspxDragHelper != null) {
  __aspxDragHelper.endDrag(e);
  return true;
 }
}
function DragHelper_onmousemove(e) {
 if(__aspxDragHelper != null) {
  __aspxDragHelper.drag(e);
  return true;
 }
}
function DragHelper_onkeydown(e) {
 if(__aspxDragHelper == null) return;
 if(e.keyCode == ASPxKey.Esc) {
  if(_aspxIsExists(__aspxDragHelper.onEscKeyDown))
   __aspxDragHelper.onEscKeyDown();
  else
   __aspxDragHelper.cancelDrag();
 }
 return true;
}
function DragHelper_onselectstart(e) {
 var drag = __aspxDragHelper;
 if(drag && (drag.canDrag || drag.clearSelectionOnce)) {
  _aspxClearSelection();
  drag.clearSelectionOnce = false;
  return false;
 }
 return true;
}
_aspxAttachEventToDocument("mouseup", DragHelper_onmouseup);
_aspxAttachEventToDocument("mousemove", DragHelper_onmousemove);
_aspxAttachEventToDocument("keydown", DragHelper_onkeydown);
_aspxAttachEventToDocument("selectstart", DragHelper_onselectstart);
var __aspxCursorTargets = null;
ASPxClientCursorTargets = _aspxCreateClass(null, {
 constructor: function() {
  this.list = new Array();
  this.starttargetElement = null;
  this.starttargetTag = 0;
  this.oldtargetElement = null;
  this.oldtargetTag = 0;
  this.targetElement = null;
  this.targetTag = 0;
  this.x = 0;
  this.y = 0;
  this.removedX = 0;
  this.removedY = 0;
  this.removedWidth = 0;
  this.removedHeight = 0;
  this.onTargetChanging = new Function();
  this.onTargetChanged = new Function();
  this.onTargetAdding = null;
  __aspxCursorTargets = this;
 },
 addElement: function(element) {
  if(!this.canAddElement(element)) return null;
  var target = new ASPxClientCursorTarget(element);
  this.list.push(target);
  return target;
 },
 removeElement: function(element) {
  for(var i = 0; i < this.list.length; i++)
   if(this.list[i].element == element) {
    this.list.splice(i, 1);
    return;
   }
 },
 addParentElement: function(parent, child) {
  var target = this.addElement(parent);
  if(target != null) {
   target.targetElement = child;
  }
  return target;
 },
 RegisterTargets: function(element, idPrefixArray) {
  this.addFunc = this.addElement;
  this.RegisterTargetsCore(element, idPrefixArray);
 },
 UnregisterTargets: function(element, idPrefixArray) {
  this.addFunc = this.removeElement;
  this.RegisterTargetsCore(element, idPrefixArray);
 },
 RegisterTargetsCore: function(element, idPrefixArray) {
  if(element == null) return;  
  for(var i = 0; i < idPrefixArray.length; i++) 
   this.RegisterTargetCore(element, idPrefixArray[i]);
 },
 RegisterTargetCore: function(element, idPrefix) {
  if(!_aspxIsExists(element.id)) return;
  if(element.id.indexOf(idPrefix) > -1) 
   this.addFunc(element);
  for(var i = 0; i < element.childNodes.length; i ++) 
   this.RegisterTargetCore(element.childNodes[i], idPrefix);
 },
 canAddElement: function(element) {
  if(element == null || !_aspxGetElementDisplay(element))
   return false;
  for(var i = 0; i < this.list.length; i ++) {
   if(this.list[i].targetElement == element) return false;
  }
  if(this.onTargetAdding != null && !this.onTargetAdding(this, element)) return false;
  return element.style.visibility != "hidden";
 },
 removeInitialTarget: function(x, y) {
  var el = this.getTarget(x  + _aspxGetDocumentScrollLeft(), y  + _aspxGetDocumentScrollTop());
  if(el == null) return;
  this.removedX = _aspxGetAbsoluteX(el);
  this.removedY = _aspxGetAbsoluteY(el);
  this.removedWidth = el.offsetWidth;
  this.removedHeight = el.offsetHeight;
 },
 getTarget: function(x, y) {
  for(var i = 0; i < this.list.length; i ++) {
   if(this.list[i].contains(x, y))
    return this.list[i].targetElement;
  }
  return null;
 },
 targetChanged: function(element, tag) {
  this.targetElement = element;
  this.targetTag = tag; 
  this.onTargetChanging(this);
  if(this.oldtargetElement != this.targetElement || this.oldtargetTag != this.targetTag) {
   this.onTargetChanged(this);
   this.oldtargetElement = this.targetElement;
   this.oldtargetTag = this.targetTag;
  }
 },
 cancelChanging: function() {
  this.targetElement = this.oldtargetElement;
  this.targetTag = this.oldtargetTag;
 },
 isLeftPartOfElement: function() {
  if(this.targetElement == null) return true;
  var left = this.x - this.targetElementX();
  return left < this.targetElement.offsetWidth / 2; 
 },
 isTopPartOfElement: function() {
  if(this.targetElement == null) return true;
  var top = this.y - this.targetElementY();
  return top < this.targetElement.offsetHeight / 2; 
 },
 targetElementX: function() {
  return this.targetElement != null ? _aspxGetAbsoluteX(this.targetElement) : 0;
 },
 targetElementY: function() {
  return this.targetElement != null ? _aspxGetAbsoluteY(this.targetElement) : 0;
 },
 onmousemove: function(e) {
  this.doTargetChanged(e); 
 },
 onmouseup: function(e) { 
  this.doTargetChanged(e); 
  __aspxCursorTargets = null; 
 },
 doTargetChanged: function(e) {
  this.x = e.clientX + _aspxGetDocumentScrollLeft();
  this.y = e.clientY + _aspxGetDocumentScrollTop();
  if(this.inRemovedBounds(this.x, this.y)) return; 
  this.targetChanged(this.getTarget(this.x, this.y), 0); 
 },
 inRemovedBounds: function(x, y) {
  if(this.removedWidth == 0) return false;
  return x > this.removedX && x < (this.removedX + this.removedWidth) &&
   y > this.removedY && y < (this.removedY + this.removedHeight);
 }
});
ASPxClientCursorTarget = _aspxCreateClass(null, {
 constructor: function(element) {
  this.element = element;
  this.targetElement = element;
  this.absoluteX = _aspxGetAbsoluteX(element);
  this.absoluteY = _aspxGetAbsoluteY(element);
 },
 contains: function(x, y) {
  return x >= this.absoluteX && x <= this.absoluteX + this.element.offsetWidth &&
   y >= this.absoluteY && y <= this.absoluteY + this.element.offsetHeight;
 }
});
function CursorTarget_onmouseup(e) {
 if(__aspxCursorTargets != null) {
  __aspxCursorTargets.onmouseup(e);
  return true;
 }
}
function CursorTarget_onmousemove(e) {
 if(__aspxCursorTargets != null) {
  __aspxCursorTargets.onmousemove(e);
  return true;
 }
}
_aspxAttachEventToDocument("mouseup", CursorTarget_onmouseup);
_aspxAttachEventToDocument("mousemove", CursorTarget_onmousemove);

var __aspxWindowResizer = null;
var __aspxClientPopupFilterWindow = null;
ASPxClientWindowResizer = _aspxCreateClass(null, {
 constructor: function(e, resizedEl){
  __aspxWindowResizer = this;
  this.resizedEl = resizedEl;
  this.minWidth = 50;
  this.minHeight = 50;
  this.lastX = e.clientX;
  this.lastY = e.clientY; 
  this.newWidth = resizedEl.offsetWidth;
  this.newHeight = resizedEl.offsetHeight;
  this.startWidth = this.newWidth;
  this.startHeight = this.newHeight;
  this.virtWidth = this.newWidth;
  this.virtHeight = this.newHeight;
  this.onSetSize = null;
  this.onEndResizing = new Function();
 }, 
 doResizing: function(e) {
  this.virtWidth = this.virtWidth + e.clientX - this.lastX;
  this.virtHeight = this.virtHeight + e.clientY - this.lastY;
  this.lastX = e.clientX;
  this.lastY = e.clientY;  
  this.newWidth = this.virtWidth;
  this.newHeight = this.virtHeight;
  if(this.newWidth < this.minWidth)
   this.newWidth = this.minWidth;
  if(this.newHeight < this.minHeight)
   this.newHeight = this.minHeight;
  this.doSetSize();
 },
 cancel: function() {
  this.newWidth = this.startWidth;
  this.newHeight = this.startHeight;
  this.stop();
 },
 endResizing: function(e) {
  this.onEndResizing(e);
  this.stop(); 
 },
 stop: function() {
  this.doSetSize();
  __aspxWindowResizer = null;
 },
 doSetSize : function() {
  if(this.onSetSize == null || this.onSetSize(this)) {
   this.setSize();  
  }
 },
 setSize: function() {
  this.resizedEl.style.width = this.newWidth + "px";
  this.resizedEl.style.height = this.newHeight + "px";
 }
});
ASPxClientPopupFilterWindow = _aspxCreateClass(null, {
 constructor: function(name){
  this.name = name;
  this.onHidden = null;
  this.monitorWindowResizing = true;
  _aspxAttachEventToElement(this.GetWindowResizer(), "dragstart", _aspxPreventDragStart);
 },
 GetWindow: function() { return _aspxGetElementById(this.name + "_FPW"); },
 GetElement: function() { return _aspxGetElementById(this.name + "_FPC"); },
 GetWindowResizer: function() { return _aspxGetElementById(this.name + "_FPWR"); },
 IsShowing: function() {
  if(!_aspxIsExists(this.window)) return false;
  return _aspxGetElementDisplay(this.window);
 },
 Hide: function() {
  if(!_aspxIsExists(this.window)) return;
  __aspxClientPopupFilterWindow = null;
  _aspxSetElementDisplay(this.window, false);
  this.header = null;
  if(_aspxIsExists(this.onHidden))
   this.onHidden(this);
 },
 Show: function(element, mainElement) {
  __aspxClientPopupFilterWindow = this;
  this.window = this.GetWindow();
  if(!_aspxIsExists(this.window)) return;
  _aspxSetElementDisplay(this.window, true);
  var left = _aspxGetAbsoluteX(element, mainElement);
  var top = _aspxGetAbsoluteY(element, mainElement) + element.offsetHeight;
  left = _aspxPrepareClientPosForElement(left, this.window, true);
  top = _aspxPrepareClientPosForElement(top, this.window, false);
  this.window.style.left = left + "px";
  this.window.style.top = top + "px";
  this.header = element;
 },
 SetDefaultWidth: function() {
  this.GetWindow().style.width = "";
  this.GetElement().style.width = "";
 },
 onMouseDown: function(e) {
  var e = _aspxGetEvent(e);
  var element = _aspxGetEventSource(e);
  if(element.DXFilterPopupButton) return true; 
  if(this.IsShowing() && !_aspxGetIsParent(this.window, _aspxGetEventSource(e))) {
   this.Hide();
  }
  return true;
 },
 onResizerMouseDown: function(e) {
  var resizer = new ASPxClientWindowResizer(e, this.GetElement());
  resizer.onSetSize = this.ResizerSetSize;
  resizer.resizedWindow = this.window;  
  return _aspxCancelBubble(e);
 },
 ResizerSetSize: function(resizer) {
  var oldElWidth = resizer.resizedEl.style.width;
  var oldWindowWidth = resizer.resizedWindow.style.width;
  var difEl = resizer.resizedEl.offsetWidth;
  var difWindow = resizer.resizedWindow.offsetWidth;
  resizer.resizedWindow.style.width = resizer.newWidth + "px";
  resizer.resizedEl.style.width = resizer.newWidth + "px";
  difEl = resizer.resizedEl.offsetWidth - difEl;
  difWindow = resizer.resizedWindow.offsetWidth - difWindow;
  if(difEl != difWindow) {
   resizer.resizedEl.style.width = oldElWidth;
   resizer.resizedWindow.style.width = oldWindowWidth;
  }
  if(__aspxNetscapeFamily) {
   resizer.resizedWindow.style.width = resizer.resizedEl.style.width;
   if(resizer.resizedWindow.offsetWidth < resizer.resizedEl.offsetWidth) {
      resizer.resizedWindow.style.width = "";
   }
  }
  resizer.resizedWindow.style.height = resizer.newHeight + "px";
  resizer.resizedEl.style.height = resizer.newHeight + "px";
  return false;
 }
});
function WindowResizer_onmouseup(e) {
 if(__aspxWindowResizer != null)
  __aspxWindowResizer.endResizing(e);
 return true;
}
function WindowResizer_onmousemove(e) {
 if(__aspxWindowResizer != null) {
  __aspxWindowResizer.doResizing(e);
 }
 return true;
}
function WindowResizer_onkeydown(e) {
 if(__aspxWindowResizer == null) return;
 if(e.keyCode == ASPxKey.Esc)
  __aspxWindowResizer.cancel();
 return true;
}
function WindowResizer_onselectstart(e) {
 if(__aspxWindowResizer == null) return;
 document.selection.empty();
 return false;
}
var __aspxClientPopupFilterWindowShowAgain = false;
function PopupFilterWindow_DocumentOnMouseDown(e){
 if(__aspxClientPopupFilterWindow == null) return;
 var src = _aspxGetEventSource(e),
  header = __aspxClientPopupFilterWindow.header;
 var onclickText = _aspxIsExists(src.onclick) ? src.onclick.toString() : "";
 if(onclickText.indexOf("_ShowFilterPopup") >= 0 && __aspxClientPopupFilterWindow.IsShowing() && _aspxGetIsParent(header, src)) {
  __aspxClientPopupFilterWindowShowAgain = true;
 }
 return __aspxClientPopupFilterWindow.onMouseDown(e);
}
function PopupFilterWindow_WindowOnResize(e){
 if(!__aspxClientPopupFilterWindow || !__aspxClientPopupFilterWindow.monitorWindowResizing) return;
 __aspxClientPopupFilterWindow.Hide();
}
function PopupFilterWindow_WindowOnLoad(e) {
 _aspxAttachEventToDocument("mousedown", PopupFilterWindow_DocumentOnMouseDown);
 _aspxAttachEventToElement(window, "resize", PopupFilterWindow_WindowOnResize);
}
_aspxAttachEventToDocument("mouseup", WindowResizer_onmouseup);
_aspxAttachEventToDocument("mousemove", WindowResizer_onmousemove);
_aspxAttachEventToDocument("keydown", WindowResizer_onkeydown);
_aspxAttachEventToDocument("selectstart", WindowResizer_onselectstart);
_aspxAttachEventToElement(window, "load", PopupFilterWindow_WindowOnLoad);
ASPxClientGridView = _aspxCreateClass(ASPxClientControl, {
 constructor: function(name){
  this.constructor.prototype.constructor.call(this, name);
  this.callBacksEnabled = true;
  this.custwindowLeft = null;
  this.custwindowTop = null;
  this.custwindowVisible = null;
  this.activeElement = null;
  this.filterKeyPressInputValue = "";
  this.userChangedSelection = false;
  this.lockFilter = false;
  this.confirmDelete = "";
  this.filterKeyPressTimerId = -1;
  this.virtualScrollTimerId = -1;
  this.lockVirtualScrolling = false;
  this.filterPopupWindow = null;
  this.filterPopupActiveColumnIndex = -1;
  this.filterRowMenuColumnIndex = -1;
  this.editorIDList = [ ];
  this.keys = [];
  this.lastMultiSelectIndex = -1;
  this.hasFooterRowTemplate = false;
  this.mainTableClickData = {
   processing: false,
   focusChanged: false,
   selectionChanged: false
  };
  this.scrollPosLogger = null;
  this.fixedColumnsStrayScrollHandler = null;
  this.sizingConfig.adjustControl = true;
  this.SelectionChanged = new ASPxClientEvent();
  this.FocusedRowChanged = new ASPxClientEvent();
  this.ColumnSorting = new ASPxClientEvent();
  this.ColumnGrouping = new ASPxClientEvent();
  this.ColumnMoving = new ASPxClientEvent();
  this.ColumnStartDragging  = new ASPxClientEvent();
  this.ColumnResizing  = new ASPxClientEvent();
  this.ColumnResized  = new ASPxClientEvent();
  this.RowExpanding  = new ASPxClientEvent();
  this.RowCollapsing  = new ASPxClientEvent();
  this.DetailRowExpanding  = new ASPxClientEvent();
  this.DetailRowCollapsing  = new ASPxClientEvent();
  this.RowClick  = new ASPxClientEvent();
  this.RowDblClick  = new ASPxClientEvent();
  this.ContextMenu = new ASPxClientEvent();
  this.CustomizationWindowCloseUp = new ASPxClientEvent();
  this.CustomButtonClick = new ASPxClientEvent();
  this.funcCallbacks = new Array();
  this.pageRowCount = 0;
  this.pageRowSize = 0;
  this.pageIndex = 0;
  this.pageCount = 1;
  this.allowFocusedRow = false;
  this.allowMultiSelection = false;
  this.focusedRowIndex = -1;
  this.selectedWithoutPageRowCount = 0;
  this.visibleStartIndex = 0;
  this.columns = new Array();
  this.isColumnsResizable = false;
  this.isMainControlResizable = false;
  this.isVerticalScrolling = false;
  this.isHorizontalScrolling = false;
  this.fixedColumnCount = 0;
  this.scrollToRowIndex = -1;
  this.virtualScrollRowHeight = 0;
  this.callbackOnFocusedRowChanged = false;
  this.callbackOnSelectionChanged = false;
  this.autoFilterDelay = 1200;
  this.editState = 0;
  this.kbdHelper = null;
  this.enableKeyboard = false;
  this.keyboardLock = false;
  this.accessKey = null;
  this.rowHotTrackStyle = null;
  this.rowHotTrackItemsBag = { };
  if(ASPxClientGridView.instances)
   ASPxClientGridView.instances[this.name] = this;
 },
 ClearColumns: function() {
  this.columns = new Array();
 },
 CreateColumn: function (name, index, fieldName, visible, filterRowTypeKind) {
  if(!_aspxIsExists(this.columns)) 
   this.columns = new Array();
  this.columns.push(new ASPxClientGridViewColumn(name, index, fieldName, visible, filterRowTypeKind));
 },
 _constDXDataRow: function() { return "DXDataRow"; },
 _constDXGroupRow: function() { return "DXGroupRow"; },
 CustomizationWindowSuffix: "_custwindow",
 EmptyHeaderSuffix: "_emptyheader",
 _constDXMainTable: function() { return "DXMainTable"; },
 _isGroupRow: function(row) { return row.id.indexOf(this._constDXGroupRow()) > -1; },
 GetRootTable: function() { return _aspxGetElementById(this.name); },
 GetGridTD: function() { 
  var table = this.GetRootTable();
  if(!_aspxIsExists(table)) return null;
  return table.rows[0].cells[0];
 },
 GetArrowDragDownImage: function() { return this.GetChildElementById("IADD"); },
 GetArrowDragUpImage: function() { return this.GetChildElementById("IADU"); },
 GetArrowDragFieldImage: function() { return this.GetChildElementById("IDHF"); },
 GetCallbackState: function() { return this.GetChildElementById("CallbackState"); },
 GetSelectionInput: function() { return this.GetChildElementById("DXSelInput"); },
 GetFocusedRowInput: function() { return this.GetChildElementById("DXFocusedRowInput"); },
 GetColResizedInput: function() { return this.GetChildElementById("DXColResizedInput"); },
 GetPostBackSyncInput: function() { return this.GetChildElementById("DXSyncInput"); },
 GetLoadingPanelDiv: function() {  return this.GetChildElementById("LPD"); },
 GetHorzScrollDiv: function() {  return this.GetChildElementById("DXHorzScrollDiv"); },
 GetFixedColumnsDiv: function() {  return this.GetChildElementById("DXFixedColumnsDiv"); },
 GetRow: function(visibleIndex) { 
  var res = this.GetDataRow(visibleIndex);
  if(res == null) res = this.GetGroupRow(visibleIndex);
  return res;
 },
 GetDataRow: function(visibleIndex) { return this.GetChildElementById(this._constDXDataRow() + visibleIndex); },
 GetGroupRow: function(visibleIndex) { 
  var element = this.GetChildElementById(this._constDXGroupRow() + visibleIndex);
  if(!element)
   element = this.GetExpandedGroupRow(visibleIndex);
  return element; 
 },
 GetExpandedGroupRow: function(visibleIndex) { return this.GetChildElementById(this._constDXGroupRow() + "Exp" + visibleIndex); },
 GetDataRowSelBtn: function(index) { return this.GetChildElementById("DXSelBtn" + index); },
 GetMainTable: function() { return this.GetChildElementById(this._constDXMainTable()); },
 GetStyleTable: function() { return this.GetChildElementById("DXStyleTable"); },
 GetLoadingPanelContainer: function() { return this.GetChildElementById("DXLPContainer"); },
 IsGroupingTarget: function(id) { 
  return id.indexOf(this.name + "_grouppanel") == 0 || id.indexOf("-groupcol") > -1;
 },
 GetHeadersRow: function() { 
  return this.GetChildElementById("DXHeadersRow"); 
 },
 GetEditingRow: function(obj) { return _aspxGetElementById(obj.name + "_DXEditingRow"); },
 GetEditingErrorRow: function(obj) { return _aspxGetElementById(obj.name + "_DXEditingErrorRow"); },
 GetEditFormTable: function() { return _aspxGetElementById(this.name + "_DXEFT"); },
 GetCustomizationWindow: function() { return aspxGetControlCollection().Get(this.name + this.CustomizationWindowSuffix); },
 GetParentRowsWindow: function() { return aspxGetControlCollection().Get(this.name + "_DXparentrowswindow"); },
 GetEditorPrefix: function() { return "DXEditor"; },
 GetPopupEditForm: function() { return aspxGetControlCollection().Get(this.name  + "_DXPEForm"); },
 GetFilterWindowContent: function(){ return this.GetChildElementById("FPC"); },
 GetFilterRowMenu: function() { return aspxGetControlCollection().Get(this.name + "_DXFilterRowMenu"); },
 GetFilterControlPopup: function() { return aspxGetControlCollection().Get(this.name + "_DXPFCForm"); },
 GetFilterControl: function() { return aspxGetControlCollection().Get(this.name +  "_DXPFCForm_DXPFC"); }, 
 GetEditorByColumnIndex: function(colIndex) { 
  var list = this._getEditors();
  for(var i = 0; i < list.length; i++) {
   if(this._getNumberFromEndOfString(list[i].name) == colIndex) return list[i];
  }
  return null;
 }, 
 Initialize: function(){
  this.constructor.prototype.Initialize.call(this);
  if(this.enabled)
   this.SetHeadersClientEvents();
  this._setFocusedRowInputValue();
  this.UpdateHorzScrollDivs();
  this.ApplyPostBackSyncData();
  this.ToggleScrollPosLogger(true);
  this.AddSelectStartHandler();
  this.EnsureRowHotTrackItems();
  if(this.enableKeyboard) {
   this.kbdHelper = new ASPxGridViewKbdHelper(this);
   this.kbdHelper.Init();
   ASPxKbdHelper.RegisterAccessKey(this);
  }
 },
 AdjustControlCore: function() {
  ASPxClientControl.prototype.AdjustControlCore.call(this);
  this.UpdateVerticalScrollControls();
  this.UpdateHorzScrollDivs();
 },
 GetChildElementById: function(childName){
  if(!_aspxIsExists(this.childrenCache)) 
   this.childrenCache = new Object();
  if(!_aspxIsExistsElement(this.childrenCache[childName])) 
   this.childrenCache[childName] = _aspxGetElementById(this.name + "_" + childName);
  return this.childrenCache[childName];
 },
 gridCallBack: function(arguments) {
  if(!this.isInitialized)
   return;
  this.OnBeforeCallbackOrPostBack();
  var serializedArgs = _aspxSerializeStringArray(arguments); 
  if(!_aspxIsExists(this.callBack) || !this.callBacksEnabled) {
   this.lockFilter = true;
   this.SendPostBack(serializedArgs);
  } else {
   this.OnBeforeCallback();
   var command = this.GetCorrectedCommand(arguments);
   var preparedArgs = this.prepareCallbackArgs(serializedArgs, this.GetGridTD());
   this.lockFilter = true;
   this.userChangedSelection = false;
   this.CreateCallback(preparedArgs, command);
  }
 },
 GetCorrectedCommand: function(arguments) {
  if(arguments.length == 0)
   return "";
  var command = arguments[0];
  if(arguments.length > 1 && command == "COLUMNMOVE") {
   if(arguments[arguments.length - 1])
    command = "UNGROUP";
   if(arguments[arguments.length - 2])
    command = "GROUP";
  }
  return command;
 },
 FuncGetCallBackIndex: function(onCallBack) {
  for(var i = 0; i < this.funcCallbacks.length; i ++) {
   if(this.funcCallbacks[i] == null) {
    this.funcCallbacks[i] = onCallBack;
    return i;
   }
  }
  this.funcCallbacks.push(onCallBack);
  return this.funcCallbacks.length - 1;
 },
 GetFuncCallBack: function(index) {
  if(index < 0 || index >= this.funcCallbacks.length) return null;
  var result = this.funcCallbacks[index];
  this.funcCallbacks[index] = null;
  return result;
 },
 gridFuncCallBack: function(arguments, onCallBack) {
  var serializedArgs = _aspxSerializeStringArray(arguments); 
  var callbackArgs = this.formatCallbackArg("FB", this.FuncGetCallBackIndex(onCallBack).toString()) +
   this.prepareCallbackArgs(serializedArgs, null);
  this.CreateCallback(callbackArgs, "FUNCTION");
 }, 
 prepareCallbackArgs: function(serializedArgs, rootTD) {
  var preparedArgs =
   this.formatCallbackArg("EV", this.GetEditorValues(rootTD)) +
   this.formatCallbackArg("SR", this.GetSelectedState()) +
   this.formatCallbackArg("FR", this.GetFocusedRowInput()) +
   this.formatCallbackArg("CR", this.GetColResizedInput()) +
   this.formatCallbackArg("GB", serializedArgs);
  return preparedArgs;
 },
 formatCallbackArg: function(prefix, arg) {
  if(arg == null) return "";
  if(!_aspxIsExists(arg.length) && _aspxIsExists(arg.value)) {
   arg = arg.value;
  }
  if(arg == null || arg == "") return "";
  return prefix + "|" + arg.length + ';' + arg + ';';
 },
 OnCallback: function(result){
  this.HideFilterControlPopup();
  if(result.indexOf("FB|") == 0) {
   _aspxSetTimeout("aspxGVFuncCallback(\""+this.name+"\", \"" + escape(result.substr(3)) +"\");", 0);
  } else {
   var rootTD = this.GetGridTD();
   if(rootTD != null) {
    _aspxSetInnerHtml(rootTD, result);
   }
   _aspxSetTimeout("aspxRestoreCallBackTimer(\""+this.name+"\");", 0);
  }
 },
 OnFuncCallback: function(result) {
  var pos = result.indexOf("|");
  if(pos < 0) return;
  var index = parseInt(result.substr(0, pos), 10);
  var onCallBack = this.GetFuncCallBack(index);
  if(onCallBack == null) return;
  result = result.substr(pos + 1);
  onCallBack(eval(result));
 },
 OnCallbackError: function(result, data){
  var rootTD = this.GetGridTD();
  this.showingError = result;
  if(rootTD != null) 
   _aspxSetTimeout("aspxRestoreCallBackTimer(\"" + this.name + "\");", 0);
 },
 ShowError: function(errorText) {
  var displayIn = this;
  if(_aspxIsExists(this.GetPopupEditForm())) {
   displayIn = this.GetPopupEditForm();
   if(!this.GetPopupEditForm().IsVisible()) {
    this.GetPopupEditForm().Show();  
   }
  }
  var errorRow = this.GetEditingErrorRow(displayIn);
  if(errorRow == null) {
   var editRow = this.GetEditingRow(displayIn);
   if(editRow != null) {
     errorRow = editRow.parentNode.insertRow(editRow.sectionRowIndex + 1);
     errorRow.id = editRow.id.replace("DXEditingRow", "DXEditingErrorRow");
    this.ApplyEditingErrorRowStyle(errorRow);
   }
  }
  if(errorRow != null) {
   errorRow.cells[errorRow.cells.length - 1].innerHTML = errorText;
  } else {
    alert(errorText);
  }
 },
 ApplyEditingErrorRowStyle: function(errorRow) {
  var row = this.GetStyleTable().rows[1];
  errorRow.className = row.className;
  errorRow.style.cssText = row.style.cssText;
  for(var i = 0; i < row.cells.length; i ++) {
   errorRow.appendChild(row.cells[i].cloneNode(true));
  }
 },
 OnBeforeCallbackOrPostBack: function() {
  this.HidePopupEditForm();
  ASPxClientGridView.SaveActiveElementSettings(this);
 },
 OnBeforeCallback: function() {
  this.keyboardLock = true;
  _aspxClearTimer(this.virtualScrollTimerId);
  this.virtualScrollTimerId = -1;
  this.ShowLoadingPanel();
  this.ToggleScrollPosLogger(false);
  this.SaveCallbackSettings();
  this.RemoveSelectStartHandler();
 },
 OnAfterCallback: function() {
  if(_aspxIsExists(this.showingError) && this.showingError != "") {
     this.ShowError(this.showingError);
      this.showingError = null;
    }
  this.childrenCache = new Object();
  this.lockFilter = true;
  try {
   this.SetHeadersClientEvents();
   this.UpdateHorzScrollDivs();
   this.ToggleScrollPosLogger(true);
   this.RestoreCallbackSettings();
   this.AddSelectStartHandler();
   this.EnsureRowHotTrackItems();
  }
  finally {
   this.lockFilter = false;
   this.keyboardLock = false;
  }
 },
 SaveCallbackSettings: function() {
  var custWindow = this.GetCustomizationWindow();
  if(custWindow != null) {
   var custWindowElement = custWindow.GetWindowElement(-1);
   if(_aspxIsExists(custWindowElement )){
    this.custwindowLeft = _aspxGetAbsoluteX(custWindowElement);
    this.custwindowTop = _aspxGetAbsoluteY(custWindowElement);
    this.custwindowVisible = custWindow.IsVisible();
   }
  } else {
   this.custwindowVisible = null;
  }
  var helper = this.getFixedColumnsHelper();
  if(helper != null) helper.SaveCallbackSettings();  
 },
 RestoreCallbackSettings: function() {
  var custWindow = this.GetCustomizationWindow();
  if(custWindow != null && this.custwindowVisible != null) {
   if(this.custwindowVisible){
    custWindow.enableAnimation = false;
    custWindow.ShowAtPos(this.custwindowLeft, this.custwindowTop);
   }
  }
  this.UpdateVerticalScrollControls();
  this.ApplyPostBackSyncData();
  this.sizeCorrectedOnce = false; 
  var helper = this.getFixedColumnsHelper();
  if(helper != null) helper.RestoreCallbackSettings();
  ASPxClientGridView.RestoreActiveElementSettings(this); 
 },
 HidePopupEditForm: function() {
  var popup = this.GetPopupEditForm();
  if(popup != null) {
   popup.Hide();
  }
 },
 _isRowSelected: function(visibleIndex) {
  if(!_aspxIsExists(this.GetDataRow(visibleIndex))) return false;
  var index = this._getRowIndexOnPage(visibleIndex);
  var selInput = this.GetSelectionInput();
  if(!_aspxIsExists(selInput)) return false;
  return this._isTrueInCheckList(selInput.value, index);
 },
 _isTrueInCheckList: function(checkList, index) {
  if(index < 0 ||  index >= checkList.length) return false;
  return checkList.charAt(index) == "T";
 },
 _getSelectedRowCount: function() {
  var res = this.selectedWithoutPageRowCount;
  var selInput = this.GetSelectionInput();
  if(!_aspxIsExists(selInput)) return res;
  var checkList = selInput.value;
  var selCount = 0;
  for(var i = 0; i < checkList.length; i++) {
   if(checkList.charAt(i) == "T") selCount ++;
  }
  return res + selCount;
 },
 _selectAllRowsOnPage: function(checked) {
  var selInput = this.GetSelectionInput();
  if(!_aspxIsExists(selInput)) return;
  this._selectAllSelBtn(checked);
  var prevSelectedRowCount = 0;
  var isTrueInCheckList = false;
  for(var i = 0; i < this.pageRowCount; i ++) {
   isTrueInCheckList = this._isTrueInCheckList(selInput.value, i);
   if(isTrueInCheckList) prevSelectedRowCount++; 
   if(isTrueInCheckList != checked) {
    this.ChangeRowStyle(i + this.visibleStartIndex, checked ? 0 : 3);
   }
  }
  if (prevSelectedRowCount == 0 && !checked) return;
  var selValue = "";
  if(checked) {
   for(var i = 0; i < this.pageRowCount; i ++)
    selValue += this.IsDataRow(this.visibleStartIndex + i ) ? "T" : "F";
  }
  if(selValue != selInput.value) {
   this.userChangedSelection = true;
   if(selValue == "") selValue = "U";
   selInput.value = selValue;
  }
  this.DoSelectionChanged(-1, checked, true);
 },
 DeleteGridRow: function(visibleIndex) {
  if(this.confirmDelete != "" && !confirm(this.confirmDelete)) return;
  this.DeleteRow(visibleIndex);
 },
 _selectAllSelBtn: function(checked) {
  if(this.pageRowCount <= 0) return;
  for(var i = 0; i < this.pageRowCount; i ++) {
   var element = this.GetDataRowSelBtn(i + this.visibleStartIndex);
   if(element != null) {
    element.checked = checked;
   }
  }
 },
 SelectRowCore: function(visibleIndex, check) {
  var checked = false;
  var isCheckBox = _aspxIsExists(check) && _aspxIsExists(check.checked) && _aspxIsExists(check.type) && check.type.toLowerCase() == "checkbox";
  if(!isCheckBox) {
   checked = !this._isRowSelected(visibleIndex);
  } else {
   checked = check.checked;
  }
  this.SelectRow(visibleIndex, checked, isCheckBox);
 },
 doRowMultiSelect: function(row, rowIndex, evt) {
  var ctrlKey = evt.ctrlKey || evt.metaKey;
  if(!ctrlKey && !evt.shiftKey) {
   this._selectAllRowsOnPage(false);
   this.SelectRow(rowIndex, true);
   this.lastMultiSelectIndex = rowIndex;
  } else {
   if(!__aspxIE && !_aspxGetEventSource(evt).tagName.match(/input|select|textarea/i))
    _aspxClearSelection();
   if(ctrlKey) {
    this.SelectRow(rowIndex, !this._isRowSelected(rowIndex));
    this.lastMultiSelectIndex = rowIndex;
   } else {
    var startIndex = rowIndex > this.lastMultiSelectIndex ? this.lastMultiSelectIndex + 1 : rowIndex;
    var endIndex = rowIndex > this.lastMultiSelectIndex ? rowIndex : this.lastMultiSelectIndex - 1;
    for(var i = this.visibleStartIndex; i < this.pageRowCount + this.visibleStartIndex; i ++) {
     if(i == this.lastMultiSelectIndex) continue;
     this.SelectRow(i, i >= startIndex && i <= endIndex);
    }
   }
  }
  this.UpdatePostBackSyncInput();
 },
 AddSelectStartHandler: function() {   
  if(!this.allowMultiSelection || !__aspxIE)
   return;
  _aspxAttachEventToElement(this.GetMainTable(), "selectstart", ASPxClientGridView.SelectStartHandler);
 },
 RemoveSelectStartHandler: function() {
  if(!this.allowMultiSelection || !__aspxIE)
   return; 
  _aspxDetachEventFromElement(this.GetMainTable(), "selectstart", ASPxClientGridView.SelectStartHandler);
 },
 SelectRow: function(visibleIndex, checked, fromCheckBox) {
  if(!this.IsDataRow(visibleIndex)) return;
  if(_aspxIsExists(fromCheckBox)) fromCheckBox = false;
  var index = this._getRowIndexOnPage(visibleIndex);
  if(index < 0) return;
  var selInput = this.GetSelectionInput();
  if(_aspxIsExists(selInput)) {
   this.userChangedSelection = true;
   var checkList = selInput.value;
   if(index >= checkList.length) {
    if(!checked) return;
    for(var i = checkList.length; i <= index; i ++)
     checkList += "F";
   }
   checkList = checkList.substr(0, index) + (checked ? "T" : "F") + checkList.substr(index + 1, checkList.length - index - 1);
   if(checkList.indexOf("T") < 0) checkList = "U";
   selInput.value = checkList;
  }
  if(!fromCheckBox) {
   var checkBox = this.GetDataRowSelBtn(visibleIndex);
   if(checkBox != null) checkBox.checked = checked;
  }
  this.ChangeRowStyle(visibleIndex, checked ? 0 : 3);
  this.DoSelectionChanged(visibleIndex, checked, false);
 },
 getRowByHtmlEvent: function(evt) {
  var row = _aspxGetParentByPartialId(_aspxGetEventSource(evt), this._constDXDataRow());
  if(!_aspxIsExists(row))
   row = _aspxGetParentByPartialId(_aspxGetEventSource(evt), this._constDXGroupRow());
  return row;
 },
 mainTableClick: function(evt) { this.getGridByRow(evt).mainTableClickCore(evt); },
 mainTableClickCore: function(evt) {
  if(this.kbdHelper)
   this.kbdHelper.HandleClick(evt);
  this.mainTableClickData.processing = true;
  try {
   var source = _aspxGetEventSource(evt);
   var row = this.getRowByHtmlEvent(evt);
   if(_aspxIsExists(row)) {
    var rowIndex = this.getRowIndex(row.id);
    if(source && source.className.indexOf("dxgv__cci") < 0)
     if(this.RaiseRowClick(rowIndex, evt)) return; 
    if(this.allowFocusedRow) {
     this.focusRow(row);
    }
    if(this.allowMultiSelection) {
     if(source != this.GetDataRowSelBtn(rowIndex)) {
      this.doRowMultiSelect(row, rowIndex, evt);
     }
    } else {
     this.lastMultiSelectIndex = rowIndex;
    }
   }
  } finally {
   if(this.mainTableClickData.focusChanged && !this.mainTableClickData.selectionChanged) {
    this.gridCallBack(["FOCUSEDROW"]);
   } else if(this.mainTableClickData.selectionChanged) {
    this.gridCallBack(["SELECTION"]);
   }
   this.mainTableClickData.processing = false;
   this.mainTableClickData.focusChanged = false;
   this.mainTableClickData.selectionChanged = false;
  }
 },
 mainTableDblClick: function(evt) { this.getGridByRow(evt).mainTableDblClickCore(evt); },
 mainTableDblClickCore: function(evt) {
  var row = this.getRowByHtmlEvent(evt);
  if(_aspxIsExists(row)) {
   this.RaiseRowDblClick(this.getRowIndex(row.id), evt); 
  }
 },
 getGridByRow: function(rowEvt) {
  var row = this.getRowByHtmlEvent(rowEvt);
  if(!_aspxIsExists(row)) return this;
  var id = row.offsetParent.id;
  id = id.substr(0, id.length - this._constDXMainTable().length - 1);
  var table = aspxGetControlCollection().Get(id);
  return _aspxIsExists(table) ? table : this;
 },
 focusRow: function(row) {
  if(!_aspxIsExists(row)) return;
  var index = this.getRowIndex(row.id);
  this._setFocusedRowIndex(index);
 },
 _setFocusedRowIndex: function(visibleIndex) {
  if(visibleIndex < 0) visibleIndex = -1;
  if(!this.allowFocusedRow) return;
  var row = this.GetRow(visibleIndex);
  if(visibleIndex == this.focusedRowIndex) return;
  var oldFocusedRow = this.focusedRowIndex;
  this.focusedRowIndex = visibleIndex;
  this.ChangeRowStyle(oldFocusedRow, this._isRowSelected(oldFocusedRow) ? 0 : 3);
  if(this.focusedRowIndex > -1)
  if(row)
   this.ChangeRowStyle(this.focusedRowIndex, this._isGroupRow(row) ? 2 : 1);
  this._setFocusedRowInputValue();
  if(this.callbackOnFocusedRowChanged) {
   this.UpdatePostBackSyncInput({ isChangedNotification: true });
   if(!this.mainTableClickData.processing) {
    this.gridCallBack(["FOCUSEDROW"]);
   } else {
    this.mainTableClickData.focusChanged = true;
   }
   return;
  }
  this.RaiseFocusedRowChanged();
 },
 _setFocusedRowInputValue: function() {
  if(this.GetFocusedRowInput() != null) {
   this.GetFocusedRowInput().value = this.focusedRowIndex;
  }
 },
 _getFocusedRowIndex: function() {
  if(!this.allowFocusedRow) return -1;
  return this.focusedRowIndex;
 },
 getRowIndex: function(rowId) { return this._getNumberFromEndOfString(rowId); },
 _getNumberFromEndOfString: function(st) {
  var value = -1;
  var n = st.length - 1;
  while(parseInt(st.substr(n), 10) >= 0) {
   value = parseInt(st.substr(n), 10);
   n --;
  }
  return value;
 },
 GetSelectedState: function() {
  if(!this.userChangedSelection) return null;
  if(!_aspxIsExists(this.GetSelectionInput())) return null;
  return this.GetSelectionInput().value;
 },
 ChangeRowStyle: function(visibleIndex, rowStyle) {
  if(this._getFocusedRowIndex() == visibleIndex && rowStyle != 1 && rowStyle != 2) return;
  var row = this.GetRow(visibleIndex);
  if(!_aspxIsExists(row)) return;
  if(rowStyle == 0 && this._isGroupRow(row)) return; 
  var index = this._getRowIndexOnPage(visibleIndex);
  var styleRow = this._getStyleRow(index, rowStyle);
  if(!_aspxIsExists(styleRow)) return;
  row.className = styleRow.className;
  row.style.cssText = styleRow.style.cssText;
 },
 _getRowIndexOnPage: function(visibleIndex) { 
  return visibleIndex - this.visibleStartIndex; 
 },
 getColumnIndex: function(colId) { 
  if(colId.indexOf(this.EmptyHeaderSuffix) > -1) return 0;
  var index = this._getNumberFromEndOfString(colId); 
  return colId.indexOf("col" + index) > -1 ? index : -1;
 },
 getColumnObject: function(colId) {
  var index = this.getColumnIndex(colId);
  return index > -1 ? this._getColumn(index) : null;
 },
 _getColumnIndexByColumnArgs: function(column) {
  column = this._getColumnObjectByArg(column);
  if(!_aspxIsExists(column)) return null;
  return column.index;
 },
 _getColumnObjectByArg: function(arg) {
  if(!_aspxIsExists(arg)) return null;
  if(typeof(arg) == "number") return this._getColumn(arg);
  if(_aspxIsExists(arg.index)) return arg;
  var column = this._getColumnById(arg);
  if(_aspxIsExists(column)) return column;
  return this._getColumnByField(arg);  
 },
 _getColumnsCount: function() { return this.columns.length; },
 _getColumn: function(index) { 
  if(index < 0 || index >= this.columns.length) return null;
  return this.columns[index];
 },
 _getColumnById: function(id) {
  if(!_aspxIsExists(id)) return null;
  for(var i = 0; i < this.columns.length; i++) {
   if(this.columns[i].id == id) return this.columns[i];
  }
  return null;
 },
 _getColumnByField: function(fieldName) {
  if(!_aspxIsExists(fieldName)) return null;
  for(var i = 0; i < this.columns.length; i++) {
   if(this.columns[i].fieldName == fieldName) return this.columns[i];
  }
  return null;
 },
 _getStyleRow: function(index, rowStyle) {
  var styleTable = this.GetStyleTable();
  if(!_aspxIsExists(styleTable)) return null;
  if(rowStyle < 3) return styleTable.rows[rowStyle + 2];
  return styleTable.rows[5 + index];
 },
 DoSelectionChanged: function(index, isSelected, isSelectAllOnPage){
  if(this.callbackOnSelectionChanged) {
   this.UpdatePostBackSyncInput({ isChangedNotification: true });
   if(!this.mainTableClickData.processing) {
    this.gridCallBack(["SELECTION"]);
   } else {
    this.mainTableClickData.selectionChanged = true;
   }
   return;
  }
  this.RaiseSelectionChanged(index, isSelected, isSelectAllOnPage, false);
 },
 CommandCustomButton:function(id, index) {
  var processOnServer = true;
  if(!this.CustomButtonClick.IsEmpty()) {
   var e = new ASPxClientGridViewCustomButtonEventArgs(index, id);
   this.CustomButtonClick.FireEvent(this, e);
   processOnServer = e.processOnServer;
  }
  if(processOnServer)
   this.gridCallBack(["CUSTOMBUTTON", id, index]);
 },
 HeaderColumnResizing: function(e){
  var element = _aspxGetEventSource(e);
  if(!_aspxIsExists(element)) return;
  if(!_aspxIsExistsType(typeof(ASPxClientTableColumnResizing))) return;
  if(!_aspxIsExists(this.columnResizing)) {
   this.columnResizing = new ASPxClientTableColumnResizing(this, "DXMainTable", "DXHeaderTable", "DXFooterTable", this.isHorizontalScrolling);
   this.columnResizing.CanResizeLastColumn = this.isMainControlResizable;
  }
  this.columnResizing.UpdateCursor(element, e , this.indentColumnCount);
 },
 HeaderMouseDown: function(element, e){
  if(!_aspxGetIsLeftButtonPressed(e)) return;
  var source = _aspxGetEventSource(e);
  if(_aspxIsExists(source.onclick))
   return;
  if(this.startColumnResizing(element, e)) return;
  var column = this._getColumnObjectByArg(this.getColumnIndex(element.id));
  var dragCanceled = this.RaiseColumnStartDragging(column);
  var canDrag = !dragCanceled && this.canDragColumn(element) && source.tagName != "IMG";
  var drag = this.createDrag(e, element, canDrag);
  if(!canDrag && (e.shiftKey || e.ctrlKey))
   drag.clearSelectionOnce = true;
  this.createTargets(drag, e);
 },
 createDrag: function(e, element, canDrag) {
  var drag = new ASPxClientDragHelper(e, element, true);
  drag.canDrag = canDrag;
  drag.onDragDivCreating = this.DragDivCreating;
  drag.grid = this;
  drag.ctrl = aspxGetCtrlKey(e);
  drag.shift = aspxGetShiftKey(e);
  drag.onDoClick = this.headerDoClick;
  drag.onCloneCreating = this.cloneCreating;
  drag.onEndDrag = this.endDrag;
  drag.onCancelDrag = this.cancelDrag;
  return drag;
 }, 
 createTargets: function(drag, e) {
  if(!drag.canDrag) return;
  var targets = new ASPxClientCursorTargets();
  targets.obj = drag.obj;
  targets.grid = this;
  targets.onTargetChanging = this.targetChanging; 
  targets.onTargetChanged = this.targetChanged; 
  targets.onTargetAdding = this.targetAdding;
  var list = [
   "T-col", 
   "T-groupcol", 
   "_grouppanel",
   this.name + this.EmptyHeaderSuffix
  ];
  var win = this.GetCustomizationWindow();
  if(win)
   list.unshift(win.GetWindowClientTable(-1).id);      
  targets.RegisterTargets(this.GetRootTable(), list);
  targets.removeInitialTarget(e.clientX, e.clientY);
 },
 startColumnResizing: function(element, e) {
  if(!_aspxIsExists(this.columnResizing)) return false;
  if(!this.columnResizing.CanStartResizing(element, e, this.indentColumnCount)) return false;
  var columnIndex = this.getColumnIndex(element.id);
  var leftPartOfElement = (e.clientX - _aspxGetAbsoluteX(element)) < element.offsetWidth / 2;
  if (this.isMainControlResizable && leftPartOfElement) columnIndex--;
  var column = this._getColumnObjectByArg(columnIndex);
  if(this.RaiseColumnResizing(column)) return false;
  this.columnResizing.StartResizing(element, e, this.indentColumnCount, column);
  this.columnResizing.SetResizedInput(this.GetColResizedInput());
  if(this.isMainControlResizable) {
   this.columnResizing.SetResizableControl(this.GetRootTable());
  }
  return true;
 },
 DragDivCreating: function(drag, dragDiv) {
  var rootTable = drag.grid.GetRootTable();
  if(!_aspxIsExists(dragDiv) || !_aspxIsExists(rootTable)) return;
  dragDiv.className = rootTable.className;
  dragDiv.style.cssText = rootTable.style.cssText;
 },
 headerDoClick: function(drag) {
  if(!drag.grid.canSortByColumn(drag.obj)) return;
  var order = "";
  drag.grid.SortBy(drag.grid.getColumnIndex(drag.obj.id), drag.ctrl ? "NONE" : "", !drag.shift && !drag.ctrl);
 },
 cancelDrag: function(drag) {
  drag.grid.targetImagesChangeVisibility(false);
 },
 endDrag: function(drag) {
  if(drag.targetElement == null) return;
  var grid = drag.grid;  
  var column = grid.getColumnIndex(drag.obj.id);
  var id = drag.targetElement.id;
  var columnTo = grid.getColumnIndex(id);
  var isLeft = grid.IsRightToLeft() ? !drag.targetTag : drag.targetTag;
  grid.MoveColumn(column, columnTo, isLeft, grid.IsGroupingTarget(id), grid.IsGroupingTarget(drag.obj.id));
 },
 cloneCreating: function(clone) {
  var table = document.createElement("table");
  table.width = this.obj.offsetWidth + "px";
  var row = table.insertRow(-1);
  clone.style.borderLeftWidth = __aspxOpera ? "0px" : "";
  clone.style.borderTopWidth = "";
  clone.style.borderRightWidth = __aspxOpera ? "0px" : "";
  row.appendChild(clone);
  return table;
 },
 IsElementBelongsToGrid: function(elementId) {
  return elementId.indexOf(this.name + "_") == 0 && elementId.indexOf(this.name + "_dxdt") < 0;
 },
 targetChanging: function(targets) {
  targets.targetTag = targets.isLeftPartOfElement();
  var grid = targets.grid;
  var grouping = false;
  if(grid.IsTargetElementGroupPanel(targets)) {
   targets.targetTag = true;
   grouping = true;
  }
  if(grid.IsTargetElementGroupHeader(targets)) {
   grouping = true;
  }
  if(grouping && !grid.canGroupByColumn(targets.obj))
   targets.targetElement = null;
  if(targets.targetElement != null) {
   grid.RaiseColumnMoving(targets);
  }
 },
 targetAdding: function(targets, element) {
  var grid = targets.grid;
  if(!grid.IsElementBelongsToGrid(element.id)) return false;
  var hScrollCtrl =  grid.getHorzScrollableControl();
  if(!_aspxIsExists(hScrollCtrl)) return true;
  if(grid.getColumnIndex(element.id) < 0 || grid.IsGroupingTarget(element.id)) return true;
  var x1 = _aspxGetAbsoluteX(element);
  var x2 = _aspxGetAbsoluteX(hScrollCtrl);
  return x1 >= x2 && x1 + element.offsetWidth <= x2 + hScrollCtrl.offsetWidth;
 },
 IsTargetElementGroupPanel: function(targets) {
  return targets.targetElement != null && targets.targetElement.id.indexOf("_grouppanel") > -1;
 },
 IsTargetElementGroupHeader: function(targets) {
  return targets.targetElement != null && this.IsGroupingTarget(targets.targetElement.id);
 },
 targetChanged: function(targets) {
    if(__aspxDragHelper == null) return;
    if(targets.targetElement == __aspxDragHelper.obj) return;
    if(targets.targetElement != null) {
   __aspxDragHelper.targetElement = targets.targetElement;
   __aspxDragHelper.targetTag = targets.targetTag;
   var left = _aspxGetAbsoluteX(targets.targetElement);
   if(targets.targetTag == false) {
    left += targets.targetElement.offsetWidth;
   }
   targets.grid.setDragImagesPosition(targets.targetElement, left);
  } else {
   __aspxDragHelper.targetElement = null;
   targets.grid.targetImagesChangeVisibility(false);
  }
 },
 targetImagesChangeVisibility: function(vis) {
  if(this.GetArrowDragDownImage() == null) return;
  var value = vis ? "visible" : "hidden";
  this.GetArrowDragDownImage().style.visibility = value;
  this.GetArrowDragUpImage().style.visibility = value;
  if(__aspxDragHelper != null) {
   __aspxDragHelper.removeElementFromDragDiv();
  }
 },
 setDragImagesPosition: function(el, left) {
  this.targetImagesChangeVisibility(false);
  var win = this.GetCustomizationWindow();
  if(win && win.GetWindowClientTable(-1) == el) {
   __aspxDragHelper.addElementToDragDiv(this.GetArrowDragFieldImage());
  } else {
   left = _aspxPrepareClientPosForElement(left, this.GetArrowDragDownImage(), true);
   var top = _aspxPrepareClientPosForElement(_aspxGetAbsoluteY(el), this.GetArrowDragDownImage(), false);
   this.targetImagesChangeVisibility(true);
   if(this.GetArrowDragDownImage() != null) {
    this.GetArrowDragDownImage().style.left = left + "px";
    this.GetArrowDragUpImage().style.left = left + "px";
    this.GetArrowDragDownImage().style.top = (top - this.GetArrowDragDownImage().offsetHeight) + "px";
    this.GetArrowDragUpImage().style.top = (top + el.offsetHeight) + "px";
   }
  }
 },
 getCustomizationWindowElement: function() {
  if(this.GetCustomizationWindow() != null) 
   return this.GetCustomizationWindow().GetWindowElement(-1);
  return null;
 },
 OnParentRowMouseEnter: function(element) {
  if(this.GetParentRowsWindow() == null) return;
  if(this.GetParentRowsWindow().IsWindowVisible()) return;
  this.ParentRowsTimerId = _aspxSetTimeout("aspxGVParentRowsTimer(\""+this.name+"\", \"" + element.id + "\");", 500);
 },
 OnParentRowMouseLeave: function(evt) {
  if(_aspxIsExists(this.ParentRowsTimerId)) {
   _aspxClearTimer(this.ParentRowsTimerId);
  }
  if(this.GetParentRowsWindow() == null) return;
  if(_aspxIsExists(evt) && _aspxIsExists(evt.toElement)) {
   if(_aspxGetParentByPartialId(evt.toElement, this.GetParentRowsWindow().name) != null)
     return;
  }
  this.HideParentRows();
 },
 ShowParentRows: function(element) {
  this.ParentRowsTimerId = null;
  if(this.GetParentRowsWindow() != null) {
   this.GetParentRowsWindow().ShowAtElement(element);
  }
 },
 ShowFilterPopup: function(headerName, colIndex, htmlEvent) {
  if(this.filterPopupWindow == null) {
   this.filterPopupWindow = new ASPxClientPopupFilterWindow(this.name);
  }
  if(this.filterPopupWindow.IsShowing() && this.filterPopupActiveColumnIndex == colIndex) {
   this.HideFilterPopup();
   return;
  }
  this.filterPopupWindow.monitorWindowResizing = false;
  this.filterPopupWindow.Show(_aspxGetEventSource(htmlEvent), this.GetMainTable());
  this.filterPopupActiveColumnIndex = colIndex;
  this.gridFuncCallBack(["FILTERPOPUP", this.name, colIndex, (aspxGetShiftKey(htmlEvent) ? "T" : "")], this.onFilterPopupCallback);
  var content = this.GetFilterWindowContent();
  if(content != null) {
   content.innerHTML = "";
   var el = this.CreateLoadingPanelInsideContainer(content);
   _aspxRemoveBorders(el);
   var contentStyle = _aspxGetCurrentStyle(content);
   if(contentStyle != null) {
    _aspxSetBackground(el, contentStyle.backgroundColor);
   }
  }
 },
 HideFilterPopup: function() {
  if(this.filterPopupWindow == null) return;
  this.filterPopupWindow.Hide();
  this.filterPopupWindow = null;
  this.filterPopupActiveColumnIndex = -1;
 },
 onFilterItemOver: function(row) {
  row.oldclassName = row.className;
  row.oldcssText = row.style.cssText;
  var table = row.offsetParent;
  var selRow = table.rows[table.rows.length - 1];
  row.className = selRow.className;
  row.style.cssText = selRow.style.cssText;
 }, 
 onFilterItemOut: function(row) {
  row.className = row.oldclassName;
  row.style.cssText = row.oldcssText;
 }, 
 onFilterPopupCallback: function(values) {
  var grid = aspxGetControlCollection().Get(values[0]);
  if(grid == null) return;
  var fwContent = grid.GetFilterWindowContent();
  if(fwContent == null) return;
  _aspxSetInnerHtml(fwContent, values[1]);
  grid.CorrectFilterPopupPosition();
  grid.filterPopupWindow.monitorWindowResizing = true;
 },
 CorrectFilterPopupPosition: function() {
  if(!this.filterPopupWindow) return;  
  var win = this.filterPopupWindow.GetWindow();
  var left = win.offsetLeft;  
  win.style.left = "0px";  
  var width = win.offsetWidth;  
  var docWidth = _aspxGetDocumentClientWidth() + _aspxGetDocumentScrollLeft();
  var overhead = width - docWidth + left;
  if(overhead > 0) {
   left -= overhead;  
   if(left < 0) left = 0;
  }
  win.style.left = left + "px";
 },
 HideParentRows: function() {
  this.ParentRowsTimerId = null;
  if(this.GetParentRowsWindow() != null) {
   this.GetParentRowsWindow().Hide();
  }
 },
 getColumnOptions: function(id) {
  id = id.substr(this.name.length);
  if(id.indexOf(this.CustomizationWindowSuffix) == 0)
   id = id.substr(this.CustomizationWindowSuffix.length);
  var prefix = "_DX-";
  if(id.indexOf(prefix) != 0) 
   return "";
  var start = prefix.length;
  var stop = id.indexOf("-", start);
  return id.substring(start, stop);
 }, 
 canSortByColumn: function(headerElement) {
  return this.getColumnOptions(headerElement.id).indexOf("S") > -1;
 },
 canGroupByColumn: function(headerElement) {
  return this.getColumnOptions(headerElement.id).indexOf("G") > -1;
 },
 canDragColumn: function(headerElement) {
  return this.getColumnOptions(headerElement.id).indexOf("D") > -1;
 },
 doPagerOnClick: function(id) {
  if(!_aspxIsExists(id)) return;
  this.UpdatePostBackSyncInput({ isPagerClick: true });
  this.gridCallBack(["PAGERONCLICK", id]);
 },
 OnColumnFilterInputChanged: function(editor) {
  this.ApplyColumnAutoFilterCore(editor);
 },
 OnColumnFilterInputSpecKeyPress: function(editor, e) {
  if(_aspxIsExists(e.htmlEvent)) e = e.htmlEvent;
  if(e.keyCode == ASPxKey.Enter) {
   _aspxPreventEventAndBubble(e);
   editor.Validate();
   this.ApplyColumnAutoFilterCore(editor);
   return;
  }
  if(e.keyCode == ASPxKey.Delete && e.ctrlKey) {
   _aspxPreventEventAndBubble(e);
   editor.SetValue(null);
   this.ApplyColumnAutoFilterCore(editor);
   return;
  }
 },
 OnColumnFilterInputKeyPress: function(editor, e) {
  this.OnColumnFilterInputSpecKeyPress(editor, e);
  if(_aspxIsExists(e.htmlEvent)) e = e.htmlEvent;
  if(e.keyCode == ASPxKey.Tab || e.keyCode == ASPxKey.Enter) return;
  if(e.keyCode == ASPxKey.Delete && e.ctrlKey) return;
  this.ClearAutoFilterInputTimer();
  if(editor != this.FilterKeyPressEditor) {
   this.filterKeyPressInputValue = editor.GetValueString();
  }
  this.FilterKeyPressEditor = editor;
  this.filterKeyPressTimerId = _aspxSetTimeout("aspxGVTimer(\""+this.name+"\");", this.autoFilterDelay);
 },
 ClearAutoFilterInputTimer: function() {
  this.filterKeyPressTimerId = _aspxClearTimer(this.filterKeyPressTimerId);
 },
 GetAutoFilterEditorInputElement: function(editor) {
  if(_aspxIsExists(document.activeElement)) return document.activeElement;
  if(_aspxIsExists(editor.GetInputElement)) return editor.GetInputElement();
  return null;
 },
 OnFilterKeyPressTick: function() {
  if(_aspxIsExists(this.FilterKeyPressEditor)) {
   this.ApplyColumnAutoFilterCore(this.FilterKeyPressEditor);
  }
 },
 ApplyColumnAutoFilterCore: function(editor) {
  if(this.lockFilter) return;
  this.ClearAutoFilterInputTimer();
  if(_aspxIsExists(this.FilterKeyPressEditor) && editor == this.FilterKeyPressEditor) {
   if(this.FilterKeyPressEditor.GetValueString() == this.filterKeyPressInputValue) return;
  }
  var column = this.getColumnIndex(editor.name);
  if(column < 0) return;
  this.activeElement = this.GetAutoFilterEditorInputElement(editor);
  this.AutoFilterByColumn(column, editor.GetValueString());
 },
 FilterRowMenuButtonClick: function(columnIndex, element) {
  var menu = this.GetFilterRowMenu();
  if(!menu) return;
  var column = this._getColumn(columnIndex);
  if(!column) return;
  for(var i = menu.GetItemCount() - 1; i >= 0; i--) {
   var item = menu.GetItem(i);
   item.SetChecked(item.name.substr(0, item.name.indexOf("|")) == this.filterRowConditions[columnIndex])
   item.SetVisible(this.GetFilterRowMenuItemVisible(item, column));
  }
  menu.ShowAtElement(element);
  this.filterRowMenuColumnIndex = columnIndex;
 },
 GetFilterRowMenuItemVisible: function(item, column) {
  if(column.filterRowTypeKind)
   return item.name.indexOf(column.filterRowTypeKind) > -1;
  return false;
 },
 FilterRowMenuItemClick: function(item) {
  var itemName = item.name.substr(0, item.name.indexOf("|"));
  this.gridCallBack(["FILTERROWMENU", this.filterRowMenuColumnIndex, itemName]);
 },
 ShowLoadingPanel: function() {
  var content = this.GetGridTD();
  if(content == null) return;
  this.CreateLoadingDiv(content);
  var lpContainer = this.GetLoadingPanelContainer();
  if(lpContainer == null)
   this.CreateLoadingPanelWithAbsolutePosition(content);
  else
   this.CreateLoadingPanelInline(lpContainer);
 },
 _updateEdit: function() {
  if(window.ASPxClientEdit && !ASPxClientEdit.ValidateEditorsInContainer(this.GetEditFormTable(), this.name))
   return;
  var list = this._getEditors();
  if(list.length != 0) {
   if(!this._validate(list)) return;
  }
  this.gridCallBack(["UPDATEEDIT"]);
 },
 _validate: function(list) {
  var isValid = true;
  var firstInvalid = null;
  var edit;
  for(var i = 0; i < list.length; i ++) {
   edit = list[i];
   edit.Validate();
   isValid = edit.GetIsValid() && isValid;
   if(firstInvalid == null && edit.setFocusOnError && !edit.GetIsValid())
    firstInvalid = edit;
  }
  if (firstInvalid != null)
   firstInvalid.Focus();
  return isValid;
 },
 _getEditors: function() {
  var list = [ ];
  for(var i = 0; i < this.editorIDList.length; i++) {
   var editor = aspxGetControlCollection().Get(this.editorIDList[i]);
   if(editor && editor.GetMainElement && _aspxIsExistsElement(editor.GetMainElement())) {
    if(!_aspxIsExists(editor.Validate)) continue; 
    list.push(editor);
   }
  }
  return list;
 },
 GetEditorValues: function() {
  var list = this._getEditors();
  if(list.length == 0) return null;
  var res = list.length + ";";
  for(var i = 0; i < list.length; i ++) {
   res += this.GetEditorValue(list[i]);
  }
  return res;
 },
 GetEditorValue: function(editor) {
  var value = editor.GetValueString();
  var valueLength = -1;
  if(!_aspxIsExists(value)) {
   value = "";
  } else {
   value = value.toString();
   valueLength = value.length;
  }
  return this.GetEditorIndex(editor.name) + "," + valueLength + "," + value + ";";
 },
 GetEditorIndex: function(editorId) {
  var i = editorId.lastIndexOf(this.GetEditorPrefix());
  if(i < 0) return -1;
  return editorId.substr(i + this.GetEditorPrefix().length);
 },
 GetHorzScrollbarOwner: function() {
  if(this.fixedColumnCount > 0)
   return this.GetFixedColumnsDiv();
  return this.getHorzScrollableControl();
 },
 updateVirtualMarginBottom: function() {
  if(this.pageIndex < 0)
   return;
   var table = this.GetMainTable();
  var parent = table.parentNode;
  var margin = null;
  for(var i = parent.childNodes.length - 1; i >= 0; i --){
   margin = parent.childNodes[i];
   if(_aspxIsExists(margin.offsetHeight)) break;
  }
  if(margin == this.GetMainTable()) return;
  var requiredHeight = this.getScrollableControl().offsetHeight - table.offsetHeight;
  if(margin.offsetHeight < requiredHeight)
   margin.style.height = requiredHeight + "px";
 },
 getVirtualScrollMarginTop: function() {
  var parent = this.GetMainTable().parentNode;
  var margin = null;
  for(var i = 0; i < parent.childNodes.length; i ++) {
   margin = parent.childNodes[i];
   if(_aspxIsExists(margin.offsetHeight)) break;
  }
  if(margin == this.GetMainTable()) return 0;
  return margin.offsetHeight;
 },
 setOnVirtualScroll: function() {
  if(this.virtualScrollRowHeight <= 0) return;
  this.getScrollableControl().grid = this;
  _aspxAttachEventToElement(this.getScrollableControl(), "scroll", this.OnVirtualScroll);
  this.savedVirtualScroll = this.getVertScrollPosition();
 },
 OnVirtualScroll: function(event) {
  var src = _aspxGetEventSource(event);
  var grid = src.grid;
  _aspxClearTimer(grid.virtualScrollTimerId);
  grid.virtualScrollTimerId = _aspxSetTimeout("aspxGVVirtualScrollCore(\""+grid.name+"\");", 1000);
 },
 getVertScrollPosition: function() { return this.getScrollPosition(this.getScrollableControl(), true);  },
 getScrollPosition: function(scrollableDiv, isTop) {
  if(!_aspxIsExists(scrollableDiv)) return 0;
  return isTop ? scrollableDiv.scrollTop : scrollableDiv.scrollLeft;
 },
 setScrollPosition: function(scrollableDiv, newScrolPos, isTop) {
  if(newScrolPos < 0) return;
  if(!_aspxIsExists(scrollableDiv)) return;
  this.lockVirtualScrolling = true;
  try {
   if(isTop) {
    scrollableDiv.scrollTop = newScrolPos;
    var popup = this.GetPopupEditForm();
    if(popup)
     popup.UpdatePosition();       
   } else {
    scrollableDiv.scrollLeft = newScrolPos;
   }
  } finally {
   this.lockVirtualScrolling = false;
  }
 },
 getScrollableControl: function() {
  if(!this.isVerticalScrolling) return null;
  return this.GetMainTable().parentNode;
 },
 getHorzScrollableControl: function() {
  return this.isVerticalScrolling ? this.getScrollableControl() : this.GetHorzScrollDiv();
 },
 getScrollableHelper: function() {
  if(!this.isVerticalScrolling) return null;
  if(!_aspxIsExists(this.scrollableHelper)) {
   this.scrollableHelper = new ASPxClientTableScrollerHelper(this, "DXMainTable", "DXHeaderTable", "DXFooterTable", this.isHorizontalScrolling);
   if(_aspxIsExists(this.isWidthTypePercent)) {
    this.scrollableHelper.IsWidthTypePercent = true;
   }
  }
  return this.scrollableHelper;
 },
 VirtualScroll: function() {
  if(this.lockVirtualScrolling) return;
  var pos = this.getVertScrollPosition();
  if(pos == this.savedVirtualScroll) return;
  this.savedVirtualScroll = pos;
  if(this.isVirtualScrollOutOfCurPage()){
   var index = this.getVirtualPageIndex();   
   if(index != this.pageIndex) {
    _aspxDetachEventFromElement(this.getScrollableControl(), "scroll", this.OnVirtualScroll);
    this.GotoPage(index);
   }
  }
 },
 isVirtualScrollOutOfCurPage: function() {
  var marginTop = this.getVirtualScrollMarginTop();
  return marginTop - this.savedVirtualScroll > 0
   ||  this.savedVirtualScroll + this.getScrollableControl().clientHeight - marginTop - this.GetMainTable().clientHeight > 0;
 },
 getVirtualPageIndex: function() {
  var marginTop = this.getVirtualScrollMarginTop();
  var rowIndex;
  if(this.savedVirtualScroll < marginTop) {
   rowIndex = this.savedVirtualScroll / this.virtualScrollRowHeight;
  } else {
   rowIndex = this.visibleStartIndex + this.pageRowCount + (this.savedVirtualScroll - marginTop) / this.virtualScrollRowHeight;
  }
  return Math.floor(rowIndex / this.pageRowSize);
 },
 getFixedColumnsHelper: function() {
  if(!_aspxIsExists(this.GetFixedColumnsDiv())) return null;
  if(!_aspxIsExists(this.fixedColumnsHelper)) {
   this.fixedColumnsHelper = new ASPxClientTableFixedColumnsHelper(this, 
   "DXMainTable", "DXHeaderTable", "DXFooterTable", "DXFixedColumnsDiv", "DXFixedColumnsContentDiv", 
   this.fixedColumnCount, this.GetRootTable().offsetWidth);
  }
  return this.fixedColumnsHelper;
 },
 UpdateVerticalScrollControls: function() {
  var helper = this.getScrollableHelper();
  if(helper == null) return;
  helper.SetOnScroll();
  helper.CorrectHeaderFooterColsWidth(false);
 },
 SetHeadersClientEvents: function() {
  var row = this.GetHeadersRow();
  if(row == null) return;
  for(var i = 0; i < row.cells.length; i ++) {
   if(this.isColumnsResizable) {
    _aspxAttachEventToElement(row.cells[i], "mousemove", new Function("event", "aspxGVHeaderColumnResizing('" + this.name + "', event);"));
   }
  }
 },
 UpdateHorzScrollDivs: function(onResize) {
  if(onResize && this.fixedColumnCount > 0) return;
  var divs = this.GetHorzScrollDivs();
  if(divs.length > 0) {
   var table = this.GetRootTable();
   if(ASPxClientGridView.IsOriginalWidthPercentage(table)) {    
    for(var i = 0; i < divs.length; i++)
     divs[i].style.width = "1px";
    ASPxClientGridView.ResetElementWidth(table);
   }
   var divWidth = table.offsetWidth - _aspxGetLeftRightBordersAndPaddingsSummaryValue(table);
   if(divWidth < 0) divWidth = 0;
   for(var i = 0; i < divs.length; i++)
    divs[i].style.width = divWidth + "px";
  }
  if(this.getFixedColumnsHelper() != null) {
   this.SetFixedColumnsStrayScrollHandler();
   this.getFixedColumnsHelper().Update();
  }
 },
 SetFixedColumnsStrayScrollHandler: function() {
  var div = this.getHorzScrollableControl();
  var grid = this;
  if(this.fixedColumnsStrayScrollHandler != null)
   _aspxDetachEventFromElement(div, "scroll", this.fixedColumnsStrayScrollHandler);
  this.fixedColumnsStrayScrollHandler = function(){
   grid.getHorzScrollableControl().scrollLeft = 0;
  };
  _aspxAttachEventToElement(div, "scroll", this.fixedColumnsStrayScrollHandler);  
 },
 GetHorzScrollDivs: function() {
  var divs = [ this.GetHorzScrollDiv(), this.GetFixedColumnsDiv() ];
  var result = [ ];
  for(var i = 0; i < divs.length; i++) {
   if(!_aspxIsExistsElement(divs[i])) continue;
   result.push(divs[i]);
  }
  return result;
 },
 UpdatePostBackSyncInput: function(flags) {
  var input = this.GetPostBackSyncInput();
  if(!input) return;
  input.value = [ 
   (flags && flags.isPagerClick) ? 0 : this.getVertScrollPosition(),   
   this.getScrollPosition(this.GetHorzScrollbarOwner(), false),    
   (flags && flags.isChangedNotification) ? -1 : this.lastMultiSelectIndex  
  ].join(" ");
 },
 ApplyPostBackSyncData: function() {
  var input = this.GetPostBackSyncInput();
  var instance = this;
  var vertScrollPos = -1;
  var horzScrollPos = -1;
  if(input && input.value.length > 0) {
   var list = input.value.split(" ");  
   vertScrollPos = Number(list[0]);
   horzScrollPos = Number(list[1]);
   this.lastMultiSelectIndex = Number(list[2]);
  }
  var newRowVertScrollPos = this.GetNewRowVertScrollPos();
  if(newRowVertScrollPos > -1)
   vertScrollPos = newRowVertScrollPos;
  if(this.virtualScrollRowHeight <= 0 && !this.doScrollToRowIndex() && vertScrollPos > -1)
    this.setScrollPosition(this.getScrollableControl(), vertScrollPos, true);   
  if(horzScrollPos > -1)
    window.setTimeout(function() { instance.setScrollPosition(instance.GetHorzScrollbarOwner(), horzScrollPos, false) }, 0);
  if(this.virtualScrollRowHeight > 0) {
   this.updateVirtualMarginBottom();
   this.setScrollPosition(this.getScrollableControl(), this.getVirtualScrollMarginTop(), true);
   window.setTimeout(function() { instance.setOnVirtualScroll() }, 0);
  }      
 },
 GetNewRowVertScrollPos: function() {
  if(this.IsNewRowEditing()) {
   var row = this.GetEditingRow(this);
   if(row)
    return !this.IsNewRowAtBottom() ? 0 : 0x1fffffff;
  }
  return -1;
 },
 doScrollToRowIndex: function() {
  if(this.scrollToRowIndex < 0) return false;
  this.MakeRowVisible(this.scrollToRowIndex);
  this.scrollToRowIndex = -1;
  return true;
 },
 ToggleScrollPosLogger: function(active) {
  var elements = [ ];
  var horzOwner = this.GetHorzScrollbarOwner();
  var vertOwner = this.getScrollableControl();
  if(horzOwner)
   elements.push(horzOwner);
  if(horzOwner && vertOwner && horzOwner != vertOwner)
   elements.push(vertOwner);
  for(var i = 0; i < elements.length; i++) {      
   if(this.scrollPosLogger != null)
    _aspxDetachEventFromElement(elements[i], "scroll", this.scrollPosLogger);
   if(active) {   
    var instance = this; 
    _aspxAttachEventToElement(elements[i], "scroll", function() {
     instance.UpdatePostBackSyncInput();
    });
   }
  }
 },
 EnsureRowHotTrackItems: function() {
  if(this.rowHotTrackStyle == null) return;
  var list = [ ];
  for(var i = 0; i < this.pageRowCount; i++) {
   var index = i + this.visibleStartIndex;
   if(this.rowHotTrackItemsBag[index]) continue;
   list.push(this._constDXDataRow() + index);
   this.rowHotTrackItemsBag[index] = true;
  }
  if(list.length > 0) {
   aspxAddHoverItems(this.name, [
    [ 
     [this.rowHotTrackStyle[0]], 
     [this.rowHotTrackStyle[1]], 
     list
    ]
   ]);
  }
 },
 PerformCallback: function(args){
  if(!_aspxIsExists(args)) args = "";
  this.gridCallBack(["CUSTOMCALLBACK", args]);
 },
 GetValuesOnCustomCallback: function(args, onCallBack) {
  this.gridFuncCallBack(["CUSTOMVALUES", args], onCallBack);
 },
 GotoPage: function(pageIndex){
  this.gridCallBack(["GOTOPAGE", pageIndex]);
 },
 GetPageIndex: function(){
  return this.pageIndex;
 },
 GetPageCount: function(){
  return this.pageCount;
 },
 NextPage: function(){
  this.gridCallBack(["NEXTPAGE"]);
 },
 PrevPage: function(){
  this.gridCallBack(["PREVPAGE"]);
 },
 UnGroup: function(column){
  column = this._getColumnIndexByColumnArgs(column);
  this.GroupBy(column, -1);
 },
 ExpandAll: function(){
  this.gridCallBack(["EXPANDALL"]);
 },
 CollapseAll: function(){
  this.gridCallBack(["COLLAPSEALL"]);
 },
 ExpandAllDetailRows: function(){
  this.gridCallBack(["SHOWALLDETAIL"]);
 },
 CollapseAllDetailRows: function(){
  this.gridCallBack(["HIDEALLDETAIL"]);
 },
 ExpandRow: function(visibleIndex, recursive){
  if(this.RaiseRowExpanding(visibleIndex)) return;
  if(!_aspxIsExists(recursive)) recursive = false;
  this.gridCallBack(["EXPANDROW", visibleIndex, recursive]);
 },
 CollapseRow: function(visibleIndex, recursive){
  if(this.RaiseRowCollapsing(visibleIndex)) return;
  if(!_aspxIsExists(recursive)) recursive = false;
  this.gridCallBack(["COLLAPSEROW", visibleIndex, recursive]);
 },
 MakeRowVisible: function(visibleIndex) {
  var row = this.GetRow(visibleIndex);
  if(row == null && visibleIndex >= this.visibleStartIndex 
   && visibleIndex < this.visibleStartIndex + this.pageRowCount) {
   row = this.GetEditingRow(this);
  }
  var helper = this.getScrollableHelper();
  if(helper == null || row == null) return;
  helper.MakeRowVisible(row);
 },
 ExpandDetailRow: function(visibleIndex){
  if(this.RaiseDetailRowExpanding(visibleIndex)) return;
  this.gridCallBack(["SHOWDETAILROW", visibleIndex]);
 },
 CollapseDetailRow: function(visibleIndex){
  if(this.RaiseDetailRowCollapsing(visibleIndex)) return;
  this.gridCallBack(["HIDEDETAILROW", visibleIndex]);
 },
 GetRowKey: function(visibleIndex) {
  var arrayIndex = visibleIndex - this.visibleStartIndex;
  if (arrayIndex < 0 || arrayIndex > this.keys.length - 1) return null;
  return this.keys[arrayIndex];
 },   
 StartEditRow: function(visibleIndex) {
  var key = this.GetRowKey(visibleIndex);
  if(key != null)
   this.StartEditRowByKey(key);
 },
 StartEditRowByKey: function(key) {
  this.gridCallBack(["STARTEDIT", key]);
 },
 IsEditing: function() {
  return this.editState > 0;
 },
 IsNewRowEditing: function() {
  return this.editState > 1;
 },
 IsNewRowAtBottom: function() {
  return this.editState == 3;
 },
 UpdateEdit: function(){
  this._updateEdit();
 },
 CancelEdit: function(){
  this.gridCallBack(["CANCELEDIT"]);
 },
 AddNewRow: function(){
  this.gridCallBack(["ADDNEWROW"]);
 },
 DeleteRow: function(visibleIndex){
  var key = this.GetRowKey(visibleIndex);
  if(key != null)
   this.DeleteRowByKey(key);
 },
 DeleteRowByKey: function(key) {
  this.gridCallBack(["DELETEROW", key]);
 },
 Refresh: function(){
  this.gridCallBack(["REFRESH"]);
 },
 ApplyFilter: function(expression){
  if(!_aspxIsExists(expression)) expression = "";
  this.gridCallBack(["APPLYFILTER", expression]);
 },
 ClearFilter: function(){
  this.ApplyFilter();
 },
 GetAutoFilterEditor: function(column) { 
  column = this._getColumnIndexByColumnArgs(column);
  if(!_aspxIsExists(column)) return null;
  return aspxGetControlCollection().Get(this.name + "_DXFREditorcol" + column);
 },
 AutoFilterByColumn: function(column,val){
  column = this._getColumnIndexByColumnArgs(column);
  if(!_aspxIsExists(column)) return;
  if(!_aspxIsExists(val)) val = "";
  if(val.length > 255) val = val.substr(0, 255);
  this.gridCallBack(["APPLYCOLUMNFILTER", column, val]);
 },
 ApplyHeaderFilterByColumn: function(column,val){
  column = this._getColumnIndexByColumnArgs(column);
  if(!_aspxIsExists(column)) return;
  if(!_aspxIsExists(val)) val = "";
  if(val.length > 500) val = val.substr(0, 500);
  this.gridCallBack(["APPLYHEADERCOLUMNFILTER", column, val]);
 },
 GroupBy: function(column, groupIndex, sortOrder){
  if(this.RaiseColumnGrouping(this._getColumnObjectByArg(column))) return;
  column = this._getColumnIndexByColumnArgs(column);
  if(!_aspxIsExists(groupIndex)) groupIndex = "";
  if(!_aspxIsExists(sortOrder)) sortOrder = "ASC";
  this.gridCallBack(["GROUP", column, groupIndex, sortOrder]);
 },
 SortBy: function(column, sortOrder, reset, sortIndex){
  if(this.RaiseColumnSorting(this._getColumnObjectByArg(column))) return;
  column = this._getColumnIndexByColumnArgs(column);
  if(!_aspxIsExists(sortIndex)) sortIndex = "";
  if(!_aspxIsExists(sortOrder)) sortOrder = "";
  if(!_aspxIsExists(reset)) reset = true;
  this.gridCallBack(["SORT", column, sortIndex, sortOrder, reset]);
 },
 MoveColumn: function(column, columnMoveTo, moveBefore, moveToGroup, moveFromGroup){
  if(!_aspxIsExists(column)) return;
  if(!_aspxIsExists(columnMoveTo)) columnMoveTo = -1;
  if(!_aspxIsExists(moveBefore)) moveBefore = true;
  if(!_aspxIsExists(moveToGroup)) moveToGroup = false;
  if(!_aspxIsExists(moveFromGroup)) moveFromGroup = false;
  if(moveToGroup) {
   if(this.RaiseColumnGrouping(this._getColumnObjectByArg(column))) return;
  }
  column = this._getColumnIndexByColumnArgs(column);
  this.gridCallBack(["COLUMNMOVE", column, columnMoveTo, moveBefore, moveToGroup, moveFromGroup]);
 },
 GetFocusedRowIndex: function() {
  return this._getFocusedRowIndex();
 },
 SetFocusedRowIndex: function(visibleIndex) {
  return this._setFocusedRowIndex(visibleIndex);
 },
 IsCustomizationWindowVisible: function(){
  var custWindow = this.GetCustomizationWindow();
  return custWindow != null && custWindow.IsVisible();
 },
 ShowCustomizationWindow: function(showAtElement){
  var custWindow = this.GetCustomizationWindow();
  if(!_aspxIsExists(showAtElement)) showAtElement = this.GetMainElement();
  custWindow.ShowAtElement(showAtElement);
 },
 HideCustomizationWindow: function(){
  var custWindow = this.GetCustomizationWindow();
  if(custWindow != null) custWindow.Hide();
 },
 SelectRows: function(visibleIndices, selected){
  if(!_aspxIsExists(selected)) selected = true;
  if(!_aspxIsExists(visibleIndices)) {
   selected = selected ? "all" : "unall";
   visibleIndices = [0];
  } else {
   if(visibleIndices.constructor != Array)
    visibleIndices = [visibleIndices];
  }
  this.gridCallBack(["SELECTROWS", selected].concat(visibleIndices));
 },
 SelectRowsByKey: function(keys, selected){
  if(!_aspxIsExists(selected)) selected = true;
  if(!_aspxIsExists(keys)) return;
  if(keys.constructor != Array)
   keys = [keys];
  this.gridCallBack(["SELECTROWSKEY", selected].concat(keys));
 },
 UnselectRowsByKey: function(keys){
  this.SelectRowsByKey(keys, false);
 },
 UnselectRows: function(visibleIndices){
  this.SelectRows(visibleIndices, false);
 },
 SelectRowOnPage: function(visibleIndex, selected){
  if(!_aspxIsExists(selected)) selected = true;
  this.SelectRow(visibleIndex, selected);
 },
 UnselectRowOnPage: function(visibleIndex){
  this.SelectRowOnPage(visibleIndex, false);
 },
 SelectAllRowsOnPage: function(selected){
  if(!_aspxIsExists(selected)) selected = true;
  this._selectAllRowsOnPage(selected);
 },
 UnselectAllRowsOnPage: function(){
  this._selectAllRowsOnPage(false);
 },
 GetSelectedRowCount: function() {
  return this._getSelectedRowCount();
 },
 GetSelectedFieldValues: function(fieldNames, onCallBack) {
  this.gridFuncCallBack(["SELFIELDVALUES", fieldNames], onCallBack);
 },
 GetSelectedKeysOnPage: function() {
  var keys = [];
  for(var i = 0; i < this.pageRowCount; i++) {
   if(this._isRowSelected(this.visibleStartIndex + i))
    keys.push(this.keys[i]);
  }
  return keys; 
 },
 IsRowSelectedOnPage: function(visibleIndex) {
  return this._isRowSelected(visibleIndex);
 },
 GetRowValues: function(visibleIndex, fieldNames, onCallBack) {
  this.gridFuncCallBack(["ROWVALUES", visibleIndex, fieldNames], onCallBack);
 },
 GetPageRowValues: function(fieldNames, onCallBack) {
  this.gridFuncCallBack(["PAGEROWVALUES", fieldNames], onCallBack);
 },
 GetVisibleRowsOnPage: function() {
  return this.pageRowCount;
 },
 GetTopVisibleIndex: function() {
  return this.visibleStartIndex;
 },
 IsGroupRow: function(visibleIndex) {
  return this.GetGroupRow(visibleIndex) != null;
 },
 IsDataRow: function(visibleIndex) {
  return this.GetDataRow(visibleIndex) != null;
 },
 IsGroupRowExpanded: function(visibleIndex) { 
  return this.GetExpandedGroupRow(visibleIndex) != null;
 },
 GetColumnsCount: function() {
  return this._getColumnsCount();
 },
 GetColumn: function(index) {
  return this._getColumn(index);
 },
 GetColumnById: function(id) {
  return this._getColumnById(id);
 },
 GetColumnByField: function(fieldName) {
  return this._getColumnByField(fieldName);
 },
 GetEditor: function(column) {
  var columnObject = this._getColumnObjectByArg(column);
  return columnObject != null ? this.GetEditorByColumnIndex(columnObject.index) : null;
 },
 FocusEditor: function(column) {
  var editor = this.GetEditor(column);
  if(editor != null && _aspxIsExists(editor.SetFocus)) {
   editor.SetFocus();  
  }
 },
 GetEditValue: function(column) {
  var editor = this.GetEditor(column);
  return editor != null ? editor.GetValue() : null;
 },
 SetEditValue: function(column, value) {
  var editor = this.GetEditor(column);
  if(editor != null) {
   editor.SetValue(value);
  }
 },
 ShowFilterControl: function() {
  this.gridCallBack(["SHOWFILTERCONTROL"]);
 },
 CloseFilterControl: function() {
  this.HideFilterControlPopup();
  this.gridCallBack(["CLOSEFILTERCONTROL"]);
 },
 HideFilterControlPopup: function() {
  var popup = this.GetFilterControlPopup();
  if(popup) popup.Hide();
 },
 ApplyFilterControl: function() {
  var fc = this.GetFilterControl();
  if(fc == null) return;
  if(!this.callBacksEnabled)
   this.HideFilterControlPopup();
  fc.Apply(this);
 },
 SetFilterEnabled: function(isFilterEnabled) {
  this.gridCallBack(["SETFILTERENABLED", isFilterEnabled]);
 },
 SetWidth: function(width) {
  ASPxClientGridView.DropElementOriginalWidth(this.GetRootTable());
  this.constructor.prototype.SetWidth.call(this, width);
 },
 SetHeight: function(height) {
  var rootTable = this.GetRootTable();
  var scrollDiv = this.getScrollableControl();
  if(!_aspxIsExists(rootTable) || !_aspxIsExists(scrollDiv)) return;
  var scrollHeight = (scrollDiv.offsetHeight + (height - rootTable.offsetHeight));
  scrollDiv.style.height = scrollHeight + "px";
 },
 GetVertScrollPos: function() {
  if(this.virtualScrollRowHeight > 0) 
   return 0;
  return this.getScrollPosition(this.getScrollableControl(), true);
 },
 GetHorzScrollPos: function() {
  return this.getScrollPosition(this.GetHorzScrollbarOwner(), false);
 },
 SetVertScrollPos: function(value) {
  if(this.virtualScrollRowHeight > 0) return;
  this.setScrollPosition(this.getScrollableControl(), value, true);
 },
 SetHorzScrollPos: function(value) {
  this.setScrollPosition(this.GetHorzScrollbarOwner(), value, false);
 },
 RaiseSelectionChanged: function(visibleIndex, isSelected, isAllRecordsOnPage, isChangedOnServer) {
  if(!this.SelectionChanged.IsEmpty()){
   var args = new ASPxClientGridViewSelectionEventArgs(visibleIndex, isSelected, isAllRecordsOnPage, isChangedOnServer);
   this.SelectionChanged.FireEvent(this, args);
   if(args.processOnServer) {
    this.gridCallBack(["SELECTION"]);
   }
  }
  return false; 
 },
 RaiseFocusedRowChanged: function() {
  if(!this.FocusedRowChanged.IsEmpty()){
   var args = new ASPxClientProcessingModeEventArgs(false);
   this.FocusedRowChanged.FireEvent(this, args);
   if(args.processOnServer) {
    this.gridCallBack(["FOCUSEDROW"]);
   }
  }
  return false; 
 },
 RaiseColumnSorting: function(column) {
  if(!this.ColumnSorting.IsEmpty()){
   var args = new ASPxClientGridViewColumnCancelEventArgs(column);
   this.ColumnSorting.FireEvent(this, args);
   return args.cancel;
  }
  return false; 
 },
 RaiseColumnGrouping: function(column) {
  if(!this.ColumnGrouping.IsEmpty()){
   var args = new ASPxClientGridViewColumnCancelEventArgs(column);
   this.ColumnGrouping.FireEvent(this, args);
   return args.cancel;
  }
  return false; 
 },
 RaiseColumnStartDragging: function(column) {
  if(!this.ColumnStartDragging.IsEmpty()){
   var args = new ASPxClientGridViewColumnCancelEventArgs(column);
   this.ColumnStartDragging.FireEvent(this, args);
   return args.cancel;
  }
  return false; 
 },
 RaiseColumnResizing: function(column) {
  if(!this.ColumnResizing.IsEmpty()){
   var args = new ASPxClientGridViewColumnCancelEventArgs(column);
   this.ColumnResizing.FireEvent(this, args);
   return args.cancel;
  }
  return false; 
 },
 RaiseColumnResized: function(column) {
  if(!this.ColumnResized.IsEmpty()){
   var args = new ASPxClientGridViewColumnProcessingModeEventArgs(column);
   this.ColumnResized.FireEvent(this, args);
   if(args.processOnServer)
    this.Refresh();
  }
 },
 RaiseRowExpanding: function(visibleIndex) {
  if(!this.RowExpanding.IsEmpty()){
   var args = new ASPxClientGridViewRowCancelEventArgs(visibleIndex);
   this.RowExpanding.FireEvent(this, args);
   return args.cancel;
  }
  return false; 
 },
 RaiseRowCollapsing: function(visibleIndex) {
  if(!this.RowCollapsing.IsEmpty()){
   var args = new ASPxClientGridViewRowCancelEventArgs(visibleIndex);
   this.RowCollapsing.FireEvent(this, args);
   return args.cancel;
  }
  return false; 
 },
 RaiseDetailRowExpanding: function(visibleIndex) {
  if(!this.DetailRowExpanding.IsEmpty()){
   var args = new ASPxClientGridViewRowCancelEventArgs(visibleIndex);
   this.DetailRowExpanding.FireEvent(this, args);
   return args.cancel;
  }
  return false; 
 },
 RaiseDetailRowCollapsing: function(visibleIndex) {
  if(!this.DetailRowCollapsing.IsEmpty()){
   var args = new ASPxClientGridViewRowCancelEventArgs(visibleIndex);
   this.DetailRowCollapsing.FireEvent(this, args);
   return args.cancel;
  }
  return false; 
 },
 RaiseRowClick: function(visibleIndex, htmlEvent) {
  if(!this.RowClick.IsEmpty()){
   var args = new ASPxClientGridViewRowClickEventArgs(visibleIndex, htmlEvent);
   this.RowClick.FireEvent(this, args);
   return args.cancel;
  }
  return false; 
 },
 RaiseRowDblClick: function(visibleIndex, htmlEvent) {
  if(!this.RowDblClick.IsEmpty()){
   _aspxClearSelection(); 
   var args = new ASPxClientGridViewRowClickEventArgs(visibleIndex, htmlEvent);
   this.RowDblClick.FireEvent(this, args);
   return args.cancel;
  }
  return false; 
 },
 RaiseContextMenu: function(objectType, index, htmlEvent) {
  if(!this.ContextMenu.IsEmpty()){
   var args = new ASPxClientGridViewContextMenuEventArgs(objectType, index, htmlEvent);
   this.ContextMenu.FireEvent(this, args);
   return true;
  }
  return false; 
 },
 RaiseCustomizationWindowCloseUp: function() {
  if(!this.CustomizationWindowCloseUp.IsEmpty()){
   var args = new ASPxClientEventArgs();
   this.CustomizationWindowCloseUp.FireEvent(this, args);
  }
  return false; 
 },
 RaiseColumnMoving: function(targets) {
  if(this.ColumnMoving.IsEmpty()) return;
  var srcColumn = this.getColumnObject(targets.obj.id);
  var destColumn = this.getColumnObject(targets.targetElement.id);
  var isLeft = targets.isLeftPartOfElement();
  var isGroupPanel = this.IsTargetElementGroupPanel(targets);
  var args = new ASPxClientGridViewColumnMovingEventArgs(srcColumn, destColumn, isLeft, isGroupPanel);
  this.ColumnMoving.FireEvent(this, args);
  if(!args.allow) {
   targets.targetElement = null;
  }
 }
});
ASPxClientGridView.Cast = ASPxClientControl.Cast;
ASPxClientGridViewColumn = _aspxCreateClass(null, {
 constructor: function(name, index, fieldName, visible, filterRowTypeKind){
  this.name = name;
  this.id = name;
  this.index = index;
  this.fieldName = fieldName;
  this.visible = visible;
  this.filterRowTypeKind = filterRowTypeKind;
 }
});
ASPxClientGridViewColumnCancelEventArgs = _aspxCreateClass(ASPxClientCancelEventArgs, {
 constructor: function(column){
  this.constructor.prototype.constructor.call(this);
  this.column = column;
 }
});
ASPxClientGridViewColumnProcessingModeEventArgs = _aspxCreateClass(ASPxClientProcessingModeEventArgs, {
 constructor: function(column){
  this.constructor.prototype.constructor.call(this, false);
  this.column = column;
 }
});
ASPxClientGridViewRowCancelEventArgs = _aspxCreateClass(ASPxClientCancelEventArgs, {
 constructor: function(visibleIndex){
  this.constructor.prototype.constructor.call(this);
  this.visibleIndex = visibleIndex;
 }
});
ASPxClientGridViewSelectionEventArgs = _aspxCreateClass(ASPxClientProcessingModeEventArgs, {
 constructor: function(visibleIndex, isSelected, isAllRecordsOnPage, isChangedOnServer){
  this.constructor.prototype.constructor.call(this, false);
  this.visibleIndex = visibleIndex;
  this.isSelected = isSelected;
  this.isAllRecordsOnPage = isAllRecordsOnPage;
  this.isChangedOnServer = isChangedOnServer;
 }
});
ASPxClientGridViewRowClickEventArgs = _aspxCreateClass(ASPxClientGridViewRowCancelEventArgs, {
 constructor: function(visibleIndex, htmlEvent){
  this.constructor.prototype.constructor.call(this, visibleIndex);
  this.htmlEvent = htmlEvent;
 }
});
ASPxClientGridViewContextMenuEventArgs = _aspxCreateClass(ASPxClientEventArgs, {
 constructor: function(objectType, index, htmlEvent){
  this.constructor.prototype.constructor.call(this);
  this.objectType = objectType;
  this.index = index;
  this.htmlEvent = htmlEvent;
 }
});
ASPxClientGridViewCustomButtonEventArgs = _aspxCreateClass(ASPxClientProcessingModeEventArgs, {
 constructor: function(visibleIndex, buttonID) {
  this.constructor.prototype.constructor.call(this, false);
  this.visibleIndex = visibleIndex;
  this.buttonID = buttonID;
 } 
});
ASPxClientGridViewColumnMovingEventArgs = _aspxCreateClass(ASPxClientEventArgs, {
 constructor: function(sourceColumn, destinationColumn, isDropBefore, isGroupPanel) {
  this.constructor.prototype.constructor.call(this);
  this.allow = true;
  this.sourceColumn = sourceColumn;
  this.destinationColumn = destinationColumn;
  this.isDropBefore = isDropBefore;
  this.isGroupPanel = isGroupPanel;
 }
});
ASPxGridViewKbdHelper = _aspxCreateClass(ASPxKbdHelper, {
 HandleKeyDown: function(e) {  
  var grid = this.control;
  var index = grid.GetFocusedRowIndex();
  var busy = grid.keyboardLock;
  switch(_aspxGetKeyCode(e)) {  
   case ASPxKey.Down:
    if(!busy) 
     this.TryMoveFocusDown(index, e.shiftKey);
    return true;
   case ASPxKey.Up:
    if(!busy) 
     this.TryMoveFocusUp(index, e.shiftKey);
    return true;
   case ASPxKey.Right:
    if(!busy) {
     if(!this.TryExpand(index))
      this.TryMoveFocusDown(index, e.shiftKey);
    }
    return true;
   case ASPxKey.Left:
    if(!busy) {
     if(!this.TryCollapse(index))
      this.TryMoveFocusUp(index, e.shiftKey);
    }
    return true;
   case ASPxKey.PageDown:
    if(e.shiftKey) {
     if(!busy && grid.pageIndex < grid.pageCount - 1)
      grid.NextPage();
     return true; 
    }
    break;
   case ASPxKey.PageUp:
    if(e.shiftKey) {
     if(!busy && grid.pageIndex > 0)
      grid.PrevPage();
     return true; 
    }
    break;     
  }
  return false;
 },
 HandleKeyPress: function(e) {
  var grid = this.control;
  var index = grid.GetFocusedRowIndex();
  var busy = grid.keyboardLock;
  switch(_aspxGetKeyCode(e)) {
   case ASPxKey.Space:
    if(!busy && this.IsRowSelectable(index))
     grid.IsRowSelectedOnPage(index) ? grid.UnselectRowOnPage(index) : grid.SelectRowOnPage(index);
    return true;
    case 43:
    if(!busy)
     this.TryExpand(index);
    return true;
    case 45: 
    if(!busy)   
     this.TryCollapse(index);    
    return true;
  }
  return false;
 },
 EnsureFocusedRowVisible: function() {
  var grid = this.control;
  var container = grid.getScrollableControl();
  if(!container) return;
  var row = grid.GetRow(grid.GetFocusedRowIndex());
  if(!row) return;
  var rowTop = row.offsetTop;
  var rowHeight = row.offsetHeight;
  var containerHeight = container.clientHeight;
  if(rowTop < container.scrollTop) {
   container.scrollTop = rowTop;   
  } 
  else if(rowTop + rowHeight > container.scrollTop + containerHeight) {
   container.scrollTop = rowTop + rowHeight - containerHeight;   
  }
 },
 HasDetailButton: function(expanded) {
  var grid = this.control;
  var row = grid.GetRow(grid.GetFocusedRowIndex());
  if(!row) return;
  var needle = expanded ? "aspxGVHideDetailRow" : "aspxGVShowDetailRow";
  return row.innerHTML.indexOf(needle) > -1;
 },
 IsRowSelectable: function(index) {
  return this.control.allowMultiSelection || this.control.GetRow(index).innerHTML.indexOf("aspxGVSelectRow") > -1;
 },
 UpdateShiftSelection: function(start, end) {
  var grid = this.control;
  grid.UnselectAllRowsOnPage();
  if(grid.lastMultiSelectIndex > -1)   
   start = grid.lastMultiSelectIndex;
  else   
   grid.lastMultiSelectIndex = start;
  for(var i = Math.min(start, end); i <= Math.max(start, end); i++)
   grid.SelectRowOnPage(i);
 },
 TryExpand: function(index) {
  var grid = this.control;
  if(grid.IsGroupRow(index) && !grid.IsGroupRowExpanded(index)) {
   grid.ExpandRow(index);
   return true;
  }
  if(this.HasDetailButton(false)) {
   grid.ExpandDetailRow(index);
   return true;
  }
  return false;
 },
 TryCollapse: function(index) {
  var grid = this.control;
  if(grid.IsGroupRow(index) && grid.IsGroupRowExpanded(index)) {
   grid.CollapseRow(index);
   return true;
  }
  if(this.HasDetailButton(true)) {
   grid.CollapseDetailRow(index);
   return true;
  }
  return false;
 },
 TryMoveFocusDown: function(index, select) {
  var grid = this.control;
  if(index < grid.visibleStartIndex + grid.pageRowCount - 1) {
   grid.SetFocusedRowIndex(index + 1);
   this.EnsureFocusedRowVisible();
   if(this.IsRowSelectable(index)) {
    if(select) {
     this.UpdateShiftSelection(index, index + 1);
    } else {
     grid.lastMultiSelectIndex = -1;
    }
   }
  } else {
   if(grid.pageIndex < grid.pageCount - 1) {       
    grid.callbackOnFocusedRowChanged = true;
    grid.SetFocusedRowIndex(index + 1);
   }
  }  
 },
 TryMoveFocusUp: function(index, select) {
  var grid = this.control;
  if(index > grid.visibleStartIndex) {
   grid.SetFocusedRowIndex(index - 1);
   this.EnsureFocusedRowVisible();
   if(this.IsRowSelectable(index)) {
    if(select) {
     this.UpdateShiftSelection(index, index - 1);
    } else {
     grid.lastMultiSelectIndex = -1;
    }
   }
  } else {
   if(grid.pageIndex > 0) {
    grid.callbackOnFocusedRowChanged = true;
    grid.SetFocusedRowIndex(index - 1);
   }
  }
 }
});
function aspxGetCtrlKey(evt) { 
 if(__aspxIE) return (event != null) ? event.ctrlKey : false;
 else return (evt != null) ? evt.ctrlKey : false;
}
function aspxGetAltKey(evt) { 
 if(__aspxIE) return (event != null) ? event.altKey : false;
 else return (evt != null) ? evt.altKey : false;
}
function aspxGetShiftKey(evt) { 
 if(__aspxIE) return (event != null) ? event.shiftKey : false;
 else return (evt != null) ? evt.shiftKey : false;
}
function _aspxGetIECaretInfo(element, operation){
 if(!_aspxIsExists(document.selection) || !_aspxIsExists(document.selection.createRange)) 
  return -1;
 var origionalRange = document.selection.createRange();
 try {
  var range = origionalRange.duplicate();
  range.moveToElementText(element);
 } 
 catch(e){
  try {
   var range = element.createTextRange();
  }
  catch(ee) {
   return -1;
  }
 }
 range.setEndPoint(operation, origionalRange);
 var result = range.text.length;
 return result > element.value.length ? -1 : result;
}
function _aspxGetCaretEnd(element){
 try {
  if(_aspxIsExists(element.selectionEnd))
   return element.selectionEnd;
  return _aspxGetIECaretInfo(element, "EndToEnd");
 }
 catch(e) {
  return null;
 }
}
function _aspxCaretStart(element){
 if(_aspxIsExists(element.selectionStart)) 
  return element.selectionStart;
 return _aspxGetIECaretInfo(element, "EndToStart");
}
function _aspxSetCaret(element, pos){
 element.focus();
 if(_aspxIsExists(element.type) && element.type != "text") return;
 if(_aspxIsExists(element.setSelectionRange)){
  element.setSelectionRange(pos, pos);
  return;
 }
 if(_aspxIsExists(element.createTextRange)){
  range = element.createTextRange();  
  range.moveStart('character',pos);
  range.collapse();
  range.select();
 }
}
function aspxGVContextMenu(name, objectType, index, e) {
 var gv = aspxGetControlCollection().Get(name);
 if(gv != null) {
  gv.RaiseContextMenu(objectType, index, e);
 }
}
function aspxGVExpandRow(name, value) {
 var gv = aspxGetControlCollection().Get(name);
 if(gv != null) 
  gv.ExpandRow(value);
}
function aspxGVCollapseRow(name, value) {
 var gv = aspxGetControlCollection().Get(name);
 if(gv != null) 
  gv.CollapseRow(value);
}
function aspxGVShowDetailRow(name, value) {
 var gv = aspxGetControlCollection().Get(name);
 if(gv != null) 
  gv.ExpandDetailRow(value);
}
function aspxGVHideDetailRow(name, value) {
 var gv = aspxGetControlCollection().Get(name);
 if(gv != null) 
  gv.CollapseDetailRow(value);
}
function aspxGVStartEditRow(name, value) {
 var gv = aspxGetControlCollection().Get(name);
 if(gv != null) 
  gv.StartEditRow(value);
}
function aspxGVDeleteRow(name, value) {
 var gv = aspxGetControlCollection().Get(name);
 if(gv != null) 
  gv.DeleteGridRow(value);
}
function aspxGVClearFilter(name) {
 var gv = aspxGetControlCollection().Get(name);
 if(gv != null) 
  gv.ClearFilter();
}
function aspxGVUpdateEdit(name) {
 var gv = aspxGetControlCollection().Get(name);
 if(gv != null) 
  gv.UpdateEdit();
}
function aspxGVCancelEdit(name) {
 var gv = aspxGetControlCollection().Get(name);
 if(gv != null) 
  gv.CancelEdit();
}
function aspxGVAddNewRow(name) {
 var gv = aspxGetControlCollection().Get(name);
 if(gv != null) 
  gv.AddNewRow();
}
function aspxGVSelectRow(name, index, value) {
 var gv = aspxGetControlCollection().Get(name);
 if(gv != null) 
  gv.SelectRowCore(index, value);
}
function aspxGVCommandCustomButton(name, id, index) {
 var gv = aspxGetControlCollection().Get(name);
 if(gv != null) 
  gv.CommandCustomButton(id, index);
}
function aspxGVHeaderMouseDown(name, element, e) {
 var gv = aspxGetControlCollection().Get(name);
 if(gv != null) 
  gv.HeaderMouseDown(element, e);
}
function aspxGVHeaderColumnResizing(name, e) {
 var gv = aspxGetControlCollection().Get(name);
 if(gv != null) 
  gv.HeaderColumnResizing(e);
}
function aspxGVPagerOnClick(name, value) {
 var gv = aspxGetControlCollection().Get(name);
 if(gv != null) 
  gv.doPagerOnClick(value);
}
function aspxGVFilterKeyPress(name, element, e) {
 var gv = aspxGetControlCollection().Get(name);
 if(gv != null) 
  gv.OnColumnFilterInputKeyPress(element, e);
}
function aspxGVFilterSpecKeyPress(name, element, e) {
 var gv = aspxGetControlCollection().Get(name);
 if(gv != null) 
  gv.OnColumnFilterInputSpecKeyPress(element, e);
}
function aspxGVFilterChanged(name, element) {
 _aspxSetTimeout("aspxGVFilterChangedDelayed(\""+name+"\", \"" + element.name + "\");", 0);
}
function aspxGVFilterChangedDelayed(name, elementName) {
 var gv = aspxGetControlCollection().Get(name);
 var element = aspxGetControlCollection().Get(elementName);
 if(gv != null && element != null) 
  gv.OnColumnFilterInputChanged(element);
}
function aspxGVTimer(name) {
 var gv = aspxGetControlCollection().Get(name);
 if(gv != null) 
  gv.OnFilterKeyPressTick();
}
function aspxGVFocusedRowChanged(name) {
 var gv = aspxGetControlCollection().Get(name);
 if(gv != null) 
  gv.RaiseFocusedRowChanged();
}
function aspxGVSelectionChanged(name) {
 var gv = aspxGetControlCollection().Get(name);
 if(gv != null) 
  gv.RaiseSelectionChanged(-1, false, false, true);
}
function aspxGVFuncCallback(name, result) {
 var gv = aspxGetControlCollection().Get(name);
 if(gv != null) 
  gv.OnFuncCallback(unescape(result));
}
function aspxRestoreCallBackTimer(name) {
 var gv = aspxGetControlCollection().Get(name);
 if(gv != null) 
  gv.OnAfterCallback();
}
function aspxGVShowParentRows(name, evt, element) {
 var gv = aspxGetControlCollection().Get(name);
 if(gv != null) {
  if(_aspxIsExists(element)) {
   gv.OnParentRowMouseEnter(element);
  }
  else gv.OnParentRowMouseLeave(evt);
 }
}
function aspxGVTableClick(name, evt) {
 if(_aspxIsExistsType(typeof Sys)) {
  try {
   Sys.WebForms.PageRequestManager._instance._onFormElementClick(new Sys.UI.DomEvent(evt));
  } catch(dummy) { 
  }
 }
 var gv = aspxGetControlCollection().Get(name);
 if(gv != null) {
  gv.mainTableClick(evt);
 } 
 return _aspxCancelBubble(evt); 
}
function aspxGVTableDblClick(name, evt) {
 var gv = aspxGetControlCollection().Get(name);
 if(gv != null) {
  gv.mainTableDblClick(evt);
 }
 return _aspxCancelBubble(evt); 
}
function aspxGVParentRowsTimer(name, rowId) {
 var gv = aspxGetControlCollection().Get(name);
 var element = _aspxGetElementById(rowId);
 if(!_aspxIsExists(element) || gv == null) return;
 gv.ShowParentRows(element);
}
function aspxGVCustWindowShown_IE(s) {
 var div = document.getElementById(s.name + "_Scroller");
 div.style.overflow = "hidden";
 var width1 = div.clientWidth;
 div.style.overflow = "auto";
 var width2 = div.clientWidth;
 if(width2 > width1) {
  div.style.width = width1 + "px";
  div.style.paddingRight = (width2 - width1) + "px";
  window.setTimeout(function() { 
   div.className = "_";
   div.className = "";
  }, 0);
 }
}
function aspxGVCustWindowCloseUp(name) {
 var gv = aspxGetControlCollection().Get(name);
 if(gv != null) {
  gv.RaiseCustomizationWindowCloseUp();
 }
}
function aspxGVShowFilterPopup(name, elementName, colIndex, buttonElement, htmlEvent) { 
 var gv = aspxGetControlCollection().Get(name);
 if(gv != null) {
  buttonElement.DXFilterPopupButton = 1;
  gv.ShowFilterPopup(elementName, colIndex, htmlEvent);
 }
}
function aspxGVApplyFilterPopup(name, colIndex, row) {
 var gv = aspxGetControlCollection().Get(name);
 if(gv != null) {
  gv.HideFilterPopup();
  gv.ApplyHeaderFilterByColumn(colIndex, _aspxGetAttribute(row, "filterValue"));
 }
}
function aspxGVFilterPopupItemOver(name, row) {
 var gv = aspxGetControlCollection().Get(name);
 if(gv != null) {
  gv.onFilterItemOver(row);
 }
}
function aspxGVFilterPopupItemOut(name, row) {
 var gv = aspxGetControlCollection().Get(name);
 if(gv != null) {
  gv.onFilterItemOut(row);
 }
}
function aspxGVShowFilterControl(name) {
 var gv = aspxGetControlCollection().Get(name);
 if(gv != null) {
  gv.ShowFilterControl();
 }
}
function aspxGVCloseFilterControl(name) {
 var gv = aspxGetControlCollection().Get(name);
 if(gv != null) {
  gv.CloseFilterControl();
 }
}
function aspxGVSetFilterEnabled(name, value) {
 var gv = aspxGetControlCollection().Get(name);
 if(gv != null) {
  gv.SetFilterEnabled(value);
 }
}
function aspxGVApplyFilterControl(name) {
 var gv = aspxGetControlCollection().Get(name);
 if(gv != null)
  gv.ApplyFilterControl();
}
function aspxGVFilterRowMenu(name, columnIndex, element) {
 var gv = aspxGetControlCollection().Get(name);
 if(gv != null)
  gv.FilterRowMenuButtonClick(columnIndex, element);
}
function aspxGVFilterRowMenuClick(name, e) {
 var gv = aspxGetControlCollection().Get(name);
 if(gv != null)
  gv.FilterRowMenuItemClick(e.item);
}
function aspxGVSort(name, columnIndex) {
 var gv = aspxGetControlCollection().Get(name);
 if(gv != null)  
  gv.SortBy(columnIndex);
}
function aspxGVVirtualScrollCore(name) {
 var gv = aspxGetControlCollection().Get(name);
 if(gv != null)  
  gv.VirtualScroll();
}
function _aspxSerializeStringArray(array) {
 if(!_aspxIsExists(array) || array.constructor != Array || array.length == 0)
  return "";
 var sb = new ASPxStringBuilder();
 for(var i = 0; i < array.length; i++) {
  var item = array[i].toString();
  sb.Append(item.length);
  sb.Append('|');
  sb.Append(item);
 }
 return sb.ToString();
}
ASPxClientGridView.instances = { };
ASPxClientGridView.ResetElementWidth = function(element) {
 var width;
 if(!_aspxIsExists(element.dxgvOrigWidth)) {  
  width = element.dxgvOrigWidth = String(element.style.width).length > 0
   ? element.style.width 
   : element.offsetWidth + "px";
 } else {
   width = element.dxgvOrigWidth;
 } 
 element.style.width = width;
};
ASPxClientGridView.DropElementOriginalWidth = function(element) {
 if(_aspxIsExists(element.dxgvOrigWidth))
  element.dxgvOrigWidth = null;
};
ASPxClientGridView.IsOriginalWidthPercentage = function(element) {
 var width = String(element.style.width);
 return width.length < 1 || width.charAt(width.length - 1) == "%";
};
ASPxClientGridView.SelectStartHandler = function(e) {
 if(_aspxGetEventSource(e).tagName.match(/input|select|textarea/i))
  return;
 if(e.ctrlKey || e.shiftKey) {
  _aspxClearSelection();
  _aspxPreventEventAndBubble(e);
 }
};
ASPxClientGridView.SaveActiveElementSettings = function(grid) {
 var element = grid.activeElement;
 grid.activeElement = null;
 ASPxClientGridView.activeElementData = null;
 if (!element || !element.id || element.tagName != "INPUT" || element.id.indexOf(grid.name + "_") != 0)
  return;  
 ASPxClientGridView.activeElementData = [ grid.name, element.id, _aspxGetCaretEnd(element) ];
 if(_aspxIsExistsType(typeof Sys) && _aspxIsExistsType(typeof Sys.Application)) {
  if(!ASPxClientGridView.MsAjaxActiveElementHandlerAdded) {
   Sys.Application.add_load(function() { ASPxClientGridView.RestoreActiveElementSettings(); } );
   ASPxClientGridView.MsAjaxActiveElementHandlerAdded = true;
  }
 } 
};
ASPxClientGridView.RestoreActiveElementSettings = function(grid) {
 var data = ASPxClientGridView.activeElementData;
 if(!data || grid && data[0] != grid.name) return;
 var element = _aspxGetElementById(data[1]);
 if (element) {
  element.focus();
  _aspxSetCaret(element, data[2]);
 }
 ASPxClientGridView.activeElementData = null;
};
var __aspxTEInputSuffix = "_I";
var __aspxTERawInputSuffix = "_Raw";
var __aspxPasteCheckInterval = 50;
ASPxEditorStretchedInputElementsManager = _aspxCreateClass(null, {
 constructor: function() {
  this.targetEditorNames = { };
 },
 Initialize: function() {
  this.InitializeTargetEditorsList();
 },
 InitializeTargetEditorsList: function() {
  aspxGetControlCollection().ForEachControl(function(control) {
   if(this.targetEditorNames[control.name])
    return;
   if(ASPxIdent.IsASPxClientTextEdit(control) && control.WidthCorrectionRequired()) {
    var inputElement = control.GetInputElement();
    if(inputElement && _aspxIsWidthSetInPercentage(inputElement.style.width))
     this.targetEditorNames[control.name] = true;
   }
  }, this);
 },
 HideInputElementsExceptOf: function(exceptedEditor) {
  var collection = aspxGetControlCollection();
  for(var editorName in this.targetEditorNames) {
   if(typeof(editorName) != "string")
    continue;
   var editor = collection.Get(editorName);
   if(!ASPxIdent.IsASPxClientEdit(editor)) continue;
   if(editor && editor != exceptedEditor) {
    var input = editor.GetInputElement();
    if(input) {
     var existentSavedDisplay = input._dxSavedDisplayAttr;
     if(!_aspxIsExists(existentSavedDisplay)) {
      input._dxSavedDisplayAttr = input.style.display;
      input.style.display = "none";
     }
    }
   }   
  }
 },
 ShowInputElements: function() {
  var collection = aspxGetControlCollection();
  for(var editorName in this.targetEditorNames) {
   if(typeof(editorName) != "string")
    continue;
   var editor = collection.Get(editorName);
   if(!ASPxIdent.IsASPxClientEdit(editor)) continue;
   if(editor) {
    var input = editor.GetInputElement();
    if(input) {
     var savedDisplay = input._dxSavedDisplayAttr;
     if(_aspxIsExists(savedDisplay)) {
      input.style.display = savedDisplay;
      input._dxSavedDisplayAttr = null;
     }
    }
   }
  }
 }
});
var __aspxEditorStretchedInputElementsManager = null;
function _aspxGetEditorStretchedInputElementsManager() {
 if(!__aspxEditorStretchedInputElementsManager)
  __aspxEditorStretchedInputElementsManager = new ASPxEditorStretchedInputElementsManager();
 return __aspxEditorStretchedInputElementsManager;
}
ASPxClientTextEdit = _aspxCreateClass(ASPxClientEdit, {
 constructor: function(name) {
  this.constructor.prototype.constructor.call(this, name);      
  this.isASPxClientTextEdit = true;
  this.nullText = "";
  this.escCount = 0;
  this.raiseValueChangedOnEnter = true;
  this.autoResizeWithContainer = false;
  this.lastChangedValue = null;
  this.maskInfo = null;  
  this.maskValueBeforeUserInput = "";
  this.maskPasteTimerID = -1;
  this.maskPasteLock = false;    
  this.maskPasteCounter = 0;
  this.maskTextBeforePaste = "";    
  this.maskHintHtml = "";
  this.maskHintTimerID = -1;
  this.displayFormat = null;
  this.TextChanged = new ASPxClientEvent();
 },
 Initialize: function(){
  this.SaveChangedValue();
  ASPxClientEdit.prototype.Initialize.call(this);
 },
 InlineInitialize: function(){
  ASPxClientEdit.prototype.InlineInitialize.call(this);
  if(this.maskInfo != null)
   this.InitMask();
 },
 FindInputElement: function(){
  return this.isNative ? this.GetMainElement() : _aspxGetElementById(this.name + __aspxTEInputSuffix);
 },
 GetRawInputElement: function() {
  return _aspxGetElementById(this.name + __aspxTERawInputSuffix);
 },
 DecodeRawInputValue: function(value) {
  return value;
 },
 SetRawInputValue: function(value){
  this.GetRawInputElement().value = value;
 },
 SyncRawInputValue: function() {
  if(this.maskInfo != null)
   this.SetRawInputValue(this.maskInfo.GetValue());
  else
   this.SetRawInputValue(this.GetInputElement().value);
 },
 HasTextDecorators: function() {
  return this.nullText != "" || this.displayFormat != null;
 },
 CanApplyTextDecorators: function(){
  return !this.focused;
 },
 GetDecoratedText: function(value) {
  var isNull = value == null || (value === "" && this.convertEmptyStringToNull);
  if(isNull && this.nullText != "")
   return this.nullText;
  if(this.displayFormat != null)
   return ASPxFormatter.Format(this.displayFormat, value);
  if(this.maskInfo != null)
   return this.maskInfo.GetText();
  if(value == null)
   return "";
  return value;
 },
 ToggleTextDecoration: function() {
  if(this.readOnly) return;
  if(!this.HasTextDecorators()) return;
  if(this.focused) {
   var input = this.GetInputElement();
   var oldValue = input.value;
   var sel = _aspxGetSelectionInfo(input);
   this.ToggleTextDecorationCore();
   if(oldValue != input.value) {
    if(sel.startPos == 0 && sel.endPos == oldValue.length)
     sel.endPos = input.value.length;
    else
     sel.endPos = sel.startPos;
    _aspxSetInputSelection(input, sel.startPos, sel.endPos);
   }
  } else {
   this.ToggleTextDecorationCore();
  }
 },
 ToggleTextDecorationCore: function() {
  if(this.maskInfo != null) {   
   this.ApplyMaskInfo(false);
  } else {
   var input = this.GetInputElement();
   var rawValue = this.GetRawInputElement().value;
   var value = this.CanApplyTextDecorators() ? this.GetDecoratedText(rawValue) : rawValue;
   if(input.value != value)
    input.value = value;
  }
 },
 PopulateStyleDecorationPostfixes: function() {
  ASPxClientEdit.prototype.PopulateStyleDecorationPostfixes.call(this);
  this.styleDecoration.AddPostfix(__aspxTEInputSuffix);
 },
 GetValue: function() {
  var value = null;
  if(this.maskInfo != null)
   value = this.maskInfo.GetValue();
  else if(this.HasTextDecorators())
   value = this.GetRawInputElement().value;
  else
   value = this.GetInputElement().value;
  return (value == "" && this.convertEmptyStringToNull) ? null : value;
 },
 SetValue: function(value) {
  if(value == null) value = "";
  if(this.maskInfo != null) {
   this.maskInfo.SetValue(value);
   this.ApplyMaskInfo(false);
   this.SavePrevMaskValue();
  } 
  else if(this.HasTextDecorators()) {
   this.SetRawInputValue(value);
   this.GetInputElement().value = this.CanApplyTextDecorators() ? this.GetDecoratedText(value) : value;
  }
  else
   this.GetInputElement().value = value;
  if(this.styleDecoration != null)
   this.styleDecoration.Update();   
  this.SaveChangedValue();   
 },
 CollapseControl: function(checkSizeCorrectedFlag) {
  if (checkSizeCorrectedFlag && this.sizeCorrectedOnce)
   return;
  var mainElement = this.GetMainElement();
  if (!_aspxIsExistsElement(mainElement))
   return;
  if (this.WidthCorrectionRequired())
   this.GetInputElement().style.width = "0";
 },
 CorrectEditorWidth: function() {
  var inputElement = this.GetInputElement();
  var stretchedInputsManager = _aspxGetEditorStretchedInputElementsManager();
  try {
   stretchedInputsManager.HideInputElementsExceptOf(this);
   _aspxSetOffsetWidth(inputElement, _aspxGetClearClientWidth(_aspxFindOffsetParent(inputElement)));
  } finally {
   stretchedInputsManager.ShowInputElements();
  }
 },
 UnstretchInputElement: function(){
  var inputElement = this.GetInputElement();
  var mainElement = this.GetMainElement();
  var mainElementCurStyle = _aspxGetCurrentStyle(mainElement);
  if (_aspxIsExistsElement(mainElement) && _aspxIsExistsElement(inputElement) && _aspxIsExistsElement(mainElementCurStyle) && 
   inputElement.style.width == "100%" &&
   (mainElementCurStyle.width == "" || mainElementCurStyle.width == "auto"))
   inputElement.style.width = "";
 },
 RaiseValueChangedEvent: function() {
  var processOnServer = ASPxClientEdit.prototype.RaiseValueChangedEvent.call(this);
  processOnServer = this.RaiseTextChanged(processOnServer);
  return processOnServer;
 },
 InitMask: function() {
  this.SetValue(this.DecodeRawInputValue(this.GetRawInputElement().value));
  this.validationPatterns.unshift(new ASPxMaskValidationPattern(this.maskInfo.errorText, this.maskInfo));
  this.maskPasteTimerID = _aspxSetInterval("aspxMaskPasteTimerProc('" + this.name + "')", __aspxPasteCheckInterval);
 },
 SavePrevMaskValue: function() {
  this.maskValueBeforeUserInput = this.maskInfo.GetValue();
 },
 FillMaskInfo: function() {
  var input = this.GetInputElement();
  if(!input) return; 
  var sel = _aspxGetSelectionInfo(input);
  this.maskInfo.SetCaret(sel.startPos, sel.endPos - sel.startPos);  
 },
 ApplyMaskInfo: function(applyCaret) {
  this.SyncRawInputValue();
  var input = this.GetInputElement();
  var text = this.GetMaskDisplayText();
  this.maskTextBeforePaste = text;
  if(input.value != text)
   input.value = text;
  if(applyCaret)
   _aspxSetInputSelection(input, this.maskInfo.caretPos, this.maskInfo.caretPos + this.maskInfo.selectionLength);
 },
 GetMaskDisplayText: function() {
  if(!this.focused && this.HasTextDecorators())
   return this.GetDecoratedText(this.maskInfo.GetValue());
  return this.maskInfo.GetText();
 },
 ShouldCancelMaskKeyProcessing: function(htmlEvent, keyDownInfo) {
  return htmlEvent.returnValue === false;
 }, 
 HandleMaskKeyDown: function(evt) {
  var keyInfo = _aspxMaskManager.CreateKeyInfoByEvent(evt);
  _aspxMaskManager.keyCancelled = this.ShouldCancelMaskKeyProcessing(evt, keyInfo);
  if(_aspxMaskManager.keyCancelled) {
   _aspxPreventEvent(evt);
   return;
  }
  this.maskPasteLock = true;
  this.FillMaskInfo();  
  var canHandle = _aspxMaskManager.CanHandleControlKey(keyInfo);   
  _aspxMaskManager.savedKeyDownKeyInfo = keyInfo;
  if(canHandle) {   
   _aspxMaskManager.OnKeyDown(this.maskInfo, keyInfo);
   this.ApplyMaskInfo(true);
   _aspxPreventEvent(evt);
  }
  _aspxMaskManager.keyDownHandled = canHandle;
  this.maskPasteLock = false;
  this.UpdateMaskHintHtml();
 },
 HandleMaskKeyPress: function(evt) {
  var keyInfo = _aspxMaskManager.CreateKeyInfoByEvent(evt);
  _aspxMaskManager.keyCancelled = _aspxMaskManager.keyCancelled || this.ShouldCancelMaskKeyProcessing(evt, _aspxMaskManager.savedKeyDownKeyInfo);
  if(_aspxMaskManager.keyCancelled) {
   _aspxPreventEvent(evt);
   return;
  }
  this.maskPasteLock = true;  
  var printable = _aspxMaskManager.savedKeyDownKeyInfo != null && _aspxMaskManager.IsPrintableKeyCode(_aspxMaskManager.savedKeyDownKeyInfo);
  if(printable) {
   _aspxMaskManager.OnKeyPress(this.maskInfo, keyInfo);
   this.ApplyMaskInfo(true);
  }
  if(printable || _aspxMaskManager.keyDownHandled)   
   _aspxPreventEvent(evt); 
  this.maskPasteLock = false;
  this.UpdateMaskHintHtml();
 },
 MaskPasteTimerProc: function() {
  if(this.maskPasteLock) return;
  this.maskPasteCounter++;
  var inputElement = this.inputElement;
  if(!inputElement || this.maskPasteCounter > 40) {
   this.maskPasteCounter = 0;
   inputElement = this.GetInputElement();
  if(!_aspxIsExistsElement(inputElement)) {
   this.maskPasteTimerID = _aspxClearInterval(this.maskPasteTimerID);
   return;  
  }
  }
  if(this.maskTextBeforePaste != inputElement.value) {
   this.maskInfo.ProcessPaste(inputElement.value, _aspxGetSelectionInfo(inputElement).endPos);
   this.ApplyMaskInfo(true);
  }
 },
 BeginShowMaskHint: function() {  
  if(!this.readOnly && this.maskHintTimerID == -1)
   this.maskHintTimerID = window.setInterval(aspxMaskHintTimerProc, 500);
 },
 EndShowMaskHint: function() {
  window.clearInterval(this.maskHintTimerID);
  this.maskHintTimerID = -1;
 },
 MaskHintTimerProc: function() {  
  if(this.maskInfo) {
   this.FillMaskInfo();
   this.UpdateMaskHintHtml();
  } else {
   this.EndShowMaskHint();
  }
 },
 UpdateMaskHintHtml: function() {  
  var hint =  this.GetMaskHintElement();
  if(!_aspxIsExistsElement(hint))
   return;
  var html = _aspxMaskManager.GetHintHtml(this.maskInfo);
  if(html == this.maskHintHtml)
   return;
  if(html != "") {
   var mainElement = this.GetMainElement();
   if(_aspxIsExistsElement(mainElement)) {
    hint.innerHTML = html;
    hint.style.position = "absolute";  
    hint.style.left = _aspxGetAbsoluteX(mainElement) + "px";
    hint.style.top = (_aspxGetAbsoluteY(mainElement) + mainElement.offsetHeight + 2) + "px";
    hint.style.display = "block";    
   }   
  } else {
   hint.style.display = "none";
  }
  this.maskHintHtml = html;
 },
 HideMaskHint: function() {
  var hint =  this.GetMaskHintElement();
  if(_aspxIsExistsElement(hint))
   hint.style.display = "none";
  this.maskHintHtml = "";
 },
 GetMaskHintElement: function() {
  return _aspxGetElementById(this.name + "_MaskHint");
 },
 OnMouseWheel: function(evt){
  if(this.readOnly || this.maskInfo == null) return;
  this.FillMaskInfo();
  _aspxMaskManager.OnMouseWheel(this.maskInfo, _aspxGetWheelDelta(evt) < 0 ? -1 : 1);
  this.ApplyMaskInfo(true);
  _aspxPreventEvent(evt);
  this.UpdateMaskHintHtml();
 }, 
 OnBrowserWindowResize: function(evt) {
  if(!this.autoResizeWithContainer)
   this.AdjustControl();
 },
 IsValueChanged: function() {
    return this.GetValue() != this.lastChangedValue; 
 },
 AllowPreventingDefaultEnterBehavior: function() {
  return true;
 },
 OnKeyDown: function(evt) {        
  if(__aspxWebKitFamily && !this.autoPostBack && _aspxGetKeyCode(evt) == ASPxKey.Enter && this.AllowPreventingDefaultEnterBehavior()){ 
   return _aspxPreventEvent(evt);
  }
  if(__aspxIE && _aspxGetKeyCode(evt) == ASPxKey.Esc) {   
   if(++this.escCount > 1) {
    _aspxPreventEvent(evt);
    return;
   }
  } else {
   this.escCount = 0;
  }
  ASPxClientEdit.prototype.OnKeyDown.call(this, evt);
  if(!this.specialKeyboardHandlingUsed && this.raiseValueChangedOnEnter && evt.keyCode == ASPxKey.Enter) {
   this.RaiseStandardOnChange();
   return;
  }  
  if(!this.readOnly && this.maskInfo != null)
   this.HandleMaskKeyDown(evt);
 },
 OnKeyPress: function(evt) {
  ASPxClientEdit.prototype.OnKeyPress.call(this, evt);
  if(!this.readOnly && this.maskInfo != null)
   this.HandleMaskKeyPress(evt);
 },
 OnKeyUp: function(evt) {
  if(this.HasTextDecorators())
   this.SyncRawInputValue();
  ASPxClientEdit.prototype.OnKeyUp.call(this, evt);
 },
 OnFocusCore: function() {
  var wasLocked = this.IsFocusEventsLocked();
  if(!this.GetEnabled()){
   var inputElement = this.GetInputElement();
   if(_aspxIsExists(inputElement)) inputElement.blur();
   return;
  }
  ASPxClientEdit.prototype.OnFocusCore.call(this);
  if(this.maskInfo != null) {
   this.SavePrevMaskValue();
   this.BeginShowMaskHint();
  }
  if(!wasLocked)
   this.ToggleTextDecoration();
 },
 OnLostFocusCore: function() {
  var wasLocked = this.IsFocusEventsLocked();
  ASPxClientEdit.prototype.OnLostFocusCore.call(this);
  if(this.maskInfo != null) {
   this.EndShowMaskHint();
   this.HideMaskHint();   
   if(this.maskInfo.ApplyFixes(null))
    this.ApplyMaskInfo(false);
   this.RaiseStandardOnChange();
  }
  if(!wasLocked)
   this.ToggleTextDecoration();
  this.escCount = 0;
 },
 OnValueChanged: function() { 
  if(this.maskInfo != null) {
   if(this.maskInfo.GetValue() == this.maskValueBeforeUserInput) 
    return;
   this.SavePrevMaskValue();
  }
  if(this.HasTextDecorators())
   this.SyncRawInputValue();
  if(!this.IsValueChanged()) return;
  this.SaveChangedValue(); 
  ASPxClientEdit.prototype.OnValueChanged.call(this);
 }, 
 OnTextChanged: function() {
 },
 SaveChangedValue: function() {
  this.lastChangedValue = this.GetValue();
 },
 RaiseStandardOnChange: function(){
  var element = this.GetInputElement();
  if(_aspxIsExists(element) && _aspxIsExists(element.onchange)) {
   var eventMock = {
    target:this.GetInputElement()
   };
   element.onchange(eventMock);
  }
 },
 RaiseTextChanged: function(processOnServer){
  if(!this.TextChanged.IsEmpty()){
   var args = new ASPxClientProcessingModeEventArgs(processOnServer);
   this.TextChanged.FireEvent(this, args);
   processOnServer = args.processOnServer;
  }
  return processOnServer;  
 },
 GetText: function(){
  if(this.maskInfo != null) {
   return this.maskInfo.GetText();
  } else {
   var value = this.GetValue();
   return value != null ? value : "";
  }
 },
 SetText: function (value){
  if(this.maskInfo != null) {
   this.maskInfo.SetText(value);
   this.ApplyMaskInfo(false);
   this.SavePrevMaskValue();
  } else {
   this.SetValue(value);
  }
 },
 SelectAll: function() {
  this.SetSelection(0, -1, false);
 },
 SetCaretPosition: function(pos) {
  var inputElement = this.GetInputElement();
  _aspxSetCaretPosition(inputElement, pos);
 },
 SetSelection: function(startPos, endPos, scrollToSelection) { 
  var inputElement = this.GetInputElement();
  _aspxSetSelection(inputElement, startPos, endPos, scrollToSelection);
 },
 ChangeEnabledAttributes: function(enabled){
  var inputElement = this.GetInputElement();
  if(_aspxIsExists(inputElement)){
   this.ChangeInputEnabledAttributes(inputElement, _aspxChangeAttributesMethod(enabled), enabled);
   if(this.specialKeyboardHandlingUsed)
    this.ChangeSpecialInputEnabledAttributes(inputElement, _aspxChangeEventsMethod(enabled));
   this.ChangeInputEnabled(inputElement, enabled, this.readOnly);
  }
 },
 ChangeEnabledStateItems: function(enabled){
  if(!this.isNative) {
   var sc = aspxGetStateController();
   sc.SetElementEnabled(this.GetMainElement(), enabled);
   sc.SetElementEnabled(this.GetInputElement(), enabled);
  }
 },
 ChangeInputEnabled: function(element, enabled, readOnly){
  if(this.UseReadOnlyForDisabled())
   element.readOnly = !enabled || readOnly;
  else
   element.disabled = !enabled;
 },
 ChangeInputEnabledAttributes: function(element, method, enabled){
  if(enabled && __aspxWebKitFamily && element.tabIndex == -1)
   element.tabIndex = null;
  method(element, "tabIndex");
  if(!enabled) element.tabIndex = -1;
  method(element, "onclick");
  if(!this.NeedFocusCorrectionWhenDisabled())
   method(element, "onfocus");
  method(element, "onblur");
  method(element, "onkeydown");
  method(element, "onkeypress");
  method(element, "onkeyup");
 },
 UseReadOnlyForDisabled: function(){
  return (__aspxIE || __aspxOpera) && !this.isNative;
 },
 NeedFocusCorrectionWhenDisabled: function(){
  return __aspxIE && !this.isNative;
 }
});
ASPxIdent.IsASPxClientTextEdit = function(obj) {
 return _aspxIsExists(obj.isASPxClientTextEdit) && obj.isASPxClientTextEdit;
};
ASPxMaskValidationPattern = _aspxCreateClass(ASPxValidationPattern, {
 constructor: function(errorText, maskInfo) {
  this.constructor.prototype.constructor.call(this, errorText);
  this.maskInfo = maskInfo;
 },
 EvaluateIsValid: function(value) {
  return this.maskInfo.IsValid();
 }
});
ASPxClientTextBoxBase = _aspxCreateClass(ASPxClientTextEdit, {
 constructor: function(name) {
  this.constructor.prototype.constructor.call(this, name);
  this.sizingConfig.allowSetHeight = false;
  this.sizingConfig.adjustControl = true;
 }
});
ASPxClientTextBox = _aspxCreateClass(ASPxClientTextBoxBase, {
 constructor: function(name) {
  this.constructor.prototype.constructor.call(this, name);
  this.isASPxClientTextBox = true;
 }
});
ASPxClientTextBox.Cast = ASPxClientControl.Cast;
ASPxIdent.IsASPxClientTextBox = function(obj) {
 return _aspxIsExists(obj.isASPxClientTextBox) && obj.isASPxClientTextBox;
};
var __aspxMMinHeight = 34;
ASPxClientMemo = _aspxCreateClass(ASPxClientTextEdit, { 
 constructor: function(name) {
  this.constructor.prototype.constructor.call(this, name);        
  this.isASPxClientMemo = true;
  this.raiseValueChangedOnEnter = false;
 },
 CollapseControl: function(checkSizeCorrectedFlag) {
  if (checkSizeCorrectedFlag && this.sizeCorrectedOnce)
   return;
  var mainElement = this.GetMainElement();
  var inputElement = this.GetInputElement();
  if (!_aspxIsExistsElement(mainElement) || !_aspxIsExistsElement(inputElement))
   return;
  ASPxClientTextEdit.prototype.CollapseControl.call(this, checkSizeCorrectedFlag);
  var mainElementCurStyle = _aspxGetCurrentStyle(mainElement);
  if (this.heightCorrectionRequired && _aspxIsExists(mainElement) && _aspxIsExists(inputElement)) {
   if (mainElement.style.height == "100%" || mainElementCurStyle.height == "100%") {
    mainElement.style.height = "0";
    mainElement.wasCollapsed = true;
   }
   inputElement.style.height = "0";
  }
 },
 CorrectEditorHeight: function() {
  var mainElement = this.GetMainElement();
  if(mainElement.wasCollapsed) {
   mainElement.wasCollapsed = null;
   _aspxSetOffsetHeight(mainElement, _aspxGetClearClientHeight(_aspxFindOffsetParent(mainElement)));
  }
  if(!this.isNative) {
   var inputElement = this.GetInputElement();
   var inputClearClientHeight = _aspxGetClearClientHeight(_aspxFindOffsetParent(inputElement));
   if(__aspxIE && __aspxBrowserVersion < 8)
     inputClearClientHeight -= 2;
   if(__aspxIE) {
    var calculatedMainElementStyle = _aspxGetCurrentStyle(mainElement);
    inputClearClientHeight += _aspxPxToInt(calculatedMainElementStyle.borderTopWidth) + _aspxPxToInt(calculatedMainElementStyle.borderBottomWidth);
   }
   if(inputClearClientHeight < __aspxMMinHeight)
    inputClearClientHeight = __aspxMMinHeight;
   _aspxSetOffsetHeight(inputElement, inputClearClientHeight);
   mainElement.style.height = "100%";
  }
 },
 SetWidth: function(width) {
  this.constructor.prototype.SetWidth.call(this, width);
  if(__aspxIE)
   this.AdjustControl();
 },
 SetHeight: function(height) {
  this.GetInputElement().style.height = "1px";
  this.constructor.prototype.SetHeight.call(this, height);
  this.GetInputElement().style.height = this.GetMainElement().clientHeight + "px";
 },
 ClearErrorFrameElementsStyles: function() {
  var textarea = this.GetInputElement();
  if(!textarea)
   return;
  var scrollBarPosition = textarea.scrollTop;
  ASPxClientTextEdit.prototype.ClearErrorFrameElementsStyles.call(this);
  if(__aspxFirefox)
   textarea.scrollTop = scrollBarPosition;
 },
 AllowPreventingDefaultEnterBehavior: function() {
  return false; 
 }
});
ASPxClientMemo.Cast = ASPxClientControl.Cast;
ASPxIdent.IsASPxClientMemo = function(obj) {
 return _aspxIsExists(obj.isASPxClientMemo) && obj.isASPxClientMemo;
};
ASPxClientButtonEditBase = _aspxCreateClass(ASPxClientTextBoxBase, {
 constructor: function(name) {
  this.constructor.prototype.constructor.call(this, name);        
  this.allowUserInput = true;
  this.allowMouseWheel = true;
  this.buttonCount = 0;
  this.ButtonClick = new ASPxClientEvent();
 },
 GetButton: function(number) {
  return this.GetChild("_B" + number);
 },
 ProcessInternalButtonClick: function(buttonIndex) {
  return false;
 },
 OnButtonClick: function(number){
  var processOnServer = this.RaiseButtonClick(number);
  if (!this.ProcessInternalButtonClick(number) && processOnServer)
   this.SendPostBack('BC:' + number);
 },
 SelectInputElement: function() {
  var element = this.GetInputElement();
  if(_aspxIsExistsElement(element)) {
   _aspxSetFocus(element);
   element.select();  
  }
 },
 RaiseButtonClick: function(number){
  var processOnServer = this.autoPostBack || this.IsServerEventAssigned("ButtonClick");
  if(!this.ButtonClick.IsEmpty()){
   var args = new ASPxClientButtonEditClickEventArgs(processOnServer, number);
   this.ButtonClick.FireEvent(this, args);
   processOnServer = args.processOnServer;
  }
  return processOnServer;
 },
 ChangeEnabledAttributes: function(enabled){
  ASPxClientTextEdit.prototype.ChangeEnabledAttributes.call(this, enabled);
  for(var i = 0; i < this.buttonCount; i++){
   var element = this.GetButton(i);
   if(_aspxIsExists(element)) 
    this.ChangeButtonEnabledAttributes(element, _aspxChangeAttributesMethod(enabled));
  }
 },
 ChangeEnabledStateItems: function(enabled){
  ASPxClientTextEdit.prototype.ChangeEnabledStateItems.call(this, enabled);
  for(var i = 0; i < this.buttonCount; i++){
   var element = this.GetButton(i);
   if(_aspxIsExists(element)) 
    aspxGetStateController().SetElementEnabled(element, enabled);
  }
 },
 ChangeButtonEnabledAttributes: function(element, method){
  method(element, "onclick");
  method(element, "ondblclick");
  method(element, "onmousedown");
  method(element, "onmouseup");
 },
 ChangeInputEnabled: function(element, enabled, readOnly){
  ASPxClientTextEdit.prototype.ChangeInputEnabled.call(this, element, enabled, readOnly || !this.allowUserInput);
 }
});
ASPxClientButtonEdit = _aspxCreateClass(ASPxClientButtonEditBase, {
});
ASPxClientButtonEdit.Cast = ASPxClientControl.Cast;
ASPxClientButtonEditClickEventArgs = _aspxCreateClass(ASPxClientProcessingModeEventArgs, {
 constructor: function(processOnServer, buttonIndex){
  this.constructor.prototype.constructor.call(this, processOnServer);
  this.buttonIndex = buttonIndex;
 }
});
function aspxETextChanged(name) { 
 var edit = aspxGetControlCollection().Get(name);
 if(edit != null) edit.OnTextChanged(); 
}
function aspxBEClick(name,number){
 var edit = aspxGetControlCollection().Get(name);
 if(edit != null) edit.OnButtonClick(number);
}
function aspxMaskPasteTimerProc(name){
 var edit = aspxGetControlCollection().Get(name);
 if(edit != null) edit.MaskPasteTimerProc();
}
function aspxMaskHintTimerProc() {
 var focusedEditor = ASPxClientEdit.GetFocusedEditor();
 if(focusedEditor != null && _aspxIsFunction(focusedEditor.MaskHintTimerProc))
  focusedEditor.MaskHintTimerProc();
}
function _aspxSetFocusToTextEditWithDelay(name) {
 _aspxSetTimeout("var edit = aspxGetControlCollection().Get('" + name + "'); __aspxIE ? edit.SetCaretPosition(0) : edit.SetFocus();", 500);
}
function _aspxPGNav(evt) {
 var element = _aspxGetEventSource(evt);
 if(element != null) {
  if(element.tagName != "A") {
   var linkElement = _aspxGetChildByTagName(element, "A", 0);
   if(linkElement != null) 
    _aspxNavigateUrl(linkElement.href, linkElement.target);
  }
 }
 if(!__aspxNetscapeFamily)
  evt.cancelBubble = true;
}
ASPxClientHiddenField = _aspxCreateClass(ASPxClientControl, {
 constructor: function(name) {
  this.constructor.prototype.constructor.call(this, name);
  this.syncWithServer = true;
  this.properties = { };
  this.typeInfoTable = { };
  this.typeNameTable = [ ];
  this.allowMultipleCallbacks = false;
  this.serializer = _aspxGetHiddenFieldSerializer();
 },
 InlineInitialize: function() {
  if(this.syncWithServer) {
   var postHandler = aspxGetPostHandler();
   postHandler.PostFinalization.AddHandler(this.OnPost, this);
  }
 },
 GetInputElement: function() {
  if(this.inputElement == null)
   this.inputElement = document.getElementById(this.name + ASPxClientHiddenField.InputElementIDSuffix);
  return this.inputElement;
 },
 OnPost: function() {
  var inputElement = this.GetInputElement();
  if(_aspxIsExists(inputElement)) {
   var serializedData = this.serializer.Serialize(this);
   inputElement.value = _aspxEncodeHtml(serializedData);
  }
 },
 PerformCallback: function(parameter) {
  this.CreateCallback(parameter);
 },
 OnCallback: function(result) {
  var callbackMarkupContainer = this.GetCallbackMarkupContainer();
  _aspxSetInnerHtml(callbackMarkupContainer, result);
 },
 GetCallbackMarkupContainer: function() {
  var callbackMarkupContainer = _aspxGetElementById(this.GetCallbackMarkupContainerID());
  if(!_aspxIsExists(callbackMarkupContainer)) {
   callbackMarkupContainer = this.CreateCallbackMarkupContainer();
   document.body.appendChild(callbackMarkupContainer);
  }
  return callbackMarkupContainer;
 },
 GetCallbackMarkupContainerID: function() {
  return this.name + ASPxClientHiddenField.CallbackMarkupContainerIDSuffix;
 },
 CreateCallbackMarkupContainer: function() {
  var callbackMarkupContainer = document.createElement("DIV");
  _aspxSetElementDisplay(callbackMarkupContainer, false);
  callbackMarkupContainer.id = this.GetCallbackMarkupContainerID();
  return callbackMarkupContainer;
 },
 Add: function(propertyName, propertyValue) {
  var existentPropertyValue = this.Get(propertyName);
  if(typeof(existentPropertyValue) == "undefined")
   this.Set(propertyName, propertyValue);
  else
   alert("A property with the name '" + propertyName + "' has already been added.");
 },
 Get: function(propertyName) {
  var safeName = this.GetTopLevelPropertySafeName(propertyName);
  return this.properties[safeName];
 },
 Set: function(propertyName, propertyValue) {
  var safeName = this.GetTopLevelPropertySafeName(propertyName);
  if(typeof(propertyValue) == "undefined")
   this.Remove(propertyName);
  else
   this.properties[safeName] = propertyValue;
 },
 Remove: function(propertyName) {
  var safeName = this.GetTopLevelPropertySafeName(propertyName);
  delete this.properties[safeName];
  this.serializer.typeInfoHelper.RemoveTypeInfoBranch(this.typeInfoTable, safeName);
 },
 Clear: function() {
  this.properties = { };
  this.typeInfoTable = { };
  this.typeNameTable = [ ];
 },
 Contains: function(propertyName) {
  var safeTopLevelPropertyName = this.GetTopLevelPropertySafeName(propertyName);
  for(var key in this.properties) {
   if(key == safeTopLevelPropertyName)
    return true;
  }
  return false;
 },
 GetTopLevelPropertySafeName: function(propertyName) {
  return ASPxClientHiddenField.TopLevelKeyPrefix + propertyName;
 }
});
ASPxClientHiddenField.Cast = ASPxClientControl.Cast;
ASPxClientHiddenField.InputElementIDSuffix = "_I";
ASPxClientHiddenField.CallbackMarkupContainerIDSuffix = "_D";
ASPxClientHiddenField.TopLevelKeyPrefix = "dxp";
ASPxTypeInfoHelper = _aspxCreateClass(null, {
 constructor: function() {
  this.minUnknownTypeIndex = 1024;
  this.clientTypeConstructors = [
   null,
   Number,
   String,
   Date,
   Boolean,
   RegExp,
   Array,
   Object
  ];
  this.clientTypeConstructorIndices = { };
  for(var i = 1; i < this.clientTypeConstructors.length; i++)
   this.clientTypeConstructorIndices[this.clientTypeConstructors[i]] = i;
 },
 EnsureTypeInfoTableCompliant: function(value, typeInfoTable, typeInfoKey) {
  if(typeInfoKey == "")
   return;
  var typeCode = typeInfoTable[typeInfoKey];
  if(typeof(typeCode) != "undefined") {
   if(!this.IsValueTypeInfoCompliant(value, typeCode))
    this.RemoveTypeInfoBranch(typeInfoTable, typeInfoKey);
   else
    return;
  }
  typeCode = this.CreateTypeCode(value);
  if(typeof(typeCode) != "undefined")
   typeInfoTable[typeInfoKey] = typeCode;
  else
   delete typeInfoTable[typeInfoKey];
 },
 IsAtomValue: function(value, typeCode) {
  return typeCode == 0 || !(this.IsListValue(value, typeCode) || this.IsDictionaryValue(value, typeCode));
 },
 IsListValue: function(value, typeCode) {
  return this.IsKnownTypeCode(typeCode) ? this.GetConstructor(typeCode) === Array : value.constructor === Array;
 },
 IsDictionaryValue: function(value, typeCode) {
  return this.IsKnownTypeCode(typeCode) ? this.GetConstructor(typeCode) === Object : value.constructor === Object;
 },
 GetArrayTypeCode: function() {
  return this.clientTypeConstructorIndices[Array] << 1;
 },
 GetStringTypeCode: function() {
  return this.clientTypeConstructorIndices[String] << 1;
 },
 IsStringTypeCode: function(typeCode) {
  return typeCode == this.GetStringTypeCode();
 },
 IsValueTypeInfoCompliant: function(value, typeCode) {
  if(this.IsKnownTypeCode(typeCode))
   return value != null ? value.constructor === this.GetConstructor(typeCode) : this.IsNullable(typeCode);
  else
   return value == null || value.constructor === Array || value.constructor === Object;
 },
 CreateTypeCode: function(value) {
  if(value == null)
   return 1; 
  var clientTypeIndex = this.clientTypeConstructorIndices[value.constructor];
  var lowerBit = Number(
   clientTypeIndex == this.clientTypeConstructorIndices[RegExp] ||
   clientTypeIndex == this.clientTypeConstructorIndices[Array] ||
   clientTypeIndex == this.clientTypeConstructorIndices[Object]
  );
  return typeof(clientTypeIndex) != "undefined" ? ((clientTypeIndex << 1) + lowerBit) : void(0);
 },
 IsNullable: function(typeCode) {
  return (typeCode & 1) > 0;
 },
 GetConstructor: function(typeCode) {
  return this.clientTypeConstructors[(typeCode >>> 1) & 7];
 },
 IsKnownTypeCode: function(typeCode) {
  return typeCode < this.minUnknownTypeIndex;
 },
 RemoveTypeInfoBranch: function(typeInfoTable, typeInfoKeyPrefix) {
  for(var key in typeInfoTable) {
   if(key.indexOf(typeInfoKeyPrefix) == 0)
    delete typeInfoTable[key];
  }
 }
});
ASPxHiddenFieldSerializer = _aspxCreateClass(null, {
 constructor: function() {
  this.typeInfoHelper = new ASPxTypeInfoHelper();
  this.separator = "|";
  this.sentinel = "#";
  this.charCodes = this.CreateCharCodeList([ "a", "z", "0", "9", "_", "$" ]);
  this.sb = new ASPxStringBuilder();
 },
 Serialize: function(hiddenField) {
  var sb = new ASPxStringBuilder();
  this.SerializeCore(hiddenField.typeNameTable, "", sb, null, null, null, false);
  this.SerializeCore(hiddenField.properties, "", sb, hiddenField.typeInfoTable, hiddenField.typeNameTable, ASPxClientHiddenField.TopLevelKeyPrefix, true);
  return sb.ToString();
 },
 SerializeCore: function(value, pathInPropertiesTree, serializedData, typeInfoTable, typeNameTable, keyNamePrefix, validateKeys) {
  var metaTablesDefined = typeInfoTable != null && typeNameTable != null;
  var typeCode = null;
  if(metaTablesDefined) {
   this.typeInfoHelper.EnsureTypeInfoTableCompliant(value, typeInfoTable, pathInPropertiesTree);
   typeCode = typeInfoTable[pathInPropertiesTree];
  } else {
   typeCode = value.constructor === Array ?
    this.typeInfoHelper.GetArrayTypeCode() : this.typeInfoHelper.GetStringTypeCode();
  }
  if(typeof(typeCode) != "undefined")
   serializedData.Append(typeCode);
  serializedData.Append(this.separator);
  if(typeof(typeCode) == "undefined" || this.typeInfoHelper.IsDictionaryValue(value, typeCode)) {
   for(var key in value) {
    var serializableKey = key;
    if(keyNamePrefix.length > 0)
     serializableKey = serializableKey.slice(keyNamePrefix.length);
    if(validateKeys)
     this.AssertKeyIsValid(serializableKey);
    serializedData.Append(serializableKey);
    serializedData.Append(this.separator);
    this.SerializeCore(value[key], pathInPropertiesTree.length > 0 ? (pathInPropertiesTree + this.separator + key) : key,
     serializedData, typeInfoTable, typeNameTable, "", validateKeys);   
   }
   serializedData.Append(this.sentinel);
  } else if(this.typeInfoHelper.IsListValue(value, typeCode)) {
   for(var i = 0; i < value.length; i++)
    this.SerializeCore(value[i], pathInPropertiesTree.length > 0 ? (pathInPropertiesTree + this.separator + i) : i,
     serializedData, typeInfoTable, typeNameTable, "", validateKeys);
   serializedData.Append(this.sentinel);
  } else if(this.typeInfoHelper.IsAtomValue(value, typeCode))
   this.SerializeAtomValue(value, serializedData, typeCode);
 },
 SerializeAtomValue: function(value, sb, typeCode) {
  var valueStr = this.SerializeAtomValueCore(value, typeCode);
  sb.Append(valueStr.length.toString());
  sb.Append(this.separator);
  sb.Append(valueStr);
 },
 SerializeAtomValueCore: function(value, typeCode) {
  var isString = this.typeInfoHelper.IsStringTypeCode(typeCode);
  if(value == null)
   return isString ? "0" : "";
  else {
   if(isString) {
    value = this.PreventStringModificationByInput(value); 
    return "1" + value;
   } else {
    var ctor = value.constructor;
    if(ctor === String )
     return value;
    else if(ctor === Boolean)
     return value ? "1" : "0";
    else if(ctor === Number)
     return value.toString();
    else if(ctor === Date)
     return String(_aspxToLocalTime(value).valueOf());
    else if(ctor === RegExp) {
     var options = "";
     if(value.ignoreCase)
      options += "i";
     if(value.multiline)
      options += "m";
     return options + "," + value.source;
    }
   }
  }
  alert("Unable to serialize value " + value.toString() + " (Constructor: " + value.constructor.toString() + ").");
 },
 AssertKeyIsValid: function(key) {
  if(!key)
   alert("Empty key.");
  else {
   key = key.toLowerCase();
   var code = key.charCodeAt(0);
   if(!(this.IsLowercaseLetterCharCode(code) || code == this.charCodes["_"] || code == this.charCodes["$"]))
    alert("Invalid key '" + key + "'.");
   for(var i = 1; i < key.length; i++) {
    code = key.charCodeAt(i);
    if(!(this.IsLowercaseLetterOrDigitCharCode(code) || code == this.charCodes["_"] || code == this.charCodes["$"]))
     alert("Invalid key '" + key + "'.");
   }
  }
 },
 CreateCharCodeList: function(chars) {
  var charCodes = { };
  for(var i = 0; i < chars.length; i++) {
   var ch = chars[i];
   charCodes[ch] = ch.charCodeAt(0);
  }
  return charCodes;
 },
 IsLowercaseLetterCharCode: function(charCode) {
  return charCode >= this.charCodes["a"] && charCode <= this.charCodes["z"];
 },
 IsLowercaseLetterOrDigitCharCode: function(charCode) {
  if(this.IsLowercaseLetterCharCode(charCode))
   return true;
  else
   return charCode >= this.charCodes["0"] && charCode <= this.charCodes["9"];
 },
 PreventStringModificationByInput: function(str) {
  this.sb.Clear();
  var startPos = 0;
  for(var i = 0; i < str.length; i++) {
   var currentCh = str.charAt(i);
   if(currentCh == '\r' && (i == str.length - 1 || str.charAt(i + 1) != '\n') ||
    currentCh == '\n' && (i == 0 || str.charAt(i - 1) != '\r')) {
    if(startPos >= 0)
     this.sb.Append(str.substring(startPos, i));
    startPos = i + 1;
    this.sb.Append("\r\n");
   }
  }
  if(0 <= startPos && startPos <= str.length)
   this.sb.Append(str.substring(startPos, str.length));
  return this.sb.ToString();
 }
});
function _aspxGetHiddenFieldSerializer() {
 if(!window.__aspxHiddenFieldSerializer)
  window.__aspxHiddenFieldSerializer = new ASPxHiddenFieldSerializer();
 return window.__aspxHiddenFieldSerializer;
}
var __aspxMenuAnimationAccelerator = 1/10;
var __aspxPCAnimationAccelerator = 1/3;
var __aspxAnimationDiscardPixels = 3;
var __aspxPopupShadowWidth = 5;
var __aspxPopupShadowHeight = 5;
var __aspxNotSetAlignIndicator = "NotSet";
var __aspxInnerAlignIndicator = "Sides";
function _aspxIsAlignNotSet(align){
 return align == __aspxNotSetAlignIndicator;
}
function _aspxIsInnerAlign(align){
 return align.indexOf(__aspxInnerAlignIndicator) != -1;
}
function _aspxIsOuterAlign(align){
 return (!this.IsInnerAlign(align)) && (!_aspxIsAlignNotSet(align));
}
function _aspxPopupPosition(position, isInverted){
 this.position = position;
 this.isInverted = isInverted;
}
function _aspxSegment(pos, len){
 this.pos = pos;
 this.len = len;
}
function _aspxRect(left, top, width, height){
 this.left = left;
 this.top = top;
 this.width = width;
 this.height = height;
}
function _aspxSize(width, height){
 this.width = width;
 this.height = height;
}
function _aspxFindPopupElementById(id){
 if(id == "") return null; 
 var popupElement = _aspxGetElementById(id);
 if(!_aspxIsExistsElement(popupElement)){
  var idParts = id.split("_");
  var uniqueId = idParts.join("$");
  popupElement = _aspxGetElementById(uniqueId);
 }
 return popupElement;
}
function _aspxFindEventSourceParentByTestFunc(evt, testFunc){
 return _aspxFindParentByTestFunc(_aspxGetEventSource(evt), testFunc);
}
function _aspxFindParentByTestFunc(element, testFunc){
 if (!_aspxIsExists(testFunc)) return null;
 while(element != null && element.tagName != "BODY"){
  if(testFunc(element))
   return element;
  element = element.parentNode;     
 }
 return null;
}
function _aspxPreventContextMenu(evt){
 if (__aspxWebKitFamily){
  if(evt.stopPropagation)
   evt.stopPropagation();
  evt.returnValue = false;
  if(evt.preventDefault)
   evt.preventDefault();
 } else if (__aspxNetscapeFamily)
  evt.preventDefault();
}
function _aspxIsExistsAbsolutePosParent(element){
 return _aspxIsExistsParentWithSpecPosition(element, ["absolute"]);
}
function _aspxIsExistsAbsoluteOrRelativePosParent(element){
 return _aspxIsExistsParentWithSpecPosition(element, ["absolute", "relative"]);
}
function _aspxIsExistsParentWithSpecPosition(element, positions){
 var curEl = element.offsetParent;
 while(curEl != null) {
  for(var i = 0; i < positions.length; i ++){
   if (_aspxGetCurrentStyle(curEl).position == positions[i])
    return true;
  }
  curEl = curEl.offsetParent;
 }
 return false;
}
function _aspxAdjustPositionToClientScreen(element, shadowSize, pos, isX){
 var min = isX ? _aspxGetDocumentScrollLeft() : _aspxGetDocumentScrollTop();
 var max = min + (isX ? _aspxGetDocumentClientWidth() : _aspxGetDocumentClientHeight());
 max -= (isX ? element.offsetWidth + shadowSize : element.offsetHeight + shadowSize);
 if (pos > max) pos = max;
 if (pos < min) pos = min;
 return pos;
}
function _aspxGetPopupAbsoluteX(element, shadowWidth, popupElement, hAlign, hOffset, x, left){
 var width = element.offsetWidth;
 var bodyWidth = _aspxGetDocumentClientWidth();
 var elementX = _aspxGetAbsoluteX(popupElement);
 var scrollX = _aspxGetDocumentScrollLeft();
 if (hAlign == "WindowCenter"){
  var showAtPos = x != __aspxInvalidPosition && !_aspxIsExists(popupElement);
  if(showAtPos)
   hAlign = "";
  else
   return new _aspxPopupPosition(Math.ceil(bodyWidth / 2 - width / 2) + scrollX + hOffset, false);
 }
 if (_aspxIsExists(popupElement)){
  var leftX = elementX - width;
  var rightX = elementX + popupElement.offsetWidth;
  var innerLeftX = elementX;
  var innerRightX = elementX + popupElement.offsetWidth - width;
  var isMoreFreeSpaceLeft = bodyWidth - (rightX + width) < leftX - 2 * scrollX;
 }
 else
  hAlign = "";
 var isInverted = false; 
 if (hAlign == "OutsideLeft"){
  isInverted = !(leftX - scrollX > 0 || isMoreFreeSpaceLeft);
  if(isInverted)
   x = rightX - hOffset;
  else
   x = leftX + hOffset;
 }
 else if (hAlign == "LeftSides"){
  x =  innerLeftX + hOffset;
  x = _aspxAdjustPositionToClientScreen(element, shadowWidth, x, true);
 }
 else if (hAlign == "Center"){
  x =  elementX + Math.round((popupElement.offsetWidth  - width) / 2) + hOffset;
 }
 else if (hAlign == "RightSides"){
  x = innerRightX + hOffset;
  x = _aspxAdjustPositionToClientScreen(element, shadowWidth, x, true);
 }
 else if (hAlign == "OutsideRight"){
  isInverted = !(rightX + width < bodyWidth + scrollX || !isMoreFreeSpaceLeft);
  if(isInverted)
   x = leftX - hOffset;
  else
   x = rightX + hOffset;
 }
 else{
  if (!_aspxGetIsValidPosition(x))
   x = (_aspxIsExists(popupElement)) ? _aspxGetAbsoluteX(popupElement) : left;
  isInverted = x - scrollX + width > bodyWidth && x - scrollX > bodyWidth / 2;
  if(isInverted)
   x = x - width - hOffset;
  else
   x = x + hOffset;
 }
 return new _aspxPopupPosition(x, isInverted);
}
function _aspxGetPopupAbsoluteY(element, shadowHeight, popupElement, vAlign, vOffset, y, top){
 var height = element.offsetHeight;
 var bodyHeight = _aspxGetDocumentClientHeight(); 
 var elementY = _aspxGetAbsoluteY(popupElement);
 var scrollY = _aspxGetDocumentScrollTop();
 if (vAlign == "WindowCenter"){
  var showAtPos = y != __aspxInvalidPosition && !_aspxIsExists(popupElement);
  if(showAtPos)
   hAlign = "";
  else
   return new _aspxPopupPosition(Math.ceil(bodyHeight / 2 - height / 2) + scrollY + vOffset, false);
 }
 if (_aspxIsExists(popupElement)){
  var bottomY = elementY + popupElement.offsetHeight;
  var topY = elementY - height;
  var innerBottomY = elementY + popupElement.offsetHeight - height;
  var innerTopY = elementY;
  var isMoreFreeSpaceAbove = bodyHeight - (bottomY + height) < topY - 2 * scrollY;
 }
 else
  vAlign = "";
 var isInverted = false;
 if (vAlign == "Above"){
  isInverted = !(topY - scrollY > 0 || isMoreFreeSpaceAbove);
  if(isInverted)
   y = bottomY - vOffset;
  else
   y = topY + vOffset;
 }
 else if (vAlign == "TopSides"){
  y = innerTopY + vOffset;
  y = _aspxAdjustPositionToClientScreen(element, shadowHeight, y, false);
 }
 else if (vAlign == "Middle"){
  y =  elementY + Math.round((popupElement.offsetHeight  - height) / 2) + vOffset;
 }
 else if (vAlign == "BottomSides"){
  y = innerBottomY + vOffset;
  y = _aspxAdjustPositionToClientScreen(element, shadowHeight, y, false);
 }
 else if (vAlign == "Below"){
  isInverted = !(bottomY + height < bodyHeight + scrollY || !isMoreFreeSpaceAbove);
  if(isInverted)
   y = topY - vOffset;
  else
   y = bottomY + vOffset;
 }
 else{
  if (!_aspxGetIsValidPosition(y))
   y = (_aspxIsExists(popupElement)) ? _aspxGetAbsoluteY(popupElement) : top;
  isInverted = y - _aspxGetDocumentScrollTop() + height > bodyHeight && y - _aspxGetDocumentScrollTop() > bodyHeight / 2;
  if(isInverted)
   y = y - height - vOffset;
  else
   y = y + vOffset;
 }
 return new _aspxPopupPosition(y, isInverted);
}
function _aspxGetIntersectionRect(left1, top1, left2, top2, width, height){
 var segment1 = _aspxGetIntersectionSegment(left1, left2, width);
 var segment2 = _aspxGetIntersectionSegment(top1, top2, height);
 if (segment1 != null && segment2 != null){
  var left = segment1.pos;
  var top = segment2.pos;
  var width = segment1.len;
  var height = segment2.len;
  return new _aspxRect(left, top, width, height);
 }
 return null;
}
function _aspxGetIntersectionSegment(pos1, pos2, len){
 var posDifferense = Math.abs(pos1 - pos2);
 if (posDifferense <= len){
  var pos = pos1 > pos2 ? pos1 : pos2;
  var len = len - posDifferense;
  return new _aspxSegment(pos, len);
 }
 return null;
}
function _aspxRemoveFocus(parent){
 var input = document.createElement('input');
 _aspxConcealInputElement(input);
 parent.appendChild(input);
 input.focus();
 _aspxRemoveElement(input);
} 
function _aspxConcealInputElement(input){
 input.style.position = "absolute";
 input.style.left = 0;
 input.style.top = 0;
 if(__aspxWebKitFamily) {
    input.style.opacity = 0;
    input.style.width = 1;
    input.style.height = 1;
 } else {
  input.style.border = 0;
  input.style.width = 0;
  input.style.height = 0;
   }
}
function _aspxInitAnimationDiv(element, x, y, onTimerString, onAnimStopCallString){
 element.animationStart = new Date();
 element.absoluteLeft = x;
 element.absoluteTop = y;
 element.popuping = true;
 element.onTimerString = onTimerString;
 element.onAnimStopCallString = onAnimStopCallString;
 element.style.overflow = "hidden";
 element.style.position = "absolute";
 _aspxSetStylePosition(element, x,y);
 _aspxSetStyleSize(element, element.offsetWidth, element.offsetHeight);
}
function _aspxOnAnimationTimer(animationDivElement, element, mainCell, iframeElement, animationDelay, animationMaxDelay, animationAccelerator){
 animationDivElement.timerID = _aspxClearTimer(element.timerID);
 var timeExpired = new Date() - animationDivElement.animationStart > animationMaxDelay;
 var left = !timeExpired ? _aspxGetNextAnimationPosInternal(element.offsetLeft, animationAccelerator) : 0;
 var top = !timeExpired ? _aspxGetNextAnimationPosInternal(element.offsetTop, animationAccelerator) : 0;
 element.style.top = top + "px";
 element.style.left = left + "px";
 var rect = _aspxGetIntersectionRect(animationDivElement.offsetLeft, animationDivElement.offsetTop, 
  element.offsetLeft + animationDivElement.offsetLeft, element.offsetTop + animationDivElement.offsetTop,
  mainCell.offsetWidth, mainCell.offsetHeight);
 if (_aspxIsExists(rect) && _aspxIsExists(iframeElement)){
  _aspxSetStylePosition(iframeElement, rect.left, rect.top);
  _aspxSetStyleSize(iframeElement, rect.width, rect.height);
 }
 if(timeExpired || (left == 0 && top == 0))
  _aspxAnimationFinished(animationDivElement);
 else 
  animationDivElement.timerID = window.setTimeout(animationDivElement.onTimerString, animationDelay);
}
function _aspxGetNextAnimationPosInternal(pos, animationAccelerator){
 pos = Math.round(pos * animationAccelerator);
 if (Math.abs(pos) < __aspxAnimationDiscardPixels)
  pos = 0;
 return pos;
}
function _aspxAnimationFinished(element){
 if(_aspxStopAnimation(element) && _aspxIsExists(element.onAnimStopCallString) && 
  element.onAnimStopCallString !== ""){
  window.setTimeout(element.onAnimStopCallString, 0);
 }
}
function _aspxStopAnimation(element){
 if(element.popuping){
  element.popuping = false;
  element.onTimerString = "";
  element.style.overflow = "visible";
  return true;
 }
 return false;
}
function _aspxGetAnimationHorizontalDirection(popupPosition, horizontalAlign, verticalAlign){
 if (_aspxIsInnerAlign(horizontalAlign) 
  && !_aspxIsInnerAlign(verticalAlign) 
  && !_aspxIsAlignNotSet(verticalAlign))
  return 0;
 var toTheLeft = (horizontalAlign == "OutsideLeft" || horizontalAlign == "RightSides") ^ popupPosition.isInverted;
 return toTheLeft ? 1 : -1;
}
function _aspxGetAnimationVerticalDirection(popupPosition, horizontalAlign, verticalAlign){
 if (_aspxIsInnerAlign(verticalAlign) 
  && !_aspxIsInnerAlign(horizontalAlign) 
  && !_aspxIsAlignNotSet(horizontalAlign))
  return 0;
 var toTheTop = (verticalAlign == "Above" || verticalAlign == "BottomSides") ^ popupPosition.isInverted;
 return toTheTop ? 1 : -1;
}
var __aspxHideBodyScrollCount = 0;
function _aspxHideBodyScroll(){
 __aspxHideBodyScrollCount++;
 if(__aspxHideBodyScrollCount > 1) 
  return;
 if(__aspxIE){
  _aspxChangeAttribute(document.body, "scroll", "no");
  _aspxChangeStyleAttribute(document.documentElement, "overflow", "hidden");
 } else if(__aspxFirefox && __aspxBrowserVersion < 3) { 
  var scrollTop = document.documentElement.scrollTop;
  _aspxChangeStyleAttribute(document.body, "overflow", "hidden");
  document.documentElement.scrollTop = scrollTop;
 } else
  _aspxChangeStyleAttribute(document.body, "overflow", "hidden");
   _aspxChangeStyleAttribute(document.body, "marginRight", "16px");
}
function _aspxRestoreBodyScroll(){
 __aspxHideBodyScrollCount--;
 if(__aspxHideBodyScrollCount > 0) 
  return;
 if(__aspxIE){
  _aspxRestoreAttribute(document.body, "scroll");
  _aspxRestoreStyleAttribute(document.documentElement, "overflow");
 }
 else
  _aspxRestoreStyleAttribute(document.body, "overflow");
 _aspxRestoreStyleAttribute(document.body, "marginRight");
 if(__aspxWebKitFamily){ 
  var scrollTop = document.body.scrollTop;
  document.body.scrollTop ++;
  document.body.scrollTop --;
  document.body.scrollTop = scrollTop;
 }
}
function _aspxCoordinatesInDocumentRect(x, y){
 var docScrollLeft = _aspxGetDocumentScrollLeft();
 var docScrollTop = _aspxGetDocumentScrollTop();
 return (x > docScrollLeft && y > docScrollTop && 
  x < _aspxGetDocumentClientWidth() + docScrollLeft && 
  y < _aspxGetDocumentClientHeight() + docScrollTop);
}
function _aspxGetElementZIndexArray(element){  
 var currentElement = element;
 var zIndexesArray = [0];
 while(_aspxIsExists(currentElement) && currentElement.tagName != "BODY") {
  if(_aspxIsExists(currentElement.style)) {
   if(typeof(currentElement.style.zIndex) != "undefined" && currentElement.style.zIndex != "")
    zIndexesArray.unshift(currentElement.style.zIndex);
  }
  currentElement = currentElement.parentNode;
 }
 return zIndexesArray;   
}
function _aspxIsHigher(higherZIndexArrat, zIndexArray){
 if (zIndexArray == null) return true;
 var count = (higherZIndexArrat.length >= zIndexArray.length) ? higherZIndexArrat.length : zIndexArray.length;
 for (var i = 0; i < count; i++) 
    if(typeof(higherZIndexArrat[i]) != "undefined" && typeof(zIndexArray[i]) != "undefined"){
    if (higherZIndexArrat[i] != zIndexArray[i]) return higherZIndexArrat[i] > zIndexArray[i];   
    } else return typeof(zIndexArray[i]) == "undefined";  
 return true;   
}
function _aspxTestIsPopupElement(element) {
 return _aspxIsExists(element.DXPopupElementControl);
}
var _aspxClientOverControlUtils = {
 GetPopupElementByEvt: function(evt) {
  return _aspxFindEventSourceParentByTestFunc(evt, _aspxTestIsPopupElement);
 },
 OnMouseEvent: function (evt, mouseOver) {
  var popupElement = _aspxClientOverControlUtils.GetPopupElementByEvt(evt);
  if (mouseOver) 
   popupElement.DXPopupElementControl.OnPopupElementMouseOver(evt, popupElement);
  else 
   popupElement.DXPopupElementControl.OnPopupElementMouseOut(evt, popupElement);
 },
 OnMouseOut: function(evt) {
  _aspxClientOverControlUtils.OnMouseEvent(evt, false);
 },
 OnMouseOver: function(evt) {
  _aspxClientOverControlUtils.OnMouseEvent(evt, true);
 }
}
var __aspxPCWIdSuffix = "_PW";
function ASPxPCResizeCursorInfo(horizontalDirection, verticalDirection, horizontalOffset, verticalOffset){
 this.horizontalDirection = horizontalDirection;
 this.verticalDirection = verticalDirection;
 this.horizontalOffset = horizontalOffset;
 this.verticalOffset = verticalOffset;
 this.course = verticalDirection + horizontalDirection;
}
ASPxClientPopupControl = _aspxCreateClass(ASPxClientControl, {
 constructor: function(name){
  this.constructor.prototype.constructor.call(this, name);
  this.leadingAfterInitCall = true; 
  this.adjustInnerControlsSizeOnShow = true;
  this.animationDelay = 30;
  this.animationMaxDelay = 400;  
  this.appearAfter = 300;
  this.disappearAfter = 500;
  this.allowResize = false;
  this.enableAnimation = true;
  this.shadowVisible = true;
  this.allowCorrectYOffsetPosition = true; 
  this.contentUrl = "";
  this.contentUrlArray = [];
  this.cookieName = "";
  this.closeAction = "OuterMouseClick";
  this.popupAction = "LeftMouseClick";
  this.closeActionArray = [];
  this.popupActionArray = [];
  this.popupElementID = "";
  this.popupElementIDArray = [];
  this.showOnPageLoad = false;
  this.showOnPageLoadArray = [];
  this.popupHorizontalAlign = __aspxNotSetAlignIndicator;
  this.popupVerticalAlign = __aspxNotSetAlignIndicator;
  this.popupHorizontalOffset = 0;
  this.popupVerticalOffset = 0;
  this.windows = []; 
  this.windowCount = 0;
  this.isDragged = false;
  this.isResized = false;
  this.zIndex = -1;
  this.left = 0;
  this.top = 0;
  this.iframeLoading = false;
  this.isDraggedArray = [];
  this.isResizedArray = [];
  this.zIndexArray = [];
  this.leftArray = [];
  this.topArray = [];
  this.height = 0;
  this.width = 0;
  this.heightArray = [];
  this.widthArray = [];
  this.iframeLoadingArray = [];
  this.isLiveResizingMode = true;
  this.isPopupPositionCorrectionOn = true;
  this.SSLSecureBlankUrl = "";
  this.windowElements = new Object();
  this.hideBodyScrollWhenModal = true;
  this.autoUpdatePosition = false;
  this.isNeedPopupedSet = false;
  this.cachedSize = null;
  this.cachedSizeArray = [];
  this.fakeDragDiv = null;
  this.popupElement = null;
  this.popupElements = [];
  this.headerHeight = 0;
  this.headerHeightArray = [];
  this.footerHeight = 0;
  this.footerHeightArray = [];
  this.ResizeBorderSize = 6;
  this.ResizeCornerBorderSize = 20;
  this.CloseButtonClick = new ASPxClientEvent();
  this.CloseUp = new ASPxClientEvent();
  this.Closing = new ASPxClientEvent();
  this.PopUp = new ASPxClientEvent();
  this.Resize = new ASPxClientEvent();
  this.Shown = new ASPxClientEvent();
  this.BeforeResizing = new ASPxClientEvent();
  this.AfterResizing = new ASPxClientEvent();
  aspxGetPopupControlCollection().Add(this);
 },
 Initialize: function(){
  this.InitializeArrays();
  if (this.HasDefaultWindow())
   this.InitializeWindow(-1);
  for(var i = 0; i < this.popupElementIDArray.length; i ++) 
   this.InitializeWindow(i);
  this.constructor.prototype.Initialize.call(this);
 },
 AfterInitialize: function(){
  if (this.HasDefaultWindow())
   this.AfterInitializeWindow(-1);
  for(var i = 0; i < this.popupElementIDArray.length; i ++) 
   this.AfterInitializeWindow(i);
  this.constructor.prototype.AfterInitialize.call(this);
 },
 InitializeArrays: function(){
  if (this.GetWindowCountCore() > 0){
   if (this.contentUrlArray.length == 0)
    this.InitializeArray(this.contentUrlArray, "");
   if (this.popupActionArray.length == 0)
    this.InitializeArray(this.popupActionArray, this.popupAction);
   if (this.closeActionArray.length == 0)
    this.InitializeArray(this.closeActionArray, this.closeAction);
   if (this.popupElementIDArray.length == 0)
    this.InitializeArray(this.popupElementIDArray, "");
   if (this.showOnPageLoadArray.length == 0)
    this.InitializeArray(this.showOnPageLoadArray, false);
   if (this.isDraggedArray.length == 0)
    this.InitializeArray(this.isDraggedArray, false);
   if (this.isResizedArray.length == 0)
    this.InitializeArray(this.isResizedArray, false);
   if (this.zIndexArray.length == 0)
    this.InitializeArray(this.zIndexArray, -1);    
   if (this.leftArray.length == 0)
    this.InitializeArray(this.leftArray, 0);
   if (this.topArray.length == 0)
    this.InitializeArray(this.topArray, 0);
   if (this.widthArray.length == 0)
    this.InitializeArray(this.widthArray, 0);
   if (this.heightArray.length == 0)
    this.InitializeArray(this.heightArray, 0);
   if (this.cachedSizeArray.length == 0)
    this.InitializeArray(this.cachedSizeArray, null);
   if (this.iframeLoadingArray.length == 0)
    this.InitializeArray(this.iframeLoadingArray, false);
   if (__aspxIE){
    if (this.headerHeightArray.length == 0)
     this.InitializeArray(this.headerHeightArray, -1);
    if (this.footerHeightArray.length == 0)
     this.InitializeArray(this.footerHeightArray, -1);
   }
  }
 },
 InitializeArray: function(array, value){
  for (var i = 0; i < this.GetWindowCountCore(); i++)
   array[i] = value;
 },
 InitializeWindow: function(index){
  this.GetPopupElement(index);
  var element = this.GetWindowElement(index);
  if (element != null){
   element.onresize = new Function("aspxPWResize(\""+ this.name + "\",\"" + element.id + "\");");
   if (__aspxIE)
    this.AttachOnDragStartEventToWindowImages(index);
   this.InitIFrame(index);
   element.isHiding = false;
   element.isIEContentHeightInit = false;
   element.isPopupPositionCorrectionOn = this.isPopupPositionCorrectionOn || !this.GetShowOnPageLoad(index);
   if (this.GetShowOnPageLoad(index) && this.GetZIndex(index) > 0){
    this.FirstShowWindow(index, false);
    aspxGetPopupControlCollection().SetWindowElementZIndex(element, this.GetZIndex(index));
    element.isPopupPositionCorrectionOn = true;
   }
  }
 },
 InitIFrame: function(index){
  var contentIFrameElement = this.GetWindowContentIFrameElement(index);
  if(_aspxIsExists(contentIFrameElement)){
   contentIFrameElement.popupControlName = this.name;
   contentIFrameElement.pcWndIndex = index;
   _aspxAttachEventToElement(contentIFrameElement, "load", aspxPCIframeLoad);
  }
 },
 AfterInitializeWindow: function(index){
  if (this.GetShowOnPageLoad(index) && this.GetZIndex(index) < 0){
   this.FirstShowWindow(index, true);
   var element = this.GetWindowElement(index);
   if (element != null)
    element.isPopupPositionCorrectionOn = true;  
  }
 },
 AttachOnDragStartEventToWindowImages: function(index) {   
  this.AttachChildImagesPreventDragStartEvent(this.GetWindowHeaderElement(index));
  this.AttachChildImagesPreventDragStartEvent(this.GetWindowFooterElement(index));
 },
 AttachChildImagesPreventDragStartEvent: function(parentElem) {
  var images = parentElem == null ? null : _aspxGetElementsByTagName(parentElem, "img");
  if (images != null) {  
   for(var i = 0; i < images.length; i ++)
    images[i].ondragstart = new Function("return _aspxPreventDragStart(event)");  
   } 
 },
 FirstShowWindow: function(index, allowChangeZIndex){
  var isFreeWindow = this.GetIsDragged(index);
  var x = __aspxInvalidPosition;
  var y = __aspxInvalidPosition;
  if (isFreeWindow){
   x = this.GetWindowLeft(index);
   y = this.GetWindowTop(index);
   var popupHorizontalOffsetBackup = this.popupHorizontalOffset;
   var popupVerticalOffsetBackup = this.popupVerticalOffset;
   this.popupHorizontalOffset = 0;
   this.popupVerticalOffset = 0;
  }
  var enableAnimationBackup = this.enableAnimation;
  this.enableAnimation = false;
  this.DoShowWindowAtPos(index, x, y, isFreeWindow, false, allowChangeZIndex);
  this.enableAnimation = enableAnimationBackup;
  if (isFreeWindow){
   this.popupHorizontalOffset = popupHorizontalOffsetBackup ;
   this.popupVerticalOffset = popupVerticalOffsetBackup;
  }
 },
 GetIsDragged: function(index){
  if(0 <= index && index < this.isDraggedArray.length)
   return this.isDraggedArray[index];
  return this.isDragged;
 },
 SetIsDragged: function(index, value){
  if(0 <= index && index < this.isDraggedArray.length)
   this.isDraggedArray[index]=value;
  else   
   this.isDragged=value;
 },
 GetIsResized: function(index){
  if(0 <= index && index < this.isResizedArray.length)
   return this.isResizedArray[index];
  return this.isResized;
 },
 SetIsResized: function(index, value){
  if(0 <= index && index < this.isResizedArray.length)
   this.isResizedArray[index]=value;
  else   
   this.isResized=value;
 },
 HasDefaultWindow: function() {
  return this.GetWindowCountCore() == 0;
 },
 GetCurrentLeft: function(index){
  return this.GetPosition(index, true);
 },
 GetCurrentTop: function(index){
  return this.GetPosition(index, false);
 },
 GetHeaderHeight: function(index){
  if(0 <= index && index < this.headerHeightArray.length)
   return this.headerHeightArray[index];
  return this.headerHeight;
 },
 GetFooterHeight: function(index){
  if(0 <= index && index < this.footerHeightArray.length)
   return this.footerHeightArray[index];
  return this.footerHeight;
 },
 SetHeaderHeight: function(index, height){
  if(0 <= index && index < this.headerHeightArray.length)
   this.headerHeightArray[index] = height;
  else
   this.headerHeight = height;
 },
 SetFooterHeight: function(index, height){
  if(0 <= index && index < this.footerHeightArray.length)
   return this.footerHeightArray[index] = height;
  else 
   this.footerHeight = height;
 },
 GetPosition: function(index, isLeft){
  if(0 <= index && index < this.GetWindowCountCore())
   return  isLeft ? this.leftArray[index] : this.topArray[index];
  return  isLeft ? this.left : this.top;
 },
 SetPopupElementReference: function(index, popupElement, attach) {
  if(!_aspxIsExistsElement(popupElement)) return;
  var setReferenceFunction = attach ? _aspxAttachEventToElement : _aspxDetachEventFromElement;
  var windowPopupAction = this.GetWindowPopupAction(index);       
  if(windowPopupAction == "LeftMouseClick")
   setReferenceFunction(popupElement, "mouseup", aspxPEMEvent);
  else if (windowPopupAction == "RightMouseClick")
   setReferenceFunction(popupElement, "contextmenu", aspxPEMEvent);
  else if (windowPopupAction == "MouseOver") {
   setReferenceFunction(popupElement, "mouseover",  _aspxClientOverControlUtils.OnMouseOver );     
   setReferenceFunction(this.GetWindowElement(index), "mouseover", aspxPWEMOver);
  }     
  if (windowPopupAction == "LeftMouseClick" || windowPopupAction == "RightMouseClick") {
   setReferenceFunction(popupElement, "mousedown", aspxPEMEvent);
   this.isNeedPopupedSet = true;
  }  
  if(attach) {
   popupElement.DXPopupElementControl = this;
   popupElement.DXPopupWindowIndex = index;
   popupElement.isPopuped = false;
   this.SetPopupElementIDInternal(index, popupElement.id);
   this.SetPopupElementInternal(index, popupElement);
  } else 
     popupElement.DXPopupElementControl = popupElement.DXPopupWindowIndex = popupElement.isPopuped = undefined; 
 },
 AttachToPopupElement: function(index, newPopupElementId) {
  var oldPopupElementId = this.GetPopupElementIDInternal(index);
  var popupElementId = _aspxIsExists(newPopupElementId) ? newPopupElementId : oldPopupElementId;
  var popupElement = _aspxFindPopupElementById(popupElementId);
  if(popupElementId != oldPopupElementId) 
   if(aspxGetPopupControlCollection().IsDisappearTimerActive()) {      
      aspxGetPopupControlCollection().ClearDisappearTimer();
      this.Hide(index);
   }
  this.SetPopupElementReference(index, popupElement, true);
 },
 DetachFromPopupElement: function(index) {
  var popupElement = this.GetPopupElementInternal(index);
  this.SetPopupElementIDInternal(index, "");
  this.SetPopupElementInternal(index, null);
  this.SetPopupElementReference(index, popupElement, false);
 },
 GetPopupElement: function(index){
  var popupElement = this.GetPopupElementInternal(index);
  var modalElement = this.GetWindowModalElement(index);
  if(_aspxIsExists(modalElement))
   _aspxAttachEventToElement(modalElement, "mousedown", aspxPWMEMDown);
  if(!_aspxIsExistsElement(popupElement)){
   this.AttachToPopupElement(index);
  }
  return popupElement;
 },
 GetPopupElementInternal: function(index){
  if(0 <= index && index < this.GetWindowCountCore())
   return this.popupElements[index];
  return this.popupElement;
 },
 SetPopupElementInternal: function(index, element){
  if(0 <= index && index < this.GetWindowCountCore())
   this.popupElements[index] = element;
  else
   this.popupElement = element;
 },
 GetPopupElementIDInternal: function(index){
  if(0 <= index && index < this.GetWindowCountCore())
   return this.popupElementIDArray[index];
  return this.popupElementID;
 },
 SetPopupElementIDInternal: function(index, popupElementID) {
  if(0 <= index && index < this.GetWindowCountCore())
   this.popupElementIDArray[index] = popupElementID;
  else this.popupElementID = popupElementID;
 },
 GetShadowWidth: function(){
  return this.shadowVisible ? __aspxPopupShadowWidth : 0;
 },
 GetShadowHeight: function(){
  return this.shadowVisible ? __aspxPopupShadowHeight : 0;
 },
 GetShowOnPageLoad: function(index){
  if(0 <= index && index < this.showOnPageLoadArray.length)
   return this.showOnPageLoadArray[index];
  return this.showOnPageLoad;
 },
 GetWindowCountCore: function(){
  return (this.windows.length > 0) ? this.windows.length : this.windowCount;
 },
 GetWindowIFrame: function(index){
  var element = this.GetWindowElement(index);
  var iFrame = element.overflowElement;
  if(!_aspxIsExists(iFrame)){
   iFrame = this.FindWindowIFrame(index);
   element.overflowElement = iFrame;
  }
  return iFrame;
 },
 FindWindowIFrame: function(index){
  return _aspxGetElementById(this.name + "_DXPWIF" + index);
 },
 GetWindowModalElement: function(index){
  var element = this.GetWindowElement(index);
  if(!_aspxIsExists(element)) return;
  var modalElement = element.modalElement;
  if(!_aspxIsExists(modalElement)){
   modalElement = this.FindWindowModalElement(index);
   element.modalElement = modalElement;
   if(_aspxIsExists(modalElement)){
    modalElement.DXModalPopupControl = this;
    modalElement.DXModalPopupWindowIndex = index;
   }
  }
  return modalElement;
 },
 FindWindowModalElement: function(index){
  return _aspxGetElementById(this.name + "_DXPWMB" + index);
 },
 GetWindowElementId: function(index){
  return this.name + __aspxPCWIdSuffix + index;
 },  
 WindowIsModal: function(index) {
  return _aspxIsExists(this.GetWindowModalElement(index));
 },
 GetWindowElement: function(index){
  if(!_aspxIsExistsElement(this.windowElements[index]))
   this.windowElements[index] = _aspxGetElementById(this.GetWindowElementId(index));
  return this.windowElements[index];
 },
 GetWindowChild: function(index, idPostfix){
  return _aspxGetChildById(this.GetWindowElement(index), this.name + idPostfix);
 },
 GetWindowContentIFrameDivElementID: function(index){
  return this.name + "_CIFD" + index;
 },
 GetWindowContentIFrameDivElement: function(index){
  return this.GetWindowChild(index, "_CIFD" + index);
 },
 GetWindowContentIFrameElementId: function(index){
  return this.name + "_CIF" + index;
 },
 GetWindowContentIFrameElement: function(index){
  return this.GetWindowChild(index, "_CIF" + index);
 },
 GetWindowContentIFrameUrl: function(index){
  if(0 <= index && index < this.contentUrlArray.length)
   return this.contentUrlArray[index];
  return this.contentUrl;
 },
 GetWindowPopupAction: function(index){
  if(0 <= index && index < this.popupActionArray.length)
   return  this.popupActionArray[index];
  return this.popupAction;
 },
 GetWindowCloseAction: function(index){
  if(0 <= index && index < this.closeActionArray.length)
   return  this.closeActionArray[index];
  return this.closeAction;
 },
 SetWindowContentIFrameUrl: function(index, url){
  if(0 <= index && index < this.contentUrlArray.length)
   this.contentUrlArray[index] = url;
  else
   this.contentUrl = url;
 },
 ShowWindowContentUrl: function(index){
  var contentIFrame = this.GetWindowContentIFrameElement(index);
  if(__aspxNetscapeFamily || __aspxWebKitFamily){
   var contentIFrameDiv = this.GetWindowContentIFrameDivElement(index);
   if(_aspxIsExists(contentIFrameDiv))
    this.AdjustIFrameDivHeight(this.GetWindowClientTable(index), contentIFrameDiv, contentIFrame);
   if(_aspxIsExists(contentIFrame))
    contentIFrame.style.height = contentIFrameDiv.clientHeight + "px";
  }
  this.LoadWindowContentUrl(index);
  if(_aspxIsExists(contentIFrame) && contentIFrame.DXReloadAfterShowRequired){
   this.RefreshWindowContentUrl(this.GetWindow(index));
   contentIFrame.DXReloadAfterShowRequired = false;
  }
 },
 LoadWindowContentUrl: function(index){
  var url = this.GetWindowContentIFrameUrl(index);
  this.LoadWindowContentFromUrl(index, url);
 },
 LoadWindowContentFromUrl: function(index, url){
  var element = this.GetWindowContentIFrameElement(index);
  if(_aspxIsExists(element) && element.src != url && element.DXSrcRaw != url){
   this.SetSrcToIframeElement(index, element, url);
   this.SetWindowContentIFrameUrl(index, element.src); 
  }
 },
 SetSrcToIframeElement: function(index, iframeElement, src){
  this.SetIframeLoading(index, true);
  iframeElement.src = src;
  iframeElement.DXSrcRaw = src;
 },
 GetWindowContentElement: function(index){
  return this.GetWindowChild(index, "_PWC" + index);
 },
 GetWindowHeaderElement: function(index){
  return this.GetWindowChild(index, "_PWH" + index);
 },
 GetWindowHeaderGripElement: function(index){
  return this.GetWindowChild(index, "_FGRP" + index);
 },
 GetWindowFooterElement: function(index){
  return this.GetWindowChild(index, "_PWF" + index);
 },
 GetWindowIndex: function(element){
  var id = element.id;
  var pos = id.lastIndexOf(__aspxPCWIdSuffix);
  return parseInt(id.substr(pos + __aspxPCWIdSuffix.length));
 },
 GetWindowMainCell: function(element){
  return this.GetWindowMainTable(element).rows[0].cells[0];
 },
 GetWindowMainTable: function(element){
  var index = this.GetWindowIndex(element);
  var shadowTable = this.GetWindowChild(index, "_PWST" + index);
  return shadowTable != null ? shadowTable : element;
 },
 GetWindowClientTable: function(index){
  return this.GetWindowChild(index, "_CLW" + index);
 },
 GetWindowLeft: function(index){
  if(0 <= index && index < this.leftArray.length)
   return this.leftArray[index];
  return this.left;
 },
 SetWindowLeft: function(index, left){
  if(0 <= index && index < this.leftArray.length)
   this.leftArray[index] = left;
  else
   this.left = left;
 },
 GetWindowHeightInternal: function(index){
  if(0 <= index && index < this.heightArray.length)
   return this.heightArray[index];
  return this.height;
 },
 SetWindowHeight: function(index, height){
  if(0 <= index && index < this.heightArray.length)
   this.heightArray[index] = height;
  else 
   this.height = height;
 },
 GetWindowWidthInternal: function(index){
  if(0 <= index && index < this.widthArray.length)
   return this.widthArray[index];
  return this.width;
 },
 SetWindowWidth: function(index, width){
  if(0 <= index && index < this.widthArray.length)
   this.widthArray[index] = width;
  else 
   this.width = width;
 },
 GetWindowTop: function(index){
  if(0 <= index && index < this.topArray.length)
   return this.topArray[index];
  return this.top;
 },
 SetWindowTop: function(index, top){
  if(0 <= index && index < this.topArray.length)
   return this.topArray[index] = top;
  else
   return this.top = top;
 },
 GetWindowsStateInputElement: function(){
  return _aspxGetElementById(this.name + "WS");
 },
 GetZIndex: function(index){
  if (0 <= index && index < this.zIndexArray.length)
   return this.zIndexArray[index];
  return this.zIndex;
 },
 GetCurrentZIndex: function(index){
  var element = this.GetWindowElement(index);
  if(element != null) {
   if(element.style.zIndex != "") 
    return element.style.zIndex;
   if(0 <= index && index < this.GetWindowCountCore())
    return  this.zIndexArray[index];
   return this.zIndex;
  }
 },
 GetCurrentWindowWidth: function(index){
  var element = this.GetWindowElement(index);
  if(element != null) {
   var mainCell = this.GetWindowMainCell(element);
   if(mainCell.firstChild.offsetWidth > 0)
    return mainCell.firstChild.offsetWidth;
   return this.GetWindowWidthInternal(index);
  }
 },
 GetCurrentWindowHeight: function(index){
  var element = this.GetWindowElement(index);
  if(element != null) {
   var mainCell = this.GetWindowMainCell(element);
   if(mainCell.firstChild.offsetHeight > 0)
    return mainCell.firstChild.offsetHeight;
   return this.GetWindowHeightInternal(index);
  }
 },
 GetIframeLoading: function(index){
  if (0 <= index && index < this.iframeLoadingArray.length)
   return this.iframeLoadingArray[index];
  return this.iframeLoading;
 },
 SetIframeLoading: function(index, value){
  if(0 <= index && index < this.iframeLoadingArray.length)
   this.iframeLoadingArray[index] = value;
  else
   this.iframeLoading = value;
 },
 GetClientPopupPos: function(element, popupElement, pos, isX, isDragged){
  var index = this.GetWindowIndex(element);
  var popupPosition = null;
  if (isDragged)
   popupPosition = new _aspxPopupPosition(this.GetPosition(index, isX), false);
  else
   popupPosition = isX ? this.GetClientPopupPosX(element, popupElement, pos) : this.GetClientPopupPosY(element, popupElement, pos);
  popupPosition.position = _aspxPrepareClientPosForElement(popupPosition.position, element, isX);
  if(__aspxFirefox && __aspxBrowserVersion < 3 && _aspxIsExists(this.GetWindowModalElement(index)))
   popupPosition.position -= isX ? _aspxGetDocumentScrollLeft() : _aspxGetDocumentScrollTop();
  return popupPosition;
 },
 GetClientPopupPosX: function(element, popupElement, x){
  var mainElement = this.GetWindowMainCell(element);
  var popupPosition = _aspxGetPopupAbsoluteX(mainElement, this.GetShadowWidth(), popupElement, this.popupHorizontalAlign, this.popupHorizontalOffset, 
   x, this.GetWindowLeft(this.GetWindowIndex(element)));
  return this.CorrectPopupPositionForClientWindow(element, popupPosition, true);
 },
 GetClientPopupPosY: function(element, popupElement, y){
  var mainElement = this.GetWindowMainCell(element);
  var popupPosition = _aspxGetPopupAbsoluteY(mainElement, this.GetShadowHeight(), popupElement, this.popupVerticalAlign, this.popupVerticalOffset, 
   y, this.GetWindowTop(this.GetWindowIndex(element)));
  return (this.allowCorrectYOffsetPosition ? this.CorrectPopupPositionForClientWindow(element, popupPosition, false) : popupPosition);
 },
 CorrectPopupPositionForClientWindow: function(element, popupPosition, isX){
  if (element.isPopupPositionCorrectionOn){
   popupPosition.position = _aspxAdjustPositionToClientScreen(element, 
    isX ? this.GetShadowWidth() : this.GetShadowHeight(), popupPosition.position, isX);
  }
  return popupPosition;
 },
 DoShowWindow: function(index, evt){
  if (!this.InternalIsWindowVisible(index)){
   var x = _aspxGetEventX(evt);
   var y = _aspxGetEventY(evt);
   this.DoShowWindowAtPos(index, x, y, false, true, true);
  }
 },
 DoShowWindowAtPos: function(index, x, y, ignorePopupElement, closeOtherWindows, allowChangeZIndex){
  var element = this.GetWindowElement(index);
  if(element != null){
   if (this.adjustInnerControlsSizeOnShow) {
    var windowContent = this.GetWindowContentElement(index);
    var collection = aspxGetControlCollection();
    collection.CollapseControls(windowContent, __aspxCheckSizeCorrectedFlag);
   }
   this.FFTextCurFixShow(index, true);
   if (closeOtherWindows)
    aspxGetPopupControlCollection().DoHideAllWindows(null, this.GetWindowElementId(index), false);
   var isMoving = this.InternalIsWindowVisible(index);
   _aspxSetElementDisplay(element, true);
   if(__aspxIE && !element.isIEContentHeightInit){
    element.isIEContentHeightInit = true;
    this.GetWindowContentElement(index).style.height = "0px";
    this.CorrectContentCellHeight(element, false); 
   }
   var cachedSize = this.GetWindowCachedSize(index);
   if(cachedSize != null){
    this.SetWindowSize(this.GetWindow(index), cachedSize.width, cachedSize.height);
    this.ResetWindowCachedSize(index);
   }
   this.RefreshRootDivElementSize(index);
   var popupElement = ignorePopupElement ? null : this.GetPopupElement(index);
   var isDragged = this.GetIsDragged(index);
   var horizontalPopupPosition = this.GetClientPopupPos(element, popupElement, x, true, isDragged);
   var verticalPopupPosition = this.GetClientPopupPos(element, popupElement, y, false, isDragged);
   var clientX = horizontalPopupPosition.position;
   var clientY = verticalPopupPosition.position;
   this.SetWindowPos(index, element, clientX, clientY);
   this.DoShowWindowModalElement(index);
   var isAnimationNeed = this.enableAnimation && !isMoving;
   if (isAnimationNeed)
    this.StartAnimation(element, index, horizontalPopupPosition, verticalPopupPosition);
   else
    _aspxSetElementVisibility(element, true);
   if (!isMoving){
    aspxGetPopupControlCollection().RegisterVisibleWindow(element, this, index);
    this.RaisePopUp(index);
    if(!this.enableAnimation)
     this.RaiseShowen(index);
   }
   if (allowChangeZIndex){
    aspxGetPopupControlCollection().ActivateWindowElement(element);
   }
   if(!isAnimationNeed && __aspxNetscape && _aspxIsExists(this.GetWindowModalElement(index))){
    _aspxSetElementDisplay(element, false);
    _aspxSetElementDisplay(element, true);
   }
   this.ShowWindowContentUrl(index);
   if (this.adjustInnerControlsSizeOnShow) {
    collection.AdjustControls(windowContent, __aspxCheckSizeCorrectedFlag);
   }
  }
 },
 RefreshRootDivElementSize: function(index) {
  if(this.WindowRootElementIsDiv()) {  
   var window = this.GetWindowElement(index);
   var windowMainTable = this.GetWindowMainTable(window);
   _aspxSetStyleSize(window, windowMainTable.offsetWidth, windowMainTable.offsetHeight);  
  }
 },
 WindowRootElementIsDiv: function() {
  return this.enableAnimation;
 },
 DoShowWindowIFrame: function(index, x, y, width, height){
  if (!this.renderIFrameForPopupElements) return;
  var element = this.GetWindowElement(index);
  var iFrame = this.GetWindowIFrame(index);
  if(_aspxIsExists(element) && _aspxIsExists(iFrame)){
   var cell = this.GetWindowMainCell(element);
   if (width < 0)
    width = cell.offsetWidth;
   if (height < 0)
    height = cell.offsetHeight;
   _aspxSetStyleSize(iFrame, width, height);
   if (x != __aspxInvalidPosition && y != __aspxInvalidPosition)
    _aspxSetStylePosition(iFrame, x, y);
   _aspxSetElementDisplay(iFrame, true);
  }
 },
 DoShowWindowModalElement: function(index){
  var modalElement = this.GetWindowModalElement(index);
  if(_aspxIsExists(modalElement)){
   var bodyScrollHasJustBeingHidden = false;
   if(this.hideBodyScrollWhenModal && !this.IsWindowVisible(this.GetWindow(index))){
    bodyScrollHasJustBeingHidden = true;
    aspxGetPopupControlCollection().LockWindowResizeByBodyScrollVisibilityChanging();
    _aspxHideBodyScroll();
   }
   _aspxSetElementDisplay(modalElement, true);
   aspxGetPopupControlCollection().AdjustModalElementBounds(modalElement);
   _aspxSetElementVisibility(modalElement, true);
   aspxGetPopupControlCollection().RegisterVisibleModalElement(modalElement);
   if(bodyScrollHasJustBeingHidden)
    aspxGetPopupControlCollection().UnlockWindowResizeByBodyScrollVisibilityChanging();
  }
 },
 DoHideWindowCore: function(index){
  this.FFTextCurFixHide(index, true);
  var element = this.GetWindowElement(index);
  if(element != null){
   element.isHiding = true;
   this.SetIsDragged(index, false);
   this.UpdateWindowsStateInputElement();
   this.UpdateWindowsStateCookie();
   element.isHiding = false;
   _aspxStopAnimation(element);
   _aspxSetElementVisibility(element, false);
   _aspxSetElementDisplay(element, false);
   this.DoHideWindowModalElement(element);
   this.DoHideWindowIFrame(element);
   aspxGetPopupControlCollection().UnregisterVisibleWindow(element);
  }
 },
 DoHideWindow: function(index){
  if (!this.InternalIsWindowVisible(index)) return;
  var cancel = this.RaiseClosing(index);
  if(!cancel){
   this.DoHideWindowCore(index);
   this.RaiseCloseUp(index);
  }
  return cancel;
 },
 DoHideWindowIFrame: function(element){
  if (!this.renderIFrameForPopupElements) return;
  var iFrame = element.overflowElement;
  if(_aspxIsExists(iFrame))
   _aspxSetElementDisplay(iFrame, false);
 },
 DoHideWindowModalElement: function(element){
  var modalElement = element.modalElement;
  if(_aspxIsExists(modalElement)){
   aspxGetPopupControlCollection().UnregisterVisibleModalElement(modalElement);
   if(this.hideBodyScrollWhenModal) {
    if(__aspxWebKitFamily)
     aspxGetPopupControlCollection().LockScrollEvent();
    _aspxRestoreBodyScroll();
    if(__aspxWebKitFamily)
     aspxGetPopupControlCollection().UnlockScrollEvent();
   }
   _aspxSetStyleSize(modalElement, 1, 1);
   _aspxSetElementVisibility(modalElement, false);
   _aspxSetElementDisplay(modalElement, false);
  }
 },
 SetWindowDisplay: function(index, value){
  var pcwElement = this.GetWindowElement(index);
  this.SetFFTextCurFixShowing(index, value, false);
  _aspxSetElementDisplay(pcwElement, value);
 },
 GetTextCurFixDiv: function(index){
  return _aspxGetElementById(this.name + "_" + "TCFix" + index);
 },
 FFTextCurFixShow: function(index, isSetVisibility){
  this.SetFFTextCurFixShowing(index, true, isSetVisibility);
 },
 FFTextCurFixHide: function(index, isSetVisibility){
  this.SetFFTextCurFixShowing(index, false, isSetVisibility);
 },
 IsFFTextCurFixRequired: function(index){
  return __aspxFirefox && _aspxIsExists(this.GetWindowModalElement(index));
 },
 SetFFTextCurFixShowing: function(index, value, isSetVisibility){
  if(this.IsFFTextCurFixRequired(index)){
   var fixDiv = this.GetTextCurFixDiv(index);
   if(_aspxIsExists(fixDiv)){
    if(isSetVisibility)
     _aspxSetElementVisibility(fixDiv, value);
    _aspxSetElementDisplay(fixDiv, value);
   }
  }  
 },
 SetWindowPos: function(index, element, x, y){
  _aspxSetStylePosition(element, x, y);
  this.DoShowWindowIFrame(index, x, y, __aspxInvalidDimension, __aspxInvalidDimension);
  this.SetIsDragged(index, true);
  this.SetWindowLeft(index, _aspxGetAbsoluteX(element));
  this.SetWindowTop(index, _aspxGetAbsoluteY(element));
  this.UpdateWindowsStateInputElement();
  this.UpdateWindowsStateCookie();
 },
 CorrectContentCellHeight: function(element, isResizing){
  if (__aspxIE){
   var index = this.GetWindowIndex(element);
   var clientTable = this.GetWindowClientTable(index);
   var headerCell = this.GetWindowHeaderElement(index);
   var contentCell = this.GetWindowContentElement(index);
   var footerCell = this.GetWindowFooterElement(index);
   var windowMainCell = this.GetWindowMainCell(element);
   var mainCellHeight = windowMainCell.clientHeight - this.GetTwoVerticalPaddingSize(windowMainCell);
   var headerHeight = _aspxIsExists(headerCell) ? headerCell.offsetHeight : 0;
   var footerHeight = _aspxIsExists(footerCell) ? footerCell.offsetHeight : 0;
   if (isResizing){
    headerHeight = this.GetHeaderHeight(index);
    footerHeight = this.GetFooterHeight(index);
   }
   else{
    this.SetHeaderHeight(index, headerHeight);
    this.SetFooterHeight(index, footerHeight);
   }
   var correctedHeight = Math.max(0, mainCellHeight - headerHeight - footerHeight);
   contentCell.style.height = correctedHeight + "px";
   var verticalsPaddings = contentCell.offsetHeight - correctedHeight;
   contentCell.style.height = correctedHeight - verticalsPaddings + "px";
  }
 },
 GetTwoVerticalPaddingSize: function(element){
  var heightWithBorders = element.clientHeight;
  var paddingTopBackup = element.style.paddingTop;
  var paddingBottomBackup = element.style.paddingBottom;
  element.style.paddingTop = "0px";
  element.style.paddingBottom = "0px";
  var heightWithoutBorders = element.clientHeight;
  element.style.paddingTop = paddingTopBackup;
  element.style.paddingBottom = paddingBottomBackup;
  return (heightWithBorders - heightWithoutBorders);
 },
 InternalIsWindowVisible: function(index){
  var element = this.GetWindowElement(index);
  return (element != null) ? _aspxGetElementVisibility(element) : false;
 },
 InternalIsWindowDisplayed: function(index){
  var element = this.GetWindowElement(index);
  return (element != null) ? _aspxGetElementDisplay(element) : false;
 },
 OnActivate: function(index){
  var element = this.GetWindowElement(index);
  if (element != null)
   aspxGetPopupControlCollection().ActivateWindowElement(element);
 },
 OnAnimationTimer: function(index){
  var animationDivElement = this.GetWindowElement(index);
  if(_aspxIsExists(animationDivElement)){
   var element = this.GetWindowMainTable(animationDivElement);
   var mainCell = this.GetWindowMainCell(animationDivElement);
   var iframeElement = this.GetWindowIFrame(index);
   _aspxOnAnimationTimer(animationDivElement, element, mainCell, iframeElement, this.animationDelay, this.animationMaxDelay,__aspxPCAnimationAccelerator);
  }
 },
 OnAnimationStop: function(index){
  this.RaiseShowen(index);
 },
 OnDragStart: function(evt, index){
  this.SetIsDragged(index, true);
  this.ShowDragCursor(index);
  var element = this.GetWindowElement(index);
  if(_aspxIsExists(this.GetWindowContentIFrameElement(index)))
   this.HideIframeElementBeforeDragging(index);  
  var gragXOffset = _aspxGetAbsoluteX(element) - _aspxGetEventX(evt);
  var gragYOffset = _aspxGetAbsoluteY(element) - _aspxGetEventY(evt);
  var xClientCorrection = _aspxGetPositionElementOffset(element, true);
  var yClientCorrection = _aspxGetPositionElementOffset(element, false);
  gragXOffset -= xClientCorrection;
  gragYOffset -= yClientCorrection;
  aspxGetPopupControlCollection().InitDragObject(this, index, gragXOffset, gragYOffset, xClientCorrection, yClientCorrection);
 },
 OnDrag: function(index, x, y, xClientCorrection, yClientCorrection) {
  var element = this.GetWindowElement(index);
  if(element != null){
   _aspxSetStylePosition(element, x, y);  
   this.SetWindowLeft(index, x + xClientCorrection);
   this.SetWindowTop(index, y + yClientCorrection);
   var iFrame = element.overflowElement;
   if(_aspxIsExists(iFrame))
    _aspxSetStylePosition(iFrame, x, y);
   if (__aspxOpera) 
    _aspxClearSelection();
  }
 },
 OnDragStop: function(index) {
  var element = this.GetWindowElement(index);
  this.HideDragCursor(index);
  this.UpdateWindowsStateInputElement();
  this.UpdateWindowsStateCookie();
  if(_aspxIsExists(this.GetWindowContentIFrameElement(index)))
   this.ShowIframeElementAfterDragging(index);
 },
 OnPopupElementMouseOver: function(evt, popupElement) {
  if(popupElement != null) {
   var index = popupElement.DXPopupWindowIndex;
   if(!this.InternalIsWindowVisible(index)){
    aspxGetPopupControlCollection().SetAppearTimer(this.name, index, this.appearAfter);
    aspxGetPopupControlCollection().InitOverObject(this, index, evt);
   }
  }
 },
 OnPopupElementMouseOut: function(evt, popupElement) {
 },
 HideIframeElementBeforeDragging: function(index){
  var iframeElement = this.GetWindowContentIFrameElement(index);
  if(__aspxIE){
   this.CreateFakeDragDiv(iframeElement);
   _aspxSetElementDisplay(iframeElement, false);
  } else
   _aspxSetElementVisibility(iframeElement, false);
 },
 ShowIframeElementAfterDragging: function(index){
  var iframeElement = this.GetWindowContentIFrameElement(index);
  if(this.fakeDragDiv != null){
   this.RemoveFakeDragDiv(iframeElement);
   _aspxSetElementDisplay(iframeElement, true);
  } else
   _aspxSetElementVisibility(iframeElement, true);
 },
 CreateFakeDragDiv: function(iframe) {
  this.fakeDragDiv = document.createElement("div");
  _aspxSetStyleSize(this.fakeDragDiv, iframe.offsetWidth, iframe.offsetHeight);  
  iframe.parentElement.appendChild(this.fakeDragDiv);
 },
 RemoveFakeDragDiv: function(iframe) {
  iframe.parentElement.removeChild(this.fakeDragDiv);
  this.fakeDragDiv = null;
 },
 CreateResizePanel: function(index){
  var element = this.GetWindowElement(index);
  var mainCell = this.GetWindowMainCell(element);
  var resizePanel = document.createElement("DIV");
  element.parentNode.appendChild(resizePanel);
  resizePanel.style.overflow = "hidden";
  resizePanel.style.position = "absolute";
  resizePanel.style.zIndex = __aspxPopupControlZIndex + aspxGetPopupControlCollection().visiblePopupWindowIds.length * 2 + 2;
  if (!this.isLiveResizingMode)
   resizePanel.style.border = "black 1px dotted";
  return resizePanel;
 },
 OnResizeStart: function(evt, index){
   if (!aspxGetPopupControlCollection().IsResizeInint()){
   this.SetIsResized(index, true);
   var cursor = this.CreateResizeCursorInfo(evt, index);
   if (cursor.course != ""){
    var resizePanel = this.CreateResizePanel(index);
    this.UpdateResizeCursor(resizePanel, cursor.verticalDirection, cursor.horizontalDirection);
    aspxGetPopupControlCollection().InitResizeObject(this, index, cursor, resizePanel);
    this.OnResize(evt, index, cursor, resizePanel);
   }
  }
  return aspxGetPopupControlCollection().IsResizeInint();
 },
 OnResize: function(evt, index, cursor, resizePanel){
  this.OnResizePanel(evt, index, cursor, resizePanel);
  if (this.isLiveResizingMode)
   this.OnResizeWindow(index, cursor, resizePanel);
  if (!__aspxIE) 
   _aspxClearSelection();
 },
 OnResizePanel: function(evt, index, cursor, resizePanel){
  var x = _aspxGetEventX(evt);
  var y = _aspxGetEventY(evt);
  var element = this.GetWindowElement(index);
  var mainCell = this.GetWindowMainCell(element);
  var clientWindow = this.GetWindowClientTable(index);
  var left = _aspxGetAbsoluteX(mainCell);
  var top = _aspxGetAbsoluteY(mainCell);
  var newLeft = _aspxGetAbsoluteX(element);
  var newTop  = _aspxGetAbsoluteY(element);
  var newHeight = mainCell.offsetHeight;
  var newWidth = mainCell.offsetWidth;
  if(cursor.horizontalDirection == "e")
   newWidth = x - newLeft + cursor.horizontalOffset + 1;
  if(cursor.verticalDirection == "s")
   newHeight = y - newTop + cursor.verticalOffset + 1;
  if(cursor.horizontalDirection == "w") {
   newLeft = _aspxPrepareClientPosForElement(x, element, true) - cursor.horizontalOffset;
   newWidth = newWidth - (x - left) + cursor.horizontalOffset;
  }else
   newLeft = _aspxPrepareClientPosForElement(newLeft, element, true);
  if(cursor.verticalDirection == "n"){
   newTop =_aspxPrepareClientPosForElement(y, element, false) - cursor.verticalOffset;
   newHeight = newHeight - (y - top) + cursor.verticalOffset;
  }else
   newTop = _aspxPrepareClientPosForElement(newTop, element, false);
  if(!this.isLiveResizingMode){
   newWidth -= 2; 
   newHeight -= 2;
  }
  if(newWidth > 0 && newHeight > 0) {
   _aspxSetStylePosition(resizePanel, newLeft, newTop);
   _aspxSetStyleSize(resizePanel, newWidth, newHeight);
   this.SetWindowLeft(index, _aspxGetAbsoluteX(element));
   this.SetWindowTop(index, _aspxGetAbsoluteY(element));
  }
 },
 OnResizeWindow: function(index, cursor, resizePanel){
  this.SetClientWindowSize(index, resizePanel.offsetWidth, resizePanel.offsetHeight);
  var element = this.GetWindowElement(index);
  var mainCell = this.GetWindowMainCell(element);
  var heightCorrection = mainCell.offsetHeight - resizePanel.offsetHeight;
  var widthCorrection = mainCell.offsetWidth - resizePanel.offsetWidth;
  var left = _aspxGetAbsoluteX(resizePanel) - (cursor.horizontalDirection == "w" ? widthCorrection : 0);
  var top  = _aspxGetAbsoluteY(resizePanel) - (cursor.verticalDirection == "n" ?  heightCorrection : 0);
  left = _aspxPrepareClientPosForElement(left, element, true);
  top = _aspxPrepareClientPosForElement(top, element, false);
  _aspxSetStylePosition(element, left, top);
  if(this.InternalIsWindowVisible(index)) 
   this.DoShowWindowIFrame(index, left, top, __aspxInvalidDimension, __aspxInvalidDimension);
 },
 OnResizeStop: function(evt, index, cursor, resizePanel){
  if(this.allowResize){
   if (!this.isLiveResizingMode) {
    var collection = aspxGetControlCollection();
    var windowElement = this.GetWindowElement(index);
    collection.CollapseControls(windowElement);
    this.OnResizeWindow(index, cursor, resizePanel);
   }
   this.CreateResizeCursorInfo(evt, index);
   this.UpdateWindowsStateInputElement();
   this.UpdateWindowsStateCookie();
   this.RaiseResize(index);
   if (!this.isLiveResizingMode)
    collection.AdjustControls(windowElement);
  }
 },
 OnMouseDownModalElement: function(evt, index) {
  aspxGetPopupControlCollection().DoHideAllWindows(_aspxGetEventSource(evt), "", false);
  if (this.isNeedPopupedSet) {
   var popupElement = this.GetPopupElement(index);
   popupElement.isPopuped = true;
  }
 },
 SetClientWindowSize: function(index, width, height){
  var element = this.GetWindowElement(index);
  var mainCell = this.GetWindowMainCell(element);
  var clientWindow = this.GetWindowClientTable(index);
  element.style.height = "0px";
  element.style.width = "0px";
  var windowHorizontalTwoBorderSize = mainCell.offsetWidth - clientWindow.offsetWidth;
  var windowVerticalTwoBorderSize = mainCell.offsetHeight - clientWindow.offsetHeight;
  var contentIFrameDiv = this.GetWindowContentIFrameDivElement(index);
  var contentIFrame = this.GetWindowContentIFrameElement(index);
  width -= windowHorizontalTwoBorderSize;
  height -= windowVerticalTwoBorderSize;
  if(width < 0) width = 0;
  if(height < 0) height = 0;
  this.RaiseBeforeResizing(index);
  if (__aspxIE){
   this.GetWindowContentElement(index).style.height = "0px";
   mainCell.style.height = "0px"; 
  } else {
   if (_aspxIsExists(contentIFrame))
    contentIFrame.style.height = "0px";
   if(_aspxIsExists(contentIFrameDiv)) 
    contentIFrameDiv.style.height = "0px";
  }
  _aspxSetStyleSize(clientWindow, width, height);
  var mainCellHeight = __aspxFirefox && height == 0 ? 1 : 0; 
  _aspxSetStyleSize(mainCell, width, mainCellHeight);
  if (__aspxNetscapeFamily){
   _aspxSetElementDisplay(element, false);
   _aspxSetElementDisplay(element, true);
  }
  _aspxSetStyleSize(element, clientWindow.offsetWidth + this.GetShadowWidth() + windowHorizontalTwoBorderSize, clientWindow.offsetHeight + this.GetShadowHeight() + windowVerticalTwoBorderSize);
  this.CorrectContentCellHeight(element, true);
  this.SetWindowWidth(index, clientWindow.offsetWidth);
  this.SetWindowHeight(index, clientWindow.offsetHeight);
  if(_aspxIsExists(contentIFrameDiv))
   this.AdjustIFrameDivHeight(clientWindow, contentIFrameDiv, contentIFrame);
  if(_aspxIsExists(contentIFrame))
   contentIFrame.style.height = "100%";
  this.RaiseAfterResizing(index);
 },
 GetIsSafariGreater4OrChromeGreater2: function(){
  return (__aspxSafari && __aspxBrowserVersion >= 4) || (__aspxChrome  && __aspxBrowserVersion >= 2);
 },
 AdjustIFrameDivHeight: function(clientWindow, contentIFrameDiv, contentIFrame){
  if(this.GetIsSafariGreater4OrChromeGreater2())
   this.AdjustIFrameDivHeight_Safari4(contentIFrameDiv);
  else if((__aspxOpera && __aspxBrowserVersion >= 9.5) || __aspxFirefox)
   this.AdjustIFrameDivHeight_OperaGreaterThan95_FireFox(clientWindow, contentIFrameDiv, contentIFrame);
  else
   contentIFrameDiv.style.height = "100%";
 },
 AdjustIFrameDivHeight_Safari4: function(contentIFrameDiv){
  var firstClientHeight = this.GetElementClientHeight(contentIFrameDiv.parentNode);
  contentIFrameDiv.style.height = firstClientHeight + "px";
  var secontClientHeight = this.GetElementClientHeight(contentIFrameDiv.parentNode);
  contentIFrameDiv.style.height = (2 * firstClientHeight - secontClientHeight) + "px";
 },
 AdjustIFrameDivHeight_OperaGreaterThan95_FireFox: function(clientWindow, contentIFrameDiv, contentIFrame){
  var clientWindowHeight = clientWindow.offsetHeight;
  contentIFrameDiv.style.height = "100%";
  var contentIFrameDivHeight = contentIFrameDiv.offsetHeight;
  contentIFrameDiv.style.height = contentIFrameDivHeight + "px";
  var clientWindowHeightDifference = clientWindow.offsetHeight - clientWindowHeight;
  contentIFrameDiv.style.height = (contentIFrameDivHeight - clientWindowHeightDifference) + "px";
 },
 GetElementClientHeight: function(element){
  if(this.GetIsSafariGreater4OrChromeGreater2() && element.tagName == "TD")
   return _aspxWebKit3TDRealInfo.GetClientHeight(element);
  return element.clentHeight;
 },
 SetWindowCachedSize: function(index, width, height) {
  if(0 <= index && index < this.heightArray.length)
   this.cachedSizeArray[index] = new _aspxSize(width, height);
  else 
   this.cachedSize = new _aspxSize(width, height);
 },
 GetWindowCachedSize: function(index) {
  if(0 <= index && index < this.heightArray.length)
   return this.cachedSizeArray[index];
  else 
   return this.cachedSize;
 },
 ResetWindowCachedSize: function(index) {
  if(0 <= index && index < this.heightArray.length)
   this.cachedSizeArray[index] = null;
  else 
   this.cachedSize = null;
 },
 CreateResizeCursorInfo: function(evt, index){
  var element = this.GetWindowElement(index);
  var mainCell = this.GetWindowMainCell(element);
  var clientWindow = this.GetWindowClientTable(index);
  var headerElement = this.GetWindowHeaderElement(index);
  var left = _aspxGetAbsoluteX(mainCell);
  var top = _aspxGetAbsoluteY(mainCell);
  var x = _aspxGetEventX(evt);
  var y = _aspxGetEventY(evt);
  var leftOffset = Math.abs(x - left);
  var rightOffset = Math.abs(x - left - mainCell.offsetWidth + 1);
  var topOffset = Math.abs(y - top);
  var bottomOffset = Math.abs(y - top - mainCell.offsetHeight + 1);
  var cursorInfo = this.CreateResizeBorderCursorInfo(index, leftOffset, rightOffset, topOffset, bottomOffset);
  var gripCell = this.GetWindowHeaderGripElement(index);
  if (gripCell) {
   var gripCursorInfo = this.CreateGripCursorInfo(index, mainCell, gripCell, rightOffset, bottomOffset);
   if (_aspxIsExists(gripCursorInfo))
    cursorInfo = gripCursorInfo;
  }
  this.UpdateResizeCursor(clientWindow, cursorInfo.verticalDirection, cursorInfo.horizontalDirection);
  this.UpdateResizeCursor(mainCell, cursorInfo.verticalDirection, cursorInfo.horizontalDirection);
  if (_aspxIsExists(headerElement))
   this.UpdateResizeCursor(headerElement, cursorInfo.verticalDirection, cursorInfo.horizontalDirection);
  return cursorInfo;
 },
 CreateGripCursorInfo: function(index, mainCell, gripCell, rightOffset, bottomOffset){
  var gripWidth  = mainCell.offsetWidth - (_aspxGetAbsoluteX(gripCell) - _aspxGetAbsoluteX(mainCell));
  var gripHeight = mainCell.offsetHeight - (_aspxGetAbsoluteY(gripCell) - _aspxGetAbsoluteY(mainCell));
  if (gripHeight > bottomOffset && gripWidth > rightOffset) 
   return new ASPxPCResizeCursorInfo("e", "s", rightOffset, bottomOffset);
  return null;
 },
 CreateResizeBorderCursorInfo: function(index, leftOffset, rightOffset, topOffset, bottomOffset){
  var ResizeBorderSize = this.ResizeBorderSize;
  var verticalDirection = this.GetResizeVerticalCourse(ResizeBorderSize, topOffset, bottomOffset);
  ResizeBorderSize = verticalDirection != "" ? this.ResizeCornerBorderSize : this.ResizeBorderSize;
  var horizontalDirection = this.GetResizeHorizontalCourse(ResizeBorderSize, leftOffset, rightOffset);
  if (verticalDirection == "" && horizontalDirection != "")
   verticalDirection = this.GetResizeVerticalCourse(this.ResizeCornerBorderSize, topOffset, bottomOffset);
  var horizontalOffset = leftOffset < rightOffset ? leftOffset : rightOffset;
  var verticalOffset = topOffset < bottomOffset ? topOffset : bottomOffset;
  return new ASPxPCResizeCursorInfo(horizontalDirection, verticalDirection, horizontalOffset, verticalOffset);
 },
 GetResizeVerticalCourse: function(ResizeBorderSize, topOffset, bottomOffset){
  if (ResizeBorderSize > topOffset) return "n";
  if (ResizeBorderSize > bottomOffset) return "s";
  return "";
 },
 GetResizeHorizontalCourse: function(ResizeBorderSize, leftOffset, rightOffset){
  if (ResizeBorderSize > leftOffset) return "w";
  if (ResizeBorderSize > rightOffset) return "e";
  return "";
 },
 UpdateResizeCursor: function(element, verticalDirection, horizontalDirection){
  var cursor = verticalDirection +  horizontalDirection;
  if (cursor != ""){
   cursor += "-resize";
   this.ShowTemporaryCursor(element, cursor);
  }
  else
   this.HideTemporaryCursor(element);
 },
 ShowTemporaryCursor: function(element, cursor){
  _aspxChangeStyleAttribute(element, "cursor", cursor);
 },
 HideTemporaryCursor: function(element){
  _aspxRestoreStyleAttribute(element, "cursor");
 },
 ResizeWindowIFrame: function(index){
  if (!this.renderIFrameForPopupElements) return;
  if (!this.InternalIsWindowVisible(index)) return;
  var iFrame = this.GetWindowIFrame(index);
  if(_aspxIsExists(iFrame)){ 
   var cell = this.GetWindowMainCell(this.GetWindowElement(index));
   _aspxSetStyleSize(iFrame, cell.offsetWidth, cell.offsetHeight);
  }
 },
 GetContentIFrameWindow: function(){
  var iframeElement = this.GetContentIFrame();  
  return iframeElement.contentWindow;
 },
 ShowDragCursor: function(index){
  var dragElement = this.GetDragElement(index);
  if (dragElement)
   this.ShowTemporaryCursor(dragElement, "move");
 },
 HideDragCursor: function(index){
  var dragElement = this.GetDragElement(index);
  if(dragElement != null)
   this.HideTemporaryCursor(dragElement);
 },
 GetDragElement: function(index){
  var headerElement = this.GetWindowHeaderElement(index);
  var element = this.GetWindowElement(index);
  if (element != null)
   return (headerElement != null ? headerElement : this.GetWindowMainCell(element));
  return null;
 },
 OnActivateMouseDown: function(evt, index){
  this.OnActivate(index);
 },
 OnCloseButtonClick: function(index){
  this.RaiseCloseButtonClick(index);
  if(this.GetWindowCloseAction(index) != "None")
   this.DoHideWindow(index);
 },
 OnMouseDown: function(evt, index, isDraggingAllowed){
  if(_aspxGetIsLeftButtonPressed(evt)){
   _aspxClearSelection();
   var isResizing = false;
   if (this.allowResize)
    isResizing = this.OnResizeStart(evt, index);
   if (isDraggingAllowed && !isResizing)
    this.OnDragStart(evt, index);
  }
 },
 OnMouseMove: function(evt, index){
  this.CreateResizeCursorInfo(evt, index);
 },
 StartAnimation: function(animationDivElement, index, horizontalPopupPosition, verticalPopupPosition){
  var element = this.GetWindowMainTable(animationDivElement);
  var clientX = horizontalPopupPosition.position;
  var clientY = verticalPopupPosition.position;
  var args = "(\"" + this.name + "\", " + index + ")";
  var onTimerString = "aspxPCATimer" + args;
  var onAnimStopCallString = "aspxPCAStop" + args;
  _aspxInitAnimationDiv(animationDivElement, clientX, clientY, onTimerString, onAnimStopCallString);
  var horizontalDirection = _aspxGetAnimationHorizontalDirection(horizontalPopupPosition, this.popupHorizontalAlign, this.popupVerticalAlign);
  var verticalDirection = _aspxGetAnimationVerticalDirection(verticalPopupPosition, this.popupHorizontalAlign, this.popupVerticalAlign);
  var xPos = horizontalDirection * animationDivElement.offsetHeight;
  var yPos = verticalDirection * animationDivElement.offsetWidth;
  _aspxSetStylePosition(element, xPos, yPos);
  _aspxSetElementVisibility(animationDivElement, true);
  this.DoShowWindowIFrame(index, clientX, clientY, 0, 0);
  animationDivElement.timerID = window.setTimeout(animationDivElement.onTimerString, this.animationDelay);
 },
 GetWindowsState: function(){
  var state = "";
  if (this.HasDefaultWindow()){
   state += this.GetWindowState(-1);
  }
  for(var i = 0; i < this.GetWindowCountCore(); i ++) {
   state += this.GetWindowState(i);
   if(i < this.GetWindowCountCore() - 1) state += ";";
  }
  return state;
 },
 GetWindowState: function(index){
  var element = this.GetWindowElement(index);
  if (element != null){
   var mainCell = this.GetWindowMainCell(element);
   var visibleFlag = (!this.InternalIsWindowVisible(index) || element.isHiding) ? "0" : "1";
   var isDraggedFlag = this.GetIsDragged(index) ? "1" : "0";
   var zIndex = this.GetCurrentZIndex(index);
   var isResized = this.GetIsResized(index);
   var isResizedFlag = isResized ? "1" : "0";
   var width = isResized ? this.GetCurrentWindowWidth(index) : __aspxInvalidDimension;
   var height = isResized ? this.GetCurrentWindowHeight(index) : __aspxInvalidDimension;
   var state = visibleFlag + ":" + isDraggedFlag + ":" + zIndex + ":" + 
    this.GetCurrentLeft(index) + ":" + this.GetCurrentTop(index) + ":" + isResizedFlag + ":" +
    width + ":" + height;
   return state;
  }
  return "";
 },
 UpdateWindowsStateCookie: function(){
  if(this.cookieName == "") return;
  _aspxDelCookie(this.cookieName);
  _aspxSetCookie(this.cookieName, this.GetWindowsState());
 },
 UpdateWindowsStateInputElement: function(){
  var element = this.GetWindowsStateInputElement();
  if(element != null) element.value = this.GetWindowsState();
 },
 OnIFrameLoad: function(index){
  this.SetIframeLoading(index, false);
 },
 CreateWindows: function(windowsNames){
  for (var i = 0; i < windowsNames.length; i ++){
   var window = new ASPxClientPopupWindow(this, i, windowsNames[i]);
   _aspxArrayPush(this.windows, window);
  }
 },
 RaiseCloseButtonClick: function(index){
  var window = index < 0 ? null : this.GetWindow(index);
  if(!this.CloseButtonClick.IsEmpty()){
   var args = new ASPxClientPopupWindowEventArgs(window);
   this.CloseButtonClick.FireEvent(this, args);
  }
 },
 RaiseClosing: function(index){
  var window = index < 0 ? null : this.GetWindow(index);
  var cancel = false;
  if(!this.Closing.IsEmpty()){
   var args = new ASPxClientPopupWindowCancelEventArgs(window);
   this.Closing.FireEvent(this, args);
   cancel = args.cancel;
  }
  return cancel;
 },
 RaiseCloseUp: function(index){
  var window = index < 0 ? null : this.GetWindow(index);
  if(!this.CloseUp.IsEmpty()){
   var args = new ASPxClientPopupWindowEventArgs(window);
   this.CloseUp.FireEvent(this, args);
  }
 },
 RaisePopUp: function(index){
  var window = index < 0 ? null : this.GetWindow(index);
  if(!this.PopUp.IsEmpty()){
   var args = new ASPxClientPopupWindowEventArgs(window);
   this.PopUp.FireEvent(this, args);
  }
 },
 RaiseResize: function(index){
  var window = index < 0 ? null : this.GetWindow(index);
  if(!this.Resize.IsEmpty()){
   var args = new ASPxClientPopupWindowEventArgs(window);
   this.Resize.FireEvent(this, args);
  }
 },
 RaiseBeforeResizing: function(index){
  var window = index < 0 ? null : this.GetWindow(index);
  if(!this.BeforeResizing.IsEmpty()){
   var args = new ASPxClientPopupWindowEventArgs(window);
   this.BeforeResizing.FireEvent(this, args);
  }
 },
 RaiseAfterResizing: function(index){
  var window = index < 0 ? null : this.GetWindow(index);
  if(!this.AfterResizing.IsEmpty()){
   var args = new ASPxClientPopupWindowEventArgs(window);
   this.AfterResizing.FireEvent(this, args);
  }
 },
 RaiseShowen: function(index){
  var window = index < 0 ? null : this.GetWindow(index);
  if(!this.Shown.IsEmpty()){
   var args = new ASPxClientPopupWindowEventArgs(window);
   this.Shown.FireEvent(this, args);
  }
 },
 AdjustSize: function() {
  return this.SetSize(0, 0);
 },
 GetHeight: function(){
  return this.GetWindowHeight(null);
 },
 GetWidth: function(){
  return this.GetWindowWidth(null);
 },
 SetSize: function(width, height){
  this.SetWindowSize(null, width, height);
 },
 SetWidth: function(width) {
  this.SetSize(width, this.GetHeight());
 },
 SetHeight: function(height) {
  this.SetSize(this.GetWidth(), height);
 },
 GetWindowHeight: function(window){
  var index = (window != null) ? window.index : -1;
  var element = this.GetWindowElement(index);
  var mainCell = this.GetWindowMainCell(element);
  return mainCell.offsetHeight;
 },
 GetWindowWidth: function(window){
  var index = (window != null) ? window.index : -1;
  var element = this.GetWindowElement(index);
  var mainCell = this.GetWindowMainCell(element);
  return mainCell.offsetWidth;
 },
 SetWindowSize: function(window, width, height){
  var index = (window != null) ? window.index : -1;
  if(this.InternalIsWindowDisplayed(index)) {
   this.SetClientWindowSize(index, width, height);
   var iFrame = this.GetWindowIFrame(index);
   if(_aspxIsExists(iFrame)){
    var winElememnt = this.GetWindowElement(index);
    var realWidth = winElememnt.offsetWidth;
    var realHeight = winElememnt.offsetHeight;
    _aspxSetStyleSize(iFrame, realWidth, realHeight);
   }
  } else
   this.SetWindowCachedSize(index, width, height);
 },  
 GetContentHTML: function(){
  return this.GetContentHtml();
 },
 SetContentHTML: function(html){
  this.SetContentHtml(html);
 },
 GetContentHtml: function(){
  return this.GetWindowContentHtml(null);
 },
 SetContentHtml: function(html){
  this.SetWindowContentHtml(null, html);
 },
 GetContentIFrame: function(window){
  return this.GetWindowContentIFrame(null);
 },
 GetContentUrl: function(){
  return this.GetWindowContentUrl(null);
 },
 SetContentUrl: function(url){
  this.SetWindowContentUrl(null, url);
 },
 RefreshContentUrl: function(){
  this.RefreshWindowContentUrl(null);
 },
 SetWindowPopupElementID: function(window, popupElementId) {
  var index = (window != null) ? window.index : -1;
  if (popupElementId != this.GetPopupElementIDInternal(index)) {
   this.DetachFromPopupElement(index);
   this.AttachToPopupElement(index, popupElementId);
  }
 },
 SetPopupElementID: function(popupElementId) {
  this.SetWindowPopupElementID(null, popupElementId);
 },
 Show: function(){
  this.ShowWindow(null);
 },
 ShowAtElement: function(htmlElement){
  this.ShowWindowAtElement(null, htmlElement);
 },
 ShowAtElementByID: function(id){
  var htmlElement = document.getElementById(id);
  this.ShowWindowAtElement(null, htmlElement);
 },
 ShowAtPos: function(x, y){
  this.ShowWindowAtPos(null, Math.round(x), Math.round(y));
 },
 BringToFront: function(){
  this.BringWindowToFront(null);
 },
 Hide: function(){
  this.HideWindow(null);
 },
 IsWindowVisible: function(window){
  var index = (window != null) ? window.index : -1;
  return this.InternalIsWindowVisible(index);
 },
 IsVisible: function(){
  return this.InternalIsWindowVisible(-1);
 },
 GetWindow: function(index){
  return (0 <= index && index < this.windows.length) ? this.windows[index] : null;
 },
 GetWindowByName: function(name){
  for(var i = 0; i < this.windows.length; i ++)
   if(this.windows[i].name == name) return this.windows[i];
  return null;
 },
 GetWindowCount: function(){
  return this.GetWindowCountCore();
 },
 ShowWindow: function(window){
  var index = (window != null) ? window.index : -1;
  this.DoShowWindowAtPos(index, __aspxInvalidPosition, __aspxInvalidPosition, false, false, true);
 },
 ShowWindowAtElement: function(window, htmlElement){
  var index = (window != null) ? window.index : -1;
  var popupElementBackup = this.GetPopupElement(index);
  this.SetPopupElementInternal(index, htmlElement);
  this.ShowWindow(window);
  this.SetPopupElementInternal(index, popupElementBackup);
 },
 ShowWindowAtElementByID: function(window, id){
  var htmlElement = document.getElementById(id);
  this.ShowWindowAtElement(window, htmlElement);
 },
 ShowWindowAtPos: function(window, x, y){
  var index = (window != null) ? window.index : -1;
  this.DoShowWindowAtPos(index, x, y, true, false, true);
 },
 BringWindowToFront: function(window){
  var index = (window != null) ? window.index : -1;
  var element = this.GetWindowElement(index); 
  aspxGetPopupControlCollection().ActivateWindowElement(element);
 },
 HideWindow: function(window){
  var index = (window != null) ? window.index : -1;
  this.DoHideWindow(index);
 },
 GetWindowContentHTML: function(window){
  return this.GetWindowContentHtml(window);
 },
 SetWindowContentHTML: function(window, html){
  this.SetWindowContentHtml(window, html);
 },
 GetWindowContentHtml: function(window){
  var index = (window != null) ? window.index : -1;
  var element = this.GetWindowContentElement(index);
  return (element != null) ? element.innerHTML : "";
 },
 SetWindowContentHtml: function(window, html){
  var index = (window != null) ? window.index : -1;
  var element = this.GetWindowContentElement(index);
  if(element != null){
   _aspxSetInnerHtml(element, html);
   this.ResizeWindowIFrame(index);
  }
 },
 GetWindowContentIFrame: function(window){
  var index = (window != null) ? window.index : -1;
  return this.GetWindowContentIFrameElement(index);
 },
 GetWindowContentUrl: function(window){
  var index = (window != null) ? window.index : -1;
  if(!this.IsWindowVisible(window))
   return this.GetWindowContentIFrameUrl(index);
  var element = this.GetWindowContentIFrameElement(index);
  return (element != null) ? element.src : "";
 },
 SetWindowContentUrl: function(window, url){
  var index = (window != null) ? window.index : -1;
  var element = this.GetWindowContentIFrameElement(index);
  var windowVisible = this.IsWindowVisible(window);
  if(windowVisible && element != null)
   this.ShowIframeElementAfterDragging(index);
  this.SetWindowContentIFrameUrl(index, url);
  var src = (__aspxIE && !windowVisible) ? this.SSLSecureBlankUrl : url;
  if (element == null)
   this.CreateWindowContentIFrameElement(index, src);
  else
   this.SetSrcToIframeElement(index, element, src);
 },
 RefreshWindowContentUrl: function(window){
  var index = (window != null) ? window.index : -1;
  if(__aspxIE)
   this.RefreshWindowContentUrlIE(index, window);
  else
   this.RefreshWindowContentUrlCommon(window);
 },
 RefreshWindowContentUrlIE: function(index, window){
  var windowVisible = this.InternalIsWindowVisible(index);
  if(windowVisible)
   this.RefreshWindowContentUrlIECore(index, window);
  else{
   var iframe = this.GetWindowContentIFrameElement(index);
   if(_aspxIsExists(iframe))
    iframe.DXReloadAfterShowRequired = true;
  }
 },
 RefreshWindowContentUrlIECore: function(index, window){
  try{
   if(!this.GetIframeLoading(index)){
    var iframe = this.GetWindowContentIFrameElement(index);
    if(_aspxIsExists(iframe))
     iframe.contentWindow.location.reload();
   }
  } catch(e) {
   this.RefreshWindowContentUrlCommon(window);
  }
 },
 RefreshWindowContentUrlCommon: function(window){
  this.SetWindowContentUrl(window, this.GetWindowContentUrl(window));
 },
 UpdatePosition: function(){
  this.UpdatePositionAtElement(this.GetPopupElement(-1));
 },
 UpdatePositionAtElement: function(popupElement){
  this.UpdateWindowPositionAtElement(null, popupElement);
 },
 UpdateWindowPosition: function(window){
  var index = (window != null) ? window.index : -1;
  this.UpdateWindowPositionAtElement(window, this.GetPopupElement(index));
 },
 UpdateWindowPositionAtElement: function(window, popupElement){
  var index = (window != null) ? window.index : -1;
  this.UpdateWindowPositionInternal(index, popupElement);
 },
 UpdateWindowPositionInternal: function(index, popupElement){
  var element = this.GetWindowElement(index);
  if(this.InternalIsWindowVisible(index) && element != null){
   var horizontalPopupPosition = this.GetClientPopupPos(element, popupElement, __aspxInvalidPosition, true, false);
   var verticalPopupPosition = this.GetClientPopupPos(element, popupElement, __aspxInvalidPosition, false, false);
   this.SetWindowPos(index, element, horizontalPopupPosition.position, verticalPopupPosition.position);
  } else
   this.DoShowWindowAtPos(index, __aspxInvalidDimension, __aspxInvalidDimension, false, false, false);
 },
 TryAutoUpdatePosition: function(){
  if(this.autoUpdatePosition) 
   this.UpdatePosition();   
 },
 CreateWindowContentIFrameElement: function(index, src){
  var content = this.GetWindowContentElement(index);
  var iframeParent = content;
  content.innerHTML = "";
  var iframe = this.CreateContentIFrameElement(index, src);
  var iframeDiv = null;
  if(!__aspxIE){
   iframeDiv = this.CreateContentIFrameDivElement(index);
   content.appendChild(iframeDiv);
   iframeParent = iframeDiv;
  }
  iframeParent.appendChild(iframe);
  if(!__aspxIE){
   if(__aspxOpera)
    iframe.style.height = "100%";
   else
    iframe.style.height = iframeDiv.clientHeight + "px";
  }
  this.InitIFrame(index);
  return iframe;
 },
 CreateContentIFrameElement: function(index, src){
  var iframe = document.createElement("IFRAME");
  iframe.id = this.GetWindowContentIFrameElementId(index);
  iframe.scrolling = "auto";
  iframe.frameBorder = 0;
  iframe.style.width = "100%";
  iframe.style.height = __aspxIE ? "100%" : "0px";
  this.SetSrcToIframeElement(index, iframe, src);
  return iframe;
 },
 CreateContentIFrameDivElement: function(index){
  var iframeDiv = document.createElement("DIV");
  iframeDiv.id = this.GetWindowContentIFrameDivElementID(index);
  iframeDiv.style.width = "100%";
  iframeDiv.style.height = "100%";
  return iframeDiv;
 },
 GetWindowHeaderTextCell: function(index){
  return this.GetWindowChild(index, "_PWH" + index + "T");
 },
 GetWindowHeaderImageCell: function(index){
  return this.GetWindowChild(index, "_PWH" + index + "I");
 },
 GetWindowFooterTextCell: function(index){
  return this.GetWindowChild(index, "_PWF" + index + "T");
 },
 GetWindowFooterImageCell: function(index){
  return this.GetWindowChild(index, "_PWF" + index + "I");
 },
 GetWindowHeaderImageUrl: function(index){
  var element = this.GetWindowHeaderImageCell(index);
  if(element != null){
   var img = _aspxGetChildByTagName(element, "IMG", 0);
   if(img != null)
    return img.src;
  }
  return "";
 },
 SetWindowHeaderImageUrl: function(index, url){
  var element = this.GetWindowHeaderImageCell(index);
  if(element != null){
   var img = _aspxGetChildByTagName(element, "IMG", 0);
   if(img != null)
    img.src = url;
  }
 },
 GetWindowFooterImageUrl: function(index){
  var element = this.GetWindowFooterImageCell(index);
  if(element != null){
   var img = _aspxGetChildByTagName(element, "IMG", 0);
   if(img != null)
    return img.src;
  }
  return "";
 },
 SetWindowFooterImageUrl: function(index, url){
  var element = this.GetWindowFooterImageCell(index);
  if(element != null){
   var img = _aspxGetChildByTagName(element, "IMG", 0);
   if(img != null)
    img.src = url;
  }
 },
 GetWindowHeaderNavigateUrl: function(index){
  var element = this.GetWindowHeaderTextCell(index);
  if(element != null){
   var link = _aspxGetChildByTagName(element, "A", 0);
   if(link != null)
    return link.href;
  }
  element = this.GetWindowHeaderImageCell(index);
  if(element != null){
   var link = _aspxGetChildByTagName(element, "A", 0);
   if(link != null)
    return link.href;
  }
  return "";
 },
 SetWindowHeaderNavigateUrl: function(index, url){
  var element = this.GetWindowHeaderTextCell(index);
  if(element != null){
   var link = _aspxGetChildByTagName(element, "A", 0);
   if(link != null)
    link.href = url;
  }
  var element = this.GetWindowHeaderImageCell(index);
  if(element != null){
   var link = _aspxGetChildByTagName(element, "A", 0);
   if(link != null)
    link.href = url;
  }
 },
 GetWindowFooterNavigateUrl: function(index){
  var element = this.GetWindowFooterTextCell(index);
  if(element != null){
   var link = _aspxGetChildByTagName(element, "A", 0);
   if(link != null)
    return link.href;
  }
  element = this.GetWindowFooterImageCell(index);
  if(element != null){
   var link = _aspxGetChildByTagName(element, "A", 0);
   if(link != null)
    return link.href;
  }
  return "";
 },
 SetWindowFooterNavigateUrl: function(index, url){
  var element = this.GetWindowFooterTextCell(index);
  if(element != null){
   var link = _aspxGetChildByTagName(element, "A", 0);
   if(link != null)
    link.href = url;
  }
  var element = this.GetWindowFooterImageCell(index);
  if(element != null){
   var link = _aspxGetChildByTagName(element, "A", 0);
   if(link != null)
    link.href = url;
  }
 },
 GetWindowHeaderText: function(index){
  var element = this.GetWindowHeaderTextCell(index);
  if(element != null){
   var link = _aspxGetChildByTagName(element, "A", 0);
   if(link != null)
    return link.innerHTML;
   else
    return element.innerHTML;
  }
  return "";
 },
 SetWindowHeaderText: function(index, text){
  var element = this.GetWindowHeaderTextCell(index);
  if(element != null){
   var link = _aspxGetChildByTagName(element, "A", 0);
   if(link != null)
    link.innerHTML = text;
   else
    element.innerHTML = text;
  }
 },
 GetWindowFooterText: function(index){
  var element = this.GetWindowFooterTextCell(index);
  if(element != null){
   var link = _aspxGetChildByTagName(element, "A", 0);
   if(link != null)
    return link.innerHTML;
   else
    return element.innerHTML;
  }
  return "";
 },
 SetWindowFooterText: function(index, text){
  var element = this.GetWindowFooterTextCell(index);
  if(element != null){
   var link = _aspxGetChildByTagName(element, "A", 0);
   if(link != null)
    link.innerHTML = text;
   else
    element.innerHTML = text;
  }
 },
 RefreshPopupElementConnection: function(){
  if (this.HasDefaultWindow())
   this.AttachToPopupElement(-1);
  for(var i = 0; i < this.GetWindowCountCore(); i++) 
   this.AttachToPopupElement(i);
 },
 GetHeaderImageUrl: function(){
  return this.GetWindowHeaderImageUrl(-1);
 },
 SetHeaderImageUrl: function(value){
  this.SetWindowHeaderImageUrl(-1, value);
 },
 GetFooterImageUrl: function(){
  return this.GetWindowFooterImageUrl(-1);
 },
 SetFooterImageUrl: function(value){
  this.SetWindowFooterImageUrl(-1, value);
 },
 GetHeaderNavigateUrl: function(){
  return this.GetWindowHeaderNavigateUrl(-1);
 },
 SetHeaderNavigateUrl: function(value){
  this.SetWindowHeaderNavigateUrl(-1, value);
 },
 GetFooterNavigateUrl: function(){
  return this.GetWindowFooterNavigateUrl(-1);
 },
 SetFooterNavigateUrl: function(value){
  this.SetWindowFooterNavigateUrl(-1, value);
 },
 GetHeaderText: function(){
  return this.GetWindowHeaderText(-1);
 },
 SetHeaderText: function(value){
  this.SetWindowHeaderText(-1, value);
 },
 GetFooterText: function(){
  return this.GetWindowFooterText(-1);
 },
 SetFooterText: function(value){
  this.SetWindowFooterText(-1, value);
 },
 GetVisible: function(){
  return this.IsVisible();
 },
 SetVisible: function(visible){
  if(visible && !this.IsVisible())
   this.Show();
  else if(!visible && this.IsVisible())
   this.Hide();
 }
});
ASPxClientPopupControl.Cast = ASPxClientControl.Cast;
ASPxClientPopupControl.GetPopupControlCollection = function(){
 return aspxGetPopupControlCollection();
}
ASPxClientPopupControlCollection = _aspxCreateClass(ASPxClientControlCollection, {
 constructor: function(){
  this.constructor.prototype.constructor.call(this);
  this.draggingControl = null;
  this.draggingWindowIndex = -1;
  this.gragXOffset = 0;
  this.gragYOffset = 0;
  this.visibleModalElements = new Array();
  this.visiblePopupWindowIds = new Array();
  this.zIndex = __aspxPopupControlZIndex;
  this.windowResizeByBodyScrollVisibilityChangingLockCount = 0;
  this.overControl = null;
  this.overWindowIndex = -1;
  this.overXPos = __aspxInvalidPosition;
  this.overYPos = __aspxInvalidPosition;
  this.appearTimerID = -1;
  this.disappearTimerID = -1;
  this.scrollEventLockCount = 0;
  this.resizeControl = null;
  this.resizeIndex = -2;
  this.resizeCursor = "";
  this.resizePanel = null;
  this.selectBanned = false;
  this.pcWindowsAreRestrictedByDocumentWindow = true;
  this.searchForTabIndexInAllElements = false;
  this.SaveScrollState();
 },
 GetPopupWindowFromID: function(id){
  var pos = id.lastIndexOf(__aspxPCWIdSuffix);
  var name = id.substring(0, pos);
  var index = id.substr(pos + __aspxPCWIdSuffix.length);
  var popupControl = aspxGetPopupControlCollection().Get(name);
  return new _aspxPopupWindow(popupControl, index);
 },
 DoHideAllWindows: function(srcElement, excptId, applyToAll){
  for(var i = this.visiblePopupWindowIds.length - 1; i >= 0 ; i --){
   var id = this.visiblePopupWindowIds[i];
   if(id == excptId) continue;
   if(srcElement != null && _aspxGetParentById(srcElement, id) != null) continue;
   var popupWindow = this.GetPopupWindowFromID(id);
   var windowCloseAction = popupWindow.popupControl.GetWindowCloseAction(popupWindow.windowIndex);
   if(popupWindow.popupControl != null && (
    (windowCloseAction != "CloseButton" && windowCloseAction != "None") || applyToAll)){
    popupWindow.popupControl.DoHideWindow(parseInt(popupWindow.windowIndex));
   }
  }
 },
 DoShowAtCurrentPos: function(name, index){
  var pc = this.Get(name);
  if(pc != null && !pc.InternalIsWindowVisible(index))
   pc.DoShowWindowAtPos(index, this.overXPos, this.overYPos, false, true, true);
 },
 ActivateWindowElement: function(element){
  var visibleWindowsCount = this.visiblePopupWindowIds.length;
  if (__aspxPopupControlZIndex <= element.style.zIndex && element.style.zIndex != visibleWindowsCount * 2 + __aspxPopupControlZIndex){
   this.DeleteWindowFromZIndexOrder(element);
  }
  this.SetWindowElementZIndex(element, __aspxPopupControlZIndex + visibleWindowsCount * 2);
  this.ResfreshTabIndexes(false);
 },  
 ResfreshTabIndexes: function(forceRecalculate){
  var topModalWindow = this.GetTopModalWindow();
  if(topModalWindow != null || forceRecalculate){
   var topModalWindowZIndexArray = _aspxGetElementZIndexArray(topModalWindow);
   this.CalculateTabIndexes(topModalWindowZIndexArray);
  }
 },
 ElementHasTabIndex: function(element) {
  if(__aspxIE && __aspxBrowserVersion < 8) {
   var elementHtml = element.outerHTML;
   var attributeIndex = elementHtml.indexOf('tabIndex');
   return attributeIndex != -1 && attributeIndex < elementHtml.indexOf(">");
  }
  else 
   return _aspxIsExists(_aspxGetAttribute(element, "tabindex"));
 },
 IsElementCanBeActive: function(element, searchForTabIndexInAllElements) {
  return element.tagName === "INPUT" || element.tagName === "A" || (searchForTabIndexInAllElements && this.ElementHasTabIndex(element));
 },
 GetCanBeActiveElements: function(searchForTabIndexInAllElements) {
  var elements = document.getElementsByTagName("*");
  var canBeActiveElements = [];
  for(var i = 0; i < elements.length; i++) { 
   if(this.IsElementCanBeActive(elements[i], searchForTabIndexInAllElements)) 
    _aspxArrayPush(canBeActiveElements, elements[i]);
  }
  return canBeActiveElements;
 },
 CalculateTabIndexes: function(topModalWindowZIndexArray){
  var searchForTabIndexInAllElements = aspxGetPopupControlCollection().searchForTabIndexInAllElements
  var elements = this.GetCanBeActiveElements(searchForTabIndexInAllElements);
  for(var i = 0; i < elements.length; i++){
     var currentElementZIndexArray = _aspxGetElementZIndexArray(elements[i]);      
     if(_aspxIsHigher(currentElementZIndexArray, topModalWindowZIndexArray)) 
     _aspxRestoreTabIndexAttribute(elements[i]); 
     else 
     _aspxChangeTabIndexAttribute(elements[i]);
  }
 },  
 PopupWindowIsModalByVisibleIndex: function(visiblePopupWindowIndex){
  return this.PopupWindowIsModalByID(this.visiblePopupWindowIds[visiblePopupWindowIndex]);
 }, 
 PopupWindowIsModalByID: function(windowElementID){
  var popupWindow = this.GetPopupWindowFromID(windowElementID);
  return popupWindow.popupControl.WindowIsModal(popupWindow.windowIndex);
 }, 
 GetTopModalWindow: function(){   
  var topWindow = null;
  var topWindowZIndexArray = null;
  for(var i = 0; i < this.visiblePopupWindowIds.length; i++){
     var currentWindow = _aspxGetElementById(this.visiblePopupWindowIds[i]);     
     if(this.PopupWindowIsModalByVisibleIndex(i) && _aspxElementIsVisible(currentWindow)){
     var currentWindowZIndexArray = _aspxGetElementZIndexArray(currentWindow); 
     if(topWindow == null || _aspxIsHigher(currentWindowZIndexArray, topWindowZIndexArray)){              
     topWindow = currentWindow;
     topWindowZIndexArray = currentWindowZIndexArray;
     }
     }
  }
  return topWindow;
 },   
 DeleteWindowFromZIndexOrder: function(element){
  for(var i = this.visiblePopupWindowIds.length - 1; i >= 0 ; i--){
   var windowElement = _aspxGetElementById(this.visiblePopupWindowIds[i]);
   if(!_aspxIsExists(windowElement))
    _aspxArrayRemoveAt(this.visiblePopupWindowIds, i);
   else if (windowElement.style.zIndex > element.style.zIndex) 
    this.SetWindowElementZIndex(windowElement, windowElement.style.zIndex - 2);
  }
 },
 SetWindowElementZIndex: function(element, zIndex){
  element.style.zIndex = zIndex;
  var iFrame = element.overflowElement;
  if(_aspxIsExists(iFrame))
   iFrame.style.zIndex = zIndex - 1;
  var modalElement = element.modalElement;
  if(_aspxIsExists(modalElement))
   modalElement.style.zIndex = zIndex - 1;
  this.UpdateWindowsStateInputElement(element.id);
  this.UpdateWindowsStateCookie(element.id);
 }, 
 AdjustModalElementsBounds: function(){
  for(var i = 0; i < this.visibleModalElements.length; i++)
   this.AdjustModalElementBounds(this.visibleModalElements[i]);
 },
 AdjustModalElementBounds: function(element){
  if(!_aspxIsExistsElement(element)) return;
  var x = _aspxPrepareClientPosForElement(0, element, true);
  var y = _aspxPrepareClientPosForElement(0, element, false);
  _aspxSetStylePosition(element, x, y);
  if(__aspxNetscapeFamily) _aspxSetStyleSize(element, 1, 1);
  _aspxSetStyleSize(element, _aspxGetDocumentWidth(), _aspxGetDocumentHeight());
 },
 ClearAppearTimer: function(){
  this.appearTimerID = _aspxClearTimer(this.appearTimerID);
 },
 ClearDisappearTimer: function(){
  this.disappearTimerID = _aspxClearTimer(this.disappearTimerID); 
 },
 IsAppearTimerActive: function(){
  return this.appearTimerID > -1;
 },
 IsDisappearTimerActive: function(){
  return this.disappearTimerID > -1;
 },
 SetAppearTimer: function(name, index, timeout){
  this.appearTimerID = _aspxSetTimeout("aspxPEMOverTimer(\"" + name + "\", " + index + ")", timeout);
 },
 SetDisappearTimer: function(name, index, timeout){
  this.disappearTimerID = _aspxSetTimeout("aspxPWDisappearTimer(\"" + name + "\", " + index + ")", timeout);
 },
 GetDocScrollDifference: function(){
  return new _aspxScrollDifference(_aspxGetDocumentScrollLeft() - this.docScrollLeft, _aspxGetDocumentScrollTop() - this.docScrollTop);
 },
 IsDocScrolled: function(scroll){
  return scroll.horizontal != 0 || scroll.vertical != 0;
 },
 SaveScrollState: function(){
  this.docScrollLeft = _aspxGetDocumentScrollLeft();
  this.docScrollTop = _aspxGetDocumentScrollTop();
 },
 InitDragObject: function(control, index, x, y, xClientCorrection, yClientCorrection){
  this.draggingControl = control;
  this.draggingWindowIndex = index;
  this.gragXOffset = x;
  this.gragYOffset = y;
  this.xClientCorrection = xClientCorrection;
  this.yClientCorrection = yClientCorrection;
  this.selectBanned = true;
 },
 InitOverObject:  function(control, index, evt){
  this.overControl = control;
  this.overWindowIndex = index;
  if(_aspxIsExists(evt)) 
     this.SaveCurrentMouseOverPos(evt);
 },
 InitResizeObject:  function(control, index, cursor, resizePanel){
  this.resizeControl = control;
  this.resizeIndex = index;
  this.resizeCursor = cursor;
  this.resizePanel = resizePanel;
  this.selectBanned = true;
 },
 IsResizeInint : function(){
  return this.resizeControl != null;
 },
 ClearDragObject: function(){
  this.draggingControl = null;
  this.draggingWindowIndex = -1;
  this.gragXOffset = 0;
  this.gragYOffset = 0;
  this.selectBanned = this.resizeControl != null;
 },
 ClearResizeObject: function(){
  this.resizeControl = null;
  this.resizeIndex = -2;
  this.resizeCursor = "";
  this.selectBanned = this.draggingControl != null;
  this.resizePanel.parentNode.removeChild(this.resizePanel);
 },
 Drag: function(evt){
  var x = _aspxGetEventX(evt);
  var y = _aspxGetEventY(evt);
  if(this.pcWindowsAreRestrictedByDocumentWindow && _aspxCoordinatesInDocumentRect(x, y)){
   x += this.gragXOffset;
   y += this.gragYOffset;
   this.draggingControl.OnDrag(this.draggingWindowIndex, x, y, this.xClientCorrection, this.yClientCorrection);
  }
 },
 DragStop: function(){
  this.draggingControl.OnDragStop(this.draggingWindowIndex);
  this.ClearDragObject();
 },
 ResizeStop: function(evt){
  this.resizeControl.OnResizeStop(evt, this.resizeIndex, this.resizeCursor, this.resizePanel);
  aspxGetPopupControlCollection().ClearResizeObject();
 },
 OnPWMouseMove: function(evt, name, index){
  if (this.draggingControl == null && 
   this.overControl == null && 
   this.resizeControl == null){
   var pc = aspxGetPopupControlCollection().Get(name);
   if(pc != null) pc.OnMouseMove(evt, index);
  }
 },
 OnPWMouseOver: function(evt){
  if (!_aspxIsExists(this.overControl) || _aspxIsExists(this.draggingControl)) return;
  if(this.IsOverPopupWindow(evt))
   this.ClearDisappearTimer();
 },
 IsOverPopupWindow: function(evt){
  return _aspxFindEventSourceParentByTestFunc(evt, aspxTestOverPopupWindowElement) != null;
 },
 OnDocumentMouseDown: function(evt){
  var popupElement = _aspxFindEventSourceParentByTestFunc(evt, aspxTestPopupControlElement);
  var excptId = popupElement == null ? "" :
   popupElement.DXPopupElementControl.GetWindowElementId(popupElement.DXPopupWindowIndex);
  this.OnMouseDownCore(evt, excptId);
 },
 OnMouseDown: function(evt){
  this.OnMouseDownCore(evt, "");
 },
 OnMouseDownCore: function(evt, excptId){
  if(this.IsDocumentIsCoveredByModalElement())
   return;
  var srcElement = _aspxGetEventSource(evt);
  this.DoHideAllWindows(srcElement, excptId, false);
  aspxGetPopupControlCollection().ClearAppearTimer();
 },
 OnMouseMove: function(evt){
  if(this.draggingControl != null){
   if(__aspxIE && !_aspxGetIsLeftButtonPressed(evt)) 
    return this.DragStop();
   else
    this.Drag(evt);
  }
  else if(this.overControl != null){
   this.OnMouseOver(evt);
  }
  else if(this.resizeControl != null){
   if(__aspxIE && !_aspxGetIsLeftButtonPressed(evt)) 
    this.ResizeStop(evt);
   else
    this.resizeControl.OnResize(evt, this.resizeIndex, this.resizeCursor, this.resizePanel);
  }
 },
 OnMouseOver: function(evt){
  var element = _aspxFindEventSourceParentByTestFunc(evt, aspxTestPopupControlOverElement);
  if (element != null){
   this.ClearDisappearTimer();
   this.SaveCurrentMouseOverPos(evt);
   return _aspxCancelBubble(evt);
  }
  this.OnMouseOut();
 },
 OnMouseOut: function(){
  if (!_aspxIsExists(this.overControl) || _aspxIsExists(this.draggingControl)) return;
  this.ClearAppearTimer();
  var windowCloseAction = this.overControl.GetWindowCloseAction(this.overWindowIndex);
  if(windowCloseAction == "MouseOut"  && this.overControl.InternalIsWindowVisible(this.overWindowIndex)){
   if (!this.IsDisappearTimerActive())
    this.SetDisappearTimer(this.overControl.name, this.overWindowIndex, this.overControl.disappearAfter);
  }
  else
   this.OverStop();
 },
 OnMouseUp: function(evt){
  if(this.draggingControl != null)  
   this.DragStop();
  if(this.resizeControl != null)  
   this.ResizeStop(evt);
 },
 OnResize: function(evt){
  this.AutoUpdateElementsPosition();
  this.AdjustModalElementsBounds();
 },
 OnScroll: function(evt){
  if(this.scrollEventLockCount > 0)
   return;
  var scroll = this.GetDocScrollDifference();
  if(this.IsDocScrolled(scroll)){ 
   this.CorrectPositionAtScroll(scroll);
   this.AdjustModalElementsBounds();
   this.SaveScrollState();
  }
 },
 LockScrollEvent: function() {
  this.scrollEventLockCount++;
 },
 UnlockScrollEvent: function() {
  this.scrollEventLockCount--;
 },
 CorrectPositionAtScroll: function(scroll){
  for(var i = 0; i < this.visiblePopupWindowIds.length; i++){
    var popupWindow = this.GetPopupWindowFromID(this.visiblePopupWindowIds[i]);
    var popupControl = popupWindow.popupControl;
    if(popupControl != null && popupControl.InternalIsWindowVisible(popupWindow.windowIndex)){
     var isNeedFix = popupControl.IsFFTextCurFixRequired(popupWindow.windowIndex);
     if(popupControl.autoUpdatePosition) 
     popupWindow.popupControl.TryAutoUpdatePosition();   
     else if(isNeedFix) 
     this.FFScrollEmulation(scroll, popupWindow);
    }
  } 
 },
 FFScrollEmulation: function(scroll, popupWindow){
  var windowElement = popupWindow.popupControl.GetWindowElement(popupWindow.windowIndex);
  windowElement.style.left = (windowElement.offsetLeft - scroll.horizontal) + "px";
  windowElement.style.top = (windowElement.offsetTop - scroll.vertical) + "px";
 },
 OnSelectStart: function(){
  return !this.selectBanned;
 },
 OverStop: function(){
  this.overControl = null;
  this.overWindowIndex = -1;
 },
 OnPWDisappearTimer: function(name, index){
  var pc = this.Get(name);
  if(pc != null){
   if(!pc.DoHideWindow(index))
    this.OverStop();  
   else
    this.ClearDisappearTimer();
  }
 },
 SaveCurrentMouseOverPos: function(evt){
  this.overXPos = _aspxGetEventX(evt);
  this.overYPos = _aspxGetEventY(evt);
 },
 RegisterVisibleModalElement: function(element){
  if(_aspxArrayIndexOf(this.visibleModalElements, element) == -1)
   _aspxArrayPush(this.visibleModalElements, element);
 },
 UnregisterVisibleModalElement: function(element){
  _aspxArrayRemove(this.visibleModalElements, element);
 },
 RegisterVisibleWindow: function(element, popupControl, index){
  if(_aspxArrayIndexOf(this.visiblePopupWindowIds, element.id) == -1){
   _aspxArrayPush(this.visiblePopupWindowIds, element.id);
   if(_aspxIsExists(popupControl))
    aspxGetPopupControlCollection().InitOverObject(popupControl, index, null);
   this.OnRegisteredVisibleWindow(element);
  }
 },
 OnRegisteredVisibleWindow: function(element){
  var elementIndex = _aspxArrayIndexOf(this.visiblePopupWindowIds, element.id);
  if(this.PopupWindowIsModalByVisibleIndex(elementIndex))
     _aspxRemoveFocus(element);
 },
 UnregisterVisibleWindow: function(element){
  this.DeleteWindowFromZIndexOrder(element);
  _aspxArrayRemove(this.visiblePopupWindowIds, element.id);
  var forceRecalculate = this.PopupWindowIsModalByID(element.id);
  this.ResfreshTabIndexes(forceRecalculate);
 },
 UpdateWindowsStateCookie: function(id){
  var pos = id.lastIndexOf(__aspxPCWIdSuffix);
  var name = id.substring(0, pos);
  var popupControl = aspxGetPopupControlCollection().Get(name);
  if(popupControl != null)
   popupControl.UpdateWindowsStateCookie(false);    
 },
 UpdateWindowsStateInputElement: function(id){
  var pos = id.lastIndexOf(__aspxPCWIdSuffix);
  var name = id.substring(0, pos);
  var popupControl = aspxGetPopupControlCollection().Get(name);
  if(popupControl != null)
   popupControl.UpdateWindowsStateInputElement(false);    
 },
 AutoUpdateElementsPosition: function() {
  for(var i = 0; i < this.visiblePopupWindowIds.length; i++){
   var popupWindow = this.GetPopupWindowFromID(this.visiblePopupWindowIds[i]);
   var popupControl = popupWindow.popupControl;
   if(popupControl != null && popupControl.InternalIsWindowVisible(popupWindow.windowIndex))
    popupControl.TryAutoUpdatePosition();
  }
 },
 IsDocumentIsCoveredByModalElement: function() {
  for(var i = 0; i < this.visiblePopupWindowIds.length; i++){
   var popupWindow = this.GetPopupWindowFromID(this.visiblePopupWindowIds[i]);
   var popupControl = popupWindow.popupControl;
   if(popupControl != null && _aspxIsExists(popupControl.GetWindowModalElement(popupWindow.windowIndex)))
    return true;
  }
  return false;
 },
 LockWindowResizeByBodyScrollVisibilityChanging: function(){
  this.windowResizeByBodyScrollVisibilityChangingLockCount++;
 },
 UnlockWindowResizeByBodyScrollVisibilityChanging: function(){
  this.windowResizeByBodyScrollVisibilityChangingLockCount--;
 },
 WindowResizeByBodyScrollVisibilityChangingLocked: function(){
  return this.windowResizeByBodyScrollVisibilityChangingLockCount > 0;
 },
 HideAllWindows: function(){
  this.DoHideAllWindows(null, "", true);
 }
});
var __aspxPopupControlCollection = null;
function aspxGetPopupControlCollection(){
 if(__aspxPopupControlCollection == null)
  __aspxPopupControlCollection  = new ASPxClientPopupControlCollection();
 return __aspxPopupControlCollection;
}
ASPxClientPopupWindow = _aspxCreateClass(null, {
 constructor: function(popupControl, index, name){
  this.popupControl = popupControl;
  this.index = index;
  this.name = name;
 },
 GetHeaderImageUrl: function(){
  return this.popupControl.GetWindowHeaderImageUrl(this.index);
 },
 SetHeaderImageUrl: function(value){
  this.popupControl.SetWindowHeaderImageUrl(this.index, value);
 },
 GetFooterImageUrl: function(){
  return this.popupControl.GetWindowFooterImageUrl(this.index);
 },
 SetFooterImageUrl: function(value){
  this.popupControl.SetWindowFooterImageUrl(this.index, value);
 },
 GetHeaderNavigateUrl: function(){
  return this.popupControl.GetWindowHeaderNavigateUrl(this.index);
 },
 SetHeaderNavigateUrl: function(value){
  this.popupControl.SetWindowHeaderNavigateUrl(this.index, value);
 },
 GetFooterNavigateUrl: function(){
  return this.popupControl.GetWindowFooterNavigateUrl(this.index);
 },
 SetFooterNavigateUrl: function(value){
  this.popupControl.SetWindowFooterNavigateUrl(this.index, value);
 },
 GetHeaderText: function(){
  return this.popupControl.GetWindowHeaderText(this.index);
 },
 SetHeaderText: function(value){
  this.popupControl.SetWindowHeaderText(this.index, value);
 },
 GetFooterText: function(){
  return this.popupControl.GetWindowFooterText(this.index);
 },
 SetFooterText: function(value){
  this.popupControl.SetWindowFooterText(this.index, value);
 }
});
ASPxClientPopupWindowEventArgs = _aspxCreateClass(ASPxClientEventArgs, {
 constructor: function(window){
  this.constructor.prototype.constructor.call(this);
  this.window = window;
 }
});
ASPxClientPopupWindowCancelEventArgs = _aspxCreateClass(ASPxClientCancelEventArgs, {
 constructor: function(window){
  this.constructor.prototype.constructor.call(this);
  this.window = window;
 }
});
function _aspxPopupWindow(popupControl, windowIndex){
 this.popupControl = popupControl;
 this.windowIndex = windowIndex;
}
function _aspxScrollDifference(horizontal, vertical){
 this.horizontal = horizontal;
 this.vertical = vertical;
}
function aspxPEMOverTimer(name, index){
 aspxGetPopupControlCollection().DoShowAtCurrentPos(name, index);
}
function aspxPWDisappearTimer(name, index){
 aspxGetPopupControlCollection().OnPWDisappearTimer(name, index);
}
function aspxPWCBClick(evt, name, index){
 if(__aspxIE || __aspxOpera)
  _aspxEmulateDocumentOnMouseDown(evt); 
 var pc = aspxGetPopupControlCollection().Get(name);
 if(pc != null) pc.OnCloseButtonClick(index);
}
function aspxPWCBMDown(evt){
 return _aspxCancelBubble(evt);
}
function aspxPWEMOver(evt){
 aspxGetPopupControlCollection().OnPWMouseOver(evt);
}
function aspxPWMEMDown(evt){
 var element = _aspxGetEventSource(evt);
 if (element != null) 
  element.DXModalPopupControl.OnMouseDownModalElement(evt, element.DXModalPopupWindowIndex);
}
function aspxPEMEvent(evt){
 var element = _aspxFindEventSourceParentByTestFunc(evt, aspxTestPopupControlElement);
 if (element != null){
  if (evt.type == "mousedown"){
   if (element.DXPopupElementControl.InternalIsWindowVisible(element.DXPopupWindowIndex))
    element.isPopuped = true;
   else
    element.isPopuped = false;
   aspxGetPopupControlCollection().OnMouseDown(evt);     
  }
  else{
   var windowPopupAction = element.DXPopupElementControl.GetWindowPopupAction(element.DXPopupWindowIndex);
   if (windowPopupAction=="RightMouseClick" || _aspxGetIsLeftButtonPressed(evt)){
    if (windowPopupAction=="RightMouseClick")
     _aspxPreventContextMenu(evt);
    var windowCloseAction = element.DXPopupElementControl.GetWindowCloseAction(element.DXPopupWindowIndex);
    if (!(element.isPopuped && windowCloseAction == "OuterMouseClick"))
     element.DXPopupElementControl.DoShowWindow(element.DXPopupWindowIndex, evt);
    if (windowCloseAction == "MouseOut")
     aspxGetPopupControlCollection().InitOverObject(element.DXPopupElementControl, element.DXPopupWindowIndex, evt);
    return false;
   }
  }
 }
}
function aspxPWDGMDown(evt, name, index){
 return aspxPWMDown(evt, name, index, true);
}
function aspxPWGripMDown(evt, name, index){
 aspxPWMDownCore(evt, name, index, false);
 return aspxPWCBMDown(evt);
}
function aspxPWMDown(evt, name, index, isWindowContentDraggingAllowed){
 aspxPWMDownCore(evt, name, index, isWindowContentDraggingAllowed);
 if(isWindowContentDraggingAllowed){ 
  if (!__aspxIE) 
   evt.preventDefault();
  return _aspxCancelBubble(evt); 
 }
}
function aspxPWMDownCore(evt, name, index, isDraggingAllowed){
 var pc = aspxGetPopupControlCollection().Get(name);
 if(pc != null) {
  pc.OnActivateMouseDown(evt, index);
  pc.OnMouseDown(evt, index, isDraggingAllowed);
 }
}
function aspxPWResize(name, index){
 var pc = aspxGetPopupControlCollection().Get(name);
 if(pc != null) pc.ResizeWindowIFrame(index);
}
function aspxPWMMove(evt, name, index){
 aspxGetPopupControlCollection().OnPWMouseMove(evt, name, index);
}
function aspxPCATimer(name, index){
 var pc = aspxGetPopupControlCollection().Get(name);
 if(pc != null) pc.OnAnimationTimer(index);
}
function aspxPCAStop(name, index){
 var pc = aspxGetPopupControlCollection().Get(name);
 if(pc != null) pc.OnAnimationStop(index);
}
function aspxPCIframeLoad(evt){
 var srcElement = _aspxGetEventSource(evt);
 if(_aspxIsExists(srcElement)){
  var pcName = srcElement.popupControlName;
  var pcWndIndex = srcElement.pcWndIndex;
  if(_aspxIsExists(pcName)){ 
   var pc = aspxGetPopupControlCollection().Get(pcName);
   pc.OnIFrameLoad(pcWndIndex);
  }
 }
}
_aspxAttachEventToDocument("mousedown", aspxPopupControlDocumentMouseDown);
function aspxPopupControlDocumentMouseDown(evt){
 aspxGetPopupControlCollection().OnDocumentMouseDown(evt);
}
_aspxAttachEventToDocument("mouseup", aspxPopupControlDocumentMouseUp);
function aspxPopupControlDocumentMouseUp(evt){
 return aspxGetPopupControlCollection().OnMouseUp(evt); 
}
_aspxAttachEventToDocument("mousemove", aspxPopupControlDocumentMouseMove);
function aspxPopupControlDocumentMouseMove(evt){
 if(typeof(aspxGetPopupControlCollection) != "undefined")
  aspxGetPopupControlCollection().OnMouseMove(evt); 
}
_aspxAttachEventToDocument("mouseout", aspxPopupControlDocumentMouseOut);
function aspxPopupControlDocumentMouseOut(){
 if(typeof(aspxGetPopupControlCollection) != "undefined")
  aspxGetPopupControlCollection().OnMouseOut(); 
}
_aspxAttachEventToElement(window, "resize", aspxPopupControlWindowResize);
function aspxPopupControlWindowResize(evt){
 aspxGetPopupControlCollection().OnResize(evt); 
}
_aspxAttachEventToElement(window, "scroll", aspxPopupControlWindowScroll);
function aspxPopupControlWindowScroll(evt){
 aspxGetPopupControlCollection().OnScroll(evt); 
}
_aspxAttachEventToDocument("selectstart", aspxPopupControlDocumentSelectStart);
function aspxPopupControlDocumentSelectStart(evt){
 var ret = aspxGetPopupControlCollection().OnSelectStart(evt); 
 if(!ret) return false; 
}
function aspxTestPopupControlElement(element){
 return (_aspxIsExists(element.DXPopupElementControl) && _aspxIsExists(element.DXPopupWindowIndex));
}
function aspxTestPopupControlOverElement(element){
 var collection = aspxGetPopupControlCollection();
 var windowId = collection.overControl.GetWindowElementId(collection.overWindowIndex);
 var popupElement = collection.overControl.GetPopupElement(collection.overWindowIndex);
 if (_aspxIsExists(popupElement)) {
  var popupElementId = popupElement.id;
  return (element.id == windowId || element.id == popupElementId);
 }
 return false;
}
function aspxTestOverPopupWindowElement(element){
 var collection = aspxGetPopupControlCollection();
 var windowId = collection.overControl.GetWindowElementId(collection.overWindowIndex);
 var popupElement = collection.overControl.GetPopupElement(collection.overWindowIndex);
 if (_aspxIsExists(popupElement)) {
  var popupElementId = popupElement.id;
  return (element.id == windowId || element.id == popupElementId);
 }
 return false;
}
