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() + "/";
 if(year < 1000)
  result += "0";
 result += 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; 
}
function _aspxAreDatesEqualExact(date1, date2) {
 if(date1 == null && date2 == null)
  return true;
 if(date1 == null || date2 == null)
  return false;
 return date1.getTime() == date2.getTime(); 
}
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;
}
function _aspxHideScrollBarCore(element, scrollName) {
 if(element.tagName == "IFRAME") {
  if((element.scrolling == "yes") || (element.scrolling == "auto")) {
   _aspxChangeAttribute(element, "scrolling", "no");
   return true;
  }
 }
 else if(element.tagName == "DIV") {
  if((element.style[scrollName] == "scroll") || (element.style[scrollName] == "auto")) {
   _aspxChangeStyleAttribute(element, scrollName, "hidden");
   return true;
  }
 }
 return false;
}
function _aspxRestoreScrollBarCore(element, scrollName) {
 if(element.tagName == "IFRAME")
  return _aspxRestoreAttribute(element, "scrolling");
 else if(element.tagName == "DIV")
  return _aspxRestoreStyleAttribute(element, scrollName);
 return false;
}
function _aspxSetScrollBarVisibilityCore(element, scrollName, isVisible) {
 return isVisible ? _aspxRestoreScrollBarCore(element, scrollName) : _aspxHideScrollBarCore(element, scrollName);
}
function _aspxSetScrollBarVisibility(element, isVisible) {
 return _aspxSetScrollBarVisibilityCore(element, "overflowX", isVisible)
  || _aspxSetScrollBarVisibilityCore(element, "overflowY", isVisible);
}
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 _aspxInsertElementAfter(newElement, targetElement) {
 var parentElem = targetElement.parentNode;
 if(parentElem.childNodes[parentElem.childNodes.length - 1] == targetElement)
  parentElem.appendChild(newElement);
 else
  parentElem.insertBefore(newElement, targetElement.nextSibling);
}
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);
  return true;
 }
 return false;
}
function _aspxRestoreAttribute(obj, attrName){
 return _aspxRestoreAttributeExtended(obj, attrName, obj, "saved" + attrName);
}
function _aspxRestoreStyleAttribute(obj, attrName){
 return _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();
ASPxClientCancelEventArgs = _aspxCreateClass(ASPxClientEventArgs, {
 constructor: function(){
  this.constructor.prototype.constructor.call(this);
  this.cancel = false;
 }
});
ASPxClientProcessingModeEventArgs = _aspxCreateClass(ASPxClientEventArgs, {
 constructor: function(processOnServer){
  this.constructor.prototype.constructor.call(this);
  this.processOnServer = processOnServer;
 }
});
ASPxClientProcessingModeCancelEventArgs = _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.sizingConfig = {
   allowSetWidth: true,
   allowSetHeight: true,
   correction : false,
   adjustControl : 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() {
 },
 GetWidth: function() {
  return this.GetMainElement().offsetWidth;
 },
 GetHeight: function() {
  return this.GetMainElement().offsetHeight;
 },
 SetWidth: function(width) {
  if(this.sizingConfig.allowSetWidth)
   this.SetSizeCore("width", width, "GetWidth", false);
 },
 SetHeight: function(height) {
  if(this.sizingConfig.allowSetHeight)
   this.SetSizeCore("height", height, "GetHeight", false);
 },
 SetSizeCore: function(sizePropertyName, size, getFunctionName, corrected) {
  if(size < 0)
   return;
  this.GetMainElement().style[sizePropertyName] = size + "px";
  if(this.sizingConfig.adjustControl)
   this.AdjustControl(false, true);
  if(this.sizingConfig.correction && !corrected) {
   var realSize = this[getFunctionName]();
   if(realSize != size) {
    var correctedSize = size - (realSize - size);
    this.SetSizeCore(sizePropertyName, correctedSize, getFunctionName, true);
   }
  }
 },
 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();
   if(this.InCallback())
    this.ShowLoadingPanel();
   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;
 },
 ShowLoadingPanel: function() {
 },
 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, imageObjs, imagePostfixes, kind){
  this.name = name;
  this.classNames = classNames;
  this.customClassNames = [];
  this.resultClassNames = [];
  this.cssTexts = cssTexts;
  this.postfixes = postfixes;
  this.imageObjs = imageObjs;
  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];
   else
    this.resultClassNames[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;
      if(elements[j].id == id)
       this.images[i] = elements[j];
      else
       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.imageObjs) && this.imageObjs.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.imageObjs[i]) || this.imageObjs[i] == "") continue;
   if(_aspxIsAlphaFilterUsed(images[i]))   
    _aspxChangeAttributeExtended(images[i].style, "filter", images[i], "saved" + this.kind + "Filter", 
     "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=" + this.imageObjs[i] + ", sizingMethod=scale)");    
   else{
    var useSpriteImage = typeof(this.imageObjs[i]) != "string";
    var newUrl = "", newCssClass = "", newBackground = "";
    if(useSpriteImage){
     if(_aspxIsExists(this.imageObjs[i].spriteCssClass))
      newCssClass = this.imageObjs[i].spriteCssClass;
     if(_aspxIsExists(this.imageObjs[i].spriteBackground)){
      newUrl = __aspxEmptyImageUrl;
      newBackground = this.imageObjs[i].spriteBackground;
     }
    }
    else{
     newUrl = this.imageObjs[i];
     newCssClass = " ";
     newBackground = " ";
    }
    if(newUrl != "")
     _aspxChangeAttributeExtended(images[i], "src", images[i], "saved" + this.kind + "Src", newUrl);
    if(newCssClass != "")
     this.ApplyImageClassName(images[i], newCssClass);
    if(newBackground != ""){
     if(__aspxWebKitFamily) {
      var savedBackground = _aspxGetAttribute(images[i].style, "background") + " " + images[i].style["backgroundPosition"];
      _aspxSetAttribute(images[i], "saved" + this.kind + "Background", savedBackground);
      _aspxSetAttribute(images[i].style, "background", newBackground);
     }
     else
      _aspxChangeAttributeExtended(images[i].style, "background", images[i], "saved" + this.kind + "Background", newBackground);
    }     
   }
  }
 },
 ApplyImageClassName: function(element, newClassName){
  _aspxSetAttribute(element, "saved" + this.kind + "ClassName", element.className);
  element.className = newClassName;
 },
 Cancel: function(element){
  if(!this.enabled) return;
  try{  
   this.CancelStyle(element);
   if(_aspxIsExists(this.imageObjs) && this.imageObjs.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.imageObjs[i]) || this.imageObjs[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");
    this.CancelImageClassName(images[i]);
    _aspxRestoreAttributeExtended(images[i].style, "background", images[i], "saved" + this.kind + "Background");
   }
  }
 },
 CancelImageClassName: function(element){
  var savedClassName = _aspxGetAttribute(element, "saved" + this.kind + "ClassName");
  if(savedClassName){
   element.className = savedClassName;
   _aspxRemoveAttribute(element, "saved" + this.kind + "ClassName");
  }
 },
 Clone: function(){
  return new ASPxStateItem(this.name, this.classNames, this.cssTexts, this.postfixes, 
   this.imageObjs, 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, imageObjs, imagePostfixes){
  this.AddItem(this.hoverItems, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, __aspxHoverItemKind);
  this.AddItem(this.focusedItems, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, __aspxFocusedItemKind);
 },
 AddPressedItem: function(name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes){
  this.AddItem(this.pressedItems, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, __aspxPressedItemKind);
 },
 AddSelectedItem: function(name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes){
  this.AddItem(this.selectedItems, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, __aspxSelectedItemKind);
 },
 AddDisabledItem: function(name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes){
  this.AddItem(this.disabledItems, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, __aspxDisabledItemKind);
 },
 AddItem: function(items, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, kind){
  var stateItem = new ASPxStateItem(name, classNames, cssTexts, postfixes, imageObjs, 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 imageObjs = _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, imageObjs, 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) {
 _aspxEmulateOnMouseDown(document, evt);
}
function _aspxEmulateOnMouseDown(element, evt) {
 if(__aspxIE)
  element.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.clientY, evt.ctrlKey, evt.altKey, evt.shiftKey, false, 0, null);
  element.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 __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(!ASPxIdent.IsASPxClientEdit(editor)) continue;
   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(!ASPxIdent.IsASPxClientEdit(editor)) continue;
   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() {
  if(!this.GetEnabled()){
   var inputElement = this.GetInputElement();
   if(_aspxIsExists(inputElement)) inputElement.blur();
   return;
  }
  ASPxClientEdit.prototype.OnFocusCore.call(this);
  if(this.maskInfo != null) {
   this.SavePrevMaskValue();
   this.BeginShowMaskHint();
  }
  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);
 }, 
 OnTextChanged: function() {
 },
 RaiseStandardOnChange: function(){
  var element = this.GetInputElement();
  if(_aspxIsExists(element) && _aspxIsExists(element.onchange)) {
   var eventMock = {
    target:this.GetInputElement()
   };
   element.onchange(eventMock);
  }
 },
 RaiseTextChanged: function(processOnServer){
  if(!this.TextChanged.IsEmpty()){
   var args = new ASPxClientProcessingModeEventArgs(processOnServer);
   this.TextChanged.FireEvent(this, args);
   processOnServer = args.processOnServer;
  }
  return processOnServer;  
 },
 GetText: function(){
  if(this.maskInfo != null) {
   return this.maskInfo.GetText();
  } else {
   var value = this.GetValue();
   return value != null ? value : "";
  }
 },
 SetText: function (value){
  if(this.maskInfo != null) {
   this.maskInfo.SetText(value);
   this.ApplyMaskInfo(false);
   this.SavePrevMaskValue();
  } else {
   this.SetValue(value);
  }
 },
 SelectAll: function() {
  this.SetSelection(0, -1, false);
 },
 SetCaretPosition: function(pos) {
  var inputElement = this.GetInputElement();
  _aspxSetCaretPosition(inputElement, pos);
 },
 SetSelection: function(startPos, endPos, scrollToSelection) { 
  var inputElement = this.GetInputElement();
  _aspxSetSelection(inputElement, startPos, endPos, scrollToSelection);
 },
 ChangeEnabledAttributes: function(enabled){
  var inputElement = this.GetInputElement();
  if(_aspxIsExists(inputElement)){
   this.ChangeInputEnabledAttributes(inputElement, _aspxChangeAttributesMethod(enabled), enabled);
   if(this.specialKeyboardHandlingUsed)
    this.ChangeSpecialInputEnabledAttributes(inputElement, _aspxChangeEventsMethod(enabled));
   this.ChangeInputEnabled(inputElement, enabled, this.readOnly);
  }
 },
 ChangeEnabledStateItems: function(enabled){
  if(!this.isNative) {
   var sc = aspxGetStateController();
   sc.SetElementEnabled(this.GetMainElement(), enabled);
   sc.SetElementEnabled(this.GetInputElement(), enabled);
  }
 },
 ChangeInputEnabled: function(element, enabled, readOnly){
  if(this.UseReadOnlyForDisabled())
   element.readOnly = !enabled || readOnly;
  else
   element.disabled = !enabled;
 },
 ChangeInputEnabledAttributes: function(element, method, enabled){
  if(enabled && __aspxWebKitFamily && element.tabIndex == -1)
   element.tabIndex = null;
  method(element, "tabIndex");
  if(!enabled) element.tabIndex = -1;
  method(element, "onclick");
  if(!this.NeedFocusCorrectionWhenDisabled())
   method(element, "onfocus");
  method(element, "onblur");
  method(element, "onkeydown");
  method(element, "onkeypress");
  method(element, "onkeyup");
 },
 UseReadOnlyForDisabled: function(){
  return (__aspxIE || __aspxOpera) && !this.isNative;
 },
 NeedFocusCorrectionWhenDisabled: function(){
  return __aspxIE && !this.isNative;
 }
});
ASPxIdent.IsASPxClientTextEdit = function(obj) {
 return _aspxIsExists(obj.isASPxClientTextEdit) && obj.isASPxClientTextEdit;
};
ASPxMaskValidationPattern = _aspxCreateClass(ASPxValidationPattern, {
 constructor: function(errorText, maskInfo) {
  this.constructor.prototype.constructor.call(this, errorText);
  this.maskInfo = maskInfo;
 },
 EvaluateIsValid: function(value) {
  return this.maskInfo.IsValid();
 }
});
ASPxClientTextBoxBase = _aspxCreateClass(ASPxClientTextEdit, {
 constructor: function(name) {
  this.constructor.prototype.constructor.call(this, name);
  this.sizingConfig.allowSetHeight = false;
  this.sizingConfig.adjustControl = true;
 }
});
ASPxClientTextBox = _aspxCreateClass(ASPxClientTextBoxBase, {
 constructor: function(name) {
  this.constructor.prototype.constructor.call(this, name);
  this.isASPxClientTextBox = true;
 }
});
ASPxIdent.IsASPxClientTextBox = function(obj) {
 return _aspxIsExists(obj.isASPxClientTextBox) && obj.isASPxClientTextBox;
};
var __aspxMMinHeight = 34;
ASPxClientMemo = _aspxCreateClass(ASPxClientTextEdit, { 
 constructor: function(name) {
  this.constructor.prototype.constructor.call(this, name);        
  this.isASPxClientMemo = true;
  this.raiseValueChangedOnEnter = false;
 },
 CollapseControl: function(checkSizeCorrectedFlag) {
  if (checkSizeCorrectedFlag && this.sizeCorrectedOnce)
   return;
  var mainElement = this.GetMainElement();
  var inputElement = this.GetInputElement();
  if (!_aspxIsExistsElement(mainElement) || !_aspxIsExistsElement(inputElement))
   return;
  ASPxClientTextEdit.prototype.CollapseControl.call(this, checkSizeCorrectedFlag);
  var mainElementCurStyle = _aspxGetCurrentStyle(mainElement);
  if (this.heightCorrectionRequired && _aspxIsExists(mainElement) && _aspxIsExists(inputElement)) {
   if (mainElement.style.height == "100%" || mainElementCurStyle.height == "100%") {
    mainElement.style.height = "0";
    mainElement.wasCollapsed = true;
   }
   inputElement.style.height = "0";
  }
 },
 CorrectEditorHeight: function() {
  var mainElement = this.GetMainElement();
  if(mainElement.wasCollapsed) {
   mainElement.wasCollapsed = null;
   _aspxSetOffsetHeight(mainElement, _aspxGetClearClientHeight(_aspxFindOffsetParent(mainElement)));
  }
  if(!this.isNative) {
   var inputElement = this.GetInputElement();
   var inputClearClientHeight = _aspxGetClearClientHeight(_aspxFindOffsetParent(inputElement));
   if(__aspxIE && __aspxBrowserVersion < 8)
     inputClearClientHeight -= 2;
   if(__aspxIE) {
    var calculatedMainElementStyle = _aspxGetCurrentStyle(mainElement);
    inputClearClientHeight += _aspxPxToInt(calculatedMainElementStyle.borderTopWidth) + _aspxPxToInt(calculatedMainElementStyle.borderBottomWidth);
   }
   if(inputClearClientHeight < __aspxMMinHeight)
    inputClearClientHeight = __aspxMMinHeight;
   _aspxSetOffsetHeight(inputElement, inputClearClientHeight);
   mainElement.style.height = "100%";
  }
 },
 SetWidth: function(width) {
  this.constructor.prototype.SetWidth.call(this, width);
  if(__aspxIE)
   this.AdjustControl();
 },
 SetHeight: function(height) {
  this.GetInputElement().style.height = "1px";
  this.constructor.prototype.SetHeight.call(this, height);
  this.GetInputElement().style.height = this.GetMainElement().clientHeight + "px";
 }
});
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(buttonIndex) {
  return false;
 },
 OnButtonClick: function(number){
  var processOnServer = this.RaiseButtonClick(number);
  if (!this.ProcessInternalButtonClick(number) && processOnServer)
   this.SendPostBack('BC:' + number);
 },
 SelectInputElement: function() {
  var element = this.GetInputElement();
  if(_aspxIsExistsElement(element)) {
   _aspxSetFocus(element);
   element.select();  
  }
 },
 RaiseButtonClick: function(number){
  var processOnServer = this.autoPostBack || this.IsServerEventAssigned("ButtonClick");
  if(!this.ButtonClick.IsEmpty()){
   var args = new ASPxClientButtonEditClickEventArgs(processOnServer, number);
   this.ButtonClick.FireEvent(this, args);
   processOnServer = args.processOnServer;
  }
  return processOnServer;
 },
 ChangeEnabledAttributes: function(enabled){
  ASPxClientTextEdit.prototype.ChangeEnabledAttributes.call(this, enabled);
  for(var i = 0; i < this.buttonCount; i++){
   var element = this.GetButton(i);
   if(_aspxIsExists(element)) 
    this.ChangeButtonEnabledAttributes(element, _aspxChangeAttributesMethod(enabled));
  }
 },
 ChangeEnabledStateItems: function(enabled){
  ASPxClientTextEdit.prototype.ChangeEnabledStateItems.call(this, enabled);
  for(var i = 0; i < this.buttonCount; i++){
   var element = this.GetButton(i);
   if(_aspxIsExists(element)) 
    aspxGetStateController().SetElementEnabled(element, enabled);
  }
 },
 ChangeButtonEnabledAttributes: function(element, method){
  method(element, "onclick");
  method(element, "ondblclick");
  method(element, "onmousedown");
  method(element, "onmouseup");
 },
 ChangeInputEnabled: function(element, enabled, readOnly){
  ASPxClientTextEdit.prototype.ChangeInputEnabled.call(this, element, enabled, readOnly || !this.allowUserInput);
 }
});
ASPxClientButtonEdit = _aspxCreateClass(ASPxClientButtonEditBase, {
});
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);
}
_aspxMaskPartBase = _aspxCreateClass(null, {
 typeCode: 1,
 constructor: function() {
  this.valueInitialized = false;
  this.dateTimeRole = null;
 },
 Grow: function(text) {
  throw "Not supported";
 },
 GetSize: function() {
  throw "Not supported";
 },
 GetValue: function() {
  this.EnsureValueInitialized();
  return this.GetValueCore();
 },
 EnsureValueInitialized: function() {
  if(this.valueInitialized) return;
  this.InitValue();
  this.valueInitialized = true;
 },
 InitValue: function() {
  throw "Not supported";
 }, 
 GetValueCore: function() {
  throw "Not supported";
 },
 Clear: function(startPos, endPos) {
 },
 HandleKey: function(maskInfo, keyInfo, pos) {
  throw "Not supported";
 },
 HandleControlKey: function(maskInfo, keyInfo, pos) {   
  switch(keyInfo.keyCode) {
   case ASPxKey.Left:
    if(keyInfo.ctrlState)
     maskInfo.MoveToPrevNonLiteral();
    else
     maskInfo.IncCaretPos(-1);
    break;
   case ASPxKey.Right:
    if(keyInfo.ctrlState)
     maskInfo.MoveToNextNonLiteral();
    else
     maskInfo.IncCaretPos(1);
    break;
  }
 },
 HandleMouseWheel: function(maskInfo, delta, pos) {
 },
 AllowIncreaseSize: function() { 
  return false; 
 },
 SupportsUpDown: function() { 
  return false; 
 },
 IsValid: function() {
  return true;
 },
 GetHintHtml: function() {
  return "";
 }
}); 
_aspxLiteralMaskPart = _aspxCreateClass(_aspxMaskPartBase, {
 typeCode: 2,
 constructor: function() {
  this.constructor.prototype.constructor.call(this);  
  this.literal = "";
 },
 Grow: function(text) {
  this.literal += text;
 }, 
 GetSize: function() {
  return this.literal.length;
 },
 InitValue: function() {
 }, 
 GetValueCore: function() {
  return this.literal;
 },
 HandleKey: function(maskInfo, keyInfo, pos) {
  if(keyInfo.keyCode == 32){
   maskInfo.IncCaretPos();
   return true;
  }
  var ch = String.fromCharCode(keyInfo.keyCode).toLowerCase();
  var index = this.GetValue().toLowerCase().indexOf(ch, pos);
  if(index > -1){
   maskInfo.IncCaretPos(index - pos + 1);
   return true;
  }
  maskInfo.IncCaretPos();
  return false;
 },
 HandleControlKey: function(maskInfo, keyInfo, pos) {
  switch(keyInfo.keyCode) {
   case ASPxKey.Right:
   case ASPxKey.Delete:
    maskInfo.IncCaretPos(this.GetSize() - pos);
    break;
   case ASPxKey.Left:    
   case ASPxKey.Backspace:
    maskInfo.IncCaretPos(-pos);
    break;
   default:
    _aspxMaskPartBase.prototype.HandleControlKey.call(this, maskInfo, keyInfo, pos);
  }
 }
}); 
_aspxEnumMaskPart = _aspxCreateClass(_aspxMaskPartBase, {
 typeCode: 3,
 constructor: function(items) {
  this.constructor.prototype.constructor.call(this);
  this.items = [];
  this.itemIndex = 0;
  this.defaultItemIndex = 0;
  this.PrepareItems(items);
 },
 PrepareItems: function(items){ 
  var hash = {};
  for(var i = 0; i < items.length; i++){
   var item = String(items[i]);
   if(item.length > 0 && !_aspxIsExists(hash[item])){
    if(item.charAt(0) == "*"){
     this.defaultItemIndex = i;
     item = item.substr(1);
    }
    this.items.push(item);
    hash[item] = 1;
   } 
  }
 },
 GetSize: function() {
  return this.GetValue().length;
 },
 InitValue: function() {  
  this.itemIndex = this.defaultItemIndex;
 }, 
 GetValueCore: function() {
  return this.items[this.itemIndex];
 },
 Clear: function(startPos, endPos) {
  this.ClearInternal(startPos);
 },
 ClearInternal: function(pos) {
  var prefix = this.GetValue().substr(0, pos);
  if(prefix.length < 1) {
   if(this.dateTimeRole == "t" || this.dateTimeRole == "M")
    this.itemIndex = 0;
   else
    this.itemIndex = this.defaultItemIndex;
  } else {
   this.itemIndex = this.FindItemIndexByPrefix(prefix);
  }
 },
 HandleKey: function(maskInfo, keyInfo, pos) {
  var ch = String.fromCharCode(keyInfo.keyCode);
  var prefix = this.GetValue().substr(0, pos) + ch;
  var index = this.FindItemIndexByPrefix(prefix);
  if(index < 0 && ch != " ") {
   maskInfo.SetCaret(maskInfo.caretPos, this.GetSize() - pos);
   return false;
  }
  if(index > -1)
   this.itemIndex = index;
  maskInfo.SetCaret(1 + maskInfo.caretPos, this.GetSize() - pos - 1);
  return true;
 },
 HandleControlKey: function(maskInfo, keyInfo, pos) {
  switch(keyInfo.keyCode) {
   case ASPxKey.Up:
    this.ChangeItemIndex(maskInfo, this.dateTimeRole != null ? 1 : -1, pos);
    break;
   case ASPxKey.Down:
    this.ChangeItemIndex(maskInfo, this.dateTimeRole != null ? -1 : 1, pos);
    break;    
   case ASPxKey.Backspace:
    if(keyInfo.ctrlState){
     this.itemIndex = this.defaultItemIndex;
     maskInfo.IncCaretPos(-pos);
    }
    else {
     this.ClearInternal(pos - 1);
     maskInfo.SetCaret(maskInfo.caretPos - 1, 0);
    }
    break;
   case ASPxKey.Delete:
    if(keyInfo.ctrlState){
     this.itemIndex = this.defaultItemIndex;
     maskInfo.IncCaretPos(this.GetSize() - pos);
    }
    else {
     this.ClearInternal(pos);
     maskInfo.SetCaret(maskInfo.caretPos + 1, 0);
    }
    break;    
   default:
    _aspxMaskPartBase.prototype.HandleControlKey.call(this, maskInfo, keyInfo, pos);
  }
 },
 HandleMouseWheel: function(maskInfo, delta, pos) {
  if(this.dateTimeRole == null)
   delta = -delta;
  this.ChangeItemIndex(maskInfo, delta, pos);
 },
 ChangeItemIndex: function(maskInfo, delta, pos) {
  this.itemIndex += delta;
  while(this.itemIndex < 0)
   this.itemIndex += this.items.length;
  while(this.itemIndex > this.items.length - 1)
   this.itemIndex -= this.items.length;
  maskInfo.SetCaret(maskInfo.caretPos - pos, this.GetSize());
 },
 FindItemIndexByPrefix: function(prefix) {  
  prefix = prefix.toLowerCase();
  for(var i = 0; i < this.items.length; i++) {
   var item = this.items[i];
   if(item.toLowerCase().indexOf(prefix) == 0)
    return i;
  }
  return -1;
 },
 SupportsUpDown: function() { 
  return true; 
 },
 GetHintHtml: function() {
  if(this.dateTimeRole != null)
   return "";
  var list = [];
  for(var i = 0; i < this.items.length; i++) {
   var text = this.items[i];
   if(i == this.itemIndex)
    text = "<strong>" + text + "</strong>";
   list.push(text);
  }
  return list.join(", ");
 }
});
_aspxRangeMaskPart = _aspxCreateClass(_aspxMaskPartBase, {
 typeCode: 4,
 constructor: function(minNumber, maxNumber) {
  this.constructor.prototype.constructor.call(this);  
  if(maxNumber < minNumber)
   maxNumber = minNumber;  
  this.minNumber = minNumber;
  this.maxNumber = maxNumber;
  this.defaultNumber = null;
  this.zeroFill = false;
  this.absNumber = 0;
  this.negative = false;
  this.enableGroups = false;
 },
 GetSize: function() {
  return this.GetValue().length;
 },
 InitValue: function() {
  var number = 0;
  if(this.defaultNumber != null)
   number = this.defaultNumber;
  else {
   if(this.maxNumber < 0)
    number = this.maxNumber;
   else if(this.minNumber < 0)
    number = 0;
   else
    number = this.minNumber;
  }
  this.SetNumber(number);
 }, 
 GetValueCore: function() {
  var value = String(this.absNumber);  
  if(this.zeroFill) {
   var size = Math.max(this.minNumber.toString().length, this.maxNumber.toString().length);
   var incSize = size - value.length;
   for(var i = 0; i < incSize; i++)
    value = "0" + value;
  }
  if(this.enableGroups)
   value = this.AddGroupSeparators(value);
  if(this.negative)
   value = "-" + value;
  return value;
 },
 AddGroupSeparators: function(text) {
  if(text.length < 4)
   return text;
  var temp = [ ];
  var count = Math.ceil(text.length / 3);
  for(var i = 1; i < count; i++)
   temp.unshift(text.substr(text.length - i * 3, 3));
  temp.unshift(text.substr(0, text.length % 3 || 3));
  return temp.join(__aspxCultureInfo.numGroupSeparator);
 },
 IsGroupSeparatorPos: function(pos) {
  if(!this.enableGroups)
   return false;
  var reversePos = this.GetSize() - pos;
  return reversePos > 0 && reversePos % 4 == 0;
 }, 
 GetNumber: function() {
  var result = this.absNumber;
  if(this.negative)
   result = -result;
  return result;
 },
 SetNumber: function(number) {
  this.negative = (number < 0);
  this.absNumber = Math.abs(number);
 },
 SetText: function(text, checkMinNumber) {
  checkMinNumber = checkMinNumber || Math.abs(this.minNumber) < 2;
  if(text == "") text = "0";
  if(text == "-") text = "-0";
  if(this.enableGroups) {
   text = text.split(__aspxCultureInfo.numGroupSeparator).join("");
  }
  var number = Number(text);
  if(number > this.maxNumber) {
   this.SetNumber(this.maxNumber);
  } else if(checkMinNumber && number < this.minNumber) {
   this.SetNumber(this.minNumber);
  } else {
   this.absNumber = Math.abs(number);
   this.negative = (text.indexOf("-") > -1);
  }  
 },
 Clear: function(startPos, endPos){
  var newText = _aspxInsertEx(this.GetValue(), "", startPos, endPos);
  if(newText.length == 0 && this.dateTimeRole == "h")
   newText = "12";
  this.SetText(newText, true);
 },
 HandleKey: function(maskInfo, keyInfo, pos) { 
  var keyCode = keyInfo.keyCode;    
  var ch = String.fromCharCode(keyCode);
  if((ch == __aspxCultureInfo.numGroupSeparator && this.IsGroupSeparatorPos(pos)
   || keyCode == 32) && pos < this.GetSize()) {
   maskInfo.IncCaretPos();
   return true;
  }
  var oldNumber = this.GetNumber();
  if(_aspxMaskManager.IsSignumCode(keyCode)) {
   if((ch == "-" && this.minNumber < 0)  || (ch == "+" && oldNumber < 0)) {      
    var newNumber = -oldNumber;
    if(this.CheckRange(newNumber)) {
     this.negative = !this.negative;
     maskInfo.SetCaret(maskInfo.caretPos - pos + (this.negative ? 1 : 0), 0);
     return true;
    }
   }
  }
  if(_aspxMaskManager.IsDigitCode(keyCode)) {
   if(!this.zeroFill && ch == "0" && oldNumber == 0 && pos > this.GetSize() - 1)
    return false;
   this.TryTypeAtPos(maskInfo, ch, pos, 1);
   return true;
  }
  return false;
 },
 HandleControlKey: function(maskInfo, keyInfo, pos) {
  switch(keyInfo.keyCode) {
   case ASPxKey.Up:    
    this.ChangeNumber(maskInfo, 1, pos);
    break;
   case ASPxKey.Down:
    this.ChangeNumber(maskInfo, -1, pos);
    break;
   case ASPxKey.Delete:
    if(keyInfo.ctrlState) {    
     var newText = this.GetValue().substr(0, pos);
     this.SetText(newText, false);
     maskInfo.IncCaretPos(this.GetSize() - pos);
    } else {        
     if(this.IsGroupSeparatorPos(pos)) {
      maskInfo.IncCaretPos();
     } else {        
      if(this.zeroFill)
       this.TryTypeAtPos(maskInfo, "0", pos, 1);
      else
       this.TryTypeAtPos(maskInfo, "", pos, 1);
    }
    }
    break;
   case ASPxKey.Backspace:
    if(keyInfo.ctrlState) {    
     var newText = this.GetValue().substr(pos);
     this.SetText(newText, false);
     maskInfo.IncCaretPos(-pos);
    } else {       
     if(this.IsGroupSeparatorPos(pos - 1)) {
      maskInfo.IncCaretPos(-1);
     } else {
      if(this.zeroFill)
       this.TryTypeAtPos(maskInfo, "0", pos, -1);
      else
       this.TryTypeAtPos(maskInfo, "", pos, -1);
     }
    }
    break;
   default:
    _aspxMaskPartBase.prototype.HandleControlKey.call(this, maskInfo, keyInfo, pos);
  }
 },
 HandleMouseWheel: function(maskInfo, delta, pos) {
  this.ChangeNumber(maskInfo, delta, pos);
 },
 ChangeNumber: function(maskInfo, delta, pos) {
  var number = this.GetNumber();
  if(number < this.minNumber)
   number = this.minNumber;
  var newNumber = number + delta;
  while(newNumber < this.minNumber)
   newNumber += 1 + this.maxNumber - this.minNumber;
  while(newNumber > this.maxNumber)
   newNumber -= 1 + this.maxNumber - this.minNumber;
  this.SetNumber(newNumber);
  maskInfo.SetCaret(maskInfo.caretPos - pos, this.GetSize()); 
 },
 CheckRange: function(number){
  return (this.minNumber <= number && number <= this.maxNumber);
 },
 TryTypeAtPos: function(maskInfo, str, pos, dir) {
  if(dir > 0 && this.IsGroupSeparatorPos(pos)) {
   pos++;
   maskInfo.IncCaretPos();
  }
  var oldSize = this.GetSize();
  var strPos = pos;
  if(dir < 0) strPos -= 1;
  var newText = _aspxInsertEx(this.GetValue(), str, strPos, strPos + 1);
  this.SetText(newText, false);
  var newPos;
  if(dir > 0 && oldSize == pos) {
   newPos = this.GetSize();
  } else  {      
   var diff = 0;
   if(!this.zeroFill) {
    diff = this.GetSize() - oldSize;
    if(dir < 0) diff += 1;
    if(diff > 0) diff = 0;
   }
   newPos = pos + dir + diff;
  }
  if(newPos < 0) newPos = 0;  
  if(newPos > this.GetSize()) newPos = this.GetSize();
  if(this.IsGroupSeparatorPos(newPos))
   newPos++;
  maskInfo.IncCaretPos(newPos - pos);
 }, 
 AllowIncreaseSize: function() {
  if(this.zeroFill) return false;
  var currentNumber = this.GetNumber();
  if(currentNumber < 0)
   return currentNumber * 10 >= this.minNumber;
  if(currentNumber >= 0)
   return currentNumber * 10 <= this.maxNumber;
  return false;
 },
 SupportsUpDown: function() { 
  return true; 
 },
 GetHintHtml: function() {
  if(this.dateTimeRole != null)
   return ""; 
  return this.minNumber + ".." + this.maxNumber;
 }
}); 
_aspxPromptMaskPart = _aspxCreateClass(_aspxMaskPartBase, {
 typeCode: 5,
 constructor: function() {
  this.constructor.prototype.constructor.call(this);
  this.required = false;
  this.size = 0;
  this.text = "";
 },
 Grow: function(text) {
  this.size += text.length;
 }, 
 GetSize: function() {
  return this.size;
 },
 InitValue: function() {  
  var size = this.GetSize();
  for(var i = 0; i < size; i++)
   this.text += " ";
 }, 
 GetValueCore: function() {
  return this.text;
 },
 Clear: function(startPos, endPos){
  this.ClearInternal(startPos, endPos - startPos);
 },
 ClearInternal: function(pos, count){
  for(var  i = 0; i < count; i++)
   this.SetCharInPos(" ", i + pos);         
 },
 HandleKey: function(maskInfo, keyInfo, pos) {
  var keyCode = keyInfo.keyCode;  
  if(maskInfo.IsPromptCode(keyCode))
   keyCode = 32;
  if(keyCode != 32 && !this.IsValidCharCode(keyCode, pos))
   return false;
  this.SetCharInPos(String.fromCharCode(keyCode), pos);
  maskInfo.IncCaretPos();
  return true;
 },
 HandleControlKey: function(maskInfo, keyInfo, pos) {
  switch(keyInfo.keyCode) {
   case ASPxKey.Delete:
    var count = keyInfo.ctrlState ? this.GetSize() - pos : 1;
    this.ClearInternal(pos, count);
    maskInfo.IncCaretPos(count);
    break; 
   case ASPxKey.Backspace:
    var count = keyInfo.ctrlState ? pos : 1;
    this.ClearInternal(pos - count, count);
    maskInfo.IncCaretPos(-count);
    break;
   default:
    _aspxMaskPartBase.prototype.HandleControlKey.call(this, maskInfo, keyInfo, pos);
  }
 }, 
 SetCharInPos: function(ch, pos) {
  this.text = _aspxInsertEx(this.GetValue(), ch, pos, pos + 1);
 }, 
 IsValidCharCode: function(code, pos) {
  throw "Not supported";
 },
 IsValid: function() {
  if(!this.required)
   return true;
  return this.GetValue().indexOf(" ") < 0;
 }
});
_aspxNumericMaskPart = _aspxCreateClass(_aspxPromptMaskPart, {
 typeCode: 6,
 constructor: function() {
  this.constructor.prototype.constructor.call(this);
  this.acceptsSignum = false;
 },
 IsValidCharCode: function(code, pos) {
  if(_aspxMaskManager.IsSignumCode(code)) {
   if(!this.acceptsSignum) return false;
   var value = this.GetValue();
   for(var i = 0; i < pos; i++){
    var currentCode = value.charCodeAt(i);
    if(_aspxMaskManager.IsDigitCode(currentCode) || _aspxMaskManager.IsSignumCode(currentCode))
     return false;
   }
   return true;
  }
  return _aspxMaskManager.IsDigitCode(code);
 } 
});
_aspxCharMaskPart = _aspxCreateClass(_aspxPromptMaskPart, {
 typeCode: 7,
 constructor: function() {
  this.constructor.prototype.constructor.call(this);
  this.caseConvention = 0;
 },
 SetCharInPos: function(ch, pos) {
  if(this.caseConvention < 0)
   ch = ch.toLowerCase();
  if(this.caseConvention > 0)
   ch = ch.toUpperCase();   
  _aspxPromptMaskPart.prototype.SetCharInPos.call(this, ch, pos);
 }, 
 IsValidCharCode: function(code, pos) {
  return code > 31;
 }
});
_aspxAlphaMaskPart = _aspxCreateClass(_aspxCharMaskPart, {
 typeCode: 8,
 IsValidCharCode: function(code, pos) {
  return _aspxMaskManager.IsAlphaCode(code);
 }
}); 
_aspxAlphaNumericMaskPart = _aspxCreateClass(_aspxCharMaskPart, {
 typeCode: 9,
 IsValidCharCode: function(code, pos) {
  return _aspxMaskManager.IsAlphaCode(code) || _aspxMaskManager.IsDigitCode(code);
 } 
}); 
_aspxMaskParser = {
 Parse: function(mask, dateTimeOnly) {
  this.result = [ ];
  this.currentCaseConvention = 0;  
  this.quoteMode = null;
  this.dateTimeOnly = (dateTimeOnly === true);
  mask.replace(this.GetMasterRegex(), this.ParseCallback);
  return this.result;
 },
 regex: {    
  ranges: "\\<-?\\d+(\\.\\.-?\\d+){1,2}g?\\>",
  enums: "\\<\\*?[^|*<>]*(\\|\\*?[^|*<>]*)+\\>",
  prompts: "[LlAaCc09#,.:/$<>~]",
  dates: "(y{1,4}|M{1,4}|d{1,4}|hh?|HH?|mm?|ss?|F{1,6}|f{1,6}|tt?)"
 }, 
 GetMasterRegex: function() {
  if(this.dateTimeOnly) {
   if(!this.__masterDateTimeOnlyRegex)
    this.__masterDateTimeOnlyRegex = this.CreateMasterRegex(true);
   return this.__masterDateTimeOnlyRegex;      
  }
  if(!this.__masterRegex)
   this.__masterRegex = this.CreateMasterRegex(false);
  return this.__masterRegex;
 }, 
 GetRangesRegex: function() {
  if(!this.__rangesRegex) 
   this.__rangesRegex = this.CreateAnchoredRegex(this.regex.ranges);
  return this.__rangesRegex;
 },
 GetEnumsRegex: function() {
  if(!this.__enumsRegex) 
   this.__enumsRegex = this.CreateAnchoredRegex(this.regex.enums);
  return this.__enumsRegex;
 },
 GetDatesRegex: function() {
  if(!this.__datesRegex)
   this.__datesRegex = this.CreateAnchoredRegex(this.regex.dates);
  return this.__datesRegex;
 },
 CreateAnchoredRegex: function(text) {
  return new RegExp("^" + text + "$");
 },
 CreateMasterRegex: function(dateTimeOnly) {
  var list = [ ];
  this.PushConditional(list, "\\\\\\\\", true);
  this.PushConditional(list, "\\\\[\"']", true);
  this.PushConditional(list, "[\"']", true);
  this.PushConditional(list, this.regex.ranges, !dateTimeOnly);
  this.PushConditional(list, this.regex.enums, !dateTimeOnly);
  this.PushConditional(list, "\\\\" + this.regex.dates, true);
  this.PushConditional(list, "\\\\" + this.regex.prompts, !dateTimeOnly);
  this.PushConditional(list, this.regex.dates, true);
  this.PushConditional(list, this.regex.prompts, !dateTimeOnly);
  this.PushConditional(list, ".", true);
  return new RegExp("(" + list.join("|") + ")", "g");
 },
 PushConditional: function(list, item, allow) {
  if(allow)
   list.push(item); 
 },
 ParseCallback: function(text) {  
  _aspxMaskParser.ParseCore(text, null);
 },
 ParseCore: function(text, dateTimeRole) {
  var acceptRangesEnums = (dateTimeRole != null || !this.dateTimeOnly);
  if(text == "'" || text == '"')
   this.ParseQuote(text);
  else if(this.quoteMode != null)
   this.ParseLiteral(text);
  else if(acceptRangesEnums && this.GetRangesRegex().test(text)) 
   this.ParseRange(text, dateTimeRole);
  else if(acceptRangesEnums && this.GetEnumsRegex().test(text)) 
   this.ParseEnum(text, dateTimeRole);
  else if(this.GetDatesRegex().test(text))
   this.ParseDate(text);
  else
   this.ParseSimple(text);
 },
 ParseRange: function(text, dateTimeRole) {  
  var enableGroups = false;
  text = this.StripBrockets(text);
  if(text.charAt(text.length - 1) == "g") {
   enableGroups = true;
   text = text.substr(0, text.length - 1);
  }
  var data = text.split("..");
  var minNumber, maxNumber = 0;
  var defaultNumber = null;
  if(data.length == 2){
   minNumber = Number(data[0]);
   maxNumber = Number(data[1]);
  }
  else if(data.length == 3){
   minNumber = Number(data[0]);
   maxNumber = Number(data[2]);
   defaultNumber = Number(data[1]);
  }
  var part = new _aspxRangeMaskPart(minNumber, maxNumber);
  part.defaultNumber = defaultNumber;
  part.zeroFill = (data[0] == "00") || (data[0].length > 1 && data[0].charAt(0) == "0");
  part.dateTimeRole = dateTimeRole;
  part.enableGroups = enableGroups;
  this.result.push(part);
 },
 ParseEnum: function(text, dateTimeRole) {
  text = this.StripBrockets(text);
  var part = new _aspxEnumMaskPart(text.split("|"));
  part.dateTimeRole = dateTimeRole;
  this.result.push(part);
 },
 StripBrockets: function(text) {
  return text.substr(1, text.length - 2);
 },   
 ParseSimple: function(text) {  
  switch(text) {
   case ":":
    this.ParseLiteral(__aspxCultureInfo.ts);
    break;
   case "/":
    this.ParseLiteral(__aspxCultureInfo.ds);
    break;
   default:
    if(this.dateTimeOnly) {
     this.ParseLiteral(text);     
    } else {
     switch(text) {
      case "L":
      case "l":
       this.ParseChar(text, _aspxAlphaMaskPart, text == "L");
       break;
      case "A":
      case "a":
       this.ParseChar(text, _aspxAlphaNumericMaskPart, text == "A");   
       break;
      case "C":
      case "c":
       this.ParseChar(text, _aspxCharMaskPart, text == "C");
       break;
      case ">":
        this.currentCaseConvention = 1;
        break;       
      case "<":
        this.currentCaseConvention = -1;
        break;      
      case "~":
        this.currentCaseConvention = 0;
        break;       
      case "0":
      case "9":
      case "#":
       this.ParseNumeric(text);   
       break;
      case ".":
       this.ParseLiteral(__aspxCultureInfo.numDecimalPoint);
       break;
      case ",":
       this.ParseLiteral(__aspxCultureInfo.numGroupSeparator);
       break;
      case "$":
       this.ParseLiteral(__aspxCultureInfo.currency);
       break;
      default:
       this.ParseLiteral(text);
       break;                       
     }
    }    
    break;
  }
 },
 ParseChar: function(text, ctor, required) {
  var part = this.GetCurrentPart();
  if(part == null || part.typeCode != ctor.prototype.typeCode || part.required != required || part.caseConvention != this.currentCaseConvention) {
   part = new ctor();
   part.required = required;
   part.caseConvention = this.currentCaseConvention;
   this.result.push(part);
  }
  part.Grow(text);
 },
 ParseNumeric: function(text) {
  var required = text == "0";
  var acceptsSignum = text == "#";
  var part = this.GetCurrentPart();
  if(part == null || part.typeCode != _aspxNumericMaskPart.prototype.typeCode || part.required != required || part.acceptsSignum != acceptsSignum) {
   part = new _aspxNumericMaskPart();
   part.required = required;
   part.acceptsSignum = acceptsSignum;
   this.result.push(part);
  }
  part.Grow(text);
 },
 ParseLiteral: function(text) {
  var part = this.GetCurrentPart();
  if(part == null || part.typeCode != _aspxLiteralMaskPart.prototype.typeCode) {
   part = new _aspxLiteralMaskPart();
   this.result.push(part);
  }
  if(text.length > 0 && text.charAt(0) == "\\")
   text = text.substr(1);
  part.Grow(text);
 },
 GetCurrentPart: function() {
  var len = this.result.length;
  if(len < 1)
   return null;
  return this.result[len - 1];
 },
 ParseDate: function(text) {
  this.ParseCore(this.GetDateSpecifierReplacement(text), this.GetDateTimeRole(text));
 },
 GetDateSpecifierReplacement: function(text) {
  var now = this.now || new Date();
  switch(text) {
   case "yyyy":    
    return "<0100.." + now.getFullYear() + "..9999>"; 
   case "yyy":    
    return "<100.." + now.getFullYear() + "..9999>"; 
   case "yy":    
    return "<00.." + (now.getFullYear() % 100) + "..99>";
   case "y":    
    return "<0.." + (now.getFullYear() % 100) + "..99>";
   case "MMMM":    
    return "<" + this.GetEnumItems(__aspxCultureInfo.genMonthNames, now.getMonth()).join("|") + ">";
   case "MMM":    
    return "<" + this.GetEnumItems(__aspxCultureInfo.abbrGenMonthNames, now.getMonth()).join("|") + ">";
   case "MM":    
    return "<01.." + (now.getMonth() + 1) + "..12>";
   case "M":    
    return "<1.." + (now.getMonth() + 1) + "..12>";
   case "dddd":
    return "<" + this.GetEnumItems(__aspxCultureInfo.dayNames, now.getDay()).join("|") + ">";
   case "ddd":
    return "<" + this.GetEnumItems(__aspxCultureInfo.abbrDayNames, now.getDay()).join("|") + ">";
   case "dd":    
    return "<01.." + now.getDate() + "..31>";
   case "d":    
    return "<1.." + now.getDate() + "..31>";
   case "hh":
    return "<01.." + this.GetShortHours(now) + "..12>";
   case "h":
    return "<1.." + this.GetShortHours(now) + "..12>";
   case "HH":
    return "<00.." + now.getHours() + "..23>";
   case "H":
    return "<0.." + now.getHours() + "..23>";
   case "mm":
    return "<00.." + now.getMinutes() + "..59>";
   case "m":
    return "<0.." + now.getMinutes() + "..59>";
   case "ss":
    return "<00.." + now.getSeconds() + "..59>";
   case "s":
    return "<0.." + now.getSeconds() + "..59>";
   case "tt":
   case "t":
    if(__aspxCultureInfo.am.length < 1)
     return "";
    return "<" + this.GetAmPmArray(now.getHours(), text.length == 1).join("|") + ">";
  }
  if(/^f{1,6}$/i.test(text)) {
   if(text.length == 1)
    return "<0..9>";
   if(text.length == 2)
    return "<0..99>";    
   return "<0..999>";
  }
  throw "Not supported";
 },  
 GetDateTimeRole: function(text) {
  var ch = text.charAt(0);
  if(ch == "y" || ch == "M" || ch =="d"
   || ch.toLowerCase() == "h" || ch == "m" || ch == "s" 
   || ch.toLowerCase() == "f" || ch == "t")
   return ch;
  return null;
 },
 GetEnumItems: function(items, defaultIndex){
   var result = [].concat(items);
   result[defaultIndex] = "*" + result[defaultIndex];
   return result;
 },
 GetShortHours: function(date){
  var result = (date.getHours() % 12);
  if(result == 0) result = 12;
  return result;
 },
 GetAmPmArray: function(hours, useFirstChar){
  var result = [__aspxCultureInfo.am, __aspxCultureInfo.pm];
  for(var i = 0; i < result.length; i++){
   if(useFirstChar)
    result[i] = result[i].charAt(0);
  }
  if(hours > 12)
   result[1] = "*" + result[1];
  return result;
 },
 ParseQuote: function(text) {  
  if(this.quoteMode == null) {
   this.quoteMode = text;
  } else {
   if(text == this.quoteMode)
    this.quoteMode = null;
   else
    this.ParseLiteral(text);
  }
 }
};
_aspxMaskIncludeLiterals = {
 All: 1,
 None: 2,
 DecimalSymbol: 3 
};
_aspxMaskInfo = _aspxCreateClass(null, { 
 constructor: function() {   
  this.parts = null;
  this.promptChar = "_";  
  this.includeLiterals = _aspxMaskIncludeLiterals.All;  
  this.errorText = "";
  this.caretPos = 0;
  this.selectionLength = 0; 
  this.lastEditedPart = null;
 },
 GetSize: function() { 
  var size = 0;
  for(var i = 0; i < this.parts.length; i++)
   size += this.parts[i].GetSize();
  return size;
 },
 GetText: function() {
  var result = "";
  for(var i = 0; i < this.parts.length; i++) {
   var part = this.parts[i];
   if(_aspxMaskManager.IsLiteralPart(part) || _aspxMaskManager.IsEnumPart(part))
    result += part.GetValue();
   else
    result += part.GetValue().split(" ").join(this.promptChar);
  }
  return result;
 },
 GetValue: function() {
  var list = [];
  for(var i = 0; i < this.parts.length; i++) {
   var part = this.parts[i];
   var partValue = part.GetValue();
   if(_aspxMaskManager.IsLiteralPart(part) && _aspxMaskManager.IsIgnorableLiteral(partValue, this.includeLiterals))
     continue;
   if(_aspxMaskManager.IsRangePart(part) && this.includeLiterals != _aspxMaskIncludeLiterals.All)
    partValue = partValue.split(__aspxCultureInfo.numGroupSeparator).join("");
   list.push(partValue);
  }  
  return list.join("");
 },
 SetText: function(text) {
  this.Clear();
  this.SetCaret(0, 0);
  this.SetValueCore(text, _aspxMaskIncludeLiterals.All);
  this.SetCaret(0, 0);
 },
 SetValue: function(value) {
  this.Clear();
  this.SetCaret(0, 0);
  this.SetValueCore(value, this.includeLiterals);
  this.SetCaret(0, 0);
 },
 SetValueCore: function(value, includeLiterals) {
  for(var i = 0; i < value.length; i++) {
   var keyInfo = _aspxMaskManager.CreateKeyInfo(value.charCodeAt(i), false, false);
   _aspxMaskManager.HandleKey(this, keyInfo, false, includeLiterals);
  }
 },
 Clear: function() {
  for(var i = 0; i < this.parts.length; i++) {
   var part = this.parts[i];
   part.Clear(0, part.GetSize());
  }
 },
 ProcessPaste: function(rawText, caretPosAfterPaste) {
  var currentText = this.GetText();
  var leadLength = 0;
  for(var i = 0; i < Math.min(rawText.length, currentText.length); i++) {
   if(rawText.charAt(i) != currentText.charAt(i))
    break;
   leadLength++;
  }
  var pastedText = rawText.substr(leadLength, caretPosAfterPaste - leadLength);  
  this.SetCaret(caretPosAfterPaste - pastedText.length, 0);
  var padLength = 0;
  for(var i = pastedText.length + rawText.length; i < currentText.length; i++) {
   pastedText += " ";
   padLength++;
  }
  this.SetValueCore(pastedText, _aspxMaskIncludeLiterals.All);
  this.caretPos -= padLength;
 },
 IsValid: function() {
  for(var i = 0; i < this.parts.length; i++) {
   if(!this.parts[i].IsValid())
    return false;
  }
  return true;
 },
 SetCaret: function(caretPos, selectionLength) {
  if(selectionLength < 0) throw "Internal Error";
  this.caretPos = caretPos;
  this.selectionLength = selectionLength;
 },
 IncCaretPos: function(delta) {
  if(!_aspxIsExists(delta))
   delta = 1;
  this.caretPos += delta;
  this.selectionLength = 0;
 },
 MoveToPrevNonLiteral: function() {
  var partPos = 0;
  var resultPos = 0;
  for(var i = 0; i < this.parts.length; i++) {
   if(partPos >= this.caretPos)
    break;
   var part = this.parts[i];
   var nextPartPos = partPos + part.GetSize();
   if(!_aspxMaskManager.IsLiteralPart(part))
    resultPos = nextPartPos < this.caretPos ? nextPartPos : partPos;
   partPos = nextPartPos;
  }
  this.SetCaret(resultPos, 0);
 },  
 MoveToNextNonLiteral: function() {
  var partPos = 0;
  for(var i = 0; i < this.parts.length; i++) {
   var part = this.parts[i];
   var nextPartPos = partPos + part.GetSize();   
   if(nextPartPos > this.caretPos && !_aspxMaskManager.IsLiteralPart(part)) {
    if(partPos <= this.caretPos)
     partPos = nextPartPos;
    break;
   }
   partPos = nextPartPos;
  }
  this.SetCaret(partPos, 0);
 }, 
 IsPromptCode: function(code) {
  return (code == 32 || code == this.promptChar.charCodeAt(0));
 },
 BeforeChange: function(part) {
  this.ApplyFixes(part);
  this.lastEditedPart = part;
  part.EnsureValueInitialized();
 },
 AfterChange: function(part) {
 },
 ApplyFixes: function(currentPart) {
  var result1 = this.FixLastRangePart(currentPart);
  var result2 = this.FixLastDatePart(currentPart);
  return result1 || result2;
 },
 FixLastRangePart: function(currentPart) {  
  var part = this.lastEditedPart;
  if(!part || part == currentPart || !_aspxMaskManager.IsRangePart(part))
   return false;
  var number = part.GetNumber();
  if(number >= part.minNumber) 
   return false;
  var prevSize = part.GetSize();
  part.SetNumber(part.minNumber);
  this.SetCaret(this.caretPos + part.GetSize() - prevSize, 0);
  return true;
 },
 FixLastDatePart: function(currentPart) {
  var part = this.lastEditedPart;
  if(!part || part == currentPart || part.dateTimeRole == null)
   return false;
  var bag = _aspxMaskDateTimeHelper.GetDateBag(this);
  if(!bag.hasDate)
   return false;
  var maxDay = _aspxMaskDateTimeHelper.GetMaxDayInMonth(bag.month, bag.year);
  if(bag.day > maxDay) {   
   if(bag.day == 29 && bag.month == 1) {
    bag.year = _aspxMaskDateTimeHelper.GetNextLeapYear(bag.year);
   } else {
    if(part.dateTimeRole == "d")
     bag.month--;
    else
     bag.day = maxDay;
   }   
  }
  var prefixSize = this.GetSizeBeforeEditedPart(currentPart);
  _aspxMaskDateTimeHelper.SetDate(this, _aspxMaskDateTimeHelper.CreateDateFromBag(bag, true));
  this.caretPos += this.GetSizeBeforeEditedPart(currentPart) - prefixSize;
  return true;
 },
 GetSizeBeforeEditedPart: function(currentPart) {
  var pos = 0;
  for(var i = 0; i < this.parts.length; i++) {
   if(this.parts[i] == currentPart)
    break;
   pos += this.parts[i].GetSize();
  }
  return pos;
 } 
});
_aspxMaskInfo.Create = function(maskText, dateTimeOnly) {
 var info = new _aspxMaskInfo();
 info.parts = _aspxMaskParser.Parse(maskText, dateTimeOnly);
 return info;
}
_aspxMaskManager = {
 OnKeyPress: function(maskInfo, keyInfo) {
  if(maskInfo.selectionLength > 0)
   this.ClearSelection(maskInfo);
  this.HandleKey(maskInfo, keyInfo, true, _aspxMaskIncludeLiterals.All);
 },
 OnKeyDown: function(maskInfo, keyInfo) {
  if(maskInfo.selectionLength > 0 && (keyInfo.keyCode == ASPxKey.Backspace || keyInfo.keyCode == ASPxKey.Delete))
   this.ClearSelection(maskInfo);
  else
   this.HandleControlKey(maskInfo, keyInfo);
 },
 OnMouseWheel: function(maskInfo, delta) {
  this.HandleMouseWheel(maskInfo, delta);
 },
 HandleKey: function(maskInfo, keyInfo, autoSkipLiterals, includeLiterals) { 
  var partStart = 0;
  var caretInfoBeforeSkip = null;  
  for(var i = 0; i < maskInfo.parts.length; i++) {
   var part = maskInfo.parts[i];
   if(this.IsCaretInPart(maskInfo.caretPos, partStart, part)) {    
    if(!this.IsLiteralPart(part) || !this.IsIgnorableLiteral(part.GetValue(), includeLiterals)) {
     var savedCaretPos = maskInfo.caretPos;
     maskInfo.BeforeChange(part);
     partStart += maskInfo.caretPos - savedCaretPos;
     if(this.savedKeyDownKeyInfo && this.savedKeyDownKeyInfo.keyCode == ASPxKey.Decimal)
      keyInfo.keyCode = __aspxCultureInfo.numDecimalPoint.charCodeAt(0);
     if(part.HandleKey(maskInfo, keyInfo, maskInfo.caretPos - partStart)) {        
      if(autoSkipLiterals)
       this.TrySkipLiteralOnPartEdge(maskInfo, partStart, i);
      maskInfo.AfterChange(part);
      return;
     }
     if(caretInfoBeforeSkip == null)
      caretInfoBeforeSkip = [ maskInfo.caretPos, maskInfo.selectionLength ];
    }         
    maskInfo.SetCaret(partStart + part.GetSize(), 0);
   }
   partStart += part.GetSize();
  }
  if(caretInfoBeforeSkip != null)
   maskInfo.SetCaret(caretInfoBeforeSkip[0], caretInfoBeforeSkip[1]);
 },
 HandleControlKey: function(maskInfo, keyInfo) {
  maskInfo.selectionLength = 0;
  var partStart = 0;  
  for(var i = 0; i < maskInfo.parts.length; i++) {
   var part = maskInfo.parts[i];
   if(this.IsCaretInPartOnControlKey(maskInfo.caretPos, partStart, part, keyInfo.keyCode)) {
    var savedCaretPos = maskInfo.caretPos;
    maskInfo.BeforeChange(part);
    partStart += maskInfo.caretPos - savedCaretPos;
    part.HandleControlKey(maskInfo, keyInfo, maskInfo.caretPos - partStart);
    if(keyInfo.keyCode == ASPxKey.Delete)
     this.TrySkipLiteralOnPartEdge(maskInfo, partStart, i);
    maskInfo.AfterChange(part);
    break;
   }
   partStart += part.GetSize();
  }
 },
 HandleMouseWheel: function(maskInfo, delta) {
  var partStart = 0;  
  for(var i = 0; i < maskInfo.parts.length; i++) {
   var part = maskInfo.parts[i];
   if(this.IsCaretInPartOnMouseWheel(maskInfo.caretPos, partStart, part)) {
    var savedCaretPos = maskInfo.caretPos;
    maskInfo.BeforeChange(part);
    partStart += maskInfo.caretPos - savedCaretPos;
    part.HandleMouseWheel(maskInfo, delta, maskInfo.caretPos - partStart);
    maskInfo.AfterChange(part);
    break;
   }   
   partStart += part.GetSize();
  }
 },
 TrySkipLiteralOnPartEdge: function(maskInfo, partStartPos, partIndex) {
  var part = maskInfo.parts[partIndex];
  var posInPart = maskInfo.caretPos - partStartPos;
  var amount = 0;
  if(part.AllowIncreaseSize()) return;
  if(partIndex > maskInfo.parts.length - 3 ||  posInPart < part.GetSize()) return;
  var sibling = maskInfo.parts[partIndex + 1];
  if(this.IsLiteralPart(sibling))
   amount = sibling.GetSize();
  maskInfo.IncCaretPos(amount);
  maskInfo.ApplyFixes(sibling);
 },
 ClearSelection: function(maskInfo){  
  var partStart = 0;
  for(var i = 0; i < maskInfo.parts.length; i++) {
   var part = maskInfo.parts[i];
   var outerLeft = Math.min(partStart, maskInfo.caretPos);
   var outerRight = Math.max(partStart + part.GetSize(), maskInfo.caretPos + maskInfo.selectionLength);
   var size = part.GetSize();
   if(size + maskInfo.selectionLength > outerRight - outerLeft){
    var innerLeft = Math.max(partStart, maskInfo.caretPos);
    var innerRight = Math.min(partStart + size, maskInfo.caretPos + maskInfo.selectionLength);    
    part.Clear(innerLeft - partStart, innerRight - partStart);
    maskInfo.selectionLength += part.GetSize() - size;    
   }
   partStart += part.GetSize();
  }
  maskInfo.selectionLength = 0;
 },
 IsCaretInPart: function(caretPos, partStartPos, part) {
  if(caretPos < partStartPos)
   return false;
  var nextPartPos = partStartPos + part.GetSize();
  if(caretPos > nextPartPos)
   return false;
  if(caretPos == nextPartPos)
   return part.AllowIncreaseSize();
  return true;
 },
 IsCaretInPartOnControlKey: function(caretPos, partStartPos, part, keyCode) {
  if(caretPos == partStartPos) {
   if(keyCode == ASPxKey.Backspace || keyCode == ASPxKey.Left)
    return false;
   return true;
  }
  var nextPartPos = partStartPos + part.GetSize();
  if(partStartPos < caretPos && caretPos < nextPartPos) 
   return true;
  if(caretPos == nextPartPos) {
   if(keyCode == ASPxKey.Up || keyCode == ASPxKey.Down)
    return part.SupportsUpDown();
   if(keyCode == ASPxKey.Backspace || keyCode == ASPxKey.Left)
    return true;
   return false;   
  }
  return false;
 },
 IsCaretInPartOnMouseWheel: function(caretPos, partStartPos, part) {
  if(!part.SupportsUpDown()) 
   return false;
  return caretPos >= partStartPos && caretPos <= partStartPos + part.GetSize();
 },
 GetHintHtml: function(maskInfo) {
  var pos = 0;
  for(var i = 0; i < maskInfo.parts.length; i++) {
   var part = maskInfo.parts[i];
   if(this.IsCaretInPartOnMouseWheel(maskInfo.caretPos, pos, part))
    return part.GetHintHtml();
   pos += part.GetSize();
  }
  return "";
 }, 
 CreateKeyInfo: function(keyCode, shiftState, ctrlState) {
  return {
   keyCode: keyCode,
   shiftState: shiftState,
   ctrlState: ctrlState
  }; 
 },
 CreateKeyInfoByEvent: function(evt) {
  return this.CreateKeyInfo(_aspxGetKeyCode(evt), evt.shiftKey, evt.ctrlKey);
 },
 IsLiteralPart: function(part) {
  return (part.typeCode == _aspxLiteralMaskPart.prototype.typeCode);
 }, 
 IsEnumPart: function(part) {
  return (part.typeCode == _aspxEnumMaskPart.prototype.typeCode);
 },
 IsRangePart: function(part) {
  return (part.typeCode == _aspxRangeMaskPart.prototype.typeCode);
 },
 IsAlphaCode: function(code) {  
  return (64 < code && code < 91 || 96 < code && code < 123 || code > 127);
 },
 IsDigitCode: function(code) {  
  return (47 < code && code < 58);
 },
 IsSignumCode: function(code) {  
  return (code == 43 || code == 45);
 },
 CanHandleControlKey: function(keyInfo) {
  if(keyInfo.shiftState)
   return false;
  return keyInfo.keyCode == ASPxKey.Up || keyInfo.keyCode == ASPxKey.Down
   || keyInfo.keyCode == ASPxKey.Left || keyInfo.keyCode == ASPxKey.Right
   || keyInfo.keyCode == ASPxKey.Backspace || keyInfo.keyCode == ASPxKey.Delete;
 }, 
 IsPrintableKeyCode: function(keyInfo) {
  if(keyInfo.ctrlState) 
   return false;
  var code = keyInfo.keyCode;  
  return code == 32
   || (code >= 48 && code <= 57)
   || (code >= 65 && code <= 90)
   || (code >= 96 && code <= 107)
   || (code >= 109 && code <= 111)
   || (code >= 186 && code <= 192)
   || (code >= 219 && code <= 222);  
 },
 IsIgnorableLiteral: function(text, mode) {
  if(mode == _aspxMaskIncludeLiterals.None)
   return true;
  if(mode == _aspxMaskIncludeLiterals.All)
   return false;
  return text != __aspxCultureInfo.numDecimalPoint;
 }
};
_aspxMaskManager.keyCancelled = false;
_aspxMaskManager.keyDownHandled = false;
_aspxMaskManager.savedKeyDownKeyInfo = null;
_aspxMaskDateTimeHelper = {
 GetDate: function(maskInfo) {
  return this.CreateDateFromBag(this.GetDateBag(maskInfo), this.HasDateParts(maskInfo));
 },
 GetDateBag: function(maskInfo) {
  var bag = {
   year: 100, 
   month: 0, 
   day: 1,
   hours: 0,
   min: 0,
   sec: 0,
   msec: 0,
   pm: false,
   hasAmPm: false,
   hasDate: false
  };
  for(var i = 0; i < maskInfo.parts.length; i++) {
   var part = maskInfo.parts[i];
   switch(part.dateTimeRole) {
    case "y":     
     bag.year = Number(part.GetValue());
     if(bag.year < 100)
      bag.year = _aspxExpandTwoDigitYear(bag.year);     
     bag.hasDate = true;
     break;
    case "M":
     bag.month = _aspxMaskManager.IsEnumPart(part) ? part.itemIndex : Number(part.GetValue()) - 1;
     bag.hasDate = true;
     break;
    case "d":
     if(!_aspxMaskManager.IsEnumPart(part)) {
      bag.day = Number(part.GetValue());
      bag.hasDate = true;
     }
     break;
    case "H":
    case "h":
     bag.hours = Number(part.GetValue());
     break;
    case "m":
     bag.min = Number(part.GetValue());
     break;
    case "s":
     bag.sec = Number(part.GetValue());
     break;
    case "f":
    case "F":
     bag.msec = Number(part.GetValue());
     break;
    case "t":
     bag.hasAmPm = true;
     bag.pm = _aspxMaskManager.IsEnumPart(part) && part.itemIndex > 0;
     break;
   }
  }
  if(bag.hasAmPm) {
   if(!bag.pm && bag.hours == 12)
    bag.hours = 0;
   if(bag.pm && bag.hours < 12)
    bag.hours += 12;
  }
  return bag;
 },
 CreateDateFromBag: function(bag, allowNull) {
  if(allowNull) {
   if(bag.year == 100 && bag.month == 0 && bag.day == 1 
    && bag.hours + bag.min + bag.sec + bag.msec == 0)
    return null;
  }
  return new Date(bag.year, bag.month, bag.day, bag.hours, bag.min, bag.sec, bag.msec);
 },
 GetMaxDayInMonth: function(month, year) {
  if(month == 1)
   return this.IsLeapYear(year) ? 29 : 28;
  if(month == 3 || month == 5 || month == 8 || month == 10)
   return 30;
  return 31;
 },
 IsLeapYear: function(year) {
  if(year % 4 != 0)
   return false;
  if(year % 100 == 0)  
   return year % 400 == 0;
  return true;
 },
 GetNextLeapYear: function(year) {
  var result = 4 * (1 + Math.floor(year / 4));
  if(!this.IsLeapYear(result))
   result += 4;
  return result;
 }, 
 SetDate: function(maskInfo, date) {
  if(date == null)
   date = new Date(100, 0, 1);
  for(var i = 0; i < maskInfo.parts.length; i++) {
   var part = maskInfo.parts[i];
   part.EnsureValueInitialized();   
   switch(part.dateTimeRole) {
    case "y":
     this.SetYear(part, date);
     break;
    case "M":
     this.SetMonth(part, date);
     break;
    case "d":
     this.SetDay(part, date);
     break;
    case "h":
     this.SetHours(part, date, false);
     break;
    case "H":
     this.SetHours(part, date, true);
     break; 
    case "m":
     this.SetMinutes(part, date);
     break;
    case "s":
     this.SetSeconds(part, date);      
     break;
    case "f":
    case "F":
     this.SetMilliseconds(part, date);
     break;
    case "t":
     this.SetAmPm(part, date);      
     break;      
   }   
  }
 },
 SetYear: function(part, date) {
  if(!_aspxMaskManager.IsRangePart(part))
   return;
  var value = date.getFullYear();
  if(part.maxNumber < 100)
   value = value % 100;
  part.SetNumber(value);
 },
 SetMonth: function(part, date) { 
  if(_aspxMaskManager.IsRangePart(part))
   part.SetNumber(1 + date.getMonth());
  else if(_aspxMaskManager.IsEnumPart(part))
   part.itemIndex = date.getMonth();
 },
 SetDay: function(part, date) {
  if(_aspxMaskManager.IsRangePart(part))
   part.SetNumber(date.getDate());
  else if(_aspxMaskManager.IsEnumPart(part))
   part.itemIndex = date.getDay();
 },
 SetHours: function(part, date, full) {
  if(!_aspxMaskManager.IsRangePart(part))
   return; 
  var value = date.getHours();
  if(!full) {
   value = value % 12;
   if(value == 0)
    value = 12;
  }
  part.SetNumber(value);
 },
 SetMinutes: function(part, date) {
  if(!_aspxMaskManager.IsRangePart(part))
   return; 
  part.SetNumber(date.getMinutes());
 },
 SetSeconds: function(part, date) {
  if(!_aspxMaskManager.IsRangePart(part))
   return;
  part.SetNumber(date.getSeconds());
 },
 SetMilliseconds: function(part, date) {
  if(!_aspxMaskManager.IsRangePart(part))
   return;
  var value = date.getMilliseconds();
  while(value > part.maxNumber)
   value = value / 10;
  part.SetNumber(Math.round(value));
 },
 SetAmPm: function(part, date) {
  if(!_aspxMaskManager.IsEnumPart(part))
   return; 
  part.itemIndex = date.getHours() < 12 ? 0 : 1;
 },
 HasDateParts: function(maskInfo) {
  var list = maskInfo.parts;
  for(var i = 0; i < list.length; i++) {
   var role = list[i].dateTimeRole;
   if(role == "d" || role == "M" || role == "y")
    return true;
  }
  return false;
 }
};
var __aspxCalendarWeekCount = 6;
var __aspxCalendarMsPerDay = 86400000;
var __aspxActiveCalendar = null;
ASPxClientCalendar = _aspxCreateClass(ASPxClientEdit, {
 constructor: function(name) {
  this.constructor.prototype.constructor.call(this, name);
  this.SelectionChanging = new ASPxClientEvent();
  this.SelectionChanged = new ASPxClientEvent();
  this.VisibleMonthChanged = new ASPxClientEvent();
  this.isMouseDown = false;  
  this.forceMouseDown = false;
  this.selection = new ASPxClientCalendarSelection();
  this.selectionTransaction = null;  
  this.selectionStartDate = null;
  this.selectionPrevStartDate = null;
  this.lastSelectedDate = null;
  this.selectionCtrl = false;
  this.selectionByWeeks = false;  
  this.nodeCache = { };
  this.visibleDate = new Date();
  this.firstDayOfWeek = 0;    
  this.columns = 1;
  this.rows = 1;
  this.enableFast = true;
  this.enableMulti = false;
  this.minDate = null;
  this.maxDate = null;
  this.customDraw = false;  
  this.showWeekNumbers = true;
  this.showDayHeaders = true;
  this.isDateEditCalendar = false;
  this.sizingConfig.allowSetHeight = false;
  this.isDateChangingByKeyboard = false;
  this.MainElementClick = new ASPxClientEvent();      
 },
 Initialize: function() {
  this.selectionTransaction = new ASPxClientCalendarSelectionTransaction(this);
  this.selectionPrevStartDate = this.selection.GetFirstDate();
  this.SaveClientState(); 
  ASPxClientEdit.prototype.Initialize.call(this);
 },
 InlineInitialize: function(){
  this.CreateViews();
  if(this.enableFast)
   this.fastNavigation = new ASPxClientCalendarFastNavigation(this);
  this.InitSpecialKeyboardHandling();
  this.MakeDisabledStateItems();
  ASPxClientEditBase.prototype.InlineInitialize.call(this);
 },
 MakeDisabledStateItems: function(){
  for(var key in this.views) {
   var view = this.views[key];
   if(view.constructor != ASPxClientCalendarView) continue;
   view.MakeDisabledStateItems();
  }
 },
 FindInputElement: function() {
  return this.GetChild("_KBS");
 },
 FindStateInputElement: function() {
  return _aspxGetElementById(this.name + "_STATE");
 },
 GetClearButton: function() {
  return this.GetChild("_BC");
 },
 GetTodayButton: function() {
  return this.GetChild("_BT");
 },
 GetValue: function() {
  return this.selection.GetFirstDate();
 },
 GetValueString: function() {
  var value = this.GetValue();
  return value == null ? null : _aspxGetInvariantDateString(value);
 },
 SetValue: function(date) {
  if(date != null)
   this.SetVisibleDate(date);
  this.SetSelectedDate(date);
 },
 GetFastNavigation: function() {
  return this.fastNavigation;
 },    
 GetViewKey: function(row, column) {
  return row + "x" + column;
 },
 GetView: function(row, column) {
  var key = this.GetViewKey(row, column);
  return this.views[key];
 },
 CreateViews: function() {
  this.views = { };
  var key;
  for(var row = 0 ; row < this.rows; row++) {   
   for(var col = 0; col < this.columns; col++) {
    key = this.GetViewKey(row, col);
    var view = new ASPxClientCalendarView(this, row, col);
    view.Initialize();
    this.views[key] = view;
   }
  }
 },
 IsFastNavigationActive: function() {
  if (_aspxIsExists(this.fastNavigation))
   return this.fastNavigation.GetPopup().IsVisible();
  return false;
 },
 IsDateSelected: function(date) {
  return this.selection.Contains(date);
 },
 IsDateVisible: function(date) {
  var startDate = ASPxClientCalendar.CloneDate(this.GetView(0, 0).visibleDate);
  startDate.setDate(1);  
  var endDate = ASPxClientCalendar.CloneDate(this.GetView(this.rows - 1, this.columns - 1).visibleDate);
  endDate.setDate(ASPxClientCalendar.GetDaysInMonth(endDate.getMonth(), endDate.getFullYear()));
  return (date >= startDate) && (date < endDate);
 },
 IsDateWeekend: function(date) {
  var day = date.getDay();
  return day == 0 || day == 6;
 }, 
 IsMultiView: function() {
  return this.columns > 1 || this.rows > 1;
 },
 IsDateInRange: function(date) {
  return date == null || 
   ((this.minDate == null || date >= this.minDate) && 
    (this.maxDate == null || date <= this.maxDate));
 },
 GetCachedElementById: function(id) {
  if(!_aspxIsExistsElement(this.nodeCache[id]))
   this.nodeCache[id] = _aspxGetElementById(id);
  return this.nodeCache[id]; 
 },
 Update: function() {
  if(this.customDraw) 
   this.SendPostBack("");
  else
   this.UpdateInternal();
 }, 
 UpdateInternal: function() {
  for(var key in this.views) {
   var view = this.views[key];
   if(view.constructor != ASPxClientCalendarView) continue;
    view.Update();
  }
 }, 
 ApplySelectionByDiff: function(selection, save) {
  var toShow = [ ];
  var toHide = [ ];
  var dates =  selection.GetDates();
  var oldDates = this.selection.GetDates();
  var date;
  for(var i = 0; i < dates.length; i++) {
   date = dates[i];
   if(!this.selection.Contains(date))
    toShow.push(date);
  }
  for(var i = 0; i < oldDates.length; i++) {
   date = oldDates[i];
   if(!selection.Contains(date))
    toHide.push(date);
  }
  for(var key in this.views) {
   var view = this.views[key];
   if(view.constructor != ASPxClientCalendarView) continue;
   view.UpdateSelection(toHide, false);
   view.UpdateSelection(toShow, true);   
  }
  this.selection.Assign(selection);
  if(save)
   this.SaveClientState();
 },
 ImportEtalonStyle: function(info, suffix) {
  var cell = this.GetEtalonStyleCell(suffix);
  if(_aspxIsExistsElement(cell))
   info.Import(cell);   
 },
 GetEtalonStyleCell: function(name) {
  return this.GetCachedElementById(this.name + "_EC_" + name);
 },
 SaveClientState: function() {
  var element = this.FindStateInputElement();
  if (element != null) {
   var state = _aspxGetInvariantDateString(this.visibleDate);   
   if(this.selection.count > 0) 
    state += ":" + this.FormatDates(this.selection.GetDates(), ":");
   element.value = state;
  }
 },  
 FormatDates: function(dates, separator) {
  var result = "";
  for(var i = 0; i < dates.length; i++) {
   if (result.length > 0)
    result += separator;
   result += _aspxGetInvariantDateString(dates[i]);     
  }
  return result;
 },
 InitializeKeyHandlers: function() {
  this.AddKeyDownHandler(ASPxKey.Enter, "OnEnter");
  this.AddKeyDownHandler(ASPxKey.Esc, "OnEscape");
  this.AddKeyDownHandler(ASPxKey.PageUp, "OnPageUp");
  this.AddKeyDownHandler(ASPxKey.PageDown, "OnPageDown");
  this.AddKeyDownHandler(ASPxKey.End, "OnEndKeyDown");
  this.AddKeyDownHandler(ASPxKey.Home, "OnHomeKeyDown");
  this.AddKeyDownHandler(ASPxKey.Left, "OnArrowLeft");
  this.AddKeyDownHandler(ASPxKey.Right, "OnArrowRight");
  this.AddKeyDownHandler(ASPxKey.Up, "OnArrowUp");
  this.AddKeyDownHandler(ASPxKey.Down, "OnArrowDown");
 },
 OnArrowUp: function(evt) {
  if (this.IsFastNavigationActive()) 
   this.GetFastNavigation().OnArrowUp(evt);
  else if (!this.readOnly) {
   var newDate = this.GetNearestDayForToday();
   if (_aspxIsExists(this.lastSelectedDate))
    newDate = ASPxClientCalendar.GetPrevWeekDate(this.lastSelectedDate);
   this.CorrectVisibleMonth(newDate, false);
   this.DoKeyboardSelection(newDate, evt.shiftKey);
  }
  return true;
 },
 OnArrowDown: function(evt) {  
  if (this.IsFastNavigationActive()) 
   this.GetFastNavigation().OnArrowDown(evt);
  else if (!this.readOnly) {
   var newDate = this.GetNearestDayForToday();
   if (_aspxIsExists(this.lastSelectedDate))  
    newDate = ASPxClientCalendar.GetNextWeekDate(this.lastSelectedDate);
   this.CorrectVisibleMonth(newDate, true);
   this.DoKeyboardSelection(newDate, evt.shiftKey);
  }
  return true;
 },
 OnArrowLeft: function(evt) { 
  if (this.IsFastNavigationActive()) 
   this.GetFastNavigation().OnArrowLeft(evt);
  else if (!this.readOnly) {  
   var newDate = this.GetNearestDayForToday();
   if (_aspxIsExists(this.lastSelectedDate)) 
    newDate = ASPxClientCalendar.GetTomorrowDate(this.lastSelectedDate);
   this.CorrectVisibleMonth(newDate, false);
   this.DoKeyboardSelection(newDate, evt.shiftKey);
  }
  return true;
 },
 OnArrowRight: function(evt) {
  if (this.IsFastNavigationActive()) 
   this.GetFastNavigation().OnArrowRight(evt);
  else if (!this.readOnly) {  
   var newDate = this.GetNearestDayForToday();
   if (_aspxIsExists(this.lastSelectedDate))
    newDate = ASPxClientCalendar.GetYesterDate(this.lastSelectedDate);
   this.CorrectVisibleMonth(newDate, true);
   this.DoKeyboardSelection(newDate, evt.shiftKey);
  }
  return true;
 },
 OnPageUp: function(evt) {
  if (this.IsFastNavigationActive()) 
   this.GetFastNavigation().OnPageUp(evt);
  else if (!this.readOnly) {
   var newDate = this.GetNearestDayForToday();
   if (_aspxIsExists(this.lastSelectedDate)) {
    if (evt.ctrlKey)
     newDate = ASPxClientCalendar.GetPrevYearDate(this.lastSelectedDate);
    else
     newDate = ASPxClientCalendar.GetPrevMonthDate(this.lastSelectedDate);   
   }
   this.CorrectVisibleMonth(newDate, false);  
   this.DoKeyboardSelection(newDate);
  }
  return true; 
 },
 OnPageDown: function(evt) {
  if (this.IsFastNavigationActive()) 
   this.GetFastNavigation().OnPageDown(evt);
  else if (!this.readOnly) {
   var newDate = this.GetNearestDayForToday();
   if (_aspxIsExists(this.lastSelectedDate)) {
    if (evt.ctrlKey)
     newDate = ASPxClientCalendar.GetNextYearDate(this.lastSelectedDate);
    else
     newDate = ASPxClientCalendar.GetNextMonthDate(this.lastSelectedDate);
   }
   this.CorrectVisibleMonth(newDate, true);
   this.DoKeyboardSelection(newDate);
  }
  return true;
 },
 OnEndKeyDown: function(evt) {
  if (!this.readOnly && !this.IsFastNavigationActive()) { 
   var newDate = this.GetNearestDayForToday();
   if (_aspxIsExists(this.lastSelectedDate))   
    newDate = ASPxClientCalendar.CloneDate(this.lastSelectedDate);
   newDate = ASPxClientCalendar.GetLastDayInMonthDate(newDate);
   this.CorrectVisibleMonth(newDate, false);
   this.DoKeyboardSelection(newDate, evt.shiftKey);
  }
  return true;
 },
 OnHomeKeyDown: function(evt) {
  if (!this.readOnly && !this.IsFastNavigationActive()) {
   var newDate = this.GetNearestDayForToday();
   if (_aspxIsExists(this.lastSelectedDate))   
    newDate = ASPxClientCalendar.CloneDate(this.lastSelectedDate);
   newDate = ASPxClientCalendar.GetFirstDayInMonthDate(newDate);   
   this.CorrectVisibleMonth(newDate, false);
   this.DoKeyboardSelection(newDate, evt.shiftKey);
  }
  return true; 
 },
 OnEnter: function() {
  if (this.IsFastNavigationActive())
   this.GetFastNavigation().OnEnter();
  return true;
 },
 OnEscape: function() {
  if (this.IsFastNavigationActive())
   this.GetFastNavigation().OnEscape();
  return true;
 },
 OnShiftMonth: function(offset) {
  if(offset) {
   var date = ASPxClientCalendar.AddMonths(this.visibleDate, offset);   
   this.OnVisibleMonthChanged(date);
  }
 },
 OnDayMouseDown: function(date, shift, ctrl, byWeeks) {
  this.isMouseDown = true;
  this.selectionByWeeks = byWeeks;
  this.selectionTransaction.Start();
  if(this.enableMulti) {
   if(ctrl) {
    this.selectionCtrl = true;
    this.selectionTransaction.CopyFromBackup();
   } else
    this.selectionCtrl = false;
   if(shift && _aspxIsExists(this.selectionPrevStartDate)) {
    this.selectionStartDate = this.selectionPrevStartDate;         
    this.selectionTransaction.selection.AddRange(this.selectionStartDate, date);
    if(byWeeks)
     this.selectionTransaction.selection.AddWeek(date);
   } else {
    this.selectionStartDate = date;
    this.selectionPrevStartDate = date;
    if(byWeeks)
     this.selectionTransaction.selection.AddWeek(date);
    else
     this.selectionTransaction.selection.Add(date);
   }
  } else
   this.selectionTransaction.selection.Add(date);
  this.ApplySelectionByDiff(this.selectionTransaction.selection, false);
 },
 OnDayMouseOver: function(date) {
  if(this.enableMulti) {
   if(this.selectionCtrl)
    this.selectionTransaction.CopyFromBackup();
   else
    this.selectionTransaction.selection.Clear();
   this.selectionTransaction.selection.AddRange(this.selectionStartDate, date);
   if(this.selectionByWeeks) {
    this.selectionTransaction.selection.AddWeek(date);
    this.selectionTransaction.selection.AddWeek(this.selectionStartDate);
   }
  } else {
   this.selectionTransaction.selection.Clear();
   this.selectionTransaction.selection.Add(date);
  }
  this.ApplySelectionByDiff(this.selectionTransaction.selection, false);
 },
 OnDayMouseUp: function(date) {
  if (!__aspxIE && this.isMouseDown)
   this.OnMainElementClick();
  this.isMouseDown = false;
  if(this.enableMulti && this.selectionCtrl && this.selectionTransaction.backup.Contains(date) &&
   ASPxClientCalendar.AreDatesEqual(date, this.selectionStartDate)) {
   if(this.selectionByWeeks)
    this.selectionTransaction.selection.RemoveWeek(date);
   else
    this.selectionTransaction.selection.Remove(date);
  }
  this.lastSelectedDate = ASPxClientCalendar.CloneDate(date);
  this.OnSelectionChanging(); 
 },
 OnTodayClick: function() {
  var now = new Date(); 
  var date = new Date(now.getFullYear(), now.getMonth(), now.getDate());
  if(this.IsDateInRange(date)) {
   this.selectionTransaction.Start();
   this.selectionTransaction.selection.Add(date);
   this.OnSelectionChanging();
   if(!ASPxClientCalendar.AreDatesOfSameMonth(date, this.visibleDate))
    this.OnVisibleMonthChanged(date);  
  }
 },
 OnClearClick: function() {
  this.selectionTransaction.Start();
  this.OnSelectionChanging();
  this.selectionStartDate = null;
  this.selectionPrevStartDate = null;    
  this.lastSelectedDate = null;
 },
 OnSelectMonth: function(row, column) {  
  var txn = this.selectionTransaction;
  txn.Start();
  var date = ASPxClientCalendar.CloneDate(this.GetView(row, column).visibleDate);
  date.setDate(1);
  do {  
   if(this.IsDateInRange(date))
    txn.selection.Add(date);
   date = ASPxClientCalendar.AddDays(date, 1);
  } while(date.getDate() > 1);
  this.OnSelectionChanging();
 },
 OnTitleClick: function(row, column) {
  this.fastNavigation.activeView = this.GetView(row, column);
  this.fastNavigation.Prepare();
  this.fastNavigation.Show();
 },
 OnMainElementClick: function() {
  this.MainElementClick.FireEvent(this);
 },
 OnSelectionChanging: function() {
  if(!this.SelectionChanging.IsEmpty()){
   var args = new ASPxClientCalendarSelectionEventArgs(false, this.selectionTransaction.selection);
   this.SelectionChanging.FireEvent(this, args);  
  }
  var changed = this.selectionTransaction.IsChanged();
  this.selectionTransaction.Commit();
  if(changed)
   this.OnValueChanged();  
 },
 OnVisibleMonthChanged: function(date) {
  var offsetInternal = ASPxClientCalendar.GetOffsetInMonths(this.visibleDate, date);
  this.SetVisibleDate(date);
  var processOnServer = this.RaiseVisibleMonthChanged(offsetInternal);
  if(processOnServer)
   this.SendPostBackInternal("");  
 },
 OnSelectionCancelled: function() {
  this.isMouseDown = false;  
  this.selectionTransaction.Rollback();
 },
 RaiseValueChangedEvent: function() {
  var processOnServer = ASPxClientEdit.prototype.RaiseValueChangedEvent.call(this);
  processOnServer = this.RaiseSelectionChanged(processOnServer);
  return processOnServer;
 },
 SetVisibleDate: function(date) {
  var old = this.visibleDate;
  this.visibleDate = date;
  this.SaveClientState();
  if(!ASPxClientCalendar.AreDatesOfSameMonth(date, old))
   this.Update(); 
 },
 SetSelectedDate: function(date) {
  if(this.IsDateInRange(date)) {   
   var selection = new ASPxClientCalendarSelection();
   if(date != null) {
    selection.Add(date);
    this.lastSelectedDate = ASPxClientCalendar.CloneDate(date);
   }
   this.ApplySelectionByDiff(selection, true);
  }
 },
 CorrectVisibleMonth: function(newDate, isForwardDirection) {
  var offset = ASPxClientCalendar.GetOffsetInMonths(this.visibleDate, newDate);
  if (this.IsMultiView() && offset != 0) {
   var view = isForwardDirection ? this.GetView(this.rows - 1, this.columns - 1) : 
            this.GetView(0, 0);
   offset = this.IsDateVisible(newDate) ? 0 :
       ASPxClientCalendar.GetOffsetInMonths(view.visibleDate, newDate);
  }
  if (!this.IsDateInRange(newDate))
   offset = 0;
  if (offset != 0)
   this.OnShiftMonth(offset);
 },
 DoKeyboardSelection: function(date, shift) {
  if (this.IsDateInRange(date)) {
   this.isDateChangingByKeyboard = true;
   this.selectionTransaction.Start();
   if(this.enableMulti && shift && _aspxIsExists(this.selectionStartDate))
    this.selectionTransaction.selection.AddRange(this.selectionStartDate, date);
   else {
    this.selectionTransaction.selection.Add(date);
    this.selectionStartDate = date;
   }
   this.lastSelectedDate = ASPxClientCalendar.CloneDate(date);
   this.OnSelectionChanging();
   this.isDateChangingByKeyboard = false;
  }
 },
 GetNearestDayForToday: function() {
  var now = new Date();
  var ret = new Date(now.getFullYear(), now.getMonth(), now.getDate());
  if (_aspxIsExists(this.minDate) && !this.IsDateInRange(ret))
   ret = ASPxClientCalendar.CloneDate(this.minDate);
  return ret;
 },
 UseDelayedSpecialFocus: function() { 
  return true;
 },
 GetDelayedSpecialFocusTriggers: function() {
  var list = ASPxClientEdit.prototype.GetDelayedSpecialFocusTriggers.call(this);
  if(this.enableFast)
   list.push(this.GetFastNavigation().GetPopup().GetWindowElement(-1));
  return list;
 },
 GetSelectedDate: function() {
  return this.GetValue();
 },
 GetVisibleDate: function() {
  return this.visibleDate;
 },
 SelectDate: function(date) {
  if(_aspxIsExists(date)) {
   this.selection.Add(date);
   this.Update();
  }
 },
 SelectRange: function(start, end) {
  if(_aspxIsExists(start) && _aspxIsExists(end)) {
   this.selection.AddRange(start, end);
   this.Update();
  }
 },
 DeselectDate: function(date) {
  if(_aspxIsExists(date)) {
   this.selection.Remove(date);
   this.Update(); 
  }
 },
 DeselectRange: function(start, end) {
  if(_aspxIsExists(start) && _aspxIsExists(end)) {
   this.selection.RemoveRange(start, end);
   this.Update();
  }
 },
 ClearSelection: function() {
  this.selection.Clear();
  this.Update();
 },
 GetSelectedDates: function() {
  return this.selection.GetDates();
 },
 RaiseSelectionChanged: function(processOnServer){
  if(!this.SelectionChanged.IsEmpty()){
   var args = new ASPxClientProcessingModeEventArgs(processOnServer);  
   this.SelectionChanged.FireEvent(this, args);
   processOnServer = args.processOnServer;
  }
  return processOnServer;
 },
 RaiseVisibleMonthChanged: function(offsetInternal){
  var processOnServer = this.autoPostBack;
  if(!this.VisibleMonthChanged.IsEmpty()){
   var args = new ASPxClientProcessingModeEventArgs(processOnServer);
   args.offsetInternal = offsetInternal;
   this.VisibleMonthChanged.FireEvent(this, args);
   processOnServer = args.processOnServer;
  }
  return processOnServer;
 },
 ChangeEnabledAttributes: function(enabled){
  _aspxChangeDocumentEventsMethod(enabled)("mouseup", aspxCalDocMouseUp);
  _aspxChangeEventsMethod(enabled)(this.GetMainElement(), "click", new Function("aspxCalMainElemClick('" + this.name + "');"));
  var inputElement = this.GetInputElement();
  if(_aspxIsExists(inputElement)) 
   this.ChangeSpecialInputEnabledAttributes(inputElement, _aspxChangeEventsMethod(enabled));
  var btnElement = this.GetTodayButton();
  if(_aspxIsExists(btnElement))
   this.ChangeButtonEnabledAttributes(btnElement, _aspxChangeAttributesMethod(enabled));
  btnElement = this.GetClearButton();
  if(_aspxIsExists(btnElement))
   this.ChangeButtonEnabledAttributes(btnElement, _aspxChangeAttributesMethod(enabled));
  for(var key in this.views) {
   var view = this.views[key];
   if(view.constructor != ASPxClientCalendarView) continue;
   view.ChangeEnabledAttributes(enabled);
  }
 },
 ChangeEnabledStateItems: function(enabled){
  aspxGetStateController().SetElementEnabled(this.GetMainElement(), enabled);
  var btnElement = this.GetTodayButton();
  if(_aspxIsExists(btnElement))
   aspxGetStateController().SetElementEnabled(btnElement, enabled);
  btnElement = this.GetClearButton();
  if(_aspxIsExists(btnElement))
   aspxGetStateController().SetElementEnabled(btnElement, enabled);
  for(var key in this.views) {
   var view = this.views[key];
   if(view.constructor != ASPxClientCalendarView) continue;  
   view.ChangeEnabledStateItems(enabled);
  }
  this.UpdateInternal();   
 },
 ChangeButtonEnabledAttributes: function(element, method){
  method(element, "onclick");
  method(element, "ondblclick");
 },
 GetMinDate: function() {
  return this.minDate;
 },
 SetMinDate: function(date) {
  this.minDate = date;
  this.Update();
 },
 GetMaxDate: function() {
  return this.maxDate;
 },
 SetMaxDate: function(date) {
  this.maxDate = date;
  this.Update();
 }
});
ASPxClientCalendar.AreDatesEqual = function(date1, date2) {
 if(date1 == date2)  
  return true;
 if(!date1 || !date2)
  return false;
 return date1.getFullYear() == date2.getFullYear() && date1.getMonth() == date2.getMonth() && date1.getDate() == date2.getDate();
}
ASPxClientCalendar.AreDatesOfSameMonth = function(date1, date2) {
 if(!date1 || !date2)
  return false;
 return date1.getFullYear() == date2.getFullYear() && date1.getMonth() == date2.getMonth();
}
ASPxClientCalendar.GetUTCTime = function(date) {
 return Date.UTC(date.getFullYear(), date.getMonth(), date.getDate());
}
ASPxClientCalendar.GetFirstDayOfYear = function(date) {
 return new Date(date.getFullYear(), 0, 1);  
}
ASPxClientCalendar.GetDayOfYear = function(date) {
 var ms = ASPxClientCalendar.GetUTCTime(date) - 
  ASPxClientCalendar.GetUTCTime(ASPxClientCalendar.GetFirstDayOfYear(date));
 return 1 + Math.floor(ms / __aspxCalendarMsPerDay);
}
ASPxClientCalendar.GetISO8601WeekOfYear = function(date) {
 var firstDate = new Date(date.getFullYear(), 0, 1);
 var firstDayOfWeek = firstDate.getDay();
 if(firstDayOfWeek == 0)
  firstDayOfWeek = 7;
 var daysInFirstWeek = 8 - firstDayOfWeek;
 var lastDate = new Date(date.getFullYear(), 11, 31);   
 var lastDayOfWeek = lastDate.getDay();
 if(lastDayOfWeek == 0)
  lastDayOfWeek = 7;
 var daysInLastWeek = 8 - lastDayOfWeek; 
 var fullWeeks = Math.ceil((ASPxClientCalendar.GetDayOfYear(date) - daysInFirstWeek) / 7);
 var result = fullWeeks;   
 if(daysInFirstWeek > 3)
  result++;
 var isThursday = firstDayOfWeek == 4 || lastDayOfWeek == 4;
 if(result > 52 && !isThursday)
  result = 1;
 if(result == 0)
  return ASPxClientCalendar.GetISO8601WeekOfYear(new Date(date.getFullYear() - 1, 11, 31));
 return result;
}
ASPxClientCalendar.GetNextWeekDate = function(date) {
 var ret = new Date(date.getTime()); 
 var newDay = date.getDate() + 7;
 ret.setDate(newDay);
 return ret;
}
ASPxClientCalendar.GetPrevWeekDate = function(date) {
 var ret = new Date(date.getTime());
 var newDay = date.getDate() - 7;
 ret.setDate(newDay);
 return ret;
}
ASPxClientCalendar.GetTomorrowDate = function(date) {
 var ret = new Date(date.getTime());
 ret.setDate(ret.getDate() - 1);
 return ret;
}
ASPxClientCalendar.GetYesterDate = function(date) {
 var ret = new Date(date.getTime());
 ret.setDate(ret.getDate() + 1);
 return ret;
}
ASPxClientCalendar.GetNextMonthDate = function(date) {
 var ret = new Date(date.getTime());
 var maxDateInNextMonth = ASPxClientCalendar.GetDaysInMonth(ret.getMonth() + 1, ret.getFullYear());
 if (ret.getDate() > maxDateInNextMonth)
  ret.setDate(maxDateInNextMonth);
 ret.setMonth(ret.getMonth() + 1);
 return ret;
}
ASPxClientCalendar.GetNextYearDate = function(date) {
 var ret = new Date(date.getTime());
 var maxDateInPrevYearMonth = ASPxClientCalendar.GetDaysInMonth(ret.getMonth(), ret.getFullYear() + 1);
 if (ret.getDate() > maxDateInPrevYearMonth)
  ret.setDate(maxDateInPrevYearMonth);
 ret.setFullYear(ret.getFullYear() + 1);
 return ret;
}
ASPxClientCalendar.GetPrevMonthDate = function(date) {
 var ret = new Date(date.getTime());
 var maxDateInPrevMonth = ASPxClientCalendar.GetDaysInMonth(ret.getMonth() - 1, ret.getFullYear());
 if (ret.getDate() > maxDateInPrevMonth)
  ret.setDate(maxDateInPrevMonth);
 ret.setMonth(ret.getMonth() - 1);
 return ret;
}
ASPxClientCalendar.GetPrevYearDate = function(date) {
 var ret = new Date(date.getTime());
 var maxDateInPrevYearMonth = ASPxClientCalendar.GetDaysInMonth(ret.getMonth(), ret.getFullYear() - 1);
 if (ret.getDate() > maxDateInPrevYearMonth)
  ret.setDate(maxDateInPrevYearMonth);
 ret.setFullYear(ret.getFullYear() - 1);
 return ret;
}
ASPxClientCalendar.GetFirstDayInMonthDate = function(date) {
 var ret = new Date(date.getTime());
 ret.setDate(1);
 return ret;
}
ASPxClientCalendar.GetLastDayInMonthDate = function(date) {
 var ret = new Date(date.getTime());
 var maxDateInYearMonth = ASPxClientCalendar.GetDaysInMonth(ret.getMonth(), ret.getFullYear());
 ret.setDate(maxDateInYearMonth);
 return ret;
}
ASPxClientCalendar.AddDays = function(date, count) {
 var newDate = ASPxClientCalendar.CloneDate(date);
 newDate.setUTCDate(count + newDate.getUTCDate());
 ASPxClientCalendar.FixTimezoneGap(date, newDate);
 return newDate;
}
ASPxClientCalendar.AddMonths = function(date, count) {
 var newDate = ASPxClientCalendar.CloneDate(date);
 newDate.setMonth(count + newDate.getMonth());
 ASPxClientCalendar.FixTimezoneGap(date, newDate);
 if(newDate.getDate() < date.getDate())
  newDate = ASPxClientCalendar.AddDays(newDate, -newDate.getDate()); 
 return newDate;
}
ASPxClientCalendar.CloneDate = function(date) {
 var cloned = new Date();
 cloned.setTime(date.getTime());
 return cloned;
}
ASPxClientCalendar.GetDecadeStartYear = function(year) {
 return 10 * Math.floor(year / 10);
}
ASPxClientCalendar.GetDaysInRange = function(start, end) {
 return 1 + (ASPxClientCalendar.GetUTCTime(end) - ASPxClientCalendar.GetUTCTime(start)) / __aspxCalendarMsPerDay;
};
ASPxClientCalendar.GetDaysInMonth = function(month, year) {
 var d = new Date(year, month + 1, 0);
 return d.getDate();
};
ASPxClientCalendar.GetOffsetInMonths = function(start, end) {
 return end.getMonth() - start.getMonth() + 12 * (end.getFullYear() - start.getFullYear());
};
ASPxClientCalendar.FixTimezoneGap = function(oldDate, newDate) {
 var diff = newDate.getHours() - oldDate.getHours();
 if(diff == 0)
  return;
 var sign = (diff == 1 || diff == -23) ? -1 : 1;
 var trial = new Date(newDate.getTime() + sign * 3600000);
 if(sign > 0 || trial.getDate() == newDate.getDate())
  newDate.setTime(trial.getTime());
};
ASPxClientCalendarSelection = _aspxCreateClass(null, {
 constructor: function() {
  this.dates = { };
  this.count = 0;  
 },
 Assign: function(source) {
  this.Clear();
  for(var key in source.dates) {
   var item = source.dates[key];
   if(item.constructor != Date) continue;
   this.Add(item);
  }
 },
 Clear: function() {
  if(this.count > 0) {
   this.dates = { };
   this.count = 0;
  }
 },
 Equals: function(selection) {
  if(this.count != selection.count)
   return false;
  for(var key in this.dates) {
   if(this.dates[key].constructor != Date) continue;
   if(!selection.ContainsKey(key))
    return false;
  }
  return true;
 },
 Contains: function(date) {
  var key = this.GetKey(date);
  return this.ContainsKey(key);
 },
 ContainsKey: function(key) {
  return _aspxIsExists(this.dates[key]);
 },
 Add: function(date) {
  var key = this.GetKey(date);
  if(!this.ContainsKey(key)) {
   this.dates[key] = ASPxClientCalendar.CloneDate(date);
   this.count++;
  }
 },
 AddArray: function(dates) {
  for(var i = 0; i < dates.length; i++)
   this.Add(dates[i]);
 },
 AddRange: function(start, end)  {
  if(end < start) {
   this.AddRange(end, start);
   return;
  }
  var count = ASPxClientCalendar.GetDaysInRange(start, end);
  var date = ASPxClientCalendar.CloneDate(start);  
  for(var i = 0; i < count; i++) {
   this.Add(date);
   date = ASPxClientCalendar.AddDays(date, 1);
  }
 },
 AddWeek: function(startDate) {
  this.AddRange(startDate, ASPxClientCalendar.AddDays(startDate, 6));
 },
 Remove: function(date) {
  var key = this.GetKey(date);
  if(this.ContainsKey(key)) {
   delete this.dates[key];
   this.count--;
  }
 },
 RemoveArray: function(dates) {
  for(var i = 0; i < dates.length; i++)
   this.Remove(dates[i]);
 },
 RemoveRange: function(start, end) {
  if(end < start) {
   this.RemoveRange(end, start);
   return;
  }
  var count = ASPxClientCalendar.GetDaysInRange(start, end);
  var date = ASPxClientCalendar.CloneDate(start);  
  for(var i = 0; i < count; i++) {
   this.Remove(date);
   date = ASPxClientCalendar.AddDays(date, 1);
  }
 },
 RemoveWeek: function(startDate) {
  this.RemoveRange(startDate, ASPxClientCalendar.AddDays(startDate, 6));
 },
 GetDates: function() {
  var result = [ ];
  for(var key in this.dates) {
   var item = this.dates[key];
   if(item.constructor != Date) continue;
   result.push(ASPxClientCalendar.CloneDate(item));
  }
  return result;  
 },
 GetFirstDate: function() {
  if(this.count == 0)
   return null;
  for(var key in this.dates) {
   var item = this.dates[key];
   if(item.constructor != Date) continue;
   return ASPxClientCalendar.CloneDate(item);
  }
  return null;
 },
 GetKey: function(date) {  
  return _aspxGetInvariantDateString(date);
 }
});
ASPxClientCalendarSelectionTransaction = _aspxCreateClass(null, {
 constructor: function(calendar) {
  this.calendar = calendar;
  this.isActive = false;
  this.backup = new ASPxClientCalendarSelection();
  this.selection = new ASPxClientCalendarSelection;
 },
 Start: function() {
  if(this.isActive)
   this.Rollback();
  this.backup.Assign(this.calendar.selection);
  this.selection.Clear();
  this.isActive = true;
  __aspxActiveCalendar = this.calendar;
 },
 Commit: function() {  
  this.calendar.ApplySelectionByDiff(this.selection, true);
  this.Reset();
 },
 Rollback: function() {
  this.calendar.ApplySelectionByDiff(this.backup);  
  this.Reset();
 },
 Reset: function() {
  this.backup.Clear();
  this.selection.Clear();
  this.isActive = false;
  __aspxActiveCalendar = null;
 },
 CopyFromBackup: function() {
  this.selection.Assign(this.backup);
 },
 IsChanged: function() {
  return !this.backup.Equals(this.selection);
 }
});
ASPxClientCalendarView = _aspxCreateClass(null, {
 constructor: function(calendar, row, column) {
  this.row = row;
  this.column = column;
  this.calendar = calendar; 
  var temp = column + row;
  this.isLowBoundary = temp == 0;
  this.isHighBoundary = temp == calendar.rows + calendar.columns - 2; 
  this.visibleDate = null;
  this.startDate = null;  
  this.dayFunctions = {};
  this.dayFunctionsWithWeekSelection = {};
 },
 Initialize: function() {
  this.dayCellCache = { };
  this.dayStyleCache = { }; 
  this.UpdateDate();
  this.UpdateSelection(this.calendar.selection.GetDates(), true);  
  var cell = this.GetMonthCell();
  if(_aspxIsExistsElement(cell))
   _aspxPreventElementDragAndSelect(cell, false);
 },
 AttachMouseEvents: function(eventMethod, styleMethod) {
  var index;
  var cell;
  if(this.calendar.showDayHeaders) {
   var headCells = this.GetMonthTable().rows[0].cells; 
   var dayNameIndex = 0;
   if(this.calendar.showWeekNumbers) {
    dayNameIndex++;
    cell = headCells[0];
    if(this.calendar.enableMulti) {
     eventMethod(cell, "click", 
      new Function("aspxCalSelectMonth('" + this.calendar.name + "', " + this.row + ", " + this.column + ")"));     
     styleMethod(cell, "cursor", _aspxGetPointerCursor());
    }
    this.AttachCancelSelect(eventMethod, cell);
   }   
   for(var j = 0; j < 7; j++)
    this.AttachCancelSelect(eventMethod, headCells[dayNameIndex++]);
  }
  for(var i = 0; i < __aspxCalendarWeekCount; i++) {
   if(this.calendar.showWeekNumbers) {
    cell = this.GetWeekNumberCell(i);
    if(this.calendar.enableMulti)
     this.AttachDayMouseEvents(eventMethod, cell, this.GetDayMouseEventFunction(7 * i, true));    
    else
     this.AttachCancelSelect(eventMethod, cell);
   }
   var date;
   for(var j = 0; j < 7; j++) {
    index = i * 7 + j;
    cell = this.GetDayCell(index);
    date = this.GetDateByIndex(index);
    if(!this.calendar.enableMulti && this.IsDateVisible(date) && this.calendar.IsDateInRange(date))
     styleMethod(cell, "cursor", _aspxGetPointerCursor());
    this.AttachDayMouseEvents(eventMethod, cell, this.GetDayMouseEventFunction(index, false));    
   }
  }
 },
 AttachDayMouseEvents: function(method, cell, handler) {
  var types = ["down", "up", "over"];
  for(var i = 0; i < types.length; i++)
   method(cell, "mouse" + types[i], handler);
 },
 AttachCancelSelect: function(method, element) {
  method(element, "mouseup", aspxCalCancelSelect);
 },
 GetDayMouseEventFunction: function(index, selectWeeks) {
  var hash = selectWeeks ? this.dayFunctionsWithWeekSelection : this.dayFunctions;
  if(!_aspxIsExists(hash[index]))
   hash[index] = new Function("e", "aspxCalDayMouseEvt('" + this.calendar.name + "', " + this.row + ", " + this.column + ", " + index + ", e, " + selectWeeks + ");");
  return hash[index];
 },
 UpdateDate: function() {
  this.visibleDate = ASPxClientCalendar.AddMonths(this.calendar.visibleDate, 
   this.row * this.calendar.columns + this.column);
  var date = ASPxClientCalendar.CloneDate(this.visibleDate);
  date.setDate(1);
  var offset = date.getDay() - this.calendar.firstDayOfWeek;
  if(offset < 0)
   offset += 7;
  this.startDate = ASPxClientCalendar.AddDays(date, -offset);
 },
 GetDateByIndex: function(index) {
  return ASPxClientCalendar.AddDays(this.startDate, index);
 },
 GetIndexByDate: function(date) {
  return ASPxClientCalendar.GetDaysInRange(this.startDate, date) - 1;
 },
 IsDateOtherMonth: function(date) {
  if(date == null)
   return false;
  return date.getMonth() != this.visibleDate.getMonth() ||
   date.getFullYear() != this.visibleDate.getFullYear();
 },
 GetDayCell: function(index) {
  if(_aspxIsExists(this.dayCellCache[index]))
   return this.dayCellCache[index];
  var mt = this.GetMonthTable();
  var colIndex = index % 7;
  var rowIndex = (index - colIndex) / 7;
  if(this.calendar.showDayHeaders)
   rowIndex++;  
  if(this.calendar.showWeekNumbers)
   colIndex++;
  var cell = mt.rows[rowIndex].cells[colIndex];
  this.dayCellCache[index] = cell;
  return cell;
 },
 GetMonthTable: function() {
  return this.GetCachedElementById("mt");
 }, 
 GetMonthCell: function() {
  return this.GetCachedElementById("mc");
 },
 GetWeekNumberCell: function(index) {
  if(this.calendar.showDayHeaders)
   index++;
  return this.GetMonthTable().rows[index].cells[0];
 },
 GetPrevYearCell: function() {
  return this.GetCachedElementById("PYC");
 },
 GetPrevMonthCell: function() {
  return this.GetCachedElementById("PMC");
 },
 GetTitleCell: function() {
  return this.GetCachedElementById("TC");
 },
 GetTitleElement: function() {
  return this.GetCachedElementById("T");
 },
 GetNextMonthCell: function() {
  return this.GetCachedElementById("NMC");
 },
 GetNextYearCell: function() {
  return this.GetCachedElementById("NYC");
 },
 Update: function() {
  this.dayStyleCache = { };
  this.UpdateDate();  
  this.UpdateDays();
  this.UpdateTitle();  
  this.UpdateSelection(this.calendar.selection.GetDates(), true);
 },
 UpdateDays: function() {  
  var date = ASPxClientCalendar.CloneDate(this.startDate);
  var offset = this.calendar.firstDayOfWeek - 1;
  if(offset < 0)
   offset += 7;    
  var weekNumber = ASPxClientCalendar.GetISO8601WeekOfYear(ASPxClientCalendar.AddDays(date, offset));
  var cell;
  for(var i = 0; i < __aspxCalendarWeekCount; i++) {
   if(this.calendar.showWeekNumbers)    
    this.GetWeekNumberCell(i).innerHTML = (weekNumber < 10 ? "0" : "") + weekNumber.toString();   
   for(var j = 0; j < 7; j++) {    
    cell = this.GetDayCell(i * 7 + j);    
    cell.innerHTML = this.IsDateVisible(date) ? date.getDate() : "&nbsp;";
    this.ApplyDayCellStyle(cell, date);
    date = ASPxClientCalendar.AddDays(date, 1);
   } 
   if(++weekNumber > 52)
    weekNumber = ASPxClientCalendar.GetISO8601WeekOfYear(ASPxClientCalendar.AddDays(date, offset));
  }   
 },
 UpdateTitle: function() {  
  this.GetTitleElement().innerHTML = __aspxCultureInfo.monthNames[this.visibleDate.getMonth()] +
   " " + this.visibleDate.getFullYear(); 
 },
 UpdateSelection: function(dates, showSelection) {  
  var index;  
  var maxIndex = 7 * __aspxCalendarWeekCount - 1;  
  for(var i = 0; i < dates.length; i++) {
   index = this.GetIndexByDate(dates[i]);
   if(index < 0 || index > maxIndex || !this.IsDateVisible(dates[i]))
    continue;
   this.ApplySelectionToCell(index, showSelection);
  }
 },
 ApplySelectionToCell: function(index, showSelection) {
  var cell = this.GetDayCell(index);
  if(showSelection) {
   var info;
   if(!_aspxIsExists(this.dayStyleCache[index])) {
    var backup = new ASPxClientCalendarStyleInfo();
    backup.Import(cell);    
    this.dayStyleCache[index] = backup;
    info = backup.Clone();
   } else
    info = this.dayStyleCache[index].Clone();
   this.calendar.ImportEtalonStyle(info, "DS");
  } else
   info = this.dayStyleCache[index];
  info.Apply(cell);
 }, 
 ApplyDayCellStyle: function(cell, date) {
  cell.style.cursor = "";
  var cal = this.calendar;
  var info = new ASPxClientCalendarStyleInfo();
  var needPointer = false;
  cal.ImportEtalonStyle(info, "D");
  if(this.IsDateVisible(date)) {
   if(cal.IsDateWeekend(date))
    cal.ImportEtalonStyle(info, "DW");    
   if(this.IsDateOtherMonth(date))
    cal.ImportEtalonStyle(info, "DA");    
   if(!cal.IsDateInRange(date))
    cal.ImportEtalonStyle(info, "DO");
   if(ASPxClientCalendar.AreDatesEqual(new Date(), date))
    cal.ImportEtalonStyle(info, "DT");
   if(!cal.clientEnabled)
    cal.ImportEtalonStyle(info, "DD");
   else if(!cal.enableMulti)
    needPointer = true;
  }
  info.Apply(cell);
  if(needPointer)
   _aspxSetPointerCursor(cell);
 },
 GetIDPostfix: function() {
  return "_" + this.row.toString() + "x" + this.column.toString();
 },
 GetCachedElementById: function(postfix) {
  if(this.calendar.IsMultiView())
   postfix += this.GetIDPostfix(); 
  return this.calendar.GetCachedElementById(this.calendar.name + "_" + postfix);
 },
 IsDateVisible: function(date) {
  var result = !this.calendar.IsMultiView() || !this.IsDateOtherMonth(date);
  if(!result) {   
   result = result || this.isLowBoundary && date <= this.visibleDate ||
    this.isHighBoundary && date >= this.visibleDate;
  }  
  return result;
 },
 MakeDisabledStateItems: function() {
  var cells = this.GetAuxCells();
  for(var i = 0; i < cells.length; i++)
   this.AddAuxDisabledStateItem(cells[i], this.GetAuxId(i));
  var element = this.GetTitleCell();
  if(_aspxIsExists(element))
   this.AddHeaderDisabledStateItem(element);
  var element = this.GetTitleElement();
  if(_aspxIsExists(element))
   this.AddHeaderDisabledStateItem(element);
 },
 AddAuxDisabledStateItem: function(element, id){
  var cell = this.calendar.GetEtalonStyleCell("DD");
  element.id = id;
  aspxGetStateController().AddDisabledItem(id, cell.className, cell.style.cssText, null, null, null);
 },
 AddHeaderDisabledStateItem: function(element){
  var cell = this.calendar.GetEtalonStyleCell("DD");
  aspxGetStateController().AddDisabledItem(element.id, cell.className, cell.style.cssText, null, null, null);
 },
 ChangeEnabledAttributes: function(enabled){
  var element = this.GetPrevYearCell();
  if(_aspxIsExists(element))
   this.ChangeButtonEnabledAttributes(element, _aspxChangeAttributesMethod(enabled));
  var element = this.GetPrevMonthCell();
  if(_aspxIsExists(element))
   this.ChangeButtonEnabledAttributes(element, _aspxChangeAttributesMethod(enabled));
  var element = this.GetTitleElement();
  if(_aspxIsExists(element)){
   this.ChangeButtonEnabledAttributes(element, _aspxChangeAttributesMethod(enabled));
   this.ChangeTitleElementEnabledAttributes(element, _aspxChangeStyleAttributesMethod(enabled));
  }
  var element = this.GetNextMonthCell();
  if(_aspxIsExists(element))
   this.ChangeButtonEnabledAttributes(element, _aspxChangeAttributesMethod(enabled));
  var element = this.GetNextYearCell();
  if(_aspxIsExists(element))
   this.ChangeButtonEnabledAttributes(element, _aspxChangeAttributesMethod(enabled));
  if(this.calendar.enabled && !this.calendar.readOnly)
   this.AttachMouseEvents(_aspxChangeEventsMethod(enabled), _aspxInitiallyChangeStyleAttributesMethod(enabled));
 },
 ChangeEnabledStateItems: function(enabled){
  this.SetAuxCellsEnabled(enabled);
  this.SetHeaderCellsEnabled(enabled);
 }, 
 ChangeTitleElementEnabledAttributes: function(element, method){
  method(element, "cursor");
 },
 ChangeButtonEnabledAttributes: function(element, method){
  method(element, "onclick");
  method(element, "ondblclick");
 },
 SetAuxCellsEnabled: function(enabled){
  var cells = this.GetAuxCells();
  for(var i = 0; i < cells.length; i++)
   aspxGetStateController().SetElementEnabled(cells[i], enabled);
 },
 SetHeaderCellsEnabled: function(enabled){
  var element = this.GetPrevYearCell();
  if(_aspxIsExists(element))
   aspxGetStateController().SetElementEnabled(element, enabled);
  var element = this.GetPrevMonthCell();
  if(_aspxIsExists(element))
   aspxGetStateController().SetElementEnabled(element, enabled);
  var element = this.GetTitleCell();
  if(_aspxIsExists(element))
   aspxGetStateController().SetElementEnabled(element, enabled);
  var element = this.GetTitleElement();
  if(_aspxIsExists(element))
   aspxGetStateController().SetElementEnabled(element, enabled);
  var element = this.GetNextMonthCell();
  if(_aspxIsExists(element))
   aspxGetStateController().SetElementEnabled(element, enabled);
  var element = this.GetNextYearCell();
  if(_aspxIsExists(element))
   aspxGetStateController().SetElementEnabled(element, enabled);
 },   
 GetAuxCells: function(){
  if(this.auxCells == null){
   this.auxCells = [];
   var table = this.GetMonthTable();
   for(var i = 0; i < table.rows.length; i++) {
    var row = table.rows[i];
    if(i == 0 && this.calendar.showDayHeaders) {    
     for(var j = 0; j < row.cells.length; j++)
      this.auxCells.push(row.cells[j]);
    }
    if(i > 0 && this.calendar.showWeekNumbers)
     this.auxCells.push(row.cells[0]);
   }
  }
  return this.auxCells;
 },
 GetAuxId: function(index) {
  return this.calendar.name + "_AUX_" + this.row + "_" + this.column + "_" + index;
 }
});
ASPxClientCalendarFastNavigation = _aspxCreateClass(null, {
 constructor: function(calendar) {
  this.calendar = calendar;
  this.activeMonth = -1;
  this.activeYear = -1;
  this.startYear = -1;
  this.activeView = null;
  this.InitializeUI();  
 },
 InitializeUI: function() {
  var item;
  var prefix = this.GetId();
  for(var m = 0; m < 12; m++) {
   item = this.GetMonthItem(m);
   if(!_aspxIsExistsElement(item))
    break;
   item.id = prefix + "_M" + m;
   _aspxAttachEventToElement(item, "click", new Function("aspxCalFNMClick('" + this.calendar.name + "', " + m + ")"));
  }
  for(var i = 0; i < 10; i++) {
   item = this.GetYearItem(i);
   if(!_aspxIsExistsElement(item))
    break;   
   item.id = prefix + "_Y" + i;
   _aspxAttachEventToElement(item, "click", new Function("aspxCalFNYClick('" + this.calendar.name + "', " + i + ")"));
  }
  _aspxAttachEventToElement(this.GetPopup().GetWindowElement(-1), "click", new Function("aspxCalMainElemClick('" + this.calendar.name + "')"));
 },
 Show: function() {
  this.GetPopup().ShowAtElement(this.activeView.GetTitleElement());
 },
 Hide: function() {
  this.GetPopup().Hide();
 },
 SetMonth: function(month) {
  if(month != this.activeMonth) {
   var prevCell = this.GetMonthItem(this.activeMonth);
   var cell = this.GetMonthItem(month);
   if(_aspxIsExistsElement(prevCell))
    this.ApplyItemStyle(prevCell, false, "M");
   this.ApplyItemStyle(cell, true, "M");
   this.activeMonth = month;   
  } 
 },
 ShiftMonth: function(offset) {
  var month = (this.activeMonth + offset) % 12;
  month = (month < 0) ? month + 12 : month;
  this.SetMonth(month);
 },
 SetYear: function(year) {
  var startYear = Math.floor(year / 10) * 10;
  this.SetStartYear(startYear);
  this.SetYearIndex(year - startYear);
 },
 SetYearIndex: function(index) {
  var prevIndex = this.activeYear - this.startYear;
  if(index != prevIndex) {
   var prevCell = this.GetYearItem(prevIndex);
   if(_aspxIsExistsElement(prevCell))
    this.ApplyItemStyle(prevCell, false, "Y");
   var cell = this.GetYearItem(index);
   this.ApplyItemStyle(cell, true, "Y");
   this.activeYear = index + this.startYear;
  } 
 },
 SetStartYear: function(year) {
  if(this.startYear == year) return;
  this.startYear = year;  
  this.PrepareYearList();
 },
 ShiftYear: function(offset) {
  this.SetYear(this.activeYear + offset);
 },
 ShiftStartYear: function(offset) {
  this.SetStartYear(this.startYear + offset);
 },
 ApplyChanges: function() {
  this.GetPopup().Hide();  
  var offset = ASPxClientCalendar.GetOffsetInMonths(this.calendar.visibleDate, new Date(this.activeYear, this.activeMonth, 1));
  offset -= this.activeView.row * this.calendar.columns + this.activeView.column;  
  if(offset != 0) {
   var date = ASPxClientCalendar.AddMonths(this.calendar.visibleDate, offset);
   this.calendar.OnVisibleMonthChanged(date);  
  }
  this.calendar.OnMainElementClick();
 },
 CancelChanges: function() {
  this.GetPopup().Hide();
  this.calendar.OnMainElementClick();
 },
 Prepare: function() {
  var date = this.activeView.visibleDate;
  this.activeYear = date.getFullYear();
  this.activeMonth = date.getMonth();
  this.startYear = ASPxClientCalendar.GetDecadeStartYear(this.activeYear);
  this.PrepareMonthList();
  this.PrepareYearList();
 }, 
 PrepareMonthList: function() {  
  var item;
  for(var month = 0; month < 12; month++) {
   item = this.GetMonthItem(month);
   if(item == null)
    return;
   this.ApplyItemStyle(item, month == this.activeMonth, "M");
  }  
 },
 PrepareYearList: function() {
  var year = this.startYear;
  var item;
  for(var index = 0; index < 10; index++) {
   item = this.GetYearItem(index);
   if(item == null)
    return;
   item.innerHTML = year;
   this.ApplyItemStyle(item, year == this.activeYear, "Y");
   year++;
  }   
 },
 GetMonthItem: function(month) {
  var t = this.GetCachedElementById("m");
  if(!_aspxIsExistsElement(t))
   return null;
  var colIndex = month % 4;
  var rowIndex = (month - colIndex) / 4;
  return t.rows[rowIndex].cells[colIndex];
 },
 GetYearItem: function(index) {
  var t = this.GetCachedElementById("y");
  if(!_aspxIsExistsElement(t) || index < 0 || index > 9)
   return null;
  var colIndex = index % 5;
  var rowIndex = (index - colIndex) / 5;
  if(rowIndex == 0)
   colIndex++;
  return t.rows[rowIndex].cells[colIndex];
 },
 GetPopup: function() {
  return aspxGetControlCollection().Get(this.GetId());
 },
 ApplyItemStyle: function(item, isSelected, type) {
  var info = new ASPxClientCalendarStyleInfo();
  this.calendar.ImportEtalonStyle(info, "FN" + type);
  if(isSelected)
   this.calendar.ImportEtalonStyle(info, "FN" + type + "S");
  info.Apply(item);  
 },
 GetCachedElementById: function(postfix) { 
  return this.calendar.GetCachedElementById(this.GetId() + "_" + postfix);
 },
 GetId: function() {
  return this.calendar.name + "_FNP";
 },
 OnArrowUp: function(evt) {
  if(!evt.shiftKey)
   this.ShiftYear(-5);
  else
   this.ShiftMonth(-4);
 },
 OnArrowDown: function(evt) {  
  if(!evt.shiftKey)
   this.ShiftYear(5);
  else
   this.ShiftMonth(4);
 },
 OnArrowLeft: function(evt) { 
  if(!evt.shiftKey)
   this.ShiftYear(-1);
  else
   this.ShiftMonth(-1);
 },
 OnArrowRight: function(evt) {
  if(!evt.shiftKey)
   this.ShiftYear(1);
  else
   this.ShiftMonth(1);
 },
 OnPageUp: function(evt) {
  this.ShiftYear(-10);
 },
 OnPageDown: function(evt) {
  this.ShiftYear(10);
 },
 OnEnter: function() {
  this.ApplyChanges();
 },
 OnEscape: function() {
  this.CancelChanges();
 },
 OnMonthClick: function(month) {
  this.SetMonth(month);
 },
 OnYearClick: function(index) {
  this.SetYearIndex(index);
 },
 OnYearShuffle: function(offset) {
  this.ShiftStartYear(offset);
 },
 OnOkClick: function() {
  this.ApplyChanges();
 },
 OnCancelClick: function() {
  this.CancelChanges();
 }
});
ASPxClientCalendarStyleInfo = _aspxCreateClass(null, {
 constructor: function() {
  this.className = "";
  this.cssText = "";
 },
 Clone: function() {
  var clone = new ASPxClientCalendarStyleInfo();
  clone.className = this.className;
  clone.cssText = this.cssText;
  return clone;
 },
 Apply: function(element) {
  if(element.className != this.className)
   element.className = this.className;
  if(element._style != this.cssText) {
   element.style.cssText = this.cssText; 
   element._style = this.cssText; 
  } 
 },
 Import: function(element) {
  if(element.className.length > 0) {
   if(this.className.length > 1)
    this.className += " ";
   this.className +=  element.className;
  }  
  var cssText = element.style.cssText;
  if(cssText.length > 0) {
   var pos = cssText.length - 1;
   while(pos > -1 && cssText.charAt(pos) == " ")
    --pos;
   if(cssText.charAt(pos) != ";")
    cssText += ";";
   this.cssText += cssText;
  }
 }  
});
ASPxClientCalendarSelectionEventArgs = _aspxCreateClass(ASPxClientProcessingModeEventArgs, {
 constructor: function(processOnServer, selection){
  this.constructor.prototype.constructor.call(this, processOnServer);
  this.selection = selection;
 }
});
function aspxCalShiftMonth(name, monthOffset) {
 if(monthOffset != 0) {
  var edit = aspxGetControlCollection().Get(name);
  if(edit != null) 
   edit.OnShiftMonth(monthOffset);  
 }
}
function aspxCalDayMouseEvt(name, row, column, index, e, byWeeks) {
 var cal = aspxGetControlCollection().Get(name);
 if(cal != null) {
  var view = cal.GetView(row, column);
  var date = view.GetDateByIndex(index);
  if(byWeeks)
   date = ASPxClientCalendar.AddDays(date, cal.firstDayOfWeek - date.getDay());
  var allowed = cal.IsDateInRange(date) && (view.IsDateVisible(date) || byWeeks);
  switch(e.type) {
   case "mousedown":
    if(allowed && _aspxGetIsLeftButtonPressed(e))
     cal.OnDayMouseDown(date, e.shiftKey, e.ctrlKey, byWeeks);
    break;
   case "mouseover":
    if(allowed) {
     if(cal.forceMouseDown)
      cal.OnDayMouseDown(date, false, false, false);
     else if(cal.isMouseDown)
      cal.OnDayMouseOver(date);
    }
    break;
   case "mouseup":
    if(cal.isMouseDown) {
     if(allowed)
      cal.OnDayMouseUp(date);
     else
      cal.OnSelectionCancelled();
    }
    break;
  }
 }
}
function aspxCalTodayClick(name) { 
 var edit = aspxGetControlCollection().Get(name);
 if(edit != null)
  edit.OnTodayClick();
}
function aspxCalClearClick(name) { 
 var edit = aspxGetControlCollection().Get(name);
 if(edit != null)
  edit.OnClearClick();  
}
function aspxCalSelectMonth(name, row, column) {
 var edit = aspxGetControlCollection().Get(name);
 if(edit != null)
  edit.OnSelectMonth(row, column);
}
function aspxCalTitleClick(name, row, column) {
 var edit = aspxGetControlCollection().Get(name);
 if(edit != null)
  edit.OnTitleClick(row, column);
}
function aspxCalFNMClick(name, month) {
 var edit = aspxGetControlCollection().Get(name);
 if(edit != null)
  edit.fastNavigation.OnMonthClick(month);
}
function aspxCalFNYClick(name, index) {
 var edit = aspxGetControlCollection().Get(name);
 if(edit != null)
  edit.fastNavigation.OnYearClick(index);
}
function aspxCalFNYShuffle(name, offset) {
 var edit = aspxGetControlCollection().Get(name);
 if(edit != null)
  edit.fastNavigation.OnYearShuffle(offset);
}
function aspxCalFNBClick(name, action) {
 var edit = aspxGetControlCollection().Get(name);
 if(edit != null) {
  switch(action) {
   case "ok":
    edit.fastNavigation.OnOkClick(); 
    break;
   case "cancel":
    edit.fastNavigation.OnCancelClick();
    break;
  }    
 }
}
function aspxCalMainElemClick(name) {
 var edit = aspxGetControlCollection().Get(name);
 if(edit != null)
  edit.OnMainElementClick();
}
function aspxCalDocMouseUp(evt) {
 var target = _aspxGetEventSource(evt);
 if(__aspxActiveCalendar != null && _aspxIsExistsElement(target)) {
  __aspxActiveCalendar.forceMouseDown = false;
  if(__aspxActiveCalendar.isMouseDown) {   
   for(var key in __aspxActiveCalendar.views) {   
    var view = __aspxActiveCalendar.views[key];
    if(view.constructor != ASPxClientCalendarView) continue;
    var monthCell = view.GetMonthCell();
    var parent = target.parentNode;
    while(_aspxIsExistsElement(parent)) {
     if(parent == monthCell)
      return;
     parent = parent.parentNode;
    }
   }
   __aspxActiveCalendar.OnSelectionCancelled();   
  }
  __aspxActiveCalendar = null;
 }
}
function aspxCalCancelSelect() {
 if(__aspxActiveCalendar != null) {
  __aspxActiveCalendar.forceMouseDown = false;
  __aspxActiveCalendar.OnSelectionCancelled();  
 }
}
