var __aspxInvalidDimension = -10000;
var __aspxInvalidPosition = -10000;
var __aspxAbsoluteLeftPosition = -10000;
var __aspxAbsoluteRightPosition = 10000;
var __aspxMenuZIndex = 21998;
var __aspxPopupControlZIndex = 11998;
var  __aspxCheckSizeCorrectedFlag = true;
var __aspxCallbackSeparator = ":";
var __aspxItemIndexSeparator = "i";
var __aspxCallbackResultPrefix = "/*^^^DX^^^*/";
var __aspxItemClassName = "dxi";
var __aspxAccessibilityEmptyUrl = "javascript:;";
var __aspxClassesScriptParsed = false; 
var __aspxDocumentLoaded = false; 
var __aspxEmptyAttributeValue = new Object();
var __aspxEmptyCachedValue = new Object();
var __aspxCachedRules = new Object();
var __aspxCultureInfo = {
 twoDigitYearMax: 2029,
 ts: ":",
 ds: "/",
 am: "AM",
 pm: "PM",
 monthNames: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", ""],
 genMonthNames: null,
 abbrGenMonthNames: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ""],
 abbrDayNames: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
 dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
 numDecimalPoint: ".",
 numPrec: 2,
 numGroupSeparator: ",", 
 numGroups: [ 3 ],
 numNegPattern: 1,
 numPosInf: "Infinity", 
 numNegInf: "-Infinity", 
 numNan: "NaN",
 currency: "$",
 currDecimalPoint: ".",
 currPrec: 2,
 currGroupSeparator: ",",
 currGroups: [ 3 ],
 currPosPattern: 0,
 currNegPattern: 0,
 percentPattern: 0,
 shortTime: "h:mm tt",
 longTime: "h:mm:ss tt",
 shortDate: "M/d/yyyy",
 longDate: "dddd, MMMM dd, yyyy",
 monthDay: "MMMM dd",
 yearMonth: "MMMM, yyyy"
};
__aspxCultureInfo.genMonthNames = __aspxCultureInfo.monthNames;
function _aspxGetInvariantDateString(date) {
 if(!date)
  return "01/01/0001";
 var day = date.getDate();
 var month = date.getMonth() + 1;
 var year = date.getFullYear();
 var result = "";
 if(month < 10)
  result += "0";
 result += month.toString() + "/";
 if(day < 10)
  result += "0";
 result += day.toString() + "/" + year.toString();
 return result;
}
function _aspxGetInvariantDateTimeString(date) {
 var dateTimeString = _aspxGetInvariantDateString(date);
 var time = {
  h: date.getHours(),
  m: date.getMinutes(),
  s: date.getSeconds()
 };
 for(var key in time) {
  var str = time[key].toString();
  if(str.length < 2)
   str = "0" + str;
  time[key] = str;
 }
 dateTimeString += " " + time.h + ":" + time.m + ":" + time.s;
 var msec = date.getMilliseconds();
 if(msec > 0)
  dateTimeString += "." + msec.toString();
 return dateTimeString;
}
function _aspxExpandTwoDigitYear(value) {
 value += 1900;
 if(value + 99 < __aspxCultureInfo.twoDigitYearMax)
  value += 100;
 return value;  
}
function _aspxToUtcTime(date) {
 var result = new Date();
 result.setTime(date.valueOf() + 60000 * date.getTimezoneOffset());
 return result;
}
function _aspxToLocalTime(date) {
 var result = new Date();
 result.setTime(date.valueOf() - 60000 * date.getTimezoneOffset());
 return result; 
}
var ASPxKey = {
 F1     : 112,
 F2     : 113,
 F3     : 114,
 F4     : 115,
 F5     : 116,
 F6     : 117,
 F7     : 118,
 F8     : 119,
 F9     : 120,
 F10    : 121,
 F11    : 122,
 F12    : 123,
 Ctrl   : 17,
 Shift  : 16,
 Alt    : 18,
 Enter  : 13,
 Home   : 36,
 End    : 35,
 Left   : 37,
 Right  : 39,
 Up     : 38,
 Down   : 40,
 PageUp    : 33,
 PageDown  : 34,
 Esc    : 27,
 Space  : 32,
 Tab    : 9,
 Backspace : 8,
 Delete    : 46,
 Insert    : 45,
 ContextMenu  : 93,
 Windows   : 91,
 Decimal   : 110
};
var ASPxCallbackType = {
 Data: "d",
 Common: "c"
};
var __aspxServerForm = null;
function _aspxGetServerForm() {
 if(typeof(window.__aspxServerFormID) == "undefined")
  return null;
 if(!_aspxIsExistsElement(__aspxServerForm))
  __aspxServerForm = _aspxGetElementById(window.__aspxServerFormID);
 return __aspxServerForm;
}
function _aspxGetActiveElement() {
 try{
  return document.activeElement;
 } catch(e) {
 }
 return null;
}
var __aspxUserAgent = navigator.userAgent.toLowerCase();
var __aspxMozilla,
 __aspxIE,
 __aspxFirefox,
 __aspxNetscape,
 __aspxSafari,
 __aspxChrome,
 __aspxOpera,
 __aspxBrowserVersion, 
 __aspxBrowserMajorVersion, 
 __aspxWindowsPlatform,
 __aspxMacOSPlatform,
 __aspxWebKitFamily, 
 __aspxNetscapeFamily; 
function _aspxIdentUserAgent(userAgent) {
 var browserTypesOrderedList = [ "Mozilla", "IE", "Firefox", "Netscape", "Safari", "Chrome", "Opera" ];
 var defaultBrowserType = "IE";
 var defaultPlatform = "Win";
 var defaultVersions = { Safari: 2, Chrome: 0.1, Mozilla: 1.9, Netscape: 8, Firefox: 2, Opera: 9, IE: 6 };
 if(!userAgent || userAgent.length == 0) {
  _aspxFillUserAgentInfo(browserTypesOrderedList, defaultBrowserType, defaultVersions[defaultBrowserType], defaultPlatform);
  return;
 }
 try {
  var platformIdentStrings = {
   "Windows": "Win",
   "Macintosh": "Mac",
   "Mac OS": "Mac",
   "Mac_PowerPC": "Mac"
  };
  var optSlashOrSpace = "(?:/|\\s*)?";
  var version = "(\\d+)(?:\\.((?:\\d+?[1-9])|\\d)0*?)?";
  var optVersion = "(?:" + version + ")?";
  var patterns = {
   Safari: "applewebkit(?:.*?(?:version/" + version + "[\\.\\w\\d]*?\\s+safari))?",
   Chrome: "chrome" + optSlashOrSpace + optVersion,
   Mozilla: "mozilla(?:.*rv:" + optVersion + ".*Gecko)?",
   Netscape: "(?:netscape|navigator)\\d*/?\\s*" + optVersion,
   Firefox: "firefox" + optSlashOrSpace + optVersion,
   Opera: "opera" + optSlashOrSpace + optVersion,
   IE: "msie\\s*" + optVersion
  };
  var browserType;
  var version = -1;
  for(var i = 0; i < browserTypesOrderedList.length; i++) {
   var browserTypeCandidate = browserTypesOrderedList[i];
   var regExp = new RegExp(patterns[browserTypeCandidate], "i");
   if(regExp.compile)
    regExp.compile(patterns[browserTypeCandidate], "i");
   var matches = regExp.exec(userAgent);
   if(matches && matches.index >= 0) {
    browserType = browserTypeCandidate;
    version = -1;
    var versionStr = "";
    if(matches[1]) {
     versionStr += matches[1];
     if(matches[2])
      versionStr += "." + matches[2];
    }
    if(versionStr != "") {
     version = parseFloat(versionStr);
     if(version == NaN)
      version = -1;
    }
   }
  }
  if(!browserType)
   browserType = defaultBrowserType;
  if(version == -1)
   version = defaultVersions[browserType];
  var platform;
  var minOccurenceIndex = Number.MAX_VALUE;
  for(var identStr in platformIdentStrings) {
   var occurenceIndex = userAgent.indexOf(identStr);
   if(occurenceIndex >= 0 && occurenceIndex < minOccurenceIndex) {
    minOccurenceIndex = occurenceIndex;
    platform = platformIdentStrings[identStr];
   }
  }
  if(!platform)
   platform = defaultPlatform;
  _aspxFillUserAgentInfo(browserTypesOrderedList, browserType, version, platform);
 } catch(e) {
  _aspxFillUserAgentInfo(browserTypesOrderedList, defaultBrowserType, defaultVersions[defaultBrowserType], defaultPlatform);
 }
}
function _aspxFillUserAgentInfo(browserTypesOrderedList, browserType, version, platform) {
 for(var i = 0; i < browserTypesOrderedList.length; i++) {
  var type = browserTypesOrderedList[i];
  eval("__aspx" + type + " = type == browserType");
 }
 __aspxBrowserVersion = Math.floor(10.0 * version) / 10.0;
 __aspxBrowserMajorVersion = Math.floor(__aspxBrowserVersion);
 __aspxWindowsPlatform = platform == "Win";
 __aspxMacOSPlatform = platform == "Mac";
 __aspxWebKitFamily = __aspxSafari || __aspxChrome;
 __aspxNetscapeFamily = __aspxNetscape || __aspxMozilla || __aspxFirefox;
}
_aspxIdentUserAgent(__aspxUserAgent);
function _aspxArrayPush(array, element){
 if(_aspxIsExists(array.push))
  array.push(element);
 else  
  array[array.length] = element;
}
function _aspxArrayInsert(array, element, position){
 if(0 <= position && position < array.length){
  for(var i = array.length; i > position; i --)
   array[i] = array[i - 1];
  array[position] = element;
 }
 else
  _aspxArrayPush(array, element);
}
function _aspxArrayRemove(array, element){
 var index = _aspxArrayIndexOf(array, element);
 if(index > -1) _aspxArrayRemoveAt(array, index);
}
function _aspxArrayRemoveAt(array, index){
 if(index >= 0  && index < array.length){
  for(var i = index; i < array.length - 1; i++)
   array[i] = array[i + 1];
  array.pop();
 }
}
function _aspxArrayClear(array){
 while(array.length > 0)
  array.pop();
}
function _aspxArrayIndexOf(array, element){
 for(var i = 0; i < array.length; i++){
  if(array[i] == element)
   return i;
 } 
 return -1;
}
function _aspxArrayIntegerAscendingSort(array){
 array.sort(function(i1, i2){
  if (i1 > i2)
   return 1;
  else if (i1 < i2)
   return -1;
  else
   return 0;
 });
}
function _aspxCreateHashTableFromArray(array) {
 var hash = [];
 for(var i = 0; i < array.length; i++)
  hash[array[i]] = 1;
 return hash;
}
function _aspxCreateIndexHashTableFromArray(array) {
 var hash = [];
 for(var i = 0; i < array.length; i++)
  hash[array[i]] = i;
 return hash;
}
var __aspxDefaultBinarySearchComparer = function(arrayElement, value) {
 if(arrayElement == value)
  return 0;
 else
  return arrayElement < value ? -1 : 1;
};
function _aspxArrayBinarySearch(array, value, binarySearchComparer, startIndex, length) {
 if(!_aspxIsExists(binarySearchComparer))
  binarySearchComparer = __aspxDefaultBinarySearchComparer;
 if(!_aspxIsExists(startIndex))
  startIndex = 0;
 if(!_aspxIsExists(length))
  length = array.length - startIndex;  
 var endIndex = (startIndex + length) - 1;
 while (startIndex <= endIndex) {
  var middle =  (startIndex + ((endIndex - startIndex) >> 1));
  var compareResult = binarySearchComparer(array[middle], value);
  if (compareResult == 0)
   return middle;
  if (compareResult < 0)
   startIndex = middle + 1;
  else
   endIndex = middle - 1;
 }
 return -(startIndex + 1);
}
function _aspxApplyReplacement(text, replecementTable) {
 for(var i = 0; i < replecementTable.length; i++) {
  var replacement = replecementTable[i];
  text = text.replace(replacement[0], replacement[1]);
 }
 return text;
}
function _aspxEncodeHtml(html) {
 return _aspxApplyReplacement(html, [
  [ /&quot;/g, '&quotx;' ], [ /"/g, '&quot;' ],
  [ /&amp;/g,  '&ampx;'  ], [ /&/g, '&amp;'  ],
  [ /&lt;/g,   '&ltx;'   ], [ /</g, '&lt;'   ],
  [ /&gt;/g,   '&gtx;'   ], [ />/g, '&gt;'   ]
 ]);
}
function _aspxDecodeHtml(html) {
 return _aspxApplyReplacement(html, [
  [ /&gt;/g,   '>' ], [ /&gtx;/g,  '&gt;'   ],
  [ /&lt;/g,   '<' ], [ /&ltx;/g,  '&lt;'   ],
  [ /&amp;/g,  '&' ], [ /&ampx;/g, '&amp;'  ],
  [ /&quot;/g, '"' ], [ /&quotx;/g,'&quot;' ]
 ]);
}
function _aspxParseShortcutString(shortcutString) {
 if(!_aspxIsExists(shortcutString))
  return 0;
 var isCtrlKey = false;
 var isShiftKey = false;
 var isAltKey = false;
 var keyCode = null;
 var shcKeys = shortcutString.toString().split("+");
 if (shcKeys.length > 0) {
  for (var i = 0; i < shcKeys.length; i++) {
   var key = _aspxTrim(shcKeys[i].toUpperCase());
   switch (key) {
    case "CTRL":
     isCtrlKey = true;
     break;
    case "SHIFT":
     isShiftKey = true;
     break;
    case "ALT":
     isAltKey = true;
     break;
    case "F1": keyCode = ASPxKey.F1; break;
    case "F2": keyCode = ASPxKey.F2; break;
    case "F3": keyCode = ASPxKey.F3; break;
    case "F4": keyCode = ASPxKey.F4; break;
    case "F5": keyCode = ASPxKey.F5; break;
    case "F6": keyCode = ASPxKey.F6; break;
    case "F7": keyCode = ASPxKey.F7; break;
    case "F8": keyCode = ASPxKey.F8; break;
    case "F9": keyCode = ASPxKey.F9; break;
    case "F10":   keyCode = ASPxKey.F10; break;
    case "F11":   keyCode = ASPxKey.F11; break;
    case "F12":   keyCode = ASPxKey.F12; break;
    case "ENTER": keyCode = ASPxKey.Enter; break;
    case "HOME":  keyCode = ASPxKey.Home; break;
    case "END":   keyCode = ASPxKey.End; break;
    case "LEFT":  keyCode = ASPxKey.Left; break;
    case "RIGHT": keyCode = ASPxKey.Right; break;
    case "UP": keyCode = ASPxKey.Up; break;
    case "DOWN":  keyCode = ASPxKey.Down; break;
    case "PAGEUP": keyCode = ASPxKey.PageUp; break;
    case "PAGEDOWN": keyCode = ASPxKey.PageDown; break;
    case "SPACE": keyCode = ASPxKey.Space; break;
    case "TAB":   keyCode = ASPxKey.Tab; break;
    case "BACK":  keyCode = ASPxKey.Backspace; break;
    case "CONTEXT": keyCode = ASPxKey.ContextMenu; break;
    case "ESCAPE":
    case "ESC":
     keyCode = ASPxKey.Esc;
     break;
    case "DELETE":
    case "DEL":
     keyCode = ASPxKey.Delete;
     break;
    case "INSERT":
    case "INS":
     keyCode = ASPxKey.Insert;
     break;
    case "PLUS":
     keyCode = "+".charCodeAt(0);
     break;
    default:
     keyCode = key.charCodeAt(0);
     break;
   }
  }
 } else
  alert("Invalid shortcut");
 return _aspxGetShortcutCode(keyCode, isCtrlKey, isShiftKey, isAltKey);
}
function _aspxGetShortcutCode(keyCode, isCtrlKey, isShiftKey, isAltKey) {
 var value = keyCode & 0xFFFF;
 var flags = 0;
 flags |= isCtrlKey ? 1 << 0 : 0;
 flags |= isShiftKey ? 1 << 2 : 0;
 flags |= isAltKey ? 1 << 4 : 0;
 value |= flags << 16;
 return value;
}
function _aspxGetShortcutCodeByEvent(evt) {
 return _aspxGetShortcutCode(_aspxGetKeyCode(evt), evt.ctrlKey, evt.shiftKey, evt.altKey);
}
var ASPxImageUtils = {
 IsAlphaFilterNeed: function(src){
  return __aspxIE && __aspxBrowserVersion < 7 && this.IsPng(src);
 },
 IsPng: function(src){
  return src.slice(-3).toLowerCase() == "png";
 },
 GetImageFilterStyle: function(src){
  return "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=" + src + ", sizingMethod=scale)";
 },
 GetImageSrc: function (image){
  if(_aspxIsAlphaFilterUsed(image)){ 
   var filter = image.style.filter;
   var regSrc = new RegExp("src=", "g");
   var regPng = new RegExp(".png", "g");
   var beginIndex = regSrc.exec(filter).lastIndex;
   var endIndex = regPng.exec(filter).lastIndex;
   return filter.substring(beginIndex, endIndex);
  } 
  return image.src;
 },
 SetImageSrc: function(image, src){
  var isAlphaFilterNeed = this.IsAlphaFilterNeed(src);
  if(isAlphaFilterNeed){
   image.src = __aspxEmptyImageUrl;
   image.style.filter = this.GetImageFilterStyle(src);
  } else {
   image.src = src;
   image.style.filter = "";
  }
 },
 SetSize: function(image, width, height){
  image.style.width = width + "px";
  image.style.height = height + "px";
 },
 GetSize: function(image, isWidth){
  return (isWidth ? image.offsetWidth : image.offsetHeight);
 }
};
function _aspxAddAlphaImageLoaderTarget(id, imageUrl) {
 if(!window._aspxAlphaImageLoaderTargets)
  window._aspxAlphaImageLoaderTargets = [];
 window._aspxAlphaImageLoaderTargets.push({ elementId: id, bgImageUrl: imageUrl });
}
function _aspxEnsureAlphaImageLoaderApplierRegistered() {
 if(!window._aspxPostponedAlphaImageLoaderApplierAdded) {
  var handler = function() {
   if(window._aspxAlphaImageLoaderTargets) {
    for(var i = 0; i < window._aspxAlphaImageLoaderTargets.length; i++) {
     var target = window._aspxAlphaImageLoaderTargets[i];
     _aspxApplyAlphaImageLoaderToBackground(target.elementId, target.bgImageUrl);
    }
    window._aspxAlphaImageLoaderTargets = [];
   }
  };
  if(typeof(aspxGetControlCollection) == "function")
   aspxGetControlCollection().ControlsInitialized.AddHandler(handler);
  else
   window.attachEvent("onload", handler);
  window._aspxPostponedAlphaImageLoaderApplierAdded = true;
 }
}
function _aspxApplyAlphaImageLoaderToBackground(elementId, bgImageUrl) {
 var element = document.all[elementId];
 if(element && element.length)
  element = document.getElementById(elementId);
 element.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=" + bgImageUrl + ", sizingMethod=crop)";
}
function _aspxApplyAlphaImageLoaderToImage(image) {
 if(image.alphaImageLoaderApplied)
  return;
 if(window.__aspxEmptyImageUrl) {
  image.alphaImageLoaderApplied = true;
  var imageUrl = image.src;
  image.src = window.__aspxEmptyImageUrl;
  image.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=" + imageUrl + ", sizingMethod=scale)";
 } else {
  var token = window.setInterval(function() {
   if(window.__aspxEmptyImageUrl) {
    _aspxApplyAlphaImageLoaderToImage(image);
    window.clearInterval(token);
   }
  }, 100);
 }
}
var __aspxVerticalScrollBarWidth;
function _aspxGetVerticalScrollBarWidth() {
 if(typeof(__aspxVerticalScrollBarWidth) == "undefined") {
  var container = document.createElement("DIV");
  container.style.cssText = "position: absolute; visibility: hidden; width: 200px; height: 150px; overflow: hidden";
  document.body.appendChild(container);
  var child = document.createElement("P");
  container.appendChild(child);
  child.style.cssText = "width: 100%; height: 200px;";
  var widthWithoutScrollBar = child.offsetWidth;
  container.style.overflow = "scroll";
  var widthWithScrollBar = child.offsetWidth;
  if(widthWithoutScrollBar == widthWithScrollBar)
   widthWithScrollBar = container.clientWidth;
  __aspxVerticalScrollBarWidth = widthWithoutScrollBar - widthWithScrollBar;
  document.body.removeChild(container);
 }
 return __aspxVerticalScrollBarWidth;
}
function _aspxGetVerticalOverflow(element) {
 if(__aspxIE || __aspxSafari && __aspxBrowserVersion >= 3 || __aspxChrome)
  return element.style.overflowY;
 return element.style.overflow;
}
function _aspxSetVerticalOverflow(element, value) {
 if(__aspxIE || __aspxSafari && __aspxBrowserVersion >= 3 || __aspxChrome)
  element.style.overflowY = value;
 else
  element.style.overflow = value;
}
ASPxStringBuilder = _aspxCreateClass(null, {
 constructor: function(str) {
  this.Initialize();
  if (str != null)
   this.Append(str);
 },
 Append: function(str) {
  this.value = null;
  this.length += (this.parts[this.partsCount++] = String(str)).length;
  return this;
 },
 Clear: function() {
  this.Initialize();
 },
 Initialize: function() {
  this.parts = [ ];
  this.partsCount = 0;
  this.length = 0;
  this.value = null;
 },
 ToString: function() {
  if (this.value != null)
   return this.value;
  var aggregate = this.parts.join('');
  this.partsCount = (this.parts = [ aggregate ]).length;
  this.length = aggregate.length;
  return (this.value = aggregate);
 }
});
function _aspxSetTimeout(callString, timeout){
 return window.setTimeout(callString, timeout);
}
function _aspxClearTimer(timerID){
 if(timerID > -1)
  window.clearTimeout(timerID);
 return -1;
}
function _aspxSetInterval(callString, interval){
 return window.setInterval(callString, interval);
}
function _aspxClearInterval(timerID){
 if(timerID > -1)
  window.clearInterval(timerID);
 return -1;
}
function _aspxSetInnerHtml(element, html) {
 if(__aspxIE) {
  element.innerHTML = "<em>&nbsp;</em>" + html;
  element.removeChild(element.firstChild);
 } else
  element.innerHTML = html;
}
function _aspxGetInnerText(container) {
 if (__aspxNetscapeFamily)
  return container.textContent;
 else if (__aspxWebKitFamily) {
  var filter = _aspxGetHtml2PlainTextFilter();
  filter.innerHTML = container.innerHTML;
  _aspxSetElementDisplay(filter, true);
  var innerText = filter.innerText;
  _aspxSetElementDisplay(filter, false);
  return innerText;
 } else
  return container.innerText;
}
var __aspxHtml2PlainTextFilter = null;
function _aspxGetHtml2PlainTextFilter() {
 if (__aspxHtml2PlainTextFilter == null) {
  __aspxHtml2PlainTextFilter = document.createElement("DIV");
  __aspxHtml2PlainTextFilter.style.width = "0";
  __aspxHtml2PlainTextFilter.style.height = "0";
  _aspxSetElementDisplay(__aspxHtml2PlainTextFilter, false);
  document.body.appendChild(__aspxHtml2PlainTextFilter);
 }
 return __aspxHtml2PlainTextFilter;
}
function _aspxCreateHiddenField(name, id) {
 var input = document.createElement("INPUT");
 input.setAttribute("type", "hidden");
 if(_aspxIsExists(name))
  input.setAttribute("name", name);
 if(_aspxIsExists(id))
  input.setAttribute("id", id);
 return input;
}
function _aspxCloneObject(srcObject) {
  if(typeof(srcObject) != 'object' || srcObject == null)
 return srcObject;
  var newObject = new Object();
  for(var i in srcObject) 
 newObject[i] = srcObject[i];
  return newObject;
}
function _aspxIsExistsType(type){
 return type != "undefined";
}
function _aspxIsExists(obj){
 return (typeof(obj) != "undefined") && (obj != null);
}
function _aspxIsFunction(obj){
 return typeof(obj) == "function";
}
function _aspxGetDefinedValue(value, defaultValue){
 return (typeof(value) != "undefined") ? value : defaultValue;
}
function _aspxGetKeyCode(srcEvt) {
 return __aspxNetscapeFamily ? srcEvt.which : srcEvt.keyCode;
}
function _aspxSetInputSelection(input, startPos, endPos){
 startPos = _aspxGetDefinedValue(startPos, 0);
 endPos = _aspxGetDefinedValue(endPos, input.value.length);
 if (__aspxIE) {
  var range = input.createTextRange();
  range.collapse(true);
  range.moveStart("character", startPos);
  range.moveEnd("character", endPos - startPos);
  range.select();
 } else {
  try {
   input.setSelectionRange(startPos, endPos);
  } catch(e) { }
 }
}
function _aspxGetSelectionInfo(input) {
 var start, end;
 if(__aspxIE){
  var range = document.selection.createRange();
  var rangeCopy = range.duplicate();
  range.move('character', -input.value.length);
  range.setEndPoint('EndToStart', rangeCopy);
  start = range.text.length;
  end = start + rangeCopy.text.length;
 } else {
  start = input.selectionStart;
  end = input.selectionEnd;
 }
 return { startPos: start, endPos: end };
}
function  _aspxHasInputSelection(input){
 var selectionInfo = _aspxGetSelectionInfo(input);
 return selectionInfo.startPos == selectionInfo.endPos;
}
function _aspxPreventElementDrag(element) {
 if(__aspxIE)
  _aspxAttachEventToElement(element, "dragstart", _aspxPreventEvent);
 else
  _aspxAttachEventToElement(element, "mousedown", _aspxPreventEvent);
}
function _aspxPreventElementDragAndSelect(element, isSkipMouseMove){
 if(__aspxWebKitFamily)
  _aspxAttachEventToElement(element, "selectstart", _aspxPreventEventAndBubble);
 if(__aspxIE){
  _aspxAttachEventToElement(element, "selectstart", new function(){ return false;});
  if(!isSkipMouseMove)
   _aspxAttachEventToElement(element, "mousemove", _aspxClearSelectionOnMouseMove);
  _aspxAttachEventToElement(element, "dragstart", _aspxPreventDragStart);
 }
}
function _aspxSetElementAsUnselectable(element, isWithChild) {
 if (_aspxIsExists(element) && (element.nodeType == 1)) {
  element.unselectable = "on";
  if (__aspxNetscapeFamily)
   element.onmousedown = new function() { return false; };
  if(isWithChild === true){
   for(var j = 0; j < element.childNodes.length; j ++)
    _aspxSetElementAsUnselectable(element.childNodes[j]);
  }
 }
}
function _aspxClearSelection() {
 try{
  if (_aspxIsExists(window.getSelection)) {
   if (__aspxWebKitFamily)
    window.getSelection().collapse();
   else
    window.getSelection().removeAllRanges();
  }
  else if (_aspxIsExists(document.selection)) {
   if(_aspxIsExists(document.selection.empty))
    document.selection.empty();
   else if(_aspxIsExists(document.selection.clear))
    document.selection.clear();
  }
 } catch(e) {
 }
}
function _aspxClearSelectionOnMouseMove(evt) {
 if (!__aspxIE || (evt.button != 0)) 
  _aspxClearSelection();
}
function _aspxPreventDragStart(evt) {
 evt = _aspxGetEvent(evt);
 var element = _aspxGetEventSource(evt);
 element.releaseCapture(); 
 return false;
}
function _aspxFalseFunction() { return false; }
function _aspxSetElementSelectionEnabled(element, value) {
 var userSelectValue = value ? "" : "none";
 var func = value ? _aspxDetachEventFromElement : _aspxAttachEventToElement;
 if(__aspxFirefox)
  element.style.MozUserSelect = userSelectValue;
 else if(__aspxWebKitFamily)
  element.style.KhtmlUserSelect = userSelectValue;
 else if(__aspxOpera)
  func(element, "mousemove", _aspxClearSelection);
 else
  func(element, "selectstart", _aspxFalseFunction);
}
function _aspxGetElementById(id) {
 if(_aspxIsExists(document.getElementById))
  return document.getElementById(id);
 else
  return document.all[id];
}
function _aspxGetInputElementById(id) {
 var elem = _aspxGetElementById(id);
 if(!__aspxIE)
  return elem;
 if(_aspxIsExists(elem)) {
  if(elem.id == id)
   return elem;
  else {
   for(var i = 1; i < document.all[id].length; i++) {
    if(document.all[id][i].id == id)
     return document.all[id][i];
   }
  }
 }
 return null;
}
function _aspxGetElementByIdInDocument(documentObj, id) {
 if(_aspxIsExists(documentObj.getElementById))
  return documentObj.getElementById(id);
 else
  return documentObj.all[id];
}
function _aspxGetIsParent(parentElement, element) {
 while(element != null){
  if(element.tagName == "BODY")
   return false;
  if(element == parentElement)
   return true;
  element = element.parentNode;
 }
 return false;
}
function _aspxGetParentById(element, id) {
 element = element.parentNode;
 while(element != null){
  if(element.id == id)
   return element;
  element = element.parentNode;
 }
 return null;
}
function _aspxGetParentByTagName(element, tagName) {
 tagName = tagName.toUpperCase();
 while(element != null) {
  if(element.tagName == "BODY")
   return null;
  if(element.tagName == tagName)
   return element;
  element = element.parentNode;
 }
 return null;
}
function _aspxGetParentByClassName(element, className) {
 while(element != null) {
  if(element.tagName == "BODY")
   return null;
  if(element.className.indexOf(className) != -1)
   return element;
  element = element.parentNode;
 }
 return null;
}
function _aspxGetParentByTagNameAndAttributeValue(element, tagName, attrName, attrValue) {
 tagName = tagName.toUpperCase();
 while(element != null) {
  if(element.tagName == "BODY")
   return null;
  if(element.tagName == tagName && _aspxIsExists(element[attrName]) && element[attrName] == attrValue)
   return element;
  element = element.parentNode;
 }
 return null;
}
function _aspxGetChildById(element, id) {
 if(!__aspxIE)
  return _aspxGetElementById(id);
 else{
  var element = element.all[id];
  if(!_aspxIsExists(element))
   return null;
  else if(!_aspxIsExists(element.length)) 
   return element;
  else
   return _aspxGetElementById(id);
 }
}
function _aspxGetElementsByTagName(element, tagName) {
 tagName = tagName.toUpperCase();
 if(element != null){  
  if (_aspxIsExists(element.all) && (!__aspxFirefox || __aspxBrowserVersion < 3))
   return __aspxNetscape ? element.all.tags[tagName] : element.all.tags(tagName);
  else
   return element.getElementsByTagName(tagName);
 }
 return null;
}
function _aspxGetChildByTagName(element, tagName, index) {
 if(element != null){    
  var collection = _aspxGetElementsByTagName(element, tagName);
  if(collection != null){
   if(index < collection.length)
    return collection[index];
  }
 }
 return null;
}
function _aspxGetChildTextNode(element, index) {
 if(element != null){
  var collection = new Array();
  _aspxGetChildTextNodeCollection(element, collection);
  if(index < collection.length)
   return collection[index];
 }
 return null;
}
function _aspxGetChildTextNodeCollection(element, collection) {
 for(var i = 0; i < element.childNodes.length; i ++){
  var childNode = element.childNodes[i];
  if(_aspxIsExists(childNode.nodeValue))
   _aspxArrayPush(collection, childNode);
  _aspxGetChildTextNodeCollection(childNode, collection);
 }
}
function _aspxGetChildsByClassName(element, className) {
 var collection = _aspxIsExists(element.all) ? element.all : element.getElementsByTagName('*');
 var ret = new Array();
 if(collection != null) {
  for(var i = 0; i < collection.length; i ++) {
   if (collection[i].className.indexOf(className) != -1)
    ret.push(collection[i]);
  }
 }
 return ret;
}
function _aspxGetParentByPartialId(element, idPart){
 while(element != null){
  if(_aspxIsExists(element.id)) {
   if(element.id.indexOf(idPart) > -1) return element;
  }
  element = element.parentNode;
 }
 return null;
}
function _aspxGetElementsByPartialId(element, partialName, list) {
 if(!_aspxIsExists(element.id)) return;
 if(element.id.indexOf(partialName) > -1) {
  list.push(element);
 }
 for(var i = 0; i < element.childNodes.length; i ++) {
  _aspxGetElementsByPartialId(element.childNodes[i], partialName, list);
 }
}
function _aspxGetElementDocument(element) {
 return _aspxIsExists(element.document) ? element.document : element.ownerDocument;
}
function _aspxIFrameWindow(name) {
 if(__aspxIE)
  return window.frames[name].window;
 else{
  var frameElement = document.getElementById(name);
  return (frameElement != null) ? frameElement.contentWindow : null;
 }
}
function _aspxIFrameDocument(name) {
 if(__aspxIE)
  return window.frames[name].document;
 else{
  var frameElement = document.getElementById(name);
  return (frameElement != null) ? frameElement.contentDocument : null;
 }
}
function _aspxIFrameDocumentBody(name) {
 var doc = _aspxIFrameDocument(name);
 return (doc != null) ? doc.body : null;
}
function _aspxIFrameElement(name) {
 if(__aspxIE)
  return window.frames[name].window.frameElement;
 else
  return document.getElementById(name);
}
function _aspxRemoveElement(element) {
 if(_aspxIsExists(element)) { 
  var parent = element.parentNode;
  if(_aspxIsExists(parent))
   parent.removeChild(element);
 }
 element = null;
}
function _aspxReplaceTagName(element, newTagName) {
 if (element.nodeType != 1)
  return null;
 if (element.nodeName == newTagName)
  return element;
 var doc = element.ownerDocument;
 var newElem = doc.createElement(newTagName);
 _aspxCopyAllAttributes(element, newElem);
 for (var i = 0; i < element.childNodes.length; i++)
  newElem.appendChild(element.childNodes[i].cloneNode(true));
 element.parentNode.replaceChild(newElem, element);
 return newElem;
}
function _aspxRemoveOuterTags(element) {
 if (__aspxIE) {
  element.insertAdjacentHTML( 'beforeBegin', element.innerHTML ) ;
  _aspxRemoveElement(element);
 } else {
  var docFragment = element.ownerDocument.createDocumentFragment();
  for (var i = 0; i < element.childNodes.length; i++)
   docFragment.appendChild(element.childNodes[i].cloneNode(true));
  element.parentNode.replaceChild(docFragment, element);
 }
}
function _aspxWrapElementInNewElement(element, newElementTagName) { 
 var wrapElement = null;
 if (__aspxIE) {
  var wrapElement = element.ownerDocument.createElement(newElementTagName);
  wrapElement.appendChild(element.cloneNode(true));
  element.parentNode.insertBefore(wrapElement, element);
  element.parentNode.removeChild(element);
 } else {
  var docFragment = element.ownerDocument.createDocumentFragment();
  wrapElement = element.ownerDocument.createElement(newElementTagName);
  docFragment.appendChild(wrapElement);
  wrapElement.appendChild(element.cloneNode(true));
  element.parentNode.replaceChild(docFragment, element);
 }
 return wrapElement;
}
function _aspxGetEvent(evt){
 return (typeof(event) != "undefined" && event != null) ? event : evt; 
}
function _aspxPreventEvent(evt){
 if (__aspxNetscapeFamily)
  evt.preventDefault();
 else
  evt.returnValue = false;
 return false;
}
function _aspxPreventEventAndBubble(evt){
 _aspxPreventEvent(evt);
 if (__aspxNetscapeFamily)
  evt.stopPropagation();
 evt.cancelBubble = true;
 return false;
}
function _aspxCancelBubble(evt){
 evt.cancelBubble = true;
 return false;
}
function _aspxGetEventSource(evt){
 evt = _aspxGetEvent(evt);
 if(!_aspxIsExists(evt)) return null; 
 return __aspxIE ? evt.srcElement : evt.target;
}
function _aspxGetEventX(evt){
 return evt.clientX  - _aspxGetIEDocumentClientOffsetInternal(true) + (__aspxSafari && __aspxBrowserVersion < 3 ? 0 : _aspxGetDocumentScrollLeft());
}
function _aspxGetEventY(evt){
 return evt.clientY - _aspxGetIEDocumentClientOffsetInternal(false) + (__aspxSafari && __aspxBrowserVersion < 3 ? 0 : _aspxGetDocumentScrollTop());
}
function _aspxGetIEDocumentClientOffset(IsX){
 return 0;
}
function _aspxGetIEDocumentClientOffsetInternal(IsX){
 var clientOffset = 0;
 if(__aspxIE){
  if(_aspxIsExists(document.documentElement))
   clientOffset = IsX ? document.documentElement.clientLeft : document.documentElement.clientTop;
  if(clientOffset == 0 && _aspxIsExists(document.body))
   var clientOffset = IsX ? document.body.clientLeft : document.body.clientTop;
 }
 return clientOffset;
}
function _aspxGetIsLeftButtonPressed(evt){
 evt = _aspxGetEvent(evt);
 if(!_aspxIsExists(evt)) return false;
 if(__aspxIE)
  return evt.button == 1;
 else if(__aspxNetscapeFamily || __aspxWebKitFamily)
  return evt.which == 1;
 else if (__aspxOpera)
  return evt.button == 0;  
 return true;  
}
function _aspxGetWheelDelta(evt){
 var ret = __aspxNetscapeFamily ? -evt.detail : evt.wheelDelta;
 if (__aspxOpera && __aspxBrowserVersion < 9)
  ret = -ret;
 return ret;
}
function _aspxDelCookie(name){
 _aspxSetCookieInternal(name, "", new Date(1970, 1, 1));
}
function _aspxGetCookie(name) {
 name = escape(name);
 var cookies = document.cookie.split(';');
 for(var i = 0; i < cookies.length; i++) {
  var cookie = _aspxTrim(cookies[i]);
  if(cookie.indexOf(name + "=") == 0)
   return unescape(cookie.substring(name.length + 1, cookie.length));
  else if(cookie.indexOf(name + ";") == 0 || cookie === name)
   return "";
 }
 return null;
}
function _aspxSetCookie(name, value, expirationDate){
 if(!_aspxIsExists(value)) {
  _aspxDelCookie(name);
  return;
 }
 if(!ASPxIdent.IsDate(expirationDate)) {
  expirationDate = new Date();
  expirationDate.setFullYear(expirationDate.getFullYear() + 1);
 }
 _aspxSetCookieInternal(name, value, expirationDate);
}
function _aspxSetCookieInternal(name, value, date){
 document.cookie = escape(name) + "=" + escape(value.toString()) + "; expires=" + date.toGMTString() + "; path=/";
}
function _aspxGetElementDisplay(element){
 return element.style.display != "none";
}
function _aspxSetElementDisplay(element, value){
 element.style.display = value ? "" : "none";
}
function _aspxGetElementVisibility(element){
 return element.style.visibility != "hidden";
}
function _aspxSetElementVisibility(element, value){
 element.style.visibility = value ? "" : "hidden";
}
function _aspxAddStyleSheetLinkToDocument(doc, linkUrl) {
 var newLink = _aspxCreateStyleLink(doc, linkUrl);
 var head = _aspxGetHeadElementOrCreateIfNotExist(doc);
 head.appendChild(newLink);
}
function _aspxGetHeadElementOrCreateIfNotExist(doc) {
 var elements = _aspxGetElementsByTagName(doc, "head");
 var head = null;
 if (elements.length == 0) {
  head = doc.createElement("head");
  head.visibility = "hidden";
  doc.insertBefore(head, doc.body);
 } else
  head = elements[0];
 return head;
}
function _aspxCreateStyleLink(doc, url) {
 var newLink = doc.createElement("link");
 _aspxSetAttribute(newLink, "href", url);
 _aspxSetAttribute(newLink, "type", "text/css");
 _aspxSetAttribute(newLink, "rel", "stylesheet");
 return newLink;
}
function _aspxGetCurrentStyle(element){
 if (__aspxIE)
  return element.currentStyle;
 else if (__aspxOpera && __aspxBrowserVersion < 9)
  return window.getComputedStyle(element, null);
 else
  return document.defaultView.getComputedStyle(element, null);
}
function _aspxIsElementRigthToLeft(element) {
 var style = _aspxGetCurrentStyle(element);
 if (__aspxIE)
  style.writingMode.toUpperCase().indexOf("RL") > -1;
 return style.direction.toUpperCase().indexOf("RTL") > -1;
}
function _aspxCreateStyleSheetInDocument(doc) {
 if(__aspxIE)
  return doc.createStyleSheet();
 else {
  var styleSheet = doc.createElement("STYLE");
  _aspxGetChildByTagName(doc, "HEAD", 0).appendChild(styleSheet);
  return doc.styleSheets[doc.styleSheets.length - 1];
 }
}
function _aspxCreateStyleSheet(){
 return _aspxCreateStyleSheetInDocument(document);
}
function _aspxGetStyleSheetRules(styleSheet){
 try {
  return __aspxIE ? styleSheet.rules : styleSheet.cssRules;
 }
 catch(e) {
  return null;
 }
}
function _aspxGetStyleSheetRule(className){
 if(_aspxIsExists(__aspxCachedRules[className])){
  if(__aspxCachedRules[className] != __aspxEmptyCachedValue)
   return __aspxCachedRules[className];
  return null;
 }
 for(var i = 0; i < document.styleSheets.length; i ++){
  var styleSheet = document.styleSheets[i];
  var rules = _aspxGetStyleSheetRules(styleSheet);
  if(rules != null){
   for(var j = 0; j < rules.length; j ++){
    if(rules[j].selectorText == "." + className){
     __aspxCachedRules[className] = rules[j];
     return rules[j];
    }
   }
  }
 }
 __aspxCachedRules[className] = __aspxEmptyCachedValue;
 return null;
}
function _aspxRemoveStyleSheetRule(styleSheet, index){
 var rules = _aspxGetStyleSheetRules(styleSheet);
 if(rules != null && rules.length > 0 && rules.length >= index){
  if(__aspxIE)
   styleSheet.removeRule(index);
  else   
   styleSheet.deleteRule(index);  
 }    
}
function _aspxAddStyleSheetRule(styleSheet, selector, cssText){
 if(!_aspxIsExists(cssText) || cssText == "") return;
 if(__aspxIE)
  styleSheet.addRule(selector, cssText);
 else
  styleSheet.insertRule(selector + " { " + cssText + " }", styleSheet.cssRules.length);
}
function _aspxGetPointerCursor() {
 return "pointer";
}
function _aspxSetPointerCursor(element) {
 if(element.style.cursor == "")
  element.style.cursor = _aspxGetPointerCursor();
}
var _aspxWebKit3TDRealInfo = {
 GetOffsetTop: function(tdElement){
  switch(_aspxGetCurrentStyle(tdElement).verticalAlign){
   case "middle":
    return Math.round(tdElement.offsetTop - (tdElement.offsetHeight - tdElement.clientHeight )/2 + tdElement.clientTop);
   case "bottom":
    return tdElement.offsetTop - tdElement.offsetHeight + tdElement.clientHeight + tdElement.clientTop;
  }
  return tdElement.offsetTop;
 },
 GetClientHeight: function(tdElement){
  var valign = _aspxGetCurrentStyle(tdElement).verticalAlign;
  switch(valign){
   case "middle":
    return tdElement.clientHeight + tdElement.offsetTop * 2;
   case "top":
    return tdElement.offsetHeight - tdElement.clientTop * 2;
   case "bottom":
    return tdElement.clientHeight + tdElement.offsetTop;
  }
  return tdElement.clientHeight;
 }
}
function _aspxGetIsValidPosition(pos){
 return pos != __aspxInvalidPosition && pos != -__aspxInvalidPosition;
}
function _aspxGetAbsoluteX(curEl){
 return _aspxGetAbsolutePositionX(curEl);
}
function _aspxGetAbsoluteY(curEl){
 return _aspxGetAbsolutePositionY(curEl);
}
function _aspxSetAbsoluteX(element, x){
 element.style.left = _aspxPrepareClientPosForElement(x, element, true) + "px";
}
function _aspxSetAbsoluteY(element, y){
 element.style.top = _aspxPrepareClientPosForElement(y, element, false) + "px";
}
function _aspxGetAbsolutePositionX(element){
 if (__aspxIE)
  return _aspxGetAbsolutePositionX_IE(element);
 else if (__aspxFirefox && __aspxBrowserVersion >= 3)
  return _aspxGetAbsolutePositionX_FF3(element);
 else if (__aspxOpera)
  return _aspxGetAbsolutePositionX_Opera(element);
 else if(__aspxNetscapeFamily && (!__aspxFirefox || __aspxBrowserVersion < 3))
  return _aspxGetAbsolutePositionX_NS(element);
 else if(__aspxWebKitFamily)
  return _aspxGetAbsolutePositionX_Safari(element);
 else
  return _aspxGetAbsolutePositionX_Other(element);
}
function _aspxGetAbsolutePositionX_Opera(curEl){
 var isFirstCycle = true;
 var pos = _aspxGetAbsoluteOffsetX_OperaFFSafari(curEl);
 while (curEl != null) {
  pos += curEl.offsetLeft;
  if(!isFirstCycle)
   pos -= curEl.scrollLeft;
  curEl = curEl.offsetParent;
  isFirstCycle = false;
 }
 pos += document.body.scrollLeft;
 return pos;
}
function _aspxGetAbsolutePositionX_IE(element){
 if(element == null || __aspxIE && element.parentNode == null) return 0; 
 return element.getBoundingClientRect().left + _aspxGetDocumentScrollLeft() - _aspxGetIEDocumentClientOffsetInternal(true);
}
function _aspxGetAbsolutePositionX_FF3(element){
 if(element == null) return 0;
 var x = element.getBoundingClientRect().left + _aspxGetDocumentScrollLeft() - _aspxGetIEDocumentClientOffsetInternal(true);
 return Math.round(x);
}
function _aspxGetAbsolutePositionX_NS(curEl){
 var pos = _aspxGetAbsoluteOffsetX_OperaFFSafari(curEl);
 var isFirstCycle = true;
 while (curEl != null) {
  pos += curEl.offsetLeft;
  if (!isFirstCycle && curEl.offsetParent != null)
   pos -= curEl.scrollLeft;
  if (!isFirstCycle && __aspxFirefox){
   var style = _aspxGetCurrentStyle(curEl);
   if(curEl.tagName == "DIV" && style.overflow != "visible")
    pos += _aspxPxToInt(style.borderLeftWidth);
  }
  isFirstCycle = false;
  curEl = curEl.offsetParent;
 }
 return pos;
}
function _aspxGetAbsolutePositionX_Safari(curEl){
 var pos = _aspxGetAbsoluteOffsetX_OperaFFSafari(curEl);
 var isSafariVerNonLessThan3OrChrome = __aspxSafari && __aspxBrowserVersion >= 3 || __aspxChrome;
 if(curEl != null){
  var isFirstCycle = true;
  if(isSafariVerNonLessThan3OrChrome && curEl.tagName == "TD") {
   pos += curEl.offsetLeft;
   curEl = curEl.offsetParent;
   isFirstCycle = false;
  }
  while (curEl != null) {
   pos += curEl.offsetLeft;
   if(isSafariVerNonLessThan3OrChrome && !isFirstCycle && (curEl.tagName == "TD" || curEl.tagName == "TABLE"))
    pos += curEl.clientLeft;
   isFirstCycle = false;
   curEl = curEl.offsetParent;
  }
 }
 return pos;
}
function _aspxGetAbsoluteOffsetX_OperaFFSafari(curEl) {
 var pos = 0;
 var isFirstCycle = true;
 while (curEl != null) {
  if(curEl.tagName == "BODY")
   break;
  var style = _aspxGetCurrentStyle(curEl);
  if(!__aspxWebKitFamily && style.position == "absolute")
   break;
  if(!isFirstCycle && curEl.tagName == "DIV" && (__aspxWebKitFamily || style.position == "" || style.position == "static"))
   pos -= curEl.scrollLeft;
  curEl = curEl.parentNode;
  isFirstCycle = false;
 }
 return pos;
}
function _aspxGetAbsolutePositionX_Other(curEl){
 var pos = 0;
 var isFirstCycle = true;
 while (curEl != null) {
  pos += curEl.offsetLeft;
  if (!isFirstCycle && curEl.offsetParent != null)
   pos -= curEl.scrollLeft;
  isFirstCycle = false;
  curEl = curEl.offsetParent;
 }
 return pos;
}
function _aspxGetAbsolutePositionY(element){
 if (__aspxIE)
  return _aspxGetAbsolutePositionY_IE(element);
 else if (__aspxFirefox && __aspxBrowserVersion >= 3)
  return _aspxGetAbsolutePositionY_FF3(element);
 else if (__aspxOpera)
  return _aspxGetAbsolutePositionY_Opera(element);
 else if(__aspxNetscapeFamily && (!__aspxFirefox || __aspxBrowserVersion < 3))
  return _aspxGetAbsolutePositionY_NS(element);
 else if(__aspxWebKitFamily)
  return _aspxGetAbsolutePositionY_Safari(element);
 else
  return _aspxGetAbsolutePositionY_Other(element);
}
function _aspxGetAbsolutePositionY_Opera(curEl){
 var isFirstCycle = true;
 if(curEl && curEl.tagName == "TR" && curEl.cells.length > 0)
  curEl = curEl.cells[0];
 var pos = _aspxGetAbsoluteOffsetY_OperaFFSafari(curEl);
 while (curEl != null) {
  pos += curEl.offsetTop;
  if(!isFirstCycle)
   pos -= curEl.scrollTop;
  curEl = curEl.offsetParent;
  isFirstCycle = false;
 }
 pos += document.body.scrollTop;
 return pos;
}
function _aspxGetAbsolutePositionY_IE(element){
 if(element == null || __aspxIE && element.parentNode == null) return 0; 
 return element.getBoundingClientRect().top + _aspxGetDocumentScrollTop() - _aspxGetIEDocumentClientOffsetInternal(false);
}
function _aspxGetAbsolutePositionY_FF3(element){
 if(element == null) return 0;
 var y = element.getBoundingClientRect().top + _aspxGetDocumentScrollTop() - _aspxGetIEDocumentClientOffsetInternal(false);
 return Math.round(y);
}
function _aspxGetAbsolutePositionY_NS(curEl){
 var pos = _aspxGetAbsoluteOffsetY_OperaFFSafari(curEl);
 var isFirstCycle = true;
 while (curEl != null) {
  pos += curEl.offsetTop;
  if (!isFirstCycle && curEl.offsetParent != null)
   pos -= curEl.scrollTop;
  if (!isFirstCycle && __aspxFirefox){
   var style = _aspxGetCurrentStyle(curEl);
   if(curEl.tagName == "DIV" && style.overflow != "visible")
    pos += _aspxPxToInt(style.borderTopWidth);
  }
  isFirstCycle = false;
  curEl = curEl.offsetParent;
 }
 return pos;
}
function _aspxGetAbsolutePositionY_Safari(curEl){
 var pos = _aspxGetAbsoluteOffsetY_OperaFFSafari(curEl);
 var isSafariVerNonLessThan3OrChrome = __aspxSafari && __aspxBrowserVersion >= 3 || __aspxChrome;
 if(curEl != null){
  var isFirstCycle = true;
  if(isSafariVerNonLessThan3OrChrome && curEl.tagName == "TD") {
   pos += _aspxWebKit3TDRealInfo.GetOffsetTop(curEl);
   curEl = curEl.offsetParent;
   isFirstCycle = false;
  }
  while (curEl != null) {
   pos += curEl.offsetTop;
   if(isSafariVerNonLessThan3OrChrome && !isFirstCycle && (curEl.tagName == "TD" || curEl.tagName == "TABLE"))
    pos += curEl.clientTop;
   isFirstCycle = false;
   curEl = curEl.offsetParent;
  }
 }
 return pos;
}
function _aspxGetAbsoluteOffsetY_OperaFFSafari(curEl) {
 var pos = 0;   
 var isFirstCycle = true;
 while (curEl != null) {
  if(curEl.tagName == "BODY")
   break;
  var style = _aspxGetCurrentStyle(curEl);
  if(!__aspxWebKitFamily && style.position == "absolute")
   break;
  if(!isFirstCycle && curEl.tagName == "DIV" && (__aspxWebKitFamily || style.position == "" || style.position == "static"))
   pos -= curEl.scrollTop;
  curEl = curEl.parentNode;
  isFirstCycle = false;
 }
 return pos; 
}
function _aspxGetAbsolutePositionY_Other(curEl){
 var pos = 0;
 var isFirstCycle = true;
 while (curEl != null) {
  pos += curEl.offsetTop;
  if (!isFirstCycle && curEl.offsetParent != null)
   pos -= curEl.scrollTop;
  isFirstCycle = false;
  curEl = curEl.offsetParent;
 }
 return pos;
}
function _aspxPrepareClientPosForElement(pos, element, isX) {
 pos -= _aspxGetPositionElementOffset(element, isX);
 return pos;
}
function _aspxGetPositionElementOffset(element, isX) {
 var curEl = element.offsetParent;
 var offset = 0;
 var scroll = 0;
 var isThereFixedParent = false;
 var isFixed = false;
 var position = "";
 while(curEl != null) {
  var tagName = curEl.tagName;
  if(tagName == "HTML" || tagName == "BODY")
   break;
  if(tagName != "TD" && tagName != "TR") {
   var style = _aspxGetCurrentStyle(curEl);
   isFixed = style.position == "fixed";
   if(isFixed)
    isThereFixedParent = true;
   if (style.position == "absolute" || isFixed || style.position == "relative") {
    offset += isX ? curEl.offsetLeft : curEl.offsetTop;
    if (__aspxIE || __aspxOpera && __aspxBrowserVersion >= 9 || __aspxSafari && __aspxMacOSPlatform)
     offset += _aspxPxToInt(isX ? style.borderLeftWidth : style.borderTopWidth);
   }
  }
  scroll += isX ? curEl.scrollLeft : curEl.scrollTop;
  curEl = curEl.offsetParent;
 }
 offset -= scroll; 
 if((__aspxIE && __aspxBrowserVersion >= 7 || __aspxFirefox && __aspxBrowserVersion >= 3) && isThereFixedParent)
  offset += isX ? _aspxGetDocumentScrollLeft() : _aspxGetDocumentScrollTop();
 return offset;
}
function _aspxPxToInt(px) {
 var result = 0;
 if (px != null && px != "") {
  try {
   var indexOfPx = px.indexOf("px");
   if (indexOfPx > -1)
    result = parseInt(px.substr(0, indexOfPx));
  } catch(e) { }
 }
 return result;
}
function _aspxGetLeftRightBordersAndPaddingsSummaryValue(element) {
 var currentStyle = _aspxGetCurrentStyle(element);
 var value = _aspxPxToInt(currentStyle.paddingLeft) + _aspxPxToInt(currentStyle.paddingRight);
 if(currentStyle.borderLeftStyle != "none")
  value += _aspxPxToInt(currentStyle.borderLeftWidth);
 if(currentStyle.borderRightStyle != "none")
  value += _aspxPxToInt(currentStyle.borderRightWidth);  
 return value;
}
function _aspxGetClearClientWidth(element) {
 return element.offsetWidth - _aspxGetLeftRightBordersAndPaddingsSummaryValue(element);
}
function _aspxGetClearClientHeight(element) {
 var currentStyle = _aspxGetCurrentStyle(element);
 return element.offsetHeight - _aspxPxToInt(currentStyle.paddingTop) - _aspxPxToInt(currentStyle.paddingBottom) -
  _aspxPxToInt(currentStyle.borderTopWidth) - _aspxPxToInt(currentStyle.borderBottomWidth);
}
function _aspxSetOffsetWidth(element, widthValue) {
 var currentStyle = _aspxGetCurrentStyle(element);
 var value = widthValue - _aspxPxToInt(currentStyle.marginLeft) - _aspxPxToInt(currentStyle.marginRight);
 if(__aspxIE)
  value -= _aspxGetLeftRightBordersAndPaddingsSummaryValue(element);
 if(value > -1)
  element.style.width = value + "px";
}
function _aspxSetOffsetHeight(element, heightValue) {
 var currentStyle = _aspxGetCurrentStyle(element);
 var value = heightValue - _aspxPxToInt(currentStyle.marginTop) - _aspxPxToInt(currentStyle.marginBottom);
 if(__aspxIE)
  value -= _aspxPxToInt(currentStyle.paddingTop) + _aspxPxToInt(currentStyle.paddingBottom) +
   _aspxPxToInt(currentStyle.borderTopWidth) + _aspxPxToInt(currentStyle.borderBottomWidth); 
 if(value > -1)
  element.style.height = value + "px";
}
function _aspxFindOffsetParent(element) {
 if(__aspxIE && __aspxBrowserVersion < 8)
  return element.offsetParent;
 var currentElement = element.parentNode;
 while(_aspxIsExistsElement(currentElement) && currentElement.tagName != "BODY") {
  if (currentElement.offsetWidth > 0 && currentElement.offsetHeight > 0)
   return currentElement;
  currentElement = currentElement.parentNode;
 }
 return document.body;
}
function _aspxGetDocumentScrollTop(){
 if(__aspxWebKitFamily || __aspxIE && __aspxBrowserVersion == 5.5 || document.documentElement.scrollTop == 0)
  return document.body.scrollTop;
 else
  return document.documentElement.scrollTop;
}
function _aspxGetDocumentScrollLeft(){
 if(__aspxWebKitFamily || __aspxIE && __aspxBrowserVersion == 5.5 || document.documentElement.scrollLeft == 0)
  return document.body.scrollLeft;
 else
  return document.documentElement.scrollLeft;
}
function _aspxGetDocumentClientWidth(){
 if(__aspxWebKitFamily || __aspxIE && __aspxBrowserVersion == 5.5 || document.documentElement.clientWidth == 0)
  return document.body.clientWidth;
 else
  return document.documentElement.clientWidth;
}
function _aspxGetDocumentClientHeight(){
 if(__aspxWebKitFamily)
  return window.innerHeight;
 else if(__aspxOpera) 
  return __aspxBrowserVersion >= 9.6 ? document.documentElement.clientHeight : document.body.clientHeight;
 else if(__aspxIE && __aspxBrowserVersion == 5.5 ||  document.documentElement.clientHeight == 0)
  return document.body.clientHeight;
 else
  return document.documentElement.clientHeight;
}
function _aspxSetStylePosition(element, x, y){
 element.style.left = x + "px";
 element.style.top = y + "px";
}
function _aspxSetStyleSize(element, width, height){
 element.style.width = width + "px";
 element.style.height = height + "px";
}
function _aspxGetDocumentWidth(){
 var bodyWidth = document.body.offsetWidth;
 var docWidth = (__aspxIE && __aspxBrowserMajorVersion != 7) ? document.documentElement.clientWidth : document.documentElement.offsetWidth;
 var bodyScrollWidth = document.body.scrollWidth;
 var docScrollWidth = document.documentElement.scrollWidth;
 return _aspxGetMaxDimensionOf(bodyWidth, docWidth, bodyScrollWidth, docScrollWidth);
}
function _aspxGetDocumentHeight(){
 var bodyHeight = document.body.offsetHeight;
 var docHeight = (__aspxIE && __aspxBrowserMajorVersion != 7) ? document.documentElement.clientHeight : document.documentElement.offsetHeight;
 var bodyScrollHeight = document.body.scrollHeight;
 var docScrollHeight = document.documentElement.scrollHeight;
 var maxHeight = _aspxGetMaxDimensionOf(bodyHeight, docHeight, bodyScrollHeight, docScrollHeight);
 if(__aspxOpera && __aspxBrowserVersion >= 9.6){
  if(__aspxBrowserVersion < 10)
   maxHeight = _aspxGetMaxDimensionOf(bodyHeight, docHeight, bodyScrollHeight);
  var visibleHeightOfDocument = document.documentElement.clientHeight;
  if(maxHeight > visibleHeightOfDocument)
   maxHeight = _aspxGetMaxDimensionOf(window.outerHeight, maxHeight);
  else
   maxHeight = document.documentElement.clientHeight;
  return maxHeight;
 }
 return maxHeight;
}
function _aspxGetDocumentMaxClientWidth(){
 var bodyWidth = document.body.offsetWidth;
 var docWidth = document.documentElement.offsetWidth;
 var docClientWidth = document.documentElement.clientWidth;
 return _aspxGetMaxDimensionOf(bodyWidth, docWidth, docClientWidth);
}
function _aspxGetDocumentMaxClientHeight(){
 var bodyHeight = document.body.offsetHeight;
 var docHeight = document.documentElement.offsetHeight;
 var docClientHeight = document.documentElement.clientHeight;
 return _aspxGetMaxDimensionOf(bodyHeight, docHeight, docClientHeight);
}
function _aspxGetMaxDimensionOf(){
 var max = __aspxInvalidDimension;
 for (var i = 0; i < arguments.length; i++){
  if(max < arguments[i])
   max = arguments[i];
 }
 return max;
}
function _aspxGetClientLeft(element){
 return _aspxIsExists(element.clientLeft) ? element.clientLeft : (element.offsetWidth - element.clientWidth) / 2;
}
function _aspxGetClientTop(element){
 return _aspxIsExists(element.clientTop) ? element.clientTop : (element.offsetHeight - element.clientHeight) / 2;
}
function _aspxRemoveBorders(element) {
 if(!_aspxIsExists(element))
  return;
 element.style.borderWidth = 0;
 for(var i = 0; i < element.childNodes.length; i++) {
  var child = element.childNodes[i];
  if(_aspxIsExists(child.style))
   child.style.border = "0";
 }
}
function _aspxSetBackground(element, background) {
 if(!_aspxIsExists(element))
  return;
 element.style.backgroundColor = background;
 for(var i = 0; i < element.childNodes.length; i++) {
  var child = element.childNodes[i];
  if(_aspxIsExists(child.style))
   child.style.backgroundColor = background;
 }
}
function _aspxSetFocus(element) {
 window.setTimeout(function() { 
  try {
   element.focus();
   if (__aspxIE && document.activeElement != element)
    element.focus();
  } catch (e) {
  }
 }, 100);
}
function _aspxIsFocusableCore(element, skipContainerVisibilityCheck) {
 var current = element;
 while(_aspxIsExists(current)) {
  if (current == element || !skipContainerVisibilityCheck(current)) {
   if (current.tagName == "BODY")
    return true;
   if (current.disabled || !_aspxGetElementDisplay(current) || !_aspxGetElementVisibility(current))
    return false;
  }
  current = current.parentNode;
 }
 return true;
}
function _aspxIsFocusable(element) {
 return _aspxIsFocusableCore(element, function() { return false; });
}
function _aspxAttachEventToElement(element, eventName, func) {
 if(__aspxNetscapeFamily || __aspxWebKitFamily)
  element.addEventListener(eventName, func, true);
 else {
  if(eventName.toLowerCase().indexOf("on") != 0) 
   eventName = "on" + eventName;
  element.attachEvent(eventName, func);
 }
}
function _aspxDetachEventFromElement(element, eventName, func) {
 if(__aspxNetscapeFamily || __aspxWebKitFamily)
  element.removeEventListener(eventName, func, true);
 else {
  if(eventName.toLowerCase().indexOf("on") != 0) 
   eventName = "on" + eventName;
  element.detachEvent(eventName, func);
 }
}
function _aspxAttachEventToDocument(eventName, func) {
 _aspxAttachEventToElement(document, eventName, func);
}
function _aspxDetachEventFromDocument(eventName, func) {
 _aspxAttachEventToElement(document, eventName, func);
}
function _aspxCreateEventHandlerFunction(funcName, controlName, withHtmlEventArg) {
 return withHtmlEventArg ?
  new Function("event", funcName + "('" + controlName + "', event);") :
  new Function(funcName + "('" + controlName + "');");
}
function _aspxCreateClass(parentClass, properties) {
 var ret = function() {
  if (ret.preparing) 
   return delete(ret.preparing);
  if (ret.constr) {
   this.constructor = ret;
   ret.constr.apply(this, arguments);
  }
 }
 ret.prototype = {};
 if(_aspxIsExists(parentClass)) {
  parentClass.preparing = true;
  ret.prototype = new parentClass;
  ret.prototype.constructor = parentClass;
  ret.constr = parentClass;
 }
 if(_aspxIsExists(properties)) {
  var constructorName = "constructor";
  for(var name in properties){
   if (name != constructorName) 
    ret.prototype[name] = properties[name];
  }
  if (properties[constructorName] && properties[constructorName] != Object)
   ret.constr = properties[constructorName];
 }
 return ret;
}
function _aspxGetAttribute(obj, attrName){
 if(_aspxIsExists(obj.getAttribute))
  return obj.getAttribute(attrName);
 else if(_aspxIsExists(obj.getPropertyValue))
  return obj.getPropertyValue(attrName);
 return null;
}
function _aspxSetAttribute(obj, attrName, value){
 if(_aspxIsExists(obj.setAttribute))
  obj.setAttribute(attrName, value);
 else if(_aspxIsExists(obj.setProperty))
  obj.setProperty(attrName, value, "");
}
function _aspxRemoveAttribute(obj, attrName){
 if(_aspxIsExists(obj.removeAttribute))
  obj.removeAttribute(attrName);
 else if(_aspxIsExists(obj.removeProperty))
  obj.removeProperty(attrName);
}
function _aspxIsExistsAttribute(obj, attrName){
 var value = _aspxGetAttribute(obj, attrName);
 return (value != null) && (value != "");
}
function _aspxSetOrRemoveAttribute(obj, attrName, value) {
 if (!value)
  _aspxRemoveAttribute(obj, attrName);
 else
  _aspxSetAttribute(obj, attrName, value);
}
function _aspxSaveAttribute(obj, attrName, savedObj, savedAttrName){
 if(!_aspxIsExistsAttribute(savedObj, savedAttrName)){
  var oldValue = _aspxIsExistsAttribute(obj, attrName) ? _aspxGetAttribute(obj, attrName) : __aspxEmptyAttributeValue;
  _aspxSetAttribute(savedObj, savedAttrName, oldValue);
 }
}
function _aspxChangeAttributeExtended(obj, attrName, savedObj, savedAttrName, newValue){
 _aspxSaveAttribute(obj, attrName, savedObj, savedAttrName);
 _aspxSetAttribute(obj, attrName, newValue);
}
function _aspxChangeAttribute(obj, attrName, newValue){
 _aspxChangeAttributeExtended(obj, attrName, obj, "saved" + attrName, newValue);
}
function _aspxChangeStyleAttribute(obj, attrName, newValue){
 _aspxChangeAttributeExtended(obj.style, attrName, obj, "saved" + attrName, newValue);
}
function _aspxResetAttributeExtended(obj, attrName, savedObj, savedAttrName){
 _aspxSaveAttribute(obj, attrName, savedObj, savedAttrName);
 _aspxSetAttribute(obj, attrName, "");
 _aspxRemoveAttribute(obj, attrName);
}
function _aspxResetAttribute(obj, attrName){
 _aspxResetAttributeExtended(obj, attrName, obj, "saved" + attrName);
}
function _aspxResetStyleAttribute(obj, attrName){
 _aspxResetAttributeExtended(obj.style, attrName, obj, "saved" + attrName);
}
function _aspxRestoreAttributeExtended(obj, attrName, savedObj, savedAttrName){
 if(_aspxIsExistsAttribute(savedObj, savedAttrName)){
  var oldValue = _aspxGetAttribute(savedObj, savedAttrName);
  if(oldValue != __aspxEmptyAttributeValue)
   _aspxSetAttribute(obj, attrName, oldValue);
  else
   _aspxRemoveAttribute(obj, attrName);
  _aspxRemoveAttribute(savedObj, savedAttrName);
 }
}
function _aspxRestoreAttribute(obj, attrName){
 _aspxRestoreAttributeExtended(obj, attrName, obj, "saved" + attrName);
}
function _aspxRestoreStyleAttribute(obj, attrName){
 _aspxRestoreAttributeExtended(obj.style, attrName, obj, "saved" + attrName);
}
function _aspxCopyAllAttributes(sourceElem, destElement) {
 var attrs = sourceElem.attributes;
 for (var n = 0; n < attrs.length; n++) {
  var attr = attrs[n];
  if (attr.specified) {
   var attrName = attr.nodeName;
   var attrValue = sourceElem.getAttribute(attrName, 2);
   if (attrValue == null)
    attrValue = attr.nodeValue;
   destElement.setAttribute(attrName, attrValue, 0); 
  }
 }
 if (sourceElem.style.cssText !== '')
  destElement.style.cssText = sourceElem.style.cssText;
}
function _aspxRemoveAllAttributes(element, excludedAttributes) {
 var excludedAttributesHashTable = {};
 if (_aspxIsExists(excludedAttributes))
  excludedAttributesHashTable = _aspxCreateHashTableFromArray(excludedAttributes);
 if (_aspxIsExists(element.attributes)) {
  var attrArray = element.attributes;
  for (var i = 0; i < attrArray.length; i++) {
   var attrName = attrArray[i].name;
   if (!_aspxIsExists(excludedAttributesHashTable[attrName.toLowerCase()])) {
    try {
     attrArray.removeNamedItem(attrName);
    } catch (e) { }
   }
  }
 }
}
function _aspxRemoveStyleAttribute(element, attrName) {
 if (_aspxIsExists(element.style)) {
  if (__aspxFirefox && element.style[attrName]) 
   element.style[attrName] = "";
  if (_aspxIsExists(element.style.removeAttribute) && element.style.removeAttribute != "")
   element.style.removeAttribute(attrName);
  else if (_aspxIsExists(element.style.removeProperty) && element.style.removeProperty != "")
   element.style.removeProperty(attrName);
 }
}
function _aspxRemoveAllStyles(element) {
 if (_aspxIsExists(element.style)) {
  for(var key in element.style)
   _aspxRemoveStyleAttribute(element, key);
    _aspxRemoveAttribute(element, "style");
 }
}
function _aspxChangeAttributesMethod(enabled){
 return enabled ? _aspxRestoreAttribute : _aspxResetAttribute;
}
function _aspxInitiallyChangeAttributesMethod(enabled){
 return enabled ? _aspxChangeAttribute : _aspxResetAttribute;
}
function _aspxChangeStyleAttributesMethod(enabled){
 return enabled ? _aspxRestoreStyleAttribute : _aspxResetStyleAttribute;
}
function _aspxInitiallyChangeStyleAttributesMethod(enabled){
 return enabled ? _aspxChangeStyleAttribute : _aspxResetStyleAttribute;
}
function _aspxChangeEventsMethod(enabled){
 return enabled ? _aspxAttachEventToElement : _aspxDetachEventFromElement;
}
function _aspxChangeDocumentEventsMethod(enabled){
 return enabled ? _aspxAttachEventToDocument : _aspxDetachEventFromDocument;
}
function _aspxTrimStart(str) { 
 var re = /\s*((\S+\s*)*)/;
 return str.replace(re, "$1"); 
}
function _aspxTrimEnd(str) { 
 var re = /((\s*\S+)*)\s*/;
 return str.replace(re, "$1"); 
}
function _aspxTrim(str) { 
 return _aspxTrimStart(_aspxTrimEnd(str)); 
}
function _aspxInsert(str, subStr, index) { 
 var leftText = str.slice(0, index);
 var rightText = str.slice(index);
 return leftText + subStr + rightText;
}
function _aspxInsertEx(str, subStr, startIndex, endIndex) { 
 var leftText = str.slice(0, startIndex);
 var rightText = str.slice(endIndex);
 return leftText + subStr + rightText;
}
function _aspxNavigateUrl(url, target) {
 var javascriptPrefix = "javascript:";
 if(url == "")
  return;
 else if(url.indexOf(javascriptPrefix) != -1) 
  eval(url.substr(javascriptPrefix.length));
 else {
  if(target != "")
   _aspxNavigateTo(url, target);
  else
   location.href = url;
 }
}
function _aspxNavigateTo(url, target) {
 var lowerCaseTarget = target.toLowerCase();
 if("_top" == lowerCaseTarget)
  top.location.href = url;
 else if("_self" == lowerCaseTarget)
  location.href = url;
 else if("_search" == lowerCaseTarget)
  window.open(url, 'blank');
 else if("_media" == lowerCaseTarget)
  window.open(url, 'blank');
 else if("_parent" == lowerCaseTarget)
  window.parent.location.href = url;
 else if("_blank" == lowerCaseTarget)
  window.open(url, 'blank');
 else {
  var frame = _aspxGetFrame(top.frames, target);
  if(frame != null)
   frame.location.href = url;
  else
   window.open(url, 'blank');
 }
}
function _aspxGetFrame(frames, name) {
 if(_aspxIsExists(frames[name]))
  return frames[name];
 for(var i = 0; i < frames.length; i++) {
  try {
   var frame = frames[i];
   if(frame.name == name) 
    return frame; 
   frame = _aspxGetFrame(frame.frames, name);
   if(frame != null)   
    return frame; 
  } catch(e) {
  } 
 }
 return null;
}
function _aspxToHex(d) {
 return (d < 16) ? ("0" + d.toString(16)) : d.toString(16);
}
function _aspxColorToHexadecimal(colorValue) {
 if (typeof(colorValue) == "number") {
  var r = colorValue & 0xFF;
  var g = (colorValue >> 8) & 0xFF;
  var b = (colorValue >> 16) & 0xFF;
  return "#" + _aspxToHex(r) + _aspxToHex(g) + _aspxToHex(b);
 }
 if (colorValue && (colorValue.substr(0, 3).toLowerCase() == "rgb")) {
  var re = /rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/;
  var regResult = colorValue.match(re);
  if (regResult) {
   var r = parseInt(regResult[1]);
   var g = parseInt(regResult[2]);
   var b = parseInt(regResult[3]);
   return "#" + _aspxToHex(r) + _aspxToHex(g) + _aspxToHex(b);
  }
  return null;
 } 
 if (colorValue && (colorValue.charAt(0) == "#"))
  return colorValue;
 return null;
}
function _aspxFormatCallbackArg(prefix, arg) {
 if(prefix == null && arg == null)
  return ""; 
 if(prefix == null) prefix = "";
 if(arg == null) arg = "";
 if(arg != null && !_aspxIsExists(arg.length) && _aspxIsExists(arg.value))
  arg = arg.value;
 arg = arg.toString();
 return [prefix, '|', arg.length, '|' , arg].join('');
}
function _aspxFormatCallbackArgs(callbackData) {
 var sb = new ASPxStringBuilder();
 for(var i = 0; i < callbackData.length; i++)
  sb.Append(_aspxFormatCallbackArg(callbackData[i][0], callbackData[i][1]));
 return sb.ToString();
}
function _aspxIsValidElement(element){
 if(__aspxIE)
  return _aspxIsExists(element.parentNode) && _aspxIsExists(element.parentNode.tagName);
 else {
  if(!__aspxOpera && element.offsetParent != null)
   return true;
  while(element != null){
   if(_aspxIsExists(element.tagName) && element.tagName == "BODY")
    return true;
   element = element.parentNode;
  }
  return false;
 }
}
function _aspxIsValidElements(elements) {
 if (!_aspxIsExists(elements))
  return false; 
 for(var i = 0; i < elements.length; i++) {
  if(_aspxIsExists(elements[i]) && !_aspxIsValidElement(elements[i]))
   return false;
 }
 return true;
}
function _aspxIsExistsElement(element) {
 return _aspxIsExists(element) && _aspxIsValidElement(element);
}
ASPxClientEvent = _aspxCreateClass(null, {
 constructor: function() {
  this.handlerInfoList = [];
 },
 AddHandler: function(handler, executionContext) {
  if(typeof(executionContext) == "undefined")
   executionContext = null;
  var handlerInfo = ASPxClientEvent.CreateHandlerInfo(handler, executionContext);
  this.handlerInfoList.push(handlerInfo);
 },
 RemoveHandler: function(handler, executionContext) {
  for(var i = this.handlerInfoList.length - 1; i >= 0; i--) {
   var handlerInfo = this.handlerInfoList[i];
   if(handlerInfo.handler == handler && (!executionContext || handlerInfo.executionContext == executionContext)) {
    _aspxArrayRemoveAt(this.handlerInfoList, i);
    return;
   }
  }
 },
 ClearHandlers: function() {
  this.handlerInfoList.length = 0;
 },
 FireEvent: function(obj, args) {
  for(var i = 0; i < this.handlerInfoList.length; i++) {
   var handlerInfo = this.handlerInfoList[i];
   handlerInfo.handler.call(handlerInfo.executionContext, obj, args);
  }
 },
 IsEmpty: function() {
  return this.handlerInfoList.length == 0;
 }
});
ASPxClientEvent.CreateHandlerInfo = function(handler, executionContext) {
 var info = new Object();
 info.handler = handler;
 info.executionContext = executionContext;
 return info;
};
ASPxClientEventArgs = _aspxCreateClass(null, {
 constructor: function() {
 }
});
ASPxClientEventArgs.Empty = new ASPxClientEventArgs();
ASPxClientProcessingModeEventArgs = _aspxCreateClass(ASPxClientEventArgs, {
 constructor: function(processOnServer){
  this.constructor.prototype.constructor.call(this);
  this.processOnServer = processOnServer;
 }
});
ASPxClientCancelEventArgs = _aspxCreateClass(ASPxClientProcessingModeEventArgs, {
 constructor: function(processOnServer){
  this.constructor.prototype.constructor.call(this, processOnServer);
  this.cancel = false;
 }
});
ASPxClientBeginCallbackEventArgs = _aspxCreateClass(ASPxClientEventArgs, {
 constructor: function(command){
  this.constructor.prototype.constructor.call(this);
  this.command = command;
 }
});
ASPxClientEndCallbackEventArgs = _aspxCreateClass(ASPxClientEventArgs, {
 constructor: function(){
  this.constructor.prototype.constructor.call(this);
 }
});
ASPxClientCustomDataCallbackEventArgs = _aspxCreateClass(ASPxClientEventArgs, {
 constructor: function(result) {
  this.constructor.prototype.constructor.call(this);
  this.result = result;
 }
});
ASPxClientCallbackErrorEventArgs = _aspxCreateClass(ASPxClientEventArgs, {
 constructor: function(message){
  this.constructor.prototype.constructor.call(this);
  this.message = message;
  this.handled = false;
 }
});
if(_aspxIsFunction(window.WebForm_InitCallbackAddField)) {
 (function() {
  var original = window.WebForm_InitCallbackAddField;
  window.WebForm_InitCallbackAddField = function(name, value) {
   if(typeof(name) == "string" && name)
    original.apply(null, arguments);
  };
 })();
}
ASPxPostHandler = _aspxCreateClass(null, {
 constructor: function() {
  this.Post = new ASPxClientEvent();
  this.ReplaceGlobalPostFunctions();
  this.HandleDxCallbackBeginning();
  this.HandleMSAjaxRequestBeginning();
 },
 OnPost: function() {
  this.Post.FireEvent(this, ASPxClientEventArgs.Empty);
 },
 ReplaceGlobalPostFunctions: function() {
  if(_aspxIsFunction(window.__doPostBack))
   this.ReplaceDoPostBack();
  if(_aspxIsFunction(window.WebForm_DoCallback))
   this.ReplaceDoCallback();
  var form = _aspxGetServerForm();
  if(form == null)
   return;
  if(form.submit)
   this.ReplaceFormSubmit(form);
  this.ReplaceFormOnSumbit(form);
  form = null;
 },
 HandleDxCallbackBeginning: function() {
  aspxGetControlCollection().BeforeInitCallback.AddHandler(function() {
   _aspxRaisePostHandlerOnPost(false, true);
  });
 },
 HandleMSAjaxRequestBeginning: function() {
  if(window.Sys && Sys.WebForms && Sys.WebForms.PageRequestManager && Sys.WebForms.PageRequestManager.getInstance) {
   var pageRequestManager = Sys.WebForms.PageRequestManager.getInstance();
   if(pageRequestManager != null && ASPxIdent.IsArray(pageRequestManager._onSubmitStatements)) {
    pageRequestManager._onSubmitStatements.unshift(function() {
     _aspxRaisePostHandlerOnPost(true); return true;
    });
   }
  }
 },
 ReplaceDoPostBack: function() {
  var original = __doPostBack;
  __doPostBack = function(eventTarget, eventArgument) {
   _aspxRaisePostHandlerOnPost();
   original(eventTarget, eventArgument);
  };
 },
 ReplaceDoCallback: function() {
  var original = WebForm_DoCallback;
  WebForm_DoCallback = function(eventTarget, eventArgument, eventCallback, context, errorCallback, useAsync) {
   var postHandler = aspxGetPostHandler();
   if(postHandler.dxCallbackHandled)
    delete postHandler.dxCallbackHandled;
   else
    _aspxRaisePostHandlerOnPost();
   return original(eventTarget, eventArgument, eventCallback, context, errorCallback, useAsync);
  };
 },
 ReplaceFormSubmit: function(form) {
  var original = form.submit;
  form.submit = function() {
   _aspxRaisePostHandlerOnPost();
   var callee = arguments.callee;
   this.submit = original;
   var submitResult = this.submit();
   this.submit = callee;
   return submitResult;
  };
 },
 ReplaceFormOnSumbit: function(form) {
  var original = form.onsubmit;
  form.onsubmit = function() {
   var postHandler = aspxGetPostHandler();
   if(postHandler.msAjaxRequestBeginningHandled)
    delete postHandler.msAjaxRequestBeginningHandled;
   else
    _aspxRaisePostHandlerOnPost();
   return _aspxIsFunction(original) ? original() : true;
  };
  form = null;
 }
});
function _aspxRaisePostHandlerOnPost(isMSAjaxRequestBeginning, isDXCallbackBeginning) {
 var postHandler = aspxGetPostHandler();
 if(_aspxIsExists(postHandler)) {
  if(isMSAjaxRequestBeginning)
   postHandler.msAjaxRequestBeginningHandled = true;
  else if(isDXCallbackBeginning)
   postHandler.dxCallbackHandled = true;
  postHandler.OnPost();
 }
}
function aspxGetPostHandler() {
 if (!_aspxIsExistsType(typeof(window.__aspxPostHandler)))
  window.__aspxPostHandler = new ASPxPostHandler();
 return window.__aspxPostHandler;
}
ASPxClientControlsInitializedEventArgs = _aspxCreateClass(ASPxClientEventArgs, {
 constructor: function(isCallback) {
  this.isCallback = isCallback;
 }
});
ASPxClientControlCollection = _aspxCreateClass(null, {
 constructor: function(){
  this.elements = new Object();
  this.windowResizeSubscribers = [];
  this.prevWndWidth = "";
  this.prevWndHeight = "";
  this.BeforeInitCallback = new ASPxClientEvent();
  this.ControlsInitialized = new ASPxClientEvent();
 },
 Add: function(element){
  this.elements[element.name] = element;
 },
 Get: function(name){
  return this.elements[name];
 },
 AdjustControls: function(container, checkSizeCorrectedFlag) {
  window.setTimeout(function() {
   var collection = aspxGetControlCollection();
   collection.ProcessControlsInConatiner(container, checkSizeCorrectedFlag, function(control, check) { control.AdjustControl(check); });
  }, 0);
 },
 CollapseControls: function(container, checkSizeCorrectedFlag) {
  this.ProcessControlsInConatiner(container, checkSizeCorrectedFlag, function(control, check) {
   control.CollapseControl(check);
  });
 },
 AtlasInitialize: function(isCallback) {
  _aspxProcessScriptsAndLinks("", isCallback);
 },
 Initialize: function() {
  this.InitializeElements(false );
  if(_aspxIsExistsType(typeof(Sys)) && _aspxIsExistsType(typeof(Sys.Application)))
   Sys.Application.add_load(aspxCAInit);
  this.InitWindowSizeCache();
 },
 InitializeElements: function(isCallback) {
  for(var name in this.elements) {
   var control = this.elements[name];
   if(!ASPxIdent.IsASPxClientControl(control))
    continue;
   if (!control.isInitialized)
    control.Initialize();
  }
  if(typeof(_aspxGetEditorStretchedInputElementsManager) != "undefined")
   _aspxGetEditorStretchedInputElementsManager().Initialize();
  this.AfterInitializeElements(true);
  this.AfterInitializeElements(false);
  this.RaiseControlsInitialized(isCallback);
 },
 AfterInitializeElements: function(leadingCall) {
  for(var name in this.elements){
   var control = this.elements[name];
   if(!ASPxIdent.IsASPxClientControl(control))
    continue;
   if (control.leadingAfterInitCall && leadingCall || !control.leadingAfterInitCall && !leadingCall) {
    if(!this.elements[name].isInitialized)
     this.elements[name].AfterInitialize();
   }
  }
 },
 DoFinalizeCallback: function() {
  for(var name in this.elements){
   var control = this.elements[name];
   if(!ASPxIdent.IsASPxClientControl(control))
    continue;
   control.DoFinalizeCallback();
  }
 },
 ProcessControlsInConatiner: function(container, checkSizeCorrectedFlag, processingProc) {
  for (var controlName in this.elements) {
   var control = this.elements[controlName];
   if(!ASPxIdent.IsASPxClientControl(control))
    continue;
   if (_aspxIsExists(container) && _aspxIsExists(control.GetMainElement)) {
    var mainElement = control.GetMainElement();
    if (_aspxIsExists(mainElement) && !_aspxGetIsParent(container, mainElement))
     continue;
   }
   processingProc(control, checkSizeCorrectedFlag);
  }
 },
 RaiseControlsInitialized: function(isCallback) {
  if(!this.ControlsInitialized.IsEmpty()){
   if(typeof(isCallback) == "undefined")
    isCallback = true;
   var args = new ASPxClientControlsInitializedEventArgs(isCallback);
   this.ControlsInitialized.FireEvent(this, args);
  }
 },
 Before_WebForm_InitCallback: function(){
  var args = new ASPxClientEventArgs();
  this.BeforeInitCallback.FireEvent(this, args);
 },
 InitWindowSizeCache: function(){
  this.prevWndWidth = document.documentElement.clientWidth;
  this.prevWndHeight = document.documentElement.clientHeight;
 },
 BrowserWindowSizeChanged: function(){
  var wndWidth = document.documentElement.clientWidth;
  var wndHeight = document.documentElement.clientHeight;
  var browserWindowSizeChanged = (this.prevWndWidth != wndWidth) || (this.prevWndHeight != wndHeight);
  if(browserWindowSizeChanged){
   this.prevWndWidth = wndWidth;
   this.prevWndHeight = wndHeight;
   return true;
  }
  return false;
 },
 SubscribeObjectToBrowserWindowResize: function(object){
  this.windowResizeSubscribers.push(object);
 },
 OnBrowserWindowResize: function(evt){
  if(this.BrowserWindowSizeChanged()){
   for(var i = 0; i < this.windowResizeSubscribers.length; i++)
    this.windowResizeSubscribers[i].OnBrowserWindowResize(evt);
  }
 }
});
ASPxClientControl = _aspxCreateClass(null, {
 constructor: function(name){
  this.isASPxClientControl = true;
  this.name = name;
  this.uniqueID = name;
  this.enabled = true;
  this.clientEnabled = true;
  this.clientVisible = true;
  this.autoPostBack = false;
  this.allowMultipleCallbacks = true;
  this.callBack = null;
  this.savedCallbacks = null;
  this.isNative = false;
  this.requestCount = 0;
  this.isInitialized = false;
  this.initialFocused = false;
  this.leadingAfterInitCall = false; 
  this.sizeCorrectedOnce = false;
  this.serverEvents = [];
  this.dialogContentHashTable = { };
  this.sizeCorrectedOnce = false;
  this.loadingPanelElement = null;
  this.loadingDivElement = null;  
  this.mainElement = null;
  this.renderIFrameForPopupElements = false;
  this.Init = new ASPxClientEvent();
  this.BeginCallback = new ASPxClientEvent();
  this.EndCallback = new ASPxClientEvent();
  this.CallbackError = new ASPxClientEvent();
  this.CustomDataCallback = new ASPxClientEvent();
  aspxGetControlCollection().Add(this);  
 },
 Initialize: function() {
  if(this.callBack != null)
   this.InitializeCallBackData();
 },
 InlineInitialize: function() {
 },
 InitailizeFocus: function() {
  if(this.initialFocused && this.IsVisible())
   this.Focus();
 },
 AfterInitialize: function() {
  this.AdjustControl(__aspxCheckSizeCorrectedFlag);
  this.InitailizeFocus();
  this.isInitialized = true;
  this.RaiseInit();
  if(_aspxIsExists(this.savedCallbacks)) {
   for(var i = 0; i < this.savedCallbacks.length; i++) 
    this.CreateCallbackInternal(this.savedCallbacks[i].arg, this.savedCallbacks[i].command, 
     false, this.savedCallbacks[i].callbackInfo);
   this.savedCallbacks = null;
  }
 },
 InitializeCallBackData: function() {
 },
 CollapseControl: function(checkSizeCorrectedFlag) {
 },
 AdjustControl: function(checkSizeCorrectedFlag, nestedCall) {
  if(checkSizeCorrectedFlag && this.sizeCorrectedOnce || ASPxClientControl.adjustControlLocked && !nestedCall)
   return;
  ASPxClientControl.adjustControlLocked = true;
  try {
   var mainElement = this.GetMainElement();
   if (!_aspxIsExists(mainElement) || !this.IsDisplayed())
    return;
   this.AdjustControlCore();
   this.sizeCorrectedOnce = true;
  } finally {
   delete ASPxClientControl.adjustControlLocked;
  }
 },
 AdjustControlCore: function() {
 },
 OnBrowserWindowResize: function(evt){
 },
 RegisterServerEventAssigned: function(eventNames){
  for(var i = 0; i < eventNames.length; i++)
   this.serverEvents[eventNames[i]] = true;
 },
 IsServerEventAssigned: function(eventName){
  return _aspxIsExists(this.serverEvents[eventName]);
 },
 GetChild: function(idPostfix){
  var mainElement = this.GetMainElement();
  return _aspxIsExists(mainElement) ? _aspxGetChildById(mainElement, this.name + idPostfix) : null;
 },
 GetItemElementName: function(element) {
  var name = "";
  if (_aspxIsExists(element.id))
   name = element.id.substring(this.name.length + 1);
  return name;
 },
 GetLinkElement: function(element) {
  if (element == null) return null;
  return (element.tagName == "A") ? element : _aspxGetChildByTagName(element, "A", 0);
 },
 GetInternalHyperlinkElement: function(parentElement, index) {
  var element = _aspxGetChildByTagName(parentElement, "A", index);
  if (element == null) 
   element = _aspxGetChildByTagName(parentElement, "SPAN", index);
  return element;
 },
 GetMainElement: function(){
  if(!_aspxIsExistsElement(this.mainElement))
   this.mainElement = _aspxGetElementById(this.name);
  return this.mainElement;
 },
 IsRightToLeft: function() {
  return _aspxIsElementRigthToLeft(this.GetMainElement());
 },
 OnControlClick: function(clickedElement, htmlEvent) {
 },
 GetLoadingPanelElement: function(){
  return _aspxGetElementById(this.name + "_LP");
 },
 CloneLoadingPanel: function(element, parent) {
  var clone = element.cloneNode(true);
  clone.id = element.id + "V";
  parent.appendChild(clone);
  return clone;
 },
 CreateLoadingPanelInsideContainer: function(parentElement) {
  if(parentElement == null) return null;
  this.HideLoadingPanel();
  var element = this.GetLoadingPanelElement();
  if (element != null){
   var width = 0;
   var height = 0;
   var itemsTable = _aspxGetChildByTagName(parentElement, "TABLE", 0);
   if(itemsTable != null) {
    width = itemsTable.offsetWidth;
    height = itemsTable.offsetHeight;
   } else if(parentElement.childNodes.length == 0){
    var dummyDiv = document.createElement("DIV");
    parentElement.appendChild(dummyDiv);
    width = dummyDiv.offsetWidth;
   } else {
    width = parentElement.clientWidth;
    height = parentElement.clientHeight;
   }
   parentElement.innerHTML = "";
   var table = document.createElement("TABLE");
   parentElement.appendChild(table);
   table.border = 0;
   table.cellPadding = 0;
   table.cellSpacing = 0;
   table.style.height = (height > 0) ? height + "px" : "100%";
   table.style.width = (width > 0) ? width + "px" : "100%";
   var tbody = document.createElement("TBODY");
   table.appendChild(tbody);
   var tr = document.createElement("TR");
   tbody.appendChild(tr);
   var td = document.createElement("TD");
   tr.appendChild(td);
   td.align = "center";
   td.vAlign = "middle";
   element = this.CloneLoadingPanel(element, td);
   _aspxSetElementDisplay(element, true);
   this.loadingPanelElement = element;
   return element;
  } else
   parentElement.innerHTML = "&nbsp;";
  return null;
 },
 CreateLoadingPanelWithAbsolutePosition: function(parentElement, offsetElement) {
  if(parentElement == null) return null;
  this.HideLoadingPanel();
  if(!_aspxIsExists(offsetElement))
   offsetElement = parentElement;
  var element = this.GetLoadingPanelElement();
  if(element != null) {
   element = this.CloneLoadingPanel(element, parentElement);
   element.style.position = "absolute";
   _aspxSetElementDisplay(element, true);
   this.SetLoadingPanelLocation(offsetElement, element);
   this.loadingPanelElement = element;
   return element;
  }
  return null;
 },
 CreateLoadingPanelInline: function(parentElement){
  if(parentElement == null) return null;
  this.HideLoadingPanel();
  var element = this.GetLoadingPanelElement();
  if(element != null) {
   element = this.CloneLoadingPanel(element, parentElement);
   _aspxSetElementDisplay(element, true);
   this.loadingPanelElement = element;
   return element;
  }
  return null;
 },
 HideLoadingPanel: function() {
  if(_aspxIsExistsElement(this.loadingPanelElement)) {
   _aspxRemoveElement(this.loadingPanelElement);
   this.loadingPanelElement = null;
  }
 },
 SetLoadingPanelLocation: function(offsetElement, loadingPanel, x, y, offsetX, offsetY) {
  if(!_aspxIsExists(x) || !_aspxIsExists(y)){
   var x1 = _aspxGetAbsoluteX(offsetElement) - _aspxGetIEDocumentClientOffset(true);
   var y1 = _aspxGetAbsoluteY(offsetElement) - _aspxGetIEDocumentClientOffset(false);
   var x2 = x1;
   var y2 = y1;
   if(offsetElement == document.body){
    x2 += _aspxGetDocumentMaxClientWidth();
    y2 += _aspxGetDocumentMaxClientHeight();
   }
   else{
    x2 += offsetElement.offsetWidth;
    y2 += offsetElement.offsetHeight;
   }
   if(x1 < _aspxGetDocumentScrollLeft())
    x1 = _aspxGetDocumentScrollLeft();
   if(y1 < _aspxGetDocumentScrollTop())
    y1 = _aspxGetDocumentScrollTop();
   if(x2 > _aspxGetDocumentScrollLeft() + _aspxGetDocumentClientWidth())
    x2 = _aspxGetDocumentScrollLeft() + _aspxGetDocumentClientWidth();
   if(y2 > _aspxGetDocumentScrollTop() + _aspxGetDocumentClientHeight())
    y2 = _aspxGetDocumentScrollTop() + _aspxGetDocumentClientHeight();
   x = x1 + ((x2 - x1 - loadingPanel.offsetWidth) / 2);
   y = y1 + ((y2 - y1 - loadingPanel.offsetHeight) / 2);
  }
  if(_aspxIsExists(offsetX) && _aspxIsExists(offsetY)){
   x += offsetX;
   y += offsetY;
  }
  loadingPanel.style.left = _aspxPrepareClientPosForElement(x, loadingPanel, true) + "px";
  loadingPanel.style.top = _aspxPrepareClientPosForElement(y, loadingPanel, false) + "px";
 },
 GetLoadingDiv: function(){
  return _aspxGetElementById(this.name + "_LD");
 },
 CreateLoadingDiv: function(parentElement, offsetElement){
  if(parentElement == null) return null;
  this.HideLoadingDiv();
  if(!_aspxIsExists(offsetElement))
   offsetElement = parentElement;
  var div = this.GetLoadingDiv();
  if(div != null){
   div = div.cloneNode(true);
   parentElement.appendChild(div);
   _aspxSetElementDisplay(div, true);
   this.SetLoadingDivBounds(offsetElement, div);
   this.loadingDivElement = div;
   return div;
  }
  return null;
 },
 SetLoadingDivBounds: function(offsetElement, loadingDiv) {
  var absX = (offsetElement == document.body) ? 0 : _aspxGetAbsoluteX(offsetElement);
  var absY = (offsetElement == document.body) ? 0 : _aspxGetAbsoluteY(offsetElement);
  loadingDiv.style.left = _aspxPrepareClientPosForElement(absX, loadingDiv, true) + "px";
  loadingDiv.style.top = _aspxPrepareClientPosForElement(absY, loadingDiv, false) + "px";
  var width = (offsetElement == document.body) ? _aspxGetDocumentWidth() : offsetElement.offsetWidth;
  var height = (offsetElement == document.body) ? _aspxGetDocumentHeight() : offsetElement.offsetHeight;
  _aspxSetStyleSize(loadingDiv, width, height); 
  var correctedWidth = 2 * width - loadingDiv.offsetWidth;
  if(correctedWidth <= 0) correctedWidth = width;
  var correctedHeight = 2 * height - loadingDiv.offsetHeight;
  if(correctedHeight <= 0) correctedHeight = height;
  _aspxSetStyleSize(loadingDiv, correctedWidth, correctedHeight);
 },
 HideLoadingDiv: function() {
  if(_aspxIsExistsElement(this.loadingDivElement)){
   _aspxRemoveElement(this.loadingDivElement);
   this.loadingDivElement = null;
  }
 },
 RaiseInit: function(){
  if(!this.Init.IsEmpty()){
   var args = new ASPxClientEventArgs();
   this.Init.FireEvent(this, args);
  }
 },
 RaiseBeginCallback: function(command){
  if(!this.BeginCallback.IsEmpty()){
   var args = new ASPxClientBeginCallbackEventArgs(command);
   this.BeginCallback.FireEvent(this, args);
  }
  if(_aspxIsExistsType(typeof(aspxGetGlobalEvents)))
   aspxGetGlobalEvents().OnBeginCallback(this, command);
 },
 RaiseEndCallback: function(){
  if(!this.EndCallback.IsEmpty()){
   var args = new ASPxClientEndCallbackEventArgs();
   this.EndCallback.FireEvent(this, args);
  }
  if(_aspxIsExistsType(typeof(aspxGetGlobalEvents)))
   aspxGetGlobalEvents().OnEndCallback(this);
 },
 RaiseCallbackError: function(message) {
  if(!this.CallbackError.IsEmpty()) {
   var args = new ASPxClientCallbackErrorEventArgs(message);
   this.CallbackError.FireEvent(this, args);
   if(args.handled)
    return { isHandled: true, errorMessage: args.message };
  }
  if(_aspxIsExistsType(typeof(aspxGetGlobalEvents))) {
   var args = new ASPxClientCallbackErrorEventArgs(message);
   aspxGetGlobalEvents().OnCallbackError(this, args);
   if(args.handled)
    return { isHandled: true, errorMessage: args.message };
  }
  return { isHandled: false, errorMessage: message };
 },
 IsVisible: function() {
  var element = this.GetMainElement();
  while(_aspxIsExists(element) && element.tagName != "BODY") {
   if (!_aspxGetElementVisibility(element) || !_aspxGetElementDisplay(element))
    return false;
   element = element.parentNode;
  }
  return true;
 },
 IsDisplayed: function() {
  var element = this.GetMainElement();
  while(_aspxIsExists(element) && element.tagName != "BODY") {
   if(!_aspxGetElementDisplay(element)) 
    return false;
   element = element.parentNode;
  }
  return true;
 },
 Focus: function() {
 },
 GetClientVisible: function(){
  return this.GetVisible();
 },
 SetClientVisible: function(visible){
  this.SetVisible(visible);
 },
 GetVisible: function(){
  return this.clientVisible;
 },
 SetVisible: function(visible){
  if(this.clientVisible != visible){
   this.clientVisible = visible;
   _aspxSetElementDisplay(this.GetMainElement(), visible);
   if (visible) {
    this.AdjustControl(__aspxCheckSizeCorrectedFlag);
    var mainElement = this.GetMainElement();
    if (_aspxIsExists(mainElement))
     aspxGetControlCollection().AdjustControls(mainElement, __aspxCheckSizeCorrectedFlag);
   }
  }
 },
 InCallback: function() {
  return this.requestCount > 0;
 },
 DoBeginCallback: function(command) {
  if(!_aspxIsExists(command)) command = "";
  this.RaiseBeginCallback(command);
  aspxGetControlCollection().Before_WebForm_InitCallback();
  if(_aspxIsExistsType(typeof(WebForm_InitCallback)) && _aspxIsExists(WebForm_InitCallback)) {
   __theFormPostData = "";
   __theFormPostCollection = new Array();
   this.ClearPostBackEventInput("__EVENTTARGET");
   this.ClearPostBackEventInput("__EVENTARGUMENT");
   WebForm_InitCallback();
   this.savedFormPostData = __theFormPostData;   
   this.savedFormPostCollection = __theFormPostCollection;
  }
 },
 ClearPostBackEventInput: function(id){
  var element = _aspxGetElementById(id);
  if(element != null) element.value = "";
 },
 PerformDataCallback: function(arg, handler) {
  this.CreateCustomDataCallback(arg, "", handler);
 }, 
 CreateCallback: function(arg, command) {
  var callbackInfo = this.CreateCallbackInfo(ASPxCallbackType.Common, null);
  this.CreateCallbackByInfo(arg, command, callbackInfo);
 },
 CreateCustomDataCallback: function(arg, command, handler) {
  var callbackInfo = this.CreateCallbackInfo(ASPxCallbackType.Data, handler);
  this.CreateCallbackByInfo(arg, command, callbackInfo);
 },
 CreateCallbackByInfo: function(arg, command, callbackInfo) {
  if(_aspxIsExistsType(typeof(WebForm_DoCallback)) && _aspxIsExists(WebForm_DoCallback)) 
   this.CreateCallbackInternal(arg, command, true, callbackInfo);
  else {
   if(!_aspxIsExists(this.savedCallbacks))
    this.savedCallbacks = [];
   this.savedCallbacks.push({ arg: arg, command: command, callbackInfo: callbackInfo });
  }
 },
 CreateCallbackInternal: function(arg, command, viaTimer, callbackInfo) {
  if(!this.CanCreateCallback()) 
   return;
  this.requestCount++;
  this.DoBeginCallback(command);
  if(typeof(arg) == "undefined")
   arg = "";
  if(typeof(command) == "undefined")
   command = "";
  var callbackID = this.SaveCallbackInfo(callbackInfo);
  if(viaTimer)
   window.setTimeout("aspxCreateCallback('" + this.name + "', '" + escape(arg) + "', '" + escape(command) + "', " + callbackID + ");", 0);
  else
   this.CreateCallbackCore(arg, command, callbackID);
 },
 CreateCallbackCore: function(arg, command, callbackID) {
  __theFormPostData = this.savedFormPostData;
  __theFormPostCollection = this.savedFormPostCollection;
  this.callBack(this.GetSerializedCallbackInfoByID(callbackID) + arg);
 },
 CanCreateCallback: function() {
  return this.allowMultipleCallbacks || !this.InCallback();
 },
 DoLoadCallbackScripts: function() {
  _aspxProcessScriptsAndLinks(this.name);
 },
 DoEndCallback: function(){
  this.RaiseEndCallback();
 },
 DoFinalizeCallback: function() {
 },
 HideLoadingPanelOnCallback: function() {
  return true;
 },
 DoCallback: function(result) {
  this.requestCount--;
  if(this.HideLoadingPanelOnCallback()) {
   this.HideLoadingDiv();
   this.HideLoadingPanel();
  }
  if(result.indexOf(__aspxCallbackResultPrefix) != 0) 
   this.ProcessCallbackGeneralError(result);
  else {
   var resultObj = null;
   try {
    resultObj = eval(result);
   } 
   catch(e) {
   }
   if(_aspxIsExists(resultObj)){
    if(_aspxIsExists(resultObj.redirect))
     window.location.href = resultObj.redirect;
    else if(_aspxIsExists(resultObj.generalError))
     this.ProcessCallbackGeneralError(resultObj.generalError);
    else {
     var errorObj = resultObj.error;
     if(_aspxIsExists(errorObj))
      this.ProcessCallbackError(errorObj);
     else {
      if(resultObj.cp) {
       for(var name in resultObj.cp)
        this[name] = resultObj.cp[name];
      }
      var callbackInfo = this.DequeueCallbackInfo(resultObj.id);
      if(callbackInfo.type == ASPxCallbackType.Data) 
       this.ProcessCustomDataCallback(resultObj.result, callbackInfo);
      else 
       this.ProcessCallback(resultObj.result);
     }
     this.DoLoadCallbackScripts();
    }
   } 
  }
 },
 DoCallbackError: function(result) {
  this.HideLoadingDiv();
  this.HideLoadingPanel();
  this.OnCallbackGeneralError(result);
 },
 DoControlClick: function(evt) {
  this.OnControlClick(_aspxGetEventSource(evt), evt);
 },
 ProcessCallback: function(result) {
  this.OnCallback(result);
 },
 ProcessCustomDataCallback: function(result, callbackInfo) {
  if(callbackInfo.handler != null)
   callbackInfo.handler(this, result);
  this.RaiseCustomDataCallback(result);
 },
 RaiseCustomDataCallback: function(result) {
  if(!this.CustomDataCallback.IsEmpty()) {
   var arg = new ASPxClientCustomDataCallbackEventArgs(result);
   this.CustomDataCallback.FireEvent(this, arg);
  }
 },
 OnCallback: function(result) {
 },
 CreateCallbackInfo: function(type, handler) {
  return { type: type, handler: handler };
 },
 GetSerializedCallbackInfoByID: function(callbackID) {
  return this.GetCallbackInfoByID(callbackID).type + callbackID + __aspxCallbackSeparator;
 },
 SaveCallbackInfo: function(callbackInfo) {
  var activeCallbacksInfo = this.GetActiveCallbacksInfo();
  for(var i = 0; i < activeCallbacksInfo.length; i++) {
   if(activeCallbacksInfo[i] == null) {
    activeCallbacksInfo[i] = callbackInfo;
    return i;
   }
  }
  activeCallbacksInfo.push(callbackInfo);
  return activeCallbacksInfo.length - 1;
 },
 GetActiveCallbacksInfo: function() {
  var persistentProperties = this.GetPersistentProperties();
  if(!persistentProperties.activeCallbacks)
   persistentProperties.activeCallbacks = [ ];
  return persistentProperties.activeCallbacks;
 },
 GetPersistentProperties: function() {
  var storage = _aspxGetPersistentControlPropertiesStorage();
  var persistentProperties = storage[this.name];
  if(!persistentProperties) {
   persistentProperties = { };
   storage[this.name] = persistentProperties;
  }
  return persistentProperties;
 },
 GetCallbackInfoByID: function(callbackID) {
  return this.GetActiveCallbacksInfo()[callbackID];
 },
 DequeueCallbackInfo: function(index) {
  var activeCallbacksInfo = this.GetActiveCallbacksInfo();
  if(index < 0 || index >= activeCallbacksInfo.length)
   return null;
  var result = activeCallbacksInfo[index];
  activeCallbacksInfo[index] = null;
  return result;
 },
 ProcessCallbackError: function(errorObj) {
  var data = _aspxIsExists(errorObj.data) ? errorObj.data : null;
  var result = this.RaiseCallbackError(errorObj.message);
  if(!result.isHandled)
   this.OnCallbackError(result.errorMessage, data);
 },
 OnCallbackError: function(errorMessage, data) {
  if(errorMessage)
   alert(errorMessage);
 },
 ProcessCallbackGeneralError: function(errorMessage) {
  var result = this.RaiseCallbackError(errorMessage);
  if(!result.isHandled)
   this.OnCallbackGeneralError(result.errorMessage);
 },
 OnCallbackGeneralError: function(errorMessage) {
  this.OnCallbackError(errorMessage, null);
 },
 SendPostBack: function(params) {
  __doPostBack(this.uniqueID, params);
 }
});
ASPxIdent = { };
ASPxIdent.IsDate = function(obj) {
 return _aspxIsExists(obj) && obj.constructor == Date;
};
ASPxIdent.IsRegExp = function(obj) {
 return _aspxIsExists(obj) && obj.constructor === RegExp;
};
ASPxIdent.IsArray = function(obj) {
 return _aspxIsExists(obj) && obj.constructor == Array;
};
ASPxIdent.IsASPxClientControl = function(obj) {
 return obj != null && _aspxIsExists(obj.isASPxClientControl) && obj.isASPxClientControl;
};
ASPxIdent.IsASPxClientEdit = function(obj) {
 return _aspxIsExists(obj.isASPxClientEdit) && obj.isASPxClientEdit;
};
ASPxClientControl.GetControlCollection = function(){
 return aspxGetControlCollection();
}
var __aspxControlCollection = null;
function aspxGetControlCollection(){
 if(__aspxControlCollection == null)
  __aspxControlCollection = new ASPxClientControlCollection();
 return __aspxControlCollection;
}
var __aspxPersistentControlPropertiesStorage = null;
function _aspxGetPersistentControlPropertiesStorage() {
 if(__aspxPersistentControlPropertiesStorage == null)
  __aspxPersistentControlPropertiesStorage = { };
 return __aspxPersistentControlPropertiesStorage;
}
function _aspxFunctionIsInCallstack(currentCallee, targetFunction, depthLimit) {
 var candidate = currentCallee;
 var depth = 0;
 while(candidate && depth <= depthLimit) {
  candidate = candidate.caller;
  if(candidate == targetFunction)
   return true;
  depth++;
 }
 return false;
}
function aspxCAInit() {
 var isAppInit = typeof(Sys$_Application$_doInitialize) != "undefined" &&
  _aspxFunctionIsInCallstack(arguments.callee, Sys$_Application$_doInitialize, 10 );
 aspxGetControlCollection().AtlasInitialize(!isAppInit);
}
function aspxCreateCallback(name, arg, command, callbackID){
 var control = aspxGetControlCollection().Get(name);
 if(control != null)
  control.CreateCallbackCore(unescape(arg), unescape(command), callbackID);
}
function aspxCallback(result, context){
 var collection = aspxGetControlCollection();
 collection.DoFinalizeCallback();
 var control = collection.Get(context);
 if(control != null)
  control.DoCallback(result);
}
function aspxCallbackError(result, context){
 var control = aspxGetControlCollection().Get(context);
 if(control != null)
  control.DoCallbackError(result, false);
}
function aspxCClick(name, evt) {
 var control = aspxGetControlCollection().Get(name);
 if(control != null) control.DoControlClick(evt);
}
var __aspxStateItemsExist = false;
var __aspxHoverStyleSheet = null;
var __aspxPressedStyleSheet = null;
var __aspxSelectedStyleSheet = null;
var __aspxDisabledStyleSheet = null;
var __aspxFocusedItemKind = "FocusedStateItem";
var __aspxHoverItemKind = "HoverStateItem";
var __aspxPressedItemKind = "PressedStateItem";
var __aspxSelectedItemKind = "SelectedStateItem";
var __aspxDisabledItemKind = "DisabledStateItem";
var __aspxStyleCount = 0;
var __aspxStyleNameCache = new Object();
function _aspxCreateImportantStyleRule(styleSheet, cssText) {
 if(_aspxIsExists(__aspxStyleNameCache[cssText]))
  return __aspxStyleNameCache[cssText];
 var newText = "";
 var attributes = cssText.split(";");
 for(var i = 0; i < attributes.length; i++){
  if(attributes[i] != "")
   newText += attributes[i] + " !important;";
 }
 var className = "dxh" + __aspxStyleCount;
 _aspxAddStyleSheetRule(styleSheet, "." + className, newText);
 __aspxStyleCount++;
 __aspxStyleNameCache[cssText] = className;
 return className; 
}
ASPxStateItem = _aspxCreateClass(null, {
 constructor: function(name, classNames, cssTexts, postfixes, imageUrls, imagePostfixes, kind){
  this.name = name;
  this.classNames = classNames;
  this.customClassNames = [];
  this.resultClassNames = [];
  this.cssTexts = cssTexts;
  this.postfixes = postfixes;
  this.imageUrls = imageUrls;
  this.imagePostfixes = imagePostfixes;
  this.kind = kind;
  this.enabled = true;
  this.needRefreshBetweenElements = false;
  this.elements = null;
  this.images = null;
  this.linkColor = null;
  this.lintTextDecoration = null;
 },
 GetCssText: function(index){
  if(_aspxIsExists(this.cssTexts[index]))
   return this.cssTexts[index];
  return this.cssTexts[0];
 },
 CreateStyleRule: function(index){
  if(this.GetCssText(index) == "") return "";
  var styleSheet = this.GetStyleSheet();
  if(_aspxIsExists(styleSheet))
   return _aspxCreateImportantStyleRule(styleSheet, this.GetCssText(index));  
  return ""; 
 },
 GetClassName: function(index){
  if(_aspxIsExists(this.classNames[index]))
   return this.classNames[index];
  return this.classNames[0];
 },
 GetResultClassName: function(index){
  if(!_aspxIsExists(this.resultClassNames[index])){
   if(!_aspxIsExists(this.customClassNames[index]))
    this.customClassNames[index] = this.CreateStyleRule(index);
   if(this.GetClassName(index) != "" && this.customClassNames[index] != "")
    this.resultClassNames[index] = this.GetClassName(index) + " " + this.customClassNames[index];
   else if(this.GetClassName(index) != "")
    this.resultClassNames[index] = this.GetClassName(index);
   else if(this.customClassNames[index] != "")
    this.resultClassNames[index] = this.customClassNames[index];
  }
  return this.resultClassNames[index];
 },
 GetStyleSheet: function(){
  if(!_aspxIsExists(__aspxDisabledStyleSheet))
   __aspxDisabledStyleSheet = _aspxCreateStyleSheet();
  if(!_aspxIsExists(__aspxSelectedStyleSheet))
   __aspxSelectedStyleSheet = _aspxCreateStyleSheet();
  if(!_aspxIsExists(__aspxHoverStyleSheet))
   __aspxHoverStyleSheet = _aspxCreateStyleSheet();
  if(!_aspxIsExists(__aspxPressedStyleSheet))
   __aspxPressedStyleSheet = _aspxCreateStyleSheet();
  switch(this.kind){
   case __aspxDisabledItemKind:
    return __aspxDisabledStyleSheet;
   case __aspxHoverItemKind:
    return __aspxHoverStyleSheet;
   case __aspxPressedItemKind:
    return __aspxPressedStyleSheet;
   case __aspxSelectedItemKind:
    return __aspxSelectedStyleSheet;
  }
  return null;
 },
 GetElements: function(element){
  if(!_aspxIsExists(this.elements) || !_aspxIsValidElements(this.elements)){
   if(_aspxIsExists(this.postfixes) && this.postfixes.length > 0){
    this.elements = new Array();
    var parentNode = element.parentNode;
    if(_aspxIsExists(parentNode)){
     for(var i = 0; i < this.postfixes.length; i++){
      var id = this.name + this.postfixes[i];
      this.elements[i] = _aspxGetChildById(parentNode, id);
      if(!_aspxIsExists(this.elements[i]))
       this.elements[i] = _aspxGetElementById(id);
     }
    }
   }
   else
    this.elements = [element];
  }
  return this.elements;
 },
 GetImages: function(element){
  if(!_aspxIsExists(this.images) || !_aspxIsValidElements(this.images)){
   this.images = new Array();
   if(_aspxIsExists(this.imagePostfixes) && this.imagePostfixes.length > 0){
    var elements = this.GetElements(element);
    for(var i = 0; i < this.imagePostfixes.length; i++){
     var id = this.name + this.imagePostfixes[i];
     for(var j = 0; j < elements.length; j++){
      if(!_aspxIsExists(elements[j])) continue;
      this.images[i] = _aspxGetChildById(elements[j], id);
      if(_aspxIsExists(this.images[i]))
       break;
     }
    }
   }
  }
  return this.images;
 },
 Apply: function(element){
  if(!this.enabled) return;
  try{
   this.ApplyStyle(element);
   if(_aspxIsExists(this.imageUrls) && this.imageUrls.length > 0)
    this.ApplyImage(element);
  }
  catch(e){
  }
 },
 ApplyStyle: function(element){
  var elements = this.GetElements(element);
  for(var i = 0; i < elements.length; i++){
   if(!_aspxIsExists(elements[i])) continue;
   var className = elements[i].className.replace(this.GetResultClassName(i), "");
   elements[i].className = _aspxTrim(className) + " " + this.GetResultClassName(i);
   if(!__aspxOpera || __aspxBrowserVersion >= 9)
    this.ApplyStyleToLinks(elements, i);
  }
 },
 ApplyStyleToLinks: function(elements, index){
  var linkCount = 0;
  var savedLinkCount = -1;
  if(_aspxIsExists(elements[index]["savedLinkCount"]))
   savedLinkCount = parseInt(elements[index]["savedLinkCount"]);
  do{
   if(savedLinkCount > -1 && savedLinkCount <= linkCount)
    break;
   var link = elements[index]["link" + linkCount];
   if(!_aspxIsExists(link)){
    link = _aspxGetChildByTagName(elements[index], "A", linkCount);
    if(!_aspxIsExists(link))
     link = _aspxGetChildByTagName(elements[index], "SPAN", linkCount); 
    if(_aspxIsExists(link))
     elements[index]["link" + linkCount] = link;
   }
   if(_aspxIsExists(link))
    this.ApplyStyleToLinkElement(link, index);
   else
    elements[index]["savedLinkCount"] = linkCount;
   linkCount++;
  }
  while(link != null)
 },
 ApplyStyleToLinkElement: function(link, index){
  if(this.GetLinkColor(index) != "")
   _aspxChangeAttributeExtended(link.style, "color", link, "saved" + this.kind + "Color", this.GetLinkColor(index));
  if(this.GetLinkTextDecoration(index) != "")
   _aspxChangeAttributeExtended(link.style, "textDecoration", link, "saved" + this.kind + "TextDecoration", this.GetLinkTextDecoration(index));
 },
 ApplyImage: function(element){
  var images = this.GetImages(element);
  for(var i = 0; i < images.length; i++){
   if(!_aspxIsExists(images[i]) || !_aspxIsExists(this.imageUrls[i]) || this.imageUrls[i] == "") continue;
   if(_aspxIsAlphaFilterUsed(images[i]))   
    _aspxChangeAttributeExtended(images[i].style, "filter", images[i], "saved" + this.kind + "Filter", 
     "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=" + this.imageUrls[i] + ", sizingMethod=scale)");    
   else
    _aspxChangeAttributeExtended(images[i], "src", images[i], "saved" + this.kind + "Src", this.imageUrls[i]);
  }
 },
 Cancel: function(element){
  if(!this.enabled) return;
  try{  
   this.CancelStyle(element);
   if(_aspxIsExists(this.imageUrls) && this.imageUrls.length > 0)
   this.CancelImage(element);
  }
  catch(e){
  }
 },
 CancelStyle: function(element){
  var elements = this.GetElements(element);
  for(var i = 0; i < elements.length; i++){
   if(!_aspxIsExists(elements[i])) continue;
   var className = _aspxTrim(elements[i].className.replace(this.GetResultClassName(i), ""));
   elements[i].className = className;
   if(!__aspxOpera || __aspxBrowserVersion >= 9)
    this.CancelStyleFromLinks(elements, i);
  }
 },
 CancelStyleFromLinks: function(elements, index){
  var linkCount = 0;
  var savedLinkCount = -1;
  if(_aspxIsExists(elements[index]["savedLinkCount"]))
   savedLinkCount = parseInt(elements[index]["savedLinkCount"]);
  do{
   if(savedLinkCount > -1 && savedLinkCount <= linkCount)
    break;
   var link = elements[index]["link" + linkCount];
   if(!_aspxIsExists(link)){
    link = _aspxGetChildByTagName(elements[index], "A", linkCount);
    if(!_aspxIsExists(link))
     link = _aspxGetChildByTagName(elements[index], "SPAN", linkCount); 
    if(_aspxIsExists(link))
     elements[index]["link" + linkCount] = link;
   }
   if(_aspxIsExists(link))
    this.CancelStyleFromLinkElement(link, index);
   else
    elements[index]["savedLinkCount"] = linkCount;
   linkCount++;
  }
  while(link != null)
 },
 CancelStyleFromLinkElement: function(link, index){
  if(this.GetLinkColor(index) != "")
   _aspxRestoreAttributeExtended(link.style, "color", link, "saved" + this.kind + "Color");
  if(this.GetLinkTextDecoration(index) != "")
   _aspxRestoreAttributeExtended(link.style, "textDecoration", link, "saved" + this.kind + "TextDecoration");
 },
 CancelImage: function(element){
  var images = this.GetImages(element);
  for(var i = 0; i < images.length; i++){
   if(!_aspxIsExists(images[i]) || !_aspxIsExists(this.imageUrls[i]) || this.imageUrls[i] == "") continue;
   if(_aspxIsAlphaFilterUsed(images[i]))
    _aspxRestoreAttributeExtended(images[i].style, "filter", images[i], "saved" + this.kind + "Filter");
   else
    _aspxRestoreAttributeExtended(images[i], "src", images[i], "saved" + this.kind + "Src");
  }
 },
 Clone: function(){
  return new ASPxStateItem(this.name, this.classNames, this.cssTexts, this.postfixes, 
   this.imageUrls, this.imagePostfixes, this.kind);
 },
 IsChildElement: function(element){
  if(element != null){
   var elements = this.GetElements(element);
   for(var i = 0; i < elements.length; i++){
    if(!_aspxIsExists(elements[i])) continue;
    if(_aspxGetIsParent(elements[i], element)) 
     return true;
   }
  }
  return false;
 },
 GetLinkColor: function(index){
  if(!_aspxIsExists(this.linkColor)){
   var rule = _aspxGetStyleSheetRule(this.customClassNames[index]);
   this.linkColor = _aspxIsExists(rule) ? rule.style.color : null;
   if(!_aspxIsExists(this.linkColor)){
    var rule = _aspxGetStyleSheetRule(this.GetClassName(index));
    this.linkColor = _aspxIsExists(rule) ? rule.style.color : null;
   }
   if(this.linkColor == null) 
    this.linkColor = "";
  }
  return this.linkColor;
 },
 GetLinkTextDecoration: function(index){
  if(!_aspxIsExists(this.linkTextDecoration)){
   var rule = _aspxGetStyleSheetRule(this.customClassNames[index]);
   this.linkTextDecoration = _aspxIsExists(rule) ? rule.style.textDecoration : null;
   if(!_aspxIsExists(this.linkTextDecoration)){
    var rule = _aspxGetStyleSheetRule(this.GetClassName(index));
    this.linkTextDecoration = _aspxIsExists(rule) ? rule.style.textDecoration : null;
   }
   if(this.linkTextDecoration == null) 
    this.linkTextDecoration = "";
  }
  return this.linkTextDecoration;
 }
});
ASPxClientStateEventArgs = _aspxCreateClass(null, {
 constructor: function(item, element){
  this.item = item;
  this.element = element;
  this.toElement = null;
  this.fromElement = null;
  this.htmlEvent = null;
 }
});
ASPxStateController = _aspxCreateClass(null, {
 constructor: function(){
  this.focusedItems = new Object();
  this.hoverItems = new Object();
  this.pressedItems = new Object();
  this.selectedItems = new Object();
  this.disabledItems = new Object();
  this.currentFocusedElement = null;
  this.currentFocusedItemName = null;
  this.currentHoverElement = null;
  this.currentHoverItemName = null;
  this.currentPressedElement = null;
  this.currentPressedItemName = null;
  this.savedCurrentPressedElement = null;
  this.savedCurrentMouseMoveSrcElement = null;
  this.AfterSetFocusedState = new ASPxClientEvent();
  this.AfterClearFocusedState = new ASPxClientEvent();
  this.AfterSetHoverState = new ASPxClientEvent();
  this.AfterClearHoverState = new ASPxClientEvent();
  this.AfterSetPressedState = new ASPxClientEvent();
  this.AfterClearPressedState = new ASPxClientEvent();
  this.AfterDisabled = new ASPxClientEvent();
  this.AfterEnabled = new ASPxClientEvent();
  this.BeforeSetFocusedState = new ASPxClientEvent();
  this.BeforeClearFocusedState = new ASPxClientEvent();
  this.BeforeSetHoverState = new ASPxClientEvent();
  this.BeforeClearHoverState = new ASPxClientEvent();
  this.BeforeSetPressedState = new ASPxClientEvent();
  this.BeforeClearPressedState = new ASPxClientEvent();
  this.BeforeDisabled = new ASPxClientEvent();
  this.BeforeEnabled = new ASPxClientEvent();
  this.FocusedItemKeyDown = new ASPxClientEvent();
 }, 
 AddHoverItem: function(name, classNames, cssTexts, postfixes, imageUrls, imagePostfixes){
  this.AddItem(this.hoverItems, name, classNames, cssTexts, postfixes, imageUrls, imagePostfixes, __aspxHoverItemKind);
  this.AddItem(this.focusedItems, name, classNames, cssTexts, postfixes, imageUrls, imagePostfixes, __aspxFocusedItemKind);
 },
 AddPressedItem: function(name, classNames, cssTexts, postfixes, imageUrls, imagePostfixes){
  this.AddItem(this.pressedItems, name, classNames, cssTexts, postfixes, imageUrls, imagePostfixes, __aspxPressedItemKind);
 },
 AddSelectedItem: function(name, classNames, cssTexts, postfixes, imageUrls, imagePostfixes){
  this.AddItem(this.selectedItems, name, classNames, cssTexts, postfixes, imageUrls, imagePostfixes, __aspxSelectedItemKind);
 },
 AddDisabledItem: function(name, classNames, cssTexts, postfixes, imageUrls, imagePostfixes){
  this.AddItem(this.disabledItems, name, classNames, cssTexts, postfixes, imageUrls, imagePostfixes, __aspxDisabledItemKind);
 },
 AddItem: function(items, name, classNames, cssTexts, postfixes, imageUrls, imagePostfixes, kind){
  var stateItem = new ASPxStateItem(name, classNames, cssTexts, postfixes, imageUrls, imagePostfixes, kind);
  if(_aspxIsExists(postfixes) && postfixes.length > 0){
   for(var i = 0; i < postfixes.length; i ++){
    items[name + postfixes[i]] = stateItem;
   }
  }
  else
   items[name] = stateItem;
  __aspxStateItemsExist = true;
 },
 GetFocusedElement: function(srcElement){
  return this.GetItemElement(srcElement, this.focusedItems, __aspxFocusedItemKind);
 },
 GetHoverElement: function(srcElement){
  return this.GetItemElement(srcElement, this.hoverItems, __aspxHoverItemKind);
 },
 GetPressedElement: function(srcElement){
  return this.GetItemElement(srcElement, this.pressedItems, __aspxPressedItemKind);
 },
 GetSelectedElement: function(srcElement){
  return this.GetItemElement(srcElement, this.selectedItems, __aspxSelectedItemKind);
 },
 GetDisabledElement: function(srcElement){
  return this.GetItemElement(srcElement, this.disabledItems, __aspxDisabledItemKind);
 },
 GetItemElement: function(srcElement, items, kind){
  if(_aspxIsExists(srcElement) && _aspxIsExists(srcElement["cached" + kind])){
   var cachedElement = srcElement["cached" + kind];
   if(cachedElement != __aspxEmptyCachedValue)
    return cachedElement;
   return null;
  }
  var element = srcElement;
  while(element != null) {
   var item = items[element.id];
   if(_aspxIsExists(item)){
    this.CacheItemElement(srcElement, kind, element);
    element[kind] = item;
    return element;
   }
   element = element.parentNode;
  }
  this.CacheItemElement(srcElement, kind, __aspxEmptyCachedValue);
  return null;
 },
 CacheItemElement: function(srcElement, kind, value){
  if(_aspxIsExists(srcElement) && !_aspxIsExists(srcElement["cached" + kind]))
   srcElement["cached" + kind] = value;
 },
 DoSetFocusedState: function(element, fromElement){
  var item = element[__aspxFocusedItemKind];
  if(_aspxIsExists(item)){
   var args = new ASPxClientStateEventArgs(item, element);
   args.fromElement = fromElement;
   this.BeforeSetFocusedState.FireEvent(this, args);
   item.Apply(element);
   this.AfterSetFocusedState.FireEvent(this, args);
  }
 },
 DoClearFocusedState: function(element, toElement){
  var item = element[__aspxFocusedItemKind];
  if(_aspxIsExists(item)){
   var args = new ASPxClientStateEventArgs(item, element);
   args.toElement = toElement;
   this.BeforeClearFocusedState.FireEvent(this, args);
   item.Cancel(element);
   this.AfterClearFocusedState.FireEvent(this, args);
  }
 },
 DoSetHoverState: function(element, fromElement){
  var item = element[__aspxHoverItemKind];
  if(_aspxIsExists(item)){
   var args = new ASPxClientStateEventArgs(item, element);
   args.fromElement = fromElement;
   this.BeforeSetHoverState.FireEvent(this, args);
   item.Apply(element);
   this.AfterSetHoverState.FireEvent(this, args);
  }
 },
 DoClearHoverState: function(element, toElement){
  var item = element[__aspxHoverItemKind];
  if(_aspxIsExists(item)){
   var args = new ASPxClientStateEventArgs(item, element);
   args.toElement = toElement;
   this.BeforeClearHoverState.FireEvent(this, args);
   item.Cancel(element);
   this.AfterClearHoverState.FireEvent(this, args);
  }
 },
 DoSetPressedState: function(element){
  var item = element[__aspxPressedItemKind];
  if(_aspxIsExists(item)){
   var args = new ASPxClientStateEventArgs(item, element);
   this.BeforeSetPressedState.FireEvent(this, args);
   item.Apply(element);
   this.AfterSetPressedState.FireEvent(this, args);
  }
 },
 DoClearPressedState: function(element){
  var item = element[__aspxPressedItemKind];
  if(_aspxIsExists(item)){
   var args = new ASPxClientStateEventArgs(item, element);
   this.BeforeClearPressedState.FireEvent(this, args);
   item.Cancel(element);
   this.AfterClearPressedState.FireEvent(this, args);
  }
 },
 SetCurrentFocusedElement: function(element){
  if(_aspxIsExists(this.currentFocusedElement) && !_aspxIsValidElement(this.currentFocusedElement)){
   this.currentFocusedElement = null;
   this.currentFocusedItemName = "";
  }
  if(this.currentFocusedElement != element){
   var oldCurrentFocusedElement = this.currentFocusedElement;
   var item = (element != null) ? element[__aspxFocusedItemKind] : null;
   var itemName = (item != null) ? item.name : "";
   if(this.currentFocusedItemName != itemName){
    if(this.currentHoverItemName != "")
     this.SetCurrentHoverElement(null);
    if(this.currentFocusedElement != null)
     this.DoClearFocusedState(this.currentFocusedElement, element);
    this.currentFocusedElement = element;
    item = (element != null) ? element[__aspxFocusedItemKind] : null;
    this.currentFocusedItemName = (item != null) ? item.name : "";
    if(this.currentFocusedElement != null)
     this.DoSetFocusedState(this.currentFocusedElement, oldCurrentFocusedElement);
   }
  }
 },
 SetCurrentHoverElement: function(element){
  if(_aspxIsExists(this.currentHoverElement) && !_aspxIsValidElement(this.currentHoverElement)){
   this.currentHoverElement = null;
   this.currentHoverItemName = "";
  }
  if(this.currentHoverElement != element){
   var oldCurrentHoverElement = this.currentHoverElement;
   var item = (element != null) ? element[__aspxHoverItemKind] : null;
   var itemName = (item != null) ? item.name : "";
   if(this.currentHoverItemName != itemName || (item != null && item.needRefreshBetweenElements)){
    if(this.currentFocusedItemName != "")
     this.SetCurrentFocusedElement(null);
    if(this.currentHoverElement != null)
     this.DoClearHoverState(this.currentHoverElement, element);
    this.currentHoverElement = element;
    item = (element != null) ? element[__aspxHoverItemKind] : null;
    this.currentHoverItemName = (item != null) ? item.name : "";
    if(this.currentHoverElement != null)
     this.DoSetHoverState(this.currentHoverElement, oldCurrentHoverElement);
   }
  }
 },
 SetCurrentPressedElement: function(element){
  if(_aspxIsExists(this.currentPressedElement) && !_aspxIsValidElement(this.currentPressedElement)){
   this.currentPressedElement = null;
   this.currentPressedItemName = "";
  }
  if(this.currentPressedElement != element){
   if(this.currentPressedElement != null)
    this.DoClearPressedState(this.currentPressedElement);
   this.currentPressedElement = element;
   var item = (element != null) ? element[__aspxPressedItemKind] : null;
   this.currentPressedItemName = (item != null) ? item.name : "";
   if(this.currentPressedElement != null)
    this.DoSetPressedState(this.currentPressedElement);
  }
 },
 SetCurrentFocusedElementBySrcElement: function(srcElement){
  var element = this.GetFocusedElement(srcElement);
  this.SetCurrentFocusedElement(element);
 },
 SetCurrentHoverElementBySrcElement: function(srcElement){
  var element = this.GetHoverElement(srcElement);
  this.SetCurrentHoverElement(element);
 },
 SetCurrentPressedElementBySrcElement: function(srcElement){
  var element = this.GetPressedElement(srcElement);
  this.SetCurrentPressedElement(element);
 },
 SelectElement: function(element){
  var item = element[__aspxSelectedItemKind];
  if(_aspxIsExists(item))
   item.Apply(element);
 }, 
 SelectElementBySrcElement: function(srcElement){
  var element = this.GetSelectedElement(srcElement);
  if(element != null) this.SelectElement(element);
 }, 
 DeselectElement: function(element){
  var item = element[__aspxSelectedItemKind];
  if(_aspxIsExists(item))
   item.Cancel(element);
 }, 
 DeselectElementBySrcElement: function(srcElement){
  var element = this.GetSelectedElement(srcElement);
  if(element != null) this.DeselectElement(element);
 },
 SetElementEnabled: function(element, enable){
  if(enable)
   this.EnableElement(element);
  else
   this.DisableElement(element);
 },
 DisableElement: function(element){
  var element = this.GetDisabledElement(element);
  if(element != null) {
   var item = element[__aspxDisabledItemKind];
   if(_aspxIsExists(item)){
    var args = new ASPxClientStateEventArgs(item, element);
    this.BeforeDisabled.FireEvent(this, args);
    if(item.name == this.currentPressedItemName)
     this.SetCurrentPressedElement(null);
    if(item.name == this.currentHoverItemName)
     this.SetCurrentHoverElement(null);
    item.Apply(element);
    this.SetMouseStateItemsEnabled(item.name, item.postfixes, false);
    this.AfterDisabled.FireEvent(this, args);
   }
  }
 }, 
 EnableElement: function(element){
  var element = this.GetDisabledElement(element);
  if(element != null) {
   var item = element[__aspxDisabledItemKind];
   if(_aspxIsExists(item)){
    var args = new ASPxClientStateEventArgs(item, element);
    this.BeforeEnabled.FireEvent(this, args);
    item.Cancel(element);
    this.SetMouseStateItemsEnabled(item.name, item.postfixes, true);
    this.AfterEnabled.FireEvent(this, args);
   }
  }
 }, 
 SetMouseStateItemsEnabled: function(name, postfixes, enabled){   
  if(_aspxIsExists(postfixes) && postfixes.length > 0){
   for(var i = 0; i < postfixes.length; i ++){
    this.SetItemsEnabled(this.hoverItems, name + postfixes[i], enabled);
    this.SetItemsEnabled(this.pressedItems, name + postfixes[i], enabled);
   }
  }
  else{
   this.SetItemsEnabled(this.hoverItems, name, enabled);
   this.SetItemsEnabled(this.pressedItems, name, enabled);
  }  
 },
 SetItemsEnabled: function(items, name, enabled){   
  if(_aspxIsExists(items[name])) items[name].enabled = enabled;
 },
 OnFocusMove: function(evt){
  var element = _aspxGetEventSource(evt);
  aspxGetStateController().SetCurrentFocusedElementBySrcElement(element);
 },
 OnMouseMove: function(evt, checkElementChanged){
  var srcElement = _aspxGetEventSource(evt);
  if(checkElementChanged && srcElement == this.savedCurrentMouseMoveSrcElement) return;
  this.savedCurrentMouseMoveSrcElement = srcElement;
  if(__aspxIE && !_aspxGetIsLeftButtonPressed(evt) && this.savedCurrentPressedElement != null)
   this.ClearSavedCurrentPressedElement();
  if(this.savedCurrentPressedElement == null)
   this.SetCurrentHoverElementBySrcElement(srcElement);
  else {
   var element = this.GetPressedElement(srcElement);
   if(element != this.currentPressedElement){
    if(element == this.savedCurrentPressedElement)
     this.SetCurrentPressedElement(this.savedCurrentPressedElement);
    else
     this.SetCurrentPressedElement(null);
   }
  }
 },
 OnMouseDown: function(evt){
  if(!_aspxGetIsLeftButtonPressed(evt)) return;
  var srcElement = _aspxGetEventSource(evt);
  this.OnMouseDownOnElement(srcElement);
 },
 OnMouseDownOnElement: function(element){
  if(this.GetPressedElement(element) == null) return;
  this.SetCurrentHoverElement(null);
  this.SetCurrentPressedElementBySrcElement(element);
  this.savedCurrentPressedElement = this.currentPressedElement;
 },
 OnMouseUp: function(evt){
  var srcElement = _aspxGetEventSource(evt);
  this.OnMouseUpOnElement(srcElement);
 },
 OnMouseUpOnElement: function(element){
  if(this.savedCurrentPressedElement == null) return;
  this.ClearSavedCurrentPressedElement();
  this.SetCurrentHoverElementBySrcElement(element);
 },
 OnMouseOver: function(evt){
  var element = _aspxGetEventSource(evt);
  if (_aspxIsExists(element) && element.tagName == "IFRAME")
   this.OnMouseMove(evt, true);
 },
 OnKeyDown: function(evt){
  var element = this.GetFocusedElement(_aspxGetEventSource(evt));
  if(element != null && element == this.currentFocusedElement) {
   var item = element[__aspxFocusedItemKind];
   if(_aspxIsExists(item)){
    var args = new ASPxClientStateEventArgs(item, element);
    args.htmlEvent = evt;
    this.FocusedItemKeyDown.FireEvent(this, args);
   }
  }
 },
 OnSelectStart: function(evt){
  if ((this.savedCurrentPressedElement != null) && 
   (!_aspxIsExists(this.savedCurrentPressedElement.needClearSelection)))  {
   _aspxClearSelection();
   return false;
  }
 },
 ClearSavedCurrentPressedElement: function() {
  this.savedCurrentPressedElement = null;
  this.SetCurrentPressedElement(null);
 }
});
var __aspxStateController = null;
function aspxGetStateController(){
 if(__aspxStateController == null)
  __aspxStateController = new ASPxStateController();
 return __aspxStateController;
}
function aspxAddStateItems(method, namePrefix, classes){
 for(var i = 0; i < classes.length; i ++){
  for(var j = 0; j < classes[i][2].length; j ++) {
   var name = namePrefix;
   if(_aspxIsExists(classes[i][2][j]) && classes[i][2][j] != "")
    name += "_" + classes[i][2][j];
   var postfixes = _aspxIsExists(classes[i][3]) ? classes[i][3] : null;
   var imageUrls = _aspxIsExists(classes[i][4]) && _aspxIsExists(classes[i][4][j]) ? classes[i][4][j] : null;
   var imagePostfixes =  _aspxIsExists(classes[i][5]) ? classes[i][5] : null;
   method.call(aspxGetStateController(), name, classes[i][0], classes[i][1], postfixes, imageUrls, imagePostfixes);
  }
 }
}
function aspxAddHoverItems(namePrefix, classes){
 aspxAddStateItems(aspxGetStateController().AddHoverItem, namePrefix, classes);
}
function aspxAddPressedItems(namePrefix, classes){
 aspxAddStateItems(aspxGetStateController().AddPressedItem, namePrefix, classes);
}
function aspxAddSelectedItems(namePrefix, classes){
 aspxAddStateItems(aspxGetStateController().AddSelectedItem, namePrefix, classes);
}
function aspxAddDisabledItems(namePrefix, classes){
 aspxAddStateItems(aspxGetStateController().AddDisabledItem, namePrefix, classes);
}
function aspxAddAfterClearFocusedState(handler){
 aspxGetStateController().AfterClearFocusedState.AddHandler(handler);
}
function aspxAddAfterSetFocusedState(handler){
 aspxGetStateController().AfterSetFocusedState.AddHandler(handler);
}
function aspxAddAfterClearHoverState(handler){
 aspxGetStateController().AfterClearHoverState.AddHandler(handler);
}
function aspxAddAfterSetHoverState(handler){
 aspxGetStateController().AfterSetHoverState.AddHandler(handler);
}
function aspxAddAfterClearPressedState(handler){
 aspxGetStateController().AfterClearPressedState.AddHandler(handler);
}
function aspxAddAfterSetPressedState(handler){
 aspxGetStateController().AfterSetPressedState.AddHandler(handler);
}
function aspxAddAfterDisabled(handler){
 aspxGetStateController().AfterDisabled.AddHandler(handler);
}
function aspxAddAfterEnabled(handler){
 aspxGetStateController().AfterEnabled.AddHandler(handler);
}
function aspxAddBeforeClearFocusedState(handler){
 aspxGetStateController().BeforeClearFocusedState.AddHandler(handler);
}
function aspxAddBeforeSetFocusedState(handler){
 aspxGetStateController().BeforeSetFocusedState.AddHandler(handler);
}
function aspxAddBeforeClearHoverState(handler){
 aspxGetStateController().BeforeClearHoverState.AddHandler(handler);
}
function aspxAddBeforeSetHoverState(handler){
 aspxGetStateController().BeforeSetHoverState.AddHandler(handler);
}
function aspxAddBeforeClearPressedState(handler){
 aspxGetStateController().BeforeClearPressedState.AddHandler(handler);
}
function aspxAddBeforeSetPressedState(handler){
 aspxGetStateController().BeforeSetPressedState.AddHandler(handler);
}
function aspxAddBeforeDisabled(handler){
 aspxGetStateController().BeforeDisabled.AddHandler(handler);
}
function aspxAddBeforeEnabled(handler){
 aspxGetStateController().BeforeEnabled.AddHandler(handler);
}
function aspxAddFocusedItemKeyDown(handler){
 aspxGetStateController().FocusedItemKeyDown.AddHandler(handler);
}
function aspxSetHoverState(element){
 aspxGetStateController().SetCurrentHoverElementBySrcElement(element);
}
function aspxClearHoverState(evt){
 aspxGetStateController().SetCurrentHoverElementBySrcElement(null);
}
function aspxUpdateHoverState(evt){
 aspxGetStateController().OnMouseMove(evt, false);
}
function aspxSetFocusedState(element){
 aspxGetStateController().SetCurrentFocusedElementBySrcElement(element);
}
function aspxClearFocusedState(evt){
 aspxGetStateController().SetCurrentFocusedElementBySrcElement(null);
}
function aspxUpdateFocusedState(evt){
 aspxGetStateController().OnFocusMove(evt);
}
_aspxAttachEventToElement(window, "load", aspxClassesWindowOnLoad);
function aspxClassesWindowOnLoad(evt){
 __aspxDocumentLoaded = true;
 ASPxResourceManager.SynchronizeResources(false);
 aspxGetControlCollection().Initialize();
 _aspxInitializeScripts();
 _aspxInitializeLinks();
}
_aspxAttachEventToDocument("mousemove", aspxClassesDocumentMouseMove);
function aspxClassesDocumentMouseMove(evt){
 if(__aspxClassesScriptParsed && __aspxStateItemsExist)
  aspxGetStateController().OnMouseMove(evt, true);
}
_aspxAttachEventToDocument("mousedown", aspxClassesDocumentMouseDown);
function aspxClassesDocumentMouseDown(evt){
 if(__aspxClassesScriptParsed && __aspxStateItemsExist)
  aspxGetStateController().OnMouseDown(evt);
}
_aspxAttachEventToDocument("mouseup", aspxClassesDocumentMouseUp);
function aspxClassesDocumentMouseUp(evt){
 if(__aspxClassesScriptParsed && __aspxStateItemsExist)
  aspxGetStateController().OnMouseUp(evt);
}
_aspxAttachEventToDocument("mouseover", aspxClassesDocumentMouseOver);
function aspxClassesDocumentMouseOver(evt){
 if(__aspxClassesScriptParsed && __aspxStateItemsExist)
  aspxGetStateController().OnMouseOver(evt);
}
_aspxAttachEventToDocument("keydown", aspxClassesDocumentKeyDown);
function aspxClassesDocumentKeyDown(evt){
 if(__aspxClassesScriptParsed && __aspxStateItemsExist)
  aspxGetStateController().OnKeyDown(evt);
}
_aspxAttachEventToDocument("selectstart", aspxClassesDocumentSelectStart);
function aspxClassesDocumentSelectStart(evt){
 if(__aspxClassesScriptParsed && __aspxStateItemsExist)
  return aspxGetStateController().OnSelectStart(evt); 
}
_aspxAttachEventToElement(window, "resize", aspxPopupControlWindowResize);
function aspxPopupControlWindowResize(evt){
 aspxGetControlCollection().OnBrowserWindowResize(evt); 
}
function aspxFireDefaultButton(evt, buttonID) {
 if(_aspxIsDefaultButtonEvent(evt, buttonID)) {
  var defaultButton = _aspxGetElementById(buttonID);
  if(_aspxIsExists(defaultButton) && _aspxIsExists(defaultButton.click)) {
   if(_aspxIsFocusable(defaultButton))
    defaultButton.focus();
   defaultButton.click();
   _aspxPreventEventAndBubble(evt);
   return false;
  }
 }
 return true;
}
function _aspxIsDefaultButtonEvent(evt, defaultButtonID) {
 if(evt.keyCode != ASPxKey.Enter)
  return false;
 var srcElement = _aspxGetEventSource(evt);
 if(!_aspxIsExists(srcElement) || srcElement.id === defaultButtonID)
  return true;
 var tagName = srcElement.tagName;
 var type = srcElement.type;
 return tagName != "TEXTAREA" && tagName != "BUTTON" && tagName != "A" &&
  (tagName != "INPUT" || type != "checkbox" && type != "radio" && type != "button" && type != "submit" && type != "reset");
}
ASPxResourceManager = {
 HandlerStr: "DXR.axd?r=",
 InputElements: {},
 SynchronizeResources: function(isCallback){
  this.SynchronizeResourcesElements(_aspxGetIncludeScripts(), "src", "DXScript");
 },
 SynchronizeResourcesElements: function(elements, urlAttr, id){
  var hash = {};
  for(var i = 0; i < elements.length; i++) {
   var resourceUrl = _aspxGetAttribute(elements[i], urlAttr);
   if(_aspxIsExists(resourceUrl)){
    var pos = resourceUrl.indexOf(this.HandlerStr);
    if(pos > -1){
     var list = resourceUrl.substr(pos + this.HandlerStr.length);
     var indexes = list.split(",");
     for(var j = 0; j < indexes.length; j++)
      hash[indexes[j]] = indexes[j];
    }
    else
     hash[resourceUrl] = resourceUrl;
   }
  }
  var array = [];
  for(var key in hash) 
   array.push(key);
  this.UpdateInputElement(id, array.join(","));
 },
 UpdateInputElement: function(typeName, list){
  var inputElement = this.InputElements[typeName];
  if(!_aspxIsExistsElement(inputElement)){
   inputElement = this.CreateInputElement(typeName);
   this.InputElements[typeName] = inputElement;
  }
  if(_aspxIsExistsElement(inputElement))
   inputElement.value = list;
 },
 CreateInputElement: function(typeName){
  var inputElement = _aspxCreateHiddenField(typeName);
  var form = _aspxGetServerForm();
  if(_aspxIsExists(form)){
   form.appendChild(inputElement);
   return inputElement;
  }
  return null;
 }
};
var __aspxIncludeScriptPrefix = "dxis_";
var __aspxStartupScriptPrefix = "dxss_";
var __aspxIncludeScriptsCache = {};
var __aspxCreatedIncludeScripts;
var __aspxAppendedScriptsCount;
var __aspxScriptsRestartHandlers = { };
function _aspxGetScriptCode(script) {
 var text = __aspxWebKitFamily ? script.firstChild.data : script.text;
 var comment = "<!--";
 var pos = text.indexOf(comment);
 if(pos > -1)
  text = text.substr(pos + comment.length);
 return text;
}
function _aspxAppendScript(script) {
 var parent = document.getElementsByTagName("head")[0];
 if(!_aspxIsExists(parent))
  parent = document.body;  
 if(_aspxIsExists(parent)) {
  parent.appendChild(script);
 }  
}
function _aspxIsAlphaFilterUsed(img){
 return (__aspxIE && img.style.filter.indexOf("progid:DXImageTransform.Microsoft.AlphaImageLoader") > -1);
}
function _aspxIsKnownIncludeScript(script) {
 return _aspxIsExists(__aspxIncludeScriptsCache[script.src]);
}
function _aspxCacheIncludeScript(script) {
 __aspxIncludeScriptsCache[script.src] = 1;
}
function _aspxProcessScriptsAndLinks(ownerName, isCallback) {
 if(!__aspxDocumentLoaded) return; 
 _aspxProcessScripts(ownerName, isCallback);
 _aspxSweepDuplicatedLinks();
 _aspxMoveLinkElements();
 __aspxCachedRules = { };
}
function _aspxGetStartupScripts() {
 return _aspxGetScriptsCore(__aspxStartupScriptPrefix);
}
function _aspxGetIncludeScripts() {
 return _aspxGetScriptsCore(__aspxIncludeScriptPrefix);
}
function _aspxGetScriptsCore(prefix) {
 var result = [];
 var scripts = document.getElementsByTagName("SCRIPT");
 for(var i = 0; i < scripts.length; i++) {
  if (scripts[i].id.indexOf(prefix) == 0)
   result.push(scripts[i]);
 }
 return result;
}
function _aspxGetLinks() {
 var result = [];
 var links = document.getElementsByTagName("LINK");;
 for(var i = 0; i < links.length; i++) 
  result[i] = links[i];
 return result;
}
function _aspxInitializeLinks() {
 var links = _aspxGetLinks();
 for(var i = 0; i < links.length; i++)
  links[i].loaded = true; 
}
function _aspxInitializeScripts() {
 var scripts = _aspxGetIncludeScripts();
 for(var i = 0; i < scripts.length; i++)
  _aspxCacheIncludeScript(scripts[i]);   
 var startupScripts = _aspxGetStartupScripts();
 for(var i = 0; i < startupScripts.length; i++)
  startupScripts[i].executed = true; 
}
function _aspxSweepDuplicatedLinks() {
 if(__aspxIE && __aspxBrowserVersion < 7)
  return;
 var hash = { };
 var links = _aspxGetLinks();
 for(var i = 0; i < links.length; i++) {
  var href = links[i].href;
  if(!_aspxIsExists(href) || href == "")
   continue;
  if(_aspxIsExists(hash[href])){
   if(!hash[href].loaded && links[i].loaded){
    _aspxRemoveElement(hash[href]);
    hash[href] = links[i];
   }
   else
    _aspxRemoveElement(links[i]);
  }
  else
   hash[href] = links[i];
 }
}
function _aspxSweepDuplicatedScripts() {
 var hash = { };
 var scripts = _aspxGetIncludeScripts();
 for(var i = 0; i < scripts.length; i++) {
  var src = scripts[i].src;
  if(!_aspxIsExists(src) || src == "") continue;
  if(_aspxIsExists(hash[src]))
   _aspxRemoveElement(scripts[i]);
  else
   hash[src] = scripts[i];
 }
}
function _aspxProcessScripts(ownerName, isCallback) {
 __aspxCreatedIncludeScripts = [];
 __aspxAppendedScriptsCount = 0;
 var scripts = _aspxGetIncludeScripts();
 var scriptsLoading = false;
 var previousCreatedScript = null;
 var firstCreatedScript = null;
 for(var i = 0; i < scripts.length; i++) {
  var script = scripts[i];
  if(script.src == "") continue; 
  if(_aspxIsKnownIncludeScript(script))
   continue;
  scriptsLoading = true;
  var createdScript = document.createElement("script");
  __aspxCreatedIncludeScripts.push(createdScript);
  createdScript.type = "text/javascript";
  createdScript.src = script.src;
  createdScript.id = script.id;
  if (_aspxIsExists(script.parentElement))
   script.parentElement.removeChild(script);
  if(__aspxIE) {
   createdScript.onreadystatechange = new Function("_aspxOnScriptReadyStateChangedCallback(this, \"" + ownerName + "\");");
  } else if(__aspxWebKitFamily) {
   createdScript.onload = new Function("_aspxOnScriptLoadCallback(this, \"" + ownerName + "\");");
   if(firstCreatedScript == null)
    firstCreatedScript = createdScript;
   createdScript.nextCreatedScript = null;
   if(previousCreatedScript != null)
    previousCreatedScript.nextCreatedScript = createdScript;
   previousCreatedScript = createdScript;
  } else {
   createdScript.onload = new Function("_aspxOnScriptLoadCallback(this, \"" + ownerName + "\");");
   _aspxAppendScript(createdScript);
   _aspxCacheIncludeScript(createdScript);
  }
 }
 if(firstCreatedScript != null) {
  _aspxAppendScript(firstCreatedScript);
  _aspxCacheIncludeScript(firstCreatedScript);
 }
 if(!scriptsLoading)
  _aspxFinalizeScriptProcessing(ownerName, isCallback);
}
function _aspxFinalizeScriptProcessing(ownerName, isCallback) {
 _aspxSweepDuplicatedScripts();
 _aspxRunStartupScripts(isCallback);
 ASPxResourceManager.SynchronizeResources(true);
 var owner = aspxGetControlCollection().Get(ownerName);
 if(owner != null)
  owner.DoEndCallback();
}
function _aspxRunStartupScripts(isCallback) {
 var scripts = _aspxGetStartupScripts();
 var code;
 for(var i = 0; i < scripts.length; i++){
  if(!scripts[i].executed) {
   code = _aspxGetScriptCode(scripts[i]);
   eval(code);
   scripts[i].executed = true;
  }
 }
 if(__aspxDocumentLoaded) 
  aspxGetControlCollection().InitializeElements(isCallback);
 for(var key in __aspxScriptsRestartHandlers)
  __aspxScriptsRestartHandlers[key]();
}
function _aspxOnScriptReadyStateChangedCallback(scriptElement, ownerName) {
 if(scriptElement.readyState == "loaded") {
  _aspxCacheIncludeScript(scriptElement);
  for(var i = 0; i < __aspxCreatedIncludeScripts.length; i++) {
   var script = __aspxCreatedIncludeScripts[i];
   if(_aspxIsKnownIncludeScript(script)) {
    if(!script.executed) {
     script.executed = true;
     _aspxAppendScript(script);
     __aspxAppendedScriptsCount++;
    }
   } else
    break;
  }
  if(__aspxCreatedIncludeScripts.length == __aspxAppendedScriptsCount)
   _aspxFinalizeScriptProcessing(ownerName);
 }
}
function _aspxOnScriptLoadCallback(scriptElement, ownerName) {
 __aspxAppendedScriptsCount++;
 if(_aspxIsExists(scriptElement.nextCreatedScript)) {
  _aspxAppendScript(scriptElement.nextCreatedScript);
  _aspxCacheIncludeScript(scriptElement.nextCreatedScript);
 }
 if(__aspxCreatedIncludeScripts.length == __aspxAppendedScriptsCount)
  _aspxFinalizeScriptProcessing(ownerName);
}
function _aspxAddScriptsRestartHandler(objectName, handler) {
 __aspxScriptsRestartHandlers[objectName] = handler;
}
function _aspxMoveLinkElements() {
 if(__aspxIE)
  return;
 var head = _aspxGetElementsByTagName(document, "head")[0];
 var bodyLinks = _aspxGetElementsByTagName(document.body, "link");
 for(var i = 0; i < bodyLinks.length; i++)
  head.appendChild(bodyLinks[i]);
}
_aspxToJson = function(param){
 var paramType = typeof(param);
 if((paramType == "undefined") || (param == null))
  return null;
 if((paramType == "object") && (typeof(param.__toJson) == "function"))
  return param.__toJson();
 if((paramType == "number") || (paramType == "boolean"))
  return param;
 if(param.constructor == Date)
  return "\"" + _aspxGetInvariantDateTimeString(param) + "\"";
 if(paramType == "string"){
  var result = param.replace(/"/g, "\\\"");
  result = result.replace(/</g, "\\u003c");
  result = result.replace(/>/g, "\\u003e");
  return "\"" + result + "\"";
 }
 if(param.constructor == Array){
  var values = [];
  for(var i = 0; i < param.length; i++)
   values.push(_aspxToJson(param[i]));
  return "[" + values.join(",") + "]";
 }
 var exceptKeys = {};
 if(ASPxIdent.IsArray(param.__toJsonExceptKeys))
  exceptKeys = _aspxCreateHashTableFromArray(param.__toJsonExceptKeys);
 exceptKeys["__toJsonExceptKeys"] = 1;
 var values = [];
 for(var key in param){
  if(_aspxIsFunction(param[key]))
   continue;
  if(exceptKeys[key] == 1)
   continue;
  values.push(_aspxToJson(key) + ":" + _aspxToJson(param[key]));
 }
 return "{" + values.join(",") + "}";
}
__aspxClassesScriptParsed = true;
function _aspxEmulateDocumentOnMouseDown(evt) {
 if(__aspxIE)
  document.fireEvent("onmousedown", evt);
 else if(!__aspxWebKitFamily){
  var emulatedEvt = document.createEvent("MouseEvents");
  emulatedEvt.initMouseEvent("mousedown", true, true, window, 0, evt.screenX, evt.screenY, 
   evt.clientX, evt.clientX, evt.ctrlKey, evt.altKey, evt.shiftKey, false, 0, null);
  document.dispatchEvent(emulatedEvt);
 }
} 
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 = {
 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.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();
 },
 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()) : "");
  }
 },
 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();
  this.GetInputElement().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.focused)
    return;
  }
  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.GetExternalTable())) {
   this.BeginErrorFrameUpdate();
   try {
    this.SetIsValid(true);
    this.SetErrorText(this.initialErrorText);
    if(this.validateOnLeave || validationType != ASPxValidationType.PersonalOnValueChanged) {
     this.ValidateWithPatterns();
     this.RaiseValidation();
    }
    this.UpdateErrorFrameAndFocus(validationType == ASPxValidationType.PersonalOnValueChanged && this.validateOnLeave && !this.GetIsValid());
   } finally {
    this.EndErrorFrameUpdate();
   }
  }
 },
 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 (_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(typeof(isValid) == "undefined")
   isValid = this.GetIsValid();
  var externalTable = this.GetExternalTable();
  var isStaticDisplay = this.display == ASPxErrorFrameDisplay.Static;
  if(isValid) {
   if(isStaticDisplay) {
    externalTable.style.visibility = "hidden";
   } else {
    this.HideErrorCell();
    this.SaveErrorFrameStyles();
    this.ClearErrorFrameElementsStyles();
   }
  } else {
   var editorLocatedWithinVisibleContainer = this.IsVisible();
   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(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 savedVisibility = element.style.visibility;
  var savedDisplay = element.style.display;
  var savedWidth = element.style.width;
  element.style.cssText = "";
  element.style.visibility = savedVisibility;
  element.style.display = savedDisplay;
  element.style.width = savedWidth;
 },
 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);
     this.SetErrorText(validator.errorText);
     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);
   this.SetIsValid(args.isValid);
   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(){
  var externalTable = this.GetExternalTable();
  return _aspxIsExistsElement(externalTable) ? this.isValid : true;
 },
 GetErrorText: function(){
  return this.errorText;
 },
 SetIsValid: function(isValid){
  if (this.customValidationEnabled) {
   this.isValid = isValid;
   this.UpdateErrorFrameAndFocus(false );
   this.UpdateClientValidationState();
  }
 },
 SetErrorText: function(errorText){
  if (this.customValidationEnabled) {
   this.errorText = errorText;
   this.UpdateErrorFrameAndFocus(false );
   this.UpdateClientValidationState();
  }
 },
 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 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);
 }
 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);
}
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 = { };
 },
 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] = _aspxTrim(className + " " + _aspxCreateImportantStyleRule(this.GetStyleSheet(), cssText));
 },
 Update: function() {
  for(var i = 0; i < this.postfixList.length; i++) {
   var postfix = this.postfixList[i];
   var element = _aspxGetElementById(this.editor.name + postfix);
   if(!element) continue;
   if(this.HasDecoration("F"))
    this.ApplyDecoration("F", element, 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, apply);
   }
  }   
 },
 HasDecoration: function(key) {
  return !!this.styles[key];
 },
 ApplyDecoration: function(key, element, active) {
  var value = this.styles[key];
  element.className = element.className.replace(value, "");
  if(active)
   element.className = _aspxTrim(element.className + " " + value);
 }
});
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();
 if (editor != null && editor.IsEditorElement(_aspxGetEventSource(evt)))
  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;
 var collection = aspxGetControlCollection();
 for (var key in collection.elements) {
  var control = collection.elements[key];
  if (control != null && 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;
    }
   }
  }
 }
 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 _aspxClearProcessingProc(edit) {
 edit.SetValue(null);
 edit.SetIsValid(true);
 return true;
}
function _aspxValidateProcessingProc(edit) {
 edit.OnValidation(ASPxValidationType.MassValidation);
 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);
 },
 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");
 }
});
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);
 },
 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.emptyImageWidth = "";
  this.emptyImageHeight = "";
  this.imageAlt = "";
  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);
    else
     this.ApplyImageProperties(image, value, this.imageWidth, this.imageHeight, this.imageAlt);
   }
   else
    ASPxImageUtils.SetImageSrc(image, value);
  }
 },
 ApplyImageProperties: function(imageElement, url, width, height, alt){
  ASPxImageUtils.SetImageSrc(imageElement, url);
  imageElement.style.width = width;
  imageElement.style.height = height;
  imageElement.alt = alt;
 },
 GetImageUrl: function(url){
  return this.GetValue();
 },
 SetImageUrl: function(url){
  this.SetValue(url);
 }
});
ASPxClientBinaryImage = _aspxCreateClass(ASPxClientImageBase, {
 constructor: function(name) {
  this.constructor.prototype.constructor.call(this, name);
 },
 GetValue: function() {
  return "";
 },
 SetValue: function(value) {
 }
});
ASPxClientLabel = _aspxCreateClass(ASPxClientStaticEdit, {
 constructor: function(name) {
  this.constructor.prototype.constructor.call(this, name);          
 },
 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");
 }
});
function aspxSEClick(name, evt){
 var edit = aspxGetControlCollection().Get(name);
 if(edit != null) 
  edit.OnClick(evt);
}
var __aspxDialogFormCallbackStatus = "DialogForm";
var __aspxCurrentControlNameInDialog = "";
var __aspxAreKeyboardEventsInitialized = false;
function aspxAdjustControlsSizeInDialogWindow() {
 var control = aspxGetControlCollection().Get(__aspxCurrentControlNameInDialog); 
 var curDialog = control != null ? ASPxDialog.GetLastDialog(control) : null;
 if (curDialog != null)
  ASPxClientControl.GetControlCollection().AdjustControls(curDialog.GetDialogPopup().GetMainElement());
}
ASPxDialog = _aspxCreateClass(null, {
 constructor: function(name) {
  this.name = name;
  this.initInfo = null;  
  this.editorKeyDownProccesed = false;
  this.keyDownHandlers = {};
  this.InitializeKeyHandlers();
 },
 InitializeKeyHandlers: function() {
  this.AddKeyDownHandler("ESC", "HideDialog");
 },
 AddKeyDownHandler: function(shortcutString, handler) {
  this.keyDownHandlers[_aspxParseShortcutString(shortcutString)] = handler;
 },
 DoCustomAction: function(result, params) {
 },
 GetDialogCaptionText: function() {
  return "";
 },
 GetInitInfoObject: function() {
  return null;
 },
 InitializeDialogFields: function(initInfo) {
 },
 SetFocusInField: function() {
 },
 Execute: function(ownerControl, popupElementID) {
  this.ownerControl = ownerControl;
  __aspxCurrentControlNameInDialog = this.ownerControl.name;
  ASPxDialog.PushDialogToCollection(this.ownerControl, this);
  this.InitializePopupEvents();
  this.GetDialogPopup().SetHeaderText(this.GetDialogCaptionText());  
  if (_aspxIsExists(popupElementID))
   this.GetDialogPopup().ShowAtElementByID(popupElementID);
  else
   this.GetDialogPopup().Show();
  if (this.GetDialogContent(this.name) == null) {
   this.SendCallbackForDialogContent();
   this.ShowLoadingPanelInDialogPopup();
  }
  else {
   this.ExecuteInternal(this.GetDialogContent(this.name));
   _aspxRunStartupScripts();
   this.OnInitComplete();
  }
 },
 ExecuteInternal: function(result) {
  this.initInfo = this.GetInitInfoObject();
  this.GetDialogPopup().SetContentHtml(result);
  if (this.GetDialogPopup().IsVisible())
   this.GetDialogPopup().UpdatePosition();
 },
 GetDialogPopup: function() {
  if (_aspxIsExists(this.ownerControl.GetDialogPopupControl))
   return this.ownerControl.GetDialogPopupControl();
  return null;
 },
 AddDialogContentToHash: function(name, content) {
  this.GetDialogContentHashTable()[this.name] = content;
 },
 GetDialogContent: function(name) { 
  return _aspxIsExists(this.GetDialogContentHashTable()[this.name]) ? 
     this.GetDialogContentHashTable()[this.name] : null;
 },
 GetDialogContentHashTable: function() {
  if (_aspxIsExists(this.ownerControl.dialogContentHashTable))
   return this.ownerControl.dialogContentHashTable;
  return null;
 },
 InitializePopupEvents: function() {
  if (this.GetDialogPopup().CloseButtonClick.IsEmpty()) {
   var func = _aspxCreateEventHandlerFunction("aspxOnDialogCloseButtonClick", this.ownerControl.name, false);
   this.GetDialogPopup().CloseButtonClick.AddHandler(func);
   func = _aspxCreateEventHandlerFunction("aspxOnDialogClose", this.ownerControl.name, false);
   this.GetDialogPopup().CloseUp.AddHandler(func);
  }
 },
 InitCustomKeyboardHandling: function() {
  if (!__aspxAreKeyboardEventsInitialized) {
   __aspxAreKeyboardEventsInitialized = true;      
   _aspxAttachEventToDocument(__aspxWebKitFamily ? "keydown" : "keypress", aspxDialogDocumentKeypress);
   if (__aspxNetscapeFamily)
    this.ReplaceKBSIKeyDown();
  }
 },
 ReplaceKBSIKeyDown: function() { 
  var original = aspxKBSIKeyDown;
  aspxKBSIKeyDown = function(name, evt) {
   var isProcessed = original(name, evt);
   var ownerControl = aspxGetControlCollection().Get(__aspxCurrentControlNameInDialog);
   var curDialog = ownerControl != null ? ASPxDialog.GetLastDialog(ownerControl) : null;
   if (curDialog != null) curDialog.OnInnerEditorKeyDown(evt, isProcessed);
   return isProcessed;
  };
 },
 SendCallbackForDialogContent: function() {
  this.ownerControl.callbackOwner = this;
  this.ownerControl.SendCallback(__aspxDialogFormCallbackStatus, this.name, false);
 },
 ShowLoadingPanelInDialogPopup: function() {
  this.GetDialogPopup().SetContentHtml("");
  var contentElement = this.GetDialogPopup().GetWindowContentElement(-1);  
  this.ownerControl.CreateLoadingDiv(contentElement);
  this.ownerControl.CreateLoadingPanelInsideContainer(contentElement);
 },
 ShowLoadingPanelOverDialogPopup: function() {
  var offsetElement = _aspxGetParentByTagName(this.GetDialogPopup().GetWindowContentElement(-1), "table");
  this.ownerControl.CreateLoadingDiv(document.body, offsetElement);
  this.ownerControl.CreateLoadingPanelWithAbsolutePosition(document.body, offsetElement);
 },
 HideLoadingPanelOverDialogPopup: function() {
  this.ownerControl.HideLoadingDiv();
  this.ownerControl.HideLoadingPanel();
 }, 
 HideDialog: function() {
    this.GetDialogPopup().Hide();
    this.OnCloseButtonClick();
    this.OnClose();
 },
   OnCallback: function(result) {
  this.ExecuteInternal(result);
    this.AddDialogContentToHash(this.name, result);    
   },
 OnCallbackError: function(result, data) {
  this.ownerControl.callbackOwner = null;
 },
 OnEndCallback: function() {
  this.ownerControl.callbackOwner = null;
    this.OnInitComplete();
 },
 OnClose: function() {
  ASPxDialog.RemoveLastDialog(this.ownerControl);
 },
 OnCloseButtonClick: function() {
 },
   OnComplete: function(result, params) {
    this.GetDialogPopup().Hide();
  this.DoCustomAction(result, params);
   },
 OnDocumentKeyPress: function(evt) {
  if (!this.editorKeyDownProccesed) {
   var handler = this.keyDownHandlers[_aspxGetShortcutCode(evt.keyCode, evt.ctrlKey, evt.shiftKey, evt.altKey)];
   if(_aspxIsExists(handler))
    this[handler](evt);
  }
  this.editorKeyDownProccesed = false;
 },
 OnInnerEditorKeyDown: function(evt, isProcessed) {
  this.editorKeyDownProccesed = _aspxIsExists(isProcessed) ? !isProcessed : false;
 },
 OnInitComplete: function() {
  this.InitCustomKeyboardHandling();
  this.InitializeDialogFields(this.initInfo);
  this.SetFocusInField();
 }
});
ASPxDialog.PushDialogToCollection = function(ownerControl, dialog) {
 if (!_aspxIsExists(ownerControl.dialogArray))
  ownerControl.dialogArray = new Array();
 _aspxArrayPush(ownerControl.dialogArray, dialog);
}
ASPxDialog.GetLastDialog = function(ownerControl) {
 if (_aspxIsExists(ownerControl.dialogArray)) {
  var length = ownerControl.dialogArray.length;
  return length > 0 ? ownerControl.dialogArray[length - 1] : null;
 }
 return null;
}
ASPxDialog.RemoveLastDialog = function(ownerControl) {
 var array = ownerControl.dialogArray;
 if (_aspxIsExists(array) && array.length > 0)
  _aspxArrayRemoveAt(array, array.length - 1);
}
function aspxOnDialogCloseButtonClick(name) {
 var ownerControl = aspxGetControlCollection().Get(name);
 var curDialog = ownerControl != null ? ASPxDialog.GetLastDialog(ownerControl) : null;
 if (curDialog != null)
  return curDialog.OnCloseButtonClick();
}
function aspxOnDialogClose(name) {
 var ownerControl = aspxGetControlCollection().Get(name); 
 var curDialog = ownerControl != null ? ASPxDialog.GetLastDialog(ownerControl) : null;
 if (curDialog != null) 
  return curDialog.OnClose();
}
function aspxDialogComplete(result, params) {
 var ownerControl = aspxGetControlCollection().Get(__aspxCurrentControlNameInDialog);
 var curDialog = ownerControl != null ? ASPxDialog.GetLastDialog(ownerControl) : null;
 if (curDialog != null)
  return curDialog.OnComplete(result, params);
}
function aspxDialogDocumentKeypress(evt) {
 var ownerControl = aspxGetControlCollection().Get(__aspxCurrentControlNameInDialog);
 var curDialog = ownerControl != null ? ASPxDialog.GetLastDialog(ownerControl) : null;
 if (curDialog != null)
  ASPxDialog.GetLastDialog(ownerControl).OnDocumentKeyPress(evt);
}
ASPxClientPopupMenu = _aspxCreateClass(ASPxClientMenuBase, {
 constructor: function(name){
  this.constructor.prototype.constructor.call(this, name);
  this.popupAction = "RightMouseClick";
  this.popupElementID = "";
  this.popupElement = null;
  this.popupHorizontalOffset = 0;
  this.popupVerticalOffset = 0;
  this.popupHorizontalAlign = __aspxNotSetAlignIndicator;
  this.popupVerticalAlign = __aspxNotSetAlignIndicator;
  this.left = 0;
  this.top = 0;
  this.shadowHeight = 5;
  this.shadowWidth = 5;
 }, 
 Initialize: function(){
  this.GetPopupElement();
  ASPxClientMenuBase.prototype.Initialize.call(this);
 },
 GetPopupElement: function(){
  if(!_aspxIsExistsElement(this.popupElement)){
   this.popupElement = _aspxFindPopupElementById(this.popupElementID);
   if(_aspxIsExistsElement(this.popupElement)){
    this.popupElement.DXMenu = this;
    if(this.popupAction == "LeftMouseClick")
     _aspxAttachEventToElement(this.popupElement, "mouseup", aspxMEvent);
    else if(this.popupAction == "RightMouseClick")
     _aspxAttachEventToElement(this.popupElement, "contextmenu", aspxMEvent);
    else if(this.popupAction == "MouseOver"){
     _aspxAttachEventToElement(this.popupElement, "mouseover", aspxMEvent);
     _aspxAttachEventToElement(this.popupElement, "mouseout", aspxMEvent);
    }
    if (this.popupAction == "LeftMouseClick"){
     _aspxAttachEventToElement(this.popupElement, "mousedown", aspxMEvent);
     this.popupElement.isPopuped = false;
    }
   }
  }
  return this.popupElement;
 },
 IsMenuVisible: function(){
  var element = this.GetMainElement();
  return (element != null) ? _aspxGetElementDisplay(element) : false;
 },
 IsParentElementPositionStatic: function(indexPath){
  return false;
 },
 GetClientSubMenuPos: function(element, indexPath, pos, isXPos){
  if (indexPath == "") {
   var popupPosition = null;
   if (isXPos){
    popupPosition = _aspxGetPopupAbsoluteX(this.GetMenuMainCell(this.GetMainElement()),
     this.shadowWidth, this.GetPopupElement(), this.popupHorizontalAlign, this.popupHorizontalOffset, pos, this.left);
   }
   else{
    popupPosition = _aspxGetPopupAbsoluteY(this.GetMenuMainCell(this.GetMainElement()), 
     this.shadowHeight, this.GetPopupElement(), this.popupVerticalAlign, this.popupVerticalOffset, pos, this.top);
   }
   popupPosition.position -= _aspxGetPositionElementOffset(element, isXPos);
   return popupPosition;
  }
  return ASPxClientMenuBase.prototype.GetClientSubMenuPos.call(this, element, indexPath, pos, isXPos);
 },
 GetMenuElement: function(indexPath){
  if (indexPath == "")
   return this.mainElement;
  return ASPxClientMenuBase.prototype.GetMenuElement.call(this, indexPath);
 },
 OnItemOverTimer: function(indexPath){
  if(indexPath == ""){
   aspxGetMenuCollection().DoHidePopupMenus(null, -1, this.name, false, "");
   aspxGetMenuCollection().DoShowAtCurrentPos(this.name, indexPath);
  }
  else
   ASPxClientMenuBase.prototype.OnItemOverTimer.call(this, indexPath);
 },
 DoShow: function(x, y){
  var element = this.GetMainElement();
  if(element != null && !_aspxGetElementDisplay(element)){
   aspxGetMenuCollection().DoHidePopupMenus(null, -1, this.name, false, "");
   this.DoShowPopupMenu(element, x, y, "");
  }
 },
 DoShowByAPI: function(x, y){
  var enableAnimationBackup = this.enableAnimation;
  this.enableAnimation = false;
  this.DoShow(x, y);
  this.enableAnimation = enableAnimationBackup;
 },
 DoHidePopupMenu: function(evt, element){
  if ((__aspxNetscapeFamily || __aspxWebKitFamily) && _aspxIsExists(evt) && this.GetPopupElement() != null 
   && _aspxIsExists(this.GetPopupElement().isPopuped)){
   if (_aspxFindEventSourceParentByTestFunc(evt, aspxTestPopupMenuElement) == this.GetPopupElement()) {
    this.GetPopupElement().isPopuped = true;
   }
  }
  ASPxClientMenuBase.prototype.DoHidePopupMenu.call(this, evt, element);
 },
 DoShowPopupMenuBorderCorrector: function(element, x, y, indexPath, toTheLeft, toTheTop){
  if (indexPath != "")
   ASPxClientMenuBase.prototype.DoShowPopupMenuBorderCorrector.call(this, element, x, y, indexPath, toTheLeft, toTheTop);
 },
 ShowInternal: function(evt){
  var x = _aspxGetEventX(evt);
  var y = _aspxGetEventY(evt);
  if (evt.type == "mouseover")
   aspxGetMenuCollection().SetAppearTimer(this.name, "", this.appearAfter);
  else
   this.DoShow(x, y);
 },
 GetAnimationHorizontalDirection: function(indexPath, popupPosition){
  if (this.GetMenuLevel(indexPath) == 0)
   return _aspxGetAnimationHorizontalDirection(popupPosition, this.popupHorizontalAlign, this.popupVerticalAlign);
  else 
   return popupPosition.isInverted ? 1 : -1;
 },
 GetAnimationVerticalDirection: function(indexPath, popupPosition){
  if (this.GetMenuLevel(indexPath) == 0)
   return _aspxGetAnimationVerticalDirection(popupPosition, this.popupHorizontalAlign, this.popupVerticalAlign);
  else 
   return 0;
 },
 ReplacePopupElementID: function(newPopupElementID){
  var popupElementIDBackup = this.popupElementID;
  this.popupElementID = newPopupElementID;
  this.popupElement = null;
  this.GetPopupElement();
  return popupElementIDBackup;
 },
 Hide: function(){
  var element = this.GetMainElement();
  if(element != null) this.DoHidePopupMenu(null, element);
 },
 Show: function(){
  this.DoShowByAPI(__aspxInvalidPosition, __aspxInvalidPosition);
 },
 ShowAtElement: function(htmlElement){
  var popupElementBackup = this.popupElement;
  this.popupElement = htmlElement;
  this.DoShowByAPI(__aspxInvalidPosition, __aspxInvalidPosition);
  this.popupElement = popupElementBackup;
 },
 ShowAtElementByID: function(id){
  var htmlElement = document.getElementById(id);
  this.ShowAtElement(htmlElement);
 },
 ShowAtPos: function(x, y){
  var popupElementIDBackup = this.ReplacePopupElementID("");
  this.DoShowByAPI(x, y);
  this.ReplacePopupElementID(popupElementIDBackup);
 },
 GetVisible: function(){
  return this.IsMenuVisible();
 },
 SetVisible: function(visible){
  if(visible && !this.IsMenuVisible())
   this.Show();
  else if(!visible && this.IsMenuVisible())
   this.Hide();
 }
});
function aspxMEvent(evt){
 var element = _aspxFindEventSourceParentByTestFunc(evt, aspxTestPopupMenuElement);
 if(element != null) {
  if (evt.type == "mouseout")
   return aspxPMOnMouseOut(evt, element);
  else if (evt.type == "mouseover")
   return aspxPMOnMouseOver(evt, element);
  else if (evt.type == "mousedown")
   return aspxPMOnMouseDown(evt, element);
  else
   return aspxPMOnMouseUp(evt, element);
 }
}
function aspxPMOnMouseDown(evt, element){
 if (!__aspxNetscapeFamily && !__aspxWebKitFamily && _aspxIsExists(element.isPopuped))
  element.isPopuped = element.DXMenu.IsMenuVisible();
}
function aspxPMOnMouseUp(evt, element){
 if (element.DXMenu.popupAction=="RightMouseClick" || _aspxGetIsLeftButtonPressed(evt)) {
  if (element.DXMenu.popupAction=="RightMouseClick")
   _aspxPreventContextMenu(evt);
  if (element.isPopuped != true)
   element.DXMenu.ShowInternal(evt);
  else if ((__aspxNetscapeFamily || __aspxWebKitFamily) && _aspxIsExists(element.isPopuped))
   element.isPopuped = false;
  return _aspxCancelBubble(evt);
 }
}
function aspxPMOnMouseOver(evt, element){
 if(!element.DXMenu.IsMenuVisible())
  element.DXMenu.ShowInternal(evt);
}
function aspxPMOnMouseOut(evt, element){
 if(!element.DXMenu.IsMenuVisible())
  aspxGetMenuCollection().ClearAppearTimer();
}
function aspxTestPopupMenuElement(element){
 return _aspxIsExists(element.DXMenu);
}
_aspxAttachEventToDocument("mousemove", aspxPopupMenuDocumentMouseMove);
function aspxPopupMenuDocumentMouseMove(evt){
 if (aspxGetMenuCollection().IsAppearTimerActive()){
  var element = _aspxFindEventSourceParentByTestFunc(evt, aspxTestPopupMenuElement);
  if(element != null && !element.DXMenu.IsMenuVisible())
   aspxGetMenuCollection().SaveCurrentMouseOverPos(evt);
 }
}

var __aspxTINonProcessingSymbols = ["^", "\\", "\'"];
var __aspxTIWildCards = ["*", "?"];
var __aspxTIGroupElementClassName = "dxg";
var __aspxTIItemElementClassName = "dxtxi";
var __aspxTITextElementClassName = "dxtxt";
var __aspxTIDefaultFilterIntervalDelay = 200;
ASPxClientTitleIndex = _aspxCreateClass(ASPxClientControl, {
 constructor: function(name){
  this.constructor.prototype.constructor.call(this, name);
  this.allowMultipleCallbacks = false;
  this.autoFocus = false;
  this.columnCount = 1;
  this.filterDelay = 0;
  this.rowCount = -1;
  this.showBackToTop = false;
  this.softFiltering = false;
  this.groupSpacing = 0;
  this.groupContentPaddingBottom = 0;
  this.groupContentPaddingTop = 0;
  this.lastFilterMask = "";  
  this.pasteTimerID = -1;
  this.filterTimerID = -1;
  this.mainCellWidth = 0;
  this.columnElements = new Object();    
  this.groupElements = new Object();
  this.itemElements = new Object();
  this.ItemClick = new ASPxClientEvent();
  this.InitializeAutoComplete();
 },
 Initialize: function(){
  if (_aspxIsExists(this.GetFilterInputElement())) {
   this.CleanWhitespaceInControl();
   if (this.filterDelay > __aspxTIDefaultFilterIntervalDelay)
    __aspxTIDefaultFilterIntervalDelay = this.filterDelay;
  }
  if (this.autoFocus && _aspxIsExists(this.GetFilterInputElement()) && 
      _aspxIsFocusable(this.GetFilterInputElement()))
   this.GetFilterInputElement().focus();
  this.constructor.prototype.Initialize.call(this);
 },
 InitializeAutoComplete: function(){
  var element = this.GetFilterInputElement();
  if (_aspxIsExists(element)) element.autocomplete = "off";
 },
 GetCategoryHeaderElement: function(rowIndex){
  return this.GetChild("_CH" + rowIndex);
 },
 GetColumnElement: function(index, rowIndex){
  var columnId = (this.rowCount > 0) ? "_C" + index + "_" + rowIndex : "_C" + index;
  if(!_aspxIsExistsElement(this.columnElements[columnId]))
   this.columnElements[columnId] = this.GetChild(columnId);
  return this.columnElements[columnId];
 },
 GetContentTDWidth: function() {
  return _aspxGetParentByTagName(this.GetCategoryHeaderElement(0), 'td').clientWidth;  
 },
 GetEmptyResultCaptionElement: function() {
  return this.GetChild("_TI_E");
 },
 GetFilterInputElement: function() {
  return this.GetChild("_FI");
 },
 GetGroupElements: function(columnElement) { 
  if(!_aspxIsValidElements(this.groupElements[columnElement.id]))
   this.groupElements[columnElement.id] = _aspxGetChildsByClassName(columnElement, __aspxTIGroupElementClassName);
  return this.groupElements[columnElement.id];
 },
 GetItemText: function(nodeElement) {
  var textElem = this.GetItemTextElement(nodeElement);
  if (_aspxIsExists(textElem) && _aspxIsExists(textElem.nodeValue))
   return _aspxTrim(textElem.nodeValue);
  else  
   return "";
 },
 GetItemElements: function(groupElement) {
  var groupText = this.GetItemText(groupElement);
  if(!_aspxIsValidElements(this.itemElements[groupText]))
   this.itemElements[groupText] = _aspxGetChildsByClassName(groupElement, __aspxTIItemElementClassName);
  return this.itemElements[groupText];
 },
 GetItemTextElement: function(nodeElement){ 
  var textElement = _aspxGetChildsByClassName(nodeElement, __aspxTITextElementClassName)[0];
  return _aspxIsExists(textElement) ? _aspxGetChildTextNode(textElement, 0) : null;
 },
 GetIndexPanelIndexInputElement: function(){
  return _aspxGetElementById(this.name + "PI");
 },
 GetContentCell: function(){
  return this.GetChild("_CCell");
 }, 
 GetTreeViewCell: function(){
  return this.GetChild("_ICell");
 },
 SetPrevFilterMask: function(filterMask) {
  if(!_aspxIsExists(this.lastFilterMask))
    this.lastFilterMask = "";
  this.lastFilterMask = filterMask; 
 },  
 SetFilterTimer: function(fi, timeout) {
  var str = "aspxSFilterTimer(\"" + this.name + "\")";
  if(timeout == 0)
   eval(str);
  else
   this.filterTimerID = _aspxSetTimeout(str, timeout);
 },
 SetPasteTimer: function() {
  var str = "aspxSPasteTimer(\"" + this.name + "\")";
  this.pasteTimerID = _aspxSetInterval(str, __aspxTIDefaultFilterIntervalDelay);
 },
 ClearFilterTimer: function() {
  this.filterTimerID = _aspxClearTimer(this.filterTimerID);
 },
 ClearPasteTimer: function() {
  this.pasteTimerID = _aspxClearInterval(this.pasteTimerID);
 },
 CleanWhitespaceInControl: function() {
  if (this.rowCount > 0)
   this.CleanWhitespace(_aspxGetParentByTagName(this.GetCategoryHeaderElement(0), "table"));
  else {
     for (var j = 0; j < this.columnCount; j ++)
     this.CleanWhitespace(this.GetColumnElement(j, -1));
  }
 },
 CleanWhitespace: function(element) {
  if (element.hasChildNodes()) {   
   var i = 0;
   while (i < element.childNodes.length) {
    var node = element.childNodes[i];
    if(node.nodeType == 3 && !/\S/.test(node.nodeValue))
     node.parentNode.removeChild(node);
    else{
     i++;
     if(node.nodeType != 3)
      this.CleanWhitespace(node);
    }
    }
  }
 },
 CreateFilterRegEx: function(filterMask) {
  var regExString = (this.softFiltering) ? ".*" : "^";
  for (var i=0; i<filterMask.length; i++){
   var index = _aspxArrayIndexOf(__aspxTIWildCards, filterMask.charAt(i));
   if (index > -1){
    switch(index) {
     case 0: regExString += ".*"; break; 
     case 1: regExString += ".{1}"; break; 
    }
   }
   else {
    var index = _aspxArrayIndexOf(__aspxTINonProcessingSymbols, filterMask.charAt(i));
    if (index == -1)
     regExString += "[" + filterMask.charAt(i) + "]";
   }
  }
  regExString += ".*";
  return new RegExp(regExString, 'i'); 
 }, 
 OnCallback: function(result) {
  var inputElement = this.GetIndexPanelIndexInputElement();
  if(inputElement != null) 
   inputElement.value = result.index;
  var element = this.GetContentCell();
  if(element != null) 
   _aspxSetInnerHtml(element, result.html);
 },
 IsAllowableKeyCode: function(keyCode) {
  return (((keyCode >= 48) && (keyCode <= 57)) || 
    ((keyCode >= 186) && (keyCode <= 192)) || 
    ((keyCode >= 219) && (keyCode <= 226)) || 
    ((keyCode >= 65)&&(keyCode <= 90)) ||
    ((keyCode >= 65)&&(keyCode <= 90)) || 
    ((keyCode >= 96)&&(keyCode <= 107)) || 
    ((keyCode >= 109)&&(keyCode <= 111)) || 
      keyCode == 8 || keyCode == 45 || keyCode == 46);
 },
 IsFirstCategoryTR: function(categoryElem) {
  var spacingElem = categoryElem.parentNode.previousSibling;
  return !_aspxIsExists(spacingElem);
 },
 IsFirstCategory: function(categoryElem, index) {
  var i = index - 1;
  while (i >= 0) {  
   if (_aspxGetElementDisplay(this.GetCategoryHeaderElement(i).parentNode))
    return false;
   i--;
  }
  return true;
 },
 IsFirstGroupInColumn: function(groupIndex, columnElem) {
  var groupElements = this.GetGroupElements(columnElem);  
  var i = groupIndex - 1;
  while (i >= 0) {
   if (_aspxGetElementDisplay(groupElements[i]))
    return false;
   i--;
  }
  return true; 
 }, 
 IsFilterTimerActive: function() {
  return this.filterTimerID > -1;
 },
 IsFilterMaskChanged: function(filterMask) {
  if(!_aspxIsExists(this.lastFilterMask))
   this.lastFilterMask = "";
   return this.lastFilterMask.toUpperCase() != filterMask.toUpperCase();
 },
 CorrectCategorySpacing: function(categoryElem, index) {
  var headerTR = categoryElem.parentNode;  
  if (!this.IsFirstCategoryTR(categoryElem) && 
   (this.groupSpacing != 0) &&  this.IsFirstCategory(categoryElem, index))   
   _aspxSetElementDisplay(headerTR.previousSibling, false);
 },
 CorrectNodesPaddings: function(columnIndex, rowIndex) {
  var columnElem = this.GetColumnElement(columnIndex, rowIndex);
  var groupElements = this.GetGroupElements(columnElem);  
  for (var i = 0; i < groupElements.length; i ++) {
   if (_aspxGetElementDisplay(groupElements[i])) {     
    if (this.IsFirstGroupInColumn(i, columnElem)) 
     _aspxChangeStyleAttribute(groupElements[i], "paddingTop", 0);
    else 
     _aspxRestoreStyleAttribute(groupElements[i], "paddingTop");
    this.CorrectGroupContentPadding(groupElements[i]);
   }
  }
 },
 CorrectGroupContentPadding: function(groupElement) {
  var itemElements = this.GetItemElements(groupElement);  
  for (var i = 0; i < itemElements.length; i++) {
   if (_aspxGetElementDisplay(itemElements[i])) {
    if (i == 0)  
     _aspxChangeStyleAttribute(itemElements[i], "paddingTop", 0);
    else 
     _aspxRestoreStyleAttribute(itemElements[i], "paddingTop");
   }
  }
 },
 DoIndexPanelItemClick: function(value) {
  var inputElement = this.GetIndexPanelIndexInputElement();
  if(inputElement != null) {
   if (_aspxIsExists(this.GetFilterInputElement()))
    this.GetFilterInputElement().disabled = true;
   this.CreateCallback(value + __aspxCallbackSeparator + value);
  }
 },
 DoBeginCallback: function(command){
  this.CreateLoadingPanelWithAbsolutePosition(this.GetTreeViewCell());
  ASPxClientControl.prototype.DoBeginCallback.call(this, command);
 },
 OnControlClick: function(clickedElement, htmlEvent) {
  var itemElement = _aspxGetParentByClassName(clickedElement, __aspxItemClassName);  
  if(_aspxIsExists(itemElement)) {
   var processOnServer = this.RaiseItemClick(itemElement, htmlEvent);  
   var hasItemLink = this.GetLinkElement(itemElement) != null;
   if(processOnServer && !hasItemLink) {
    var name = this.GetItemElementName(itemElement);
    this.SendPostBack("CLICK:" + name);
   }
  }
 },
 RaiseItemClick: function(itemElement, htmlEvent){
  var processOnServer = this.autoPostBack || this.IsServerEventAssigned("ItemClick");
  if(!this.ItemClick.IsEmpty()){
   var name = this.GetItemElementName(itemElement);
   var args = new ASPxClientTitleIndexItemEventArgs(processOnServer, name, itemElement, htmlEvent);
   this.ItemClick.FireEvent(this, args);
   processOnServer = args.processOnServer;
  }
  return processOnServer;
 },
 DoFilter: function (filterMask){
  filterMask = _aspxTrim(filterMask);
  if(this.IsFilterMaskChanged(filterMask)){        
   this.SetPrevFilterMask(filterMask);   
   var filterRegEx = this.CreateFilterRegEx(filterMask);
   var isData = false;
   if (this.rowCount > 0) { 
    var categoryCount = 0;
    if (this.GetContentTDWidth() != 0)
     this.mainCellWidth = this.GetContentTDWidth();
    for(var i = 0; i < this.rowCount; i ++) {
     var categoryElem = this.GetCategoryHeaderElement(i);     
     var visibleColCount = 0;
     for(var j = 0; j < this.columnCount; j ++) {
       var visibleItemCount = this.FilterColumnInCategory(j, i, filterMask, filterRegEx);
       if (visibleItemCount != 0)
        visibleColCount ++;
      }
      if (visibleColCount != 0) {      
       this.ShowCategory(categoryElem);
       this.CorrectCategorySpacing(categoryElem, i);
       categoryCount ++;
      }
      else
       this.HideCategory(categoryElem);
    }
    isData = categoryCount != 0;
   }
   else { 
    var visibleColCount = 0;
    for (var i = 0; i < this.columnCount; i ++) {
     var visibleCategoryNodeCount = this.FilterColumn(i, -1, filterMask, filterRegEx);
     this.CorrectNodesPaddings(i, -1);
     if (visibleCategoryNodeCount != 0)
      visibleColCount ++;
    }
    isData = visibleColCount != 0;
   }
   if(isData)
    this.HideEmptyResultCaption();
   else
    this.ShowEmptyResultCaption();   
  }
 },
 DoFilterInternal: function() {
  this.DoFilter(this.GetFilterInputElement().value);
 },
 FilterColumn: function(columnIndex, rowIndex, filterMask, filterRegEx) {
  var columnElem = this.GetColumnElement(columnIndex, rowIndex);
  var groupElements = this.GetGroupElements(columnElem);  
  var visibleGroupCount = 0;
  for(var i = 0; i < groupElements.length; i ++) {
   visibleItemsCount = this.FilterItems(groupElements[i], filterRegEx);
   if(visibleItemsCount > 0) {
    visibleGroupCount ++;
    this.ShowGroup(groupElements[i]);
   }
   else
    this.HideGroup(groupElements[i]);
  }
  if(visibleGroupCount != 0) {
   _aspxSetElementVisibility(columnElem, true);
   this.SetColumnSeparatorDisplay(columnElem, true, columnIndex, rowIndex);   
  }
  else {
   _aspxSetElementVisibility(columnElem, false);
   this.SetColumnSeparatorDisplay(columnElem, false, columnIndex, rowIndex);
  }
  return visibleGroupCount;
 },
 FilterColumnInCategory: function(columnIndex, rowIndex, filterMask, filterRegEx) {
  var columnElem = this.GetColumnElement(columnIndex, rowIndex);
  var visibleItemCount = 0;
  if (_aspxIsExists(columnElem)) {
   var itemElements = this.GetItemElements(columnElem);
   for (var i = 0; i < itemElements.length; i++) {
    var itemText = this.GetItemText(itemElements[i]);
    if (!filterRegEx.test(itemText))
     _aspxSetElementDisplay(itemElements[i], false);
    else {
     _aspxSetElementDisplay(itemElements[i], true);
     visibleItemCount ++;
    }
   }
   if(visibleItemCount != 0) {
    this.SetColumnSeparatorDisplay(columnElem, true, columnIndex, rowIndex);
   }
   else {
    this.SetColumnSeparatorDisplay(columnElem, false, columnIndex, rowIndex);
   }
  }
  return visibleItemCount;
 },
 FilterItems: function(parentNodeElem, filterRegEx) {
  var itemElements = this.GetItemElements(parentNodeElem);  
  var visibleNodeCount = 0;
  for (var i = 0; i < itemElements.length; i++) {
   var itemText = this.GetItemText(itemElements[i]);
   if(filterRegEx.test(itemText)) {
    _aspxSetElementDisplay(itemElements[i], true);
    visibleNodeCount ++;
   }
   else
    _aspxSetElementDisplay(itemElements[i], false);
  }
  return visibleNodeCount;
 },
 ShowCategory: function(categoryElement) {
  var headerTR = categoryElement.parentNode; 
  _aspxSetElementDisplay(headerTR, true);
  if ((this.groupSpacing != 0) && !this.IsFirstCategoryTR(categoryElement)) 
   _aspxSetElementDisplay(headerTR.previousSibling, true);
  var categoryContentElem = null;
  if (this.groupContentPaddingTop == 0) {
   categoryContentElem = headerTR.nextSibling;
   _aspxSetElementDisplay(headerTR.nextSibling, true);
  }
  else {
   _aspxSetElementDisplay(headerTR.nextSibling, true);
   categoryContentElem = headerTR.nextSibling.nextSibling;
   _aspxSetElementDisplay(headerTR.nextSibling.nextSibling, true);
  }
  if (this.groupContentPaddingBottom != 0)
   _aspxSetElementDisplay(categoryContentElem.nextSibling, true);
  if (this.showBackToTop) {
   if (this.groupContentPaddingBottom != 0)
    _aspxSetElementDisplay(categoryContentElem.nextSibling.nextSibling, true);
   else
    _aspxSetElementDisplay(categoryContentElem.nextSibling, true);     
  }  
 },
 HideCategory: function(categoryElement) {
  var headerTR = categoryElement.parentNode; 
  _aspxSetElementDisplay(headerTR, false);
  if ((this.groupSpacing != 0) && !this.IsFirstCategoryTR(categoryElement)) 
   _aspxSetElementDisplay(headerTR.previousSibling, false);
  var categoryContentElem = null;
  if (this.groupContentPaddingTop == 0) { 
   categoryContentElem = headerTR.nextSibling;
   _aspxSetElementDisplay(headerTR.nextSibling, false);
  }
  else {
   _aspxSetElementDisplay(headerTR.nextSibling, false);
   categoryContentElem = headerTR.nextSibling.nextSibling;
   _aspxSetElementDisplay(headerTR.nextSibling.nextSibling, false);
  }  
  if (this.groupContentPaddingBottom != 0)
   _aspxSetElementDisplay(categoryContentElem.nextSibling, false);
  if (this.showBackToTop) {
   if (this.groupContentPaddingBottom != 0)
    _aspxSetElementDisplay(categoryContentElem.nextSibling.nextSibling, false);
   else
    _aspxSetElementDisplay(categoryContentElem.nextSibling, false);
  }   
 },
 ShowEmptyResultCaption: function() {
  var elem = this.GetEmptyResultCaptionElement();
  if (this.rowCount > 0 && (this.mainCellWidth > 0)) 
   elem.style.width = this.mainCellWidth + "px";
  _aspxSetElementDisplay(elem, true);
 },
 HideEmptyResultCaption: function() {
  var elem = this.GetEmptyResultCaptionElement();
  _aspxSetElementDisplay(elem, false);
 },
 ShowGroup: function(nodeElement) {
  if(!_aspxGetElementDisplay(nodeElement))
   _aspxSetElementDisplay(nodeElement, true);
 },
 HideGroup: function(nodeElement) {
  _aspxSetElementDisplay(nodeElement, false);  
 },
 SetColumnSeparatorDisplay: function(columnElem, value, columnIndex, rowIndex){
  if(columnIndex != this.columnCount - 1)
   this.SetRightColumnSeparatorDisplay(columnElem, value);  
  else{ 
   var prevColumn = this.GetColumnElement(columnIndex - 1, rowIndex);
   if((prevColumn != null) && (_aspxGetElementDisplay(prevColumn))){
    this.SetLeftColumnSeparatorDisplay(columnElem, value);
   }
  }
 },
 SetLeftColumnSeparatorDisplay: function(columnElem, value){
  var curElem = columnElem.previousSibling;
  while((curElem != null) && (curElem.id == "")){
   _aspxSetElementVisibility(curElem, value);
   curElem = curElem.previousSibling;
  }
 },
 SetRightColumnSeparatorDisplay: function(columnElem, value){
  var curElem = columnElem.nextSibling;
  while((curElem != null) && (curElem.id == "")){
   _aspxSetElementVisibility(curElem, value);
   curElem = curElem.nextSibling;
  }
 },
 OnFilterInputBlur: function(evt) {
  this.ClearPasteTimer();
 },
 OnFilterInputChange: function(evt) {
  if(this.GetFilterInputElement().value != ""){
   if(this.IsFilterTimerActive())
    this.ClearFilterTimer();
   this.DoFilter(this.GetFilterInputElement().value); 
  }
 },
 OnFilterInputFocus: function() {
  this.SetPasteTimer();
 },
 OnFilterInputKeyUp: function(evt) {
  if(this.IsAllowableKeyCode(evt.keyCode)){
   if(this.IsFilterTimerActive())
    this.ClearFilterTimer();
   this.SetFilterTimer(this.GetFilterInputElement(), this.filterDelay);
  }
 },     
 OnFilterInputKeyPress: function(evt) { 
  if (evt.keyCode == ASPxKey.Enter) 
   return false;
 }
});
ASPxClientTitleIndexItemEventArgs = _aspxCreateClass(ASPxClientProcessingModeEventArgs, {
 constructor: function(processOnServer, name, htmlElement, htmlEvent){
  this.constructor.prototype.constructor.call(this, processOnServer);
  this.name = name;
  this.htmlElement = htmlElement;
  this.htmlEvent = htmlEvent;
 }
});
function aspxSIFBlur(name) {
 var si = aspxGetControlCollection().Get(name);
 if(si != null) si.OnFilterInputBlur();
 return true;
}
function aspxSIFChange(evt, name) {
 var si = aspxGetControlCollection().Get(name);
 if(si != null) si.OnFilterInputChange(evt);
 return true;
}
function aspxSIFFocus(name) {
 var si = aspxGetControlCollection().Get(name);
 if(si != null) si.OnFilterInputFocus();
 return true;
}
function aspxSIFKeyUp(evt, name) {
 var si = aspxGetControlCollection().Get(name);
 if(si != null) si.OnFilterInputKeyUp(evt);
 return true;
}
function aspxSIFKeyPress(evt, name) {
 var si = aspxGetControlCollection().Get(name);
 if(si != null) return si.OnFilterInputKeyPress(evt);
 return true;
}
function aspxSFilterTimer(name){
 var si = aspxGetControlCollection().Get(name);
 if(si != null){
  si.DoFilter(si.GetFilterInputElement().value);
  si.ClearFilterTimer();
 }
}
function aspxSPasteTimer(name) {
 var si = aspxGetControlCollection().Get(name);
 if(si != null) si.DoFilterInternal();
}
function aspxIPItemClick(name, value) {
 var ti = aspxGetControlCollection().Get(name);
 if(ti != null) ti.DoIndexPanelItemClick(value);
}

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;
 }, 
 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) {
 if(__aspxDragHelper != null) {
  if(!__aspxDragHelper.canDrag)
   return true;
  try {
   document.selection.empty();
  } catch(e) {
  }
  return false;   
 }
}
_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);

ASPxClientHtmlEditorSelection =_aspxCreateClass(null, {
 constructor: function(htmlEditor) {
  this.clientSelection = ASPxClientHtmlEditorSelection.Create(htmlEditor);
  this.clientSelection.Save();
  this.isControlSelected = this.clientSelection.IsControl();
  this.html = this.clientSelection.GetHtmlText();
  this.text = this.clientSelection.GetText();
  this.selectedElement = this.clientSelection.GetParentElement();
 },
 Apply: function() {
  this.clientSelection.Restore();
 },
 GetIsControlSelected: function() {
  return this.isControlSelected;
 },
 GetSelectedElement: function() {
  return this.selectedElement;
 },
 GetHtml: function() {
  return this.html;
 },
 GetText: function() {
  return this.text;
 }
});
ASPxClientHtmlEditorSelection.Create = function(htmlEditor) {
 var contentWindow = htmlEditor.GetDesignViewIFrameWindow();
 return ASPxClientSelection.Create(contentWindow);
}
ASPxClientHtmlEditorSelection.SelectElement = function(element, htmlEditor, selectAllContent) {
 if (!_aspxIsExists(selectAllContent))
  selectAllContent = true;
 var iframeWindow = htmlEditor.GetDesignViewIFrameWindow();
 return __aspxIE ? ASPxClientSelectionIE.SelectElementInDocument(element, iframeWindow.document, selectAllContent) :
      ASPxClientSelectionNSOpera.SelectElementInDocument(element, iframeWindow.document, iframeWindow, selectAllContent);
}
ASPxClientSelection = _aspxCreateClass(null, {
 constructor: function(contentWindow) {
  this.contentWindow = contentWindow;
  this.contentDocument = contentWindow.document;
  this.startContainer = null;
  this.endContainer = null;
  this.startOffset = 0;
  this.endOffset = 0;
 },
 GetHtmlText: function() {
 },
 Save: function() {
 },
 Restore: function() {
 },
 GetText: function() {
 },
 GetHtmlText: function() {
 },
 GetStartContainer: function() {
  this.FindStartEndContainerInternal();
  return this.startContainer;
 },
 GetEndContainer: function() {
  this.FindStartEndContainerInternal();
  return this.endContainer;
 },
 GetStartOffset: function() {
  this.FindStartEndContainerInternal();
  return this.startOffset;
 },
 GetEndOffset: function() {
  this.FindStartEndContainerInternal();
  return this.endOffset;
 },
 IsControl: function() {
  return false;
 },
 IsTextOnly: function() {
  return false;
 },
 GetRange: function() {
 },
 GetExtendedBookmark: function() {
  return null;
 },
 GetSelectionMarkerElement: function(isStart) {
  return null;
 },
 SelectExtendedBookmark: function(bookmark) {
 },
 RemoveExtendedBookmark: function(bookmark) {
  if (bookmark) {
   _aspxRemoveElement(_aspxGetElementByIdInDocument(this.contentDocument, bookmark.startMarkerID));
   _aspxRemoveElement(_aspxGetElementByIdInDocument(this.contentDocument, bookmark.endMarkerID));
  }
  return null;
 },
 FindStartEndContainer: function() {
 },
 FindStartEndContainerInternal: function() {
  if (this.startContainer || this.endContainer)
   return;
  this.FindStartEndContainer();
 }
});
ASPxClientSelection.IsHtml = function(text) {
 if (!text || !text.match) return text;
 return text.match(/</);
}
ASPxClientSelection.Create = function(contentWindow) {
 return __aspxIE ? new ASPxClientSelectionIE(contentWindow) : new ASPxClientSelectionNSOpera(contentWindow);
}
ASPxClientSelection.GetMarkerID = function() {
 return 'dx_temp_' + (new Date()).valueOf() + '_' + Math.floor(Math.random()*1000);
}
ASPxClientSelection.IsControlElement = function(element) {
 if (element.nodeType == 1) {
  var tagName = element.tagName.toUpperCase();
  return tagName == "TABLE" || tagName == "IMG";
 }
 return false;
};
ASPxClientSelection.InsertNodeAtPosition = function(containerNode, insertNode, containeNodeOffset, doc) {
 var newTextNode = null;
 if ((containerNode.nodeType == 3) && (insertNode.nodeType == 3))
  containerNode.insertData(containeNodeOffset, insertNode.nodeValue);
 else {
  var afterNode;
  if (containerNode.nodeType == 3) {
   var textNode = containerNode;
   containerNode = textNode.parentNode;
   var nodeText = textNode.nodeValue;
   var textBefore = nodeText.substr(0, containeNodeOffset);
   var textAfter = nodeText.substr(containeNodeOffset);
   var beforeNode = doc.createTextNode(textBefore);
   var afterNode = doc.createTextNode(textAfter);
   containerNode.insertBefore(afterNode, textNode);
   containerNode.insertBefore(insertNode, afterNode);
   newTextNode = beforeNode;
   try {
    containerNode.insertBefore(beforeNode, insertNode);
   }
   catch (exc) { }
   containerNode.removeChild(textNode);
  }
  else {
   if (containerNode.childNodes.length > 0) {
    afterNode = containerNode.childNodes[containeNodeOffset];
    containerNode.insertBefore(insertNode, afterNode);
   }
   else {
    if (containerNode.tagName != "BODY")
     containerNode = containerNode.parentNode;
    containerNode.appendChild(insertNode);
   }
  }
  return newTextNode;
 }
}
ASPxClientSelectionIE = _aspxCreateClass(ASPxClientSelection, {
 constructor: function(contentWindow) {
  this.constructor.prototype.constructor.call(this, contentWindow);
 },
 Save: function() {
  this.contentWindow.focus();
  var curSelection = this.contentDocument.selection;
  var selRange = curSelection.createRange();
  if (selRange.length)
   this.sourceIndex = selRange.item(0).sourceIndex;
  else
   this.startBookmark = this.GetBookmark(selRange);
 },
 Restore: function() {
  if (_aspxIsExists(this.sourceIndex)) {
   var selRange = this.contentDocument.body.createControlRange();
   selRange.addElement(this.contentDocument.all(this.sourceIndex));
   selRange.select();
  }
  else if (_aspxIsExists(this.startBookmark)) {
   var selRange = this.contentDocument.body.createTextRange();
   selRange.moveToBookmark(this.startBookmark);
   selRange.select();
   selRange.collapse();
  }
  this.contentWindow.focus();
 },
 GetBookmark: function(range) {
  return range.getBookmark(); 
 },
 GetSelectionMarkerElement: function(isStart) {
  var rng = this.GetRange();
  var markerID = ASPxClientSelection.GetMarkerID();
  var makerElem = null;
  if (this.IsControl()) {
   makerElem = this.contentDocument.createElement("span");
   makerElem.id = markerID;
   var controlElem = rng.item(0);
   if (isStart)
    controlElem.parentNode.insertBefore(makerElem, controlElem);
   else
    controlElem.parentNode.insertBefore(makerElem, controlElem.nextSibling);
  }
  else {
   if (_aspxIsExists(rng.parentElement) && rng.parentElement().document != this.contentDocument)
    return null;
   if (_aspxIsExists(rng.collapse))
    rng.collapse(isStart);
   try {
    rng.pasteHTML('<span id="' + markerID + '"></span>');
    makerElem = _aspxGetElementByIdInDocument(this.contentDocument, markerID);
   } catch (e) { };
  }
  return makerElem;
 },
 GetExtendedBookmark: function() {
  var controlElementID = null;
  var bookmark = null;
  if (this.IsControl()) {
   var selRange = this.contentDocument.selection.createRange();
   controlElementID = ASPxClientSelection.GetMarkerID();
   _aspxChangeAttribute(selRange.item(0), "id", controlElementID);
   bookmark = { "controlElementID": controlElementID };
  }
  else {
   var startMarker = this.GetSelectionMarkerElement(true);
   var endMarker = this.GetSelectionMarkerElement(false);
   if (startMarker != null && endMarker != null)
    bookmark = { "startMarkerID": startMarker.id, "endMarkerID": endMarker.id };
  }
  return bookmark;
 },
 SelectExtendedBookmark: function(bookmark) {
  var rng1 = null;
  if (bookmark.controlElementID) {
   rng1 = this.contentDocument.body.createControlRange();
   var controlElement = _aspxGetElementByIdInDocument(this.contentDocument, bookmark.controlElementID);
   _aspxRestoreAttribute(controlElement, "id");
   rng1.addElement(controlElement);
  }
  else {
   var startMarker = _aspxGetElementByIdInDocument(this.contentDocument, bookmark.startMarkerID);
   var endMarker = _aspxGetElementByIdInDocument(this.contentDocument, bookmark.endMarkerID);
   rng1 = this.contentDocument.body.createTextRange();
   if (_aspxIsExists(startMarker))
    rng1.moveToElementText(startMarker);
   rng1.moveStart('character', 0);
   var rng2 = this.contentDocument.body.createTextRange();
   if (_aspxIsExists(endMarker))
    rng2.moveToElementText(endMarker);
   rng1.setEndPoint('EndToEnd', rng2);
   rng1.moveEnd('character', 0);
   _aspxRemoveElement(startMarker);
   _aspxRemoveElement(endMarker);
  }
  rng1.select();
 },
 SelectElement: function(elem, selectAllContent) {
  ASPxClientSelectionIE.SelectElementInDocument(elem, this.contentDocument, selectAllContent);
 },
 GetRange: function() {
  return this.contentDocument.selection.createRange();
 },
 GetParentElement: function() {
  var ret = null;
  var rng = this.GetRange();
  if (!rng) return ret;
  if (rng.length)
   ret = rng.item(0);
  else if (rng.parentElement)
   ret = rng.parentElement();
  return ret;
 },
 GetText: function() {
  var ret = "";
  var rng = this.contentDocument.selection.createRange();
  if (_aspxIsExists(rng.text))
   ret = rng.text;
  return ret;
 },
 GetHtmlText: function() {
  var ret = "";
  var rng = this.GetRange();
  if (rng.length)
   ret = rng.item(0).outerHTML;
  else if (rng.htmlText)
   ret = rng.htmlText;
  return ret;
 },
 IsControl: function() {
  return this.contentDocument.selection.type == 'Control';
 },
 IsTextOnly: function() {
  var rng = this.contentDocument.selection.createRange();
  if (_aspxIsExists(rng.text) && _aspxIsExists(rng.htmlText))
   return (rng.text == rng.htmlText);
  return false;
 },
 FindStartEndContainer: function() {
  var startMarker = this.GetSelectionMarkerElement(true);
  var endMarker = this.GetSelectionMarkerElement(false);
  if (!startMarker && !endMarker) {
   this.startContainer = this.contentDocument.body;
   return;
  }
  this.startContainer = startMarker.parentNode;
  this.startOffset = _aspxArrayIndexOf(this.startContainer.childNodes, startMarker);
  _aspxRemoveElement(startMarker);
  this.endContainer = endMarker.parentNode;
  this.endOffset = _aspxArrayIndexOf(this.endContainer.childNodes, endMarker);
  _aspxRemoveElement(endMarker);
  if (this.startContainer != this.endContainer) {
   if (this.endOffset == 0) {
    while (this.endContainer && !this.endContainer.previousSibling)
     this.endContainer = this.endContainer.parentNode;
    if (this.endContainer)
     this.endContainer = this.endContainer.previousSibling;
   }
   else if (this.endContainer.nodeType == 1)
    this.endContainer = this.endContainer.childNodes[this.endOffset - 1];
  }
 }
});
ASPxClientSelectionIE.SelectElementInDocument = function(elem, docObj, selectAllContent) {
 if (!_aspxIsExists(selectAllContent))
  selectAllContent = true;
 var rng;
 if (ASPxClientSelection.IsControlElement(elem)) {
  rng = docObj.body.createControlRange();
  rng.addElement(elem);
 }
 else {
  rng = docObj.selection.createRange();
  try { 
   rng.moveToElementText(elem); 
  }
  catch (e) { }
 }
 if (!selectAllContent) {
  try { 
   rng.collapse(false); 
  }
  catch (e) { }
 }
 rng.select();
};
DialogSelectionIE = _aspxCreateClass(ASPxClientSelectionIE, {
 Save: function() {
  this.contentWindow.focus();  
  var curSelection = this.contentDocument.selection;
  if (curSelection) {
   this.selectionRange = curSelection.createRange();
   if (curSelection.type.toLowerCase() == "control")
    this.sourceIndex = this.selectionRange.item(0).sourceIndex;
  }
 },
 Restore: function() {
  if (_aspxIsExists(this.sourceIndex)) {
   var selRange = this.contentDocument.body.createControlRange();
   selRange.addElement(this.contentDocument.all(this.sourceIndex));
   selRange.select();
  }
  else if (_aspxIsExists(this.selectionRange))
   this.selectionRange.select();
  this.contentWindow.focus();
 }
});
ASPxClientSelectionNSOpera = _aspxCreateClass(ASPxClientSelection, {
 constructor: function(contentWindow) {
  this.constructor.prototype.constructor.call(this, contentWindow);
 },
 Save: function() {
  var curSelection = this.contentWindow.getSelection();
  if (_aspxIsExists(curSelection)) {
   this.isCollapsedSelection = curSelection.isCollapsed;
   this.startNodePath = this.GetNodePath(this.contentDocument.documentElement, curSelection.anchorNode);
   this.startNodeOffset = curSelection.anchorOffset;
   this.endNodePath = this.GetNodePath(this.contentDocument.documentElement, curSelection.focusNode);
   this.endNodeOffset = curSelection.focusOffset;
   if (__aspxOpera) {
    if (this.NeedExchangeStartAndEndNode(this.startNodePath, this.endNodePath, this.startNodeOffset, this.endNodeOffset)) {
     var tmp = this.startNodePath;
     this.startNodePath = this.endNodePath;
     this.endNodePath = tmp;
     tmp = this.startNodeOffset;
     this.startNodeOffset = this.endNodeOffset;
     this.endNodeOffset = tmp;
    }
   }
  }
  else {
   this.isCollapsedSelection = null;
   this.startNodePath = null;
   this.startNodeOffset = null;
   this.endNodePath = null;
   this.endNodeOffset = null;
  }
 },
 Restore: function() {
  var curSelection = this.contentWindow.getSelection();
  var startNode = this.GetNodeByPath(this.contentDocument.documentElement, this.startNodePath);
  var endNode = this.GetNodeByPath(this.contentDocument.documentElement, this.endNodePath);
  ASPxClientSelectionNSOpera.RestoreByStartAndEndNodeCore(startNode, endNode, this.startNodeOffset,
               this.endNodeOffset,
               this.isCollapsedSelection,
               this.contentDocument,
               this.contentWindow);
 },
 GetParentElement: function() {
  var ret = null;
  var rng = this.GetRange();
  if (!rng) return ret;
  var selection = this.contentWindow.getSelection();
  var startContainer = this.GetStartContainer(rng, selection);
  var endContainer = this.GetEndContainer(rng, selection);
  var startOffset = this.GetStartOffset(rng, selection);
  var endOffset = this.GetEndOffset(rng, selection);
  if (startContainer == endContainer && (endOffset - startOffset) == 1 &&
    (selection.anchorNode.childNodes.length > 0))
   ret = selection.anchorNode.childNodes[selection.anchorOffset];
  else {
   if (!rng.commonAncestorContainer.tagName) {
    if (this.contentWindow.document == rng.commonAncestorContainer &&
     selection.baseNode) 
     ret = selection.baseNode.parentNode;
    else
     ret = rng.commonAncestorContainer.parentNode;
   }
   else
    ret = rng.commonAncestorContainer;
  }
  return ret;
 },
 GetRange: function() {
  var selection = this.contentWindow.getSelection();
  if (!selection || selection.rangeCount < 1)
   return null;
  return selection.getRangeAt ? selection.getRangeAt(0) : this.contentWindow.createRange(); 
 },
 GetText: function() {
  var ret = "";
  if (this.contentWindow.getSelection)
   ret = this.contentWindow.getSelection().toString();
  return ret;
 },
 GetHtmlText: function() {
  var ret = "";
  var selection = this.contentWindow.getSelection();
  var rng = null;
  if (selection.getRangeAt && selection.rangeCount > 0) {
   rng = selection.getRangeAt(0);
   var tempDiv = this.contentWindow.document.createElement("div");
   var clonedFragment = rng.cloneContents();
   if (_aspxIsExists(clonedFragment)) {
    tempDiv.appendChild(clonedFragment);
    ret = tempDiv.innerHTML;
   }
  }
  return ret;
 },
 GetExtendedBookmark: function() {
  var startSpan = this.contentDocument.createElement("span");
  startSpan.id = ASPxClientSelection.GetMarkerID();
  var endSpan = this.contentDocument.createElement("span");
  endSpan.id = ASPxClientSelection.GetMarkerID();
  var isEmptyTextSelected = false;
  if (this.startContainer == this.endContainer) {
   isEmptyTextSelected = this.endOffset == this.startOffset;
   var newContainer = ASPxClientSelection.InsertNodeAtPosition(this.endContainer, endSpan, this.endOffset, this.contentDocument);
   if (_aspxIsExists(newContainer))
    this.startContainer = newContainer;
   ASPxClientSelection.InsertNodeAtPosition(this.startContainer, startSpan, this.startOffset, this.contentDocument);
  }
  else {
   ASPxClientSelection.InsertNodeAtPosition(this.startContainer, startSpan, this.startOffset, this.contentDocument);
   ASPxClientSelection.InsertNodeAtPosition(this.endContainer, endSpan, this.endOffset, this.contentDocument);
  }
  var bookmark = { "startMarkerID": startSpan.id, "endMarkerID": endSpan.id, "isEmptyTextSelected": isEmptyTextSelected };
  this.SelectExtendedBookmark(bookmark, false);
  return bookmark;
 },
 SelectExtendedBookmark: function(bookmark, withDeleteMarker) {
  if (!_aspxIsExists(withDeleteMarker))
   withDeleteMarker = true;
  var startMarker = _aspxGetElementByIdInDocument(this.contentDocument, bookmark.startMarkerID);
  var endMarker = _aspxGetElementByIdInDocument(this.contentDocument, bookmark.endMarkerID);
  var rng1 = this.contentDocument.createRange();
  rng1.setStart(startMarker.nextSibling, 0);
  if (startMarker.nextSibling != endMarker) {
   var nextSibling = endMarker.nextSibling ? endMarker.nextSibling : endMarker;
   rng1.setEnd(nextSibling, 0);
  }
  var sel = this.contentWindow.getSelection();
  sel.removeAllRanges();
  sel.addRange(rng1);
  if (bookmark.isEmptyTextSelected) {
   var index = _aspxArrayIndexOf(endMarker.parentNode.childNodes, startMarker);
   sel.collapse(endMarker.parentNode, index);
  }
  if (withDeleteMarker) {
   _aspxRemoveElement(startMarker);
   _aspxRemoveElement(endMarker);
  }
 },
 FindStartEndContainer: function() {
  var rng = this.GetRange();
  var selection = this.contentWindow.getSelection();
  this.startContainer = rng.startContainer ? rng.startContainer : selection.baseNode;
  this.endContainer = rng.endContainer ? rng.endContainer : selection.extentNode;
  this.startOffset = rng.startOffset != null ? rng.startOffset : selection.baseOffset;
  this.endOffset = rng.endOffset != null ? rng.endOffset : selection.extentOffset;
 },
 IsControl: function() {
  var selection = this.contentWindow.getSelection();
  if (selection.toString() != "" || !_aspxIsExists(selection.focusNode))
   return false;
  var focusNode = selection.focusNode;
  if (focusNode.nodeType == 1) { 
   var rng = this.GetRange();
   var startContainer = this.GetStartContainer();
   var endContainer = this.GetEndContainer();
   var startOffset = this.GetStartOffset();
   var endOffset = this.GetEndOffset();
   if (startContainer == endContainer && (endOffset - startOffset) == 1 &&
     (selection.anchorNode.childNodes.length > 0))
    focusNode = selection.anchorNode.childNodes[selection.anchorOffset];
  }
  return (focusNode.tagName == 'IMG');
 },
 IsTextOnly: function() {
  var selection = this.contentWindow.getSelection();
  return _aspxIsExists(selection.focusNode) && _aspxIsExists(selection.anchorNode) &&
    ((selection.focusNode == selection.anchorNode) ||
    ((selection.focusNode.nodeType == 3) && (selection.anchorNode.nodeType == 3))); 
 },
 SelectElement: function(elem, selectAllContent) {
  if (!_aspxIsExists(selectAllContent))
   selectAllContent = true;
  ASPxClientSelectionNSOpera.SelectElementInDocument(elem, this.contentDocument, this.contentWindow, selectAllContent);
 },
 NeedExchangeStartAndEndNode: function(startNodePath, endNodePath, startNodeOffset, endNodeOffset) {
  if (startNodePath != endNodePath) {
   var startNodePathArray = startNodePath.split("-");
   var endNodePathArray = endNodePath.split("-");
   var length = Math.min(startNodePathArray.length, endNodePathArray.length);
   for (var i = 0; i < length; i++) {
    var i1 = parseInt(startNodePathArray[i], 10);
    var i2 = parseInt(endNodePathArray[i], 10);
    if (i1 > i2)
     return true;
   }
  }
  return startNodeOffset > endNodeOffset;
 },
 GetNodePath: function(rootNode, node) {
  var path = "";
  var curParentNode = node;
  var curNode = node;
  if (_aspxIsExists(curParentNode)) {
   while (rootNode != curParentNode) {
    curParentNode = curParentNode.parentNode;
    if (_aspxIsExists(curParentNode.childNodes)) {
     var index = _aspxArrayIndexOf(curParentNode.childNodes, curNode);
     path = index.toString() + "-" + path;
    }
    curNode = curParentNode;
   }
  }
  return path.substr(0, path.length - 1);
 },
 GetNodeByPath: function(rootNode, path) {
  if (path != "") {
   var pathNodeArray = path.split("-");
   var curNode = rootNode;
   for (var i = 0; i < pathNodeArray.length; i++) {
    var index = parseInt(pathNodeArray[i], 10);
    curNode = curNode.childNodes[index];
   }
   return curNode;
  }
  else
   return null;
 }
});
ASPxClientSelectionNSOpera.RestoreByStartAndEndNodeCore = function(startNode, 
                 endNode, 
                 startNodeOffset, 
                 endNodeOffset, isCollapsed,
                 docObj, windowObj) {
 var curSelection = windowObj.getSelection();
 ASPxClientSelectionNSOpera.SelectElementInDocument(startNode, docObj, windowObj);
 ASPxClientSelectionNSOpera.SelectElementInDocument(endNode, docObj, windowObj);
 if (_aspxIsExists(startNode))
  curSelection.collapse(startNode, startNodeOffset);
 if (_aspxIsExists(endNode) && !isCollapsed) {
  if (__aspxWebKitFamily)
   curSelection.setBaseAndExtent(startNode, startNodeOffset, endNode, endNodeOffset);
  else
   curSelection.extend(endNode, endNodeOffset);
 }
}
ASPxClientSelectionNSOpera.SelectElementInDocument = function(elem, docObj, windowObj, selectAllContent) {
 if (_aspxIsExists(elem)) {
  if (!_aspxIsExists(selectAllContent))
   selectAllContent = true;
  var range = docObj.createRange();
  range.selectNode(elem);
  if (__aspxOpera)
   range.selectNodeContents(elem);
  if (!selectAllContent)
   range.collapse(false);
  var selection = windowObj.getSelection();   
  if (__aspxWebKitFamily)
   selection.setBaseAndExtent(range.startContainer,range.startOffset,range.endContainer,range.endOffset);
  else {
   selection.removeAllRanges();   
   selection.addRange(range);
  }
 } 
}
ASPxCachedElementsManager = _aspxCreateClass(null, {
 constructor: function(htmlEditor) {
  this.htmlEditor = htmlEditor;
  this.selectedElements = { table: null, tableRow: null, tableCell: null };
  this.needGetElementFromSelection = { table: true, tableRow: true, tableCell: true };
 },
 ClearSeletedElements: function() {
  for (var key in this.selectedElements) {
   this.selectedElements[key] = null;
   this.needGetElementFromSelection[key] = true;
  }
 },
 GetSeletedElement: function(name) {
  return this.selectedElements[name];
 },
 SetSelectedElement: function(name, element) {
  this.selectedElements[name] = element;
  this.needGetElementFromSelection[name] = false;
 },
 NeedGetElementFromSelection: function(name) {
  return this.needGetElementFromSelection[name] && !_aspxIsExists(this.selectedElements[name]);
 }
});

var ASPxClientCommandConsts = {
 BOLD_COMMAND : "bold",
 ITALIC_COMMAND: "italic",
 UNDERLINE_COMMAND: "underline", 
 STRIKETHROUGH_COMMAND: "strikethrough",
 SUPERSCRIPT_COMMAND: "superscript",
 SUBSCRIPT_COMMAND: "subscript",
 JUSTIFYCENTER_COMMAND: "justifycenter",
 JUSTIFYLEFT_COMMAND: "justifyleft",
 INDENT_COMMAND: "indent",
 OUTDENT_COMMAND: "outdent",
 JUSTIFYRIGHT_COMMAND: "justifyright",
 JUSTIFYFULL_COMMAND: "justifyfull",
 FONTSIZE_COMMAND : "fontsize",
 FONTNAME_COMMAND : "fontname",
 FONTCOLOR_COMMAND: "forecolor",
 BACKCOLOR_COMMAND: "backcolor",
 FORMATBLOCK_COMMAND: "formatblock",
 APPLYCSS_COMMAND: "applycss",
 REMOVEFORMAT_COMMAND: "removeformat",
 UNDO_COMMAND: "undo",
 REDO_COMMAND: "redo",
 COPY_COMMAND: "copy",
 KBCOPY_COMMAND: "kbcopy",
 PASTE_COMMAND: "paste",
 KBPASTE_COMMAND: "kbpaste",
 PASTEFROMWORD_COMMAND: "pastefromword", 
 PASTEFROMWORDDIALOG_COMMAND: "pastefromworddialog",
 CUT_COMMAND: "cut",
 KBCUT_COMMAND: "kbcut",
 SELECT_ALL: "selectall",
 DELETE_COMMAND: "delete", 
 KBDELETE_COMMAND: "kbdelete",
 TEXTTYPE_COMMAND: "texttype",
 NEWPARAGRAPHTYPE_COMMAND: "newparagraphtype",
 LINEBREAKETYPE_COMMAND: "linebreaktype",
 PASTEHTML_COMMAND: "pastehtml",
 RESIZEOBJECT_COMMAND: "resizeobject",
 DRAGDROPOBJECT_COMMAND: "dragdropobject",
 DROPOBJECTFROMEXTERNAL_COMMAND: "dropobjectfromexternal",
 INSERTORDEREDLIST_COMMAND: "insertorderedlist",
 INSERTUNORDEREDLIST_COMMAND: "insertunorderedlist",
 UNLINK_COMMAND: "unlink",
 INSERTLINK_COMMAND: "insertlink",
 INSERTIMAGE_COMMAND: "insertimage",
 CHANGEIMAGE_COMMAND: "changeimage",
 CHECKSPELLING_COMMAND: "checkspelling",
 INSERTIMAGE_DIALOG_COMMAND: "insertimagedialog",
 CHANGEIMAGE_DIALOG_COMMAND: "changeimagedialog",
 INSERTLINK_DIALOG_COMMAND: "insertlinkdialog",
 CHANGELINK_DIALOG_COMMAND: "changelinkdialog",
 INSERTTABLE_DIALOG_COMMAND: "inserttabledialog",
 TABLEPROPERTIES_DIALOG_COMMAND: "tablepropertiesdialog",
 TABLECELLPROPERTIES_DIALOG_COMMAND: "tablecellpropertiesdialog",
 TABLECOLUMNPROPERTIES_DIALOG_COMMAND: "tablecolumnpropertiesdialog",
 TABLEROWPROPERTIES_DIALOG_COMMAND: "tablerowpropertiesdialog",
 PRINT_COMMAND: "print",
 INSERTTABLE_COMMAND: "inserttable",
 CHANGETABLE_COMMAND: "changetable",
 CHANGETABLECELL_COMMAND: "changetablecell",
 CHANGETABLEROW_COMMAND: "changetablerow",
 CHANGETABLECOLUMN_COMMAND: "changetablecolumn",
 DELETETABLE_COMMAND: "deletetable",
 DELETETABLEROW_COMMAND: "deletetablerow",
 DELETETABLECOLUMN_COMMAND: "deletetablecolumn",
 INSERTTABLECOLUMNTOLEFT_COMMAND: "inserttablecolumntoleft",
 INSERTTABLECOLUMNTORIGHT_COMMAND: "inserttablecolumntoright", 
 INSERTTABLEROWBELOW_COMMAND: "inserttablerowbelow",
 INSERTTABLEROWABOVE_COMMAND: "inserttablerowabove",
 SPLITTABLECELLHORIZONTALLY_COMMAND: "splittablecellhorizontally",
 SPLITTABLECELLVERTICALLY_COMMAND: "splittablecellvertically", 
 MERGETABLECELLRIGHT_COMMAND: "mergetablecellright",
 MERGETABLECELLDOWN_COMMAND: "mergetablecelldown",
 CheckSpellingCore_COMMAND: "checkspellingcore",
 Start_COMMAND: "start"
};
var ASPxCommandMessageConsts = new Object();
ASPxCommandMessageConsts[ASPxClientCommandConsts.CUT_COMMAND] = "Please use Ctrl+X to Cut";
ASPxCommandMessageConsts[ASPxClientCommandConsts.PASTE_COMMAND] = "Please use Ctrl+V to Paste";
ASPxCommandMessageConsts[ASPxClientCommandConsts.COPY_COMMAND] = "Please use Ctrl+C to Copy";
Command = _aspxCreateClass(null, {
 constructor: function(cmdID) {
  this.commandID = cmdID;
 },
 Execute: function(cmdValue, editor) {
  return true;
 },
 GetCommandID: function() {
  return this.commandID;
 }, 
 GetState: function(editor) {
  return true;
 },
 GetValue: function(editor) {
  return null;
 },
 IsDefaultAction: function() {
  return false; 
 },
 IsImmediateExecution: function() {
  return false;
 },
 IsHtmlChangeable: function() {
  return true;
 },
 IsLocked: function(editor) {
  return false;
 },
 IsReversable: function() {
  return true;
 }
});
HtmlProcessingCommand = _aspxCreateClass(Command, {
 SaveSelectionRangeInfo: function(selectionInfo, editor) {
  this.startR = null;
  this.endR = null;  
  if (__aspxIE && !selectionInfo.IsControl()) {
   var range = editor.GetDesignViewIFrameDocument().selection.createRange();
   this.startR = range.duplicate();
   this.endR = range.duplicate();
   this.startR.collapse();
   this.endR.collapse(false);
  }
 },
 RestoreSelectionRange: function(editor) {
  if (__aspxIE) {
   try {
    var newRange = editor.GetDesignViewIFrameDocument().selection.createRange();
    newRange.setEndPoint("StartToStart",this.startR);
    newRange.setEndPoint("EndToEnd",this.endR);
    newRange.select();
   }
   catch (e) {
   }
  } else {
   if (__aspxOpera)
    editor.GetDesignViewIFrameDocument().body.focus();
   if (!__aspxWebKitFamily) {
    var selection = editor.GetDesignViewIFrameWindow().getSelection();
    var rng = selection.getRangeAt(0);
    rng.collapse(false);
   }
  }
 }
});
BrowserCommand = _aspxCreateClass(Command, {
 Execute: function(cmdValue, editor) {
  Command.prototype.Execute.call(this);
  var contentAreaDoc = editor.GetDesignViewIFrameDocument();
  if (!this.NeedUseCss())
      contentAreaDoc.execCommand(this.GetUseCSSCommandName(), false, false);
     var isSuccessfully = contentAreaDoc.execCommand(this.GetCommandName(), false, this.GetCorrectedValue(cmdValue));
  if (!this.NeedUseCss())
      contentAreaDoc.execCommand(this.GetUseCSSCommandName(), false, true);
  editor.SetFocus();
  return isSuccessfully;
 },
 GetCommandName: function() {
  return this.commandID;
 }, 
 GetCorrectedValue: function(value) {
  return value;  
 },
 GetState: function(editor) {
  var ret = true;
  if (!this.IsAlwaysEnabledCommand(this.commandID)) {      
   try {
    ret = this.TryGetState(editor);
   }
   catch(ex) { ret = false; }
  }
  return ret;
 },
 GetValue: function(editor) {  
  var ret = null;
  try {
   ret = this.TryGetValue(editor);
  }
  catch(e) {}
  return ret;
 },
 GetUseCSSCommandName: function(doc) {
  return __aspxNetscapeFamily ? "styleWithCSS" : "useCSS";
 },
 IsLocked: function(editor) {
  var ret = this.TryGetIsLocked(editor);
  if (__aspxOpera && ret) {
   try { 
    ret = !this.TryGetState(editor); 
   }
   catch(ex) { ret = false; }
  }
  return ret;
 },
 TryGetState: function(editor) {
  return editor.GetDesignViewIFrameDocument().queryCommandState(this.GetCommandName()); 
 },
 TryGetValue: function(editor) {
  return editor.GetDesignViewIFrameDocument().queryCommandValue(this.GetCommandName());
 },
 TryGetIsLocked: function(editor) {
  try {
   return !editor.GetDesignViewIFrameDocument().queryCommandEnabled(this.GetCommandName());
  } catch(e) {}
  return true;
 },
 IsAlwaysEnabledCommand: function(commandID) {
  return this.commandID == ASPxClientCommandConsts.FONTSIZE_COMMAND || this.commandID == ASPxClientCommandConsts.FONTNAME_COMMAND;
 },
 NeedUseCss: function() {
  return true;
 }
});
var __aspxHEFakeElementClassName = "dxHClass";
ApplyCssCommand = _aspxCreateClass(HtmlProcessingCommand, {
 Execute: function(cmdValue, editor) {
  cmdValue.tagName = _aspxTrim(cmdValue.tagName);
  cmdValue.cssClass = _aspxTrim(cmdValue.cssClass);
  if (this.IsExclusionTagName(cmdValue.tagName)) return false;
  var curSelection = ASPxClientHtmlEditorSelection.Create(editor);
  this.SaveSelectionRangeInfo(curSelection, editor);
  var parentTagName = curSelection.GetParentElement().tagName.toUpperCase();
  if (this.IsExclusionTagName(parentTagName) && (cmdValue.tagName == "")) {
   this.SetClassNameAttribute(curSelection.GetParentElement(), cmdValue.cssClass);
  }
  else if (curSelection.GetText()!= "") {
   var selInfo = editor.GetEditorSelectionInfo(true);
   for (var i = 0; i < selInfo.allElements.length; i++) {
    var curElem = selInfo.allElements[i];    
    var targetParentElem = this.GetEqualParentElement(curElem, cmdValue.tagName, cmdValue.cssClass);
    if (!_aspxIsExists(targetParentElem)) {
     var elemInnerHtml = curElem.innerHTML;
     var newElement = null;
     if (cmdValue.tagName) {
      var newElement = null;
      targetParentElem = this.GetParentElementWithTagName(curElem, cmdValue.tagName);
      if (_aspxIsExists(targetParentElem)) 
       this.SetClassNameAttribute(targetParentElem, cmdValue.cssClass);
      else {
       newElement = editor.GetDesignViewIFrameDocument().createElement(cmdValue.tagName);
       this.SetClassNameAttribute(newElement, cmdValue.cssClass);
       }
     }
     else { 
      newElement = editor.GetDesignViewIFrameDocument().createElement("span");
      this.SetClassNameAttribute(newElement, __aspxHEFakeElementClassName);
      newElement.className += " " + cmdValue.cssClass;
     }
     if (newElement) {
      _aspxSetInnerHtml(newElement, elemInnerHtml);
      curElem.innerHTML = '';
      curElem.appendChild(newElement);
     }
    }
   }
   editor.DeleteNewAddedFontElements(selInfo);
   if (cmdValue.tagName == "")
    this.OptimizeChildCssClass(editor.GetDesignViewIFrameDocument().body, cmdValue.cssClass);
  }
  this.RestoreSelectionRange(editor);
  return true;
 },   
 GetValue: function(editor) {
  return (__aspxIE) ? this.GetValueIE(editor) : this.GetValueMoz(editor);
 },
 GetValueIE : function(editor) {    
  var contentAreaDoc = editor.GetDesignViewIFrameDocument();
  var curSelection = contentAreaDoc.selection;
  if (!curSelection) return "";
  var selRange = curSelection.createRange();
  var parentElement = (selRange.length > 0 ? selRange(0) : selRange.parentElement());
  return this.GetValueByElement(parentElement);
 },
 GetValueMoz: function(editor) {
  var contentWindow = editor.GetDesignViewIFrameWindow(); 
  var curSelection = contentWindow.getSelection();
  if (!curSelection || curSelection.rangeCount != 1) return "";
  var startNode = (curSelection.anchorNode.nodeType != 3
       ? curSelection.anchorNode
       : curSelection.anchorNode.parentNode);
  var endNode = (curSelection.focusNode.nodeType != 3
       ? curSelection.focusNode
       : curSelection.focusNode.parentNode);       
  if (startNode != endNode)
   return "";
  var restoreSelection = ASPxClientHtmlEditorSelection.Create(editor);
  return this.GetValueByElement(restoreSelection.GetParentElement());
 },
 GetValueByElement: function(element) {
  var tagName = "";
  var cssClass = "";
  if (element && element.nodeType == 1 && element.tagName.toLowerCase() != "body") {
   tagName = element.tagName.toLowerCase();
   cssClass = element.className;
  }
  return { tagName: tagName, cssClass: cssClass };
 },
 IsExclusionTagName: function(tagName) {
  tagName = tagName.toUpperCase();
  return tagName == "IMG" || tagName == "TABLE" || tagName == "OBJECT" || tagName == "EMBED";
 },
 OptimizeChildCssClass: function(parentElement, targetCssClass) {
  var fakeElementCollection = _aspxGetChildsByClassName(parentElement, __aspxHEFakeElementClassName);
  var newElementArray = new Array();
  for (var i = 0; i < fakeElementCollection.length; i++) {
   var newElement = this.TryRemoveFakeElement(fakeElementCollection[i], targetCssClass);
   if (!newElement)
    this.RemoveFakeCssClass(fakeElementCollection[i]);
   else
    _aspxArrayPush(newElementArray, newElement);
  }
  this.TryMoveCssClassToParent(newElementArray, targetCssClass);
 },
 TryRemoveFakeElement: function(fakeElement, targetCssClass) {
  var parentElement = fakeElement.parentNode;
  var ret = null;
  if ((parentElement.tagName.toUpperCase() != "BODY") && 
    (parentElement.childNodes.length == 1)) {
   var elemInnerHtml = fakeElement.innerHTML;
   _aspxRemoveElement(fakeElement);
   _aspxSetInnerHtml(parentElement, elemInnerHtml);
   this.SetClassNameAttribute(parentElement, targetCssClass);
   ret = parentElement;
  } else if(targetCssClass == "")
   _aspxRemoveOuterTags(fakeElement);
  return ret;
 },
 TryMoveCssClassToParent: function(elements, targetCssClass) {
  for (var i = 0; i < elements.length; i++) {
   var parentElement = elements[i].parentNode;
   var parentElementTagName = parentElement.tagName.toUpperCase();
   if ((parentElementTagName == "OL" || parentElementTagName == "UL") && 
    (elements[i].className == targetCssClass)) {
    this.ProcessListElements(parentElement, targetCssClass);
   }
  }
 },
 ProcessListElements: function(mainListElement, targetCssClass) {
  var listItemElements = _aspxGetElementsByTagName(mainListElement, "li");
  var isAllItemNeedClear = true;
  for (var i = 0 ; i< listItemElements.length; i++) {
   if (listItemElements[i].className != targetCssClass) {
    isAllItemNeedClear = false;
    return;
   }
  }
  if (isAllItemNeedClear) {
   this.SetClassNameAttribute(mainListElement, targetCssClass);
   for (var i = 0 ; i< listItemElements.length; i++)
    this.SetClassNameAttribute(listItemElements[i], "");
  }
 },
 RemoveFakeCssClass: function(sourceElement) {
  var sourceCssClass = sourceElement.className;
  sourceCssClass = sourceCssClass.replace(__aspxHEFakeElementClassName, "");
  sourceCssClass = _aspxTrim(sourceCssClass);
  sourceElement.className = sourceCssClass;
 },
 GetParentElementWithTagName: function(element, tagName) {
  var parentElement = element.parentNode;
  return  parentElement.tagName.toUpperCase() == tagName.toUpperCase() ? parentElement : null;
 },
 GetEqualParentElement: function(elem, tagName, cssClass) {
  var ret = null;
  if (tagName && cssClass)
   ret = _aspxGetParentByTagNameAndAttributeValue(elem, tagName, "class", cssClass);
  else if (cssClass)
   ret = _aspxGetParentByClassName(elem);
  return ret;
 }, 
 SetClassNameAttribute: function(element, className) {
  if (className)
   element.className = className;
  else
   _aspxRemoveAttribute(element, __aspxNetscapeFamily ? "class" : "className");
 }
});
FontColorBrowserCommand = _aspxCreateClass(BrowserCommand, {
 Execute: function(cmdValue, editor) {
  if (!cmdValue)
   cmdValue = editor.currentFontColor;
  else
   editor.currentFontColor = cmdValue;
   return BrowserCommand.prototype.Execute.call(this, cmdValue, editor);
 },
 GetValue: function(editor) {
  return _aspxColorToHexadecimal(BrowserCommand.prototype.GetValue.call(this, editor));
 },
 NeedUseCss: function() {
  return !__aspxNetscapeFamily;
 },
 TryGetValue: function(editor) {
  return editor.currentFontColor;
 }
});
FontSizeBrowserCommand  = _aspxCreateClass(BrowserCommand, {
 GetValue: function(editor) {
  var value = BrowserCommand.prototype.GetValue.call(this, editor);
  if (__aspxWebKitFamily) {
   var index = _aspxGetDefaultSafariFontSizesInPixelHashTable()[value];
   value = index > -1 ? index + 1 : null;
  }
  return value;
 }
});
BgColorBrowserCommand = _aspxCreateClass(FontColorBrowserCommand, {
 Execute: function(cmdValue, editor) {
  if (!cmdValue)
   cmdValue = editor.currentBgColor;
  else
   editor.currentBgColor = cmdValue;
  BrowserCommand.prototype.Execute.call(this, cmdValue, editor);
 },
 GetCommandName: function() {
  return __aspxIE ? BrowserCommand.prototype.GetCommandName.call(this) : "HiliteColor";
 },
 NeedUseCss: function() {
  return true;
 },
 TryGetValue: function(editor) {
  return editor.currentBgColor;
 }
});
InsertListCommand = _aspxCreateClass(BrowserCommand, {
 GetState: function(editor) {
  var curSelection = ASPxClientHtmlEditorSelection.Create(editor);
  var tagName = "";
  switch (this.GetCommandName()) {
   case ASPxClientCommandConsts.INSERTORDEREDLIST_COMMAND:
    tagName = "OL";break;
   case ASPxClientCommandConsts.INSERTUNORDEREDLIST_COMMAND:
    tagName = "UL";break;
  }
  return _aspxIsExists(_aspxGetParentByTagName(curSelection.GetParentElement(), tagName));
 }
});
InsertListCommand = _aspxCreateClass(BrowserCommand, {
 GetState: function(editor) {
  var curSelection = ASPxClientHtmlEditorSelection.Create(editor);
  var tagName = "";
  switch (this.GetCommandName()) {
   case ASPxClientCommandConsts.INSERTORDEREDLIST_COMMAND:
    tagName = "OL";break;
   case ASPxClientCommandConsts.INSERTUNORDEREDLIST_COMMAND:
    tagName = "UL";break;
  }
  return _aspxIsExists(_aspxGetParentByTagName(curSelection.GetParentElement(), tagName));
 }
});
IndentCommand = _aspxCreateClass(BrowserCommand, {
 Execute: function(cmdValue, editor) {
  var curSelection = ASPxClientHtmlEditorSelection.Create(editor);
  var selectedList = IndentCommand.GetMainParentList(curSelection.GetParentElement());
  if (_aspxIsExists(selectedList))
   this.IndentList(selectedList, curSelection, editor);
  else
   BrowserCommand.prototype.Execute.call(this, cmdValue, editor);
  return true;
 },
 GetState: function(editor) {
  return false;
 },
 IsLocked: function(editor) {
  if (__aspxOpera)
   return this.TryGetIsLocked(editor);
  return BrowserCommand.prototype.IsLocked.call(this, editor);
 },
 TryGetIsLocked: function(editor) {
  var isLocked = false;
  var curSelection = ASPxClientHtmlEditorSelection.Create(editor);
  var selectedList = IndentCommand.GetParentList(curSelection.GetParentElement());
  if (_aspxIsExists(selectedList)) {
   selectedList = IndentCommand.GetMainParentList(curSelection.GetParentElement());
   isLocked = !this.IsIndentionAllowed(selectedList,
            curSelection.GetStartContainer(),
            curSelection.GetEndContainer(), editor);
  }
  else
   isLocked = BrowserCommand.prototype.TryGetIsLocked.call(this, editor);
  return isLocked;
 },
 IndentList: function(listNode, selection, editor) {
  var bookmark = selection.GetExtendedBookmark();
  selection = ASPxClientHtmlEditorSelection.Create(editor);
  var newlistNode = IndentCommand.IndentListCore(listNode, selection.GetStartContainer(),
              selection.GetEndContainer(), this.GetIndent());
  listNode.parentNode.replaceChild(newlistNode, listNode);
  selection.SelectExtendedBookmark(bookmark);
  if (!__aspxIE) 
   editor.SetFocus();
 },
 IsIndentionAllowed: function(listNode, startItemNode, endItemNode, htmlEditor) {
  startItemNode = IndentCommand.EnsureListItemNode(startItemNode);
  endItemNode = IndentCommand.EnsureListItemNode(endItemNode);
  var indent = this.GetIndent();
  var listItemArray = IndentCommand.GetListItemArray(listNode, 0, null);
  listItemArray = IndentCommand.IndentListItemsInItemArray(listItemArray, startItemNode, endItemNode, indent);
  if (listItemArray == null || listItemArray[0].level != 0)
   return false;
  for (var i = 1; i < listItemArray.length; i++) {
   if (indent > 0) {
    if (listItemArray[i].level - listItemArray[i - 1].level > indent)
     return false;
   }
   else if (listItemArray[i].level < 0)
    return false;
  }
  return true;
 },
 GetIndent: function() {
  var indent = 0;
  switch (this.GetCommandName()) {
   case ASPxClientCommandConsts.INDENT_COMMAND:
    indent = 1; break;
   case ASPxClientCommandConsts.OUTDENT_COMMAND:
    indent = -1; break;
  }
  return indent;
 }
});
IndentCommand.IndentListCore = function(listNode, startNode, endNode, indent) {
 startNode = IndentCommand.EnsureListItemNode(startNode);
 endNode = IndentCommand.EnsureListItemNode(endNode);
 var listItemArray = IndentCommand.GetListItemArray(listNode, 0, null);
 var itemArray = IndentCommand.IndentListItemsInItemArray(listItemArray, startNode, endNode, indent);
 return IndentCommand.GenerateListByItemArray(itemArray);
}
IndentCommand.GetListItemArray = function(listNode, currentLevel, itemArray, parentItemIndex) {
 if (!_aspxIsExists(itemArray))
  itemArray = new Array();
 if (!_aspxIsExists(parentItemIndex))
  parentItemIndex = -1;
 var curListItem = _aspxGetChildByTagName(listNode, "LI" ,0); 
 while(_aspxIsExists(curListItem)) {
  _aspxArrayPush(itemArray, { 'level': currentLevel, 'node' : curListItem, 'parentItemIndex' : parentItemIndex });
  var nestedListNode = IndentCommand.GetChildList(curListItem);
  if (_aspxIsExists(nestedListNode))
   itemArray = IndentCommand.GetListItemArray(nestedListNode, currentLevel + 1, itemArray, itemArray.length - 1);
  curListItem = IndentCommand.GetNextListItem(curListItem);
 }
 return itemArray;
}
IndentCommand.IndentListItemsInItemArray = function(itemArray, startListItem, endListItem, indent) {
 var startItemIndex = -1;
 var endItemIndex = -1;
 for (var i = 0; i < itemArray.length; i++) {
  if (itemArray[i].node == startListItem)
   startItemIndex = i;
  if (itemArray[i].node == endListItem)
   endItemIndex = i;
  if (startItemIndex != -1 && endItemIndex != -1)
   break;
 }
 if (startItemIndex == -1 || endItemIndex == -1)
  return null;
 for (var i = startItemIndex; i <= endItemIndex; i++)
  itemArray[i].level += indent;
 if (indent < 0) {
  for (var i = 0; i < itemArray.length; i++) {
   if (itemArray[i].parentItemIndex != -1) {
    var parentLevel = itemArray[itemArray[i].parentItemIndex].level;
    if (itemArray[i].level - parentLevel > 1)
     itemArray[i].level += indent;
   }
  }
 }
 return itemArray;
}
IndentCommand.GenerateListByItemArray = function(itemArray) {
 if (itemArray.length <= 0)
  return null;
 var doc = itemArray[0].node.document;
 var listNodeByLevel = [];
 var listItemNodeArray = [];
 var curLevel = 0;
 for (var i = 0; i < itemArray.length; i++) {
  var curItem = itemArray[i];
  if (curLevel > curItem.level) {
   for (var j = curItem.level + 1; j <= curLevel; j++)
    listNodeByLevel[j] = null;
  }
  if (!_aspxIsExists(listNodeByLevel[curItem.level])) {
   var oldListNode = IndentCommand.GetParentList(curItem.node);
   var newListNode = oldListNode.cloneNode(false);
   listNodeByLevel[curItem.level] = newListNode;
   if (curItem.level - 1 >= 0)
    listItemNodeArray[curItem.level - 1].appendChild(newListNode);
  }
  var clonedListItem = IndentCommand.CloneListItem(curItem.node, doc);
  listItemNodeArray[curItem.level] = clonedListItem;
  listNodeByLevel[curItem.level].appendChild(clonedListItem);
  curLevel = curItem.level;
 }
 return listNodeByLevel[0];
}
IndentCommand.EnsureListItemNode = function(node) {
 while (node) {
  var tagName = "";
  var parentNode = node.parentNode;
  if (parentNode && parentNode.nodeType == 1)
   tagName = parentNode.tagName.toUpperCase();
  if (tagName == "OL" || tagName == "UL")
   break;
  node = parentNode;
 }
 return node;
}
IndentCommand.CloneListItem = function(item, doc) {
 var newItem = item.cloneNode(true);
 newItem.innerHTML = "";
 for (var i = 0 ; i < item.childNodes.length; i++) {
  var tagName = item.childNodes[i].tagName;
  tagName = _aspxIsExists(tagName) ? tagName.toUpperCase() : "";
  if ((tagName != "UL") && (tagName != "OL"))
   newItem.appendChild(item.childNodes[i].cloneNode(true));
 }
 return newItem;
}
IndentCommand.GetChildList = function(elem) {
 for (var i = 0 ; i < elem.childNodes.length; i++) {
  var tagName = elem.childNodes[i].tagName;
  tagName = _aspxIsExists(tagName) ? tagName.toUpperCase() : ""; 
  if ((tagName == "UL") || (tagName == "OL"))
   return elem.childNodes[i];
 }
 return null;
}
IndentCommand.GetNextListItem = function(listItemNode) {
 var nextListItemNode = listItemNode.nextSibling;
 while (nextListItemNode != null && nextListItemNode.nodeType != 1)
  nextListItemNode = nextListItemNode.nextSibling;
 return nextListItemNode;
}
IndentCommand.GetMainParentList = function(elem) {
 var lastListNode = null;
 while (elem) {
  if (elem.nodeType == 1) {
   var tagName = elem.tagName.toUpperCase();
   if (tagName == "UL" || tagName == "OL")
    lastListNode = elem;
  }
  elem = elem.parentNode;
 }
 return lastListNode;
}
IndentCommand.GetParentList = function(elem) {
 var selectedList = _aspxGetParentByTagName(elem, "OL");
 if (!_aspxIsExists(selectedList))
  selectedList = _aspxGetParentByTagName(elem, "UL");
 return selectedList;
}
var __aspxEmptyBorderTableClassName = "dxEmptyBorderTable";
var __aspxHESizeTypeRegExp = new RegExp("([0-9]*[,.]?[0-9]*)(px|%)");
var _aspxHETableHelper = {
 AppendEmptyBorderClassName: function(elem) {
  if (elem.className.indexOf(__aspxEmptyBorderTableClassName) > -1)
   return;
  elem.className += " " + __aspxEmptyBorderTableClassName;
 },
 IsEmptyBorder: function(table) {
  if (!_aspxIsExists(table))
   return false;
  return table.border == "0" || !_aspxIsExists(table.border) || table.border == "";
 },
 ReplaceTableStyleBorderByAttribute: function(table) {
  var tableStyle = table.style;
  if (tableStyle.borderLeftColor &&
   (tableStyle.borderLeftColor == tableStyle.borderRightColor) &&
   (tableStyle.borderRightColor == tableStyle.borderBottomColor) &&
   (tableStyle.borderBottomColor == tableStyle.borderTopColor)) {
   this.SetTableBorderColor(table, tableStyle.borderBottomColor);
   tableStyle.borderLeftColor = "";
   _aspxRemoveStyleAttribute(tableStyle, "borderLeftColor");
   tableStyle.borderRightColor = "";
   _aspxRemoveStyleAttribute(tableStyle, "borderRightColor");
   tableStyle.borderTopColor = "";
   _aspxRemoveStyleAttribute(tableStyle, "borderTopColor");
   tableStyle.borderBottomColor = "";
   _aspxRemoveStyleAttribute(tableStyle, "borderBottomColor");
  }
 },
 RemoveEmptyBorderClassName: function(elem) {
  elem.className = elem.className.replace(__aspxEmptyBorderTableClassName, "");
 },
 GetTable: function(element) {
  return _aspxGetParentByTagName(element, "TABLE");
 },
 GetTableRow: function(elem) {
  if (elem && elem.nodeType == 1 && elem.tagName.toUpperCase() == "TR")
   return elem;
  var cell = this.GetTableCell(elem);
  if (_aspxIsExists(cell))
   return cell.parentNode;
  return null;
 },
 GetTableCellBySelection: function(startElem, endElem) {
  var cell = _aspxHETableHelper.GetTableCell(startElem);
  if (!_aspxIsExists(cell) && endElem != null) {
   cell = _aspxHETableHelper.GetTableCell(endElem);
   if (__aspxSafari && startElem && startElem.tagName.toUpperCase() == "TR") { 
    var index = cell.cellIndex - 1;
    if (index < 0)
     cell = startElem.cells[startElem.cells.length - 1];
    else
     cell = startElem.cells[index];
   }
  }
  return cell;
 },
 GetTableCell: function(element) {
  if (!element)
   return null;
  if (element.nodeType == "1" &&
   (element.tagName.toUpperCase() == "TD" || element.tagName.toUpperCase() == "TH"))
   return element;
  var cell = _aspxGetParentByTagName(element, "TD");
  if (!_aspxIsExists(cell))
   cell = _aspxGetParentByTagName(element, "TH");
  return cell;
 },
 GetTableProperties: function(table) {
  var tableInfoObject = {
   borderWidth: 0,
   borderColor: null,
   backgroundColor: null,
   width: null,
   height: null,
   cellPadding: 0,
   cellSpacing: 0,
   align: null,
   accessibility: null
  };
  if (table.className.indexOf(__aspxEmptyBorderTableClassName) == -1) {
   if (_aspxIsExists(table.border))
    tableInfoObject.borderWidth = table.border;
   var borderColor = this.GetTableBorderColor(table);
   if (_aspxIsExists(borderColor))
    tableInfoObject.borderColor = borderColor;
  }
  if (table.style.backgroundColor)
   tableInfoObject.backgroundColor = table.style.backgroundColor;
  if (table.style.width)
   tableInfoObject.width = table.style.width;
  if (table.style.height)
   tableInfoObject.height = table.style.height;
  tableInfoObject.cellPadding = table.cellPadding;
  tableInfoObject.cellSpacing = table.cellSpacing;
  if (table.align)
   tableInfoObject.align = table.align;
  var accessibility = { caption: "", summary: "", headers: "" };
  accessibility.headers = this.GetAccessibilityHeadersValue(table);
  accessibility.caption = this.GetAccessibilityCaption(table);
  accessibility.summary = table.summary;
  tableInfoObject.accessibility = accessibility;
  return tableInfoObject;
 },
 SetTableProperties: function(table, properties, htmlEditor) {
  if (properties) {
   if (_aspxIsExists(properties.borderWidth))
    this.SetTableBorderWidth(table, properties.borderWidth, htmlEditor);
   if (_aspxIsExists(properties.borderColor))
    this.SetTableBorderColor(table, properties.borderColor);
   this.SetBackgroundColor(table, properties.backgroundColor);
   table.cellSpacing = properties.cellSpacing;
   table.cellPadding = properties.cellPadding;
   if (properties.width)
    table.style.width = properties.width;
   else if (_aspxIsExists(table.style.width)) {
    _aspxRemoveAttribute(table, "width");
    _aspxRemoveStyleAttribute(table, "width");
   }
   if (properties.height)
    table.style.height = properties.height;
   else if (_aspxIsExists(table.style.height)) {
    _aspxRemoveAttribute(table, "height");
    table.style.height = "";
    _aspxRemoveStyleAttribute(table, "height");
   }
   if (properties.align)
    table.align = properties.align;
   else if (_aspxIsExists(table.align)) {
    table.align = "";
    _aspxRemoveAttribute(table, "align");
   }
   if (properties.accessibility)
    this.SetTableAccessibility(table, properties.accessibility);
  }
 },
 SetTableBorderWidth: function(table, borderWidth, htmlEditor) {
  if (__aspxFirefox && table.style.borderCollapse == "collapse") {
   var tempTableId = ASPxClientSelection.GetMarkerID();
   _aspxChangeAttribute(table, "id", tempTableId);
   table.style.borderCollapse = "separate";
   this.currentHtmlEditor = htmlEditor;
   _aspxSetTimeout("_aspxHETableHelper.SetTableBorderWidthDelay('" + tempTableId + "'," + borderWidth + ")", 100);
  }
  else {
   _aspxSetAttribute(table, "border", borderWidth);
   this.SetEmptyTableBorderClass(table);
  }
 },
 SetTableBorderWidthDelay: function(tableId, borderWidth) {
  var table = _aspxGetElementByIdInDocument(this.currentHtmlEditor.GetDesignViewIFrameDocument(), tableId);
  _aspxSetAttribute(table, "border", borderWidth);
  table.style.borderCollapse = "collapse";
  _aspxRestoreAttribute(table, "id");
  this.SetEmptyTableBorderClass(table);
  this.currentHtmlEditor.commandManager.UpdateLastItemInRestoreHtmlArray();
  this.currentHtmlEditor = null;
 },
 SetEmptyTableBorderClass: function(table) {
  if (this.IsEmptyBorder(table))
   this.AppendEmptyBorderClassName(table);
  else
   this.RemoveEmptyBorderClassName(table);
 },
 GetCellProperties: function(cell) {
  var cellInfo = {
   backgroundColor: null,
   align: null,
   vAlign: null
  };
  if (cell.style.textAlign)
   cellInfo.align = cell.style.textAlign;
  if (cell.style.verticalAlign)
   cellInfo.vAlign = cell.style.verticalAlign;
  if (cell.style.backgroundColor)
   cellInfo.backgroundColor = cell.style.backgroundColor;
  return cellInfo;
 },
 SetCellProperties: function(cell, properties) {
  if (properties.vAlign)
   cell.style.verticalAlign = properties.vAlign.toLowerCase();
  else if (_aspxIsExists(cell.vAlign))
   _aspxRemoveStyleAttribute(cell, "verticalAlign");
  if (properties.align)
   cell.style.textAlign = properties.align.toLowerCase();
  else if (_aspxIsExists(cell.align))
   _aspxRemoveStyleAttribute(cell, "textAlign");
  this.SetBackgroundColor(cell, properties.backgroundColor);
 },
 SetCellPropertiesForAllCell: function(table, properties) {
  for (var i = 0; i < table.rows.length; i++) {
   for (var j = 0; j < table.rows[i].cells.length; j++)
    this.SetCellProperties(this.GetCell(table, i, j), properties);
  }
 },
 SetColumnProperties: function(cell, properties) {
  var table = _aspxGetParentByTagName(cell, "TABLE");
  var row = cell.parentNode;
  var tableModel = _aspxHETableHelper.CreateTableModel(table);
  var columnIndex = this.GetColumnIndexByTableModel(tableModel, row.rowIndex, cell);
  var colSpan = this.GetColSpan(cell);
  for (var i = 0; i < tableModel.length; i++) {
   for (var j = columnIndex; j < columnIndex + colSpan; j++) {
    var curCell = tableModel[i][j];
    if (this.GetColSpan(curCell) <= colSpan) {
     this.SetCellProperties(curCell, properties);
     if (properties.width)
      curCell.style.width = properties.width;
     else if (_aspxIsExists(curCell.style.width)) {
      curCell.style.width = "";
      _aspxRemoveStyleAttribute(curCell, "width");
     }
    }
   }
  }
 },
 GetColumnProperties: function(cell) {
  var columnInfo = {
   backgroundColor: null,
   width: null,
   align: null,
   vAlign: null
  };
  var table = _aspxGetParentByTagName(cell, "TABLE");
  var row = cell.parentNode;
  var tableModel = _aspxHETableHelper.CreateTableModel(table);
  var columnIndex = this.GetColumnIndexByTableModel(tableModel, row.rowIndex, cell);
  var colSpan = this.GetColSpan(cell);
  var curCellInfo = this.GetCellProperties(cell);
  var align = columnInfo.align = curCellInfo.align;
  var vAlign = columnInfo.vAlign = curCellInfo.vAlign;
  var backgroundColor = columnInfo.backgroundColor = curCellInfo.backgroundColor;
  var maxCellWidth = 0;
  var isWidthDefined = true;
  for (var i = 0; i < tableModel.length; i++) {
   for (var j = columnIndex; j < columnIndex + colSpan; j++) {
    var curCell = tableModel[i][j];
    if (this.GetColSpan(curCell) <= colSpan) {
     var curCellInfo = this.GetCellProperties(curCell);
     if (curCell.style.width && _aspxGetClearClientWidth(curCell) > maxCellWidth)
      maxCellWidth = curCell.style.width;
     if (align != curCellInfo.align)
      columnInfo.align = null;
     if (vAlign != curCellInfo.vAlign)
      columnInfo.vAlign = null;
     if (backgroundColor != curCellInfo.backgroundColor)
      columnInfo.backgroundColor = null;
     if (isWidthDefined) {
      var curCellColSpan = this.GetColSpan(curCell);
      if (curCellColSpan != colSpan)
       isWidthDefined = false;
      else if (columnIndex != this.GetColumnIndexByTableModel(tableModel, i, curCell))
       isWidthDefined = false;
     }
    }
   }
  }
  if (isWidthDefined && this.ParseSizeString(maxCellWidth).value > 0)
   columnInfo.width = maxCellWidth;
  return columnInfo;
 },
 GetRowProperties: function(cell) {
  var rowInfo = {
   backgroundColor: null,
   height: null,
   align: null,
   vAlign: null
  };
  var table = _aspxGetParentByTagName(cell, "TABLE");
  var row = cell.parentNode;
  var tableModel = _aspxHETableHelper.CreateTableModel(table);
  var rowSpan = this.GetRowSpan(cell);
  var curCellInfo = this.GetCellProperties(cell);
  var align = rowInfo.align = curCellInfo.align;
  var vAlign = rowInfo.vAlign = curCellInfo.vAlign;
  var backgroundColor = rowInfo.backgroundColor = curCellInfo.backgroundColor;
  var maxCellHeight = 0;
  var isHeightDefined = true;
  for (var i = row.rowIndex; i < row.rowIndex + rowSpan; i++) {
   for (var j = 0; j < tableModel[i].length; j++) {
    var curCell = tableModel[i][j];
    if (this.GetRowSpan(curCell) <= rowSpan) {
     var curCellInfo = this.GetCellProperties(curCell);
     if (curCell.style.height && _aspxGetClearClientHeight(curCell) > maxCellHeight)
      maxCellHeight = curCell.style.height;
     if (align != curCellInfo.align)
      rowInfo.align = null;
     if (vAlign != curCellInfo.vAlign)
      rowInfo.vAlign = null;
     if (backgroundColor != curCellInfo.backgroundColor)
      rowInfo.backgroundColor = null;
     if (isHeightDefined) {
      var curCellRowSpan = this.GetRowSpan(curCell);
      if (curCellRowSpan != rowSpan)
       isHeightDefined = false;
      else if (row.rowIndex != curCell.parentNode.rowIndex)
       isHeightDefined = false;
     }
    }
   }
  }
  if (isHeightDefined && this.ParseSizeString(maxCellHeight).value > 0)
   rowInfo.height = maxCellHeight;
  return rowInfo;
 },
 SetRowProperties: function(cell, properties) {
  var table = _aspxGetParentByTagName(cell, "TABLE");
  var row = cell.parentNode;
  var tableModel = _aspxHETableHelper.CreateTableModel(table);
  var columnIndex = this.GetColumnIndexByTableModel(tableModel, row.rowIndex, cell);
  var rowSpan = this.GetRowSpan(cell);
  var rowIndex = row.rowIndex;
  for (var i = rowIndex; i < rowIndex + rowSpan; i++) {
   for (var j = 0; j < tableModel[i].length; j++) {
    if (this.GetRowSpan(tableModel[i][j]) <= rowSpan) {
     if (properties.vAlign)
      _aspxSetAttribute(tableModel[i][j], "vAlign", properties.vAlign.toLowerCase());
     else
      _aspxRemoveAttribute(tableModel[i][j], "vAlign");
     if (properties.align)
      _aspxSetAttribute(tableModel[i][j], "align", properties.align.toLowerCase());
     else
      _aspxRemoveAttribute(tableModel[i][j], "align");
     if (properties.height)
      tableModel[i][j].style.height = properties.height;
     else if (_aspxIsExists(tableModel[i][j].style.width)) {
      tableModel[i][j].style.height = "";
      _aspxRemoveStyleAttribute(tableModel[i][j], "height");
     }
     this.SetBackgroundColor(tableModel[i][j], properties.backgroundColor);
    }
   }
  }
 },
 SetTableAccessibility: function(table, properties) {
  if (properties.caption) {
   var caption = table.createCaption();
   caption.innerHTML = properties.caption;
  }
  else
   table.deleteCaption();
  if (properties.summary)
   table.summary = properties.summary;
  else
   _aspxRemoveAttribute(table, "summary");
  var hasColumnHeaders = this.GetHasColumnHeaders(table);
  var headers = properties.headers;
  this.SetRowAndBothHeaders(table, headers);
  this.SetColumnAndBothHeaders(table, headers, hasColumnHeaders);
 },
 SetColumnAndBothHeaders: function(table, headers, hasColumnHeaders) {
  if ((headers == 'column' || headers == 'both') && !this.GetHasColumnHeaders(table)) {
   for (var i = 0; i < table.rows.length; i++) {
    var newCell = _aspxReplaceTagName(table.rows[i].cells[0], 'TH');
    if (newCell != null && !(headers == 'both' && newCell.scope == 'col'))
     newCell.scope = 'row';
   }
  }
  if (hasColumnHeaders && headers != 'column' && headers != 'both') {
   for (var i = 0; i < table.rows.length; i++) {
    var row = table.rows[i];
    if (row.parentNode.nodeName.toUpperCase() == 'TBODY') {
     var newCell = _aspxReplaceTagName(row.cells[0], 'TD');
     if (newCell != null)
      newCell.removeAttribute('scope');
    }
   }
  }
 },
 SetRowAndBothHeaders: function(table, headers) {
  var hasRowHeaders = this.GetHasRowHeaders(table);
  if (!hasRowHeaders && (headers == 'row' || headers == 'both')) {
   var firstRow = table.rows[0];
   for (var i = 0; i < firstRow.childNodes.length; i++) {
    if (firstRow.childNodes[i].nodeType == 1) {
     var th = _aspxReplaceTagName(firstRow.childNodes[i], 'TH');
     if (_aspxIsExists(th))
      th.scope = 'col';
    }
   }
   var tHead = table.tHead;
   if (!_aspxIsExists(tHead))
    tHead = table.createTHead();
   if (tHead.childNodes.length == 0)
    tHead.appendChild(firstRow);
   for (var i = table.tBodies.length - 1; i >= 0; i--) {
    if (_aspxTrim(table.tBodies[i].innerHTML) == "")
     table.removeChild(table.tBodies[i]);
   }
  }
  if (hasRowHeaders && headers != 'row' && headers != 'both') {
   var firstRow = table.rows[0];
   for (var i = 0; i < firstRow.cells.length; i++) {
    var newCell = _aspxReplaceTagName(firstRow.cells[i], "TD");
    if (newCell != null)
     _aspxRemoveAttribute(newCell, "scope");
   }
   if (_aspxIsExists(table.tHead) && table.tHead.childNodes.length > 0) {
    var firstRow = table.tBodies[0].firstChild;
    for (var i = table.tHead.childNodes.length - 1; i >= 0; i--) {
     if (table.tHead.childNodes[i].nodeType == 1)
      firstRow = table.tBodies[0].insertBefore(table.tHead.childNodes[i], firstRow);
    }
    table.removeChild(table.tHead);
   }
  }
 },
 GetAccessibilityHeadersValue: function(table) {
  var hasColumnHeaders = this.GetHasColumnHeaders(table);
  var hasRowHeaders = this.GetHasRowHeaders(table);
  var ret = null;
  if (hasColumnHeaders && hasRowHeaders)
   ret = "both";
  else if (hasColumnHeaders)
   ret = "column";
  else if (hasRowHeaders)
   ret = "row";
  return ret;
 },
 GetAccessibilityCaption: function(table) {
  var caption = _aspxGetChildByTagName(table, "CAPTION", 0);
  if (caption)
   return caption.innerHTML;
  return "";
 },
 GetHasColumnHeaders: function(table) {
  for (var i = 0; i < table.rows.length; i++) {
   if (table.rows[i].cells[0].nodeName.toUpperCase() != 'TH')
    return false;
  }
  return true;
 },
 GetHasRowHeaders: function(table) {
  if (table.rows.length == 0)
   return false;
  for (var i = 0; i < table.rows[0].cells.length; i++) {
   if (table.rows[0].cells[i].nodeName.toUpperCase() != 'TH')
    return false;
  }
  return true;
 },
 IsTableColumnEqual: function(table) {
  if (table.rows.length < 0)
   return false;
  var cellWidth = table.rows[0].cells[0].style.width;
  if (!cellWidth)
   return false;
  for (var i = 0; i < table.rows.length; i++) {
   var curRow = table.rows[i];
   for (var j = 0; j < curRow.cells.length; j++)
    if (cellWidth && cellWidth != this.GetCell(table, i, j).style.width)
    return false;
  }
  return true;
 },
 AdjustColumnWidth: function(table) {
  var cellWidth = 100 / table.rows[0].cells.length + "%";
  for (var i = 0; i < table.rows.length; i++) {
   var curRow = table.rows[i];
   for (var j = 0; j < curRow.cells.length; j++) {
    _aspxRemoveAttribute(this.GetCell(table, i, j), "width");
    this.GetCell(table, i, j).style.width = cellWidth;
   }
  }
 },
 InsertColumn: function(cell, shift, htmlEditor) {
  if (cell.nodeName.toUpperCase() != "TD" && cell.nodeName.toUpperCase() != "TH")
   return "";
  var table = this.GetTable(cell);
  var tableModel = this.CreateTableModel(table);
  var row = cell.parentNode;
  var columnIndex = this.GetColumnIndexByTableModel(tableModel, row.rowIndex, cell);
  var colSpan = this.GetColSpan(cell);
  var nextColumnIndex = -1;
  if (shift > 0)
   nextColumnIndex = columnIndex + colSpan;
  else
   nextColumnIndex = columnIndex;
  var isTableColumnEqual = this.IsTableColumnEqual(table);
  var doc = _aspxGetElementDocument(cell);
  for (var r = 0; r < tableModel.length; r++) {
   var curCell = shift > 0 ? tableModel[r][nextColumnIndex - 1] : tableModel[r][nextColumnIndex];
   var curCellColumnIndex = this.GetColumnIndexByTableModel(tableModel, r, curCell);
   var curCellColSpan = this.GetColSpan(curCell);
   if ((shift > 0 && curCellColumnIndex + curCellColSpan == columnIndex + colSpan) ||
    (shift == 0 && curCellColumnIndex == columnIndex)) {
    var curCellRowSpan = this.GetRowSpan(curCell);
    var newCell = this.CreateNewCellByCell(tableModel[r][columnIndex], true);
    for (var j = r; j < r + curCellRowSpan; j++)
     _aspxArrayInsert(tableModel[j], newCell, nextColumnIndex);
    r = j - 1;
   }
   else
    _aspxArrayInsert(tableModel[r], curCell, nextColumnIndex);
  }
  var rowIndex = row.rowIndex;
  this.GenerateTableFromModel(tableModel, table);
  if (isTableColumnEqual)
   this.AdjustColumnWidth(table);
  if (htmlEditor)
   this.SelectCellCore(tableModel[rowIndex][nextColumnIndex], htmlEditor);
 },
 InsertRow: function(cell, shift, htmlEditor) {
  if (cell.nodeName.toUpperCase() != "TD" && cell.nodeName.toUpperCase() != "TH")
   return "";
  var table = this.GetTable(cell);
  var tableModel = this.CreateTableModel(table);
  var row = cell.parentNode;
  var rowIndex = row.rowIndex;
  var columnIndex = this.GetColumnIndexByTableModel(tableModel, rowIndex, cell);
  var rowSpan = this.GetRowSpan(cell);
  var doc = _aspxGetElementDocument(cell);
  var newRowIndex = -1;
  var rowIndexInModel = -1;
  if (shift > 0) {
   rowIndexInModel = rowIndex + rowSpan - 1;
   newRowIndex = rowIndex + rowSpan + shift - 1;
  }
  else {
   newRowIndex = rowIndex;
   rowIndexInModel = rowIndex;
  }
  var newRowModel = new Array();
  for (var i = 0; i < tableModel[rowIndexInModel].length; i++) {
   var curCell = tableModel[rowIndexInModel][i];
   var curCellRow = curCell.parentNode;
   var curCellRowSpan = this.GetRowSpan(curCell);
   if ((shift > 0 && (curCellRow.rowIndex + curCellRowSpan == rowIndex + rowSpan)) ||
    (shift == 0 && (curCellRow.rowIndex == rowIndex))) {
    var curCellColSpan = this.GetColSpan(curCell);
    var newCell = this.CreateNewCellByCell(curCell);
    for (var j = i; j < i + curCellColSpan; j++)
     newRowModel[j] = newCell;
    i = j - 1;
   }
   else
    newRowModel[i] = tableModel[rowIndexInModel][i];
  }
  _aspxArrayInsert(tableModel, newRowModel, newRowIndex);
  var newRow = null;
  if (_aspxIsExists(_aspxGetParentByTagName(cell, "THEAD")))
   newRow = table.tHead.insertRow(newRowIndex);
  else
   newRow = table.insertRow(newRowIndex);
  _aspxCopyAllAttributes(row, newRow);
  _aspxRemoveAttribute(newRow, "id");
  this.GenerateTableFromModel(tableModel, table);
  if (htmlEditor)
   this.SelectCellCore(tableModel[newRowIndex][columnIndex], htmlEditor);
 },
 RemoveRow: function(cell, htmlEditor) {
  var row = _aspxHETableHelper.GetTableRow(cell);
  if (_aspxIsExists(row)) {
   var table = this.GetTable(cell);
   var tableModel = this.CreateTableModel(table);
   var columnIndex = this.GetColumnIndexByTableModel(tableModel, row.rowIndex, cell);
   var rowIndex = row.rowIndex;
   var rowSpan = this.GetRowSpan(tableModel[rowIndex][columnIndex]);
   for (var r = rowSpan + rowIndex - 1; r >= rowIndex; r--) {
    _aspxArrayRemoveAt(tableModel, r);
    if (r < table.rows.length)
     table.deleteRow(r);
   }
   if (table.rows.length > 0) {
    this.GenerateTableFromModel(tableModel, table);
    if (htmlEditor) {
     rowIndex = Math.min(rowIndex, table.rows.length - 1);
     this.SelectCellCore(tableModel[rowIndex][columnIndex], htmlEditor);
    }
   }
   else
    _aspxRemoveElement(table);
   return true;
  }
  return false;
 },
 RemoveColumn: function(cell, htmlEditor) {
  var row = _aspxHETableHelper.GetTableRow(cell);
  if (_aspxIsExists(row)) {
   var table = this.GetTable(cell);
   var tableModel = this.CreateTableModel(table);
   var columnIndex = this.GetColumnIndexByTableModel(tableModel, row.rowIndex, cell);
   var rowIndex = row.rowIndex;
   var colSpan = this.GetColSpan(tableModel[rowIndex][columnIndex]);
   for (var r = 0; r < tableModel.length; r++) {
    for (var c = columnIndex + colSpan - 1; c >= columnIndex; c--) {
     _aspxArrayRemoveAt(tableModel[r], c);
    }
   }
   if (tableModel[rowIndex].length > 0) {
    this.GenerateTableFromModel(tableModel, table);
    if (htmlEditor) {
     columnIndex = Math.min(columnIndex, tableModel[rowIndex].length - 1);
     this.SelectCellCore(tableModel[rowIndex][columnIndex], htmlEditor);
    }
   }
   else
    _aspxRemoveElement(table);
   return true;
  }
  return false;
 },
 SplitCellHorizontal: function(cell, htmlEditor) {
  if (!_aspxIsExists(cell))
   return false;
  var table = _aspxGetParentByTagName(cell, "TABLE");
  var row = cell.parentNode;
  var rowIndex = row.rowIndex;
  var tableModel = _aspxHETableHelper.CreateTableModel(table);
  var columnIndex = this.GetColumnIndexByTableModel(tableModel, row.rowIndex, cell);
  var colSpan = isNaN(cell.colSpan) ? 1 : cell.colSpan;
  var doc = _aspxGetElementDocument(table);
  var newCellWidth = "";
  var newCell = doc.createElement(cell.nodeName);
  if (!__aspxIE)
   this.AddDefaultContentToCell(newCell);
  if (colSpan > 1) {
   var newColSpan = Math.ceil(colSpan / 2);
   var startIdx = columnIndex + newColSpan;
   var endIdx = columnIndex + colSpan;
   var rowSpan = isNaN(cell.rowSpan) ? 1 : cell.rowSpan;
   for (var r = rowIndex; r < rowIndex + rowSpan; r++) {
    for (var i = startIdx; i < endIdx; i++)
     tableModel[r][i] = newCell;
   }
  }
  else {
   var newTableModel = new Array();
   var newRowHash = {};
   for (var i = 0; i < tableModel.length; i++) {
    var newRow = tableModel[i].slice(0, columnIndex);
    if (tableModel[i].length <= columnIndex) {
     newTableModel.push(newRow);
     continue;
    }
    if (tableModel[i][columnIndex] == cell) {
     newRow.push(cell);
     newRow.push(newCell);
    }
    else {
     newRow.push(tableModel[i][columnIndex]);
     newRow.push(tableModel[i][columnIndex]);
    }
    for (var j = columnIndex + 1; j < tableModel[i].length; j++)
     newRow.push(tableModel[i][j]);
    newTableModel.push(newRow);
   }
   tableModel = newTableModel;
  }
  var cellWidthInfo = _aspxHETableHelper.ParseSizeString(tableModel[rowIndex][columnIndex].style.width);
  if (cellWidthInfo.valueType) {
   var newCellWidth = cellWidthInfo.value / 2;
   tableModel[rowIndex][columnIndex].style.width = newCellWidth + cellWidthInfo.valueType;
   newCell.style.width = newCellWidth + cellWidthInfo.valueType;
  }
  this.GenerateTableFromModel(tableModel, table);
  if (htmlEditor)
   this.SelectCellCore(tableModel[rowIndex][columnIndex], htmlEditor);
 },
 SplitCellVertical: function(cell, htmlEditor) {
  if (!_aspxIsExists(cell))
   return false;
  var table = _aspxGetParentByTagName(cell, "TABLE");
  var row = cell.parentNode;
  var rowIndex = row.rowIndex;
  var tableModel = _aspxHETableHelper.CreateTableModel(table);
  var columnIndex = this.GetColumnIndexByTableModel(tableModel, rowIndex, cell);
  var rowSpan = this.GetRowSpan(cell);
  var doc = _aspxGetElementDocument(table);
  if (rowSpan > 1) {
   var newRowSpan = Math.ceil(rowSpan / 2);
   var newCell = doc.createElement(cell.nodeName);
   if (!__aspxIE)
    this.AddDefaultContentToCell(newCell);
   var startRowIndex = rowIndex + newRowSpan;
   var endRowIndex = rowIndex + rowSpan;
   var curColumnIndex = columnIndex;
   while (tableModel[rowIndex][curColumnIndex] == cell) {
    for (var r = startRowIndex; r < endRowIndex; r++) {
     if (tableModel[r][curColumnIndex] == cell)
      tableModel[r][curColumnIndex] = newCell;
    }
    curColumnIndex++;
   }
  }
  else {
   var newRowHash = {};
   var newRowIndex = rowIndex + 1;
   var isThead = _aspxIsExists(_aspxGetParentByTagName(cell, "THEAD"));
   var newRow = null;
   if (isThead)
    newRow = table.tHead.insertRow(newRowIndex);
   else
    newRow = table.insertRow(newRowIndex);
   _aspxCopyAllAttributes(row, newRow);
   _aspxRemoveAttribute(newRow, "id");
   _aspxArrayInsert(tableModel, new Array(), newRowIndex);
   for (var i = 0; i < tableModel[rowIndex].length; i++) {
    if (tableModel[rowIndex][i] == cell) {
     if (!newRowHash[cell]) {
      newRowHash[cell] = doc.createElement(cell.nodeName);
      if (!__aspxIE)
       this.AddDefaultContentToCell(newRowHash[cell]);
     }
     tableModel[newRowIndex][i] = newRowHash[cell];
    }
    else
     tableModel[newRowIndex][i] = tableModel[rowIndex][i];
   }
  }
  this.GenerateTableFromModel(tableModel, table);
  if (htmlEditor)
   this.SelectCellCore(tableModel[rowIndex][columnIndex], htmlEditor);
 },
 MergeCellHorizontal: function(cell, htmlEditor) {
  var table = _aspxGetParentByTagName(cell, "TABLE");
  var row = cell.parentNode;
  var rowIndex = row.rowIndex;
  var tableModel = _aspxHETableHelper.CreateTableModel(table);
  var columnIndex = this.GetColumnIndexByTableModel(tableModel, rowIndex, cell);
  var nextCellColumnIndex = this.GetNextCellColumnIndexByTableModel(tableModel, rowIndex, columnIndex);
  var nextCell = tableModel[rowIndex][nextCellColumnIndex];
  var rowSpan = isNaN(cell.rowSpan) ? 1 : cell.rowSpan;
  var newCell = this.MergeCell(cell, nextCell);
  var cellWidthInfo = _aspxHETableHelper.ParseSizeString(tableModel[rowIndex][columnIndex].style.width);
  var mergedCellWidthInfo = _aspxHETableHelper.ParseSizeString(tableModel[rowIndex][nextCellColumnIndex].style.width);
  if (cellWidthInfo.valueType && cellWidthInfo.valueType == mergedCellWidthInfo.valueType)
   newCell.style.width = cellWidthInfo.value + mergedCellWidthInfo.value + cellWidthInfo.valueType;
  for (var i = rowIndex; i < rowIndex + rowSpan; i++) {
   var curColumnIndex = columnIndex;
   while (tableModel[i] &&
     (tableModel[i][curColumnIndex] == cell || tableModel[i][curColumnIndex] == nextCell)) {
    tableModel[i][curColumnIndex] = newCell;
    curColumnIndex++;
   }
  }
  this.GenerateTableFromModel(tableModel, table);
  if (htmlEditor)
   this.SelectCellCore(tableModel[rowIndex][columnIndex], htmlEditor);
 },
 MergeCellVertical: function(cell, htmlEditor) {
  var table = _aspxGetParentByTagName(cell, "TABLE");
  var row = cell.parentNode;
  var rowIndex = row.rowIndex;
  var tableModel = _aspxHETableHelper.CreateTableModel(table);
  var columnIndex = this.GetColumnIndexByTableModel(tableModel, rowIndex, cell);
  var nextCellRowIndex = this.GetNextCellRowIndexByTableModel(tableModel, rowIndex, columnIndex);
  var colSpan = this.GetColSpan(cell);
  var nextCell = tableModel[nextCellRowIndex][columnIndex];
  var newCell = this.MergeCell(cell, nextCell);
  for (var i = columnIndex; i < columnIndex + colSpan; i++) {
   var curRowIndex = rowIndex;
   while (tableModel[curRowIndex] &&
     (tableModel[curRowIndex][i] == cell || tableModel[curRowIndex][i] == nextCell)) {
    tableModel[curRowIndex][i] = newCell;
    curRowIndex++;
   }
  }
  this.GenerateTableFromModel(tableModel, table);
  if (htmlEditor)
   this.SelectCellCore(tableModel[rowIndex][columnIndex], htmlEditor);
 },
 IsMergeCellHorizontalAllow: function(cell, htmlEditor) {
  var isAllow = false;
  var tableModel = _aspxHETableHelper.CreateTableModel(_aspxGetParentByTagName(cell, "TABLE"));
  var row = cell.parentNode;
  var colIndx = this.GetColumnIndexByTableModel(tableModel, row.rowIndex, cell);
  var nextCellColIndx = colIndx + this.GetColSpan(cell);
  var nextCell = tableModel[row.rowIndex][nextCellColIndx];
  if (_aspxIsExists(nextCell)) {
   if (this.GetRowSpan(cell) == this.GetRowSpan(nextCell)) {
    var realNextCellRow = nextCell.parentNode;
    isAllow = realNextCellRow.rowIndex == row.rowIndex;
   }
  }
  return isAllow;
 },
 IsMergeCellVerticalAllow: function(cell, htmlEditor) {
  var isAllow = false;
  var table = _aspxGetParentByTagName(cell, "TABLE");
  var nextCell = this.GetNextCellVertical(cell);
  if (nextCell) {
   var colSpan = isNaN(cell.colSpan) ? 1 : cell.colSpan;
   var nextCellColSpan = isNaN(nextCell.colSpan) ? 1 : nextCell.colSpan;
   isAllow = colSpan == nextCellColSpan;
  }
  return isAllow;
 },
 MergeCell: function(firstCell, secondCell) {
  var doc = _aspxGetElementDocument(firstCell);
  var newCell = doc.createElement(firstCell.nodeName);
  newCell.innerHTML = firstCell.innerHTML;
  var emptyHtmlRegExp = new RegExp(__aspxHEEmptyHtmlRegExpPattern, "ig");
  if (!emptyHtmlRegExp.test(secondCell.innerHTML))
   newCell.innerHTML += "<br/>" + secondCell.innerHTML;
  _aspxCopyAllAttributes(firstCell, newCell);
  return newCell;
 },
 CreateTableModel: function(table) {
  var rows = table.rows;
  var rowCount = 0;
  var model = new Array();
  for (var i = 0; i < rows.length; i++) {
   if (!model[rowCount])
    model[rowCount] = new Array();
   var colCount = 0;
   for (var j = 0; j < rows[i].cells.length; j++) {
    var curCell = rows[i].cells[j];
    while (model[rowCount][colCount])
     colCount++;
    var colSpan = this.GetColSpan(curCell);
    var rowSpan = this.GetRowSpan(curCell);
    for (var rs = 0; rs < rowSpan; rs++) {
     if (!model[rowCount + rs])
      model[rowCount + rs] = new Array();
     for (var cs = 0; cs < colSpan; cs++)
      model[rowCount + rs][colCount + cs] = rows[i].cells[j];
    }
    colCount += colSpan - 1;
   }
   rowCount++;
  }
  return model;
 },
 GenerateTableFromModel: function(model, sourceTable) {
  var rowSpanAttr = __aspxIE ? "_dxrowspan" : "rowSpan";
  for (var i = 0; i < model.length; i++) {
   for (var j = 0; j < model[i].length; j++) {
    if (model[i][j].parentNode)
     model[i][j].parentNode.removeChild(model[i][j]);
    model[i][j].colSpan = model[i][j][rowSpanAttr] = 1;
    model[i][j].rowSpan = 1;
    model[i][j].rowIsNotSpanned = false;
    model[i][j].colIsNotSpanned = false;
   }
  }
  var maxColumnCount = 0;
  for (var i = 0; i < model.length; i++) {
   for (var j = 0; j < model[i].length; j++) {
    if (model[i][j]) {
     var cell = model[i][j];
     if (j > maxColumnCount)
      maxColumnCount = j;
     if (!cell.colIsNotSpanned) {
      if (model[i][j - 1] == cell)
       cell.colSpan++;
      if (model[i][j + 1] != cell)
       cell.colIsNotSpanned = true;
     }
    }
   }
  }
  var sourceRows = new Array();
  for (var i = 0; i <= maxColumnCount; i++) {
   for (var j = 0; j < model.length; j++) {
    if (model[j] && model[j][i] && !model[j][i].rowIsNotSpanned) {
     var cell = model[j][i];
     if (model[j - 1] && model[j - 1][i] == cell)
      cell[rowSpanAttr]++;
     if (!model[j + 1] || model[j + 1][i] != cell)
      cell.rowIsNotSpanned = true;
    }
   }
  }
  var doc = _aspxGetElementDocument(sourceTable);
  for (var i = 0; i < model.length; i++) {
   var rowObj = doc.createElement(sourceTable.rows[i].tagName);
   _aspxCopyAllAttributes(sourceTable.rows[i], rowObj);
   for (var j = 0; j < model[i].length; ) {
    var cell = model[i][j];
    _aspxRemoveAttribute(cell, "rowIsNotSpanned");
    _aspxRemoveAttribute(cell, "colIsNotSpanned");
    if (model[i - 1] && model[i - 1][j] == cell) {
     j += cell.colSpan;
     continue;
    }
    rowObj.appendChild(cell);
    var isEmptyRowSpan = cell.rowSpan == 1;
    if (rowSpanAttr != 'rowSpan' && _aspxIsExists(cell[rowSpanAttr])) {
     if (cell[rowSpanAttr] > 1)
      isEmptyRowSpan = false;
     cell.rowSpan = cell[rowSpanAttr];
     cell.removeAttribute(rowSpanAttr);
    }
    if (cell.colSpan == 1)
     cell.removeAttribute('colspan');
    if (isEmptyRowSpan)
     cell.removeAttribute('rowspan');
    j += cell.colSpan;
   }
   sourceTable.rows[i].parentNode.replaceChild(rowObj, sourceTable.rows[i]);
  }
 },
 AddDefaultContentToCell: function(cell) {
  cell.innerHTML = "&nbsp;";
 },
 CreateNewCellByCell: function(cell, resetWidth) {
  var newCell = _aspxGetElementDocument(cell).createElement(cell.nodeName);
  if (cell.style.cssText !== '') {
   newCell.style.cssText = cell.style.cssText;
   if (resetWidth && _aspxHETableHelper.ParseSizeString(newCell.style.width).valueType == "%")
    newCell.style.width = "";
  }
  if (!__aspxIE)
   this.AddDefaultContentToCell(newCell);
  return newCell;
 },
 ParseSizeString: function(sizeString) {
  var ret = { value: null, valueType: null };
  var res = __aspxHESizeTypeRegExp.exec(sizeString);
  if (res && res.length > 2) {
   ret.value = parseFloat(res[1]);
   ret.valueType = res[2];
  }
  return ret;
 },
 SetBackgroundColor: function(element, color) {
  if (color)
   element.style.backgroundColor = color;
  else {
   element.style.backgroundColor = "";
   _aspxRemoveStyleAttribute(element.style, "backgroundColor");
  }
 },
 SetTableBorderColor: function(table, color) {
  table.setAttribute(__aspxIE ? "borderColor" : "bordercolor", color);
 },
 GetTableBorderColor: function(table, color) {
  return _aspxGetAttribute(table, __aspxIE ? "borderColor" : "bordercolor");
 },
 GetRowIndex: function(cell) {
  var row = cell.parentNode;
  return row.rowIndex;
 },
 GetCell: function(table, rowIndex, colIndex) {
  return table.rows[rowIndex].cells[colIndex];
 },
 GetNextCellVertical: function(cell) {
  var nextCell = null;
  var row = cell.parentNode;
  var table = _aspxGetParentByTagName(cell, "TABLE");
  var rowSpan = this.GetRowSpan(cell);
  if (table.rows.length > row.rowIndex + rowSpan) {
   var curCellIndex = 0;
   var nextRow = table.rows[row.rowIndex + rowSpan];
   var curCumulitativeSpan = 0;
   while ((curCumulitativeSpan < cell.cellIndex + 1) && (nextRow.cells.length > curCellIndex)) {
    curCumulitativeSpan += this.GetColSpan(nextRow.cells[curCellIndex]);
    nextCell = nextRow.cells[curCellIndex];
    curCellIndex += 1;
   }
  }
  return nextCell;
 },
 GetColumnIndexByTableModel: function(model, rowIndex, cell) {
  if (model.length < rowIndex + 1)
   return -1;
  var row = model[rowIndex];
  for (var i = 0; i < row.length; i++) {
   if (row[i] == cell)
    return i;
  }
  return -1;
 },
 GetNextCellColumnIndexByTableModel: function(model, rowIndex, columnIndex) {
  if (model.length < rowIndex + 1)
   return -1;
  var cell = model[rowIndex][columnIndex];
  for (var i = columnIndex; i < model[rowIndex].length; i++) {
   if (model[rowIndex][i] != cell)
    return i;
  }
  return -1;
 },
 GetNextCellRowIndexByTableModel: function(model, rowIndex, columnIndex) {
  if (model.length < rowIndex + 1)
   return -1;
  var cell = model[rowIndex][columnIndex];
  for (var i = rowIndex; i < model.length; i++) {
   if (model[i][columnIndex] != cell)
    return i;
  }
  return -1;
 },
 GetNextRow: function(row) {
  var table = _aspxGetParentByTagName(row, "TABLE");
  var i = 0;
  for (i = 0; i < table.rows.length; i++)
   if (table.rows[i] == row)
   break;
  return i + 1 < table.rows.length ? table.rows[i + 1] : null;
 },
 GetColSpan: function(cell) {
  return isNaN(cell.colSpan) ? 1 : cell.colSpan;
 },
 GetRowSpan: function(cell) {
  return isNaN(cell.rowSpan) ? 1 : cell.rowSpan;
 },
 SelectCell: function(table, rowIndex, colIndex, htmlEditor) {
  var cell = this.GetCell(table, rowIndex, colIndex);
  if (_aspxIsExists(cell))
   this.SelectCellCore(cell, htmlEditor);
 },
 SelectCellCore: function(cell, htmlEditor) {
  var elem = cell;
  if (cell.childNodes.length > 0 && !__aspxIE)
   elem = cell.childNodes[0];
  if (!__aspxIE)
   htmlEditor.SetFocus();
  ASPxClientHtmlEditorSelection.SelectElement(elem, htmlEditor, __aspxOpera);
 },
 DeleteRows: function(table) {
  for (var i = 0; i < table.rows.length; i++) {
   var rIndex = table.rows[i].sectionRowIndex;
   table.deleteRow(rIndex);
  }
 }
}
InsertTableCommand = _aspxCreateClass(Command, {
 Execute: function(cmdValue, htmlEditor) {
  Command.prototype.Execute.call(this);
  var doc = htmlEditor.GetDesignViewIFrameDocument();
  var tableId = ASPxClientSelection.GetMarkerID();
  var emptyTableHtml = "<table id='" + tableId + "'></table>";
  ASPxHtmlEditorCommandList[ASPxClientCommandConsts.PASTEHTML_COMMAND].Execute(emptyTableHtml, htmlEditor);
  var emptyTable = _aspxGetElementByIdInDocument(doc, tableId);
  emptyTable.id = "";
  _aspxRemoveAttribute(emptyTable, "id");
  InsertTableCommand.SetTableRowAndColumnCount(emptyTable, cmdValue.rows,
              cmdValue.columns, cmdValue.isColumnEqualWidth);
  this.InitializeTable(emptyTable);
  _aspxHETableHelper.SetTableProperties(emptyTable, cmdValue.tableProperties, htmlEditor);
  _aspxHETableHelper.SelectCell(emptyTable, 0, 0, htmlEditor);
  return true;
 },
 InitializeTable: function(table) {
  table.style.borderCollapse = "collapse";
  for (var i = 0; i < table.rows.length; i++) {
   var row = table.rows[i];
   for (var j = 0; j < row.cells.length; j++)
    _aspxHETableHelper.AddDefaultContentToCell(row.cells[j]);
  }
 }
});
InsertTableCommand.SetTableRowAndColumnCount = function(table, rowCount, columnCount, isColumnEqualWidth) {
 _aspxHETableHelper.DeleteRows(table);
 var cellWidth = 100 / columnCount + "%";
 for (var i = 0; i < rowCount; i++) {
  var newRow = table.insertRow(i);
  for (var j = 0; j < columnCount; j++) {
   var cell = newRow.insertCell(j);
   if (isColumnEqualWidth)
    cell.style.width = cellWidth;
  }
 }
};
ChangeTableCommand = _aspxCreateClass(Command, {
 Execute: function(cmdValue, htmlEditor) {
  Command.prototype.Execute.call(this);
  _aspxHETableHelper.SetTableProperties(cmdValue.tableElement, cmdValue.tableProperties, htmlEditor);
  _aspxHETableHelper.SelectCell(cmdValue.tableElement, 0, 0, htmlEditor);
  return true;
 }
});
ChangeTableCellCommand = _aspxCreateClass(Command, {
 Execute: function(cmdValue, htmlEditor) {
  Command.prototype.Execute.call(this);
  if (cmdValue.properties.applyForAll)
   _aspxHETableHelper.SetCellPropertiesForAllCell(_aspxGetParentByTagName(cmdValue.cellElement, "TABLE"),
               cmdValue.properties);
  else
   _aspxHETableHelper.SetCellProperties(cmdValue.cellElement, cmdValue.properties);
  return true;
 }
});
ChangeTableColumnCommand = _aspxCreateClass(Command, {
 Execute: function(cmdValue, htmlEditor) {
  Command.prototype.Execute.call(this);
  _aspxHETableHelper.SetColumnProperties(cmdValue.cell, cmdValue.properties);
  return true;
 }
});
ChangeTableRowCommand = _aspxCreateClass(Command, {
 Execute: function(cmdValue, htmlEditor) {
  Command.prototype.Execute.call(this);
  _aspxHETableHelper.SetRowProperties(cmdValue.cell, cmdValue.properties);
  return true;
 }
});
DeleteTableCommand = _aspxCreateClass(Command, {
 Execute: function(cmdValue, htmlEditor) {
  Command.prototype.Execute.call(this);
  var curSelection = ASPxClientHtmlEditorSelection.Create(htmlEditor);
  var table = _aspxHETableHelper.GetTable(curSelection.GetParentElement());
  if (_aspxIsExists(table)) {
   ASPxClientHtmlEditorSelection.SelectElement(table, htmlEditor);
   ASPxHtmlEditorCommandList[ASPxClientCommandConsts.DELETE_COMMAND].Execute(null, htmlEditor);
   if (__aspxOpera)
    _aspxRemoveElement(table);
   htmlEditor.SetFocus();
   return true;
  }
  return false;
 },
 IsLocked: function(editor) {
  return !ChangeTableDialogCommand.IsTableSelected(editor);
 }
});
InsertTableColumnAndRowCommandBase = _aspxCreateClass(Command, {
 IsLocked: function(editor) {
  return !_aspxIsExists(InsertTableColumnAndRowCommandBase.GetTableCell(editor));
 }
});
InsertTableColumnAndRowCommandBase.GetTableCell = function(htmlEditor) {
 if (htmlEditor.NeedGetElementFromSelection("tableCell")) {
  var curSelection = ASPxClientHtmlEditorSelection.Create(htmlEditor);
  var parentElem = curSelection.GetParentElement();
  var endElem = null;
  if (!__aspxIE)
   endElem = curSelection.GetEndContainer();
  htmlEditor.SetSelectedElement("tableCell", _aspxHETableHelper.GetTableCellBySelection(parentElem, endElem));
 }
 return htmlEditor.GetSelectedElement("tableCell");
}
InsertTableColumnCommand = _aspxCreateClass(InsertTableColumnAndRowCommandBase, {
 Execute: function(cmdValue, htmlEditor) {
  Command.prototype.Execute.call(this);
  var cell = InsertTableColumnAndRowCommandBase.GetTableCell(htmlEditor);
  if (_aspxIsExists(cell)) {
   _aspxHETableHelper.InsertColumn(cell, this.GetShift(), htmlEditor);
   htmlEditor.SetFocus();
   return true;
  }
  return false;
 },
 GetShift: function() {
  var ret = 0; 
  if (this.commandID == ASPxClientCommandConsts.INSERTTABLECOLUMNTORIGHT_COMMAND)
   ret = 1;
  return ret;
 }
});
InsertTableRowCommand = _aspxCreateClass(InsertTableColumnAndRowCommandBase, {
 Execute: function(cmdValue, htmlEditor) {
  Command.prototype.Execute.call(this);
  var cell = InsertTableColumnAndRowCommandBase.GetTableCell(htmlEditor);
  if (_aspxIsExists(cell)) {
   _aspxHETableHelper.InsertRow(cell, this.GetShift(), htmlEditor);
   htmlEditor.SetFocus();
   return true;
  }
  return false;
 },
 GetShift: function() {
  var ret = 0; 
  if (this.commandID == ASPxClientCommandConsts.INSERTTABLEROWBELOW_COMMAND)
   ret = 1;
  return ret;
 }
});
DeleteTableRowCommand = _aspxCreateClass(InsertTableColumnAndRowCommandBase, {
 Execute: function(cmdValue, htmlEditor) {
  Command.prototype.Execute.call(this);
  var cell = InsertTableColumnAndRowCommandBase.GetTableCell(htmlEditor);
  return _aspxHETableHelper.RemoveRow(cell, htmlEditor);
 },
 IsLocked: function(editor) {
  if (editor.NeedGetElementFromSelection("tableRow")) {
   var curSelection = ASPxClientHtmlEditorSelection.Create(editor);
   editor.SetSelectedElement("tableRow", _aspxHETableHelper.GetTableRow(curSelection.GetParentElement()));
  }
  return !_aspxIsExists(editor.GetSelectedElement("tableRow"));
 }
});
DeleteTableColumnCommand = _aspxCreateClass(DeleteTableRowCommand, {
 Execute: function(cmdValue, htmlEditor) {
  Command.prototype.Execute.call(this);
  var curSelection = ASPxClientHtmlEditorSelection.Create(htmlEditor);
  var selElem = curSelection.GetParentElement();
  var table = _aspxHETableHelper.GetTable(selElem);
  var row = _aspxHETableHelper.GetTableRow(selElem);
  var cell = InsertTableColumnAndRowCommandBase.GetTableCell(htmlEditor);
  return _aspxHETableHelper.RemoveColumn(cell, htmlEditor);
 }
});
SplitTableCellHorizontallyCommand = _aspxCreateClass(InsertTableColumnAndRowCommandBase, {
 Execute: function(cmdValue, htmlEditor) {
  Command.prototype.Execute.call(this);
  _aspxHETableHelper.SplitCellHorizontal(InsertTableColumnAndRowCommandBase.GetTableCell(htmlEditor), htmlEditor);
  return true;
 }
});
SplitTableCellVerticallyCommand = _aspxCreateClass(InsertTableColumnAndRowCommandBase, {
 Execute: function(cmdValue, htmlEditor) {
  Command.prototype.Execute.call(this);
  _aspxHETableHelper.SplitCellVertical(InsertTableColumnAndRowCommandBase.GetTableCell(htmlEditor), htmlEditor);
  return true;
 }
});
MergeTableCellRightCommand = _aspxCreateClass(InsertTableColumnAndRowCommandBase, {
 Execute: function(cmdValue, htmlEditor) {
  Command.prototype.Execute.call(this);  
  _aspxHETableHelper.MergeCellHorizontal(InsertTableColumnAndRowCommandBase.GetTableCell(htmlEditor), htmlEditor);
  return true;
 },
 IsLocked: function(editor) {
  var cell = InsertTableColumnAndRowCommandBase.GetTableCell(editor);
  if (_aspxIsExists(cell))
   return !_aspxHETableHelper.IsMergeCellHorizontalAllow(cell, editor);
  return true;
 }
});
MergeTableCellDownCommand = _aspxCreateClass(InsertTableColumnAndRowCommandBase, {
 Execute: function(cmdValue, htmlEditor) {
  Command.prototype.Execute.call(this);
  _aspxHETableHelper.MergeCellVertical(InsertTableColumnAndRowCommandBase.GetTableCell(htmlEditor), htmlEditor);
  return true;
 },
 IsLocked: function(editor) {
  var cell = InsertTableColumnAndRowCommandBase.GetTableCell(editor);
  if (_aspxIsExists(cell))
   return !_aspxHETableHelper.IsMergeCellVerticalAllow(cell, editor);
  return true;
 }
});
FormatBlockCommand = _aspxCreateClass(BrowserCommand, {
 GetCorrectedValue: function(value) {
  return __aspxIE ? "<" + value + ">" : value;
 },
 GetValue: function(editor) {
  value = (__aspxIE) ? this.GetValueIE(editor) : this.GetValueMoz(editor);
  return (value == "font") ? "span" : value;
 },
 GetValueIE : function(editor) {    
  var contentAreaDoc = editor.GetDesignViewIFrameDocument();
  var curSelection = contentAreaDoc.selection;
  if (!curSelection) return "";
  var selRange = curSelection.createRange();
  var parentElement = (selRange.length > 0 ? selRange(0) : selRange.parentElement());
  return this.GetValueByElement(parentElement);
 },
 GetValueMoz: function(editor) {
  var contentWindow = editor.GetDesignViewIFrameWindow(); 
  var curSelection = contentWindow.getSelection();
  if (!curSelection || curSelection.rangeCount != 1) return "";
  var startNode = (curSelection.anchorNode.nodeType != 3
       ? curSelection.anchorNode
       : curSelection.anchorNode.parentNode);
  var endNode = (curSelection.focusNode.nodeType != 3
       ? curSelection.focusNode
       : curSelection.focusNode.parentNode);       
  if (startNode != endNode)
   return "";
  var restoreSelection = ASPxClientHtmlEditorSelection.Create(editor);
  return this.GetValueByElement(restoreSelection.GetParentElement());
 },
 GetValueByElement: function(element) {
  return (element) && (element.nodeType == 1) ? element.tagName.toLowerCase() : "";
 }
});
RemoveFormatCommand = _aspxCreateClass(BrowserCommand, {
 Execute: function(cmdValue, editor) {
  BrowserCommand.prototype.Execute.call(this, cmdValue, editor);
  var curSelection = ASPxClientHtmlEditorSelection.Create(editor);
  var parentElem = curSelection.GetParentElement();
  if (!curSelection.IsTextOnly() && !curSelection.IsControl() && 
   _aspxIsExists(parentElem))
   this.CleanElement(parentElem);
  return true;
 },
 CleanElement: function(element) {
  for (var i =  0; i < element.childNodes.length ; i++)
   this.CleanElement(element.childNodes[i]);
  if (element.nodeType == 1 && element.tagName.toUpperCase() != "BODY") {
   _aspxRemoveAllAttributes(element, ["href", "src", "alt", "target", "id", "title", "value"]);
   _aspxRemoveAllStyles(element);
  }
 }
});
PasteFromWord = _aspxCreateClass(Command, {
 Execute: function(cmdValue, htmlEditor) {
  Command.prototype.Execute.call(this);  
  return ASPxHtmlEditorCommandList[ASPxClientCommandConsts.PASTEHTML_COMMAND].Execute(
   PasteFromWord.ClearWordFormatting(cmdValue.html, cmdValue.stripFontFamily), htmlEditor); 
 }
});
PasteFromWord.ClearWordFormatting = function(html, stripFontFamily) {
 html = PasteFromWord.ClearWordAttributes(html);
 html = html.replace(/<\/?\w+:[^>]*>/gi, '');
 html = html.replace(/<STYLE[^>]*>[\s\S]*?<\/STYLE[^>]*>/gi, '');
 html = html.replace(/<(?:META|LINK)[^>]*>\s*/gi, '');
 html = html.replace(/<\\?\?xml[^>]*>/gi, '');
 html = html.replace(/<o:[pP][^>]*>\s*<\/o:[pP]>/gi, '');
 html = html.replace(/<o:[pP][^>]*>.*?<\/o:[pP]>/gi, '&nbsp;');
 html = html.replace(/<st1:.*?>/gi, '');
 html = html.replace(/<\!--[\s\S]*?-->/g, '');
 html = html.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3") ;
 html =  html.replace(/\s*style="\s*"/gi, '');
 html = html.replace(/style=""/ig, "");
 html = html.replace(/style=''/ig, "");
 html = html.replace(/^\s/i, '');
 html = html.replace(/\s$/i, '');
 html = html.replace(/<p>&nbsp;<\/p>/gi, '<br /><br />');
 html = html.replace(/<font\s*>([^<>]+)<\/font>/gi, '$1');
 html = html.replace(/<span\s*><span\s*>([^<>]+)<\/span><\/span>/ig, '$1');
 html = html.replace(/<span>([^<>]+)<\/span>/gi, '$1');
 if (stripFontFamily) {
  html = html.replace(/\s*face="[^"]*"/gi, '');
  html = html.replace(/\s*face=[^ >]*/gi, '');
  html = html.replace(/\s*FONT-FAMILY:[^;"]*;?/gi, '');
 }
 var replacePwithDIV = new RegExp('(<P)([^>]*>[\\s\\S]*?)(<\/P>)', 'gi');
 html = html.replace(replacePwithDIV, '<div$2<\/div>');
 html = html.replace( /<([^\s>]+)(\s[^>]*)?>\s*<\/\1>/g, '' );
 html = html.replace( /<([^\s>]+)(\s[^>]*)?>\s*<\/\1>/g, '' );
 html = html.replace( /<([^\s>]+)(\s[^>]*)?>\s*<\/\1>/g, '' );
 return html;
}
PasteFromWord.ClearWordAttributes = function(html) {
 html = html.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3") ;
 html = html.replace(/\s*mso-[^:]+:[^;"]+;?/gi, '');
 html = html.replace(/\s*MARGIN: 0cm 0cm 0pt\s*;/gi, '');
 html = html.replace(/\s*MARGIN: 0cm 0cm 0pt\s*"/gi, "\"");
 html = html.replace(/\s*TEXT-INDENT: 0cm\s*;/gi, '');
 html = html.replace(/\s*TEXT-INDENT: 0cm\s*"/gi, "\"");
 html = html.replace(/\s*PAGE-BREAK-BEFORE: [^\s;]+;?"/gi, "\"");
 html = html.replace(/\s*FONT-VARIANT: [^\s;]+;?"/gi, "\"") ;
 html = html.replace(/\s*tab-stops:[^;"]*;?/gi, '') ;
 html = html.replace(/\s*tab-stops:[^"]*/gi, '') ;
 return html;
}
PasteHtmlCommand = _aspxCreateClass(Command, {
 Execute: function(htmlText, htmlEditor, needSelect) {
  Command.prototype.Execute.call(this);
  this.needSelect = _aspxIsExists(needSelect) ? needSelect : true;
  this.htmlText = htmlText;
  this.htmlEditor = htmlEditor;
  if (__aspxIE)
   return this.ExecuteIE();
  if (__aspxOpera)
   return this.ExecuteOpera();
  if (__aspxNetscapeFamily)
   return this.ExecuteNS();
  if (__aspxWebKitFamily)
   return this.ExecuteWebKit();
  return false;
 },
 ExecuteIE: function() {
  var doc = this.htmlEditor.GetDesignViewIFrameDocument();
  if (doc.selection.type.toLowerCase() != "none")
   doc.selection.createRange().execCommand("Delete");
  if (doc.selection.type.toLowerCase() != "none") 
   doc.execCommand("Delete");
  doc.body.setActive();
  var selRange = doc.selection.createRange();
  if (selRange && selRange.length) {
   var elem = selRange.item(0);
   if (elem && elem.tagName.toUpperCase() == "BODY") {
    var formElement = elem.getElementsByTagName("FORM")[0];
    if (formElement)
     _aspxSetInnerHtml(formElement, formElement.innerHTML + this.htmlText);
   }
  }
  else {
   var rngStart = selRange.duplicate();
   rngStart.collapse(true);
   selRange.pasteHTML(this.htmlText);
   rngStart.setEndPoint("StartToEnd", selRange);
   rngStart.select();
  }
  return true;
 },
 ExecuteNS: function() {
  return this.ExecuteOpera();
 },
 ExecuteOpera: function() {
  var doc = this.htmlEditor.GetDesignViewIFrameDocument();
  var tmpNode = doc.createElement("SPAN");
  _aspxSetInnerHtml(tmpNode, this.htmlText);
  this.InsertNodeAtSelection(tmpNode);
  var range = doc.createRange();
  range.selectNodeContents(tmpNode);
  var documentFragment = range.extractContents();
  range.selectNode(tmpNode);
  range.deleteContents();
  this.InsertNodeAtSelection(documentFragment);
  if (__aspxOpera)
   this.htmlEditor.GetDesignViewIFrameDocument().body.focus();
  return true;
 },
 ExecuteWebKit: function() {
  var doc = this.htmlEditor.GetDesignViewIFrameDocument();
  doc.execCommand("InsertHTML", false, this.htmlText);
  this.htmlEditor.Focus();
  return true;
 },
 InsertNodeAtSelection : function(insertNode) {
  if (__aspxOpera)
   ASPxHtmlEditorCommandList[ASPxClientCommandConsts.DELETE_COMMAND].Execute(null, this.htmlEditor);
  var selection = this.htmlEditor.GetDesignViewIFrameWindow().getSelection();  
  var range = selection.getRangeAt(0);
  selection.removeAllRanges();
  range.deleteContents();
  var container = range.startContainer;
  var startPosition = range.startOffset;
   range = this.htmlEditor.GetDesignViewIFrameDocument().createRange();
  if ((container.nodeType == 3) && (insertNode.nodeType == 3)) {
   container.insertData(startPosition, insertNode.nodeValue);
   range.setEnd(container, startPosition + insertNode.length);
   range.setStart(container, startPosition);
  }
  else {
   var afterNode;
   var isContainerEmpty = false;
   if (container.nodeType == 3) {
    var textNode = container;
    container = textNode.parentNode;
    var nodeText = textNode.nodeValue;
    var textBefore = nodeText.substr(0, startPosition);
    var textAfter = nodeText.substr(startPosition);
     var beforeNode = this.htmlEditor.GetDesignViewIFrameDocument().createTextNode(textBefore);
     var afterNode = this.htmlEditor.GetDesignViewIFrameDocument().createTextNode(textAfter);
    container.insertBefore(afterNode, textNode);
    container.insertBefore(insertNode, afterNode);
    try {
     container.insertBefore(beforeNode, insertNode);
    }
    catch (exc) { }
    container.removeChild(textNode);
   }
   else {
    if (container.childNodes.length > 0) {
     afterNode = container.childNodes[startPosition];
     container.insertBefore(insertNode, afterNode);
    }
    else {
     if (container.tagName != "BODY")
      container = container.parentNode;
     isContainerEmpty = true;
     container.appendChild(insertNode);
    }
   }
   try {
    if (isContainerEmpty) {
     range.selectNode(container.childNodes[container.childNodes.length - 1]);
     range.collapse(false);
    }
    else {
     range.setStart(insertNode, 0);
     if (!_aspxIsExists(afterNode)) 
       afterNode = __aspxNetscapeFamily ? this.htmlEditor.GetDesignViewIFrameDocument().body : insertNode;
      range.setEnd(_aspxIsExists(afterNode) ? afterNode : this.htmlEditor.GetDesignViewIFrameDocument().body, 0);
    }
   }
   catch (exc) { }
  }
  try {
   selection.addRange(range);
  }
  catch (exc) { }
 }
});
CopyPastCommand  = _aspxCreateClass(BrowserCommand, {
 Execute: function(cmdValue, editor) {
  var isSuccessfully = true;
  Command.prototype.Execute.call(this);
  if (__aspxIE)
   isSuccessfully = this.ExecuteIE(editor);
  else {
   var message = "Not supported in this browser";
   if (_aspxIsExists(ASPxCommandMessageConsts[this.commandID]))
    message = ASPxCommandMessageConsts[this.commandID];
   alert(message);
   return false;
  }
  return isSuccessfully;
 },
 ExecuteIE: function(editor) {
  var isSuccessfully = false;
  var isEnabled = !__aspxOpera;
  if (isEnabled) {
   try {
    editor.GetDesignViewIFrameDocument().queryCommandEnabled(this.commandID); 
   }
   catch (e) { 
    isEnabled = false;
   }
  }
  if (isEnabled)
   isSuccessfully = editor.GetDesignViewIFrameDocument().execCommand(this.commandID, false, null);
  return isSuccessfully;
 },
 IsHtmlChangeable: function() {
  return this.GetCommandID() != ASPxClientCommandConsts.COPY_COMMAND;
 }
});
SelectAllBrowserCommand  = _aspxCreateClass(BrowserCommand, {
 IsHtmlChangeable: function() {
  return false;
 }
});
TextTypeCommand = _aspxCreateClass(Command, {
 IsDefaultAction: function() {
  return true;
 },
 IsImmediateExecution: function() {
  return true;
 }
});
KbCopyCommand = _aspxCreateClass(TextTypeCommand, {
 IsHtmlChangeable: function() {
  return false;
 } 
});
KbCutCommand = _aspxCreateClass(TextTypeCommand, {
});
KbPasteCommand = _aspxCreateClass(TextTypeCommand, {
});
LineBreakTypeCommand = _aspxCreateClass(TextTypeCommand, {
});
NewParagraphTypeCommand = _aspxCreateClass(Command, {
 Execute: function(cmdValue, editor) {
  return editor.GetDesignViewIFrameDocument().execCommand("InsertParagraph", false, null);
 }
});
DeleteCommand = _aspxCreateClass(Command, {
 Execute: function(cmdValue, editor) {
    var isSuccessfully = true;
  var designViewIFrameDocument = editor.GetDesignViewIFrameDocument();
    isSuccessfully = designViewIFrameDocument.execCommand(this.commandID, false, null);
    if (__aspxOpera) { 
   designViewIFrameDocument.contentEditable = true;
   designViewIFrameDocument.body.focus();
  }
  return isSuccessfully;
 }
});
DeleteWithoutSelectionCommand = _aspxCreateClass(Command, {
 Execute: function(cmdValue, editor) {
  return true;
 },
 IsImmediateExecution: function() {
  return true;
 }
});
UndoCommand = _aspxCreateClass(Command, {
 Execute: function(cmdValue, editor) {
  var ret = editor.Undo();
  editor.SetFocus();  
  return ret;
 },
 IsReversable: function() {
  return false;
 },
 IsLocked: function(editor) {
  return !editor.IsUndoAvailable();
 }
});
RedoCommand = _aspxCreateClass(Command, {
 Execute: function(cmdValue, editor) {
  var ret = editor.Redo();
  editor.SetFocus();
  return ret;
 },
 IsReversable: function() {
  return false;
 },
 IsLocked: function(editor) {
  return !editor.IsRedoAvailable();
 }
});
CheckSpellingCommand  = _aspxCreateClass(Command, {
 Execute: function(cmdValue, editor) {
  return editor.CheckSpelling();
 },
 IsLocked: function(editor) {
  return aspxIsEmptyHtml(editor.GetHtmlInternal());
 }
});
CheckSpellingCoreCommand = _aspxCreateClass(Command, {
 Execute: function(cmdValue, editor) {
  editor.SetHtmlInternal(cmdValue);
  return true;
 }
});
PrintCommand  = _aspxCreateClass(Command, {
 Execute: function(cmdValue, editor) {
  return editor.Print();
 },
 IsLocked: function(editor) {
  return aspxIsEmptyHtml(editor.GetHtmlInternal());
 },
 IsReversable: function() {
  return false;
 }
});
function aspxIsEmptyHtml(html){
 var html = _aspxTrim(html);
 return html == "" || html == "&nbsp;" || html == "<P>&nbsp;</P>";
}
InsertImageCommand = _aspxCreateClass(BrowserCommand, {
 Execute: function(cmdValue, editor) {
  var newImageElement = this.InsertImage(cmdValue.src, editor);
  ChangeImageCommand.SetImageProperties(newImageElement, "", cmdValue.width,
           cmdValue.height, cmdValue.align, cmdValue.alt,
           cmdValue.useFloat);
  return true;
 },
 InsertImage: function(source, editor) {
  var markerID = ASPxClientSelection.GetMarkerID();
  var htmlText = "<img src='" + source + "' id='" + markerID + "' />";
  ASPxHtmlEditorCommandList[ASPxClientCommandConsts.PASTEHTML_COMMAND].Execute(htmlText, editor);
  var imageElement = _aspxGetElementByIdInDocument(editor.GetDesignViewIFrameDocument(), markerID);
  _aspxRemoveAttribute(imageElement, "id");
  return imageElement;
 }
});
ChangeImageCommand = _aspxCreateClass(Command, {
 Execute: function(cmdValue, editor) {
  ChangeImageCommand.SetImageProperties(cmdValue.imageElement, cmdValue.src, cmdValue.width, 
             cmdValue.height, cmdValue.align, cmdValue.alt,
             cmdValue.useFloat);
  return true;
 }
});
ChangeImageCommand.GetImageProperties = function(imageElement) {
 var imageInfoObject = {
  isCustomSize: false,
  src: imageElement.src,
  width: imageElement.width,
  height: imageElement.height,
  align: "",
  alt: "",
  useFloat: false
 };
 imageInfoObject.isCustomSize = ChangeImageCommand.IsExistImageAttribute(imageElement, "width") ||
           ChangeImageCommand.IsExistImageAttribute(imageElement, "height");
 var parentNode = imageElement.parentNode;
 if (parentNode.childNodes.length == 1 && parentNode.tagName != "BODY") {
  imageInfoObject.align = parentNode.style.textAlign;
  if (!imageInfoObject.align)
   imageInfoObject.align = parentNode.align;
 }
 if (!imageInfoObject.align) {
  if (_aspxIsExistsAttribute(imageElement, "align"))
   imageInfoObject.align = _aspxGetAttribute(imageElement, "align");
  else {
   if (__aspxIE && _aspxIsExists(imageElement.style.styleFloat)) {
    imageInfoObject.align = imageElement.style.styleFloat;
    imageInfoObject.useFloat = true;
   }
   if (!__aspxIE && _aspxIsExists(imageElement.style.cssFloat)) {
    imageInfoObject.align = imageElement.style.cssFloat;
    imageInfoObject.useFloat = true;
   }
  }
 }
 imageInfoObject.alt = _aspxGetAttribute(imageElement, "alt");
 return imageInfoObject;
};
ChangeImageCommand.IsExistImageAttribute = function(image, attrName) {
 var styleAttr = _aspxGetAttribute(image.style, attrName);
 return ((styleAttr != "") && (styleAttr != null)) ||
     (!__aspxNetscapeFamily && (image.outerHTML.toLowerCase().indexOf(attrName + "=") > -1));
};
Command.RemoveFloat = function(imageElement) {
 _aspxRemoveStyleAttribute(imageElement, "styleFloat");
 if (_aspxIsExists(imageElement.style.cssFloat)) 
  imageElement.style.cssFloat = "";
};
ChangeImageCommand.SetImageProperties = function(imageElement, src, width, height, align, alt, useFloat) {
 if (src && src != "")
  _aspxSetAttribute(imageElement, "src", src);
 if (width && width != "")
  _aspxSetAttribute(imageElement.style, "width", width);
 else {
  _aspxRemoveAttribute(imageElement, "width");
  _aspxRemoveAttribute(imageElement.style, "width");
 }
 if (height && height != "")
  _aspxSetAttribute(imageElement.style, "height", height);
 else {
  _aspxRemoveAttribute(imageElement, "height");
  _aspxRemoveAttribute(imageElement.style, "height");
 }
 if (alt && alt != "")
  _aspxSetAttribute(imageElement, "alt", alt);
 if (align) {
  var documentObj = _aspxGetElementDocument(imageElement); 
  var sourceId = imageElement.id;
  imageElement.id = __aspxHEMarkID;
  var parentNode = imageElement.parentNode;
  var wrapElem = null;
  if (parentNode.childNodes.length == 1 && parentNode.tagName != "BODY" && parentNode.tagName != "TD")
   wrapElem = parentNode;
  _aspxRemoveAttribute(imageElement, "align");
  Command.RemoveFloat(imageElement);
  if (align.toLowerCase() == "left" || align.toLowerCase() == "right") {
   if (wrapElem != null)
    _aspxRemoveOuterTags(wrapElem);
   imageElement = _aspxGetElementByIdInDocument(documentObj, __aspxHEMarkID);
   if (useFloat) {
    if (__aspxIE)
     imageElement.style.styleFloat = align;
    else
     imageElement.style.cssFloat = align;
   }
   else
    _aspxSetAttribute(imageElement, "align", align);
  }
  else { 
   if (wrapElem == null)
    wrapElem = _aspxWrapElementInNewElement(imageElement, "DIV");
   wrapElem.style.textAlign = "center";
   imageElement = _aspxGetElementByIdInDocument(documentObj, __aspxHEMarkID);
  }
  sourceId != "" ? imageElement.id = sourceId : _aspxRemoveAttribute(imageElement, "id");
 }
};
InsertLinkCommand = _aspxCreateClass(HtmlProcessingCommand, {
 Execute: function(cmdValue, editor) {
  var curSelection = ASPxClientHtmlEditorSelection.Create(editor);
  var selContainerElement = curSelection.GetParentElement();
  var link = _aspxGetParentByTagName(selContainerElement, "A");
  if (_aspxIsExists(link)) { 
   InsertLinkCommand.prototype.SetLinkProperties(link, cmdValue.url, 
               InsertLinkCommand.PrepareLinkText(cmdValue.text), 
               cmdValue.target, cmdValue.title);
  }  
  else if (curSelection.GetText()!= "" || curSelection.GetParentElement().tagName == "IMG" ||
    curSelection.GetParentElement().tagName == "TABLE") { 
   ASPxHtmlEditorCommandList[ASPxClientCommandConsts.UNLINK_COMMAND].Execute(null, editor);   
   var selInfo = editor.GetEditorSelectionInfo();
   var lastLinkID = 'dx_temp_' + (new Date()).valueOf();
   for (var i = 0; i < selInfo.allElements.length; i++) {
    var curElem = selInfo.allElements[i];
    var parentLink = _aspxGetParentByTagName(curElem, "A");
    var curLink = null;
    if (_aspxIsExists(parentLink)) {
     if (parentLink.href != cmdValue.url)
      InsertLinkCommand.prototype.SetLinkProperties(parentLink, cmdValue.url, "",
                  cmdValue.target, cmdValue.title);
     curLink = parentLink;
    }
    else {
     var elemInnerHtml = curElem.innerHTML;
     var newLinkElement = editor.GetDesignViewIFrameDocument().createElement('A');
     _aspxSetInnerHtml(newLinkElement, elemInnerHtml);
     curElem.innerHTML = '';
     if (__aspxWebKitFamily) newLinkElement.href = "#";
     curElem.appendChild(newLinkElement);
     InsertLinkCommand.prototype.SetLinkProperties(newLinkElement, cmdValue.url, InsertLinkCommand.PrepareLinkText(cmdValue.text),
                 cmdValue.target, cmdValue.title);
     curLink = newLinkElement;
    }
    if (i == selInfo.allElements.length - 1)
     _aspxChangeAttribute(curLink, "id", lastLinkID);
   }   
   editor.DeleteNewAddedFontElements(selInfo);
   var lastLinkElement = _aspxGetElementByIdInDocument(editor.GetDesignViewIFrameDocument(), lastLinkID);
   _aspxRestoreAttribute(lastLinkElement, "id");
   curSelection.SelectElement(lastLinkElement, false);
   if (__aspxOpera)
    editor.GetDesignViewIFrameDocument().body.focus();
  }
  else { 
   var htmlText = "<a href='" + cmdValue.url + "'";
   if (cmdValue.title)
    htmlText = this.AddAttributeStringToHtml(htmlText, "title", cmdValue.title);
   if (cmdValue.target)
    htmlText = this.AddAttributeStringToHtml(htmlText, "target", cmdValue.target);
   htmlText += ">" + InsertLinkCommand.PrepareLinkText(cmdValue.text) + "</a>";
   return ASPxHtmlEditorCommandList[ASPxClientCommandConsts.PASTEHTML_COMMAND].Execute(htmlText, editor);
  }  
  return true;
 },
 AddAttributeStringToHtml: function(html, attrName, attrValue) {
  return html + " " + attrName + "='" + attrValue + "'";
 }
});
InsertLinkCommand.prototype.SetLinkProperties = function(linkElement, url, text, target, title) {
 _aspxSetOrRemoveAttribute(linkElement, "href", url);
 _aspxSetOrRemoveAttribute(linkElement, "target", target);
 _aspxSetOrRemoveAttribute(linkElement, "title", title);
 if (text != "")
  linkElement.innerHTML = text;
}
InsertLinkCommand.PrepareLinkText = function(text) {
 return text.replace("<", "&lt;").replace(">", "&gt;");
}
DialogCommand = _aspxCreateClass(Command, {
 Execute: function(cmdValue, editor) {
  var dialog = ASPxHtmlEditorDialogList[this.commandID];
  if (dialog != null)
   dialog.Execute(editor);
  else
   alert('Dialog is not found');
  return true;
 },
 IsHtmlChangeable: function() {
  return false;
 },
 GetState: function(editor) {
  return false;
 },
 IsLocked: function(editor) {
  return false;
 }
});
PasteFromWordDialogCommand = _aspxCreateClass(DialogCommand, {
 IsLocked: function(editor) {
  if (__aspxWebKitFamily) return false;
  try {
   return !editor.GetDesignViewIFrameDocument().queryCommandEnabled(ASPxClientCommandConsts.PASTE_COMMAND);
  }
  catch(e) {}
  return true;
 }
});
ChangeImageDialogCommand = _aspxCreateClass(DialogCommand, {
 IsLocked: function(editor) {
  return !_aspxIsExists(InsertImageDialog.prototype.GetSelectedImage(editor));
 }
});
ChangeLinkDialogCommand = _aspxCreateClass(DialogCommand, {
 IsLocked: function(editor) {
  return !InsertLinkDialog.prototype.IsLinkSelected(editor);
 }
});
TableCellPropertiesDialogCommand = _aspxCreateClass(DialogCommand, {
 IsLocked: function(editor) {
  return !TableCellPropertiesDialogCommand.IsTableCellSelected(editor);
 }
});
TableCellPropertiesDialogCommand.IsTableCellSelected = function(editor) {
 return _aspxIsExists(InsertTableColumnAndRowCommandBase.GetTableCell(editor));
}
ChangeTableDialogCommand = _aspxCreateClass(DialogCommand, {
 IsLocked: function(editor) {
  return !ChangeTableDialogCommand.IsTableSelected(editor);
 }
});
ChangeTableDialogCommand.IsTableSelected = function(htmlEditor) {
 var curSelection = ASPxClientHtmlEditorSelection.Create(htmlEditor);
 return _aspxIsExists(_aspxHETableHelper.GetTable(curSelection.GetParentElement()));
};
var ASPxHtmlEditorCommandList = {};
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.BOLD_COMMAND] = new BrowserCommand(ASPxClientCommandConsts.BOLD_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.ITALIC_COMMAND] = new BrowserCommand(ASPxClientCommandConsts.ITALIC_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.UNDERLINE_COMMAND] = new BrowserCommand(ASPxClientCommandConsts.UNDERLINE_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.STRIKETHROUGH_COMMAND] = new BrowserCommand(ASPxClientCommandConsts.STRIKETHROUGH_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.JUSTIFYCENTER_COMMAND] = new BrowserCommand(ASPxClientCommandConsts.JUSTIFYCENTER_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.JUSTIFYLEFT_COMMAND] = new BrowserCommand(ASPxClientCommandConsts.JUSTIFYLEFT_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.JUSTIFYRIGHT_COMMAND] = new BrowserCommand(ASPxClientCommandConsts.JUSTIFYRIGHT_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.JUSTIFYFULL_COMMAND] = new BrowserCommand(ASPxClientCommandConsts.JUSTIFYFULL_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.SUPERSCRIPT_COMMAND] = new BrowserCommand(ASPxClientCommandConsts.SUPERSCRIPT_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.SUBSCRIPT_COMMAND] = new BrowserCommand(ASPxClientCommandConsts.SUBSCRIPT_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.INDENT_COMMAND] = new IndentCommand(ASPxClientCommandConsts.INDENT_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.OUTDENT_COMMAND] = new IndentCommand(ASPxClientCommandConsts.OUTDENT_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.INSERTORDEREDLIST_COMMAND] = new InsertListCommand(ASPxClientCommandConsts.INSERTORDEREDLIST_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.INSERTUNORDEREDLIST_COMMAND] = new InsertListCommand(ASPxClientCommandConsts.INSERTUNORDEREDLIST_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.SELECT_ALL] = new SelectAllBrowserCommand(ASPxClientCommandConsts.SELECT_ALL);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.PASTE_COMMAND] = new CopyPastCommand(ASPxClientCommandConsts.PASTE_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.PASTEFROMWORD_COMMAND] = new PasteFromWord(ASPxClientCommandConsts.PASTEFROMWORD_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.CUT_COMMAND] = new CopyPastCommand(ASPxClientCommandConsts.CUT_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.COPY_COMMAND] = new CopyPastCommand(ASPxClientCommandConsts.COPY_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.KBPASTE_COMMAND] = new KbPasteCommand(ASPxClientCommandConsts.KBPASTE_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.KBCUT_COMMAND] = new KbCutCommand(ASPxClientCommandConsts.KBCUT_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.KBCOPY_COMMAND] = new KbCopyCommand(ASPxClientCommandConsts.KBCOPY_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.FONTSIZE_COMMAND] = new FontSizeBrowserCommand(ASPxClientCommandConsts.FONTSIZE_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.FONTNAME_COMMAND] = new BrowserCommand(ASPxClientCommandConsts.FONTNAME_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.FONTCOLOR_COMMAND] = new FontColorBrowserCommand(ASPxClientCommandConsts.FONTCOLOR_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.BACKCOLOR_COMMAND] = new BgColorBrowserCommand(ASPxClientCommandConsts.BACKCOLOR_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.APPLYCSS_COMMAND] = new ApplyCssCommand(ASPxClientCommandConsts.APPLYCSS_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.FORMATBLOCK_COMMAND] = new FormatBlockCommand(ASPxClientCommandConsts.FORMATBLOCK_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.REMOVEFORMAT_COMMAND] = new RemoveFormatCommand(ASPxClientCommandConsts.REMOVEFORMAT_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.UNDO_COMMAND] = new UndoCommand(ASPxClientCommandConsts.UNDO_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.REDO_COMMAND] = new RedoCommand(ASPxClientCommandConsts.REDO_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.LINEBREAKETYPE_COMMAND] = new LineBreakTypeCommand(ASPxClientCommandConsts.LINEBREAKETYPE_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.NEWPARAGRAPHTYPE_COMMAND] = new NewParagraphTypeCommand(ASPxClientCommandConsts.NEWPARAGRAPHTYPE_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.TEXTTYPE_COMMAND] = new TextTypeCommand(ASPxClientCommandConsts.TextType_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.RESIZEOBJECT_COMMAND] = new TextTypeCommand(ASPxClientCommandConsts.RESIZEOBJECT_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.DRAGDROPOBJECT_COMMAND] = new TextTypeCommand(ASPxClientCommandConsts.DRAGDROPOBJECT_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.DROPOBJECTFROMEXTERNAL_COMMAND] = new TextTypeCommand(ASPxClientCommandConsts.DROPOBJECTFROMEXTERNAL_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.DELETE_COMMAND] = new DeleteCommand(ASPxClientCommandConsts.DELETE_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.KBDELETE_COMMAND] = new DeleteWithoutSelectionCommand(ASPxClientCommandConsts.KBDELETE_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.PASTEHTML_COMMAND] = new PasteHtmlCommand(ASPxClientCommandConsts.PASTEHTML_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.INSERTLINK_COMMAND] = new InsertLinkCommand(ASPxClientCommandConsts.INSERTLINK_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.UNLINK_COMMAND] = new BrowserCommand(ASPxClientCommandConsts.UNLINK_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.CHANGEIMAGE_COMMAND] = new ChangeImageCommand(ASPxClientCommandConsts.CHANGEIMAGE_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.INSERTIMAGE_COMMAND] = new InsertImageCommand(ASPxClientCommandConsts.INSERTIMAGE_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.CHECKSPELLING_COMMAND] = new CheckSpellingCommand(ASPxClientCommandConsts.CHECKSPELLING_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.CheckSpellingCore_COMMAND] = new CheckSpellingCoreCommand(ASPxClientCommandConsts.CHECKSPELLING_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.PRINT_COMMAND] = new PrintCommand(ASPxClientCommandConsts.PRINT_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.INSERTTABLE_COMMAND] = new InsertTableCommand(ASPxClientCommandConsts.INSERTTABLE_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.CHANGETABLE_COMMAND] = new ChangeTableCommand(ASPxClientCommandConsts.CHANGETABLE_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.CHANGETABLECELL_COMMAND] = new ChangeTableCellCommand(ASPxClientCommandConsts.CHANGETABLECELL_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.CHANGETABLECOLUMN_COMMAND] = new ChangeTableColumnCommand(ASPxClientCommandConsts.CHANGETABLECOLUMN_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.CHANGETABLEROW_COMMAND] = new ChangeTableRowCommand(ASPxClientCommandConsts.CHANGETABLEROW_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.DELETETABLE_COMMAND] = new DeleteTableCommand(ASPxClientCommandConsts.DELETETABLE_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.DELETETABLEROW_COMMAND] = new DeleteTableRowCommand(ASPxClientCommandConsts.DELETETABLEROW_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.DELETETABLECOLUMN_COMMAND] = new DeleteTableColumnCommand(ASPxClientCommandConsts.DELETETABLECOLUMN_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.INSERTTABLECOLUMNTOLEFT_COMMAND] = new InsertTableColumnCommand(ASPxClientCommandConsts.INSERTTABLECOLUMNTOLEFT_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.INSERTTABLECOLUMNTORIGHT_COMMAND] = new InsertTableColumnCommand(ASPxClientCommandConsts.INSERTTABLECOLUMNTORIGHT_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.INSERTTABLEROWBELOW_COMMAND] = new InsertTableRowCommand(ASPxClientCommandConsts.INSERTTABLEROWBELOW_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.INSERTTABLEROWABOVE_COMMAND] = new InsertTableRowCommand(ASPxClientCommandConsts.INSERTTABLEROWABOVE_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.PASTEFROMWORDDIALOG_COMMAND] = new PasteFromWordDialogCommand(ASPxClientCommandConsts.PASTEFROMWORDDIALOG_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.INSERTIMAGE_DIALOG_COMMAND] = new DialogCommand(ASPxClientCommandConsts.INSERTIMAGE_DIALOG_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.CHANGEIMAGE_DIALOG_COMMAND] = new ChangeImageDialogCommand(ASPxClientCommandConsts.CHANGEIMAGE_DIALOG_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.CHANGELINK_DIALOG_COMMAND] = new ChangeLinkDialogCommand(ASPxClientCommandConsts.CHANGELINK_DIALOG_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.INSERTLINK_DIALOG_COMMAND] = new DialogCommand(ASPxClientCommandConsts.INSERTLINK_DIALOG_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.TABLEPROPERTIES_DIALOG_COMMAND] = new ChangeTableDialogCommand(ASPxClientCommandConsts.TABLEPROPERTIES_DIALOG_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.INSERTTABLE_DIALOG_COMMAND] = new DialogCommand(ASPxClientCommandConsts.INSERTTABLE_DIALOG_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.TABLECELLPROPERTIES_DIALOG_COMMAND] = new TableCellPropertiesDialogCommand(ASPxClientCommandConsts.TABLECELLPROPERTIES_DIALOG_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.TABLECOLUMNPROPERTIES_DIALOG_COMMAND] = new TableCellPropertiesDialogCommand(ASPxClientCommandConsts.TABLECOLUMNPROPERTIES_DIALOG_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.TABLEROWPROPERTIES_DIALOG_COMMAND] = new TableCellPropertiesDialogCommand(ASPxClientCommandConsts.TABLEROWPROPERTIES_DIALOG_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.SPLITTABLECELLHORIZONTALLY_COMMAND] = new SplitTableCellHorizontallyCommand(ASPxClientCommandConsts.SPLITTABLECELLHORIZONTALLY_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.SPLITTABLECELLVERTICALLY_COMMAND] = new SplitTableCellVerticallyCommand(ASPxClientCommandConsts.SPLITTABLECELLVERTICALLY_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.MERGETABLECELLRIGHT_COMMAND] = new MergeTableCellRightCommand(ASPxClientCommandConsts.MERGETABLECELLRIGHT_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.MERGETABLECELLDOWN_COMMAND] = new MergeTableCellDownCommand(ASPxClientCommandConsts.MERGETABLECELLDOWN_COMMAND);
ASPxHtmlEditorCommandList[ASPxClientCommandConsts.Start_COMMAND] = new Command(ASPxClientCommandConsts.TEXTTYPE_COMMAND);
var __aspxEmptySelection = "empty";
CommandManager = _aspxCreateClass(null, {
 constructor: function(htmlEditor) {
  this.htmlEditor = htmlEditor;
  this.commandIdArray = new Array();
  this.currentCmdIDIndex = -1;
  this.lastRestoreSelection = null;
  this.restoreHtmlArray = new Array();
  this.undoSelectionArray = new Array();
  this.redoSelectionArray = new Array();
  this.ExecuteCommand(ASPxClientCommandConsts.Start_COMMAND, "null", true);
 },
 ExecuteCommand: function(cmdID, cmdValue, addToUndoStack) {
  var isSuccessfully = false;
  if (!ASPxHtmlEditorCommandList[cmdID].IsHtmlChangeable() || !addToUndoStack)
   isSuccessfully = ASPxHtmlEditorCommandList[cmdID].Execute(cmdValue, this.htmlEditor);
  else {
   this.OnCommandExecuting(cmdID);
   isSuccessfully = ASPxHtmlEditorCommandList[cmdID].Execute(cmdValue, this.htmlEditor);
   var needAddToStack = isSuccessfully && ASPxHtmlEditorCommandList[cmdID].IsReversable();
   if (needAddToStack) {
    this.ClearActionsToRedo();
    this.currentCmdIDIndex = this.commandIdArray.length;
    _aspxArrayPush(this.commandIdArray, cmdID);
   }
   this.OnCommandExecuted(needAddToStack);
  }
  return isSuccessfully;
 },
 Undo: function(depth) {
  depth = Math.min(depth, this.commandIdArray.length);
  var actionCount = this.commandIdArray.length;
  depth = Math.min(depth, this.commandIdArray.length);
  while ((depth > 0) && (this.currentCmdIDIndex > 0) && (this.currentCmdIDIndex < actionCount)) {
   this.htmlEditor.SetHtmlInternal(this.GetRestoreText(this.currentCmdIDIndex - 1));
   this.GetUndoSelection(this.currentCmdIDIndex - 1).Restore();
   this.currentCmdIDIndex--;
   depth--;
  }
  return true;
 },
 Redo: function(depth) {
  depth = Math.min(depth, this.commandIdArray.length);
  var actionIndex = this.currentCmdIDIndex + 1;
  while (depth > 0 && this.commandIdArray.length >= actionIndex) {
   this.htmlEditor.SetHtmlInternal(this.GetRestoreText(actionIndex));
   this.GetRedoSelection(actionIndex).Restore();
   this.currentCmdIDIndex = actionIndex;
   actionIndex++;
   depth--;
  }
  return true;
 },
 OnCommandExecuting: function(cmdID) {
  if (this.IsUndoRedoCommand(cmdID) &&
   _aspxIsExists(this.commandIdArray[this.currentCmdIDIndex + 1]))
   return;
  if (_aspxIsExists(this.commandIdArray[this.currentCmdIDIndex])) {
   var prevActionUndoSelection = this.htmlEditor.SaveLastSelection();
   if (this.IsLastCommandImmediateExecute()) {
    this.AddNewItemToArray(this.restoreHtmlArray, this.currentCmdIDIndex, this.lastHTML);
    this.UpdateOrAddNewItemToArray(this.undoSelectionArray, this.currentCmdIDIndex, prevActionUndoSelection);
    this.AddNewItemToArray(this.redoSelectionArray, this.currentCmdIDIndex,
      _aspxCloneObject(this.lastRestoreSelection));
   }
   else
    this.undoSelectionArray[this.currentCmdIDIndex] = prevActionUndoSelection;
  }
 },
 OnCommandExecuted: function(needAddToStack) {
  var lastCmdID = this.GetLastCommandID();
  if (needAddToStack && !ASPxHtmlEditorCommandList[lastCmdID].IsImmediateExecution()) {
   this.AddNewItemToArray(this.restoreHtmlArray, this.currentCmdIDIndex, this.GetEditorHtml());
   this.AddNewItemToArray(this.undoSelectionArray, this.currentCmdIDIndex, __aspxEmptySelection);
   this.AddNewItemToArray(this.redoSelectionArray, this.currentCmdIDIndex, this.htmlEditor.SaveLastSelection());
  }
 },
 ClearActionsToRedo: function() {
  if (this.IsRedoAvailable()) {
   this.lastRestoreSelection = null;
   var startIndex = this.currentCmdIDIndex + 1;
   var length = this.commandIdArray.length - this.currentCmdIDIndex;
   this.commandIdArray.splice(startIndex, length);
   this.restoreHtmlArray.splice(startIndex, length);
   this.undoSelectionArray.splice(startIndex, length);
   this.redoSelectionArray.splice(startIndex, length);
  }
 },
 ClearUndoHistory: function() {
  this.lastRestoreSelection = null;
  this.currentCmdIDIndex = -1;
  this.commandIdArray.length = 0;
  this.commandIdArray.length = 0;
  this.restoreHtmlArray.length = 0;
  this.undoSelectionArray.length = 0;
  this.redoSelectionArray.length = 0;
  this.ExecuteCommand(ASPxClientCommandConsts.Start_COMMAND, "null", true);
 },
 CleanEmptyRestoreHtml: function() {
  if (this.GetEditorHtml() == this.lastHTML) {
   _aspxArrayRemoveAt(this.commandIdArray, this.currentCmdIDIndex);
   this.currentCmdIDIndex = this.commandIdArray.length - 1;
  }
 },
 GetEditorHtml: function() {
  return this.htmlEditor.GetHtmlInternal();
 },
 GetRestoreText: function(index) {
  return this.restoreHtmlArray[index];
 },
 GetRedoSelection: function(index) {
  return this.redoSelectionArray[index];
 },
 GetUndoSelection: function(index) {
  return this.undoSelectionArray[index];
 },
 IsRedoAvailable: function() {
  return (this.commandIdArray.length - 1 > this.currentCmdIDIndex);
 },
 IsUndoAvailable: function() {
  return this.currentCmdIDIndex > 0;
 },
 UpdateLastRestoreSelectionAndHTML: function() {
  if (this.lastRestoreSelection == null)
   this.lastRestoreSelection = ASPxClientHtmlEditorSelection.Create(this.htmlEditor);
  this.lastRestoreSelection.Save();
  this.UpdateLastRestoreHtml();
 },
 UpdateLastRestoreHtml: function() {
  this.lastHTML = this.GetEditorHtml();
 },
 UpdateLastItemInRestoreHtmlArray: function() {
  this.restoreHtmlArray[this.restoreHtmlArray.length - 1] = this.GetEditorHtml();
 },
 IsLastCommandImmediateExecute: function() {
  var lastCmdID = this.GetLastCommandID();
  var isImmediateExecution = ASPxHtmlEditorCommandList[lastCmdID].IsImmediateExecution();
  return (lastCmdID != null) && isImmediateExecution &&
    (this.currentCmdIDIndex == this.commandIdArray.length - 1);
 },
 IsDeleting: function() {
  var lastCmdID = this.GetLastCommandID();
  return (lastCmdID != null) && (lastCmdID == ASPxClientCommandConsts.KBDELETE_COMMAND) &&
    (this.currentCmdIDIndex == this.commandIdArray.length - 1);
 },
 IsUndoRedoCommand: function(cmdID) {
  return (cmdID == ASPxClientCommandConsts.REDO_COMMAND) ||
    (cmdID == ASPxClientCommandConsts.UNDO_COMMAND);
 },
 GetLastCommandID: function() {
  var curAction = this.commandIdArray[this.currentCmdIDIndex];
  return _aspxIsExists(curAction) ? curAction : null;
 },
 AddNewItemToArray: function(array, index, value) {
  if (!_aspxIsExists(array[index]))
   _aspxArrayPush(array, value);
 },
 UpdateOrAddNewItemToArray: function(array, index, value) {
  if (!_aspxIsExists(array[index]))
   _aspxArrayPush(array, value);
  else if (array[index] == __aspxEmptySelection)
   array[index] = value;
 }
});
CommandManager.prototype.IsDefaultActionCommand = function(cmdID) {
 return  (cmdID == ASPxClientCommandConsts.KBPASTE_COMMAND) || 
   (cmdID == ASPxClientCommandConsts.KBCUT_COMMAND) || 
   (cmdID == ASPxClientCommandConsts.LINEBREAKETYPE_COMMAND);
}
var ASPxShortcuts = [
 [ASPxClientCommandConsts.BOLD_COMMAND, "CTRL+B"],
 [ASPxClientCommandConsts.ITALIC_COMMAND, "CTRL+I"],
 [ASPxClientCommandConsts.UNDERLINE_COMMAND, "CTRL+U"],
 [ASPxClientCommandConsts.JUSTIFYLEFT_COMMAND, "CTRL+L"],
 [ASPxClientCommandConsts.JUSTIFYCENTER_COMMAND, "CTRL+E"],
 [ASPxClientCommandConsts.JUSTIFYRIGHT_COMMAND, "CTRL+R"],
 [ASPxClientCommandConsts.JUSTIFYFULL_COMMAND, "CTRL+J"],
 [ASPxClientCommandConsts.NEWPARAGRAPHTYPE_COMMAND, "CTRL+ENTER"],
 [ASPxClientCommandConsts.LINEBREAKETYPE_COMMAND, "SHIFT+ENTER"],
 [ASPxClientCommandConsts.UNDO_COMMAND, "CTRL+Z"],
 [ASPxClientCommandConsts.REDO_COMMAND, "CTRL+Y"],
 [ASPxClientCommandConsts.INSERTLINK_DIALOG_COMMAND, "CTRL+K"], 
 [ASPxClientCommandConsts.INSERTIMAGE_DIALOG_COMMAND, "CTRL+G"], 
 [ASPxClientCommandConsts.UNLINK_COMMAND, "CTRL+SHIFT+K"], 
 [ASPxClientCommandConsts.KBPASTE_COMMAND, "CTRL+V"],
 [ASPxClientCommandConsts.KBPASTE_COMMAND, "SHIFT+INSERT"],
 [ASPxClientCommandConsts.KBCUT_COMMAND, "CTRL+X"],
 [ASPxClientCommandConsts.KBCUT_COMMAND, "SHIFT+DELETE"],
 [ASPxClientCommandConsts.KBCOPY_COMMAND, "CTRL+C"],
 [ASPxClientCommandConsts.KBCOPY_COMMAND, "CTRL+INSERT"],
 [ASPxClientCommandConsts.PRINT_COMMAND, "CTRL+P"],
 [ASPxClientCommandConsts.SELECT_ALL, "CTRL+A"]
];
KeyboardManager = _aspxCreateClass(null, {
 constructor: function() {
  this.shortcutCommands = new Array();
 },
 AddShortcut: function(shortcutString, commandID) {
   var shortcutCode = _aspxParseShortcutString(shortcutString);
   this.shortcutCommands[shortcutCode] = commandID;
 }
});
KeyboardManager.prototype.IsSystemKey = function(keyCode) {
 return keyCode == 0 ||
  keyCode >= ASPxKey.F1 && keyCode <= ASPxKey.F12 ||
  keyCode >= ASPxKey.Backspace && keyCode <= ASPxKey.Esc ||
  keyCode >= ASPxKey.Space && keyCode <= ASPxKey.Delete ||
  keyCode == ASPxKey.ContextMenu;
}
KeyboardManager.prototype.IsDeleteOrBackSpaceKey = function(keyCode) {
 return keyCode == ASPxKey.Delete || keyCode == ASPxKey.Backspace;
}
KeyboardManager.prototype.IsBackSpaceKey = function(keyCode) {
 return keyCode == ASPxKey.Backspace;
}
KeyboardManager.prototype.IsCursorMovingKey = function(keyCode) {
 return keyCode >= ASPxKey.PageUp && keyCode <= ASPxKey.Down;
}
KeyboardManager.prototype.GetShortcutCommand = function(evt) { 
 var shortcutCode = _aspxGetShortcutCode(evt.keyCode, evt.ctrlKey, evt.shiftKey, evt.altKey);
 return this.shortcutCommands[shortcutCode];
}
ASPxHtmlEditorDialogSR = { };
ASPxHtmlEditorDialog = _aspxCreateClass(ASPxDialog, {      
 Execute: function(ownerControl) {
  this.htmlEditor = ownerControl;
  this.CreateSelectionInfo();
  if (__aspxIE)
   this.SaveScrollPosition();
  if(__aspxOpera)
   this.SaveDocumentScrollPosition();
  this.htmlEditor.RemoveFocus();
  if(__aspxOpera)
   this.RestoreDocumentScrollPosition();
  this.SetDialogNameInput();
  this.isOnCallbackError = false;
  ASPxDialog.prototype.Execute.call(this, ownerControl);  
 },
 OnCallbackError: function(result, data) {
  this.isOnCallbackError = true;
  this.ClearDialogNameInput();
  this.HideDialog();
  ASPxDialog.prototype.OnCallbackError.call(this, result); 
 }, 
 OnClose: function() {
  ASPxDialog.prototype.OnClose.call(this);
  this.ClearDialogNameInput();
  if (!this.isOnCallbackError)
   this.SaveEditorsState();
 },
 OnCloseButtonClick: function() { 
    this.htmlEditor.RestoreLastSelection(this.selectionInfo.selection);
  this.htmlEditor.UpdateToolbar();
 },
   OnComplete: function(result, params) {
    this.GetDialogPopup().Hide();
    this.htmlEditor.RestoreLastSelection(this.selectionInfo.selection);
  this.DoCustomAction(result, params);
  this.ClearEditorValue();
  if (!result)
   this.htmlEditor.UpdateToolbar();
   },
 OnInitComplete: function() {
  ASPxDialog.prototype.OnInitComplete.call(this);
  if (__aspxIE)
   this.RestoreScrollPositionAndSelection();
  this.htmlEditor.ClearFocusInput(); 
  this.RestoreEditorsState();
 },
 SaveEditorsState: function() {
 },
 RestoreEditorsState: function() {
 },
 ClearEditorValue: function() {
 },
 CreateSelectionInfo: function() {
  var curSelection = this.htmlEditor.CreateRestoreSelectionForDialog();
  this.selectionInfo = {
   selection: curSelection,
   isControl: curSelection.IsControl(),
   text: curSelection.GetText(),
   htmlText: curSelection.GetHtmlText(),
   selectedElement: curSelection.GetParentElement(),
   endSelectedElement: curSelection.GetEndContainer()
  };
 },
 ClearDialogNameInput: function() {
  this.htmlEditor.GetCurrentDialogHiddenInput().value = "";
 },
 SendCallback: function(callbackArgs) {
  this.ownerControl.callbackOwner = this;
  this.ownerControl.CreateCallback(callbackArgs, "", false);
  this.ShowLoadingPanelOverDialogPopup();
 },
 SetDialogNameInput: function() {
  this.htmlEditor.GetCurrentDialogHiddenInput().value = this.name;
 },
 RestoreScrollPositionAndSelection: function() {
    this.htmlEditor.RestoreLastSelection(this.selectionInfo.selection);
    if (this.savedScrollLeft > 0)
     this.htmlEditor.GetDesignViewIFrameDocument().body.scrollLeft = this.savedScrollLeft;
    if (this.savedScrollTop > 0)     
     this.htmlEditor.GetDesignViewIFrameDocument().body.scrollTop = this.savedScrollTop;
 },
 RestoreDocumentScrollPosition: function() {
    document.body.scrollLeft = this.savedDocumentScrollLeft;
    document.body.scrollTop = this.savedDocumentScrollTop;
 },
 SaveScrollPosition: function() {
  this.savedScrollLeft = this.htmlEditor.GetDesignViewIFrameDocument().body.scrollLeft;
  this.savedScrollTop = this.htmlEditor.GetDesignViewIFrameDocument().body.scrollTop;
 }, 
 SaveDocumentScrollPosition: function() {
  this.savedDocumentScrollLeft = _aspxGetDocumentScrollLeft();
  this.savedDocumentScrollTop = _aspxGetDocumentScrollTop();
 }, 
 IsEnabledEditor: function(editor) {
  return _aspxGetElementVisibility(editor.GetMainElement());
 }
});
__aspxDefaultLinkHref = "http://"; 
__aspxMailtToPrefix = "mailto:";
__aspxMailtToSubjectPrefix = "?subject=";
__aspxOpenInNewWindowTarget = "_blank";
InsertLinkDialog = _aspxCreateClass(ASPxHtmlEditorDialog , {
 DoCustomAction: function(result, params) {
  if (result) {   
   var target = "";
   var title = "";
   var text = "";
   var url = "";
   title = params.title;
   text = params.text;
   switch (_dxeRblLinkType.GetValue()) {
    case "Email":
      url = __aspxMailtToPrefix + params.url;
      if (_aspxIsExists(params.subject))
       url += __aspxMailtToSubjectPrefix + params.subject;
      break;
    case "URL":
      url = params.url;
      target = params.isCheckedOpenInNewWindow ? __aspxOpenInNewWindowTarget : "";
      break;
   }
   if (params.isTextOnlySelected && (text == ""))
    text = params.url;
   this.htmlEditor.InsertLink(url, text, target, title);
  }
 },
 GetDialogCaptionText: function() {
  return InsertLinkDialog.prototype.IsLink(this.selectionInfo.selectedElement) 
   ? ASPxHtmlEditorDialogSR.ChangeLink
   : ASPxHtmlEditorDialogSR.InsertLink;
 },
 GetInitInfoObject: function() {
  var linkInfoObject = {
   href: "",
   text: "",
   title: "",
   target: ""
  };
  var link = _aspxGetParentByTagName(this.selectionInfo.selectedElement, "A");
  var isTextEditorVisible =true;
  if (_aspxIsExists(link)) {
   if (!InsertLinkDialog.prototype.ContaintTextNodeOnly(link) || this.selectionInfo.isControl)
    isTextEditorVisible = false;     
  }
  else {
   var img = _aspxGetParentByTagName(this.selectionInfo.selectedElement, "img");
   if (_aspxIsExists(img))
    isTextEditorVisible = false;
   else {
    var text = this.selectionInfo.text;
    if (text) text = this.selectionInfo.htmlText;
    isTextEditorVisible = !ASPxClientSelection.IsHtml(_aspxTrim(text));
   }
  }
  linkInfoObject.isTextEditorVisible = isTextEditorVisible;
  linkInfoObject.text = this.selectionInfo.text;
  if (_aspxIsExists(link)) {
   linkInfoObject.href = _aspxGetAttribute(link, "href");
   linkInfoObject.text = link.innerHTML;
   linkInfoObject.title = _aspxGetAttribute(link, "title");
   linkInfoObject.target = _aspxGetAttribute(link, "target");
  }
  if (linkInfoObject.href == "")
   linkInfoObject.href = __aspxDefaultLinkHref;
  return linkInfoObject;
 },
 InitializeDialogFields: function(linkInfo) {
  var isLinkSelected = InsertLinkDialog.prototype.IsLink(this.selectionInfo.selectedElement);
  this.GetChangeButton().SetVisible(isLinkSelected);
  this.GetInsertButton().SetVisible(!isLinkSelected);
  if ((linkInfo.href != "") && (linkInfo.href.indexOf(__aspxMailtToPrefix) > -1)) {   
   var mailtoIndex = linkInfo.href.indexOf(__aspxMailtToPrefix);
   var subjectIndex = linkInfo.href.indexOf(__aspxMailtToSubjectPrefix);
   var index = subjectIndex > -1 ? subjectIndex : linkInfo.href.length;
   this.GetEmailToTextBox().SetValue(linkInfo.href.substring(mailtoIndex + __aspxMailtToPrefix.length, index));
   var subject = "";
   if (subjectIndex > -1)
    subject = linkInfo.href.substring(subjectIndex + __aspxMailtToSubjectPrefix.length);
   this.GetSubjectTextBox().SetValue(subject);
   this.GetLinkTypeRadioButtonList().SetValue("Email");
  }
  else {
   this.GetLinkTypeRadioButtonList().SetValue("URL");
   this.GetUrlTextBox().SetValue(linkInfo.href);
   this.GetOpenInNewWindowCheckBox().SetValue(linkInfo.target == __aspxOpenInNewWindowTarget);
  }
  this.GetToolTipTextBox().SetValue(linkInfo.title);
  if (linkInfo.isTextEditorVisible)
   this.GetTextTextBox().SetValue(linkInfo.text);
  else {
   this.GetTextTextBox().SetEnabled(false);
   this.GetLabelText().SetEnabled(false);
  }
  this.GetLinkTypeRadioButtonList().RaiseSelectedIndexChanged();  
 },
 ClearEditorValue: function() {
  this.GetEmailToTextBox().SetValue(null);
  this.GetSubjectTextBox().SetValue(null);
  this.GetUrlTextBox().SetValue(null);
  this.GetToolTipTextBox().SetValue(null);
  this.GetTextTextBox().SetValue(null);
 },
 SetFocusInField: function() {
  if (this.GetLinkTypeRadioButtonList().GetValue() == "URL")
   _aspxSetFocusToTextEditWithDelay(_dxeTxbURL.name);
  else
   _aspxSetFocusToTextEditWithDelay(_dxeTxbEmailTo.name);
 },
 GetChangeButton: function() {
  return _aspxIsExists(window._dxeBtnChange) ? _dxeBtnChange : null;
 },
 GetEmailToTextBox: function() {
  return _dxeTxbEmailTo;
 },
 GetInsertButton: function() {
  return _dxeBtnOk;
 },   
 GetLabelText: function() {
  return _dxeLblText;
 },
 GetLinkTypeRadioButtonList: function() {
  return _dxeRblLinkType;
 },
 GetOpenInNewWindowCheckBox: function() {
  return _dxeCkbOpenInNewWindow;
 },
 GetTextTextBox: function() {
  return _dxeTxbText;
 },
 GetToolTipTextBox: function() {
  return _dxeTxbToolTip;
 },
 GetSubjectTextBox: function() {
  return _dxeTxbSubject;
 }, 
 GetUrlTextBox: function() {
  return _dxeTxbURL;
 }
});
InsertLinkDialog.prototype.ContaintTextNodeOnly = function(linkElement) {
 if (linkElement.childNodes.length > 0) {
  for (var i = 0; i < linkElement.childNodes.length; i++) {
   if (linkElement.childNodes[i].nodeType != 3)
    return false;
  }
 }
 return true;
};
InsertLinkDialog.prototype.IsLinkSelected = function(htmlEditor) {
 var curSelection = ASPxClientHtmlEditorSelection.Create(htmlEditor);
 return InsertLinkDialog.prototype.IsLink(curSelection.GetParentElement());
};
InsertLinkDialog.prototype.IsLink = function(element) {
 return _aspxIsExists(_aspxGetParentByTagName(element, "A"));
};
var __aspxPreviewTextElementID = "_dxInsertImagePreviewText";
var __aspxPreviewImageElementID = "_dxInsertImagePreviewImage";
InsertImageDialog = _aspxCreateClass(ASPxHtmlEditorDialog , {
 DoCustomAction: function(result, params) {
  if (result) {
   if (_aspxIsExists(this.selectedImageElement))
    this.htmlEditor.ChangeImage(this.selectedImageElement, params.src, 
           params.width, params.height,
           params.align, params.alt, params.useFloat);
   else
    this.htmlEditor.InsertImage(params.src, params.width, params.height, 
           params.align, params.alt, 
           params.useFloat);
  }
 },
 GetDialogCaptionText: function() {
  var img = InsertImageDialog.prototype.GetImage(this.selectionInfo.selectedElement);
  return _aspxIsExists(img) 
   ? ASPxHtmlEditorDialogSR.ChangeImage
   : ASPxHtmlEditorDialogSR.InsertImage;
 },
 GetInitInfoObject: function() {
  var imageInfoObject = {
   isCustomSize: false,
   src: "",
   width: "",
   height: "",
   align: "",
   alt: "",
   useFloat: false
  };
  this.constrainProportions = true;
  this.selectedImageElement = InsertImageDialog.prototype.GetImage(this.selectionInfo.selectedElement);
  if (_aspxIsExists(this.selectedImageElement))
   imageInfoObject = ChangeImageCommand.GetImageProperties(this.selectedImageElement);
  return imageInfoObject;
 },
 InitializeDialogFields: function(imageInfo) {
  var isImage = _aspxIsExists(this.selectedImageElement);
  this.GetChangeButton().SetVisible(isImage);
  this.GetInsertButton().SetVisible(!isImage);
  if (imageInfo.src) {
   this.fieldInitializing = true;
   _dxeTbxInsertImageUrl.SetValue(imageInfo.src);
   this.OnImageSrcChanged(imageInfo.src);
  }
  this.UpdateSizeFields(imageInfo.width ? imageInfo.width : 0, imageInfo.height ? imageInfo.height : 0);
  if (imageInfo.isCustomSize) {
   _dxeCmbSize.SetValue("custom");
   _dxeCmbSize.OnSelectChanged();
  }
  if (imageInfo.align)
   _dxeCmbImagePosition.SetValue(imageInfo.align);
  if (imageInfo.alt)
   _dxeTxbDescription.SetValue(imageInfo.alt);
  if (imageInfo.useFloat)
   _dxeCkbWrapTextArroundImage.SetChecked(imageInfo.useFloat);
 },
 ClearEditorValue: function() {
  _dxeTbxInsertImageUrl.SetValue(null);
  _dxeTxbDescription.SetValue(null);
  _dxeCkbWrapTextArroundImage.SetChecked(false);
  this.GetThumbnailFileNameTextBox().SetValue(null);
 },
 SaveEditorsState: function() {
  var checkBox = this.GetCheckBoxMoreImageOptions();
  if (_aspxIsExists(checkBox)) {
   this.htmlEditor.moreImageOptions = checkBox.GetChecked();
  }
 },
 RestoreEditorsState: function() {  
  if (_aspxIsExists(this.htmlEditor.moreImageOptions)) {
   this.GetCheckBoxMoreImageOptions().SetChecked(this.htmlEditor.moreImageOptions);
   this.GetCheckBoxMoreImageOptions().RaiseCheckedChanged();
  }
 },
 GetPreviewTextElement: function() {
  return _aspxGetElementById(this.htmlEditor.name + __aspxPreviewTextElementID);
 },
 GetPreviewImageElement: function() {
  return _aspxGetElementById(this.htmlEditor.name + __aspxPreviewImageElementID);
 },
 GetPreviewAreaCell: function() {
  return _aspxGetParentByTagName(this.GetPreviewImageElement(), "td");
 },
 GetChangeButton: function() {
  return _dxeBtnChangeImage;
 },
 GetCheckBoxMoreImageOptions: function() {
  return _aspxIsExists(window._dxeCkbMoreImageOptions) ? _dxeCkbMoreImageOptions : null;
 },
 GetClientUploadDirectory: function() {
  return this.htmlEditor.uploadImageFileDirectoryPath;
 },
 GetThumbnailCheckBox: function() {
  return _dxeCkbCreateThumbnail;
 }, 
 GetErrorLabel: function() {
  return _dxeLblError;
 },
 GetInsertButton: function() {
  return _dxeBtnInsertImage;
 },   
 GetImageUploader: function() {
  return _dxeUplImage;
 },
 GetThumbnailFileNameTextBox: function() {
  return _dxeThumbnailFileName;
 },
 GetInsertImageUrlTextBox: function() {
  return _dxeTbxInsertImageUrl;
 },
 IsFieldInitializing: function() {
  if (_aspxIsExists(this.fieldInitializing))
   return this.fieldInitializing;
  return false;
 },
 SetFocusInField: function() {
  _aspxSetFocusToTextEditWithDelay(_dxeTbxInsertImageUrl.name);
 }, 
 OnCallback: function(result) {
  if (result.indexOf(__aspxHESaveImageToServerCallbackPrefix) == 0) {
   this.OnImageSavedToServer(result.substring(__aspxHESaveImageToServerCallbackPrefix.length + 1, result.length));
   this.ownerControl.callbackOwner = null;
  }
  else
   ASPxDialog.prototype.OnCallback.call(this, result);
 },
 OnComplete: function(result, params) {
  this.insertImageParams = params;
  if (result) {
   if(_dxeRblImageFromThisComputer.GetChecked())
    return this.GetImageUploader().UploadFile();
   else if (this.IsCreateThumbnail())
    return this.SaveThumbnailImageToServerViaCallback(this.GetInsertImageUrlTextBox().GetText(),
                  this.GetThumbnailFileNameTextBox().GetText(),
                  params.width, params.height);
   else if (this.IsSaveImageToServer() && _dxeRblImageFromTheWeb.GetChecked())
    return this.SaveImageToServerViaCallback(this.GetInsertImageUrlTextBox().GetText());
  }
  ASPxHtmlEditorDialog.prototype.OnComplete.call(this, result, params);
 },
 OnImageSavedToServer: function(result) {
  if (result.indexOf(__aspxSaveImageToServerErrorCallbackPrefix) > -1)
   this.ShowErrorMessage(result.substring(__aspxSaveImageToServerErrorCallbackPrefix.length + 1, result.length));
  else {
   this.insertImageParams.src = result.substr(__aspxSaveImageToServerNewUrlCallbackPrefix.length + 1, result.length);
   ASPxHtmlEditorDialog.prototype.OnComplete.call(this, 1, this.insertImageParams);
  }
 },
 OnConstrainProportionsSwitchClick: function(evt, invisibleSwitchImgID) {
  var visibleSwitchImg = _aspxGetEventSource(evt);
  var invisibleSwitchImg = _aspxGetElementById(invisibleSwitchImgID);
  _aspxSetElementDisplay(visibleSwitchImg, false);
  _aspxSetElementDisplay(invisibleSwitchImg, true); 
  this.constrainProportions = !this.constrainProportions;
  if (this.constrainProportions)
   this.UpdateSizeFields(this.initialWidth, this.initialHeight);
 },
 OnImageUploadStart: function() {
  this.ShowLoadingPanelOverDialogPopup();
 },
 OnImageUploadComplete: function(args) {
  this.HideLoadingPanelOverDialogPopup();
  if (args.isValid) {
   var fileName = this.GetClientUploadDirectory() + args.callbackData;
   this.insertImageParams.src = fileName;
   if (this.IsCreateThumbnail())
    this.SaveThumbnailImageToServerViaCallback(ASPxClientPath.GetBaseUrlPath() + fileName,
                 this.GetThumbnailFileNameTextBox().GetText(),
                 this.insertImageParams.width, this.insertImageParams.height);
   else
    ASPxHtmlEditorDialog.prototype.OnComplete.call(this, 1, this.insertImageParams);
  }
 },
 OnImageUploadTextChanged: function() {
  this.UpdateThumbnailFileName(this.GetImageUploader().GetText());
 },
 OnImageSrcChanged: function(src) {
  this.CheckImageExisting(src);
  this.UpdateThumbnailFileName(src);
 },
 OnImageFromTypeChanged: function() {
  var src = _dxeRblImageFromTheWeb.GetChecked() ? this.GetInsertImageUrlTextBox().GetText() :
              this.GetImageUploader().GetText();
  this.UpdateThumbnailFileName(src);
 },
 OnLoadTestExistingImage: function() {  
  this.GetPreviewImageElement().src = this.testImage.src;  
  var previewAreaTD = this.GetPreviewAreaCell();
  var maxWidth = previewAreaTD.clientWidth;
  var maxHeight = __aspxWebKitFamily ? previewAreaTD.offsetHeight : previewAreaTD.clientHeight;
  this.SetPreviewImageSize(this.testImage.width, this.testImage.height, maxWidth, maxHeight);  
  _aspxSetElementDisplay(this.GetPreviewTextElement(), false);
  _aspxSetElementDisplay(this.GetPreviewImageElement(), true);
  previewAreaTD.style.borderStyle = "none";
  this.UpdateSizeFieldsAfterLoad(this.testImage.width, this.testImage.height);
 },
 OnErrorTestExistingImage: function() {
  _aspxSetElementDisplay(this.GetPreviewTextElement(), true);
  _aspxSetElementDisplay(this.GetPreviewImageElement(), false);
  var previewAreaTD = this.GetPreviewAreaCell();
  previewAreaTD.style.borderStyle = "";
  this.UpdateSizeFieldsAfterLoad();
 },
 OnSizeSpinNumberChanged: function(sizeType) {
  if (this.constrainProportions)
   this.UpdateSizeSpinEditsWithConstrainProportions(sizeType);
 },
 OnSizeSpinKeyUp: function(sizeType, htmlEvent) {
  if (this.constrainProportions) {
   var keyCode = _aspxGetKeyCode(htmlEvent);  
   if (keyCode != ASPxKey.Tab && keyCode != ASPxKey.Shift)
    this.UpdateSizeSpinEditsWithConstrainProportions(sizeType);
  }
 },
 CheckImageExisting: function(checkingSrc) {
  if (document.images) {
   if (this.testImage == null) {
    this.testImage = new Image();
    _aspxAttachEventToElement(this.testImage, "load",
           new Function("aspxTestExistingImageOnLoad" + "('" + this.htmlEditor.name + "');"));
    _aspxAttachEventToElement(this.testImage, "error",
           new Function("aspxTestExistingImageOnError" + "('" + this.htmlEditor.name + "');"));
   }
   this.testImage.src = checkingSrc;
  }
 },
 IsCreateThumbnail: function() {  
  return this.GetThumbnailCheckBox().GetChecked() && _dxeCmbSize.GetValue() == "custom";
 },
 IsSaveImageToServer: function() {
  return _dxeCkbSaveToServer.GetValue() || !this.htmlEditor.allowInsertDirectImageUrls;
 },
 SetPreviewImageSize: function(sourceWidth, sourceHeight, maxWidth, maxHeight) {
  var newWidth = sourceWidth;
  var newHeight = sourceHeight;
  if ((sourceWidth > maxWidth) || 
   (sourceHeight > maxHeight)) {
   var cw = sourceWidth/maxWidth;   
   var ch = sourceHeight/maxHeight;
   if (cw > ch) {
    var cw = sourceWidth/maxWidth;   
    newWidth = Math.floor(sourceWidth/cw);
    newHeight = Math.floor(sourceHeight/cw);
   }
   else {
    newWidth = Math.floor(sourceWidth/ch);
    newHeight = Math.floor(sourceHeight/ch);
   }
  }  
  var previewImage = this.GetPreviewImageElement();
  previewImage.style.width = newWidth + "px";
  previewImage.style.height = newHeight + "px";
 },
 SaveImageToServerViaCallback: function(src) {
  this.SendCallback(_aspxFormatCallbackArg(__aspxHESaveImageToServerCallbackPrefix, src));
 },
 SaveThumbnailImageToServerViaCallback: function(src, newImageFileName, thumbnailWidth, thumbnailHeight) {
  this.SendCallback(_aspxFormatCallbackArgs([
   [ __aspxHESaveImageToServerCallbackPrefix, src ],
   [ __aspxHEThumbnailImageWidthCallbackPrefix, thumbnailWidth ],
   [ __aspxHEThumbnailImageHeightCallbackPrefix, thumbnailHeight ],
   [ __aspxHEThumbnailImageFileNameCallbackPrefix, newImageFileName ]
  ]));
 },
 HideErrorMessage: function() {
  this.GetErrorLabel().SetVisible(false);
 },
 ShowErrorMessage: function(message) {
  var textBox = this.GetInsertImageUrlTextBox();
  textBox.isValid = false;
  textBox.errorText = message;
  textBox.UpdateErrorFrameAndFocus(false, true);
 },
 UpdateConstrainProportionsCoef: function(width, height) {
  if ((width == height) || (height == 0))
   this.constrainProportionsCoef_WH = 1;
  else
   this.constrainProportionsCoef_WH = width/height;
  this.initialWidth = width;
  this.initialHeight = height;
 },
 UpdateSizeSpinEditsWithConstrainProportions: function(sizeType) {
  var newWidth = _dxeSpnWidth.GetNumber();
  var newHeight = _dxeSpnHeight.GetNumber();
  switch(sizeType) {
   case "width":
    _dxeSpnWidth.SaveSelectionStartAndEndPosition();
    newHeight = _dxeSpnWidth.GetParsedNumber()/this.constrainProportionsCoef_WH;
    _dxeSpnHeight.SetValue(Math.floor(newHeight));
    _dxeSpnWidth.RestoreSelectionStartAndEndPosition();
    break;
   case "height":
    _dxeSpnHeight.SaveSelectionStartAndEndPosition();
    newWidth = _dxeSpnHeight.GetParsedNumber()*this.constrainProportionsCoef_WH;
    _dxeSpnWidth.SetValue(Math.floor(newWidth));
    _dxeSpnHeight.RestoreSelectionStartAndEndPosition();
    break;
  }
 }, 
 UpdateSizeFields: function(imageWidth, imageHeight) {
  _dxeSpnWidth.SetValue(imageWidth >= 0 ? imageWidth : 0);
  _dxeSpnHeight.SetValue(imageHeight >=0 ? imageHeight: 0);
  this.UpdateConstrainProportionsCoef(_dxeSpnWidth.GetNumber(), _dxeSpnHeight.GetNumber());
 },
 UpdateSizeFieldsAfterLoad: function(imageWidth, imageHeight) {
  if (!this.IsFieldInitializing())
   this.UpdateSizeFields(imageWidth, imageHeight);
  else
   this.fieldInitializing = false;
 },
 UpdateThumbnailFileName: function(src) {
  var fileName = ASPxClientPath.GetFileNameWithoutExtension(src);
  if (fileName)
   fileName += "Thumbnail.jpg";
  this.GetThumbnailFileNameTextBox().SetText(fileName);
 }
});
InsertImageDialog.prototype.GetSelectedImage = function(htmlEditor) {
 var curSelection = ASPxClientHtmlEditorSelection.Create(htmlEditor);
 var containerElement = curSelection.GetParentElement();  
 return InsertImageDialog.prototype.GetImage(containerElement);
}
InsertImageDialog.prototype.GetImage = function(element) {
 return _aspxGetParentByTagName(element, "img");
}
function aspxInsertImageSrcValueChanged(src) {
 var htmlEdit = aspxGetControlCollection().Get(__aspxCurrentControlNameInDialog);
 var curDialog = htmlEdit != null ? ASPxDialog.GetLastDialog(htmlEdit) : null;
 if (curDialog != null) curDialog.OnImageSrcChanged(src);
}
function aspxConstrainProportionsSwitchClick(evt, invisibleSwitchImgID) {
 var htmlEdit = aspxGetControlCollection().Get(__aspxCurrentControlNameInDialog);
 var curDialog = htmlEdit != null ? ASPxDialog.GetLastDialog(htmlEdit) : null;
 if (curDialog != null) 
  return curDialog.OnConstrainProportionsSwitchClick(evt, invisibleSwitchImgID);
}
function aspxImageUploadStart() {
 var htmlEdit = aspxGetControlCollection().Get(__aspxCurrentControlNameInDialog);
 var curDialog = htmlEdit != null ? ASPxDialog.GetLastDialog(htmlEdit) : null;
 if (curDialog != null)
  return curDialog.OnImageUploadStart();
}
function aspxImageUploadComplete(args) {
 var htmlEdit = aspxGetControlCollection().Get(__aspxCurrentControlNameInDialog);
 var curDialog = htmlEdit != null ? ASPxDialog.GetLastDialog(htmlEdit) : null;
 if (curDialog != null)
  return curDialog.OnImageUploadComplete(args);
}
function aspxImageUploadTextChanged() {
 var htmlEdit = aspxGetControlCollection().Get(__aspxCurrentControlNameInDialog);
 var curDialog = htmlEdit != null ? ASPxDialog.GetLastDialog(htmlEdit) : null;
 if (curDialog != null)
  return curDialog.OnImageUploadTextChanged();
}
function aspxOnImageFromTypeChanged() {
 var htmlEdit = aspxGetControlCollection().Get(__aspxCurrentControlNameInDialog);
 var curDialog = htmlEdit != null ? ASPxDialog.GetLastDialog(htmlEdit) : null;
 if (curDialog != null)
  return curDialog.OnImageFromTypeChanged();
}
function aspxTestExistingImageOnLoad(name) {
 var htmlEdit = aspxGetControlCollection().Get(name);
 var curDialog = htmlEdit != null ? ASPxDialog.GetLastDialog(htmlEdit) : null;
 if (curDialog != null) curDialog.OnLoadTestExistingImage();
}
function aspxTestExistingImageOnError(name) {
 var htmlEdit = aspxGetControlCollection().Get(name);
 var curDialog = htmlEdit != null ? ASPxDialog.GetLastDialog(htmlEdit) : null;
 if (curDialog != null) curDialog.OnErrorTestExistingImage();
}
function aspxSizeSpinNumberChanged(sizeType) {
 var htmlEdit = aspxGetControlCollection().Get(__aspxCurrentControlNameInDialog);
 var curDialog = htmlEdit != null ? ASPxDialog.GetLastDialog(htmlEdit) : null;
 if (curDialog != null) 
  return curDialog.OnSizeSpinNumberChanged(sizeType);
}
function aspxSizeSpinKeyUp(sizeType, htmlEvent) {
 var htmlEdit = aspxGetControlCollection().Get(__aspxCurrentControlNameInDialog);
 var curDialog = htmlEdit != null ? ASPxDialog.GetLastDialog(htmlEdit) : null;
 if (curDialog != null)
  return curDialog.OnSizeSpinKeyUp(sizeType, htmlEvent);
}
InsertTableDialog = _aspxCreateClass(ASPxHtmlEditorDialog, {
 DoCustomAction: function(result, cmdValue) {
  if (result)
   this.htmlEditor.ExecuteCommand(ASPxClientCommandConsts.INSERTTABLE_COMMAND, cmdValue, true);
 },
 GetDialogCaptionText: function() {
  return ASPxHtmlEditorDialogSR.InsertTable;
 },
 InitializeDialogFields: function(tableInfo) {
  this.SetDisplayColumnsAndRowsEditors(true);
 },
 SetFocusInField: function() {
  _aspxSetFocusToTextEditWithDelay(_dxeSpnTableColumns.name);
 },
 SetDisplayColumnsAndRowsEditors: function(display) {
  _dxeCkbColumnsEqualWidth.SetClientVisible(display);
  var row = this.GetRowsAndColumnsRowElement();
  _aspxSetElementDisplay(row, display);
  _aspxSetElementDisplay(_aspxHETableHelper.GetNextRow(row), display);
 },
 GetRowsAndColumnsRowElement: function() {
  return _aspxGetParentByTagName(_dxeSpnTableColumns.GetMainElement(), "TR");
 }
});
TablePropertiesDialog = _aspxCreateClass(InsertTableDialog, {
 DoCustomAction: function(result, cmdValue) {
  if (result) {
   cmdValue = { tableElement: this.selectedTable, tableProperties: cmdValue.tableProperties };
   this.htmlEditor.ExecuteCommand(ASPxClientCommandConsts.CHANGETABLE_COMMAND, cmdValue, true);
  }
 },
 GetInitInfoObject: function() {
  var tableInfoObject = {
   borderWidth: null,
   borderColor: "",
   backgroundColor: "",
   width: "",
   height: "",
   cellPadding: "",
   cellSpacing: "",
   align: null,
   accessibility: null
  };
  this.selectedTable = _aspxHETableHelper.GetTable(this.selectionInfo.selectedElement);
  if (_aspxIsExists(this.selectedTable))
   tableInfoObject = _aspxHETableHelper.GetTableProperties(this.selectedTable);
  return tableInfoObject;
 },
 InitializeDialogFields: function(tableInfo) {
  this.SetDisplayColumnsAndRowsEditors(false);
  TablePropertiesDialog.SetSizeEditors(_dxeCmbTableWidth, _dxeCmbTableWidthType, _dxeTxbTableWidth, tableInfo.width);
  TablePropertiesDialog.SetSizeEditors(_dxeCmbTableHeight, _dxeCmbTableHeightType, _dxeTxbTableHeight, tableInfo.height);
  _dxeSpnCellPadding.SetText(tableInfo.cellPadding);
  _dxeSpnCellSpacing.SetText(tableInfo.cellSpacing);
  _dxeCmbTableAlign.SetValue(tableInfo.align);
  if (tableInfo.align)
   _dxeCmbTableAlign.SetValue(tableInfo.align.toLowerCase());
  _dxeSpnTableBorderSize.SetText(tableInfo.borderWidth);
  _dxeTxbTableBorderColor.SetText(tableInfo.borderColor);
  _dxeTxbTableBackgroundColor.SetText(tableInfo.backgroundColor);
  var accessibility = tableInfo.accessibility;
  _dxeTxbTableSummary.SetText(accessibility.summary);
  _dxeTxbTableCaption.SetText(accessibility.caption);
  _dxeCmbTableHeaders.SetValue(accessibility.headers);
 },
 GetDialogCaptionText: function() {
  return ASPxHtmlEditorDialogSR.ChangeTable;
 },
 SetFocusInField: function() {
  _aspxSetFocusToTextEditWithDelay(_dxeCmbTableWidth.name);
 }
});
TablePropertiesDialog.SetSizeEditors = function(cmb, cmbType, spinEdit, value) {
 cmb.SetValue(value);
 var selectedItem = cmb.GetSelectedItem();
 if (selectedItem == null) {
  cmb.SetValue("custom");
  var res = _aspxHETableHelper.ParseSizeString(value);
  if (res.valueType) {
   value = res.value;
   cmbType.SetValue(res.valueType);
   cmbType.RaiseValueChangedEvent();
  }
  spinEdit.SetText(value);
 }
 cmb.RaiseValueChangedEvent();
}
TableCellPropertiesDialog = _aspxCreateClass(ASPxHtmlEditorDialog, {
 DoCustomAction: function(result, cmdValue) {
  if (result) {
   cmdValue = { cellElement: this.selectedCell, properties: cmdValue };
   this.htmlEditor.ExecuteCommand(ASPxClientCommandConsts.CHANGETABLECELL_COMMAND, cmdValue, true);
  }
 },
 GetDialogCaptionText: function() {
  return ASPxHtmlEditorDialogSR.ChangeTableCell;
 },
 InitializeDialogFields: function(cellInfo) {
  this.SetSizeEditorsDisplay(false);
  _dxeCkbApplyForAllElements.SetVisible(true);
  _dxeTxbTableColumnBackgroundColor.SetText(cellInfo.backgroundColor);
  _dxeCmbTableColumnAlign.SetValue(cellInfo.align);
  if (cellInfo.align)
   _dxeCmbTableColumnAlign.SetValue(cellInfo.align.toLowerCase());
  _dxeCmbTableColumnVAlign.SetValue(cellInfo.vAlign);
  if (cellInfo.vAlign)
   _dxeCmbTableColumnVAlign.SetValue(cellInfo.vAlign.toLowerCase());
 },
 GetInitInfoObject: function() {
  var cellInfoObject = {
   backgroundColor: "",
   align: null,
   vAlign: null
  };
  this.selectedCell = _aspxHETableHelper.GetTableCellBySelection(this.selectionInfo.selectedElement,
                  this.selectionInfo.endSelectedElement);
  if (_aspxIsExists(this.selectedCell))
   cellInfoObject = _aspxHETableHelper.GetCellProperties(this.selectedCell);
  return cellInfoObject;
 },
 SetFocusInField: function() {
  _aspxSetFocusToTextEditWithDelay(_dxeCmbTableColumnAlign.name);
 },
 SetSizeEditorsDisplay: function(display) {
  _dxeRPTableColumnSize.SetVisible(display);
  var firstMainElem = _dxeRPTableColumnSize.GetMainElement();
  var secondMainElem = _dxeRPTableLayout.GetMainElement();
  if (_aspxIsExists(firstMainElem) && _aspxIsExists(secondMainElem)) {
   var curElem = firstMainElem.nextSibling;
   while (curElem != secondMainElem) {
    if (curElem.nodeType == 1)
     _aspxSetElementDisplay(curElem, display);
    curElem = curElem.nextSibling;
   }
  }
 },
 OnComplete: function(result, params) {
  ASPxHtmlEditorDialog.prototype.OnComplete.call(this, result, params);
  _dxeCkbApplyForAllElements.SetChecked(false);
 },
 SetWidthEditorsDisplay: function(display) {
  _aspxSetElementDisplay(_aspxGetElementById(this.GetWidthEditorsTRID()), display);
 },
 SetHeightEditorsDisplay: function(display) {
  _aspxSetElementDisplay(_aspxGetElementById(this.GetHeightEditorsTRID()), display);
 },
 GetWidthEditorsTRID: function() {
  return this.htmlEditor.name + "_dxeColumnWidthCell";
 },
 GetHeightEditorsTRID: function() {
  return this.htmlEditor.name + "_dxeColumnHeightCell";
 }
});
TableColumnPropertiesDialog = _aspxCreateClass(TableCellPropertiesDialog, {
 DoCustomAction: function(result, cmdValue) {
  if (result) {
   cmdValue = { cell: this.selectedCell, properties: cmdValue };
   this.htmlEditor.ExecuteCommand(ASPxClientCommandConsts.CHANGETABLECOLUMN_COMMAND, cmdValue, true);
  }
 },
 SetFocusInField: function() {
  _aspxSetFocusToTextEditWithDelay(_dxeCmbTableColumnAlign.name);
 },
 GetInitInfoObject: function() {
  var columnInfoObject = {
   backgroundColor: "",
   width: "",
   align: null,
   vAlign: null
  };
  var table = _aspxHETableHelper.GetTable(this.selectionInfo.selectedElement);
  this.selectedCell = _aspxHETableHelper.GetTableCellBySelection(this.selectionInfo.selectedElement,
                 this.selectionInfo.endSelectedElement);
  if (_aspxIsExists(table))
   columnInfoObject = _aspxHETableHelper.GetColumnProperties(this.selectedCell);
  return columnInfoObject;
 },
 InitializeDialogFields: function(columnInfo) {
  _dxeTxbTableColumnBackgroundColor.SetText(columnInfo.backgroundColor);
  _dxeCkbApplyForAllElements.SetVisible(false);
  this.SetWidthEditorsDisplay(true);
  this.SetHeightEditorsDisplay(false);
  this.SetSizeEditorsDisplay(true);
  _dxeCmbTableColumnAlign.SetValue(columnInfo.align);
  if (columnInfo.align)
   _dxeCmbTableColumnAlign.SetValue(columnInfo.align.toLowerCase());
  _dxeCmbTableColumnVAlign.SetValue(columnInfo.vAlign);
  if (columnInfo.vAlign)
   _dxeCmbTableColumnVAlign.SetValue(columnInfo.vAlign.toLowerCase());
  TablePropertiesDialog.SetSizeEditors(_dxeCmbTableColumnWidth, _dxeCmbTableColumnWidthType,
           _dxeTxbTableColumnWidth, columnInfo.width);
 },
 GetDialogCaptionText: function() {
  return ASPxHtmlEditorDialogSR.ChangeTableColumn;
 }
});
TableRowPropertiesDialog = _aspxCreateClass(TableCellPropertiesDialog, {
 DoCustomAction: function(result, cmdValue) {
  if (result) {
   cmdValue = { cell: this.selectedCell, properties: cmdValue };
   this.htmlEditor.ExecuteCommand(ASPxClientCommandConsts.CHANGETABLEROW_COMMAND, cmdValue, true);
  }
 },
 SetFocusInField: function() {
  _aspxSetFocusToTextEditWithDelay(_dxeCmbTableColumnAlign.name);
 },
 GetInitInfoObject: function() {
  var rowInfoObject = {
   backgroundColor: "",
   height: "",
   align: null,
   vAlign: null
  };
  var table = _aspxHETableHelper.GetTable(this.selectionInfo.selectedElement);
  this.selectedCell = _aspxHETableHelper.GetTableCellBySelection(this.selectionInfo.selectedElement,
                 this.selectionInfo.endSelectedElement);
  if (_aspxIsExists(this.selectedCell))
   rowInfoObject = _aspxHETableHelper.GetRowProperties(this.selectedCell);
  return rowInfoObject;
 },
 GetDialogCaptionText: function() {
  return ASPxHtmlEditorDialogSR.ChangeTableRow;
 },
 InitializeDialogFields: function(rowInfo) {
  _dxeTxbTableColumnBackgroundColor.SetText(rowInfo.backgroundColor);
  _dxeCkbApplyForAllElements.SetVisible(false);
  this.SetWidthEditorsDisplay(false);
  this.SetHeightEditorsDisplay(true);
  this.SetSizeEditorsDisplay(true);
  _dxeCmbTableColumnAlign.SetValue(rowInfo.align);
  if (rowInfo.align)
   _dxeCmbTableColumnAlign.SetValue(rowInfo.align.toLowerCase());
  _dxeCmbTableColumnVAlign.SetValue(rowInfo.vAlign);
  if (rowInfo.vAlign)
   _dxeCmbTableColumnVAlign.SetValue(rowInfo.vAlign.toLowerCase());
  TablePropertiesDialog.SetSizeEditors(_dxeCmbTableRowHeight, _dxeCmbTableRowHeightType, _dxeTxbTableRowHeight, rowInfo.height);
 }
});
PasteFromWordDialog = _aspxCreateClass(ASPxHtmlEditorDialog, {
 DoCustomAction: function(result, cmdValue) {
  _aspxRemoveElement(this.GetPasteContainerIFrame());
  if (result && cmdValue.html)
   this.htmlEditor.ExecuteCommand(ASPxClientCommandConsts.PASTEFROMWORD_COMMAND, cmdValue, true);
 },
 InitializeDialogFields: function() {
  var contentDocument = this.GetPasteContainerIFrame().contentWindow.document;
  contentDocument.open();
  contentDocument.write("<head><style></style></head><body></body>");
  contentDocument.close();
  if (__aspxIE)
   contentDocument.body.contentEditable = true;
  else {
   contentDocument.body.spellcheck = false;
   contentDocument["designMode"] = "on";
  }
  _aspxAttachEventToElement(contentDocument, "keypress", aspxHEPasteFromWordContainerKeyPress);
  contentDocument.body.style.margin = "0px";
  contentDocument.body.style.padding = "2px";
  contentDocument.body.style.border = "Solid 0px";
 },
 SetFocusInField: function() {
  _aspxSetTimeout("_aspxIFrameWindow('" + this.GetPasteContainerIFrameName() + "').focus();", 500);
 },
 GetDialogCaptionText: function() {
  return ASPxHtmlEditorDialogSR.PasteFromWord;
 },
 OnPasteContainerKeyPress: function(evt) {
  if (evt.keyCode == ASPxKey.Esc)
   this.HideDialog();
 },
 GetPasteContainerIFrame: function() {
  return _aspxGetElementById(this.GetPasteContainerIFrameName());
 },
 GetPasteContainerIFrameName: function() {
  return this.htmlEditor.name + "_dxePasteFromWordContainer";
 }
});
function aspxHEPasteFromWordContainerKeyPress(evt) {
 var htmlEdit = aspxGetControlCollection().Get(__aspxCurrentControlNameInDialog);
 var curDialog = htmlEdit != null ? ASPxDialog.GetLastDialog(htmlEdit) : null;
 if (curDialog != null)
  return curDialog.OnPasteContainerKeyPress(evt);
}
var ASPxHtmlEditorDialogList = {};
ASPxHtmlEditorDialogList[ASPxClientCommandConsts.INSERTLINK_DIALOG_COMMAND] = new InsertLinkDialog(ASPxClientCommandConsts.INSERTLINK_DIALOG_COMMAND);
ASPxHtmlEditorDialogList[ASPxClientCommandConsts.CHANGELINK_DIALOG_COMMAND] = new InsertLinkDialog(ASPxClientCommandConsts.INSERTLINK_DIALOG_COMMAND);
ASPxHtmlEditorDialogList[ASPxClientCommandConsts.INSERTIMAGE_DIALOG_COMMAND] = new InsertImageDialog(ASPxClientCommandConsts.INSERTIMAGE_DIALOG_COMMAND);
ASPxHtmlEditorDialogList[ASPxClientCommandConsts.CHANGEIMAGE_DIALOG_COMMAND] = new InsertImageDialog(ASPxClientCommandConsts.INSERTIMAGE_DIALOG_COMMAND);
ASPxHtmlEditorDialogList[ASPxClientCommandConsts.INSERTTABLE_DIALOG_COMMAND] = new InsertTableDialog(ASPxClientCommandConsts.INSERTTABLE_DIALOG_COMMAND);
ASPxHtmlEditorDialogList[ASPxClientCommandConsts.TABLEPROPERTIES_DIALOG_COMMAND] = new TablePropertiesDialog(ASPxClientCommandConsts.INSERTTABLE_DIALOG_COMMAND);
ASPxHtmlEditorDialogList[ASPxClientCommandConsts.TABLECELLPROPERTIES_DIALOG_COMMAND] = new TableCellPropertiesDialog(ASPxClientCommandConsts.TABLECOLUMNPROPERTIES_DIALOG_COMMAND);
ASPxHtmlEditorDialogList[ASPxClientCommandConsts.TABLECOLUMNPROPERTIES_DIALOG_COMMAND] = new TableColumnPropertiesDialog(ASPxClientCommandConsts.TABLECOLUMNPROPERTIES_DIALOG_COMMAND);
ASPxHtmlEditorDialogList[ASPxClientCommandConsts.TABLEROWPROPERTIES_DIALOG_COMMAND] = new TableRowPropertiesDialog(ASPxClientCommandConsts.TABLECOLUMNPROPERTIES_DIALOG_COMMAND);
ASPxHtmlEditorDialogList[ASPxClientCommandConsts.PASTEFROMWORDDIALOG_COMMAND] = new PasteFromWordDialog(ASPxClientCommandConsts.PASTEFROMWORDDIALOG_COMMAND);
var __aspxHEIsDocumentDragOver = false;
var __aspxHEDragDropDelay = 100;
var __aspxHEMarkID = "dxMID";
var __aspxHEMarkClassName = "dxMClassName";
var __aspxHEMarkFontAttr = "dxattr";
var __aspxHEMarkFontFace = "ABC";
var __aspxHEDesignViewDocumentCssClassName = "dxheDesignViewDoc";
var __aspxHEPreviewDocumentCssClassName = "dxhePreviewDoc";
var __aspxHEPreservedTagNamePrefix = "ASPxPreservedTag_";
ASPxClientHtmlEditorIDSuffix = {
 ContentHtmlHiddenField: "_Html",
 CurrentDialogHiddenField: "_CurDialog",
 DesignViewIFrame: "_DesignIFrame",
 DesignViewCell: "_DesignViewCell",
 EditAreaCell: "_EdtCell",
 FakeFocusInput: "_FFI",
 HtmlViewEdit: "_HtmlViewEdit",
 MainCell: "_MainCell",
 PopupDialogControl: "_DPP",
 PopupMenu: "_PPM",
 PreviewIFrame: "_PreviewIFrame",
 PreviewCell: "_PreviewCell",
 TabControl: "_TC",
 Toolbar: "_TD",
 ToolbarRow: "_TBRow",
 StatusBarCell: "_SBarCell",
 SpellChecker : "_SC"
};
var __aspxHESaveImageToServerCallbackPrefix = "ImageToServer";
var __aspxHEThumbnailImageWidthCallbackPrefix = "TNIW";
var __aspxHEThumbnailImageHeightCallbackPrefix = "TNIH";
var __aspxHEThumbnailImageFileNameCallbackPrefix = "TNIF";
var __aspxHESwitchToDesignViewCallbackPrefix = "ProcessHtml_Design";
var __aspxHESwitchToHtmlViewCallbackPrefix = "ProcessHtml_Html";
var __aspxHESwitchToPreviewCallbackPrefix = "ProcessHtml_Preview";
var __aspxHESpellCheckingCallbackPrefix = "SpellCheck";
var __aspxSaveImageToServerErrorCallbackPrefix = "ISE";
var __aspxSaveImageToServerNewUrlCallbackPrefix = "ISU";
var __aspxJSEventHadlersRegExpPattern = "(\\s(\\bon[a-zA-Z][a-z]+)\\s?\=\\s?[\'\"]?(javascript\:)?[\\w\(\\),\\' ]*;?[\\'\\\"]?)+";
var __aspxJSTagsRegExpPattern = "<(script)([^>]*)>[\\s\\S]*?</(script)([^>]*)>";
var __aspxHEEmptyTagsRegExpPattern = "^<(p|div|address|h\\d|center|strong)(?=[ >])[^>]*>(?:\\s*|&nbsp;|<br\\/\\>|<br \\/\\>|<br>)(<\\/\\1>)?$";
var __aspxHEEmptyHtmlRegExpPattern = "^(<br\\/\\>|<br \\/\\>|<br>|&nbsp;)?$";
ASPxClientHtmlEditorView = {
 Design: "D",
 Html: "H",
 Preview: "P"
};
ASPxClientHtmlEditorCommandEventArgs = _aspxCreateClass(ASPxClientEventArgs, {
 constructor: function(commandName, parameter, isSuccessful) {
  this.constructor.prototype.constructor.call(this);
  this.commandName = commandName;
  this.parameter = parameter;
  this.isSuccessful = isSuccessful;
 }
});
ASPxHtmlEditorsCollection = _aspxCreateClass(null, {
 constructor: function() {
  this.htmlEditors = [ ];
  aspxGetPostHandler().Post.AddHandler(function(s, e) {
   aspxGetHtmlEditorsCollection().Synchronize();
  });
 },
 Push: function(htmlEditor) {
  for(var i = 0; i < this.htmlEditors.length; i++) {
   if (this.htmlEditors[i].name == htmlEditor.name) {
    this.htmlEditors[i] = htmlEditor;
    return;
   }
  }
  this.htmlEditors.push(htmlEditor);
 },
 AdjustSizeToContainer: function() {
  for (var i = 0; i < this.htmlEditors.length; i++)
   this.htmlEditors[i].AdjustSizeToContainer();
 },
 Synchronize: function() {
  for (var i = 0; i < this.htmlEditors.length; i++) {
   var htmlEditor = this.htmlEditors[i];
   htmlEditor.Synchronize();
  }
 },
 FocusActiveEditorToolbar: function() {
  for (var i = 0; i < this.htmlEditors.length; i++)
   if(this.htmlEditors[i].isInFocus)
    this.htmlEditors[i].FocusToolbar();
 }
});
function aspxGetHtmlEditorsCollection() {
 if (!_aspxIsExistsType(typeof(window.__aspxHEHtmlEditorsCollection))) {
  window.__aspxHEHtmlEditorsCollection = new ASPxHtmlEditorsCollection();
 }
 return window.__aspxHEHtmlEditorsCollection;
}
ASPxHtmlEditorLayoutCalculator = _aspxCreateClass(null, {
 UpdateLayout: function(htmlEditor, activeView, isInitializing) {
  if (!htmlEditor.IsVisible())
   return;
  if (isInitializing)
   this.FixHtmlEditMainElementWidth(htmlEditor);
  if (__aspxIE && isInitializing)
   this.CalculateTableCellsHeight(htmlEditor, activeView);
  this.HideViewAreas(htmlEditor);
  if (__aspxIE) {
   var contentCellHeight = this.CalculateContentCellHeight(htmlEditor, activeView);
   this.CollapseContentCell(htmlEditor);
  }
  this.UpdateToolbarRowDisplay(htmlEditor, activeView);
  this.CollapseViewAreas(htmlEditor);
  this.ShowHideViewAreasDependingOnActiveView(htmlEditor, activeView);
  if (__aspxIE)
   this.SetContentCellCalculatedHeight(htmlEditor, contentCellHeight);
  this.CorrectActiveViewAreaHeight(htmlEditor, activeView);
  if (__aspxNetscapeFamily && !htmlEditor.IsHtmlView(activeView))
   this.FixToolbarTableBorder_NS(htmlEditor);
 },
 CalculateTableCellsHeight: function(htmlEditor, activeView) {
  htmlEditor.calculatedToolbarCellHeight = 0;
  htmlEditor.calculatedStatusBarCellHeigth = 0;
  var toolbarCell = htmlEditor.GetToolbarCell();
  if (_aspxIsExists(toolbarCell)) {
   var savedToolbarIsVisible = this.IsToolbarRowVisible(htmlEditor, activeView);
   this.ShowHideToolbarRow(htmlEditor, true);
   htmlEditor.calculatedToolbarCellHeight = _aspxGetClearClientHeight(toolbarCell);
   this.ShowHideToolbarRow(htmlEditor, savedToolbarIsVisible);
  }
  var statusBarCell = htmlEditor.GetStatusBarCell();
  if (_aspxIsExists(statusBarCell))
   htmlEditor.calculatedStatusBarCellHeigth = _aspxGetClearClientHeight(statusBarCell);
 },
 FixHtmlEditMainElementWidth: function(htmlEditor) {
  var mainElement = htmlEditor.GetMainElement();
  mainElement.style.width = (mainElement.offsetWidth > 0) ? (mainElement.offsetWidth + "px") : "100%";
 },
 ShowHideViewAreas: function(htmlEditor, showDesignView, showHtmlView, showPreview) {
  var designViewTable = htmlEditor.GetDesignViewTable();
  var htmlViewEdit = htmlEditor.GetHtmlViewEdit();
  var previewTable = htmlEditor.GetPreviewTable();
  if (_aspxIsExists(designViewTable))
   _aspxSetElementDisplay(designViewTable, showDesignView);
  if (_aspxIsExists(htmlViewEdit))
   htmlViewEdit.SetVisible(showHtmlView);
  if (_aspxIsExists(previewTable))
   _aspxSetElementDisplay(previewTable, showPreview);
 },
 HideViewAreas: function(htmlEditor) {
  this.ShowHideViewAreas(htmlEditor, false, false, false);
 },
 UpdateToolbarRowDisplay: function(htmlEditor, activeView) {
  this.ShowHideToolbarRow(htmlEditor, this.IsToolbarRowVisible(htmlEditor, activeView));
 },
 IsToolbarRowVisible: function(htmlEditor, activeView) {
  return htmlEditor.IsDesignView(activeView);
 },
 ShowHideToolbarRow: function(htmlEditor, isDisplayed) {
  var toolbarRow = htmlEditor.GetToolbarRow();
  if (_aspxIsExists(toolbarRow)) {
   _aspxSetElementDisplay(toolbarRow, isDisplayed);
  }
 },
 CalculateContentCellHeight: function(htmlEditor, activeView) {
  var mainCell = htmlEditor.GetMainCell();
  var mainCellHeight = _aspxGetClearClientHeight(mainCell);
  var toolbarCellHeight = htmlEditor.IsDesignView(activeView) ? htmlEditor.calculatedToolbarCellHeight : 0;
  return (mainCellHeight - toolbarCellHeight - htmlEditor.calculatedStatusBarCellHeigth);
 },
 CollapseContentCell: function(htmlEditor) {
  this.SetContentCellCalculatedHeight(htmlEditor, 0);
 },
 SetContentCellCalculatedHeight: function(htmlEditor, height) {
  var contentCell = htmlEditor.GetEditAreaCell();
  if (height != null)
   _aspxSetOffsetHeight(contentCell, height);
  else
   contentCell.style.height = "";
 },
 CollapseViewAreas: function(htmlEditor) {
  var designViewCell = htmlEditor.GetDesignViewCell();
  var htmlEdit = htmlEditor.GetHtmlViewEdit();
  var previewCell = htmlEditor.GetPreviewCell();
  if (_aspxIsExists(designViewCell))
   designViewCell.style.height = "0";
  if (_aspxIsExists(htmlEdit))
   htmlEdit.GetInputElement().style.height = "0";
  if (_aspxIsExists(previewCell))
   previewCell.style.height = "0";
 },
 ShowHideViewAreasDependingOnActiveView: function(htmlEditor, activeView) {
  this.ShowHideViewAreas(htmlEditor, htmlEditor.IsDesignView(activeView), htmlEditor.IsHtmlView(activeView), htmlEditor.IsPreview(activeView));
 },
 CorrectActiveViewAreaHeight: function(htmlEditor, activeView) {
  if (htmlEditor.IsDesignView(activeView))
   this.CorrectDesignViewAreaHeight(htmlEditor);
  else if (htmlEditor.IsHtmlView(activeView))
   this.CorrectHtmlViewAreaHeight(htmlEditor);
  else if (htmlEditor.IsPreview(activeView))
   this.CorrectPreviewAreaHeight(htmlEditor);
 },
 CorrectDesignViewAreaHeight: function(htmlEditor) {
  this.CorrectIFrameContainingAreaHeight(htmlEditor, htmlEditor.GetDesignViewCell(), htmlEditor.GetDesignViewIFrameElement());
 },
 CorrectHtmlViewAreaHeight: function(htmlEditor) {
  var htmlViewEdit = htmlEditor.GetHtmlViewEdit();
  if (_aspxIsExists(htmlViewEdit))
   htmlViewEdit.AdjustControl(false, true );
 },
 CorrectPreviewAreaHeight: function(htmlEditor) {
  this.CorrectIFrameContainingAreaHeight(htmlEditor, htmlEditor.GetPreviewCell(), htmlEditor.GetPreviewIFrameElement());
 },
 CorrectIFrameContainingAreaHeight: function(htmlEditor, viewCell, viewIFrameElement) {
  var contentCell = htmlEditor.GetEditAreaCell();
  _aspxSetElementDisplay(viewIFrameElement, false);
  if (__aspxNetscapeFamily || __aspxOpera) {
   var height = _aspxGetClearClientHeight(contentCell);
   var viewCellCalculatedStyle = _aspxGetCurrentStyle(viewCell);
   height -= Math.round((_aspxPxToInt(viewCellCalculatedStyle.borderTopWidth) + _aspxPxToInt(viewCellCalculatedStyle.borderBottomWidth)) / 2.0);
   _aspxSetOffsetHeight(viewCell, height);
  } else {
   _aspxSetOffsetHeight(viewCell, _aspxGetClearClientHeight(contentCell));
  }
  viewIFrameElement.style.height = "100%";
  _aspxSetElementDisplay(viewIFrameElement, true);
 },
 FixToolbarTableBorder_NS: function(htmlEditor) {
  var table = htmlEditor.GetToolbarTable();
  if (_aspxIsExists(table)) {
   var borderCollapse = table.style.borderCollapse;
   table.style.borderCollapse = "";
   table.style.borderCollapse = borderCollapse;
  }
 }
});
__aspxHtmlEditorLayoutCalculator = null;
function aspxGetHtmlEditorLayoutCalculator() {
 if (__aspxHtmlEditorLayoutCalculator == null)
  __aspxHtmlEditorLayoutCalculator = new ASPxHtmlEditorLayoutCalculator();
 return __aspxHtmlEditorLayoutCalculator;
}
var __aspxHEClientStateInputIDSuffix = "_ClientState";
var __aspxHEClientStateRecordSeparator = '|';
ASPxClientHtmlEditorClientState = _aspxCreateClass(null, {
 constructor: function(htmlEditor) {
  this.htmlEditor = htmlEditor;
  this.clientStateInput = null;
  this.fieldsNameValueCollection = this.ParseStateStr();
 },
 GetClientStateInput: function() {
  if (this.clientStateInput == null)
   this.clientStateInput = this.FindClientStateInput();
  return this.clientStateInput;
 },
 FindClientStateInput: function() {
  return _aspxGetElementById(this.htmlEditor.name + __aspxHEClientStateInputIDSuffix);
 },
 SetFieldValue: function(name, value) {
  this.fieldsNameValueCollection[name] = value;
  this.Save(this.fieldsNameValueCollection);
 },
 ParseStateStr: function() {
  var state = this.GetClientStateInput().value;
  collection = {};
  var startIndex = 0;
  while(startIndex < state.length)
   startIndex = this.ParseFieldRecord(state, startIndex, collection);
  return collection;
 },
 ParseFieldRecord: function(state, startIndex, collection) {
  var indexOfFirstSeparator = state.indexOf(__aspxHEClientStateRecordSeparator, startIndex);
  var fieldName = state.substr(startIndex, indexOfFirstSeparator - startIndex);
  startIndex += fieldName.length + 1;
  var indexOfSecondSeparator = state.indexOf(__aspxHEClientStateRecordSeparator, startIndex);
  var fieldValueLengthStr = state.substr(startIndex, indexOfSecondSeparator - startIndex);
  startIndex += fieldValueLengthStr.length + 1;
  var fieldValueLength = parseInt(fieldValueLengthStr);
  var fieldValue = state.substr(startIndex, fieldValueLength);
  startIndex += fieldValueLength;
  collection[fieldName] = fieldValue;
  return startIndex;
 },
 Save: function(collection) {
  var result = [];
  for(var fieldName in collection) {
   var value = collection[fieldName];
   if (typeof(value) == "string")
    result.push(fieldName + __aspxHEClientStateRecordSeparator + value.length + __aspxHEClientStateRecordSeparator + value);
  }
  this.GetClientStateInput().value = result.join('');
 }
});
ASPxClientHtmlEditor = _aspxCreateClass(ASPxClientControl, {
 constructor: function(name) {
  this.constructor.prototype.constructor.call(this, name);
  this.allowDesignView = true;
  this.allowHtmlView = true;
  this.allowPreview = true;
  this.allowContextMenu = true;
  this.allowScripts = false;
  this.allowInsertDirectImageUrls = true;
  this.cssFileLinkArray = [];
  this.designViewIFrameDocumentStyleCssText = "";
  this.previewIFrameDocumentStyleCssText = "";
  this.html = "";
  this.activeView = ASPxClientHtmlEditorView.Design;
  this.uploadImageFileDirectoryPath = "";
  this.updateDeprecatedElements = true;
  this.areDictionariesAssigned = true; 
  this.clientState = new ASPxClientHtmlEditorClientState(this);
  this.callbackOwner = null;
  this.spellCheckerCallback = false;
  this.isDraggingInsideEditor = false;
  this.isDropExternalContentExecuted = false;
  this.dragDropTimerID = null;
  this.beforePopupSelection = null;
  this.CustomCommand = new ASPxClientEvent();
  this.CommandExecuted = new ASPxClientEvent();
  this.GotFocus = new ASPxClientEvent();
  this.LostFocus = new ASPxClientEvent();
  this.SelectionChanged = new ASPxClientEvent();
  this.HtmlChanged = new ASPxClientEvent();
  this.currentBgColor = null;
  this.currentFontColor = null;
  this.isWidthDefinedInPercent = false;
  this.initialMainElementWidth = -1;
  this.mainElementParentNodeWidthHashTable = {};
  this.layoutCalculator = aspxGetHtmlEditorLayoutCalculator();
  this.eventListener = null;
  this.commandManager = null;
  this.isErrorOnCallback = false;
  this.isMouseDown = false;
  this.isInFocus = false;
  this.keyboardManager = null;
  this.toolbar = null;
  this.shortcutCmdID = null;
  this.executingCommandName = null;
  this.pasteContainer = null;
  this.savedPreviewHtmlAfterSet = ""; 
  this.cachedElementsManager = new ASPxCachedElementsManager(this);
 },
 InlineInitialize: function() {
  if (!__aspxOpera || !this.allowDesignView) {
   this.InitAreas();
   this.UpdateLayout(this.activeView, false);
  }
  this.InitializeSpellChecker();
 },
 Initialize: function() {
  ASPxClientControl.prototype.Initialize.call(this);
  aspxGetHtmlEditorsCollection().Push(this);
  if (!__aspxOpera && this.allowDesignView)
   this.InitializeManagers();
  this.InitializeMainElementParentNodeInfo();
 },
 InitializeManagers: function() {
  if (this.allowDesignView) {
   this.commandManager = new CommandManager(this);
   this.keyboardManager = new KeyboardManager();
   this.toolbar = this.GetToolbar();
   this.InitializeEventListner();
   this.InitializeShortcuts();
  }
 },
 InitializeMainElementParentNodeInfo: function() {
  this.SaveMainElementParentNodeWidth();
  this.initialMainElementWidth = this.GetMainElement().style.width;
  this.isWidthDefinedInPercent = this.initialMainElementWidth.indexOf("%") != -1;
 },
 InitAreas: function() {
  if (this.allowDesignView)
   this.InitDesignViewIFrame();
  if (this.allowPreview)
   this.InitPreviewIFrame();
  if (this.allowHtmlView)
   this.InitHtmlViewArea();
  if (this.html != "")
   this.SetHtmlInternal(this.html);
 },
 InitializeSpellChecker: function() {
  var spellChecker = this.GetSpellCheckerClientInstance();
  if (_aspxIsExists(spellChecker)) {
   var method = new Function("sender", "args", "aspxHESpellCheckerWordChanged(\"" + this.name + "\", sender, args);");
   spellChecker.WordChanged.AddHandler(method);
   spellChecker.ReCheck = this.ReCheck;
   spellChecker.htmlEditor = this;
  }
 },
 InitDesignViewIFrame: function() {
  this.InitIFrame(this.GetDesignViewIFrameName(), "", this.cssFileLinkArray);
  this.InitDesignViewIFrameStyle();
 },
 InitPreviewIFrame: function() {
  this.InitIFrame(this.GetPreviewIFrameName(), "", this.cssFileLinkArray);
  this.InitPreviewIFrameStyle();
 },
 InitHtmlViewArea: function() {
  this.DisableSpellCheckerAttribute(this.GetHtmlViewEdit().GetInputElement());
 },
 InitializeEventListner: function() {
  this.eventListener = new EventListener(this);
 },
 InitializeShortcuts: function() {
  this.shortcutCmdID = null;
  for (var i = 0; i < ASPxShortcuts.length; i++)
   this.keyboardManager.AddShortcut(ASPxShortcuts[i][1], ASPxShortcuts[i][0]);
 },
 InitIFrame: function(iframeName, bodyContentHtml, cssFileLinkArray) {
  var doc = _aspxIFrameDocument(iframeName);
  var element = _aspxIFrameElement(iframeName);
  if (doc != null && element != null) {
   this.InitIFrameDocument(doc, bodyContentHtml, cssFileLinkArray);
   if (__aspxOpera)
    doc.body.style.height = "100%";
   element.style.height = "100%";
   doc.body.className = element.className;
  }
 },
 InitIFrameDocument: function(doc, bodyContentHtml, cssFileLinkArray) {
  doc.open();
  doc.write(this.GetIFrameDocumentHtml(bodyContentHtml));
  doc.close();
  doc.body.style.borderWidth = 0;
  this.DisableSpellCheckerAttribute(doc.body);
  this.AddCssFileLinksToDocument(doc, cssFileLinkArray);
 },
 InitDesignViewIFrameStyle: function() {
  if (this.designViewIFrameDocumentStyleCssText != "") {
   var designViewIFrameDocumentStyleSheet = _aspxCreateStyleSheetInDocument(this.GetDesignViewIFrameDocument());
   _aspxAddStyleSheetRule(designViewIFrameDocumentStyleSheet,
      "." + __aspxHEDesignViewDocumentCssClassName, this.designViewIFrameDocumentStyleCssText);
   this.GetDesignViewIFrameDocumentBody().className += " " + __aspxHEDesignViewDocumentCssClassName;
  }
 },
 InitPreviewIFrameStyle: function() {
  if (this.previewIFrameDocumentStyleCssText != "") {
   var previewIFrameDocumentStyleSheet = _aspxCreateStyleSheetInDocument(this.GetPreviewIFrameDocument());
   _aspxAddStyleSheetRule(previewIFrameDocumentStyleSheet,
      "." + __aspxHEPreviewDocumentCssClassName, this.previewIFrameDocumentStyleCssText);
   this.GetPreviewIFrameDocumentBody().className += " " + __aspxHEPreviewDocumentCssClassName;
  }
 },
 AddCssFileLinksToDocument: function(doc, linkArray) {
  for (var i = 0; i < linkArray.length; i++) {
   _aspxAddStyleSheetLinkToDocument(doc, linkArray[i]);
  }
 },
 SetClientStateFieldValue: function(name, value) {
  this.clientState.SetFieldValue(name, value);
 },
 GetCurrentDialogHiddenInput: function() {
  return _aspxGetElementById(this.name + ASPxClientHtmlEditorIDSuffix.CurrentDialogHiddenField);
 },
 GetDesignViewCell: function() {
  return _aspxGetElementById(this.name + ASPxClientHtmlEditorIDSuffix.DesignViewCell);
 },
 GetDesignViewTable: function() {
  return _aspxGetParentByTagName(this.GetDesignViewCell(), "table");
 },
 GetPreviewTable: function() {
  return _aspxGetParentByTagName(this.GetPreviewCell(), "table");
 },
 GetPreviewCell: function() {
  return _aspxGetElementById(this.name + ASPxClientHtmlEditorIDSuffix.PreviewCell);
 },
 GetDesignViewIFrameDocument: function() {
  return _aspxIFrameDocument(this.GetDesignViewIFrameName());
 },
 GetDesignViewIFrameDocumentBody: function() {
  return _aspxIFrameDocumentBody(this.GetDesignViewIFrameName());
 },
 GetDesignViewIFrameWindow: function() {
  return _aspxIFrameWindow(this.GetDesignViewIFrameName());
 },
 GetEditAreaCell: function() {
  return _aspxGetElementById(this.name + ASPxClientHtmlEditorIDSuffix.EditAreaCell);
 },
 GetDialogPopupControl: function() {
  return aspxGetControlCollection().Get(this.name + ASPxClientHtmlEditorIDSuffix.PopupDialogControl);
 },
 GetDesignViewIFrameElement: function() {
  return _aspxIFrameElement(this.GetDesignViewIFrameName());
 },
 GetDesignViewIFrameName: function() {
  return this.name + ASPxClientHtmlEditorIDSuffix.DesignViewIFrame;
 },
 GetActualMainElementParentNodeWidth: function() {
  return this.GetMainElement().parentNode.offsetWidth;
 },
 GetSavedMainElementParentNodeWidth: function(view) {
  return this.mainElementParentNodeWidthHashTable[view];
 },
 GetPreviewIFrameName: function() {
  return this.name + ASPxClientHtmlEditorIDSuffix.PreviewIFrame;
 },
 GetPreviewIFrameElement: function() {
  return _aspxIFrameElement(this.GetPreviewIFrameName());
 },
 GetPreviewIFrameDocument: function() {
  return _aspxIFrameDocument(this.GetPreviewIFrameName());
 },
 GetPreviewIFrameDocumentBody: function() {
  return _aspxIFrameDocumentBody(this.GetPreviewIFrameName());
 },
 GetElementDocument: function(element) {
  return element.ownerDocument || element.document;
 },
 GetFakeFocusInputElement: function() {
  return _aspxGetElementById(this.name + ASPxClientHtmlEditorIDSuffix.FakeFocusInput);
 },
 GetHtmlViewEdit: function() {
  return aspxGetControlCollection().Get(this.name + ASPxClientHtmlEditorIDSuffix.HtmlViewEdit);
 },
 GetMainCell: function() {
  return _aspxGetElementById(this.name + ASPxClientHtmlEditorIDSuffix.MainCell);
 },
 GetContextMenu: function() {
  return aspxGetControlCollection().Get(this.name + ASPxClientHtmlEditorIDSuffix.PopupMenu);
 },
 GetToolbar: function() { 
  return aspxGetControlCollection().Get(this.name + ASPxClientHtmlEditorIDSuffix.Toolbar);
 },
 GetTabControl: function() {
  return aspxGetControlCollection().Get(this.name + ASPxClientHtmlEditorIDSuffix.TabControl);
 },
 GetToolbarRow: function() {
  return this.GetChild(ASPxClientHtmlEditorIDSuffix.ToolbarRow);
 },
 GetToolbarTable: function() {
  return _aspxGetParentByTagName(this.GetToolbarRow(), "table");
 },
 GetToolbarCell: function() {
  return _aspxGetChildByTagName(this.GetToolbarRow(), "td", 0);
 },
 GetStatusBarCell: function() {
  return _aspxGetElementById(this.name + ASPxClientHtmlEditorIDSuffix.StatusBarCell);
 },
 GetSpellCheckerClientInstance: function() {
  return aspxGetControlCollection().Get(this.name + ASPxClientHtmlEditorIDSuffix.SpellChecker);
 },
 GetHtmlSyncHiddenField: function() {
  return _aspxGetElementById(this.name + ASPxClientHtmlEditorIDSuffix.ContentHtmlHiddenField);
 },
 SaveMainElementParentNodeWidth: function(view) {
  if (!_aspxIsExists(view))
   view = this.activeView;
  this.mainElementParentNodeWidthHashTable[view] = this.GetActualMainElementParentNodeWidth();
 },
 UpdateLayout: function(activeView, isInitializing) {
  if (!_aspxIsExists(isInitializing))
   isInitializing = false;
  this.layoutCalculator.UpdateLayout(this, activeView, isInitializing);
 },
 UpdateToolbarAndMenu: function() {
  if (this.allowDesignView && this.IsDesignView()) {
   this.UpdateToolbarImmediately();
   this.UpdateContextMenu();
  }
 },
 AdjustSizeToContainer: function(view) {
  if(!_aspxIsExistsElement(this.GetMainElement()))
   return;
  if (!this.isWidthDefinedInPercent) return;
  if (!_aspxIsExists(view))
   view = this.activeView;
  this.AdjustSizeToContainerCore(view);
 },
 AdjustSizeToContainerCore: function(view) {
  if (this.NeedWidthCorrection(view)) {
   this.GetMainElement().style.width = this.initialMainElementWidth;
   if (this.IsHtmlView() && __aspxIE
    && __aspxBrowserVersion < 8 )
    this.GetHtmlViewEdit().GetInputElement().style.width = "0px";
   this.AdjustControl();
  }
  this.SaveMainElementParentNodeWidth(view);
 },
 NeedWidthCorrection: function(view) {
  if (__aspxIE && __aspxBrowserMajorVersion == 6) return true;
  return this.GetActualMainElementParentNodeWidth() != this.GetSavedMainElementParentNodeWidth(view);
 },
 AdjustControlCore: function() {
  var needSetFocus = !(__aspxNetscapeFamily);
  var scrollX = _aspxGetDocumentScrollLeft();
  var scrollY = _aspxGetDocumentScrollTop();
  if (this.IsDesignView()) {
   this.SetDesignModeAttribute();
   if (needSetFocus)
    this.SetFocus();
  }
  this.UpdateToolbarAndMenu();
  this.UpdateLayout(this.activeView, true);
  if (this.IsDesignView() && needSetFocus) {
   this.RemoveFocus();
   window.scrollTo(scrollX, scrollY);
  }
 },
 IsStatusBarShown: function() {
  return (this.allowDesignView ? 1 : 0) + (this.allowHtmlView ? 1 : 0) + (this.allowPreview ? 1 : 0) > 1;
 },
 SetDesignModeAttribute: function() {
  var doc = _aspxIFrameDocument(this.GetDesignViewIFrameName());
  if (__aspxNetscapeFamily)
   doc.designMode = "on";
  else
   doc.body.contentEditable = true;
 },
 DisableSpellCheckerAttribute: function(element) {
  if (__aspxFirefox)
   element.spellcheck = false;
 },
 ShowLoadingPanel: function() {
  var container = this.GetMainElement();
  this.CreateLoadingDiv(document.body, container);
  this.CreateLoadingPanelWithAbsolutePosition(document.body, container);
 },
 Focus: function() {
  this.SetFocus();
 },
 ClearFocusInput: function() {
  var focusInputElement = this.GetFakeFocusInputElement();
  if (_aspxIsExists(focusInputElement))
   focusInputElement.value = "";
 },
 SetActive: function() { 
  if (__aspxIE) {
   var iFrame = this.GetDesignViewIFrameElement();
   if (_aspxIsExists(iFrame))
    iFrame.setActive();
  }
 },
 SetFocus: function() {
  if (this.IsDesignView()) {
   var docObj = this.GetDesignViewIFrameWindow();
   if (__aspxWebKitFamily && !this.isInitialized)
    var docObj = this.GetDesignViewIFrameDocumentBody();
   docObj.focus();
  }
  else if (this.IsHtmlView())
   this.GetHtmlViewEdit().SetFocus();
 },
 RemoveFocus: function() {
  var inputElement = this.GetFakeFocusInputElement();
  _aspxRemoveAttribute(inputElement, "disabled");
  try {
   inputElement.focus();
  }
  catch (e) { }
  if (__aspxIE || (__aspxWebKitFamily && !this.isInitialized)) {
   try {
    window.focus();
   }
   catch (e) { }
  }
  inputElement.disabled = "disabled";
 },
 GetHtml: function() {
  return this.ProcessHtmlToGetHtml(this.GetHtmlInternal());
 },
 GetHtmlInternal: function() {
  var html = this.html;
  if (this.IsDesignView() && this.IsExistsWindowInIFrame(this.GetDesignViewIFrameName()))
   html = this.GetDesignViewIFrameDocumentBody().innerHTML;
  else if (this.IsHtmlView() && _aspxIsExistsElement(this.GetHtmlViewEdit().GetMainElement()))
   html = this.GetHtmlViewEdit().GetText();
  else if (this.IsExistsWindowInIFrame(this.GetPreviewIFrameName()))
   html = this.savedPreviewHtmlAfterSet;
  return html;
 },
 SetHtml: function(html) {
  this.ClearUndoHistory();
  this.SetHtmlInternal(html);
  this.OnHtmlChanged(false);
 },
 SetHtmlInternal: function(html, newActiveView) {
  if (!_aspxIsExists(newActiveView))
   newActiveView = this.activeView;
  html = this.ProcessHtmlToSetHtml(html, newActiveView);
  if (this.allowDesignView && this.IsDesignView(newActiveView)) {
   this.SetInnerHtmlToBody(this.GetDesignViewIFrameDocumentBody(), html);
   this.ProcessDesignViewDocumentDomAfterSetHtml();
  }
  if (this.allowHtmlView && this.IsHtmlView(newActiveView))
   this.GetHtmlViewEdit().SetText(html);
  if (this.allowPreview && this.IsPreview(newActiveView)) {
   _aspxSetInnerHtml(this.GetPreviewIFrameDocumentBody(), html);
   this.savedPreviewHtmlAfterSet = this.GetPreviewIFrameDocumentBody().innerHTML;
   this.ProcessPreviewDocumentDomAfterSetHtml();
  }
 },
 ProcessHtmlToSetHtml: function(html, newActiveView) {
  if (this.IsPreview(newActiveView) || this.IsDesignView(newActiveView)) {
   html = ASPxClientHtmlEditor.PreserveTagsByName("noscript", html);
   if (!this.allowScripts)
    html = ASPxClientHtmlEditor.CleanHtmlScripts(html);
   else
    html = ASPxClientHtmlEditor.PreserveTagsByName("script", html);
   if (this.IsDesignView(newActiveView)) {
    if (__aspxIE)
     html = ASPxClientHtmlProcessingUtils.ReplaceUnderlineSpanWithUTag(html);
    if (this.updateDeprecatedElements)
     html = ASPxClientHtmlProcessingUtils.ReplaceSpanWithFontTag(html);
   }
   html = this.DeconvertEmptyHtml(html);
  } else if (this.IsHtmlView(newActiveView))
   html = this.ConvertToEmptyHtml(html);
  return html;
 },
 ProcessDesignViewDocumentDomAfterSetHtml: function() {
  ASPxClientHtmlProcessingUtils.ReplaceTableStyleBorderByAttribute(this.GetDesignViewIFrameDocumentBody());
  ASPxClientHtmlProcessingUtils.AddEmptyBorderClassInTables(this.GetDesignViewIFrameDocumentBody());
 },
 ProcessPreviewDocumentDomAfterSetHtml: function() {
  ASPxClientHtmlProcessingUtils.ReplaceLinkTargetWithBlank(this.GetPreviewIFrameDocumentBody());
 },
 ProcessHtmlToGetHtml: function(html) {
  if (this.IsPreview() || this.IsDesignView()) {
   html = this.ConvertToEmptyHtml(ASPxClientHtmlEditor.DepreserveTagsByName("noscript", html));
   if (this.allowScripts)
    html = ASPxClientHtmlEditor.DepreserveTagsByName("script", html);
   if (this.IsDesignView()) {
    if (this.updateDeprecatedElements)
     html = ASPxClientHtmlProcessingUtils.ReplaceFontWithSpanTag(html);
    html = ASPxClientHtmlProcessingUtils.FilterHtmlToGetHtml(html);
    html = ASPxClientHtmlProcessingUtils.RemoveEmptyBorderClassName(html);
   }
  }
  return html;
 },
 SetInnerHtmlToBody: function(bodyElement, html) {
  _aspxSetInnerHtml(bodyElement, html);
  if (__aspxIE) 
   ASPxClientHtmlProcessingUtils.CleanWrongSizeAttribute(bodyElement);
 },
 Synchronize: function() {
  if (this.IsControlExist()) {
   this.SynchronizeContentHtml();
   this.ClearFocusInput();
  }
 },
 SynchronizeContentHtml: function() {
  var htmlSyncInput = this.GetHtmlSyncHiddenField();
  if (_aspxIsExistsElement(htmlSyncInput)) {
   var html = this.GetHtml();
   this.syncronizedHtml = html; 
   htmlSyncInput.value = _aspxEncodeHtml(html);
  }
 },
 IsControlExist: function() {
  return _aspxIsExistsElement(this.GetMainElement());
 },
 IsDesignView: function(view) {
  if (!_aspxIsExists(view))
   view = this.activeView;
  return view == ASPxClientHtmlEditorView.Design;
 },
 IsHtmlView: function(view) {
  if (!_aspxIsExists(view))
   view = this.activeView;
  return view == ASPxClientHtmlEditorView.Html;
 },
 IsPreview: function(view) {
  if (!_aspxIsExists(view))
   view = this.activeView;
  return view == ASPxClientHtmlEditorView.Preview;
 },
 ChangeActiveView: function(activeView) {
  if (activeView == this.activeView)
   return;
  switch (activeView) {
   case ASPxClientHtmlEditorView.Design:
    this.SetDesignActiveView();
    break;
   case ASPxClientHtmlEditorView.Html:
    this.SetHtmlActiveView();
    break;
   case ASPxClientHtmlEditorView.Preview:
    this.SetPreviewActiveView();
    break;
  }
  this.activeView = activeView;
 },
 SetDesignActiveView: function() {
  this.SetClientStateFieldValue("ActiveView", "Design");
  if (this.IsHtmlView())
   this.ClearUndoHistory();
  this.SendCallback(__aspxHESwitchToDesignViewCallbackPrefix, "", true);
 },
 SetHtmlActiveView: function() {
  this.SetClientStateFieldValue("ActiveView", "Html");
  if (this.IsDesignView())
   this.ClearUndoHistory();
  this.SendCallback(__aspxHESwitchToHtmlViewCallbackPrefix, "", true);
 },
 SetPreviewActiveView: function() {
  this.SetClientStateFieldValue("ActiveView", "Preview");
  this.ClearUndoHistory();
  this.SendCallback(__aspxHESwitchToPreviewCallbackPrefix, "", true);
 },
 SwitchToDesignViewCore: function(html) {
  this.SwitchToViewCore(ASPxClientHtmlEditorView.Design, html);
  this.SetDesignModeAttribute();
  this.OnHtmlChanged(false);
 },
 SwitchToHtmlViewCore: function(html) {
  this.SwitchToViewCore(ASPxClientHtmlEditorView.Html, html);
 },
 SwitchToPreviewCore: function(html) {
  this.SwitchToViewCore(ASPxClientHtmlEditorView.Preview, html);
 },
 SwitchToViewCore: function(view, html) {
  this.UpdateLayout(view);
  this.CorrectWidthOnSwitchToView(view);
  this.SetHtmlInternal(html, view);
  if (this.IsPreview(view))
   this.RemoveFocus();
  else
   this.SetFocus();
 },
 CorrectWidthOnSwitchToView: function(view) {
  if (this.IsHtmlView(view) || this.IsPreview(view))
   this.AdjustSizeToContainer(view);
 },
 ExecuteCommand: function(commandName, parameter, addToHistory) {
  var isSuccessfully = false;
  if (this.IsDesignView()) {
   addToHistory = _aspxIsExists(addToHistory) ? addToHistory : true;
   this.RestoreSelectionForPopup();
   var cmd = ASPxHtmlEditorCommandList[commandName];
   if (cmd != null) {
    this.executingCommandName = commandName;
    var contentHtml = this.GetHtmlInternal();
    var isSuccessfully = this.commandManager.ExecuteCommand(commandName, parameter, addToHistory);
    if (!cmd.IsImmediateExecution())
     this.executingCommandName = null;
    if (contentHtml != this.GetHtmlInternal())
     this.OnHtmlChanged(false);
    else
     if (isSuccessfully)
     this.OnSelectionChanged();
    this.RaiseCommandExecuted(commandName, parameter, isSuccessfully);
   }
   else {
    if (!this.CustomCommand.IsEmpty()) {
     isSuccessfully = this.RaiseCustomCommand(commandName, parameter);
     this.RaiseCommandExecuted(commandName, parameter, isSuccessfully);
    }
    else
     alert('Command not found');
   }
  }
  return isSuccessfully;
 },
 PasteHtml: function(htmlText) {
  return this.ExecuteCommand(ASPxClientCommandConsts.PASTEHTML_COMMAND, htmlText);
 },
 InsertLink: function(url, text, target, title) {
  var value = {
   url: url,
   text: text,
   target: target,
   title: title
  };
  this.ExecuteCommand(ASPxClientCommandConsts.INSERTLINK_COMMAND, value);
 },
 InsertImage: function(src, width, height, align, alt, useFloat) {
  var value = {
   src: src,
   width: width,
   height: height,
   align: align,
   alt: alt,
   useFloat: useFloat
  };
  this.ExecuteCommand(ASPxClientCommandConsts.INSERTIMAGE_COMMAND, value);
 },
 ChangeImage: function(imageElement, src, width, height, align, alt, useFloat) {
  var value = {
   imageElement: imageElement,
   src: src,
   width: width,
   height: height,
   align: align,
   alt: alt,
   useFloat: useFloat
  };
  this.ExecuteCommand(ASPxClientCommandConsts.CHANGEIMAGE_COMMAND, value);
 },
 CheckSpelling: function() {
  var spellChecker = this.GetSpellCheckerClientInstance();
  if (_aspxIsExists(spellChecker)) {
   if (this.areDictionariesAssigned)
    this.SendCallback(__aspxHESpellCheckingCallbackPrefix, spellChecker.CreateCallbackArgumentToCheckText(""), true);
   else
    alert("The built-in spell checker doesn't have dictionaries by default. Use the SettingsSpellChecker.Dictionaries property to define the spell checker's dictionaries.");
  }
 },
 ReCheck: function(text) {
  this.htmlEditor.SendCallback(__aspxHESpellCheckingCallbackPrefix, this.CreateCallbackArgumentToCheckText(""), false);
  this.ShowLoadingPanel();
 },
 OnSpellCheckerWordChanged: function(sender, args) {
  this.ExecuteCommand(ASPxClientCommandConsts.CheckSpellingCore_COMMAND, args.checkedText);
 },
 Print: function() {
  var window = this.GetDesignViewIFrameWindow();
  if (_aspxIsExists(window)) window.print();
 },
 Undo: function() {
  if (this.IsUndoAvailable())
   return this.commandManager.Undo(1);
  return false;
 },
 Redo: function() {
  if (this.IsRedoAvailable())
   return this.commandManager.Redo(1);
  return false;
 },
 GetSelection: function() {
  return new ASPxClientHtmlEditorSelection(this);
 },
 SetSelection: function(selection) {
  if (__aspxNetscapeFamily)
   this.SetFocus();
  selection.Apply();
 },
 GetSelectedElement: function(name) {
  return this.cachedElementsManager.GetSeletedElement(name);
 },
 SetSelectedElement: function(name, element) {
  return this.cachedElementsManager.SetSelectedElement(name, element);
 },
 NeedGetElementFromSelection: function(name) {
  return this.cachedElementsManager.NeedGetElementFromSelection(name);
 },
 GetEditorSelectionInfo: function(needNestingFontElementCorrection) {
  needNestingFontElementCorrection = _aspxIsExists(needNestingFontElementCorrection) ?
            needNestingFontElementCorrection && __aspxNetscapeFamily : false;
  var ret = { allElements: [], newElements: [] };
  var fontTagName = __aspxSafari ? "span" : "font"; 
  var curSelection = ASPxClientHtmlEditorSelection.Create(this);
  if (curSelection.IsControl()) {
   var controlElement = curSelection.GetParentElement();
   var fontElement = this.GetDesignViewIFrameDocument().createElement('FONT');
   fontElement.appendChild(controlElement.cloneNode(true));
   controlElement.parentNode.replaceChild(fontElement, controlElement);
   ret.allElements.push(fontElement);
   ret.newElements.push(fontElement);
  }
  else {
   var savedExistingFontElems = _aspxGetElementsByTagName(this.GetDesignViewIFrameDocument(), fontTagName);
   for (var i = 0; i < savedExistingFontElems.length; i++) {
    if (savedExistingFontElems[i].face) {
     savedExistingFontElems[i].setAttribute('_dxface', savedExistingFontElems[i].face);
    }
    savedExistingFontElems[i].setAttribute(__aspxHEMarkFontAttr, 1);
   }
   if (__aspxNetscapeFamily)
    this.GetDesignViewIFrameDocument().execCommand("useCSS", false, true);
   ASPxHtmlEditorCommandList[ASPxClientCommandConsts.FONTNAME_COMMAND].Execute(__aspxHEMarkFontFace, this, false);
   var allFontElems = _aspxGetElementsByTagName(this.GetDesignViewIFrameDocument(), fontTagName);
   for (var i = 0; i < allFontElems.length; i++) {
    if (this.IsMarkedFontElement(allFontElems[i])) {
     ret.allElements.push(allFontElems[i]);
     var childElems = _aspxGetElementsByTagName(allFontElems[i], fontTagName);
     var count = childElems.length;
     for (var j = 0; j < count; j++) {
      if (this.IsMarkedFontElement(childElems[i]))
       ret.allElements.push(childElems[i]);
     }
     if (!allFontElems[i].getAttribute(__aspxHEMarkFontAttr)) {
      var elem = allFontElems[i];
      if (needNestingFontElementCorrection) {
       elem = this.CorrectNestedFontElement(elem);
       ret.allElements[i] = elem;
       allFontElems[i] = elem;
      }
      ret.newElements.push(elem);
     }
    }
    allFontElems[i].removeAttribute(__aspxHEMarkFontAttr);
   }
   for (var i = 0; i < savedExistingFontElems.length; i++) {
    savedExistingFontElems[i].face = savedExistingFontElems[i].getAttribute('_dxface');
    savedExistingFontElems[i].removeAttribute('_dxface');
   }
   savedExistingFontElems = [];
   if (__aspxNetscapeFamily)
    this.GetDesignViewIFrameDocument().execCommand("useCSS", false, false);
  }
  return ret;
 },
 CorrectNestedFontElement: function(fontElement) {
  var ret = fontElement;
  if ((fontElement.childNodes.length == 1) && (fontElement.childNodes[0].nodeType != 3)) {
   var childNode = fontElement.childNodes[0];
   childNode.className += " " + __aspxHEMarkClassName;
   var html = childNode.innerHTML;
   _aspxRemoveOuterTags(fontElement);
   childNode = _aspxGetChildsByClassName(this.GetDesignViewIFrameDocumentBody(), __aspxHEMarkClassName)[0];
   childNode.className.replace(__aspxHEMarkClassName, "");
   childNode.innerHTML = "";
   var newFontElement = this.GetDesignViewIFrameDocument().createElement('FONT');
   newFontElement.face = __aspxHEMarkFontFace;
   _aspxSetInnerHtml(newFontElement, html);
   childNode.appendChild(newFontElement);
   ret = newFontElement;
  }
  return ret;
 },
 IsMarkedFontElement: function(elem, font) {
  return elem && (elem.getAttribute('face') == __aspxHEMarkFontFace || elem.style.fontFamily == __aspxHEMarkFontFace);
 },
 DeleteNewAddedFontElements: function(selInfo) {
  var newElements = selInfo.newElements;
  for (var i = 0; i < newElements.length; i++) {
   if (__aspxIE || __aspxOpera)
    newElements[i].removeNode(false);
   else {
    var range = this.GetDesignViewIFrameDocument().createRange();
    range.selectNodeContents(newElements[i]);
    var selectedContent = range.extractContents();
    range.selectNode(newElements[i]);
    range.deleteContents();
    range.insertNode(selectedContent);
   }
  }
 },
 CreateRestoreSelection: function() {
  return ASPxClientHtmlEditorSelection.Create(this);
 },
 RestoreLastSelection: function(selectionObj) {
  if (selectionObj != null) {
   this.SetFocus();
   selectionObj.Restore();
  }
 },
 SaveLastSelection: function() {
  var selectionObj = ASPxClientHtmlEditorSelection.Create(this);
  selectionObj.Save();
  return selectionObj;
 },
 CreateRestoreSelectionForDialog: function() {
  var selectionObj = __aspxIE ? new DialogSelectionIE(this.GetDesignViewIFrameWindow()) :
       new ASPxClientSelectionNSOpera(this.GetDesignViewIFrameWindow());
  selectionObj.Save();
  return selectionObj;
 },
 UpdateContextMenu: function() {
  if (this.allowContextMenu == true && this.GetContextMenu().GetVisible())
   this.GetContextMenu().SetVisible(false);
 },
 ShowContextMenu: function(evt) {
  this.SaveSelectionForPopup();
  if (!this.GetContextMenu().GetVisible()) {
   this.UpdateContextMenuItemsState();
   var scrollX = _aspxGetDocumentScrollLeft();
   var scrollY = _aspxGetDocumentScrollTop();
   var x = _aspxGetEventX(evt) + _aspxGetAbsoluteX(this.GetDesignViewIFrameElement()) - scrollX;
   var y = _aspxGetEventY(evt) + _aspxGetAbsoluteY(this.GetDesignViewIFrameElement()) - scrollY;
   this.GetContextMenu().ShowAtPos(x + 8, y + 8);
  }
 },
 UpdateContextMenuItemsState: function() {
  var popupMenu = this.GetContextMenu();
  for (var i = 0; i < popupMenu.GetItemCount(); i++) {
   var item = popupMenu.GetItem(i);
   if (_aspxIsExists(ASPxHtmlEditorCommandList[item.name]))
    item.SetVisible(!ASPxHtmlEditorCommandList[item.name].IsLocked(this));
  }
 },
 UpdateToolbar: function() {
  if (_aspxIsExists(this.toolbar))
   this.toolbar.UpdateItems();
 },
 UpdateToolbarImmediately: function() {
  if (_aspxIsExists(this.toolbar))
   this.toolbar.DoUpdateItems();
 },
 SendCallback: function(prefix, arg, showLoadingPanel) {
  if (showLoadingPanel)
   this.ShowLoadingPanel();
  this.CreateCallback(_aspxFormatCallbackArg(prefix, arg));
 },
 OnCallback: function(result) {
  if (this.callbackOwner != null)
   this.callbackOwner.OnCallback(result);
  else
   this.OnHtmlEditorCallback(result.action, result.html, result.spellcheck);
 },
 OnCallbackError: function(result, data) {
  if (this.callbackOwner != null)
   this.callbackOwner.OnCallbackError(result);
  else
   this.RollbackActiveView();
  this.isErrorOnCallback = true;
  this.constructor.prototype.OnCallbackError.call(this, result, data);
 },
 DoEndCallback: function() {
  this.constructor.prototype.DoEndCallback.call(this);
  if (this.callbackOwner != null && !this.isErrorOnCallback)
   this.callbackOwner.OnEndCallback();
  else if (this.spellCheckerCallback) {
   var spellChecker = this.GetSpellCheckerClientInstance();
   if (_aspxIsExists(spellChecker))
    spellChecker.DoEndCallback();
  }
  this.isErrorOnCallback = false;
 },
 OnHtmlEditorCallback: function(prefix, result, spellCheckResult) {
  this.spellCheckerCallback = false;
  switch (prefix) {
   case __aspxHESwitchToDesignViewCallbackPrefix:
    this.SwitchToDesignViewCore(result);
    break;
   case __aspxHESwitchToHtmlViewCallbackPrefix:
    this.SwitchToHtmlViewCore(result);
    break;
   case __aspxHESwitchToPreviewCallbackPrefix:
    this.SwitchToPreviewCore(result);
    break;
   case __aspxHESpellCheckingCallbackPrefix:
    var spellChecker = this.GetSpellCheckerClientInstance();
    if (_aspxIsExists(spellChecker)) {
     this.ClearUndoHistory();
     this.SetHtmlInternal(result);
     spellChecker.CheckByCallbackResult(result, spellCheckResult, this.GetMainElement());
     spellChecker.HideLoadingPanelCore();
     this.RemoveFocus();
    }
    this.spellCheckerCallback = true;
    break;
   default:
    throw "Unexpected callback prefix.";
    break;
  }
 },
 RollbackActiveView: function() {
  if (this.allowDesignView) {
   this.activeView = ASPxClientHtmlEditorView.Design;
   this.SwitchToDesignViewCore(this.GetHtml());
  }
  else if (this.allowHtmlView) {
   this.activeView = ASPxClientHtmlEditorView.Html;
   this.SwitchToHtmlViewCore(this.GetHtml());
  }
  else if (this.allowPreview) {
   this.activeView = ASPxClientHtmlEditorView.Preview;
   this.SwitchToPreviewCore(this.GetHtml());
  }
  var tabControl = this.GetTabControl();
  if (tabControl != null)
   tabControl.SetActiveTab(tabControl.GetTab(0));
 },
 ConvertToEmptyHtml: function(html) {
  var emptyTagsRegExp = new RegExp(__aspxHEEmptyTagsRegExpPattern, "ig");
  var emptyHtmlRegExp = new RegExp(__aspxHEEmptyHtmlRegExpPattern, "ig");
  var processedHtml = _aspxTrim(html);
  if (emptyTagsRegExp.test(processedHtml) || emptyHtmlRegExp.test(processedHtml))
   html = "";
  return html;
 },
 DeconvertEmptyHtml: function(html) {
  if (html == "" && (__aspxWebKitFamily || __aspxNetscapeFamily))
   html = "&nbsp;";
  return html;
 },
 CreatePasteContainer: function() {
  var divElem = document.createElement("DIV");
  divElem.style.overflow = "hidden";
  divElem.style.width = "1px";
  divElem.style.height = "1px";
  divElem.contentEditable = true;
  document.body.appendChild(divElem);
  return divElem;
 },
 IsExistsWindowInIFrame: function(iframeName) {
  try {
   return _aspxIsExists(_aspxIFrameWindow(iframeName));
  }
  catch (e) {
   return false;
  }
 },
 GetIFrameDocumentHtml: function(bodyContentHtml) {
  var html = "<head>";
  if (__aspxIE)
   html += "  <scr" + "ipt type=\"text/javascript\">" +
    "    window.document.onkeydown = function() {" +
    "       if(event.keyCode == 121) {" +
    "           window.parent.FocusActiveEditorToolbar();" +
    "           event.keyCode = 0;" +
    "           return false;" +
    "       }" +
    "   }" +
    "  </scr" + "ipt>";
  html += "<style></style></head><body>";
  if (_aspxIsExists(bodyContentHtml) && bodyContentHtml != "")
   html += bodyContentHtml;
  else if (__aspxWebKitFamily || __aspxNetscapeFamily)
   html += "&nbsp;";
  html += "</body>";
  return html;
 },
 ClearUndoHistory: function() {
  if (this.allowDesignView)
   this.commandManager.ClearUndoHistory();
 },
 CreateKeyDownInfo: function(evt) { 
  this.keyDownInfo = {
   isSystemKey: this.keyboardManager.IsSystemKey(evt.keyCode),
   isDeleteOrBackSpaceKey: this.keyboardManager.IsDeleteOrBackSpaceKey(evt.keyCode),
   isBackSpaceKey: this.keyboardManager.IsBackSpaceKey(evt.keyCode),
   isCursorMovingKey: this.keyboardManager.IsCursorMovingKey(evt.keyCode)
  };
 },
 ClearKeyDownInfo: function() { 
  this.keyDownInfo = null;
 },
 IsDefaultActionCommand: function(cmdID) {
  return _aspxIsExists(ASPxHtmlEditorCommandList[cmdID]) &&
    ASPxHtmlEditorCommandList[cmdID].IsDefaultAction();
 },
 IsDeleting: function() {
  return this.commandManager.IsDeleting() &&
   _aspxIsExists(this.keyDownInfo) && this.keyDownInfo.isDeleteOrBackSpaceKey;
 },
 IsHtmlChangeableCommand: function(cmdID) {
  return _aspxIsExists(ASPxHtmlEditorCommandList[cmdID]) &&
   ASPxHtmlEditorCommandList[cmdID].IsHtmlChangeable();
 },
 IsShortcut: function() {
  return _aspxIsExists(this.shortcutCmdID);
 },
 IsTextTyping: function() {
  return this.executingCommandName &&
    (this.executingCommandName == ASPxClientCommandConsts.TEXTTYPE_COMMAND) &&
    _aspxIsExists(this.keyDownInfo) && !this.keyDownInfo.isSystemKey;
 },
 IsRedoAvailable: function() {
  return this.commandManager.IsRedoAvailable();
 },
 IsUndoAvailable: function() {
  return this.commandManager.IsUndoAvailable();
 },
 OnSelectionChanged: function() {
  this.cachedElementsManager.ClearSeletedElements();
  this.UpdateToolbar();
  this.UpdateContextMenu();
  this.RaiseSelectionChanged();
 },
 OnHtmlChanged: function(saveSelectionAndHtml) {
  if (saveSelectionAndHtml && this.IsDesignView())
   this.commandManager.UpdateLastRestoreSelectionAndHTML();
  this.RaiseHtmlChanged();
  if (this.IsDesignView())
   this.OnSelectionChanged();
 },
 FocusToolbar: function() {
  this.GetToolbar().Focus();
 },
 FocusLastToolbar: function() {
  this.GetToolbar().FocusLastToolbar();
 },
 ProcessTabOnKeyDown: function(evt) {
  if (__aspxIE && evt.keyCode == ASPxKey.Tab) {
   try {
    if (evt.shiftKey) {
     this.FocusLastToolbar();
     ASPxClientHtmlEditor.PreventEventIE(evt);
    }
    else
     window.focus();
   }
   catch (e) { }
  }
 },
 OnKeyDown: function(evt) {
  this.shortcutCmdID = this.keyboardManager.GetShortcutCommand(evt);
  this.isAllowToPreventShortcut = false;
  this.ProcessTabOnKeyDown(evt);
  if (!__aspxIE && evt.keyCode == ASPxKey.F10) {
   aspxGetHtmlEditorsCollection().FocusActiveEditorToolbar();
   return _aspxPreventEvent(evt);
  }
  else if (this.IsShortcut()) {
   this.ExecuteCommand(this.shortcutCmdID, null);
   this.isAllowToPreventShortcut = !this.IsDefaultActionCommand(this.shortcutCmdID);
  }
  else {
   this.CreateKeyDownInfo(evt);
   if (this.keyDownInfo.isSystemKey) {
    if (this.keyDownInfo.isDeleteOrBackSpaceKey) {
     var curSelection = ASPxClientHtmlEditorSelection.Create(this);
     if (!this.keyDownInfo.isBackSpaceKey &&
       curSelection.GetHtmlText() != "" && (__aspxIE || __aspxOpera)) {
      this.ExecuteCommand(ASPxClientCommandConsts.DELETE_COMMAND, null);
      _aspxPreventEvent(evt);
     }
     else {
      this.ExecuteCommand(ASPxClientCommandConsts.KBDELETE_COMMAND, null);
      this.commandManager.UpdateLastRestoreHtml();
     }
    }
   }
   else
    if (!this.keyDownInfo.isCursorMovingKey) {
    if (!this.IsTextTyping())
     this.ExecuteCommand(ASPxClientCommandConsts.TEXTTYPE_COMMAND, null);
   }
  }
  if (this.IsShortcut() && __aspxIE && this.isAllowToPreventShortcut)
   ASPxClientHtmlEditor.PreventEventIE(evt);
 },
 OnKeyUp: function(evt) {
  if (!this.IsShortcut()) {
   if (this.IsDeleting())
    this.commandManager.CleanEmptyRestoreHtml();
   if (this.IsTextTyping() || this.IsDeleting())
    this.OnHtmlChanged(true);
   this.OnSelectionChanged();
   this.ClearKeyDownInfo();
  } else
   if (this.IsDefaultActionCommand(this.shortcutCmdID) &&
    this.IsHtmlChangeableCommand(this.shortcutCmdID)) {
   this.OnHtmlChanged(true);
  }
  else
   this.OnSelectionChanged();
 },
 OnKeyPress: function(evt) {
  if (this.IsShortcut(evt) && this.isAllowToPreventShortcut) {
   this.shortcutCmdID = null;
   return _aspxPreventEvent(evt);
  }
 },
 OnDblClick: function(evt) {
  var source = _aspxGetEventSource(evt);
  if (!_aspxIsExists(source))
   return;
  if (source.tagName == "IMG") {
   if (__aspxWebKitFamily)
    ASPxClientHtmlEditorSelection.SelectElement(source, this);
   this.ExecuteCommand(ASPxClientCommandConsts.CHANGEIMAGE_DIALOG_COMMAND);
  }
 },
 OnMouseDown: function(evt) {
  var toolBar = this.GetToolbar();
  if (_aspxIsExists(toolBar))
   toolBar.HideAllPopups();
  if (__aspxWebKitFamily && _aspxGetIsLeftButtonPressed(evt)) {
   var source = _aspxGetEventSource(evt);
   if (_aspxIsExists(source) && source.tagName == "IMG")
    ASPxClientHtmlEditorSelection.SelectElement(source, this);
  }
  this.isMouseDown = true;
 },
 OnMouseUp: function(evt) {
  this.OnSelectionChanged();
  this.isMouseDown = false;
 },
 OnFocus: function() {
  if (!this.isInitialized || (!__aspxIE && this.isMouseDown && this.isInFocus))
   return;
  this.isInFocus = true;
  this.RaiseFocus();
 },
 OnLostFocus: function() {
  if (!this.isInitialized || (__aspxWebKitFamily && !this.isInFocus))
   return;
  this.isInFocus = false;
  this.RaiseLostFocus();
 },
 OnDesignViewIframeLoad: function() {
  var designViewIframe = document.getElementById(this.GetDesignViewIFrameName());
  if (_aspxIsExists(designViewIframe) && !_aspxIsExists(designViewIframe.isLoaded)) {
   designViewIframe.isLoaded = true;
   this.InitAreas();
   this.UpdateLayout();
   this.InitializeManagers();
   this.AdjustControlCore();
  }
 },
 ClearDragDropTimer: function() {
  if (this.dragDropTimerID)
   _aspxClearTimer(this.dragDropTimerID);
 },
 OnAfterDocumentObjectDragEnd: function() {
  this.isDropExternalContentExecuted = false;
  this.OnHtmlChanged(true);
  this.ClearDragDropTimer();
 },
 OnAfterDocumentObjectDragEndCallWithDelay: function() {
  var callStr = "aspxHEAfterDocumentObjectDragEnd(\"" + this.name + "\")";
  this.dragDropTimerID = _aspxSetTimeout(callStr, __aspxHEDragDropDelay);
 },
 OnAfterObjectDragEnd: function() {
  this.OnHtmlChanged(true);
  this.ClearDragDropTimer();
 },
 OnAfterObjectDragEndWithDelay: function() {
  var callStr = "aspxHEAfterObjectDragEnd(\"" + this.name + "\")";
  this.dragDropTimerID = _aspxSetTimeout(callStr, __aspxHEDragDropDelay);
 },
 OnDocumentObjectDragEnd: function() {
  if (this.isDropExternalContentExecuted)
   this.OnAfterDocumentObjectDragEnd();
 },
 OnObjectDragStart: function(evt) {
  if (!this.isDraggingInsideEditor && !__aspxHEIsDocumentDragOver ) {
   this.isDraggingInsideEditor = true;
   this.ExecuteCommand(ASPxClientCommandConsts.DRAGDROPOBJECT_COMMAND, null);
  }
 },
 OnObjectDrop: function(evt) {
  if (!this.isDraggingInsideEditor) {
   this.isDropExternalContentExecuted = true;
   this.ExecuteCommand(ASPxClientCommandConsts.DROPOBJECTFROMEXTERNAL_COMMAND, null);
   if (__aspxHEIsDocumentDragOver) { 
    __aspxHEIsDocumentDragOver = false;
    this.OnAfterDocumentObjectDragEndCallWithDelay();
   }
  }
  if (__aspxNetscapeFamily)
   this.OnObjectDragEnd();
 },
 OnObjectDragEnd: function() {
  if (this.isDraggingInsideEditor) {
   this.isDraggingInsideEditor = false;
   this.OnAfterObjectDragEndWithDelay();
  }
 },
 OnObjectResizeStart: function(evt) {
  this.ExecuteCommand(ASPxClientCommandConsts.RESIZEOBJECT_COMMAND, null);
 },
 OnObjectResizeEnd: function(evt) {
  this.OnHtmlChanged(true);
 },
 OnContextMenuItemClick: function(item) {
  this.RestoreSelectionForPopup();
  this.ExecuteCommand(item.name, null);
 },
 SaveSelectionForPopup: function() {
  this.beforePopupSelection = this.CreateRestoreSelection();
  if (__aspxIE)
   this.selectionBookmark = this.beforePopupSelection.GetExtendedBookmark();
  else
   this.beforePopupSelection.Save();
 },
 RestoreSelectionForPopup: function() {
  if (_aspxIsExists(this.beforePopupSelection)) {
   if (__aspxIE && this.selectionBookmark) {
    this.beforePopupSelection.SelectExtendedBookmark(this.selectionBookmark);
    this.selectionBookmark = null;
   }
   else
    this.beforePopupSelection.Restore();
   this.beforePopupSelection = null;
  }
 },
 OnContextMenuCloseUp: function() {
  if (this.beforePopupSelection)
   this.selectionBookmark = this.beforePopupSelection.RemoveExtendedBookmark(this.selectionBookmark);
 },
 OnContextMenu: function(evt) {
  if (this.allowContextMenu == true)
   this.ShowContextMenu(evt);
  if (__aspxIE)
   evt.returnValue = false;
  else
   evt.preventDefault();
 },
 OnToolbarDropDownItemCloseUp: function() {
  this.RestoreSelectionForPopup();
 },
 RaiseCommandExecuted: function(commandName, parameter, isSuccessful) {
  if (!this.CommandExecuted.IsEmpty()) {
   var args = new ASPxClientHtmlEditorCommandEventArgs(commandName, parameter, isSuccessful, this);
   this.CommandExecuted.FireEvent(this, args);
  }
 },
 RaiseCustomCommand: function(commandName, parameter) {
  if (!this.CustomCommand.IsEmpty()) {
   var args = new ASPxClientHtmlEditorCommandEventArgs(commandName, parameter, true, this);
   this.CustomCommand.FireEvent(this, args);
   return args.isSuccessful;
  }
  return true;
 },
 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);
  }
 },
 RaiseHtmlChanged: function() {
  if (!this.HtmlChanged.IsEmpty()) {
   var args = new ASPxClientEventArgs();
   this.HtmlChanged.FireEvent(this, args);
  }
 },
 RaiseSelectionChanged: function() {
  if (!this.SelectionChanged.IsEmpty()) {
   var args = new ASPxClientEventArgs();
   this.SelectionChanged.FireEvent(this, args);
  }
 }
});
ASPxClientHtmlEditor.CleanHtmlScripts = function(html) {
 var ret = ASPxClientHtmlEditor.RemoveScriptTags(html);
 return ASPxClientHtmlEditor.RemoveScriptEventHadlers(ret);
};
ASPxClientHtmlEditor.RemoveScriptTags = function(html) {
 var ret = html;
 var rx = new RegExp(__aspxJSTagsRegExpPattern, "gi");
 if (ret != "")
  ret = ret.replace(rx, "");
 return ret;
};
ASPxClientHtmlEditor.PreserveTagsByName = function(tagName, html) {
 return _aspxApplyReplacement(html, [
  ["<" + tagName, "<" + "!--" + __aspxHEPreservedTagNamePrefix + tagName],
  ["<" + "/" + tagName + ">", "</" + __aspxHEPreservedTagNamePrefix + tagName + "--" + ">"]
 ]);
};
ASPxClientHtmlEditor.DepreserveTagsByName = function(tagName, html) {
 return _aspxApplyReplacement(html, [
  ["<" + "!--" + __aspxHEPreservedTagNamePrefix + tagName, "<" + tagName],
  ["</" + __aspxHEPreservedTagNamePrefix + tagName + "--" + ">", "<" + "/" + tagName + ">"]
 ]);
};
ASPxClientHtmlEditor.RemoveScriptEventHadlers = function(html) {
 var ret = html;
 var rx = new RegExp(__aspxJSEventHadlersRegExpPattern, "ig");
 if (ret != "")
  ret = ret.replace(rx, "");
 return ret;
};
ASPxClientHtmlEditor.PreventEventIE = function(evt) { 
 evt.keyCode = 123;
 evt.returnValue = false;
 return false;
}
EventListener = _aspxCreateClass(null, {
 constructor: function(htmlEditor) {
  this.htmlEditor = htmlEditor;
  this.AttachEventsToEditor();
 },
 AttachEventsToEditor: function() {
  var doc = this.htmlEditor.GetDesignViewIFrameDocument();
  _aspxAttachEventToElement(doc, "keydown", this.CreateEventHandlerFunction("aspxHEEditAreaKeyDown", true));
  _aspxAttachEventToElement(doc, "keyup", this.CreateEventHandlerFunction("aspxHEEditAreaKeyUp", true));
  if (!__aspxIE) 
   _aspxAttachEventToElement(doc, "keypress", this.CreateEventHandlerFunction("aspxHEEditAreaKeyPress", true));
  _aspxAttachEventToElement(doc, "mousedown", this.CreateEventHandlerFunction("aspxHEEditAreaMouseDown", true));
  _aspxAttachEventToElement(doc, "mouseup", this.CreateEventHandlerFunction("aspxHEEditAreaMouseUp", true));
  var designViewIFrame = this.htmlEditor.GetDesignViewIFrameWindow();
  _aspxAttachEventToElement(designViewIFrame, "focus", this.CreateEventHandlerFunction("aspxHEEditAreaOnFocus", false));
  _aspxAttachEventToElement(designViewIFrame, "blur", this.CreateEventHandlerFunction("aspxHEEditAreaOnLostFocus", false));
  if (!__aspxOpera)
   _aspxAttachEventToElement(doc, "dblclick", this.CreateEventHandlerFunction("aspxHEEditAreaDblClick", true));
  if (__aspxNetscapeFamily) {
   this.htmlEditor.GetDesignViewIFrameWindow().captureEvents(Event.DRAGDROP | Event.DBLCLICK);
   _aspxAttachEventToElement(this.htmlEditor.GetDesignViewIFrameWindow(), "dragdrop", 
    this.CreateEventHandlerFunction("aspxHEEditObjectDrop", true));
   _aspxAttachEventToElement(this.htmlEditor.GetDesignViewIFrameWindow(), "dragover",
    this.CreateEventHandlerFunction("aspxHEEditObjectDragStart", true));
  }
  else {
   _aspxAttachEventToElement(doc.body, "resizestart",
    this.CreateEventHandlerFunction("aspxHEEditObjectResizeStart", true));
   _aspxAttachEventToElement(doc.body, "resizeend",
    this.CreateEventHandlerFunction("aspxHEEditObjectResizeEnd", true));
   _aspxAttachEventToElement(document.body, "dragend", 
    this.CreateEventHandlerFunction("aspxHEDocumentObjectDragEnd", true));
   _aspxAttachEventToElement(doc.body, "dragstart",
    this.CreateEventHandlerFunction("aspxHEEditObjectDragStart", true));
   _aspxAttachEventToElement(doc.body, "drop",
    this.CreateEventHandlerFunction("aspxHEEditObjectDrop", true));
   _aspxAttachEventToElement(doc.body, "dragend",
    this.CreateEventHandlerFunction("aspxHEEditObjectDragEnd", true));
  }
  if (this.htmlEditor.allowContextMenu != "default")
   _aspxAttachEventToElement(doc, "contextmenu", this.CreateEventHandlerFunction("aspxHEEditAreaContextMenu", true));
 },
 CreateEventHandlerFunction: function(funcName, withHTMLEventArg) {
  return withHTMLEventArg ? new Function("event", funcName + "('" + this.htmlEditor.name + "', event);") :
   new Function(funcName + "('" + this.htmlEditor.name + "');");
 }
});
ASPxClientPath = {
 DirectorySeparatorChar: "\\",
 AltDirectorySeparatorChar: "/",
 VolumeSeparatorChar: ":",
 GetBaseUrlPath: function() {
  return window.location.protocol + "//" +  window.location.host;
 },
 GetFileName: function(path) {
  if (path) {
   var length = path.length;
   var index = length;
   while (--index >= 0) {
    var ch = path.charAt(index);
    if (((ch == ASPxClientPath.DirectorySeparatorChar) || (ch == ASPxClientPath.AltDirectorySeparatorChar)) || 
      (ch == ASPxClientPath.VolumeSeparatorChar))
     return path.substr(index + 1, (length - index) - 1);
   }
  }
  return "";
 },
 GetFileNameWithoutExtension: function(path) {
  path = ASPxClientPath.GetFileName(path);
  if (!path)
   return "";
  var length = path.lastIndexOf('.');
  if (length == -1)
   return path;
  return path.substr(0, length);
 }
};
var __aspxStyleAttributeRegEx = new RegExp("style=\"[^\"]*\"|'[^']*'", "ig");
var __aspxRGBColorCssAttrRegExp = new RegExp("rgb\\((\\d+)\\,(\\s)?(\\d+)\\,(\\s)?(\\d+)\\)", "ig");
var __aspxDefaultSafariFontSizes = ["x-small", "small", "medium", "large", "x-large", "xx-large", "-webkit-xxx-large"];
var __aspxDefaultSafariFontSizesInPixel = ["10px", "13px", "16px", "18px", "24px", "32px", "48px"];
var __aspxDefaultFontSizes = ["8pt", "10pt", "12pt", "14pt", "18pt", "24pt", "36pt"];
var __aspxDefaultSafariFontSizesHashTable = null;
var __aspxDefaultSafariFontSizesInPixelHashTable = _aspxCreateIndexHashTableFromArray(__aspxDefaultSafariFontSizesInPixel);
function _aspxGetDefaultSafariFontSizesHashTable() {
 if (!__aspxDefaultSafariFontSizesHashTable)
  __aspxDefaultSafariFontSizesHashTable = _aspxCreateIndexHashTableFromArray(__aspxDefaultSafariFontSizes);
 return __aspxDefaultSafariFontSizesHashTable;
}
function _aspxGetDefaultSafariFontSizesInPixelHashTable() {
 if (!__aspxDefaultSafariFontSizesInPixelHashTable)
  __aspxDefaultSafariFontSizesInPixelHashTable = _aspxCreateIndexHashTableFromArray(__aspxDefaultSafariFontSizesInPixel);
 return __aspxDefaultSafariFontSizesInPixelHashTable;
}
ASPxClientHtmlProcessingUtils = {
 AddEmptyBorderClassInTables: function(parentElem) {
  var tables = _aspxGetElementsByTagName(parentElem, "TABLE");
  for (var i = 0; i < tables.length; i++) {
   if (_aspxHETableHelper.IsEmptyBorder(tables[i]))
    _aspxHETableHelper.AppendEmptyBorderClassName(tables[i]);
  }
 },
 ReplaceTableStyleBorderByAttribute: function(parentElem) {
  var tables = _aspxGetElementsByTagName(parentElem, "TABLE");
  for (var i = 0; i < tables.length; i++)
   _aspxHETableHelper.ReplaceTableStyleBorderByAttribute(tables[i]);
 },
 RemoveEmptyBorderClassName: function(html) {
  var reg = new RegExp("(class=[\"\'].*)(" + __aspxEmptyBorderTableClassName + ")(.*[\"\'])", "ig");
  html = html.replace(reg, '$1$3');
  html = html.replace(new RegExp("class=\"[ ]*\"[ ]*", "ig"), ""); 
  return html.replace(new RegExp("class='[ ]*'[ ]*", "ig"), "");
 },
 ReplaceFontWithSpanTag: function(html) {
  html = _aspxApplyReplacement(html, [
   [/<font/ig, "<span"],
   [/<\/font>/ig, "</span>"]
  ]);
  var containerElement = document.createElement("DIV");
  _aspxSetInnerHtml(containerElement, html);
  var spans = _aspxGetElementsByTagName(containerElement, "SPAN");
  for (var i = 0; i < spans.length; i++) {
   var curSpan = spans[i];
   var curSpanFace = _aspxGetAttribute(curSpan, "face");
   if (_aspxIsExists(curSpanFace)) { 
    if (curSpanFace != "null")
     curSpan.style.fontFamily = curSpanFace;
    _aspxRemoveAttribute(curSpan, "face");
   }
   var size = 0;
   if (!isNaN(size = parseInt(_aspxGetAttribute(curSpan, "size")))) {
    try {
     curSpan.style.fontSize = __aspxDefaultFontSizes[size - 1];
    }
    catch (ex) { }
   }
   else {
    if (__aspxWebKitFamily) {
     var index = _aspxGetDefaultSafariFontSizesHashTable()[curSpan.style.fontSize.toLowerCase()]; ;
     if (index > -1)
      curSpan.style.fontSize = __aspxDefaultFontSizes[index];
    }
   }
   _aspxRemoveAttribute(curSpan, "size");
   if (this.IsExistAttribute(curSpan, "color")) {
    curSpan.style.color = this.CorrectColorValue(_aspxGetAttribute(curSpan, "color"));
    _aspxRemoveAttribute(curSpan, "color");
   }
  }
  var retHtml = containerElement.innerHTML;
  containerElement = null;
  return retHtml;
 },
 ReplaceSpanWithFontTag: function(html) {
  html = _aspxApplyReplacement(html, [
   [/<span/ig, "<font"],
   [/<\/span>/ig, "</font>"]
  ]);
  var defaultFontSizeReverseArray = [];
  for (var i = 0; i < __aspxDefaultFontSizes.length; i++)
   defaultFontSizeReverseArray[parseInt(__aspxDefaultFontSizes[i])] = i;
  var containerElement = document.createElement("DIV");
  _aspxSetInnerHtml(containerElement, html);
  var fonts = _aspxGetElementsByTagName(containerElement, "FONT");
  for (var i = 0; i < fonts.length; i++) {
   var curFont = fonts[i];
   if (curFont.style.fontFamily) {
    curFont.face = curFont.style.fontFamily;
    _aspxRemoveStyleAttribute(curFont, "fontFamily");
   }
   if (curFont.style.fontSize) {
    _aspxRemoveAttribute(curFont, "size");
    var size = defaultFontSizeReverseArray[parseInt(curFont.style.fontSize)];
    if (typeof (size) != 'undefined') {
     curFont.size = size + 1;
     _aspxRemoveStyleAttribute(curFont, "fontSize");
    }
   }
   if (curFont.style.color) {
    var newColor = this.CorrectColorValue(curFont.style.color);
    curFont.color = newColor;
    _aspxRemoveStyleAttribute(curFont, "color");
   }
  }
  html = containerElement.innerHTML;
  containerElement = null;
  html = html.replace(/\s*style="\s*"/gi, '');
  html = html.replace(/style=""/ig, "");
  html = html.replace(/style=''/ig, "");
  return html;
 },
 ReplaceUnderlineSpanWithUTag: function(html) {
  var containerElement = document.createElement("DIV");
  _aspxSetInnerHtml(containerElement, html);
  var spans = this.GetUnderlineSpanElements(containerElement);
  var UElement = document.createElement("U");
  while (spans.length > 0) {
   var curSpan = spans[0];
   if (this.IsUnderlineSpan(curSpan)) {
    var newUELement = UElement.cloneNode(false);
    var parentNode = curSpan.parentNode;
    newUELement.id = curSpan.id;
    newUELement.style.cssText = curSpan.style.cssText;
    newUELement.style.textDecoration = "";
    if (curSpan.className)
     newUELement.className = curSpan.className;
    _aspxSetInnerHtml(newUELement, curSpan.innerHTML);
    parentNode.replaceChild(newUELement, curSpan);
    spans = this.GetUnderlineSpanElements(containerElement);
   }
  }
  return containerElement.innerHTML;
 },
 ReplaceLinkTargetWithBlank: function(parentElem) {
  var linkArray = _aspxGetElementsByTagName(parentElem, "A");
  for (var i = 0; i < linkArray.length; i++)
   _aspxSetAttribute(linkArray[i], "target", "_blank");
 },
 ReplaceRGBToHex: function(html) {
  return html.replace(__aspxStyleAttributeRegEx,
        function(cssStyleString) {
         return cssStyleString.replace(__aspxRGBColorCssAttrRegExp, _aspxColorToHexadecimal);
        }
       );
 },
 FilterHtmlToGetHtml: function(html) {
  if (__aspxNetscapeFamily || __aspxWebKitFamily)
   html = this.ReplaceRGBToHex(html);
  return html;
 },
 CorrectColorValue: function(colorValue) {
  if (!colorValue) return null;
  var retColorValue = colorValue;
  if (typeof (colorValue) == "number" || colorValue.substr(0, 3) == "rgb")
   retColorValue = _aspxColorToHexadecimal(colorValue);
  return retColorValue;
 },
 CleanWrongSizeAttribute: function(element) {
  var fonts = _aspxGetElementsByTagName(element, "font");
  for (var i = 0; i < fonts.length; i++)
   if (fonts[i].size == "+0")
   _aspxRemoveAttribute(fonts[i], "size");
 },
 IsExistAttribute: function(element, attrName) {
  var attrObj = _aspxGetAttribute(element, attrName);
  return _aspxIsExists(attrObj) && attrObj != "null";
 },
 IsUnderlineSpan: function(element) {
  return (element.tagName.toLowerCase() == "span") &&
    (element.style.textDecoration.toLowerCase() == "underline") &&
    (element.style.fontFamily == "") &&
    (element.style.fontSize == "");
 },
 GetUnderlineSpanElements: function(element) {
  var spans = element.getElementsByTagName("SPAN");
  var ret = new Array();
  for (var i = spans.length - 1; i >= 0; i--) {
   if (this.IsUnderlineSpan(spans[i]))
    _aspxArrayPush(ret, spans[i]);
  }
  return ret;
 }
};
_aspxAttachEventToElement(window, "resize", aspxHEBodyResize);
var _aspxResizingTimerId = null;
function aspxHEBodyResize() { 
 if (!aspxGetHtmlEditorsCollection().resizingLocked) { 
  aspxGetHtmlEditorsCollection().resizingLocked = true;
  if (__aspxChrome) { 
   _aspxResizingTimerId = _aspxClearTimer(_aspxResizingTimerId);
   _aspxResizingTimerId = _aspxSetTimeout("aspxGetHtmlEditorsCollection().AdjustSizeToContainer()", 200);
  }
  else
   aspxGetHtmlEditorsCollection().AdjustSizeToContainer();
  _aspxSetTimeout("aspxGetHtmlEditorsCollection().resizingLocked = false", 100);
 }
}
function aspxHEChangeActiveView(name, evt) {
 var htmlEdit = aspxGetControlCollection().Get(name);
 if (htmlEdit != null)
  htmlEdit.ChangeActiveView(evt.tab.name);
}
window.FocusActiveEditorToolbar = function() {
 aspxGetHtmlEditorsCollection().FocusActiveEditorToolbar();
}
function aspxHEEditAreaKeyDown(name, evt) {
 var htmlEdit = aspxGetControlCollection().Get(name);
 if (htmlEdit != null)
  return htmlEdit.OnKeyDown(evt);
}
function aspxHEEditAreaKeyUp(name, evt) {
 var htmlEdit = aspxGetControlCollection().Get(name); 
 if (htmlEdit != null)
  return htmlEdit.OnKeyUp(evt);
}
function aspxHEEditAreaKeyPress(name, evt) {
 var htmlEdit = aspxGetControlCollection().Get(name);
 if (htmlEdit != null)
  return htmlEdit.OnKeyPress(evt);
}
function aspxHEEditAreaMouseDown(name, evt) {
 var htmlEdit = aspxGetControlCollection().Get(name);
 if (htmlEdit != null)
  htmlEdit.OnMouseDown(evt);
}
function aspxHEEditAreaMouseUp(name, evt) {
 var htmlEdit = aspxGetControlCollection().Get(name);
 if (htmlEdit != null)
  htmlEdit.OnMouseUp(evt);
}
function aspxHEEditAreaContextMenu(name, evt) {
 var htmlEdit = aspxGetControlCollection().Get(name);
 if (htmlEdit != null)
  htmlEdit.OnContextMenu(evt);
}
function aspxHEEditAreaDblClick(name, evt) {
 var htmlEdit = aspxGetControlCollection().Get(name);
 if (htmlEdit != null)
  htmlEdit.OnDblClick(evt);
}
function aspxHEEditAreaOnFocus(name) {
 var htmlEdit = aspxGetControlCollection().Get(name);
 if (htmlEdit != null)
  return htmlEdit.OnFocus();
}
function aspxHEEditAreaOnLostFocus(name) {
 var htmlEdit = aspxGetControlCollection().Get(name);
 if (htmlEdit != null)
  return htmlEdit.OnLostFocus();
}
function aspxHEEditObjectResizeStart(name, evt) {
 var htmlEdit = aspxGetControlCollection().Get(name);
 if (htmlEdit != null)
  return htmlEdit.OnObjectResizeStart(evt);
}
function aspxHEEditObjectResizeEnd(name, evt) {
 var htmlEdit = aspxGetControlCollection().Get(name);
 if (htmlEdit != null)
  return htmlEdit.OnObjectResizeEnd(evt);
}
function aspxHEAfterDocumentObjectDragEnd(name) {
 var htmlEdit = aspxGetControlCollection().Get(name);
 if (htmlEdit != null)
  return htmlEdit.OnAfterDocumentObjectDragEnd();
}
function aspxHEAfterObjectDragEnd(name) {
 var htmlEdit = aspxGetControlCollection().Get(name);
 if (htmlEdit != null)
  return htmlEdit.OnAfterObjectDragEnd();
}
function aspxHEEditObjectDragStart(name, evt) {
 var htmlEdit = aspxGetControlCollection().Get(name);
 if (htmlEdit != null)
  return htmlEdit.OnObjectDragStart(evt);
}
function aspxHEEditObjectDragEnd(name) {
 var htmlEdit = aspxGetControlCollection().Get(name);
 if (htmlEdit != null)
  return htmlEdit.OnObjectDragEnd();
}
function aspxHEEditObjectDrop(name, evt) {
 var htmlEdit = aspxGetControlCollection().Get(name);
 if (htmlEdit != null)
  return htmlEdit.OnObjectDrop(evt);
}
function aspxHEDocumentObjectDragEnd(name) {
 var htmlEdit = aspxGetControlCollection().Get(name);
 if (htmlEdit != null)
  return htmlEdit.OnDocumentObjectDragEnd();
}
function aspxHESpellCheckerWordChanged(name, sender, args) {
 var htmlEdit = aspxGetControlCollection().Get(name);
 if (htmlEdit != null)
  return htmlEdit.OnSpellCheckerWordChanged(sender, args);
}
function aspxHEDesignViewIframeOnLoad(name) {
 var htmlEdit = aspxGetControlCollection().Get(name);
 if (htmlEdit != null)
  htmlEdit.OnDesignViewIframeLoad();
}
function aspxHEHtmlViewHtmlChanged(name) {
 var htmlEdit = aspxGetControlCollection().Get(name);
 if (htmlEdit != null)
  htmlEdit.OnHtmlChanged();
}
function aspxHEDocumentDragOver(evt) {
 __aspxHEIsDocumentDragOver = true;
}
function aspxHEDocumentDragDrop() {
 __aspxHEIsDocumentDragOver = false;
}
if (__aspxNetscapeFamily)
 _aspxAttachEventToDocument("dragover", aspxHEDocumentDragOver);
if (__aspxNetscapeFamily)
 _aspxAttachEventToDocument("dragdrop", aspxHEDocumentDragDrop);
function aspxHEContextMenuCloseUp(name) {
 var htmlEdit = aspxGetControlCollection().Get(name);
 if (htmlEdit != null) return htmlEdit.OnContextMenuCloseUp();
}
function aspxHEContextMenuItemClick(name, args) {
 var htmlEdit = aspxGetControlCollection().Get(name);
 if (htmlEdit != null) return htmlEdit.OnContextMenuItemClick(args.item);
}
var __aspxActiveSpellChecker = null;
var __aspxSCFormPostFix = ":SCFPR:";
var __aspxSCOptionsPrefix = "Options:";
var __aspxSCErrorMarker = "^^^DXError^^^";
ASPxClientSpellChecker = _aspxCreateClass(ASPxClientControl, {
 constructor: function(name) {
  this.constructor.prototype.constructor.call(this, name);
  this.callbackError = false;
  this.checkingText = null;
  this.anchorElement = null;
  this.editorElement = null;
  this.checkedContainer = null;
  this.checkedText = ""; 
  this.editorHelper = new ASPxEditorHelper();
  this.containerBrowser  = new ASPxContainerBrowser();
  this.formHandler = null;
  this.spellCheckForm = null;
  this.optionsForm = null;
  this.isOptionsForm = false;
  this.preventHideEvents = false;
  this.checkedElementID = "";
  this.showOneWordInTextPreview = false;
  this.BeforeCheck = new ASPxClientEvent();
  this.CheckCompleteFormShowing = new ASPxClientEvent();
  this.AfterCheck = new ASPxClientEvent();
  this.WordChanged = new ASPxClientEvent();
 },
 Check: function() {  
  this.CheckElementById(this.checkedElementID);
 },
 CheckElement: function(element) { 
  if(!_aspxIsExists(element)) return;
  var inputElement = this.FindDxEditorInputElement(element);
  if (inputElement != null)
   element = inputElement;
  if(this.CanCheckControl(element.id))
   this.CheckElementCore(element);
  else
   this.ContinueOrFinishCheck(element);
 },
 CheckElementById: function(id) {
  var element = this.FindDxEditorInputElementById(id);
  if(!_aspxIsExists(element))
   element = _aspxGetElementById(id);
  this.CheckElement(element);
 },
 CheckElementsInContainer: function(containerElement) {
  if(_aspxIsExists(containerElement)) {
   this.checkedContainer = containerElement;
   var editor = this.FindNextEditorInContainer(containerElement, null);
   if(_aspxIsExists(editor))
    this.CheckElement(editor);
   else
    this.ShowFinishMessageBox();
  }  
 },
 CheckElementsInContainerById: function(containerId) {
  var container = _aspxGetElementById(containerId);
  this.CheckElementsInContainer(container);
 },
 CheckText: function(text, anchorElement) { 
  this.CheckCore(text, anchorElement, null, null);
 }, 
 FindDxEditorInputElement: function(obj) {
  if(ASPxIdent.IsASPxClientEdit(obj))
   return obj.GetInputElement();
  else if(_aspxIsExistsElement(obj) && _aspxIsExists(obj.id))
   return _aspxGetChildById(obj, obj.id + "_I"); 
  return null;
 },
 FindDxEditorInputElementById: function(id) {
  var control = aspxGetControlCollection().Get(id);
  if(control != null && ASPxIdent.IsASPxClientEdit(control))
   return control.GetInputElement();
  return null;
 }, 
 GetEditorID: function(element) {
  var id = "";
  if (_aspxIsExists(element)) {
   var editor = this.editorHelper.GetDXEditorByInput(element);
   id = editor ? editor.name : element.id;
  }
  return id; 
 }, 
 GetDialogPopupControl: function(name) {
  return aspxGetControlCollection().Get(this.name + "_" + name);
 },
 GetOptionsHiddenField: function() {
  return document.getElementById(this.name + "_SettingsHiddenField");
 },  
 GetSpellCheckForm: function() {
  if(!this.spellCheckForm)
   this.spellCheckForm = new SpellCheckForm("SpellCheckForm", this);
  return this.spellCheckForm;
 },
 GetOptionsForm: function() {
  if(!this.optionsForm)
   this.optionsForm = new SpellCheckOptionsForm("SpellCheckOptionsForm", this);
  return this.optionsForm;
 }, 
 SetOptionsHiddenField: function(callbackResult) {
  if(callbackResult.indexOf(__aspxSCOptionsPrefix) == 0) {
   var i = callbackResult.indexOf(";");
   this.GetOptionsHiddenField().value = callbackResult.slice(8, i); 
   return callbackResult.slice(i +  1);
  }
  return callbackResult;
 },
 CanCheckControl: function(id) {
  return this.RaiseBeforeCheck(id);
 },   
 ContinueCheckContainer: function(nextEditor) {
  if (_aspxIsExists(this.editorElement))
   this.RaiseAfterCheck(this.GetEditorID(this.editorElement), this.checkingText);
  this.checkedText = null;
  this.CheckElement(nextEditor);
 },
 ContinueOrFinishCheck: function(currentElement) {
  if(_aspxIsExists(this.checkedContainer)){  
   var editor = this.FindNextEditorInContainer(this.checkedContainer, currentElement);
   if(_aspxIsExists(editor)){
    this.ContinueCheckContainer(editor);
    return;
   }
   else 
    this.RaiseAfterCheck(this.GetEditorID(currentElement), this.checkingText);
  }
  var spellCheckForm = this.GetSpellCheckForm();
  if(spellCheckForm.IsVisible() != null)
   spellCheckForm.GetDialogPopup().Hide();
  this.ShowFinishMessageBox();
  __aspxActiveSpellChecker = null;
 },
 CheckElementCore: function(element) { 
  if (ASPxEditorHelper.IsEditableEditNode(element))
   this.CheckCore(element.value, element, element, null);
  else
   this.ContinueOrFinishCheck(element);
 },
 CheckByCallbackResult: function(text, result, anchorElement) {  
  this.CheckCore(text, anchorElement, null, result);
 }, 
 CheckCore: function(text, anchorElement, editorElement, callResult) { 
  __aspxActiveSpellChecker = this;
  this.checkingText = text;
  this.anchorElement = _aspxIsExists(anchorElement) ? anchorElement : document.body;
  this.editorElement = editorElement;
  __aspxCurrentControlNameInDialog = this.name;
  if(this.formHandler == null)
   this.formHandler = new ASPxSpellCheckerFormHandler(this);  
  if(callResult != null)
   this.OnCallback(callResult);
  else if(text != "")
   this.SendCallback(this.CreateCallbackArgumentToCheckText(text));
  else 
   this.ContinueOrFinishCheck(this.editorElement);
 }, 
 ReCheck: function(text) {
  var callbackParam = this.CreateCallbackArgumentToCheckText(text);
  this.checkingText = text;
  this.SendCallback(callbackParam);
 },
 CreateCallbackArgumentToCheckText: function(text) {
  var argument = "Check(" + text.length + "):" + text;
  if(!this.IsDialogContentAvailable(this.GetSpellCheckForm().name))
   argument = argument.concat(":", this.CreateCallbackArgumentToGetSpellCheckFormContent());
  var options = this.CreateCallbackArgumentToSaveOptions();
  if(options != "")
   argument = argument.concat(":", options);
  return argument;
 },
 CreateCallbackArgumentToGetSpellCheckFormContent: function() {
  return "DialogForm:SpellCheckForm"; 
 },
 CreateCallbackArgumentToGetSpellCheckOptionsFormContent: function() {
  return "DialogForm:SpellCheckOptionsForm"; 
 },
 CreateCallbackArgumentToSaveOptions: function() {
  var mask = this.GetOptionsHiddenField().value;
  if(mask && mask != "")
   return "Options:" + mask;
  return "";
 },
 CreateCallbackArgumentToAddWord: function(word) {
  return "Word(" + word.length + "):" + word;
 },
 ShowFinishMessageBox: function() {
  var needShowAlert = this.formHandler == null || !this.formHandler.HasErrors();
  if(!needShowAlert)
   return;
  needShowAlert = this.RaiseCheckCompleteFormShowing();
  if(needShowAlert)
   alert(this.finishSpellChecking); 
 },
 IsDialogContentAvailable: function(name) {
  return this.dialogContentHashTable[name] != null;
 },
 HideDialog: function(result) { 
  if(this.preventHideEvents) return;
  var optionsForm = this.GetOptionsForm();
  if(optionsForm.IsVisible())
   this.OnFinishOptionsEditing(result);
  else
   this.OnFinishSpellChecking(result);
 },
 ShowOptionsForm: function(dialogContent) {
  this.isOptionsForm = true;
  if(this.formHandler != null)
   this.formHandler.ClearErrorSelection();
  var dialog = this.GetOptionsForm();
  if(!this.IsDialogContentAvailable(dialog.name)  && !dialogContent)
   this.SendCallback(this.CreateCallbackArgumentToGetSpellCheckOptionsFormContent());
  else
   this.ShowOptionsFormCore(dialogContent);
 },
 ShowOptionsFormCore: function(dialogContent) { 
  var dialog = this.GetOptionsForm();
  var spellCheckForm = this.GetSpellCheckForm();
  var popupElement = this.anchorElement;
  if(spellCheckForm.IsVisible())
   popupElement = spellCheckForm.GetDialogPopup().GetWindowContentElement(-1);
  dialog.Show(popupElement);  
  dialog.GetDialogPopup().SetPopupElementInternal(-1, popupElement);
  if(dialogContent)
   dialog.SetDialogContent(dialogContent);
 },
 ShowLoadingPanel: function() {
  var offsetElement = null;
  var spellCheckForm = this.GetSpellCheckForm();
  if(spellCheckForm.IsVisible())
   spellCheckForm.ShowLoadingPanelOverDialogPopup();
  else {
   offsetElement = this.checkedContainer ? this.checkedContainer : this.anchorElement;
   this.ShowLoadingPanelCore(document.body, offsetElement);   
  }
 },
 HideLoadingPanelCore: function() {
  var spellCheckForm = this.GetSpellCheckForm(); 
  if(spellCheckForm.IsVisible())
   spellCheckForm.HideLoadingPanelOverDialogPopup();
 },
 ShowLoadingPanelCore: function(parentElement, offsetElement) { 
  this.CreateLoadingPanelWithAbsolutePosition(parentElement, offsetElement);  
 },
 SendCallback: function(argument) {
  this.BeforeSendCallback();
  this.CreateCallback(argument);   
 },
 OnCallback: function(result) {
  this.HideLoadingPanelCore();
  this.ProcessCallbackResult(result);
 },
 ProcessCallbackResult: function(resultObj) {
  if (_aspxIsExists(resultObj.options))
   this.GetOptionsHiddenField().value = resultObj.options;
  if(!this.isOptionsForm) {    
   var errorCount = _aspxIsExists(resultObj.errorCount) ? resultObj.errorCount : 0;   
   if(errorCount > 0) {
    this.formHandler.Initialize(errorCount, resultObj.startErrorWordPositionArray,
           resultObj.wrongWordLengthArray, resultObj.suggestionsArray);
    this.GetSpellCheckForm().Show(this.anchorElement);
    if(_aspxIsExists(resultObj.dialogContent))
     this.GetSpellCheckForm().SetDialogContent(resultObj.dialogContent);
   }
   else
    if(!_aspxIsExists(this.checkedContainer))
     this.OnFinishSpellChecking(false);
  }
  else
   this.ShowOptionsForm(resultObj.dialogContent);
 },
 DoEndCallback: function() {
  this.constructor.prototype.DoEndCallback.call(this);  
  if(this.callbackError){
   this.callbackError = false;
   return;
  }
  if(!this.isOptionsForm) {
   if(this.formHandler.errorCount > 0) {
    this.GetSpellCheckForm().OnEndCallback();
    this.formHandler.ShowSpellCheckerForm();
   } else if(_aspxIsExists(this.checkedContainer)) {
       var editor = this.FindNextEditorInContainer(this.checkedContainer, this.editorElement);
       if(_aspxIsExists(editor))
        this.ContinueCheckContainer(editor);
       else {
        this.OnFinishSpellChecking(false);
        this.ShowFinishMessageBox();
       }
    }
    else
     this.ShowFinishMessageBox();
  }
  else
   this.InitializeOptionsDialogFields();   
 },
 OnCallbackError: function(result, data){
  this.callbackError = true;
  this.constructor.prototype.OnCallbackError.call(this, result, data);
 },
 BeforeSendCallback: function() { 
  if(_aspxIsExists(this.formHandler)) {
   this.formHandler.ClearErrorSelection();
   this.formHandler.ClearListBoxItems();
  }
  this.ShowLoadingPanel();
 },
 AddToDictionary: function() {
  this.formHandler.AddToDictionaryClick();
 },
 AddWord: function(word) {
  this.formHandler.ClearErrorSelection();
  var text = this.checkedText;
  var callbackParam = this.CreateCallbackArgumentToCheckText(text);
  callbackParam = callbackParam.concat(":", this.CreateCallbackArgumentToAddWord(word));
  this.checkingText = text;  
  this.SendCallback(callbackParam);
 }, 
 Change: function() {
  this.formHandler.ChangeClick();  
 },
 ChangeAll: function() {
  this.formHandler.ChangeAllClick();
 },
 Ignore: function() {
  this.formHandler.IgnoreClick();
 }, 
 IgnoreAll: function() { 
  this.formHandler.IgnoreAllClick();
 }, 
 Cancel: function() {
  this.formHandler.Cancel();
 },
 ListBoxItemChanged: function(listBox, e) {
  this.formHandler.ListBoxItemChanged(listBox);
 }, 
 TextBoxKeyPress: function(evt) {
  this.formHandler.TextBoxKeyPress(_aspxGetKeyCode(evt));
 }, 
 TextBoxKeyDown: function(evt) {
  this.formHandler.TextBoxKeyDown(_aspxGetKeyCode(evt));
 },
 SCListBoxItemDoubleClick: function() {
  this.formHandler.SCListBoxItemDoubleClick();
 },
 OnWordChanged: function() {
  if(_aspxIsExists(this.editorElement))
   this.editorHelper.SetText(this.editorElement, this.checkedText);
  this.RaiseWordChanged(this.GetEditorID(this.editorElement), this.checkedText);
 },
 OnFinishSpellCheckingCore: function(change) {
  var checkedText = this.checkingText;
  this.formHandler.ClearErrorSelection();
  if(change) {
   checkedText = this.checkedText;
   if(_aspxIsExists(this.editorElement))
    this.editorHelper.SetText(this.editorElement, checkedText);    
  }
  this.formHandler.ClearInternalFields();
  this.RaiseAfterCheck(this.GetEditorID(this.editorElement), checkedText);
  this.checkingText = null;
  this.anchorElement = null;
  this.editorElement = null;
  this.checkedText = null;
 },
 OnFinishSpellChecking: function(change) {
  this.preventHideEvents = true;
  if(change && _aspxIsExists(this.checkedContainer)){
   var editor = this.FindNextEditorInContainer(this.checkedContainer, this.editorElement);
   if(_aspxIsExists(editor)){
    this.OnFinishSpellCheckingCore(change);
    this.ContinueCheckContainer(editor);
    this.preventHideEvents = false;
    return;
   }
  }
  var spellCheckForm = this.GetSpellCheckForm();
  if(spellCheckForm.IsVisible() != null)
   spellCheckForm.GetDialogPopup().Hide();
  this.OnFinishSpellCheckingCore(change);
  if(change) 
   this.ShowFinishMessageBox();
  __aspxActiveSpellChecker = null;
  this.preventHideEvents = false;
 }, 
 OnFinishOptionsEditing: function(change) {
  this.preventHideEvents = true;
  var optionsForm = this.GetOptionsForm();
  if(optionsForm.IsVisible() != null)
   optionsForm.GetDialogPopup().Hide();
  this.isOptionsForm = false;
  if(change) {
   this.GetOptionsHiddenField().value = this.CreateSettingsMask();
   this.ReCheck(this.checkedText);
  }
  else {  
   this.formHandler.SelectError(this.formHandler.currentError);
   this.formHandler.PrepareFormControlsByError(this.formHandler.currentError);
   this.InitializeOptionsDialogFields();
    }
    this.preventHideEvents = false;
 },
 FindNextEditorInContainer: function(container, currentEditor) {
  var editor = this.containerBrowser.FindNextEditor(container, currentEditor);
  if(_aspxIsExists(editor) && _aspxIsExists(editor.id) && editor.id.indexOf(this.name + "_") == 0)
   editor = null;
  return editor;
 },
 CreateSettingsMask: function() {
  var mask = "";  
  mask += this.MapEditorValueToString(chkbUpperCase);
  mask += this.MapEditorValueToString(chkbMixedCase);
  mask += this.MapEditorValueToString(chkbNumbers);
  mask += this.MapEditorValueToString(chkbEmails);
  mask += this.MapEditorValueToString(chkbUrls);
  mask += this.MapEditorValueToString(chkbTags);
  mask = mask.concat(comboLanguage.GetValue()); 
  return mask;
 },
 MapEditorValueToString: function(editor) {
  return editor.GetChecked() ? "1" : "0";
 },
 InitializeOptionsDialogFields: function() {
  this.ParseSettingsMask(this.GetOptionsHiddenField().value);
 },
 ParseSettingsMask: function(mask) {
  if(!mask || mask == "")
   return;
  chkbUpperCase.SetChecked(mask.charAt(0) == "1"); 
  chkbMixedCase.SetChecked(mask.charAt(1) == "1"); 
  chkbNumbers.SetChecked(mask.charAt(2) == "1"); 
  chkbEmails.SetChecked(mask.charAt(3) == "1"); 
  chkbUrls.SetChecked(mask.charAt(4) == "1");
  chkbTags.SetChecked(mask.charAt(5) == "1");
  comboLanguage.SetValue(mask.slice(6)); 
 }
});
ASPxSpellCheckerFormHandler = _aspxCreateClass(null, {
 constructor: function(spellChecker) {
  this.spellChecker = spellChecker;
  this.scForm = spellChecker.GetSpellCheckForm();
  this.errorCount = -1;
  this.errors = [];
  this.currentError = null;
  this.ignoreAllList = [];
  this.changeAllList = new Object();
  this.delta = 0;
  this.checkedTextFakeElement = null;
  this.previewTextElement = null;
  this.sampleErrorElement = null;
 },
 ClearInternalFields: function() {
  this.errorCount = -1;
  this.errors = [];
  this.currentError = null;
 },
 Initialize: function(errorCount, startErrorWordPositionArray, wrongWordLengthArray, suggestionsArray) {
  this.ClearInternalFields();
  this.wrongWordLengthArray = wrongWordLengthArray;
  this.startErrorWordPositionArray = startErrorWordPositionArray;
  this.suggestionsArray = suggestionsArray;
  this.errorCount = errorCount;
 },
 InitializeErrorArray: function() {
  _aspxArrayClear(this.errors);
  for (var i =0; i < this.errorCount; i++) {
   var error = {};
   error.wordStart = this.startErrorWordPositionArray[i];
   error.wordLength = this.wrongWordLengthArray[i];
   error.suggestions = this.suggestionsArray[i];
   error.suggestionCount = this.suggestionsArray[i].length;    
   error.word = this.GetWordByError(error);
   this.AddErrorToErrorsList(error);
  }
 },
 AddErrorToErrorsList: function(error) {
  if(this.currentError == null)
   this.errors.push(error);
  else {
   if(error.wordStart > this.currentError.wordStart)
    this.errors.push(error);
   else
    this.errorCount --;
  }
 },
 GetSCForm: function() {
  return this.scForm;
 },
 GetSCFormListBox: function (form) {
  if(_aspxIsExistsType(typeof(_dxeSCSuggestionsListBox)) && _aspxIsExists(_dxeSCSuggestionsListBox) && _aspxIsExistsElement(_dxeSCSuggestionsListBox.GetMainElement()))
   return _dxeSCSuggestionsListBox;
  return null;
 }, 
 GetSCFormChangeButton: function(form) { 
  if(_aspxIsExistsType(typeof(_dxeSCBtnChange)) && _aspxIsExists(_dxeSCBtnChange) && _aspxIsExistsElement(_dxeSCBtnChange.GetMainElement()))
   return _dxeSCBtnChange;
  return null;
 },
 GetSCFormChangeAllButton: function(form) {
  if(_aspxIsExistsType(typeof(_dxeSCBtnChangeAll)) && _aspxIsExists(_dxeSCBtnChangeAll) && _aspxIsExistsElement(_dxeSCBtnChangeAll.GetMainElement()))
   return _dxeSCBtnChangeAll;
  return null;
 },
 GetSCFormChangeTextBox: function() { 
  if(_aspxIsExistsType(typeof(_dxeSCTxtChangeTo)) && _aspxIsExists(_dxeSCTxtChangeTo) && _aspxIsExistsElement(_dxeSCTxtChangeTo.GetMainElement()))
   return _dxeSCTxtChangeTo;
  return null;
 },
 GetCheckedTextFakeElement: function() {
  if(!_aspxIsExistsElement(this.checkedTextFakeElement))
   this.checkedTextFakeElement = document.createElement("DIV");
  return this.checkedTextFakeElement;
 },
 GetSampleErrorElement: function() {
  return document.getElementById(this.spellChecker.name + "_SpellCheckSpan");  
 },
 GetCachedSampleErrorElement: function() {
  if(!_aspxIsExistsElement(this.sampleErrorElement))
   this.sampleErrorElement = this.GetSampleErrorElement();
  return this.sampleErrorElement;
 },   
 GetPreviewTextElement: function() {
  if(!_aspxIsExistsElement(this.previewTextElement))
   this.previewTextElement = document.getElementById(this.spellChecker.name + "_" + this.GetSCForm().name +"_SCCheckedDiv"); 
  return this.previewTextElement;
 },
 ClearListBoxItems: function() {
  var listBox = this.GetSCFormListBox(this.GetSCForm());
  if(_aspxIsExists(listBox)) listBox.ClearItems();
 },
 CanPerformChangeAction: function() {
  return this.currentError.suggestionCount > 0;
 }, 
 HasErrors: function() {
  return this.errors.length > 0  || this.currentError != null;
 },
 ProcessNewError: function() {
  this.ClearErrorSelection();
  this.AdjustFormButtons();
  this.SelectError(this.currentError);
  this.PrepareFormControlsByError(this.currentError);
 },
 PrepareFormControlsByError: function(error) { 
  this.PopulateSuggestionsListBox(error);
  this.PrepareTextBox(error);
  this.SelectFirstSuggestion(); 
 },
 SetChangeButtonsEnabled: function(enabled) {
  var btnChange = this.GetSCFormChangeButton(this.GetSCForm());
  var btnChangeAll = this.GetSCFormChangeAllButton(this.GetSCForm());
  btnChange.SetEnabled(enabled);
  btnChangeAll.SetEnabled(enabled); 
 },
 SelectError: function(error) {
  var startIndex = this.GetWordStartIndex(error);
  var finishIndex = this.GetWordFinishIndex(error);   
  var text = this.spellChecker.checkedText;
  text = _aspxInsert(text, __aspxSCErrorMarker, finishIndex);
  text = _aspxInsert(text, __aspxSCErrorMarker, startIndex);
  if(this.spellChecker.editorElement != null)
   text = ASPxSpellCheckerFormHandler.PreparePreviewText(text);
  else
   text = ASPxSpellCheckerHtmlFilter.PreparePreviewHTML(text);
  startIndex = text.indexOf(__aspxSCErrorMarker);
  finishIndex = text.lastIndexOf(__aspxSCErrorMarker) + __aspxSCErrorMarker.length;
  var leftText = text.slice(0, startIndex);
  var rightText = text.slice(finishIndex);
  var element = this.GetPreviewTextElement();
  var errorSpan = this.GetCachedSampleErrorElement().cloneNode(true);
  errorSpan.innerHTML = error.word;
  element.appendChild(errorSpan);
  element.innerHTML = leftText + element.innerHTML + rightText;
  this.UpdatePreviewElementScroll();
 },
 UpdatePreviewElementScroll: function() {
  var previewElement = this.GetPreviewTextElement();
  var sampleErrorElement = this.GetSampleErrorElement();
  var previewElementClientHeight = _aspxGetClearClientHeight(previewElement);
  var sampleErrorElementScrollTop = sampleErrorElement.offsetTop + sampleErrorElement.offsetHeight;
  var delta = sampleErrorElementScrollTop - previewElement.scrollTop;
  if (delta >= previewElementClientHeight || delta <=0)
   previewElement.scrollTop = sampleErrorElement.offsetTop - 10; 
 },
 PopulateSuggestionsListBox: function(error) {
  var listBox = this.GetSCFormListBox(this.GetSCForm());
  if(!listBox)
   return;
  listBox.BeginUpdate();
  listBox.ClearItems();
  if(error.suggestions.length > 0) {
   for(var i = 0; i < error.suggestions.length; i++)
    listBox.AddItem(error.suggestions[i]);
  }
  else {
   listBox.AddItem(this.spellChecker.noSuggestionsText);
  }
  listBox.EndUpdate();
 },
 SelectFirstSuggestion: function() {
  var listBox = this.GetSCFormListBox(this.GetSCForm());
  if(listBox.GetItemCount() > 0)
   listBox.SetSelectedIndex(0); 
 },
 ShowSpellCheckerFormCore: function() {
  this.GetPreviewTextElement().scrollTop = 0;
  this.StartProcessError();
 },
 ShowSpellCheckerForm: function() {
  this.BeforeShowSpellCheckerForm();
  if(this.errorCount > 0)
   this.ShowSpellCheckerFormCore();
  else
   this.FinishSpellChecking();
 },
 AddToDictionaryClick: function() {
  this.spellChecker.AddWord(this.currentError.word);
 },
 CloseSpellCheckForm: function() {
  this.GetSCForm().OnComplete(0, 0);
 }, 
 FindWord: function(wordArray, word) { 
  for(var i = 0; i < wordArray.length; i++)
   if(word == wordArray[i])
    return true;
  return false;
 },
 FindWordInChangeAllList: function(word) {
  return this.changeAllList[word] != null;
 },
 FinishSpellChecking: function() {
  this.spellChecker.OnFinishSpellChecking(true);
 },   
 StartProcessError: function() {
  this.currentError = this.GetNextError();
  if(this.currentError)
   this.ProcessNewError(); 
  else
   this.FinishSpellChecking();
 },
 BeforeShowSpellCheckerForm: function() {
  this.delta = 0;
  this.spellChecker.checkedText = this.spellChecker.checkingText;
  this.InitializeErrorArray();
 },
 ChangeClick: function() {
  var suggestion = this.GetSuggestion();
  this.ChangeCore(suggestion);  
  this.spellChecker.OnWordChanged();
  this.StartProcessError();
 },
 IgnoreClick: function() {
  this.StartProcessError();
 },
 IgnoreAllClick: function() {  
  this.ignoreAllList.push(this.currentError.word);
  this.StartProcessError();
 }, 
 ChangeAllClick: function() {
  this.changeAllList[this.currentError.word] = this.GetSuggestion();
  this.ChangeClick();
 },    
 ListBoxItemChanged: function(listBox) { 
  var suggestion = listBox.GetSelectedItem().text;
  var textBox = this.GetSCFormChangeTextBox();
  textBox.SetValue(suggestion);
 },
 SCListBoxItemDoubleClick: function() {
  if(this.currentError.suggestionCount > 0)
   this.ChangeClick();
 }, 
 TextBoxKeyPress: function(keyCode) {
  if (keyCode > 0 && keyCode != ASPxKey.Enter && keyCode != ASPxKey.Esc)
   this.SetChangeButtonsEnabled(true);
 }, 
 TextBoxKeyDown: function(keyCode) {
  if(keyCode == ASPxKey.Backspace || keyCode == ASPxKey.Delete)
   this.SetChangeButtonsEnabled(true); 
 },
 ChangeCore: function(suggestion) { 
  this.DoChangeWord(suggestion);
  if(suggestion)
   this.delta += suggestion.length - this.currentError.wordLength;
  else
   this.delta -= this.currentError.wordLength;
 }, 
 GetWord: function(startIndex, endIndex) {
  var text = this.spellChecker.checkedText;
  return text.substring(startIndex, endIndex);
 },
 GetText: function(tdElement) {
  var text = "";
  var textNodes = new Array();
  _aspxGetChildTextNodeCollection(tdElement, textNodes);
  for(var i = 0; i < textNodes.length; i++)
   text += textNodes[i].nodeValue;
  return text;
 }, 
 GetWordByError: function(error) {
  var startIndex = this.GetWordStartIndex(error);
  var finishIndex = this.GetWordFinishIndex(error);
  return this.GetWord(startIndex, finishIndex);
 }, 
 GetWordStartIndex: function(error) {
  return error.wordStart + this.delta;
 }, 
 GetWordFinishIndex: function(error) {
  return error.wordStart + error.wordLength + this.delta;
 },
 DoChangeWord: function(suggestion) {
  var startIndex = this.GetWordStartIndex(this.currentError);
  var finishIndex = this.GetWordFinishIndex(this.currentError);
  var text = this.spellChecker.checkedText;
  this.spellChecker.checkedText = _aspxInsertEx(text, suggestion, startIndex, finishIndex);
 },
 GetNextError: function() { 
  while(this.errors.length > 0) { 
   var error = this.errors.shift();
   var word = error.word;
   if(this.FindWordInChangeAllList(word)) { 
    this.currentError = error;
    this.ClearErrorSelection();
    this.ChangeCore(this.changeAllList[word]);
    continue;
   }
   if(!this.FindWord(this.ignoreAllList, word))
    return error;
  }
  return null;
 }, 
 GetSuggestion: function() {
  return this.GetSCFormChangeTextBox().GetText();
 },  
 AdjustFormButtons: function() {
  this.SetChangeButtonsEnabled(this.CanPerformChangeAction());
 },
 ClearErrorSelection: function() {
  var element = this.GetPreviewTextElement();   
  if(_aspxIsExists(element)) element.innerHTML = "";
 },
 PrepareTextBox: function(error) {
  var textBox = this.GetSCFormChangeTextBox();  
  if(error.suggestions.length == 0) {
   textBox.SetValue(error.word);
   textBox.Focus();
   textBox.SelectAll();
  }
  else {
   textBox.SetValue(error.suggestions[0]);
   textBox.Focus();
  }
 } 
});
ASPxSpellCheckerFormHandler.PreparePreviewText = function(text) {
 var regExp = new RegExp("\\r\\n|\\n|\\n\\v", "g");
 text = _aspxApplyReplacement(text, [ [ /</g, '&lt;' ], [ />/g, '&gt;' ] ]);
 text = text.replace(regExp, "<br/>");
 return text;
}
var __aspxSCTextFormattingElementTagNames = [ "B", "I", "U", "S" ,"STRONG", "SMALL", "BIG", "BASEFONT", "TT", "STRIKE"];
var __aspxSCTextFormattingElementTagNameHashTable = _aspxCreateHashTableFromArray(__aspxSCTextFormattingElementTagNames);
var __aspxSCBlockElementTagNames = [ "H1", "H2", "H3", "H4" ,"H5", "H6", "CENTER" ];
var __aspxSCBlockElementTagNamesHashTable = _aspxCreateHashTableFromArray(__aspxSCBlockElementTagNames);
var __aspxSCForbiddenElementTagNames = [ "OBJECT", "APPLET", "IMG", "MAP" ,"IFRAME", "BODY", "HEAD", "SCRIPT", "LINK" ];
var __aspxSCForbiddenElementTagNamesHashTable = _aspxCreateHashTableFromArray(__aspxSCForbiddenElementTagNames);
ASPxSpellCheckerHtmlFilter = {};
ASPxSpellCheckerHtmlFilter.PreparePreviewHTML = function(html) {
 var fakeElement = document.createElement("DIV");
 _aspxSetInnerHtml(fakeElement, html);
 ASPxSpellCheckerHtmlFilter.FilterElements(fakeElement);
 return fakeElement.innerHTML;
}
ASPxSpellCheckerHtmlFilter.FilterElements = function(parentNode) {
 for (var i = parentNode.childNodes.length - 1; i >= 0 ; i--)
  ASPxSpellCheckerHtmlFilter.FilterElements(parentNode.childNodes[i]);
 ASPxSpellCheckerHtmlFilter.CleanElement(parentNode);
}
ASPxSpellCheckerHtmlFilter.CleanElement = function(element) {
 if (element.nodeType == 1) {
  var tagName = element.tagName;
  if (ASPxSpellCheckerHtmlFilter.IsTextFormattingElementTagName(tagName))
   _aspxRemoveOuterTags(element);
  else if (ASPxSpellCheckerHtmlFilter.IsBlockElementTagName(tagName))
   _aspxReplaceTagName(element, "P");
  else if (ASPxSpellCheckerHtmlFilter.IsForbiddenElementTagName(tagName))
   _aspxRemoveElement(element);
  else {
   _aspxRemoveAllAttributes(element);
   _aspxRemoveAllStyles(element);
   if (ASPxSpellCheckerHtmlFilter.IsLinkElementTagName(tagName))
    _aspxSetAttribute(element, "href", "javascript:void('0')");
  }
 }
}
ASPxSpellCheckerHtmlFilter.IsTextFormattingElementTagName = function(tagName) {
 return _aspxIsExists(__aspxSCTextFormattingElementTagNameHashTable[tagName]);
}
ASPxSpellCheckerHtmlFilter.IsBlockElementTagName = function(tagName) {
 return _aspxIsExists(__aspxSCBlockElementTagNamesHashTable[tagName]);
}
ASPxSpellCheckerHtmlFilter.IsForbiddenElementTagName = function(tagName) {
 return _aspxIsExists(__aspxSCForbiddenElementTagNamesHashTable[tagName]);
}
ASPxSpellCheckerHtmlFilter.IsLinkElementTagName = function(tagName) {
 return tagName == "A";
}
ASPxContainerBrowser = _aspxCreateClass(null, {
 constructor: function() {
  this.currentEditor = null;
  this.nextEditor = null;
  this.isCurrentEditorFound = false;
 },
 BeforeFindNextEditor: function(currentEditor) { 
  this.nextEditor = null;
  this.isCurrentEditorFound = false;  
  this.currentEditor = currentEditor;
 },
 FindNextEditor: function(container, currentEditor) { 
  this.BeforeFindNextEditor(currentEditor);
  this.FindNextEditorCore(container);
  return this.nextEditor;
 },
 FindNextEditorCore: function(container) { 
  if(this.nextEditor != null)
   return;
  for(var i = 0; i < container.childNodes.length; i++) {
   var curNode = container.childNodes[i];
   if(ASPxEditorHelper.IsEditableEditNode(curNode))
    this.ProcessEditableEditNode(curNode);
   else
    this.FindNextEditorCore(curNode);
  }
 },
 ProcessEditableEditNode: function(editNode) {
  if(this.nextEditor != null)
   return;
  if(editNode == this.currentEditor) { 
   this.isCurrentEditorFound = true;
   return;
  }
  if(this.isCurrentEditorFound || !this.currentEditor) {
   this.nextEditor = editNode;
   return;
  }
 } 
});
ASPxSpellCheckerBaseEditorHelper = _aspxCreateClass(null, {
 constructor: function() {},
 GetText: function(editor) {
  return editor.value; 
 },
 SetText: function(editor, value) {
  editor.value = value;
 },
 IsEditable: function(editor) {
  return !editor.disabled && !editor.readOnly;
 }
});
ASPxSpellCheckerASPxEditorHelper = _aspxCreateClass(ASPxSpellCheckerBaseEditorHelper, {
 constructor: function() { 
  this.constructor.prototype.constructor.call(this);
 },
 GetText: function(editor) {
  return editor.GetValue(); 
 },
 SetText: function(editor, value) {
  if (_aspxIsExists(editor.SetText))
   editor.SetText(value);
  else
   editor.SetValue(value);
 },
 IsEditable: function(editor) {
  return editor.GetEnabled() && 
   ASPxSpellCheckerBaseEditorHelper.prototype.IsEditable(editor.GetInputElement());
 }
});
ASPxEditorHelper = _aspxCreateClass(null, {
 constructor: function() {
  this.standardEditorHelper = new ASPxSpellCheckerBaseEditorHelper();
  this.DXEditorHelper = new ASPxSpellCheckerASPxEditorHelper();
 },
 GetDXEditorByInput: function(inputElement) {
  var collection = aspxGetControlCollection();
  for(var name in collection.elements) {
   var element = collection.elements[name];
   if(ASPxIdent.IsASPxClientEdit(element) && element.GetInputElement() == inputElement)
    return element;
  }
  return null;
 },
 SetText: function(inputElement, value) {
  if(this.IsDXEditor(inputElement)) {
   this.GetDXEditorHelper().SetText(this.GetDXEditorByInput(inputElement), value);
   this.GetDXEditorByInput(inputElement).RaiseTextChanged();
  }
  else
   this.GetStandardEditorHelper().SetText(inputElement, value);
 },
 GetText: function(inputElement) {
  if(this.IsDXEditor(inputElement))
   return this.GetDXEditorHelper().GetText(this.GetDXEditorByInput(inputElement));
  else
   return this.GetStandardEditorHelper().GetText(inputElement);
 },
 IsDXEditor: function(inputElement) {
  return this.GetDXEditorByInput(inputElement) != null; 
 },
 IsEditable: function(inputElement) {
  if(this.IsDXEditor(inputElement))
   return this.GetDXEditorHelper().IsEditable(this.GetDXEditorByInput(inputElement));
  else
   return this.GetStandardEditorHelper().IsEditable(inputElement);
 },
 GetStandardEditorHelper: function() {
  return this.standardEditorHelper;
 },
 GetDXEditorHelper: function() {
  return this.DXEditorHelper;
 }
});
ASPxEditorHelper.IsEditableEditNode = function(element) {
 if(!_aspxIsExists(element.tagName))
  return false;
 var tagName = element.tagName;
 if((tagName == "INPUT" && element.type == "text") || tagName == "TEXTAREA")  
  return ASPxEditorHelper.CanEditNode(element);
 return false;
}
ASPxEditorHelper.CanEditNode = function(element) {
 return !element.readOnly && !element.disabled;
}
function aspxSCIgnore(s, e) {
 __aspxActiveSpellChecker.Ignore();
}
function aspxSCIgnoreAll(s, e) {
 __aspxActiveSpellChecker.IgnoreAll();
}
function aspxSCAddToDictionary(s, e) {
 __aspxActiveSpellChecker.AddToDictionary();
}
function aspxSCChange(s, e) {
 __aspxActiveSpellChecker.Change();
}
function aspxSCChangeAll(s, e) {
 __aspxActiveSpellChecker.ChangeAll();
}
function aspxSCShowOptionsForm(s, e) {
 __aspxActiveSpellChecker.ShowOptionsForm();
}
function aspxSCListBoxItemChanged(s, e) {
 __aspxActiveSpellChecker.ListBoxItemChanged(s, e);
}
function aspxSCTextBoxKeyPress(s, e) {
 if (__aspxActiveSpellChecker != null)
  __aspxActiveSpellChecker.TextBoxKeyPress(e.htmlEvent);
}
function aspxSCTextBoxKeyDown(s, e) { 
 if (__aspxActiveSpellChecker != null)
  __aspxActiveSpellChecker.TextBoxKeyDown(e.htmlEvent);
}
function aspxSCListBoxItemDoubleClick(s, e) { 
 if (__aspxActiveSpellChecker != null)
  __aspxActiveSpellChecker.SCListBoxItemDoubleClick();
}
ASPxClientSpellChecker.prototype.RaiseBeforeCheck = function(controlId) {
 if(!this.BeforeCheck.IsEmpty()) {
  var args = new ASPxClientSpellCheckerBeforeCheckEventArgs(controlId);
  this.BeforeCheck.FireEvent(this, args);
  return !args.cancel;
 } 
 return true;
}
ASPxClientSpellCheckerBeforeCheckEventArgs = _aspxCreateClass(ASPxClientCancelEventArgs, {
 constructor: function(controlId){
  this.constructor.prototype.constructor.call(this, false);
  this.controlId = controlId;
 }
});
ASPxClientSpellChecker.prototype.RaiseCheckCompleteFormShowing = function() {
 if(!this.CheckCompleteFormShowing.IsEmpty()) {
  var args = new ASPxClientCancelEventArgs();
  this.CheckCompleteFormShowing.FireEvent(this, args);
  return !args.cancel;
 }
 return true;
}
ASPxClientSpellChecker.prototype.RaiseAfterCheck = function(controlId, checkedText) {
 if(!this.AfterCheck.IsEmpty()) {
  var args = new ASPxClientSpellCheckerAfterCheckEventArgs(controlId, checkedText);
  this.AfterCheck.FireEvent(this, args);
 }
}
ASPxClientSpellChecker.prototype.RaiseWordChanged = function(controlId, checkedText) {
 if(!this.WordChanged.IsEmpty()) {
  var args = new ASPxClientSpellCheckerAfterCheckEventArgs(controlId, checkedText);
  this.WordChanged.FireEvent(this, args);
 }
}
ASPxClientSpellCheckerAfterCheckEventArgs = _aspxCreateClass(ASPxClientEventArgs, {
 constructor: function(controlId, checkedText){
  this.constructor.prototype.constructor.call(this, null);
  this.controlId = controlId;
  this.checkedText = checkedText;
 }
});

SCDialog = _aspxCreateClass(ASPxDialog, {
 constructor: function(name, spellChecker) {
  this.constructor.prototype.constructor.call(this, name);
  this.initExecuting = false;
  this.spellChecker = spellChecker;
  this.ownerControl = spellChecker;
 },
 ShowLoadingPanelInDialogPopup: function() {
 },
 Show: function(popupElement) {
  ASPxDialog.PushDialogToCollection(this.ownerControl, this);
  this.InitializePopupEvents();
  this.GetDialogPopup().SetHeaderText(this.GetDialogCaptionText());
  this.GetDialogPopup().ShowAtElement(popupElement);
 },
 InitializePopupEvents: function() {
  func = _aspxCreateEventHandlerFunction("aspxOnSCDialogClose", this.spellChecker, false);
  this.GetDialogPopup().CloseUp.AddHandler(func);
 },
 SetDialogContent: function(dialogContent) {
  var popupControl = this.GetDialogPopup();
  popupControl.SetContentHtml(dialogContent);
  this.AddDialogContentToHash(this.name, dialogContent);
  this.GetDialogPopup().UpdatePosition();
 },
 HideDialog: function() {
  aspxSCDialogComplete(false);
 }, 
 GetDialogPopup: function() {
  return this.spellChecker.GetDialogPopupControl(this.name); 
 },
 IsVisible: function(){
  return this.GetDialogPopup().IsVisible();
 }
});
SpellCheckForm = _aspxCreateClass(SCDialog , {
 DoCustomAction: function(result) {
 },
 GetDialogCaptionText: function() {
  return this.spellChecker.spellCheckFormCaption;
 },
 SendCallbackForDialogContent: function() {
 },
 SetFocusInField: function() {
  _aspxSetFocusToTextEditWithDelay(_dxeSCTxtChangeTo.name);
 },
 HideLoadingPanelOverDialogPopup: function() {
  SCDialog.prototype.HideLoadingPanelOverDialogPopup.call(this);
  if (this.spellChecker.formHandler.GetSCFormChangeButton())
  _dxeSCBtnChange.SetEnabled(true);
 },
 ShowLoadingPanelOverDialogPopup: function() {
  SCDialog.prototype.ShowLoadingPanelOverDialogPopup.call(this);
  _dxeSCBtnChange.SetEnabled(false);
 }
});
SpellCheckOptionsForm = _aspxCreateClass(SCDialog , { 
 DoCustomAction: function(result, params) {
 },   
 GetDialogCaptionText: function() {
  return this.spellChecker.optionsFormCaption;
 },
 SetFocusInField: function() {
 }
});
function aspxSCDialogComplete(result) {
 if(_aspxIsExists(__aspxActiveSpellChecker))
  __aspxActiveSpellChecker.HideDialog(result);
}
function aspxOnSCDialogClose(spellChecker) {
 aspxSCDialogComplete(false);
}
ASPxClientTabControlBase = _aspxCreateClass(ASPxClientControl, {
 constructor: function(name){
  this.constructor.prototype.constructor.call(this, name);
  this.activeTabIndex = 0;
  this.callbackCount = 0;
  this.cookieName = "";
  this.emptyHeight = false;
  this.emptyWidth = false;
  this.tabsHeight = null;
  this.tabAlign = "Left";
  this.tabPosition = "Top";
  this.tabCount = 0;
  this.tabs = [];
  this.tabsContentRequest = [];
  this.handleClickOnWholeTab = true;
  this.TabClick = new ASPxClientEvent();
  this.ActiveTabChanged = new ASPxClientEvent();
  this.ActiveTabChanging = new ASPxClientEvent();
  this.InitializeOnResize();
 },
 Initialize: function(){
  this.constructor.prototype.Initialize.call(this);
  this.CorrrectCellsBounds(true); 
 },
 InlineInitialize: function(){
  this.InitializeEnabledAndVisible();
  this.CorrrectCellsBounds(true);
 },
 InitializeEnabledAndVisible: function(){
  for(var i = 0; i < this.tabs.length; i++){
   this.SetTabVisible(i, this.tabs[i].clientVisible, true);
   this.SetTabEnabled(i, this.tabs[i].clientEnabled, true);
  } 
 },
 InitializeCallBackData: function(){
  var element = this.GetContentElement(this.activeTabIndex);
  if(element != null) element.loaded = true;
 },
 InitializeOnResize: function(){
  var element = this.GetMainElement();
  if(_aspxIsExists(element))
   element.onresize = new Function("aspxTCResize(\"" + this.name + "\");"); 
 },
 GetTabsCell: function(){
  return this.GetChild("_TC");
 },
 GetTabElement: function(index, active){
  return this.GetChild("_" + (active ? "A" : "") + "T" + index);
 },
 GetContentsCell: function(){
  return this.GetChild("_CC");
 },
 GetContentElement: function(index){
  return this.GetChild("_C" + index);
 },
 GetSeparatorElement: function(index){
  return this.GetChild("_T" + index + "S");
 },
 GetLeftAlignCellElement: function(){
  return this.GetChild("_LAC");
 },
 GetRightAlignCellElement: function(){
  return this.GetChild("_RAC");
 },
 GetTabLayoutElement: function(element){
  if(!this.IsTopBottomTabPosition())
   return element.parentNode;
  return element;
 },
 GetActiveTabIndexInputElement: function(index){
  return _aspxGetElementById(this.name + "ATI");
 },
 IsTopBottomTabPosition: function(){
  return (this.tabPosition == "Top" || this.tabPosition == "Bottom");
 },
 CorrrectCellsBounds: function(initialization){
  if(this.isInitialized || initialization)
   window.setTimeout("aspxTCCorrectBounds(\"" + this.name + "\");", 1);
 },
 CorrrectCellsBoundsTimer: function(){
  var mainElement = this.GetMainElement();
  if(mainElement == null || mainElement.offsetWidth == 0 || mainElement.offsetHeight == 0) return;
  mainElement.corrected = true;
     if(__aspxIE && !this.emptyHeight && this.tabAlign != "Justify"){
   if(this.IsTopBottomTabPosition())
    this.CorrectContentCellHeight();
   else
    this.CorrectAlignCellsHeight();
  }
     if((__aspxFirefox || __aspxWebKitFamily) && !this.emptyHeight && this.tabAlign == "Center"){
      if(!this.IsTopBottomTabPosition())
    this.CorrectAlignCellsHeight();
  }
  if((this.emptyHeight || __aspxOpera) && !this.IsTopBottomTabPosition()){
   this.CorrectTabsCellHeight();
   if(__aspxIE)
    this.CorrectAlignCellsHeight();
  }
  if(this.emptyWidth && this.IsTopBottomTabPosition() && this.tabAlign != "Justify")
   this.CorrectTabsCellWidth();
  this.CorrectOperaTabsCellAlignment();
  this.CorrectOperaTabCellsAlignment();
 },
 CorrectTabsCellHeight: function(){
  var mainElement = this.GetMainElement();
  var tabsCell = this.GetTabsCell();
  if(mainElement != null && tabsCell){
   var leftAlignCell = this.GetLeftAlignCellElement();
   if(leftAlignCell != null)
    leftAlignCell.style.height = "auto";
   var rightAlignCell = this.GetRightAlignCellElement();
   if(rightAlignCell != null)
    rightAlignCell.style.height = "auto";
   var tabsTable = tabsCell.firstChild; 
   var tabsTableHeightCorrectionRequired = (__aspxChrome || __aspxSafari && __aspxBrowserVersion >= 4 ||
    __aspxIE && __aspxBrowserVersion >= 8 || __aspxOpera) && !this.IsTopBottomTabPosition();
   if(tabsTableHeightCorrectionRequired)
    tabsTable.style.height = "auto"; 
   tabsCell.style.height = "auto";
   tabsCell.style.height = mainElement.offsetHeight + "px";
   if(tabsTableHeightCorrectionRequired)
    tabsTable.style.height = _aspxGetClearClientHeight(tabsCell) + "px";
   if(leftAlignCell != null && rightAlignCell == null)
    leftAlignCell.style.height = "100%";
   if(leftAlignCell == null && rightAlignCell != null)
    rightAlignCell.style.height = "100%";
   if(leftAlignCell != null && rightAlignCell != null){
    leftAlignCell.style.height = "50%";
    rightAlignCell.style.height = "50%";
   }
  }
 },
 CorrectTabsCellWidth: function(){
  var mainElement = this.GetMainElement();
  var tabsCell = this.GetTabsCell();
  if(mainElement != null && tabsCell){
   var leftAlignCell = this.GetLeftAlignCellElement();
   if(leftAlignCell != null)
    leftAlignCell.style.width = "auto";
   var rightAlignCell = this.GetRightAlignCellElement();
   if(rightAlignCell != null)
    rightAlignCell.style.width = "auto";
   tabsCell.style.width = "auto";
   tabsCell.style.width = mainElement.clientWidth;
   if(leftAlignCell != null && rightAlignCell == null)
    leftAlignCell.style.width = "100%";
   if(leftAlignCell == null && rightAlignCell != null)
    rightAlignCell.style.width = "100%";
   if(leftAlignCell != null && rightAlignCell != null){
    leftAlignCell.style.width = "50%";
    rightAlignCell.style.width = "50%";
   }
  }
 },
 CorrectContentCellHeight: function(){
  var mainElement = this.GetMainElement();
  var tabsCell = this.GetTabsCell();
  var contentsCell = this.GetContentsCell();
  if(mainElement != null && tabsCell != null && contentsCell != null){
   if(this.tabsHeight == null)
    this.tabsHeight = tabsCell.clientHeight;
   tabsCell.style.height = this.tabsHeight + "px";
   contentsCell.style.height = "auto";
   contentsCell.style.height = (mainElement.clientHeight - this.tabsHeight) + "px";
  }
 },
 CorrectAlignCellsHeight: function(){
  var mainElement = this.GetMainElement();
  var tabsCell = this.GetTabsCell();
  if(mainElement != null && tabsCell != null){
   var leftAlignCell = this.GetLeftAlignCellElement();
   var rightAlignCell = this.GetRightAlignCellElement();
   var tabsTable = tabsCell.firstChild;
   if(tabsTable != null){
    if(leftAlignCell != null || rightAlignCell != null){
     var tabsHeight = 0;
     for(var i = 0; i < tabsTable.rows.length; i ++){
      var cell = tabsTable.rows[i].cells[0];
      if(cell != leftAlignCell && cell != rightAlignCell)
       tabsHeight += cell.offsetHeight;
     }
     if(leftAlignCell != null)
      leftAlignCell.style.height = "auto";
     if(rightAlignCell != null)
      rightAlignCell.style.height = "auto";
     var correctionHeight = mainElement.clientHeight - tabsHeight;
     if(leftAlignCell != null)
      leftAlignCell.style.height = ((rightAlignCell != null) ? Math.round(correctionHeight / 2) : correctionHeight) + "px";
     if(rightAlignCell != null)
      rightAlignCell.style.height = ((leftAlignCell != null) ? Math.round(correctionHeight / 2) : correctionHeight) + "px";
    }
   }
  }
 },
 CorrectOperaTabsCellAlignment: function(){ 
  if(!__aspxOpera || this.tabAlign != "Justify") return;
  if(!this.IsTopBottomTabPosition() && !this.emptyHeight) return;
  var element = this.GetTabsCell();
  _aspxSetElementDisplay(element, false);
  _aspxSetElementDisplay(element, true);
 },
 CorrectOperaTabCellsAlignment: function(){ 
  if(!__aspxOpera || !this.IsTopBottomTabPosition()) return;
  var element = this.GetLeftAlignCellElement();
  if(element != null){ 
   _aspxSetElementDisplay(element, false);
   _aspxSetElementDisplay(element, true);
  }
  element = this.GetRightAlignCellElement();
  if(element != null){ 
   _aspxSetElementDisplay(element, false);
   _aspxSetElementDisplay(element, true);
  }
  for(var i = 0; i < this.tabCount; i ++){
   if(this.activeTabIndex == i) continue;
   element = this.GetTabElement(i, false);
   if(element != null){
    _aspxSetElementDisplay(element, false);
    _aspxSetElementDisplay(element, true);
   }
  }
 },
 FixControlSize: function(){
  this.FixElementSize(this.GetMainElement());
  this.FixElementSize(this.GetContentsCell());
 },
 UnfixControlSize: function(){
  this.UnfixElementSize(this.GetMainElement());
  this.UnfixElementSize(this.GetContentsCell());
 },
 FixElementSize: function(element){
  if(element == null) return;
  _aspxChangeStyleAttribute(element, "width", (__aspxIE ? element.clientWidth : element.offsetWidth) + "px");
  _aspxChangeStyleAttribute(element, "height", (__aspxIE ? element.clientHeight : element.offsetHeight) + "px");
 },
 UnfixElementSize: function(element){
  if(element == null) return;
  _aspxRestoreStyleAttribute(element, "width");
  _aspxRestoreStyleAttribute(element, "height");
 },
 AdjustSize: function(){
  this.CorrrectCellsBounds(false);
 },
 ChangeTabState: function(index, active){
  var element = this.GetTabElement(index, true);
  if(element != null) _aspxSetElementDisplay(this.GetTabLayoutElement(element), active);
  element = this.GetTabElement(index, false);
  if(element != null) _aspxSetElementDisplay(this.GetTabLayoutElement(element), !active);
  element = this.GetContentElement(index);
  if(element != null) _aspxSetElementDisplay(element, active);
 },
 ChangeActiveTab: function(index, hasLink){
  var processingMode = this.RaiseActiveTabChanging(index);
  if(processingMode == "Client" || processingMode == "ClientWithReload"){
   var element = this.GetContentElement(index);
   if(_aspxIsFunction(this.callBack) && element != null && (!element.loaded || processingMode == "ClientWithReload")){
    if(this.callbackCount == 0)
     this.FixControlSize();
    this.DoChangeActiveTab(index);
    if(!element.loading){
     this.callbackCount++;
     element.loading = true;
     this.CreateLoadingPanelWithAbsolutePosition(element, this.GetContentsCell());
     this.CreateCallback(index);
     _aspxArrayPush(this.tabsContentRequest, index);
    }
    this.CorrectOperaTabCellsAlignment();
   }
   else{
    this.DoChangeActiveTab(index);
    this.CorrrectCellsBounds(false);
    this.CorrectOperaTabCellsAlignment();
    var activeContentElement = this.GetContentElement(this.activeTabIndex);
    var collection = aspxGetControlCollection();
    collection.AdjustControls(activeContentElement, __aspxCheckSizeCorrectedFlag);
    this.RaiseActiveTabChanged(index);
   }
  }
  else if(processingMode == "Server"  && !hasLink)
   this.SendPostBack("ACTIVATE:" + index);
 },
 DoChangeActiveTab: function(index){
  if(__aspxFirefox && __aspxBrowserVersion >= 3) { 
   var contentsCell = this.GetContentsCell();
   var isContentsCellExists = _aspxIsExistsElement(contentsCell);
   if(isContentsCellExists)
    _aspxSetElementVisibility(contentsCell, false);
   this.ChangeTabState(index, true);
   this.ChangeTabState(this.activeTabIndex, false);
   this.activeTabIndex = index;
   if(isContentsCellExists)
    _aspxSetElementVisibility(contentsCell, true);
  } else {
   this.ChangeTabState(this.activeTabIndex, false);
   this.activeTabIndex = index;
   this.ChangeTabState(this.activeTabIndex, true);
  }
  this.UpdateActiveTabIndexInputElement();
  this.UpdateActiveTabIndexCookie();
 },
 SetActiveTabIndexInternal: function(index, hasLink){
  if(this.activeTabIndex == index) return;
  var lastScrollYPos = _aspxGetDocumentScrollTop();
  this.ChangeActiveTab(index, hasLink);
  var scrollY = _aspxGetDocumentScrollTop();
  if (lastScrollYPos != scrollY)
   window.scrollTo(_aspxGetDocumentScrollLeft(), lastScrollYPos);
  this.UpdateHoverState(index);   
 },
 UpdateActiveTabIndexCookie: function(){
  if(this.cookieName == "") return;
  _aspxDelCookie(this.cookieName);
  _aspxSetCookie(this.cookieName, this.activeTabIndex);
 },
 UpdateActiveTabIndexInputElement: function(){
  var element = this.GetActiveTabIndexInputElement();
  if(element != null) element.value = this.activeTabIndex;
 },
 UpdateHoverState: function(index){
  var element = this.GetTabElement(index, true);
  if(element != null) aspxGetStateController().SetCurrentHoverElementBySrcElement(element);
 },
 OnResize: function(){
  var mainElement = this.GetMainElement();
  if(mainElement != null && !_aspxIsExists(mainElement.corrected))
   this.CorrrectCellsBounds(false);
 },
 OnTabClick: function(evt, index){   
  var processingMode = this.RaiseTabClick(index, evt);
  var clickedLinkElement = _aspxGetParentByTagName(_aspxGetEventSource(evt), "A");
  var isLinkClicked = (clickedLinkElement != null && clickedLinkElement.href != __aspxAccessibilityEmptyUrl);
  var element = this.GetTabElement(index, false);
  var linkElement = (element != null) ? _aspxGetChildByTagName(element, "A", 0) : null;
  if(linkElement != null && linkElement.href == __aspxAccessibilityEmptyUrl)
   linkElement = null;
  if (processingMode != "Handled"){
   var hasLink = isLinkClicked || linkElement != null;
   if (processingMode == "Server" && !hasLink)
    this.SendPostBack("CLICK:" + index);
   else
    this.SetActiveTabIndexInternal(index, hasLink);
   if(this.handleClickOnWholeTab && !isLinkClicked && linkElement != null) 
    _aspxNavigateUrl(linkElement.href, linkElement.target);
  }
 },
 OnCallbackInternal: function(html, index, isError){
  this.SetCallbackContent(html, index, isError);
  if(!isError)
   this.RaiseActiveTabChanged(index);
  _aspxArrayRemoveAt(this.tabsContentRequest, 0);
 },
 OnCallback: function(result){
  this.OnCallbackInternal(result.html, result.index, false);
 },
 OnCallbackError: function(result, data){
  this.OnCallbackInternal(result, data, true);
 },
 OnCallbackGeneralError: function(result){
  var callbackTabIndex = (this.tabsContentRequest.length > 0) ? this.tabsContentRequest[0] : this.activeTabIndex;
  this.SetCallbackContent(result, callbackTabIndex, true);
  _aspxArrayRemoveAt(this.tabsContentRequest, 0);
 },
 SetCallbackContent: function(html, index, isError) {
  var element = this.GetContentElement(index);
  if(element != null) {
   if(!isError)
    element.loaded = true;
   element.loading = false;
   _aspxSetInnerHtml(element, html);
   this.callbackCount--;
   if(this.callbackCount == 0){
    this.UnfixControlSize();
    this.CorrrectCellsBounds(false);
    this.CorrectOperaTabCellsAlignment();
   }
  }
 },
 CreateTabs: function(tabsProperties){
  for(var i = 0; i < tabsProperties.length; i ++){
   var tabName = _aspxIsExists(tabsProperties[i][0]) ? tabsProperties[i][0] : "";
   var tab = new ASPxClientTab(this, i, tabName);
   if(_aspxIsExists(tabsProperties[i][1]))
    tab.enabled = tabsProperties[i][1];
   if(_aspxIsExists(tabsProperties[i][2]))    
    tab.clientEnabled = tabsProperties[i][2];
   if(_aspxIsExists(tabsProperties[i][3]))
    tab.visible = tabsProperties[i][3];
   if(_aspxIsExists(tabsProperties[i][4]))
    tab.clientVisible = tabsProperties[i][4];
   _aspxArrayPush(this.tabs, tab);
  }
 },
 RaiseTabClick: function(index, htmlEvent){
  var processingMode = this.autoPostBack || this.IsServerEventAssigned("TabClick") ? "Server" : "Client";
  if(!this.TabClick.IsEmpty()){   
   var htmlElement = this.GetTabElement(index, this.activeTabIndex == index);
   var args = new ASPxClientTabControlTabClickEventArgs(processingMode == "Server", this.GetTab(index), htmlElement, htmlEvent);
   this.TabClick.FireEvent(this, args);
   if(args.cancel)
    processingMode = "Handled";
   else 
    processingMode = args.processOnServer ? "Server" : "Client";   
  }
  return processingMode;
 },
 RaiseActiveTabChanged: function(index){
  if(!this.ActiveTabChanged.IsEmpty()){
   var args = new ASPxClientTabControlTabEventArgs(this.GetTab(index));
   this.ActiveTabChanged.FireEvent(this, args);
  }
 },
 RaiseActiveTabChanging: function(index){ 
  var processingMode = this.autoPostBack ? "Server" : "Client";
  if(!this.ActiveTabChanging.IsEmpty()){
   var args = new ASPxClientTabControlTabCancelEventArgs(processingMode == "Server", this.GetTab(index));
   this.ActiveTabChanging.FireEvent(this, args);
   if(args.cancel)
    processingMode = "Handled";
   else if(args.processOnServer)
    processingMode = "Server";
   else
    processingMode = args.reloadContentOnCallback ? "ClientWithReload" : "Client";
  }
  return processingMode;
 },
 GetActiveTab: function(){
  return (this.activeTabIndex > -1) ? this.GetTab(this.activeTabIndex) : null;
 },
 SetActiveTab: function(tab){
  if(this.IsTabVisible(tab.index))
   this.SetActiveTabIndexInternal(tab.index, false);
 },
 GetTabCount: function(){
  return this.tabs.length;
 },
 GetTab: function(index){
  return (0 <= index && index < this.tabs.length) ? this.tabs[index] : null;
 },
 GetTabByName: function(name){
  for(var i = 0; i < this.tabs.length; i ++)
   if(this.tabs[i].name == name) return this.tabs[i];
  return null;
 },
 IsTabEnabled: function(index){
  return this.tabs[index].GetEnabled();
 },
 SetTabEnabled: function(index, enabled, initialization){
  if(!this.tabs[index].enabled) return;
  if(!initialization || !enabled)
   this.ChangeTabEnabledStateItems(index, enabled);
  this.ChangeTabEnabledAttributes(index, enabled);
 },
 ChangeTabEnabledAttributes: function(index, enabled){
  if(enabled){
   this.ChangeTabElementsEnabledAttributes(index, _aspxRestoreAttribute, _aspxRestoreStyleAttribute);
   if(!this.IsTabEnabled(this.activeTabIndex) && this.IsTabVisible(index))
    this.SetActiveTabIndexInternal(index, false);
   }
  else{
   if(this.activeTabIndex == index){
    for(var i = 0; i < this.GetTabCount(); i ++){
     if(this.IsTabVisible(i) && this.IsTabEnabled(i) && i != index){
      this.SetActiveTabIndexInternal(i, false);
      break;
     }
    }
   }
   this.ChangeTabElementsEnabledAttributes(index, _aspxResetAttribute, _aspxResetStyleAttribute);
  }
 },
 ChangeTabElementsEnabledAttributes: function(index, method, styleMethod){
  var element = this.GetTabElement(index, false);
  if(_aspxIsExists(element)){
   method(element, "onclick");
   styleMethod(element, "cursor");
      var link = this.GetInternalHyperlinkElement(element, 0);
      if(link != null){
       method(link, "href");
       styleMethod(link, "cursor");
   }
      link = this.GetInternalHyperlinkElement(element, 1);
      if(link != null){
       method(link, "href");
       styleMethod(link, "cursor");
   }
  }
  var activeElement = this.GetTabElement(index, true);
  if(_aspxIsExists(activeElement)){
   method(activeElement, "onclick");
   styleMethod(activeElement, "cursor");
  }
 },
 ChangeTabEnabledStateItems: function(index, enabled){
  var element = this.GetTabElement(index, false);
  if(element != null)
   aspxGetStateController().SetElementEnabled(element, enabled);
  var activeElement = this.GetTabElement(index, true);
  if(activeElement != null)
   aspxGetStateController().SetElementEnabled(activeElement, enabled);
 }, 
 GetTabTextCell: function(index, active){
  return this.GetChild("_" + (active ? "A" : "") + "T"  + index + "T");
 },
 GetTabImageCell: function(index, active){
  return this.GetChild("_" + (active ? "A" : "") + "T"  + index + "I");
 },
 GetTabImageUrl: function(index, active){
  var element = this.GetTabImageCell(index, active);
  if(element != null){
   var img = _aspxGetChildByTagName(element, "IMG", 0);
   if(img != null)
    return img.src;
  }
  return "";
 },
 SetTabImageUrl: function(index, active, url){
  var element = this.GetTabImageCell(index, active);
  if(element != null){
   var img = _aspxGetChildByTagName(element, "IMG", 0);
   if(img != null)
    img.src = url;
  }
 },
 GetTabNavigateUrl: function(index){
  var element = this.GetTabTextCell(index, false);
  if(element != null){
   var link = _aspxGetChildByTagName(element, "A", 0);
   if(link != null)
    return link.href;
  }
  element = this.GetTabImageCell(index, false);
  if(element != null){
   var link = _aspxGetChildByTagName(element, "A", 0);
   if(link != null)
    return link.href;
  }
  return "";
 },
 SetTabNavigateUrl: function(index, url){
  var element = this.GetTabTextCell(index, false);
  if(element != null){
   var link = _aspxGetChildByTagName(element, "A", 0);
   if(link != null)
    link.href = url;
  }
  var element = this.GetTabImageCell(index, false);
  if(element != null){
   var link = _aspxGetChildByTagName(element, "A", 0);
   if(link != null)
    link.href = url;
  }
 },
 GetTabText: function(index){
  var element = this.GetTabTextCell(index, false);
  if(element != null){
   var link = this.GetInternalHyperlinkElement(element, 0);
   if(link != null)
    return link.innerHTML;
   else
    return element.innerHTML;
  }
  return "";
 },
 SetTabText: function(index, text){
  var element = this.GetTabTextCell(index, false);
  if(element != null){
   var link = this.GetInternalHyperlinkElement(element, 0);
   if(link != null)
    link.innerHTML = text;
   else
    element.innerHTML = text;
  }
  element = this.GetTabTextCell(index, true);
  if(element != null){
   var link = this.GetInternalHyperlinkElement(element, 0);
   if(link != null)
    link.innerHTML = text;
   else
    element.innerHTML = text;
  }
 },
 IsTabVisible: function(index){
  return this.tabs[index].GetVisible();
 },
 SetTabVisible: function(index, visible, initialization){
  if(!this.tabs[index].visible) return; 
  if(visible && initialization) return;
  var element = this.GetTabElement(index, false);
  if(element != null) element = this.GetTabLayoutElement(element);
  var activeElement = this.GetTabElement(index, true);
  if(activeElement != null) activeElement = this.GetTabLayoutElement(activeElement);
  var contentElement = this.GetContentElement(index);
  if(!visible){
   if(this.activeTabIndex == index){
    for(var i = 0; i < this.GetTabCount(); i ++){
     if(this.IsTabVisible(i) && this.IsTabEnabled(i) && i != index){
      this.SetActiveTabIndexInternal(i, false);
      break;
     }
    }
    for(var i = 0; i < this.GetTabCount(); i ++){
     if(this.IsTabVisible(i) && i != index){
      this.SetActiveTabIndexInternal(i, false);
      break;
     }
    }
    if(this.activeTabIndex == index){
     this.activeTabIndex = -1;
     _aspxSetElementDisplay(this.GetMainElement(), false);
    }
   }
   if(element != null)
    _aspxSetElementDisplay(element, false);
   if(activeElement != null)
    _aspxSetElementDisplay(activeElement, false);
   if(contentElement != null)
    _aspxSetElementDisplay(contentElement, false);
  }
  else{
   if(element != null)
    _aspxSetElementDisplay(element, this.activeTabIndex != index);
   if(activeElement != null)
    _aspxSetElementDisplay(activeElement, this.activeTabIndex == index);
   if(contentElement != null)
    _aspxSetElementDisplay(contentElement, this.activeTabIndex == index);
   if(this.activeTabIndex == -1){
    _aspxSetElementDisplay(this.GetMainElement(), true);
    this.SetActiveTabIndexInternal(index, false);
   }
   else if(!this.IsTabEnabled(this.activeTabIndex) && this.IsTabEnabled(index))
    this.SetActiveTabIndexInternal(index, false);
  }
  this.SetSeparatorsVisiblility();
  this.CorrrectCellsBounds(false);
 },
 SetSeparatorsVisiblility: function(){
  for(var i = 0; i < this.tabs.length; i++){
   var separatorVisible = this.tabs[i].GetVisible() && this.HasNextVisibleTabs(i);
   var separatorElement = this.GetSeparatorElement(i);
   if(separatorElement != null) {
    separatorElement = this.GetTabLayoutElement(separatorElement);
    _aspxSetElementDisplay(separatorElement, separatorVisible);
   }
  }
 },
 HasNextVisibleTabs: function(index){
  for(var i = index + 1; i < this.tabs.length; i++){
   if(this.tabs[i].GetVisible())
    return true;
  }
  return false;
 }
});
ASPxClientTabControl = _aspxCreateClass(ASPxClientTabControlBase, {
});
ASPxClientPageControl = _aspxCreateClass(ASPxClientTabControlBase, {
 constructor: function(name){
  this.constructor.prototype.constructor.call(this, name);
  this.handleClickOnWholeTab = false;
 },
 GetTabContentHTML: function(tab){
  var element = this.GetContentElement(tab.index);
  return (element != null) ? element.innerHTML : "";
 },
 SetTabContentHTML: function(tab, html){
  var element = this.GetContentElement(tab.index);
  if(element != null) {
   _aspxSetInnerHtml(element, html);
   this.CorrrectCellsBounds(false);
  }
 }
});
ASPxClientTab = _aspxCreateClass(null, {
 constructor: function(tabControl, index, name){
  this.tabControl = tabControl;
  this.index = index;
  this.name = name;
  this.enabled = true;
  this.clientEnabled = true;
  this.visible = true;
  this.clientVisible = true;
 },
 GetEnabled: function(){
  return this.enabled && this.clientEnabled;
 },
 SetEnabled: function(value){
  if (this.clientEnabled != value) {
   this.clientEnabled = value;
   this.tabControl.SetTabEnabled(this.index, value, false);
  }
 },
 GetImageUrl: function(active){
  if(!_aspxIsExists(active)) active = false; 
  return this.tabControl.GetTabImageUrl(this.index, active);
 },
 SetImageUrl: function(value, active){
  if(!_aspxIsExists(active)) active = false; 
  this.tabControl.SetTabImageUrl(this.index, active, value);
 },
 GetActiveImageUrl: function(){
  return this.tabControl.GetTabImageUrl(this.index, true);
 },
 SetActiveImageUrl: function(value){
  this.tabControl.SetTabImageUrl(this.index, true, value);
 },
 GetNavigateUrl: function(){
  return this.tabControl.GetTabNavigateUrl(this.index);
 },
 SetNavigateUrl: function(value){
  this.tabControl.SetTabNavigateUrl(this.index, value);
 },
 GetText: function(){
  return this.tabControl.GetTabText(this.index);
 },
 SetText: function(value){
  this.tabControl.SetTabText(this.index, value);
 },
 GetVisible: function(){
  return this.visible && this.clientVisible;
 },
 SetVisible: function(value){
  if (this.clientVisible != value) {
   this.clientVisible = value;
   this.tabControl.SetTabVisible(this.index, value, false);
  }
 } 
});
ASPxClientTabControlTabEventArgs = _aspxCreateClass(ASPxClientEventArgs, {
 constructor: function(tab, htmlElement, htmlEvent){
  this.constructor.prototype.constructor.call(this);
  this.tab = tab;
 }
});
ASPxClientTabControlTabCancelEventArgs = _aspxCreateClass(ASPxClientCancelEventArgs, {
 constructor: function(processOnServer, tab){
  this.constructor.prototype.constructor.call(this, processOnServer);
  this.tab = tab;
  this.reloadContentOnCallback = false;
 }
});
ASPxClientTabControlTabClickEventArgs = _aspxCreateClass(ASPxClientTabControlTabCancelEventArgs, {
 constructor: function(processOnServer, tab, htmlElement, htmlEvent){
  this.constructor.prototype.constructor.call(this, processOnServer, tab);
  this.htmlElement = htmlElement;
  this.htmlEvent = htmlEvent;  
 }
});
function aspxTCResize(name){
 var tc = aspxGetControlCollection().Get(name);
 if(tc != null) tc.OnResize();
}
function aspxTCCorrectBounds(name){
 var tc = aspxGetControlCollection().Get(name);
 if(tc != null) tc.CorrrectCellsBoundsTimer();
}
function aspxTCTClick(evt, name, index){
 var tc = aspxGetControlCollection().Get(name);
 if(tc != null) tc.OnTabClick(evt, index);
 if(!__aspxNetscapeFamily)
  evt.cancelBubble = true;
}

var __aspxTEInputSuffix = "_I";
var __aspxTERawInputSuffix = "_Raw";
var __aspxPasteCheckInterval = 20;
ASPxEditorStretchedInputElementsManager = _aspxCreateClass(null, {
 constructor: function() {
  this.targetEditorNames = { };
  this.savedDisplayAttrName = "dxESIEM_display";
 },
 Initialize: function() {
  this.InitializeTargetEditorsList();
 },
 InitializeTargetEditorsList: function() {
  var controls = aspxGetControlCollection().elements;
  for(var key in controls) {
   var control = controls[key];
   if(this.targetEditorNames[control.name])
    continue;
   if(ASPxIdent.IsASPxClientTextEdit(control) && control.WidthCorrectionRequired()) {
    var inputElement = control.GetInputElement();
    if(inputElement && this.IsPercentageWidth(inputElement.style.width))
     this.targetEditorNames[control.name] = true;
   }
  }
 },
 HideInputElementsExceptOf: function(exceptedEditor) {
  var collection = aspxGetControlCollection();
  for(var editorName in this.targetEditorNames) {
   if(typeof(editorName) != "string")
    continue;
   var editor = collection.Get(editorName);
   if(editor && editor != exceptedEditor) {
    var input = editor.GetInputElement();
    if(input) {
     var existentSavedDisplay = input.getAttribute(this.savedDisplayAttrName);
     if(existentSavedDisplay == null) {
      input.setAttribute(this.savedDisplayAttrName, 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(editor) {
    var input = editor.GetInputElement();
    if(input) {
     var savedDisplay = input.getAttribute(this.savedDisplayAttrName);
     if(savedDisplay != null) {
      input.style.display = savedDisplay;
      input.removeAttribute(this.savedDisplayAttrName);
     }
    }
   }
  }
 },
 IsPercentageWidth: function(widthStr) {
  return widthStr.length > 0 && widthStr.charAt(widthStr.length - 1) == '%';
 }
});
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.raiseValueChangedOnEnter = true;
  this.maskInfo = null;  
  this.maskValueBeforeUserInput = "";
  this.maskPasteTimerID = -1;
  this.maskPasteLock = false;    
  this.maskTextBeforePaste = "";    
  this.maskHintHtml = "";
  this.maskHintTimerID = -1;
  this.displayFormat = null;
  this.TextChanged = new ASPxClientEvent();
 },
 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();   
 },
 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;
  var 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();
 }, 
 OnKeyDown: function(evt) {        
  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() {
  ASPxClientEdit.prototype.OnFocusCore.call(this);
  if(this.maskInfo != null) {
   this.SavePrevMaskValue();
   this.BeginShowMaskHint();
  }
  this.ToggleTextDecoration();
 },
 OnLostFocusCore: function() {
  ASPxClientEdit.prototype.OnLostFocusCore.call(this);
  if(this.maskInfo != null) {
   this.EndShowMaskHint();
   this.HideMaskHint();   
   if(this.maskInfo.ApplyFixes(null))
    this.ApplyMaskInfo(false);
   this.RaiseStandardOnChange();
  }
  this.ToggleTextDecoration();
 },
 OnValueChanged: function() { 
  if(this.maskInfo != null) {
   if(this.maskInfo.GetValue() == this.maskValueBeforeUserInput) 
    return;
   this.SavePrevMaskValue();
  }
  if(this.HasTextDecorators())
   this.SyncRawInputValue();
  ASPxClientEdit.prototype.OnValueChanged.call(this);
 }, 
 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){
  if(this.isNative)
   this.GetMainElement().disabled = !enabled;
  var inputElement = this.GetInputElement();
  if(_aspxIsExists(inputElement)){
   this.ChangeInputEnabledAttributes(inputElement, _aspxChangeAttributesMethod(enabled), enabled);
   if(this.specialKeyboardHandlingUsed)
    this.ChangeSpecialInputEnabledAttributes(inputElement, _aspxChangeEventsMethod(enabled));
   if(!this.isNative)
    this.ChangeReadOnlyAttribute(inputElement, enabled);
  }
 },
 ChangeEnabledStateItems: function(enabled){
  if(!this.isNative)
   aspxGetStateController().SetElementEnabled(this.GetMainElement(), enabled);
 },
 ChangeReadOnlyAttribute: function(element, enabled){
  element.readOnly = !enabled || this.readOnly;
 },
 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");
  method(element, "onfocus");
  method(element, "onblur");
  method(element, "onkeydown");
  method(element, "onkeypress");
  method(element, "onkeyup");
 }
});
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, {
});
ASPxClientTextBox = _aspxCreateClass(ASPxClientTextBoxBase, {
 constructor: function(name) {
  this.constructor.prototype.constructor.call(this, name);
  this.isASPxClientTextBox = true;
 }
});
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%";
  }
 }
});
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.buttonCount = 0;
  this.ButtonClick = new ASPxClientEvent();
 },
 GetButton: function(number) {
  return this.GetChild("_B" + number);
 },
 ProcessInternalButtonClick: function(number) {
  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");
 },
 ChangeReadOnlyAttribute: function(element, enabled){
  if(this.allowUserInput)
   ASPxClientTextEdit.prototype.ChangeReadOnlyAttribute.call(this, element, enabled);
 }
});
ASPxClientButtonEdit = _aspxCreateClass(ASPxClientButtonEditBase, {
});
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);
}
ASPxClientButton = _aspxCreateClass(ASPxClientControl, {
 constructor: function(name) {
  this.constructor.prototype.constructor.call(this, name);
  this.isASPxClientButton = true;
  this.allowFocus = true;
  this.autoPostBackFunction = null;
  this.causesValidation = true;
  this.checked = false;
  this.clickLocked = false;
  this.groupName = "";
  this.focusElementSelected = false;
  this.pressed = false;
  this.useSubmitBehavior = true;
  this.validationGroup = "";
  this.validationContainerID = null;
  this.validateInvisibleEditors = false;
  this.buttonCell = null;
  this.contentDiv = null;
  this.checkedInput = null;
  this.buttonImage = null;
  this.internalButton = null;
  this.textElement = null; 
  this.textControl = null;
  this.textContainer = null;
  this.isTextEmpty = false;
  this.CheckedChanged = new ASPxClientEvent();
  this.GotFocus = new ASPxClientEvent();
  this.LostFocus = new ASPxClientEvent();
  this.Click = new ASPxClientEvent();
 },
 InlineInitialize: function() {
  this.InitializeEvents();
  this.InitializeEnabled();
  this.InitializeChecked();
  this.PreventButtonImageDragging();
 },
 InitializeEnabled: function(){
  this.SetEnabledInternal(this.clientEnabled, true);
 },
 InitializeChecked: function(){
  this.SetCheckedInternal(this.checked, true);
 },
 InitializeEvents: function(){
  if (!this.isNative) {
   var element = this.GetInternalButton();
   if(_aspxIsExists(element))
    element.onfocus = null;
   var textControl = this.GetTextControl();
   if (_aspxIsExists(textControl)) {
    if (__aspxIE)
     _aspxAttachEventToElement(textControl, "onmouseup", _aspxClearSelection);
    _aspxPreventElementDragAndSelect(textControl, false);
   }    
  }
  var name = this.name;
  this.onClick = function() {
   var processOnServer = aspxBClick(name);
   if (!processOnServer) {
    var evt = _aspxGetEvent(arguments[0]);
    if (evt)
     _aspxPreventEvent(evt);
   }
   return processOnServer;
  };
  this.onGotFocus = function() { aspxBGotFocus(name); };
  this.onLostFocus = function() { aspxBLostFocus(name); };
  this.onKeyUp = function(evt) { aspxBKeyUp(evt, name); };
  this.onKeyDown = function(evt) { aspxBKeyDown(evt, name); }; 
  if(!this.isNative) {
   this.AttachNativeHandlerToMainElement("focus", "SetFocus");
   this.AttachNativeHandlerToMainElement("click", "DoClick");
  }
 },
 PreventButtonImageDragging: function() {
  var image = this.GetButtonImage();
  if(_aspxIsExists(image)) {
   if(__aspxNetscapeFamily)
    image.onmousedown = function(evt) {
     evt.cancelBubble = true;
     return false;
    };
   else
    image.ondragstart = function() {
     return false;
    };
  }
 },
 AttachNativeHandlerToMainElement: function(handlerName, correspondingMethodName) {
  var mainElement = this.GetMainElement();
  if (!_aspxIsExistsElement(mainElement))
   return;
  eval("mainElement." + handlerName + " = function() { _aspxBCallButtonMethod('" + this.name + "', '" + correspondingMethodName + "'); }");
 },
 GetContentDiv: function(){
  if(!_aspxIsExistsElement(this.contentDiv))
   this.contentDiv = this.GetChild("_CD");
  return this.contentDiv;
 },       
 GetButtonCell: function(){
  if(!_aspxIsExistsElement(this.buttonCell))
   this.buttonCell = this.GetChild("_B");
  return this.buttonCell;
 },   
 GetButtonCheckedInput: function(){
  if(!_aspxIsExistsElement(this.checkedInput))
   this.checkedInput = _aspxGetElementById(this.name + "_CH");
  return this.checkedInput;
 },  
 GetButtonImage: function(){
  if(!_aspxIsExistsElement(this.buttonImage))
   this.buttonImage = _aspxGetChildByTagName(this.GetButtonCell(), "IMG", 0);
  return this.buttonImage;
 },
 GetInternalButton: function() {
  if(!_aspxIsExistsElement(this.internalButton))
   this.internalButton = this.isNative ? this.GetMainElement() : _aspxGetChildByTagName(this.GetMainElement(), "INPUT", 0);
  return this.internalButton;
 },
 GetTextContainer: function() {
  if (!_aspxIsExists(this.textContainer)) {
   var textElement = this.GetTextElement();
   this.textContainer = _aspxGetChildByTagName(textElement, "SPAN", 0);
  }
  return this.textContainer;
 },
 GetTextElement: function(){
  if(!_aspxIsExistsElement(this.textElement)){
   var contentDiv = this.GetContentDiv();
   if (this.GetButtonImage() == null) 
    this.textElement = contentDiv;
   else {
    this.textElement = _aspxGetChildByTagName(contentDiv, "TD", 0);
    var img = _aspxGetChildByTagName(this.textElement, "IMG", 0);
    if (_aspxIsExists(img))
     this.textElement = _aspxGetChildByTagName(contentDiv, "TD", 1);
   }
  }
  return this.textElement;
 }, 
 GetTextControl: function(){
  if(!_aspxIsExistsElement(this.textControl))
   this.textControl = _aspxGetParentByTagName(this.GetTextElement(), "table");
  if (!_aspxIsExistsElement(this.textControl) || (this.textControl.id == this.name))
   this.textControl = this.GetTextElement();
  return this.textControl;
 },
 GetPostfixes: function(){
  return this.isNative ? [""] : ["_B"];
 },
 IsHovered: function(){
  var hoverElement = this.isNative ? this.GetMainElement() : this.GetButtonCell();
  return aspxGetStateController().currentHoverItemName == hoverElement.id;
 },   
 SetEnabledInternal: function(enabled, initialization) {
  if(!this.enabled)
   return;
  if(!initialization || !enabled)
   this.ChangeEnabledStateItems(enabled);
  this.ChangeEnabledAttributes(enabled);
 },
 ChangeEnabledAttributes: function(enabled) {
  if(this.isNative)
   this.GetMainElement().disabled = !enabled;
  else {
   var element = this.GetInternalButton();
   if(_aspxIsExists(element))
    element.disabled = !enabled;
  }
  this.ChangeEnabledEventsAttributes(_aspxChangeEventsMethod(enabled));
 },
 ChangeEnabledEventsAttributes: function(method) {
  var element = this.GetMainElement();
  method(element, "click", this.onClick);
  if (this.allowFocus){
   if (!this.isNative) 
    element = this.GetInternalButton();
   if(_aspxIsExists(element)) {
    method(element, "focus", this.onGotFocus);
    method(element, "blur", this.onLostFocus);
    if (!this.isNative){
     method(element, "keyup", this.onKeyUp);
     method(element, "blur", this.onKeyUp);
     method(element, "keydown", this.onKeyDown);
    }
   }
  }
 },
 ChangeEnabledStateItems: function(enabled){
  if(!this.isNative){
   aspxGetStateController().SetElementEnabled(this.GetButtonCell(), enabled);
   this.UpdateFocusedStyle();
  }
 },
 OnFocus: function() {
  if(!this.allowFocus)
   return false;
  this.focused = true;
  if(this.isInitialized)
   this.RaiseFocus();
  this.UpdateFocusedStyle();
 },  
 OnLostFocus: function() {
  if(!this.allowFocus)
   return false;
  this.focused = false;
  if(this.isInitialized)
   this.RaiseLostFocus();
  this.UpdateFocusedStyle();
 },
 CauseValidation: function() {
  if (this.causesValidation && _aspxIsExistsType(typeof(ASPxClientEdit)))
   return this.validationContainerID != null ?
    ASPxClientEdit.ValidateEditorsInContainerById(this.validationContainerID, this.validationGroup, this.validateInvisibleEditors) :
    ASPxClientEdit.ValidateGroup(this.validationGroup, this.validateInvisibleEditors);
  else
   return true;
 },
 OnClick: function() {
  if(this.clickLocked)
   return true;
  else if(this.checked && this.groupName != "" && this.GetCheckedGroupList().length > 1)
   return;
  this.SetFocus();
  var isValid = this.CauseValidation();
  var processOnServer = this.autoPostBack;
  if (this.groupName != "") {
   if(this.GetCheckedGroupList().length == 1)
    this.SetCheckedInternal(!this.checked, false);
   else {
    this.SetCheckedInternal(true, false);
    this.ClearButtonGroupChecked(true);
   }
   processOnServer = this.RaiseCheckedChanged();
   if (processOnServer && isValid)
    this.SendPostBack("CheckedChanged");
  }
  processOnServer = this.RaiseClick();
  if (processOnServer && isValid){
   this.SendPostBack("Click");
   return true;
  }
  return false;
 },
 OnKeyUp: function(evt) {
    if(this.pressed)
   this.SetUnpressed();
 },
 OnKeyDown: function(evt) {
    if(evt.keyCode == ASPxKey.Enter || evt.keyCode == ASPxKey.Space)
     this.SetPressed();
 },  
 GetChecked: function(){
  return this.groupName != "" ? this.GetButtonCheckedInput().value == "1" : false;
 },  
 GetCheckedGroupList: function(){
  var collection = aspxGetControlCollection(); 
  var result = new Array();
  for(var name in collection.elements) {
   var element = collection.elements[name];
   if (element != null && ASPxIdent.IsASPxClientButton(element) &&
    (element.groupName == this.groupName))
    _aspxArrayPush(result, element);
  }
  return result;
 },
 ClearButtonGroupChecked: function(raiseCheckedChanged){
  var list = this.GetCheckedGroupList();
  for(var i = 0; i < list.length; i ++){
   if(list[i] != this && list[i].checked) {
    list[i].SetCheckedInternal(false, false);
    if(raiseCheckedChanged)
     list[i].RaiseCheckedChanged();
   }
  }
 },
 ApplyCheckedStyle: function(){
  var stateController = aspxGetStateController();
  if(this.IsHovered()) 
   stateController.SetCurrentHoverElement(null);  
  stateController.SelectElementBySrcElement(this.GetButtonCell());
 }, 
 ApplyUncheckedStyle: function(){
  var stateController = aspxGetStateController();
  if(this.IsHovered()) 
   stateController.SetCurrentHoverElement(null);
  stateController.DeselectElementBySrcElement(this.GetButtonCell());
 },  
 SetCheckedInternal: function(checked, initialization){
  if(initialization && checked || (this.checked != checked)){
   this.checked = checked;
   var inputElement = this.GetButtonCheckedInput();
   if(_aspxIsExists(inputElement)) inputElement.value = checked ? "1" : "0";         
   if(checked)
    this.ApplyCheckedStyle();
   else
    this.ApplyUncheckedStyle();
  }
 },
 ApplyPressedStyle: function(){
  aspxGetStateController().OnMouseDownOnElement(this.GetButtonCell());
 },
 ApplyUnpressedStyle: function(){ 
  aspxGetStateController().OnMouseUpOnElement(this.GetButtonCell());
 },
 SetPressed: function(){
  this.pressed = true;
  this.ApplyPressedStyle();
 }, 
 SetUnpressed: function(){
  this.pressed = false;
  this.ApplyUnpressedStyle();
 },
 SetFocus: function(){
  if(!this.allowFocus || this.focused)
   return;
  var element = this.GetInternalButton();
  if(_aspxIsExists(element)) {
   var hiddenInternalButtonRequiresVisibilityToGetFocused = __aspxWebKitFamily  && !this.isNative ;
   if(hiddenInternalButtonRequiresVisibilityToGetFocused)
    ASPxClientButton.MakeHiddenElementFocusable(element);
   if(_aspxIsFocusable(element) && _aspxGetActiveElement() != element)
    element.focus();
   if(hiddenInternalButtonRequiresVisibilityToGetFocused)
    ASPxClientButton.RestoreHiddenElementAppearance(element);
  }
 },
 ApplyFocusedStyle: function(){
  if(this.focusElementSelected) return;
  aspxGetStateController().SelectElementBySrcElement(this.GetContentDiv());
  this.focusElementSelected = true;
 },
 ApplyUnfocusedStyle: function(){ 
  if(!this.focusElementSelected) return;
  aspxGetStateController().DeselectElementBySrcElement(this.GetContentDiv());
  this.focusElementSelected = false;
 },
 UpdateFocusedStyle: function(){
  if(this.isNative)
   return;
  if(this.enabled && this.clientEnabled && this.allowFocus && this.focused)
   this.ApplyFocusedStyle();
  else
   this.ApplyUnfocusedStyle();
 },
 SendPostBack: function(postBackArg){
  if(!this.enabled || !this.clientEnabled)
   return;
  var arg = _aspxIsExists(postBackArg) ? postBackArg : "";
  if(_aspxIsExists(this.autoPostBackFunction))
   this.autoPostBackFunction(arg);
  else if(!this.useSubmitBehavior)
   ASPxClientControl.prototype.SendPostBack.call(this, arg);
  if(this.useSubmitBehavior && !this.isNative)
   this.ClickInternalButton();
 },
 ClickInternalButton: function(){
  var element = this.GetInternalButton();
  if(_aspxIsExists(element)) {
   this.clickLocked = true;
   if (__aspxNetscapeFamily)
    this.CreateUniqueIDCarrier(); 
   element.click();
   if (__aspxNetscapeFamily)
    this.RemoveUniqueIDCarrier(); 
   this.clickLocked = false;
  }
 },
 CreateUniqueIDCarrier: function() {
  var name = this.uniqueID;
  var id = this.GetUniqueIDCarrierID();
  var field = _aspxCreateHiddenField(name, id);
  var form = _aspxGetServerForm();
  form.appendChild(field);
 },
 RemoveUniqueIDCarrier: function() {
  var field = document.getElementById(this.GetUniqueIDCarrierID());
  if (_aspxIsExists(field))
   field.parentNode.removeChild(field);
 },
 GetUniqueIDCarrierID: function() {
  return this.uniqueID + "_UIDC";
 },
 DoClick: function(){
  if(!this.enabled || !this.clientEnabled)
   return;
  var button = this.isNative ? this.GetMainElement() : this.GetInternalButton();
  if(_aspxIsExists(button))
   button.click();
  else 
   this.OnClick();   
 },
 GetChecked: function(){
  return this.checked;
 },
 SetChecked: function(checked){
  this.SetCheckedInternal(checked, false);
  this.ClearButtonGroupChecked(false);
 },
 GetText: function(){
  if (this.isTextEmpty)
   return "";
  else
   return this.isNative ? this.GetMainElement().value : this.GetTextContainer().innerHTML;
 },
 SetText: function(text){
  this.isTextEmpty = (text == null || text == "");
  if (this.isNative)
   this.GetMainElement().value = (text != null) ? text : "";
  else {
   var textContainer = this.GetTextContainer();
   textContainer.innerHTML = this.isTextEmpty ? "&nbsp;" : text;
  }
 },
 SetEnabled: function(enabled){
  if (this.clientEnabled != enabled) {
   if (!enabled && this.focused)
    this.OnLostFocus();
   this.clientEnabled = enabled;
   this.SetEnabledInternal(enabled, false);
  }
 },
 GetEnabled: function(){
  return this.enabled && this.clientEnabled;
 },
 Focus: function(){
  this.SetFocus();
 },
 RaiseCheckedChanged: function(){
  var processOnServer = this.autoPostBack || this.IsServerEventAssigned("CheckedChanged");
  if(!this.CheckedChanged.IsEmpty()){
   var args = new ASPxClientProcessingModeEventArgs(processOnServer);
   this.CheckedChanged.FireEvent(this, args);
   processOnServer = args.processOnServer;
  }
  return processOnServer;
 },
 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);
  }
 },
 RaiseClick: function(){
  var processOnServer = this.autoPostBack || this.IsServerEventAssigned("Click");
  if(!this.Click.IsEmpty()){
   var args = new ASPxClientProcessingModeEventArgs(processOnServer);
   this.Click.FireEvent(this, args);
   processOnServer = args.processOnServer;
  }
  return processOnServer;
 }
});
ASPxClientButton.MakeHiddenElementFocusable = function(element) {
  element.__dxHiddenElementState = {
   parentDisplay: element.parentNode.style.display,
   height: element.style.height,
   width: element.style.width
  };
  element.parentNode.style.display = "block";
  element.style.height = "1px";
  element.style.width = "1px";
};
ASPxClientButton.RestoreHiddenElementAppearance = function(element) {
 var state = element.__dxHiddenElementState;
 element.parentNode.style.display = state.parentDisplay;
 element.style.height = state.height;
 element.style.width = state.width;
 delete element.__dxHiddenElementState;
};
ASPxIdent.IsASPxClientButton = function(obj) {
 return _aspxIsExists(obj.isASPxClientButton) && obj.isASPxClientButton;
};
function _aspxBCallButtonMethod(name, methodName) {
 var button = aspxGetControlCollection().Get(name); 
 if (button != null)
  eval("button." + methodName + "()");
}
function aspxBGotFocus(name){
 var button = aspxGetControlCollection().Get(name); 
 if(button != null)
  return button.OnFocus();
}
function aspxBLostFocus(name){
 var button = aspxGetControlCollection().Get(name);
 if(button != null) 
  return button.OnLostFocus();
}
function aspxBClick(name){
 var button = aspxGetControlCollection().Get(name); 
 if(button != null)
  return button.OnClick();
}
function aspxBKeyDown(evt,name){
 var button = aspxGetControlCollection().Get(name); 
 if(button != null)
  button.OnKeyDown(evt);
}
function aspxBKeyUp(evt,name){
 var button = aspxGetControlCollection().Get(name); 
 if(button != null)
  button.OnKeyUp(evt);
}

ASPxRelatedControlManager = {
 storage: { },
 GetRelatedCollection: function(masterName) {
  if(!_aspxIsExists(this.storage[masterName]))
   this.storage[masterName] = [ ];
  return this.storage[masterName];
 },
 RegisterRelatedControl: function(masterName, name) {
  this.GetRelatedCollection(masterName)[name] = name;
 },
 RegisterRelatedControls: function(masterName, names) {
  var relatedCollection = this.GetRelatedCollection(masterName);
  var name;
  for(var i = 0; i < names.length; i++) {
   name = names[i];
   relatedCollection[name] = name;
  }
 },
 GetLinkedControls: function(masterControl) {
  var result = [ masterControl ];
  for(var name in this.GetRelatedCollection(masterControl.name)) {
   var control = aspxGetControlCollection().Get(name);
   if(_aspxIsExists(control))
    result.push(control);
  }
  return result;
 },
 coverCache: { },
 panelCache: { },
 timers: { },
 Shade: function(masterControl) {  
  this.ShadeCore(masterControl, true);
  var name = masterControl.name;
  this.timers[name] = _aspxSetTimeout("ASPxRelatedControlManager.ShadeTransition('" + name + "')", 750);
 },
 ShadeCore: function(masterControl, isTransparent) {
  if(!isTransparent) {
   var panel = masterControl.CreateLoadingPanelWithAbsolutePosition(document.body, masterControl.GetMainElement());
   this.panelCache[masterControl.name] = panel;
  } 
  var controls = this.GetLinkedControls(masterControl);
  for(var i = 0; i < controls.length; i++) {
   var control = controls[i];
   var cover = control.CreateLoadingDiv(document.body, control.GetMainElement());
   if(_aspxIsExistsElement(cover)) {
    if(isTransparent) {
     cover.className = "";
     cover.style.background = "white";         
     if(__aspxIE)
      cover.style.filter = "alpha(opacity=1)";
     else
      cover.style.opacity = "0.01";
    }
    this.coverCache[control.name] = cover;
   }
  }  
 },
 ShadeTransition: function(masterName) {
  var obj = aspxGetControlCollection().Get(masterName);
  if(_aspxIsExists(obj)) {
   this.Unshade(obj);
   this.ShadeCore(obj, false);
  }
 },
 Unshade: function(masterControl) {
  var masterName = masterControl.name;
  _aspxClearTimer(this.timers[masterName]);
  delete this.timers[masterName];
  var panel = this.panelCache[masterName];
  if(_aspxIsExistsElement(panel))
   _aspxRemoveElement(panel);
  delete this.panelCache[masterName];
  var controls = this.GetLinkedControls(masterControl);
  for(var i = 0; i < controls.length; i++) {
   var control = controls[i];
   var cover = this.coverCache[control.name];
   if(_aspxIsExistsElement(cover))
    _aspxRemoveElement(cover);    
   delete this.coverCache[control.name];
  }
 },
 CreateInfo: function() {
  return { 
   clientObjectName:   "",
   elementId:    "",
   innerHtml:    "",
   parameters:   ""
  }; 
 },
 ProcessInfo: function(info) {
  var control = aspxGetControlCollection().Get(info.clientObjectName);  
  if(!_aspxIsExists(control) || !_aspxIsFunction(control.ProcessCallbackResult))
   this.ProcessCallbackResultDefault(info.elementId, info.innerHtml, info.parameters);
  else
   control.ProcessCallbackResult(info.elementId, info.innerHtml, info.parameters);
 },
 ProcessCallbackResultDefault: function(elementId, innerHtml, parameters) {
  var element = _aspxGetElementById(elementId);
  if(_aspxIsExistsElement(element))
   element.innerHTML = innerHtml;  
 },
 ParseResult: function(result) {  
  var prevIndex = 0;
  var index;
  var lens;
  var info;
  while(true) {
   var remm = result.substring(prevIndex);
   index = result.indexOf("|", prevIndex);
   if(index < 0)
    break;
   lens = result.substring(prevIndex, index).split(",");
   prevIndex = index + 1;
   info = this.CreateInfo();
   info.clientObjectName = result.substr(prevIndex, lens[0]);
   prevIndex += parseInt(lens[0]);
   info.elementId = result.substr(prevIndex, lens[1]);
   prevIndex += parseInt(lens[1]);
   info.innerHtml = result.substr(prevIndex, lens[2]);
   prevIndex += parseInt(lens[2]);
   info.parameters = result.substr(prevIndex, lens[3]);
   prevIndex += parseInt(lens[3]);
   this.ProcessInfo(info);   
  }
 }
};
var __aspxMenuAnimationAccelerator = 1/10;
var __aspxPCAnimationAccelerator = 1/3;
var __aspxAnimationDiscardPixels = 3;
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;
 }
 if(__aspxIE && __aspxBrowserVersion == 5.5)
  x -= _aspxGetIEDocumentClientOffset(true);
 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;
 }
 if(__aspxIE && __aspxBrowserVersion == 5.5)
  y -= _aspxGetIEDocumentClientOffset(false);
 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 _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;
 if(timeExpired)
  _aspxAnimationFinished(animationDivElement);
 var left = animationDivElement.popuping ? _aspxGetNextAnimationPosInternal(element.offsetLeft, animationAccelerator) : 0;
 var top = animationDivElement.popuping ? _aspxGetNextAnimationPosInternal(element.offsetTop, animationAccelerator) : 0;
 if (left == 0 && top == 0)
  _aspxAnimationFinished(animationDivElement);
 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 && animationDivElement.popuping)
  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 !== ""){
  eval(element.onAnimStopCallString);
 }
}
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;
 }
}
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.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.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.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.rowHotTrackStyle = null;
  this.rowHotTrackItemsBag = { };
  if(ASPxClientGridView.instances)
   ASPxClientGridView.instances[this.name] = this;
 },
 ClearColumns: function() {
  this.columns = new Array();
 },
 CreateColumn: function (name, index, fieldName, visible) {
  if(!_aspxIsExists(this.columns)) 
   this.columns = new Array();
  this.columns.push(new ASPxClientGridViewColumn(name, index, fieldName, visible));
 },
 _constDXDataRow: function() { return "DXDataRow"; },
 _constDXGroupRow: function() { return "DXGroupRow"; },
 _constDXCustWindow: function() { return "_DXTDcustwindow"; },
 _constDXEmptyHeader: function() { return "_DXTDemptyheader"; },
 _constDXDropTarget: function() { return "_DXT"; },
 _constDXDropSource: function() { return "_DXTD"; },
 _constDXCanGroup: function() { return "_DXTDG"; },
 _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"); },
 IsGroupHeader: function(id) { return id.indexOf("_DXTDgroup") > 0; },
 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._constDXCustWindow()); },
 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();
 },
 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.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();
 },
 OnBeforeCallback: function() {
  _aspxClearTimer(this.virtualScrollTimerId);
  this.virtualScrollTimerId = -1;
  this.CreateLoadingPanel(this.GetGridTD());
  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;
  }
 },
 SaveCallbackSettings: function() {
  var el = this.activeElement;
  this.activeElement = null;
  this.savedActiveElementId = null;
  if(el != null && el.id && el.id.indexOf(this.name) == 0) {
   this.SaveActiveElementSettings(el);
  }
  var custWindow = this.GetCustomizationWindow();
  if(custWindow != null) {
   var custWindowElement = custWindow.GetWindowElement(-1);
   if(_aspxIsExists(custWindowElement )){
    this.custwindowLeft = _aspxGetAbsoluteX(custWindowElement) - _aspxGetIEDocumentClientOffset(true);
    this.custwindowTop = _aspxGetAbsoluteY(custWindowElement) - _aspxGetIEDocumentClientOffset(false);
    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();
  this.RestoreActiveElementSettings(); 
 },
 SaveActiveElementSettings: function(element) {
  if(element.tagName != "INPUT")
   return;
  this.savedActiveElementId = element.id;
  this.savedActiveElementCaret = _aspxGetCaretEnd(element);
 },
 RestoreActiveElementSettings: function() {
  if(this.savedActiveElementId == null) return;
  var element = _aspxGetElementById(this.savedActiveElementId);
  if(_aspxIsExists(element)) {
   element.focus();
   _aspxSetCaret(element, this.savedActiveElementCaret);
  }
  this.savedActiveElementId = null;
 },
 HidePopupEditForm: function() {
  var popup = this.GetPopupEditForm();
  if(popup != null) {
   popup.CloseUp.ClearHandlers();
   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) {
  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);
     }
    }
   }
  } 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 > -1 && row == null) || visibleIndex == this.focusedRowIndex) return;
  var oldFocusedRow = this.focusedRowIndex;
  this.focusedRowIndex = visibleIndex;
  this.ChangeRowStyle(oldFocusedRow, this._isRowSelected(oldFocusedRow) ? 0 : 3);
  if(this.focusedRowIndex > -1)
  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._constDXEmptyHeader()) > -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));
  if(this.RaiseColumnStartDragging(column)) return;
  var canDrag = (element.id.indexOf(this._constDXDropSource()) > -1) && (source.tagName!="IMG");
  var drag = this.createDrag(e, element, canDrag);
  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 targertIds = new Array();
  targertIds.push(this._constDXCustWindow());
  targertIds.push(this._constDXDropTarget());
  targets.RegisterTargets(this.GetRootTable(), targertIds);
  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 column = this._getColumnObjectByArg(this.getColumnIndex(element.id));
  if(this.RaiseColumnResizing(column)) return false;
  this.columnResizing.StartResizing(element, e, this.indentColumnCount);
  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.getIsColumnCanSort(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.IsGroupHeader(id), grid.IsGroupHeader(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.getIsColumnCanGroup(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.IsGroupHeader(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.IsGroupHeader(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);
  if(el == this.getCustomizationWindowElement()) {
   __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.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();
 },
 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();
  }
 },
 getIsColumnCanSort: function(colElement) {
  return this.getIsColumnCanDoOperation(colElement, "S");
 },
 getIsColumnCanGroup: function(colElement) {
  return colElement.id.toUpperCase().indexOf(this._constDXCanGroup()) > -1;
 },
 getIsColumnCanDoOperation: function(colElement, op) {
  var id = colElement.id;
  return id.substr(id.lastIndexOf("_")).indexOf(op) > -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 == 13) {
   e.cancelBubble = true;
   e.returnValue = false;
   editor.Validate();
   this.ApplyColumnAutoFilterCore(editor);
   return;
  }
  if(e.keyCode == 46 && e.ctrlKey) {
   e.cancelBubble = true;
   e.returnValue = false;
   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 == 9) {
   e.cancelBubble = true;
  }
  if(e.keyCode == 13) return;
  if(e.keyCode == 46 && 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;
  for(var i = menu.GetItemCount() - 1; i >= 0; i--) {
   var item = menu.GetItem(i);
   item.SetChecked(item.name == this.filterRowConditions[columnIndex]);  
  }
  menu.ShowAtElement(element);
  this.filterRowMenuColumnIndex = columnIndex;
 },
 FilterRowMenuItemClick: function(item) {
  this.gridCallBack(["FILTERROWMENU", this.filterRowMenuColumnIndex, item.name]);
 },
 CreateLoadingPanel: function(content) {
  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() {
   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 = -1;
 },
 OnVirtualScroll: function(event) {
  var src = _aspxGetEventSource(event);
  var grid = src.grid;
  _aspxClearTimer(grid.virtualScrollTimerId);
  grid.savedVirtualScroll = src.scrollTop;
  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;
  if(this.getVertScrollPosition() != this.savedVirtualScroll) return;
  if(this.isVirtualScrollOutOfCurPage()){
   _aspxDetachEventFromElement(this.getScrollableControl(), "scroll", this.OnVirtualScroll); 
   this.GotoPage(this.getVirtualPageIndex());
  }
 },
 isVirtualScrollOutOfCurPage: function() {
  var marginTop = this.getVirtualScrollMarginTop();
  if(this.savedVirtualScroll < marginTop) return true;
  if(this.pageRowCount < this.pageRowSize) return false;
  return this.savedVirtualScroll > marginTop + this.GetMainTable().clientHeight - this.getScrollableControl().clientHeight;
 },
 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;
  if(input && input.value.length > 0) {
   var list = input.value.split(" ");  
   var vertScrollPos = Number(list[0]);
   var horzScrollPos = Number(list[1]);
   this.lastMultiSelectIndex = Number(list[2]);
   if((this.virtualScrollRowHeight <= 0) && !this.doScrollToRowIndex())
    this.setScrollPosition(this.getScrollableControl(), vertScrollPos, true);   
   if(horzScrollPos > 0)
    window.setTimeout(function() { instance.setScrollPosition(instance.GetHorzScrollbarOwner(), horzScrollPos, false) }, 0);
  } else {
   this.doScrollToRowIndex();
  }
  if(this.virtualScrollRowHeight > 0) {
   this.updateVirtualMarginBottom();
   this.setScrollPosition(this.getScrollableControl(), this.getVirtualScrollMarginTop(), true);
   window.setTimeout(function() { instance.setOnVirtualScroll() }, 0);
  }      
 },
 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]);
 },
 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]);
 },
 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;
  fc.Apply(this);
 },
 SetFilterEnabled: function(isFilterEnabled) {
  this.gridCallBack(["SETFILTERENABLED", isFilterEnabled]);
 },
 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; 
 },
 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;
  }
 }
});
ASPxClientGridViewColumn = _aspxCreateClass(null, {
 constructor: function(name, index, fieldName, visible){
  this.name = name;
  this.id = name;
  this.index = index;
  this.fieldName = fieldName;
  this.visible = visible;
 }
});
ASPxClientGridViewColumnCancelEventArgs = _aspxCreateClass(ASPxClientCancelEventArgs, {
 constructor: function(column){
  this.constructor.prototype.constructor.call(this, true);
  this.column = column;
 }
});
ASPxClientGridViewRowCancelEventArgs = _aspxCreateClass(ASPxClientCancelEventArgs, {
 constructor: function(visibleIndex){
  this.constructor.prototype.constructor.call(this, true);
  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;
 } 
});
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");
 var width1 = div.clientWidth;
 div.style.overflow = "hidden";
 var width2 = div.clientWidth;
 div.style.overflow = "auto"; 
 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.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);
 }
};
ASPxClientNewsControl = _aspxCreateClass(ASPxClientDataView, {
 constructor: function(name){
  this.constructor.prototype.constructor.call(this, name);
  this.TailClick = new ASPxClientEvent();  
 },
 DoTailClick: function(itemName, evt){
  var clickedElement = _aspxGetEventSource(evt);
  this.OnTailClick(clickedElement, itemName, evt);
 }, 
 OnTailClick: function(clickedElement, itemName, htmlEvent) {
  var itemElement = clickedElement;  
  if(_aspxIsExists(itemElement)) {
   var processOnServer = this.RaiseTailClick(itemElement, itemName, htmlEvent);  
   var hasItemLink = this.GetLinkElement(itemElement) != null;
   if(processOnServer && !hasItemLink) {      
    this.SendPostBack("CLICK:" + itemName);
   }
  }
 },
 RaiseTailClick: function(tailElement, itemName, htmlEvent){
  var processOnServer = this.autoPostBack || this.IsServerEventAssigned("TailClick");
  if(!this.TailClick.IsEmpty()){
   var args = new ASPxClientNewsControlItemEventArgs(processOnServer, itemName, tailElement, htmlEvent);
   this.TailClick.FireEvent(this, args);
   processOnServer = args.processOnServer;
  }
  return processOnServer;
 }
});
ASPxClientNewsControlItemEventArgs = _aspxCreateClass(ASPxClientProcessingModeEventArgs, {
 constructor: function(processOnServer, name, htmlElement, htmlEvent){
  this.constructor.prototype.constructor.call(this, processOnServer);
  this.name = name;
  this.htmlElement = htmlElement;
  this.htmlEvent = htmlEvent;
 }
});
function aspxHLTClick(evt, name, itemName) {
 var control = aspxGetControlCollection().Get(name);
 if(control != null) control.DoTailClick(itemName, evt);
}
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.Post.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.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", "_", "$" ]);
 },
 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)
    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"];
 }
});
function _aspxGetHiddenFieldSerializer() {
 if(!window.__aspxHiddenFieldSerializer)
  window.__aspxHiddenFieldSerializer = new ASPxHiddenFieldSerializer();
 return window.__aspxHiddenFieldSerializer;
}
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.allowCorrectYOffsetPosition = true; 
  this.contentUrl = "";
  this.contentUrlArray = [];
  this.cookieName = "";
  this.closeAction = "OuterMouseClick";
  this.popupAction = "LeftMouseClick";
  this.popupElementID = "";
  this.popupElementIDArray = [];
  this.showOnPageLoad = false;
  this.showOnPageLoadArray = [];
  this.popupHorizontalAlign = __aspxNotSetAlignIndicator;
  this.popupVerticalAlign = __aspxNotSetAlignIndicator;
  this.popupHorizontalOffset = 0;
  this.popupVerticalOffset = 0;
  this.shadowHeight = 5;
  this.shadowWidth = 5;
  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.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;
 },
 GetPopupElement: function(index){
  var popupElement = this.GetPopupElementInternal(index);
  var modalElement = this.GetWindowModalElement(index);
  if(_aspxIsExists(modalElement))
   _aspxAttachEventToElement(modalElement, "mousedown", aspxPWMEMDown);
  if(!_aspxIsExistsElement(popupElement)){
   var popupElement = _aspxFindPopupElementById(this.GetPopupElementID(index));
   if(_aspxIsExistsElement(popupElement)) {
    popupElement.DXPopupControl = this;
    popupElement.DXPopupWindowIndex = index;
    popupElement.isPopuped = false;
    if (this.popupAction == "LeftMouseClick")
     _aspxAttachEventToElement(popupElement, "mouseup", aspxPEMEvent);
    else if (this.popupAction == "RightMouseClick")
     _aspxAttachEventToElement(popupElement, "contextmenu", aspxPEMEvent);
    else if (this.popupAction == "MouseOver"){
     _aspxAttachEventToElement(popupElement, "mouseover", aspxPEMOver);   
     _aspxAttachEventToElement(this.GetWindowElement(index), "mouseover", aspxPWEMOver);
    }     
    if (this.popupAction == "LeftMouseClick" || this.popupAction == "RightMouseClick"){
     _aspxAttachEventToElement(popupElement, "mousedown", aspxPEMEvent);
     this.isNeedPopupedSet = true;
    }
    this.SetPopupElementInternal(index, popupElement);
   }
  }
  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;
 },
 GetPopupElementID: function(index){
  if(0 <= index && index < this.GetWindowCountCore())
   return this.popupElementIDArray[index];
  return this.popupElementID;
 },
 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;
 },
 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;
 },
 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();
  if(__aspxIE && __aspxBrowserVersion > 5.5 && popupElement != null && _aspxIsExistsAbsoluteOrRelativePosParent(popupElement))
   popupPosition.position -= _aspxGetIEDocumentClientOffset(isX);
  return popupPosition;
 },
 GetClientPopupPosX: function(element, popupElement, x){
  var mainElement = this.GetWindowMainCell(element);
  var popupPosition = _aspxGetPopupAbsoluteX(mainElement, this.shadowWidth,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.shadowHeight, 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.shadowWidth : this.shadowHeight, 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);
   }
   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.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);
   }
  }
 },
 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)){
   if(this.hideBodyScrollWhenModal && !this.IsWindowVisible(this.GetWindow(index)))
    _aspxHideBodyScroll();
   _aspxSetElementDisplay(modalElement, true);
   aspxGetPopupControlCollection().AdjustModalElementBounds(modalElement);
   _aspxSetElementVisibility(modalElement, true);
   aspxGetPopupControlCollection().RegisterVisibleModalElement(modalElement);
  }
 },
 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) - _aspxGetIEDocumentClientOffset(true);
  var gragYOffset = _aspxGetAbsoluteY(element) - _aspxGetEventY(evt) - _aspxGetIEDocumentClientOffset(false);
  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);
 },
 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 - _aspxGetIEDocumentClientOffset(true), newTop - _aspxGetIEDocumentClientOffset(false));
   _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) - _aspxGetIEDocumentClientOffset(true);
  var top  = _aspxGetAbsoluteY(resizePanel) - (cursor.verticalDirection == "n" ?  heightCorrection : 0) - _aspxGetIEDocumentClientOffset(false);
  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);
  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);
  _aspxSetStyleSize(mainCell, width, height);
  if (__aspxNetscapeFamily){
   _aspxSetElementDisplay(element, false);
   _aspxSetElementDisplay(element, true);
  }
  _aspxSetStyleSize(element, clientWindow.offsetWidth + this.shadowWidth + windowHorizontalTwoBorderSize, clientWindow.offsetHeight + this.shadowHeight + 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);
  }
 },
 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.closeAction != "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) : 0;
   var height = isResized ? this.GetCurrentWindowHeight(index) : 0;
   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(false, 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(false, 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(false, 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(false, 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(false, 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(false, 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(false, 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(false, 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);
 },
 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))
    _aspxSetStyleSize(iFrame, width, height);
  } else
   this.SetWindowCachedSize(index, width, height);
 },
 IsVisible: function(){
  return this.InternalIsWindowVisible(-1);
 },
 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);
 },
 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);
 },
 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;
  }
 },
 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.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.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.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);
   if(popupWindow.popupControl != null && (
    (popupWindow.popupControl.closeAction != "CloseButton" && popupWindow.popupControl.closeAction != "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);
 },
 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;
  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) + this.gragXOffset;
  var y = _aspxGetEventY(evt) + 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.DXPopupControl.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();
  if(this.overControl.closeAction == "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){
     var isNeedFix = popupControl.IsFFTextCurFixRequired(popupWindow.windowIndex);
     if(popupControl.autoUpdatePosition && !isNeedFix) 
     popupWindow.popupControl.TryAutoUpdatePosition();   
     else if(!popupControl.autoUpdatePosition && 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){
  if(_aspxArrayIndexOf(this.visiblePopupWindowIds, element.id) == -1)
   _aspxArrayPush(this.visiblePopupWindowIds, element.id);
 },
 UnregisterVisibleWindow: function(element){
  this.DeleteWindowFromZIndexOrder(element);
  _aspxArrayRemove(this.visiblePopupWindowIds, element.id);
 },
 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;
 },
 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(processOnServer, window){
  this.constructor.prototype.constructor.call(this);
  this.window = window;
 }
});
ASPxClientPopupWindowCancelEventArgs = _aspxCreateClass(ASPxClientCancelEventArgs, {
 constructor: function(processOnServer, window){
  this.constructor.prototype.constructor.call(this, processOnServer);
  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 aspxPEMOver(evt){
 var element = _aspxFindEventSourceParentByTestFunc(evt, aspxTestPopupControlElement);
 if (element != null) {
  var popupControl = element.DXPopupControl;
  var index = element.DXPopupWindowIndex;
  if (!popupControl.InternalIsWindowVisible(index)){
   aspxGetPopupControlCollection().SetAppearTimer(popupControl.name, index, popupControl.appearAfter);
   aspxGetPopupControlCollection().InitOverObject(popupControl, index, 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.DXPopupControl.InternalIsWindowVisible(element.DXPopupWindowIndex))
    element.isPopuped = true;
   else
    element.isPopuped = false;
   aspxGetPopupControlCollection().OnMouseDown(evt);     
  }
  else{
   if (element.DXPopupControl.popupAction=="RightMouseClick" || _aspxGetIsLeftButtonPressed(evt)){
    if (element.DXPopupControl.popupAction=="RightMouseClick")
     _aspxPreventContextMenu(evt);
    if (!(element.isPopuped && element.DXPopupControl.closeAction == "OuterMouseClick"))
     element.DXPopupControl.DoShowWindow(element.DXPopupWindowIndex, evt);
    if (element.DXPopupControl.closeAction == "MouseOut")
     aspxGetPopupControlCollection().InitOverObject(element.DXPopupControl, 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.DXPopupControl) && _aspxIsExists(element.DXPopupWindowIndex));
}
function aspxTestPopupControlOverElement(element){
 var collection = aspxGetPopupControlCollection();
 var windowId = collection.overControl.GetWindowElementId(collection.overWindowIndex);
 var popupElementId = collection.overControl.GetPopupElement(collection.overWindowIndex).id;
 return (element.id == windowId || element.id == popupElementId);
}
function aspxTestOverPopupWindowElement(element){
 var collection = aspxGetPopupControlCollection();
 var windowId = collection.overControl.GetWindowElementId(collection.overWindowIndex);
 var popupWindowElementId = collection.overControl.GetWindowElementId(collection.overWindowIndex);
 return (element.id == popupWindowElementId);
}
