PageSourceSearch

https://aeronext.aero/DXR.axd?r=1_243,1_138,1_237,1_164,1_141,1_135,1_226,1_229,1_137,1_153,1_162,1_170-APS0v

js aeronext.aero collected 2026-09-29 07:37:10 UTC 659,156 bytes, 17,359 lines download raw bytes

1var ASPx = {};
2(function () {
3ASPx.EmptyObject = { };
4ASPx.FalseFunction = function() { return false; }
5ASPx.SSLSecureBlankUrl = '/DXR.axd?r=1_0-APS0v';
6ASPx.EmptyImageUrl = '/DXR.axd?r=1_35-APS0v';
7ASPx.VersionInfo = 'Version=\'16.1.11.0\', File Version=\'16.1.11.0\', Date Modified=\'25.06.2025 14:56:06\'';
8ASPx.InvalidDimension = -10000;
9ASPx.InvalidPosition = -10000;
10ASPx.AbsoluteLeftPosition = -10000;
11ASPx.EmptyGuid = "00000000-0000-0000-0000-000000000000";
12ASPx.CallbackSeparator = ":";
13ASPx.ItemIndexSeparator = "i";
14ASPx.CallbackResultPrefix = "/*DX*/";
15ASPx.AccessibilityEmptyUrl = "javascript:;";
16ASPx.AccessibilityPronounceTimeout = 500;
17ASPx.PossibleNumberDecimalSeparators = [",", "."];
18ASPx.CultureInfo = {
19 twoDigitYearMax: 2029,
20 ts: ":",
21 ds: "/",
22 am: "AM",
23 pm: "PM",
24 monthNames: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", ""],
25 genMonthNames: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "
25November", "December", ""],
26 abbrMonthNames: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ""],
27 abbrDayNames: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
28 dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
29 numDecimalPoint: ".",
30 numPrec: 2,
31 numGroupSeparator: ",", 
32 numGroups: [ 3 ],
33 numNegPattern: 1,
34 numPosInf: "Infinity", 
35 numNegInf: "-Infinity", 
36 numNan: "NaN",
37 currency: "$",
38 currDecimalPoint: ".",
39 currPrec: 2,
40 currGroupSeparator: ",",
41 currGroups: [ 3 ],
42 currPosPattern: 0,
43 currNegPattern: 0,
44 percentPattern: 0,
45 shortTime: "h:mm tt",
46 longTime: "h:mm:ss tt",
47 shortDate: "M/d/yyyy",
48 longDate: "dddd, MMMM d, yyyy",
49 monthDay: "MMMM d",
50 yearMonth: "MMMM yyyy"
51};
52ASPx.CultureInfo.genMonthNames = ASPx.CultureInfo.monthNames;
53ASPx.Position = {
54 Left: "Left",
55 Right: "Right",
56 Top: "Top",
57 Bottom: "Bottom"
58};
59var DateUtils = { };
60DateUtils.GetInvariantDateString = function(date) {
61 if(!date)
62  return "01/01/0001";
63 var day = date.getDate();
64 var month = date.getMonth() + 1;
65 var year = date.getFullYear();
66 var result = "";
67 if(month < 10)
68  result += "0";
69 result += month.toString() + "/";
70 if(day < 10)
71  result += "0";
72 result += day.toString() + "/";
73 if(year < 1000)
74  result += "0";
75 result += year.toString();
76 return result;
77}
78DateUtils.GetInvariantDateTimeString = function(date) {
79 var dateTimeString = DateUtils.GetInvariantDateString(date);
80 var time = {
81  h: date.getHours(),
82  m: date.getMinutes(),
83  s: date.getSeconds()
84 };
85 for(var key in time) {
86  var str = time[key].toString();
87  if(str.length < 2)
88   str = "0" + str;
89  time[key] = str;
90 }
91 dateTimeString += " " + time.h + ":" + time.m + ":" + time.s;
92 var msec = date.getMilliseconds();
93 if(msec > 0)
94  dateTimeString += "." + ("000" + msec.toString()).substr(-3);
95 return dateTimeString;
96}
97DateUtils.ExpandTwoDigitYear = function(value) {
98 value += 1900;
99 if(value + 99 < ASPx.CultureInfo.twoDigitYearMax)
100  value += 100;
101 return value;  
102}
103DateUtils.ToUtcTime = function(date) {
104 var result = new Date();
105 result.setTime(date.valueOf() + 60000 * date.getTimezoneOffset());
106 return result;
107}
108DateUtils.ToLocalTime = function(date) {
109 var result = new Date();
110 result.setTime(date.valueOf() - 60000 * date.getTimezoneOffset());
111 return result; 
112}
113DateUtils.AreDatesEqualExact = function(date1, date2) {
114 if(date1 == null && date2 == null)
115  return true;
116 if(date1 == null || date2 == null)
117  return false;
118 return date1.getTime() == date2.getTime(); 
119}
120DateUtils.FixTimezoneGap = function(oldDate, newDate) {
121 var diff = newDate.getHours() - oldDate.getHours();
122 if(diff == 0)
123  return;
124 var sign = (diff == 1 || diff == -23) ? -1 : 1;
125 var trial = new Date(newDate.getTime() + sign * 3600000);
126 if(sign > 0 || trial.getDate() == newDate.getDate())
127  newDate.setTime(trial.getTime());
128}
129ASPx.DateUtils = DateUtils;
130var Timer = { };
131Timer.ClearTimer = function(timerID){
132 if(timerID > -1)
133  window.clearTimeout(timerID);
134 return -1;
135}
136Timer.ClearInterval = function(timerID){
137 if(timerID > -1)
138  window.clearInterval(timerID);
139 return -1;
140}
141var setControlBoundTimer = function(handler, control, setTimerFunction, clearTimerFunction, delay) {
142 var timerId;
143 var getTimerId = function() { return timerId };
144 var boundHandler = function() {
145  var controlExists = control && ASPx.GetControlCollection().Get(control.name) === control;
146  if(controlExists)
147   handler.aspxBind(control)();
148  else
149   clearTimerFunction(getTimerId());
150 }
151 timerId = setTimerFunction(boundHandler, delay);
152 return timerId;
153}
154Timer.SetControlBoundTimeout = function(handler, control, delay) {
155 return setControlBoundTimer(handler, control, window.setTimeout, Timer.ClearTimer, delay);
156}
157Timer.SetControlBoundInterval = function(handler, control, delay) {
158 return setControlBoundTimer(handler, control, window.setInterval, Timer.ClearInterval, delay);
159}
160Timer.Throttle = function(func, delay) {
161 var isThrottled = false,
162   savedArgs,
163   savedThis = this;
164 function wrapper() {
165  if(isThrottled) {
166   savedArgs = arguments;
167   savedThis = this;
168   return;
169  }
170  func.apply(this, arguments);
171  isThrottled = true;
172  setTimeout(function() {
173   isThrottled = false;
174   if(savedArgs) {
175    wrapper.apply(savedThis, savedArgs);
176    savedArgs = null;
177   }
178  }, delay);
179 }
180 wrapper.cancel = function() {
181  clearTimeout(delay);
182  delay = savedArgs = savedThis = null;
183 };
184 return wrapper;
185}
186ASPx.Timer = Timer;
187var Browser = { };
188Browser.UserAgent = navigator.userAgent.toLowerCase();
189Browser.Mozilla = false;
190Browser.IE = false;
191Browser.Firefox = false;
192Browser.Netscape = false;
193Browser.Safari = false;
194Browser.Chrome = false;
195Browser.Opera = false;
196Browser.Edge = false;
197Browser.Version = undefined; 
198Browser.MajorVersion = undefined; 
199Browser.WindowsPlatform = false;
200Browser.MacOSPlatform = false;
201Browser.MacOSMobilePlatform = false;
202Browser.AndroidMobilePlatform = false;
203Browser.PlaformMajorVersion = false;
204Browser.WindowsPhonePlatform = false;
205Browser.AndroidDefaultBrowser = false;
206Browser.AndroidChromeBrowser = false;
207Browser.SamsungAndroidDevice = false;
208Browser.WebKitTouchUI = false;
209Browser.MSTouchUI = false;
210Browser.TouchUI = false;
211Browser.WebKitFamily = false; 
212Browser.NetscapeFamily = false; 
213Browser.HardwareAcceleration = false;
214Browser.VirtualKeyboardSupported = false;
215Browser.Info = "";
216function indentPlatformMajorVersion(userAgent) {
217 var regex = /(?:(?:windows nt|macintosh|mac os|cpu os|cpu iphone os|android|windows phone|linux) )(\d+)(?:[-0-9_.])*/;
218 var matches = regex.exec(userAgent);
219 if(matches)
220  Browser.PlaformMajorVersion = matches[1];
221}
222function getIECompatibleVersionString() {
223 if(document.compatible) {
224  for(var i = 0; i < document.compatible.length; i++)
225   if(document.compatible[i].userAgent === "IE" && document.compatible[i].version)
226    return document.compatible[i].version.toLowerCase();
227 }
228 return "";
229}
230Browser.IdentUserAgent = function(userAgent, ignoreDocumentMode) {
231 var browserTypesOrderedList = [ "Mozilla", "IE", "Firefox", "Netscape", "Safari", "Chrome", "Opera", "Opera10", "Edge" ];
232 var defaultBrowserType = "IE";
233 var defaultPlatform = "Win";
234 var defaultVersions = { Safari: 2, Chrome: 0.1, Mozilla: 1.9, Net
234scape: 8, Firefox: 2, Opera: 9, IE: 6, Edge: 12 };
235 if(!userAgent || userAgent.length == 0) {
236  fillUserAgentInfo(browserTypesOrderedList, defaultBrowserType, defaultVersions[defaultBrowserType], defaultPlatform);
237  return;
238 }
239 userAgent = userAgent.toLowerCase();
240 indentPlatformMajorVersion(userAgent);
241 try {
242  var platformIdentStrings = {
243   "Windows": "Win",
244   "Macintosh": "Mac",
245   "Mac OS": "Mac",
246   "Mac_PowerPC": "Mac",
247   "cpu os": "MacMobile",
248   "cpu iphone os": "MacMobile",
249   "Android": "Android",
250   "!Windows Phone": "WinPhone",
251   "!WPDesktop": "WinPhone",
252   "!ZuneWP": "WinPhone"
253  };
254  var optSlashOrSpace = "(?:/|\\s*)?";
255  var version = "(\\d+)(?:\\.((?:\\d+?[1-9])|\\d)0*?)?";
256  var optVersion = "(?:" + version + ")?";
257  var patterns = {
258   Safari: "applewebkit(?:.*?(?:version/" + version + "[\\.\\w\\d]*?(?:\\s+mobile\/\\S*)?\\s+safari))?",
259   Chrome: "(?:chrome|crios)(?!frame)" + optSlashOrSpace + optVersion,
260   Mozilla: "mozilla(?:.*rv:" + optVersion + ".*Gecko)?",
261   Netscape: "(?:netscape|navigator)\\d*/?\\s*" + optVersion,
262   Firefox: "firefox" + optSlashOrSpace + optVersion,
263   Opera: "(?:opera|opr)" + optSlashOrSpace + optVersion,
264   Opera10: "opera.*\\s*version" + optSlashOrSpace + optVersion,
265   IE: "msie\\s*" + optVersion,
266   Edge: "edge" + optSlashOrSpace + optVersion
267  };
268  var browserType;
269  var version = -1;
270  for(var i = 0; i < browserTypesOrderedList.length; i++) {
271   var browserTypeCandidate = browserTypesOrderedList[i];
272   var regExp = new RegExp(patterns[browserTypeCandidate], "i");
273   if(regExp.compile)
274    regExp.compile(patterns[browserTypeCandidate], "i");
275   var matches = regExp.exec(userAgent);
276   if(matches && matches.index >= 0) {
277    if(browserType == "IE" && version >= 11 && browserTypeCandidate == "Safari") 
278     continue;
279    browserType = browserTypeCandidate;
280    if(browserType == "Opera10")
281     browserType = "Opera";
282    var tridentPattern = "trident" + optSlashOrSpace + optVersion;
283    version = Browser.GetBrowserVersion(userAgent, matches, tridentPattern, getIECompatibleVersionString());
284    if(browserType == "Mozilla" && version >= 11)
285     browserType = "IE";
286   }
287  }
288  if(!browserType)
289   browserType = defaultBrowserType;
290  var browserVersionDetected = version != -1;
291  if(!browserVersionDetected)
292   version = defaultVersions[browserType];
293  var platform;
294  var minOccurenceIndex = Number.MAX_VALUE;
295  for(var identStr in platformIdentStrings) {
296   if(!platformIdentStrings.hasOwnProperty(identStr)) continue;
297   var importantIdent = identStr.substr(0,1) == "!";
298   var occurenceIndex = userAgent.indexOf((importantIdent ? identStr.substr(1) : identStr).toLowerCase());
299   if(occurenceIndex >= 0 && (occurenceIndex < minOccurenceIndex || importantIdent)) {
300    minOccurenceIndex = importantIdent ? 0 : occurenceIndex;
301    platform = platformIdentStrings[identStr];
302   }
303  }
304  var samsungPattern = "SM-[A-Z]";
305  var matches = userAgent.toUpperCase().match(samsungPattern);
306  var isSamsungAndroidDevice = matches && matches.length > 0;
307  if(platform == "WinPhone" && version < 9)
308   version = Math.floor(getVersionFromTrident(userAgent, "trident" + optSlashOrSpace + optVersion));
309  if(!ignoreDocumentMode && browserType == "IE" && version > 7 && document.documentMode < version)
310   version = document.documentMode;
311  if(platform == "WinPhone")
312   version = Math.max(9, version);
313  if(!platform)
314   platform = defaultPlatform;
315  if(platform == platformIdentStrings["cpu os"] && !browserVersionDetected) 
316   version = 4;
317  fillUserAgentInfo(browserTypesOrderedList, browserType, version, platform, isSamsungAndroidDevice);
318 } catch(e) {
319  fillUserAgentInfo(browserTypesOrderedList, defaultBrowserType, defaultVersions[defaultBrowserType], defaultPlatform);
320 }
321}
322function getVersionFromMatches(matches) {
323 var result = -1;
324 var versionStr = "";
325 if(matches[1]) {
326  versionStr += matches[1];
327  if(matches[2])
328   versionStr += "." + matches[2];
329 }
330 if(versionStr != "") {
331  result = parseFloat(versionStr);
332  if(result == NaN)
333   result = -1;
334 }
335 return result;
336}
337function getVersionFromTrident(userAgent, tridentPattern) {
338 var tridentDiffFromVersion = 4;
339 var matches = new RegExp(tridentPattern, "i").exec(userAgent);
340 return getVersionFromMatches(matches) + tridentDiffFromVersion;
341}
342Browser.GetBrowserVersion = function(userAgent, matches, tridentPattern, ieCompatibleVersionString) {
343 var version = getVersionFromMatches(matches);
344 if(ieCompatibleVersionString) {
345  var versionFromTrident = getVersionFromTrident(userAgent, tridentPattern);
346  if(ieCompatibleVersionString === "edge" || parseInt(ieCompatibleVersionString) === versionFromTrident)
347   return versionFromTrident;
348 }
349 return version;
350}
351function fillUserAgentInfo(browserTypesOrderedList, browserType, version, platform, isSamsungAndroidDevice) {
352 for(var i = 0; i < browserTypesOrderedList.length; i++) {
353  var type = browserTypesOrderedList[i];
354  Browser[type] = type == browserType;
355 }
356 Browser.Version = Math.floor(10.0 * version) / 10.0;
357 Browser.MajorVersion = Math.floor(Browser.Version);
358 Browser.WindowsPlatform = platform == "Win" || platform == "WinPhone";
359 Browser.MacOSPlatform = platform == "Mac";
360 Browser.MacOSMobilePlatform = platform == "MacMobile";
361 Browser.AndroidMobilePlatform = platform == "Android";
362 Browser.WindowsPhonePlatform = platform == "WinPhone";
363 Browser.WebKitFamily = Browser.Safari || Browser.Chrome || Browser.Opera && Browser.MajorVersion >= 15;
364 Browser.NetscapeFamily = Browser.Netscape || Browser.Mozilla || Browser.Firefox;
365 Browser.HardwareAcceleration = (Browser.IE && Browser.MajorVersion >= 9) || (Browser.Firefox && Browser.MajorVersion >= 4) || 
366  (Browser.AndroidMobilePlatform && Browser.Chrome) || (Browser.Chrome && Browser.MajorVersion >= 37) || 
367  (Browser.Safari && !Browser.WindowsPlatform) || Browser.Edge;
368 Browser.WebKitTouchUI = Browser.MacOSMobilePlatform || Browser.AndroidMobilePlatform;
369 var isIETouchUI = Browser.IE && Browser.MajorVersion > 9 && Browser.WindowsPlatform && Browser.UserAgent.toLowerCase().indexOf("touch") >= 0;
370 Browser.MSTouchUI = isIETouchUI || (Browser.Edge && !!window.navigator.maxTouchPoints);
371 Browser.TouchUI = Browser.WebKitTouchUI || Browser.MSTouchUI;
372 Browser.MobileUI = Browser.WebKitTouchUI || Browser.WindowsPhonePlatform;
373 Browser.AndroidDefaultBrowser = Browser.AndroidMobilePlatform && !Browser.Chrome;
374 Browser.AndroidChromeBrowser = Browser.AndroidMobilePlatform && Browser.Chrome;
375 if(isSamsungAndroidDevice)
376  Browser.SamsungAndroidDevice = isSamsungAndroidDevice;
377 if(Browser.MSTouchUI) {
378  var isARMArchitecture = Browser.UserAgent.toLowerCase().indexOf("arm;") > -1;    
379  Browser.VirtualKeyboardSupported = isARMArchitecture || Browser.WindowsPhonePlatform;   
380 } else {
381  Browser.VirtualKeyboardSupported = Browser.WebKitTouchUI;
382 }
383 fillDocumentElementBrowserTypeClassNames(browserTypesOrderedList);
384}
385function fillDocumentElementBrowserTypeClassNames(browserTypesOrderedList) {
386 var documentElementClassName = "";
387 var browserTypeslist = browserTypesOrderedList.concat(["WindowsPlatform", "MacOSPlatform", "MacOSMobilePlatform", "AndroidMobilePlatform",
388   "WindowsPhonePlatform", "WebKitFamily", "WebKitTouchUI", "MSTouchUI", "TouchUI", "AndroidDefaultBrowser"]);
389 for(var i = 0; i < browserTypeslist.length; i++) {
390  var type = browserTypeslist[i];
391  if(Browser[type])
392   documentElementClassName += "dx" + type + " ";
393 }
394 documentElementClassName += "dxBrowserVersion-" + Browser.MajorVersion
395 if(document && document.documentElement) {
396  if(document.documentElement.className != "")
397   documentElementClassName = " " + documentElementClassName;
398  document.documentElement.className += documentElementClassName;
399  Browser.Info = documentElementClassName;
400 }
401}
402Browser.IdentUserAgent(Browser.UserAgent);
403ASPx.Browser = Browser;
404ASPx.BlankUrl = Browser.IE ? ASPx.SSLSecureBlankUrl : (Browser.Opera ? "about:blank" : "");
405var Data = { };
406Data.ArrayInsert = function(array, element, position){
407 if(0 <= position && position < array.length){
408  for(var i = array.length; i > position; i --)
409   array[i] = array[i - 1];
410  array[position] = element;
411 }
412 else
413  array.push(element);
414}
415Data.ArrayRemove = function(array, element){
416 var index = Data.ArrayIndexOf(array, element);
417 if(index > -1) Data.ArrayRemoveAt(array, index);
418}
419Data.ArrayRemoveAt = function(array, index){
420 if(index >= 0  && index < array.length){
421  for(var i = index; i < array.length - 1; i++)
422   array[i] = array[i + 1];
423  array.pop();
424 }
425}
426Data.ArrayClear = function(array){
427 while(array.length > 0)
428  array.pop();
429}
430Data.ArrayIndexOf = function(array, element, comparer) {
431 if(!comparer) {
432  for(var i = 0; i < array.length; i++) {
433   if(array[i] == element)
434    return i;
435  }
436 } else {
437  for(var i = 0; i < array.length; i++) {
438   if(comparer(array[i], element))
439    return i;
440  }
441 }
442 return -1;
443}
444Data.ArrayContains = function(array, element) { 
445 return Data.ArrayIndexOf(array, element) >= 0;
446}
447Data.ArrayEqual = function(array1, array2) {
448 var count1 = array1.length;
449 var count2 = array2.length;
450 if(count1 != count2)
451  return false;
452 for(var i = 0; i < count1; i++)
453  if(array1[i] != array2[i])
454   return false;
455 return true;
456}
457Data.ArrayGetIntegerEdgeValues = function(array) {
458 var arrayToSort = Data.CollectionToArray(array);
459 Data.ArrayIntegerAscendingSort(arrayToSort);
460 return {
461  start: arrayToSort[0],
462  end: arrayToSort[arrayToSort.length - 1]
463 }
464}
465Data.ArrayIntegerAscendingSort = function(array){
466 Data.ArrayIntegerSort(array);
467}
468Data.ArrayIntegerSort = function(array, desc) {
469 array.sort(function(i1, i2) {
470  var res = 0;
471  if(i1 > i2)
472   res = 1;
473  else if(i1 < i2)
474   res = -1;
475  if(desc)
476   res *= -1;
477  return res;
478 });
479},
480Data.CollectionsUnionToArray = function(firstCollection, secondCollection) {
481 var result = [];
482 var firstCollectionLength = firstCollection.length;
483 var secondCollectionLength = secondCollection.length;
484 for(var i = 0; i <  firstCollectionLength + secondCollectionLength; i++) {
485  if(i < firstCollectionLength) 
486   result.push(firstCollection[i]);
487  else 
488   result.push(secondCollection[i - firstCollectionLength]);
489 }  
490 return result;
491}
492Data.CollectionToArray = function(collection) {
493 var array = [];
494 for(var i = 0; i < collection.length; i++)
495  array.push(collection[i]);
496 return array;
497}
498Data.CreateHashTableFromArray = function(array) {
499 var hash = [];
500 for(var i = 0; i < array.length; i++)
501  hash[array[i]] = 1;
502 return hash;
503}
504Data.CreateIndexHashTableFromArray = function(array) {
505 var hash = [];
506 for(var i = 0; i < array.length; i++)
507  hash[array[i]] = i;
508 return hash;
509}
510var defaultBinarySearchComparer = function(array, index, value) {
511 var arrayElement = array[index];
512 if(arrayElement == value)
513  return 0;
514 else
515  return arrayElement < value ? -1 : 1;
516};
517Data.NearestLeftBinarySearchComparer = function(array, index, value) { 
518 var arrayElement = array[index];
519 var leftPoint = arrayElement < value;
520 var lastLeftPoint = leftPoint && index == array.length - 1;
521 var nearestLeftPoint = lastLeftPoint || (leftPoint && array[index + 1] >= value)
522 if(nearestLeftPoint)
523  return 0;
524 else
525  return arrayElement < value ? -1 : 1;
526};
527Data.ArrayBinarySearch = function(array, value, binarySearchComparer, startIndex, length) {
528 if(!binarySearchComparer)
529  binarySearchComparer = defaultBinarySearchComparer;
530 if(!ASPx.IsExists(startIndex))
531  startIndex = 0;
532 if(!ASPx.IsExists(length))
533  length = array.length - startIndex;  
534 var endIndex = (startIndex + length) - 1;
535 while(startIndex <= endIndex) {
536  var middle =  (startIndex + ((endIndex - startIndex) >> 1));
537  var compareResult = binarySearchComparer(array, middle, value);
538  if(compareResult == 0)
539   return middle;
540  if(compareResult < 0)
541   startIndex = middle + 1;
542  else
543   endIndex = middle - 1;
544 }
545 return -(startIndex + 1);
546},
547Data.ArrayFlattern = function(arrayOfArrays) {
548 return [].concat.apply([], arrayOfArrays);
549},
550Data.GetDistinctArray = function(array) {
551 var resultArray = [];
552 for(var i = 0; i < array.length; i++) {
553  var currentEntry = array[i];
554  if(Data.ArrayIndexOf(resultArray, currentEntry) == -1) {
555     resultArray.push(currentEntry);
556  }
557 }
558 return resultArray;
559}
560Data.ForEach = function(arr, callback) {
561 if(Array.prototype.forEach) {
562  Array.prototype.forEach.call(arr, callback);
563 } else {
564  for(var i = 0, len = arr.length; i < len; i++) {
565   callback(arr[i], i, arr);
566  }
567 }
568},
569Data.MergeHashTables = function(target, object) {
570 if(!object || typeof (object) == "string")
571  return target;
572 if(!target)
573  target = {};
574 for(var key in object)
575  if(key && !(key in target))
576   target[key] = object[key];
577 return target;
578}
579ASPx.Data = Data;
580var Cookie = { };
581Cookie.DelCookie = function(name){
582 setCookieInternal(name, "", new Date(1970, 1, 1));
583}
584Cookie.GetCookie = function(name) {
585 name = escape(name);
586 var cookies = document.cookie.split(';');
587 for(var i = 0; i < cookies.length; i++) {
588  var cookie = Str.Trim(cookies[i]);
589  if(cookie.indexOf(name + "=") == 0)
590   return unescape(cookie.substring(name.length + 1, cookie.length));
591  else if(cookie.indexOf(name + ";") == 0 || cookie === name)
592   return "";
593 }
594 return null;
595}
596Cookie.SetCookie = function(name, value, expirationDate){
597 if(!ASPx.IsExists(value)) {
598  Cookie.DelCookie(name);
599  return;
600 }
601 if(!ASPx.Ident.IsDate(expirationDate)) {
602  expirationDate = new Date();
603  expirationDate.setFullYear(expirationDate.getFullYear() + 1);
604 }
605 setCookieInternal(name, value, expirationDate);
606}
607function setCookieInternal(name, value, date){
608 document.cookie = escape(name) + "=" + escape(value.toString()) + "; expires=" + date.toGMTString() + "; path=/";
609}
610ASPx.Cookie = Cookie;
611ASPx.ImageUtils = {
612 GetImageSrc: function (image){
613  return image.src;
614 },
615 SetImageSrc: function(image, src){
616  image.src = src;
617 },
618 SetSize: function(image, width, height){
619  image.style.width = width + "px";
620  image.style.height = height + "px";
621 },
622 GetSize: function(image, isWidth){
623  return (isWidth ? image.offsetWidth : image.offsetHeight);
624 }
625};
626var Str = { };
627Str.ApplyReplacement = function(text, replecementTable) {
628 if(typeof(text) != "string")
629  text = text.toString();
630 for(var i = 0; i < replecementTable.length; i++) {
631  var replacement = replecementTable[i];
632  text = text.replace(replacement[0], replacement[1]);
633 }
634 return text;
635}
636Str.CompleteReplace = function(text, regexp, newSubStr) {
637 if(typeof(text) != "string")
638  text = text.toString();
639 var textPrev;
640 do {
641  textPrev = text;
642  text = text.replace(regexp, newSubStr);
643 } while(text != textPrev);
644 return text;
645}
646Str.EncodeHtml = function(html) {
647 return Str.ApplyReplacement(html, [
648  [ /&amp;/g,  '&ampx;'  ], [ /&/g, '&amp;'  ],
649  [ /&quot;/g, '&quotx;' ], [ /"/g, '&quot;' ],
650  [ /&lt;/g,   '&ltx;'   ], [ /</g, '&lt;'   ],
651  [ /&gt;/g,   '&gtx;'   ], [ />/g, '&gt;'   ]
652 ]);
653}
654Str.DecodeHtml = function(html) {
655 return Str.ApplyReplacement(html, [
656  [ /&gt;/g,   '>' ], [ /&gtx;/g,  '&gt;'   ],
657  [ /&lt;/g,   '<' ], [ /&ltx;/g,  '&lt;'   ],
658  [ /&quot;/g, '"' ], [ /&quotx;/g,'&quot;' ],
659  [ /&amp;/g,  '&' ], [ /&ampx;/g, '&amp;'  ]
660 ]);
661}
662Str.TrimStart = function(str) { 
663 return trimInternal(str, true);
664}
665Str.TrimEnd = function(str) { 
666 return trimInternal(str, false, true);
667}
668Str.Trim = function(str) { 
669 return trimInternal(str, true, true); 
670}
671var whiteSpaces = { 
672 0x0009: 1, 0x000a: 1, 0x000b: 1, 0x000c: 1, 0x000d: 1, 0x0020: 1, 0x0085: 1, 
673 0x00a0: 1, 0x1680: 1, 0x180e: 1, 0x2000: 1, 0x2001: 1, 0x2002: 1, 0x2003: 1, 
674 0x2004: 1, 0x2005: 1, 0x2006: 1, 0x2007: 1, 0x2008: 1, 0x2009: 1, 0x200a: 1, 
675 0x200b: 1, 0x2028: 1, 0x2029: 1, 0x202f: 1, 0x205f: 1, 0x3000: 1
676};
677var caretWidth = 1;
678function trimInternal(source, trimStart, trimEnd) {
679 var len = source.length;
680 if(!len)
681  return source;
682 if(len < 0xBABA1) { 
683  var result = source;
684  if(trimStart) {
685   result = result.replace(/^\s+/, "");
686  }
687  if(trimEnd) {
688   result = result.replace(/\s+$/, "");
689  }
690  return result;  
691 } else {
692  var start = 0;
693  if(trimEnd) {   
694   while(len > 0 && whiteSpaces[source.charCodeAt(len - 1)]) {
695    len--;
696   }
697  }
698  if(trimStart && len > 0) {
699   while(start < len && whiteSpaces[source.charCodeAt(start)]) { 
700    start++; 
701   }   
702  }
703  return source.substring(start, len);
704 }
705}
706Str.Insert = function(str, subStr, index) { 
707 var leftText = str.slice(0, index);
708 var rightText = str.slice(index);
709 return leftText + subStr + rightText;
710}
711Str.InsertEx = function(str, subStr, startIndex, endIndex) { 
712 var leftText = str.slice(0, startIndex);
713 var rightText = str.slice(endIndex);
714 return leftText + subStr + rightText;
715}
716var greekSLFSigmaChar = String.fromCharCode(962);
717var greekSLSigmaChar = String.fromCharCode(963);
718Str.PrepareStringForFilter = function(s){
719 s = s.toLowerCase();
720 if(ASPx.Browser.WebKitFamily) {
721  return s.replace(new RegExp(greekSLFSigmaChar, "g"), greekSLSigmaChar);
722 }
723 return s;
724}
725Str.GetCoincideCharCount = function(text, filter, textMatchingDelegate) {
726 var coincideText = ASPx.Str.PrepareStringForFilter(filter);
727 var originText = ASPx.Str.PrepareStringForFilter(text);
728 while(coincideText != "" && !textMatchingDelegate(originText, coincideText)) {
729  coincideText = coincideText.slice(0, -1);
730 }
731 return coincideText.length;
732}
733ASPx.Str = Str;
734var Xml = { };
735Xml.Parse = function(xmlStr) {
736 if(window.DOMParser) {
737  var parser = new DOMParser();
738  return parser.parseFromString(xmlStr, "text/xml");
739 }
740 else if(window.ActiveXObject) {
741  var xmlDoc = new window.ActiveXObject("Microsoft.XMLDOM");
742  if(xmlDoc) {
743   xmlDoc.async = false;
744   xmlDoc.loadXML(xmlStr);
745   return xmlDoc;
746  }
747 }
748 return null;
749}
750ASPx.Xml = Xml;
751ASPx.Key = {
752 F1     : 112,
753 F2     : 113,
754 F3     : 114,
755 F4     : 115,
756 F5     : 116,
757 F6     : 117,
758 F7     : 118,
759 F8     : 119,
760 F9     : 120,
761 F10    : 121,
762 F11    : 122,
763 F12    : 123,
764 Ctrl   : 17,
765 Shift  : 16,
766 Alt    : 18,
767 Enter  : 13,
768 Home   : 36,
769 End    : 35,
770 Left   : 37,
771 Right  : 39,
772 Up     : 38,
773 Down   : 40,
774 PageUp    : 33,
775 PageDown  : 34,
776 Esc    : 27,
777 Space  : 32,
778 Tab    : 9,
779 Backspace : 8,
780 Delete    : 46,
781 Insert    : 45,
782 ContextMenu  : 93,
783 Windows   : 91,
784 Decimal   : 110
785};
786ASPx.KeyCode = {
787 Backspace : 8,
788 Tab    : 9,
789 Enter  : 13,
790 Pause  : 19,
791 CapsLock  : 20,
792 Esc    : 27,
793 Space  : 32,
794 PageUp    : 33,
795 PageDown  : 34,
796 End    : 35,
797 Home   : 36,
798 Left   : 37,
799 Up     : 38,
800 Right  : 39,
801 Down   : 40,
802 Insert    : 45,
803 Delete    : 46,
804 Key_0  : 48,
805 Key_1  : 49,
806 Key_2  : 50,
807 Key_3  : 51,
808 Key_4  : 52,
809 Key_5  : 53,
810 Key_6  : 54,
811 Key_7  : 55,
812 Key_8  : 56,
813 Key_9  : 57,
814 Key_a  : 65,
815 Key_b  : 66,
816 Key_c  : 67,
817 Key_d  : 68,
818 Key_e  : 69,
819 Key_f  : 70,
820 Key_g  : 71,
821 Key_h  : 72,
822 Key_i  : 73,
823 Key_j  : 74,
824 Key_k  : 75,
825 Key_l  : 76,
826 Key_m  : 77,
827 Key_n  : 78,
828 Key_o  : 79,
829 Key_p  : 80,
830 Key_q  : 81,
831 Key_r  : 82,
832 Key_s  : 83,
833 Key_t  : 84,
834 Key_u  : 85,
835 Key_v  : 86,
836 Key_w  : 87,
837 Key_x  : 88,
838 Key_y  : 89,
839 Key_z  : 90,
840 Windows   : 91,
841 ContextMenu  : 93,
842 Numpad_0  : 96,
843 Numpad_1  : 97,
844 Numpad_2  : 98,
845 Numpad_3  : 99,
846 Numpad_4  : 100,
847 Numpad_5  : 101,
848 Numpad_6  : 102,
849 Numpad_7  : 103,
850 Numpad_8  : 104,
851 Numpad_9  : 105,
852 Multiply  : 106,
853 Add    : 107,
854 Subtract  : 109,
855 Decimal   : 110,
856 Divide    : 111,
857 F1     : 112,
858 F2     : 113,
859 F3     : 114,
860 F4     : 115,
861 F5     : 116,
862 F6     : 117,
863 F7     : 118,
864 F8     : 119,
865 F9     : 120,
866 F10    : 121,
867 F11    : 122,
868 F12    : 123,
869 NumLock   : 144,
870 ScrollLock   : 145,
871 Semicolon : 186,
872 Equals    : 187,
873 Comma  : 188,
874 Dash   : 189,
875 Period    : 190,
876 ForwardSlash : 191,
877 GraveAccent  : 192,
878 OpenBracket  : 219,
879 BackSlash : 220,
880 CloseBracket : 221,
881 SingleQuote  : 222
882};
883ASPx.ScrollBarMode = { Hidden: 0, Visible: 1, Auto: 2 };
884ASPx.ColumnResizeMode = { None: 0, Control: 1, NextColumn: 2 };
885var Selection = { };
886Selection.Set = function(input, startPos, endPos, scrollToSelection) {
887 if(!ASPx.IsExistsElement(input))
888  return;
889 if(Browser.VirtualKeyboardSupported && (ASPx.GetActiveElement() !== input || ASPx.VirtualKeyboardUI.getInputNativeFocusLocked()))
890  return;
891 var textLen = input.value.length;
892 startPos = ASPx.GetDefinedValue(startPos, 0);
893 endPos = ASPx.GetDefinedValue(endPos, textLen);
894 if(startPos < 0)
895  startPos = 0;
896 if(endPos < 0 || endPos > textLen)
897  endPos = textLen;
898 if(startPos > endPos)
899  startPos = endPos;
900 var makeReadOnly = false;
901 if(Browser.WebKitFamily && input.readOnly) {
902  input.readOnly = false;
903  makeReadOnly = true;
904 }
905 try {
906  if(Browser.Firefox && Browser.Version >= 8) 
907   input.setSelectionRange(startPos, endPos, "backward");
908  else if(Browser.IE && input.createTextRange) {
909   var range = input.createTextRange();
910   range.collapse(true);
911   range.moveStart("character", startPos);
912   range.moveEnd("character", endPos - startPos);
913   range.select();
914  } else {
915   forceScrollToSelectionRange(input, startPos, endPos);
916   input.setSelectionRange(startPos, endPos);
917  }
918  if(Browser.Opera || Browser.Firefox || Browser.Chrome) 
919   input.focus();
920 } catch(e) { 
921 }
922 if(scrollToSelection && input.tagName == 'TEXTAREA') {
923  var scrollHeight = input.scrollHeight;
924  var approxCaretPos = startPos;
925  var scrollTop = Math.max(Math.round(approxCaretPos * scrollHeight / textLen  - input.clientHeight / 2), 0);
926  input.scrollTop = scrollTop;
927 }
928 if(makeReadOnly)
929  input.readOnly = true;
930}
931var getTextWidthBeforePos = function(input, pos) {
932 return ASPx.GetSizeOfText(input.value.toString().substr(0, pos), ASPx.GetCurrentStyle(input)).width;
933}
934var forceScrollToSelectionRange = function(input, startPos, endPos) {
935 var widthBeforeStartPos = getTextWidthBeforePos(input, startPos) - caretWidth;
936 var widthBeforeEndPos = getTextWidthBeforePos(input, endPos) + caretWidth;
937 var inputRawWidth = input.offsetWidth - ASPx.GetLeftRightBordersAndPaddingsSummaryValue(input);
938 if(input.scrollLeft < widthBeforeEndPos - inputRawWidth)
939  input.scrollLeft = widthBeforeEndPos - inputRawWidth;
940 else if(input.scrollLeft > widthBeforeStartPos)
941  input.scrollLeft = widthBeforeStartPos;
942}
943Selection.GetInfo = function(input) {
944 var start, end;
945 if(Browser.IE && Browser.Version < 9) {
946  var range = document.selection.createRange();
947  var rangeCopy = range.duplicate();
948  range.move('character', -input.value.length);
949  range.setEndPoint('EndToStart', rangeCopy);
950  start = range.text.length;
951  end = start + rangeCopy.text.length;
952 } else {
953  try {
954   start = input.selectionStart;
955   end = input.selectionEnd;
956  } catch (e) {
957  }
958 }
959 return { startPos: start, endPos: end };
960}
961Selection.GetExtInfo = function(input) {
962 var start = 0, end = 0, textLen = 0;
963 if(Browser.IE && Browser.Version < 9) {
964  var normalizedValue;
965  var range, textInputRange, textInputEndRange;
966  range = document.selection.createRange();
967  if(range && range.parentElement() == input) {
968   textLen = input.value.length;
969   normalizedValue = input.value.replace(/\r\n/g, "\n");
970   textInputRange = input.createTextRange();
971   textInputRange.moveToBookmark(range.getBookmark());
972   textInputEndRange = input.createTextRange();
973   textInputEndRange.collapse(false);
974   if(textInputRange.compareEndPoints("StartToEnd", textInputEndRange) > -1) {
975    start = textLen;
976    end = textLen;
977   } else {
978    start = normalizedValue.slice(0, start).split("\n").length - textInputRange.moveStart("character", -textLen) -1;
979    if(textInputRange.compareEndPoints("EndToEnd", textInputEndRange) > -1)
980     end = textLen;
981    else
982     end = normalizedValue.slice(0, end).split("\n").length - textInputRange.moveEnd("character", -textLen) - 1;    
983   }
984  }
985  return {startPos: start, endPos: end};
986 }
987 try {
988  start = input.selectionStart;
989  end = input.selectionEnd;
990 } catch (e) {
991 }
992 return {startPos: start, endPos: end}; 
993}
994Selection.SetCaretPosition = function(input, caretPos) {
995 if(typeof caretPos === "undefined" || caretPos < 0)
996  caretPos = input.value.length;
997 Selection.Set(input, caretPos, caretPos, true);
998}
999Selection.GetCaretPosition = function(element, isDialogMode) {
1000 var pos = 0;
1001 if("selectionStart" in element) {
1002  pos = element.selectionStart;
1003 } else if("selection" in document) {
1004  element.focus();
1005  var sel = document.selection.createRange(),
1006   selLength = document.selection.createRange().text.length;
1007  sel.moveStart("character", -element.value.length);
1008  pos = sel.text.length - selLength;
1009 }
1010 if(isDialogMode && !pos) {
1011  pos = element.value.length - 1;
1012 }
1013 return pos;
1014}
1015Selection.Clear = function() {
1016 try {
1017  if(window.getSelection) {
1018   window.getSelection().removeAllRanges();
1019  }
1020  else if(document.selection) {
1021   if(document.selection.empty)
1022    document.selection.empty();
1023   else if(document.selection.clear)
1024    document.selection.clear();
1025  }
1026 } catch(e) {
1027 }
1028}
1029Selection.ClearOnMouseMove = function(evt) {
1030 if(!Browser.IE || (evt.button != 0)) 
1031  Selection.Clear();
1032}
1033Selection.SetElementSelectionEnabled = function(element, value) {
1034 var userSelectValue = value ? "" : "none";
1035 var func = value ? Evt.DetachEventFromElement : Evt.AttachEventToElement;
1036 if(Browser.Firefox)
1037  element.style.MozUserSelect = userSelectValue;
1038 else if(Browser.WebKitFamily)
1039  element.style.webkitUserSelect = userSelectValue;
1040 else if(Browser.Opera)
1041  func(element, "mousemove", Selection.Clear);
1042 else {
1043  func(element, "selectstart", ASPx.FalseFunction);
1044  func(element, "mousemove", Selection.Clear);
1045 }
1046}
1047Selection.SetElementAsUnselectable = function(element, isWithChild, recursive) {
1048 if(element && element.nodeType == 1) {
1049  element.unselectable = "on";
1050  if(Browser.NetscapeFamily)
1051   element.onmousedown = ASPx.FalseFunction;
1052  if((Browser.IE && Browser.Version >= 9) || Browser.WebKitFamily)
1053   Evt.AttachEventToElement(element, "mousedown", Evt.PreventEventAndBubble);
1054  if(isWithChild === true){
1055   for(var j = 0; j < element.childNodes.length; j ++)
1056    Selection.SetElementAsUnselectable(element.childNodes[j], (!!recursive ? true : false), (!!recursive));
1057  }
1058 }
1059}
1060Selection.AreEqual = function(selection1, selection2) {
1061 return selection1.startPos === selection2.startPos && selection1.endPos === selection2.endPos;
1062}
1063ASPx.Selection = Selection;
1064var MouseScroller = { };
1065MouseScroller.MinimumOffset = 10;
1066MouseScroller.Create = function(getElement, getScrollXElement, getScrollYElement, needPreventScrolling, vertRecursive, onMouseDown, onMouseMove, onMouseUp, onMouseUpMissed) {
1067 var element = getElement();
1068 if(!element) 
1069  return;
1070 if(!element.dxMouseScroller)
1071  element.dxMouseScroller = new MouseScroller.Extender(getElement, getScrollXElement, getScrollYElement, needPreventScrolling, vertRecursive, onMouseDown, onMouseMove, onMouseUp, onMouseUpMissed);
1072 return element.dxMouseScroller;
1073}
1074MouseScroller.Extender = function(getElement, getScrollXElement, getScrollYElement, needPreventScrolling, vertRecursive, onMouseDown, onMouseMove, onMouseUp, onMouseUpMissed) {
1075 this.getElement = getElement;
1076 this.getScrollXElement = getScrollXElement;
1077 this.getScrollYElement = getScrollYElement;
1078 this.needPreventScrolling = needPreventScrolling;
1079 this.vertRecursive = !!vertRecursive;
1080 this.createHandlers(onMouseDown || function() { }, onMouseMove || function() { }, onMouseUp || function() { }, onMouseUpMissed || function() { });
1081 this.update()
1082};
1083MouseScroller.Extender.prototype = {
1084 update: function() {
1085  if(this.element)
1086   Evt.DetachEventFromElement(this.element, ASPx.TouchUIHelper.touchMouseDownEventName, this.mouseDownHandler);
1087  this.element = this.getElement();
1088  Evt.AttachEventToElement(this.element, ASPx.TouchUIHelper.touchMouseDownEventName, this.mouseDownHandler);  
1089  Evt.AttachEventToElement(this.element, "click", this.mouseClickHandler);   
1090  if(Browser.MSTouchUI && this.element.className.indexOf(ASPx.TouchUIHelper.msTouchDraggableClassName) < 0)
1091   this.element.className += " " + ASPx.TouchUIHelper.msTouchDraggableClassName;
1092  this.scrollXElement = this.getScrollXElement();
1093  this.scrollYElement = this.getScrollYElement();
1094 },
1095 createHandlers: function(onMouseDown, onMouseMove, onMouseUp, onMouseUpMissed) {
1096  var mouseDownCounter = 0;
1097  this.onMouseDown = onMouseDown;
1098  this.onMouseMove = onMouseMove;
1099  this.onMouseUp = onMouseUp;  
1100  this.mouseDownHandler = function(e) {
1101   if(mouseDownCounter++ > 0) {
1102    this.finishScrolling();
1103    onMouseUpMissed();
1104   }
1105   var eventSource = Evt.GetEventSource(e);
1106   var requirePreventCustonScroll = ASPx.IsExists(ASPx.TouchUIHelper.RequirePreventCustomScroll) && ASPx.TouchUIHelper.RequirePreventCustomScroll(eventSource, this.element);
1107   if(requirePreventCustonScroll || this.needPreventScrolling && this.needPreventScrolling(eventSource))
1108    return;
1109   this.scrollableTreeLine = this.GetScrollableElements();
1110   this.firstX = this.prevX = Evt.GetEventX(e);
1111   this.firstY = this.prevY = Evt.GetEventY(e);
1112   Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseMoveEventName, this.mouseMoveHandler);
1113   Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseUpEventName, this.mouseUpHandler);
1114   this.onMouseDown(e);
1115  }.aspxBind(this);
1116  this.mouseMoveHandler = function(e) {
1117   if(ASPx.TouchUIHelper.isGesture)
1118    return;
1119   var x = Evt.GetEventX(e);
1120   var y = Evt.GetEventY(e);
1121   var xDiff = this.prevX - x;
1122   var yDiff = this.prevY - y;
1123   if(this.vertRecursive) {
1124    var isTopDirection = yDiff < 0;
1125    this.scrollYElement = this.GetElementForVertScrolling(isTopDirection, this.prevIsTopDirection, this.scrollYElement);
1126    this.prevIsTopDirection = isTopDirection;
1127   }
1128   if(this.scrollXElement && xDiff != 0)
1129    this.scrollXElement.scrollLeft += xDiff;
1130   if(this.scrollYElement && yDiff != 0) {
1131    this.scrollYElement.scrollTop += yDiff;
1132    var isOuterScrollableElement = this.scrollableTreeLine[this.scrollableTreeLine.length - 1] == this.scrollYElement;
1133    if(isOuterScrollableElement)
1134     y += yDiff;
1135   }
1136   this.prevX = x;
1137   this.prevY = y;
1138   e.preventDefault();
1139   this.onMouseMove(e);
1140  }.aspxBind(this);
1141  this.mouseUpHandler = function(e) {
1142   this.finishScrolling();
1143   this.onMouseUp(e);
1144  }.aspxBind(this);
1145  this.mouseClickHandler = function(e){
1146   if(this.needPreventScrolling && this.needPreventScrolling(Evt.GetEventSource(e)))
1147    return;
1148   var xDiff = this.firstX - Evt.GetEventX(e);
1149   var yDiff = this.firstY - Evt.GetEventY(e);
1150   if(xDiff > MouseScroller.MinimumOffset || yDiff > MouseScroller.MinimumOffset)
1151    return Evt.PreventEventAndBubble(e);
1152  }.aspxBind(this);
1153  this.finishScrolling = function() {
1154   Evt.DetachEventFromDocument(ASPx.TouchUIHelper.touchMouseMoveEventName, this.mouseMoveHandler);
1155   Evt.DetachEventFromDocument(ASPx.TouchUIHelper.touchMouseUpEventName, this.mouseUpHandler);
1156   this.scrollableTreeLine = [];
1157   this.prevIsTopDirection = null;
1158   mouseDownCounter--;
1159  };
1160 },
1161 GetScrollableElements: function() {
1162  var result = [ ];
1163  var el = this.element;
1164  while(el && el != document && this.vertRecursive) {
1165   var outerScrollableElementTag = ASPx.Browser.IE ? "HTML" : "BODY";
1166   if(this.CanVertScroll(el) || el.tagName == outerScrollableElementTag)
1167    result.push(el);
1168   el = el.parentNode;
1169  }
1170  return result;
1171 },
1172 CanVertScroll: function(element) {
1173  var style = ASPx.GetCurrentStyle(element);
1174  return style.overflow == "scroll" || style.overflow == "auto" || style.overflowY == "scroll" || style.overflowY == "auto";
1175 },
1176 GetElementForVertScrolling: function(currentIsTop, prevIsTop, prevElement) {
1177  if(prevElement && currentIsTop === prevIsTop && this.GetVertScrollExcess(prevElement, currentIsTop) > 0)
1178   return prevElement;
1179  for(var i = 0; i < this.scrollableTreeLine.length; i++) {
1180   var element = this.scrollableTreeLine[i];
1181   var excess = this.GetVertScrollExcess(element, currentIsTop);
1182   if(excess > 0)
1183    return element;
1184  }
1185  return null;
1186 },
1187 GetVertScrollExcess: function(element, isTop) {
1188  if(isTop)
1189   return element.scrollTop;
1190  var isBodyElement = element.tagName == "BODY";
1191  var clientHeight = isBodyElement ? ASPx.GetDocumentClientHeight() : element.clientHeight;
1192  return element.scrollHeight - clientHeight - element.scrollTop;
1193 }
1194}
1195ASPx.MouseScroller = MouseScroller;
1196var Evt = { };
1197Evt.GetEvent = function(evt){
1198 return (typeof(event) != "undefined" && event != null && Browser.IE) ? event : evt; 
1199}
1200Evt.IsEventPrevented = function(evt) {
1201 return evt.defaultPrevented || evt.returnValue === false;
1202}
1203Evt.PreventEvent = function(evt){
1204 if(evt.preventDefault)
1205  evt.preventDefault();
1206 else
1207  evt.returnValue = false;
1208 return false;
1209}
1210Evt.PreventEventAndBubble = function(evt){
1211 Evt.PreventEvent(evt);
1212 if(evt.stopPropagation)
1213  evt.stopPropagation();
1214 evt.cancelBubble = true;
1215 return false;
1216}
1217Evt.CancelBubble = function(evt){
1218 evt.cancelBubble = true;
1219 return false;
1220}
1221Evt.PreventImageDragging = function(image) {
1222 if(image) {
1223  if(Browser.NetscapeFamily)
1224   image.onmousedown = function(evt) {
1225    evt.cancelBubble = true;
1226    return false;
1227   };
1228  else
1229   image.ondragstart = function() {
1230    return false;
1231   };
1232 }
1233}
1234Evt.PreventDragStart = function(evt) {
1235 evt = Evt.GetEvent(evt);
1236 var element = Evt.GetEventSource(evt);
1237 if(element.releaseCapture)
1238  element.releaseCapture(); 
1239 return false;
1240}
1241Evt.PreventElementDrag = function(element) {
1242 if(Browser.IE)
1243  Evt.AttachEventToElement(element, "dragstart", Evt.PreventEvent);
1244 else
1245  Evt.AttachEventToElement(element, "mousedown", Evt.PreventEvent);
1246}
1247Evt.PreventElementDragAndSelect = function(element, skipMouseMove, skipIESelect){
1248 if(Browser.WebKitFamily)
1249  Evt.AttachEventToElement(element, "selectstart", Evt.PreventEventAndBubble);
1250 if(Browser.IE){
1251  if(!skipIESelect)
1252   Evt.AttachEventToElement(element, "selectstart", ASPx.FalseFunction);
1253  if(!skipMouseMove)
1254   Evt.AttachEventToElement(element, "mousemove", Selection.ClearOnMouseMove);
1255  Evt.AttachEventToElement(element, "dragstart", Evt.PreventDragStart);
1256 }
1257}
1258Evt.GetEventSource = function(evt){
1259 if(!ASPx.IsExists(evt)) return null; 
1260 return evt.srcElement ? evt.srcElement : evt.target;
1261}
1262Evt.GetKeyCode = function(srcEvt) {
1263 return Browser.NetscapeFamily || Browser.Opera ? srcEvt.which : srcEvt.keyCode;
1264}
1265function clientEventRequiresDocScrollCorrection() {
1266 var isSafariVerLess3 = Browser.Safari && Browser.Version < 3,
1267  isMacOSMobileVerLess51 = Browser.MacOSMobilePlatform && Browser.Version < 5.1;
1268 return Browser.AndroidDefaultBrowser || Browser.AndroidChromeBrowser || !(isSafariVerLess3 || isMacOSMobileVerLess51);
1269}
1270Evt.GetEventX = function(evt){
1271 if(ASPx.TouchUIHelper.isTouchEvent(evt))
1272  return ASPx.TouchUIHelper.getEventX(evt);
1273 return evt.clientX + (clientEventRequiresDocScrollCorrection() ? ASPx.GetDocumentScrollLeft() : 0);
1274}
1275Evt.GetEventY = function(evt){
1276 if(ASPx.TouchUIHelper.isTouchEvent(evt))
1277  return ASPx.TouchUIHelper.getEventY(evt);
1278 return evt.clientY + (clientEventRequiresDocScrollCorrection() ? ASPx.GetDocumentScrollTop() : 0 );
1279}
1280Evt.IsLeftButtonPressed = function(evt){
1281 if(ASPx.TouchUIHelper.isTouchEvent(evt)) 
1282  return true;
1283 evt = Evt.GetEvent(evt);
1284 if(!evt) return false;
1285 if(Browser.IE && Browser.Version < 11){
1286  if(Browser.MSTouchUI)
1287   return true;
1288  return evt.button % 2 == 1; 
1289 }
1290 else if(Browser.NetscapeFamily || Browser.WebKitFamily || (Browser.IE && Browser.Version >= 11) || Browser.Edge) {
1291  if(evt.type === "pointermove")
1292   return evt.buttons === 1;
1293  return evt.which == 1;
1294 }
1295 else if(Browser.Opera)
1296  return evt.button == 0;  
1297 return true;  
1298}
1299Evt.IsRightButtonPressed = function(evt){
1300 evt = Evt.GetEvent(evt);
1301 if(!ASPx.IsExists(evt)) return false;
1302 if(Browser.IE || Browser.Edge) {
1303  if(evt.type === "pointermove")
1304   return evt.buttons === 2;
1305  return evt.button == 2;
1306 }
1307 else if(Browser.NetscapeFamily || Browser.WebKitFamily)
1308  return evt.which == 3;
1309 else if (Browser.Opera)
1310  return evt.button == 1;
1311 return true;
1312}
1313Evt.GetWheelDelta = function(evt){
1314 var ret = Browser.NetscapeFamily ? -evt.detail : evt.wheelDelta;
1315 if(Browser.Opera && Browser.Version < 9)
1316  ret = -ret;
1317 return ret;
1318}
1319Evt.IsWheelEventWithDirection = function(evt) {
1320 return ASPx.Data.ArrayContains(["wheel", "mousewheel"], evt.type);
1321}
1322Evt.GetWheelDeltaX = function(evt) {
1323 if(evt.type === "wheel")
1324  return -evt.deltaX;
1325 if(evt.type === "mousewheel")
1326  return evt.wheelDeltaX;
1327}
1328Evt.GetWheelDeltaY = function(evt) {
1329 if(evt.type === "wheel")
1330  return -evt.deltaY;
1331 if(evt.type === "mousewheel")
1332  return evt.wheelDeltaY;
1333}
1334Evt.AttachEventToElement = function(element, eventName, func, onlyBubbling) {
1335 if(element.addEventListener)
1336  element.addEventListener(eventName, func, !onlyBubbling);
1337 else
1338  element.attachEvent("on" + eventName, func);
1339}
1340Evt.DetachEventFromElement = function(element, eventName, func) {
1341 if(element.removeEventListener)
1342  element.removeEventListener(eventName, func, true);
1343 else
1344  element.detachEvent("on" + eventName, func);
1345}
1346Evt.AttachEventToDocument = function(eventName, func) {
1347 var attachingAllowed = ASPx.TouchUIHelper.onEventAttachingToDocument(eventName, func);
1348 if(attachingAllowed)
1349  Evt.AttachEventToDocumentCore(eventName, func);
1350}
1351Evt.AttachEventToDocumentCore = function(eventName, func) {
1352 Evt.AttachEventToElement(document, eventName, func);
1353}
1354Evt.DetachEventFromDocument = function(eventName, func) {
1355 Evt.DetachEventFromDocumentCore(eventName, func);
1356 ASPx.TouchUIHelper.onEventDettachedFromDocument(eventName, func);
1357}
1358Evt.DetachEventFromDocumentCore = function(eventName, func){
1359 Evt.DetachEventFromElement(document, eventName, func);
1360}
1361Evt.GetMouseWheelEventName = function(){
1362 return Browser.NetscapeFamily ? "DOMMouseScroll" : "mousewheel";
1363}
1364Evt.AttachMouseEnterToElement = function (element, onMouseOverHandler, onMouseOutHandler) {
1365 Evt.AttachEventToElement(element, ASPx.TouchUIHelper.pointerEnabled ? ASPx.TouchUIHelper.pointerOverEventName : "mouseover", function (evt) { mouseEnterHandler(evt, element, onMouseOverHandler, onMouseOutHandler); });
1366 Evt.AttachEventToElement(element, ASPx.TouchUIHelper.pointerEnabled ? ASPx.TouchUIHelper.pointerOutEventName : "mouseout", function (evt) { mouseEnterHandler(evt, element, onMouseOverHandler, onMouseOutHandler); });
1367}
1368Evt.GetEventRelatedTarget = function(evt, isMouseOverEvent) {
1369 return evt.relatedTarget || (isMouseOverEvent ? evt.srcElement : evt.toElement);
1370}
1371function mouseEnterHandler(evt, element, onMouseOverHandler, onMouseOutHandler) {
1372 var isMouseOverExecuted = !!element.dxMouseOverExecuted;
1373 var isMouseOverEvent = (evt.type == "mouseover" || evt.type == ASPx.TouchUIHelper.pointerOverEventName);
1374 if(isMouseOverEvent && isMouseOverExecuted || !isMouseOverEvent && !isMouseOverExecuted)
1375  return;
1376 var source = Evt.GetEventRelatedTarget(evt, isMouseOverEvent);
1377 if(!ASPx.GetIsParent(element, source)) {
1378  element.dxMouseOverExecuted = isMouseOverEvent;
1379  if(isMouseOverEvent)
1380   onMouseOverHandler(element);
1381  else
1382   onMouseOutHandler(element);
1383 }
1384 else if(isMouseOverEvent && !isMouseOverExecuted) {
1385  element.dxMouseOverExecuted = true;
1386  onMouseOverHandler(element);
1387 }
1388}
1389Evt.DispatchEvent = function(target, eventName, canBubble, cancellable) {
1390 var event;
1391 if(Browser.IE && Browser.Version < 9) {
1392  eventName = "on" + eventName;
1393  if(eventName in target) {
1394   event = document.createEventObject();
1395   target.fireEvent("on" + eventName, event);
1396  }
1397 } else {
1398  event = document.createEvent("Event");
1399  event.initEvent(eventName, canBubble || false, cancellable || false);
1400  target.dispatchEvent(event);
1401 }
1402}
1403Evt.EmulateDocumentOnMouseDown = function(evt) {
1404 Evt.EmulateOnMouseDown(document, evt);
1405}
1406Evt.EmulateOnMouseDown = function(element, evt) {
1407 if(Browser.IE && Browser.Version < 9)
1408  element.fireEvent("onmousedown", evt);
1409 else if(!Browser.WebKitFamily){
1410  var emulatedEvt = document.createEvent("MouseEvents");
1411  emulatedEvt.initMouseEvent("mousedown", true, true, window, 0, evt.screenX, evt.screenY, 
1412   evt.clientX, evt.clientY, evt.ctrlKey, evt.altKey, evt.shiftKey, false, 0, null);
1413  element.dispatchEvent(emulatedEvt);
1414 }
1415}
1416Evt.EmulateOnMouseEvent = function (type, element, evt) {
1417 evt.type = type;
1418 var emulatedEvt = document.createEvent("MouseEvents");
1419 emulatedEvt.initMouseEvent(type, true, true, window, 0, evt.screenX, evt.screenY,
1420  evt.clientX, evt.clientY, evt.ctrlKey, evt.altKey, evt.shiftKey, false, 0, null);
1421 emulatedEvt.target = element;
1422 element.dispatchEvent(emulatedEvt);
1423}
1424Evt.EmulateMouseClick = function (element, evt) {
1425 var x = element.offsetWidth / 2;
1426 var y = element.offsetHeight / 2;
1427 if (!evt)
1428  evt = {
1429   bubbles: true,
1430   cancelable: true,
1431   view: window,
1432   detail: 1,
1433   screenX: 0,
1434   screenY: 0,
1435   clientX: x,
1436   clientY: y,
1437   ctrlKey: false,
1438   altKey: false,
1439   shiftKey: false,
1440   metaKey: false,
1441   button: 0,
1442   relatedTarget: null
1443  };
1444 Evt.EmulateOnMouseEvent("mousedown", element, evt);
1445 Evt.EmulateOnMouseEvent("mouseup", element, evt);
1446 Evt.EmulateOnMouseEvent("click", element, evt);
1447}
1448Evt.DoElementClick = function(element) {
1449 try{
1450  element.click();
1451 }
1452 catch(e){ 
1453 }
1454}
1455ASPx.Evt = Evt;
1456var Attr = { };
1457Attr.GetAttribute = function(obj, attrName){
1458 if(obj.getAttribute)
1459  return obj.getAttribute(attrName);
1460 else if(obj.getPropertyValue)
1461  return obj.getPropertyValue(attrName);
1462 return null;
1463}
1464Attr.SetAttribute = function(obj, attrName, value){
1465 if(obj.setAttribute)
1466  obj.setAttribute(attrName, value);
1467 else if(obj.setProperty)
1468  obj.setProperty(attrName, value, "");
1469}
1470Attr.RemoveAttribute = function(obj, attrName){
1471 if(obj.removeAttribute)
1472  obj.removeAttribute(attrName);
1473 else if(obj.removeProperty)
1474  obj.removeProperty(attrName);
1475}
1476Attr.IsExistsAttribute = function(obj, attrName){
1477 var value = Attr.GetAttribute(obj, attrName);
1478 return (value != null) && (value !== "");
1479}
1480Attr.SetOrRemoveAttribute = function(obj, attrName, value) {
1481 if(!value)
1482  Attr.RemoveAttribute(obj, attrName);
1483 else
1484  Attr.SetAttribute(obj, attrName, value);
1485}
1486Attr.SaveAttribute = function(obj, attrName, savedObj, savedAttrName){
1487 if(!Attr.IsExistsAttribute(savedObj, savedAttrName)){
1488  var oldValue = Attr.IsExistsAttribute(obj, attrName) ? Attr.GetAttribute(obj, attrName) : ASPx.EmptyObject;
1489  Attr.SetAttribute(savedObj, savedAttrName, oldValue);
1490 }
1491}
1492Attr.SaveStyleAttribute = function(obj, attrName){
1493 Attr.SaveAttribute(obj.style, attrName, obj, "saved" + attrName);
1494}
1495Attr.ChangeAttributeExtended = function(obj, attrName, savedObj, savedAttrName, newValue){
1496 Attr.SaveAttribute(obj, attrName, savedObj, savedAttrName);
1497 Attr.SetAttribute(obj, attrName, newValue);
1498}
1499Attr.ChangeAttribute = function(obj, attrName, newValue){
1500 Attr.ChangeAttributeExtended(obj, attrName, obj, "saved" + attrName, newValue);
1501}
1502Attr.ChangeStyleAttribute = function(obj, attrName, newValue){
1503 Attr.ChangeAttributeExtended(obj.style, attrName, obj, "saved" + attrName, newValue);
1504}
1505Attr.ResetAttributeExtended = function(obj, attrName, savedObj, savedAttrName){
1506 Attr.SaveAttribute(obj, attrName, savedObj, savedAttrName);
1507 Attr.SetAttribute(obj, attrName, "");
1508 Attr.RemoveAttribute(obj, attrName);
1509}
1510Attr.ResetAttribute = function(obj, attrName){
1511 Attr.ResetAttributeExtended(obj, attrName, obj, "saved" + attrName);
1512}
1513Attr.ResetStyleAttribute = function(obj, attrName){
1514 Attr.ResetAttributeExtended(obj.style, attrName, obj, "saved" + attrName);
1515}
1516Attr.RestoreAttributeExtended = function(obj, attrName, savedObj, savedAttrName){
1517 if(Attr.IsExistsAttribute(savedObj, savedAttrName)){
1518  var oldValue = Attr.GetAttribute(savedObj, savedAttrName);
1519  if(oldValue != ASPx.EmptyObject)
1520   Attr.SetAttribute(obj, attrName, oldValue);
1521  else
1522   Attr.RemoveAttribute(obj, attrName);
1523  Attr.RemoveAttribute(savedObj, savedAttrName);
1524  return true;
1525 }
1526 return false;
1527}
1528Attr.RestoreAttribute = function(obj, attrName){
1529 return Attr.RestoreAttributeExtended(obj, attrName, obj, "saved" + attrName);
1530}
1531Attr.RestoreStyleAttribute = function(obj, attrName){
1532 return Attr.RestoreAttributeExtended(obj.style, attrName, obj, "saved" + attrName);
1533}
1534Attr.CopyAllAttributes = function(sourceElem, destElement) {
1535 var attrs = sourceElem.attributes;
1536 for(var n = 0; n < attrs.length; n++) {
1537  var attr = attrs[n];
1538  if(attr.specified) {
1539   var attrName = attr.nodeName;
1540   var attrValue = sourceElem.getAttribute(attrName, 2);
1541   if(attrValue == null)
1542    attrValue = attr.nodeValue;
1543   destElement.setAttribute(attrName, attrValue, 0); 
1544  }
1545 }
1546 if(sourceElem.style.cssText !== '')
1547  destElement.style.cssText = sourceElem.style.cssText;
1548}
1549Attr.RemoveAllAttributes = function(element, excludedAttributes) {
1550 var excludedAttributesHashTable = {};
1551 if(excludedAttributes)
1552  excludedAttributesHashTable = Data.CreateHashTableFromArray(excludedAttributes);
1553 if(element.attributes) {
1554  var attrArray = element.attributes;
1555  for(var i = 0; i < attrArray.length; i++) {
1556   var attrName = attrArray[i].name;
1557   if(!ASPx.IsExists(excludedAttributesHashTable[attrName.toLowerCase()])) {
1558    try {
1559     attrArray.removeNamedItem(attrName);
1560    } catch (e) { }
1561   }
1562  }
1563 }
1564}
1565Attr.RemoveStyleAttribute = function(element, attrName) {
1566 if(element.style) {
1567  if(Browser.Firefox && element.style[attrName]) 
1568   element.style[attrName] = "";
1569  if(element.style.removeAttribute && element.style.removeAttribute != "")
1570   element.style.removeAttribute(attrName);
1571  else if(element.style.removeProperty && element.style.removeProperty != "")
1572   element.style.removeProperty(attrName);
1573 }
1574}
1575Attr.RemoveAllStyles = function(element) {
1576 if(element.style) {
1577  for(var key in element.style)
1578   Attr.RemoveStyleAttribute(element, key);
1579    Attr.RemoveAttribute(element, "style");
1580 }
1581}
1582Attr.GetTabIndexAttributeName = function(){
1583 return Browser.IE  ? "tabIndex" : "tabindex";
1584}
1585Attr.ChangeTabIndexAttribute = function(element){
1586 var attribute = Attr.GetTabIndexAttributeName(); 
1587 if(Attr.GetAttribute(element, attribute) != -1)
1588    Attr.ChangeAttribute(element, attribute, -1);
1589}
1590Attr.SaveTabIndexAttributeAndReset = function(element) {
1591 var attribute = Attr.GetTabIndexAttributeName();
1592 Attr.SaveAttribute(element, attribute, element, "saved" + attribute);
1593 Attr.SetAttribute(element, attribute, -1);
1594}
1595Attr.RestoreTabIndexAttribute = function(element){
1596 var attribute = Attr.GetTabIndexAttributeName();
1597 if(Attr.IsExistsAttribute(element, attribute)) {
1598  if(Attr.GetAttribute(element, attribute) == -1) {
1599   if(Attr.IsExistsAttribute(element, "saved" + attribute)){
1600    var oldValue = Attr.GetAttribute(element, "saved" + attribute);
1601    if(oldValue != ASPx.EmptyObject)
1602     Attr.SetAttribute(element, attribute, oldValue);
1603    else {
1604     if(Browser.WebKitFamily) 
1605      Attr.SetAttribute(element, attribute, 0); 
1606     Attr.RemoveAttribute(element, attribute);   
1607    }
1608    Attr.RemoveAttribute(element, "saved" + attribute); 
1609   }
1610  }
1611 }
1612}
1613Attr.ChangeAttributesMethod = function(enabled){
1614 return enabled ? Attr.RestoreAttribute : Attr.ResetAttribute;
1615}
1616Attr.InitiallyChangeAttributesMethod = function(enabled){
1617 return enabled ? Attr.ChangeAttribute : Attr.ResetAttribute;
1618}
1619Attr.ChangeStyleAttributesMethod = function(enabled){
1620 return enabled ? Attr.RestoreStyleAttribute : Attr.ResetStyleAttribute;
1621}
1622Attr.InitiallyChangeStyleAttributesMethod = function(enabled){
1623 return enabled ? Attr.ChangeStyleAttribute : Attr.ResetStyleAttribute;
1624}
1625Attr.ChangeEventsMethod = function(enabled){
1626 return enabled ? Evt.AttachEventToElement : Evt.DetachEventFromElement;
1627}
1628Attr.ChangeDocumentEventsMethod = function(enabled){
1629 return enabled ? Evt.AttachEventToDocument : Evt.DetachEventFromDocument;
1630}
1631ASPx.Attr = Attr;
1632var Aria = {
1633 checked: "aria-checked",
1634 descendant: "aria-activedescendant",
1635 described: "aria-describedby",
1636 disabled: "aria-disabled",
1637 expanded: "aria-expanded",
1638 haspopup: "aria-haspopup",
1639 invalid: "aria-invalid",
1640 label: "aria-label",
1641 labelled: "aria-labelledby",
1642 level: "aria-level",
1643 owns: "aria-owns",
1644 posinset: "aria-posinset",
1645 role: "role",
1646 selected: "aria-selected",
1647 setsize: "aria-setsize",
1648 valuemax: "aria-valuemax",
1649 valuemin: "aria-valuemin",
1650 valuenow: "aria-valuenow"
1651};
1652Aria.SetOrRemoveDescendant = function(obj, value) {
1653 ASPx.Attr.SetOrRemoveAttribute(obj, Aria.descendant, value);
1654}
1655Aria.SetOrRemoveLabel = function(obj, value) {
1656 ASPx.Attr.SetOrRemoveAttribute(obj, Aria.label, value);
1657}
1658Aria.SetOrRemoveLabelled = function(obj, value) {
1659 ASPx.Attr.SetOrRemoveAttribute(obj, Aria.labelled, value);
1660}
1661Aria.SetSilence = function(obj) {
1662 ASPx.Attr.SetAttribute(obj, Aria.label, ";");
1663}
1664ASPx.Attr.Aria = Aria;
1665var Color = { };
1666function _aspxToHex(d) {
1667 return (d < 16) ? ("0" + d.toString(16)) : d.toString(16);
1668}
1669Color.ColorToHexadecimal = function(colorValue) {
1670 if(typeof(colorValue) == "number") {
1671  var r = colorValue & 0xFF;
1672  var g = (colorValue >> 8) & 0xFF;
1673  var b = (colorValue >> 16) & 0xFF;
1674  return "#" + _aspxToHex(r) + _aspxToHex(g) + _aspxToHex(b);
1675 }
1676 if(colorValue && (colorValue.substr(0, 3).toLowerCase() == "rgb")) {
1677  var re = /rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/;
1678  var regResult = colorValue.toLowerCase().match(re);
1679  if(regResult) {
1680   var r = parseInt(regResult[1]);
1681   var g = parseInt(regResult[2]);
1682   var b = parseInt(regResult[3]);
1683   return "#" + _aspxToHex(r) + _aspxToHex(g) + _aspxToHex(b);
1684  }
1685  return null;
1686 } 
1687 if(colorValue && (colorValue.charAt(0) == "#"))
1688  return colorValue;
1689 return null;
1690}
1691Color.Names = {
1692 AddColorNames: function(stringResourcesObj) {
1693  if(stringResourcesObj) {
1694   for(var key in stringResourcesObj)
1695    this[key] = stringResourcesObj[key];
1696  }
1697 }
1698}
1699ASPx.Color = Color;
1700var Url = { };
1701Url.Navigate = function(url, target) {
1702 var javascriptPrefix = "javascript:";
1703 if(url == "")
1704  return;
1705 else if(url.indexOf(javascriptPrefix) != -1) 
1706  eval(url.substr(javascriptPrefix.length));
1707 else {
1708  try{
1709   if(target != "")
1710    navigateTo(url, target);
1711   else
1712    location.href = url;
1713  }
1714  catch(e){
1715  }
1716 }
1717}
1718Url.NavigateByLink = function(linkElement) {
1719 Url.Navigate(Attr.GetAttribute(linkElement, "href"), linkElement.target);
1720}
1721Url.GetAbsoluteUrl = function(url) {
1722 if(url)
1723  url = Url.getURLObject(url).href;
1724 return url;
1725}
1726var absolutePathPrefixes = 
1727 [ "about:", "file:///", "ftp://", "gopher://", "http://", "https://", "javascript:", "mailto:", "news:", "res://", "telnet://", "view-source:" ];
1728Url.isAbsoluteUrl = function(url) {
1729 if (url) {
1730  for (var i = 0; i < absolutePathPrefixes.length; i++) {
1731   if(url.indexOf(absolutePathPrefixes[i]) == 0)
1732    return true;
1733  }
1734 }
1735 return false;
1736}
1737Url.getURLObject = function(url) {
1738 var link = document.createElement('A');
1739 link.href = url || "";
1740 return { 
1741  href: link.href,
1742  protocol: link.protocol,
1743  host: link.host,
1744  port: link.port,
1745  pathname: link.pathname,
1746  search: link.search,
1747  hash: link.hash
1748 }; 
1749}
1750Url.getRootRelativeUrl = function(url) {
1751 return getRelativeUrl(url, !Url.isRootRelativeUrl(url), true); 
1752}
1753Url.getPathRelativeUrl = function(url) {
1754 return getRelativeUrl(url, !Url.isPathRelativeUrl(url), false);
1755}
1756function getRelativeUrl(url, isValid, isRootRelative) {
1757 if(url && !(/data:([^;]+\/?[^;]*)(;charset=[^;]*)?(;base64,)/.test(url)) && isValid) {
1758  var urlObject = Url.getURLObject(url);
1759  var baseUrlObject = Url.getURLObject();
1760  if(!Url.isAbsoluteUrl(url) || urlObject.host === baseUrlObject.host && urlObject.protocol === baseUrlObject.protocol) {
1761   url = urlObject.pathname;
1762   if(!isRootRelative)
1763    url = getPathRelativeUrl(baseUrlObject.pathname, url);
1764   url = url + urlObject.search + urlObject.hash;
1765  }
1766 }
1767 return url;   
1768}
1769function getPathRelativeUrl(baseUrl, url) {
1770 var requestSegments = getSegments(baseUrl, false);
1771 var urlSegments = getSegments(url, true);
1772 return buildPathRelativeUrl(requestSegments, urlSegments, 0, 0, "");
1773}
1774function getSegments(url, addTail) {
1775 var segments = [];
1776 var startIndex = 0;
1777 var endIndex = -1;
1778 while ((endIndex = url.indexOf("/", startIndex)) != -1) {
1779  segments.push(url.substring(startIndex, ++endIndex));
1780  startIndex = endIndex;
1781 }
1782 if(addTail && startIndex < url.length)
1783  segments.push(url.substring(startIndex, url.length)); 
1784 return segments;
1785}
1786function buildPathRelativeUrl(requestSegments, urlSegments, reqIndex, urlIndex, buffer) {
1787 if(urlIndex >= urlSegments.length)
1788  return buffer;
1789 if(reqIndex >= requestSegments.length)
1790  return buildPathRelativeUrl(requestSegments, urlSegments, reqIndex, urlIndex + 1, buffer + urlSegments[urlIndex]);
1791 if(requestSegments[reqIndex] === urlSegments[urlIndex] && urlIndex === reqIndex)
1792  return buildPathRelativeUrl(requestSegments, urlSegments, reqIndex + 1, urlIndex + 1, buffer);
1793 return buildPathRelativeUrl(requestSegments, urlSegments, reqIndex + 1, urlIndex, buffer + "../");
1794}
1795Url.isPathRelativeUrl = function(url) {
1796 return !!url && !Url.isAbsoluteUrl(url) && url.indexOf("/") != 0;  
1797}
1798Url.isRootRelativeUrl = function(url) {
1799 return !!url && !Url.isAbsoluteUrl(url) && url.indexOf("/") == 0 && url.indexOf("//") != 0;
1800}
1801function navigateTo(url, target) {
1802 var lowerCaseTarget = target.toLowerCase();
1803 if("_top" == lowerCaseTarget)
1804  top.location.href = url;
1805 else if("_self" == lowerCaseTarget)
1806  location.href = url;
1807 else if("_search" == lowerCaseTarget)
1808  openInNewWindow(url)
1809 else if("_media" == lowerCaseTarget)
1810  openInNewWindow(url)
1811 else if("_parent" == lowerCaseTarget)
1812  window.parent.location.href = url;
1813 else if("_blank" == lowerCaseTarget)
1814  openInNewWindow(url)
1815 else {
1816  var frame = getFrame(top.frames, target);
1817  if(frame != null)
1818   frame.location.href = url;
1819  else
1820   openInNewWindow(url)
1821 }
1822}
1823function openInNewWindow(url) {
1824 if(ASPx.Browser.Safari)
1825  openInNewWindowViaIframe(url);
1826 else {
1827  var newWindow = window.open();
1828  newWindow.opener = null;
1829  newWindow.location = url;
1830 }
1831}
1832function openInNewWindowViaIframe(url) {
1833 var iframe = document.createElement('iframe');
1834 iframe.style.display = 'none';
1835 document.body.appendChild(iframe);
1836 var iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
1837 var openArgs = '"' + url + '"';
1838 var script = iframeDoc.createElement('script');
1839 script.type = 'text/javascript';
1840 script.text = 'window.parent = null; ' +
1841  'window.top = null;' +
1842  'window.frameElement = null;' +
1843  'var child = window.open(' + openArgs + ');' +
1844  'child.opener = null';
1845 iframeDoc.body.appendChild(script);
1846 document.body.removeChild(iframe);
1847}
1848ASPx.Url = Url;
1849var Office = {}
1850Office.getHandlerResourceUrl = function(pageUrl) {
1851 var url = pageUrl ? pageUrl : document.URL;
1852 if(url.indexOf("?") != -1)
1853  url = url.substring(0, url.indexOf("?"));
1854 if(url.indexOf("#") != -1) 
1855  url = url.substring(0, url.indexOf("#"));
1856 if(/.*\.aspx$/.test(url))
1857  url = url.substring(0, url.lastIndexOf("/") + 1);
1858 else if(url.lastIndexOf("/") != url.length - 1)
1859  url += "/";
1860 return url;
1861}
1862ASPx.Office = Office;
1863var Json = { };
1864function isValid(JsonString) {
1865 return !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(JsonString.replace(/"(\\.|[^"\\])*"/g, '')))
1866}
1867Json.Eval = function(jsonString, controlName) {
1868 if(isValid(jsonString))
1869  return eval("(" + jsonString + ")");
1870 else
1871  throw new Error(controlName + " received incorrect JSON-data: " + jsonString);
1872}
1873Json.ToJson = function(param){
1874 var paramType = typeof(param);
1875 if((paramType == "undefined") || (param == null))
1876  return null;
1877 if((paramType == "object") && (typeof(param.__toJson) == "function"))
1878  return param.__toJson();
1879 if((paramType == "number") || (paramType == "boolean"))
1880  return param;
1881 if(param.constructor == Date)
1882  return dateToJson(param);
1883 if(paramType == "string") {
1884  var result = param.replace(/\\/g, "\\\\");
1885  result = result.replace(/"/g, "\\\"");
1886  result = result.replace(/\n/g, "\\n");
1887  result = result.replace(/\r/g, "\\r");
1888  result = result.replace(/</g, "\\u003c");
1889  result = result.replace(/>/g, "\\u003e");
1890  return "\"" + result + "\"";
1891 }
1892 if(param.constructor == Array){
1893  var values = [];
1894  for(var i = 0; i < param.length; i++) {
1895   var jsonValue = Json.ToJson(param[i]);
1896   if(jsonValue === null)
1897    jsonValue = "null";
1898   values.push(jsonValue);
1899  }
1900  return "[" + values.join(",") + "]";
1901 }
1902 var exceptKeys = {};
1903 if(ASPx.Ident.IsArray(param.__toJsonExceptKeys))
1904  exceptKeys = Data.CreateHashTableFromArray(param.__toJsonExceptKeys);
1905 exceptKeys["__toJsonExceptKeys"] = 1;
1906 var values = [];
1907 for(var key in param){
1908  if(ASPx.IsFunction(param[key]))
1909   continue;
1910  if(exceptKeys[key] == 1)
1911   continue;
1912  values.push(Json.ToJson(key) + ":" + Json.ToJson(param[key]));
1913 }
1914 return "{" + values.join(",") + "}";
1915}
1916function dateToJson(date) {
1917 var result = [ 
1918  date.getFullYear(),
1919  date.getMonth(),
1920  date.getDate()
1921 ];
1922 var time = {
1923  h: date.getHours(),
1924  m: date.getMinutes(),
1925  s: date.getSeconds(),
1926  ms: date.getMilliseconds()
1927 };
1928 if(time.h || time.m || time.s || time.ms)
1929  result.push(time.h);
1930 if(time.m || time.s || time.ms)
1931  result.push(time.m);
1932 if(time.s || time.ms)
1933  result.push(time.s);
1934 if(time.ms)
1935  result.push(time.ms);
1936 return "new Date(" + result.join() + ")";
1937}
1938ASPx.Json = Json;
1939ASPx.CreateClass = function(parentClass, properties) {
1940 var ret = function() {
1941  if(ret.preparing) 
1942   return delete(ret.preparing);
1943  if(ret.constr) {
1944   this.constructor = ret;
1945   ret.constr.apply(this, arguments);
1946  }
1947 }
1948 ret.prototype = {};
1949 if(parentClass) {
1950  parentClass.preparing = true;
1951  for(var name in parentClass) {
1952   if(parentClass.hasOwnProperty(name) && name != 'constr' && ASPx.IsFunction(parentClass[name]) && !ret[name])
1953    ret[name] = parentClass[name].aspxBind(parentClass);
1954  }
1955  ret.prototype = new parentClass;
1956  ret.prototype.constructor = parentClass;
1957  ret.constr = parentClass;
1958 }
1959 if(properties) {
1960  var constructorName = "constructor";
1961  for(var name in properties){
1962   if(name != constructorName) 
1963    ret.prototype[name] = properties[name];
1964  }
1965  if(properties[constructorName] && properties[constructorName] != Object)
1966   ret.constr = properties[constructorName];
1967 }
1968 return ret;
1969}
1970ASPx.FormatCallbackArg = function(prefix, arg) {
1971 if(prefix == null && arg == null)
1972  return ""; 
1973 if(prefix == null) prefix = "";
1974 if(arg == null) arg = "";
1975 if(arg != null && !ASPx.IsExists(arg.length) && ASPx.IsExists(arg.value))
1976  arg = arg.value;
1977 arg = arg.toString();
1978 return [prefix, '|', arg.length, '|' , arg].join('');
1979}
1980ASPx.FormatCallbackArgs = function(callbackData) {
1981 var sb = [ ];
1982 for(var i = 0; i < callbackData.length; i++)
1983  sb.push(ASPx.FormatCallbackArg(callbackData[i][0], callbackData[i][1]));
1984 return sb.join("");
1985}
1986ASPx.ParseShortcutString = function(shortcutString) {
1987 if(!shortcutString)
1988  return 0;
1989 var isCtrlKey = false;
1990 var isShiftKey = false;
1991 var isAltKey = false;
1992 var isMetaKey = false;
1993 var keyCode = null;
1994 var shcKeys = shortcutString.toString().split("+");
1995 if(shcKeys.length > 0) {
1996  for(var i = 0; i < shcKeys.length; i++) {
1997   var key = Str.Trim(shcKeys[i].toUpperCase());
1998   switch (key) {
1999    case "CTRL":
2000     isCtrlKey = true;
2001     break;
2002    case "SHIFT":
2003     isShiftKey = true;
2004     break;
2005    case "ALT":
2006     isAltKey = true;
2007     break;
2008    case "CMD":
2009     isMetaKey = true;
2010     break;
2011    case "F1": keyCode = ASPx.Key.F1; break;
2012    case "F2": keyCode = ASPx.Key.F2; break;
2013    case "F3": keyCode = ASPx.Key.F3; break;
2014    case "F4": keyCode = ASPx.Key.F4; break;
2015    case "F5": keyCode = ASPx.Key.F5; break;
2016    case "F6": keyCode = ASPx.Key.F6; break;
2017    case "F7": keyCode = ASPx.Key.F7; break;
2018    case "F8": keyCode = ASPx.Key.F8; break;
2019    case "F9": keyCode = ASPx.Key.F9; break;
2020    case "F10":   keyCode = ASPx.Key.F10; break;
2021    case "F11":   keyCode = ASPx.Key.F11; break;
2022    case "F12":   keyCode = ASPx.Key.F12; break;
2023    case "ENTER": keyCode = ASPx.Key.Enter; break;
2024    case "HOME":  keyCode = ASPx.Key.Home; break;
2025    case "END":   keyCode = ASPx.Key.End; break;
2026    case "LEFT":  keyCode = ASPx.Key.Left; break;
2027    case "RIGHT": keyCode = ASPx.Key.Right; break;
2028    case "UP": keyCode = ASPx.Key.Up; break;
2029    case "DOWN":  keyCode = ASPx.Key.Down; break;
2030    case "PAGEUP": keyCode = ASPx.Key.PageUp; break;
2031    case "PAGEDOWN": keyCode = ASPx.Key.PageDown; break;
2032    case "SPACE": keyCode = ASPx.Key.Space; break;
2033    case "TAB":   keyCode = ASPx.Key.Tab; break;
2034    case "BACK":  keyCode = ASPx.Key.Backspace; break;
2035    case "CONTEXT": keyCode = ASPx.Key.ContextMenu; break;
2036    case "ESCAPE":
2037    case "ESC":
2038     keyCode = ASPx.Key.Esc;
2039     break;
2040    case "DELETE":
2041    case "DEL":
2042     keyCode = ASPx.Key.Delete;
2043     break;
2044    case "INSERT":
2045    case "INS":
2046     keyCode = ASPx.Key.Insert;
2047     break;
2048    case "PLUS":
2049     keyCode = "+".charCodeAt(0);
2050     break;
2051    default:
2052     keyCode = key.charCodeAt(0);
2053     break;
2054   }
2055  }
2056 } else
2057  ASPx.ShowErrorAlert("Invalid shortcut");
2058 return ASPx.GetShortcutCode(keyCode, isCtrlKey, isShiftKey, isAltKey, isMetaKey);
2059}
2060ASPx.GetShortcutCode = function(keyCode, isCtrlKey, isShiftKey, isAltKey, isMetaKey) {
2061 var value = keyCode & 0xFFFF;
2062 var flags = 0;
2063 flags |= isCtrlKey ? 1 << 0 : 0;
2064 flags |= isShiftKey ? 1 << 2 : 0;
2065 flags |= isAltKey ? 1 << 4 : 0;
2066 flags |= isMetaKey ? 1 << 8 : 0;
2067 value |= flags << 16;
2068 return value;
2069}
2070ASPx.GetShortcutCodeByEvent = function(evt) {
2071 return ASPx.GetShortcutCode(Evt.GetKeyCode(evt), evt.ctrlKey, evt.shiftKey, evt.altKey, ASPx.Browser.MacOSPlatform ? evt.metaKey : false);
2072}
2073ASPx.IsPasteShortcut = function(evt) {
2074 if(evt.type === "paste")
2075  return true;
2076 var keyCode = Evt.GetKeyCode(evt);
2077 if(Browser.NetscapeFamily && evt.which == 0)  
2078  keyCode = evt.keyCode;
2079 return (evt.ctrlKey && (keyCode == 118  || (keyCode == 86))) ||
2080     (evt.shiftKey && !evt.ctrlKey && !evt.altKey &&
2081     (keyCode == ASPx.Key.Insert)) ;
2082}
2083ASPx.SetFocus = function(element, selectAction) {
2084 function focusCore(element, selectAction){
2085  try {
2086    element.focus();
2087    if(Browser.IE && document.activeElement != element)
2088     element.focus();
2089    if(selectAction) {
2090     var currentSelection = Selection.GetInfo(element);
2091     if(currentSelection.startPos == currentSelection.endPos) {
2092      switch(selectAction) {
2093       case "start":
2094        Selection.SetCaretPosition(element, 0);
2095        break;
2096       case "all":
2097        Selection.Set(element);
2098        break;
2099      }
2100     }
2101    }
2102   } catch (e) {
2103  }
2104 }
2105 if(ASPxClientUtils.iOSPlatform) 
2106  focusCore(element, selectAction);
2107 else {
2108  window.setTimeout(function() { 
2109   focusCore(element, selectAction);
2110  }, 100);
2111 }
2112}
2113ASPx.IsFocusableCore = function(element, skipContainerVisibilityCheck) {
2114 var current = element;
2115 while(current && current.nodeType == 1) {
2116  if(current == element || !skipContainerVisibilityCheck(current)) {
2117   if(current.tagName == "BODY")
2118    return true;
2119   if(current.disabled || !ASPx.GetElementDisplay(current) || !ASPx.GetElementVisibility(current))
2120    return false;
2121  }
2122  current = current.parentNode;
2123 }
2124 return true;
2125}
2126ASPx.IsFocusable = function(element) {
2127 return ASPx.IsFocusableCore(element, ASPx.FalseFunction);
2128}
2129ASPx.IsActionElement = function(element) {
2130 var tabIndex = parseInt(ASPx.Attr.GetAttribute(element, ASPx.Attr.GetTabIndexAttributeName()));
2131 var hasTabIndex = !isNaN(tabIndex);
2132 var hasNonNegativeTabIndex = hasTabIndex && tabIndex > -1;
2133 var hasNegativeTabIndex = hasTabIndex && tabIndex < 0;
2134 var tagName = element.tagName;
2135 var focusableElementTags = ["BUTTON", "SELECT", "TEXTAREA", "OPTION", "IFRAME"];
2136 var isFocusableCore = ASPx.IsFocusable(element);
2137 var isFocusableTag = focusableElementTags.indexOf(tagName) !== -1;
2138 var isFocusableLink = tagName === "A" && (element.href || hasNonNegativeTabIndex);
2139 var isFocusableInput = tagName === "INPUT" && element.type.toLowerCase() !== "hidden";
2140 var isFocusableByTabIndex = tagName !== "INPUT" && hasNonNegativeTabIndex;
2141 return isFocusableCore && !hasNegativeTabIndex && (isFocusableTag || isFocusableLink || isFocusableInput || isFocusableByTabIndex);
2142};
2143ASPx.GetCanBeActiveElementsInContainer = function(container) {
2144 var canBeActiveTags = ["INPUT", "A", "UL", "BUTTON", "TEXTAREA", "SELECT", "IFRAME"],
2145  canBeActiveElements = [];
2146 Data.ForEach(canBeActiveTags, function(tag) {
2147  var elements = container.getElementsByTagName(tag);
2148  canBeActiveElements = canBeActiveElements.concat([].slice.call(elements));
2149 });
2150 return canBeActiveElements;
2151};
2152ASPx.FindChildActionElements = function(container, predicate) {
2153 return ASPx.GetNodes(container, function(el) {
2154  var allowedByPredicate = !predicate || predicate(el);
2155  return allowedByPredicate && ASPx.IsActionElement(el);
2156 });
2157}
2158ASPx.FindChildActionElement = function(container, predicate) {
2159 var result = null;
2160 if(!container) return result;
2161 var actionElements = ASPx.FindChildActionElements(container, predicate);
2162 if(actionElements.length > 0) {
2163  var tabIndexElements = actionElements.filter(function(x) { return parseInt(ASPx.Attr.GetAttribute(x, "tabindex")) > 0; });
2164  tabIndexElements.sort(function(x, y) {
2165   xTabIndex = parseInt(ASPx.Attr.GetAttribute(x, "tabindex"));
2166   yTabIndex = parseInt(ASPx.Attr.GetAttribute(y, "tabindex"));
2167   return xTabIndex - yTabIndex;
2168  });
2169  result = tabIndexElements[0] || actionElements[0];
2170 }
2171 return result;
2172}
2173ASPx.GetParentClientControls = function(name) {
2174 var nameParts = name.split("_");
2175 var result = [ ];
2176 var controlCollection = ASPx.GetControlCollection();
2177 for(var i = 1; i <= nameParts.length; i++) {
2178  var controlName = nameParts.slice(0, i).join("_");
2179  var control = controlCollection.Get(controlName);
2180  if(control)
2181   result.push(control);
2182 }
2183 return result;
2184}
2185ASPx.GetRootControl = function(childControlName) {
2186 var childControlNameParts = childControlName.split("_");
2187 var controlCollection = ASPx.GetControlCollection();
2188 for(var i = 1; i <= childControlNameParts.length; i++) {
2189  var controlName = childControlNameParts.slice(0, i).join("_");
2190  var control = controlCollection.GetByName(controlName);
2191  if(control)
2192   return control;
2193 }
2194}
2195ASPx.IsExists = function(obj){
2196 return (typeof(obj) != "undefined") && (obj != null);
2197}
2198ASPx.IsFunction = function(obj){
2199 return typeof(obj) == "function";
2200}
2201ASPx.IsNumber = function(str) {
2202 return !isNaN(parseFloat(str)) && isFinite(str);
2203}
2204ASPx.GetDefinedValue = function(value, defaultValue){
2205 return (typeof(value) != "undefined") ? value : defaultValue;
2206}
2207ASPx.CorrectJSFloatNumber = function(number) {
2208 var ret = 21; 
2209 var numString = number.toPrecision(21);
2210 numString = numString.replace("-", ""); 
2211 var integerDigitsCount = numString.indexOf(ASPx.PossibleNumberDecimalSeparators[0]);
2212 if(integerDigitsCount < 0)
2213  integerDigitsCount = numString.indexOf(ASPx.PossibleNumberDecimalSeparators[1]);
2214 var floatDigitsCount = numString.length - integerDigitsCount - 1;
2215 if(floatDigitsCount < 10)
2216  return number;
2217 if(integerDigitsCount > 0) {
2218  ret = integerDigitsCount + 12;
2219 }
2220 var toPrecisionNumber = Math.min(ret, 21);
2221 var newValueString = number.toPrecision(toPrecisionNumber);
2222 return parseFloat(newValueString, 10);
2223}
2224ASPx.CorrectRounding = function(number, step) { 
2225 var regex = /[,|.](.*)/,
2226  isFloatValue = regex.test(number),
2227  isFloatStep = regex.test(step);
2228 if(isFloatValue || isFloatStep) {
2229  var valueAccuracy = (isFloatValue) ? regex.exec(number)[0].length - 1 : 0,
2230   stepAccuracy = (isFloatStep) ? regex.exec(step)[0].length - 1 : 0,
2231   accuracy = Math.max(valueAccuracy, stepAccuracy);
2232  var multiplier = Math.pow(10, accuracy);
2233  number = Math.round((number + step) * multiplier) / multiplier;
2234  return number;
2235 }
2236 return number + step;
2237}
2238ASPx.GetActiveElement = function() {
2239 try{ return document.activeElement; } catch(e) { return null; }
2240}
2241var verticalScrollBarWidth;
2242ASPx.GetVerticalScrollBarWidth = function() {
2243 if(typeof(verticalScrollBarWidth) == "undefined") {
2244  var container = document.createElement("DIV");
2245  container.style.cssText = "position: absolute; top: 0px; left: 0px; visibility: hidden; width: 200px; height: 150px; overflow: hidden; box-sizing: content-box";
2246  document.body.appendChild(container);
2247  var child = document.createElement("P");
2248  container.appendChild(child);
2249  child.style.cssText = "width: 100%; height: 200px;";
2250  var widthWithoutScrollBar = child.offsetWidth;
2251  container.style.overflow = "scroll";
2252  var widthWithScrollBar = child.offsetWidth;
2253  if(widthWithoutScrollBar == widthWithScrollBar)
2254   widthWithScrollBar = container.clientWidth;
2255  verticalScrollBarWidth = widthWithoutScrollBar - widthWithScrollBar;
2256  document.body.removeChild(container);
2257 }
2258 return verticalScrollBarWidth;
2259}
2260function hideScrollBarCore(element, scrollName) {
2261 if(element.tagName == "IFRAME") {
2262  if((element.scrolling == "yes") || (element.scrolling == "auto")) {
2263   Attr.ChangeAttribute(element, "scrolling", "no");
2264   return true;
2265  }
2266 }
2267 else if(element.tagName == "DIV") {
2268  if((element.style[scrollName] == "scroll") || (element.style[scrollName] == "auto")) {
2269   Attr.ChangeStyleAttribute(element, scrollName, "hidden");
2270   return true;
2271  }
2272 }
2273 return false;
2274}
2275function restoreScrollBarCore(element, scrollName) {
2276 if(element.tagName == "IFRAME")
2277  return Attr.RestoreAttribute(element, "scrolling");
2278 else if(element.tagName == "DIV")
2279  return Attr.RestoreStyleAttribute(element, scrollName);
2280 return false;
2281}
2282ASPx.SetScrollBarVisibilityCore = function(element, scrollName, isVisible) {
2283 return isVisible ? restoreScrollBarCore(element, scrollName) : hideScrollBarCore(element, scrollName);
2284}
2285ASPx.SetScrollBarVisibility = function(element, isVisible) {
2286 if(ASPx.SetScrollBarVisibilityCore(element, "overflow", isVisible)) 
2287  return true;
2288 var result = ASPx.SetScrollBarVisibilityCore(element, "overflowX", isVisible)
2289  || ASPx.SetScrollBarVisibilityCore(element, "overflowY", isVisible);
2290 return result;
2291}
2292ASPx.SetInnerHtml = function(element, html) {
2293 if(Browser.IE) {
2294  element.innerHTML = "<em>&nbsp;</em>" + html;
2295  element.removeChild(element.firstChild);
2296 } else
2297  element.innerHTML = html;
2298}
2299ASPx.GetInnerText = function(container) {
2300 if(Browser.Safari && Browser.MajorVersion <= 5) {
2301  var filter = getHtml2PlainTextFilter();
2302  filter.innerHTML = container.innerHTML;
2303  ASPx.SetElementDisplay(filter, true);
2304  var innerText = filter.innerText;
2305  ASPx.SetElementDisplay(filter, false);
2306  return innerText;
2307 } else if(Browser.NetscapeFamily || Browser.WebKitFamily || (Browser.IE && Browser.Version >= 9) || Browser.Edge) {
2308  return container.textContent;
2309 } else
2310  return container.innerText;
2311}
2312var html2PlainTextFilter = null;
2313function getHtml2PlainTextFilter() {
2314 if(html2PlainTextFilter == null) {
2315  html2PlainTextFilter = document.createElement("DIV");
2316  html2PlainTextFilter.style.width = "0";
2317  html2PlainTextFilter.style.height = "0";
2318  html2PlainTextFilter.style.overflow = "visible";
2319  ASPx.SetElementDisplay(html2PlainTextFilter, false);
2320  document.body.appendChild(html2PlainTextFilter);
2321 }
2322 return html2PlainTextFilter;
2323}
2324ASPx.CreateHiddenField = function(name, id) {
2325 var input = document.createElement("INPUT");
2326 input.setAttribute("type", "hidden");
2327 if(name)
2328  input.setAttribute("name", name);
2329 if(id)
2330  input.setAttribute("id", id);
2331 return input;
2332}
2333ASPx.CloneObject = function(srcObject) {
2334  if(typeof(srcObject) != 'object' || srcObject == null)
2335 return srcObject;
2336  var newObject = { };
2337  for(var i in srcObject) 
2338 newObject[i] = srcObject[i];
2339  return newObject;
2340}
2341ASPx.IsPercentageSize = function(size) {
2342 return size && size.indexOf('%') != -1;
2343}
2344ASPx.GetElementById = function(id) {
2345 if(document.getElementById)
2346  return document.getElementById(id);
2347 else
2348  return document.all[id];
2349}
2350ASPx.GetInputElementById = function(id) {
2351 var elem = ASPx.GetElementById(id);
2352 if(!Browser.IE)
2353  return elem;
2354 if(elem) {
2355  if(elem.id == id)
2356   return elem;
2357  else {
2358   for(var i = 1; i < document.all[id].length; i++) {
2359    if(document.all[id][i].id == id)
2360     return document.all[id][i];
2361   }
2362  }
2363 }
2364 return null;
2365}
2366ASPx.GetElementByIdInDocument = function(documentObj, id) {
2367 if(documentObj.getElementById)
2368  return documentObj.getElementById(id);
2369 else
2370  return documentObj.all[id];
2371}
2372ASPx.GetIsParent = function(parentElement, element) {
2373 if(!parentElement || !element)
2374  return false;
2375 while(element){
2376  if(element === parentElement)
2377   return true;
2378  if(element.tagName === "BODY")
2379   return false;
2380  element = element.parentNode;
2381 }
2382 return false;
2383}
2384ASPx.GetParentById = function(element, id) {
2385 element = element.parentNode;
2386 while(element){
2387  if(element.id === id)
2388   return element;
2389  element = element.parentNode;
2390 }
2391 return null;
2392}
2393ASPx.GetParentByPartialId = function(element, idPart){
2394 while(element && element.tagName != "BODY") {
2395  if(element.id && element.id.match(idPart)) 
2396   return element;
2397  element = element.parentNode;
2398 }
2399 return null;
2400}
2401ASPx.GetParentByTagName = function(element, tagName) {
2402 tagName = tagName.toUpperCase();
2403 while(element) {
2404  if(element.tagName === "BODY")
2405   return null;
2406  if(element.tagName === tagName)
2407   return element;
2408  element = element.parentNode;
2409 }
2410 return null;
2411}
2412function getParentByClassNameInternal(element, className, selector) {
2413 while(element != null) {
2414  if(element.tagName == "BODY" || element.nodeName == "#document")
2415   return null;
2416  if(selector(element, className))
2417   return element;
2418  element = element.parentNode;
2419 }
2420 return null;
2421}
2422ASPx.GetParentByPartialClassName = function(element, className) {
2423 return getParentByClassNameInternal(element, className, ASPx.ElementContainsCssClass);
2424}
2425ASPx.GetParentByClassName = function(element, className) {
2426 return getParentByClassNameInternal(element, className, ASPx.ElementHasCssClass);
2427}
2428ASPx.GetParentByTagNameAndAttributeValue = function(element, tagName, attrName, attrValue) {
2429 tagName = tagName.toUpperCase();
2430 while(element != null) {
2431  if(element.tagName == "BODY")
2432   return null;
2433  if(element.tagName == tagName && element[attrName] == attrValue)
2434   return element;
2435  element = element.parentNode;
2436 }
2437 return null;
2438}
2439ASPx.GetParent = function(element, testFunc){
2440 if (!ASPx.IsExists(testFunc)) return null;
2441 while(element != null && element.tagName != "BODY"){
2442  if(testFunc(element))
2443   return element;
2444  element = element.parentNode;
2445 }
2446 return null;
2447}
2448ASPx.GetPreviousSibling = function(el) {
2449 if(el.previousElementSibling) {
2450  return el.previousElementSibling;
2451 } else {
2452  while(el = el.previousSibling) {
2453   if(el.nodeType === 1)
2454    return el;
2455  }
2456 }
2457}
2458ASPx.ElementHasCssClass = function(element, className) {
2459 try {
2460  var classList = element.classList;
2461  if(!classList) {
2462   if(!element.className)
2463    return false;
2464   var elementClasses = element.className.split(" ");
2465  }
2466  var classNames = className.split(" ");
2467  for(var i = classNames.length - 1; i >= 0; i--) {
2468   if(classList) {
2469    if(!classList.contains(classNames[i]))
2470     return false;
2471    continue;
2472   }
2473   if(Data.ArrayIndexOf(elementClasses, classNames[i]) < 0)
2474    return false;
2475  }
2476  return true;
2477 } catch(e) {
2478  return false;
2479 }
2480}
2481ASPx.ElementContainsCssClass = function(element, className) {
2482 try {
2483  if(!element.className)
2484   return false;
2485  return element.className.indexOf(className) != -1;
2486 } catch(e) {
2487  return false;
2488 }
2489}
2490ASPx.AddClassNameToElement = function (element, className) {
2491 if(!element) return;
2492 if (!ASPx.ElementHasCssClass(element, className))
2493  element.className = (element.className === "") ? className : element.className + " " + className;
2494}
2495ASPx.RemoveClassNameFromElement = function(element, className) {
2496 if(!element) return;
2497 var updClassName = " " + element.className + " ";
2498 var newClassName = updClassName.replace(" " + className + " ", " ");
2499 if(updClassName.length != newClassName.length)
2500  element.className = Str.Trim(newClassName);
2501}
2502ASPx.GetClassNameList = function(element) {
2503 if(element.classList)
2504  return [ ].slice.call(element.classList);
2505 return el.className.replace(/^\s+|\s+$/g, '').split(/\s+/);
2506}
2507function nodeListToArray(nodeList, filter) {
2508 var result = [];
2509 for(var i = 0, element; element = nodeList[i]; i++) {
2510  if(filter && !filter(element))
2511   continue;
2512  result.push(element);
2513 }
2514 return result;
2515}
2516function getItemByIndex(collection, index) {
2517 if(!index) index = 0;
2518 if(collection != null && collection.length > index)
2519  return collection[index];
2520 return null;
2521}
2522ASPx.GetChildNodesByClassName = function(parent, className) {
2523 if(parent.querySelectorAll) {
2524  var children = parent.querySelectorAll('.' + className);
2525  return nodeListToArray(children, function(element) { 
2526   return element.parentNode === parent;
2527  });
2528 }
2529 return ASPx.GetChildNodes(parent, function(elem) { return elem.className && ASPx.ElementHasCssClass(elem, className); });
2530}
2531ASPx.GetChildNodesByPartialClassName = function(element, className) {
2532 return ASPx.GetChildElementNodesByPredicate(element,
2533  function(child) {
2534   return ASPx.ElementContainsCssClass(child, className);
2535  });
2536}
2537ASPx.GetChildByPartialClassName = function(element, className, index) {
2538 if(element != null){    
2539  var collection = ASPx.GetChildNodesByPartialClassName(element, className);
2540  return getItemByIndex(collection, index);
2541 }
2542 return null;
2543}
2544ASPx.GetChildByClassName = function(element, className, index) {
2545 if(element != null){    
2546  var collection = ASPx.GetChildNodesByClassName(element, className);
2547  return getItemByIndex(collection, index);
2548 }
2549 return null;
2550}
2551ASPx.GetNodesByPartialClassName = function(element, className) {
2552 if(element.querySelectorAll) {
2553  var list = element.querySelectorAll('*[class*=' + className + ']');
2554  return nodeListToArray(list);
2555 }
2556 var collection = element.all || element.getElementsByTagName('*');
2557 var ret = [ ];
2558 if(collection != null) {
2559  for(var i = 0; i < collection.length; i ++) {
2560   if(ASPx.ElementContainsCssClass(collection[i], className))
2561    ret.push(collection[i]);
2562  }
2563 }
2564 return ret;
2565}
2566ASPx.GetNodesByClassName = function(parent, className) {
2567 if(parent.querySelectorAll) {
2568  var children = parent.querySelectorAll('.' + className);
2569  return nodeListToArray(children);
2570 }
2571 return ASPx.GetNodes(parent, function(elem) { return elem.className && ASPx.ElementHasCssClass(elem, className); });
2572}
2573ASPx.GetNodeByClassName = function(element, className, index) {
2574 if(element != null){    
2575  var collection = ASPx.GetNodesByClassName(element, className);
2576  return getItemByIndex(collection, index);
2577 }
2578 return null;
2579}
2580ASPx.GetChildById = function(element, id) {
2581 if(element.all) {
2582  var child = element.all[id];
2583  if(!child) {
2584   child = element.all(id); 
2585   if(!child)
2586    return Browser.IE ? document.getElementById(id) : null; 
2587  } 
2588  if(!ASPx.IsExists(child.length)) 
2589   return child;
2590  else
2591   return ASPx.GetElementById(id);
2592 }
2593 else
2594  return ASPx.GetElementById(id);
2595}
2596ASPx.GetNodesByPartialId = function(element, partialName, list) {
2597 if(element.id && element.id.indexOf(partialName) > -1) 
2598  list.push(element);
2599 if(element.childNodes) {
2600  for(var i = 0; i < element.childNodes.length; i ++) 
2601   ASPx.GetNodesByPartialId(element.childNodes[i], partialName, list);
2602 }
2603}
2604ASPx.GetNodesByTagName = function(element, tagName) {
2605 tagName = tagName.toUpperCase();
2606 if(element) {
2607  if(element.getElementsByTagName) 
2608   return element.getElementsByTagName(tagName);
2609  else if(element.all && element.all.tags !== undefined)
2610   return Browser.Netscape ? element.all.tags[tagName] : element.all.tags(tagName);
2611 }
2612 return null;
2613}
2614ASPx.GetNodeByTagName = function(element, tagName, index) {
2615 if(element != null){    
2616  var collection = ASPx.GetNodesByTagName(element, tagName);
2617  return getItemByIndex(collection, index);
2618 }
2619 return null;
2620}
2621ASPx.GetChildNodesByTagName = function(parent, tagName) {
2622 return ASPx.GetChildNodes(parent, function (child) { return child.tagName === tagName; });
2623}
2624ASPx.GetChildByTagName = function(element, tagName, index) {
2625 if(element != null){    
2626  var collection = ASPx.GetChildNodesByTagName(element, tagName);
2627  return getItemByIndex(collection, index);
2628 }
2629 return null;
2630}
2631ASPx.RetrieveByPredicate = function(scourceCollection, predicate) {
2632 var result = [];
2633 for(var i = 0; i < scourceCollection.length; i++) {
2634  var element = scourceCollection[i];
2635  if(!predicate || predicate(element)) 
2636   result.push(element);
2637 }
2638 return result;
2639}
2640ASPx.GetChildNodes = function(parent, predicate) {
2641 return ASPx.RetrieveByPredicate(parent.childNodes, predicate);
2642}
2643ASPx.GetNodes = function(parent, predicate) {
2644 var c = parent.all || parent.getElementsByTagName('*');
2645 return ASPx.RetrieveByPredicate(c, predicate);
2646}
2647ASPx.GetChildElementNodes = function(parent) {
2648 if(!parent) return null;
2649 return ASPx.GetChildNodes(parent, function(e) { return e.nodeType == 1 })
2650}
2651ASPx.GetChildElementNodesByPredicate = function(parent, predicate) {
2652 if(!parent) return null;
2653 if(!predicate) return ASPx.GetChildElementNodes(parent);
2654 return ASPx.GetChildNodes(parent, function(e) { return e.nodeType == 1 && predicate(e); })
2655}
2656ASPx.GetTextNode = function(element, index) {
2657 if(element != null){
2658  var collection = [ ];
2659  ASPx.GetTextNodes(element, collection);
2660  return getItemByIndex(collection, index);
2661 }
2662 return null;
2663}
2664ASPx.GetTextNodes = function(element, collection) {
2665 for(var i = 0; i < element.childNodes.length; i ++){
2666  var childNode = element.childNodes[i];
2667  if(ASPx.IsExists(childNode.nodeValue))
2668   collection.push(childNode);
2669  ASPx.GetTextNodes(childNode, collection);
2670 }
2671}
2672ASPx.GetNormalizedTextNode = function(element, index) {
2673 var textNode = ASPx.GetTextNode(element, index);
2674 if(textNode != null)
2675  ASPx.MergeAdjacentTextNodes(textNode);
2676 return textNode;
2677}
2678ASPx.MergeAdjacentTextNodes = function(firstTextNode) {
2679 if(!ASPx.IsExists(firstTextNode.nodeValue))
2680  return;
2681 var textNode = firstTextNode;
2682 while(textNode.nextSibling && ASPx.IsExists(textNode.nextSibling.nodeValue)) {
2683  textNode.nodeValue += textNode.nextSibling.nodeValue;
2684  textNode.parentNode.removeChild(textNode.nextSibling);
2685 }
2686}
2687ASPx.GetElementDocument = function(element) {
2688 return element.document || element.ownerDocument;
2689}
2690ASPx.RemoveElement = function(element) {
2691 if(element && element.parentNode)
2692  element.parentNode.removeChild(element);
2693}
2694ASPx.ReplaceTagName = function(element, newTagName, cloneChilds) {
2695 if(element.nodeType != 1)
2696  return null;
2697 if(element.nodeName == newTagName)
2698  return element;
2699 cloneChilds = cloneChilds !== undefined ? cloneChilds : true;
2700 var doc = element.ownerDocument;
2701 var newElem = doc.createElement(newTagName);
2702 Attr.CopyAllAttributes(element, newElem);
2703 if(cloneChilds) {
2704  for(var i = 0; i < element.childNodes.length; i++)
2705   newElem.appendChild(element.childNodes[i].cloneNode(true));
2706 }
2707 else {
2708  for(var child; child = element.firstChild; )
2709   newElem.appendChild(child);
2710 }
2711 element.parentNode.replaceChild(newElem, element);
2712 return newElem;
2713}
2714ASPx.RemoveOuterTags = function(element) {
2715 if(ASPx.Browser.IE) {
2716  element.insertAdjacentHTML( 'beforeBegin', element.innerHTML ) ;
2717  ASPx.RemoveElement(element);
2718 } else {
2719  var docFragment = element.ownerDocument.createDocumentFragment();
2720  for(var i = 0; i < element.childNodes.length; i++)
2721   docFragment.appendChild(element.childNodes[i].cloneNode(true));
2722  element.parentNode.replaceChild(docFragment, element);
2723 }
2724}
2725ASPx.WrapElementInNewElement = function(element, newElementTagName) { 
2726 var wrapElement = null;
2727 if(Browser.IE) {
2728  var wrapElement = element.ownerDocument.createElement(newElementTagName);
2729  wrapElement.appendChild(element.cloneNode(true));
2730  element.parentNode.insertBefore(wrapElement, element);
2731  element.parentNode.removeChild(element);
2732 } else {
2733  var docFragment = element.ownerDocument.createDocumentFragment();
2734  wrapElement = element.ownerDocument.createElement(newElementTagName);
2735  docFragment.appendChild(wrapElement);
2736  wrapElement.appendChild(element.cloneNode(true));
2737  element.parentNode.replaceChild(docFragment, element);
2738 }
2739 return wrapElement;
2740}
2741ASPx.InsertElementAfter = function(newElement, targetElement) {
2742 var parentElem = targetElement.parentNode;
2743 if(parentElem.childNodes[parentElem.childNodes.length - 1] == targetElement)
2744  parentElem.appendChild(newElement);
2745 else
2746  parentElem.insertBefore(newElement, targetElement.nextSibling);
2747}
2748ASPx.SetElementOpacity = function(element, value) {
2749  var useOpacityStyle = !Browser.IE || Browser.Version > 8;
2750  if(useOpacityStyle){
2751   element.style.opacity = value;
2752  } else {
2753   if(typeof(element.filters) === "object" && element.filters["DXImageTransform.Microsoft.Alpha"])
2754    element.filters.item("DXImageTransform.Microsoft.Alpha").Opacity = value*100;
2755   else
2756   element.style.filter = "alpha(opacity=" + (value * 100) + ")";
2757  }
2758}
2759ASPx.GetElementOpacity = function(element) {
2760 var useOpacityStyle = !Browser.IE || Browser.Version > 8;
2761 if(useOpacityStyle)
2762  return parseFloat(ASPx.GetCurrentStyle(element).opacity);
2763 else {
2764  if(typeof(element.filters) === "object" && element.filters["DXImageTransform.Microsoft.Alpha"]){
2765   return element.filters.item("DXImageTransform.Microsoft.Alpha").Opacity / 100;
2766  } else {
2767   var alphaValue = ASPx.GetCurrentStyle(element).filter;
2768   var value = alphaValue.replace("alpha(opacity=", "");
2769   value = value.replace(")", "");
2770   return parseInt(value) / 100;
2771  }
2772  return 100;
2773 }
2774}
2775ASPx.GetElementDisplay = function(element, isCurrentStyle) {
2776 if (isCurrentStyle)
2777  return ASPx.GetCurrentStyle(element).display != "none";
2778 return element.style.display != "none";
2779}
2780ASPx.SetElementDisplay = function(element, value) {
2781 if(!element) return;
2782 element.style.display = value ? "" : "none";
2783}
2784ASPx.GetElementVisibility = function(element, isCurrentStyle) {
2785 if(isCurrentStyle)
2786  return ASPx.GetCurrentStyle(element).visibility != "hidden";
2787 return element.style.visibility != "hidden";
2788}
2789ASPx.SetElementVisibility = function(element, value) {
2790 if(!element) return;
2791 element.style.visibility = value ? "visible" : "hidden";
2792}
2793ASPx.IsElementVisible = function(element, isCurrentStyle) {
2794 while(element && element.tagName != "BODY") {
2795  if(!ASPx.GetElementDisplay(element, isCurrentStyle) || (!ASPx.GetElementVisibility(element, isCurrentStyle) && !Attr.IsExistsAttribute(element, "errorFrame")))
2796     return false;
2797  element = element.parentNode;
2798 }
2799 return true;
2800}
2801ASPx.IsElementDisplayed = function(element) {
2802 while(element && element.tagName != "BODY") {
2803  if(!ASPx.GetElementDisplay(element))
2804     return false;
2805  element = element.parentNode;
2806 }
2807 return true;
2808}
2809ASPx.AddStyleSheetLinkToDocument = function(doc, linkUrl) {
2810 var newLink = createStyleLink(doc, linkUrl);
2811 var head = ASPx.GetHeadElementOrCreateIfNotExist(doc);
2812 head.appendChild(newLink);
2813}
2814ASPx.GetHeadElementOrCreateIfNotExist = function(doc) {
2815 var elements = ASPx.GetNodesByTagName(doc, "head");
2816 var head = null;
2817 if(elements.length == 0) {
2818  head = doc.createElement("head");
2819  head.visibility = "hidden";
2820  doc.insertBefore(head, doc.body);
2821 } else
2822  head = elements[0];
2823 return head;
2824}
2825function createStyleLink(doc, url) {
2826 var newLink = doc.createElement("link");
2827 Attr.SetAttribute(newLink, "href", url);
2828 Attr.SetAttribute(newLink, "type", "text/css");
2829 Attr.SetAttribute(newLink, "rel", "stylesheet");
2830 return newLink;
2831}
2832ASPx.GetCurrentStyle = function(element) {
2833 if(element.currentStyle)
2834  return element.currentStyle;
2835 else if(document.defaultView && document.defaultView.getComputedStyle) { 
2836  var result = document.defaultView.getComputedStyle(element, null);
2837  if(!result && Browser.Firefox && window.frameElement) {
2838   var changes = [];
2839   var curElement = window.frameElement;
2840   while(!(result = document.defaultView.getComputedStyle(element, null))) {
2841    changes.push([curElement, curElement.style.display]);
2842    ASPx.SetStylesCore(curElement, "display", "block", true);
2843    curElement = curElement.tagName == "BODY" ? curElement.ownerDocument.defaultView.frameElement : curElement.parentNode;
2844   }
2845   result = ASPx.CloneObject(result);
2846   for(var ch, i = 0; ch = changes[i]; i++)
2847    ASPx.SetStylesCore(ch[0], "display", ch[1]);
2848   var reflow = document.body.offsetWidth; 
2849  }
2850  return result;
2851 }
2852 return window.getComputedStyle(element, null);
2853}
2854ASPx.CreateStyleSheetInDocument = function(doc) {
2855 if(doc.createStyleSheet) {
2856  try {
2857   return doc.createStyleSheet();
2858  }
2859  catch(e) {
2860   var message = "The CSS link limit (31) has been exceeded. Please enable CSS merging or reduce the number of CSS files on the page. For details, see http://www.devexpress.com/Support/Center/p/K18487.aspx.";
2861   throw new Error(message);
2862  }
2863 }
2864 else {
2865  var styleSheet = doc.createElement("STYLE");
2866  ASPx.GetNodeByTagName(doc, "HEAD", 0).appendChild(styleSheet);
2867  return styleSheet.sheet;
2868 }
2869}
2870ASPx.currentStyleSheet = null;
2871ASPx.GetCurrentStyleSheet = function() {
2872 if(!ASPx.currentStyleSheet)
2873  ASPx.currentStyleSheet = ASPx.CreateStyleSheetInDocument(document);
2874 return ASPx.currentStyleSheet;
2875}
2876function getStyleSheetRules(styleSheet){
2877 try {
2878  return Browser.IE && Browser.Version == 8 ? styleSheet.rules : styleSheet.cssRules;
2879 }
2880 catch(e) {
2881  return null;
2882 }
2883}
2884ASPx.cachedCssRules = { };
2885ASPx.GetStyleSheetRules = function (className, stylesStorageDocument) {
2886 if(ASPx.cachedCssRules[className]) {
2887  if(ASPx.cachedCssRules[className] != ASPx.EmptyObject)
2888   return ASPx.cachedCssRules[className];
2889  return null;
2890 }
2891 var result = iterateStyleSheetRules(stylesStorageDocument, function(rule) {
2892  if(rule.selectorText == "." + className){
2893   ASPx.cachedCssRules[className] = rule;
2894   return rule;
2895  }
2896 });
2897 if(ASPx.IsExists(result))
2898  return result;
2899 ASPx.cachedCssRules[className] = ASPx.EmptyObject;
2900 return null;
2901}
2902function iterateStyleSheetRules(stylesStorageDocument, callback) {
2903 var doc = stylesStorageDocument || document;
2904 for(var i = 0; i < doc.styleSheets.length; i ++){
2905  var styleSheet = doc.styleSheets[i];
2906  var rules = getStyleSheetRules(styleSheet);
2907  if(rules != null){
2908   for(var j = 0; j < rules.length; j ++) {
2909    var result = callback(rules[j]);
2910    if(result !== undefined)
2911     return result;
2912   }
2913  }
2914 }
2915};
2916ASPx.ClearCachedCssRules = function(){
2917 ASPx.cachedCssRules = { };
2918}
2919var styleCount = 0;
2920var styleNameCache = { };
2921ASPx.CreateImportantStyleRule = function(styleSheet, cssText, postfix, prefix) {
2922 styleSheet = styleSheet || ASPx.GetCurrentStyleSheet();
2923 var cacheKey = (postfix ? postfix + "||" : "") + cssText + (prefix ? "||" + prefix : "");
2924 if(styleNameCache[cacheKey])
2925  return styleNameCache[cacheKey];
2926 prefix = prefix ? prefix + " " : "";
2927 var className = "dxh" + styleCount + (postfix ? postfix : "");
2928 ASPx.AddStyleSheetRule(styleSheet, prefix + "." + className, ASPx.CreateImportantCssText(cssText));
2929 styleCount++;
2930 styleNameCache[cacheKey] = className;
2931 return className; 
2932}
2933ASPx.CreateImportantCssText = function(cssText) {
2934 var newText = "";
2935 var attributes = cssText.split(";");
2936 for(var i = 0; i < attributes.length; i++){
2937  if(attributes[i] != "")
2938   newText += attributes[i] + " !important;";
2939 }
2940 return newText;
2941}
2942ASPx.AddStyleSheetRule = function(styleSheet, selector, cssText){
2943 if(!cssText) return;
2944 if(Browser.IE)
2945  styleSheet.addRule(selector, cssText);
2946 else
2947  styleSheet.insertRule(selector + " { " + cssText + " }", styleSheet.cssRules.length);
2948}
2949ASPx.GetPointerCursor = function() {
2950 return "pointer";
2951}
2952ASPx.SetPointerCursor = function(element) {
2953 if(element.style.cursor == "")
2954  element.style.cursor = ASPx.GetPointerCursor();
2955}
2956ASPx.SetElementFloat = function(element, value) {
2957 if(ASPx.IsExists(element.style.cssFloat))
2958  element.style.cssFloat = value;
2959 else if(ASPx.IsExists(element.style.styleFloat))
2960  element.style.styleFloat = value;
2961 else
2962  Attr.SetAttribute(element.style, "float", value);
2963}
2964ASPx.GetElementFloat = function(element) {
2965 var currentStyle = ASPx.GetCurrentStyle(element);
2966 if(ASPx.IsExists(currentStyle.cssFloat))
2967  return currentStyle.cssFloat;
2968 if(ASPx.IsExists(currentStyle.styleFloat))
2969  return currentStyle.styleFloat;
2970 return Attr.GetAttribute(currentStyle, "float");
2971}
2972function getElementDirection(element) {
2973 return ASPx.GetCurrentStyle(element).direction;
2974}
2975ASPx.IsElementRightToLeft = function(element) {
2976 return getElementDirection(element) == "rtl";
2977}
2978ASPx.AdjustVerticalMarginsInContainer = function(container) {
2979 var containerBorderAndPaddings = ASPx.GetTopBottomBordersAndPaddingsSummaryValue(container);
2980 var flowElements = [], floatElements = [], floatTextElements = [];
2981 var maxHeight = 0, maxFlowHeight = 0;
2982 for(var i = 0; i < container.childNodes.length; i++) {
2983  var element = container.childNodes[i];
2984  if(!element.offsetHeight) continue;
2985  ASPx.ClearVerticalMargins(element);
2986 }
2987 for(var i = 0; i < container.childNodes.length; i++) {
2988  var element = container.childNodes[i];
2989  if(!element.offsetHeight) continue;
2990  var float = ASPx.GetElementFloat(element);
2991  var isFloat = (float === "left" || float === "right");
2992  if(isFloat)
2993   floatElements.push(element)
2994  else {
2995   flowElements.push(element);
2996   if(element.tagName !== "IMG"){
2997    if(!ASPx.IsTextWrapped(element))
2998     element.style.verticalAlign = 'baseline'; 
2999    floatTextElements.push(element);
3000   }
3001   if(element.tagName === "DIV")
3002    Attr.ChangeStyleAttribute(element, "float", "left"); 
3003  }
3004  if(element.offsetHeight > maxHeight) 
3005   maxHeight = element.offsetHeight;
3006  if(!isFloat && element.offsetHeight > maxFlowHeight) 
3007   maxFlowHeight = element.offsetHeight;
3008 }
3009 for(var i = 0; i < flowElements.length; i++) 
3010  Attr.RestoreStyleAttribute(flowElements[i], "float");
3011 var containerBorderAndPaddings = ASPx.GetTopBottomBordersAndPaddingsSummaryValue(container);
3012 var containerHeight = container.offsetHeight - containerBorderAndPaddings;
3013 if(maxHeight == containerHeight) {
3014  var verticalAlign = ASPx.GetCurrentStyle(container).verticalAlign;
3015  for(var i = 0; i < floatTextElements.length; i++)
3016   floatTextElements[i].style.verticalAlign = '';
3017  containerHeight = container.offsetHeight - containerBorderAndPaddings;
3018  for(var i = 0; i < floatElements.length; i++)
3019   adjustVerticalMarginsCore(floatElements[i], containerHeight, verticalAlign, true);
3020  for(var i = 0; i < flowElements.length; i++) {
3021   if(maxFlowHeight != maxHeight)
3022    adjustVerticalMarginsCore(flowElements[i], containerHeight, verticalAlign);
3023  }
3024 }
3025}
3026ASPx.AdjustVerticalMargins = function(element) {
3027 ASPx.ClearVerticalMargins(element);
3028 var parentElement = element.parentNode;
3029 var parentHeight = parentElement.offsetHeight - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(parentElement);
3030 adjustVerticalMarginsCore(element, parentHeight, ASPx.GetCurrentStyle(parentElement).verticalAlign);
3031}
3032function adjustVerticalMarginsCore(element, parentHeight, verticalAlign, toBottom) {
3033 var marginTop;
3034 if(verticalAlign == "top")
3035  marginTop = 0;
3036 else if(verticalAlign == "bottom")
3037  marginTop = parentHeight - element.offsetHeight;
3038 else
3039  marginTop = (parentHeight - element.offsetHeight) / 2;
3040 if(marginTop !== 0){
3041  var marginAttr = (toBottom ? Math.ceil(marginTop) : Math.floor(marginTop)) + "px"
3042  element.style.marginTop = marginAttr;
3043 }
3044}
3045ASPx.ClearVerticalMargins = function(element) {
3046 element.style.marginTop = "";
3047 element.style.marginBottom = "";
3048}
3049ASPx.AdjustHeightInContainer = function(container) {
3050 var height = container.offsetHeight - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(container);
3051 for(var i = 0; i < container.childNodes.length; i++) {
3052  var element = container.childNodes[i];
3053  if(!element.offsetHeight) continue;
3054  ASPx.ClearHeight(element);
3055 }
3056 var elements = [];
3057 var childrenHeight = 0;
3058 for(var i = 0; i < container.childNodes.length; i++) {
3059  var element = container.childNodes[i];
3060  if(!element.offsetHeight) continue;
3061  childrenHeight += element.offsetHeight + ASPx.GetTopBottomMargins(element);
3062  elements.push(element);
3063 }
3064 if(elements.length > 0 && childrenHeight < height) {
3065  var correctedHeight = 0;
3066  for(var i = 0; i < elements.length; i++) {
3067   var elementHeight = 0;
3068   if(i < elements.length - 1){
3069    var elementHeight = Math.floor(height / elements.length);
3070    correctedHeight += elementHeight;
3071   }
3072   else{
3073    var elementHeight = height - correctedHeight;
3074    if(elementHeight < 0) elementHeight = 0;
3075   }
3076   adjustHeightCore(elements[i], elementHeight);
3077  }
3078 }
3079}
3080ASPx.AdjustHeight = function(element) {
3081 ASPx.ClearHeight(element);
3082 var parentElement = element.parentNode;
3083 var height = parentElement.offsetHeight - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(parentElement);
3084 adjustHeightCore(element, height);
3085}
3086function adjustHeightCore(element, height) {
3087 var height = height - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(element);
3088 if(height < 0) height = 0;
3089 element.style.height = height + "px";
3090}
3091ASPx.ClearHeight = function(element) {
3092 element.style.height = "";
3093}
3094ASPx.ShrinkWrappedTextInContainer = function(container) {
3095 if(!container) return;
3096 for(var i = 0; i < container.childNodes.length; i++){
3097  var child = container.childNodes[i];
3098  if(child.style && ASPx.IsTextWrapped(child)) {
3099   Attr.ChangeStyleAttribute(child, "width", "1px");
3100   child.shrinkedTextContainer = true;
3101  }
3102 }
3103}
3104ASPx.AdjustWrappedTextInContainer = function(container) {
3105 if(!container) return;
3106 var textContainer, leftWidth = 0, rightWidth = 0;
3107 for(var i = 0; i < container.childNodes.length; i++){
3108  var child = container.childNodes[i];
3109  if(child.tagName === "BR")
3110   return;
3111  if(!child.tagName)
3112   continue;
3113  if(child.tagName !== "IMG"){
3114   textContainer = child;
3115   if(ASPx.IsTextWrapped(textContainer)){
3116    if(!textContainer.shrinkedTextContainer)
3117     textContainer.style.width = "";
3118    textContainer.style.marginRight = "";
3119   }
3120  }
3121  else {
3122   if(child.offsetWidth === 0){
3123    Evt.AttachEventToElement(child, "load", function (evt) {
3124     ASPx.AdjustWrappedTextInContainer(container);
3125    });
3126    return;
3127   }
3128   var width = child.offsetWidth + ASPx.GetLeftRightMargins(child);
3129   if(textContainer)
3130    rightWidth += width;
3131   else
3132    leftWidth += width;
3133  }
3134 }
3135 if(textContainer && ASPx.IsTextWrapped(textContainer)) {
3136  var containerWidth = container.offsetWidth - ASPx.GetLeftRightBordersAndPaddingsSummaryValue(container);
3137  if(textContainer.shrinkedTextContainer) {
3138   Attr.RestoreStyleAttribute(textContainer, "width");
3139   Attr.ChangeStyleAttribute(container, "width", containerWidth + "px");
3140  }
3141  if(textContainer.offsetWidth + leftWidth + rightWidth >= containerWidth) {
3142    if(rightWidth > 0 && !textContainer.shrinkedTextContainer)
3143    textContainer.style.width = (containerWidth - rightWidth) + "px";
3144   else if(leftWidth > 0){
3145    if(ASPx.IsElementRightToLeft(container))
3146     textContainer.style.marginLeft = leftWidth + "px";
3147    else
3148     textContainer.style.marginRight = leftWidth + "px";
3149   }
3150  }
3151 }
3152}
3153ASPx.IsTextWrapped = function(element) {
3154 return element && ASPx.GetCurrentStyle(element).whiteSpace !== "nowrap";
3155}
3156ASPx.IsValidPosition = function(pos){
3157 return pos != ASPx.InvalidPosition && pos != -ASPx.InvalidPosition;
3158}
3159ASPx.getSpriteMainElement = function(element) {
3160 var cssClassMarker = "dx-acc";
3161 if(ASPx.ElementContainsCssClass(element, cssClassMarker))
3162  return element;
3163 if(element.parentNode && ASPx.ElementContainsCssClass(element.parentNode, cssClassMarker))
3164  return element.parentNode;
3165 return element;
3166}
3167ASPx.GetAbsoluteX = function(curEl){
3168 return ASPx.GetAbsolutePositionX(curEl);
3169}
3170ASPx.GetAbsoluteY = function(curEl){
3171 return ASPx.GetAbsolutePositionY(curEl);
3172}
3173ASPx.SetAbsoluteX = function(element, x){
3174 element.style.left = ASPx.PrepareClientPosForElement(x, element, true) + "px";
3175}
3176ASPx.SetAbsoluteY = function(element, y){
3177 element.style.top = ASPx.PrepareClientPosForElement(y, element, false) + "px";
3178}
3179ASPx.GetAbsolutePositionX = function(element){
3180 if(Browser.IE)
3181  return getAbsolutePositionX_IE(element);
3182 else if(Browser.Firefox && Browser.Version >= 3)
3183  return getAbsolutePositionX_FF3(element);
3184 else if(Browser.Opera)
3185  return getAbsolutePositionX_Opera(element);
3186 else if(Browser.NetscapeFamily && (!Browser.Firefox || Browser.Version < 3))
3187  return getAbsolutePositionX_NS(element);
3188 else if(Browser.WebKitFamily || Browser.Edge)
3189  return getAbsolutePositionX_FF3(element);
3190 else
3191  return getAbsolutePositionX_Other(element);
3192}
3193function getAbsolutePositionX_Opera(curEl){
3194 var isFirstCycle = true;
3195 var pos = getAbsoluteScrollOffset_OperaFF(curEl, true);
3196 while(curEl != null) {
3197  pos += curEl.offsetLeft;
3198  if(!isFirstCycle)
3199   pos -= curEl.scrollLeft;
3200  curEl = curEl.offsetParent;
3201  isFirstCycle = false;
3202 }
3203 pos += document.body.scrollLeft;
3204 return pos;
3205}
3206function getAbsolutePositionX_IE(element){
3207 if(element == null || Browser.IE && element.parentNode == null) return 0; 
3208 return element.getBoundingClientRect().left + ASPx.GetDocumentScrollLeft();
3209}
3210function getAbsolutePositionX_FF3(element){
3211 if(element == null) return 0;
3212 var x = element.getBoundingClientRect().left + ASPx.GetDocumentScrollLeft();
3213 return Math.round(x);
3214}
3215function getAbsolutePositionX_NS(curEl){
3216 var pos = getAbsoluteScrollOffset_OperaFF(curEl, true);
3217 var isFirstCycle = true;
3218 while(curEl != null) {
3219  pos += curEl.offsetLeft;
3220  if(!isFirstCycle && curEl.offsetParent != null)
3221   pos -= curEl.scrollLeft;
3222  if(!isFirstCycle && Browser.Firefox){
3223   var style = ASPx.GetCurrentStyle(curEl);
3224   if(curEl.tagName == "DIV" && style.overflow != "visible")
3225    pos += ASPx.PxToInt(style.borderLeftWidth);
3226  }
3227  isFirstCycle = false;
3228  curEl = curEl.offsetParent;
3229 }
3230 return pos;
3231}
3232function getAbsolutePositionX_Safari(curEl){
3233 var pos = getAbsoluteScrollOffset_WebKit(curEl, true);
3234 var isSafariVerNonLessThan3OrChrome = Browser.Safari && Browser.Version >= 3 || Browser.Chrome;
3235 if(curEl != null){
3236  var isFirstCycle = true;
3237  if(isSafariVerNonLessThan3OrChrome && curEl.tagName == "TD") {
3238   pos += curEl.offsetLeft;
3239   curEl = curEl.offsetParent;
3240   isFirstCycle = false;
3241  }
3242  var hasNonStaticElement = false;
3243  while (curEl != null) {
3244   pos += curEl.offsetLeft;
3245   var style = ASPx.GetCurrentStyle(curEl);
3246   var isNonStatic = style.position !== "" && style.position !== "static";
3247   if(isNonStatic)
3248    hasNonStaticElement = true;
3249   var safariDisplayTable = Browser.Safari && Browser.Version >= 8 && style.display === "table";
3250   var posDiv = curEl.tagName == "DIV" && isNonStatic && !safariDisplayTable;
3251   if(!isFirstCycle && (curEl.tagName == "TD" || curEl.tagName == "TABLE" || posDiv))
3252    pos += curEl.clientLeft;
3253   isFirstCycle = false;
3254   curEl = curEl.offsetParent;
3255  }
3256  if(!hasNonStaticElement && (document.documentElement.style.position === "" || document.documentElement.style.position === "static"))
3257   pos += document.documentElement.offsetLeft;
3258 }
3259 return pos;
3260}
3261function getAbsolutePositionX_Other(curEl){
3262 var pos = 0;
3263 var isFirstCycle = true;
3264 while(curEl != null) {
3265  pos += curEl.offsetLeft;
3266  if(!isFirstCycle && curEl.offsetParent != null)
3267   pos -= curEl.scrollLeft;
3268  isFirstCycle = false;
3269  curEl = curEl.offsetParent;
3270 }
3271 return pos;
3272}
3273ASPx.GetAbsolutePositionY = function(element){
3274 if(Browser.IE)
3275  return getAbsolutePositionY_IE(element);
3276 else if(Browser.Firefox && Browser.Version >= 3)
3277  return getAbsolutePositionY_FF3(element);
3278 else if(Browser.Opera)
3279  return getAbsolutePositionY_Opera(element);
3280 else if(Browser.NetscapeFamily && (!Browser.Firefox || Browser.Version < 3))
3281  return getAbsolutePositionY_NS(element);
3282 else if(Browser.WebKitFamily || Browser.Edge)
3283  return getAbsolutePositionY_FF3(element);
3284 else
3285  return getAbsolutePositionY_Other(element);
3286}
3287function getAbsolutePositionY_Opera(curEl){
3288 var isFirstCycle = true;
3289 if(curEl && curEl.tagName == "TR" && curEl.cells.length > 0)
3290  curEl = curEl.cells[0];
3291 var pos = getAbsoluteScrollOffset_OperaFF(curEl, false);
3292 while(curEl != null) {
3293  pos += curEl.offsetTop;
3294  if(!isFirstCycle)
3295   pos -= curEl.scrollTop;
3296  curEl = curEl.offsetParent;
3297  isFirstCycle = false;
3298 }
3299 pos += document.body.scrollTop;
3300 return pos;
3301}
3302function getAbsolutePositionY_IE(element){
3303 if(element == null || Browser.IE && element.parentNode == null) return 0; 
3304 return element.getBoundingClientRect().top + ASPx.GetDocumentScrollTop();
3305}
3306function getAbsolutePositionY_FF3(element){
3307 if(element == null) return 0;
3308 var y = element.getBoundingClientRect().top + ASPx.GetDocumentScrollTop();
3309 return Math.round(y);
3310}
3311function getAbsolutePositionY_NS(curEl){
3312 var pos = getAbsoluteScrollOffset_OperaFF(curEl, false);
3313 var isFirstCycle = true;
3314 while(curEl != null) {
3315  pos += curEl.offsetTop;
3316  if(!isFirstCycle && curEl.offsetParent != null)
3317   pos -= curEl.scrollTop;
3318  if(!isFirstCycle && Browser.Firefox){
3319   var style = ASPx.GetCurrentStyle(curEl);
3320   if(curEl.tagName == "DIV" && style.overflow != "visible")
3321    pos += ASPx.PxToInt(style.borderTopWidth);
3322  }
3323  isFirstCycle = false;
3324  curEl = curEl.offsetParent;
3325 }
3326 return pos;
3327}
3328var WebKit3TDRealInfo = {
3329 GetOffsetTop: function(tdElement){
3330  switch(ASPx.GetCurrentStyle(tdElement).verticalAlign){
3331   case "middle":
3332    return Math.round(tdElement.offsetTop - (tdElement.offsetHeight - tdElement.clientHeight )/2 + tdElement.clientTop);
3333   case "bottom":
3334    return tdElement.offsetTop - tdElement.offsetHeight + tdElement.clientHeight + tdElement.clientTop;
3335  }
3336  return tdElement.offsetTop;
3337 },
3338 GetClientHeight: function(tdElement){
3339  var valign = ASPx.GetCurrentStyle(tdElement).verticalAlign;
3340  switch(valign){
3341   case "middle":
3342    return tdElement.clientHeight + tdElement.offsetTop * 2;
3343   case "top":
3344    return tdElement.offsetHeight - tdElement.clientTop * 2;
3345   case "bottom":
3346    return tdElement.clientHeight + tdElement.offsetTop;
3347  }
3348  return tdElement.clientHeight;
3349 }
3350}
3351function getAbsolutePositionY_Safari(curEl){
3352 var pos = getAbsoluteScrollOffset_WebKit(curEl, false);
3353 var isSafariVerNonLessThan3OrChrome = Browser.Safari && Browser.Version >= 3 || Browser.Chrome;
3354 if(curEl != null){
3355  var isFirstCycle = true;
3356  if(isSafariVerNonLessThan3OrChrome && curEl.tagName == "TD") {
3357   pos += WebKit3TDRealInfo.GetOffsetTop(curEl);
3358   curEl = curEl.offsetParent;
3359   isFirstCycle = false;
3360  }
3361  var hasNonStaticElement = false;
3362  while (curEl != null) {
3363   pos += curEl.offsetTop;
3364   var style = ASPx.GetCurrentStyle(curEl);
3365   var isNonStatic = style.position !== "" && style.position !== "static";
3366   if(isNonStatic)
3367    hasNonStaticElement = true;
3368   var safariDisplayTable = Browser.Safari && Browser.Version >= 8 && style.display === "table";
3369   var posDiv = curEl.tagName == "DIV" && isNonStatic && !safariDisplayTable;
3370   if(!isFirstCycle && (curEl.tagName == "TD" || curEl.tagName == "TABLE" || posDiv))
3371    pos += curEl.clientTop;
3372   isFirstCycle = false;
3373   curEl = curEl.offsetParent;
3374  }
3375  if(!hasNonStaticElement && (document.documentElement.style.position === "" || document.documentElement.style.position === "static"))
3376   pos += document.documentElement.offsetTop;
3377 }
3378 return pos;
3379}
3380function getAbsoluteScrollOffset_OperaFF(curEl, isX) {
3381 var pos = 0;   
3382 var isFirstCycle = true;
3383 while(curEl != null) {
3384  if(curEl.tagName == "BODY")
3385   break;
3386  var style = ASPx.GetCurrentStyle(curEl);
3387  if(style.position == "absolute")
3388   break;
3389  if(!isFirstCycle && curEl.tagName == "DIV" && (style.position == "" || style.position == "static"))
3390   pos -= isX ? curEl.scrollLeft : curEl.scrollTop;
3391  curEl = curEl.parentNode;
3392  isFirstCycle = false;
3393 }
3394 return pos; 
3395}
3396function getAbsoluteScrollOffset_WebKit(curEl, isX) {
3397 var pos = 0;   
3398 var isFirstCycle = true;
3399 var step = 0;
3400 var absoluteWasFoundAtStep = -1;
3401 var isThereFixedParent = false;
3402 while(curEl != null) {
3403  if(curEl.tagName == "BODY")
3404   break;
3405  var style = ASPx.GetCurrentStyle(curEl);
3406  var positionIsDefault = style.position == "" || style.position == "static";
3407  var absoluteWasFoundAtPreviousStep = absoluteWasFoundAtStep >= 0 && absoluteWasFoundAtStep < step;
3408  var canHaveScrolls = curEl.tagName == "DIV" || curEl.tagName == "SECTION" || curEl.tagName == "FORM";
3409  if(!isFirstCycle && canHaveScrolls && (!positionIsDefault || !absoluteWasFoundAtPreviousStep))
3410   pos -= isX ? curEl.scrollLeft : curEl.scrollTop;
3411  if(style.position == "absolute")
3412   absoluteWasFoundAtStep = step;
3413  else if(style.position == "relative")
3414   absoluteWasFoundAtStep = -1;
3415  else if(style.position == "fixed")
3416   isThereFixedParent = true;
3417  curEl = curEl.parentNode;
3418  isFirstCycle = false;
3419  step ++;
3420 }
3421 if(isThereFixedParent)
3422  pos += isX ? ASPx.GetDocumentScrollLeft() : ASPx.GetDocumentScrollTop();
3423 return pos; 
3424}
3425function getAbsolutePositionY_Other(curEl){
3426 var pos = 0;
3427 var isFirstCycle = true;
3428 while(curEl != null) {
3429  pos += curEl.offsetTop;
3430  if(!isFirstCycle && curEl.offsetParent != null)
3431   pos -= curEl.scrollTop;
3432  isFirstCycle = false;
3433  curEl = curEl.offsetParent;
3434 }
3435 return pos;
3436}
3437function createElementMock(element) {
3438 var div = document.createElement('DIV');
3439 div.style.top = "0px";
3440 div.style.left = "0px";
3441 div.visibility = "hidden";
3442 div.style.position = ASPx.GetCurrentStyle(element).position;
3443 return div;
3444}
3445ASPx.PrepareClientPosElementForOtherParent = function(pos, element, otherParent, isX) {
3446 if(element.parentNode == otherParent)
3447  return ASPx.PrepareClientPosForElement(pos, element, isX);
3448 var elementMock = createElementMock(element);
3449 otherParent.appendChild(elementMock); 
3450 var preparedPos = ASPx.PrepareClientPosForElement(pos, elementMock, isX);
3451 otherParent.removeChild(elementMock);
3452 return preparedPos;
3453}
3454ASPx.PrepareClientPosForElement = function(pos, element, isX) {
3455 pos -= ASPx.GetPositionElementOffset(element, isX);
3456 return pos;
3457}
3458function getExperimentalPositionOffset(element, isX) {
3459 var div = createElementMock(element);
3460 if(div.style.position == "static")
3461  div.style.position = "absolute";
3462 element.parentNode.appendChild(div); 
3463 var realPos = isX ? ASPx.GetAbsoluteX(div) : ASPx.GetAbsoluteY(div);
3464 element.parentNode.removeChild(div);
3465 return Math.round(realPos);
3466}
3467ASPx.GetPositionElementOffset = function(element, isX) {
3468 return getExperimentalPositionOffset(element, isX);
3469}
3470function getPositionElementOffsetCore(element, isX) {
3471 var curEl = element.offsetParent;
3472 var offset = 0;
3473 var scroll = 0;
3474 var isThereFixedParent = false;
3475 var isFixed = false;
3476 var hasDisplayTableParent = false;
3477 var position = "";
3478 while(curEl != null) {
3479  var tagName = curEl.tagName;
3480  if(tagName == "HTML"){
3481   break;
3482  }
3483  if(tagName == "BODY"){
3484   if(!Browser.Opera && !Browser.Chrome && !Browser.Edge){
3485    var style = ASPx.GetCurrentStyle(curEl);
3486    if(style.position != "" && style.position != "static"){
3487     offset += ASPx.PxToInt(isX ? style.left : style.top);
3488     offset += ASPx.PxToInt(isX ? style.marginLeft : style.marginTop);
3489    }
3490   }
3491   break;
3492  }
3493  var style = ASPx.GetCurrentStyle(curEl);
3494  isFixed = style.position == "fixed";
3495  if(isFixed) {
3496   isThereFixedParent = true;
3497   if(Browser.IE) 
3498    return getExperimentalPositionOffset(element, isX); 
3499  }
3500  hasDisplayTableParent = style.display == "table" && (style.position == "absolute" || style.position == "relative");
3501  if(hasDisplayTableParent && Browser.IE)
3502   return getExperimentalPositionOffset(element, isX);
3503  if(style.position == "absolute" || isFixed || style.position == "relative") {
3504   offset += isX ? curEl.offsetLeft : curEl.offsetTop;
3505   offset += ASPx.PxToInt(isX ? style.borderLeftWidth : style.borderTopWidth);
3506  }
3507  if(style.position == "relative") 
3508   scroll += getElementChainScroll(curEl, curEl.offsetParent, isX);
3509  scroll += isX ? curEl.scrollLeft : curEl.scrollTop;
3510  curEl = curEl.offsetParent;
3511 }
3512 offset -= scroll; 
3513 if((Browser.IE || Browser.Firefox && Browser.Version >= 3 || Browser.WebKitFamily || Browser.Edge) && isThereFixedParent)
3514  offset += isX ? ASPx.GetDocumentScrollLeft() : ASPx.GetDocumentScrollTop();
3515 return offset;
3516}
3517function getElementChainScroll(startElement, endElement, isX){
3518 var curEl = startElement.parentNode;
3519 var scroll = 0;
3520 while(curEl != endElement){
3521  scroll += isX ? curEl.scrollLeft : curEl.scrollTop;
3522  curEl = curEl.parentNode;
3523 }
3524 return scroll;
3525}
3526ASPx.GetSizeOfText = function(text, textCss) {
3527 var testContainer = document.createElement("tester");
3528 var defaultLineHeight = ASPx.Browser.Firefox ? "1" : "";
3529 testContainer.style.fontSize = textCss.fontSize;
3530 testContainer.style.fontFamily = textCss.fontFamily;
3531 testContainer.style.fontWeight = textCss.fontWeight;
3532 testContainer.style.letterSpacing = textCss.letterSpacing;
3533 testContainer.style.lineHeight = textCss.lineHeight || defaultLineHeight;
3534 testContainer.style.position = "absolute";
3535 testContainer.style.top = ASPx.InvalidPosition + "px";
3536 testContainer.style.left = ASPx.InvalidPosition + "px";
3537 testContainer.style.width = "auto";
3538 testContainer.style.whiteSpace = "nowrap";
3539 testContainer.appendChild(document.createTextNode(text));
3540 var testElement = document.body.appendChild(testContainer);
3541 var size = {
3542  "width": testElement.offsetWidth,
3543  "height": testElement.offsetHeight
3544 };
3545 document.body.removeChild(testElement);
3546 return size;
3547}
3548ASPx.PointToPixel = function(points, addPx) {  
3549 var result = 0;
3550 try {
3551  var indexOfPt = points.toLowerCase().indexOf("pt");
3552  if(indexOfPt > -1)
3553   result = parseInt(points.substr(0, indexOfPt)) * 96 / 72;
3554  else
3555   result = parseInt(points) * 96 / 72;
3556  if(addPx)
3557   result = result + "px";
3558 } catch(e) {}
3559 return result;
3560}
3561ASPx.PixelToPoint = function(pixels, addPt) { 
3562 var result = 0;
3563 try {
3564  var indexOfPx = pixels.toLowerCase().indexOf("px");
3565  if(indexOfPx > -1)
3566   result = parseInt(pixels.substr(0, indexOfPx)) * 72 / 96;
3567  else
3568   result = parseInt(pixels) * 72 / 96;
3569  if(addPt)
3570   result = result + "pt";
3571 } catch(e) {}
3572 return result;         
3573}
3574ASPx.PxToInt = function(px) {
3575 return pxToNumber(px, parseInt);
3576}
3577ASPx.PxToFloat = function(px) {
3578 return pxToNumber(px, parseFloat);
3579}
3580function pxToNumber(px, parseFunction) {
3581 var result = 0;
3582 if(px != null && px != "") {
3583  try {
3584   var indexOfPx = px.indexOf("px");
3585   if(indexOfPx > -1)
3586    result = parseFunction(px.substr(0, indexOfPx));
3587  } catch(e) { }
3588 }
3589 return result;
3590}
3591ASPx.PercentageToFloat = function(perc) {
3592 var result = 0;
3593 if(perc != null && perc != "") {
3594  try {
3595   var indexOfPerc = perc.indexOf("%");
3596   if(indexOfPerc > -1)
3597    result = parseFloat(perc.substr(0, indexOfPerc)) / 100;
3598  } catch(e) { }
3599 }
3600 return result;
3601}
3602ASPx.CreateGuid = function() {
3603 return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { 
3604   var r = Math.random()*16|0,v=c=='x'?r:r&0x3|0x8;
3605  return v.toString(16);
3606 });
3607}
3608ASPx.GetLeftRightBordersAndPaddingsSummaryValue = function(element, currentStyle) {
3609 return ASPx.GetLeftRightPaddings(element, currentStyle) + ASPx.GetHorizontalBordersWidth(element, currentStyle);
3610}
3611ASPx.GetTopBottomBordersAndPaddingsSummaryValue = function(element, currentStyle) {
3612 return ASPx.GetTopBottomPaddings(element, currentStyle) + ASPx.GetVerticalBordersWidth(element, currentStyle);
3613}
3614ASPx.GetVerticalBordersWidth = function(element, style) {
3615 if(!ASPx.IsExists(style))
3616  style = (Browser.IE && Browser.MajorVersion != 9 && window.getComputedStyle) ? window.getComputedStyle(element) : ASPx.GetCurrentStyle(element);
3617 var res = 0;
3618 if(style.borderTopStyle != "none") {
3619  res += ASPx.PxToFloat(style.borderTopWidth);
3620  if(Browser.IE && Browser.MajorVersion < 9)
3621   res += getIe8BorderWidthFromText(style.borderTopWidth);
3622 }
3623 if(style.borderBottomStyle != "none") {
3624  res += ASPx.PxToFloat(style.borderBottomWidth);
3625  if(Browser.IE && Browser.MajorVersion < 9)
3626   res += getIe8BorderWidthFromText(style.borderBottomWidth);
3627 }
3628 return res;
3629}
3630ASPx.GetHorizontalBordersWidth = function(element, style) {
3631 if(!ASPx.IsExists(style))
3632  style = (Browser.IE && window.getComputedStyle) ? window.getComputedStyle(element) : ASPx.GetCurrentStyle(element);
3633 var res = 0;
3634 if(style.borderLeftStyle != "none") {
3635  res += ASPx.PxToFloat(style.borderLeftWidth);
3636  if(Browser.IE && Browser.MajorVersion < 9)
3637   res += getIe8BorderWidthFromText(style.borderLeftWidth);
3638 }
3639 if(style.borderRightStyle != "none") {
3640  res += ASPx.PxToFloat(style.borderRightWidth);
3641  if(Browser.IE && Browser.MajorVersion < 9)
3642   res += getIe8BorderWidthFromText(style.borderRightWidth);
3643 }
3644 return res;
3645}
3646function getIe8BorderWidthFromText(textWidth) {
3647 var availableWidth = { "thin": 1, "medium" : 3, "thick": 5 };
3648 var width = availableWidth[textWidth];
3649 return width ? width : 0;
3650}
3651ASPx.GetTopBottomPaddings = function(element, style) {
3652 var currentStyle = style ? style : ASPx.GetCurrentStyle(element);
3653 return ASPx.PxToInt(currentStyle.paddingTop) + ASPx.PxToInt(currentStyle.paddingBottom);
3654}
3655ASPx.GetLeftRightPaddings = function(element, style) {
3656 var currentStyle = style ? style : ASPx.GetCurrentStyle(element);
3657 return ASPx.PxToInt(currentStyle.paddingLeft) + ASPx.PxToInt(currentStyle.paddingRight);
3658}
3659ASPx.GetTopBottomMargins = function(element, style) {
3660 var currentStyle = style ? style : ASPx.GetCurrentStyle(element);
3661 return ASPx.PxToInt(currentStyle.marginTop) + ASPx.PxToInt(currentStyle.marginBottom);
3662}
3663ASPx.GetLeftRightMargins = function(element, style) {
3664 var currentStyle = style ? style : ASPx.GetCurrentStyle(element);
3665 return ASPx.PxToInt(currentStyle.marginLeft) + ASPx.PxToInt(currentStyle.marginRight);
3666}
3667ASPx.GetClearClientWidth = function(element) {
3668 return element.offsetWidth - ASPx.GetLeftRightBordersAndPaddingsSummaryValue(element);
3669}
3670ASPx.GetClearClientHeight = function(element) {
3671 return element.offsetHeight - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(element);
3672}
3673ASPx.SetOffsetWidth = function(element, widthValue, currentStyle) {
3674 if(!ASPx.IsExists(currentStyle))
3675  currentStyle = ASPx.GetCurrentStyle(element);
3676 var value = widthValue - ASPx.PxToInt(currentStyle.marginLeft) - ASPx.PxToInt(currentStyle.marginRight);
3677  value -= ASPx.GetLeftRightBordersAndPaddingsSummaryValue(element, currentStyle);
3678 if(value > -1)
3679  element.style.width = value + "px";
3680}
3681ASPx.SetOffsetHeight = function(element, heightValue, currentStyle) {
3682 if(!ASPx.IsExists(currentStyle))
3683  currentStyle = ASPx.GetCurrentStyle(element);
3684 var value = heightValue - ASPx.PxToInt(currentStyle.marginTop) - ASPx.PxToInt(currentStyle.marginBottom);
3685  value -= ASPx.GetTopBottomBordersAndPaddingsSummaryValue(element, currentStyle);
3686 if(value > -1)
3687  element.style.height = value + "px";
3688}
3689ASPx.FindOffsetParent = function(element) {
3690 var currentElement = element.parentNode;
3691 while(ASPx.IsExistsElement(currentElement) && currentElement.tagName != "BODY") {
3692  if(currentElement.offsetWidth > 0 && currentElement.offsetHeight > 0)
3693   return currentElement;
3694  currentElement = currentElement.parentNode;
3695 }
3696 return document.body;
3697}
3698ASPx.GetDocumentScrollTop = function(){
3699 var isScrollBodyIE = Browser.IE && ASPx.GetCurrentStyle(document.body).overflow == "hidden" && document.body.scrollTop > 0;
3700 if(Browser.WebKitFamily || Browser.Edge || isScrollBodyIE) {
3701  if(Browser.MacOSMobilePlatform) 
3702   return window.pageYOffset;
3703  else 
3704   return document.body.scrollTop;
3705 }
3706 else
3707  return document.documentElement.scrollTop;
3708}
3709ASPx.SetDocumentScrollTop = function(scrollTop) {
3710 if(Browser.WebKitFamily || Browser.Edge) {
3711  if(Browser.MacOSMobilePlatform) 
3712   window.pageYOffset = scrollTop;
3713  else 
3714   document.body.scrollTop = scrollTop;
3715 }
3716 else
3717  document.documentElement.scrollTop = scrollTop;
3718}
3719ASPx.GetDocumentScrollLeft = function(){
3720 var isScrollBodyIE = Browser.IE && ASPx.GetCurrentStyle(document.body).overflow == "hidden" && document.body.scrollLeft > 0;
3721 if(Browser.WebKitFamily || Browser.Edge || isScrollBodyIE || Browser.Opera)
3722  return document.body.scrollLeft;
3723 return document.documentElement.scrollLeft;
3724}
3725ASPx.SetDocumentScrollLeft = function(scrollLeft) {
3726 if(Browser.WebKitFamily || Browser.Edge) {
3727  if(Browser.MacOSMobilePlatform)
3728   window.pageXOffset = scrollLeft;
3729  else 
3730   document.body.scrollLeft = scrollLeft;
3731 }
3732 else
3733  document.documentElement.scrollLeft = scrollLeft;
3734}
3735ASPx.GetDocumentClientWidth = function(){
3736 if(document.documentElement.clientWidth == 0)
3737  return document.body.clientWidth;
3738 else
3739  return document.documentElement.clientWidth;
3740}
3741ASPx.GetDocumentClientHeight = function() {
3742 if(Browser.Firefox && window.innerHeight - document.documentElement.clientHeight > ASPx.GetVerticalScrollBarWidth()) {
3743  return window.innerHeight;
3744 } else if(Browser.Opera && Browser.Version < 9.6 || document.documentElement.clientHeight == 0) {
3745   return document.body.clientHeight
3746 }
3747 return document.documentElement.clientHeight;
3748}
3749ASPx.GetDocumentWidth = function(){
3750 var bodyWidth = document.body.offsetWidth;
3751 var docWidth = Browser.IE ? document.documentElement.clientWidth : document.documentElement.offsetWidth;
3752 var bodyScrollWidth = document.body.scrollWidth;
3753 var docScrollWidth = document.documentElement.scrollWidth;
3754 return getMaxDimensionOf(bodyWidth, docWidth, bodyScrollWidth, docScrollWidth);
3755}
3756ASPx.GetDocumentHeight = function(){
3757 var bodyHeight = document.body.offsetHeight;
3758 var docHeight = Browser.IE ? document.documentElement.clientHeight : document.documentElement.offsetHeight;
3759 var bodyScrollHeight = document.body.scrollHeight;
3760 var docScrollHeight = document.documentElement.scrollHeight;
3761 var maxHeight = getMaxDimensionOf(bodyHeight, docHeight, bodyScrollHeight, docScrollHeight);
3762 if(Browser.Opera && Browser.Version >= 9.6){
3763  if(Browser.Version < 10)
3764   maxHeight = getMaxDimensionOf(bodyHeight, docHeight, bodyScrollHeight);
3765  var visibleHeightOfDocument = document.documentElement.clientHeight;
3766  if(maxHeight > visibleHeightOfDocument)
3767   maxHeight = getMaxDimensionOf(window.outerHeight, maxHeight);
3768  else
3769   maxHeight = document.documentElement.clientHeight;
3770  return maxHeight;
3771 }
3772 return maxHeight;
3773}
3774ASPx.GetDocumentMaxClientWidth = function(){
3775 var bodyWidth = document.body.offsetWidth;
3776 var docWidth = document.documentElement.offsetWidth;
3777 var docClientWidth = document.documentElement.clientWidth;
3778 return getMaxDimensionOf(bodyWidth, docWidth, docClientWidth);
3779}
3780ASPx.GetDocumentMaxClientHeight = function(){
3781 var bodyHeight = document.body.offsetHeight;
3782 var docHeight = document.documentElement.offsetHeight;
3783 var docClientHeight = document.documentElement.clientHeight;
3784 return getMaxDimensionOf(bodyHeight, docHeight, docClientHeight);
3785}
3786ASPx.verticalScrollIsNotHidden = null;
3787ASPx.horizontalScrollIsNotHidden = null;
3788ASPx.GetVerticalScrollIsNotHidden = function() {
3789 if(!ASPx.IsExists(ASPx.verticalScrollIsNotHidden))
3790  ASPx.verticalScrollIsNotHidden = ASPx.GetCurrentStyle(document.body).overflowY !== "hidden"
3791   && ASPx.GetCurrentStyle(document.documentElement).overflowY !== "hidden";
3792 return ASPx.verticalScrollIsNotHidden;
3793}
3794ASPx.GetHorizontalScrollIsNotHidden = function() {
3795 if(!ASPx.IsExists(ASPx.horizontalScrollIsNotHidden))
3796  ASPx.horizontalScrollIsNotHidden = ASPx.GetCurrentStyle(document.body).overflowX !== "hidden"
3797   && ASPx.GetCurrentStyle(document.documentElement).overflowX !== "hidden";
3798 return ASPx.horizontalScrollIsNotHidden;
3799}
3800ASPx.GetCurrentDocumentWidth = function() {
3801 var result = ASPx.GetDocumentClientWidth();
3802 if(!ASPx.Browser.Safari && ASPx.GetVerticalScrollIsNotHidden() && ASPx.GetDocumentHeight() > ASPx.GetDocumentClientHeight())
3803  result += ASPx.GetVerticalScrollBarWidth();
3804 return result;
3805}
3806ASPx.GetCurrentDocumentHeight = function() {
3807 var result = ASPx.GetDocumentClientHeight();
3808 if(!ASPx.Browser.Safari && ASPx.GetHorizontalScrollIsNotHidden() && ASPx.GetDocumentWidth() > ASPx.GetDocumentClientWidth())
3809  result += ASPx.GetVerticalScrollBarWidth();
3810 return result;
3811}
3812function getMaxDimensionOf(){
3813 var max = ASPx.InvalidDimension;
3814 for(var i = 0; i < arguments.length; i++){
3815  if(max < arguments[i])
3816   max = arguments[i];
3817 }
3818 return max;
3819}
3820ASPx.GetClientLeft = function(element){
3821 return ASPx.IsExists(element.clientLeft) ? element.clientLeft : (element.offsetWidth - element.clientWidth) / 2;
3822}
3823ASPx.GetClientTop = function(element){
3824 return ASPx.IsExists(element.clientTop) ? element.clientTop : (element.offsetHeight - element.clientHeight) / 2;
3825}
3826ASPx.SetStyles = function(element, styles, makeImportant) {
3827 if(ASPx.IsExists(styles.cssText))
3828  element.style.cssText = styles.cssText;
3829 if(ASPx.IsExists(styles.className))
3830  element.className = styles.className;
3831 for(var property in styles) {
3832  if(!styles.hasOwnProperty(property))
3833   continue;
3834  var value = styles[property];
3835  switch (property) {
3836   case "cssText":
3837   case "className":
3838    break;
3839   case "float":
3840    ASPx.SetElementFloat(element, value);
3841    break;
3842   case "opacity":
3843    ASPx.SetElementOpacity(element, value);
3844    break;
3845   case "zIndex":
3846    ASPx.SetStylesCore(element, property, value, makeImportant);
3847    break;
3848   case "fontWeight":
3849    if(ASPx.Browser.IE && ASPx.Browser.Version < 9 && typeof(styles[property]) == "number")
3850     value = styles[property].toString();
3851   default:
3852    ASPx.SetStylesCore(element, property, value + (typeof (value) == "number" ? "px" : ""), makeImportant);
3853  }
3854 }
3855}
3856ASPx.SetStylesCore = function(element, property, value, makeImportant) {
3857 if(makeImportant) {
3858  var index = property.search("[A-Z]");
3859  if(index != -1)
3860   property = property.replace(property.charAt(index), "-" + property.charAt(index).toLowerCase());
3861  if(element.style.setProperty)
3862   element.style.setProperty(property, value, "important");
3863  else 
3864   element.style.cssText += ";" + property + ":" + value + "!important";
3865 }
3866 else
3867  element.style[property] = value;
3868}
3869ASPx.RemoveBordersAndShadows = function(el) {
3870 if(!el || !el.style)
3871  return;
3872 el.style.borderWidth = 0;
3873 if(ASPx.IsExists(el.style.boxShadow))
3874  el.style.boxShadow = "none";
3875 else if(ASPx.IsExists(el.style.MozBoxShadow))
3876  el.style.MozBoxShadow = "none";
3877 else if(ASPx.IsExists(el.style.webkitBoxShadow))
3878  el.style.webkitBoxShadow = "none";
3879}
3880ASPx.GetCellSpacing = function(element) {
3881 var val = parseInt(element.cellSpacing);
3882 if(!isNaN(val)) return val;
3883 val = parseInt(ASPx.GetCurrentStyle(element).borderSpacing);
3884 if(!isNaN(val)) return val;
3885 return 0;
3886}
3887ASPx.GetInnerScrollPositions = function(element) {
3888 var scrolls = [];
3889 getInnerScrollPositionsCore(element, scrolls);
3890 return scrolls;
3891}
3892function getInnerScrollPositionsCore(element, scrolls) {
3893 for(var child = element.firstChild; child; child = child.nextSibling) {
3894  var scrollTop = child.scrollTop,
3895   scrollLeft = child.scrollLeft;
3896  if(scrollTop > 0 || scrollLeft > 0)
3897   scrolls.push([child, scrollTop, scrollLeft]);
3898  getInnerScrollPositionsCore(child, scrolls);
3899 }
3900}
3901ASPx.RestoreInnerScrollPositions = function(scrolls) {
3902 for(var i = 0, scrollArr; scrollArr = scrolls[i]; i++) {
3903  if(scrollArr[1] > 0)
3904   scrollArr[0].scrollTop = scrollArr[1];
3905  if(scrollArr[2] > 0)
3906   scrollArr[0].scrollLeft = scrollArr[2];
3907 }
3908}
3909ASPx.GetOuterScrollPosition = function(element) {
3910 while(element.tagName !== "BODY") {
3911  var scrollTop = element.scrollTop,
3912   scrollLeft = element.scrollLeft;
3913  if(scrollTop > 0 || scrollLeft > 0) {
3914   return {
3915    scrollTop: scrollTop,
3916    scrollLeft: scrollLeft,
3917    element: element
3918   };
3919  }
3920  element = element.parentNode;
3921 }
3922 return {
3923  scrollTop: ASPx.GetDocumentScrollTop(),
3924  scrollLeft: ASPx.GetDocumentScrollLeft()
3925 };
3926}
3927ASPx.RestoreOuterScrollPosition = function(scrollInfo) {
3928 if(scrollInfo.element) {
3929  if(scrollInfo.scrollTop > 0)
3930   scrollInfo.element.scrollTop = scrollInfo.scrollTop;
3931  if(scrollInfo.scrollLeft > 0)
3932   scrollInfo.element.scrollLeft = scrollInfo.scrollLeft;
3933 }
3934 else {
3935  if(scrollInfo.scrollTop > 0)
3936   ASPx.SetDocumentScrollTop(scrollInfo.scrollTop);
3937  if(scrollInfo.scrollLeft > 0)
3938   ASPx.SetDocumentScrollLeft(scrollInfo.scrollLeft);
3939 }
3940}
3941ASPx.ChangeElementContainer = function(element, container, savePreviousContainer) {
3942 if(element.parentNode != container) {
3943  var parentNode = element.parentNode;
3944  parentNode.removeChild(element);
3945  container.appendChild(element);
3946  if(savePreviousContainer)
3947   element.previousContainer = parentNode;
3948 }
3949}
3950ASPx.RestoreElementContainer = function(element) {
3951 if(element.previousContainer) {
3952  ASPx.ChangeElementContainer(element, element.previousContainer, false);
3953  element.previousContainer = null;
3954 }
3955}
3956ASPx.MoveChildrenToElement = function(sourceElement, destinationElement){
3957 while(sourceElement.childNodes.length > 0)
3958  destinationElement.appendChild(sourceElement.childNodes[0]);
3959}
3960ASPx.GetScriptCode = function(script) {
3961 var useFirstChildElement = Browser.Chrome && Browser.Version < 11 || Browser.Safari && Browser.Version < 5; 
3962 var text = useFirstChildElement ? script.firstChild.data : script.text;
3963 var comment = "<!--";
3964 var pos = text.indexOf(comment);
3965 if(pos > -1)
3966  text = text.substr(pos + comment.length);
3967 return text;
3968}
3969ASPx.AppendScript = function(script) {
3970 var parent = document.getElementsByTagName("head")[0];
3971 if(!parent)
3972  parent = document.body;
3973 if(parent)
3974  parent.appendChild(script);
3975}
3976function getFrame(frames, name) {
3977 if(frames[name])
3978  return frames[name];
3979 for(var i = 0; i < frames.length; i++) {
3980  try {
3981   var frame = frames[i];
3982   if(frame.name == name) 
3983    return frame; 
3984   frame = getFrame(frame.frames, name);
3985   if(frame != null)   
3986    return frame; 
3987  } catch(e) {
3988  } 
3989 }
3990 return null;
3991}
3992ASPx.IsValidElement = function(element) {
3993 if(!element) 
3994  return false;
3995 if(!(Browser.Firefox && Browser.Version < 4)) {
3996  if(element.ownerDocument && element.ownerDocument.body.compareDocumentPosition)
3997   return element.ownerDocument.body.compareDocumentPosition(element) % 2 === 0;
3998 }
3999 if(!Browser.Opera && !(Browser.IE && Browser.Version < 9) && element.offsetParent && element.parentNode.tagName)
4000  return true;
4001 while(element != null){
4002  if(element.tagName == "BODY")
4003   return true;
4004  element = element.parentNode;
4005 }
4006 return false;
4007}
4008ASPx.IsValidElements = function(elements) {
4009 if(!elements)
4010  return false; 
4011 for(var i = 0; i < elements.length; i++) {
4012  if(elements[i] && !ASPx.IsValidElement(elements[i]))
4013   return false;
4014 }
4015 return true;
4016}
4017ASPx.IsExistsElement = function(element) {
4018 return element && ASPx.IsValidElement(element);
4019}
4020ASPx.CreateHtmlElementFromString = function(str) {
4021 var dummy = ASPx.CreateHtmlElement();
4022 dummy.innerHTML = str;
4023 return dummy.firstChild;
4024}
4025ASPx.CreateHtmlElement = function(tagName, styles) {
4026 var element = document.createElement(tagName || "DIV");
4027 if(styles)
4028  ASPx.SetStyles(element, styles);
4029 return element;
4030}
4031ASPx.RestoreElementOriginalWidth = function(element) {
4032 if(!ASPx.IsExistsElement(element)) 
4033  return;
4034 element.style.width = element.dxOrigWidth = ASPx.GetElementOriginalWidth(element);
4035}
4036ASPx.GetElementOriginalWidth = function(element) {
4037 if(!ASPx.IsExistsElement(element)) 
4038  return null;
4039 var width;
4040 if(!ASPx.IsExists(element.dxOrigWidth)) {
4041   width = String(element.style.width).length > 0
4042  ? element.style.width
4043  : element.offsetWidth + "px";
4044 } else {
4045  width = element.dxOrigWidth;
4046 }
4047 return width;
4048}
4049ASPx.DropElementOriginalWidth = function(element) {
4050 if(ASPx.IsExists(element.dxOrigWidth))
4051  element.dxOrigWidth = null;
4052}
4053ASPx.GetObjectKeys = function(obj) {
4054 if(!obj) return [ ];
4055 if(Object.keys)
4056  return Object.keys(obj);
4057 var keys = [ ];
4058 for(var key in obj) {
4059  if(obj.hasOwnProperty(key))
4060   keys.push(key);
4061 }
4062 return keys;
4063}
4064ASPx.ShowErrorAlert = function(message) {
4065 var textArea = document.createElement("TEXTAREA");
4066 textArea.innerHTML = message;
4067 message = textArea.value;
4068 if(ASPx.IsExists(message) && message !== "")
4069  alert(message);
4070}
4071ASPx.IsInteractiveControl = function(element, extremeParent) { 
4072 return Data.ArrayIndexOf(["A", "INPUT", "SELECT", "OPTION", "TEXTAREA", "BUTTON", "IFRAME"], element.tagName) > -1;
4073}
4074ASPx.IsUrlContainsClientScript = function(url) {
4075 return url.toLowerCase().indexOf("javascript:") !== -1;
4076}
4077Function.prototype.aspxBind = function(scope) {
4078 var func = this;
4079 return function() {
4080  return func.apply(scope, arguments);
4081 };
4082};
4083var FilteringUtils = { };
4084FilteringUtils.EventKeyCodeChangesTheInput = function(evt) {
4085 if(ASPx.IsPasteShortcut(evt))
4086  return true;
4087 else if(evt.ctrlKey && !evt.altKey)
4088  return false;
4089 if(ASPx.Browser.AndroidMobilePlatform || ASPx.Browser.MacOSMobilePlatform) return true; 
4090 var keyCode = ASPx.Evt.GetKeyCode(evt);
4091 var isSystemKey = ASPx.Key.Windows <= keyCode && keyCode <= ASPx.Key.ContextMenu;
4092 var isFKey = ASPx.Key.F1 <= keyCode && keyCode <= 127; 
4093 return ASPx.Key.Delete <= keyCode && !isSystemKey && !isFKey || keyCode == ASPx.Key.Backspace || keyCode == ASPx.Key.Space;
4094}
4095FilteringUtils.FormatCallbackArg = function(prefix, arg) {
4096 return (ASPx.IsExists(arg) ? prefix + "|" + arg.length + ';' + arg + ';' : "");
4097}
4098ASPx.FilteringUtils = FilteringUtils;
4099var FormatStringHelper = { };
4100FormatStringHelper.PlaceHolderTemplateStruct = function(startIndex, length, index, placeHolderString){
4101 this.startIndex = startIndex;
4102 this.realStartIndex = 0;
4103 this.length = length;
4104 this.realLength = 0;
4105 this.index = index;
4106 this.placeHolderString = placeHolderString;
4107}
4108FormatStringHelper.GetPlaceHolderTemplates = function(formatString){
4109 formatString = this.CollapseDoubleBrackets(formatString);
4110 var templates = this.CreatePlaceHolderTemplates(formatString);
4111 return templates;
4112}
4113FormatStringHelper.CreatePlaceHolderTemplates = function(formatString){
4114 var templates = [];
4115 var templateStrings = formatString.match(/{[^}]+}/g);
4116 if(templateStrings != null){
4117  var pos = 0;
4118  for(var i = 0; i < templateStrings.length; i++){
4119   var tempString = templateStrings[i];
4120   var startIndex = formatString.indexOf(tempString, pos);
4121   var length = tempString.length;
4122   var indexString = tempString.slice(1).match(/^[0-9]+/);
4123   var index = parseInt(indexString);
4124   templates.push(new this.PlaceHolderTemplateStruct(startIndex, length, index, tempString));
4125   pos = startIndex + length;
4126  }
4127 }
4128 return templates;
4129}
4130FormatStringHelper.CollapseDoubleBrackets = function(formatString){
4131 formatString = this.CollapseOpenDoubleBrackets(formatString);
4132 formatString = this.CollapseCloseDoubleBrackets(formatString);
4133 return formatString;
4134}
4135FormatStringHelper.CollapseOpenDoubleBrackets = function(formatString){
4136 return formatString.replace(/{{/g, "_");
4137}
4138FormatStringHelper.CollapseCloseDoubleBrackets = function(formatString){
4139 while(true){
4140  var index = formatString.lastIndexOf("}}");
4141  if(index == -1) 
4142   break;
4143  else
4144   formatString = formatString.substr(0, index) + "_" + formatString.substr(index + 2);
4145 }
4146 return formatString;
4147}
4148ASPx.FormatStringHelper = FormatStringHelper;
4149var StartWithFilteringUtils = { };
4150StartWithFilteringUtils.HighlightSuggestedText = function(input, suggestedText, control){
4151 if(this.NeedToLockAndoidKeyEvents(control))
4152  control.LockAndroidKeyEvents();
4153 var selInfo = ASPx.Selection.GetInfo(input);
4154 var currentTextLenght = ASPx.Str.GetCoincideCharCount(suggestedText, input.value, 
4155  function(text, filter) { 
4156   return text.indexOf(filter) == 0;
4157  });
4158 var suggestedTextLenght = suggestedText.length;
4159 var isSelected = selInfo.startPos == 0 && selInfo.endPos == currentTextLenght && 
4160  selInfo.endPos == suggestedTextLenght && input.value == suggestedText;
4161 if(!isSelected) { 
4162  input.value = suggestedText;
4163  if(this.NeedToLockAndoidKeyEvents(control)) {
4164   window.setTimeout(function() {
4165    this.SelectText(input, currentTextLenght, suggestedTextLenght);
4166    control.UnlockAndroidKeyEvents();
4167   }.aspxBind(this), control.adroidSamsungBugTimeout);
4168  } else
4169   this.SelectText(input, currentTextLenght, suggestedTextLenght);
4170 }
4171}
4172StartWithFilteringUtils.SelectText = function(input, startPos, stopPos) {
4173 if(startPos < stopPos)
4174  ASPx.Selection.Set(input, startPos, stopPos);
4175}
4176StartWithFilteringUtils.RollbackOneSuggestedChar = function(input){
4177 var currentText = input.value;
4178 var cutText = currentText.slice(0, -1);
4179 if(cutText != currentText)
4180  input.value = cutText;
4181}
4182StartWithFilteringUtils.NeedToLockAndoidKeyEvents = function(control) {
4183 return ASPx.Browser.AndroidMobilePlatform && control && control.LockAndroidKeyEvents;
4184}
4185ASPx.StartWithFilteringUtils = StartWithFilteringUtils;
4186var ContainsFilteringUtils = { };
4187ContainsFilteringUtils.ColumnSelectionStruct = function(index, startIndex, length){
4188 this.index = index;
4189 this.length = length;
4190 this.startIndex = startIndex;
4191}
4192ContainsFilteringUtils.IsFilterCrossPlaseHolder = function(filterStartIndex, filterEndIndex, template) {
4193 var left = Math.max(filterStartIndex, template.realStartIndex);
4194 var right = Math.min(filterEndIndex,  template.realStartIndex + template.realLength);
4195 return left < right;
4196}
4197ContainsFilteringUtils.GetColumnSelectionsForItem = function(itemValues, formatString, filterString) {
4198 if(formatString == "") 
4199  return this.GetSelectionForSingleColumnItem(itemValues, filterString); 
4200 var result = [];
4201 var formatedString = ASPx.Formatter.Format(formatString, itemValues);
4202 var filterStartIndex = ASPx.Str.PrepareStringForFilter(formatedString).indexOf(ASPx.Str.PrepareStringForFilter(filterString));
4203 if(filterStartIndex == -1) return result;
4204 var filterEndIndex = filterStartIndex + filterString.length;
4205 var templates = FormatStringHelper.GetPlaceHolderTemplates(formatString);
4206 this.SupplyTemplatesWithRealValues(itemValues, templates);
4207 for(var i = 0; i < templates.length ; i++) {
4208  if(this.IsFilterCrossPlaseHolder(filterStartIndex, filterEndIndex, templates[i])) 
4209   result.push(this.GetColumnSelectionsForItemValue(templates[i], filterStartIndex, filterEndIndex));
4210 }
4211 return result;
4212}
4213ContainsFilteringUtils.GetColumnSelectionsForItemValue = function(template, filterStartIndex, filterEndIndex) {
4214 var selectedTextStartIndex = filterStartIndex < template.realStartIndex ? 0 :
4215  filterStartIndex - template.realStartIndex;
4216 var selectedTextEndIndex = filterEndIndex >  template.realStartIndex + template.realLength ? template.realLength :
4217  filterEndIndex - template.realStartIndex;
4218 var selectedTextLength = selectedTextEndIndex - selectedTextStartIndex;
4219  return new this.ColumnSelectionStruct(template.index, selectedTextStartIndex, selectedTextLength);
4220},
4221ContainsFilteringUtils.GetSelectionForSingleColumnItem = function(itemValues, filterString) {
4222 var selectedTextStartIndex = ASPx.Str.PrepareStringForFilter(itemValues[0]).indexOf(ASPx.Str.PrepareStringForFilter(filterString));
4223 var selectedTextLength = filterString.length;
4224 return [new this.ColumnSelectionStruct(0, selectedTextStartIndex, selectedTextLength)];
4225}
4226ContainsFilteringUtils.ResetFormatStringIndex = function(formatString, index) {
4227 if(index != 0)
4228  return formatString.replace(index.toString(), "0");
4229 return formatString;
4230},
4231ContainsFilteringUtils.SupplyTemplatesWithRealValues = function(itemValues, templates) {
4232 var shift = 0;
4233 for(var i = 0; i < templates.length; i++) {
4234  var formatString = this.ResetFormatStringIndex(templates[i].placeHolderString, templates[i].index);
4235  var currentItemValue = itemValues[templates[i].index];
4236  templates[i].realLength = ASPx.Formatter.Format(formatString, currentItemValue).length;
4237  templates[i].realStartIndex  += templates[i].startIndex + shift; 
4238  shift += templates[i].realLength - templates[i].placeHolderString.length; 
4239 }
4240}
4241ContainsFilteringUtils.PrepareElementText = function(itemText) {
4242 return itemText ? itemText.replace(/\&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;") : '';
4243}
4244ContainsFilteringUtils.UnselectContainsTextInElement = function(element, selection) {
4245 var currentText =  ASPx.Attr.GetAttribute (element, "DXText");
4246 if(ASPx.IsExists(currentText)) {
4247  currentText = ContainsFilteringUtils.PrepareElementText(currentText);
4248  ASPx.SetInnerHtml(element, currentText === "" ? "&nbsp;" : currentText);
4249 }
4250}
4251ContainsFilteringUtils.ReselectContainsTextInElement = function(element, selection) {
4252 var currentText = ASPx.GetInnerText(element);
4253 if(currentText.indexOf("</em>") != -1)
4254  ContainsFilteringUtils.UnselectContainsTextInElement(element, selection);
4255 return ContainsFilteringUtils.SelectContainsTextInElement(element, selection);
4256}
4257ContainsFilteringUtils.SelectContainsTextInElement = function(element, selection) {
4258 if(selection.startIndex == -1) return;
4259 var currentText =  ASPx.Attr.GetAttribute (element, "DXText");
4260 if(!ASPx.IsExists(currentText)) ASPx.Attr.SetAttribute (element, "DXText", ASPx.GetInnerText(element));
4261 var oldInnerText = ASPx.GetInnerText(element);
4262 var newInnerText = ContainsFilteringUtils.PrepareElementText(oldInnerText.substr(0, selection.startIndex)) + "<em>" + 
4263      oldInnerText.substr(selection.startIndex, selection.length) + "</em>" + 
4264      ContainsFilteringUtils.PrepareElementText(oldInnerText.substr(selection.startIndex + selection.length));
4265 ASPx.SetInnerHtml(element, newInnerText);
4266}
4267ASPx.ContainsFilteringUtils = ContainsFilteringUtils;
4268ASPx.MakeEqualControlsWidth = function(name1, name2){
4269 var control1 = ASPx.GetControlCollection().Get(name1);
4270 var control2 = ASPx.GetControlCollection().Get(name2);
4271 if(control1 && control2){
4272  var width = Math.max(control1.GetWidth(), control2.GetWidth());
4273  control1.SetWidth(width);
4274  control2.SetWidth(width);
4275 }
4276}
4277var AccessibilityUtils = {
4278 isInitialized: false,
4279 highContrastCssClassMarker: "dxHighContrast",
4280 highContrastThemeActive: false,
4281 accessibleBackgroundCssMarker: ".dx-runtime-background",
4282 createAccessibleBackgrounds: function(control) {
4283  if(!this.highContrastThemeActive || control.accessibleBackgroundsCreated || !control.accessibilityCompliant)
4284   return;
4285  var className = this.accessibleBackgroundCssMarker;
4286  var styleSheetRuleNames = [];
4287  iterateStyleSheetRules(null, function(rule) {
4288   var selectorTxt = rule.selectorText;
4289   if(selectorTxt && selectorTxt.indexOf(className) > -1)
4290    styleSheetRuleNames.push(ASPx.Str.CompleteReplace(selectorTxt, className, "")); 
4291  });
4292  for(var i = 0; i < styleSheetRuleNames.length; i++) {
4293   var name = styleSheetRuleNames[i];
4294   var rule = ASPx.GetStyleSheetRules(name.substring(1));
4295   if(rule && rule.style && rule.style.backgroundImage)
4296    this.createAccessibleBackground(control.GetMainElement(), rule.style, name);
4297  }
4298  control.accessibleBackgroundsCreated = true;
4299 },
4300 createAccessibleBackground: function(container, style, selector) {
4301  if(!container)
4302   return;
4303  var backgroundUrl = style.backgroundImage.substring(5, style.backgroundImage.length - 2);
4304  var elements = container.querySelectorAll(selector);
4305  var accessibleBackgroundClassName = "dx-acc-bi";
4306  for(var i = 0; i < elements.length; i++) {
4307   var element = elements[i];
4308   if(ASPx.ElementHasCssClass(element, accessibleBackgroundClassName))
4309    continue;
4310   var image = null;
4311   if(element.tagName !== "IMG") {
4312    ASPx.AddClassNameToElement(element, accessibleBackgroundClassName);
4313    image = element.ownerDocument.createElement("IMG");
4314    ASPx.SetStyles(image, { width: element.offsetWidth, height: element.offsetHeight });
4315    if(element.firstChild)
4316     element.insertBefore(image, element.firstChild);
4317    else
4318     element.appendChild(image);
4319   } else
4320    image = element;
4321   image.src = backgroundUrl;
4322  }
4323 },
4324 initialize: function() {
4325  if(!this.isInitialized) {
4326   this.isInitialized = true;
4327   this.detectHighContrastTheme();
4328  }   
4329 },
4330 detectHighContrastTheme: function() {
4331  var testElement = document.createElement("DIV");
4332  ASPx.SetStyles(testElement, {
4333   backgroundImage: "url('" + ASPx.EmptyImageUrl + "')",
4334   display: "none"
4335  }, true);
4336  var docElement = document.documentElement;
4337  docElement.appendChild(testElement);
4338  var actualBackgroundImg = ASPx.GetCurrentStyle(testElement).backgroundImage;
4339  docElement.removeChild(testElement);
4340  if(actualBackgroundImg === "none") {
4341   this.highContrastThemeActive = true;
4342   ASPx.AddClassNameToElement(docElement, this.highContrastCssClassMarker);
4343  }
4344 }
4345};
4346ASPx.AccessibilityUtils = AccessibilityUtils;
4347ASPx.EnableCssAnimation = true;
4348var AnimationTransitionBase = ASPx.CreateClass(null, {
4349 constructor: function(element, options) {
4350  if(element) {
4351   AnimationTransitionBase.Cancel(element);
4352   this.element = element;
4353   this.element.aspxTransition = this;
4354  }
4355  this.duration = options.duration || AnimationConstants.Durations.DEFAULT;
4356  this.transition = options.transition || AnimationConstants.Transitions.SINE;
4357  this.property = options.property;
4358  this.unit = options.unit || "";
4359  this.onComplete = options.onComplete;
4360  this.to = null;
4361  this.from = null;
4362 },
4363 Start: function(from, to) {
4364  if(to != undefined) {
4365   this.to = to;
4366   this.from = from;
4367   this.SetValue(this.from);
4368  }
4369  else
4370   this.to = from;
4371 },
4372 Cancel: function() {
4373  if(!this.element)
4374   return;
4375  try {
4376   delete this.element.aspxTransition;
4377  } catch(e) {
4378   this.element.aspxTransition = undefined;
4379  }
4380 },
4381 GetValue: function() {
4382  return this.getValueInternal(this.element, this.property);
4383 },
4384 SetValue: function(value) {
4385  this.setValueInternal(this.element, this.property, this.unit, value);
4386 },
4387 setValueInternal: function(element, property, unit, value) {
4388  if(property == "opacity")
4389   AnimationUtils.setOpacity(element, value);
4390  else
4391   element.style[property] = value + unit;
4392 },
4393 getValueInternal: function(element, property) {
4394  if(property == "opacity")
4395   return ASPx.GetElementOpacity(element);
4396  var value = parseFloat(element.style[property]);
4397  return isNaN(value) ? 0 : value;
4398 },
4399 performOnComplete: function() {
4400  if(this.onComplete)
4401   this.onComplete(this.element);
4402 },
4403 getTransition: function() {
4404  return this.transition;
4405 }
4406});
4407AnimationTransitionBase.Cancel = function(element) {
4408 if(element.aspxTransition)
4409  element.aspxTransition.Cancel();
4410};
4411var AnimationConstants = {};
4412AnimationConstants.Durations = {
4413 SHORT: 200,
4414 DEFAULT: 400,
4415 LONG: 600
4416};
4417AnimationConstants.Transitions = {
4418 LINER: {
4419  Css: "cubic-bezier(0.250, 0.250, 0.750, 0.750)",
4420  Js: function(progress) { return progress; }
4421 },
4422 SINE: {
4423  Css: "cubic-bezier(0.470, 0.000, 0.745, 0.715)",
4424  Js: function(progress) { return Math.sin(progress * 1.57); }
4425 },
4426 POW: {
4427  Css: "cubic-bezier(0.755, 0.050, 0.855, 0.060)",
4428  Js: function(progress) { return Math.pow(progress, 4); }
4429 },
4430 POW_EASE_OUT: {
4431  Css: "cubic-bezier(0.165, 0.840, 0.440, 1.000)",
4432  Js: function(progress) { return 1 - AnimationConstants.Transitions.POW.Js(1 - progress); }
4433 },
4434 RIPPLE: {
4435  Css: "cubic-bezier(0.47, 0.06, 0.23, 0.99)",
4436  Js: function(progress) {
4437   return Math.pow((progress), 3) * 0.47 + 3 * progress * Math.pow((1 - progress), 2) * 0.06 + 3 * Math.pow(progress, 2) *
4438    (1 - progress) * 0.23 + 0.99 * Math.pow(progress, 3);
4439  }
4440 }
4441};
4442var JsAnimationTransition = ASPx.CreateClass(AnimationTransitionBase, {
4443 constructor: function(element, options) {
4444  this.constructor.prototype.constructor.call(this, element, options);
4445  this.onStep = options.onStep;
4446  this.fps = 60;
4447  this.startTime = null;
4448 },
4449 Start: function(from, to) {
4450  if(from == to) {
4451   this.from = this.to = from;
4452   setTimeout(this.complete.aspxBind(this), 0);
4453  }
4454  else {
4455   AnimationTransitionBase.prototype.Start.call(this, from, to);
4456   if(to == undefined)
4457    this.from = this.GetValue();
4458   this.initTimer();
4459  }
4460 },
4461 Cancel: function() {
4462  AnimationTransitionBase.prototype.Cancel.call(this);
4463  if(this.timerId)
4464   clearInterval(this.timerId);
4465 },
4466 initTimer: function() {
4467  this.startTime = new Date();
4468  this.timerId = window.setInterval(function() { this.onTick(); }.aspxBind(this), 1000 / this.fps);
4469 },
4470 onTick: function() {
4471  var progress = (new Date() - this.startTime) / this.duration;
4472  if(progress >= 1)
4473   this.complete();
4474  else {
4475   this.update(progress);
4476   if(this.onStep)
4477    this.onStep();
4478  }
4479 },
4480 update: function(progress) {
4481  this.SetValue(this.gatCalculatedValue(this.from, this.to, progress));
4482 },
4483 complete: function() {
4484  this.Cancel();
4485  this.update(1);
4486  this.performOnComplete();
4487 },
4488 gatCalculatedValue: function(from, to, progress) {
4489  if(progress == 1)
4490   return to;
4491  return from + (to - from) * this.getTransition()(progress);
4492 },
4493 getTransition: function() {
4494  return this.transition.Js;
4495 }
4496});
4497var SimpleAnimationTransition = ASPx.CreateClass(JsAnimationTransition, {
4498 constructor: function(options) {
4499  this.constructor.prototype.constructor.call(this, null, options);
4500  this.transition = options.transition || AnimationConstants.Transitions.POW_EASE_OUT;
4501  this.onUpdate = options.onUpdate;
4502  this.lastValue = 0;
4503 },
4504 SetValue: function(value) {
4505  this.onUpdate(value - this.lastValue);
4506  this.lastValue = value;
4507 },
4508 GetValue: function() {
4509  return this.lastValue;
4510 },
4511 performOnComplete: function() {
4512  if(this.onComplete)
4513   this.onComplete();
4514 }
4515});
4516var MultipleJsAnimationTransition = ASPx.CreateClass(JsAnimationTransition, {
4517 constructor: function(element, options) {
4518  this.constructor.prototype.constructor.call(this, element, options);
4519  this.properties = {};
4520 },
4521 Start: function(properties) {
4522  this.initProperties(properties);
4523  this.initTimer();
4524 },
4525 initProperties: function(properties) {
4526  this.properties = properties;
4527  for(var propName in this.properties)
4528   if(properties[propName].from == undefined)
4529    properties[propName].from = this.getValueInternal(this.element, propName);
4530 },
4531 update: function(progress) {
4532  for(var propName in this.properties) {
4533   var property = this.properties[propName];
4534   if(property.from != property.to)
4535    this.setValueInternal(this.element, propName, property.unit, this.gatCalculatedValue(property.from, property.to, progress));
4536  }
4537 }
4538});
4539var CssAnimationTransition = ASPx.CreateClass(AnimationTransitionBase, {
4540 constructor: function(element, options) {
4541  this.constructor.prototype.constructor.call(this, element, options);
4542  this.transitionPropertyName = AnimationUtils.CurrentTransition.property;
4543  this.eventName = AnimationUtils.CurrentTransition.event;
4544 },
4545 Start: function(from, to) {
4546  AnimationTransitionBase.prototype.Start.call(this, from, to);
4547  this.startTimerId = window.setTimeout(function() {
4548   if(this.from == this.to)
4549    this.onTransitionEnd();
4550   else {
4551    var isHidden = this.element.offsetHeight == 0 && this.element.offsetWidth == 0; 
4552    if(!isHidden)
4553     this.prepareElementBeforeAnimation();
4554    this.SetValue(this.to);
4555    if(isHidden)
4556     this.onTransitionEnd();
4557   }
4558  }.aspxBind(this), 0);
4559 },
4560 Cancel: function() {
4561  window.clearTimeout(this.startTimerId);
4562  AnimationTransitionBase.prototype.Cancel.call(this);
4563  ASPx.Evt.DetachEventFromElement(this.element, this.eventName, CssAnimationTransition.transitionEnd);
4564  this.stopAnimation();
4565  this.setValueInternal(this.element, this.transitionPropertyName, "", "");
4566 },
4567 prepareElementBeforeAnimation: function() {
4568  ASPx.Evt.AttachEventToElement(this.element, this.eventName, CssAnimationTransition.transitionEnd);
4569  var tmpH = this.element.offsetHeight; 
4570  this.element.style[this.transitionPropertyName] = this.getTransitionCssString();
4571  if(ASPx.Browser.Safari && ASPx.Browser.MacOSMobilePlatform && ASPx.Browser.MajorVersion >= 8) 
4572   setTimeout(function() {
4573    if(this.element && this.element.aspxTransition) {
4574     this.element.style[this.transitionPropertyName] = "";
4575     this.element.aspxTransition.onTransitionEnd();
4576    }
4577   }.aspxBind(this), this.duration + 100);
4578 },
4579 stopAnimation: function() {
4580  this.SetValue(ASPx.GetCurrentStyle(this.element)[this.property]);
4581 },
4582 onTransitionEnd: function() {
4583  this.Cancel();
4584  this.performOnComplete();
4585 },
4586 getTransition: function() {
4587  return this.transition.Css;
4588 },
4589 getTransitionCssString: function() {
4590  return this.getTransitionCssStringInternal(this.getCssName(this.property));
4591 },
4592 getTransitionCssStringInternal: function(cssProperty) {
4593  return cssProperty + " " + this.duration + "ms " + this.getTransition();
4594 },
4595 getCssName: function(property) {
4596  switch(property) {
4597   case "marginLeft":
4598    return "margin-left";
4599   case "marginTop":
4600    return "margin-top"
4601  }
4602  return property;
4603 }
4604});
4605var MultipleCssAnimationTransition = ASPx.CreateClass(CssAnimationTransition, {
4606 constructor: function(element, options) {
4607  this.constructor.prototype.constructor.call(this, element, options);
4608  this.properties = null;
4609 },
4610 Start: function(properties) {
4611  this.properties = properties;
4612  this.forEachProperties(function(property, propName) {
4613   if(property.from !== undefined)
4614    this.setValueInternal(this.element, propName, property.unit, property.from);
4615  }.aspxBind(this));
4616  this.prepareElementBeforeAnimation();
4617  this.forEachProperties(function(property, propName) {
4618   this.setValueInternal(this.element, propName, property.unit, property.to);
4619  }.aspxBind(this));
4620 },
4621 stopAnimation: function() {
4622  var style = ASPx.GetCurrentStyle(this.element);
4623  this.forEachProperties(function(property, propName) {
4624   this.setValueInternal(this.element, propName, "", style[propName]);
4625  }.aspxBind(this));
4626 },
4627 getTransitionCssString: function() {
4628  var str = "";
4629  this.forEachProperties(function(property, propName) {
4630   str += this.getTransitionCssStringInternal(this.getCssName(propName)) + ",";
4631  }.aspxBind(this));
4632  str = str.substring(0, str.length - 1);
4633  return str;
4634 },
4635 forEachProperties: function(func) {
4636  for(var propName in this.properties) {
4637   var property = this.properties[propName];
4638   if(property.from == undefined)
4639    property.from = this.getValueInternal(this.element, propName);
4640   if(property.from != property.to)
4641    func(property, propName);
4642  }
4643 }
4644});
4645CssAnimationTransition.transitionEnd = function(evt) {
4646 var element = evt.target;
4647 if(element && element.aspxTransition)
4648  element.aspxTransition.onTransitionEnd();
4649}
4650var AnimationUtils = {
4651 CanUseCssTransition: function() { return ASPx.EnableCssAnimation && this.CurrentTransition },
4652 CanUseCssTransform: function() { return this.CanUseCssTransition() && this.CurrentTransform },
4653 CurrentTransition: (function() {
4654  if(ASPx.Browser.IE) 
4655   return null;
4656  var transitions = [
4657   { property: "webkitTransition", event: "webkitTransitionEnd" },
4658   { property: "MozTransition", event: "transitionend" },
4659   { property: "OTransition", event: "oTransitionEnd" },
4660   { property: "transition", event: "transitionend" }
4661  ]
4662  var fakeElement = document.createElement("DIV");
4663  for(var i = 0; i < transitions.length; i++)
4664   if(transitions[i].property in fakeElement.style)
4665    return transitions[i];
4666 })(),
4667 CurrentTransform: (function() {
4668  var transforms = ["transform", "MozTransform", "-webkit-transform", "msTransform", "OTransform"];
4669  var fakeElement = document.createElement("DIV");
4670  for(var i = 0; i < transforms.length; i++)
4671   if(transforms[i] in fakeElement.style)
4672    return transforms[i];
4673 })(),
4674 SetTransformValue: function(element, position, isTop) {
4675  if(this.CanUseCssTransform())
4676   element.style[this.CurrentTransform] = this.GetTransformCssText(position, isTop);
4677  else
4678   element.style[!isTop ? "left" : "top"] = position + "px";
4679 },
4680 GetTransformValue: function(element, isTop) {
4681  if(this.CanUseCssTransform()) {
4682   var cssValue = element.style[this.CurrentTransform];
4683   return cssValue ? Number(cssValue.replace('matrix(1, 0, 0, 1,', '').replace(')', '').split(',')[!isTop ? 0 : 1]) : 0;
4684  }
4685  else
4686   return !isTop ? element.offsetLeft : element.offsetTop;
4687 },
4688 GetTransformCssText: function(position, isTop) {
4689  return "matrix(1, 0, 0, 1," + (!isTop ? position : 0) + ", " + (!isTop ? 0 : position) + ")";
4690 },
4691 createMultipleAnimationTransition: function (element, options) {
4692  return this.CanUseCssTransition() && !options.onStep ? new MultipleCssAnimationTransition(element, options) : new MultipleJsAnimationTransition(element, options);
4693 },
4694 createSimpleAnimationTransition: function(options) {
4695  return new SimpleAnimationTransition(options);
4696 },
4697 createJsAnimationTransition: function(element, options) {
4698  return new JsAnimationTransition(element, options);
4699 },
4700 createCssAnimationTransition: function(element, options) {
4701  return new CssAnimationTransition(element, options);
4702 },
4703 setOpacity: function(element, value) {
4704  ASPx.SetElementOpacity(element, value);
4705 }
4706};
4707ASPxClientUtils = {};
4708ASPxClientUtils.agent = Browser.UserAgent;
4709ASPxClientUtils.opera = Browser.Opera;
4710ASPxClientUtils.opera9 = Browser.Opera && Browser.MajorVersion == 9;
4711ASPxClientUtils.safari = Browser.Safari;
4712ASPxClientUtils.safari3 = Browser.Safari && Browser.MajorVersion == 3;
4713ASPxClientUtils.safariMacOS = Browser.Safari && Browser.MacOSPlatform;
4714ASPxClientUtils.chrome = Browser.Chrome;
4715ASPxClientUtils.ie = Browser.IE;
4716;
4717ASPxClientUtils.ie7 = Browser.IE && Browser.MajorVersion == 7;
4718ASPxClientUtils.firefox = Browser.Firefox;
4719ASPxClientUtils.firefox3 = Browser.Firefox && Browser.MajorVersion == 3;
4720ASPxClientUtils.mozilla = Browser.Mozilla;
4721ASPxClientUtils.netscape = Browser.Netscape;
4722ASPxClientUtils.browserVersion = Browser.Version;
4723ASPxClientUtils.browserMajorVersion = Browser.MajorVersion;
4724ASPxClientUtils.macOSPlatform = Browser.MacOSPlatform;
4725ASPxClientUtils.windowsPlatform = Browser.WindowsPlatform;
4726ASPxClientUtils.webKitFamily = Browser.WebKitFamily;
4727ASPxClientUtils.netscapeFamily = Browser.NetscapeFamily;
4728ASPxClientUtils.touchUI = Browser.TouchUI;
4729ASPxClientUtils.webKitTouchUI = Browser.WebKitTouchUI;
4730ASPxClientUtils.msTouchUI = Browser.MSTouchUI;
4731ASPxClientUtils.iOSPlatform = Browser.MacOSMobilePlatform;
4732ASPxClientUtils.androidPlatform = Browser.AndroidMobilePlatform;
4733ASPxClientUtils.ArrayInsert = Data.ArrayInsert;
4734ASPxClientUtils.ArrayRemove = Data.ArrayRemove;
4735ASPxClientUtils.ArrayRemoveAt = Data.ArrayRemoveAt;
4736ASPxClientUtils.ArrayClear = Data.ArrayClear;
4737ASPxClientUtils.ArrayIndexOf = Data.ArrayIndexOf;
4738ASPxClientUtils.AttachEventToElement = Evt.AttachEventToElement;
4739ASPxClientUtils.DetachEventFromElement = Evt.DetachEventFromElement;
4740ASPxClientUtils.GetEventSource = Evt.GetEventSource;
4741ASPxClientUtils.GetEventX = Evt.GetEventX;
4742ASPxClientUtils.GetEventY = Evt.GetEventY;
4743ASPxClientUtils.GetKeyCode = Evt.GetKeyCode;
4744ASPxClientUtils.PreventEvent = Evt.PreventEvent;
4745ASPxClientUtils.PreventEventAndBubble = Evt.PreventEventAndBubble;
4746ASPxClientUtils.PreventDragStart = Evt.PreventDragStart;
4747ASPxClientUtils.ClearSelection = Selection.Clear;
4748ASPxClientUtils.IsExists = ASPx.IsExists;
4749ASPxClientUtils.IsFunction = ASPx.IsFunction;
4750ASPxClientUtils.GetAbsoluteX = ASPx.GetAbsoluteX;
4751ASPxClientUtils.GetAbsoluteY = ASPx.GetAbsoluteY;
4752ASPxClientUtils.SetAbsoluteX = ASPx.SetAbsoluteX;
4753ASPxClientUtils.SetAbsoluteY = ASPx.SetAbsoluteY;
4754ASPxClientUtils.GetDocumentScrollTop = ASPx.GetDocumentScrollTop;
4755ASPxClientUtils.GetDocumentScrollLeft = ASPx.GetDocumentScrollLeft;
4756ASPxClientUtils.GetDocumentClientWidth = ASPx.GetDocumentClientWidth;
4757ASPxClientUtils.GetDocumentClientHeight = ASPx.GetDocumentClientHeight;
4758ASPxClientUtils.GetIsParent = ASPx.GetIsParent;
4759ASPxClientUtils.GetParentById = ASPx.GetParentById;
4760ASPxClientUtils.GetParentByTagName = ASPx.GetParentByTagName;
4761ASPxClientUtils.GetParentByClassName = ASPx.GetParentByPartialClassName;
4762ASPxClientUtils.GetChildById = ASPx.GetChildById;
4763ASPxClientUtils.GetChildByTagName = ASPx.GetChildByTagName;
4764ASPxClientUtils.SetCookie = Cookie.SetCookie;
4765ASPxClientUtils.GetCookie = Cookie.GetCookie;
4766ASPxClientUtils.DeleteCookie = Cookie.DelCookie;
4767ASPxClientUtils.GetShortcutCode = ASPx.GetShortcutCode; 
4768ASPxClientUtils.GetShortcutCodeByEvent = ASPx.GetShortcutCodeByEvent;
4769ASPxClientUtils.StringToShortcutCode = ASPx.ParseShortcutString;
4770ASPxClientUtils.Trim = Str.Trim; 
4771ASPxClientUtils.TrimStart = Str.TrimStart;
4772ASPxClientUtils.TrimEnd = Str.TrimEnd;
4773window.ASPxClientUtils = ASPxClientUtils;
4774ASPx.AnimationUtils = AnimationUtils;
4775ASPx.AnimationTransitionBase = AnimationTransitionBase;
4776ASPx.AnimationConstants = AnimationConstants;
4777})();
4778   
4779(function () {
4780ASPx.classesScriptParsed = false;
4781ASPx.documentLoaded = false; 
4782ASPx.CallbackType = {
4783 Data: "d",
4784 Common: "c"
4785};
4786ASPx.callbackState = {
4787 aborted: "aborted",
4788 inTurn: "inTurn",
4789 sent: "sent"
4790};
4791var ASPxClientEvent = ASPx.CreateClass(null, {
4792 constructor: function() {
4793  this.handlerInfoList = [];
4794  this.firingIndex = -1;
4795 },
4796 AddHandler: function(handler, executionContext) {
4797  if(typeof(executionContext) == "undefined")
4798   executionContext = null;
4799  this.RemoveHandler(handler, executionContext);
4800  var handlerInfo = ASPxClientEvent.CreateHandlerInfo(handler, executionContext);
4801  this.handlerInfoList.push(handlerInfo);
4802 },
4803 RemoveHandler: function(handler, executionContext) {
4804  this.removeHandlerByCondition(function(handlerInfo) {
4805   return handlerInfo.handler == handler && 
4806    (!executionContext || handlerInfo.executionContext == executionContext);
4807  });
4808 },
4809 removeHandlerByCondition: function(predicate) {
4810   for(var i = this.handlerInfoList.length - 1; i >= 0; i--) {
4811   var handlerInfo = this.handlerInfoList[i];
4812   if(predicate(handlerInfo)) {
4813    ASPx.Data.ArrayRemoveAt(this.handlerInfoList, i);
4814    if(i <= this.firingIndex)
4815     this.firingIndex--;
4816   }
4817  }
4818 },
4819 removeHandlerByControlName: function(controlName) {
4820  this.removeHandlerByCondition(function(handlerInfo) {
4821   return handlerInfo.executionContext &&  
4822    handlerInfo.executionContext.name === controlName;
4823  });
4824 },
4825 ClearHandlers: function() {
4826  this.handlerInfoList.length = 0;
4827 },
4828 FireEvent: function(obj, args) {
4829  for(this.firingIndex = 0; this.firingIndex < this.handlerInfoList.length; this.firingIndex++) {
4830   var handlerInfo = this.handlerInfoList[this.firingIndex];
4831   handlerInfo.handler.call(handlerInfo.executionContext, obj, args);
4832  }
4833 },
4834 InsertFirstHandler: function(handler, executionContext){
4835  if(typeof(executionContext) == "undefined")
4836   executionContext = null;
4837  var handlerInfo = ASPxClientEvent.CreateHandlerInfo(handler, executionContext);
4838  ASPx.Data.ArrayInsert(this.handlerInfoList, handlerInfo, 0);
4839 },
4840 IsEmpty: function() {
4841  return this.handlerInfoList.length == 0;
4842 }
4843});
4844ASPxClientEvent.CreateHandlerInfo = function(handler, executionContext) {
4845 return {
4846  handler: handler,
4847  executionContext: executionContext
4848 };
4849};
4850var ASPxClientEventArgs = ASPx.CreateClass(null, {
4851 constructor: function() {
4852 }
4853});
4854ASPxClientEventArgs.Empty = new ASPxClientEventArgs();
4855var ASPxClientCancelEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
4856 constructor: function(){
4857  this.constructor.prototype.constructor.call(this);
4858  this.cancel = false;
4859 }
4860});
4861var ASPxClientProcessingModeEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
4862 constructor: function(processOnServer){
4863  this.constructor.prototype.constructor.call(this);
4864  this.processOnServer = processOnServer;
4865 }
4866});
4867var ASPxClientProcessingModeCancelEventArgs = ASPx.CreateClass(ASPxClientProcessingModeEventArgs, {
4868 constructor: function(processOnServer){
4869  this.constructor.prototype.constructor.call(this, processOnServer);
4870  this.cancel = false;
4871 }
4872});
4873var OrderedMap = ASPx.CreateClass(null, {
4874 constructor: function(){
4875  this.entries = {};
4876  this.firstEntry = null;
4877  this.lastEntry = null;
4878 },
4879 add: function(key, element) {
4880  var entry = this.addEntry(key, element);
4881  this.entries[key] = entry;
4882 },
4883 remove: function(key) {
4884  var entry = this.entries[key];
4885  if(entry === undefined)
4886   return;
4887  this.removeEntry(entry);
4888  delete this.entries[key];
4889 },
4890 clear: function() {
4891  this.markAllEntriesAsRemoved();
4892  this.entries = {};
4893  this.firstEntry = null;
4894  this.lastEntry = null;
4895 },
4896 get: function(key) {
4897  var entry = this.entries[key];
4898  return entry ? entry.value : undefined;
4899 },
4900 forEachEntry: function(processFunc, context) {
4901  context = context || this;
4902  for(var entry = this.firstEntry; entry; entry = entry.next) {
4903   if(entry.removed)
4904    continue;
4905   if(processFunc.call(context, entry.key, entry.value))
4906    return;
4907  }
4908 },
4909 addEntry: function(key, element) {
4910  var entry = { key: key, value: element, next: null, prev: null };
4911  if(!this.firstEntry)
4912   this.firstEntry = entry;
4913  else {
4914   entry.prev = this.lastEntry;
4915   this.lastEntry.next = entry;
4916  }
4917  this.lastEntry = entry;
4918  return entry;
4919 },
4920 removeEntry: function(entry) {
4921  if(this.firstEntry == entry)
4922   this.firstEntry = entry.next;
4923  if(this.lastEntry == entry)
4924   this.lastEntry = entry.prev;
4925  if(entry.prev)
4926   entry.prev.next = entry.next;
4927  if(entry.next)
4928   entry.next.prev = entry.prev;
4929  entry.removed = true;
4930 },
4931 markAllEntriesAsRemoved: function() {
4932  for(var entry = this.firstEntry; entry; entry = entry.next)
4933   entry.removed = true;
4934 }
4935});
4936var CollectionBase = ASPx.CreateClass(null, {
4937 constructor: function(){
4938  this.elementsMap = new OrderedMap();
4939  this.isASPxClientCollection = true;
4940 },
4941 Add: function(key, element) {
4942  this.elementsMap.add(key, element);
4943 },
4944 Remove: function(key) {
4945  this.elementsMap.remove(key);
4946 },
4947 Clear: function(){
4948  this.elementsMap.clear();
4949 },
4950 Get: function(key){
4951  return this.elementsMap.get(key);
4952 }
4953});
4954var GarbageCollector = ASPx.CreateClass(null, {
4955 constructor: function() {
4956  this.interval = 5000;
4957  this.intervalID = window.setInterval(function(){ this.CollectObjects(); }.aspxBind(this), this.interval);
4958 },
4959 CollectObjects: function(){
4960  if(ASPx.GetControlCollection().InCallback()) return;
4961  ASPx.GetControlCollectionCollection().RemoveDisposedControls();
4962  if(typeof(ASPx.GetStateController) != "undefined")
4963   ASPx.GetStateController().RemoveDisposedItems();
4964  if(ASPx.TableScrollHelperCollection)
4965   ASPx.TableScrollHelperCollection.RemoveDisposedObjects();
4966  if(ASPx.Ident.scripts.ASPxClientRatingControl)
4967   ASPxClientRatingControl.RemoveDisposedElementUnderCursor();
4968  var postHandler = aspxGetPostHandler();
4969  if(postHandler)
4970   postHandler.RemoveDisposedFormsFromCache();
4971 }
4972});
4973var gcCollector = new GarbageCollector(); 
4974var ControlTree = ASPx.CreateClass(null, {
4975 constructor: function(controlCollection, container) {
4976  this.container = container;
4977  this.domMap = { };
4978  this.rootNode = this.createNode(null, null);
4979  this.createControlTree(controlCollection, container);
4980 },
4981 forEachControl: function(collapseControls, processFunc) {
4982  var observer = _aspxGetDomObserver();
4983  observer.pause(this.container, true);
4984  var documentScrollInfo;
4985  if(collapseControls) {
4986   documentScrollInfo = ASPx.GetOuterScrollPosition(document.body);
4987   this.collapseControls(this.rootNode);
4988  }
4989  var adjustNodes = [], 
4990   autoHeightNodes = [];
4991  var requireReAdjust = this.forEachControlCore(this.rootNode, collapseControls, processFunc, adju
4991stNodes, autoHeightNodes);
4992  if(requireReAdjust)
4993   this.forEachControlsBackward(adjustNodes, collapseControls, processFunc);
4994  else {
4995   for(var i = 0, node; node = autoHeightNodes[i]; i++)
4996    node.control.AdjustAutoHeight();
4997  }
4998  if(collapseControls)
4999   ASPx.RestoreOuterScrollPosition(documentScrollInfo);
5000  observer.resume(this.container, true);
5001 },
5002 forEachControlCore: function(node, collapseControls, processFunc, adjustNodes, autoHeightNodes) {
5003  var requireReAdjust = false,
5004   size, newSize;
5005  if(node.control) {
5006   var checkReadjustment = collapseControls && node.control.IsControlCollapsed() && node.control.CanCauseReadjustment();
5007   if(checkReadjustment)
5008    size = node.control.GetControlPercentMarkerSize(false, true);
5009   if(node.control.IsControlCollapsed() && !node.control.IsExpandableByAdjustment())
5010    node.control.ExpandControl();
5011   node.control.isInsideHierarchyAdjustment = true;
5012   processFunc(node.control);
5013   node.control.isInsideHierarchyAdjustment = false;
5014   if(checkReadjustment) {
5015    newSize = node.control.GetControlPercentMarkerSize(false, true);
5016    requireReAdjust = size.width !== newSize.width;
5017   }
5018   if(node.control.sizingConfig.supportAutoHeight)
5019    autoHeightNodes.push(node);
5020   node.control.ResetControlPercentMarkerSize();
5021  }
5022  for(var childNode, i = 0; childNode = node.children[i]; i++)
5023   requireReAdjust = this.forEachControlCore(childNode, collapseControls, processFunc, adju
5023stNodes, autoHeightNodes) || requireReAdjust;
5024  adjustNodes.push(node);
5025  return requireReAdjust;
5026 },
5027 forEachControlsBackward: function(adjustNodes, collapseControls, processFunc) {
5028  for(var i = 0, node; node = adjustNodes[i]; i++)
5029   this.forEachControlsBackwardCore(node, collapseControls, processFunc);
5030 },
5031 forEachControlsBackwardCore: function(node, collapseControls, processFunc) {
5032  if(node.control)
5033   processFunc(node.control);
5034  if(node.children.length > 1) {
5035   for(var i = 0, childNode; childNode = node.children[i]; i++) {
5036    if(childNode.control)
5037     processFunc(childNode.control);
5038   }
5039  }
5040 },
5041 collapseControls: function(node) {
5042  for(var childNode, i = 0; childNode = node.children[i]; i++)
5043   this.collapseControls(childNode);
5044  if(node.control && node.control.NeedCollapseControl())
5045   node.control.CollapseControl();
5046 },
5047 createControlTree: function(controlCollection, container) {
5048  controlCollection.ProcessControlsInContainer(container, function(control) {
5049   control.RegisterInControlTree(this);
5050  }.aspxBind(this));
5051  var fixedNodes = [];
5052  var fixedNodesChildren = [];
5053  for(var domElementID in this.domMap) {
5054   if(!this.domMap.hasOwnProperty(domElementID)) continue;
5055   var node = this.domMap[domElementID];
5056   var controlOwner = node.control ? node.control.controlOwner : null;
5057   if(controlOwner && this.domMap[controlOwner.name])
5058    continue;
5059   if(this.isFixedNode(node))
5060    fixedNodes.push(node);
5061   else {
5062    var parentNode = this.findParentNode(domElementID);
5063    parentNode = parentNode || this.rootNode;
5064    if(this.isFixedNode(parentNode))
5065     fixedNodesChildren.push(node);
5066    else {
5067     var childNode = node.mainNode || node;
5068     this.addChildNode(parentNode, childNode);
5069    }
5070   }
5071  }
5072  for(var i = fixedNodes.length - 1; i >= 0; i--)
5073   this.insertChildNode(this.rootNode, fixedNodes[i], 0);
5074  for(var i = fixedNodesChildren.length - 1; i >= 0; i--)
5075   this.insertChildNode(this.rootNode, fixedNodesChildren[i], 0);
5076 },
5077 findParentNode: function(id) {
5078  var element = document.getElementById(id).parentNode;
5079  while(element && element.tagName !== "BODY") {
5080   if(element.id) {
5081    var parentNode = this.domMap[element.id];
5082    if(parentNode)
5083     return parentNode;
5084   }
5085   element = element.parentNode;
5086  }
5087  return null;
5088 },
5089 addChildNode: function(node, childNode) {
5090  if(!childNode.parentNode) {
5091   node.children.push(childNode);
5092   childNode.parentNode = node;
5093  }
5094 },
5095 insertChildNode: function(node, childNode, index) {
5096  if(!childNode.parentNode) {
5097   ASPx.Data.ArrayInsert(node.children, childNode, index);
5098   childNode.parentNode = node;
5099  }
5100 },
5101 addRelatedNode: function(node, relatedNode) {
5102  this.addChildNode(node, relatedNode);
5103  relatedNode.mainNode = node;
5104 },
5105 isFixedNode: function(node) {
5106  var control = node.mainNode ? node.mainNode.control : node.control;
5107  return control && control.HasFixedPosition();
5108 },
5109 createNode: function(domElementID, control) {
5110  var node = {
5111   control: control,
5112   children: [],
5113   parentNode: null,
5114   mainNode: null
5115  };
5116  if(domElementID)
5117   this.domMap[domElementID] = node;
5118  return node;
5119 }
5120});
5121function _aspxFunctionIsInCallstack(currentCallee, targetFunction, depthLimit) {
5122 var candidate = currentCallee;
5123 var depth = 0;
5124 while(candidate && depth <= depthLimit) {
5125  candidate = candidate.caller;
5126  if(candidate == targetFunction)
5127   return true;
5128  depth++;
5129 }
5130 return false;
5131}
5132ASPx.Evt.AttachEventToElement(window, "load", aspxClassesWindowOnLoad);
5133function aspxClassesWindowOnLoad(evt){
5134 ASPx.documentLoaded = true;
5135 _aspxSweepDuplicatedLinks();
5136 ResourceManager.SynchronizeResources();
5137 var externalScriptProcessor = GetExternalScriptProcessor();
5138 if(externalScriptProcessor)
5139  externalScriptProcessor.ShowErrorMessages();
5140 ASPx.AccessibilityUtils.initialize();
5141 ASPx.GetControlCollection().Initialize();
5142 _aspxInitializeScripts();
5143 _aspxInitializeLinks();
5144 _aspxInitializeFocus();
5145}
5146Ident = { };
5147Ident.IsDate = function(obj) {
5148 return obj && obj.constructor == Date;
5149};
5150Ident.IsRegExp = function(obj) {
5151 return obj && obj.constructor === RegExp;
5152};
5153Ident.IsArray = function(obj) {
5154 return obj && obj.constructor == Array;
5155};
5156Ident.IsASPxClientCollection = function(obj) {
5157 return obj && obj.isASPxClientCollection;
5158};
5159Ident.IsASPxClientControl = function(obj) {
5160 return obj && obj.isASPxClientControl;
5161};
5162Ident.IsASPxClientEdit = function(obj) {
5163 return obj && obj.isASPxClientEdit;
5164};
5165Ident.IsFocusableElementRegardlessTabIndex = function (element) {
5166 var tagName = element.tagName;
5167 return tagName == "TEXTAREA" || tagName == "INPUT" || tagName == "A" || 
5168  tagName == "SELECT" || tagName == "IFRAME" || tagName == "OBJECT";
5169};
5170Ident.isDialogInvisibleControl = function(control) {
5171 return !!ASPx.Dialog && ASPx.Dialog.isDialogInvisibleControl(control);
5172};
5173Ident.scripts = {};
5174if(ASPx.IsFunction(window.WebForm_InitCallbackAddField)) {
5175 (function() {
5176  var original = window.WebForm_InitCallbackAddField;
5177  window.WebForm_InitCallbackAddField = function(name, value) {
5178   if(typeof(name) == "string" && name)
5179    original.apply(null, arguments);
5180  };
5181 })();
5182}
5183ASPx.FireDefaultButton = function(evt, buttonID) {
5184 if(_aspxIsDefaultButtonEvent(evt, buttonID)) {
5185  var defaultButton = ASPx.GetElementById(buttonID);
5186  if(defaultButton && defaultButton.click) {
5187   if(ASPx.IsFocusable(defaultButton))
5188    defaultButton.focus();
5189   ASPx.Evt.DoElementClick(defaultButton);
5190   ASPx.Evt.PreventEventAndBubble(evt);
5191   return false;
5192  }
5193 }
5194 return true;
5195}
5196function _aspxIsDefaultButtonEvent(evt, defaultButtonID) {
5197 if(evt.keyCode != ASPx.Key.Enter)
5198  return false;
5199 var srcElement = ASPx.Evt.GetEventSource(evt);
5200 if(!srcElement || srcElement.id === defaultButtonID)
5201  return true;
5202 var tagName = srcElement.tagName;
5203 var type = srcElement.type;
5204 return tagName != "TEXTAREA" && tagName != "BUTTON" && tagName != "A" &&
5205  (tagName != "INPUT" || type != "checkbox" && type != "radio" && type != "button" && type != "submit" && type != "reset");
5206}
5207var PostHandler = ASPx.CreateClass(null, {
5208 constructor: function() {
5209  this.Post = new ASPxClientEvent();
5210  this.PostFinalization = new ASPxClientEvent();
5211  this.observableForms = [];
5212  this.dxCallbackTriggers = {};
5213  this.lastSubmitElementName = null;
5214  this.beforeOnSubmit = function() { };
5215  this.ReplaceGlobalPostFunctions();
5216  this.HandleDxCallbackBeginning();
5217  this.HandleMSAjaxRequestBeginning();
5218 },
5219 Update: function() {
5220  this.ReplaceFormsSubmit(true);
5221 },
5222 ProcessPostRequest: function(ownerID, isCallback, isMSAjaxRequest, isDXCallback) {
5223  this.cancelPostProcessing = false;
5224  this.isMSAjaxRequest = isMSAjaxRequest;
5225  if(this.SkipRaiseOnPost(ownerID, isCallback, isDXCallback))
5226   return;
5227  var args = new PostHandlerOnPostEventArgs(ownerID, isCallback, isMSAjaxRequest, isDXCallback);
5228  this.Post.FireEvent(this, args);
5229  this.cancelPostProcessing = args.cancel;
5230  if(!args.cancel)
5231   this.PostFinalization.FireEvent(this, args);
5232 },
5233 SkipRaiseOnPost: function(ownerID, isCallback, isDXCallback) { 
5234  if(!isCallback)
5235   return false;
5236  var dxOwner = isDXCallback && ASPx.GetControlCollection().GetByName(ownerID);
5237  if(dxOwner) {
5238   this.dxCallbackTriggers[dxOwner.uniqueID] = true;
5239   return false;
5240  }
5241  if(this.dxCallbackTriggers[ownerID]) {
5242   this.dxCallbackTriggers[ownerID] = false;
5243   return true;
5244  }
5245  return false;
5246 },
5247 ReplaceGlobalPostFunctions: function() {
5248  if(ASPx.IsFunction(window.__doPostBack))
5249   this.ReplaceDoPostBack();
5250  if(ASPx.IsFunction(window.WebForm_DoCallback))
5251   this.ReplaceDoCallback();
5252  this.ReplaceFormsSubmit();
5253 },
5254 HandleDxCallbackBeginning: function() {
5255  ASPx.GetControlCollection().BeforeInitCallback.AddHandler(function(s, e) {
5256   aspxRaisePostHandlerOnPost(e.callbackOwnerID, true, false, true); 
5257  });
5258 },
5259 HandleMSAjaxRequestBeginning: function() {
5260  if(window.Sys && Sys.WebForms && Sys.WebForms.PageRequestManager && Sys.WebForms.PageRequestManager.getInstance) {
5261   var pageRequestManager = Sys.WebForms.PageRequestManager.getInstance();
5262   if(pageRequestManager != null && Ident.IsArray(pageRequestManager._onSubmitStatements)) {
5263    pageRequestManager._onSubmitStatements.unshift(function() {
5264     var postbackSettings = Sys.WebForms.PageRequestManager.getInstance()._postBackSettings;
5265     var postHandler = aspxGetPostHandler();
5266     aspxRaisePostHandlerOnPost(postbackSettings.asyncTarget, true, true);
5267     return !postHandler.cancelPostProcessing;
5268    });
5269   }
5270  }
5271 },
5272 ReplaceDoPostBack: function() {
5273  var original = __doPostBack;
5274  __doPostBack = function(eventTarget, eventArgument) {
5275   var postHandler = aspxGetPostHandler();
5276   aspxRaisePostHandlerOnPost(eventTarget);
5277   if(postHandler.cancelPostProcessing)
5278    return;
5279   ASPxClientControl.postHandlingLocked = true;
5280   original(eventTarget, eventArgument);
5281   delete ASPxClientControl.postHandlingLocked;
5282  };
5283 },
5284 ReplaceDoCallback: function() {
5285  var original = WebForm_DoCallback;
5286  WebForm_DoCallback = function(eventTarget, eventArgument, eventCallback, context, errorCallback, useAsync) {
5287   var postHandler = aspxGetPostHandler();
5288   aspxRaisePostHandlerOnPost(eventTarget, true);
5289   if(postHandler.cancelPostProcessing)
5290    return;
5291   return original(eventTarget, eventArgument, eventCallback, context, errorCallback, useAsync);
5292  };
5293 },
5294 ReplaceFormsSubmit: function(checkObservableCollection) {
5295  for(var i = 0; i < document.forms.length; i++) { 
5296   var form = document.forms[i];
5297   if(checkObservableCollection && ASPx.Data.ArrayIndexOf(this.observableForms, form) >= 0)
5298    continue;
5299   if(form.submit)
5300    this.ReplaceFormSubmit(form);
5301   this.ReplaceFormOnSumbit(form);
5302   this.observableForms.push(form);
5303  }
5304 },
5305 ReplaceFormSubmit: function(form) {
5306  var originalSubmit = form.submit;
5307  form.submit = function() {
5308   var postHandler = aspxGetPostHandler();
5309   aspxRaisePostHandlerOnPost();
5310   if(postHandler.cancelPostProcessing)
5311    return false;
5312   var callee = arguments.callee;
5313   this.submit = originalSubmit;
5314   var submitResult = this.submit();
5315   this.submit = callee;
5316   return submitResult;
5317  };
5318  form = null;
5319 },
5320 ReplaceFormOnSumbit: function(form) {
5321  var originalSubmit = form.onsubmit;
5322  form.onsubmit = function() {
5323   var postHandler = aspxGetPostHandler();
5324   postHandler.beforeOnSubmit();
5325   if(postHandler.isMSAjaxRequest)
5326    postHandler.isMsAjaxRequest = false;
5327   else
5328    aspxRaisePostHandlerOnPost(postHandler.GetLastSubmitElementName());
5329   if(postHandler.cancelPostProcessing)
5330    return false;
5331   return ASPx.IsFunction(originalSubmit)
5332    ? originalSubmit.apply(this, arguments)
5333    : true;
5334  };
5335  form = null;
5336 },
5337 SetBeforeOnSubmit: function(action) {
5338  this.beforeOnSubmit = action;
5339 },
5340 SetLastSubmitElementName: function(elementName) {
5341  this.lastSubmitElementName = elementName;
5342 },
5343 GetLastSubmitElementName: function() {
5344  return this.lastSubmitElementName;
5345 },
5346 RemoveDisposedFormsFromCache: function(){
5347  for(var i = 0; this.observableForms && i < this.observableForms.length; i++){
5348   var form = this.observableForms[i];
5349   if(!ASPx.IsExistsElement(form)){
5350    ASPx.Data.ArrayRemove(this.observableForms, form);
5351    i--;
5352   }
5353  }
5354 }
5355});
5356function aspxRaisePostHandlerOnPost(ownerID, isCallback, isMSAjaxRequest, isDXCallback) {
5357 if(ASPxClientControl.postHandlingLocked) return;
5358 var postHandler = aspxGetPostHandler();
5359 if(postHandler)
5360  postHandler.ProcessPostRequest(ownerID, isCallback, isMSAjaxRequest, isDXCallback);
5361}
5362var aspxPostHandler;
5363function aspxGetPostHandler() {
5364 if(!aspxPostHandler)
5365  aspxPostHandler = new PostHandler();
5366 return aspxPostHandler;
5367}
5368var PostHandlerOnPostEventArgs = ASPx.CreateClass(ASPxClientCancelEventArgs, {
5369 constructor: function(ownerID, isCallback, isMSAjaxCallback, isDXCallback){
5370  this.constructor.prototype.constructor.call(this);
5371  this.ownerID = ownerID;
5372  this.isCallback = !!isCallback;
5373  this.isDXCallback = !!isDXCallback;
5374  this.isMSAjaxCallback = !!isMSAjaxCallback;
5375 }
5376});
5377var ResourceManager = {
5378 HandlerStr: "DXR.axd?r=",
5379 ResourceHashes: {},
5380 SynchronizeResources: function(method){
5381  if(!method){
5382   method = function(name, resource) { 
5383    this.UpdateInputElements(name, resource); 
5384   }.aspxBind(this);
5385  }
5386  var resources = this.GetResourcesData();
5387  for(var name in resources)
5388   method(name, resources[name]);
5389 },
5390 GetResourcesData: function(){
5391  return {
5392   DXScript: this.GetResourcesElementsString(_aspxGetIncludeScripts(), "src", "DXScript"),
5393   DXCss: this.GetResourcesElementsString(_aspxGetLinks(), "href", "DXCss")
5394  };
5395 },
5396 GetResourcesElementsString: function(elements, urlAttr, id){
5397  if(!this.ResourceHashes[id]) 
5398   this.ResourceHashes[id] = {};
5399  var hash = this.ResourceHashes[id];
5400  for(var i = 0; i < elements.length; i++) {
5401   var resourceUrl = ASPx.Attr.GetAttribute(elements[i], urlAttr);
5402   if(resourceUrl) {
5403    var pos = resourceUrl.indexOf(this.HandlerStr);
5404    if(pos > -1){
5405     var list = resourceUrl.substr(pos + this.HandlerStr.length);
5406     var ampPos = list.lastIndexOf("-");
5407     if(ampPos > -1)
5408      list = list.substr(0, ampPos);
5409     var indexes = list.split(",");
5410     for(var j = 0; j < indexes.length; j++)
5411      hash[indexes[j]] = indexes[j];
5412    }
5413    else
5414     hash[resourceUrl] = resourceUrl;
5415   }
5416  }
5417  var array = [];
5418  for(var key in hash) 
5419   array.push(key);
5420  return array.join(",");
5421 },
5422 UpdateInputElements: function(typeName, list){
5423  for(var i = 0; i < document.forms.length; i++){
5424   var inputElement = document.forms[i][typeName];
5425   if(!inputElement)
5426    inputElement = this.CreateInputElement(document.forms[i], typeName);
5427   inputElement.value = list;
5428  }
5429 },
5430 CreateInputElement: function(form, typeName){
5431  var inputElement = ASPx.CreateHiddenField(typeName, typeName);
5432  form.appendChild(inputElement);
5433  return inputElement;
5434 }
5435};
5436ASPx.includeScriptPrefix = "dxis_";
5437ASPx.startupScriptPrefix = "dxss_";
5438var includeScriptsCache = {};
5439var createdIncludeScripts = [];
5440var appendedScriptsCount = 0;
5441var callbackOwnerNames = [];
5442var scriptsRestartHandlers = { };
5443function _aspxIsKnownIncludeScript(script) {
5444 return !!includeScriptsCache[script.src];
5445}
5446function _aspxCacheIncludeScript(script) {
5447 includeScriptsCache[script.src] = 1;
5448}
5449function _aspxProcessScriptsAndLinks(ownerName, isCallback) {
5450 if(!ASPx.documentLoaded) return; 
5451 _aspxProcessScripts(ownerName, isCallback);
5452 getLinkProcessor().process();
5453 ASPx.ClearCachedCssRules();
5454}
5455function _aspxGetStartupScripts() {
5456 return _aspxGetScriptsCore(ASPx.startupScriptPrefix);
5457}
5458function _aspxGetIncludeScripts() {
5459 return _aspxGetScriptsCore(ASPx.includeScriptPrefix);
5460}
5461function _aspxGetScriptsCore(prefix) {
5462 var result = [];
5463 var scripts = document.getElementsByTagName("SCRIPT");
5464 for(var i = 0; i < scripts.length; i++) {
5465  if(scripts[i].id.indexOf(prefix) == 0)
5466   result.push(scripts[i]);
5467 }
5468 return result;
5469}
5470function _aspxGetLinks() {
5471 var result = [];
5472 var links = document.getElementsByTagName("LINK");;
5473 for(var i = 0; i < links.length; i++) 
5474  result[i] = links[i];
5475 return result;
5476}
5477function _aspxIsLinksLoaded() {
5478 var links = _aspxGetLinks();
5479 for(var i = 0, link; link = links[i]; i++) {
5480  if(link.readyState && link.readyState.toLowerCase() == "loading")
5481    return false;
5482  }
5483 return true;
5484}
5485function _aspxInitializeLinks() {
5486 var links = _aspxGetLinks();
5487 for(var i = 0; i < links.length; i++)
5488  links[i].loaded = true; 
5489}
5490function _aspxInitializeScripts() {
5491 var scripts = _aspxGetIncludeScripts();
5492 for(var i = 0; i < scripts.length; i++)
5493  _aspxCacheIncludeScript(scripts[i]);   
5494 var startupScripts = _aspxGetStartupScripts();
5495 for(var i = 0; i < startupScripts.length; i++)
5496  startupScripts[i].executed = true; 
5497}
5498function _aspxSweepDuplicatedLinks() {
5499 var hash = { };
5500 var links = _aspxGetLinks();
5501 for(var i = 0; i < links.length; i++) {
5502  var href = links[i].href;
5503  if(!href)
5504   continue;
5505  if(hash[href]){
5506   if((ASPx.Browser.IE || !hash[href].loaded) && links[i].loaded) {
5507    ASPx.RemoveElement(hash[href]);
5508    hash[href] = links[i];
5509   }
5510   else
5511    ASPx.RemoveElement(links[i]);
5512  }
5513  else
5514   hash[href] = links[i];
5515 }
5516}
5517function _aspxSweepDuplicatedScripts() {
5518 var hash = { };
5519 var scripts = _aspxGetIncludeScripts();
5520 for(var i = 0; i < scripts.length; i++) {
5521  var src = scripts[i].src;
5522  if(!src) continue;
5523  if(hash[src])
5524   ASPx.RemoveElement(scripts[i]);
5525  else
5526   hash[src] = scripts[i];
5527 }
5528}
5529function _aspxProcessScripts(ownerName, isCallback) {
5530 var scripts = _aspxGetIncludeScripts();
5531 var previousCreatedScript = null;
5532 var firstCreatedScript = null;
5533 for(var i = 0; i < scripts.length; i++) {
5534  var script = scripts[i];
5535  if(script.src == "") continue; 
5536  if(_aspxIsKnownIncludeScript(script))
5537   continue;
5538  var createdScript = document.createElement("script");
5539  createdScript.type = "text/javascript";
5540  createdScript.src = script.src;
5541  createdScript.id = script.id;
5542  function AreScriptsEqual(script1, script2) {
5543   return script1.src == script2.src;
5544  }
5545  if(ASPx.Data.ArrayIndexOf(createdIncludeScripts, createdScript, AreScriptsEqual) >= 0)
5546   continue;
5547  createdIncludeScripts.push(createdScript);
5548  ASPx.RemoveElement(script);
5549  if(ASPx.Browser.IE && ASPx.Browser.Version < 9) {
5550   createdScript.onreadystatechange = new Function("ASPx.OnScriptReadyStateChangedCallback(this, " + isCallback + ");");
5551  } else if(ASPx.Browser.Edge || ASPx.Browser.WebKitFamily || (ASPx.Browser.Firefox && ASPx.Browser.Version >= 4) || ASPx.Browser.IE && ASPx.Browser.Version >= 9) {
5552   createdScript.onload = new Function("ASPx.OnScriptLoadCallback(this, " + isCallback + ");");
5553   if(firstCreatedScript == null)
5554    firstCreatedScript = createdScript;
5555   createdScript.nextCreatedScript = null;
5556   if(previousCreatedScript != null)
5557    previousCreatedScript.nextCreatedScript = createdScript;
5558   previousCreatedScript = createdScript;
5559  } else {
5560   createdScript.onload = new Function("ASPx.OnScriptLoadCallback(this);");
5561   ASPx.AppendScript(createdScript);
5562   _aspxCacheIncludeScript(createdScript);
5563  }
5564 }
5565 if(firstCreatedScript != null) {
5566  ASPx.AppendScript(firstCreatedScript);
5567  _aspxCacheIncludeScript(firstCreatedScript);
5568 }
5569 if(isCallback)
5570  callbackOwnerNames.push(ownerName);
5571 if(createdIncludeScripts.length == 0) {
5572  var newLinks = ASPx.GetNodesByTagName(document.body, "link");
5573  var needProcessLinks = isCallback && newLinks.length > 0;
5574  if(needProcessLinks)
5575   needProcessLinks = getLinkProcessor().addLinks(newLinks);
5576  if(!needProcessLinks)
5577   ASPx.FinalizeScriptProcessing(isCallback);
5578 }
5579}
5580ASPx.FinalizeScriptProcessing = function(isCallback) {
5581 createdIncludeScripts = [];
5582 appendedScriptsCount = 0;
5583 var linkProcessor = getLinkProcessor();
5584 if(linkProcessor.hasLinks())
5585  _aspxSweepDuplicatedLinks();
5586 linkProcessor.reset();
5587 _aspxSweepDuplicatedScripts();
5588 _aspxRunStartupScripts(isCallback);
5589 ResourceManager.SynchronizeResources();
5590}
5591var startupScriptsRunning = false;
5592function _aspxRunStartupScripts(isCallback) {
5593 startupScriptsRunning = true;
5594 try {
5595  _aspxRunStartupScriptsCore();
5596 }
5597 finally {
5598  startupScriptsRunning = false;
5599 }
5600 if(ASPx.documentLoaded) {
5601  ASPx.GetControlCollection().InitializeElements(isCallback);
5602  for(var key in scriptsRestartHandlers)
5603   scriptsRestartHandlers[key]();
5604  _aspxRunEndCallbackScript();
5605 }
5606}
5607function _aspxIsStartupScriptsRunning(isCallback) {
5608 return startupScriptsRunning;
5609}
5610function _aspxRunStartupScriptsCore() {
5611 var scripts = _aspxGetStartupScripts();
5612 var code;
5613 for(var i = 0; i < scripts.length; i++){
5614  if(!scripts[i].executed) {
5615   code = ASPx.GetScriptCode(scripts[i]);
5616   eval(code);
5617   scripts[i].executed = true;
5618  }
5619 }
5620}
5621function _aspxRunEndCallbackScript() {
5622 while(callbackOwnerNames.length > 0) {
5623  var callbackOwnerName = callbackOwnerNames.pop();
5624  var callbackOwner = ASPx.GetControlCollection().Get(callbackOwnerName);
5625  if(callbackOwner)
5626   callbackOwner.DoEndCallback();
5627 }
5628}
5629ASPx.OnScriptReadyStateChangedCallback = function(scriptElement, isCallback) {
5630 if(scriptElement.readyState == "loaded") {
5631  _aspxCacheIncludeScript(scriptElement);
5632  for(var i = 0; i < createdIncludeScripts.length; i++) {
5633   var script = createdIncludeScripts[i];
5634   if(_aspxIsKnownIncludeScript(script)) {
5635    if(!script.executed) {
5636     script.executed = true;
5637     ASPx.AppendScript(script);
5638     appendedScriptsCount++;
5639    }
5640   } else
5641    break;
5642  }
5643  if(createdIncludeScripts.length == appendedScriptsCount)
5644   ASPx.FinalizeScriptProcessing(isCallback);
5645 }
5646}
5647ASPx.OnScriptLoadCallback = function(scriptElement, isCallback) {
5648 appendedScriptsCount++;
5649 if(scriptElement.nextCreatedScript) {
5650  ASPx.AppendScript(scriptElement.nextCreatedScript);
5651  _aspxCacheIncludeScript(scriptElement.nextCreatedScript);
5652 }
5653 if(createdIncludeScripts.length == appendedScriptsCount)
5654  ASPx.FinalizeScriptProcessing(isCallback);
5655}
5656function _aspxAddScriptsRestartHandler(objectName, handler) {
5657 scriptsRestartHandlers[objectName] = handler;
5658}
5659function _aspxMoveLinkElements() {
5660 var head = ASPx.GetNodesByTagName(document, "head")[0];
5661 var bodyLinks = ASPx.GetNodesByTagName(document.body, "link");
5662 if(head && bodyLinks.length > 0){
5663  var headLinks = ASPx.GetNodesByTagName(head, "link");
5664  var dxLinkAnchor = head.firstChild;
5665  for(var i = 0; i < headLinks.length; i++){
5666   if(headLinks[i].href.indexOf(ResourceManager.HandlerStr) > -1)
5667    dxLinkAnchor = headLinks[i].nextSibling;
5668  }
5669  while(bodyLinks.length > 0) 
5670   head.insertBefore(bodyLinks[0], dxLinkAnchor);
5671 }
5672}
5673var LinkProcessor = ASPx.CreateClass(null, {
5674 constructor: function() {
5675  this.loadedLinkCount = 0;
5676  this.linkInfos = [];
5677  this.loadingObservationTimerID = -1;
5678 },
5679 process: function() {
5680  if(this.hasLinks()) {
5681   if(this.isLinkLoadEventSupported())
5682    this.processViaLoadEvent();
5683   else
5684    this.processViaTimer();
5685  }
5686  else
5687   _aspxSweepDuplicatedLinks();
5688  _aspxMoveLinkElements();
5689 },
5690 addLinks: function(links) {
5691  var prevLinkCount = this.linkInfos.length;
5692  for(var i = 0; i < links.length; i++) {
5693   var link = links[i];
5694   if(link.loaded || link.rel != "stylesheet" || link.type != "text/css" || link.href.toLowerCase().indexOf("dxr.axd?r=") == -1)
5695    continue;
5696   var linkInfo = {
5697    link: link,
5698    href: link.href
5699   };
5700   this.linkInfos.push(linkInfo);
5701  }
5702  return prevLinkCount != this.linkInfos.length;
5703 },
5704 hasLinks: function() {
5705  return this.linkInfos.length > 0;
5706 },
5707 reset: function() {
5708  this.linkInfos = [];
5709  this.loadedLinkCount = 0;
5710 },
5711 processViaLoadEvent: function() {
5712  for(var i = 0, linkInfo; linkInfo = this.linkInfos[i]; i++) {
5713   if(ASPx.Browser.IE && ASPx.Browser.Version < 9) {
5714    var that = this;
5715    linkInfo.link.onreadystatechange = function() { that.onLinkReadyStateChanged(this); };
5716   }
5717   else
5718    linkInfo.link.onload = this.onLinkLoad.aspxBind(this);
5719  }
5720 },
5721 isLinkLoadEventSupported: function() {
5722  return !(ASPx.Browser.Chrome && ASPx.Browser.MajorVersion < 19 || ASPx.Browser.Firefox && ASPx.Browser.MajorVersion < 9 ||
5723   ASPx.Browser.Safari && ASPx.Browser.MajorVersion < 6 || ASPx.Browser.AndroidDefaultBrowser && ASPx.Browser.MajorVersion < 4.4);
5724 },
5725 processViaTimer: function() {
5726  if(this.loadingObservationTimerID == -1)
5727   this.onLinksLoadingObserve();
5728 },
5729 onLinksLoadingObserve: function() {
5730  if(this.getIsAllLinksLoaded()) {
5731   this.loadingObservationTimerID = -1;
5732   this.onAllLinksLoad();
5733  }
5734  else
5735   this.loadingObservationTimerID = window.setTimeout(this.onLinksLoadingObserve.aspxBind(this), 100);
5736 },
5737 getIsAllLinksLoaded: function() {
5738  var styleSheets = document.styleSheets;
5739  var loadedLinkHrefs = { };
5740  for(var i = 0; i < styleSheets.length; i++) {
5741   var styleSheet = styleSheets[i];
5742   try {
5743    if(styleSheet.cssRules)
5744     loadedLinkHrefs[styleSheet.href] = 1;
5745   }
5746   catch(ex) { }
5747  }
5748  var loadedLinksCount = 0;
5749  for(var i = 0, linkInfo; linkInfo = this.linkInfos[i]; i++) {
5750   if(loadedLinkHrefs[linkInfo.href])
5751    loadedLinksCount++;
5752  }
5753  return loadedLinksCount == this.linkInfos.length;
5754 },
5755 onAllLinksLoad: function() {
5756  this.reset();
5757  _aspxSweepDuplicatedLinks();
5758  if(createdIncludeScripts.length == 0)
5759   ASPx.FinalizeScriptProcessing(true);
5760 },
5761 onLinkReadyStateChanged: function(linkElement) {
5762  if(linkElement.readyState == "complete")
5763   this.onLinkLoadCore(linkElement);
5764 },
5765 onLinkLoad: function(evt) {
5766  var linkElement = ASPx.Evt.GetEventSource(evt);
5767  this.onLinkLoadCore(linkElement);
5768 },
5769 onLinkLoadCore: function(linkElement) {
5770  if(!this.hasLinkElement(linkElement)) return;
5771  this.loadedLinkCount++;
5772  if(!ASPx.Browser.Firefox && this.loadedLinkCount == this.linkInfos.length || 
5773   ASPx.Browser.Firefox && this.loadedLinkCount == 2 * this.linkInfos.length) {
5774   this.onAllLinksLoad();
5775  }
5776 },
5777 hasLinkElement: function(linkElement) {
5778  for(var i = 0, linkInfo; linkInfo = this.linkInfos[i]; i++) {
5779   if(linkInfo.link == linkElement)
5780    return true;
5781  }
5782  return false;
5783 }
5784});
5785var linkProcessor = null;
5786function getLinkProcessor() {
5787 if(linkProcessor == null)
5788  linkProcessor = new LinkProcessor();
5789 return linkProcessor;
5790}
5791var IFrameHelper = ASPx.CreateClass(null, {
5792 constructor: function(params) {
5793  this.params = params || {};
5794  this.params.src = this.params.src || "";
5795  this.CreateElements();
5796 },
5797 CreateElements: function() {
5798  var elements = IFrameHelper.Create(this.params);
5799  this.containerElement = elements.container;
5800  this.iframeElement = elements.iframe;
5801  this.AttachOnLoadHandler(this, this.iframeElement);
5802  this.SetLoading(true);
5803  if(this.params.onCreate)
5804   this.params.onCreate(this.containerElement, this.iframeElement);
5805 },
5806 AttachOnLoadHandler: function(instance, element) {
5807  ASPx.Evt.AttachEventToElement(element, "load", function() {
5808   instance.OnLoad(element);
5809  });
5810 },
5811 OnLoad: function(element) {
5812  this.SetLoading(false, element);
5813  if(!element.preventCustomOnLoad && this.params.onLoad)
5814   this.params.onLoad();
5815 },
5816 IsLoading: function(element) {
5817  element = element || this.iframeElement;
5818  if(element)
5819   return element.loading;
5820  return false;
5821 },
5822 SetLoading: function(value, element) {
5823  element = element || this.iframeElement;
5824  if(element)
5825   element.loading = value;
5826 },
5827 GetContentUrl: function() {
5828  return this.params.src;
5829 },
5830 SetContentUrl: function(url, preventBrowserCaching) {
5831  if(url) {
5832   this.params.src = url;
5833   if(preventBrowserCaching)
5834    url = IFrameHelper.AddRandomParamToUrl(url);
5835   this.SetLoading(true);
5836   this.iframeElement.src = url;
5837  }
5838 },
5839 RefreshContentUrl: function() {
5840  if(this.IsLoading())
5841   return;
5842  this.SetLoading(true);
5843  var oldContainerElement = this.containerElement;
5844  var oldIframeElement = this.iframeElement;
5845  var postfix = "_del" + Math.floor(Math.random()*100000).toString();
5846  if(this.params.id)
5847   oldIframeElement.id = this.params.id + postfix;
5848  if(this.params.name)
5849   oldIframeElement.name = this.params.name + postfix;
5850  ASPx.SetStyles(oldContainerElement, { height: 0 });
5851  this.CreateElements();
5852  oldIframeElement.preventCustomOnLoad = true;
5853  oldIframeElement.src = ASPx.BlankUrl;
5854  window.setTimeout(function() {
5855   oldContainerElement.parentNode.removeChild(oldContainerElement);
5856  }, 10000); 
5857 }
5858});
5859IFrameHelper.Create = function(params) {
5860 var iframeHtmlStringParts = [ "<iframe frameborder='0'" ];
5861 if(params) {
5862  if(params.id)
5863   iframeHtmlStringParts.push(" id='", params.id, "'");
5864  if(params.name)
5865   iframeHtmlStringParts.push(" name='", params.name, "'");
5866  if(params.title)
5867   iframeHtmlStringParts.push(" title='", params.title, "'");
5868  if(params.scrolling)
5869   iframeHtmlStringParts.push(" scrolling='", params.scrolling, "'");
5870  if(params.src)
5871   iframeHtmlStringParts.push(" src='", params.src, "'");
5872 }
5873 iframeHtmlStringParts.push("></iframe>");
5874 var containerElement = ASPx.CreateHtmlElementFromString("<div style='border-width: 0px; padding: 0px; margin: 0px'></div>");
5875 var iframeElement = ASPx.CreateHtmlElementFromString(iframeHtmlStringParts.join(""));
5876 containerElement.appendChild(iframeElement);
5877 return {
5878  container: containerElement,
5879  iframe: iframeElement
5880 };
5881};
5882IFrameHelper.AddRandomParamToUrl = function(url) {
5883 var prefix = url.indexOf("?") > -1
5884  ? "&"
5885  : "?";
5886 var param = prefix + Math.floor(Math.random()*100000).toString();
5887 var anchorIndex = url.indexOf("#");
5888 return anchorIndex == -1
5889  ? url + param
5890  : url.substr(0, anchorIndex) + param + url.substr(anchorIndex);
5891};
5892IFrameHelper.GetWindow = function(name) {
5893 if(ASPx.Browser.IE)
5894  return window.frames[name].window;
5895 else{
5896  var frameElement = document.getElementById(name);
5897  return (frameElement != null) ? frameElement.contentWindow : null;
5898 }
5899};
5900IFrameHelper.GetDocument = function(name) {
5901 var frameElement;
5902 if(ASPx.Browser.IE) {
5903  frameElement = window.frames[name];
5904  return (frameElement != null) ? frameElement.document : null;
5905 }
5906 else {
5907  frameElement = document.getElementById(name);
5908  return (frameElement != null) ? frameElement.contentDocument : null;
5909 }
5910};
5911IFrameHelper.GetDocumentBody = function(name) {
5912 var doc = IFrameHelper.GetDocument(name);
5913 return (doc != null) ? doc.body : null;
5914};
5915IFrameHelper.GetDocumentHead = function (name) {
5916 var doc = IFrameHelper.GetDocument(name);
5917 return (doc != null) ? doc.head || doc.getElementsByTagName('head')[0] : null;
5918};
5919IFrameHelper.GetElement = function(name) {
5920 if(ASPx.Browser.IE)
5921  return window.frames[name].window.frameElement;
5922 else
5923  return document.getElementById(name);
5924};
5925var KbdHelper = ASPx.CreateClass(null, {
5926 constructor: function(control) {
5927  this.control = control;
5928 },
5929 Init: function() {
5930  KbdHelper.GlobalInit();
5931  var elements = this.getFocusableElements();
5932  for(var i = 0; i < elements.length; i++) {
5933   var element = elements[i];
5934   element.tabIndex = Math.max(element.tabIndex, 0);
5935   var instance = this;
5936   ASPx.Evt.AttachEventToElement(element, "click", function(e) {
5937    instance.HandleClick(e);
5938   });  
5939   ASPx.Evt.AttachEventToElement(element, "focus", function(e) {    
5940    if(!instance.CanFocus(e))
5941     return true;
5942    KbdHelper.active = instance;
5943   });
5944   ASPx.Evt.AttachEventToElement(element, "blur", function () {
5945    instance.onBlur();
5946   }); 
5947  }   
5948 },
5949 getFocusableElements: function() {
5950  return [this.GetFocusableElement()]; 
5951 },
5952 GetFocusableElement: function() { return this.control.GetMainElement(); },
5953 canHandleNoFocusAction: function() { 
5954  var focusableElements = this.getFocusableElements();
5955  for(var i = 0; i < focusableElements.length; i++) {
5956   if(focusableElements[i] === _aspxGetFocusedElement())
5957    return false;
5958  }
5959  return true;
5960 },
5961 CanFocus: function(e) {
5962  var tag = ASPx.Evt.GetEventSource(e).tagName;
5963  if(tag == "A" || tag == "TEXTAREA" || tag == "INPUT" || tag == "SELECT" || tag == "IFRAME" || tag == "OBJECT")
5964   return false; 
5965  return true;
5966 },
5967 HandleClick: function(e) {
5968  if(!this.CanFocus(e))
5969   return;
5970  this.Focus();
5971 },
5972 Focus: function() {
5973  try {
5974   this.GetFocusableElement().focus();   
5975  } catch(e) {
5976  }
5977 },
5978 onBlur: function(){
5979  delete KbdHelper.active;
5980 },
5981 HandleKeyDown: function(e) { }, 
5982 HandleKeyPress: function(e) { }, 
5983 HandleKeyUp: function (e) { },
5984 HandleNoFocusAction: function(e) { },
5985 FocusByAccessKey: function () { }
5986});
5987KbdHelper.GlobalInit = function() {
5988 if(KbdHelper.ready)
5989  return;
5990 ASPx.Evt.AttachEventToDocument("keydown", KbdHelper.OnKeyDown);
5991 ASPx.Evt.AttachEventToDocument("keypress", KbdHelper.OnKeyPress);
5992 ASPx.Evt.AttachEventToDocument("keyup", KbdHelper.OnKeyUp);
5993 KbdHelper.ready = true; 
5994};
5995KbdHelper.swallowKey = false;
5996KbdHelper.accessKeys = { };
5997KbdHelper.ProcessKey = function(e, actionName) {
5998 if(!KbdHelper.active) 
5999  return;
6000 if (KbdHelper.active.canHandleNoFocusAction()) {
6001  KbdHelper.active["HandleNoFocusAction"](e, actionName);
6002  return;
6003 }
6004 var ctl = KbdHelper.active.control;
6005 if(ctl !== ASPx.GetControlCollection().Get(ctl.name)) {
6006  delete KbdHelper.active;
6007  return;
6008 }
6009 if(!KbdHelper.swallowKey) 
6010  KbdHelper.swallowKey = KbdHelper.active[actionName](e);
6011 if(KbdHelper.swallowKey)
6012  ASPx.Evt.PreventEvent(e);
6013};
6014KbdHelper.OnKeyDown = function(e) {
6015 KbdHelper.swallowKey = false;
6016 if(KbdHelper.TryAccessKey(KbdHelper.getKeyName(e)))
6017  ASPx.Evt.PreventEvent(e);
6018 else 
6019  KbdHelper.ProcessKey(e, "HandleKeyDown"); 
6020};
6021KbdHelper.OnKeyPress = function(e) { KbdHelper.ProcessKey(e, "HandleKeyPress"); };
6022KbdHelper.OnKeyUp = function(e) { KbdHelper.ProcessKey(e, "HandleKeyUp"); };
6023KbdHelper.RegisterAccessKey = function(obj) {
6024 if(obj.accessKey)
6025  var key = "CtrlShift" + obj.accessKey;
6026 else if(obj.keyTipModeShortcut)
6027  var key = obj.keyTipModeShortcut;
6028 if(!key) return;
6029 KbdHelper.accessKeys[key.toLowerCase()] = obj.name;
6030};
6031KbdHelper.TryAccessKey = function(code) {
6032 var key = code.toLowerCase ? code.toLowerCase() : String.fromCharCode(code).toLowerCase();
6033 var name = KbdHelper.accessKeys[key];
6034 if(!name) return false;
6035 var obj = ASPx.GetControlCollection().Get(name);
6036 return KbdHelper.ClickAccessKey(obj);
6037};
6038KbdHelper.ClickAccessKey = function (control) {
6039 if (!control) return false;
6040 var el = control.GetMainElement();
6041 if (!el) return false;
6042 el.focus();
6043 setTimeout(function () {
6044  if (KbdHelper.active && KbdHelper.active.FocusByAccessKey)
6045   KbdHelper.active.FocusByAccessKey();
6046 }.aspxBind(this), 100);
6047 return true;
6048};
6049KbdHelper.getKeyName = function(e) {
6050 var name = "";
6051 if(e.altKey)
6052  name += "Alt";
6053 if(e.ctrlKey)
6054  name += "Ctrl";
6055 if(e.shiftKey)
6056  name += "Shift";
6057 var keyCode = e.key || e.code || String.fromCharCode(ASPx.Evt.GetKeyCode(e));
6058 if(keyCode.match(/key/i))
6059  name += keyCode.replace(/key/i, "");
6060 else if(keyCode.match(/digit/i))
6061  name += keyCode.replace(/digit/i, "");
6062 else if(keyCode.match(/arrow/i))
6063  name += keyCode.replace(/arrow/i, "");
6064 else if(keyCode.match(/ins/i))
6065  name += "Ins"
6066 else if(keyCode.match(/del/i))
6067  name += "Del"
6068 else if(keyCode.match(/back/i))
6069  name += "Back"
6070 else if(!keyCode.match(/alt/i) && !keyCode.match(/control/i) && !keyCode.match(/shift/i))
6071  name += keyCode;
6072 return name.replace(/^a-zA-Z0-9/, "");
6073};
6074AccessKeysHelper = ASPx.CreateClass(KbdHelper, {
6075 constructor: function (control) {
6076  this.constructor.prototype.constructor.call(this, control);
6077  this.accessKeysVisible = false;
6078  this.activeKey = null;
6079  this.accessKey = new AccessKey(control.accessKey);
6080  this.accessKeys = this.accessKey.accessKeys;
6081  this.charIndex = 0;
6082  this.onFocusByAccessKey = null;
6083  this.onClose = null;
6084  this.manualStopProcessing = false;
6085  this.isActive = false;
6086 },
6087 Init: function (control) {
6088  KbdHelper.prototype.Init.call(this);
6089  KbdHelper.RegisterAccessKey(control);   
6090 },
6091 Add: function (accessKey) {
6092  this.accessKey.Add(accessKey);
6093 },
6094 HandleKeyDown: function (e) {
6095  var control = this.control;
6096  var keyCode = ASPx.Evt.GetKeyCode(e);
6097  var restoreFocus = false;
6098  var stopProcessing = this.processKeyDown(keyCode);
6099  if (stopProcessing.value) {
6100   this.stopProcessing();
6101   if(this.onClosedOnEscape && (keyCode == ASPx.Key.Esc || stopProcessing.fireEvent))
6102    this.onClosedOnEscape();
6103  }
6104  return stopProcessing;
6105 },
6106 HandleNoFocusAction: function (e, actionName) {
6107  var keyCode = ASPx.Evt.GetKeyCode(e);
6108  if (this.onClosedOnEscape && keyCode == ASPx.Key.Esc && actionName == "HandleKeyDown")
6109   this.onClosedOnEscape();
6110 },
6111 Activate: function () {
6112  KbdHelper.ClickAccessKey(this.control);
6113 },
6114 Stop: function() {
6115  this.stopProcessing();
6116 },
6117 stopProcessing: function () {
6118  this.HideAccessKeys();
6119  if (KbdHelper.active && this.isActive) {
6120   this.isActive = false;
6121   KbdHelper.active.control.GetMainElement().blur();
6122   delete KbdHelper.active;
6123  }
6124 },
6125 onBlur: function () {
6126  if (this.manualStopProcessing) {
6127   this.manualStopProcessing = false;
6128   return;
6129  }
6130  this.HideAccessKeys();
6131  KbdHelper.prototype.onBlur.call(this);
6132 },
6133 processKeyDown: function (keyCode) {
6134  switch (keyCode) {
6135   case ASPx.Key.Left:
6136    this.TryMoveFocusLeft();
6137    return { value: false };
6138   case ASPx.Key.Right:
6139    this.TryMoveFocusRight();
6140    return { value: false };
6141   case ASPx.Key.Esc:
6142    if(this.control.hideAllPopups)
6143     this.control.hideAllPopups(true, true);
6144    if(this.activeKey)
6145     this.activeKey = this.activeKey.Return();
6146    this.charIndex = 0;
6147    if (!this.activeKey)
6148     return { value: true };
6149    break;
6150   case ASPx.Key.Enter:
6151    return { value: true };
6152   default:
6153    var char = String.fromCharCode(keyCode).toUpperCase();
6154    var needToContinue = { value: false };
6155    if(this.activeKey)
6156     var keyResult = this.activeKey.TryAccessKey(char, this.charIndex, needToContinue);
6157    if (needToContinue.value) {
6158     this.charIndex++;
6159     return { value: false };;
6160    }
6161    this.charIndex = 0;
6162    if(keyResult !== undefined)
6163     this.activeKey = keyResult;
6164    else
6165     return { value: true, fireEvent: true };
6166    if (!this.activeKey || !this.activeKey.accessKeys || this.activeKey.accessKeys.length == 0) {
6167     if (this.activeKey && this.activeKey.manualStopProcessing) {
6168      this.manualStopProcessing = true;
6169      break;
6170     }
6171     return { value: true, fireEvent: true };
6172    }
6173  }
6174  return { value: false };
6175 },
6176 TryMoveFocusLeft: function (modifier) {},
6177 TryMoveFocusRight: function (modifier) {},
6178 TryMoveFocusUp: function (modifier) {},
6179 TryMoveFocusDown: function (modifier) {},
6180 FocusByAccessKey: function () {
6181  if (this.onFocusByAccessKey)
6182   this.onFocusByAccessKey();
6183  this.HideAccessKeys();
6184  KbdHelper.prototype.FocusByAccessKey.call(this);
6185  this.activeKey = this.accessKey;
6186  this.activeKey.execute();
6187  this.isActive = true;
6188 },
6189 HideAccessKeys: function(){
6190  this.hideAccessKeys(this.accessKey);
6191 }, 
6192 hideAccessKeys: function (accessKey) {
6193  for (var i = 0, ak; ak = accessKey.accessKeys[i]; i++) {
6194   this.hideAccessKeys(ak);
6195  }
6196  if (accessKey)
6197   accessKey.hide();
6198 },
6199 HandleClick: function(e) {
6200  KbdHelper.prototype.HandleClick.call(this, e);
6201  this.stopProcessing();
6202 }
6203});
6204AccessKey = ASPx.CreateClass(null, {
6205 constructor: function (popupItem, getPopupElement, keyTipElement, key, onlyClick, manualStopProcessing) {
6206  this.key = key ? key : keyTipElement ? ASPxClientUtils.Trim(ASPx.GetInnerText(keyTipElement)) : null;
6207  this.popupItem = popupItem;
6208  this.getPopupElement = getPopupElement;
6209  this.keyTipElement = keyTipElement;
6210  this.accessKeys = [];
6211  this.needShowChilds = true;
6212  this.parent = null;
6213  this.onlyClick = onlyClick;
6214  this.manualStopProcessing = manualStopProcessing;
6215 },
6216 Add: function (accessKey) {
6217  this.accessKeys.push(accessKey);
6218  accessKey.parent = this;
6219 },
6220 TryAccessKey: function (char, index, needToContinue) {
6221  if (!this.accessKeys || this.accessKeys.length == 0)
6222   return;
6223  for (var i = 0, accessKey; accessKey = this.accessKeys[i]; i++) {
6224   if (accessKey.key[index] == char && accessKey.isVisible()) {
6225    if (accessKey.key[index + 1]) {
6226     needToContinue.value = true;
6227    }
6228    else {
6229     accessKey.execute();
6230     return accessKey;
6231    }
6232   } else {
6233    accessKey.hide();
6234   }
6235  }
6236  for (var i = 0, accessKey; accessKey = this.accessKeys[i]; i++) {
6237   var key = accessKey.TryAccessKey(char, index, needToContinue);
6238   if (key)
6239    return key;
6240  }
6241  return;
6242 },
6243 isVisible: function(){
6244  return ASPx.GetElementVisibility(this.keyTipElement);
6245 },
6246 Return: function () {
6247  this.hideChildAccessKeys();
6248  if (this.parent) {
6249   this.parent.showAccessKeys(true);
6250  }  
6251  return this.parent;
6252 },
6253 execute: function () {
6254  this.hideAll();
6255  if (this.popupItem && this.popupItem.accessKeyClick && !this.onlyClick)
6256   this.popupItem.accessKeyClick();
6257  if (this.getPopupElement && this.onlyClick)
6258   ASPx.Evt.EmulateMouseClick(this.getPopupElement());
6259  if (this.accessKeys)
6260   setTimeout(function () {
6261    this.showAccessKeys(true);
6262   }.aspxBind(this), 100);
6263 },
6264 showAccessKeys: function (directShow) {
6265  if (!directShow && !this.needShowChilds)
6266   return;
6267  for (var i = 0; i < this.accessKeys.length; i++) {
6268   var accessKey = this.accessKeys[i];
6269   if (accessKey) {
6270    var popupElement = accessKey.getPopupElement ? accessKey.getPopupElement() : null;
6271    if (popupElement && ASPx.IsElementVisible(popupElement, true)) {
6272     this.show(accessKey);
6273    }
6274    accessKey.showAccessKeys();
6275   }
6276  }
6277 },
6278 show: function (accessKey) {
6279  var keyTipElement = accessKey.keyTipElement;
6280  var popupElement = accessKey.getPopupElement();
6281  var top = ASPx.GetAbsolutePositionY(popupElement);
6282  var left = ASPx.GetAbsolutePositionX(popupElement);
6283  if (accessKey.popupItem.getAccessKeyPosition)
6284   switch (accessKey.popupItem.getAccessKeyPosition()) {
6285    case "AboveRight":
6286     left = left + popupElement.offsetWidth - keyTipElement.offsetWidth / 3;
6287     top = top - keyTipElement.offsetHeight / 2;
6288     break;
6289    case "Right":
6290     left = left + popupElement.offsetWidth - keyTipElement.offsetWidth / 3;
6291     top = top + popupElement.offsetHeight / 2 - keyTipElement.offsetHeight / 2;
6292     break;
6293    case "BelowRight":
6294     left = left + popupElement.offsetWidth - keyTipElement.offsetWidth / 3;
6295     top = top + keyTipElement.offsetHeight / 2;
6296     break;
6297    default:
6298     top = top + popupElement.offsetHeight;
6299     left = left + popupElement.offsetWidth / 2 - keyTipElement.offsetWidth / 2;
6300     break;
6301   }
6302  else {
6303   top = top + popupElement.offsetHeight;
6304   left = left + popupElement.offsetWidth / 2 - keyTipElement.offsetWidth / 2;
6305  }
6306  ASPx.SetAbsoluteY(keyTipElement, top);
6307  ASPx.SetAbsoluteX(keyTipElement, left);
6308  ASPx.SetElementVisibility(keyTipElement, true); 
6309 },
6310 hide: function () {
6311  if (this.keyTipElement)
6312   ASPx.SetElementVisibility(this.keyTipElement, false);
6313 },
6314 hideChildAccessKeys: function () {
6315  this.hideAccessKeys(this.accessKeys);
6316 },
6317 hideAccessKeys: function (accessKeys) {
6318  if (accessKeys) {
6319   for (var i = 0, accessKey; accessKey = accessKeys[i]; i++) {
6320    if (accessKey.keyTipElement)
6321     accessKey.hide();
6322    accessKey.hideChildAccessKeys();
6323   }
6324  }
6325 },
6326 hideAll: function () {
6327  this.getRoot(this).hideChildAccessKeys();
6328 },
6329 getRoot: function (accessKey) {
6330  if (!accessKey.parent)
6331   return accessKey;
6332  return this.getRoot(accessKey.parent);
6333 }
6334});
6335var focusedElement = null;
6336function aspxOnElementFocused(evt) {
6337 evt = ASPx.Evt.GetEvent(evt);
6338 if(evt && evt.target)
6339  focusedElement = evt.target;
6340}
6341function _aspxInitializeFocus() {
6342 if(!ASPx.GetActiveElement())
6343  ASPx.Evt.AttachEventToDocument("focus", aspxOnElementFocused);
6344}
6345function _aspxGetFocusedElement() {
6346 var activeElement = ASPx.GetActiveElement();
6347 return activeElement ? activeElement : focusedElement;
6348}
6349CheckBoxCheckState = {
6350 Checked : "Checked",
6351 Unchecked : "Unchecked",
6352 Indeterminate : "Indeterminate"
6353};
6354CheckBoxInputKey = { 
6355 Checked : "C",
6356 Unchecked : "U",
6357 Indeterminate : "I"
6358};
6359var CheckableElementStateController = ASPx.CreateClass(null, {
6360 constructor: function(imageProperties) {
6361  this.checkBoxStates = [];
6362  this.imageProperties = imageProperties;
6363 },
6364 GetValueByInputKey: function(inputKey) {
6365  return this.GetFirstValueBySecondValue("Value", "StateInputKey", inputKey);
6366 },
6367 GetInputKeyByValue: function(value) {
6368  return this.GetFirstValueBySecondValue("StateInputKey", "Value", value);
6369 },
6370 GetImagePropertiesNumByInputKey: function(value) {
6371  return this.GetFirstValueBySecondValue("ImagePropertiesNumber", "StateInputKey", value);
6372 },
6373 GetNextCheckBoxValue: function(currentValue, allowGrayed) {
6374  var currentInputKey = this.GetInputKeyByValue(currentValue);
6375  var nextInputKey = '';
6376  switch(currentInputKey) {
6377   case CheckBoxInputKey.Checked:
6378    nextInputKey = CheckBoxInputKey.Unchecked; break;
6379   case CheckBoxInputKey.Unchecked:
6380    nextInputKey = allowGrayed ? CheckBoxInputKey.Indeterminate : CheckBoxInputKey.Checked; break;
6381   case CheckBoxInputKey.Indeterminate:
6382    nextInputKey = CheckBoxInputKey.Checked; break;
6383  }
6384  return this.GetValueByInputKey(nextInputKey);
6385 },
6386 GetCheckStateByInputKey: function(inputKey) {
6387  switch(inputKey) {
6388   case CheckBoxInputKey.Checked: 
6389    return CheckBoxCheckState.Checked;
6390   case CheckBoxInputKey.Unchecked: 
6391    return CheckBoxCheckState.Unchecked;
6392   case CheckBoxInputKey.Indeterminate: 
6393    return CheckBoxCheckState.Indeterminate;
6394  }
6395 },
6396 GetValueByCheckState: function(checkState) {
6397  switch(checkState) {
6398   case CheckBoxCheckState.Checked: 
6399    return this.GetValueByInputKey(CheckBoxInputKey.Checked);
6400   case CheckBoxCheckState.Unchecked: 
6401    return this.GetValueByInputKey(CheckBoxInputKey.Unchecked);
6402   case CheckBoxCheckState.Indeterminate: 
6403    return this.GetValueByInputKey(CheckBoxInputKey.Indeterminate);
6404  }
6405 },
6406 GetFirstValueBySecondValue: function(firstValueName, secondValueName, secondValue) {
6407  return this.GetValueByFunc(firstValueName, 
6408   function(checkBoxState) { return checkBoxState[secondValueName] === secondValue; });
6409 },
6410 GetValueByFunc: function(valueName, func) {
6411  for(var i = 0; i < this.checkBoxStates.length; i++) {
6412   if(func(this.checkBoxStates[i]))
6413    return this.checkBoxStates[i][valueName];
6414  }  
6415 },
6416 AssignElementClassName: function(element, cssClassPropertyKey, disabledCssClassPropertyKey, assignedClassName) {
6417  var classNames = [ ];
6418  for(var i = 0; i < this.imageProperties[cssClassPropertyKey].length; i++) {
6419   classNames.push(this.imageProperties[disabledCssClassPropertyKey][i]);
6420   classNames.push(this.imageProperties[cssClassPropertyKey][i]);
6421  }
6422  var elementClassName = element.className;
6423  for(var i = 0; i < classNames.length; i++) {
6424   var className = classNames[i];
6425   var index = elementClassName.indexOf(className);
6426   if(index > -1)
6427    elementClassName = elementClassName.replace((index == 0 ? '' : ' ') + className, "");
6428  }
6429  elementClassName += " " + assignedClassName;
6430  element.className = elementClassName;
6431 },
6432 UpdateInternalCheckBoxDecoration: function(mainElement, inputKey, enabled) {
6433  var imagePropertiesNumber = this.GetImagePropertiesNumByInputKey(inputKey);
6434  for(var imagePropertyKey in this.imageProperties) {
6435   var propertyValue = this.imageProperties[imagePropertyKey][imagePropertiesNumber];
6436   propertyValue = propertyValue || !isNaN(propertyValue) ? propertyValue : "";
6437   switch(imagePropertyKey) {
6438    case "0" : mainElement.title = propertyValue; break;
6439    case "1" : mainElement.style.width = propertyValue + (propertyValue != "" ? "px" : ""); break;
6440    case "2" : mainElement.style.height = propertyValue + (propertyValue != "" ? "px" : ""); break;
6441   }
6442   if(enabled) {
6443    switch(imagePropertyKey) {
6444     case "3" : this.SetImageSrc(mainElement, propertyValue); break;
6445     case "4" : 
6446      this.AssignElementClassName(mainElement, "4", "8", propertyValue);
6447      break;
6448     case "5" : this.SetBackgroundPosition(mainElement, propertyValue, true); break;
6449     case "6" : this.SetBackgroundPosition(mainElement, propertyValue, false); break;
6450    }
6451   } else {
6452     switch(imagePropertyKey) {
6453     case "7" : this.SetImageSrc(mainElement, propertyValue); break;
6454     case "8" : 
6455      this.AssignElementClassName(mainElement, "4", "8", propertyValue);
6456      break;
6457     case "9" : this.SetBackgroundPosition(mainElement, propertyValue, true); break;
6458     case "10" : this.SetBackgroundPosition(mainElement, propertyValue, false); break;
6459    }
6460   }
6461  }
6462 },
6463 SetImageSrc: function(mainElement, src) {
6464  if(src === ""){
6465   mainElement.style.backgroundImage = "";
6466   mainElement.style.backgroundPosition = "";
6467  }
6468  else{
6469   mainElement.style.backgroundImage = "url('" + src + "')";
6470   this.SetBackgroundPosition(mainElement, 0, true);
6471   this.SetBackgroundPosition(mainElement, 0, false);
6472  }
6473 },
6474 SetBackgroundPosition: function(element, value, isX) {
6475  if(value === "") {
6476   element.style.backgroundPosition = value;
6477   return;
6478  }
6479  if(element.style.backgroundPosition === "")
6480   element.style.backgroundPosition = isX ? "-" + value.toString() + "px 0px" : "0px -" + value.toString() + "px";
6481  else {
6482   var position = element.style.backgroundPosition.split(' ');
6483   element.style.backgroundPosition = isX ? '-' + value.toString() + "px " + position[1] :  position[0] + " -" + value.toString() + "px";
6484  }
6485 },
6486 AddState: function(value, stateInputKey, imagePropertiesNumber) {
6487  this.checkBoxStates.push({
6488   "Value" : value, 
6489   "StateInputKey" : stateInputKey, 
6490   "ImagePropertiesNumber" : imagePropertiesNumber
6491  });
6492 },
6493 GetAriaCheckedValue: function(state) {
6494  switch(state) {
6495   case ASPx.CheckBoxCheckState.Checked: return "true";
6496   case ASPx.CheckBoxCheckState.Unchecked: return "false";
6497   case ASPx.CheckBoxCheckState.Indeterminate: return "mixed";
6498   default: return "";
6499  }
6500 }
6501});
6502CheckableElementStateController.Create = function(imageProperties, valueChecked, valueUnchecked, valueGrayed, allowGrayed) {
6503 var stateController = new CheckableElementStateController(imageProperties);
6504 stateController.AddState(valueChecked, CheckBoxInputKey.Checked, 0);
6505 stateController.AddState(valueUnchecked, CheckBoxInputKey.Unchecked, 1);
6506 if(typeof(valueGrayed) != "undefined")
6507  stateController.AddState(valueGrayed, CheckBoxInputKey.Indeterminate, allowGrayed ? 2 : 1);
6508 stateController.allowGrayed = allowGrayed;
6509 return stateController;
6510};
6511var CheckableElementHelper = ASPx.CreateClass(null, {
6512 InternalCheckBoxInitialize: function(internalCheckBox) {
6513  this.AttachToMainElement(internalCheckBox);
6514  this.AttachToInputElement(internalCheckBox);
6515 },
6516 AttachToMainElement: function(internalCheckBox) {
6517  var instance = this;
6518  if(internalCheckBox.mainElement) {
6519    ASPx.Evt.AttachEventToElement(internalCheckBox.mainElement, "click",
6520    function (evt) { 
6521     instance.InvokeClick(internalCheckBox, evt);
6522     if(!internalCheckBox.disableCancelBubble)
6523      return ASPx.Evt.PreventEventAndBubble(evt);
6524    }
6525   );
6526   ASPx.Evt.AttachEventToElement(internalCheckBox.mainElement, "mousedown",
6527    function (evt) {
6528     internalCheckBox.Refocus();
6529    }
6530   );
6531   ASPx.Evt.PreventElementDragAndSelect(internalCheckBox.mainElement, true);
6532  }
6533 },
6534 AttachToInputElement: function(internalCheckBox) {
6535  var instance = this;
6536  if(internalCheckBox.inputElement && internalCheckBox.mainElement) {
6537   var checkableElement = internalCheckBox.accessibilityCompliant ? internalCheckBox.mainElement : internalCheckBox.inputElement;
6538   ASPx.Evt.AttachEventToElement(checkableElement, "focus",
6539    function (evt) { 
6540     if(!internalCheckBox.enabled)
6541      checkableElement.blur();
6542     else
6543      internalCheckBox.OnFocus();
6544    }
6545   );
6546   ASPx.Evt.AttachEventToElement(checkableElement, "blur", 
6547    function (evt) { 
6548     internalCheckBox.OnLostFocus();
6549    }
6550   );
6551   ASPx.Evt.AttachEventToElement(checkableElement, "keyup",
6552    function (evt) { 
6553     if(ASPx.Evt.GetKeyCode(evt) == ASPx.Key.Space)
6554      instance.InvokeClick(internalCheckBox, evt);
6555    }
6556   );
6557   ASPx.Evt.AttachEventToElement(checkableElement, "keydown",
6558    function (evt) { 
6559     if(ASPx.Evt.GetKeyCode(evt) == ASPx.Key.Space)
6560      return ASPx.Evt.PreventEvent(evt);
6561    }
6562   );
6563  }
6564 },
6565 IsKBSInputWrapperExist: function() {
6566  return ASPx.Browser.Opera || ASPx.Browser.WebKitFamily;
6567 },
6568 GetICBMainElementByInput: function(icbInputElement) {
6569  return this.IsKBSInputWrapperExist() ? icbInputElement.parentNode.parentNode : icbInputElement.parentNode;
6570 },
6571 InvokeClick: function(internalCheckBox, evt) {
6572   if(internalCheckBox.enabled && !internalCheckBox.readOnly) {
6573   var inputElementValue = internalCheckBox.inputElement.value;
6574   var focusableElement = internalCheckBox.accessibilityCompliant ? internalCheckBox.mainElement : internalCheckBox.inputElement; 
6575   focusableElement.focus();
6576   if(!ASPx.Browser.IE) 
6577    internalCheckBox.inputElement.value = inputElementValue;
6578   this.InvokeClickCore(internalCheckBox, evt)
6579   }
6580 },
6581 InvokeClickCore: function(internalCheckBox, evt) {
6582  internalCheckBox.OnClick(evt);
6583 }
6584});
6585CheckableElementHelper.Instance = new CheckableElementHelper();
6586var CheckBoxInternal = ASPx.CreateClass(null, {
6587 constructor: function(inputElement, stateController, allowGrayed, allowGrayedByClick, helper, container, storeValueInInput, key, disableCancelBubble,
6588  accessibilityCompliant) {
6589  this.inputElement = inputElement;
6590  this.mainElement = helper.GetICBMainElementByInput(this.inputElement);
6591  this.name = (key ? key : this.inputElement.id) + CheckBoxInternal.GetICBMainElementPostfix();
6592  this.mainElement.id = this.name;
6593  this.stateController = stateController;
6594  this.container = container;
6595  this.allowGrayed = allowGrayed;
6596  this.allowGrayedByClick = allowGrayedByClick;
6597  this.autoSwitchEnabled = true;
6598  this.storeValueInInput = !!storeValueInInput;
6599  this.storedInputKey = !this.storeValueInInput ? this.inputElement.value : null;
6600  this.disableCancelBubble = !!disableCancelBubble;
6601  this.accessibilityCompliant = accessibilityCompliant;
6602  this.focusDecoration = null;
6603  this.focused = false;
6604  this.focusLocked = false;
6605  this.enabled = !this.mainElement.className.match(/dxWeb_\w+Disabled(\b|_)/);
6606  this.readOnly = false;
6607  this.CheckedChanged = new ASPxClientEvent();
6608  this.Focus = new ASPxClientEvent();
6609  this.LostFocus = new ASPxClientEvent();
6610  helper.InternalCheckBoxInitialize(this);
6611 },
6612 ChangeInputElementTabIndex: function() {  
6613  var changeMethod = this.enabled ? ASPx.Attr.RestoreTabIndexAttribute : ASPx.Attr.SaveTabIndexAttributeAndReset;
6614  changeMethod(this.inputElement);
6615 },
6616 CreateFocusDecoration: function(focusedStyle) {
6617   this.focusDecoration = new EditorStyleDecoration(this);
6618   this.focusDecoration.AddStyle('F', focusedStyle[0], focusedStyle[1]);
6619   this.focusDecoration.AddPostfix("");
6620 },
6621 UpdateFocusDecoration: function() {
6622  this.focusDecoration.Update();
6623 },  
6624 StoreInputKey: function(inputKey) {
6625  if(this.storeValueInInput)
6626   this.inputElement.value = inputKey;
6627  else
6628   this.storedInputKey = inputKey;
6629 },
6630 GetStoredInputKey: function() {
6631  if(this.storeValueInInput)
6632   return this.inputElement.value;
6633  else
6634   return this.storedInputKey;
6635 },
6636 OnClick: function(e) {
6637  if(this.autoSwitchEnabled) {
6638   var currentValue = this.GetValue();
6639   var value = this.stateController.GetNextCheckBoxValue(currentValue, this.allowGrayedByClick && this.allowGrayed);
6640   this.SetValue(value);
6641  }
6642  this.CheckedChanged.FireEvent(this, e);
6643 },
6644 OnFocus: function() {
6645  if(!this.IsFocusLocked()) {
6646   this.focused = true;
6647   this.UpdateFocusDecoration();
6648   this.Focus.FireEvent(this, null);
6649  } else
6650   this.UnlockFocus();
6651 },
6652 OnLostFocus: function() {
6653  if(!this.IsFocusLocked()) {
6654   this.focused = false;
6655   this.UpdateFocusDecoration();
6656   this.LostFocus.FireEvent(this, null);
6657  }
6658 },
6659 Refocus: function() {
6660  if(this.focused) {
6661   this.LockFocus();
6662   this.inputElement.blur();
6663   if(ASPx.Browser.MacOSMobilePlatform) {
6664    window.setTimeout(function() {
6665     ASPx.SetFocus(this.inputElement);
6666    }, 100);
6667   } else {
6668    ASPx.SetFocus(this.inputElement);
6669   }
6670  }
6671 },
6672 LockFocus: function() {
6673  this.focusLocked = true;
6674 },
6675 UnlockFocus: function() {
6676  this.focusLocked = false;
6677 },
6678 IsFocusLocked: function() {
6679  if(!!ASPx.Attr.GetAttribute(this.mainElement, ASPx.Attr.GetTabIndexAttributeName()))
6680   return false;
6681  return this.focusLocked;
6682 },
6683 SetValue: function(value) {
6684  var currentValue = this.GetValue();
6685  if(currentValue !== value) {
6686   var newInputKey = this.stateController.GetInputKeyByValue(value);
6687   if(newInputKey) {
6688    this.StoreInputKey(newInputKey);   
6689    this.stateController.UpdateInternalCheckBoxDecoration(this.mainElement, newInputKey, this.enabled);
6690   }
6691  }
6692  if(this.accessibilityCompliant) {
6693   var state = this.GetCurrentCheckState();
6694   var value = this.stateController.GetAriaCheckedValue(state);
6695   if(this.mainElement.attributes["aria-checked"] !== undefined)
6696    this.mainElement.setAttribute("aria-checked", value); 
6697   if(this.mainElement.attributes["aria-selected"] !== undefined)
6698    this.mainElement.setAttribute("aria-selected", value); 
6699  }
6700 },
6701 GetValue: function() {
6702  return this.stateController.GetValueByInputKey(this.GetCurrentInputKey());
6703 },
6704 GetCurrentCheckState: function() {
6705  return this.stateController.GetCheckStateByInputKey(this.GetCurrentInputKey());
6706 },
6707 GetCurrentInputKey: function() {
6708  return this.GetStoredInputKey();
6709 },
6710 GetChecked: function() {
6711  return this.GetCurrentInputKey() === CheckBoxInputKey.Checked;
6712 },
6713 SetChecked: function(checked) {
6714  var newValue = this.stateController.GetValueByCheckState(checked ? CheckBoxCheckState.Checked : CheckBoxCheckState.Unchecked);
6715  this.SetValue(newValue);
6716 },
6717 SetEnabled: function(enabled) {
6718  if(this.enabled != enabled) {
6719   this.enabled = enabled;
6720   this.stateController.UpdateInternalCheckBoxDecoration(this.mainElement, this.GetCurrentInputKey(), this.enabled);
6721   this.ChangeInputElementTabIndex();
6722  }
6723 },
6724 GetEnabled: function() {
6725  return this.enabled;
6726 }
6727});
6728CheckBoxInternal.GetICBMainElementPostfix = function() {
6729 return "_D";
6730};
6731var CheckBoxInternalCollection = ASPx.CreateClass(CollectionBase, {
6732 constructor: function(imageProperties, allowGrayed, storeValueInInput, helper, disableCancelBubble, accessibilityCompliant) {
6733  this.constructor.prototype.constructor.call(this);
6734  this.stateController = allowGrayed 
6735   ? CheckableElementStateController.Create(imageProperties, CheckBoxInputKey.Checked, CheckBoxInputKey.Unchecked, CheckBoxInputKey.Indeterminate, true)
6736   : CheckableElementStateController.Create(imageProperties, CheckBoxInputKey.Checked, CheckBoxInputKey.Unchecked);
6737  this.helper = helper || CheckableElementHelper.Instance;
6738  this.storeValueInInput = !!storeValueInInput;
6739  this.disableCancelBubble = !!disableCancelBubble;
6740  this.accessibilityCompliant = accessibilityCompliant;
6741 },
6742 Add: function(key, inputElement, container) {
6743  this.Remove(key);
6744  var checkBox = this.CreateInternalCheckBox(key, inputElement, container);
6745  CollectionBase.prototype.Add.call(this, key, checkBox);
6746  return checkBox;
6747 },
6748 SetImageProperties: function(imageProperties) {
6749  this.stateController.imageProperties = imageProperties;
6750 },
6751 CreateInternalCheckBox: function(key, inputElement, container) {
6752  return new CheckBoxInternal(inputElement, this.stateController, this.stateController.allowGrayed, false, this.helper, container, 
6753   this.storeValueInInput, key, this.disableCancelBubble, this.accessibilityCompliant);
6754 }
6755});
6756var EditorStyleDecoration = ASPx.CreateClass(null, {
6757 constructor: function(editor) {
6758  this.editor = editor;
6759  this.postfixList = [ ];
6760  this.styles = { };
6761  this.innerStyles = { };
6762  this.nullTextClassName = "";
6763  this.lockUpdate = false;
6764 },
6765 GetStyleSheet: function() {
6766  return ASPx.GetCurrentStyleSheet();
6767 },
6768 AddPostfix: function(value, applyClass, applyBorders, applyBackgroun
6768d) {
6769  this.postfixList.push(value);
6770 },
6771 AddStyle: function(key, className, cssText) {
6772  this.styles[key] = this.CreateRule(className, cssText);
6773  this.innerStyles[key] = this.CreateRule("", this.FilterInnerCss(cssText));
6774 },
6775 CreateRule: function(className, cssText) {
6776  return ASPx.Str.Trim(className + " " + ASPx.CreateImportantStyleRule(this.GetStyleSheet(), cssText));
6777 },
6778 LockUpdate: function() {
6779  this.lockUpdate = true;
6780 },
6781 UnlockUpdate: function() {
6782  this.lockUpdate = false;
6783 },
6784 IsUpdateLocked: function() {
6785  return this.lockUpdate;
6786 },
6787 Update: function() {
6788  if(this.IsUpdateLocked())
6789   return;
6790  this.UpdateCore();
6791 },
6792 UpdateCore: function() {
6793  for(var i = 0; i < this.postfixList.length; i++) {
6794   var postfix = this.postfixList[i];
6795   var inner = postfix.length > 0;
6796   var element = ASPx.GetElementById(this.editor.name + postfix);
6797   if(element) {
6798    this.ApplyInvalidStyle(element, inner);
6799    this.ApplyFocusedStyle(element, inner);
6800    this.ApplyNullTextStyle(element, inner);
6801   }
6802  }
6803 },
6804 ApplyInvalidStyle: function(element, inner) {
6805  if(this.HasDecoration("I")) {
6806   var isValid = this.editor.GetIsValid();
6807   this.ApplyDecoration("I", element, inner, !isValid);
6808  }
6809 },
6810 ApplyFocusedStyle: function(element, inner) {
6811  if(this.HasDecoration("F"))
6812   this.ApplyDecoration("F", element, inner, this.editor.focused);
6813 },
6814 ApplyNullTextStyle: function(element, inner) {
6815  if(!this.HasDecoration("N"))
6816   return;  
6817  var apply = !this.editor.focused;
6818  if(apply) {
6819   if(this.editor.CanApplyNullTextDecoration) {
6820    apply = this.editor.CanApplyNullTextDecoration();
6821   } else {
6822    var value = this.editor.GetValue();
6823    apply = apply && (value == null || value === "");
6824   }
6825  }
6826  if(apply)
6827   ASPx.Attr.ChangeAttribute(element, "spellcheck", "false");
6828  else
6829   ASPx.Attr.RestoreAttribute(element, "spellcheck");
6830  this.ApplyDecoration("N", element, inner, apply);
6831 },
6832 HasDecoration: function(key) {
6833  return !!this.styles[key];
6834 },
6835 ApplyNullTextClassName: function(active) {
6836  var nullTextClassName = this.GetNullTextClassName();
6837  var editorMainElement = this.editor.GetMainElement();
6838  if (active)
6839   ASPx.AddClassNameToElement(editorMainElement, nullTextClassName);
6840  else
6841   ASPx.RemoveClassNameFromElement(editorMainElement, nullTextClassName);
6842 },
6843 GetNullTextClassName: function () {
6844  if (!this.nullTextClassName)
6845   this.InitializeNullTextClassName();
6846  return this.nullTextClassName;
6847 },
6848 InitializeNullTextClassName: function () {
6849  var nullTextStyle = this.styles["N"];
6850  if (nullTextStyle) {
6851   var nullTextStyleClassNames = nullTextStyle.split(" ");
6852   for (var i = 0; i < nullTextStyleClassNames.length; i++)
6853    if (nullTextStyleClassNames[i].match("dxeNullText"))
6854     this.nullTextClassName = nullTextStyleClassNames[i];
6855  }
6856 },
6857 ApplyDecoration: function(key, element, inner, active) {
6858  var value = inner ? this.innerStyles[key] : this.styles[key];
6859  ASPx.RemoveClassNameFromElement(element, value);
6860  if(ASPx.Browser.IE && ASPx.Browser.MajorVersion >= 11)
6861   var reflow = element.offsetWidth; 
6862  if(active) {
6863   ASPx.AddClassNameToElement(element, value);
6864   if(ASPx.Browser.IE && ASPx.Browser.Version > 10 && element.border != null) { 
6865    var border = parseInt(element.border) || 0;
6866    element.border = 1;
6867    element.border = border;
6868   }
6869  }
6870 },
6871 FilterInnerCss: function(css) {
6872  return css.replace(/(border|background-image)[^:]*:[^;]+/gi, "");
6873 }
6874});
6875var TouchUIHelper = {
6876 isGesture: false,
6877 isMouseEventFromScrolling: false,
6878 isNativeScrollingAllowed: true,
6879 clickSensetivity: 10,
6880 documentTouchHandlers: {},
6881 documentEventAttachingAllowed: true,
6882 msTouchDraggableClassName: "dxMSTouchDraggable",
6883 touchMouseDownEventName: ASPx.Browser.WebKitTouchUI ? "touchstart" : (ASPx.Browser.Edge && ASPx.Browser.MSTouchUI && window.PointerEvent ? "pointerdown" : "mousedown"),
6884 touchMouseUpEventName:   ASPx.Browser.WebKitTouchUI ? "touchend"   : (ASPx.Browser.Edge && ASPx.Browser.MSTouchUI && window.PointerEvent ? "pointerup" : "mouseup"),
6885 touchMouseMoveEventName: ASPx.Browser.WebKitTouchUI ? "touchmove"  : (ASPx.Browser.Edge && ASPx.Browser.MSTouchUI && window.PointerEvent ? "pointermove" : "mousemove"),
6886 isTouchEvent: function(evt) {
6887  if(!evt) return false;
6888  return ASPx.Browser.WebKitTouchUI && ASPx.IsExists(evt.changedTouches); 
6889 },
6890 isTouchEventName: function(eventName) {
6891  return ASPx.Browser.WebKitTouchUI && (eventName.indexOf("touch") > -1 || eventName.indexOf("gesture") > -1);
6892 },
6893 getEventX: function(evt) { 
6894  return ASPx.Browser.IE ? evt.pageX : evt.changedTouches[0].pageX; 
6895 },
6896 getEventY: function (evt) { 
6897  return ASPx.Browser.IE ? evt.pageY :evt.changedTouches[0].pageY; 
6898 },
6899 getWebkitMajorVersion: function(){
6900  if(!this.webkitMajorVersion){
6901   var regExp = new RegExp("applewebkit/(\\d+)", "i");
6902   var matches = regExp.exec(ASPx.Browser.UserAgent);
6903   if(matches && matches.index >= 1)
6904    this.webkitMajorVersion = matches[1];
6905  }
6906  return this.webkitMajorVersion;
6907 },
6908 getIsLandscapeOrientation: function(){
6909  if(ASPx.Browser.MacOSMobilePlatform || ASPx.Browser.AndroidMobilePlatform)
6910   return Math.abs(window.orientation) == 90;
6911  return ASPx.GetDocumentClientWidth() > ASPx.GetDocumentClientHeight();
6912 },
6913 nativeScrollingSupported: function() {
6914  var allowedSafariVersion = ASPx.Browser.Version >= 5.1 && ASPx.Browser.Version < 8; 
6915  var allowedWebKitVersion = this.getWebkitMajorVersion() >
6915 533 && (ASPx.Browser.Chrome || this.getWebkitMajorVersion() < 600);
6916  return (ASPx.Browser.MacOSMobilePlatform && (allowedSafariVersion || allowedWebKitVersion))
6917   || (ASPx.Browser.AndroidMobilePlatform && ASPx.Browser.PlaformMajorVersion >= 3) || (ASPx.Browser.MSTouchUI && (!ASPx.Browser.WindowsPhonePlatform || !ASPx.Browser.IE));
6918 },
6919 makeScrollableIfRequired: function(element, options) {
6920  if(ASPx.Browser.WebKitTouchUI && element) {
6921   var overflow = ASPx.GetCurrentStyle(element).overflow;
6922   if(element.tagName == "DIV" &&  overflow != "hidden" && overflow != "visible" ){
6923    return this.MakeScrollable(element);
6924   }
6925  }
6926 },
6927 preventScrollOnEvent: function(evt){
6928 },
6929 handleFastTapIfRequired: function(evt, action, preventCommonClickEvents) {
6930  if(ASPx.Browser.WebKitTouchUI && evt.type == 'touchstart' && action) {
6931   this.FastTapHelper.HandleFastTap(evt, action, preventCommonClickEvents);
6932   return true;
6933  }
6934  return false;
6935 },
6936 ensureDocumentSizesCorrect: function (){
6937  return (document.documentElement.clientWidth - document.documentElement.clientHeight) / (screen.width - screen.height) > 0;
6938 },
6939 ensureOrientationChanged: function(onOrientationChangedFunction){
6940  if(ASPxClientUtils.iOSPlatform || this.ensureDocumentSizesCorrect())
6941   onOrientationChangedFunction();
6942  else {
6943   window.setTimeout(function(){
6944    this.ensureOrientationChanged(onOrientationChangedFunction);
6945   }.aspxBind(this), 100);
6946  }
6947 },
6948 onEventAttachingToDocument: function(eventName, func){
6949  if(ASPx.Browser.MacOSMobilePlatform && this.isTouchEventName(eventName)) {
6950   if(!this.documentTouchHandlers[eventName])
6951    this.documentTouchHandlers[eventName] = [];
6952   this.documentTouchHandlers[eventName].push(func);
6953   return this.documentEventAttachingAllowed;
6954  }
6955  return true;
6956 },
6957 onEventDettachedFromDocument: function(eventName, func){
6958  if(ASPx.Browser.MacOSMobilePlatform && this.isTouchEventName(eventName)) {
6959   var handlers = this.documentTouchHandlers[eventName];
6960   if(handlers)
6961    ASPx.Data.ArrayRemove(handlers, func);
6962  }
6963 },
6964 processDocumentTouchEventHandlers: function(proc) {
6965  var touchEventNames = ["touchstart", "touchend", "touchmove", "gesturestart", "gestureend"];
6966  for(var i = 0; i < touchEventNames.length; i++) {
6967   var eventName = touchEventNames[i];
6968   var handlers = this.documentTouchHandlers[eventName];
6969   if(handlers) {
6970    for(var j = 0; j < handlers.length; j++) {
6971     proc(eventName,handlers[j]);
6972    }
6973   }
6974  }
6975 },
6976 removeDocumentTouchEventHandlers: function() {
6977  if(ASPx.Browser.MacOSMobilePlatform) {
6978   this.documentEventAttachingAllowed = false;
6979   this.processDocumentTouchEventHandlers(ASPx.Evt.DetachEventFromDocumentCore);
6980  }
6981 },
6982 restoreDocumentTouchEventHandlers: function () {
6983  if(ASPx.Browser.MacOSMobilePlatform) {
6984   this.documentEventAttachingAllowed = true;
6985   this.processDocumentTouchEventHandlers(ASPx.Evt.AttachEventToDocumentCore);
6986  }
6987 },
6988 IsNativeScrolling: function() {
6989  return TouchUIHelper.nativeScrollingSupported() && TouchUIHelper.isNativeScrollingAllowed;
6990 },
6991 pointerEnabled: !!(window.PointerEvent || window.MSPointerEvent),
6992 pointerDownEventName: window.PointerEvent ? "pointerdown" : "MSPointerDown",
6993 pointerUpEventName: window.PointerEvent ? "pointerup" : "MSPointerUp",
6994 pointerCancelEventName: window.PointerEvent ? "pointercancel" : "MSPointerCancel",
6995 pointerMoveEventName: window.PointerEvent ? "pointermove" : "MSPointerMove",
6996 pointerOverEventName: window.PointerEvent ? "pointerover" : "MSPointerOver",
6997 pointerOutEventName: window.PointerEvent ? "pointerout" : "MSPointerOut",
6998 pointerType: {
6999  Touch: (ASPx.Browser.IE && ASPx.Browser.Version == 10) ? 2 : "touch",
7000  Pen: (ASPx.Browser.IE && ASPx.Browser.Version == 10) ? 3 : "pen",
7001  Mouse: (ASPx.Browser.IE && ASPx.Browser.Version == 10) ? 4 : "mouse"
7002 },
7003 msGestureEnabled: !!(window.PointerEvent || window.MSPointerEvent) && typeof(MSGesture) != "undefined",
7004 msTouchCreateGesturesWrapper: function(element, onTap){
7005  if(!TouchUIHelper.msGestureEnabled) 
7006   return;
7007  var gesture = new MSGesture();
7008  gesture.target = element;
7009  ASPx.Evt.AttachEventToElement(element, TouchUIHelper.pointerDownEventName, function(evt){
7010   gesture.addPointer(evt.pointerId);
7011  });
7012  ASPx.Evt.AttachEventToElement(element, TouchUIHelper.pointerUpEventName, function(evt){
7013   gesture.stop();
7014  });
7015  if(onTap)
7016   ASPx.Evt.AttachEventToElement(element, "MSGestureTap", onTap);
7017  return gesture;
7018 }
7019};
7020var CacheHelper = {};
7021CacheHelper.GetCachedValueCore = function(obj, key, func, cacheObj, fillValueMethod) {
7022 if(!cacheObj)
7023  cacheObj = obj;
7024 if(!cacheObj.cache)
7025  cacheObj.cache = {};
7026 if(!key) 
7027  key = "default";
7028 fillValueMethod(obj, key, func, cacheObj);
7029 return cacheObj.cache[key];
7030};
7031CacheHelper.GetCachedValue = function(obj, key, func, cacheObj) {
7032 return CacheHelper.GetCachedValueCore(obj, key, func, cacheObj, 
7033  function(obj, key, func, cacheObj) {
7034   if(!ASPx.IsExists(cacheObj.cache[key]))
7035    cacheObj.cache[key] = func.apply(obj, []);
7036  });
7037};
7038CacheHelper.GetCachedElement = function(obj, key, func, cacheObj) {
7039 return CacheHelper.GetCachedValueCore(obj, key, func, cacheObj, 
7040  function(obj, key, func, cacheObj) {
7041   if(!ASPx.IsValidElement(cacheObj.cache[key]))
7042    cacheObj.cache[key] = func.apply(obj, []);
7043  });
7044};
7045CacheHelper.GetCachedElements = function(obj, key, func, cacheObj) {
7046 return CacheHelper.GetCachedValueCore(obj, key, func, cacheObj, 
7047  function(obj, key, func, cacheObj) {
7048   if(!ASPx.IsValidElements(cacheObj.cache[key])){
7049    var elements = func.apply(obj, []);
7050    if(!Ident.IsArray(elements))
7051     elements = [elements];
7052    cacheObj.cache[key] = elements;
7053   }
7054  });
7055};
7056CacheHelper.GetCachedElementById = function(obj, id, cacheObj) {
7057 return CacheHelper.GetCachedElement(obj, id, function() { return ASPx.GetElementById(id); }, cacheObj);
7058};
7059CacheHelper.GetCachedChildById = function(obj, parent, id, cacheObj) {
7060 return CacheHelper.GetCachedElement(obj, id, function() { return ASPx.GetChildById(parent, id); }, cacheObj);
7061};
7062CacheHelper.DropCachedValue = function(cacheObj, key) {
7063 cacheObj.cache[key] = null;
7064};  
7065CacheHelper.DropCache = function(cacheObj) {
7066 cacheObj.cache = null;
7067};  
7068var DomObserver = ASPx.CreateClass(null, {
7069 constructor: function() {
7070  this.items = { };
7071 },
7072 subscribe: function(elementID, callbackFunc) {
7073  var item = this.items[elementID];
7074  if(item)
7075   this.unsubscribe(elementID);
7076  item = {
7077   elementID: elementID,
7078   callbackFunc: callbackFunc,
7079   pauseCount: 0
7080  };
7081  this.prepareItem(item);
7082  this.items[elementID] = item;
7083 },
7084 prepareItem: function(item) {
7085 },
7086 unsubscribe: function(elementID) {
7087  this.items[elementID] = null;
7088 },
7089 getItemElement: function(item) {
7090  var element = this.getElementById(item.elementID);
7091  if(element)
7092   return element;
7093  this.unsubscribe(item.elementID);
7094  return null;
7095 },
7096 getElementById: function(elementID) {
7097  var element = document.getElementById(elementID);
7098  return element && ASPx.IsValidElement(element) ? element : null;
7099 },
7100 pause: function(element, includeSubtree) {
7101  this.changeItemsState(element, includeSubtree, true);
7102 },
7103 resume: function(element, includeSubtree) {
7104  this.changeItemsState(element, includeSubtree, false);
7105 },
7106 forEachItem: function(processFunc, context) {
7107  context = context || this;
7108  for(var itemName in this.items) {
7109   if(!this.items.hasOwnProperty(itemName))
7110    continue;
7111   var item = this.items[itemName];
7112   if(item) {
7113    var needBreak = processFunc.call(context, item);
7114    if(needBreak)
7115     return;
7116   }
7117  }
7118 },
7119 changeItemsState: function(element, includeSubtree, pause) {
7120  this.forEachItem(function(item) {
7121   if(!element)
7122    this.changeItemState(item, pause);
7123   else {
7124    var itemElement = this.getItemElement(item);
7125    if(itemElement && (element == itemElement || (includeSubtree && ASPx.GetIsParent(element, itemElement)))) {
7126     this.changeItemState(item, pause);
7127     if(!includeSubtree)
7128      return true;
7129    }
7130   }
7131  }.aspxBind(this));
7132 },
7133 changeItemState: function(item, pause) {
7134  if(pause)
7135   this.pauseItem(item)
7136  else
7137   this.resumeItem(item);
7138 },
7139 pauseItem: function(item) {
7140  item.paused = true;
7141  item.pauseCount++;
7142 },
7143 resumeItem: function(item) {
7144  if(item.pauseCount > 0) {
7145   if(item.pauseCount == 1)
7146    item.paused = false;
7147   item.pauseCount--;
7148  }
7149 }
7150});
7151DomObserver.IsMutationObserverAvailable = function() {
7152 return !!window.MutationObserver;
7153};
7154var TimerObserver = ASPx.CreateClass(DomObserver, {
7155 constructor: function() {
7156  this.constructor.prototype.constructor.call(this);
7157  this.timerID = -1;
7158  this.observationTimeout = 300;
7159 },
7160 subscribe: function(elementID, callbackFunc) {
7161  DomObserver.prototype.subscribe.call(this, elementID, callbackFunc);
7162  if(!this.isActivated())
7163   this.startObserving();
7164 },
7165 isActivated: function() {
7166  return this.timerID !== -1;
7167 },
7168 startObserving: function() {
7169  if(this.isActivated())
7170   window.clearTimeout(this.timerID);
7171  this.timerID = window.setTimeout(this.onTimeout, this.observationTimeout);
7172 },
7173 onTimeout: function() {
7174  var observer = _aspxGetDomObserver();
7175  observer.doObserve();
7176  observer.startObserving();
7177 },
7178 doObserve: function() {
7179  if(!ASPx.documentLoaded) return;
7180  this.forEachItem(function(item) {
7181   if(!item.paused)
7182    this.doObserveForItem(item);
7183  }.aspxBind(this));
7184 },
7185 doObserveForItem: function(item) {
7186  var element = this.getItemElement(item);
7187  if(element)
7188   item.callbackFunc.call(this, element);
7189 }
7190});
7191var MutationObserver = ASPx.CreateClass(DomObserver, {
7192 constructor: function() {
7193  this.constructor.prototype.constructor.call(this);
7194  this.callbackTimeout = 10;
7195 },
7196 prepareItem: function(item) {
7197  item.callbackTimerID = -1;
7198  var target = this.getElementById(item.elementID);
7199  if(!target)
7200   return;
7201  var observerCallbackFunc = function() {
7202   if(item.callbackTimerID === -1) {
7203    var timeoutHander = function() {
7204     item.callbackTimerID = -1;
7205     item.callbackFunc.call(this, target);
7206    }.aspxBind(this);
7207    item.callbackTimerID = window.setTimeout(timeoutHander, this.callbackTimeout);
7208   }
7209  }.aspxBind(this);
7210  var observer = new window.MutationObserver(observerCallbackFunc);
7211  var config = { attributes: true, childList: true, characterData: true, subtree: true };
7212  observer.observe(target, config);
7213  item.observer = observer;
7214  item.config = config;
7215 },
7216 unsubscribe: function(elementID) {
7217  var item = this.items[elementID];
7218  if(item) {
7219   item.observer.disconnect();
7220   item.observer = null;
7221  }
7222  DomObserver.prototype.unsubscribe.call(this, elementID);
7223 },
7224 pauseItem: function(item) {
7225  DomObserver.prototype.pauseItem.call(this, item);
7226  item.observer.disconnect();
7227 },
7228 resumeItem: function(item) {
7229  DomObserver.prototype.resumeItem.call(this, item);
7230  if(!item.paused) {
7231   var target = this.getItemElement(item);
7232   if(target)
7233    item.observer.observe(target, item.config);
7234  }
7235 }
7236});
7237var domObserver = null;
7238function _aspxGetDomObserver() {
7239 if(domObserver == null)
7240  domObserver = DomObserver.IsMutationObserverAvailable() ? new MutationObserver() : new TimerObserver();
7241 return domObserver;
7242};
7243var ControlUpdateWatcher = ASPx.CreateClass(null, {
7244 constructor: function() {
7245  this.helpers = { };
7246  this.clearLockerTimerID = -1;
7247  this.clearLockerTimerDelay = 15;
7248  this.postProcessing = false;
7249  this.init();
7250 },
7251 init: function() {
7252  var postHandler = aspxGetPostHandler();
7253  postHandler.Post.AddHandler(this.OnPost, this);
7254 },
7255 Add: function(helper) {
7256  this.helpers[helper.GetName()] = helper;
7257 },
7258 CanSendCallback: function(dxCallbackOwner, arg) {
7259  this.LockConfirmOnBeforeWindowUnload();
7260  var modifiedHelpers = this.FilterModifiedHelpersByDXCallbackOwner(this.GetModifiedHelpers(), dxCallbackOwner, arg);
7261  if(modifiedHelpers.length === 0) return true;
7262  var modifiedHelpersInfo = this.GetToConfirmAndToResetLists(modifiedHelpers, dxCallbackOwner.name);
7263  if(!modifiedHelpersInfo) return true;
7264  if(modifiedHelpersInfo.toConfirm.length === 0) {
7265   this.ResetClientChanges(modifiedHelpersInfo.toReset);
7266   return true;
7267  }
7268  var helper = modifiedHelpersInfo.toConfirm[0];
7269  if(!confirm(helper.GetConfirmUpdateText()))
7270   return false;
7271  this.ResetClientChanges(modifiedHelpersInfo.toReset);
7272  return true;
7273 },
7274 OnPost: function(s, e) {
7275  if(e.isDXCallback) return;
7276  this.postProcessing = true;
7277  this.LockConfirmOnBeforeWindowUnload();
7278  var modifiedHelpersInfo = this.GetModifedHelpersInfo(e);
7279  if(!modifiedHelpersInfo) return;
7280  if(modifiedHelpersInfo.toConfirm.length === 0) {
7281   this.ResetClientChanges(modifiedHelpersInfo.toReset);
7282   return;
7283  }
7284  var helper = modifiedHelpersInfo.toConfirm[0];
7285  if(!confirm(helper.GetConfirmUpdateText())) {
7286   e.cancel = true;
7287   this.finishPostProcessing();
7288  }
7289  if(!e.cancel)
7290   this.ResetClientChanges(modifiedHelpersInfo.toReset);
7291 },
7292 finishPostProcessing: function() {
7293  this.postProcessing = false;
7294 },
7295 GetModifedHelpersInfo: function(e) {
7296  var modifiedHelpers = this.FilterModifiedHelpers(this.GetModifiedHelpers(), e);
7297  if(modifiedHelpers.length === 0) return;
7298  return this.GetToConfirmAndToResetLists(modifiedHelpers, e && e.ownerID);
7299 },
7300 GetToConfirmAndToResetLists: function(modifiedHelpers, ownerID) {
7301  var resetList = [ ];
7302  var confirmList = [ ];
7303  for(var i = 0; i < modifiedHelpers.length; i++) {
7304   var helper = modifiedHelpers[i];
7305   if(!helper.GetConfirmUpdateText()) { 
7306    resetList.push(helper);
7307    continue;
7308   }
7309   if(helper.CanShowConfirm(ownerID)) { 
7310    resetList.push(helper);
7311    confirmList.push(helper);
7312   }
7313  }
7314  return { toConfirm: confirmList, toReset: resetList };
7315 },
7316 FilterModifiedHelpers: function(modifiedHelpers, e) {
7317  if(modifiedHelpers.length === 0)
7318   return [ ];
7319  if(this.RequireProcessUpdatePanelCallback(e))
7320   return this.FilterModifiedHelpersByUpdatePanels(modifiedHelpers);
7321  if(this.postProcessing)
7322   return this.FilterModifiedHelpersByPostback(modifiedHelpers);
7323  return modifiedHelpers;
7324 },
7325 FilterModifiedHelpersByDXCallbackOwner: function(modifiedHelpers, dxCallbackOwner, arg) {
7326  var result = [ ];
7327  for(var i = 0; i < modifiedHelpers.length; i++) {
7328   var helper = modifiedHelpers[i];
7329   if(helper.NeedConfirmOnCallback(dxCallbackOwner, arg))
7330    result.push(helper);
7331  }
7332  return result;
7333 },
7334 FilterModifiedHelpersByUpdatePanels: function(modifiedHelpers) {
7335  var result = [ ];
7336  var updatePanels = this.GetUpdatePanelsWaitedForUpdate();
7337  for(var i = 0; i < updatePanels.length; i++) {
7338   var panelID = updatePanels[i].replace(/\$/g, "_");
7339   var panel = ASPx.GetElementById(panelID);
7340   if(!panel) continue;
7341   for(var j = 0; j < modifiedHelpers.length; j++) {
7342    var helper = modifiedHelpers[j];
7343    if(ASPx.GetIsParent(panel, helper.GetControlMainElement()))
7344     result.push(helper);
7345   }
7346  }
7347  return result;
7348 },
7349 FilterModifiedHelpersByPostback: function(modifiedHelpers) {
7350  var result = [ ];
7351  for(var i = 0; i < modifiedHelpers.length; i++) {
7352   var helper = modifiedHelpers[i];
7353   if(helper.NeedConfirmOnPostback())
7354    result.push(helper);
7355  }
7356  return result;
7357 },
7358 RequireProcessUpdatePanelCallback: function(e) {
7359  var rManager = this.GetMSRequestManager();
7360  if(rManager && e && e.isMSAjaxCallback)
7361   return rManager._postBackSettings.async;
7362  return false;
7363 },
7364 GetUpdatePanelsWaitedForUpdate: function() {
7365  var rManager = this.GetMSRequestManager();
7366  if(!rManager) return [ ];
7367  var panelUniqueIDs = rManager._postBackSettings.panelsToUpdate || [ ];
7368  var panelClientIDs = [ ];
7369  for(var i = 0; i < panelUniqueIDs.length; i++) {
7370   var index = ASPx.Data.ArrayIndexOf(rManager._updatePanelIDs, panelUniqueIDs[i]);
7371   if(index >= 0)
7372    panelClientIDs.push(rManager._updatePanelClientIDs[index]);
7373  }
7374  return panelClientIDs;
7375 },
7376 GetMSRequestManager: function() {
7377  if(window.Sys && Sys.WebForms && Sys.WebForms.PageRequestManager && Sys.WebForms.PageRequestManager.getInstance)
7378   return Sys.WebForms.PageRequestManager.getInstance();
7379  return null;
7380 },
7381 GetModifiedHelpers: function() {
7382  var result = [ ];
7383  for(var key in this.helpers) { 
7384   var helper = this.helpers[key];
7385   if(helper.HasChanges())
7386    result.push(helper);
7387  }
7388  return result;
7389 },
7390 ResetClientChanges: function(modifiedHelpers) {
7391  for(var i = 0; i < modifiedHelpers.length; i++)
7392   modifiedHelpers[i].ResetClientChanges();
7393 },
7394 GetConfirmUpdateMessage: function() {
7395  if(this.confirmOnWindowUnloadLocked) return;
7396  var modifiedHelpersInfo = this.GetModifedHelpersInfo();
7397  if(!modifiedHelpersInfo || modifiedHelpersInfo.toConfirm.length === 0) 
7398   return;
7399  var helper = modifiedHelpersInfo.toConfirm[0];
7400  return helper.GetConfirmUpdateText();
7401 },
7402 LockConfirmOnBeforeWindowUnload: function() {
7403  this.confirmOnWindowUnloadLocked = true;
7404  this.clearLockerTimerID = ASPx.Timer.ClearTimer(this.clearLockerTimerID);
7405  this.clearLockerTimerID = window.setTimeout(function() {
7406   this.confirmOnWindowUnloadLocked = false;
7407  }.aspxBind(this), this.clearLockerTimerDelay);
7408 },
7409 OnWindowBeforeUnload: function(e) {
7410  var confirmMessage = this.GetConfirmUpdateMessage();
7411  if(confirmMessage)
7412   e.returnValue = confirmMessage;
7413  this.finishPostProcessing();
7414  return confirmMessage;
7415 },
7416 OnWindowUnload: function(e) {
7417  if(this.confirmOnWindowUnloadLocked) return;
7418  var modifiedHelpersInfo = this.GetModifedHelpersInfo();
7419  if(!modifiedHelpersInfo) return;
7420  this.ResetClientChanges(modifiedHelpersInfo.toReset);
7421 },
7422 OnMouseDown: function(e) {
7423  if(ASPx.Browser.IE)
7424   this.PreventBeforeUnloadOnLinkClick(e);
7425 },
7426 OnFocusIn: function(e) {
7427  if(ASPx.Browser.IE)
7428   this.PreventBeforeUnloadOnLinkClick(e);
7429 },
7430 PreventBeforeUnloadOnLinkClick: function(e) {
7431  if(ASPx.GetObjectKeys(this.helpers).length == 0)
7432   return;
7433  var link = ASPx.GetParentByTagName(ASPx.Evt.GetEventSource(e), "A");
7434  if(!link || link.dxgvLinkClickHanlderAssigned)
7435   return;
7436  var url = ASPx.Attr.GetAttribute(link, "href");
7437  if(!url || url.indexOf("javascript:") < 0)
7438   return;
7439  ASPx.Evt.AttachEventToElement(link, "click", function(ev) { return ASPx.Evt.PreventEvent(ev); });
7440  link.dxgvLinkClickHanlderAssigned = true;
7441 }
7442});
7443ControlUpdateWatcher.Instance = null;
7444ControlUpdateWatcher.getInstance = function () {
7445 if (!ControlUpdateWatcher.Instance) {
7446  ControlUpdateWatcher.Instance = new ControlUpdateWatcher();
7447  ASPx.Evt.AttachEventToElement(window, "beforeunload", function(e) {
7448   return ControlUpdateWatcher.Instance.OnWindowBeforeUnload(e);
7449  });
7450  ASPx.Evt.AttachEventToElement(window, "unload", function(e) {
7451   ControlUpdateWatcher.Instance.OnWindowUnload(e);
7452  });
7453  ASPx.Evt.AttachEventToDocument("mousedown", function(e) {
7454   ControlUpdateWatcher.Instance.OnMouseDown(e);
7455  });
7456  ASPx.Evt.AttachEventToDocument("focusin", function(e) {
7457   ControlUpdateWatcher.Instance.OnFocusIn(e);
7458  });
7459 }
7460 return ControlUpdateWatcher.Instance;
7461};
7462var UpdateWatcherHelper = ASPx.CreateClass(null, {
7463 constructor: function(owner) {
7464  this.owner = owner;
7465  this.ownerWatcher = ControlUpdateWatcher.getInstance();
7466  this.ownerWatcher.Add(this);
7467 },
7468 GetName: function() {
7469  return this.owner.name;
7470 },
7471 GetControlMainElement: function() {
7472  return this.owner.GetMainElement();
7473 },
7474 GetControlParentForm: function(){
7475  return ASPx.GetParentByTagName(this.GetControlMainElement(), "FORM");
7476 },
7477 CanShowConfirm: function(requestOwnerID) {
7478  return true;
7479 },
7480 HasChanges: function() {
7481  return false;
7482 },
7483 GetConfirmUpdateText: function() {
7484  return "";
7485 },
7486 NeedConfirmOnCallback: function(dxCallbackOwner) {
7487  return true;
7488 },
7489 NeedConfirmOnPostback: function() {
7490  if(ASPx.IsUploadSubmitRequest)
7491   return !ASPx.IsUploadSubmitRequest(this.GetControlParentForm(
7491));
7492  return true;
7493 },
7494 ResetClientChanges: function() {
7495 },
7496 ConfirmOnCustomControlEvent: function() {
7497  var confirmMessage = this.GetConfirmUpdateText();
7498  if(confirmMessage)
7499   return confirm(confirmMessage);
7500  return false;
7501 }
7502});
7503var ControlCallbackHandlersQueue = ASPx.CreateClass(null, {
7504 constructor: function (owner) {
7505  this.owner = owner;
7506  this.handlerInfos = [];
7507 },
7508 addCallbackHandler: function(handlerInfo) {
7509  this.handlerInfos.push(handlerInfo);
7510 },
7511 executeCallbacksHandlers: function() {
7512  for(var i = 0, handlerInfo; handlerInfo = this.handlerInfos[i]; i++)
7513   handlerInfo.handler.call(this.owner, handlerInfo.result);
7514  this.handlerInfos = [];
7515 }
7516});
7517var ControlCallbackQueueHelper = ASPx.CreateClass(null, {
7518 constructor: function (owner) {
7519  this.owner = owner;
7520  this.pendingCallbacks = [];
7521  this.receivedCallbacks = [];
7522  this.attachEvents();
7523 },
7524 showLoadingElements: function () {
7525  this.owner.ShowLoadingDiv();
7526  if (this.owner.IsCallbackAnimationEnabled())
7527   this.owner.StartBeginCallbackA
7527nimation();
7528  else
7529   this.owner.ShowLoadingElementsInternal();
7530 },
7531 attachEvents: function () {
7532  this.owner.EndCallback.AddHandler(this.onEndCallback.aspxBind(this));
7533  this.owner.CallbackError.AddHandler(this.onCallbackError.aspxBind(this));
7534 },
7535 detachEvents: function () {
7536  this.owner.EndCallback.RemoveHandler(this.onEndCallback);
7537  this.owner.CallbackError.RemoveHandler(this.onCallbackError);
7538 },
7539 onCallbackError: function (owner, result) {
7540  this.sendErrorToChildControl(result);
7541 },
7542 ignoreDuplicates: function () {
7543  return true;
7544 },
7545 hasDuplicate: function (arg) {
7546  for (var i in this.pendingCallbacks) {
7547   if (this.pendingCallbacks[i].arg == arg && this.pendingCallbacks[i].state != ASPx.callbackState.aborted)
7548    return true;
7549  }
7550  return false;
7551 },
7552 getToken: function (halperContext, callbackInfo) {
7553  return {
7554   cancel: function () {
7555    if (callbackInfo.state == ASPx.callbackState.sent) {
7556     callbackInfo.state = ASPx.callbackState.aborted;
7557     halperContext.sendNext();
7558    }
7559    if (callbackInfo.state == ASPx.callbackState.inTurn)
7560     ASPx.Data.ArrayRemove(halperContext.pendingCallbacks, callbackInfo);
7561   },
7562   callbackId: -1
7563  }
7564 },
7565 sendCallback: function (arg, handlerContext, handler) {
7566  if (this.ignoreDuplicates() && this.hasDuplicate(arg))
7567   return false;
7568  var handlerContext = handlerContext || this.owner;
7569  var callbackInfo = {
7570   arg: arg,
7571   handlerContext: handlerContext,
7572   handler: handler || handlerContext.OnCallback,
7573   state: ASPx.callbackState.inTurn, callbackId: -1
7574  };
7575  this.pendingCallbacks.push(callbackInfo);
7576  if (!this.hasActiveCallback()) {
7577   callbackInfo.callbackId = this.owner.CreateCallback(arg);
7578   callbackInfo.state = ASPx.callbackState.sent;
7579  }
7580  return this.getToken(this, callbackInfo);
7581 },
7582 hasActiveCallback: function () {
7583  return this.getCallbacksInfoByState(ASPx.callbackState.sent).length > 0;
7584 },
7585 sendNext: function () {
7586  var nextCallbackInfo = this.getCallbacksInfoByState(ASPx.callbackState.inTurn)[0];
7587  if (nextCallbackInfo) {
7588   nextCallbackInfo.callbackId = this.owner.CreateCallback(nextCallbackInfo.arg);
7589   nextCallbackInfo.state = ASPx.callbackState.sent;
7590   return nextCallbackInfo.callbackId;
7591  }
7592 },
7593 onEndCallback: function () {
7594  if (!this.owner.isErrorOnCallback && this.hasPendingCallbacks()) {
7595   var curCallbackId;
7596   var curCallbackInfo;
7597   var handlerContext;
7598   for (var i in this.receivedCallbacks) {
7599    curCallbackId = this.receivedCallbacks[i];
7600    curCallbackInfo = this.getCallbackInfoById(curCallbackId);
7601    if (curCallbackInfo.state != ASPx.callbackState.aborted) {
7602     handlerContext = curCallbackInfo.handlerContext;
7603     if (handlerContext.OnEndCallback)
7604      handlerContext.OnEndCallback();
7605     this.sendNext();
7606    }
7607    ASPx.Data.ArrayRemove(this.pendingCallbacks, curCallbackInfo);
7608   }
7609   ASPx.Data.ArrayClear(this.receivedCallbacks);
7610  }
7611 },
7612 hasPendingCallbacks: function () {
7613  return this.pendingCallbacks && this.pendingCallbacks.length && this.pendingCallbacks.length > 0;
7614 },
7615 processCallback: function (result, callbackId) {
7616  this.receivedCallbacks.push(callbackId);
7617  if (this.hasPendingCallbacks()) {
7618   var callbackInfo = this.getCallbackInfoById(callbackId);
7619   if (callbackInfo.state != ASPx.callbackState.aborted)
7620    callbackInfo.handler.call(callbackInfo.handlerContext, result);
7621  }
7622 },
7623 getCallbackInfoById: function (id) {
7624  for (var i in this.pendingCallbacks) {
7625   if (this.pendingCallbacks[i].callbackId == id)
7626    return this.pendingCallbacks[i];
7627  }
7628 },
7629 getCallbacksInfoByState: function (state) {
7630  var result = [];
7631  for (var i in this.pendingCallbacks) {
7632   if (this.pendingCallbacks[i].state == state)
7633    result.push(this.pendingCallbacks[i]);
7634  }
7635  return result;
7636 },
7637 sendErrorToChildControl: function (callbackObj) {
7638  if (!this.hasPendingCallbacks())
7639   return;
7640  var callbackInfo = this.getCallbackInfoById(callbackObj.callbackId || 0);
7641  if (!callbackInfo)
7642   return;
7643  var hasChildControlHandler = (callbackInfo.handlerContext != this.owner) && callbackInfo.handlerContext.OnCallbackError;
7644  if (hasChildControlHandler)
7645   callbackInfo.handlerContext.OnCallbackError.call(callbackInfo.handlerContext, callbackObj.message, callbackObj.data);
7646 }
7647});
7648var AccessibilityHelperBase = ASPx.CreateClass(null, {
7649 constructor: function(control) {
7650  this.control = control;
7651  this.timerID = -1;
7652  this.pronounceMessageTimeout = 500;
7653  this.activeItem = this.getItems()[0];
7654  this.pronounceIsStarted = false;
7655 },
7656 PronounceMessage: function(text, activeItemArgs, inactiveItemArgs, mainElementArgs, ownerMainElement) {   
7657  this.timerID = ASPx.Timer.ClearTimer(this.timerID);
7658  this.pronounceIsStarted = true;
7659  this.timerID = window.setTimeout(function() {
7660   this.PronounceMessageCore(text, activeItemArgs, inactiveItemArgs, mainElementArgs, ownerMainElement);
7661  }.aspxBind(this), this.getPronounceTimeout());
7662 },
7663 PronounceMessageCore: function(text, activeItemArgs, inactiveItemArgs, mainElementArgs, ownerMainElement) {
7664  this.toogleItem();
7665  var mainElement = this.getMainElement();
7666  var activeItem = this.getItem(true);
7667  var inactiveItem = this.getItem();
7668  if(ASPx.Attr.GetAttribute(mainElement, "role") != "application")
7669   mainElementArgs = this.addArguments(mainElementArgs, { "aria-activedescendant"   : activeItem.id });
7670  activeItemArgs = this.addArguments(activeItemArgs,    { "aria-label"     : text });
7671  inactiveItemArgs = this.addArguments(inactiveItemArgs,   { "aria-label"     : "" });
7672  if(!!this.control.GetErrorCell()) {
7673   var errorTextElement = this.control.GetAccessibilityErrorTextElement();
7674   activeItemArgs = this.addArguments(activeItemArgs,   {"aria-invalid"  : !this.control.isValid ? "true" : "" });
7675   mainElementArgs = this.addArguments(mainElementArgs, { "aria-invalid" : "" });
7676   inactiveItemArgs = this.addArguments(inactiveItemArgs,  { "aria-invalid" : "" });
7677  }
7678  this.changeActivityAttributes(activeItem, activeItemArgs);
7679  if(!!this.control.GetErrorCell()) {
7680   this.control.SetOrRemoveAccessibilityAdditionalText([activeItem], errorTextElement, !this.control.isValid, false, true);
7681   this.control.SetOrRemoveAccessibilityAdditionalText([mainElement, inactiveItem], errorTextElement, false, false, false);
7682  }
7683  this.changeActivityAttributes(mainElement, mainElementArgs);
7684  if(!!ownerMainElement && ASPx.Attr.GetAttribute(ownerMainElement, "role") != "application")
7685   this.changeActivityAttributes(ownerMainElement, { "aria-activedescendant": activeItem.id });
7686  this.changeActivityAttributes(inactiveItem, inactiveItemArgs);
7687  this.pronounceIsStarted = false;
7688 },
7689 GetActiveElement: function(inputIsMainElement) {
7690  if(this.pronounceIsStarted) return null;
7691  var mainElement = inputIsMainElement ? this.control.GetInputElement() : this.getMainElement();
7692  var activeElementId = ASPx.Attr.GetAttribute(mainElement, 'aria-activedescendant');
7693  return activeElementId ? ASPx.GetElementById(activeElementId) : mainElement;
7694 },
7695 getMainElement: function() {
7696  if(!ASPx.IsExistsElement(this.mainElement))
7697   this.mainElement = this.control.GetAccessibilityServiceElement();
7698  return this.mainElement;
7699 },
7700 getItems: function() {
7701  if(!ASPx.IsExistsElement(this.items))
7702   this.items = ASPx.GetChildElementNodes(this.getMainElement());
7703  return this.items;
7704 },
7705 getItem: function(isActive) {
7706  if(isActive)
7707   return this.activeItem;
7708  var items = this.getItems();
7709  return items[0] === this.activeItem ? items[1] : items[0];
7710 },
7711 getPronounceTimeout: function() { return this.pronounceMessageTimeout; },
7712 toogleItem: function() {
7713  this.activeItem = this.getItem();
7714 },
7715 addArguments: function(targetArgs, newArgs) {
7716  if(!targetArgs) targetArgs = { };
7717  for(key in newArgs) {
7718   if(!targetArgs.hasOwnProperty(key))
7719    targetArgs[key] = newArgs[key];
7720  }
7721  return targetArgs;
7722 },
7723 changeActivityAttributes: function(element, args) {
7724  for(key in args) {
7725   var value = args[key];
7726   var action = value !== "" ? ASPx.Attr.SetAttribute : ASPx.Attr.RemoveAttribute;
7727   action(element, key, value);
7728  }
7729 }
7730});
7731var AccessibilityPronouncer = ASPx.CreateClass(null, {
7732 constructor: function() {
7733  this.pronouncerId = "dxPronouncer";
7734  this.initialized = false;
7735  this.focusableMessageElement = null;
7736  this.messageElement = null;
7737  this.pronouncers = {
7738   callback: new AccessibilityCallbackPronouncer(this),
7739   descendant: new AccessibilityDescendantPronouncer(this),
7740   labelled: new AccessibilityLabelledPronouncer(this)
7741  }
7742 },
7743 Pronounce: function(args) {
7744  this.pronouncers[args.type].Pronounce(args);
7745 },
7746 EnsureInitialize: function() {
7747  if(!this.initialized)
7748   this.initialize();
7749 },
7750 RemoveState: function() {
7751  for(pronouncer in this.pronouncers)
7752   pronouncer.RemoveState();
7753 },
7754 RestoreControlState: function(type, mainElement) {
7755  this.pronouncers[type].RestoreControlState(mainElement);
7756 },
7757 RestoreElementsState: function(type, elements) {
7758  this.pronouncers[type].RestoreElementsState(elements);
7759 },
7760 RestoreElementState: function(type, element) {
7761  this.pronouncers[type].RestoreElementState(element);
7762 },
7763 initialize: function() {
7764  this.createFocusableMessageElement();
7765  this.createMessageElement();
7766  this.initialized = true;
7767 },
7768 createFocusableMessageElement: function() {
7769  var focusableMessageElement = document.createElement("DIV");
7770  ASPx.Attr.SetAttribute(focusableMessageElement, "role", "application");
7771  ASPx.Attr.Aria.SetSilence(focusableMessageElement);
7772  document.body.appendChild(focusableMessageElement);
7773  this.focusableMessageElement = focusableMessageElement;
7774 },
7775 createMessageElement: function() {
7776  var messageElement = document.createElement("DIV");
7777  messageElement.id = this.pronouncerId;
7778  ASPx.Attr.SetAttribute(messageElement, "role", "note");
7779  this.focusableMessageElement.appendChild(messageElement);
7780  this.messageElement = messageElement;
7781 },
7782 getMessage: function(messagePartsArg) {
7783  var messageParts = [ ];
7784  for(key in messagePartsArg) {
7785   var value = messagePartsArg[key];
7786   if(ASPx.IsExists(value))
7787    messageParts.push(value);
7788  } 
7789  return messageParts.join(", ");
7790 }
7791});
7792var AccessibilityPronouncerBase = ASPx.CreateClass(null, {
7793 constructor: function() {
7794  this.state = { };
7795 },
7796 Pronounce: function() { },
7797 SaveElementState: function(element) { 
7798  if(this.state[element.id])
7799   return;
7800  this.state[element.id] = {
7801   element: element,
7802   labelled: ASPx.Attr.GetAttribute(element, ASPx.Attr.Aria.labelled),
7803   descendant: ASPx.Attr.GetAttribute(element, ASPx.Attr.Aria.descendant)
7804  }
7805 },
7806 RemoveState: function() {
7807  this.state = { };
7808 },
7809 RestoreControlState: function(mainElement) { 
7810  for(elementInfo in this.state) {
7811   var element = this.state[elementInfo].element;
7812   if(!mainElement || ASPx.GetIsParent(mainElement, element))
7813    this.RestoreElementState(element);
7814  }
7815 },
7816 RestoreElementsState: function(elements) { 
7817  for(var i = 0; i < elements.length; i++)
7818   this.RestoreElementState(elements[i]);
7819 },
7820 RestoreElementState: function(element) {
7821  var elementState = this.state[element.id];
7822  if(!elementState)
7823   return;
7824  ASPx.Attr.Aria.SetOrRemoveLabelled(element, elementState.labelled);
7825  ASPx.Attr.Aria.SetOrRemoveDescendant(element, elementState.descendant);
7826  ASPx.Attr.Aria.SetOrRemoveLabel(this.getMessageElement());
7827  delete this.state[element.id];
7828 },  
7829 getMessageElement: function() {
7830  return ASPx.AccessibilityPronouncer.messageElement;
7831 },
7832 getMessage: function(messageParts) {
7833  return ASPx.AccessibilityPronouncer.getMessage(messageParts);
7834 }
7835});
7836var AccessibilityCallbackPronouncer = ASPx.CreateClass(AccessibilityPronouncerBase, {
7837 constructor: function() {
7838  this.constructor.prototype.constructor.call(this);
7839 }
7840});
7841var AccessibilityDescendantPronouncer = ASPx.CreateClass(AccessibilityPronouncerBase, {
7842 constructor: function() {
7843  this.constructor.prototype.constructor.call(this);
7844 },
7845 Pronounce: function(args) {
7846  var activeElement = ASPx.GetActiveElement();
7847  this.SaveElementState(activeElement);
7848  var messageElement = this.getMessageElement();
7849  ASPx.Attr.Aria.SetOrRemoveLabel(messageElement, this.getMessage(args.messageParts));
7850  ASPx.Attr.Aria.SetOrRemoveDescendant(activeElement, messageElement.id);
7851 }
7852});
7853var AccessibilityLabelledPronouncer = ASPx.CreateClass(AccessibilityPronouncerBase, {
7854 constructor: function() {
7855  this.constructor.prototype.constructor.call(this);
7856 },
7857 Pronounce: function(args) {
7858  var messageElement = this.getMessageElement();
7859  var labelledElement = args.labelledElement;
7860  var activeElement = ASPx.GetActiveElement();
7861  this.SaveElementState(labelledElement);
7862  this.SaveElementState(activeElement);
7863  ASPx.Attr.Aria.SetOrRemoveLabel(messageElement, this.getMessage(args.messageParts));
7864  ASPx.Attr.Aria.SetOrRemoveLabelled(labelledElement, messageElement.id);
7865  ASPx.Attr.Aria.SetOrRemoveDescendant(activeElement, labelledElement.id);
7866 }
7867});
7868ASPx.AccessibilityPronouncerType = {
7869 callback: "callback",
7870 descendant: "descendant",
7871 labelled: "labelled"
7872};
7873ASPx.AccessibilityPronouncer = new AccessibilityPronouncer();
7874var EventStorage = ASPx.CreateClass(null, {
7875 constructor: function() {
7876  this.bag = { };
7877 },
7878 Save: function(e, data, overwrite) {
7879  var key = this.getEventKey(e);
7880  if(this.bag.hasOwnProperty(key) && !overwrite)
7881   return;
7882  this.bag[key] = data;
7883  window.setTimeout(function() { delete this.bag[key]; }.aspxBind(this), 100);
7884 },
7885 Load: function(e) {
7886  var key = this.getEventKey(e);
7887  return this.bag[key];
7888 },
7889 getEventKey: function(e) {
7890  if(ASPx.IsExists(e.timeStamp))
7891   return e.timeStamp.toString();
7892  var eventSource = ASPx.Evt.GetEventSource(e);
7893  var type = e.type.toString();
7894  return eventSource ? type + "_" + eventSource.uniqueID.toString() : type;
7895 }
7896});
7897EventStorage.Instance = null;
7898EventStorage.getInstance = function() {
7899 if(!EventStorage.Instance)
7900  EventStorage.Instance = new EventStorage();
7901 return EventStorage.Instance;
7902};
7903var GetGlobalObject = function(objectName) {
7904 var fields = objectName.split('.');
7905 var obj = window[fields[0]];
7906 for(var i = 1;
7906 obj && i < fields.length; i++) {
7907  obj = obj[fields[i]];
7908 }
7909 return obj;
7910}
7911var GetExternalScriptProcessor = function() {
7912 return ASPx.ExternalScriptProcessor ? ASPx.ExternalScriptProcessor.getInstance() : null;
7913}
7914var ThemesWithRipple = ['Material'];
7915var RippleHelper = {
7916 rippleTargetClassName: "dxRippleTarget",
7917 rippleTargetExternalClassName: "dxRippleTargetExternal",
7918 rippleContainerClassName: "dxRippleContainer",
7919 rippleClassName: "dxRipple",
7920 touchRadius: -1,
7921 isMobileExternalRipple: null,
7922 zoom: 1,
7923 parentsScroll: null,
7924 Init: function() {
7925  if(this.getIsRippleFunctionalityEnabled()) {
7926   setTimeout(function() {
7927    this.calcTouchRadius();
7928   }.aspxBind(this), 0);
7929  }
7930 },
7931 calcTouchRadius: function() {
7932  var testBlock = document.createElement("DIV");
7933  ASPx.SetStyles(testBlock, {
7934   height: "1in",
7935   width: "1in",
7936   left: "-100%",
7937   top: "-100%",
7938   position: "absolute"
7939  });
7940  document.body.appendChild(testBlock);
7941  this.touchRadius = (1.8 / 2.54) * Math.max(testBlock.offsetWidth, testBlock.offsetHeight);
7942  document.body.removeChild(testBlock);
7943 },
7944 isRippleFunctionalityEnabled: null,
7945 checkRippleFunctionality: function() {
7946  if(ASPx.Browser.Safari && ASPx.Browser.Version <= 5.1)
7947   return false;
7948  try {
7949   if(document.styleSheets) {
7950    for(var i = 0; i < document.styleSheets.length; i++) {
7951     var styleSheet = document.styleSheets[i];
7952     if(styleSheet.cssRules) {
7953      for(var j = 0; j < styleSheet.cssRules.length; j++)
7954       for(var k = 0; k < ThemesWithRipple.length; k++)
7955        if(styleSheet.cssRules[j].cssText.indexOf(ThemesWithRipple[k]) !== -1)
7956         return true;
7957     }
7958    }
7959   }
7960  }
7961  catch(exc) { }
7962  return false;
7963 },
7964 ReInit: function() {
7965  this.isRippleFunctionalityEnabled = null;
7966  this.Init();
7967 },
7968 onDocumentMouseDown: function(evt) {
7969  if(RippleHelper.getIsRippleFunctionalityEnabled())
7970   RippleHelper.processMouseDown(evt);
7971 },
7972 getIsRippleFunctionalityEnabled: function() {
7973  if(!ASPx.IsExists(this.isRippleFunctionalityEnabled))
7974   this.isRippleFunctionalityEnabled = this.checkRippleFunctionality();
7975  return this.isRippleFunctionalityEnabled;
7976 },
7977   createTargetInfo: function(target) {
7978  return { 
7979   x: ASPx.GetAbsoluteX(target),
7980   y: ASPx.GetAbsoluteY(target),
7981   width: target.offsetWidth,
7982   height: target.offsetHeight,
7983   classNames: ASPx.GetClassNameList(target),
7984   getTarget: function() { return target; },
7985   getRect: function() { return {x: this.x, y: this.y, width: this.width, height: this.height }; }
7986  };
7987 },
7988 createEventInfo: function(evt) {
7989  return { x: this.getEventX(evt), y: this.getEventY(evt) };
7990 },
7991 processMouseDown: function(evt) {
7992  var evtSource = ASPx.Evt.GetEventSource(evt);
7993  var rippleTarget = this.getRippleTargetElement(evtSource);
7994  if(this.needToProcessRipple(rippleTarget, evtSource)) {
7995   var targetInfo = this.createTargetInfo(rippleTarget);
7996   this.initRippleProcess(targetInfo);
7997   this.processRipple(targetInfo, this.createEventInfo(evt));
7998  }
7999 },
8000 getRippleTargetElement: function(evtSource) {
8001  if(this.hasRippleMarker(evtSource))
8002   return evtSource;
8003  if(evtSource.tagName && evtSource.tagName.toLowerCase() == "input" && ASPx.ElementContainsCssClass(evtSource, "dxTI")) {
8004   var elements = ASPx.GetChildElementNodesByPredicate(evtSource.parentNode.parentNode, function(element) {
8005    return this.hasRippleMarker(element);
8006   }.aspxBind(this));
8007   return elements && elements[0];
8008  }
8009  return ASPx.GetParent(evtSource, function(element) {
8010   return this.hasRippleMarker(element);
8011  }.aspxBind(this));
8012 },
8013 hasRippleMarker: function(element) {
8014  if(!ASPx.IsExistsElement(element))
8015   return false;
8016  var computedStyles = window.getComputedStyle(element, ":before");
8017  if(ASPx.IsExists(computedStyles)) {
8018   var content = computedStyles.getPropertyValue("content");
8019   if(content.indexOf(this.rippleTargetExternalClassName) > -1) {
8020    ASPx.AddClassNameToElement(element, this.rippleTargetExternalClassName);
8021    return true;
8022   }
8023   return content.indexOf(this.rippleTargetClassName) > -1;
8024  }
8025  return false;
8026 },
8027 needToProcessRipple: function(rippleTarget, evtSource) {
8028  return rippleTarget && ASPx.AnimationUtils && !ASPx.GetParentByPartialClassName(rippleTarget, "Disabled") && 
8029   !ASPx.ElementContainsCssClass(rippleTarget, "dxgvBatchEditCell") && 
8030   !ASPx.ElementContainsCssClass(rippleTarget, "dxcvEditForm") &&
8031   !ASPx.GetParentByPartialClassName(evtSource, "dxcvFocusedCell") &&
8032   !(ASPx.ElementContainsCssClass(rippleTarget, "dxeCalendarDay") && ASPx.Str.Trim(rippleTarget.textContent) == "");
8033 },
8034 hasBothOverflow: function(style) {
8035  return style.overflow == "scroll" || style.overflow == "auto" || style.overflow == "hidden";
8036 },
8037 hasOverflowX: function(style) {
8038  return style.overflowX == "scroll" || style.overflowX == "auto" || style.overflowX == "hidden";
8039 },
8040 hasOverflowY: function(style) {
8041  return style.overflowY == "scroll" || style.overflowY == "auto" || style.overflowY == "hidden";
8042 },
8043 getExternalRippleContainerSize: function(targetRect) {
8044  if(ASPx.Browser.MobileUI) {
8045   var origTouchRadius = this.getOriginTouchRadius();
8046   if(origTouchRadius < targetRect.width || origTouchRadius < targetRect.height)
8047    origTouchRadius = Math.max(targetRect.width, targetRect.height);
8048   return {x: targetRect.x + (targetRect.width - origTouchRadius) / 2, y: targetRect.y + (targetRect.height - origTouchRadius) / 2, width: origTouchRadius, height: origTouchRadius };
8049  }
8050  var result = { x: 0, y: 0, width: 0, height: 0 };
8051  var diff = targetRect.width - targetRect.height;
8052  if(diff > 0) {
8053   result.x = targetRect.x;
8054   result.y = targetRect.y - diff / 2;
8055   result.width = targetRect.width;
8056   result.height = targetRect.width;
8057  } else {
8058   result.x = targetRect.x + diff / 2;
8059   result.y = targetRect.y;
8060   result.width = targetRect.height;
8061   result.height = targetRect.height;
8062  }
8063  return result;
8064 },
8065 getInternalContainerSize: function(targetInfo) {
8066  var parentWithOverflow = RippleHelper.getParentWithOverflow(targetInfo.getTarget());
8067  if(!ASPx.IsExists(parentWithOverflow))
8068   return targetInfo;
8069  var parentWithOverflowStyle = ASPx.GetCurrentStyle(parentWithOverflow);
8070  var bothOverflow = this.hasBothOverflow(parentWithOverflowStyle);
8071  var overflowX = this.hasOverflowX(parentWithOverflowStyle);
8072  var overflowY = this.hasOverflowY(parentWithOverflowStyle);
8073  var parentRect = {
8074   x: ASPx.GetAbsoluteX(parentWithOverflow),
8075   y: ASPx.GetAbsoluteY(parentWithOverflow),
8076   width: parentWithOverflow.offsetWidth,
8077   height: parentWithOverflow.offsetHeight
8078  };
8079  return this.getInternalContainerSizeCore(targetInfo, parentRect, bothOverflow, overflowX, overflowY);
8080 },
8081 getInternalContainerSizeCore: function(targetRect, parentRect, bothOverflow, overflowX, overflowY) {
8082  var result = {};
8083  ASPx.Data.MergeHashTables(result, targetRect);
8084  if(bothOverflow || overflowX) {
8085   result.x = targetRect.x < parentRect.x ? parentRect.x : targetRect.x;
8086   if(targetRect.x + targetRect.width > parentRect.x + parentRect.width)
8087    result.width = parentRect.x + parentRect.width - targetRect.x;
8088   if(parentRect.x > targetRect.x)
8089    result.width -= (parentRect.x - targetRect.x);
8090  }
8091  if(bothOverflow || overflowY) {
8092   result.y = targetRect.y < parentRect.y ? parentRect.y : targetRect.y;
8093   if(targetRect.y + targetRect.height > parentRect.y + parentRect.height)
8094    result.height = parentRect.y + parentRect.height - targetRect.y;
8095   if(parentRect.y > targetRect.y)
8096    result.height -= (parentRect.y - targetRect.y);
8097  }
8098  return result;
8099 },
8100 calculateRippleContainerSize: function(targetInfo, isExternalRipple) {
8101  return isExternalRipple ? this.getExternalRippleContainerSize(targetInfo) : this.getInternalContainerSize(targetInfo);
8102 },
8103 getParentWithOverflow: function(rippleTarget) {
8104  var result = ASPx.GetParent(rippleTarget, function(element) {
8105   var elementStyle = ASPx.GetCurrentStyle(element);
8106   return this.hasBothOverflow(elementStyle) || this.hasOverflowX(elementStyle) || this.hasOverflowY(elementStyle);
8107  }.aspxBind(this));
8108  return result;
8109 },
8110 getDuration: function(targetInfo) {
8111  return this.IsExternalRipple(targetInfo) || ASPx.Browser.MobileUI ? 650 : 450;
8112 },
8113 createRippleTransition: function(container, rippleElement, radius, targetInfo) {
8114  var rippleSize = 2 * radius;
8115  var transitionProperties = {
8116   width: { from: 0, to: rippleSize, transition: ASPx.AnimationConstants.Transitions.RIPPLE, propName: "width", unit: "px" },
8117   height: { from: 0, to: rippleSize, transition: ASPx.AnimationConstants.Transitions.RIPPLE, propName: "height", unit: "px" },
8118   marginLeft: { from: 0, to: -rippleSize / 2, transition: ASPx.AnimationConstants.Transitions.RIPPLE, propName: "marginLeft", unit: "px" },
8119   marginTop: { from: 0, to: -rippleSize / 2, transition: ASPx.AnimationConstants.Transitions.RIPPLE, propName: "marginTop", unit: "px" },
8120   opacity: { from: 1, to: 0.05, transition: ASPx.AnimationConstants.Transitions.RIPPLE, propName: "o
8120pacity", unit: "%" }
8121  };
8122  var rippleTransition = ASPx.AnimationUtils.createMultipleAnimationTransition(rippleElement, {
8123   transition: ASPx.AnimationConstants.Transitions.RIPPLE,
8124   duration: this.getDuration(targetInfo),
8125   onComplete: function(element) {
8126    ASPx.RemoveElement(container);
8127   }
8128  });
8129  rippleTransition.Start(transitionProperties);
8130 },
8131 calculateRadius: function(isExternalRipple, posX, posY, containerRect) {
8132  var radius = -1;
8133  if(isExternalRipple) {
8134   if(ASPx.Browser.MobileUI)
8135    radius = this.getOriginTouchRadius() / 2;
8136   else
8137    radius = Math.max(containerRect.height, containerRect.width);
8138  } else {
8139   var width1 = posX - containerRect.x;
8140   var width2 = containerRect.width - width1;
8141   var height1 = posY - containerRect.y;
8142   var height2 = containerRect.height - height1;
8143   var rippleWidth = Math.max(width1, width2);
8144   var rippleHeight = Math.max(height1, height2);
8145   radius = Math.sqrt(Math.pow(rippleHeight, 2) + Math.pow(rippleWidth, 2));
8146  }
8147  return radius;
8148 },
8149 createRippleElement: function(container, rippleCenter) {
8150  var rippleElement = document.createElement("DIV");
8151  rippleElement.className = this.rippleClassName;
8152  container.appendChild(rippleElement);
8153  ASPxClientUtils.SetAbsoluteX(rippleElement, rippleCenter.x);
8154  ASPxClientUtils.SetAbsoluteY(rippleElement, rippleCenter.y);
8155  return rippleElement;
8156 },
8157 processRipple: function(targetInfo, eventInfo) {
8158  var isExternalRipple = this.IsExternalRipple(targetInfo);
8159  var rippleCenter = this.getRippleCenter(targetInfo.getRect(), eventInfo, isExternalRipple);
8160  var container = this.createRippleContainer(targetInfo, isExternalRipple);
8161  var rippleElement = this.createRippleElement(container, rippleCenter);
8162  var radius = this.calculateRadius(isExternalRipple, rippleCenter.x, rippleCenter.y, this.getElementRect(container));
8163  this.createRippleTransition(container, rippleElement, radius, targetInfo);
8164 },
8165 initRippleProcess: function(targetInfo) {
8166  this.isMobileExternalRipple = null;
8167  this.zoom = screen.width / window.innerWidth;
8168  this.calculateParentsScroll(targetInfo);
8169 },
8170 calculateParentsScroll: function(targetInfo) {
8171  this.parentsScroll = { scrollLeft: 0, scrollTop: 0 };
8172  if(ASPx.Browser.MacOSMobilePlatform) {
8173   var parent = targetInfo.getTarget().parentNode;
8174   while(ASPx.IsExists(parent) && parent.tagName !== "BODY") {
8175    this.parentsScroll.scrollLeft += parent.scrollLeft;
8176    this.parentsScroll.scrollTop += parent.scrollTop;
8177    parent = parent.parentNode;
8178   }
8179  }
8180 },
8181 getRippleCenter: function(targetInfo, eventInfo, isExternalRipple) {
8182  var posX = 0;
8183  var posY = 0;
8184  if(isExternalRipple) {
8185   posX = targetInfo.x + targetInfo.width / 2;
8186   posY = targetInfo.y + targetInfo.height / 2;
8187  } else {
8188   posX = eventInfo.x;
8189   posY = eventInfo.y;
8190  }
8191  return {x: posX, y: posY};
8192 },
8193 createRippleContainer: function(targetInfo, isExternalRipple) {
8194  var containerParent = targetInfo.getTarget();
8195  if(!containerParent)
8196   return;
8197  var containerTagName = containerParent.tagName == "TR" ? "TD" : "DIV";
8198  var container = document.createElement(containerTagName);
8199  container.className = this.rippleContainerClassName;
8200  if(containerParent.parentNode && containerParent.tagName == "IMG")
8201   containerParent = containerParent.parentNode;
8202  containerParent.appendChild(container);
8203  if(isExternalRipple)
8204   container.style.borderRadius = "50%";
8205  var containerRect = this.calculateRippleContainerSize(targetInfo, isExternalRipple);
8206  this.assignContainerSettings(container, containerRect);
8207  return container;
8208 },
8209 assignContainerSettings: function(container, containerRect) {
8210  var properties = {
8211   height: containerRect.height,
8212   width: containerRect.width,
8213   left: ASPx.PrepareClientPosForElement(containerRect.x, container, true),
8214   top: ASPx.PrepareClientPosForElement(containerRect.y, container, false)
8215  };
8216  if(ASPx.Browser.MobileUI)
8217   ASPx.Data.MergeHashTables(properties, {marginTop: 0, marginLeft: 0 });
8218  ASPx.SetStyles(container, properties, ASPx.Browser.MobileUI);
8219 },
8220 IsExternalRipple: function(targetInfo) {
8221  var hasExternalRippleClassName = ASPx.ElementContainsCssClass(targetInfo.getTarget(), this.rippleTargetExternalClassName);
8222  if(!ASPx.Browser.MobileUI)
8223   return hasExternalRippleClassName;
8224  return hasExternalRippleClassName || this.IsMobileExternalRipple(targetInfo);
8225 },
8226 IsMobileExternalRipple: function(targetInfo) {
8227  if(this.isMobileExternalRipple == null) {
8228   var originTouchRadius = this.getOriginTouchRadius();
8229   this.isMobileExternalRipple = ASPx.Browser.MobileUI && targetInfo.width < originTouchRadius && targetInfo.height < originTouchRadius;
8230  }
8231  return this.isMobileExternalRipple;
8232 },
8233 RemoveRippleContainer: function(element) {
8234  var childs = ASPx.GetChildNodesByClassName(element, this.rippleContainerClassName);
8235  var rippleContainer = childs.length > 0 ? childs[0] : null;
8236  if(rippleContainer != null)
8237   rippleContainer.parentNode.removeChild(rippleContainer);
8238 },
8239 getEventX: function(evt) {
8240  var x = ASPxClientUtils.GetEventX(evt);
8241  if(ASPx.Browser.MacOSMobilePlatform)
8242   x += this.parentsScroll.scrollLeft;
8243  return ASPx.Browser.AndroidMobilePlatform ? x + window.pageXOffset : x;
8244 },
8245 getEventY: function(evt) {
8246  var y = ASPxClientUtils.GetEventY(evt);
8247  if(ASPx.Browser.MacOSMobilePlatform)
8248   y += this.parentsScroll.scrollTop;
8249  return ASPx.Browser.AndroidMobilePlatform ? y + window.pageYOffset : y;
8250 },
8251 getOriginTouchRadius: function() {
8252  return this.touchRadius / this.zoom;
8253 },
8254 getElementRect: function(element) {
8255  return { x: ASPx.GetAbsoluteX(element), y: ASPx.GetAbsoluteY(element), width: element.offsetWidth, height: element.offsetHeight };
8256 }
8257}
8258var AccessibilitySR = {
8259 AddStringResources: function(stringResourcesObj) {
8260  if(stringResourcesObj) {
8261   for(var key in stringResourcesObj)
8262    this[key] = stringResourcesObj[key];
8263  }
8264 }
8265};
8266ASPx.CollectionBase = CollectionBase;
8267ASPx.FunctionIsInCallstack = _aspxFunctionIsInCallstack;
8268ASPx.RaisePostHandlerOnPost = aspxRaisePostHandlerOnPost;
8269ASPx.GetPostHandler = aspxGetPostHandler;
8270ASPx.ProcessScriptsAndLinks = _aspxProcessScriptsAndLinks;
8271ASPx.InitializeLinks = _aspxInitializeLinks;
8272ASPx.InitializeScripts = _aspxInitializeScripts;
8273ASPx.RunStartupScripts = _aspxRunStartupScripts;
8274ASPx.IsStartupScriptsRunning = _aspxIsStartupScriptsRunning;
8275ASPx.AddScriptsRestartHandler = _aspxAddScriptsRestartHandler;
8276ASPx.GetFocusedElement = _aspxGetFocusedElement;
8277ASPx.GetDomObserver = _aspxGetDomObserver;
8278ASPx.CacheHelper = CacheHelper;
8279ASPx.ControlTree = ControlTree;
8280ASPx.ControlCallbackHandlersQueue = ControlCallbackHandlersQueue;
8281ASPx.ResourceManager = ResourceManager;
8282ASPx.UpdateWatcherHelper = UpdateWatcherHelper;
8283ASPx.EventStorage = EventStorage;
8284ASPx.GetGlobalObject = GetGlobalObject;
8285ASPx.GetExternalScriptProcessor = GetExternalScriptProcessor;
8286ASPx.CheckBoxCheckState = CheckBoxCheckState;
8287ASPx.CheckBoxInputKey = CheckBoxInputKey;
8288ASPx.CheckableElementStateController = CheckableElementStateController;
8289ASPx.CheckableElementHelper = CheckableElementHelper;
8290ASPx.CheckBoxInternal = CheckBoxInternal;
8291ASPx.CheckBoxInternalCollection = CheckBoxInternalCollection;
8292ASPx.ControlCallbackQueueHelper = ControlCallbackQueueHelper;
8293ASPx.EditorStyleDecoration = EditorStyleDecoration;
8294ASPx.AccessibilitySR = AccessibilitySR;
8295ASPx.KbdHelper = KbdHelper;
8296ASPx.AccessKeysHelper = AccessKeysHelper;
8297ASPx.AccessKey = AccessKey;
8298ASPx.IFrameHelper = IFrameHelper;
8299ASPx.Ident = Ident;
8300ASPx.TouchUIHelper = TouchUIHelper;
8301ASPx.ControlUpdateWatcher = ControlUpdateWatcher;
8302ASPx.AccessibilityHelperBase = AccessibilityHelperBase;
8303ASPx.RippleHelper = RippleHelper;
8304ASPx.ThemesWithRipple = ThemesWithRipple;
8305window.ASPxClientEvent = ASPxClientEvent;
8306window.ASPxClientEventArgs = ASPxClientEventArgs;
8307window.ASPxClientCancelEventArgs = ASPxClientCancelEventArgs;
8308window.ASPxClientProcessingModeEventArgs = ASPxClientProcessingModeEventArgs;
8309window.ASPxClientProcessingModeCancelEventArgs = ASPxClientProcessingModeCancelEventArgs;
8310ASPx.Evt.AttachEventToDocument(TouchUIHelper.touchMouseDownEventName, RippleHelper.onDocumentMouseDown);
8311ASPx.classesScriptParsed = true;
8312})();
8313
8314(function () {
8315ASPx.StateItemsExist = false;
8316ASPx.FocusedItemKind = "FocusedStateItem";
8317ASPx.HoverItemKind = "HoverStateItem";
8318ASPx.PressedItemKind = "PressedStateItem";
8319ASPx.SelectedItemKind = "SelectedStateItem";
8320ASPx.DisabledItemKind = "DisabledStateItem";
8321ASPx.CachedStatePrefix = "cached";
8322ASPxStateItem = ASPx.CreateClass(null, {
8323 constructor: function(name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, kind, disableApplyingStyleToLink){
8324  this.name = name;
8325  this.classNames = classNames;
8326  this.customClassNames = [];
8327  this.resultClassNames = [];
8328  this.cssTexts = cssTexts;
8329  this.postfixes = postfixes;
8330  this.imageObjs = imageObjs;
8331  this.imagePostfixes = imagePostfixes;
8332  this.kind = kind;
8333  this.classNamePostfix = kind.substr(0, 1).toLowerCase();
8334  this.enabled = true;
8335  this.needRefreshBetweenElements = false;
8336  this.elements = null;
8337  this.images = null;
8338  this.links = [];
8339  this.linkColor = null;
8340  this.linkTextDecoration = null;
8341  this.disableApplyingStyleToLink = !!disableApplyingStyleToLink; 
8342 },
8343 GetCssText: function(index){
8344  if(ASPx.IsExists(this.cssTexts[index]))
8345   return this.cssTexts[index];
8346  return this.cssTexts[0];
8347 },
8348 CreateStyleRule: function(index){
8349  if(this.GetCssText(index) == "") return "";
8350  var styleSheet = ASPx.GetCurrentStyleSheet();
8351  if(styleSheet)
8352   return ASPx.CreateImportantStyleRule(styleSheet, this.GetCssText(index), this.classNamePostfix);  
8353  return ""; 
8354 },
8355 GetClassName: function(index){
8356  if(ASPx.IsExists(this.classNames[index]))
8357   return this.classNames[index];
8358  return this.classNames[0];
8359 },
8360 GetResultClassName: function(index){
8361  if(!ASPx.IsExists(this.resultClassNames[index])) {
8362   if(!ASPx.IsExists(this.customClassNames[index]))
8363    this.customClassNames[index] = this.CreateStyleRule(index);
8364   if(this.GetClassName(index) != "" && this.customClassNames[index] != "")
8365    this.resultClassNames[index] = this.GetClassName(index) + " " + this.customClassNames[index];
8366   else if(this.GetClassName(index) != "")
8367    this.resultClassNames[index] = this.GetClassName(index);
8368   else if(this.customClassNames[index] != "")
8369    this.resultClassNames[index] = this.customClassNames[index];
8370   else
8371    this.resultClassNames[index] = "";
8372  }
8373  return this.resultClassNames[index];
8374 },
8375 GetElements: function(element){
8376  if(!this.elements || !ASPx.IsValidElements(this.elements)){
8377   if(this.postfixes && this.postfixes.length > 0){
8378    this.elements = [ ];
8379    var parentNode = element.parentNode;
8380    if(parentNode){
8381     for(var i = 0; i < this.postfixes.length; i++){
8382      var id = this.name + this.postfixes[i];
8383      this.elements[i] = ASPx.GetChildById(parentNode, id);
8384      if(!this.elements[i])
8385       this.elements[i] = ASPx.GetElementById(id);
8386     }
8387    }
8388   }
8389   else
8390    this.elements = [element];
8391  }
8392  return this.elements;
8393 },
8394 GetImages: function(element){
8395  if(!this.images || !ASPx.IsValidElements(this.images)){
8396   this.images = [ ];
8397   if(this.imagePostfixes && this.imagePostfixes.length > 0){
8398    var elements = this.GetElements(element);
8399    for(var i = 0; i < this.imagePostfixes.length; i++){
8400     var id = this.name + this.imagePostfixes[i];
8401     for(var j = 0; j < elements.length; j++){
8402      if(!elements[j]) continue;
8403      if(elements[j].id == id)
8404       this.images[i] = elements[j];
8405      else
8406       this.images[i] = ASPx.GetChildById(elements[j], id);
8407      if(this.images[i])
8408       break;
8409     }
8410    }
8411   }
8412  }
8413  return this.images;
8414 },
8415 Apply: function(element){
8416  if(!this.enabled) return;
8417  try{
8418   this.ApplyStyle(element);
8419   if(this.imageObjs && this.imageObjs.length > 0)
8420    this.ApplyImage(element);
8421   if(ASPx.Browser.IE && ASPx.Browser.MajorVersion >= 11)
8422    this.ForceRedrawAppearance(element);
8423  }
8424  catch(e){
8425  }
8426 },
8427 ApplyStyle: function(element){
8428  var elements = this.GetElements(element);
8429  for(var i = 0; i < elements.length; i++){
8430   if(!elements[i]) continue;
8431   var className = elements[i].className.replace(this.GetResultClassName(i), "");
8432   elements[i].className = ASPx.Str.Trim(className) + " " + this.GetResultClassName(i);
8433   if(!ASPx.Browser.Opera || ASPx.Browser.Version >= 9)
8434    this.ApplyStyleToLinks(elements, i);
8435  }
8436 },
8437 ApplyStyleToLinks: function(elements, index){
8438  if(this.disableApplyingStyleToLink)
8439   return;
8440  if(!ASPx.IsValidElements(this.links[index]))
8441   this.links[index] = ASPx.GetNodesByTagName(elements[index], "A");
8442  for(var i = 0; i < this.links[index].length; i++)
8443   this.ApplyStyleToLinkElement(this.links[index][i], index);
8444 },
8445 ApplyStyleToLinkElement: function(link, index){
8446  if(this.GetLinkColor(index) != "")
8447   ASPx.Attr.ChangeAttributeExtended(link.style, "color", link, "saved" + this.kind + "Color", this.GetLinkColor(index));
8448  if(this.GetLinkTextDecoration(index) != "")
8449   ASPx.Attr.ChangeAttributeExtended(link.style, "textDecoration", link, "saved" + this.kind + "TextDecoration", this.GetLinkTextDecoration(index));
8450 },
8451 ApplyImage: function(element){
8452  var images = this.GetImages(element);
8453  for(var i = 0; i < images.length; i++){
8454   if(!images[i] || !this.imageObjs[i]) continue;
8455   var useSpriteImage = typeof(this.imageObjs[i]) != "string";
8456   var newUrl = "", newCssClass = "", newBackground = "";
8457   if(useSpriteImage){
8458    newUrl = ASPx.EmptyImageUrl;           
8459    if(this.imageObjs[i].spriteCssClass) 
8460     newCssClass = this.imageObjs[i].spriteCssClass;
8461    if(this.imageObjs[i].spriteBackground)
8462     newBackground = this.imageObjs[i].spriteBackground;
8463   }
8464   else{
8465    newUrl = this.imageObjs[i];
8466    if(ASPx.Attr.IsExistsAttribute(images[i].style, "background"))   
8467     newBackground = " ";
8468   }
8469   if(newUrl != "")
8470    ASPx.Attr.ChangeAttributeExtended(images[i], "src", images[i], "saved" + this.kind + "Src", newUrl);
8471   if(newCssClass != "")
8472    this.ApplyImageClassName(images[i], newCssClass);
8473   if(newBackground != ""){
8474    if(ASPx.Browser.WebKitFamily) {
8475     var savedBackground = ASPx.Attr.GetAttribute(images[i].style, "background");
8476     if(!useSpriteImage)
8477      savedBackground += " " + images[i].style["backgroundPosition"];
8478     ASPx.Attr.SetAttribute(images[i], "saved" + this.kind + "Background", savedBackground);
8479     ASPx.Attr.SetAttribute(images[i].style, "background", newBackground);
8480    }
8481    else
8482     ASPx.Attr.ChangeAttributeExtended(images[i].style, "background", images[i], "saved" + this.kind + "Background", newBackground);
8483   }     
8484  }
8485 },
8486 ApplyImageClassName: function(element, newClassName){
8487  if(ASPx.Attr.GetAttribute(element, "saved" + this.kind + "ClassName"))
8488   this.CancelImageClassName(element);
8489  var className = element.className
8490  ASPx.Attr.SetAttribute(element, "saved" + this.kind + "ClassName", className);
8491  element.className = className + " " + newClassName;
8492 },
8493 Cancel: function(element){
8494  if(!this.enabled) return;
8495  try{  
8496   if(this.imageObjs && this.imageObjs.length > 0)
8497    this.CancelImage(element);
8498   this.CancelStyle(element);
8499  }
8500  catch(e){
8501  }
8502 },
8503 CancelStyle: function(element){
8504  var elements = this.GetElements(element);
8505  for(var i = 0; i < elements.length; i++){
8506   if(!elements[i]) continue;
8507   var className = ASPx.Str.Trim(elements[i].className.replace(this.GetResultClassName(i), ""));
8508   elements[i].className = className;
8509   if(!ASPx.Browser.Opera || ASPx.Browser.Version >= 9)
8510    this.CancelStyleFromLinks(elements, i);
8511  }
8512 },
8513 CancelStyleFromLinks: function(elements, index){
8514  if(this.disableApplyingStyleToLink)
8515   return;
8516  if(!ASPx.IsValidElements(this.links[index]))
8517   this.links[index] = ASPx.GetNodesByTagName(elements[index], "A");
8518  for(var i = 0; i < this.links[index].length; i++)
8519   this.CancelStyleFromLinkElement(this.links[index][i], index);
8520 },
8521 CancelStyleFromLinkElement: function(link, index){
8522  if(this.GetLinkColor(index) != "")
8523   ASPx.Attr.RestoreAttributeExtended(link.style, "color", link, "saved" + this.kind + "Color");
8524  if(this.GetLinkTextDecoration(index) != "")
8525   ASPx.Attr.RestoreAttributeExtended(link.style, "textDecoration", link, "saved" + this.kind + "TextDecoration");
8526 },
8527 CancelImage: function(element){
8528  var images = this.GetImages(element);
8529  for(var i = 0; i < images.length; i++){
8530   if(!images[i] || !this.imageObjs[i]) continue;
8531   ASPx.Attr.RestoreAttributeExtended(images[i], "src", images[i], "saved" + this.kind + "Src");
8532   this.CancelImageClassName(images[i]);
8533   ASPx.Attr.RestoreAttributeExtended(images[i].style, "background", images[i], "saved" + this.kind + "Background");
8534  }
8535 },
8536 CancelImageClassName: function(element){
8537  var savedClassName = ASPx.Attr.GetAttribute(element, "saved" + this.kind + "ClassName");
8538  if(ASPx.IsExists(savedClassName)) {
8539   element.className = savedClassName;
8540   ASPx.Attr.RemoveAttribute(element, "saved" + this.kind + "ClassName");
8541  }
8542 },
8543 Clone: function(){
8544  return new ASPxStateItem(this.name, this.classNames, this.cssTexts, this.postfixes, 
8545   this.imageObjs, this.imagePostfixes, this.kind, this.disableApplyingStyleToLink);
8546 },
8547 IsChildElement: function(element){
8548  if(element != null){
8549   var elements = this.GetElements(element);
8550   for(var i = 0; i < elements.length; i++){
8551    if(!elements[i]) continue;
8552    if(ASPx.GetIsParent(elements[i], element)) 
8553     return true;
8554   }
8555  }
8556  return false;
8557 },
8558 ForceRedrawAppearance: function(element) {
8559  if(!aspxGetStateController().IsForceRedrawAppearanceLocked()) {
8560   var value = element.style.opacity;
8561   element.style.opacity = "0.7777";
8562   var dummy = element.offsetWidth;
8563   element.style.opacity = value;
8564  }
8565 },
8566 GetLinkColor: function(index){
8567  if(!ASPx.IsExists(this.linkColor)){
8568   var rule = ASPx.GetStyleSheetRules(this.customClassNames[index]);
8569   this.linkColor = rule ? rule.style.color : null;
8570   if(!ASPx.IsExists(this.linkColor)){
8571    var rule = ASPx.GetStyleSheetRules(this.GetClassName(index));
8572    this.linkColor = rule ? rule.style.color : null;
8573   }
8574   if(this.linkColor == null) 
8575    this.linkColor = "";
8576  }
8577  return this.linkColor;
8578 },
8579 GetLinkTextDecoration: function(index){
8580  if(!ASPx.IsExists(this.linkTextDecoration)){
8581   var rule = ASPx.GetStyleSheetRules(this.customClassNames[index]);
8582   this.linkTextDecoration = rule ? rule.style.textDecoration : null;
8583   if(!ASPx.IsExists(this.linkTextDecoration)){
8584    var rule = ASPx.GetStyleSheetRules(this.GetClassName(index));
8585    this.linkTextDecoration = rule ? rule.style.textDecoration : null;
8586   }
8587   if(this.linkTextDecoration == null) 
8588    this.linkTextDecoration = "";
8589  }
8590  return this.linkTextDecoration;
8591 }
8592});
8593ASPxClientStateEventArgs = ASPx.CreateClass(null, {
8594 constructor: function(item, element){
8595  this.item = item;
8596  this.element = element;
8597  this.toElement = null;
8598  this.fromElement = null;
8599  this.htmlEvent = null;
8600 }
8601});
8602ASPxStateController = ASPx.CreateClass(null, {
8603 constructor: function(){
8604  this.focusedItems = { };
8605  this.hoverItems = { };
8606  this.pressedItems = { };
8607  this.selectedItems = { };
8608  this.disabledItems = { };
8609  this.disabledScheme = {};
8610  this.currentFocusedElement = null;
8611  this.currentFocusedItemName = null;
8612  this.currentHoverElement = null;
8613  this.currentHoverItemName = null;
8614  this.currentPressedElement = null;
8615  this.currentPressedItemName = null;
8616  this.savedCurrentPressedElement = null;
8617  this.savedCurrentMouseMoveSrcElement = null;
8618  this.forceRedrawAppearanceLockCount = 0;
8619  this.AfterSetFocusedState = new ASPxClientEvent();
8620  this.AfterClearFocusedState = new ASPxClientEvent();
8621  this.AfterSetHoverState = new ASPxClientEvent();
8622  this.AfterClearHoverState = new ASPxClientEvent();
8623  this.AfterSetPressedState = new ASPxClientEvent();
8624  this.AfterClearPressedState = new ASPxClientEvent();
8625  this.AfterDisabled = new ASPxClientEvent();
8626  this.AfterEnabled = new ASPxClientEvent();
8627  this.BeforeSetFocusedState = new ASPxClientEvent();
8628  this.BeforeClearFocusedState = new ASPxClientEvent();
8629  this.BeforeSetHoverState = new ASPxClientEvent();
8630  this.BeforeClearHoverState = new ASPxClientEvent();
8631  this.BeforeSetPressedState = new ASPxClientEvent();
8632  this.BeforeClearPressedState = new ASPxClientEvent();
8633  this.BeforeDisabled = new ASPxClientEvent();
8634  this.BeforeEnabled = new ASPxClientEvent();
8635  this.FocusedItemKeyDown = new ASPxClientEvent();
8636 }, 
8637 AddHoverItem: function(name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, disableApplyingStyleToLink){
8638  this.AddItem(this.hoverItems, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, ASPx.HoverItemKind, disableApplyingStyleToLink);
8639  this.AddItem(this.focusedItems, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, ASPx.FocusedItemKind, disableApplyingStyleToLink);
8640 },
8641 AddPressedItem: function(name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes ,disableApplyingStyleToLink){
8642  this.AddItem(this.pressedItems, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, ASPx.PressedItemKind, disableApplyingStyleToLink);
8643 },
8644 AddSelectedItem: function(name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, disableApplyingStyleToLink){
8645  this.AddItem(this.selectedItems, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, ASPx.SelectedItemKind, disableApplyingStyleToLink);
8646 },
8647 AddDisabledItem: function (name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, disableApplyingStyleToLink, rootId) {
8648  this.AddItem(this.disabledItems, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes,
8649   ASPx.DisabledItemKind, disableApplyingStyleToLink, this.addIdToDisabledItemScheme, rootId);
8650 },
8651 addIdToDisabledItemScheme: function(rootId, childId) {
8652  if (!rootId)
8653   return;
8654  if (!this.disabledScheme[rootId])
8655   this.disabledScheme[rootId] = [rootId];
8656  if (childId && (rootId != childId) && ASPx.Data.ArrayIndexOf(this.disabledScheme[rootId], childId) == -1)
8657   this.disabledScheme[rootId].push(childId);
8658 },
8659 removeIdFromDisabledItemScheme: function(rootId, childId) {
8660  if (!rootId || !this.disabledScheme[rootId])
8661   return;
8662  ASPx.Data.ArrayRemove(this.disabledScheme[rootId], childId);
8663  if (this.disabledScheme[rootId].length == 0)
8664   delete this.disabledScheme[rootId];
8665 },
8666 AddItem: function (items, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, kind, disableApplyingStyleToLink, onAdd, rootId) {
8667  var stateItem = new ASPxStateItem(name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, kind, disableApplyingStyleToLink);
8668  if (postfixes && postfixes.length > 0) {
8669   for (var i = 0; i < postfixes.length; i++) {
8670    items[name + postfixes[i]] = stateItem;
8671    if (onAdd)
8672     onAdd.call(this, rootId, name + postfixes[i]);
8673   }
8674  }
8675  else {
8676   if (onAdd)
8677    onAdd.call(this, rootId, name);
8678   items[name] = stateItem;
8679  }
8680  ASPx.StateItemsExist = true;
8681 },
8682 RemoveHoverItem: function(name, postfixes){
8683  this.RemoveItem(this.hoverItems, name, postfixes);
8684  this.RemoveItem(this.focusedItems, name, postfixes);
8685 },
8686 RemovePressedItem: function(name, postfixes){
8687  this.RemoveItem(this.pressedItems, name, postfixes);
8688 },
8689 RemoveSelectedItem: function(name, postfixes){
8690  this.RemoveItem(this.selectedItems, name, postfixes);
8691 },
8692 RemoveDisabledItem: function (name, postfixes, rootId) {
8693  this.RemoveItem(this.disabledItems, name, postfixes, this.removeIdFromDisabledItemScheme, rootId);
8694 },
8695 RemoveItem: function (items, name, postfixes, onRemove, rootId) {
8696  if (postfixes && postfixes.length > 0) {
8697   for (var i = 0; i < postfixes.length; i++) {
8698    delete items[name + postfixes[i]];
8699    if (onRemove)
8700     onRemove.call(this, rootId, name + postfixes[i]);
8701   }
8702  }
8703  else {
8704   delete items[name];
8705   if (onRemove)
8706    onRemove.call(this, rootId, name);
8707  }
8708 },
8709 RemoveDisposedItems: function(){
8710  this.RemoveDisposedItemsByType(this.hoverItems);
8711  this.RemoveDisposedItemsByType(this.pressedItems);
8712  this.RemoveDisposedItemsByType(this.focusedItems);
8713  this.RemoveDisposedItemsByType(this.selectedItems);
8714  this.RemoveDisposedItemsByType(this.disabledItems);
8715  this.RemoveDisposedItemsByType(this.disabledScheme);
8716 },
8717 RemoveDisposedItemsByType: function(items){
8718  for(var key in items) {
8719   var item = items[key];
8720   var element = document.getElementById(key);
8721   if(!element || !ASPx.IsValidElement(element))
8722    delete items[key];
8723   try{
8724    if(item && item.elements) {
8725     for(var i = 0; i < item.elements.length; i++) {
8726      if(!ASPx.IsValidElements(item.links[i]))
8727       item.links[i] = null;
8728     }
8729    }
8730   }
8731   catch(e){
8732   }
8733  }
8734 },
8735 GetFocusedElement: function(srcElement){
8736  return this.GetItemElement(srcElement, this.focusedItems, ASPx.FocusedItemKind);
8737 },
8738 GetHoverElement: function(srcElement){
8739  return this.GetItemElement(srcElement, this.hoverItems, ASPx.HoverItemKind);
8740 },
8741 GetPressedElement: function(srcElement){
8742  return this.GetItemElement(srcElement, this.pressedItems, ASPx.PressedItemKind);
8743 },
8744 GetSelectedElement: function(srcElement){
8745  return this.GetItemElement(srcElement, this.selectedItems, ASPx.SelectedItemKind);
8746 },
8747 GetDisabledElement: function(srcElement){
8748  return this.GetItemElement(srcElement, this.disabledItems, ASPx.DisabledItemKind);
8749 },
8750 GetItemElement: function(srcElement, items, kind){
8751  if(srcElement && srcElement[ASPx.CachedStatePrefix + kind]){
8752   var cachedElement = srcElement[ASPx.CachedStatePrefix + kind];
8753   if(cachedElement != ASPx.EmptyObject)
8754    return cachedElement;
8755   return null;
8756  }
8757  var element = srcElement;
8758  while(element != null) {
8759   var item = items[element.id];
8760   if(item){
8761    this.CacheItemElement(srcElement, kind, element);
8762    element[kind] = item;
8763    return element;
8764   }
8765   element = element.parentNode;
8766  }
8767  this.CacheItemElement(srcElement, kind, ASPx.EmptyObject);
8768  return null;
8769 },
8770 CacheItemElement: function(srcElement, kind, value){
8771  if(srcElement && !srcElement[ASPx.CachedStatePrefix + kind])
8772   srcElement[ASPx.CachedStatePrefix + kind] = value;
8773 },
8774 DoSetFocusedState: function(element, fromElement){
8775  var item = element[ASPx.FocusedItemKind];
8776  if(item){
8777   var args = new ASPxClientStateEventArgs(item, element);
8778   args.fromElement = fromElement;
8779   this.BeforeSetFocusedState.FireEvent(this, args);
8780   item.Apply(element);
8781   this.AfterSetFocusedState.FireEvent(this, args);
8782  }
8783 },
8784 DoClearFocusedState: function(element, toElement){
8785  var item = element[ASPx.FocusedItemKind];
8786  if(item){
8787   var args = new ASPxClientStateEventArgs(item, element);
8788   args.toElement = toElement;
8789   this.BeforeClearFocusedState.FireEvent(this, args);
8790   item.Cancel(element);
8791   this.AfterClearFocusedState.FireEvent(this, args);
8792  }
8793 },
8794 DoSetHoverState: function(element, fromElement){
8795  var item = element[ASPx.HoverItemKind];
8796  if(item){
8797   var args = new ASPxClientStateEventArgs(item, element);
8798   args.fromElement = fromElement;
8799   this.BeforeSetHoverState.FireEvent(this, args);
8800   item.Apply(element);
8801   this.AfterSetHoverState.FireEvent(this, args);
8802  }
8803 },
8804 DoClearHoverState: function(element, toElement){
8805  var item = element[ASPx.HoverItemKind];
8806  if(item){
8807   var args = new ASPxClientStateEventArgs(item, element);
8808   args.toElement = toElement;
8809   this.BeforeClearHoverState.FireEvent(this, args);
8810   item.Cancel(element);
8811   this.AfterClearHoverState.FireEvent(this, args);
8812  }
8813 },
8814 DoSetPressedState: function(element){
8815  var item = element[ASPx.PressedItemKind];
8816  if(item){
8817   var args = new ASPxClientStateEventArgs(item, element);
8818   this.BeforeSetPressedState.FireEvent(this, args);
8819   item.Apply(element);
8820   this.AfterSetPressedState.FireEvent(this, args);
8821  }
8822 },
8823 DoClearPressedState: function(element){
8824  var item = element[ASPx.PressedItemKind];
8825  if(item){
8826   var args = new ASPxClientStateEventArgs(item, element);
8827   this.BeforeClearPressedState.FireEvent(this, args);
8828   item.Cancel(element);
8829   this.AfterClearPressedState.FireEvent(this, args);
8830  }
8831 },
8832 SetCurrentFocusedElement: function(element){
8833  if(this.currentFocusedElement && !ASPx.IsValidElement(this.currentFocusedElement)){
8834   this.currentFocusedElement = null;
8835   this.currentFocusedItemName = "";
8836  }
8837  if(this.currentFocusedElement != element){
8838   var oldCurrentFocusedElement = this.currentFocusedElement;
8839   var item = (element != null) ? element[ASPx.FocusedItemKind] : null;
8840   var itemName = (item != null) ? item.name : "";
8841   if(this.currentFocusedItemName != itemName){
8842    if(this.currentHoverItemName != "")
8843     this.SetCurrentHoverElement(null);
8844    if(this.currentFocusedElement != null)
8845     this.DoClearFocusedState(this.currentFocusedElement, element);
8846    this.currentFocusedElement = element;
8847    item = (element != null) ? element[ASPx.FocusedItemKind] : null;
8848    this.currentFocusedItemName = (item != null) ? item.name : "";
8849    if(this.currentFocusedElement != null)
8850     this.DoSetFocusedState(this.currentFocusedElement, oldCurrentFocusedElement);
8851   }
8852  }
8853 },
8854 SetCurrentHoverElement: function(element){
8855  if(this.currentHoverElement && !ASPx.IsValidElement(this.currentHoverElement)){
8856   this.currentHoverElement = null;
8857   this.currentHoverItemName = "";
8858  }
8859  var item = (element != null) ? element[ASPx.HoverItemKind] : null;
8860  if(item && !item.enabled) { 
8861   element = this.GetItemElement(element.parentNode, this.hoverItems, ASPx.HoverItemKind);
8862   item = (element != null) ? element[ASPx.HoverItemKind] : null;
8863  }
8864  if(this.currentHoverElement != element){
8865   var oldCurrentHoverElement = this.currentHoverElement,
8866    itemName = (item != null) ? item.name : "";
8867   if(this.currentHoverItemName != itemName || (item != null && item.needRefreshBetweenElements)){
8868    if(this.currentHoverElement != null)
8869     this.DoClearHoverState(this.currentHoverElement, element);
8870    item = (element != null) ? element[ASPx.HoverItemKind] : null;
8871    if(item == null || item.enabled){
8872     this.currentHoverElement = element;
8873     this.currentHoverItemName = (item != null) ? item.name : "";
8874     if(this.currentHoverElement != null)
8875      this.DoSetHoverState(this.currentHoverElement, oldCurrentHoverElement);
8876    }
8877   }
8878  }
8879 },
8880 SetCurrentPressedElement: function(element){
8881  if(this.currentPressedElement && !ASPx.IsValidElement(this.currentPressedElement)){
8882   this.currentPressedElement = null;
8883   this.currentPressedItemName = "";
8884  }
8885  if(this.currentPressedElement != element){
8886   if(this.currentPressedElement != null)
8887    this.DoClearPressedState(this.currentPressedElement);
8888   var item = (element != null) ? element[ASPx.PressedItemKind] : null;
8889   if(item == null || item.enabled){
8890    this.currentPressedElement = element;
8891    this.currentPressedItemName = (item != null) ? item.name : "";
8892    if(this.currentPressedElement != null)
8893     this.DoSetPressedState(this.currentPressedElement);
8894   }
8895  }
8896 },
8897 SetCurrentFocusedElementBySrcElement: function(srcElement){
8898  var element = this.GetFocusedElement(srcElement);
8899  this.SetCurrentFocusedElement(element);
8900 },
8901 SetCurrentHoverElementBySrcElement: function(srcElement){
8902  var element = this.GetHoverElement(srcElement);
8903  this.SetCurrentHoverElement(element);
8904 },
8905 SetCurrentPressedElementBySrcElement: function(srcElement){
8906  var element = this.GetPressedElement(srcElement);
8907  this.SetCurrentPressedElement(element);
8908 },
8909 SetPressedElement: function (element) {
8910  this.SetCurrentHoverElement(null);
8911  this.SetCurrentPressedElementBySrcElement(element);
8912  this.savedCurrentPressedElement = this.currentPressedElement;
8913 },
8914 SelectElement: function (element) {
8915  var item = element[ASPx.SelectedItemKind];
8916  if(item)
8917   item.Apply(element);
8918 }, 
8919 SelectElementBySrcElement: function(srcElement){
8920  var element = this.GetSelectedElement(srcElement);
8921  if(element != null) this.SelectElement(element);
8922 }, 
8923 DeselectElement: function(element){
8924  var item = element[ASPx.SelectedItemKind];
8925  if(item)
8926   item.Cancel(element);
8927 }, 
8928 DeselectElementBySrcElement: function(srcElement){
8929  var element = this.GetSelectedElement(srcElement);
8930  if(element != null) this.DeselectElement(element);
8931 },
8932 SetElementEnabled: function(element, enable){
8933  if(enable)
8934   this.EnableElement(element);
8935  else
8936   this.DisableElement(element);
8937 },
8938 SetElementWithChildNodesEnabled: function (parentName, enabled) {
8939  var procFunct = (enabled ? this.EnableElement : this.DisableElement);
8940  var childItems = this.disabledScheme[parentName];
8941  if (childItems && childItems.length > 0)
8942   for (var i = 0; i < childItems.length; i++) {
8943    procFunct.call(this, document.getElementById(childItems[i]));
8944   }
8945 },
8946 DisableElement: function (element) {
8947  var element = this.GetDisabledElement(element);
8948  if(element != null) {
8949   var item = element[ASPx.DisabledItemKind];
8950   if(item){
8951    var args = new ASPxClientStateEventArgs(item, element);
8952    this.BeforeDisabled.FireEvent(this, args);
8953    if(item.name == this.currentPressedItemName)
8954     this.SetCurrentPressedElement(null);
8955    if(item.name == this.currentHoverItemName)
8956     this.SetCurrentHoverElement(null);
8957    item.Apply(element);
8958    this.SetMouseStateItemsEnabled(item.name, item.postfixes, false);
8959    this.AfterDisabled.FireEvent(this, args);
8960   }
8961  }
8962 }, 
8963 EnableElement: function(element){
8964  var element = this.GetDisabledElement(element);
8965  if(element != null) {
8966   var item = element[ASPx.DisabledItemKind];
8967   if(item){
8968    var args = new ASPxClientStateEventArgs(item, element);
8969    this.BeforeEnabled.FireEvent(this, args);
8970    item.Cancel(element);
8971    this.SetMouseStateItemsEnabled(item.name, item.postfixes, true);
8972    this.AfterEnabled.FireEvent(this, args);
8973   }
8974  }
8975 }, 
8976 SetMouseStateItemsEnabled: function(name, postfixes, enabled){   
8977  if(postfixes && postfixes.length > 0){
8978   for(var i = 0; i < postfixes.length; i ++){
8979    this.SetItemsEnabled(this.hoverItems, name + postfixes[i], enabled);
8980    this.SetItemsEnabled(this.pressedItems, name + postfixes[i], enabled);
8981    this.SetItemsEnabled(this.focusedItems, name + postfixes[i], enabled);
8982   }
8983  }
8984  else{
8985   this.SetItemsEnabled(this.hoverItems, name, enabled);
8986   this.SetItemsEnabled(this.pressedItems, name, enabled);
8987   this.SetItemsEnabled(this.focusedItems, name, enabled);
8988  }  
8989 },
8990 SetItemsEnabled: function(items, name, enabled){   
8991  if(items[name])
8992   items[name].enabled = enabled;
8993 },
8994 OnFocusMove: function(evt){
8995  var element = ASPx.Evt.GetEventSource(evt);
8996  aspxGetStateController().SetCurrentFocusedElementBySrcElement(element);
8997 },
8998 OnMouseMove: function(evt, checkElementChanged){
8999  var srcElement = ASPx.Evt.GetEventSource(evt);
9000  if(checkElementChanged && srcElement == this.savedCurrentMouseMoveSrcElement) return;
9001  this.savedCurrentMouseMoveSrcElement = srcElement;
9002  if(ASPx.Browser.IE && !ASPx.Evt.IsLeftButtonPressed(evt) && this.savedCurrentPressedElement != null)
9003   this.ClearSavedCurrentPressedElement();
9004  if(this.savedCurrentPressedElement == null)
9005   this.SetCurrentHoverElementBySrcElement(srcElement);
9006  else{
9007   var element = this.GetPressedElement(srcElement);
9008   if(element != this.currentPressedElement){
9009    if(element == this.savedCurrentPressedElement)
9010     this.SetCurrentPressedElement(this.savedCurrentPressedElement);
9011    else
9012     this.SetCurrentPressedElement(null);
9013   }
9014  }
9015 },
9016 OnMouseDown: function(evt){
9017  if(!ASPx.Evt.IsLeftButtonPressed(evt)) return;
9018  var srcElement = ASPx.Evt.GetEventSource(evt);
9019  this.OnMouseDownOnElement(srcElement);
9020 },
9021 OnMouseDownOnElement: function (element) {
9022  if(this.GetPressedElement(element) == null) return;
9023  this.SetPressedElement(element);
9024 },
9025 OnMouseUp: function(evt){
9026  var srcElement = ASPx.Evt.GetEventSource(evt);
9027  this.OnMouseUpOnElement(srcElement);
9028 },
9029 OnMouseUpOnElement: function(element){
9030  if(this.savedCurrentPressedElement == null) return;
9031  this.ClearSavedCurrentPressedElement();
9032  this.SetCurrentHoverElementBySrcElement(element);
9033 },
9034 OnMouseOver: function(evt){
9035  var element = ASPx.Evt.GetEventSource(evt);
9036  if(element && element.tagName == "IFRAME")
9037   this.OnMouseMove(evt, true);
9038 },
9039 OnKeyDown: function(evt){
9040  var element = this.GetFocusedElement(ASPx.Evt.GetEventSource(evt));
9041  if(element != null && element == this.currentFocusedElement) {
9042   var item = element[ASPx.FocusedItemKind];
9043   if(item){
9044    var args = new ASPxClientStateEventArgs(item, element);
9045    args.htmlEvent = evt;
9046    this.FocusedItemKeyDown.FireEvent(this, args);
9047   }
9048  }
9049 },
9050 OnSelectStart: function(evt){
9051  if(this.savedCurrentPressedElement) {
9052   ASPx.Selection.Clear();
9053   return false;
9054  }
9055 },
9056 ClearSavedCurrentPressedElement: function() {
9057  this.savedCurrentPressedElement = null;
9058  this.SetCurrentPressedElement(null);
9059 },
9060 ClearCache: function(srcElement, kind) {
9061  if(srcElement[ASPx.CachedStatePrefix + kind])
9062   srcElement[ASPx.CachedStatePrefix + kind] = null;
9063 },
9064 ClearElementCache: function(srcElement) {
9065  this.ClearCache(srcElement, ASPx.FocusedItemKind);
9066  this.ClearCache(srcElement, ASPx.HoverItemKind);
9067  this.ClearCache(srcElement, ASPx.PressedItemKind);
9068  this.ClearCache(srcElement, ASPx.SelectedItemKind);
9069  this.ClearCache(srcElement, ASPx.DisabledItemKind);
9070 },
9071 LockForceRedrawAppearance: function() {
9072  this.forceRedrawAppearanceLockCount++;
9073 },
9074 UnlockForceRedrawAppearance: function() {
9075  this.forceRedrawAppearanceLockCount--;
9076 },
9077 IsForceRedrawAppearanceLocked: function() {
9078  return this.forceRedrawAppearanceLockCount > 0;
9079 }
9080});
9081var stateController = null;
9082function aspxGetStateController(){
9083 if(stateController == null)
9084  stateController = new ASPxStateController();
9085 return stateController;
9086}
9087function aspxAddStateItems(method, namePrefix, classes, disableApplyingStyleToLink){
9088 for(var i = 0; i < classes.length; i ++){
9089  for(var j = 0; j < classes[i][2].length; j ++) {
9090   var name = namePrefix;
9091   if(classes[i][2][j])
9092    name += "_" + classes[i][2][j];
9093   var postfixes = classes[i][3] || null;
9094   var imag
9094eObjs = (classes[i][4] && classes[i][4][j]) || null;
9095   var imagePostfixes = classes[i][5] || null;
9096   method.call(aspxGetStateController(), name, classes[i][0], classes[i][1], postfixes, imageObjs, imagePostfixes, disableApplyingStyleToLink, namePrefix);
9097  }
9098 }
9099}
9100ASPx.AddHoverItems = function(namePrefix, classes, disableApplyingStyleToLink){
9101 aspxAddStateItems(aspxGetStateController().AddHoverItem, namePrefix, classes, disableApplyingStyleToLink);
9102}
9103ASPx.AddPressedItems = function(namePrefix, classes, disableApplyingStyleToLink){
9104 aspxAddStateItems(aspxGetStateController().AddPressedItem, namePrefix, classes, disableApplyingStyleToLink);
9105}
9106ASPx.AddSelectedItems = function(namePrefix, classes, disableApplyingStyleToLink){
9107 aspxAddStateItems(aspxGetStateController().AddSelectedItem, namePrefix, classes, disableApplyingStyleToLink);
9108}
9109ASPx.AddDisabledItems = function(namePrefix, classes, disableApplyingStyleToLink){
9110 aspxAddStateItems(aspxGetStateController().AddDisabledItem, namePrefix, classes, disableApplyingStyleToLink);
9111}
9112function aspxRemoveStateItems(method, namePrefix, classes){
9113 for(var i = 0; i < classes.length; i ++){
9114  for(var j = 0; j < classes[i][0].length; j ++) {
9115   var name = namePrefix;
9116   if(classes[i][0][j])
9117    name += "_" + classes[i][0][j];
9118   method.call(aspxGetStateController(), name, classes[i][1], namePrefix);
9119  }
9120 }
9121}
9122ASPx.RemoveHoverItems = function(namePrefix, classes){
9123 aspxRemoveStateItems(aspxGetStateController().RemoveHoverItem, namePrefix, classes);
9124}
9125ASPx.RemovePressedItems = function(namePrefix, classes){
9126 aspxRemoveStateItems(aspxGetStateController().RemovePressedItem, namePrefix, classes);
9127}
9128ASPx.RemoveSelectedItems = function(namePrefix, classes){
9129 aspxRemoveStateItems(aspxGetStateController().RemoveSelectedItem, namePrefix, classes);
9130}
9131ASPx.RemoveDisabledItems = function(namePrefix, classes){
9132 aspxRemoveStateItems(aspxGetStateController().RemoveDisabledItem, namePrefix, classes);
9133}
9134ASPx.AddAfterClearFocusedState = function(handler){
9135 aspxGetStateController().AfterClearFocusedState.AddHandler(handler);
9136}
9137ASPx.AddAfterSetFocusedState = function(handler){
9138 aspxGetStateController().AfterSetFocusedState.AddHandler(handler);
9139}
9140ASPx.AddAfterClearHoverState = function(handler){
9141 aspxGetStateController().AfterClearHoverState.AddHandler(handler);
9142}
9143ASPx.AddAfterSetHoverState = function(handler){
9144 aspxGetStateController().AfterSetHoverState.AddHandler(handler);
9145}
9146ASPx.AddAfterClearPressedState = function(handler){
9147 aspxGetStateController().AfterClearPressedState.AddHandler(handler);
9148}
9149ASPx.AddAfterSetPressedState = function(handler){
9150 aspxGetStateController().AfterSetPressedState.AddHandler(handler);
9151}
9152ASPx.AddAfterDisabled = function(handler){
9153 aspxGetStateController().AfterDisabled.AddHandler(handler);
9154}
9155ASPx.AddAfterEnabled = function(handler){
9156 aspxGetStateController().AfterEnabled.AddHandler(handler);
9157}
9158ASPx.AddBeforeClearFocusedState = function(handler){
9159 aspxGetStateController().BeforeClearFocusedState.AddHandler(handler);
9160}
9161ASPx.AddBeforeSetFocusedState = function(handler){
9162 aspxGetStateController().BeforeSetFocusedState.AddHandler(handler);
9163}
9164ASPx.AddBeforeClearHoverState = function(handler){
9165 aspxGetStateController().BeforeClearHoverState.AddHandler(handler);
9166}
9167ASPx.AddBeforeSetHoverState = function(handler){
9168 aspxGetStateController().BeforeSetHoverState.AddHandler(handler);
9169}
9170ASPx.AddBeforeClearPressedState = function(handler){
9171 aspxGetStateController().BeforeClearPressedState.AddHandler(handler);
9172}
9173ASPx.AddBeforeSetPressedState = function(handler){
9174 aspxGetStateController().BeforeSetPressedState.AddHandler(handler);
9175}
9176ASPx.AddBeforeDisabled = function(handler){
9177 aspxGetStateController().BeforeDisabled.AddHandler(handler);
9178}
9179ASPx.AddBeforeEnabled = function(handler){
9180 aspxGetStateController().BeforeEnabled.AddHandler(handler);
9181}
9182ASPx.AddFocusedItemKeyDown = function(handler){
9183 aspxGetStateController().FocusedItemKeyDown.AddHandler(handler);
9184}
9185ASPx.SetHoverState = function(element){
9186 aspxGetStateController().SetCurrentHoverElementBySrcElement(element);
9187}
9188ASPx.ClearHoverState = function(evt){
9189 aspxGetStateController().SetCurrentHoverElementBySrcElement(null);
9190}
9191ASPx.UpdateHoverState = function(evt){
9192 aspxGetStateController().OnMouseMove(evt, false);
9193}
9194ASPx.SetFocusedState = function(element){
9195 aspxGetStateController().SetCurrentFocusedElementBySrcElement(element);
9196}
9197ASPx.ClearFocusedState = function(evt){
9198 aspxGetStateController().SetCurrentFocusedElementBySrcElement(null);
9199}
9200ASPx.UpdateFocusedState = function(evt){
9201 aspxGetStateController().OnFocusMove(evt);
9202}
9203ASPx.AccessibilityMarkerClass = "dxalink";
9204ASPx.AssignAccessibilityEventsToChildrenLinks = function(container, clearFocusedStateOnMouseOut){
9205 var links = ASPx.GetNodesByPartialClassName(container, ASPx.AccessibilityMarkerClass);
9206 for(var i = 0; i < links.length; i++)
9207  ASPx.AssignAccessibilityEventsToLink(links[i], clearFocusedStateOnMouseOut);
9208}
9209ASPx.AssignAccessibilityEventsToLink = function(link, clearFocusedStateOnMouseOut) {
9210 if(!ASPx.ElementContainsCssClass(link, ASPx.AccessibilityMarkerClass))
9211  return;
9212 ASPx.Evt.AttachEventToElement(link, "focus", function(e) { ASPx.UpdateFocusedState(e); });
9213 var clearFocusedStateHandler = function(e) { ASPx.ClearFocusedState(e); };
9214 ASPx.Evt.AttachEventToElement(link, "blur", clearFocusedStateHandler);
9215 if(clearFocusedStateOnMouseOut)
9216  ASPx.Evt.AttachEventToElement(link, "mouseout", clearFocusedStateHandler);
9217}
9218ASPx.Evt.AttachEventToDocument("mousemove", function(evt) {
9219 if(ASPx.classesScriptParsed && ASPx.StateItemsExist)
9220  aspxGetStateController().OnMouseMove(evt, true);
9221});
9222ASPx.Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseDownEventName, function(evt) {
9223 if(ASPx.classesScriptParsed && ASPx.StateItemsExist)
9224  aspxGetStateController().OnMouseDown(evt);
9225});
9226ASPx.Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseUpEventName, function(evt) {
9227 if(ASPx.classesScriptParsed && ASPx.StateItemsExist)
9228  aspxGetStateController().OnMouseUp(evt);
9229});
9230ASPx.Evt.AttachEventToDocument("mouseover", function(evt) {
9231 if(ASPx.classesScriptParsed && ASPx.StateItemsExist)
9232  aspxGetStateController().OnMouseOver(evt);
9233});
9234ASPx.Evt.AttachEventToDocument("keydown", function(evt) {
9235 if(ASPx.classesScriptParsed && ASPx.StateItemsExist)
9236  aspxGetStateController().OnKeyDown(evt);
9237});
9238ASPx.Evt.AttachEventToDocument("selectstart", function(evt) {
9239 if(ASPx.classesScriptParsed && ASPx.StateItemsExist)
9240  return aspxGetStateController().OnSelectStart(evt);
9241});
9242ASPx.GetStateController = aspxGetStateController;
9243})();
9244(function () {
9245 if (typeof ASPx == "undefined") {
9246  window.ASPx = {};
9247 }
9248 ASPx.ASPxImageLoad = {};
9249 ASPx.ASPxImageLoad.dxDefaultLoadingImageCssClass = "dxe-loadingImage";
9250 ASPx.ASPxImageLoad.OnLoad = function (image, customLoadingImage, isOldIE, customBackgroun
9250dImageUrl) {
9251  image.dxCustomBackgroundImageUrl = "";
9252  image.dxShowLoadingImage = true;
9253  image.dxCustomLoadingImage = customLoadingImage;
9254  if (customBackgroundImageUrl != "")
9255   image.dxCustomBackgroundImageUrl = "url('" + customBackgroundImageUrl + "')";
9256  ASPx.ASPxImageLoad.prepareImageBackground(image, isOldIE);
9257  ASPx.ASPxImageLoad.removeHandlers(image);
9258  image.className = image.className.replace(ASPx.ASPxImageLoad.dxDefaultLoadingImageCssClass, "");
9259 };
9260 ASPx.ASPxImageLoad.removeASPxImageBackground = function (image, isOldIE) {
9261  if (isOldIE) 
9262   image.style.removeAttribute("background-image");
9263  else 
9264   image.style.backgroundImage = "";
9265 };
9266 ASPx.ASPxImageLoad.prepareImageBackground = function (image, isOldIE) {
9267  ASPx.ASPxImageLoad.removeASPxImageBackground(image, isOldIE);
9268  if (image.dxCustomBackgroundImageUrl != "")
9269   image.style.backgroundImage = image.dxCustomBackgroundImageUrl;
9270 };
9271 ASPx.ASPxImageLoad.removeHandlers = function (image) {
9272  image.removeAttribute("onload");
9273  image.removeAttribute("onabort");
9274  image.removeAttribute("onerror");
9275 };
9276})();
9277(function () {
9278var ASPxClientBeginCallbackEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
9279 constructor: function(command){
9280  this.constructor.prototype.constructor.call(this);
9281  this.command = command;
9282 }
9283});
9284var ASPxClientGlobalBeginCallbackEventArgs = ASPx.CreateClass(ASPxClientBeginCallbackEventArgs, {
9285 constructor: function(control, command){
9286  this.constructor.prototype.constructor.call(this, command);
9287  this.control = control;
9288 }
9289});
9290var ASPxClientEndCallbackEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
9291 constructor: function(){
9292  this.constructor.prototype.constructor.call(this);
9293 }
9294});
9295var ASPxClientGlobalEndCallbackEventArgs = ASPx.CreateClass(ASPxClientEndCallbackEventArgs, {
9296 constructor: function(control){
9297  this.constructor.prototype.constructor.call(this);
9298  this.control = control;
9299 }
9300});
9301var ASPxClientCustomDataCallbackEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
9302 constructor: function(result) {
9303  this.constructor.prototype.constructor.call(this);
9304  this.result = result;
9305 }
9306});
9307var ASPxClientCallbackErrorEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
9308 constructor: function (message, callbackId) {
9309  this.constructor.prototype.constructor.call(this);
9310  this.message = message;
9311  this.handled = false;
9312  this.callbackId = callbackId;
9313 }
9314});
9315var ASPxClientGlobalCallbackErrorEventArgs = ASPx.CreateClass(ASPxClientCallbackErrorEventArgs, {
9316 constructor: function (control, message, callbackId) {
9317  this.constructor.prototype.constructor.call(this, message, callbackId);
9318  this.control = control;
9319 }
9320});
9321var ASPxClientValidationCompletedEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
9322 constructor: function (container, validationGroup, invisibleControlsValidated, isValid, firstInvalidControl, firstVisibleInvalidControl) {
9323  this.constructor.prototype.constructor.call(this);
9324  this.container = container;
9325  this.validationGroup = validationGroup;
9326  this.invisibleControlsValidated = invisibleControlsValidated;
9327  this.isValid = isValid;
9328  this.firstInvalidControl = firstInvalidControl;
9329  this.firstVisibleInvalidControl = firstVisibleInvalidControl;
9330 }
9331});
9332var ASPxClientControlsInitializedEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
9333 constructor: function(isCallback) {
9334  this.isCallback = isCallback;
9335 }
9336});
9337var ASPxClientControlBeforePronounceEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
9338 constructor: function(type, control, messageParts, labelledElement){
9339  this.constructor.prototype.constructor.call(this);
9340  this.type = type;
9341  this.control = control;
9342  this.messageParts = messageParts;
9343  this.labelledElement = labelledElement;
9344 }
9345});
9346var BeforeInitCallbackEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
9347 constructor: function(callbackOwnerID){
9348  this.constructor.prototype.constructor.call(this);
9349  this.callbackOwnerID = callbackOwnerID;
9350 }
9351});
9352var ASPxClientControlBase = ASPx.CreateClass(null, {
9353 constructor: function(name){
9354  this.name = name;
9355  this.uniqueID = name;   
9356  this.globalName = name;
9357  this.stateObject = null;
9358  this.encodeHtml = true;
9359  this.enabled = true;
9360  this.clientEnabled = true;
9361  this.savedClientEnabled = true;
9362  this.clientVisible = true;
9363  this.accessibilityCompliant = false;
9364  this.autoPostBack = false;
9365  this.allowMultipleCallbacks = true;
9366  this.callBack = null;
9367  this.enableCallbackAnimation = false;
9368  this.enableSlideCallbackAnimation = false;
9369  this.slideAnimationDirection = null;
9370  this.beginCallbackAnimationProcessing = false;
9371  this.endCallbackAnimationProcessing = false;
9372  this.savedCallbackResult = null;
9373  this.savedCallbacks = null;
9374  this.isCallbackAnimationPrevented = false;
9375  this.lpDelay = 300;
9376  this.lpTimer = -1;
9377  this.requestCount = 0;
9378  this.enableSwipeGestures = false;
9379  this.disableSwipeGestures = false;
9380  this.supportGestures = false;
9381  this.repeatedGestureValue = 0;
9382  this.repeatedGestureCount = 0;
9383  this.isInitialized = false;
9384  this.initialFocused = false;
9385  this.leadingAfterInitCall = ASPxClientControl.LeadingAfterInitCallConsts.None; 
9386  this.serverEvents = [];
9387  this.loadingPanelElement = null;
9388  this.loadingDivElement = null;  
9389  this.hasPhantomLoadingElements = false;
9390  this.mainElement = null;
9391  this.touchUIMouseScroller = null;
9392  this.hiddenFields = { };
9393  this.callbackHandlersQueue = new ASPx.ControlCallbackHandlersQueue(this);
9394  this.Init = new ASPxClientEvent();
9395  this.BeginCallback = new ASPxClientEvent();
9396  this.EndCallback = new ASPxClientEvent();
9397  this.EndCallbackAnimationStart = new ASPxClientEvent();
9398  this.CallbackError = new ASPxClientEvent();
9399  this.CustomDataCallback = new ASPxClientEvent();
9400  this.BeforePronounce = new ASPxClientEvent();
9401 },
9402 Initialize: function() {
9403  if(this.callBack != null)
9404   this.InitializeCallBackData();
9405  if (this.useCallbackQueue())
9406   this.callbackQueueHelper = new ASPx.ControlCallbackQueueHelper(this);
9407  ASPx.AccessibilityUtils.createAccessibleBackgrounds(this);
9408 },
9409 InlineInitialize: function() {
9410  this.savedClientEnabled = this.clientEnabled;
9411 },
9412 InitializeGestures: function() {
9413  if(this.isSwipeGesturesEnabled() && this.supportGestures) {
9414   ASPx.GesturesHelper.AddSwipeGestureHandler(this.name, 
9415    function() { return this.GetCallbackAnimationElement(); }.aspxBind(this), 
9416    function(evt) { return this.CanHandleGestureCore(evt); }.aspxBind(this), 
9417    function(value) { return this.AllowStartGesture(); }.aspxBind(this),
9418    function(value) { return this.StartGesture(); }.aspxBind(this),
9419    function(value) { return this.AllowExecuteGesture(value); }.aspxBind(this),
9420    function(value) { this.ExecuteGesture(value); }.aspxBind(this),
9421    function(value) { this.CancelGesture(value); }.aspxBind(this),
9422    this.GetDefaultanimationEngineType()
9423   );
9424   if(ASPx.Browser.MSTouchUI)
9425    this.touchUIMouseScroller = ASPx.MouseScroller.Create(
9426     function() { return this.GetCallbackAnimationElement(); }.aspxBind(this),
9427     function() { return null; },
9428     function() { return this.GetCallbackAnimationElement(); }.aspxBind(this),
9429     function(element) { return this.NeedPreventTouchUIMouseScrolling(element); }.aspxBind(this),
9430     true
9431    );
9432  }
9433 },
9434 isSwipeGesturesEnabled: function() {
9435  return !this.disableSwipeGestures && (this.enableSwipeGestures || ASPx.Browser.TouchUI);
9436 },
9437 isSlideCallbackAnimationEnabled: function() {
9438  return this.enableSlideCallbackAnimation || this.isSwipeGesturesEnabled(); 
9439 },
9440 InitGlobalVariable: function(varName){
9441  if(!window) return;
9442  this.globalName = varName;
9443  window[varName] = this;
9444 },
9445 SetProperties: function(properties, obj){
9446  if(!obj) obj = this;
9447  for(var name in properties){
9448   if(properties.hasOwnProperty(name))
9449    obj[name] = properties[name];
9450  }
9451 },
9452 SetEvents: function(events, obj){
9453  if(!obj) obj = this;
9454  for(var name in events){
9455   if(events.hasOwnProperty(name) && obj[name] && obj[name].AddHandler)
9456    obj[name].AddHandler(events[name]);
9457  }
9458 },
9459 InitializeProperties: function(properties){
9460 },
9461 useCallbackQueue: function(){
9462  return false;
9463 },
9464 NeedPreventTouchUIMouseScrolling: function(element) {
9465  return false;
9466 },
9467 InitailizeFocus: function() {
9468  if(this.initialFocused && this.IsVisible())
9469   this.Focus();
9470 },
9471 AfterCreate: function() { 
9472  this.InlineInitialize();
9473  this.InitializeGestures();
9474 },
9475 AfterInitialize: function() {
9476  this.initializeAriaDescriptor();
9477  this.InitailizeFocus();
9478  this.isInitialized = true;
9479  this.RaiseInit();
9480  if(this.savedCallbacks) {
9481   for(var i = 0; i < this.savedCallbacks.length; i++) 
9482    this.CreateCallbackInternal(this.savedCallbacks[i].arg, this.savedCallbacks[i].command, 
9483     false, this.savedCallbacks[i].callbackInfo);
9484   this.savedCallbacks = null;
9485  }
9486 },
9487 InitializeCallBackData: function() {
9488 },
9489 IsDOMDisposed: function() { 
9490  return !ASPx.IsExistsElement(this.GetMainElement());
9491 },
9492 initializeAriaDescriptor: function() {
9493  if(this.ariaDescription) {
9494   var descriptionObject = ASPx.Json.Eval(this.ariaDescription)
9495   if(descriptionObject) {
9496    this.ariaDescriptor = new AriaDescriptor(this, descriptionObject);
9497    this.applyAccessibilityAttributes(this.ariaDescriptor); 
9498   }
9499  }
9500 },
9501 applyAccessibilityAttributes: function() { },
9502 setAriaDescription: function(selector, argsList) {
9503  if(this.ariaDescriptor)
9504   this.ariaDescriptor.setDescription(selector, argsList || [[]]);
9505 },
9506 HtmlEncode: function(text) {
9507  return this.encodeHtml ? ASPx.Str.EncodeHtml(text) : text;
9508 },
9509 IsServerEventAssigned: function(eventName){
9510  return ASPx.Data.ArrayIndexOf(this.serverEvents, eventName) >= 0;
9511 },
9512 OnPost: function(args){
9513  this.UpdateStateObject();
9514  if(this.stateObject != null) 
9515   this.UpdateStateHiddenField();
9516 },
9517 OnPostFinalization: function(args){
9518 },
9519 UpdateStateObject: function(){
9520 },
9521 UpdateStateObjectWithObject: function(obj){
9522  if(!obj) return;
9523  if(!this.stateObject)
9524   this.stateObject = { };
9525  for(var key in obj)
9526   this.stateObject[key] = obj[key];
9527 },
9528 UpdateStateHiddenField: function(){
9529  var stateHiddenField = this.GetStateHiddenField()
9530  if(stateHiddenField) {
9531   var stateObjectStr = ASPx.Json.ToJson(this.stateObject);
9532   stateHiddenField.value = ASPx.Str.EncodeHtml(stateObjectStr);
9533  }
9534 },
9535 GetStateHiddenField: function() {
9536  return this.GetHiddenField(this.GetStateHiddenFieldName(), this.GetStateHiddenFieldID(), 
9537   this.GetStateHiddenFieldParent(), this.GetStateHiddenFieldOrigin());
9538 },
9539 GetStateHiddenFieldName: function() {
9540  return this.uniqueID;
9541 },
9542 GetStateHiddenFieldID: function() {
9543  return this.name + "_State";
9544 },
9545 GetStateHiddenFieldOrigin: function() {
9546  return this.GetMainElement();
9547 },
9548 GetStateHiddenFieldParent: function() {
9549  var element = this.GetStateHiddenFieldOrigin();
9550  return element ? element.parentNode : null;
9551 },
9552 GetHiddenField: function(name, id, parent, beforeElement) {
9553  var hiddenField = this.hiddenFields[id];
9554  if(!hiddenField || !ASPx.IsValidElement(hiddenField)) {
9555   if(parent) {
9556    var existingHiddenField = ASPx.GetElementById(this.GetStateHiddenFieldID());
9557    this.hiddenFields[id] = hiddenField = existingHiddenField || ASPx.CreateHiddenField(name, id);
9558    if(existingHiddenField)
9559     return existingHiddenField;
9560    if(beforeElement)
9561     parent.insertBefore(hiddenField, beforeElement)
9562    else
9563     parent.appendChild(hiddenField);
9564   }
9565  }
9566  return hiddenField;
9567 },
9568 GetChildElement: function(idPostfix){
9569  var mainElement = this.GetMainElement();
9570  if(idPostfix.charAt && idPostfix.charAt(0) !== "_")
9571   idPostfix = "_" + idPostfix;
9572  return mainElement ? ASPx.CacheHelper.GetCachedChildById(this, mainElement, this.name + idPostfix) : null;
9573 },
9574 getChildControl: function(idPostfix) {
9575  var result = null;
9576  var childControlId = this.getChildControlUniqueID(idPostfix);
9577  ASPx.GetControlCollection().ProcessControlsInContainer(this.GetMainElement(), function(control) {
9578   if(control.uniqueID == childControlId)
9579    result = control;
9580  });
9581  return result;  
9582 },
9583 getChildControlUniqueID: function(idPostfix) {
9584  idPostfix = idPostfix.split("_").join("$");
9585  if(idPostfix.charAt && idPostfix.charAt(0) !== "$")
9586   idPostfix = "$" + idPostfix;
9587  return this.uniqueID + idPostfix;  
9588 },
9589 getInnerControl: function(idPostfix) {
9590  var name = this.name + idPostfix;
9591  var result = window[name];
9592  return result && Ident.IsASPxClientControl(result)
9593   ? result
9594   : null;
9595 },
9596 GetParentForm: function(){
9597  return ASPx.GetParentByTagName(this.GetMainElement(), "FORM");
9598 },
9599 GetMainElement: function(){
9600  if(!ASPx.IsExistsElement(this.mainElement))
9601   this.mainElement = ASPx.GetElementById(this.name);
9602  return this.mainElement;
9603 },
9604 IsLoadingContainerVisible: function(){
9605  return this.IsVisible();
9606 },
9607 GetLoadingPanelElement: function(){
9608  return ASPx.GetElementById(this.name + "_LP");
9609 },
9610 GetClonedLoadingPanel: function(){
9611  return document.getElementById(this.GetLoadingPanelElement().id + "V"); 
9612 },
9613 CloneLoadingPanel: function(element, parent) {
9614  var clone = element.cloneNode(true);
9615  clone.id = element.id + "V";
9616  parent.appendChild(clone);
9617  return clone;
9618 },
9619 CreateLoadingPanelWithoutBordersInsideContainer: function(container) {
9620  var loadingPanel = this.CreateLoadingPanelInsideContainer(container, false, true, true);
9621  var contentStyle = ASPx.GetCurrentStyle(container);
9622  if(!loadingPanel || !contentStyle)
9623   return;
9624  var elements = [ ];
9625  elements.push(loadingPanel.tagName == "TABLE" ? loadingPanel : ASPx.GetNodeByTagName(loadingPanel, "TABLE", 0));
9626  var cells = ASPx.GetNodesByTagName(loadingPanel, "TD");
9627  if(!cells) cells = [ ];
9628  for(var i = 0; i < cells.length; i++)
9629   elements.push(cells[i]);
9630  for(var i = 0; i < elements.length; i++) {
9631   var el = elements[i];
9632   el.style.backgroundColor = contentStyle.backgroundColor;
9633   ASPx.RemoveBordersAndShadows(el);
9634  }
9635 },
9636 CreateLoadingPanelInsideContainer: function(parentElement, hideContent, collapseHeight, collapseWidth) {
9637  if(this.ShouldHideExistingLoadingElements())
9638   this.HideLoadingPanel();
9639  if(parentElement == null)
9640   return null;
9641  if(!this.IsLoadingContainerVisible()) {
9642   this.hasPhantomLoadingElements = true;
9643   return null;
9644  }
9645  var element = this.GetLoadingPanelElement();
9646  if(element != null){
9647   var width = collapseWidth ? 0 : ASPx.GetClearClientWidth(parentElement);
9648   var height = collapseHeight ? 0 : ASPx.GetClearClientHeight(parentElement);
9649   if(hideContent){
9650    for(var i = parentElement.childNodes.length - 1; i > -1; i--){
9651     if(parentElement.childNodes[i].style)
9652      parentElement.childNodes[i].style.display = "none";
9653     else if(parentElement.childNodes[i].nodeType == 3) 
9654      parentElement.removeChild(parentElement.childNodes[i]);
9655    }
9656   }
9657   else
9658    parentElement.innerHTML = "";
9659   var table = document.createElement("TABLE");
9660   parentElement.appendChild(table);
9661   table.border = 0;
9662   table.cellPadding = 0;
9663   table.cellSpacing = 0;
9664   ASPx.SetStyles(table, {
9665    width: (width > 0) ? width : "100%",
9666    height: (height > 0) ? height : "100%"
9667   });
9668   var tbody = document.createElement("TBODY");
9669   table.appendChild(tbody);
9670   var tr = document.createElement("TR");
9671   tbody.appendChild(tr);
9672   var td = document.createElement("TD");
9673   tr.appendChild(td);
9674   td.align = "center";
9675   td.vAlign = "middle";
9676   element = this.CloneLoadingPanel(element, td);
9677   ASPx.SetElementDisplay(element, true);
9678   this.loadingPanelElement = element;
9679   return element;
9680  } else
9681   parentElement.innerHTML = "&nbsp;";
9682  return null;
9683 },
9684 CreateLoadingPanelWithAbsolutePosition: function(parentElement, offsetElement) {
9685  if(this.ShouldHideExistingLoadingElements())
9686   this.HideLoadingPanel();
9687  if(parentElement == null)
9688   return null;
9689  if(!this.IsLoadingContainerVisible()) {
9690   this.hasPhantomLoadingElements = true;
9691   return null;
9692  }
9693  if(!offsetElement)
9694   offsetElement = parentElement;
9695  var element = this.GetLoadingPanelElement();
9696  if(element != null) {
9697   element = this.CloneLoadingPanel(element, parentElement);
9698   ASPx.SetStyles(element, {
9699    position: "absolute",
9700    display: ""
9701   });
9702   ASPx.Evt.AttachEventToElement(element, ASPx.Evt.GetMouseWheelEventName(), ASPx.Evt.PreventEvent);
9703   this.SetLoadingPanelLocation(offsetElement, element);
9704   this.loadingPanelElement = element;
9705   return element;
9706  }
9707  return null;
9708 },
9709 CreateLoadingPanelInline: function(parentElement){
9710  if(this.ShouldHideExistingLoadingElements())
9711   this.HideLoadingPanel();
9712  if(parentElement == null)
9713   return null;
9714  if(!this.IsLoadingContainerVisible()) {
9715   this.hasPhantomLoadingElements = true;
9716   return null;
9717  }
9718  var element = this.GetLoadingPanelElement();
9719  if(element != null) {
9720   element = this.CloneLoadingPanel(element, parentElement);
9721   ASPx.SetElementDisplay(element, true);
9722   this.loadingPanelElement = element;
9723   return element;
9724  }
9725  return null;
9726 },
9727 ShowLoadingPanel: function() {
9728 },
9729 ShowLoadingElements: function() {
9730  if(this.InCallback() || this.lpTimer > -1) return;
9731  this.ShowLoadingDiv();
9732  if(this.IsCallbackAnimationEnabled())
9733   this.StartBeginCallbackA
9733nimation();
9734  else
9735   this.ShowLoadingElementsInternal();
9736 },
9737 ShowLoadingElementsInternal: function() {
9738  if(this.lpDelay > 0 && !this.IsCallbackAnimationEnabled()) 
9739   this.lpTimer = window.setTimeout(function() { 
9740    this.ShowLoadingPanelOnTimer(); 
9741   }.aspxBind(this), this.lpDelay);
9742  else {
9743   this.RestoreLoadingDivOpacity();
9744   this.ShowLoadingPanel();
9745  }
9746 },
9747 GetLoadingPanelOffsetElement: function (baseElement) {
9748  if(this.IsCallbackAnimationEnabled()) {
9749   var element = this.GetLoadingPanelCallbackAnimationOffsetElement();
9750   if(element) {
9751    var container = typeof(ASPx.AnimationHelper) != "undefined" ? ASPx.AnimationHelper.findSlideAnimationContainer(element) : null;
9752    if(container)
9753     return container.parentNode.parentNode;
9754    else
9755     return element;
9756   }
9757  }
9758  return baseElement;
9759 },
9760 GetLoadingPanelCallbackAnimationOffsetElement: function () {
9761  return this.GetCallbackAnimationElement();
9762 },
9763 IsCallbackAnimationEnabled: function () {
9764  return (this.enableCallbackAnimation || this.isSlideCallbackAnimationEnabled()) && !this.isCallbackAnimationPrevented;
9765 },
9766 GetDefaultanimationEngineType: function() {
9767  return ASPx.AnimationEngineType.DEFAULT;
9768 },
9769 StartBeginCallbackAnimation: function () {
9770  this.beginCallbackAnimationProcessing = true;
9771  this.isCallbackFinished = false;
9772  var element = this.GetCallbackAnimationElement();
9773  if(element && this.isSlideCallbackAnimationEnabled() && this.slideAnimationDirection) 
9774   ASPx.AnimationHelper.slideOut(element, this.slideAnimationDirection, this.FinishBeginCallbackAnimation.aspxBind(this), this.GetDefaultanimationEngineType());
9775  else if(element && this.enableCallbackAnimation) 
9776   ASPx.AnimationHelper.fadeOut(element, this.FinishBeginCallbackAnimation.aspxBind(this));
9777  else
9778   this.FinishBeginCallbackAnimation();
9779 },
9780 CancelBeginCallbackAnimation: function() {
9781  if(this.beginCallbackAnimationProcessing) {
9782   this.beginCallbackAnimationProcessing = false;
9783   var element = this.GetCallbackAnimationElement();
9784   ASPx.AnimationHelper.cancelAnimation(element);
9785  }
9786 },
9787 FinishBeginCallbackAnimation: function () {
9788  this.beginCallbackAnimationProcessing = false;
9789  if(!this.isCallbackFinished)
9790   this.ShowLoadingElementsInternal();
9791  else {
9792   this.DoCallback(this.savedCallbackResult);
9793   this.savedCallbackResult = null;
9794  }
9795 },
9796 CheckBeginCallbackAnimationInProgress: function(callbackResult) {
9797  if(this.beginCallbackAnimationProcessing) {
9798   this.savedCallbackResult = callbackResult;
9799   this.isCallbackFinished = true;
9800   return true;
9801  }
9802  return false;
9803 },
9804 StartEndCallbackAnimation: function () {
9805  this.HideLoadingPanel();
9806  this.SetInitialLoadingDivOpacity();
9807  this.RaiseEndCallbackAnimationStart();
9808  this.endCallbackAnimationProcessing = true;
9809  var element = this.GetCallbackAnimationElement();
9810  if(element && this.isSlideCallbackAnimationEnabled() && this.slideAnimationDirection) 
9811   ASPx.AnimationHelper.slideIn(element, this.slideAnimationDirection, this.FinishEndCallbackAnimation.aspxBind(this), this.GetDefaultanimationEngineType());
9812  else if(element && this.enableCallbackAnimation) 
9813   ASPx.AnimationHelper.fadeIn(element, this.FinishEndCallbackAnimation.aspxBind(this));
9814  else
9815   this.FinishEndCallbackAnimation();
9816  this.slideAnimationDirection = null;
9817 },
9818 FinishEndCallbackAnimation: function () {
9819  this.DoEndCallback();
9820  this.endCallbackAnimationProcessing = false;
9821  this.CheckRepeatGesture();
9822 },
9823 CheckEndCallbackAnimationNeeded: function() {
9824  if(!this.endCallbackAnimationProcessing && this.requestCount == 1) {
9825   this.StartEndCallbackAnimation();
9826   return true;
9827  }
9828  return false;
9829 },
9830 PreventCallbackAnimation: function() {
9831  this.isCallbackAnimationPrevented = true;
9832 },
9833 GetCallbackAnimationElement: function() {
9834  return null;
9835 },
9836 AssignSlideAnimationDirectionByPagerArgument: function(arg, currentPageIndex) {
9837  this.slideAnimationDirection = null;
9838  if(this.isSlideCallbackAnimationEnabled() && typeof(ASPx.AnimationHelper) != "undefined") {
9839   if(arg == PagerCommands.Next || arg == PagerCommands.Last)
9840    this.slideAnimationDirection = ASPx.AnimationHelper.SLIDE_LEFT_DIRECTION;
9841   else if(arg == PagerCommands.First || arg == PagerCommands.Prev)
9842    this.slideAnimationDirection = ASPx.AnimationHelper.SLIDE_RIGHT_DIRECTION;
9843   else if(!isNaN(currentPageIndex) && arg.indexOf(PagerCommands.PageNumber) == 0) {
9844    var newPageIndex = parseInt(arg.substring(2));
9845    if(!isNaN(newPageIndex))
9846     this.slideAnimationDirection = newPageIndex < currentPageIndex ? ASPx.AnimationHelper.SLIDE_RIGHT_DIRECTION : ASPx.AnimationHelper.SLIDE_LEFT_DIRECTION;
9847   }
9848  }
9849 },
9850 TryShowPhantomLoadingElements: function () {
9851  if(this.hasPhantomLoadingElements && this.InCallback()) {
9852   this.hasPhantomLoadingElements = false;
9853   this.ShowLoadingDivAndPanel();
9854  }
9855 },
9856 ShowLoadingDivAndPanel: function () {
9857  this.ShowLoadingDiv();
9858  this.RestoreLoadingDivOpacity();
9859  this.ShowLoadingPanel();
9860 },
9861 HideLoadingElements: function() {
9862  this.CancelBeginCallbackAnimation();
9863  this.HideLoadingPanel();
9864  this.HideLoadingDiv();
9865 },
9866 ShowLoadingPanelOnTimer: function() {
9867  this.ClearLoadingPanelTimer();
9868  if(!this.IsDOMDisposed()) {
9869   this.RestoreLoadingDivOpacity();
9870   this.ShowLoadingPanel();
9871  }
9872 },
9873 ClearLoadingPanelTimer: function() {
9874  this.lpTimer = ASPx.Timer.ClearTimer(this.lpTimer);  
9875 },
9876 HideLoadingPanel: function() {
9877  this.ClearLoadingPanelTimer();
9878  this.hasPhantomLoadingElements = false;
9879  if(ASPx.IsExistsElement(this.loadingPanelElement)) {
9880   ASPx.RemoveElement(this.loadingPanelElement);
9881   this.loadingPanelElement = null;
9882  }
9883 },
9884 SetLoadingPanelLocation: function(offsetElement, loadingPanel, x, y, offsetX, offsetY) {
9885  if(!ASPx.IsExists(x) || !ASPx.IsExists(y)){
9886   var x1 = ASPx.GetAbsoluteX(offsetElement);
9887   var y1 = ASPx.GetAbsoluteY(offsetElement);
9888   var x2 = x1;
9889   var y2 = y1;
9890   if(offsetElement == document.body){
9891    x2 += ASPx.GetDocumentMaxClientWidth();
9892    y2 += ASPx.GetDocumentMaxClientHeight();
9893   }
9894   else{
9895    x2 += offsetElement.offsetWidth;
9896    y2 += offsetElement.offsetHeight;
9897   }
9898   if(x1 < ASPx.GetDocumentScrollLeft())
9899    x1 = ASPx.GetDocumentScrollLeft();
9900   if(y1 < ASPx.GetDocumentScrollTop())
9901    y1 = ASPx.GetDocumentScrollTop();
9902   if(x2 > ASPx.GetDocumentScrollLeft() + ASPx.GetDocumentClientWidth())
9903    x2 = ASPx.GetDocumentScrollLeft() + ASPx.GetDocumentClientWidth();
9904   if(y2 > ASPx.GetDocumentScrollTop() + ASPx.GetDocumentClientHeight())
9905    y2 = ASPx.GetDocumentScrollTop() + ASPx.GetDocumentClientHeight();
9906   x = x1 + ((x2 - x1 - loadingPanel.offsetWidth) / 2);
9907   y = y1 + ((y2 - y1 - loadingPanel.offsetHeight) / 2);
9908  }
9909  if(ASPx.IsExists(offsetX) && ASPx.IsExists(offsetY)){
9910   x += offsetX;
9911   y += offsetY;
9912  }
9913  x = ASPx.PrepareClientPosForElement(x, loadingPanel, true);
9914  y = ASPx.PrepareClientPosForElement(y, loadingPanel, false);
9915  if(ASPx.Browser.IE && ASPx.Browser.Version > 8 && (y - Math.floor(y) === 0.5))
9916   y = Math.ceil(y);
9917  ASPx.SetStyles(loadingPanel, { left: x, top: y });
9918 },
9919 GetLoadingDiv: function(){
9920  return ASPx.GetElementById(this.name + "_LD");
9921 },
9922 CreateLoadingDiv: function(parentElement, offsetElement){
9923  if(this.ShouldHideExistingLoadingElements())
9924   this.HideLoadingDiv();
9925  if(parentElement == null) 
9926   return null;
9927  if(!this.IsLoadingContainerVisible()) {
9928   this.hasPhantomLoadingElements = true;
9929   return null;
9930  }
9931  if(!offsetElement)
9932   offsetElement = parentElement;
9933  var div = this.GetLoadingDiv();
9934  if(div != null){
9935   div = div.cloneNode(true);
9936   parentElement.appendChild(div);
9937   ASPx.SetElementDisplay(div, true);
9938   ASPx.Evt.AttachEventToElement(div, ASPx.TouchUIHelper.touchMouseDownEventName, ASPx.Evt.PreventEvent);
9939   ASPx.Evt.AttachEventToElement(div, ASPx.TouchUIHelper.touchMouseMoveEventName, ASPx.Evt.PreventEvent);
9940   ASPx.Evt.AttachEventToElement(div, ASPx.TouchUIHelper.touchMouseUpEventName, ASPx.Evt.PreventEvent);
9941   ASPx.Evt.AttachEventToElement(div, ASPx.Evt.GetMouseWheelEventName(), ASPx.Evt.PreventEvent);
9942   this.SetLoadingDivBounds(offsetElement, div);
9943   this.loadingDivElement = div;
9944   this.SetInitialLoadingDivOpacity();
9945   return div;
9946  }
9947  return null;
9948 },
9949 SetInitialLoadingDivOpacity: function() {
9950  if(!this.loadingDivElement) return;
9951  ASPx.Attr.SaveStyleAttribute(this.loadingDivElement, "opacity");
9952  ASPx.Attr.SaveStyleAttribute(this.loadingDivElement, "filter");
9953  ASPx.SetElementOpacity(this.loadingDivElement, 0.01);
9954 },
9955 RestoreLoadingDivOpacity: function() {
9956  if(!this.loadingDivElement) return;
9957  ASPx.Attr.RestoreStyleAttribute(this.loadingDivElement, "opacity");
9958  ASPx.Attr.RestoreStyleAttribute(this.loadingDivElement, "filter");
9959 },
9960 SetLoadingDivBounds: function(offsetElement, loadingDiv) {
9961  var absX = (offsetElement == document.body) ? 0 : ASPx.GetAbsoluteX(offsetElement);
9962  var absY = (offsetElement == document.body) ? 0 : ASPx.GetAbsoluteY(offsetElement);
9963  ASPx.SetStyles(loadingDiv, {
9964   left: ASPx.PrepareClientPosForElement(absX, loadingDiv, true),
9965   top: ASPx.PrepareClientPosForElement(absY, loadingDiv, false)
9966  });
9967  var width = (offsetElement == document.body) ? ASPx.GetDocumentWidth() : offsetElement.offsetWidth;
9968  var height = (offsetElement == document.body) ? ASPx.GetDocumentHeight() : offsetElement.offsetHeight;
9969  if(height < 0) 
9970   height = 0;
9971  ASPx.SetStyles(loadingDiv, { width: width, height: height });
9972  var correctedWidth = 2 * width - loadingDiv.offsetWidth;
9973  if(correctedWidth <= 0) correctedWidth = width;
9974  var correctedHeight = 2 * height - loadingDiv.offsetHeight;
9975  if(correctedHeight <= 0) correctedHeight = height;
9976  ASPx.SetStyles(loadingDiv, { width: correctedWidth, height: correctedHeight });
9977 },
9978 ShowLoadingDiv: function() {
9979 },
9980 HideLoadingDiv: function() {
9981  this.hasPhantomLoadingElements = false;
9982  if(ASPx.IsExistsElement(this.loadingDivElement)){
9983   ASPx.RemoveElement(this.loadingDivElement);
9984   this.loadingDivElement = null;
9985  }
9986 },
9987 CanHandleGesture: function(evt) {
9988  return false;
9989 },
9990 CanHandleGestureCore: function(evt) {
9991  var source = ASPx.Evt.GetEventSource(evt);
9992  if(ASPx.GetIsParent(this.loadingPanelElement, source) || ASPx.GetIsParent(this.loadingDivElement, source))
9993   return true; 
9994  var callbackAnimationElement = this.GetCallbackAnimationElement();
9995  if(!callbackAnimationElement)
9996   return false;
9997  var animationContainer = ASPx.AnimationHelper.getSlideAnimationContainer(callbackAnimationElement, false, false);
9998  if(animationContainer && ASPx.GetIsParent(animationContainer, source) && !ASPx.GetIsParent(animationContainer.childNodes[0], source))
9999   return true; 
10000  return this.CanHandleGesture(evt); 
10001 },
10002 AllowStartGesture: function() {
10003  return !this.beginCallbackAnimationProcessing && !this.endCallbackAnimationProcessing;
10004 },
10005 StartGesture: function() {
10006 },
10007 AllowExecuteGesture: function(value) {
10008  return false;
10009 },
10010 ExecuteGesture: function(value) {
10011 },
10012 CancelGesture: function(value) {
10013  if(this.repeatedGestureCount === 0) {
10014   this.repeatedGestureValue = value;
10015   this.repeatedGestureCount = 1;
10016  }
10017  else {
10018   if(this.repeatedGestureValue * value > 0)
10019    this.repeatedGestureCount++;
10020   else
10021    this.repeatedGestureCount--;
10022   if(this.repeatedGestureCount === 0)
10023    this.repeatedGestureCount = 0;
10024  }
10025 },
10026 CheckRepeatGesture: function() {
10027  if(this.repeatedGestureCount !== 0) {
10028   if(this.AllowExecuteGesture(this.repeatedGestureValue))
10029    this.ExecuteGesture(this.repeatedGestureValue, this.repeatedGestureCount);
10030   this.repeatedGestureValue = 0;
10031   this.repeatedGestureCount = 0;
10032  }
10033 },
10034 AllowExecutePagerGesture: function (pageIndex, pageCount, value) {
10035  if(pageIndex < 0) return false;
10036  if(pageCount <= 1) return false;
10037  if(value > 0 && pageIndex === 0) return false;
10038  if(value < 0 && pageIndex === pageCount - 1) return false;
10039  return true;
10040 },
10041 ExecutePagerGesture: function(pageIndex, pageCount, value, count, method) {
10042  if(!count) count = 1;
10043  var pageIndex = pageIndex + (value < 0 ? count : -count);
10044  if(pageIndex < 0) pageIndex = 0;
10045  if(pageIndex > pageCount - 1) pageIndex = pageCount - 1;
10046  method(PagerCommands.PageNumber + pageIndex);
10047 },
10048 RaiseInit: function(){
10049  if(!this.Init.IsEmpty()){
10050   var args = new ASPxClientEventArgs();
10051   this.Init.FireEvent(this, args);
10052  }
10053 },
10054 RaiseBeginCallbackInternal: function(command){
10055  if(!this.BeginCallback.IsEmpty()){
10056   var args = new ASPxClientBeginCallbackEventArgs(command);
10057   this.BeginCallback.FireEvent(this, args);
10058  }
10059 },
10060 RaiseEndCallbackInternal: function() {
10061  if(!this.EndCallback.IsEmpty()){
10062   var args = new ASPxClientEndCallbackEventArgs();
10063   this.EndCallback.FireEvent(this, args);
10064  }
10065 },
10066 RaiseCallbackErrorInternal: function(message, callbackId) {
10067  if(!this.CallbackError.IsEmpty()) {
10068   var args = new ASPxClientCallbackErrorEventArgs(message, callbackId);
10069   this.CallbackError.FireEvent(this, args);
10070   if(args.handled)
10071    return { isHandled: true, errorMessage: args.message };
10072  }
10073 },
10074 RaiseBeginCallback: function(command){
10075  this.RaiseBeginCallbackInternal(command);    
10076  aspxGetControlCollection().RaiseBeginCallback(this, command);
10077 },
10078 RaiseEndCallback: function(){
10079  this.RaiseEndCallbackInternal();
10080  aspxGetControlCollection().RaiseEndCallback(this);
10081 },
10082 RaiseCallbackError: function (message, callbackId) {
10083  var result = this.RaiseCallbackErrorInternal(message, callbackId);
10084  if(!result) 
10085   result = aspxGetControlCollection().RaiseCallbackError(this, message, callbackId);
10086  return result;
10087 },
10088 RaiseEndCallbackAnimationStart: function(){
10089  if(!this.EndCallbackAnimationStart.IsEmpty()){
10090   var args = new ASPxClientEventArgs();
10091   this.EndCallbackAnimationStart.FireEvent(this, args);
10092  }
10093 },
10094 RaiseBeforePronounce: function(control, isCallback, messageParts, labelledElement) {
10095  var args = new ASPxClientControlBeforePronounceEventArgs(control, isCallback, messageParts, labelledElement);
10096  if(!this.BeforePronounce.IsEmpty())
10097   this.BeforePronounce.FireEvent(this, args);
10098  return args;
10099 },
10100 PronounceMessage: function(control, isCallback, messageParts, labelledElement) {
10101  var args = this.RaiseBeforePronounce(control, isCallback, messageParts, labelledElement);
10102  ASPx.AccessibilityPronouncer.Pronounce(args);
10103 },
10104 IsVisible: function() {
10105  var element = this.GetMainElement();
10106  return ASPx.IsElementVisible(element);
10107 },
10108 IsDisplayedElement: function(element) {
10109  while(element && element.tagName != "BODY") {
10110   if(!ASPx.GetElementDisplay(element)) 
10111    return false;
10112   element = element.parentNode;
10113  }
10114  return true;
10115 },
10116 IsDisplayed: function() {
10117  return this.IsDisplayedElement(this.GetMainElement());
10118 },
10119 IsHiddenElement: function(element) {
10120  return element && element.offsetWidth == 0 && element.offsetHeight == 0;
10121 },
10122 IsHidden: function() {
10123  return this.IsHiddenElement(this.GetMainElement());
10124 },
10125 Focus: function() {
10126 },
10127 GetClientVisible: function(){
10128  return this.GetVisible();
10129 },
10130 SetClientVisible: function(visible){
10131  this.SetVisible(visible);
10132 },
10133 GetVisible: function(){
10134  return this.clientVisible;
10135 },
10136 SetVisible: function(visible){
10137  if(this.clientVisible != visible){
10138   this.clientVisible = visible;
10139   ASPx.SetElementDisplay(this.GetMainElement(), visible);
10140   if(visible) {
10141    this.AdjustControl();
10142    var mainElement = this.GetMainElement();
10143    if(mainElement)
10144     aspxGetControlCollection().AdjustControls(mainElement);
10145   }
10146  }
10147 },
10148 GetEnabled: function() {
10149  return this.clientEnabled;
10150 },
10151 SetEnabled: function(enabled) {
10152  this.clientEnabled = enabled;
10153  if(ASPxClientControl.setEnabledLocked)
10154   return;
10155  else
10156   ASPxClientControl.setEnabledLocked = true;
10157  this.savedClientEnabled = enabled;
10158  aspxGetControlCollection().ProcessControlsInContainer(this.GetMainElement(), function(control) {
10159   if(ASPx.IsFunction(control.SetEnabled))
10160    control.SetEnabled(enabled && control.savedClientEnabled);
10161  });
10162  delete ASPxClientControl.setEnabledLocked;
10163 },
10164 InCallback: function() {
10165  return this.requestCount > 0;
10166 },
10167 DoBeginCallback: function(command) {
10168  this.RaiseBeginCallback(command || "");
10169  aspxGetControlCollection().Before_WebForm_InitCallback(this.name);
10170  if(typeof(WebForm_InitCallback) != "undefined" && WebForm_InitCallback) {
10171   __theFormPostData = "";
10172   __theFormPostCollection = [ ];
10173   this.ClearPostBackEventInput("__EVENTTARGET");
10174   this.ClearPostBackEventInput("__EVENTARGUMENT");
10175   WebForm_InitCallback();
10176   this.savedFormPostData = __theFormPostData;   
10177   this.savedFormPostCollection = __theFormPostCollection;
10178  }
10179 },
10180 ClearPostBackEventInput: function(id){
10181  var element = ASPx.GetElementById(id);
10182  if(element != null) element.value = "";
10183 },
10184 PerformDataCallback: function(arg, handler) {
10185  this.CreateCustomDataCallback(arg, "", handler);
10186 },
10187 sendCallbackViaQueue: function (prefix, arg, showLoadingPanel, context, handler) {
10188  if (!this.useCallbackQueue())
10189   return false;
10190  var context = context || this;
10191  var token = this.callbackQueueHelper.sendCallback(ASPx.FormatCallbackArg(prefix, arg), context, handler || context.OnCallback);
10192  if (showLoadingPanel)
10193   this.callbackQueueHelper.showLoadingElements();
10194  return token;
10195 },
10196 CreateCallback: function (arg, command, handler) {
10197  var callbackInfo = this.CreateCallbackInfo(ASPx.CallbackType.Common, handler || null);
10198  var callbackID = this.CreateCallbackByInfo(arg, command, callbackInfo);
10199  return callbackID;
10200 },
10201 CreateCustomDataCallback: function(arg, command, handler) {
10202  var callbackInfo = this.CreateCallbackInfo(ASPx.CallbackType.Data, handler);
10203  this.CreateCallbackByInfo(arg, command, callbackInfo);
10204 },
10205 CreateCallbackByInfo: function(arg, command, callbackInfo) {
10206  if(!this.CanCreateCallback()) return;
10207  var callbackID;
10208  if(typeof(WebForm_DoCallback) != "undefined" && WebForm_DoCallback && ASPx.documentLoaded)
10209   callbackID = this.CreateCallbackInternal(arg, command, true, callbackInfo);
10210  else {
10211   if(!this.savedCallbacks)
10212    this.savedCallbacks = [];
10213   var callbackInfo = { arg: arg, command: command, callbackInfo: callbackInfo };
10214   if(this.allowMultipleCallbacks)
10215    this.savedCallbacks.push(callbackInfo);
10216   else
10217    this.savedCallbacks[0] = callbackInfo;
10218  }
10219  return callbackID;
10220 },
10221 CreateCallbackInternal: function(arg, command, viaTimer, callbackInfo) {
10222  var watcher = ASPx.ControlUpdateWatcher.getInstance();
10223  if(watcher && !watcher.CanSendCallback(this, arg)) {
10224   this.CancelCallbackInternal();
10225   return;
10226  }
10227  this.requestCount++;
10228  this.DoBeginCallback(command);
10229  if(typeof(arg) == "undefined")
10230   arg = "";
10231  if(typeof(command) == "undefined")
10232   command = "";
10233  var callbackID = this.SaveCallbackInfo(callbackInfo);
10234  if(viaTimer)
10235   window.setTimeout(function() { this.CreateCallbackCore(arg, command, callbackID); }.aspxBind(this), 0);
10236  else
10237   this.CreateCallbackCore(arg, command, callbackID);
10238  return callbackID;
10239 },
10240 CancelCallbackInternal: function() {
10241  this.CancelCallbackCore();
10242  this.HideLoadingElements();
10243 },
10244 CancelCallbackCore: function() {
10245 },
10246 CreateCallbackCore: function(arg, command, callbackID) {
10247  var callBackMethod = this.GetCallbackMethod(command);
10248  __theFormPostData = this.savedFormPostData;
10249  __theFormPostCollection = this.savedFormPostCollection;
10250  callBackMethod.call(this, this.GetSerializedCallbackInfoByID(callbackID) + arg);
10251 },
10252 GetCallbackMethod: function(command){
10253  return this.callBack;
10254 },
10255 CanCreateCallback: function() {
10256  return !this.InCallback() || (this.allowMultipleCallbacks && !this.beginCallbackA
10256nimationProcessing && !this.endCallbackAnimationProcessing);
10257 },
10258 DoLoadCallbackScripts: function() {
10259  ASPx.ProcessScriptsAndLinks(this.name, true);
10260 },
10261 DoEndCallback: function() {
10262  if(this.IsCallbackAnimationEnabled() && this.CheckEndCallbackAnimationNeeded()) 
10263   return;
10264  this.requestCount--;
10265  if (this.requestCount < 1) 
10266   this.callbackHandlersQueue.executeCallbacksHandlers();
10267  if(this.HideLoadingPanelOnCallback() && this.requestCount < 1) 
10268   this.HideLoadingElements();
10269  if(this.isSwipeGesturesEnabled() && this.supportGestures) {
10270   ASPx.GesturesHelper.UpdateSwipeAnimationContainer(this.name);
10271   if(this.touchUIMouseScroller)
10272    this.touchUIMouseScroller.update();
10273  }
10274  this.isCallbackAnimationPrevented = false;
10275  this.OnCallbackFinalized();
10276  this.AssignEllipsisTooltips();
10277  this.RaiseEndCallback();
10278 },
10279 DoFinalizeCallback: function() {
10280 },
10281 OnCallbackFinalized: function() {
10282 },
10283 AssignEllipsisTooltips: function() { },
10284 HideLoadingPanelOnCallback: function() {
10285  return true;
10286 },
10287 ShouldHideExistingLoadingElements: function() {
10288  return true;
10289 },
10290 EvalCallbackResult: function(resultString){
10291  return eval(resultString);
10292 },
10293 DoCallback: function(result) {
10294  if(this.IsCallbackAnimationEnabled() && this.CheckBeginCallbackA
10294nimationInProgress(result))
10295   return;
10296  result = ASPx.Str.Trim(result);
10297  if(result.indexOf(ASPx.CallbackResultPrefix) != 0) 
10298   this.ProcessCallbackGeneralError(result);
10299  else {
10300   var resultObj = null;
10301   try {
10302    resultObj = this.EvalCallbackResult(result);
10303   } 
10304   catch(e) {
10305   }
10306   if(resultObj) {
10307    ASPx.CacheHelper.DropCache(this);
10308    if(resultObj.redirect){
10309     if(!ASPx.Browser.IE)
10310      window.location.href = resultObj.redirect;
10311     else { 
10312      var fakeLink = document.createElement("a");
10313      fakeLink.href = resultObj.redirect;
10314      document.body.appendChild(fakeLink); 
10315      try { fakeLink.click(); } catch(e){ } 
10316     }
10317    }
10318    else if(ASPx.IsExists(resultObj.generalError)){
10319     this.ProcessCallbackGeneralError(resultObj.generalError);
10320    }
10321    else {
10322     var errorObj = resultObj.error;
10323     if(errorObj)
10324      this.ProcessCallbackError(errorObj,resultObj.id);
10325     else {
10326      if(resultObj.cp) {
10327       for(var name in resultObj.cp)
10328        this[name] = resultObj.cp[name];
10329      }
10330      var callbackInfo = this.DequeueCallbackInfo(resultObj.id);
10331      if(callbackInfo && callbackInfo.type == ASPx.CallbackType.Data)
10332       this.ProcessCustomDataCallback(resultObj.result, callbackInfo);
10333      else {
10334       if (this.useCallbackQueue() && this.callbackQueueHelper.getCallbackInfoById(resultObj.id))
10335        this.callbackQueueHelper.processCallback(resultObj.result, resultObj.id);
10336       else {
10337        this.ProcessCallback(resultObj.result, resultObj.id);
10338        if(callbackInfo && callbackInfo.handler) {
10339         var handlerInfo = { handler: callbackInfo.handler, result: resultObj.result.data };
10340         this.callbackHandlersQueue.addCallbackHandler(handlerInfo);
10341        }
10342       }
10343      }
10344     }
10345    }
10346   } 
10347  }
10348  this.DoLoadCallbackScripts();
10349 },
10350 DoCallbackError: function(result) {
10351  this.HideLoadingElements();
10352  this.ProcessCallbackGeneralError(result); 
10353 },
10354 DoControlClick: function(evt) {
10355  this.OnControlClick(ASPx.Evt.GetEventSource(evt), evt);
10356 },
10357 ProcessCallback: function (result, callbackId) {
10358  this.OnCallback(result, callbackId);
10359 },
10360 ProcessCustomDataCallback: function(result, callbackInfo) {
10361  if(callbackInfo.handler != null)
10362   callbackInfo.handler(this, result);
10363  this.RaiseCustomDataCallback(result);
10364 },
10365 RaiseCustomDataCallback: function(result) {
10366  if(!this.CustomDataCallback.IsEmpty()) {
10367   var arg = new ASPxClientCustomDataCallbackEventArgs(result);
10368   this.CustomDataCallback.FireEvent(this, arg);
10369  }
10370 },
10371 OnCallback: function(result) {
10372 },
10373 CreateCallbackInfo: function(type, handler) {
10374  return { type: type, handler: handler };
10375 },
10376 GetSerializedCallbackInfoByID: function(callbackID) {
10377  return this.GetCallbackInfoByID(callbackID).type + callbackID + ASPx.CallbackSeparator;
10378 },
10379 SaveCallbackInfo: function(callbackInfo) {
10380  var activeCallbacksInfo = this.GetActiveCallbacksInfo();
10381  for(var i = 0; i < activeCallbacksInfo.length; i++) {
10382   if(activeCallbacksInfo[i] == null) {
10383    activeCallbacksInfo[i] = callbackInfo;
10384    return i;
10385   }
10386  }
10387  activeCallbacksInfo.push(callbackInfo);
10388  return activeCallbacksInfo.length - 1;
10389 },
10390 GetActiveCallbacksInfo: function() {
10391  var persistentProperties = this.GetPersistentProperties();
10392  if(!persistentProperties.activeCallbacks)
10393   persistentProperties.activeCallbacks = [ ];
10394  return persistentProperties.activeCallbacks;
10395 },
10396 GetPersistentProperties: function() {
10397  var storage = _aspxGetPersistentControlPropertiesStorage();
10398  var persistentProperties = storage[this.name];
10399  if(!persistentProperties) {
10400   persistentProperties = { };
10401   storage[this.name] = persistentProperties;
10402  }
10403  return persistentProperties;
10404 },
10405 GetCallbackInfoByID: function(callbackID) {
10406  return this.GetActiveCallbacksInfo()[callbackID];
10407 },
10408 DequeueCallbackInfo: function(index) {
10409  var activeCallbacksInfo = this.GetActiveCallbacksInfo();
10410  if(index < 0 || index >= activeCallbacksInfo.length)
10411   return null;
10412  var result = activeCallbacksInfo[index];
10413  activeCallbacksInfo[index] = null;
10414  return result;
10415 },
10416 ProcessCallbackError: function (errorObj, callbackId) {
10417  var data = ASPx.IsExists(errorObj.data) ? errorObj.data : null;
10418  var result = this.RaiseCallbackError(errorObj.message, callbackId);
10419  if(result.isHandled)
10420   this.OnCallbackErrorAfterUserHandle(result.errorMessage, data); 
10421  else
10422   this.OnCallbackError(result.errorMessage, data); 
10423 },
10424 OnCallbackError: function(errorMessage, data) {
10425  if(errorMessage)
10426   ASPx.ShowErrorAlert(errorMessage);
10427 },
10428 OnCallbackErrorAfterUserHandle: function(errorMessage, data) {
10429 },
10430 ProcessCallbackGeneralError: function(errorMessage) {
10431  var result = this.RaiseCallbackError(errorMessage);
10432  if(!result.isHandled)
10433   this.OnCallbackGeneralError(result.errorMessage);
10434 },
10435 OnCallbackGeneralError: function(errorMessage) {
10436  this.OnCallbackError(errorMessage, null);
10437 },
10438 SendPostBack: function(params) {
10439  if(typeof(__doPostBack) != "undefined")
10440   __doPostBack(this.uniqueID, params);
10441  else{
10442   var form = this.GetParentForm();
10443   if(form) form.submit();
10444  }
10445 },
10446 IsValidInstance: function () {
10447  return aspxGetControlCollection().GetByName(this.name) === this;
10448 },
10449 OnDispose: function() { 
10450  var varName = this.globalName;
10451  if(varName && varName !== "" && window && window[varName] && window[varName] == this){
10452   try{
10453    delete window[varName];
10454   }
10455   catch(e){  }
10456  }
10457  if(this.callbackQueueHelper)
10458   this.callbackQueueHelper.detachEvents();
10459 },
10460 OnGlobalControlsInitialized: function(args) { 
10461 },
10462 OnGlobalBrowserWindowResized: function(args) { 
10463 },
10464 OnGlobalBeginCallback: function(args) { 
10465 },
10466 OnGlobalEndCallback: function(args) { 
10467 },
10468 OnGlobalCallbackError: function(args) { 
10469 },
10470 OnGlobalValidationCompleted: function(args) { 
10471 }
10472});
10473ASPxClientControlBase.Cast = function(obj) {
10474 if(typeof obj == "string")
10475  return window[obj];
10476 return obj;
10477};
10478var persistentControlPropertiesStorage = null;
10479function _aspxGetPersistentControlPropertiesStorage() {
10480 if(persistentControlPropertiesStorage == null)
10481  persistentControlPropertiesStorage = { };
10482 return persistentControlPropertiesStorage;
10483}
10484var ELLIPSIS_MARKER_CLASS = "dx-ellipsis";
10485var ELLIPSIS_TOOLTIP_MARKER_ATTR = "dxEllipsisTitle";
10486var ASPxClientControl = ASPx.CreateClass(ASPxClientControlBase, {
10487 constructor: function(name){
10488  this.constructor.prototype.constructor.call(this, name);
10489  this.isASPxClientControl = true;
10490  this.rtl = false;
10491  this.enableEllipsis = false;
10492  this.isNative = false;
10493  this.isControlCollapsed = false;
10494  this.isInsideHierarchyAdjustment = false;
10495  this.controlOwner = null;
10496  this.adjustedSizes = { };
10497  this.dialogContentHashTable = { };
10498  this.renderIFrameForPopupElements = false;
10499  this.widthValueSetInPercentage = false;
10500  this.heightValueSetInPercentage = false;
10501  this.verticalAlignedElements = { };
10502  this.wrappedTextContainers = { };
10503  this.scrollPositionState = { };
10504  this.sizingConfig = {
10505   allowSetWidth: true,
10506   allowSetHeight: true,
10507   correction : false,
10508   adjustControl : false,
10509   supportPercentHeight: false,
10510   supportAutoHeight: false
10511  };
10512  this.percentSizeConfig = {
10513   width: -1,
10514   height: -1,
10515   markerWidth: -1,
10516   markerHeight: -1
10517  };
10518  aspxGetControlCollection().Add(this);  
10519 },
10520 InlineInitialize: function() {
10521  this.InitializeDOM();
10522  ASPxClientControlBase.prototype.InlineInitialize.call(this);
10523 },
10524 AfterCreate: function() { 
10525  ASPxClientControlBase.prototype.AfterCreate.call(this);
10526  if(!this.CanInitializeAdjustmentOnDOMContentLoaded() || ASPx.IsStartupScriptsRunning())
10527   this.InitializeAdjustment();
10528 },
10529 DOMContentLoaded: function() {
10530  if(this.CanInitializeAdjustmentOnDOMContentLoaded()) 
10531   this.InitializeAdjustment();
10532 },
10533 CanInitializeAdjustmentOnDOMContentLoaded: function() {
10534  return !ASPx.Browser.IE || ASPx.Browser.Version >= 10; 
10535 },
10536 InitializeAdjustment: function() {
10537  this.UpdateAdjustmentFlags();
10538  this.AdjustControl();
10539 },
10540 AfterInitialize: function() {
10541  this.AdjustControl();
10542  ASPxClientControlBase.prototype.AfterInitialize.call(this);
10543 },
10544 IsStateControllerEnabled: function(){
10545  return typeof(ASPx.GetStateController) != "undefined" && ASPx.GetStateController();
10546 },
10547 InitializeDOM: function() {
10548  var mainElement = this.GetMainElement();
10549  if(mainElement)
10550   mainElement["dxinit"] = true;
10551 },
10552 IsDOMInitialized: function() {
10553  var mainElement = this.GetMainElement();
10554  return mainElement && mainElement["dxinit"];
10555 },
10556 GetWidth: function() {
10557  return this.GetMainElement().offsetWidth;
10558 },
10559 GetHeight: function() {
10560  return this.GetMainElement().offsetHeight;
10561 },
10562 SetWidth: function(width) {
10563  if(this.sizingConfig.allowSetWidth)
10564   this.SetSizeCore("width", width, "GetWidth", false);
10565 },
10566 SetHeight: function(height) {
10567  if(this.sizingConfig.allowSetHeight)
10568   this.SetSizeCore("height", height, "GetHeight", false);
10569 },
10570 SetSizeCore: function(sizePropertyName, size, getFunctionName, corrected) {
10571  if(size < 0)
10572   return;
10573  this.GetMainElement().style[sizePropertyName] = size + "px";
10574  this.UpdateAdjustmentFlags(sizePropertyName);
10575  if(this.sizingConfig.adjustControl)
10576   this.AdjustControl(true);
10577  if(this.sizingConfig.correction && !corrected) {
10578   var realSize = this[getFunctionName]();
10579   if(realSize != size) {
10580    var correctedSize = size - (realSize - size);
10581    this.SetSizeCore(sizePropertyName, correctedSize, getFunctionName, true);
10582   }
10583  }
10584 },
10585 AdjustControl: function(nestedCall) {
10586  if(this.IsAdjustmentRequired() && (!ASPxClientControl.adjustControl
10586Locked || nestedCall)) {
10587   ASPxClientControl.adjustControlLocked = true;
10588   try {
10589    if(!this.IsAdjustmentAllowed())
10590     return;
10591    this.AdjustControlCore();
10592    this.UpdateAdjustedSizes();
10593   } 
10594   finally {
10595    delete ASPxClientControl.adjustControlLocked;
10596   }
10597  }
10598  this.AssignEllipsisTooltips();
10599  this.TryShowPhantomLoadingElements();
10600 },
10601 ResetControlAdjustment: function () {
10602  this.adjustedSizes = { };
10603 },
10604 UpdateAdjustmentFlags: function(sizeProperty) {
10605  var mainElement = this.GetMainElement();
10606  if(mainElement) {
10607   var mainElementStyle = ASPx.GetCurrentStyle(mainElement);
10608   this.UpdatePercentSizeConfig([mainElementStyle.width, mainElement.style.width], [mainElementStyle.height, mainElement.style.height], sizeProperty);
10609  }
10610 },
10611 UpdatePercentSizeConfig: function(widths, heights, modifyStyleProperty) {
10612  switch(modifyStyleProperty) {
10613   case "width":
10614    this.UpdatePercentWidthConfig(widths);
10615    break;
10616   case "height":
10617    this.UpdatePercentHeightConfig(heights);
10618    break;
10619   default:
10620    this.UpdatePercentWidthConfig(widths);
10621    this.UpdatePercentHeightConfig(heights);
10622    break;
10623  }
10624  this.ResetControlPercentMarkerSize();
10625 },
10626 UpdatePercentWidthConfig: function(widths) {
10627  this.widthValueSetInPercentage = false;
10628  for(var i = 0; i < widths.length; i++) {
10629   if(this.IsPercentageWidth(widths[i])) {
10630    this.percentSizeConfig.width = widths[i];
10631    this.widthValueSetInPercentage = true;
10632    break;
10633   }
10634  }
10635 },
10636 IsPercentageWidth: function(width) { return ASPx.IsPercentageSize(width); },
10637 UpdatePercentHeightConfig: function(heights) {
10638  this.heightValueSetInPercentage = false;
10639    for(var i = 0; i < heights.length; i++) {
10640   if(ASPx.IsPercentageSize(heights[i])) {
10641    this.percentSizeConfig.height = heights[i];
10642    this.heightValueSetInPercentage = true;
10643    break;
10644   }
10645  }
10646 },
10647 GetAdjustedSizes: function() {
10648  var mainElement = this.GetMainElement();
10649  if(mainElement) 
10650   return { width: mainElement.offsetWidth, height: mainElement.offsetHeight };
10651  return { width: 0, height: 0 };
10652 },
10653 IsAdjusted: function() {
10654  return (this.adjustedSizes.width && this.adjustedSizes.width > 0) && (this.adjustedSizes.height && this.adjustedSizes.height > 0);
10655 },
10656 IsAdjustmentRequired: function() {
10657  if(!this.IsAdjusted())
10658   return true;
10659  if(this.widthValueSetInPercentage)
10660   return true;
10661  if(this.heightValueSetInPercentage)
10662   return true;
10663  var sizes = this.GetAdjustedSizes();
10664  for(var name in sizes){
10665   if(this.adjustedSizes[name] !== sizes[name])
10666    return true;
10667  }
10668  return false;
10669 },
10670 IsAdjustmentAllowed: function() {
10671  var mainElement = this.GetMainElement();
10672  return mainElement && this.IsDisplayed() && !this.IsHidden() && this.IsDOMInitialized();
10673 },
10674 UpdateAdjustedSizes: function() {
10675  var sizes = this.GetAdjustedSizes();
10676  for(var name in sizes)
10677   this.adjustedSizes[name] = sizes[name];
10678 },
10679 AdjustControlCore: function() {
10680 },
10681 AdjustAutoHeight: function() {
10682 },
10683 IsControlCollapsed: function() {
10684  return this.isControlCollapsed;
10685 },
10686 NeedCollapseControl: function() {
10687  return this.NeedCollapseControlCore() && this.IsAdjustmentRequired() && this.IsAdjustmentAllowed();
10688 },
10689 NeedCollapseControlCore: function() {
10690  return false;
10691 },
10692 CollapseEditor: function() {
10693 },
10694 CollapseControl: function() {
10695  this.SaveScrollPositions();
10696  var mainElement = this.GetMainElement(),
10697   marker = this.GetControlPercentSizeMarker();
10698  marker.style.height = this.heightValueSetInPercentage && this.sizingConfig.supportPercentHeight
10699   ? this.percentSizeConfig.height 
10700   : (mainElement.offsetHeight + "px");
10701  mainElement.style.display = "none";
10702  this.isControlCollapsed = true;
10703 },
10704 ExpandControl: function() {
10705  var mainElement = this.GetMainElement();
10706  mainElement.style.display = "";
10707  this.GetControlPercentSizeMarker().style.height = "0px";
10708  this.isControlCollapsed = false;
10709  this.RestoreScrollPositions();
10710 },
10711 CanCauseReadjustment: function() {
10712  return this.NeedCollapseControlCore();
10713 },
10714 IsExpandableByAdjustment: function() {
10715  return false;
10716 },
10717 HasFixedPosition: function() {
10718  return false;
10719 },
10720 SaveScrollPositions: function() {
10721  var mainElement = this.GetMainElement();
10722  this.scrollPositionState.outer = ASPx.GetOuterScrollPosition(mainElement.parentNode);
10723  this.scrollPositionState.inner = ASPx.GetInnerScrollPositions(mainElement);
10724 },
10725 RestoreScrollPositions: function() {
10726  ASPx.RestoreOuterScrollPosition(this.scrollPositionState.outer);
10727  ASPx.RestoreInnerScrollPositions(this.scrollPositionState.inner);
10728 },
10729 GetControlPercentSizeMarker: function() {
10730  if(this.percentSizeMarker === undefined) {
10731   this.percentSizeMarker = ASPx.CreateHtmlElementFromString("<div style='height:0px;font-size:0px;line-height:0;width:100%;'></div>");
10732   ASPx.InsertElementAfter(this.percentSizeMarker, this.GetMainElement());
10733  }
10734  return this.percentSizeMarker;
10735 },
10736 KeepControlPercentSizeMarker: function(needCollapse, needCalculateHeight) {
10737  var mainElement = this.GetMainElement(),
10738   marker = this.GetControlPercentSizeMarker(),
10739   markerHeight;
10740  if(needCollapse)
10741   this.CollapseControl();
10742  if(this.widthValueSetInPercentage && marker.style.width !== this.percentSizeConfig.width)
10743   marker.style.width = this.percentSizeConfig.width;
10744  if(needCalculateHeight) {
10745   if(this.IsControlCollapsed())
10746    markerHeight = marker.style.height;
10747   marker.style.height = this.percentSizeConfig.height;
10748  }
10749  this.percentSizeConfig.markerWidth = marker.offsetWidth;
10750  if(needCalculateHeight) {
10751   this.percentSizeConfig.markerHeight = marker.offsetHeight;
10752   if(this.IsControlCollapsed())
10753    marker.style.height = markerHeight;
10754   else
10755    marker.style.height = "0px";
10756  }
10757  if(needCollapse)
10758   this.ExpandControl();
10759 },
10760 ResetControlPercentMarkerSize: function() {
10761  this.percentSizeConfig.markerWidth = -1;
10762  this.percentSizeConfig.markerHeight = -1;
10763 },
10764 GetControlPercentMarkerSize: function(hideControl, force) {
10765  var needCalculateHeight = this.heightValueSetInPercentage && this.sizingConfig.supp
10765ortPercentHeight;
10766  if(force || this.percentSizeConfig.markerWidth < 1 || (needCalculateHeight && this.percentSizeConfig.markerHeight < 1))
10767   this.KeepControlPercentSizeMarker(hideControl && !this.IsControlCollapsed(), needCalculateHeight);
10768  return {
10769   width: this.percentSizeConfig.markerWidth,
10770   height: this.percentSizeConfig.markerHeight
10771  };
10772 },
10773 AssignEllipsisTooltips: function() {
10774  if(this.RequireAssignTooltips())
10775   this.AssignEllipsisTooltipsCore();
10776 },
10777 AssignEllipsisTooltipsCore: function(rootElement, reassingExistingTooltips) {
10778  var requirePaddingManipulation = ASPx.Browser.IE || ASPx.Browser.Edge || ASPx.Browser.Firefox;
10779  rootElement = rootElement || this.GetMainElement();
10780  var nodes = this.GetEllipsisNodes(rootElement);
10781  var nodeInfos = [];
10782  var nodesCount = nodes.length;
10783  for(var i = 0; i < nodesCount; i++) {
10784   var node = nodes[i];
10785   var info = { node: node };
10786   if(requirePaddingManipulation) {
10787    var style = ASPx.GetCurrentStyle(node);
10788    info.paddingLeft = node.style.paddingLeft;
10789    info.totalPadding = ASPx.GetLeftRightPaddings(node, style);
10790   }
10791   nodeInfos.push(info);
10792  }
10793  if(requirePaddingManipulation) {
10794   for(var i = 0; i < nodesCount; i++) {
10795    var info = nodeInfos[i];
10796    ASPx.SetStyles(info.node, { paddingLeft: info.totalPadding }, true);
10797   }
10798  }
10799  for(var i = 0; i < nodesCount; i++) {
10800   var info = nodeInfos[i];
10801   var node = info.node;
10802   info.isTextShortened = node.scrollWidth > node.clientWidth;
10803   info.hasTitle = !!node.title;
10804   if(!info.hasTitle || reassingExistingTooltips)
10805    info.title = this.GetEllipsisTooltipText(node);
10806  }
10807  for(var i = 0; i < nodesCount; i++) {
10808   var info = nodeInfos[i];
10809   var node = info.node;
10810   if(info.isTextShortened && info.title) {
10811    ASPx.Attr.SetAttribute(node, "title", info.title);
10812    ASPx.Attr.SetAttribute(node, ELLIPSIS_TOOLTIP_MARKER_ATTR, true);
10813   }
10814   if(!info.isTextShortened && info.hasTitle)
10815    ASPx.Attr.RemoveAttribute(node, "title");
10816  }
10817  if(requirePaddingManipulation) {
10818   for(var i = 0; i < nodesCount; i++) {
10819    var info = nodeInfos[i];
10820    var node = info.node;
10821    node.style.paddingLeft = info.paddingLeft;
10822   }
10823  }
10824 },
10825 GetEllipsisNodes: function(element) {
10826  var ellipsibleNodes = ASPx.Data.CollectionToArray(ASPx.GetNodesByClassName(element, ELLIPSIS_MARKER_CLASS));
10827  if(ASPx.ElementHasCssClass(element, ELLIPSIS_MARKER_CLASS))
10828   ellipsibleNodes.push(element);
10829  return ellipsibleNodes.filter(function(node) {
10830   return !ASPx.Attr.IsExistsAttribute(node, "title") || ASPx.Attr.IsExistsAttribute(node, ELLIPSIS_TOOLTIP_MARKER_ATTR);
10831  });
10832 },
10833 GetEllipsisTooltipText: function(element) {
10834  if(element && ASPx.IsExists(element.innerText))
10835   return element.innerText;
10836  return ASPx.GetInnerText(element);
10837 },
10838 RequireAssignTooltips: function() {
10839  return this.enableEllipsis && !ASPx.Browser.MobileUI;
10840 },
10841 OnBrowserWindowResize: function(e) {
10842 },
10843 OnBrowserWindowResizeInternal: function(e){
10844  if(this.BrowserWindowResizeSubscriber()) 
10845   this.OnBrowserWindowResize(e);
10846 },
10847 BrowserWindowResizeSubscriber: function() {
10848  return this.widthValueSetInPercentage || !this.IsAdjusted();
10849 },
10850 ShrinkWrappedText: function(getElements, key, reCorrect) {
10851  if(!ASPx.Browser.Safari) return;
10852  var elements = ASPx.CacheHelper.GetCachedElements(this, key, getElements, this.wrappedTextContainers);
10853  for(var i = 0; i < elements.length; i++)
10854   this.ShrinkWrappedTextInContainer(elements[i], reCorrect);
10855 },
10856 ShrinkWrappedTextInContainer: function(container, reCorrect) {
10857  if(!ASPx.Browser.Safari || !container || (container.dxWrappedTextShrinked && !reCorrect) || container.offsetWidth === 0) return;
10858  ASPx.ShrinkWrappedTextInContainer(container);
10859  container.dxWrappedTextShrinked = true;
10860 },
10861 CorrectWrappedText: function(getElements, key, reCorrect) {
10862  var elements = ASPx.CacheHelper.GetCachedElements(this, key, getElements, this.wrappedTextContainers);
10863  for(var i = 0; i < elements.length; i++)
10864   this.CorrectWrappedTextInContainer(elements[i], reCorrect);
10865 },
10866 CorrectWrappedTextInContainer: function(container, reCorrect) {
10867  if(!container || (container.dxWrappedTextCorrected && !reCorrect) || container.offsetWidth === 0) return;
10868  ASPx.AdjustWrappedTextInContainer(container);
10869  container.dxWrappedTextCorrected = true;
10870 },
10871 CorrectVerticalAlignment: function(alignMethod, getElements, key, reAlign) {
10872  var elements = ASPx.CacheHelper.GetCachedElements(this, key, getElements, this.verticalAlignedElements);
10873  for(var i = 0; i < elements.length; i++)
10874   this.CorrectElementVerticalAlignment(alignMethod, elements[i], reAlign);
10875 },
10876 CorrectElementVerticalAlignment: function(alignMethod, element, reAlign) {
10877  if(!element || (element.dxVerticalAligned && !reAlign) || element.offsetHeight === 0) return;
10878  alignMethod(element);
10879  element.dxVerticalAligned = true;
10880 },
10881 ClearVerticalAlignedElementsCache: function() {
10882  ASPx.CacheHelper.DropCache(this.verticalAlignedElements);
10883 },
10884 ClearWrappedTextContainersCache: function() {
10885  ASPx.CacheHelper.DropCache(this.wrappedTextContainers);
10886 },
10887 AdjustPagerControls: function() {
10888  if(typeof(ASPx.GetPagersCollection) != "undefined")
10889   ASPx.GetPagersCollection().AdjustControls(this.GetMainElement());
10890 },
10891 RegisterInControlTree: function(tree) {
10892  var mainElement = this.GetMainElement();
10893  if(mainElement && mainElement.id)
10894   tree.createNode(mainElement.id, this);
10895 },
10896 GetItemElementName: function(element) {
10897  var name = "";
10898  if(element.id)
10899   name = element.id.substring(this.name.length + 1);
10900  return name;
10901 },
10902 GetLinkElement: function(element) {
10903  if(element == null) return null;
10904  return (element.tagName == "A") ? element : ASPx.GetNodeByTagName(element, "A", 0);
10905 },
10906 GetInternalHyperlinkElement: function(parentElement, index) {
10907  var element = ASPx.GetNodeByTagName(parentElement, "A", index);
10908  if(element == null) 
10909   element = ASPx.GetNodeByTagName(parentElement, "SPAN", index);
10910  return element;
10911 },
10912 OnControlClick: function(clickedElement, htmlEvent) {
10913 }
10914});
10915ASPxClientControl.Cast = function(obj) {
10916 if(typeof obj == "string")
10917  return window[obj];
10918 return obj;
10919};
10920ASPxClientControl.AdjustControls = function(container, collapseControls){
10921 aspxGetControlCollection().AdjustControls(container, collapseControls);
10922};
10923ASPxClientControl.GetControlCollection = function(){
10924 return aspxGetControlCollection();
10925}
10926ASPxClientControl.LeadingAfterInitCallConsts = {
10927 None: 0,
10928 Direct: 1,
10929 Reverse: 2
10930};
10931var ASPxClientComponent = ASPx.CreateClass(ASPxClientControl, {
10932 constructor: function (name) {
10933  this.constructor.prototype.constructor.call(this, name);
10934 },
10935 IsDOMDisposed: function() { 
10936  return false;
10937 }
10938});
10939var ASPxClientControlCollection = ASPx.CreateClass(ASPx.CollectionBase, {
10940 constructor: function(){
10941  this.constructor.prototype.constructor.call(this);
10942  this.prevWndWidth = "";
10943  this.prevWndHeight = "";
10944  this.requestCountInternal = 0; 
10945  this.BeforeInitCallback = new ASPxClientEvent();
10946  this.ControlsInitialized = new ASPxClientEvent();
10947  this.BrowserWindowResized = new ASPxClientEvent();
10948  this.BeginCallback = new ASPxClientEvent();
10949  this.EndCallback = new ASPxClientEvent();
10950  this.CallbackError = new ASPxClientEvent();
10951  this.ValidationCompleted = new ASPxClientEvent();
10952  aspxGetControlCollectionCollection().Add(this);
10953 },
10954 Add: function(element) {
10955  var existsElement = this.Get(element.name);
10956  if(existsElement && existsElement !== element) 
10957   this.Remove(existsElement);
10958  ASPx.CollectionBase.prototype.Add.call(this, element.name, element);
10959 },
10960 Remove: function(element) {
10961  if(element && element instanceof ASPxClientControl)
10962   element.OnDispose();
10963  ASPx.CollectionBase.prototype.Remove.call(this, element.name);
10964 },
10965 GetGlobal: function(name) {
10966  var result = window[name];
10967  return result && Ident.IsASPxClientControl(result)
10968   ? result
10969   : null;
10970 },
10971 GetByName: function(name){
10972  return this.Get(name) || this.GetGlobal(name);
10973 },
10974 GetCollectionType: function(){
10975  return ASPxClientControlCollection.BaseCollectionType;
10976 },
10977 GetControlsByPredicate: function(predicate) {
10978  var result = [];
10979  this.ForEachControl(function(control) {
10980   if(!predicate || predicate(control))
10981    result.push(control);
10982  });
10983  return result;
10984 },
10985 GetControlsByType: function(type) {
10986  return this.GetControlsByPredicate(function(control) { 
10987   return type && (control instanceof type);
10988  });
10989 },
10990 ForEachControl: function(action, context) {
10991  context = context || this;
10992  this.elementsMap.forEachEntry(function(name, control) {
10993   if(Ident.IsASPxClientControl(control))
10994    return action.call(context, control);
10995  }, context);
10996 },
10997 forEachControlHierarchy: function(container, context, collapseControls, processFunc) {
10998  context = context || this;
10999  var controlTree = new ASPx.ControlTree(this, container);
11000  controlTree.forEachControl(collapseControls, function(control) {
11001   processFunc.call(context, control);
11002  });
11003 },
11004 AdjustControls: function(container, collapseControls) {
11005  container = container || null;
11006  window.setTimeout(function() {
11007   this.AdjustControlsCore(container, collapseControls);
11008  }.aspxBind(this), 0);
11009 },
11010 AdjustControlsCore: function(container, collapseControls) {
11011  this.forEachControlHierarchy(container, this, collapseControls, function(control) {
11012   control.AdjustControl();
11013  });
11014 },
11015 CollapseControls: function(container) {
11016  this.ProcessControlsInContainer(container, function(control) {
11017   if(control.isASPxClientEdit)
11018    control.CollapseEditor();
11019   else if(!!window.ASPxClientRibbon && control instanceof ASPxClientRibbon)
11020    control.CollapseControl();
11021  });
11022 },
11023 AtlasInitialize: function(isCallback) {
11024  if(ASPx.Browser.IE && ASPx.Browser.MajorVersion < 9) {
11025   var func = function() {
11026    if(_aspxIsLinksLoaded())
11027     ASPx.ProcessScriptsAndLinks("", isCallback); 
11028    else
11029     setTimeout(func, 100);
11030   }   
11031   func();
11032  }
11033  else
11034   ASPx.ProcessScriptsAndLinks("", isCallback);
11035 },
11036 DOMContentLoaded: function() {
11037  this.ForEachControl(function(control){
11038    control.DOMContentLoaded();
11039  });
11040 },
11041 Initialize: function() {
11042  ASPx.GetPostHandler().Post.AddHandler(
11043   function(s, e) { this.OnPost(e); }.aspxBind(this)
11044  );
11045  ASPx.GetPostHandler().PostFinalization.AddHandler(
11046   function(s, e) { this.OnPostFinalization(e); }.aspxBind(this)
11047  );
11048  this.InitializeElements(false );
11049  if(typeof(Sys) != "undefined" && typeof(Sys.Application) != "undefined") {
11050   var checkIsInitialized = function() {
11051    if(Sys.Application.get_isInitialized())
11052     Sys.Application.add_load(aspxCAInit);
11053    else
11054     setTimeout(checkIsInitialized, 0);
11055   }
11056   checkIsInitialized();
11057  }
11058  this.InitWindowSizeCache();
11059 },
11060 InitializeElements: function(isCallback) {
11061  this.ForEachControl(function(control){
11062   if(!control.isInitialized)
11063    control.Initialize();
11064  });
11065  this.AfterInitializeElementsLeadingCall();
11066  this.AfterInitializeElements();
11067  this.RaiseControlsInitialized(isCallback);
11068 },
11069 AfterInitializeElementsLeadingCall: function() {
11070  var controls = {};
11071  controls[ASPxClientControl.LeadingAfterInitCallConsts.Direct] = [];
11072  controls[ASPxClientControl.LeadingAfterInitCallConsts.Reverse] = [];
11073  this.ForEachControl(function(control) {
11074   if(control.leadingAfterInitCall != ASPxClientControl.LeadingAfterInitCallConsts.None && !control.isInitialized)
11075    controls[control.leadingAfterInitCall].push(control);
11076  });
11077  var directInitControls = controls[ASPxClientControl.LeadingAfterInitCallConsts.Direct],
11078   reverseInitControls = controls[ASPxClientControl.LeadingAfterInitCallConsts.Reverse];
11079  for(var i = 0, control; control = directInitControls[i]; i++)
11080   control.AfterInitialize();
11081  for(var i = reverseInitControls.length - 1, control; control = reverseInitControls[i]; i--)
11082   control.AfterInitialize();
11083 },
11084 AfterInitializeElements: function() {
11085  this.ForEachControl(function(control) {
11086   if(control.leadingAfterInitCall == ASPxClientControl.LeadingAfterInitCallConsts.None && !control.isInitialized)
11087    control.AfterInitialize();
11088  });
11089  ASPx.RippleHelper.Init();
11090 },
11091 DoFinalizeCallback: function() {
11092  this.ForEachControl(function(control){
11093   control.DoFinalizeCallback();
11094  });
11095 },
11096 ProcessControlsInContainer: function(container, processFunc) {
11097  this.ForEachControl(function(control){
11098   if(!container || this.IsControlInContainer(container, control))
11099    processFunc(control);
11100  });
11101 },
11102 IsControlInContainer: function(container, control) {
11103  if(control.GetMainElement) {
11104   var mainElement = control.GetMainElement();
11105   if(mainElement && (mainElement != container)) {
11106    if(ASPx.GetIsParent(container, mainElement))
11107     return true;
11108   }
11109  }
11110  return false;
11111 },
11112 RaiseControlsInitialized: function(isCallback) {
11113  if(typeof(isCallback) == "undefined")
11114   isCallback = true;
11115  var args = new ASPxClientControlsInitializedEventArgs(isCallback);
11116  if(!this.ControlsInitialized.IsEmpty())  
11117   this.ControlsInitialized.FireEvent(this, args);
11118  this.ForEachControl(function(control){
11119   control.OnGlobalControlsInitialized(args);
11120  });
11121 },
11122 RaiseBrowserWindowResized: function() {
11123  var args = new ASPxClientEventArgs();
11124  if(!this.BrowserWindowResized.IsEmpty())
11125   this.BrowserWindowResized.FireEvent(this, args);
11126  this.ForEachControl(function(control){
11127   control.OnGlobalBrowserWindowResized(args);
11128  });
11129 },
11130 RaiseBeginCallback: function (control, command) {
11131  var args = new ASPxClientGlobalBeginCallbackEventArgs(control, command);
11132  if(!this.BeginCallback.IsEmpty())
11133   this.BeginCallback.FireEvent(this, args);
11134  this.ForEachControl(function(control){
11135   control.OnGlobalBeginCallback(args);
11136  });
11137  this.IncrementRequestCount();
11138 },
11139 RaiseEndCallback: function (control) {
11140  var args = new ASPxClientGlobalEndCallbackEventArgs(control);
11141  if (!this.EndCallback.IsEmpty()) 
11142   this.EndCallback.FireEvent(this, args);
11143  this.ForEachControl(function(control){
11144   control.OnGlobalEndCallback(args);
11145  });
11146  this.DecrementRequestCount();
11147 },
11148 InCallback: function() {
11149  return this.requestCountInternal > 0;
11150 },
11151 RaiseCallbackError: function (control, message, callbackId) {
11152  var args = new ASPxClientGlobalCallbackErrorEventArgs(control, message, callbackId);
11153  if (!this.CallbackError.IsEmpty()) 
11154   this.CallbackError.FireEvent(this, args);
11155  this.ForEachControl(function(control){
11156   control.OnGlobalCallbackError(args);
11157  });
11158  if(args.handled)
11159   return { isHandled: true, errorMessage: args.message };  
11160  return { isHandled: false, errorMessage: message };
11161 },
11162 RaiseValidationCompleted: function (container, validationGroup, invisibleControlsValidated, isValid, firstInvalidControl, firstVisibleInvalidControl) {
11163  var args = new ASPxClientValidationCompletedEventArgs(container, validationGroup, invisibleControlsValidated, isValid, firstInvalidControl, firstVisibleInvalidControl);
11164  if (!this.ValidationCompleted.IsEmpty()) 
11165   this.ValidationCompleted.FireEvent(this, args);
11166  this.ForEachControl(function(control){
11167   control.OnGlobalValidationCompleted(args);
11168  });
11169 },
11170 Before_WebForm_InitCallback: function(callbackOwnerID){
11171  var args = new BeforeInitCallbackEventArgs(callbackOwnerID);
11172  this.BeforeInitCallback.FireEvent(this, args);
11173 },
11174 InitWindowSizeCache: function(){
11175  this.prevWndWidth = ASPx.GetDocumentClientWidth();
11176  this.prevWndHeight = ASPx.GetDocumentClientHeight();
11177 },
11178 OnBrowserWindowResize: function(evt){
11179  var shouldIgnoreNestedEvents = ASPx.Browser.IE && ASPx.Browser.MajorVersion == 8;
11180  if(shouldIgnoreNestedEvents) {
11181   if(this.prevWndWidth === "" || this.prevWndHeight === "" || this.browserWindowResizeLocked)
11182    return;
11183   this.browserWindowResizeLocked = true;
11184  }
11185  this.OnBrowserWindowResizeCore(evt);
11186  if(shouldIgnoreNestedEvents)
11187   this.browserWindowResizeLocked = false;
11188 },
11189 OnBrowserWindowResizeCore: function(htmlEvent){
11190  var args = this.CreateOnBrowserWindowResizeEventArgs(htmlEvent);
11191  if(this.CalculateIsBrowserWindowSizeChanged()) {
11192   this.forEachControlHierarchy(null, this, true, function(control) {
11193    if(control.IsDOMInitialized())
11194     control.OnBrowserWindowResizeInternal(args);
11195   });
11196   this.RaiseBrowserWindowResized();
11197  }
11198 },
11199 CreateOnBrowserWindowResizeEventArgs: function(htmlEvent){
11200  return {
11201   htmlEvent: htmlEvent,
11202   wndWidth: ASPx.GetDocumentClientWidth(),
11203   wndHeight: ASPx.GetDocumentClientHeight(),
11204   prevWndWidth: this.prevWndWidth,
11205   prevWndHeight: this.prevWndHeight
11206  }
11207 },
11208 CalculateIsBrowserWindowSizeChanged: function(){
11209  var wndWidth = ASPx.GetDocumentClientWidth();
11210  var wndHeight = ASPx.GetDocumentClientHeight();
11211  var isBrowserWindowSizeChanged = (this.prevWndWidth != wndWidth) || (this.prevWndHeight != wndHeight);
11212  if(isBrowserWindowSizeChanged){
11213   this.prevWndWidth = wndWidth;
11214   this.prevWndHeight = wndHeight;
11215   return true;
11216  }
11217  return false;
11218 },
11219 OnPost: function(args){
11220  this.ForEachControl(function(control) {
11221   control.OnPost(args);
11222  }, null);
11223 },
11224 OnPostFinalization: function(args){
11225  this.ForEachControl(function(control) {
11226   control.OnPostFinalization(args);
11227  }, null);
11228 },
11229 IncrementRequestCount: function() {
11230  this.requestCountInternal++;
11231 },
11232 DecrementRequestCount: function() {
11233  this.requestCountInternal--;
11234 },
11235 ResetRequestCount: function() {
11236  this.requestCountInternal = 0;
11237 }
11238});
11239ASPxClientControlCollection.BaseCollectionType = "Control";
11240var controlCollection = null;
11241function aspxGetControlCollection(){
11242 if(controlCollection == null) 
11243  controlCollection = new ASPxClientControlCollection();
11244 return controlCollection;
11245}
11246var ControlCollectionCollection = ASPx.CreateClass(ASPx.CollectionBase, {
11247 constructor: function(){
11248  this.constructor.prototype.constructor.call(this);
11249 },
11250 Add: function(element) {
11251  var key = element.GetCollectionType();
11252  if(!key) throw "The collection type isn't specified.";
11253  if(this.Get(key)) throw "The collection with type='" + key + "' already exists.";
11254  ASPx.CollectionBase.prototype.Add.call(this, key, element);
11255 },
11256 RemoveDisposedControls: function(){
11257  var baseCollection = this.Get(ASPxClientControlCollection.BaseCollectionType);
11258  var disposedControls = [];
11259  baseCollection.elementsMap.forEachEntry(function(name, control) {
11260   if(!ASPx.Ident.IsASPxClientControl(control)) return;
11261   if(control.IsDOMDisposed())
11262    disposedControls.push(control);
11263  });
11264  for(var i = 0; i < disposedControls.length; i++) {
11265   this.elementsMap.forEachEntry(function(key, collection) {
11266    if(ASPx.Ident.IsASPxClientCollection(collection))
11267     collection.Remove(disposedControls[i]);
11268   });
11269  }
11270 }
11271});
11272var controlCollectionCollection = null;
11273function aspxGetControlCollectionCollection(){
11274 if(controlCollectionCollection == null)
11275  controlCollectionCollection = new ControlCollectionCollection();
11276 return controlCollectionCollection;
11277}
11278var AriaDescriptionAttributes = {
11279 Role: "0",
11280 AriaLabel: "1",
11281 TabIndex: "2",
11282 AriaOwns: "3",
11283 AriaDescribedBy: "4",
11284 AriaDisabled: "5",
11285 AriaHasPopup: "6",
11286 AriaLevel: "7"
11287};
11288var AriaDescriptor = ASPx.CreateClass(null, {
11289 constructor: function(ownerControl, description) {
11290  this.ownerControl = ownerControl;
11291  this.rootElement = ownerControl.GetMainElement();
11292  this.description = description;
11293 },
11294 setDescription: function(name, argList) {
11295  var description = this.findChildDescription(name);
11296  if(description) {
11297   var elements = name ? this.rootElement.querySelectorAll(this.getDescriptionSelector(description)) : [this.rootElement];
11298   for(var i = 0; i < elements.length; i++)
11299    this.applyDescriptionToElement(elements[i], description, argList[i] || argList[0]);
11300  }
11301 },
11302 getDescriptionName: function(description) {
11303  return description.n;
11304 },
11305 getDescriptionSelector: function(description) {
11306  return description.s;
11307 },
11308 findChildDescription: function(name) {
11309  if(name === this.getDescriptionName(this.description))
11310   return this.description;
11311  var childCollection = this.description.c || [];
11312  for(var i = 0; i < childCollection.length; i++) {
11313   var childDescription = childCollection[i];
11314   if(this.getDescriptionName(childDescription) === name)
11315    return childDescription;
11316  }
11317  return null;
11318 },
11319 applyDescriptionToElement: function(element, description, args) {
11320  if(!description || !element)
11321   return;
11322  this.trySetAriaOwnsAttribute(element, description);
11323  this.trySetAriaDescribedByAttribute(element, description);
11324  this.trySetAttribute(element, description, AriaDescriptionAttributes.Role, "role");
11325  this.trySetAttribute(element, description, AriaDescriptionAttributes.TabIndex, "tabindex");
11326  this.trySetAttribute(element, description, AriaDescriptionAttributes.AriaLevel, "aria-level");
11327  this.executeOnDescription(description, AriaDescriptionAttributes.AriaLabel, function(value) {
11328   ASPx.Attr.SetAttribute(element, "aria-label", ASPx.Str.ApplyReplacement(value, args));
11329  });
11330  this.executeOnDescription(description, AriaDescriptionAttributes.AriaDisabled, function(value) {
11331   ASPx.Attr.SetAttribute(element, "aria-disabled", !!value); 
11332  });
11333  this.executeOnDescription(description, AriaDescriptionAttributes.AriaHasPopup, function(value) {
11334   ASPx.Attr.SetAttribute(element, "aria-haspopup", !!value);
11335  });
11336 },
11337 trySetAriaDescribedByAttribute: function(element, description) {
11338  this.executeOnDescription(description, AriaDescriptionAttributes.AriaDescribedBy, function(selectorInfo) {
11339   var descriptor = this.getNodesBySelector(element, selectorInfo.descriptorSelector)[0];
11340   var target = this.getNodesBySelector(element, selectorInfo.targetSelector)[0];
11341   if(!target || !descriptor)
11342    return;
11343   ASPx.Attr.SetAttribute(target, "aria-describedby", this.getNodeId(descriptor));
11344  });
11345 },
11346 trySetAriaOwnsAttribute: function(element, description) {
11347  this.executeOnDescription(description, AriaDescriptionAttributes.AriaOwns, function(selector) {
11348   var ownedNodes = this.getNodesBySelector(element, selector);
11349   var ariaOwnsAttributeValue = "";
11350   for(var i = 0; i < ownedNodes.length; i++)
11351    ariaOwnsAttributeValue += (this.getNodeId(ownedNodes[i]) + (i != ownedNodes.length - 1 ? " " : ""));
11352   ASPx.Attr.SetAttribute(element, "aria-owns", ariaOwnsAttributeValue);
11353  });
11354 },
11355 trySetAttribute: function(element, description, ariaAttribute, attributeName) {
11356  this.executeOnDescription(description, ariaAttribute, function(value) { 
11357   ASPx.Attr.SetAttribute(element, attributeName, description[ariaAttribute]); 
11358  });
11359 },
11360 executeOnDescription: function(description, ariaDescAttr, callback) {
11361  var descInfo = description[ariaDescAttr];
11362  if(ASPx.IsExists(descInfo))
11363   callback.aspxBind(this)(descInfo);
11364 },
11365 getNodesBySelector: function(element, selector) {
11366  var id = element.id || "";
11367  var childNodes = element.querySelectorAll("#" + this.getNodeId(element) + " > " + selector);
11368  ASPx.Attr.SetOrRemoveAttribute(element, "id", id);
11369  return childNodes;
11370 },
11371 getNodeId: function(node) {
11372  if(!node.id)
11373   node.id = this.createRandomId();
11374  return node.id; 
11375 },
11376 createRandomId: function() {
11377  return "r" + ASPx.CreateGuid();
11378 }
11379});
11380PagerCommands = {
11381 Next : "PBN",
11382 Prev : "PBP",
11383 Last : "PBL",
11384 First : "PBF",
11385 PageNumber : "PN",
11386 PageSize : "PSP"
11387};
11388ASPx.Callback = function(result, context){
11389 var collection = aspxGetControlCollection();
11390 collection.DoFinalizeCallback();
11391 var control = collection.Get(context);
11392 if(control != null)
11393  control.DoCallback(result);
11394 ASPx.RippleHelper.ReInit();
11395}
11396ASPx.CallbackError = function(result, context){
11397 var control = aspxGetControlCollection().Get(context);
11398 if(control != null)
11399  control.DoCallbackError(result, false);
11400}
11401ASPx.CClick = function(name, evt) {
11402 var control = aspxGetControlCollection().Get(name);
11403 if(control != null) control.DoControlClick(evt);
11404}
11405function aspxCAInit() {
11406 var isAppInit = typeof(Sys$_Application$initialize) != "undefined" &&
11407  ASPx.FunctionIsInCallstack(arguments.callee, Sys$_Application$initialize, 10 );
11408 aspxGetControlCollection().AtlasInitialize(!isAppInit);
11409}
11410ASPx.Evt.AttachEventToElement(window, "resize", aspxGlobalWindowResize);
11411function aspxGlobalWindowResize(evt){
11412 aspxGetControlCollection().OnBrowserWindowResize(evt); 
11413}
11414ASPx.Evt.AttachEventToElement(window.document, "DOMContentLoaded", aspxClassesDOMContentLoaded);
11415function aspxClassesDOMContentLoaded(evt){
11416 aspxGetControlCollection().DOMContentLoaded();
11417}
11418ASPx.GetControlCollection = aspxGetControlCollection;
11419ASPx.GetControlCollectionCollection = aspxGetControlCollectionCollection;
11420ASPx.GetPersistentControlPropertiesStorage = _aspxGetPersistentControlPropertiesStorage;
11421ASPx.PagerCommands = PagerCommands;
11422window.ASPxClientBeginCallbackEventArgs = ASPxClientBeginCallbackEventArgs;
11423window.ASPxClientGlobalBeginCallbackEventArgs = ASPxClientGlobalBeginCallbackEventArgs;
11424window.ASPxClientEndCallbackEventArgs = ASPxClientEndCallbackEventArgs;
11425window.ASPxClientGlobalEndCallbackEventArgs = ASPxClientGlobalEndCallbackEventArgs;
11426window.ASPxClientCallbackErrorEventArgs = ASPxClientCallbackErrorEventArgs;
11427window.ASPxClientGlobalCallbackErrorEventArgs = ASPxClientGlobalCallbackErrorEventArgs;
11428window.ASPxClientCustomDataCallbackEventArgs = ASPxClientCustomDataCallbackEventArgs;
11429window.ASPxClientValidationCompletedEventArgs = ASPxClientValidationCompletedEventArgs;
11430window.ASPxClientControlsInitializedEventArgs = ASPxClientControlsInitializedEventArgs;
11431window.ASPxClientControlBeforePronounceEventArgs = ASPxClientControlBeforePronounceEventArgs;
11432window.ASPxClientControlCollection = ASPxClientControlCollection;
11433window.ASPxClientControlBase = ASPxClientControlBase;
11434window.ASPxClientControl = ASPxClientControl;
11435window.ASPxClientComponent = ASPxClientComponent;
11436})();
11437(function () {
11438 var PositionAnimationTransition = ASPx.CreateClass(ASPx.AnimationTransitionBase, {
11439  constructor: function (element, options) {
11440   this.constructor.prototype.constructor.call(this, element, options);
11441   this.direction = options.direction;
11442   this.animationTransition = this.createAnimationTransition();
11443   AnimationHelper.appendWKAnimationClassNameIfRequired(this.element);
11444  },
11445  Start: function (to) {
11446   var from = this.GetValue();
11447   if(ASPx.AnimationUtils.CanUseCssTransform()) {
11448    from = this.convertPosToCssTransformPos(from);
11449    to = this.convertPosToCssTransformPos(to);
11450   }
11451   this.animationTransition.Start(from, to);
11452  },
11453  SetValue: function (value) {
11454   ASPx.AnimationUtils.SetTransformValue(this.element, value, this.direction == AnimationHelper.SLIDE_VERTICAL_DIRECTION);
11455  },
11456  GetValue: function () {
11457   return ASPx.AnimationUtils.GetTransformValue(this.element, this.direction == AnimationHelper.SLIDE_VERTICAL_DIRECTION);
11458  },
11459  createAnimationTransition: function () {
11460   var transition = ASPx.AnimationUtils.CanUseCssTransform() ? this.createTransformAnimationTransition() : this.createPositionAnimationTransition();
11461   transition.transition = ASPx.AnimationConstants.Transitions.POW_EASE_OUT;
11462   return transition;
11463  },
11464  createTransformAnimationTransition: function () {
11465   return ASPx.AnimationUtils.createCssAnimationTransition(this.element, {
11466    property: ASPx.AnimationUtils.CanUseCssTransform(),
11467    duration: this.duration,
11468    onComplete: this.onComplete
11469   });
11470  },
11471  createPositionAnimationTransition: function () {
11472   return AnimationHelper.createAnimationTransition(this.element, {
11473    property: this.direction == AnimationHelper.SLIDE_VERTICAL_DIRECTION ? "top" : "left",
11474    unit: "px",
11475    duration: this.duration,
11476    onComplete: this.onComplete
11477   });
11478  },
11479  convertPosToCssTransformPos: function (position) {
11480   return ASPx.AnimationUtils.GetTransformCssText(position, this.direction == AnimationHelper.SLIDE_VERTICAL_DIRECTION);
11481  }
11482 });
11483 var AnimationHelper = {
11484  SLIDE_HORIZONTAL_DIRECTION: 0,
11485  SLIDE_VERTICAL_DIRECTION: 1,
11486  SLIDE_TOP_DIRECTION: 0,
11487  SLIDE_RIGHT_DIRECTION: 1,
11488  SLIDE_BOTTOM_DIRECTION: 2,
11489  SLIDE_LEFT_DIRECTION: 3,
11490  SLIDE_CONTAINER_CLASS: "dxAC",
11491  MAXIMUM_DEPTH: 3,
11492  createAnimationTransition: function (element, options) {
11493   if(options.onStep) 
11494    options.animationEngine = "js";
11495   switch (options.animationEngine) {
11496    case "js":
11497     return ASPx.AnimationUtils.createJsAnimationTransition(element, options);
11498    case "css":
11499     return ASPx.AnimationUtils.createCssAnimationTransition(element, options);
11500    default:
11501     return ASPx.AnimationUtils.CanUseCssTransition() ? ASPx.AnimationUtils.createCssAnimationTransition(element, options) :
11502      ASPx.AnimationUtils.createJsAnimationTransition(element, options);
11503   }
11504  },
11505  createMultipleAnimationTransition: function (element, options) {
11506   return ASPx.AnimationUtils.createMultipleAnimationTransition(element, options);
11507  },
11508  createSimpleAnimationTransition: function (options) {
11509   return ASPx.AnimationUtils.createSimpleAnimationTransition(options);
11510  },
11511  cancelAnimation: function (element) {
11512   ASPx.AnimationTransitionBase.Cancel(element);
11513  },
11514  fadeIn: function (element, onComplete, duration) {
11515   AnimationHelper.fadeTo(element, {
11516    from: 0, to: 1,
11517    onComplete: onComplete,
11518    duration: duration || ASPx.AnimationConstants.Durations.DEFAULT
11519   });
11520  },
11521  fadeOut: function (element, onComplete, duration) {
11522   AnimationHelper.fadeTo(element, {
11523    from: ASPx.GetElementOpacity(element), to: 0,
11524    onComplete: onComplete,
11525    duration: duration || ASPx.AnimationConstants.Durations.DEFAULT
11526   });
11527  },
11528  fadeTo: function (element, options) {
11529   options.property = "opacity";
11530   if(!options.duration)
11531    options.duration = ASPx.AnimationConstants.Durations.SHORT;
11532   var transition = AnimationHelper.createAnimationTransition(element, options);
11533   if(!ASPx.IsExists(options.from))
11534    options.from = transition.GetValue();
11535   transition.Start(options.from, options.to);
11536  },
11537  slideIn: function (element, direction, onComplete, animationEngineType) {
11538   AnimationHelper.setOpacity(element, 1);
11539   var animationContainer = AnimationHelper.getSlideAnimationContainer(element, true, true);
11540   var pos = AnimationHelper.getSlideInStartPos(animationContainer, direction);
11541   var transition = AnimationHelper.createSlideTransition(animationContainer, direction,
11542    function (el) {
11543     AnimationHelper.resetSlideAnimationContainerSize(animationContainer);
11544     if(onComplete)
11545      onComplete(el);
11546    }, animationEngineType);
11547   transition.Start(pos, 0);
11548  },
11549  slideOut: function (element, direction, onComplete, animationEngineType) {
11550   var animationContainer = AnimationHelper.getSlideAnimationContainer(element, true, true);
11551   var pos = AnimationHelper.getSlideOutFinishPos(animationContainer, direction);
11552   var transition = AnimationHelper.createSlideTransition(animationContainer, direction,
11553    function (el) {
11554     AnimationHelper.setOpacity(el.firstChild, 0);
11555     if(onComplete)
11556      onComplete(el);
11557    }, animationEngineType);
11558   transition.Start(pos);
11559  },
11560  slideTo: function (element, options) {
11561   if(!ASPx.IsExists(options.direction))
11562    options.direction = AnimationHelper.SLIDE_HORIZONTAL_DIRECTION;
11563   var transition = new PositionAnimationTransition(element, options);
11564   transition.Start(options.to);
11565  },
11566  setOpacity: function (element, value) {
11567   ASPx.AnimationUtils.setOpacity(element, value);
11568  },
11569  appendWKAnimationClassNameIfRequired: function (element) {
11570   if(ASPx.AnimationUtils.CanUseCssTransform() && ASPx.Browser.WebKitFamily && !ASPx.ElementHasCssClass(element, "dx-wbv"))
11571    element.className += " dx-wbv";
11572  },
11573  findSlideAnimationContainer: function (element) {
11574   var container = element
11575   for(var i = 0; i < AnimationHelper.MAXIMUM_DEPTH; i++) {
11576    if(container.tagName == "BODY")
11577     return null;
11578    if(ASPx.ElementHasCssClass(container, AnimationHelper.SLIDE_CONTAINER_CLASS))
11579     return container;
11580    container = container.parentNode;
11581   }
11582   return null;
11583  },
11584  createSlideAnimationContainer: function (element) {
11585   var rootContainer = document.createElement("DIV");
11586   ASPx.SetStyles(rootContainer, {
11587    className: AnimationHelper.SLIDE_CONTAINER_CLASS,
11588    overflow: "hidden"
11589   });
11590   var elementContainer = document.createElement("DIV");
11591   rootContainer.appendChild(elementContainer);
11592   var parentNode = element.parentNode;
11593   parentNode.insertBefore(rootContainer, element);
11594   elementContainer.appendChild(element);
11595   return rootContainer;
11596  },
11597  getSlideAnimationContainer: function (element, create, fixSize) {
11598   if(!element) return;
11599   var width = element.offsetWidth;
11600   var height = element.offsetHeight;
11601   var container;
11602   if(element.className == AnimationHelper.SLIDE_CONTAINER_CLASS)
11603    container = element;
11604   if(!container)
11605    container = AnimationHelper.findSlideAnimationContainer(element);
11606   if(!container && create)
11607    container = AnimationHelper.createSlideAnimationContainer(element);
11608   if(container && fixSize) {
11609    ASPx.SetStyles(container, {
11610     width: width, height: height
11611    });
11612    ASPx.SetStyles(container.firstChild, {
11613     width: width, height: height
11614    });
11615   }
11616   return container;
11617  },
11618  resetSlideAnimationContainerSize: function (container) {
11619   ASPx.SetStyles(container, {
11620    width: "", height: ""
11621   });
11622   ASPx.SetStyles(container.firstChild, {
11623    width: "", height: ""
11624   });
11625  },
11626  getModifyProperty: function (direction) {
11627   if(direction == AnimationHelper.SLIDE_TOP_DIRECTION || direction == AnimationHelper.SLIDE_BOTTOM_DIRECTION)
11628    return "marginTop";
11629   return "marginLeft";
11630  },
11631  createSlideTransition: function (animationContainer, direction, complete, animationEngineType) {
11632   var animationEngine = "";
11633   switch(animationEngineType) {
11634    case AnimationEngineType.JS:
11635     animationEngine = "js";
11636     break;
11637    case AnimationEngineType.CSS:
11638     animationEngine = "css";
11639     break;
11640   }
11641   return AnimationHelper.createAnimationTransition(animationContainer.firstChild, {
11642    unit: "px",
11643    property: AnimationHelper.getModifyProperty(direction),
11644    onComplete: complete,
11645    animationEngine: animationEngine
11646   });
11647  },
11648  getSlideInStartPos: function (animationContainer, direction) {
11649   switch (direction) {
11650    case AnimationHelper.SLIDE_TOP_DIRECTION:
11651     return animationContainer.offsetHeight;
11652    case AnimationHelper.SLIDE_LEFT_DIRECTION:
11653     return animationContainer.offsetWidth;
11654    case AnimationHelper.SLIDE_RIGHT_DIRECTION:
11655     return -animationContainer.offsetWidth;
11656    case AnimationHelper.SLIDE_BOTTOM_DIRECTION:
11657     return -animationContainer.offsetHeight;
11658   }
11659  },
11660  getSlideOutFinishPos: function (animationContainer, direction) {
11661   switch (direction) {
11662    case AnimationHelper.SLIDE_TOP_DIRECTION:
11663     return -animationContainer.offsetHeight;
11664    case AnimationHelper.SLIDE_LEFT_DIRECTION:
11665     return -animationContainer.offsetWidth;
11666    case AnimationHelper.SLIDE_RIGHT_DIRECTION:
11667     return animationContainer.offsetWidth;
11668    case AnimationHelper.SLIDE_BOTTOM_DIRECTION:
11669     return animationContainer.offsetHeight;
11670   }
11671  }
11672 };
11673 var GestureHandler = ASPx.CreateClass(null, {
11674  constructor: function (getAnimationElement, canHandle, allowStart) {
11675   this.getAnimationElement = getAnimationElement;
11676   this.canHandle = canHandle;
11677   this.allowStart = allowStart;
11678   this.startMousePosX = 0;
11679   this.startMousePosY = 0;
11680   this.startTime = null;
11681   this.isEventsPrevented = false;
11682   this.savedElements = [];
11683  },
11684  OnSelectStart: function(evt) {
11685   ASPx.Evt.PreventEvent(evt); 
11686  },
11687  OnDragStart: function(evt) {
11688   ASPx.Evt.PreventEvent(evt);  
11689  },
11690  OnMouseDown: function (evt) {
11691   this.startMousePosX = ASPx.Evt.GetEventX(evt);
11692   this.startMousePosY = ASPx.Evt.GetEventY(evt);
11693   this.startTime = new Date();
11694  },
11695  OnMouseMove: function(evt) {
11696   if(!ASPx.Browser.MobileUI)
11697    ASPx.Selection.Clear();
11698   if(Math.abs(this.GetCurrentDistanceX(evt)) < GestureHandler.SLIDER_MIN_START_DISTANCE && Math.abs(this.GetCurrentDistanceY(evt)) < GestureHandler.SLIDER_MIN_START_DISTANCE)
11699    GesturesHelper.isExecutedGesture = false;
11700  },
11701  OnMouseUp: function (evt) {
11702  },
11703  CanHandleEvent: function (evt) {
11704   return !this.canHandle || this.canHandle(evt);
11705  },
11706  IsStartAllowed: function(value) {
11707   return !this.allowStart || this.allowStart(value);
11708  },
11709  RollbackGesture: function () {
11710  },
11711  GetRubberPosition: function (position) {
11712   return position / GestureHandler.FACTOR_RUBBER;
11713  },
11714  GetCurrentDistanceX: function (evt) {
11715   return ASPx.Evt.GetEventX(evt) - this.startMousePosX;
11716  },
11717  GetCurrentDistanceY: function (evt) {
11718   return ASPx.Evt.GetEventY(evt) - this.startMousePosY;
11719  },
11720  GetDistanceLimit: function () {
11721   return (new Date() - this.startTime) < GestureHandler.MAX_TIME_SPAN ? GestureHandler.MIN_DISTANCE_LIMIT : GestureHandler.MAX_DISTANCE_LIMIT;
11722  },
11723  GetContainerElement: function () {
11724  },
11725  AttachPreventEvents: function (evt) {
11726   if(!this.isEventsPrevented) {
11727    var element = ASPx.Evt.GetEventSource(evt);
11728    var container = this.GetContainerElement();
11729    while(element && element != container) {
11730     ASPx.Evt.AttachEventToElement(element, "mouseup", ASPx.Evt.PreventEvent);
11731     ASPx.Evt.AttachEventToElement(element, "click", ASPx.Evt.PreventEvent);
11732     this.savedElements.push(element);
11733     element = element.parentNode;
11734    }
11735    this.isEventsPrevented = true;
11736   }
11737  },
11738  DetachPreventEvents: function () {
11739   if(this.isEventsPrevented) {
11740    window.setTimeout(function () {
11741     while(this.savedElements.length > 0) {
11742      var element = this.savedElements.pop();
11743      ASPx.Evt.DetachEventFromElement(element, "mouseup", ASPx.Evt.PreventEvent);
11744      ASPx.Evt.DetachEventFromElement(element, "click", ASPx.Evt.PreventEvent);
11745     }
11746    }.aspxBind(this), 0);
11747    this.isEventsPrevented = false;
11748   }
11749  }
11750 });
11751 GestureHandler.MAX_DISTANCE_LIMIT = 70;
11752 GestureHandler.MIN_DISTANCE_LIMIT = 10;
11753 GestureHandler.MIN_START_DISTANCE = 0;
11754 GestureHandler.SLIDER_MIN_START_DISTANCE = 5;
11755 GestureHandler.MAX_TIME_SPAN = 300;
11756 GestureHandler.FACTOR_RUBBER = 4;
11757 GestureHandler.RETURN_ANIMATION_DURATION = 150;
11758 var SwipeSlideGestureHandler = ASPx.CreateClass(GestureHandler, {
11759  constructor: function (getAnimationElement, direction, canHandle, backward, forward, rollback, move) {
11760   this.constructor.prototype.constructor.call(this, getAnimationElement, canHandle);
11761   this.slideElement = this.getAnimationElement();
11762   this.container = this.slideElement.parentNode;
11763   this.direction = direction;
11764   this.backward = backward;
11765   this.forward = forward;
11766   this.rollback = rollback;
11767   this.slideElementSize = 0;
11768   this.containerElementSize = 0;
11769   this.startSliderElementPosition = 0;
11770   this.centeredSlideElementPosition = 0;
11771  },
11772  OnMouseDown: function (evt) {
11773   GestureHandler.prototype.OnMouseDown.call(this, evt);
11774   this.slideElementSize = this.GetElementSize();
11775   this.startSliderElementPosition = this.GetElementPosition();
11776   this.containerElementSize = this.GetContainerElementSize();
11777   if(this.slideElementSize <= this.containerElementSize)
11778    this.centeredSlideElementPosition = (this.containerElementSize - this.slideElementSize) / 2;
11779  },
11780  OnMouseMove: function (evt) {
11781   GestureHandler.prototype.OnMouseMove.call(this, evt);
11782   if(!ASPx.Browser.TouchUI && !ASPx.GetIsParent(this.container, ASPx.Evt.GetEventSource(evt))) {
11783    GesturesHelper.OnDocumentMouseUp(evt);
11784    return;
11785   }
11786   var distance = this.GetCurrentDistance(evt);
11787   if(Math.abs(distance) < GestureHandler.SLIDER_MIN_START_DISTANCE || ASPx.TouchUIHelper.isGesture)
11788    return;
11789   this.SetElementPosition(this.GetCalculatedPosition(distance));
11790   this.AttachPreventEvents(evt);
11791   ASPx.Evt.PreventEvent(evt);
11792  },
11793  GetCalculatedPosition: function (distance) {
11794   ASPx.AnimationTransitionBase.Cancel(this.slideElement);
11795   var position = this.startSliderElementPosition + distance,
11796    maxPosition = -(this.slideElementSize - this.containerElementSize),
11797    minPosition = 0;
11798   if(this.centeredSlideElementPosition > 0)
11799    position = this.GetRubberPosition(distance) + this.centeredSlideElementPosition;
11800   else if(position > minPosition)
11801    position = this.GetRubberPosition(distance);
11802   else if(position < maxPosition)
11803    position = this.GetRubberPosition(distance) + maxPosition;
11804   return position;
11805  },
11806  OnMouseUp: function (evt) {
11807   this.DetachPreventEvents();
11808   if(this.GetCurrentDistance(evt) != 0)
11809    this.OnMouseUpCore(evt);
11810  },
11811  OnMouseUpCore: function (evt) {
11812   var distance = this.GetCurrentDistance(evt);
11813   if(this.centeredSlideElementPosition > 0 || this.CheckSlidePanelIsOutOfBounds())
11814    this.PerformRollback();
11815   else
11816    this.PerformAction(distance);
11817  },
11818  PerformAction: function (distance) {
11819   if(Math.abs(distance) < this.GetDistanceLimit())
11820    this.PerformRollback();
11821   else if(distance < 0)
11822    this.PerformForward();
11823   else
11824    this.PerformBackward();
11825  },
11826  PerformBackward: function () {
11827   this.backward();
11828  },
11829  PerformForward: function () {
11830   this.forward();
11831  },
11832  PerformRollback: function () {
11833   this.rollback();
11834  },
11835  CheckSlidePanelIsOutOfBounds: function () {
11836   var minOffset = -(this.slideElementSize - this.containerElementSize), maxOffset = 0;
11837   var position = null, slideElementPos = this.GetElementPosition();
11838   if(slideElementPos > maxOffset || slideElementPos < minOffset)
11839    return true;
11840   return false;
11841  },
11842  GetContainerElement: function () {
11843   return this.container;
11844  },
11845  GetElementSize: function () {
11846   return this.IsHorizontalDirection() ? this.slideElement.offsetWidth : this.slideElement.offsetHeight;
11847  },
11848  GetContainerElementSize: function () {
11849   return this.IsHorizontalDirection() ? ASPx.GetClearClientWidth(this.container) : ASPx.GetClearClientHeight(this.container);
11850  },
11851  GetCurrentDistance: function (evt) {
11852   return this.IsHorizontalDirection() ? this.GetCurrentDistanceX(evt) : this.GetCurrentDistanceY(evt);
11853  },
11854  GetElementPosition: function () {
11855   return ASPx.AnimationUtils.GetTransformValue(this.slideElement, !this.IsHorizontalDirection());
11856  },
11857  SetElementPosition: function (position) {
11858   ASPx.AnimationUtils.SetTransformValue(this.slideElement, position, !this.IsHorizontalDirection());
11859  },
11860  IsHorizontalDirection: function () {
11861   return this.direction == AnimationHelper.SLIDE_HORIZONTAL_DIRECTION;
11862  }
11863 });
11864 var SwipeSimpleSlideGestureHandler = ASPx.CreateClass(SwipeSlideGestureHandler, {
11865  constructor: function (getAnimationElement, direction, canHandle, backward, forward, rollback, updatePosition) {
11866   this.constructor.prototype.constructor.call(this, getAnimationElement, direction, canHandle, backward, forward, rollback);
11867   this.container = this.slideElement;
11868   this.updatePosition = updatePosition;
11869   this.prevDistance = 0;
11870  },
11871  OnMouseDown: function (evt) {
11872   GestureHandler.prototype.OnMouseDown.call(this, evt);
11873   this.prevDistance = 0;
11874  },
11875  OnMouseUpCore: function (evt) {
11876   this.PerformAction(this.GetCurrentDistance(evt));
11877  },
11878  PerformAction: function (distance) {
11879   if(Math.abs(distance) < this.GetDistanceLimit())
11880    this.PerformRollback();
11881   else if(distance < 0)
11882    this.PerformForward();
11883   else
11884    this.PerformBackward();
11885  },
11886  GetCalculatedPosition: function (distance) {
11887   var position = distance - this.prevDistance;
11888   this.prevDistance = distance;
11889   return position;
11890  },
11891  SetElementPosition: function (position) {
11892   this.updatePosition(position);
11893  }
11894 });
11895 var SwipeGestureHandler = ASPx.CreateClass(GestureHandler, {
11896  constructor: function (getAnimationElement, canHandle, allowStart, start, allowComplete, complete, cancel, animationEngineType) {
11897   this.constructor.prototype.constructor.call(this, getAnimationElement, canHandle, allowStart);
11898   this.start = start;
11899   this.allowComplete = allowComplete;
11900   this.complete = complete;
11901   this.cancel = cancel;
11902   this.animationTween = null;
11903   this.currentDistanceX = 0;
11904   this.currentDistanceY = 0;
11905   this.tryStartGesture = false;
11906   this.tryStartScrolling = false;
11907   this.animationEngineType = animationEngineType;
11908   this.UpdateAnimationContainer();
11909  },
11910  UpdateAnimationContainer: function () {
11911   this.animationContainer = AnimationHelper.getSlideAnimationContainer(this.getAnimationElement(), true, false);
11912  },
11913  CanHandleEvent: function (evt) {
11914   if(GestureHandler.prototype.CanHandleEvent.call(this, evt))
11915    return true;
11916   return this.animationTween && this.animationContainer && ASPx.GetIsParent(this.animationContainer, ASPx.Evt.GetEventSource(evt));
11917  },
11918  OnMouseDown: function (evt) {
11919   GestureHandler.prototype.OnMouseDown.call(this, evt);
11920   if(this.animationTween)
11921    this.animationTween.Cancel();
11922   this.currentDistanceX = 0;
11923   this.currentDistanceY = 0;
11924   this.tryStartGesture = false;
11925   this.tryStartScrolling = false;
11926  },
11927  OnMouseMove: function (evt) {
11928   GestureHandler.prototype.OnMouseMove.call(this, evt);
11929   var isZoomGestureConflict = evt.touches && evt.touches.length > 1;
11930   if (isZoomGestureConflict)
11931    return false;
11932   this.currentDistanceX = this.GetCurrentDistanceX(evt);
11933   this.currentDistanceY = this.GetCurrentDistanceY(evt);
11934   if(!this.animationTween && !this.tryStartScrolling && (Math.abs(this.currentDistanceX) >
11935    GestureHandler.MIN_START_DISTANCE || Math.abs(this.currentDistanceY) > GestureHandler.MIN_START_DISTANCE)) {
11936    if(Math.abs(this.currentDistanceY) < Math.abs(this.currentDistanceX)) {
11937     this.tryStartGesture = true;
11938     if(this.IsStartAllowed(this.currentDistanceX)) {
11939      this.animationContainer = AnimationHelper.getSlideAnimationContainer(this.getAnimationElement(), true, true);
11940      this.animationTween = AnimationHelper.createSlideTransition(this.animationContainer, AnimationHelper.SLIDE_LEFT_DIRECTION,
11941       function () {
11942        AnimationHelper.resetSlideAnimationContainerSize(this.animationContainer);
11943        this.animationContainer = null;
11944        this.animationTween = null;
11945       }.aspxBind(this), this.animationEngineType);
11946      this.PerformStart(this.currentDistanceX);
11947      this.AttachPreventEvents(evt);
11948     }
11949    }
11950    else
11951     this.tryStartScrolling = true;
11952   }
11953   if(this.animationTween) {
11954    if(this.allowComplete && !this.allowComplete(this.currentDistanceX))
11955     this.currentDistanceX = this.GetRubberPosition(this.currentDistanceX);
11956    this.animationTween.SetValue(this.currentDistanceX);
11957   }
11958   if(!this.tryStartScrolling && !ASPx.TouchUIHelper.isGesture && evt.touches && evt.touches.length < 2)
11959    ASPx.Evt.PreventEvent(evt);
11960  },
11961  OnMouseUp: function (evt) {
11962   if(!this.animationTween) {
11963    if(this.tryStartGesture)
11964     this.PerformCancel(this.currentDistanceX);
11965   }
11966   else {
11967    if(Math.abs(this.currentDistanceX) < this.GetDistanceLimit())
11968     this.RollbackGesture();
11969    else {
11970     if(this.IsCompleteAllowed(this.currentDistanceX)) {
11971      this.PerformComplete(this.currentDistanceX);
11972      this.animationContainer = null;
11973      this.animationTween = null;
11974     }
11975     else
11976      this.RollbackGesture();
11977    }
11978   }
11979   this.DetachPreventEvents();
11980   this.tryStartGesture = false;
11981   this.tryStartScrolling = false;
11982  },
11983  PerformStart: function (value) {
11984   if(this.start)
11985    this.start(value);
11986  },
11987  IsCompleteAllowed: function (value) {
11988   return !this.allowComplete || this.allowComplete(value);
11989  },
11990  PerformComplete: function (value) {
11991   if(this.complete)
11992    this.complete(value);
11993  },
11994  PerformCancel: function (value) {
11995   if(this.cancel)
11996    this.cancel(value);
11997  },
11998  RollbackGesture: function () {
11999   this.animationTween.Start(this.currentDistanceX, 0);
12000  },
12001  ResetGestureElementPosition: function () {
12002   if (this.currentDistanceX === 0) return;
12003   var container = AnimationHelper.getSlideAnimationContainer(this.getAnimationElement());
12004   var onComplete = function () {  AnimationHelper.resetSlideAnimationContainerSize(container);  };
12005   var animation = AnimationHelper.createSlideTransition(container, AnimationHelper.SLIDE_LEFT_DIRECTION, onComplete, this.animationEngineType);
12006   animation.Start(this.currentDistanceX, 0);
12007  },
12008  GetContainerElement: function () {
12009   return this.animationContainer;
12010  }
12011 });
12012 var GesturesHelper = {
12013  handlers: {},
12014  activeHandler: null,
12015  isAttachedEvents: false,
12016  isExecutedGesture: false,
12017  AddSwipeGestureHandler: function (id, getAnimationElement, canHandle, allowStart, start, allowComplete, complete, cancel, animationEngineType) {
12018   this.handlers[id] = new SwipeGestureHandler(getAnimationElement, canHandle, allowStart, start, allowComplete, complete, cancel, animationEngineType);
12019  },
12020  UpdateSwipeAnimationContainer: function (id) {
12021   if(this.handlers[id])
12022    this.handlers[id].UpdateAnimationContainer();
12023  },
12024  AddSwipeSlideGestureHandler: function (id, getAnimationElement, direction, canHandle, backward, forward, rollback, updatePosition) {
12025   if(updatePosition)
12026    this.handlers[id] = new SwipeSimpleSlideGestureHandler(getAnimationElement, direction, canHandle, backward, forward, rollback, updatePosition);
12027   else
12028    this.handlers[id] = new SwipeSlideGestureHandler(getAnimationElement, direction, canHandle, backward, forward, rollback);
12029  },
12030  getParentDXEditorWithSwipeGestures: function(element) {
12031     return ASPx.GetParent(element, function(parent) {
12032      var parentObj = ASPx.GetControlCollection().Get(parent.id);
12033      return parentObj && parentObj.supportGestures && parentObj.isSwipeGesturesEnabled();
12034   });
12035  },
12036  canHandleMouseDown: function(evt) {
12037   if(!ASPx.Evt.IsLeftButtonPressed(evt))
12038    return false;
12039   var element = ASPx.Evt.GetEventSource(evt);
12040   var dxFocusedEditor = ASPx.Ident.scripts.ASPxClientEdit && ASPx.GetFocusedEditor();
12041   if(dxFocusedEditor && dxFocusedEditor.IsEditorElement(element)) {
12042    var elementParentDXEditorWithSwipeGestures = GesturesHelper.getParentDXEditorWithSwipeGestures(element);
12043    if(!elementParentDXEditorWithSwipeGestures || !dxFocusedEditor.IsEditorElement(elementParentDXEditorWithSwipeGestures))
12044     return false;
12045   }
12046   var isTextEditor = element.tagName == "TEXTAREA" || element.tagName == "INPUT" && ASPx.Attr.GetAttribute(element, "type") == "text";
12047   if(isTextEditor && document.activeElement == element)
12048    return false;
12049   return true;  
12050  },
12051  OnDocumentDragStart: function(evt) {
12052   if(GesturesHelper.activeHandler)
12053    GesturesHelper.activeHandler.OnDragStart(evt);
12054  },
12055  OnDocumentSelectStart: function(evt) {
12056   if(GesturesHelper.activeHandler)
12057    GesturesHelper.activeHandler.OnSelectStart(evt);
12058  },
12059  OnDocumentMouseDown: function (evt) {
12060   if(!GesturesHelper.canHandleMouseDown(evt))
12061    return;
12062   GesturesHelper.activeHandler = GesturesHelper.FindHandler(evt);
12063   if(GesturesHelper.activeHandler)
12064    GesturesHelper.activeHandler.OnMouseDown(evt);
12065  },
12066  OnDocumentMouseMove: function (evt) {
12067   if(GesturesHelper.activeHandler) {
12068    GesturesHelper.isExecutedGesture = true;
12069    GesturesHelper.activeHandler.OnMouseMove(evt);
12070   }
12071  },
12072  OnDocumentMouseUp: function (evt) {
12073   if(GesturesHelper.activeHandler) {
12074    GesturesHelper.activeHandler.OnMouseUp(evt);
12075    GesturesHelper.activeHandler = null;
12076    window.setTimeout(function () { GesturesHelper.isExecutedGesture = false; }, 0);
12077   }
12078  },
12079  AttachEvents: function () {
12080   if(!GesturesHelper.isAttachedEvents) {
12081    GesturesHelper.Attach(ASPx.Evt.AttachEventToElement);
12082    GesturesHelper.isAttachedEvents = true;
12083   }
12084  },
12085  DetachEvents: function () {
12086   if(GesturesHelper.isAttachedEvents) {
12087    GesturesHelper.Attach(ASPx.Evt.DetachEventFromElement);
12088    GesturesHelper.isAttachedEvents = false;
12089   }
12090  },
12091  Attach: function (changeEventsMethod) {
12092   var doc = window.document;
12093   changeEventsMethod(doc, ASPx.TouchUIHelper.touchMouseDownEventName, GesturesHelper.OnDocumentMouseDown);
12094   changeEventsMethod(doc, ASPx.TouchUIHelper.touchMouseMoveEventName, GesturesHelper.OnDocumentMouseMove);
12095   changeEventsMethod(doc, ASPx.TouchUIHelper.touchMouseUpEventName, GesturesHelper.OnDocumentMouseUp);
12096   if(!ASPx.Browser.MobileUI) {
12097    changeEventsMethod(doc, "selectstart", GesturesHelper.OnDocumentSelectStart);
12098    changeEventsMethod(doc, "dragstart", GesturesHelper.OnDocumentDragStart);
12099   }
12100  },
12101  FindHandler: function (evt) {
12102   var handlers = [];
12103   for(var id in GesturesHelper.handlers) {
12104    var handler = GesturesHelper.handlers[id];
12105    if(handler.CanHandleEvent && handler.CanHandleEvent(evt))
12106     handlers.push(handler);
12107   }
12108   if(!handlers.length)
12109    return null;
12110   handlers.sort(function (a, b) {
12111    return ASPx.GetIsParent(a.getAnimationElement(), b.getAnimationElement()) ? 1 : -1;
12112   });
12113   return handlers[0];
12114  },
12115  IsExecutedGesture: function () {
12116   return GesturesHelper.isExecutedGesture;
12117  }
12118 };
12119 GesturesHelper.AttachEvents();
12120 var AnimationEngineType = {
12121  "JS": 0,
12122  "CSS": 1,
12123  "DEFAULT" : 2
12124 }
12125 ASPx.AnimationEngineType = AnimationEngineType;
12126 ASPx.AnimationHelper = AnimationHelper;
12127 ASPx.GesturesHelper = GesturesHelper;
12128})();
12129(function() {
12130 ASPxClientPanelBase = ASPx.CreateClass(ASPxClientControl, {
12131  constructor: function(name) {
12132   this.constructor.prototype.constructor.call(this, name);
12133   this.touchUIScroller = null;
12134  },
12135  Initialize: function(){
12136   ASPxClientControl.prototype.Initialize.call(this);
12137   this.touchUIScroller = ASPx.TouchUIHelper.makeScrollableIfRequired(this.GetMainElement());
12138  },
12139  getContentElement: function() {
12140   if(this.getAnimationContentContainerElement())
12141    return this.getAnimationContentContainerElement();
12142   if(this.getScrollContentContainerElement())
12143    return this.getScrollContentContainerElement();
12144   if(!ASPx.IsExistsElement(this.contentElement)){
12145    var element = this.GetMainElement();
12146    this.contentElement = element && element.tagName == "TABLE" ? element.rows[0].cells[0] : element;
12147   }
12148   return this.contentElement;
12149  },
12150  getAnimationContentContainerElement: function() {
12151   return null;
12152  },
12153  getScrollContentContainerElement: function() {
12154   return null;
12155  },
12156  GetContentHTML: function(){
12157   return this.GetContentHtml();
12158  },
12159  SetContentHTML: function(html){
12160   this.SetContentHtml(html);
12161  },
12162  GetContentHtml: function(){
12163   return this.getContentElement().innerHTML;
12164  },
12165  SetContentHtml: function(html){
12166   ASPx.SetInnerHtml(this.getContentElement(), html);
12167   if(this.touchUIScroller)
12168    this.touchUIScroller.ChangeElement(this.getContentElement());
12169  }
12170 });
12171 ASPxClientPanelBase.Cast = ASPxClientControl.Cast;
12172 var FixedPanels = {};
12173 var FixedPositionProperties;
12174 var InitFixedPositionProperties = function(){
12175  FixedPositionProperties = {};
12176  FixedPositionProperties["Top"] = { 
12177   documentPadding: "padding-top", documentMargin: "margin-top", documentMargin2: "margin-bottom", 
12178   contentEdge: "top", oppositeContentEdge: "bottom", size: "offsetHeight", animationSize: "height", oppositePanel: "Bottom" 
12179  };
12180  FixedPositionProperties["Bottom"] = { 
12181   documentPadding: "padding-bottom", documentMargin: "margin-top", documentMargin2: "margin-bottom", 
12182   contentEdge: "bottom", oppositeContentEdge: "top", size: "offsetHeight", animationSize: "height", oppositePanel: "Top"
12183  };
12184  FixedPositionProperties["Left"] = { 
12185   documentPadding: "padding-left", documentMargin: "margin-left", documentMargin2: "margin-right", 
12186   contentEdge: "left", oppositeContentEdge: "right", size: "offsetWidth", animationSize: "width", oppositePanel: "Right"
12187  };
12188  FixedPositionProperties["Right"] = { 
12189   documentPadding: "padding-right", documentMargin: "margin-left", documentMargin2: "margin-right", 
12190   contentEdge: "right", oppositeContentEdge: "left", size: "offsetWidth", animationSize: "width", oppositePanel: "Left"
12191  };
12192 }
12193 var ExpandDirectionProperties;
12194 var InitExpandDirectionProperties = function(){
12195  ExpandDirectionProperties = {};
12196  ExpandDirectionProperties["PopupToLeft"] = { 
12197   hAlign: ASPx.PopupUtils.OutsideLeftAlignIndicator, vAlign: ASPx.PopupUtils.TopSidesAlignIndicator, 
12198   size: "offsetWidth", animationSize: "width" 
12199  };
12200  ExpandDirectionProperties["PopupToRight"] = { 
12201   hAlign: ASPx.PopupUtils.OutsideRightAlignIndicator, vAlign: ASPx.PopupUtils.TopSidesAlignIndicator, 
12202   size: "offsetWidth", animationSize: "width" 
12203  };
12204  ExpandDirectionProperties["PopupToTop"] = { 
12205   hAlign: ASPx.PopupUtils.LeftSidesAlignIndicator, vAlign: ASPx.PopupUtils.AboveAlignIndicator, 
12206   size: "offsetHeight", animationSize: "height" 
12207  };
12208  ExpandDirectionProperties["PopupToBottom"] = { 
12209   hAlign: ASPx.PopupUtils.LeftSidesAlignIndicator, vAlign: ASPx.PopupUtils.BelowAlignIndicator, 
12210   size: "offsetHeight", animationSize: "height" 
12211  };
12212 }
12213 var CollapsiblePanelsAutoGenGroupCount = 0;
12214 var CollapsiblePanelsGroups = {};
12215 var ExpandedPanels = {};
12216 var DocumentProperties = {};
12217 var EXPANDED_SELECTOR = "dxpnl-expanded";
12218 var COLLAPSIBLE_SELECTOR = "dxpnl-collapsible";
12219 var CENTER_BTN_POSITION_SELECTOR = "dxpnl-cp";
12220 var EXPAND_BAR_ID = "_EB";
12221 var EXPAND_BUTTON_ID = "_EBB";
12222 var CONTENT_CONTAINER_ID = "_CC";
12223 var COLLAPSED_STATE_CLASS_NAME = "dxpnl-collapsedState";
12224 var HIDDEN_STATE_CLASS_NAME = "dxpnl-hiddenState";
12225 ASPxClientPanel = ASPx.CreateClass(ASPxClientPanelBase, {
12226  constructor: function(name) {
12227   this.constructor.prototype.constructor.call(this, name);
12228   this.animationType = "none";
12229   this.fixedPosition = this.getFixedPosition();
12230   this.expandEffect = "Slide";
12231   this.expandOnPageLoad = false;
12232   this.groupName = "";
12233   this.fixedPositionOverlap = false;
12234   this.fixedPositionProperties = null;
12235   this.expandDirectionProperties = null;
12236   this.documentMarginsChanged = false;
12237   this.slideAnimationPosProperty = null;
12238   this.slideAnimationExpandBarSize = null;
12239   this.collapseWindowWidth = 0;
12240   this.collapseWindowHeight = 0;
12241   this.hideWindowWidth = 0;
12242   this.hideWindowHeight = 0;
12243   this.contentElement = null;
12244   this.expandBarElement = null;
12245   this.expandButtonElement = null;
12246   this.animationContentContainerElement = null;
12247   this.scrollContentContainerElement = null;
12248   this.Collapsed = new ASPxClientEvent();
12249   this.Expanded = new ASPxClientEvent();
12250  },
12251  InlineInitialize: function(){
12252   ASPxClientPanelBase.prototype.InlineInitialize.call(this);
12253   if(this.fixedPosition){
12254    if(!FixedPositionProperties)
12255     InitFixedPositionProperties();
12256    this.fixedPositionProperties = FixedPositionProperties[this.fixedPosition];
12257   }
12258   if(this.expandEffect.indexOf("Popup") > -1){
12259    if(!ExpandDirectionProperties)
12260     InitExpandDirectionProperties();
12261    this.expandDirectionProperties = ExpandDirectionProperties[this.expandEffect];
12262   }
12263   if(this.isPositionFixed()){
12264    FixedPanels[this.fixedPosition] = this;
12265    var scrollContainer = this.getScrollContentContainerElement();
12266    if(scrollContainer && 
12267     (scrollContainer.style.overflow !== "" && scrollContainer.style.overflow !== "visible" ||
12268     scrollContainer.style.overflowX !== "" && scrollContainer.style.overflowX !== "visible" ||
12269     scrollContainer.style.overflowY !== "" && scrollContainer.style.overflowY !== "visible")){
12270     ASPx.Evt.AttachEventToElement(scrollContainer, "scroll",
12271      function (evt) {
12272       if(ASPx.Evt.GetEventSource(evt) != scrollContainer)
12273        return;
12274       if(typeof(ASPx.GetDropDownCollection) != "undefined")
12275        ASPx.GetDropDownCollection().ProcessControlsInContainer(scrollContainer, function(control) {
12276         control.HideDropDown();
12277        });
12278       if(typeof(ASPx.GetMenuCollection) != "undefined")
12279        ASPx.GetMenuCollection().HideAll();
12280      }.aspxBind(this));
12281    }
12282   }
12283   if(this.hideWindowWidth > 0 || this.hideWindowHeight > 0)
12284    this.createVisibilityCss();
12285   if(this.collapseWindowWidth > 0 || this.collapseWindowHeight > 0)
12286    this.createCollapsibilityCss();
12287   if(this.useAdaptivityClassNames())
12288    this.ensureAdaptivityClassNames();
12289   if(this.groupName == ""){
12290    this.groupName = "DXAutoGenExpandGroup" + CollapsiblePanelsAutoGenGroupCount;
12291    CollapsiblePanelsAutoGenGroupCount++;
12292   }
12293   if(!CollapsiblePanelsGroups[this.groupName])
12294    CollapsiblePanelsGroups[this.groupName] = [];
12295   CollapsiblePanelsGroups[this.groupName].push(this);
12296   var btnElement = this.getExpandButtonElement();
12297   if(btnElement){
12298    ASPx.Evt.AttachEventToElement(btnElement, ASPx.TouchUIHelper.touchMouseUpEventName,
12299     function (evt) {
12300      if(ASPx.Evt.IsLeftButtonPressed(evt))
12301       this.Toggle();
12302     }.aspxBind(this));
12303   }
12304   this.updateFixedPanelContext();
12305   if(!this.clientEnabled)
12306    this.SetEnabled(this.clientEnabled);
12307  },
12308  AfterInitialize: function(){
12309   ASPxClientPanelBase.prototype.AfterInitialize.call(this);
12310   var barElement = this.getExpandBarElement();
12311   if(barElement && this.isExpandBarChangeVisibilityOnExpanding())
12312    ASPx.AddClassNameToElement(barElement, "h");
12313   if(this.expandOnPageLoad)
12314    this.Expand(true);
12315  },
12316  OnDispose: function () {
12317   if(FixedPanels[this.fixedPosition] === this)
12318    delete FixedPanels[this.fixedPosition];
12319   if(ASPx.Ident.IsArray(CollapsiblePanelsGroups[this.groupName])){
12320    ASPx.Data.ArrayRemove(CollapsiblePanelsGroups[this.groupName], this);
12321    if(CollapsiblePanelsGroups[this.groupName].length === 0)
12322     delete CollapsiblePanelsGroups[this.groupName];
12323   }
12324   if(ExpandedPanels[this.groupName] === this)
12325    delete ExpandedPanels[this.groupName];
12326   ASPxClientPanelBase.prototype.OnDispose.call(this);
12327  },
12328  AdjustControlCore: function() {
12329   this.updateExpandButtonPosition();
12330   this.updateFixedPanelContext();
12331  },
12332  GetAdjustedSizes: function() {
12333   var sizes = ASPxClientControl.prototype.GetAdjustedSizes.call(this);
12334   var expandBar = this.getExpandBarElement();
12335   if(expandBar) {
12336    sizes["expandBarWidth"] = expandBar.offsetWidth;
12337    sizes["expandBarHeight"] = expandBar.offsetHeight;
12338   }
12339   return sizes;
12340  },
12341  IsDisplayed: function() {
12342   if(ASPxClientPanelBase.prototype.IsDisplayed.call(this))
12343    return true;
12344   return this.IsDisplayedElement(this.getExpandBarElement());
12345  },
12346  IsHidden: function() {
12347   if(!ASPxClientPanelBase.prototype.IsHidden.call(this))
12348    return false;
12349   return this.IsHiddenElement(this.getExpandBarElement());
12350  },
12351  OnBrowserWindowResize: function(e) {
12352   if(this.useAdaptivityClassNames())
12353    this.ensureAdaptivityClassNames();
12354   this.onBrowserWindowResizeCore();
12355   window.setTimeout(function() {
12356    this.onBrowserWindowResizeCore();
12357   }.aspxBind(this), 0);
12358  },
12359  BrowserWindowResizeSubscriber: function() {
12360   return this.isPositionFixed() || this.getExpandBarElement() || this.useAdaptivityClassNames();
12361  },
12362  HasFixedPosition: function() {
12363   return this.isPositionFixed();
12364  },
12365  RegisterInControlTree: function(tree) {
12366   var mainNode = tree.createNode(null, this);
12367   this.registerElementInTree(this.GetMainElement(), tree, mainNode);
12368   this.registerElementInTree(this.getExpandBarElement(), tree, mainNode);
12369  },
12370  getSizeCore: function(element, sizeProperty){
12371   return element[sizeProperty];
12372  },
12373  getFixedSize: function(sizeProperty){
12374   return this.getSizeCore(this.getFixedElement(), sizeProperty);
12375  },
12376  getExpandedSize: function(sizeProperty){
12377   if(this.getExpandBarElement() && this.isElementDisplayed(this.getExpandBarElement()))
12378    return this.getSizeCore(this.GetMainElement(), sizeProperty);
12379   return 0;
12380  },
12381  GetWidth: function() {
12382   if(!this.getExpandBarElement()) 
12383    return ASPxClientControl.prototype.GetWidth.call(this);
12384   var width = 0;
12385   if(this.isElementDisplayed(this.getExpandBarElement()))
12386    width += this.getExpandBarElement().offsetWidth;
12387   if(this.isElementDisplayed(this.GetMainElement()) && (!this.IsExpandedInternal() || !this.isPopupExpanding()))
12388    width += this.GetMainElement().offsetWidth;
12389   return width;
12390  },
12391  GetHeight: function() {
12392   if(!this.getExpandBarElement()) 
12393    return ASPxClientControl.prototype.GetHeight.call(this);
12394   var height = 0;
12395   if(this.isElementDisplayed(this.getExpandBarElement()))
12396    height += this.getExpandBarElement().offsetHeight;
12397   if(this.isElementDisplayed(this.GetMainElement()) && (!this.IsExpandedInternal() || !this.isPopupExpanding()))
12398    height += this.GetMainElement().offsetHeight;
12399   return height;
12400  },
12401  SetVisible: function (value) {
12402   if(this.clientVisible != value) {
12403    ASPxClientPanelBase.prototype.SetVisible.call(this, value);
12404    var expandBarElement = this.getExpandBarElement();
12405    if(expandBarElement) ASPx.SetElementDisplay(expandBarElement, value);
12406    this.updateFixedPanelContext();
12407   }
12408  },
12409  onBrowserWindowResizeCore: function() {
12410   this.updateExpandButtonPosition();
12411   this.updateFixedPanelContext();
12412   this.checkCollapseContent();
12413  },
12414  registerElementInTree: function(element, tree, mainNode) {
12415   if(element && element.id) {
12416    var node = tree.createNode(element.id, null);
12417    tree.addRelatedNode(node, mainNode);
12418   }
12419  },
12420  updateFixedPanelContext: function(){
12421   if(!this.isPositionFixed()) return;
12422   this.updateDocumentPaddings();
12423   this.updateMainElementFixedPosition();
12424   this.updateFixedPanelsPosition();
12425  },
12426  updateExpandButtonPosition: function(){
12427   var expandButton = this.getExpandButtonElement();
12428   if(!expandButton) return;
12429   var isCenterPosition = expandButton.className.indexOf(CENTER_BTN_POSITION_SELECTOR) > -1;
12430   if(isCenterPosition && expandButton.offsetWidth > 0){
12431    expandButton.style.width = expandButton.offsetWidth + "px";
12432    ASPx.SetElementFloat(expandButton, "none");
12433   }
12434   var correctButtonPosition = false;
12435   if(this.fixedPosition == "Top" || this.fixedPosition == "Bottom")
12436    correctButtonPosition = true;
12437   else if(this.fixedPosition == "Left" || this.fixedPosition == "Right")
12438    correctButtonPosition = isCenterPosition;
12439   else if(this.hasVerticalOrientation())
12440    correctButtonPosition = isCenterPosition;
12441   else
12442    correctButtonPosition = true;
12443   if(correctButtonPosition) 
12444    this.CorrectVerticalAlignment(ASPx.AdjustVerticalMargins, this.getExpandButtonElement, "Btn", true);
12445  },
12446  updateDocumentPaddings: function(){
12447   if(!this.fixedPositionProperties) return;
12448   var size = this.getFixedSize(this.fixedPositionProperties.size);
12449   var expandedSize = 0;
12450   if(this.expandEffect == "Slide"){
12451    expandedSize = this.getExpandedSize(this.fixedPositionProperties.size);
12452    if(this.fixedPosition == "Right" || this.fixedPosition == "Bottom")
12453     expandedSize = -expandedSize;
12454   }
12455   this.changeStyleSideAttribute(document.documentElement, "padding", this.fixedPositionProperties.documentPadding, size + "px");
12456   var documentMarginValue = this.getDocumentPropertyValue(this.fixedPositionProperties.documentMargin);
12457   var documentMargin2Value = this.getDocumentPropertyValue(this.fixedPositionProperties.documentMargin2);
12458   if(expandedSize != 0){
12459    ASPx.Attr.ChangeStyleAttribute(document.documentElement, this.fixedPositionProperties.documentMargin, (documentMarginValue + expandedSize) + "px");
12460    ASPx.Attr.ChangeStyleAttribute(document.documentElement, this.fixedPositionProperties.documentMargin2, (documentMargin2Value - expandedSize) + "px");
12461    this.documentMarginsChanged = true;
12462   }
12463   else if(this.documentMarginsChanged){
12464    ASPx.Attr.RestoreStyleAttribute(document.documentElement, this.fixedPositionProperties.documentMargin);
12465    ASPx.Attr.RestoreStyleAttribute(document.documentElement, this.fixedPositionProperties.documentMargin2);
12466    this.documentMarginsChanged = false;
12467   }
12468  },
12469  changeStyleSideAttribute: function(element, baseAttr, attr, value){
12470   if(!ASPx.Browser.IE || ASPx.Browser.Version > 8)
12471    ASPx.Attr.ChangeStyleAttribute(element, attr, value);
12472   else{
12473    var style = ASPx.GetCurrentStyle(element);
12474    var top = (attr == baseAttr + "-top") ? value : style[baseAttr + "Top"];
12475    var right = (attr == baseAttr + "-right") ? value : style[baseAttr + "Right"];
12476    var bottom = (attr == baseAttr + "-bottom") ? value : style[baseAttr + "Bottom"];
12477    var left = (attr == baseAttr + "-left") ? value : style[baseAttr + "Left"];
12478    ASPx.Attr.ChangeStyleAttribute(element, baseAttr, top + " " + right + " " + bottom + " " + left);
12479   }
12480  },
12481  updateMainElementFixedPosition: function(){
12482   if(!this.fixedPositionProperties) return;
12483   var barElement = this.getExpandBarElement();
12484   if(barElement){
12485    var size = this.getSizeCore(barElement, this.fixedPositionProperties.size);
12486    ASPx.Attr.ChangeStyleAttribute(this.GetMainElement(), this.fixedPositionProperties.contentEdge, size + "px");
12487   }
12488  },
12489  updateFixedPanelsPosition: function() {
12490   this.updateFixedPanelsEdges(this.updateFixedPanelEdge);
12491   this.updateFixedPanelsEdges(this.updateFixedPanelOppositeEdge);
12492  },
12493  updateFixedPanelsEdges: function(method) {
12494   if(FixedPanels["Top"]){
12495    if(FixedPanels["Left"] && !FixedPanels["Top"].fixedPositionOverlap && FixedPanels["Left"].fixedPositionOverlap)
12496     method.call(FixedPanels["Left"], FixedPanels["Top"], FixedPanels["Right"]);
12497    if(FixedPanels["Right"] && !FixedPanels["Top"].fixedPositionOverlap && FixedPanels["Right"].fixedPositionOverlap)
12498     method.call(FixedPanels["Right"], FixedPanels["Top"], FixedPanels["Left"]);
12499   }
12500   if(FixedPanels["Bottom"]){
12501    if(FixedPanels["Left"] && !FixedPanels["Bottom"].fixedPositionOverlap && FixedPanels["Left"].fixedPositionOverlap)
12502     method.call(FixedPanels["Left"], FixedPanels["Bottom"], FixedPanels["Right"]);
12503    if(FixedPanels["Right"] && !FixedPanels["Bottom"].fixedPositionOverlap && FixedPanels["Right"].fixedPositionOverlap)
12504     method.call(FixedPanels["Right"], FixedPanels["Bottom"], FixedPanels["Left"]);
12505   }
12506   if(FixedPanels["Left"]){
12507    if(FixedPanels["Top"] && (!FixedPanels["Left"].fixedPositionOverlap || FixedPanels["Top"].fixedPositionOverlap))
12508     method.call(FixedPanels["Top"], FixedPanels["Left"], FixedPanels["Bottom"]);
12509    if(FixedPanels["Bottom"] && (!FixedPanels["Left"].fixedPositionOverlap || FixedPanels["Bottom"].fixedPositionOverlap))
12510     method.call(FixedPanels["Bottom"], FixedPanels["Left"], FixedPanels["Top"]);
12511   }
12512   if(FixedPanels["Right"]){
12513    if(FixedPanels["Top"] && (!FixedPanels["Right"].fixedPositionOverlap || FixedPanels["Top"].fixedPositionOverlap))
12514     method.call(FixedPanels["Top"], FixedPanels["Right"], FixedPanels["Bottom"]);
12515    if(FixedPanels["Bottom"] && (!FixedPanels["Right"].fixedPositionOverlap || FixedPanels["Bottom"].fixedPositionOverlap))
12516     method.call(FixedPanels["Bottom"], FixedPanels["Right"], FixedPanels["Top"]);
12517   }
12518  },
12519  updateFixedPanelEdge: function(panel){
12520   var size = this.getFixedSize(this.fixedPositionProperties.size);
12521   if(this.expandEffect == "Slide")
12522    size += this.getExpandedSize(this.fixedPositionProperties.size);
12523   this.updateFixedPanelEdgeCore(panel, this.fixedPositionProperties.contentEdge, size);
12524  },
12525  updateFixedPanelOppositeEdge: function(panel, opppositePanel){
12526   if(!this.IsExpandedInternal() && opppositePanel) return;
12527   if(this.expandEffect == "Slide") {
12528    var size = this.getExpandedSize(this.fixedPositionProperties.size);
12529    this.updateFixedPanelEdgeCore(panel, this.fixedPositionProperties.oppositeContentEdge, -size);
12530   }
12531  },
12532  updateFixedPanelEdgeCore: function(panel, edge, size){
12533   var mainElement = panel.GetMainElement();
12534   mainElement.style[edge] = size + "px";
12535   var expandBarElement = panel.getExpandBarElement();
12536   if(expandBarElement)
12537    expandBarElement.style[edge] = size + "px";
12538  },
12539  isPositionFixed: function(){
12540   return !!this.fixedPositionProperties;
12541  },
12542  getFixedPosition: function(){
12543   var cssClass = this.GetMainElement().className;
12544   if(cssClass.indexOf("dxpnl-edge t") > -1)
12545    return "Top";
12546   if(cssClass.indexOf("dxpnl-edge b") > -1)
12547    return "Bottom";
12548   if(cssClass.indexOf("dxpnl-edge l") > -1)
12549    return "Left";
12550   if(cssClass.indexOf("dxpnl-edge r") > -1)
12551    return "Right";
12552   return null;
12553  },
12554  isPopupExpanding: function(){
12555   return !!this.expandDirectionProperties;
12556  },
12557  isExpandBarChangeVisibilityOnExpanding: function(){
12558   return !this.isPopupExpanding() && !this.isPositionFixed() && CollapsiblePanelsGroups[this.groupName].length > 1;
12559  },
12560  createVisibilityCss: function() {
12561   var rules = [];
12562   rules.push({ selector: "#" + this.name, cssText: "display: none!important;" });
12563   rules.push({ selector: "#" + this.name + EXPAND_BAR_ID, cssText: "display: none!important;" });
12564   this.insertAdaptivityRules(rules, this.hideWindowWidth, this.hideWindowHeight, HIDDEN_STATE_CLASS_NAME);
12565  },
12566  createCollapsibilityCss: function() {
12567   var rules = [];
12568   rules.push({ selector: "#" + this.name, cssText: "display: none;" });
12569   rules.push({ selector: "#" + this.name + EXPAND_BAR_ID + ".dxpnl-bar", cssText: (this.isPositionFixed() ? "display: block;" : "display: table;") });
12570   rules.push({ selector: "#" + this.name + "." + EXPANDED_SELECTOR, cssText: "display: block!important;" });
12571   this.insertAdaptivityRules(rules, this.collapseWindowWidth, this.collapseWindowHeight, COLLAPSED_STATE_CLASS_NAME);
12572  },
12573  insertAdaptivityRules: function(rules, maxWindowWidth, maxWindowHeight, adaptivityClassName) {
12574   var styleSheet = ASPx.GetCurrentStyleSheet();
12575   if(!styleSheet) return;
12576   if(!this.isIE8()) {
12577    var mediaRule = "@media all and (max-width: " + maxWindowWidth + "px), (max-height: " + maxWindowHeight + "px) { ";
12578    for(var i = 0; i < rules.length; i++)
12579     mediaRule += rules[i].selector + "{" + rules[i].cssText + "}";
12580    mediaRule += "}";
12581    if(styleSheet.insertRule)
12582     styleSheet.insertRule(mediaRule, styleSheet.cssRules.length);
12583   }
12584   else
12585    for(var i = 0; i < rules.length; i++) {
12586     rules[i].selector += "." + adaptivityClassName;
12587     ASPx.AddStyleSheetRule(styleSheet, rules[i].selector, rules[i].cssText);
12588    }
12589  },
12590  ensureAdaptivityClassNames: function() {
12591   this.ensureAdaptivityClassName(HIDDEN_STATE_CLASS_NAME, this.hideWindowWidth, this.hideWindowHeight);
12592   this.ensureAdaptivityClassName(COLLAPSED_STATE_CLASS_NAME, this.collapseWindowWidth, this.collapseWindowHeight);
12593  },
12594  ensureAdaptivityClassName: function(adaptivityClassName, maxWindowWidth, maxWindowHeight) {
12595   var currentDocumentWidth = ASPx.GetCurrentDocumentWidth();
12596   var currentDocumentHeight = ASPx.GetCurrentDocumentHeight();
12597   if(currentDocumentWidth <= maxWindowWidth || currentDocumentHeight <= maxWindowHeight)
12598    this.addAdaptivityClassName(adaptivityClassName);
12599   else
12600    this.removeAdaptivityClassName(adaptivityClassName);
12601  },
12602  addAdaptivityClassName: function(className) {
12603   ASPx.AddClassNameToElement(this.GetMainElement(), className);
12604   if(ASPx.IsExists(this.getExpandBarElement()))
12605    ASPx.AddClassNameToElement(this.getExpandBarElement(), className);
12606  },
12607  removeAdaptivityClassName: function(className) {
12608   ASPx.RemoveClassNameFromElement(this.GetMainElement(), className);
12609   if(ASPx.IsExists(this.getExpandBarElement()))
12610    ASPx.RemoveClassNameFromElement(this.getExpandBarElement(), className);
12611  },
12612  useAdaptivityClassNames: function() {
12613   return this.isIE8()
12614    && (this.hideWindowWidth > 0 || this.hideWindowHeight > 0 || this.collapseWindowWidth > 0 || this.collapseWindowHeight > 0);
12615  },
12616  isIE8: function() {
12617   return ASPx.Browser.IE && ASPx.Browser.Version === 8;
12618  },
12619  Toggle: function() {
12620   if(this.IsExpandedInternal()) 
12621    this.Collapse();
12622   else 
12623    this.Expand();
12624  },
12625  IsExpandable: function() {
12626   if(this.GetMainElement().className.indexOf(" " + COLLAPSIBLE_SELECTOR) > -1)
12627    return true;
12628   if(this.collapseWindowWidth > 0 || this.collapseWindowHeight > 0){
12629    var expandBarElement = this.getExpandBarElement();
12630    return expandBarElement && ASPx.GetCurrentStyle(expandBarElement).display !== "none";
12631   }
12632   return false;
12633  },
12634  IsExpanded: function() {
12635   if(this.IsExpandable())
12636    return this.IsExpandedInternal();
12637   return true;
12638  },
12639  IsExpandedInternal: function() {
12640   return this.GetMainElement().className.indexOf(" " + EXPANDED_SELECTOR) > -1;
12641  },
12642  Expand: function(preventAnimation) {
12643   if(ExpandedPanels[this.groupName] != this) {
12644    if(ExpandedPanels[this.groupName])
12645     ExpandedPanels[this.groupName].Collapse(preventAnimation);
12646    this.collapseOppositePanel(preventAnimation);
12647    this.collapseUnfixedPopupPanels();
12648    ExpandedPanels[this.groupName] = this;
12649    ASPx.GetStateController().SelectElementBySrcElement(this.GetMainElement());
12650    ASPx.GetStateController().SelectElementBySrcElement(this.getExpandButtonElement());
12651    ASPx.GetControlCollection().AdjustControls(this.GetMainElement());
12652    if(this.isPopupExpanding() && !this.isPositionFixed())
12653     this.updateMainElementPosition(true);
12654    if(this.isExpandBarChangeVisibilityOnExpanding())
12655     this.slideAnimationExpandBarSize = this.getSlideAnimationSize(this.getExpandBarElement(), true);
12656    ASPx.GetStateController().SelectElementBySrcElement(this.getExpandBarElement());
12657    if(!preventAnimation && this.animationType == "slide")
12658     this.startSlideAnimation(this.GetMainElement(), false);
12659    else if(!preventAnimation && this.animationType == "fade")
12660     this.startFadeAnimation(this.GetMainElement(), false);
12661    else
12662     this.expandCore();
12663   }
12664  },
12665  Collapse: function(preventAnimation) {
12666   if(ExpandedPanels[this.groupName] == this) {
12667    ExpandedPanels[this.groupName] = null;
12668    this.collapseUnfixedPopupPanels();
12669    if(this.isExpandBarChangeVisibilityOnExpanding()){
12670     ASPx.GetStateController().DeselectElementBySrcElement(this.getExpandBarElement());
12671     this.slideAnimationExpandBarSize = this.getSlideAnimationSize(this.getExpandBarElement(), true);
12672     ASPx.GetStateController().SelectElementBySrcElement(this.getExpandBarElement());
12673    }
12674    if(!preventAnimation && this.animationType == "slide")
12675     this.startSlideAnimation(this.GetMainElement(), true);
12676    else if(!preventAnimation && this.animationType == "fade")
12677     this.startFadeAnimation(this.GetMainElement(), true);
12678    else
12679     this.collapseCore();
12680   }
12681  },
12682  expandCore: function() {
12683   if(this.isPositionFixed()) {
12684    this.updateFixedPanelContext();
12685   }
12686   this.raiseExpanded();
12687  },
12688  collapseCore: function() {
12689   ASPx.GetStateController().DeselectElementBySrcElement(this.GetMainElement());
12690   ASPx.GetStateController().DeselectElementBySrcElement(this.getExpandButtonElement());
12691   if(this.isPopupExpanding() && !this.isPositionFixed())
12692    this.updateMainElementPosition(false);
12693   ASPx.GetStateController().DeselectElementBySrcElement(this.getExpandBarElement());
12694   if(this.isPositionFixed()) {
12695    this.updateFixedPanelContext();
12696   }
12697   this.slideAnimationPosProperty = null;
12698   this.raiseCollapsed();
12699  },
12700  collapseOppositePanel: function(preventAnimation) {
12701   if(!this.fixedPositionProperties) return;
12702   if(FixedPanels[this.fixedPositionProperties.oppositePanel])
12703    FixedPanels[this.fixedPositionProperties.oppositePanel].Collapse(preventAnimation);
12704  },
12705  collapseUnfixedPopupPanels: function() {
12706   if(!this.isPositionFixed() || this.isPopupExpanding()) return;
12707   for(var groupName in ExpandedPanels){
12708    if(ExpandedPanels[groupName] && !ExpandedPanels[groupName].fixedPosition && ExpandedPanels[groupName].isPopupExpanding())
12709     ExpandedPanels[groupName].Collapse(true);
12710   }
12711  },
12712  saveOpacity: function(element) {
12713   if(!this.isIE8())
12714    ASPx.Attr.SaveStyleAttribute(element, "opacity");
12715   else if(ASPx.GetCurrentStyle(element).filter)
12716    ASPx.Attr.SaveStyleAttribute(element, "filter");
12717  },
12718  restoreOpacity: function(element) {
12719   if(!this.isIE8())
12720    ASPx.Attr.RestoreStyleAttribute(element, "opacity");
12721   else
12722    ASPx.Attr.RestoreStyleAttribute(element, "filter");
12723  },
12724  startFadeAnimation: function (element, isCollapsing) {
12725   this.saveOpacity(element);
12726   var onComplete =  function() { this.finishFadeAnimation(element, isCollapsing); }.aspxBind(this);
12727   if(isCollapsing)
12728    ASPx.AnimationHelper.fadeOut(element, onComplete, ASPx.AnimationConstants.Durations.SHORT);
12729   else
12730    ASPx.AnimationHelper.fadeIn(element, onComplete, ASPx.AnimationConstants.Durations.SHORT);
12731  },
12732  finishFadeAnimation: function (element, isCollapsing) {
12733   this.restoreOpacity(element);
12734   if(isCollapsing)
12735    this.collapseCore(); 
12736   else
12737    this.expandCore(); 
12738  },
12739  startSlideAnimation: function(element, isCollapsing) {
12740   var sizeProperty = this.getSlideAnimationSizeProperty();
12741   var offsetWidth = element.offsetWidth;
12742   var offsetHeight = element.offsetHeight;
12743   ASPx.Attr.SaveStyleAttribute(element, sizeProperty);
12744   if(element.style.overflow !== "")
12745    ASPx.Attr.ChangeStyleAttribute(element, "overflow", "hidden");
12746   else{
12747    ASPx.Attr.ChangeStyleAttribute(element, "overflow-x", "hidden");
12748    ASPx.Attr.ChangeStyleAttribute(element, "overflow-y", "hidden");
12749   }
12750   var contentContainer = this.getAnimationContentContainerElement();
12751   if(contentContainer) {
12752    if(contentContainer.style.overflow !== "")
12753     ASPx.Attr.ChangeStyleAttribute(contentContainer, "overflow", "hidden");
12754    else{
12755     ASPx.Attr.ChangeStyleAttribute(contentContainer, "overflow-x", "hidden");
12756     ASPx.Attr.ChangeStyleAttribute(contentContainer, "overflow-y", "hidden");
12757    }
12758    ASPx.Attr.ChangeStyleAttribute(contentContainer, "width", offsetWidth - ASPx.GetLeftRightBordersAndPaddingsSummaryValue(element) + "px");
12759    ASPx.Attr.ChangeStyleAttribute(contentContainer, "height", offsetHeight - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(element) + "px");
12760   }
12761   var transitionProperties = {
12762    duration: ASPx.AnimationConstants.Durations.SHORT, 
12763    onComplete: function() { this.finishSlideAnimation(element, isCollapsing); }.aspxBind(this)
12764   };
12765   if(this.isPositionFixed())
12766    transitionProperties.onStep = function() { this.performSlideAnimationStep(); }.aspxBind(this);
12767   var transition = ASPx.AnimationHelper.createMultipleAnimationTransition(element, transitionProperties);
12768   var size = this.getSlideAnimationSize(element, !this.isPositionFixed());
12769   var startSize = isCollapsing ? size : 0;
12770   var endSize = isCollapsing ? 0 : size;
12771   if(this.isExpandBarChangeVisibilityOnExpanding() && this.slideAnimationExpandBarSize){
12772    if(startSize == 0)
12773     startSize = this.slideAnimationExpandBarSize;
12774    if(endSize == 0)
12775     endSize = this.slideAnimationExpandBarSize;
12776   }
12777   var properties = {};
12778   properties[sizeProperty] = { from: startSize, to: endSize, unit: "px" };
12779   if(!isCollapsing) 
12780    ASPx.Attr.ChangeStyleAttribute(element, sizeProperty, startSize + "px");
12781   if(this.slideAnimationPosProperty){
12782    var position = parseInt(element.style[this.slideAnimationPosProperty]);
12783    var startPosition = isCollapsing ? position : position + size;
12784    var endPosition = isCollapsing ? position + size : position;
12785    properties[this.slideAnimationPosProperty] = { from: startPosition, to: endPosition, unit: "px" };
12786    if(!isCollapsing) 
12787     ASPx.Attr.ChangeStyleAttribute(element, this.slideAnimationPosProperty, startPosition + "px");
12788   }
12789   transition.Start(properties);
12790  },
12791  finishSlideAnimation: function(element, isCollapsing) {
12792   var sizeProperty = this.getSlideAnimationSizeProperty();
12793   ASPx.Attr.RestoreStyleAttribute(element, sizeProperty);
12794   ASPx.Attr.RestoreStyleAttribute(element, "overflow");
12795   ASPx.Attr.RestoreStyleAttribute(element, "overflow-x");
12796   ASPx.Attr.RestoreStyleAttribute(element, "overflow-y");
12797   var contentContainer = this.getAnimationContentContainerElement();
12798   if(contentContainer) {
12799    ASPx.Attr.RestoreStyleAttribute(contentContainer, "overflow");
12800    ASPx.Attr.RestoreStyleAttribute(contentContainer, "overflow-x");
12801    ASPx.Attr.RestoreStyleAttribute(contentContainer, "overflow-y");
12802    ASPx.Attr.RestoreStyleAttribute(contentContainer, "width");
12803    ASPx.Attr.RestoreStyleAttribute(contentContainer, "height");
12804   }
12805   if(isCollapsing)
12806    this.collapseCore(); 
12807   else
12808    this.expandCore(); 
12809  },
12810  performSlideAnimationStep: function() {
12811   this.updateFixedPanelContext();
12812  },
12813  getSlideAnimationSizeProperty: function() {
12814   if(this.fixedPositionProperties)
12815    return this.fixedPositionProperties.animationSize;
12816   else if(this.expandDirectionProperties)
12817    return this.expandDirectionProperties.animationSize;
12818   else 
12819    return this.hasVerticalOrientation() ? "width" : "height";
12820  },
12821  getSlideAnimationSize: function(element, fullSize) {
12822   var sizeProperty;
12823   if(this.fixedPositionProperties)
12824    sizeProperty = this.fixedPositionProperties.size;
12825   else if(this.expandDirectionProperties)
12826    sizeProperty = this.expandDirectionProperties.size;
12827   else
12828    sizeProperty = this.hasVerticalOrientation() ? "offsetWidth" : "offsetHeight";
12829   var size = this.getSizeCore(element, sizeProperty);
12830   if(fullSize) {
12831    if(sizeProperty == "offsetWidth")
12832     size -= ASPx.GetHorizontalBordersWidth(element);
12833    else
12834     size -= ASPx.GetVerticalBordersWidth(element);
12835   }
12836   else {
12837    if(sizeProperty == "offsetWidth")
12838     size -= ASPx.GetLeftRightBordersAndPaddingsSummaryValue(element);
12839    else
12840     size -= ASPx.GetTopBottomBordersAndPaddingsSummaryValue(element);
12841   }
12842   return size;
12843  },
12844  getSlideAnimationPosProperty: function(x, y) {
12845   if(this.expandEffect == "PopupToTop")
12846    return !y.isInverted ? "top" : null;
12847   if(this.expandEffect == "PopupToBottom")
12848    return y.isInverted ? "top" : null;
12849   if(this.expandEffect == "PopupToLeft")
12850    return !x.isInverted ? "left" : null;
12851   if(this.expandEffect == "PopupToRight")
12852    return y.isInverted ? "left" : null;
12853   return null;
12854  }, 
12855  hasVerticalOrientation: function() {
12856   var float = ASPx.GetElementFloat(this.GetMainElement());
12857   return (float === "left" || float === "right");
12858  },
12859  updateMainElementPosition: function(expanded) {
12860   if(!this.expandDirectionProperties) return;
12861   if(expanded)
12862    this.updateMainElementExpandedPosition(this.GetMainElement());
12863   else
12864    this.updateMainElementCollapsedPosition(this.GetMainElement());
12865  },
12866  updateMainElementExpandedPosition: function(element) {
12867   if(element.style.width === "100%")
12868    ASPx.Attr.ChangeStyleAttribute(element, "width", (element.parentNode.offsetWidth - ASPx.GetLeftRightMargins(element)) + "px");
12869   if(element.style.height === "100%")
12870    ASPx.Attr.ChangeStyleAttribute(element, "height", (element.parentNode.offsetHeight - ASPx.GetTopBottomMargins(element)) + "px");
12871   ASPx.Attr.ChangeStyleAttribute(element, "position", "absolute");
12872   var barElement = this.getExpandBarElement();
12873   var x = ASPx.PopupUtils.GetPopupAbsoluteX(element,
12874    barElement, this.expandDirectionProperties.hAlign, 0, 0, 0, false, false);
12875   var y = ASPx.PopupUtils.GetPopupAbsoluteY(element,
12876    barElement, this.expandDirectionProperties.vAlign, 0, 0, 0, true);
12877   ASPx.SetAbsoluteX(element, x.position);
12878   ASPx.SetAbsoluteY(element, y.position);
12879   this.slideAnimationPosProperty = this.getSlideAnimationPosProperty(x, y);
12880  },
12881  updateMainElementCollapsedPosition: function(element) {
12882   ASPx.Attr.RestoreStyleAttribute(element, "position");
12883   ASPx.Attr.RestoreStyleAttribute(element, "left");
12884   ASPx.Attr.RestoreStyleAttribute(element, "top");
12885   ASPx.Attr.RestoreStyleAttribute(element, "width");
12886   ASPx.Attr.RestoreStyleAttribute(element, "height");
12887  },
12888  checkCollapseContent: function(){
12889   if(!this.getExpandBarElement()) return;
12890   if(this.IsExpandedInternal()){
12891    if(CollapsiblePanelsGroups[this.groupName].length === 1 && !this.isElementDisplayed(this.getExpandBarElement()) && this.isElementDisplayed(this.GetMainElement()))
12892     this.Collapse(true);
12893    if(!this.isPositionFixed() && this.isPopupExpanding())
12894     this.Collapse(true);
12895   }
12896  },
12897  raiseCollapsed: function() {
12898   if(!this.Collapsed.IsEmpty()) {
12899    var args = new ASPxClientEventArgs();
12900    this.Collapsed.FireEvent(this, args);
12901   }
12902  },
12903  raiseExpanded: function() {
12904   if(!this.Expanded.IsEmpty()) {
12905    var args = new ASPxClientEventArgs();
12906    this.Expanded.FireEvent(this, args);
12907   }
12908  },
12909  getAnimationContentContainerElement: function() {
12910   if(!ASPx.IsExistsElement(this.animationContentContainerElement)) 
12911    this.animationContentContainerElement = ASPx.GetChildByClassName(this.GetMainElement(), "dxpnl-acc");
12912   return this.animationContentContainerElement;
12913  },
12914  getScrollContentContainerElement: function() {
12915   if (!ASPx.IsExistsElement(this.scrollContentContainerElement)) {
12916    var mainElement = this.GetMainElement();
12917    this.scrollContentContainerElement = ASPx.GetNodesByPartialClassName(this.GetMainElement(), "dxpnl-scc")[0];
12918    if (mainElement.tagName == "DIV" && this.scrollContentContainerElement && this.scrollContentContainerElement.parentNode != mainElement)
12919     this.scrollContentContainerElement = null;
12920   }
12921   return this.scrollContentContainerElement;
12922  },
12923  getExpandBarElement: function() {
12924   if(!ASPx.IsExistsElement(this.expandBarElement))
12925    this.expandBarElement = ASPx.GetElementById(this.name + EXPAND_BAR_ID);
12926   return this.expandBarElement;
12927  },
12928  getExpandButtonElement: function() {
12929   if(!ASPx.IsExistsElement(this.expandButtonElement))
12930    this.expandButtonElement = ASPx.GetElementById(this.name + EXPAND_BUTTON_ID);
12931   return this.expandButtonElement;
12932  },
12933  getFixedElement: function(){
12934   if(this.getExpandBarElement() && this.isElementDisplayed(this.getExpandBarElement()))
12935    return this.getExpandBarElement();
12936   else
12937    return this.GetMainElement();
12938  },
12939  getDocumentPropertyValue: function(attr){
12940   if(DocumentProperties[attr] === undefined){
12941    var currentStyle = ASPx.GetCurrentStyle(document.documentElement);
12942    var attrValue = parseInt(ASPx.Attr.GetAttribute(currentStyle, attr));
12943    DocumentProperties[attr] = !isNaN(attrValue) ? attrValue : 0;
12944   }
12945   return DocumentProperties[attr];
12946  },
12947  isElementDisplayed: function(element){
12948   return ASPx.GetCurrentStyle(element).display != "none";
12949  }
12950 });
12951 ASPxClientPanel.Cast = ASPxClientControl.Cast;
12952 window.ASPxClientPanelBase = ASPxClientPanelBase;
12953 window.ASPxClientPanel = ASPxClientPanel;
12954})();
12955(function () {
12956var PopupUtils = {
12957 NotSetAlignIndicator: "NotSet",
12958 InnerAlignIndicator: "Sides",
12959 OutsideLeftAlignIndicator: "OutsideLeft",
12960 LeftSidesAlignIndicator: "LeftSides",
12961 RightSidesAlignIndicator: "RightSides",
12962 OutsideRightAlignIndicator: "OutsideRight",
12963 CenterAlignIndicator: "Center",
12964 AboveAlignIndicator: "Above",
12965 TopSidesAlignIndicator: "TopSides",
12966 MiddleAlignIndicator: "Middle",
12967 BottomSidesAlignIndicator: "BottomSides",
12968 BelowAlignIndicator: "Below",
12969 WindowCenterAlignIndicator: "WindowCenter",
12970 LeftAlignIndicator: "Left",
12971 RightAlignIndicator: "Right",
12972 TopAlignIndicator: "Top",
12973 BottomAlignIndicator: "Bottom",
12974 WindowLeftAlignIndicator: "WindowLeft",
12975 WindowRightAlignIndicator: "WindowRight",
12976 WindowTopAlignIndicator: "WindowTop",
12977 WindowBottomAlignIndicator: "WindowBottom",
12978 IsAlignNotSet: function (align) {
12979  return align == PopupUtils.NotSetAlignIndicator;
12980 },
12981 IsInnerAlign: function (align) {
12982  return align.indexOf(PopupUtils.InnerAlignIndicator) != -1;
12983 },
12984 IsRightSidesAlign: function(align) {
12985  return align == PopupUtils.RightSidesAlignIndicator;
12986 },
12987 IsOutsideRightAlign: function(align) {
12988  return align == PopupUtils.OutsideRightAlignIndicator;
12989 },
12990 IsCenterAlign: function(align) {
12991  return align == PopupUtils.CenterAlignIndicator;
12992 },
12993 FindPopupElementById: function (id) {
12994  if(id == "")
12995   return null; 
12996  var popupElement = ASPx.GetElementById(id);
12997  if(!ASPx.IsExistsElement(popupElement)) {
12998   var idParts = id.split("_");
12999   var uniqueId = idParts.join("$");
13000   popupElement = ASPx.GetElementById(uniqueId);
13001  }
13002  return popupElement;
13003 },
13004 FindEventSourceParentByTestFunc: function (evt, testFunc) {
13005  return ASPx.GetParent(ASPx.Evt.GetEventSource(evt), testFunc);
13006 },
13007 PreventContextMenu: function (evt) {
13008  if(evt.stopPropagation)
13009   evt.stopPropagation();
13010  if(evt.preventDefault)
13011   evt.preventDefault();
13012  if(ASPx.Browser.WebKitFamily)
13013   evt.returnValue = false;
13014 },
13015 GetDocumentClientWidthForPopup: function () {
13016  return ASPx.Browser.WebKitTouchUI ? ASPx.GetDocumentWidth() : ASPx.GetDocumentClientWidth(); 
13017 },
13018 GetDocumentClientHeightForPopup: function() {
13019  return ASPx.Browser.WebKitTouchUI ? ASPx.GetDocumentHeight() : ASPx.GetDocumentClientHeight(); 
13020 },
13021 AdjustPositionToClientScreen: function (element, pos, rtl, isX) {
13022  var min = isX ? ASPx.GetDocumentScrollLeft() : ASPx.GetDocumentScrollTop(),
13023   viewPortWidth = ASPx.Browser.WebKitTouchUI ? window.innerWidth : ASPx.GetDocumentClientWidth(),
13024   max = min + (isX ? viewPortWidth : ASPx.GetDocumentClientHeight());
13025  max -= (isX ? element.offsetWidth : element.offsetHeight);
13026  if(rtl) {
13027   if(pos < min) pos = min;
13028   if(pos > max) pos = max;
13029  } else {
13030   if(pos > max) pos = max;
13031   if(pos < min) pos = min;
13032  }
13033  return pos;
13034 },
13035 GetPopupAbsoluteX: function(element, popupElement, hAlign, hOffset, x, left, rtl, isPopupFullCorrectionOn) {
13036  return PopupUtils.getPopupAbsolutePos(element, popupElement, hAlign, hOffset, x, left, rtl, isPopupFullCorrectionOn, true);
13037 },
13038 GetPopupAbsoluteY: function (element, popupElement, vAlign, vOffset, y, top, isPopupFullCorrectionOn) {
13039  return PopupUtils.getPopupAbsolutePos(element, popupElement, vAlign, vOffset, y, top, false, isPopupFullCorrectionOn, false);
13040 },
13041 getPopupAbsolutePos: function(element, popupElement, align, offset, startPos, startPosInit, rtl, isPopupFullCorrectionOn, isHorizontal) {
13042  var calculator = getPositionCalculator();
13043  calculator.applyParams(element, popupElement, align, offset, startPos, startPosInit, rtl, isPopupFullCorrectionOn, isHorizontal);
13044  var position = calculator.getPopupAbsolutePos();
13045  calculator.disposeState();
13046  return position;
13047 },
13048 RemoveFocus: function (parent) {
13049  var div = document.createElement('div');
13050  div.tabIndex = "-1";
13051  PopupUtils.ConcealDivElement(div);
13052  parent.appendChild(div);
13053  if(ASPx.IsFocusable(div))
13054   div.focus();
13055  ASPx.RemoveElement(div);
13056 },
13057 ConcealDivElement: function (div) {
13058  div.style.position = "absolute";
13059  div.style.left = 0;
13060  div.style.top = 0;
13061  if(ASPx.Browser.WebKitFamily) {
13062   div.style.opacity = 0;
13063   div.style.width = 1;
13064   div.style.height = 1;
13065  } else {
13066   div.style.border = 0;
13067   div.style.width = 0;
13068   div.style.height = 0;
13069  }
13070 },
13071 InitAnimationDiv: function (element, x, y, onAnimStopCallString, skipSizeInit) {
13072  PopupUtils.InitAnimationDivCore(element);
13073  element.popuping = true;
13074  element.onAnimStopCallString = onAnimStopCallString;
13075  if(!skipSizeInit)
13076   ASPx.SetStyles(element, { width: element.offsetWidth, height: element.offsetHeight });
13077  ASPx.SetStyles(element, { left: x, top: y });
13078 },
13079 InitAnimationDivCore: function (element) {
13080  ASPx.SetStyles(element, {
13081   overflow: "hidden",
13082   position: "absolute"
13083  });
13084 },
13085 StartSlideAnimation: function (animationDivElement, element, iframeElement, duration, preventChangingWidth, preventChangingHeight) {
13086  if(iframeElement) {
13087   var endLeft = ASPx.PxToInt(iframeElement.style.left);
13088   var endTop = ASPx.PxToInt(iframeElement.style.top);
13089   var startLeft = ASPx.PxToInt(element.style.left) < 0 ? endLeft : animationDivElement.offsetLeft + animationDivElement.offsetWidth;
13090   var startTop = ASPx.PxToInt(element.style.top) < 0 ? endTop : animationDivElement.offsetTop + animationDivElement.offsetHeight;
13091   var properties = {
13092    left: { from: startLeft, to: endLeft, unit: "px" },
13093    top: { from: startTop, to: endTop, unit: "px" }
13094   };
13095   if(!preventChangingWidth)
13096    properties["width"] = { to: element.offsetWidth, unit: "px" };
13097   if(!preventChangingHeight)
13098    properties["height"] = { to: element.offsetHeight, unit: "px" };
13099   ASPx.AnimationHelper.createMultipleAnimationTransition(iframeElement, {
13100    duration: duration
13101   }).Start(properties);
13102  }
13103  ASPx.AnimationHelper.createMultipleAnimationTransition(element, {
13104   duration: duration,
13105   onComplete: function () { PopupUtils.AnimationFinished(animationDivElement, element); }
13106  }).Start({
13107   left: { to: 0, unit: "px" },
13108   top: { to: 0, unit: "px" }
13109  });
13110 },
13111 AnimationFinished: function (animationDivElement, element) {
13112  if(PopupUtils.StopAnimation(animationDivElement, element) && ASPx.IsExists(animationDivElement.onAnimStopCallString) &&
13113   animationDivElement.onAnimStopCallString !== "") {
13114   window.setTimeout(animationDivElement.onAnimStopCallString, 0);
13115  }
13116 },
13117 StopAnimation: function (animationDivElement, element) {
13118  if(animationDivElement.popuping) {
13119   ASPx.AnimationHelper.cancelAnimation(element);
13120   animationDivElement.popuping = false;
13121   animationDivElement.style.overflow = "visible";
13122   return true;
13123  }
13124  return false;
13125 },
13126 GetAnimationHorizontalDirection: function (popupPosition, horizontalAlign, verticalAlign, rtl) {
13127  if(PopupUtils.IsInnerAlign(horizontalAlign)
13128   && !PopupUtils.IsInnerAlign(verticalAlign)
13129   && !PopupUtils.IsAlignNotSet(verticalAlign))
13130   return 0;
13131  var toTheLeft = (horizontalAlign == PopupUtils.OutsideLeftAlignIndicator || horizontalAlign == PopupUtils.RightSidesAlignIndicator || (horizontalAlign == PopupUtils.NotSetAlignIndicator && rtl)) ^ popupPosition.isInverted;
13132  return toTheLeft ? 1 : -1;
13133 },
13134 GetAnimationVerticalDirection: function (popupPosition, horizontalAlign, verticalAlign) {
13135  if(PopupUtils.IsInnerAlign(verticalAlign)
13136   && !PopupUtils.IsInnerAlign(horizontalAlign)
13137   && !PopupUtils.IsAlignNotSet(horizontalAlign))
13138   return 0;
13139  var toTheTop = (verticalAlign == PopupUtils.AboveAlignIndicator || verticalAlign == PopupUtils.BottomSidesAlignIndicator) ^ popupPosition.isInverted;
13140  return toTheTop ? 1 : -1;
13141 },
13142 IsVerticalScrollExists: function () {
13143  var scrollIsNotHidden = ASPx.GetCurrentStyle(document.body).overflowY !== "hidden" && ASPx.GetCurrentStyle(document.documentElement).overflowY !== "hidden";
13144  return (scrollIsNotHidden && ASPx.GetDocumentHeight() > ASPx.GetDocumentClientHeight());
13145 },
13146 CoordinatesInDocumentRect: function (x, y) {
13147  var docScrollLeft = ASPx.GetDocumentScrollLeft();
13148  var docScrollTop = ASPx.GetDocumentScrollTop();
13149  return (x > docScrollLeft && y > docScrollTop &&
13150   x < ASPx.GetDocumentClientWidth() + docScrollLeft &&
13151   y < ASPx.GetDocumentClientHeight() + docScrollTop);
13152 },
13153 GetElementZIndexArray: function (element) {
13154  var currentElement = element;
13155  var zIndexesArray = [0];
13156  while(currentElement && currentElement.tagName != "BODY") {
13157   if(currentElement.style) {
13158    if(typeof (currentElement.style.zIndex) != "undefined" && currentElement.style.zIndex != "")
13159     zIndexesArray.unshift(currentElement.style.zIndex);
13160   }
13161   currentElement = currentElement.parentNode;
13162  }
13163  return zIndexesArray;
13164 },
13165 IsHigher: function (higherZIndexArrat, zIndexArray) {
13166  if(zIndexArray == null) return true;
13167  var count = (higherZIndexArrat.length >= zIndexArray.length) ? higherZIndexArrat.length : zIndexArray.length;
13168  for(var i = 0; i < count; i++)
13169   if(typeof (higherZIndexArrat[i]) != "undefined" && typeof (zIndexArray[i]) != "undefined") {
13170    var higherZIndexArrayCurrentElement = parseInt(higherZIndexArrat[i].toString());
13171    var zIndexArrayCurrentElement = parseInt(zIndexArray[i].toString());
13172    if(higherZIndexArrayCurrentElement != zIndexArrayCurrentElement)
13173     return higherZIndexArrayCurrentElement > zIndexArrayCurrentElement;
13174   } else return typeof (zIndexArray[i]) == "undefined";
13175  return true;
13176 },
13177 TestIsPopupElement: function (element) {
13178  return !!element.DXPopupElementControl;
13179 }
13180}
13181PopupUtils.OverControl = {
13182 GetPopupElementByEvt: function (evt) {
13183  return PopupUtils.FindEventSourceParentByTestFunc(evt, PopupUtils.TestIsPopupElement);
13184 },
13185 OnMouseEvent: function (evt, mouseOver) {
13186  var popupElement = PopupUtils.OverControl.GetPopupElementByEvt(evt);
13187  if(mouseOver)
13188   popupElement.DXPopupElementControl.OnPopupElementMouseOver(evt, popupElement);
13189  else
13190   popupElement.DXPopupElementControl.OnPopupElementMouseOut(evt, popupElement);
13191 },
13192 OnMouseOut: function (evt) {
13193  PopupUtils.OverControl.OnMouseEvent(evt, false);
13194 },
13195 OnMouseOver: function (evt) {
13196  PopupUtils.OverControl.OnMouseEvent(evt, true);
13197 }
13198}
13199PopupUtils.BodyScrollHelper = (function () {
13200 var windowScrollLock = {};
13201 var windowScroll = {};
13202 function lockWindowScroll(windowId) {
13203  windowScrollLock[windowId] = true;
13204 }
13205 function unlockWindowScroll(windowId) {
13206  windowScrollLock[windowId] = false;
13207 }
13208 function isAnyWindowScrollLocked() {
13209  for(var key in windowScrollLock) 
13210   if(windowScrollLock[key])
13211    return true;
13212  return false;
13213 }
13214 function replaceVerticalScrollByMargin() {
13215  var currentBodyStyle = ASPx.GetCurrentStyle(document.body),
13216   marginWidth = ASPx.GetVerticalScrollBarWidth() + ASPx.PxToInt(currentBodyStyle.marginRight);
13217  ASPx.Attr.ChangeStyleAttribute(document.body, "margin-right", marginWidth + "px");
13218 }
13219 function fixScrollsBug() {
13220  var scrollTop = document.body.scrollTop;
13221  var scrollLeft = document.body.scrollLeft;
13222  document.body.scrollTop++;
13223  document.body.scrollTop--;
13224  document.body.scrollLeft++;
13225  document.body.scrollLeft--;
13226  document.body.scrollLeft = scrollLeft;
13227  document.body.scrollTop = scrollTop;
13228 }
13229 return {
13230  HideBodyScroll: function(windowId) {
13231   if(isAnyWindowScrollLocked()) { 
13232    lockWindowScroll(windowId);
13233    return;
13234   }
13235   lockWindowScroll(windowId);
13236   if(PopupUtils.IsVerticalScrollExists())
13237    replaceVerticalScrollByMargin();
13238   if(ASPx.Browser.IE) {
13239    ASPx.Attr.ChangeAttribute(document.body, "scroll", "no");
13240    ASPx.Attr.ChangeStyleAttribute(document.documentElement, "overflow", "hidden");
13241   } else if(ASPx.Browser.Firefox && ASPx.Browser.Version < 3) { 
13242    var scrollTop = document.documentElement.scrollTop;
13243    ASPx.Attr.ChangeStyleAttribute(document.body, "overflow", "hidden");
13244    document.documentElement.scrollTop = scrollTop;
13245   } else if(ASPx.Browser.WebKitTouchUI) {
13246    windowScroll[windowId] = { 
13247     x: window.scrollX,
13248     y: window.scrollY
13249    };
13250    ASPx.Attr.ChangeStyleAttribute(document.documentElement, "overflow", "hidden");
13251    ASPx.Attr.ChangeStyleAttribute(document.body, "overflow", "hidden");
13252    ASPx.Attr.ChangeStyleAttribute(document.body, "position", "relative");
13253    ASPx.Attr.ChangeStyleAttribute(document.body, "height", "100%");
13254    ASPx.Attr.ChangeStyleAttribute(document.body, "margin", "0");
13255    ASPx.Attr.ChangeStyleAttribute(document.documentElement, "height", "100%");
13256   } else {
13257    ASPx.Attr.ChangeStyleAttribute(document.documentElement, "overflow", "hidden");
13258    var documentHeight = ASPx.GetDocumentHeight();
13259    var documentWidth = ASPx.GetDocumentWidth();
13260    if(window.pageYOffset > 0 && ASPx.PxToInt(window.getComputedStyle(document.body, null)) != documentHeight)
13261     ASPx.Attr.ChangeStyleAttribute(document.body, "height", documentHeight + "px");
13262    if(window.pageXOffset > 0 && ASPx.PxToInt(window.getComputedStyle(document.body, null)) != documentWidth)
13263     ASPx.Attr.ChangeStyleAttribute(document.body, "width", documentWidth + "px");
13264    if(ASPx.Browser.Chrome) {
13265     fixScrollsBug();
13266    }
13267   }
13268  },
13269  RestoreBodyScroll: function(windowId) {
13270   unlockWindowScroll(windowId);
13271   if(isAnyWindowScrollLocked())
13272    return;
13273   if(ASPx.Browser.IE) {
13274    ASPx.Attr.RestoreAttribute(document.body, "scroll");
13275    ASPx.Attr.RestoreStyleAttribute(document.documentElement, "overflow");
13276   } else if(ASPx.Browser.WebKitTouchUI) {
13277    ASPx.Attr.RestoreStyleAttribute(document.body, "position");
13278    ASPx.Attr.RestoreStyleAttribute(document.body, "height");
13279    ASPx.Attr.RestoreStyleAttribute(document.body, "margin");
13280    ASPx.Attr.RestoreStyleAttribute(document.documentElement, "overflow");
13281    ASPx.Attr.RestoreStyleAttribute(document.body, "overflow");
13282    ASPx.Attr.RestoreStyleAttribute(document.documentElement, "height");
13283    windowScroll = windowScroll[windowId];
13284    window.scrollTo(windowScroll.x, windowScroll.y);
13285   } else
13286    ASPx.Attr.RestoreStyleAttribute(document.documentElement, "overflow");
13287   ASPx.Attr.RestoreStyleAttribute(document.body, "margin-right");
13288   ASPx.Attr.RestoreStyleAttribute(document.body, "height");
13289   ASPx.Attr.RestoreStyleAttribute(document.body, "width");
13290   if(ASPx.Browser.WebKitFamily) { 
13291    fixScrollsBug();
13292   }
13293  }
13294 }
13295})();
13296var PositionAlignConsts = {
13297 NOT_SET: 0,
13298 OUTSIDE_START: 1,
13299 NEAR_BOUND_START: 2,
13300 INNER_START: 3,
13301 CENTER: 4,
13302 INNER_END: 5,
13303 NEAR_BOUND_END: 6,
13304 OUTSIDE_END: 7,
13305 WINDOW_CENTER: 8,
13306 WINDOW_START: 9,
13307 WINDOW_END: 10
13308};
13309var AlignIndicatorTable = {};
13310var PositionCalculator = ASPx.CreateClass(null, {
13311 constructor: function() {
13312  this.element = null;
13313  this.popupElement = null;
13314  this.align = 0;
13315  this.offset = 0;
13316  this.startPos = 0;
13317  this.startPosInit = 0;
13318  this.rtl = false;
13319  this.isPopupFullCorrectionOn = false;
13320  this.isHorizontal = true;
13321  this.size = 0;
13322  this.bodySize = 0;
13323  this.actualBodySize = 0;
13324  this.elementStartPos = 0;
13325  this.scrollStartPos = 0;
13326  this.isInverted = false;
13327  this.popupElementSize = 0;
13328  this.boundStartPos = 0;
13329  this.boundEndPos = 0;
13330  this.innerBoundStartPos = 0;
13331  this.innerBoundEndPos = 0;
13332  this.isMoreFreeSpaceLeft = false;
13333  this.nearBoundOverlapRate = 0.25;
13334  this.functionsTable = {};
13335  this.initializeFunctionsTable();
13336 },
13337 applyParams: function(element, popupElement, align, offset, startPos, startPosInit, rtl, isPopupFullCorrectionOn, isHorizontal) {
13338  this.isHorizontal = isHorizontal;
13339  this.element = element;
13340  this.popupElement = popupElement;
13341  this.align = this.getAlignValueFromIndicator(align);
13342  this.offset = offset;
13343  this.startPos = startPos;
13344  this.startPosInit = startPosInit;
13345  this.rtl = rtl;
13346  this.isPopupFullCorrectionOn = isPopupFullCorrectionOn;
13347  this.calculateParams();
13348 },
13349 disposeState: function() {
13350  this.element = null;
13351  this.popupElement = null;
13352 },
13353 getPopupAbsolutePos: function() {
13354  if(this.isWindowAlign()) {
13355   var showAtPos = this.startPos != ASPx.InvalidPosition && !this.popupElement;
13356   if(showAtPos)
13357    this.align = PositionAlignConsts.NOT_SET;
13358   else
13359    return this.getWindowAlignPos();
13360  }
13361  if(this.popupElement)
13362   this.calculatePopupElement();
13363  else
13364   this.align = PositionAlignConsts.NOT_SET;
13365  return this.getPopupAbsolutePosCore();
13366 },
13367 initializeFunctionsTable: function() {
13368  var table = this.functionsTable;
13369  table[PositionAlignConsts.NOT_SET] = this.calculateNotSet;
13370  table[PositionAlignConsts.OUTSIDE_START] = this.calculateOutsideStart;
13371  table[PositionAlignConsts.INNER_START] = this.calculateInnerStart;
13372  table[PositionAlignConsts.CENTER] = this.calculateCenter;
13373  table[PositionAlignConsts.INNER_END] = this.calculateInnerEnd;
13374  table[PositionAlignConsts.OUTSIDE_END] = this.calculateOutsideEnd;
13375  table[PositionAlignConsts.NEAR_BOUND_START] = this.calculateNearBoundStart;
13376  table[PositionAlignConsts.NEAR_BOUND_END] = this.calculateNearBoundEnd;
13377  table[PositionAlignConsts.WINDOW_CENTER] = this.calculateWindowCenter;
13378  table[PositionAlignConsts.WINDOW_START] = this.calculateWindowStart;
13379  table[PositionAlignConsts.WINDOW_END] = this.calculateWindowEnd;
13380 },
13381 calculateParams: function() {
13382  this.size = this.getElementSize();
13383  if(this.isHorizontal) {
13384   this.bodySize = ASPx.GetDocumentClientWidth();
13385   this.elementStartPos = ASPx.GetAbsoluteX(this.popupElement);
13386   this.scrollStartPos = ASPx.GetDocumentScrollLeft();
13387  }
13388  else {
13389   this.bodySize = ASPx.GetDocumentClientHeight();
13390   this.elementStartPos = ASPx.GetAbsoluteY(this.popupElement);
13391   this.scrollStartPos = ASPx.GetDocumentScrollTop();
13392  }
13393 },
13394 isWindowAlign: function() {
13395  return this.align == PositionAlignConsts.WINDOW_CENTER || this.align == PositionAlignConsts.WINDOW_START ||
13396   this.align == PositionAlignConsts.WINDOW_END;
13397 },
13398 getWindowAlignPos: function() {
13399  this.actualBodySize = ASPx.Browser.WebKitTouchUI ? this.getWindowInnerSize() : this.bodySize;
13400  return this.getPopupAbsolutePosCore();
13401 },
13402 getPopupAbsolutePosCore: function() {
13403  var calculationFunc = this.functionsTable[this.align];
13404  calculationFunc.call(this);
13405  return new ASPx.PopupPosition(this.startPos, this.isInverted);
13406 },
13407 calculateWindowCenter: function() {
13408  this.startPos = Math.ceil(this.actualBodySize / 2 - this.size / 2) + this.scrollStartPos + this.offset;
13409 },
13410 calculateWindowStart: function() {
13411  this.startPos = this.scrollStartPos + this.offset;
13412 },
13413 calculateWindowEnd: function() {
13414  this.startPos = this.scrollStartPos + this.actualBodySize - this.size + this.offset;
13415 },
13416 calculatePopupElement: function() {
13417  this.popupElementSize = this.getPopupElementSize();
13418  this.boundStartPos = this.elementStartPos - this.size;
13419  this.boundEndPos = this.elementStartPos + this.popupElementSize;
13420  this.innerBoundStartPos = this.elementStartPos;
13421  this.innerBoundEndPos = this.elementStartPos + this.popupElementSize - this.size;
13422  this.isMoreFreeSpaceLeft = this.bodySize - (this.boundEndPos + this.size) < this.boundStartPos - 2 * this.scrollStartPos;
13423 },
13424 calculateOutsideStart: function() {
13425  this.isInverted = this.isPopupFullCorrectionOn && (!(this.boundStartPos - this.scrollStartPos > 0 || this.isMoreFreeSpaceLeft));
13426  if(this.isInverted)
13427   this.startPos = this.boundEndPos - this.offset;
13428  else
13429   this.startPos = this.boundStartPos + this.offset;
13430 },
13431 calculateInnerStart: function() {
13432  this.startPos = this.innerBoundStartPos + this.offset;
13433  if(this.isPopupFullCorrectionOn)
13434   this.startPos = PopupUtils.AdjustPositionToClientScreen(this.element, this.startPos, this.rtl, true);
13435 },
13436 calculateCenter: function() {
13437  this.startPos = this.elementStartPos + Math.round((this.popupElementSize - this.size) / 2) + this.offset;
13438 },
13439 calculateInnerEnd: function() {
13440  this.startPos = this.innerBoundEndPos + this.offset;
13441  if(this.isPopupFullCorrectionOn)
13442   this.startPos = PopupUtils.AdjustPositionToClientScreen(this.element, this.startPos, this.rtl, true);
13443 },
13444 calculateOutsideEnd: function() {
13445  this.isInverted = this.isPopupFullCorrectionOn && (!(this.boundEndPos + this.size < this.bodySize + this.scrollStartPos || !this.isMoreFreeSpaceLeft));
13446  if(this.isInverted)
13447   this.startPos = this.boundStartPos - this.offset;
13448  else
13449   this.startPos = this.boundEndPos + this.offset;
13450 },
13451 calculateNotSet: function() {
13452  if(this.rtl)
13453   this.calculateNotSetRightToLeft();
13454  else
13455   this.calculateNotSetLeftToRight();
13456 },
13457 calculateNotSetLeftToRight: function() {
13458  if(!ASPx.IsValidPosition(this.startPos)) {
13459   if(this.popupElement)
13460    this.startPos = this.elementStartPos;
13461   else if(this.offset)
13462    this.startPos = 0;
13463   else
13464    this.startPos = this.startPosInit;
13465  }
13466  this.isInverted = this.isPopupFullCorrectionOn && (this.startPos - this.scrollStartPos + this.size > this.bodySize && this.startPos - this.scrollStartPos > this.bodySize / 2);
13467  if(this.isInverted)
13468   this.startPos = this.startPos - this.size - this.offset;
13469  else
13470   this.startPos = this.startPos + this.offset;
13471 },
13472 calculateNotSetRightToLeft: function() {
13473  if(!ASPx.IsValidPosition(this.startPos)) {
13474   if(this.popupElement)
13475    this.startPos = this.innerBoundEndPos;
13476   else if(this.offset)
13477    this.startPos = 0;
13478   else
13479    this.startPos = this.startPosInit;
13480  }
13481  else
13482   this.startPos -= this.size;
13483  this.isInverted = this.isPopupFullCorrectionOn && (this.startPos < this.scrollStartPos && this.startPos - this.scrollStartPos < this.bodySize / 2);
13484  if(this.isInverted)
13485   this.startPos = this.startPos + this.size + this.offset;
13486  else
13487   this.startPos = this.startPos - this.offset;
13488 },
13489 calculateNearBoundStart: function() {
13490  this.startPos = this.boundStartPos + this.offset + this.size * this.nearBoundOverlapRate;
13491  if(this.isPopupFullCorrectionOn)
13492   this.startPos = PopupUtils.AdjustPositionToClientScreen(this.element, this.startPos, this.rtl, true);
13493 },
13494 calculateNearBoundEnd: function() {
13495  this.startPos = this.boundEndPos + this.offset - this.size * this.nearBoundOverlapRate;
13496  if(this.isPopupFullCorrectionOn)
13497   this.startPos = PopupUtils.AdjustPositionToClientScreen(this.element, this.startPos, this.rtl, true);
13498 },
13499 getAlignValueFromIndicator: function(alignIndicator) {
13500  var alignValue = AlignIndicatorTable[alignIndicator];
13501  if(alignValue === undefined)
13502   throw "Incorrect align indicator.";
13503  return alignValue;
13504 },
13505 getElementSize: function() {
13506  return this.getCustomElementSize(this.element);
13507 },
13508 getPopupElementSize: function() {
13509  return this.getCustomElementSize(this.popupElement);
13510 },
13511 getCustomElementSize: function(customElement) {
13512  return this.isHorizontal ? customElement.offsetWidth : customElement.offsetHeight;
13513 },
13514 getWindowInnerSize: function() {
13515  return this.isHorizontal ? window.innerWidth : window.innerHeight;
13516 }
13517});
13518var positionCalculator = null;
13519function getPositionCalculator() {
13520 if(positionCalculator == null)
13521  positionCalculator = new PositionCalculator();
13522 return positionCalculator;
13523}
13524function initializeAlignIndicatorTable() {
13525 AlignIndicatorTable[PopupUtils.NotSetAlignIndicator] = PositionAlignConsts.NOT_SET;
13526 AlignIndicatorTable[PopupUtils.OutsideLeftAlignIndicator] = PositionAlignConsts.OUT
13526SIDE_START;
13527 AlignIndicatorTable[PopupUtils.AboveAlignIndicator] = PositionAlignConsts.OUTSIDE_START;
13528 AlignIndicatorTable[PopupUtils.LeftAlignIndicator] = PositionAlignConsts.NEAR_BOUND_START;
13529 AlignIndicatorTable[PopupUtils.TopAlignIndicator] = PositionAlignConsts.NEAR_BOUND_START;
13530 AlignIndicatorTable[PopupUtils.LeftSidesAlignIndicator] = PositionAlignConsts.INNER_START;
13531 AlignIndicatorTable[PopupUtils.TopSidesAlignIndicator] = PositionAlignConsts.INNER_START;
13532 AlignIndicatorTable[PopupUtils.CenterAlignIndicator] = PositionAlignConsts.CENTER;
13533 AlignIndicatorTable[PopupUtils.MiddleAlignIndicator] = PositionAlignConsts.CENTER;
13534 AlignIndicatorTable[PopupUtils.RightSidesAlignIndicator] = PositionAlignConsts.INNER_END;
13535 AlignIndicatorTable[PopupUtils.BottomSidesAlignIndicator] = PositionAlignConsts.INNER_END;
13536 AlignIndicatorTable[PopupUtils.RightAlignIndicator] = PositionAlignConsts.NEAR_BOUND_END;
13537 AlignIndicatorTable[PopupUtils.BottomAlignIndicator] = PositionAlignConsts.NEAR_BOUND_END;
13538 AlignIndicatorTable[PopupUtils.OutsideRightAlignIndicator] = PositionAlignConsts.OUTSIDE_END;
13539 AlignIndicatorTable[PopupUtils.BelowAlignIndicator] = PositionAlignConsts.OUTSIDE_END;
13540 AlignIndicatorTable[PopupUtils.WindowCenterAlignIndicator] = PositionAlignConsts.WINDOW_CENTER;
13541 AlignIndicatorTable[PopupUtils.WindowLeftAlignIndicator] = PositionAlignConsts.WINDOW_START;
13542 AlignIndicatorTable[PopupUtils.WindowTopAlignIndicator] = PositionAlignConsts.WINDOW_START;
13543 AlignIndicatorTable[PopupUtils.WindowRightAlignIndicator] = PositionAlignConsts.WINDOW_END;
13544 AlignIndicatorTable[PopupUtils.WindowBottomAlignIndicator] = PositionAlignConsts.WINDOW_END;
13545}
13546initializeAlignIndicatorTable();
13547ASPx.PopupPosition = function(position, isInverted) {
13548 this.position = position;
13549 this.isInverted = isInverted;
13550}
13551ASPx.PopupSize = function(width, height) {
13552 this.width = width;
13553 this.height = height;
13554}
13555ASPx.PopupUtils = PopupUtils;
13556})();
13557(function () {
13558ASPxClientCallbackPanel = ASPx.CreateClass(ASPxClientPanel, {
13559 constructor: function (name) {
13560  this.constructor.prototype.constructor.call(this, name);
13561  this.hideContentOnCallback = true;
13562  this.isLoadingPanelTextEmpty = false;
13563 },
13564 OnCallback: function (result) {
13565  ASPx.SetInnerHtml(this.getContentElement(), result);
13566  if(this.touchUIScroller)
13567   this.touchUIScroller.ChangeElement(this.getContentElement());
13568 },
13569 ShowLoadingPanel: function () {
13570  var element = this.getContentElement();
13571  var mainElement = (element.tagName == "TD") ? this.GetMainElement() : element;
13572  if(!this.hideContentOnCallback)
13573   this.CreateLoadingPanelWithAbsolutePosition(this.GetMainElement().parentNode, mainElement);
13574  else
13575   this.CreateLoadingPanelInsideContainer(element, true, true, false);
13576 },
13577 ShowLoadingDiv: function () {
13578  this.CreateLoadingDiv(this.GetMainElement().parentNode, this.getContentElement());
13579 },
13580 GetCallbackAnimationElement: function() {
13581  return this.getContentElement();
13582 },
13583 PerformCallback: function (parameter, onSuccess) {
13584  this.CreateCallback(parameter, null, null, onSuccess);
13585 },
13586 CreateCallback: function (arg, command, callbackInfo, handler) {
13587  this.ShowLoadingElements();
13588  ASPxClientControl.prototype.CreateCallback.call(this, arg, command, handler);
13589 },
13590 GetLoadingPanelTextLabelID: function () {
13591  return this.name + "_TL";
13592 },
13593 GetLoadingPanelTextLabel: function () {
13594  return ASPx.GetElementById(this.GetLoadingPanelTextLabelID());
13595 },
13596 GetLoadingPanelText: function () {
13597  var textLabel = this.GetLoadingPanelTextLabel();
13598  if(textLabel && !this.isLoadingPanelTextEmpty)
13599   return textLabel.innerHTML;
13600  return "";
13601 },
13602 SetLoadingPanelText: function (text) {
13603  this.isLoadingPanelTextEmpty = text == null || text == "";
13604  var textLabel = this.GetLoadingPanelTextLabel();
13605  if(textLabel)
13606   textLabel.innerHTML = this.isLoadingPanelTextEmpty ? "&nbsp;" : text;
13607 },
13608 SetContentHtml: function (html, useAnimation) {
13609  ASPxClientPanel.prototype.SetContentHtml.call(this, html);
13610  if(useAnimation && typeof(ASPx.AnimationHelper) != "undefined")
13611   ASPx.AnimationHelper.fadeIn(this.getContentElement());
13612 }
13613});
13614ASPxClientCallbackPanel.Cast = ASPxClientControl.Cast;
13615window.ASPxClientCallbackPanel = ASPxClientCallbackPanel;
13616})();
13617(function() {
13618var captchaRefreshCommand = "R";
13619var captchaImageIDPostfix = "_IMG";
13620var captchaTextBoxIDPostfix = "_TB";
13621var captchaRefreshButtonIDPostfix = "_RB";
13622var captchaRefreshButtonTextSpanIDPostfix = "_RTS";
13623var ASPxClientCaptcha = ASPx.CreateClass(ASPxClientControl, {
13624 constructor: function(name) {
13625  this.constructor.prototype.constructor.call(this, name);
13626  this.refreshButtonOnClick = function() { this.Refresh(); }.aspxBind(this);
13627  var image = this.GetImage();
13628  ASPx.Evt.AttachEventToElement(image, "load", function() {
13629   this.HideLoadingElements();
13630   this.GetImage().style.visibility = "";
13631  }.aspxBind(this));
13632  var refreshButton = this.GetRefreshButton();
13633  if(refreshButton != null)
13634   ASPx.Evt.AttachEventToElement(refreshButton, "click", this.refreshButtonOnClick); 
13635  this.allowMultipleCallbacks = false;
13636 },
13637 GetImage: function() {
13638  return ASPx.GetElementById(this.name + captchaImageIDPostfix);
13639 },
13640 GetRefreshButton: function() {
13641  return ASPx.GetElementById(this.name + captchaRefreshButtonIDPostfix);
13642 },
13643 GetRefreshButtonTextSpan: function() {
13644  return ASPx.GetElementById(this.name + captchaRefreshButtonTextSpanIDPostfix);
13645 },
13646 GetEditor: function() {
13647  return ASPx.GetControlCollection().Get(this.name + captchaTextBoxIDPostfix);
13648 },
13649 HideLoadingPanelOnCallback: function() {
13650  return false;
13651 },
13652 CreateCallback: function(arg, command, callbackInfo) {
13653  this.ShowLoadingElements();
13654  ASPxClientControl.prototype.CreateCallback.call(this, arg, command);
13655 },
13656 DoBeginCallback: function(command){
13657  var editor = this.GetEditor();
13658  if(editor != null) editor.SetIsValid(true);
13659  ASPxClientControl.prototype.DoBeginCallback.call(this, command);
13660 },
13661 ShowLoadingPanel: function(){
13662  var image = this.GetImage();
13663  image.style.visibility = "hidden";
13664  this.CreateLoadingPanelWithAbsolutePosition(this.GetMainElement(), image);
13665 },
13666 ShowLoadingDiv: function () {
13667  this.CreateLoadingDiv(this.GetMainElement(), this.GetImage());
13668 },
13669 GetCallbackAnimationElement: function() {
13670  return this.GetImage();
13671 },
13672 OnCallback: function(result) {
13673  var image = this.GetImage();
13674  image.src = result;
13675 },
13676 SetEnabled: function(enabled) {
13677  if(enabled == this.clientEnabled)
13678   return;
13679  ASPxClientControl.prototype.SetEnabled.call(this, enabled);
13680  var refreshButton = this.GetRefreshButton();
13681  if(refreshButton == null)
13682   return;
13683  ASPx.GetStateController().SetElementEnabled(this.GetRefreshButton(), enabled);
13684  ASPx.GetStateController().SetElementEnabled(this.GetRefreshButtonTextSpan(), enabled);
13685  var eventsMethod = ASPx.Attr.ChangeEventsMethod(enabled);
13686  eventsMethod(refreshButton, "click", this.refreshButtonOnClick);
13687  refreshButton.style.cursor = enabled ? "pointer" : "default";
13688 },
13689 Focus: function () {
13690  var editor = this.GetEditor();
13691  if(editor)
13692   editor.SetFocus();
13693 },
13694 Refresh: function() {
13695  if(!this.callBack) {
13696   if(this.isInitialized)
13697    this.SendPostBack(captchaRefreshCommand);
13698   return;
13699  }
13700  this.CreateCallback(captchaRefreshCommand);
13701 }
13702});
13703ASPxClientCaptcha.Cast = ASPxClientControl.Cast;
13704window.ASPxClientCaptcha = ASPxClientCaptcha;
13705})();
13706(function() {
13707var ASPxClientEditBase = ASPx.CreateClass(ASPxClientControl, {
13708 constructor: function(name) {
13709  this.constructor.prototype.constructor.call(this, name);
13710  this.EnabledChanged = new ASPxClientEvent();
13711  this.captionPosition = ASPx.Position.Left;
13712  this.showCaptionColon = true;
13713 },
13714 InlineInitialize: function(){
13715  ASPxClientControl.prototype.InlineInitialize.call(this);
13716  this.InitializeEnabled(); 
13717 },
13718 InitializeEnabled: function() {
13719  this.SetEnabledInternal(this.clientEnabled, true);
13720 },
13721 GetValue: function() {
13722  var element = this.GetMainElement();
13723  if(ASPx.IsExistsElement(element))
13724   return element.innerHTML;
13725  return "";
13726 },
13727 GetValueString: function(){
13728  var value = this.GetValue();
13729  return (value == null) ? null : value.toString();
13730 },
13731 SetValue: function(value) {
13732  if(value == null)
13733   value = "";
13734  var element = this.GetMainElement();
13735  if(ASPx.IsExistsElement(element))
13736   element.innerHTML = value;
13737 },
13738 GetEnabled: function(){
13739  return this.enabled && this.clientEnabled;
13740 },
13741 SetEnabled: function(enabled){
13742  if(this.clientEnabled != enabled) {
13743   var errorFrameRequiresUpdate = this.GetIsValid && !this.GetIsValid();
13744   if(errorFrameRequiresUpdate && !enabled)
13745    this.UpdateErrorFrameAndFocus(false , null , true );
13746   this.clientEnabled = enabled;
13747   this.SetEnabledInternal(enabled, false);
13748   if(errorFrameRequiresUpdate && enabled)
13749    this.UpdateErrorFrameAndFocus(false );
13750   this.RaiseEnabledChangedEvent();
13751  }
13752 },
13753 SetEnabledInternal: function(enabled, initialization){
13754  if(!this.enabled) return;
13755  if(!initialization || !enabled)
13756   this.ChangeEnabledStateItems(enabled);
13757  this.ChangeEnabledAttributes(enabled);
13758  if(ASPx.Browser.Chrome) {   
13759   var mainElement = this.GetMainElement();
13760   if(mainElement)
13761    mainElement.className = mainElement.className;
13762  } 
13763 },
13764 ChangeEnabledAttributes: function(enabled){
13765 },
13766 ChangeEnabledStateItems: function(enabled){
13767 },
13768 RaiseEnabledChangedEvent: function(){
13769  if(!this.EnabledChanged.IsEmpty()){
13770   var args = new ASPxClientEventArgs();
13771   this.EnabledChanged.FireEvent(this, args);
13772  }
13773 },
13774 GetDecodeValue: function (value) { 
13775  if(typeof (value) == "string" && value.length > 1)
13776   value = this.SimpleDecodeHtml(value);
13777  return value;
13778 },
13779 SimpleDecodeHtml: function (html) {
13780  return ASPx.Str.ApplyReplacement(html, [
13781   [/&lt;/g, '<'],
13782   [/&amp;/g, '&'],
13783   [/&quot;/g, '"'],
13784   [/&#39;/g, '\''],
13785   [/&#32;/g, ' ']
13786  ]);
13787 },
13788 GetCachedElementById: function(idSuffix) {
13789  return ASPx.CacheHelper.GetCachedElementById(this, this.name + idSuffix);
13790 },
13791 GetCaptionCell: function() {
13792  return this.GetCachedElementById(EditElementSuffix.CaptionCell);
13793 },
13794 GetExternalTable: function() {
13795  return this.GetCachedElementById(EditElementSuffix.ExternalTable);
13796 },
13797 getCaptionRelatedCellCount: function() {
13798  if(!this.captionRelatedCellCount)
13799   this.captionRelatedCellCount = ASPx.GetNodesByClassName(this.GetExternalTable(), CaptionRelatedCellClassName).length;
13800  return this.captionRelatedCellCount;
13801 },
13802 addCssClassToCaptionRelatedCells: function() {
13803  if(this.captionPosition == ASPx.Position.Left || this.captionPosition == ASPx.Position.Right) {
13804   var captionRelatedCellsIndex = this.captionPosition == ASPx.Position.Left ? 0 : this.GetCaptionCell().cellIndex;
13805   for(var i = 0; i < this.GetExternalTable().rows.length; i++)
13806    ASPx.AddClassNameToElement(this.GetExternalTable().rows[i].cells[captionRelatedCellsIndex], CaptionRelatedCellClassName);
13807  }
13808  if(this.captionPosition == ASPx.Position.Top || this.captionPosition == ASPx.Position.Bottom)
13809   for(var i = 0; i < this.GetCaptionCell().parentNode.cells.length; i++)
13810    ASPx.AddClassNameToElement(this.GetCaptionCell().parentNode.cells[i], CaptionRelatedCellClassName);
13811 },
13812 GetCaption: function() {
13813  if(ASPx.IsExists(this.GetCaptionCell()))
13814   return this.getCaptionInternal();
13815  return "";
13816 },
13817 SetCaption: function(caption) {
13818  if(!ASPx.IsExists(this.GetCaptionCell()))
13819   return;
13820  if(this.getCaptionRelatedCellCount() == 0)
13821   this.addCssClassToCaptionRelatedCells();
13822  if(caption !== "")
13823   ASPx.RemoveClassNameFromElement(this.GetExternalTable(), ASPxEditExternalTableClassNames.TableWithEmptyCaptionClassName);
13824  else
13825   ASPx.AddClassNameToElement(this.GetExternalTable(), ASPxEditExternalTableClassNames.TableWithEmptyCaptionClassName);
13826  this.setCaptionInternal(caption);
13827 },
13828 getCaptionTextNode: function() {
13829  var captionElement = ASPx.GetNodesByPartialClassName(this.GetCaptionCell(), CaptionElementPartialClassName)[0];
13830  return ASPx.GetNormalizedTextNode(captionElement);
13831 },
13832 getCaptionInternal: function() {
13833  var captionText = this.getCaptionTextNode().nodeValue;
13834  if(captionText !== "" && captionText[captionText.length - 1] == ":")
13835   captionText = captionText.substring(0, captionText.length - 1);
13836  return captionText;
13837 },
13838 setCaptionInternal: function(caption) {
13839  caption = ASPx.Str.Trim(caption);
13840  var captionTextNode = this.getCaptionTextNode();
13841  if(this.showCaptionColon && caption[caption.length - 1] != ":" && caption !== "")
13842   caption += ":";
13843  captionTextNode.nodeValue = caption;
13844 }
13845});
13846var ValidationPattern = ASPx.CreateClass(null, {
13847 constructor: function(errorText) {
13848  this.errorText = errorText;
13849 }
13850});
13851var RequiredFieldValidationPattern = ASPx.CreateClass(ValidationPattern, {
13852 constructor: function(errorText) {
13853  this.constructor.prototype.constructor.call(this, errorText);
13854 },
13855 EvaluateIsValid: function(value) {
13856  return value != null && (value.constructor == Array || ASPx.Str.Trim(value.toString()) != "");
13857 }
13858});
13859var RegularExpressionValidationPattern = ASPx.CreateClass(ValidationPattern, {
13860 constructor: function(errorText, pattern) {
13861  this.constructor.prototype.constructor.call(this, errorText);
13862  this.pattern = pattern;
13863 },
13864 EvaluateIsValid: function(value) {
13865  if(value == null) 
13866   return true;
13867  var strValue = value.toString();
13868  if(ASPx.Str.Trim(strValue).length == 0)
13869   return true;
13870  var regEx = new RegExp(this.pattern);
13871  var matches = regEx.exec(strValue);
13872  return matches != null && strValue == matches[0];
13873 }
13874});
13875function _aspxIsEditorFocusable(inputElement) {
13876 return ASPx.IsFocusableCore(inputElement, function(container) {
13877  return container.getAttribute("errorFrame") == "errorFrame";
13878 });
13879}
13880var invalidEditorToBeFocused = null;
13881var ValidationType = {
13882 PersonalOnValueChanged: "ValueChanged",
13883 PersonalViaScript: "CalledViaScript",
13884 MassValidation: "MassValidation"
13885};
13886var ErrorFrameDisplay = {
13887 None: "None",
13888 Static: "Static",
13889 Dynamic: "Dynamic"
13890};
13891var EditElementSuffix = {
13892 ExternalTable: "_ET",
13893 ControlCell: "_CC",
13894 ErrorCell: "_EC",
13895 ErrorTextCell: "_ETC",
13896 ErrorImage: "_EI",
13897 CaptionCell: "_CapC",
13898 AccessibilityAdditionalTextRow: "_AHTR"
13899};
13900var ASPxEditExternalTableClassNames = {
13901 ValidStaticTableClassName: "dxeValidStEditorTable",
13902 ValidDynamicTableClassName: "dxeValidDynEditorTable",
13903 TableWithSeparateBordersClassName: "tableWithSeparateBorders",
13904 TableWithEmptyCaptionClassName: "tableWithEmptyCaption"
13905};
13906var CaptionRelatedCellClassName = "dxeCaptionRelatedCell";
13907var CaptionElementPartialClassName = "dxeCaption";
13908var AccessibilityInvisibleRowCssClassName = "dxAIR";
13909var ASPxClientEdit = ASPx.CreateClass(ASPxClientEditBase, {
13910 constructor: function(name) {
13911  this.constructor.prototype.constructor.call(this, name);
13912  this.isASPxClientEdit = true;
13913  this.inputElement = null;
13914  this.convertEmptyStringToNull = true;
13915  this.readOnly = false;
13916  this.focused = false;
13917  this.focusEventsLocked = false;
13918  this.receiveGlobalMouseWheel = true;
13919  this.styleDecoration = null;
13920  this.heightCorrectionRequired = false;
13921  this.customValidationEnabled = false;
13922  this.display = ErrorFrameDisplay.Static;
13923  this.initialErrorText = "";
13924  this.causesValidation = false;
13925  this.validateOnLeave = true;
13926  this.validationGroup = "";
13927  this.sendPostBackWithValidation = null;
13928  this.validationPatterns = [];
13929  this.setFocusOnError = false;
13930  this.errorDisplayMode = "it";
13931  this.errorText = "";
13932  this.isValid = true;
13933  this.errorImageIsAssigned = false;
13934  this.notifyValidationSummariesToAcceptNewError = false;
13935  this.isErrorFrameRequired = false;
13936  this.enterProcessed = false;
13937  this.keyDownHandlers = {};
13938  this.keyPressHandlers = {};
13939  this.keyUpHandlers = {};
13940  this.specialKeyboardHandlingUsed = false;
13941  this.onKeyDownHandler = null;
13942  this.onKeyPressHandler = null;
13943  this.onKeyUpHandler = null;
13944  this.onGotFocusHandler = null;
13945  this.onLostFocusHandler = null;
13946  this.GotFocus = new ASPxClientEvent();
13947  this.LostFocus = new ASPxClientEvent();
13948  this.Validation = new ASPxClientEvent();
13949  this.ValueChanged = new ASPxClientEvent();
13950  this.KeyDown = new ASPxClientEvent();
13951  this.KeyPress = new ASPxClientEvent();
13952  this.KeyUp = new ASPxClientEvent();
13953  this.eventHandlersInitialized = false;
13954 },
13955 InitializeProperties: function(properties){
13956  if(properties.decorationStyles){
13957   for(var i = 0; i < properties.decorationStyles.length; i++)
13958    this.AddDecorationStyle(properties.decorationStyles[i].key, 
13959     properties.decorationStyles[i].className, 
13960     properties.decorationStyles[i].cssText);
13961  }
13962 },
13963 Initialize: function() {
13964  this.initialErrorText = this.errorText;
13965  ASPxClientEditBase.prototype.Initialize.call(this);
13966  this.InitializeKeyHandlers();
13967  this.UpdateClientValidationState();
13968  this.UpdateValidationSummaries(null , true );
13969 },
13970 InlineInitialize: function() {
13971  ASPxClientEditBase.prototype.InlineInitialize.call(this);
13972  if(!this.eventHandlersInitialized)
13973   this.InitializeEvents();
13974  if(this.styleDecoration)
13975   this.styleDecoration.Update();
13976  var externalTable = this.GetExternalTable();
13977  if(externalTable && ASPx.IsPercentageSize(externalTable.style.width)) {
13978   this.width = "100%";
13979   this.GetMainElement().style.width = "100%";
13980   if(this.isErrorFrameRequired)
13981    externalTable.setAttribute("errorFrame", "errorFrame");
13982  }
13983 }, 
13984 AfterInitialize: function() {
13985  this.SetAccessibilityCaptionAssociating();
13986  this.UpdateAccessibilityAdditionalTextRelation();
13987  this.UpdateValidationAccessibilityAttributes();
13988  ASPxClientEditBase.prototype.AfterInitialize.call(this);
13989 },
13990 InitializeEvents: function() {
13991 },
13992 InitSpecialKeyboardHandling: function(){
13993  var name = this.name;
13994  this.onKeyDownHandler = function(evt) { ASPx.KBSIKeyDown(name,evt); };
13995  this.onKeyPressHandler = function(evt) { ASPx.KBSIKeyPress(name, evt); };
13996  this.onKeyUpHandler = function(evt) { ASPx.KBSIKeyUp(name, evt); };
13997  this.onGotFocusHandler = function(evt) { ASPx.ESGotFocus(name); };
13998  this.onLostFocusHandler = function(evt) { ASPx.ESLostFocus(name); };
13999  this.specialKeyboardHandlingUsed = true;
14000  this.InitializeDelayedSpecialFocus();
14001 },
14002 InitializeKeyHandlers: function() {
14003 },
14004 AddKeyDownHandler: function(key, handler) {
14005  this.keyDownHandlers[key] = handler;
14006 },
14007 AddKeyPressHandler: function(key, handler) {
14008  this.keyPressHandlers[key] = handler;
14009 },
14010 ChangeSpecialInputEnabledAttributes: function(element, method, doNotChangeAutoComplete){
14011  if(!doNotChangeAutoComplete) 
14012   element.autocomplete = "off";
14013  if(this.onKeyDownHandler != null)
14014   method(element, "keydown", this.onKeyDownHandler);
14015  if(this.onKeyPressHandler != null)
14016   method(element, "keypress", this.onKeyPressHandler);
14017  if(this.onKeyUpHandler != null)
14018   method(element, "keyup", this.onKeyUpHandler);
14019  if(this.onGotFocusHandler != null)
14020   method(element, "focus", this.onGotFocusHandler);
14021  if(this.onLostFocusHandler != null)
14022   method(element, "blur", this.onLostFocusHandler);
14023 },
14024 UpdateClientValidationState: function() {
14025  if(!this.customValidationEnabled)
14026   return;
14027  var mainElement = this.GetMainElement();
14028  if(mainElement) {
14029   var validationState = !this.GetIsValid() ? ("-" + this.GetErrorText()) : "";
14030   this.UpdateStateObjectWithObject({ validationState: validationState });
14031  }
14032 },
14033 UpdateValidationSummaries: function(validationType, initializing) {
14034  if(ASPx.Ident.scripts.ASPxClientValidationSummary) {
14035   var summaryCollection = ASPx.GetClientValidationSummaryCollection();
14036   summaryCollection.OnEditorIsValidStateChanged(this, validationType, initializing && this.notifyValidationSummariesToAcceptNewError);
14037  }
14038 },
14039 FindInputElement: function(){
14040  return null;
14041 },
14042 GetInputElement: function(){
14043  if(!ASPx.IsExistsElement(this.inputElement))
14044   this.inputElement = this.FindInputElement();
14045  return this.inputElement;
14046 },
14047 GetFocusableInputElement: function() {
14048  return this.GetInputElement();
14049 },
14050 GetAccessibilityActiveElements: function() {
14051  return [this.GetInputElement()];
14052 },
14053 GetAccessibilityFirstActiveElement: function() {
14054  return this.accessibilityHelper ? 
14055    this.accessibilityHelper.getMainElement() : 
14056    this.GetAccessibilityActiveElements()[0];
14057 },
14058 GetAccessibilityAdditionalTextRowId: function() {
14059  return this.name + EditElementSuffix.AccessibilityAdditionalTextRow;
14060 },
14061 UpdateAccessibilityAdditionalTextRelation: function() {
14062  var additionalTextElement = this.GetAccessibilityAdditionalTextElement();
14063  if(ASPx.IsExists(additionalTextElement)) {
14064   var pronounceElement = this.GetAccessibilityFirstActiveElement();
14065   var hasAnyLabel = !!ASPx.Attr.GetAttribute(pronounceElement, "aria-label") || 
14066    !!ASPx.Attr.GetAttribute(pronounceElement, "aria-labelledby") ||
14067    ASPx.FindAssociatedLabelElements(this).length > 0;
14068   this.SetOrRemoveAccessibilityAdditionalText([pronounceElement], additionalTextElement, true, !hasAnyLabel, false);
14069  }
14070 },
14071 GetAccessibilityAdditionalTextElement: function() {
14072  var mainElement = this.GetMainElement();
14073  if(!this.accessibilityCompliant || !mainElement) return null;
14074  var additionalText = "";
14075  var additionalTextElement = null;
14076  if(!!this.nullText)
14077   additionalText = this.nullText;
14078  else if(!!this.helpTextObj)
14079   additionalTextElement = this.helpTextObj.helpTextElement;
14080  else if(!!mainElement.title)
14081   additionalText = mainElement.title;
14082  if(!!additionalText && mainElement.tagName == "TABLE") {
14083   additionalTextElement = ASPx.GetElementById(this.GetAccessibilityAdditionalTextRowId());
14084   if(!additionalTextElement)
14085    additionalTextElement = this.CreateAccessibilityAdditionalTextRow();
14086   ASPx.SetInnerHtml(additionalTextElement.cells[0], additionalText);
14087  }
14088  return additionalTextElement;
14089 },
14090 CreateAccessibilityAdditionalTextRow: function() {
14091  var textRow = this.GetMainElement().insertRow(-1);
14092  textRow.insertCell();
14093  textRow.id = this.GetAccessibilityAdditionalTextRowId();
14094  ASPx.AddClassNameToElement(textRow, AccessibilityInvisibleRowCssClassName);
14095  return textRow;
14096 },
14097 GetErrorImage: function() {
14098  return this.GetCachedElementById(EditElementSuffix.ErrorImage);
14099 },
14100 GetControlCell: function() {
14101  return this.GetCachedElementById(EditElementSuffix.ControlCell);
14102 },
14103 GetErrorCell: function() {
14104  return this.GetCachedElementById(EditElementSuffix.ErrorCell);
14105 },
14106 GetErrorTextCell: function() {
14107  return this.GetCachedElementById(this.errorImageIsAssigned ? EditElementSuffix.ErrorTextCell : EditElementSuffix.ErrorCell);
14108 },
14109 GetAccessibilityErrorTextElement: function () {
14110  return !!this.GetErrorTextCell() ? this.GetErrorTextCell() : this.GetErrorImage();
14111 },
14112 SetAccessibilityCaptionAssociating: function() {
14113  var captionCell = this.GetCaptionCell();
14114  if(!this.accessibilityCompliant || !captionCell || captionCell.childNodes[0].tagName == "LABEL") return;
14115  var labelElement = captionCell.childNodes[0];
14116  ASPx.SetAccessibilityLabelAssociating(this, this.GetAccessibilityFirstActiveElement(), labelElement);
14117 },
14118 SetOrRemoveAccessibilityAdditionalText: function(accessibilityElements, textElement, setText, isLabel, isFirst) {
14119  var idsRefAttribute = isLabel ? "aria-labelledby" : "aria-describedby";
14120  if(!this.accessibilityCompliant || !textElement) return;
14121  var textId = !!textElement.id ? textElement.id : textElement.parentNode.id;
14122  for(var i = 0; i < accessibilityElements.length; i++) {
14123   if(!accessibilityElements[i]) continue;
14124   var descRefString = ASPx.Attr.GetAttribute(accessibilityElements[i], idsRefAttribute);
14125   var descRefIds = !!descRefString ? descRefString.split(" ") : [ ];
14126   var descIndex = descRefIds.indexOf(textId);
14127   if(setText && descIndex == -1)
14128    isFirst ? descRefIds.unshift(textId) : descRefIds.push(textId);
14129   else if(!setText && descIndex > -1)
14130    descRefIds.splice(descIndex, 1);
14131   ASPx.Attr.SetOrRemoveAttribute(accessibilityElements[i], idsRefAttribute, descRefIds.join(" "));
14132  }
14133 },
14134 SetVisible: function (isVisible) {
14135  if(this.clientVisible == isVisible)
14136   return;
14137  var externalTable = this.GetExternalTable();
14138  if(externalTable) {
14139   ASPx.SetElementDisplay(externalTable, isVisible);
14140   if(this.customValidationEnabled) {
14141    var isValid = !isVisible ? true : void (0);
14142    this.UpdateErrorFrameAndFocus(false , true , isValid );
14143   }
14144  }
14145  ASPxClientControl.prototype.SetVisible.call(this, isVisible);
14146 },
14147 GetStateHiddenFieldName: function() {
14148  return this.uniqueID + "$State";
14149 },
14150 GetValueInputToValidate: function() {
14151  return this.GetInputElement();
14152 },
14153 IsVisible: function() {
14154  if(!this.clientVisible)
14155   return false;
14156  var element = this.GetMainElement();
14157  if(!element) 
14158   return false;
14159  while(element && element.tagName != "BODY") {
14160   if(element.getAttribute("errorFrame") != "errorFrame" && (!ASPx.GetElementVisibility(element) || !ASPx.GetElementDisplay(element)))
14161    return false;
14162   element = element.parentNode;
14163  }
14164  return true;
14165 },
14166 AdjustControlCore: function() {
14167  this.CollapseEditor();
14168  this.UnstretchInputElement();
14169  if(this.heightCorrectionRequired)
14170   this.CorrectEditorHeight();
14171 },
14172 CorrectEditorHeight: function() {
14173 },
14174 UnstretchInputElement: function() {
14175 },
14176 UseDelayedSpecialFocus: function() {
14177  return false;
14178 },
14179 GetDelayedSpecialFocusTriggers: function() {
14180  return [ this.GetMainElement() ];
14181 },
14182 InitializeDelayedSpecialFocus: function() {
14183  if(!this.UseDelayedSpecialFocus())
14184   return;
14185  this.specialFocusTimer = -1;    
14186  var handler = function(evt) { this.OnDelayedSpecialFocusMouseDown(evt); }.aspxBind(this);
14187  var triggers = this.GetDelayedSpecialFocusTriggers();
14188  for(var i = 0; i < triggers.length; i++)
14189   ASPx.Evt.AttachEventToElement(triggers[i], "mousedown", handler);
14190 },
14191 OnDelayedSpecialFocusMouseDown: function(evt) {
14192  window.setTimeout(function() { this.SetFocus(); }.aspxBind(this), 0);
14193 },
14194 IsFocusEventsLocked: function() {
14195  return this.focusEventsLocked;
14196 },
14197 LockFocusEvents: function() {
14198  if(!this.focused) return;
14199  this.focusEventsLocked = true;
14200 },
14201 UnlockFocusEvents: function() {
14202  this.focusEventsLocked = false;
14203 },
14204 ForceRefocusEditor: function(evt, isNativeFocus) {
14205  if(ASPx.Browser.VirtualKeyboardSupported) {
14206   var focusedEditor = ASPx.VirtualKeyboardUI.getFocusedEditor();
14207   if(ASPx.VirtualKeyboardUI.getInputNativeFocusLocked() && (!focusedEditor || focusedEditor === this))
14208     return;
14209   ASPx.VirtualKeyboardUI.setInputNativeFocusLocked(!isNativeFocus);
14210  }
14211  this.LockFocusEvents();
14212  this.BlurInputElement();
14213  window.setTimeout(function() { 
14214   if(ASPx.Browser.VirtualKeyboardSupported) {
14215    ASPx.VirtualKeyboardUI.setFocusEditorCore(this);
14216   } else {
14217    this.SetFocus();
14218   }
14219  }.aspxBind(this), 0);
14220 },
14221 BlurInputElement: function() {
14222  var inputElement = this.GetFocusableInputElement();
14223  if(inputElement && inputElement.blur)
14224   inputElement.blur();
14225 },
14226 IsEditorElement: function(element) {
14227  return this.GetMainElement() == element || ASPx.GetIsParent(this.GetMainElement(), element);
14228 },
14229 IsClearButtonElement: function(element) {
14230  return false;
14231 },
14232 IsElementBelongToInputElement: function(element) {
14233  return this.GetInputElement() == element;
14234 },
14235 OnFocusCore: function() {
14236  if(this.UseDelayedSpecialFocus())
14237   window.clearTimeout(this.specialFocusTimer);
14238  if(!this.IsFocusEventsLocked()){
14239   this.focused = true;
14240   ASPx.SetFocusedEditor(this);
14241   if(this.styleDecoration)
14242    this.styleDecoration.Update();
14243   if(this.isInitialized)
14244    this.RaiseFocus();
14245  }
14246  else
14247   this.UnlockFocusEvents();
14248 },
14249 OnLostFocusCore: function() {
14250  if(!this.IsFocusEventsLocked()){
14251   this.focused = false;
14252   if(ASPx.GetFocusedEditor() === this)
14253    ASPx.SetFocusedEditor(null);
14254   if(this.styleDecoration)
14255    this.styleDecoration.Update();
14256   this.RaiseLostFocus();
14257  }
14258 },
14259 OnFocus: function() {
14260  if(!this.specialKeyboardHandlingUsed)
14261   this.OnFocusCore();
14262 },
14263 OnLostFocus: function() {
14264  if(this.isInitialized && !this.specialKeyboardHandlingUsed)
14265   this.OnLostFocusCore();
14266 },
14267 OnSpecialFocus: function() {
14268  if(this.isInitialized)
14269   this.OnFocusCore();
14270 },
14271 OnSpecialLostFocus: function() {
14272  if(this.isInitialized)
14273   this.OnLostFocusCore();
14274 },
14275 OnMouseWheel: function(evt){
14276 },
14277 OnValidation: function(validationType) {
14278  if(this.customValidationEnabled && this.isInitialized && ASPx.IsExistsElement(this.GetMainElement()) &&
14279   (!this.IsErrorFrameDisplayed() || this.GetExternalTable())) {
14280   this.BeginErrorFrameUpdate();
14281   try {
14282    if(this.validateOnLeave || validationType != ValidationType.PersonalOnValueChanged) {
14283     this.SetIsValid(true, true );
14284     this.SetErrorText(this.initialErrorText, true );
14285     this.ValidateWithPatterns();
14286     this.RaiseValidation();
14287    }
14288    this.UpdateErrorFrameAndFocus(this.editorFocusingRequired(validationType));
14289   } finally {
14290    this.EndErrorFrameUpdate();
14291   }
14292   this.UpdateValidationSummaries(validationType);
14293   this.UpdateValidationAccessibilityAttributes(validationType);
14294  }
14295 },
14296 UpdateValidationAccessibilityAttributes: function(validationType) {
14297  if(!this.accessibilityCompliant || (validationType == ValidationType.PersonalOnValueChanged && this.accessibilityHelper)) return;
14298  var accessibilityElements = this.GetAccessibilityActiveElements();
14299  var errorTextElement = this.GetAccessibilityErrorTextElement();
14300  this.SetOrRemoveAccessibilityAdditionalText(accessibilityElements, errorTextElement, !this.isValid, false, true);
14301  if(accessibilityElements.length > 0 && !!errorTextElement) {
14302   for(var i = 0; i < accessibilityElements.length; i++) {
14303    if(!ASPx.IsExists(accessibilityElements[i])) continue;
14304    ASPx.Attr.SetOrRemoveAttribute(accessibilityElements[i], "aria-invalid", !this.isValid);
14305   }
14306  }
14307 },
14308 editorFocusingRequired: function(validationType) {
14309  return !this.GetIsValid() && ((validationType == ValidationType.PersonalOnValueChanged && this.validateOnLeave) ||
14310         (validationType == ValidationType.PersonalViaScript && this.setFocusOnError));
14311 },
14312 OnValueChanged: function() {
14313  var processOnServer = this.RaiseValidationInternal();
14314  processOnServer = this.RaiseValueChangedEvent() && processOnServer;
14315  if(processOnServer)
14316   this.SendPostBackInternal("");
14317 },
14318 ParseValue: function() {
14319 },
14320 RaisePersonalStandardValidation: function() {
14321  if(ASPx.IsFunction(window.ValidatorOnChange)) {
14322   var inputElement = this.GetValueInputToValidate();
14323   if(inputElement && inputElement.Validators)
14324    window.ValidatorOnChange({ srcElement: inputElement });
14325  }
14326 },
14327 RaiseValidationInternal: function() {
14328  if(this.isPostBackAllowed() && this.causesValidation && this.validateOnLeave)
14329   return ASPxClientEdit.ValidateGroup(this.validationGroup);
14330  else {
14331   this.OnValidation(ValidationType.PersonalOnValueChanged);
14332   return this.GetIsValid();
14333  }
14334 },
14335 RaiseValueChangedEvent: function(){
14336  return this.RaiseValueChanged();
14337 },
14338 SendPostBackInternal: function(postBackArg) {
14339  if(ASPx.IsFunction(this.sendPostBackWithValidation))
14340   this.sendPostBackWithValidation(postBackArg);
14341  else
14342   this.SendPostBack(postBackArg);
14343 },
14344 SetElementToBeFocused: function() {
14345  if(this.IsVisible())
14346   invalidEditorToBeFocused = this;
14347 },
14348 GetFocusSelectAction: function() {
14349  return null;
14350 },
14351 SetFocus: function() {
14352  var inputElement = this.GetFocusableInputElement();
14353  if(!inputElement) return; 
14354  var isIE9 = ASPx.Browser.IE && ASPx.Browser.Version >= 9;
14355  if((ASPx.GetActiveElement() != inputElement || isIE9) && _aspxIsEditorFocusable(inputElement))
14356   ASPx.SetFocus(inputElement, this.GetFocusSelectAction());
14357 },
14358 SetFocusOnError: function() {
14359  if(invalidEditorToBeFocused == this) {
14360   this.SetFocus();
14361   invalidEditorToBeFocused = null;
14362  }
14363 },
14364 BeginErrorFrameUpdate: function() {
14365  if(!this.errorFrameUpdateLocked)
14366   this.errorFrameUpdateLocked = true;
14367 },
14368 EndErrorFrameUpdate: function() {
14369  this.errorFrameUpdateLocked = false;
14370  var args = this.updateErrorFrameAndFocusLastCallArgs;
14371  if(args) {
14372   this.UpdateErrorFrameAndFocus(args[0], args[1]);
14373   delete this.updateErrorFrameAndFocusLastCallArgs;
14374  }
14375 },
14376 UpdateErrorFrameAndFocus: function(setFocusOnError, ignoreVisibilityCheck, isValid) {
14377  if(!this.GetEnabled() || !ignoreVisibilityCheck && !this.GetVisible())
14378   return;
14379  if(this.errorFrameUpdateLocked) {
14380   this.updateErrorFrameAndFocusLastCallArgs = [ setFocusOnError, ignoreVisibilityCheck ];
14381   return;
14382  }
14383  if(this.styleDecoration)
14384   this.styleDecoration.Update();
14385  if(typeof(isValid) == "undefined")
14386   isValid = this.GetIsValid();
14387  var externalTable = this.GetExternalTable();
14388  var isStaticDisplay = this.display == ErrorFrameDisplay.Static;
14389  if(isValid && this.IsErrorFrameDisplayed()) {
14390   if(isStaticDisplay) {
14391    this.HideErrorCell(true);
14392    ASPx.AddClassNameToElement(externalTable, ASPxEditExternalTableClassNames.ValidStaticTableClassName);
14393   } else {
14394    this.HideErrorCell();
14395    this.SaveControlCellStyles();
14396    this.ClearControlCellStyles();
14397    ASPx.AddClassNameToElement(externalTable, ASPxEditExternalTableClassNames.ValidDynamicTableClassName);
14398   }
14399  } else {
14400   var editorLocatedWithinVisibleContainer = this.IsVisible();
14401   if(this.IsErrorFrameDisplayed()) {
14402    this.UpdateErrorCellContent();
14403    if(isStaticDisplay) {
14404     this.ShowErrorCell(true);
14405     ASPx.RemoveClassNameFromElement(externalTable, ASPxEditExternalTableClassNames.ValidStaticTableClassName);
14406    } else {
14407     this.EnsureControlCellStylesLoaded();
14408     this.RestoreControlCellStyles();
14409     this.ShowErrorCell();
14410     ASPx.RemoveClassNameFromElement(externalTable, ASPxEditExternalTableClassNames.ValidDynamicTableClassName);
14411    }
14412   }
14413   if(editorLocatedWithinVisibleContainer) {
14414    if(setFocusOnError && this.setFocusOnError && invalidEditorToBeFocused == null) {
14415     this.SetElementToBeFocused();
14416     this.SetFocusOnError();
14417    }
14418   }
14419  }
14420 },
14421 ShowErrorCell: function (useVisibilityAttribute) {
14422  var errorCell = this.GetErrorCell();
14423  if(errorCell) {
14424   if(useVisibilityAttribute)
14425    ASPx.SetElementVisibility(errorCell, true);
14426   else
14427    ASPx.SetElementDisplay(errorCell, true);
14428  }
14429 },
14430 HideErrorCell: function(useVisibilityAttribute) {
14431  var errorCell = this.GetErrorCell();
14432  if(errorCell) {
14433   if(useVisibilityAttribute)
14434    ASPx.SetElementVisibility(errorCell, false);
14435   else
14436    ASPx.SetElementDisplay(errorCell, false);
14437  }
14438 },
14439 SaveControlCellStyles: function() {
14440  this.EnsureControlCellStylesLoaded();
14441 },
14442 EnsureControlCellStylesLoaded: function() {
14443  if(typeof(this.controlCellStyles) == "undefined") {
14444   var controlCell = this.GetControlCell();
14445   this.controlCellStyles = {
14446    cssClass: controlCell.className,
14447    style: this.ExtractElementStyleStringIgnoringVisibilityProps(controlCell)
14448   };
14449  }
14450 },
14451 ClearControlCellStyles: function() {
14452  this.ClearElementStyle(this.GetControlCell());
14453 },
14454 RestoreControlCellStyles: function() {
14455  var controlCell = this.GetControlCell();
14456  var externalTable = this.GetExternalTable();
14457  if(ASPx.Browser.WebKitFamily)
14458   this.MakeBorderSeparateForTable(externalTable);
14459  controlCell.className = this.controlCellStyles.cssClass;
14460  controlCell.style.cssText = this.controlCellStyles.style;
14461  if(ASPx.Browser.WebKitFamily)
14462   this.UndoBorderSeparateForTable(externalTable);
14463 },
14464 MakeBorderSeparateForTable: function(table) {
14465  ASPx.AddClassNameToElement(table, ASPxEditExternalTableClassNames.TableWithSeparateBordersClassName);
14466 },
14467 UndoBorderSeparateForTable: function(table) {
14468  setTimeout(function () {
14469   ASPx.RemoveClassNameFromElement(table, ASPxEditExternalTableClassNames.TableWithSeparateBordersClassName);
14470  }, 0);
14471 },
14472 ExtractElementStyleStringIgnoringVisibilityProps: function(element) {
14473  var savedVisibility = element.style.visibility;
14474  var savedDisplay = element.style.display;
14475  element.style.visibility = "";
14476  element.style.display = "";
14477  var styleStr = element.style.cssText;
14478  element.style.visibility = savedVisibility;
14479  element.style.display = savedDisplay;
14480  return styleStr;
14481 },
14482 ClearElementStyle: function(element) {
14483  if(!element)
14484   return;
14485  element.className = "";
14486  var excludedAttrNames = [
14487   "width", "display", "visibility",
14488   "position", "left", "top", "z-index",
14489   "margin", "margin-top", "margin-right", "margin-bottom", "margin-left",
14490   "float", "clear"
14491  ];
14492  var savedAttrValues = { };
14493  for(var i = 0; i < excludedAttrNames.length; i++) {
14494   var attrName = excludedAttrNames[i];
14495   var attrValue = element.style[attrName];
14496   if(attrValue)
14497    savedAttrValues[attrName] = attrValue;
14498  }
14499  element.style.cssText = "";
14500  for(var styleAttrName in savedAttrValues)
14501   element.style[styleAttrName] = savedAttrValues[styleAttrName];
14502 },
14503 Clear: function() {
14504  this.SetValue(null);
14505  this.SetIsValid(true);
14506  return true;
14507 },
14508 UpdateErrorCellContent: function() {
14509  if(this.errorDisplayMode.indexOf("t") > -1)
14510   this.UpdateErrorText();
14511  if(this.errorDisplayMode == "i")
14512   this.UpdateErrorImage();
14513 },
14514 UpdateErrorImage: function() {
14515  var image = this.GetErrorImage();
14516  if(ASPx.IsExistsElement(image)) {
14517   if(this.accessibilityCompliant) {
14518    ASPx.Attr.SetAttribute(image, "aria-label", this.errorText);
14519    var innerImg = ASPx.GetNodeByTagName(image, "IMG", 0);
14520    if(ASPx.IsExists(innerImg))
14521     innerImg.alt = this.errorText;
14522   }
14523   image.alt = this.errorText;
14524   image.title = this.errorText;
14525  } else {
14526   this.UpdateErrorText();
14527  }
14528 },
14529 UpdateErrorText: function() {
14530  var errorTextCell = this.GetErrorTextCell();
14531  if(ASPx.IsExistsElement(errorTextCell))
14532   errorTextCell.innerHTML = this.HtmlEncode(this.errorText);
14533 },
14534 ValidateWithPatterns: function() {
14535  if(this.validationPatterns.length > 0) {
14536   var value = this.GetValue();
14537   for(var i = 0; i < this.validationPatterns.length; i++) {
14538    var validator = this.validationPatterns[i];
14539    if(!validator.EvaluateIsValid(value)) {
14540     this.SetIsValid(false, true );
14541     this.SetErrorText(validator.errorText, true );
14542     return;
14543    }
14544   }
14545  }
14546 },
14547 OnSpecialKeyDown: function(evt){
14548  this.RaiseKeyDown(evt);
14549  var handler = this.keyDownHandlers[evt.keyCode];
14550  if(handler) 
14551   return this[handler](evt);
14552  return false;
14553 },
14554 OnSpecialKeyPress: function(evt){
14555  this.RaiseKeyPress(evt);
14556  var handler = this.keyPressHandlers[evt.keyCode];
14557  if(handler) 
14558   return this[handler](evt);
14559  if(ASPx.Browser.NetscapeFamily || ASPx.Browser.Opera){
14560   if(evt.keyCode == ASPx.Key.Enter)
14561    return this.enterProcessed;
14562  }
14563  return false;
14564 },
14565 OnSpecialKeyUp: function(evt){
14566  this.RaiseKeyUp(evt);
14567  var handler = this.keyUpHandlers[evt.keyCode];
14568  if(handler) 
14569   return this[handler](evt);
14570  return false;
14571 },
14572 OnKeyDown: function(evt) {
14573  if(!this.specialKeyboardHandlingUsed)
14574   this.RaiseKeyDown(evt);
14575 },
14576 OnKeyPress: function(evt) {
14577  if(!this.specialKeyboardHandlingUsed)
14578   this.RaiseKeyPress(evt);
14579 },
14580 OnKeyUp: function(evt) {
14581  if(!this.specialKeyboardHandlingUsed)
14582   this.RaiseKeyUp(evt);
14583 },
14584 RaiseKeyDown: function(evt){
14585  if(!this.KeyDown.IsEmpty()){
14586   var args = new ASPxClientEditKeyEventArgs(evt);
14587   this.KeyDown.FireEvent(this, args);
14588  }
14589 },
14590 RaiseKeyPress: function(evt){
14591  if(!this.KeyPress.IsEmpty()){
14592   var args = new ASPxClientEditKeyEventArgs(evt);
14593   this.KeyPress.FireEvent(this, args);
14594  }
14595 },
14596 RaiseKeyUp: function(evt){
14597  if(!this.KeyUp.IsEmpty()){
14598   var args = new ASPxClientEditKeyEventArgs(evt);
14599   this.KeyUp.FireEvent(this, args);
14600  }
14601 },
14602 RaiseFocus: function(){
14603  if(!this.GotFocus.IsEmpty()){
14604   var args = new ASPxClientEventArgs();
14605   this.GotFocus.FireEvent(this, args);
14606  }
14607 },
14608 RaiseLostFocus: function(){
14609  if(!this.LostFocus.IsEmpty()){
14610   var args = new ASPxClientEventArgs();
14611   this.LostFocus.FireEvent(this, args);
14612  }
14613 },
14614 RaiseValidation: function() {
14615  if(this.customValidationEnabled && !this.Validation.IsEmpty()) {
14616   var currentValue = this.GetValue();
14617   var args = new ASPxClientEditValidationEventArgs(currentValue, this.errorText, this.GetIsValid());
14618   this.Validation.FireEvent(this, args);
14619   this.SetErrorText(args.errorText, true );
14620   this.SetIsValid(args.isValid, true );
14621   if(args.value != currentValue)
14622    this.SetValue(args.value);
14623  }
14624 },
14625 RaiseValueChanged: function(){
14626  var processOnServer = this.isPostBackAllowed();
14627  if(!this.ValueChanged.IsEmpty()){
14628   var args = new ASPxClientProcessingModeEventArgs(processOnServer);
14629   this.ValueChanged.FireEvent(this, args);
14630   processOnServer = args.processOnServer;
14631  }
14632  return processOnServer;  
14633 },
14634 isPostBackAllowed: function() {
14635  return this.autoPostBack;
14636 },
14637 AddDecorationStyle: function(key, className, cssText) {
14638  if(!this.styleDecoration) 
14639   this.RequireStyleDecoration();
14640  this.styleDecoration.AddStyle(key, className, cssText);
14641 }, 
14642 RequireStyleDecoration: function() {
14643  this.styleDecoration = new ASPx.EditorStyleDecoration(this);
14644  this.PopulateStyleDecorationPostfixes();
14645 }, 
14646 PopulateStyleDecorationPostfixes: function() {
14647  this.styleDecoration.AddPostfix("");
14648 },
14649 LockStyleDecorationUpdate: function() {
14650  if(this.styleDecoration)
14651   this.styleDecoration.LockUpdate();
14652 },
14653 UnlockStyleDecorationUpdate: function() {
14654  if(this.styleDecoration)
14655   this.styleDecoration.UnlockUpdate();
14656 },
14657 Focus: function(){
14658  this.SetFocus();
14659 },
14660 GetIsValid: function() {
14661  var hasRequiredInputElement = !this.RequireInputElementToValidate() || ASPx.IsExistsElement(this.GetInputElement());
14662  if(!hasRequiredInputElement || this.IsErrorFrameDisplayed() && !ASPx.IsExistsElement(this.GetExternalTable()))
14663   return true;
14664  return this.isValid;
14665 },
14666 RequireInputElementToValidate: function() {
14667  return true;
14668 },
14669 IsErrorFrameDisplayed: function() {
14670  return this.display !== ErrorFrameDisplay.None;
14671 },
14672 GetErrorText: function(){
14673  return this.errorText;
14674 },
14675 SetIsValid: function(isValid, validating){
14676  if(this.customValidationEnabled && this.isValid != isValid) {
14677   this.isValid = isValid;
14678   this.UpdateErrorFrameAndFocus(false );
14679   this.UpdateClientValidationState();
14680   if(!validating)
14681    this.UpdateValidationSummaries(ValidationType.PersonalViaScript);
14682  }
14683 },
14684 SetErrorText: function(errorText, validating){
14685  if(this.customValidationEnabled && this.errorText != errorText) {
14686   this.errorText = errorText;
14687   this.UpdateErrorFrameAndFocus(false );
14688   this.UpdateClientValidationState();
14689   if(!validating)
14690    this.UpdateValidationSummaries(ValidationType.PersonalViaScript);
14691  }
14692 },
14693 Validate: function(){
14694  this.ParseValue();
14695  this.OnValidation(ValidationType.PersonalViaScript);
14696 }
14697});
14698ASPx.Ident.scripts.ASPxClientEdit = true;
14699ASPx.focusedEditorName = "";
14700ASPx.GetFocusedEditor = function() {
14701 var focusedEditor = ASPx.GetControlCollection().Get(ASPx.focusedEditorName);
14702 if(focusedEditor && !focusedEditor.focused){
14703  ASPx.SetFocusedEditor(null);
14704  focusedEditor = null;
14705 }
14706 return focusedEditor;
14707}
14708ASPx.SetFocusedEditor = function(editor) {
14709 ASPx.focusedEditorName = editor ? editor.name : "";
14710}
14711ASPx.SetAccessibilityLabelAssociating = function(editor, activeElement, labelElement) {
14712 var clickHandler = function(evt) {
14713  if(editor && editor.OnAssociatedLabelClick)
14714   editor.OnAssociatedLabelClick(evt);
14715  else
14716   activeElement.click();
14717 }.aspxBind(this);
14718 ASPx.Evt.AttachEventToElement(labelElement, "click", clickHandler);
14719 if(!!editor) {
14720  var hasAriaLabel = !!ASPx.Attr.GetAttribute(activeElement, "aria-label");
14721  editor.SetOrRemoveAccessibilityAdditionalText([activeElement], labelElement, true, !hasAriaLabel, true);
14722 }
14723}
14724ASPx.FindAssociatedLabelElements = function(editor) {
14725 var assocciatedLabels = [];
14726 var inputElement = editor.GetInputElement();
14727 if(!ASPx.IsExists(inputElement) || !inputElement.id) 
14728  return assocciatedLabels;
14729 var labels = ASPx.GetNodesByTagName(document, "LABEL");
14730 for(var i = 0; i < labels.length; i++) {
14731  if(!!labels[i].htmlFor && labels[i].htmlFor === inputElement.id)
14732   assocciatedLabels.push(labels[i]);
14733 }
14734 return assocciatedLabels;
14735}
14736ASPxClientEdit.ClearEditorsInContainer = function(container, validationGroup, clearInvisibleEditors) {
14737 invalidEditorToBeFocused = null;
14738 ASPx.ProcessEditorsInContainer(container, ASPx.ClearProcessingProc, ASPx.ClearChoiceCondition, validationGroup, clearInvisibleEditors, true );
14739 ASPxClientEdit.ClearExternalControlsInContainer(container, validationGroup, clearInvisibleEditors);
14740}
14741ASPxClientEdit.ClearEditorsInContainerById = function(containerId, validationGroup, clearInvisibleEditors) {
14742 var container = document.getElementById(containerId);
14743 this.ClearEditorsInContainer(container, validationGroup, clearInvisibleEditors);
14744}
14745ASPxClientEdit.ClearGroup = function(validationGroup, clearInvisibleEditors) {
14746 return this.ClearEditorsInContainer(null, validationGroup, clearInvisibleEditors);
14747}
14748ASPxClientEdit.ValidateEditorsInContainer = function(container, validationGroup, validateInvisibleEditors) {
14749 var summaryCollection;
14750 if(ASPx.Ident.scripts.ASPxClientValidationSummary) {
14751  summaryCollection = ASPx.GetClientValidationSummaryCollection();
14752  summaryCollection.AllowNewErrorsAccepting(validationGroup);
14753 }
14754 var validationResult = ASPx.ProcessEditorsInContainer(container, ASPx.ValidateProcessingProc, _aspxValidateChoiceCondition, validationGroup, validateInvisibleEditors,
14755  false );
14756 validationResult.isValid = ASPxClientEdit.ValidateExternalControlsInContainer(container, validationGroup, validateInvisibleEditors) && validationResult.isValid;
14757 if(typeof(validateInvisibleEditors) == "undefined")
14758  validateInvisibleEditors = false;
14759 if(typeof(validationGroup) == "undefined")
14760  validationGroup = null;    
14761 ASPx.GetControlCollection().RaiseValidationCompleted(container, validationGroup,
14762 validateInvisibleEditors, validationResult.isValid, validationResult.firstInvalid, validationResult.firstVisibleInvalid);
14763 if(summaryCollection)
14764  summaryCollection.ForbidNewErrorsAccepting(validationGroup);
14765 if(!validationResult.isValid && !!validationResult.firstVisibleInvalid && validationResult.firstVisibleInvalid.accessibilityCompliant && !validationResult.firstVisibleInvalid.setFocusOnError) {
14766  var accessInvalidControl = validationResult.firstVisibleInvalid;
14767  if(!summaryCollection && !accessInvalidControl.focused) {
14768   var beforeDelayActiveElement = ASPx.GetActiveElement();
14769   setTimeout(function() {
14770    var currentActiveElement = ASPx.GetActiveElement();
14771    if(accessInvalidControl.focused || (currentActiveElement != beforeDelayActiveElement && ASPx.Attr.IsExistsAttribute(currentActiveElement, 'role')))
14772     return;
14773    var errorTextElement = accessInvalidControl.GetAccessibilityErrorTextElement();
14774    ASPx.SetElementDisplay(errorTextElement, false);
14775    ASPx.Attr.SetAttribute(errorTextElement, 'role', 'alert');
14776    ASPx.SetElementDisplay(errorTextElement, true);
14777    setTimeout(function() { ASPx.Attr.RemoveAttribute(errorTextElement, 'role'); }, 500);
14778   }, 500);    
14779  }
14780 }
14781 return validationResult.isValid;
14782}
14783ASPxClientEdit.ValidateEditorsInContainerById = function(containerId, validationGroup, validateInvisibleEditors) {
14784 var container = document.getElementById(containerId);
14785 return this.ValidateEditorsInContainer(container, validationGroup, validateInvisibleEditors);
14786}
14787ASPxClientEdit.ValidateGroup = function(validationGroup, validateInvisibleEditors) {
14788 return this.ValidateEditorsInContainer(null, validationGroup, validateInvisibleEditors);
14789}
14790ASPxClientEdit.AreEditorsValid = function(containerOrContainerId, validationGroup, checkInvisibleEditors) {
14791 var container = typeof(containerOrContainerId) == "string" ? document.getElementById(containerOrContainerId) : containerOrContainerId;
14792 var checkResult = ASPx.ProcessEditorsInContainer(container, ASPx.EditorsValidProcessingProc, _aspxEditorsValidChoiceCondition, validationGroup,
14793  checkInvisibleEditors, false );
14794 checkResult.isValid = ASPxClientEdit.AreExternalControlsValidInContainer(containerOrContainerId, validationGroup, checkInvisibleEditors) && checkResult.isValid;
14795 return checkResult.isValid;
14796}
14797ASPxClientEdit.AreExternalControlsValidInContainer = function(containerId, validationGroup, validateInvisibleEditors) {
14798 if(ASPx.Ident.scripts.ASPxClientHtmlEditor)
14799  return ASPxClientHtmlEditor.AreEditorsValidInContainer(containerId, validationGroup, validateInvisibleEditors);
14800 return true;
14801}
14802ASPxClientEdit.ClearExternalControlsInContainer = function(containerId, validationGroup, validateInvisibleEditors) {
14803 if(ASPx.Ident.scripts.ASPxClientHtmlEditor)
14804  return ASPxClientHtmlEditor.ClearEditorsInContainer(containerId, validationGroup, validateInvisibleEditors);
14805 return true;
14806}
14807ASPxClientEdit.ValidateExternalControlsInContainer = function(containerId, validationGroup, validateInvisibleEditors) {
14808 if(ASPx.Ident.scripts.ASPxClientHtmlEditor)
14809  return ASPxClientHtmlEditor.ValidateEditorsInContainer(containerId, validationGroup, validateInvisibleEditors);
14810 return true;
14811}
14812var ASPxClientEditKeyEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
14813 constructor: function(htmlEvent) {
14814  this.constructor.prototype.constructor.call(this);
14815  this.htmlEvent = htmlEvent;
14816 }
14817});
14818var ASPxClientEditValidationEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
14819 constructor: function(value, errorText, isValid) {
14820  this.constructor.prototype.constructor.call(this);
14821  this.errorText = errorText;
14822  this.isValid = isValid;
14823  this.value = value;
14824 }
14825});
14826ASPx.ProcessEditorsInContainer = function(container, processingProc, choiceCondition, validationGroup, processInvisibleEditors, processDisabledEditors) {
14827 var allProcessedSuccessfull = true;
14828 var firstInvalid = null;
14829 var firstVisibleInvalid = null;
14830 var invalidEditorToBeFocused = null;
14831 ASPx.GetControlCollection().ForEachControl(function(control) {
14832  var needToProcessRatingControl = window.ASPxClientRatingControl && (control instanceof ASPxClientRatingControl) && processingProc === ASPx.ClearProcessingProc;
14833  if(!ASPx.Ident.isDialogInvisibleControl(control) && (ASPx.Ident.IsASPxClientEdit(control) || needToProcessRatingControl) && (processDisabledEditors || control.GetEnabled())) {
14834   var mainElement = control.GetMainElement();
14835   if(mainElement &&
14836    (container == null || ASPx.GetIsParent(container, mainElement)) &&
14837    (processInvisibleEditors || control.IsVisible()) &&
14838    (!choiceCondition || choiceCondition(control, validationGroup))) {
14839    var isSuccess = processingProc(control);
14840    if(!isSuccess) {
14841     allProcessedSuccessfull = false;
14842     if(firstInvalid == null)
14843      firstInvalid = control;
14844     var isVisible = control.IsVisible();
14845     if(isVisible && firstVisibleInvalid == null)
14846      firstVisibleInvalid = control;
14847     if(control.setFocusOnError && invalidEditorToBeFocused == null && isVisible)
14848      invalidEditorToBeFocused = control;
14849    }
14850   }
14851  }
14852 }, this);
14853 if(invalidEditorToBeFocused != null)
14854  invalidEditorToBeFocused.SetFocus();
14855 return new ASPxValidationResult(allProcessedSuccessfull, firstInvalid, firstVisibleInvalid);
14856}
14857var ASPxValidationResult = ASPx.CreateClass(null, {
14858 constructor: function(isValid, firstInvalid, firstVisibleInvalid) {
14859  this.isValid = isValid;
14860  this.firstInvalid = firstInvalid;
14861  this.firstVisibleInvalid = firstVisibleInvalid;
14862 }
14863});
14864ASPx.ClearChoiceCondition = function(edit, validationGroup) {
14865 return !ASPx.IsExists(validationGroup) || (edit.validationGroup == validationGroup);
14866}
14867function _aspxValidateChoiceCondition(edit, validationGroup) {
14868 return ASPx.ClearChoiceCondition(edit, validationGroup) && edit.customValidationEnabled;
14869}
14870function _aspxEditorsValidChoiceCondition(edit, validationGroup) {
14871 return _aspxValidateChoiceCondition(edit, validationGroup);
14872}
14873function wrapLostFocusHandler(handler) {
14874 if(ASPx.Browser.Edge) {
14875  return function(name) {
14876   var edit = ASPx.GetControlCollection().Get(name);
14877   if(edit && !ASPx.IsElementVisible(edit.GetMainElement()))
14878    setTimeout(handler, 0, name);
14879   else
14880    handler(name);
14881  };
14882 }
14883 return handler;
14884};
14885ASPx.EGotFocus = function(name) {
14886 var edit = ASPx.GetControlCollection().Get(name); 
14887 if(!edit) return;
14888 if(!edit.isInitialized){
14889  var inputElement = edit.GetFocusableInputElement();
14890  if(inputElement && inputElement === document.activeElement)
14891   ASPx.Browser.Firefox ? window.setTimeout(function() { document.activeElement.blur(); }, 0) : document.activeElement.blur();
14892  return;
14893 }
14894  if(ASPx.Browser.VirtualKeyboardSupported) {
14895  ASPx.VirtualKeyboardUI.onCallingVirtualKeyboard(edit, false);
14896 } else {
14897  edit.OnFocus();
14898 }
14899}
14900ASPx.ELostFocusCore = function(name) {
14901 if(ASPx.Browser.VirtualKeyboardSupported) {
14902  var supressLostFocus = ASPx.VirtualKeyboardUI.isInputNativeBluring();
14903  if(supressLostFocus)
14904   return;
14905  ASPx.VirtualKeyboardUI.resetFocusedEditor();
14906 }
14907 var edit = ASPx.GetControlCollection().Get(name);
14908 if(edit != null) 
14909  edit.OnLostFocus();
14910}
14911ASPx.ELostFocus = wrapLostFocusHandler(ASPx.ELostFocusCore);
14912ASPx.ESGotFocus = function(name) {
14913 var edit = ASPx.GetControlCollection().Get(name); 
14914 if(!edit) return;
14915   if(ASPx.Browser.VirtualKeyboardSupported) {
14916  ASPx.VirtualKeyboardUI.onCallingVirtualKeyboard(edit, true);
14917 } else {
14918  edit.OnSpecialFocus();
14919 }
14920}
14921ASPx.ESLostFocusCore = function(name) {
14922 if(ASPx.Browser.VirtualKeyboardSupported) {
14923  var supressLostFocus = ASPx.VirtualKeyboardUI.isInputNativeBluring();
14924  if(supressLostFocus)
14925   return;
14926  ASPx.VirtualKeyboardUI.resetFocusedEditor();
14927 }
14928 var edit = ASPx.GetControlCollection().Get(name);
14929 if(!edit) return;
14930 if(edit.UseDelayedSpecialFocus())
14931  edit.specialFocusTimer = window.setTimeout(function() { edit.OnSpecialLostFocus(); }, 30);
14932 else
14933  edit.OnSpecialLostFocus();
14934}
14935ASPx.ESLostFocus = wrapLostFocusHandler(ASPx.ESLostFocusCore);
14936ASPx.EValueChanged = function(name) {
14937 var edit = ASPx.GetControlCollection().Get(name);
14938 if(edit != null)
14939  edit.OnValueChanged();
14940}
14941ASPx.VirtualKeyboardUI = (function() {
14942 var focusedEditor = null;
14943 var inputNativeFocusLocked = false;
14944 function elementBelongsToEditor(element) {
14945  if(!element) return false;
14946  var isBelongsToEditor = false;
14947  ASPx.GetControlCollection().ForEachControl(function(control) {
14948   if(ASPx.Ident.IsASPxClientEdit(control) && control.IsEditorElement(element)) {
14949    isBelongsToEditor = true;
14950    return true;
14951   }
14952  }, this);
14953  return isBelongsToEditor;
14954 }
14955 function elementBelongsToFocusedEditor(element) {
14956  return focusedEditor && focusedEditor.IsEditorElement(element);
14957 }
14958 return {
14959  onTouchStart: function (evt) {
14960   if (!ASPx.Browser.VirtualKeyboardSupported) return;
14961   inputNativeFocusLocked = false;
14962   if(ASPx.TouchUIHelper.pointerEnabled) {
14963    if(evt.pointerType != ASPx.TouchUIHelper.pointerType.Touch)
14964     return;
14965    this.processFocusEditorControl(evt);
14966   } else
14967    ASPx.TouchUIHelper.handleFastTapIfRequired(evt,  function(){ this.processFocusEditorControl(evt); }.aspxBind(this), false);
14968  },
14969  processFocusEditorControl: function(evt) {
14970   var evtSource = ASPx.Evt.GetEventSource(evt);
14971   var timeEditHasAppliedFocus = focusedEditor && (ASPx.Ident.IsASPxClientTimeEdit && ASPx.Ident.IsASPxClientTimeEdit(focusedEditor));
14972   var focusedTimeEditBelongsToDateEdit = timeEditHasAppliedFocus && focusedEditor.OwnerDateEdit && focusedEditor.OwnerDateEdit.GetShowTimeSection();
14973   if(focusedTimeEditBelongsToDateEdit) {
14974    focusedEditor.OwnerDateEdit.ForceRefocusTimeSectionTimeEdit(evtSource);
14975    return;
14976   }
14977   var elementWithNativeFocus = ASPx.GetActiveElement();
14978   var someEditorInputIsFocused = elementBelongsToEditor(elementWithNativeFocus);
14979   var touchKeyboardIsVisible = someEditorInputIsFocused;
14980   var tapOutsideEditorAndInputs = !elementBelongsToEditor(evtSource) && !ASPx.Ident.IsFocusableElementRegardlessTabIndex(evtSource);
14981   var blurToHideTouchKeyboard = touchKeyboardIsVisible && tapOutsideEditorAndInputs;
14982   if(blurToHideTouchKeyboard) {
14983    elementWithNativeFocus.blur();
14984    return;
14985   }
14986   var tapOutsideFocusedEditor = focusedEditor && !elementBelongsToFocusedEditor(evtSource);
14987   if(tapOutsideFocusedEditor) {
14988    var focusedEditorWithBluredInput = !elementBelongsToFocusedEditor(elementWithNativeFocus);
14989    if(focusedEditorWithBluredInput) 
14990     this.lostAppliedFocusOfEditor();
14991   }
14992  },
14993  smartFocusEditor: function(edit) {
14994   if(!edit.focused) {
14995    this.setInputNativeFocusLocked(true);
14996    this.setFocusEditorCore(edit);
14997   } else {
14998    edit.ForceRefocusEditor();
14999   }
15000  },
15001  setFocusEditorCore: function(edit) {
15002   if(ASPx.Browser.MacOSMobilePlatform) {
15003    var timeoutDuration = ASPx.Browser.Chrome ? 250 : 30;
15004    window.setTimeout(function(){ edit.SetFocus(); }, timeoutDuration);
15005   } else {
15006    edit.SetFocus();
15007   }
15008  },
15009  onCallingVirtualKeyboard: function(edit, isSpecial) {
15010   this.setAppliedFocusOfEditor(edit, isSpecial);
15011   if(edit.specialKeyboardHandlingUsed == isSpecial && inputNativeFocusLocked)
15012    edit.BlurInputElement();
15013  },
15014  isInputNativeBluring: function() {
15015   return focusedEditor && inputNativeFocusLocked;
15016  },
15017  setInputNativeFocusLocked: function(locked) {
15018   inputNativeFocusLocked = locked;
15019  },
15020  getInputNativeFocusLocked: function() {
15021   return inputNativeFocusLocked;
15022  },
15023  setAppliedFocusOfEditor: function(edit, isSpecial) {
15024   if(focusedEditor === edit) {
15025    if(edit.specialKeyboardHandlingUsed == isSpecial) {
15026     focusedEditor.UnlockFocusEvents();
15027     if(focusedEditor.EnsureClearButtonVisibility)
15028      focusedEditor.EnsureClearButtonVisibility();
15029    }
15030    return;
15031   }
15032   if(edit.specialKeyboardHandlingUsed == isSpecial) {
15033    this.lostAppliedFocusOfEditor();
15034    focusedEditor = edit;
15035    ASPx.SetFocusedEditor(edit);
15036   }
15037   if(isSpecial)
15038    edit.OnSpecialFocus();
15039   else
15040    edit.OnFocus();
15041  },
15042  lostAppliedFocusOfEditor: function() {
15043   if(!focusedEditor) return;
15044   var curEditorName = focusedEditor.name; 
15045   var skbdHandlingUsed = focusedEditor.specialKeyboardHandlingUsed;
15046   var focusedEditorInputElementExists = focusedEditor.GetInputElement();
15047   focusedEditor = null;
15048   if(!focusedEditorInputElementExists)
15049    return;
15050   ASPx.ELostFocusCore(curEditorName);
15051   if(skbdHandlingUsed)
15052    ASPx.ESLostFocusCore(curEditorName);
15053  },
15054  getFocusedEditor: function() {
15055   return focusedEditor;
15056  },
15057  resetFocusedEditor: function() {
15058   focusedEditor = null;
15059  },
15060  focusableInputElementIsActive: function(edit) {
15061   var inputElement = edit.GetFocusableInputElement();
15062   return !!inputElement ? ASPx.GetActiveElement() === inputElement : false;
15063  }
15064 }
15065})();
15066if(ASPx.Browser.VirtualKeyboardSupported) {
15067 var touchEventName = ASPx.TouchUIHelper.pointerEnabled ? ASPx.TouchUIHelper.pointerDownEventName : 'touchstart';
15068 ASPx.Evt.AttachEventToDocument(touchEventName, function(evt){ ASPx.VirtualKeyboardUI.onTouchStart(evt); });
15069}
15070ASPx.Evt.AttachEventToDocument("mousedown", function(evt) {
15071 var editor = ASPx.GetFocusedEditor();
15072 if(!editor) 
15073  return;
15074 var evtSource = ASPx.Evt.GetEventSource(evt);
15075 if(editor.IsClearButtonElement(evtSource))
15076  return;
15077 if(editor.OwnerDateEdit && editor.OwnerDateEdit.GetShowTimeSection()) {
15078  editor.OwnerDateEdit.ForceRefocusTimeSectionTimeEdit(evtSource);
15079  return;
15080 }
15081 if(editor.IsEditorElement(evtSource) && !editor.IsElementBelongToInputElement(evtSource))
15082  editor.ForceRefocusEditor(evt);
15083});
15084ASPx.Evt.AttachEventToDocument(ASPx.Evt.GetMouseWheelEventName(), function(evt) {
15085 var editor = ASPx.GetFocusedEditor();
15086 if(editor != null && ASPx.IsExistsElement(editor.GetMainElement()) && editor.focused && editor.receiveGlobalMouseWheel)
15087  editor.OnMouseWheel(evt);
15088});
15089ASPx.KBSIKeyDown = function(name, evt){
15090 var control = ASPx.GetControlCollection().Get(name);
15091 if(control != null){
15092  var isProcessed = control.OnSpecialKeyDown(evt);
15093  if(isProcessed)
15094   return ASPx.Evt.PreventEventAndBubble(evt);
15095 }
15096}
15097ASPx.KBSIKeyPress = function(name, evt){
15098 var control = ASPx.GetControlCollection().Get(name);
15099 if(control != null){
15100  var isProcessed = control.OnSpecialKeyPress(evt);
15101  if(isProcessed)
15102   return ASPx.Evt.PreventEventAndBubble(evt);
15103 }
15104}
15105ASPx.KBSIKeyUp = function(name, evt){
15106 var control = ASPx.GetControlCollection().Get(name);
15107 if(control != null){
15108  var isProcessed = control.OnSpecialKeyUp(evt);
15109  if(isProcessed)
15110   return ASPx.Evt.PreventEventAndBubble(evt);
15111 }
15112}
15113ASPx.ClearProcessingProc = function(edit) {
15114 return edit.Clear();
15115}
15116ASPx.ValidateProcessingProc = function(edit) {
15117 edit.OnValidation(ValidationType.MassValidation);
15118 return edit.GetIsValid();
15119}
15120ASPx.EditorsValidProcessingProc = function(edit) {
15121 return edit.GetIsValid();
15122}
15123var CheckEditElementHelper = ASPx.CreateClass(ASPx.CheckableElementHelper, {
15124 AttachToMainElement: function(internalCheckBox) {
15125  ASPx.CheckableElementHelper.prototype.AttachToMainElement.call(this, internalCheckBox);
15126  this.AttachToLabelElement(this.GetLabelElement(internalCheckBox.container), internalCheckBox);
15127 },
15128 AttachToLabelElement: function(labelElement, internalCheckBox) {
15129  var _this = this;
15130  if(labelElement) {
15131   ASPx.Evt.AttachEventToElement(labelElement, "click", 
15132    function (evt) { 
15133     _this.InvokeClick(internalCheckBox, evt);
15134    }
15135   );
15136   ASPx.Evt.AttachEventToElement(labelElement, "mousedown",
15137    function (evt) {
15138     internalCheckBox.Refocus();
15139    }
15140   );
15141  }
15142 },
15143 GetLabelElement: function(container) {
15144  var labelElement = ASPx.GetNodeByTagName(container, "LABEL", 0);
15145  if(!labelElement) {
15146   var labelCell = ASPx.GetNodeByClassName(container, "dxichTextCellSys", 0);
15147   labelElement = ASPx.GetNodeByTagName(labelCell, "SPAN", 0);
15148  }
15149  return labelElement;
15150 }
15151});
15152CheckEditElementHelper.Instance = new CheckEditElementHelper();
15153var CalendarSharedParameters = ASPx.CreateClass(null, {
15154 updateCalendarCallbackCommand: "UPDATE",
15155 constructor: function() {
15156  this.minDate = null;
15157  this.maxDate = null;
15158  this.disabledDates = [];
15159  this.calendarCustomDraw = false;
15160  this.hasCustomDisabledDatesViaCallback = false;
15161  this.dateRangeMode = false;
15162  this.currentDateEdit = null;
15163  this.DaysSelectingOnMouseOver = new ASPxClientEvent();
15164  this.VisibleDaysMouseOut = new ASPxClientEvent();
15165  this.CalendarSelectionChangedInternal = new ASPxClientEvent();
15166 },
15167 Assign: function(source) {
15168  this.minDate = source.minDate ? source.minDate : null;
15169  this.maxDate = source.maxDate ? source.maxDate : null;
15170  this.calendarCustomDraw = source.calendarCustomDraw ? source.calendarCustomDraw : false;
15171  this.hasCustomDisabledDatesViaCallback = source.hasCustomDisabledDatesViaCallback ? source.hasCustomDisabledDatesViaCallback : false;
15172  this.disabledDates = source.disabledDates ? source.disabledDates : [];
15173  this.currentDateEdit = source.currentDateEdit ? source.currentDateEdit : null;
15174 },
15175 GetUpdateCallbackParameters: function() {
15176  var callbackArgs = this.GetCallbackArgs();
15177  callbackArgs = this.FormatCallbackArg(this.updateCalendarCallbackCommand, callbackArgs);
15178  return callbackArgs;
15179 },
15180 GetCallbackArgs: function() {
15181  var args = {};
15182  if(this.minDate)
15183   args.clientMinDate = ASPx.DateUtils.GetInvariantDateString(this.minDate);
15184  if(this.maxDate)
15185   args.clientMaxDate = ASPx.DateUtils.GetInvariantDateString(this.maxDate);
15186  for(key in args) {
15187   var jsonArgs = JSON.stringify(args);
15188   return ASPx.Str.EncodeHtml(jsonArgs);
15189  }
15190  return null;
15191 },
15192 FormatCallbackArg: function(prefix, arg) {
15193  if(!arg) return prefix;
15194  return [prefix, '|', arg.length, ';', arg, ';'].join('');
15195 }
15196});
15197ASPx.CalendarSharedParameters = CalendarSharedParameters;
15198ASPx.ValidationType = ValidationType;
15199ASPx.ErrorFrameDisplay = ErrorFrameDisplay;
15200ASPx.EditElementSuffix = EditElementSuffix;
15201ASPx.ValidationPattern = ValidationPattern;
15202ASPx.RequiredFieldValidationPattern = RequiredFieldValidationPattern;
15203ASPx.RegularExpressionValidationPattern = RegularExpressionValidationPattern;
15204ASPx.CheckEditElementHelper = CheckEditElementHelper;
15205ASPx.IsEditorFocusable = _aspxIsEditorFocusable;
15206window.ASPxClientEditBase = ASPxClientEditBase;
15207window.ASPxClientEdit = ASPxClientEdit;
15208window.ASPxClientEditKeyEventArgs = ASPxClientEditKeyEventArgs;
15209window.ASPxClientEditValidationEventArgs = ASPxClientEditValidationEventArgs;
15210})();
15211
15212(function() {
15213ASPx.TEInputSuffix = "_I";
15214ASPx.PasteCheckInterval = 50;
15215ASPx.TEHelpTextElementSuffix = "_HTE";
15216var passwordInputClonedSuffix = "_CLND";
15217var memoMinHeight = 34;
15218var BrowserHelper = {
15219 SAFARI_SYSTEM_CLASS_NAME: "dxeSafariSys",
15220 MOBILE_SAFARI_SYSTEM_CLASS_NAME: "dxeIPadSys",
15221 GetBrowserSpecificSystemClassName: function() {
15222  if(ASPx.Browser.Safari)
15223   return ASPx.Browser.MacOSMobilePlatform ? this.MOBILE_SAFARI_SYSTEM_CLASS_NAME : this.SAFARI_SYSTEM_CLASS_NAME;
15224  return "";
15225 }
15226};
15227var ASPxClientTextEdit = ASPx.CreateClass(ASPxClientEdit, {
15228 constructor: function(name) {
15229  this.constructor.prototype.constructor.call(this, name);      
15230  this.isASPxClientTextEdit = true;
15231  this.nullText = "";
15232  this.escCount = 0;
15233  this.raiseValueChangedOnEnter = true;
15234  this.autoResizeWithContainer = false;
15235  this.lastChangedValue = null;
15236  this.autoCompleteAttribute = null;
15237  this.passwordNullTextIntervalID = -1;
15238  this.nullTextInputElement = null;
15239  this.helpText = "";
15240  this.helpTextObj = null;  
15241  this.helpTextStyle = [];
15242  this.externalTableStyle = [];
15243  this.helpTextPosition = ASPx.Position.Right;
15244  this.helpTextMargins = null;
15245  this.helpTextHAlign = ASPxClientTextEditHelpTextHAlign.Left;
15246  this.helpTextVAlign = ASPxClientTextEditHelpTextVAlign.Top;
15247  this.enableHelpTextPopupAnimation = true;
15248  this.helpTextDisplayMode = ASPxClientTextEditHelpTextDisplayMode.Inline;
15249  this.maskInfo = null;  
15250  this.maskValueBeforeUserInput = "";
15251  this.maskPasteTimerID = -1;
15252  this.maskPasteLock = false;    
15253  this.maskPasteCounter = 0;
15254  this.maskTextBeforePaste = "";    
15255  this.maskHintHtml = "";
15256  this.maskHintTimerID = -1;
15257  this.maskedEditorClickEventHandlers = [];
15258  this.errorCellPosition = ASPx.Position.Right;
15259  this.displayFormat = null;
15260  this.TextChanged = new ASPxClientEvent();
15261 },
15262 InitializeProperties: function(properties){
15263  ASPxClientEdit.prototype.InitializeProperties.call(this, properties);
15264  if(properties.maskInfo) {
15265   this.maskInfo = ASPx.MaskInfo.Create(properties.maskInfo.maskText, properties.maskInfo.dateTimeOnly, properties.maskInfo.allowEscapingInEnums);
15266   this.SetProperties(properties.maskInfo.properties, this.maskInfo);
15267  }
15268 },
15269 Initialize: function(){
15270  this.SaveChangedValue();
15271  ASPxClientEdit.prototype.Initialize.call(this);
15272  this.CorrectInputMaxLength();
15273  this.SubscribeToIeDropEvent();
15274  if(ASPx.Browser.WebKitFamily)  
15275   this.CorrectMainElementWhiteSpaceStyle();
15276  if(this.GetInputElement().type == "password")
15277   this.ToggleTextDecoration();
15278 },
15279 InlineInitialize: function(){
15280  ASPxClientEdit.prototype.InlineInitialize.call(this);
15281  if(this.maskInfo != null)
15282   this.InitMask();
15283  this.ApplyBrowserSpecificClassName();
15284  this.helpTextInitialize();
15285  if(ASPx.Browser.IE && ASPx.Browser.Version >= 10 && this.nullText != "")
15286   this.addIEXButtonEventHandler();
15287  if(this.autoCompleteAttribute)
15288   this.GetInputElement().setAttribute(this.autoCompleteAttribute.name, this.autoCompleteAttribute.value);
15289 },
15290 InitializeEvents: function() {
15291  ASPxClientEdit.prototype.InitializeEvents.call(this);
15292  ASPx.Evt.AttachEventToElement(this.GetInputElement(), "keydown", this.OnKeyDown.aspxBind(this));
15293  ASPx.Evt.AttachEventToElement(this.GetInputElement(), "keyup", this.OnKeyUp.aspxBind(this));
15294  ASPx.Evt.AttachEventToElement(this.GetInputElement(), "keypress", this.OnKeyPress.aspxBind(this));
15295 },
15296 AdjustControl: function() {
15297  ASPxClientEdit.prototype.AdjustControl.call(this);
15298  if(ASPx.Browser.IE && ASPx.Browser.Version > 8 && !this.isNative)
15299   this.correctInputElementHeight();
15300 },
15301 correctInputElementHeight: function() {
15302  var mainElement = this.GetMainElement();
15303  if(mainElement) {
15304   var mainElementHeight = mainElement.style.height;
15305   var mainElementHeightSpecified = mainElementHeight && mainElementHeight.indexOf('px') !== -1; 
15306   if(mainElementHeightSpecified) {
15307    var inputElement = this.GetInputElement();
15308    var inputElementHeight = this.getInputElementHeight();
15309    inputElement.style.height = inputElementHeight + "px";
15310    if(!ASPx.Ident.IsASPxClientMemo(this))
15311     inputElement.style.lineHeight = inputElementHeight + "px";
15312   }
15313  }
15314 },
15315 getInputElementHeight: function() {
15316  var mainElement = this.GetMainElement(),
15317   inputElement = this.GetInputElement();
15318  var inputElementHeight = ASPx.PxToInt(mainElement.style.height) - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(mainElement);
15319  var inputElementContainer = inputElement.parentNode,
15320   inputContainerStyle = ASPx.GetCurrentStyle(inputElementContainer);
15321  inputElementHeight -= ASPx.GetTopBottomBordersAndPaddingsSummaryValue(inputElementContainer, inputContainerStyle) 
15322   + ASPx.GetTopBottomMargins(inputElementContainer, inputContainerStyle);
15323  var mainElementCellspacing = ASPx.GetCellSpacing(mainElement);
15324  if(mainElementCellspacing)
15325   inputElementHeight -= mainElementCellspacing * 2;
15326  var inputStyle = ASPx.GetCurrentStyle(inputElement);
15327  inputElementHeight -= ASPx.GetTopBottomBordersAndPaddingsSummaryValue(inputElement, inputStyle) 
15328   + ASPx.GetTopBottomMargins(inputElement, inputStyle);
15329  return inputElementHeight;
15330 },
15331 addIEXButtonEventHandler: function() {
15332  var inputElement = this.GetInputElement()
15333  if(ASPx.IsExists(inputElement)) {
15334   this.isDeleteOrBackspaceKeyClick = false;
15335   ASPx.Evt.AttachEventToElement(inputElement, "input", function (evt) {
15336    if(this.isDeleteOrBackspaceKeyClick) {
15337     this.isDeleteOrBackspaceKeyClick = false;
15338     return;
15339    }
15340    if(inputElement.value === '') {
15341     this.SyncRawValue();
15342    }
15343   }.aspxBind(this));
15344   ASPx.Evt.AttachEventToElement(inputElement, "keydown", function (evt) {
15345    this.isDeleteOrBackspaceKeyClick = (evt.keyCode == ASPx.Key.Delete || evt.keyCode == ASPx.Key.Backspace);
15346   }.aspxBind(this));
15347  }   
15348 },
15349 ensureOutOfRangeWarningManager: function (minValue, maxValue, defaultMinValue, defaultMaxValue, valueFormatter) {
15350  if (!this.outOfRangeWarningManager)
15351   this.outOfRangeWarningManager = new ASPxOutOfRangeWarningManager(this, minValue, maxValue, defaultMinValue, defaultMaxValue,
15352    this.hasRightPopupHelpText() ? ASPx.Position.Bottom : ASPx.Position.Right, valueFormatter);
15353 },
15354 helpTextInitialize: function () {
15355  if(this.helpText) {
15356   this.helpTextObj = new ASPxClientTextEditHelpText(this, this.helpTextStyle, this.helpText, this.helpTextPosition,
15357    this.helpTextHAlign, this.helpTextVAlign, this.helpTextMargins, this.enableHelpTextPopupAnimation, this.helpTextDisplayMode);
15358  }
15359 },
15360 hasRightPopupHelpText: function() {
15361  return this.helpText && this.helpTextDisplayMode === ASPxClientTextEditHelpTextDisplayMode.Popup
15362   && this.helpTextPosition === ASPx.Position.Right;
15363 },
15364 showHelpText: function () {
15365  if(this.helpTextObj)
15366   this.helpTextObj.show();
15367 },
15368 hideHelpText: function () {
15369  if(this.helpTextObj)
15370   this.helpTextObj.hide();
15371 },
15372 ApplyBrowserSpecificClassName: function() {
15373  var mainElement = this.GetMainElement();
15374  if(ASPx.IsExistsElement(mainElement)) {
15375   var className = BrowserHelper.GetBrowserSpecificSystemClassName();
15376   if(className)
15377    mainElement.className += " " + className;
15378  }
15379 },
15380  CorrectMainElementWhiteSpaceStyle: function() {
15381  var inputElement = this.GetInputElement();
15382  if(inputElement && inputElement.parentNode) {
15383   if(this.IsElementHasWhiteSpaceStyle(inputElement.parentNode))
15384    inputElement.parentNode.style.whiteSpace = "normal";
15385  }
15386 },
15387 IsElementHasWhiteSpaceStyle: function(element) {
15388  var currentStyle = ASPx.GetCurrentStyle(element);
15389  return currentStyle.whiteSpace == "nowrap" || currentStyle.whiteSpace == "pre";  
15390 },
15391 FindInputElement: function(){
15392  return this.isNative ? this.GetMainElement() : ASPx.GetElementById(this.name + ASPx.TEInputSuffix);
15393 },
15394 DecodeRawInputValue: function(value) {
15395  return value;
15396 },
15397 GetRawValue: function(value){
15398  return ASPx.IsExists(this.stateObject) ? this.stateObject.rawValue : null;
15399 },
15400 SetRawValue: function(value){
15401  if(ASPx.IsExists(value))
15402   value = value.toString();
15403  this.UpdateStateObjectWithObject({ rawValue: value });
15404 },
15405 SyncRawValue: function() {
15406  if(this.maskInfo != null)
15407   this.SetRawValue(this.maskInfo.GetValue());
15408  else
15409   this.SetRawValue(this.GetInputElement().value);
15410 },
15411 HasTextDecorators: function() {
15412  return this.nullText != "" || this.displayFormat != null;
15413 },
15414 CanApplyTextDecorators: function(){
15415  return !this.focused;
15416 },
15417 GetDecoratedText: function(value) {
15418  if(this.IsNull(value) && this.nullText != "") {
15419   if(this.CanApplyNullTextDecoration) {
15420    if(this.CanApplyNullTextDecoration())
15421     return this.nullText;
15422   } else {
15423    return this.nullText;
15424   }
15425  }
15426  if(this.displayFormat != null)
15427   return this.GetDisplayFormatText(value);
15428  if(this.maskInfo != null)
15429   return this.maskInfo.GetText();
15430  if(value == null)
15431   return "";
15432  return value;
15433 },
15434 GetDisplayFormatText: function(value) {
15435  return ASPx.Formatter.Format(this.displayFormat, value);
15436 },
15437 ToggleTextDecoration: function() {
15438  if(this.HasTextDecorators()) {
15439   if(this.focused) {
15440    var input = this.GetInputElement();
15441    var oldValue = input.value;
15442    var sel = ASPx.Selection.GetExtInfo(input);
15443    this.ToggleTextDecorationCore();
15444    if(oldValue != input.value || !ASPx.Selection.AreEqual(sel, ASPx.Selection.GetExtInfo(input))) {
15445     if(sel.startPos == 0 && sel.endPos == oldValue.length)
15446      sel.endPos = input.value.length;
15447     else
15448      sel.endPos = sel.startPos;
15449     if(!this.accessibilityCompliant || ASPx.GetActiveElement() == input)
15450      this.SetSelectionOnToggleTextDecoration(input, sel);
15451    }
15452   } else
15453    this.ToggleTextDecorationCore();
15454  }
15455 },
15456 SetSelectionOnToggleTextDecoration: function(input, sel) {
15457  ASPx.Selection.Set(input, sel.startPos, sel.endPos);
15458 },
15459 ToggleTextDecorationCore: function() {
15460  if(this.maskInfo != null) {   
15461   this.ApplyMaskInfo(false);
15462  } else {
15463   var input = this.GetInputElement();
15464   var rawValue = this.GetRawValue();
15465   var value = this.CanApplyTextDecorators() ? this.GetDecoratedText(rawValue) : rawValue;
15466   if(input.value != value) {
15467    if(input.type == "password")
15468     this.TogglePasswordInputTextDecoration(value);
15469    else
15470     input.value = value;
15471   }
15472  }
15473 },
15474 GetPasswordNullTextInputElement: function() {
15475  if(!this.isPasswordNullTextInputElementExists())
15476   this.nullTextInputElement = this.createPasswordNullTextInputElement();
15477  return this.nullTextInputElement;
15478 },
15479 createPasswordNullTextInputElement: function() {
15480  var inputElement = this.GetInputElement(),
15481   nullTextInputElement = document.createElement("INPUT");
15482  nullTextInputElement.className = inputElement.className;
15483  nullTextInputElement.style.cssText = inputElement.style.cssText;
15484  nullTextInputElement.id = inputElement.id + passwordInputClonedSuffix;
15485  nullTextInputElement.type = "text";
15486  if(ASPx.IsExists(inputElement.tabIndex))
15487   nullTextInputElement.tabIndex = inputElement.tabIndex;
15488  var onFocusEventHandler = function() {
15489   var inputElement = this.GetInputElement(),
15490    nullTextInputElement = this.GetPasswordNullTextInputElement();
15491   if(inputElement) {
15492    this.LockFocusEvents();  
15493    ASPx.SetElementDisplay(inputElement, true);
15494    inputElement.focus();
15495    ASPx.SetElementDisplay(nullTextInputElement, false);
15496    this.ReplaceAssociatedIdInLabels(nullTextInputElement.id, inputElement.id);
15497   }
15498  }.aspxBind(this);
15499  ASPx.Evt.AttachEventToElement(nullTextInputElement, "focus", onFocusEventHandler);
15500  return nullTextInputElement;
15501 },
15502 isPasswordNullTextInputElementExists: function() {
15503  return ASPx.IsExistsElement(this.nullTextInputElement);
15504 },
15505 TogglePasswordNullTextTimeoutChecker: function() {
15506  if(this.passwordNullTextIntervalID < 0) {
15507   var timeoutChecker = function() {
15508    var inputElement = this.GetInputElement();
15509    if(ASPx.GetControlCollection().GetByName(this.name) !== this || inputElement == null) {
15510     window.clearTimeout(this.passwordNullTextIntervalID);
15511     this.passwordNullTextIntervalID = -1;
15512     return;
15513    } else {
15514     if(!this.focused) {
15515      var passwordNullTextInputElement = this.GetPasswordNullTextInputElement();
15516      if(passwordNullTextInputElement.value != this.nullText && inputElement.value == "") { 
15517       passwordNullTextInputElement.value = this.nullText;
15518       this.SetValue(null);
15519      }
15520      if(inputElement.value != "") {
15521       if(inputElement.style.display == "none") {
15522        this.SetValue(inputElement.value);
15523        this.UnhidePasswordInput();
15524       }
15525      } else {
15526       if(inputElement.style.display != "none") {
15527        this.SetValue(null);
15528        this.HidePasswordInput();
15529       }
15530      }
15531     }
15532    }
15533   }.aspxBind(this);
15534   timeoutChecker(); 
15535   this.passwordNullTextIntervalID = window.setInterval(timeoutChecker, 100);
15536  }
15537 },
15538 TogglePasswordInputTextDecoration: function(value) {
15539  var inputElement = this.GetInputElement();
15540  var nullTextInputElement = this.GetPasswordNullTextInputElement();
15541  nullTextInputElement.value = value;
15542  var parentNode = inputElement.parentNode;
15543  if(ASPx.Data.ArrayIndexOf(parentNode.childNodes, nullTextInputElement) < 0) {
15544   ASPx.Attr.ChangeStyleAttribute(nullTextInputElement, "display", "none");
15545   parentNode.appendChild(nullTextInputElement);
15546  }
15547  this.HidePasswordInput();
15548  this.TogglePasswordNullTextTimeoutChecker();
15549 },
15550 HidePasswordInput: function() {
15551  ASPx.Attr.ChangeStyleAttribute(this.GetInputElement(), "display", "none");
15552  ASPx.Attr.ChangeStyleAttribute(this.GetPasswordNullTextInputElement(), "display", "");
15553  this.ReplaceAssociatedIdInLabels(this.GetInputElement().id, this.GetPasswordNullTextInputElement().id);
15554 },
15555 UnhidePasswordInput: function() {
15556  ASPx.Attr.ChangeStyleAttribute(this.GetInputElement(), "display", "");
15557  ASPx.Attr.ChangeStyleAttribute(this.GetPasswordNullTextInputElement(), "display", "none");
15558  this.ReplaceAssociatedIdInLabels(this.GetPasswordNullTextInputElement().id, this.GetInputElement().id);
15559 },
15560 ReplaceAssociatedIdInLabels: function(oldId, newId) {
15561  var labels = document.getElementsByTagName("LABEL");
15562  for(var i = 0; i < labels.length; i++) {
15563   if(labels[i].attributes["for"] && labels[i].attributes["for"].value == oldId)
15564    labels[i].attributes["for"].value = newId;
15565  }
15566 },
15567 GetFormattedText: function() {
15568  var value = this.GetValue();
15569  if(this.IsNull(value) && this.nullText != "")
15570   return this.GetText();
15571  return this.GetDecoratedText(value);
15572 },
15573 IsNull: function(value) {
15574  return value == null || value === "";
15575 },
15576 PopulateStyleDecorationPostfixes: function() {
15577  ASPxClientEdit.prototype.PopulateStyleDecorationPostfixes.call(this);
15578  this.styleDecoration.AddPostfix(ASPx.TEInputSuffix);
15579 },
15580 GetValue: function() {
15581  var value = null;
15582  if(this.maskInfo != null)
15583   value = this.maskInfo.GetValue();
15584  else if(this.HasTextDecorators())
15585   value = this.GetRawValue();
15586  else {
15587   var input = this.GetInputElement();
15588   value = input ? input.value : null;
15589  };
15590  return (value == "" && this.convertEmptyStringToNull) ? null : value;
15591 },
15592 SetValue: function(value) {
15593  if(value == null || value === undefined) 
15594   value = "";
15595  if(this.maskInfo != null) {
15596   this.maskInfo.SetValue(value.toString());
15597   this.ApplyMaskInfo(false);
15598   this.SavePrevMaskValue();
15599  } 
15600  else if(this.HasTextDecorators()) {
15601   this.SetRawValue(value);
15602   this.GetInputElement().value = this.CanApplyTextDecorators() && this.GetInputElement().type != "password" ? this.GetDecoratedText(value) : value;
15603  }
15604  else
15605   this.GetInputElement().value = value;
15606  if(this.styleDecoration)
15607   this.styleDecoration.Update();   
15608  this.SaveChangedValue();   
15609 },
15610 SetVisible: function(visible) {
15611  ASPxClientEdit.prototype.SetVisible.call(this, visible);
15612  if(this.helpTextDisplayMode === ASPxClientTextEditHelpTextDisplayMode.Inline) {
15613   if(visible)
15614    this.showHelpText();
15615   else
15616    this.hideHelpText();
15617  }
15618 },
15619 UnstretchInputElement: function(){
15620  var inputElement = this.GetInputElement();
15621  var mainElement = this.GetMainElement();
15622  var mainElementCurStyle = ASPx.GetCurrentStyle(mainElement);
15623  if(ASPx.IsExistsElement(mainElement) && ASPx.IsExistsElement(inputElement) && ASPx.IsExists(mainElementCurStyle) && 
15624   inputElement.style.width == "100%" &&
15625   (mainElementCurStyle.width == "" || mainElementCurStyle.width == "auto"))
15626   inputElement.style.width = "";
15627 },
15628 RestoreActiveElement: function(activeElement) {
15629  if(activeElement && activeElement.setActive && activeElement.tagName != "IFRAME")
15630   activeElement.setActive();
15631 },
15632 RaiseValueChangedEvent: function() {
15633  var processOnServer = ASPxClientEdit.prototype.RaiseValueChangedEvent.call(this);
15634  processOnServer = this.RaiseTextChanged(processOnServer);
15635  return processOnServer;
15636 },
15637 InitMask: function() {
15638  var rawValue = this.GetRawValue();
15639  this.SetValue(rawValue.length ? this.DecodeRawInputValue(rawValue) : this.maskInfo.GetValue());
15640  this.validationPatterns.unshift(new MaskValidationPattern(this.maskInfo.errorText, this.maskInfo));
15641 },
15642 SetMaskPasteTimer: function() {
15643  this.ClearMaskPasteTimer();
15644  this.maskPasteTimerID = ASPx.Timer.SetControlBoundInterval(this.MaskPasteTimerProc, this, ASPx.PasteCheckInterval);
15645 },
15646 ClearMaskPasteTimer: function() {
15647  this.maskPasteTimerID = ASPx.Timer.ClearInterval(this.maskPasteTimerID);
15648 },
15649 SavePrevMaskValue: function() {
15650  this.maskValueBeforeUserInput = this.maskInfo.GetValue();
15651 },
15652 FillMaskInfo: function() {
15653  var input = this.GetInputElement();
15654  if(!input) return; 
15655  var sel = ASPx.Selection.GetInfo(input);
15656  this.maskInfo.SetCaret(sel.startPos, sel.endPos - sel.startPos);  
15657 },
15658 ApplyMaskInfo: function(applyCaret) {
15659  this.SyncRawValue();
15660  var input = this.GetInputElement();
15661  var text = this.GetMaskDisplayText();
15662  this.maskTextBeforePaste = text;
15663  if(input.value != text)
15664   input.value = text;
15665  if(applyCaret)
15666   ASPx.Selection.Set(input, this.maskInfo.caretPos, this.maskInfo.caretPos + this.maskInfo.selectionLength);
15667 },
15668 GetMaskDisplayText: function() {
15669  if(!this.focused && this.HasTextDecorators())
15670   return this.GetDecoratedText(this.maskInfo.GetValue());
15671  return this.maskInfo.GetText();
15672 },
15673 ShouldCancelMaskKeyProcessing: function(htmlEvent, keyDownInfo) {
15674  return ASPx.Evt.IsEventPrevented(htmlEvent);
15675 }, 
15676 HandleMaskKeyDown: function(evt) {
15677  var keyInfo = ASPx.MaskManager.CreateKeyInfoByEvent(evt);
15678  ASPx.MaskManager.keyCancelled = this.ShouldCancelMaskKeyProcessing(evt, keyInfo);
15679  if(ASPx.MaskManager.keyCancelled) {
15680   ASPx.Evt.PreventEvent(evt);
15681   return;
15682  }
15683  this.maskPasteLock = true;
15684  this.FillMaskInfo();  
15685  var canHandle = ASPx.MaskManager.CanHandleControlKey(keyInfo);   
15686  ASPx.MaskManager.savedKeyDownKeyInfo = keyInfo;
15687  if(canHandle) {   
15688   ASPx.MaskManager.OnKeyDown(this.maskInfo, keyInfo);
15689   this.ApplyMaskInfo(true);
15690   ASPx.Evt.PreventEvent(evt);
15691  }
15692  ASPx.MaskManager.keyDownHandled = canHandle;
15693  this.maskPasteLock = false;
15694  this.UpdateMaskHintHtml();
15695 },
15696 HandleMaskKeyPress: function(evt) {
15697  var keyInfo = ASPx.MaskManager.CreateKeyInfoByEvent(evt);
15698  ASPx.MaskManager.keyCancelled = ASPx.MaskManager.keyCancelled || this.ShouldCancelMaskKeyProcessing(evt, ASPx.MaskManager.savedKeyDownKeyInfo);
15699  if(ASPx.MaskManager.keyCancelled) {
15700   ASPx.Evt.PreventEvent(evt);
15701   return;
15702  }
15703  this.maskPasteLock = true;  
15704  var printable = ASPx.MaskManager.savedKeyDownKeyInfo != null && ASPx.MaskManager.IsPrintableKeyCode(ASPx.MaskManager.savedKeyDownKeyInfo);
15705  if(printable) {
15706   ASPx.MaskManager.OnKeyPress(this.maskInfo, keyInfo);
15707   this.ApplyMaskInfo(true);
15708  }
15709  if(printable || ASPx.MaskManager.keyDownHandled)   
15710   ASPx.Evt.PreventEvent(evt); 
15711  this.maskPasteLock = false;
15712  this.UpdateMaskHintHtml();
15713 },
15714 MaskPasteTimerProc: function() {
15715  if(this.maskPasteLock || !this.maskInfo) return;
15716  this.maskPasteCounter++;
15717  var inputElement = this.inputElement;
15718  if(!inputElement || this.maskPasteCounter > 40) {
15719   this.maskPasteCounter = 0;
15720   inputElement = this.GetInputElement();
15721   if(!ASPx.IsExistsElement(inputElement)) {
15722    this.ClearMaskPasteTimer();
15723    return;
15724   }
15725  }
15726  if(this.maskTextBeforePaste !== inputElement.value) {
15727   this.maskInfo.ProcessPaste(inputElement.value, ASPx.Selection.GetInfo(inputElement).endPos);
15728   this.ApplyMaskInfo(true);
15729  }
15730  if(!this.focused)
15731   this.ClearMaskPasteTimer();
15732 },
15733 BeginShowMaskHint: function() {  
15734  if(!this.readOnly && this.maskHintTimerID == -1)
15735   this.maskHintTimerID = window.setInterval(ASPx.MaskHintTimerProc, 500);
15736 },
15737 EndShowMaskHint: function() {
15738  window.clearInterval(this.maskHintTimerID);
15739  this.maskHintTimerID = -1;
15740 },
15741 MaskHintTimerProc: function() {  
15742  if(this.maskInfo) {
15743   this.FillMaskInfo();
15744   this.UpdateMaskHintHtml();
15745  } else {
15746   this.EndShowMaskHint();
15747  }
15748 },
15749 UpdateMaskHintHtml: function() {  
15750  var hint =  this.GetMaskHintElement();
15751  if(!ASPx.IsExistsElement(hint))
15752   return;
15753  var html = ASPx.MaskManager.GetHintHtml(this.maskInfo);
15754  if(html == this.maskHintHtml)
15755   return;
15756  if(html != "") {
15757   var mainElement = this.GetMainElement();
15758   if(ASPx.IsExistsElement(mainElement)) {
15759    hint.innerHTML = html;
15760    hint.style.position = "absolute";  
15761    hint.style.left = ASPx.PrepareClientPosForElement(ASPx.GetAbsoluteX(mainElement), mainElement, true) + "px";
15762    hint.style.top = (ASPx.PrepareClientPosForElement(ASPx.GetAbsoluteY(mainElement), mainElement, false) + mainElement.offsetHeight + 2) + "px";
15763    hint.style.display = "block";    
15764   }   
15765  } else {
15766   hint.style.display = "none";
15767  }
15768  this.maskHintHtml = html;
15769 },
15770 HideMaskHint: function() {
15771  var hint =  this.GetMaskHintElement();
15772  if(ASPx.IsExistsElement(hint))
15773   hint.style.display = "none";
15774  this.maskHintHtml = "";
15775 },
15776 GetMaskHintElement: function() {
15777  return ASPx.GetElementById(this.name + "_MaskHint");
15778 },
15779 OnFocus: function() {
15780  if(this.maskInfo != null && !ASPx.GetControlCollection().InCallback())
15781   this.SetMaskPasteTimer();
15782  ASPxClientEdit.prototype.OnFocus.call(this);
15783 },
15784 OnMouseWheel: function(evt){
15785  if(this.readOnly || this.maskInfo == null) return;
15786  this.FillMaskInfo();
15787  ASPx.MaskManager.OnMouseWheel(this.maskInfo, ASPx.Evt.GetWheelDelta(evt) < 0 ? -1 : 1);
15788  this.ApplyMaskInfo(true);
15789  ASPx.Evt.PreventEvent(evt);
15790  this.UpdateMaskHintHtml();
15791 }, 
15792 OnBrowserWindowResize: function(e) {
15793  if(!this.autoResizeWithContainer)
15794   this.AdjustControl();
15795 },
15796 IsValueChanged: function() {
15797  return this.GetValue() != this.lastChangedValue; 
15798 },
15799 OnKeyDown: function(evt) {        
15800  if(this.NeedPreventBrowserUndoBehaviour(evt))
15801   return ASPx.Evt.PreventEvent(evt);
15802  if(this.RequireHandleMaxlenManually()) {
15803   this.onKeyDownInputValue = this.GetInputElement().value;
15804   var selectionInfo = ASPx.Selection.GetExtInfo(this.GetInputElement());
15805   this.onKeyDownCursorPos = selectionInfo.startPos;
15806  }
15807  if(ASPx.Browser.IE && ASPx.Evt.GetKeyCode(evt) == ASPx.Key.Esc) {   
15808   if(++this.escCount > 1) {
15809    ASPx.Evt.PreventEvent(evt);
15810    return;
15811   }
15812  } else 
15813   this.escCount = 0;
15814  ASPxClientEdit.prototype.OnKeyDown.call(this, evt);
15815  if(!this.IsRaiseStandardOnChange(evt)) {
15816   if(!this.readOnly && this.maskInfo != null)
15817    this.HandleMaskKeyDown(evt);
15818  }
15819 },
15820 IsCtrlZ: function(evt) {
15821  return evt.ctrlKey && !evt.altKey && !evt.shiftKey && (ASPx.Evt.GetKeyCode(evt) == 122 || ASPx.Evt.GetKeyCode(evt) == 90)
15822 },
15823 NeedPreventBrowserUndoBehaviour: function(evt) {
15824  var inputElement = this.GetInputElement();
15825  return this.IsCtrlZ(evt) && !!inputElement && !inputElement.value;
15826 },
15827 OnKeyPress: function(evt) {
15828  ASPxClientEdit.prototype.OnKeyPress.call(this, evt);
15829  if(!this.readOnly && this.maskInfo != null && !this.IsRaiseStandardOnChange(evt))
15830   this.HandleMaskKeyPress(evt);
15831  if(this.NeedOnKeyEventEnd(evt, true))
15832   this.OnKeyEventEnd(evt);
15833 },
15834 OnKeyUp: function(evt) {
15835  if(ASPx.Browser.Firefox && !this.focused && ASPx.Evt.GetKeyCode(evt) === ASPx.Key.Tab)
15836   return;
15837  if(this.NeedOnKeyEventEnd(evt, false)) {
15838   var proccessNextCommingPress = ASPx.Evt.GetKeyCode(evt) === ASPx.Key.Alt; 
15839   this.OnKeyEventEnd(evt, proccessNextCommingPress);
15840  }
15841  if(this.RequireHandleMaxlenManually()) {
15842   var inputValueLength = this.GetInputElement().value.length;
15843   var maxLength = this.GetInputMaxLength();
15844   if(inputValueLength > maxLength && inputValueLength > this.onKeyDownInputValue.length) {
15845    this.GetInputElement().value = this.onKeyDownInputValue;
15846    this.SetCaretPosition(this.onKeyDownCursorPos);
15847   }
15848  }
15849  ASPxClientEdit.prototype.OnKeyUp.call(this, evt);
15850 },
15851 RequireHandleMaxlenManually: function() { 
15852  return ASPx.Browser.AndroidMobilePlatform && ASPx.Browser.SamsungAndroidDevice && ASPx.Browser.PlaformMajorVersion < 6 && this.GetInputMaxLength() !== -1;
15853 },
15854 GetInputMaxLength: function() {
15855  var input = this.GetInputElement();
15856  if(ASPx.Attr.IsExistsAttribute(input, "maxlength"))
15857   return input.maxLength;
15858  return -1;
15859 },
15860 NeedOnKeyEventEnd: function(evt, isKeyPress) { 
15861  var handleKeyPress = this.maskInfo != null && evt.keyCode == ASPx.Key.Enter;
15862  return handleKeyPress == isKeyPress;
15863 },
15864 OnKeyEventEnd: function(evt, withDelay){
15865  if(!this.readOnly) {
15866   if(this.IsRaiseStandardOnChange(evt))
15867    this.RaiseStandardOnChange();
15868   this.SyncRawValueIfHasTextDecorators(withDelay);
15869  }
15870 },
15871 SyncRawValueIfHasTextDecorators: function(withDelay) {
15872  if(this.HasTextDecorators()) {
15873   if(withDelay) {
15874    window.setTimeout(function() {
15875     this.SyncRawValue();
15876    }.aspxBind(this), 0);
15877   } else 
15878    this.SyncRawValue();
15879  }
15880 },
15881 IsRaiseStandardOnChange: function(evt){
15882  return !this.specialKeyboardHandlingUsed && this.raiseValueChangedOnEnter && evt.keyCode == ASPx.Key.Enter;
15883 },
15884 GetFocusSelectAction: function() {
15885  if(this.maskInfo)
15886   return "start";
15887  return "all"; 
15888 },
15889 CorrectFocusWhenDisabled: function() {
15890  if(!this.GetEnabled()) {
15891   var inputElement = this.GetInputElement();
15892   if(inputElement)
15893    inputElement.blur();
15894   return true;
15895  }
15896  return false;
15897 },
15898 EnsureShowPopupHelpText: function() {
15899  if(this.helpTextDisplayMode === ASPxClientTextEditHelpTextDisplayMode.Popup)
15900   this.showHelpText();
15901 },
15902 EnsureHidePopupHelpText: function() {
15903  if(this.helpTextDisplayMode === ASPxClientTextEditHelpTextDisplayMode.Popup)
15904   this.hideHelpText();
15905 },
15906 OnFocusCore: function() {
15907  if(this.CorrectFocusWhenDisabled())
15908   return;
15909  var wasLocked = this.IsFocusEventsLocked();
15910  ASPxClientEdit.prototype.OnFocusCore.call(this);
15911  this.CorrectInputMaxLength(true);
15912  if(this.maskInfo != null) {
15913   this.SavePrevMaskValue();
15914   this.BeginShowMaskHint();
15915   this.AttachOnMouseClickIfNeeded();
15916  }
15917  if(!wasLocked)
15918   this.ToggleTextDecoration();
15919  if(this.isPasswordNullTextInputElementExists())
15920   setTimeout(function() { this.EnsureShowPopupHelpText(); }.aspxBind(this), 0);
15921  else
15922   this.EnsureShowPopupHelpText();
15923 },
15924 clearMaskedEditorClickEventHandlers: function () {
15925  for(var i = 0; i < this.maskedEditorClickEventHandlers.length; i++)
15926   ASPx.Evt.DetachEventFromElement(this.GetInputElement(), "click", this.maskedEditorClickEventHandlers[i]);
15927  this.maskedEditorClickEventHandlers = [];
15928 },
15929 addMaskedEditorClickEventHandler: function () {
15930  this.maskedEditorClickEventHandlers.push(this.MouseClickOnMaskedEditorFunc);
15931  ASPx.Evt.AttachEventToElement(this.GetInputElement(), "click", this.MouseClickOnMaskedEditorFunc);
15932 },
15933 AttachOnMouseClickIfNeeded: function () {
15934  this.clearMaskedEditorClickEventHandlers();
15935  if(this.GetValue() == "" || this.GetValue() == null) {
15936   this.MouseClickOnMaskedEditorFunc = function (e) {
15937    this.clearMaskedEditorClickEventHandlers();
15938    var selectionInfo = ASPx.Selection.GetExtInfo(this.GetInputElement());
15939    if(selectionInfo.startPos == selectionInfo.endPos)
15940     this.SetCaretPosition(this.GetInitialCaretPositionInEmptyMaskedInput());
15941   }.aspxBind(this);
15942   this.addMaskedEditorClickEventHandler();
15943  }
15944 },
15945 GetInitialCaretPositionInEmptyMaskedInput: function() {
15946  var maskParts = this.maskInfo.parts;
15947  return ASPx.MaskManager.IsLiteralPart(maskParts[0]) ? maskParts[0].GetSize() : 0;
15948 },
15949 OnLostFocusCore: function() {
15950  var wasLocked = this.IsFocusEventsLocked();
15951  ASPxClientEdit.prototype.OnLostFocusCore.call(this);
15952  this.CorrectInputMaxLength();
15953  if(this.maskInfo != null) {
15954   this.EndShowMaskHint();
15955   this.HideMaskHint();   
15956   if(this.maskInfo.ApplyFixes(null))
15957    this.ApplyMaskInfo(false);
15958   this.RaiseStandardOnChange();
15959  }
15960  if(!wasLocked)
15961   this.ToggleTextDecoration();
15962  this.escCount = 0;
15963  this.EnsureHidePopupHelpText();
15964 },
15965 InputMaxLengthCorrectionRequired: function () {
15966  return ASPx.Browser.IE && ASPx.Browser.Version >= 10 && (!this.isNative || this.nullText != "");
15967 },
15968 CorrectInputMaxLength: function (onFocus) {
15969  if(this.InputMaxLengthCorrectionRequired()) {
15970   var input = this.GetInputElement();
15971   if(!ASPx.IsExists(this.inputMaxLength))
15972    this.inputMaxLength = input.maxLength;
15973   input.maxLength = onFocus ? this.inputMaxLength : -1;
15974  }
15975 },
15976 SubscribeToIeDropEvent: function() {
15977  if(this.InputMaxLengthCorrectionRequired()) {
15978   var input = this.GetInputElement();
15979   ASPx.Evt.AttachEventToElement(input, "drop", function(e) { this.CorrectInputMaxLength(true); }.aspxBind(this));
15980  }
15981 },
15982 SetFocus: function() {
15983  if(this.isPasswordNullTextInputElementExists()) {
15984   this.GetPasswordNullTextInputElement().focus();
15985  } else {
15986     ASPxClientEdit.prototype.SetFocus.call(this);
15987  }
15988 },
15989 OnValueChanged: function() {
15990  if(this.maskInfo != null) {
15991   if(this.maskInfo.GetValue() == this.maskValueBeforeUserInput && !this.IsValueChangeForced())
15992    return;
15993   this.SavePrevMaskValue();
15994  }
15995  if(this.HasTextDecorators())
15996   this.SyncRawValue();
15997  if(!this.IsValueChanged() && !this.IsValueChangeForced())
15998   return;
15999  this.SaveChangedValue(); 
16000  ASPxClientEdit.prototype.OnValueChanged.call(this);
16001 },
16002 IsValueChangeForced: function() {
16003  return false;
16004 },
16005 OnTextChanged: function() {
16006 },
16007 SaveChangedValue: function() {
16008  this.lastChangedValue = this.GetValue();
16009 },
16010 RaiseStandardOnChange: function(){
16011  var element = this.GetInputElement();
16012  if(element && element.onchange) {
16013   element.onchange({ target: this.GetInputElement() });
16014  }
16015  else if(this.ValueChanged) {
16016   this.ValueChanged.FireEvent(this);
16017  }
16018 },
16019 RaiseTextChanged: function(processOnServer){
16020  if(!this.TextChanged.IsEmpty()){
16021   var args = new ASPxClientProcessingModeEventArgs(processOnServer);
16022   this.TextChanged.FireEvent(this, args);
16023   processOnServer = args.processOnServer;
16024  }
16025  return processOnServer;  
16026 },
16027 GetText: function(){
16028  if(this.maskInfo != null) {
16029   return this.maskInfo.GetText();
16030  } else {
16031   var value = this.GetValue();
16032   return value != null ? value : "";
16033  }
16034 },
16035 SetText: function (value){
16036  if(this.maskInfo != null) {
16037   this.maskInfo.SetText(value);
16038   this.ApplyMaskInfo(false);
16039   this.SavePrevMaskValue();
16040  } else {
16041   this.SetValue(value);
16042  }
16043 },
16044 SelectAll: function() {
16045  this.SetSelection(0, -1, false);
16046 },
16047 SetCaretPosition: function(pos) {
16048  var inputElement = this.GetInputElement();
16049  ASPx.Selection.SetCaretPosition(inputElement, pos);
16050 },
16051 SetSelection: function(startPos, endPos, scrollToSelection) { 
16052  var inputElement = this.GetInputElement();
16053  ASPx.Selection.Set(inputElement, startPos, endPos, scrollToSelection);
16054 },
16055 ChangeEnabledAttributes: function(enabled){
16056  var inputElement = this.GetInputElement();
16057  if(inputElement){
16058   this.ChangeInputEnabledAttributes(inputElement, ASPx.Attr.ChangeAttributesMethod(enabled), enabled);
16059   if(this.specialKeyboardHandlingUsed)
16060    this.ChangeSpecialInputEnabledAttributes(inputElement, ASPx.Attr.ChangeEventsMethod(enabled));
16061   this.ChangeInputEnabled(inputElement, enabled, this.readOnly);
16062  }
16063 },
16064 ChangeEnabledStateItems: function(enabled){
16065  if(!this.isNative) {
16066   var sc = ASPx.GetStateController();
16067   sc.SetElementEnabled(this.GetMainElement(), enabled);
16068   sc.SetElementEnabled(this.GetInputElement(), enabled);
16069  }
16070 },
16071 ChangeInputEnabled: function(element, enabled, readOnly) {
16072  if(this.UseReadOnlyForDisabled())
16073   element.readOnly = !enabled || readOnly;
16074  else
16075   element.disabled = !enabled;
16076 },
16077 ChangeInputEnabledAttributes: function(element, method, enabled) {
16078  var ieTabIndexFix = enabled && ASPx.Browser.IE && element.setAttribute && ASPx.Attr.IsExistsAttribute(element, "savedtabIndex");
16079  method(element, "tabIndex");
16080  if(!enabled) element.tabIndex = -1;
16081  if(ieTabIndexFix) { 
16082   window.setTimeout(function() {
16083    if(element && element.parentNode)
16084     element.parentNode.replaceChild(element, element); 
16085   }, 0);
16086  }
16087  method(element, "onclick");
16088  if(!this.NeedFocusCorrectionWhenDisabled())
16089   method(element, "onfocus");
16090  method(element, "onblur");
16091  method(element, "onkeydown");
16092  method(element, "onkeypress");
16093  method(element, "onkeyup");
16094 },
16095 UseReadOnlyForDisabled: function() {
16096  return (ASPx.Browser.IE && ASPx.Browser.Version < 10) && !this.isNative;
16097 },
16098 NeedFocusCorrectionWhenDisabled: function(){
16099  return (ASPx.Browser.IE && ASPx.Browser.Version < 10) && !this.isNative;
16100 },
16101 OnPostFinalization: function(args) {
16102  if(this.GetEnabled() || !this.UseReadOnlyForDisabled() || args.isDXCallback)
16103   return;
16104  var inputElement = this.GetInputElement();
16105  if(inputElement) {
16106   var inputDisabled = inputElement.disabled;
16107   inputElement.disabled = true;
16108   window.setTimeout(function() {
16109    inputElement.disabled = inputDisabled;
16110   }.aspxBind(this), 0);
16111  }
16112 }
16113});
16114MaskValidationPattern = ASPx.CreateClass(ASPx.ValidationPattern, {
16115 constructor: function(errorText, maskInfo) {
16116  this.constructor.prototype.constructor.call(this, errorText);
16117  this.maskInfo = maskInfo;
16118 },
16119 EvaluateIsValid: function(value) {
16120  return this.maskInfo.IsValid();
16121 }
16122});
16123ASPx.Ident.IsASPxClientTextEdit = function(obj) {
16124 return !!obj.isASPxClientTextEdit;
16125};
16126var ASPxClientTextBoxBase = ASPx.CreateClass(ASPxClientTextEdit, {
16127 constructor: function(name) {
16128  this.constructor.prototype.constructor.call(this, name);
16129  this.sizingConfig.allowSetHeight = false;
16130  this.sizingConfig.adjustControl = true;
16131 }
16132});
16133var ASPxClientTextBox = ASPx.CreateClass(ASPxClientTextBoxBase, {
16134 constructor: function(name) {
16135  this.constructor.prototype.constructor.call(this, name);
16136  this.isASPxClientTextBox = true;
16137 }
16138});
16139ASPxClientTextBox.Cast = ASPxClientControl.Cast;
16140ASPx.Ident.IsASPxClientTextBox = function(obj) {
16141 return !!obj.isASPxClientTextBox;
16142};
16143var ASPxClientMemo = ASPx.CreateClass(ASPxClientTextEdit, { 
16144 constructor: function(name) {
16145  this.constructor.prototype.constructor.call(this, name);        
16146  this.isASPxClientMemo = true;
16147  this.raiseValueChangedOnEnter = false;
16148  this.maxLength = 0;
16149  this.pasteTimerID = -1;
16150  this.pasteTimerActivatorCount = 0;
16151 },
16152 Initialize: function() {
16153  ASPxClientTextEdit.prototype.Initialize.call(this);
16154  this.SaveChangedValue();
16155  this.maxLengthRestricted = this.maxLength > 0;
16156 },
16157 CutString: function() {
16158  var text = this.GetText();
16159  if(text.length > this.maxLength) {
16160   text = text.substring(0, this.maxLength);
16161   this.SetText(text);
16162  }
16163 },
16164 EventKeyCodeChangesTheInput: function(evt) {
16165  if(ASPx.IsPasteShortcut(evt))
16166   return true;
16167  else if(evt.ctrlKey)
16168   return false;
16169  var keyCode = ASPx.Evt.GetKeyCode(evt);
16170  var isSystemKey = ASPx.Key.Windows <= keyCode && keyCode <= ASPx.Key.ContextMenu;
16171  var isFKey = ASPx.Key.F1 <= keyCode && keyCode <= 127; 
16172  return ASPx.Key.Delete < keyCode && !isSystemKey && !isFKey || keyCode == ASPx.Key.Enter || keyCode == ASPx.Key.Space;
16173 },
16174 OnTextChangingCheck: function() {
16175  if(this.maxLengthRestricted)  
16176   this.CutString(); 
16177 },
16178 StartTextChangingTimer: function() {
16179  if(this.maxLengthRestricted) {
16180   if(this.pasteTimerActivatorCount == 0) 
16181    this.SetTextChangingTimer();
16182   this.pasteTimerActivatorCount ++;
16183  }
16184 },
16185 EndTextChangingTimer: function() {
16186  if(this.maxLengthRestricted) {
16187   this.pasteTimerActivatorCount --;
16188   if(this.pasteTimerActivatorCount == 0) 
16189    this.ClearTextChangingTimer();
16190  }
16191 },
16192 CollapseEditor: function() {
16193  if(!this.IsAdjustmentRequired()) return;
16194  var mainElement = this.GetMainElement();
16195  var inputElement = this.GetInputElement();
16196  if(!ASPx.IsExistsElement(mainElement) || !ASPx.IsExistsElement(inputElement))
16197   return;
16198  ASPxClientTextEdit.prototype.CollapseEditor.call(this);
16199  var mainElementCurStyle = ASPx.GetCurrentStyle(mainElement);
16200  if(this.heightCorrectionRequired && mainElement && inputElement) {
16201   if(mainElement.style.height == "100%" || mainElementCurStyle.height == "100%") {
16202    mainElement.style.height = "0";
16203    mainElement.wasCollapsed = true;
16204   }
16205   inputElement.style.height = "0";
16206  }
16207 },
16208 CorrectEditorHeight: function() {
16209  var mainElement = this.GetMainElement();
16210  if(mainElement.wasCollapsed) {
16211   mainElement.wasCollapsed = null;
16212   ASPx.SetOffsetHeight(mainElement, ASPx.GetClearClientHeight(ASPx.FindOffsetParent(mainElement)));
16213  }
16214  if(!this.isNative) {
16215   var inputElement = this.GetInputElement();
16216   var inputClearClientHeight = ASPx.GetClearClientHeight(ASPx.FindOffsetParent(inputElement));
16217   if(ASPx.Browser.IE) {
16218    inputClearClientHeight -= 2;
16219    var calculatedMainElementStyle = ASPx.GetCurrentStyle(mainElement);
16220    inputClearClientHeight += ASPx.PxToInt(calculatedMainElementStyle.borderTopWidth) + ASPx.PxToInt(calculatedMainElementStyle.borderBottomWidth);
16221   }
16222   if(inputClearClientHeight < memoMinHeight)
16223    inputClearClientHeight = memoMinHeight;
16224   ASPx.SetOffsetHeight(inputElement, inputClearClientHeight);
16225   mainElement.style.height = "100%";
16226   setTimeout(function() {
16227    var inputParentOffsetHeight = ASPx.GetClearClientHeight(ASPx.FindOffsetParent(inputElement));
16228    if(inputParentOffsetHeight != inputClearClientHeight) {
16229      ASPx.SetOffsetHeight(inputElement, inputParentOffsetHeight); 
16230     }
16231   }, 0);
16232  }
16233 },
16234 SetWidth: function(width) {
16235  ASPxClientTextEdit.prototype.SetWidth.call(this, width);
16236  if(ASPx.Browser.IE)
16237   this.AdjustControl();
16238 },
16239 SetHeight: function(height) {
16240  var textarea = this.GetInputElement();
16241  textarea.style.height = "1px";
16242  ASPxClientTextEdit.prototype.SetHeight.call(this, height);
16243  textarea.style.height = ASPx.GetClearClientHeight(this.GetMainElement()) - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(textarea) + "px";
16244 },
16245 ClearErrorFrameElementsStyles: function() {
16246  var textarea = this.GetInputElement();
16247  if(!textarea)
16248   return;
16249  var scrollBarPosition = textarea.scrollTop;
16250  ASPxClientTextEdit.prototype.ClearErrorFrameElementsStyles.call(this);
16251  if(ASPx.Browser.Firefox)
16252   textarea.scrollTop = scrollBarPosition;
16253 },
16254 OnMouseOver: function() {
16255  this.StartTextChangingTimer();
16256 },  
16257 OnMouseOut: function() {
16258  this.EndTextChangingTimer();
16259 },   
16260 OnFocus: function() {  
16261  this.StartTextChangingTimer();
16262  ASPxClientEdit.prototype.OnFocus.call(this);
16263 },
16264 OnLostFocus: function() {
16265  this.EndTextChangingTimer();
16266  ASPxClientEdit.prototype.OnLostFocus.call(this);
16267 },
16268 OnKeyDown: function(evt) { 
16269  if(this.NeedPreventBrowserUndoBehaviour(evt))
16270   return ASPx.Evt.PreventEvent(evt);
16271  if(this.maxLengthRestricted){
16272   var selection = ASPx.Selection.GetInfo(this.GetInputElement()); 
16273   var noCharToReplace = selection.startPos == selection.endPos;
16274   if(this.GetText().length >= this.maxLength && noCharToReplace && this.EventKeyCodeChangesTheInput(evt)) {
16275    return ASPx.Evt.PreventEvent(evt);
16276   }
16277  }
16278  ASPxClientEdit.prototype.OnKeyDown.call(this, evt);
16279 },
16280 SetTextChangingTimer: function() {
16281  this.pasteTimerID = ASPx.Timer.SetControlBoundInterval(this.OnTextChangingCheck, this, ASPx.PasteCheckInterval);
16282 },
16283 ClearTextChangingTimer: function() {
16284  this.pasteTimerID = ASPx.Timer.ClearInterval(this.pasteTimerID);
16285 }
16286});
16287ASPxClientMemo.Cast = ASPxClientControl.Cast;
16288ASPx.Ident.IsASPxClientMemo = function(obj) { return obj && !!obj.isASPxClientMemo; };
16289var CLEAR_BUTTON_INDEX = -100;
16290var HIDE_CONTENT_CSS_CLASS_NAME = "dxHideContent";
16291var setContentVisibility = function(clearButtonElement, value) {
16292 var action = value ? ASPx.RemoveClassNameFromElement : ASPx.AddClassNameToElement;
16293 action(clearButtonElement, HIDE_CONTENT_CSS_CLASS_NAME);
16294};
16295var CLEAR_BUTTON_DISPLAY_MODE = {
16296 AUTO: 'Auto',
16297 ALWAYS: 'Always',
16298 NEVER: 'Never',
16299 ON_HOVER: 'OnHover'
16300};
16301var AccessibilityFocusedButtonClassName = "dxAFB";
16302var ASPxClientButtonEditBase = ASPx.CreateClass(ASPxClientTextBoxBase, {
16303 constructor: function(name) {
16304  this.constructor.prototype.constructor.call(this, name);        
16305  this.allowUserInput = true;
16306  this.isValueChanging = false;
16307  this.allowMouseWheel = true;
16308  this.isMouseOver = false;
16309  this.buttonCount = 0;
16310  this.emptyValueMaskDisplayText = "";
16311  this.clearButtonDisplayMode = CLEAR_BUTTON_DISPLAY_MODE.AUTO;
16312  this.forceShowClearButtonAlways = false;
16313  this.recoverClearButtonVisibility = false;
16314  this.ButtonClick = new ASPxClientEvent();
16315 },
16316 Initialize: function() {
16317  ASPxClientTextBoxBase.prototype.Initialize.call(this);
16318  this.EnsureEmptyValueMaskDisplayText();
16319  if(this.HasClearButton())
16320   this.InitializeClearButton();
16321  this.InitAccessibilityCompliant();
16322 },
16323 InlineInitialize: function() {
16324  ASPxClientTextBoxBase.prototype.InlineInitialize.call(this);
16325  if(this.clearButtonDisplayMode === CLEAR_BUTTON_DISPLAY_MODE.AUTO) {
16326   this.clearButtonDisplayMode = this.IsClearButtonVisibleAuto() || this.forceShowClearButtonAlways ?
16327    CLEAR_BUTTON_DISPLAY_MODE.ALWAYS : CLEAR_BUTTON_DISPLAY_MODE.NEVER;
16328  }
16329  this.EnsureClearButtonVisibility();
16330 },
16331 InitializeClearButton: function() {
16332  if(this.clearButtonDisplayMode === CLEAR_BUTTON_DISPLAY_MODE.ON_HOVER) {
16333   var mainElement = this.GetMainElement();
16334   ASPx.Evt.AttachMouseEnterToElement(mainElement, this.OnMouseOver.aspxBind(this), this.OnMouseOut.aspxBind(this));
16335  }
16336 },
16337 IsClearButtonVisibleAuto: function() {
16338  return ASPx.Browser.MobileUI;
16339 },
16340 EnsureEmptyValueMaskDisplayText: function() {
16341  if(this.maskInfo && this.HasClearButton()) {
16342   var savedText = this.maskInfo.GetText();
16343   this.maskInfo.SetText("");
16344   this.emptyValueMaskDisplayText = this.maskInfo.GetText();
16345   this.maskInfo.SetText(savedText);
16346  }
16347 },
16348 GetButton: function(number) {
16349  return this.GetChildElement("B" + number);
16350 },
16351 GetCustomButtonCollection: function() {
16352  var buttonElements = [];
16353  for(var i = 0; i < this.buttonCount; i++) {
16354   var button =  this.GetButton(i);
16355   if(!!button)
16356    buttonElements.push(button);
16357  }
16358  return buttonElements;
16359 },
16360 GetButtonCollection: function() {
16361  var buttonElements = [];
16362  var clearButton = this.GetClearButton();
16363  if(!!clearButton)
16364   buttonElements.push(clearButton);
16365  return buttonElements.concat(this.GetCustomButtonCollection());
16366 },
16367 GetAccessibilityAnchor: function(buttonElement) {
16368  var firstChild = buttonElement.firstElementChild;
16369  var isExistsAnchorElement = ASPx.Attr.GetAttribute(firstChild, "role") === "button";
16370  return isExistsAnchorElement ? firstChild : null;
16371 },
16372 GetButtonByAccessibilityAnchor: function(anchorElement) {
16373  return anchorElement.parentNode;
16374 },
16375 SetAccessibilityAnchorEnabled: function(buttonElement, enabled) {
16376  var anchorElement = this.GetAccessibilityAnchor(buttonElement);
16377  if(ASPx.IsExists(anchorElement))
16378   ASPx.Attr.SetOrRemoveAttribute(anchorElement, "tabindex", enabled ? "0" : "");
16379 },
16380 InitAccessibilityCompliant: function() {
16381  if(!this.accessibilityCompliant) return;
16382  var buttonElements = this.GetButtonCollection();
16383  var labelElements = ASPx.FindAssociatedLabelElements(this);
16384  for(var i = 0; i < buttonElements.length; i++)
16385   this.InitAccessibilityAnchor(this.GetAccessibilityAnchor(buttonElements[i]), labelElements);     
16386 },
16387 InitAccessibilityAnchor: function(anchorElement, labelElements) {
16388  if(!ASPx.IsExists(anchorElement))
16389   return;
16390  for(var i = 0; i < labelElements.length; i++)
16391   this.SetOrRemoveAccessibilityAdditionalText([anchorElement], labelElements[i], true, false, false);
16392  ASPx.Evt.AttachEventToElement(anchorElement, "keydown", function(evt) { this.OnButtonKeysHandling(evt); }.aspxBind(this));
16393  ASPx.Evt.AttachEventToElement(anchorElement, "keyup", function(evt) { this.OnButtonKeysHandling(evt); }.aspxBind(this));
16394  ASPx.Evt.AttachEventToElement(anchorElement, "focus", function(evt) { this.OnButtonGotFocus(evt); }.aspxBind(this));
16395  ASPx.Evt.AttachEventToElement(anchorElement, "blur", function(evt) { this.OnButtonLostFocus(evt); }.aspxBind(this));
16396 },
16397 OnButtonKeysHandling: function(evt) {
16398  var isKeyUp = evt.type == "keyup";
16399  var keyCode = ASPx.Evt.GetKeyCode(evt);
16400  var sourceElement = ASPx.Evt.GetEventSource(evt);
16401  if((keyCode == ASPx.Key.Space && isKeyUp) || (keyCode == ASPx.Key.Enter && !isKeyUp)) {
16402   var buttonElement = this.GetButtonByAccessibilityAnchor(sourceElement);
16403   var mouseEvent = buttonElement.onclick || buttonElement.onmousedown || buttonElement.ontouchstart || buttonElement.onpointerdown;
16404   var emulateMouseEvtArgs = { button: 0, which: 1, srcElement: buttonElement, target: buttonElement };
16405   if(!!mouseEvent) {
16406    ASPx.Attr.SetAttribute(sourceElement, "aria-pressed", true);
16407    setTimeout(function() {
16408     mouseEvent(emulateMouseEvtArgs); 
16409     ASPx.Attr.RemoveAttribute(sourceElement, "aria-pressed");
16410    }, 300);
16411   }
16412  }
16413  if(keyCode != ASPx.Key.Tab) {
16414   evt.cancelBubble = true;
16415   evt.preventDefault();
16416  }
16417  return false;
16418 },
16419 OnButtonGotFocus: function(evt) {
16420  var editor = ASPx.GetControlCollection().Get(this.name);
16421  var sourceElement = ASPx.Evt.GetEventSource(evt);
16422  if(!!editor && !editor.CorrectAccessibilityButtonFocus(sourceElement)) {
16423   var buttonElement = editor.GetButtonByAccessibilityAnchor(sourceElement);
16424   ASPx.AddClassNameToElement(buttonElement, AccessibilityFocusedButtonClassName);
16425   ASPx.EGotFocus(editor.name);
16426   if(editor.specialKeyboardHandlingUsed)
16427    ASPx.ESGotFocus(editor.name);
16428  }
16429 },
16430 OnButtonLostFocus: function(evt) {
16431  var editor = ASPx.GetControlCollection().Get(this.name);
16432  var sourceElement = ASPx.Evt.GetEventSource(evt);
16433  if(!!editor) {
16434   var buttonElement = editor.GetButtonByAccessibilityAnchor(sourceElement);
16435   ASPx.RemoveClassNameFromElement(buttonElement, AccessibilityFocusedButtonClassName);
16436  }
16437  setTimeout(function() {
16438   if(!!editor && !editor.IsEditorElement(ASPx.GetActiveElement())) {
16439    ASPx.ELostFocus(editor.name);
16440    if(editor.specialKeyboardHandlingUsed)
16441     ASPx.ESLostFocus(editor.name);
16442   }
16443  }.aspxBind(this), 0);
16444 },
16445 ForceRefocusEditor: function(evt, isNativeFocus) {
16446  if(this.accessibilityCompliant) {
16447   var srcElement = ASPx.Evt.GetEventSource(evt);
16448   var customButtons = this.GetCustomButtonCollection();
16449   for(var i = 0; i < customButtons.length; i++)
16450    if(customButtons[i] == srcElement || ASPx.GetIsParent(customButtons[i], srcElement))
16451     return;
16452  }
16453  ASPxClientEdit.prototype.ForceRefocusEditor.call(this, evt, isNativeFocus);
16454 },
16455 CorrectAccessibilityButtonFocus: function(sourceElement) {
16456  if(ASPx.Attr.IsExistsAttribute(sourceElement, "tabindex"))
16457   return false;
16458  setTimeout(function() {
16459   var buttonElements = this.GetButtonCollection();
16460   for(var i = 0; i < buttonElements.length; i++)
16461    if(ASPx.GetIsParent(buttonElements[i], sourceElement))
16462     this.GetAccessibilityAnchor(buttonElements[i]).focus();
16463  }.aspxBind(this), 0);
16464  return true;
16465 },
16466 OnKeyDown: function(evt) { 
16467  if(this.accessibilityCompliant) {
16468   var hasClearButtonOnHover = this.HasClearButton() && this.clearButtonDisplayMode === CLEAR_BUTTON_DISPLAY_MODE.ON_HOVER;
16469   this.recoverClearButtonVisibility = hasClearButtonOnHover && ASPx.Evt.GetKeyCode(evt) == ASPx.Key.Tab && !evt.shiftKey;
16470  }
16471  ASPxClientTextBoxBase.prototype.OnKeyDown.call(this, evt);
16472 },
16473 SetButtonVisible: function(number, value) {
16474  var button = this.GetButton(number);
16475  if(!button)
16476   return;
16477  var isAlwaysShownClearButton = number === CLEAR_BUTTON_INDEX && this.clearButtonDisplayMode === CLEAR_BUTTON_DISPLAY_MODE.ALWAYS;
16478  var visibilityModifier = isAlwaysShownClearButton ? setContentVisibility : ASPx.SetElementDisplay;
16479  if(isAlwaysShownClearButton && this.accessibilityCompliant)
16480   this.SetAccessibilityAnchorEnabled(button, value);
16481  visibilityModifier(button, value);
16482 },
16483 GetButtonVisible: function(number) {
16484  var button = this.GetButton(number);
16485  if(number === CLEAR_BUTTON_INDEX && this.clearButtonDisplayMode === CLEAR_BUTTON_DISPLAY_MODE.ALWAYS)
16486   return button && !ASPx.ElementHasCssClass(button, HIDE_CONTENT_CSS_CLASS_NAME);
16487  return button && ASPx.IsElementVisible(button);
16488 },
16489 ProcessInternalButtonClick: function(buttonIndex) {
16490  return false;
16491 },
16492 OnButtonClick: function(number) {
16493  var processOnServer = this.RaiseButtonClick(number);
16494  if(!this.ProcessInternalButtonClick(number) && processOnServer)
16495   this.SendPostBack('BC:' + number);
16496 },
16497 GetLastSuccesfullValue: function() {
16498  return this.lastChangedValue;
16499 },
16500 OnClear: function() {
16501  this.ClearEditorValueAndForceOnChange();
16502  this.ForceRefocusEditor(null, true);
16503  window.setTimeout(this.EnsureClearButtonVisibility.aspxBind(this), 0);
16504 },
16505 ClearEditorValueAndForceOnChange: function() {
16506  if(this.readOnly || !this.GetButtonVisible(CLEAR_BUTTON_INDEX))
16507   return;
16508  var raiseOnChange = this.ClearEditorValueByClearButton();
16509  if(raiseOnChange)
16510   this.ForceStandardOnChange();
16511 },
16512 ClearEditorValueByClearButton: function() {
16513  var prevValue = this.GetLastSuccesfullValue();
16514  this.ClearEditorValueByClearButtonCore();
16515  return prevValue !== this.GetValue();
16516 },
16517 ClearEditorValueByClearButtonCore: function() {
16518  this.Clear();
16519  this.GetInputElement().value = '';
16520 },
16521 ForceStandardOnChange: function() {
16522  this.forceValueChanged = true;
16523  this.RaiseStandardOnChange();
16524  this.forceValueChanged = false;
16525 },
16526 IsValueChangeForced: function() {
16527  return this.forceValueChanged || ASPxClientTextBoxBase.prototype.IsValueChangeForced.call(this);
16528 },
16529 IsValueChanging: function() { return this.isValueChanging; },
16530 StartValueChanging: function() { this.isValueChanging = true; },
16531 EndValueChanging: function() { this.isValueChanging = false; },
16532 IsClearButtonElement: function(element) {
16533  return ASPx.GetIsParent(this.GetClearButton(), element);
16534 },
16535 OnFocusCore: function() {
16536  ASPxClientTextBoxBase.prototype.OnFocusCore.call(this);
16537  this.EnsureClearButtonVisibility();
16538 },
16539 OnLostFocusCore: function() {
16540  ASPxClientTextBoxBase.prototype.OnLostFocusCore.call(this);
16541  this.EnsureClearButtonVisibility();
16542  this.recoverClearButtonVisibility = false;
16543 },
16544 GetClearButton: function() {
16545  return this.GetButton(CLEAR_BUTTON_INDEX);
16546 },
16547 HasClearButton: function() {
16548  return !!this.GetClearButton();
16549 },
16550 RequireShowClearButton: function() {
16551  if(!this.clientEnabled || !this.HasClearButton() || this.clearButtonDisplayMode === CLEAR_BUTTON_DISPLAY_MODE.NEVER)
16552   return false;
16553  var isFocused = this.IsFocused();
16554  if(!isFocused && !this.isMouseOver && this.clearButtonDisplayMode !== CLEAR_BUTTON_DISPLAY_MODE.ALWAYS && !this.recoverClearButtonVisibility)
16555   return false;
16556  if(isFocused)
16557   return this.RequireShowClearButtonCore();
16558  return !this.IsNullState();
16559 },
16560 IsFocused: function() {
16561  return this === ASPx.GetFocusedEditor();
16562 },
16563 IsNullState: function() {
16564  return this.IsNull(this.GetValue());
16565 },
16566 RequireShowClearButtonCore: function() {
16567  var inputText = this.GetInputElement().value;
16568  return inputText !== this.GetEmptyValueDisplayText();
16569 },
16570 GetEmptyValueDisplayText: function() { 
16571  return this.maskInfo ? this.emptyValueMaskDisplayText : "";
16572 },
16573 EnsureClearButtonVisibility: function() {
16574  this.SetButtonVisible(CLEAR_BUTTON_INDEX, this.RequireShowClearButton());
16575 },
16576 OnMouseOver: function() {
16577  this.isMouseOver = true;
16578  this.EnsureClearButtonVisibility();
16579 },
16580 OnMouseOut: function() {
16581  this.isMouseOver = false;
16582  this.EnsureClearButtonVisibility();
16583 },
16584 OnKeyPress: function(evt) {
16585  if(this.allowUserInput)
16586   ASPxClientTextBoxBase.prototype.OnKeyPress.call(this, evt);
16587 },
16588 OnKeyEventEnd: function(evt, withDelay) {
16589  ASPxClientTextBoxBase.prototype.OnKeyEventEnd.call(this, evt, withDelay);
16590  this.EnsureClearButtonVisibility();
16591 },
16592 RaiseButtonClick: function(number){
16593  var processOnServer = this.autoPostBack || this.IsServerEventAssigned("ButtonClick");
16594  if(!this.ButtonClick.IsEmpty()){
16595   var args = new ASPxClientButtonEditClickEventArgs(processOnServer, number);
16596   this.ButtonClick.FireEvent(this, args);
16597   processOnServer = args.processOnServer;
16598  }
16599  return processOnServer;
16600 },
16601 ChangeEnabledAttributes: function(enabled){
16602  ASPxClientTextEdit.prototype.ChangeEnabledAttributes.call(this, enabled);
16603  for(var i = 0; i < this.buttonCount; i++){
16604   var element = this.GetButton(i);
16605   if(element)
16606    this.ChangeButtonEnabledAttributes(element, ASPx.Attr.ChangeAttributesMethod(enabled));
16607  }
16608  if(this.accessibilityCompliant)
16609   this.ChangeAccessibilityButtonEnabledAttributes(enabled);
16610 },
16611 ChangeEnabledStateItems: function(enabled){
16612  ASPxClientTextEdit.prototype.ChangeEnabledStateItems.call(this, enabled);
16613  for(var i = 0; i < this.buttonCount; i++){
16614   var element = this.GetButton(i);
16615   if(element) 
16616    ASPx.GetStateController().SetElementEnabled(element, enabled);
16617  }
16618 },
16619 ChangeButtonEnabledAttributes: function(element, method){
16620  method(element, "onclick");
16621  method(element, "ondblclick");
16622  if(ASPx.Browser.Edge)
16623   method(element, "onmousedown");
16624  method(element, "on" + ASPx.TouchUIHelper.touchMouseDownEventName);
16625  method(element, "on" + ASPx.TouchUIHelper.touchMouseUpEventName);
16626 },
16627 ChangeInputEnabled: function(element, enabled, readOnly) {
16628  ASPxClientTextEdit.prototype.ChangeInputEnabled.call(this, element, enabled, readOnly || !this.allowUserInput);
16629 },
16630 ChangeAccessibilityButtonEnabledAttributes: function(enabled) {
16631  var buttonElements = this.GetButtonCollection();
16632  for(var i = 0; i < buttonElements.length; i++)
16633   this.SetAccessibilityAnchorEnabled(buttonElements[i], enabled);
16634 },
16635 SetValue: function(value) {
16636  ASPxClientTextEdit.prototype.SetValue.call(this, value);
16637  if(!this.IsFocused())
16638   this.EnsureClearButtonVisibility();
16639 }
16640});
16641var ASPxClientButtonEdit = ASPx.CreateClass(ASPxClientButtonEditBase, {
16642});
16643ASPxClientButtonEdit.Cast = ASPxClientControl.Cast;
16644var ASPxClientButtonEditClickEventArgs = ASPx.CreateClass(ASPxClientProcessingModeEventArgs, {
16645 constructor: function(processOnServer, buttonIndex){
16646  this.constructor.prototype.constructor.call(this, processOnServer);
16647  this.buttonIndex = buttonIndex;
16648 }
16649});
16650var ASPxClientTextEditHelpTextHAlign = {
16651 Left: "Left",
16652 Right: "Right",
16653 Center: "Center"
16654};
16655var ASPxClientTextEditHelpTextVAlign = {
16656 Top: "Top",
16657 Bottom: "Bottom",
16658 Middle: "Middle"
16659};
16660var ASPxClientTextEditHelpTextDisplayMode = {
16661 Inline: "Inline",
16662 Popup: "Popup"
16663};
16664var ASPxClientTextEditHelpTextConsts = {
16665 VERTICAL_ORIENTATION_CLASS_NAME: "dxeVHelpTextSys",
16666 HORIZONTAL_ORIENTATION_CLASS_NAME: "dxeHHelpTextSys"
16667};
16668var ASPxClientTextEditHelpText = ASPx.CreateClass(null, {
16669 constructor: function (editor, helpTextStyle, helpText, position, hAlign, vAlign, margins, animationEnabled, helpTextDisplayMode) {
16670  this.hAlign = hAlign;
16671  this.vAlign = vAlign;
16672  this.animationEnabled = animationEnabled;
16673  this.displayMode = helpTextDisplayMode;
16674  this.editor = editor;
16675  this.editorMainElement = editor.GetMainElement();
16676  this.margins = margins ? { Top: margins[0], Right: margins[1], Bottom: margins[2], Left: margins[3] } : null;
16677  this.defaultMargins = { Top: 10, Right: 10, Bottom: 10, Left: 10 };
16678  this.position = position;
16679  this.helpTextElement = this.createHelpTextElement();
16680  this.setHelpTextZIndex(true);
16681  this.prepareHelpTextElement(helpTextStyle, helpText);
16682 },
16683 getRows: function (table) {
16684  return ASPx.GetChildNodesByTagName(table, "TR");
16685 },
16686 getCells: function (row) {
16687  return ASPx.GetChildNodesByTagName(row, "TD");
16688 },
16689 getCellByIndex: function(row, cellIndex) {
16690  return this.getCells(row)[cellIndex];
16691 },
16692 getCellIndex: function(row, cell) {
16693  var cells = this.getCells(row);
16694  for(var i = 0; i < cells.length; i++) {
16695   if(cells[i] === cell)
16696    return i;
16697  }
16698 },
16699 isHorizontal: function(position) {
16700  return position === ASPx.Position.Left || position === ASPx.Position.Right;
16701 },
16702 isVertical: function (position) {
16703  return position === ASPx.Position.Top || position === ASPx.Position.Bottom;
16704 },
16705 createEmptyCell: function(assignClassName) {
16706  var cell = document.createElement("TD");
16707  if(assignClassName)
16708   cell.className = "dxeFakeEmptyCell";
16709  return cell;
16710 },
16711 addHelpTextCellToExternalTableWithTwoCells: function (captionCell, errorCell, helpTextCell, errorTableBody, tableRows) {
16712  var captionPosition = this.editor.captionPosition;
16713  var errorCellPosition = this.editor.errorCellPosition;
16714  var helpTextRow = this.isVertical(this.position) ? document.createElement("TR") : null;
16715  if(captionPosition === ASPx.Position.Left && this.position === ASPx.Position.Left && this.isHorizontal(errorCellPosition))
16716   captionCell.parentNode.insertBefore(helpTextCell, captionCell.nextSibling);
16717  if(captionPosition === ASPx.Position.Right && this.position === ASPx.Position.Right && this.isHorizontal(errorCellPosition))
16718   captionCell.parentNode.insertBefore(helpTextCell, captionCell);
16719  if(captionPosition === ASPx.Position.Left && this.position === ASPx.Position.Right && this.isHorizontal(errorCellPosition))
16720   tableRows[0].appendChild(helpTextCell);
16721  if(captionPosition === ASPx.Position.Right && this.position === ASPx.Position.Left && this.isHorizontal(errorCellPosition))
16722   tableRows[0].insertBefore(helpTextCell, tableRows[0].childNodes[0]);
16723  if(captionPosition === ASPx.Position.Top && this.position === ASPx.Position.Bottom && this.isVertical(errorCellPosition)) {
16724   helpTextRow.appendChild(helpTextCell);
16725   errorTableBody.appendChild(helpTextRow);
16726  }
16727  if(captionPosition === ASPx.Position.Bottom && this.position === ASPx.Position.Top && this.isVertical(errorCellPosition)) {
16728   helpTextRow.appendChild(helpTextCell);
16729   errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
16730  }
16731  if(captionPosition === ASPx.Position.Top && this.position === ASPx.Position.Top && this.isVertical(errorCellPosition)) {
16732   helpTextRow.appendChild(helpTextCell);
16733   errorTableBody.insertBefore(helpTextRow, captionCell.parentNode.nextSibling);
16734  }
16735  if(captionPosition === ASPx.Position.Bottom && this.position === ASPx.Position.Bottom && this.isVertical(errorCellPosition)) {
16736   helpTextRow.appendChild(helpTextCell);
16737   errorTableBody.insertBefore(helpTextRow, captionCell.parentNode);
16738  }
16739  if(captionPosition === ASPx.Position.Right && this.position === ASPx.Position.Top && this.isVertical(errorCellPosition)) {
16740   helpTextRow.appendChild(helpTextCell);
16741   helpTextRow.appendChild(this.createEmptyCell());
16742   errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
16743  }
16744  if(this.position === ASPx.Position.Bottom) {
16745   if(captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Top || captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Right) {
16746    helpTextRow.appendChild(helpTextCell);
16747    helpTextRow.appendChild(this.createEmptyCell());
16748    errorTableBody.appendChild(helpTextRow);
16749   }
16750  }
16751  if(captionPosition === ASPx.Position.Left && this.position === ASPx.Position.Top && this.isVertical(errorCellPosition)) {
16752   helpTextRow.appendChild(this.createEmptyCell());
16753   helpTextRow.appendChild(helpTextCell);
16754   errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
16755  }
16756  if(captionPosition === ASPx.Position.Left && this.position === ASPx.Position.Bottom && this.isVertical(errorCellPosition)) {
16757   helpTextRow.appendChild(this.createEmptyCell());
16758   helpTextRow.appendChild(helpTextCell);
16759   errorTableBody.appendChild(helpTextRow);
16760  }
16761  if(this.position === ASPx.Position.Right) {
16762   if(captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Left || captionPosition === ASPx.Position.Left && errorCellPosition === ASPx.Position.Top
16763    || captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Right) {
16764    tableRows[1].appendChild(helpTextCell);
16765    tableRows[0].appendChild(this.createEmptyCell());
16766   }
16767   if(captionPosition === ASPx.Position.Left && errorCellPosition === ASPx.Position.Bottom || captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Left) {
16768    tableRows[0].appendChild(helpTextCell);
16769    tableRows[1].appendChild(this.createEmptyCell());
16770   }
16771  }
16772  if(this.position === ASPx.Position.Left) {
16773   if(captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Top || captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Right
16774    || captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Left) {
16775    tableRows[1].insertBefore(helpTextCell, tableRows[1].childNodes[0]);
16776    tableRows[0].insertBefore(this.createEmptyCell(), tableRows[0].childNodes[0]);
16777   }
16778   if(captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Top || captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Bottom) {
16779    tableRows[1].insertBefore(helpTextCell, tableRows[1].childNodes[0]);
16780    tableRows[0].insertBefore(this.createEmptyCell(errorCellPosition === ASPx.Position.Top), tableRows[0].childNodes[0]);
16781    tableRows[2].insertBefore(this.createEmptyCell(errorCellPosition !== ASPx.Position.Top), tableRows[2].childNodes[0]);
16782   }
16783   if(captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Top) {
16784    tableRows[2].insertBefore(helpTextCell, tableRows[2].childNodes[0]);
16785    tableRows[0].insertBefore(this.createEmptyCell(false), tableRows[0].childNodes[0]);
16786    tableRows[1].insertBefore(this.createEmptyCell(true), tableRows[1].childNodes[0]);
16787   }
16788   if(captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Bottom) {
16789    tableRows[0].insertBefore(helpTextCell, tableRows[0].childNodes[0]);
16790    tableRows[1].insertBefore(this.createEmptyCell(true), tableRows[1].childNodes[0]);
16791    tableRows[2].insertBefore(this.createEmptyCell(false), tableRows[2].childNodes[0]);
16792   }
16793   if(captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Left || captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Bottom
16794    || captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Right) {
16795    tableRows[0].insertBefore(helpTextCell, tableRows[0].childNodes[0]);
16796    tableRows[1].insertBefore(this.createEmptyCell(), tableRows[1].childNodes[0]);
16797   }
16798   if(captionPosition === ASPx.Position.Left && this.isVertical(errorCellPosition)) {
16799    captionCell.parentNode.insertBefore(helpTextCell, captionCell.nextSibling);
16800    var emptyCellParentRow = errorCellPosition === ASPx.Position.Top ? tableRows[0] : tableRows[1];
16801    var helpTextCellIndex = this.getCellIndex(helpTextCell.parentNode, helpTextCell);
16802    emptyCellParentRow.insertBefore(this.createEmptyCell(), this.getCellByIndex(emptyCellParentRow, helpTextCellIndex));
16803   }
16804  }
16805  if(this.position === ASPx.Position.Right) {
16806   if(captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Top || captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Bottom) {
16807    tableRows[1].appendChild(helpTextCell);
16808    tableRows[0].appendChild(this.createEmptyCell(errorCellPosition === ASPx.Position.Top));
16809    tableRows[2].appendChild(this.createEmptyCell(errorCellPosition !== ASPx.Position.Top));
16810   }
16811   if(captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Top) {
16812    tableRows[2].appendChild(helpTextCell);
16813    tableRows[0].appendChild(this.createEmptyCell(false));
16814    tableRows[1].appendChild(this.createEmptyCell(true));
16815   }
16816   if(captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Bottom) {
16817    tableRows[0].appendChild(helpTextCell);
16818    tableRows[1].appendChild(this.createEmptyCell(true));
16819    tableRows[2].appendChild(this.createEmptyCell(false));
16820   }
16821   if(captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Right) {
16822    tableRows[0].appendChild(helpTextCell);
16823    tableRows[1].appendChild(this.createEmptyCell());
16824   }
16825   if(captionPosition === ASPx.Position.Right && this.isVertical(errorCellPosition)) {
16826    captionCell.parentNode.insertBefore(helpTextCell, captionCell);
16827    var emptyCellParentRow = errorCellPosition === ASPx.Position.Top ? tableRows[0] : tableRows[1];
16828    var helpTextCellIndex = this.getCellIndex(helpTextCell.parentNode, helpTextCell);
16829    emptyCellParentRow.insertBefore(this.createEmptyCell(), this.getCellByIndex(emptyCellParentRow, helpTextCellIndex));
16830   }
16831  }
16832  if(captionPosition === ASPx.Position.Top && this.position === ASPx.Position.Top && this.isHorizontal(errorCellPosition)) {
16833   if(errorCellPosition === ASPx.Position.Left) {
16834    helpTextRow.appendChild(this.createEmptyCell(true));
16835    helpTextRow.appendChild(helpTextCell);
16836   }
16837   else {
16838    helpTextRow.appendChild(helpTextCell);
16839    helpTextRow.appendChild(this.createEmptyCell());
16840   }
16841   errorTableBody.insertBefore(helpTextRow, captionCell.parentNode.nextSibling);
16842  }
16843  if(captionPosition === ASPx.Position.Bottom && this.position === ASPx.Position.Top && this.isHorizontal(errorCellPosition)) {
16844   if(errorCellPosition === ASPx.Position.Left) {
16845    helpTextRow.appendChild(this.createEmptyCell(true));
16846    helpTextRow.appendChild(helpTextCell);
16847   }
16848   else {
16849    helpTextRow.appendChild(helpTextCell);
16850    helpTextRow.appendChild(this.createEmptyCell());
16851   }
16852   errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
16853  }
16854  if(captionPosition === ASPx.Position.Bottom && this.position === ASPx.Position.Bottom && this.isHorizontal(errorCellPosition)) {
16855   if(errorCellPosition === ASPx.Position.Left) {
16856    helpTextRow.appendChild(this.createEmptyCell(true));
16857    helpTextRow.appendChild(helpTextCell);
16858   }
16859   else {
16860    helpTextRow.appendChild(helpTextCell);
16861    helpTextRow.appendChild(this.createEmptyCell());
16862   }
16863   errorTableBody.insertBefore(helpTextRow, captionCell.parentNode);
16864  }
16865  if(captionPosition === ASPx.Position.Top && this.position === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Left) {
16866   helpTextRow.appendChild(this.createEmptyCell(true));
16867   helpTextRow.appendChild(helpTextCell);
16868   errorTableBody.appendChild(helpTextRow);
16869  }
16870  if(captionPosition === ASPx.Position.Right && this.position === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Bottom) {
16871   helpTextRow.appendChild(helpTextCell);
16872   helpTextRow.appendChild(this.createEmptyCell());
16873   errorTableBody.appendChild(helpTextRow);
16874  }
16875  if(this.position === ASPx.Position.Bottom) {
16876   if(captionPosition === ASPx.Position.Left && errorCellPosition === ASPx.Position.Right || captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Left) {
16877    helpTextRow.appendChild(this.createEmptyCell(errorCellPosition !== ASPx.Position.Right));
16878    helpTextRow.appendChild(helpTextCell);
16879    helpTextRow.appendChild(this.createEmptyCell(errorCellPosition === ASPx.Position.Right));
16880    errorTableBody.appendChild(helpTextRow);
16881   }
16882   if(captionPosition === ASPx.Position.Left && errorCellPosition === ASPx.Position.Left) {
16883    helpTextRow.appendChild(this.createEmptyCell(false));
16884    helpTextRow.appendChild(this.createEmptyCell(true));
16885    helpTextRow.appendChild(helpTextCell);
16886    errorTableBody.appendChild(helpTextRow);
16887   }
16888   if(captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Right) {
16889    helpTextRow.appendChild(helpTextCell);
16890    helpTextRow.appendChild(this.createEmptyCell(true));
16891    helpTextRow.appendChild(this.createEmptyCell(false));
16892    errorTableBody.appendChild(helpTextRow);
16893   }   
16894  }
16895  if(this.position === ASPx.Position.Top) {
16896   if(captionPosition === ASPx.Position.Left && errorCellPosition === ASPx.Position.Right || captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Left) {
16897    helpTextRow.appendChild(this.createEmptyCell(errorCellPosition !== ASPx.Position.Right));
16898    helpTextRow.appendChild(helpTextCell);
16899    helpTextRow.appendChild(this.createEmptyCell(errorCellPosition === ASPx.Position.Right));
16900    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
16901   }
16902   if(captionPosition === ASPx.Position.Left && errorCellPosition === ASPx.Position.Left) {
16903    helpTextRow.appendChild(this.createEmptyCell(false));
16904    helpTextRow.appendChild(this.createEmptyCell(true));
16905    helpTextRow.appendChild(helpTextCell);
16906    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
16907   }
16908   if(captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Right) {
16909    helpTextRow.appendChild(helpTextCell);
16910    helpTextRow.appendChild(this.createEmptyCell(true));
16911    helpTextRow.appendChild(this.createEmptyCell(false));
16912    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
16913   }
16914  }
16915 },
16916 addHelpTextCellToExternalTableWithErrorCell: function (errorCell, helpTextCell, errorTableBody, tableRows) {
16917  var errorCellPosition = this.editor.errorCellPosition;
16918  var helpTextRow = document.createElement("TR");
16919  if(this.position === ASPx.Position.Left && this.isHorizontal(errorCellPosition))
16920   tableRows[0].insertBefore(helpTextCell, tableRows[0].childNodes[0]);
16921  if(this.position === ASPx.Position.Right && this.isHorizontal(errorCellPosition))
16922   tableRows[0].appendChild(helpTextCell);
16923  if(this.position === ASPx.Position.Top && this.isVertical(errorCellPosition)) {
16924   helpTextRow.appendChild(helpTextCell);
16925   errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
16926  }
16927  if(this.position === ASPx.Position.Bottom && this.isVertical(errorCellPosition)) {
16928   helpTextRow.appendChild(helpTextCell);
16929   errorTableBody.appendChild(helpTextRow);
16930  }
16931  if(errorCellPosition === ASPx.Position.Left && this.isVertical(this.po
16931sition)) {
16932   helpTextRow.appendChild(this.createEmptyCell(true));
16933   helpTextRow.appendChild(helpTextCell);
16934   if(this.position === ASPx.Position.Top)
16935    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
16936   else
16937    errorTableBody.appendChild(helpTextRow);
16938  }
16939  if(errorCellPosition === ASPx.Position.Right && this.isVertical(this.position)) {
16940   helpTextRow.appendChild(helpTextCell);
16941   helpTextRow.appendChild(this.createEmptyCell(true));
16942   if(this.position === ASPx.Position.Top)
16943    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
16944   else
16945    errorTableBody.appendChild(helpTextRow);
16946  }
16947  if(this.position === ASPx.Position.Left && this.isVertical(errorCellPosition)) {
16948   var helpTextParentRowIndex = errorCellPosition === ASPx.Position.Top ? 1 : 0;
16949   var emptyCellRowIndex = helpTextParentRowIndex === 0 ? 1 : 0;
16950   tableRows[helpTextParentRowIndex].insertBefore(helpTextCell, tableRows[helpTextParentRowIndex].childNodes[0]);
16951   tableRows[emptyCellRowIndex].insertBefore(this.createEmptyCell(true), tableRows[emptyCellRowIndex].childNodes[0]);
16952  }
16953  if(this.position === ASPx.Position.Right && this.isVertical(errorCellPosition)) {
16954   var helpTextParentRowIndex = errorCellPosition === ASPx.Position.Top ? 1 : 0;
16955   var emptyCellRowIndex = helpTextParentRowIndex === 0 ? 1 : 0;
16956   tableRows[helpTextParentRowIndex].appendChild(helpTextCell);
16957   tableRows[emptyCellRowIndex].appendChild(this.createEmptyCell(true));
16958  }
16959 },
16960 addHelpTextCellToExternalTableWithCaption: function (captionCell, helpTextCell, errorTableBody, tableRows) {
16961  var captionPosition = this.editor.captionPosition;
16962  var helpTextRow = document.createElement("TR");
16963  if(captionPosition === ASPx.Position.Left && this.isVertical(this.position)) {
16964   helpTextRow.appendChild(this.createEmptyCell());
16965   helpTextRow.appendChild(helpTextCell);
16966   if(this.position === ASPx.Position.Top)
16967    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
16968   else
16969    errorTableBody.appendChild(helpTextRow);
16970  }
16971  if(this.position === ASPx.Position.Left && this.isVertical(captionPosition)) {
16972   var helpTextParentRowIndex = captionPosition === ASPx.Position.Top ? 1 : 0;
16973   var emptyCellParentRowIndex = helpTextParentRowIndex === 0 ? 1 : 0;
16974   tableRows[helpTextParentRowIndex].insertBefore(helpTextCell, tableRows[helpTextParentRowIndex].childNodes[0]);
16975   tableRows[emptyCellParentRowIndex].insertBefore(this.createEmptyCell(), tableRows[emptyCellParentRowIndex].childNodes[0]);
16976  }
16977  if(this.position === ASPx.Position.Right && this.isVertical(captionPosition)) {
16978   var helpTextParentRowIndex = captionPosition === ASPx.Position.Top ? 1 : 0;
16979   var emptyCellParentRowIndex = helpTextParentRowIndex === 0 ? 1 : 0;
16980   tableRows[helpTextParentRowIndex].appendChild(helpTextCell);
16981   tableRows[emptyCellParentRowIndex].appendChild(this.createEmptyCell());
16982  }
16983  if(captionPosition === ASPx.Position.Right && this.isVertical(this.position)) {
16984   helpTextRow.appendChild(helpTextCell);
16985   helpTextRow.appendChild(this.createEmptyCell());
16986   if(this.position === ASPx.Position.Top)
16987    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
16988   else
16989    errorTableBody.appendChild(helpTextRow);
16990  }
16991  if(this.isVertical(captionPosition) && this.isVertical(this.position)) {
16992   helpTextRow.appendChild(helpTextCell);
16993   if(captionPosition === ASPx.Position.Top && this.position === ASPx.Position.Top)
16994    errorTableBody.insertBefore(helpTextRow, captionCell.parentNode.nextSibling);
16995   if(captionPosition === ASPx.Position.Top && this.position === ASPx.Position.Bottom)
16996    errorTableBody.appendChild(helpTextRow);
16997   if(captionPosition === ASPx.Position.Bottom && this.position === ASPx.Position.Top)
16998    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
16999   if(captionPosition === ASPx.Position.Bottom && this.position === ASPx.Position.Bottom)
17000    errorTableBody.insertBefore(helpTextRow, captionCell.parentNode);
17001  }
17002  if(captionPosition === ASPx.Position.Left && this.position === ASPx.Position.Left)
17003   captionCell.parentNode.insertBefore(helpTextCell, captionCell.nextSibling);
17004  if(captionPosition === ASPx.Position.Right && this.position === ASPx.Position.Right)
17005   captionCell.parentNode.insertBefore(helpTextCell, captionCell);
17006  if(captionPosition === ASPx.Position.Left && this.position === ASPx.Position.Right)
17007   tableRows[0].appendChild(helpTextCell);
17008  if(captionPosition === ASPx.Position.Right && this.position === ASPx.Position.Left)
17009   tableRows[0].insertBefore(helpTextCell, tableRows[0].childNodes[0]);
17010 },
17011 addHelpTextCellToExternalTableWithEditorOnly: function (helpTextCell, errorTableBody, tableRows) {
17012  if(this.isHorizontal(this.position)) {
17013   if(this.position === ASPx.Position.Left)
17014    tableRows[0].insertBefore(helpTextCell, tableRows[0].childNodes[0]);
17015   else
17016    tableRows[0].appendChild(helpTextCell);
17017  }
17018  else {
17019   var helpTextRow = document.createElement("TR");
17020   helpTextRow.appendChild(helpTextCell);
17021   if(this.position === ASPx.Position.Top)
17022    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
17023   else
17024    errorTableBody.appendChild(helpTextRow);
17025  }
17026 },
17027 addHelpTextCellToExternalTable: function (errorTable, helpTextCell) {
17028  var errorTableBody = ASPx.GetNodeByTagName(errorTable, "TBODY", 0);
17029  var tableRows = this.getRows(errorTableBody);
17030  var captionCell = this.editor.GetCaptionCell();
17031  var errorCell = this.editor.GetErrorCell();
17032  if(captionCell) {
17033   if(errorCell)
17034    this.addHelpTextCellToExternalTableWithTwoCells(captionCell, errorCell, helpTextCell, errorTableBody, tableRows);
17035   else
17036    this.addHelpTextCellToExternalTableWithCaption(captionCell, helpTextCell, errorTableBody, tableRows);
17037  }
17038  else if(errorCell)
17039   this.addHelpTextCellToExternalTableWithErrorCell(errorCell, helpTextCell, errorTableBody, tableRows);
17040  else
17041   this.addHelpTextCellToExternalTableWithEditorOnly(helpTextCell, errorTableBody, tableRows);
17042 },
17043 createExternalTable: function () {
17044  var externalTable = document.createElement("TABLE");
17045  externalTable.id = this.editor.name + ASPx.EditElementSuffix.ExternalTable;
17046  externalTable.cellPadding = 0;
17047  externalTable.cellSpacing = 0;
17048  this.applyExternalTableStyle(externalTable);
17049  var editorWidth = this.editorMainElement.style.width;
17050  if(ASPx.IsPercentageSize(editorWidth)) {
17051   externalTable.style.width = editorWidth;
17052   this.editorMainElement.style.width = "100%";
17053   this.editor.width = "100%";
17054  }
17055  var externalTableBody = document.createElement("TBODY");
17056  var externalTableRow = document.createElement("TR");
17057  var externalTableCell = document.createElement("TD");
17058  externalTable.appendChild(externalTableBody);
17059  externalTableBody.appendChild(externalTableRow);
17060  externalTableRow.appendChild(externalTableCell);
17061  this.editorMainElement.parentNode.appendChild(externalTable);
17062  ASPx.ChangeElementContainer(this.editorMainElement, externalTableCell, true);
17063  return externalTable;
17064 },
17065 applyExternalTableStyle: function (externalTable) {
17066  var externalTableStyle = this.editor.externalTableStyle;
17067  if(externalTableStyle.length > 0) {
17068   this.applyStyleToElement(externalTable, externalTableStyle);
17069  }
17070 },
17071 applyStyleToElement: function(element, style) {
17072  element.className = style[0];
17073  if(style[1]) {
17074   var styleSheet = ASPx.GetCurrentStyleSheet();
17075   element.className += " " + ASPx.CreateImportantStyleRule(styleSheet, style[1]);
17076  }
17077 },
17078 createInlineHelpTextElement: function () {
17079  var helpTextElement = document.createElement("TD");
17080  var externalTable = this.editor.GetExternalTable();
17081  if(!externalTable)
17082   externalTable = this.createExternalTable();
17083  this.addHelpTextCellToExternalTable(externalTable, helpTextElement);
17084  return helpTextElement;
17085 },
17086 createPopupHelpTextElement: function () {
17087  var helpTextElement = document.createElement("DIV");
17088  document.body.appendChild(helpTextElement);
17089  ASPx.AnimationHelper.setOpacity(helpTextElement, 0);
17090  return helpTextElement;
17091 },
17092 createHelpTextElement: function () {
17093  return this.displayMode === ASPxClientTextEditHelpTextDisplayMode.Popup ?
17094   this.createPopupHelpTextElement() : this.createInlineHelpTextElement();
17095 },
17096 prepareHelpTextElement: function (helpTextStyle, helpText) {
17097  this.helpTextElement.id = this.getHelpTextElementId();
17098  this.applyStyleToElement(this.helpTextElement, helpTextStyle);
17099  ASPx.SetInnerHtml(this.helpTextElement, "<SPAN>" + helpText + "</SPAN>");
17100  if(this.displayMode === ASPxClientTextEditHelpTextDisplayMode.Popup)
17101   this.updatePopupHelpTextPosition();
17102  else {
17103   var isVerticalOrientation = this.position === ASPx.Position.Top || this.position === ASPx.Position.Bottom;
17104   var orientationClassName = isVerticalOrientation ? ASPxClientTextEditHelpTextConsts.VERTICAL_ORIENTATION_CLASS_NAME :
17105    ASPxClientTextEditHelpTextConsts.HORIZONTAL_ORIENTATION_CLASS_NAME;
17106   this.helpTextElement.className += " " + orientationClassName;
17107   this.setInlineHelpTextElementAlign();
17108   ASPx.SetElementDisplay(this.helpTextElement, this.editor.clientVisible);
17109  }
17110 },
17111 getHelpTextElementId: function() {
17112  return this.editor.name + ASPx.TEHelpTextElementSuffix;
17113 },
17114 setInlineHelpTextElementAlign: function() {
17115  var hAlignValue = "", vAlignValue = "";
17116  switch(this.hAlign) {
17117   case ASPxClientTextEditHelpTextHAlign.Left: hAlignValue = "left"; break;
17118   case ASPxClientTextEditHelpTextHAlign.Right: hAlignValue = "right"; break;
17119   case ASPxClientTextEditHelpTextHAlign.Center: hAlignValue = "center"; break;
17120  }
17121  switch(this.vAlign) {
17122   case ASPxClientTextEditHelpTextVAlign.Top: vAlignValue = "top"; break;
17123   case ASPxClientTextEditHelpTextVAlign.Bottom: vAlignValue = "bottom"; break;
17124   case ASPxClientTextEditHelpTextVAlign.Middle: vAlignValue = "middle"; break;
17125  }
17126  this.helpTextElement.style.textAlign = hAlignValue;
17127  this.helpTextElement.style.verticalAlign = vAlignValue;
17128 },
17129 getHelpTextMargins: function() {
17130  if(this.margins)
17131   return this.margins;
17132  var result = this.defaultMargins;
17133  if(this.position === ASPx.Position.Top || this.position === ASPx.Position.Bottom)
17134   result.Left = result.Right = 0;
17135  else
17136   result.Top = result.Bottom = 0;
17137  return result;
17138 },
17139 updatePopupHelpTextPosition: function (editorMainElement) {
17140  var editorWidth = this.editorMainElement.offsetWidth;
17141  var editorHeight = this.editorMainElement.offsetHeight;
17142  var helpTextWidth = this.helpTextElement.offsetWidth;
17143  var helpTextHeight = this.helpTextElement.offsetHeight;
17144  var editorX = ASPx.GetAbsoluteX(this.editorMainElement);
17145  var editorY = ASPx.GetAbsoluteY(this.editorMainElement);
17146  var helpTextX = 0, helpTextY = 0;
17147  var margins = this.getHelpTextMargins();
17148  if(this.position === ASPx.Position.Top || this.position === ASPx.Position.Bottom) {
17149   if(this.position === ASPx.Position.Top)
17150    helpTextY = editorY - margins.Bottom - helpTextHeight;
17151   else if(this.position === ASPx.Position.Bottom)
17152    helpTextY = editorY + editorHeight + margins.Top;
17153   if(this.hAlign === ASPxClientTextEditHelpTextHAlign.Left)
17154    helpTextX = editorX + margins.Left;
17155   else if(this.hAlign === ASPxClientTextEditHelpTextHAlign.Right)
17156    helpTextX = editorX + editorWidth - helpTextWidth - margins.Right;
17157   else if(this.hAlign === ASPxClientTextEditHelpTextHAlign.Center) {
17158    var editorCenterX = editorX + editorWidth / 2;
17159    var helpTextWidthWithMargins = helpTextWidth + margins.Left + margins.Right;
17160    helpTextX = editorCenterX - helpTextWidthWithMargins / 2 + margins.Left;
17161   }
17162  } else {
17163   if(this.position === ASPx.Position.Left)
17164    helpTextX = editorX - margins.Right - helpTextWidth;
17165   else if(this.position === ASPx.Position.Right)
17166    helpTextX = editorX + editorWidth + margins.Left;
17167   if(this.vAlign === ASPxClientTextEditHelpTextVAlign.Top)
17168    helpTextY = editorY + margins.Top;
17169   else if(this.vAlign === ASPxClientTextEditHelpTextVAlign.Bottom)
17170    helpTextY = editorY + editorHeight - helpTextHeight - margins.Bottom;
17171   else if(this.vAlign === ASPxClientTextEditHelpTextVAlign.Middle) {
17172    var editorCenterY = editorY + editorHeight / 2;
17173    var helpTextHeightWithMargins = helpTextHeight + margins.Top + margins.Bottom;
17174    helpTextY = editorCenterY - helpTextHeightWithMargins / 2 + margins.Top;
17175   }
17176  }
17177  helpTextX = helpTextX < 0 ? 0 : helpTextX;
17178  helpTextY = helpTextY < 0 ? 0 : helpTextY;
17179  ASPx.SetAbsoluteX(this.helpTextElement, helpTextX);
17180  ASPx.SetAbsoluteY(this.helpTextElement, helpTextY);
17181 },
17182 setHelpTextZIndex: function (hide) { 
17183  var newZIndex = 41998 * (hide ? -1 : 1);
17184  if(this.helpTextElement.style.zIndex != newZIndex)
17185   this.helpTextElement.style.zIndex = newZIndex;
17186 },
17187 hide: function () {
17188  if(this.displayMode === ASPxClientTextEditHelpTextDisplayMode.Inline) {
17189   ASPx.SetElementDisplay(this.helpTextElement, false);
17190  }
17191  else {
17192   this.animationEnabled ? ASPx.AnimationHelper.fadeOut(this.helpTextElement) :
17193    ASPx.AnimationHelper.setOpacity(this.helpTextElement, 0);
17194   this.setHelpTextZIndex(true);
17195  }
17196 },
17197 show: function () {
17198  if(this.displayMode === ASPxClientTextEditHelpTextDisplayMode.Inline) {
17199   ASPx.SetElementDisplay(this.helpTextElement, true);
17200  }
17201  else {
17202   this.updatePopupHelpTextPosition();
17203   this.animationEnabled ? ASPx.AnimationHelper.fadeIn(this.helpTextElement) :
17204    ASPx.AnimationHelper.setOpacity(this.helpTextElement, 1);
17205   this.setHelpTextZIndex(false);
17206  }
17207 }
17208});
17209var ASPxOutOfRangeWarningManager = ASPx.CreateClass(null, {
17210 constructor: function (editor, minValue, maxValue, defaultMinValue, defaultMaxValue, outOfRangeWarningElementPosition, valueFormatter) {
17211  this.editor = editor;
17212  this.outOfRangeWarningElementPosition = outOfRangeWarningElementPosition;
17213  this.minValue = minValue;
17214  this.maxValue = maxValue;
17215  this.defaultMinValue = defaultMinValue;
17216  this.defaultMaxValue = defaultMaxValue;
17217  this.minMaxValueFormatter = valueFormatter;
17218  this.animationDuration = 150;
17219  this.CreateOutOfRangeWarningElement();
17220 },
17221 SetMinValue: function (minValue) {
17222  this.minValue = minValue;
17223  this.UpdateOutOfRangeWarningElementText();
17224 },
17225 SetMaxValue: function (maxValue) {
17226  this.maxValue = maxValue;
17227  this.UpdateOutOfRangeWarningElementText();
17228 },
17229 CreateOutOfRangeWarningElement: function () {
17230  this.outOfRangeWarningElement = document.createElement("DIV");
17231  this.outOfRangeWarningElement.id = this.editor.name + "OutOfRWarn";
17232  ASPx.InsertElementAfter(this.outOfRangeWarningElement, this.editor.GetMainElement());
17233  ASPx.AnimationHelper.setOpacity(this.outOfRangeWarningElement, 0);
17234  this.outOfRangeWarningElement.className = this.editor.outOfRangeWarningClassName;
17235  this.UpdateOutOfRangeWarningElementText();
17236 },
17237 IsValueInRange: function (value) {
17238  return (!this.IsMinValueExists() || value >= this.minValue)
17239   && (!this.IsMaxValueExists() || value <= this.maxValue);
17240 },
17241 IsMinValueExists: function() {
17242  return ASPx.IsExists(this.minValue) && !isNaN(this.minValue) && this.minValue !== this.defaultMinValue;
17243 },
17244 IsMaxValueExists: function () {
17245  return ASPx.IsExists(this.maxValue) && !isNaN(this.maxValue) && this.maxValue !== this.defaultMaxValue;
17246 },
17247 GetFormattedTextByValue: function(value) {
17248  if (this.minMaxValueFormatter)
17249   return this.minMaxValueFormatter.Format(value);
17250  return value;
17251 },
17252 GetWarningText: function() {
17253  var textTemplate = arguments[0];
17254  var valueTexts = [];
17255  for (var i = 1; i < arguments.length; i++) {
17256   var valueText = this.GetFormattedTextByValue(arguments[i]);
17257   valueTexts.push(valueText);
17258  }
17259  return ASPx.Formatter.Format(textTemplate, valueTexts);
17260 },
17261 UpdateOutOfRangeWarningElementText: function () {
17262  var text = "";
17263  if (this.IsMinValueExists() && this.IsMaxValueExists())
17264   text = this.GetWarningText(this.editor.outOfRangeWarningMessages[0], this.minValue, this.maxValue);
17265  if (this.IsMinValueExists() && !this.IsMaxValueExists())
17266   text = this.GetWarningText(this.editor.outOfRangeWarningMessages[1], this.minValue);
17267  if (!this.IsMinValueExists() && this.IsMaxValueExists())
17268   text = this.GetWarningText(this.editor.outOfRangeWarningMessages[2], this.maxValue);
17269  ASPx.SetInnerHtml(this.outOfRangeWarningElement, "<LABEL>" + text + "</LABEL>");
17270 },
17271 UpdateOutOfRangeWarningElementVisibility: function (currentValue) {
17272  var isValidValue = currentValue == null || this.IsValueInRange(currentValue);
17273  if (!isValidValue && !this.outOfRangeWarningElementShown)
17274   this.ShowOutOfRangeWarningElement();
17275  if (isValidValue && this.outOfRangeWarningElementShown)
17276   this.HideOutOfRangeWarningElement();
17277 },
17278 GetOutOfRangeWarningElementCoordinates: function() {
17279  var editorMainElement = this.editor.GetMainElement();
17280  var editorWidth = editorMainElement.offsetWidth;
17281  var editorHeight = editorMainElement.offsetHeight;
17282  var editorX = ASPx.GetAbsoluteX(editorMainElement);
17283  var editorY = ASPx.GetAbsoluteY(editorMainElement);
17284  var outOfRangeWarningElementX = this.outOfRangeWarningElementPosition === ASPx.Position.Right ? editorX + editorWidth : editorX;
17285  var outOfRangeWarningElementY = this.outOfRangeWarningElementPosition === ASPx.Position.Right ? editorY : editorY + editorHeight;
17286  outOfRangeWarningElementX = outOfRangeWarningElementX < 0 ? 0 : outOfRangeWarningElementX;
17287  outOfRangeWarningElementY = outOfRangeWarningElementY < 0 ? 0 : outOfRangeWarningElementY;
17288  return {
17289   x: outOfRangeWarningElementX,
17290   y: outOfRangeWarningElementY
17291  };
17292 },
17293 ShowOutOfRangeWarningElement: function () {
17294  this.outOfRangeWarningElement.style.display = "inline";
17295  var outOfRangeWarningElementCoordinates = this.GetOutOfRangeWarningElementCoordinates();
17296  ASPx.SetAbsoluteX(this.outOfRangeWarningElement, outOfRangeWarningElementCoordinates.x);
17297  ASPx.SetAbsoluteY(this.outOfRangeWarningElement, outOfRangeWarningElementCoordinates.y);
17298  ASPx.AnimationHelper.fadeIn(this.outOfRangeWarningElement, null, this.animationDuration);
17299  this.outOfRangeWarningElementShown = true;
17300 },
17301 HideOutOfRangeWarningElement: function () {
17302  ASPx.AnimationHelper.fadeOut(this.outOfRangeWarningElement, function () {
17303   ASPx.SetElementDisplay(this.outOfRangeWarningElement, false);
17304  }.aspxBind(this), this.animationDuration);
17305  this.outOfRangeWarningElementShown = false;
17306 }
17307});
17308ASPx.MMMouseOut = function(name, evt) {
17309 var edit = ASPx.GetControlCollection().Get(name);
17310 if(edit != null) edit.OnMouseOut(evt);
17311}
17312ASPx.MMMouseOver = function(name, evt) {
17313 var edit = ASPx.GetControlCollection().Get(name);
17314 if(edit != null) edit.OnMouseOver(evt);
17315}
17316ASPx.MaskHintTimerProc = function() {
17317 var focusedEditor = ASPx.GetFocusedEditor();
17318 if(focusedEditor != null && ASPx.IsFunction(focusedEditor.MaskHintTimerProc))
17319  focusedEditor.MaskHintTimerProc();
17320}
17321ASPx.ETextChanged = function(name) {
17322 var edit = ASPx.GetControlCollection().Get(name);
17323 if(edit != null) edit.OnTextChanged(); 
17324}
17325ASPx.BEClick = function(name,number){
17326 var edit = ASPx.GetControlCollection().Get(name);
17327 if(edit != null) edit.OnButtonClick(number);
17328}
17329ASPx.BEClear = function(name, evt) {
17330 var edit = ASPx.GetControlCollection().Get(name);
17331 if(edit && (evt.button === 0 || ASPx.Browser.TouchUI)) {
17332  var requireFocus = !ASPx.Browser.VirtualKeyboardSupported || ASPx.Browser.MSTouchUI;
17333  (function performOnClean() {
17334   if(requireFocus && !edit.IsFocused())
17335    edit.GetInputElement().focus();
17336   if(edit.IsFocused() || !requireFocus)
17337    edit.OnClear();
17338   else
17339    window.setTimeout(performOnClean, 100);
17340  })();
17341 }
17342}
17343ASPx.SetFocusToTextEditWithDelay = function(name) {
17344 window.setTimeout(function() {
17345  var edit = ASPx.GetControlCollection().Get(name);
17346  if(!edit)
17347   return;
17348  ASPx.Browser.IE ? edit.SetCaretPosition(0) : edit.SetFocus();
17349 }, 500);
17350}
17351window.ASPxClientTextEdit = ASPxClientTextEdit;
17352window.ASPxClientTextBoxBase = ASPxClientTextBoxBase;
17353window.ASPxClientTextBox = ASPxClientTextBox;
17354window.ASPxClientMemo = ASPxClientMemo;
17355window.ASPxClientButtonEditBase = ASPxClientButtonEditBase;
17356window.ASPxClientButtonEdit = ASPxClientButtonEdit;
17357window.ASPxClientButtonEditClickEventArgs = ASPxClientButtonEditClickEventArgs;
17358})();
17359

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.