PageSourceSearch

https://admin.tracker.com/DXR.axd?r=1_304,1_185,1_298,1_211,1_221,…7,1_290,1_288,1_209,1_217,1_198,23_18-zGfMi

js tracker.com collected 2026-09-24 12:11:47 UTC 1,027,343 bytes, 26,634 lines download raw bytes

1var ASPx = ASPx || {};
2var dx = dx || {};
3(function () {
4ASPx.EmptyObject = { };
5ASPx.FalseFunction = function() { return false; };
6ASPx.SSLSecureBlankUrl = '/DXR.axd?r=1_0-vGfMi';
7ASPx.EmptyImageUrl = '/DXR.axd?r=1_58-vGfMi';
8ASPx.VersionInfo = 'Version=\'17.2.13.0\', File Version=\'17.2.13.0\', Date Modified=\'5/15/2019 12:02:46 PM\'';
9ASPx.Platform = 'ASP';
10ASPx.InvalidDimension = -10000;
11ASPx.InvalidPosition = -10000;
12ASPx.AbsoluteLeftPosition = -10000;
13ASPx.EmptyGuid = "00000000-0000-0000-0000-000000000000";
14ASPx.CallbackSeparator = ":";
15ASPx.ItemIndexSeparator = "i";
16ASPx.CallbackResultPrefix = "/*DX*/";
17ASPx.AccessibilityEmptyUrl = "javascript:;";
18ASPx.AccessibilityPronounceTimeout = 500;
19ASPx.MaxMobileWindowWidth = 576;
20ASPx.PossibleNumberDecimalSeparators = [",", "."];
21ASPx.CultureInfo = {
22 twoDigitYearMax: 2029,
23 ts: ":",
24 ds: "/",
25 am: "AM",
26 pm: "PM",
27 monthNames: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", ""],
28 genMonthNames: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "
28November", "December", ""],
29 abbrMonthNames: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ""],
30 abbrDayNames: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
31 dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
32 invariantCultureDecimalPoint: ".",
33 numDecimalPoint: ".",
34 numPrec: 2,
35 numGroupSeparator: ",", 
36 numGroups: [ 3 ],
37 numNegPattern: 1,
38 numPosInf: "Infinity", 
39 numNegInf: "-Infinity", 
40 numNan: "NaN",
41 currency: "$",
42 currDecimalPoint: ".",
43 currPrec: 2,
44 currGroupSeparator: ",",
45 currGroups: [ 3 ],
46 currPosPattern: 0,
47 currNegPattern: 0,
48 percentPattern: 0,
49 shortTime: "h:mm tt",
50 longTime: "h:mm:ss tt",
51 shortDate: "M/d/yyyy",
52 longDate: "dddd, MMMM d, yyyy",
53 monthDay: "MMMM d",
54 yearMonth: "MMMM yyyy"
55};
56ASPx.CultureInfo.genMonthNames = ASPx.CultureInfo.monthNames;
57ASPx.Position = {
58 Left: "Left",
59 Right: "Right",
60 Top: "Top",
61 Bottom: "Bottom"
62};
63var DateUtils = { };
64DateUtils.GetInvariantDateString = function(date) {
65 if(!date)
66  return "01/01/0001";
67 var day = date.getDate();
68 var month = date.getMonth() + 1;
69 var year = date.getFullYear();
70 var result = "";
71 if(month < 10)
72  result += "0";
73 result += month.toString() + "/";
74 if(day < 10)
75  result += "0";
76 result += day.toString() + "/";
77 if(year < 1000)
78  result += "0";
79 result += year.toString();
80 return result;
81};
82DateUtils.GetInvariantDateTimeString = function(date) {
83 var dateTimeString = DateUtils.GetInvariantDateString(date);
84 var time = {
85  h: date.getHours(),
86  m: date.getMinutes(),
87  s: date.getSeconds()
88 };
89 for(var key in time) {
90  if(time.hasOwnProperty(key)) {
91   var str = time[key].toString();
92   if(str.length < 2)
93    str = "0" + str;
94   time[key] = str;
95  }
96 }
97 dateTimeString += " " + time.h + ":" + time.m + ":" + time.s;
98 var msec = date.getMilliseconds();
99 if(msec > 0)
100  dateTimeString += "." + ("000" + msec.toString()).substr(-3);
101 return dateTimeString;
102};
103DateUtils.ExpandTwoDigitYear = function(value) {
104 value += 1900;
105 if(value + 99 < ASPx.CultureInfo.twoDigitYearMax)
106  value += 100;
107 return value;  
108};
109DateUtils.GetTimeZoneOffset = function(date) {
110 var utcFullYear = date.getUTCFullYear();
111 var utcDate = new Date(utcFullYear, date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(),
112  date.getUTCMinutes(), date.getUTCSeconds(), date.getUTCMilliseconds());
113 if (utcFullYear < 100)
114  utcDate.setFullYear(utcFullYear);
115 return utcDate - date;
116};
117DateUtils.ToUtcTime = function(date) {
118 var result = new Date();
119 result.setTime(date.valueOf() + ASPx.DateUtils.GetTimeZoneOffset(date));
120 return result;
121};
122DateUtils.ToLocalTime = function(date) {
123 var result = new Date();
124 result.setTime(date.valueOf() - ASPx.DateUtils.GetTimeZoneOffset(date));
125 return result; 
126};
127DateUtils.AreDatesEqualExact = function(date1, date2) {
128 if(date1 == null && date2 == null)
129  return true;
130 if(date1 == null || date2 == null)
131  return false;
132 return date1.getTime() == date2.getTime(); 
133};
134DateUtils.FixTimezoneGap = function(oldDate, newDate) {
135 var diff = newDate.getHours() - oldDate.getHours();
136 if(diff == 0)
137  return;
138 var sign = (diff == 1 || diff == -23) ? -1 : 1;
139 var trial = new Date(newDate.getTime() + sign * 3600000);
140 var isDateChangedAsExpected = newDate.getHours() - trial.getHours() === diff;
141 if(isDateChangedAsExpected && (sign > 0 || trial.getDate() == newDate.getDate()))
142  newDate.setTime(trial.getTime());
143};
144ASPx.DateUtils = DateUtils;
145var Timer = { };
146Timer.ClearTimer = function(timerID){
147 if(timerID > -1)
148  window.clearTimeout(timerID);
149 return -1;
150};
151Timer.ClearInterval = function(timerID){
152 if(timerID > -1)
153  window.clearInterval(timerID);
154 return -1;
155};
156var setControlBoundTimer = function(handler, control, setTimerFunction, clearTimerFunction, delay) {
157 var timerId;
158 var getTimerId = function() { return timerId; };
159 var boundHandler = function() {
160  var controlExists = control && ASPx.GetControlCollection().Get(control.name) === control;
161  if(controlExists)
162   handler.aspxBind(control)();
163  else
164   clearTimerFunction(getTimerId());
165 };
166 timerId = setTimerFunction(boundHandler, delay);
167 return timerId;
168};
169Timer.SetControlBoundTimeout = function(handler, control, delay) {
170 return setControlBoundTimer(handler, control, window.setTimeout, Timer.ClearTimer, delay);
171};
172Timer.SetControlBoundInterval = function(handler, control, delay) {
173 return setControlBoundTimer(handler, control, window.setInterval, Timer.ClearInterval, delay);
174};
175Timer.Throttle = function(func, delay) {
176 var isThrottled = false,
177   savedArgs,
178   savedThis = this;
179 function wrapper() {
180  if(isThrottled) {
181   savedArgs = arguments;
182   savedThis = this;
183   return;
184  }
185  func.apply(this, arguments);
186  isThrottled = true;
187  setTimeout(function() {
188   isThrottled = false;
189   if(savedArgs) {
190    wrapper.apply(savedThis, savedArgs);
191    savedArgs = null;
192   }
193  }, delay);
194 }
195 wrapper.cancel = function() {
196  clearTimeout(delay);
197  delay = savedArgs = savedThis = null;
198 };
199 return wrapper;
200};
201ASPx.Timer = Timer;
202var Browser = { };
203Browser.UserAgent = navigator.userAgent.toLowerCase();
204Browser.Mozilla = false;
205Browser.IE = false;
206Browser.Firefox = false;
207Browser.Netscape = false;
208Browser.Safari = false;
209Browser.Chrome = false;
210Browser.Opera = false;
211Browser.Edge = false;
212Browser.Version = undefined; 
213Browser.MajorVersion = undefined; 
214Browser.WindowsPlatform = false;
215Browser.MacOSPlatform = false;
216Browser.MacOSMobilePlatform = false;
217Browser.AndroidMobilePlatform = false;
218Browser.PlaformMajorVersion = false;
219Browser.WindowsPhonePlatform = false;
220Browser.AndroidDefaultBrowser = false;
221Browser.AndroidChromeBrowser = false;
222Browser.SamsungAndroidDevice = false;
223Browser.WebKitTouchUI = false;
224Browser.MSTouchUI = false;
225Browser.TouchUI = false;
226Browser.WebKitFamily = false; 
227Browser.NetscapeFamily = false; 
228Browser.HardwareAcceleration = false;
229Browser.VirtualKeyboardSupported = false;
230Browser.Info = "";
231function indentPlatformMajorVersion(userAgent) {
232 var regex = /(?:(?:windows nt|macintosh|mac os|cpu os|cpu iphone os|android|windows phone|linux) )(\d+)(?:[-0-9_.])*/;
233 var matches = regex.exec(userAgent);
234 if(matches)
235  Browser.PlaformMajorVersion = matches[1];
236}
237function getIECompatibleVersionString() {
238 if(document.compatible) {
239  for(var i = 0; i < document.compatible.length; i++)
240   if(document.compatible[i].userAgent === "IE" && document.compatible[i].version)
241    return document.compatible[i].version.toLowerCase();
242 }
243 return "";
244}
245Browser.IdentUserAgent = function(userAgent, ignoreDocumentMode) {
246 var browserTypesOrderedList = [ "Mozilla", "IE", "Firefox", "Netscape", "Safari", "Chrome", "Opera", "Opera10", "Edge" ];
247 var defaultBrowserType = "IE";
248 var defaultPlatform = "Win";
249 var defaultVersions = { Safari: 2, Chrome: 0.1, Mozilla: 1.9, Netscape: 8, Firefox: 2, Opera: 9, IE: 6, Edge: 12 };
250 if(!userAgent || userAgent.length == 0) {
251  fillUserAgentInfo(browserTypesOrderedList, defaultBrowserType, defaultVersions[defaultBrowserType], defaultPlatform);
252  return;
253 }
254 userAgent = userAgent.toLowerCase();
255 indentPlatformMajorVersion(userAgent);
256 try {
257  var platformIdentStrings = {
258   "Windows": "Win",
259   "Macintosh": "Mac",
260   "Mac OS": "Mac",
261   "Mac_PowerPC": "Mac",
262   "cpu os": "MacMobile",
263   "cpu iphone os": "MacMobile",
264   "Android": "Android",
265   "!Windows Phone": "WinPhone",
266   "!WPDesktop": "WinPhone",
267   "!ZuneWP": "WinPhone"
268  };
269  var optSlashOrSpace = "(?:/|\\s*)?";
270  var version = "(\\d+)(?:\\.((?:\\d+?[1-9])|\\d)0*?)?";
271  var optVersion = "(?:" + version + ")?";
272  var patterns = {
273   Safari: "applewebkit(?:.*?(?:version/" + version + "[\\.\\w\\d]*?(?:\\s+mobile\/\\S*)?\\s+safari))?",
274   Chrome: "(?:chrome|crios)(?!frame)" + optSlashOrSpace + optVersion,
275   Mozilla: "mozilla(?:.*rv:" + optVersion + ".*Gecko)?",
276   Netscape: "(?:netscape|navigator)\\d*/?\\s*" + optVersion,
277   Firefox: "firefox" + optSlashOrSpace + optVersion,
278   Opera: "(?:opera|\sopr)" + optSlashOrSpace + optVersion,
279   Opera10: "opera.*\\s*version" + optSlashOrSpace + optVersion,
280   IE: "msie\\s*" + optVersion,
281   Edge: "edge" + optSlashOrSpace + optVersion
282  };
283  var browserType;
284  var version = -1;
285  for(var i = 0; i < browserTypesOrderedList.length; i++) {
286   var browserTypeCandidate = browserTypesOrderedList[i];
287   var regExp = new RegExp(patterns[browserTypeCandidate], "i");
288   if(regExp.compile)
289    regExp.compile(patterns[browserTypeCandidate], "i");
290   var matches = regExp.exec(userAgent);
291   if(matches && matches.index >= 0) {
292    if(browserType == "IE" && version >= 11 && browserTypeCandidate == "Safari") 
293     continue;
294    browserType = browserTypeCandidate;
295    if(browserType == "Opera10")
296     browserType = "Opera";
297    var tridentPattern = "trident" + optSlashOrSpace + optVersion;
298    version = Browser.GetBrowserVersion(userAgent, matches, tridentPattern, getIECompatibleVersionString());
299    if(browserType == "Mozilla" && version >= 11)
300     browserType = "IE";
301   }
302  }
303  if(!browserType)
304   browserType = defaultBrowserType;
305  var browserVersionDetected = version != -1;
306  if(!browserVersionDetected)
307   version = defaultVersions[browserType];
308  var platform;
309  var minOccurenceIndex = Number.MAX_VALUE;
310  for(var identStr in platformIdentStrings) {
311   if(!platformIdentStrings.hasOwnProperty(identStr)) continue;
312   var importantIdent = identStr.substr(0,1) == "!";
313   var occurenceIndex = userAgent.indexOf((importantIdent ? identStr.substr(1) : identStr).toLowerCase());
314   if(occurenceIndex >= 0 && (occurenceIndex < minOccurenceIndex || importantIdent)) {
315    minOccurenceIndex = importantIdent ? 0 : occurenceIndex;
316    platform = platformIdentStrings[identStr];
317   }
318  }
319  var samsungPattern = "SM-[A-Z]";
320  var matches = userAgent.toUpperCase().match(samsungPattern);
321  var isSamsungAndroidDevice = matches && matches.length > 0;
322  if(platform == "WinPhone" && version < 9)
323   version = Math.floor(getVersionFromTrident(userAgent, "trident" + optSlashOrSpace + optVersion));
324  if(!ignoreDocumentMode && browserType == "IE" && version > 7 && document.documentMode < version)
325   version = document.documentMode;
326  if(platform == "WinPhone")
327   version = Math.max(9, version);
328  if(!platform)
329   platform = defaultPlatform;
330  if(platform == platformIdentStrings["cpu os"] && !browserVersionDetected) 
331   version = 4;
332  fillUserAgentInfo(browserTypesOrderedList, browserType, version, platform, isSamsungAndroidDevice);
333 } catch(e) {
334  fillUserAgentInfo(browserTypesOrderedList, defaultBrowserType, defaultVersions[defaultBrowserType], defaultPlatform);
335 }
336};
337function getVersionFromMatches(matches) {
338 var result = -1;
339 var versionStr = "";
340 if(matches[1]) {
341  versionStr += matches[1];
342  if(matches[2])
343   versionStr += "." + matches[2];
344 }
345 if(versionStr != "") {
346  result = parseFloat(versionStr);
347  if(isNaN(result))
348   result = -1;
349 }
350 return result;
351}
352function getVersionFromTrident(userAgent, tridentPattern) {
353 var tridentDiffFromVersion = 4;
354 var matches = new RegExp(tridentPattern, "i").exec(userAgent);
355 return getVersionFromMatches(matches) + tridentDiffFromVersion;
356}
357Browser.GetBrowserVersion = function(userAgent, matches, tridentPattern, ieCompatibleVersionString) {
358 var version = getVersionFromMatches(matches);
359 if(ieCompatibleVersionString) {
360  var versionFromTrident = getVersionFromTrident(userAgent, tridentPattern);
361  if(ieCompatibleVersionString === "edge" || parseInt(ieCompatibleVersionString) === versionFromTrident)
362   return versionFromTrident;
363 }
364 return version;
365};
366function fillUserAgentInfo(browserTypesOrderedList, browserType, version, platform, isSamsungAndroidDevice) {
367 for(var i = 0; i < browserTypesOrderedList.length; i++) {
368  var type = browserTypesOrderedList[i];
369  Browser[type] = type == browserType;
370 }
371 Browser.Version = Math.floor(10.0 * version) / 10.0;
372 Browser.MajorVersion = Math.floor(Browser.Version);
373 Browser.WindowsPlatform = platform == "Win" || platform == "WinPhone";
374 Browser.MacOSPlatform = platform == "Mac";
375 Browser.MacOSMobilePlatform = platform == "MacMobile";
376 Browser.AndroidMobilePlatform = platform == "Android";
377 Browser.WindowsPhonePlatform = platform == "WinPhone";
378 Browser.WebKitFamily = Browser.Safari || Browser.Chrome || Browser.Opera && Browser.MajorVersion >= 15;
379 Browser.NetscapeFamily = Browser.Netscape || Browser.Mozilla || Browser.Firefox;
380 Browser.HardwareAcceleration = (Browser.IE && Browser.MajorVersion >= 9) || (Browser.Firefox && Browser.MajorVersion >= 4) || 
381  (Browser.AndroidMobilePlatform && Browser.Chrome) || (Browser.Chrome && Browser.MajorVersion >= 37) || 
382  (Browser.Safari && !Browser.WindowsPlatform) || Browser.Edge || (Browser.Opera && Browser.MajorVersion >= 46);
383 Browser.WebKitTouchUI = Browser.MacOSMobilePlatform || Browser.AndroidMobilePlatform;
384 var isIETouchUI = Browser.IE && Browser.MajorVersion > 9 && Browser.WindowsPlatform && Browser.UserAgent.toLowerCase().indexOf("touch") >= 0;
385 Browser.MSTouchUI = isIETouchUI || (Browser.Edge && !!window.navigator.maxTouchPoints);
386 Browser.TouchUI = Browser.WebKitTouchUI || Browser.MSTouchUI;
387 Browser.MobileUI = Browser.WebKitTouchUI || Browser.WindowsPhonePlatform;
388 Browser.AndroidDefaultBrowser = Browser.AndroidMobilePlatform && !Browser.Chrome;
389 Browser.AndroidChromeBrowser = Browser.AndroidMobilePlatform && Browser.Chrome;
390 if(isSamsungAndroidDevice)
391  Browser.SamsungAndroidDevice = isSamsungAndroidDevice;
392 if(Browser.MSTouchUI) {
393  var isARMArchitecture = Browser.UserAgent.toLowerCase().indexOf("arm;") > -1;    
394  Browser.VirtualKeyboardSupported = isARMArchitecture || Browser.WindowsPhonePlatform;   
395 } else {
396  Browser.VirtualKeyboardSupported = Browser.WebKitTouchUI;
397 }
398 fillDocumentElementBrowserTypeClassNames(browserTypesOrderedList);
399}
400function fillDocumentElementBrowserTypeClassNames(browserTypesOrderedList) {
401 var documentElementClassName = "";
402 var browserTypeslist = browserTypesOrderedList.concat(["WindowsPlatform", "MacOSPlatform", "MacOSMobilePlatform", "AndroidMobilePlatform",
403   "WindowsPhonePlatform", "WebKitFamily", "WebKitTouchUI", "MSTouchUI", "TouchUI", "AndroidDefaultBrowser"]);
404 for(var i = 0; i < browserTypeslist.length; i++) {
405  var type = browserTypeslist[i];
406  if(Browser[type])
407   documentElementClassName += "dx" + type + " ";
408 }
409 documentElementClassName += "dxBrowserVersion-" + Browser.MajorVersion;
410 if(document && document.documentElement) {
411  if(document.documentElement.className != "")
412   documentElementClassName = " " + documentElementClassName;
413  document.documentElement.className += documentElementClassName;
414  Browser.Info = documentElementClassName;
415 }
416}
417Browser.IdentUserAgent(Browser.UserAgent);
418ASPx.Browser = Browser;
419ASPx.BlankUrl = Browser.IE ? ASPx.SSLSecureBlankUrl : (Browser.Opera ? "about:blank" : "");
420var Data = { };
421Data.ArrayInsert = function(array, element, position){
422 if(0 <= position && position < array.length){
423  for(var i = array.length; i > position; i --)
424   array[i] = array[i - 1];
425  array[position] = element;
426 }
427 else
428  array.push(element);
429};
430Data.ArrayRemove = function(array, element){
431 var index = Data.ArrayIndexOf(array, element);
432 if(index > -1) Data.ArrayRemoveAt(array, index);
433};
434Data.ArrayRemoveAt = function(array, index){
435 if(index >= 0  && index < array.length){
436  for(var i = index; i < array.length - 1; i++)
437   array[i] = array[i + 1];
438  array.pop();
439 }
440};
441Data.ArrayClear = function(array){
442 while(array.length > 0)
443  array.pop();
444};
445Data.ArrayIndexOf = function(array, element, comparer) {
446 if(!comparer) {
447  for(var i = 0; i < array.length; i++) {
448   if(array[i] == element)
449    return i;
450  }
451 } else {
452  for(var i = 0; i < array.length; i++) {
453   if(comparer(array[i], element))
454    return i;
455  }
456 }
457 return -1;
458};
459Data.ArrayContains = function(array, element) { 
460 return Data.ArrayIndexOf(array, element) >= 0;
461};
462Data.ArrayEqual = function(array1, array2) {
463 var count1 = array1.length;
464 var count2 = array2.length;
465 if(count1 != count2)
466  return false;
467 for(var i = 0; i < count1; i++)
468  if(array1[i] != array2[i])
469   return false;
470 return true;
471};
472Data.ArraySame = function(array1, array2) {
473 if(array1.length !== array2.length)
474  return false;
475 return array1.every(function(elem) { return Data.ArrayContains(array2, elem); });
476};
477Data.ArrayGetIntegerEdgeValues = function(array) {
478 var arrayToSort = Data.CollectionToArray(array);
479 Data.ArrayIntegerAscendingSort(arrayToSort);
480 return {
481  start: arrayToSort[0],
482  end: arrayToSort[arrayToSort.length - 1]
483 };
484};
485Data.ArrayIntegerAscendingSort = function(array){
486 Data.ArrayIntegerSort(array);
487};
488Data.ArrayIntegerSort = function(array, desc) {
489 array.sort(function(i1, i2) {
490  var res = 0;
491  if(i1 > i2)
492   res = 1;
493  else if(i1 < i2)
494   res = -1;
495  if(desc)
496   res *= -1;
497  return res;
498 });
499};
500Data.CollectionsUnionToArray = function(firstCollection, secondCollection) {
501 var result = [];
502 var firstCollectionLength = firstCollection.length;
503 var secondCollectionLength = secondCollection.length;
504 for(var i = 0; i < firstCollectionLength + secondCollectionLength; i++) {
505  if(i < firstCollectionLength)
506   result.push(firstCollection[i]);
507  else
508   result.push(secondCollection[i - firstCollectionLength]);
509 }
510 return result;
511};
512Data.CollectionToArray = function(collection) {
513 var array = [];
514 for(var i = 0; i < collection.length; i++)
515  array.push(collection[i]);
516 return array;
517};
518Data.CreateHashTableFromArray = function(array) {
519 var hash = [];
520 for(var i = 0; i < array.length; i++)
521  hash[array[i]] = 1;
522 return hash;
523};
524Data.CreateIndexHashTableFromArray = function(array) {
525 var hash = [];
526 for(var i = 0; i < array.length; i++)
527  hash[array[i]] = i;
528 return hash;
529};
530Data.ArrayToHash = function(array, getKeyFunc, getValueFunc) {
531 if(!(array instanceof Array)) 
532  return { };
533 return array.reduce(function(map, element, index) { 
534  var key = getKeyFunc(element, index);
535  var value = getValueFunc(element, index);
536  map[key] = value;
537  return map; 
538 }, { });
539};
540Data.Sum = function(array, getValueFunc) {
541 if(!(array instanceof Array)) 
542  return 0;
543 return array.reduce(function(prevValue, item) {
544  var value = getValueFunc ? getValueFunc(item) : item;
545  if(!ASPx.IsNumber(value))
546   value = 0;
547  return prevValue + value;
548 }, 0);
549};
550Data.Min = function(array, getValueFunc) { return CalculateArrayMinMax(array, getValueFunc, false); };
551Data.Max = function(array, getValueFunc) { return CalculateArrayMinMax(array, getValueFunc, true); };
552var CalculateArrayMinMax = function(array, getValueFunc, isMax) {
553 if(!(array instanceof Array)) 
554  return 0;
555 var startValue = isMax ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY;
556 return array.reduce(function(prevValue, item) {
557  var value = getValueFunc ? getValueFunc(item) : item;
558  if(!ASPx.IsNumber(value))
559   value = startValue;
560  var func = isMax ? Math.max : Math.min;
561  return func(value, prevValue);
562 }, startValue);
563};
564var defaultBinarySearchComparer = function(array, index, value) {
565 var arrayElement = array[index];
566 if(arrayElement == value)
567  return 0;
568 else
569  return arrayElement < value ? -1 : 1;
570};
571Data.NearestLeftBinarySearchComparer = function(array, index, value) { 
572 var arrayElement = array[index];
573 var leftPoint = arrayElement < value;
574 var lastLeftPoint = leftPoint && index == array.length - 1;
575 var nearestLeftPoint = lastLeftPoint || (leftPoint && array[index + 1] >= value);
576 if(nearestLeftPoint)
577  return 0;
578 else
579  return arrayElement < value ? -1 : 1;
580};
581Data.ArrayBinarySearch = function(array, value, binarySearchComparer, startIndex, length) {
582 if(!binarySearchComparer)
583  binarySearchComparer = defaultBinarySearchComparer;
584 if(!ASPx.IsExists(startIndex))
585  startIndex = 0;
586 if(!ASPx.IsExists(length))
587  length = array.length - startIndex;
588 var endIndex = (startIndex + length) - 1;
589 while(startIndex <= endIndex) {
590  var middle = (startIndex + ((endIndex - startIndex) >> 1));
591  var compareResult = binarySearchComparer(array, middle, value);
592  if(compareResult == 0)
593   return middle;
594  if(compareResult < 0)
595   startIndex = middle + 1;
596  else
597   endIndex = middle - 1;
598 }
599 return -(startIndex + 1);
600};
601Data.ArrayFlatten = function(arrayOfArrays) {
602 return [].concat.apply([], arrayOfArrays);
603};
604Data.GetDistinctArray = function(array) {
605 var resultArray = [];
606 for(var i = 0; i < array.length; i++) {
607  var currentEntry = array[i];
608  if(Data.ArrayIndexOf(resultArray, currentEntry) == -1) {
609   resultArray.push(currentEntry);
610  }
611 }
612 return resultArray;
613};
614Data.ForEach = function(arr, callback) {
615 if(Array.prototype.forEach) {
616  Array.prototype.forEach.call(arr, callback);
617 } else {
618  for(var i = 0, len = arr.length; i < len; i++) {
619   callback(arr[i], i, arr);
620  }
621 }
622};
623Data.MergeHashTables = function(target, object) {
624 if(!object || typeof (object) == "string")
625  return target;
626 if(!target)
627  target = {};
628 for(var key in object)
629  if(key && !(key in target))
630   target[key] = object[key];
631 return target;
632};
633Data.Range = function(count, start) {
634 count = parseInt(count) || 0;
635 start = parseInt(start) || 0;
636 if(count < 0) count = 0;
637 if(start < 0) start = 0;
638 return Array.apply(null, Array(count)).map(function(val, i) { return start + i; });
639};
640ASPx.Data = Data;
641var Cookie = { };
642Cookie.DelCookie = function(name){
643 setCookieInternal(name, "", new Date(1970, 1, 1));
644};
645Cookie.GetCookie = function(name) {
646 name = escape(name);
647 var cookies = document.cookie.split(';');
648 for(var i = 0; i < cookies.length; i++) {
649  var cookie = Str.Trim(cookies[i]);
650  if(cookie.indexOf(name + "=") == 0)
651   return unescape(cookie.substring(name.length + 1, cookie.length));
652  else if(cookie.indexOf(name + ";") == 0 || cookie === name)
653   return "";
654 }
655 return null;
656};
657Cookie.SetCookie = function(name, value, expirationDate){
658 if(!ASPx.IsExists(value)) {
659  Cookie.DelCookie(name);
660  return;
661 }
662 if(!ASPx.Ident.IsDate(expirationDate)) {
663  expirationDate = new Date();
664  expirationDate.setFullYear(expirationDate.getFullYear() + 1);
665 }
666 setCookieInternal(name, value, expirationDate);
667};
668function setCookieInternal(name, value, date){
669 document.cookie = escape(name) + "=" + escape(value.toString()) + "; expires=" + date.toGMTString() + "; path=/";
670}
671ASPx.Cookie = Cookie;
672ASPx.ImageUtils = {
673 GetImageSrc: function (image){
674  return image.src;
675 },
676 SetImageSrc: function(image, src){
677  if(isSourceResetRequired())
678   image.src = "";
679  image.src = src;
680 },
681 SetSize: function(image, width, height){
682  image.style.width = width + "px";
683  image.style.height = height + "px";
684 },
685 GetSize: function(image, isWidth){
686  return (isWidth ? image.offsetWidth : image.offsetHeight);
687 }
688};
689var Str = { };
690Str.ApplyReplacement = function(text, replecementTable) {
691 if(typeof(text) != "string")
692  text = text.toString();
693 for(var i = 0; i < replecementTable.length; i++) {
694  var replacement = replecementTable[i];
695  text = text.replace(replacement[0], replacement[1]);
696 }
697 return text;
698};
699Str.CompleteReplace = function(text, regexp, newSubStr) {
700 if(typeof(text) != "string")
701  text = text.toString();
702 var textPrev;
703 do {
704  textPrev = text;
705  text = text.replace(regexp, newSubStr);
706 } while(text != textPrev);
707 return text;
708};
709Str.EncodeHtml = function(html) {
710 return Str.ApplyReplacement(html, [
711  [ /&amp;/g,  '&ampx;'  ], [ /&/g, '&amp;'  ],
712  [ /&quot;/g, '&quotx;' ], [ /"/g, '&quot;' ],
713  [ /&lt;/g,   '&ltx;'   ], [ /</g, '&lt;'   ],
714  [ /&gt;/g,   '&gtx;'   ], [ />/g, '&gt;'   ]
715 ]);
716};
717Str.DecodeHtml = function(html) {
718 return Str.ApplyReplacement(html, [
719  [ /&gt;/g,   '>' ], [ /&gtx;/g,  '&gt;'   ],
720  [ /&lt;/g,   '<' ], [ /&ltx;/g,  '&lt;'   ],
721  [ /&quot;/g, '"' ], [ /&quotx;/g,'&quot;' ],
722  [ /&amp;/g,  '&' ], [ /&ampx;/g, '&amp;'  ]
723 ]);
724};
725Str.DecodeHtmlViaTextArea = function(html) {
726 var textArea = document.createElement("TEXTAREA");
727 textArea.innerHTML = html;
728 return textArea.value;
729};
730Str.TrimStart = function(str) { 
731 return trimInternal(str, true);
732};
733Str.TrimEnd = function(str) { 
734 return trimInternal(str, false, true);
735};
736Str.Trim = function(str) { 
737 return trimInternal(str, true, true); 
738};
739var whiteSpaces = { 
740 0x0009: 1, 0x000a: 1, 0x000b: 1, 0x000c: 1, 0x000d: 1, 0x0020: 1, 0x0085: 1, 
741 0x00a0: 1, 0x1680: 1, 0x180e: 1, 0x2000: 1, 0x2001: 1, 0x2002: 1, 0x2003: 1, 
742 0x2004: 1, 0x2005: 1, 0x2006: 1, 0x2007: 1, 0x2008: 1, 0x2009: 1, 0x200a: 1, 
743 0x200b: 1, 0x2028: 1, 0x2029: 1, 0x202f: 1, 0x205f: 1, 0x3000: 1
744};
745var caretWidth = 1;
746function trimInternal(source, trimStart, trimEnd) {
747 var len = source.length;
748 if(!len)
749  return source;
750 if(len < 0xBABA1) { 
751  var result = source;
752  if(trimStart) {
753   result = result.replace(/^\s+/, "");
754  }
755  if(trimEnd) {
756   result = result.replace(/\s+$/, "");
757  }
758  return result;  
759 } else {
760  var start = 0;
761  if(trimEnd) {   
762   while(len > 0 && whiteSpaces[source.charCodeAt(len - 1)]) {
763    len--;
764   }
765  }
766  if(trimStart && len > 0) {
767   while(start < len && whiteSpaces[source.charCodeAt(start)]) { 
768    start++; 
769   }   
770  }
771  return source.substring(start, len);
772 }
773}
774Str.Insert = function(str, subStr, index) { 
775 var leftText = str.slice(0, index);
776 var rightText = str.slice(index);
777 return leftText + subStr + rightText;
778};
779Str.InsertEx = function(str, subStr, startIndex, endIndex) { 
780 var leftText = str.slice(0, startIndex);
781 var rightText = str.slice(endIndex);
782 return leftText + subStr + rightText;
783};
784var greekSLFSigmaChar = String.fromCharCode(962);
785var greekSLSigmaChar = String.fromCharCode(963);
786Str.PrepareStringForFilter = function(s){
787 s = s.toLowerCase();
788 if(ASPx.Browser.WebKitFamily) {
789  return s.replace(new RegExp(greekSLFSigmaChar, "g"), greekSLSigmaChar);
790 }
791 return s;
792};
793Str.GetCoincideCharCount = function(text, filter, textMatchingDelegate) {
794 var coincideText = ASPx.Str.PrepareStringForFilter(filter);
795 var originText = ASPx.Str.PrepareStringForFilter(text);
796 while(coincideText != "" && !textMatchingDelegate(originText, coincideText)) {
797  coincideText = coincideText.slice(0, -1);
798 }
799 return coincideText.length;
800};
801ASPx.Str = Str;
802var Xml = { };
803Xml.Parse = function(xmlStr) {
804 if(window.DOMParser) {
805  var parser = new DOMParser();
806  return parser.parseFromString(xmlStr, "text/xml");
807 }
808 else if(window.ActiveXObject) {
809  var xmlDoc = new window.ActiveXObject("Microsoft.XMLDOM");
810  if(xmlDoc) {
811   xmlDoc.async = false;
812   xmlDoc.loadXML(xmlStr);
813   return xmlDoc;
814  }
815 }
816 return null;
817};
818ASPx.Xml = Xml;
819ASPx.Key = {
820 F1     : 112,
821 F2     : 113,
822 F3     : 114,
823 F4     : 115,
824 F5     : 116,
825 F6     : 117,
826 F7     : 118,
827 F8     : 119,
828 F9     : 120,
829 F10    : 121,
830 F11    : 122,
831 F12    : 123,
832 Ctrl   : 17,
833 Shift  : 16,
834 Alt    : 18,
835 Enter  : 13,
836 Home   : 36,
837 End    : 35,
838 Left   : 37,
839 Right  : 39,
840 Up     : 38,
841 Down   : 40,
842 PageUp    : 33,
843 PageDown  : 34,
844 Esc    : 27,
845 Space  : 32,
846 Tab    : 9,
847 Backspace : 8,
848 Delete    : 46,
849 Insert    : 45,
850 ContextMenu  : 93,
851 Windows   : 91,
852 Decimal   : 110
853};
854ASPx.KeyCode = {
855 Backspace : 8,
856 Tab    : 9,
857 Enter  : 13,
858 Pause  : 19,
859 CapsLock  : 20,
860 Esc    : 27,
861 Space  : 32,
862 PageUp    : 33,
863 PageDown  : 34,
864 End    : 35,
865 Home   : 36,
866 Left   : 37,
867 Up     : 38,
868 Right  : 39,
869 Down   : 40,
870 Insert    : 45,
871 Delete    : 46,
872 Key_0  : 48,
873 Key_1  : 49,
874 Key_2  : 50,
875 Key_3  : 51,
876 Key_4  : 52,
877 Key_5  : 53,
878 Key_6  : 54,
879 Key_7  : 55,
880 Key_8  : 56,
881 Key_9  : 57,
882 Key_a  : 65,
883 Key_b  : 66,
884 Key_c  : 67,
885 Key_d  : 68,
886 Key_e  : 69,
887 Key_f  : 70,
888 Key_g  : 71,
889 Key_h  : 72,
890 Key_i  : 73,
891 Key_j  : 74,
892 Key_k  : 75,
893 Key_l  : 76,
894 Key_m  : 77,
895 Key_n  : 78,
896 Key_o  : 79,
897 Key_p  : 80,
898 Key_q  : 81,
899 Key_r  : 82,
900 Key_s  : 83,
901 Key_t  : 84,
902 Key_u  : 85,
903 Key_v  : 86,
904 Key_w  : 87,
905 Key_x  : 88,
906 Key_y  : 89,
907 Key_z  : 90,
908 Windows   : 91,
909 ContextMenu  : 93,
910 Numpad_0  : 96,
911 Numpad_1  : 97,
912 Numpad_2  : 98,
913 Numpad_3  : 99,
914 Numpad_4  : 100,
915 Numpad_5  : 101,
916 Numpad_6  : 102,
917 Numpad_7  : 103,
918 Numpad_8  : 104,
919 Numpad_9  : 105,
920 Multiply  : 106,
921 Add    : 107,
922 Subtract  : 109,
923 Decimal   : 110,
924 Divide    : 111,
925 F1     : 112,
926 F2     : 113,
927 F3     : 114,
928 F4     : 115,
929 F5     : 116,
930 F6     : 117,
931 F7     : 118,
932 F8     : 119,
933 F9     : 120,
934 F10    : 121,
935 F11    : 122,
936 F12    : 123,
937 NumLock   : 144,
938 ScrollLock   : 145,
939 Semicolon : 186,
940 Equals    : 187,
941 Comma  : 188,
942 Dash   : 189,
943 Period    : 190,
944 ForwardSlash : 191,
945 GraveAccent  : 192,
946 OpenBracket  : 219,
947 BackSlash : 220,
948 CloseBracket : 221,
949 SingleQuote  : 222
950};
951ASPx.ScrollBarMode = { Hidden: 0, Visible: 1, Auto: 2 };
952ASPx.ColumnResizeMode = { None: 0, Control: 1, NextColumn: 2 };
953var Selection = { };
954Selection.Set = function(input, startPos, endPos, scrollToSelection, isApi) {
955 if(!ASPx.IsExistsElement(input))
956  return;
957 var isInputFocused = ASPx.GetActiveElement() === input;
958 var isInputNativeFocusLocked = ASPx.VirtualKeyboardUI.getInputNativeFocusLocked();
959 if(!isApi && Browser.VirtualKeyboardSupported && (!isInputFocused || isInputNativeFocusLocked))
960  return;
961 var textLen = input.value.length;
962 startPos = ASPx.GetDefinedValue(startPos, 0);
963 endPos = ASPx.GetDefinedValue(endPos, textLen);
964 if(startPos < 0)
965  startPos = 0;
966 if(endPos < 0 || endPos > textLen)
967  endPos = textLen;
968 if(startPos > endPos)
969  startPos = endPos;
970 var makeReadOnly = false;
971 if(Browser.WebKitFamily && input.readOnly) {
972  input.readOnly = false;
973  makeReadOnly = true;
974 }
975 try {
976  if(Browser.Firefox && Browser.Version >= 8) 
977   input.setSelectionRange(startPos, endPos, "backward");
978  else if(Browser.IE && input.createTextRange) {
979   var range = input.createTextRange();
980   range.collapse(true);
981   range.moveStart("character", startPos);
982   range.moveEnd("character", endPos - startPos);
983   range.select();
984  } else {
985   forceScrollToSelectionRange(input, startPos, endPos);
986   input.setSelectionRange(startPos, endPos);
987  }
988  if(Browser.Opera || Browser.Firefox || Browser.Chrome) 
989   input.focus();
990 } catch(e) { 
991 }
992 if(scrollToSelection && input.tagName == 'TEXTAREA') {
993  var scrollHeight = input.scrollHeight;
994  var approxCaretPos = startPos;
995  var scrollTop = Math.max(Math.round(approxCaretPos * scrollHeight / textLen  - input.clientHeight / 2), 0);
996  input.scrollTop = scrollTop;
997 }
998 if(makeReadOnly)
999  input.readOnly = true;
1000};
1001var getTextWidthBeforePos = function(input, pos) {
1002 return ASPx.GetSizeOfText(input.value.toString().substr(0, pos), ASPx.GetCurrentStyle(input)).width;
1003};
1004var forceScrollToSelectionRange = function(input, startPos, endPos) {
1005 var widthBeforeStartPos = getTextWidthBeforePos(input, startPos) - caretWidth;
1006 var widthBeforeEndPos = getTextWidthBeforePos(input, endPos) + caretWidth;
1007 var inputRawWidth = input.offsetWidth - ASPx.GetLeftRightBordersAndPaddingsSummaryValue(input);
1008 if(input.scrollLeft < widthBeforeEndPos - inputRawWidth)
1009  input.scrollLeft = widthBeforeEndPos - inputRawWidth;
1010 else if(input.scrollLeft > widthBeforeStartPos)
1011  input.scrollLeft = widthBeforeStartPos;
1012};
1013Selection.GetInfo = function(input) {
1014 var start, end;
1015 if(Browser.IE && Browser.Version < 9) {
1016  var range = document.selection.createRange();
1017  var rangeCopy = range.duplicate();
1018  range.move('character', -input.value.length);
1019  range.setEndPoint('EndToStart', rangeCopy);
1020  start = range.text.length;
1021  end = start + rangeCopy.text.length;
1022 } else {
1023  try {
1024   start = input.selectionStart;
1025   end = input.selectionEnd;
1026  } catch (e) {
1027  }
1028 }
1029 return { startPos: start, endPos: end };
1030};
1031Selection.GetExtInfo = function(input) {
1032 var start = 0, end = 0, textLen = 0;
1033 if(Browser.IE && Browser.Version < 9) {
1034  var normalizedValue;
1035  var range, textInputRange, textInputEndRange;
1036  range = document.selection.createRange();
1037  if(range && range.parentElement() == input) {
1038   textLen = input.value.length;
1039   normalizedValue = input.value.replace(/\r\n/g, "\n");
1040   textInputRange = input.createTextRange();
1041   textInputRange.moveToBookmark(range.getBookmark());
1042   textInputEndRange = input.createTextRange();
1043   textInputEndRange.collapse(false);
1044   if(textInputRange.compareEndPoints("StartToEnd", textInputEndRange) > -1) {
1045    start = textLen;
1046    end = textLen;
1047   } else {
1048    start = normalizedValue.slice(0, start).split("\n").length - textInputRange.moveStart("character", -textLen) -1;
1049    if(textInputRange.compareEndPoints("EndToEnd", textInputEndRange) > -1)
1050     end = textLen;
1051    else
1052     end = normalizedValue.slice(0, end).split("\n").length - textInputRange.moveEnd("character", -textLen) - 1;    
1053   }
1054  }
1055  return {startPos: start, endPos: end};
1056 }
1057 try {
1058  start = input.selectionStart;
1059  end = input.selectionEnd;
1060 } catch (e) {
1061 }
1062 return {startPos: start, endPos: end}; 
1063};
1064Selection.SetCaretPosition = function(input, caretPos) {
1065 if(typeof caretPos === "undefined" || caretPos < 0)
1066  caretPos = input.value.length;
1067 Selection.Set(input, caretPos, caretPos, true);
1068};
1069Selection.GetCaretPosition = function(element, isDialogMode) {
1070 var pos = 0;
1071 if("selectionStart" in element) {
1072  pos = element.selectionStart;
1073 } else if("selection" in document) {
1074  element.focus();
1075  var sel = document.selection.createRange(),
1076   selLength = document.selection.createRange().text.length;
1077  sel.moveStart("character", -element.value.length);
1078  pos = sel.text.length - selLength;
1079 }
1080 if(isDialogMode && !pos) {
1081  pos = element.value.length - 1;
1082 }
1083 return pos;
1084};
1085Selection.Clear = function() {
1086 try {
1087  if(window.getSelection) {
1088   window.getSelection().removeAllRanges();
1089  }
1090  else if(document.selection) {
1091   if(document.selection.empty)
1092    document.selection.empty();
1093   else if(document.selection.clear)
1094    document.selection.clear();
1095  }
1096 } catch(e) {
1097 }
1098};
1099Selection.ClearOnMouseMove = function(evt) {
1100 if(!Browser.IE || (evt.button != 0)) 
1101  Selection.Clear();
1102};
1103Selection.SetElementSelectionEnabled = function(element, value) {
1104 var userSelectValue = value ? "" : "none";
1105 var func = value ? Evt.DetachEventFromElement : Evt.AttachEventToElement;
1106 if(Browser.Firefox)
1107  element.style.MozUserSelect = userSelectValue;
1108 else if(Browser.WebKitFamily)
1109  element.style.webkitUserSelect = userSelectValue;
1110 else if(Browser.IE && Browser.Version > 10 || Browser.Edge)
1111  element.style.msUserSelect = userSelectValue;
1112 else if(Browser.Opera)
1113  func(element, "mousemove", Selection.Clear);
1114 else {
1115  func(element, "selectstart", ASPx.FalseFunction);
1116  func(element, "mousemove", Selection.Clear);
1117 }
1118};
1119Selection.SetElementAsUnselectable = function(element, isWithChild, recursive) {
1120 if(element && element.nodeType == 1) {
1121  element.unselectable = "on";
1122  if(Browser.NetscapeFamily)
1123   element.onmousedown = ASPx.FalseFunction;
1124  if((Browser.IE && Browser.Version >= 9) || Browser.WebKitFamily)
1125   Evt.AttachEventToElement(element, "mousedown", Evt.PreventEventAndBubble);
1126  if(isWithChild === true){
1127   for(var j = 0; j < element.childNodes.length; j ++)
1128    Selection.SetElementAsUnselectable(element.childNodes[j], (!!recursive ? true : false), (!!recursive));
1129  }
1130 }
1131};
1132Selection.AreEqual = function(selection1, selection2) {
1133 return selection1.startPos === selection2.startPos && selection1.endPos === selection2.endPos;
1134};
1135ASPx.Selection = Selection;
1136var MouseScroller = { };
1137MouseScroller.MinimumOffset = 10;
1138MouseScroller.Create = function(getElement, getScrollXElement, getScrollYElement, needPreventScrolling, vertRecursive, onMouseDown, onMouseMove, onMouseUp, onMouseUpMissed) {
1139 var element = getElement();
1140 if(!element) 
1141  return;
1142 if(!element.dxMouseScroller)
1143  element.dxMouseScroller = new MouseScroller.Extender(getElement, getScrollXElement, getScrollYElement, needPreventScrolling, vertRecursive, onMouseDown, onMouseMove, onMouseUp, onMouseUpMissed);
1144 return element.dxMouseScroller;
1145};
1146MouseScroller.Extender = function(getElement, getScrollXElement, getScrollYElement, needPreventScrolling, vertRecursive, onMouseDown, onMouseMove, onMouseUp, onMouseUpMissed) {
1147 this.getElement = getElement;
1148 this.getScrollXElement = getScrollXElement;
1149 this.getScrollYElement = getScrollYElement;
1150 this.needPreventScrolling = needPreventScrolling;
1151 this.vertRecursive = !!vertRecursive;
1152 this.createHandlers(onMouseDown || function() { }, onMouseMove || function() { }, onMouseUp || function() { }, onMouseUpMissed || function() { });
1153 this.update();
1154};
1155MouseScroller.Extender.prototype = {
1156 update: function() {
1157  if(this.element)
1158   Evt.DetachEventFromElement(this.element, ASPx.TouchUIHelper.touchMouseDownEventName, this.mouseDownHandler);
1159  this.element = this.getElement();
1160  Evt.AttachEventToElement(this.element, ASPx.TouchUIHelper.touchMouseDownEventName, this.mouseDownHandler);  
1161  Evt.AttachEventToElement(this.element, "click", this.mouseClickHandler);   
1162  if(Browser.MSTouchUI && this.element.className.indexOf(ASPx.TouchUIHelper.msTouchDraggableClassName) < 0)
1163   this.element.className += " " + ASPx.TouchUIHelper.msTouchDraggableClassName;
1164  this.scrollXElement = this.getScrollXElement();
1165  this.scrollYElement = this.getScrollYElement();
1166 },
1167 createHandlers: function(onMouseDown, onMouseMove, onMouseUp, onMouseUpMissed) {
1168  var mouseDownCounter = 0;
1169  this.onMouseDown = onMouseDown;
1170  this.onMouseMove = onMouseMove;
1171  this.onMouseUp = onMouseUp;  
1172  this.mouseDownHandler = function(e) {
1173   if(mouseDownCounter++ > 0) {
1174    this.finishScrolling();
1175    onMouseUpMissed();
1176   }
1177   var eventSource = Evt.GetEventSource(e);
1178   var requirePreventCustonScroll = ASPx.IsExists(ASPx.TouchUIHelper.RequirePreventCustomScroll) && ASPx.TouchUIHelper.RequirePreventCustomScroll(eventSource, this.element);
1179   this.requirePreventScroll = requirePreventCustonScroll || this.needPreventScrolling && this.needPreventScrolling(eventSource);
1180   if(this.requirePreventScroll)
1181    return;
1182   this.scrollableTreeLine = this.GetScrollableElements();
1183   this.firstX = this.prevX = Evt.GetEventX(e);
1184   this.firstY = this.prevY = Evt.GetEventY(e);
1185   Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseMoveEventName, this.mouseMoveHandler);
1186   Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseUpEventName, this.mouseUpHandler);
1187   this.onMouseDown(e);
1188  }.aspxBind(this);
1189  this.mouseMoveHandler = function(e) {
1190   if(ASPx.TouchUIHelper.isGesture)
1191    return;
1192   var x = Evt.GetEventX(e);
1193   var y = Evt.GetEventY(e);
1194   var xDiff = this.prevX - x;
1195   var yDiff = this.prevY - y;
1196   if(this.vertRecursive) {
1197    var isTopDirection = yDiff < 0;
1198    this.scrollYElement = this.GetElementForVertScrolling(isTopDirection, this.prevIsTopDirection, this.scrollYElement);
1199    this.prevIsTopDirection = isTopDirection;
1200   }
1201   if(this.scrollXElement && xDiff != 0)
1202    this.scrollXElement.scrollLeft += xDiff;
1203   if(this.scrollYElement && yDiff != 0) {
1204    this.scrollYElement.scrollTop += yDiff;
1205    var isOuterScrollableElement = this.scrollableTreeLine[this.scrollableTreeLine.length - 1] == this.scrollYElement;
1206    if(isOuterScrollableElement)
1207     y += yDiff;
1208   }
1209   this.prevX = x;
1210   this.prevY = y;
1211   e.preventDefault();
1212   this.onMouseMove(e);
1213  }.aspxBind(this);
1214  this.mouseUpHandler = function(e) {
1215   this.finishScrolling();
1216   this.onMouseUp(e);
1217  }.aspxBind(this);
1218  this.mouseClickHandler = function(e){
1219   if(this.requirePreventScroll)
1220    return;
1221   var xDiff = this.firstX - Evt.GetEventX(e);
1222   var yDiff = this.firstY - Evt.GetEventY(e);
1223   if(xDiff > MouseScroller.MinimumOffset || yDiff > MouseScroller.MinimumOffset)
1224    return Evt.PreventEventAndBubble(e);
1225  }.aspxBind(this);
1226  this.finishScrolling = function() {
1227   Evt.DetachEventFromDocument(ASPx.TouchUIHelper.touchMouseMoveEventName, this.mouseMoveHandler);
1228   Evt.DetachEventFromDocument(ASPx.TouchUIHelper.touchMouseUpEventName, this.mouseUpHandler);
1229   this.scrollableTreeLine = [];
1230   this.prevIsTopDirection = null;
1231   mouseDownCounter--;
1232  };
1233 },
1234 GetScrollableElements: function() {
1235  if(!this.vertRecursive) return [ ];
1236  var outerScrollableElementTag = ASPx.Browser.IE ? "HTML" : "BODY";
1237  return ASPx.GetElementTreeLine(this.element, null, function(el) { return el == document; })
1238   .filter(function(el) { return ASPx.IsScrollableElement(el, false, true) || el.tagName == outerScrollableElementTag; }.bind(this));
1239 },
1240 GetElementForVertScrolling: function(currentIsTop, prevIsTop, prevElement) {
1241  if(prevElement && currentIsTop === prevIsTop && this.GetVertScrollExcess(prevElement, currentIsTop) > 0)
1242   return prevElement;
1243  for(var i = 0; i < this.scrollableTreeLine.length; i++) {
1244   var element = this.scrollableTreeLine[i];
1245   var excess = this.GetVertScrollExcess(element, currentIsTop);
1246   if(excess > 0)
1247    return element;
1248  }
1249  return null;
1250 },
1251 GetVertScrollExcess: function(element, isTop) {
1252  if(isTop)
1253   return element.scrollTop;
1254  var isBodyElement = element.tagName == "BODY";
1255  var clientHeight = isBodyElement ? ASPx.GetDocumentClientHeight() : element.clientHeight;
1256  return element.scrollHeight - clientHeight - element.scrollTop;
1257 }
1258};
1259ASPx.MouseScroller = MouseScroller;
1260var Evt = { };
1261Evt.GetEvent = function(evt){
1262 return (typeof(event) != "undefined" && event != null && Browser.IE) ? event : evt; 
1263};
1264Evt.IsEventPrevented = function(evt) {
1265 return evt.defaultPrevented || evt.returnValue === false;
1266};
1267Evt.PreventEvent = function(evt){
1268 if(evt.preventDefault)
1269  evt.preventDefault();
1270 else
1271  evt.returnValue = false;
1272 return false;
1273};
1274Evt.PreventEventAndBubble = function(evt){
1275 Evt.PreventEvent(evt);
1276 if(evt.stopPropagation)
1277  evt.stopPropagation();
1278 evt.cancelBubble = true;
1279 return false;
1280};
1281Evt.CancelBubble = function(evt){
1282 evt.cancelBubble = true;
1283 return false;
1284};
1285Evt.PreventImageDragging = function(image) {
1286 if(image)
1287  image.ondragstart = function() { return false; };
1288};
1289Evt.PreventDragStart = function(evt) {
1290 evt = Evt.GetEvent(evt);
1291 var element = Evt.GetEventSource(evt);
1292 if(element.releaseCapture)
1293  element.releaseCapture(); 
1294 return false;
1295};
1296Evt.PreventElementDrag = function(element) {
1297 if(Browser.IE)
1298  Evt.AttachEventToElement(element, "dragstart", Evt.PreventEvent);
1299 else
1300  Evt.AttachEventToElement(element, "mousedown", Evt.PreventEvent);
1301};
1302Evt.PreventElementDragAndSelect = function(element, skipMouseMove, skipIESelect){
1303 if(Browser.WebKitFamily)
1304  Evt.AttachEventToElement(element, "selectstart", Evt.PreventEventAndBubble);
1305 if(Browser.IE){
1306  if(!skipIESelect)
1307   Evt.AttachEventToElement(element, "selectstart", ASPx.FalseFunction);
1308  if(!skipMouseMove)
1309   Evt.AttachEventToElement(element, "mousemove", Selection.ClearOnMouseMove);
1310  Evt.AttachEventToElement(element, "dragstart", Evt.PreventDragStart);
1311 }
1312};
1313Evt.GetEventSource = function(evt){
1314 if(!ASPx.IsExists(evt)) return null; 
1315 return evt.srcElement ? evt.srcElement : evt.target;
1316};
1317Evt.GetKeyCode = function(srcEvt) {
1318 return Browser.NetscapeFamily || Browser.Opera ? srcEvt.which : srcEvt.keyCode;
1319};
1320function clientEventRequiresDocScrollCorrection() {
1321 var isSafariVerLess3 = Browser.Safari && Browser.Version < 3,
1322  isMacOSMobileVerLess51 = Browser.MacOSMobilePlatform && Browser.Version < 5.1;
1323 return Browser.AndroidDefaultBrowser || Browser.AndroidChromeBrowser || !(isSafariVerLess3 || isMacOSMobileVerLess51);
1324}
1325Evt.GetEventX = function(evt){
1326 if(ASPx.TouchUIHelper.isTouchEvent(evt))
1327  return ASPx.TouchUIHelper.getEventX(evt);
1328 return evt.clientX + (clientEventRequiresDocScrollCorrection() ? ASPx.GetDocumentScrollLeft() : 0);
1329};
1330Evt.GetEventY = function(evt){
1331 if(ASPx.TouchUIHelper.isTouchEvent(evt))
1332  return ASPx.TouchUIHelper.getEventY(evt);
1333 return evt.clientY + (clientEventRequiresDocScrollCorrection() ? ASPx.GetDocumentScrollTop() : 0 );
1334};
1335Evt.IsLeftButtonPressed = function(evt) {
1336 if(ASPx.TouchUIHelper.isTouchEvent(evt))
1337  return true;
1338 evt = Evt.GetEvent(evt);
1339 if(!evt) return false;
1340 if(Browser.IE && Browser.Version < 11) {
1341  if(Browser.MSTouchUI)
1342   return true;
1343  return evt.button % 2 == 1; 
1344 } else if(Browser.WebKitFamily) {
1345  if(evt.type === "pointermove")
1346   return evt.buttons === 1;
1347  return evt.which == 1;
1348 } else if(Browser.NetscapeFamily || Browser.Edge || (Browser.IE && Browser.Version >= 11)) {
1349  if(evt.type === ASPx.TouchUIHelper.touchMouseMoveEventName)
1350   return evt.buttons === 1;
1351  return evt.which == 1;
1352 } else if(Browser.Opera)
1353  return evt.button == 0;
1354 return true;
1355};
1356Evt.IsRightButtonPressed = function(evt){
1357 evt = Evt.GetEvent(evt);
1358 if(!ASPx.IsExists(evt)) return false;
1359 if(Browser.IE || Browser.Edge) {
1360  if(evt.type === "pointermove")
1361   return evt.buttons === 2;
1362  return evt.button == 2;
1363 }
1364 else if(Browser.NetscapeFamily || Browser.WebKitFamily)
1365  return evt.which == 3;
1366 else if (Browser.Opera)
1367  return evt.button == 1;
1368 return true;
1369};
1370Evt.GetWheelDelta = function(evt) {
1371 var ret;
1372 if(Browser.NetscapeFamily && Browser.MajorVersion < 17)
1373  ret = -evt.detail;
1374 else if(Browser.Safari)
1375  ret = evt.wheelDelta;
1376 else
1377  ret = -evt.deltaY;
1378 if(Browser.Opera && Browser.Version < 9)
1379  ret = -ret;
1380 return ret;
1381};
1382Evt.IsWheelEventWithDirection = function(evt) {
1383 return ASPx.Data.ArrayContains(["wheel", "mousewheel"], evt.type);
1384};
1385Evt.GetWheelDeltaX = function(evt) {
1386 if(evt.type === "wheel")
1387  return -evt.deltaX;
1388 if(evt.type === "mousewheel")
1389  return evt.wheelDeltaX;
1390};
1391Evt.GetWheelDeltaY = function(evt) {
1392 if(evt.type === "wheel")
1393  return -evt.deltaY;
1394 if(evt.type === "mousewheel")
1395  return evt.wheelDeltaY;
1396};
1397Evt.IsPassiveListenersSupported = function() {
1398 if(Browser.Chrome && Browser.MajorVersion > 69 || Browser.Edge && Browser.MajorVersion > 15 || Browser.Firefox && Browser.MajorVersion > 62)
1399  return true;
1400 if(Evt.isPassiveListenersSupported === undefined) {
1401  Evt.isPassiveListenersSupported = false;
1402  try {
1403   var options = Object.defineProperty({}, "passive", { get: function() { Evt.isPassiveListenersSupported = true; } });
1404   window.addEventListener("test", options, options);
1405   window.removeEventListener("test", options, options);
1406  }
1407  catch(err) { Evt.isPassiveListenersSupported = false; }
1408 }
1409 return !!Evt.isPassiveListenersSupported;
1410};
1411Evt.AttachEventToElement = function(element, eventName, func, onlyBubbling, passive) {
1412 if(element.addEventListener)
1413  element.addEventListener(eventName, func, Evt.IsPassiveListenersSupported() ? { capture: !onlyBubbling, passive: !!passive } : !onlyBubbling);
1414 else
1415  element.attachEvent("on" + eventName, func);
1416};
1417Evt.DetachEventFromElement = function(element, eventName, func) {
1418 if(element.removeEventListener)
1419  element.removeEventListener(eventName, func, true);
1420 else
1421  element.detachEvent("on" + eventName, func);
1422};
1423Evt.AttachEventToDocument = function(eventName, func) {
1424 var attachingAllowed = ASPx.TouchUIHelper.onEventAttachingToDocument(eventName, func);
1425 if(attachingAllowed)
1426  Evt.AttachEventToDocumentCore(eventName, func);
1427};
1428Evt.AttachEventToDocumentCore = function(eventName, func) {
1429 Evt.AttachEventToElement(document, eventName, func);
1430};
1431Evt.DetachEventFromDocument = function(eventName, func) {
1432 Evt.DetachEventFromDocumentCore(eventName, func);
1433 ASPx.TouchUIHelper.onEventDettachedFromDocument(eventName, func);
1434};
1435Evt.DetachEventFromDocumentCore = function(eventName, func){
1436 Evt.DetachEventFromElement(document, eventName, func);
1437};
1438Evt.GetMouseWheelEventName = function() {
1439 if(Browser.Safari)
1440  return "mousewheel";
1441 if(Browser.NetscapeFamily && Browser.MajorVersion < 17)
1442  return "DOMMouseScroll";
1443 return "wheel";
1444};
1445Evt.AttachMouseEnterToElement = function (element, onMouseOverHandler, onMouseOutHandler) {
1446 Evt.AttachEventToElement(element, ASPx.TouchUIHelper.pointerEnabled ? ASPx.TouchUIHelper.pointerOverEventName : "mouseover", function (evt) { mouseEnterHandler(evt, element, onMouseOverHandler, onMouseOutHandler); });
1447 Evt.AttachEventToElement(element, ASPx.TouchUIHelper.pointerEnabled ? ASPx.TouchUIHelper.pointerOutEventName : "mouseout", function (evt) { mouseEnterHandler(evt, element, onMouseOverHandler, onMouseOutHandler); });
1448};
1449Evt.GetEventRelatedTarget = function(evt, isMouseOverEvent) {
1450 return evt.relatedTarget || (isMouseOverEvent ? evt.srcElement : evt.toElement);
1451};
1452function mouseEnterHandler(evt, element, onMouseOverHandler, onMouseOutHandler) {
1453 var isMouseOverExecuted = !!element.dxMouseOverExecuted;
1454 var isMouseOverEvent = (evt.type == "mouseover" || evt.type == ASPx.TouchUIHelper.pointerOverEventName);
1455 if(isMouseOverEvent && isMouseOverExecuted || !isMouseOverEvent && !isMouseOverExecuted)
1456  return;
1457 var source = Evt.GetEventRelatedTarget(evt, isMouseOverEvent);
1458 if(!ASPx.GetIsParent(element, source)) {
1459  element.dxMouseOverExecuted = isMouseOverEvent;
1460  if(isMouseOverEvent)
1461   onMouseOverHandler(element);
1462  else
1463   onMouseOutHandler(element);
1464 }
1465 else if(isMouseOverEvent && !isMouseOverExecuted) {
1466  element.dxMouseOverExecuted = true;
1467  onMouseOverHandler(element);
1468 }
1469}
1470Evt.DispatchEvent = function(target, eventName, canBubble, cancellable) {
1471 var event;
1472 if(Browser.IE && Browser.Version < 9) {
1473  eventName = "on" + eventName;
1474  if(eventName in target) {
1475   event = document.createEventObject();
1476   target.fireEvent("on" + eventName, event);
1477  }
1478 } else {
1479  event = document.createEvent("Event");
1480  event.initEvent(eventName, canBubble || false, cancellable || false);
1481  target.dispatchEvent(event);
1482 }
1483};
1484Evt.EmulateDocumentOnMouseDown = function(evt) {
1485 Evt.EmulateOnMouseDown(document, evt);
1486};
1487Evt.EmulateOnMouseDown = function(element, evt) {
1488 if(Browser.IE && Browser.Version < 9)
1489  element.fireEvent("onmousedown", evt);
1490 else if(!Browser.WebKitFamily){
1491  var emulatedEvt = document.createEvent("MouseEvents");
1492  emulatedEvt.initMouseEvent("mousedown", true, true, window, 0, evt.screenX, evt.screenY, 
1493   evt.clientX, evt.clientY, evt.ctrlKey, evt.altKey, evt.shiftKey, false, 0, null);
1494  element.dispatchEvent(emulatedEvt);
1495 }
1496};
1497Evt.EmulateOnMouseEvent = function (type, element, evt) {
1498 evt.type = type;
1499 var emulatedEvt = document.createEvent("MouseEvents");
1500 emulatedEvt.initMouseEvent(type, true, true, window, 0, evt.screenX, evt.screenY,
1501  evt.clientX, evt.clientY, evt.ctrlKey, evt.altKey, evt.shiftKey, false, 0, null);
1502 emulatedEvt.target = element;
1503 element.dispatchEvent(emulatedEvt);
1504};
1505Evt.EmulateMouseClick = function (element, evt) {
1506 var x = element.offsetWidth / 2;
1507 var y = element.offsetHeight / 2;
1508 if (!evt)
1509  evt = {
1510   bubbles: true,
1511   cancelable: true,
1512   view: window,
1513   detail: 1,
1514   screenX: 0,
1515   screenY: 0,
1516   clientX: x,
1517   clientY: y,
1518   ctrlKey: false,
1519   altKey: false,
1520   shiftKey: false,
1521   metaKey: false,
1522   button: 0,
1523   relatedTarget: null
1524  };
1525 Evt.EmulateOnMouseEvent("mousedown", element, evt);
1526 Evt.EmulateOnMouseEvent("mouseup", element, evt);
1527 Evt.EmulateOnMouseEvent("click", element, evt);
1528};
1529Evt.DoElementClick = function(element) {
1530 try{
1531  element.click();
1532 }
1533 catch(e){ 
1534 }
1535};
1536Evt.IsActionKeyPressed = function(evt) {
1537 return evt.keyCode === ASPx.Key.Space ||
1538     evt.keyCode === ASPx.Key.Enter ||
1539    (evt.keyCode === ASPx.Key.Down && evt.altKey);
1540};
1541Evt.InvokeMouseClickByKeyDown = function(evt, handler) {
1542 if(Evt.IsActionKeyPressed(evt)) {
1543  ASPx.Evt.PreventEvent(evt); 
1544  if(!handler)
1545   ASPx.Evt.GetEventSource(evt).onclick();
1546  else
1547   handler(evt);
1548 }
1549};
1550ASPx.Evt = Evt;
1551var Attr = { };
1552Attr.GetAttribute = function(obj, attrName){
1553 if(obj.getAttribute)
1554  return obj.getAttribute(attrName);
1555 else if(obj.getPropertyValue)
1556  return obj.getPropertyValue(attrName);
1557 return null;
1558};
1559Attr.SetAttribute = function(obj, attrName, value){
1560 if(obj.setAttribute) {
1561  if(isSourceResetRequired() && attrName.toLowerCase() === "src") 
1562   obj.setAttribute(attrName, "");
1563  obj.setAttribute(attrName, value);
1564 } else if(obj.setProperty)
1565  obj.setProperty(attrName, value, "");
1566};
1567Attr.RemoveAttribute = function(obj, attrName){
1568 if(obj.removeAttribute)
1569  obj.removeAttribute(attrName);
1570 else if(obj.removeProperty)
1571  obj.removeProperty(attrName);
1572};
1573Attr.IsExistsAttribute = function(obj, attrName){
1574 var value = Attr.GetAttribute(obj, attrName);
1575 return (value != null) && (value !== "");
1576};
1577Attr.SetOrRemoveAttribute = function(obj, attrName, value) {
1578 if(!value)
1579  Attr.RemoveAttribute(obj, attrName);
1580 else
1581  Attr.SetAttribute(obj, attrName, value);
1582};
1583Attr.SaveAttribute = function(obj, attrName, savedObj, savedAttrName){
1584 if(!Attr.IsExistsAttribute(savedObj, savedAttrName)){
1585  var oldValue = Attr.IsExistsAttribute(obj, attrName) ? Attr.GetAttribute(obj, attrName) : ASPx.EmptyObject;
1586  Attr.SetAttribute(savedObj, savedAttrName, oldValue);
1587 }
1588};
1589Attr.SaveStyleAttribute = function(obj, attrName){
1590 Attr.SaveAttribute(obj.style, attrName, obj, "saved" + attrName);
1591};
1592Attr.ChangeAttributeExtended = function(obj, attrName, savedObj, savedAttrName, newValue){
1593 Attr.SaveAttribute(obj, attrName, savedObj, savedAttrName);
1594 Attr.SetAttribute(obj, attrName, newValue);
1595};
1596Attr.ChangeAttribute = function(obj, attrName, newValue){
1597 Attr.ChangeAttributeExtended(obj, attrName, obj, "saved" + attrName, newValue);
1598};
1599Attr.ChangeStyleAttribute = function(obj, attrName, newValue){
1600 Attr.ChangeAttributeExtended(obj.style, attrName, obj, "saved" + attrName, newValue);
1601};
1602Attr.ResetAttributeExtended = function(obj, attrName, savedObj, savedAttrName){
1603 Attr.SaveAttribute(obj, attrName, savedObj, savedAttrName);
1604 Attr.SetAttribute(obj, attrName, "");
1605 Attr.RemoveAttribute(obj, attrName);
1606};
1607Attr.ResetAttribute = function(obj, attrName){
1608 Attr.ResetAttributeExtended(obj, attrName, obj, "saved" + attrName);
1609};
1610Attr.ResetStyleAttribute = function(obj, attrName){
1611 Attr.ResetAttributeExtended(obj.style, attrName, obj, "saved" + attrName);
1612};
1613Attr.RestoreAttributeExtended = function(obj, attrName, savedObj, savedAttrName){
1614 if(Attr.IsExistsAttribute(savedObj, savedAttrName)){
1615  var oldValue = Attr.GetAttribute(savedObj, savedAttrName);
1616  if(oldValue != ASPx.EmptyObject)
1617   Attr.SetAttribute(obj, attrName, oldValue);
1618  else
1619   Attr.RemoveAttribute(obj, attrName);
1620  Attr.RemoveAttribute(savedObj, savedAttrName);
1621  return true;
1622 }
1623 return false;
1624};
1625Attr.RestoreAttribute = function(obj, attrName){
1626 return Attr.RestoreAttributeExtended(obj, attrName, obj, "saved" + attrName);
1627};
1628Attr.RestoreStyleAttribute = function(obj, attrName){
1629 return Attr.RestoreAttributeExtended(obj.style, attrName, obj, "saved" + attrName);
1630};
1631Attr.CopyAllAttributes = function(sourceElem, destElement) {
1632 var attrs = sourceElem.attributes;
1633 for(var n = 0; n < attrs.length; n++) {
1634  var attr = attrs[n];
1635  if(attr.specified) {
1636   var attrName = attr.nodeName;
1637   var attrValue = sourceElem.getAttribute(attrName, 2);
1638   if(attrValue == null)
1639    attrValue = attr.nodeValue;
1640   destElement.setAttribute(attrName, attrValue, 0); 
1641  }
1642 }
1643 if(sourceElem.style.cssText !== '')
1644  destElement.style.cssText = sourceElem.style.cssText;
1645};
1646Attr.RemoveAllAttributes = function(element, excludedAttributes) {
1647 var excludedAttributesHashTable = {};
1648 if(excludedAttributes)
1649  excludedAttributesHashTable = Data.CreateHashTableFromArray(excludedAttributes);
1650 if(element.attributes) {
1651  var attrArray = element.attributes;
1652  for(var i = 0; i < attrArray.length; i++) {
1653   var attrName = attrArray[i].name;
1654   if(!ASPx.IsExists(excludedAttributesHashTable[attrName.toLowerCase()])) {
1655    try {
1656     attrArray.removeNamedItem(attrName);
1657    } catch (e) { }
1658   }
1659  }
1660 }
1661};
1662Attr.RemoveStyleAttribute = function(element, attrName) {
1663 if(element.style) {
1664  if(Browser.Firefox && element.style[attrName]) 
1665   element.style[attrName] = "";
1666  if(element.style.removeAttribute && element.style.removeAttribute != "")
1667   element.style.removeAttribute(attrName);
1668  else if(element.style.removeProperty && element.style.removeProperty != "")
1669   element.style.removeProperty(attrName);
1670 }
1671};
1672Attr.RemoveAllStyles = function(element) {
1673 if(element.style) {
1674  for(var key in element.style)
1675   Attr.RemoveStyleAttribute(element, key);
1676    Attr.RemoveAttribute(element, "style");
1677 }
1678};
1679Attr.GetTabIndexAttributeName = function(){
1680 return Browser.IE  ? "tabIndex" : "tabindex";
1681};
1682Attr.ChangeTabIndexAttribute = function(element){
1683 var attribute = Attr.GetTabIndexAttributeName(); 
1684 if(Attr.GetAttribute(element, attribute) != -1)
1685    Attr.ChangeAttribute(element, attribute, -1);
1686};
1687Attr.SaveTabIndexAttributeAndReset = function(element) {
1688 var attribute = Attr.GetTabIndexAttributeName();
1689 Attr.SaveAttribute(element, attribute, element, "saved" + attribute);
1690 Attr.SetAttribute(element, attribute, -1);
1691};
1692Attr.RestoreTabIndexAttribute = function(element){
1693 var attribute = Attr.GetTabIndexAttributeName();
1694 if(Attr.IsExistsAttribute(element, attribute)) {
1695  if(Attr.GetAttribute(element, attribute) == -1) {
1696   if(Attr.IsExistsAttribute(element, "saved" + attribute)){
1697    var oldValue = Attr.GetAttribute(element, "saved" + attribute);
1698    if(oldValue != ASPx.EmptyObject)
1699     Attr.SetAttribute(element, attribute, oldValue);
1700    else {
1701     if(Browser.WebKitFamily) 
1702      Attr.SetAttribute(element, attribute, 0); 
1703     Attr.RemoveAttribute(element, attribute);   
1704    }
1705    Attr.RemoveAttribute(element, "saved" + attribute); 
1706   }
1707  }
1708 }
1709};
1710Attr.ChangeAttributesMethod = function(enabled){
1711 return enabled ? Attr.RestoreAttribute : Attr.ResetAttribute;
1712};
1713Attr.InitiallyChangeAttributesMethod = function(enabled){
1714 return enabled ? Attr.ChangeAttribute : Attr.ResetAttribute;
1715};
1716Attr.ChangeStyleAttributesMethod = function(enabled){
1717 return enabled ? Attr.RestoreStyleAttribute : Attr.ResetStyleAttribute;
1718};
1719Attr.InitiallyChangeStyleAttributesMethod = function(enabled){
1720 return enabled ? Attr.ChangeStyleAttribute : Attr.ResetStyleAttribute;
1721};
1722Attr.ChangeEventsMethod = function(enabled){
1723 return enabled ? Evt.AttachEventToElement : Evt.DetachEventFromElement;
1724};
1725Attr.ChangeDocumentEventsMethod = function(enabled){
1726 return enabled ? Evt.AttachEventToDocument : Evt.DetachEventFromDocument;
1727};
1728Attr.ChangeCellSpanCount = function(cell, value, isColumnSpan) {
1729 if(!cell) return;
1730 var propertyKey = isColumnSpan ? "colSpan" : "rowSpan";
1731 var prevValue = cell[propertyKey];
1732 if(value > 1)
1733  cell[propertyKey] = value;
1734 else if(prevValue !== 1)
1735  Attr.RemoveAttribute(cell, propertyKey);
1736};
1737function isSourceResetRequired() {
1738 return Browser.IE && Browser.MajorVersion >= 11;
1739}
1740ASPx.Attr = Attr;
1741var Aria = {
1742 atomic: "aria-atomic",
1743 checked: "aria-checked",
1744 descendant: "aria-activedescendant",
1745 described: "aria-describedby",
1746 disabled: "aria-disabled",
1747 expanded: "aria-expanded",
1748 haspopup: "aria-haspopup",
1749 invalid: "aria-invalid",
1750 label: "aria-label",
1751 labelled: "aria-labelledby",
1752 level: "aria-level",
1753 owns: "aria-owns",
1754 posinset: "aria-posinset",
1755 role: "role",
1756 selected: "aria-selected",
1757 setsize: "aria-setsize",
1758 valuemax: "aria-valuemax",
1759 valuemin: "aria-valuemin",
1760 valuenow: "aria-valuenow"
1761};
1762Aria.SetOrRemoveDescendant = function(obj, value) {
1763 ASPx.Attr.SetOrRemoveAttribute(obj, Aria.descendant, value);
1764};
1765Aria.SetOrRemoveLabel = function(obj, value) {
1766 ASPx.Attr.SetOrRemoveAttribute(obj, Aria.label, value);
1767};
1768Aria.AppendLabel = function(obj, value, checkExists) {
1769 var currentValue = ASPx.Attr.GetAttribute(obj, Aria.label) || "";
1770 var resultParts = [ ];
1771 if(currentValue)
1772  resultParts.push(currentValue);
1773 var needAppendValue = value && (!checkExists || currentValue.indexOf(value) == -1);
1774 if(needAppendValue)
1775  resultParts.push(value);
1776 ASPx.Attr.SetAttribute(obj, Aria.label, resultParts.join(" "));
1777};
1778Aria.SetOrRemoveLabelled = function(obj, value) {
1779 ASPx.Attr.SetOrRemoveAttribute(obj, Aria.labelled, value);
1780};
1781Aria.SetApplicationRole = function(obj) {
1782  ASPx.Attr.SetAttribute(obj, Aria.role, "application");
1783};
1784Aria.SetSilence = function(obj) {
1785 ASPx.Attr.SetAttribute(obj, Aria.label, ";");
1786};
1787Aria.SetExpanded = function(obj, expanded) {
1788 if(!obj || !ASPx.Attr.GetAttribute(obj, Aria.expanded)) return;
1789 Aria.SetBoolAttribute(obj, Aria.expanded, expanded);
1790};
1791Aria.SetAtomic = function(obj, value) {
1792 Aria.SetBoolAttribute(obj, Aria.atomic, value);
1793};
1794Aria.SetBoolAttribute = function(obj, attribute, value) {
1795 if(value)
1796  ASPx.Attr.SetAttribute(obj, attribute, true);
1797 else 
1798  ASPx.Attr.SetAttribute(obj, attribute, false);
1799};
1800ASPx.Attr.Aria = Aria;
1801var Color = { };
1802function _aspxToHex(d) {
1803 return (d < 16) ? ("0" + d.toString(16)) : d.toString(16);
1804}
1805Color.RGBRegexp = /rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/;
1806Color.ColorToHexadecimal = function(colorValue) {
1807 if(typeof(colorValue) == "number") {
1808  var r = colorValue & 0xFF;
1809  var g = (colorValue >> 8) & 0xFF;
1810  var b = (colorValue >> 16) & 0xFF;
1811  return "#" + _aspxToHex(r) + _aspxToHex(g) + _aspxToHex(b);
1812 }
1813 if(colorValue && (colorValue.substr(0, 3).toLowerCase() == "rgb")) {
1814  var regResult = colorValue.toLowerCase().match(Color.RGBRegexp);
1815  if(regResult) {
1816   var r = parseInt(regResult[1]);
1817   var g = parseInt(regResult[2]);
1818   var b = parseInt(regResult[3]);
1819   return "#" + _aspxToHex(r) + _aspxToHex(g) + _aspxToHex(b);
1820  }
1821  return null;
1822 } 
1823 if(colorValue && (colorValue.charAt(0) == "#"))
1824  return colorValue;
1825 return null;
1826};
1827Color.Names = {
1828 AddColorNames: function(stringResourcesObj) {
1829  if(stringResourcesObj) {
1830   for(var key in stringResourcesObj)
1831    if(stringResourcesObj.hasOwnProperty(key))
1832     this[key] = stringResourcesObj[key];
1833  }
1834 }
1835};
1836ASPx.Color = Color;
1837var Url = { };
1838Url.Navigate = function(url, target) {
1839 var javascriptPrefix = "javascript:";
1840 if(!url || url === "")
1841  return;
1842 else if(url.indexOf(javascriptPrefix) != -1) 
1843  eval(url.substr(javascriptPrefix.length));
1844 else {
1845  try{
1846   if(target != "")
1847    navigateTo(url, target);
1848   else
1849    location.href = url;
1850  }
1851  catch(e){
1852  }
1853 }
1854};
1855Url.NavigateByLink = function(linkElement) {
1856 Url.Navigate(Attr.GetAttribute(linkElement, "href"), linkElement.target);
1857};
1858Url.GetAbsoluteUrl = function(url) {
1859 if(url)
1860  url = Url.getURLObject(url).href;
1861 return url;
1862};
1863Url.Redirect = function(url) {
1864 if(!ASPx.Browser.IE)
1865  window.location.href = url;
1866 else { 
1867  var fakeLink = document.createElement("a");
1868  fakeLink.href = url;
1869  document.body.appendChild(fakeLink);
1870  try { fakeLink.click(); } catch(e) { } 
1871 }
1872};
1873var absolutePathPrefixes = 
1874 [ "about:", "file:///", "ftp://", "gopher://", "http://", "https://", "javascript:", "mailto:", "news:", "res://", "telnet://", "view-source:" ];
1875Url.isAbsoluteUrl = function(url) {
1876 if (url) {
1877  for (var i = 0; i < absolutePathPrefixes.length; i++) {
1878   if(url.indexOf(absolutePathPrefixes[i]) == 0)
1879    return true;
1880  }
1881 }
1882 return false;
1883};
1884Url.getURLObject = function(url) {
1885 var link = document.createElement('A');
1886 link.href = url || "";
1887 return { 
1888  href: link.href,
1889  protocol: link.protocol,
1890  host: link.host,
1891  port: link.port,
1892  pathname: link.pathname,
1893  search: link.search,
1894  hash: link.hash
1895 }; 
1896};
1897Url.getRootRelativeUrl = function(url) {
1898 return getRelativeUrl(url, !Url.isRootRelativeUrl(url), true); 
1899};
1900Url.getPathRelativeUrl = function(url) {
1901 return getRelativeUrl(url, !Url.isPathRelativeUrl(url), false);
1902};
1903function getRelativeUrl(url, isValid, isRootRelative) {
1904 if(url && !(/data:([^;]+\/?[^;]*)(;charset=[^;]*)?(;base64,)/.test(url)) && isValid) {
1905  var urlObject = Url.getURLObject(url);
1906  var baseUrlObject = Url.getURLObject();
1907  if(!Url.isAbsoluteUrl(url) || urlObject.host === baseUrlObject.host && urlObject.protocol === baseUrlObject.protocol) {
1908   url = urlObject.pathname;
1909   if(!isRootRelative)
1910    url = getPathRelativeUrl(baseUrlObject.pathname, url);
1911   url = url + urlObject.search + urlObject.hash;
1912  }
1913 }
1914 return url;   
1915}
1916function getPathRelativeUrl(baseUrl, url) {
1917 var requestSegments = getSegments(baseUrl, false);
1918 var urlSegments = getSegments(url, true);
1919 return buildPathRelativeUrl(requestSegments, urlSegments, 0, 0, "");
1920}
1921function getSegments(url, addTail) {
1922 var segments = [];
1923 var startIndex = 0;
1924 var endIndex = -1;
1925 while ((endIndex = url.indexOf("/", startIndex)) != -1) {
1926  segments.push(url.substring(startIndex, ++endIndex));
1927  startIndex = endIndex;
1928 }
1929 if(addTail && startIndex < url.length)
1930  segments.push(url.substring(startIndex, url.length)); 
1931 return segments;
1932}
1933function buildPathRelativeUrl(requestSegments, urlSegments, reqIndex, urlIndex, buffer) {
1934 if(urlIndex >= urlSegments.length)
1935  return buffer;
1936 if(reqIndex >= requestSegments.length)
1937  return buildPathRelativeUrl(requestSegments, urlSegments, reqIndex, urlIndex + 1, buffer + urlSegments[urlIndex]);
1938 if(requestSegments[reqIndex] === urlSegments[urlIndex] && urlIndex === reqIndex)
1939  return buildPathRelativeUrl(requestSegments, urlSegments, reqIndex + 1, urlIndex + 1, buffer);
1940 return buildPathRelativeUrl(requestSegments, urlSegments, reqIndex + 1, urlIndex, buffer + "../");
1941}
1942Url.isPathRelativeUrl = function(url) {
1943 return !!url && !Url.isAbsoluteUrl(url) && url.indexOf("/") != 0;  
1944};
1945Url.isRootRelativeUrl = function(url) {
1946 return !!url && !Url.isAbsoluteUrl(url) && url.indexOf("/") == 0 && url.indexOf("//") != 0;
1947};
1948function navigateTo(url, target) {
1949 var lowerCaseTarget = target.toLowerCase();
1950 if("_top" == lowerCaseTarget)
1951  top.location.href = url;
1952 else if("_self" == lowerCaseTarget)
1953  location.href = url;
1954 else if("_search" == lowerCaseTarget)
1955  openInNewWindow(url);
1956 else if("_media" == lowerCaseTarget)
1957  openInNewWindow(url);
1958 else if("_parent" == lowerCaseTarget)
1959  window.parent.location.href = url;
1960 else if("_blank" == lowerCaseTarget)
1961  openInNewWindow(url);
1962 else {
1963  var frame = getFrame(top.frames, target);
1964  if(frame != null)
1965   frame.location.href = url;
1966  else
1967   openInNewWindow(url);
1968 }
1969}
1970function openInNewWindow(url) {
1971 if(ASPx.Browser.Safari)
1972  openInNewWindowViaIframe(url);
1973 else {
1974  var newWindow = window.open();
1975  newWindow.opener = null;
1976  newWindow.location = url;
1977 }
1978}
1979function openInNewWindowViaIframe(url) {
1980 var iframe = document.createElement('iframe');
1981 iframe.style.display = 'none';
1982 document.body.appendChild(iframe);
1983 var iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
1984 var openArgs = '"' + url + '"';
1985 var script = iframeDoc.createElement('script');
1986 script.type = 'text/javascript';
1987 script.text = 'window.parent = null; ' +
1988  'window.top = null;' +
1989  'window.frameElement = null;' +
1990  'var child = window.open(' + openArgs + ');' +
1991  'child.opener = null';
1992 iframeDoc.body.appendChild(script);
1993 document.body.removeChild(iframe);
1994}
1995ASPx.Url = Url;
1996var Json = { };
1997function isValid(JsonString) {
1998 return !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(JsonString.replace(/"(\\.|[^"\\])*"/g, '')));
1999}
2000Json.Eval = function(jsonString, controlName) {
2001 if(isValid(jsonString))
2002  return eval("(" + jsonString + ")");
2003 else
2004  throw new Error(controlName + " received incorrect JSON-data: " + jsonString);
2005};
2006Json.ToJson = function(param){
2007 var paramType = typeof(param);
2008 if((paramType == "undefined") || (param == null))
2009  return null;
2010 if((paramType == "object") && (typeof(param.__toJson) == "function"))
2011  return param.__toJson();
2012 if((paramType == "number") || (paramType == "boolean"))
2013  return param;
2014 if(param.constructor == Date)
2015  return dateToJson(param);
2016 if(paramType == "string") {
2017  var result = param.replace(/\\/g, "\\\\");
2018  result = result.replace(/"/g, "\\\"");
2019  result = result.replace(/\n/g, "\\n");
2020  result = result.replace(/\r/g, "\\r");
2021  result = result.replace(/</g, "\\u003c");
2022  result = result.replace(/>/g, "\\u003e");
2023  return "\"" + result + "\"";
2024 }
2025 if(param.constructor == Array){
2026  var values = [];
2027  for(var i = 0; i < param.length; i++) {
2028   var jsonValue = Json.ToJson(param[i]);
2029   if(jsonValue === null)
2030    jsonValue = "null";
2031   values.push(jsonValue);
2032  }
2033  return "[" + values.join(",") + "]";
2034 }
2035 var exceptKeys = {};
2036 if(ASPx.Ident.IsArray(param.__toJsonExceptKeys))
2037  exceptKeys = Data.CreateHashTableFromArray(param.__toJsonExceptKeys);
2038 exceptKeys["__toJsonExceptKeys"] = 1;
2039 var values = [];
2040 for(var key in param) {
2041  if(param.hasOwnProperty(key)) {
2042   if(ASPx.IsFunction(param[key]))
2043    continue;
2044   if(exceptKeys[key] == 1)
2045    continue;
2046   values.push(Json.ToJson(key) + ":" + Json.ToJson(param[key]));
2047  }
2048 }
2049 return "{" + values.join(",") + "}";
2050};
2051function dateToJson(date) {
2052 var result = [ 
2053  date.getFullYear(),
2054  date.getMonth(),
2055  date.getDate()
2056 ];
2057 var time = {
2058  h: date.getHours(),
2059  m: date.getMinutes(),
2060  s: date.getSeconds(),
2061  ms: date.getMilliseconds()
2062 };
2063 if(time.h || time.m || time.s || time.ms)
2064  result.push(time.h);
2065 if(time.m || time.s || time.ms)
2066  result.push(time.m);
2067 if(time.s || time.ms)
2068  result.push(time.s);
2069 if(time.ms)
2070  result.push(time.ms);
2071 return "new Date(" + result.join() + ")";
2072}
2073ASPx.Json = Json;
2074ASPx.CreateClass = function(parentClass, properties) {
2075 if(arguments.length == 1) {
2076  properties = parentClass;
2077  parentClass = null;
2078 }
2079 var ret = function() {
2080  if(ret.preparing) 
2081   return delete(ret.preparing);
2082  if(ret.constr) {
2083   this.constructor = ret;
2084   ret.constr.apply(this, arguments);
2085  }
2086 };
2087 ret.prototype = {};
2088 if(parentClass) {
2089  parentClass.preparing = true;
2090  for(var name in parentClass) {
2091   if(parentClass.hasOwnProperty(name) && name != 'constr' && ASPx.IsFunction(parentClass[name]) && !ret[name])
2092    ret[name] = parentClass[name].aspxBind(parentClass);
2093  }
2094  ret.prototype = new parentClass;
2095  ret.prototype.constructor = parentClass;
2096  ret.constr = parentClass;
2097 }
2098 if(properties) {
2099  var constructorName = "constructor";
2100  for(var name in properties) {
2101   if(!properties.hasOwnProperty(name)) 
2102    continue;
2103   var getter = Object.getOwnPropertyDescriptor(properties, name).get;
2104   var setter = Object.getOwnPropertyDescriptor(properties, name).set;
2105   if(getter || setter)
2106    Object.defineProperty(ret.prototype, name, {
2107     set: setter,
2108     get: getter,
2109     enumerable: true,
2110     configurable: true
2111    });
2112   if(name != constructorName && !getter && !setter)
2113    ret.prototype[name] = properties[name];
2114  }
2115  if(properties[constructorName] && properties[constructorName] != Object)
2116   ret.constr = properties[constructorName];
2117 }
2118 return ret;
2119};
2120ASPx.FormatCallbackArg = function(prefix, arg) {
2121 if(prefix == null && arg == null)
2122  return ""; 
2123 if(prefix == null) prefix = "";
2124 if(arg == null) arg = "";
2125 if(arg != null && !ASPx.IsExists(arg.length) && ASPx.IsExists(arg.value))
2126  arg = arg.value;
2127 arg = arg.toString();
2128 return [prefix, '|', arg.length, '|' , arg].join('');
2129};
2130ASPx.FormatCallbackArgs = function(callbackData) {
2131 var sb = [ ];
2132 for(var i = 0; i < callbackData.length; i++)
2133  sb.push(ASPx.FormatCallbackArg(callbackData[i][0], callbackData[i][1]));
2134 return sb.join("");
2135};
2136ASPx.ParseShortcutString = function(shortcutString) {
2137 if(!shortcutString)
2138  return 0;
2139 var isCtrlKey = false;
2140 var isShiftKey = false;
2141 var isAltKey = false;
2142 var isMetaKey = false;
2143 var keyCode = null;
2144 var shcKeys = shortcutString.toString().split("+");
2145 if(shcKeys.length > 0) {
2146  for(var i = 0; i < shcKeys.length; i++) {
2147   var key = Str.Trim(shcKeys[i].toUpperCase());
2148   switch (key) {
2149    case "CONTROL":
2150    case "CONTROLKEY":
2151    case "CTRL":
2152     isCtrlKey = true;
2153     break;
2154    case "SHIFT":
2155    case "SHIFTKEY":
2156     isShiftKey = true;
2157     break;
2158    case "ALT":
2159     isAltKey = true;
2160     break;
2161    case "CMD":
2162     isMetaKey = true;
2163     break;
2164    case "F1": keyCode = ASPx.Key.F1; break;
2165    case "F2": keyCode = ASPx.Key.F2; break;
2166    case "F3": keyCode = ASPx.Key.F3; break;
2167    case "F4": keyCode = ASPx.Key.F4; break;
2168    case "F5": keyCode = ASPx.Key.F5; break;
2169    case "F6": keyCode = ASPx.Key.F6; break;
2170    case "F7": keyCode = ASPx.Key.F7; break;
2171    case "F8": keyCode = ASPx.Key.F8; break;
2172    case "F9": keyCode = ASPx.Key.F9; break;
2173    case "F10":   keyCode = ASPx.Key.F10; break;
2174    case "F11":   keyCode = ASPx.Key.F11; break;
2175    case "F12":   keyCode = ASPx.Key.F12; break;
2176    case "RETURN":
2177    case "ENTER": keyCode = ASPx.Key.Enter; break;
2178    case "HOME":  keyCode = ASPx.Key.Home; break;
2179    case "END":   keyCode = ASPx.Key.End; break;
2180    case "LEFT":  keyCode = ASPx.Key.Left; break;
2181    case "RIGHT": keyCode = ASPx.Key.Right; break;
2182    case "UP": keyCode = ASPx.Key.Up; break;
2183    case "DOWN":  keyCode = ASPx.Key.Down; break;
2184    case "PAGEUP": keyCode = ASPx.Key.PageUp; break;
2185    case "PAGEDOWN": keyCode = ASPx.Key.PageDown; break;
2186    case "SPACE": keyCode = ASPx.Key.Space; break;
2187    case "TAB":   keyCode = ASPx.Key.Tab; break;
2188    case "BACKSPACE": 
2189    case "BACK": keyCode = ASPx.Key.Backspace; break;
2190    case "CONTEXT": keyCode = ASPx.Key.ContextMenu; break;
2191    case "ESCAPE":
2192    case "ESC":
2193     keyCode = ASPx.Key.Esc;
2194     break;
2195    case "DELETE":
2196    case "DEL":
2197     keyCode = ASPx.Key.Delete;
2198     break;
2199    case "INSERT":
2200    case "INS":
2201     keyCode = ASPx.Key.Insert;
2202     break;
2203    case "PLUS":
2204     keyCode = "+".charCodeAt(0);
2205     break;
2206    default:
2207     keyCode = key.charCodeAt(0);
2208     break;
2209   }
2210  }
2211 } else
2212  ASPx.ShowErrorAlert("Invalid shortcut");
2213 return ASPx.GetShortcutCode(keyCode, isCtrlKey, isShiftKey, isAltKey, isMetaKey);
2214};
2215ASPx.GetShortcutCode = function(keyCode, isCtrlKey, isShiftKey, isAltKey, isMetaKey) {
2216 var value = keyCode & 0xFFFF;
2217 var flags = 0;
2218 flags |= isCtrlKey ? 1 << 0 : 0;
2219 flags |= isShiftKey ? 1 << 2 : 0;
2220 flags |= isAltKey ? 1 << 4 : 0;
2221 flags |= isMetaKey ? 1 << 8 : 0;
2222 value |= flags << 16;
2223 return value;
2224};
2225ASPx.GetShortcutCodeByEvent = function(evt) {
2226 return ASPx.GetShortcutCode(Evt.GetKeyCode(evt), evt.ctrlKey, evt.shiftKey, evt.altKey, ASPx.Browser.MacOSPlatform ? evt.metaKey : false);
2227};
2228ASPx.IsPasteShortcut = function(evt) {
2229 if(evt.type === "paste")
2230  return true;
2231 var keyCode = Evt.GetKeyCode(evt);
2232 if(Browser.NetscapeFamily && evt.which == 0)  
2233  keyCode = evt.keyCode;
2234 return (evt.ctrlKey && (keyCode == 118  || (keyCode == 86))) ||
2235     (evt.shiftKey && !evt.ctrlKey && !evt.altKey &&
2236     (keyCode == ASPx.Key.Insert)) ;
2237};
2238var NotPrintableKeyCodes = null;
2239ASPx.IsPrintableKey = function(keyCode) {
2240 if (!NotPrintableKeyCodes)
2241  NotPrintableKeyCodes = Object.keys(ASPx.Key).map(function(key) { return ASPx.Key[key]; });
2242 return !ASPx.Data.ArrayContains(NotPrintableKeyCodes, keyCode);
2243};
2244ASPx.SetFocus = function(element, selectAction) {
2245 function focusCore(element, selectAction){
2246  try {
2247    element.focus();
2248    if(Browser.IE && document.activeElement != element)
2249     element.focus();
2250    if(selectAction) {
2251     var currentSelection = Selection.GetInfo(element);
2252     if(currentSelection.startPos == currentSelection.endPos) {
2253      switch(selectAction) {
2254       case "start":
2255        Selection.SetCaretPosition(element, 0);
2256        break;
2257       case "all":
2258        Selection.Set(element);
2259        break;
2260      }
2261     }
2262    }
2263   } catch (e) {
2264  }
2265 }
2266 if(ASPxClientUtils.iOSPlatform) 
2267  focusCore(element, selectAction);
2268 else {
2269  window.setTimeout(function() { 
2270   focusCore(element, selectAction);
2271  }, 100);
2272 }
2273};
2274ASPx.IsFocusableCore = function(element, skipContainerVisibilityCheck) {
2275 var current = element;
2276 while(current && current.nodeType == 1) {
2277  if(current == element || !skipContainerVisibilityCheck(current)) {
2278   var tagName = current.tagName.toUpperCase();
2279   if(tagName == "BODY")
2280    return true;
2281   var disabledElementTags = ["INPUT", "BUTTON", "TEXTAREA", "SELECT", "OPTION"];
2282   if(disabledElementTags.indexOf(tagName) !== -1 && current.disabled || !ASPx.GetElementDisplay(current) || !ASPx.GetElementVisibility(current))
2283    return false;
2284  }
2285  current = current.parentNode;
2286 }
2287 return true;
2288};
2289ASPx.IsFocusable = function(element) {
2290 return ASPx.IsFocusableCore(element, ASPx.FalseFunction);
2291};
2292ASPx.IsActionElement = function(element) {
2293 if(!ASPx.IsExistsElement(element))
2294  return false;
2295 var tabIndex = parseInt(ASPx.Attr.GetAttribute(element, ASPx.Attr.GetTabIndexAttributeName()));
2296 var hasTabIndex = !isNaN(tabIndex);
2297 var hasNonNegativeTabIndex = hasTabIndex && tabIndex > -1;
2298 var hasNegativeTabIndex = hasTabIndex && tabIndex < 0;
2299 var tagName = element.tagName;
2300 var focusableElementTags = ["BUTTON", "SELECT", "TEXTAREA", "OPTION", "IFRAME"];
2301 var isFocusableCore = ASPx.IsFocusable(element);
2302 var isFocusableTag = focusableElementTags.indexOf(tagName) !== -1;
2303 var isFocusableLink = tagName === "A" && (!!element.href || hasNonNegativeTabIndex);
2304 var isFocusableInput = tagName === "INPUT" && element.type.toLowerCase() !== "hidden";
2305 var isFocusableByTabIndex = tagName !== "INPUT" && hasNonNegativeTabIndex;
2306 var isEditableDiv = tagName == "DIV" && element.contentEditable === "true";
2307 return isFocusableCore && !hasNegativeTabIndex && (isFocusableTag || isFocusableLink || isFocusableInput || isFocusableByTabIndex || isEditableDiv);
2308};
2309ASPx.GetCanBeActiveElementsInContainer = function(container) {
2310 var canBeActiveTags = ["INPUT", "A", "UL", "BUTTON", "TEXTAREA", "SELECT", "IFRAME"],
2311  canBeActiveElements = [];
2312 Data.ForEach(canBeActiveTags, function(tag) {
2313  var elements = container.getElementsByTagName(tag);
2314  canBeActiveElements = canBeActiveElements.concat([].slice.call(elements));
2315 });
2316 return canBeActiveElements;
2317};
2318function isActionElementAllowedByPredicate(element, predicate) {
2319  var allowedByPredicate = !predicate || predicate(element);
2320  return allowedByPredicate && ASPx.IsActionElement(element);
2321}
2322ASPx.FindChildActionElements = function(container, predicate) {
2323 return ASPx.GetNodes(container, function(el) {
2324  return isActionElementAllowedByPredicate(el, predicate);
2325 });
2326};
2327ASPx.FindAllSortedActionElements = function(container, predicate) {
2328 var result = [ ];
2329 if(!container || !container.getElementsByTagName) return result;
2330 var actionElements = ASPx.FindChildActionElements(container, predicate);
2331 var getTabOrderValue = function(el) {
2332  var tabIndex = parseInt(ASPx.Attr.GetAttribute(el, ASPx.Attr.GetTabIndexAttributeName()));
2333  return isNaN(tabIndex) ? 0 : tabIndex;
2334 };
2335 var positiveTabIndexElements = actionElements.filter(function(x) { return getTabOrderValue(x) > 0; });
2336 var nonPositiveTabIndexElements = actionElements.filter(function(x) { return getTabOrderValue(x) === 0; });
2337 var sortedTabIndexElements = positiveTabIndexElements.sort(function(x, y) { return getTabOrderValue(x) - getTabOrderValue(y); });
2338 result = sortedTabIndexElements.concat(nonPositiveTabIndexElements);
2339 return result;
2340};
2341ASPx.FindFirstChildActionElement = function(container, predicate) {
2342 if(!container || isActionElementAllowedByPredicate(container, predicate))
2343  return !container ? null : container;
2344 var sortedActionElements = ASPx.FindAllSortedActionElements(container, predicate);
2345 return sortedActionElements[0];
2346};
2347ASPx.FindLastChildActionElement = function(container, predicate) {
2348 if(!container)
2349  return null;
2350 var sortedActionElements = ASPx.FindAllSortedActionElements(container, predicate);
2351 var actionElement = sortedActionElements[sortedActionElements.length - 1];
2352 if(!actionElement && isActionElementAllowedByPredicate(container, predicate))
2353  actionElement = container;
2354 return actionElement;
2355};
2356ASPx.GetParentClientControls = function(name) {
2357 var nameParts = name.split("_");
2358 var result = [ ];
2359 var controlCollection = ASPx.GetControlCollection();
2360 for(var i = 1; i <= nameParts.length; i++) {
2361  var controlName = nameParts.slice(0, i).join("_");
2362  var control = controlCollection.Get(controlName);
2363  if(control)
2364   result.push(control);
2365 }
2366 return result;
2367};
2368ASPx.GetRootClientControl = function(childControlName) {
2369 var parentControls = ASPx.GetParentClientControls(childControlName);
2370 return parentControls[0];
2371};
2372ASPx.GetClientControlByElementID = function(elementID) {
2373 var parentControls = ASPx.GetParentClientControls(elementID);
2374 return parentControls[parentControls.length - 1];
2375};
2376ASPx.IsExists = function(obj){
2377 return (typeof(obj) != "undefined") && (obj != null);
2378};
2379ASPx.IsFunction = function(obj){
2380 return typeof(obj) == "function";
2381};
2382ASPx.IsNumber = function(str) {
2383 return !isNaN(parseFloat(str)) && isFinite(str);
2384};
2385ASPx.GetDefinedValue = function(value, defaultValue){
2386 return (typeof(value) != "undefined") ? value : defaultValue;
2387};
2388ASPx.CorrectJSFloatNumber = function(number) {
2389 var ret = 21; 
2390 var numString = number.toPrecision(21);
2391 numString = numString.replace("-", ""); 
2392 var integerDigitsCount = numString.indexOf(ASPx.PossibleNumberDecimalSeparators[0]);
2393 if(integerDigitsCount < 0)
2394  integerDigitsCount = numString.indexOf(ASPx.PossibleNumberDecimalSeparators[1]);
2395 var floatDigitsCount = numString.length - integerDigitsCount - 1;
2396 if(floatDigitsCount < 10)
2397  return number;
2398 if(integerDigitsCount > 0) {
2399  ret = integerDigitsCount + 12;
2400 }
2401 var toPrecisionNumber = Math.min(ret, 21);
2402 var newValueString = number.toPrecision(toPrecisionNumber);
2403 return parseFloat(newValueString, 10);
2404};
2405ASPx.CorrectRounding = function(number, step) { 
2406 var regex = /[,|.](.*)/,
2407  isFloatValue = regex.test(number),
2408  isFloatStep = regex.test(step);
2409 if(isFloatValue || isFloatStep) {
2410  var valueAccuracy = (isFloatValue) ? regex.exec(number)[0].length - 1 : 0,
2411   stepAccuracy = (isFloatStep) ? regex.exec(step)[0].length - 1 : 0,
2412   accuracy = Math.max(valueAccuracy, stepAccuracy);
2413  var multiplier = Math.pow(10, accuracy);
2414  number = Math.round((number + step) * multiplier) / multiplier;
2415  return number;
2416 }
2417 return number + step;
2418};
2419ASPx.GetActiveElement = function() {
2420 try{ return document.activeElement; } catch(e) { return null; }
2421};
2422var verticalScrollBarWidth;
2423ASPx.GetVerticalScrollBarWidth = function() {
2424 if(typeof(verticalScrollBarWidth) == "undefined") {
2425  var container = document.createElement("DIV");
2426  container.style.cssText = "position: absolute; top: 0px; left: 0px; visibility: hidden; width: 200px; height: 150px; overflow: hidden; box-sizing: content-box";
2427  document.body.appendChild(container);
2428  var child = document.createElement("P");
2429  container.appendChild(child);
2430  child.style.cssText = "width: 100%; height: 200px;";
2431  var widthWithoutScrollBar = child.offsetWidth;
2432  container.style.overflow = "scroll";
2433  var widthWithScrollBar = child.offsetWidth;
2434  if(widthWithoutScrollBar == widthWithScrollBar)
2435   widthWithScrollBar = container.clientWidth;
2436  verticalScrollBarWidth = widthWithoutScrollBar - widthWithScrollBar;
2437  document.body.removeChild(container);
2438 }
2439 return verticalScrollBarWidth;
2440};
2441function hideScrollBarCore(element, scrollName) {
2442 if(element.tagName == "IFRAME") {
2443  if((element.scrolling == "yes") || (element.scrolling == "auto")) {
2444   Attr.ChangeAttribute(element, "scrolling", "no");
2445   return true;
2446  }
2447 }
2448 else if(element.tagName == "DIV") {
2449  if((element.style[scrollName] == "scroll") || (element.style[scrollName] == "auto")) {
2450   Attr.ChangeStyleAttribute(element, scrollName, "hidden");
2451   return true;
2452  }
2453 }
2454 return false;
2455}
2456function restoreScrollBarCore(element, scrollName) {
2457 if(element.tagName == "IFRAME")
2458  return Attr.RestoreAttribute(element, "scrolling");
2459 else if(element.tagName == "DIV")
2460  return Attr.RestoreStyleAttribute(element, scrollName);
2461 return false;
2462}
2463ASPx.SetScrollBarVisibilityCore = function(element, scrollName, isVisible) {
2464 return isVisible ? restoreScrollBarCore(element, scrollName) : hideScrollBarCore(element, scrollName);
2465};
2466ASPx.SetScrollBarVisibility = function(element, isVisible) {
2467 if(ASPx.SetScrollBarVisibilityCore(element, "overflow", isVisible)) 
2468  return true;
2469 var result = ASPx.SetScrollBarVisibilityCore(element, "overflowX", isVisible)
2470  || ASPx.SetScrollBarVisibilityCore(element, "overflowY", isVisible);
2471 return result;
2472};
2473ASPx.SetInnerHtml = function(element, html) {
2474 if(Browser.IE) {
2475  element.innerHTML = "<em>&nbsp;</em>" + html;
2476  element.removeChild(element.firstChild);
2477 } else
2478  element.innerHTML = html;
2479};
2480ASPx.GetInnerText = function(container) {
2481 if(Browser.Safari && Browser.MajorVersion <= 5) {
2482  var filter = getHtml2PlainTextFilter();
2483  filter.innerHTML = container.innerHTML;
2484  ASPx.SetElementDisplay(filter, true);
2485  var innerText = filter.innerText;
2486  ASPx.SetElementDisplay(filter, false);
2487  return innerText;
2488 } else if(Browser.NetscapeFamily || Browser.WebKitFamily || (Browser.IE && Browser.Version >= 9) || Browser.Edge) {
2489  return container.textContent;
2490 } else
2491  return container.innerText;
2492};
2493var html2PlainTextFilter = null;
2494function getHtml2PlainTextFilter() {
2495 if(html2PlainTextFilter == null) {
2496  html2PlainTextFilter = document.createElement("DIV");
2497  html2PlainTextFilter.style.width = "0";
2498  html2PlainTextFilter.style.height = "0";
2499  html2PlainTextFilter.style.overflow = "visible";
2500  ASPx.SetElementDisplay(html2PlainTextFilter, false);
2501  document.body.appendChild(html2PlainTextFilter);
2502 }
2503 return html2PlainTextFilter;
2504}
2505ASPx.CreateHiddenField = function(name, id, parent) {
2506 var input = document.createElement("INPUT");
2507 input.setAttribute("type", "hidden");
2508 if(name)
2509  input.setAttribute("name", name);
2510 if(id)
2511  input.setAttribute("id", id);
2512 if(parent)
2513  parent.appendChild(input);
2514 return input;
2515};
2516ASPx.CloneObject = function(srcObject) {
2517 if(typeof(srcObject) != 'object' || srcObject == null)
2518  return srcObject;
2519 var newObject = {};
2520 for(var i in srcObject)
2521  newObject[i] = srcObject[i];
2522 return newObject;
2523};
2524ASPx.InsertRowsBefore = function(table, rowsHtml, index) {
2525 var row = null;
2526 if(index >= 0 && index < table.rows.length)
2527  row = table.rows[index];
2528 var func = ASPx.Browser.IE && ASPx.Browser.Version < 10 ? insertRowsBefore_IE9 : insertRowsBefore;
2529 func(table, rowsHtml, row);
2530};
2531var insertRowsBefore = function(table, rowsHtml, row) {
2532 if(!row && table.tBodies.length > 0) {
2533  row = document.createElement("TR");
2534  table.tBodies[0].appendChild(row);
2535  row.shouldRemove = true;
2536 }
2537 if(row) {
2538  row.insertAdjacentHTML("beforeBegin", rowsHtml);
2539  if(row.shouldRemove)
2540   ASPx.RemoveElement(row);
2541 }
2542};
2543var insertRowsBefore_IE9 = function(table, rowsHtml, nextRow) {
2544 var row = document.createElement("TR");
2545 var cell = document.createElement("TD");
2546 cell.innerHTML = "<table><tbody>" + rowsHtml + "</tbody></table>";
2547 var tbody = table.tBodies[0];
2548 tbody.appendChild(row);
2549 row.appendChild(cell);
2550 var newTable = ASPx.GetNodeByTagName(cell, "TABLE", 0);
2551 var rowCount = newTable.rows.length;
2552 for(var i = rowCount - 1; i >= 0; i--) {
2553  var newRow = newTable.rows[i];
2554  if(nextRow == null)
2555   tbody.appendChild(newRow);
2556  else
2557   tbody.insertBefore(newRow, nextRow);
2558  nextRow = newRow;
2559 }
2560 ASPx.RemoveElement(row);
2561};
2562ASPx.IsPercentageSize = function(size) {
2563 return size && size.indexOf('%') != -1;
2564};
2565ASPx.GetElementById = function(id) {
2566 if(document.getElementById)
2567  return document.getElementById(id);
2568 else
2569  return document.all[id];
2570};
2571ASPx.GetInputElementById = function(id) {
2572 var elem = ASPx.GetElementById(id);
2573 if(!Browser.IE)
2574  return elem;
2575 if(elem) {
2576  if(elem.id == id)
2577   return elem;
2578  else {
2579   for(var i = 1; i < document.all[id].length; i++) {
2580    if(document.all[id][i].id == id)
2581     return document.all[id][i];
2582   }
2583  }
2584 }
2585 return null;
2586};
2587ASPx.GetElementByIdInDocument = function(documentObj, id) {
2588 if(documentObj.getElementById)
2589  return documentObj.getElementById(id);
2590 else
2591  return documentObj.all[id];
2592};
2593ASPx.GetIsParent = function(parentElement, element) {
2594 if(!parentElement || !element)
2595  return false;
2596 while(element){
2597  if(element === parentElement)
2598   return true;
2599  if(element.tagName === "BODY")
2600   return false;
2601  element = element.parentNode;
2602 }
2603 return false;
2604};
2605ASPx.GetParentById = function(element, id) {
2606 element = element.parentNode;
2607 while(element){
2608  if(element.id === id)
2609   return element;
2610  element = element.parentNode;
2611 }
2612 return null;
2613};
2614ASPx.GetParentByPartialId = function(element, idPart){
2615 while(element && element.tagName != "BODY") {
2616  if(element.id && element.id.match(idPart)) 
2617   return element;
2618  element = element.parentNode;
2619 }
2620 return null;
2621};
2622ASPx.GetParentByTagName = function(element, tagName) {
2623 tagName = tagName.toUpperCase();
2624 while(element) {
2625  if(element.tagName === "BODY")
2626   return null;
2627  if(element.tagName === tagName)
2628   return element;
2629  element = element.parentNode;
2630 }
2631 return null;
2632};
2633function getParentByClassNameInternal(element, className, selector) {
2634 while(element != null) {
2635  if(element.tagName == "BODY" || element.nodeName == "#document")
2636   return null;
2637  if(selector(element, className))
2638   return element;
2639  element = element.parentNode;
2640 }
2641 return null;
2642}
2643ASPx.GetParentByPartialClassName = function(element, className) {
2644 return getParentByClassNameInternal(element, className, ASPx.ElementContainsCssClass);
2645};
2646ASPx.GetParentByClassName = function(element, className) {
2647 return getParentByClassNameInternal(element, className, ASPx.ElementHasCssClass);
2648};
2649ASPx.GetParentByTagNameAndAttributeValue = function(element, tagName, attrName, attrValue) {
2650 tagName = tagName.toUpperCase();
2651 while(element != null) {
2652  if(element.tagName == "BODY")
2653   return null;
2654  if(element.tagName == tagName && element[attrName] == attrValue)
2655   return element;
2656  element = element.parentNode;
2657 }
2658 return null;
2659};
2660ASPx.GetParent = function(element, testFunc){
2661 if (!ASPx.IsExists(testFunc)) return null;
2662 while(element != null && element.tagName != "BODY"){
2663  if(testFunc(element))
2664   return element;
2665  element = element.parentNode;
2666 }
2667 return null;
2668};
2669ASPx.GetElementTreeLine = function(element, stopTagName, stopFunc) {
2670 var result = [];
2671 stopTagName = stopTagName || "BODY";
2672 while(element != null) {
2673  if(!stopFunc && element.tagName == stopTagName)
2674   break;
2675  if(stopFunc && stopFunc(element))
2676   break;
2677  result.push(element);
2678  element = element.parentNode;
2679 }
2680 return result;
2681};
2682ASPx.IsScrollableElement = function(element, isHorzScrollable, isVertScrollable) {
2683 isHorzScrollable = ASPx.IsExists(isHorzScrollable) ? isHorzScrollable : true;
2684 isVertScrollable = ASPx.IsExists(isVertScrollable) ? isVertScrollable : true;
2685 var style = ASPx.GetCurrentStyle(element);
2686 var overflowStyleNames = ["overflow"];
2687 if(isHorzScrollable)
2688  overflowStyleNames.push("overflowX");
2689 if(isVertScrollable)
2690  overflowStyleNames.push("overflowY");
2691 for(var i = 0; i < overflowStyleNames.length; i++)
2692  if(style[overflowStyleNames[i]] == "scroll" || style[overflowStyleNames[i]] == "auto")
2693   return true;
2694 return false;
2695};
2696ASPx.GetPreviousSibling = function(el) {
2697 if(el.previousElementSibling) {
2698  return el.previousElementSibling;
2699 } else {
2700  while(el = el.previousSibling) {
2701   if(el.nodeType === 1)
2702    return el;
2703  }
2704 }
2705};
2706ASPx.ElementHasCssClass = function(element, className) {
2707 try {
2708  var elementClasses;
2709  var classList = element.classList;
2710  if(!classList) {
2711   if(!element.className)
2712    return false;
2713   elementClasses = element.className.split(" ");
2714  }
2715  var classNames = className.split(" ");
2716  for(var i = classNames.length - 1; i >= 0; i--) {
2717   if(classList) {
2718    if(!classList.contains(classNames[i]))
2719     return false;
2720    continue;
2721   }
2722   if(Data.ArrayIndexOf(elementClasses, classNames[i]) < 0)
2723    return false;
2724  }
2725  return true;
2726 } catch(e) {
2727  return false;
2728 }
2729};
2730ASPx.ElementContainsCssClass = function(element, className) {
2731 try {
2732  if(!element.className)
2733   return false;
2734  return element.className.indexOf(className) != -1;
2735 } catch(e) {
2736  return false;
2737 }
2738};
2739ASPx.AddClassNameToElement = function (element, className) {
2740 if(!element || typeof(className) !== "string" ) return;
2741 className = className.trim();
2742 if(!ASPx.ElementHasCssClass(element, className) && className !== "")
2743  element.className = (element.className === "") ? className : element.className + " " + className;
2744};
2745ASPx.RemoveClassNameFromElement = function(element, className) {
2746 if(!element) return;
2747 var updClassName = " " + element.className + " ";
2748 var newClassName = updClassName.replace(" " + className + " ", " ");
2749 if(updClassName.length != newClassName.length)
2750  element.className = Str.Trim(newClassName);
2751};
2752ASPx.GetClassNameList = function(element) {
2753 if(element.classList)
2754  return [ ].slice.call(element.classList);
2755 return element.className.replace(/^\s+|\s+$/g, '').split(/\s+/);
2756};
2757function nodeListToArray(nodeList, filter) {
2758 var result = [];
2759 for(var i = 0, element; element = nodeList[i]; i++) {
2760  if(filter && !filter(element))
2761   continue;
2762  result.push(element);
2763 }
2764 return result;
2765}
2766ASPx.NodeListToArray = nodeListToArray;
2767function getItemByIndex(collection, index) {
2768 if(!index) index = 0;
2769 if(collection != null && collection.length > index)
2770  return collection[index];
2771 return null;
2772}
2773ASPx.GetChildNodesByQuerySelector = function (parent, selector) {
2774 return nodeListToArray(parent.querySelectorAll(selector), function (el) { return el.parentNode === parent; });
2775};
2776ASPx.GetChildNodesByClassName = function(parent, className) {
2777 if(!parent) return [];
2778 if(parent.querySelectorAll) {
2779  var children = parent.querySelectorAll('.' + className);
2780  return nodeListToArray(children, function(element) { 
2781   return element.parentNode === parent;
2782  });
2783 }
2784 return ASPx.GetChildNodes(parent, function(elem) { return elem.className && ASPx.ElementHasCssClass(elem, className); });
2785};
2786ASPx.GetChildNodesByPartialClassName = function(element, className) {
2787 return ASPx.GetChildElementNodesByPredicate(element,
2788  function(child) {
2789   return ASPx.ElementContainsCssClass(child, className);
2790  });
2791};
2792ASPx.GetChildByPartialClassName = function(element, className, index) {
2793 if(element != null){    
2794  var collection = ASPx.GetChildNodesByPartialClassName(element, className);
2795  return getItemByIndex(collection, index);
2796 }
2797 return null;
2798};
2799ASPx.GetChildByClassName = function(element, className, index) {
2800 if(element != null){    
2801  var collection = ASPx.GetChildNodesByClassName(element, className);
2802  return getItemByIndex(collection, index);
2803 }
2804 return null;
2805};
2806ASPx.GetNodesByPartialClassName = function(element, className) {
2807 if(element.querySelectorAll) {
2808  var list = element.querySelectorAll('*[class*=' + className + ']');
2809  return nodeListToArray(list);
2810 }
2811 var collection = element.all || element.getElementsByTagName('*');
2812 var ret = [ ];
2813 if(collection != null) {
2814  for(var i = 0; i < collection.length; i ++) {
2815   if(ASPx.ElementContainsCssClass(collection[i], className))
2816    ret.push(collection[i]);
2817  }
2818 }
2819 return ret;
2820};
2821ASPx.GetNodesByClassName = function(parent, className) {
2822 if(parent.querySelectorAll) {
2823  var children = parent.querySelectorAll('.' + className);
2824  return nodeListToArray(children);
2825 }
2826 return ASPx.GetNodes(parent, function(elem) { return elem.className && ASPx.ElementHasCssClass(elem, className); });
2827};
2828ASPx.GetNodeByClassName = function(element, className, index) {
2829 if(element != null){    
2830  var collection = ASPx.GetNodesByClassName(element, className);
2831  return getItemByIndex(collection, index);
2832 }
2833 return null;
2834};
2835ASPx.GetChildById = function(element, id) {
2836 if(element.all) {
2837  var child = element.all[id];
2838  if(!child) {
2839   child = element.all(id); 
2840   if(!child)
2841    return Browser.IE ? document.getElementById(id) : null; 
2842  } 
2843  if(!ASPx.IsExists(child.length)) 
2844   return child;
2845  else
2846   return ASPx.GetElementById(id);
2847 }
2848 else
2849  return ASPx.GetElementById(id);
2850};
2851ASPx.GetNodesByPartialId = function(element, partialName, list) {
2852 if(element.id && element.id.indexOf(partialName) > -1) 
2853  list.push(element);
2854 if(element.childNodes) {
2855  for(var i = 0; i < element.childNodes.length; i ++) 
2856   ASPx.GetNodesByPartialId(element.childNodes[i], partialName, list);
2857 }
2858};
2859ASPx.GetNodesByTagName = function(element, tagName) {
2860 tagName = tagName.toUpperCase();
2861 if(element) {
2862  if(element.getElementsByTagName) 
2863   return element.getElementsByTagName(tagName);
2864  else if(element.all && element.all.tags !== undefined)
2865   return Browser.Netscape ? element.all.tags[tagName] : element.all.tags(tagName);
2866 }
2867 return null;
2868};
2869ASPx.GetNodeByTagName = function(element, tagName, index) {
2870 if(element != null){    
2871  var collection = ASPx.GetNodesByTagName(element, tagName);
2872  return getItemByIndex(collection, index);
2873 }
2874 return null;
2875};
2876ASPx.GetChildNodesByTagName = function(parent, tagName) {
2877 return ASPx.GetChildNodes(parent, function (child) { return child.tagName === tagName; });
2878};
2879ASPx.GetChildByTagName = function(element, tagName, index) {
2880 if(element != null){    
2881  var collection = ASPx.GetChildNodesByTagName(element, tagName);
2882  return getItemByIndex(collection, index);
2883 }
2884 return null;
2885};
2886ASPx.RetrieveByPredicate = function(scourceCollection, predicate) {
2887 var result = [];
2888 for(var i = 0; i < scourceCollection.length; i++) {
2889  var element = scourceCollection[i];
2890  if(!predicate || predicate(element)) 
2891   result.push(element);
2892 }
2893 return result;
2894};
2895ASPx.GetChildNodes = function(parent, predicate) {
2896 return ASPx.RetrieveByPredicate(parent.childNodes, predicate);
2897};
2898ASPx.GetNodes = function(parent, predicate) {
2899 var c = parent.all || parent.getElementsByTagName('*');
2900 return ASPx.RetrieveByPredicate(c, predicate);
2901};
2902ASPx.GetChildElementNodes = function(parent) {
2903 if(!parent) return null;
2904 return ASPx.GetChildNodes(parent, function(e) { return e.nodeType == 1; });
2905};
2906ASPx.GetChildElementNodesByPredicate = function(parent, predicate) {
2907 if(!parent) return null;
2908 if(!predicate) return ASPx.GetChildElementNodes(parent);
2909 return ASPx.GetChildNodes(parent, function(e) { return e.nodeType == 1 && predicate(e); });
2910};
2911ASPx.GetTextNode = function(element, index) {
2912 if(element != null){
2913  var collection = [ ];
2914  ASPx.GetTextNodes(element, collection);
2915  return getItemByIndex(collection, index);
2916 }
2917 return null;
2918};
2919ASPx.GetTextNodes = function(element, collection) {
2920 for(var i = 0; i < element.childNodes.length; i ++){
2921  var childNode = element.childNodes[i];
2922  if(ASPx.IsExists(childNode.nodeValue))
2923   collection.push(childNode);
2924  ASPx.GetTextNodes(childNode, collection);
2925 }
2926};
2927ASPx.GetNormalizedTextNode = function(element, index) {
2928 var textNode = ASPx.GetTextNode(element, index);
2929 if(textNode != null)
2930  ASPx.MergeAdjacentTextNodes(textNode);
2931 return textNode;
2932};
2933ASPx.MergeAdjacentTextNodes = function(firstTextNode) {
2934 if(!ASPx.IsExists(firstTextNode.nodeValue))
2935  return;
2936 var textNode = firstTextNode;
2937 while(textNode.nextSibling && ASPx.IsExists(textNode.nextSibling.nodeValue)) {
2938  textNode.nodeValue += textNode.nextSibling.nodeValue;
2939  textNode.parentNode.removeChild(textNode.nextSibling);
2940 }
2941};
2942ASPx.GetElementDocument = function(element) {
2943 return element.document || element.ownerDocument;
2944};
2945ASPx.RemoveElement = function(element) {
2946 if(element && element.parentNode)
2947  element.parentNode.removeChild(element);
2948};
2949ASPx.ReplaceTagName = function(element, newTagName, cloneChilds) {
2950 if(element.nodeType != 1)
2951  return null;
2952 if(element.nodeName == newTagName)
2953  return element;
2954 cloneChilds = cloneChilds !== undefined ? cloneChilds : true;
2955 var doc = element.ownerDocument;
2956 var newElem = doc.createElement(newTagName);
2957 Attr.CopyAllAttributes(element, newElem);
2958 if(cloneChilds) {
2959  for(var i = 0; i < element.childNodes.length; i++)
2960   newElem.appendChild(element.childNodes[i].cloneNode(true));
2961 }
2962 else {
2963  for(var child; child = element.firstChild; )
2964   newElem.appendChild(child);
2965 }
2966 element.parentNode.replaceChild(newElem, element);
2967 return newElem;
2968};
2969ASPx.RemoveOuterTags = function(element) {
2970 if(ASPx.Browser.IE) {
2971  element.insertAdjacentHTML( 'beforeBegin', element.innerHTML ) ;
2972  ASPx.RemoveElement(element);
2973 } else {
2974  var docFragment = element.ownerDocument.createDocumentFragment();
2975  for(var i = 0; i < element.childNodes.length; i++)
2976   docFragment.appendChild(element.childNodes[i].cloneNode(true));
2977  element.parentNode.replaceChild(docFragment, element);
2978 }
2979};
2980ASPx.WrapElementInNewElement = function(element, newElementTagName) { 
2981 var wrapElement = null;
2982 if(Browser.IE) {
2983  var wrapElement = element.ownerDocument.createElement(newElementTagName);
2984  wrapElement.appendChild(element.cloneNode(true));
2985  element.parentNode.insertBefore(wrapElement, element);
2986  element.parentNode.removeChild(element);
2987 } else {
2988  var docFragment = element.ownerDocument.createDocumentFragment();
2989  wrapElement = element.ownerDocument.createElement(newElementTagName);
2990  docFragment.appendChild(wrapElement);
2991  wrapElement.appendChild(element.cloneNode(true));
2992  element.parentNode.replaceChild(docFragment, element);
2993 }
2994 return wrapElement;
2995};
2996ASPx.InsertElementAfter = function(newElement, targetElement) {
2997 var parentElem = targetElement.parentNode;
2998 if(parentElem.childNodes[parentElem.childNodes.length - 1] == targetElement)
2999  parentElem.appendChild(newElement);
3000 else
3001  parentElem.insertBefore(newElement, targetElement.nextSibling);
3002};
3003ASPx.SetElementOpacity = function(element, value) {
3004  var useOpacityStyle = !Browser.IE || Browser.Version > 8;
3005  if(useOpacityStyle){
3006   element.style.opacity = value;
3007  } else {
3008   if(typeof(element.filters) === "object" && element.filters["DXImageTransform.Microsoft.Alpha"])
3009    element.filters.item("DXImageTransform.Microsoft.Alpha").Opacity = value*100;
3010   else
3011   element.style.filter = "alpha(opacity=" + (value * 100) + ")";
3012  }
3013};
3014ASPx.GetElementOpacity = function(element) {
3015 var useOpacityStyle = !Browser.IE || Browser.Version > 8;
3016 if(useOpacityStyle)
3017  return parseFloat(ASPx.GetCurrentStyle(element).opacity);
3018 else {
3019  if(typeof(element.filters) === "object" && element.filters["DXImageTransform.Microsoft.Alpha"]){
3020   return element.filters.item("DXImageTransform.Microsoft.Alpha").Opacity / 100;
3021  } else {
3022   var alphaValue = ASPx.GetCurrentStyle(element).filter;
3023   var value = alphaValue.replace("alpha(opacity=", "");
3024   value = value.replace(")", "");
3025   return parseInt(value) / 100;
3026  }
3027  return 100;
3028 }
3029};
3030ASPx.GetElementDisplay = function(element, isCurrentStyle) {
3031 if (isCurrentStyle)
3032  return ASPx.GetCurrentStyle(element).display != "none";
3033 return element.style.display != "none";
3034};
3035ASPx.SetElementDisplay = function(element, value, checkCurrentStyle, makeInline) {
3036 if(!element) return;
3037 if(typeof(value) === "string")
3038  element.style.display = value;
3039 else if(!value)
3040  element.style.display = "none";
3041 else {
3042  element.style.display = "";
3043  if(checkCurrentStyle && ASPx.GetCurrentStyle(element).display === "none"){
3044   var displayAddon = makeInline ? "inline-" : "";
3045   switch(element.tagName){
3046    case "TABLE": {
3047     element.style.display = displayAddon + "table";
3048     break;
3049    }
3050    default: {
3051     element.style.display = displayAddon + "block";
3052     break;
3053    }
3054   }
3055  }
3056 }
3057};
3058ASPx.GetElementVisibility = function(element, isCurrentStyle) {
3059 if(isCurrentStyle)
3060  return ASPx.GetCurrentStyle(element).visibility != "hidden";
3061 return element.style.visibility != "hidden";
3062};
3063ASPx.SetElementVisibility = function(element, value) {
3064 if(!element) return;
3065 if(typeof(value) === "string")
3066  element.style.visibility = value;
3067 else
3068  element.style.visibility = value ? "visible" : "hidden";
3069};
3070ASPx.IsElementVisible = function(element, isCurrentStyle) {
3071 while(element && element.tagName != "BODY") {
3072  if(!ASPx.GetElementDisplay(element, isCurrentStyle) || (!ASPx.GetElementVisibility(element, isCurrentStyle) && !Attr.IsExistsAttribute(element, "errorFrame")))
3073     return false;
3074  element = element.parentNode;
3075 }
3076 return true;
3077};
3078ASPx.IsElementDisplayed = function(element) {
3079 while(element && element.tagName != "BODY") {
3080  if(!ASPx.GetElementDisplay(element))
3081     return false;
3082  element = element.parentNode;
3083 }
3084 return true;
3085};
3086ASPx.GetElementInitializedFlag = function(element) {
3087 return element["dxinit"];
3088};
3089ASPx.SetElementInitializedFlag = function(element) {
3090 element["dxinit"] = true;
3091};
3092ASPx.AddStyleSheetLinkToDocument = function(doc, linkUrl) {
3093 var newLink = createStyleLink(doc, linkUrl);
3094 var head = ASPx.GetHeadElementOrCreateIfNotExist(doc);
3095 head.appendChild(newLink);
3096};
3097ASPx.GetHeadElementOrCreateIfNotExist = function(doc) {
3098 var elements = ASPx.GetNodesByTagName(doc, "head");
3099 var head = null;
3100 if(elements.length == 0) {
3101  head = doc.createElement("head");
3102  head.visibility = "hidden";
3103  doc.insertBefore(head, doc.body);
3104 } else
3105  head = elements[0];
3106 return head;
3107};
3108function createStyleLink(doc, url) {
3109 var newLink = doc.createElement("link");
3110 Attr.SetAttribute(newLink, "href", url);
3111 Attr.SetAttribute(newLink, "type", "text/css");
3112 Attr.SetAttribute(newLink, "rel", "stylesheet");
3113 return newLink;
3114}
3115ASPx.GetCurrentStyle = function(element) {
3116 if(element.currentStyle)
3117  return element.currentStyle;
3118 else if(document.defaultView && document.defaultView.getComputedStyle) { 
3119  var result = document.defaultView.getComputedStyle(element, null);
3120  if(!result && Browser.Firefox && window.frameElement) {
3121   var changes = [];
3122   var curElement = window.frameElement;
3123   while(!(result = document.defaultView.getComputedStyle(element, null))) {
3124    changes.push([curElement, curElement.style.display]);
3125    ASPx.SetStylesCore(curElement, "display", "block", true);
3126    curElement = curElement.tagName == "BODY" ? curElement.ownerDocument.defaultView.frameElement : curElement.parentNode;
3127   }
3128   result = ASPx.CloneObject(result);
3129   for(var ch, i = 0; ch = changes[i]; i++)
3130    ASPx.SetStylesCore(ch[0], "display", ch[1]);
3131   var dummy = document.body.offsetWidth; 
3132  }
3133  return result;
3134 }
3135 return window.getComputedStyle(element, null);
3136};
3137ASPx.CreateStyleSheetInDocument = function(doc) {
3138 if(doc.createStyleSheet) {
3139  try {
3140   return doc.createStyleSheet();
3141  }
3142  catch(e) {
3143   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.";
3144   throw new Error(message);
3145  }
3146 }
3147 else {
3148  var styleSheet = doc.createElement("STYLE");
3149  ASPx.GetNodeByTagName(doc, "HEAD", 0).appendChild(styleSheet);
3150  return styleSheet.sheet;
3151 }
3152};
3153ASPx.currentStyleSheet = null;
3154ASPx.GetCurrentStyleSheet = function() {
3155 if(!ASPx.currentStyleSheet)
3156  ASPx.currentStyleSheet = ASPx.CreateStyleSheetInDocument(document);
3157 return ASPx.currentStyleSheet;
3158};
3159function getStyleSheetRules(styleSheet){
3160 try {
3161  return Browser.IE && Browser.Version == 8 ? styleSheet.rules : styleSheet.cssRules;
3162 }
3163 catch(e) {
3164  return null;
3165 }
3166}
3167ASPx.cachedCssRules = { };
3168ASPx.GetStyleSheetRules = function (className, stylesStorageDocument) {
3169 if(ASPx.cachedCssRules[className]) {
3170  if(ASPx.cachedCssRules[className] != ASPx.EmptyObject)
3171   return ASPx.cachedCssRules[className];
3172  return null;
3173 }
3174 var result = iterateStyleSheetRules(stylesStorageDocument, function(rule) {
3175  if(rule.selectorText == "." + className){
3176   ASPx.cachedCssRules[className] = rule;
3177   return rule;
3178  }
3179 });
3180 if(ASPx.IsExists(result))
3181  return result;
3182 ASPx.cachedCssRules[className] = ASPx.EmptyObject;
3183 return null;
3184};
3185function iterateStyleSheetRules(stylesStorageDocument, callback) {
3186 var doc = stylesStorageDocument || document;
3187 for(var i = 0; i < doc.styleSheets.length; i ++){
3188  var styleSheet = doc.styleSheets[i];
3189  var rules = getStyleSheetRules(styleSheet);
3190  if(rules != null){
3191   for(var j = 0; j < rules.length; j ++) {
3192    var result = callback(rules[j]);
3193    if(result !== undefined)
3194     return result;
3195   }
3196  }
3197 }
3198}
3199ASPx.ClearCachedCssRules = function(){
3200 ASPx.cachedCssRules = { };
3201};
3202var styleCount = 0;
3203var styleNameCache = { };
3204ASPx.CreateImportantStyleRule = function(styleSheet, cssText, postfix, prefix) {
3205 styleSheet = styleSheet || ASPx.GetCurrentStyleSheet();
3206 var cacheKey = (postfix ? postfix + "||" : "") + cssText + (prefix ? "||" + prefix : "");
3207 if(styleNameCache[cacheKey])
3208  return styleNameCache[cacheKey];
3209 prefix = prefix ? prefix + " " : "";
3210 var className = "dxh" + styleCount + (postfix ? postfix : "");
3211 ASPx.AddStyleSheetRule(styleSheet, prefix + "." + className, ASPx.CreateImportantCssText(cssText));
3212 styleCount++;
3213 styleNameCache[cacheKey] = className;
3214 return className; 
3215};
3216ASPx.CreateImportantCssText = function(cssText) {
3217 var newText = "";
3218 var attributes = cssText.split(";");
3219 for(var i = 0; i < attributes.length; i++){
3220  if(attributes[i] != "")
3221   newText += attributes[i] + " !important;";
3222 }
3223 return newText;
3224};
3225ASPx.AddStyleSheetRule = function(styleSheet, selector, cssText){
3226 if(!cssText) return;
3227 if(Browser.IE)
3228  styleSheet.addRule(selector, cssText);
3229 else
3230  styleSheet.insertRule(selector + " { " + cssText + " }", styleSheet.cssRules.length);
3231};
3232ASPx.GetPointerCursor = function() {
3233 return "pointer";
3234};
3235ASPx.SetPointerCursor = function(element) {
3236 if(element.style.cursor == "")
3237  element.style.cursor = ASPx.GetPointerCursor();
3238};
3239ASPx.SetElementFloat = function(element, value) {
3240 if(ASPx.IsExists(element.style.cssFloat))
3241  element.style.cssFloat = value;
3242 else if(ASPx.IsExists(element.style.styleFloat))
3243  element.style.styleFloat = value;
3244 else
3245  Attr.SetAttribute(element.style, "float", value);
3246};
3247ASPx.GetElementFloat = function(element) {
3248 var currentStyle = ASPx.GetCurrentStyle(element);
3249 if(ASPx.IsExists(currentStyle.cssFloat))
3250  return currentStyle.cssFloat;
3251 if(ASPx.IsExists(currentStyle.styleFloat))
3252  return currentStyle.styleFloat;
3253 return Attr.GetAttribute(currentStyle, "float");
3254};
3255function getElementDirection(element) {
3256 return ASPx.GetCurrentStyle(element).direction;
3257}
3258ASPx.IsElementRightToLeft = function(element) {
3259 return getElementDirection(element) == "rtl";
3260};
3261ASPx.AdjustVerticalMarginsInContainer = function(container) {
3262 var containerBorderAndPaddings = ASPx.GetTopBottomBordersAndPaddingsSummaryValue(container);
3263 var flowElements = [], floatElements = [], floatTextElements = [];
3264 var maxHeight = 0, maxFlowHeight = 0;
3265 for(var i = 0; i < container.childNodes.length; i++) {
3266  var element = container.childNodes[i];
3267  if(!element.offsetHeight) continue;
3268  ASPx.ClearVerticalMargins(element);
3269 }
3270 for(var i = 0; i < container.childNodes.length; i++) {
3271  var element = container.childNodes[i];
3272  if(!element.offsetHeight) continue;
3273  var float = ASPx.GetElementFloat(element);
3274  var isFloat = (float === "left" || float === "right");
3275  if(isFloat)
3276   floatElements.push(element);
3277  else {
3278   flowElements.push(element);
3279   if(element.tagName !== "IMG"){
3280    if(!ASPx.IsTextWrapped(element))
3281     element.style.verticalAlign = 'baseline'; 
3282    floatTextElements.push(element);
3283   }
3284   if(element.tagName === "DIV")
3285    Attr.ChangeStyleAttribute(element, "float", "left"); 
3286  }
3287  if(element.offsetHeight > maxHeight) 
3288   maxHeight = element.offsetHeight;
3289  if(!isFloat && element.offsetHeight > maxFlowHeight) 
3290   maxFlowHeight = element.offsetHeight;
3291 }
3292 for(var i = 0; i < flowElements.length; i++) 
3293  Attr.RestoreStyleAttribute(flowElements[i], "float");
3294 var containerBorderAndPaddings = ASPx.GetTopBottomBordersAndPaddingsSummaryValue(container);
3295 var containerHeight = container.offsetHeight - containerBorderAndPaddings;
3296 if(maxHeight == containerHeight) {
3297  var verticalAlign = ASPx.GetCurrentStyle(container).verticalAlign;
3298  for(var i = 0; i < floatTextElements.length; i++)
3299   floatTextElements[i].style.verticalAlign = '';
3300  containerHeight = container.offsetHeight - containerBorderAndPaddings;
3301  for(var i = 0; i < floatElements.length; i++)
3302   adjustVerticalMarginsCore(floatElements[i], containerHeight, verticalAlign, true);
3303  for(var i = 0; i < flowElements.length; i++) {
3304   if(maxFlowHeight != maxHeight)
3305    adjustVerticalMarginsCore(flowElements[i], containerHeight, verticalAlign);
3306  }
3307 }
3308};
3309ASPx.AdjustVerticalMargins = function(element) {
3310 ASPx.ClearVerticalMargins(element);
3311 var parentElement = element.parentNode;
3312 var parentHeight = parentElement.getBoundingClientRect().height - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(parentElement);
3313 adjustVerticalMarginsCore(element, parentHeight, ASPx.GetCurrentStyle(parentElement).verticalAlign);
3314};
3315function adjustVerticalMarginsCore(element, parentHeight, verticalAlign, toBottom) {
3316 var marginTop;
3317 if(verticalAlign == "top")
3318  marginTop = 0;
3319 else if(verticalAlign == "bottom")
3320  marginTop = parentHeight - element.getBoundingClientRect().height;
3321 else
3322  marginTop = (parentHeight - element.getBoundingClientRect().height) / 2;
3323 if(marginTop !== 0){
3324  element.style.marginTop = marginTop + "px";
3325 }
3326}
3327ASPx.ClearVerticalMargins = function(element) {
3328 element.style.marginTop = "";
3329 element.style.marginBottom = "";
3330};
3331ASPx.AdjustHeightInContainer = function(container) {
3332 var height = container.offsetHeight - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(container);
3333 for(var i = 0; i < container.childNodes.length; i++) {
3334  var element = container.childNodes[i];
3335  if(!element.offsetHeight) continue;
3336  ASPx.ClearHeight(element);
3337 }
3338 var elements = [];
3339 var childrenHeight = 0;
3340 for(var i = 0; i < container.childNodes.length; i++) {
3341  var element = container.childNodes[i];
3342  if(!element.offsetHeight) continue;
3343  childrenHeight += element.offsetHeight + ASPx.GetTopBottomMargins(element);
3344  elements.push(element);
3345 }
3346 if(elements.length > 0 && childrenHeight < height) {
3347  var correctedHeight = 0;
3348  for(var i = 0; i < elements.length; i++) {
3349   var elementHeight = 0;
3350   if(i < elements.length - 1){
3351    var elementHeight = Math.floor(height / elements.length);
3352    correctedHeight += elementHeight;
3353   }
3354   else{
3355    var elementHeight = height - correctedHeight;
3356    if(elementHeight < 0) elementHeight = 0;
3357   }
3358   adjustHeightCore(elements[i], elementHeight);
3359  }
3360 }
3361};
3362ASPx.AdjustHeight = function(element) {
3363 ASPx.ClearHeight(element);
3364 var parentElement = element.parentNode;
3365 var height = parentElement.getBoundingClientRect().height - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(parentElement);
3366 adjustHeightCore(element, height);
3367};
3368function adjustHeightCore(element, height) {
3369 var height = height - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(element);
3370 if(height < 0) height = 0;
3371 element.style.height = height + "px";
3372}
3373ASPx.ClearHeight = function(element) {
3374 element.style.height = "";
3375};
3376ASPx.ShrinkWrappedTextInContainer = function(container) {
3377 if(!container) return;
3378 for(var i = 0; i < container.childNodes.length; i++){
3379  var child = container.childNodes[i];
3380  if(child.style && ASPx.IsTextWrapped(child)) {
3381   Attr.ChangeStyleAttribute(child, "width", "1px");
3382   child.shrinkedTextContainer = true;
3383  }
3384 }
3385};
3386ASPx.AdjustWrappedTextInContainer = function(container) {
3387 if(!container) return;
3388 var textContainer, leftWidth = 0, rightWidth = 0;
3389 for(var i = 0; i < container.childNodes.length; i++){
3390  var child = container.childNodes[i];
3391  if(child.tagName === "BR")
3392   return;
3393  if(!child.tagName)
3394   continue;
3395  if(child.tagName !== "IMG"){
3396   textContainer = child;
3397   if(ASPx.IsTextWrapped(textContainer)){
3398    if(!textContainer.shrinkedTextContainer)
3399     textContainer.style.width = "";
3400    textContainer.style.marginRight = "";
3401   }
3402  }
3403  else {
3404   if(child.offsetWidth === 0)
3405    Evt.AttachEventToElement(child, "load", function(evt) { ASPx.AdjustWrappedTextInContainer(container); });
3406   else {
3407    var width = child.offsetWidth + ASPx.GetLeftRightMargins(child);
3408    if(textContainer)
3409     rightWidth += width;
3410    else
3411     leftWidth += width;
3412   }
3413  }
3414 }
3415 if(textContainer && ASPx.IsTextWrapped(textContainer)) {
3416  var containerWidth = container.offsetWidth - ASPx.GetLeftRightBordersAndPaddingsSummaryValue(container);
3417  if(textContainer.shrinkedTextContainer) {
3418   Attr.RestoreStyleAttribute(textContainer, "width");
3419   Attr.ChangeStyleAttribute(container, "width", containerWidth + "px");
3420  }
3421  if(textContainer.offsetWidth + leftWidth + rightWidth >= containerWidth) {
3422    if(rightWidth > 0 && !textContainer.shrinkedTextContainer)
3423    textContainer.style.width = (containerWidth - rightWidth) + "px";
3424   else if(leftWidth > 0){
3425    if(ASPx.IsElementRightToLeft(container))
3426     textContainer.style.marginLeft = leftWidth + "px";
3427    else
3428     textContainer.style.marginRight = leftWidth + "px";
3429   }
3430  }
3431 }
3432};
3433ASPx.IsTextWrapped = function(element) {
3434 return element && ASPx.GetCurrentStyle(element).whiteSpace !== "nowrap";
3435};
3436ASPx.IsValidPosition = function(pos){
3437 return pos != ASPx.InvalidPosition && pos != -ASPx.InvalidPosition;
3438};
3439ASPx.getSpriteMainElement = function(element) {
3440 var cssClassMarker = "dx-acc";
3441 if(ASPx.ElementContainsCssClass(element, cssClassMarker))
3442  return element;
3443 if(element.parentNode && ASPx.ElementContainsCssClass(element.parentNode, cssClassMarker))
3444  return element.parentNode;
3445 return element;
3446};
3447ASPx.GetAbsoluteX = function(curEl){
3448 return ASPx.GetAbsolutePositionX(curEl);
3449};
3450ASPx.GetAbsoluteY = function(curEl){
3451 return ASPx.GetAbsolutePositionY(curEl);
3452};
3453ASPx.SetAbsoluteX = function(element, x){
3454 element.style.left = ASPx.PrepareClientPosForElement(x, element, true) + "px";
3455};
3456ASPx.SetAbsoluteY = function(element, y){
3457 element.style.top = ASPx.PrepareClientPosForElement(y, element, false) + "px";
3458};
3459ASPx.GetAbsolutePositionX = function(element){
3460 if(Browser.IE)
3461  return getAbsolutePositionX_IE(element);
3462 else if(Browser.Firefox && Browser.Version >= 3)
3463  return getAbsolutePositionX_FF3(element);
3464 else if(Browser.Opera)
3465  return getAbsolutePositionX_Opera(element);
3466 else if(Browser.NetscapeFamily && (!Browser.Firefox || Browser.Version < 3))
3467  return getAbsolutePositionX_NS(element);
3468 else if(Browser.WebKitFamily || Browser.Edge)
3469  return getAbsolutePositionX_FF3(element);
3470 else
3471  return getAbsolutePositionX_Other(element);
3472};
3473function getAbsolutePositionX_Opera(curEl){
3474 var isFirstCycle = true;
3475 var pos = getAbsoluteScrollOffset_OperaFF(curEl, true);
3476 while(curEl != null) {
3477  pos += curEl.offsetLeft;
3478  if(!isFirstCycle)
3479   pos -= curEl.scrollLeft;
3480  curEl = curEl.offsetParent;
3481  isFirstCycle = false;
3482 }
3483 pos += document.body.scrollLeft;
3484 return pos;
3485}
3486function getAbsolutePositionX_IE(element){
3487 if(element == null || Browser.IE && element.parentNode == null) return 0; 
3488 return element.getBoundingClientRect().left + ASPx.GetDocumentScrollLeft();
3489}
3490function getAbsolutePositionX_FF3(element){
3491 if(element == null) return 0;
3492 var x = element.getBoundingClientRect().left + ASPx.GetDocumentScrollLeft();
3493 return Math.round(x);
3494}
3495function getAbsolutePositionX_NS(curEl){
3496 var pos = getAbsoluteScrollOffset_OperaFF(curEl, true);
3497 var isFirstCycle = true;
3498 while(curEl != null) {
3499  pos += curEl.offsetLeft;
3500  if(!isFirstCycle && curEl.offsetParent != null)
3501   pos -= curEl.scrollLeft;
3502  if(!isFirstCycle && Browser.Firefox){
3503   var style = ASPx.GetCurrentStyle(curEl);
3504   if(curEl.tagName == "DIV" && style.overflow != "visible")
3505    pos += ASPx.PxToInt(style.borderLeftWidth);
3506  }
3507  isFirstCycle = false;
3508  curEl = curEl.offsetParent;
3509 }
3510 return pos;
3511}
3512function getAbsolutePositionX_Other(curEl){
3513 var pos = 0;
3514 var isFirstCycle = true;
3515 while(curEl != null) {
3516  pos += curEl.offsetLeft;
3517  if(!isFirstCycle && curEl.offsetParent != null)
3518   pos -= curEl.scrollLeft;
3519  isFirstCycle = false;
3520  curEl = curEl.offsetParent;
3521 }
3522 return pos;
3523}
3524ASPx.GetAbsolutePositionY = function(element){
3525 if(Browser.IE)
3526  return getAbsolutePositionY_IE(element);
3527 else if(Browser.Firefox && Browser.Version >= 3)
3528  return getAbsolutePositionY_FF3(element);
3529 else if(Browser.Opera)
3530  return getAbsolutePositionY_Opera(element);
3531 else if(Browser.NetscapeFamily && (!Browser.Firefox || Browser.Version < 3))
3532  return getAbsolutePositionY_NS(element);
3533 else if(Browser.WebKitFamily || Browser.Edge)
3534  return getAbsolutePositionY_FF3(element);
3535 else
3536  return getAbsolutePositionY_Other(element);
3537};
3538function getAbsolutePositionY_Opera(curEl){
3539 var isFirstCycle = true;
3540 if(curEl && curEl.tagName == "TR" && curEl.cells.length > 0)
3541  curEl = curEl.cells[0];
3542 var pos = getAbsoluteScrollOffset_OperaFF(curEl, false);
3543 while(curEl != null) {
3544  pos += curEl.offsetTop;
3545  if(!isFirstCycle)
3546   pos -= curEl.scrollTop;
3547  curEl = curEl.offsetParent;
3548  isFirstCycle = false;
3549 }
3550 pos += document.body.scrollTop;
3551 return pos;
3552}
3553function getAbsolutePositionY_IE(element){
3554 if(element == null || Browser.IE && element.parentNode == null) return 0; 
3555 return element.getBoundingClientRect().top + ASPx.GetDocumentScrollTop();
3556}
3557function getAbsolutePositionY_FF3(element){
3558 if(element == null) return 0;
3559 var y = element.getBoundingClientRect().top + ASPx.GetDocumentScrollTop();
3560 return Math.round(y);
3561}
3562function getAbsolutePositionY_NS(curEl){
3563 var pos = getAbsoluteScrollOffset_OperaFF(curEl, false);
3564 var isFirstCycle = true;
3565 while(curEl != null) {
3566  pos += curEl.offsetTop;
3567  if(!isFirstCycle && curEl.offsetParent != null)
3568   pos -= curEl.scrollTop;
3569  if(!isFirstCycle && Browser.Firefox){
3570   var style = ASPx.GetCurrentStyle(curEl);
3571   if(curEl.tagName == "DIV" && style.overflow != "visible")
3572    pos += ASPx.PxToInt(style.borderTopWidth);
3573  }
3574  isFirstCycle = false;
3575  curEl = curEl.offsetParent;
3576 }
3577 return pos;
3578}
3579function getAbsoluteScrollOffset_OperaFF(curEl, isX) {
3580 var pos = 0;   
3581 var isFirstCycle = true;
3582 while(curEl != null) {
3583  if(curEl.tagName == "BODY")
3584   break;
3585  var style = ASPx.GetCurrentStyle(curEl);
3586  if(style.position == "absolute")
3587   break;
3588  if(!isFirstCycle && curEl.tagName == "DIV" && (style.position == "" || style.position == "static"))
3589   pos -= isX ? curEl.scrollLeft : curEl.scrollTop;
3590  curEl = curEl.parentNode;
3591  isFirstCycle = false;
3592 }
3593 return pos; 
3594}
3595function getAbsolutePositionY_Other(curEl){
3596 var pos = 0;
3597 var isFirstCycle = true;
3598 while(curEl != null) {
3599  pos += curEl.offsetTop;
3600  if(!isFirstCycle && curEl.offsetParent != null)
3601   pos -= curEl.scrollTop;
3602  isFirstCycle = false;
3603  curEl = curEl.offsetParent;
3604 }
3605 return pos;
3606}
3607function createElementMock(element) {
3608 var div = document.createElement('DIV');
3609 div.style.top = "0px";
3610 div.style.left = "0px";
3611 div.visibility = "hidden";
3612 div.style.position = ASPx.GetCurrentStyle(element).position;
3613 return div;
3614}
3615ASPx.PrepareClientPosElementForOtherParent = function(pos, element, otherParent, isX) {
3616 if(element.parentNode == otherParent)
3617  return ASPx.PrepareClientPosForElement(pos, element, isX);
3618 var elementMock = createElementMock(element);
3619 otherParent.appendChild(elementMock); 
3620 var preparedPos = ASPx.PrepareClientPosForElement(pos, elementMock, isX);
3621 otherParent.removeChild(elementMock);
3622 return preparedPos;
3623};
3624ASPx.PrepareClientPosForElement = function(pos, element, isX) {
3625 pos -= ASPx.GetPositionElementOffset(element, isX);
3626 return pos;
3627};
3628function getExperimentalPositionOffset(element, isX) {
3629 var div = createElementMock(element);
3630 if(div.style.position == "static")
3631  div.style.position = "absolute";
3632 element.parentNode.appendChild(div); 
3633 var realPos = isX ? ASPx.GetAbsoluteX(div) : ASPx.GetAbsoluteY(div);
3634 element.parentNode.removeChild(div);
3635 return Math.round(realPos);
3636}
3637ASPx.GetPositionElementOffset = function(element, isX) {
3638 return getExperimentalPositionOffset(element, isX);
3639};
3640ASPx.GetSizeOfText = function(text, textCss) {
3641 var testContainer = document.createElement("tester");
3642 var defaultLineHeight = ASPx.Browser.Firefox ? "1" : "";
3643 testContainer.style.fontSize = textCss.fontSize;
3644 testContainer.style.fontFamily = textCss.fontFamily;
3645 testContainer.style.fontWeight = textCss.fontWeight;
3646 testContainer.style.letterSpacing = textCss.letterSpacing;
3647 testContainer.style.lineHeight = textCss.lineHeight || defaultLineHeight;
3648 testContainer.style.position = "absolute";
3649 testContainer.style.top = ASPx.InvalidPosition + "px";
3650 testContainer.style.left = ASPx.InvalidPosition + "px";
3651 testContainer.style.width = "auto";
3652 testContainer.style.whiteSpace = "nowrap";
3653 testContainer.appendChild(document.createTextNode(text));
3654 var testElement = document.body.appendChild(testContainer);
3655 var size = {
3656  "width": testElement.offsetWidth,
3657  "height": testElement.offsetHeight
3658 };
3659 document.body.removeChild(testElement);
3660 return size;
3661};
3662ASPx.PointToPixel = function(points, addPx) {  
3663 var result = 0;
3664 try {
3665  var indexOfPt = points.toLowerCase().indexOf("pt");
3666  if(indexOfPt > -1)
3667   result = parseInt(points.substr(0, indexOfPt)) * 96 / 72;
3668  else
3669   result = parseInt(points) * 96 / 72;
3670  if(addPx)
3671   result = result + "px";
3672 } catch(e) {}
3673 return result;
3674};
3675ASPx.PixelToPoint = function(pixels, addPt) { 
3676 var result = 0;
3677 try {
3678  var indexOfPx = pixels.toLowerCase().indexOf("px");
3679  if(indexOfPx > -1)
3680   result = parseInt(pixels.substr(0, indexOfPx)) * 72 / 96;
3681  else
3682   result = parseInt(pixels) * 72 / 96;
3683  if(addPt)
3684   result = result + "pt";
3685 } catch(e) {}
3686 return result;         
3687};
3688ASPx.PxToInt = function(px) {
3689 return pxToNumber(px, parseInt);
3690};
3691ASPx.PxToFloat = function(px) {
3692 return pxToNumber(px, parseFloat);
3693};
3694function pxToNumber(px, parseFunction) {
3695 var result = 0;
3696 if(px != null && px != "") {
3697  try {
3698   var indexOfPx = px.indexOf("px");
3699   if(indexOfPx > -1)
3700    result = parseFunction(px.substr(0, indexOfPx));
3701  } catch(e) { }
3702 }
3703 return result;
3704}
3705ASPx.PercentageToFloat = function(perc) {
3706 var result = 0;
3707 if(perc != null && perc != "") {
3708  try {
3709   var indexOfPerc = perc.indexOf("%");
3710   if(indexOfPerc > -1)
3711    result = parseFloat(perc.substr(0, indexOfPerc)) / 100;
3712  } catch(e) { }
3713 }
3714 return result;
3715};
3716ASPx.CreateGuid = function() {
3717 return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { 
3718   var r = Math.random()*16|0,v=c=='x'?r:r&0x3|0x8;
3719  return v.toString(16);
3720 });
3721};
3722ASPx.GetLeftRightBordersAndPaddingsSummaryValue = function(element, currentStyle) {
3723 return ASPx.GetLeftRightPaddings(element, currentStyle) + ASPx.GetHorizontalBordersWidth(element, currentStyle);
3724};
3725ASPx.GetTopBottomBordersAndPaddingsSummaryValue = function(element, currentStyle) {
3726 return ASPx.GetTopBottomPaddings(element, currentStyle) + ASPx.GetVerticalBordersWidth(element, currentStyle);
3727};
3728ASPx.GetVerticalBordersWidth = function(element, style) {
3729 if(!ASPx.IsExists(style))
3730  style = (Browser.IE && Browser.MajorVersion != 9 && window.getComputedStyle) ? window.getComputedStyle(element) : ASPx.GetCurrentStyle(element);
3731 var res = 0;
3732 if(style.borderTopStyle != "none") {
3733  res += ASPx.PxToFloat(style.borderTopWidth);
3734  if(Browser.IE && Browser.MajorVersion < 9)
3735   res += getIe8BorderWidthFromText(style.borderTopWidth);
3736 }
3737 if(style.borderBottomStyle != "none") {
3738  res += ASPx.PxToFloat(style.borderBottomWidth);
3739  if(Browser.IE && Browser.MajorVersion < 9)
3740   res += getIe8BorderWidthFromText(style.borderBottomWidth);
3741 }
3742 return res;
3743};
3744ASPx.GetHorizontalBordersWidth = function(element, style) {
3745 if(!ASPx.IsExists(style))
3746  style = (Browser.IE && window.getComputedStyle) ? window.getComputedStyle(element) : ASPx.GetCurrentStyle(element);
3747 var res = 0;
3748 if(style.borderLeftStyle != "none") {
3749  res += ASPx.PxToFloat(style.borderLeftWidth);
3750  if(Browser.IE && Browser.MajorVersion < 9)
3751   res += getIe8BorderWidthFromText(style.borderLeftWidth);
3752 }
3753 if(style.borderRightStyle != "none") {
3754  res += ASPx.PxToFloat(style.borderRightWidth);
3755  if(Browser.IE && Browser.MajorVersion < 9)
3756   res += getIe8BorderWidthFromText(style.borderRightWidth);
3757 }
3758 return res;
3759};
3760function getIe8BorderWidthFromText(textWidth) {
3761 var availableWidth = { "thin": 1, "medium" : 3, "thick": 5 };
3762 var width = availableWidth[textWidth];
3763 return width ? width : 0;
3764}
3765ASPx.GetTopBottomPaddings = function(element, style) {
3766 var currentStyle = style ? style : ASPx.GetCurrentStyle(element);
3767 return ASPx.PxToInt(currentStyle.paddingTop) + ASPx.PxToInt(currentStyle.paddingBottom);
3768};
3769ASPx.GetLeftRightPaddings = function(element, style) {
3770 var currentStyle = style ? style : ASPx.GetCurrentStyle(element);
3771 return ASPx.PxToInt(currentStyle.paddingLeft) + ASPx.PxToInt(currentStyle.paddingRight);
3772};
3773ASPx.GetTopBottomMargins = function(element, style) {
3774 var currentStyle = style ? style : ASPx.GetCurrentStyle(element);
3775 return ASPx.PxToInt(currentStyle.marginTop) + ASPx.PxToInt(currentStyle.marginBottom);
3776};
3777ASPx.GetLeftRightMargins = function(element, style) {
3778 var currentStyle = style ? style : ASPx.GetCurrentStyle(element);
3779 return ASPx.PxToInt(currentStyle.marginLeft) + ASPx.PxToInt(currentStyle.marginRight);
3780};
3781ASPx.GetClearClientWidth = function(element) {
3782 return element.offsetWidth - ASPx.GetLeftRightBordersAndPaddingsSummaryValue(element);
3783};
3784ASPx.GetClearClientHeight = function(element) {
3785 return element.offsetHeight - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(element);
3786};
3787ASPx.SetOffsetWidth = function(element, widthValue, currentStyle) {
3788 if(!ASPx.IsExists(currentStyle))
3789  currentStyle = ASPx.GetCurrentStyle(element);
3790 var value = widthValue - ASPx.PxToInt(currentStyle.marginLeft) - ASPx.PxToInt(currentStyle.marginRight);
3791  value -= ASPx.GetLeftRightBordersAndPaddingsSummaryValue(element, currentStyle);
3792 if(value > -1)
3793  element.style.width = value + "px";
3794};
3795ASPx.SetOffsetHeight = function(element, heightValue, currentStyle) {
3796 if(!ASPx.IsExists(currentStyle))
3797  currentStyle = ASPx.GetCurrentStyle(element);
3798 var value = heightValue - ASPx.PxToInt(currentStyle.marginTop) - ASPx.PxToInt(currentStyle.marginBottom);
3799  value -= ASPx.GetTopBottomBordersAndPaddingsSummaryValue(element, currentStyle);
3800 if(value > -1)
3801  element.style.height = value + "px";
3802};
3803ASPx.FindOffsetParent = function(element) {
3804 var currentElement = element.parentNode;
3805 while(ASPx.IsExistsElement(currentElement) && currentElement.tagName != "BODY") {
3806  if(currentElement.offsetWidth > 0 && currentElement.offsetHeight > 0)
3807   return currentElement;
3808  currentElement = currentElement.parentNode;
3809 }
3810 return document.body;
3811};
3812ASPx.GetDocumentScrollTop = function(){
3813 var isScrollBodyIE = Browser.IE && ASPx.GetCurrentStyle(document.body).overflow == "hidden" && document.body.scrollTop > 0;
3814 if(Browser.WebKitFamily || Browser.Edge || isScrollBodyIE) {
3815  if(Browser.MacOSMobilePlatform) 
3816   return window.pageYOffset;
3817  if(Browser.WebKitFamily)
3818   return document.documentElement.scrollTop || document.body.scrollTop;
3819  return document.body.scrollTop;
3820 }
3821 else
3822  return document.documentElement.scrollTop;
3823};
3824ASPx.SetDocumentScrollTop = function(scrollTop) {
3825 if(Browser.WebKitFamily && Browser.Version < 60 || Browser.Edge)
3826  document.body.scrollTop = scrollTop;
3827 else
3828  document.documentElement.scrollTop = scrollTop;
3829};
3830ASPx.GetDocumentScrollLeft = function(){
3831 var isScrollBodyIE = Browser.IE && ASPx.GetCurrentStyle(document.body).overflow == "hidden" && document.body.scrollLeft > 0;
3832 if(Browser.Edge || isScrollBodyIE)
3833  return document.body.scrollLeft;
3834 if(Browser.WebKitFamily)
3835  return document.documentElement.scrollLeft || document.body.scrollLeft;
3836 return document.documentElement.scrollLeft;
3837};
3838ASPx.SetDocumentScrollLeft = function (scrollLeft) {
3839 if(Browser.WebKitFamily && Browser.Version < 60 || Browser.Edge)
3840  document.body.scrollLeft = scrollLeft;
3841 else
3842  document.documentElement.scrollLeft = scrollLeft;
3843};
3844ASPx.GetDocumentClientWidth = function(){
3845 if(document.documentElement.clientWidth == 0)
3846  return document.body.clientWidth;
3847 else
3848  return document.documentElement.clientWidth;
3849};
3850ASPx.GetDocumentClientHeight = function() {
3851 if(Browser.Firefox && window.innerHeight - document.documentElement.clientHeight > ASPx.GetVerticalScrollBarWidth()) {
3852  return window.innerHeight;
3853 } else if(Browser.Opera && Browser.Version < 9.6 || document.documentElement.clientHeight == 0) {
3854   return document.body.clientHeight;
3855 }
3856 return document.documentElement.clientHeight;
3857};
3858ASPx.GetDocumentWidth = function(){
3859 var bodyWidth = document.body.offsetWidth;
3860 var docWidth = Browser.IE ? document.documentElement.clientWidth : document.documentElement.offsetWidth;
3861 var bodyScrollWidth = document.body.scrollWidth;
3862 var docScrollWidth = document.documentElement.scrollWidth;
3863 return getMaxDimensionOf(bodyWidth, docWidth, bodyScrollWidth, docScrollWidth);
3864};
3865ASPx.GetDocumentHeight = function(){
3866 var bodyHeight = document.body.offsetHeight;
3867 var docHeight = Browser.IE ? document.documentElement.clientHeight : document.documentElement.offsetHeight;
3868 var bodyScrollHeight = document.body.scrollHeight;
3869 var docScrollHeight = document.documentElement.scrollHeight;
3870 var maxHeight = getMaxDimensionOf(bodyHeight, docHeight, bodyScrollHeight, docScrollHeight);
3871 if(Browser.Opera && Browser.Version >= 9.6){
3872  if(Browser.Version < 10)
3873   maxHeight = getMaxDimensionOf(bodyHeight, docHeight, bodyScrollHeight);
3874  var visibleHeightOfDocument = document.documentElement.clientHeight;
3875  if(maxHeight > visibleHeightOfDocument)
3876   maxHeight = getMaxDimensionOf(window.outerHeight, maxHeight);
3877  else
3878   maxHeight = document.documentElement.clientHeight;
3879  return maxHeight;
3880 }
3881 return maxHeight;
3882};
3883ASPx.GetDocumentMaxClientWidth = function(){
3884 var bodyWidth = document.body.offsetWidth;
3885 var docWidth = document.documentElement.offsetWidth;
3886 var docClientWidth = document.documentElement.clientWidth;
3887 return getMaxDimensionOf(bodyWidth, docWidth, docClientWidth);
3888};
3889ASPx.GetDocumentMaxClientHeight = function(){
3890 var bodyHeight = document.body.offsetHeight;
3891 var docHeight = document.documentElement.offsetHeight;
3892 var docClientHeight = document.documentElement.clientHeight;
3893 return getMaxDimensionOf(bodyHeight, docHeight, docClientHeight);
3894};
3895ASPx.verticalScrollIsNotHidden = null;
3896ASPx.horizontalScrollIsNotHidden = null;
3897ASPx.GetVerticalScrollIsNotHidden = function() {
3898 if(!ASPx.IsExists(ASPx.verticalScrollIsNotHidden))
3899  ASPx.verticalScrollIsNotHidden = ASPx.GetCurrentStyle(document.body).overflowY !== "hidden"
3900   && ASPx.GetCurrentStyle(document.documentElement).overflowY !== "hidden";
3901 return ASPx.verticalScrollIsNotHidden;
3902};
3903ASPx.GetHorizontalScrollIsNotHidden = function() {
3904 if(!ASPx.IsExists(ASPx.horizontalScrollIsNotHidden))
3905  ASPx.horizontalScrollIsNotHidden = ASPx.GetCurrentStyle(document.body).overflowX !== "hidden"
3906   && ASPx.GetCurrentStyle(document.documentElement).overflowX !== "hidden";
3907 return ASPx.horizontalScrollIsNotHidden;
3908};
3909ASPx.GetCurrentDocumentWidth = function() {
3910 var result = ASPx.GetDocumentClientWidth();
3911 if(!ASPx.Browser.Safari && ASPx.GetVerticalScrollIsNotHidden() && ASPx.GetDocumentHeight() > ASPx.GetDocumentClientHeight())
3912  result += ASPx.GetVerticalScrollBarWidth();
3913 return result;
3914};
3915ASPx.GetCurrentDocumentHeight = function() {
3916 var result = ASPx.GetDocumentClientHeight();
3917 if(!ASPx.Browser.Safari && ASPx.GetHorizontalScrollIsNotHidden() && ASPx.GetDocumentWidth() > ASPx.GetDocumentClientWidth())
3918  result += ASPx.GetVerticalScrollBarWidth();
3919 return result;
3920};
3921function getMaxDimensionOf(){
3922 var max = ASPx.InvalidDimension;
3923 for(var i = 0; i < arguments.length; i++){
3924  if(max < arguments[i])
3925   max = arguments[i];
3926 }
3927 return max;
3928}
3929ASPx.GetClientLeft = function(element){
3930 return ASPx.IsExists(element.clientLeft) ? element.clientLeft : (element.offsetWidth - element.clientWidth) / 2;
3931};
3932ASPx.GetClientTop = function(element){
3933 return ASPx.IsExists(element.clientTop) ? element.clientTop : (element.offsetHeight - element.clientHeight) / 2;
3934};
3935ASPx.SetStyles = function(element, styles, makeImportant) {
3936 if(ASPx.IsExists(styles.cssText))
3937  element.style.cssText = styles.cssText;
3938 if(ASPx.IsExists(styles.className))
3939  element.className = styles.className;
3940 for(var property in styles) {
3941  if(!styles.hasOwnProperty(property))
3942   continue;
3943  var value = styles[property];
3944  switch (property) {
3945   case "cssText":
3946   case "className":
3947    break;
3948   case "float":
3949    ASPx.SetElementFloat(element, value);
3950    break;
3951   case "opacity":
3952    ASPx.SetElementOpacity(element, value);
3953    break;
3954   case "zIndex":
3955    ASPx.SetStylesCore(element, property, value, makeImportant);
3956    break;
3957   case "fontWeight":
3958    if(ASPx.Browser.IE && ASPx.Browser.Version < 9 && typeof(styles[property]) == "number")
3959     value = styles[property].toString();
3960   default:
3961    ASPx.SetStylesCore(element, property, value + (typeof (value) == "number" ? "px" : ""), makeImportant);
3962  }
3963 }
3964};
3965ASPx.SetStylesCore = function(element, property, value, makeImportant) {
3966 if(makeImportant) {
3967  var index = property.search("[A-Z]");
3968  if(index != -1)
3969   property = property.replace(property.charAt(index), "-" + property.charAt(index).toLowerCase());
3970  if(element.style.setProperty)
3971   element.style.setProperty(property, value, "important");
3972  else 
3973   element.style.cssText += ";" + property + ":" + value + "!important";
3974 }
3975 else
3976  element.style[property] = value;
3977};
3978ASPx.RemoveBordersAndShadows = function(el) {
3979 if(!el || !el.style)
3980  return;
3981 el.style.borderWidth = 0;
3982 if(ASPx.IsExists(el.style.boxShadow))
3983  el.style.boxShadow = "none";
3984 else if(ASPx.IsExists(el.style.MozBoxShadow))
3985  el.style.MozBoxShadow = "none";
3986 else if(ASPx.IsExists(el.style.webkitBoxShadow))
3987  el.style.webkitBoxShadow = "none";
3988};
3989ASPx.GetCellSpacing = function(element) {
3990 var val = parseInt(element.cellSpacing);
3991 if(!isNaN(val)) return val;
3992 val = parseInt(ASPx.GetCurrentStyle(element).borderSpacing);
3993 if(!isNaN(val)) return val;
3994 return 0;
3995};
3996ASPx.GetInnerScrollPositions = function(element) {
3997 var scrolls = [];
3998 getInnerScrollPositionsCore(element, scrolls);
3999 return scrolls;
4000};
4001function getInnerScrollPositionsCore(element, scrolls) {
4002 for(var child = element.firstChild; child; child = child.nextSibling) {
4003  var scrollTop = child.scrollTop,
4004   scrollLeft = child.scrollLeft;
4005  if(scrollTop > 0 || scrollLeft > 0)
4006   scrolls.push([child, scrollTop, scrollLeft]);
4007  getInnerScrollPositionsCore(child, scrolls);
4008 }
4009}
4010ASPx.RestoreInnerScrollPositions = function(scrolls) {
4011 for(var i = 0, scrollArr; scrollArr = scrolls[i]; i++) {
4012  if(scrollArr[1] > 0)
4013   scrollArr[0].scrollTop = scrollArr[1];
4014  if(scrollArr[2] > 0)
4015   scrollArr[0].scrollLeft = scrollArr[2];
4016 }
4017};
4018ASPx.GetOuterScrollPosition = function(element) {
4019 while(element.tagName !== "BODY") {
4020  var scrollTop = element.scrollTop,
4021   scrollLeft = element.scrollLeft;
4022  if(scrollTop > 0 || scrollLeft > 0) {
4023   return {
4024    scrollTop: scrollTop,
4025    scrollLeft: scrollLeft,
4026    element: element
4027   };
4028  }
4029  element = element.parentNode;
4030 }
4031 return {
4032  scrollTop: ASPx.GetDocumentScrollTop(),
4033  scrollLeft: ASPx.GetDocumentScrollLeft()
4034 };
4035};
4036ASPx.RestoreOuterScrollPosition = function(scrollInfo) {
4037 if(scrollInfo.element) {
4038  if(scrollInfo.scrollTop > 0)
4039   scrollInfo.element.scrollTop = scrollInfo.scrollTop;
4040  if(scrollInfo.scrollLeft > 0)
4041   scrollInfo.element.scrollLeft = scrollInfo.scrollLeft;
4042 }
4043 else {
4044  if(scrollInfo.scrollTop > 0)
4045   ASPx.SetDocumentScrollTop(scrollInfo.scrollTop);
4046  if(scrollInfo.scrollLeft > 0)
4047   ASPx.SetDocumentScrollLeft(scrollInfo.scrollLeft);
4048 }
4049};
4050ASPx.ChangeElementContainer = function(element, container, savePreviousContainer) {
4051 if(element.parentNode != container) {
4052  var parentNode = element.parentNode;
4053  parentNode.removeChild(element);
4054  container.appendChild(element);
4055  if(savePreviousContainer)
4056   element.previousContainer = parentNode;
4057 }
4058};
4059ASPx.RestoreElementContainer = function(element) {
4060 if(element.previousContainer) {
4061  ASPx.ChangeElementContainer(element, element.previousContainer, false);
4062  element.previousContainer = null;
4063 }
4064};
4065ASPx.MoveChildrenToElement = function(sourceElement, destinationElement){
4066 while(sourceElement.childNodes.length > 0)
4067  destinationElement.appendChild(sourceElement.childNodes[0]);
4068};
4069ASPx.GetScriptCode = function(script) {
4070 var useFirstChildElement = Browser.Chrome && Browser.Version < 11 || Browser.Safari && Browser.Version < 5; 
4071 var text = useFirstChildElement ? script.firstChild.data : script.text;
4072 var comment = "<!--";
4073 var pos = text.indexOf(comment);
4074 if(pos > -1)
4075  text = text.substr(pos + comment.length);
4076 return text;
4077};
4078ASPx.AppendScript = function(script) {
4079 var parent = document.getElementsByTagName("head")[0];
4080 if(!parent)
4081  parent = document.body;
4082 if(parent)
4083  parent.appendChild(script);
4084};
4085function getFrame(frames, name) {
4086 if(frames[name])
4087  return frames[name];
4088 for(var i = 0; i < frames.length; i++) {
4089  try {
4090   var frame = frames[i];
4091   if(frame.name == name) 
4092    return frame; 
4093   frame = getFrame(frame.frames, name);
4094   if(frame != null)   
4095    return frame; 
4096  } catch(e) {
4097  } 
4098 }
4099 return null;
4100}
4101ASPx.IsValidElement = function(element) {
4102 if(!element) 
4103  return false;
4104 if(!(Browser.Firefox && Browser.Version < 4)) {
4105  if(element.ownerDocument && element.ownerDocument.body && element.ownerDocument.body.compareDocumentPosition)
4106   return element.ownerDocument.body.compareDocumentPosition(element) % 2 === 0;
4107 }
4108 if(!Browser.Opera && !(Browser.IE && Browser.Version < 9) && element.offsetParent && element.parentNode.tagName)
4109  return true;
4110 while(element != null){
4111  if(element.tagName == "BODY")
4112   return true;
4113  element = element.parentNode;
4114 }
4115 return false;
4116};
4117ASPx.IsValidElements = function(elements) {
4118 if(!elements)
4119  return false; 
4120 for(var i = 0; i < elements.length; i++) {
4121  if(elements[i] && !ASPx.IsValidElement(elements[i]))
4122   return false;
4123 }
4124 return true;
4125};
4126ASPx.IsExistsElement = function(element) {
4127 return element && ASPx.IsValidElement(element);
4128};
4129ASPx.CreateHtmlElementFromString = function(str) {
4130 var dummy = ASPx.CreateHtmlElement();
4131 dummy.innerHTML = str;
4132 return dummy.firstChild;
4133};
4134ASPx.CreateHtmlElement = function(tagName, styles) {
4135 var element = document.createElement(tagName || "DIV");
4136 if(styles)
4137  ASPx.SetStyles(element, styles);
4138 return element;
4139};
4140ASPx.RestoreElementOriginalWidth = function(element) {
4141 if(!ASPx.IsExistsElement(element)) 
4142  return;
4143 element.style.width = element.dxOrigWidth = ASPx.GetElementOriginalWidth(element);
4144};
4145ASPx.GetElementOriginalWidth = function(element) {
4146 if(!ASPx.IsExistsElement(element)) 
4147  return null;
4148 var width;
4149 if(!ASPx.IsExists(element.dxOrigWidth)) {
4150   width = String(element.style.width).length > 0
4151  ? element.style.width
4152  : element.offsetWidth + "px";
4153 } else {
4154  width = element.dxOrigWidth;
4155 }
4156 return width;
4157};
4158ASPx.DropElementOriginalWidth = function(element) {
4159 if(ASPx.IsExists(element.dxOrigWidth))
4160  element.dxOrigWidth = null;
4161};
4162ASPx.GetObjectKeys = function(obj) {
4163 if(!obj) return [ ];
4164 if(Object.keys)
4165  return Object.keys(obj);
4166 var keys = [ ];
4167 for(var key in obj) {
4168  if(obj.hasOwnProperty(key))
4169   keys.push(key);
4170 }
4171 return keys;
4172};
4173ASPx.ShowErrorAlert = function(message) {
4174 message = ASPx.Str.DecodeHtmlViaTextArea(message);
4175 if(ASPx.IsExists(message) && message !== "")
4176  alert(message);
4177};
4178ASPx.ShowKBErrorMessage = function(text, kbid) {
4179 ASPx.ShowErrorMessage(text + "https://www.devexpress.com/kbid=" + kbid + ".");
4180};
4181ASPx.ShowErrorMessage = function(errorMessage) {
4182 var console = window.console;
4183 if(!console || !ASPx.IsFunction(console.error))
4184  return;
4185 console.error(errorMessage);
4186};
4187ASPx.IsInteractiveControl = function(element, extremeParent) { 
4188 return Data.ArrayIndexOf(["A", "INPUT", "SELECT", "OPTION", "TEXTAREA", "BUTTON", "IFRAME"], element.tagName) > -1;
4189};
4190ASPx.IsUrlContainsClientScript = function(url) {
4191 return url.toLowerCase().indexOf("javascript:") !== -1;
4192};
4193ASPx.GetMSAjaxRequestManager = function() {
4194 if(window.Sys && Sys.WebForms && Sys.WebForms.PageRequestManager && Sys.WebForms.PageRequestManager.getInstance)
4195  return Sys.WebForms.PageRequestManager.getInstance();
4196 return null;
4197};
4198Function.prototype.aspxBind = function(scope) {
4199 var func = this;
4200 return function() {
4201  return func.apply(scope, arguments);
4202 };
4203};
4204var FilteringUtils = { };
4205FilteringUtils.EventKeyCodeChangesTheInput = function(evt) {
4206 if(ASPx.IsPasteShortcut(evt))
4207  return true;
4208 else if(evt.ctrlKey && !evt.altKey)
4209  return false;
4210 if(ASPx.Browser.AndroidMobilePlatform || ASPx.Browser.MacOSMobilePlatform) return true; 
4211 var keyCode = ASPx.Evt.GetKeyCode(evt);
4212 var isSystemKey = ASPx.Key.Windows <= keyCode && keyCode <= ASPx.Key.ContextMenu;
4213 var isFKey = ASPx.Key.F1 <= keyCode && keyCode <= 127; 
4214 return ASPx.Key.Delete <= keyCode && !isSystemKey && !isFKey || keyCode == ASPx.Key.Backspace || keyCode == ASPx.Key.Space;
4215};
4216FilteringUtils.FormatCallbackArg = function(prefix, arg) {
4217 return (ASPx.IsExists(arg) ? prefix + "|" + arg.length + ';' + arg + ';' : "");
4218};
4219ASPx.FilteringUtils = FilteringUtils;
4220var FormatStringHelper = { };
4221FormatStringHelper.PlaceHolderTemplateStruct = function(startIndex, length, index, placeHolderString){
4222 this.startIndex = startIndex;
4223 this.realStartIndex = 0;
4224 this.length = length;
4225 this.realLength = 0;
4226 this.index = index;
4227 this.placeHolderString = placeHolderString;
4228};
4229FormatStringHelper.GetPlaceHolderTemplates = function(formatString){
4230 formatString = this.CollapseDoubleBrackets(formatString);
4231 var templates = this.CreatePlaceHolderTemplates(formatString);
4232 return templates;
4233};
4234FormatStringHelper.CreatePlaceHolderTemplates = function(formatString){
4235 var templates = [];
4236 var templateStrings = formatString.match(/{[^}]+}/g);
4237 if(templateStrings != null){
4238  var pos = 0;
4239  for(var i = 0; i < templateStrings.length; i++){
4240   var tempString = templateStrings[i];
4241   var startIndex = formatString.indexOf(tempString, pos);
4242   var length = tempString.length;
4243   var indexString = tempString.slice(1).match(/^[0-9]+/);
4244   var index = parseInt(indexString);
4245   templates.push(new this.PlaceHolderTemplateStruct(startIndex, length, index, tempString));
4246   pos = startIndex + length;
4247  }
4248 }
4249 return templates;
4250};
4251FormatStringHelper.CollapseDoubleBrackets = function(formatString){
4252 formatString = this.CollapseOpenDoubleBrackets(formatString);
4253 formatString = this.CollapseCloseDoubleBrackets(formatString);
4254 return formatString;
4255};
4256FormatStringHelper.CollapseOpenDoubleBrackets = function(formatString){
4257 return formatString.replace(/{{/g, "_");
4258};
4259FormatStringHelper.CollapseCloseDoubleBrackets = function(formatString){
4260 while(true){
4261  var index = formatString.lastIndexOf("}}");
4262  if(index == -1) 
4263   break;
4264  else
4265   formatString = formatString.substr(0, index) + "_" + formatString.substr(index + 2);
4266 }
4267 return formatString;
4268};
4269ASPx.FormatStringHelper = FormatStringHelper;
4270var StartWithFilteringUtils = { };
4271StartWithFilteringUtils.HighlightSuggestedText = function(input, suggestedText, control){
4272 if(this.NeedToLockAndoidKeyEvents(control))
4273  control.LockAndroidKeyEvents();
4274 var selInfo = ASPx.Selection.GetInfo(input);
4275 var currentTextLenght = ASPx.Str.GetCoincideCharCount(suggestedText, input.value, 
4276  function(text, filter) { 
4277   return text.indexOf(filter) == 0;
4278  });
4279 var suggestedTextLenght = suggestedText.length;
4280 var isSelected = selInfo.startPos == 0 && selInfo.endPos == currentTextLenght && 
4281  selInfo.endPos == suggestedTextLenght && input.value == suggestedText;
4282 if(!isSelected) { 
4283  input.value = suggestedText;
4284  if(this.NeedToLockAndoidKeyEvents(control)) {
4285   window.setTimeout(function() {
4286    this.SelectText(input, currentTextLenght, suggestedTextLenght);
4287    control.UnlockAndroidKeyEvents();
4288   }.aspxBind(this), control.adroidSamsungBugTimeout);
4289  } else
4290   this.SelectText(input, currentTextLenght, suggestedTextLenght);
4291 }
4292};
4293StartWithFilteringUtils.SelectText = function(input, startPos, stopPos) {
4294 if(startPos < stopPos)
4295  ASPx.Selection.Set(input, startPos, stopPos);
4296};
4297StartWithFilteringUtils.RollbackOneSuggestedChar = function(input){
4298 var currentText = input.value;
4299 var cutText = currentText.slice(0, -1);
4300 if(cutText != currentText)
4301  input.value = cutText;
4302};
4303StartWithFilteringUtils.NeedToLockAndoidKeyEvents = function(control) {
4304 return ASPx.Browser.AndroidMobilePlatform && control && control.LockAndroidKeyEvents;
4305};
4306ASPx.StartWithFilteringUtils = StartWithFilteringUtils;
4307var ContainsFilteringUtils = { };
4308ContainsFilteringUtils.ColumnSelectionStruct = function(index, startIndex, length){
4309 this.index = index;
4310 this.length = length;
4311 this.startIndex = startIndex;
4312};
4313ContainsFilteringUtils.IsFilterCrossPlaseHolder = function(filterStartIndex, filterEndIndex, template) {
4314 var left = Math.max(filterStartIndex, template.realStartIndex);
4315 var right = Math.min(filterEndIndex,  template.realStartIndex + template.realLength);
4316 return left < right;
4317};
4318ContainsFilteringUtils.GetColumnSelectionsForItem = function(itemValues, formatString, filterString) {
4319 if(formatString == "") 
4320  return this.GetSelectionForSingleColumnItem(itemValues, filterString); 
4321 var result = [];
4322 var formatedString = ASPx.Formatter.Format(formatString, itemValues);
4323 var filterStartIndex = ASPx.Str.PrepareStringForFilter(formatedString).indexOf(ASPx.Str.PrepareStringForFilter(filterString));
4324 if(filterStartIndex == -1) return result;
4325 var filterEndIndex = filterStartIndex + filterString.length;
4326 var templates = FormatStringHelper.GetPlaceHolderTemplates(formatString);
4327 this.SupplyTemplatesWithRealValues(itemValues, templates);
4328 for(var i = 0; i < templates.length ; i++) {
4329  if(this.IsFilterCrossPlaseHolder(filterStartIndex, filterEndIndex, templates[i])) 
4330   result.push(this.GetColumnSelectionsForItemValue(templates[i], filterStartIndex, filterEndIndex));
4331 }
4332 return result;
4333};
4334ContainsFilteringUtils.GetColumnSelectionsForItemValue = function(template, filterStartIndex, filterEndIndex) {
4335 var selectedTextStartIndex = filterStartIndex < template.realStartIndex ? 0 :
4336  filterStartIndex - template.realStartIndex;
4337 var selectedTextEndIndex = filterEndIndex >  template.realStartIndex + template.realLength ? template.realLength :
4338  filterEndIndex - template.realStartIndex;
4339 var selectedTextLength = selectedTextEndIndex - selectedTextStartIndex;
4340 return new this.ColumnSelectionStruct(template.index, selectedTextStartIndex, selectedTextLength);
4341};
4342ContainsFilteringUtils.GetSelectionForSingleColumnItem = function(itemValues, filterString) {
4343 var selectedTextStartIndex = ASPx.Str.PrepareStringForFilter(itemValues[0]).indexOf(ASPx.Str.PrepareStringForFilter(filterString));
4344 var selectedTextLength = filterString.length;
4345 return [new this.ColumnSelectionStruct(0, selectedTextStartIndex, selectedTextLength)];
4346};
4347ContainsFilteringUtils.ResetFormatStringIndex = function(formatString, index) {
4348 if(index != 0)
4349  return formatString.replace(index.toString(), "0");
4350 return formatString;
4351};
4352ContainsFilteringUtils.SupplyTemplatesWithRealValues = function(itemValues, templates) {
4353 var shift = 0;
4354 for(var i = 0; i < templates.length; i++) {
4355  var formatString = this.ResetFormatStringIndex(templates[i].placeHolderString, templates[i].index);
4356  var currentItemValue = itemValues[templates[i].index];
4357  templates[i].realLength = ASPx.Formatter.Format(formatString, currentItemValue).length;
4358  templates[i].realStartIndex  += templates[i].startIndex + shift; 
4359  shift += templates[i].realLength - templates[i].placeHolderString.length; 
4360 }
4361};
4362ContainsFilteringUtils.PrepareElementText = function(itemText) {
4363 return itemText ? itemText.replace(/\&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;") : '';
4364};
4365ContainsFilteringUtils.UnselectContainsTextInElement = function(element, selection, highlightTagName) {
4366 var currentText =  ASPx.Attr.GetAttribute (element, "DXText");
4367 if(ASPx.IsExists(currentText)) {
4368  currentText = ContainsFilteringUtils.PrepareElementText(currentText);
4369  ASPx.SetInnerHtml(element, currentText === "" ? "&nbsp;" : currentText);
4370 }
4371};
4372ContainsFilteringUtils.ReselectContainsTextInElement = function(element, selection, highlightTagName) {
4373 var currentText = ASPx.GetInnerText(element);
4374 if(!highlightTagName)
4375  highlightTagName = "em";
4376 highlightTagName = highlightTagName.toLowerCase();
4377 if(currentText.indexOf("</" + highlightTagName + ">") != -1)
4378  ContainsFilteringUtils.UnselectContainsTextInElement(element, selection, highlightTagName);
4379 return ContainsFilteringUtils.SelectContainsTextInElement(element, selection, highlightTagName);
4380};
4381ContainsFilteringUtils.SelectContainsTextInElement = function(element, selection, highlightTagName) {
4382 if(selection.startIndex == -1)
4383  return;
4384 var currentText =  ASPx.Attr.GetAttribute (element, "DXText");
4385 if(!ASPx.IsExists(currentText)) ASPx.Attr.SetAttribute (element, "DXText", ASPx.GetInnerText(element));
4386 if(!highlightTagName)
4387  highlightTagName = "em";
4388 highlightTagName = highlightTagName.toLowerCase();
4389 var oldInnerText = ASPx.GetInnerText(element);
4390 var newInnerText = ContainsFilteringUtils.PrepareElementText(oldInnerText.substr(0, selection.startIndex)) + "<" + highlightTagName + ">" +
4391      ContainsFilteringUtils.PrepareElementText(oldInnerText.substr(selection.startIndex, selection.length)) + "</" + highlightTagName + ">" +
4392      ContainsFilteringUtils.PrepareElementText(oldInnerText.substr(selection.startIndex + selection.length));
4393 ASPx.SetInnerHtml(element, newInnerText);
4394};
4395ASPx.ContainsFilteringUtils = ContainsFilteringUtils;
4396ASPx.MakeEqualControlsWidth = function(name1, name2){
4397 var control1 = ASPx.GetControlCollection().Get(name1);
4398 var control2 = ASPx.GetControlCollection().Get(name2);
4399 if(control1 && control2){
4400  var width = Math.max(control1.GetWidth(), control2.GetWidth());
4401  control1.SetWidth(width);
4402  control2.SetWidth(width);
4403 }
4404};
4405ASPx.HighContrastForeColorHighlightColorMap = {
4406 "#ffff00" : "#008000",
4407 "#00ff00" : "#0000ff",
4408 "#ffffff" : "#00838f",
4409 "#000000" : "#a347ff"
4410};
4411var AccessibilityUtils = {
4412 isInitialized: false,
4413 highContrastCssClassMarker: "dxHighContrast",
4414 highContrastBackgroundCssClassMarker: "dxHCB",
4415 highContrastDefaultBackgroundColor: "#a347ff",
4416 highContrastThemeActive: false,
4417 accessibleBackgroundCssMarker: ".dx-runtime-background",
4418 createAccessibleBackgrounds: function(control) {
4419  if(!this.highContrastThemeActive || control.accessibleBackgroundsCreated || !control.accessibilityCompliant)
4420   return;
4421  var className = this.accessibleBackgroundCssMarker;
4422  var styleSheetRuleNames = [];
4423  iterateStyleSheetRules(null, function(rule) {
4424   var selectorTxt = rule.selectorText;
4425   if(selectorTxt && selectorTxt.indexOf(className) > -1)
4426    styleSheetRuleNames.push(ASPx.Str.CompleteReplace(selectorTxt, className, "")); 
4427  });
4428  for(var i = 0; i < styleSheetRuleNames.length; i++) {
4429   var name = styleSheetRuleNames[i];
4430   var rule = ASPx.GetStyleSheetRules(name.substring(1));
4431   if(rule && rule.style && rule.style.backgroundImage)
4432    this.createAccessibleBackground(control.GetMainElement(), rule.style, name);
4433  }
4434  control.accessibleBackgroundsCreated = true;
4435 },
4436 createAccessibleBackground: function(container, style, selector) {
4437  if(!container)
4438   return;
4439  var backgroundUrl = style.backgroundImage.substring(5, style.backgroundImage.length - 2);
4440  var elements = container.querySelectorAll(selector);
4441  var accessibleBackgroundClassName = "dx-acc-bi";
4442  for(var i = 0; i < elements.length; i++) {
4443   var element = elements[i];
4444   if(ASPx.ElementHasCssClass(element, accessibleBackgroundClassName))
4445    continue;
4446   var image = null;
4447   if(element.tagName !== "IMG") {
4448    ASPx.AddClassNameToElement(element, accessibleBackgroundClassName);
4449    image = element.ownerDocument.createElement("IMG");
4450    ASPx.SetStyles(image, { width: "100%", height: "100%" });
4451    if(element.firstChild)
4452     element.insertBefore(image, element.firstChild);
4453    else
4454     element.appendChild(image);
4455   } else
4456    image = element;
4457   image.src = backgroundUrl;
4458  }
4459 },
4460 createHighContrastBackgroundStyle: function() {
4461  var style = document.createElement('style');
4462  style.type = 'text/css';
4463  var styleContent = [
4464   "." + this.highContrastCssClassMarker + " ." + this.highContrastBackgroundCssClassMarker + ":after {",
4465   "border-image: url(" + this.getHighContrastBackgroundUrl() + ") 0 1 0 0 round;",
4466   "}",
4467  ];
4468  style.innerHTML = styleContent.join('\n');
4469  document.getElementsByTagName('head')[0].appendChild(style);
4470 },
4471 getHighContrastBackgroundUrl: function() {
4472  var canvas = document.createElement("canvas"),
4473  ctx = canvas.getContext('2d');
4474  canvas.width = 1;
4475  canvas.height = 1;
4476  ctx.fillStyle = this.getHighContrastBackgroundColor();
4477  ctx.fillRect(0, 0, canvas.width, canvas.height);
4478  return canvas.toDataURL();
4479 },
4480 getHighContrastBackgroundColor: function() {
4481  var foreColor = ASPx.GetCurrentStyle(document.body).color;
4482  var hexColor = ASPx.Color.ColorToHexadecimal(foreColor);
4483  return ASPx.HighContrastForeColorHighlightColorMap[hexColor] || this.highContrastDefaultBackgroundColor;
4484 },
4485 initialize: function() {
4486  if(this.isInitialized)
4487   return;
4488  this.isInitialized = true;
4489  this.detectHighContrastTheme();
4490  if(this.highContrastThemeActive)
4491   this.createHighContrastBackgroundStyle();
4492 },
4493 detectHighContrastTheme: function() {
4494  var testElement = document.createElement("DIV");
4495  ASPx.SetStyles(testElement, {
4496   backgroundImage: "url('" + ASPx.EmptyImageUrl + "')",
4497   display: "none"
4498  }, true);
4499  var docElement = document.documentElement;
4500  docElement.appendChild(testElement);
4501  var actualBackgroundImg = ASPx.GetCurrentStyle(testElement).backgroundImage;
4502  docElement.removeChild(testElement);
4503  if(actualBackgroundImg === "none") {
4504   this.highContrastThemeActive = true;
4505   ASPx.AddClassNameToElement(docElement, this.highContrastCssClassMarker);
4506  }
4507 }
4508};
4509ASPx.AccessibilityUtils = AccessibilityUtils;
4510ASPx.AccessibilityUtils.SendMessageToAssistiveTechnology = function(message) {
4511 var messageParts = ASPx.Ident.IsArray(message) ? message : [message];
4512 var args = new ASPxClientControlBeforePronounceEventArgs(messageParts, null);
4513 ASPx.AccessibilityPronouncer.EnsureInitialize();
4514 ASPx.AccessibilityPronouncer.Pronounce(args, ASPx.AccessibilityPronouncerType.live);
4515};
4516ASPx.AccessibilityUtils.SetFocusAccessible = function(focusableElement) {
4517 if(!focusableElement)
4518  return;
4519 var elementId = focusableElement.id;
4520 if(!elementId) {
4521  var namedParent = ASPx.GetParent(focusableElement, function(element) {
4522   return !!element.id;
4523  });
4524  if(ASPx.IsExists(namedParent))
4525   elementId = namedParent.id;
4526 }
4527 var focusableControl = ASPx.GetClientControlByElementID(elementId);
4528 if(focusableControl && focusableControl.OnAssociatedLabelClick)
4529  focusableControl.OnAssociatedLabelClick(focusableElement);
4530 else
4531  window.setTimeout(function() {
4532   ASPx.AccessibilityUtils.SetFocusAccessibleCore(focusableElement);
4533  }, 0);
4534};
4535ASPx.AccessibilityUtils.SetFocusAccessibleCore = function(focusableElement) {
4536 if(!ASPx.IsExists(focusableElement))
4537  return;
4538 if(!ASPx.IsValidElement(focusableElement) && focusableElement.id)
4539  focusableElement = ASPx.GetElementById(focusableElement.id);
4540 if(!ASPx.IsActionElement(focusableElement))
4541  focusableElement = ASPx.RestoreFocusHelper.findNeighbourFocusElement(focusableElement, document.body);
4542 if(ASPx.IsExistsElement(focusableElement))
4543  focusableElement.focus();
4544};
4545ASPx.EnableCssAnimation = true;
4546var AnimationTransitionBase = ASPx.CreateClass(null, {
4547 constructor: function(element, options) {
4548  if(element) {
4549   AnimationTransitionBase.Cancel(element);
4550   this.element = element;
4551   this.element.aspxTransition = this;
4552  }
4553  this.duration = options.duration || AnimationConstants.Durations.DEFAULT;
4554  this.transition = options.transition || AnimationConstants.Transitions.SINE;
4555  this.property = options.property;
4556  this.unit = options.unit || "";
4557  this.onComplete = options.onComplete;
4558  this.to = null;
4559  this.from = null;
4560 },
4561 Start: function(from, to) {
4562  if(to != undefined) {
4563   this.to = to;
4564   this.from = from;
4565   this.SetValue(this.from);
4566  }
4567  else
4568   this.to = from;
4569 },
4570 Cancel: function() {
4571  if(!this.element)
4572   return;
4573  try {
4574   delete this.element.aspxTransition;
4575  } catch(e) {
4576   this.element.aspxTransition = undefined;
4577  }
4578 },
4579 GetValue: function() {
4580  return this.getValueInternal(this.element, this.property);
4581 },
4582 SetValue: function(value) {
4583  this.setValueInternal(this.element, this.property, this.unit, value);
4584 },
4585 setValueInternal: function(element, property, unit, value) {
4586  if(property == "opacity")
4587   AnimationUtils.setOpacity(element, value);
4588  else
4589   element.style[property] = value + unit;
4590 },
4591 getValueInternal: function(element, property) {
4592  if(property == "opacity")
4593   return ASPx.GetElementOpacity(element);
4594  var value = parseFloat(element.style[property]);
4595  return isNaN(value) ? 0 : value;
4596 },
4597 performOnComplete: function() {
4598  if(this.onComplete)
4599   this.onComplete(this.element);
4600 },
4601 getTransition: function() {
4602  return this.transition;
4603 }
4604});
4605AnimationTransitionBase.Cancel = function(element) {
4606 if(element.aspxTransition)
4607  element.aspxTransition.Cancel();
4608};
4609var AnimationConstants = {};
4610AnimationConstants.Durations = {
4611 SHORT: 200,
4612 DEFAULT: 400,
4613 LONG: 600
4614};
4615AnimationConstants.Transitions = {
4616 LINER: {
4617  Css: "cubic-bezier(0.250, 0.250, 0.750, 0.750)",
4618  Js: function(progress) { return progress; }
4619 },
4620 SINE: {
4621  Css: "cubic-bezier(0.470, 0.000, 0.745, 0.715)",
4622  Js: function(progress) { return Math.sin(progress * 1.57); }
4623 },
4624 POW: {
4625  Css: "cubic-bezier(0.755, 0.050, 0.855, 0.060)",
4626  Js: function(progress) { return Math.pow(progress, 4); }
4627 },
4628 POW_EASE_OUT: {
4629  Css: "cubic-bezier(0.165, 0.840, 0.440, 1.000)",
4630  Js: function(progress) { return 1 - AnimationConstants.Transitions.POW.Js(1 - progress); }
4631 },
4632 RIPPLE: {
4633  Css: "cubic-bezier(0.47, 0.06, 0.23, 0.99)",
4634  Js: function(progress) {
4635   return Math.pow((progress), 3) * 0.47 + 3 * progress * Math.pow((1 - progress), 2) * 0.06 + 3 * Math.pow(progress, 2) *
4636    (1 - progress) * 0.23 + 0.99 * Math.pow(progress, 3);
4637  }
4638 }
4639};
4640var JsAnimationTransition = ASPx.CreateClass(AnimationTransitionBase, {
4641 constructor: function(element, options) {
4642  this.constructor.prototype.constructor.call(this, element, options);
4643  this.onStep = options.onStep;
4644  this.fps = 60;
4645  this.startTime = null;
4646 },
4647 Start: function(from, to) {
4648  if(from == to) {
4649   this.from = this.to = from;
4650   setTimeout(this.complete.aspxBind(this), 0);
4651  }
4652  else {
4653   AnimationTransitionBase.prototype.Start.call(this, from, to);
4654   if(to == undefined)
4655    this.from = this.GetValue();
4656   this.initTimer();
4657  }
4658 },
4659 Cancel: function() {
4660  AnimationTransitionBase.prototype.Cancel.call(this);
4661  if(this.timerId)
4662   clearInterval(this.timerId);
4663 },
4664 initTimer: function() {
4665  this.startTime = new Date();
4666  this.timerId = window.setInterval(function() { this.onTick(); }.aspxBind(this), 1000 / this.fps);
4667 },
4668 onTick: function() {
4669  var progress = (new Date() - this.startTime) / this.duration;
4670  if(progress >= 1)
4671   this.complete();
4672  else {
4673   this.update(progress);
4674   if(this.onStep)
4675    this.onStep();
4676  }
4677 },
4678 update: function(progress) {
4679  this.SetValue(this.gatCalculatedValue(this.from, this.to, progress));
4680 },
4681 complete: function() {
4682  this.Cancel();
4683  this.update(1);
4684  this.performOnComplete();
4685 },
4686 gatCalculatedValue: function(from, to, progress) {
4687  if(progress == 1)
4688   return to;
4689  return from + (to - from) * this.getTransition()(progress);
4690 },
4691 getTransition: function() {
4692  return this.transition.Js;
4693 }
4694});
4695var SimpleAnimationTransition = ASPx.CreateClass(JsAnimationTransition, {
4696 constructor: function(options) {
4697  this.constructor.prototype.constructor.call(this, null, options);
4698  this.transition = options.transition || AnimationConstants.Transitions.POW_EASE_OUT;
4699  this.onUpdate = options.onUpdate;
4700  this.lastValue = 0;
4701 },
4702 SetValue: function(value) {
4703  this.onUpdate(value - this.lastValue);
4704  this.lastValue = value;
4705 },
4706 GetValue: function() {
4707  return this.lastValue;
4708 },
4709 performOnComplete: function() {
4710  if(this.onComplete)
4711   this.onComplete();
4712 }
4713});
4714var MultipleJsAnimationTransition = ASPx.CreateClass(JsAnimationTransition, {
4715 constructor: function(element, options) {
4716  this.constructor.prototype.constructor.call(this, element, options);
4717  this.properties = {};
4718 },
4719 Start: function(properties) {
4720  this.initProperties(properties);
4721  this.initTimer();
4722 },
4723 initProperties: function(properties) {
4724  this.properties = properties;
4725  for(var propName in this.properties)
4726   if(properties[propName].from == undefined)
4727    properties[propName].from = this.getValueInternal(this.element, propName);
4728 },
4729 update: function(progress) {
4730  for(var propName in this.properties) {
4731   if(this.properties.hasOwnProperty(propName)) {
4732    var property = this.properties[propName];
4733    if(property.from != property.to)
4734     this.setValueInternal(this.element, propName, property.unit, this.gatCalculatedValue(property.from, property.to, progress));
4735   }
4736  }
4737 }
4738});
4739var CssAnimationTransition = ASPx.CreateClass(AnimationTransitionBase, {
4740 constructor: function(element, options) {
4741  this.constructor.prototype.constructor.call(this, element, options);
4742  this.transitionPropertyName = AnimationUtils.CurrentTransition.property;
4743  this.eventName = AnimationUtils.CurrentTransition.event;
4744 },
4745 Start: function(from, to) {
4746  AnimationTransitionBase.prototype.Start.call(this, from, to);
4747  this.startTimerId = window.setTimeout(function() {
4748   if(this.from == this.to)
4749    this.onTransitionEnd();
4750   else {
4751    var isHidden = this.element.offsetHeight == 0 && this.element.offsetWidth == 0; 
4752    if(!isHidden)
4753     this.prepareElementBeforeAnimation();
4754    this.SetValue(this.to);
4755    if(isHidden)
4756     this.onTransitionEnd();
4757   }
4758  }.aspxBind(this), 0);
4759 },
4760 Cancel: function() {
4761  window.clearTimeout(this.startTimerId);
4762  AnimationTransitionBase.prototype.Cancel.call(this);
4763  ASPx.Evt.DetachEventFromElement(this.element, this.eventName, CssAnimationTransition.transitionEnd);
4764  this.setValueInternal(this.element, this.transitionPropertyName, "", "");
4765  this.stopAnimation();
4766 },
4767 prepareElementBeforeAnimation: function() {
4768  ASPx.Evt.AttachEventToElement(this.element, this.eventName, CssAnimationTransition.transitionEnd);
4769  var dummy = this.element.offsetHeight;
4770  this.element.style[this.transitionPropertyName] = this.getTransitionCssString();
4771  if(ASPx.Browser.Safari && ASPx.Browser.MacOSMobilePlatform && ASPx.Browser.MajorVersion >= 8) 
4772   setTimeout(function() {
4773    if(this.element && this.element.aspxTransition) {
4774     this.element.style[this.transitionPropertyName] = "";
4775     this.element.aspxTransition.onTransitionEnd();
4776    }
4777   }.aspxBind(this), this.duration + 100);
4778 },
4779 stopAnimation: function() {
4780  this.SetValue(ASPx.GetCurrentStyle(this.element)[this.property]);
4781 },
4782 onTransitionEnd: function() {
4783  this.Cancel();
4784  this.performOnComplete();
4785 },
4786 getTransition: function() {
4787  return this.transition.Css;
4788 },
4789 getTransitionCssString: function() {
4790  return this.getTransitionCssStringInternal(this.getCssName(this.property));
4791 },
4792 getTransitionCssStringInternal: function(cssProperty) {
4793  return cssProperty + " " + this.duration + "ms " + this.getTransition();
4794 },
4795 getCssName: function(property) {
4796  switch(property) {
4797   case "marginLeft":
4798    return "margin-left";
4799   case "marginTop":
4800    return "margin-top";
4801  }
4802  return property;
4803 }
4804});
4805var MultipleCssAnimationTransition = ASPx.CreateClass(CssAnimationTransition, {
4806 constructor: function(element, options) {
4807  this.constructor.prototype.constructor.call(this, element, options);
4808  this.properties = null;
4809 },
4810 Start: function(properties) {
4811  this.properties = properties;
4812  this.forEachProperties(function(property, propName) {
4813   if(property.from !== undefined)
4814    this.setValueInternal(this.element, propName, property.unit, property.from);
4815  }.aspxBind(this));
4816  this.prepareElementBeforeAnimation();
4817  window.setTimeout(function() {
4818   this.forEachProperties(function(property, propName) {
4819    this.setValueInternal(this.element, propName, property.unit, property.to);
4820   }.aspxBind(this));
4821  }.aspxBind(this), 0);
4822 },
4823 stopAnimation: function() {
4824  var style = ASPx.GetCurrentStyle(this.element);
4825  this.forEachProperties(function(property, propName) {
4826   this.setValueInternal(this.element, propName, "", style[propName]);
4827  }.aspxBind(this));
4828 },
4829 getTransitionCssString: function() {
4830  var str = "";
4831  this.forEachProperties(function(property, propName) {
4832   str += this.getTransitionCssStringInternal(this.getCssName(propName)) + ",";
4833  }.aspxBind(this));
4834  str = str.substring(0, str.length - 1);
4835  return str;
4836 },
4837 forEachProperties: function(func) {
4838  for(var propName in this.properties) {
4839   if(this.properties.hasOwnProperty(propName)) {
4840    var property = this.properties[propName];
4841    if(property.from == undefined)
4842     property.from = this.getValueInternal(this.element, propName);
4843    if(property.from != property.to)
4844     func(property, propName);
4845   }
4846  }
4847 }
4848});
4849CssAnimationTransition.transitionEnd = function(evt) {
4850 var element = evt.target;
4851 if(element && element.aspxTransition)
4852  element.aspxTransition.onTransitionEnd();
4853};
4854var AnimationUtils = {
4855 CanUseCssTransition: function() { return ASPx.EnableCssAnimation && this.CurrentTransition; },
4856 CanUseCssTransform: function() { return this.CanUseCssTransition() && this.CurrentTransform; },
4857 CurrentTransition: (function() {
4858  if(ASPx.Browser.IE) 
4859   return null;
4860  var transitions = [
4861   { property: "webkitTransition", event: "webkitTransitionEnd" },
4862   { property: "MozTransition", event: "transitionend" },
4863   { property: "OTransition", event: "oTransitionEnd" },
4864   { property: "transition", event: "transitionend" }
4865  ];
4866  var fakeElement = document.createElement("DIV");
4867  for(var i = 0; i < transitions.length; i++)
4868   if(transitions[i].property in fakeElement.style)
4869    return transitions[i];
4870 })(),
4871 CurrentTransform: (function() {
4872  var transforms = ["transform", "MozTransform", "-webkit-transform", "msTransform", "OTransform"];
4873  var fakeElement = document.createElement("DIV");
4874  for(var i = 0; i < transforms.length; i++)
4875   if(transforms[i] in fakeElement.style)
4876    return transforms[i];
4877 })(),
4878 SetTransformValue: function(element, position, isTop) {
4879  if(this.CanUseCssTransform())
4880   element.style[this.CurrentTransform] = this.GetTransformCssText(position, isTop);
4881  else
4882   element.style[!isTop ? "left" : "top"] = position + "px";
4883 },
4884 GetTransformValue: function(element, isTop) {
4885  if(this.CanUseCssTransform()) {
4886   var cssValue = element.style[this.CurrentTransform];
4887   return cssValue && cssValue != "none" ? Number(cssValue.replace('matrix(1, 0, 0, 1,', '').replace(')', '').split(',')[!isTop ? 0 : 1]) : 0;
4888  }
4889  else
4890   return !isTop ? element.offsetLeft : element.offsetTop;
4891 },
4892 GetTransformCssText: function(position, isTop) {
4893  if(!position)
4894   return "none";
4895  return "matrix(1, 0, 0, 1," + (!isTop ? position : 0) + ", " + (!isTop ? 0 : position) + ")";
4896 },
4897 createMultipleAnimationTransition: function (element, options) {
4898  return this.CanUseCssTransition() && !options.onStep ? new MultipleCssAnimationTransition(element, options) : new MultipleJsAnimationTransition(element, options);
4899 },
4900 createSimpleAnimationTransition: function(options) {
4901  return new SimpleAnimationTransition(options);
4902 },
4903 createJsAnimationTransition: function(element, options) {
4904  return new JsAnimationTransition(element, options);
4905 },
4906 createCssAnimationTransition: function(element, options) {
4907  return new CssAnimationTransition(element, options);
4908 },
4909 setOpacity: function(element, value) {
4910  ASPx.SetElementOpacity(element, value);
4911 }
4912};
4913var AsyncTracker = function() {
4914 var currentToken,
4915  lockedTokens,
4916  onDoneDelegates,
4917  lockedDelegates;
4918 function clearState() {
4919  currentToken = 1;
4920  lockedTokens = [];
4921  onDoneDelegates = [];
4922  lockedDelegates = {};
4923 }
4924 clearState();
4925 var log = function(msg) { };
4926 function setLog(delegate){
4927  log = delegate;
4928 }
4929 function getLockToken() {
4930  if(onDoneDelegates.length === 0)
4931   return -1;
4932  var token = currentToken++;
4933  lockedTokens.push(token);
4934  lockedDelegates[token] = [];
4935  for (var i = 0; i < onDoneDelegates.length; i++) {
4936   lockedDelegates[token].push(onDoneDelegates[i]);
4937  }
4938  log("module locks token " + token);
4939  return token;
4940 }
4941 function releaseToken(token) {
4942  if(token < 0) return;
4943  log("module releasing token " + token);
4944  ASPx.Data.ArrayRemove(lockedTokens, token);
4945  delete lockedDelegates[token];
4946  invokeUnlockedDelegates();
4947  if(lockedTokens.length === 0)
4948   clearState();
4949  log("module released token " + token);
4950 }
4951 function invokeUnlockedDelegates() {
4952  var onDoneDelegate;
4953  for (var i = onDoneDelegates.length - 1; i >= 0; i--) {
4954   if(onDoneDelegates[i] && !isDelegateLocked(onDoneDelegates[i])) {
4955    onDoneDelegate = onDoneDelegates[i];
4956    delete onDoneDelegates[i];
4957    onDoneDelegate();
4958   }
4959  }
4960 }
4961 function isDelegateLocked(delegate) {
4962  for (var i = lockedTokens.length - 1; i >= 0; i--) {
4963   var token = lockedTokens[i];
4964   var delegates = lockedDelegates[token];
4965   if(delegates) {
4966    for (var j = delegates.length - 1; j >= 0; j--) {
4967     if(delegates[j] && delegates[j] === delegate)
4968      return true;
4969    }
4970   }
4971  }
4972  return false;
4973 }
4974 function track(doDelegate, onDoneDelegate) {
4975  if(onDoneDelegate)
4976   onDoneDelegates.push(onDoneDelegate);
4977  doDelegate();
4978  if(onDoneDelegate)
4979   invokeUnlockedDelegates();
4980 }
4981 return {
4982  getLockToken: getLockToken,
4983  releaseToken: releaseToken,
4984  track: track,
4985  setLog:setLog,
4986 };
4987};
4988var GetEditorValuesInContainer = function(containerOrId, processInvisibleEditors, needSerialize) {
4989 var container = typeof(containerOrId) === "string" ? ASPx.GetElementById(containerOrId) : containerOrId;
4990 var result = {};
4991 ASPx.ProcessEditorsInContainer(container, function(editor){
4992  result[editor.name] = GetCorrectedByTypeValue(ASPx.GetEditorValueByControl(editor), needSerialize);
4993 }, null, null, processInvisibleEditors, false);
4994 return result;
4995};
4996var GetCorrectedByTypeValue = function(value, needSerialize){
4997 if(ASPx.Ident.IsArray(value))
4998  for(var i = 0; i < value.length; i++)
4999   value[i] = GetCorrectedByTypeValue(value[i]);
5000 if(needSerialize && ASPx.Ident.IsDate(value))
5001  return ASPx.DateUtils.GetInvariantDateTimeString(value);
5002 return value;
5003};
5004ASPx.GetEditorValueByControl = function(control, needSerialize) {
5005 var result;
5006 if(ASPx.IsMultipleValueOwner(control))
5007  result = control.GetSelectedValues();
5008 if(ASPx.IsTokenBox(control)) {
5009  if(needSerialize)
5010   result = control.GetTokenValuesCollection();
5011  else
5012   result = control.GetTokenCollection();
5013 }
5014 return result || control.GetValue();
5015};
5016ASPx.IsMultipleValueOwner = function(control) {
5017 return ASPx.IsListBox(control) || ASPx.IsCheckBoxList(control);
5018};
5019ASPx.IsCheckBoxList = function(control) {
5020 return control && typeof(ASPxClientCheckBoxList) != "undefined" && control instanceof ASPxClientCheckBoxList;
5021};
5022ASPx.IsListBox = function(control) {
5023 return control && typeof(ASPxClientListBox) != "undefined" && control instanceof ASPxClientListBox;
5024};
5025ASPx.IsComboBox = function(control) {
5026 return control && typeof(ASPxClientComboBox) != "undefined" && control instanceof ASPxClientComboBox;
5027};
5028ASPx.IsTokenBox = function(control) {
5029 return control && typeof(ASPxClientTokenBox) != "undefined" && control instanceof ASPxClientTokenBox;
5030};
5031ASPx.IsGridLookup = function(control) {
5032 return control && typeof(MVCxClientGridLookup) != "undefined" && control instanceof MVCxClientGridLookup;
5033};
5034ASPx.IsSpinEdit = function(control) {
5035 return control && typeof(ASPxClientSpinEdit) != "undefined" && control instanceof ASPxClientSpinEdit;
5036};
5037ASPxClientUtils = {};
5038ASPxClientUtils.agent = Browser.UserAgent;
5039ASPxClientUtils.opera = Browser.Opera;
5040ASPxClientUtils.opera9 = Browser.Opera && Browser.MajorVersion == 9;
5041ASPxClientUtils.safari = Browser.Safari;
5042ASPxClientUtils.safari3 = Browser.Safari && Browser.MajorVersion == 3;
5043ASPxClientUtils.safariMacOS = Browser.Safari && Browser.MacOSPlatform;
5044ASPxClientUtils.chrome = Browser.Chrome;
5045ASPxClientUtils.ie = Browser.IE;
5046ASPxClientUtils.ie7 = Browser.IE && Browser.MajorVersion == 7;
5047ASPxClientUtils.firefox = Browser.Firefox;
5048ASPxClientUtils.firefox3 = Browser.Firefox && Browser.MajorVersion == 3;
5049ASPxClientUtils.mozilla = Browser.Mozilla;
5050ASPxClientUtils.netscape = Browser.Netscape;
5051ASPxClientUtils.browserVersion = Browser.Version;
5052ASPxClientUtils.browserMajorVersion = Browser.MajorVersion;
5053ASPxClientUtils.macOSPlatform = Browser.MacOSPlatform;
5054ASPxClientUtils.windowsPlatform = Browser.WindowsPlatform;
5055ASPxClientUtils.webKitFamily = Browser.WebKitFamily;
5056ASPxClientUtils.netscapeFamily = Browser.NetscapeFamily;
5057ASPxClientUtils.touchUI = Browser.TouchUI;
5058ASPxClientUtils.webKitTouchUI = Browser.WebKitTouchUI;
5059ASPxClientUtils.msTouchUI = Browser.MSTouchUI;
5060ASPxClientUtils.iOSPlatform = Browser.MacOSMobilePlatform;
5061ASPxClientUtils.androidPlatform = Browser.AndroidMobilePlatform;
5062ASPxClientUtils.ArrayInsert = Data.ArrayInsert;
5063ASPxClientUtils.ArrayRemove = Data.ArrayRemove;
5064ASPxClientUtils.ArrayRemoveAt = Data.ArrayRemoveAt;
5065ASPxClientUtils.ArrayClear = Data.ArrayClear;
5066ASPxClientUtils.ArrayIndexOf = Data.ArrayIndexOf;
5067ASPxClientUtils.AttachEventToElement = Evt.AttachEventToElement;
5068ASPxClientUtils.DetachEventFromElement = Evt.DetachEventFromElement;
5069ASPxClientUtils.GetEventSource = Evt.GetEventSource;
5070ASPxClientUtils.GetEventX = Evt.GetEventX;
5071ASPxClientUtils.GetEventY = Evt.GetEventY;
5072ASPxClientUtils.GetKeyCode = Evt.GetKeyCode;
5073ASPxClientUtils.PreventEvent = Evt.PreventEvent;
5074ASPxClientUtils.PreventEventAndBubble = Evt.PreventEventAndBubble;
5075ASPxClientUtils.PreventDragStart = Evt.PreventDragStart;
5076ASPxClientUtils.ClearSelection = Selection.Clear;
5077ASPxClientUtils.IsExists = ASPx.IsExists;
5078ASPxClientUtils.IsFunction = ASPx.IsFunction;
5079ASPxClientUtils.GetAbsoluteX = ASPx.GetAbsoluteX;
5080ASPxClientUtils.GetAbsoluteY = ASPx.GetAbsoluteY;
5081ASPxClientUtils.SetAbsoluteX = ASPx.SetAbsoluteX;
5082ASPxClientUtils.SetAbsoluteY = ASPx.SetAbsoluteY;
5083ASPxClientUtils.GetDocumentScrollTop = ASPx.GetDocumentScrollTop;
5084ASPxClientUtils.GetDocumentScrollLeft = ASPx.GetDocumentScrollLeft;
5085ASPxClientUtils.GetDocumentClientWidth = ASPx.GetDocumentClientWidth;
5086ASPxClientUtils.GetDocumentClientHeight = ASPx.GetDocumentClientHeight;
5087ASPxClientUtils.GetIsParent = ASPx.GetIsParent;
5088ASPxClientUtils.GetParentById = ASPx.GetParentById;
5089ASPxClientUtils.GetParentByTagName = ASPx.GetParentByTagName;
5090ASPxClientUtils.GetParentByClassName = ASPx.GetParentByPartialClassName;
5091ASPxClientUtils.GetChildById = ASPx.GetChildById;
5092ASPxClientUtils.GetChildByTagName = ASPx.GetChildByTagName;
5093ASPxClientUtils.SetCookie = Cookie.SetCookie;
5094ASPxClientUtils.GetCookie = Cookie.GetCookie;
5095ASPxClientUtils.DeleteCookie = Cookie.DelCookie;
5096ASPxClientUtils.GetShortcutCode = ASPx.GetShortcutCode; 
5097ASPxClientUtils.GetShortcutCodeByEvent = ASPx.GetShortcutCodeByEvent;
5098ASPxClientUtils.StringToShortcutCode = ASPx.ParseShortcutString;
5099ASPxClientUtils.Trim = Str.Trim; 
5100ASPxClientUtils.TrimStart = Str.TrimStart;
5101ASPxClientUtils.TrimEnd = Str.TrimEnd;
5102ASPxClientUtils.GetEditorValuesInContainer = GetEditorValuesInContainer;
5103ASPxClientUtils.SendMessageToAssistiveTechnology = ASPx.AccessibilityUtils.SendMessageToAssistiveTechnology;
5104window.ASPxClientUtils = ASPxClientUtils;
5105ASPx.AnimationUtils = AnimationUtils;
5106ASPx.AnimationTransitionBase = AnimationTransitionBase;
5107ASPx.AnimationConstants = AnimationConstants;
5108ASPx.AsyncTracker = AsyncTracker;
5109})();
5110
5111(function () {
5112ASPx.classesScriptParsed = false;
5113ASPx.documentLoaded = false; 
5114ASPx.CallbackType = {
5115 Data: "d",
5116 Common: "c"
5117};
5118ASPx.callbackState = {
5119 aborted: "aborted",
5120 inTurn: "inTurn",
5121 sent: "sent"
5122};
5123var ASPxClientEvent = ASPx.CreateClass(null, {
5124 constructor: function() {
5125  this.handlerInfoList = [];
5126  this.firingIndex = -1;
5127 },
5128 AddHandler: function(handler, executionContext) {
5129  if(typeof(executionContext) == "undefined")
5130   executionContext = null;
5131  this.RemoveHandler(handler, executionContext);
5132  var handlerInfo = ASPxClientEvent.CreateHandlerInfo(handler, executionContext);
5133  this.handlerInfoList.push(handlerInfo);
5134 },
5135 RemoveHandler: function(handler, executionContext) {
5136  this.removeHandlerByCondition(function(handlerInfo) {
5137   return handlerInfo.handler == handler && 
5138    (!executionContext || handlerInfo.executionContext == executionContext);
5139  });
5140 },
5141 removeHandlerByCondition: function(predicate) {
5142   for(var i = this.handlerInfoList.length - 1; i >= 0; i--) {
5143   var handlerInfo = this.handlerInfoList[i];
5144   if(predicate(handlerInfo)) {
5145    ASPx.Data.ArrayRemoveAt(this.handlerInfoList, i);
5146    if(i <= this.firingIndex)
5147     this.firingIndex--;
5148   }
5149  }
5150 },
5151 removeHandlerByControlName: function(controlName) {
5152  this.removeHandlerByCondition(function(handlerInfo) {
5153   return handlerInfo.executionContext &&  
5154    handlerInfo.executionContext.name === controlName;
5155  });
5156 },
5157 ClearHandlers: function() {
5158  this.handlerInfoList.length = 0;
5159 },
5160 FireEvent: function(obj, args) {
5161  for(this.firingIndex = 0; this.firingIndex < this.handlerInfoList.length; this.firingIndex++) {
5162   var handlerInfo = this.handlerInfoList[this.firingIndex];
5163   handlerInfo.handler.call(handlerInfo.executionContext, obj, args);
5164  }
5165 },
5166 InsertFirstHandler: function(handler, executionContext){
5167  if(typeof(executionContext) == "undefined")
5168   executionContext = null;
5169  var handlerInfo = ASPxClientEvent.CreateHandlerInfo(handler, executionContext);
5170  ASPx.Data.ArrayInsert(this.handlerInfoList, handlerInfo, 0);
5171 },
5172 IsEmpty: function() {
5173  return this.handlerInfoList.length == 0;
5174 }
5175});
5176ASPxClientEvent.CreateHandlerInfo = function(handler, executionContext) {
5177 return {
5178  handler: handler,
5179  executionContext: executionContext
5180 };
5181};
5182var ASPxClientEventArgs = ASPx.CreateClass(null, {
5183 constructor: function() {
5184 }
5185});
5186ASPxClientEventArgs.Empty = new ASPxClientEventArgs();
5187var ASPxClientCancelEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
5188 constructor: function(){
5189  this.constructor.prototype.constructor.call(this);
5190  this.cancel = false;
5191 }
5192});
5193var ASPxClientProcessingModeEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
5194 constructor: function(processOnServer){
5195  this.constructor.prototype.constructor.call(this);
5196  this.processOnServer = !!processOnServer;
5197 }
5198});
5199var ASPxClientProcessingModeCancelEventArgs = ASPx.CreateClass(ASPxClientProcessingModeEventArgs, {
5200 constructor: function(processOnServer){
5201  this.constructor.prototype.constructor.call(this, processOnServer);
5202  this.cancel = false;
5203 }
5204});
5205var OrderedMap = ASPx.CreateClass(null, {
5206 constructor: function(){
5207  this.entries = {};
5208  this.firstEntry = null;
5209  this.lastEntry = null;
5210 },
5211 add: function(key, element) {
5212  var entry = this.addEntry(key, element);
5213  this.entries[key] = entry;
5214 },
5215 remove: function(key) {
5216  var entry = this.entries[key];
5217  if(entry === undefined)
5218   return;
5219  this.removeEntry(entry);
5220  delete this.entries[key];
5221 },
5222 clear: function() {
5223  this.markAllEntriesAsRemoved();
5224  this.entries = {};
5225  this.firstEntry = null;
5226  this.lastEntry = null;
5227 },
5228 get: function(key) {
5229  var entry = this.entries[key];
5230  return entry ? entry.value : undefined;
5231 },
5232 forEachEntry: function(processFunc, context) {
5233  context = context || this;
5234  for(var entry = this.firstEntry; entry; entry = entry.next) {
5235   if(entry.removed)
5236    continue;
5237   if(processFunc.call(context, entry.key, entry.value))
5238    return;
5239  }
5240 },
5241 addEntry: function(key, element) {
5242  var entry = { key: key, value: element, next: null, prev: null };
5243  if(!this.firstEntry)
5244   this.firstEntry = entry;
5245  else {
5246   entry.prev = this.lastEntry;
5247   this.lastEntry.next = entry;
5248  }
5249  this.lastEntry = entry;
5250  return entry;
5251 },
5252 removeEntry: function(entry) {
5253  if(this.firstEntry == entry)
5254   this.firstEntry = entry.next;
5255  if(this.lastEntry == entry)
5256   this.lastEntry = entry.prev;
5257  if(entry.prev)
5258   entry.prev.next = entry.next;
5259  if(entry.next)
5260   entry.next.prev = entry.prev;
5261  entry.removed = true;
5262 },
5263 markAllEntriesAsRemoved: function() {
5264  for(var entry = this.firstEntry; entry; entry = entry.next)
5265   entry.removed = true;
5266 }
5267});
5268var CollectionBase = ASPx.CreateClass(null, {
5269 constructor: function(){
5270  this.elementsMap = new OrderedMap();
5271  this.isASPxClientCollection = true;
5272 },
5273 Add: function(key, element) {
5274  this.elementsMap.add(key, element);
5275 },
5276 Remove: function(key) {
5277  this.elementsMap.remove(key);
5278 },
5279 Clear: function(){
5280  this.elementsMap.clear();
5281 },
5282 Get: function(key){
5283  return this.elementsMap.get(key);
5284 }
5285});
5286var GarbageCollector = ASPx.CreateClass(null, {
5287 constructor: function() {
5288  this.interval = 5000;
5289  this.intervalID = window.setInterval(function(){ this.CollectObjects(); }.aspxBind(this), this.interval);
5290 },
5291 CollectObjects: function(){
5292  if(ASPx.GetControlCollection().InCallback()) return;
5293  ASPx.GetControlCollectionCollection().RemoveDisposedControls();
5294  if(typeof(ASPx.GetStateController) != "undefined")
5295   ASPx.GetStateController().RemoveDisposedItems();
5296  if(ASPx.TableScrollHelperCollection)
5297   ASPx.TableScrollHelperCollection.RemoveDisposedObjects();
5298  if(ASPx.Ident.scripts.ASPxClientRatingControl)
5299   ASPxClientRatingControl.RemoveDisposedElementUnderCursor();
5300  var postHandler = aspxGetPostHandler();
5301  if(postHandler)
5302   postHandler.RemoveDisposedFormsFromCache();
5303 }
5304});
5305var dummyGcCollector = new GarbageCollector(); 
5306var ControlTree = ASPx.CreateClass(null, {
5307 constructor: function(controlCollection, container) {
5308  this.container = container;
5309  this.domMap = { };
5310  this.rootNode = this.createNode(null, null);
5311  this.createControlTree(controlCollection, container);
5312 },
5313 forEachControl: function(collapseControls, processFunc) {
5314  var observer = _aspxGetDomObserver();
5315  observer.pause(this.container, true);
5316  var documentScrollInfo;
5317  if(collapseControls) {
5318   documentScrollInfo = ASPx.GetOuterScrollPosition(document.body);
5319   this.collapseControls(this.rootNode);
5320  }
5321  var adjustNodes = [], 
5322   autoHeightNodes = [];
5323  var requireReAdjust = this.forEachControlCore(this.rootNode, collapseControls, processFunc, adju
5323stNodes, autoHeightNodes);
5324  if(requireReAdjust)
5325   this.forEachControlsBackward(adjustNodes, collapseControls, processFunc);
5326  else {
5327   for(var i = 0, node; node = autoHeightNodes[i]; i++)
5328    node.control.AdjustAutoHeight();
5329  }
5330  if(collapseControls)
5331   ASPx.RestoreOuterScrollPosition(documentScrollInfo);
5332  observer.resume(this.container, true);
5333 },
5334 forEachControlCore: function(node, collapseControls, processFunc, adjustNodes, autoHeightNodes) {
5335  var requireReAdjust = false,
5336   size, newSize;
5337  if(node.control) {
5338   var checkReadjustment = collapseControls && node.control.IsControlCollapsed() && node.control.CanCauseReadjustment();
5339   if(checkReadjustment)
5340    size = node.control.GetControlPercentMarkerSize(false, true);
5341   if(node.control.IsControlCollapsed() && !node.control.IsExpandableByAdjustment())
5342    node.control.ExpandControl();
5343   node.control.isInsideHierarchyAdjustment = true;
5344   processFunc(node.control);
5345   node.control.isInsideHierarchyAdjustment = false;
5346   if(checkReadjustment) {
5347    newSize = node.control.GetControlPercentMarkerSize(false, true);
5348    requireReAdjust = size.width !== newSize.width;
5349   }
5350   if(node.control.sizingConfig.supportAutoHeight)
5351    autoHeightNodes.push(node);
5352   node.control.ResetControlPercentMarkerSize();
5353  }
5354  for(var childNode, i = 0; childNode = node.children[i]; i++)
5355   requireReAdjust = this.forEachControlCore(childNode, collapseControls, processFunc, adju
5355stNodes, autoHeightNodes) || requireReAdjust;
5356  adjustNodes.push(node);
5357  return requireReAdjust;
5358 },
5359 forEachControlsBackward: function(adjustNodes, collapseControls, processFunc) {
5360  for(var i = 0, node; node = adjustNodes[i]; i++)
5361   this.forEachControlsBackwardCore(node, collapseControls, processFunc);
5362 },
5363 forEachControlsBackwardCore: function(node, collapseControls, processFunc) {
5364  if(node.control)
5365   processFunc(node.control);
5366  if(node.children.length > 1) {
5367   for(var i = 0, childNode; childNode = node.children[i]; i++) {
5368    if(childNode.control)
5369     processFunc(childNode.control);
5370   }
5371  }
5372 },
5373 collapseControls: function(node) {
5374  for(var childNode, i = 0; childNode = node.children[i]; i++)
5375   this.collapseControls(childNode);
5376  if(node.control && node.control.NeedCollapseControl())
5377   node.control.CollapseControl();
5378 },
5379 createControlTree: function(controlCollection, container) {
5380  controlCollection.ProcessControlsInContainer(container, function(control) {
5381   control.RegisterInControlTree(this);
5382  }.aspxBind(this));
5383  var fixedNodes = [];
5384  var fixedNodesChildren = [];
5385  for(var domElementID in this.domMap) {
5386   if(!this.domMap.hasOwnProperty(domElementID)) continue;
5387   var node = this.domMap[domElementID];
5388   var controlOwner = node.control ? node.control.controlOwner : null;
5389   if(controlOwner && this.domMap[controlOwner.name])
5390    continue;
5391   if(this.isFixedNode(node))
5392    fixedNodes.push(node);
5393   else {
5394    var parentNode = this.findParentNode(domElementID);
5395    parentNode = parentNode || this.rootNode;
5396    if(this.isFixedNode(parentNode))
5397     fixedNodesChildren.push(node);
5398    else {
5399     var childNode = node.mainNode || node;
5400     this.addChildNode(parentNode, childNode);
5401    }
5402   }
5403  }
5404  for(var i = fixedNodes.length - 1; i >= 0; i--)
5405   this.insertChildNode(this.rootNode, fixedNodes[i], 0);
5406  for(var i = fixedNodesChildren.length - 1; i >= 0; i--)
5407   this.insertChildNode(this.rootNode, fixedNodesChildren[i], 0);
5408 },
5409 findParentNode: function(id) {
5410  var element = document.getElementById(id).parentNode;
5411  while(element && element.tagName !== "BODY") {
5412   if(element.id) {
5413    var parentNode = this.domMap[element.id];
5414    if(parentNode)
5415     return parentNode;
5416   }
5417   element = element.parentNode;
5418  }
5419  return null;
5420 },
5421 addChildNode: function(node, childNode) {
5422  if(!childNode.parentNode) {
5423   node.children.push(childNode);
5424   childNode.parentNode = node;
5425  }
5426 },
5427 insertChildNode: function(node, childNode, index) {
5428  if(!childNode.parentNode) {
5429   ASPx.Data.ArrayInsert(node.children, childNode, index);
5430   childNode.parentNode = node;
5431  }
5432 },
5433 addRelatedNode: function(node, relatedNode) {
5434  this.addChildNode(node, relatedNode);
5435  relatedNode.mainNode = node;
5436 },
5437 isFixedNode: function(node) {
5438  var control = node.mainNode ? node.mainNode.control : node.control;
5439  return control && control.HasFixedPosition();
5440 },
5441 createNode: function(domElementID, control) {
5442  var node = {
5443   control: control,
5444   children: [],
5445   parentNode: null,
5446   mainNode: null
5447  };
5448  if(domElementID)
5449   this.domMap[domElementID] = node;
5450  return node;
5451 }
5452});
5453function _aspxFunctionIsInCallstack(currentCallee, targetFunction, depthLimit) {
5454 var candidate = currentCallee;
5455 var depth = 0;
5456 while(candidate && depth <= depthLimit) {
5457  candidate = candidate.caller;
5458  if(candidate == targetFunction)
5459   return true;
5460  depth++;
5461 }
5462 return false;
5463}
5464ASPx.Evt.AttachEventToElement(window, "load", aspxClassesWindowOnLoad);
5465function aspxClassesWindowOnLoad(evt){
5466 ASPx.documentLoaded = true;
5467 _aspxSweepDuplicatedLinks();
5468 ResourceManager.SynchronizeResources();
5469 var externalScriptProcessor = GetExternalScriptProcessor();
5470 if(externalScriptProcessor)
5471  externalScriptProcessor.ShowErrorMessages();
5472 ASPx.AccessibilityUtils.initialize();
5473 ASPx.GetControlCollection().Initialize();
5474 _aspxInitializeScripts();
5475 _aspxInitializeLinks();
5476 _aspxInitializeFocus();
5477}
5478Ident = { };
5479Ident.IsDate = function(obj) {
5480 return obj && obj.constructor == Date;
5481};
5482Ident.IsRegExp = function(obj) {
5483 return obj && obj.constructor === RegExp;
5484};
5485Ident.IsArray = function(obj) {
5486 return obj && obj.constructor == Array;
5487};
5488Ident.IsASPxClientCollection = function(obj) {
5489 return obj && obj.isASPxClientCollection;
5490};
5491Ident.IsASPxClientControl = function(obj) {
5492 return obj && obj instanceof ASPxClientControlBase;
5493};
5494Ident.IsASPxClientEdit = function(obj) {
5495 return obj && obj.isASPxClientEdit;
5496};
5497Ident.IsFocusableElementRegardlessTabIndex = function (element) {
5498 var tagName = element.tagName;
5499 return tagName == "TEXTAREA" || tagName == "INPUT" || tagName == "A" || 
5500  tagName == "SELECT" || tagName == "IFRAME" || tagName == "OBJECT";
5501};
5502Ident.isDialogInvisibleControl = function(control) {
5503 return !!ASPx.Dialog && ASPx.Dialog.isDialogInvisibleControl(control);
5504};
5505Ident.scripts = {};
5506if(ASPx.IsFunction(window.WebForm_InitCallbackAddField)) {
5507 (function() {
5508  var original = window.WebForm_InitCallbackAddField;
5509  window.WebForm_InitCallbackAddField = function(name, value) {
5510   if(typeof(name) == "string" && name)
5511    original.apply(null, arguments);
5512  };
5513 })();
5514}
5515ASPx.FireDefaultButton = function(evt, buttonID) {
5516 if(_aspxIsDefaultButtonEvent(evt, buttonID)) {
5517  var defaultButton = ASPx.GetElementById(buttonID);
5518  if(defaultButton && defaultButton.click) {
5519   if(ASPx.IsFocusable(defaultButton))
5520    defaultButton.focus();
5521   ASPx.Evt.DoElementClick(defaultButton);
5522   ASPx.Evt.PreventEventAndBubble(evt);
5523   return false;
5524  }
5525 }
5526 return true;
5527};
5528function _aspxIsDefaultButtonEvent(evt, defaultButtonID) {
5529 if(evt.keyCode != ASPx.Key.Enter)
5530  return false;
5531 var srcElement = ASPx.Evt.GetEventSource(evt);
5532 if(!srcElement || srcElement.id === defaultButtonID)
5533  return true;
5534 var tagName = srcElement.tagName;
5535 var type = srcElement.type;
5536 return tagName != "TEXTAREA" && tagName != "BUTTON" && tagName != "A" &&
5537  (tagName != "INPUT" || type != "checkbox" && type != "radio" && type != "button" && type != "submit" && type != "reset");
5538}
5539var PostHandler = ASPx.CreateClass(null, {
5540 constructor: function() {
5541  this.Post = new ASPxClientEvent();
5542  this.PostFinalization = new ASPxClientEvent();
5543  this.observableForms = [];
5544  this.dxCallbackTriggers = {};
5545  this.lastSubmitElementName = null;
5546  this.beforeOnSubmit = function() { };
5547  this.ReplaceGlobalPostFunctions();
5548  this.HandleDxCallbackBeginning();
5549  this.HandleMSAjaxRequestBeginning();
5550 },
5551 Update: function() {
5552  this.ReplaceFormsSubmit(true);
5553 },
5554 ProcessPostRequest: function(ownerID, isCallback, isMSAjaxRequest, isDXCallback) {
5555  this.cancelPostProcessing = false;
5556  this.isMSAjaxRequest = isMSAjaxRequest;
5557  if(this.SkipRaiseOnPost(ownerID, isCallback, isDXCallback))
5558   return;
5559  var args = new PostHandlerOnPostEventArgs(ownerID, isCallback, isMSAjaxRequest, isDXCallback);
5560  this.Post.FireEvent(this, args);
5561  this.cancelPostProcessing = args.cancel;
5562  if(!args.cancel)
5563   this.PostFinalization.FireEvent(this, args);
5564 },
5565 SkipRaiseOnPost: function(ownerID, isCallback, isDXCallback) { 
5566  if(!isCallback)
5567   return false;
5568  var dxOwner = isDXCallback && ASPx.GetControlCollection().GetByName(ownerID);
5569  if(dxOwner) {
5570   this.dxCallbackTriggers[dxOwner.uniqueID] = true;
5571   return false;
5572  }
5573  if(this.dxCallbackTriggers[ownerID]) {
5574   this.dxCallbackTriggers[ownerID] = false;
5575   return true;
5576  }
5577  return false;
5578 },
5579 ReplaceGlobalPostFunctions: function() {
5580  if(ASPx.IsFunction(window.__doPostBack))
5581   this.ReplaceDoPostBack();
5582  if(ASPx.IsFunction(window.WebForm_DoCallback))
5583   this.ReplaceDoCallback();
5584  this.ReplaceFormsSubmit();
5585 },
5586 HandleDxCallbackBeginning: function() {
5587  ASPx.GetControlCollection().BeforeInitCallback.AddHandler(function(s, e) {
5588   aspxRaisePostHandlerOnPost(e.callbackOwnerID, true, false, true); 
5589  });
5590 },
5591 HandleMSAjaxRequestBeginning: function() {
5592  var pageRequestManager = ASPx.GetMSAjaxRequestManager();
5593  if(pageRequestManager != null && Ident.IsArray(pageRequestManager._onSubmitStatements)) {
5594   pageRequestManager._onSubmitStatements.unshift(function() {
5595    var postbackSettings = Sys.WebForms.PageRequestManager.getInstance()._postBackSettings;
5596    var postHandler = aspxGetPostHandler();
5597    aspxRaisePostHandlerOnPost(postbackSettings.asyncTarget, true, true);
5598    return !postHandler.cancelPostProcessing;
5599   });
5600  }
5601 },
5602 ReplaceDoPostBack: function() {
5603  var original = __doPostBack;
5604  __doPostBack = function(eventTarget, eventArgument) {
5605   var postHandler = aspxGetPostHandler();
5606   aspxRaisePostHandlerOnPost(eventTarget);
5607   if(postHandler.cancelPostProcessing)
5608    return;
5609   ASPxClientControl.postHandlingLocked = true;
5610   original(eventTarget, eventArgument);
5611   delete ASPxClientControl.postHandlingLocked;
5612  };
5613 },
5614 ReplaceDoCallback: function() {
5615  var original = WebForm_DoCallback;
5616  WebForm_DoCallback = function(eventTarget, eventArgument, eventCallback, context, errorCallback, useAsync) {
5617   var postHandler = aspxGetPostHandler();
5618   aspxRaisePostHandlerOnPost(eventTarget, true);
5619   if(postHandler.cancelPostProcessing)
5620    return;
5621   return original(eventTarget, eventArgument, eventCallback, context, errorCallback, useAsync);
5622  };
5623 },
5624 ReplaceFormsSubmit: function(checkObservableCollection) {
5625  for(var i = 0; i < document.forms.length; i++) { 
5626   var form = document.forms[i];
5627   if(checkObservableCollection && ASPx.Data.ArrayIndexOf(this.observableForms, form) >= 0)
5628    continue;
5629   if(form.submit)
5630    this.ReplaceFormSubmit(form);
5631   this.ReplaceFormOnSumbit(form);
5632   this.observableForms.push(form);
5633  }
5634 },
5635 ReplaceFormSubmit: function(form) {
5636  var originalSubmit = form.submit;
5637  form.submit = function() {
5638   var postHandler = aspxGetPostHandler();
5639   aspxRaisePostHandlerOnPost();
5640   if(postHandler.cancelPostProcessing)
5641    return false;
5642   var callee = arguments.callee;
5643   this.submit = originalSubmit;
5644   var submitResult = this.submit();
5645   this.submit = callee;
5646   return submitResult;
5647  };
5648  form = null;
5649 },
5650 ReplaceFormOnSumbit: function(form) {
5651  var originalSubmit = form.onsubmit;
5652  form.onsubmit = function() {
5653   var postHandler = aspxGetPostHandler();
5654   postHandler.beforeOnSubmit();
5655   if(postHandler.isMSAjaxRequest)
5656    postHandler.isMsAjaxRequest = false;
5657   else
5658    aspxRaisePostHandlerOnPost(postHandler.GetLastSubmitElementName());
5659   if(postHandler.cancelPostProcessing)
5660    return false;
5661   return ASPx.IsFunction(originalSubmit)
5662    ? originalSubmit.apply(this, arguments)
5663    : true;
5664  };
5665  form = null;
5666 },
5667 SetBeforeOnSubmit: function(action) {
5668  this.beforeOnSubmit = action;
5669 },
5670 SetLastSubmitElementName: function(elementName) {
5671  this.lastSubmitElementName = elementName;
5672 },
5673 GetLastSubmitElementName: function() {
5674  return this.lastSubmitElementName;
5675 },
5676 RemoveDisposedFormsFromCache: function(){
5677  for(var i = 0; this.observableForms && i < this.observableForms.length; i++){
5678   var form = this.observableForms[i];
5679   if(!ASPx.IsExistsElement(form)){
5680    ASPx.Data.ArrayRemove(this.observableForms, form);
5681    i--;
5682   }
5683  }
5684 }
5685});
5686function aspxRaisePostHandlerOnPost(ownerID, isCallback, isMSAjaxRequest, isDXCallback) {
5687 if(ASPxClientControl.postHandlingLocked) return;
5688 var postHandler = aspxGetPostHandler();
5689 if(postHandler)
5690  postHandler.ProcessPostRequest(ownerID, isCallback, isMSAjaxRequest, isDXCallback);
5691}
5692var aspxPostHandler;
5693function aspxGetPostHandler() {
5694 if(!aspxPostHandler)
5695  aspxPostHandler = new PostHandler();
5696 return aspxPostHandler;
5697}
5698var PostHandlerOnPostEventArgs = ASPx.CreateClass(ASPxClientCancelEventArgs, {
5699 constructor: function(ownerID, isCallback, isMSAjaxCallback, isDXCallback){
5700  this.constructor.prototype.constructor.call(this);
5701  this.ownerID = ownerID;
5702  this.isCallback = !!isCallback;
5703  this.isDXCallback = !!isDXCallback;
5704  this.isMSAjaxCallback = !!isMSAjaxCallback;
5705 }
5706});
5707var ResourceManager = {
5708 HandlerStr: "DXR.axd?r=",
5709 ResourceHashes: {},
5710 SynchronizeResources: function(method){
5711  if(!method){
5712   method = function(name, resource) { 
5713    this.UpdateInputElements(name, resource); 
5714   }.aspxBind(this);
5715  }
5716  var resources = this.GetResourcesData();
5717  for(var name in resources)
5718   if(resources.hasOwnProperty(name))
5719    method(name, resources[name]);
5720 },
5721 GetResourcesData: function(){
5722  return {
5723   DXScript: this.GetResourcesElementsString(_aspxGetIncludeScripts(), "src", "DXScript"),
5724   DXCss: this.GetResourcesElementsString(_aspxGetLinks(), "href", "DXCss")
5725  };
5726 },
5727 ParseBundleSrc: function(elements, urlAttr){
5728  var timeStamp = "";
5729  var resourceUrlArray = [];
5730  for(var i = 0; i < elements.length; i++) {
5731   var resourceUrl = ASPx.Attr.GetAttribute(elements[i], urlAttr);
5732   if(resourceUrl) {
5733    var pos = resourceUrl.indexOf(this.HandlerStr);
5734    if(pos > -1){
5735     var list = resourceUrl.substr(pos + this.HandlerStr.length);
5736     var ampPos = list.lastIndexOf("-");
5737     if(ampPos > -1) {
5738      timeStamp = list.substr(ampPos);
5739      list = list.substr(0, ampPos);
5740     }
5741     var indexes = list.split(",");
5742     for(var j = 0; j < indexes.length; j++) {
5743      resourceUrlArray.push(indexes[j]);
5744     }
5745    }
5746    else
5747     resourceUrlArray.push(resourceUrl);
5748   }
5749  }
5750  return {
5751   'resourceUrlArray': resourceUrlArray,
5752   'timeStamp': timeStamp
5753  };
5754 },
5755 GetResourceHashes: function (id) {
5756  if (!this.ResourceHashes[id])
5757   this.ResourceHashes[id] = {};
5758  return this.ResourceHashes[id];
5759 },
5760 GetResourcesElementsString: function (elements, urlAttr, id) {
5761  var hash = this.GetResourceHashes(id);
5762  var resourceUrlArray = this.ParseBundleSrc(elements, urlAttr).resourceUrlArray;
5763  for(var i = 0; i < resourceUrlArray.length; i++) {
5764   hash[resourceUrlArray[i]] = resourceUrlArray[i];
5765  }
5766  var array = [];
5767  for(var key in hash)
5768   if(hash.hasOwnProperty(key))
5769    array.push(key);
5770  return array.join(",");
5771 },
5772 GetNewResourcesElementString: function (element, urlAttr, id) {
5773  var originalUrl = ASPx.Attr.GetAttribute(element, urlAttr);
5774  var handlerStrIndex = originalUrl.indexOf(this.HandlerStr);
5775  var dxResources = handlerStrIndex > -1;
5776  if(!dxResources) return element[urlAttr];
5777  var hash = this.GetResourceHashes(id);
5778  var srcInfo = this.ParseBundleSrc([element], urlAttr);
5779  var resourceUrlArray = srcInfo.resourceUrlArray;
5780  var timeStamp = srcInfo.timeStamp;
5781  var newResourceArray = [];
5782  for(var i = 0; i < resourceUrlArray.length; i++) {
5783    if(!hash[resourceUrlArray[i]])
5784    newResourceArray.push(resourceUrlArray[i]);
5785  }
5786  var newResources = "";
5787  if(newResourceArray.length > 0) {
5788    var baseUrl = originalUrl.substr(0, handlerStrIndex);
5789    newResources = baseUrl + this.HandlerStr + newResourceArray.join(",") + timeStamp;
5790  }
5791  return newResources;
5792 },
5793 UpdateInputElements: function(typeName, list){
5794  for(var i = 0; i < document.forms.length; i++){
5795   var inputElement = document.forms[i][typeName];
5796   if(!inputElement)
5797    inputElement = this.CreateInputElement(document.forms[i], typeName);
5798   inputElement.value = list;
5799  }
5800 },
5801 CreateInputElement: function(form, typeName){
5802  var inputElement = ASPx.CreateHiddenField(typeName);
5803  form.appendChild(inputElement);
5804  return inputElement;
5805 }
5806};
5807ASPx.includeScriptPrefix = "dxis_";
5808ASPx.startupScriptPrefix = "dxss_";
5809var includeScriptsCache = {};
5810var createdIncludeScripts = [];
5811var appendedScriptsCount = 0;
5812var callbackOwnerNames = [];
5813var scriptsRestartHandlers = { };
5814function _aspxIsKnownIncludeScript(script) {
5815 return !!includeScriptsCache[script.src];
5816}
5817function _aspxCacheIncludeScript(script) {
5818 includeScriptsCache[script.src] = 1;
5819}
5820function _aspxProcessScriptsAndLinks(ownerName, isCallback) {
5821 if(!ASPx.documentLoaded) return; 
5822 _aspxProcessScripts(ownerName, isCallback);
5823 getLinkProcessor().process();
5824 ASPx.ClearCachedCssRules();
5825}
5826function _aspxGetStartupScripts() {
5827 return _aspxGetScriptsCore(ASPx.startupScriptPrefix);
5828}
5829function _aspxGetIncludeScripts() {
5830 return _aspxGetScriptsCore(ASPx.includeScriptPrefix);
5831}
5832function _aspxGetScriptsCore(prefix) {
5833 var result = [];
5834 var scripts = document.getElementsByTagName("SCRIPT");
5835 for(var i = 0; i < scripts.length; i++) {
5836  if(scripts[i].id.indexOf(prefix) == 0)
5837   result.push(scripts[i]);
5838 }
5839 return result;
5840}
5841function _aspxGetLinks() {
5842 var result = [];
5843 var links = document.getElementsByTagName("LINK");
5844 for(var i = 0; i < links.length; i++) 
5845  result[i] = links[i];
5846 return result;
5847}
5848function _aspxIsLinksLoaded() {
5849 var links = _aspxGetLinks();
5850 for(var i = 0, link; link = links[i]; i++)
5851  if(link.readyState && link.readyState.toLowerCase() == "loading")
5852    return false;
5853 return true;
5854}
5855function _aspxInitializeLinks() {
5856 var links = _aspxGetLinks();
5857 for(var i = 0; i < links.length; i++)
5858  links[i].loaded = true; 
5859}
5860var scriptExecutedAttrName = "data-executed";
5861function isScriptExecuted(script) {
5862 return ASPx.Attr.GetAttribute(script, scriptExecutedAttrName);
5863}
5864function markScriptAsExecuted(script) {
5865 ASPx.Attr.SetAttribute(script, scriptExecutedAttrName, true);
5866}
5867function _aspxInitializeScripts() {
5868 var scripts = _aspxGetIncludeScripts();
5869 for(var i = 0; i < scripts.length; i++)
5870  _aspxCacheIncludeScript(scripts[i]);   
5871 var startupScripts = _aspxGetStartupScripts();
5872 for(var i = 0; i < startupScripts.length; i++)
5873  markScriptAsExecuted(startupScripts[i]);
5874}
5875function _aspxSweepDuplicatedLinks() {
5876 var hash = { };
5877 var links = _aspxGetLinks();
5878 for(var i = 0; i < links.length; i++) {
5879  var href = links[i].href;
5880  if(!href)
5881   continue;
5882  if(hash[href]){
5883   if((ASPx.Browser.IE || !hash[href].loaded) && links[i].loaded) {
5884    ASPx.RemoveElement(hash[href]);
5885    hash[href] = links[i];
5886   }
5887   else
5888    ASPx.RemoveElement(links[i]);
5889  }
5890  else
5891   hash[href] = links[i];
5892 }
5893}
5894function _aspxSweepDuplicatedScripts() {
5895 var hash = { };
5896 var scripts = _aspxGetIncludeScripts();
5897 for(var i = 0; i < scripts.length; i++) {
5898  var src = scripts[i].src;
5899  if(!src) continue;
5900  if(hash[src])
5901   ASPx.RemoveElement(scripts[i]);
5902  else
5903   hash[src] = scripts[i];
5904 }
5905}
5906function _aspxAreScriptsEqual(script1, script2) {
5907 return script1.src == script2.src;
5908}
5909function _aspxProcessScripts(ownerName, isCallback) {
5910 var scripts = _aspxGetIncludeScripts();
5911 var previousCreatedScript = null;
5912 var firstCreatedScript = null;
5913 for(var i = 0; i < scripts.length; i++) {
5914  var script = scripts[i];
5915  if(script.src == "") continue; 
5916  if(_aspxIsKnownIncludeScript(script))
5917   continue;
5918  var getOnlyNewResources = true;
5919  var onlyNewScripts = ResourceManager.GetNewResourcesElementString(script, "src", "DXScript", getOnlyNewResources);
5920  if (onlyNewScripts == "")
5921   continue;
5922  var createdScript = document.createElement("script");
5923  createdScript.type = "text/javascript";
5924  createdScript.src = onlyNewScripts;
5925  createdScript.id = script.id;
5926  if(ASPx.Data.ArrayIndexOf(createdIncludeScripts, createdScript, _aspxAreScriptsEqual) >= 0)
5927   continue;
5928  createdIncludeScripts.push(createdScript);
5929  ASPx.RemoveElement(script);
5930  if(ASPx.Browser.IE && ASPx.Browser.Version < 9) {
5931   createdScript.onreadystatechange = new Function("ASPx.OnScriptReadyStateChangedCallback(this, " + isCallback + ");");
5932  } else if(ASPx.Browser.Edge || ASPx.Browser.WebKitFamily || (ASPx.Browser.Firefox && ASPx.Browser.Version >= 4) || ASPx.Browser.IE && ASPx.Browser.Version >= 9) {
5933   createdScript.onload = new Function("ASPx.OnScriptLoadCallback(this, " + isCallback + ");");
5934   if(firstCreatedScript == null)
5935    firstCreatedScript = createdScript;
5936   createdScript.nextCreatedScript = null;
5937   if(previousCreatedScript != null)
5938    previousCreatedScript.nextCreatedScript = createdScript;
5939   previousCreatedScript = createdScript;
5940  } else {
5941   createdScript.onload = new Function("ASPx.OnScriptLoadCallback(this);");
5942   ASPx.AppendScript(createdScript);
5943   _aspxCacheIncludeScript(createdScript);
5944  }
5945 }
5946 if(firstCreatedScript != null) {
5947  ASPx.AppendScript(firstCreatedScript);
5948  _aspxCacheIncludeScript(firstCreatedScript);
5949 }
5950 if(isCallback)
5951  callbackOwnerNames.push(ownerName);
5952 if(createdIncludeScripts.length == 0) {
5953  var newLinks = ASPx.GetNodesByTagName(document.body, "link");
5954  var needProcessLinks = isCallback && newLinks.length > 0;
5955  if(needProcessLinks)
5956   needProcessLinks = getLinkProcessor().addLinks(newLinks);
5957  if(!needProcessLinks)
5958   ASPx.FinalizeScriptProcessing(isCallback);
5959 }
5960}
5961ASPx.FinalizeScriptProcessing = function(isCallback) {
5962 createdIncludeScripts = [];
5963 appendedScriptsCount = 0;
5964 var linkProcessor = getLinkProcessor();
5965 if(linkProcessor.hasLinks())
5966  _aspxSweepDuplicatedLinks();
5967 linkProcessor.reset();
5968 _aspxSweepDuplicatedScripts();
5969 ResourceManager.SynchronizeResources();
5970 _aspxRunStartupScripts(isCallback);
5971};
5972var startupScriptsRunning = false;
5973function _aspxRunStartupScripts(isCallback) {
5974 startupScriptsRunning = true;
5975 try {
5976  _aspxRunStartupScriptsCore();
5977 }
5978 finally {
5979  startupScriptsRunning = false;
5980 }
5981 if(ASPx.documentLoaded) {
5982  ASPx.GetControlCollection().InitializeElements(isCallback);
5983  for(var key in scriptsRestartHandlers)
5984   if(scriptsRestartHandlers.hasOwnProperty(key))
5985    scriptsRestartHandlers[key]();
5986  _aspxRunEndCallbackScript();
5987 }
5988}
5989function _aspxIsStartupScriptsRunning(isCallback) {
5990 return startupScriptsRunning;
5991}
5992function _aspxRunStartupScriptsCore() {
5993 var scripts = _aspxGetStartupScripts();
5994 var code;
5995 for(var i = 0; i < scripts.length; i++){
5996  var script = scripts[i];
5997  if(!isScriptExecuted(script)) {
5998   _aspxEnsureStartupScriptIsUnique(script.id); 
5999   code = ASPx.GetScriptCode(script);
6000   eval(code);
6001   markScriptAsExecuted(script);
6002  }
6003 }
6004}
6005function _aspxEnsureStartupScriptIsUnique(scriptId) {
6006 if(!scriptId)
6007  return;
6008 var scriptExecutedSelector = "script[" + scriptExecutedAttrName + "='true']#" + scriptId;
6009 ASPx.RemoveElement(document.querySelector(scriptExecutedSelector));
6010}
6011function _aspxRunEndCallbackScript() {
6012 while(callbackOwnerNames.length > 0) {
6013  var callbackOwnerName = callbackOwnerNames.pop();
6014  var callbackOwner = ASPx.GetControlCollection().Get(callbackOwnerName);
6015  if(callbackOwner)
6016   callbackOwner.DoEndCallback();
6017 }
6018}
6019ASPx.OnScriptReadyStateChangedCallback = function(scriptElement, isCallback) {
6020 if(scriptElement.readyState == "loaded") {
6021  _aspxCacheIncludeScript(scriptElement);
6022  for(var i = 0; i < createdIncludeScripts.length; i++) {
6023   var script = createdIncludeScripts[i];
6024   if(_aspxIsKnownIncludeScript(script)) {
6025    if(!isScriptExecuted(script)) {
6026     markScriptAsExecuted(script);
6027     ASPx.AppendScript(script);
6028     appendedScriptsCount++;
6029    }
6030   } else
6031    break;
6032  }
6033  if(createdIncludeScripts.length == appendedScriptsCount)
6034   ASPx.FinalizeScriptProcessing(isCallback);
6035 }
6036};
6037ASPx.OnScriptLoadCallback = function(scriptElement, isCallback) {
6038 appendedScriptsCount++;
6039 if(scriptElement.nextCreatedScript) {
6040  ASPx.AppendScript(scriptElement.nextCreatedScript);
6041  _aspxCacheIncludeScript(scriptElement.nextCreatedScript);
6042 }
6043 if(createdIncludeScripts.length == appendedScriptsCount)
6044  ASPx.FinalizeScriptProcessing(isCallback);
6045};
6046function _aspxAddScriptsRestartHandler(objectName, handler) {
6047 scriptsRestartHandlers[objectName] = handler;
6048}
6049function _aspxMoveLinkElements() {
6050 var head = ASPx.GetNodesByTagName(document, "head")[0];
6051 var bodyLinks = ASPx.GetNodesByTagName(document.body, "link");
6052 if(head && bodyLinks.length > 0){
6053  var headLinks = ASPx.GetNodesByTagName(head, "link");
6054  var dxLinkAnchor = head.firstChild;
6055  for(var i = 0; i < headLinks.length; i++){
6056   if(headLinks[i].href.indexOf(ResourceManager.HandlerStr) > -1)
6057    dxLinkAnchor = headLinks[i].nextSibling;
6058  }
6059  while(bodyLinks.length > 0) 
6060   head.insertBefore(bodyLinks[0], dxLinkAnchor);
6061 }
6062}
6063var LinkProcessor = ASPx.CreateClass(null, {
6064 constructor: function() {
6065  this.loadedLinkCount = 0;
6066  this.linkInfos = [];
6067  this.loadingObservationTimerID = -1;
6068 },
6069 process: function() {
6070  if(this.hasLinks()) {
6071   if(this.isLinkLoadEventSupported())
6072    this.processViaLoadEvent();
6073   else
6074    this.processViaTimer();
6075  }
6076  else
6077   _aspxSweepDuplicatedLinks();
6078  _aspxMoveLinkElements();
6079 },
6080 addLinks: function(links) {
6081  var prevLinkCount = this.linkInfos.length;
6082  for(var i = 0; i < links.length; i++) {
6083   var link = links[i];
6084   if(link.loaded || link.rel != "stylesheet" || link.type != "text/css" || link.href.toLowerCase().indexOf("dxr.axd?r=") == -1)
6085    continue;
6086   var linkInfo = {
6087    link: link,
6088    href: link.href
6089   };
6090   this.linkInfos.push(linkInfo);
6091  }
6092  return prevLinkCount != this.linkInfos.length;
6093 },
6094 hasLinks: function() {
6095  return this.linkInfos.length > 0;
6096 },
6097 reset: function() {
6098  this.linkInfos = [];
6099  this.loadedLinkCount = 0;
6100 },
6101 processViaLoadEvent: function() {
6102  var that = this;
6103  for(var i = 0, linkInfo; linkInfo = this.linkInfos[i]; i++) {
6104   if(ASPx.Browser.IE && ASPx.Browser.Version < 9)
6105    linkInfo.link.onreadystatechange = function() { that.onLinkReadyStateChanged(this); };
6106   else
6107    linkInfo.link.onload = this.onLinkLoad.aspxBind(this);
6108  }
6109 },
6110 isLinkLoadEventSupported: function() {
6111  return !(ASPx.Browser.Chrome && ASPx.Browser.MajorVersion < 19 || ASPx.Browser.Firefox && ASPx.Browser.MajorVersion < 9 ||
6112   ASPx.Browser.Safari && ASPx.Browser.MajorVersion < 6 || ASPx.Browser.AndroidDefaultBrowser && ASPx.Browser.MajorVersion < 4.4);
6113 },
6114 processViaTimer: function() {
6115  if(this.loadingObservationTimerID == -1)
6116   this.onLinksLoadingObserve();
6117 },
6118 onLinksLoadingObserve: function() {
6119  if(this.getIsAllLinksLoaded()) {
6120   this.loadingObservationTimerID = -1;
6121   this.onAllLinksLoad();
6122  }
6123  else
6124   this.loadingObservationTimerID = window.setTimeout(this.onLinksLoadingObserve.aspxBind(this), 100);
6125 },
6126 getIsAllLinksLoaded: function() {
6127  var styleSheets = document.styleSheets;
6128  var loadedLinkHrefs = { };
6129  for(var i = 0; i < styleSheets.length; i++) {
6130   var styleSheet = styleSheets[i];
6131   try {
6132    if(styleSheet.cssRules)
6133     loadedLinkHrefs[styleSheet.href] = 1;
6134   }
6135   catch(ex) { }
6136  }
6137  var loadedLinksCount = 0;
6138  for(var i = 0, linkInfo; linkInfo = this.linkInfos[i]; i++) {
6139   if(loadedLinkHrefs[linkInfo.href])
6140    loadedLinksCount++;
6141  }
6142  return loadedLinksCount == this.linkInfos.length;
6143 },
6144 onAllLinksLoad: function() {
6145  this.reset();
6146  _aspxSweepDuplicatedLinks();
6147  if(createdIncludeScripts.length == 0)
6148   ASPx.FinalizeScriptProcessing(true);
6149 },
6150 onLinkReadyStateChanged: function(linkElement) {
6151  if(linkElement.readyState == "complete")
6152   this.onLinkLoadCore(linkElement);
6153 },
6154 onLinkLoad: function(evt) {
6155  var linkElement = ASPx.Evt.GetEventSource(evt);
6156  this.onLinkLoadCore(linkElement);
6157 },
6158 onLinkLoadCore: function(linkElement) {
6159  if(!this.hasLinkElement(linkElement)) return;
6160  this.loadedLinkCount++;
6161  if(!ASPx.Browser.Firefox && this.loadedLinkCount == this.linkInfos.length || 
6162   ASPx.Browser.Firefox && this.loadedLinkCount == 2 * this.linkInfos.length) {
6163   this.onAllLinksLoad();
6164  }
6165 },
6166 hasLinkElement: function(linkElement) {
6167  for(var i = 0, linkInfo; linkInfo = this.linkInfos[i]; i++) {
6168   if(linkInfo.link == linkElement)
6169    return true;
6170  }
6171  return false;
6172 }
6173});
6174var linkProcessor = null;
6175function getLinkProcessor() {
6176 if(linkProcessor == null)
6177  linkProcessor = new LinkProcessor();
6178 return linkProcessor;
6179}
6180var IFrameHelper = ASPx.CreateClass(null, {
6181 constructor: function(params) {
6182  this.params = params || {};
6183  this.params.src = this.params.src || "";
6184  this.CreateElements();
6185 },
6186 CreateElements: function() {
6187  var elements = IFrameHelper.Create(this.params);
6188  this.containerElement = elements.container;
6189  this.iframeElement = elements.iframe;
6190  this.AttachOnLoadHandler(this, this.iframeElement);
6191  this.SetLoading(true);
6192  if(this.params.onCreate)
6193   this.params.onCreate(this.containerElement, this.iframeElement);
6194 },
6195 AttachOnLoadHandler: function(instance, element) {
6196  ASPx.Evt.AttachEventToElement(element, "load", function() {
6197   instance.OnLoad(element);
6198  });
6199 },
6200 OnLoad: function(element) {
6201  this.SetLoading(false, element);
6202  if(!element.preventCustomOnLoad && this.params.onLoad)
6203   this.params.onLoad();
6204 },
6205 IsLoading: function(element) {
6206  element = element || this.iframeElement;
6207  if(element)
6208   return element.loading;
6209  return false;
6210 },
6211 SetLoading: function(value, element) {
6212  element = element || this.iframeElement;
6213  if(element)
6214   element.loading = value;
6215 },
6216 GetContentUrl: function() {
6217  return this.params.src;
6218 },
6219 SetContentUrl: function(url, preventBrowserCaching) {
6220  if(url) {
6221   this.params.src = url;
6222   if(preventBrowserCaching)
6223    url = IFrameHelper.AddRandomParamToUrl(url);
6224   this.SetLoading(true);
6225   this.iframeElement.src = url;
6226  }
6227 },
6228 RefreshContentUrl: function() {
6229  if(this.IsLoading())
6230   return;
6231  this.SetLoading(true);
6232  var oldContainerElement = this.containerElement;
6233  var oldIframeElement = this.iframeElement;
6234  var postfix = "_del" + Math.floor(Math.random()*100000).toString();
6235  if(this.params.id)
6236   oldIframeElement.id = this.params.id + postfix;
6237  if(this.params.name)
6238   oldIframeElement.name = this.params.name + postfix;
6239  ASPx.SetStyles(oldContainerElement, { height: 0 });
6240  this.CreateElements();
6241  oldIframeElement.preventCustomOnLoad = true;
6242  oldIframeElement.src = ASPx.BlankUrl;
6243  window.setTimeout(function() {
6244   oldContainerElement.parentNode.removeChild(oldContainerElement);
6245  }, 10000); 
6246 }
6247});
6248IFrameHelper.Create = function(params) {
6249 var iframeHtmlStringParts = [ "<iframe frameborder='0'" ];
6250 if(params) {
6251  if(params.id)
6252   iframeHtmlStringParts.push(" id='", params.id, "'");
6253  if(params.name)
6254   iframeHtmlStringParts.push(" name='", params.name, "'");
6255  if(params.title)
6256   iframeHtmlStringParts.push(" title='", params.title, "'");
6257  if(params.scrolling)
6258   iframeHtmlStringParts.push(" scrolling='", params.scrolling, "'");
6259  if(params.src)
6260   iframeHtmlStringParts.push(" src='", params.src, "'");
6261 }
6262 iframeHtmlStringParts.push("></iframe>");
6263 var containerElement = ASPx.CreateHtmlElementFromString("<div style='border-width: 0px; padding: 0px; margin: 0px'></div>");
6264 var iframeElement = ASPx.CreateHtmlElementFromString(iframeHtmlStringParts.join(""));
6265 containerElement.appendChild(iframeElement);
6266 return {
6267  container: containerElement,
6268  iframe: iframeElement
6269 };
6270};
6271IFrameHelper.AddRandomParamToUrl = function(url) {
6272 var prefix = url.indexOf("?") > -1
6273  ? "&"
6274  : "?";
6275 var param = prefix + Math.floor(Math.random()*100000).toString();
6276 var anchorIndex = url.indexOf("#");
6277 return anchorIndex == -1
6278  ? url + param
6279  : url.substr(0, anchorIndex) + param + url.substr(anchorIndex);
6280};
6281IFrameHelper.GetWindow = function(name) {
6282 if(ASPx.Browser.IE)
6283  return window.frames[name].window;
6284 else{
6285  var frameElement = document.getElementById(name);
6286  return (frameElement != null) ? frameElement.contentWindow : null;
6287 }
6288};
6289IFrameHelper.GetDocument = function(name) {
6290 var frameElement;
6291 if(ASPx.Browser.IE) {
6292  frameElement = window.frames[name];
6293  return (frameElement != null) ? frameElement.document : null;
6294 }
6295 else {
6296  frameElement = document.getElementById(name);
6297  return (frameElement != null) ? frameElement.contentDocument : null;
6298 }
6299};
6300IFrameHelper.GetDocumentBody = function(name) {
6301 var doc = IFrameHelper.GetDocument(name);
6302 return (doc != null) ? doc.body : null;
6303};
6304IFrameHelper.GetDocumentHead = function (name) {
6305 var doc = IFrameHelper.GetDocument(name);
6306 return (doc != null) ? doc.head || doc.getElementsByTagName('head')[0] : null;
6307};
6308IFrameHelper.GetElement = function(name) {
6309 if(ASPx.Browser.IE)
6310  return window.frames[name].window.frameElement;
6311 else
6312  return document.getElementById(name);
6313};
6314var KbdHelper = ASPx.CreateClass(null, {
6315 constructor: function(control) {
6316  this.control = control;
6317 },
6318 Init: function() {
6319  KbdHelper.GlobalInit();
6320  var elements = this.getFocusableElements();
6321  for(var i = 0; i < elements.length; i++) {
6322   var element = elements[i];
6323   element.tabIndex = Math.max(element.tabIndex, 0);
6324   ASPx.Evt.AttachEventToElement(element, "click", function(e) { this.HandleClick(e); }.aspxBind(this));
6325   ASPx.Evt.AttachEventToElement(element, "focus", function(e) {    
6326    return this.onElementFocus(e);
6327   }.aspxBind(this));
6328   ASPx.Evt.AttachEventToElement(element, "blur", function () { this.onBlur(); }.aspxBind(this)); 
6329  }   
6330 },
6331 onElementFocus: function(e) {
6332  if(!this.CanFocus(e))
6333   return true;
6334  KbdHelper.active = this;
6335 },
6336 getFocusableElements: function() {
6337  return [this.GetFocusableElement()]; 
6338 },
6339 GetFocusableElement: function() { return this.control.GetMainElement(); },
6340 canHandleNoFocusAction: function() { 
6341  var focusableElements = this.getFocusableElements();
6342  for(var i = 0; i < focusableElements.length; i++) {
6343   if(focusableElements[i] === _aspxGetFocusedElement())
6344    return false;
6345  }
6346  return true;
6347 },
6348 CanFocus: function(e) {
6349  var tag = ASPx.Evt.GetEventSource(e).tagName;
6350  if(tag == "A" || tag == "TEXTAREA" || tag == "INPUT" || tag == "SELECT" || tag == "IFRAME" || tag == "OBJECT")
6351   return false; 
6352  return true;
6353 },
6354 HandleClick: function(e) {
6355  if(!this.CanFocus(e))
6356   return;
6357  this.Focus();
6358 },
6359 Focus: function() {
6360  try {
6361   this.GetFocusableElement().focus();   
6362  } catch(e) {
6363  }
6364 },
6365 onBlur: function(){
6366  delete KbdHelper.active;
6367 },
6368 HandleKeyDown: function(e) { }, 
6369 HandleKeyPress: function(e) { }, 
6370 HandleKeyUp: function (e) { },
6371 HandleNoFocusAction: function(e) { },
6372 FocusByAccessKey: function () { }
6373});
6374KbdHelper.GlobalInit = function() {
6375 if(KbdHelper.ready)
6376  return;
6377 ASPx.Evt.AttachEventToDocument("keydown", KbdHelper.OnKeyDown);
6378 ASPx.Evt.AttachEventToDocument("keypress", KbdHelper.OnKeyPress);
6379 ASPx.Evt.AttachEventToDocument("keyup", KbdHelper.OnKeyUp);
6380 KbdHelper.ready = true; 
6381};
6382KbdHelper.swallowKey = false;
6383KbdHelper.accessKeys = { };
6384KbdHelper.ProcessKey = function(e, actionName) {
6385 if(!KbdHelper.active) 
6386  return;
6387 if (KbdHelper.active.canHandleNoFocusAction()) {
6388  KbdHelper.active["HandleNoFocusAction"](e, actionName);
6389  return;
6390 }
6391 var ctl = KbdHelper.active.control;
6392 if(ctl !== ASPx.GetControlCollection().Get(ctl.name)) {
6393  delete KbdHelper.active;
6394  return;
6395 }
6396 if(!KbdHelper.swallowKey) 
6397  KbdHelper.swallowKey = KbdHelper.active[actionName](e);
6398 if(KbdHelper.swallowKey)
6399  ASPx.Evt.PreventEvent(e);
6400};
6401KbdHelper.OnKeyDown = function(e) {
6402 KbdHelper.swallowKey = false;
6403 if(KbdHelper.TryAccessKey(KbdHelper.getKeyName(e)))
6404  ASPx.Evt.PreventEvent(e);
6405 else 
6406  KbdHelper.ProcessKey(e, "HandleKeyDown"); 
6407};
6408KbdHelper.OnKeyPress = function(e) { KbdHelper.ProcessKey(e, "HandleKeyPress"); };
6409KbdHelper.OnKeyUp = function(e) { KbdHelper.ProcessKey(e, "HandleKeyUp"); };
6410KbdHelper.RegisterAccessKey = function(obj) {
6411 var key;
6412 if(obj.accessKey)
6413  key = "CtrlShift" + obj.accessKey;
6414 else if(obj.keyTipModeShortcut)
6415  key = obj.keyTipModeShortcut;
6416 if(!key) return;
6417 KbdHelper.accessKeys[key.toLowerCase()] = obj.name;
6418};
6419KbdHelper.TryAccessKey = function(code) {
6420 var key = code.toLowerCase ? code.toLowerCase() : String.fromCharCode(code).toLowerCase();
6421 var name = KbdHelper.accessKeys[key];
6422 if(!name) return false;
6423 var obj = ASPx.GetControlCollection().Get(name);
6424 return KbdHelper.ClickAccessKey(obj);
6425};
6426KbdHelper.ClickAccessKey = function (control) {
6427 if (!control) return false;
6428 var el = control.GetMainElement();
6429 if (!el) return false;
6430 el.focus();
6431 setTimeout(function () {
6432  if (KbdHelper.active && KbdHelper.active.FocusByAccessKey)
6433   KbdHelper.active.FocusByAccessKey();
6434 }.aspxBind(this), 100);
6435 return true;
6436};
6437KbdHelper.getKeyName = function(e) {
6438 var name = "";
6439 if(e.altKey)
6440  name += "Alt";
6441 if(e.ctrlKey)
6442  name += "Ctrl";
6443 if(e.shiftKey)
6444  name += "Shift";
6445 var keyCode = e.key || e.code || String.fromCharCode(ASPx.Evt.GetKeyCode(e));
6446 if(keyCode.match(/key/i))
6447  name += keyCode.replace(/key/i, "");
6448 else if(keyCode.match(/digit/i))
6449  name += keyCode.replace(/digit/i, "");
6450 else if(keyCode.match(/arrow/i))
6451  name += keyCode.replace(/arrow/i, "");
6452 else if(keyCode.match(/ins/i))
6453  name += "Ins";
6454 else if(keyCode.match(/del/i))
6455  name += "Del";
6456 else if(keyCode.match(/back/i))
6457  name += "Back";
6458 else if(!keyCode.match(/alt/i) && !keyCode.match(/control/i) && !keyCode.match(/shift/i))
6459  name += keyCode;
6460 return name.replace(/^a-zA-Z0-9/, "");
6461};
6462AccessKeysHelper = ASPx.CreateClass(KbdHelper, {
6463 constructor: function (control) {
6464  this.constructor.prototype.constructor.call(this, control);
6465  this.accessKeysVisible = false;
6466  this.activeKey = null;
6467  this.accessKey = new AccessKey(control.accessKey);
6468  this.accessKeys = this.accessKey.accessKeys;
6469  this.charIndex = 0;
6470  this.onFocusByAccessKey = null;
6471  this.onClose = null;
6472  this.manualStopProcessing = false;
6473  this.isActive = false;
6474  this.areAccessKeysShown = false;
6475 },
6476 Init: function (control) {
6477  KbdHelper.prototype.Init.call(this);
6478  KbdHelper.RegisterAccessKey(control);   
6479 },
6480 Add: function (accessKey) {
6481  this.accessKey.Add(accessKey);
6482 },
6483 HandleKeyDown: function (e) {
6484  var keyCode = ASPx.Evt.GetKeyCode(e);
6485  var stopProcessing = this.processKeyDown(keyCode);
6486  if (stopProcessing.value) {
6487   this.stopProcessing();
6488   if(this.onClosedOnEscape && (keyCode == ASPx.Key.Esc || stopProcessing.fireEvent))
6489    this.onClosedOnEscape();
6490  }
6491  return stopProcessing;
6492 },
6493 HandleNoFocusAction: function (e, actionName) {
6494  var keyCode = ASPx.Evt.GetKeyCode(e);
6495  if (this.onClosedOnEscape && keyCode == ASPx.Key.Esc && actionName == "HandleKeyDown")
6496   this.onClosedOnEscape();
6497 },
6498 Activate: function () {
6499  KbdHelper.ClickAccessKey(this.control);
6500  this.areAccessKeysShown = true;
6501 },
6502 Stop: function() {
6503  this.stopProcessing();
6504 },
6505 stopProcessing: function () {
6506  this.HideAccessKeys();
6507  if (KbdHelper.active && this.isActive) {
6508   this.isActive = false;
6509   KbdHelper.active.control.GetMainElement().blur();
6510   delete KbdHelper.active;
6511  }
6512 },
6513 onBlur: function() {
6514  if (this.manualStopProcessing) {
6515   this.manualStopProcessing = false;
6516   return;
6517  }
6518  this.HideAccessKeys();
6519  KbdHelper.prototype.onBlur.call(this);
6520 },
6521 processKeyDown: function (keyCode) {
6522  switch (keyCode) {
6523   case ASPx.Key.Left:
6524    this.TryMoveFocusLeft();
6525    return { value: false };
6526   case ASPx.Key.Right:
6527    this.TryMoveFocusRight();
6528    return { value: false };
6529   case ASPx.Key.Esc:
6530    if(this.control.hideAllPopups)
6531     this.control.hideAllPopups(true, true);
6532    if(this.activeKey)
6533     this.activeKey = this.activeKey.Return();
6534    this.charIndex = 0;
6535    if (!this.activeKey)
6536     return { value: true };
6537    break;
6538   case ASPx.Key.Enter:
6539    return { value: true };
6540   default:
6541    if (!ASPx.IsPrintableKey(keyCode))
6542     return { value: false };
6543    var char = String.fromCharCode(keyCode).toUpperCase();
6544    var needToContinue = { value: false };
6545    var keyResult;
6546    if(this.activeKey)
6547     keyResult = this.activeKey.TryAccessKey(char, this.charIndex, needToContinue);
6548    if (needToContinue.value) {
6549     this.charIndex++;
6550     return { value: false };
6551    }
6552    this.charIndex = 0;
6553    if(keyResult !== undefined)
6554     this.activeKey = keyResult;
6555    else
6556     return { value: true, fireEvent: true };
6557    if (!this.activeKey || !this.activeKey.accessKeys || this.activeKey.accessKeys.length == 0) {
6558     if (this.activeKey && this.activeKey.manualStopProcessing) {
6559      this.manualStopProcessing = true;
6560      break;
6561     }
6562     return { value: true, fireEvent: true };
6563    }
6564  }
6565  return { value: false };
6566 },
6567 TryMoveFocusLeft: function (modifier) {},
6568 TryMoveFocusRight: function (modifier) {},
6569 TryMoveFocusUp: function (modifier) {},
6570 TryMoveFocusDown: function (modifier) {},
6571 FocusByAccessKey: function() {
6572  if (this.onFocusByAccessKey)
6573   this.onFocusByAccessKey();
6574  this.HideAccessKeys();
6575  KbdHelper.prototype.FocusByAccessKey.call(this);
6576  this.activeKey = this.accessKey;
6577  this.activeKey.execute();
6578  this.isActive = true;
6579  this.areAccessKeysShown = true;
6580 },
6581 HideAccessKeys: function() {
6582  this.areAccessKeysShown = false;
6583  this.hideAccessKeys(this.accessKey);
6584 },
6585 Update: function() {
6586  this.throttleMethod(this.refresh, 100);
6587 },
6588 refresh: function() {
6589  if(this.activeKey && this.areAccessKeysShown) {
6590   this.activeKey.execute();
6591  }
6592 },
6593 throttleMethod: function(method, delay) {
6594  clearTimeout(method.timerId);
6595  method.timerId = setTimeout(function() {
6596   method.call(this);
6597  }.aspxBind(this), delay);
6598 },
6599 AreAccessKeysShown: function() {
6600  return this.areAccessKeysShown;
6601 },
6602 hideAccessKeys: function (accessKey) {
6603  for (var i = 0, ak; ak = accessKey.accessKeys[i]; i++) {
6604   this.hideAccessKeys(ak);
6605  }
6606  if (accessKey)
6607   accessKey.hide();
6608 },
6609 HandleClick: function(e) {
6610  KbdHelper.prototype.HandleClick.call(this, e);
6611  this.stopProcessing();
6612 }
6613});
6614AccessKey = ASPx.CreateClass(null, {
6615 constructor: function (popupItem, getPopupElement, keyTipElement, key, onlyClick, manualStopProcessing) {
6616  this.key = key ? key : keyTipElement ? ASPxClientUtils.Trim(ASPx.GetInnerText(keyTipElement)) : null;
6617  this.popupItem = popupItem;
6618  this.getPopupElement = getPopupElement;
6619  this.keyTipElement = keyTipElement;
6620  this.accessKeys = [];
6621  this.needShowChilds = true;
6622  this.parent = null;
6623  this.onlyClick = onlyClick;
6624  this.manualStopProcessing = manualStopProcessing;
6625 },
6626 Add: function (accessKey) {
6627  this.accessKeys.push(accessKey);
6628  accessKey.parent = this;
6629 },
6630 TryAccessKey: function (char, index, needToContinue) {
6631  if (!this.accessKeys || this.accessKeys.length == 0)
6632   return;
6633  for (var i = 0, accessKey; accessKey = this.accessKeys[i]; i++) {
6634   if (accessKey.key[index] == char && accessKey.isVisible()) {
6635    if (accessKey.key[index + 1]) {
6636     needToContinue.value = true;
6637    }
6638    else {
6639     accessKey.execute();
6640     return accessKey;
6641    }
6642   } else {
6643    accessKey.hide();
6644   }
6645  }
6646  for (var i = 0, accessKey; accessKey = this.accessKeys[i]; i++) {
6647   var key = accessKey.TryAccessKey(char, index, needToContinue);
6648   if (key)
6649    return key;
6650  }
6651  return;
6652 },
6653 isVisible: function(){
6654  return ASPx.GetElementVisibility(this.keyTipElement);
6655 },
6656 Return: function () {
6657  this.hideChildAccessKeys();
6658  if (this.parent) {
6659   this.parent.showAccessKeys(true);
6660  }  
6661  return this.parent;
6662 },
6663 execute: function () {
6664  this.hideAll();
6665  if (this.popupItem && this.popupItem.accessKeyClick && !this.onlyClick)
6666   this.popupItem.accessKeyClick();
6667  if (this.getPopupElement && this.onlyClick)
6668   ASPx.Evt.EmulateMouseClick(this.getPopupElement(this.popupItem));
6669  if (this.accessKeys)
6670   setTimeout(function () {
6671    this.showAccessKeys(true);
6672   }.aspxBind(this), 100);
6673 },
6674 showAccessKeys: function(directShow) {
6675  if (!directShow && !this.needShowChilds)
6676   return;
6677  for (var i = 0; i < this.accessKeys.length; i++) {
6678   var accessKey = this.accessKeys[i];
6679   if (accessKey) {
6680    var popupElement = accessKey.getPopupElement ? accessKey.getPopupElement(accessKey.popupItem) : null;
6681    if (popupElement && ASPx.IsElementVisible(popupElement, true)) {
6682     this.show(accessKey);
6683    }
6684    accessKey.showAccessKeys();
6685   }
6686  }
6687 },
6688 show: function(accessKey) {
6689  var keyTipElement = accessKey.keyTipElement;
6690  var popupElement = accessKey.getPopupElement(accessKey.popupItem);
6691  var top = ASPx.GetAbsolutePositionY(popupElement);
6692  var left = ASPx.GetAbsolutePositionX(popupElement);
6693  if (accessKey.popupItem.getAccessKeyPosition)
6694   switch (accessKey.popupItem.getAccessKeyPosition()) {
6695    case "AboveRight":
6696     left = left + popupElement.offsetWidth - keyTipElement.offsetWidth / 3;
6697     top = top - keyTipElement.offsetHeight / 2;
6698     break;
6699    case "Right":
6700     left = left + popupElement.offsetWidth - keyTipElement.offsetWidth / 3;
6701     top = top + popupElement.offsetHeight / 2 - keyTipElement.offsetHeight / 2;
6702     break;
6703    case "BelowRight":
6704     left = left + popupElement.offsetWidth - keyTipElement.offsetWidth / 3;
6705     top = top + keyTipElement.offsetHeight / 2;
6706     break;
6707    default:
6708     top = top + popupElement.offsetHeight;
6709     left = left + popupElement.offsetWidth / 2 - keyTipElement.offsetWidth / 2;
6710     break;
6711   }
6712  else {
6713   top = top + popupElement.offsetHeight;
6714   left = left + popupElement.offsetWidth / 2 - keyTipElement.offsetWidth / 2;
6715  }
6716  ASPx.SetAbsoluteY(keyTipElement, top);
6717  ASPx.SetAbsoluteX(keyTipElement, left);
6718  ASPx.SetElementVisibility(keyTipElement, true); 
6719 },
6720 hide: function() {
6721  if (this.keyTipElement)
6722   ASPx.SetElementVisibility(this.keyTipElement, false);
6723 },
6724 hideChildAccessKeys: function () {
6725  this.hideAccessKeys(this.accessKeys);
6726 },
6727 hideAccessKeys: function (accessKeys) {
6728  if (accessKeys) {
6729   for (var i = 0, accessKey; accessKey = accessKeys[i]; i++) {
6730    if (accessKey.keyTipElement)
6731     accessKey.hide();
6732    accessKey.hideChildAccessKeys();
6733   }
6734  }
6735 },
6736 hideAll: function () {
6737  this.getRoot(this).hideChildAccessKeys();
6738 },
6739 getRoot: function (accessKey) {
6740  if (!accessKey.parent)
6741   return accessKey;
6742  return this.getRoot(accessKey.parent);
6743 }
6744});
6745var focusedElement = null;
6746function aspxOnElementFocused(evt) {
6747 evt = ASPx.Evt.GetEvent(evt);
6748 if(evt && evt.target)
6749  focusedElement = evt.target;
6750}
6751function _aspxInitializeFocus() {
6752 if(!ASPx.GetActiveElement())
6753  ASPx.Evt.AttachEventToDocument("focus", aspxOnElementFocused);
6754}
6755function _aspxGetFocusedElement() {
6756 var activeElement = ASPx.GetActiveElement();
6757 return activeElement ? activeElement : focusedElement;
6758}
6759CheckBoxCheckState = {
6760 Checked : "Checked",
6761 Unchecked : "Unchecked",
6762 Indeterminate : "Indeterminate"
6763};
6764CheckBoxInputKey = { 
6765 Checked : "C",
6766 Unchecked : "U",
6767 Indeterminate : "I"
6768};
6769var CheckableElementStateController = ASPx.CreateClass(null, {
6770 constructor: function(imageProperties) {
6771  this.checkBoxStates = [];
6772  this.imageProperties = imageProperties;
6773  this.customImageMarkerClassName = "dxcbCI";
6774 },
6775 GetValueByInputKey: function(inputKey) {
6776  return this.GetFirstValueBySecondValue("Value", "StateInputKey", inputKey);
6777 },
6778 GetInputKeyByValue: function(value) {
6779  return this.GetFirstValueBySecondValue("StateInputKey", "Value", value);
6780 },
6781 GetImagePropertiesNumByInputKey: function(value) {
6782  return this.GetFirstValueBySecondValue("ImagePropertiesNumber", "StateInputKey", value);
6783 },
6784 GetNextCheckBoxValue: function(currentValue, allowGrayed) {
6785  var currentInputKey = this.GetInputKeyByValue(currentValue);
6786  var nextInputKey = '';
6787  switch(currentInputKey) {
6788   case CheckBoxInputKey.Checked:
6789    nextInputKey = CheckBoxInputKey.Unchecked; break;
6790   case CheckBoxInputKey.Unchecked:
6791    nextInputKey = allowGrayed ? CheckBoxInputKey.Indeterminate : CheckBoxInputKey.Checked; break;
6792   case CheckBoxInputKey.Indeterminate:
6793    nextInputKey = CheckBoxInputKey.Checked; break;
6794  }
6795  return this.GetValueByInputKey(nextInputKey);
6796 },
6797 GetCheckStateByInputKey: function(inputKey) {
6798  switch(inputKey) {
6799   case CheckBoxInputKey.Checked: 
6800    return CheckBoxCheckState.Checked;
6801   case CheckBoxInputKey.Unchecked: 
6802    return CheckBoxCheckState.Unchecked;
6803   case CheckBoxInputKey.Indeterminate: 
6804    return CheckBoxCheckState.Indeterminate;
6805  }
6806 },
6807 GetValueByCheckState: function(checkState) {
6808  switch(checkState) {
6809   case CheckBoxCheckState.Checked: 
6810    return this.GetValueByInputKey(CheckBoxInputKey.Checked);
6811   case CheckBoxCheckState.Unchecked: 
6812    return this.GetValueByInputKey(CheckBoxInputKey.Unchecked);
6813   case CheckBoxCheckState.Indeterminate: 
6814    return this.GetValueByInputKey(CheckBoxInputKey.Indeterminate);
6815  }
6816 },
6817 GetFirstValueBySecondValue: function(firstValueName, secondValueName, secondValue) {
6818  return this.GetValueByFunc(firstValueName, 
6819   function(checkBoxState) { return checkBoxState[secondValueName] === secondValue; });
6820 },
6821 GetValueByFunc: function(valueName, func) {
6822  for(var i = 0; i < this.checkBoxStates.length; i++) {
6823   if(func(this.checkBoxStates[i]))
6824    return this.checkBoxStates[i][valueName];
6825  }  
6826 },
6827 AssignElementClassName: function(element, cssClassPropertyKey, disabledCssClassPropertyKey, assignedClassName) {
6828  var classNames = [ ];
6829  for(var i = 0; i < this.imageProperties[cssClassPropertyKey].length; i++) {
6830   classNames.push(this.imageProperties[disabledCssClassPropertyKey][i]);
6831   classNames.push(this.imageProperties[cssClassPropertyKey][i]);
6832  }
6833  var elementClassName = element.className;
6834  for(var i = 0; i < classNames.length; i++) {
6835   var className = classNames[i];
6836   var index = elementClassName.indexOf(className);
6837   if(index > -1)
6838    elementClassName = elementClassName.replace((index == 0 ? '' : ' ') + className, "");
6839  }
6840  elementClassName += " " + assignedClassName;
6841  element.className = elementClassName;
6842 },
6843 UpdateInternalCheckBoxDecoration: function(mainElement, inputKey, enabled) {
6844  var imagePropertiesNumber = this.GetImagePropertiesNumByInputKey(inputKey);
6845  for(var imagePropertyKey in this.imageProperties) {
6846   if(this.imageProperties.hasOwnProperty(imagePropertyKey)) {
6847    var propertyValue = this.imageProperties[imagePropertyKey][imagePropertiesNumber];
6848    propertyValue = propertyValue || !isNaN(propertyValue) ? propertyValue : "";
6849    switch(imagePropertyKey) {
6850     case "0" : mainElement.title = propertyValue; break;
6851     case "1" : mainElement.style.width = propertyValue + (propertyValue != "" ? "px" : ""); break;
6852     case "2" : mainElement.style.height = propertyValue + (propertyValue != "" ? "px" : ""); break;
6853    }
6854    if(enabled) {
6855     switch(imagePropertyKey) {
6856      case "3" : this.SetImageSrc(mainElement, propertyValue); break;
6857      case "4" : 
6858       this.AssignElementClassName(mainElement, "4", "8", propertyValue);
6859       break;
6860      case "5" : this.SetBackgroundPosition(mainElement, propertyValue, true); break;
6861      case "6" : this.SetBackgroundPosition(mainElement, propertyValue, false); break;
6862     }
6863    } else {
6864     switch(imagePropertyKey) {
6865      case "7" : this.SetImageSrc(mainElement, propertyValue); break;
6866      case "8" : 
6867       this.AssignElementClassName(mainElement, "4", "8", propertyValue);
6868       break;
6869      case "9" : this.SetBackgroundPosition(mainElement, propertyValue, true); break;
6870      case "10" : this.SetBackgroundPosition(mainElement, propertyValue, false); break;
6871     }
6872    }
6873   }
6874  }
6875 },
6876 SetImageSrc: function(mainElement, src) {
6877  if(src === ""){
6878   mainElement.style.backgroundImage = "";
6879   mainElement.style.backgroundPosition = "";
6880   ASPx.RemoveClassNameFromElement(mainElement, this.customImageMarkerClassName);
6881  }
6882  else{
6883   mainElement.style.backgroundImage = "url('" + src + "')";
6884   this.SetBackgroundPosition(mainElement, 0, true);
6885   this.SetBackgroundPosition(mainElement, 0, false);
6886   ASPx.AddClassNameToElement(mainElement, this.customImageMarkerClassName);
6887  }
6888 },
6889 SetBackgroundPosition: function(element, value, isX) {
6890  if(value === "") {
6891   element.style.backgroundPosition = value;
6892   return;
6893  }
6894  if(element.style.backgroundPosition === "")
6895   element.style.backgroundPosition = isX ? "-" + value.toString() + "px 0px" : "0px -" + value.toString() + "px";
6896  else {
6897   var position = element.style.backgroundPosition.split(' ');
6898   element.style.backgroundPosition = isX ? '-' + value.toString() + "px " + position[1] :  position[0] + " -" + value.toString() + "px";
6899  }
6900 },
6901 AddState: function(value, stateInputKey, imagePropertiesNumber) {
6902  this.checkBoxStates.push({
6903   "Value" : value, 
6904   "StateInputKey" : stateInputKey, 
6905   "ImagePropertiesNumber" : imagePropertiesNumber
6906  });
6907 },
6908 GetAriaCheckedValue: function(state) {
6909  switch(state) {
6910   case ASPx.CheckBoxCheckState.Checked: return "true";
6911   case ASPx.CheckBoxCheckState.Unchecked: return "false";
6912   case ASPx.CheckBoxCheckState.Indeterminate: return "mixed";
6913   default: return "";
6914  }
6915 }
6916});
6917CheckableElementStateController.Create = function(imageProperties, valueChecked, valueUnchecked, valueGrayed, allowGrayed) {
6918 var stateController = new CheckableElementStateController(imageProperties);
6919 stateController.AddState(valueChecked, CheckBoxInputKey.Checked, 0);
6920 stateController.AddState(valueUnchecked, CheckBoxInputKey.Unchecked, 1);
6921 if(typeof(valueGrayed) != "undefined")
6922  stateController.AddState(valueGrayed, CheckBoxInputKey.Indeterminate, allowGrayed ? 2 : 1);
6923 stateController.allowGrayed = allowGrayed;
6924 return stateController;
6925};
6926var CheckableElementHelper = ASPx.CreateClass(null, {
6927 InternalCheckBoxInitialize: function(internalCheckBox) {
6928  this.AttachToMainElement(internalCheckBox);
6929  this.AttachToInputElement(internalCheckBox);
6930 },
6931 AttachToMainElement: function(internalCheckBox) {
6932  var instance = this;
6933  if(internalCheckBox.mainElement) {
6934    var toggleEvent = internalCheckBox.displaySwitch ? ASPx.TouchUIHelper.touchMouseDownEventName : "click";
6935    ASPx.Evt.AttachEventToElement(internalCheckBox.mainElement, toggleEvent,
6936    function (evt) {
6937     if(ASPx.Evt.IsRightButtonPressed(evt))
6938      return;
6939     instance.InvokeClick(internalCheckBox, evt);
6940     if(!internalCheckBox.disableCancelBubble)
6941      return ASPx.Evt.PreventEventAndBubble(evt);
6942    }
6943   );
6944   ASPx.Evt.AttachEventToElement(internalCheckBox.mainElement, "mousedown",
6945    function (evt) {
6946     internalCheckBox.Refocus();
6947    }
6948   );
6949   ASPx.Evt.PreventElementDragAndSelect(internalCheckBox.mainElement, true);
6950  }
6951 },
6952 AttachToInputElement: function(internalCheckBox) {
6953  var instance = this;
6954  if(internalCheckBox.inputElement && internalCheckBox.mainElement) {
6955   var checkableElement = internalCheckBox.accessibilityCompliant ? internalCheckBox.mainElement : internalCheckBox.inputElement;
6956   ASPx.Evt.AttachEventToElement(checkableElement, "focus",
6957    function (evt) { 
6958     if(!internalCheckBox.enabled)
6959      checkableElement.blur();
6960     else
6961      internalCheckBox.OnFocus();
6962    }
6963   );
6964   ASPx.Evt.AttachEventToElement(checkableElement, "blur", 
6965    function (evt) { 
6966     internalCheckBox.OnLostFocus();
6967    }
6968   );
6969   ASPx.Evt.AttachEventToElement(checkableElement, "keyup",
6970    function (evt) { 
6971     if(ASPx.Evt.GetKeyCode(evt) == ASPx.Key.Space)
6972      instance.InvokeClick(internalCheckBox, evt);
6973    }
6974   );
6975   ASPx.Evt.AttachEventToElement(checkableElement, "keydown",
6976    function (evt) { 
6977     if(ASPx.Evt.GetKeyCode(evt) == ASPx.Key.Space)
6978      return ASPx.Evt.PreventEvent(evt);
6979    }
6980   );
6981  }
6982 },
6983 IsKBSInputWrapperExist: function() {
6984  return ASPx.Browser.Opera || ASPx.Browser.WebKitFamily;
6985 },
6986 GetICBMainElementByInput: function(icbInputElement) {
6987  return this.IsKBSInputWrapperExist() ? icbInputElement.parentNode.parentNode : icbInputElement.parentNode;
6988 },
6989 RequirePreventFocus: function() { return false; },
6990 InvokeClick: function(internalCheckBox, evt) {
6991   if(internalCheckBox.enabled && !internalCheckBox.readOnly) {
6992   var inputElementValue = internalCheckBox.inputElement.value;
6993   var focusableElement = internalCheckBox.accessibilityCompliant ? internalCheckBox.mainElement : internalCheckBox.inputElement; 
6994   if(!this.RequirePreventFocus())
6995    focusableElement.focus();
6996   if(!ASPx.Browser.IE) 
6997    internalCheckBox.inputElement.value = inputElementValue;
6998   this.InvokeClickCore(internalCheckBox, evt);
6999   }
7000 },
7001 InvokeClickCore: function(internalCheckBox, evt) {
7002  internalCheckBox.OnClick(evt);
7003 }
7004});
7005CheckableElementHelper.Instance = new CheckableElementHelper();
7006var CheckBoxInternal = ASPx.CreateClass(null, {
7007 constructor: function(inputElement, stateController, allowGrayed, allowGrayedByClick, helper, container, storeValueInInput, key, disableCancelBubble,
7008  accessibilityCompliant, displaySwitch) {
7009  this.inputElement = inputElement;
7010  this.mainElement = helper.GetICBMainElementByInput(this.inputElement);
7011  this.name = (key ? key : this.inputElement.id) + CheckBoxInternal.GetICBMainElementPostfix();
7012  this.mainElement.id = this.name;
7013  this.stateController = stateController;
7014  this.container = container;
7015  this.allowGrayed = allowGrayed;
7016  this.allowGrayedByClick = allowGrayedByClick;
7017  this.autoSwitchEnabled = true;
7018  this.displaySwitch = displaySwitch;
7019  this.storeValueInInput = !!storeValueInInput;
7020  this.storedInputKey = !this.storeValueInInput ? this.inputElement.value : null;
7021  this.disableCancelBubble = !!disableCancelBubble;
7022  this.accessibilityCompliant = accessibilityCompliant;
7023  this.focusDecoration = null;
7024  this.focused = false;
7025  this.focusLocked = false;
7026  this.enabled = !this.mainElement.className.match(/dxWeb_\w+Disabled(\b|_)/);
7027  this.readOnly = false;
7028  this.preventFocus = helper.RequirePreventFocus();
7029  this.CheckedChanged = new ASPxClientEvent();
7030  this.Focus = new ASPxClientEvent();
7031  this.LostFocus = new ASPxClientEvent();
7032  helper.InternalCheckBoxInitialize(this);
7033 },
7034 ChangeInputElementTabIndex: function() {  
7035  var changeMethod = this.enabled ? ASPx.Attr.RestoreTabIndexAttribute : ASPx.Attr.SaveTabIndexAttributeAndReset;
7036  changeMethod(this.inputElement);
7037 },
7038 CreateFocusDecoration: function(focusedStyle) {
7039   this.focusDecoration = new FocusedStyleDecoration(this);
7040   this.focusDecoration.AddStyle('F', focusedStyle[0], focusedStyle[1]);
7041   this.focusDecoration.AddPostfix("");
7042 },
7043 UpdateFocusDecoration: function() {
7044  this.focusDecoration.Update();
7045 },  
7046 StoreInputKey: function(inputKey) {
7047  if(this.storeValueInInput)
7048   this.inputElement.value = inputKey;
7049  else
7050   this.storedInputKey = inputKey;
7051 },
7052 GetStoredInputKey: function() {
7053  if(this.storeValueInInput)
7054   return this.inputElement.value;
7055  else
7056   return this.storedInputKey;
7057 },
7058 OnClick: function(e) {
7059  if(this.autoSwitchEnabled) {
7060   var currentValue = this.GetValue();
7061   var value = this.stateController.GetNextCheckBoxValue(currentValue, this.allowGrayedByClick && this.allowGrayed);
7062   this.SetValue(value);
7063  }
7064  this.CheckedChanged.FireEvent(this, e);
7065 },
7066 OnFocus: function() {
7067  if(!this.IsFocusLocked()) {
7068   this.focused = true;
7069   this.UpdateFocusDecoration();
7070   this.Focus.FireEvent(this, null);
7071  } else
7072   this.UnlockFocus();
7073 },
7074 OnLostFocus: function() {
7075  if(!this.IsFocusLocked()) {
7076   this.focused = false;
7077   this.UpdateFocusDecoration();
7078   this.LostFocus.FireEvent(this, null);
7079  }
7080 },
7081 Refocus: function() {
7082  if(this.preventFocus) return;
7083  if(this.focused) {
7084   this.LockFocus();
7085   this.inputElement.blur();
7086   if(ASPx.Browser.MacOSMobilePlatform) {
7087    window.setTimeout(function() {
7088     ASPx.SetFocus(this.inputElement);
7089    }, 100);
7090   } else {
7091    ASPx.SetFocus(this.inputElement);
7092   }
7093  }
7094 },
7095 LockFocus: function() {
7096  this.focusLocked = true;
7097 },
7098 UnlockFocus: function() {
7099  this.focusLocked = false;
7100 },
7101 IsFocusLocked: function() {
7102  if(!!ASPx.Attr.GetAttribute(this.mainElement, ASPx.Attr.GetTabIndexAttributeName()))
7103   return false;
7104  return this.focusLocked;
7105 },
7106 SetValue: function(value) {
7107  var currentValue = this.GetValue();
7108  if(currentValue !== value) {
7109   var newInputKey = this.stateController.GetInputKeyByValue(value);
7110   if(newInputKey) {
7111    this.StoreInputKey(newInputKey);   
7112    this.stateController.UpdateInternalCheckBoxDecoration(this.mainElement, newInputKey, this.enabled);
7113   }
7114  }
7115  if(this.accessibilityCompliant) {
7116   var state = this.GetCurrentCheckState();
7117   var value = this.stateController.GetAriaCheckedValue(state);
7118   if(this.mainElement.attributes["aria-checked"] !== undefined)
7119    this.mainElement.setAttribute("aria-checked", value); 
7120   if(this.mainElement.attributes["aria-selected"] !== undefined)
7121    this.mainElement.setAttribute("aria-selected", value); 
7122  }
7123 },
7124 GetValue: function() {
7125  return this.stateController.GetValueByInputKey(this.GetCurrentInputKey());
7126 },
7127 GetCurrentCheckState: function() {
7128  return this.stateController.GetCheckStateByInputKey(this.GetCurrentInputKey());
7129 },
7130 GetCurrentInputKey: function() {
7131  return this.GetStoredInputKey();
7132 },
7133 GetChecked: function() {
7134  return this.GetCurrentInputKey() === CheckBoxInputKey.Checked;
7135 },
7136 SetChecked: function(checked) {
7137  var newValue = this.stateController.GetValueByCheckState(checked ? CheckBoxCheckState.Checked : CheckBoxCheckState.Unchecked);
7138  this.SetValue(newValue);
7139 },
7140 SetEnabled: function(enabled) {
7141  if(this.enabled != enabled) {
7142   this.enabled = enabled;
7143   this.stateController.UpdateInternalCheckBoxDecoration(this.mainElement, this.GetCurrentInputKey(), this.enabled);
7144   this.ChangeInputElementTabIndex();
7145  }
7146 },
7147 GetEnabled: function() {
7148  return this.enabled;
7149 }
7150});
7151CheckBoxInternal.GetICBMainElementPostfix = function() {
7152 return "_D";
7153};
7154var CheckBoxInternalCollection = ASPx.CreateClass(CollectionBase, {
7155 constructor: function(imageProperties, allowGrayed, storeValueInInput, helper, disableCancelBubble, accessibilityCompliant) {
7156  this.constructor.prototype.constructor.call(this);
7157  this.stateController = allowGrayed 
7158   ? CheckableElementStateController.Create(imageProperties, CheckBoxInputKey.Checked, CheckBoxInputKey.Unchecked, CheckBoxInputKey.Indeterminate, true)
7159   : CheckableElementStateController.Create(imageProperties, CheckBoxInputKey.Checked, CheckBoxInputKey.Unchecked);
7160  this.helper = helper || CheckableElementHelper.Instance;
7161  this.storeValueInInput = !!storeValueInInput;
7162  this.disableCancelBubble = !!disableCancelBubble;
7163  this.accessibilityCompliant = accessibilityCompliant;
7164 },
7165 Add: function(key, inputElement, container) {
7166  this.Remove(key);
7167  var checkBox = this.CreateInternalCheckBox(key, inputElement, container);
7168  CollectionBase.prototype.Add.call(this, key, checkBox);
7169  return checkBox;
7170 },
7171 SetImageProperties: function(imageProperties) {
7172  this.stateController.imageProperties = imageProperties;
7173 },
7174 CreateInternalCheckBox: function(key, inputElement, container) {
7175  return new CheckBoxInternal(inputElement, this.stateController, this.stateController.allowGrayed, false, this.helper, container, 
7176   this.storeValueInInput, key, this.disableCancelBubble, this.accessibilityCompliant);
7177 }
7178});
7179var FocusedStyleDecoration = ASPx.CreateClass(null, {
7180 constructor: function(editor) {
7181  this.editor = editor;
7182  this.postfixList = [];
7183  this.styles = {};
7184  this.innerStyles = {};
7185 },
7186 AddPostfix: function(value) {
7187  this.postfixList.push(value);
7188 },
7189 AddStyle: function(key, className, cssText) {
7190  this.styles[key] = this.CreateRule(className, cssText);
7191  this.innerStyles[key] = this.CreateRule("", this.FilterInnerCss(cssText));
7192 },
7193 CreateRule: function(className, cssText) {
7194  return ASPx.Str.Trim(className + " " + ASPx.CreateImportantStyleRule(this.GetStyleSheet(), cssText));
7195 },
7196 GetStyleSheet: function() {
7197  return ASPx.GetCurrentStyleSheet();
7198 },
7199 FilterInnerCss: function(css) {
7200  return css.replace(/(border|background-image)[^:]*:[^;]+/gi, "");
7201 },
7202 Update: function() {
7203  for(var i = 0; i < this.postfixList.length; i++) {
7204   var postfix = this.postfixList[i];
7205   var inner = postfix.length > 0;
7206   var element = this.GetElementByPostfix(postfix);
7207   if(element)
7208    this.ApplyStyles(element, inner);
7209  }
7210 },
7211 GetElementByPostfix: function(postfix) {
7212  return ASPx.GetElementById(this.editor.name + postfix);
7213 },
7214 ApplyStyles: function(element, inner) {
7215  this.ApplyFocusedStyle(element, inner);
7216 },
7217 ApplyFocusedStyle: function(element, inner) {
7218  if(this.HasDecoration("F"))
7219   this.ApplyDecoration("F", element, inner, this.editor.focused);
7220 },
7221 HasDecoration: function(key) {
7222  return !!this.styles[key];
7223 },
7224 ApplyDecoration: function(key, element, inner, active) {
7225  var value = inner ? this.innerStyles[key] : this.styles[key];
7226  this.RemoveDecoration(element, value);
7227  if(active) {
7228   ASPx.AddClassNameToElement(element, value);
7229   if(ASPx.Browser.IE && ASPx.Browser.Version > 10 && element.border != null) 
7230    this.EnsureElementBorder(element);
7231  }
7232 },
7233 RemoveDecoration: function(element, value) {
7234  ASPx.RemoveClassNameFromElement(element, value);
7235  if(ASPx.Browser.IE && ASPx.Browser.MajorVersion >= 11)
7236   var dummy = element.offsetWidth; 
7237 },
7238 ApplyDecorationCore: function() {
7239 },
7240 EnsureElementBorder: function(element) {
7241  var border = parseInt(element.border) || 0;
7242  element.border = 1;
7243  element.border = border;
7244 }
7245});
7246var EditorStyleDecoration = ASPx.CreateClass(FocusedStyleDecoration, {
7247 constructor: function(editor) {
7248  this.constructor.prototype.constructor.call(this, editor);
7249  this.lockUpdate = false;
7250 },
7251 LockUpdate: function() {
7252  this.lockUpdate = true;
7253 },
7254 UnlockUpdate: function() {
7255  this.lockUpdate = false;
7256 },
7257 IsUpdateLocked: function() {
7258  return this.lockUpdate;
7259 },
7260 Update: function () {
7261  if(this.IsUpdateLocked())
7262   return;
7263  ASPx.FocusedStyleDecoration.prototype.Update.call(this);
7264 },
7265 ApplyStyles: function (element, inner) {
7266  this.ApplyInvalidStyle(element, inner);
7267  ASPx.FocusedStyleDecoration.prototype.ApplyStyles.call(this, element, inner);
7268 },
7269 ApplyInvalidStyle: function (element, inner) {
7270  if(this.HasDecoration("I")) {
7271   var isValid = this.editor.GetIsValid();
7272   this.ApplyDecoration("I", element, inner, !isValid);
7273  }
7274 }
7275});
7276var TextEditorStyleDecoration = ASPx.CreateClass(EditorStyleDecoration, {
7277 constructor: function(editor) {
7278  this.constructor.prototype.constructor.call(this, editor);
7279  this.nullTextClassName = "";
7280 },
7281 ApplyStyles: function(element, inner) {
7282  ASPx.EditorStyleDecoration.prototype.ApplyStyles.call(this, element, inner);
7283  this.ApplyNullTextStyle(element, inner);
7284 },
7285 ApplyNullTextStyle: function(element, inner) {
7286  if(!this.HasDecoration("N"))
7287   return;
7288  var apply = !this.editor.focused && this.editor.CanApplyNullTextDecoration();
7289  this.EnsureSpellcheckAttribute(element, apply);
7290  this.ApplyDecoration("N", element, inner, apply);
7291 },
7292 EnsureSpellcheckAttribute: function(element, apply) {
7293  if(apply)
7294   ASPx.Attr.ChangeAttribute(element, "spellcheck", "false");
7295  else
7296   ASPx.Attr.RestoreAttribute(element, "spellcheck");
7297 },
7298 ApplyNullTextClassName: function(active) {
7299  var nullTextClassName = this.GetNullTextClassName();
7300  var editorMainElement = this.editor.GetMainElement();
7301  if(active)
7302   ASPx.AddClassNameToElement(editorMainElement, nullTextClassName);
7303  else
7304   ASPx.RemoveClassNameFromElement(editorMainElement, nullTextClassName);
7305 },
7306 GetNullTextClassName: function() {
7307  if (!this.nullTextClassName)
7308   this.InitializeNullTextClassName();
7309  return this.nullTextClassName;
7310 },
7311 InitializeNullTextClassName: function() {
7312  var nullTextStyle = this.styles["N"];
7313  if (nullTextStyle) {
7314   var nullTextStyleClassNames = nullTextStyle.split(" ");
7315   for (var i = 0; i < nullTextStyleClassNames.length; i++)
7316    if (nullTextStyleClassNames[i].match("dxeNullText"))
7317     this.nullTextClassName = nullTextStyleClassNames[i];
7318  }
7319 }
7320});
7321var TouchUIHelper = {
7322 isGesture: false,
7323 isMouseEventFromScrolling: false,
7324 isNativeScrollingAllowed: true,
7325 clickSensetivity: 10,
7326 documentTouchHandlers: {},
7327 documentEventAttachingAllowed: true,
7328 msTouchDraggableClassName: "dxMSTouchDraggable",
7329 touchMouseDownEventName: ASPx.Browser.WebKitTouchUI ? "touchstart" : (ASPx.Browser.Edge && ASPx.Browser.MSTouchUI && window.PointerEvent ? "pointerdown" : "mousedown"),
7330 touchMouseUpEventName:   ASPx.Browser.WebKitTouchUI ? "touchend"   : (ASPx.Browser.Edge && ASPx.Browser.MSTouchUI && window.PointerEvent ? "pointerup" : "mouseup"),
7331 touchMouseMoveEventName: ASPx.Browser.WebKitTouchUI ? "touchmove"  : (ASPx.Browser.Edge && ASPx.Browser.MSTouchUI && window.PointerEvent ? "pointermove" : "mousemove"),
7332 isTouchEvent: function(evt) {
7333  if(!evt) return false;
7334  return ASPx.Browser.WebKitTouchUI && ASPx.IsExists(evt.changedTouches); 
7335 },
7336 isTouchEventName: function(eventName) {
7337  return ASPx.Browser.WebKitTouchUI && (eventName.indexOf("touch") > -1 || eventName.indexOf("gesture") > -1);
7338 },
7339 getEventX: function(evt) { 
7340  return ASPx.Browser.IE ? evt.pageX : evt.changedTouches[0].pageX; 
7341 },
7342 getEventY: function (evt) { 
7343  return ASPx.Browser.IE ? evt.pageY :evt.changedTouches[0].pageY; 
7344 },
7345 getWebkitMajorVersion: function(){
7346  if(!this.webkitMajorVersion){
7347   var regExp = new RegExp("applewebkit/(\\d+)", "i");
7348   var matches = regExp.exec(ASPx.Browser.UserAgent);
7349   if(matches && matches.index >= 1)
7350    this.webkitMajorVersion = matches[1];
7351  }
7352  return this.webkitMajorVersion;
7353 },
7354 getIsLandscapeOrientation: function(){
7355  if(ASPx.Browser.MacOSMobilePlatform || ASPx.Browser.AndroidMobilePlatform)
7356   return Math.abs(window.orientation) == 90;
7357  return ASPx.GetDocumentClientWidth() > ASPx.GetDocumentClientHeight();
7358 },
7359 nativeScrollingSupported: function() {
7360  var allowedSafariVersion = ASPx.Browser.Version >= 5.1 && ASPx.Browser.Version < 8; 
7361  var allowedWebKitVersion = this.getWebkitMajorVersion() >
7361 533 && (ASPx.Browser.Chrome || this.getWebkitMajorVersion() < 600);
7362  return (ASPx.Browser.MacOSMobilePlatform && (allowedSafariVersion || allowedWebKitVersion))
7363   || (ASPx.Browser.AndroidMobilePlatform && ASPx.Browser.PlaformMajorVersion >= 3) || (ASPx.Browser.MSTouchUI && (!ASPx.Browser.WindowsPhonePlatform || !ASPx.Browser.IE));
7364 },
7365 makeScrollableIfRequired: function(element, options) {
7366  if(ASPx.Browser.WebKitTouchUI && element) {
7367   var overflow = ASPx.GetCurrentStyle(element).overflow;
7368   if(element.tagName == "DIV" &&  overflow != "hidden" && overflow != "visible" ){
7369    return this.MakeScrollable(element);
7370   }
7371  }
7372 },
7373 preventScrollOnEvent: function(evt){
7374 },
7375 handleFastTapIfRequired: function(evt, action, preventCommonClickEvents) {
7376  if(ASPx.Browser.WebKitTouchUI && evt.type == 'touchstart' && action) {
7377   this.FastTapHelper.HandleFastTap(evt, action, preventCommonClickEvents);
7378   return true;
7379  }
7380  return false;
7381 },
7382 ensureDocumentSizesCorrect: function (){
7383  return (document.documentElement.clientWidth - document.documentElement.clientHeight) / (screen.width - screen.height) > 0;
7384 },
7385 ensureOrientationChanged: function(onOrientationChangedFunction){
7386  if(ASPxClientUtils.iOSPlatform || this.ensureDocumentSizesCorrect())
7387   onOrientationChangedFunction();
7388  else {
7389   window.setTimeout(function(){
7390    this.ensureOrientationChanged(onOrientationChangedFunction);
7391   }.aspxBind(this), 100);
7392  }
7393 },
7394 onEventAttachingToDocument: function(eventName, func){
7395  if(ASPx.Browser.MacOSMobilePlatform && this.isTouchEventName(eventName)) {
7396   if(!this.documentTouchHandlers[eventName])
7397    this.documentTouchHandlers[eventName] = [];
7398   this.documentTouchHandlers[eventName].push(func);
7399   return this.documentEventAttachingAllowed;
7400  }
7401  return true;
7402 },
7403 onEventDettachedFromDocument: function(eventName, func){
7404  if(ASPx.Browser.MacOSMobilePlatform && this.isTouchEventName(eventName)) {
7405   var handlers = this.documentTouchHandlers[eventName];
7406   if(handlers)
7407    ASPx.Data.ArrayRemove(handlers, func);
7408  }
7409 },
7410 processDocumentTouchEventHandlers: function(proc) {
7411  var touchEventNames = ["touchstart", "touchend", "touchmove", "gesturestart", "gestureend"];
7412  for(var i = 0; i < touchEventNames.length; i++) {
7413   var eventName = touchEventNames[i];
7414   var handlers = this.documentTouchHandlers[eventName];
7415   if(handlers) {
7416    for(var j = 0; j < handlers.length; j++) {
7417     proc(eventName,handlers[j]);
7418    }
7419   }
7420  }
7421 },
7422 removeDocumentTouchEventHandlers: function() {
7423  if(ASPx.Browser.MacOSMobilePlatform) {
7424   this.documentEventAttachingAllowed = false;
7425   this.processDocumentTouchEventHandlers(ASPx.Evt.DetachEventFromDocumentCore);
7426  }
7427 },
7428 restoreDocumentTouchEventHandlers: function () {
7429  if(ASPx.Browser.MacOSMobilePlatform) {
7430   this.documentEventAttachingAllowed = true;
7431   this.processDocumentTouchEventHandlers(ASPx.Evt.AttachEventToDocumentCore);
7432  }
7433 },
7434 IsNativeScrolling: function() {
7435  return TouchUIHelper.nativeScrollingSupported() && TouchUIHelper.isNativeScrollingAllowed;
7436 },
7437 pointerEnabled: !!(window.PointerEvent || window.MSPointerEvent),
7438 pointerDownEventName: window.PointerEvent ? "pointerdown" : "MSPointerDown",
7439 pointerUpEventName: window.PointerEvent ? "pointerup" : "MSPointerUp",
7440 pointerCancelEventName: window.PointerEvent ? "pointercancel" : "MSPointerCancel",
7441 pointerMoveEventName: window.PointerEvent ? "pointermove" : "MSPointerMove",
7442 pointerOverEventName: window.PointerEvent ? "pointerover" : "MSPointerOver",
7443 pointerOutEventName: window.PointerEvent ? "pointerout" : "MSPointerOut",
7444 pointerType: {
7445  Touch: (ASPx.Browser.IE && ASPx.Browser.Version == 10) ? 2 : "touch",
7446  Pen: (ASPx.Browser.IE && ASPx.Browser.Version == 10) ? 3 : "pen",
7447  Mouse: (ASPx.Browser.IE && ASPx.Browser.Version == 10) ? 4 : "mouse"
7448 },
7449 msGestureEnabled: !!(window.PointerEvent || window.MSPointerEvent) && typeof(MSGesture) != "undefined",
7450 msTouchCreateGesturesWrapper: function(element, onTap){
7451  if(!TouchUIHelper.msGestureEnabled) 
7452   return;
7453  var gesture = new MSGesture();
7454  gesture.target = element;
7455  ASPx.Evt.AttachEventToElement(element, TouchUIHelper.pointerDownEventName, function(evt){
7456   gesture.addPointer(evt.pointerId);
7457  });
7458  ASPx.Evt.AttachEventToElement(element, TouchUIHelper.pointerUpEventName, function(evt){
7459   gesture.stop();
7460  });
7461  if(onTap)
7462   ASPx.Evt.AttachEventToElement(element, "MSGestureTap", onTap);
7463  return gesture;
7464 }
7465};
7466var CacheHelper = {};
7467CacheHelper.GetCachedValueCore = function(obj, key, func, cacheObj, fillValueMethod) {
7468 if(!cacheObj)
7469  cacheObj = obj;
7470 if(!cacheObj.cache)
7471  cacheObj.cache = {};
7472 if(!key) 
7473  key = "default";
7474 fillValueMethod(obj, key, func, cacheObj);
7475 return cacheObj.cache[key];
7476};
7477CacheHelper.GetCachedValue = function(obj, key, func, cacheObj) {
7478 return CacheHelper.GetCachedValueCore(obj, key, func, cacheObj, 
7479  function(obj, key, func, cacheObj) {
7480   if(!ASPx.IsExists(cacheObj.cache[key]))
7481    cacheObj.cache[key] = func.apply(obj, []);
7482  });
7483};
7484CacheHelper.GetCachedElement = function(obj, key, func, cacheObj) {
7485 return CacheHelper.GetCachedValueCore(obj, key, func, cacheObj, 
7486  function(obj, key, func, cacheObj) {
7487   if(!ASPx.IsValidElement(cacheObj.cache[key]))
7488    cacheObj.cache[key] = func.apply(obj, []);
7489  });
7490};
7491CacheHelper.GetCachedElements = function(obj, key, func, cacheObj) {
7492 return CacheHelper.GetCachedValueCore(obj, key, func, cacheObj, 
7493  function(obj, key, func, cacheObj) {
7494   if(!ASPx.IsValidElements(cacheObj.cache[key])){
7495    var elements = func.apply(obj, []);
7496    if(!Ident.IsArray(elements))
7497     elements = [elements];
7498    cacheObj.cache[key] = elements;
7499   }
7500  });
7501};
7502CacheHelper.GetCachedElementById = function(obj, id, cacheObj) {
7503 return CacheHelper.GetCachedElement(obj, id, function() { return ASPx.GetElementById(id); }, cacheObj);
7504};
7505CacheHelper.GetCachedChildById = function(obj, parent, id, cacheObj) {
7506 return CacheHelper.GetCachedElement(obj, id, function() { return ASPx.GetChildById(parent, id); }, cacheObj);
7507};
7508CacheHelper.DropCachedValue = function(cacheObj, key) {
7509 cacheObj.cache[key] = null;
7510};  
7511CacheHelper.DropCache = function(cacheObj) {
7512 cacheObj.cache = null;
7513};  
7514var DomObserver = ASPx.CreateClass(null, {
7515 constructor: function() {
7516  this.items = { };
7517 },
7518 subscribe: function(elementID, callbackFunc) {
7519  var item = this.items[elementID];
7520  if(item)
7521   this.unsubscribe(elementID);
7522  item = {
7523   elementID: elementID,
7524   callbackFunc: callbackFunc,
7525   pauseCount: 0
7526  };
7527  this.prepareItem(item);
7528  this.items[elementID] = item;
7529 },
7530 prepareItem: function(item) {
7531 },
7532 unsubscribe: function(elementID) {
7533  this.items[elementID] = null;
7534 },
7535 getItemElement: function(item) {
7536  var element = this.getElementById(item.elementID);
7537  if(element)
7538   return element;
7539  this.unsubscribe(item.elementID);
7540  return null;
7541 },
7542 getElementById: function(elementID) {
7543  var element = document.getElementById(elementID);
7544  return element && ASPx.IsValidElement(element) ? element : null;
7545 },
7546 pause: function(element, includeSubtree) {
7547  this.changeItemsState(element, includeSubtree, true);
7548 },
7549 resume: function(element, includeSubtree) {
7550  this.changeItemsState(element, includeSubtree, false);
7551 },
7552 forEachItem: function(processFunc, context) {
7553  context = context || this;
7554  for(var itemName in this.items) {
7555   if(!this.items.hasOwnProperty(itemName))
7556    continue;
7557   var item = this.items[itemName];
7558   if(item) {
7559    var needBreak = processFunc.call(context, item);
7560    if(needBreak)
7561     return;
7562   }
7563  }
7564 },
7565 changeItemsState: function(element, includeSubtree, pause) {
7566  this.forEachItem(function(item) {
7567   if(!element)
7568    this.changeItemState(item, pause);
7569   else {
7570    var itemElement = this.getItemElement(item);
7571    if(itemElement && (element == itemElement || (includeSubtree && ASPx.GetIsParent(element, itemElement)))) {
7572     this.changeItemState(item, pause);
7573     if(!includeSubtree)
7574      return true;
7575    }
7576   }
7577  }.aspxBind(this));
7578 },
7579 changeItemState: function(item, pause) {
7580  if(pause)
7581   this.pauseItem(item);
7582  else
7583   this.resumeItem(item);
7584 },
7585 pauseItem: function(item) {
7586  item.paused = true;
7587  item.pauseCount++;
7588 },
7589 resumeItem: function(item) {
7590  if(item.pauseCount > 0) {
7591   if(item.pauseCount == 1)
7592    item.paused = false;
7593   item.pauseCount--;
7594  }
7595 }
7596});
7597DomObserver.IsMutationObserverAvailable = function() {
7598 return !!window.MutationObserver;
7599};
7600var TimerObserver = ASPx.CreateClass(DomObserver, {
7601 constructor: function() {
7602  this.constructor.prototype.constructor.call(this);
7603  this.timerID = -1;
7604  this.observationTimeout = 300;
7605 },
7606 subscribe: function(elementID, callbackFunc) {
7607  DomObserver.prototype.subscribe.call(this, elementID, callbackFunc);
7608  if(!this.isActivated())
7609   this.startObserving();
7610 },
7611 isActivated: function() {
7612  return this.timerID !== -1;
7613 },
7614 startObserving: function() {
7615  if(this.isActivated())
7616   window.clearTimeout(this.timerID);
7617  this.timerID = window.setTimeout(this.onTimeout, this.observationTimeout);
7618 },
7619 onTimeout: function() {
7620  var observer = _aspxGetDomObserver();
7621  observer.doObserve();
7622  observer.startObserving();
7623 },
7624 doObserve: function() {
7625  if(!ASPx.documentLoaded) return;
7626  this.forEachItem(function(item) {
7627   if(!item.paused)
7628    this.doObserveForItem(item);
7629  }.aspxBind(this));
7630 },
7631 doObserveForItem: function(item) {
7632  var element = this.getItemElement(item);
7633  if(element)
7634   item.callbackFunc.call(this, element);
7635 }
7636});
7637var MutationObserver = ASPx.CreateClass(DomObserver, {
7638 constructor: function() {
7639  this.constructor.prototype.constructor.call(this);
7640  this.callbackTimeout = 10;
7641 },
7642 prepareItem: function(item) {
7643  item.callbackTimerID = -1;
7644  var target = this.getElementById(item.elementID);
7645  if(!target)
7646   return;
7647  var observerCallbackFunc = function() {
7648   if(item.callbackTimerID === -1) {
7649    var timeoutHander = function() {
7650     item.callbackTimerID = -1;
7651     item.callbackFunc.call(this, target);
7652    }.aspxBind(this);
7653    item.callbackTimerID = window.setTimeout(timeoutHander, this.callbackTimeout);
7654   }
7655  }.aspxBind(this);
7656  var observer = new window.MutationObserver(observerCallbackFunc);
7657  var config = { attributes: true, childList: true, characterData: true, subtree: true };
7658  observer.observe(target, config);
7659  item.observer = observer;
7660  item.config = config;
7661 },
7662 unsubscribe: function(elementID) {
7663  var item = this.items[elementID];
7664  if(item) {
7665   item.observer.disconnect();
7666   item.observer = null;
7667  }
7668  DomObserver.prototype.unsubscribe.call(this, elementID);
7669 },
7670 pauseItem: function(item) {
7671  DomObserver.prototype.pauseItem.call(this, item);
7672  item.observer.disconnect();
7673 },
7674 resumeItem: function(item) {
7675  DomObserver.prototype.resumeItem.call(this, item);
7676  if(!item.paused) {
7677   var target = this.getItemElement(item);
7678   if(target)
7679    item.observer.observe(target, item.config);
7680  }
7681 }
7682});
7683var domObserver = null;
7684function _aspxGetDomObserver() {
7685 if(domObserver == null)
7686  domObserver = DomObserver.IsMutationObserverAvailable() ? new MutationObserver() : new TimerObserver();
7687 return domObserver;
7688}
7689var ControlUpdateWatcher = ASPx.CreateClass(null, {
7690 constructor: function() {
7691  this.helpers = { };
7692  this.clearLockerTimerID = -1;
7693  this.clearLockerTimerDelay = 15;
7694  this.postProcessing = false;
7695  this.init();
7696 },
7697 init: function() {
7698  var postHandler = aspxGetPostHandler();
7699  postHandler.Post.AddHandler(this.OnPost, this);
7700 },
7701 Add: function(helper) {
7702  this.helpers[helper.GetName()] = helper;
7703 },
7704 CanSendCallback: function(dxCallbackOwner, arg) {
7705  this.LockConfirmOnBeforeWindowUnload();
7706  var modifiedHelpers = this.FilterModifiedHelpersByDXCallbackOwner(this.GetModifiedHelpers(), dxCallbackOwner, arg);
7707  if(modifiedHelpers.length === 0) return true;
7708  var modifiedHelpersInfo = this.GetToConfirmAndToResetLists(modifiedHelpers, dxCallbackOwner.name);
7709  if(!modifiedHelpersInfo) return true;
7710  if(modifiedHelpersInfo.toConfirm.length === 0) {
7711   this.ResetClientChanges(modifiedHelpersInfo.toReset);
7712   return true;
7713  }
7714  var helper = modifiedHelpersInfo.toConfirm[0];
7715  if(!confirm(helper.GetConfirmUpdateText()))
7716   return false;
7717  this.ResetClientChanges(modifiedHelpersInfo.toReset);
7718  return true;
7719 },
7720 OnPost: function(s, e) {
7721  if(e.isDXCallback) return;
7722  this.postProcessing = true;
7723  this.LockConfirmOnBeforeWindowUnload();
7724  var modifiedHelpersInfo = this.GetModifedHelpersInfo(e);
7725  if(!modifiedHelpersInfo) return;
7726  if(modifiedHelpersInfo.toConfirm.length === 0) {
7727   this.ResetClientChanges(modifiedHelpersInfo.toReset);
7728   return;
7729  }
7730  var helper = modifiedHelpersInfo.toConfirm[0];
7731  if(!confirm(helper.GetConfirmUpdateText())) {
7732   e.cancel = true;
7733   this.finishPostProcessing();
7734  }
7735  if(!e.cancel)
7736   this.ResetClientChanges(modifiedHelpersInfo.toReset);
7737 },
7738 finishPostProcessing: function() {
7739  this.postProcessing = false;
7740 },
7741 GetModifedHelpersInfo: function(e) {
7742  var modifiedHelpers = this.FilterModifiedHelpers(this.GetModifiedHelpers(), e);
7743  if(modifiedHelpers.length === 0) return;
7744  return this.GetToConfirmAndToResetLists(modifiedHelpers, e && e.ownerID);
7745 },
7746 GetToConfirmAndToResetLists: function(modifiedHelpers, ownerID) {
7747  var resetList = [ ];
7748  var confirmList = [ ];
7749  for(var i = 0; i < modifiedHelpers.length; i++) {
7750   var helper = modifiedHelpers[i];
7751   if(!helper.GetConfirmUpdateText()) { 
7752    resetList.push(helper);
7753    continue;
7754   }
7755   if(helper.CanShowConfirm(ownerID)) { 
7756    resetList.push(helper);
7757    confirmList.push(helper);
7758   }
7759  }
7760  return { toConfirm: confirmList, toReset: resetList };
7761 },
7762 FilterModifiedHelpers: function(modifiedHelpers, e) {
7763  if(modifiedHelpers.length === 0)
7764   return [ ];
7765  if(this.RequireProcessUpdatePanelCallback(e))
7766   return this.FilterModifiedHelpersByUpdatePanels(modifiedHelpers);
7767  if(this.postProcessing)
7768   return this.FilterModifiedHelpersByPostback(modifiedHelpers);
7769  return modifiedHelpers;
7770 },
7771 FilterModifiedHelpersByDXCallbackOwner: function(modifiedHelpers, dxCallbackOwner, arg) {
7772  var result = [ ];
7773  for(var i = 0; i < modifiedHelpers.length; i++) {
7774   var helper = modifiedHelpers[i];
7775   if(helper.NeedConfirmOnCallback(dxCallbackOwner, arg))
7776    result.push(helper);
7777  }
7778  return result;
7779 },
7780 FilterModifiedHelpersByUpdatePanels: function(modifiedHelpers) {
7781  var result = [ ];
7782  var updatePanels = this.GetUpdatePanelsWaitedForUpdate();
7783  for(var i = 0; i < updatePanels.length; i++) {
7784   var panelID = updatePanels[i].replace(/\$/g, "_");
7785   var panel = ASPx.GetElementById(panelID);
7786   if(!panel) continue;
7787   for(var j = 0; j < modifiedHelpers.length; j++) {
7788    var helper = modifiedHelpers[j];
7789    if(ASPx.GetIsParent(panel, helper.GetControlMainElement()))
7790     result.push(helper);
7791   }
7792  }
7793  return result;
7794 },
7795 FilterModifiedHelpersByPostback: function(modifiedHelpers) {
7796  var result = [ ];
7797  for(var i = 0; i < modifiedHelpers.length; i++) {
7798   var helper = modifiedHelpers[i];
7799   if(helper.NeedConfirmOnPostback())
7800    result.push(helper);
7801  }
7802  return result;
7803 },
7804 RequireProcessUpdatePanelCallback: function(e) {
7805  var rManager = this.GetMSRequestManager();
7806  if(rManager && e && e.isMSAjaxCallback)
7807   return rManager._postBackSettings.async;
7808  return false;
7809 },
7810 GetUpdatePanelsWaitedForUpdate: function() {
7811  var rManager = this.GetMSRequestManager();
7812  if(!rManager) return [ ];
7813  var panelUniqueIDs = rManager._postBackSettings.panelsToUpdate || [ ];
7814  var panelClientIDs = [ ];
7815  for(var i = 0; i < panelUniqueIDs.length; i++) {
7816   var index = ASPx.Data.ArrayIndexOf(rManager._updatePanelIDs, panelUniqueIDs[i]);
7817   if(index >= 0)
7818    panelClientIDs.push(rManager._updatePanelClientIDs[index]);
7819  }
7820  return panelClientIDs;
7821 },
7822 GetMSRequestManager: function() {
7823  return ASPx.GetMSAjaxRequestManager();
7824 },
7825 GetModifiedHelpers: function() {
7826  var result = [ ];
7827  for(var key in this.helpers) { 
7828   if(this.helpers.hasOwnProperty(key)) {
7829    var helper = this.helpers[key];
7830    if(helper.HasChanges())
7831     result.push(helper);
7832   }
7833  }
7834  return result;
7835 },
7836 ResetClientChanges: function(modifiedHelpers) {
7837  for(var i = 0; i < modifiedHelpers.length; i++)
7838   modifiedHelpers[i].ResetClientChanges();
7839 },
7840 GetConfirmUpdateMessage: function() {
7841  if(this.confirmOnWindowUnloadLocked) return;
7842  var modifiedHelpersInfo = this.GetModifedHelpersInfo();
7843  if(!modifiedHelpersInfo || modifiedHelpersInfo.toConfirm.length === 0) 
7844   return;
7845  var helper = modifiedHelpersInfo.toConfirm[0];
7846  return helper.GetConfirmUpdateText();
7847 },
7848 LockConfirmOnBeforeWindowUnload: function() {
7849  this.confirmOnWindowUnloadLocked = true;
7850  this.clearLockerTimerID = ASPx.Timer.ClearTimer(this.clearLockerTimerID);
7851  this.clearLockerTimerID = window.setTimeout(function() {
7852   this.confirmOnWindowUnloadLocked = false;
7853  }.aspxBind(this), this.clearLockerTimerDelay);
7854 },
7855 OnWindowBeforeUnload: function(e) {
7856  var confirmMessage = this.GetConfirmUpdateMessage();
7857  if(confirmMessage)
7858   e.returnValue = confirmMessage;
7859  this.finishPostProcessing();
7860  return confirmMessage;
7861 },
7862 OnWindowUnload: function(e) {
7863  if(this.confirmOnWindowUnloadLocked) return;
7864  var modifiedHelpersInfo = this.GetModifedHelpersInfo();
7865  if(!modifiedHelpersInfo) return;
7866  this.ResetClientChanges(modifiedHelpersInfo.toReset);
7867 },
7868 OnMouseDown: function(e) {
7869  if(ASPx.Browser.IE)
7870   this.PreventBeforeUnloadOnLinkClick(e);
7871 },
7872 OnFocusIn: function(e) {
7873  if(ASPx.Browser.IE)
7874   this.PreventBeforeUnloadOnLinkClick(e);
7875 },
7876 PreventBeforeUnloadOnLinkClick: function(e) {
7877  if(ASPx.GetObjectKeys(this.helpers).length == 0)
7878   return;
7879  var link = ASPx.GetParentByTagName(ASPx.Evt.GetEventSource(e), "A");
7880  if(!link || link.dxgvLinkClickHanlderAssigned)
7881   return;
7882  var url = ASPx.Attr.GetAttribute(link, "href");
7883  if(!url || url.indexOf("javascript:") < 0)
7884   return;
7885  ASPx.Evt.AttachEventToElement(link, "click", function(ev) { return ASPx.Evt.PreventEvent(ev); });
7886  link.dxgvLinkClickHanlderAssigned = true;
7887 }
7888});
7889ControlUpdateWatcher.Instance = null;
7890ControlUpdateWatcher.getInstance = function () {
7891 if (!ControlUpdateWatcher.Instance) {
7892  ControlUpdateWatcher.Instance = new ControlUpdateWatcher();
7893  ASPx.Evt.AttachEventToElement(window, "beforeunload", function(e) {
7894   return ControlUpdateWatcher.Instance.OnWindowBeforeUnload(e);
7895  });
7896  ASPx.Evt.AttachEventToElement(window, "unload", function(e) {
7897   ControlUpdateWatcher.Instance.OnWindowUnload(e);
7898  });
7899  ASPx.Evt.AttachEventToDocument("mousedown", function(e) {
7900   ControlUpdateWatcher.Instance.OnMouseDown(e);
7901  });
7902  ASPx.Evt.AttachEventToDocument("focusin", function(e) {
7903   ControlUpdateWatcher.Instance.OnFocusIn(e);
7904  });
7905 }
7906 return ControlUpdateWatcher.Instance;
7907};
7908var UpdateWatcherHelper = ASPx.CreateClass(null, {
7909 constructor: function(owner) {
7910  this.owner = owner;
7911  this.ownerWatcher = ControlUpdateWatcher.getInstance();
7912  this.ownerWatcher.Add(this);
7913 },
7914 GetName: function() {
7915  return this.owner.name;
7916 },
7917 GetControlMainElement: function() {
7918  return this.owner.GetMainElement();
7919 },
7920 GetControlParentForm: function(){
7921  return ASPx.GetParentByTagName(this.GetControlMainElement(), "FORM");
7922 },
7923 CanShowConfirm: function(requestOwnerID) {
7924  return true;
7925 },
7926 HasChanges: function() {
7927  return false;
7928 },
7929 GetConfirmUpdateText: function() {
7930  return "";
7931 },
7932 NeedConfirmOnCallback: function(dxCallbackOwner) {
7933  return true;
7934 },
7935 NeedConfirmOnPostback: function() {
7936  if(ASPx.IsUploadSubmitRequest)
7937   return !ASPx.IsUploadSubmitRequest(this.GetControlParentForm(
7937));
7938  return true;
7939 },
7940 ResetClientChanges: function() {
7941 },
7942 ConfirmOnCustomControlEvent: function() {
7943  var confirmMessage = this.GetConfirmUpdateText();
7944  if(confirmMessage)
7945   return confirm(confirmMessage);
7946  return false;
7947 }
7948});
7949var ControlCallbackHandlersQueue = ASPx.CreateClass(null, {
7950 constructor: function (owner) {
7951  this.owner = owner;
7952  this.handlerInfos = [];
7953 },
7954 addCallbackHandler: function(handlerInfo) {
7955  this.handlerInfos.push(handlerInfo);
7956 },
7957 executeCallbacksHandlers: function() {
7958  for(var i = 0, handlerInfo; handlerInfo = this.handlerInfos[i]; i++)
7959   handlerInfo.handler.call(this.owner, handlerInfo.result);
7960  this.handlerInfos = [];
7961 }
7962});
7963var ControlCallbackQueueHelper = ASPx.CreateClass(null, {
7964 constructor: function (owner) {
7965  this.owner = owner;
7966  this.pendingCallbacks = [];
7967  this.receivedCallbacks = [];
7968  this.attachEvents();
7969 },
7970 showLoadingElements: function () {
7971  this.owner.ShowLoadingDiv();
7972  if (this.owner.IsCallbackAnimationEnabled())
7973   this.owner.StartBeginCallbackA
7973nimation();
7974  else
7975   this.owner.ShowLoadingElementsInternal();
7976 },
7977 attachEvents: function () {
7978  this.owner.EndCallback.AddHandler(this.onEndCallback.aspxBind(this));
7979  this.owner.CallbackError.AddHandler(this.onCallbackError.aspxBind(this));
7980 },
7981 detachEvents: function () {
7982  this.owner.EndCallback.RemoveHandler(this.onEndCallback);
7983  this.owner.CallbackError.RemoveHandler(this.onCallbackError);
7984 },
7985 onCallbackError: function (owner, result) {
7986  this.sendErrorToChildControl(result);
7987 },
7988 ignoreDuplicates: function () {
7989  return true;
7990 },
7991 hasDuplicate: function (arg) {
7992  for (var i in this.pendingCallbacks) {
7993   if (this.pendingCallbacks[i].arg == arg && this.pendingCallbacks[i].state != ASPx.callbackState.aborted)
7994    return true;
7995  }
7996  return false;
7997 },
7998 getToken: function (halperContext, callbackInfo) {
7999  return {
8000   cancel: function () {
8001    if (callbackInfo.state == ASPx.callbackState.sent) {
8002     callbackInfo.state = ASPx.callbackState.aborted;
8003     halperContext.sendNext();
8004    }
8005    if (callbackInfo.state == ASPx.callbackState.inTurn)
8006     ASPx.Data.ArrayRemove(halperContext.pendingCallbacks, callbackInfo);
8007   },
8008   callbackId: -1
8009  };
8010 },
8011 sendCallback: function (arg, handlerContext, handler, commandName, onBeforeSend) {
8012  if (this.ignoreDuplicates() && this.hasDuplicate(arg))
8013   return false;
8014  var handlerContext = handlerContext || this.owner;
8015  var callbackInfo = {
8016   arg: arg,
8017   handlerContext: handlerContext,
8018   handler: handler || handlerContext.OnCallback,
8019   state: ASPx.callbackState.inTurn,
8020   callbackId: -1,
8021   onBeforeSend: onBeforeSend
8022  };
8023  this.pendingCallbacks.push(callbackInfo);
8024  if (!this.hasActiveCallback()) {
8025   this.createCallbackByCallbackInfo(callbackInfo, commandName);
8026  }
8027  return this.getToken(this, callbackInfo);
8028 },
8029 hasActiveCallback: function () {
8030  return this.getCallbacksInfoByState(ASPx.callbackState.sent).length > 0;
8031 },
8032 sendNext: function () {
8033  var nextCallbackInfo = this.getCallbacksInfoByState(ASPx.callbackState.inTurn)[0];
8034  if (nextCallbackInfo) {
8035   this.createCallbackByCallbackInfo(nextCallbackInfo);
8036   return nextCallbackInfo.callbackId;
8037  }
8038 },
8039 createCallbackByCallbackInfo: function(callbackInfo, commandName) {
8040  if(callbackInfo.onBeforeSend)
8041   callbackInfo.onBeforeSend();
8042  callbackInfo.callbackId = this.owner.CreateCallback(callbackInfo.arg, commandName);
8043  callbackInfo.state = ASPx.callbackState.sent;
8044 },
8045 onEndCallback: function () {
8046  if (!this.owner.isErrorOnCallback && this.hasPendingCallbacks()) {
8047   var curCallbackId;
8048   var curCallbackInfo;
8049   var handlerContext;
8050   for (var i in this.receivedCallbacks) {
8051    if(this.receivedCallbacks.hasOwnProperty(i)) {
8052     curCallbackId = this.receivedCallbacks[i];
8053     curCallbackInfo = this.getCallbackInfoById(curCallbackId);
8054     if (curCallbackInfo.state != ASPx.callbackState.aborted) {
8055      handlerContext = curCallbackInfo.handlerContext;
8056      if (handlerContext.OnEndCallback)
8057       handlerContext.OnEndCallback();
8058      this.sendNext();
8059     }
8060     ASPx.Data.ArrayRemove(this.pendingCallbacks, curCallbackInfo);
8061    }
8062   }
8063   ASPx.Data.ArrayClear(this.receivedCallbacks);
8064  }
8065 },
8066 hasPendingCallbacks: function () {
8067  return this.pendingCallbacks && this.pendingCallbacks.length && this.pendingCallbacks.length > 0;
8068 },
8069 processCallback: function (result, callbackId) {
8070  this.receivedCallbacks.push(callbackId);
8071  if (this.hasPendingCallbacks()) {
8072   var callbackInfo = this.getCallbackInfoById(callbackId);
8073   if (callbackInfo.state != ASPx.callbackState.aborted)
8074    callbackInfo.handler.call(callbackInfo.handlerContext, result);
8075  }
8076 },
8077 getCallbackInfoById: function (id) {
8078  for (var i in this.pendingCallbacks) {
8079   if (this.pendingCallbacks[i].callbackId == id)
8080    return this.pendingCallbacks[i];
8081  }
8082 },
8083 getCallbacksInfoByState: function (state) {
8084  var result = [];
8085  for (var i in this.pendingCallbacks) {
8086   if (this.pendingCallbacks[i].state == state)
8087    result.push(this.pendingCallbacks[i]);
8088  }
8089  return result;
8090 },
8091 sendErrorToChildControl: function (callbackObj) {
8092  if (!this.hasPendingCallbacks())
8093   return;
8094  var callbackInfo = this.getCallbackInfoById(callbackObj.callbackId || 0);
8095  if (!callbackInfo)
8096   return;
8097  var hasChildControlHandler = (callbackInfo.handlerContext != this.owner) && callbackInfo.handlerContext.OnCallbackError;
8098  if (hasChildControlHandler)
8099   callbackInfo.handlerContext.OnCallbackError.call(callbackInfo.handlerContext, callbackObj.message, callbackObj.data);
8100 }
8101});
8102var AccessibilityHelperBase = ASPx.CreateClass(null, {
8103 constructor: function(control) {
8104  this.control = control;
8105  this.timerID = -1;
8106  this.pronounceMessageTimeout = 500;
8107  this.activeItem = this.getItems()[0];
8108  this.pronounceIsStarted = false;
8109 },
8110 PronounceMessage: function(text, activeItemArgs, inactiveItemArgs, mainElementArgs, ownerMainElement) {   
8111  this.timerID = ASPx.Timer.ClearTimer(this.timerID);
8112  this.pronounceIsStarted = true;
8113  this.timerID = window.setTimeout(function() {
8114   this.PronounceMessageCore(text, activeItemArgs, inactiveItemArgs, mainElementArgs, ownerMainElement);
8115  }.aspxBind(this), this.getPronounceTimeout());
8116 },
8117 PronounceMessageCore: function(text, activeItemArgs, inactiveItemArgs, mainElementArgs, ownerMainElement) {
8118  if(!this.getItems())
8119   return;
8120  this.toogleItem();
8121  var mainElement = this.getMainElement();
8122  var activeItem = this.getItem(true);
8123  var inactiveItem = this.getItem();
8124  if(ASPx.Attr.GetAttribute(mainElement, "role") != "application")
8125   mainElementArgs = this.addArguments(mainElementArgs, { "aria-activedescendant" : activeItem.id });
8126  var messageAttrObj = {};
8127  var activeItemRole = ASPx.Attr.GetAttribute(activeItem, "role");
8128  var attrName = activeItemRole == "combobox" ? "aria-label" : "innerHtml";
8129  messageAttrObj[attrName] = ASPx.Str.EncodeHtml(text);
8130  activeItemArgs = this.addArguments(activeItemArgs, messageAttrObj);
8131  messageAttrObj[attrName] = "";
8132  inactiveItemArgs = this.addArguments(inactiveItemArgs, messageAttrObj);
8133  var errorTextElement = null;
8134  if(this.control.GetErrorCell()) {
8135   errorTextElement = this.getAriaExplanatoryTextManager().GetErrorTextElement();
8136   activeItemArgs = this.addArguments(activeItemArgs,   {"aria-invalid"  : !this.control.isValid ? "true" : "" });
8137   mainElementArgs = this.addArguments(mainElementArgs, { "aria-invalid" : "" });
8138   inactiveItemArgs = this.addArguments(inactiveItemArgs,  { "aria-invalid" : "" });
8139  }
8140  this.changeActivityAttributes(activeItem, activeItemArgs);
8141  if(errorTextElement) {
8142   this.getAriaExplanatoryTextManager().SetOrRemoveText([activeItem], errorTextElement, !this.control.isValid, false, true);
8143   this.getAriaExplanatoryTextManager().SetOrRemoveText([mainElement, inactiveItem], errorTextElement, false, false, false);
8144  }
8145  this.changeActivityAttributes(mainElement, mainElementArgs);
8146  if(!!ownerMainElement && ASPx.Attr.GetAttribute(ownerMainElement, "role") != "application")
8147   this.changeActivityAttributes(ownerMainElement, { "aria-activedescendant": activeItem.id });
8148  this.changeActivityAttributes(inactiveItem, inactiveItemArgs);
8149  this.pronounceIsStarted = false;
8150 },
8151 GetActiveElement: function(inputIsMainElement) {
8152  if(this.pronounceIsStarted) return null;
8153  var mainElement = inputIsMainElement ? this.control.GetInputElement() : this.getMainElement();
8154  var activeElementId = ASPx.Attr.GetAttribute(mainElement, 'aria-activedescendant');
8155  return activeElementId ? ASPx.GetElementById(activeElementId) : mainElement;
8156 },
8157 getMainElement: function() {
8158  if(!ASPx.IsExistsElement(this.mainElement))
8159   this.mainElement = this.control.GetAccessibilityAssistantElement();
8160  return this.mainElement;
8161 },
8162 getItems: function() {
8163  if(!ASPx.IsExistsElement(this.items))
8164   this.items = ASPx.GetChildElementNodes(this.getMainElement());
8165  return this.items;
8166 },
8167 getItem: function(isActive) {
8168  if(isActive)
8169   return this.activeItem;
8170  var items = this.getItems();
8171  return items[0] === this.activeItem ? items[1] : items[0];
8172 },
8173 getAriaExplanatoryTextManager: function() { return this.control.ariaExplanatoryTextManager; },
8174 getPronounceTimeout: function() { return this.pronounceMessageTimeout; },
8175 toogleItem: function() {
8176  this.activeItem = this.getItem();
8177 },
8178 addArguments: function(targetArgs, newArgs) {
8179  if(!targetArgs) targetArgs = { };
8180  for(var key in newArgs) {
8181   if(newArgs.hasOwnProperty(key) && !targetArgs.hasOwnProperty(key))
8182    targetArgs[key] = newArgs[key];
8183  }
8184  return targetArgs;
8185 },
8186 changeActivityAttributes: function(element, args) {
8187  if(!element)
8188   return;
8189  for(var key in args) {
8190   if(args.hasOwnProperty(key)) {
8191    var value = args[key];
8192    if(key == "innerHtml")
8193     ASPx.SetInnerHtml(element, value);
8194    else {
8195     var action = value !== "" ? ASPx.Attr.SetAttribute : ASPx.Attr.RemoveAttribute;
8196     action(element, key, value);
8197    }
8198   }
8199  }
8200 }
8201});
8202var AccessibilityPronouncer = ASPx.CreateClass(null, {
8203 constructor: function() {
8204  this.pronouncerId = "dxPronouncer";
8205  this.initialized = false;
8206  this.focusableMessageElement = null;
8207  this.messageElement = null;
8208  this.pronouncers = {
8209   live: new AccessibilityLivePronouncer(this),
8210   descendant: new AccessibilityDescendantPronouncer(this)
8211  };
8212 },
8213 Pronounce: function(args, type) {
8214  this.pronouncers[type].Pronounce(args);
8215 },
8216 EnsureInitialize: function() {
8217  if(!this.initialized)
8218   this.initialize();
8219 },
8220 RemoveState: function() {
8221  for(var pronouncer in this.pronouncers)
8222   if(this.pronouncers.hasOwnProperty(pronouncer))
8223    pronouncer.RemoveState();
8224 },
8225 RestoreControlState: function(type, mainElement) {
8226  this.pronouncers[type].RestoreControlState(mainElement);
8227 },
8228 RestoreElementsState: function(type, elements) {
8229  this.pronouncers[type].RestoreElementsState(elements);
8230 },
8231 RestoreElementState: function(type, element) {
8232  this.pronouncers[type].RestoreElementState(element);
8233 },
8234 initialize: function() {
8235  this.createFocusableMessageElement();
8236  this.createMessageElement();
8237  this.prepareFocusableMessageElement();
8238  this.setAttributesForKeyboardNavigation();
8239  this.initialized = true;
8240 },
8241 createFocusableMessageElement: function() {
8242  var focusableMessageElement = document.createElement("DIV");
8243  document.body.appendChild(focusableMessageElement);
8244  this.focusableMessageElement = focusableMessageElement;   
8245 },
8246 prepareFocusableMessageElement: function() {
8247  this.focusableMessageElement.className = "dxAIFME";
8248 },
8249 setAttributesForKeyboardNavigation: function() {
8250  ASPx.Attr.Aria.SetApplicationRole(this.focusableMessageElement);
8251  ASPx.Attr.Aria.SetSilence(this.focusableMessageElement);
8252 },
8253 createMessageElement: function() {
8254  var messageElement = document.createElement("DIV");
8255  messageElement.id = this.pronouncerId;
8256  ASPx.Attr.SetAttribute(messageElement, "role", "note");
8257  this.focusableMessageElement.appendChild(messageElement);
8258  this.messageElement = messageElement;
8259 },
8260 getMessage: function(messagePartsArg) {
8261  var messageParts = messagePartsArg.filter(function(x) { return ASPx.IsExists(x); });
8262  return messageParts.join(", ");
8263 }
8264});
8265var AccessibilityPronouncerBase = ASPx.CreateClass(null, {
8266 constructor: function() {
8267  this.state = { };
8268 },
8269 Pronounce: function(args) {
8270  var messageElement = this.getMessageElement();
8271  ASPx.Attr.Aria.SetOrRemoveLabel(messageElement);
8272  ASPx.SetInnerHtml(messageElement, "");
8273  this.PronounceCore(args);
8274 },
8275 PronounceCore: function(args) { },
8276 SaveElementState: function(element) { 
8277  if(this.state[element.id])
8278   return;
8279  this.state[element.id] = {
8280   element: element,
8281   descendant: ASPx.Attr.GetAttribute(element, ASPx.Attr.Aria.descendant)
8282  };
8283 },
8284 RemoveState: function() {
8285  this.state = { };
8286 },
8287 RestoreControlState: function(mainElement) { 
8288  for(var elementInfo in this.state) {
8289   if(this.state.hasOwnProperty(elementInfo)) {
8290    var element = this.state[elementInfo].element;
8291    if(!mainElement || ASPx.GetIsParent(mainElement, element))
8292     this.RestoreElementState(element);
8293   }
8294  }
8295 },
8296 RestoreElementsState: function(elements) { 
8297  for(var i = 0; i < elements.length; i++)
8298   this.RestoreElementState(elements[i]);
8299 },
8300 RestoreElementState: function(element) {
8301  var elementState = this.state[element.id];
8302  if(!elementState)
8303   return;
8304  ASPx.Attr.Aria.SetOrRemoveDescendant(element, elementState.descendant);
8305  delete this.state[element.id];
8306 },
8307 getMessage: function(args) {
8308  return ASPx.AccessibilityPronouncer.getMessage(args.messageParts);
8309 },
8310 getMessageElement: function() {
8311  return ASPx.AccessibilityPronouncer.messageElement;
8312 },
8313 getFocusableMessageElement: function() {
8314   return ASPx.AccessibilityPronouncer.focusableMessageElement;
8315 }
8316});
8317var AccessibilityLivePronouncer = ASPx.CreateClass(AccessibilityPronouncerBase, {
8318 constructor: function() {
8319  this.constructor.prototype.constructor.call(this);
8320 },
8321 PronounceCore: function(args) {
8322  var message = this.getMessage(args);
8323  var messageElement = this.getMessageElement();
8324  ASPx.Attr.SetAttribute(this.getFocusableMessageElement(), "aria-live", "assertive");
8325  ASPx.Attr.Aria.SetAtomic(this.getFocusableMessageElement(), "true");
8326  ASPx.SetInnerHtml(messageElement, ASPx.Str.EncodeHtml(message));
8327 }
8328});
8329var AccessibilityDescendantPronouncer = ASPx.CreateClass(AccessibilityPronouncerBase, {
8330 constructor: function() {
8331  this.constructor.prototype.constructor.call(this);
8332 },
8333 PronounceCore: function(args) {
8334  var message = this.getMessage(args);
8335  var activeElement = ASPx.GetActiveElement();
8336  var messageElement = this.getMessageElement();
8337  this.SaveElementState(activeElement);
8338  ASPx.Attr.RemoveAttribute(this.getFocusableMessageElement(), "aria-live");
8339  ASPx.Attr.RemoveAttribute(this.getFocusableMessageElement(), "aria-atomic");
8340  ASPx.Attr.Aria.SetOrRemoveLabel(messageElement, message);
8341  ASPx.Attr.Aria.SetOrRemoveDescendant(activeElement, messageElement.id);
8342 }
8343});
8344ASPx.AccessibilityPronouncerType = {
8345 live: "live",
8346 descendant: "descendant"
8347};
8348ASPx.AccessibilityPronouncer = new AccessibilityPronouncer();
8349var RestoreFocusHelper = ASPx.CreateClass(null, {
8350 constructor: function() {
8351  this.excludedIDs = [ "DXCBtn" ]; 
8352  this.pronouncerType = ASPx.AccessibilityPronouncerType.live;
8353  this.callbackQueue = [];
8354  this.Initialize();
8355 },
8356 Initialize: function() {
8357  var that = this;
8358  ASPx.Evt.AttachEventToDocumentCore("DOMContentLoaded", function() {
8359   ASPxClientControl.GetControlCollection().BeginCallback.AddHandler(that.OnBeginCallback, that);
8360   ASPxClientControl.GetControlCollection().EndCallback.AddHandler(that.OnEndCallback, that);
8361  });
8362 },
8363 OnBeginCallback: function(s, e) {
8364  var control = e.control;
8365  if(!control.allowRestoreFocusOnCallbacks())
8366   return;
8367  control.accessibilityFocusTreeLine = this.getFocusTreeLine(control);
8368  var controlHasCallbackTreeLine = this.callbackQueueContainsTreeLine(control);
8369  this.pushTreeLineInfoIntoCallbackQueue(control);
8370  if(control.accessibilityFocusTreeLine && !controlHasCallbackTreeLine)
8371   control.SendMessageToAssistiveTechnology(this.getDefaultCallbackMessage());
8372 },
8373 OnEndCallback: function(s, e) {
8374  var control = e.control;
8375  if(!control.allowRestoreFocusOnCallbacks())
8376   return;
8377  var treeLineInfo = this.shiftTreeLineInfoFromCallbackQueue(control);
8378  if(treeLineInfo.queueLength == 0) {
8379   if(!control.accessibilityFocusTreeLine && treeLineInfo.treeLine)
8380    control.accessibilityFocusTreeLine = treeLineInfo.treeLine;
8381   var focusElement = this.findFocusElement(control);
8382   if(!this.handleActivePopupWindow(focusElement))
8383    ASPx.AccessibilityUtils.SetFocusAccessible(focusElement);
8384   delete control.accessibilityFocusTreeLine;
8385  }
8386 },
8387 pushTreeLineInfoIntoCallbackQueue: function(control) {
8388  var controlTreeLine = control.accessibilityFocusTreeLine ? control.accessibilityFocusTreeLine.slice(0) : null;
8389  if(!this.callbackQueue[control.name])
8390   this.callbackQueue[control.name] = [];
8391  this.callbackQueue[control.name].push(controlTreeLine);
8392 },
8393 shiftTreeLineInfoFromCallbackQueue: function(control) {
8394  var treeLineInfo = { queueLength: 0, treeLine: null };
8395  var treeLines = this.callbackQueue[control.name];
8396  if(treeLines && treeLines.length > 0) {
8397   treeLineInfo.treeLine = treeLines.shift();
8398   var linesCount = treeLines.length;
8399   treeLineInfo.queueLength = linesCount;
8400   if(linesCount > 0 && !treeLines[0] && treeLineInfo.treeLine)
8401    treeLines[0] = treeLineInfo.treeLine.slice(0);
8402  }
8403  return treeLineInfo;
8404 },
8405 callbackQueueContainsTreeLine: function(control) {
8406  var treeLines = this.callbackQueue[control.name];
8407  if(!treeLines || treeLines.length == 0) 
8408   return false;
8409  if(treeLines[treeLines.length - 1])
8410   return true;
8411  return false;
8412 },
8413 getDefaultCallbackMessage: function() {
8414  return ASPx.AccessibilitySR.DefaultCallbackMessage;
8415 },
8416 handleActivePopupWindow: function(focusElement) {
8417  if(!ASPx.GetPopupControlCollection)
8418   return false;
8419  var activePopupWindow = ASPx.GetPopupControlCollection().GetCurrentActiveWindowElement();
8420  if(activePopupWindow) {
8421   var popupInfo = ASPx.GetPopupControlCollection().GetPopupWindowFromID(activePopupWindow.id);
8422   if(!popupInfo.popupControl.accessibleFocusElement) {
8423    if(popupInfo.popupControl.setFocusOnCallback)
8424     popupInfo.popupControl.accessibleFocusElement = focusElement;
8425    else {
8426     var parentControl = popupInfo.popupControl.GetParentControl();
8427     if(parentControl && parentControl.GetMainElement())
8428      popupInfo.popupControl.accessibleFocusElement = ASPx.FindFirstChildActionElement(parentControl.GetMainElement());
8429    }
8430    return true;
8431   }
8432  }
8433  return false;
8434 },
8435 getFocusTreeLine: function(control) {
8436  var element = document.activeElement;
8437  var mainElement = control.GetMainElement();
8438  if(!ASPx.GetIsParent(mainElement, element)) {
8439   var treeInfo = this.findFocusedControlElement(mainElement, element);
8440   element = treeInfo.focusElement;
8441   mainElement = treeInfo.rootElement;
8442  }
8443  return this.getTreeLineCore(mainElement, element);
8444 },
8445 getTreeLineCore: function(mainElement, element) {
8446  if(!element) return null;
8447  treeLine = [ ];
8448  while(element) {
8449   treeLine.push({ 
8450    id: element.id,
8451    tagName: element.tagName,
8452    index: ASPx.Data.ArrayIndexOf(element.parentNode.childNodes, element)
8453   });
8454   if(element === mainElement || element === document.body)
8455    break;
8456   element = element.parentNode;
8457  }
8458  return treeLine;
8459 },
8460 findFocusedControlElement: function(mainElement, activeElement) {
8461  var element = null;
8462  var parentElement = mainElement;
8463  var focusedEditor = ASPx.IsExists(ASPx.GetFocusedEditor) ? ASPx.GetFocusedEditor() : null;
8464  if(focusedEditor && ASPx.GetIsParent(mainElement, focusedEditor.GetMainElement()))
8465   element = focusedEditor.GetFocusableInputElement();
8466  else {
8467   if(mainElement && activeElement) {
8468    var mainControl = ASPx.GetClientControlByElementID(mainElement.id);
8469    var parentControls = ASPx.GetParentClientControls(activeElement.id);
8470    for(var i = parentControls.length - 1; i > -1; i--) {   
8471     if(mainControl.name == parentControls[i].name) {
8472      element = activeElement;
8473      var rootIndex = i > 0 ? i - 1 : i;
8474      parentElement = parentControls[rootIndex].GetMainElement();
8475      if(!parentElement && parentControls[rootIndex].GetCurrentWindowElement)
8476       parentElement = parentControls[rootIndex].GetCurrentWindowElement();
8477      break;
8478     }
8479    }
8480   }
8481  }
8482  return { focusElement: element, rootElement: parentElement }; 
8483 },
8484 findFocusElement: function(control) {
8485  if(!control.accessibilityFocusTreeLine)
8486   return;
8487  var treeLine = control.accessibilityFocusTreeLine.slice(0);
8488  var focusElementParent = this.findFocusElementParentById(treeLine);
8489  if(!focusElementParent) 
8490   return;
8491  return this.findFocusElementFromDOMTree(treeLine, focusElementParent);
8492 },
8493 findFocusElementParentById: function(treeLine) {
8494  for(var i = 0; i < treeLine.length; i++) {
8495   var id = treeLine[i].id;
8496   if(!this.isValidId(id))
8497    continue;
8498   var element = document.getElementById(id);
8499   if(element) {
8500    treeLine.splice(i, treeLine.length - i);
8501    treeLine.reverse();
8502    return element;
8503   }
8504  }
8505  return null;
8506 },
8507 findFocusElementFromDOMTree: function(treeLine, focusElementParent) {
8508  var element = focusElementParent;
8509  for(var i = 0; i < treeLine.length; i++) {
8510   var info = treeLine[i];
8511   if(info.index >= element.childNodes.length) {
8512    element = element.childNodes.length > 0 ? element.childNodes[element.childNodes.length - 1] : null;
8513    return this.findNeighbourFocusElement(element, focusElementParent);
8514   }
8515   var child = element.childNodes[info.index];
8516   if(child.tagName !== info.tagName)
8517    return this.findNeighbourFocusElement(child, focusElementParent);
8518   element = child;
8519  }
8520  return element;
8521 },
8522 findNeighbourFocusElement: function(element, focusElementParent) {
8523  if(!element || !element.parentNode) return null;
8524  var neighbours = element.parentNode.childNodes;
8525  var indices = this.calcLeftRightIndices(ASPx.Data.ArrayIndexOf(neighbours, element), neighbours.length);
8526  for(var i = 0; i < indices.length; i++) {
8527   var index = indices[i];
8528   var actionElement = ASPx.FindFirstChildActionElement(neighbours[index]);
8529   if(actionElement)
8530    return actionElement;
8531  }
8532  if(element === focusElementParent)
8533   return null;
8534  return this.findNeighbourFocusElement(element.parentNode, focusElementParent);
8535 },
8536 calcLeftRightIndices: function(startIndex, count) {
8537  var indices = [ ];
8538  var incSides = [ 0, 0 ];
8539  var index = startIndex;
8540  for(var i = 0; i < count; i++) {
8541   indices.push(index);
8542   var even = i % 2 === 0;
8543   var nextIndex = this.calcNextIndex(startIndex, count, incSides, even);
8544   if(nextIndex < 0)
8545    nextIndex = this.calcNextIndex(startIndex, count, incSides, !even);
8546   index = nextIndex;
8547  }
8548  return indices;
8549 },
8550 calcNextIndex: function(startIndex, count, incSides, even) {
8551  var sideIndex = even ? 0 : 1;
8552  var inc = incSides[sideIndex];
8553  inc += even ? -1 : 1;
8554  var nextIndex = startIndex + inc;
8555  if(nextIndex >= 0 && nextIndex < count) {
8556   incSides[sideIndex] = inc;
8557   return nextIndex;
8558  }
8559  return -1;
8560 },
8561 isValidId: function(id) {
8562  return id && !this.isExcludedId(id);
8563 },
8564 isExcludedId: function(id) {
8565  var result = false;
8566  for(var i = 0; i < this.excludedIDs.length; i++) {
8567   if(id.indexOf(this.excludedIDs[i]) > -1) {
8568    result = true;
8569    break;
8570   }
8571  }
8572  return result;
8573 }
8574});
8575var EventStorage = ASPx.CreateClass(null, {
8576 constructor: function() {
8577  this.bag = { };
8578 },
8579 Save: function(e, data, overwrite) {
8580  var key = this.getEventKey(e);
8581  if(this.bag.hasOwnProperty(key) && !overwrite)
8582   return;
8583  this.bag[key] = data;
8584  window.setTimeout(function() { delete this.bag[key]; }.aspxBind(this), 100);
8585 },
8586 Load: function(e) {
8587  var key = this.getEventKey(e);
8588  return this.bag[key];
8589 },
8590 getEventKey: function(e) {
8591  if(ASPx.IsExists(e.timeStamp))
8592   return e.timeStamp.toString();
8593  var eventSource = ASPx.Evt.GetEventSource(e);
8594  var type = e.type.toString();
8595  return eventSource ? type + "_" + eventSource.uniqueID.toString() : type;
8596 }
8597});
8598ASPx.RestoreFocusHelper = new RestoreFocusHelper();
8599EventStorage.Instance = null;
8600EventStorage.getInstance = function() {
8601 if(!EventStorage.Instance)
8602  EventStorage.Instance = new EventStorage();
8603 return EventStorage.Instance;
8604};
8605var GetGlobalObject = function(objectName) {
8606 var fields = objectName.split('.');
8607 var obj = window[fields[0]];
8608 for(var i = 1;
8608 obj && i < fields.length; i++) {
8609  obj = obj[fields[i]];
8610 }
8611 return obj;
8612};
8613var GetExternalScriptProcessor = function() {
8614 return ASPx.ExternalScriptProcessor ? ASPx.ExternalScriptProcessor.getInstance() : null;
8615};
8616var SAVED_WIDTH_ATTR = "data-dx-ripple-saved-width";
8617var RIPPLE_FIXED_ROW_ATTR = "data-dx-ripple-locked";
8618var READ_ONLY_COMBOBOX_MARKER_CSS_CLASS = "dxICBReadonlyMarker";
8619var ThemesWithRipple = ['Material'];
8620var RippleHelper = {
8621 rippleTargetClassName: "dxRippleTarget",
8622 rippleTargetExternalClassName: "dxRippleTargetExternal",
8623 rippleContainerClassName: "dxRippleContainer",
8624 rippleClassName: "dxRipple",
8625 touchRadius: -1,
8626 isMobileExternalRipple: null,
8627 zoom: 1,
8628 Init: function() {
8629  if(this.getIsRippleFunctionalityEnabled()) {
8630   setTimeout(function() {
8631    this.calcTouchRadius();
8632   }.aspxBind(this), 0);
8633  }
8634 },
8635 calcTouchRadius: function() {
8636  var testBlock = document.createElement("DIV");
8637  ASPx.SetStyles(testBlock, {
8638   height: "1in",
8639   width: "1in",
8640   left: "-100%",
8641   top: "-100%",
8642   position: "absolute"
8643  });
8644  document.body.appendChild(testBlock);
8645  this.touchRadius = (1.8 / 2.54) * Math.max(testBlock.offsetWidth, testBlock.offsetHeight);
8646  document.body.removeChild(testBlock);
8647 },
8648 isRippleFunctionalityEnabled: null,
8649 checkRippleFunctionality: function() {
8650  if(ASPx.Browser.Safari && ASPx.Browser.Version <= 5.1)
8651   return false;
8652  for(var i = 0; i < ThemesWithRipple.length; i++) {
8653   var firstRippleThemeElement = document.querySelector("[class*='_" + ThemesWithRipple[i] + "']");
8654   if(firstRippleThemeElement)
8655    return true;
8656  }  
8657  return false;
8658 },
8659 ReInit: function() {
8660  this.isRippleFunctionalityEnabled = null;
8661  this.Init();
8662 },
8663 onDocumentMouseDown: function(evt) {
8664  if(RippleHelper.getIsRippleFunctionalityEnabled())
8665   RippleHelper.processMouseDown(evt);
8666 },
8667 getIsRippleFunctionalityEnabled: function() {
8668  if(!ASPx.IsExists(this.isRippleFunctionalityEnabled))
8669   this.isRippleFunctionalityEnabled = this.checkRippleFunctionality();
8670  return this.isRippleFunctionalityEnabled;
8671 },
8672   createTargetInfo: function(target) {
8673  return { 
8674   x: ASPx.GetAbsoluteX(target),
8675   y: ASPx.GetAbsoluteY(target),
8676   width: target.offsetWidth,
8677   height: target.offsetHeight,
8678   classNames: ASPx.GetClassNameList(target),
8679   getTarget: function() { return target; },
8680   getRect: function() { return {x: this.x, y: this.y, width: this.width, height: this.height }; }
8681  };
8682 },
8683 createEventInfo: function(evt) {
8684  return { x: this.getEventX(evt), y: this.getEventY(evt) };
8685 },
8686 processMouseDown: function(evt) {
8687  var evtSource = ASPx.Evt.GetEventSource(evt);
8688  var rippleTarget = this.getRippleTargetElement(evtSource);
8689  if(this.needToProcessRipple(rippleTarget, evtSource))
8690   this.processRipple(this.createTargetInfo(rippleTarget), this.createEventInfo(evt));
8691 },
8692 getRippleTargetElement: function(evtSource) {
8693  if(this.hasRippleMarker(evtSource))
8694   return evtSource;
8695  if(evtSource.tagName && evtSource.tagName.toLowerCase() == "input" && ASPx.ElementContainsCssClass(evtSource, "dxTI")) {
8696   var elements = ASPx.GetChildElementNodesByPredicate(evtSource.parentNode.parentNode, function(element) {
8697    return this.hasRippleMarker(element);
8698   }.aspxBind(this));
8699   return elements && elements[0];
8700  }
8701  return ASPx.GetParent(evtSource, function(element) {
8702   return this.hasRippleMarker(element);
8703  }.aspxBind(this));
8704 },
8705 hasRippleMarker: function(element) {
8706  if(!ASPx.IsExistsElement(element))
8707   return false;
8708  var computedStyles = window.getComputedStyle(element, ":before");
8709  if(ASPx.IsExists(computedStyles)) {
8710   var content = computedStyles.getPropertyValue("content");
8711   if(content.indexOf(this.rippleTargetExternalClassName) > -1) {
8712    ASPx.AddClassNameToElement(element, this.rippleTargetExternalClassName);
8713    return true;
8714   }
8715   return content.indexOf(this.rippleTargetClassName) > -1;
8716  }
8717  return false;
8718 },
8719 needToProcessRipple: function(rippleTarget, evtSource) {
8720  if(!rippleTarget || !ASPx.AnimationUtils)
8721   return false;
8722  var isClearButton = ASPx.ElementContainsCssClass(rippleTarget, "dxeButton") && rippleTarget.id && rippleTarget.id.indexOf("B-100") !== -1;
8723  var isEmptyCalendarDay = ASPx.ElementContainsCssClass(rippleTarget, "dxeCalendarDay") && ASPx.Str.Trim(rippleTarget.textContent) == "";
8724  var isReadonly = ASPx.ElementContainsCssClass(rippleTarget, READ_ONLY_COMBOBOX_MARKER_CSS_CLASS);
8725  var tempFixDisable = ASPx.ElementContainsCssClass(rippleTarget, "dxSwitcher") && ASPx.Browser.MacOSMobilePlatform;
8726  var rippleIsForbidden = isReadonly || isClearButton || isEmptyCalendarDay || ASPx.GetParentByPartialClassName(rippleTarget, "Disabled") ||
8727   ASPx.ElementContainsCssClass(rippleTarget, "dxgvBatchEditCell") || ASPx.ElementContainsCssClass(rippleTarget, "dxcvEditForm") ||
8728   ASPx.GetParentByPartialClassName(evtSource, "dxcvFocusedCell") || tempFixDisable;
8729  return !rippleIsForbidden;
8730 },
8731 hasBothOverflow: function(style) {
8732  return style.overflow == "scroll" || style.overflow == "auto" || style.overflow == "hidden";
8733 },
8734 hasOverflowX: function(style) {
8735  return style.overflowX == "scroll" || style.overflowX == "auto" || style.overflowX == "hidden";
8736 },
8737 hasOverflowY: function(style) {
8738  return style.overflowY == "scroll" || style.overflowY == "auto" || style.overflowY == "hidden";
8739 },
8740 getExternalRippleContainerSize: function(targetRect) {
8741  if(ASPx.Browser.MobileUI) {
8742   var origTouchRadius = this.getOriginTouchRadius();
8743   if(origTouchRadius < targetRect.width || origTouchRadius < targetRect.height)
8744    origTouchRadius = Math.max(targetRect.width, targetRect.height);
8745   return {x: targetRect.x + (targetRect.width - origTouchRadius) / 2, y: targetRect.y + (targetRect.height - origTouchRadius) / 2, width: origTouchRadius, height: origTouchRadius };
8746  }
8747  var result = { x: 0, y: 0, width: 0, height: 0 };
8748  var diff = targetRect.width - targetRect.height;
8749  if(diff > 0) {
8750   result.x = targetRect.x;
8751   result.y = targetRect.y - diff / 2;
8752   result.width = targetRect.width;
8753   result.height = targetRect.width;
8754  } else {
8755   result.x = targetRect.x + diff / 2;
8756   result.y = targetRect.y;
8757   result.width = targetRect.height;
8758   result.height = targetRect.height;
8759  }
8760  return result;
8761 },
8762 getInternalContainerSize: function(targetInfo) {
8763  var parentWithOverflow = RippleHelper.getParentWithOverflow(targetInfo.getTarget());
8764  if(!ASPx.IsExists(parentWithOverflow))
8765   return targetInfo;
8766  var parentWithOverflowStyle = ASPx.GetCurrentStyle(parentWithOverflow);
8767  var bothOverflow = this.hasBothOverflow(parentWithOverflowStyle);
8768  var overflowX = this.hasOverflowX(parentWithOverflowStyle);
8769  var overflowY = this.hasOverflowY(parentWithOverflowStyle);
8770  var parentRect = {
8771   x: ASPx.GetAbsoluteX(parentWithOverflow),
8772   y: ASPx.GetAbsoluteY(parentWithOverflow),
8773   width: parentWithOverflow.offsetWidth,
8774   height: parentWithOverflow.offsetHeight
8775  };
8776  return this.getInternalContainerSizeCore(targetInfo, parentRect, bothOverflow, overflowX, overflowY);
8777 },
8778 getInternalContainerSizeCore: function(targetRect, parentRect, bothOverflow, overflowX, overflowY) {
8779  var result = {};
8780  ASPx.Data.MergeHashTables(result, targetRect);
8781  if(bothOverflow || overflowX) {
8782   result.x = targetRect.x < parentRect.x ? parentRect.x : targetRect.x;
8783   if(targetRect.x + targetRect.width > parentRect.x + parentRect.width)
8784    result.width = parentRect.x + parentRect.width - targetRect.x;
8785   if(parentRect.x > targetRect.x)
8786    result.width -= (parentRect.x - targetRect.x);
8787  }
8788  if(bothOverflow || overflowY) {
8789   result.y = targetRect.y < parentRect.y ? parentRect.y : targetRect.y;
8790   if(targetRect.y + targetRect.height > parentRect.y + parentRect.height)
8791    result.height = parentRect.y + parentRect.height - targetRect.y;
8792   if(parentRect.y > targetRect.y)
8793    result.height -= (parentRect.y - targetRect.y);
8794  }
8795  return result;
8796 },
8797 calculateRippleContainerSize: function(targetInfo, isExternalRipple) {
8798  return isExternalRipple ? this.getExternalRippleContainerSize(targetInfo) : this.getInternalContainerSize(targetInfo);
8799 },
8800 getParentWithOverflow: function(rippleTarget) {
8801  var result = ASPx.GetParent(rippleTarget, function(element) {
8802   var elementStyle = ASPx.GetCurrentStyle(element);
8803   return this.hasBothOverflow(elementStyle) || this.hasOverflowX(elementStyle) || this.hasOverflowY(elementStyle);
8804  }.aspxBind(this));
8805  return result;
8806 },
8807 getDuration: function(targetInfo) {
8808  return this.IsExternalRipple(targetInfo) || ASPx.Browser.MobileUI ? 650 : 450;
8809 },
8810 createRippleTransition: function(container, rippleElement, radius, targetInfo) {
8811  var rippleSize = 2 * radius;
8812  var transitionEndIsAborted = true;
8813  var transitionProperties = {
8814   width: { from: 0, to: rippleSize, transition: ASPx.AnimationConstants.Transitions.RIPPLE, propName: "width", unit: "px" },
8815   height: { from: 0, to: rippleSize, transition: ASPx.AnimationConstants.Transitions.RIPPLE, propName: "height", unit: "px" },
8816   marginLeft: { from: 0, to: -rippleSize / 2, transition: ASPx.AnimationConstants.Transitions.RIPPLE, propName: "marginLeft", unit: "px" },
8817   marginTop: { from: 0, to: -rippleSize / 2, transition: ASPx.AnimationConstants.Transitions.RIPPLE, propName: "marginTop", unit: "px" },
8818   opacity: { from: 1, to: 0.05, transition: ASPx.AnimationConstants.Transitions.RIPPLE, propName: "o
8818pacity", unit: "%" }
8819  };
8820  var rippleTransition = ASPx.AnimationUtils.createMultipleAnimationTransition(rippleElement, {
8821   transition: ASPx.AnimationConstants.Transitions.RIPPLE,
8822   duration: this.getDuration(targetInfo),
8823   onComplete: function() {
8824    this.RemoveRippleContainer(container.parentElement);
8825    transitionEndIsAborted = false;
8826   }.bind(this)
8827  });
8828  rippleTransition.Start(transitionProperties);
8829  window.setTimeout(function() {
8830   if(transitionEndIsAborted)
8831    this.RemoveRippleContainer(container.parentElement);
8832  }.bind(this), 500);
8833 },
8834 calculateRadius: function(isExternalRipple, posX, posY, containerRect) {
8835  var radius = -1;
8836  if(isExternalRipple) {
8837   if(ASPx.Browser.MobileUI)
8838    radius = this.getOriginTouchRadius() / 2;
8839   else
8840    radius = Math.max(containerRect.height, containerRect.width);
8841  } else {
8842   var width1 = posX - containerRect.x;
8843   var width2 = containerRect.width - width1;
8844   var height1 = posY - containerRect.y;
8845   var height2 = containerRect.height - height1;
8846   var rippleWidth = Math.max(width1, width2);
8847   var rippleHeight = Math.max(height1, height2);
8848   radius = Math.sqrt(Math.pow(rippleHeight, 2) + Math.pow(rippleWidth, 2));
8849  }
8850  return radius;
8851 },
8852 createRippleElement: function(container, rippleCenter) {
8853  var rippleElement = document.createElement("DIV");
8854  rippleElement.className = this.rippleClassName;
8855  container.appendChild(rippleElement);
8856  ASPxClientUtils.SetAbsoluteX(rippleElement, rippleCenter.x);
8857  ASPxClientUtils.SetAbsoluteY(rippleElement, rippleCenter.y);
8858  return rippleElement;
8859 },
8860 processRipple: function(targetInfo, eventInfo) {
8861  this.initRippleProcess();
8862  var isExternalRipple = this.IsExternalRipple(targetInfo);
8863  var rippleCenter = this.getRippleCenter(targetInfo.getRect(), eventInfo, isExternalRipple);
8864  var container = this.createRippleContainer(targetInfo, isExternalRipple);
8865  var rippleElement = this.createRippleElement(container, rippleCenter);
8866  var radius = this.calculateRadius(isExternalRipple, rippleCenter.x, rippleCenter.y, this.getElementRect(container));
8867  this.createRippleTransition(container, rippleElement, radius, targetInfo);
8868 },
8869 initRippleProcess: function() {
8870  this.isMobileExternalRipple = null;
8871  this.zoom = screen.width / window.innerWidth;
8872 },
8873 getRippleCenter: function(targetInfo, eventInfo, isExternalRipple) {
8874  var posX = 0;
8875  var posY = 0;
8876  if(isExternalRipple) {
8877   posX = targetInfo.x + targetInfo.width / 2;
8878   posY = targetInfo.y + targetInfo.height / 2;
8879  } else {
8880   posX = eventInfo.x;
8881   posY = eventInfo.y;
8882  }
8883  return {x: posX, y: posY};
8884 },
8885 createRippleContainer: function(targetInfo, isExternalRipple) {
8886  var containerParent = targetInfo.getTarget();
8887  if(!containerParent)
8888   return;
8889  var containerTagName = containerParent.tagName == "TR" ? "TD" : "DIV";
8890  var container = document.createElement(containerTagName);
8891  container.className = this.rippleContainerClassName;
8892  if(containerParent.parentNode && containerParent.tagName == "IMG")
8893   containerParent = containerParent.parentNode;
8894  if(this.isARowInFixedLayoutTable(containerParent))
8895   this.lockFixedLayoutTableSizes(containerParent);
8896  containerParent.appendChild(container);
8897  if(isExternalRipple)
8898   container.style.borderRadius = "50%";
8899  var containerRect = this.calculateRippleContainerSize(targetInfo, isExternalRipple);
8900  this.assignContainerSettings(container, containerRect);
8901  return container;
8902 },
8903 isARowInFixedLayoutTable: function(containerParent) {
8904  if(containerParent.tagName !== "TR")
8905   return false;
8906  var parentTable = this.getParentTable(containerParent);
8907  return parentTable && ASPx.GetCurrentStyle(parentTable)["table-layout"] === "fixed";
8908 },
8909 processFirstRowOfFixedTable: function(containerRow, rowAction, cellAction) {
8910  var firstRow = this.getFirstRow(containerRow);
8911  rowAction(firstRow);
8912  var cells = ASPx.Data.CollectionToArray(firstRow.cells);
8913  cells.forEach(cellAction);
8914 },
8915 getParentTable: function(element) {
8916  var parentTable = element;
8917  while(parentTable && parentTable.tagName !== "TABLE")
8918   parentTable = parentTable.parentElement;
8919  return parentTable;
8920 },
8921 lockFixedLayoutTableSizes: function(containerRow) {
8922  var firstRow = this.getFirstRow(containerRow);
8923  if(this.incLockCount(firstRow) === 1) {
8924   var cells = ASPx.Data.CollectionToArray(firstRow.cells);
8925   var widths = cells.map(function(cell) { return cell.style.width; });
8926   var computedWidths = cells.map(function(cell) {
8927    if(ASPx.Browser.IE && ASPx.ElementHasCssClass(cell, "dxeCM"))
8928     return cell.offsetWidth + "px";
8929    return window.getComputedStyle(cell).width;
8930   });
8931   var fixWidth = function(cell, i) {
8932    if(ASPx.Attr.IsExistsAttribute(cell, SAVED_WIDTH_ATTR))
8933     return;
8934    if(widths[i])
8935     ASPx.Attr.SetAttribute(cell, SAVED_WIDTH_ATTR, widths[i]);
8936    cell.style.width = computedWidths[i];
8937   };
8938   cells.forEach(fixWidth);
8939  }
8940 }, 
8941 unlockFixedLayoutTableSizes: function(containerRow) {
8942  var firstRow = this.getFirstRow(containerRow);   
8943  if(this.decLockCount(firstRow) === 0) {
8944   var cells = ASPx.Data.CollectionToArray(firstRow.cells);
8945   var restoreState = function(cell) {
8946    if(ASPx.Attr.IsExistsAttribute(cell, SAVED_WIDTH_ATTR)) {
8947     cell.style.width = ASPx.Attr.GetAttribute(cell, SAVED_WIDTH_ATTR);
8948     ASPx.Attr.RemoveAttribute(cell, SAVED_WIDTH_ATTR);
8949    } else {
8950     cell.style.width = null;
8951    }
8952   };
8953   cells.forEach(restoreState);
8954  }
8955 },
8956 getFirstRow: function(containerRow) { return ASPx.GetChildByTagName(containerRow.parentElement, "TR", 0); },
8957 incLockCount: function(elem) { return this.changeLockCount(elem, 1); },
8958 decLockCount: function(elem) { return this.changeLockCount(elem, -1); },
8959 changeLockCount: function(elem, diff) {
8960  var lockCounter = this.getLockCount(elem);
8961  lockCounter += diff;
8962  lockCounter = Math.max(0, lockCounter);
8963  if(lockCounter === 0)
8964   ASPx.Attr.RemoveAttribute(elem, RIPPLE_FIXED_ROW_ATTR);
8965  else
8966   ASPx.Attr.SetAttribute(elem, RIPPLE_FIXED_ROW_ATTR, lockCounter);
8967  return lockCounter;
8968 },
8969 getLockCount: function(lockElement) {
8970  var attrValue = ASPx.Attr.GetAttribute(lockElement, RIPPLE_FIXED_ROW_ATTR);
8971  return parseInt(attrValue) || 0;
8972 },
8973 assignContainerSettings: function(container, containerRect) {
8974  var properties = {
8975   height: containerRect.height,
8976   width: containerRect.width,
8977   left: ASPx.PrepareClientPosForElement(containerRect.x, container, true),
8978   top: ASPx.PrepareClientPosForElement(containerRect.y, container, false)
8979  };
8980  if(ASPx.Browser.MobileUI)
8981   ASPx.Data.MergeHashTables(properties, {marginTop: 0, marginLeft: 0 });
8982  ASPx.SetStyles(container, properties, ASPx.Browser.MobileUI);
8983 },
8984 IsExternalRipple: function(targetInfo) {
8985  var hasExternalRippleClassName = ASPx.ElementContainsCssClass(targetInfo.getTarget(), this.rippleTargetExternalClassName);
8986  if(!ASPx.Browser.MobileUI)
8987   return hasExternalRippleClassName;
8988  return hasExternalRippleClassName || this.IsMobileExternalRipple(targetInfo);
8989 },
8990 IsMobileExternalRipple: function(targetInfo) {
8991  if(this.isMobileExternalRipple == null) {
8992   var originTouchRadius = this.getOriginTouchRadius();
8993   this.isMobileExternalRipple = ASPx.Browser.MobileUI && targetInfo.width < originTouchRadius && targetInfo.height < originTouchRadius;
8994  }
8995  return this.isMobileExternalRipple;
8996 },
8997 RemoveRippleContainer: function(element) {
8998  if(!element)
8999   return;
9000  var childs = ASPx.GetChildNodesByClassName(element, this.rippleContainerClassName);
9001  var rippleContainer = childs.length > 0 ? childs[0] : null;
9002  if(rippleContainer != null) {
9003   var containerParent = rippleContainer.parentNode;
9004   containerParent.removeChild(rippleContainer);
9005   if(this.isARowInFixedLayoutTable(containerParent))
9006    this.unlockFixedLayoutTableSizes(containerParent);
9007  }
9008 },
9009 getEventX: function(evt) {
9010  return ASPxClientUtils.GetEventX(evt);
9011 },
9012 getEventY: function(evt) {
9013  return ASPxClientUtils.GetEventY(evt);
9014 },
9015 getOriginTouchRadius: function() {
9016  return this.touchRadius / this.zoom;
9017 },
9018 getElementRect: function(element) {
9019  return { x: ASPx.GetAbsoluteX(element), y: ASPx.GetAbsoluteY(element), width: element.offsetWidth, height: element.offsetHeight };
9020 }
9021};
9022var AccessibilitySR = {
9023 AddStringResources: function(stringResourcesObj) {
9024  if(stringResourcesObj) {
9025   for(var key in stringResourcesObj)
9026    if(stringResourcesObj.hasOwnProperty(key))
9027     this[key] = stringResourcesObj[key];
9028  }
9029 }
9030};
9031ASPx.CollectionBase = CollectionBase;
9032ASPx.FunctionIsInCallstack = _aspxFunctionIsInCallstack;
9033ASPx.RaisePostHandlerOnPost = aspxRaisePostHandlerOnPost;
9034ASPx.GetPostHandler = aspxGetPostHandler;
9035ASPx.ProcessScriptsAndLinks = _aspxProcessScriptsAndLinks;
9036ASPx.InitializeLinks = _aspxInitializeLinks;
9037ASPx.InitializeScripts = _aspxInitializeScripts;
9038ASPx.RunStartupScripts = _aspxRunStartupScripts;
9039ASPx.IsStartupScriptsRunning = _aspxIsStartupScriptsRunning;
9040ASPx.AddScriptsRestartHandler = _aspxAddScriptsRestartHandler;
9041ASPx.GetFocusedElement = _aspxGetFocusedElement;
9042ASPx.GetDomObserver = _aspxGetDomObserver;
9043ASPx.CacheHelper = CacheHelper;
9044ASPx.ControlTree = ControlTree;
9045ASPx.ControlCallbackHandlersQueue = ControlCallbackHandlersQueue;
9046ASPx.ResourceManager = ResourceManager;
9047ASPx.UpdateWatcherHelper = UpdateWatcherHelper;
9048ASPx.EventStorage = EventStorage;
9049ASPx.GetGlobalObject = GetGlobalObject;
9050ASPx.GetExternalScriptProcessor = GetExternalScriptProcessor;
9051ASPx.CheckBoxCheckState = CheckBoxCheckState;
9052ASPx.CheckBoxInputKey = CheckBoxInputKey;
9053ASPx.CheckableElementStateController = CheckableElementStateController;
9054ASPx.CheckableElementHelper = CheckableElementHelper;
9055ASPx.CheckBoxInternal = CheckBoxInternal;
9056ASPx.CheckBoxInternalCollection = CheckBoxInternalCollection;
9057ASPx.ControlCallbackQueueHelper = ControlCallbackQueueHelper;
9058ASPx.FocusedStyleDecoration = FocusedStyleDecoration;
9059ASPx.EditorStyleDecoration = EditorStyleDecoration;
9060ASPx.TextEditorStyleDecoration = TextEditorStyleDecoration;
9061ASPx.AccessibilitySR = AccessibilitySR;
9062ASPx.KbdHelper = KbdHelper;
9063ASPx.AccessKeysHelper = AccessKeysHelper;
9064ASPx.AccessKey = AccessKey;
9065ASPx.IFrameHelper = IFrameHelper;
9066ASPx.Ident = Ident;
9067ASPx.TouchUIHelper = TouchUIHelper;
9068ASPx.ControlUpdateWatcher = ControlUpdateWatcher;
9069ASPx.AccessibilityHelperBase = AccessibilityHelperBase;
9070ASPx.RippleHelper = RippleHelper;
9071ASPx.ThemesWithRipple = ThemesWithRipple;
9072window.ASPxClientEvent = ASPxClientEvent;
9073window.ASPxClientEventArgs = ASPxClientEventArgs;
9074window.ASPxClientCancelEventArgs = ASPxClientCancelEventArgs;
9075window.ASPxClientProcessingModeEventArgs = ASPxClientProcessingModeEventArgs;
9076window.ASPxClientProcessingModeCancelEventArgs = ASPxClientProcessingModeCancelEventArgs;
9077ASPx.Evt.AttachEventToDocument(TouchUIHelper.touchMouseDownEventName, RippleHelper.onDocumentMouseDown);
9078ASPx.classesScriptParsed = true;
9079})();
9080
9081(function () {
9082ASPx.StateItemsExist = false;
9083ASPx.FocusedItemKind = "FocusedStateItem";
9084ASPx.HoverItemKind = "HoverStateItem";
9085ASPx.PressedItemKind = "PressedStateItem";
9086ASPx.SelectedItemKind = "SelectedStateItem";
9087ASPx.DisabledItemKind = "DisabledStateItem";
9088ASPx.CachedStatePrefix = "cached";
9089ASPxStateItem = ASPx.CreateClass(null, {
9090 constructor: function(name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, kind, disableApplyingStyleToLink){
9091  this.name = name;
9092  this.classNames = classNames;
9093  this.customClassNames = [];
9094  this.resultClassNames = [];
9095  this.cssTexts = cssTexts;
9096  this.postfixes = postfixes;
9097  this.imageObjs = imageObjs;
9098  this.imagePostfixes = imagePostfixes;
9099  this.kind = kind;
9100  this.classNamePostfix = kind.substr(0, 1).toLowerCase();
9101  this.enabled = true;
9102  this.needRefreshBetweenElements = false;
9103  this.elements = null;
9104  this.images = null;
9105  this.links = [];
9106  this.linkColor = null;
9107  this.linkTextDecoration = null;
9108  this.disableApplyingStyleToLink = !!disableApplyingStyleToLink; 
9109 },
9110 GetCssText: function(index){
9111  if(ASPx.IsExists(this.cssTexts[index]))
9112   return this.cssTexts[index];
9113  return this.cssTexts[0];
9114 },
9115 CreateStyleRule: function(index){
9116  if(this.GetCssText(index) == "") return "";
9117  var styleSheet = ASPx.GetCurrentStyleSheet();
9118  if(styleSheet)
9119   return ASPx.CreateImportantStyleRule(styleSheet, this.GetCssText(index), this.classNamePostfix);  
9120  return ""; 
9121 },
9122 GetClassName: function(index){
9123  if(ASPx.IsExists(this.classNames[index]))
9124   return this.classNames[index];
9125  return this.classNames[0];
9126 },
9127 GetResultClassName: function(index){
9128  if(!ASPx.IsExists(this.resultClassNames[index])) {
9129   if(!ASPx.IsExists(this.customClassNames[index]))
9130    this.customClassNames[index] = this.CreateStyleRule(index);
9131   if(this.GetClassName(index) != "" && this.customClassNames[index] != "")
9132    this.resultClassNames[index] = this.GetClassName(index) + " " + this.customClassNames[index];
9133   else if(this.GetClassName(index) != "")
9134    this.resultClassNames[index] = this.GetClassName(index);
9135   else if(this.customClassNames[index] != "")
9136    this.resultClassNames[index] = this.customClassNames[index];
9137   else
9138    this.resultClassNames[index] = "";
9139  }
9140  return this.resultClassNames[index];
9141 },
9142 GetElements: function(element){
9143  if(!this.elements || !ASPx.IsValidElements(this.elements)){
9144   if(this.postfixes && this.postfixes.length > 0){
9145    this.elements = [ ];
9146    var parentNode = element.parentNode;
9147    if(parentNode){
9148     for(var i = 0; i < this.postfixes.length; i++){
9149      var id = this.name + this.postfixes[i];
9150      this.elements[i] = ASPx.GetChildById(parentNode, id);
9151      if(!this.elements[i])
9152       this.elements[i] = ASPx.GetElementById(id);
9153     }
9154    }
9155   }
9156   else
9157    this.elements = [element];
9158  }
9159  return this.elements;
9160 },
9161 GetImages: function(element){
9162  if(!this.images || !ASPx.IsValidElements(this.images)){
9163   this.images = [ ];
9164   if(this.imagePostfixes && this.imagePostfixes.length > 0){
9165    var elements = this.GetElements(element);
9166    for(var i = 0; i < this.imagePostfixes.length; i++){
9167     var id = this.name + this.imagePostfixes[i];
9168     for(var j = 0; j < elements.length; j++){
9169      if(!elements[j]) continue;
9170      if(elements[j].id == id)
9171       this.images[i] = elements[j];
9172      else
9173       this.images[i] = ASPx.GetChildById(elements[j], id);
9174      if(this.images[i])
9175       break;
9176     }
9177    }
9178   }
9179  }
9180  return this.images;
9181 },
9182 Apply: function(element){
9183  if(!this.enabled) return;
9184  try{
9185   this.ApplyStyle(element);
9186   if(this.imageObjs && this.imageObjs.length > 0)
9187    this.ApplyImage(element);
9188   if(ASPx.Browser.IE && ASPx.Browser.MajorVersion >= 11 && ASPx.Browser.PlaformMajorVersion < 10)
9189    this.ForceRedrawAppearance(element);
9190  }
9191  catch(e){
9192  }
9193 },
9194 ApplyStyle: function(element){
9195  var elements = this.GetElements(element);
9196  for(var i = 0; i < elements.length; i++){
9197   if(!elements[i]) continue;
9198   if(this.GetResultClassName(i) != "") {
9199    var className = elements[i].className.replace(this.GetResultClassName(i), "");
9200    elements[i].className = ASPx.Str.Trim(className) + " " + this.GetResultClassName(i);
9201   }
9202   if(!ASPx.Browser.Opera || ASPx.Browser.Version >= 9)
9203    this.ApplyStyleToLinks(elements, i);
9204  }
9205 },
9206 ApplyStyleToLinks: function(elements, index){
9207  if(this.disableApplyingStyleToLink)
9208   return;
9209  if(!ASPx.IsValidElements(this.links[index]))
9210   this.links[index] = ASPx.GetNodesByTagName(elements[index], "A");
9211  for(var i = 0; i < this.links[index].length; i++)
9212   this.ApplyStyleToLinkElement(this.links[index][i], index);
9213 },
9214 ApplyStyleToLinkElement: function(link, index){
9215  if(this.GetLinkColor(index) != "")
9216   ASPx.Attr.ChangeAttributeExtended(link.style, "color", link, "saved" + this.kind + "Color", this.GetLinkColor(index));
9217  if(this.GetLinkTextDecoration(index) != "")
9218   ASPx.Attr.ChangeAttributeExtended(link.style, "textDecoration", link, "saved" + this.kind + "TextDecoration", this.GetLinkTextDecoration(index));
9219 },
9220 ApplyImage: function(element){
9221  var images = this.GetImages(element);
9222  for(var i = 0; i < images.length; i++){
9223   if(!images[i] || !this.imageObjs[i]) continue;
9224   var useSpriteImage = typeof(this.imageObjs[i]) != "string";
9225   var newUrl = "", newCssClass = "", newBackground = "";
9226   if(useSpriteImage){
9227    newUrl = ASPx.EmptyImageUrl;           
9228    if(this.imageObjs[i].spriteCssClass) 
9229     newCssClass = this.imageObjs[i].spriteCssClass;
9230    if(this.imageObjs[i].spriteBackground)
9231     newBackground = this.imageObjs[i].spriteBackground;
9232   }
9233   else{
9234    newUrl = this.imageObjs[i];
9235    if(ASPx.Attr.IsExistsAttribute(images[i].style, "background"))   
9236     newBackground = " ";
9237   }
9238   if(newUrl != "")
9239    ASPx.Attr.ChangeAttributeExtended(images[i], "src", images[i], "saved" + this.kind + "Src", newUrl);
9240   if(newCssClass != "")
9241    this.ApplyImageClassName(images[i], newCssClass);
9242   if(newBackground != ""){
9243    if(ASPx.Browser.WebKitFamily) {
9244     var savedBackground = ASPx.Attr.GetAttribute(images[i].style, "background");
9245     if(!useSpriteImage)
9246      savedBackground += " " + images[i].style["backgroundPosition"];
9247     ASPx.Attr.SetAttribute(images[i], "saved" + this.kind + "Background", savedBackground);
9248     ASPx.Attr.SetAttribute(images[i].style, "background", newBackground);
9249    }
9250    else
9251     ASPx.Attr.ChangeAttributeExtended(images[i].style, "background", images[i], "saved" + this.kind + "Background", newBackground);
9252   }     
9253  }
9254 },
9255 ApplyImageClassName: function(element, newClassName){
9256  if(ASPx.Attr.GetAttribute(element, "saved" + this.kind + "ClassName"))
9257   this.CancelImageClassName(element);
9258  var className = element.className;
9259  ASPx.Attr.SetAttribute(element, "saved" + this.kind + "ClassName", className);
9260  element.className = className + " " + newClassName;
9261 },
9262 Cancel: function(element){
9263  if(!this.enabled) return;
9264  try{  
9265   if(this.imageObjs && this.imageObjs.length > 0)
9266    this.CancelImage(element);
9267   this.CancelStyle(element);
9268  }
9269  catch(e){
9270  }
9271 },
9272 CancelStyle: function(element){
9273  var elements = this.GetElements(element);
9274  for(var i = 0; i < elements.length; i++){
9275   if(!elements[i]) continue;
9276   if(this.GetResultClassName(i) != "") {
9277    var className = ASPx.Str.Trim(elements[i].className.replace(this.GetResultClassName(i), ""));
9278    elements[i].className = className;
9279   }
9280   if(!ASPx.Browser.Opera || ASPx.Browser.Version >= 9)
9281    this.CancelStyleFromLinks(elements, i);
9282  }
9283 },
9284 CancelStyleFromLinks: function(elements, index){
9285  if(this.disableApplyingStyleToLink)
9286   return;
9287  if(!ASPx.IsValidElements(this.links[index]))
9288   this.links[index] = ASPx.GetNodesByTagName(elements[index], "A");
9289  for(var i = 0; i < this.links[index].length; i++)
9290   this.CancelStyleFromLinkElement(this.links[index][i], index);
9291 },
9292 CancelStyleFromLinkElement: function(link, index){
9293  if(this.GetLinkColor(index) != "")
9294   ASPx.Attr.RestoreAttributeExtended(link.style, "color", link, "saved" + this.kind + "Color");
9295  if(this.GetLinkTextDecoration(index) != "")
9296   ASPx.Attr.RestoreAttributeExtended(link.style, "textDecoration", link, "saved" + this.kind + "TextDecoration");
9297 },
9298 CancelImage: function(element){
9299  var images = this.GetImages(element);
9300  for(var i = 0; i < images.length; i++){
9301   if(!images[i] || !this.imageObjs[i]) continue;
9302   ASPx.Attr.RestoreAttributeExtended(images[i], "src", images[i], "saved" + this.kind + "Src");
9303   this.CancelImageClassName(images[i]);
9304   ASPx.Attr.RestoreAttributeExtended(images[i].style, "background", images[i], "saved" + this.kind + "Background");
9305  }
9306 },
9307 CancelImageClassName: function(element){
9308  var savedClassName = ASPx.Attr.GetAttribute(element, "saved" + this.kind + "ClassName");
9309  if(ASPx.IsExists(savedClassName)) {
9310   element.className = savedClassName;
9311   ASPx.Attr.RemoveAttribute(element, "saved" + this.kind + "ClassName");
9312  }
9313 },
9314 Clone: function(){
9315  return new ASPxStateItem(this.name, this.classNames, this.cssTexts, this.postfixes, 
9316   this.imageObjs, this.imagePostfixes, this.kind, this.disableApplyingStyleToLink);
9317 },
9318 IsChildElement: function(element){
9319  if(element != null){
9320   var elements = this.GetElements(element);
9321   for(var i = 0; i < elements.length; i++){
9322    if(!elements[i]) continue;
9323    if(ASPx.GetIsParent(elements[i], element)) 
9324     return true;
9325   }
9326  }
9327  return false;
9328 },
9329 ForceRedrawAppearance: function(element) {
9330  if(!aspxGetStateController().IsForceRedrawAppearanceLocked()) {
9331   var value = element.style.opacity;
9332   element.style.opacity = "0.7777";
9333   var dummy = element.offsetWidth;
9334   element.style.opacity = value;
9335  }
9336 },
9337 GetLinkColor: function(index){
9338  if(!ASPx.IsExists(this.linkColor)){
9339   var rule = ASPx.GetStyleSheetRules(this.customClassNames[index]);
9340   this.linkColor = rule ? rule.style.color : null;
9341   if(!ASPx.IsExists(this.linkColor)){
9342    var rule = ASPx.GetStyleSheetRules(this.GetClassName(index));
9343    this.linkColor = rule ? rule.style.color : null;
9344   }
9345   if(this.linkColor == null) 
9346    this.linkColor = "";
9347  }
9348  return this.linkColor;
9349 },
9350 GetLinkTextDecoration: function(index){
9351  if(!ASPx.IsExists(this.linkTextDecoration)){
9352   var rule = ASPx.GetStyleSheetRules(this.customClassNames[index]);
9353   this.linkTextDecoration = rule ? rule.style.textDecoration : null;
9354   if(!ASPx.IsExists(this.linkTextDecoration)){
9355    var rule = ASPx.GetStyleSheetRules(this.GetClassName(index));
9356    this.linkTextDecoration = rule ? rule.style.textDecoration : null;
9357   }
9358   if(this.linkTextDecoration == null) 
9359    this.linkTextDecoration = "";
9360  }
9361  return this.linkTextDecoration;
9362 }
9363});
9364ASPxClientStateEventArgs = ASPx.CreateClass(null, {
9365 constructor: function(item, element){
9366  this.item = item;
9367  this.element = element;
9368  this.toElement = null;
9369  this.fromElement = null;
9370  this.htmlEvent = null;
9371 }
9372});
9373ASPxStateController = ASPx.CreateClass(null, {
9374 constructor: function(){
9375  this.focusedItems = { };
9376  this.hoverItems = { };
9377  this.pressedItems = { };
9378  this.selectedItems = { };
9379  this.disabledItems = { };
9380  this.disabledScheme = {};
9381  this.currentFocusedElement = null;
9382  this.currentFocusedItemName = null;
9383  this.currentHoverElement = null;
9384  this.currentHoverItemName = null;
9385  this.currentPressedElement = null;
9386  this.currentPressedItemName = null;
9387  this.savedCurrentPressedElement = null;
9388  this.savedCurrentMouseMoveSrcElement = null;
9389  this.forceRedrawAppearanceLockCount = 0;
9390  this.AfterSetFocusedState = new ASPxClientEvent();
9391  this.AfterClearFocusedState = new ASPxClientEvent();
9392  this.AfterSetHoverState = new ASPxClientEvent();
9393  this.AfterClearHoverState = new ASPxClientEvent();
9394  this.AfterSetPressedState = new ASPxClientEvent();
9395  this.AfterClearPressedState = new ASPxClientEvent();
9396  this.AfterDisabled = new ASPxClientEvent();
9397  this.AfterEnabled = new ASPxClientEvent();
9398  this.BeforeSetFocusedState = new ASPxClientEvent();
9399  this.BeforeClearFocusedState = new ASPxClientEvent();
9400  this.BeforeSetHoverState = new ASPxClientEvent();
9401  this.BeforeClearHoverState = new ASPxClientEvent();
9402  this.BeforeSetPressedState = new ASPxClientEvent();
9403  this.BeforeClearPressedState = new ASPxClientEvent();
9404  this.BeforeDisabled = new ASPxClientEvent();
9405  this.BeforeEnabled = new ASPxClientEvent();
9406  this.FocusedItemKeyDown = new ASPxClientEvent();
9407 }, 
9408 AddHoverItem: function(name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, disableApplyingStyleToLink){
9409  this.AddItem(this.hoverItems, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, ASPx.HoverItemKind, disableApplyingStyleToLink);
9410  this.AddItem(this.focusedItems, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, ASPx.FocusedItemKind, disableApplyingStyleToLink);
9411 },
9412 AddPressedItem: function(name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, disableApplyingStyleToLink){
9413  this.AddItem(this.pressedItems, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, ASPx.PressedItemKind, disableApplyingStyleToLink);
9414 },
9415 AddSelectedItem: function(name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, disableApplyingStyleToLink){
9416  this.AddItem(this.selectedItems, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, ASPx.SelectedItemKind, disableApplyingStyleToLink);
9417 },
9418 AddDisabledItem: function (name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, disableApplyingStyleToLink, rootId) {
9419  this.AddItem(this.disabledItems, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes,
9420   ASPx.DisabledItemKind, disableApplyingStyleToLink, this.addIdToDisabledItemScheme, rootId);
9421 },
9422 addIdToDisabledItemScheme: function(rootId, childId) {
9423  if (!rootId)
9424   return;
9425  if (!this.disabledScheme[rootId])
9426   this.disabledScheme[rootId] = [rootId];
9427  if (childId && (rootId != childId) && ASPx.Data.ArrayIndexOf(this.disabledScheme[rootId], childId) == -1)
9428   this.disabledScheme[rootId].push(childId);
9429 },
9430 removeIdFromDisabledItemScheme: function(rootId, childId) {
9431  if (!rootId || !this.disabledScheme[rootId])
9432   return;
9433  ASPx.Data.ArrayRemove(this.disabledScheme[rootId], childId);
9434  if (this.disabledScheme[rootId].length == 0)
9435   delete this.disabledScheme[rootId];
9436 },
9437 AddItem: function (items, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, kind, disableApplyingStyleToLink, onAdd, rootId) {
9438  var stateItem = new ASPxStateItem(name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, kind, disableApplyingStyleToLink);
9439  if (postfixes && postfixes.length > 0) {
9440   for (var i = 0; i < postfixes.length; i++) {
9441    items[name + postfixes[i]] = stateItem;
9442    if (onAdd)
9443     onAdd.call(this, rootId, name + postfixes[i]);
9444   }
9445  }
9446  else {
9447   if (onAdd)
9448    onAdd.call(this, rootId, name);
9449   items[name] = stateItem;
9450  }
9451  ASPx.StateItemsExist = true;
9452 },
9453 RemoveHoverItem: function(name, postfixes){
9454  this.RemoveItem(this.hoverItems, name, postfixes);
9455  this.RemoveItem(this.focusedItems, name, postfixes);
9456 },
9457 RemovePressedItem: function(name, postfixes){
9458  this.RemoveItem(this.pressedItems, name, postfixes);
9459 },
9460 RemoveSelectedItem: function(name, postfixes){
9461  this.RemoveItem(this.selectedItems, name, postfixes);
9462 },
9463 RemoveDisabledItem: function (name, postfixes, rootId) {
9464  this.RemoveItem(this.disabledItems, name, postfixes, this.removeIdFromDisabledItemScheme, rootId);
9465 },
9466 RemoveItem: function (items, name, postfixes, onRemove, rootId) {
9467  if (postfixes && postfixes.length > 0) {
9468   for (var i = 0; i < postfixes.length; i++) {
9469    delete items[name + postfixes[i]];
9470    if (onRemove)
9471     onRemove.call(this, rootId, name + postfixes[i]);
9472   }
9473  }
9474  else {
9475   delete items[name];
9476   if (onRemove)
9477    onRemove.call(this, rootId, name);
9478  }
9479 },
9480 RemoveDisposedItems: function(){
9481  this.RemoveDisposedItemsByType(this.hoverItems);
9482  this.RemoveDisposedItemsByType(this.pressedItems);
9483  this.RemoveDisposedItemsByType(this.focusedItems);
9484  this.RemoveDisposedItemsByType(this.selectedItems);
9485  this.RemoveDisposedItemsByType(this.disabledItems);
9486  this.RemoveDisposedItemsByType(this.disabledScheme);
9487 },
9488 RemoveDisposedItemsByType: function(items){
9489  for(var key in items) {
9490   if(items.hasOwnProperty(key)) {
9491    var item = items[key];
9492    var element = document.getElementById(key);
9493    if(!element || !ASPx.IsValidElement(element))
9494     delete items[key];
9495    try {
9496     if(item && item.elements) {
9497      for(var i = 0; i < item.elements.length; i++) {
9498       if(!ASPx.IsValidElements(item.links[i]))
9499        item.links[i] = null;
9500      }
9501     }
9502    }
9503    catch(e) {
9504    }
9505   }
9506  }
9507 },
9508 GetFocusedElement: function(srcElement){
9509  return this.GetItemElement(srcElement, this.focusedItems, ASPx.FocusedItemKind);
9510 },
9511 GetHoverElement: function(srcElement){
9512  return this.GetItemElement(srcElement, this.hoverItems, ASPx.HoverItemKind);
9513 },
9514 GetPressedElement: function(srcElement){
9515  return this.GetItemElement(srcElement, this.pressedItems, ASPx.PressedItemKind);
9516 },
9517 GetSelectedElement: function(srcElement){
9518  return this.GetItemElement(srcElement, this.selectedItems, ASPx.SelectedItemKind);
9519 },
9520 GetDisabledElement: function(srcElement){
9521  return this.GetItemElement(srcElement, this.disabledItems, ASPx.DisabledItemKind);
9522 },
9523 GetItemElement: function(srcElement, items, kind){
9524  if(srcElement && srcElement[ASPx.CachedStatePrefix + kind]){
9525   var cachedElement = srcElement[ASPx.CachedStatePrefix + kind];
9526   if(cachedElement != ASPx.EmptyObject)
9527    return cachedElement;
9528   return null;
9529  }
9530  var element = srcElement;
9531  while(element != null) {
9532   var item = items[element.id];
9533   if(item){
9534    this.CacheItemElement(srcElement, kind, element);
9535    element[kind] = item;
9536    return element;
9537   }
9538   element = element.parentNode;
9539  }
9540  this.CacheItemElement(srcElement, kind, ASPx.EmptyObject);
9541  return null;
9542 },
9543 CacheItemElement: function(srcElement, kind, value){
9544  if(srcElement && !srcElement[ASPx.CachedStatePrefix + kind])
9545   srcElement[ASPx.CachedStatePrefix + kind] = value;
9546 },
9547 DoSetFocusedState: function(element, fromElement){
9548  var item = element[ASPx.FocusedItemKind];
9549  if(item){
9550   var args = new ASPxClientStateEventArgs(item, element);
9551   args.fromElement = fromElement;
9552   this.BeforeSetFocusedState.FireEvent(this, args);
9553   item.Apply(element);
9554   this.AfterSetFocusedState.FireEvent(this, args);
9555  }
9556 },
9557 DoClearFocusedState: function(element, toElement){
9558  var item = element[ASPx.FocusedItemKind];
9559  if(item){
9560   var args = new ASPxClientStateEventArgs(item, element);
9561   args.toElement = toElement;
9562   this.BeforeClearFocusedState.FireEvent(this, args);
9563   item.Cancel(element);
9564   this.AfterClearFocusedState.FireEvent(this, args);
9565  }
9566 },
9567 DoSetHoverState: function(element, fromElement){
9568  var item = element[ASPx.HoverItemKind];
9569  if(item){
9570   var args = new ASPxClientStateEventArgs(item, element);
9571   args.fromElement = fromElement;
9572   this.BeforeSetHoverState.FireEvent(this, args);
9573   item.Apply(element);
9574   this.AfterSetHoverState.FireEvent(this, args);
9575  }
9576 },
9577 DoClearHoverState: function(element, toElement){
9578  var item = element[ASPx.HoverItemKind];
9579  if(item){
9580   var args = new ASPxClientStateEventArgs(item, element);
9581   args.toElement = toElement;
9582   this.BeforeClearHoverState.FireEvent(this, args);
9583   item.Cancel(element);
9584   this.AfterClearHoverState.FireEvent(this, args);
9585  }
9586 },
9587 DoSetPressedState: function(element){
9588  var item = element[ASPx.PressedItemKind];
9589  if(item){
9590   var args = new ASPxClientStateEventArgs(item, element);
9591   this.BeforeSetPressedState.FireEvent(this, args);
9592   item.Apply(element);
9593   this.AfterSetPressedState.FireEvent(this, args);
9594  }
9595 },
9596 DoClearPressedState: function(element){
9597  var item = element[ASPx.PressedItemKind];
9598  if(item){
9599   var args = new ASPxClientStateEventArgs(item, element);
9600   this.BeforeClearPressedState.FireEvent(this, args);
9601   item.Cancel(element);
9602   this.AfterClearPressedState.FireEvent(this, args);
9603  }
9604 },
9605 SetCurrentFocusedElement: function(element){
9606  if(this.currentFocusedElement && !ASPx.IsValidElement(this.currentFocusedElement)){
9607   this.currentFocusedElement = null;
9608   this.currentFocusedItemName = "";
9609  }
9610  if(this.currentFocusedElement != element){
9611   var oldCurrentFocusedElement = this.currentFocusedElement;
9612   var item = (element != null) ? element[ASPx.FocusedItemKind] : null;
9613   var itemName = (item != null) ? item.name : "";
9614   if(this.currentFocusedItemName != itemName){
9615    if(this.currentHoverItemName != "")
9616     this.SetCurrentHoverElement(null);
9617    if(this.currentFocusedElement != null)
9618     this.DoClearFocusedState(this.currentFocusedElement, element);
9619    this.currentFocusedElement = element;
9620    item = (element != null) ? element[ASPx.FocusedItemKind] : null;
9621    this.currentFocusedItemName = (item != null) ? item.name : "";
9622    if(this.currentFocusedElement != null)
9623     this.DoSetFocusedState(this.currentFocusedElement, oldCurrentFocusedElement);
9624   }
9625  }
9626 },
9627 SetCurrentHoverElement: function(element){
9628  if(this.currentHoverElement && !ASPx.IsValidElement(this.currentHoverElement)){
9629   this.currentHoverElement = null;
9630   this.currentHoverItemName = "";
9631  }
9632  var item = (element != null) ? element[ASPx.HoverItemKind] : null;
9633  if(item && !item.enabled) { 
9634   element = this.GetItemElement(element.parentNode, this.hoverItems, ASPx.HoverItemKind);
9635   item = (element != null) ? element[ASPx.HoverItemKind] : null;
9636  }
9637  if(this.currentHoverElement != element){
9638   var oldCurrentHoverElement = this.currentHoverElement,
9639    itemName = (item != null) ? item.name : "";
9640   if(this.currentHoverItemName != itemName || (item != null && item.needRefreshBetweenElements)){
9641    if(this.currentHoverElement != null)
9642     this.DoClearHoverState(this.currentHoverElement, element);
9643    item = (element != null) ? element[ASPx.HoverItemKind] : null;
9644    if(item == null || item.enabled){
9645     this.currentHoverElement = element;
9646     this.currentHoverItemName = (item != null) ? item.name : "";
9647     if(this.currentHoverElement != null)
9648      this.DoSetHoverState(this.currentHoverElement, oldCurrentHoverElement);
9649    }
9650   }
9651  }
9652 },
9653 SetCurrentPressedElement: function(element){
9654  if(this.currentPressedElement && !ASPx.IsValidElement(this.currentPressedElement)){
9655   this.currentPressedElement = null;
9656   this.currentPressedItemName = "";
9657  }
9658  if(this.currentPressedElement != element){
9659   if(this.currentPressedElement != null)
9660    this.DoClearPressedState(this.currentPressedElement);
9661   var item = (element != null) ? element[ASPx.PressedItemKind] : null;
9662   if(item == null || item.enabled){
9663    this.currentPressedElement = element;
9664    this.currentPressedItemName = (item != null) ? item.name : "";
9665    if(this.currentPressedElement != null)
9666     this.DoSetPressedState(this.currentPressedElement);
9667   }
9668  }
9669 },
9670 SetCurrentFocusedElementBySrcElement: function(srcElement){
9671  var element = this.GetFocusedElement(srcElement);
9672  this.SetCurrentFocusedElement(element);
9673 },
9674 SetCurrentHoverElementBySrcElement: function(srcElement){
9675  var element = this.GetHoverElement(srcElement);
9676  this.SetCurrentHoverElement(element);
9677 },
9678 SetCurrentPressedElementBySrcElement: function(srcElement){
9679  var element = this.GetPressedElement(srcElement);
9680  this.SetCurrentPressedElement(element);
9681 },
9682 SetPressedElement: function (element) {
9683  this.SetCurrentHoverElement(null);
9684  this.SetCurrentPressedElementBySrcElement(element);
9685  this.savedCurrentPressedElement = this.currentPressedElement;
9686 },
9687 SelectElement: function (element) {
9688  var item = element[ASPx.SelectedItemKind];
9689  if(item)
9690   item.Apply(element);
9691 }, 
9692 SelectElementBySrcElement: function(srcElement){
9693  var element = this.GetSelectedElement(srcElement);
9694  if(element != null) this.SelectElement(element);
9695 }, 
9696 DeselectElement: function(element){
9697  var item = element[ASPx.SelectedItemKind];
9698  if(item)
9699   item.Cancel(element);
9700 }, 
9701 DeselectElementBySrcElement: function(srcElement){
9702  var element = this.GetSelectedElement(srcElement);
9703  if(element != null) this.DeselectElement(element);
9704 },
9705 SetElementEnabled: function(element, enable){
9706  if(enable)
9707   this.EnableElement(element);
9708  else
9709   this.DisableElement(element);
9710 },
9711 SetElementWithChildNodesEnabled: function (parentName, enabled) {
9712  var procFunct = (enabled ? this.EnableElement : this.DisableElement);
9713  var childItems = this.disabledScheme[parentName];
9714  if (childItems && childItems.length > 0)
9715   for (var i = 0; i < childItems.length; i++) {
9716    procFunct.call(this, document.getElementById(childItems[i]));
9717   }
9718 },
9719 DisableElement: function (element) {
9720  var element = this.GetDisabledElement(element);
9721  if(element != null) {
9722   var item = element[ASPx.DisabledItemKind];
9723   if(item){
9724    var args = new ASPxClientStateEventArgs(item, element);
9725    this.BeforeDisabled.FireEvent(this, args);
9726    if(item.name == this.currentPressedItemName)
9727     this.SetCurrentPressedElement(null);
9728    if(item.name == this.currentHoverItemName)
9729     this.SetCurrentHoverElement(null);
9730    item.Apply(element);
9731    this.SetMouseStateItemsEnabled(item.name, item.postfixes, false);
9732    this.AfterDisabled.FireEvent(this, args);
9733   }
9734  }
9735 }, 
9736 EnableElement: function(element){
9737  var element = this.GetDisabledElement(element);
9738  if(element != null) {
9739   var item = element[ASPx.DisabledItemKind];
9740   if(item){
9741    var args = new ASPxClientStateEventArgs(item, element);
9742    this.BeforeEnabled.FireEvent(this, args);
9743    item.Cancel(element);
9744    this.SetMouseStateItemsEnabled(item.name, item.postfixes, true);
9745    this.AfterEnabled.FireEvent(this, args);
9746   }
9747  }
9748 }, 
9749 SetMouseStateItemsEnabled: function(name, postfixes, enabled){   
9750  if(postfixes && postfixes.length > 0){
9751   for(var i = 0; i < postfixes.length; i ++){
9752    this.SetItemsEnabled(this.hoverItems, name + postfixes[i], enabled);
9753    this.SetItemsEnabled(this.pressedItems, name + postfixes[i], enabled);
9754    this.SetItemsEnabled(this.focusedItems, name + postfixes[i], enabled);
9755   }
9756  }
9757  else{
9758   this.SetItemsEnabled(this.hoverItems, name, enabled);
9759   this.SetItemsEnabled(this.pressedItems, name, enabled);
9760   this.SetItemsEnabled(this.focusedItems, name, enabled);
9761  }  
9762 },
9763 SetItemsEnabled: function(items, name, enabled){   
9764  if(items[name])
9765   items[name].enabled = enabled;
9766 },
9767 OnFocusMove: function(evt){
9768  var element = ASPx.Evt.GetEventSource(evt);
9769  aspxGetStateController().SetCurrentFocusedElementBySrcElement(element);
9770 },
9771 OnMouseMove: function(evt, checkElementChanged){
9772  var srcElement = ASPx.Evt.GetEventSource(evt);
9773  if(checkElementChanged && srcElement == this.savedCurrentMouseMoveSrcElement) return;
9774  this.savedCurrentMouseMoveSrcElement = srcElement;
9775  if(ASPx.Browser.IE && !ASPx.Evt.IsLeftButtonPressed(evt) && this.savedCurrentPressedElement != null)
9776   this.ClearSavedCurrentPressedElement();
9777  if(this.savedCurrentPressedElement == null)
9778   this.SetCurrentHoverElementBySrcElement(srcElement);
9779  else{
9780   var element = this.GetPressedElement(srcElement);
9781   if(element != this.currentPressedElement){
9782    if(element == this.savedCurrentPressedElement)
9783     this.SetCurrentPressedElement(this.savedCurrentPressedElement);
9784    else
9785     this.SetCurrentPressedElement(null);
9786   }
9787  }
9788 },
9789 OnMouseDown: function(evt){
9790  if(!ASPx.Evt.IsLeftButtonPressed(evt)) return;
9791  var srcElement = ASPx.Evt.GetEventSource(evt);
9792  this.OnMouseDownOnElement(srcElement);
9793 },
9794 OnMouseDownOnElement: function (element) {
9795  if(this.GetPressedElement(element) == null) return;
9796  this.SetPressedElement(element);
9797 },
9798 OnMouseUp: function(evt){
9799  var srcElement = ASPx.Evt.GetEventSource(evt);
9800  this.OnMouseUpOnElement(srcElement);
9801 },
9802 OnMouseUpOnElement: function(element){
9803  if(this.savedCurrentPressedElement == null) return;
9804  this.ClearSavedCurrentPressedElement();
9805  this.SetCurrentHoverElementBySrcElement(element);
9806 },
9807 OnMouseOver: function(evt){
9808  var element = ASPx.Evt.GetEventSource(evt);
9809  if(element && element.tagName == "IFRAME")
9810   this.OnMouseMove(evt, true);
9811 },
9812 OnKeyDown: function(evt){
9813  var element = this.GetFocusedElement(ASPx.Evt.GetEventSource(evt));
9814  if(element != null && element == this.currentFocusedElement) {
9815   var item = element[ASPx.FocusedItemKind];
9816   if(item){
9817    var args = new ASPxClientStateEventArgs(item, element);
9818    args.htmlEvent = evt;
9819    this.FocusedItemKeyDown.FireEvent(this, args);
9820   }
9821  }
9822 },
9823 OnKeyUpOnElement: function(evt) {
9824  if(this.savedCurrentPressedElement != null && ASPx.Evt.IsActionKeyPressed(evt))
9825   this.ClearSavedCurrentPressedElement();
9826 },
9827 OnSelectStart: function(evt){
9828  if(this.savedCurrentPressedElement) {
9829   ASPx.Selection.Clear();
9830   return false;
9831  }
9832 },
9833 ClearSavedCurrentPressedElement: function() {
9834  this.savedCurrentPressedElement = null;
9835  this.SetCurrentPressedElement(null);
9836 },
9837 ClearCache: function(srcElement, kind) {
9838  if(srcElement[ASPx.CachedStatePrefix + kind])
9839   srcElement[ASPx.CachedStatePrefix + kind] = null;
9840 },
9841 ClearElementCache: function(srcElement) {
9842  this.ClearCache(srcElement, ASPx.FocusedItemKind);
9843  this.ClearCache(srcElement, ASPx.HoverItemKind);
9844  this.ClearCache(srcElement, ASPx.PressedItemKind);
9845  this.ClearCache(srcElement, ASPx.SelectedItemKind);
9846  this.ClearCache(srcElement, ASPx.DisabledItemKind);
9847 },
9848 LockForceRedrawAppearance: function() {
9849  this.forceRedrawAppearanceLockCount++;
9850 },
9851 UnlockForceRedrawAppearance: function() {
9852  this.forceRedrawAppearanceLockCount--;
9853 },
9854 IsForceRedrawAppearanceLocked: function() {
9855  return this.forceRedrawAppearanceLockCount > 0;
9856 }
9857});
9858var stateController = null;
9859function aspxGetStateController(){
9860 if(stateController == null)
9861  stateController = new ASPxStateController();
9862 return stateController;
9863}
9864function aspxAddStateItems(method, namePrefix, classes, disableApplyingStyleToLink){
9865 for(var i = 
98650; i < classes.length; i ++){
9866  for(var j = 0; j < classes[i][2].length; j ++) {
9867   var name = namePrefix;
9868   if(classes[i][2][j])
9869    name += "_" + classes[i][2][j];
9870   var postfixes = classes[i][3] || null;
9871   var imageObjs = (classes[i][4] && classes[i][4][j]) || null;
9872   var imagePostfixes = classes[i][5] || null;
9873   method.call(aspxGetStateController(), name, classes[i][0], classes[i][1], postfixes, imageObjs, imagePostfixes, disableApplyingStyleToLink, namePrefix);
9874  }
9875 }
9876}
9877ASPx.AddHoverItems = function(namePrefix, classes, disableApplyingStyleToLink){
9878 aspxAddStateItems(aspxGetStateController().AddHoverItem, namePrefix, classes, disableApplyingStyleToLink);
9879};
9880ASPx.AddPressedItems = function(namePrefix, classes, disableApplyingStyleToLink){
9881 aspxAddStateItems(aspxGetStateController().AddPressedItem, namePrefix, classes, disableApplyingStyleToLink);
9882};
9883ASPx.AddSelectedItems = function(namePrefix, classes, disableApplyingStyleToLink){
9884 aspxAddStateItems(aspxGetStateController().AddSelectedItem, namePrefix, classes, disableApplyingStyleToLink);
9885};
9886ASPx.AddDisabledItems = function(namePrefix, classes, disableApplyingStyleToLink){
9887 aspxAddStateItems(aspxGetStateController().AddDisabledItem, namePrefix, classes, disableApplyingStyleToLink);
9888};
9889function aspxRemoveStateItems(method, namePrefix, classes){
9890 for(var i = 0; i < classes.length; i ++){
9891  for(var j = 0; j < classes[i][0].length; j ++) {
9892   var name = namePrefix;
9893   if(classes[i][0][j])
9894    name += "_" + classes[i][0][j];
9895   method.call(aspxGetStateController(), name, classes[i][1], namePrefix);
9896  }
9897 }
9898}
9899ASPx.RemoveHoverItems = function(namePrefix, classes){
9900 aspxRemoveStateItems(aspxGetStateController().RemoveHoverItem, namePrefix, classes);
9901};
9902ASPx.RemovePressedItems = function(namePrefix, classes){
9903 aspxRemoveStateItems(aspxGetStateController().RemovePressedItem, namePrefix, classes);
9904};
9905ASPx.RemoveSelectedItems = function(namePrefix, classes){
9906 aspxRemoveStateItems(aspxGetStateController().RemoveSelectedItem, namePrefix, classes);
9907};
9908ASPx.RemoveDisabledItems = function(namePrefix, classes){
9909 aspxRemoveStateItems(aspxGetStateController().RemoveDisabledItem, namePrefix, classes);
9910};
9911ASPx.AddAfterClearFocusedState = function(handler){
9912 aspxGetStateController().AfterClearFocusedState.AddHandler(handler);
9913};
9914ASPx.AddAfterSetFocusedState = function(handler){
9915 aspxGetStateController().AfterSetFocusedState.AddHandler(handler);
9916};
9917ASPx.AddAfterClearHoverState = function(handler){
9918 aspxGetStateController().AfterClearHoverState.AddHandler(handler);
9919};
9920ASPx.AddAfterSetHoverState = function(handler){
9921 aspxGetStateController().AfterSetHoverState.AddHandler(handler);
9922};
9923ASPx.AddAfterClearPressedState = function(handler){
9924 aspxGetStateController().AfterClearPressedState.AddHandler(handler);
9925};
9926ASPx.AddAfterSetPressedState = function(handler){
9927 aspxGetStateController().AfterSetPressedState.AddHandler(handler);
9928};
9929ASPx.AddAfterDisabled = function(handler){
9930 aspxGetStateController().AfterDisabled.AddHandler(handler);
9931};
9932ASPx.AddAfterEnabled = function(handler){
9933 aspxGetStateController().AfterEnabled.AddHandler(handler);
9934};
9935ASPx.AddBeforeClearFocusedState = function(handler){
9936 aspxGetStateController().BeforeClearFocusedState.AddHandler(handler);
9937};
9938ASPx.AddBeforeSetFocusedState = function(handler){
9939 aspxGetStateController().BeforeSetFocusedState.AddHandler(handler);
9940};
9941ASPx.AddBeforeClearHoverState = function(handler){
9942 aspxGetStateController().BeforeClearHoverState.AddHandler(handler);
9943};
9944ASPx.AddBeforeSetHoverState = function(handler){
9945 aspxGetStateController().BeforeSetHoverState.AddHandler(handler);
9946};
9947ASPx.AddBeforeClearPressedState = function(handler){
9948 aspxGetStateController().BeforeClearPressedState.AddHandler(handler);
9949};
9950ASPx.AddBeforeSetPressedState = function(handler){
9951 aspxGetStateController().BeforeSetPressedState.AddHandler(handler);
9952};
9953ASPx.AddBeforeDisabled = function(handler){
9954 aspxGetStateController().BeforeDisabled.AddHandler(handler);
9955};
9956ASPx.AddBeforeEnabled = function(handler){
9957 aspxGetStateController().BeforeEnabled.AddHandler(handler);
9958};
9959ASPx.AddFocusedItemKeyDown = function(handler){
9960 aspxGetStateController().FocusedItemKeyDown.AddHandler(handler);
9961};
9962ASPx.SetHoverState = function(element){
9963 aspxGetStateController().SetCurrentHoverElementBySrcElement(element);
9964};
9965ASPx.ClearHoverState = function(evt){
9966 aspxGetStateController().SetCurrentHoverElementBySrcElement(null);
9967};
9968ASPx.UpdateHoverState = function(evt){
9969 aspxGetStateController().OnMouseMove(evt, false);
9970};
9971ASPx.SetFocusedState = function(element){
9972 aspxGetStateController().SetCurrentFocusedElementBySrcElement(element);
9973};
9974ASPx.ClearFocusedState = function(evt){
9975 aspxGetStateController().SetCurrentFocusedElementBySrcElement(null);
9976};
9977ASPx.UpdateFocusedState = function(evt){
9978 aspxGetStateController().OnFocusMove(evt);
9979};
9980ASPx.AccessibilityMarkerClass = "dxalink";
9981ASPx.AssignAccessibilityEventsToChildrenLinks = function(container, clearFocusedStateOnMouseOut){
9982 var links = ASPx.GetNodesByPartialClassName(container, ASPx.AccessibilityMarkerClass);
9983 for(var i = 0; i < links.length; i++)
9984  ASPx.AssignAccessibilityEventsToLink(links[i], clearFocusedStateOnMouseOut);
9985};
9986ASPx.AssignAccessibilityEventsToLink = function(link, clearFocusedStateOnMouseOut) {
9987 if(!ASPx.ElementContainsCssClass(link, ASPx.AccessibilityMarkerClass))
9988  return;
9989 ASPx.AssignAccessibilityEventsToLinkCore(link, clearFocusedStateOnMouseOut);
9990};
9991ASPx.AssignAccessibilityEventsToLinkCore = function (link, clearFocusedStateOnMouseOut) {
9992 ASPx.Evt.AttachEventToElement(link, "focus", function (e) { ASPx.UpdateFocusedState(e); });
9993 var clearFocusedStateHandler = function (e) { ASPx.ClearFocusedState(e); };
9994 ASPx.Evt.AttachEventToElement(link, "blur", clearFocusedStateHandler);
9995 if(clearFocusedStateOnMouseOut)
9996  ASPx.Evt.AttachEventToElement(link, "mouseout", clearFocusedStateHandler);
9997};
9998ASPx.Evt.AttachEventToDocument("mousemove", function(evt) {
9999 if(ASPx.classesScriptParsed && ASPx.StateItemsExist)
10000  aspxGetStateController().OnMouseMove(evt, true);
10001});
10002ASPx.Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseDownEventName, function(evt) {
10003 if(ASPx.classesScriptParsed && ASPx.StateItemsExist)
10004  aspxGetStateController().OnMouseDown(evt);
10005});
10006ASPx.Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseUpEventName, function(evt) {
10007 if(ASPx.classesScriptParsed && ASPx.StateItemsExist)
10008  aspxGetStateController().OnMouseUp(evt);
10009});
10010ASPx.Evt.AttachEventToDocument("mouseover", function(evt) {
10011 if(ASPx.classesScriptParsed && ASPx.StateItemsExist)
10012  aspxGetStateController().OnMouseOver(evt);
10013});
10014ASPx.Evt.AttachEventToDocument("keydown", function(evt) {
10015 if(ASPx.classesScriptParsed && ASPx.StateItemsExist)
10016  aspxGetStateController().OnKeyDown(evt);
10017});
10018ASPx.Evt.AttachEventToDocument("selectstart", function(evt) {
10019 if(ASPx.classesScriptParsed && ASPx.StateItemsExist)
10020  return aspxGetStateController().OnSelectStart(evt);
10021});
10022ASPx.GetStateController = aspxGetStateController;
10023})();
10024(function () {
10025 var ASPx = window.ASPx || {};
10026 ASPx.ASPxImageLoad = {};
10027 ASPx.ASPxImageLoad.dxDefaultLoadingImageCssClass = "dxe-loadingImage";
10028 ASPx.ASPxImageLoad.dxDefaultLoadingImageCssClassRegexp = new RegExp("dx\\w+-loadingImage");
10029 ASPx.ASPxImageLoad.OnLoad = function (image, customLoadingImage, isOldIE, customBackgroundImageUrl) {
10030  image.dxCustomBackgroundImageUrl = "";
10031  image.dxShowLoadingImage = true;
10032  image.dxCustomLoadingImage = customLoadingImage;
10033  if (customBackgroundImageUrl != "")
10034   image.dxCustomBackgroundImageUrl = "url('" + customBackgroundImageUrl + "')";
10035  ASPx.ASPxImageLoad.prepareImageBackground(image, isOldIE);
10036  ASPx.ASPxImageLoad.removeHandlers(image);
10037  image.className = image.className.replace(ASPx.ASPxImageLoad.dxDefaultLoadingImageCssClassRegexp, "");
10038 };
10039 ASPx.ASPxImageLoad.removeASPxImageBackground = function (image, isOldIE) {
10040  if (isOldIE) 
10041   image.style.removeAttribute("background-image");
10042  else 
10043   image.style.backgroundImage = "";
10044 };
10045 ASPx.ASPxImageLoad.prepareImageBackground = function (image, isOldIE) {
10046  ASPx.ASPxImageLoad.removeASPxImageBackground(image, isOldIE);
10047  if (image.dxCustomBackgroundImageUrl != "")
10048   image.style.backgroundImage = image.dxCustomBackgroundImageUrl;
10049 };
10050 ASPx.ASPxImageLoad.removeHandlers = function (image) {
10051  image.removeAttribute("onload");
10052  image.removeAttribute("onabort");
10053  image.removeAttribute("onerror");
10054 };
10055 window.ASPx = ASPx;
10056})();
10057(function() {
10058var CheckingScriptObjectCommand = ASPx.CreateClass(null, {
10059 constructor: function(scriptName, markerObjectName) {
10060  this.scriptName = scriptName;
10061  this.markerObjectName = markerObjectName;
10062  this.isExisted = false;
10063 },
10064 Run: function() {
10065  var markerObj = this.GetMarkerObject();
10066  this.isExisted = !!markerObj;
10067  if(this.isExisted)
10068   markerObj.DXPatched = true;
10069 },
10070 GetErrorMessage: function() {
10071  return this.GetErrorMessageCore(true);
10072 },
10073 GetErrorMessageCore: function(isScriptRequired){
10074  var markerObj = this.GetMarkerObject();
10075  if(this.isExisted && markerObj && markerObj.DXPatched || !isScriptRequired && !markerObj)
10076   return null;
10077  if(isScriptRequired && !this.GetMarkerObject()){
10078   if(this.isExisted)
10079    return this.scriptName + " script was attached but has been overridden.";
10080   else
10081    return this.scriptName + " script was not attached.";
10082  }
10083  if(!this.isExisted)
10084   return this.scriptName + " script was attached after DevExpress scripts.";
10085  return this.scriptName + " script was attached multiple times and mixed up with DevExpress scripts.";
10086 },
10087 GetMarkerObject: function() {
10088  return ASPx.GetGlobalObject(this.markerObjectName);
10089 }
10090});
10091var PatchScriptCommand = ASPx.CreateClass(CheckingScriptObjectCommand, {
10092 constructor: function(scriptName, markerObjectName, patchMethod, required) {
10093  this.constructor.prototype.constructor.call(this, scriptName, markerObjectName);
10094  this.required = required;
10095  this.patchMethod = patchMethod;
10096 },
10097 Run: function() {
10098  CheckingScriptObjectCommand.prototype.Run.call(this);
10099  if(this.isExisted)
10100   this.patchMethod();
10101 },
10102 GetErrorMessage: function() {  
10103  return this.GetErrorMessageCore(this.required);
10104 }
10105});
10106var ExternalScriptProcessor = ASPx.CreateClass(null, {
10107 constructor: function() {
10108  this.commands = {};
10109 },
10110 Process: function(scriptName, markerObjectName, patchMethod, required) {
10111  var newCommand = this.CreateCommand(scriptName, markerObjectName, patchMethod, !!required);
10112  var oldCommand = this.commands[markerObjectName];
10113  if(oldCommand) {
10114   if(!oldCommand.patchMethod && !newCommand.patchMethod)
10115    newCommand = null;
10116   else if(newCommand.patchMethod && (!oldCommand.patchMethod || oldCommand.required))
10117    newCommand.required = true;
10118   else if(oldCommand.patchMethod && !newCommand.patchMethod) {
10119    oldCommand.required = true;
10120    newCommand = null;
10121   }
10122  }
10123  if(newCommand) {
10124   this.commands[markerObjectName] = newCommand;
10125   newCommand.Run();
10126  }
10127 },
10128 CreateCommand: function(scriptName, markerObjectName, patchMethod, required) {
10129  if(patchMethod)
10130   return new PatchScriptCommand(scriptName, markerObjectName, patchMethod, required);
10131  return new CheckingScriptObjectCommand(scriptName, markerObjectName);
10132 },
10133 ShowErrorMessages: function() {
10134  var messages = this.GetErrorMessages();
10135  var console = window.console;
10136  if(!messages.length || !console || !ASPx.IsFunction(console.error))
10137   return;
10138  for(var i = 0; i < messages.length; i++) {
10139   console.error(messages[i]);
10140  }
10141  ASPx.ShowKBErrorMessage("Please check the correctness of script registration on the page. For details, see ", "T272309");
10142 },
10143 GetErrorMessages: function() {
10144  var messages = [];
10145  for (var key in this.commands) {
10146   if (this.commands.hasOwnProperty(key)) {
10147    var message = this.commands[key].GetErrorMessage();
10148    if (message)
10149     messages.push(message);
10150   }
10151  }
10152  return messages;
10153 }
10154});
10155ExternalScriptProcessor.Instance = null;
10156ExternalScriptProcessor.getInstance = function() {
10157 if(!ExternalScriptProcessor.Instance)
10158  ExternalScriptProcessor.Instance = new ExternalScriptProcessor();
10159 return ExternalScriptProcessor.Instance;
10160};
10161ASPx.ExternalScriptProcessor = ExternalScriptProcessor;
10162})();
10163(function () {
10164var ASPxClientBeginCallbackEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
10165 constructor: function(command){
10166  this.constructor.prototype.constructor.call(this);
10167  this.command = command;
10168 }
10169});
10170var ASPxClientGlobalBeginCallbackEventArgs = ASPx.CreateClass(ASPxClientBeginCallbackEventArgs, {
10171 constructor: function(control, command){
10172  this.constructor.prototype.constructor.call(this, command);
10173  this.control = control;
10174 }
10175});
10176var ASPxClientEndCallbackEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
10177 constructor: function(){
10178  this.constructor.prototype.constructor.call(this);
10179 }
10180});
10181var ASPxClientGlobalEndCallbackEventArgs = ASPx.CreateClass(ASPxClientEndCallbackEventArgs, {
10182 constructor: function(control){
10183  this.constructor.prototype.constructor.call(this);
10184  this.control = control;
10185 }
10186});
10187var ASPxClientCustomDataCallbackEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
10188 constructor: function(result) {
10189  this.constructor.prototype.constructor.call(this);
10190  this.result = result;
10191 }
10192});
10193var ASPxClientCallbackErrorEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
10194 constructor: function (message, callbackId) {
10195  this.constructor.prototype.constructor.call(this);
10196  this.message = message;
10197  this.handled = false;
10198  this.callbackId = callbackId;
10199 }
10200});
10201var ASPxClientGlobalCallbackErrorEventArgs = ASPx.CreateClass(ASPxClientCallbackErrorEventArgs, {
10202 constructor: function (control, message, callbackId) {
10203  this.constructor.prototype.constructor.call(this, message, callbackId);
10204  this.control = control;
10205 }
10206});
10207var ASPxClientValidationCompletedEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
10208 constructor: function (container, validationGroup, invisibleControlsValidated, isValid, firstInvalidControl, firstVisibleInvalidControl) {
10209  this.constructor.prototype.constructor.call(this);
10210  this.container = container;
10211  this.validationGroup = validationGroup;
10212  this.invisibleControlsValidated = invisibleControlsValidated;
10213  this.isValid = isValid;
10214  this.firstInvalidControl = firstInvalidControl;
10215  this.firstVisibleInvalidControl = firstVisibleInvalidControl;
10216 }
10217});
10218var ASPxClientControlsInitializedEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
10219 constructor: function(isCallback) {
10220  this.isCallback = isCallback;
10221 }
10222});
10223var ASPxClientControlBeforePronounceEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
10224 constructor: function(messageParts, control){
10225  this.constructor.prototype.constructor.call(this);
10226  this.messageParts = messageParts;
10227  this.control = control;
10228 }
10229});
10230var ASPxClientControlUnloadEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
10231 constructor: function(control){
10232  this.constructor.prototype.constructor.call(this);
10233  this.control = control;
10234 }
10235});
10236var BeforeInitCallbackEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
10237 constructor: function(callbackOwnerID){
10238  this.constructor.prototype.constructor.call(this);
10239  this.callbackOwnerID = callbackOwnerID;
10240 }
10241});
10242ASPx.createControl = function(type, name, windowName, properties, events, setupMethod, data){
10243 var dxo = new type(name);
10244 dxo.InitGlobalVariable(windowName && windowName.length > 0 ? windowName : name);
10245 if(properties)
10246  dxo.SetProperties(properties);
10247 if(events)
10248  dxo.SetEvents(events);
10249 if(setupMethod)
10250  setupMethod.call(dxo);
10251 if(data)
10252  dxo.SetData(data);
10253 dxo.AfterCreate();
10254};
10255var ASPxClientControlBase = ASPx.CreateClass(null, {
10256 constructor: function(name){
10257  this.name = name;
10258  this.uniqueID = name;   
10259  this.globalName = name;
10260  this.stateObject = null;
10261  this.encodeHtml = true;
10262  this.enabled = true;
10263  this.clientEnabled = true;
10264  this.savedClientEnabled = true;
10265  this.clientVisible = true;
10266  this.accessibilityCompliant = false;
10267  this.parseJSPropertiesOnCallbackError = false;
10268  this.autoPostBack = false;
10269  this.allowMultipleCallbacks = true;
10270  this.callBack = null;
10271  this.enableCallbackAnimation = false;
10272  this.enableSlideCallbackAnimation = false;
10273  this.slideAnimationDirection = null;
10274  this.beginCallbackAnimationProcessing = false;
10275  this.endCallbackAnimationProcessing = false;
10276  this.savedCallbackResult = null;
10277  this.savedCallbacks = null;
10278  this.isCallbackAnimationPrevented = false;
10279  this.lpDelay = 300;
10280  this.lpTimer = -1;
10281  this.requestCount = 0;
10282  this.enableSwipeGestures = false;
10283  this.disableSwipeGestures = false;
10284  this.supportGestures = false;
10285  this.repeatedGestureValue = 0;
10286  this.repeatedGestureCount = 0;
10287  this.isInitialized = false;
10288  this.initialFocused = false;
10289  this.leadingAfterInitCall = ASPxClientControl.LeadingAfterInitCallConsts.None; 
10290  this.serverEvents = [];
10291  this.loadingPanelElement = null;
10292  this.loadingDivElement = null;  
10293  this.hasPhantomLoadingElements = false;
10294  this.mainElement = null;
10295  this.touchUIMouseScroller = null;
10296  this.hiddenFields = { };
10297  this.callbackHandlersQueue = new ASPx.ControlCallbackHandlersQueue(this);
10298  this.Init = new ASPxClientEvent();
10299  this.BeginCallback = new ASPxClientEvent();
10300  this.EndCallback = new ASPxClientEvent();
10301  this.EndCallbackAnimationStart = new ASPxClientEvent();
10302  this.CallbackError = new ASPxClientEvent();
10303  this.CustomDataCallback = new ASPxClientEvent();
10304  this.BeforePronounce = new ASPxClientEvent();
10305  this.Unload = new ASPxClientEvent();
10306  aspxGetControlCollection().Add(this);
10307 },
10308 Initialize: function() {
10309  if(this.callBack != null)
10310   this.InitializeCallBackData();
10311  if (this.useCallbackQueue())
10312   this.callbackQueueHelper = new ASPx.ControlCallbackQueueHelper(this);
10313  ASPx.AccessibilityUtils.createAccessibleBackgrounds(this);
10314  if(this.accessibilityCompliant)
10315   ASPx.AccessibilityPronouncer.EnsureInitialize();
10316 },
10317 InlineInitialize: function() {
10318  this.savedClientEnabled = this.clientEnabled;
10319 },
10320 InitializeGestures: function() {
10321  if(this.isSwipeGesturesEnabled() && this.supportGestures) {
10322   ASPx.GesturesHelper.AddSwipeGestureHandler(this.name, 
10323    function() { return this.GetCallbackAnimationElement(); }.aspxBind(this), 
10324    function(evt) { return this.CanHandleGestureCore(evt); }.aspxBind(this), 
10325    function(value) { return this.AllowStartGesture(value); }.aspxBind(this),
10326    function(value) { return this.StartGesture(); }.aspxBind(this),
10327    function(value) { return this.AllowExecuteGesture(value); }.aspxBind(this),
10328    function(value) { this.ExecuteGesture(value); }.aspxBind(this),
10329    function(value) { this.CancelGesture(value); }.aspxBind(this),
10330    this.GetDefaultanimationEngineType(),
10331    this.rtl
10332   );
10333   if(ASPx.Browser.MSTouchUI)
10334    this.touchUIMouseScroller = ASPx.MouseScroller.Create(
10335     function() { return this.GetCallbackAnimationElement(); }.aspxBind(this),
10336     function() { return null; },
10337     function() { return this.GetCallbackAnimationElement(); }.aspxBind(this),
10338     function(element) { return this.NeedPreventTouchUIMouseScrolling(element); }.aspxBind(this),
10339     true
10340    );
10341  }
10342 },
10343 isSwipeGesturesEnabled: function() {
10344  return !this.disableSwipeGestures && (this.enableSwipeGestures || ASPx.Browser.TouchUI);
10345 },
10346 isSlideCallbackAnimationEnabled: function() {
10347  return this.enableSlideCallbackAnimation || this.isSwipeGesturesEnabled(); 
10348 },
10349 InitGlobalVariable: function(varName){
10350  if(!window) return;
10351  this.globalName = varName;
10352  window[varName] = this;
10353 },
10354 SetProperties: function(properties, obj){
10355  if(!obj) obj = this;
10356  for(var name in properties){
10357   if(properties.hasOwnProperty(name))
10358    obj[name] = properties[name];
10359  }
10360 },
10361 SetEvents: function(events, obj){
10362  if(!obj) obj = this;
10363  for(var name in events){
10364   if(events.hasOwnProperty(name) && obj[name] && obj[name].AddHandler)
10365    obj[name].AddHandler(events[name]);
10366  }
10367 },
10368 SetData: function(data){
10369 },
10370 useCallbackQueue: function(){
10371  return false;
10372 },
10373 NeedPreventTouchUIMouseScrolling: function(element) {
10374  return false;
10375 },
10376 InitailizeFocus: function() {
10377  if(this.initialFocused && this.IsVisible())
10378   this.Focus();
10379 },
10380 AfterCreate: function() { 
10381  this.InlineInitialize();
10382  this.InitializeGestures();
10383 },
10384 AfterInitialize: function() {
10385  this.initializeAriaDescriptor();
10386  this.InitailizeFocus();
10387  this.isInitialized = true;
10388  this.RaiseInit();
10389  if(this.savedCallbacks) {
10390   for(var i = 0; i < this.savedCallbacks.length; i++) 
10391    this.CreateCallbackInternal(this.savedCallbacks[i].arg, this.savedCallbacks[i].command, 
10392     false, this.savedCallbacks[i].callbackInfo);
10393   this.savedCallbacks = null;
10394  }
10395 },
10396 InitializeCallBackData: function() {
10397 },
10398 AtlasPreInitialize: function() {
10399 },
10400 AtlasInitialize: function() {
10401 },
10402 IsDOMDisposed: function() { 
10403  return !ASPx.IsExistsElement(this.GetMainElement());
10404 },
10405 initializeAriaDescriptor: function() {
10406  if(this.ariaDescription) {
10407   var descriptionObject = ASPx.Json.Eval(this.ariaDescription);
10408   if(descriptionObject) {
10409    this.ariaDescriptor = new AriaDescriptor(this, descriptionObject);
10410    this.applyAccessibilityAttributes(this.ariaDescriptor); 
10411   }
10412  }
10413 },
10414 applyAccessibilityAttributes: function() { },
10415 setAriaDescription: function(selector, argsList) {
10416  if(this.ariaDescriptor)
10417   this.ariaDescriptor.setDescription(selector, argsList || [[]]);
10418 },
10419 allowRestoreFocusOnCallbacks: function(){
10420  return this.accessibilityCompliant;
10421 },
10422 HtmlEncode: function(text) {
10423  return this.encodeHtml ? ASPx.Str.EncodeHtml(text) : text;
10424 },
10425 IsServerEventAssigned: function(eventName){
10426  return ASPx.Data.ArrayIndexOf(this.serverEvents, eventName) >= 0;
10427 },
10428 OnPost: function(args){
10429  this.UpdateStateObject();
10430  if(this.stateObject != null) 
10431   this.UpdateStateHiddenField();
10432 },
10433 OnPostFinalization: function(args){
10434 },
10435 UpdateStateObject: function(){
10436 },
10437 UpdateStateObjectWithObject: function(obj){
10438  if(!obj) return;
10439  if(!this.stateObject)
10440   this.stateObject = { };
10441  for(var key in obj)
10442   if(obj.hasOwnProperty(key))
10443    this.stateObject[key] = obj[key];
10444 },
10445 UpdateStateHiddenField: function(){
10446  var stateHiddenField = this.GetStateHiddenField();
10447  if(stateHiddenField) {
10448   var stateObjectStr = ASPx.Json.ToJson(this.stateObject);
10449   stateHiddenField.value = ASPx.Str.EncodeHtml(stateObjectStr);
10450  }
10451 },
10452 GetStateHiddenField: function() {
10453  return this.GetHiddenField(this.GetStateHiddenFieldName(), this.GetStateHiddenFieldID(), 
10454   this.GetStateHiddenFieldParent(), this.GetStateHiddenFieldOrigin());
10455 },
10456 GetStateHiddenFieldName: function() {
10457  return this.uniqueID;
10458 },
10459 GetStateHiddenFieldID: function() {
10460  return this.name + "_State";
10461 },
10462 GetStateHiddenFieldOrigin: function() {
10463  return this.GetMainElement();
10464 },
10465 GetStateHiddenFieldParent: function() {
10466  var element = this.GetStateHiddenFieldOrigin();
10467  return element ? element.parentNode : null;
10468 },
10469 GetHiddenField: function(name, id, parent, beforeElement) {
10470  var hiddenField = this.hiddenFields[id];
10471  if(!hiddenField || !ASPx.IsValidElement(hiddenField)) {
10472   if(parent) {
10473    var existingHiddenField = ASPx.GetElementById(this.GetStateHiddenFieldID());
10474    this.hiddenFields[id] = hiddenField = existingHiddenField || ASPx.CreateHiddenField(name, id);
10475    if(existingHiddenField)
10476     return existingHiddenField;
10477    if(beforeElement)
10478     parent.insertBefore(hiddenField, beforeElement);
10479    else
10480     parent.appendChild(hiddenField);
10481   }
10482  }
10483  return hiddenField;
10484 },
10485 GetChildElement: function(idPostfix){
10486  var mainElement = this.GetMainElement();
10487  if(idPostfix.charAt && idPostfix.charAt(0) !== "_")
10488   idPostfix = "_" + idPostfix;
10489  return mainElement ? ASPx.CacheHelper.GetCachedChildById(this, mainElement, this.name + idPostfix) : null;
10490 },
10491 getChildControl: function(idPostfix) {
10492  var result = null;
10493  var childControlId = this.getChildControlUniqueID(idPostfix);
10494  ASPx.GetControlCollection().ProcessControlsInContainer(this.GetMainElement(), function(control) {
10495   if(control.uniqueID == childControlId)
10496    result = control;
10497  });
10498  return result;  
10499 },
10500 getChildControlUniqueID: function(idPostfix) {
10501  idPostfix = idPostfix.split("_").join("$");
10502  if(idPostfix.charAt && idPostfix.charAt(0) !== "$")
10503   idPostfix = "$" + idPostfix;
10504  return this.uniqueID + idPostfix;  
10505 },
10506 getInnerControl: function(idPostfix) {
10507  var name = this.name + idPostfix;
10508  var result = window[name];
10509  return result && Ident.IsASPxClientControl(result)
10510   ? result
10511   : null;
10512 },
10513 GetParentForm: function(){
10514  return ASPx.GetParentByTagName(this.GetMainElement(), "FORM");
10515 },
10516 GetMainElement: function(){
10517  if(!ASPx.IsExistsElement(this.mainElement))
10518   this.mainElement = ASPx.GetElementById(this.GetMainElementId());
10519  return this.mainElement;
10520 },
10521 GetMainElementId: function() {
10522  return this.name;
10523 },
10524 IsLoadingContainerVisible: function(){
10525  return this.IsVisible();
10526 },
10527 GetLoadingPanelElement: function(){
10528  return ASPx.GetElementById(this.name + "_LP");
10529 },
10530 GetClonedLoadingPanel: function(){
10531  return document.getElementById(this.GetLoadingPanelElement().id + "V"); 
10532 },
10533 CloneLoadingPanel: function(element, parent) {
10534  var clone = element.cloneNode(true);
10535  clone.id = element.id + "V";
10536  parent.appendChild(clone);
10537  return clone;
10538 },
10539 CreateLoadingPanelWithoutBordersInsideContainer: function(container) {
10540  var loadingPanel = this.CreateLoadingPanelInsideContainer(container, false, true, true);
10541  var contentStyle = ASPx.GetCurrentStyle(container);
10542  if(!loadingPanel || !contentStyle)
10543   return;
10544  var elements = [ ];
10545  var table = (loadingPanel.tagName == "TABLE") ? loadingPanel : ASPx.GetNodeByTagName(loadingPanel, "TABLE", 0);
10546  if(table != null)
10547   elements.push(table);
10548  else
10549   elements.push(loadingPanel);
10550  var cells = ASPx.GetNodesByTagName(loadingPanel, "TD");
10551  if(!cells) cells = [ ];
10552  for(var i = 0; i < cells.length; i++)
10553   elements.push(cells[i]);
10554  for(var i = 0; i < elements.length; i++) {
10555   var el = elements[i];
10556   el.style.backgroundColor = contentStyle.backgroundColor;
10557   ASPx.RemoveBordersAndShadows(el);
10558  }
10559 },
10560 CreateLoadingPanelInsideContainer: function(parentElement, hideContent, collapseHeight, collapseWidth) {
10561  if(this.ShouldHideExistingLoadingElements())
10562   this.HideLoadingPanel();
10563  if(parentElement == null)
10564   return null;
10565  if(!this.IsLoadingContainerVisible()) {
10566   this.hasPhantomLoadingElements = true;
10567   return null;
10568  }
10569  var element = this.GetLoadingPanelElement();
10570  if(element != null){
10571   var width = collapseWidth ? 0 : ASPx.GetClearClientWidth(parentElement);
10572   var height = collapseHeight ? 0 : ASPx.GetClearClientHeight(parentElement);
10573   if(hideContent){
10574    for(var i = parentElement.childNodes.length - 1; i > -1; i--){
10575     if(parentElement.childNodes[i].style)
10576      parentElement.childNodes[i].style.display = "none";
10577     else if(parentElement.childNodes[i].nodeType == 3) 
10578      parentElement.removeChild(parentElement.childNodes[i]);
10579    }
10580   }
10581   else
10582    parentElement.innerHTML = "";
10583   var table = document.createElement("TABLE");
10584   parentElement.appendChild(table);
10585   table.border = 0;
10586   table.cellPadding = 0;
10587   table.cellSpacing = 0;
10588   ASPx.SetStyles(table, {
10589    width: (width > 0) ? width : "100%",
10590    height: (height > 0) ? height : "100%"
10591   });
10592   var tbody = document.createElement("TBODY");
10593   table.appendChild(tbody);
10594   var tr = document.createElement("TR");
10595   tbody.appendChild(tr);
10596   var td = document.createElement("TD");
10597   tr.appendChild(td);
10598   td.align = "center";
10599   td.vAlign = "middle";
10600   element = this.CloneLoadingPanel(element, td);
10601   ASPx.SetElementDisplay(element, true, true);
10602   this.loadingPanelElement = element;
10603   return element;
10604  } else
10605   parentElement.innerHTML = "&nbsp;";
10606  return null;
10607 },
10608 CreateLoadingPanelWithAbsolutePosition: function(parentElement, offsetElement) {
10609  if(this.ShouldHideExistingLoadingElements())
10610   this.HideLoadingPanel();
10611  if(parentElement == null)
10612   return null;
10613  if(!this.IsLoadingContainerVisible()) {
10614   this.hasPhantomLoadingElements = true;
10615   return null;
10616  }
10617  if(!offsetElement)
10618   offsetElement = parentElement;
10619  var element = this.GetLoadingPanelElement();
10620  if(element != null) {
10621   element = this.CloneLoadingPanel(element, parentElement);
10622   ASPx.SetStyles(element, {
10623    position: "absolute"
10624   });
10625   ASPx.SetElementDisplay(element, true, true);
10626   ASPx.Evt.AttachEventToElement(element, ASPx.Evt.GetMouseWheelEventName(), ASPx.Evt.PreventEvent);
10627   this.SetLoadingPanelLocation(offsetElement, element);
10628   this.loadingPanelElement = element;
10629   return element;
10630  }
10631  return null;
10632 },
10633 CreateLoadingPanelInline: function(parentElement, centerInParent){
10634  if(this.ShouldHideExistingLoadingElements())
10635   this.HideLoadingPanel();
10636  if(parentElement == null)
10637   return null;
10638  if(!this.IsLoadingContainerVisible()) {
10639   this.hasPhantomLoadingElements = true;
10640   return null;
10641  }
10642  var element = this.GetLoadingPanelElement();
10643  if(element != null) {
10644   element = this.CloneLoadingPanel(element, parentElement);
10645   if(centerInParent){
10646    ASPx.SetElementDisplay(element, true, true, true);
10647    parentElement.style.textAlign = "center";
10648   }
10649   else
10650    ASPx.SetElementDisplay(element, true, true);
10651   this.loadingPanelElement = element;
10652   return element;
10653  }
10654  return null;
10655 },
10656 ShowLoadingPanel: function() {
10657 },
10658 ShowLoadingElements: function() {
10659  if(this.InCallback() || this.lpTimer > -1) return;
10660  this.ShowLoadingDiv();
10661  if(this.IsCallbackAnimationEnabled())
10662   this.StartBeginCallbackAnimation();
10663  else
10664   this.ShowLoadingElementsInternal();
10665 },
10666 ShowLoadingElementsInternal: function() {
10667  if(this.lpDelay > 0 && !this.IsCallbackAnimationEnabled()) 
10668   this.lpTimer = window.setTimeout(function() { 
10669    this.ShowLoadingPanelOnTimer(); 
10670   }.aspxBind(this), this.lpDelay);
10671  else {
10672   this.RestoreLoadingDivOpacity();
10673   this.ShowLoadingPanel();
10674  }
10675 },
10676 GetLoadingPanelOffsetElement: function (baseElement) {
10677  if(this.IsCallbackAnimationEnabled()) {
10678   var element = this.GetLoadingPanelCallbackAnimationOffsetElement();
10679   if(element) {
10680    var container = typeof(ASPx.AnimationHelper) != "undefined" ? ASPx.AnimationHelper.findSlideAnimationContainer(element) : null;
10681    if(container)
10682     return container.parentNode.parentNode;
10683    else
10684     return element;
10685   }
10686  }
10687  return baseElement;
10688 },
10689 GetLoadingPanelCallbackAnimationOffsetElement: function () {
10690  return this.GetCallbackAnimationElement();
10691 },
10692 IsCallbackAnimationEnabled: function () {
10693  return (this.enableCallbackAnimation || this.isSlideCallbackAnimationEnabled()) && !this.isCallbackAnimationPrevented;
10694 },
10695 GetDefaultanimationEngineType: function() {
10696  return ASPx.AnimationEngineType.DEFAULT;
10697 },
10698 StartBeginCallbackAnimation: function () {
10699  this.beginCallbackAnimationProcessing = true;
10700  this.isCallbackFinished = false;
10701  var element = this.GetCallbackAnimationElement();
10702  if (element && this.isSlideCallbackAnimationEnabled() && this.slideAnimationDirection)
10703   ASPx.AnimationHelper.slideOut(element, this.slideAnimationDirection, this.FinishBeginCallbackAnimation.aspxBind(this), this.GetDefaultanimationEngineType(), this.rtl);
10704  else if(element && this.enableCallbackAnimation) 
10705   ASPx.AnimationHelper.fadeOut(element, this.FinishBeginCallbackAnimation.aspxBind(this));
10706  else
10707   this.FinishBeginCallbackAnimation();
10708 },
10709 CancelBeginCallbackAnimation: function() {
10710  if(this.beginCallbackAnimationProcessing) {
10711   this.beginCallbackAnimationProcessing = false;
10712   var element = this.GetCallbackAnimationElement();
10713   ASPx.AnimationHelper.cancelAnimation(element);
10714  }
10715 },
10716 FinishBeginCallbackAnimation: function () {
10717  this.beginCallbackAnimationProcessing = false;
10718  if(!this.isCallbackFinished)
10719   this.ShowLoadingElementsInternal();
10720  else {
10721   this.DoCallback(this.savedCallbackResult);
10722   this.savedCallbackResult = null;
10723  }
10724 },
10725 CheckBeginCallbackAnimationInProgress: function(callbackResult) {
10726  if(this.beginCallbackAnimationProcessing) {
10727   this.savedCallbackResult = callbackResult;
10728   this.isCallbackFinished = true;
10729   return true;
10730  }
10731  return false;
10732 },
10733 StartEndCallbackAnimation: function () {
10734  this.HideLoadingPanel();
10735  this.SetInitialLoadingDivOpacity();
10736  this.RaiseEndCallbackAnimationStart();
10737  this.endCallbackAnimationProcessing = true;
10738  var element = this.GetCallbackAnimationElement();
10739  if(element && this.isSlideCallbackAnimationEnabled() && this.slideAnimationDirection) 
10740   ASPx.AnimationHelper.slideIn(element, this.slideAnimationDirection, this.FinishEndCallbackAnimation.aspxBind(this), this.GetDefaultanimationEngineType(), this.rtl);
10741  else if(element && this.enableCallbackAnimation) 
10742   ASPx.AnimationHelper.fadeIn(element, this.FinishEndCallbackAnimation.aspxBind(this));
10743  else
10744   this.FinishEndCallbackAnimation();
10745  this.slideAnimationDirection = null;
10746 },
10747 FinishEndCallbackAnimation: function () {
10748  this.DoEndCallback();
10749  this.endCallbackAnimationProcessing = false;
10750  this.CheckRepeatGesture();
10751 },
10752 CheckEndCallbackAnimationNeeded: function() {
10753  if(!this.endCallbackAnimationProcessing && this.requestCount == 1) {
10754   this.StartEndCallbackAnimation();
10755   return true;
10756  }
10757  return false;
10758 },
10759 PreventCallbackAnimation: function() {
10760  this.isCallbackAnimationPrevented = true;
10761 },
10762 GetCallbackAnimationElement: function() {
10763  return null;
10764 },
10765 AssignSlideAnimationDirectionByPagerArgument: function(arg, currentPageIndex) {
10766  this.slideAnimationDirection = null;
10767  if(this.isSlideCallbackAnimationEnabled() && typeof(ASPx.AnimationHelper) != "undefined") {
10768   if(arg == PagerCommands.Next || arg == PagerCommands.Last)
10769    this.slideAnimationDirection = ASPx.AnimationHelper.SLIDE_LEFT_DIRECTION;
10770   else if(arg == PagerCommands.First || arg == PagerCommands.Prev)
10771    this.slideAnimationDirection = ASPx.AnimationHelper.SLIDE_RIGHT_DIRECTION;
10772   else if(!isNaN(currentPageIndex) && arg.indexOf(PagerCommands.PageNumber) == 0) {
10773    var newPageIndex = parseInt(arg.substring(2));
10774    if (!isNaN(newPageIndex)) {
10775     var leftDir = this.rtl ? ASPx.AnimationHelper.SLIDE_LEFT_DIRECTION : ASPx.AnimationHelper.SLIDE_RIGHT_DIRECTION;
10776     var rightDir = this.rtl ? ASPx.AnimationHelper.SLIDE_RIGHT_DIRECTION : ASPx.AnimationHelper.SLIDE_LEFT_DIRECTION;
10777     this.slideAnimationDirection = newPageIndex < currentPageIndex ? leftDir : rightDir;
10778    }
10779   }
10780  }
10781 },
10782 TryShowPhantomLoadingElements: function () {
10783  if(this.hasPhantomLoadingElements && this.InCallback()) {
10784   this.hasPhantomLoadingElements = false;
10785   this.ShowLoadingDivAndPanel();
10786  }
10787 },
10788 ShowLoadingDivAndPanel: function () {
10789  this.ShowLoadingDiv();
10790  this.RestoreLoadingDivOpacity();
10791  this.ShowLoadingPanel();
10792 },
10793 HideLoadingElements: function() {
10794  this.CancelBeginCallbackAnimation();
10795  this.HideLoadingPanel();
10796  this.HideLoadingDiv();
10797 },
10798 ShowLoadingPanelOnTimer: function() {
10799  this.ClearLoadingPanelTimer();
10800  if(!this.IsDOMDisposed()) {
10801   this.RestoreLoadingDivOpacity();
10802   this.ShowLoadingPanel();
10803  }
10804 },
10805 ClearLoadingPanelTimer: function() {
10806  this.lpTimer = ASPx.Timer.ClearTimer(this.lpTimer);  
10807 },
10808 HideLoadingPanel: function() {
10809  this.ClearLoadingPanelTimer();
10810  this.hasPhantomLoadingElements = false;
10811  if(ASPx.IsExistsElement(this.loadingPanelElement)) {
10812   ASPx.RemoveElement(this.loadingPanelElement);
10813   this.loadingPanelElement = null;
10814  }
10815 },
10816 SetLoadingPanelLocation: function(offsetElement, loadingPanel, x, y, offsetX, offsetY) {
10817  if(!ASPx.IsExists(x) || !ASPx.IsExists(y)){
10818   var x1 = ASPx.GetAbsoluteX(offsetElement);
10819   var y1 = ASPx.GetAbsoluteY(offsetElement);
10820   var x2 = x1;
10821   var y2 = y1;
10822   if(offsetElement == document.body) {
10823    x1 = 0;
10824    y1 = 0;
10825    x2 = ASPx.GetDocumentMaxClientWidth();
10826    y2 = ASPx.GetDocumentMaxClientHeight();
10827   }
10828   else{
10829    x2 += offsetElement.offsetWidth;
10830    y2 += offsetElement.offsetHeight;
10831   }
10832   if(x1 < ASPx.GetDocumentScrollLeft())
10833    x1 = ASPx.GetDocumentScrollLeft();
10834   if(y1 < ASPx.GetDocumentScrollTop())
10835    y1 = ASPx.GetDocumentScrollTop();
10836   if(x2 > ASPx.GetDocumentScrollLeft() + ASPx.GetDocumentClientWidth())
10837    x2 = ASPx.GetDocumentScrollLeft() + ASPx.GetDocumentClientWidth();
10838   if(y2 > ASPx.GetDocumentScrollTop() + ASPx.GetDocumentClientHeight())
10839    y2 = ASPx.GetDocumentScrollTop() + ASPx.GetDocumentClientHeight();
10840   x = x1 + ((x2 - x1 - loadingPanel.offsetWidth) / 2);
10841   y = y1 + ((y2 - y1 - loadingPanel.offsetHeight) / 2);
10842  }
10843  if(ASPx.IsExists(offsetX) && ASPx.IsExists(offsetY)){
10844   x += offsetX;
10845   y += offsetY;
10846  }
10847  x = ASPx.PrepareClientPosForElement(x, loadingPanel, true);
10848  y = ASPx.PrepareClientPosForElement(y, loadingPanel, false);
10849  if(ASPx.Browser.IE && ASPx.Browser.Version > 8) {
10850   x = Math.round(x);
10851   y = Math.round(y);
10852  }
10853  ASPx.SetStyles(loadingPanel, { left: x, top: y });
10854 },
10855 GetLoadingDiv: function(){
10856  return ASPx.GetElementById(this.name + "_LD");
10857 },
10858 CreateLoadingDiv: function(parentElement, offsetElement){
10859  if(this.ShouldHideExistingLoadingElements())
10860   this.HideLoadingDiv();
10861  if(parentElement == null) 
10862   return null;
10863  if(!this.IsLoadingContainerVisible()) {
10864   this.hasPhantomLoadingElements = true;
10865   return null;
10866  }
10867  if(!offsetElement)
10868   offsetElement = parentElement;
10869  var div = this.GetLoadingDiv();
10870  if(div != null){
10871   div = div.cloneNode(true);
10872   parentElement.appendChild(div);
10873   ASPx.SetElementDisplay(div, true, true);
10874   ASPx.Evt.AttachEventToElement(div, ASPx.TouchUIHelper.touchMouseDownEventName, ASPx.Evt.PreventEvent);
10875   ASPx.Evt.AttachEventToElement(div, ASPx.TouchUIHelper.touchMouseMoveEventName, ASPx.Evt.PreventEvent);
10876   ASPx.Evt.AttachEventToElement(div, ASPx.TouchUIHelper.touchMouseUpEventName, ASPx.Evt.PreventEvent);
10877   ASPx.Evt.AttachEventToElement(div, ASPx.Evt.GetMouseWheelEventName(), ASPx.Evt.PreventEvent);
10878   this.SetLoadingDivBounds(offsetElement, div);
10879   this.loadingDivElement = div;
10880   this.SetInitialLoadingDivOpacity();
10881   return div;
10882  }
10883  return null;
10884 },
10885 SetInitialLoadingDivOpacity: function() {
10886  if(!this.loadingDivElement) return;
10887  ASPx.Attr.SaveStyleAttribute(this.loadingDivElement, "opacity");
10888  ASPx.Attr.SaveStyleAttribute(this.loadingDivElement, "filter");
10889  ASPx.SetElementOpacity(this.loadingDivElement, 0.01);
10890 },
10891 RestoreLoadingDivOpacity: function() {
10892  if(!this.loadingDivElement) return;
10893  ASPx.Attr.RestoreStyleAttribute(this.loadingDivElement, "opacity");
10894  ASPx.Attr.RestoreStyleAttribute(this.loadingDivElement, "filter");
10895 },
10896 SetLoadingDivBounds: function(offsetElement, loadingDiv) {
10897  var absX = (offsetElement == document.body) ? 0 : ASPx.GetAbsoluteX(offsetElement);
10898  var absY = (offsetElement == document.body) ? 0 : ASPx.GetAbsoluteY(offsetElement);
10899  ASPx.SetStyles(loadingDiv, {
10900   left: ASPx.PrepareClientPosForElement(absX, loadingDiv, true),
10901   top: ASPx.PrepareClientPosForElement(absY, loadingDiv, false)
10902  });
10903  var width = (offsetElement == document.body) ? ASPx.GetDocumentWidth() : offsetElement.offsetWidth;
10904  var height = (offsetElement == document.body) ? ASPx.GetDocumentHeight() : offsetElement.offsetHeight;
10905  if(height < 0) 
10906   height = 0;
10907  ASPx.SetStyles(loadingDiv, { width: width, height: height });
10908  var correctedWidth = 2 * width - loadingDiv.offsetWidth;
10909  if(correctedWidth <= 0) correctedWidth = width;
10910  var correctedHeight = 2 * height - loadingDiv.offsetHeight;
10911  if(correctedHeight <= 0) correctedHeight = height;
10912  ASPx.SetStyles(loadingDiv, { width: correctedWidth, height: correctedHeight });
10913 },
10914 ShowLoadingDiv: function() {
10915 },
10916 HideLoadingDiv: function() {
10917  this.hasPhantomLoadingElements = false;
10918  if(ASPx.IsExistsElement(this.loadingDivElement)){
10919   ASPx.RemoveElement(this.loadingDivElement);
10920   this.loadingDivElement = null;
10921  }
10922 },
10923 CanHandleGesture: function(evt) {
10924  return false;
10925 },
10926 CanHandleGestureCore: function(evt) {
10927  var source = ASPx.Evt.GetEventSource(evt);
10928  if(ASPx.GetIsParent(this.loadingPanelElement, source) || ASPx.GetIsParent(this.loadingDivElement, source))
10929   return true; 
10930  var callbackAnimationElement = this.GetCallbackAnimationElement();
10931  if(!callbackAnimationElement)
10932   return false;
10933  var animationContainer = ASPx.AnimationHelper.getSlideAnimationContainer(callbackAnimationElement, false, false);
10934  if(animationContainer && ASPx.GetIsParent(animationContainer, source) && !ASPx.GetIsParent(animationContainer.childNodes[0], source))
10935   return true; 
10936  return this.CanHandleGesture(evt); 
10937 },
10938 AllowStartGesture: function() {
10939  return !this.beginCallbackAnimationProcessing && !this.endCallbackAnimationProcessing;
10940 },
10941 StartGesture: function() {
10942 },
10943 AllowExecuteGesture: function(value) {
10944  return false;
10945 },
10946 ExecuteGesture: function(value) {
10947 },
10948 CancelGesture: function(value) {
10949  if(this.repeatedGestureCount === 0) {
10950   this.repeatedGestureValue = value;
10951   this.repeatedGestureCount = 1;
10952  }
10953  else {
10954   if(this.repeatedGestureValue * value > 0)
10955    this.repeatedGestureCount++;
10956   else
10957    this.repeatedGestureCount--;
10958   if(this.repeatedGestureCount === 0)
10959    this.repeatedGestureCount = 0;
10960  }
10961 },
10962 CheckRepeatGesture: function() {
10963  if(this.repeatedGestureCount !== 0) {
10964   if(this.AllowExecuteGesture(this.repeatedGestureValue))
10965    this.ExecuteGesture(this.repeatedGestureValue, this.repeatedGestureCount);
10966   this.repeatedGestureValue = 0;
10967   this.repeatedGestureCount = 0;
10968  }
10969 },
10970 AllowExecutePagerGesture: function (pageIndex, pageCount, value) {
10971  if(pageIndex < 0) return false;
10972  if(pageCount <= 1) return false;
10973  if(value > 0 && pageIndex === 0) return false;
10974  if(value < 0 && pageIndex === pageCount - 1) return false;
10975  return true;
10976 },
10977 ExecutePagerGesture: function(pageIndex, pageCount, value, count, method) {
10978  if(!count) count = 1;
10979  var pageIndex = pageIndex + (value < 0 ? count : -count);
10980  if(pageIndex < 0) pageIndex = 0;
10981  if(pageIndex > pageCount - 1) pageIndex = pageCount - 1;
10982  method(PagerCommands.PageNumber + pageIndex);
10983 },
10984 RaiseInit: function(){
10985  if(!this.Init.IsEmpty()){
10986   var args = new ASPxClientEventArgs();
10987   this.Init.FireEvent(this, args);
10988  }
10989 },
10990 RaiseBeginCallbackInternal: function(command){
10991  if(!this.BeginCallback.IsEmpty()){
10992   var args = new ASPxClientBeginCallbackEventArgs(command);
10993   this.BeginCallback.FireEvent(this, args);
10994  }
10995 },
10996 RaiseEndCallbackInternal: function() {
10997  if(!this.EndCallback.IsEmpty()){
10998   var args = new ASPxClientEndCallbackEventArgs();
10999   this.EndCallback.FireEvent(this, args);
11000  }
11001 },
11002 RaiseCallbackErrorInternal: function(message, callbackId) {
11003  if(!this.CallbackError.IsEmpty()) {
11004   var args = new ASPxClientCallbackErrorEventArgs(message, callbackId);
11005   this.CallbackError.FireEvent(this, args);
11006   if(args.handled)
11007    return { isHandled: true, errorMessage: args.message };
11008  }
11009 },
11010 RaiseBeginCallback: function(command){
11011  this.RaiseBeginCallbackInternal(command);    
11012  aspxGetControlCollection().RaiseBeginCallback(this, command);
11013 },
11014 RaiseEndCallback: function(){
11015  this.RaiseEndCallbackInternal();
11016  aspxGetControlCollection().RaiseEndCallback(this);
11017 },
11018 RaiseCallbackError: function (message, callbackId) {
11019  var result = this.RaiseCallbackErrorInternal(message, callbackId);
11020  if(!result) 
11021   result = aspxGetControlCollection().RaiseCallbackError(this, message, callbackId);
11022  return result;
11023 },
11024 RaiseEndCallbackAnimationStart: function(){
11025  if(!this.EndCallbackAnimationStart.IsEmpty()){
11026   var args = new ASPxClientEventArgs();
11027   this.EndCallbackAnimationStart.FireEvent(this, args);
11028  }
11029 },
11030 RaiseBeforePronounce: function(message) {
11031  var args = new ASPxClientControlBeforePronounceEventArgs(message, this);
11032  if(!this.BeforePronounce.IsEmpty())
11033   this.BeforePronounce.FireEvent(this, args);
11034  return args;
11035 },
11036 RaiseUnload: function() {
11037  var args = new ASPxClientControlUnloadEventArgs(this);
11038  if(!this.Unload.IsEmpty())
11039   this.Unload.FireEvent(this, args);
11040 },
11041 SendMessageToAssistiveTechnology: function(message) {
11042  if(!this.accessibilityCompliant)
11043   return;
11044  this.PronounceMessageInternal(message, ASPx.AccessibilityPronouncerType.live);
11045 },
11046 PronounceMessageInternal: function(messageArg, type) {
11047  var message = messageArg;
11048  if(!ASPx.Ident.IsArray(messageArg))
11049   message = [messageArg];
11050  var args = this.RaiseBeforePronounce(message);
11051  ASPx.AccessibilityPronouncer.Pronounce(args, type);
11052 },
11053 IsVisible: function() {
11054  var element = this.GetMainElement();
11055  return ASPx.IsElementVisible(element);
11056 },
11057 IsDisplayedElement: function(element) {
11058  while(element && element.tagName != "BODY") {
11059   if(!ASPx.GetElementDisplay(element)) 
11060    return false;
11061   element = element.parentNode;
11062  }
11063  return true;
11064 },
11065 IsDisplayed: function() {
11066  return this.IsDisplayedElement(this.GetMainElement());
11067 },
11068 IsHiddenElement: function(element) {
11069  return element && element.offsetWidth == 0 && element.offsetHeight == 0;
11070 },
11071 IsHidden: function() {
11072  return this.IsHiddenElement(this.GetMainElement());
11073 },
11074 GetParentControl: function() {
11075  var mainElement = this.GetMainElement() || (this.GetCurrentWindowElement && this.GetCurrentWindowElement());
11076  var popupPostfix = ASPx.PCWIdSuffix + "-1";
11077  var result = null;
11078  ASPx.GetParent(mainElement, function(element) {
11079   if(element === mainElement || !element.id)
11080    return false;
11081   var controlName = element.id.replace(popupPostfix, "");
11082   result = ASPx.GetControlCollection().Get(controlName);
11083   return !!result;
11084  });
11085  return result;
11086 },
11087 findParentByType: function (type) {
11088  var ctrl = this;
11089  while (ctrl) {
11090   var parent = ctrl.GetParentControl();
11091   if (parent && parent instanceof type)
11092    return parent;
11093   ctrl = parent;
11094  }
11095  return null;
11096 },
11097 Focus: function() {
11098 },
11099 GetClientVisible: function(){
11100  return this.GetVisible();
11101 },
11102 SetClientVisible: function(visible){
11103  this.SetVisible(visible);
11104 },
11105 GetVisible: function(){
11106  return this.clientVisible;
11107 },
11108 SetVisible: function(visible){
11109  if(this.clientVisible != visible){
11110   this.clientVisible = visible;
11111   ASPx.SetElementDisplay(this.GetMainElement(), visible);
11112   if(visible) {
11113    this.AdjustControl();
11114    var mainElement = this.GetMainElement();
11115    if(mainElement)
11116     aspxGetControlCollection().AdjustControls(mainElement);
11117   }
11118  }
11119 },
11120 GetEnabled: function() {
11121  return this.clientEnabled;
11122 },
11123 SetEnabled: function(enabled) {
11124  this.clientEnabled = enabled;
11125  if(ASPxClientControl.setEnabledLocked)
11126   return;
11127  else
11128   ASPxClientControl.setEnabledLocked = true;
11129  this.savedClientEnabled = enabled;
11130  aspxGetControlCollection().ProcessControlsInContainer(this.GetMainElement(), function(control) {
11131   if(ASPx.IsFunction(control.SetEnabled))
11132    control.SetEnabled(enabled && control.savedClientEnabled);
11133  });
11134  delete ASPxClientControl.setEnabledLocked;
11135 },
11136 InCallback: function() {
11137  return this.requestCount > 0;
11138 },
11139 DoBeginCallback: function(command) {
11140  this.RaiseBeginCallback(command || "");
11141  aspxGetControlCollection().Before_WebForm_InitCallback(this.name);
11142  if(typeof(WebForm_InitCallback) != "undefined" && WebForm_InitCallback) {
11143   __theFormPostData = "";
11144   __theFormPostCollection = [ ];
11145   this.ClearPostBackEventInput("__EVENTTARGET");
11146   this.ClearPostBackEventInput("__EVENTARGUMENT");
11147   WebForm_InitCallback();
11148   this.savedFormPostData = __theFormPostData;   
11149   this.savedFormPostCollection = __theFormPostCollection;
11150  }
11151 },
11152 ClearPostBackEventInput: function(id){
11153  var element = ASPx.GetElementById(id);
11154  if(element != null) element.value = "";
11155 },
11156 PerformDataCallback: function(arg, handler) {
11157  this.CreateCustomDataCallback(arg, "", handler);
11158 },
11159 sendCallbackViaQueue: function (prefix, arg, showLoadingPanel, context, handler, onBeforeSend) {
11160  if (!this.useCallbackQueue())
11161   return false;
11162  var context = context || this;
11163  var token = this.callbackQueueHelper.sendCallback(ASPx.FormatCallbackArg(prefix, arg), context, handler || context.OnCallback, prefix, onBeforeSend);
11164  if (showLoadingPanel)
11165   this.callbackQueueHelper.showLoadingElements();
11166  return token;
11167 },
11168 CreateCallback: function (arg, command, handler) {
11169  var callbackInfo = this.CreateCallbackInfo(ASPx.CallbackType.Common, handler || null);
11170  var callbackID = this.CreateCallbackByInfo(arg, command, callbackInfo);
11171  return callbackID;
11172 },
11173 CreateCustomDataCallback: function(arg, command, handler) {
11174  var callbackInfo = this.CreateCallbackInfo(ASPx.CallbackType.Data, handler);
11175  this.CreateCallbackByInfo(arg, command, callbackInfo);
11176 },
11177 CreateCallbackByInfo: function(arg, command, callbackInfo) {
11178  if(!this.CanCreateCallback()) return;
11179  var callbackID;
11180  if(typeof(WebForm_DoCallback) != "undefined" && WebForm_DoCallback && ASPx.documentLoaded || ASPx.Platform === "NETCORE")
11181   callbackID = this.CreateCallbackInternal(arg, command, true, callbackInfo);
11182  else {
11183   if(!this.savedCallbacks)
11184    this.savedCallbacks = [];
11185   var callbackInfo = { arg: arg, command: command, callbackInfo: callbackInfo };
11186   if(this.allowMultipleCallbacks)
11187    this.savedCallbacks.push(callbackInfo);
11188   else
11189    this.savedCallbacks[0] = callbackInfo;
11190  }
11191  return callbackID;
11192 },
11193 CreateCallbackInternal: function(arg, command, viaTimer, callbackInfo) {
11194  var watcher = ASPx.ControlUpdateWatcher.getInstance();
11195  if(watcher && !watcher.CanSendCallback(this, arg)) {
11196   this.CancelCallbackInternal();
11197   return;
11198  }
11199  this.requestCount++;
11200  this.DoBeginCallback(command);
11201  if(typeof(arg) == "undefined")
11202   arg = "";
11203  if(typeof(command) == "undefined")
11204   command = "";
11205  var callbackID = this.SaveCallbackInfo(callbackInfo);
11206  if(viaTimer)
11207   window.setTimeout(function() { this.CreateCallbackCore(arg, command, callbackID); }.aspxBind(this), 0);
11208  else
11209   this.CreateCallbackCore(arg, command, callbackID);
11210  return callbackID;
11211 },
11212 CancelCallbackInternal: function() {
11213  this.CancelCallbackCore();
11214  this.HideLoadingElements();
11215 },
11216 CancelCallbackCore: function() {
11217 },
11218 CreateCallbackCore: function(arg, command, callbackID) {
11219  var callBackMethod = this.GetCallbackMethod(command);
11220  __theFormPostData = this.savedFormPostData;
11221  __theFormPostCollection = this.savedFormPostCollection;
11222  callBackMethod.call(this, this.GetSerializedCallbackInfoByID(callbackID) + arg);
11223 },
11224 GetCallbackMethod: function(command){
11225  return this.callBack;
11226 },
11227 CanCreateCallback: function() {
11228  return !this.InCallback() || (this.allowMultipleCallbacks && !this.beginCallbackA
11228nimationProcessing && !this.endCallbackAnimationProcessing);
11229 },
11230 DoLoadCallbackScripts: function() {
11231  ASPx.ProcessScriptsAndLinks(this.name, true);
11232 },
11233 DoEndCallback: function() {
11234  if(this.IsCallbackAnimationEnabled() && this.CheckEndCallbackAnimationNeeded()) 
11235   return;
11236  this.requestCount--;
11237  if (this.requestCount < 1) 
11238   this.callbackHandlersQueue.executeCallbacksHandlers();
11239  if(this.HideLoadingPanelOnCallback() && this.requestCount < 1) 
11240   this.HideLoadingElements();
11241  if(this.isSwipeGesturesEnabled() && this.supportGestures) {
11242   ASPx.GesturesHelper.UpdateSwipeAnimationContainer(this.name);
11243   if(this.touchUIMouseScroller)
11244    this.touchUIMouseScroller.update();
11245  }
11246  this.isCallbackAnimationPrevented = false;
11247  this.OnCallbackFinalized();
11248  this.AssignEllipsisTooltips();
11249  this.RaiseEndCallback();
11250 },
11251 DoFinalizeCallback: function() {
11252 },
11253 OnCallbackFinalized: function() {
11254 },
11255 AssignEllipsisTooltips: function() { },
11256 HideLoadingPanelOnCallback: function() {
11257  return true;
11258 },
11259 ShouldHideExistingLoadingElements: function() {
11260  return true;
11261 },
11262 EvalCallbackResult: function(resultString){
11263  return eval(resultString);
11264 },
11265 ParseJSProperties: function(resultObj) {
11266  if(resultObj.cp) {
11267   for(var name in resultObj.cp)
11268    if(resultObj.cp.hasOwnProperty(name))
11269     this[name] = resultObj.cp[name];
11270  }
11271 },
11272 DoCallback: function(result) {
11273  if(this.IsCallbackAnimationEnabled() && this.CheckBeginCallbackA
11273nimationInProgress(result))
11274   return;
11275  result = ASPx.Str.Trim(result);
11276  if(result.indexOf(ASPx.CallbackResultPrefix) != 0) 
11277   this.ProcessCallbackGeneralError(result, false);
11278  else {
11279   var resultObj = null;
11280   try {
11281    resultObj = this.EvalCallbackResult(result);
11282   } 
11283   catch(e) {
11284   }
11285   if(resultObj) {
11286    ASPx.CacheHelper.DropCache(this);
11287    if(resultObj.redirect) {
11288     this.ParseJSProperties(resultObj); 
11289     ASPx.Url.Redirect(resultObj.redirect);
11290    }
11291    else if(ASPx.IsExists(resultObj.generalError)) {
11292     this.ProcessCallbackGeneralError(resultObj.generalError, true);
11293    }
11294    else {
11295     var errorObj = resultObj.error;
11296     if(errorObj) { 
11297      if(this.parseJSPropertiesOnCallbackError)
11298       this.ParseJSProperties(resultObj);
11299      this.ProcessCallbackError(errorObj,resultObj.id);
11300     } else {
11301      this.ParseJSProperties(resultObj);
11302      var callbackInfo = this.DequeueCallbackInfo(resultObj.id);
11303      if(callbackInfo && callbackInfo.type == ASPx.CallbackType.Data)
11304       this.ProcessCustomDataCallback(resultObj.result, callbackInfo);
11305      else {
11306       if (this.useCallbackQueue() && this.callbackQueueHelper.getCallbackInfoById(resultObj.id))
11307        this.callbackQueueHelper.processCallback(resultObj.result, resultObj.id);
11308       else {
11309        this.ProcessCallback(resultObj.result, resultObj.id);
11310        if(callbackInfo && callbackInfo.handler) {
11311         var handlerInfo = { handler: callbackInfo.handler, result: resultObj.result.data };
11312         this.callbackHandlersQueue.addCallbackHandler(handlerInfo);
11313        }
11314       }
11315      }
11316     }
11317    }
11318   } 
11319  }
11320  this.DoLoadCallbackScripts();
11321 },
11322 DoCallbackError: function(result) {
11323  this.HideLoadingElements();
11324  this.ProcessCallbackGeneralError(result, false); 
11325 },
11326 DoControlClick: function(evt) {
11327  this.OnControlClick(ASPx.Evt.GetEventSource(evt), evt);
11328 },
11329 ProcessCallback: function (result, callbackId) {
11330  this.OnCallback(result, callbackId);
11331 },
11332 ProcessCustomDataCallback: function(result, callbackInfo) {
11333  if(callbackInfo.handler != null)
11334   callbackInfo.handler(this, result);
11335  this.RaiseCustomDataCallback(result);
11336 },
11337 RaiseCustomDataCallback: function(result) {
11338  if(!this.CustomDataCallback.IsEmpty()) {
11339   var arg = new ASPxClientCustomDataCallbackEventArgs(result);
11340   this.CustomDataCallback.FireEvent(this, arg);
11341  }
11342 },
11343 OnCallback: function(result) {
11344 },
11345 CreateCallbackInfo: function(type, handler) {
11346  return { type: type, handler: handler };
11347 },
11348 GetSerializedCallbackInfoByID: function(callbackID) {
11349  return this.GetCallbackInfoByID(callbackID).type + callbackID + ASPx.CallbackSeparator;
11350 },
11351 SaveCallbackInfo: function(callbackInfo) {
11352  var activeCallbacksInfo = this.GetActiveCallbacksInfo();
11353  for(var i = 0; i < activeCallbacksInfo.length; i++) {
11354   if(activeCallbacksInfo[i] == null) {
11355    activeCallbacksInfo[i] = callbackInfo;
11356    return i;
11357   }
11358  }
11359  activeCallbacksInfo.push(callbackInfo);
11360  return activeCallbacksInfo.length - 1;
11361 },
11362 GetActiveCallbacksInfo: function() {
11363  var persistentProperties = this.GetPersistentProperties();
11364  if(!persistentProperties.activeCallbacks)
11365   persistentProperties.activeCallbacks = [ ];
11366  return persistentProperties.activeCallbacks;
11367 },
11368 GetPersistentProperties: function() {
11369  var storage = _aspxGetPersistentControlPropertiesStorage();
11370  var persistentProperties = storage[this.name];
11371  if(!persistentProperties) {
11372   persistentProperties = { };
11373   storage[this.name] = persistentProperties;
11374  }
11375  return persistentProperties;
11376 },
11377 GetCallbackInfoByID: function(callbackID) {
11378  return this.GetActiveCallbacksInfo()[callbackID];
11379 },
11380 DequeueCallbackInfo: function(index) {
11381  var activeCallbacksInfo = this.GetActiveCallbacksInfo();
11382  if(index < 0 || index >= activeCallbacksInfo.length)
11383   return null;
11384  var result = activeCallbacksInfo[index];
11385  activeCallbacksInfo[index] = null;
11386  return result;
11387 },
11388 ProcessCallbackError: function (errorObj, callbackId) {
11389  var data = ASPx.IsExists(errorObj.data) ? errorObj.data : null;
11390  var result = this.RaiseCallbackError(errorObj.message, callbackId);
11391  if(result.isHandled)
11392   this.OnCallbackErrorAfterUserHandle(result.errorMessage, data); 
11393  else
11394   this.OnCallbackError(result.errorMessage, data); 
11395 },
11396 OnCallbackError: function(errorMessage, data) {
11397  if(errorMessage)
11398   ASPx.ShowErrorAlert(errorMessage);
11399 },
11400 OnCallbackErrorAfterUserHandle: function(errorMessage, data) {
11401 },
11402 ProcessCallbackGeneralError: function(errorMessage, serverExceptionOnLastCallback) {
11403  this.serverExceptionOnLastCallback = serverExceptionOnLastCallback;
11404  var result = this.RaiseCallbackError(errorMessage);
11405  if(result.isHandled)
11406   this.OnCallbackGeneralErrorAfterUserHandle(result.errorMessage);
11407  else
11408   this.OnCallbackGeneralError(result.errorMessage);
11409 },
11410 OnCallbackGeneralError: function(errorMessage) {
11411  this.OnCallbackError(errorMessage, null);
11412 },
11413 OnCallbackGeneralErrorAfterUserHandle: function (errorMessage) {
11414 },
11415 SendPostBack: function(params, preventConvertToUpdatePanelCallback) {
11416  if(preventConvertToUpdatePanelCallback)
11417   this.sendMSAjaxCompatPostBack(params);
11418  else
11419   this.sendPostBackInternal(params);
11420 },
11421 sendPostBackInternal: function(params) {
11422  if(typeof(__doPostBack) != "undefined")
11423   __doPostBack(this.uniqueID, params);
11424  else{
11425   var form = this.GetParentForm();
11426   if(form) form.submit();
11427  }
11428 },
11429 sendMSAjaxCompatPostBack: function(params) {
11430  var rm = ASPx.GetMSAjaxRequestManager();
11431  var triggers = rm ? rm._postBackControlClientIDs : null;
11432  var needRegister = triggers && ASPx.Ident.IsArray(triggers) && ASPx.Data.ArrayIndexOf(triggers, this.name) == -1;
11433  if(needRegister)
11434   triggers.unshift(this.name);
11435  this.sendPostBackInternal(params);
11436  if(needRegister)
11437   triggers.shift();
11438 },
11439 IsValidInstance: function () {
11440  return aspxGetControlCollection().GetByName(this.name) === this;
11441 },
11442 OnDispose: function() { 
11443  var varName = this.globalName;
11444  if(varName && varName !== "" && window && window[varName] && window[varName] == this){
11445   try{
11446    delete window[varName];
11447   }
11448   catch(e){  }
11449  }
11450  if(this.callbackQueueHelper)
11451   this.callbackQueueHelper.detachEvents();
11452 },
11453 OnGlobalControlsInitialized: function(args) { 
11454 },
11455 OnGlobalBrowserWindowResized: function(args) { 
11456 },
11457 OnGlobalBeginCallback: function(args) { 
11458 },
11459 OnGlobalEndCallback: function(args) { 
11460 },
11461 OnGlobalCallbackError: function(args) { 
11462 },
11463 OnGlobalValidationCompleted: function(args) { 
11464 },
11465 DOMContentLoaded: function() { },
11466 IsStateControllerEnabled: function() { return false; },
11467 InitializeDOM: function() {
11468  var mainElement = this.GetMainElement();
11469  if(mainElement)
11470   ASPx.SetElementInitializedFlag(mainElement);
11471 },
11472 IsDOMInitialized: function() {
11473  var mainElement = this.GetMainElement();
11474  return mainElement && ASPx.GetElementInitializedFlag(mainElement);
11475 },
11476 AdjustControl: function(nestedCall) { },
11477 OnBrowserWindowResizeInternal: function(e) { },
11478 RegisterInControlTree: function(tree) { }
11479});
11480ASPxClientControlBase.Cast = function(obj) {
11481 if(typeof obj == "string")
11482  return window[obj];
11483 return obj;
11484};
11485var persistentControlPropertiesStorage = null;
11486function _aspxGetPersistentControlPropertiesStorage() {
11487 if(persistentControlPropertiesStorage == null)
11488  persistentControlPropertiesStorage = { };
11489 return persistentControlPropertiesStorage;
11490}
11491var ELLIPSIS_MARKER_CLASS = "dx-ellipsis";
11492var ELLIPSIS_TOOLTIP_MARKER_ATTR = "dxEllipsisTitle";
11493var ASPxClientControl = ASPx.CreateClass(ASPxClientControlBase, {
11494 constructor: function(name){
11495  this.constructor.prototype.constructor.call(this, name);
11496  this.rtl = false;
11497  this.enableEllipsis = false;
11498  this.isNative = false;
11499  this.isControlCollapsed = false;
11500  this.isInsideHierarchyAdjustment = false;
11501  this.controlOwner = null;
11502  this.adjustedSizes = { };
11503  this.dialogContentHashTable = { };
11504  this.renderIFrameForPopupElements = false;
11505  this.widthValueSetInPercentage = false;
11506  this.heightValueSetInPercentage = false;
11507  this.verticalAlignedElements = { };
11508  this.wrappedTextContainers = { };
11509  this.scrollPositionState = { };
11510  this.sizingConfig = {
11511   allowSetWidth: true,
11512   allowSetHeight: true,
11513   correction : false,
11514   adjustControl : false,
11515   supportPercentHeight: false,
11516   supportAutoHeight: false
11517  };
11518  this.percentSizeConfig = {
11519   width: -1,
11520   height: -1,
11521   markerWidth: -1,
11522   markerHeight: -1
11523  };  
11524 },
11525 InlineInitialize: function() {
11526  this.InitializeDOM();
11527  ASPxClientControlBase.prototype.InlineInitialize.call(this);
11528 },
11529 AfterCreate: function() { 
11530  ASPxClientControlBase.prototype.AfterCreate.call(this);
11531  if(!this.CanInitializeAdjustmentOnDOMContentLoaded() || ASPx.IsStartupScriptsRunning())
11532   this.InitializeAdjustment();
11533 },
11534 DOMContentLoaded: function() {
11535  if(this.CanInitializeAdjustmentOnDOMContentLoaded()) 
11536   this.InitializeAdjustment();
11537 },
11538 CanInitializeAdjustmentOnDOMContentLoaded: function() {
11539  return !ASPx.Browser.IE || ASPx.Browser.Version >= 10; 
11540 },
11541 InitializeAdjustment: function() {
11542  this.UpdateAdjustmentFlags();
11543  this.AdjustControl();
11544 },
11545 AfterInitialize: function() {
11546  this.AdjustControl();
11547  ASPxClientControlBase.prototype.AfterInitialize.call(this);
11548 },
11549 IsStateControllerEnabled: function(){
11550  return typeof(ASPx.GetStateController) != "undefined" && ASPx.GetStateController();
11551 },
11552 GetWidth: function() {
11553  return this.GetMainElement().offsetWidth;
11554 },
11555 GetHeight: function() {
11556  return this.GetMainElement().offsetHeight;
11557 },
11558 SetWidth: function(width) {
11559  if(this.sizingConfig.allowSetWidth)
11560   this.SetSizeCore("width", width, "GetWidth", false);
11561 },
11562 SetHeight: function(height) {
11563  if(this.sizingConfig.allowSetHeight)
11564   this.SetSizeCore("height", height, "GetHeight", false);
11565 },
11566 SetSizeCore: function(sizePropertyName, size, getFunctionName, corrected) {
11567  if(size < 0)
11568   return;
11569  this.GetMainElement().style[sizePropertyName] = size + "px";
11570  this.UpdateAdjustmentFlags(sizePropertyName);
11571  if(this.sizingConfig.adjustControl)
11572   this.AdjustControl(true);
11573  if(this.sizingConfig.correction && !corrected) {
11574   var realSize = this[getFunctionName]();
11575   if(realSize != size) {
11576    var correctedSize = size - (realSize - size);
11577    this.SetSizeCore(sizePropertyName, correctedSize, getFunctionName, true);
11578   }
11579  }
11580 },
11581 AdjustControl: function(nestedCall) {
11582  if(this.IsAdjustmentRequired() && (!ASPxClientControl.adjustControlLocked || nestedCall)) {
11583   ASPxClientControl.adjustControlLocked = true;
11584   try {
11585    if(!this.IsAdjustmentAllowed())
11586     return;
11587    this.AdjustControlCore();
11588    this.UpdateAdjustedSizes();
11589   } 
11590   finally {
11591    delete ASPxClientControl.adjustControlLocked;
11592   }
11593  }
11594  this.AssignEllipsisTooltips();
11595  this.TryShowPhantomLoadingElements();
11596 },
11597 ResetControlAdjustment: function () {
11598  this.adjustedSizes = { };
11599 },
11600 UpdateAdjustmentFlags: function(sizeProperty) {
11601  var mainElement = this.GetMainElement();
11602  if(mainElement) {
11603   var mainElementStyle = ASPx.GetCurrentStyle(mainElement);
11604   this.UpdatePercentSizeConfig([mainElementStyle.width, mainElement.style.width], [mainElementStyle.height, mainElement.style.height], sizeProperty);
11605  }
11606 },
11607 UpdatePercentSizeConfig: function(widths, heights, modifyStyleProperty) {
11608  switch(modifyStyleProperty) {
11609   case "width":
11610    this.UpdatePercentWidthConfig(widths);
11611    break;
11612   case "height":
11613    this.UpdatePercentHeightConfig(heights);
11614    break;
11615   default:
11616    this.UpdatePercentWidthConfig(widths);
11617    this.UpdatePercentHeightConfig(heights);
11618    break;
11619  }
11620  this.ResetControlPercentMarkerSize();
11621 },
11622 UpdatePercentWidthConfig: function(widths) {
11623  this.widthValueSetInPercentage = false;
11624  for(var i = 0; i < widths.length; i++) {
11625   if(this.IsPercentageWidth(widths[i])) {
11626    this.percentSizeConfig.width = widths[i];
11627    this.widthValueSetInPercentage = true;
11628    break;
11629   }
11630  }
11631 },
11632 IsPercentageWidth: function(width) { return ASPx.IsPercentageSize(width); },
11633 UpdatePercentHeightConfig: function(heights) {
11634  this.heightValueSetInPercentage = false;
11635    for(var i = 0; i < heights.length; i++) {
11636   if(ASPx.IsPercentageSize(heights[i])) {
11637    this.percentSizeConfig.height = heights[i];
11638    this.heightValueSetInPercentage = true;
11639    break;
11640   }
11641  }
11642 },
11643 GetAdjustedSizes: function() {
11644  var mainElement = this.GetMainElement();
11645  if(mainElement) 
11646   return { width: mainElement.offsetWidth, height: mainElement.offsetHeight };
11647  return { width: 0, height: 0 };
11648 },
11649 IsAdjusted: function() {
11650  return (this.adjustedSizes.width && this.adjustedSizes.width > 0) && (this.adjustedSizes.height && this.adjustedSizes.height > 0);
11651 },
11652 IsAdjustmentRequired: function() {
11653  if(!this.IsAdjusted())
11654   return true;
11655  if(this.widthValueSetInPercentage)
11656   return true;
11657  if(this.heightValueSetInPercentage)
11658   return true;
11659  var sizes = this.GetAdjustedSizes();
11660  for(var name in sizes){
11661   if(this.adjustedSizes[name] !== sizes[name])
11662    return true;
11663  }
11664  return false;
11665 },
11666 IsAdjustmentAllowed: function() {
11667  var mainElement = this.GetMainElement();
11668  return mainElement && this.IsDisplayed() && !this.IsHidden() && this.IsDOMInitialized();
11669 },
11670 UpdateAdjustedSizes: function() {
11671  var sizes = this.GetAdjustedSizes();
11672  for(var name in sizes)
11673   if(sizes.hasOwnProperty(name))
11674    this.adjustedSizes[name] = sizes[name];
11675 },
11676 AdjustControlCore: function() {
11677 },
11678 AdjustAutoHeight: function() {
11679 },
11680 IsControlCollapsed: function() {
11681  return this.isControlCollapsed;
11682 },
11683 NeedCollapseControl: function() {
11684  return this.NeedCollapseControlCore() && this.IsAdjustmentRequired() && this.IsAdjustmentAllowed();
11685 },
11686 NeedCollapseControlCore: function() {
11687  return false;
11688 },
11689 CollapseEditor: function() {
11690 },
11691 CollapseControl: function() {
11692  this.SaveScrollPositions();
11693  var mainElement = this.GetMainElement(),
11694   marker = this.GetControlPercentSizeMarker();
11695  marker.style.height = this.heightValueSetInPercentage && this.sizingConfig.supp
11695ortPercentHeight
11696   ? this.percentSizeConfig.height 
11697   : (mainElement.offsetHeight + "px");
11698  mainElement.style.display = "none";
11699  this.isControlCollapsed = true;
11700 },
11701 ExpandControl: function() {
11702  var mainElement = this.GetMainElement();
11703  mainElement.style.display = "";
11704  this.GetControlPercentSizeMarker().style.height = "0px";
11705  this.isControlCollapsed = false;
11706  this.RestoreScrollPositions();
11707 },
11708 CanCauseReadjustment: function() {
11709  return this.NeedCollapseControlCore();
11710 },
11711 IsExpandableByAdjustment: function() {
11712  return false;
11713 },
11714 HasFixedPosition: function() {
11715  return false;
11716 },
11717 SaveScrollPositions: function() {
11718  var mainElement = this.GetMainElement();
11719  this.scrollPositionState.outer = ASPx.GetOuterScrollPosition(mainElement.parentNode);
11720  this.scrollPositionState.inner = ASPx.GetInnerScrollPositions(mainElement);
11721 },
11722 RestoreScrollPositions: function() {
11723  ASPx.RestoreOuterScrollPosition(this.scrollPositionState.outer);
11724  ASPx.RestoreInnerScrollPositions(this.scrollPositionState.inner);
11725 },
11726 GetControlPercentSizeMarker: function() {
11727  if(this.percentSizeMarker === undefined) {
11728   this.percentSizeMarker = ASPx.CreateHtmlElementFromString("<div style='height:0px;font-size:0px;line-height:0;width:100%;'></div>");
11729   ASPx.InsertElementAfter(this.percentSizeMarker, this.GetMainElement());
11730  }
11731  return this.percentSizeMarker;
11732 },
11733 KeepControlPercentSizeMarker: function(needCollapse, needCalculateHeight) {
11734  var marker = this.GetControlPercentSizeMarker(),
11735   markerHeight;
11736  if(needCollapse)
11737   this.CollapseControl();
11738  if(this.widthValueSetInPercentage && marker.style.width !== this.percentSizeConfig.width)
11739   marker.style.width = this.percentSizeConfig.width;
11740  if(needCalculateHeight) {
11741   if(this.IsControlCollapsed())
11742    markerHeight = marker.style.height;
11743   marker.style.height = this.percentSizeConfig.height;
11744  }
11745  this.percentSizeConfig.markerWidth = marker.offsetWidth;
11746  if(needCalculateHeight) {
11747   this.percentSizeConfig.markerHeight = marker.offsetHeight;
11748   if(this.IsControlCollapsed())
11749    marker.style.height = markerHeight;
11750   else
11751    marker.style.height = "0px";
11752  }
11753  if(needCollapse)
11754   this.ExpandControl();
11755 },
11756 ResetControlPercentMarkerSize: function() {
11757  this.percentSizeConfig.markerWidth = -1;
11758  this.percentSizeConfig.markerHeight = -1;
11759 },
11760 GetControlPercentMarkerSize: function(hideControl, force) {
11761  var needCalculateHeight = this.heightValueSetInPercentage && this.sizingConfig.supportPercentHeight;
11762  if(force || this.percentSizeConfig.markerWidth < 1 || (needCalculateHeight && this.percentSizeConfig.markerHeight < 1))
11763   this.KeepControlPercentSizeMarker(hideControl && !this.IsControlCollapsed(), needCalculateHeight);
11764  return {
11765   width: this.percentSizeConfig.markerWidth,
11766   height: this.percentSizeConfig.markerHeight
11767  };
11768 },
11769 AssignEllipsisTooltips: function() {
11770  if(this.RequireAssignTooltips())
11771   this.AssignEllipsisTooltipsCore();
11772 },
11773 AssignEllipsisTooltipsCore: function(rootElement, reassingExistingTooltips) {
11774  var requirePaddingManipulation = ASPx.Browser.IE || ASPx.Browser.Edge || ASPx.Browser.Firefox;
11775  rootElement = rootElement || this.GetMainElement();
11776  var nodes = this.GetEllipsisNodes(rootElement);
11777  var nodeInfos = [];
11778  var nodesCount = nodes.length;
11779  for(var i = 0; i < nodesCount; i++) {
11780   var node = nodes[i];
11781   var info = { node: node };
11782   if(requirePaddingManipulation) {
11783    var style = ASPx.GetCurrentStyle(node);
11784    info.paddingLeft = node.style.paddingLeft;
11785    info.totalPadding = ASPx.GetLeftRightPaddings(node, style);
11786   }
11787   nodeInfos.push(info);
11788  }
11789  if(requirePaddingManipulation) {
11790   for(var i = 0; i < nodesCount; i++) {
11791    var info = nodeInfos[i];
11792    ASPx.SetStyles(info.node, { paddingLeft: info.totalPadding }, true);
11793   }
11794  }
11795  for(var i = 0; i < nodesCount; i++) {
11796   var info = nodeInfos[i];
11797   var node = info.node;
11798   info.isTextShortened = node.scrollWidth > node.clientWidth;
11799   info.hasTitle = ASPx.Attr.GetAttribute(node, "title") !== null;
11800   if(!info.hasTitle || reassingExistingTooltips)
11801    info.title = this.GetEllipsisTooltipText(node);
11802  }
11803  for(var i = 0; i < nodesCount; i++) {
11804   var info = nodeInfos[i];
11805   var node = info.node;
11806   if(info.isTextShortened && info.title) {
11807    ASPx.Attr.SetAttribute(node, "title", info.title);
11808    ASPx.Attr.SetAttribute(node, ELLIPSIS_TOOLTIP_MARKER_ATTR, true);
11809   }
11810   if(!info.isTextShortened && info.hasTitle)
11811    ASPx.Attr.RemoveAttribute(node, "title");
11812  }
11813  if(requirePaddingManipulation) {
11814   for(var i = 0; i < nodesCount; i++) {
11815    var info = nodeInfos[i];
11816    var node = info.node;
11817    node.style.paddingLeft = info.paddingLeft;
11818   }
11819  }
11820 },
11821 GetEllipsisNodes: function(element) {
11822  var ellipsibleNodes = ASPx.Data.CollectionToArray(ASPx.GetNodesByClassName(element, ELLIPSIS_MARKER_CLASS));
11823  if(ASPx.ElementHasCssClass(element, ELLIPSIS_MARKER_CLASS))
11824   ellipsibleNodes.push(element);
11825  return ellipsibleNodes.filter(function(node) {
11826   return !ASPx.Attr.IsExistsAttribute(node, "title") || ASPx.Attr.IsExistsAttribute(node, ELLIPSIS_TOOLTIP_MARKER_ATTR);
11827  });
11828 },
11829 GetEllipsisTooltipText: function(element) {
11830  if(element && ASPx.IsExists(element.innerText))
11831   return element.innerText;
11832  return ASPx.GetInnerText(element);
11833 },
11834 RequireAssignTooltips: function() {
11835  return this.enableEllipsis && !ASPx.Browser.MobileUI;
11836 },
11837 OnBrowserWindowResize: function(e) {
11838 },
11839 OnBrowserWindowResizeInternal: function(e){
11840  if(this.BrowserWindowResizeSubscriber()) 
11841   this.OnBrowserWindowResize(e);
11842 },
11843 BrowserWindowResizeSubscriber: function() {
11844  return this.widthValueSetInPercentage || !this.IsAdjusted();
11845 },
11846 ShrinkWrappedText: function(getElements, key, reCorrect) {
11847  if(!ASPx.Browser.Safari) return;
11848  var elements = ASPx.CacheHelper.GetCachedElements(this, key, getElements, this.wrappedTextContainers);
11849  for(var i = 0; i < elements.length; i++)
11850   this.ShrinkWrappedTextInContainer(elements[i], reCorrect);
11851 },
11852 ShrinkWrappedTextInContainer: function(container, reCorrect) {
11853  if(!ASPx.Browser.Safari || !container || (container.dxWrappedTextShrinked && !reCorrect) || container.offsetWidth === 0) return;
11854  ASPx.ShrinkWrappedTextInContainer(container);
11855  container.dxWrappedTextShrinked = true;
11856 },
11857 CorrectWrappedText: function(getElements, key, reCorrect) {
11858  var elements = ASPx.CacheHelper.GetCachedElements(this, key, getElements, this.wrappedTextContainers);
11859  for(var i = 0; i < elements.length; i++)
11860   this.CorrectWrappedTextInContainer(elements[i], reCorrect);
11861 },
11862 CorrectWrappedTextInContainer: function(container, reCorrect) {
11863  if(!container || (container.dxWrappedTextCorrected && !reCorrect) || container.offsetWidth === 0) return;
11864  ASPx.AdjustWrappedTextInContainer(container);
11865  container.dxWrappedTextCorrected = true;
11866 },
11867 CorrectVerticalAlignment: function(alignMethod, getElements, key, reAlign) {
11868  var elements = ASPx.CacheHelper.GetCachedElements(this, key, getElements, this.verticalAlignedElements);
11869  for(var i = 0; i < elements.length; i++)
11870   this.CorrectElementVerticalAlignment(alignMethod, elements[i], reAlign);
11871 },
11872 CorrectElementVerticalAlignment: function(alignMethod, element, reAlign) {
11873  if(!element || (element.dxVerticalAligned && !reAlign) || element.offsetHeight === 0) return;
11874  alignMethod(element);
11875  element.dxVerticalAligned = true;
11876 },
11877 ClearVerticalAlignedElementsCache: function() {
11878  ASPx.CacheHelper.DropCache(this.verticalAlignedElements);
11879 },
11880 ClearWrappedTextContainersCache: function() {
11881  ASPx.CacheHelper.DropCache(this.wrappedTextContainers);
11882 },
11883 AdjustPagerControls: function() {
11884  if(typeof(ASPx.GetPagersCollection) != "undefined")
11885   ASPx.GetPagersCollection().AdjustControls(this.GetMainElement());
11886 },
11887 RegisterInControlTree: function(tree) {
11888  var mainElement = this.GetMainElement();
11889  if(mainElement && mainElement.id)
11890   tree.createNode(mainElement.id, this);
11891 },
11892 GetItemElementName: function(element) {
11893  var name = "";
11894  if(element.id)
11895   name = element.id.substring(this.name.length + 1);
11896  return name;
11897 },
11898 GetLinkElement: function(element) {
11899  if(element == null) return null;
11900  return (element.tagName == "A") ? element : ASPx.GetNodeByTagName(element, "A", 0);
11901 },
11902 GetInternalHyperlinkElement: function(parentElement, index) {
11903  var element = ASPx.GetNodeByTagName(parentElement, "A", index);
11904  if(element == null) 
11905   element = ASPx.GetNodeByTagName(parentElement, "SPAN", index);
11906  return element;
11907 },
11908 OnControlClick: function(clickedElement, htmlEvent) {
11909 }
11910});
11911ASPxClientControl.Cast = function(obj) {
11912 if(typeof obj == "string")
11913  return window[obj];
11914 return obj;
11915};
11916ASPxClientControl.AdjustControls = function(container, collapseControls){
11917 aspxGetControlCollection().AdjustControls(container, collapseControls);
11918};
11919ASPxClientControl.GetControlCollection = function(){
11920 return aspxGetControlCollection();
11921};
11922ASPxClientControl.LeadingAfterInitCallConsts = {
11923 None: 0,
11924 Direct: 1,
11925 Reverse: 2
11926};
11927var ASPxClientComponent = ASPx.CreateClass(ASPxClientControl, {
11928 constructor: function (name) {
11929  this.constructor.prototype.constructor.call(this, name);
11930 },
11931 IsDOMDisposed: function() { 
11932  return false;
11933 }
11934});
11935var ASPxClientControlCollection = ASPx.CreateClass(ASPx.CollectionBase, {
11936 constructor: function(){
11937  this.constructor.prototype.constructor.call(this);
11938  this.prevWndWidth = "";
11939  this.prevWndHeight = "";
11940  this.requestCountInternal = 0; 
11941  this.BeforeInitCallback = new ASPxClientEvent();
11942  this.ControlsInitialized = new ASPxClientEvent();
11943  this.BrowserWindowResized = new ASPxClientEvent();
11944  this.BeginCallback = new ASPxClientEvent();
11945  this.EndCallback = new ASPxClientEvent();
11946  this.CallbackError = new ASPxClientEvent();
11947  this.ValidationCompleted = new ASPxClientEvent();
11948  aspxGetControlCollectionCollection().Add(this);
11949 },
11950 Add: function(element) {
11951  var existsElement = this.Get(element.name);
11952  if(existsElement && existsElement !== element) 
11953   this.Remove(existsElement);
11954  ASPx.CollectionBase.prototype.Add.call(this, element.name, element);
11955 },
11956 Remove: function(element) {
11957  if(element && element instanceof ASPxClientControl)
11958   element.OnDispose();
11959  ASPx.CollectionBase.prototype.Remove.call(this, element.name);
11960 },
11961 GetGlobal: function(name) {
11962  var result = window[name];
11963  return result && Ident.IsASPxClientControl(result)
11964   ? result
11965   : null;
11966 },
11967 GetByName: function(name){
11968  return this.Get(name) || this.GetGlobal(name);
11969 },
11970 GetCollectionType: function(){
11971  return ASPxClientControlCollection.BaseCollectionType;
11972 },
11973 GetControlsByPredicate: function(predicate) {
11974  var result = [];
11975  this.ForEachControl(function(control) {
11976   if(!predicate || predicate(control))
11977    result.push(control);
11978  });
11979  return result;
11980 },
11981 GetControlsByType: function(type) {
11982  return this.GetControlsByPredicate(function(control) { 
11983   return type && (control instanceof type);
11984  });
11985 },
11986 ForEachControl: function(action, context) {
11987  context = context || this;
11988  this.elementsMap.forEachEntry(function(name, control) {
11989   if(Ident.IsASPxClientControl(control))
11990    return action.call(context, control);
11991  }, context);
11992 },
11993 forEachControlHierarchy: function(container, context, collapseControls, processFunc) {
11994  context = context || this;
11995  var controlTree = new ASPx.ControlTree(this, container);
11996  controlTree.forEachControl(collapseControls, function(control) {
11997   processFunc.call(context, control);
11998  });
11999 },
12000 AdjustControls: function(container, collapseControls) {
12001  container = container || null;
12002  window.setTimeout(function() {
12003   this.AdjustControlsCore(container, collapseControls);
12004  }.aspxBind(this), 0);
12005 },
12006 AdjustControlsCore: function(container, collapseControls) {
12007  this.forEachControlHierarchy(container, this, collapseControls, function(control) {
12008   control.AdjustControl();
12009  });
12010 },
12011 CollapseControls: function(container) {
12012  this.ProcessControlsInContainer(container, function(control) {
12013   if(control.isASPxClientEdit)
12014    control.CollapseEditor();
12015   else if(!!window.ASPxClientRibbon && control instanceof ASPxClientRibbon)
12016    control.CollapseControl();
12017  });
12018 },
12019 AtlasInitialize: function(isCallback) {
12020  this.ForEachControl(function(control) {
12021   control.AtlasPreInitialize();
12022  });
12023  ASPx.ProcessScriptsAndLinks("", isCallback);
12024  this.ForEachControl(function(control) {
12025   control.AtlasInitialize();
12026  });
12027 },
12028 DOMContentLoaded: function() {
12029  this.ForEachControl(function(control){
12030    control.DOMContentLoaded();
12031  });
12032 },
12033 OnDocumentUnload: function() {
12034  this.ForEachControl(function(control) {
12035   control.RaiseUnload();
12036  });
12037 },
12038 Initialize: function() {
12039  ASPx.GetPostHandler().Post.AddHandler(
12040   function(s, e) { this.OnPost(e); }.aspxBind(this)
12041  );
12042  ASPx.GetPostHandler().PostFinalization.AddHandler(
12043   function(s, e) { this.OnPostFinalization(e); }.aspxBind(this)
12044  );
12045  this.InitializeElements(false );
12046  if(typeof(Sys) != "undefined" && typeof(Sys.Application) != "undefined") {
12047   var checkIsInitialized = function() {
12048    if(Sys.Application.get_isInitialized())
12049     Sys.Application.add_load(aspxCAInit);
12050    else
12051     setTimeout(checkIsInitialized, 0);
12052   };
12053   checkIsInitialized();
12054  }
12055  this.InitWindowSizeCache();
12056 },
12057 InitializeElements: function(isCallback) {
12058  this.ForEachControl(function(control){
12059   if(!control.isInitialized)
12060    control.Initialize();
12061  });
12062  this.AfterInitializeElementsLeadingCall();
12063  this.AfterInitializeElements();
12064  this.RaiseControlsInitialized(isCallback);
12065 },
12066 AfterInitializeElementsLeadingCall: function() {
12067  var controls = {};
12068  controls[ASPxClientControl.LeadingAfterInitCallConsts.Direct] = [];
12069  controls[ASPxClientControl.LeadingAfterInitCallConsts.Reverse] = [];
12070  this.ForEachControl(function(control) {
12071   if(control.leadingAfterInitCall != ASPxClientControl.LeadingAfterInitCallConsts.None && !control.isInitialized)
12072    controls[control.leadingAfterInitCall].push(control);
12073  });
12074  var directInitControls = controls[ASPxClientControl.LeadingAfterInitCallConsts.Direct],
12075   reverseInitControls = controls[ASPxClientControl.LeadingAfterInitCallConsts.Reverse];
12076  for(var i = 0, control; control = directInitControls[i]; i++)
12077   control.AfterInitialize();
12078  for(var i = reverseInitControls.length - 1, control; control = reverseInitControls[i]; i--)
12079   control.AfterInitialize();
12080 },
12081 AfterInitializeElements: function() {
12082  this.ForEachControl(function(control) {
12083   if(control.leadingAfterInitCall == ASPxClientControl.LeadingAfterInitCallConsts.None && !control.isInitialized)
12084    control.AfterInitialize();
12085  });
12086  ASPx.RippleHelper.Init();
12087 },
12088 DoFinalizeCallback: function() {
12089  this.ForEachControl(function(control){
12090   control.DoFinalizeCallback();
12091  });
12092 },
12093 ProcessControlsInContainer: function(container, processFunc) {
12094  this.ForEachControl(function(control){
12095   if(!container || this.IsControlInContainer(container, control))
12096    processFunc(control);
12097  });
12098 },
12099 IsControlInContainer: function(container, control) {
12100  if(control.GetMainElement) {
12101   var mainElement = control.GetMainElement();
12102   if(mainElement && (mainElement != container)) {
12103    if(ASPx.GetIsParent(container, mainElement))
12104     return true;
12105   }
12106  }
12107  return false;
12108 },
12109 RaiseControlsInitialized: function(isCallback) {
12110  if(typeof(isCallback) == "undefined")
12111   isCallback = true;
12112  var args = new ASPxClientControlsInitializedEventArgs(isCallback);
12113  if(!this.ControlsInitialized.IsEmpty())  
12114   this.ControlsInitialized.FireEvent(this, args);
12115  this.ForEachControl(function(control){
12116   control.OnGlobalControlsInitialized(args);
12117  });
12118 },
12119 RaiseBrowserWindowResized: function() {
12120  var args = new ASPxClientEventArgs();
12121  if(!this.BrowserWindowResized.IsEmpty())
12122   this.BrowserWindowResized.FireEvent(this, args);
12123  this.ForEachControl(function(control){
12124   control.OnGlobalBrowserWindowResized(args);
12125  });
12126 },
12127 RaiseBeginCallback: function (control, command) {
12128  var args = new ASPxClientGlobalBeginCallbackEventArgs(control, command);
12129  if(!this.BeginCallback.IsEmpty())
12130   this.BeginCallback.FireEvent(this, args);
12131  this.ForEachControl(function(control){
12132   control.OnGlobalBeginCallback(args);
12133  });
12134  this.IncrementRequestCount();
12135 },
12136 RaiseEndCallback: function (control) {
12137  var args = new ASPxClientGlobalEndCallbackEventArgs(control);
12138  if (!this.EndCallback.IsEmpty()) 
12139   this.EndCallback.FireEvent(this, args);
12140  this.ForEachControl(function(control){
12141   control.OnGlobalEndCallback(args);
12142  });
12143  this.DecrementRequestCount();
12144 },
12145 InCallback: function() {
12146  return this.requestCountInternal > 0;
12147 },
12148 RaiseCallbackError: function (control, message, callbackId) {
12149  var args = new ASPxClientGlobalCallbackErrorEventArgs(control, message, callbackId);
12150  if (!this.CallbackError.IsEmpty()) 
12151   this.CallbackError.FireEvent(this, args);
12152  this.ForEachControl(function(control){
12153   control.OnGlobalCallbackError(args);
12154  });
12155  if(args.handled)
12156   return { isHandled: true, errorMessage: args.message };  
12157  return { isHandled: false, errorMessage: message };
12158 },
12159 RaiseValidationCompleted: function (container, validationGroup, invisibleControlsValidated, isValid, firstInvalidControl, firstVisibleInvalidControl) {
12160  var args = new ASPxClientValidationCompletedEventArgs(container, validationGroup, invisibleControlsValidated, isValid, firstInvalidControl, firstVisibleInvalidControl);
12161  if (!this.ValidationCompleted.IsEmpty()) 
12162   this.ValidationCompleted.FireEvent(this, args);
12163  this.ForEachControl(function(control){
12164   control.OnGlobalValidationCompleted(args);
12165  });
12166 },
12167 Before_WebForm_InitCallback: function(callbackOwnerID){
12168  var args = new BeforeInitCallbackEventArgs(callbackOwnerID);
12169  this.BeforeInitCallback.FireEvent(this, args);
12170 },
12171 InitWindowSizeCache: function(){
12172  this.prevWndWidth = ASPx.GetDocumentClientWidth();
12173  this.prevWndHeight = ASPx.GetDocumentClientHeight();
12174 },
12175 OnBrowserWindowResize: function(evt){
12176  var shouldIgnoreNestedEvents = ASPx.Browser.IE && ASPx.Browser.MajorVersion == 8;
12177  if(shouldIgnoreNestedEvents) {
12178   if(this.prevWndWidth === "" || this.prevWndHeight === "" || this.browserWindowResizeLocked)
12179    return;
12180   this.browserWindowResizeLocked = true;
12181  }
12182  this.OnBrowserWindowResizeCore(evt);
12183  if(shouldIgnoreNestedEvents)
12184   this.browserWindowResizeLocked = false;
12185 },
12186 OnBrowserWindowResizeCore: function(htmlEvent){
12187  var args = this.CreateOnBrowserWindowResizeEventArgs(htmlEvent);
12188  if(this.CalculateIsBrowserWindowSizeChanged()) {
12189   this.forEachControlHierarchy(null, this, true, function(control) {
12190    if(control.IsDOMInitialized())
12191     control.OnBrowserWindowResizeInternal(args);
12192   });
12193   this.RaiseBrowserWindowResized();
12194  }
12195 },
12196 CreateOnBrowserWindowResizeEventArgs: function(htmlEvent){
12197  return {
12198   htmlEvent: htmlEvent,
12199   wndWidth: ASPx.GetDocumentClientWidth(),
12200   wndHeight: ASPx.GetDocumentClientHeight(),
12201   prevWndWidth: this.prevWndWidth,
12202   prevWndHeight: this.prevWndHeight
12203  };
12204 },
12205 CalculateIsBrowserWindowSizeChanged: function(){
12206  var wndWidth = ASPx.GetDocumentClientWidth();
12207  var wndHeight = ASPx.GetDocumentClientHeight();
12208  var isBrowserWindowSizeChanged = (this.prevWndWidth != wndWidth) || (this.prevWndHeight != wndHeight);
12209  if(isBrowserWindowSizeChanged){
12210   this.prevWndWidth = wndWidth;
12211   this.prevWndHeight = wndHeight;
12212   return true;
12213  }
12214  return false;
12215 },
12216 OnPost: function(args){
12217  this.ForEachControl(function(control) {
12218   control.OnPost(args);
12219  }, null);
12220 },
12221 OnPostFinalization: function(args){
12222  this.ForEachControl(function(control) {
12223   control.OnPostFinalization(args);
12224  }, null);
12225 },
12226 IncrementRequestCount: function() {
12227  this.requestCountInternal++;
12228 },
12229 DecrementRequestCount: function() {
12230  this.requestCountInternal--;
12231 },
12232 ResetRequestCount: function() {
12233  this.requestCountInternal = 0;
12234 }
12235});
12236ASPxClientControlCollection.BaseCollectionType = "Control";
12237var controlCollection = null;
12238function aspxGetControlCollection(){
12239 if(controlCollection == null) 
12240  controlCollection = new ASPxClientControlCollection();
12241 return controlCollection;
12242}
12243var ControlCollectionCollection = ASPx.CreateClass(ASPx.CollectionBase, {
12244 constructor: function(){
12245  this.constructor.prototype.constructor.call(this);
12246 },
12247 Add: function(element) {
12248  var key = element.GetCollectionType();
12249  if(!key) throw "The collection type isn't specified.";
12250  if(this.Get(key)) throw "The collection with type='" + key + "' already exists.";
12251  ASPx.CollectionBase.prototype.Add.call(this, key, element);
12252 },
12253 RemoveDisposedControls: function(){
12254  var baseCollection = this.Get(ASPxClientControlCollection.BaseCollectionType);
12255  var disposedControls = [];
12256  baseCollection.elementsMap.forEachEntry(function(name, control) {
12257   if(!ASPx.Ident.IsASPxClientControl(control)) return;
12258   if(control.IsDOMDisposed())
12259    disposedControls.push(control);
12260  });
12261  this.RemoveControls(disposedControls);
12262 },
12263 RemoveControls: function(controls){
12264  for(var i = 0; i < controls.length; i++) {
12265   this.elementsMap.forEachEntry(function(key, collection) {
12266    if(ASPx.Ident.IsASPxClientCollection(collection))
12267     collection.Remove(controls[i]);
12268   });
12269  }
12270 }
12271});
12272var controlCollectionCollection = null;
12273function aspxGetControlCollectionCollection(){
12274 if(controlCollectionCollection == null)
12275  controlCollectionCollection = new ControlCollectionCollection();
12276 return controlCollectionCollection;
12277}
12278var AriaDescriptionAttributes = {
12279 Role: "0",
12280 AriaLabel: "1",
12281 TabIndex: "2",
12282 AriaOwns: "3",
12283 AriaDescribedBy: "4",
12284 AriaDisabled: "5",
12285 AriaHasPopup: "6",
12286 AriaLevel: "7"
12287};
12288var AriaDescriptor = ASPx.CreateClass(null, {
12289 constructor: function(ownerControl, description) {
12290  this.ownerControl = ownerControl;
12291  this.rootElement = ownerControl.GetMainElement();
12292  this.description = description;
12293 },
12294 setDescription: function(name, argList) {
12295  var description = this.findChildDescription(name);
12296  if(description) {
12297   var elements = name ? this.rootElement.querySelectorAll(this.getDescriptionSelector(description)) : [this.rootElement];
12298   for(var i = 0; i < elements.length; i++)
12299    this.applyDescriptionToElement(elements[i], description, argList[i] || argList[0]);
12300  }
12301 },
12302 getDescriptionName: function(description) {
12303  return description.n;
12304 },
12305 getDescriptionSelector: function(description) {
12306  return description.s;
12307 },
12308 findChildDescription: function(name) {
12309  if(name === this.getDescriptionName(this.description))
12310   return this.description;
12311  var childCollection = this.description.c || [];
12312  for(var i = 0; i < childCollection.length; i++) {
12313   var childDescription = childCollection[i];
12314   if(this.getDescriptionName(childDescription) === name)
12315    return childDescription;
12316  }
12317  return null;
12318 },
12319 applyDescriptionToElement: function(element, description, args) {
12320  if(!description || !element)
12321   return;
12322  this.trySetAriaOwnsAttribute(element, description);
12323  this.trySetAriaDescribedByAttribute(element, description);
12324  this.trySetAttribute(element, description, AriaDescriptionAttributes.Role, "role");
12325  this.trySetAttribute(element, description, AriaDescriptionAttributes.TabIndex, "tabindex");
12326  this.trySetAttribute(element, description, AriaDescriptionAttributes.AriaLevel, "aria-level");
12327  this.executeOnDescription(description, AriaDescriptionAttributes.AriaLabel, function(value) {
12328   ASPx.Attr.SetAttribute(element, "aria-label", ASPx.Str.ApplyReplacement(value, args));
12329  });
12330  this.executeOnDescription(description, AriaDescriptionAttributes.AriaDisabled, function(value) {
12331   ASPx.Attr.SetAttribute(element, "aria-disabled", !!value); 
12332  });
12333  this.executeOnDescription(description, AriaDescriptionAttributes.AriaHasPopup, function(value) {
12334   ASPx.Attr.SetAttribute(element, "aria-haspopup", !!value);
12335  });
12336 },
12337 trySetAriaDescribedByAttribute: function(element, description) {
12338  this.executeOnDescription(description, AriaDescriptionAttributes.AriaDescribedBy, function(selectorInfo) {
12339   var descriptor = this.getNodesBySelector(element, selectorInfo.descriptorSelector)[0];
12340   var target = this.getNodesBySelector(element, selectorInfo.targetSelector)[0];
12341   if(!target || !descriptor)
12342    return;
12343   ASPx.Attr.SetAttribute(target, "aria-describedby", this.getNodeId(descriptor));
12344  });
12345 },
12346 trySetAriaOwnsAttribute: function(element, description) {
12347  this.executeOnDescription(description, AriaDescriptionAttributes.AriaOwns, function(selector) {
12348   var ownedNodes = this.getNodesBySelector(element, selector);
12349   var ariaOwnsAttributeValue = "";
12350   for(var i = 0; i < ownedNodes.length; i++)
12351    ariaOwnsAttributeValue += (this.getNodeId(ownedNodes[i]) + (i != ownedNodes.length - 1 ? " " : ""));
12352   ASPx.Attr.SetAttribute(element, "aria-owns", ariaOwnsAttributeValue);
12353  });
12354 },
12355 trySetAttribute: function(element, description, ariaAttribute, attributeName) {
12356  this.executeOnDescription(description, ariaAttribute, function(value) { 
12357   ASPx.Attr.SetAttribute(element, attributeName, description[ariaAttribute]); 
12358  });
12359 },
12360 executeOnDescription: function(description, ariaDescAttr, callback) {
12361  var descInfo = description[ariaDescAttr];
12362  if(ASPx.IsExists(descInfo))
12363   callback.aspxBind(this)(descInfo);
12364 },
12365 getNodesBySelector: function(element, selector) {
12366  var id = element.id || "";
12367  var childNodes = element.querySelectorAll("#" + this.getNodeId(element) + " > " + selector);
12368  ASPx.Attr.SetOrRemoveAttribute(element, "id", id);
12369  return childNodes;
12370 },
12371 getNodeId: function(node) {
12372  if(!node.id)
12373   node.id = this.createRandomId();
12374  return node.id; 
12375 },
12376 createRandomId: function() {
12377  return "r" + ASPx.CreateGuid();
12378 }
12379});
12380PagerCommands = {
12381 Next : "PBN",
12382 Prev : "PBP",
12383 Last : "PBL",
12384 First : "PBF",
12385 PageNumber : "PN",
12386 PageSize : "PSP"
12387};
12388ASPx.Callback = function(result, context){
12389 var collection = aspxGetControlCollection();
12390 collection.DoFinalizeCallback();
12391 var control = collection.Get(context);
12392 if(control != null)
12393  control.DoCallback(result);
12394 ASPx.RippleHelper.ReInit();
12395};
12396ASPx.CallbackError = function(result, context){
12397 var control = aspxGetControlCollection().Get(context);
12398 if(control != null)
12399  control.DoCallbackError(result, false);
12400};
12401ASPx.CClick = function(name, evt) {
12402 var control = aspxGetControlCollection().Get(name);
12403 if(control != null) control.DoControlClick(evt);
12404};
12405function aspxCAInit() {
12406 var isAppInit = typeof(Sys$_Application$initialize) != "undefined" &&
12407  ASPx.FunctionIsInCallstack(arguments.callee, Sys$_Application$initialize, 10 );
12408 aspxGetControlCollection().AtlasInitialize(!isAppInit);
12409}
12410ASPx.Evt.AttachEventToElement(window, "resize", aspxGlobalWindowResize);
12411function aspxGlobalWindowResize(evt){
12412 aspxGetControlCollection().OnBrowserWindowResize(evt); 
12413}
12414ASPx.Evt.AttachEventToElement(window, "unload", aspxClassesUnload);
12415function aspxClassesUnload(evt) {
12416 aspxGetControlCollection().OnDocumentUnload();
12417}
12418ASPx.Evt.AttachEventToElement(window.document, "DOMContentLoaded", aspxClassesDOMContentLoaded);
12419function aspxClassesDOMContentLoaded(evt){
12420 aspxGetControlCollection().DOMContentLoaded();
12421}
12422ASPx.GetControlCollection = aspxGetControlCollection;
12423ASPx.GetControlCollectionCollection = aspxGetControlCollectionCollection;
12424ASPx.GetPersistentControlPropertiesStorage = _aspxGetPersistentControlPropertiesStorage;
12425ASPx.PagerCommands = PagerCommands;
12426window.ASPxClientBeginCallbackEventArgs = ASPxClientBeginCallbackEventArgs;
12427window.ASPxClientGlobalBeginCallbackEventArgs = ASPxClientGlobalBeginCallbackEventArgs;
12428window.ASPxClientEndCallbackEventArgs = ASPxClientEndCallbackEventArgs;
12429window.ASPxClientGlobalEndCallbackEventArgs = ASPxClientGlobalEndCallbackEventArgs;
12430window.ASPxClientCallbackErrorEventArgs = ASPxClientCallbackErrorEventArgs;
12431window.ASPxClientGlobalCallbackErrorEventArgs = ASPxClientGlobalCallbackErrorEventArgs;
12432window.ASPxClientCustomDataCallbackEventArgs = ASPxClientCustomDataCallbackEventArgs;
12433window.ASPxClientValidationCompletedEventArgs = ASPxClientValidationCompletedEventArgs;
12434window.ASPxClientControlsInitializedEventArgs = ASPxClientControlsInitializedEventArgs;
12435window.ASPxClientControlBeforePronounceEventArgs = ASPxClientControlBeforePronounceEventArgs;
12436window.ASPxClientControlUnloadEventArgs = ASPxClientControlUnloadEventArgs;
12437window.ASPxClientControlCollection = ASPxClientControlCollection;
12438window.ASPxClientControlBase = ASPxClientControlBase;
12439window.ASPxClientControl = ASPxClientControl;
12440window.ASPxClientComponent = ASPxClientComponent;
12441})();
12442(function () {
12443 var PositionAnimationTransition = ASPx.CreateClass(ASPx.AnimationTransitionBase, {
12444  constructor: function (element, options) {
12445   this.constructor.prototype.constructor.call(this, element, options);
12446   this.direction = options.direction;
12447   this.animationTransition = this.createAnimationTransition();
12448   AnimationHelper.appendWKAnimationClassNameIfRequired(this.element);
12449  },
12450  Start: function (to) {
12451   var from = this.GetValue();
12452   if(ASPx.AnimationUtils.CanUseCssTransform()) {
12453    from = this.convertPosToCssTransformPos(from);
12454    to = this.convertPosToCssTransformPos(to);
12455   }
12456   this.animationTransition.Start(from, to);
12457  },
12458  SetValue: function (value) {
12459   ASPx.AnimationUtils.SetTransformValue(this.element, value, this.direction == AnimationHelper.SLIDE_VERTICAL_DIRECTION);
12460  },
12461  GetValue: function () {
12462   return ASPx.AnimationUtils.GetTransformValue(this.element, this.direction == AnimationHelper.SLIDE_VERTICAL_DIRECTION);
12463  },
12464  createAnimationTransition: function () {
12465   var transition = ASPx.AnimationUtils.CanUseCssTransform() ? this.createTransformAnimationTransition() : this.createPositionAnimationTransition();
12466   transition.transition = ASPx.AnimationConstants.Transitions.POW_EASE_OUT;
12467   return transition;
12468  },
12469  createTransformAnimationTransition: function () {
12470   return ASPx.AnimationUtils.createCssAnimationTransition(this.element, {
12471    property: ASPx.AnimationUtils.CanUseCssTransform(),
12472    duration: this.duration,
12473    onComplete: this.onComplete
12474   });
12475  },
12476  createPositionAnimationTransition: function () {
12477   return AnimationHelper.createAnimationTransition(this.element, {
12478    property: this.direction == AnimationHelper.SLIDE_VERTICAL_DIRECTION ? "top" : "left",
12479    unit: "px",
12480    duration: this.duration,
12481    onComplete: this.onComplete
12482   });
12483  },
12484  convertPosToCssTransformPos: function (position) {
12485   return ASPx.AnimationUtils.GetTransformCssText(position, this.direction == AnimationHelper.SLIDE_VERTICAL_DIRECTION);
12486  }
12487 });
12488 var AnimationHelper = {
12489  SLIDE_HORIZONTAL_DIRECTION: 0,
12490  SLIDE_VERTICAL_DIRECTION: 1,
12491  SLIDE_TOP_DIRECTION: 0,
12492  SLIDE_RIGHT_DIRECTION: 1,
12493  SLIDE_BOTTOM_DIRECTION: 2,
12494  SLIDE_LEFT_DIRECTION: 3,
12495  SLIDE_CONTAINER_CLASS: "dxAC",
12496  MAXIMUM_DEPTH: 3,
12497  createAnimationTransition: function (element, options) {
12498   if(options.onStep) 
12499    options.animationEngine = "js";
12500   switch (options.animationEngine) {
12501    case "js":
12502     return ASPx.AnimationUtils.createJsAnimationTransition(element, options);
12503    case "css":
12504     return ASPx.AnimationUtils.createCssAnimationTransition(element, options);
12505    default:
12506     return ASPx.AnimationUtils.CanUseCssTransition() ? ASPx.AnimationUtils.createCssAnimationTransition(element, options) :
12507      ASPx.AnimationUtils.createJsAnimationTransition(element, options);
12508   }
12509  },
12510  createMultipleAnimationTransition: function (element, options) {
12511   return ASPx.AnimationUtils.createMultipleAnimationTransition(element, options);
12512  },
12513  createSimpleAnimationTransition: function (options) {
12514   return ASPx.AnimationUtils.createSimpleAnimationTransition(options);
12515  },
12516  cancelAnimation: function (element) {
12517   ASPx.AnimationTransitionBase.Cancel(element);
12518  },
12519  fadeIn: function (element, onComplete, duration) {
12520   AnimationHelper.fadeTo(element, {
12521    from: 0, to: 1,
12522    onComplete: onComplete,
12523    duration: duration || ASPx.AnimationConstants.Durations.DEFAULT
12524   });
12525  },
12526  fadeOut: function (element, onComplete, duration) {
12527   AnimationHelper.fadeTo(element, {
12528    from: ASPx.GetElementOpacity(element), to: 0,
12529    onComplete: onComplete,
12530    duration: duration || ASPx.AnimationConstants.Durations.DEFAULT
12531   });
12532  },
12533  fadeTo: function (element, options) {
12534   options.property = "opacity";
12535   if(!options.duration)
12536    options.duration = ASPx.AnimationConstants.Durations.SHORT;
12537   var transition = AnimationHelper.createAnimationTransition(element, options);
12538   if(!ASPx.IsExists(options.from))
12539    options.from = transition.GetValue();
12540   transition.Start(options.from, options.to);
12541  },
12542  slideIn: function (element, direction, onComplete, animationEngineType, rtl) {
12543   AnimationHelper.setOpacity(element, 1);
12544   var animationContainer = AnimationHelper.getSlideAnimationContainer(element, true, true);
12545   var pos = AnimationHelper.getSlideInStartPos(animationContainer, direction, rtl);
12546   var transition = AnimationHelper.createSlideTransition(animationContainer, direction,
12547    function (el) {
12548     AnimationHelper.resetSlideAnimationContainerSize(animationContainer);
12549     if(onComplete)
12550      onComplete(el);
12551    }, animationEngineType, rtl);
12552   transition.Start(pos, 0);
12553  },
12554  slideOut: function (element, direction, onComplete, animationEngineType, rtl) {
12555   var animationContainer = AnimationHelper.getSlideAnimationContainer(element, true, true);
12556   var pos = AnimationHelper.getSlideOutFinishPos(animationContainer, direction, rtl);
12557   var transition = AnimationHelper.createSlideTransition(animationContainer, direction,
12558    function (el) {
12559     AnimationHelper.setOpacity(el.firstChild, 0);
12560     if(onComplete)
12561      onComplete(el);
12562    }, animationEngineType, rtl);
12563   transition.Start(pos);
12564  },
12565  slideTo: function (element, options) {
12566   if(!ASPx.IsExists(options.direction))
12567    options.direction = AnimationHelper.SLIDE_HORIZONTAL_DIRECTION;
12568   var transition = new PositionAnimationTransition(element, options);
12569   transition.Start(options.to);
12570  },
12571  setOpacity: function (element, value) {
12572   ASPx.AnimationUtils.setOpacity(element, value);
12573  },
12574  appendWKAnimationClassNameIfRequired: function (element) {
12575   if(ASPx.AnimationUtils.CanUseCssTransform() && ASPx.Browser.WebKitFamily && !ASPx.ElementHasCssClass(element, "dx-wbv"))
12576    element.className += " dx-wbv";
12577  },
12578  findSlideAnimationContainer: function (element) {
12579   var container = element;
12580   for(var i = 0; i < AnimationHelper.MAXIMUM_DEPTH; i++) {
12581    if(container.tagName == "BODY")
12582     return null;
12583    if(ASPx.ElementHasCssClass(container, AnimationHelper.SLIDE_CONTAINER_CLASS))
12584     return container;
12585    container = container.parentNode;
12586   }
12587   return null;
12588  },
12589  createSlideAnimationContainer: function (element) {
12590   var rootContainer = document.createElement("DIV");
12591   ASPx.SetStyles(rootContainer, {
12592    className: AnimationHelper.SLIDE_CONTAINER_CLASS,
12593    overflow: "hidden"
12594   });
12595   var elementContainer = document.createElement("DIV");
12596   rootContainer.appendChild(elementContainer);
12597   var parentNode = element.parentNode;
12598   parentNode.insertBefore(rootContainer, element);
12599   elementContainer.appendChild(element);
12600   return rootContainer;
12601  },
12602  getSlideAnimationContainer: function (element, create, fixSize) {
12603   if(!element) return;
12604   var width = element.offsetWidth;
12605   var height = element.offsetHeight;
12606   var container;
12607   if(element.className == AnimationHelper.SLIDE_CONTAINER_CLASS)
12608    container = element;
12609   if(!container)
12610    container = AnimationHelper.findSlideAnimationContainer(element);
12611   if(!container && create)
12612    container = AnimationHelper.createSlideAnimationContainer(element);
12613   if(container && fixSize) {
12614    ASPx.SetStyles(container, {
12615     width: width, height: height
12616    });
12617    ASPx.SetStyles(container.firstChild, {
12618     width: width, height: height
12619    });
12620   }
12621   return container;
12622  },
12623  resetSlideAnimationContainerSize: function (container) {
12624   ASPx.SetStyles(container, {
12625    width: "", height: ""
12626   });
12627   ASPx.SetStyles(container.firstChild, {
12628    width: "", height: ""
12629   });
12630  },
12631  getModifyProperty: function (direction, rtl) {
12632   if(direction == AnimationHelper.SLIDE_TOP_DIRECTION || direction == AnimationHelper.SLIDE_BOTTOM_DIRECTION)
12633    return "marginTop";
12634   return rtl ? "margin-right" : "margin-left";
12635  },
12636  createSlideTransition: function (animationContainer, direction, complete, animationEngineType, rtl) {
12637   if(rtl == undefined)
12638    rtl = false;
12639   var animationEngine = "";
12640   switch(animationEngineType) {
12641    case AnimationEngineType.JS:
12642     animationEngine = "js";
12643     break;
12644    case AnimationEngineType.CSS:
12645     animationEngine = "css";
12646     break;
12647   }
12648   return AnimationHelper.createAnimationTransition(animationContainer.firstChild, {
12649    unit: "px",
12650    property: AnimationHelper.getModifyProperty(direction, rtl),
12651    onComplete: complete,
12652    animationEngine: animationEngine
12653   });
12654  },
12655  getSlideInStartPos: function (animationContainer, direction, rtl) {
12656   var dir = rtl ? -1 : 1;
12657   switch (direction) {
12658    case AnimationHelper.SLIDE_TOP_DIRECTION:
12659     return animationContainer.offsetHeight;
12660    case AnimationHelper.SLIDE_LEFT_DIRECTION:
12661     return animationContainer.offsetWidth * dir;
12662    case AnimationHelper.SLIDE_RIGHT_DIRECTION:
12663     return -animationContainer.offsetWidth * dir;
12664    case AnimationHelper.SLIDE_BOTTOM_DIRECTION:
12665     return -animationContainer.offsetHeight;
12666   }
12667  },
12668  getSlideOutFinishPos: function (animationContainer, direction, rtl) {
12669   var dir = rtl ? -1 : 1;
12670   switch (direction) {
12671    case AnimationHelper.SLIDE_TOP_DIRECTION:
12672     return -animationContainer.offsetHeight;
12673    case AnimationHelper.SLIDE_LEFT_DIRECTION:
12674     return -animationContainer.offsetWidth * dir;
12675    case AnimationHelper.SLIDE_RIGHT_DIRECTION:
12676     return animationContainer.offsetWidth * dir;
12677    case AnimationHelper.SLIDE_BOTTOM_DIRECTION:
12678     return animationContainer.offsetHeight;
12679   }
12680  }
12681 };
12682 var GestureHandler = ASPx.CreateClass(null, {
12683  constructor: function (getAnimationElement, canHandle, allowStart) {
12684   this.getAnimationElement = getAnimationElement;
12685   this.canHandle = canHandle;
12686   this.allowStart = allowStart;
12687   this.startMousePosX = 0;
12688   this.startMousePosY = 0;
12689   this.startTime = null;
12690   this.isEventsPrevented = false;
12691   this.savedElements = [];
12692  },
12693  OnSelectStart: function(evt) {
12694   ASPx.Evt.PreventEvent(evt); 
12695  },
12696  OnDragStart: function(evt) {
12697   ASPx.Evt.PreventEvent(evt);  
12698  },
12699  OnMouseDown: function (evt) {
12700   this.startMousePosX = ASPx.Evt.GetEventX(evt);
12701   this.startMousePosY = ASPx.Evt.GetEventY(evt);
12702   this.startTime = new Date();
12703  },
12704  OnMouseMove: function(evt) {
12705   if(!ASPx.Browser.MobileUI)
12706    ASPx.Selection.Clear();
12707   if(Math.abs(this.GetCurrentDistanceX(evt)) < GestureHandler.SLIDER_MIN_START_DISTANCE && Math.abs(this.GetCurrentDistanceY(evt)) < GestureHandler.SLIDER_MIN_START_DISTANCE)
12708    GesturesHelper.isExecutedGesture = false;
12709  },
12710  OnMouseUp: function (evt) {
12711  },
12712  CanHandleEvent: function (evt) {
12713   return !this.canHandle || this.canHandle(evt);
12714  },
12715  IsStartAllowed: function(value) {
12716   return !this.allowStart || this.allowStart(value);
12717  },
12718  RollbackGesture: function () {
12719  },
12720  GetRubberPosition: function (position) {
12721   return position / GestureHandler.FACTOR_RUBBER;
12722  },
12723  GetCurrentDistanceX: function (evt) {
12724   return ASPx.Evt.GetEventX(evt) - this.startMousePosX;
12725  },
12726  GetCurrentDistanceY: function (evt) {
12727   return ASPx.Evt.GetEventY(evt) - this.startMousePosY;
12728  },
12729  GetDistanceLimit: function () {
12730   return (new Date() - this.startTime) < GestureHandler.MAX_TIME_SPAN ? GestureHandler.MIN_DISTANCE_LIMIT : GestureHandler.MAX_DISTANCE_LIMIT;
12731  },
12732  GetContainerElement: function () {
12733  },
12734  AttachPreventEvents: function (evt) {
12735   if(!this.isEventsPrevented) {
12736    var element = ASPx.Evt.GetEventSource(evt);
12737    var container = this.GetContainerElement();
12738    while(element && element != container) {
12739     ASPx.Evt.AttachEventToElement(element, "mouseup", ASPx.Evt.PreventEvent);
12740     ASPx.Evt.AttachEventToElement(element, "click", ASPx.Evt.PreventEvent);
12741     this.savedElements.push(element);
12742     element = element.parentNode;
12743    }
12744    this.isEventsPrevented = true;
12745   }
12746  },
12747  DetachPreventEvents: function () {
12748   if(this.isEventsPrevented) {
12749    window.setTimeout(function () {
12750     while(this.savedElements.length > 0) {
12751      var element = this.savedElements.pop();
12752      ASPx.Evt.DetachEventFromElement(element, "mouseup", ASPx.Evt.PreventEvent);
12753      ASPx.Evt.DetachEventFromElement(element, "click", ASPx.Evt.PreventEvent);
12754     }
12755    }.aspxBind(this), 0);
12756    this.isEventsPrevented = false;
12757   }
12758  }
12759 });
12760 GestureHandler.MAX_DISTANCE_LIMIT = 70;
12761 GestureHandler.MIN_DISTANCE_LIMIT = 10;
12762 GestureHandler.MIN_START_DISTANCE = 0;
12763 GestureHandler.SLIDER_MIN_START_DISTANCE = 5;
12764 GestureHandler.MAX_TIME_SPAN = 300;
12765 GestureHandler.FACTOR_RUBBER = 4;
12766 GestureHandler.RETURN_ANIMATION_DURATION = 150;
12767 var SwipeSlideGestureHandler = ASPx.CreateClass(GestureHandler, {
12768  constructor: function (getAnimationElement, direction, canHandle, backward, forward, rollback, move) {
12769   this.constructor.prototype.constructor.call(this, getAnimationElement, canHandle);
12770   this.slideElement = this.getAnimationElement();
12771   this.container = this.slideElement.parentNode;
12772   this.direction = direction;
12773   this.backward = backward;
12774   this.forward = forward;
12775   this.rollback = rollback;
12776   this.slideElementSize = 0;
12777   this.containerElementSize = 0;
12778   this.startSliderElementPosition = 0;
12779   this.centeredSlideElementPosition = 0;
12780  },
12781  OnMouseDown: function (evt) {
12782   GestureHandler.prototype.OnMouseDown.call(this, evt);
12783   this.slideElementSize = this.GetElementSize();
12784   this.startSliderElementPosition = this.GetElementPosition();
12785   this.containerElementSize = this.GetContainerElementSize();
12786   if(this.slideElementSize <= this.containerElementSize)
12787    this.centeredSlideElementPosition = (this.containerElementSize - this.slideElementSize) / 2;
12788  },
12789  OnMouseMove: function (evt) {
12790   GestureHandler.prototype.OnMouseMove.call(this, evt);
12791   if(!ASPx.Browser.TouchUI && !ASPx.GetIsParent(this.container, ASPx.Evt.GetEventSource(evt))) {
12792    GesturesHelper.OnDocumentMouseUp(evt);
12793    return;
12794   }
12795   var distance = this.GetCurrentDistance(evt);
12796   if(Math.abs(distance) < GestureHandler.SLIDER_MIN_START_DISTANCE || ASPx.TouchUIHelper.isGesture)
12797    return;
12798   this.SetElementPosition(this.GetCalculatedPosition(distance));
12799   this.AttachPreventEvents(evt);
12800   ASPx.Evt.PreventEvent(evt);
12801  },
12802  GetCalculatedPosition: function (distance) {
12803   ASPx.AnimationTransitionBase.Cancel(this.slideElement);
12804   var position = this.startSliderElementPosition + distance,
12805    maxPosition = -(this.slideElementSize - this.containerElementSize),
12806    minPosition = 0;
12807   if(this.centeredSlideElementPosition > 0)
12808    position = this.GetRubberPosition(distance) + this.centeredSlideElementPosition;
12809   else if(position > minPosition)
12810    position = this.GetRubberPosition(distance);
12811   else if(position < maxPosition)
12812    position = this.GetRubberPosition(distance) + maxPosition;
12813   return position;
12814  },
12815  OnMouseUp: function (evt) {
12816   this.DetachPreventEvents();
12817   if(this.GetCurrentDistance(evt) != 0)
12818    this.OnMouseUpCore(evt);
12819  },
12820  OnMouseUpCore: function (evt) {
12821   var distance = this.GetCurrentDistance(evt);
12822   if(this.centeredSlideElementPosition > 0 || this.CheckSlidePanelIsOutOfBounds())
12823    this.PerformRollback();
12824   else
12825    this.PerformAction(distance);
12826  },
12827  PerformAction: function (distance) {
12828   if(Math.abs(distance) < this.GetDistanceLimit())
12829    this.PerformRollback();
12830   else if(distance < 0)
12831    this.PerformForward();
12832   else
12833    this.PerformBackward();
12834  },
12835  PerformBackward: function () {
12836   this.backward();
12837  },
12838  PerformForward: function () {
12839   this.forward();
12840  },
12841  PerformRollback: function () {
12842   this.rollback();
12843  },
12844  CheckSlidePanelIsOutOfBounds: function () {
12845   var minOffset = -(this.slideElementSize - this.containerElementSize), maxOffset = 0;
12846   var slideElementPos = this.GetElementPosition();
12847   if(slideElementPos > maxOffset || slideElementPos < minOffset)
12848    return true;
12849   return false;
12850  },
12851  GetContainerElement: function () {
12852   return this.container;
12853  },
12854  GetElementSize: function () {
12855   return this.IsHorizontalDirection() ? this.slideElement.offsetWidth : this.slideElement.offsetHeight;
12856  },
12857  GetContainerElementSize: function () {
12858   return this.IsHorizontalDirection() ? ASPx.GetClearClientWidth(this.container) : ASPx.GetClearClientHeight(this.container);
12859  },
12860  GetCurrentDistance: function (evt) {
12861   return this.IsHorizontalDirection() ? this.GetCurrentDistanceX(evt) : this.GetCurrentDistanceY(evt);
12862  },
12863  GetElementPosition: function () {
12864   return ASPx.AnimationUtils.GetTransformValue(this.slideElement, !this.IsHorizontalDirection());
12865  },
12866  SetElementPosition: function (position) {
12867   ASPx.AnimationUtils.SetTransformValue(this.slideElement, position, !this.IsHorizontalDirection());
12868  },
12869  IsHorizontalDirection: function () {
12870   return this.direction == AnimationHelper.SLIDE_HORIZONTAL_DIRECTION;
12871  }
12872 });
12873 var SwipeSimpleSlideGestureHandler = ASPx.CreateClass(SwipeSlideGestureHandler, {
12874  constructor: function (getAnimationElement, direction, canHandle, backward, forward, rollback, updatePosition) {
12875   this.constructor.prototype.constructor.call(this, getAnimationElement, direction, canHandle, backward, forward, rollback);
12876   this.container = this.slideElement;
12877   this.updatePosition = updatePosition;
12878   this.prevDistance = 0;
12879  },
12880  OnMouseDown: function (evt) {
12881   GestureHandler.prototype.OnMouseDown.call(this, evt);
12882   this.prevDistance = 0;
12883  },
12884  OnMouseUpCore: function (evt) {
12885   this.PerformAction(this.GetCurrentDistance(evt));
12886  },
12887  PerformAction: function (distance) {
12888   if(Math.abs(distance) < this.GetDistanceLimit())
12889    this.PerformRollback();
12890   else if(distance < 0)
12891    this.PerformForward();
12892   else
12893    this.PerformBackward();
12894  },
12895  GetCalculatedPosition: function (distance) {
12896   var position = distance - this.prevDistance;
12897   this.prevDistance = distance;
12898   return position;
12899  },
12900  SetElementPosition: function (position) {
12901   this.updatePosition(position);
12902  }
12903 });
12904 var SwipeGestureHandler = ASPx.CreateClass(GestureHandler, {
12905  constructor: function (getAnimationElement, canHandle, allowStart, start, allowComplete, complete, cancel, animationEngineType, rtl) {
12906   this.constructor.prototype.constructor.call(this, getAnimationElement, canHandle, allowStart);
12907   this.start = start;
12908   this.allowComplete = allowComplete;
12909   this.complete = complete;
12910   this.cancel = cancel;
12911   this.animationTween = null;
12912   this.currentDistanceX = 0;
12913   this.currentDistanceY = 0;
12914   this.tryStartGesture = false;
12915   this.tryStartScrolling = false;
12916   this.animationEngineType = animationEngineType;
12917   this.rtl = rtl;
12918   this.UpdateAnimationContainer();
12919  },
12920  UpdateAnimationContainer: function () {
12921   this.animationContainer = AnimationHelper.getSlideAnimationContainer(this.getAnimationElement(), true, false);
12922  },
12923  CanHandleEvent: function (evt) {
12924   if(GestureHandler.prototype.CanHandleEvent.call(this, evt))
12925    return true;
12926   return this.animationTween && this.animationContainer && ASPx.GetIsParent(this.animationContainer, ASPx.Evt.GetEventSource(evt));
12927  },
12928  OnMouseDown: function (evt) {
12929   GestureHandler.prototype.OnMouseDown.call(this, evt);
12930   if(this.animationTween)
12931    this.animationTween.Cancel();
12932   this.currentDistanceX = 0;
12933   this.currentDistanceY = 0;
12934   this.tryStartGesture = false;
12935   this.tryStartScrolling = false;
12936  },
12937  OnMouseMove: function (evt) {
12938   GestureHandler.prototype.OnMouseMove.call(this, evt);
12939   var isZoomGestureConflict = evt.touches && evt.touches.length > 1;
12940   if (isZoomGestureConflict)
12941    return false;
12942   this.currentDistanceX = this.GetCurrentDistanceX(evt);
12943   this.currentDistanceY = this.GetCurrentDistanceY(evt);
12944   if(this.rtl)
12945    this.currentDistanceX = -this.currentDistanceX;
12946   if(!this.animationTween && !this.tryStartScrolling && (Math.abs(this.currentDistanceX) >
12947    GestureHandler.MIN_START_DISTANCE || Math.abs(this.currentDistanceY) > GestureHandler.MIN_START_DISTANCE)) {
12948    if(Math.abs(this.currentDistanceY) < Math.abs(this.currentDistanceX)) {
12949     this.tryStartGesture = true;
12950     if(this.IsStartAllowed(this.currentDistanceX)) {
12951      this.animationContainer = AnimationHelper.getSlideAnimationContainer(this.getAnimationElement(), true, true);
12952      this.animationTween = AnimationHelper.createSlideTransition(this.animationContainer, AnimationHelper.SLIDE_LEFT_DIRECTION,
12953       function () {
12954        AnimationHelper.resetSlideAnimationContainerSize(this.animationContainer);
12955        this.animationContainer = null;
12956        this.animationTween = null;
12957       }.aspxBind(this), this.animationEngineType, this.rtl);
12958      this.PerformStart(this.currentDistanceX);
12959      this.AttachPreventEvents(evt);
12960     }
12961    }
12962    else
12963     this.tryStartScrolling = true;
12964   }
12965   if(this.animationTween) {
12966    if(this.allowComplete && !this.allowComplete(this.currentDistanceX))
12967     this.currentDistanceX = this.GetRubberPosition(this.currentDistanceX);
12968    this.animationTween.SetValue(this.currentDistanceX);
12969   }
12970   if(!this.tryStartScrolling && !ASPx.TouchUIHelper.isGesture && evt.touches && evt.touches.length < 2)
12971    ASPx.Evt.PreventEvent(evt);
12972  },
12973  OnMouseUp: function (evt) {
12974   if(!this.animationTween) {
12975    if(this.tryStartGesture)
12976     this.PerformCancel(this.currentDistanceX);
12977   }
12978   else {
12979    if(Math.abs(this.currentDistanceX) < this.GetDistanceLimit())
12980     this.RollbackGesture();
12981    else {
12982     if(this.IsCompleteAllowed(this.currentDistanceX)) {
12983      this.PerformComplete(this.currentDistanceX);
12984      this.animationContainer = null;
12985      this.animationTween = null;
12986     }
12987     else
12988      this.RollbackGesture();
12989    }
12990   }
12991   this.DetachPreventEvents();
12992   this.tryStartGesture = false;
12993   this.tryStartScrolling = false;
12994  },
12995  PerformStart: function (value) {
12996   if(this.start)
12997    this.start(value);
12998  },
12999  IsCompleteAllowed: function (value) {
13000   return !this.allowComplete || this.allowComplete(value);
13001  },
13002  PerformComplete: function (value) {
13003   if(this.complete)
13004    this.complete(value);
13005  },
13006  PerformCancel: function (value) {
13007   if(this.cancel)
13008    this.cancel(value);
13009  },
13010  RollbackGesture: function () {
13011   this.animationTween.Start(this.currentDistanceX, 0);
13012  },
13013  ResetGestureElementPosition: function () {
13014   if (this.currentDistanceX === 0) return;
13015   var container = AnimationHelper.getSlideAnimationContainer(this.getAnimationElement());
13016   var onComplete = function () { AnimationHelper.resetSlideAnimationContainerSize(container); };
13017   var animation = AnimationHelper.createSlideTransition(container, AnimationHelper.SLIDE_LEFT_DIRECTION, onComplete, this.animationEngineType, this.rtl);
13018   animation.Start(this.currentDistanceX, 0);
13019  },
13020  GetContainerElement: function () {
13021   return this.animationContainer;
13022  }
13023 });
13024 var GesturesHelper = {
13025  handlers: {},
13026  activeHandler: null,
13027  isAttachedEvents: false,
13028  isExecutedGesture: false,
13029  AddSwipeGestureHandler: function (id, getAnimationElement, canHandle, allowStart, start, allowComplete, complete, cancel, animationEngineType, rtl) {
13030   this.handlers[id] = new SwipeGestureHandler(getAnimationElement, canHandle, allowStart, start, allowComplete, complete, cancel, animationEngineType, rtl);
13031  },
13032  UpdateSwipeAnimationContainer: function (id) {
13033   if(this.handlers[id])
13034    this.handlers[id].UpdateAnimationContainer();
13035  },
13036  AddSwipeSlideGestureHandler: function (id, getAnimationElement, direction, canHandle, backward, forward, rollback, updatePosition) {
13037   if(updatePosition)
13038    this.handlers[id] = new SwipeSimpleSlideGestureHandler(getAnimationElement, direction, canHandle, backward, forward, rollback, updatePosition);
13039   else
13040    this.handlers[id] = new SwipeSlideGestureHandler(getAnimationElement, direction, canHandle, backward, forward, rollback);
13041  },
13042  getParentDXEditorWithSwipeGestures: function(element) {
13043     return ASPx.GetParent(element, function(parent) {
13044      var parentObj = ASPx.GetControlCollection().Get(parent.id);
13045      return parentObj && parentObj.supportGestures && parentObj.isSwipeGesturesEnabled();
13046   });
13047  },
13048  canHandleMouseDown: function(evt) {
13049   if(!ASPx.Evt.IsLeftButtonPressed(evt))
13050    return false;
13051   var element = ASPx.Evt.GetEventSource(evt);
13052   var dxFocusedEditor = ASPx.Ident.scripts.ASPxClientEdit && ASPx.GetFocusedEditor();
13053   if(dxFocusedEditor && dxFocusedEditor.IsEditorElement(element)) {
13054    var elementParentDXEditorWithSwipeGestures = GesturesHelper.getParentDXEditorWithSwipeGestures(element);
13055    if(!elementParentDXEditorWithSwipeGestures || !dxFocusedEditor.IsEditorElement(elementParentDXEditorWithSwipeGestures))
13056     return false;
13057   }
13058   var isTextEditor = element.tagName == "TEXTAREA" || element.tagName == "INPUT" && ASPx.Attr.GetAttribute(element, "type") == "text";
13059   if(isTextEditor && document.activeElement == element)
13060    return false;
13061   return true;  
13062  },
13063  OnDocumentDragStart: function(evt) {
13064   if(GesturesHelper.activeHandler)
13065    GesturesHelper.activeHandler.OnDragStart(evt);
13066  },
13067  OnDocumentSelectStart: function(evt) {
13068   if(GesturesHelper.activeHandler)
13069    GesturesHelper.activeHandler.OnSelectStart(evt);
13070  },
13071  OnDocumentMouseDown: function (evt) {
13072   if(!GesturesHelper.canHandleMouseDown(evt))
13073    return;
13074   GesturesHelper.activeHandler = GesturesHelper.FindHandler(evt);
13075   if(GesturesHelper.activeHandler)
13076    GesturesHelper.activeHandler.OnMouseDown(evt);
13077  },
13078  OnDocumentMouseMove: function (evt) {
13079   if(GesturesHelper.activeHandler) {
13080    GesturesHelper.isExecutedGesture = true;
13081    GesturesHelper.activeHandler.OnMouseMove(evt);
13082   }
13083  },
13084  OnDocumentMouseUp: function (evt) {
13085   if(GesturesHelper.activeHandler) {
13086    GesturesHelper.activeHandler.OnMouseUp(evt);
13087    GesturesHelper.activeHandler = null;
13088    window.setTimeout(function () { GesturesHelper.isExecutedGesture = false; }, 0);
13089   }
13090  },
13091  AttachEvents: function () {
13092   if(!GesturesHelper.isAttachedEvents) {
13093    GesturesHelper.Attach(ASPx.Evt.AttachEventToElement);
13094    GesturesHelper.isAttachedEvents = true;
13095   }
13096  },
13097  DetachEvents: function () {
13098   if(GesturesHelper.isAttachedEvents) {
13099    GesturesHelper.Attach(ASPx.Evt.DetachEventFromElement);
13100    GesturesHelper.isAttachedEvents = false;
13101   }
13102  },
13103  Attach: function (changeEventsMethod) {
13104   var doc = window.document;
13105   changeEventsMethod(doc, ASPx.TouchUIHelper.touchMouseDownEventName, GesturesHelper.OnDocumentMouseDown);
13106   changeEventsMethod(doc, ASPx.TouchUIHelper.touchMouseMoveEventName, GesturesHelper.OnDocumentMouseMove);
13107   changeEventsMethod(doc, ASPx.TouchUIHelper.touchMouseUpEventName, GesturesHelper.OnDocumentMouseUp);
13108   if(!ASPx.Browser.MobileUI) {
13109    changeEventsMethod(doc, "selectstart", GesturesHelper.OnDocumentSelectStart);
13110    changeEventsMethod(doc, "dragstart", GesturesHelper.OnDocumentDragStart);
13111   }
13112  },
13113  FindHandler: function (evt) {
13114   var handlers = [];
13115   for(var id in GesturesHelper.handlers) {
13116    if(GesturesHelper.handlers.hasOwnProperty(id)) {
13117     var handler = GesturesHelper.handlers[id];
13118     if(handler.CanHandleEvent && handler.CanHandleEvent(evt))
13119      handlers.push(handler);
13120    }
13121   }
13122   if(!handlers.length)
13123    return null;
13124   handlers.sort(function (a, b) {
13125    return ASPx.GetIsParent(a.getAnimationElement(), b.getAnimationElement()) ? 1 : -1;
13126   });
13127   return handlers[0];
13128  },
13129  IsExecutedGesture: function () {
13130   return GesturesHelper.isExecutedGesture;
13131  }
13132 };
13133 GesturesHelper.AttachEvents();
13134 var AnimationEngineType = {
13135  "JS": 0,
13136  "CSS": 1,
13137  "DEFAULT" : 2
13138 };
13139 ASPx.AnimationEngineType = AnimationEngineType;
13140 ASPx.AnimationHelper = AnimationHelper;
13141 ASPx.GesturesHelper = GesturesHelper;
13142})();
13143
13144(function () {
13145var SplitterHelper = ASPx.CreateClass(null, {
13146 constructor: function (splitter) {
13147  this.splitter = splitter;
13148 },
13149 GetMoveMaxDeltaSize: function (deltaSize) {
13150  if(deltaSize == 0)
13151   return 0;
13152  var splitter = this.splitter,
13153   leftPane = splitter.moveLeftPane,
13154   rightPane = splitter.moveRightPane;
13155  if(splitter.isHeavyUpdate) {
13156   var parent = leftPane.parent;
13157   var totalSize = 0, minSize = 0;
13158   for(var i = 0; i < parent.panes.length; i++) {
13159    var pane = parent.panes[i];
13160    if(pane.isSizePx)
13161     continue;
13162    if(pane.collapsed) {
13163     var collapsedSize = pane.GetSizeDiff(pane.isVertical);
13164     totalSize += collapsedSize;
13165     minSize += collapsedSize;
13166    }
13167    else {
13168     totalSize += pane.GetOffsetSize();
13169     minSize += pane.GetMinSize();
13170    }
13171   }
13172   var rightPanePx = rightPane.isSizePx;
13173   if(rightPanePx)
13174    deltaSize = this.GetPaneMaxDeltaSize(rightPane, -deltaSize);
13175   deltaSize = this.GetMaxDeltaSize(totalSize, minSize, Number.MAX_VALUE, -deltaSize);
13176   if(!rightPanePx)
13177    deltaSize = this.GetPaneMaxDeltaSize(leftPane, -deltaSize);
13178  }
13179  else {
13180   var parent = leftPane.parent,
13181    rightPaneAutoSize = rightPane.IsAutoSize(parent.isVertical),
13182    leftPaneAutoSize = leftPane.IsAutoSize(parent.isVertical);
13183   if(!rightPaneAutoSize)
13184    deltaSize = -this.GetPaneMaxDeltaSize(rightPane, -1 * deltaSize);
13185   if(!leftPaneAutoSize)
13186    deltaSize = this.GetPaneMaxDeltaSize(leftPane, deltaSize);
13187  }
13188  return deltaSize;
13189 },
13190 GetPaneMaxDeltaSize: function (pane, deltaSize) {
13191  return this.GetMaxDeltaSize(pane.GetOffsetSize(), pane.GetMinSize(), pane.maxSize, deltaSize);
13192 },
13193 GetMaxDeltaSize: function (size, min, max, deltaSize) {
13194  var minDeltaSize = Math.floor(min - size);
13195  var maxDeltaSize = Math.floor(max - size);
13196  if(deltaSize < minDeltaSize)
13197   return (size < min) ? 0 : minDeltaSize;
13198  else if(deltaSize > maxDeltaSize)
13199   return (size > max) ? 0 : maxDeltaSize;
13200  return deltaSize;
13201 },
13202 GetCurrentPos: function () {
13203  return this.splitter.moveIsVertical
13204   ? ASPxClientSplitter.CurrentYPos
13205   : ASPxClientSplitter.CurrentXPos;
13206 },
13207 SetResizingPanelVisibility: function (visible, cursor) {
13208  var resizingPanel = ASPx.CacheHelper.GetCachedValue(this, "resizingPanel", function () {
13209   var resizingPanel = document.createElement("DIV");
13210   resizingPanel.style.overflow = "hidden";
13211   resizingPanel.style.position = "absolute";
13212   if(ASPx.Browser.IE && ASPx.Browser.MajorVersion < 10) {
13213    resizingPanel.style.backgroundColor = "White";
13214    resizingPanel.style.filter = "alpha(opacity=1)";
13215   }
13216   resizingPanel.isVisible = false;
13217   return resizingPanel;
13218  });
13219  if(resizingPanel.isVisible != visible) {
13220   if(visible) {
13221    var mainElement = this.splitter.GetMainElement();
13222    ASPx.SetStyles(resizingPanel, {
13223     width: mainElement.offsetWidth,
13224     height: mainElement.offsetHeight
13225    });
13226    if(cursor)
13227     resizingPanel.style.cursor = cursor;
13228    mainElement.parentNode.appendChild(resizingPanel);
13229    ASPx.SetAbsoluteX(resizingPanel, ASPx.GetAbsoluteX(mainElement));
13230    ASPx.SetAbsoluteY(resizingPanel, ASPx.GetAbsoluteY(mainElement));
13231   }
13232   else
13233    resizingPanel.parentNode.removeChild(resizingPanel);
13234   resizingPanel.isVisible = visible;
13235  }
13236 },
13237 OnDispose: function() {
13238  this.splitter = null;
13239 }
13240});
13241SplitterHelper.Resize = function (pane1, pane2, deltaSize) {
13242 if(pane1.isSizePx || pane2.isSizePx) {
13243  var parent = pane1.parent;
13244  if(pane1.isSizePx && !pane1.IsAutoSize(parent.isVertical))
13245   pane1.size += deltaSize;
13246  if(pane2.isSizePx && !pane2.IsAutoSize(parent.isVertical))
13247   pane2.size -= deltaSize;
13248 }
13249 else {
13250  var c = (pane1.size + pane2.size) / (pane1.GetOffsetSize() + pane2.GetOffsetSize());
13251  pane1.size = c * (pane1.GetOffsetSize() + deltaSize);
13252  pane2.size = c * (pane2.GetOffsetSize() - deltaSize);
13253 }
13254};
13255SplitterHelper.IsAllowResize = function (pane1, pane2) {
13256 if(!pane1 || !pane2)
13257  return false;
13258 if(!pane1.splitter.enabled)
13259  return false;
13260 var bothAutoSizeOrPercent = pane1.isVertical
13261  ? pane1.autoHeight && pane2.autoHeight || pane1.autoHeight && !pane2.isSizePx || !pane1.isSizePx && pane2.autoHeight
13262  : pane1.autoWidth && pane2.autoWidth || pane1.autoWidth && !pane2.isSizePx || !pane1.isSizePx && pane2.autoWidth;
13263 if(bothAutoSizeOrPercent)
13264  return false;
13265 return pane1.splitter.allowResize && pane1.allowResize && pane2.allowResize;
13266};
13267var ASPxSplitterPaneHelper = ASPx.CreateClass(null, {
13268 constructor: function(pane) {
13269  this.pane = pane;
13270  this.indexPath = this.GetIndexPath();
13271  var paneIdPostfix = this.pane.isRootPane ? "" : "_" + this.indexPath;
13272  var separatorIdPostfix = paneIdPostfix + "_S";
13273  this.postfixes = {
13274   pane: paneIdPostfix,
13275   separator: separatorIdPostfix,
13276   table: paneIdPostfix + "_T",
13277   contentContainer: paneIdPostfix + "_CC",
13278   collapseForwardButton: separatorIdPostfix + "_CF",
13279   collapseBackwardButton: separatorIdPostfix + "_CB",
13280   collapseButtonsSeparator: separatorIdPostfix + "_CS"
13281  };
13282  this.buttonsTableExists = !!this.GetCollapseBackwardButton();
13283  this.separatorImageExists = !!this.GetCollapseButtonsSeparatorImage();
13284  this.buttonsExists = this.buttonsTableExists || this.separatorImageExists;
13285 },
13286 GetCachedValue: function (name, func) {
13287  return ASPx.CacheHelper.GetCachedValue(this, name, func);
13288 },
13289 DropCachedValue: function (name) {
13290  ASPx.CacheHelper.DropCachedValue(this, name);
13291 },
13292 DropCache: function() {
13293  ASPx.CacheHelper.DropCache(this);
13294 },
13295 GetIndexPath: function () {
13296  if(this.pane.isRootPane)
13297   return "";
13298  var parentPane = this.pane.parent;
13299  if(parentPane.isRootPane)
13300   return "" + this.pane.index;
13301  return parentPane.helper.indexPath + ASPx.ItemIndexSeparator + this.pane.index;
13302 },
13303 GetChildElement: function (idPostfix) {
13304  return this.pane.splitter.GetChildElement(idPostfix);
13305 },
13306 GetPaneElement: function () {
13307  return this.GetChildElement(this.postfixes.pane);
13308 },
13309 GetTableElement: function () {
13310  return this.GetChildElement(this.postfixes.table);
13311 },
13312 GetContentContainerElement: function () {
13313  return this.GetCachedValue(this.postfixes.contentContainer, 
13314   function () { return ASPx.GetElementById(this.pane.splitter.name + this.postfixes.contentContainer); });
13315 },
13316 DropContentContainerElementFromCache: function () {
13317  this.DropCachedValue(this.postfixes.contentContainer);
13318 },
13319 GetSeparatorElementId: function () {
13320  return this.pane.splitter.name + this.postfixes.separator;
13321 },
13322 GetSeparatorElement: function () {
13323  return this.GetChildElement(this.postfixes.separator);
13324 },
13325 GetSeparatorDivElement: function () {
13326  return this.GetCachedValue("separatorDivElement", function () {
13327   var separatorElement = this.GetSeparatorElement();
13328   return separatorElement ? separatorElement.childNodes[0] : null;
13329  });
13330 },
13331 GetCollapseBackwardButton: function () {
13332  return this.GetChildElement(this.postfixes.collapseBackwardButton);
13333 },
13334 GetCollapseForwardButton: function () {
13335  return this.GetChildElement(this.postfixes.collapseForwardButton);
13336 },
13337 GetCollapseButtonsSeparator: function () {
13338  return this.GetChildElement(this.postfixes.collapseButtonsSeparator);
13339 },
13340 GetCollapseButtonsTable: function () {
13341  return this.GetCachedValue("collapseButtonsTable", function () {
13342   return this.buttonsTableExists ? ASPx.GetParentByTagName(this.GetCollapseForwardButton(), "TABLE") : null;
13343  });
13344 },
13345 GetCollapseButtonsSeparatorImage: function () {
13346  return this.GetCachedValue("collapseButtonsSeparatorImage", function () {
13347   var separator = this.GetCollapseButtonsSeparator();
13348   if(!separator) {
13349    if(!this.buttonsTableExists)
13350     separator = this.GetSeparatorElement();
13351    else
13352     return null;
13353   }
13354   return ASPx.GetNodeByTagName(separator, "IMG", 0);
13355  });
13356 },
13357 GetButtonUpdateElement: function (buttonElement) {
13358  return !this.pane.isVertical ? buttonElement.parentNode : buttonElement;
13359 },
13360 ClearElementSizeProperty: function (property) {
13361  var element = this.GetPaneElement(),
13362   isVertical = property === "width";
13363  this.pane.savedSizeProperty = element.style[property];
13364  element.style[property] = "";
13365  if(!this.pane.IsAutoSize(isVertical)) {
13366   var contentContainerElement = this.GetContentContainerElement();
13367   this.pane.savedContentSizeProperty = contentContainerElement.style[property];
13368   contentContainerElement.style[property] = (this.pane.GetMinSize() - (isVertical ? this.pane.contentContainerWidthDiff : this.pane.contentContainerHeightDiff)) + "px";
13369  }
13370 },
13371 RestoreElementSizeProperty: function (property) {
13372  if(this.pane.savedSizeProperty) {
13373   this.GetPaneElement().style[property] = this.pane.savedSizeProperty;
13374   this.pane.savedSizeProperty = null;
13375  }
13376  if(!this.pane.IsAutoSize(property === "width")) {
13377   this.GetContentContainerElement().style[property] = this.pane.savedContentSizeProperty;
13378   this.pane.savedContentSizeProperty = null;
13379  }
13380 },
13381 SetEmptyDivVisible: function (visible) {
13382  var emptyDiv = this.GetCachedValue("emptyDiv", function () {
13383   var emptyDiv = document.createElement("DIV");
13384   emptyDiv.style.cssText = "overflow: hidden; width: 0px; height: 0px";
13385   emptyDiv.isVisible = false;
13386   return emptyDiv;
13387  });
13388  if(visible != emptyDiv.isVisible) {
13389   if(visible)
13390    this.GetPaneElement().appendChild(emptyDiv);
13391   else
13392    this.GetPaneElement().removeChild(emptyDiv);
13393   emptyDiv.isVisible = visible;
13394  }
13395 },
13396 HasCollapsedParent: function () {
13397  var parent = this.pane.parent;
13398  if(parent)
13399   return parent.collapsed || parent.helper.HasCollapsedParent();
13400  return false;
13401 },
13402 HasVisibleAutoSizeChildren: function (isVertical) {
13403  var result = false;
13404  if(!ASPx.IsExists(isVertical))
13405   isVertical = this.pane.isVertical;
13406  for(var i = 0; i < this.pane.panes.length; i++) {
13407   var pane = this.pane.panes[i];
13408   result = result || !pane.collapsed && pane.IsAutoSize(isVertical) && (!pane.panes.length || pane.helper.HasVisibleAutoSizeChildren(isVertical));
13409  }
13410  return result;
13411 },
13412 OnDispose: function() {
13413  this.pane = null;
13414  this.DropCache();
13415 }
13416});
13417var ASPxSplitterResizingPointer = ASPx.CreateClass(null, {
13418 constructor: function (elementId) {
13419  this.elementId = elementId;
13420  this.element = ASPx.GetElementById(this.elementId);
13421  this.x = 0;
13422  this.y = 0;
13423 },
13424 SetCursor: function (cursor) {
13425  this.element.style.cursor = cursor;
13426 },
13427 SetPosition: function (x, y) {
13428  this.x = x;
13429  this.y = y;
13430  ASPx.SetAbsoluteY(this.element, this.y);
13431  ASPx.SetAbsoluteX(this.element, this.x);
13432 },
13433 SetVisibility: function (isVisible) {
13434  ASPx.SetElementDisplay(this.element, isVisible);
13435 },
13436 Move: function (delta, isX) {
13437  if(isX)
13438   this.x += delta;
13439  else
13440   this.y += delta;
13441  this.SetPosition(this.x, this.y);
13442 },
13443 AttachToElement: function (element, isShow) {
13444  ASPx.SetStyles(this.element, {
13445   width: element.offsetWidth, height: element.offsetHeight
13446  });
13447  this.SetVisibility(true);
13448  this.SetPosition(ASPx.GetAbsoluteX(element), ASPx.GetAbsoluteY(element));
13449 }
13450});
13451var ASPxClientSplitter = ASPx.CreateClass(ASPxClientControl, {
13452 constructor: function (name) {
13453  this.constructor.prototype.constructor.call(this, name);
13454  this.leadingAfterInitCall = ASPxClientControl.LeadingAfterInitCallConsts.Reverse;
13455  this.emptyUrls = [
13456   "javascript:false",
13457   "about:blank",
13458   "#"
13459  ];
13460  this.width = "100%";
13461  this.height = "200px";
13462  this.helper = new SplitterHelper(this);
13463  this.resizingPointer = new ASPxSplitterResizingPointer(this.name + "_RP");
13464  this.rootPane = new ASPxClientSplitterPane(this, null, 0, 0, {});
13465  this.liveResizing = false;
13466  this.allowResize = true;
13467  this.defaultMinSize = 5;
13468  this.showSeparatorImage = true;
13469  this.showCollapseBackwardButton = false;
13470  this.showCollapseForwardButton = false;
13471  this.fullScreen = false;
13472  this.prepared = false;
13473  this.PaneResizing = new ASPxClientEvent();
13474  this.PaneResized = new ASPxClientEvent();
13475  this.PaneCollapsing = new ASPxClientEvent();
13476  this.PaneCollapsed = new ASPxClientEvent();
13477  this.PaneExpanding = new ASPxClientEvent();
13478  this.PaneExpanded = new ASPxClientEvent();
13479  this.PaneResizeCompleted = new ASPxClientEvent();
13480  this.PaneContentUrlLoaded = new ASPxClientEvent();
13481  this.autoHeightPanes = [];
13482  this.autoWidthPanes = [];
13483  this.inFullscreen = false;
13484 },
13485 SetData: function(data){
13486  if(data.isVertical)
13487   this.rootPane.isVertical = data.isVertical;
13488  if(data.panes)
13489   this.CreatePanes(data.panes);
13490 },
13491 CreatePanes: function (panesInfo) {
13492  this.CreatePanesInternal(this.rootPane, panesInfo);
13493  this.rootPane.ForEach("UpdateSize");
13494  this.rootPane.ForEach("UpdateAutoSize");
13495  this.state = this.GetStateObj(panesInfo);
13496 },
13497 CreatePanesInternal: function (parent, panesInfo) {
13498  var prevPane = null,
13499   visibleIndex = 0;
13500  for(var i = 0; i < panesInfo.length; i++) {
13501   var paneInfo = panesInfo[i];
13502   if(!paneInfo.v) continue; 
13503   var pane = new ASPxClientSplitterPane(this, parent, visibleIndex++, i, paneInfo);
13504   updatePrevNext(pane);
13505   updateAutoSize(parent, pane.autoWidth, pane.autoHeight);
13506   parent.panes.push(pane);
13507   if(ASPx.IsExists(paneInfo["i"]))
13508    this.CreatePanesInternal(pane, paneInfo["i"]);
13509  }
13510  function updatePrevNext(pane) {
13511   pane.prevPane = prevPane;
13512   if(prevPane != null)
13513    prevPane.nextPane = pane;
13514   prevPane = pane;
13515  }
13516  function updateAutoSize(pane, autoWidth, autoHeight) {
13517   if(pane && (autoWidth || autoHeight)) {
13518    if(autoWidth)
13519     pane.autoWidth = true;
13520    if(autoHeight)
13521     pane.autoHeight = true;
13522    if(!pane.splitter.hasAutoSizePane)
13523     pane.splitter.hasAutoSizePane = true;
13524    updateAutoSize(pane.parent, autoWidth, autoHeight);
13525   }
13526  }
13527 },
13528 GetStateObj: function (panesInfo) {
13529  var result = [];
13530  for(var i = 0; i < panesInfo.length; i++) {
13531   var paneState = {};
13532   if(panesInfo[i].st) {
13533    paneState.st = panesInfo[i].st;
13534    paneState.s = panesInfo[i].s;
13535   }
13536   if(panesInfo[i].c)
13537    paneState.c = panesInfo[i].c;
13538   if(panesInfo[i]["i"])
13539    paneState["i"] = this.GetStateObj(panesInfo[i]["i"]);
13540   result.push(paneState);
13541  }
13542  return result;
13543 },
13544 GetClientStateString: function () {
13545  return ASPx.Json.ToJson(this.GetClientStateObject());
13546 },
13547 GetClientStateObject: function () {
13548  return this.RefreshState(this.state, this.rootPane.panes);
13549 },
13550 RefreshState: function (state, panes) {
13551  for(var i = 0; i < panes.length; i++) {
13552   var pane = panes[i];
13553   var paneState = state[pane._index];
13554   paneState.s = Math.round(pane.size * 1000) / 1000;
13555   paneState.st = pane.sizeType;
13556   paneState.c = pane.collapsed ? 1 : 0;
13557   if(pane.panes.length == 0) {
13558    paneState.spt = Math.round(pane.scrollTop);
13559    paneState.spl = Math.round(pane.scrollLeft);
13560   }
13561   if(pane.panes.length > 0)
13562    this.RefreshState(paneState["i"], pane.panes);
13563  }
13564  return state;
13565 },
13566 InlineInitialize: function () {
13567  this.EnsureFullscreenMode();
13568  this.rootPane.ForEach("Initialize");
13569  ASPxClientControl.prototype.InlineInitialize.call(this);
13570 },
13571 EnsureFullscreenMode: function () {
13572  if(this.fullScreen) {
13573   var overflowProperty = "overflow",
13574    oldIEOverflowAutoProperty = null,
13575    autoWidth = this.rootPane.autoWidth,
13576    autoHeight = this.rootPane.autoHeight;
13577   if(autoWidth && autoHeight) {
13578    overflowProperty = null;
13579    oldIEOverflowAutoProperty = "overflow";
13580   }
13581   else if(autoWidth) {
13582    overflowProperty = "overflowY";
13583    oldIEOverflowAutoProperty = "overflowX";
13584   }
13585   else if(autoHeight) {
13586    overflowProperty = "overflowX";
13587    oldIEOverflowAutoProperty = "overflowY";
13588   }
13589   var element = this.GetMainElement().parentNode;
13590   while(element && element.tagName) {
13591    var tagName = element.tagName.toLowerCase();
13592    if(tagName != "tbody") {
13593     element.style.height = "100%";
13594     if(tagName == "form" || tagName == "body" || tagName == "html") {
13595      element.style.margin = "0px";
13596      element.style.padding = "0px";
13597      if(overflowProperty)
13598       element.style[overflowProperty] = "hidden";
13599      if(ASPx.Browser.IE && ASPx.Browser.MajorVersion < 9 && tagName == "form" && oldIEOverflowAutoProperty)
13600       element.style[oldIEOverflowAutoProperty] = "auto";
13601      if((autoHeight != autoWidth || (ASPx.Browser.IE && ASPx.Browser.MajorVersion < 9)) && (tagName == "body" || tagName == "html"))
13602       element.style.overflow = "hidden";
13603     }
13604     if(tagName == "html")
13605      break;
13606    }
13607    element = element.parentNode;
13608   }
13609  }
13610 },
13611 Initialize: function () {
13612  ASPxClientControl.prototype.Initialize.call(this);
13613  this.rootPane.ForEach("CreateContentUrlIFrame", true);
13614  if(ASPx.Browser.TouchUI) 
13615   this.UpdateAutoSizePanes();
13616 },
13617 AfterInitialize: function () {
13618  ASPxClientControl.prototype.AfterInitialize.call(this);
13619  this.SubscribeBrowserFullScreenChangeEvent();
13620  this.rootPane.ForEach("RaiseResizedEvent", true);
13621 },
13622 OnWebkitFullScreenChange: function(e) {
13623  this.inFullscreen = true;
13624  this.rootPane.ForEach('SetVisibleOverflow');
13625 },
13626 SubscribeBrowserFullScreenChangeEvent: function() {
13627  if(ASPx.Browser.Chrome) {
13628   this.webKitFullScreenChangeHandler = this.OnWebkitFullScreenChange.bind(this);
13629   ASPx.Evt.AttachEventToDocument('webkitfullscreenchange', this.webKitFullScreenChangeHandler);
13630  }
13631 },
13632 UnsubscribeFromBrowserFullScreenChangeEvent: function() {
13633  if(this.webKitFullScreenChangeHandler)
13634   ASPx.Evt.DetachEventFromDocument('webkitfullscreenchange', this.webKitFullScreenChangeHandler);
13635 },
13636 IsPrepared: function () {
13637  return this.prepared;
13638 },
13639 Prepare: function () {
13640  if(this.IsPrepared() || !this.IsDisplayed())
13641   return;
13642  this.rootPane.ForEach("Prepare", true);
13643  ASPxClientSplitter.Instances.Add(this);
13644  this.prepared = true;
13645 },
13646 UpdateAdjustmentFlags: function () {
13647  var mainElement = this.GetMainElement();
13648  if(mainElement) {
13649   var mainElementStyle = ASPx.GetCurrentStyle(mainElement);
13650   this.UpdatePercentSizeConfig([mainElementStyle.width, this.width], [mainElementStyle.height, this.height]);
13651  }
13652 },
13653 AdjustControlCore: function () {
13654  this.Prepare();
13655  this.UpdateControlSizes(false, this.isInsideHierarchyAdjustment);
13656 },
13657 NeedCollapseControlCore: function () {
13658  return true;
13659 },
13660 NeedUpdateControlSizes: function () {
13661  return ASPx.IsPercentageSize(this.width) || ASPx.IsPercentageSize(this.height) || !this.sizeUpdatedOnce;
13662 },
13663 UpdateControlSizes: function (forceUpdate, disableControlsAdjustment) {
13664  if(!(forceUpdate || this.NeedUpdateControlSizes()) || !this.IsDisplayed())
13665   return;
13666  var element = this.GetMainElement();
13667  element.style.width = this.width;
13668  element.style.height = this.height;
13669  var focusedElement = ASPx.GetFocusedElement(); 
13670  var savedSelectionStart = null,
13671   savedSelectionEnd = null,
13672   editor = null;
13673  var innerEditorIsFocused = false;
13674  if(window.ASPxClientEdit && !!focusedElement) {
13675   editor = ASPx.GetFocusedEditor();
13676   if(!!editor) {
13677    innerEditorIsFocused = true;
13678    editor.LockFocusEvents(); 
13679    savedSelectionStart = focusedElement.selectionStart;
13680    savedSelectionEnd = focusedElement.selectionEnd;
13681   }
13682  }
13683  if(ASPx.Browser.IE && ASPx.Browser.Version === 9) {  
13684   ASPx.Attr.ChangeStyleAttribute(this.GetMainElement(), "display", "none");
13685   this.UpdatePanesVisible(ASPx.Attr.ChangeStyleAttribute);
13686   ASPx.Attr.RestoreStyleAttribute(this.GetMainElement(), "display");
13687  }
13688  else
13689   this.UpdatePanesVisible(ASPx.Attr.ChangeStyleAttribute);
13690  if(ASPx.Browser.WebKitFamily)
13691   this.CreateWebkitSpecialElement();
13692  var newWidth = ASPx.GetClearClientWidth(element);
13693  var newHeight = ASPx.GetClearClientHeight(element);
13694  this.UpdatePanesVisible(ASPx.Attr.RestoreStyleAttribute);
13695   this.rootPane.offsetWidth = Math.max(newWidth, this.defaultMinSize);
13696   this.rootPane.offsetHeight = Math.max(newHeight, this.defaultMinSize);
13697   this.rootPane.UpdatePanes(true);
13698  try { 
13699   if(focusedElement &&  
13700    !ASPx.Browser.AndroidMobilePlatform && 
13701    !(ASPx.Browser.MacOSMobilePlatform && ASPx.Browser.Version >= 6) && 
13702    ASPx.GetIsParent(element, focusedElement) && 
13703    !(focusedElement.tagName && focusedElement.tagName == "IFRAME")) { 
13704    focusedElement.blur();
13705    focusedElement.focus(); 
13706    if(innerEditorIsFocused) {
13707     focusedElement.selectionStart = savedSelectionStart;
13708     focusedElement.selectionEnd = savedSelectionEnd;
13709    }
13710   }
13711  }
13712  catch (e) { }
13713  this.rootPane.ForEach("ApplyScrollPosition", true);
13714  if(this.isInitialized && !disableControlsAdjustment)
13715   this.rootPane.ForEach("AdjustControls", true);
13716  if(innerEditorIsFocused)
13717   window.setTimeout(editor.UnlockFocusEvents, 0);
13718  if(this.IsPrepared())
13719   this.sizeUpdatedOnce = true;
13720  this.UpdateCookie();
13721 },
13722 UpdateAutoSizePanes: function (forced) {
13723  if(this.hasAutoSizePane) {
13724   var heightChanged = this.UpdateAutoHeightPanes(forced),
13725    widthChanged = this.UpdateAutoWidthPanes(forced);
13726   if(forced || heightChanged || widthChanged)
13727    this.rootPane.ForEach("UpdateChildrenSize");
13728  }
13729 },
13730 UpdateAutoHeightPanes: function (forced) {
13731  var changed = false;
13732  for(var i = 0; i < this.autoHeightPanes.length; i++)
13733   changed = this.autoHeightPanes[i].IsContentHeightChanged() || changed;
13734  if(forced || changed)
13735   this.UpdateAutoSizePanesSizes(false);
13736  return changed;
13737 },
13738 UpdateAutoWidthPanes: function (forced) {
13739  var changed = false;
13740  for(var i = 0; i < this.autoWidthPanes.length; i++)
13741   changed = this.autoWidthPanes[i].IsContentWidthChanged() || changed;
13742  if(forced || changed)
13743   this.UpdateAutoSizePanesSizes(true);
13744  return changed;
13745 },
13746 UpdateAutoSizePanesSizes: function (isVertical) {
13747  var autoSizePanes = isVertical
13748   ? this.autoWidthPanes
13749   : this.autoHeightPanes,
13750   property = isVertical ? "width" : "height",
13751   percentPanes = [];
13752  for(var i = 0; i < autoSizePanes.length; i++) {
13753   var pane = autoSizePanes[i];
13754   if(!pane.helper.HasCollapsedParent()) {
13755    pane.helper.ClearElementSizeProperty(property);
13756    for(var child = pane.panes[0]; child; child = child.nextPane)
13757     if(!child.isSizePx) {
13758      percentPanes.push(child);
13759      child.helper.ClearElementSizeProperty(property);
13760     }
13761   }
13762  }
13763  for(var i = 0; i < autoSizePanes.length; i++)
13764   autoSizePanes[i].UpdateOffsetSize(isVertical);
13765  for(var i = 0; i < autoSizePanes.length; i++) {
13766   var pane = autoSizePanes[i];
13767   if(!pane.helper.HasCollapsedParent())
13768    pane.helper.RestoreElementSizeProperty(property);
13769  }
13770  for(var i = 0; i < percentPanes.length; i++)
13771   percentPanes[i].helper.RestoreElementSizeProperty(property);
13772 },
13773 UpdatePanesVisible: function (func) {
13774  var firstTD = this.rootPane.panes[0].helper.GetPaneElement();
13775  func(firstTD, "width", "1px");
13776  func(firstTD, "height", "1px");
13777  func(this.rootPane.panes[0].helper.GetContentContainerElement(), "display", "none");
13778  for(var i = 1; i < this.rootPane.panes.length; i++) {
13779   var pane = this.rootPane.panes[i];
13780   func(pane.helper.GetPaneElement(), "display", "none");
13781   var separator = pane.helper.GetSeparatorElement();
13782   if(separator)
13783    func(separator, "display", "none");
13784  }
13785 },
13786 UpdateCookie: function () {
13787  if(this.cookieName && this.cookieName != "") {
13788   ASPx.Cookie.DelCookie(this.cookieName);
13789   ASPx.Cookie.SetCookie(this.cookieName, this.GetClientStateString());
13790  }
13791 },
13792 UpdateStateObject: function(){
13793  this.UpdateStateObjectWithObject({ state: this.GetClientStateObject() });
13794 },
13795 GetPaneByPath: function (panePath, parentPane) {
13796  var pane = parentPane || this.rootPane;
13797  for(var i = 0; i < panePath.length; i++)
13798   pane = pane.panes[panePath[i]];
13799  return pane;
13800 },
13801 GetPaneByStringPath: function (paneStringPath, paneIndexSeparator) {
13802  if(!paneIndexSeparator)
13803   paneIndexSeparator = ASPx.ItemIndexSeparator;
13804  return this.GetPaneByPath(paneStringPath.split(paneIndexSeparator));
13805 },
13806 IsDocumentWidthChanged: function () {
13807  var documentWidth = this.GetDocumentWidth();
13808  if(!ASPx.IsExists(this.lastDocumentWidth) || documentWidth != this.lastDocumentWidth) {
13809   this.lastDocumentWidth = documentWidth;
13810   return true;
13811  }
13812  return false;
13813 },
13814 GetDocumentWidth: function () {
13815  if(this.fullScreen && (this.rootPane.autoHeight || this.rootPane.autoWidth))
13816   return this.GetDocumentWidthFullscreen();
13817  return ASPx.GetDocumentWidth();
13818 },
13819 GetDocumentWidthFullscreen: function () {
13820  var sizeElement = ASPx.CacheHelper.GetCachedValue(this, "fullscreenWidthElement", function () {
13821   var element = ASPx.CreateHtmlElementFromString("<div style='width: 100%; height: 0px'></div>");
13822   this.GetMainElement().parentNode.insertBefore(element, this.GetMainElement());
13823   return element;
13824  });
13825  return sizeElement.offsetWidth;
13826 },
13827 CreateWebkitSpecialElement: function () {
13828  var webkitSpecialElement = document.createElement("DIV"),
13829    element = this.GetMainElement();
13830  element.parentNode.appendChild(webkitSpecialElement);
13831  var dummy = element.offsetHeight;
13832  element.parentNode.removeChild(webkitSpecialElement);
13833 },
13834 OnBrowserWindowResize: function() {
13835  if(this.inFullscreen)
13836   window.setTimeout(function() {
13837    this.inFullscreen = false;
13838    this.rootPane.ForEach('ResetOverflow');
13839   }.aspxBind(this), 0);
13840  this.UpdateControlSizes(false, true);
13841  this.lastDocumentWidth = this.GetDocumentWidth();
13842 },
13843 BrowserWindowResizeSubscriber: function() {
13844  return this.widthValueSetInPercentage;
13845 },
13846 OnSeparatorMouseDown: function (moveRightPanePath) {
13847  var pane = this.GetPaneByStringPath(moveRightPanePath);
13848  var invert = this.rtl && !pane.isVertical;
13849  this.moveRightPane = invert ? pane.prevPane : pane;
13850  this.moveLeftPane = invert ? pane : pane.prevPane;
13851  this.moveIsVertical = pane.isVertical;
13852  this.moveStartPos = this.helper.GetCurrentPos();
13853  this.moveLastPos = this.moveStartPos;
13854  this.isHeavyUpdate = this.moveLeftPane.isSizePx != this.moveRightPane.isSizePx
13855   && !this.moveLeftPane.parent.IsAutoSize();
13856  if(!SplitterHelper.IsAllowResize(this.moveLeftPane, this.moveRightPane))
13857   return false;
13858  if(this.moveLeftPane.collapsed || this.moveRightPane.collapsed)
13859   return false;
13860  if(this.RaiseCancelEvent("PaneResizing", this.moveRightPane) || this.RaiseCancelEvent("PaneResizing", this.moveLeftPane))
13861   return false;
13862  var cursor = this.moveIsVertical ? "n-resize" : "w-resize";
13863  if(!this.liveResizing) {
13864   this.resizingPointer.SetCursor(cursor);
13865   this.resizingPointer.AttachToElement(pane.helper.GetSeparatorElement(), true);
13866  }
13867  else
13868   this.isInLiveResizing = true;
13869  this.helper.SetResizingPanelVisibility(true, cursor);
13870  return true;
13871 },
13872 OnSeparatorMouseUp: function () {
13873  this.helper.SetResizingPanelVisibility(false);
13874  if(!this.liveResizing || !this.isHeavyUpdate) {
13875   var deltaSize = this.moveLastPos - this.moveStartPos;
13876   if(!this.moveLeftPane.IsAutoSize(!this.moveLeftPane.isVertical)) {
13877    this.moveLeftPane.SetOffsetSize(this.moveLeftPane.GetOffsetSize() - deltaSize);
13878    this.moveLeftPane.inResizing = true;
13879   }
13880   if(!this.moveRightPane.IsAutoSize(!this.moveRightPane.isVertical)) {
13881    this.moveRightPane.SetOffsetSize(this.moveRightPane.GetOffsetSize() + deltaSize);
13882    this.moveRightPane.inResizing = true;
13883   }
13884   if(!this.liveResizing || !this.hasAutoSizePane)
13885    SplitterHelper.Resize(this.moveLeftPane, this.moveRightPane, deltaSize);
13886   this.moveLeftPane.parent.ForEach("UpdateChildrenSize");
13887  }
13888  if(!this.liveResizing)
13889   this.resizingPointer.SetVisibility(false);
13890  else
13891   this.isInLiveResizing = null;
13892  this.UpdateAutoSizePanes(true);
13893  this.moveLeftPane.parent.ForEach("AdjustControls");
13894  if(!this.liveResizing && (this.rootPane.autoHeight || this.rootPane.autoWidth) && this.IsDocumentWidthChanged())
13895   this.UpdateControlSizes();
13896  this.moveLeftPane.inResizing = null;
13897  this.moveRightPane.inResizing = null;
13898  this.UpdateCookie();
13899  this.RaiseEvent("PaneResizeCompleted", this.moveLeftPane);
13900  this.RaiseEvent("PaneResizeCompleted", this.moveRightPane);
13901 },
13902 OnMouseMove: function () {
13903  var deltaSize = this.helper.GetMoveMaxDeltaSize(this.helper.GetCurrentPos() - this.moveLastPos);
13904  if(deltaSize == 0) return;
13905  if(!this.moveLeftPane.IsAutoSize(!this.moveLeftPane.isVertical) || this.liveResizing)
13906   this.moveLeftPane.SetOffsetSize(this.moveLeftPane.GetOffsetSize() + deltaSize);
13907  if(!this.moveRightPane.IsAutoSize(!this.moveRightPane.isVertical) || this.liveResizing)
13908   this.moveRightPane.SetOffsetSize(this.moveRightPane.GetOffsetSize() - deltaSize);
13909  if(this.liveResizing) {
13910   var changePaneSize = function (pane, deltaSize) {
13911    pane.SetContentVisible(false);
13912    if(pane.ApplyElementSize()) {
13913     pane.ForEach("UpdateChildrenSize");
13914     pane.SetContentVisible(true);
13915     pane.RaiseResizedEvent();
13916    }
13917   };
13918   if(this.isHeavyUpdate || this.moveLeftPane.parent.autoHeight || this.moveLeftPane.parent.autoWidth) {
13919    SplitterHelper.Resize(this.moveLeftPane, this.moveRightPane, this.moveLeftPane.isSizePx || this.moveRightPane.isSizePx ? deltaSize : 0);
13920    this.moveLeftPane.parent.ForEach("UpdateChildrenSize");
13921   }
13922   else {
13923    changePaneSize(this.moveLeftPane, deltaSize, this.helper);
13924    changePaneSize(this.moveRightPane, -deltaSize, this.helper);
13925   }
13926   this.UpdateAutoSizePanes(this.liveResizing);
13927  }
13928  else
13929   this.resizingPointer.Move(deltaSize, !this.moveIsVertical);
13930  this.moveLastPos += deltaSize;
13931 },
13932 OnCollapseButtonClick: function (panePath, forwardDirection) {
13933  var rightPane = this.GetPaneByStringPath(panePath);
13934  var pane1 = forwardDirection ? rightPane.prevPane : rightPane;
13935  var pane2 = forwardDirection ? rightPane : rightPane.prevPane;
13936  if(pane1.collapsed && pane1.maximizedPane == pane2) {
13937   if(!this.RaiseCancelEvent("PaneExpanding", pane1)) {
13938    pane1.Expand();
13939    if(this.savedSize) {
13940     var rootPaneChildren = this.rootPane.panes;
13941     for(var i = 0; i < rootPaneChildren.length; i++) {
13942      if(rootPaneChildren[i].IsCollapsed())
13943       return;
13944     }
13945     for(var sizeProperty in this.savedSize)
13946      if(this.savedSize.hasOwnProperty(sizeProperty))
13947       this.GetMainElement().style[sizeProperty] = this.savedSize[sizeProperty];
13948     this.savedSize = null;
13949    }
13950   }
13951  }
13952  else {
13953   if(!this.RaiseCancelEvent("PaneCollapsing", pane2)) {
13954    if(pane2.NeedResetSplitterSizeOnCollapsing(pane1)) {
13955     if(!this.savedSize)
13956      this.savedSize = {};
13957     var sizeProperty = pane1.isVertical ? "height" : "width";
13958     if(!this.savedSize[sizeProperty]) {
13959      this.savedSize[sizeProperty] = this.GetMainElement().style[sizeProperty];
13960      this.GetMainElement().style[sizeProperty] = "";
13961     }
13962    }
13963    pane2.Collapse(pane1);
13964   }
13965  }
13966 },
13967 IsEmptyUrl: function (url) {
13968  for(var i = 0; i < this.emptyUrls.length; i++)
13969   if(url == this.emptyUrls[i])
13970    return true;
13971  return false;
13972 },
13973 RaiseEvent: function (eventName, pane) {
13974  if(this.isInitialized)
13975   this[eventName].FireEvent(this, new ASPxClientSplitterPaneEventArgs(pane));
13976 },
13977 RaiseCancelEvent: function (eventName, pane) {
13978  var args = new ASPxClientSplitterPaneCancelEventArgs(pane);
13979  this[eventName].FireEvent(this, args);
13980  return args.cancel;
13981 },
13982 GetPaneCount: function () {
13983  return this.rootPane.GetPaneCount();
13984 },
13985 GetPane: function (index) {
13986  return this.rootPane.GetPane(index);
13987 },
13988 GetPaneByName: function (name) {
13989  return this.rootPane.GetPaneByName(name);
13990 },
13991 SetAllowResize: function (allowResize) {
13992  if(this.allowResize == allowResize)
13993   return;
13994  this.allowResize = allowResize;
13995  this.rootPane.ForEach("UpdateSeparatorStyle", true);
13996 },
13997 GetLayoutData: function() {
13998  return this.GetClientStateString();
13999 },
14000 SetWidth: function (width) {
14001  this.width = width + "px";
14002  if(this.IsPrepared())
14003   this.UpdateControlSizes(true);
14004 },
14005 SetHeight: function (height) {
14006  this.height = height + "px";
14007  if(this.IsPrepared())
14008   this.UpdateControlSizes(true);
14009 },
14010 OnDispose: function() {
14011  this.RemoveGlobalLinksToObject();
14012  this.rootPane.ForEach("OnDispose");
14013  if(this.helper)
14014   this.helper.OnDispose();
14015  ASPxClientControl.prototype.OnDispose.call(this);
14016 },
14017 RemoveGlobalLinksToObject: function() {
14018  this.UnsubscribeFromBrowserFullScreenChangeEvent();
14019  if(ASPxClientSplitter.current === this)
14020   ASPxClientSplitter.current = null;
14021 }
14022});
14023ASPxClientSplitter.Cast = ASPxClientControl.Cast;
14024var ASPxClientSplitterPane = ASPx.CreateClass(null, {
14025 constructor: function (splitter, parent, visibleIndex, index, paneInfo) {
14026  this.splitter = splitter;
14027  this.parent = parent;
14028  this.index = visibleIndex;
14029  this._index = index;
14030  this.name = paneInfo.n || "";
14031  this.isRootPane = (this.parent == null);
14032  this.helper = new ASPxSplitterPaneHelper(this);
14033  this.prevPane = null;
14034  this.nextPane = null;
14035  this.panes = [];
14036  this.isVertical = this.isRootPane ? false : !parent.isVertical;
14037  this.hasSeparator = (this.index > 0);
14038  this.collapsed = ASPx.IsExists(paneInfo.c);
14039  this.size = ASPx.IsExists(paneInfo.s) ? paneInfo.s : 0;
14040  this.sizeType = ASPx.IsExists(paneInfo.st) ? paneInfo.st : null;
14041  this.autoWidth = ASPx.IsExists(paneInfo.aw);
14042  this.autoHeight = ASPx.IsExists(paneInfo.ah);
14043  this.maxSize = ASPx.IsExists(paneInfo.smax) ? paneInfo.smax : Number.MAX_VALUE;
14044  this.minSize = ASPx.IsExists(paneInfo.smin) ? paneInfo.smin : this.splitter.defaultMinSize;
14045  this.allowResize = !ASPx.IsExists(paneInfo.nar);
14046  this.showCollapseBackwardButton = ASPx.IsExists(paneInfo.scbb);
14047  this.showCollapseForwardButton = ASPx.IsExists(paneInfo.scfb);
14048  this.iframe = {};
14049  if(paneInfo.iframe) {
14050   this.iframe = {
14051    src: paneInfo.iframe[0],
14052    scrolling: paneInfo.iframe[1]
14053   };
14054   if(paneInfo.iframe[2] != "")
14055    this.iframe.name = paneInfo.iframe[2];
14056   if(paneInfo.iframe[3] != "")
14057    this.iframe.title = paneInfo.iframe[3];
14058   this.isContentUrl = true;
14059  }
14060  this.scrollTop = paneInfo.spt || 0;
14061  this.scrollLeft = paneInfo.spl || 0;
14062  this.isSizePx = (this.sizeType == "px");
14063  this.maximizedPane = null;
14064  this.dragPrevented = false;
14065  this.offsetWidth = 0;
14066  this.offsetHeight = 0;
14067  this.widthDiff = 0;
14068  this.heightDiff = 0;
14069  this.contentContainerWidthDiff = 0;
14070  this.contentContainerHeightDiff = 0;
14071  this.collapsedWidthDiff = 0;
14072  this.collapsedHeightDiff = 0;
14073  this.isASPxClientSplitterPane = true;
14074 },
14075 SetVisibleOverflow: function() {
14076  var element = this.helper.GetContentContainerElement();
14077  if(element)
14078   element.style.overflow = 'visible';
14079 },
14080 ResetOverflow: function() {
14081  var element = this.helper.GetContentContainerElement();
14082  if(element)
14083   element.style.overflow = '';
14084 },
14085 UpdateSize: function () {
14086  if(!this.panes.length) return;
14087  var prcSum = 0,
14088   emptyPanesCount = 0;
14089  for(var pane = this.panes[0]; pane; pane = pane.nextPane) {
14090   if(!pane.sizeType)
14091    emptyPanesCount++;
14092   else if(pane.sizeType == "%")
14093    prcSum += pane.size;
14094  }
14095  if(emptyPanesCount) {
14096   var emptyPaneSize = Math.max(100 - prcSum, 0) / emptyPanesCount;
14097   for(var pane = this.panes[0]; pane; pane = pane.nextPane) {
14098    if(!pane.sizeType) {
14099     pane.sizeType = "%";
14100     pane.size = emptyPaneSize;
14101    }
14102   }
14103  }
14104  if(prcSum && (!emptyPanesCount && prcSum != 100 || prcSum > 100)) {
14105   for(var pane = this.panes[0]; pane; pane = pane.nextPane) {
14106    if(pane.sizeType == "%")
14107     pane.size = 100 * pane.size / prcSum;
14108   }
14109  }
14110 },
14111 UpdateAutoSize: function () {
14112  if(this.panes.length) {
14113   var propertyAll = this.isVertical ? "autoHeight" : "autoWidth",
14114    propertyOne = this.isVertical ? "autoWidth" : "autoHeight";
14115   if(this[propertyAll]) {
14116    for(var pane = this.panes[0]; pane; pane = pane.nextPane) {
14117     pane[propertyAll] = true;
14118    }
14119   }
14120   if(this[propertyOne]) {
14121    var selected;
14122    for(var pane = this.panes[0]; pane; pane = pane.nextPane) {
14123     if(pane[propertyOne] || !pane.isSizePx || pane.isSizePx && !selected && !pane.nextPane)
14124      selected = pane;
14125     if(pane[propertyOne])
14126      break;
14127    }
14128    selected[propertyOne] = true;
14129   }
14130   for(var pane = this.panes[0]; pane; pane = pane.nextPane) {
14131    if(pane.isSizePx)
14132     continue;
14133    if(pane[propertyOne]) {
14134     pane.size = pane.GetMinSize();
14135     pane.sizeType = "px";
14136     pane.isSizePx = true;
14137    }
14138   }
14139  }
14140  if(!this.isRootPane) {
14141   if(this.autoHeight)
14142    this.splitter.autoHeightPanes.push(this);
14143   if(this.autoWidth)
14144    this.splitter.autoWidthPanes.push(this);
14145  }
14146 },
14147 IsAutoSize: function (isVertical) {
14148  if(isVertical == null)
14149   isVertical = this.isVertical;
14150  return isVertical ? this.autoWidth : this.autoHeight;
14151 },
14152 IsContentHeightChanged: function () {
14153  var contentHeight = this.helper.GetContentContainerElement().offsetHeight;
14154  if(!ASPx.IsExists(this.lastContentHeight) || contentHeight != this.lastContentHeight) {
14155   this.lastContentHeight = contentHeight;
14156   return true;
14157  }
14158  return false;
14159 },
14160 IsContentWidthChanged: function () {
14161  var contentWidth = this.helper.GetContentContainerElement().offsetWidth;
14162  if(!ASPx.IsExists(this.lastContentWidth) || contentWidth != this.lastContentWidth) {
14163   this.lastContentWidth = contentWidth;
14164   return true;
14165  }
14166  return false;
14167 },
14168 UpdateOffsetSize: function (isVertical) {
14169  var hasPanes = !!this.panes.length,
14170   contentContainerSizeDiff = hasPanes
14171    ? 0
14172    : isVertical
14173     ? this.widthDiff
14174     : this.heightDiff,
14175    contentSize = 0;
14176  if(this.isContentUrl && !hasPanes) {
14177   var element = this.helper.GetContentContainerElement();
14178   element.style.display = "none";
14179  }
14180  var contentSize = this.GetContentMinSize(isVertical);
14181  this.SetOffsetSize(Math.max(this.GetMinSize(!isVertical), contentSize), !isVertical);
14182  if(this.isContentUrl && !hasPanes) {
14183   var element = this.helper.GetContentContainerElement();
14184   element.style[isVertical ? "width" : "height"] = this.isVertical || isVertical
14185    ? "100%"
14186    : this.helper.GetPaneElement().offsetHeight - contentContainerSizeDiff + "px";
14187   element.style.display = "";
14188  }
14189 },
14190 GetContentMinSize: function (isVertical) {
14191  if(!this.panes.length) {
14192   var contentContainerElement = this.helper.GetContentContainerElement(),
14193    contentContainerSizeDiff = isVertical
14194     ? this.widthDiff
14195     : this.heightDiff;
14196   return (isVertical ? contentContainerElement.offsetWidth : contentContainerElement.offsetHeight) + contentContainerSizeDiff;
14197  }
14198  var contentSize = 0;
14199  if(this.isVertical != isVertical)
14200   for(var pane = this.panes[0]; pane; pane = pane.nextPane)
14201    contentSize = Math.max(contentSize, pane.GetContentMinSize(isVertical));
14202  else {
14203   for(var pane = this.panes[0]; pane; pane = pane.nextPane)
14204    contentSize += pane.GetContentMinSize(isVertical);
14205   contentSize += this.GetTotalSeparatorsSize(!this.isVertical);
14206  }
14207  return contentSize;
14208 },
14209 Initialize: function () {
14210  this.InitializePreventDragging();
14211  if(this.isRootPane)
14212   return;
14213  if(this.collapsed) {
14214   if(this.IsFirstPane())
14215    this.maximizedPane = this.GetNextPane();
14216   else if(this.IsLastPane())
14217    this.maximizedPane = this.GetPrevPane();
14218   else if(this.prevPane.maximizedPane && this.IsFirstPane())
14219    this.maximizedPane = this.prevPane;
14220   else
14221    this.maximizedPane = this.nextPane;
14222   if(this.maximizedPane == null)
14223    this.collapsed = false;
14224  }
14225 },
14226 Prepare: function () {
14227  var EvaluateWidthDiff = function (element) {
14228   return element.offsetWidth - element.clientWidth;
14229  };
14230  var EvaluateHeightDiff = function (element) {
14231   var elementClientHeight = ((ASPx.Browser.Safari && (ASPx.Browser.Version < 4)) || (ASPx.Browser.Chrome && (A
14231SPx.Browser.Version < 2))) ? (element.offsetHeight - element.clientTop * 2) : element.clientHeight;
14232   return element.offsetHeight - elementClientHeight;
14233  };
14234  this.GetSeparatorSize();
14235  var element = this.helper.GetPaneElement();
14236  var b203253_BodyWidthChanged = false;
14237  if(ASPx.Browser.IE && ASPx.Browser.MajorVersion == 9) { 
14238   var b203253_TestWidth = EvaluateWidthDiff(element);
14239   if(b203253_TestWidth > 10000) { 
14240    ASPx.Attr.ChangeStyleAttribute(document.body, "width", "1px");
14241    b203253_BodyWidthChanged = true;
14242   }
14243  }
14244  this.widthDiff = EvaluateWidthDiff(element);
14245  this.heightDiff = EvaluateHeightDiff(element); 
14246  if(this.panes.length == 0) {
14247   var contentContainerElement = this.helper.GetContentContainerElement();
14248   ASPx.SetScrollBarVisibility(contentContainerElement, false);
14249   ASPx.SetStyles(contentContainerElement, { width: 1, height: 1 });
14250   var overflow = contentContainerElement.style.overflowY;
14251   if(ASPx.Browser.Edge) 
14252    contentContainerElement.style.overflowY = '';
14253   this.contentContainerWidthDiff = contentContainerElement.offsetWidth - 1;
14254   this.contentContainerHeightDiff = contentContainerElement.offsetHeight - 1;
14255   if(ASPx.Browser.Edge) 
14256    contentContainerElement.style.overflowY = overflow;
14257   if(this.autoWidth) {
14258    contentContainerElement.style.width = "";
14259    var minWidthValue = this.splitter.defaultMinSize - this.contentContainerWidthDiff;
14260    if(minWidthValue > -1)
14261     contentContainerElement.style.minWidth = minWidthValue + "px";
14262   }
14263   if(this.autoHeight) {
14264    contentContainerElement.style.height = "";
14265    var minHeightValue = this.splitter.defaultMinSize - this.contentContainerWidthDiff;
14266    if(minHeightValue > -1)
14267     contentContainerElement.style.minHeight = minHeightValue + "px";
14268   }
14269   ASPx.SetScrollBarVisibility(contentContainerElement, true);
14270   if(!this.scrollEventAttached) {
14271    var _this = this;
14272    ASPx.Evt.AttachEventToElement(contentContainerElement, "scroll", function () {
14273     if(contentContainerElement.scrollTop >= 0)
14274      _this.scrollTop = contentContainerElement.scrollTop;
14275     if(contentContainerElement.scrollLeft >= 0)
14276      _this.scrollLeft = contentContainerElement.scrollLeft;
14277     _this.splitter.UpdateCookie();
14278    });
14279    this.scrollEventAttached = true;
14280   }
14281  }
14282  this.UpdateStyle(element, true);
14283  this.collapsedWidthDiff = EvaluateWidthDiff(element);
14284  this.collapsedHeightDiff = EvaluateHeightDiff(element);
14285  this.UpdateStyle(element, false);
14286  if(ASPx.Browser.IE && ASPx.Browser.MajorVersion == 9 && b203253_BodyWidthChanged) 
14287   ASPx.Attr.RestoreStyleAttribute(document.body, "width");
14288  var separator = this.helper.GetSeparatorElement();
14289  if(separator) {
14290   ASPx.SetElementDisplay(this.helper.GetSeparatorDivElement(), false);
14291   if(!this.isVertical)
14292    this.separatorSizeDiff = separator.offsetWidth - separator.clientWidth;
14293   else
14294    this.separatorSizeDiff = separator.offsetHeight - separator.clientHeight;
14295   ASPx.SetElementDisplay(this.helper.GetSeparatorDivElement(), true);
14296  }
14297  else
14298   this.separatorSizeDiff = 0;
14299  this.PrepareSeparatorButtons();
14300  if(ASPx.Browser.WebKitTouchUI) {
14301   var contentContainer = this.helper.GetContentContainerElement();
14302   var scrollbarVisible = contentContainer.style.overflow == "auto" || contentContainer.style.overflow == "scroll";
14303   var hScrollbarVisible = scrollbarVisible || contentContainer.style.overflowX == "scroll";
14304   var vScrollbarVisible = scrollbarVisible || contentContainer.style.overflowY == "scroll";
14305   if(hScrollbarVisible || vScrollbarVisible) {
14306    ASPx.TouchUIHelper.MakeScrollable(contentContainer, { showHorizontalScrollbar: hScrollbarVisible, showVerticalScrollbar: vScrollbarVisible });
14307   }
14308  }
14309  if(!this.isRootPane) {
14310   if(this.autoHeight)
14311    this.offsetHeight = this.GetMinSize(true);
14312   if(this.autoWidth)
14313    this.offsetWidth = this.GetMinSize(false);
14314  }
14315 },
14316 PrepareSeparatorButtons: function () {
14317  if(!(this.hasSeparator && this.helper.buttonsExists))
14318   return;
14319  var sizeProperty = this.isVertical ? "offsetWidth" : "offsetHeight";
14320  if(this.helper.buttonsTableExists) {
14321   this.collapseBackwardButtonSize = this.helper.GetButtonUpdateElement(this.helper.GetCollapseBackwardButton())[sizeProperty];
14322   this.collapseForwardButtonSize = this.helper.GetButtonUpdateElement(this.helper.GetCollapseForwardButton())[sizeProperty];
14323   this.buttonsTableDiffSize = this.helper.GetCollapseButtonsTable()[sizeProperty] - this.collapseBackwardButtonSize - this.collapseForwardButtonSize;
14324   if(this.helper.separatorImageExists) {
14325    this.collapseButtonsSeparatorSize = this.helper.GetButtonUpdateElement(this.helper.GetCollapseButtonsSeparator())[sizeProperty];
14326    this.buttonsTableDiffSize -= this.collapseButtonsSeparatorSize;
14327   }
14328  }
14329  else
14330   this.collapseButtonsSeparatorSize = this.helper.GetCollapseButtonsSeparatorImage()[sizeProperty];
14331 },
14332 InitializePreventDragging: function () {
14333  if(!this.dragPrevented && this.helper.separatorImageExists) {
14334   ASPx.Evt.PreventElementDrag(this.helper.GetCollapseButtonsSeparatorImage());
14335   this.dragPrevented = true;
14336  }
14337 },
14338 ApplyScrollPosition: function () {
14339  if(this.panes.length == 0) {
14340   this.SetScrollTop(this.scrollTop);
14341   this.SetScrollLeft(this.scrollLeft);
14342  }
14343 },
14344 ForEach: function (funcName, skippSelf) {
14345  if(!skippSelf)
14346   this[funcName]();
14347  for(var i = 0; i < this.panes.length; i++)
14348   this.panes[i].ForEach(funcName);
14349 },
14350 SetContentVisible: function (visible) {
14351  ASPx.SetElementDisplay(this.helper.GetContentContainerElement(), visible);
14352  if(ASPx.Browser.IE)
14353   this.helper.SetEmptyDivVisible(!visible);
14354 },
14355 AdjustControls: function () {
14356  if(this.panes.length == 0 && !this.collapsed && !this.isContentUrl)
14357   ASPx.GetControlCollection().AdjustControls(this.helper.GetContentContainerElement(), true);
14358 },
14359 UpdatePanes: function (forceAutoSizeUpdate) {
14360  this.ForEach("UpdateVisualElements", true);
14361  this.ForEach("UpdateChildrenSize");
14362  this.splitter.UpdateAutoSizePanes(forceAutoSizeUpdate);
14363 },
14364 UpdateVisualElements: function () {
14365  this.UpdateButtonsVisibility();
14366  this.UpdateSeparatorStyle();
14367  this.UpdatePaneStyle();
14368 },
14369 IsBackwardButtonVisible: function () {
14370  return ASPx.CacheHelper.GetCachedValue(this, "isBackwardButtonVisible", function () {
14371   if(!this.helper.buttonsTableExists)
14372    return false;
14373   if(this.collapsed && (this.maximizedPane == this.prevPane))
14374    return true;
14375   if(this.nextPane && this.collapsed && this.nextPane.collapsed)
14376    return true;
14377   if(this.prevPane.collapsed)
14378    return false;
14379   return this.showCollapseBackwardButton;
14380  }, this.helper);
14381 },
14382 IsForwardButtonVisible: function () {
14383  return ASPx.CacheHelper.GetCachedValue(this, "isForwardButtonVisible", function () {
14384   if(!this.helper.buttonsTableExists)
14385    return false;
14386   if(this.prevPane.collapsed && (this.prevPane.maximizedPane == this))
14387    return true;
14388   if(this.prevPane.collapsed && !this.collapsed)
14389    return true;
14390   if(this.collapsed)
14391    return false;
14392   return this.showCollapseForwardButton;
14393  }, this.helper);
14394 },
14395 DropCachedButtonsVisible: function () {
14396  ASPx.CacheHelper.DropCachedValue(this.helper, "isBackwardButtonVisible");
14397  ASPx.CacheHelper.DropCachedValue(this.helper, "isForwardButtonVisible");
14398 },
14399 UpdateSeparatorStyle: function () {
14400  var separator = this.helper.GetSeparatorElement();
14401  if(!separator) return;
14402  var prevPane = this.prevPane,
14403   isCollapsed = this.collapsed || prevPane && prevPane.collapsed,
14404   resizingEnabled = SplitterHelper.IsAllowResize(this, prevPane);
14405  if(this.splitter.IsStateControllerEnabled())
14406   ASPx.GetStateController().SetMouseStateItemsEnabled(this.helper.GetSeparatorElementId(), null, !isCollapsed && resizingEnabled);
14407  this.UpdateStyle(separator, isCollapsed);
14408 },
14409 UpdatePaneStyle: function () {
14410  this.UpdateStyle(this.helper.GetPaneElement(),
14411   this.collapsed && !this.NeedResetSplitterSizeOnCollapsing(this.maximizedPane) && !this.NeedKeepOffsetSizeOnCollapsing()
14412  );
14413 },
14414 UpdateStyle: function (element, isSelect) {
14415  if(!this.splitter.IsStateControllerEnabled()) return;
14416  if(isSelect)
14417   ASPx.GetStateController().SelectElementBySrcElement(element);
14418  else
14419   ASPx.GetStateController().DeselectElementBySrcElement(element);
14420 },
14421 UpdateButtonsVisibility: function () {
14422  if(!(this.hasSeparator && this.helper.buttonsExists))
14423   return;
14424  var separatorSize = this.GetOffsetSize(!this.isVertical) - this.separatorSizeDiff;
14425  if(this.helper.buttonsTableExists) {
14426   var buttonsSize = this.buttonsTableDiffSize;
14427   if(this.IsBackwardButtonVisible())
14428    buttonsSize += this.collapseBackwardButtonSize;
14429   if(this.IsForwardButtonVisible())
14430    buttonsSize += this.collapseForwardButtonSize;
14431   var buttonsVisible = (buttonsSize <= separatorSize);
14432   var backwardButtonVisible = buttonsVisible && this.IsBackwardButtonVisible();
14433   var forwardButtonVisible = buttonsVisible && this.IsForwardButtonVisible();
14434   ASPx.SetElementDisplay(this.helper.GetButtonUpdateElement(this.helper.GetCollapseBackwardButton()), backwardButtonVisible);
14435   ASPx.SetElementDisplay(this.helper.GetButtonUpdateElement(this.helper.GetCollapseForwardButton()), forwardButtonVisible);
14436   if(this.helper.separatorImageExists) {
14437    if(!buttonsVisible)
14438     buttonsSize = this.buttonsTableDiffSize;
14439    buttonsSize += this.collapseButtonsSeparatorSize;
14440    var separatorImageVisible = this.splitter.showSeparatorImage && (backwardButtonVisible === forwardButtonVisible) && (buttonsSize <= separatorSize);
14441    ASPx.SetElementDisplay(this.helper.GetButtonUpdateElement(this.helper.GetCollapseButtonsSeparator()), separatorImageVisible);
14442   }
14443  }
14444  else {
14445   var separatorImageVisible = this.splitter.showSeparatorImage && (this.collapseButtonsSeparatorSize <= separatorSize);
14446   ASPx.SetElementDisplay(this.helper.GetCollapseButtonsSeparatorImage(), separatorImageVisible);
14447  }
14448 },
14449 GetSeparatorSize: function () {
14450  return ASPx.CacheHelper.GetCachedValue(this, "SeparatorSize", function () {
14451   var separator = this.helper.GetSeparatorElement();
14452   return separator ? (this.isVertical ? separator.offsetHeight : separator.offsetWidth) : 0;
14453  }, this.helper);
14454 },
14455 GetTotalSeparatorsSize: function (isVertical) {
14456  if(!ASPx.IsExists(isVertical) || (isVertical == this.isVertical))
14457   return 0;
14458  var cacheKey = (isVertical ? "v" : "h") + "TotalSeparatorsSize";
14459  return ASPx.CacheHelper.GetCachedValue(this, cacheKey, function () {
14460   var result = 0;
14461   for(var i = 0; i < this.panes.length; i++)
14462    result += this.panes[i].GetSeparatorSize();
14463   return result;
14464  }, this.helper);
14465 },
14466 GetMinSize: function (isVertical) {
14467  if(!ASPx.IsExists(isVertical))
14468   isVertical = this.isVertical;
14469  var cacheKey = (isVertical ? "v" : "h") + "ItemMinSize";
14470  return ASPx.CacheHelper.GetCachedValue(this, cacheKey, function () {
14471   var result = 0;
14472   for(var i = 0; i < this.panes.length; i++)
14473    if(isVertical != this.isVertical)
14474     result += this.panes[i].GetMinSize(isVertical);
14475    else
14476     result = Math.max(result, this.panes[i].GetMinSize(isVertical));
14477   result += this.GetTotalSeparatorsSize(isVertical);
14478   var minSize = (isVertical == this.isVertical) ? this.minSize : this.splitter.defaultMinSize;
14479   result = Math.max(result, Math.max(minSize, this.GetSizeDiff(isVertical)));
14480   return result;
14481  }, this.helper);
14482 },
14483 DropCachedSizes: function () {
14484  ASPx.CacheHelper.DropCachedValue(this.helper, "SeparatorSize");
14485  ASPx.CacheHelper.DropCachedValue(this.helper, "vTotalSeparatorsSize");
14486  ASPx.CacheHelper.DropCachedValue(this.helper, "hTotalSeparatorsSize");
14487  ASPx.CacheHelper.DropCachedValue(this.helper, "ItemMinSize");
14488 },
14489 IsMaxSizeSpecified: function () {
14490  return this.maxSize != Number.MAX_VALUE;
14491 },
14492 GetMaxSize: function () {
14493  return Math.max(this.maxSize, this.GetSizeDiff(this.isVertical));
14494 },
14495 PrepareUpdateInfo: function () {
14496  var updateInfo = {};
14497  var prepareUpdateInfoPart = function () {
14498   return {
14499    panes: [],
14500    sum: 0,
14501    sumMin: 0,
14502    sumMax: 0,
14503    addPane: function () {
14504     this.panes.push(pane);
14505     if(pane.collapsed) {
14506      var sizeDiff = pane.GetSizeDiff(pane.isVertical);
14507      this.sum += sizeDiff;
14508      this.sumMin += sizeDiff;
14509     }
14510     else {
14511      this.sum += pane.size;
14512      this.sumMin += pane.GetMinSize();
14513     }
14514     this.sumMax += pane.GetMaxSize();
14515    },
14516    IsIgnoreMaxSize: function () {
14517     return this.sumMax < this.sum;
14518    }
14519   };
14520  };
14521  updateInfo.px = prepareUpdateInfoPart();
14522  updateInfo.prc = prepareUpdateInfoPart();
14523  updateInfo.collapsed = prepareUpdateInfoPart();
14524  updateInfo.autoSize = prepareUpdateInfoPart();
14525  updateInfo.onlyPxPanes = true; 
14526  updateInfo.hasPxPanesShown = false;
14527  updateInfo.hasPrcPanesShown = false;
14528  for(var i = 0; i < this.panes.length; i++) {
14529   var pane = this.panes[i];
14530   if(pane.collapsed)
14531    updateInfo.collapsed.addPane(pane);
14532   else if(pane.IsAutoSize(this.isVertical) && pane.GetOffsetSize()) {
14533    updateInfo.autoSize.addPane(pane);
14534   }
14535   else if(pane.isSizePx) {
14536    updateInfo.px.addPane(pane);
14537    updateInfo.hasPxPanesShown = true;
14538   }
14539   else {
14540    updateInfo.prc.addPane(pane);
14541    updateInfo.hasPrcPanesShown = true;
14542   }
14543   if(!pane.isSizePx)
14544    updateInfo.onlyPxPanes = false;
14545  }
14546  updateInfo.px.isIgnoreMaxSize = (!updateInfo.hasPrcPanesShown && (updateInfo.px.sumMax < updateInfo.px.sum));
14547  updateInfo.prc.isIgnoreMaxSize = (updateInfo.prc.sumMax < updateInfo.prc.sum);
14548  return updateInfo;
14549 },
14550 SetChildrenSecondSize: function () {
14551  var orientation = this.isVertical;
14552  var size = this.GetClientSize(orientation);
14553  if(this.isRootPane)
14554   for(var pane = this.panes[0]; pane; pane = pane.nextPane) {
14555    if(pane.IsAutoSize(!this.isVertical))
14556     size = Math.max(size, pane.GetOffsetSize(this.isVertical));
14557   }
14558  for(var i = 0; i < this.panes.length; i++)
14559   this.panes[i].SetOffsetSize(size, orientation);
14560 },
14561 GetChildrenTotalSize: function () {
14562  return this.GetClientSize(!this.isVertical) - this.GetTotalSeparatorsSize(!this.isVertical);
14563 },
14564 UpdateChildrenSize: function () {
14565  if(this.collapsed || (this.panes.length == 0))
14566   return;
14567  var updateInfo = this.PrepareUpdateInfo();
14568  var childrenTotalSize = this.GetChildrenTotalSize();
14569  var asTotalSize = 0;
14570  for(var i = 0; i < updateInfo.autoSize.panes.length; i++) {
14571   var pane = updateInfo.autoSize.panes[i];
14572   pane.size = pane.GetOffsetSize();
14573   asTotalSize += pane.size;
14574  }
14575  if(!updateInfo.hasPxPanesShown && !updateInfo.hasPrcPanesShown) {
14576   var asMaxSize = childrenTotalSize - (updateInfo.px.sumMin + updateInfo.prc.sumMin + updateInfo.collapsed.sumMin);
14577   asTotalSize = this.NormalizePanesSizes(updateInfo.autoSize.panes, asTotalSize, asMaxSize);
14578  }
14579  else {
14580   var pxMaxSize = childrenTotalSize - (updateInfo.prc.sumMin + updateInfo.collapsed.sumMin) - asTotalSize,
14581    isOutOfParentSize = !!(pxMaxSize < 0 && updateInfo.autoSize.panes.length);
14582   if(isOutOfParentSize)
14583    pxMaxSize = updateInfo.px.sum;
14584   var pxTotalSize = 0;
14585   if(updateInfo.hasPxPanesShown) {
14586    var c = !updateInfo.hasPrcPanesShown && !isOutOfParentSize && !updateInfo.autoSize.panes.length
14587     ? (pxMaxSize / (updateInfo.px.sum + updateInfo.autoSize.sum))
14588     : 1;
14589    for(var i = 0; i < updateInfo.px.panes.length; i++) {
14590     var pane = updateInfo.px.panes[i];
14591     var newSize = pxMaxSize > 0
14592      ? Math.max(Math.round(pane.size * c), pane.GetMinSize())
14593      : pane.GetMinSize();
14594     if(!updateInfo.px.isIgnoreMaxSize)
14595      newSize = Math.min(newSize, pane.GetMaxSize());
14596     pane.SetOffsetSize(newSize);
14597     pxTotalSize += newSize;
14598    }
14599    if(pxMaxSize > 0 && (!updateInfo.hasPrcPanesShown || (pxTotalSize > pxMaxSize))) {
14600     pxTotalSize = this.NormalizePanesSizes(updateInfo.autoSize.panes, pxTotalSize, pxMaxSize);
14601     pxTotalSize = this.NormalizePanesSizes(updateInfo.px.panes, pxTotalSize, pxMaxSize);
14602    }
14603    if(updateInfo.onlyPxPanes && !(this.IsAutoSize(this.isVertical) && !updateInfo.autoSize.panes.length)) {
14604     for(var i = 0; i < updateInfo.px.panes.length; i++) {
14605      var pane = updateInfo.px.panes[i];
14606      pane.size = pane.GetOffsetSize();
14607     }
14608    }
14609   }
14610   var prcMaxSize = pxMaxSize - pxTotalSize + updateInfo.prc.sumMin;
14611   var prcTotalSize = 0;
14612   if((prcMaxSize > 0) && updateInfo.hasPrcPanesShown) {
14613    var c = 1 / updateInfo.prc.sum;
14614    for(var i = 0; i < updateInfo.prc.panes.length; i++) {
14615     var pane = updateInfo.prc.panes[i];
14616     var newSize = Math.max(Math.round(pane.size * c * (childrenTotalSize - pxTotalSize - asTotalSize)), pane.GetMinSize());
14617     if(!updateInfo.prc.isIgnoreMaxSize)
14618      newSize = Math.min(newSize, pane.GetMaxSize());
14619     pane.SetOffsetSize(newSize);
14620     prcTotalSize += newSize;
14621    }
14622    if(prcTotalSize != prcMaxSize)
14623     prcTotalSize = this.NormalizePanesSizes(updateInfo.prc.panes, prcTotalSize, prcMaxSize);
14624   }
14625  }
14626  for(var i = 0; i < updateInfo.collapsed.panes.length; i++) {
14627   var pane = updateInfo.collapsed.panes[i],
14628    collapsedSize = pane.GetSizeDiff(pane.isVertical);
14629   if(!(ASPx.Browser.IE && pane.NeedKeepOffsetSizeOnCollapsing()))
14630    pane.SetOffsetSize(collapsedSize);
14631  }
14632  if(ASPx.Browser.WebKitFamily && updateInfo.collapsed.panes.length && this.IsAutoSize(this.IsVertical))
14633   this.splitter.CreateWebkitSpecialElement();
14634  this.SetChildrenSecondSize();
14635  for(var i = 0; i < this.panes.length; i++) {
14636   var pane = this.panes[i];
14637   if(pane.collapsed)
14638    pane.SetContentVisible(false);
14639   else
14640    pane.SetContentVisible(true);
14641   if(pane.ApplyElementSize())
14642    pane.RaiseResizedEvent();
14643  }
14644  if(ASPx.Browser.Chrome) { 
14645   for(var i = 0; i < this.panes.length; i++)
14646    this.panes[i].doLessWidth();
14647   var dummy = this.splitter.GetMainElement().offsetWidth;
14648   for(var i = 0; i < this.panes.length; i++)
14649    this.panes[i].restoreWidth();
14650  }
14651  this.ForEach("UpdateButtonsVisibility", true);
14652 },
14653 GetPossibleUp: function () {
14654  if(this.inResizing)
14655   return -1;
14656  return this.GetMaxSize() - this.GetOffsetSize();
14657 },
14658 GetPossibleDown: function () {
14659  if(this.IsAutoSize(!this.isVertical) && !(this.panes.length && !this.helper.HasVisibleAutoSizeChildren(!this.isVertical)))
14660   return -1;
14661  if(this.inResizing)
14662   return -1;
14663  return this.GetOffsetSize() - this.GetMinSize();
14664 },
14665 NormalizePanesSizes: function (panes, size, maxSize) {
14666  var insufficientSize = Math.round(maxSize) - size;
14667  var changeStep = (insufficientSize > 0) ? 1 : -1;
14668  var possibleChangeFunction = (insufficientSize > 0) ? "GetPossibleUp" : "GetPossibleDown";
14669  var changed = true;
14670  while((Math.floor(insufficientSize) != 0) && changed) {
14671   changed = false;
14672   for(var i = 0; i < panes.length; i++) {
14673    var pane = panes[i];
14674    if(pane[possibleChangeFunction]() > 0) {
14675     pane.SetOffsetSize(pane.GetOffsetSize() + changeStep);
14676     insufficientSize -= changeStep;
14677     changed = true;
14678     if(insufficientSize == 0)
14679      break;
14680    }
14681   }
14682  }
14683  return maxSize - insufficientSize;
14684 },
14685 GetOffsetSize: function (isVertical) {
14686  if(!ASPx.IsExists(isVertical))
14687   isVertical = this.isVertical;
14688  return isVertical ? this.offsetHeight : this.offsetWidth;
14689 },
14690 GetClientSize: function (isVertical) {
14691  return isVertical ? this.GetClientHeightInternal(true) : this.GetClientWidthInternal(true);
14692 },
14693 SetOffsetSize: function (value, isVertical) {
14694  if(!ASPx.IsExists(isVertical))
14695   isVertical = this.isVertical;
14696  if(isVertical)
14697   this.offsetHeight = value;
14698  else
14699   this.offsetWidth = value;
14700 },
14701 GetSizeDiff: function (isVertical) {
14702  return isVertical ? this.GetHeightDiff(true) : this.GetWidthDiff(true);
14703 },
14704 GetWidthDiff: function (isContainer) {
14705  if(this.collapsed)
14706   return this.collapsedWidthDiff;
14707  return this.widthDiff + (isContainer ? this.contentContainerWidthDiff : 0);
14708 },
14709 GetHeightDiff: function (isContainer) {
14710  if(this.collapsed)
14711   return this.collapsedHeightDiff;
14712  return this.heightDiff + (isContainer ? this.contentContainerHeightDiff : 0);
14713 },
14714 GetClientWidthInternal: function (isContainer) {
14715  if(ASPx.Browser.Firefox && this.autoWidth)
14716   return this.offsetWidth;
14717  return this.offsetWidth - this.GetWidthDiff(isContainer);
14718 },
14719 GetClientHeightInternal: function (isContainer) {
14720  if(ASPx.Browser.Firefox && this.autoHeight)
14721   return this.offsetHeight - (isContainer ? 0 : ASPx.GetVerticalBordersWidth(this.GetElement()));
14722  return this.offsetHeight - this.GetHeightDiff(isContainer);
14723 },
14724 ApplyElementSize: function () {
14725  if(this.IsSizeChanged()) {
14726   this.ApplyElementSizeCore();
14727   var contentContainerElement = this.helper.GetContentContainerElement();
14728   if(ASPx.Browser.Chrome && ASPx.Browser.MajorVersion >= 3
14729     || ASPx.Browser.Safari && ASPx.Browser.MajorVersion >= 5) {
14730    var marginRight = ASPx.PxToInt(contentContainerElement.style.marginRight);
14731    marginRight -= ASPx.PxToInt(ASPx.GetCurrentStyle(contentContainerElement).marginRight);
14732    contentContainerElement.style.marginRight = marginRight + "px";
14733   }
14734   if(ASPx.Browser.WebKitFamily)
14735    this.splitter.CreateWebkitSpecialElement(); 
14736   return true;
14737  }
14738  return false;
14739 },
14740 ApplyElementSizeCore: function () {
14741  var paneWidth = this.GetClientWidthInternal(false);
14742  var paneHeight = this.GetClientHeightInternal(false);
14743  var contentContainerWidth = this.GetClientWidthInternal(true);
14744  var contentContainerHeight = this.GetClientHeightInternal(true);
14745  if(contentContainerWidth < 0) {
14746   paneWidth -= contentContainerWidth;
14747   contentContainerWidth = 0;
14748  }
14749  if(contentContainerHeight < 0) {
14750   paneHeight -= contentContainerHeight;
14751   contentContainerHeight = 0;
14752  }
14753  var paneElement = this.helper.GetPaneElement(),
14754   contentContainerElement = this.helper.GetContentContainerElement();
14755  if(!isNaN(paneWidth) && !(paneWidth === 0 && !this.collapsed))
14756   paneElement.style.width = paneWidth + "px";
14757  if(!isNaN(paneHeight) && !(paneHeight === 0 && !this.collapsed))
14758   paneElement.style.height = paneHeight + "px";
14759  if(!this.autoWidth && !isNaN(contentContainerWidth))
14760   contentContainerElement.style.width = contentContainerWidth + "px";
14761  if(!this.autoHeight && !isNaN(contentContainerHeight))
14762   contentContainerElement.style.height = contentContainerHeight + "px";
14763 },
14764 IsSizeChanged: function () {
14765  if(!ASPx.IsExists(this.lastWidth) || !ASPx.IsExists(this.lastHeight) ||
14766   (this.offsetWidth != this.lastWidth) || (this.offsetHeight != this.lastHeight)) {
14767   this.lastWidth = this.offsetWidth;
14768   this.lastHeight = this.offsetHeight;
14769   return true;
14770  }
14771  return false;
14772 },
14773 doLessWidth: function() {
14774  var scrollBarWidth = 17;
14775  var contentContainerElement = this.helper.GetContentContainerElement();
14776  if(!this.collapsed && !this.autoWidth && contentContainerElement) {
14777   contentContainerElement.dxWidth = contentContainerElement.style.width;
14778   contentContainerElement.style.width = ASPx.PxToInt(contentContainerElement.style.width) - scrollBarWidth + "px";
14779  }
14780 },
14781 restoreWidth: function() {
14782  var contentContainerElement = this.helper.GetContentContainerElement();
14783  if(!this.collapsed && !this.autoWidth && contentContainerElement) {
14784   contentContainerElement.style.width = contentContainerElement.dxWidth;
14785   contentContainerElement.dxWidth = undefined;
14786  }
14787 },
14788 GetSplitter: function () {
14789  return this.splitter;
14790 },
14791 GetParentPane: function () {
14792  return this.parent;
14793 },
14794 GetPrevPane: function () {
14795  return this.prevPane;
14796 },
14797 GetNextPane: function () {
14798  return this.nextPane;
14799 },
14800 IsFirstPane: function () {
14801  return (this.prevPane == null);
14802 },
14803 IsLastPane: function () {
14804  return (this.nextPane == null);
14805 },
14806 IsVertical: function () {
14807  return this.isVertical;
14808 },
14809 GetPaneCount: function () {
14810  return this.panes.length;
14811 },
14812 GetPane: function (index) {
14813  return (0 <= index && index < this.panes.length) ? this.panes[index] : null;
14814 },
14815 GetPaneByName: function (name) {
14816  for(var i = 0; i < this.panes.length; i++)
14817   if(this.panes[i].name == name) return this.panes[i];
14818  for(var i = 0; i < this.panes.length; i++) {
14819   var pane = this.panes[i].GetPaneByName(name);
14820   if(pane != null) return pane;
14821  }
14822  return null;
14823 },
14824 GetClientWidth: function () {
14825  var clientWidth = this.GetClientWidthInternal(true);
14826  if(!this.IsContentUrlPane()) {
14827   var contentContainer = this.helper.GetContentContainerElement();
14828   if((contentContainer.style.overflow == "auto" && contentContainer.scrollHeight > contentContainer.clientHeight)
14829     || contentContainer.style.overflow == "scroll"
14830     || contentContainer.style.overflowY == "scroll") {
14831    clientWidth = clientWidth - ASPx.GetVerticalScrollBarWidth();
14832   }
14833  }
14834  return clientWidth;
14835 },
14836 GetClientHeight: function () {
14837  return this.GetClientHeightInternal(true);
14838 },
14839 Collapse: function (maximizedPane) {
14840  if(!this.splitter.IsPrepared())
14841   return false;
14842  if(this.collapsed)
14843   return false;
14844  if(!ASPx.IsExists(maximizedPane) || !maximizedPane.isASPxClientSplitterPane)
14845   return false;
14846  return this.CollapseExpandCore(true, maximizedPane, "PaneCollapsed");
14847 },
14848 CollapseForward: function () {
14849  return this.Collapse(this.prevPane);
14850 },
14851 CollapseBackward: function () {
14852  return this.Collapse(this.nextPane);
14853 },
14854 Expand: function () {
14855  if(!this.splitter.IsPrepared())
14856   return false;
14857  if(!this.collapsed)
14858   return false;
14859  return this.CollapseExpandCore(false, null, "PaneExpanded");
14860 },
14861 CollapseExpandCore: function (collapsed, maximizedPane, eventName) {
14862  this.collapsed = collapsed;
14863  this.maximizedPane = maximizedPane;
14864  this.DropCachedButtonsVisible();
14865  if(this.nextPane != null)
14866   this.nextPane.DropCachedButtonsVisible();
14867  this.GetParentPane().UpdatePanes(!collapsed);
14868  this.GetParentPane().ForEach("AdjustControls");
14869  this.splitter.RaiseEvent(eventName, this);
14870  this.splitter.UpdateCookie();
14871  return true;
14872 },
14873 IsCollapsed: function () {
14874  return this.collapsed;
14875 },
14876 NeedResetSplitterSizeOnCollapsing: function (maximizedPane) {
14877  return maximizedPane.IsMaxSizeSpecified() && maximizedPane.GetParentPane().isRootPane;
14878 },
14879 NeedKeepOffsetSizeOnCollapsing: function () {
14880  return this.maximizedPane.IsMaxSizeSpecified() && !this.GetParentPane().isRootPane && this.GetParentPane().GetPaneCount() == 2;
14881 },
14882 IsContentUrlPane: function () {
14883  return this.isContentUrl;
14884 },
14885 GetContentUrl: function () {
14886  return this.isContentUrl
14887   ? this.iframeObj.GetContentUrl()
14888   : "";
14889 },
14890 SetContentUrl: function (url, preventBrowserCaching) {
14891  if(!this.isContentUrl)
14892   return;
14893  this.iframeObj.SetContentUrl(url, preventBrowserCaching);
14894 },
14895 RefreshContentUrl: function () {
14896  if(!this.isContentUrl)
14897   return;
14898  this.iframeObj.RefreshContentUrl();
14899 },
14900 GetContentIFrame: function () {
14901  return this.isContentUrl
14902   ? this.helper.GetContentContainerElement()
14903   : null;
14904 },
14905 CreateContentUrlIFrame: function () {
14906  if(!this.isContentUrl)
14907   return;
14908  var contentContainer = this.helper.GetContentContainerElement();
14909  contentContainer.parentNode.removeChild(contentContainer);
14910  this.iframeObj = new ASPx.IFrameHelper({
14911   id: contentContainer.id,
14912   name: this.iframe.name,
14913   title: this.iframe.title,
14914   scrolling: this.iframe.scrolling,
14915   src: this.iframe.src,
14916   onCreate: function (containerElement, element) {
14917    element.className = "dxsplIF";
14918    this.helper.GetPaneElement().appendChild(containerElement);
14919    this.helper.DropContentContainerElementFromCache();
14920    this.ApplyElementSizeCore();
14921    if(this.autoHeight && this.isVertical)
14922     containerElement.style.height = "100%";
14923   }.aspxBind(this),
14924   onLoad: function () {
14925    this.splitter.RaiseEvent("PaneContentUrlLoaded", this);
14926   }.aspxBind(this)
14927  });
14928 },
14929 SetAllowResize: function (allowResize) {
14930  this.allowResize = allowResize;
14931  this.UpdateSeparatorStyle();
14932  if(!this.IsLastPane())
14933   this.nextPane.UpdateSeparatorStyle();
14934 },
14935 RaiseResizedEvent: function () {
14936  this.splitter.RaiseEvent("PaneResized", this);
14937 },
14938 GetElement: function () {
14939  return this.helper.GetPaneElement();
14940 },
14941 SetSize: function (size) {
14942  if(!this.splitter.IsPrepared())
14943   return;
14944  if(this.SetSizeCore(size)) {
14945   this.parent.ForEach("UpdateChildrenSize");
14946   this.splitter.UpdateAutoSizePanes();
14947   this.parent.ForEach("AdjustControls");
14948   this.splitter.UpdateCookie();
14949  }
14950 },
14951 GetSize: function () {
14952  return this.size + this.sizeType;
14953 },
14954 SetSizeCore: function (size) {
14955  if(!ASPx.IsExists(size))
14956   return false;
14957  if(this.IsAutoSize(!this.isVertical))
14958   return false;
14959  if(typeof (size) == "string") {
14960   var parsedSize = parseInt(size);
14961   if(isNaN(parsedSize))
14962    return false;
14963   this.size = parsedSize;
14964   this.sizeType = ASPx.IsPercentageSize(size) ? "%" : "px";
14965  }
14966  else if(typeof (size) == "number") {
14967   this.size = size;
14968   this.sizeType = "px";
14969  }
14970  else
14971   return false;
14972  this.isSizePx = this.sizeType == "px";
14973  return true;
14974 },
14975 GetScrollTop: function () {
14976  return this.scrollTop;
14977 },
14978 SetScrollTop: function (value) {
14979  this.helper.GetContentContainerElement().scrollTop = value;
14980 },
14981 GetScrollLeft: function () {
14982  return this.scrollLeft;
14983 },
14984 SetScrollLeft: function (value) {
14985  this.helper.GetContentContainerElement().scrollLeft = value;
14986 },
14987 OnDispose: function() {
14988  if(this.helper != null)
14989   this.helper.OnDispose();
14990  this.splitter = null;
14991  this.helper = null;
14992 }
14993});
14994ASPxClientSplitter.Instances = {
14995 items: {},
14996 Add: function(instance) {
14997  var name = instance.name;
14998  if(ASPx.IsExists(this.items[name]))
14999   this.Remove(name);
15000  this.items[name] = instance;
15001  if(instance.hasAutoSizePane)
15002   ASPxClientSplitter.AutoSizePanesUpdater.Start();
15003 },
15004 Get: function (name) {
15005  var instance = this.items[name];
15006  if(instance) {
15007   if(instance.GetMainElement())
15008    return instance;
15009   delete this.items[name];
15010  }
15011  return null;
15012 },
15013 Each: function (cb) {
15014  var hasInstances = false;
15015  for(var name in this.items) {
15016   if(this.items.hasOwnProperty(name)) {
15017    var instance = this.Get(name);
15018    if(instance) {
15019     hasInstances = true;
15020     cb.call(instance);
15021    }
15022   }
15023  }
15024  return hasInstances;
15025 },
15026 Remove: function(name) {
15027  if(!this.items[name]) return;
15028  this.items[name].OnDispose();
15029  try {
15030   delete this.items[name];
15031  } catch(e) { }
15032 }
15033};
15034ASPxClientSplitter.AutoSizePanesUpdater = {
15035 timeoutId: -1,
15036 Start: function () {
15037  var updater = ASPxClientSplitter.AutoSizePanesUpdater;
15038  if(updater.timeoutId > -1)
15039   return;
15040  updater.timeoutId = window.setTimeout(updater.OnTimeout, 300);
15041 },
15042 Stop: function () {
15043  var updater = ASPxClientSplitter.AutoSizePanesUpdater;
15044  updater.timeoutId = ASPx.Timer.ClearTimer(updater.timeoutId);
15045 },
15046 OnTimeout: function () {
15047  var updater = ASPxClientSplitter.AutoSizePanesUpdater;
15048  updater.Stop();
15049  var hasZoom = false;
15050  if(window.devicePixelRatio && window.devicePixelRatio != 1)
15051   hasZoom = true;
15052  if(ASPxClientSplitter.Instances.Each(function () {
15053   if(hasZoom) 
15054    return;
15055   this.UpdateAutoSizePanes();
15056   if(!this.isInLiveResizing && this.hasAutoSizePane && this.IsDocumentWidthChanged())
15057    this.UpdateControlSizes();
15058  }))
15059   updater.Start();
15060 }
15061};
15062ASPxClientSplitter.timerInterval = 0;
15063ASPxClientSplitter.GetRegEx = function (idPostfix) {
15064 if(!this.regExs)
15065  this.regExs = {};
15066 if(!this.regExs[idPostfix])
15067  this.regExs[idPostfix] = "_\\d+(" + ASPx.ItemIndexSeparator + "\\d+)*_" + idPostfix + "$";
15068 return this.regExs[idPostfix];
15069};
15070ASPxClientSplitter.SaveCurrentPos = function (evt) {
15071 evt = ASPx.Evt.GetEvent(evt);
15072 ASPxClientSplitter.CurrentXPos = ASPx.Evt.GetEventX(evt);
15073 ASPxClientSplitter.CurrentYPos = ASPx.Evt.GetEventY(evt);
15074};
15075ASPxClientSplitter.FindParentCell = function (element) {
15076 if(element.tagName != "TD")
15077  element = ASPx.GetParentByTagName(element, "TD");
15078 return element;
15079};
15080ASPxClientSplitter.FindSplitterInfo = function (evt, regex, suffixLength) {
15081 var element = ASPxClientSplitter.FindParentCell(ASPx.Evt.GetEventSource(evt));
15082 if(element) {
15083  var matchResult = element.id.match(regex);
15084  if(matchResult) {
15085   var name = element.id.substring(0, matchResult.index);
15086   var splitter = ASPxClientSplitter.Instances.Get(name);
15087   if(splitter != null) {
15088    var panePath = element.id.substring(matchResult.index + 1, element.id.length - suffixLength);
15089    return { "splitter": splitter, "panePath": panePath };
15090   }
15091  }
15092 }
15093 return null;
15094};
15095ASPxClientSplitter.OnMouseClick = function (evt) {
15096 var info = ASPxClientSplitter.FindSplitterInfo(evt, ASPxClientSplitter.GetRegEx("S_CF"), 5);
15097 if(info) {
15098  if(info.splitter.enabled)
15099   info.splitter.OnCollapseButtonClick(info.panePath, true);
15100 }
15101 else {
15102  info = ASPxClientSplitter.FindSplitterInfo(evt, ASPxClientSplitter.GetRegEx("S_CB"), 5);
15103  if(info && info.splitter.enabled)
15104   info.splitter.OnCollapseButtonClick(info.panePath, false);
15105 }
15106};
15107ASPxClientSplitter.OnMouseDown = function (evt) {
15108 var info = ASPxClientSplitter.FindSplitterInfo(evt, ASPxClientSplitter.GetRegEx("S"), 2);
15109 if(!info)
15110  info = ASPxClientSplitter.FindSplitterInfo(evt, ASPxClientSplitter.GetRegEx("S_CS"), 5);
15111 if(info && info.splitter) {
15112  ASPxClientSplitter.current = info.splitter;
15113  ASPxClientSplitter.SaveCurrentPos(evt);
15114  ASPx.Selection.SetElementSelectionEnabled(ASPxClientSplitter.current.GetMainElement(), false);
15115  ASPxClientSplitter.isInMove = info.splitter.OnSeparatorMouseDown(info.panePath);
15116  ASPx.Evt.PreventEvent(evt);
15117 }
15118};
15119ASPxClientSplitter.OnMouseUp = function () {
15120 if(ASPxClientSplitter.isInMove) {
15121  ASPxClientSplitter.isInMove = false;
15122  ASPx.Selection.SetElementSelectionEnabled(ASPxClientSplitter.current.GetMainElement(), true);
15123  ASPxClientSplitter.current.OnSeparatorMouseUp();
15124 }
15125};
15126ASPxClientSplitter.mouseMoveTimeoutId = -1;
15127ASPxClientSplitter.SuspendedMouseMove = function () {
15128 if(ASPxClientSplitter.isInMove)
15129  ASPxClientSplitter.current.OnMouseMove();
15130 ASPxClientSplitter.mouseMoveTimeoutId = ASPx.Timer.ClearTimer(ASPxClientSplitter.mouseMoveTimeoutId);
15131};
15132ASPxClientSplitter.OnMouseMove = function (evt) {
15133 if(ASPx.Browser.WebKitTouchUI && ASPx.TouchUIHelper.isGesture)
15134  return;
15135 if(!ASPxClientSplitter.isInMove)
15136  return;
15137 if(ASPx.Browser.IE && !ASPx.Evt.IsLeftButtonPressed(evt)) {
15138  ASPxClientSplitter.OnMouseUp(evt);
15139  return;
15140 }
15141 ASPxClientSplitter.SaveCurrentPos(evt);
15142 if(ASPxClientSplitter.mouseMoveTimeoutId == -1)
15143  ASPxClientSplitter.mouseMoveTimeoutId = window.setTimeout(ASPxClientSplitter.SuspendedMouseMove, ASPxClientSplitter.timerInterval);
15144 if(ASPx.Browser.WebKitTouchUI)
15145  evt.preventDefault();
15146};
15147ASPx.Evt.AttachEventToDocument("click", ASPxClientSplitter.OnMouseClick);
15148ASPx.Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseDownEventName, ASPxClientSplitter.OnMouseDown);
15149ASPx.Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseUpEventName, ASPxClientSplitter.OnMouseUp);
15150ASPx.Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseMoveEventName, ASPxClientSplitter.OnMouseMove);
15151var ASPxClientSplitterPaneEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
15152 constructor: function (pane) {
15153  this.constructor.prototype.constructor.call(this, pane);
15154  this.pane = pane;
15155 }
15156});
15157var ASPxClientSplitterPaneCancelEventArgs = ASPx.CreateClass(ASPxClientSplitterPaneEventArgs, {
15158 constructor: function (pane) {
15159  this.constructor.prototype.constructor.call(this, pane);
15160  this.cancel = false;
15161 }
15162});
15163window.ASPxClientSplitter = ASPxClientSplitter;
15164window.ASPxClientSplitterPane = ASPxClientSplitterPane;
15165window.ASPxClientSplitterPaneEventArgs = ASPxClientSplitterPaneEventArgs;
15166window.ASPxClientSplitterPaneCancelEventArgs = ASPxClientSplitterPaneCancelEventArgs;
15167})();
15168(function () {
15169var PopupUtils = {
15170 NotSetAlignIndicator: "NotSet",
15171 InnerAlignIndicator: "Sides",
15172 OutsideLeftAlignIndicator: "OutsideLeft",
15173 LeftSidesAlignIndicator: "LeftSides",
15174 RightSidesAlignIndicator: "RightSides",
15175 OutsideRightAlignIndicator: "OutsideRight",
15176 CenterAlignIndicator: "Center",
15177 AboveAlignIndicator: "Above",
15178 TopSidesAlignIndicator: "TopSides",
15179 MiddleAlignIndicator: "Middle",
15180 BottomSidesAlignIndicator: "BottomSides",
15181 BelowAlignIndicator: "Below",
15182 WindowCenterAlignIndicator: "WindowCenter",
15183 LeftAlignIndicator: "Left",
15184 RightAlignIndicator: "Right",
15185 TopAlignIndicator: "Top",
15186 BottomAlignIndicator: "Bottom",
15187 WindowLeftAlignIndicator: "WindowLeft",
15188 WindowRightAlignIndicator: "WindowRight",
15189 WindowTopAlignIndicator: "WindowTop",
15190 WindowBottomAlignIndicator: "WindowBottom",
15191 IsAlignNotSet: function (align) {
15192  return align == PopupUtils.NotSetAlignIndicator;
15193 },
15194 IsInnerAlign: function (align) {
15195  return align.indexOf(PopupUtils.InnerAlignIndicator) != -1;
15196 },
15197 IsRightSidesAlign: function(align) {
15198  return align == PopupUtils.RightSidesAlignIndicator;
15199 },
15200 IsOutsideRightAlign: function(align) {
15201  return align == PopupUtils.OutsideRightAlignIndicator;
15202 },
15203 IsCenterAlign: function(align) {
15204  return align == PopupUtils.CenterAlignIndicator;
15205 },
15206 FindPopupElementById: function (id) {
15207  if(id == "")
15208   return null; 
15209  var popupElement = ASPx.GetElementById(id);
15210  if(!ASPx.IsExistsElement(popupElement)) {
15211   var idParts = id.split("_");
15212   var uniqueId = idParts.join("$");
15213   popupElement = ASPx.GetElementById(uniqueId);
15214  }
15215  return popupElement;
15216 },
15217 FindEventSourceParentByTestFunc: function (evt, testFunc) {
15218  return ASPx.GetParent(ASPx.Evt.GetEventSource(evt), testFunc);
15219 },
15220 PreventContextMenu: function (evt) {
15221  if(evt.stopPropagation)
15222   evt.stopPropagation();
15223  if(evt.preventDefault)
15224   evt.preventDefault();
15225  if(ASPx.Browser.WebKitFamily)
15226   evt.returnValue = false;
15227 },
15228 GetDocumentClientWidthForPopup: function () {
15229  return ASPx.Browser.WebKitTouchUI ? ASPx.GetDocumentWidth() : ASPx.GetDocumentClientWidth(); 
15230 },
15231 GetDocumentClientHeightForPopup: function() {
15232  return ASPx.Browser.WebKitTouchUI ? ASPx.GetDocumentHeight() : ASPx.GetDocumentClientHeight(); 
15233 },
15234 AdjustPositionToClientScreen: function (element, pos, rtl, isX) {
15235  var min = isX ? ASPx.GetDocumentScrollLeft() : ASPx.GetDocumentScrollTop(),
15236   viewPortWidth = ASPx.Browser.WebKitTouchUI ? window.innerWidth : ASPx.GetDocumentClientWidth(),
15237   max = min + (isX ? viewPortWidth : ASPx.GetDocumentClientHeight());
15238  max -= (isX ? element.offsetWidth : element.offsetHeight);
15239  if(rtl) {
15240   if(pos < min) pos = min;
15241   if(pos > max) pos = max;
15242  } else {
15243   if(pos > max) pos = max;
15244   if(pos < min) pos = min;
15245  }
15246  return pos;
15247 },
15248 GetPopupAbsoluteX: function(element, popupElement, hAlign, hOffset, x, left, rtl, isPopupFullCorrectionOn) {
15249  return PopupUtils.getPopupAbsolutePos(element, popupElement, hAlign, hOffset, x, left, rtl, isPopupFullCorrectionOn, false, true);
15250 },
15251 GetPopupAbsoluteY: function (element, popupElement, vAlign, vOffset, y, top, isPopupFullCorrectionOn, ignoreAlignWithoutScrollReserve) {
15252  return PopupUtils.getPopupAbsolutePos(element, popupElement, vAlign, vOffset, y, top, false, isPopupFullCorrectionOn, ignoreAlignWithoutScrollReserve, false);
15253 },
15254 getPopupAbsolutePos: function(element, popupElement, align, offset, startPos, startPosInit, rtl, isPopupFullCorrectionOn, ignoreAlignWithoutScrollReserve, isHorizontal) {
15255  var calculator = getPositionCalculator();
15256  calculator.applyParams(element, popupElement, align, offset, startPos, startPosInit, rtl, isPopupFullCorrectionOn, ignoreAlignWithoutScrollReserve, isHorizontal);
15257  var position = calculator.getPopupAbsolutePos();
15258  calculator.disposeState();
15259  return position;
15260 },
15261 RemoveFocus: function (parent) {
15262  var div = document.createElement('div');
15263  div.tabIndex = "-1";
15264  PopupUtils.ConcealDivElement(div);
15265  parent.appendChild(div);
15266  if(ASPx.IsFocusable(div))
15267   div.focus();
15268  ASPx.RemoveElement(div);
15269 },
15270 ConcealDivElement: function (div) {
15271  div.style.position = "absolute";
15272  div.style.left = 0;
15273  div.style.top = 0;
15274  if(ASPx.Browser.WebKitFamily) {
15275   div.style.opacity = 0;
15276   div.style.width = 1;
15277   div.style.height = 1;
15278  } else {
15279   div.style.border = 0;
15280   div.style.width = 0;
15281   div.style.height = 0;
15282  }
15283 },
15284 InitAnimationProperties: function(element, onAnimStopCallString) {
15285  element.popuping = true;
15286  element.onAnimStopCallString = onAnimStopCallString;
15287 },
15288 InitAnimationDiv: function (element, x, y, onAnimStopCallString, skipSizeInit) {
15289  PopupUtils.InitAnimationProperties(element, onAnimStopCallString);
15290  PopupUtils.InitAnimationDivCore(element);
15291  if(!skipSizeInit)
15292   ASPx.SetStyles(element, { width: element.offsetWidth, height: element.offsetHeight });
15293  ASPx.SetStyles(element, { left: x, top: y });
15294 },
15295 InitAnimationDivCore: function (element) {
15296  ASPx.SetStyles(element, {
15297   overflow: "hidden",
15298   position: "absolute"
15299  });
15300 },
15301 StartSlideAnimation: function (animationDivElement, element, iframeElement, duration, preventChangingWidth, preventChangingHeight) {
15302  if(iframeElement) {
15303   var endLeft = ASPx.PxToInt(iframeElement.style.left);
15304   var endTop = ASPx.PxToInt(iframeElement.style.top);
15305   var startLeft = ASPx.PxToInt(element.style.left) < 0 ? endLeft : animationDivElement.offsetLeft + animationDivElement.offsetWidth;
15306   var startTop = ASPx.PxToInt(element.style.top) < 0 ? endTop : animationDivElement.offsetTop + animationDivElement.offsetHeight;
15307   var properties = {
15308    left: { from: startLeft, to: endLeft, unit: "px" },
15309    top: { from: startTop, to: endTop, unit: "px" }
15310   };
15311   if(!preventChangingWidth)
15312    properties.width = { to: element.offsetWidth, unit: "px" };
15313   if(!preventChangingHeight)
15314    properties.height = { to: element.offsetHeight, unit: "px" };
15315   ASPx.AnimationHelper.createMultipleAnimationTransition(iframeElement, {
15316    duration: duration
15317   }).Start(properties);
15318  }
15319  ASPx.AnimationHelper.createMultipleAnimationTransition(element, {
15320   duration: duration,
15321   onComplete: function () { PopupUtils.AnimationFinished(animationDivElement, element); }
15322  }).Start({
15323   left: { to: 0, unit: "px" },
15324   top: { to: 0, unit: "px" }
15325  });
15326 },
15327 AnimationFinished: function (animationDivElement, element) {
15328  if(PopupUtils.StopAnimation(animationDivElement, element) && ASPx.IsExists(animationDivElement.onAnimStopCallString) &&
15329   animationDivElement.onAnimStopCallString !== "") {
15330   window.setTimeout(animationDivElement.onAnimStopCallString, 0);
15331  }
15332 },
15333 StopAnimation: function (animationDivElement, element) {
15334  if(animationDivElement.popuping) {
15335   ASPx.AnimationHelper.cancelAnimation(element);
15336   animationDivElement.popuping = false;
15337   animationDivElement.style.overflow = "visible";
15338   return true;
15339  }
15340  return false;
15341 },
15342 GetAnimationHorizontalDirection: function (popupPosition, horizontalAlign, verticalAlign, rtl) {
15343  if(PopupUtils.IsInnerAlign(horizontalAlign)
15344   && !PopupUtils.IsInnerAlign(verticalAlign)
15345   && !PopupUtils.IsAlignNotSet(verticalAlign))
15346   return 0;
15347  var toTheLeft = (horizontalAlign == PopupUtils.OutsideLeftAlignIndicator || horizontalAlign == PopupUtils.RightSidesAlignIndicator || (horizontalAlign == PopupUtils.NotSetAlignIndicator && rtl)) ^ popupPosition.isInverted;
15348  return toTheLeft ? 1 : -1;
15349 },
15350 GetAnimationVerticalDirection: function (popupPosition, horizontalAlign, verticalAlign) {
15351  if(PopupUtils.IsInnerAlign(verticalAlign)
15352   && !PopupUtils.IsInnerAlign(horizontalAlign)
15353   && !PopupUtils.IsAlignNotSet(horizontalAlign))
15354   return 0;
15355  var toTheTop = (verticalAlign == PopupUtils.AboveAlignIndicator || verticalAlign == PopupUtils.BottomSidesAlignIndicator) ^ popupPosition.isInverted;
15356  return toTheTop ? 1 : -1;
15357 },
15358 IsVerticalScrollExists: function () {
15359  var scrollIsNotHidden = ASPx.GetCurrentStyle(document.body).overflowY !== "hidden" && ASPx.GetCurrentStyle(document.documentElement).overflowY !== "hidden";
15360  return (scrollIsNotHidden && ASPx.GetDocumentHeight() > ASPx.GetDocumentClientHeight());
15361 },
15362 CoordinatesInDocumentRect: function (x, y) {
15363  var docScrollLeft = ASPx.GetDocumentScrollLeft();
15364  var docScrollTop = ASPx.GetDocumentScrollTop();
15365  return (x > docScrollLeft && y > docScrollTop &&
15366   x < ASPx.GetDocumentClientWidth() + docScrollLeft &&
15367   y < ASPx.GetDocumentClientHeight() + docScrollTop);
15368 },
15369 GetElementZIndexArray: function (element) {
15370  var currentElement = element;
15371  var zIndexesArray = [0];
15372  while(currentElement && currentElement.tagName != "BODY") {
15373   if(currentElement.style) {
15374    if(typeof (currentElement.style.zIndex) != "undefined" && currentElement.style.zIndex != "")
15375     zIndexesArray.unshift(currentElement.style.zIndex);
15376   }
15377   currentElement = currentElement.parentNode;
15378  }
15379  return zIndexesArray;
15380 },
15381 IsHigher: function (higherZIndexArrat, zIndexArray) {
15382  if(zIndexArray == null) return true;
15383  var count = (higherZIndexArrat.length >= zIndexArray.length) ? higherZIndexArrat.length : zIndexArray.length;
15384  for(var i = 0; i < count; i++)
15385   if(typeof (higherZIndexArrat[i]) != "undefined" && typeof (zIndexArray[i]) != "undefined") {
15386    var higherZIndexArrayCurrentElement = parseInt(higherZIndexArrat[i].toString());
15387    var zIndexArrayCurrentElement = parseInt(zIndexArray[i].toString());
15388    if(higherZIndexArrayCurrentElement != zIndexArrayCurrentElement)
15389     return higherZIndexArrayCurrentElement > zIndexArrayCurrentElement;
15390   } else return typeof (zIndexArray[i]) == "undefined";
15391  return true;
15392 },
15393 TestIsPopupElement: function (element) {
15394  return !!element.DXPopupElementControl;
15395 },
15396 adjustViewportScrollWrapper: function(wrapper, wrapperScroll, windowElement) {
15397  var document = wrapper.ownerDocument;
15398  var window = document.defaultView || document.parentWindow;
15399  var isWindowElementDisplayed = ASPx.IsElementDisplayed(windowElement);
15400  if(!isWindowElementDisplayed) {
15401   wrapper.style.cssText = "";
15402   wrapperScroll.style.cssText = "";
15403   return; 
15404  }
15405  var windowRect = windowElement.getBoundingClientRect();
15406  var yAxis = this.calculateViewPortScrollDataByAxis(wrapper.style.top, windowRect.top, windowElement.offsetHeight, window.innerHeight, wrapper.scrollTop);
15407  var xAxis = this.calculateViewPortScrollDataByAxis(wrapper.style.left, windowRect.left, windowElement.offsetWidth, window.innerWidth, wrapper.scrollLeft);
15408  this.prepareViewPortScrollData(xAxis, yAxis);
15409  ASPx.SetStyles(windowElement, {
15410   top: yAxis.windowOffset,
15411   left: xAxis.windowOffset
15412  });
15413  ASPx.SetStyles(wrapper, {
15414   width: xAxis.wrapperSize,
15415   height: yAxis.wrapperSize,
15416   position: "absolute",
15417   overflow: ASPx.Browser.MobileUI ? "scroll" : "auto",
15418   zIndex: windowElement.style.zIndex
15419  });
15420  ASPx.SetAbsoluteX(wrapper, ASPx.GetDocumentScrollLeft());
15421  ASPx.SetAbsoluteY(wrapper, ASPx.GetDocumentScrollTop());
15422  ASPx.SetStyles(wrapperScroll, {
15423   width: xAxis.wrapperScrollSize,
15424   height: yAxis.wrapperScrollSize,
15425   position: "absolute",
15426   overflow: "hidden"
15427  });
15428  wrapper.scrollLeft = xAxis.scrollSize;
15429  wrapper.scrollTop = yAxis.scrollSize;
15430 },
15431 calculateViewPortScrollDataByAxis: function(wrapperOffsetStyle, windowOffset, windowSize, viewPortSize, scrollSize) {
15432  var isWindowOffsetNegative = windowOffset < 0;
15433  windowOffset = isWindowOffsetNegative ? 0 : windowOffset;
15434  var wrapperScrollSize = Math.max(viewPortSize + Math.abs(Math.min(0, windowOffset)), windowSize + Math.abs(windowOffset));
15435  return { 
15436   windowOffset: isWindowOffsetNegative ? 0 : windowOffset,
15437   wrapperSize: viewPortSize,
15438   wrapperScrollSize: wrapperScrollSize,
15439   scrollSize: isWindowOffsetNegative ? scrollSize + Math.abs(windowOffset) : 0,
15440   hasScroll: wrapperScrollSize > viewPortSize
15441  };
15442 },
15443 prepareViewPortScrollData: function(xAxis, yAxis) {
15444  var scrollBarSize = ASPx.GetVerticalScrollBarWidth();
15445  if(yAxis.hasScroll && !xAxis.hasScroll) {
15446   xAxis.wrapperScrollSize = Math.min(xAxis.wrapperSize - scrollBarSize, xAxis.wrapperScrollSize);
15447  } else if(xAxis.hasScroll && !yAxis.hasScroll) {
15448   yAxis.wrapperScrollSize = Math.min(yAxis.wrapperSize - scrollBarSize, yAxis.wrapperScrollSize);
15449  } else if(yAxis.hasScroll && xAxis.hasScroll) {
15450   yAxis.wrapperScrollSize -= scrollBarSize;
15451   xAxis.wrapperScrollSize -= scrollBarSize;
15452  }
15453 }
15454};
15455PopupUtils.OverControl = {
15456 GetPopupElementByEvt: function (evt) {
15457  return PopupUtils.FindEventSourceParentByTestFunc(evt, PopupUtils.TestIsPopupElement);
15458 },
15459 OnMouseEvent: function (evt, mouseOver) {
15460  var popupElement = PopupUtils.OverControl.GetPopupElementByEvt(evt);
15461  if(mouseOver)
15462   popupElement.DXPopupElementControl.OnPopupElementMouseOver(evt, popupElement);
15463  else
15464   popupElement.DXPopupElementControl.OnPopupElementMouseOut(evt, popupElement);
15465 },
15466 OnMouseOut: function (evt) {
15467  PopupUtils.OverControl.OnMouseEvent(evt, false);
15468 },
15469 OnMouseOver: function (evt) {
15470  PopupUtils.OverControl.OnMouseEvent(evt, true);
15471 }
15472};
15473PopupUtils.BodyScrollHelper = (function () {
15474 var windowScrollLock = {},
15475  windowScroll = {},
15476  hideScrollbarsClassName = "dxpc-hideScrollbars";
15477 function lockWindowScroll(windowId) {
15478  windowScrollLock[windowId] = true;
15479 }
15480 function unlockWindowScroll(windowId) {
15481  delete windowScrollLock[windowId];
15482 }
15483 function isLocked(windowId) {
15484  return !!windowScrollLock[windowId];
15485 }
15486 function isAnyWindowScrollLocked() {
15487  for(var key in windowScrollLock) 
15488   if (windowScrollLock.hasOwnProperty(key) && windowScrollLock[key] === true)
15489    return true;
15490  return false;
15491 }
15492 function replaceVerticalScrollByMargin() {
15493  var currentBodyStyle = ASPx.GetCurrentStyle(document.body),
15494   marginWidth = ASPx.GetVerticalScrollBarWidth() + ASPx.PxToInt(currentBodyStyle.paddingRight);
15495  ASPx.Attr.ChangeStyleAttribute(document.body, "padding-right", marginWidth + "px");
15496 }
15497 function restoreBodyScroll(windowId) {
15498  unlockWindowScroll(windowId);
15499  if(isAnyWindowScrollLocked())
15500   return;
15501  if(ASPx.Browser.IE) {
15502   ASPx.Attr.RestoreAttribute(document.body, "scroll");
15503   ASPx.Attr.RestoreStyleAttribute(document.documentElement, "overflow");
15504  } else if(ASPx.Browser.WebKitTouchUI) {
15505   ASPx.Attr.RestoreStyleAttribute(document.body, "position");
15506   ASPx.Attr.RestoreStyleAttribute(document.body, "height");
15507   ASPx.Attr.RestoreStyleAttribute(document.body, "margin");
15508   ASPx.RemoveClassNameFromElement(document.documentElement, hideScrollbarsClassName);
15509   ASPx.Attr.RestoreStyleAttribute(document.body, "overflow");
15510   var currentWindowScroll = windowScroll[windowId];
15511   if(!!currentWindowScroll)
15512    window.scrollTo(currentWindowScroll.x, currentWindowScroll.y);
15513  } else
15514   ASPx.Attr.RestoreStyleAttribute(document.documentElement, "overflow");
15515  if(ASPx.Browser.Chrome)
15516   var dummy = document.documentElement.scrollTop; 
15517  ASPx.Attr.RestoreStyleAttribute(document.body, "padding-right");
15518  ASPx.Attr.RestoreStyleAttribute(document.body, "height");
15519  ASPx.Attr.RestoreStyleAttribute(document.body, "width");
15520 }
15521 return {
15522  RestoreIfLocked: function(windowId) {
15523   if(isLocked(windowId))
15524    restoreBodyScroll(windowId);
15525  },
15526  HideBodyScroll: function(windowId) {
15527   if(isAnyWindowScrollLocked()) { 
15528    lockWindowScroll(windowId);
15529    return;
15530   }
15531   lockWindowScroll(windowId);
15532   if(PopupUtils.IsVerticalScrollExists())
15533    replaceVerticalScrollByMargin();
15534   if(ASPx.Browser.IE) {
15535    ASPx.Attr.ChangeAttribute(document.body, "scroll", "no");
15536    ASPx.Attr.ChangeStyleAttribute(document.documentElement, "overflow", "hidden");
15537   } else if(ASPx.Browser.WebKitTouchUI) {
15538    windowScroll[windowId] = { 
15539     x: window.scrollX,
15540     y: window.scrollY
15541    };
15542    ASPx.Attr.ChangeStyleAttribute(document.body, "overflow", "hidden");
15543    ASPx.Attr.ChangeStyleAttribute(document.body, "position", "relative");
15544    ASPx.Attr.ChangeStyleAttribute(document.body, "height", "100%");
15545    ASPx.Attr.ChangeStyleAttribute(document.body, "margin", "0");
15546    ASPx.AddClassNameToElement(document.documentElement, hideScrollbarsClassName);
15547   } else {
15548    ASPx.Attr.ChangeStyleAttribute(document.documentElement, "overflow", "hidden");
15549    var documentHeight = ASPx.GetDocumentHeight();
15550    var documentWidth = ASPx.GetDocumentWidth();
15551    if(window.pageYOffset > 0 && ASPx.PxToInt(window.getComputedStyle(document.body, null)) != documentHeight)
15552     ASPx.Attr.ChangeStyleAttribute(document.body, "height", documentHeight + "px");
15553    if(window.pageXOffset > 0 && ASPx.PxToInt(window.getComputedStyle(document.body, null)) != documentWidth)
15554     ASPx.Attr.ChangeStyleAttribute(document.body, "width", documentWidth + "px");
15555   }
15556  },
15557  RestoreBodyScroll: restoreBodyScroll
15558 };
15559})();
15560var PositionAlignConsts = {
15561 NOT_SET: 0,
15562 OUTSIDE_START: 1,
15563 NEAR_BOUND_START: 2,
15564 INNER_START: 3,
15565 CENTER: 4,
15566 INNER_END: 5,
15567 NEAR_BOUND_END: 6,
15568 OUTSIDE_END: 7,
15569 WINDOW_CENTER: 8,
15570 WINDOW_START: 9,
15571 WINDOW_END: 10
15572};
15573var AlignIndicatorTable = {};
15574var PositionCalculator = ASPx.CreateClass(null, {
15575 constructor: function() {
15576  this.element = null;
15577  this.popupElement = null;
15578  this.align = 0;
15579  this.offset = 0;
15580  this.startPos = 0;
15581  this.startPosInit = 0;
15582  this.rtl = false;
15583  this.isPopupFullCorrectionOn = false;
15584  this.isHorizontal = true;
15585  this.size = 0;
15586  this.bodySize = 0;
15587  this.actualBodySize = 0;
15588  this.elementStartPos = 0;
15589  this.scrollStartPos = 0;
15590  this.isInverted = false;
15591  this.popupElementSize = 0;
15592  this.boundStartPos = 0;
15593  this.boundEndPos = 0;
15594  this.innerBoundStartPos = 0;
15595  this.innerBoundEndPos = 0;
15596  this.isMoreFreeSpaceLeft = false;
15597  this.nearBoundOverlapRate = 0.25;
15598  this.functionsTable = {};
15599  this.initializeFunctionsTable();
15600 },
15601 applyParams: function(element, popupElement, align, offset, startPos, startPosInit, rtl, isPopupFullCorrectionOn, ignoreAlignWithoutScrollReserve, isHorizontal) {
15602  this.isHorizontal = isHorizontal;
15603  this.element = element;
15604  this.popupElement = popupElement;
15605  this.align = this.getAlignValueFromIndicator(align);
15606  this.offset = offset;
15607  this.startPos = startPos;
15608  this.startPosInit = startPosInit;
15609  this.rtl = rtl;
15610  this.isPopupFullCorrectionOn = isPopupFullCorrectionOn;
15611  this.ignoreAlignWithoutScrollReserve = ignoreAlignWithoutScrollReserve;
15612  this.calculateParams();
15613 },
15614 disposeState: function() {
15615  this.element = null;
15616  this.popupElement = null;
15617 },
15618 getPopupAbsolutePos: function() {
15619  if(this.isWindowAlign()) {
15620   var showAtPos = this.startPos != ASPx.InvalidPosition && !this.popupElement;
15621   if(showAtPos)
15622    this.align = PositionAlignConsts.NOT_SET;
15623   else
15624    return this.getWindowAlignPos();
15625  }
15626  if(this.popupElement)
15627   this.calculatePopupElement();
15628  else
15629   this.align = PositionAlignConsts.NOT_SET;
15630  return this.getPopupAbsolutePosCore();
15631 },
15632 initializeFunctionsTable: function() {
15633  var table = this.functionsTable;
15634  table[PositionAlignConsts.NOT_SET] = this.calculateNotSet;
15635  table[PositionAlignConsts.OUTSIDE_START] = this.calculateOutsideStart;
15636  table[PositionAlignConsts.INNER_START] = this.calculateInnerStart;
15637  table[PositionAlignConsts.CENTER] = this.calculateCenter;
15638  table[PositionAlignConsts.INNER_END] = this.calculateInnerEnd;
15639  table[PositionAlignConsts.OUTSIDE_END] = this.calculateOutsideEnd;
15640  table[PositionAlignConsts.NEAR_BOUND_START] = this.calculateNearBoundStart;
15641  table[PositionAlignConsts.NEAR_BOUND_END] = this.calculateNearBoundEnd;
15642  table[PositionAlignConsts.WINDOW_CENTER] = this.calculateWindowCenter;
15643  table[PositionAlignConsts.WINDOW_START] = this.calculateWindowStart;
15644  table[PositionAlignConsts.WINDOW_END] = this.calculateWindowEnd;
15645 },
15646 calculateParams: function() {
15647  this.size = this.getElementSize();
15648  if(this.isHorizontal) {
15649   this.bodySize = ASPx.GetDocumentClientWidth();
15650   this.elementStartPos = ASPx.GetAbsoluteX(this.popupElement);
15651   this.scrollStartPos = ASPx.GetDocumentScrollLeft();
15652  }
15653  else {
15654   this.bodySize = ASPx.GetDocumentClientHeight();
15655   this.elementStartPos = ASPx.GetAbsoluteY(this.popupElement);
15656   this.scrollStartPos = ASPx.GetDocumentScrollTop();
15657  }
15658 },
15659 isWindowAlign: function() {
15660  return this.align == PositionAlignConsts.WINDOW_CENTER || this.align == PositionAlignConsts.WINDOW_START ||
15661   this.align == PositionAlignConsts.WINDOW_END;
15662 },
15663 getWindowAlignPos: function() {
15664  this.actualBodySize = ASPx.Browser.WebKitTouchUI ? this.getWindowInnerSize() : this.bodySize;
15665  return this.getPopupAbsolutePosCore();
15666 },
15667 getPopupAbsolutePosCore: function() {
15668  var calculationFunc = this.functionsTable[this.align];
15669  calculationFunc.call(this);
15670  return new ASPx.PopupPosition(this.startPos, this.isInverted);
15671 },
15672 calculateWindowCenter: function() {
15673  this.startPos = Math.max(Math.ceil(this.actualBodySize / 2 - this.size / 2), 0) + this.scrollStartPos + this.offset;
15674 },
15675 calculateWindowStart: function() {
15676  this.startPos = this.scrollStartPos + this.offset;
15677 },
15678 calculateWindowEnd: function() {
15679  this.startPos = this.scrollStartPos + this.actualBodySize - this.size + this.offset;
15680 },
15681 calculatePopupElement: function() {
15682  this.popupElementSize = this.getPopupElementSize();
15683  this.boundStartPos = this.elementStartPos - this.size;
15684  this.boundEndPos = this.elementStartPos + this.popupElementSize;
15685  this.innerBoundStartPos = this.elementStartPos;
15686  this.innerBoundEndPos = this.elementStartPos + this.popupElementSize - this.size;
15687  var hasLeftScrollReserve = this.boundStartPos >= 0;
15688  this.isMoreFreeSpaceLeft = (this.bodySize - (this.boundEndPos + this.size) < this.boundStartPos - 2 * this.scrollStartPos) && (!this.ignoreAlignWithoutScrollReserve || hasLeftScrollReserve);
15689 },
15690 calculateOutsideStart: function() {
15691  this.isInverted = this.isPopupFullCorrectionOn && (!(this.boundStartPos - this.scrollStartPos > 0 || this.isMoreFreeSpaceLeft));
15692  if(this.isInverted)
15693   this.startPos = this.boundEndPos - this.offset;
15694  else
15695   this.startPos = this.boundStartPos + this.offset;
15696 },
15697 calculateInnerStart: function() {
15698  this.startPos = this.innerBoundStartPos + this.offset;
15699  if(this.isPopupFullCorrectionOn)
15700   this.startPos = PopupUtils.AdjustPositionToClientScreen(this.element, this.startPos, this.rtl, this.isHorizontal);
15701 },
15702 calculateCenter: function() {
15703  this.startPos = this.elementStartPos + Math.round((this.popupElementSize - this.size) / 2) + this.offset;
15704 },
15705 calculateInnerEnd: function() {
15706  this.startPos = this.innerBoundEndPos + this.offset;
15707  if(this.isPopupFullCorrectionOn)
15708   this.startPos = PopupUtils.AdjustPositionToClientScreen(this.element, this.startPos, this.rtl, this.isHorizontal);
15709 },
15710 calculateOutsideEnd: function() {
15711  this.isInverted = this.isPopupFullCorrectionOn && (!(this.boundEndPos + this.size < this.bodySize + this.scrollStartPos || !this.isMoreFreeSpaceLeft));
15712  if(this.isInverted)
15713   this.startPos = this.boundStartPos - this.offset;
15714  else
15715   this.startPos = this.boundEndPos + this.offset;
15716 },
15717 calculateNotSet: function() {
15718  if(this.rtl)
15719   this.calculateNotSetRightToLeft();
15720  else
15721   this.calculateNotSetLeftToRight();
15722 },
15723 calculateNotSetLeftToRight: function() {
15724  if(!ASPx.IsValidPosition(this.startPos)) {
15725   if(this.popupElement)
15726    this.startPos = this.elementStartPos;
15727   else if(this.offset)
15728    this.startPos = 0;
15729   else
15730    this.startPos = this.startPosInit;
15731  }
15732  this.isInverted = this.isPopupFullCorrectionOn && (this.startPos - this.scrollStartPos + this.size > this.bodySize && this.startPos - this.scrollStartPos > this.bodySize / 2);
15733  if(this.isInverted)
15734   this.startPos = this.startPos - this.size - this.offset;
15735  else
15736   this.startPos = this.startPos + this.offset;
15737 },
15738 calculateNotSetRightToLeft: function() {
15739  if(!ASPx.IsValidPosition(this.startPos)) {
15740   if(this.popupElement)
15741    this.startPos = this.innerBoundEndPos;
15742   else if(this.offset)
15743    this.startPos = 0;
15744   else
15745    this.startPos = this.startPosInit;
15746  }
15747  else
15748   this.startPos -= this.size;
15749  this.isInverted = this.isPopupFullCorrectionOn && (this.startPos < this.scrollStartPos && this.startPos - this.scrollStartPos < this.bodySize / 2);
15750  if(this.isInverted)
15751   this.startPos = this.startPos + this.size + this.offset;
15752  else
15753   this.startPos = this.startPos - this.offset;
15754 },
15755 calculateNearBoundStart: function() {
15756  this.startPos = this.boundStartPos + this.offset + this.size * this.nearBoundOverlapRate;
15757  if(this.isPopupFullCorrectionOn)
15758   this.startPos = PopupUtils.AdjustPositionToClientScreen(this.element, this.startPos, this.rtl, this.isHorizontal);
15759 },
15760 calculateNearBoundEnd: function() {
15761  this.startPos = this.boundEndPos + this.offset - this.size * this.nearBoundOverlapRate;
15762  if(this.isPopupFullCorrectionOn)
15763   this.startPos = PopupUtils.AdjustPositionToClientScreen(this.element, this.startPos, this.rtl, this.isHorizontal);
15764 },
15765 getAlignValueFromIndicator: function(alignIndicator) {
15766  var alignValue = AlignIndicatorTable[alignIndicator];
15767  if(alignValue === undefined)
15768   throw "Incorrect align indicator.";
15769  return alignValue;
15770 },
15771 getElementSize: function() {
15772  return this.getCustomElementSize(this.element);
15773 },
15774 getPopupElementSize: function() {
15775  return this.getCustomElementSize(this.popupElement);
15776 },
15777 getCustomElementSize: function(customElement) {
15778  return this.isHorizontal ? customElement.offsetWidth : customElement.offsetHeight;
15779 },
15780 getWindowInnerSize: function() {
15781  return this.isHorizontal ? window.innerWidth : window.innerHeight;
15782 }
15783});
15784var positionCalculator = null;
15785function getPositionCalculator() {
15786 if(positionCalculator == null)
15787  positionCalculator = new PositionCalculator();
15788 return positionCalculator;
15789}
15790function initializeAlignIndicatorTable() {
15791 AlignIndicatorTable[PopupUtils.NotSetAlignIndicator] = PositionAlignConsts.NOT_SET;
15792 AlignIndicatorTable[PopupUtils.OutsideLeftAlignIndicator] = PositionAlignConsts.OUT
15792SIDE_START;
15793 AlignIndicatorTable[PopupUtils.AboveAlignIndicator] = PositionAlignConsts.OUTSIDE_START;
15794 AlignIndicatorTable[PopupUtils.LeftAlignIndicator] = PositionAlignConsts.NEAR_BOUND_START;
15795 AlignIndicatorTable[PopupUtils.TopAlignIndicator] = PositionAlignConsts.NEAR_BOUND_START;
15796 AlignIndicatorTable[PopupUtils.LeftSidesAlignIndicator] = PositionAlignConsts.INNER_START;
15797 AlignIndicatorTable[PopupUtils.TopSidesAlignIndicator] = PositionAlignConsts.INNER_START;
15798 AlignIndicatorTable[PopupUtils.CenterAlignIndicator] = PositionAlignConsts.CENTER;
15799 AlignIndicatorTable[PopupUtils.MiddleAlignIndicator] = PositionAlignConsts.CENTER;
15800 AlignIndicatorTable[PopupUtils.RightSidesAlignIndicator] = PositionAlignConsts.INNER_END;
15801 AlignIndicatorTable[PopupUtils.BottomSidesAlignIndicator] = PositionAlignConsts.INNER_END;
15802 AlignIndicatorTable[PopupUtils.RightAlignIndicator] = PositionAlignConsts.NEAR_BOUND_END;
15803 AlignIndicatorTable[PopupUtils.BottomAlignIndicator] = PositionAlignConsts.NEAR_BOUND_END;
15804 AlignIndicatorTable[PopupUtils.OutsideRightAlignIndicator] = PositionAlignConsts.OUTSIDE_END;
15805 AlignIndicatorTable[PopupUtils.BelowAlignIndicator] = PositionAlignConsts.OUTSIDE_END;
15806 AlignIndicatorTable[PopupUtils.WindowCenterAlignIndicator] = PositionAlignConsts.WINDOW_CENTER;
15807 AlignIndicatorTable[PopupUtils.WindowLeftAlignIndicator] = PositionAlignConsts.WINDOW_START;
15808 AlignIndicatorTable[PopupUtils.WindowTopAlignIndicator] = PositionAlignConsts.WINDOW_START;
15809 AlignIndicatorTable[PopupUtils.WindowRightAlignIndicator] = PositionAlignConsts.WINDOW_END;
15810 AlignIndicatorTable[PopupUtils.WindowBottomAlignIndicator] = PositionAlignConsts.WINDOW_END;
15811}
15812initializeAlignIndicatorTable();
15813ASPx.PopupPosition = function(position, isInverted) {
15814 this.position = position;
15815 this.isInverted = isInverted;
15816};
15817ASPx.PopupSize = function(width, height) {
15818 this.width = width;
15819 this.height = height;
15820};
15821ASPx.PopupUtils = PopupUtils;
15822})();
15823(function() {
15824ASPx.PCWIdSuffix = "_PW";
15825var popupControlZIndex = 11998;
15826var defaultZIndexFromServer = "10000";
15827var ModalAlign = {
15828 WindowLeft: "WindowLeft",
15829 WindowCenter: "WindowCenter",
15830 WindowRight: "WindowRight",
15831 WindowTop: "WindowTop",
15832 WindowBottom: "WindowBottom"
15833};
15834function PCResizeCursorInfo(horizontalDirection, verticalDirection, horizontalOffset, verticalOffset) {
15835 this.horizontalDirection = horizontalDirection;
15836 this.verticalDirection = verticalDirection;
15837 this.horizontalOffset = horizontalOffset;
15838 this.verticalOffset = verticalOffset;
15839 this.course = verticalDirection + horizontalDirection;
15840}
15841var PopupControlCssClasses = {};
15842PopupControlCssClasses.Prefix = "dxpc-";
15843PopupControlCssClasses.SizeGripLiteCssClassName = PopupControlCssClasses.Prefix + "sizeGrip";
15844PopupControlCssClasses.LinkCssClassName = PopupControlCssClasses.Prefix + "link";
15845PopupControlCssClasses.ShadowLiteCssClassName = PopupControlCssClasses.Prefix + "shadow";
15846PopupControlCssClasses.MainDivLiteCssClass = PopupControlCssClasses.Prefix + "mainDiv";
15847PopupControlCssClasses.ContentWrapperCssClassName = PopupControlCssClasses.Prefix + "contentWrapper";
15848PopupControlCssClasses.ContentCssClassName = PopupControlCssClasses.Prefix + "content";
15849PopupControlCssClasses.HeaderContentCssClassName = PopupControlCssClasses.Prefix + "headerContent";
15850PopupControlCssClasses.WindowWrapperCssClassName = PopupControlCssClasses.Prefix + "win-wrapper";
15851PopupControlCssClasses.WindowWrapperScrollCssClassName = PopupControlCssClasses.WindowWrapperCssClassName + "-scroll";
15852PopupControlCssClasses.HeaderCssClassName = "dxpc-header";
15853var LoadContentViaCallback = {
15854 Default: "Default",
15855 OnFirstShow: "OnFirstShow",
15856 OnPageLoad: "OnPageLoad"
15857};
15858var constants = {
15859 DEFAULT_WINDOW_WIDTH: 200,
15860 DEFAULT_WINDOW_HEIGHT: 0
15861};
15862var ASPxClientPopupControlBase = ASPx.CreateClass(ASPxClientControl, {
15863 constructor: function(name) {
15864  this.constructor.prototype.constructor.call(this, name);
15865  this.leadingAfterInitCall = ASPxClientControl.LeadingAfterInitCallConsts.Direct; 
15866  this.adjustInnerControlsSizeOnShow = true;
15867  this.shadowVisible = true;
15868  this.cookieName = "";
15869  this.popupAnimationType = "none";
15870  this.closeAnimationType = "none";
15871  this.closeAction = "OuterMouseClick";
15872  this.isPopupFullCorrectionOn = true;
15873  this.usedInDropDown = false; 
15874  this.popupHorizontalOffset = 0;
15875  this.popupVerticalOffset = 0;
15876  this.popupHorizontalAlign = ASPx.PopupUtils.NotSetAlignIndicator;
15877  this.popupVerticalAlign = ASPx.PopupUtils.NotSetAlignIndicator;
15878  this.contentLoadingMode = LoadContentViaCallback.Default;
15879  this.slideAnimationDuration = 80;
15880  this.fadeAnimationDuration = 400;
15881  this.enableAnimation = true;
15882  this.showOnPageLoad = false;
15883  this.isDragged = false;
15884  this.closeOnEscape = false;
15885  this.savedCallbackWindowIndex = null;
15886  this.animationLockCount = 0;
15887  this.windowRequestCount = [];
15888  this.lpTimers = [];
15889  this.callbackAnimationProcessings = [];
15890  this.isCallbackFinishedStates = [];
15891  this.savedCallbackResults = [];
15892  this.loadingPanels = [];
15893  this.loadingDivs = [];
15894  this.left = 0;
15895  this.top = 0;
15896  this.height = constants.DEFAULT_WINDOW_HEIGHT;
15897  this.width = constants.DEFAULT_WINDOW_WIDTH;
15898  this.minHeight = null;
15899  this.minWidth = null;
15900  this.maxHeight = null;
15901  this.maxWidth = null;
15902  this.isResized = false;
15903  this.cachedSize = null;
15904  this.enableContentScrolling = false;
15905  this.contentOverflowX = "None";
15906  this.contentOverflowY = "None";
15907  this.contentUrl = "";
15908  this.contentUrlIFrameTitle = "";
15909  this.iframeLoading = false;
15910  this.iframeAdjustingPostponed = false;
15911  this.isPopupPositionCorrectionOn = true;
15912  this.resizeSessionCache = {};
15913  this.ResizeBorderSize = ASPx.Browser.TouchUI ? 10 : 6;
15914  this.ResizeCornerBorderSize = 20;
15915  this.isLiveResizingMode = true;
15916  this.allowResize = false;
15917  this.allowDragging = false;
15918  this.allowDraggingInAdaptiveMode = false;
15919  this.isWindowDragging = false;
15920  this.prohibitClearSelectionOnMouseDown = false;
15921  this.windowElements = {};
15922  this.windowContentElements = {};
15923  this.zIndex = -1;
15924  this.appearAfter = 300;
15925  this.disappearAfter = 500;
15926  this.popupAction = "LeftMouseClick";
15927  this.autoUpdatePosition = false;
15928  this.defaultIsPopuped = false;
15929  this.defaultLastUsedPopupElementInfo = {};
15930  this.defaultWindowPopupElementList = [];
15931  this.defaultWindowPopupElementIDList = [];
15932  this.firstFocusableElement = null;
15933  this.lastFocusableElement = null;
15934  this.focusLastElementHandler = function(e) { this.loopFocusHandler(e, false); }.aspxBind(this);
15935  this.focusFirstElementHandler = function(e) { this.loopFocusHandler(e, true); }.aspxBind(this);
15936  this.setFocusOnCallback = true;
15937  this.accessibleFocusElement = null;
15938  this.CloseButtonClick = new ASPxClientEvent();
15939  this.CloseUp = new ASPxClientEvent();
15940  this.Closing = new ASPxClientEvent();
15941  this.PopUp = new ASPxClientEvent();
15942  this.Shown = new ASPxClientEvent();
15943  this.Resize = new ASPxClientEvent();
15944  this.BeforeResizing = new ASPxClientEvent();
15945  this.AfterResizing = new ASPxClientEvent();
15946  aspxGetPopupControlCollection().Add(this);
15947 },
15948 WindowElementIDAssignmentMap: [
15949  { cssClass: PopupControlCssClasses.HeaderCssClassName, prefix: "_PWH" },
15950  { cssClass: "dxpc-headerText", prefix: "_PWH", postfix: "T" },
15951  { cssClass: "dxpc-headerImg", prefix: "_PWH", postfix: "I" },
15952  { cssClass: "dxpc-closeBtn", prefix: "_HCB" },
15953  { cssClass: "dxpc-pinBtn", prefix: "_HPB" },
15954  { cssClass: "dxpc-refreshBtn", prefix: "_HRB" },
15955  { cssClass: "dxpc-collapseBtn", prefix: "_HMNB" },
15956  { cssClass: "dxpc-maximizeBtn", prefix: "_HMXB" },
15957  { cssClass: "dxpc-content", prefix: "_PWC" },
15958  { cssClass: "dxpc-iFrame", prefix: "_CIF" },
15959  { cssClass: "dxpc-footer", prefix: "_PWF" },
15960  { cssClass: "dxpc-footerText", prefix: "_PWF", postfix: "T" },
15961  { cssClass: "dxpc-footerImg", prefix: "_PWF", postfix: "I" }
15962 ],
15963 Initialize: function() {
15964  this.InitializeBeforeAnyShow();
15965  ASPxClientControl.prototype.Initialize.call(this);
15966  if(this.accessibilityCompliant)
15967   this.InitializeAccessibleNavigation();
15968 },
15969 InitializeWindow: function(index) {
15970  ASPx.PopupUtils.BodyScrollHelper.RestoreIfLocked(this.GetWindowElementId(index));
15971  this.RemoveWindowAllPopupElements(index);
15972  this.PopulatePopupElements(index);
15973  var element = this.GetWindowElement(index);
15974  if(element != null) {
15975   this.AssignWindowElementsID(index, element);
15976   this.AssignWindowElementsEvents(index, element);
15977   element.DXPopupWindowElement = true;
15978   if(ASPx.Browser.IE)
15979    this.AttachOnDragStartEventToWindowImages(index);
15980   this.EnsureWindowContentUrl(index);
15981   element.isHiding = false;
15982   element.isPopupPositionCorrectionOn = this.isPopupPositionCorrectionOn || !this.GetShowOnPageLoad(index);
15983   if(this.GetShowOnPageLoad(index) && this.GetZIndex(index) > 0) {
15984    this.FirstShowWindow(index, false);
15985    this.SetWindowElementZIndex(element, this.GetZIndex(index));
15986    element.isPopupPositionCorrectionOn = true;
15987   }
15988   this.InitializeWindowEscKeyHandler(element, index);
15989   if(this.GetCanScrollViewPort(index))
15990    ensureViewPortSizeInterval();
15991  }
15992 },
15993 InitializeBeforeAnyShow: function() {
15994  this.InitializeEnableContentScrolling();
15995 },
15996 InitializeEnableContentScrolling: function() {
15997  this.enableContentScrolling = this.contentOverflowX != "None" || this.contentOverflowY != "None";
15998 },
15999 InitializeWindowEscKeyHandler: function(element, index) {
16000  if(!this.GetEnableCloseByEsc(index)) return;
16001  this.AddKeyDownHandler("ESC", this.OnEscKeyDown.aspxBind(this));
16002 },
16003 AfterInitialize: function() {
16004  if(this.HasDefaultWindow())
16005   this.AfterInitializeWindow(-1);
16006  for(var i = 0; i < this.GetWindowCount(); i++)
16007   this.AfterInitializeWindow(i);
16008  ASPxClientControl.prototype.AfterInitialize.call(this);
16009 },
16010 AfterInitializeWindow: function(index) {
16011  if(this.GetShowOnPageLoad(index) && this.GetZIndex(index) < 0) {
16012   this.FirstShowWindow(index, true);
16013   var element = this.GetWindowElement(index);
16014   if(element != null)
16015    element.isPopupPositionCorrectionOn = true;
16016  }
16017  this.EnsureContent(index, true);
16018 },
16019 AssignWindowElementsID: function(index, windowElement) {
16020  for(var i = 0; i < this.WindowElementIDAssignmentMap.length; i++) {
16021   var elementClass = this.WindowElementIDAssignmentMap[i].cssClass;
16022   var elements = ASPx.GetNodesByClassName(windowElement, elementClass);
16023   for(var j = 0; j < elements.length; j++) {
16024    var element = elements[j];
16025    if(this.GetFirstParentWindow(element) === windowElement)
16026     this.AssignElementID(element, index, this.WindowElementIDAssignmentMap[i].prefix, this.WindowElementIDAssignmentMap[i].postfix);
16027   }
16028  }
16029 },
16030 AssignElementID: function(element, index, prefix, postfix) {
16031  element.id = this.name + prefix + index + (postfix ? postfix : "");
16032 },
16033 AssignWindowElementsEvents: function(index, element) {
16034  var header = this.GetWindowHeaderElement(index);
16035  if(header && this.allowDragging && !this.isWindowDragging)
16036   ASPx.Evt.AttachEventToElement(header, ASPx.TouchUIHelper.touchMouseDownEventName, this.GetWindowHeaderElementMouseDownEventHandler(index), true);
16037  this.AssignHeaderButtonsEvents(index);
16038  var mdEventName = ASPx.TouchUIHelper.touchMouseDownEventName;
16039  ASPx.Evt.AttachEventToElement(element, mdEventName, this.GetWindowElementMouseDownEventHandler(index));
16040  if(this.IsResizeAllowed(index)) {
16041   var mmEventName = ASPx.TouchUIHelper.touchMouseMoveEventName;
16042   ASPx.Evt.AttachEventToElement(element, mmEventName, this.GetWindowElementMouseMoveEventHandler(index));
16043  }
16044  var sizeGrip = this.GetWindowSizeGripElement(index);
16045  if(sizeGrip) {
16046   var instance = this;
16047   ASPx.Evt.AttachEventToElement(sizeGrip, mdEventName, function(evt) {
16048    ASPx.PWGripMDown(evt, instance.name, index);
16049    ASPx.Evt.PreventEvent(evt);
16050   });
16051  }
16052 },
16053 AssignHeaderButtonsEvents: function(index) {
16054  this.AttachClickToHeaderButton(index, this.GetWindowCloseButton(index), "ASPx.PWCBClick");
16055  this.AttachClickToHeaderButton(index, this.GetWindowRefreshButton(index), "ASPx.PWRBClick");
16056 },
16057 AttachClickToHeaderButton: function(index, headerButton, eventFuncName) {
16058  var instance = this;
16059  if(headerButton) {
16060   ASPx.Evt.AttachEventToElement(headerButton, "click", function(evt) {
16061    eval(eventFuncName)(evt, instance.name, index);
16062   });
16063  }
16064 },
16065 AttachOnDragStartEventToWindowImages: function(index) {
16066  this.AttachChildImagesPreventDragStartEvent(this.GetWindowHeaderElement(index));
16067  this.AttachChildImagesPreventDragStartEvent(this.GetWindowFooterElement(index));
16068 },
16069 AttachChildImagesPreventDragStartEvent: function(parentElem) {
16070  var images = parentElem == null ? null : ASPx.GetNodesByTagName(parentElem, "img");
16071  if(images != null) {
16072   for(var i = 0; i < images.length; i++)
16073    ASPx.Evt.AttachEventToElement(images[i], "dragstart", ASPx.Evt.PreventDragStart);
16074  }
16075 },
16076 GetPropertyValue: function(index, propName) {
16077  return this[propName];
16078 },
16079 SetPropertyValue: function(index, propName, value) {
16080  this[propName] = value;
16081 },
16082 GetStretchVerticallyByIndex: function(index) {
16083  return this.GetPropertyValue(index, "stretchVertically");
16084 },
16085 GetModalMaxWidth: function(index) {
16086  return this.GetPropertyValue(index, "modalMaxWidth");
16087 },
16088 SetAdaptiveMaxWidthByIndex: function(index, value) {
16089  value = this.ConvertDimensionValueToString(value);
16090  this.SetPropertyValue(index, "modalMaxWidth", value);
16091  this.GetWindowElement(index).style["maxWidth"] = value;
16092 },
16093 GetModalMinWidth: function(index) {
16094  return this.GetPropertyValue(index, "modalMinWidth");
16095 },
16096 SetAdaptiveMinWidthByIndex: function(index, value) {
16097  value = this.ConvertDimensionValueToString(value);
16098  this.SetPropertyValue(index, "modalMinWidth", value);
16099  this.GetWindowElement(index).style["minWidth"] = value;
16100 },
16101 GetModalMinHeight: function(index) {
16102  return this.GetPropertyValue(index, "modalMinHeight");
16103 },
16104 SetAdaptiveMinHeightByIndex: function(index, value) {
16105  this.StretchVerticallyByIndex(index, false);
16106  this.SetPropertyValue(index, "modalMinHeight", value);
16107  this.SetAdaptiveHeightDimension(index, "minHeight", value);
16108 },
16109 GetModalMaxHeight: function(index) {
16110  return this.GetPropertyValue(index, "modalMaxHeight");
16111 },
16112 SetAdaptiveMaxHeightByIndex: function(index, value) {
16113  this.SetPropertyValue(index, "modalMaxHeight", value);
16114  this.SetAdaptiveHeightDimension(index, "maxHeight", value);
16115 },
16116 GetFixedHeader: function(index) {
16117  return this.GetPropertyValue(index, "fixedHeader");
16118 },
16119 GetFixedFooter: function(index) {
16120  return this.GetPropertyValue(index, "fixedFooter");
16121 },
16122 GetWindowWidthInternal: function(index) {
16123  return this.GetPropertyValue(index, "width");
16124 },
16125 GetWindowHeightInternal: function(index) {
16126  return this.GetPropertyValue(index, "height");
16127 },
16128 SetWindowHeight: function(index, height) {
16129  this.SetPropertyValue(index, "height", height);
16130 },
16131 SetWindowWidth: function(index, width) {
16132  this.SetPropertyValue(index, "width", width);
16133 },
16134 GetWindowMinWidth: function(index) {
16135  return this.GetPropertyValue(index, "minWidth");
16136 },
16137 GetWindowMaxWidth: function(index) {
16138  return this.GetPropertyValue(index, "maxWidth");
16139 },
16140 GetWindowMinHeight: function(index) {
16141  return this.GetPropertyValue(index, "minHeight");
16142 },
16143 GetWindowMaxHeight: function(index) {
16144  return this.GetPropertyValue(index, "maxHeight");
16145 },
16146 SetWindowCachedSize: function(index, width, height) {
16147  this.SetPropertyValue(index, "cachedSize", new ASPx.PopupSize(width, height));
16148 },
16149 GetWindowCachedSize: function(index) {
16150  return this.GetPropertyValue(index, "cachedSize");
16151 },
16152 ResetWindowCachedSize: function(index) {
16153  this.SetPropertyValue(index, "cachedSize", null);
16154 },
16155 GetPosition: function(index, isLeft) {
16156  return this.GetPropertyValue(index, isLeft ? "left" : "top");
16157 },
16158 GetWindowTop: function(index) {
16159  return this.GetPropertyValue(index, "top");
16160 },
16161 SetWindowTop: function(index, top) {
16162  this.SetPropertyValue(index, "top", top);
16163 },
16164 GetWindowLeft: function(index) {
16165  return this.GetPropertyValue(index, "left");
16166 },
16167 SetWindowLeft: function(index, left) {
16168  this.SetPropertyValue(index, "left", left);
16169 },
16170 GetEnableCloseByEsc: function(index) {
16171  return this.GetPropertyValue(index, "closeOnEscape");
16172 },
16173 GetIsDragged: function(index) {
16174  return this.GetPropertyValue(index, "isDragged");
16175 },
16176 GetWindowContentIFrameUrl: function(index) {
16177  return this.GetPropertyValue(index, "contentUrl");
16178 },
16179 GetWindowContentIFrameTitle: function(index) {
16180  return this.GetPropertyValue(index, "contentUrlIFrameTitle");
16181 },
16182 GetWindowCloseAction: function(index) {
16183  return this.GetPropertyValue(index, "closeAction");
16184 },
16185 GetShowOnPageLoad: function(index) {
16186  return this.GetPropertyValue(index, "showOnPageLoad");
16187 },
16188 GetZIndex: function(index) {
16189  return this.GetPropertyValue(index, "zIndex");
16190 },
16191 GetIframeLoading: function(index) {
16192  return this.GetPropertyValue(index, "iframeLoading");
16193 },
16194 SetIframeLoading: function(index, value) {
16195  this.SetPropertyValue(index, "iframeLoading", value);
16196 },
16197 SetIsDragged: function(index, value) {
16198  this.SetPropertyValue(index, "isDragged", value);
16199 },
16200 GetIsResized: function(index) {
16201  return this.GetPropertyValue(index, "isResized");
16202 },
16203 SetIsResized: function(index, value) {
16204  this.SetPropertyValue(index, "isResized", value);
16205 },
16206 SetIframeAdjustingPostponed: function(index, value) {
16207  this.SetPropertyValue(index, "iframeAdjustingPostponed", value);
16208 },
16209 GetIframeAdjustingPostponed: function(index) {
16210  return this.GetPropertyValue(index, "iframeAdjustingPostponed");
16211 },
16212 GetWindowPopupAction: function(index) {
16213  return this.GetPropertyValue(index, "popupAction");
16214 },
16215 GetWindowElementMouseMoveEventHandler: function(index) {
16216  var instance = this;
16217  return function(evt) { ASPx.PWMMove(evt, instance.name, index); };
16218 },
16219 GetWindowElementMouseDownEventHandler: function(index) {
16220  var instance = this;
16221  return function(evt) {
16222   if(instance.AllowMouseDown(evt, index))
16223    ASPx.PWMDown(evt, instance.name, index, instance.isWindowDragging);
16224  };
16225 },
16226 GetWindowHeaderElementMouseDownEventHandler: function(index) {
16227  var instance = this;
16228  return function(evt) {
16229   if(instance.AllowMouseDown(evt, index))
16230    ASPx.PWDGMDown(evt, instance.name, index);
16231  };
16232 },
16233 AllowMouseDown: function(evt, index) {
16234  return !this.PreventHeaderButtonMouseDownBubbling(evt, this.GetWindowCloseButton(index)) &&
16235   !this.PreventHeaderButtonMouseDownBubbling(evt, this.GetWindowRefreshButton(index));
16236 },
16237 PreventHeaderButtonMouseDownBubbling: function(evt, hdrButton) {
16238  if(hdrButton) {
16239   var source = ASPx.Evt.GetEventSource(evt);
16240   if(ASPx.GetIsParent(hdrButton, source)) {
16241    ASPx.PWHMDown(evt);
16242    return true;
16243   }
16244  }
16245  return false;
16246 },
16247 PrepareToAdjustContentOnShow: function(index) {
16248  if(this.adjustInnerControlsSizeOnShow) {
16249   var windowContent = this.GetContentContainer(index),
16250    collection = ASPx.GetControlCollection();
16251   collection.CollapseControls(windowContent);
16252  }
16253 },
16254 AdjustContentOnShow: function(index) {
16255  if(this.adjustInnerControlsSizeOnShow) {
16256   var windowElement = this.GetWindowElement(index);
16257   ASPx.GetControlCollection().AdjustControls(windowElement);
16258  }
16259 },
16260 AdjustSize: function() {
16261  if(this.enableContentScrolling)
16262   return;
16263  this.SetSize(0, 0);
16264 },
16265 GetFirstParentWindow: function(el) {
16266  while(el && el.tagName != "BODY") {
16267   if(el.nodeType == 1 && el.className.indexOf("dxpclW") > -1 && !isNaN(this.GetWindowIndex(el)))
16268    return el;
16269   el = el.parentNode;
16270  }
16271 },
16272 getParentPopupControl: function(index) {
16273  var parentPopupWindowElement = this.GetFirstParentWindow(this.GetWindowElement(index).parentNode);
16274  if(parentPopupWindowElement)
16275   return aspxGetPopupControlCollection().GetPopupWindowFromID(parentPopupWindowElement.id);
16276 },
16277 registerAndActivateWindow: function(windowElement, index, allowChangeZIndex) {
16278  aspxGetPopupControlCollection().RegisterVisibleWindow(windowElement, this, index);
16279  if(allowChangeZIndex)
16280   aspxGetPopupControlCollection().ActivateWindowElement(windowElement, undefined, this.GetPopupType(), this.GetDefaultZIndexFromServer(), this.GetPopupControlZIndex());
16281 },
16282 HasCloseAnimation: function() {
16283  return this.closeAnimationType != ASPxClientPopupControlBase.AnimationType.None;
16284 },
16285 AddKeyDownHandler: function(shortcutString, handler) {
16286  if(typeof(this.keyDownHandlers) === "undefined")
16287   this.keyDownHandlers = [];
16288  this.keyDownHandlers[ASPx.ParseShortcutString(shortcutString)] = handler;
16289 },
16290 InternalIsWindowDisplayed: function(index) {
16291  var element = this.GetWindowElement(index);
16292  return (element != null) ? ASPx.GetElementDisplay(element) : false;
16293 },
16294 InternalIsWindowVisible: function(index) {
16295  var element = this.GetWindowElement(index);
16296  if(!element)
16297   return false;
16298  if(this.HasCloseAnimation() && !element.closeAnimationCompleted)
16299   return false;
16300  var currentStyle = ASPx.GetCurrentStyle(element);
16301  return ((currentStyle && currentStyle.visibility != "hidden") && ASPx.GetElementDisplay(element, true) ? true : false);
16302 },
16303 IsWindowVisible: function(window) {
16304  var index = (window != null) ? window.index : -1;
16305  return this.InternalIsWindowVisible(index);
16306 },
16307 IsVisible: function() {
16308  return this.InternalIsWindowVisible(-1);
16309 },
16310 UpdateWindowsStateCookie: function() {
16311  if(this.cookieName == "") return;
16312  ASPx.Cookie.DelCookie(this.cookieName);
16313  ASPx.Cookie.SetCookie(this.cookieName, this.GetWindowsState());
16314 },
16315 SetWindowElementZIndex: function(element, zIndex) {
16316  element.style.zIndex = zIndex;
16317  var iFrame = element.overflowElement;
16318  if(iFrame)
16319   iFrame.style.zIndex = zIndex - 1;
16320  var modalElement = element.modalElement;
16321  if(modalElement)
16322   modalElement.style.zIndex = zIndex - 1;
16323  this.UpdateWindowsStateCookie();
16324 },
16325 SetWindowContentHtmlCore: function(index, html, useAnimation) {
16326  var element = this.GetContentContainer(index);
16327  if(element != null) {
16328   ASPx.SetInnerHtml(element, html);
16329   this.AfterSetWindowContentHtml(index, element, useAnimation);
16330  }
16331 },
16332 SetContentHtml: function(html, useAnimation) {
16333  this.SetWindowContentHtml(null, html, useAnimation);
16334  if(html && this.accessibilityCompliant)
16335   ASPx.GetControlCollection().ControlsInitialized.AddHandler(this.OnControlsInitialized, this);
16336 },
16337 SetWindowContentHtml: function(window, html, useAnimation) {
16338  var index = (window != null) ? window.index : -1;
16339  this.SetWindowContentHtmlCore(index, html, useAnimation);
16340 },
16341 GetContentHtml: function() {
16342  return this.GetWindowContentHtml(null);
16343 },
16344 AfterSetWindowContentHtml: function(index, contentContainer, useAnimation) {
16345  if(useAnimation && typeof (ASPx.AnimationHelper) != "undefined")
16346   ASPx.AnimationHelper.fadeIn(contentContainer, function() { this.ResizeWindowIFrame(index); }.aspxBind(this));
16347  else
16348   this.ResizeWindowIFrame(index);
16349 },
16350 ResizeWindowIFrame: function(index) {
16351  if(!this.renderIFrameForPopupElements) return;
16352  if(!this.InternalIsWindowVisible(index)) return;
16353  var iFrame = this.GetWindowIFrame(index);
16354  if(iFrame) {
16355   var cell = this.GetWindowMainCell(this.GetWindowElement(index));
16356   ASPx.SetStyles(iFrame, { width: cell.offsetWidth, height: cell.offsetHeight });
16357  }
16358 },
16359 DoHideWindow: function(index, dontRaiseClosing, closeReason) {
16360  if(!this.InternalIsWindowVisible(index)) return;
16361  var cancel = !dontRaiseClosing && this.RaiseClosing(index, closeReason);
16362  if(!cancel) {
16363   if(this.HasCloseAnimation())
16364    this.DoHideWindowCoreWithAnimation(index, closeReason);
16365   else {
16366    this.DoHideWindowCore(index, closeReason);
16367    this.RaiseCloseUp(index, closeReason);
16368   }
16369  }
16370  return cancel;
16371 },
16372 HasAnyScrollBars: function(index) {
16373  var contentElement = this.GetWindowContentElement(index);
16374  var hasBothScrollBars = contentElement.style.overflow == "scroll" || contentElement.style.overflow == "auto";
16375  return hasBothScrollBars || contentElement.style.overflowX == "scroll" ||
16376   contentElement.style.overflowY == "scroll" || contentElement.style.overflowX == "auto" ||
16377   contentElement.style.overflowY == "auto";
16378 },
16379 DoHideWindowModalElement: function(element, closeReason) {
16380  var modalElement = element.modalElement;
16381  if(modalElement && ASPx.GetElementVisibility(modalElement, true)) {
16382   var closeModalElement = function () {
16383    ASPx.SetStyles(modalElement, { width: 1, height: 1, zIndex: defaultZIndexFromServer - 1 });
16384    ASPx.SetElementVisibility(modalElement, false);
16385    ASPx.SetElementDisplay(modalElement, false);
16386   };
16387   aspxGetPopupControlCollection().UnregisterVisibleModalElement(modalElement);
16388   if(this.GetHideBodyScrollWhenModal(this.GetWindowIndex(element))) {
16389    if(ASPx.Browser.WebKitFamily)
16390     aspxGetPopupControlCollection().LockScrollEvent();
16391    if(!ASPx.Browser.WebKitTouchUI)
16392     ASPx.PopupUtils.BodyScrollHelper.RestoreBodyScroll(element.id);
16393    if(ASPx.Browser.WebKitFamily)
16394     aspxGetPopupControlCollection().UnlockScrollEvent();
16395   }
16396   if(closeReason == ASPxClientPopupControlCloseReason.OuterMouseClick) {     
16397    ASPx.SetStyles(modalElement, { opacity: 0 });
16398    if(!modalElement.mouseHandler) {
16399     modalElement.mouseHandler = function() {
16400      ASPx.SetStyles(modalElement, { opacity: "" });
16401      closeModalElement();
16402      ASPx.Evt.DetachEventFromElement(modalElement, "mouseup", modalElement.mouseHandler);
16403      ASPx.Evt.DetachEventFromElement(modalElement, "mouseout", modalElement.mouseHandler);
16404     };
16405    }
16406    ASPx.Evt.AttachEventToElement(modalElement, "mouseup", modalElement.mouseHandler);
16407    ASPx.Evt.AttachEventToElement(modalElement, "mouseout", modalElement.mouseHandler);
16408   } else
16409    closeModalElement();
16410  }
16411 },
16412 IncreaseWindowRequestCount: function (index) {
16413  if(!this.windowRequestCount[index])
16414   this.windowRequestCount[index] = 1;
16415  else
16416   this.windowRequestCount[index]++;
16417 },
16418 DecreaseWindowRequestCount: function(index) {
16419  this.windowRequestCount[index]--;
16420 },
16421 IsLoadingContainerVisible: function() {
16422  return true;
16423 },
16424 ShouldHideExistingLoadingElements: function() {
16425  return false;
16426 },
16427 GetModalElementEndAnimationOpacity: function(index) {
16428  if(typeof (this.modalElementOpacity) == "undefined")
16429   this.modalElementOpacity = [];
16430  if(typeof (this.modalElementOpacity[index]) == "undefined")
16431   this.modalElementOpacity[index] = ASPx.GetElementOpacity(this.GetWindowModalElement(index));
16432  return this.modalElementOpacity[index];
16433 },
16434 SetModalElementVisibilityWithAnimation: function(modalElement, index) {
16435  if(this.AllowModalElementAnimation(index)) {
16436   var endOpacity = this.GetModalElementEndAnimationOpacity(index);
16437   ASPx.AnimationHelper.setOpacity(modalElement, 0);
16438   ASPx.SetElementVisibility(modalElement, true);
16439   ASPx.AnimationHelper.fadeTo(modalElement, { to: endOpacity });
16440  } else
16441   ASPx.SetElementVisibility(modalElement, true);
16442 },
16443 AllowModalElementAnimation: function(index) {
16444  return this.popupAnimationType === ASPxClientPopupControlBase.AnimationType.Fade;
16445 },
16446 SetVisibleWithAnimation: function(element, isMoving, index, horizontalPopupPosition, verticalPopupPosition) {
16447  var isAnimationNeed = this.IsAnimationAllowed() && !isMoving;
16448  if(isAnimationNeed && this.popupAnimationType !== "none") {
16449   switch(this.popupAnimationType) {
16450    case ASPxClientPopupControlBase.AnimationType.Slide:
16451     this.StartSlideAnimation(element, index, horizontalPopupPosition, verticalPopupPosition);
16452     break;
16453    case ASPxClientPopupControlBase.AnimationType.Fade:
16454     this.StartFadeAnimation(element, index);
16455     break;
16456    case ASPxClientPopupControlBase.AnimationType.Auto:
16457     this.StartAutoAnimation(element, index, horizontalPopupPosition, verticalPopupPosition);
16458     break;
16459   }
16460  }
16461  else
16462   ASPx.SetElementVisibility(element, true);
16463 },
16464 StartAutoAnimation: function(element, index, horizontalPopupPosition, verticalPopupPosition) {
16465  ASPx.SetElementVisibility(element, true);
16466 },
16467 StartFadeAnimation: function(element, index) {
16468  ASPx.AnimationHelper.setOpacity(element, 0);
16469  ASPx.SetElementVisibility(element, true);
16470  var callback = function() {
16471   this.OnAnimationStop(index);
16472  }.aspxBind(this);
16473  ASPx.AnimationHelper.fadeIn(element, callback, this.fadeAnimationDuration);
16474 },
16475 StartSlideAnimation: function (animationDivElement, index, horizontalPopupPosition, verticalPopupPosition) {
16476  var element = this.GetWindowMainCell(animationDivElement);
16477  var clientX = horizontalPopupPosition.position;
16478  var clientY = verticalPopupPosition.position;
16479  var args = "(\"" + this.name + "\", " + index + ")";
16480  var onAnimStopCallString = "ASPx.PCAStop" + args;
16481  this.InitDivPosForShowSlideAnimation(index, animationDivElement, clientX, clientY, onAnimStopCallString);
16482  var horizontalDirection = this.GetAnimationHorizontalDirection(index, horizontalPopupPosition);
16483  var verticalDirection = this.GetAnimationVerticalDirection(index, verticalPopupPosition);
16484  var offsetCoefficient = this.GetSlideOffsetCoefficient(index);
16485  var xPos = horizontalDirection * animationDivElement.offsetWidth * offsetCoefficient;
16486  var yPos = verticalDirection * animationDivElement.offsetHeight * offsetCoefficient;
16487  neddToForceAnimation = xPos === 0 && yPos === 0;
16488  if(neddToForceAnimation) 
16489   yPos = 1;
16490  ASPx.SetStyles(element, { left: xPos, top: yPos });
16491  ASPx.SetElementVisibility(animationDivElement, true);
16492  this.DoShowWindowIFrame(index, clientX, clientY, 0, 0);
16493  ASPx.PopupUtils.StartSlideAnimation(animationDivElement, element, this.GetWindowIFrame(index), this.GetSlideAnimationDuration(index));
16494 },
16495 GetSlideAnimationDuration: function(index) {
16496  return this.slideAnimationDuration;
16497 },
16498 GetSlideOffsetCoefficient: function(index) {
16499  return 1;
16500 },
16501 InitDivPosForShowSlideAnimation: function(index, animationDivElement, clientX, clientY, onAnimStopCallString) {
16502  ASPx.PopupUtils.InitAnimationDiv(animationDivElement, clientX, clientY, onAnimStopCallString, true);
16503 },
16504 InitDivPosForHideSlideAnimation: function(animationDivElement) {
16505 },
16506 StopShowAnimation: function(index) {
16507  if(this.popupAnimationType != "none") {
16508   var windowElement = this.GetWindowElement(index);
16509   if(this.popupAnimationType === 'slide')
16510    ASPx.PopupUtils.StopAnimation(windowElement, this.GetWindowMainCell(windowElement));
16511   else
16512    ASPx.AnimationHelper.cancelAnimation(windowElement);
16513  }
16514 },
16515 StopCloseAnimation: function(index) {
16516  var element = this.GetWindowElement(index);
16517  if(this.HasCloseAnimation() && !element.closeAnimationCompleted) {
16518   ASPx.AnimationHelper.cancelAnimation(element);
16519   this.DoHideWindowCore(index);
16520  }
16521 },
16522 IsFadeCloseAnimation: function(index) {
16523  return this.closeAnimationType === ASPxClientPopupControlBase.AnimationType.Fade;
16524 },
16525 PrepareElementAfterCloseAnimation: function(index, element) {
16526  element.closeAnimationCompleted = true;
16527  if(this.IsFadeCloseAnimation(index))
16528   ASPx.SetStyles(element, { opacity: 1 });
16529  else
16530   ASPx.SetStyles(this.GetWindowMainCell(element), {
16531    left: 0,
16532    top: 0
16533   });
16534 },
16535 DoHideWindowCoreWithAnimation: function(index, closeReason) {
16536  this.StopShowAnimation(index);
16537  var element = this.GetWindowElement(index);
16538  element.closeAnimationCompleted = false;
16539  if(this.AllowModalElementAnimation(index) && this.CanManipulateWithModalElement(index))
16540   ASPx.AnimationHelper.fadeOut(element.modalElement, null, this.fadeAnimationDuration);
16541  switch(this.closeAnimationType) {
16542   case ASPxClientPopupControlBase.AnimationType.Slide:
16543    this.DoHideWindowWithSlideAnimation(index, closeReason);
16544    break;
16545   case ASPxClientPopupControlBase.AnimationType.Fade:
16546    this.DoHideWindowWithFadeAnimation(index, element, closeReason);
16547    break;
16548   case ASPxClientPopupControlBase.AnimationType.Auto:
16549    this.DoHideWindowWithAutoAnimation(index, element, closeReason);
16550    break;
16551  }
16552 },
16553 DoHideWindowWithAutoAnimation: function(index, element, closeReason) {
16554 },
16555 DoHideWindowWithFadeAnimation: function(index, element, closeReason) {
16556  ASPx.AnimationHelper.fadeOut(element, function() {
16557   this.DoHideWindowCore(index);
16558   this.RaiseCloseUp(index, closeReason);
16559  }.aspxBind(this), this.fadeAnimationDuration);
16560 },
16561 DoHideWindowWithSlideAnimation: function(index, closeReason) {
16562  var element = this.GetWindowElement(index);
16563  var horizontalPopupPosition = this.GetSlideAnimationPosition(element, true);
16564  var verticalPopupPosition = this.GetSlideAnimationPosition(element, false);
16565  var horizontalDirection = this.GetAnimationHorizontalDirection(index, horizontalPopupPosition);
16566  var verticalDirection = this.GetAnimationVerticalDirection(index, verticalPopupPosition);
16567  this.InitDivPosForHideSlideAnimation(element);
16568  var offsetCoefficient = this.GetSlideOffsetCoefficient(index);
16569  ASPx.AnimationHelper.createMultipleAnimationTransition(this.GetWindowMainCell(element), {
16570   duration: this.GetSlideAnimationDuration(index),
16571   onComplete: function(element) {
16572    this.DoHideWindowCore(index);
16573    this.RaiseCloseUp(index, closeReason);
16574   }.aspxBind(this)
16575  }).Start({
16576   left: { to: horizontalDirection * element.offsetWidth * offsetCoefficient, unit: "px" },
16577   top: { to: verticalDirection * element.offsetHeight * offsetCoefficient, unit: "px" }
16578  });
16579 },
16580 GetSlideAnimationPosition: function(element, isX) {
16581  return this.GetClientPopupPos(element, null, ASPx.InvalidPosition, isX, true);
16582 },
16583 GetAnimationHorizontalDirection: function(index, horizontalPopupPosition) {
16584  return ASPx.PopupUtils.GetAnimationHorizontalDirection(horizontalPopupPosition, this.popupHorizontalAlign, this.popupVerticalAlign, this.rtl);
16585 },
16586 GetAnimationVerticalDirection: function(index, verticalPopupPosition) {
16587  return ASPx.PopupUtils.GetAnimationVerticalDirection(verticalPopupPosition, this.popupHorizontalAlign, this.popupVerticalAlign);
16588 },
16589 OnAnimationStop: function(index) {
16590  this.OnWindowShown(index);
16591 },
16592 PerformCallback: function(parameter, onSuccess) {
16593  this.PerformWindowCallback(null, parameter, onSuccess);
16594 },
16595 PerformWindowCallback: function(window, parameter, onSuccess) {
16596  parameter = ASPx.IsExists(parameter) ? parameter.toString() : "";
16597  var index = (window != null) ? window.index : -1;
16598  if(!this.InWindowCallback(index)) {
16599   var windowCallbackArguments = index + ";" + parameter;
16600   this.CreateWindowCallback(index, windowCallbackArguments, onSuccess);
16601  }
16602 },
16603 InWindowCallback: function(windowIndex) {
16604  return this.windowRequestCount[windowIndex] > 0;
16605 },
16606 CreateWindowCallback: function(windowIndex, argument, handler) {
16607  this.IncreaseWindowRequestCount(windowIndex);
16608  var element = this.GetWindowElement(windowIndex);
16609  if(this.contentLoadingMode != LoadContentViaCallback.OnPageLoad || !element.loading || this.GetShowOnPageLoad(windowIndex))
16610   this.ShowWindowLoadingElements(windowIndex);
16611  this.CreateCallback(argument, null, handler);
16612 },
16613 OnCallback: function(result) {
16614  this.OnCallbackInternal(result.html, result.index, false);
16615 },
16616 OnCallbackError: function(result, data) {
16617  this.OnCallbackInternal(result, ASPx.IsExists(data) ? data : -1, true);
16618 },
16619 OnCallbackErrorAfterUserHandle: function(result, data) {
16620  this.DecreaseWindowRequestCount(data);
16621 },
16622 OnCallbackInternal: function(html, windowIndex, isError) {
16623  var element = this.GetWindowElement(windowIndex);
16624  element.loaded = !isError;
16625  element.loading = false;
16626  this.DecreaseWindowRequestCount(windowIndex);
16627  this.HideWindowLoadingPanel(windowIndex);
16628  this.SetWindowContentHtmlCore(windowIndex, html);
16629  this.UpdatePositionAfterCallback(windowIndex);
16630  this.savedCallbackWindowIndex = windowIndex;
16631  this.UpdateWindowsStateCookie();
16632 },
16633 RaiseCallbackError: function(message) {
16634  var result = ASPxClientControl.prototype.RaiseCallbackError.call(this, message);
16635  if(result.isHandled)
16636   this.HideAllLoadingPanels();
16637  return result;
16638 },
16639 StartWindowBeginCallbackAnimation: function(windowIndex) {
16640  this.callbackAnimationProcessings[windowIndex] = true;
16641  this.isCallbackFinishedStates[windowIndex] = false;
16642  ASPx.AnimationHelper.fadeOut(this.GetWindowContentElement(windowIndex), function() { this.FinishWindowBeginCallbackAnimation(windowIndex); }.aspxBind(this));
16643 },
16644 FinishWindowBeginCallbackAnimation: function(windowIndex) {
16645  this.callbackAnimationProcessings[windowIndex] = false;
16646  if(!this.isCallbackFinishedStates[windowIndex])
16647   this.ShowWindowLoadingElementsInternal(windowIndex);
16648  else
16649   this.DoCallback(this.savedCallbackResults[windowIndex]);
16650 },
16651 CheckBeginCallbackAnimationInProgress: function(callbackResult) {
16652  var result;
16653  try {
16654   result = this.EvalCallbackResult(callbackResult).result;
16655  } catch(e) {
16656   return false;
16657  }
16658  var windowIndex = result.index;
16659  if(this.enableCallbackAnimation && this.callbackAnimationProcessings[windowIndex]) {
16660   this.savedCallbackResults[windowIndex] = callbackResult;
16661   this.isCallbackFinishedStates[windowIndex] = true;
16662   return true;
16663  }
16664  return false;
16665 },
16666 StartWindowEndCallbackAnimation: function(windowIndex) {
16667  this.callbackAnimationProcessings[windowIndex] = true;
16668  ASPx.AnimationHelper.fadeIn(this.GetWindowContentElement(windowIndex), function() { this.FinishWindowEndCallbackAnimation(windowIndex); }.aspxBind(this));
16669 },
16670 FinishWindowEndCallbackAnimation: function(windowIndex) {
16671  this.DoEndCallback();
16672  this.callbackAnimationProcessings[windowIndex] = false;
16673 },
16674 CheckEndCallbackAnimationNeeded: function() {
16675  var windowIndex = this.savedCallbackWindowIndex;
16676  this.savedCallbackWindowIndex = null;
16677  if(windowIndex !== null && !this.callbackAnimationProcessings[windowIndex]) {
16678   this.StartWindowEndCallbackAnimation(windowIndex);
16679   return true;
16680  }
16681  return false;
16682 },
16683 EnsureContent: function(windowIndex, isInit) {
16684  var element = this.GetWindowElement(windowIndex);
16685  if(element && !element.loaded && !element.loading) {
16686   var shouldLoad = this.contentLoadingMode == LoadContentViaCallback.OnPageLoad || this.contentLoadingMode == LoadContentViaCallback.OnFirstShow && !isInit;
16687   if(shouldLoad) {
16688    element.loading = true;
16689    this.CreateWindowCallback(windowIndex, windowIndex);
16690   } else if(this.contentLoadingMode == LoadContentViaCallback.Default)
16691    element.loaded = true;
16692  }
16693 },
16694 HideAllLoadingPanels: function() {
16695  if(this.HasDefaultWindow())
16696   this.HideWindowLoadingPanel(-1);
16697  for(var i = 0; i < this.GetWindowCount() ; i++)
16698   this.HideWindowLoadingPanel(i);
16699 },
16700 HideWindowLoadingPanel: function(windowIndex) {
16701  this.ClearWindowLoadingPanelTimer(windowIndex);
16702  if(this.loadingDivs[windowIndex]) {
16703   ASPx.RemoveElement(this.loadingDivs[windowIndex]);
16704   this.loadingDivs[windowIndex] = null;
16705  }
16706  if(this.loadingPanels[windowIndex]) {
16707   ASPx.RemoveElement(this.loadingPanels[windowIndex]);
16708   this.loadingPanels[windowIndex] = null;
16709  }
16710 },
16711 ShowWindowLoadingElements: function(windowIndex) {
16712  if(this.lpTimers[windowIndex] && this.lpTimers[windowIndex] > -1) return;
16713  if(this.enableCallbackAnimation)
16714   this.StartWindowBeginCallbackAnimation(windowIndex);
16715  else
16716   this.ShowWindowLoadingElementsInternal(windowIndex);
16717 },
16718 ShowWindowLoadingPanelOnTimer: function(windowIndex) {
16719  this.ClearWindowLoadingPanelTimer(windowIndex);
16720  this.ShowWindowLoadingPanel(windowIndex);
16721 },
16722 ClearWindowLoadingPanelTimer: function(windowIndex) {
16723  this.lpTimers[windowIndex] = ASPx.Timer.ClearTimer(this.lpTimers[windowIndex]);
16724 },
16725 ShowWindowLoadingElementsInternal: function(windowIndex) {
16726  if(this.lpDelay > 1 && !this.enableCallbackAnimation) {
16727   var _this = this;
16728   this.lpTimers[windowIndex] = window.setTimeout(function() { _this.ShowWindowLoadingPanelOnTimer(windowIndex); }, this.lpDelay);
16729  }
16730  else
16731   this.ShowWindowLoadingPanel(windowIndex);
16732 },
16733 ShowWindowLoadingPanel: function(windowIndex) {
16734  if(!this.IsExistLoadingPanel())
16735   return;
16736  if(!this.loadingPanels[windowIndex] && this.InternalIsWindowVisible(windowIndex)) {
16737   var parentElement = this.GetWindowElement(windowIndex).parentNode;
16738   var offsetElement = this.GetLoadingPanelOffsetElement(windowIndex);
16739   this.loadingDivs[windowIndex] = this.CreateLoadingDiv(parentElement, offsetElement, windowIndex);
16740   this.loadingPanels[windowIndex] = this.CreateLoadingPanelWithAbsolutePosition(parentElement, offsetElement, windowIndex);
16741  }
16742 },
16743 GetLoadingPanelOffsetElement: function(windowIndex) {
16744  return this.GetWindowContentWrapperElement(windowIndex);
16745 },
16746 IsExistLoadingPanel: function() {
16747  return !!this.GetLoadingDiv();
16748 },
16749 LockAnimation: function() {
16750  this.animationLockCount++;
16751 },
16752 UnlockAnimation: function() {
16753  this.animationLockCount--;
16754 },
16755 IsAnimationLocked: function() {
16756  return this.animationLockCount > 0;
16757 },
16758 IsAnimationAllowed: function() {
16759  return this.enableAnimation && !this.IsAnimationLocked();
16760 },
16761 SetWindowSizeByIndexCore: function(index, width, height, isWindowCollapsed) {
16762  this.SetClientWindowSizeLite(index, width, height, isWindowCollapsed);
16763  var iFrame = this.GetWindowIFrame(index);
16764  if(iFrame && !isWindowCollapsed) {
16765   var winElememnt = this.GetWindowElement(index);
16766   var realWidth = winElememnt.offsetWidth;
16767   var realHeight = winElememnt.offsetHeight;
16768   ASPx.SetStyles(iFrame, { width: realWidth, height: realHeight });
16769  }
16770  this.UpdateWindowsStateCookie();
16771 },
16772 SetWindowSizeByIndex: function(index, width, height) {
16773  var minWidth = this.GetWindowMinWidth(index);
16774  var minHeight = this.GetWindowMinHeight(index);
16775  var maxWidth = this.GetWindowMaxWidth(index);
16776  var maxHeight = this.GetWindowMaxHeight(index);
16777  if(minWidth)
16778   width = Math.max(width, minWidth);
16779  if(minHeight)
16780   height = Math.max(height, minHeight);
16781  if(maxWidth)
16782   width = Math.min(width, maxWidth);
16783  if(maxHeight)
16784   height = Math.min(height, maxHeight);
16785  var isWindowMaximized = this.GetIsMaximized(index);
16786  var isWindowCollapsed = this.GetIsCollapsed(index);
16787  var isWindowMaximizedAndCollapsed = (isWindowMaximized && isWindowCollapsed);
16788  if(this.SizeCanBeSet(index, isWindowMaximizedAndCollapsed)) {
16789   if(!this.CollapseExecuting() && !this.MaximizationExecuting() && !this.ResizingForMaxWindowLocked()) {
16790    this.SetWindowCachedSize(index, width, height);
16791    this.SetIsResized(index, true);
16792   }
16793   if(isWindowCollapsed && !this.MaximizationExecuting() && !this.ResizingForMaxWindowLocked()) {
16794    this.SetWindowCachedSize(index, width, height);
16795    this.UpdateRestoredWindowSize(index, width, height);
16796    height = 0;
16797   }
16798   if(isWindowMaximized && !this.CollapseExecuting() && !this.ResizingForMaxWindowLocked()) {
16799    this.SetWindowCachedSize(index, width, height);
16800    this.UpdateRestoredWindowSize(index, width, height);
16801   } else {
16802    this.SetWindowSizeByIndexCore(index, width, height, isWindowCollapsed);
16803   }
16804  } else
16805   this.SetWindowCachedSize(index, width, height);
16806 },
16807 SizeCanBeSet: function(index, isWindowMaximizedAndCollapsed) {
16808  return this.InternalIsWindowDisplayed(index) && this.IsWindowElementsIDAssigned(index) && (!isWindowMaximizedAndCollapsed || this.ResizingForMaxWindowLocked());
16809 },
16810 RestoreWindowSizeFromCache: function(index) {
16811  var cachedSize = this.GetWindowCachedSize(index);
16812  if(cachedSize != null) {
16813   this.SetWindowSizeByIndex(index, cachedSize.width, cachedSize.height);
16814   this.ResetWindowCachedSize(index);
16815  }
16816 },
16817 CollapseExecuting: function() {
16818  return false;
16819 },
16820 MaximizationExecuting: function() {
16821  return false;
16822 },
16823 ResizingForMaxWindowLocked: function() {
16824  return false;
16825 },
16826 IsResizeAllowed: function(index) {
16827  return this.allowResize;
16828 },
16829 GetWindowDimensionByIndex: function(index, isWidth, forceFromCache) {
16830  var cachedSize = this.GetWindowCachedSize(index);
16831  var dimensionValue = null;
16832  if(forceFromCache == undefined && !this.GetWindowElement(index))
16833   forceFromCache = true;
16834  if(cachedSize && forceFromCache)
16835   dimensionValue = isWidth ? cachedSize.width : cachedSize.height;
16836  if(dimensionValue)
16837   return dimensionValue;
16838  else {
16839   var element = this.GetWindowElement(index);
16840   var sizeFromDOM = 0;
16841   if(this.GetIsCollapsed(index)) {
16842    var headerCell = this.GetWindowHeaderElement(index);
16843    sizeFromDOM = isWidth ? headerCell.offsetWidth : headerCell.offsetHeight;
16844   }
16845   else {
16846    var mainCell = this.GetWindowMainCell(element);
16847    sizeFromDOM = isWidth ? mainCell.offsetWidth : mainCell.offsetHeight;
16848   }
16849   if(sizeFromDOM === 0 && cachedSize)
16850    sizeFromDOM = isWidth ? cachedSize.width : cachedSize.height;
16851   return sizeFromDOM;
16852  }
16853 },
16854 SetWindowSize: function(window, width, height) {
16855  var index = (window != null) ? window.index : -1;
16856  this.SetWindowSizeByIndex(index, width, height);
16857 },
16858 SetSize: function(width, height) {
16859  this.SetWindowSize(null, width, height);
16860 },
16861 SetWidth: function(width) {
16862  var height = this.GetHeight();
16863  this.SetSize(width, height);
16864 },
16865 SetHeight: function(height) {
16866  var width = this.GetWidth();
16867  this.SetSize(width, height);
16868 },
16869 GetHeight: function() {
16870  return this.GetWindowDimensionByIndex(-1, false, false);
16871 },
16872 GetWidth: function() {
16873  return this.GetWindowDimensionByIndex(-1, true, false);
16874 },
16875 CanBeClosedByClickOnElement: function(index, srcElement, posX, id) {
16876  return srcElement === null || ASPx.GetParentById(srcElement, id) === null;
16877 },
16878 OnMouseDown: function(evt, index, isDraggingAllowed, pointOnScrollBar) {
16879  if(ASPx.Evt.IsLeftButtonPressed(evt)) {
16880   if((this.IsResizeAllowed(index) || isDraggingAllowed) && !this.prohibitClearSelectionOnMouseDown) 
16881    ASPx.Selection.Clear();
16882   var isResizing = this.ProcessResizeOnMouseDown(evt, index);
16883   var clickedOnScroll = pointOnScrollBar && this.GetEnableContentScrolling(index);
16884   if(isDraggingAllowed && !isResizing && !clickedOnScroll && !this.GetIsPinned(index) && !this.GetIsMaximized(index))
16885    this.OnDragStart(evt, index);
16886  }
16887 },
16888 OnMouseMove: function(evt, index) {
16889  if(this.allowResize && !this.GetIsCollapsed(index) && !this.GetIsMaximized(index))
16890   this.CreateResizeCursorInfo(evt, index);
16891 },
16892 CreateResizeCursorInfo: function(evt, index) {
16893  var element = this.GetWindowElement(index);
16894  var mainCell = this.GetWindowMainCell(element);
16895  var clientWindow = this.GetWindowClientTable(index);
16896  var headerElement = this.GetWindowHeaderElement(index);
16897  var left = ASPx.GetAbsoluteX(mainCell);
16898  var top = ASPx.GetAbsoluteY(mainCell);
16899  var x = ASPx.Evt.GetEventX(evt);
16900  var y = ASPx.Evt.GetEventY(evt);
16901  var mainCellWidth = mainCell.offsetWidth;
16902  var mainCellHeight = mainCell.offsetHeight;
16903  var leftOffset = Math.abs(x - left);
16904  var rightOffset = Math.abs(x - left - mainCellWidth);
16905  var topOffset = Math.abs(y - top);
16906  var bottomOffset = Math.abs(y - top - mainCellHeight);
16907  var cursorInfo = this.CreateResizeBorderCursorInfo(index, leftOffset, rightOffset, topOffset, bottomOffset);
16908  var grip = this.GetWindowSizeGripElement(index);
16909  if(grip) {
16910   var gripCursorInfo = this.CreateGripCursorInfo(index, mainCell, grip, leftOffset, rightOffset, bottomOffset);
16911   if(gripCursorInfo)
16912    cursorInfo = gripCursorInfo;
16913  }
16914  this.UpdateResizeCursor(index, clientWindow, cursorInfo.verticalDirection, cursorInfo.horizontalDirection);
16915  this.UpdateResizeCursor(index, mainCell, cursorInfo.verticalDirection, cursorInfo.horizontalDirection);
16916  if(headerElement)
16917   this.UpdateResizeCursor(index, headerElement, cursorInfo.verticalDirection, cursorInfo.horizontalDirection);
16918  return cursorInfo;
16919 },
16920 UpdateResizeCursor: function(index, element, verticalDirection, horizontalDirection) {
16921  var cursor = verticalDirection + horizontalDirection;
16922  if(cursor == "")
16923   this.HideTemporaryCursor(element);
16924  else {
16925   cursor += "-resize";
16926   this.ShowTemporaryCursor(element, cursor);
16927  }
16928 },
16929 CreateGripCursorInfo: function(index, mainCell, grip, leftOffset, rightOffset, bottomOffset) {
16930  var gripWidth = this.rtl
16931   ? ASPx.GetAbsoluteX(grip) - ASPx.GetAbsoluteX(mainCell) + grip.offsetWidth
16932   : mainCell.offsetWidth - (ASPx.GetAbsoluteX(grip) - ASPx.GetAbsoluteX(mainCell));
16933  var gripHeight = mainCell.offsetHeight - (ASPx.GetAbsoluteY(grip) - ASPx.GetAbsoluteY(mainCell));
16934  if(gripHeight > bottomOffset) {
16935   if(this.rtl && gripWidth > leftOffset)
16936    return new PCResizeCursorInfo("w", "s", leftOffset, bottomOffset);
16937   if(gripWidth > rightOffset)
16938    return new PCResizeCursorInfo("e", "s", rightOffset, bottomOffset);
16939  }
16940  return null;
16941 },
16942 CreateResizeBorderCursorInfo: function(index, leftOffset, rightOffset, topOffset, bottomOffset) {
16943  var ResizeBorderSize = this.ResizeBorderSize;
16944  var verticalDirection = this.GetResizeVerticalCourse(ResizeBorderSize, topOffset, bottomOffset);
16945  ResizeBorderSize = verticalDirection != "" ? this.ResizeCornerBorderSize : this.ResizeBorderSize;
16946  var horizontalDirection = this.GetResizeHorizontalCourse(ResizeBorderSize, leftOffset, rightOffset);
16947  if(verticalDirection == "" && horizontalDirection != "")
16948   verticalDirection = this.GetResizeVerticalCourse(this.ResizeCornerBorderSize, topOffset, bottomOffset);
16949  var horizontalOffset = leftOffset < rightOffset ? leftOffset : rightOffset;
16950  var verticalOffset = topOffset < bottomOffset ? topOffset : bottomOffset;
16951  return new PCResizeCursorInfo(horizontalDirection, verticalDirection, horizontalOffset, verticalOffset);
16952 },
16953 GetResizeVerticalCourse: function(ResizeBorderSize, topOffset, bottomOffset) {
16954  if(ResizeBorderSize > topOffset) return "n";
16955  if(ResizeBorderSize > bottomOffset) return "s";
16956  return "";
16957 },
16958 GetResizeHorizontalCourse: function(ResizeBorderSize, leftOffset, rightOffset) {
16959  if(ResizeBorderSize > leftOffset) return "w";
16960  if(ResizeBorderSize > rightOffset) return "e";
16961  return "";
16962 },
16963 ProcessResizeOnMouseDown: function(evt, index) {
16964  var isResizing = false;
16965  if(this.IsResizeAllowed(index) && !this.GetIsCollapsed(index) && !this.GetIsMaximized(index)) {
16966   var eventSourceControl = ASPx.Evt.GetEventSource(evt);
16967   var eventFromPopupContainer = ASPx.ElementHasCssClass(eventSourceControl, PopupControlCssClasse
16967s.ContentCssClassName) ||
16968    !ASPx.GetParentByClassName(eventSourceControl, PopupControlCssClasses.ContentCssClassName) ||
16969    this.eventFromOwnPopupContent(eventSourceControl);
16970   if(eventFromPopupContainer && getComputedStyle(evt.target).cursor !== "pointer")
16971    isResizing = this.OnResizeStart(evt, index);
16972  }
16973  if(isResizing && ASPx.Browser.WebKitTouchUI)
16974   aspxGetPopupControlCollection().OverStop();
16975  return isResizing;
16976 },
16977 eventFromOwnPopupContent: function(element) {
16978  while(element != null) {
16979   if(element.tagName == "BODY")
16980    return false;
16981   if(element.style.position == "absolute") {
16982    var windowIndex = this.GetWindowIndex(element);
16983    var isPopupWindow = !isNaN(windowIndex);
16984    if(isPopupWindow) {
16985     if(this.GetWindowElementId(windowIndex) == element.id)
16986      return true;
16987     return false;
16988    } else {
16989     var elementIsOtherPopup = element.style.zIndex >= this.GetPopupControlZIndex(); 
16990     if(elementIsOtherPopup)
16991      return false;
16992    }
16993   }
16994   element = element.parentNode;
16995  }
16996  return false;
16997 },
16998 OnResizeStart: function(evt, index) {
16999  if(!aspxGetPopupControlCollection().IsResizeInint()) {
17000   var cursor = this.CreateResizeCursorInfo(evt, index);
17001   if(cursor.course != "") {
17002    aspxGetPopupControlCollection().setIframesMouseMoveEnabled(false);
17003    this.EnsureWindowCoverDiv(index);
17004    this.SetIsResized(index, true);
17005    var resizePanel = this.CreateResizePanel(index);
17006    this.UpdateResizeCursor(index, resizePanel, cursor.verticalDirection, cursor.horizontalDirection);
17007    aspxGetPopupControlCollection().InitResizeObject(this, index, cursor, resizePanel);
17008    this.OnResize(evt, index, cursor, resizePanel);
17009   }
17010  }
17011  return aspxGetPopupControlCollection().IsResizeInint();
17012 },
17013 OnResizeStop: function(evt, index, cursor, resizePanel) {
17014  if(this.IsResizeAllowed(index)) {
17015   aspxGetPopupControlCollection().setIframesMouseMoveEnabled(true);
17016   this.RemoveWindowCoverDiv();
17017   var windowElement;
17018   if(!this.isLiveResizingMode) {
17019    windowElement = this.GetWindowElement(index);
17020    ASPx.GetControlCollection().CollapseControls(windowElement);
17021    this.OnResizeWindow(index, cursor, resizePanel);
17022   }
17023   this.CreateResizeCursorInfo(evt, index);
17024   this.UpdateWindowsStateCookie();
17025   this.RaiseResize(index);
17026   if(!this.isLiveResizingMode)
17027    ASPx.GetControlCollection().AdjustControls(windowElement, true);
17028  }
17029  this.ResetResizeSessionCache();
17030 },
17031 OnResizeWindow: function(index, cursor, resizePanel) {
17032  var windowElement = this.GetWindowElement(index);
17033  var resizePanelDimensions = this.GetResizePanelDimensions();
17034  var left = resizePanelDimensions.left;
17035  var top = resizePanelDimensions.top;
17036  this.SetClientWindowSizeLite(index, resizePanelDimensions.offsetWidth, resizePanelDimensions.offsetHeight);
17037  if(this.fixedBottom)
17038   top = this.fixedBottom - windowElement.offsetHeight;
17039  if(this.fixedRight)
17040   left = this.fixedRight - windowElement.offsetWidth;
17041  this.fixedBottom = null;
17042  this.fixedRight = null;
17043  if(cursor.verticalDirection === "n")
17044   this.ChangePosOnResizeWindow(top, windowElement, false);
17045  if(cursor.horizontalDirection === "w")
17046   this.ChangePosOnResizeWindow(left, windowElement, true);
17047  if(this.InternalIsWindowVisible(index)) 
17048   this.DoShowWindowIFrame(index, left, top, ASPx.InvalidDimension, ASPx.InvalidDimension);
17049 },
17050 ChangePosOnResizeWindow: function(pos, windowElement, isX) {
17051  if(ASPx.Browser.IE && ASPx.Browser.Version >= 10)
17052   pos = Math.round(pos);
17053  windowElement.style[isX ? "left" : "top"] = pos + "px";
17054 },
17055 SetClientWindowSizeLite: function(index, width, height, isWindowCollapsed) {
17056  this.RaiseBeforeResizing(index);
17057  this.SetClientWindowSizeCoreLite(index, width, height, isWindowCollapsed);
17058  if(!this.IsRaiseAfterResizingLocked())
17059   this.RaiseAfterResizing(index);
17060 },
17061 SetClientWindowSizeCoreLite: function(index, width, height, isWindowCollapsed) {
17062  var contentUrl = this.GetWindowContentIFrameUrl(index);
17063  var needToHideContent = !contentUrl;
17064  var element = this.GetWindowElement(index);
17065  var contentWrapper = this.GetWindowContentWrapperElement(index);
17066  var contentElement = this.GetWindowContentElement(index);
17067  var scrollTop = null,
17068   scrollLeft = null;
17069  if(ASPx.Browser.IE && this.GetEnableContentScrolling(index)) {
17070   scrollTop = contentElement.scrollTop;
17071   scrollLeft = contentElement.scrollLeft;
17072  }
17073  var contentIframeElement = this.GetWindowContentIFrameElement(index);
17074  var iframeHeightCorrectionOnFirstShow = height > 0;
17075  if(contentIframeElement && (this.GetWindowIsShown(index) || iframeHeightCorrectionOnFirstShow))
17076   contentIframeElement.style.height = "0px";
17077  contentWrapper.style.height = "";
17078  contentWrapper.style.width = "";
17079  contentElement.style.height = "";
17080  contentElement.style.width = "";
17081  var contentElementChildrenScroll = null,
17082   contentElementChildren = null;
17083  if(needToHideContent) {
17084   if(ASPx.Browser.IE) {
17085    var contentElementChildren = this.GetContentElementChildren(index, contentElement),
17086     contentElementChildrenScroll = this.GetContentElementChildrenScroll(index, contentElementChildren);
17087   }
17088   contentElement.style.display = "none";
17089  }
17090  var hasAnyScrollBars = this.HasAnyScrollBars(index);
17091  var elementsDisplayValue = this.GetWindowElementDisplayValue(hasAnyScrollBars, height);
17092  element.style.display = elementsDisplayValue;
17093  if(!this.GetIsCollapsed(index))
17094   contentWrapper.style.display = elementsDisplayValue;
17095  if(ASPx.IsExists(width)) {
17096   var actualWidth = width - this.GetElementBordersAndPaddings(index, element, true);
17097   if(actualWidth <= 0)
17098    actualWidth = ASPx.Browser.WebKitFamily ? 1 : 0; 
17099   element.style.width = actualWidth + "px";
17100  }
17101  var actualHeight;
17102  if(ASPx.IsExists(height)) {
17103   actualHeight = height - this.GetElementBordersAndPaddings(index, element, false);
17104   if(actualHeight < 0)
17105    actualHeight = 0;
17106   element.style.height = actualHeight + "px";
17107  }
17108  this.CorrectWindowSizeGripPositionLite(index);
17109  this.CorrectWindowHeaderText(index);
17110  this.SetContentWrapperHeightLite(index, actualHeight, element, contentWrapper);
17111  var correctContentElementSize = hasAnyScrollBars || contentElement.style.overflow == "hidden" || contentElement.style.overflowX == "hidden" || contentElement.style.overflowY == "hidden";
17112  if((correctContentElementSize || contentUrl) && height) {
17113   if(contentElement !== contentWrapper) {
17114    var contentHeight = ASPx.GetClearClientHeight(contentWrapper);
17115    if(contentHeight < 0)
17116     contentHeight = 0;
17117    contentElement.style.height = contentHeight + "px";
17118   }
17119  }
17120  if(correctContentElementSize && width && contentElement !== contentWrapper)
17121   contentElement.style.width = ASPx.GetClearClientWidth(contentWrapper) + "px";
17122  contentElement.style.display = this.getContentElementDisplay(correctContentElementSize, contentUrl);
17123  if(ASPx.IsExists(contentElementChildrenScroll) && contentElementChildrenScroll.length > 0) {
17124   for(var i = 0; i < contentElementChildrenScroll.length; i++) {
17125    var childScroll = contentElementChildrenScroll[i],
17126     childIndex = childScroll[0],
17127     childScrollLeft = childScroll[1],
17128     childScrollTop = childScroll[2];
17129    if(!!childScrollLeft)
17130     contentElementChildren[childIndex].scrollLeft = childScrollLeft;
17131    if(!!childScrollTop)
17132     contentElementChildren[childIndex].scrollTop = childScrollTop;
17133   }
17134  }
17135  if(ASPx.Browser.IE && this.GetEnableContentScrolling(index)) {
17136   contentElement.scrollTop = scrollTop;
17137   contentElement.scrollLeft = scrollLeft;
17138  }
17139  if(contentIframeElement)
17140   contentIframeElement.style.height = "100%";
17141  this.SetWindowWidth(index, width);
17142  this.SetWindowHeight(index, height);
17143  if(isWindowCollapsed)
17144   this.ResetWindowHeight(index);
17145 },
17146 IsRaiseAfterResizingLocked: function() {
17147  return false;
17148 },
17149 CreateResizePanel: function(index) {
17150  var element = this.GetWindowElement(index);
17151  var resizePanel = document.createElement("DIV");
17152  element.parentNode.appendChild(resizePanel);
17153  resizePanel.style.overflow = "hidden";
17154  resizePanel.style.position = "absolute";
17155  resizePanel.style.zIndex = this.GetPopupControlZIndex() + aspxGetPopupControlCollection().visiblePopupWindowIds.length * 2 + 2;
17156  if(!this.isLiveResizingMode)
17157   resizePanel.style.border = "black 1px dotted";
17158  return resizePanel;
17159 },
17160 OnResize: function(evt, index, cursor, resizePanel) {
17161  this.OnResizePanelLite(evt, index, cursor, resizePanel);
17162  if(this.isLiveResizingMode)
17163   this.OnResizeWindow(index, cursor, resizePanel);
17164  ASPx.Selection.Clear();
17165  if(ASPx.Browser.WebKitTouchUI)
17166   evt.preventDefault();
17167  if(this.GetIsPinned(index))
17168   this.HoldPosition(index, true, resizePanel);
17169 },
17170 OnResizePanelLite: function(evt, index, cursor, resizePanel) {
17171  var x = ASPx.Evt.GetEventX(evt);
17172  var y = ASPx.Evt.GetEventY(evt);
17173  var element = this.GetWindowElement(index);
17174  if(ASPx.Browser.IE && ASPx.Browser.Version >= 10) {
17175   x = Math.round(x);
17176   y = Math.round(y);
17177  }
17178  var elementTop = ASPx.GetAbsoluteY(element);
17179  var elementLeft = ASPx.GetAbsoluteX(element);
17180  var newLeft = ASPx.PxToInt(element.style.left);
17181  var newTop = ASPx.PxToInt(element.style.top);
17182  var newWidth = element.offsetWidth;
17183  var newHeight = element.offsetHeight;
17184  if(cursor.verticalDirection == "n") {
17185   if(!this.fixedBottom)
17186    this.fixedBottom = newTop + newHeight;
17187   newHeight += elementTop - y + cursor.verticalOffset;
17188   newTop = ASPx.PrepareClientPosForElement(y - cursor.verticalOffset, element, false);
17189  }
17190  if(cursor.verticalDirection == "s") {
17191   newHeight = y - elementTop + cursor.verticalOffset;
17192   this.fixedBottom = null;
17193  }
17194  if(cursor.horizontalDirection == "w") {
17195   if(!this.fixedRight)
17196    this.fixedRight = newLeft + newWidth;
17197   newWidth += elementLeft - x + cursor.horizontalOffset;
17198   newLeft = ASPx.PrepareClientPosForElement(x - cursor.horizontalOffset, element, true);
17199  }
17200  if(cursor.horizontalDirection == "e") {
17201   newWidth = x - elementLeft + cursor.horizontalOffset;
17202   this.fixedRight = null;
17203  }
17204  if(newWidth > 0 && newHeight > 0) {
17205   var minWidth = this.GetWindowMinWidth(index);
17206   var maxWidth = this.GetWindowMaxWidth(index);
17207   if(minWidth && newWidth < minWidth)
17208    newWidth = minWidth;
17209   if(maxWidth && newWidth > maxWidth)
17210    newWidth = maxWidth;
17211   var minHeight = this.GetWindowMinHeight(index);
17212   var maxHeight = this.GetWindowMaxHeight(index);
17213   if(minHeight && newHeight < minHeight)
17214    newHeight = minHeight;
17215   if(maxHeight && newHeight > maxHeight)
17216    newHeight = maxHeight;
17217   if(ASPx.Browser.IE && ASPx.Browser.Version >= 10) {
17218    newLeft = Math.round(newLeft);
17219    newTop = Math.round(newTop);
17220    newHeight = Math.round(newHeight);
17221    newWidth = Math.round(newWidth);
17222   }
17223   this.SetResizePanelDimensions(newLeft, newTop, newWidth, newHeight);
17224   var widthWithoutBorders = newWidth - this.getLeftRightBordersAndPaddingsSummaryValue(resizePanel);
17225   var heightWithoutBorders = newHeight - this.getTopBottomBordersAndPaddingsSummaryValue(resizePanel);
17226   ASPx.SetStyles(resizePanel, {
17227    left: newLeft, top: newTop,
17228    width: widthWithoutBorders, height: heightWithoutBorders
17229   });
17230   this.SetWindowLeft(index, elementLeft);
17231   this.SetWindowTop(index, elementTop);
17232  }
17233 },
17234 SetResizePanelDimensions: function(left, top, offsetWidth, offsetHeight) {
17235  var cache = this.GetResizeSessionCache();
17236  cache.resizePanelDimensions = {
17237   left: left,
17238   top: top,
17239   offsetWidth: offsetWidth,
17240   offsetHeight: offsetHeight
17241  };
17242 },
17243 GetResizePanelDimensions: function() {
17244  var cache = this.GetResizeSessionCache();
17245  return cache.resizePanelDimensions;
17246 },
17247 ResetResizeSessionCache: function() {
17248  this.resizeSessionCache = {};
17249 },
17250 GetResizeSessionCache: function() {
17251  return aspxGetPopupControlCollection().IsResizeInint() ? this.resizeSessionCache : {};
17252 },
17253 EnsureWindowCoverDiv: function(index) {
17254  this.windowCoverDiv = this.CreateCoverDiv(index);
17255  var windowElement = this.GetWindowElement(index);
17256  windowElement.parentNode.appendChild(this.windowCoverDiv);
17257 },
17258 CreateCoverDiv: function(index) {
17259  var coverDiv = document.createElement("DIV");
17260  ASPx.SetStyles(coverDiv, {
17261   position: "fixed",
17262   left: 0,
17263   top: 0,
17264   width: "100%",
17265   height: "100%"
17266  });
17267  return coverDiv;
17268 },
17269 RemoveWindowCoverDiv: function() {
17270  if(!!this.windowCoverDiv) {
17271   this.windowCoverDiv.parentNode.removeChild(this.windowCoverDiv);
17272   this.windowCoverDiv = null;
17273  }
17274 },
17275 OnDrag: function(index, x, y, xClientCorrection, yClientCorrection) {
17276  var element = this.GetWindowElement(index);
17277  if(element != null) {
17278   ASPx.SetStyles(element, { left: x, top: y });
17279   xClientCorrection = typeof (xClientCorrection) != "undefined" ? xClientCorrection : 0;
17280   yClientCorrection = typeof (yClientCorrection) != "undefined" ? yClientCorrection : 0;
17281   this.SetWindowLeft(index, x + xClientCorrection);
17282   this.SetWindowTop(index, y + yClientCorrection);
17283   var iFrame = element.overflowElement;
17284   if(iFrame)
17285    ASPx.SetStyles(iFrame, { left: x, top: y });
17286   if(ASPx.Browser.Opera)
17287    ASPx.Selection.Clear();
17288  }
17289 },
17290 OnDragStop: function(index) {
17291  this.HideDragCursor(index);
17292  this.UpdateWindowsStateCookie();
17293  if(this.GetWindowContentIFrameElement(index))
17294   this.SetIframeVisibleForDragging(index, true);
17295 },
17296 OnDragStart: function(evt, index) {
17297  this.SetIsDragged(index, true);
17298  this.ShowDragCursor(index);
17299  if(this.GetWindowContentIFrameElement(index))
17300   this.SetIframeVisibleForDragging(index, false);
17301  this.InitDragInfo(index, evt);
17302 },
17303 HideIframeElementBeforeDragging: function() {
17304 },
17305 InitDragInfo: function(index, evt) {
17306  var element = this.GetWindowElement(index);
17307  var gragXOffset = ASPx.GetAbsoluteX(element) - ASPx.Evt.GetEventX(evt);
17308  var gragYOffset = ASPx.GetAbsoluteY(element) - ASPx.Evt.GetEventY(evt);
17309  var xClientCorrection = this.GetDragCorrection(index, element, true);
17310  var yClientCorrection = this.GetDragCorrection(index, element, false);
17311  gragXOffset -= xClientCorrection;
17312  gragYOffset -= yClientCorrection;
17313  aspxGetPopupControlCollection().InitDragObject(this, index, gragXOffset, gragYOffset, xClientCorrection, yClientCorrection);
17314 },
17315 GetDragCorrection: function(index, element, isX) {
17316  return ASPx.GetPositionElementOffset(element, isX);
17317 },
17318 ShowDragCursor: function(index) {
17319  var dragElement = this.GetDragElement(index);
17320  if(dragElement)
17321   this.ShowTemporaryCursor(dragElement, "move");
17322 },
17323 ShowTemporaryCursor: function(element, cursor) {
17324  ASPx.Attr.ChangeStyleAttribute(element, "cursor", cursor);
17325 },
17326 HideDragCursor: function(index) {
17327  var dragElement = this.GetDragElement(index);
17328  if(dragElement != null)
17329   this.HideTemporaryCursor(dragElement);
17330 },
17331 GetDragElement: function(index) {
17332  var headerElement = this.GetWindowHeaderElement(index);
17333  var element = this.GetWindowElement(index);
17334  if(element != null)
17335   return (headerElement != null ? headerElement : this.GetWindowMainCell(element));
17336  return null;
17337 },
17338 HideTemporaryCursor: function(element) {
17339  ASPx.Attr.RestoreStyleAttribute(element, "cursor");
17340 },
17341 OnDocumentKeyDown: function(evt, popupWindow) {
17342  var handler = this.keyDownHandlers && this.keyDownHandlers[ASPx.GetShortcutCode(evt.keyCode, evt.ctrlKey, evt.shiftKey, evt.altKey)];
17343  if(handler)
17344   handler(this.GetWindowIndex(popupWindow));
17345 },
17346 OnEscKeyDown: function(index) {
17347  if(this.GetEnableCloseByEsc(index))
17348   this.DoHideWindow(index, false, ASPxClientPopupControlCloseReason.Escape);
17349 },
17350 OnRefreshButtonClick: function(index) {
17351  var contentIFrame = this.GetWindowContentIFrameElement(index);
17352  if(contentIFrame)
17353   this.RefreshWindowContentUrl(this.GetWindow(index));
17354  else
17355   this.PerformWindowCallback(this.GetWindow(index));
17356 },
17357 OnCloseButtonClick: function(index) {
17358  this.RaiseCloseButtonClick(index);
17359  if(this.GetWindowCloseAction(index) != "None")
17360   this.DoHideWindow(index, false, ASPxClientPopupControlCloseReason.CloseButton);
17361 },
17362 Show: function(popupElementIndex) {
17363  this.ShowWindowByIndex(-1, popupElementIndex);
17364 },
17365 Hide: function() {
17366  this.HideWindow(null);
17367 },
17368 HideWindow: function(window) {
17369  var index = (window != null) ? window.index : -1;
17370  this.DoHideWindow(index, false, ASPxClientPopupControlCloseReason.API);
17371 },
17372 RaiseEventByIndex: function(index, event, argsName) {
17373  if(!event.IsEmpty()) {
17374   var window = index < 0 ? null : this.GetWindow(index),
17375    args = new argsName(window);
17376   event.FireEvent(this, args);
17377  }
17378 },
17379 RaiseCloseButtonClick: function(index) {
17380  this.RaiseEventByIndex(index, this.CloseButtonClick, ASPxClientPopupWindowEventArgs);
17381 },
17382 RaiseShown: function(index) {
17383  this.RaiseEventByIndex(index, this.Shown, ASPxClientPopupWindowEventArgs);
17384 },
17385 RaisePopUp: function(index) {
17386  this.RaiseEventByIndex(index, this.PopUp, ASPxClientPopupWindowEventArgs);
17387 },
17388 RaiseBeforeResizing: function(index) {
17389  this.RaiseEventByIndex(index, this.BeforeResizing, ASPxClientPopupWindowEventArgs);
17390 },
17391 RaiseAfterResizing: function(index) {
17392  this.RaiseEventByIndex(index, this.AfterResizing, ASPxClientPopupWindowEventArgs);
17393 },
17394 RaiseClosing: function(index, closeReason) {
17395  var window = index < 0 ? null : this.GetWindow(index);
17396  var cancel = false;
17397  if(!this.Closing.IsEmpty()) {
17398   var args = new ASPxClientPopupWindowCancelEventArgs(window, closeReason);
17399   this.Closing.FireEvent(this, args);
17400   cancel = args.cancel;
17401  }
17402  return cancel;
17403 },
17404 RaiseCloseUp: function(index, closeReason) {
17405  var window = index < 0 ? null : this.GetWindow(index);
17406  if(!this.CloseUp.IsEmpty()) {
17407   var args = new ASPxClientPopupWindowCloseUpEventArgs(window, closeReason);
17408   this.CloseUp.FireEvent(this, args);
17409  }
17410 },
17411 RaiseResize: function(index, resizeState) {
17412  var window = index < 0 ? null : this.GetWindow(index);
17413  if(!this.Resize.IsEmpty()) {
17414   if(!resizeState)
17415    resizeState = ASPxClientPopupControlResizeState.Resized;
17416   var args = new ASPxClientPopupWindowResizeEventArgs(window, resizeState);
17417   this.Resize.FireEvent(this, args);
17418  }
17419 },
17420 RaisePopupOnShow: function(isMoving, index) {
17421  if(!isMoving) {
17422   this.RaisePopUp(index);
17423   if(!this.IsAnimationAllowed())
17424    this.OnWindowShown(index);
17425  }
17426 },
17427 OnActivate: function(index, evt) {
17428  var element = this.GetWindowElement(index);
17429  if(element != null)
17430   aspxGetPopupControlCollection().ActivateWindowElement(element, evt, this.GetPopupType(), this.GetDefaultZIndexFromServer(), this.GetPopupControlZIndex());
17431 },
17432 OnPWHBClickCore: function(evt, index, method) {
17433  this.OnActivate(index, evt);
17434  if(ASPx.TouchUIHelper.handleFastTapIfRequired(evt,
17435   function() { this[method](index); }.aspxBind(this), true)) {
17436   return;
17437  }
17438  if(ASPx.Browser.Opera)
17439   ASPx.Evt.EmulateDocumentOnMouseDown(evt);
17440  this[method](index);
17441 },
17442 OnScroll: function(evt, index) {
17443  if(this.HasIframeOnIos(index))
17444   this.ResetWebkitScrolling(this.getTouchScrollerElement(index), 0);
17445  if(!this.GetIsPinned(index) || (this.lockScroll > 0)) return;
17446  this.AdjustPinPositionWhileScroll(index);
17447 },
17448 ResetWebkitScrolling: function(scrollElement, timeout) {
17449  if(scrollElement.scrollTop === 0) {
17450   var styleName = "-webkit-overflow-scrolling";
17451   scrollElement.style[styleName] = "auto";
17452   window.setTimeout(function() {
17453    scrollElement.style[styleName] = "touch";
17454   }.aspxBind(this), timeout);
17455  }
17456 },
17457 HaveSpecialDivForAnimation: function() {
17458  return this.enableAnimation;
17459 },
17460 HasIframeOnIos: function(index) {
17461  return ASPx.Browser.MacOSMobilePlatform && !!this.GetWindowContentIFrameElement(index);
17462 },
17463 WindowIsModal: function(index) {
17464  return this.GetPropertyValue(index, "modal");
17465 },
17466 GetIsPopuped: function(index) {
17467  if(0 <= index && index < this.GetWindowCountCore())
17468   return this.windowsIsPopupedList[index];
17469  return this.defaultIsPopuped;
17470 },
17471 SetIsPopuped: function(index, isPopuped) {
17472  if(0 <= index && index < this.GetWindowCountCore())
17473   this.windowsIsPopupedList[index] = isPopuped;
17474  this.defaultIsPopuped = isPopuped;
17475 },
17476 GetIsMaximized: function(index) {
17477  return false;
17478 },
17479 GetIsMaximizedInit: function(index) {
17480  return false;
17481 },
17482 GetCurrentLeft: function(index) {
17483  return this.GetPosition(index, true);
17484 },
17485 GetCurrentTop: function(index) {
17486  return this.GetPosition(index, false);
17487 },
17488 GetIsPinned: function(index) {
17489  return false;
17490 },
17491 GetIsCollapsed: function(index) {
17492  return false;
17493 }, 
17494 needToHidePinnedOutFromViewPort: function(index) {
17495  return false;
17496 },
17497 GetHideBodyScrollWhenModal: function(index) {
17498  return false;
17499 },
17500 GetCanScrollViewPort: function(index) {
17501  return false;
17502 },
17503 GetEnableContentScrolling: function(index) {
17504  return false;
17505 },
17506 AutoUpdateElementsPosition: function() {
17507 },
17508 GetWindowChild: function(index, idPostfix) {
17509  var elem = this.GetWindowElement(index);
17510  if(elem)
17511   return ASPx.GetChildById(elem, this.name + idPostfix);
17512  return null;
17513 },
17514 GetWindowIndex: function(element) {
17515  var id = element.id;
17516  var pos = id.lastIndexOf(ASPx.PCWIdSuffix);
17517  return parseInt(id.substr(pos + ASPx.PCWIdSuffix.length));
17518 },
17519 GetWindow: function(index) {
17520  return (0 <= index && index < this.windows.length) ? this.windows[index] : null;
17521 },
17522 DoShowWindowIFrame: function(index, x, y, width, height) {
17523  if(!this.renderIFrameForPopupElements) return;
17524  var element = this.GetWindowElement(index);
17525  var iFrame = this.GetWindowIFrame(index);
17526  if(element && iFrame) {
17527   var cell = this.GetWindowMainCell(element);
17528   if(width < 0)
17529    width = cell.offsetWidth;
17530   if(height < 0)
17531    height = cell.offsetHeight;
17532   ASPx.SetStyles(iFrame, { width: width, height: height });
17533   if(this.IsValidPosition(x) && this.IsValidPosition(y))
17534    ASPx.SetStyles(iFrame, { left: x, top: y });
17535   if(ASPx.Browser.IE || ASPx.Browser.Firefox)
17536    this.ClearWindowIframeBodyInnerHtml(iFrame);
17537   ASPx.SetElementDisplay(iFrame, true);
17538  }
17539 },
17540 IsValidPosition: function(pos) {
17541  return pos !== ASPx.InvalidPosition;
17542 },
17543 DoHideWindowIFrame: function(element) {
17544  if(!this.renderIFrameForPopupElements) return;
17545  var iFrame = element.overflowElement;
17546  if(iFrame)
17547   ASPx.SetElementDisplay(iFrame, false);
17548 },
17549 GetIframeBody: function(iFrame) {
17550  var document = iFrame.contentDocument || iFrame.contentWindow.document;
17551  if(document)
17552   return document.getElementsByTagName('body')[0];
17553 },
17554 ClearWindowIframeBodyInnerHtml: function(iFrame) {
17555  var iFrameBody = this.GetIframeBody(iFrame);
17556  if(iFrameBody)
17557   iFrameBody.innerHTML = "";
17558 },
17559 FindWindowIFrame: function(index) {
17560  return ASPx.GetElementById(this.name + "_DXPWIF" + index);
17561 },
17562 GetWindowIFrame: function(index) {
17563  var element = this.GetWindowElement(index);
17564  var iFrame = element.overflowElement;
17565  if(!iFrame) {
17566   iFrame = this.FindWindowIFrame(index);
17567   element.overflowElement = iFrame;
17568  }
17569  return iFrame;
17570 },
17571 CreateFakeDivForIframe: function(iframe) {
17572  var fakeDiv = document.createElement("div");
17573  ASPx.SetStyles(fakeDiv, { width: iframe.offsetWidth, height: iframe.offsetHeight });
17574  return fakeDiv;
17575 },
17576 CreateIframeCoverDiv: function(iframe, index) {
17577  if(!this.iframeCoverDiv)
17578   this.iframeCoverDiv = [];
17579  if(!this.iframeCoverDiv[index])
17580   this.iframeCoverDiv[index] = this.CreateFakeDivForIframe(iframe);
17581  this.iframeCoverDiv[index].style.position = "absolute";
17582  iframe.parentElement.appendChild(this.iframeCoverDiv[index]);
17583  ASPx.SetAbsoluteX(this.iframeCoverDiv[index], ASPx.GetAbsoluteX(iframe));
17584  ASPx.SetAbsoluteY(this.iframeCoverDiv[index], ASPx.GetAbsoluteY(iframe));
17585 },
17586 RemoveIframeCoverDiv: function(iframe, index) {
17587  iframe.parentElement.removeChild(this.iframeCoverDiv[index]);
17588  this.iframeCoverDiv[index] = null;
17589 },
17590 GetWindowBorderOwnerElement: function(windowElement) {
17591  if(ASPx.ElementHasCssClass(windowElement, PopupControlCssClasses.MainDivLiteCssClass))
17592   return windowElement;
17593  else
17594   return ASPx.GetNodeByClassName(windowElement, PopupControlCssClasses.MainDivLiteCssClass);
17595 },
17596 GetWindowContentIFrameElement: function(index) {
17597  return this.GetWindowChild(index, "_CIF" + index);
17598 },
17599 GetWindowContentElement: function(index) {
17600  return this.GetWindowChild(index, "_PWC" + index);
17601 },
17602 GetWindowContentIFrameElementId: function(index) {
17603  return this.name + "_CIF" + index;
17604 },
17605 GetContentContainer: function(index) {
17606  return this.GetWindowContentElement(index);
17607 },
17608 getTouchScrollerElement: function(index) {
17609  return this.GetContentContainer(index);
17610 },
17611 GetWindowHeaderElement: function(index) {
17612  return this.GetWindowChild(index, "_PWH" + index);
17613 },
17614 GetWindowFooterElement: function(index) {
17615  return this.GetWindowChild(index, "_PWF" + index);
17616 },
17617 GetWindowSizeGripElement: function(index) {
17618  var footer = this.GetWindowFooterElement(index);
17619  if(!footer)
17620   return null;
17621  var descendants = ASPx.GetNodesByClassName(footer, PopupControlCssClasses.SizeGripLiteCssClassName);
17622  return descendants.length > 0 ? descendants[0] : null;
17623 },
17624 GetWindowContentWrapperElement: function(index) {
17625  if(!ASPx.IsExistsElement(this.windowContentElements[index])) {
17626   var windowElem = this.GetWindowElement(index);
17627   var contentWrapperParent = this.GetWindowMainCell(windowElem);
17628   this.windowContentElements[index] = ASPx.GetChildByClassName(contentWrapperParent, PopupControlCssClasses.ContentWrapperCssClassName);
17629  }
17630  return this.windowContentElements[index];
17631 },
17632 GetWindowMainCell: function(element) {
17633  return this.HaveSpecialDivForAnimation() ? ASPx.GetNodeByTagName(element, "DIV", 0) : element;
17634 },
17635 GetWindowModalElement: function(index) {
17636  var element = this.GetWindowElement(index);
17637  if(!element) return;
17638  var modalElement = element.modalElement;
17639  if(!modalElement) {
17640   modalElement = this.FindWindowModalElement(index);
17641   element.modalElement = modalElement;
17642   if(modalElement) {
17643    modalElement.DXModalPopupControl = this;
17644    modalElement.DXModalPopupWindowIndex = index;
17645   }
17646  }
17647  return modalElement;
17648 },
17649 CanManipulateWithModalElement: function(index) {
17650  return this.WindowIsModal(index);
17651 },
17652 GetCurrentZIndex: function(index) {
17653  var element = this.GetWindowElement(index);
17654  if(element != null) {
17655   if(element.style.zIndex != "" && element.style.zIndex != this.GetDefaultZIndexFromServer())
17656    return element.style.zIndex;
17657   return this.GetZIndex(index);
17658  }
17659 },
17660 GetWindowsState: function() {
17661  var state = "";
17662  if(this.HasDefaultWindow()) {
17663   state += this.GetWindowState(-1);
17664  }
17665  return state;
17666 },
17667 GetWindowState: function(index) {
17668  var element = this.GetWindowElement(index);
17669  if(element != null) {
17670   var visibleFlag = (!this.InternalIsWindowVisible(index) || element.isHiding) ? "0" : "1";
17671   var isDraggedFlag = this.GetIsDragged(index) ? "1" : "0";
17672   var zIndex = this.GetCurrentZIndex(index);
17673   var isResized = this.GetIsResized(index);
17674   var isResizedFlag = isResized ? "1" : "0";
17675   var width = null, height=null;
17676   if(isResized) {
17677    width = this.GetWindowWidthInternal(index);
17678    height = this.GetIsCollapsed(index) ? this.GetWindowDimensionByIndex(index, false, true) : this.GetWindowHeightInternal(index);
17679   } else {
17680    width = ASPx.InvalidDimension;
17681    height = ASPx.InvalidDimension;
17682   }
17683   var contentWasLoaded = element.loaded ? "1" : "0";
17684   var left, top;
17685   var isMaximized = this.GetIsMaximized(index);
17686   if(isMaximized && !this.MaximizationExecuting()) {
17687    var restoredWindowData = this.GetRestoredWindowData(index);
17688    left = restoredWindowData.left;
17689    top = restoredWindowData.top;
17690   } else {
17691    left = this.GetCurrentLeft(index);
17692    top = this.GetCurrentTop(index);
17693   }
17694   var isPinned = this.GetIsPinned(index);
17695   if(isPinned) {
17696    left -= ASPx.GetDocumentScrollLeft();
17697    top -= ASPx.GetDocumentScrollTop();
17698   }
17699   left = Math.ceil(left);
17700   top = Math.ceil(top);
17701   var pinFlag = isPinned ? "1" : "0";
17702   var minFlag = this.GetIsCollapsed(index) ? "1" : "0";
17703   var maxFlag = isMaximized || this.GetIsMaximizedInit(index) ? "1" : "0";
17704   return [visibleFlag, isDraggedFlag, zIndex, left, top, isResizedFlag, width, height, contentWasLoaded, pinFlag, minFlag, maxFlag].join(":");
17705  }
17706  return "";
17707 },
17708 UpdateStateObject: function(){
17709  this.UpdateStateObjectWithObject({ windowsState: this.GetWindowsState() });
17710 },
17711 GetStateHiddenFieldOrigin: function() {
17712  return this.GetWindowElement(this.GetWindowCountCore() - 1);
17713 },
17714 GetPopupType: function() {
17715  return "aspxpopup";
17716 },
17717 GetDefaultZIndexFromServer: function() {
17718  return defaultZIndexFromServer;
17719 },
17720 GetPopupControlZIndex: function() {
17721  return popupControlZIndex;
17722 },
17723 FindWindowModalElement: function(index) {
17724  return ASPx.GetElementById(this.name + "_DXPWMB" + index);
17725 },
17726 GetWindowCloseButton: function(index) {
17727  return ASPx.GetElementById(this.name + "_HCB" + index);
17728 },
17729 GetWindowRefreshButton: function(index) {
17730  return ASPx.GetElementById(this.name + "_HRB" + index);
17731 },
17732 FirstShowWindow: function(index, allowChangeZIndex) {
17733  var popupHorizontalOffsetBackup = -1;
17734  var popupVerticalOffsetBackup = -1;
17735  var isFreeWindow = this.GetIsDragged(index);
17736  var x = ASPx.InvalidPosition;
17737  var y = ASPx.InvalidPosition;
17738  if(isFreeWindow) {
17739   x = this.GetWindowLeft(index);
17740   y = this.GetWindowTop(index);
17741   popupHorizontalOffsetBackup = this.popupHorizontalOffset;
17742   popupVerticalOffsetBackup = this.popupVerticalOffset;
17743   this.popupHorizontalOffset = 0;
17744   this.popupVerticalOffset = 0;
17745  }
17746  this.LockAnimation();
17747  this.DoShowWindowCore(index, x, y, isFreeWindow ? -1 : 0, false, allowChangeZIndex);
17748  this.UnlockAnimation();
17749  if(isFreeWindow) {
17750   this.popupHorizontalOffset = popupHorizontalOffsetBackup;
17751   this.popupVerticalOffset = popupVerticalOffsetBackup;
17752  }
17753  this.CorrectElementVerticalAlignment(ASPx.AdjustVerticalMarginsInContainer, this.GetWindowHeaderElement(index));
17754 },
17755 HasDefaultWindow: function() {
17756  return true;
17757 },
17758 GetWindowCount: function() {
17759  return 0;
17760 },
17761 GetWindowContentHtml: function(window) {
17762  var index = (window != null) ? window.index : -1;
17763  var element = this.GetContentContainer(index);
17764  return (element != null) ? element.innerHTML : "";
17765 },
17766 GetWindowElementId: function(index) {
17767  return this.name + ASPx.PCWIdSuffix + index;
17768 },
17769 GetWindowElement: function(index) {
17770  if(!ASPx.IsExistsElement(this.windowElements[index]))
17771   this.windowElements[index] = ASPx.GetElementById(this.GetWindowElementId(index));
17772  return this.windowElements[index];
17773 },
17774 GetWindowClientTable: function(index) {
17775  return this.GetWindowElement(index);
17776 },
17777 GetCurrentWindowElement: function() {
17778  return this.GetWindowElement(-1);
17779 },
17780 ShowWindowContentUrl: function(index) {
17781  var contentIFrame = this.GetWindowContentIFrameElement(index);
17782  this.LoadWindowContentUrl(index);
17783  if(contentIFrame && contentIFrame.DXReloadAfterShowRequired) {
17784   this.RefreshWindowContentUrl(this.GetWindow(index));
17785   contentIFrame.DXReloadAfterShowRequired = false;
17786  }
17787 },
17788 RefreshWindowContentUrl: function(window) {
17789  var index = (window != null) ? window.index : -1;
17790  if(ASPx.Browser.IE)
17791   this.RefreshWindowContentUrlIE(index, window);
17792  else
17793   this.RefreshWindowContentUrlCommon(window);
17794 },
17795 RefreshContentUrl: function() {
17796  this.RefreshWindowContentUrl(null);
17797 },
17798 RefreshWindowContentUrlIE: function(index, window) {
17799  var windowVisible = this.InternalIsWindowVisible(index);
17800  if(windowVisible)
17801   this.RefreshWindowContentUrlIECore(index, window);
17802  else {
17803   var iframe = this.GetWindowContentIFrameElement(index);
17804   if(iframe)
17805    iframe.DXReloadAfterShowRequired = true;
17806  }
17807 },
17808 RefreshWindowContentUrlIECore: function(index, window) {
17809  try {
17810   if(!this.GetIframeLoading(index)) {
17811    var iframe = this.GetWindowContentIFrameElement(index);
17812    if(iframe)
17813     iframe.contentWindow.location.reload();
17814   }
17815  } catch (e) {
17816   this.RefreshWindowContentUrlCommon(window);
17817  }
17818 },
17819 RefreshWindowContentUrlCommon: function(window) {
17820  this.SetWindowContentUrl(window, this.GetWindowContentUrl(window));
17821 },
17822 GetContentUrl: function() {
17823  return this.GetWindowContentUrl(null);
17824 },
17825 GetWindowContentUrl: function(window) {
17826  var index = (window != null) ? window.index : -1;
17827  if(!this.IsWindowVisible(window))
17828   return this.GetWindowContentIFrameUrl(index);
17829  var element = this.GetWindowContentIFrameElement(index);
17830  return (element != null) ? element.src : "";
17831 },
17832 GetContentIFrame: function(window) {
17833  return this.GetWindowContentIFrame(null);
17834 },
17835 GetWindowContentIFrame: function(window) {
17836  var index = (window != null) ? window.index : -1;
17837  return this.GetWindowContentIFrameElement(index);
17838 },
17839 GetContentIFrameWindow: function() {
17840  var iframeElement = this.GetContentIFrame();
17841  return iframeElement.contentWindow;
17842 },
17843 SetContentUrl: function(url) {
17844  this.SetWindowContentUrl(null, url);
17845 },
17846 SetWindowContentUrl: function(window, url) {
17847  var index = (window != null) ? window.index : -1;
17848  this.SetWindowContentUrlInternal(index, url);
17849 },
17850 LoadWindowContentUrl: function(index) {
17851  var url = this.GetWindowContentIFrameUrl(index);
17852  this.LoadWindowContentFromUrl(index, url);
17853 },
17854 LoadWindowContentFromUrl: function(index, url) {
17855  var element = this.GetWindowContentIFrameElement(index);
17856  if(element && element.src != url && element.DXSrcRaw != url) {
17857   this.SetSrcToIframeElement(index, element, url);
17858   this.SetWindowContentIFrameUrl(index, element.src); 
17859  }
17860 },
17861 SetWindowContentIFrameUrl: function(index, url) {
17862  this.SetPropertyValue(index, "contentUrl", url);
17863 },
17864 SetWindowContentUrlInternal: function(index, url) {
17865  var element = this.GetWindowContentIFrameElement(index);
17866  var windowVisible = this.InternalIsWindowVisible(index);
17867  if(windowVisible && element != null)
17868   this.SetIframeVisibleForDragging(index, true);
17869  this.SetWindowContentIFrameUrl(index, url);
17870  var src = !windowVisible ? ASPx.SSLSecureBlankUrl : url;
17871  if(element == null) {
17872   this.CreateWindowContentIFrameElement(index, src);
17873   this.RefreshDimensionsAfterCreateIframe(index);
17874  }
17875  else
17876   this.SetSrcToIframeElement(index, element, src);
17877  this.ReinitScrollForIframe(index);
17878 },
17879 ReinitScrollForIframe: function(index) {
17880  if(this.HasIframeOnIos(index)) {
17881   var scrollElement = this.getTouchScrollerElement(index);
17882   if(scrollElement) {
17883    var options = this.GetWindowTouchScrollOptions(index);
17884    ASPx.TouchUIHelper.InitNativeScrolling(scrollElement, options);
17885    if(!!this.touchUIScrollers[index]) {
17886     this.touchUIScrollers[index].Destroy();
17887     this.touchUIScrollers[index] = null;
17888    }
17889   }
17890  }
17891 },
17892 EnsureWindowContentUrl: function(index) {
17893  var contentUrl = this.GetWindowContentIFrameUrl(index);
17894  if(contentUrl != "")
17895   this.SetWindowContentUrlInternal(index, contentUrl);
17896 },
17897 CreateWindowContentIFrameElement: function(index, src) {
17898  var content = this.GetContentContainer(index);
17899  var iframeParent = content;
17900  content.innerHTML = "";
17901  content.style.display = "block";
17902  var iframe = this.CreateContentIFrameElement(index, src);
17903  this.RequireIFrameHeightAdjusting(index, iframe);
17904  iframeParent.appendChild(iframe);
17905  this.InitIFrame(index);
17906  return iframe;
17907 },
17908 InitIFrame: function(index) {
17909  var contentIFrameElement = this.GetWindowContentIFrameElement(index);
17910  if(contentIFrameElement) {
17911   contentIFrameElement.popupControlName = this.name;
17912   contentIFrameElement.pcWndIndex = index;
17913   ASPx.Evt.AttachEventToElement(contentIFrameElement, "load", ASPx.PCIframeLoad);
17914  }
17915 },
17916 OnIFrameLoad: function(index) {
17917  this.SetIframeLoading(index, false);
17918 },
17919 RequireIFrameHeightAdjusting: function(index, iframe) {
17920  if(this.InternalIsWindowVisible(index))
17921   this.AdjustIFrameHeight(index, iframe);
17922  else
17923   this.PostponeIframeAdjusting(index);
17924 },
17925 PostponeIframeAdjusting: function(index) {
17926  this.SetIframeAdjustingPostponed(index, true);
17927 },
17928 EnsureIFrameHeightAdjusted: function(index) {
17929  if(this.GetIframeAdjustingPostponed(index)) {
17930   var iframe = this.GetWindowContentIFrameElement(index);
17931   this.AdjustIFrameHeight(index, iframe);
17932  }
17933 },
17934 AdjustIFrameHeight: function(index, iframe) {
17935 },
17936 CreateContentIFrameElement: function(index, src) {
17937  var iframe = document.createElement("IFRAME");
17938  iframe.id = this.GetWindowContentIFrameElementId(index);
17939  iframe.scrolling = "auto";
17940  iframe.frameBorder = 0;
17941  iframe.style.width = "100%";
17942  iframe.style.height = "100%";
17943  iframe.style.overflow = "auto";
17944  if(ASPx.Browser.Chrome) iframe.style.webkitBackfaceVisibility = "hidden";
17945  if(ASPx.Browser.IE || ASPx.Browser.Edge)
17946   iframe.style["-ms-user-select"] = "text";
17947  var titleText = this.GetWindowContentIFrameTitle(index);
17948  if(!!titleText)
17949   iframe.title = titleText;
17950  this.SetSrcToIframeElement(index, iframe, src);
17951  return iframe;
17952 },
17953 SetSrcToIframeElement: function(index, iframeElement, src) {
17954  this.SetIframeLoading(index, true);
17955  iframeElement.src = src;
17956  if(ASPx.Browser.Chrome && src.indexOf("#"))
17957   this.PreventScrollingAfterIframeLoaded(iframeElement);
17958  iframeElement.DXSrcRaw = src;
17959 },
17960 PreventScrollingAfterIframeLoaded: function(iframeElement) {
17961  var docScrollTop = ASPx.GetDocumentScrollTop();
17962  var onIframeLoadedHandler = function() {
17963   window.setTimeout(function() {
17964    ASPx.SetDocumentScrollTop(docScrollTop);
17965    ASPx.Evt.DetachEventFromElement(iframeElement, "load", onIframeLoadedHandler);
17966   }, 0);
17967  };
17968  ASPx.Evt.AttachEventToElement(iframeElement, "load", onIframeLoadedHandler);
17969 },
17970 GetWindowHeaderTextCell: function(index) {
17971  return this.GetWindowChild(index, "_PWH" + index + "T");
17972 },
17973 GetWindowHeaderTextElement: function(index) {
17974  var element = this.GetWindowHeaderTextCell(index);
17975  if(element != null) {
17976   var link = ASPx.GetNodeByTagName(element, "A", 0);
17977   return link || element;
17978  }
17979  return null;
17980 },
17981 GetWindowHeaderLinkElement: function(index) {
17982  var element = this.GetWindowHeaderElement(index);
17983  return element ? ASPx.GetNodeByClassName(element, PopupControlCssClasse
17983s.LinkCssClassName) : null;
17984 },
17985 GetWindowHeaderImageCell: function(index) {
17986  return this.GetWindowChild(index, "_PWH" + index + "I");
17987 },
17988 GetWindowFooterTextCell: function(index) {
17989  return this.GetWindowChild(index, "_PWF" + index + "T");
17990 },
17991 GetWindowFooterTextElement: function(index) {
17992  var element = this.GetWindowFooterTextCell(index);
17993  if(element != null) {
17994   var link = ASPx.GetNodeByTagName(element, "A", 0);
17995   return link || element;
17996  }
17997  return null;
17998 },
17999 GetWindowFooterLinkElement: function(index) {
18000  var element = this.GetWindowFooterElement(index);
18001  return element ? ASPx.GetNodeByClassName(element, PopupControlCssClasses.LinkCssClassName) : null;
18002 },
18003 GetWindowFooterImageCell: function(index) {
18004  return this.GetWindowChild(index, "_PWF" + index + "I");
18005 },
18006 GetWindowHeaderImageUrl: function(index) {
18007  var element = this.GetWindowHeaderImageCell(index);
18008  return element ? element.src : "";
18009 },
18010 SetWindowHeaderImageUrl: function(index, url) {
18011  var element = this.GetWindowHeaderImageCell(index);
18012  if(element != null) {
18013   element.onload = function() { this.CorrectHeaderContentElementHeight(index); }.aspxBind(this);
18014   element.src = url;
18015  }
18016 },
18017 GetWindowFooterImageUrl: function(index) {
18018  var element = this.GetWindowFooterImageCell(index);
18019  return element ? element.src : "";
18020 },
18021 SetWindowFooterImageUrl: function(index, url) {
18022  var element = this.GetWindowFooterImageCell(index);
18023  if(element != null) {
18024   element.src = url;
18025   this.CorrectWindowSizeGripPositionLite(index);
18026  }
18027 },
18028 GetWindowHeaderNavigateUrl: function(index) {
18029  var link = this.GetWindowHeaderLinkElement(index);
18030  if(link)
18031   return link.href || ASPx.Attr.GetAttribute(linkEl, "savedhref");
18032  return "";
18033 },
18034 SetWindowHeaderNavigateUrl: function(index, url) {
18035  var link = this.GetWindowHeaderLinkElement(index);
18036  if(link) {
18037   if(ASPx.Attr.IsExistsAttribute(link, "savedhref"))
18038    ASPx.Attr.SetAttribute(link, "savedhref", url);
18039   else if(ASPx.Attr.IsExistsAttribute(link, "href"))
18040    link.href = url;
18041  }
18042 },
18043 GetWindowFooterNavigateUrl: function(index) {
18044  var link = this.GetWindowFooterLinkElement(index);
18045  if(link)
18046   return link.href || ASPx.Attr.GetAttribute(linkEl, "savedhref");
18047  return "";
18048 },
18049 SetWindowFooterNavigateUrl: function(index, url) {
18050  var link = this.GetWindowFooterLinkElement(index);
18051  if(link) {
18052   if(ASPx.Attr.IsExistsAttribute(link, "savedhref"))
18053    ASPx.Attr.SetAttribute(link, "savedhref", url);
18054   else if (ASPx.Attr.IsExistsAttribute(link, "href"))
18055    link.href = url;
18056  }
18057 },
18058 GetWindowHeaderText: function(index) {
18059  var element = this.GetWindowHeaderTextElement(index);
18060  if(element != null) 
18061    return element.innerHTML;
18062  return "";
18063 },
18064 SetWindowHeaderText: function(index, text) {
18065  var element = this.GetWindowHeaderTextElement(index);
18066  if(element != null) {
18067   element.innerHTML = text;
18068   this.CorrectHeaderContentElementHeight(index);
18069   this.CorrectElementVerticalAlignment(ASPx.AdjustVerticalMarginsInContainer, this.GetWindowHeaderElement(index), true);
18070  }
18071 },
18072 GetWindowFooterText: function(index) {
18073  var element = this.GetWindowFooterTextElement(index);
18074  if(element != null) 
18075   return element.innerHTML;
18076  return "";
18077 },
18078 SetWindowFooterText: function(index, text) {
18079  var element = this.GetWindowFooterTextElement(index);
18080  if(element != null) {
18081   element.innerHTML = text;
18082   this.CorrectWindowSizeGripPositionLite(index);
18083  }
18084 },
18085 CorrectWindowSizeGripPositionLite: function(index) {
18086  var sizeGrip = this.GetWindowSizeGripElement(index);
18087  if(!sizeGrip || sizeGrip.corrected) return;
18088  sizeGrip.style[this.rtl ? "marginRight" : "marginLeft"] = "-" + sizeGrip.offsetWidth + "px";
18089  sizeGrip.style.marginTop = "-" + sizeGrip.offsetHeight + "px";
18090  sizeGrip.corrected = true;
18091 },
18092 GetHeaderFooterHeightCore: function(index) {
18093  var extenders = [
18094   this.GetWindowHeaderElement(index),
18095   this.GetWindowFooterElement(index)
18096  ], height = 0;
18097  for(var i = 0; i < extenders.length; i++) {
18098   if(extenders[i])
18099    height += extenders[i].offsetHeight;
18100  }
18101  return height;
18102 },
18103 GetHeaderImageUrl: function() {
18104  return this.GetWindowHeaderImageUrl(-1);
18105 },
18106 SetHeaderImageUrl: function(value) {
18107  this.SetWindowHeaderImageUrl(-1, value);
18108 },
18109 GetFooterImageUrl: function() {
18110  return this.GetWindowFooterImageUrl(-1);
18111 },
18112 SetFooterImageUrl: function(value) {
18113  this.SetWindowFooterImageUrl(-1, value);
18114 },
18115 GetHeaderNavigateUrl: function() {
18116  return this.GetWindowHeaderNavigateUrl(-1);
18117 },
18118 SetHeaderNavigateUrl: function(value) {
18119  this.SetWindowHeaderNavigateUrl(-1, value);
18120 },
18121 GetFooterNavigateUrl: function() {
18122  return this.GetWindowFooterNavigateUrl(-1);
18123 },
18124 SetFooterNavigateUrl: function(value) {
18125  this.SetWindowFooterNavigateUrl(-1, value);
18126 },
18127 GetHeaderText: function() {
18128  return this.GetWindowHeaderText(-1);
18129 },
18130 SetHeaderText: function(value) {
18131  this.SetWindowHeaderText(-1, value);
18132 },
18133 GetFooterText: function() {
18134  return this.GetWindowFooterText(-1);
18135 },
18136 SetFooterText: function(value) {
18137  this.SetWindowFooterText(-1, value);
18138 },
18139 GetVisible: function() {
18140  return this.IsVisible();
18141 },
18142 SetVisible: function(visible) {
18143  if(visible && !this.IsVisible())
18144   this.Show();
18145  else if(!visible && this.IsVisible())
18146   this.Hide();
18147 },
18148 GetStateHiddenFieldName: function() {
18149  return this.uniqueID + "State";
18150 },
18151 GetWindowCountCore: function() {
18152  return 0; 
18153 },
18154 IsWindowElementsIDAssigned: function(index) {
18155  var contentElement = this.GetWindowContentElement(index);
18156  return ASPx.IsExistsElement(contentElement);
18157 },
18158 InitializeDOM: function () {
18159  var windowElement = this.GetWindowElement(this.GetWindowCountCore() - 1);
18160  if(windowElement)
18161   windowElement.dxinit = true;
18162 },
18163 IsDOMInitialized: function() {
18164  var windowElement = this.GetWindowElement(this.GetWindowCountCore() - 1);
18165  return windowElement && windowElement.dxinit;
18166 },
18167 IsDOMDisposed: function() { 
18168  var windowElement = this.GetWindowElement(this.GetWindowCountCore() - 1);
18169  return !ASPx.IsExistsElement(windowElement);
18170 },
18171 OnDispose: function() {
18172  ASPxClientControl.prototype.OnDispose.call(this);
18173  this.ClearPopupElementConnection();
18174 },
18175 RegisterInControlTree: function(tree) {
18176  var mainNode = tree.createNode(null, this);
18177  if(this.HasDefaultWindow())
18178   this.RegisterRelatedNodeForWindowElement(tree, -1, mainNode);
18179  for(var i = 0; i < this.GetWindowCount() ; i++)
18180   this.RegisterRelatedNodeForWindowElement(tree, i, mainNode);
18181 },
18182 RegisterRelatedNodeForWindowElement: function(tree, windowElementIndex, mainNode) {
18183  var windowElement = this.GetWindowElement(windowElementIndex);
18184  if(windowElement) {
18185   var childNode = tree.createNode(windowElement.id, null);
18186   tree.addRelatedNode(mainNode, childNode);
18187  }
18188 },
18189 CorrectWindowHeaderText: function(index) {
18190  var headerElement = this.GetWindowHeaderElement(index);
18191  if(!headerElement || headerElement.corrected) return;
18192  var leftChildrenWidth = 0, rightChildrenWidth = 0, headerContentElement;
18193  for(var i = 0; i < headerElement.childNodes.length; i++) {
18194   var child = headerElement.childNodes[i];
18195   if(!child.offsetWidth) continue;
18196   if(ASPx.GetElementFloat(child) === "right")
18197    rightChildrenWidth += child.offsetWidth + ASPx.GetLeftRightMargins(child);
18198   else if(ASPx.GetElementFloat(child) === "left")
18199    leftChildrenWidth += child.offsetWidth + ASPx.GetLeftRightMargins(child);
18200   else if(!headerContentElement)
18201    headerContentElement = child;
18202  }
18203  if(headerContentElement && (leftChildrenWidth > 0 || rightChildrenWidth > 0)) {
18204   var headerContentElementStyle = ASPx.GetCurrentStyle(headerContentElement);
18205   var originalPaddingLeft = parseInt(headerContentElementStyle.paddingLeft);
18206   var originalPaddingRight = parseInt(headerContentElementStyle.paddingRight);
18207   ASPx.SetStyles(headerContentElement, {
18208    paddingLeft: leftChildrenWidth + originalPaddingLeft,
18209    paddingRight: rightChildrenWidth + originalPaddingRight
18210   }, true);
18211   this.CorrectHeaderContentElementHeight(index);
18212  }
18213  headerElement.corrected = true;
18214 },
18215 CorrectHeaderContentElementHeight: function(index) {
18216  var headerElement = this.GetWindowHeaderElement(index),
18217   headerContentElement = ASPx.GetChildByClassName(headerElement, PopupControlCssClasses.HeaderContentCssClassName);
18218  if(!headerElement || !headerContentElement) return;
18219  if(headerContentElement.style.height)
18220   headerContentElement.style.height = "";
18221  var contentElementHeight = ASPx.GetClearClientHeight(headerElement) - this.getTopBottomBordersAndPaddingsSummaryValue(headerContentElement),
18222   lineHeightForTextVerticalAlign = contentElementHeight,
18223   windowHeaderTextCell = this.GetWindowHeaderTextCell(index);
18224  if(windowHeaderTextCell)
18225   lineHeightForTextVerticalAlign -= this.getTopBottomBordersAndPaddingsSummaryValue(windowHeaderTextCell);
18226  ASPx.SetStyles(headerContentElement, { lineHeight: lineHeightForTextVerticalAlign, height: contentElementHeight }, false);
18227 },
18228 OnBeforeDropdownShow: function() {
18229  var element = this.GetWindowElement(-1);
18230  if(!ASPx.GetElementDisplay(element)) {
18231   element.style.visibility = "hidden";
18232  }
18233  this.SetWindowDisplay(-1, true);
18234 },
18235 SetWindowDisplay: function(index, value) {
18236  var pcwElement = this.GetWindowElement(index);
18237  ASPx.SetElementDisplay(pcwElement, value);
18238 },
18239 getWindowHorizontalAlign: function(element) {
18240  return this.popupHorizontalAlign;
18241 },
18242 getWindowVerticalAlign: function(element) {
18243  return this.popupVerticalAlign;
18244 },
18245 getWindowHorizontalOffset: function(element) {
18246  return this.popupHorizontalOffset;
18247 },
18248 getWindowVerticalOffset: function(element) {
18249  return this.popupVerticalOffset;
18250 },
18251 GetHorizontalAlign: function() {
18252  return this.popupHorizontalAlign;
18253 },
18254 GetVerticalAlign: function() {
18255  return this.popupVerticalAlign;
18256 },
18257 GetPopupHorizontalOffset: function() {
18258  return this.popupHorizontalOffset;
18259 },
18260 SetPopupHorizontalOffset: function(offset) {
18261  this.popupHorizontalOffset = offset;
18262 },
18263 SetPopupVerticalOffset: function(offset) {
18264  this.popupVerticalOffset = offset;
18265 },
18266 GetPopupVerticalOffset: function() {
18267  return this.popupVerticalOffset;
18268 },
18269 ShowAtElement: function(htmlElement) {
18270  this.ShowWindowAtElementByIndex(-1, htmlElement);
18271 },
18272 ShowAtElementByID: function(id) {
18273  var htmlElement = document.getElementById(id);
18274  this.ShowAtElement(htmlElement);
18275 },
18276 ShowWindowAtElementByIndex: function(index, htmlElement) {
18277  var lastIndexBackup = this.GetLastShownPopupElementIndex(index);
18278  this.ShowWindowByIndex(index, this.AddPopupElementInternal(index, htmlElement));
18279  this.RemovePopupElementInternal(index, htmlElement);
18280  this.SetLastShownPopupElementIndex(index, lastIndexBackup);
18281 },
18282 ShowWindowByIndex: function(index, popupElementIndex) {
18283  if(!this.isInitialized)
18284   return;
18285  if(popupElementIndex === undefined)
18286   popupElementIndex = this.GetLastShownPopupElementIndex(index);
18287  this.DoShowWindowCore(index, ASPx.InvalidPosition, ASPx.InvalidPosition, popupElementIndex, false, true);
18288 },
18289 DoShowWindowCore: function(index, x, y, popupElementIndex, closeOtherWindows, allowChangeZIndex, evt, closeOtherReason) {
18290 },
18291 DoShowWindow: function(index, popupElementIndex, evt) {
18292  if(!this.InternalIsWindowVisible(index)) {
18293   var x = ASPx.Evt.GetEventX(evt);
18294   var y = ASPx.Evt.GetEventY(evt);
18295   this.DoShowWindowCore(index, x, y, popupElementIndex, true, true, evt, ASPxClientPopupControlCloseReason.OuterMouseClick);
18296  }
18297 },
18298 SetWindowPos: function(index, element, x, y) {
18299  ASPx.SetStyles(element, { left: x, top: y });
18300  this.DoShowWindowIFrame(index, x, y, ASPx.InvalidDimension, ASPx.InvalidDimension);
18301  this.SetIsDragged(index, true);
18302  this.SetWindowLeft(index, ASPx.GetAbsoluteX(element));
18303  this.SetWindowTop(index, ASPx.GetAbsoluteY(element));
18304  this.UpdateWindowsStateCookie();
18305 },
18306 CorrectPopupPositionForClientWindow: function(element, popupPosition, isX) {
18307  if(element.isPopupPositionCorrectionOn && this.isPopupFullCorrectionOn) {
18308   popupPosition.position = ASPx.PopupUtils.AdjustPositionToClientScreen(element, popupPosition.position, this.rtl, isX);
18309  }
18310  return popupPosition;
18311 },
18312 GetClientPopupPos: function(element, popupElement, pos, isX, isDragged) {
18313  var index = this.GetWindowIndex(element);
18314  var popupPosition = null;
18315  if(this.GetIsMaximizedOnWebKitTouch(index))
18316   return new ASPx.PopupPosition(ASPx.PrepareClientPosForElement(0, element, isX), false);
18317  if(isDragged)
18318   popupPosition = new ASPx.PopupPosition(!this.IsValidPosition(pos) ? this.GetPosition(index, isX) : pos, false);
18319  else
18320   popupPosition = isX ? this.GetClientPopupPosX(element, popupElement, pos) : this.GetClientPopupPosY(element, popupElement, pos);
18321  popupPosition.position = ASPx.PrepareClientPosForElement(popupPosition.position, element, isX);
18322  if(ASPx.Browser.Firefox && ASPx.Browser.Version < 3 && this.GetWindowModalElement(index))
18323   popupPosition.position -= isX ? ASPx.GetDocumentScrollLeft() : ASPx.GetDocumentScrollTop();
18324  return popupPosition;
18325 },
18326 GetClientPopupPosX: function(element, popupElement, x) {
18327  var mainElement = this.GetWindowMainCell(element);
18328  var popupPosition = ASPx.PopupUtils.GetPopupAbsoluteX(mainElement, popupElement, this.getWindowHorizontalAlign(element), this.getWindowHorizontalOffset(element),
18329   x, this.GetWindowLeft(this.GetWindowIndex(element)), this.rtl, this.isPopupFullCorrectionOn);
18330  return this.CorrectPopupPositionForClientWindow(element, popupPosition, true);
18331 },
18332 GetClientPopupPosY: function(element, popupElement, y) {
18333  var mainElement = this.GetWindowMainCell(element);
18334  var popupPosition = ASPx.PopupUtils.GetPopupAbsoluteY(mainElement, popupElement, this.getWindowVerticalAlign(element), this.getWindowVerticalOffset(element),
18335   y, this.GetWindowTop(this.GetWindowIndex(element)), this.isPopupFullCorrectionOn, this.usedInDropDown);
18336  return this.usedInDropDown ? popupPosition : this.CorrectPopupPositionForClientWindow(element, popupPosition, false);
18337 },
18338 UpdateWindowPositionInternal: function(index, popupElement) {
18339  var positionUpdated = false,
18340   element = this.GetWindowElement(index);
18341  if(this.InternalIsWindowVisible(index) && element != null) {
18342   var horizontalPopupPosition = this.GetClientPopupPos(element, popupElement, ASPx.InvalidPosition, true, false);
18343   var verticalPopupPosition = this.GetClientPopupPos(element, popupElement, ASPx.InvalidPosition, false, false);
18344   this.SetWindowPos(index, element, horizontalPopupPosition.position, verticalPopupPosition.position);
18345   positionUpdated = true;
18346  }
18347  return positionUpdated;
18348 },
18349 UpdatePositionAtElement: function(popupElement) {
18350  this.UpdateWindowPositionAtElement(null, popupElement);
18351 },
18352 UpdateWindowPositionAtElement: function(window, popupElement) {
18353  var index = (window != null) ? window.index : -1;
18354  this.UpdateWindowPositionInternal(index, popupElement);
18355 },
18356 TryAutoUpdatePosition: function(index) {
18357  if(this.GetAutoUpdatePosition(index))
18358   this.UpdateWindowPositionInternal(index, this.GetPopupElement(index, this.GetLastShownPopupElementIndex(index)));
18359 },
18360 GetLastShownPopupElementIndex: function(windowIndex) {
18361  var info = this.GetLastUsedPopupElementInfo(windowIndex);
18362  return ASPx.GetDefinedValue(info.shownPEIndex, 0);
18363 },
18364 SetLastShownPopupElementIndex: function(windowIndex, popupElementIndex) {
18365  var info = this.GetLastUsedPopupElementInfo(windowIndex);
18366  info.shownPEIndex = popupElementIndex;
18367 },
18368 GetLastUsedPopupElementInfo: function(index) {
18369  if(0 <= index && index < this.GetWindowCountCore())
18370   return this.windowsLastUsedPopupElementInfoList[index];
18371  return this.defaultLastUsedPopupElementInfo;
18372 },
18373 GetPopupElement: function(index, popupElementIndex) {
18374  var popupElement = this.GetPopupElementList(index)[popupElementIndex];
18375  return popupElement ? popupElement : null;
18376 },
18377 GetPopupElementList: function(index) {
18378  if(0 <= index && index < this.GetWindowCountCore())
18379   return this.windowsPopupElementList[index];
18380  return this.defaultWindowPopupElementList;
18381 },
18382 PopulatePopupElementsByIds: function(index) {
18383  var ids = this.GetPopupElementIDList(index);
18384  for(var i = 0; i < ids.length; i++) {
18385   var popupElement = ASPx.PopupUtils.FindPopupElementById(ids[i]);
18386   if(popupElement)
18387    this.AddWindowPopupElement(index, popupElement);
18388  }
18389 },
18390 PopulatePopupElements: function(index) {
18391  this.PopulatePopupElementsByIds(index);
18392 },
18393 SetPopupElementIDByIndex: function(index, popupElementId) {
18394  this.RemoveWindowAllPopupElements(index);
18395  this.SetPopupElementIDs(index, popupElementId.split(';'));
18396  if(aspxGetPopupControlCollection().IsDisappearTimerActive()) {
18397   aspxGetPopupControlCollection().ClearDisappearTimer();
18398   this.Hide(index);
18399  }
18400  this.PopulatePopupElements(index);
18401 },
18402 RefreshPopupElementConnection: function() {
18403  this.ClearPopupElementConnection();
18404  var index = this.HasDefaultWindow() ? -1 : 0;
18405  for(; index < this.GetWindowCount(); index++)
18406   this.PopulatePopupElements(index);
18407 },
18408 ClearPopupElementConnection: function() {
18409  var index = this.HasDefaultWindow() ? -1 : 0;
18410  for(; index < this.GetWindowCount(); index++)
18411   this.RemoveWindowAllPopupElements(index);
18412 },
18413 GetPopupElementIDList: function(index) {
18414  if(0 <= index && index < this.GetWindowCountCore())
18415   return this.windowsPopupElementIDList[index];
18416  return this.defaultWindowPopupElementIDList;
18417 },
18418 SetPopupElementIDs: function(index, ids) {
18419  if(0 <= index && index < this.GetWindowCountCore())
18420   this.windowsPopupElementIDList[index] = ids;
18421  this.defaultWindowPopupElementIDList = ids;
18422 },
18423 AddPopupElementInternal: function(index, element) {
18424  var popupElements = this.GetPopupElementList(index);
18425  for(var i = 0; i < popupElements.length; i++) {
18426   if(!popupElements[i]) {
18427    popupElements[i] = element;
18428    return i;
18429   }
18430  }
18431  popupElements.push(element);
18432  return popupElements.length - 1;
18433 },
18434 RemovePopupElementInternal: function(index, element) {
18435  var popupElements = this.GetPopupElementList(index);
18436  for(var i = 0; i < popupElements.length; i++) {
18437   if(popupElements[i] == element) {
18438    popupElements[i] = null;
18439    return;
18440   }
18441  }
18442 },
18443 AddPopupElement: function(popupElement) {
18444  this.AddWindowPopupElement(-1, popupElement);
18445 },
18446 AddWindowPopupElement: function(index, popupElement) {
18447  var popupElementIndex = this.AddPopupElementInternal(index, popupElement);
18448  this.SetPopupElementReference(index, popupElement, popupElementIndex, true);
18449 },
18450 RemovePopupElement: function(popupElement) {
18451  this.RemoveWindowPopupElement(-1, popupElement);
18452 },
18453 RemoveWindowPopupElement: function(index, popupElement) {
18454  this.RemovePopupElementInternal(index, popupElement);
18455  this.SetPopupElementReference(index, popupElement, null, false);
18456 },
18457 SetPopupElementReference: function(index, popupElement, popupElementIndex, attach) {
18458  if(!ASPx.IsExistsElement(popupElement)) return;
18459  var setReferenceFunction = attach ? ASPx.Evt.AttachEventToElement : ASPx.Evt.DetachEventFromElement;
18460  var windowPopupAction = this.GetWindowPopupAction(index);
18461  if(windowPopupAction == "LeftMouseClick")
18462   setReferenceFunction(popupElement, "mouseup", aspxPEMEvent);
18463  else if(windowPopupAction == "RightMouseClick")
18464   setReferenceFunction(popupElement, "contextmenu", aspxPEMEvent);
18465  else if(windowPopupAction == "MouseOver") {
18466   var windowElement = this.GetWindowElement(index);
18467   setReferenceFunction(popupElement, "mouseover", ASPx.PopupUtils.OverControl.OnMouseOver);
18468   setReferenceFunction(windowElement, "mouseover", aspxPWEMOver);
18469   if(attach)
18470    this.SetMSTouchMouseOverReference(popupElement, windowElement, this.name, index, this.appearAfter);
18471  }
18472  if(windowPopupAction == "LeftMouseClick" || windowPopupAction == "RightMouseClick") {
18473   setReferenceFunction(popupElement, "mousedown", aspxPEMEvent);
18474  }
18475  if(attach) {
18476   popupElement.DXPopupElementControl = this;
18477   popupElement.DXPopupWindowIndex = index;
18478   popupElement.DXPopupElementIndex = popupElementIndex;
18479  } else
18480   popupElement.DXPopupElementControl = popupElement.DXPopupWindowIndex = popupElement.DXPopupElementIndex = undefined;
18481 },
18482 SetMSTouchMouseOverReference: function(popupElement, windowElement, popupName, index, appearAfter) {
18483  if(!ASPx.TouchUIHelper.pointerEnabled) return;
18484  popupElement.dxMsTouchGesture = popupElement.dxMsTouchGesture ||
18485   ASPx.TouchUIHelper.msTouchCreateGesturesWrapper(popupElement, function(evt) {
18486    window.setTimeout(function() {
18487     aspxGetPopupControlCollection().SetAppearTimer(popupName, index, popupElement.DXPopupElementIndex, appearAfter, evt);
18488    }, 0);
18489   });
18490  windowElement.dxMsTouchGesture = windowElement.dxMsTouchGesture || ASPx.TouchUIHelper.msTouchCreateGesturesWrapper(windowElement, function(evt) {
18491   window.setTimeout(function() {
18492    aspxGetPopupControlCollection().ClearDisappearTimer();
18493   }, 0);
18494  });
18495 },
18496 GetLastOverPopupElementIndex: function(windowIndex) {
18497  var info = this.GetLastUsedPopupElementInfo(windowIndex);
18498  return ASPx.GetDefinedValue(info.overPEIndex, -1);
18499 },
18500 SetLastOverPopupElementIndex: function(windowIndex, popupElementIndex) {
18501  var info = this.GetLastUsedPopupElementInfo(windowIndex);
18502  info.overPEIndex = popupElementIndex;
18503 },
18504 OnPopupElementMouseOver: function(evt, popupElement) {
18505  if(popupElement != null) {
18506   var index = popupElement.DXPopupWindowIndex;
18507   var isVisible = this.InternalIsWindowVisible(index);
18508   var popupElementIndex = popupElement.DXPopupElementIndex;
18509   if(this.GetLastOverPopupElementIndex(index) != popupElementIndex) {
18510    if(aspxGetPopupControlCollection().IsAppearTimerActive())
18511     aspxGetPopupControlCollection().ClearAppearTimer();
18512    if(aspxGetPopupControlCollection().IsDisappearTimerActive())
18513     aspxGetPopupControlCollection().ClearDisappearTimer();
18514    if(isVisible) {
18515     this.DoHideWindow(index, false, ASPxClientPopupControlCloseReason.MouseOut);
18516     isVisible = false;
18517    }
18518   }
18519   if(!isVisible) {
18520    aspxGetPopupControlCollection().SetAppearTimer(this.name, index, popupElement.DXPopupElementIndex, this.appearAfter, evt);
18521    aspxGetPopupControlCollection().InitOverObject(this, index, evt);
18522   }
18523   this.SetLastOverPopupElementIndex(index, popupElementIndex);
18524  }
18525 },
18526 OnPopupElementMouseOut: function(evt, popupElement) {
18527 },
18528 RemoveAllPopupElements: function() {
18529  this.RemoveWindowAllPopupElements(-1);
18530 },
18531 RemoveWindowAllPopupElements: function(index) {
18532  var popupElements = this.GetPopupElementList(index);
18533  for(var i = 0; i < popupElements.length; i++)
18534   this.RemoveWindowPopupElement(index, popupElements[i]);
18535 },
18536 GetWindowCurrentPopupElementByIndex: function(index) {
18537  var popupElement = this.GetPopupElement(index, this.GetLastShownPopupElementIndex(index));
18538  if(popupElement && popupElement.DXPopupElementControl)
18539   return popupElement;
18540  return null;
18541 },
18542 GetWindowCurrentPopupElementIndexByWindowIndex: function(windowIndex) {
18543  var popupElement = this.GetWindowCurrentPopupElementByIndex(windowIndex);
18544  return popupElement ? popupElement.DXPopupElementIndex : -1;
18545 },
18546 GetIsMaximizedOnWebKitTouch: function(index) {
18547  return false;
18548 },
18549 ProcessAccessibleElementOnHide: function() {
18550  if(this.accessibilityCompliant) {
18551   var focusElement = this.accessibleFocusElement ? this.accessibleFocusElement : this.GetCurrentPopupElement();
18552   ASPx.AccessibilityUtils.SetFocusAccessibleCore(focusElement);
18553   this.accessibleFocusElement = null;
18554  }
18555 },
18556 OnControlsInitialized: function() {
18557  this.InitializeAccessibleNavigationCore();
18558  setTimeout(function() {
18559   ASPx.GetControlCollection().ControlsInitialized.RemoveHandler(this.OnControlsInitialized, this);
18560  }.aspxBind(this), 0);
18561 },
18562 InitializeAccessibleNavigation: function() {
18563  this.Shown.AddHandler(this.InitializeAccessibleNavigationCore.aspxBind(this));
18564 },
18565 InitializeAccessibleNavigationCore: function() {
18566  this.resetFocusableElements();
18567  var focusableElement = this.getFirstFocusableElement();
18568  if(focusableElement) {
18569   var currentWindowContentCell = this.GetWindowContentElement(-1);
18570   var contentFirstActionElement = ASPx.FindFirstChildActionElement(currentWindowContentCell);
18571   if(contentFirstActionElement && contentFirstActionElement !== focusableElement)
18572    focusableElement = contentFirstActionElement;
18573   ASPx.AccessibilityUtils.SetFocusAccessible(focusableElement);
18574   this.SetLoopingFocusHandlers();
18575  }
18576 },
18577 resetFocusableElements: function() {
18578  if(this.firstFocusableElement)
18579   ASPx.Evt.DetachEventFromElement(this.firstFocusableElement, "keydown", this.focusLastElementHandler);
18580  if(this.lastFocusableElement)
18581   ASPx.Evt.DetachEventFromElement(this.lastFocusableElement, "keydown", this.focusFirstElementHandler);
18582  this.firstFocusableElement = null;
18583  this.lastFocusableElement = null;
18584 },
18585 getFirstFocusableElement: function() {
18586  if(!this.firstFocusableElement)
18587   this.firstFocusableElement = ASPx.FindFirstChildActionElement(this.GetCurrentWindowElement());
18588  return this.firstFocusableElement;
18589 },
18590 getLastFocusableElement: function() {
18591  if(!this.lastFocusableElement)
18592   this.lastFocusableElement = ASPx.FindLastChildActionElement(this.GetCurrentWindowElement());
18593  return this.lastFocusableElement;
18594 },
18595 SetLoopingFocusHandlers: function() {
18596  ASPx.Evt.AttachEventToElement(this.getFirstFocusableElement(), "ke
18596ydown", this.focusLastElementHandler);
18597  ASPx.Evt.AttachEventToElement(this.getLastFocusableElement(), "keydown", this.focusFirstElementHandler);
18598 },
18599 loopFocusHandler: function(evt, isLastFocusableElement) {
18600  var keyCode = ASPx.Evt.GetKeyCode(evt);
18601  if(keyCode !== ASPx.Key.Tab)
18602   return;
18603  var elementToFocus = null;
18604  if(!isLastFocusableElement && evt.shiftKey)
18605   elementToFocus = this.getLastFocusableElement();
18606  else if(isLastFocusableElement && !evt.shiftKey)
18607   elementToFocus = this.getFirstFocusableElement();
18608  if(elementToFocus) {
18609   ASPx.AccessibilityUtils.SetFocusAccessible(elementToFocus);
18610   ASPx.Evt.PreventEventAndBubble(evt);
18611  }
18612 },
18613 getLeftRightBordersAndPaddingsSummaryValue: function(element, currentStyle) {
18614  return ASPx.GetLeftRightBordersAndPaddingsSummaryValue(element, currentStyle);
18615 },
18616 getTopBottomBordersAndPaddingsSummaryValue: function(element, currentStyle) {
18617  return ASPx.GetTopBottomBordersAndPaddingsSummaryValue(element, currentStyle);
18618 },
18619 AdjustModalElementBounds: function(element) {
18620 },
18621 RefreshDimensionsAfterCreateIframe: function(index) {
18622 },
18623 UpdatePositionAfterCallback: function(windowIndex) {
18624 }
18625});
18626ASPxClientPopupControlBase.AnimationType = {
18627 Fade: "fade",
18628 Slide: "slide",
18629 Auto: "auto",
18630 None: "none"
18631};
18632var ASPxClientPopupControl = ASPx.CreateClass(ASPxClientPopupControlBase, {
18633 constructor: function(name) {
18634  this.constructor.prototype.constructor.call(this, name);
18635  this.popupActionArray = [];
18636  this.windowsPopupElementIDList = [];
18637  this.windowsPopupElementList = [];
18638  this.windowsLastUsedPopupElementInfoList = [];
18639  this.windowsIsPopupedList = [];
18640  this.windowsPopupReasonMouseEventList = [];
18641  this.defaultPopupReasonMouseEvent = null;
18642  this.modal = false;
18643  this.modalArray = [];
18644  this.isDraggedArray = [];
18645  this.closeActionArray = [];
18646  this.showOnPageLoadArray = [];
18647  this.windows = [];
18648  this.windowCount = 0;
18649  this.closeOnEscapeArray = [];
18650  this.leftArray = [];
18651  this.contentUrlArray = [];
18652  this.contentUrlIFrameTitleArray = [];
18653  this.iframeLoadingArray = [];
18654  this.iframeAdjustingPostponedArray = [];
18655  this.isResizedArray = [];
18656  this.zIndexArray = [];
18657  this.topArray = [];
18658  this.shownArray = [];
18659  this.heightArray = [];
18660  this.widthArray = [];
18661  this.widthFromServer = false;
18662  this.widthFromServerArray = [];
18663  this.minHeightArray = [];
18664  this.minWidthArray = [];
18665  this.maxHeightArray = [];
18666  this.maxWidthArray = [];
18667  this.hideBodyScrollWhenModal = true;
18668  this.hideBodyScrollWhenModalArray = [];
18669  this.hideBodyScrollWhenMaximized = true;
18670  this.canScrollViewPort = false;
18671  this.canScrollViewPortArray = [];
18672  this.autoUpdatePositionArray = [];
18673  this.cachedSizeArray = [];
18674  this.enableContentScrollingArray = [];
18675  this.contentOverflowXArray = [];
18676  this.contentOverflowYArray = [];
18677  this.isPinned = false;
18678  this.isPinnedArray = [];
18679  this.pinX = 0;
18680  this.pinXArray = [];
18681  this.pinY = 0;
18682  this.pinYArray = [];
18683  this.lockScroll = 0;
18684  this.isCollapsed = false;
18685  this.isCollapsedArray = [];
18686  this.isCollapsedInit = false;
18687  this.isCollapsedInitArray = [];
18688  this.collapseExecutingLockCount = 0;
18689  this.isMaximized = false;
18690  this.isMaximizedArray = [];
18691  this.isMaximizedInit = false;
18692  this.isMaximizedInitArray = [];
18693  this.maximizationExecutingLockCount = 0;
18694  this.restoredWindowValues = {};
18695  this.restoredWindowValuesArray = [];
18696  this.browserResizingForMaxWindowLockCount = 0;
18697  this.updateRestoredWindowSizeLockCount = 0;
18698  this.touchUIScrollers = {};
18699  this.adaptivityEnabled = false;
18700  this.DefaultModalMaxWidth = 500;
18701  this.DefaultModalMinWidth = 0;
18702  this.stretchVertically = false;
18703  this.stretchVerticallyArray = [];
18704  this.fixedHeader = true;
18705  this.fixedHeaderArray = [];
18706  this.fixedFooter = true;
18707  this.fixedFooterArray = [];
18708  this.modalMinHeight = null;
18709  this.modalMinHeightArray = [];
18710  this.modalMinWidth = null;
18711  this.modalMinWidthArray = [];
18712  this.modalMaxHeight = null;
18713  this.modalMaxHeightArray = [];
18714  this.modalMaxWidth = null;
18715  this.modalMaxWidthArray = [];
18716  this.modalVerticalAlign = ModalAlign.WindowTop;
18717  this.modalHorizontalAlign = ModalAlign.WindowCenter;
18718  this.adaptiveModalMode = false;
18719  this.adaptiveModalModeArray = [];
18720  this.switchAtWindowInnerWidth = ASPx.MaxMobileWindowWidth;
18721  this.PinnedChanged = new ASPxClientEvent();
18722 },
18723 SetData: function(data){
18724  if(data.windows)
18725   this.CreateWindows(data.windows);
18726 },
18727 InlineInitialize: function() {
18728  ASPxClientControl.prototype.InlineInitialize.call(this);
18729  this.InitializeArrayCores();
18730 },
18731 Initialize: function() {
18732  ASPxClientPopupControlBase.prototype.Initialize.call(this);
18733  aspxGetPopupControlCollection().EnsureSaveScrollState();
18734  if(this.HasDefaultWindow())
18735   this.InitializeWindow(-1);
18736  for(var i = 0; i < this.GetWindowCount() ; i++)
18737   this.InitializeWindow(i);
18738  this.InitializeScrollbars();
18739 },
18740 InitializeEnableContentScrolling: function() {
18741  for(var windowIndex = 0; windowIndex < this.GetWindowCount() ; windowIndex++) {
18742   var contentOverflowX = this.GetWindowOverflowX(windowIndex);
18743   var contentOverflowY = this.GetWindowOverflowY(windowIndex);
18744   this.enableContentScrollingArray.push(contentOverflowX != "None" || contentOverflowY != "None");
18745  }
18746  ASPxClientPopupControlBase.prototype.InitializeEnableContentScrolling.call(this);
18747 },
18748 InitializeScrollbars: function() {
18749  if(!ASPx.Browser.WebKitTouchUI && !ASPx.Browser.MSTouchUI && (!ASPx.Browser.WindowsPhonePlatform || !ASPx.Browser.IE))
18750   return;
18751  this.ForEachWindow(function(windowIndex) {
18752   if(this.GetEnableContentScrolling(windowIndex)) {
18753    var scrollElement = this.getTouchScrollerElement(windowIndex);
18754    if(scrollElement) {
18755     if(ASPx.Browser.MSTouchUI)
18756      scrollElement.style.touchAction = "auto";
18757     else {
18758      var options = this.GetWindowTouchScrollOptions(windowIndex);
18759      if(!this.HasIframeOnIos(windowIndex))
18760       this.touchUIScrollers[windowIndex] = ASPx.TouchUIHelper.MakeScrollable(scrollElement, options);
18761     }
18762    }
18763   }
18764  }.aspxBind(this));
18765 },
18766 GetWindowTouchScrollOptions: function (index) {
18767  var contentOverflowX = this.GetWindowOverflowX(index),
18768   contentOverflowY = this.GetWindowOverflowY(index);
18769  return {
18770   showHorizontalScrollbar: contentOverflowX === "Auto" || contentOverflowX === "Scroll",
18771   showVerticalScrollbar: contentOverflowY === "Auto" || contentOverflowY === "Scroll"
18772  };
18773 },
18774 ForEachWindow: function(callback) {
18775  var indices = [];
18776  if(this.HasDefaultWindow())
18777   indices.push(-1);
18778  else {
18779   for(var i = 0; i < this.GetWindowCount(); i++)
18780    indices.push(i);
18781  }
18782  ASPx.Data.ForEach(indices, callback);
18783 },
18784 preventParentOverlowOnIos: function(index) {
18785  if(!ASPx.Browser.MacOSMobilePlatform) return;
18786  var parent = this.getParentPopupControl(index);
18787  if(parent) 
18788   parent.popupControl.changeContentOverflow(parent.windowIndex);
18789 },
18790 restoreParentOverflowOnIos: function(index) {
18791  if(!ASPx.Browser.MacOSMobilePlatform) return;
18792  var parent = this.getParentPopupControl(index);
18793  if(parent) 
18794   parent.popupControl.restoreContentOverflow(parent.windowIndex);
18795 },
18796 changeContentOverflow: function(index) {
18797  var scrollerElement = this.getTouchScrollerElement(index);
18798  if(!scrollerElement) return;
18799  ASPx.Attr.ChangeStyleAttribute(scrollerElement, "overflow", "visible");
18800  ASPx.Attr.ChangeStyleAttribute(scrollerElement, "overflowX", "visible");
18801  ASPx.Attr.ChangeStyleAttribute(scrollerElement, "overflowY", "visible");
18802 },
18803 restoreContentOverflow: function(index) {
18804  var scrollerElement = this.getTouchScrollerElement(index);
18805  if(!scrollerElement) return;
18806  ASPx.Attr.RestoreStyleAttribute(scrollerElement, "overflow");
18807  ASPx.Attr.RestoreStyleAttribute(scrollerElement, "overflowX");
18808  ASPx.Attr.RestoreStyleAttribute(scrollerElement, "overflowY");
18809 },
18810 UpdateScrollbar: function(index) {
18811  var touchUIScroller = this.touchUIScrollers[index];
18812  if(!touchUIScroller)
18813   return;
18814  var scrollElement = this.GetContentContainer(index);
18815  if(scrollElement)
18816   touchUIScroller.ChangeElement(scrollElement);
18817 },
18818 InitializeArrayCores: function() {
18819  if(this.GetWindowCountCore() > 0) {
18820   this.InitializeWindowPopupElementList();
18821   this.InitializeWindowPopupElementIDList();
18822   this.InitializeWindowLastUsedPopupElementInfoList();
18823   this.InitializeArray(this.shownArray);
18824   this.InitializeArray(this.windowsPopupReasonMouseEventList, null);
18825   this.InitializeArray(this.windowsIsPopupedList, false);
18826   this.InitializeArray(this.contentUrlArray, "");
18827   this.InitializeArray(this.contentUrlIFrameTitleArray, "");
18828   this.InitializeArray(this.popupActionArray, this.popupAction);
18829   this.InitializeArray(this.closeActionArray, this.closeAction);
18830   this.InitializeArray(this.showOnPageLoadArray, false);
18831   this.InitializeArray(this.isDraggedArray, false);
18832   this.InitializeArray(this.isPinnedArray, false);
18833   this.InitializeArray(this.isCollapsedArray, false);
18834   this.InitializeArray(this.isCollapsedInitArray, false);
18835   this.InitializeArray(this.isMaximizedArray, false);
18836   this.InitializeArray(this.isMaximizedInitArray, false);
18837   this.InitializeArray(this.restoredWindowValuesArray, {});
18838   this.InitializeArray(this.iframeAdjustingPostponedArray, {});
18839   this.InitializeArray(this.isResizedArray, false);
18840   this.InitializeArray(this.zIndexArray, -1);
18841   this.InitializeArray(this.leftArray, 0);
18842   this.InitializeArray(this.topArray, 0);
18843   this.InitializeArray(this.widthArray, constants.DEFAULT_WINDOW_WIDTH);
18844   this.InitializeArray(this.heightArray, constants.DEFAULT_WINDOW_HEIGHT);
18845   this.InitializeArray(this.widthFromServerArray, false);
18846   this.InitializeArray(this.pinXArray, 0);
18847   this.InitializeArray(this.pinYArray, 0);
18848   this.InitializeArray(this.minWidthArray, null);
18849   this.InitializeArray(this.minHeightArray, null);
18850   this.InitializeArray(this.maxWidthArray, null);
18851   this.InitializeArray(this.maxHeightArray, null);
18852   this.InitializeArray(this.cachedSizeArray, null);
18853   this.InitializeArray(this.iframeLoadingArray, false);
18854   this.InitializeArray(this.autoUpdatePositionArray, false);
18855   this.InitializeArray(this.hideBodyScrollWhenModalArray, true);
18856   this.InitializeArray(this.canScrollViewPortArray, false);
18857   this.InitializeArray(this.closeOnEscapeArray, this.closeOnEscape);
18858   this.InitializeArray(this.modalArray, false);
18859   this.InitializeArray(this.adaptiveModalModeArray, false);
18860   this.InitializeArray(this.fixedHeaderArray, true);
18861   this.InitializeArray(this.fixedFooterArray, true);
18862   this.InitializeArray(this.modalMinWidthArray, null);
18863   this.InitializeArray(this.modalMinHeightArray, null);
18864   this.InitializeArray(this.modalMaxWidthArray, null);
18865   this.InitializeArray(this.modalMaxHeightArray, null);
18866   this.InitializeArray(this.stretchVerticallyArray, false);
18867  }
18868 },
18869 InitializeArray: function(array, defaultValue) {
18870  if(array.length == 0) {
18871   for(var i = 0; i < this.GetWindowCountCore() ; i++)
18872    array[i] = defaultValue;
18873  }
18874 },
18875 InitializeWindowPopupElementIDList: function() {
18876  for(var i = 0; i < this.GetWindowCountCore() ; i++) {
18877   if(!this.windowsPopupElementIDList[i])
18878    this.windowsPopupElementIDList[i] = [];
18879  }
18880 },
18881 InitializeWindowPopupElementList: function() {
18882  for(var i = 0; i < this.GetWindowCountCore() ; i++) {
18883   if(!this.windowsPopupElementList[i])
18884    this.windowsPopupElementList[i] = [];
18885  }
18886 },
18887 InitializeWindowLastUsedPopupElementInfoList: function() {
18888  for(var i = 0; i < this.GetWindowCountCore() ; i++) {
18889   if(!this.windowsLastUsedPopupElementInfoList[i])
18890    this.windowsLastUsedPopupElementInfoList[i] = {};
18891  }
18892 },
18893 AllowMouseDown: function(evt, index) {
18894  return ASPxClientPopupControlBase.prototype.AllowMouseDown.call(this, evt, index) &&
18895   !this.PreventHeaderButtonMouseDownBubbling(evt, this.GetWindowPinButton(index)) &&
18896   !this.PreventHeaderButtonMouseDownBubbling(evt, this.GetWindowCollapseButton(index)) &&
18897   !this.PreventHeaderButtonMouseDownBubbling(evt, this.GetWindowMaximizeButton(index));
18898 },
18899 AssignHeaderButtonsEvents: function(index) {
18900  ASPxClientPopupControlBase.prototype.AssignHeaderButtonsEvents.call(this, index);
18901  this.AttachClickToHeaderButton(index, this.GetWindowPinButton(index), "ASPx.PWPBClick");
18902  this.AttachClickToHeaderButton(index, this.GetWindowCollapseButton(index), "ASPx.PWMNBClick");
18903  this.AttachClickToHeaderButton(index, this.GetWindowMaximizeButton(index), "ASPx.PWMXBClick");
18904 },
18905 InitializeWindow: function(index) {
18906  ASPxClientPopupControlBase.prototype.InitializeWindow.call(this, index);
18907  if(this.adaptivityEnabled) {
18908   ASPx.Evt.AttachEventToElement(this.GetModalWrapperElement(index), "scroll", function(e) { this.OnModalWrapperScroll(e, index); }.aspxBind(this));
18909   if(ASPx.Browser.WebKitTouchUI) {
18910    ASPx.Evt.AttachEventToElement(this.GetModalWrapperElement(index), "touchstart", function(e) { this.OnModalWrapperTouchStart(e); }.aspxBind(this));
18911    ASPx.Evt.AttachEventToElement(this.GetModalWrapperElement(index), "touchmove", function(e) { this.OnModalWrapperTouchMove(e, index); }.aspxBind(this));
18912   }
18913  } else {
18914   var modalElement = this.GetWindowModalElement(index);
18915   if(modalElement)
18916    ASPx.Evt.AttachEventToElement(modalElement, "mousedown", aspxPWMEMDown);
18917  }
18918 },
18919 BrowserWindowResizeSubscriber: function() {
18920  return true;
18921 },
18922 OnBrowserWindowResize: function(e) {
18923  window.setTimeout(this.SetPopupMaximizedPositionOnBrowserResize.aspxBind(this), 0);
18924  this.ForEachWindow(this.updateContentScrollIfNeeded.aspxBind(this));
18925 },
18926 SetPopupMaximizedPositionOnBrowserResize: function() {
18927  this.ForEachWindow(this.SetMaximizedPositionOnBrowserResize.aspxBind(this));
18928 },
18929 UpdateResizeCursor: function(index, element, verticalDirection, horizontalDirection) {
18930  if(this.GetAdaptiveModalMode(index))
18931   this.HideTemporaryCursor(element);
18932  else
18933   ASPxClientPopupControlBase.prototype.UpdateResizeCursor.call(this, index, element, verticalDirection, horizontalDirection);
18934 },
18935 SetMaximizedPositionOnBrowserResize: function(index) {
18936  var element = this.GetWindowElement(index);
18937  if(element && this.GetIsMaximized(index) && this.InternalIsWindowVisible(index)) {
18938   var left = this.GetMaximizedPosition(element, true);
18939   var top = this.GetMaximizedPosition(element, false);
18940   this.SetWindowPos(index, element, left, top);
18941  }
18942 },
18943 InitCollapsedWindows: function(index) {
18944  if((this.isCollapsedInit && index == -1) || (index >= 0 && index < this.isCollapsedInitArray.length && this.isCollapsedInitArray[index])) {
18945   if(this.InternalIsWindowVisible(index)) {
18946    this.DoCollapse(index, true);
18947    if(index == -1)
18948     this.isCollapsedInit = false;
18949    else
18950     this.isCollapsedInitArray[index] = false;
18951   }
18952  }
18953 },
18954 InitMaximizedWindows: function(index) {
18955  if(this.GetIsMaximizedInit(index) && this.InternalIsWindowVisible(index)) {
18956   this.DoMaximize(index, true);
18957   this.SetIsMaximizedInit(index, false);
18958  }
18959 },
18960 InitPinnedWindows: function(index) {
18961  if((this.isPinned && index == -1) || (index >= 0 && index < this.isPinnedArray.length && this.isPinnedArray[index]))
18962   this.HoldPosition(index, true);
18963 },
18964 AfterInitializeWindow: function(index) {
18965  if(this.contentOverflowX !== "None" && !this.GetWindowWidthFromServer(index))
18966   this.SetWindowWidth(index, 0);
18967  ASPxClientPopupControlBase.prototype.AfterInitializeWindow.call(this, index);
18968  this.InitPinnedWindows(index);
18969  this.InitMaximizedWindows(index);
18970  this.InitCollapsedWindows(index);
18971 },
18972 OnDragStop: function(index) {
18973  ASPxClientPopupControlBase.prototype.OnDragStop.call(this, index);
18974  if(this.adaptivityEnabled)
18975   ASPxClientPopupControl.WindowResizeHelper.Initialize(this.GetWindowElement(index));
18976  else
18977   this.updateContentScrollIfNeeded(index);
18978 },
18979 GetPropertyValue: function(index, propName) {
18980  if(0 <= index && index < this.GetWindowCountCore())
18981   return this[propName + "Array"][index];
18982  return ASPxClientPopupControlBase.prototype.GetPropertyValue.call(this, index, propName);
18983 },
18984 SetPropertyValue: function(index, propName, value) {
18985  if(0 <= index && index < this.GetWindowCountCore())
18986   this[propName + "Array"][index] = value;
18987  else
18988   ASPxClientPopupControlBase.prototype.SetPropertyValue.call(this, index, propName, value);
18989 },
18990 GetAdaptiveModalMode: function(index) {
18991  return this.GetPropertyValue(index, "adaptiveModalMode");
18992 },
18993 GetAutoUpdatePosition: function(index) {
18994  return this.GetPropertyValue(index, "autoUpdatePosition") && !this.GetAdaptiveModalMode(index);
18995 },
18996 SetAdaptiveModalMode: function(index, value) {
18997  var func = value ? ASPx.AddClassNameToElement : ASPx.RemoveClassNameFromElement;
18998  func(this.GetModalWrapperElement(index), this.GetModalSystemCssClass());
18999  this.SetPropertyValue(index, "adaptiveModalMode", value);
19000 },
19001 GetIsPinned: function(index) {
19002  return this.GetPropertyValue(index, "isPinned");
19003 },
19004 SetIsPinned: function(index, value) {
19005  this.SetPropertyValue(index, "isPinned", value);
19006 },
19007 GetPinPosX: function(index) {
19008  return this.GetPropertyValue(index, "pinX");
19009 },
19010 SetPinPosX: function(index, pinX) {
19011  this.SetPropertyValue(index, "pinX", pinX);
19012 },
19013 GetPinPosY: function(index) {
19014  return this.GetPropertyValue(index, "pinY");
19015 },
19016 SetPinPosY: function(index, pinY) {
19017  this.SetPropertyValue(index, "pinY", pinY);
19018 },
19019 GetIsCollapsed: function(index) {
19020  return this.GetPropertyValue(index, "isCollapsed");
19021 },
19022 SetIsCollapsed: function(index, value) {
19023  this.SetPropertyValue(index, "isCollapsed", value);
19024 },
19025 GetIsMaximized: function(index) {
19026  return this.GetPropertyValue(index, "isMaximized");
19027 },
19028 GetIsMaximizedOnWebKitTouch: function(index) {
19029  return this.GetIsMaximized(index) && ASPx.Browser.WebKitTouchUI;
19030 },
19031 SetIsMaximized: function(index, value) {
19032  this.SetPropertyValue(index, "isMaximized", value);
19033 },
19034 GetIsMaximizedInit: function(index) {
19035  return this.GetPropertyValue(index, "isMaximizedInit");
19036 },
19037 SetIsMaximizedInit: function(index, value) {
19038  this.SetPropertyValue(index, "isMaximizedInit", value);
19039 },
19040 GetRestoredWindowData: function(index) {
19041  return ASPx.CloneObject(this.GetPropertyValue(index, "restoredWindowValues"));
19042 },
19043 GetEnableContentScrolling: function(index) {
19044  return this.GetPropertyValue(index, "enableContentScrolling");
19045 },
19046 GetWindowOverflowX: function(index) {
19047  return this.GetPropertyValue(index, "contentOverflowX");
19048 },
19049 GetWindowOverflowY: function(index) {
19050  return this.GetPropertyValue(index, "contentOverflowY");
19051 },
19052 SetRestoredWindowData: function(index, value) {
19053  this.SetPropertyValue(index, "restoredWindowValues", value);
19054 },
19055 GetWindowIsShown: function(index) {
19056  return this.GetPropertyValue(index, "shown");
19057 },
19058 SetWindowIsShown: function(index, shown) {
19059  this.SetPropertyValue(index, "shown", shown);
19060 },
19061 GetWindowWidthFromServer: function(index) {
19062  return this.GetPropertyValue(index, "widthFromServer");
19063 },
19064 GetHideBodyScrollWhenModal: function(index) {
19065  return this.GetPropertyValue(index, "hideBodyScrollWhenModal");
19066 },
19067 SetHideBodyScrollWhenModal: function(index, value) {
19068  this.SetPropertyValue(index, "hideBodyScrollWhenModal", value);
19069 },
19070 GetCanScrollViewPort: function(index) {
19071  return this.GetPropertyValue(index, "canScrollViewPort");
19072 },
19073 HasDefaultWindow: function() {
19074  return this.GetWindowCountCore() === 0;
19075 },
19076 GetWindowFooterHeightLite: function(index) {
19077  var footer = this.GetWindowFooterElement(index);
19078  if(footer)
19079   return footer.offsetHeight;
19080  return null;
19081 },
19082 SetWindowPopUpReasonMouseEvent: function(index, evt) {
19083  evt = ASPx.CloneObject(evt);
19084  if(evt === undefined)
19085   evt = null;
19086  if(0 <= index && index < this.GetWindowCountCore())
19087   this.windowsPopupReasonMouseEventList[index] = evt;
19088  this.defaultPopupReasonMouseEvent = evt;
19089 },
19090 GetPopUpReasonMouseEvent: function() {
19091  return this.GetWindowPopUpReasonMouseEvent(null);
19092 },
19093 GetWindowPopUpReasonMouseEvent: function(window) {
19094  var index = (window != null) ? window.index : -1;
19095  if(0 <= index && index < this.GetWindowCountCore())
19096   return this.windowsPopupReasonMouseEventList[index];
19097  return this.defaultPopupReasonMouseEvent;
19098 },
19099 GetWindowCountCore: function() {
19100  return (this.windows.length > 0) ? this.windows.length : this.windowCount;
19101 },
19102 SetClientModality: function(isModal) {
19103  this.SetWindowClientModality(-1, isModal);
19104 },
19105 SetWindowClientModality: function(index, isModal) {
19106  var modalElement = this.GetWindowModalElement(index);
19107  if(isModal && !ASPx.IsElementVisible(modalElement))
19108   this.DoShowWindowModalElement(index);
19109  if(!isModal && ASPx.IsElementVisible(modalElement)) {
19110   var element = this.GetWindowElement(index);
19111   this.DoHideWindowModalElement(element);
19112  }
19113 },
19114 GetWindowPinButton: function(index) {
19115  return ASPx.GetElementById(this.name + "_HPB" + index);
19116 },
19117 GetWindowCollapseButton: function(index) {
19118  return ASPx.GetElementById(this.name + "_HMNB" + index);
19119 },
19120 GetWindowMaximizeButton: function(index) {
19121  return ASPx.GetElementById(this.name + "_HMXB" + index);
19122 },
19123 GetWindowScrollDiv: function(index) {
19124  return this.GetWindowChild(index, "_CSD" + index);
19125 },
19126 GetWindowElementDisplayValue: function(windowHasAnyScrollbars, windowHeight) {
19127  return windowHasAnyScrollbars && windowHeight ? "block" : "table";
19128 },
19129 GetMainWindowWidth: function(index, noCache) {
19130  return this.GetClientWindowWidth(index, true, noCache);
19131 },
19132 GetClientWindowWidth: function(index, outerSize, noCache) {
19133  if(!noCache && (this.GetIsCollapsed(index) || this.GetIsMaximized(index))) {
19134   var cachedSize = this.GetWindowCachedSize(index);
19135   if(cachedSize != null)
19136    return cachedSize.width;
19137  }
19138  var element = this.GetWindowElement(index);
19139  if(element != null)
19140   return element.offsetWidth;
19141 },
19142 GetMainWindowHeight: function(index, noCache) {
19143  return this.GetClientWindowHeight(index, true, noCache);
19144 },
19145 GetClientWindowHeight: function(index, outerSize, noCache) {
19146  if(!noCache && (this.GetIsCollapsed(index) || this.GetIsMaximized(index))) {
19147   var cachedSize = this.GetWindowCachedSize(index);
19148   if(cachedSize != null)
19149    return cachedSize.height;
19150  }
19151  var element = this.GetWindowElement(index);
19152  if(element != null)
19153   return element.offsetHeight;
19154 },
19155 ShowModal: function() {
19156  this.ShowModalByIndex(-1);
19157 },
19158 ShowModalByIndex: function(index) {
19159  if(this.adaptivityEnabled) {
19160   this.SetAdaptiveModalMode(index, true);
19161   this.ResetModalStyles(index);
19162   this.ResetPopupStyles(index);
19163   this.DoShowModal(index, ASPx.InvalidPosition, ASPx.InvalidPosition, this.GetLastShownPopupElementIndex(index));
19164  }
19165 },
19166 DoShowWindowCore: function(index, x, y, popupElementIndex, closeOtherWindows, allowChangeZIndex, evt, closeOtherReason) {
19167  if(this.IsDOMDisposed()) return;
19168  this.SetWindowPopUpReasonMouseEvent(index, evt);
19169  if(this.adaptivityEnabled) {
19170   this.SetAdaptiveModalMode(index, this.NeedAdaptiveModalMode());
19171   this.ResetModalStyles(index);
19172   if(this.GetAdaptiveModalMode(index)) {
19173    this.ResetPopupStyles(index);
19174    this.DoShowModal(index, x, y, popupElementIndex);
19175    return;
19176   }
19177  }
19178  this.DoShowWindowAtPos(index, x, y, popupElementIndex, closeOtherWindows, allowChangeZIndex, evt, closeOtherReason);
19179 },
19180 NeedAdaptiveModalMode: function() {
19181  return window.innerWidth < this.GetSwitchAtWindowInnerWidth();
19182 },
19183 GetSwitchAtWindowInnerWidth: function() {
19184  return this.switchAtWindowInnerWidth;
19185 },
19186 GetModalSystemCssClass: function() {
19187  return "dxmodalSys";
19188 },
19189 DoShowWindowAtPos: function(index, x, y, popupElementIndex, closeOtherWindows, allowChangeZIndex, evt, closeOtherReason) {
19190  if(!this.isInitialized)
19191   this.PopulatePopupElements(index);
19192  var element = this.GetWindowElement(index);
19193  if(element != null && this.IsWindowElementsIDAssigned(index)) {
19194   this.StopCloseAnimation(index);
19195   this.PrepareToAdjustContentOnShow(index);
19196   if(closeOtherWindows)
19197    aspxGetPopupControlCollection().DoHideAllWindows(element, this.GetWindowElementId(index), false, closeOtherReason, 0);
19198   var isMoving = this.InternalIsWindowVisible(index);
19199   ASPx.SetElementDisplay(element, true);
19200   element.style.display = this.GetWindowElementDisplayValue(this.HasAnyScrollBars(index), this.GetPopupWindowDimensionFromCache(index, false));
19201   element.style.position = "absolute";
19202   var scrollDiv = this.GetWindowScrollDiv(index),
19203    shouldResetScrollSize = scrollDiv && this.GetEnableContentScrolling(index) && ASPx.GetDocumentMaxClientHeight() <= element.offsetHeight,
19204    savedScrollDivHeight = shouldResetScrollSize && scrollDiv.style.height;
19205   if(shouldResetScrollSize)
19206    scrollDiv.style.height = 0;
19207   this.RestoreWindowSizeFromCache(index);
19208   if(!this.GetWindowIsShown(index)) {
19209    var width = this.GetPopupWindowDimensionFromCache(index, true),
19210     height = this.GetPopupWindowDimensionFromCache(index, false);
19211    this.SetClientWindowSizeCoreLite(index, width, height);
19212    this.SetWindowIsShown(index, true);
19213   }
19214   var popupElement = this.GetPopupElement(index, popupElementIndex);
19215   if(popupElement)
19216    this.SetLastShownPopupElementIndex(index, popupElementIndex);
19217   var isDragged = this.GetIsDragged(index),
19218    isMaximized = this.GetIsMaximized(index);
19219   if(isMaximized)
19220    this.NormalizeMaximizedWindowSize(index);
19221   var horizontalPopupPosition = this.GetClientPopupPos(element, popupElement, x, true, isDragged);
19222   var verticalPopupPosition = this.GetClientPopupPos(element, popupElement, y, false, isDragged);
19223   var clientX = horizontalPopupPosition.position;
19224   var clientY = verticalPopupPosition.position;
19225   this.SetWindowPos(index, element, clientX, clientY);
19226   if(shouldResetScrollSize)
19227    scrollDiv.style.height = savedScrollDivHeight;
19228   if(this.hideBodyScrollWhenMaximized && this.GetIsMaximized(index))
19229    ASPx.PopupUtils.BodyScrollHelper.HideBodyScroll(element.id);
19230   this.DoShowWindowModalElement(index);
19231   this.SetVisibleWithAnimation(element, isMoving, index, horizontalPopupPosition, verticalPopupPosition);
19232   this.ShowWindowContentUrl(index);
19233   this.AdjustContentOnShow(index);
19234   scrollDiv = this.GetWindowScrollDiv(index);
19235   if(scrollDiv && this.GetEnableContentScrolling(index)) {
19236    var dimension = null;
19237    var windowMainCell = this.GetWindowMainCell(element);
19238    if(windowMainCell.style.width && windowMainCell.style.height)
19239     dimension = 'both';
19240    else if(windowMainCell.style.width)
19241     dimension = 'width';
19242    else if(windowMainCell.style.height)
19243     dimension = 'height';
19244    if(!dimension)
19245     return;
19246    ASPx.SetElementDisplay(scrollDiv, false);
19247    this.SetWindowScrollDivSize(scrollDiv, index, dimension);
19248    ASPx.SetElementDisplay(scrollDiv, true);
19249   }
19250   this.registerAndActivateWindow(element, index, allowChangeZIndex);
19251   this.RaisePopupOnShow(isMoving, index);
19252   this.CorrectWindowSizeGripPositionLite(index);
19253   this.CorrectWindowHeaderText(index);
19254   this.InitMaximizedWindows(index);
19255   this.InitCollapsedWindows(index);
19256   if(this.GetIsPinned(index)) window.setTimeout(function() { this.HoldPosition(index, true); }.aspxBind(this), 0);
19257   if(!this.GetShowOnPageLoad(index))
19258    this.CorrectElementVerticalAlignment(ASPx.AdjustVerticalMarginsInContainer, this.GetWindowHeaderElement(index));
19259   if(element.style.width.indexOf("px") > -1) {
19260    element.style.width = ASPx.GetCurrentStyle(element).width;
19261   }
19262   this.updateContentScrollIfNeeded(index);
19263  }
19264 },
19265 DoShowModal: function(index, x, y, popupElementIndex) {
19266  var element = this.GetWindowElement(index);
19267  if(element != null) {
19268   this.StopCloseAnimation(index);
19269   this.PrepareToAdjustContentOnShow(index);
19270   if(!ASPx.Browser.WebKitTouchUI)
19271    ASPx.PopupUtils.BodyScrollHelper.HideBodyScroll(element.id);
19272   this.DoShowWindowModalElement(index);
19273   var isMoving = this.InternalIsWindowVisible(index);
19274   ASPx.SetElementDisplay(this.GetModalWrapperElement(index), true, true);
19275   this.ResetScroll(index);
19276   ASPx.SetElementDisplay(element, true, true);
19277   this.SetSizeBeforeShow(index);
19278   this.UpdateAlignment(index);
19279   var popupElement = this.GetPopupElement(index, popupElementIndex);
19280   if(popupElement)
19281    this.SetLastShownPopupElementIndex(index, popupElementIndex);
19282   var horizontalPopupPosition = this.GetClientPopupPos(element, popupElement, x, true, false),
19283    verticalPopupPosition = this.GetClientPopupPos(element, popupElement, y, false, false);
19284   this.SetVisibleWithAnimation(element, isMoving, index, horizontalPopupPosition, verticalPopupPosition);
19285   this.ShowWindowContentUrl(index);
19286   this.AdjustContentOnShow(index);
19287   this.registerAndActivateWindow(element, index, true);
19288   this.RaisePopupOnShow(isMoving, index);
19289   this.CorrectWindowHeaderText(index);
19290   if(!this.GetShowOnPageLoad(index))
19291    this.CorrectElementVerticalAlignment(ASPx.AdjustVerticalMarginsInContainer, this.GetWindowHeaderElement(index));
19292  }
19293 },
19294 SetWindowElementZIndex: function(element, zIndex) {
19295  ASPxClientPopupControlBase.prototype.SetWindowElementZIndex.call(this, element, zIndex);
19296  if(this.adaptivityEnabled)
19297   this.SetModalWrapperZIndex(this.GetWindowIndex(element), zIndex);
19298  else
19299   this.updateContentScrollIfNeeded(this.GetWindowIndex(element));
19300 },
19301 SetModalWrapperZIndex: function(index, zIndex) {
19302  if(!this.GetAdaptiveModalMode(index)) return;
19303  ASPx.SetStyles(this.GetModalWrapperElement(index), {
19304   zIndex: zIndex
19305  });
19306 },
19307 updateContentScrollIfNeeded: function(index) {
19308  var windowElement = this.GetWindowElement(index);
19309  var wrapper = this.getWindowWrapper(windowElement);
19310  var wrapperScroll = this.getWindowWrapperScroll(windowElement);
19311  if(!wrapper || !this.WindowIsModal(index) || !this.GetHideBodyScrollWhenModal(index))
19312   return;
19313  ASPx.PopupUtils.adjustViewportScrollWrapper(wrapper, wrapperScroll, windowElement);
19314 },
19315 getWindowWrapper: function(windowElement) {
19316  return ASPx.GetParentByClassName(windowElement, PopupControlCssClasse
19316s.WindowWrapperCssClassName);
19317 },
19318 getWindowWrapperScroll: function(windowElement) {
19319  return ASPx.GetParentByClassName(windowElement, PopupControlCssClasses.WindowWrapperScrollCssClassName);
19320 },
19321 SizeCanBeSet: function(index, isWindowMaximizedAndCollapsed) {
19322  return ASPxClientPopupControlBase.prototype.SizeCanBeSet.call(this, index, isWindowMaximizedAndCollapsed) && !this.GetAdaptiveModalMode(index);
19323 },
19324 GetPopupWindowDimensionFromCache: function(index, isWidth) {
19325  var dimension;
19326  if(isWidth) {
19327   dimension = this.GetWindowWidthInternal(index);
19328   if(ASPx.IsExists(dimension)) {
19329    dimension = Math.max(dimension, this.GetWindowMinWidth(index));
19330    var maxWidth = this.GetWindowMaxWidth(index);
19331    if(maxWidth)
19332     dimension = Math.min(dimension, maxWidth);
19333   }
19334  }
19335  else {
19336   dimension = this.GetWindowHeightInternal(index);
19337   if(ASPx.IsExists(dimension)) {
19338    if(dimension != constants.DEFAULT_WINDOW_HEIGHT || !this.HasAnyScrollBars(index)) 
19339     dimension = Math.max(dimension, this.GetWindowMinHeight(index));
19340    var maxHeight = this.GetWindowMaxHeight(index);
19341    if(maxHeight)
19342     dimension = Math.min(dimension, maxHeight);
19343   }
19344  }
19345  return dimension;
19346 },
19347 NormalizeMaximizedWindowSize: function(index) {
19348  var width = this.GetPopupWindowDimensionFromCache(index, true),
19349   height = this.GetPopupWindowDimensionFromCache(index, false),
19350   dimensions = this.getDocumentDimensions(index),
19351   sizeNormalizationIsNeeded = width < dimensions.width || height < dimensions.height;
19352  if(sizeNormalizationIsNeeded)
19353   this.NormalizeWindowSize(index, true);
19354 },
19355 NormalizeWindowSize: function(index, isMaximized) {
19356  var width = this.GetClientWindowWidth(index),
19357   height = this.GetClientWindowHeight(index),
19358   normWidth = width,
19359   normHeight = height,
19360   maxWidth = this.GetWindowMaxWidth(index),
19361   minWidth = this.GetWindowMinWidth(index),
19362   maxHeight = this.GetWindowMaxHeight(index),
19363   minHeight = this.GetWindowMinHeight(index);
19364  if(maxWidth)
19365   normWidth = Math.min(normWidth, maxWidth);
19366  if(minWidth)
19367   normWidth = Math.max(normWidth, minWidth);
19368  if(maxHeight)
19369   normHeight = Math.min(normHeight, maxHeight);
19370  if(minHeight)
19371   normHeight = Math.max(normHeight, minHeight);
19372  if(normWidth !== width || normHeight !== height)
19373   this.SetWindowSize(this.GetWindow(index), normWidth, normHeight);
19374  if(isMaximized) {
19375   var dimensions = this.getDocumentDimensions(index);
19376   if(this.GetIsCollapsed(index)) {
19377    if(normWidth != dimensions.width) {
19378     this.SetWindowSizeByIndexCore(index, dimensions.width, normHeight, true);
19379    }
19380   } else {
19381    if(normWidth != dimensions.width || normHeight != dimensions.height) {
19382     this.SetWindowSizeByIndexCore(index, dimensions.width, dimensions.height, false);
19383    }
19384   }
19385  }
19386 },
19387 DoShowWindowModalElement: function(index) {
19388  if(this.CanManipulateWithModalElement(index)) {
19389   if(this.adaptivityEnabled) {
19390    this.DoShowWindowModalElementWithAdaptivity(index);
19391    return;
19392   }
19393   var modalElement = this.GetWindowModalElement(index);
19394   var bodyScrollHasJustBeingHidden = false;
19395   if(this.GetHideBodyScrollWhenModal(index) && (!this.IsWindowVisible(this.GetWindow(index)) || !ASPx.IsElementVisible(modalElement))) {
19396    bodyScrollHasJustBeingHidden = true;
19397    aspxGetPopupControlCollection().LockWindowResizeByBodyScrollVisibilityChanging();
19398    if(!ASPx.Browser.WebKitTouchUI)
19399     ASPx.PopupUtils.BodyScrollHelper.HideBodyScroll(this.GetWindowElementId(index));
19400   }
19401   if(ASPx.Browser.IE && this.GetHideBodyScrollWhenModal(index))
19402    ASPx.Evt.AttachEventToElement(modalElement, ASPx.Evt.GetMouseWheelEventName(), function(evt) { return ASPx.Evt.PreventEventAndBubble(evt); });
19403   ASPx.SetElementDisplay(modalElement, true);
19404   this.AdjustModalElementBounds(modalElement);
19405   this.SetModalElementVisibilityWithAnimation(modalElement, index);
19406   aspxGetPopupControlCollection().RegisterVisibleModalElement(modalElement);
19407   if(bodyScrollHasJustBeingHidden)
19408    aspxGetPopupControlCollection().UnlockWindowResizeByBodyScrollVisibilityChanging();
19409  }
19410 },
19411 DoShowWindowModalElementWithAdaptivity: function(index) {
19412  var overlayElement = this.GetOverlayElement(index);
19413  if(!overlayElement) return;
19414  ASPx.SetStyles(overlayElement, {
19415   right: 0,
19416   bottom: 0,
19417   width: "",
19418   height: ""
19419  });
19420  ASPx.SetElementDisplay(overlayElement, true);
19421  this.SetModalElementVisibilityWithAnimation(overlayElement, index);
19422  ASPx.GetPopupControlCollection().RegisterVisibleModalElement(overlayElement);
19423 },
19424 SetSizeBeforeShow: function(index) {
19425  if(this.GetModalMaxWidth(index) && this.GetModalMaxWidth(index) !== this.DefaultModalMaxWidth)
19426   this.SetAdaptiveMaxWidthByIndex(index, this.GetModalMaxWidth(index));
19427  if(this.GetModalMinWidth(index) !== this.DefaultModalMinWidth)
19428   this.SetAdaptiveMinWidthByIndex(index, this.GetModalMinWidth(index));
19429  this.UpdateHeightDimensions(index);
19430 },
19431 UpdateHeightDimensions: function(index) {
19432  this.UpdateAdaptiveMinHeight(index);
19433  this.UpdateAdaptiveMaxHeight(index);
19434 },
19435 UpdateAdaptiveMinHeight: function(index) {
19436  if(this.GetModalMinHeight(index) !== null)
19437   this.SetAdaptiveHeightDimension(index, "minHeight", this.GetModalMinHeight(index));
19438 },
19439 UpdateAdaptiveMaxHeight: function(index) {
19440  if(this.GetModalMaxHeight(index) !== null)
19441   this.SetAdaptiveHeightDimension(index, "maxHeight", this.GetModalMaxHeight(index));
19442 },
19443 GetClientPopupPos: function(element, popupElement, pos, isX, isDragged) {
19444  if(!this.GetAdaptiveModalMode(this.GetWindowIndex(element)))
19445   return ASPxClientPopupControlBase.prototype.GetClientPopupPos.call(this, element, popupElement, pos, isX, isDragged);
19446  var getPosFunc = isX ? ASPx.GetAbsolutePositionX : ASPx.GetAbsolutePositionY;
19447  return { position: getPosFunc(element) };
19448 },
19449 GetAnimationVerticalDirection: function(index, verticalPopupPosition) {
19450  if(!this.GetAdaptiveModalMode(index))
19451   return ASPxClientPopupControlBase.prototype.GetAnimationVerticalDirection.call(this, index, verticalPopupPosition);
19452  return ASPxClientPopupControl.Animation.GetVerticalDirection(this.modalVerticalAlign, this.modalHorizontalAlign);
19453 },
19454 GetAnimationHorizontalDirection: function(index, horizontalPopupPosition) {
19455  if(!this.GetAdaptiveModalMode(index))
19456   return ASPxClientPopupControlBase.prototype.GetAnimationHorizontalDirection.call(this, index, horizontalPopupPosition);
19457  return ASPxClientPopupControl.Animation.GetHorizontalDirection(this.modalHorizontalAlign);
19458 },
19459 GetDefaultVerticalOffset: function() {
19460  return this.IsSmallDisplay() ? 10 : 30;
19461 },
19462 IsSmallDisplay: function() {
19463  return window.innerWidth < this.GetScreenLimitForCss();
19464 },
19465 GetScreenLimitForCss: function() {
19466  return ASPx.MaxMobileWindowWidth;
19467 },
19468 StartAutoAnimation: function(element, index, horizontalPopupPosition, verticalPopupPosition) {
19469  if(this.adaptivityEnabled) {
19470   if(this.NeedFadeAnimation(index, this.popupAnimationType))
19471    this.StartFadeAnimation(element, index);
19472   else
19473    this.StartSlideAnimation(element, index, horizontalPopupPosition, verticalPopupPosition);
19474  } else 
19475   ASPxClientPopupControlBase.prototype.StartAutoAnimation.call(this, element, index, horizontalPopupPosition, verticalPopupPosition);
19476 },
19477 DoHideWindowWithAutoAnimation: function(index, element, closeReason) {
19478  if(this.NeedFadeAnimation(index, this.closeAnimationType))
19479   this.DoHideWindowWithFadeAnimation(index, element, closeReason);
19480  else
19481   this.DoHideWindowWithSlideAnimation(index, closeReason);
19482 },
19483 IsDraggingAllowed: function(index) {
19484  return this.allowDragging && (!this.GetAdaptiveModalMode(index) || this.allowDraggingInAdaptiveMode);
19485 },
19486 IsResizeAllowed: function(index) {
19487  return ASPxClientPopupControlBase.prototype.IsResizeAllowed.call(this, index) && !this.GetAdaptiveModalMode(index);
19488 },
19489 IsFadeCloseAnimation: function(index) {
19490  return ASPxClientPopupControlBase.prototype.IsFadeCloseAnimation.call(this, index) || this.NeedFadeAnimation(index, this.closeAnimationType);
19491 },
19492 NeedFadeAnimation: function(index, animationType) {
19493  return ASPxClientPopupControl.Animation.NeedFadeAnimation(this.modalHorizontalAlign, this.modalVerticalAlign,
19494   animationType, this.popupHorizontalAlign, this.popupVerticalAlign, this.GetAdaptiveModalMode(index));
19495 },
19496 AllowModalElementAnimation: function(index) {
19497  if(this.GetAdaptiveModalMode(index))
19498   return this.popupAnimationType !== ASPxClientPopupControlBase.AnimationType.None;
19499  return ASPxClientPopupControlBase.prototype.AllowModalElementAnimation.call(this, index);
19500 },
19501 DoHideWindowCore: function(index, closeReason) {
19502  var element = this.GetWindowElement(index);
19503  if(element != null) {
19504   if(this.HasCloseAnimation())
19505    this.PrepareElementAfterCloseAnimation(index, element);
19506   element.isHiding = true;
19507   element.style.zIndex = this.GetDefaultZIndexFromServer();
19508   this.SetIsDragged(index, false);
19509   this.UpdateWindowsStateCookie();
19510   element.isHiding = false;
19511   this.StopShowAnimation(index);
19512   if(ASPx.Browser.WebKitTouchUI || ASPx.Browser.Safari) {
19513    var dummy = element.offsetWidth; 
19514   }
19515   ASPx.SetElementDisplay(element, false);
19516   ASPx.SetElementVisibility(element, false);
19517   if(this.adaptivityEnabled) {
19518    ASPx.SetElementDisplay(this.GetModalWrapperElement(index), "", true);
19519    if(!ASPx.Browser.WebKitTouchUI)
19520     ASPx.PopupUtils.BodyScrollHelper.RestoreBodyScroll(element.i
19520d);
19521    this.SetWrapperScrollVisible(index, true);
19522    this.SetIsDragged(index, false);
19523   }
19524   if(this.hideBodyScrollWhenMaximized && this.GetIsMaximized(index))
19525    ASPx.PopupUtils.BodyScrollHelper.RestoreBodyScroll(element.id);
19526   this.DoHideWindowModalElement(element, closeReason);
19527   this.DoHideWindowIFrame(element);
19528   aspxGetPopupControlCollection().UnregisterVisibleWindow(element);
19529   this.ProcessAccessibleElementOnHide();
19530   this.HideWindowLoadingPanel(index);
19531  }
19532 },
19533 OnAnimationStop: function(index) {
19534  if(this.adaptivityEnabled) {
19535   this.SetWrapperScrollVisible(index, true);
19536   this.UnlockWrapperScrollEventEvent();
19537  }
19538  ASPxClientPopupControlBase.prototype.OnAnimationStop.call(this, index);
19539  if(!this.adaptivityEnabled && ASPx.Browser.Firefox)
19540   this.GetWindowElement(index).style.display = "table";
19541 },
19542 ResetModalStyles: function(index) {
19543  var element = this.GetWindowElement(index);
19544  if(element != null) {
19545   ASPx.SetStyles(element, {
19546    minWidth: "",
19547    maxWidth: "",
19548    marginTop: "",
19549    marginLeft: "",
19550    marginRight: "",
19551    position: ""
19552   });
19553   ASPx.SetStyles(this.GetWindowContentElement(index), {
19554    minHeight: "",
19555    maxHeight: "",
19556   });
19557   this.FixateFooter(index, false, 0);
19558   this.FixateHeader(index, false, 0);
19559   this.SetIsDragged(false);
19560   this.DoHideWindowModalElement(element);
19561  }
19562 },
19563 ResetPopupStyles: function(index) {
19564  var element = this.GetWindowElement(index);
19565  if(element != null) {
19566   ASPx.SetStyles(element, {
19567    left: "",
19568    top: "",
19569    width: "",
19570    height: "",
19571   });
19572   ASPx.SetStyles(this.GetWindowContentWrapperElement(index), {
19573    height: "",
19574    width: "",
19575    display: ""
19576   });
19577   ASPx.SetStyles(this.GetWindowContentElement(index), {
19578    display: "",
19579    width: "",
19580    height: ""
19581   });
19582   this.SetWindowIsShown(index, false);
19583  }
19584 },
19585 InitDivPosForHideSlideAnimation: function(animationDivElement) {
19586  ASPx.PopupUtils.InitAnimationDivCore(animationDivElement);
19587 },
19588 DoHideWindow: function(index, dontRaiseClosing, closeReason) {
19589  var cancel = ASPxClientPopupControlBase.prototype.DoHideWindow.call(this, index, dontRaiseClosing, closeReason);
19590  this.updateContentScrollIfNeeded(index);
19591  return cancel;
19592 },
19593 OnWindowShown: function(windowIndex) {
19594  this.EnsureContent(windowIndex, false);
19595  this.EnsureIFrameHeightAdjusted(windowIndex);
19596  if(this.GetAdaptiveModalMode(windowIndex))
19597   this.ChangeFooterFixed(windowIndex);
19598  else {
19599   var isMaximized = this.GetIsMaximized(windowIndex);
19600   if(isMaximized || this.HasAnyScrollBars(windowIndex))
19601    this.NormalizeWindowSize(windowIndex, isMaximized);
19602  }
19603  this.RaiseShown(windowIndex);
19604  var loadingElementsWillNotBeShown = !this.lpTimers[windowIndex] || this.lpTimers[windowIndex] < 0;
19605  if(this.InWindowCallback(windowIndex) && loadingElementsWillNotBeShown) {
19606   this.ShowWindowLoadingElementsInternal(windowIndex);
19607  }
19608  if(this.GetAdaptiveModalMode(windowIndex))
19609   this.UpdateAdaptiveMinHeight(windowIndex);
19610 },
19611 SetWrapperScrollVisible: function(index, visible) {
19612  if(!this.GetAdaptiveModalMode(index)) return;
19613  var modalWrapper = this.GetModalWrapperElement(index);
19614  if(visible) {
19615   ASPx.Attr.RestoreStyleAttribute(modalWrapper, "overflow-x");
19616   ASPx.Attr.RestoreStyleAttribute(modalWrapper, "overflow-y");
19617  } else {
19618   if(this.modalVerticalAlign === ModalAlign.WindowBottom && this.GetWindowElement(index).offsetHeight <= window.innerHeight)
19619    ASPx.Attr.ChangeStyleAttribute(modalWrapper, "overflow-y", "hidden");
19620   if(this.modalHorizontalAlign === ModalAlign.WindowRight)
19621    ASPx.Attr.ChangeStyleAttribute(modalWrapper, "overflow-x", "hidden");
19622  }
19623 },
19624 GetDragCorrection: function(index, element, isX) {
19625  if(this.adaptivityEnabled) {
19626   var offset = isX ? element.offsetLeft : element.offsetTop;
19627   offset -= ASPx.PxToInt(element.style[isX ? "left" : "top"]);
19628   return ASPx.GetPositionElementOffset(this.GetModalWrapperElement(index), isX) + offset;
19629  } else
19630   return ASPxClientPopupControlBase.prototype.GetDragCorrection.call(this, index, element, isX);
19631 },
19632 GetSlideAnimationDuration: function(index) {
19633  return !this.GetAdaptiveModalMode(index) ? ASPxClientPopupControlBase.prototype.GetSlideAnimationDuration.call(this, index) : 300;
19634 },
19635 GetSlideOffsetCoefficient: function(index) {
19636  return !this.GetAdaptiveModalMode(index) ? ASPxClientPopupControlBase.prototype.GetSlideOffsetCoefficient.call(this, index) : 0.25;
19637 },
19638 InitDivPosForShowSlideAnimation: function(index, animationDivElement, clientX, clientY, onAnimStopCallString) {
19639  if(!this.GetAdaptiveModalMode(index))
19640   ASPxClientPopupControlBase.prototype.InitDivPosForShowSlideAnimation.call(this, index, animationDivElement, clientX, clientY, onAnimStopCallString);
19641  else
19642   ASPx.PopupUtils.InitAnimationProperties(animationDivElement, onAnimStopCallString);
19643 },
19644 BeforeAnySlideAnimation: function(index) {
19645  this.FixateFooter(index, false, 0);
19646  this.FixateHeader(index, false, 0);
19647  this.SetWrapperScrollVisible(index, false);
19648 },
19649 StartSlideAnimation: function(animationDivElement, index, horizontalPopupPosition, verticalPopupPosition) {
19650  if(this.adaptivityEnabled) {
19651   this.LockWrapperScrollEvent();
19652   this.BeforeAnySlideAnimation(index);
19653  }
19654  ASPxClientPopupControlBase.prototype.StartSlideAnimation.call(this, animationDivElement, index, horizontalPopupPosition, verticalPopupPosition);
19655 },
19656 DoHideWindowWithSlideAnimation: function(index, closeReason) {
19657  if(this.adaptivityEnabled)
19658   this.BeforeAnySlideAnimation(index);
19659  ASPxClientPopupControlBase.prototype.DoHideWindowWithSlideAnimation.call(this, index, closeReason);
19660 },
19661 UpdatePositionAfterCallback: function(windowIndex) {
19662  if(this.adaptivityEnabled)
19663   this.TryAutoUpdatePosition(windowIndex);
19664  else if(this.contentLoadingMode === LoadContentViaCallback.OnFirstShow && this.InternalIsWindowVisible(windowIndex))
19665   this.UpdateWindowPositionInternal(windowIndex, this.GetPopupElement(windowIndex, this.GetLastShownPopupElementIndex(windowIndex)));
19666 },
19667 CreateLoadingDiv: function(parentElement, offsetElement, windowIndex) {
19668  if(typeof (windowIndex) != "undefined") { 
19669   var loadingDiv = ASPxClientControl.prototype.CreateLoadingDiv.call(this, parentElement, offsetElement);
19670   loadingDiv.id += windowIndex;
19671   return loadingDiv;
19672  }
19673 },
19674 CreateLoadingPanelWithAbsolutePosition: function(parentElement, offsetElement, windowIndex) {
19675  if(typeof (windowIndex) != "undefined") { 
19676   var loadingPanel = ASPxClientControl.prototype.CreateLoadingPanelWithAbsolutePosition.call(this, parentElement, offsetElement);
19677   loadingPanel.id += windowIndex;
19678   return loadingPanel;
19679  }
19680 },
19681 PerformWindowCallback: function(window, parameter, onSuccess) {
19682  ASPxClientPopupControlBase.prototype.PerformWindowCallback.call(this, window, parameter, onSuccess);
19683 },
19684 SetIframeVisibleForDragging: function(index, visible) {
19685  var iframeElement = this.GetWindowContentIFrameElement(index);
19686  if(ASPx.Browser.IE || ASPx.Browser.Edge) {
19687   if(ASPx.Browser.Edge || ASPx.Browser.Version >= 11)
19688    iframeElement.style.pointerEvents = visible ? "" : "none";
19689   else {
19690    if(visible)
19691     this.RemoveIframeCoverDiv(iframeElement, index);
19692    else
19693     this.CreateIframeCoverDiv(iframeElement, index);
19694   }
19695  }
19696  ASPx.SetElementVisibility(iframeElement, visible);
19697 },
19698 OnResizeStop: function(evt, index, cursor, resizePanel) {
19699  ASPxClientPopupControlBase.prototype.OnResizeStop.call(this, evt, index, cursor, resizePanel);
19700  if(this.IsResizeAllowed(index))
19701   this.SetWindowCachedSize(index, this.GetClientWindowWidth(index), this.GetClientWindowHeight(index));
19702  this.updateContentScrollIfNeeded(index);
19703 },
19704 OnMouseDownModalElement: function(evt, index) {
19705  aspxGetPopupControlCollection().DoHideAllWindows(ASPx.Evt.GetEventSource(evt), "", false, ASPxClientPopupControlCloseReason.OuterMouseClick, evt.offsetX);
19706  this.SetIsPopuped(index, true);
19707 },
19708 IsRaiseAfterResizingLocked: function() {
19709  return this.CollapseExecuting() || this.MaximizationExecuting();
19710 },
19711 GetContentElementChildren: function(index, contentElement) {
19712  var cache = this.GetResizeSessionCache();
19713  if(!cache.contentElementChildren || !cache.contentElementChildren[index]) {
19714   cache.contentElementChildren = [];
19715   cache.contentElementChildren[index] = contentElement.getElementsByTagName("*");
19716  }
19717  return cache.contentElementChildren[index];
19718 },
19719 GetContentElementChildrenScroll: function(index, contentElementChildren) {
19720  var cache = this.GetResizeSessionCache();
19721  if(!cache.contentElementChildrenScroll || !cache.contentElementChildrenScroll[index]) {
19722   cache.contentElementChildrenScroll = [];
19723   cache.contentElementChildrenScroll[index] = [];
19724   for(var i = 0, len = contentElementChildren.length; i < len; i++) {
19725    var child = contentElementChildren[i];
19726    if(!!child.scrollLeft || !!child.scrollTop)
19727     cache.contentElementChildrenScroll[index].push([i, child.scrollLeft, child.scrollTop]);
19728   }
19729  }
19730  return cache.contentElementChildrenScroll[index];
19731 },
19732 GetElementBordersAndPaddings: function(index, element, leftRight) {
19733  var cache = this.GetResizeSessionCache();
19734  if(!cache.elementBordersAndPaddings || !cache.elementBordersAndPaddings[index]) {
19735   cache.elementBordersAndPaddings = [];
19736   var style = ASPx.GetCurrentStyle(element);
19737   cache.elementBordersAndPaddings[index] = {
19738    leftRight: this.getLeftRightBordersAndPaddingsSummaryValue(element, style),
19739    topBottom: this.getLeftRightBordersAndPaddingsSummaryValue(element, style)
19740   };
19741  }
19742  return leftRight ? cache.elementBordersAndPaddings[index].leftRight : cache.elementBordersAndPaddings[index].topBottom;
19743 },
19744 GetHeaderFooterHeight: function(index) {
19745  var cache = this.GetResizeSessionCache();
19746  if(!cache.headerFooterHeight || !cache.headerFooterHeight[index]) {
19747   cache.headerFooterHeight = [];
19748   cache.headerFooterHeight[index] = this.GetHeaderFooterHeightCore(index);
19749  }
19750  return cache.headerFooterHeight[index];
19751 },
19752 getContentElementDisplay: function(correctContentElementSize, contentUrl) {
19753  return correctContentElementSize || contentUrl ? "block" : "table-cell";
19754 },
19755 SetContentWrapperHeightLite: function(index, actualHeight, windowElem, contentWrapper) {
19756  if(!windowElem.style.height || ASPx.IsPercentageSize(windowElem.style.height))
19757   return;
19758  var borderOwner = this.GetWindowBorderOwnerElement(windowElem);
19759  var height = borderOwner == windowElem ? actualHeight : actualHeight - (borderOwner ? ASPx.GetTopBottomBordersAndPaddingsSummaryValue(borderOwner) : 0);
19760  height -= this.GetHeaderFooterHeight(index);
19761  if(height > 0)
19762   contentWrapper.style.height = height + "px";
19763 },
19764 SetWindowScrollDivSize: function(scrollDiv, index, dimension) {
19765  var windowClientTable = this.GetWindowClientTable(index);
19766  var headerElement = this.GetWindowHeaderElement(index);
19767  var height = windowClientTable.offsetHeight;
19768  if(headerElement)
19769   height -= headerElement.offsetHeight;
19770  height -= this.GetWindowFooterHeightLite(index);
19771  if(dimension == 'height' || dimension == 'both')
19772   ASPx.SetOffsetHeight(scrollDiv, height);
19773  if(dimension == 'width' || dimension == 'both') {
19774   var width = windowClientTable.offsetWidth;
19775   var contentElement = this.GetWindowContentElement(index);
19776   width -= this.getLeftRightBordersAndPaddingsSummaryValue(scrollDiv) + ASPx.GetHorizontalBordersWidth(contentElement);
19777   if(width > -1)
19778    scrollDiv.style.width = width + "px";
19779  }
19780  scrollDiv.style.marginRight = "0px";
19781 },
19782 AdjustIFrameHeight: function(index, iframe) {
19783  ASPxClientPopupControlBase.prototype.AdjustIFrameHeight.call(this, index, iframe);
19784  if(!this.InternalIsWindowVisible(index) || !iframe || this.GetAdaptiveModalMode(index)) return;
19785  this.SetIframeAdjustingPostponed(index, false);
19786  var content = this.GetContentContainer(index);
19787  var contentWrapper = this.GetWindowContentWrapperElement(index);
19788  iframe.style.verticalAlign = "text-bottom";
19789  var iframeHeight = contentWrapper.offsetHeight - this.getTopBottomBordersAndPaddingsSummaryValue(content);
19790  if(iframeHeight >= 0)
19791   iframe.style.height = iframeHeight + "px";
19792 },
19793 OnPinButtonClick: function(index) {
19794  var value = this.GetIsPinned(index);
19795  this.SetPinCore(index, !value);
19796 },
19797 SetPinCore: function(index, value) {
19798  if(this.GetIsPinned(index) != value) {
19799   this.SetIsPinned(index, value);
19800   this.HoldPosition(index, value);
19801   this.UpdateWindowsStateCookie();
19802   this.OnPinned(index, value);
19803  }
19804 },
19805 OnPinned: function(index, pinned) {
19806  this.RaisePinnedChanged(index, pinned);
19807 },
19808 HoldPosition: function(index, hold, element) {
19809  if(hold) {
19810   element = element || this.GetWindowElement(index);
19811   if(!element) return;
19812   var x = ASPx.GetAbsoluteX(element);
19813   var y = ASPx.GetAbsoluteY(element);
19814   scrollX = ASPx.GetDocumentScrollLeft();
19815   scrollY = ASPx.GetDocumentScrollTop();
19816   this.SetPinPosX(index, x - scrollX);
19817   this.SetPinPosY(index, y - scrollY);
19818  }
19819  this.UpdateHeaderButtonSelected(index, "GetWindowPinButton", hold);
19820  this.CheckHeaderCursor(index);
19821 },
19822 GetBodyWidth: function() {
19823  return aspxGetPopupControlCollection().GetSavedBodyWidth();
19824 },
19825 GetBodyHeight: function() {
19826  return aspxGetPopupControlCollection().GetSavedBodyHeight();
19827 },
19828 GetIsOutFromViewPort: function(index) {
19829  var element = this.GetWindowElement(index);
19830  if(!element) return false;
19831  var pinXTarget = this.GetPinPosX(index);
19832  var pinYTarget = this.GetPinPosY(index);
19833  var popupWindowWidth = this.GetClientWindowWidth(index);
19834  var docClientWidth = ASPx.GetDocumentClientWidth();
19835  var rightOutOffset = (pinXTarget + popupWindowWidth) - docClientWidth;
19836  var popupWindowHeight = this.GetClientWindowHeight(index);
19837  var docClientHeight = ASPx.GetDocumentClientHeight();
19838  var bottomOutOffset = (pinYTarget + popupWindowHeight) - docClientHeight;
19839  return (rightOutOffset > 0 || bottomOutOffset > 0);
19840 },
19841 needToHidePinnedOutFromViewPort: function(index) {
19842  return this.GetIsPinned(index) && this.GetIsOutFromViewPort(index);
19843 },
19844 AdjustPinPositionWhileScroll: function(index) {
19845  var element = this.GetWindowElement(index);
19846  if(!element) return;
19847  var x = ASPx.GetAbsoluteX(element);
19848  var y = ASPx.GetAbsoluteY(element);
19849  var scrollX = ASPx.GetDocumentScrollLeft();
19850  var scrollY = ASPx.GetDocumentScrollTop();
19851  var pinX = x - scrollX;
19852  var pinY = y - scrollY;
19853  var pinXTarget = this.GetPinPosX(index);
19854  var pinYTarget = this.GetPinPosY(index);
19855  if((pinX != pinXTarget) || (pinY != pinYTarget)) {
19856   this.lockScroll++;
19857   var xNew = pinXTarget + scrollX;
19858   var yNew = pinYTarget + scrollY;
19859   var bodyWidth = this.GetBodyWidth();
19860   var bodyHeight = this.GetBodyHeight();
19861   var popupWindowWidth = this.GetClientWindowWidth(index);
19862   var docClientWidth = ASPx.GetDocumentClientWidth();
19863   var rightOutOffset = (pinXTarget + popupWindowWidth) - docClientWidth;
19864   var popupWindowHeight = this.GetClientWindowHeight(index);
19865   var docClientHeight = ASPx.GetDocumentClientHeight();
19866   var bottomOutOffset = (pinYTarget + popupWindowHeight) - docClientHeight;
19867   var cancelScrollX = false;
19868   if(xNew + (popupWindowWidth - rightOutOffset) > bodyWidth) {
19869    xNew -= (xNew + (popupWindowWidth - rightOutOffset) - bodyWidth);
19870    cancelScrollX = true;
19871   }
19872   var cancelScrollY = false;
19873   if(yNew + (popupWindowHeight - bottomOutOffset) > bodyHeight) {
19874    yNew -= (yNew + (popupWindowHeight - bottomOutOffset) - bodyHeight);
19875    cancelScrollY = true;
19876   }
19877   xNew = ASPx.PrepareClientPosForElement(xNew, element, true);
19878   yNew = ASPx.PrepareClientPosForElement(yNew, element, false);
19879   this.SetWindowPos(index, element, xNew, yNew);
19880   if(cancelScrollX) {
19881    var scrollLeftMax = bodyWidth - ASPx.GetDocumentClientWidth();
19882    if((rightOutOffset > 0) && (scrollX > scrollLeftMax)) {
19883     this.lockScroll++;
19884     ASPx.SetDocumentScrollLeft(scrollLeftMax);
19885     this.lockScroll--;
19886    }
19887   }
19888   if(cancelScrollY) {
19889    var scrollTopMax = bodyHeight - ASPx.GetDocumentClientHeight();
19890    if((bottomOutOffset > 0) && (scrollY > scrollTopMax)) {
19891     this.lockScroll++;
19892     ASPx.SetDocumentScrollTop(scrollTopMax);
19893     this.lockScroll--;
19894    }
19895   }
19896   this.lockScroll--;
19897  }
19898 },
19899 OnCollapseButtonClick: function(index) {
19900  this.SetCollapsedCore(index, !this.GetIsCollapsed(index));
19901 },
19902 SetCollapsedCore: function(index, minimization) {
19903  if(this.GetIsCollapsed(index) == minimization) return;
19904  this.DoCollapse(index, minimization);
19905  this.OnCollapsed(index, minimization);
19906 },
19907 DoCollapse: function(index, minimization) {
19908  if(this.GetIsCollapsed(index) == minimization) return;
19909  this.StartCollapse();
19910  if(minimization) {
19911   var cachedWidth = this.GetClientWindowWidth(index);
19912   var cachedHeight = this.GetClientWindowHeight(index);
19913   var shouldUpdateRestoredSize = this.ShoulUpdatedRestoredWindowSizeOnCollapse(index);
19914   var width = this.GetMainWindowWidth(index, !shouldUpdateRestoredSize);
19915   var height = this.GetMainWindowHeight(index, !shouldUpdateRestoredSize);
19916   this.SetWindowSizeByIndex(index, width, 0);
19917   this.SetWindowContentVisible(index, false);
19918   this.SetWindowFooterVisible(index, false);
19919   this.ResetWindowHeight(index);
19920   this.SetIsCollapsed(index, minimization);
19921   this.SetWindowCachedSize(index, cachedWidth, cachedHeight);
19922   if(shouldUpdateRestoredSize)
19923    this.UpdateRestoredWindowSize(index, width, height);
19924  }
19925  else {
19926   if(this.MaximizationExecuting()) {
19927    var element = this.GetWindowElement(index);
19928    if(element) {
19929     element.style.left = ASPx.GetDocumentScrollLeft();
19930     element.style.top = ASPx.GetDocumentScrollTop();
19931    }
19932   }
19933   this.SetWindowContentVisible(index, true);
19934   this.SetWindowFooterVisible(index, true);
19935   this.SetIsCollapsed(index, minimization);
19936   if(this.GetIsMaximized(index)) {
19937    var documentClientWidth = ASPx.PopupUtils.GetDocumentClientWidthForPopup();
19938    var documentClientHeight = ASPx.PopupUtils.GetDocumentClientHeightForPopup();
19939    this.SetWindowSizeByIndex(index, documentClientWidth, documentClientHeight);
19940   } else {
19941    var restoredWindowData = this.GetRestoredWindowData(index);
19942    this.SetWindowSizeByIndex(index, restoredWindowData.width, restoredWindowData.height);
19943   }
19944   ASPx.GetControlCollection().AdjustControls(this.GetWindowElement(index));
19945  }
19946  this.UpdateHeaderButtonSelected(index, "GetWindowCollapseButton", minimization);
19947  this.EndCollapse();
19948  this.UpdateWindowsStateCookie();
19949 },
19950 ResetWindowHeight: function(index) {
19951  var element = this.GetWindowElement(index);
19952  if(element)
19953   element.style.height = "";
19954 },
19955 ShoulUpdatedRestoredWindowSizeOnCollapse: function(index) {
19956  return !this.GetIsMaximized(index);
19957 },
19958 OnCollapsed: function(index, value) {
19959  if(value)
19960   this.RaiseCollapsed(index);
19961  else
19962   this.RaiseExpanded(index);
19963  this.RaiseAfterResizing(index);
19964 },
19965 OnMaximizeButtonClick: function(index) {
19966  this.SetMaximizedCore(index, !this.GetIsMaximized(index));
19967 },
19968 SetMaximizedCore: function(index, maximization) {
19969  if(this.GetIsMaximized(index) == maximization) return;
19970  this.DoMaximize(index, maximization);
19971  this.OnMaximizedChanged(index, maximization);
19972 },
19973 GetMaximizedPosition: function(element, isX) {
19974  if(ASPx.Browser.WebKitTouchUI)
19975   return ASPx.PrepareClientPosForElement(0, element, isX);
19976  return ASPx.PrepareClientPosForElement(isX ? ASPx.GetDocumentScrollLeft() : ASPx.GetDocumentScrollTop(), element, isX);
19977 },
19978 PerformMaximaze: function (index, maximization, element) {
19979  if (this.hideBodyScrollWhenMaximized)
19980   ASPx.PopupUtils.BodyScrollHelper.HideBodyScroll(element.id);
19981  if (this.GetIsCollapsed(index))
19982   this.DoCollapse(index, false);
19983  var cachedWidth = this.GetClientWindowWidth(index);
19984  var cachedHeight = this.GetClientWindowHeight(index);
19985  var restoredWindowData = this.GetInitRestoredWindowData(index);
19986  var documentClientWidth = ASPx.PopupUtils.GetDocumentClientWidthForPopup();
19987  var documentClientHeight = ASPx.PopupUtils.GetDocumentClientHeightForPopup();
19988  var windowClientTable = this.GetWindowClientTable(index);
19989  var windowClientTableParent = windowClientTable.parentNode;
19990  childStyle = ASPx.GetCurrentStyle(windowClientTableParent);
19991  var left = this.GetMaximizedPosition(element, true);
19992  var top = this.GetMaximizedPosition(element, false);
19993  this.SetWindowPos(index, element, left, top);
19994  this.SetWindowSizeByIndex(index, documentClientWidth, documentClientHeight);
19995  this.SetWindowCachedSize(index, cachedWidth, cachedHeight);
19996  this.SetRestoredWindowData(index, restoredWindowData);
19997  this.SetIsMaximized(index, maximization);
19998 },
19999 PerformMinimize: function (index, maximization, element) {
20000  var restoredWindowData = this.GetRestoredWindowData(index);
20001  var width = restoredWindowData.width || this.GetMainWindowWidth(index);
20002  var height = restoredWindowData.height || this.GetMainWindowHeight(index);
20003  this.SetIsMaximized(index, maximization);
20004  var left = ASPx.PrepareClientPosForElement(restoredWindowData.left, element, true);
20005  var top = ASPx.PrepareClientPosForElement(restoredWindowData.top, element, false);
20006  this.SetWindowPos(index, element, left, top);
20007  this.SetWindowSizeByIndex(index, width, height);
20008  if (this.GetIsCollapsed(index)) {
20009   this.SetIsCollapsed(index, false);
20010   this.UpdateRestoredWindowSizeLock();
20011   this.DoCollapse(index, true);
20012   this.UpdateRestoredWindowSizeUnlock();
20013  }
20014  if (this.hideBodyScrollWhenMaximized)
20015   ASPx.PopupUtils.BodyScrollHelper.RestoreBodyScroll(element.id);
20016 },
20017 DoMaximize: function(index, maximization) {
20018  if(this.GetIsMaximized(index) == maximization) return;
20019  var element = this.GetWindowElement(index);
20020  if(!element) return;
20021  this.StartMaximization();
20022  if(maximization)
20023   this.PerformMaximaze(index, maximization, element);
20024  else
20025   this.PerformMinimize(index, maximization, element);
20026  if(this.GetIsPinned(index))
20027   this.HoldPosition(index, true, element);
20028  this.UpdateHeaderButtonSelected(index, "GetWindowMaximizeButton", maximization);
20029  this.EndMaximization();
20030  this.UpdateWindowsStateCookie();
20031  this.CheckHeaderCursor(index);
20032 },
20033 OnMaximizedChanged: function(index, value) {
20034  if(value)
20035   this.RaiseMaximized(index);
20036  else
20037   this.RaiseRestoredAfterMaximized(index);
20038  this.RaiseAfterResizing(index);
20039 },
20040 GetInitRestoredWindowData: function(index) {
20041  var restoredWindowData = this.GetRestoredWindowData(index);
20042  restoredWindowData.left = this.GetCurrentLeft(index);
20043  restoredWindowData.top = this.GetCurrentTop(index);
20044  restoredWindowData.width = this.GetMainWindowWidth(index);
20045  restoredWindowData.height = this.GetMainWindowHeight(index);
20046  return restoredWindowData;
20047 },
20048 getDocumentDimensions: function(index) {
20049  if(ASPx.Browser.WebKitTouchUI)
20050   ASPx.Attr.ChangeStyleAttribute(this.GetWindowElement(index), "display", "none");
20051  var documentClientWidth = ASPx.PopupUtils.GetDocumentClientWidthForPopup(),
20052   documentClientHeight = ASPx.PopupUtils.GetDocumentClientHeightForPopup();
20053  if(ASPx.Browser.WebKitTouchUI)
20054   ASPx.Attr.RestoreStyleAttribute(this.GetWindowElement(index), "display");
20055  return { width: documentClientWidth, height: documentClientHeight};
20056 }, 
20057 UpdateMaximizedWindowSizeOnResize: function(index) {
20058  this.StartUpdateMaximizedWindowSizeOnResize();
20059  var dimensions = this.getDocumentDimensions(index);
20060  if(this.GetIsCollapsed(index)) dimensions.height = 0;
20061  this.SetWindowSizeByIndex(index, dimensions.width, dimensions.height);
20062  if(this.GetIsCollapsed(index)) {
20063   this.CorrectCollapsedSize(index);
20064  }
20065  window.setTimeout(function() { this.SetMaximizedWindowSizeAfterOnResize(index); }.aspxBind(this), 0);
20066  this.EndUpdateMaximizedWindowSizeOnResize();
20067 },
20068 SetMaximizedWindowSizeAfterOnResize: function(index) {
20069  this.StartUpdateMaximizedWindowSizeOnResize();
20070  var dimensions = this.getDocumentDimensions(index);
20071  windowWidthCurrent = this.GetMainWindowWidth(index, true);
20072  windowHeightCurrent = this.GetMainWindowHeight(index, true);
20073  if(this.GetIsCollapsed(index))
20074   dimensions.height = 0;
20075  if(dimensions.width != windowWidthCurrent || dimensions.height != windowHeightCurrent) {
20076   this.SetWindowSizeByIndex(index, dimensions.width, dimensions.height);
20077   if(this.GetIsCollapsed(index)) {
20078    this.CorrectCollapsedSize(index);
20079   }
20080  }
20081  this.EndUpdateMaximizedWindowSizeOnResize();
20082 },
20083 CorrectCollapsedSize: function(index) {
20084  var contentWrapper = this.GetWindowContentWrapperElement(index);
20085  if(contentWrapper && ASPx.IsElementVisible(contentWrapper))
20086   contentWrapper.style.display = 'none';
20087 },
20088 UpdateHeaderButtonSelected: function(index, methodGetWindowButton, flagSelected) {
20089  if(typeof (ASPx.GetStateController) != "undefined") {
20090   button = this[methodGetWindowButton](index);
20091   var method = flagSelected ? "SelectElementBySrcElement" : "DeselectElementBySrcElement";
20092   ASPx.GetStateController()[method](button);
20093  }
20094 },
20095 CheckHeaderCursor: function(index) {
20096  if(!this.allowDragging) return;
20097  var dragElement = this.GetDragElement(index);
20098  if(!dragElement) return;
20099  var styleCursor = dragElement.style.cursor;
20100  var isPinned = this.GetIsPinned(index);
20101  var isMaximized = this.GetIsMaximized(index);
20102  if((isPinned || isMaximized) && styleCursor != "default")
20103   dragElement.style.cursor = "default";
20104  else if(!isPinned && !isMaximized && styleCursor != "move")
20105   dragElement.style.cursor = "move";
20106 },
20107 StartCollapse: function() {
20108  this.collapseExecutingLockCount++;
20109 },
20110 EndCollapse: function() {
20111  this.collapseExecutingLockCount--;
20112 },
20113 CollapseExecuting: function() {
20114  return this.collapseExecutingLockCount > 0;
20115 },
20116 StartMaximization: function() {
20117  this.maximizationExecutingLockCount++;
20118 },
20119 EndMaximization: function() {
20120  this.maximizationExecutingLockCount--;
20121 },
20122 MaximizationExecuting: function() {
20123  return this.maximizationExecutingLockCount > 0;
20124 },
20125 StartUpdateMaximizedWindowSizeOnResize: function() {
20126  this.browserResizingForMaxWindowLockCount++;
20127 },
20128 EndUpdateMaximizedWindowSizeOnResize: function() {
20129  this.browserResizingForMaxWindowLockCount--;
20130 },
20131 ResizingForMaxWindowLocked: function() {
20132  return this.browserResizingForMaxWindowLockCount > 0;
20133 },
20134 UpdateRestoredWindowSizeLock: function() {
20135  this.updateRestoredWindowSizeLockCount++;
20136 },
20137 UpdateRestoredWindowSizeUnlock: function() {
20138  this.updateRestoredWindowSizeLockCount--;
20139 },
20140 UpdateRestoredWindowSizeLocked: function() {
20141  return this.updateRestoredWindowSizeLockCount > 0;
20142 },
20143 UpdateRestoredWindowSize: function(index, width, height) {
20144  if(!this.UpdateRestoredWindowSizeLocked()) {
20145   restoredMinWindowData = this.GetRestoredWindowData(index);
20146   restoredMinWindowData.width = width;
20147   restoredMinWindowData.height = height;
20148   this.SetRestoredWindowData(index, restoredMinWindowData);
20149  }
20150 },
20151 GetWindowsState: function() {
20152  var state = ASPxClientPopupControlBase.prototype.GetWindowsState.call(this);
20153  for(var i = 0; i < this.GetWindowCountCore() ; i++) {
20154   state += this.GetWindowState(i);
20155   if(i < this.GetWindowCountCore() - 1) state += ";";
20156  }
20157  return state;
20158 },
20159 CreateWindows: function(windowsNames) {
20160  for(var i = 0; i < windowsNames.length; i++) {
20161   var window = new ASPxClientPopupWindow(this, i, windowsNames[i]);
20162   this.windows.push(window);
20163  }
20164 },
20165 RaiseCloseButtonClick: function(index) {
20166  ASPxClientPopupControlBase.prototype.RaiseCloseButtonClick.call(this, index);
20167 },
20168 RaisePinnedChanged: function(index, pinned) {
20169  var window = index < 0 ? null : this.GetWindow(index);
20170  if(!this.PinnedChanged.IsEmpty()) {
20171   var args = new ASPxClientPopupWindowPinnedChangedEventArgs(window, pinned);
20172   this.PinnedChanged.FireEvent(this, args);
20173  }
20174 },
20175 RaiseCollapsed: function(index) {
20176  this.RaiseResize(index, ASPxClientPopupControlResizeState.Collapsed);
20177 },
20178 RaiseExpanded: function(index) {
20179  this.RaiseResize(index, ASPxClientPopupControlResizeState.Expanded);
20180 },
20181 RaiseMaximized: function(index) {
20182  this.RaiseResize(index, ASPxClientPopupControlResizeState.Maximized);
20183 },
20184 RaiseRestoredAfterMaximized: function(index) {
20185  this.RaiseResize(index, ASPxClientPopupControlResizeState.RestoredAfterMaximized);
20186 },
20187 GetContentWidth: function() {
20188  return this.GetWindowContentWidth(null);
20189 },
20190 GetContentHeight: function() {
20191  return this.GetWindowContentHeight(null);
20192 },
20193 SetSize: function(width, height) {
20194  ASPxClientPopupControlBase.prototype.SetSize.call(this, width, height);
20195 },
20196 GetWindowDimension: function(window, isWidth, forceFromCache) {
20197  var index = (window != null) ? window.index : -1;
20198  return this.GetWindowDimensionByIndex(index, isWidth, forceFromCache);
20199 },
20200 GetWindowContentDimension: function(window, isWidth) {
20201  var index = (window != null) ? window.index : -1,
20202   contentElem = this.GetWindowContentElement(index),
20203   dimensionHolder = contentElem.parentNode,
20204   paddingsHolder = contentElem;
20205  return isWidth ?
20206  (dimensionHolder.offsetWidth - this.getLeftRightBordersAndPaddingsSummaryValue(paddingsHolder)) :
20207  (dimensionHolder.offsetHeight - this.getTopBottomBordersAndPaddingsSummaryValue(paddingsHolder));
20208 },
20209 GetWindowContentWidth: function(window) {
20210  return this.GetWindowContentDimension(window, true);
20211 },
20212 GetWindowContentHeight: function(window) {
20213  return this.GetWindowContentDimension(window, false);
20214 },
20215 GetWindowHeight: function(window) {
20216  return this.GetWindowDimension(window, false);
20217 },
20218 GetWindowWidth: function(window) {
20219  return this.GetWindowDimension(window, true);
20220 },
20221 SetWindowSize: function(window, width, height) {
20222  return ASPxClientPopupControlBase.prototype.SetWindowSize.call(this, window, width, height);
20223 },
20224 GetContentHTML: function() {
20225  return this.GetContentHtml();
20226 },
20227 SetContentHTML: function(html) {
20228  this.SetContentHtml(html);
20229 },
20230 SetWindowPopupElementID: function(window, popupElementId) {
20231  var index = (window != null) ? window.index : -1;
20232  this.SetPopupElementIDByIndex(index, popupElementId);
20233 },
20234 SetPopupElementID: function(popupElementId) {
20235  this.SetPopupElementIDByIndex(-1, popupElementId);
20236 },
20237 GetCurrentPopupElementIndex: function() {
20238  return this.GetWindowCurrentPopupElementIndexByWindowIndex(-1);
20239 },
20240 GetWindowCurrentPopupElementIndex: function(window) {
20241  var index = (window != null) ? window.index : -1;
20242  return this.GetWindowCurrentPopupElementIndexByWindowIndex(index);
20243 },
20244 GetCurrentPopupElement: function() {
20245  return this.GetWindowCurrentPopupElementByIndex(-1);
20246 },
20247 GetWindowCurrentPopupElement: function(window) {
20248  var index = (window != null) ? window.index : -1;
20249  return this.GetWindowCurrentPopupElementByIndex(index);
20250 },
20251 ShowAtPos: function(x, y) {
20252  this.ShowWindowAtPos(null, Math.round(x), Math.round(y));
20253 },
20254 BringToFront: function() {
20255  this.BringWindowToFront(null);
20256 },
20257 IsWindowVisible: function(window) {
20258  return ASPxClientPopupControlBase.prototype.IsWindowVisible.call(this, window);
20259 },
20260 GetWindow: function(index) {
20261  return ASPxClientPopupControlBase.prototype.GetWindow.call(this, index);
20262 },
20263 GetWindowByName: function(name) {
20264  for(var i = 0; i < this.windows.length; i++)
20265   if(this.windows[i].name == name) return this.windows[i];
20266  return null;
20267 },
20268 GetWindowCount: function() {
20269  return this.GetWindowCountCore();
20270 },
20271 ShowWindow: function(window, popupElementIndex) {
20272  var index = (window != null) ? window.index : -1;
20273  this.ShowWindowByIndex(index, popupElementIndex);
20274 },
20275 ShowWindowAtElement: function(window, htmlElement) {
20276  var index = (window != null) ? window.index : -1;
20277  this.ShowWindowAtElementByIndex(index, htmlElement);
20278 },
20279 ShowWindowAtElementByID: function(window, id) {
20280  var htmlElement = document.getElementById(id);
20281  this.ShowWindowAtElement(window, htmlElement);
20282 },
20283 ShowWindowAtPos: function(window, x, y) {
20284  if(!this.isInitialized)
20285   return;
20286  var index = (window != null) ? window.index : -1;
20287  this.DoShowWindowCore(index, x, y, -1, false, true);
20288 },
20289 BringWindowToFront: function(window) {
20290  var index = (window != null) ? window.index : -1;
20291  var element = this.GetWindowElement(index);
20292  aspxGetPopupControlCollection().ActivateWindowElement(element, undefined, this.GetPopupType(), this.GetDefaultZIndexFromServer(), this.GetPopupControlZIndex());
20293 },
20294 HideWindow: function(window) {
20295  ASPxClientPopupControlBase.prototype.HideWindow.call(this, window);
20296 },
20297 GetWindowContentHTML: function(window) {
20298  return this.GetWindowContentHtml(window);
20299 },
20300 SetWindowContentHTML: function(window, html) {
20301  this.SetWindowContentHtml(window, html);
20302 },
20303 GetWindowContentHtml: function(window) {
20304  return ASPxClientPopupControlBase.prototype.GetWindowContentHtml.call(this, window);
20305 },
20306 SetWindowContentHtml: function(window, html, useAnimation) {
20307  ASPxClientPopupControlBase.prototype.SetWindowContentHtml.call(this, window, html, useAnimation);
20308 },
20309 AfterSetWindowContentHtml: function(index, contentContainer, useAnimation) {
20310  if(this.GetAdaptiveModalMode(index))
20311   this.TryAutoUpdatePosition(index);
20312  else
20313   this.RecalculateWindowSize(index);
20314  ASPxClientPopupControlBase.prototype.AfterSetWindowContentHtml.call(this, index, contentContainer, useAnimation);
20315  this.UpdateScrollbar(index);
20316 },
20317 UpdateAlignment: function(index) {
20318  if(this.GetIsDragged(index)) return;
20319  var element = this.GetWindowElement(index),
20320   wrapperStyle = getComputedStyle(this.GetModalWrapperElement(index)),
20321   top = ASPxClientPopupControl.AligmentCalculator.CalculateTopMargin(this.modalVerticalAlign, element.offsetHeight, this.GetDefaultVerticalOffset()),
20322   left = ASPxClientPopupControl.AligmentCalculator.CalculateLeftRightMargin(this.modalHorizontalAlign, ModalAlign.WindowLeft, wrapperStyle.paddingLeft),
20323   right = ASPxClientPopupControl.AligmentCalculator.CalculateLeftRightMargin(this.modalHorizontalAlign, ModalAlign.WindowRight, wrapperStyle.paddingRight);
20324  ASPx.SetStyles(element, {
20325   marginTop: top,
20326   marginLeft: left,
20327   marginRight: right
20328  });
20329 },
20330 GetOverlayElement: function(index) {
20331  return this.GetWindowModalElement(index);
20332 },
20333 GetModalWrapperElement: function(index) {
20334  if(!this.adaptivityEnabled) return null;
20335  var windowElement = this.GetWindowElement(index);
20336  return !!windowElement ? windowElement.parentNode : null;
20337 },
20338 GetWindowHeightWithoutContent: function(index) {
20339  var element = this.GetWindowElement(index),
20340   borderOwner = this.GetWindowBorderOwnerElement(element);
20341  return this.GetHeaderFooterHeightCore(index) + ASPx.GetVerticalBordersWidth(borderOwner);
20342 },
20343 StretchVertically: function() {
20344  this.StretchVerticallyByIndex(-1, true);
20345 },
20346 WindowStretchVertically: function(window) {
20347  var index = (window != null) ? window.index : -1;
20348  this.StretchVerticallyByIndex(index, true);
20349 },
20350 StretchVerticallyByIndex: function(index, value) {
20351  if(this.GetStretchVerticallyByIndex(index) !== value) {
20352   this.SetPropertyValue(index, "stretchVertically", value);
20353   var oldMinHeight = !!this.GetModalMinHeight(index) ? this.GetModalMinHeight(index) : 0;
20354   this.SetPropertyValue(index, "modalMinHeight", value ? "100vh" : this.minHeightBackup);
20355   this.minHeightBackup = oldMinHeight;
20356   this.UpdateHeightDimensions(index);
20357  }
20358 },
20359 SetAdaptiveMinWidth: function(minWidth) {
20360  this.SetAdaptiveMinWidthByIndex(-1, minWidth);
20361 },
20362 SetWindowAdaptiveMinWidth: function(window, minWidth) {
20363  var index = (window != null) ? window.index : -1;
20364  this.SetAdaptiveMinWidthByIndex(index, minWidth);
20365 },
20366 SetAdaptiveMaxWidth: function(maxWidth) {
20367  this.SetAdaptiveMaxWidthByIndex(-1, maxWidth);
20368 },
20369 SetWindowAdaptiveMaxWidth: function(window, maxWidth) {
20370  var index = (window != null) ? window.index : -1;
20371  this.SetAdaptiveMaxWidthByIndex(index, maxWidth);
20372 },
20373 SetAdaptiveMinHeight: function(minHeight) {
20374  this.SetAdaptiveMinHeightByIndex(-1, minHeight);
20375 },
20376 SetWindowAdaptiveMinHeight: function(window, minHeight) {
20377  var index = (window != null) ? window.index : -1;
20378  this.SetAdaptiveMinHeightByIndex(index, minHeight);
20379 },
20380 SetAdaptiveMaxHeight: function(maxHeight) {
20381  this.SetAdaptiveMaxHeightByIndex(-1, maxHeight);
20382 },
20383 SetWindowAdaptiveMaxHeight: function(window, maxHeight) {
20384  var index = (window != null) ? window.index : -1;
20385  this.SetAdaptiveMaxHeightByIndex(index, maxHeight);
20386 },
20387 SetAdaptiveHeightDimension: function(index, propertyName, value) {
20388  value = this.ConvertDimensionValueToString(value);
20389  value = value.indexOf("%") > -1 ? value.replace("%", "vh") : value;
20390  var margins = 0;
20391  if(this.stretchVertically && propertyName === "minHeight")
20392   margins = ASPx.GetTopBottomMargins(this.GetWindowElement(index));
20393  var additionalHeight = this.GetWindowHeightWithoutContent(index) + margins,
20394   contentElement = this.GetWindowContentElement(index);
20395  contentElement.style[propertyName] = "calc(" + value + " - " + additionalHeight + "px)";
20396  var iframe = this.GetWindowContentIFrameElement(index);
20397  if(!!contentElement.style.minHeight) {
20398   if(!iframe)
20399    contentElement.style.height = "auto";
20400   if(!!iframe || contentElement.offsetHeight <= ASPx.PxToInt(getComputedStyle(contentElement).minHeight) || this.HasAnyScrollBars(index))
20401    contentElement.style.height = "1px";
20402  }
20403  if(!!iframe) {
20404   iframe.style.verticalAlign = "text-bottom";
20405   iframe.style.height = "100%";
20406  }
20407 },
20408 ConvertDimensionValueToString: function(value) {
20409  if(typeof value === "number")
20410   return value + "px";
20411  if(typeof value === "string")
20412   return value;
20413 },
20414 CanBeClosedByClickOnElement: function(index, srcElement, posX, id) {
20415  return ASPxClientPopupControlBase.prototype.CanBeClosedByClickOnElement.call(this, index, srcElement, posX, id) &&
20416   (!this.GetAdaptiveModalMode(index) || srcElement != this.GetModalWrapperElement(index) || posX < srcElement.offsetWidth - ASPx.GetVerticalScrollBarWidth());
20417 },
20418 SetWindowDisplay: function(index, value) {
20419  ASPxClientPopupControlBase.prototype.SetWindowDisplay.call(this, index, value);
20420  if(this.GetAdaptiveModalMode(index)) {
20421   var wrapper = this.GetModalWrapperElement(index);
20422   ASPx.SetElementDisplay(wrapper, value, true);
20423  }
20424 },
20425 HaveSpecialDivForAnimation: function() {
20426  return ASPxClientPopupControlBase.prototype.HaveSpecialDivForAnimation.call(this) || this.adaptivityEnabled;
20427 },
20428 WindowIsModal: function(index) {
20429  return ASPxClientPopupControlBase.prototype.WindowIsModal.call(this, index) || this.GetAdaptiveModalMode(index);
20430 },
20431 RecalculateWindowSize: function(index) {
20432  var window = this.GetWindowElement(index);
20433  var displayAfterSetSize = window.style.display;
20434  this.SetClientWindowSizeCoreLite(index, this.GetWindowWidthInternal(index), this.GetWindowHeightInternal(index), this.GetIsCollapsed(index));
20435  window.style.display = displayAfterSetSize;
20436  if(this.HasAnyScrollBars(index))
20437   this.NormalizeWindowSize(index, this.GetIsMaximized(index));
20438 },
20439 GetWindowContentIFrame: function(window) {
20440  return ASPxClientPopupControlBase.prototype.GetWindowContentIFrame.call(this, window);
20441 },
20442 GetWindowContentUrl: function(window) {
20443  return ASPxClientPopupControlBase.prototype.GetWindowContentUrl.call(this, window);
20444 },
20445 SetWindowContentUrl: function(window, url) {
20446  ASPxClientPopupControlBase.prototype.SetWindowContentUrl.call(this, window, url);
20447 },
20448 RefreshDimensionsAfterCreateIframe: function(index) {
20449  if(ASPx.IsElementVisible(this.GetWindowElement(index), true)) {
20450   var windowWidth = this.GetWindowDimensionByIndex(index, true, false);
20451   var windowHeight = this.GetWindowDimensionByIndex(index, false, false);
20452   this.SetClientWindowSizeCoreLite(index, windowWidth, windowHeight);
20453  }
20454 },
20455 GetPinned: function() {
20456  return this.GetIsPinned(-1);
20457 },
20458 SetPinned: function(value) {
20459  this.SetPinCore(-1, value);
20460 },
20461 GetWindowPinned: function(window) {
20462  var index = (window != null) ? window.index : -1;
20463  return this.GetIsPinned(index);
20464 },
20465 SetWindowPinned: function(window, value) {
20466  var index = (window != null) ? window.index : -1;
20467  this.SetPinCore(index, value);
20468 },
20469 GetMaximized: function() {
20470  return this.GetIsMaximized(-1);
20471 },
20472 SetMaximized: function(value) {
20473  this.SetMaximizedCore(-1, value);
20474 },
20475 GetWindowMaximized: function(window) {
20476  var index = (window != null) ? window.index : -1;
20477  return this.GetIsMaximized(index);
20478 },
20479 SetWindowMaximized: function(window, value) {
20480  var index = (window != null) ? window.index : -1;
20481  this.SetMaximizedCore(index, value);
20482 },
20483 GetCollapsed: function() {
20484  return this.GetIsCollapsed(-1);
20485 },
20486 SetCollapsed: function(value) {
20487  this.SetCollapsedCore(-1, value);
20488 },
20489 GetWindowCollapsed: function(window) {
20490  var index = (window != null) ? window.index : -1;
20491  return this.GetIsCollapsed(index);
20492 },
20493 SetWindowCollapsed: function(window, value) {
20494  var index = (window != null) ? window.index : -1;
20495  this.SetCollapsedCore(index, value);
20496 },
20497 RefreshWindowContentUrl: function(window) {
20498  ASPxClientPopupControlBase.prototype.RefreshWindowContentUrl.call(this, window);
20499 },
20500 SetWindowContentVisible: function(index, visible) {
20501  var contentElement = this.GetWindowContentWrapperElement(index);
20502  if(contentElement)
20503   this.SetWindowPartVisibleCore(contentElement, "DXPopupWindowContentDisplay", visible);
20504 },
20505 SetWindowFooterVisible: function(index, visible) {
20506  var footerElement = this.GetWindowFooterElement(index);
20507  if(footerElement)
20508   this.SetWindowPartVisibleCore(footerElement, "DXPopupWindowFooterDisplay", visible);
20509 },
20510 SetWindowPartVisibleCore: function(partElement, displayCacheName, visible) {
20511  var nothingChanged = ASPx.IsElementVisible(partElement) && visible;
20512  if(nothingChanged) return;
20513  if(!(ASPx.IsExists(partElement[displayCacheName])))
20514   partElement[displayCacheName] = partElement.style.display;
20515  partElement.style.display = visible ? partElement[displayCacheName] : 'none';
20516 },
20517 UpdatePosition: function() {
20518  this.UpdatePositionAtElement(this.GetPopupElement(-1, this.GetLastShownPopupElementIndex(-1)));
20519 },
20520 UpdatePositionAtElement: function(popupElement) {
20521  ASPxClientPopupControlBase.prototype.UpdatePositionAtElement.call(this, popupElement);
20522 },
20523 UpdateWindowPosition: function(window) {
20524  var index = (window != null) ? window.index : -1;
20525  this.UpdateWindowPositionAtElement(window, this.GetPopupElement(index, this.GetLastShownPopupElementIndex(index)));
20526 },
20527 UpdateWindowPositionAtElement: function(window, popupElement) {
20528  ASPxClientPopupControlBase.prototype.UpdateWindowPositionAtElement.call(this, window, popupElement);
20529 },
20530 UpdateWindowPositionInternal: function(index, popupElement) {
20531  if(this.GetAdaptiveModalMode(index)) {
20532   this.TryAutoUpdatePosition(index);
20533   return;
20534  }
20535  if(!ASPxClientPopupControlBase.prototype.UpdateWindowPositionInternal.call(this, index, popupElement))
20536   this.DoShowWindowAtPos(index, ASPx.InvalidDimension, ASPx.InvalidDimension, this.GetLastShownPopupElementIndex(index), false, false);
20537 },
20538 UpdateMode: function(index) {
20539  if(!this.adaptivityEnabled) return;
20540  var currentMode = this.GetAdaptiveModalMode(index),
20541   newMode = this.NeedAdaptiveModalMode();
20542  if(currentMode != newMode) {
20543   this.SetAdaptiveModalMode(index, newMode);
20544   this.ShowWindowByIndex(-1);
20545  }
20546 },
20547 TryAutoUpdatePosition: function(index) {
20548  this.UpdateMode(index);
20549  ASPxClientPopupControlBase.prototype.TryAutoUpdatePosition.call(this, index);
20550  if(this.GetAdaptiveModalMode(index)) {
20551   this.CorrectScrollPositionOnAndroid();
20552   this.ResetWebkitScrolling(this.GetModalWrapperElement(index), 100);
20553   this.UpdateHeightDimensions(index);
20554   this.ChangeHeaderFixed(index);
20555   this.UpdateAlignment(index);
20556   this.ChangeFooterFixed(index);
20557   if(this.GetIsDragged(index) &&
20558    ASPxClientPopupControl.WindowResizeHelper.AdjustModalOnWindowResize(this.GetWindowElement(index)))
20559    this.SetIsDragged(index, false);
20560  }
20561  if(this.GetIsMaximized(index)) {
20562   this.CorrectScrollPositionOnAndroid();
20563   this.UpdateMaximizedWindowSizeOnResize(index);
20564  }
20565 },
20566 CorrectScrollPositionOnAndroid: function() {
20567  if(ASPx.Browser.AndroidMobilePlatform) {
20568   var activeElement = this.GetActiveElementIncludingIframes();
20569   if(activeElement && (activeElement.tagName === "INPUT" || activeElement.tagName === "TEXTAREA"))
20570    window.setTimeout(function() {
20571     if(activeElement.scrollIntoViewIfNeeded)
20572      activeElement.scrollIntoViewIfNeeded();
20573    }, 100);
20574  }
20575 },
20576 GetActiveElementIncludingIframes: function(document) {
20577  document = document || window.document;
20578  if(document.body === document.activeElement || document.activeElement.tagName === "IFRAME") {
20579   var iframes = document.getElementsByTagName("iframe");
20580   for(var i = 0; i < iframes.length; i++) {
20581    var focused = this.GetActiveElementIncludingIframes(iframes[i].contentWindow.document);
20582    if(focused !== false) {
20583     return focused;
20584    }
20585   }
20586  } else 
20587   return document.activeElement;
20588  return false;
20589 },
20590 OnModalWrapperScroll: function(e, index) {
20591  if(!this.GetAdaptiveModalMode(index) || this.IsWrapperScrollEventLocked()) return;
20592  this.ChangeHeaderFixed(index);
20593  this.ChangeFooterFixed(index);
20594 },
20595 OnModalWrapperTouchStart: function(e) {
20596  this.touchStartY = e.touches[0].clientY;
20597 },
20598 OnModalWrapperTouchMove: function (e, index) {
20599  if(e.touches.length > 1)
20600   return;
20601  var preventScroll = this.RequirePreventScrollForAdaptiveMode(e, index);
20602  if(preventScroll)
20603   e.preventDefault();
20604  this.touchStartY = e.touches[0].clientY;
20605 },
20606 RequirePreventScrollForAdaptiveMode: function(e, index) {
20607  var modalWrapper = this.GetModalWrapperElement(index),
20608   zoom = modalWrapper.offsetWidth / window.innerWidth,
20609   activeElement = document.activeElement,
20610   activeTyping = !!activeElement && (activeElement["type"] === "text" || activeElement["type"] === "textarea"); 
20611  if(zoom !== 1 || activeTyping)
20612   return false;
20613  var currentY = e.touches[0].clientY,
20614   preventScroll = currentY > this.touchStartY && modalWrapper.scrollTop === 0 ||
20615    currentY < this.touchStartY && modalWrapper.scrollTop + modalWrapper.clientHeight >= modalWrapper.scrollHeight;
20616  if(!preventScroll)
20617   return false;
20618  var targetElement = ASPx.Evt.GetEventSource(e),
20619   contentWrapper = this.GetWindowContentWrapperElement(index);
20620  while(targetElement && targetElement !== contentWrapper && targetElement.tagName !== 'BODY') {
20621   if(this.ElementHasScroll(targetElement))
20622    return false;
20623   targetElement = targetElement.parentNode;
20624  }
20625  return true;
20626 },
20627 ElementHasScroll: function(elem) {
20628  var style = window.getComputedStyle(elem);
20629  return ["overflow", "overflow-x", "overflow-y"].some(function(prop) {
20630   return ASPx.Data.ArrayContains(["scroll","auto"], style[prop]);
20631  });
20632 },
20633 GetFixedHeaderMaxBottom: function(index) {
20634  var contentWrapper = this.GetWindowContentWrapperElement(index);
20635  return ASPx.GetAbsolutePositionY(contentWrapper) + contentWrapper.offsetHeight;
20636 },
20637 GetFixedFooterMaxTop: function(index) {
20638  var header = this.GetWindowHeaderElement(index),
20639   contentWrapper = this.GetWindowContentWrapperElement(index),
20640   headerBottom = !!header ? ASPx.GetAbsolutePositionY(header) + header.offsetHeight : ASPx.GetAbsolutePositionY(contentWrapper);
20641  return window.innerHeight - headerBottom;
20642 },
20643 ChangeHeaderFixed: function(index) {
20644  if(!this.GetFixedHeader(index)) return;
20645  var element = this.GetWindowElement(index),
20646   modalWrapper = this.GetModalWrapperElement(index),
20647   isHeaderPartiallyHidden = modalWrapper.scrollTop > element.offsetTop,
20648   maxBottom = isHeaderPartiallyHidden ? this.GetFixedHeaderMaxBottom(index) : 0;
20649  this.FixateHeader(index, isHeaderPartiallyHidden, maxBottom);
20650 },
20651 ChangeFooterFixed: function(index) {
20652  if(!this.GetFixedFooter(index) || !this.GetWindowFooterElement(index)) return;
20653  var element = this.GetWindowElement(index),
20654   modalWrapper = this.GetModalWrapperElement(index),
20655   isFooterPartiallyHidden = element.offsetTop + element.offsetHeight - modalWrapper.scrollTop > window.innerHeight,
20656   maxTop = isFooterPartiallyHidden ? this.GetFixedFooterMaxTop(index) : 0;
20657  this.FixateFooter(index, isFooterPartiallyHidden, maxTop);
20658 },
20659 ChangeHeaderFooterFixed: function(index, elementToFix, isFixed, fixedClassName, offsetName, maxPos) {
20660  if(!elementToFix) return;
20661  var element = this.GetWindowElement(index),
20662   contentWrapper = this.GetWindowContentWrapperElement(index),
20663   changeClassNameFunc = isFixed ? ASPx.AddClassNameToElement : ASPx.RemoveClassNameFromElement,
20664   elementToFixHeight = elementToFix.offsetHeight;
20665  if(isFixed) {
20666   var borderOwner = this.GetWindowBorderOwnerElement(element),
20667    width = ASPx.GetClearClientWidth(borderOwner);
20668   ASPx.SetOffsetWidth(elementToFix, width);
20669   elementToFix.style[offsetName] = maxPos < elementToFixHeight ? maxPos - elementToFixHeight + "px" : "";
20670  } else
20671   elementToFix.style.width = "";
20672  contentWrapper.style["margin-" + offsetName] = isFixed ? elementToFixHeight + "px" : 0;
20673  changeClassNameFunc(elementToFix, fixedClassName);
20674 },
20675 FixateFooter: function(index, isFixed, maxTop) {
20676  this.ChangeHeaderFooterFixed(index, this.GetWindowFooterElement(index), isFixed, "dxFixedFooter", "bottom", maxTop);
20677 },
20678 FixateHeader: function(index, isFixed, maxBottom) {
20679  this.ChangeHeaderFooterFixed(index, this.GetWindowHeaderElement(index), isFixed, "dxFixedHeader", "top", maxBottom);
20680 },
20681 LockWrapperScrollEvent: function() {
20682  this.wrapperScrollEventLocked = true;
20683 },
20684 UnlockWrapperScrollEventEvent: function() {
20685  this.wrapperScrollEventLocked = false;
20686 },
20687 IsWrapperScrollEventLocked: function() {
20688  return this.wrapperScrollEventLocked;
20689 },
20690 ResetScroll: function(index) {
20691  if(!this.GetAdaptiveModalMode(index)) return;
20692  this.LockWrapperScrollEvent();
20693  this.GetModalWrapperElement(index).scrollTop = 0;
20694  this.UnlockWrapperScrollEventEvent();
20695 },
20696 AdjustModalElementBounds: function(element) {
20697  if(!ASPx.IsExistsElement(element)) return;
20698  ASPx.SetStyles(element, {
20699   left: 0,
20700   top: 0,
20701   right: 0,
20702   bottom: 0,
20703   width: "",
20704   height: ""
20705  });
20706 },
20707 RefreshPopupElementConnection: function() {
20708  ASPxClientPopupControlBase.prototype.RefreshPopupElementConnection.call(this);
20709 }
20710});
20711ASPxClientPopupControl.AligmentCalculator = (function() {
20712 function CalculateTopMargin(verticalAlign, elementHeight, defaultOffset) {
20713  if(verticalAlign === ModalAlign.WindowTop)
20714   return "";
20715  if(elementHeight < window.innerHeight) {
20716   var freeSpace = window.innerHeight - elementHeight;
20717   switch(verticalAlign) {
20718    case ModalAlign.WindowCenter:
20719     return freeSpace / 2;
20720    case ModalAlign.WindowBottom:
20721     return freeSpace - defaultOffset;
20722   }
20723  }
20724  return "";
20725 }
20726 function CalculateLeftRightMargin(horizontalAlign, forAligmenment, wrapperPadding) {
20727  if(horizontalAlign === forAligmenment) {
20728   if(ASPx.PxToInt(wrapperPadding) !== 0)
20729    return 0;
20730   return 10;
20731  }
20732  return "";
20733 }
20734 return {
20735  CalculateTopMargin: CalculateTopMargin,
20736  CalculateLeftRightMargin: CalculateLeftRightMargin
20737 };
20738})();
20739ASPxClientPopupControl.Animation = (function() {
20740 function GetVerticalDirection(verticalAlign, horizontalAlign) {
20741  switch(verticalAlign) {
20742   case ModalAlign.WindowTop:
20743    return -1;
20744   case ModalAlign.WindowCenter:
20745    if(horizontalAlign === ModalAlign.WindowCenter)
20746     return -1;
20747    return 0;
20748   case ModalAlign.WindowBottom:
20749    return 1;
20750  }
20751 }
20752 function GetHorizontalDirection(horizontalAlign) {
20753  switch(horizontalAlign) {
20754   case ModalAlign.WindowLeft:
20755    return -1;
20756   case ModalAlign.WindowCenter:
20757    return 0;
20758   case ModalAlign.WindowRight:
20759    return 1;
20760  }
20761 }
20762 function NeedFadeAnimation(horizontalAlign, verticalAlign, animationType, popupHorizontalAlign, popupVerticalAlign, adaptiveModalMode) {
20763  if(animationType === ASPxClientPopupControlBase.AnimationType.Auto) {
20764   if(adaptiveModalMode)
20765    return horizontalAlign === ModalAlign.WindowCenter && verticalAlign === ModalAlign.WindowCenter;
20766   else
20767    return popupHorizontalAlign === ASPx.PopupUtils.WindowCenterAlignIndicator && popupVerticalAlign === ASPx.PopupUtils.WindowCenterAlignIndicator;
20768  }
20769  return false;
20770 }
20771 return {
20772  GetVerticalDirection: GetVerticalDirection,
20773  GetHorizontalDirection: GetHorizontalDirection,
20774  NeedFadeAnimation: NeedFadeAnimation
20775 };
20776})();
20777ASPxClientPopupControl.WindowResizeHelper = (function() {
20778 var previousInnerWidth = 0,
20779  previousMargin = 0;
20780 function AdjustModalOnWindowResize(element) {
20781  var offsetLeft = element.offsetLeft,
20782   offsetWidth = element.offsetWidth,
20783   windowWidth = window.innerWidth,
20784   expectedLeft = windowWidth / 2 - offsetWidth / 2,
20785   toTheRightOfCenter = offsetLeft > expectedLeft,
20786   dw = windowWidth - previousInnerWidth,
20787   computedStyle = getComputedStyle(element),
20788   left = ASPx.PxToFloat(computedStyle.left),
20789   currentMargin = ASPx.PxToFloat(computedStyle.marginLeft),
20790   dm = currentMargin - previousMargin,
20791   newLeft = left - dm;
20792  if(toTheRightOfCenter)
20793   newLeft += dw;
20794  ASPx.SetStyles(element, { left: newLeft + "px" });
20795  if(Math.abs(offsetLeft - expectedLeft) <= 10 || dw < 0 && toTheRightOfCenter !== (element.offsetLeft > expectedLeft)) {
20796   ASPx.SetStyles(element, { left: "" });
20797   ASPx.Attr.RestoreStyleAttribute(element, "top");
20798   ASPx.Attr.RestoreStyleAttribute(element, "margin-top");
20799   return true;
20800  }
20801  previousMargin = currentMargin;
20802  previousInnerWidth = windowWidth;
20803  return false;
20804 }
20805 function Initialize(element) {
20806  previousInnerWidth = window.innerWidth;
20807  ASPx.Attr.ChangeStyleAttribute(element, "top", element.offsetTop + "px");
20808  ASPx.Attr.ChangeStyleAttribute(element, "margin-top", "0");
20809  previousMargin = ASPx.PxToFloat(getComputedStyle(element).marginLeft);
20810 }
20811 return {
20812  Initialize: Initialize,
20813  AdjustModalOnWindowResize: AdjustModalOnWindowResize
20814 };
20815})();
20816ASPxClientPopupControl.Cast = ASPxClientControl.Cast;
20817ASPxClientPopupControl.GetPopupControlCollection = function() {
20818 return aspxGetPopupControlCollection();
20819};
20820var ASPxClientPopupWindow = ASPx.CreateClass(null, {
20821 constructor: function(popupControl, index, name) {
20822  this.popupControl = popupControl;
20823  this.index = index;
20824  this.name = name;
20825 },
20826 GetHeaderImageUrl: function() {
20827  return this.popupControl.GetWindowHeaderImageUrl(this.index);
20828 },
20829 SetHeaderImageUrl: function(value) {
20830  this.popupControl.SetWindowHeaderImageUrl(this.index, value);
20831 },
20832 GetFooterImageUrl: function() {
20833  return this.popupControl.GetWindowFooterImageUrl(this.index);
20834 },
20835 SetFooterImageUrl: function(value) {
20836  this.popupControl.SetWindowFooterImageUrl(this.index, value);
20837 },
20838 GetHeaderNavigateUrl: function() {
20839  return this.popupControl.GetWindowHeaderNavigateUrl(this.index);
20840 },
20841 SetHeaderNavigateUrl: function(value) {
20842  this.popupControl.SetWindowHeaderNavigateUrl(this.index, value);
20843 },
20844 GetFooterNavigateUrl: function() {
20845  return this.popupControl.GetWindowFooterNavigateUrl(this.index);
20846 },
20847 SetFooterNavigateUrl: function(value) {
20848  this.popupControl.SetWindowFooterNavigateUrl(this.index, value);
20849 },
20850 GetHeaderText: function() {
20851  return this.popupControl.GetWindowHeaderText(this.index);
20852 },
20853 SetHeaderText: function(value) {
20854  this.popupControl.SetWindowHeaderText(this.index, value);
20855 },
20856 GetFooterText: function() {
20857  return this.popupControl.GetWindowFooterText(this.index);
20858 },
20859 SetFooterText: function(value) {
20860  this.popupControl.SetWindowFooterText(this.index, value);
20861 }
20862});
20863var ASPxClientPopupWindowEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
20864 constructor: function(window) {
20865  this.constructor.prototype.constructor.call(this);
20866  this.window = window;
20867 }
20868});
20869var ASPxClientPopupWindowCancelEventArgs = ASPx.CreateClass(ASPxClientCancelEventArgs, {
20870 constructor: function(window, closeReason) {
20871  this.constructor.prototype.constructor.call(this);
20872  this.window = window;
20873  this.closeReason = closeReason;
20874 }
20875});
20876var ASPxClientPopupWindowCloseUpEventArgs = ASPx.CreateClass(ASPxClientPopupWindowEventArgs, {
20877 constructor: function(window, closeReason) {
20878  this.constructor.prototype.constructor.call(this, window);
20879  this.closeReason = closeReason;
20880 }
20881});
20882var ASPxClientPopupWindowResizeEventArgs = ASPx.CreateClass(ASPxClientPopupWindowEventArgs, {
20883 constructor: function(window, resizeState) {
20884  this.constructor.prototype.constructor.call(this, window);
20885  this.resizeState = resizeState;
20886 }
20887});
20888var ASPxClientPopupWindowPinnedChangedEventArgs = ASPx.CreateClass(ASPxClientPopupWindowEventArgs, {
20889 constructor: function(window, pinned) {
20890  this.constructor.prototype.constructor.call(this, window);
20891  this.pinned = pinned;
20892 }
20893});
20894var ASPxClientPopupControlCollection = ASPx.CreateClass(ASPxClientControlCollection, {
20895 constructor: function() {
20896  this.constructor.prototype.constructor.call(this);
20897  this.draggingControl = null;
20898  this.draggingWindowIndex = -1;
20899  this.gragXOffset = 0;
20900  this.gragYOffset = 0;
20901  this.visibleModalElements = [];
20902  this.visiblePopupWindowIds = [];
20903  this.windowResizeByBodyScrollVisibilityChangingLockCount = 0;
20904  this.savedBodyWidth = 0;
20905  this.savedBodyHeight = 0;
20906  this.overControl = null;
20907  this.overWindowIndex = -1;
20908  this.overXPos = ASPx.InvalidPosition;
20909  this.overYPos = ASPx.InvalidPosition;
20910  this.appearTimerID = -1;
20911  this.disappearTimerID = -1;
20912  this.scrollEventLockCount = 0;
20913  this.currentActiveWindowElement = null;
20914  this.resizeControl = null;
20915  this.resizeIndex = -2;
20916  this.resizeCursor = "";
20917  this.resizePanel = null;
20918  this.selectBanned = false;
20919  this.pcWindowsAreRestrictedByDocumentWindow = true;
20920  this.docScrollLeft = -1;
20921  this.docScrollTop = -1;
20922  this.EnsureSaveScrollState();
20923 },
20924 GetCollectionType: function(){
20925  return "Popup";
20926 },
20927 Remove: function(popupControl) {
20928  for(var i = this.visibleModalElements.length - 1; i >= 0; i--) {
20929   var modalElement = this.visibleModalElements[i];
20930   if(modalElement && modalElement.DXModalPopupControl === popupControl)
20931    this.UnregisterVisibleModalElement(modalElement);
20932  }
20933  for(var j = this.visiblePopupWindowIds.length - 1; j >= 0; j--) {
20934   var id = this.visiblePopupWindowIds[j];
20935   if(!ASPx.IsExists(id)) continue;
20936   var popupWindow = this.GetPopupWindowFromID(id);
20937   if(popupWindow.popupControl === popupControl) {
20938    var windowElement = popupControl.GetWindowElement(popupWindow.windowIndex);
20939    if(windowElement)
20940     this.UnregisterVisibleWindow(windowElement);
20941    else
20942     ASPx.Data.ArrayRemove(this.visiblePopupWindowIds, id);
20943   }
20944  }
20945  ASPxClientControlCollection.prototype.Remove.call(this, popupControl);
20946 },
20947 EnsureSaveScrollState: function() {
20948  if(ASPx.documentLoaded && this.docScrollLeft < 0 && this.docScrollTop < 0)
20949   this.SaveScrollState();
20950 },
20951 GetPopupWindowFromID: function(id) {
20952  var pos = id.lastIndexOf(ASPx.PCWIdSuffix);
20953  var name = id.substring(0, pos);
20954  var index = id.substr(pos + ASPx.PCWIdSuffix.length);
20955  var popupControl = aspxGetPopupControlCollection().Get(name);
20956  return { popupControl: popupControl, windowIndex: index };
20957 },
20958 DoHideAllWindows: function(srcElement, excptId, applyToAll, closeReason, posX) {
20959  for(var i = this.visiblePopupWindowIds.length - 1; i >= 0; i--) {
20960   var id = this.visiblePopupWindowIds[i];
20961   if(id == excptId) continue;
20962   var popupWindow = this.GetPopupWindowFromID(id),
20963    windowIndex = popupWindow.windowIndex,
20964    popupControl = popupWindow.popupControl;
20965   if(!popupControl.CanBeClosedByClickOnElement(windowIndex, srcElement, posX, id)) continue;
20966   if(popupControl != null) {
20967    var popupWindowZIndexArray = ASPx.PopupUtils.GetElementZIndexArray(popupControl.GetWindowElement(windowIndex));
20968    var isPopupHigherSrcElement = ASPx.PopupUtils.IsHigher(popupWindowZIndexArray, ASPx.PopupUtils.GetElementZIndexArray(srcElement)) || !popupControl.HasDefaultWindow();
20969    var windowCloseAction = popupControl.GetWindowCloseAction(windowIndex);
20970    if ((windowCloseAction != "CloseButton" && windowCloseAction != "None") && isPopupHigherSrcElement || applyToAll)
20971     popupControl.DoHideWindow(parseInt(windowIndex), false, closeReason);
20972   }
20973  }
20974 },
20975 DoShowAtCurrentPos: function(name, index, popupElementIndex, evtClone) {
20976  var pc = this.Get(name);
20977  if(pc != null && !pc.InternalIsWindowVisible(index))
20978   pc.DoShowWindowCore(index, this.overXPos, this.overYPos, popupElementIndex, true, true, evtClone, ASPxClientPopupControlCloseReason.MouseOut);
20979 },
20980 WindowZIndexWasInitialized: function(zIndex, pcZIndex) {
20981  return pcZIndex <= zIndex;
20982 },
20983 ActivateWindowElement: function(element, evt, popupType, defZIndex, zIndex) {
20984  var maxZIndex = this.GetMaxZIndex(popupType, defZIndex),
20985   topZIndex = this.WindowZIndexWasInitialized(maxZIndex, zIndex) ? parseInt(maxZIndex) : zIndex;
20986  if(this.WindowZIndexWasInitialized(element.style.zIndex, zIndex) && element.style.zIndex != topZIndex) {
20987   this.DeleteWindowFromZIndexOrder(element);
20988  }
20989  if(!this.WindowZIndexWasInitialized(element.style.zIndex, zIndex))
20990   topZIndex += 2;
20991  var popupWindow = this.GetPopupWindowFromID(element.id);
20992  popupWindow.popupControl.SetWindowElementZIndex(element, topZIndex);
20993  var pcWElementEventSource = ASPx.PopupUtils.FindEventSourceParentByTestFunc(evt, aspxTestPopupWindowElement);
20994  if(!evt || (evt && pcWElementEventSource == element)) { 
20995   if(this.GetCurrentActiveWindowElement() != element) {
20996    this.RefreshTabIndexes(false);
20997    this.SaveCurrentActiveWindowElement(element);
20998   }
20999  }
21000 },
21001 RefreshTabIndexes: function(forceRecalculate) {
21002  var topModalWindow = this.GetTopModalWindow();
21003  if(topModalWindow != null || forceRecalculate) {
21004   var topModalWindowZIndexArray = ASPx.PopupUtils.GetElementZIndexArray(topModalWindow);
21005   this.CalculateTabIndexes(topModalWindowZIndexArray);
21006  }
21007 },
21008 ElementHasTabIndex: function(element) {
21009  return ASPx.IsExists(ASPx.Attr.GetAttribute(element, "tabindex"));
21010 },
21011 IsElementCanBeActive: function(element) { 
21012  return element.tagName === "INPUT" || element.tagName === "A" ||
21013   element.tagName === "BUTTON" || element.tagName === "TEXTAREA" ||
21014   element.tagName === "SELECT" || this.ElementHasTabIndex(element);
21015 },
21016 GetCanBeActiveElements: function() { 
21017  var elements = document.getElementsByTagName("*"),
21018   canBeActiveElements = [];
21019  for(var i = 0; i < elements.length; i++) {
21020   if(this.IsElementCanBeActive(elements[i]))
21021    canBeActiveElements.push(elements[i]);
21022  }
21023  return canBeActiveElements;
21024 },
21025 GetEditableDivs: function(){
21026  if(document.querySelectorAll)
21027   return document.querySelectorAll("div[contenteditable=true]");
21028  var editableDivs = [ ];
21029  var allDivs = document.getElementsByTagName("DIV");
21030  for(var i = 0; i < allDivs.length; i++){
21031   var div = allDivs[i];
21032   if(div.getAttribute("contenteditable") == 'true')
21033    editableDivs.push(div);
21034  }
21035  return editableDivs;
21036 },
21037 CalculateTabIndexes: function(topModalWindowZIndexArray) {
21038  var elements = this.GetCanBeActiveElements();
21039  for(var i = 0; i < elements.length; i++) {
21040   var currentElementZIndexArray = ASPx.PopupUtils.GetElementZIndexArray(elements[i]);
21041   if(ASPx.PopupUtils.IsHigher(currentElementZIndexArray, topModalWindowZIndexArray))
21042    ASPx.Attr.RestoreTabIndexAttribute(elements[i]);
21043   else
21044    ASPx.Attr.ChangeTabIndexAttribute(elements[i]);
21045  }
21046 },
21047 PopupWindowIsModalByVisibleIndex: function(visiblePopupWindowIndex) {
21048  return this.PopupWindowIsModalByID(this.visiblePopupWindowIds[visiblePopupWindowIndex]);
21049 },
21050 PopupWindowIsModalByID: function(windowElementID) {
21051  var popupWindow = this.GetPopupWindowFromID(windowElementID);
21052  return popupWindow.popupControl.WindowIsModal(popupWindow.windowIndex);
21053 },
21054 SaveCurrentActiveWindowElement: function(windowElement) {
21055  this.currentActiveWindowElement = windowElement;
21056 },
21057 SkipCurrentActiveWindowElement: function(element) {
21058  if(element == this.GetCurrentActiveWindowElement())
21059   this.SaveCurrentActiveWindowElement(null);
21060 },
21061 GetCurrentActiveWindowElement: function() {
21062  return this.currentActiveWindowElement;
21063 },
21064 GetMaxZIndex: function (type, defaultZIndex) {
21065  var maxZIndex = defaultZIndex;
21066  for(var i = 0; i < this.visiblePopupWindowIds.length; i++) {
21067   var id = this.visiblePopupWindowIds[i];
21068   if(type !== undefined && this.GetPopupWindowFromID(id).popupControl.GetPopupType() !== type)
21069    continue;
21070   var currentWindow = ASPx.GetElementById(id);
21071   if(!!currentWindow && ASPx.IsElementVisible(currentWindow) && currentWindow.style && currentWindow.style.zIndex > maxZIndex)
21072    maxZIndex = currentWindow.style.zIndex;
21073  }
21074  return maxZIndex;
21075 },
21076 GetTopModalWindow: function() {
21077  return this.GetTopWindow(true);
21078 },
21079 GetTopWindow: function(onlyModal) {
21080  var topWindow = null;
21081  var topWindowZIndexArray = null;
21082  for(var i = 0; i < this.visiblePopupWindowIds.length; i++) {
21083   var currentWindow = ASPx.GetElementById(this.visiblePopupWindowIds[i]);
21084   if(onlyModal && !this.PopupWindowIsModalByVisibleIndex(i))
21085    continue;
21086   if(ASPx.IsElementVisible(currentWindow)) {
21087    var currentWindowZIndexArray = ASPx.PopupUtils.GetElementZIndexArray(currentWindow);
21088    if(topWindow == null || ASPx.PopupUtils.IsHigher(currentWindowZIndexArray, topWindowZIndexArray)) {
21089     topWindow = currentWindow;
21090     topWindowZIndexArray = currentWindowZIndexArray;
21091    }
21092   }
21093  }
21094  return topWindow;
21095 },
21096 DeleteWindowFromZIndexOrder: function(element) {
21097  for(var i = this.visiblePopupWindowIds.length - 1; i >= 0; i--) {
21098   var windowElement = ASPx.GetElementById(this.visiblePopupWindowIds[i]);
21099   if(!windowElement)
21100    ASPx.Data.ArrayRemoveAt(this.visiblePopupWindowIds, i);
21101   else if(windowElement.style.zIndex > element.style.zIndex) {
21102    var popupWindow = this.GetPopupWindowFromID(this.visiblePopupWindowIds[i]);
21103    popupWindow.popupControl.SetWindowElementZIndex(windowElement, windowElement.style.zIndex - 2);
21104   }
21105  }
21106 },
21107 AdjustModalElementsBounds: function() {
21108  for(var i = 0; i < this.visibleModalElements.length; i++)
21109   this.visibleModalElements[i].DXModalPopupControl.AdjustModalElementBounds(this.visibleModalElements[i]);
21110 },
21111 ClearAppearTimer: function() {
21112  this.appearTimerID = ASPx.Timer.ClearTimer(this.appearTimerID);
21113 },
21114 ClearDisappearTimer: function() {
21115  this.disappearTimerID = ASPx.Timer.ClearTimer(this.disappearTimerID);
21116 },
21117 IsAppearTimerActive: function() {
21118  return this.appearTimerID > -1;
21119 },
21120 IsDisappearTimerActive: function() {
21121  return this.disappearTimerID > -1;
21122 },
21123 SetAppearTimer: function(name, index, popupElementIndex, timeout, evt) {
21124  var evtClone = ASPx.CloneObject(evt);
21125  this.appearTimerID = window.setTimeout(function() {
21126   aspxGetPopupControlCollection().DoShowAtCurrentPos(name, index, popupElementIndex, evtClone);
21127  }, timeout);
21128 },
21129 SetDisappearTimer: function(name, index, timeout) {
21130  this.disappearTimerID = window.setTimeout(function() {
21131   aspxGetPopupControlCollection().OnPWDisappearTimer(name, index);
21132  }, timeout);
21133 },
21134 GetDocScrollDifference: function() {
21135  return new _aspxScrollDifference(ASPx.GetDocumentScrollLeft() - this.docScrollLeft, ASPx.GetDocumentScrollTop() - this.docScrollTop);
21136 },
21137 IsDocScrolled: function(scroll) {
21138  return scroll.horizontal != 0 || scroll.vertical != 0;
21139 },
21140 SaveScrollState: function() {
21141  this.docScrollLeft = ASPx.GetDocumentScrollLeft();
21142  this.docScrollTop = ASPx.GetDocumentScrollTop();
21143 },
21144 InitDragObject: function(control, index, x, y, xClientCorrection, yClientCorrection) {
21145  this.draggingControl = control;
21146  this.draggingWindowIndex = index;
21147  this.gragXOffset = x;
21148  this.gragYOffset = y;
21149  this.xClientCorrection = xClientCorrection;
21150  this.yClientCorrection = yClientCorrection;
21151  this.SetDocumentSelectionBan(true);
21152 },
21153 InitOverObject: function(control, index, evt) {
21154  this.overControl = control;
21155  this.overWindowIndex = index;
21156  if(evt)
21157   this.SaveCurrentMouseOverPos(evt);
21158 },
21159 InitResizeObject: function(control, index, cursor, resizePanel) {
21160  this.resizeControl = control;
21161  this.resizeIndex = index;
21162  this.resizeCursor = cursor;
21163  this.resizePanel = resizePanel;
21164  this.SetDocumentSelectionBan(true);
21165 },
21166 SetDocumentSelectionBan: function(value) {
21167  if(this.selectBanned === value)
21168   return;
21169  this.selectBanned = value;
21170  if(ASPx.Browser.WebKitFamily) {
21171   if(value) {
21172    if(!this.webkitUserSelectBackup && document.body.style.webkitUserSelect)
21173     this.webkitUserSelectBackup = document.body.style.webkitUserSelect;
21174    document.body.style.webkitUserSelect = "none";
21175   } else {
21176    if(this.webkitUserSelectBackup) {
21177     document.body.style.webkitUserSelect = this.webkitUserSelectBackup;
21178     delete this.webkitUserSelectBackup;
21179    } else
21180     document.body.style.webkitUserSelect = "auto";
21181   }
21182  }
21183 },
21184 IsResizeInint: function() {
21185  return this.resizeControl != null;
21186 },
21187 ClearDragObject: function() {
21188  this.draggingControl = null;
21189  this.draggingWindowIndex = -1;
21190  this.gragXOffset = 0;
21191  this.gragYOffset = 0;
21192  this.SetDocumentSelectionBan(this.resizeControl != null);
21193 },
21194 ClearResizeObject: function() {
21195  this.resizeControl = null;
21196  this.resizeIndex = -2;
21197  this.resizeCursor = "";
21198  this.SetDocumentSelectionBan(this.draggingControl != null);
21199  this.resizePanel.parentNode.removeChild(this.resizePanel);
21200 },
21201 Drag: function(evt) {
21202  if(ASPx.tableColumnResizing || ASPx.currentDragHelper || !ASPx.Evt.IsLeftButtonPressed(evt)) return;
21203  var x = ASPx.Evt.GetEventX(evt);
21204  var y = ASPx.Evt.GetEventY(evt);
21205  if(this.pcWindowsAreRestrictedByDocumentWindow && ASPx.PopupUtils.CoordinatesInDocumentRect(x, y)) {
21206   x += this.gragXOffset;
21207   y += this.gragYOffset;
21208   this.draggingControl.OnDrag(this.draggingWindowIndex, x, y, this.xClientCorrection, this.yClientCorrection, evt);
21209   if(ASPx.Browser.WebKitTouchUI)
21210    evt.preventDefault();
21211  }
21212 },
21213 DragStop: function() {
21214  this.draggingControl.OnDragStop(this.draggingWindowIndex);
21215  this.ClearDragObject();
21216 },
21217 ResizeStop: function(evt) {
21218  this.resizeControl.OnResizeStop(evt, this.resizeIndex, this.resizeCursor, this.resizePanel);
21219  aspxGetPopupControlCollection().ClearResizeObject();
21220 },
21221 setIframesMouseMoveEnabled: function(enabled) {
21222  for(var i = 0; i < this.visiblePopupWindowIds.length; i++) {
21223   var popupWindow = this.GetPopupWindowFromID(this.visiblePopupWindowIds[i]);
21224   var popupControl = popupWindow.popupControl;
21225   if(popupControl) {
21226    var iframe = popupControl.GetWindowContentIFrameElement(popupWindow.windowIndex);
21227    if(iframe) {
21228     iframe.style.pointerEvents = enabled ? "" : "none";
21229     if(ASPx.Browser.IE && ASPx.Browser.MajorVersion < 11) {
21230      if(enabled)
21231       popupControl.RemoveIframeCoverDiv(iframe, popupWindow.windowIndex);
21232      else
21233       popupControl.CreateIframeCoverDiv(iframe, popupWindow.windowIndex);
21234     }
21235    }
21236   }
21237  }
21238 },
21239 OnPWMouseMove: function(evt, name, index) {
21240  if(this.draggingControl == null &&
21241   this.overControl == null &&
21242   this.resizeControl == null) {
21243   var pc = aspxGetPopupControlCollection().Get(name);
21244   if(pc != null) pc.OnMouseMove(evt, index);
21245  }
21246 },
21247 OnPWMouseOver: function(evt) {
21248  if(!this.overControl || this.draggingControl) return;
21249  if(this.IsOverPopupWindow(evt))
21250   this.ClearDisappearTimer();
21251 },
21252 IsOverPopupWindow: function(evt) {
21253  return ASPx.PopupUtils.FindEventSourceParentByTestFunc(evt, aspxTestPopupControlOverElement) != null;
21254 },
21255 OnDocumentKeyDown: function(evt) {
21256  var windowElement = this.GetTopWindow(false);
21257  if(windowElement) {
21258   var window = this.GetPopupWindowFromID(windowElement.id);
21259   if(window.popupControl);
21260    window.popupControl.OnDocumentKeyDown(evt, windowElement);
21261  }
21262 },
21263 OnDocumentMouseDown: function(evt) {
21264  var popupElement = ASPx.PopupUtils.FindEventSourceParentByTestFunc(evt, aspxTestPopupControlElement);
21265  var excptId = popupElement == null ? "" :
21266   popupElement.DXPopupElementControl.GetWindowElementId(popupElement.DXPopupWindowIndex);
21267  this.OnMouseDownCore(evt, excptId);
21268 },
21269 OnMouseDown: function(evt) {
21270  this.OnMouseDownCore(evt, "");
21271 },
21272 OnMouseDownCore: function(evt, excptId) {
21273  var srcElement = ASPx.Evt.GetEventSource(evt);
21274  this.DoHideAllWindows(srcElement, excptId, false, ASPxClientPopupControlCloseReason.OuterMouseClick, ASPx.Evt.GetEventX(evt));
21275  aspxGetPopupControlCollection().ClearAppearTimer();
21276 },
21277 OnMouseMove: function(evt) {
21278  if(ASPx.Browser.WebKitTouchUI && ASPx.TouchUIHelper.isGesture)
21279   return;
21280  if(this.draggingControl != null) {
21281   this.Drag(evt);
21282  }
21283  else if(this.overControl != null) {
21284   this.OnMouseOver(evt);
21285  }
21286  else if(this.resizeControl != null) {
21287   if(ASPx.Browser.IE && !ASPx.Evt.IsLeftButtonPressed(evt))
21288    this.ResizeStop(evt);
21289   else
21290    this.resizeControl.OnResize(evt, this.resizeIndex, this.resizeCursor, this.resizePanel);
21291  }
21292 },
21293 OnMouseOver: function(evt) {
21294  var element = ASPx.PopupUtils.FindEventSourceParentByTestFunc(evt, aspxTestPopupControlOverElement);
21295  var curPopupElement = this.overControl.GetWindowCurrentPopupElementByIndex(this.overWindowIndex);
21296  var popup = element != null ? element.DXPopupElementControl : null;
21297  var isPopupActionMouseOver = popup && popup.GetWindowPopupAction(this.overWindowIndex) == 'MouseOver';
21298  var isCurPopupElement = element !== null && element === curPopupElement;
21299  var isCurPopupWindow = element != null && element.id === this.overControl.GetWindowElementId(this.overWindowIndex);
21300  var isCurPopupElementOrCurPopupWindow = isCurPopupElement || isCurPopupWindow || isPopupActionMouseOver;
21301  if(isCurPopupElementOrCurPopupWindow) {
21302   var clearTimer = true;
21303   popup = element.DXPopupElementControl;
21304   if(popup && popup.GetLastShownPopupElementIndex(element.DXPopupWindowIndex) != element.DXPopupElementIndex)
21305    clearTimer = false;
21306   if(clearTimer)
21307    this.ClearDisappearTimer();
21308   this.SaveCurrentMouseOverPos(evt);
21309   return;
21310  }
21311  this.OnMouseOut();
21312 },
21313 OnMouseOut: function(evt) {
21314  if(!this.overControl || this.draggingControl) return;
21315  this.ClearAppearTimer();
21316  var windowCloseAction = this.overControl.GetWindowCloseAction(this.overWindowIndex);
21317  if(windowCloseAction == "MouseOut" && this.overControl.InternalIsWindowVisible(this.overWindowIndex)) {
21318   if(!this.IsDisappearTimerActive() && this.IsDisappearAllowedByMouseOut(evt))
21319    this.SetDisappearTimer(this.overControl.name, this.overWindowIndex, this.overControl.disappearAfter);
21320  }
21321  else
21322   this.OverStop();
21323 },
21324 IsDisappearAllowedByMouseOut: function(evt) {
21325  return ASPx.Browser.Firefox ? !this.IsOverPopupWindow(evt) : true;  
21326 },
21327 OnMouseUp: function(evt) {
21328  if(this.draggingControl != null)
21329   this.DragStop();
21330  if(this.resizeControl != null)
21331   this.ResizeStop(evt);
21332 },
21333 OnResize: function(evt) {
21334  this.AutoUpdateElementsPosition();
21335  this.AdjustModalElementsBounds();
21336 },
21337 OnScroll: function(evt) {
21338  if(this.scrollEventLockCount > 0)
21339   return;
21340  var scroll = this.GetDocScrollDifference();
21341  if(this.IsDocScrolled(scroll)) { 
21342   this.CorrectPositionAtScroll(scroll);
21343   this.AdjustModalElementsBounds();
21344   this.SaveScrollState();
21345  }
21346  this.CalculateDocumentDimensionsWithoutPinnedWindows(evt);
21347  this.FireScrollEventToWindows(evt);
21348 },
21349 GetSavedBodyWidth: function() {
21350  if(this.savedBodyWidth == 0)
21351   this.CalculateDocumentDimensionsWithoutPinnedWindows();
21352  return this.savedBodyWidth;
21353 },
21354 GetSavedBodyHeight: function() {
21355  if(this.savedBodyHeight == 0)
21356   this.CalculateDocumentDimensionsWithoutPinnedWindows();
21357  return this.savedBodyHeight;
21358 },
21359 HidePinnedPopupsThatOutFromViewPort: function() {
21360  var popupsToRestoreVisible = [];
21361  for(var i = 0; i < this.visiblePopupWindowIds.length; i++) {
21362   var popupWindow = this.GetPopupWindowFromID(this.visiblePopupWindowIds[i]);
21363   var popupControl = popupWindow.popupControl;
21364   if(!popupControl.needToHidePinnedOutFromViewPort(popupWindow.windowIndex))
21365    continue;
21366   var element = popupControl.GetWindowElement(popupWindow.windowIndex);
21367   if(!element) continue;
21368   var restoreData = {};
21369   restoreData.element = element;
21370   restoreData.display = element.style.display;
21371   element.style.display = "none";
21372   popupsToRestoreVisible.push(restoreData);
21373  }
21374  return popupsToRestoreVisible;
21375 },
21376 RestorePinnedPopupsThatOutFromViewPort: function(popupsToRestoreVisible) {
21377  if(popupsToRestoreVisible.length > 0) {
21378   for(var i = 0; i < popupsToRestoreVisible.length; i++) {
21379    var restoreData = popupsToRestoreVisible[i];
21380    restoreData.element.style.display = restoreData.display;
21381   }
21382  }
21383 },
21384 CalculateDocumentDimensionsWithoutPinnedWindows: function(evt) { 
21385  var popupsToRestoreVisible = [];
21386  var needToHideRestorePopupsThatOutFromViewPort = !!evt && ASPx.Evt.GetEventSource(evt) == document;
21387  if(needToHideRestorePopupsThatOutFromViewPort)
21388   popupsToRestoreVisible = this.HidePinnedPopupsThatOutFromViewPort();
21389  this.savedBodyWidth = ASPx.GetDocumentWidth();
21390  this.savedBodyHeight = ASPx.GetDocumentHeight();
21391  if(needToHideRestorePopupsThatOutFromViewPort)
21392   this.RestorePinnedPopupsThatOutFromViewPort(popupsToRestoreVisible);
21393 },
21394 FireScrollEventToWindows: function(evt) {
21395  for(var i = 0; i < this.visiblePopupWindowIds.length; i++) {
21396   var popupWindow = this.GetPopupWindowFromID(this.visiblePopupWindowIds[i]);
21397   var popupControl = popupWindow.popupControl;
21398   popupControl.OnScroll(evt, popupWindow.windowIndex);
21399  }
21400 },
21401 CalculateDocumentDimensionsWithoutPinnedWindowsOldIE: function(onCalculateFinished, evt) {  
21402  var popupsToRestoreVisible = [];
21403  var needToHideRestorePopupsThatOutFromViewPort = !!evt && ASPx.Evt.GetEventSource(evt) == document;
21404  if(needToHideRestorePopupsThatOutFromViewPort)
21405   popupsToRestoreVisible = this.HidePinnedPopupsThatOutFromViewPort();
21406  this.scrollEventLockCount++;
21407  window.setTimeout(function() {
21408   this.savedBodyWidth = ASPx.GetDocumentWidth();
21409   this.savedBodyHeight = ASPx.GetDocumentHeight();
21410   if(needToHideRestorePopupsThatOutFromViewPort)
21411    this.RestorePinnedPopupsThatOutFromViewPort(popupsToRestoreVisible);
21412   if(onCalculateFinished)
21413    window.setTimeout(function() { onCalculateFinished(); }.aspxBind(this), 0);
21414   this.scrollEventLockCount--;
21415  }.aspxBind(this), 0);
21416 },
21417 FireScrollEventToWindowsOldIE: function(evt) {
21418  this.scrollEventLockCount++;
21419  this.FireScrollEventToWindows(evt);
21420  this.scrollEventLockCount--;
21421 },
21422 LockScrollEvent: function() {
21423  this.scrollEventLockCount++;
21424 },
21425 UnlockScrollEvent: function() {
21426  this.scrollEventLockCount--;
21427 },
21428 CorrectPositionAtScroll: function(scroll) {
21429  for(var i = 0; i < this.visiblePopupWindowIds.length; i++) {
21430   var popupWindow = this.GetPopupWindowFromID(this.visiblePopupWindowIds[i]);
21431   var popupControl = popupWindow.popupControl;
21432   if(popupControl != null && popupControl.InternalIsWindowVisible(popupWindow.windowIndex)) {
21433    if(popupControl.GetAutoUpdatePosition(popupWindow.windowIndex))
21434     popupWindow.popupControl.TryAutoUpdatePosition(popupWindow.windowIndex);
21435   }
21436  }
21437 },
21438 OnSelectStart: function() {
21439  return !this.selectBanned;
21440 },
21441 OverStop: function() {
21442  this.overControl = null;
21443  this.overWindowIndex = -1;
21444 },
21445 OnPWDisappearTimer: function(name, index) {
21446  var pc = this.Get(name);
21447  if(pc != null) {
21448   if(!pc.DoHideWindow(index, false, ASPxClientPopupControlCloseReason.MouseOut))
21449    this.OverStop();
21450   this.ClearDisappearTimer();
21451  }
21452 },
21453 SaveCurrentMouseOverPos: function(evt) {
21454  this.overXPos = ASPx.Evt.GetEventX(evt);
21455  this.overYPos = ASPx.Evt.GetEventY(evt);
21456 },
21457 RegisterVisibleModalElement: function(element) {
21458  if(ASPx.Data.ArrayIndexOf(this.visibleModalElements, element) == -1)
21459   this.visibleModalElements.push(element);
21460 },
21461 UnregisterVisibleModalElement: function(element) {
21462  ASPx.Data.ArrayRemove(this.visibleModalElements, element);
21463 },
21464 RegisterVisibleWindow: function(element, popupControl, index) {
21465  if(ASPx.Data.ArrayIndexOf(this.visiblePopupWindowIds, element.id) == -1) {
21466   this.visiblePopupWindowIds.push(element.id);
21467   if(popupControl && popupControl.GetWindowCloseAction(index) == "MouseOut")
21468    aspxGetPopupControlCollection().InitOverObject(popupControl, index, null);
21469   this.OnRegisteredVisibleWindow(element);
21470  }
21471 },
21472 OnRegisteredVisibleWindow: function(element) {
21473  var elementIndex = ASPx.Data.ArrayIndexOf(this.visiblePopupWindowIds, element.id);
21474  if(this.PopupWindowIsModalByVisibleIndex(elementIndex))
21475   ASPx.PopupUtils.RemoveFocus(element);
21476 },
21477 UnregisterVisibleWindow: function(element) {
21478  this.DeleteWindowFromZIndexOrder(element);
21479  ASPx.Data.ArrayRemove(this.visiblePopupWindowIds, element.id);
21480  var forceRecalculate = this.PopupWindowIsModalByID(element.id);
21481  this.RefreshTabIndexes(forceRecalculate);
21482  this.SkipCurrentActiveWindowElement(element);
21483 },
21484 AutoUpdateElementsPosition: function() {
21485  for(var i = 0; i < this.visiblePopupWindowIds.length; i++) {
21486   var popupWindow = this.GetPopupWindowFromID(this.visiblePopupWindowIds[i]);
21487   var popupControl = popupWindow.popupControl;
21488   if(popupControl != null && popupControl.InternalIsWindowVisible(popupWindow.windowIndex))
21489    popupControl.TryAutoUpdatePosition(popupWindow.windowIndex);
21490  }
21491 },
21492 LockWindowResizeByBodyScrollVisibilityChanging: function() {
21493  this.windowResizeByBodyScrollVisibilityChangingLockCount++;
21494 },
21495 UnlockWindowResizeByBodyScrollVisibilityChanging: function() {
21496  this.windowResizeByBodyScrollVisibilityChangingLockCount--;
21497 },
21498 WindowResizeByBodyScrollVisibilityChangingLocked: function() {
21499  return this.windowResizeByBodyScrollVisibilityChangingLockCount > 0;
21500 },
21501 HideAllWindows: function() {
21502  this.DoHideAllWindows(null, "", true, ASPxClientPopupControlCloseReason.API, 0);
21503 }
21504});
21505var ASPxClientPopupControlResizeState = {
21506 Resized: 0,
21507 Collapsed: 1,
21508 Expanded: 2,
21509 Maximized: 3,
21510 RestoredAfterMaximized: 4
21511};
21512var ASPxClientPopupControlCloseReason = {
21513 API: "API",
21514 CloseButton: "CloseButton",
21515 OuterMouseClick: "OuterMouseClick",
21516 MouseOut: "MouseOut",
21517 Escape: "Escape"
21518};
21519var popupControlCollection = null;
21520function aspxGetPopupControlCollection() {
21521 if(popupControlCollection == null)
21522  popupControlCollection = new ASPxClientPopupControlCollection();
21523 return popupControlCollection;
21524}
21525function _aspxScrollDifference(horizontal, vertical) {
21526 this.horizontal = horizontal;
21527 this.vertical = vertical;
21528}
21529function aspxPWEMOver(evt) {
21530 aspxGetPopupControlCollection().OnPWMouseOver(evt);
21531}
21532ASPx.PWHMDown = function(evt) {
21533 return ASPx.Evt.CancelBubble(evt);
21534};
21535ASPx.PWCBClick = function(evt, name, index) {
21536 var pc = aspxGetPopupControlCollection().Get(name);
21537 if(pc != null) pc.OnPWHBClickCore(evt, index, "OnCloseButtonClick");
21538};
21539ASPx.PWPBClick = function(evt, name, index) {
21540 var pc = aspxGetPopupControlCollection().Get(name);
21541 if(pc != null) pc.OnPWHBClickCore(evt, index, "OnPinButtonClick");
21542};
21543ASPx.PWRBClick = function(evt, name, index) {
21544 var pc = aspxGetPopupControlCollection().Get(name);
21545 if(pc != null) pc.OnPWHBClickCore(evt, index, "OnRefreshButtonClick");
21546};
21547ASPx.PWMNBClick = function(evt, name, index) {
21548 var pc = aspxGetPopupControlCollection().Get(name);
21549 if(pc != null) pc.OnPWHBClickCore(evt, index, "OnCollapseButtonClick");
21550};
21551ASPx.PWMXBClick = function(evt, name, index) {
21552 var pc = aspxGetPopupControlCollection().Get(name);
21553 if(pc != null) pc.OnPWHBClickCore(evt, index, "OnMaximizeButtonClick");
21554};
21555ASPx.PWDGMDown = function (evt, name, index) {
21556 var pc = aspxGetPopupControlCollection().Get(name);
21557 return ASPx.PWMDown(evt, name, index, pc.IsDraggingAllowed(index));
21558};
21559ASPx.PWGripMDown = function(evt, name, index) {
21560 aspxPWMDownCore(evt, name, index, false);
21561 return ASPx.PWHMDown(evt);
21562};
21563ASPx.PWMMove = function(evt, name, index) {
21564 aspxGetPopupControlCollection().OnPWMouseMove(evt, name, index);
21565};
21566ASPx.PWMDown = function(evt, name, index, isWindowContentDraggingAllowed) { 
21567 var pointOnScrollBar = false;
21568 var pc = aspxGetPopupControlCollection().Get(name);
21569 if(pc && pc.GetEnableContentScrolling(index)) {
21570  var rtl = pc.rtl && (ASPx.Browser.IE || ASPx.Browser.Firefox || ASPx.Browser.Opera);
21571  pointOnScrollBar = aspxPointOnElementScrollBar(pc.GetContentContainer(index), evt.clientX, evt.clientY, rtl);
21572 }
21573 aspxPWMDownCore(evt, name, index, isWindowContentDraggingAllowed, pointOnScrollBar);
21574 if(isWindowContentDraggingAllowed) { 
21575  aspxGetPopupControlCollection().OnDocumentMouseDown(evt); 
21576  if(typeof (ASPx.GetDropDownCollection) == "function")
21577   ASPx.GetDropDownCollection().OnDocumentMouseDown(evt); 
21578  if(!pointOnScrollBar) {
21579   if(!ASPx.Browser.WebKitTouchUI && ASPx.Evt.GetEventSource(evt).tagName == "IMG") 
21580    ASPx.Evt.PreventEvent(evt);
21581  }
21582 }
21583};
21584function aspxPWMDownCore(evt, name, index, isDraggingAllowed, pointOnScrollBar) {
21585 var pc = aspxGetPopupControlCollection().Get(name);
21586 if(pc != null) {
21587  pc.OnActivate(index, evt);
21588  pc.OnMouseDown(evt, index, isDraggingAllowed, pointOnScrollBar);
21589 }
21590}
21591function aspxPWMEMDown(evt) {
21592 var internalScrollableModalDiv = ASPx.Browser.AndroidDefaultBrowser ? ASPx.Evt.GetEventSource(evt) : null;
21593 var modalDiv = internalScrollableModalDiv ? internalScrollableModalDiv.parentNode : ASPx.Evt.GetEventSource(evt);
21594 if(modalDiv != null) 
21595  modalDiv.DXModalPopupControl.OnMouseDownModalElement(evt, modalDiv.DXModalPopupWindowIndex);
21596}
21597function aspxPEMEvent(evt) {
21598 var element = ASPx.PopupUtils.FindEventSourceParentByTestFunc(evt, aspxTestPopupControlElement);
21599 if(element != null) {
21600  var popupControl = element.DXPopupElementControl;
21601  var index = element.DXPopupWindowIndex;
21602  if(evt.type == "mousedown") {
21603   popupControl.SetIsPopuped(index, popupControl.InternalIsWindowVisible(index));
21604   aspxGetPopupControlCollection().OnMouseDown(evt);
21605  }
21606  else {
21607   var windowPopupAction = popupControl.GetWindowPopupAction(element.DXPopupWindowIndex);
21608   var leftMouseButtonAction = windowPopupAction == "LeftMouseClick" && ASPx.Evt.IsLeftButtonPressed(evt);
21609   var isAccessibleKeyboardAction = popupControl.accessibilityCompliant && ASPx.Evt.IsActionKeyPressed(evt);
21610   var rightMouseButtonAction = windowPopupAction == "RightMouseClick" && !ASPx.Evt.IsLeftButtonPressed(evt);
21611   if(leftMouseButtonAction || rightMouseButtonAction || isAccessibleKeyboardAction) {
21612    if(rightMouseButtonAction)
21613     ASPx.PopupUtils.PreventContextMenu(evt);
21614    var windowCloseAction = popupControl.GetWindowCloseAction(index);
21615    var isPopuped = popupControl.GetIsPopuped(index);
21616    var isNewPopupElement = popupControl.GetLastShownPopupElementIndex(index) != element.DXPopupElementIndex;
21617    if(isPopuped && isNewPopupElement) {
21618     popupControl.DoHideWindow(index, false, ASPxClientPopupControlCloseReason.OuterMouseClick);
21619     aspxGetPopupControlCollection().ClearDisappearTimer();
21620     isPopuped = false;
21621    }
21622    if(!(isPopuped && windowCloseAction == "OuterMouseClick")) {
21623     popupControl.DoShowWindow(index, element.DXPopupElementIndex, evt);
21624    }
21625    if(windowCloseAction == "MouseOut")
21626     aspxGetPopupControlCollection().InitOverObject(popupControl, element.DXPopupWindowIndex, evt);
21627    return false;
21628   }
21629  }
21630 }
21631}
21632ASPx.PopupElementMouseEvent = aspxPEMEvent;
21633function aspxPointOnElementScrollBar(element, x, y, rtl) {
21634 var scrollWidth = ASPx.GetVerticalScrollBarWidth();
21635 var hasHorizontalScroll = element.scrollWidth > element.clientWidth;
21636 var hasVerticalScroll = element.scrollHeight > element.clientHeight;
21637 var ceilX = rtl ? ASPx.GetAbsoluteX(element) + scrollWidth :
21638  ASPx.GetAbsoluteX(element) + (element.offsetWidth - ASPx.GetHorizontalBordersWidth(element));
21639 var ceilY = ASPx.GetAbsoluteY(element) + (element.offsetHeight - ASPx.GetVerticalBordersWidth(element));
21640 return (hasVerticalScroll && x >= ceilX - scrollWidth && x <= ceilX) ||
21641   (hasHorizontalScroll && y >= ceilY - scrollWidth && y <= ceilY);
21642}
21643ASPx.PCAStop = function(name, index) {
21644 var pc = aspxGetPopupControlCollection().Get(name);
21645 if(pc != null) pc.OnAnimationStop(index);
21646};
21647ASPx.PCIframeLoad = function(evt) {
21648 var srcElement = ASPx.Evt.GetEventSource(evt);
21649 if(srcElement) {
21650  var pcName = srcElement.popupControlName;
21651  var pcWndIndex = srcElement.pcWndIndex;
21652  if(pcName) {
21653   var pc = aspxGetPopupControlCollection().Get(pcName);
21654   if(pc) pc.OnIFrameLoad(pcWndIndex);
21655  }
21656 }
21657};
21658function aspxTestPopupWindowElement(element) {
21659 return !!element.DXPopupWindowElement;
21660}
21661function aspxTestPopupControlElement(element) {
21662 return element.DXPopupElementControl && ASPx.IsExists(element.DXPopupWindowIndex);
21663}
21664function aspxTestPopupControlOverElement(element) {
21665 var collection = aspxGetPopupControlCollection();
21666 var popupControl = collection.overControl;
21667 var index = collection.overWindowIndex;
21668 var windowId = popupControl.GetWindowElementId(index);
21669 if(element.id == windowId)
21670  return true;
21671 var popupElements = popupControl.GetPopupElementList(index);
21672 for(var i = 0; i < popupElements.length; i++)
21673  if(popupElements[i] == element)
21674   return true;
21675 return false;
21676}
21677ASPx.Evt.AttachEventToDocument("keydown", function(evt) {
21678 aspxGetPopupControlCollection().OnDocumentKeyDown(evt);
21679});
21680ASPx.Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseDownEventName, function(evt) {
21681 aspxGetPopupControlCollection().OnDocumentMouseDown(evt);
21682});
21683ASPx.Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseUpEventName, function(evt) {
21684 return aspxGetPopupControlCollection().OnMouseUp(evt);
21685});
21686window.addEventListener(ASPx.TouchUIHelper.touchMouseMoveEventName, function(evt) {
21687 if(typeof(aspxGetPopupControlCollection) != "undefined")
21688  aspxGetPopupControlCollection().OnMouseMove(evt);
21689}, { capture: true, passive: !ASPx.Browser.WebKitTouchUI });
21690ASPx.Evt.AttachEventToDocument("mouseout", function(evt) {
21691 if(typeof (aspxGetPopupControlCollection) != "undefined")
21692  aspxGetPopupControlCollection().OnMouseOut(evt);
21693});
21694ASPx.Evt.AttachEventToElement(window, ASPx.Browser.MacOSMobilePlatform ? "orientationchange" : "resize", function(evt) {
21695 aspxGetPopupControlCollection().OnResize(evt);
21696});
21697ASPx.Evt.AttachEventToElement(window, "scroll", function(evt) {
21698 aspxGetPopupControlCollection().OnScroll(evt);
21699});
21700ASPx.Evt.AttachEventToDocument("selectstart", function(evt) {
21701 var ret = aspxGetPopupControlCollection().OnSelectStart(evt);
21702 if(!ret) return false; 
21703});
21704var currViewPortSize = getViewPortSize();
21705var viewPortSizeInterval = null;
21706function getViewPortSize() {
21707 return { 
21708  w: window.innerWidth, 
21709  h: window.innerHeight,
21710  x: window.pageXOffset,
21711  y: window.pageYOffset
21712 }; 
21713}
21714function ensureViewPortSizeInterval() {
21715 if(!!viewPortSizeInterval) return;
21716 viewPortSizeInterval = setInterval(function() {
21717  var size = getViewPortSize();
21718  if(size.w != currViewPortSize.w || size.h != currViewPortSize.h || size.x != currViewPortSize.x || size.y != currViewPortSize.y) {
21719   currViewPortSize = size;
21720   var controlCollection = aspxGetPopupControlCollection();
21721   controlCollection.ForEachControl(function(popupControl) {
21722    if(popupControl.GetCanScrollViewPort(-1) && popupControl.IsVisible()) {
21723     popupControl.updateContentScrollIfNeeded(-1);
21724     popupControl.UpdatePosition();
21725    }
21726   });
21727  }
21728 }, 50);
21729}
21730window.ASPxClientPopupControlBase = ASPxClientPopupControlBase;
21731window.ASPxClientPopupControl = ASPxClientPopupControl;
21732window.ASPxClientPopupWindow = ASPxClientPopupWindow;
21733window.ASPxClientPopupWindowEventArgs = ASPxClientPopupWindowEventArgs;
21734window.ASPxClientPopupWindowCancelEventArgs = ASPxClientPopupWindowCancelEventArgs;
21735window.ASPxClientPopupWindowResizeEventArgs = ASPxClientPopupWindowResizeEventArgs;
21736window.ASPxClientPopupWindowPinnedChangedEventArgs = ASPxClientPopupWindowPinnedChangedEventArgs;
21737window.ASPxClientPopupControlCollection = ASPxClientPopupControlCollection;
21738window.ASPxClientPopupControlResizeState = ASPxClientPopupControlResizeState;
21739window.ASPxClientPopupControlCloseReason = ASPxClientPopupControlCloseReason;
21740ASPx.GetPopupControlCollection = aspxGetPopupControlCollection;
21741ASPx.PopupControlCssClasses = PopupControlCssClasses;
21742})();
21743
21744(function() {
21745var ASPxClientEditBase = ASPx.CreateClass(ASPxClientControl, {
21746 constructor: function(name) {
21747  this.constructor.prototype.constructor.call(this, name);
21748  this.EnabledChanged = new ASPxClientEvent();
21749  this.captionPosition = ASPx.Position.Left;
21750  this.showCaptionColon = true;
21751 },
21752 InlineInitialize: function(){
21753  ASPxClientControl.prototype.InlineInitialize.call(this);
21754  this.InitializeEnabled(); 
21755 },
21756 InitializeEnabled: function() {
21757  this.SetEnabledInternal(this.clientEnabled, true);
21758 },
21759 GetValue: function() {
21760  var element = this.GetMainElement();
21761  if(ASPx.IsExistsElement(element))
21762   return element.innerHTML;
21763  return "";
21764 },
21765 GetValueString: function(){
21766  var value = this.GetValue();
21767  return (value == null) ? null : value.toString();
21768 },
21769 SetValue: function(value) {
21770  if(value == null)
21771   value = "";
21772  var element = this.GetMainElement();
21773  if(ASPx.IsExistsElement(element))
21774   element.innerHTML = value;
21775 },
21776 GetEnabled: function(){
21777  return this.enabled && this.clientEnabled;
21778 },
21779 SetEnabled: function(enabled){
21780  if(this.clientEnabled != enabled) {
21781   var errorFrameRequiresUpdate = this.GetIsValid && !this.GetIsValid();
21782   if(errorFrameRequiresUpdate && !enabled)
21783    this.UpdateErrorFrameAndFocus(false , null , true );
21784   this.clientEnabled = enabled;
21785   this.SetEnabledInternal(enabled, false);
21786   if(errorFrameRequiresUpdate && enabled)
21787    this.UpdateErrorFrameAndFocus(false );
21788   this.RaiseEnabledChangedEvent();
21789  }
21790 },
21791 SetEnabledInternal: function(enabled, initialization){
21792  if(!this.enabled) return;
21793  if(!initialization || !enabled)
21794   this.ChangeEnabledStateItems(enabled);
21795  this.ChangeEnabledAttributes(enabled);
21796  if(ASPx.Browser.Chrome) {   
21797   var mainElement = this.GetMainElement();
21798   if(mainElement)
21799    mainElement.className = mainElement.className;
21800  } 
21801 },
21802 ChangeEnabledAttributes: function(enabled){
21803 },
21804 ChangeEnabledStateItems: function(enabled){
21805 },
21806 RaiseEnabledChangedEvent: function(){
21807  if(!this.EnabledChanged.IsEmpty()){
21808   var args = new ASPxClientEventArgs();
21809   this.EnabledChanged.FireEvent(this, args);
21810  }
21811 },
21812 GetDecodeValue: function (value) { 
21813  if(typeof (value) == "string" && value.length > 1)
21814   value = this.SimpleDecodeHtml(value);
21815  return value;
21816 },
21817 SimpleDecodeHtml: function (html) {
21818  return ASPx.Str.ApplyReplacement(html, [
21819   [/&lt;/g, '<'],
21820   [/&amp;/g, '&'],
21821   [/&quot;/g, '"'],
21822   [/&#39;/g, '\''],
21823   [/&#32;/g, ' ']
21824  ]);
21825 },
21826 GetCachedElementById: function(idSuffix) {
21827  return ASPx.CacheHelper.GetCachedElementById(this, this.name + idSuffix);
21828 },
21829 GetCaptionCell: function() {
21830  return this.GetCachedElementById(EditElementSuffix.CaptionCell);
21831 },
21832 GetExternalTable: function() {
21833  return this.GetCachedElementById(EditElementSuffix.ExternalTable);
21834 },
21835 getCaptionRelatedCellCount: function() {
21836  if(!this.captionRelatedCellCount)
21837   this.captionRelatedCellCount = ASPx.GetNodesByClassName(this.GetExternalTable(), CaptionRelatedCellClassName).length;
21838  return this.captionRelatedCellCount;
21839 },
21840 addCssClassToCaptionRelatedCells: function() {
21841  if(this.captionPosition == ASPx.Position.Left || this.captionPosition == ASPx.Position.Right) {
21842   var captionRelatedCellsIndex = this.captionPosition == ASPx.Position.Left ? 0 : this.GetCaptionCell().cellIndex;
21843   for(var i = 0; i < this.GetExternalTable().rows.length; i++)
21844    ASPx.AddClassNameToElement(this.GetExternalTable().rows[i].cells[captionRelatedCellsIndex], CaptionRelatedCellClassName);
21845  }
21846  if(this.captionPosition == ASPx.Position.Top || this.captionPosition == ASPx.Position.Bottom)
21847   for(var i = 0; i < this.GetCaptionCell().parentNode.cells.length; i++)
21848    ASPx.AddClassNameToElement(this.GetCaptionCell().parentNode.cells[i], CaptionRelatedCellClassName);
21849 },
21850 GetCaption: function() {
21851  if(ASPx.IsExists(this.GetCaptionCell()))
21852   return this.getCaptionInternal();
21853  return "";
21854 },
21855 SetCaption: function(caption) {
21856  if(!ASPx.IsExists(this.GetCaptionCell()))
21857   return;
21858  if(this.getCaptionRelatedCellCount() == 0)
21859   this.addCssClassToCaptionRelatedCells();
21860  if(caption !== "")
21861   ASPx.RemoveClassNameFromElement(this.GetExternalTable(), ASPxEditExternalTableClassNames.TableWithEmptyCaptionClassName);
21862  else
21863   ASPx.AddClassNameToElement(this.GetExternalTable(), ASPxEditExternalTableClassNames.TableWithEmptyCaptionClassName);
21864  this.setCaptionInternal(caption);
21865 },
21866 getCaptionTextNode: function() {
21867  var captionElement = ASPx.GetNodesByPartialClassName(this.GetCaptionCell(), CaptionElementPartialClassName)[0];
21868  return ASPx.GetNormalizedTextNode(captionElement);
21869 },
21870 getCaptionInternal: function() {
21871  var captionText = this.getCaptionTextNode().nodeValue;
21872  if(captionText !== "" && captionText[captionText.length - 1] == ":")
21873   captionText = captionText.substring(0, captionText.length - 1);
21874  return captionText;
21875 },
21876 setCaptionInternal: function(caption) {
21877  caption = ASPx.Str.Trim(caption);
21878  var captionTextNode = this.getCaptionTextNode();
21879  if(this.showCaptionColon && caption[caption.length - 1] != ":" && caption !== "")
21880   caption += ":";
21881  captionTextNode.nodeValue = caption;
21882 },
21883 onVirtualKeyboardUITouchStart: function(evt) { }
21884});
21885var ValidationPattern = ASPx.CreateClass(null, {
21886 constructor: function(errorText) {
21887  this.errorText = errorText;
21888 }
21889});
21890var RequiredFieldValidationPattern = ASPx.CreateClass(ValidationPattern, {
21891 constructor: function(errorText) {
21892  this.constructor.prototype.constructor.call(this, errorText);
21893 },
21894 EvaluateIsValid: function(value) {
21895  return value != null && (value.constructor == Array || ASPx.Str.Trim(value.toString()) != "");
21896 }
21897});
21898var RegularExpressionValidationPattern = ASPx.CreateClass(ValidationPattern, {
21899 constructor: function(errorText, pattern) {
21900  this.constructor.prototype.constructor.call(this, errorText);
21901  this.pattern = pattern;
21902 },
21903 EvaluateIsValid: function(value) {
21904  if(value == null) 
21905   return true;
21906  var strValue = value.toString();
21907  if(ASPx.Str.Trim(strValue).length == 0)
21908   return true;
21909  var regEx = new RegExp(this.pattern);
21910  var matches = regEx.exec(strValue);
21911  return matches != null && strValue == matches[0];
21912 }
21913});
21914function _aspxIsEditorFocusable(inputElement) {
21915 return ASPx.IsFocusableCore(inputElement, function(container) {
21916  return container.getAttribute("errorFrame") == "errorFrame";
21917 });
21918}
21919var invalidEditorToBeFocused = null;
21920var ValidationType = {
21921 PersonalOnValueChanged: "ValueChanged",
21922 PersonalViaScript: "CalledViaScript",
21923 MassValidation: "MassValidation"
21924};
21925var ErrorFrameDisplay = {
21926 None: "None",
21927 Static: "Static",
21928 Dynamic: "Dynamic"
21929};
21930var EditElementSuffix = {
21931 ExternalTable: "_ET",
21932 ControlCell: "_CC",
21933 ErrorCell: "_EC",
21934 ErrorTextCell: "_ETC",
21935 ErrorImage: "_EI",
21936 CaptionCell: "_CapC",
21937 AccessibilityAdditionalTextRow: "_AHTR"
21938};
21939var ASPxEditExternalTableClassNames = {
21940 ValidStaticTableClassName: "dxeValidStEditorTable",
21941 ValidDynamicTableClassName: "dxeValidDynEditorTable",
21942 TableWithSeparateBordersClassName: "tableWithSeparateBorders",
21943 TableWithEmptyCaptionClassName: "tableWithEmptyCaption"
21944};
21945var CaptionRelatedCellClassName = "dxeCaptionRelatedCell";
21946var CaptionElementPartialClassName = "dxeCaption";
21947var AccessibilityAssistantID = "AcAs";
21948var ASPxClientEdit = ASPx.CreateClass(ASPxClientEditBase, {
21949 constructor: function(name) {
21950  this.constructor.prototype.constructor.call(this, name);
21951  this.isASPxClientEdit = true;
21952  this.inputElement = null;
21953  this.convertEmptyStringToNull = true;
21954  this.readOnly = false;
21955  this.focused = false;
21956  this.focusEventsLocked = false;
21957  this.receiveGlobalMouseWheel = true;
21958  this.styleDecoration = null;
21959  this.heightCorrectionRequired = false;
21960  this.customValidationEnabled = false;
21961  this.display = ErrorFrameDisplay.Static;
21962  this.initialErrorText = "";
21963  this.causesValidation = false;
21964  this.validateOnLeave = true;
21965  this.validationGroup = "";
21966  this.sendPostBackWithValidation = null;
21967  this.validationPatterns = [];
21968  this.setFocusOnError = false;
21969  this.errorDisplayMode = "it";
21970  this.errorText = "";
21971  this.isValid = true;
21972  this.errorImageIsAssigned = false;
21973  this.notifyValidationSummariesToAcceptNewError = false;
21974  this.isErrorFrameRequired = false;
21975  this.enterProcessed = false;
21976  this.keyDownHandlers = {};
21977  this.keyPressHandlers = {};
21978  this.keyUpHandlers = {};
21979  this.specialKeyboardHandlingUsed = false;
21980  this.onKeyDownHandler = null;
21981  this.onKeyPressHandler = null;
21982  this.onKeyUpHandler = null;
21983  this.onGotFocusHandler = null;
21984  this.onLostFocusHandler = null;
21985  this.GotFocus = new ASPxClientEvent();
21986  this.LostFocus = new ASPxClientEvent();
21987  this.Validation = new ASPxClientEvent();
21988  this.ValueChanged = new ASPxClientEvent();
21989  this.KeyDown = new ASPxClientEvent();
21990  this.KeyPress = new ASPxClientEvent();
21991  this.KeyUp = new ASPxClientEvent();
21992  this.eventHandlersInitialized = false;
21993  this.ariaExplanatoryTextManager = null;
21994 },
21995 SetData: function(data){
21996  if(data.decorationStyles){
21997   for(var i = 0; i < data.decorationStyles.length; i++)
21998    this.AddDecorationStyle(data.decorationStyles[i].key, 
21999     data.decorationStyles[i].className, 
22000     data.decorationStyles[i].cssText);
22001  }
22002 },
22003 Initialize: function() {
22004  this.initialErrorText = this.errorText;
22005  ASPxClientEditBase.prototype.Initialize.call(this);
22006  this.InitializeKeyHandlers();
22007  this.UpdateClientValidationState();
22008  this.UpdateValidationSummaries(null , true );
22009 },
22010 InlineInitialize: function() {
22011  ASPxClientEditBase.prototype.InlineInitialize.call(this);
22012  if(!this.eventHandlersInitialized)
22013   this.InitializeEvents();
22014  this.UpdateStyleDecorations();
22015  var externalTable = this.GetExternalTable();
22016  if(externalTable && ASPx.IsPercentageSize(externalTable.style.width)) {
22017   this.width = "100%";
22018   this.GetMainElement().style.width = "100%";
22019   if(this.isErrorFrameRequired)
22020    externalTable.setAttribute("errorFrame", "errorFrame");
22021  }
22022  this.ariaExplanatoryTextManager = this.CreateAriaExplanatoryTextManager();
22023 }, 
22024 AfterInitialize: function() {
22025  this.ariaExplanatoryTextManager.SetCaptionAssociating();
22026  this.ariaExplanatoryTextManager.UpdateText();
22027  this.ariaExplanatoryTextManager.UpdateValidationState();
22028  ASPxClientEditBase.prototype.AfterInitialize.call(this);
22029 },
22030 InitializeEvents: function() {
22031 },
22032 UpdateStyleDecorations: function() {
22033  if(this.styleDecoration)
22034   this.styleDecoration.Update();
22035 },
22036 InitSpecialKeyboardHandling: function(){
22037  var name = this.name;
22038  this.onKeyDownHandler = function(evt) { ASPx.KBSIKeyDown(name,evt); };
22039  this.onKeyPressHandler = function(evt) { ASPx.KBSIKeyPress(name, evt); };
22040  this.onKeyUpHandler = function(evt) { ASPx.KBSIKeyUp(name, evt); };
22041  this.onGotFocusHandler = function(evt) { ASPx.ESGotFocus(name); };
22042  this.onLostFocusHandler = function(evt) { ASPx.ESLostFocus(name); };
22043  this.specialKeyboardHandlingUsed = true;
22044  this.InitializeDelayedSpecialFocus();
22045 },
22046 InitializeKeyHandlers: function() {
22047 },
22048 AddKeyDownHandler: function(key, handler) {
22049  this.keyDownHandlers[key] = handler;
22050 },
22051 AddKeyPressHandler: function(key, handler) {
22052  this.keyPressHandlers[key] = handler;
22053 },
22054 ChangeSpecialInputEnabledAttributes: function(element, method, doNotChangeAutoComplete){
22055  if(!doNotChangeAutoComplete) 
22056   element.autocomplete = "off";
22057  if(this.onKeyDownHandler != null)
22058   method(element, "keydown", this.onKeyDownHandler);
22059  if(this.onKeyPressHandler != null)
22060   method(element, "keypress", this.onKeyPressHandler);
22061  if(this.onKeyUpHandler != null)
22062   method(element, "keyup", this.onKeyUpHandler);
22063  if(this.onGotFocusHandler != null)
22064   method(element, "focus", this.onGotFocusHandler);
22065  if(this.onLostFocusHandler != null)
22066   method(element, "blur", this.onLostFocusHandler);
22067 },
22068 CreateAriaExplanatoryTextManager: function() {
22069  if(this.accessibilityCompliant)
22070   return new EditAccessibilityExplanatoryTextManager(this);
22071  else 
22072   return new DisableAccessibilityExplanatoryTextManager(this);
22073 },
22074 UpdateClientValidationState: function() {
22075  if(!this.customValidationEnabled)
22076   return;
22077  var mainElement = this.GetMainElement();
22078  if(mainElement) {
22079   var validationState = !this.GetIsValid() ? ("-" + this.GetErrorText()) : "";
22080   this.UpdateStateObjectWithObject({ validationState: validationState });
22081  }
22082 },
22083 UpdateValidationSummaries: function(validationType, initializing) {
22084  if(ASPx.Ident.scripts.ASPxClientValidationSummary) {
22085   var summaryCollection = ASPx.GetClientValidationSummaryCollection();
22086   summaryCollection.OnEditorIsValidStateChanged(this, validationType, initializing && this.notifyValidationSummariesToAcceptNewError);
22087  }
22088 },
22089 FindInputElement: function(){
22090  return null;
22091 },
22092 GetInputElement: function(){
22093  if(!ASPx.IsExistsElement(this.inputElement))
22094   this.inputElement = this.FindInputElement();
22095  return this.inputElement;
22096 },
22097 GetFocusableInputElement: function() {
22098  return this.GetInputElement();
22099 },
22100 GetAccessibilityActiveElements: function() {
22101  return [this.GetInputElement()];
22102 },
22103 GetAccessibilityFirstActiveElement: function() {
22104  return this.accessibilityHelper ? 
22105    this.accessibilityHelper.getMainElement() : 
22106    this.GetAccessibilityActiveElements()[0];
22107 },
22108 GetAccessibilityAssistantElement: function() {
22109  return this.GetChildElement(AccessibilityAssistantID);
22110 },
22111 GetErrorImage: function() {
22112  return this.GetCachedElementById(EditElementSuffix.ErrorImage);
22113 },
22114 GetControlCell: function() {
22115  return this.GetCachedElementById(EditElementSuffix.ControlCell);
22116 },
22117 GetErrorCell: function() {
22118  return this.GetCachedElementById(EditElementSuffix.ErrorCell);
22119 },
22120 GetErrorTextCell: function() {
22121  return this.GetCachedElementById(this.errorImageIsAssigned ? EditElementSuffix.ErrorTextCell : EditElementSuffix.ErrorCell);
22122 },
22123 SetVisible: function (isVisible) {
22124  if(this.clientVisible == isVisible)
22125   return;
22126  var externalTable = this.GetExternalTable();
22127  if(externalTable) {
22128   ASPx.SetElementDisplay(externalTable, isVisible);
22129   if(this.customValidationEnabled) {
22130    var isValid = !isVisible ? true : void (0);
22131    this.UpdateErrorFrameAndFocus(false , true , isValid );
22132   }
22133  }
22134  ASPxClientControl.prototype.SetVisible.call(this, isVisible);
22135 },
22136 GetStateHiddenFieldName: function() {
22137  return this.uniqueID + "$State";
22138 },
22139 GetValueInputToValidate: function() {
22140  return this.GetInputElement();
22141 },
22142 IsVisible: function() {
22143  if(!this.clientVisible)
22144   return false;
22145  var element = this.GetMainElement();
22146  if(!element) 
22147   return false;
22148  while(element && element.tagName != "BODY") {
22149   if(element.getAttribute("errorFrame") != "errorFrame" && (!ASPx.GetElementVisibility(element) || !ASPx.GetElementDisplay(element)))
22150    return false;
22151   element = element.parentNode;
22152  }
22153  return true;
22154 },
22155 AdjustControlCore: function() {
22156  this.CollapseEditor();
22157  this.UnstretchInputElement();
22158  if(this.heightCorrectionRequired)
22159   this.CorrectEditorHeight();
22160 },
22161 CorrectEditorHeight: function() {
22162 },
22163 UnstretchInputElement: function() {
22164 },
22165 UseDelayedSpecialFocus: function() {
22166  return false;
22167 },
22168 GetDelayedSpecialFocusTriggers: function() {
22169  return [ this.GetMainElement() ];
22170 },
22171 InitializeDelayedSpecialFocus: function() {
22172  if(!this.UseDelayedSpecialFocus())
22173   return;
22174  this.specialFocusTimer = -1;    
22175  var handler = function(evt) { this.OnDelayedSpecialFocusMouseDown(evt); }.aspxBind(this);
22176  var triggers = this.GetDelayedSpecialFocusTriggers();
22177  for(var i = 0; i < triggers.length; i++)
22178   ASPx.Evt.AttachEventToElement(triggers[i], "mousedown", handler);
22179 },
22180 OnDelayedSpecialFocusMouseDown: function(evt) {
22181  window.setTimeout(function() { this.SetFocus(); }.aspxBind(this), 0);
22182 },
22183 IsFocusEventsLocked: function() {
22184  return this.focusEventsLocked;
22185 },
22186 LockFocusEvents: function() {
22187  if(!this.focused) return;
22188  this.focusEventsLocked = true;
22189 },
22190 UnlockFocusEvents: function() {
22191  this.focusEventsLocked = false;
22192 },
22193 ForceRefocusEditor: function(evt, isNativeFocus) {
22194  if(ASPx.Browser.VirtualKeyboardSupported && !this.ownerListBox) {
22195   var focusedEditor = ASPx.VirtualKeyboardUI.getFocusedEditor();
22196   if(ASPx.VirtualKeyboardUI.getInputNativeFocusLocked() && (!focusedEditor || focusedEditor === this))
22197     return;
22198   ASPx.VirtualKeyboardUI.setInputNativeFocusLocked(!isNativeFocus);
22199  }
22200  this.LockFocusEvents();
22201  this.BlurInputElement();
22202  window.setTimeout(function() { 
22203   if(ASPx.Browser.VirtualKeyboardSupported && !this.ownerListBox) {
22204    ASPx.VirtualKeyboardUI.setFocusEditorCore(this);
22205   } else {
22206    this.SetFocus();
22207   }
22208  }.aspxBind(this), 0);
22209 },
22210 BlurInputElement: function() {
22211  var inputElement = this.GetFocusableInputElement();
22212  if(inputElement && inputElement.blur)
22213   inputElement.blur();
22214 },
22215 IsEditorElement: function(element) {
22216  return this.GetMainElement() == element || ASPx.GetIsParent(this.GetMainElement(), element);
22217 },
22218 IsClearButtonElement: function(element) {
22219  return false;
22220 },
22221 IsElementBelongToInputElement: function(element) {
22222  return this.GetInputElement() == element;
22223 },
22224 OnFocusCore: function() {
22225  if(this.UseDelayedSpecialFocus())
22226   window.clearTimeout(this.specialFocusTimer);
22227  if(!this.IsFocusEventsLocked()){
22228   this.focused = true;
22229   ASPx.SetFocusedEditor(this);
22230   if(this.styleDecoration)
22231    this.styleDecoration.Update();
22232   if(this.isInitialized)
22233    this.RaiseFocus();
22234  }
22235  else
22236   this.UnlockFocusEvents();
22237 },
22238 OnLostFocusCore: function() {
22239  if(!this.IsFocusEventsLocked()){
22240   this.focused = false;
22241   if(ASPx.GetFocusedEditor() === this)
22242    ASPx.SetFocusedEditor(null);
22243   if(this.styleDecoration)
22244    this.styleDecoration.Update();
22245   this.RaiseLostFocus();
22246  }
22247 },
22248 OnFocus: function() {
22249  if(!this.specialKeyboardHandlingUsed)
22250   this.OnFocusCore();
22251 },
22252 OnLostFocus: function() {
22253  if(this.isInitialized && !this.specialKeyboardHandlingUsed)
22254   this.OnLostFocusCore();
22255 },
22256 OnSpecialFocus: function() {
22257  if(this.isInitialized)
22258   this.OnFocusCore();
22259 },
22260 OnSpecialLostFocus: function() {
22261  if(this.isInitialized)
22262   this.OnLostFocusCore();
22263 },
22264 OnMouseWheel: function(evt){
22265 },
22266 OnValidation: function(validationType) {
22267  if(this.customValidationEnabled && this.isInitialized && ASPx.IsExistsElement(this.GetMainElement()) &&
22268   (!this.IsErrorFrameDisplayed() || this.GetElementRequiredForErrorFrame())) {
22269   this.BeginErrorFrameUpdate();
22270   try {
22271    if(this.validateOnLeave || validationType != ValidationType.PersonalOnValueChanged) {
22272     this.SetIsValid(true, true );
22273     this.SetErrorText(this.initialErrorText, true );
22274     this.ValidateWithPatterns();
22275     this.RaiseValidation();
22276    }
22277    this.UpdateErrorFrameAndFocus(this.editorFocusingRequired(validationType));
22278   } finally {
22279    this.EndErrorFrameUpdate();
22280   }
22281   this.UpdateValidationSummaries(validationType);
22282   this.ariaExplanatoryTextManager.UpdateValidationState(validationType);
22283  }
22284 },
22285 GetElementRequiredForErrorFrame: function() {
22286  return this.GetExternalTable();
22287 },
22288 editorFocusingRequired: function(validationType) {
22289  return !this.GetIsValid() && ((validationType == ValidationType.PersonalOnValueChanged && this.validateOnLeave) ||
22290         (validationType == ValidationType.PersonalViaScript && this.setFocusOnError));
22291 },
22292 OnValueChanged: function() {
22293  if(this.getProcessOnServerOnValueChanged())
22294   this.SendPostBackInternal("");
22295 },
22296 getProcessOnServerOnValueChanged: function() {
22297  var processOnServer = this.RaiseValidationInternal();
22298  return this.RaiseValueChangedEvent() && processOnServer;
22299 },
22300 ParseValue: function() {
22301 },
22302 RaisePersonalStandardValidation: function() {
22303  if(ASPx.IsFunction(window.ValidatorOnChange)) {
22304   var inputElement = this.GetValueInputToValidate();
22305   if(inputElement && inputElement.Validators)
22306    window.ValidatorOnChange({ srcElement: inputElement });
22307  }
22308 },
22309 RaiseValidationInternal: function() {
22310  if(this.isPostBackAllowed() && this.causesValidation && this.validateOnLeave)
22311   return ASPxClientEdit.ValidateGroup(this.validationGroup);
22312  else {
22313   this.OnValidation(ValidationType.PersonalOnValueChanged);
22314   return this.GetIsValid();
22315  }
22316 },
22317 RaiseValueChangedEvent: function(){
22318  return this.RaiseValueChanged();
22319 },
22320 SendPostBackInternal: function(postBackArg) {
22321  if(ASPx.IsFunction(this.sendPostBackWithValidation))
22322   this.sendPostBackWithValidation(postBackArg);
22323  else
22324   this.SendPostBack(postBackArg);
22325 },
22326 SetElementToBeFocused: function() {
22327  if(this.IsVisible())
22328   invalidEditorToBeFocused = this;
22329 },
22330 GetFocusSelectAction: function() {
22331  return null;
22332 },
22333 SetFocus: function() {
22334  var inputElement = this.GetFocusableInputElement();
22335  if(!inputElement) return; 
22336  var isIE9 = ASPx.Browser.IE && ASPx.Browser.Version >= 9;
22337  if((ASPx.GetActiveElement() != inputElement || isIE9) && _aspxIsEditorFocusable(inputElement))
22338   ASPx.SetFocus(inputElement, this.GetFocusSelectAction());
22339 },
22340 SetFocusOnError: function() {
22341  if(invalidEditorToBeFocused == this) {
22342   this.SetFocus();
22343   invalidEditorToBeFocused = null;
22344  }
22345 },
22346 BeginErrorFrameUpdate: function() {
22347  if(!this.errorFrameUpdateLocked)
22348   this.errorFrameUpdateLocked = true;
22349 },
22350 EndErrorFrameUpdate: function() {
22351  this.errorFrameUpdateLocked = false;
22352  var args = this.updateErrorFrameAndFocusLastCallArgs;
22353  if(args) {
22354   this.UpdateErrorFrameAndFocus(args[0], args[1]);
22355   delete this.updateErrorFrameAndFocusLastCallArgs;
22356  }
22357 },
22358 UpdateErrorFrameAndFocus: function(setFocusOnError, ignoreVisibilityCheck, isValid) {
22359  if(!this.GetEnabled() || !ignoreVisibilityCheck && !this.GetVisible())
22360   return;
22361  if(this.errorFrameUpdateLocked) {
22362   this.updateErrorFrameAndFocusLastCallArgs = [ setFocusOnError, ignoreVisibilityCheck ];
22363   return;
22364  }
22365  if(this.styleDecoration)
22366   this.styleDecoration.Update();
22367  if(typeof(isValid) == "undefined")
22368   isValid = this.GetIsValid();
22369  var externalTable = this.GetExternalTable();
22370  var isStaticDisplay = this.display == ErrorFrameDisplay.Static;
22371  if(isValid && this.IsErrorFrameDisplayed()) {
22372   if(isStaticDisplay) {
22373    this.HideErrorCell(true);
22374    ASPx.AddClassNameToElement(externalTable, ASPxEditExternalTableClassNames.ValidStaticTableClassName);
22375   } else {
22376    this.HideErrorCell();
22377    this.SaveControlCellStyles();
22378    this.ClearControlCellStyles();
22379    ASPx.AddClassNameToElement(externalTable, ASPxEditExternalTableClassNames.ValidDynamicTableClassName);
22380   }
22381  } else {
22382   var editorLocatedWithinVisibleContainer = this.IsVisible();
22383   if(this.IsErrorFrameDisplayed()) {
22384    this.UpdateErrorCellContent();
22385    if(isStaticDisplay) {
22386     this.ShowErrorCell(true);
22387     ASPx.RemoveClassNameFromElement(externalTable, ASPxEditExternalTableClassNames.ValidStaticTableClassName);
22388    } else {
22389     this.EnsureControlCellStylesLoaded();
22390     this.RestoreControlCellStyles();
22391     this.ShowErrorCell();
22392     ASPx.RemoveClassNameFromElement(externalTable, ASPxEditExternalTableClassNames.ValidDynamicTableClassName);
22393    }
22394   }
22395   if(editorLocatedWithinVisibleContainer) {
22396    if(setFocusOnError && this.setFocusOnError && invalidEditorToBeFocused == null) {
22397     this.SetElementToBeFocused();
22398     this.SetFocusOnError();
22399    }
22400   }
22401  }
22402 },
22403 ShowErrorCell: function (useVisibilityAttribute) {
22404  var errorCell = this.GetErrorCell();
22405  if(errorCell) {
22406   if(useVisibilityAttribute)
22407    ASPx.SetElementVisibility(errorCell, true);
22408   else
22409    ASPx.SetElementDisplay(errorCell, true);
22410  }
22411 },
22412 HideErrorCell: function(useVisibilityAttribute) {
22413  var errorCell = this.GetErrorCell();
22414  if(errorCell) {
22415   if(useVisibilityAttribute)
22416    ASPx.SetElementVisibility(errorCell, false);
22417   else
22418    ASPx.SetElementDisplay(errorCell, false);
22419  }
22420 },
22421 SaveControlCellStyles: function() {
22422  this.EnsureControlCellStylesLoaded();
22423 },
22424 EnsureControlCellStylesLoaded: function() {
22425  if(typeof(this.controlCellStyles) == "undefined") {
22426   var controlCell = this.GetControlCell();
22427   this.controlCellStyles = {
22428    cssClass: controlCell.className,
22429    style: this.ExtractElementStyleStringIgnoringVisibilityProps(controlCell)
22430   };
22431  }
22432 },
22433 ClearControlCellStyles: function() {
22434  this.ClearElementStyle(this.GetControlCell());
22435 },
22436 RestoreControlCellStyles: function() {
22437  var controlCell = this.GetControlCell();
22438  var externalTable = this.GetExternalTable();
22439  if(ASPx.Browser.WebKitFamily)
22440   this.MakeBorderSeparateForTable(externalTable);
22441  controlCell.className = this.controlCellStyles.cssClass;
22442  controlCell.style.cssText = this.controlCellStyles.style;
22443  if(ASPx.Browser.WebKitFamily)
22444   this.UndoBorderSeparateForTable(externalTable);
22445 },
22446 MakeBorderSeparateForTable: function(table) {
22447  ASPx.AddClassNameToElement(table, ASPxEditExternalTableClassNames.TableWithSeparateBordersClassName);
22448 },
22449 UndoBorderSeparateForTable: function(table) {
22450  setTimeout(function () {
22451   ASPx.RemoveClassNameFromElement(table, ASPxEditExternalTableClassNames.TableWithSeparateBordersClassName);
22452  }, 0);
22453 },
22454 ExtractElementStyleStringIgnoringVisibilityProps: function(element) {
22455  var savedVisibility = element.style.visibility;
22456  var savedDisplay = element.style.display;
22457  element.style.visibility = "";
22458  element.style.display = "";
22459  var styleStr = element.style.cssText;
22460  element.style.visibility = savedVisibility;
22461  element.style.display = savedDisplay;
22462  return styleStr;
22463 },
22464 ClearElementStyle: function(element) {
22465  if(!element)
22466   return;
22467  element.className = "";
22468  var excludedAttrNames = [
22469   "width", "display", "visibility",
22470   "position", "left", "top", "z-index",
22471   "margin", "margin-top", "margin-right", "margin-bottom", "margin-left",
22472   "float", "clear"
22473  ];
22474  var savedAttrValues = { };
22475  for(var i = 0; i < excludedAttrNames.length; i++) {
22476   var attrName = excludedAttrNames[i];
22477   var attrValue = element.style[attrName];
22478   if(attrValue)
22479    savedAttrValues[attrName] = attrValue;
22480  }
22481  element.style.cssText = "";
22482  for(var styleAttrName in savedAttrValues)
22483   if(savedAttrValues.hasOwnProperty(styleAttrName))
22484    element.style[styleAttrName] = savedAttrValues[styleAttrName];
22485 },
22486 Clear: function() {
22487  this.SetValue(null);
22488  this.SetIsValid(true);
22489  return true;
22490 },
22491 UpdateErrorCellContent: function() {
22492  if(this.errorDisplayMode.indexOf("t") > -1)
22493   this.UpdateErrorText();
22494  if(this.errorDisplayMode == "i")
22495   this.UpdateErrorImage();
22496 },
22497 UpdateErrorImage: function() {
22498  var image = this.GetErrorImage();
22499  if(ASPx.IsExistsElement(image)) {
22500   if(this.accessibilityCompliant) {
22501    ASPx.Attr.SetAttribute(image, "aria-label", this.errorText);
22502    var innerImg = ASPx.GetNodeByTagName(image, "IMG", 0);
22503    if(ASPx.IsExists(innerImg))
22504     innerImg.alt = this.errorText;
22505   }
22506   image.alt = this.errorText;
22507   image.title = this.errorText;
22508  } else {
22509   this.UpdateErrorText();
22510  }
22511 },
22512 UpdateErrorText: function() {
22513  var errorTextCell = this.GetErrorTextCell();
22514  if(ASPx.IsExistsElement(errorTextCell))
22515   errorTextCell.innerHTML = this.HtmlEncode(this.errorText);
22516 },
22517 ValidateWithPatterns: function() {
22518  if(this.validationPatterns.length > 0) {
22519   var value = this.GetValue();
22520   for(var i = 0; i < this.validationPatterns.length; i++) {
22521    var validator = this.validationPatterns[i];
22522    if(!validator.EvaluateIsValid(value)) {
22523     this.SetIsValid(false, true );
22524     this.SetErrorText(validator.errorText, true );
22525     return;
22526    }
22527   }
22528  }
22529 },
22530 OnSpecialKeyDown: function(evt){
22531  this.RaiseKeyDown(evt);
22532  var handler = this.keyDownHandlers[evt.keyCode];
22533  if(handler) 
22534   return this[handler](evt);
22535  return false;
22536 },
22537 OnSpecialKeyPress: function(evt){
22538  this.RaiseKeyPress(evt);
22539  var handler = this.keyPressHandlers[evt.keyCode];
22540  if(handler) 
22541   return this[handler](evt);
22542  if(ASPx.Browser.NetscapeFamily || ASPx.Browser.Opera){
22543   if(evt.keyCode == ASPx.Key.Enter)
22544    return this.enterProcessed;
22545  }
22546  return false;
22547 },
22548 OnSpecialKeyUp: function(evt){
22549  this.RaiseKeyUp(evt);
22550  var handler = this.keyUpHandlers[evt.keyCode];
22551  if(handler) 
22552   return this[handler](evt);
22553  return false;
22554 },
22555 OnKeyDown: function(evt) {
22556  if(!this.specialKeyboardHandlingUsed)
22557   this.RaiseKeyDown(evt);
22558 },
22559 OnKeyPress: function(evt) {
22560  if(!this.specialKeyboardHandlingUsed)
22561   this.RaiseKeyPress(evt);
22562 },
22563 OnKeyUp: function(evt) {
22564  if(!this.specialKeyboardHandlingUsed)
22565   this.RaiseKeyUp(evt);
22566 },
22567 RaiseKeyDown: function(evt){
22568  if(!this.KeyDown.IsEmpty()){
22569   var args = new ASPxClientEditKeyEventArgs(evt);
22570   this.KeyDown.FireEvent(this, args);
22571  }
22572 },
22573 RaiseKeyPress: function(evt){
22574  if(!this.KeyPress.IsEmpty()){
22575   var args = new ASPxClientEditKeyEventArgs(evt);
22576   this.KeyPress.FireEvent(this, args);
22577  }
22578 },
22579 RaiseKeyUp: function(evt){
22580  if(!this.KeyUp.IsEmpty()){
22581   var args = new ASPxClientEditKeyEventArgs(evt);
22582   this.KeyUp.FireEvent(this, args);
22583  }
22584 },
22585 RaiseFocus: function(){
22586  if(!this.GotFocus.IsEmpty()){
22587   var args = new ASPxClientEventArgs();
22588   this.GotFocus.FireEvent(this, args);
22589  }
22590 },
22591 RaiseLostFocus: function(){
22592  if(!this.LostFocus.IsEmpty()){
22593   var args = new ASPxClientEventArgs();
22594   this.LostFocus.FireEvent(this, args);
22595  }
22596 },
22597 RaiseValidation: function() {
22598  if(this.customValidationEnabled && !this.Validation.IsEmpty()) {
22599   var currentValue = this.GetValue();
22600   var args = new ASPxClientEditValidationEventArgs(currentValue, this.errorText, this.GetIsValid());
22601   this.Validation.FireEvent(this, args);
22602   this.SetErrorText(args.errorText, true );
22603   this.SetIsValid(args.isValid, true );
22604   if(args.value != currentValue)
22605    this.SetValue(args.value);
22606  }
22607 },
22608 RaiseValueChanged: function(){
22609  var processOnServer = this.isPostBackAllowed();
22610  if(!this.ValueChanged.IsEmpty()){
22611   var args = new ASPxClientProcessingModeEventArgs(processOnServer);
22612   this.ValueChanged.FireEvent(this, args);
22613   processOnServer = args.processOnServer;
22614  }
22615  return processOnServer;  
22616 },
22617 isPostBackAllowed: function() {
22618  return this.autoPostBack;
22619 },
22620 AddDecorationStyle: function(key, className, cssText) {
22621  if(!this.styleDecoration) 
22622   this.RequireStyleDecoration();
22623  this.styleDecoration.AddStyle(key, className, cssText);
22624 }, 
22625 RequireStyleDecoration: function() {
22626  this.styleDecoration = this.CreateStyleDecoration();
22627  this.PopulateStyleDecorationPostfixes();
22628 },
22629 CreateStyleDecoration: function() {
22630  return new ASPx.EditorStyleDecoration(this);
22631 },
22632 PopulateStyleDecorationPostfixes: function() {
22633  this.styleDecoration.AddPostfix("");
22634 },
22635 LockStyleDecorationUpdate: function() {
22636  if(this.styleDecoration)
22637   this.styleDecoration.LockUpdate();
22638 },
22639 UnlockStyleDecorationUpdate: function() {
22640  if(this.styleDecoration)
22641   this.styleDecoration.UnlockUpdate();
22642 },
22643 Focus: function(){
22644  this.SetFocus();
22645 },
22646 GetIsValid: function() {
22647  var hasRequiredInputElement = !this.RequireInputElementToValidate() || ASPx.IsExistsElement(this.GetInputElement());
22648  if(!hasRequiredInputElement || this.IsErrorFrameDisplayed() && !ASPx.IsExistsElement(this.GetElementRequiredForErrorFrame()))
22649   return true;
22650  return this.isValid;
22651 },
22652 RequireInputElementToValidate: function() {
22653  return true;
22654 },
22655 IsErrorFrameDisplayed: function() {
22656  return this.display !== ErrorFrameDisplay.None;
22657 },
22658 GetErrorText: function(){
22659  return this.errorText;
22660 },
22661 SetIsValid: function(isValid, validating){
22662  if(this.customValidationEnabled && this.isValid != isValid) {
22663   this.isValid = isValid;
22664   this.UpdateErrorFrameAndFocus(false );
22665   this.UpdateClientValidationState();
22666   if(!validating)
22667    this.UpdateValidationSummaries(ValidationType.PersonalViaScript);
22668  }
22669 },
22670 SetErrorText: function(errorText, validating){
22671  if(this.customValidationEnabled && this.errorText != errorText) {
22672   this.errorText = errorText;
22673   this.UpdateErrorFrameAndFocus(false );
22674   this.UpdateClientValidationState();
22675   if(!validating)
22676    this.UpdateValidationSummaries(ValidationType.PersonalViaScript);
22677  }
22678 },
22679 Validate: function(){
22680  this.ParseValue();
22681  this.OnValidation(ValidationType.PersonalViaScript);
22682 },
22683 GetModifyEvent: function() {
22684  return this.ValueChanged;
22685 },
22686 EnsureRequiredNativeAttributesExists: function() { }
22687});
22688ASPx.Ident.scripts.ASPxClientEdit = true;
22689ASPx.focusedEditorName = "";
22690ASPx.GetFocusedEditor = function() {
22691 var focusedEditor = ASPx.GetControlCollection().Get(ASPx.focusedEditorName);
22692 if(focusedEditor && !focusedEditor.focused){
22693  ASPx.SetFocusedEditor(null);
22694  focusedEditor = null;
22695 }
22696 return focusedEditor;
22697};
22698ASPx.SetFocusedEditor = function(editor) {
22699 ASPx.focusedEditorName = editor ? editor.name : "";
22700};
22701ASPx.FindAssociatedLabelElements = function(editor) {
22702 var assocciatedLabels = [];
22703 var inputElement = editor.GetInputElement();
22704 if(!ASPx.IsExists(inputElement) || !inputElement.id) 
22705  return assocciatedLabels;
22706 var labels = ASPx.GetNodesByTagName(document, "LABEL");
22707 for(var i = 0; i < labels.length; i++) {
22708  if(!!labels[i].htmlFor && labels[i].htmlFor === inputElement.id)
22709   assocciatedLabels.push(labels[i]);
22710 }
22711 return assocciatedLabels;
22712};
22713var DisableAccessibilityExplanatoryTextManager = ASPx.CreateClass(null, {
22714 constructor: function(editor) {
22715  this.editor = editor;
22716 },
22717 GetAdditionalTextRowId: function() {
22718  return this.editor.name + EditElementSuffix.AccessibilityAdditionalTextRow;
22719 },
22720 GetErrorTextElement: function () {
22721  return !!this.editor.GetErrorTextCell() ? this.editor.GetErrorTextCell() : this.editor.GetErrorImage();
22722 },
22723 GetTextElement: function() { return null; },
22724 SetCaptionAssociating: function() { },
22725 UpdateText: function() { },
22726 UpdateValidationState: function(validationType) { },
22727 ToggleErrorAlert: function() { },
22728 SetOrRemoveText: function(accessibilityElements, textElement, setText, isLabel, isFirst) { }
22729});
22730var EditAccessibilityExplanatoryTextManager = ASPx.CreateClass(DisableAccessibilityExplanatoryTextManager, {
22731 constructor: function(editor) {
22732  this.constructor.prototype.constructor.call(this, editor);
22733  this.invisibleRowCssClassName = "dxAIR";
22734 },
22735 GetTextElement: function() {
22736  var mainElement = this.editor.GetMainElement();
22737  if(!mainElement) return null;
22738  var explanatoryText = "";
22739  var explanatoryTextElement = null;
22740  if(!!this.editor.nullText)
22741   explanatoryText = this.editor.nullText;
22742  else if(!!this.editor.helpTextObj)
22743   explanatoryTextElement = this.editor.helpTextObj.helpTextElement;
22744  else if(!!mainElement.title)
22745   explanatoryText = mainElement.title;
22746  if(explanatoryText && mainElement.tagName == "TABLE") {
22747   var assistantElement = this.editor.GetAccessibilityFirstActiveElement();
22748   if(assistantElement)
22749    ASPx.Attr.Aria.AppendLabel(assistantElement, explanatoryText, true);
22750  }
22751  return explanatoryTextElement;
22752 },
22753 SetCaptionAssociating: function() {
22754  var captionCell = this.editor.GetCaptionCell();
22755  if(!captionCell || captionCell.childNodes[0].tagName == "LABEL") return;
22756  var labelElement = captionCell.childNodes[0];
22757  ASPx.EditAccessibilityExplanatoryTextManager.SetLabelAssociating(this.editor, this.editor.GetAccessibilityFirstActiveElement(), labelElement);
22758 },
22759 UpdateText: function() {
22760  var additionalTextElement = this.GetTextElement();
22761  if(ASPx.IsExists(additionalTextElement)) {
22762   var pronounceElement = this.editor.GetAccessibilityFirstActiveElement();
22763   var hasAnyLabel = !!ASPx.Attr.GetAttribute(pronounceElement, "aria-label") || 
22764    !!ASPx.Attr.GetAttribute(pronounceElement, "aria-labelledby") ||
22765    ASPx.FindAssociatedLabelElements(this.editor).length > 0;
22766   this.SetOrRemoveText([pronounceElement], additionalTextElement, true, !hasAnyLabel, false);
22767  }
22768 },
22769 UpdateValidationState: function(validationType) {
22770  if(validationType == ValidationType.PersonalOnValueChanged && this.editor.accessibilityHelper) return;
22771  var accessibilityElements = this.editor.GetAccessibilityActiveElements();
22772  var errorTextElement = this.GetErrorTextElement();
22773  this.SetOrRemoveText(accessibilityElements, errorTextElement, !this.editor.isValid, false, true);
22774  if(accessibilityElements.length > 0 && !!errorTextElement) {
22775   for(var i = 0; i < accessibilityElements.length; i++) {
22776    if(!ASPx.IsExists(accessibilityElements[i])) continue;
22777    ASPx.Attr.SetOrRemoveAttribute(accessibilityElements[i], "aria-invalid", !this.editor.isValid);
22778   }
22779  }
22780 },
22781 ToggleErrorAlert: function() {
22782  var errorTextElement = this.GetErrorTextElement();
22783  ASPx.SetElementDisplay(errorTextElement, false);
22784  ASPx.Attr.SetAttribute(errorTextElement, 'role', 'alert');
22785  ASPx.SetElementDisplay(errorTextElement, true);
22786  setTimeout(function() { ASPx.Attr.RemoveAttribute(errorTextElement, 'role'); }, 500);
22787 },
22788 SetOrRemoveText: function(accessibilityElements, textElement, setText, isLabel, isFirst) {
22789  var idsRefAttribute = isLabel ? "aria-labelledby" : "aria-describedby";
22790  if(!textElement) return;
22791  var textId = !!textElement.id ? textElement.id : textElement.parentNode.id;
22792  for(var i = 0; i < accessibilityElements.length; i++) {
22793   if(!accessibilityElements[i]) continue;
22794   var descRefString = ASPx.Attr.GetAttribute(accessibilityElements[i], idsRefAttribute);
22795   var descRefIds = !!descRefString ? descRefString.split(" ") : [ ];
22796   var descIndex = descRefIds.indexOf(textId);
22797   if(setText && descIndex == -1) {
22798    if(isFirst)
22799     descRefIds.unshift(textId);
22800    else
22801     descRefIds.push(textId);
22802   }
22803   else if(!setText && descIndex > -1)
22804    descRefIds.splice(descIndex, 1);
22805   ASPx.Attr.SetOrRemoveAttribute(accessibilityElements[i], idsRefAttribute, descRefIds.join(" "));
22806  }
22807 }
22808});
22809ASPx.DisableAccessibilityExplanatoryTextManager = DisableAccessibilityExplanatoryTextManager;
22810ASPx.EditAccessibilityExplanatoryTextManager = EditAccessibilityExplanatoryTextManager;
22811ASPx.EditAccessibilityExplanatoryTextManager.SetLabelAssociating = function(editor, activeElement, labelElement) {
22812 var clickHandler = function(evt) {
22813  if(editor && editor.OnAssociatedLabelClick)
22814   editor.OnAssociatedLabelClick(evt);
22815  else
22816   activeElement.click();
22817 };
22818 ASPx.Evt.AttachEventToElement(labelElement, "click", clickHandler);
22819 if(!!editor) {
22820  var hasAriaLabel = !!ASPx.Attr.GetAttribute(activeElement, "aria-label");
22821  editor.ariaExplanatoryTextManager.SetOrRemoveText([activeElement], labelElement, true, !hasAriaLabel, true);
22822 }
22823};
22824ASPxClientEdit.ClearEditorsInContainer = function(container, validationGroup, clearInvisibleEditors) {
22825 invalidEditorToBeFocused = null;
22826 ASPx.ProcessEditorsInContainer(container, ASPx.ClearProcessingProc, ASPx.ClearChoiceCondition, validationGroup, clearInvisibleEditors, true );
22827 ASPxClientEdit.ClearExternalControlsInContainer(container, validationGroup, clearInvisibleEditors, true );
22828};
22829ASPxClientEdit.ClearEditorsInContainerById = function(containerId, validationGroup, clearInvisibleEditors) {
22830 var container = document.getElementById(containerId);
22831 this.ClearEditorsInContainer(container, validationGroup, clearInvisibleEditors);
22832};
22833ASPxClientEdit.ClearGroup = function(validationGroup, clearInvisibleEditors) {
22834 return this.ClearEditorsInContainer(null, validationGroup, clearInvisibleEditors);
22835};
22836ASPxClientEdit.ValidateEditorsInContainer = function(container, validationGroup, validateInvisibleEditors) {
22837 var summaryCollection;
22838 if(ASPx.Ident.scripts.ASPxClientValidationSummary) {
22839  summaryCollection = ASPx.GetClientValidationSummaryCollection();
22840  summaryCollection.AllowNewErrorsAccepting(validationGroup);
22841 }
22842 var validationResult = ASPx.ProcessEditorsInContainer(container, ASPx.ValidateProcessingProc, _aspxValidateChoiceCondition, validationGroup, validateInvisibleEditors,
22843  false );
22844 validationResult.isValid = ASPxClientEdit.ValidateExternalControlsInContainer(container, validationGroup, validateInvisibleEditors,
22845  false ) && validationResult.isValid;
22846 if(typeof(validateInvisibleEditors) == "undefined")
22847  validateInvisibleEditors = false;
22848 if(typeof(validationGroup) == "undefined")
22849  validationGroup = null;    
22850 ASPx.GetControlCollection().RaiseValidationCompleted(container, validationGroup,
22851 validateInvisibleEditors, validationResult.isValid, validationResult.firstInvalid, validationResult.firstVisibleInvalid);
22852 if(summaryCollection)
22853  summaryCollection.ForbidNewErrorsAccepting(validationGroup);
22854 if(!validationResult.isValid && !!validationResult.firstVisibleInvalid && validationResult.firstVisibleInvalid.accessibilityCompliant && !validationResult.firstVisibleInvalid.setFocusOnError) {
22855  var accessInvalidControl = validationResult.firstVisibleInvalid;
22856  if(!summaryCollection && !accessInvalidControl.focused) {
22857   var beforeDelayActiveElement = ASPx.GetActiveElement();
22858   setTimeout(function() {
22859    var currentActiveElement = ASPx.GetActiveElement();
22860    if(accessInvalidControl.focused || (currentActiveElement != beforeDelayActiveElement && ASPx.Attr.IsExistsAttribute(currentActiveElement, 'role')))
22861     return;
22862    accessInvalidControl.ariaExplanatoryTextManager.ToggleErrorAlert();
22863   }, 500);    
22864  }
22865 }
22866 return validationResult.isValid;
22867};
22868ASPxClientEdit.ValidateEditorsInContainerById = function(containerId, validationGroup, validateInvisibleEditors) {
22869 var container = document.getElementById(containerId);
22870 return this.ValidateEditorsInContainer(container, validationGroup, validateInvisibleEditors);
22871};
22872ASPxClientEdit.ValidateGroup = function(validationGroup, validateInvisibleEditors) {
22873 return this.ValidateEditorsInContainer(null, validationGroup, validateInvisibleEditors);
22874};
22875ASPxClientEdit.AreEditorsValid = function(containerOrContainerId, validationGroup, checkInvisibleEditors) {
22876 var container = typeof(containerOrContainerId) == "string" ? document.getElementById(containerOrContainerId) : containerOrContainerId;
22877 var checkResult = ASPx.ProcessEditorsInContainer(container, ASPx.EditorsValidProcessingProc, _aspxEditorsValidChoiceCondition, validationGroup,
22878  checkInvisibleEditors, false );
22879 checkResult.isValid = ASPxClientEdit.AreExternalControlsValidInContainer(containerOrContainerId, validationGroup,
22880  checkInvisibleEditors, false ) && checkResult.isValid;
22881 return checkResult.isValid;
22882};
22883ASPxClientEdit.AreExternalControlsValidInContainer = function(containerId, validationGroup, validateInvisibleEditors, processDisabledEditors) {
22884 if(ASPx.Ident.scripts.ASPxClientHtmlEditor)
22885  return ASPxClientHtmlEditor.AreEditorsValidInContainer(containerId, validationGroup, validateInvisibleEditors, processDisabledEditors);
22886 return true;
22887};
22888ASPxClientEdit.ClearExternalControlsInContainer = function(containerId, validationGroup, validateInvisibleEditors, processDisabledEditors) {
22889 if(ASPx.Ident.scripts.ASPxClientHtmlEditor)
22890  return ASPxClientHtmlEditor.ClearEditorsInContainer(containerId, validationGroup, validateInvisibleEditors, processDisabledEditors);
22891 return true;
22892};
22893ASPxClientEdit.ValidateExternalControlsInContainer = function(containerId, validationGroup, validateInvisibleEditors, processDisabledEditors) {
22894 if(ASPx.Ident.scripts.ASPxClientHtmlEditor)
22895  return ASPxClientHtmlEditor.ValidateEditorsInContainer(containerId, validationGroup, validateInvisibleEditors, processDisabledEditors);
22896 return true;
22897};
22898ASPxClientEdit.AttachEditorModificationListener = function(handler, predicate) {
22899 var processAction = function(event) { event.AddHandler(handler); };
22900 ASPxClientEdit.ProcessEditorModificationListener(handler, processAction, predicate);
22901};
22902ASPxClientEdit.DetachEditorModificationListener = function(handler, predicate) {
22903 var processAction = function(event) { event.RemoveHandler(handler); };
22904 ASPxClientEdit.ProcessEditorModificationListener(handler, processAction, predicate);
22905};
22906ASPxClientEdit.ProcessEditorModificationListener = function(handler, action, predicate) {
22907 ASPx.GetControlCollection().ForEachControl(function(control) {
22908  if(control.GetModifyEvent && predicate(control)) {
22909   if(control.isNative)
22910    control.EnsureRequiredNativeAttributesExists();
22911   action(control.GetModifyEvent());
22912  }
22913 });
22914};
22915var ASPxClientEditKeyEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
22916 constructor: function(htmlEvent) {
22917  this.constructor.prototype.constructor.call(this);
22918  this.htmlEvent = htmlEvent;
22919 }
22920});
22921var ASPxClientEditValidationEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
22922 constructor: function(value, errorText, isValid) {
22923  this.constructor.prototype.constructor.call(this);
22924  this.errorText = errorText;
22925  this.isValid = isValid;
22926  this.value = value;
22927 }
22928});
22929ASPx.ProcessEditorsInContainer = function(container, processingProc, choiceCondition, validationGroup, processInvisibleEditors, processDisabledEditors) {
22930 var allProcessedSuccessfull = true;
22931 var firstInvalid = null;
22932 var firstVisibleInvalid = null;
22933 var invalidEditorToBeFocused = null;
22934 ASPx.GetControlCollection().ForEachControl(function(control) {
22935  var needToProcessRatingControl = window.ASPxClientRatingControl && (control instanceof ASPxClientRatingControl) && processingProc === ASPx.ClearProcessingProc;
22936  if(!ASPx.Ident.isDialogInvisibleControl(control) && (ASPx.Ident.IsASPxClientEdit(control) || needToProcessRatingControl) && (processDisabledEditors || control.GetEnabled())) {
22937   var mainElement = control.GetMainElement();
22938   if(mainElement &&
22939    (container == null || ASPx.GetIsParent(container, mainElement)) &&
22940    (processInvisibleEditors || control.IsVisible()) &&
22941    (!choiceCondition || choiceCondition(control, validationGroup))) {
22942    var isSuccess = processingProc(control);
22943    if(!isSuccess) {
22944     allProcessedSuccessfull = false;
22945     if(firstInvalid == null)
22946      firstInvalid = control;
22947     var isVisible = control.IsVisible();
22948     if(isVisible && firstVisibleInvalid == null)
22949      firstVisibleInvalid = control;
22950     if(control.setFocusOnError && invalidEditorToBeFocused == null && isVisible)
22951      invalidEditorToBeFocused = control;
22952    }
22953   }
22954  }
22955 }, this);
22956 if(invalidEditorToBeFocused != null)
22957  invalidEditorToBeFocused.SetFocus();
22958 return new ASPxValidationResult(allProcessedSuccessfull, firstInvalid, firstVisibleInvalid);
22959};
22960var ASPxValidationResult = ASPx.CreateClass(null, {
22961 constructor: function(isValid, firstInvalid, firstVisibleInvalid) {
22962  this.isValid = isValid;
22963  this.firstInvalid = firstInvalid;
22964  this.firstVisibleInvalid = firstVisibleInvalid;
22965 }
22966});
22967ASPx.ClearChoiceCondition = function(edit, validationGroup) {
22968 return !ASPx.IsExists(validationGroup) || (edit.validationGroup == validationGroup);
22969};
22970function _aspxValidateChoiceCondition(edit, validationGroup) {
22971 return ASPx.ClearChoiceCondition(edit, validationGroup) && edit.customValidationEnabled;
22972}
22973function _aspxEditorsValidChoiceCondition(edit, validationGroup) {
22974 return _aspxValidateChoiceCondition(edit, validationGroup);
22975}
22976function wrapLostFocusHandler(handler) {
22977 if(ASPx.Browser.Edge) {
22978  return function(name) {
22979   var edit = ASPx.GetControlCollection().Get(name);
22980   if(edit && !ASPx.IsElementVisible(edit.GetMainElement()))
22981    setTimeout(handler, 0, name);
22982   else
22983    handler(name);
22984  };
22985 }
22986 return handler;
22987}
22988ASPx.EGotFocus = function(name) {
22989 var edit = ASPx.GetControlCollection().Get(name); 
22990 if(!edit) return;
22991 if(!edit.isInitialized){
22992  var inputElement = edit.GetFocusableInputElement();
22993  if(inputElement && inputElement === document.activeElement) {
22994   if(ASPx.Browser.Firefox)
22995    window.setTimeout(function() { document.activeElement.blur(); }, 0);
22996   else
22997    document.activeElement.blur();
22998  }
22999  return;
23000 }
23001 if(ASPx.Browser.VirtualKeyboardSupported && !edit.ownerListBox)
23002  ASPx.VirtualKeyboardUI.onCallingVirtualKeyboard(edit, false);
23003 else
23004  edit.OnFocus();
23005};
23006ASPx.ELostFocusCore = function(name) {
23007 var edit = ASPx.GetControlCollection().Get(name);
23008 if(ASPx.Browser.VirtualKeyboardSupported && (!edit || !edit.ownerListBox)) {
23009  var supressLostFocus = ASPx.VirtualKeyboardUI.isInputNativeBluring();
23010  if(supressLostFocus)
23011   return;
23012  ASPx.VirtualKeyboardUI.resetFocusedEditor();
23013 }
23014 if(edit != null)
23015  edit.OnLostFocus();
23016};
23017ASPx.ELostFocus = wrapLostFocusHandler(ASPx.ELostFocusCore);
23018ASPx.ESGotFocus = function(name) {
23019 var edit = ASPx.GetControlCollection().Get(name); 
23020 if(!edit) return;
23021   if(ASPx.Browser.VirtualKeyboardSupported && !edit.ownerListBox) {
23022  ASPx.VirtualKeyboardUI.onCallingVirtualKeyboard(edit, true);
23023 } else {
23024  edit.OnSpecialFocus();
23025 }
23026};
23027ASPx.ESLostFocusCore = function(name) {
23028 var edit = ASPx.GetControlCollection().Get(name);
23029 if(ASPx.Browser.VirtualKeyboardSupported && (!edit || !edit.ownerListBox)) {
23030  var supressLostFocus = ASPx.VirtualKeyboardUI.isInputNativeBluring();
23031  if(supressLostFocus)
23032   return;
23033  ASPx.VirtualKeyboardUI.resetFocusedEditor();
23034 }
23035 if(!edit) return;
23036 if(edit.UseDelayedSpecialFocus())
23037  edit.specialFocusTimer = window.setTimeout(function() { edit.OnSpecialLostFocus(); }, 30);
23038 else
23039  edit.OnSpecialLostFocus();
23040};
23041ASPx.ESLostFocus = wrapLostFocusHandler(ASPx.ESLostFocusCore);
23042ASPx.EValueChanged = function(name) {
23043 var edit = ASPx.GetControlCollection().Get(name);
23044 if(edit != null)
23045  edit.OnValueChanged();
23046};
23047ASPx.VirtualKeyboardUI = (function() {
23048 var focusedEditor = null;
23049 var inputNativeFocusLocked = false;
23050 function elementBelongsToEditor(element) {
23051  if(!element) return false;
23052  var isBelongsToEditor = false;
23053  ASPx.GetControlCollection().ForEachControl(function(control) {
23054   if(ASPx.Ident.IsASPxClientEdit(control) && control.IsEditorElement(element)) {
23055    isBelongsToEditor = true;
23056    return true;
23057   }
23058  }, this);
23059  return isBelongsToEditor;
23060 }
23061 function elementBelongsToFocusedEditor(element) {
23062  return focusedEditor && focusedEditor.IsEditorElement(element);
23063 }
23064 return {
23065  onTouchStart: function (evt) {
23066   if (!ASPx.Browser.VirtualKeyboardSupported || this.isGooglePlaceAutocompleteElementTap(evt)) return;
23067   inputNativeFocusLocked = false;
23068   if(focusedEditor)
23069    focusedEditor.onVirtualKeyboardUITouchStart(evt);
23070   if(ASPx.TouchUIHelper.pointerEnabled) {
23071    if(evt.pointerType != ASPx.TouchUIHelper.pointerType.Touch)
23072     return;
23073    this.processFocusEditorControl(evt);
23074   } else
23075    ASPx.TouchUIHelper.handleFastTapIfRequired(evt,  function(){ this.processFocusEditorControl(evt); }.aspxBind(this), false);
23076  },
23077  processFocusEditorControl: function(evt) {
23078   var evtSource = ASPx.Evt.GetEventSource(evt);
23079   var timeEditHasAppliedFocus = focusedEditor && (ASPx.Ident.IsASPxClientTimeEdit && ASPx.Ident.IsASPxClientTimeEdit(focusedEditor));
23080   var focusedTimeEditBelongsToDateEdit = timeEditHasAppliedFocus && focusedEditor.OwnerDateEdit && focusedEditor.OwnerDateEdit.GetShowTimeSection();
23081   if(focusedTimeEditBelongsToDateEdit) {
23082    focusedEditor.OwnerDateEdit.ForceRefocusTimeSectionTimeEdit(evtSource);
23083    return;
23084   }
23085   var elementWithNativeFocus = ASPx.GetActiveElement();
23086   var someEditorInputIsFocused = elementBelongsToEditor(elementWithNativeFocus);
23087   var touchKeyboardIsVisible = someEditorInputIsFocused;
23088   var tapOutsideEditorAndInputs = !elementBelongsToEditor(evtSource) && !ASPx.Ident.IsFocusableElementRegardlessTabIndex(evtSource);
23089   var blurToHideTouchKeyboard = touchKeyboardIsVisible && tapOutsideEditorAndInputs;
23090   if(blurToHideTouchKeyboard) {
23091    elementWithNativeFocus.blur();
23092    return;
23093   }
23094   var tapOutsideFocusedEditor = focusedEditor && !elementBelongsToFocusedEditor(evtSource);
23095   if(tapOutsideFocusedEditor) {
23096    var focusedEditorWithBluredInput = !elementBelongsToFocusedEditor(elementWithNativeFocus);
23097    if(focusedEditorWithBluredInput) 
23098     this.lostAppliedFocusOfEditor();
23099   }
23100  },
23101  smartFocusEditor: function(edit) {
23102   if(!edit.focused) {
23103    this.setInputNativeFocusLocked(true);
23104    this.setFocusEditorCore(edit);
23105   } else {
23106    edit.ForceRefocusEditor();
23107   }
23108  },
23109  setFocusEditorCore: function(edit) {
23110   if(ASPx.Browser.MacOSMobilePlatform) {
23111    var timeoutDuration = ASPx.Browser.Chrome ? 250 : 30;
23112    window.setTimeout(function(){ edit.SetFocus(); }, timeoutDuration);
23113   } else {
23114    edit.SetFocus();
23115   }
23116  },
23117  onCallingVirtualKeyboard: function(edit, isSpecial) {
23118   this.setAppliedFocusOfEditor(edit, isSpecial);
23119   if(edit.specialKeyboardHandlingUsed == isSpecial && inputNativeFocusLocked)
23120    edit.BlurInputElement();
23121  },
23122  isInputNativeBluring: function() {
23123   return focusedEditor && inputNativeFocusLocked;
23124  },
23125  setInputNativeFocusLocked: function(locked) {
23126   inputNativeFocusLocked = locked;
23127  },
23128  getInputNativeFocusLocked: function() {
23129   return inputNativeFocusLocked;
23130  },
23131  setAppliedFocusOfEditor: function(edit, isSpecial) {
23132   if(focusedEditor === edit) {
23133    if(edit.specialKeyboardHandlingUsed == isSpecial) {
23134     focusedEditor.UnlockFocusEvents();
23135     if(focusedEditor.EnsureClearButtonVisibility)
23136      focusedEditor.EnsureClearButtonVisibility();
23137    }
23138    return;
23139   }
23140   if(edit.specialKeyboardHandlingUsed == isSpecial) {
23141    this.lostAppliedFocusOfEditor();
23142    focusedEditor = edit;
23143    ASPx.SetFocusedEditor(edit);
23144   }
23145   if(isSpecial)
23146    edit.OnSpecialFocus();
23147   else
23148    edit.OnFocus();
23149  },
23150  lostAppliedFocusOfEditor: function() {
23151   if(!focusedEditor) return;
23152   var curEditorName = focusedEditor.name; 
23153   var skbdHandlingUsed = focusedEditor.specialKeyboardHandlingUsed;
23154   var focusedEditorInputElementExists = focusedEditor.GetInputElement();
23155   focusedEditor = null;
23156   if(!focusedEditorInputElementExists)
23157    return;
23158   ASPx.ELostFocusCore(curEditorName);
23159   if(skbdHandlingUsed)
23160    ASPx.ESLostFocusCore(curEditorName);
23161  },
23162  getFocusedEditor: function() {
23163   return focusedEditor;
23164  },
23165  resetFocusedEditor: function() {
23166   focusedEditor = null;
23167  },
23168  focusableInputElementIsActive: function(edit) {
23169   var inputElement = edit.GetFocusableInputElement();
23170   return !!inputElement ? ASPx.GetActiveElement() === inputElement : false;
23171  },
23172  isGooglePlaceAutocompleteElementTap: function(evt) {
23173   var googlePlaceAutocompleteContainer = ASPx.GetNodeByClassName(document.body, "pac-container", 0);
23174   if(!googlePlaceAutocompleteContainer)
23175    return false;
23176   return ASPx.GetParentByClassName(ASPx.Evt.GetEventSource(evt), "pac-container") != null;
23177  }
23178 };
23179})();
23180if(ASPx.Browser.VirtualKeyboardSupported) {
23181 var touchEventName = ASPx.TouchUIHelper.pointerEnabled ? ASPx.TouchUIHelper.pointerDownEventName : 'touchstart';
23182 ASPx.Evt.AttachEventToDocument(touchEventName, function(evt){ ASPx.VirtualKeyboardUI.onTouchStart(evt); });
23183}
23184ASPx.Evt.AttachEventToDocument("mousedown", function(evt) {
23185 var editor = ASPx.GetFocusedEditor();
23186 if(!editor) 
23187  return;
23188 var evtSource = ASPx.Evt.GetEventSource(evt);
23189 if(editor.IsClearButtonElement(evtSource))
23190  return;
23191 if(editor.OwnerDateEdit && editor.OwnerDateEdit.GetShowTimeSection()) {
23192  editor.OwnerDateEdit.ForceRefocusTimeSectionTimeEdit(evtSource);
23193  return;
23194 }
23195 if(editor.ownerListBox && editor.ownerListBox.IsEditorElement(evtSource) && !editor.IsEditorElement(evtSource)) {
23196  editor.ownerListBox.ForceRefocusEditor(evt);
23197  ASPx.SetFocusedEditor(editor.ownerListBox);
23198  return;
23199 }
23200 if(editor.IsEditorElement(evtSource) && !editor.IsElementBelongToInputElement(evtSource))
23201  editor.ForceRefocusEditor(evt);
23202});
23203ASPx.Evt.AttachEventToDocument(ASPx.Evt.GetMouseWheelEventName(), function(evt) {
23204 var editor = ASPx.GetFocusedEditor();
23205 if(editor != null && ASPx.IsExistsElement(editor.GetMainElement()) && editor.focused && editor.receiveGlobalMouseWheel)
23206  editor.OnMouseWheel(evt);
23207});
23208ASPx.KBSIKeyDown = function(name, evt){
23209 var control = ASPx.GetControlCollection().Get(name);
23210 if(control != null){
23211  var isProcessed = control.OnSpecialKeyDown(evt);
23212  if(isProcessed)
23213   return ASPx.Evt.PreventEventAndBubble(evt);
23214 }
23215};
23216ASPx.KBSIKeyPress = function(name, evt){
23217 var control = ASPx.GetControlCollection().Get(name);
23218 if(control != null){
23219  var isProcessed = control.OnSpecialKeyPress(evt);
23220  if(isProcessed)
23221   return ASPx.Evt.PreventEventAndBubble(evt);
23222 }
23223};
23224ASPx.KBSIKeyUp = function(name, evt){
23225 var control = ASPx.GetControlCollection().Get(name);
23226 if(control != null){
23227  var isProcessed = control.OnSpecialKeyUp(evt);
23228  if(isProcessed)
23229   return ASPx.Evt.PreventEventAndBubble(evt);
23230 }
23231};
23232ASPx.ClearProcessingProc = function(edit) {
23233 return edit.Clear();
23234};
23235ASPx.ValidateProcessingProc = function(edit) {
23236 edit.OnValidation(ValidationType.MassValidation);
23237 return edit.GetIsValid();
23238};
23239ASPx.EditorsValidProcessingProc = function(edit) {
23240 return edit.GetIsValid();
23241};
23242var CheckEditElementHelper = ASPx.CreateClass(ASPx.CheckableElementHelper, {
23243 AttachToMainElement: function(internalCheckBox) {
23244  ASPx.CheckableElementHelper.prototype.AttachToMainElement.call(this, internalCheckBox);
23245  this.AttachToLabelElement(this.GetLabelElement(internalCheckBox.container), internalCheckBox);
23246 },
23247 AttachToLabelElement: function(labelElement, internalCheckBox) {
23248  var _this = this;
23249  if(labelElement) {
23250   ASPx.Evt.AttachEventToElement(labelElement, "click", 
23251    function (evt) { 
23252     _this.InvokeClick(internalCheckBox, evt);
23253    }
23254   );
23255   ASPx.Evt.AttachEventToElement(labelElement, "mousedown",
23256    function (evt) {
23257     internalCheckBox.Refocus();
23258    }
23259   );
23260  }
23261 },
23262 GetLabelElement: function(container) {
23263  var labelElement = ASPx.GetNodeByTagName(container, "LABEL", 0);
23264  if(!labelElement) {
23265   var labelCell = ASPx.GetNodeByClassName(container, "dxichTextCellSys", 0);
23266   labelElement = ASPx.GetNodeByTagName(labelCell, "SPAN", 0);
23267  }
23268  return labelElement;
23269 }
23270});
23271CheckEditElementHelper.Instance = new CheckEditElementHelper();
23272var CalendarSharedParameters = ASPx.CreateClass(null, {
23273 updateCalendarCallbackCommand: "UPDATE",
23274 constructor: function() {
23275  this.minDate = null;
23276  this.maxDate = null;
23277  this.disabledDates = [];
23278  this.calendarCustomDraw = false;
23279  this.hasCustomDisabledDatesViaCallback = false;
23280  this.dateRangeMode = false;
23281  this.currentDateEdit = null;
23282  this.DaysSelectingOnMouseOver = new ASPxClientEvent();
23283  this.VisibleDaysMouseOut = new ASPxClientEvent();
23284  this.CalendarSelectionChangedInternal = new ASPxClientEvent();
23285 },
23286 Assign: function(source) {
23287  this.minDate = source.minDate ? source.minDate : null;
23288  this.maxDate = source.maxDate ? source.maxDate : null;
23289  this.calendarCustomDraw = source.calendarCustomDraw ? source.calendarCustomDraw : false;
23290  this.hasCustomDisabledDatesViaCallback = source.hasCustomDisabledDatesViaCallback ? source.hasCustomDisabledDatesViaCallback : false;
23291  this.disabledDates = source.disabledDates ? source.disabledDates : [];
23292  this.currentDateEdit = source.currentDateEdit ? source.currentDateEdit : null;
23293 },
23294 GetUpdateCallbackParameters: function() {
23295  var callbackArgs = this.GetCallbackArgs();
23296  callbackArgs = this.FormatCallbackArg(this.updateCalendarCallbackCommand, callbackArgs);
23297  return callbackArgs;
23298 },
23299 GetCallbackArgs: function() {
23300  var args = {};
23301  if(this.minDate)
23302   args.clientMinDate = ASPx.DateUtils.GetInvariantDateString(this.minDate);
23303  if(this.maxDate)
23304   args.clientMaxDate = ASPx.DateUtils.GetInvariantDateString(this.maxDate);
23305  if(args.clientMinDate || args.clientMaxDate) {
23306   var jsonArgs = JSON.stringify(args);
23307   return ASPx.Str.EncodeHtml(jsonArgs);
23308  }
23309  return null;
23310 },
23311 FormatCallbackArg: function(prefix, arg) {
23312  if(!arg) return prefix;
23313  return [prefix, '|', arg.length, ';', arg, ';'].join('');
23314 }
23315});
23316ASPx.CalendarSharedParameters = CalendarSharedParameters;
23317ASPx.ValidationType = ValidationType;
23318ASPx.ErrorFrameDisplay = ErrorFrameDisplay;
23319ASPx.EditElementSuffix = EditElementSuffix;
23320ASPx.ValidationPattern = ValidationPattern;
23321ASPx.RequiredFieldValidationPattern = RequiredFieldValidationPattern;
23322ASPx.RegularExpressionValidationPattern = RegularExpressionValidationPattern;
23323ASPx.CheckEditElementHelper = CheckEditElementHelper;
23324ASPx.IsEditorFocusable = _aspxIsEditorFocusable;
23325window.ASPxClientEditBase = ASPxClientEditBase;
23326window.ASPxClientEdit = ASPxClientEdit;
23327window.ASPxClientEditKeyEventArgs = ASPxClientEditKeyEventArgs;
23328window.ASPxClientEditValidationEventArgs = ASPxClientEditValidationEventArgs;
23329})();
23330
23331(function() {
23332ASPx.TEInputSuffix = "_I";
23333ASPx.PasteCheckInterval = 50;
23334ASPx.CheckUserInputInterval = 10;
23335ASPx.TEHelpTextElementSuffix = "_HTE";
23336var passwordInputClonedSuffix = "_CLND";
23337var memoMinHeight = 34;
23338var BrowserHelper = {
23339 SAFARI_SYSTEM_CLASS_NAME: "dxeSafariSys",
23340 MOBILE_SAFARI_SYSTEM_CLASS_NAME: "dxeIPadSys",
23341 GetBrowserSpecificSystemClassName: function() {
23342  if(ASPx.Browser.Safari)
23343   return ASPx.Browser.MacOSMobilePlatform ? this.MOBILE_SAFARI_SYSTEM_CLASS_NAME : this.SAFARI_SYSTEM_CLASS_NAME;
23344  return "";
23345 }
23346};
23347var focusedNullTextClassName = "dxeFNTextSys";
23348var NullTextDisplayMode = {
23349 Unfocused: "Unfocused",
23350 UnfocusedAndFocused: "UnfocusedAndFocused"
23351};
23352ASPx.NullTextDisplayMode = NullTextDisplayMode;
23353var ASPxClientTextEdit = ASPx.CreateClass(ASPxClientEdit, {
23354 constructor: function(name) {
23355  this.constructor.prototype.constructor.call(this, name);      
23356  this.isASPxClientTextEdit = true;
23357  this.nullText = "";
23358  this.nullTextDisplayMode = NullTextDisplayMode.Unfocused;
23359  this.nullTextOnFocusCssText = "";
23360  this.focusedNullTextTimerID = -1;
23361  this.escCount = 0;
23362  this.raiseValueChangedOnEnter = true;
23363  this.autoResizeWithContainer = false;
23364  this.lastChangedValue = null;
23365  this.autoCompleteAttribute = null;
23366  this.passwordNullTextIntervalID = -1;
23367  this.nullTextInputElement = null;
23368  this.helpText = "";
23369  this.helpTextObj = null;  
23370  this.helpTextStyle = [];
23371  this.externalTableStyle = [];
23372  this.helpTextPosition = ASPx.Position.Right;
23373  this.helpTextMargins = null;
23374  this.helpTextHAlign = ASPxClientTextEditHelpTextHAlign.Left;
23375  this.helpTextVAlign = ASPxClientTextEditHelpTextVAlign.Top;
23376  this.enableHelpTextPopupAnimation = true;
23377  this.helpTextDisplayMode = ASPxClientTextEditHelpTextDisplayMode.Inline;
23378  this.maskInfo = null;  
23379  this.maskValueBeforeUserInput = "";
23380  this.maskPasteTimerID = -1;
23381  this.maskPasteLock = false;    
23382  this.maskPasteCounter = 0;
23383  this.maskTextBeforePaste = "";    
23384  this.maskHintHtml = "";
23385  this.maskHintTimerID = -1;
23386  this.maskedEditorClickEventHandlers = [];
23387  this.errorCellPosition = ASPx.Position.Right;
23388  this.inlineInitializeInputValue = null;
23389  this.initializeInputValue = null;
23390  this.displayFormat = null;
23391  this.TextChanged = new ASPxClientEvent();
23392  this.UserInput = new ASPxClientEvent();
23393  this.userInputEventTimerID = -1;
23394 },
23395 SetData: function(data){
23396  ASPxClientEdit.prototype.SetData.call(this, data);
23397  if(data.maskInfo) {
23398   var maskProperties = data.maskInfo.properties;
23399   var useInvariantCultureDecimalSymbol = maskProperties && maskProperties.useInvariantCultureDecimalSymbol || false;
23400   this.maskInfo = ASPx.MaskInfo.Create(data.maskInfo.maskText, data.maskInfo.dateTimeOnly, data.maskInfo.allowEscapingInEnums, useInvariantCultureDecimalSymbol);
23401   this.SetProperties(data.maskInfo.properties, this.maskInfo);
23402  }
23403 },
23404 InlineInitialize: function() {
23405  this.SaveInputValue(true);
23406  ASPxClientEdit.prototype.InlineInitialize.call(this);
23407  if(this.maskInfo != null)
23408   this.InitMask();
23409  this.ApplyBrowserSpecificClassName();
23410  this.helpTextInitialize();
23411  if(ASPx.Browser.IE && ASPx.Browser.Version >= 10 && this.nullText != "")
23412   this.addIEXButtonEventHandler();
23413 },
23414 Initialize: function(){
23415  this.SaveInputValue(false);
23416  this.SaveChangedValue();
23417  ASPxClientEdit.prototype.Initialize.call(this);
23418  this.CorrectInputMaxLength();
23419  this.SubscribeToIeDropEvent();
23420  if(ASPx.Browser.WebKitFamily)  
23421   this.CorrectMainElementWhiteSpaceStyle();
23422  this.InitializeTextDecoration();
23423  this.InitializeAutocompleteAttribute();
23424  if(this.IsValueRestoredByBrowser())
23425   this.SynchronizeRestoredValue();
23426 },
23427 InitializeEvents: function() {
23428  ASPxClientEdit.prototype.InitializeEvents.call(this);
23429  ASPx.Evt.AttachEventToElement(this.GetInputElement(), "keydown", this.OnKeyDown.aspxBind(this));
23430  ASPx.Evt.AttachEventToElement(this.GetInputElement(), "keyup", this.OnKeyUp.aspxBind(this));
23431  ASPx.Evt.AttachEventToElement(this.GetInputElement(), "keypress", this.OnKeyPress.aspxBind(this));
23432  this.Unload.AddHandler(this.OnUnload.aspxBind(this));
23433 },
23434 InitializeTextDecoration: function() {
23435  if(this.GetInputElement().type == "password")
23436   this.ToggleTextDecoration();
23437 },
23438 InitializeAutocompleteAttribute: function() {
23439  var input = this.GetInputElement();
23440  if(this.IsVCardAttributeRequired())
23441   ASPx.Attr.SetAttribute(input, this.autoCompleteAttribute.name, this.autoCompleteAttribute.value);
23442  else if(this.IsAutocompleteOffRequiredOnInitialize())
23443   ASPx.Attr.SetAttribute(input, "autocomplete", "off");
23444 },
23445 SaveInputValue: function(isInlineInitialize) {
23446  var input = this.GetInputElement();
23447  if(!input)
23448   return;
23449  var inputValue = input.value;
23450  if(inputValue === null)
23451   inputValue = "";
23452  if(isInlineInitialize)
23453   this.inlineInitializeInputValue = inputValue;
23454  else
23455   this.initializeInputValue = inputValue;
23456 },
23457 IsValueRestoredByBrowser: function() {
23458  if(this.displayFormat || this.isNative || this.inlineInitializeInputValue === null || this.initializeInputValue === null)
23459   return false;
23460  if(ASPx.Browser.Chrome)
23461   return this.IsValueRestoredByChrome();
23462  else if(ASPx.Browser.Firefox)
23463   return this.IsValueRestoredByFirefox();
23464  else if(ASPx.Browser.IE)
23465   return this.IsValueRestoredByIE();
23466  else
23467   return this.IsValueRestoredByBrowserCore();
23468 },
23469 IsValueRestoredByBrowserCore: function() {
23470  return this.IsValueChangedBeforeInitialize() || this.IsClientValueNotExists() || this.IsValueChangedOnMaskInitialize();
23471 },
23472 IsValueRestoredByChrome: function() {
23473  return this.IsValueRestoredByBrowserCore();
23474 },
23475 IsValueRestoredByFirefox: function() {
23476  return this.IsValueRestoredByBrowserCore();
23477 },
23478 IsValueRestoredByIE: function() {
23479  return this.IsValueRestoredByBrowserCore();
23480 },
23481 IsValueChangedBeforeInitialize: function() {
23482  return this.inlineInitializeInputValue !== this.initializeInputValue;
23483 },
23484 IsClientValueNotExists: function() {
23485  return this.inlineInitializeInputValue !== "" &&
23486      this.inlineInitializeInputValue !== this.nullText &&
23487      this.inlineInitializeInputValue !== this.GetValue() &&
23488      this.inlineInitializeInputValue !== this.GetText();
23489 },
23490 IsValueChangedOnMaskInitialize: function() {
23491  return this.maskInfo && this.inlineInitializeInputValue !== this.GetInputElement().value;
23492 },
23493 SynchronizeRestoredValue: function() {
23494  this.SetText(this.initializeInputValue);
23495 },
23496 AdjustControl: function() {
23497  ASPxClientEdit.prototype.AdjustControl.call(this);
23498  if(ASPx.Browser.IE && ASPx.Browser.Version > 8 && !this.isNative)
23499   this.correctInputElementHeight();
23500  this.ensureAdjustFocusedNullTextElement();
23501 },
23502 correctInputElementHeight: function() {
23503  var mainElement = this.GetMainElement();
23504  if(mainElement) {
23505   var mainElementHeight = mainElement.style.height;
23506   var mainElementHeightSpecified = mainElementHeight && mainElementHeight.indexOf('px') !== -1; 
23507   if(mainElementHeightSpecified) {
23508    var inputElement = this.GetInputElement();
23509    var inputElementHeight = this.getInputElementHeight();
23510    inputElement.style.height = inputElementHeight + "px";
23511    if(!ASPx.Ident.IsASPxClientMemo(this))
23512     inputElement.style.lineHeight = inputElementHeight + "px";
23513   }
23514  }
23515 },
23516 getInputElementHeight: function() {
23517  var mainElement = this.GetMainElement(),
23518   inputElement = this.GetInputElement();
23519  var inputElementHeight = ASPx.PxToInt(mainElement.style.height) - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(mainElement);
23520  var inputElementContainer = inputElement.parentNode,
23521   inputContainerStyle = ASPx.GetCurrentStyle(inputElementContainer);
23522  inputElementHeight -= ASPx.GetTopBottomBordersAndPaddingsSummaryValue(inputElementContainer, inputContainerStyle) 
23523   + ASPx.GetTopBottomMargins(inputElementContainer, inputContainerStyle);
23524  var mainElementCellspacing = ASPx.GetCellSpacing(mainElement);
23525  if(mainElementCellspacing)
23526   inputElementHeight -= mainElementCellspacing * 2;
23527  var inputStyle = ASPx.GetCurrentStyle(inputElement);
23528  inputElementHeight -= ASPx.GetTopBottomBordersAndPaddingsSummaryValue(inputElement, inputStyle) 
23529   + ASPx.GetTopBottomMargins(inputElement, inputStyle);
23530  return inputElementHeight;
23531 },
23532 addIEXButtonEventHandler: function() {
23533  var inputElement = this.GetInputElement();
23534  if(ASPx.IsExists(inputElement)) {
23535   this.isDeleteOrBackspaceKeyClick = false;
23536   ASPx.Evt.AttachEventToElement(inputElement, "input", function (evt) {
23537    if(this.isDeleteOrBackspaceKeyClick) {
23538     this.isDeleteOrBackspaceKeyClick = false;
23539     return;
23540    }
23541    if(inputElement.value === '') {
23542     this.SyncRawValue();
23543    }
23544   }.aspxBind(this));
23545   ASPx.Evt.AttachEventToElement(inputElement, "keydown", function (evt) {
23546    this.isDeleteOrBackspaceKeyClick = (evt.keyCode == ASPx.Key.Delete || evt.keyCode == ASPx.Key.Backspace);
23547   }.aspxBind(this));
23548  }   
23549 },
23550 ensureOutOfRangeWarningManager: function (minValue, maxValue, defaultMinValue, defaultMaxValue, valueFormatter) {
23551  if (!this.outOfRangeWarningManager)
23552   this.outOfRangeWarningManager = new ASPxOutOfRangeWarningManager(this, minValue, maxValue, defaultMinValue, defaultMaxValue,
23553    this.showOutOfRangeWarningElementAtBottom() ? ASPx.Position.Bottom : ASPx.Position.Right, valueFormatter);
23554 },
23555 showOutOfRangeWarningElementAtBottom: function() {
23556  return this.hasRightPopupHelpText();
23557 },
23558 GetOutOfRangeWarningElementPrevSibling: function() {
23559  return this.GetMainElement();
23560 },
23561 helpTextInitialize: function () {
23562  if(this.helpText) {
23563   this.helpTextObj = new ASPxClientTextEditHelpText(this, this.helpTextStyle, this.helpText, this.helpTextPosition,
23564    this.helpTextHAlign, this.helpTextVAlign, this.helpTextMargins, this.enableHelpTextPopupAnimation, this.helpTextDisplayMode);
23565  }
23566 },
23567 hasPopupHelpText: function() {
23568  return this.helpText && this.helpTextDisplayMode === ASPxClientTextEditHelpTextDisplayMode.Popup;
23569 },
23570 hasRightPopupHelpText: function() {
23571  return this.hasPopupHelpText() && this.helpTextPosition === ASPx.Position.Right;
23572 },
23573 showHelpText: function () {
23574  if(this.helpTextObj)
23575   this.helpTextObj.show();
23576 },
23577 hideHelpText: function () {
23578  if(this.helpTextObj)
23579   this.helpTextObj.hide();
23580 },
23581 ApplyBrowserSpecificClassName: function() {
23582  var mainElement = this.GetMainElement();
23583  if(ASPx.IsExistsElement(mainElement)) {
23584   var className = BrowserHelper.GetBrowserSpecificSystemClassName();
23585   if(className)
23586    mainElement.className += " " + className;
23587  }
23588 },
23589  CorrectMainElementWhiteSpaceStyle: function() {
23590  var inputElement = this.GetInputElement();
23591  if(inputElement && inputElement.parentNode) {
23592   if(this.IsElementHasWhiteSpaceStyle(inputElement.parentNode))
23593    inputElement.parentNode.style.whiteSpace = "normal";
23594  }
23595 },
23596 IsElementHasWhiteSpaceStyle: function(element) {
23597  var currentStyle = ASPx.GetCurrentStyle(element);
23598  return currentStyle.whiteSpace == "nowrap" || currentStyle.whiteSpace == "pre";  
23599 },
23600 FindInputElement: function(){
23601  return this.isNative ? this.GetMainElement() : ASPx.GetElementById(this.name + ASPx.TEInputSuffix);
23602 },
23603 DecodeRawInputValue: function(value) {
23604  return value;
23605 },
23606 GetRawValue: function(value){
23607  return ASPx.IsExists(this.stateObject) ? this.stateObject.rawValue : null;
23608 },
23609 SetRawValue: function(value){
23610  if(ASPx.IsExists(value))
23611   value = value.toString();
23612  this.UpdateStateObjectWithObject({ rawValue: value });
23613 },
23614 SyncRawValue: function() {
23615  if(this.maskInfo != null)
23616   this.SetRawValue(this.maskInfo.GetValue(true));
23617  else
23618   this.SetRawValue(this.GetInputElement().value);
23619 },
23620 HasTextDecorators: function() {
23621  return this.nullText != "" || this.displayFormat != null;
23622 },
23623 CanApplyTextDecorators: function(){
23624  return !this.focused;
23625 },
23626 CreateStyleDecoration: function () {
23627  return new ASPx.TextEditorStyleDecoration(this);
23628 },
23629 CanApplyNullTextDecoration: function() {
23630  var value = this.GetValue();
23631  return this.IsNull(value);
23632 },
23633 GetDecoratedText: function(value) {
23634  var result = value;
23635  if(this.IsNull(value) && this.nullText != "" && this.CanApplyNullTextDecoration())
23636   result = this.nullText;
23637  else if(this.displayFormat != null)
23638   result = this.GetDisplayFormatText(value);
23639  else if(this.maskInfo != null)
23640   result = this.maskInfo.GetText();
23641  else if(value == null)
23642   result = "";
23643  return result;
23644 },
23645 GetDisplayFormatText: function(value) {
23646  return ASPx.Formatter.Format(this.displayFormat, value);
23647 },
23648 ToggleTextDecoration: function() {
23649  if(this.HasTextDecorators()) {
23650   if(this.focused) {
23651    var input = this.GetInputElement();
23652    var oldValue = input.value;
23653    var sel = ASPx.Selection.GetExtInfo(input);
23654    this.ToggleTextDecorationCore();
23655    this.ensureActivateFocusedNullTextMechanism();
23656    if(oldValue != input.value || !ASPx.Selection.AreEqual(sel, ASPx.Selection.GetExtInfo(input))) {
23657     if(sel.startPos == 0 && sel.endPos == oldValue.length)
23658      sel.endPos = input.value.length;
23659     else
23660      sel.endPos = sel.startPos;
23661     if(!this.accessibilityCompliant || ASPx.GetActiveElement() == input)
23662      this.SetSelectionOnToggleTextDecoration(input, sel);
23663    }
23664   } else {
23665    this.ToggleTextDecorationCore();
23666    this.ensureDeactivateFocusedNullTextMechanism();
23667   }
23668  }
23669 },
23670 SetSelectionOnToggleTextDecoration: function(input, sel) {
23671  ASPx.Selection.Set(input, sel.startPos, sel.endPos);
23672 },
23673 ToggleTextDecorationCore: function() {
23674  if(this.maskInfo != null) {   
23675   this.ApplyMaskInfo(false);
23676  } else {
23677   var input = this.GetInputElement();
23678   var rawValue = this.GetRawValue();
23679   var value = this.CanApplyTextDecorators() ? this.GetDecoratedText(rawValue) : rawValue;
23680   if(input.value != value) {
23681    if(input.type == "password")
23682     this.TogglePasswordInputTextDecoration(value);
23683    else
23684     input.value = value;
23685   }
23686  }
23687 },
23688 GetPasswordNullTextInputElement: function() {
23689  if(!this.isPasswordNullTextInputElementExists())
23690   this.nullTextInputElement = this.createPasswordNullTextInputElement();
23691  return this.nullTextInputElement;
23692 },
23693 createPasswordNullTextInputElement: function() {
23694  var inputElement = this.GetInputElement(),
23695   nullTextInputElement = document.createElement("INPUT");
23696  nullTextInputElement.className = inputElement.className;
23697  nullTextInputElement.style.cssText = inputElement.style.cssText;
23698  nullTextInputElement.id = inputElement.id + passwordInputClonedSuffix;
23699  nullTextInputElement.type = "text";
23700  if(ASPx.IsExists(inputElement.tabIndex))
23701   nullTextInputElement.tabIndex = inputElement.tabIndex;
23702  var onFocusEventHandler = function() {
23703   var inputElement = this.GetInputElement(),
23704    nullTextInputElement = this.GetPasswordNullTextInputElement();
23705   if(inputElement) {
23706    this.LockFocusEvents();  
23707    ASPx.SetElementDisplay(inputElement, true);
23708    inputElement.focus();
23709    ASPx.SetElementDisplay(nullTextInputElement, false);
23710    this.ensureAdjustFocusedNullTextElement();
23711    this.ReplaceAssociatedIdInLabels(nullTextInputElement.id, inputElement.id);
23712   }
23713  }.aspxBind(this);
23714  ASPx.Evt.AttachEventToElement(nullTextInputElement, "focus", onFocusEventHandler);
23715  return nullTextInputElement;
23716 },
23717 isPasswordNullTextInputElementExists: function() {
23718  return ASPx.IsExistsElement(this.nullTextInputElement);
23719 },
23720 TogglePasswordNullTextTimeoutChecker: function() {
23721  if(this.passwordNullTextIntervalID < 0) {
23722   var timeoutChecker = function() {
23723    var inputElement = this.GetInputElement();
23724    if(ASPx.GetControlCollection().GetByName(this.name) !== this || inputElement == null) {
23725     window.clearTimeout(this.passwordNullTextIntervalID);
23726     this.passwordNullTextIntervalID = -1;
23727     return;
23728    } else {
23729     if(!this.focused) {
23730      var passwordNullTextInputElement = this.GetPasswordNullTextInputElement();
23731      if(passwordNullTextInputElement.value != this.nullText && inputElement.value == "") { 
23732       passwordNullTextInputElement.value = this.nullText;
23733       this.SetValue(null);
23734      }
23735      if(inputElement.value != "") {
23736       if(inputElement.style.display == "none") {
23737        this.SetValue(inputElement.value);
23738        this.UnhidePasswordInput();
23739       }
23740      } else {
23741       if(inputElement.style.display != "none") {
23742        this.SetValue(null);
23743        this.HidePasswordInput();
23744       }
23745      }
23746     }
23747    }
23748   }.aspxBind(this);
23749   timeoutChecker(); 
23750   this.passwordNullTextIntervalID = window.setInterval(timeoutChecker, 100);
23751  }
23752 },
23753 TogglePasswordInputTextDecoration: function(value) {
23754  var inputElement = this.GetInputElement();
23755  var nullTextInputElement = this.GetPasswordNullTextInputElement();
23756  nullTextInputElement.value = value;
23757  var parentNode = inputElement.parentNode;
23758  if(ASPx.Data.ArrayIndexOf(parentNode.childNodes, nullTextInputElement) < 0) {
23759   ASPx.Attr.ChangeStyleAttribute(nullTextInputElement, "display", "none");
23760   parentNode.appendChild(nullTextInputElement);
23761  }
23762  this.HidePasswordInput();
23763  this.TogglePasswordNullTextTimeoutChecker();
23764 },
23765 HidePasswordInput: function() {
23766  ASPx.Attr.ChangeStyleAttribute(this.GetInputElement(), "display", "none");
23767  ASPx.Attr.ChangeStyleAttribute(this.GetPasswordNullTextInputElement(), "display", "");
23768  this.ReplaceAssociatedIdInLabels(this.GetInputElement().id, this.GetPasswordNullTextInputElement().id);
23769 },
23770 UnhidePasswordInput: function() {
23771  ASPx.Attr.ChangeStyleAttribute(this.GetInputElement(), "display", "");
23772  ASPx.Attr.ChangeStyleAttribute(this.GetPasswordNullTextInputElement(), "display", "none");
23773  this.ReplaceAssociatedIdInLabels(this.GetPasswordNullTextInputElement().id, this.GetInputElement().id);
23774 },
23775 ReplaceAssociatedIdInLabels: function(oldId, newId) {
23776  var labels = document.getElementsByTagName("LABEL");
23777  for(var i = 0; i < labels.length; i++) {
23778   if(labels[i].attributes["for"] && labels[i].attributes["for"].value == oldId)
23779    labels[i].attributes["for"].value = newId;
23780  }
23781 },
23782 GetFormattedText: function() {
23783  var value = this.GetValue();
23784  if(this.IsNull(value) && this.nullText != "")
23785   return this.GetText();
23786  return this.GetDecoratedText(value);
23787 },
23788 IsNull: function(value) {
23789  return value == null || value === "";
23790 },
23791 PopulateStyleDecorationPostfixes: function() {
23792  ASPxClientEdit.prototype.PopulateStyleDecorationPostfixes.call(this);
23793  this.styleDecoration.AddPostfix(ASPx.TEInputSuffix);
23794 },
23795 GetValue: function() {
23796  var value = null;
23797  if(this.maskInfo != null)
23798   value = this.maskInfo.GetValue();
23799  else if(this.HasTextDecorators())
23800   value = this.GetRawValue();
23801  else {
23802   var input = this.GetInputElement();
23803   value = input ? input.value : null;
23804  }
23805  return (value == "" && this.convertEmptyStringToNull) ? null : value;
23806 },
23807 SetValue: function(value) {
23808  if(value == null || value === undefined) 
23809   value = "";
23810  if(this.maskInfo != null) {
23811   this.maskInfo.SetValue(value.toString());
23812   this.ApplyMaskInfo(false);
23813   this.SavePrevMaskValue();
23814  } 
23815  else if(this.HasTextDecorators()) {
23816   this.SetRawValue(value);
23817   this.GetInputElement().value = this.CanApplyTextDecorators() && this.GetInputElement().type != "password" ? this.GetDecoratedText(value) : value;
23818  }
23819  else
23820   this.GetInputElement().value = value;
23821  this.UpdateStyleDecorations(); 
23822  this.SaveChangedValue();   
23823 },
23824 SetVisible: function(visible) {
23825  ASPxClientEdit.prototype.SetVisible.call(this, visible);
23826  if(this.helpTextDisplayMode === ASPxClientTextEditHelpTextDisplayMode.Inline) {
23827   if(visible)
23828    this.showHelpText();
23829   else
23830    this.hideHelpText();
23831  }
23832 },
23833 UnstretchInputElement: function(){
23834  var inputElement = this.GetInputElement();
23835  var mainElement = this.GetMainElement();
23836  var mainElementCurStyle = ASPx.GetCurrentStyle(mainElement);
23837  if(ASPx.IsExistsElement(mainElement) && ASPx.IsExistsElement(inputElement) && ASPx.IsExists(mainElementCurStyle) && 
23838   inputElement.style.width == "100%" &&
23839   (mainElementCurStyle.width == "" || mainElementCurStyle.width == "auto"))
23840   inputElement.style.width = "";
23841 },
23842 RestoreActiveElement: function(activeElement) {
23843  if(activeElement && activeElement.setActive && activeElement.tagName != "IFRAME")
23844   activeElement.setActive();
23845 },
23846 RaiseValueChangedEvent: function() {
23847  var processOnServer = ASPxClientEdit.prototype.RaiseValueChangedEvent.call(this);
23848  processOnServer = this.RaiseTextChanged(processOnServer);
23849  return processOnServer;
23850 },
23851 InitMask: function() {
23852  var rawValue = this.GetRawValue();
23853  this.SetValue(rawValue.length ? this.DecodeRawInputValue(rawValue) : this.maskInfo.GetValue());
23854  this.validationPatterns.unshift(new MaskValidationPattern(this.maskInfo.errorText, this.maskInfo));
23855 },
23856 SetMaskPasteTimer: function() {
23857  this.ClearMaskPasteTimer();
23858  this.maskPasteTimerID = ASPx.Timer.SetControlBoundInterval(this.MaskPasteTimerProc, this, ASPx.PasteCheckInterval);
23859 },
23860 ClearMaskPasteTimer: function() {
23861  this.maskPasteTimerID = ASPx.Timer.ClearInterval(this.maskPasteTimerID);
23862 },
23863 SavePrevMaskValue: function() {
23864  this.maskValueBeforeUserInput = this.maskInfo.GetValue();
23865 },
23866 FillMaskInfo: function() {
23867  var input = this.GetInputElement();
23868  if(!input) return; 
23869  var sel = ASPx.Selection.GetInfo(input);
23870  this.maskInfo.SetCaret(sel.startPos, sel.endPos - sel.startPos);  
23871 },
23872 ApplyMaskInfo: function(applyCaret) {
23873  this.SyncRawValue();
23874  var input = this.GetInputElement();
23875  var text = this.GetMaskDisplayText();
23876  this.maskTextBeforePaste = text;
23877  if(input.value != text)
23878   input.value = text;
23879  if(applyCaret)
23880   ASPx.Selection.Set(input, this.maskInfo.caretPos, this.maskInfo.caretPos + this.maskInfo.selectionLength);
23881 },
23882 GetMaskDisplayText: function() {
23883  if(!this.focused && this.HasTextDecorators())
23884   return this.GetDecoratedText(this.maskInfo.GetValue());
23885  return this.maskInfo.GetText();
23886 },
23887 ShouldCancelMaskKeyProcessing: function(htmlEvent, keyDownInfo) {
23888  return ASPx.Evt.IsEventPrevented(htmlEvent);
23889 }, 
23890 HandleMaskKeyDown: function(evt) {
23891  var keyInfo = ASPx.MaskManager.CreateKeyInfoByEvent(evt);
23892  ASPx.MaskManager.keyCancelled = this.ShouldCancelMaskKeyProcessing(evt, keyInfo);
23893  if(ASPx.MaskManager.keyCancelled) {
23894   ASPx.Evt.PreventEvent(evt);
23895   return;
23896  }
23897  this.maskPasteLock = true;
23898  this.FillMaskInfo();  
23899  var canHandle = ASPx.MaskManager.CanHandleControlKey(keyInfo);   
23900  ASPx.MaskManager.savedKeyDownKeyInfo = keyInfo;
23901  if(canHandle) {   
23902   ASPx.MaskManager.OnKeyDown(this.maskInfo, keyInfo);
23903   this.ApplyMaskInfo(true);
23904   ASPx.Evt.PreventEvent(evt);
23905  }
23906  ASPx.MaskManager.keyDownHandled = canHandle;
23907  this.maskPasteLock = false;
23908  this.UpdateMaskHintHtml();
23909 },
23910 HandleMaskKeyPress: function(evt) {
23911  var keyInfo = ASPx.MaskManager.CreateKeyInfoByEvent(evt);
23912  ASPx.MaskManager.keyCancelled = ASPx.MaskManager.keyCancelled || this.ShouldCancelMaskKeyProcessing(evt, ASPx.MaskManager.savedKeyDownKeyInfo);
23913  if(ASPx.MaskManager.keyCancelled) {
23914   ASPx.Evt.PreventEvent(evt);
23915   return;
23916  }
23917  this.maskPasteLock = true;  
23918  var printable = ASPx.MaskManager.savedKeyDownKeyInfo != null && ASPx.MaskManager.IsPrintableKeyCode(ASPx.MaskManager.savedKeyDownKeyInfo);
23919  if(printable) {
23920   ASPx.MaskManager.OnKeyPress(this.maskInfo, keyInfo);
23921   this.ApplyMaskInfo(true);
23922  }
23923  if(printable || ASPx.MaskManager.keyDownHandled)   
23924   ASPx.Evt.PreventEvent(evt); 
23925  this.maskPasteLock = false;
23926  this.UpdateMaskHintHtml();
23927 },
23928 MaskPasteTimerProc: function() {
23929  if(this.maskPasteLock || !this.maskInfo) return;
23930  this.maskPasteCounter++;
23931  var inputElement = this.inputElement;
23932  if(!inputElement || this.maskPasteCounter > 40) {
23933   this.maskPasteCounter = 0;
23934   inputElement = this.GetInputElement();
23935   if(!ASPx.IsExistsElement(inputElement)) {
23936    this.ClearMaskPasteTimer();
23937    return;
23938   }
23939  }
23940  if(this.maskTextBeforePaste !== inputElement.value)
23941   this.ProcessInputValueChangedOnTimer();
23942  if(!this.focused)
23943   this.ClearMaskPasteTimer();
23944 }, 
23945 ProcessInputValueChangedOnTimer: function() {
23946  var inputElement = this.inputElement;
23947  var selectionInfo = ASPx.Selection.GetInfo(inputElement);
23948  var startCaretPosition = selectionInfo.startPos;
23949  var endCaretPosition = selectionInfo.endPos;
23950  var oldText = this.maskTextBeforePaste;
23951  var newText = inputElement.value;
23952  var isAndroidBackSpacePressed = this.isAndroidBackSpacePressed(oldText, newText, startCaretPosition, endCaretPosition);
23953  var isLastTypedCharacter = newText.indexOf(oldText) == 0 && newText.length > oldText.length;
23954  if(isAndroidBackSpacePressed || isLastTypedCharacter) {
23955   this.SetText(newText);
23956   this.SetCaretPosition(endCaretPosition);
23957  } else {
23958   this.maskInfo.ProcessPaste(newText, endCaretPosition);
23959   this.ApplyMaskInfo(true);
23960  }
23961 },
23962 isAndroidBackSpacePressed: function(oldText, newText, startCaretPosition, endCaretPosition) {
23963  if(!ASPx.Browser.AndroidMobilePlatform || startCaretPosition !== endCaretPosition || newText.length >= oldText.length)
23964   return false;
23965  var startSubstring = newText.substring(0, startCaretPosition);
23966  var endSubstring = newText.substring(startCaretPosition);
23967  var isStartSubstringMatches = oldText.indexOf(startSubstring) == 0;
23968  var isEndSubstringMatches = endSubstring == "" || oldText.lastIndexOf(endSubstring) == oldText.length - endSubstring.length;
23969  return isStartSubstringMatches && isEndSubstringMatches;
23970 },
23971 BeginShowMaskHint: function() {  
23972  if(!this.readOnly && this.maskHintTimerID == -1)
23973   this.maskHintTimerID = window.setInterval(ASPx.MaskHintTimerProc, 500);
23974 },
23975 EndShowMaskHint: function() {
23976  window.clearInterval(this.maskHintTimerID);
23977  this.maskHintTimerID = -1;
23978 },
23979 MaskHintTimerProc: function() {  
23980  if(this.maskInfo) {
23981   this.FillMaskInfo();
23982   this.UpdateMaskHintHtml();
23983  } else {
23984   this.EndShowMaskHint();
23985  }
23986 },
23987 UpdateMaskHintHtml: function() {  
23988  var hint =  this.GetMaskHintElement();
23989  if(!ASPx.IsExistsElement(hint))
23990   return;
23991  var html = ASPx.MaskManager.GetHintHtml(this.maskInfo);
23992  if(html == this.maskHintHtml)
23993   return;
23994  if(html != "") {
23995   var mainElement = this.GetMainElement();
23996   if(ASPx.IsExistsElement(mainElement)) {
23997    hint.innerHTML = html;
23998    hint.style.position = "absolute";  
23999    hint.style.left = ASPx.PrepareClientPosForElement(ASPx.GetAbsoluteX(mainElement), mainElement, true) + "px";
24000    hint.style.top = (ASPx.PrepareClientPosForElement(ASPx.GetAbsoluteY(mainElement), mainElement, false) + mainElement.offsetHeight + 2) + "px";
24001    hint.style.display = "block";    
24002   }   
24003  } else {
24004   hint.style.display = "none";
24005  }
24006  this.maskHintHtml = html;
24007 },
24008 HideMaskHint: function() {
24009  var hint =  this.GetMaskHintElement();
24010  if(ASPx.IsExistsElement(hint))
24011   hint.style.display = "none";
24012  this.maskHintHtml = "";
24013 },
24014 GetMaskHintElement: function() {
24015  return ASPx.GetElementById(this.name + "_MaskHint");
24016 },
24017 OnFocus: function() {
24018  if (this.maskInfo != null && !ASPx.GetControlCollection().InCallback()) {
24019   this.TrySetCursorToStartPosition();
24020   this.SetMaskPasteTimer();
24021  }
24022  if(this.IsAutocompleteDropDownListRequiredOnFocus())
24023   ASPx.Attr.RemoveAttribute(this.GetInputElement(), "autocomplete");
24024  ASPxClientEdit.prototype.OnFocus.call(this);
24025 },
24026 OnLostFocus: function() {
24027  if(this.IsAutocompleteOffRequiredOnLostFocus())
24028   ASPx.Attr.SetAttribute(this.GetInputElement(), "autocomplete", "off");
24029  ASPxClientEdit.prototype.OnLostFocus.call(this);
24030 },
24031 OnMouseWheel: function(evt){
24032  if(this.readOnly || this.maskInfo == null) return;
24033  this.FillMaskInfo();
24034  ASPx.MaskManager.OnMouseWheel(this.maskInfo, ASPx.Evt.GetWheelDelta(evt) < 0 ? -1 : 1);
24035  this.ApplyMaskInfo(true);
24036  ASPx.Evt.PreventEvent(evt);
24037  this.UpdateMaskHintHtml();
24038 }, 
24039 OnBrowserWindowResize: function(e) {
24040  if(!this.autoResizeWithContainer)
24041   this.AdjustControl();
24042 },
24043 IsValueChanged: function() {
24044  return this.GetValue() != this.lastChangedValue; 
24045 },
24046 OnKeyDown: function(evt) {        
24047  if(this.NeedPreventBrowserUndoBehaviour(evt))
24048   return ASPx.Evt.PreventEvent(evt);
24049  if(this.RequireHandleMaxlenManually()) {
24050   this.onKeyDownInputValue = this.GetInputElement().value;
24051   var selectionInfo = ASPx.Selection.GetExtInfo(this.GetInputElement());
24052   this.onKeyDownCursorPos = selectionInfo.startPos;
24053  }
24054  if(ASPx.Browser.IE && ASPx.Evt.GetKeyCode(evt) == ASPx.Key.Esc) {   
24055   if(++this.escCount > 1) {
24056    ASPx.Evt.PreventEvent(evt);
24057    return;
24058   }
24059  } else 
24060   this.escCount = 0;
24061  ASPxClientEdit.prototype.OnKeyDown.call(this, evt);
24062  if(!this.IsRaiseStandardOnChange(evt)) {
24063   if(!this.readOnly && this.maskInfo != null)
24064    this.HandleMaskKeyDown(evt);
24065  }
24066 },
24067 IsCtrlZ: function(evt) {
24068  return evt.ctrlKey && !evt.altKey && !evt.shiftKey && (ASPx.Evt.GetKeyCode(evt) == 122 || ASPx.Evt.GetKeyCode(evt) == 90);
24069 },
24070 NeedPreventBrowserUndoBehaviour: function(evt) {
24071  var inputElement = this.GetInputElement();
24072  return this.IsCtrlZ(evt) && !!inputElement && !inputElement.value;
24073 },
24074 OnKeyPress: function(evt) {
24075  ASPxClientEdit.prototype.OnKeyPress.call(this, evt);
24076  if(!this.readOnly && this.maskInfo != null && !this.IsRaiseStandardOnChange(evt))
24077   this.HandleMaskKeyPress(evt);
24078  if(this.NeedOnKeyEventEnd(evt, true))
24079   this.OnKeyEventEnd(evt);
24080 },
24081 OnKeyUp: function(evt) {
24082  if(ASPx.Browser.Firefox && !this.focused && ASPx.Evt.GetKeyCode(evt) === ASPx.Key.Tab)
24083   return;
24084  if(this.NeedOnKeyEventEnd(evt, false)) {
24085   var proccessNextCommingPress = ASPx.Evt.GetKeyCode(evt) === ASPx.Key.Alt; 
24086   this.OnKeyEventEnd(evt, proccessNextCommingPress);
24087  }
24088  if(this.RequireHandleMaxlenManually()) {
24089   var inputValueLength = this.GetInputElement().value.length;
24090   var maxLength = this.GetInputMaxLength();
24091   if(inputValueLength > maxLength && inputValueLength > this.onKeyDownInputValue.length) {
24092    this.GetInputElement().value = this.onKeyDownInputValue;
24093    this.SetCaretPosition(this.onKeyDownCursorPos);
24094   }
24095  }
24096  ASPxClientEdit.prototype.OnKeyUp.call(this, evt);
24097 },
24098 RequireHandleMaxlenManually: function() { 
24099  return ASPx.Browser.AndroidMobilePlatform && ASPx.Browser.SamsungAndroidDevice && ASPx.Browser.PlaformMajorVersion < 6 && this.GetInputMaxLength() !== -1;
24100 },
24101 GetInputMaxLength: function() {
24102  var input = this.GetInputElement();
24103  if(ASPx.Attr.IsExistsAttribute(input, "maxlength"))
24104   return input.maxLength;
24105  return -1;
24106 },
24107 NeedOnKeyEventEnd: function(evt, isKeyPress) { 
24108  var handleKeyPress = this.maskInfo != null && evt.keyCode == ASPx.Key.Enter;
24109  return handleKeyPress == isKeyPress;
24110 },
24111 OnKeyEventEnd: function(evt, withDelay){
24112  if(!this.readOnly) {
24113   if(this.IsRaiseStandardOnChange(evt))
24114    this.RaiseStandardOnChange();
24115   this.SyncRawValueIfHasTextDecorators(withDelay);
24116  }
24117 },
24118 SyncRawValueIfHasTextDecorators: function(withDelay) {
24119  if(this.HasTextDecorators()) {
24120   if(withDelay) {
24121    window.setTimeout(function() {
24122     this.SyncRawValue();
24123    }.aspxBind(this), 0);
24124   } else 
24125    this.SyncRawValue();
24126  }
24127 },
24128 IsRaiseStandardOnChange: function(evt){
24129  return !this.specialKeyboardHandlingUsed && this.raiseValueChangedOnEnter && evt.keyCode == ASPx.Key.Enter;
24130 },
24131 GetFocusSelectAction: function() {
24132  if (this.maskInfo)
24133   return this.maskInfo.IsEmpty() ? null : "start";
24134  return "all"; 
24135 },
24136 CorrectFocusWhenDisabled: function() {
24137  if(!this.GetEnabled()) {
24138   var inputElement = this.GetInputElement();
24139   if(inputElement)
24140    inputElement.blur();
24141   return true;
24142  }
24143  return false;
24144 },
24145 EnsureShowPopupHelpText: function() {
24146  if(this.helpTextDisplayMode === ASPxClientTextEditHelpTextDisplayMode.Popup)
24147   this.showHelpText();
24148 },
24149 EnsureHidePopupHelpText: function() {
24150  if(this.helpTextDisplayMode === ASPxClientTextEditHelpTextDisplayMode.Popup)
24151   this.hideHelpText();
24152 },
24153 OnFocusCore: function() {
24154  if(this.CorrectFocusWhenDisabled())
24155   return;
24156  var wasLocked = this.IsFocusEventsLocked();
24157  ASPxClientEdit.prototype.OnFocusCore.call(this);
24158  this.CorrectInputMaxLength(true);
24159  if(this.maskInfo != null) {
24160   this.SavePrevMaskValue();
24161   this.BeginShowMaskHint();
24162   this.AttachOnMouseClickIfNeeded();
24163  }
24164  if(!wasLocked) {
24165   this.ToggleTextDecoration();
24166   this.startUserInputEventTimerIfRequired();
24167  }
24168  if(this.isPasswordNullTextInputElementExists())
24169   setTimeout(function() { this.EnsureShowPopupHelpText(); }.aspxBind(this), 0);
24170  else
24171   this.EnsureShowPopupHelpText();
24172 },
24173 startUserInputEventTimerIfRequired: function () {
24174  if(!this.UserInput.IsEmpty() && this.userInputEventTimerID === -1) {
24175   this.prevInputValue = this.GetInputElement().value;
24176   this.userInputEventTimerID = ASPx.Timer.SetControlBoundInterval(this.processUserInputEventTimer, this, ASPx.CheckUserInputInterval);
24177  }
24178 },
24179 clearUserInputEventTimerIfRequired: function () {
24180  if (this.userInputEventTimerID !== -1)
24181   this.userInputEventTimerID = ASPx.Timer.ClearInterval(this.userInputEventTimerID);
24182 },
24183 processUserInputEventTimer: function() {
24184  var currentInputValue = this.GetInputElement().value;
24185  if(currentInputValue !== this.prevInputValue) {
24186   this.RaiseUserInput();
24187   this.prevInputValue = currentInputValue;
24188  }
24189 },
24190 ensureFocusedNullTextElement: function () {
24191  if(!this.focusedNullTextElement)
24192   this.createFocusedNullTextElement();
24193 },
24194 getFocusedNullTextElementClassName: function() {
24195  return focusedNullTextClassName;
24196 },
24197 getFocusedNullTextElementTagName: function() {
24198  return "INPUT";
24199 },
24200 getCopyFromInputElementStyles: function() {
24201  return [ "paddingLeft", "paddingTop", "paddingRight", "paddingBottom", "borderCollapse", "borderLeftWidth", "borderTopWidth", "borderRightWidth", "borderBottomWidth" ];
24202 },
24203 copyStylesFromInputElementToFocusedNullTextElement: function() {
24204  var input = this.GetInputElement();
24205  var inputStyle = ASPx.GetCurrentStyle(input);
24206  var stylesToCopy = this.getCopyFromInputElementStyles();
24207  for(var i = 0; i < stylesToCopy.length; i++)
24208   this.focusedNullTextElement.style[stylesToCopy[i]] = inputStyle[stylesToCopy[i]];
24209 },
24210 createFocusedNullTextElement: function() {
24211  this.focusedNullTextElement = document.createElement(this.getFocusedNullTextElementTagName());
24212  this.focusedNullTextElement.value = this.nullText;
24213  this.focusedNullTextElement.className = this.getFocusedNullTextElementClassName();
24214  this.focusedNullTextElement.tabIndex = -1;
24215  ASPx.SetElementDisplay(this.focusedNullTextElement, false);
24216  this.copyStylesFromInputElementToFocusedNullTextElement();
24217  if (this.nullTextOnFocusCssText) {
24218   var styleSheet = ASPx.GetCurrentStyleSheet();
24219   this.focusedNullTextElement.className += " " + ASPx.CreateImportantStyleRule(styleSheet, this.nullTextOnFocusCssText);
24220  }
24221  var inputElement = this.GetInputElement();
24222  inputElement.parentNode.insertBefore(this.focusedNullTextElement, inputElement.nextSibling);
24223 },
24224 ensureActivateFocusedNullTextMechanism: function() {
24225  if (this.nullTextDisplayMode === NullTextDisplayMode.UnfocusedAndFocused) {
24226   if(this.IsNull(this.GetValue()))
24227    this.changeFocusedNullTextElementVisibility(true);
24228   this.setFocusedNullTextTimer();
24229  }
24230 },
24231 ensureDeactivateFocusedNullTextMechanism: function () {
24232  if (this.nullTextDisplayMode === NullTextDisplayMode.UnfocusedAndFocused) {
24233   this.clearFocusedNullTextTimer();
24234   this.changeFocusedNullTextElementVisibility(false);
24235  }
24236 },
24237 setFocusedNullTextTimer: function () {
24238  if(this.focusedNullTextTimerID === -1)
24239   this.focusedNullTextTimerID = ASPx.Timer.SetControlBoundInterval(this.onFocusedNullTextVisibilityCheck, this, ASPx.PasteCheckInterval);
24240 },
24241 clearFocusedNullTextTimer: function () {
24242  this.focusedNullTextTimerID = ASPx.Timer.ClearInterval(this.focusedNullTextTimerID);
24243 },
24244 onFocusedNullTextVisibilityCheck: function (evt) {
24245  if(!this.needShowFocusedNullText() && this.isFocusedNullTextElementDisplayed())
24246   this.changeFocusedNullTextElementVisibility(false);
24247  else if(this.needShowFocusedNullText() && !this.isFocusedNullTextElementDisplayed())
24248   this.changeFocusedNullTextElementVisibility(true);
24249 },
24250 isFocusedNullTextElementDisplayed: function() {
24251  return this.focusedNullTextElement && ASPx.GetElementDisplay(this.focusedNullTextElement);
24252 },
24253 needShowFocusedNullText: function() {
24254  if(this.focusedNullTextTimerID === -1)
24255   return this.IsNull(this.GetValue());
24256  var result = this.GetInputElement().value === "";
24257  if(this.CanApplyNullTextDecoration)
24258   result = result && this.CanApplyNullTextDecoration();
24259  return result;
24260 }, 
24261 changeFocusedNullTextElementVisibility: function (visible) {
24262  this.ensureFocusedNullTextElement();
24263  ASPx.SetElementDisplay(this.focusedNullTextElement, visible);
24264  if(visible)
24265   this.adjustFocusedNullTextElement();  
24266 },
24267 getInputElementAbsoluteX: function(input) {
24268  var result = ASPx.GetAbsoluteX(input);
24269  if(ASPx.Browser.Opera || ASPx.Browser.AndroidMobilePlatform) 
24270   result++;
24271  return result;
24272 },
24273 getInputElementAbsoluteY: function (input) {
24274  var result = ASPx.GetAbsoluteY(input);
24275  if(ASPx.Browser.Opera || ASPx.Browser.AndroidMobilePlatform) 
24276   result++;
24277  return result;
24278 },
24279 adjustFocusedNullTextElement: function() {
24280  var input = this.GetInputElement();
24281  this.focusedNullTextElement.style.width = input.offsetWidth + "px";
24282  this.focusedNullTextElement.style.height = input.offsetHeight + "px";
24283  var inputXPos = this.getInputElementAbsoluteX(input);
24284  var inputYPos = this.getInputElementAbsoluteY(input);
24285  ASPx.SetAbsoluteX(this.focusedNullTextElement, inputXPos);
24286  ASPx.SetAbsoluteY(this.focusedNullTextElement, inputYPos);
24287  var shiftByX = inputXPos - ASPx.GetAbsoluteX(this.focusedNullTextElement);
24288  var shiftByY = inputYPos - ASPx.GetAbsoluteY(this.focusedNullTextElement);
24289  if (shiftByX !== 0)
24290   this.focusedNullTextElement.style.left = ASPx.PxToFloat(this.focusedNullTextElement.style.left) + shiftByX + "px";
24291  if (shiftByY !== 0)
24292   this.focusedNullTextElement.style.top = ASPx.PxToFloat(this.focusedNullTextElement.style.top) + shiftByY + "px";
24293 },
24294 ensureAdjustFocusedNullTextElement: function () {
24295  if(this.isFocusedNullTextElementDisplayed())
24296   this.adjustFocusedNullTextElement(this.focusedNullTextElement);
24297 },
24298 TrySetCursorToStartPosition: function() {
24299  var input = this.GetInputElement();
24300  var sel = ASPx.Selection.GetInfo(input);
24301  if (sel.startPos === sel.endPos && this.maskInfo.IsEmpty()) {
24302   var pos = this.maskInfo.GetFirstNonLiteralPosition();
24303   setTimeout(function() {
24304    if (document.activeElement === input)
24305     ASPx.Selection.SetCaretPosition(input, pos);
24306   }, 0);
24307  }
24308 },
24309 clearMaskedEditorClickEventHandlers: function () {
24310  for(var i = 0; i < this.maskedEditorClickEventHandlers.length; i++)
24311   ASPx.Evt.DetachEventFromElement(this.GetInputElement(), "click", this.maskedEditorClickEventHandlers[i]);
24312  this.maskedEditorClickEventHandlers = [];
24313 },
24314 addMaskedEditorClickEventHandler: function () {
24315  this.maskedEditorClickEventHandlers.push(this.MouseClickOnMaskedEditorFunc);
24316  ASPx.Evt.AttachEventToElement(this.GetInputElement(), "click", this.MouseClickOnMaskedEditorFunc);
24317 },
24318 AttachOnMouseClickIfNeeded: function () {
24319  this.clearMaskedEditorClickEventHandlers();
24320  if(this.GetValue() == "" || this.GetValue() == null) {
24321   this.MouseClickOnMaskedEditorFunc = function (e) {
24322    this.clearMaskedEditorClickEventHandlers();
24323    var selectionInfo = ASPx.Selection.GetExtInfo(this.GetInputElement());
24324    if(selectionInfo.startPos == selectionInfo.endPos)
24325     this.SetCaretPosition(this.GetInitialCaretPositionInEmptyMaskedInput());
24326   }.aspxBind(this);
24327   this.addMaskedEditorClickEventHandler();
24328  }
24329 },
24330 GetInitialCaretPositionInEmptyMaskedInput: function() {
24331  var maskParts = this.maskInfo.parts;
24332  return ASPx.MaskManager.IsLiteralPart(maskParts[0]) ? maskParts[0].GetSize() : 0;
24333 },
24334 OnLostFocusCore: function() {
24335  var wasLocked = this.IsFocusEventsLocked();
24336  ASPxClientEdit.prototype.OnLostFocusCore.call(this);
24337  this.CorrectInputMaxLength();
24338  if(this.maskInfo != null) {
24339   this.EndShowMaskHint();
24340   this.HideMaskHint();   
24341   if(this.maskInfo.ApplyFixes(null))
24342    this.ApplyMaskInfo(false);
24343   this.RaiseStandardOnChange();
24344  }
24345  if(!wasLocked) {
24346   this.clearUserInputEventTimerIfRequired();
24347   this.ToggleTextDecoration();
24348  }
24349  this.escCount = 0;
24350  this.EnsureHidePopupHelpText();
24351 },
24352 InputMaxLengthCorrectionRequired: function () {
24353  return ASPx.Browser.IE && ASPx.Browser.Version >= 10 && (!this.isNative || this.nullText != "");
24354 },
24355 CorrectInputMaxLength: function (onFocus) {
24356  if(this.InputMaxLengthCorrectionRequired()) {
24357   var input = this.GetInputElement();
24358   if(!ASPx.IsExists(this.inputMaxLength))
24359    this.inputMaxLength = input.maxLength;
24360   input.maxLength = onFocus ? this.inputMaxLength : -1;
24361  }
24362 },
24363 SubscribeToIeDropEvent: function() {
24364  if(this.InputMaxLengthCorrectionRequired()) {
24365   var input = this.GetInputElement();
24366   ASPx.Evt.AttachEventToElement(input, "drop", function(e) { this.CorrectInputMaxLength(true); }.aspxBind(this));
24367  }
24368 },
24369 SetFocus: function() {
24370  if(this.isPasswordNullTextInputElementExists()) {
24371   this.GetPasswordNullTextInputElement().focus();
24372  } else {
24373     ASPxClientEdit.prototype.SetFocus.call(this);
24374  }
24375 },
24376 OnValueChanged: function() {
24377  if(this.maskInfo != null) {
24378   if(this.maskInfo.GetValue() == this.maskValueBeforeUserInput && !this.IsValueChangeForced())
24379    return;
24380   this.SavePrevMaskValue();
24381  }
24382  if(this.HasTextDecorators())
24383   this.SyncRawValue();
24384  if(!this.IsValueChanged() && !this.IsValueChangeForced())
24385   return;
24386  this.SaveChangedValue(); 
24387  ASPxClientEdit.prototype.OnValueChanged.call(this);
24388 },
24389 IsValueChangeForced: function() {
24390  return false;
24391 },
24392 OnTextChanged: function() {
24393 },
24394 SaveChangedValue: function() {
24395  this.lastChangedValue = this.GetValue();
24396 },
24397 RaiseStandardOnChange: function(){
24398  var element = this.GetInputElement();
24399  if(element && element.onchange) {
24400   element.onchange({ target: this.GetInputElement() });
24401  }
24402  else if(this.ValueChanged) {
24403   this.ValueChanged.FireEvent(this);
24404  }
24405 },
24406 RaiseTextChanged: function(processOnServer){
24407  if(!this.TextChanged.IsEmpty()){
24408   var args = new ASPxClientProcessingModeEventArgs(processOnServer);
24409   this.TextChanged.FireEvent(this, args);
24410   processOnServer = args.processOnServer;
24411  }
24412  return processOnServer;  
24413 },
24414 RaiseUserInput: function () {
24415  if(!this.UserInput.IsEmpty()) {
24416   var args = new ASPxClientEventArgs();
24417   this.UserInput.FireEvent(this, args);
24418  }
24419 },
24420 GetText: function(){
24421  if(this.maskInfo != null) {
24422   return this.maskInfo.GetText();
24423  } else {
24424   var value = this.GetValue();
24425   return value != null ? value : "";
24426  }
24427 },
24428 SetText: function (value){
24429  if(this.maskInfo != null) {
24430   this.maskInfo.SetText(value);
24431   this.ApplyMaskInfo(false);
24432   this.SavePrevMaskValue();
24433  } else {
24434   this.SetValue(value);
24435  }
24436 },
24437 SelectAll: function() {
24438  this.SetSelection(0, -1, false);
24439 },
24440 SetCaretPosition: function(pos) {
24441  var inputElement = this.GetInputElement();
24442  ASPx.Selection.SetCaretPosition(inputElement, pos);
24443 },
24444 GetCaretPosition: function() {
24445  var inputElement = this.GetInputElement();
24446  return ASPx.Selection.GetCaretPosition(inputElement);
24447 },
24448 SetSelection: function(startPos, endPos, scrollToSelection) { 
24449  var inputElement = this.GetInputElement();
24450  ASPx.Selection.Set(inputElement, startPos, endPos, scrollToSelection, true);
24451 },
24452 ChangeEnabledAttributes: function(enabled){
24453  var inputElement = this.GetInputElement();
24454  if(inputElement){
24455   this.ChangeInputEnabledAttributes(inputElement, ASPx.Attr.ChangeAttributesMethod(enabled), enabled);
24456   if(this.specialKeyboardHandlingUsed)
24457    this.ChangeSpecialInputEnabledAttributes(inputElement, ASPx.Attr.ChangeEventsMethod(enabled), true);
24458   this.ChangeInputEnabled(inputElement, enabled, this.readOnly);
24459  }
24460 },
24461 ChangeEnabledStateItems: function(enabled){
24462  if(!this.isNative) {
24463   var sc = ASPx.GetStateController();
24464   sc.SetElementEnabled(this.GetMainElement(), enabled);
24465   sc.SetElementEnabled(this.GetInputElement(), enabled);
24466  }
24467 },
24468 ChangeInputEnabled: function(element, enabled, readOnly) {
24469  if(this.UseReadOnlyForDisabled())
24470   element.readOnly = !enabled || readOnly;
24471  else
24472   element.disabled = !enabled;
24473 },
24474 ChangeInputEnabledAttributes: function(element, method, enabled) {
24475  var ieTabIndexFix = enabled && ASPx.Browser.IE && element.setAttribute && ASPx.Attr.IsExistsAttribute(element, "savedtabIndex");
24476  method(element, "tabIndex");
24477  if(!enabled) element.tabIndex = -1;
24478  if(ieTabIndexFix) { 
24479   window.setTimeout(function() {
24480    if(element && element.parentNode)
24481     element.parentNode.replaceChild(element, element); 
24482   }, 0);
24483  }
24484  method(element, "onclick");
24485  if(!this.NeedFocusCorrectionWhenDisabled())
24486   method(element, "onfocus");
24487  method(element, "onblur");
24488  method(element, "onkeydown");
24489  method(element, "onkeypress");
24490  method(element, "onkeyup");
24491 },
24492 UseReadOnlyForDisabled: function() {
24493  return (ASPx.Browser.IE && ASPx.Browser.Version < 10) && !this.isNative;
24494 },
24495 NeedFocusCorrectionWhenDisabled: function(){
24496  return (ASPx.Browser.IE && ASPx.Browser.Version < 10) && !this.isNative;
24497 },
24498 OnPostFinalization: function(args) {
24499  this.TryRestoreDisabledOnPost(args);
24500  this.TryClearInputTextDecorationOnPost(args);
24501 },
24502 TryRestoreDisabledOnPost: function(args) { 
24503  if(this.GetEnabled() || !this.UseReadOnlyForDisabled() || args.isDXCallback)
24504   return;
24505  var inputElement = this.GetInputElement();
24506  if(inputElement) {
24507   var inputDisabled = inputElement.disabled;
24508   inputElement.disabled = true;
24509   window.setTimeout(function() {
24510    inputElement.disabled = inputDisabled;
24511   }, 0);
24512  }
24513 },
24514 TryClearInputTextDecorationOnPost: function(args) {
24515  if(this.HasTextDecorators() && !this.GetValue()) {
24516   var inputElement = this.GetInputElement();
24517   if(inputElement) {
24518    var hiddenInput = ASPx.CreateHiddenField(ASPx.Attr.GetAttribute(inputElement, "name"), undefined, inputElement.parentNode);
24519    ASPx.Attr.ChangeAttribute(inputElement, "name", "");
24520    setTimeout(function() {
24521     ASPx.Attr.RestoreAttribute(inputElement, "name");
24522     ASPx.RemoveElement(hiddenInput);
24523    }, 0);
24524   }
24525  }
24526 },
24527 OnUnload: function() {
24528  var input = this.GetInputElement();
24529  if(!input)
24530   return;
24531  if(this.IsAutocompleteOffNotRequiredOnUnload())
24532   ASPx.Attr.RemoveAttribute(input, "autocomplete");
24533  if(this.focusedNullTextElement)
24534   ASPx.RemoveElement(this.focusedNullTextElement);
24535 },
24536 IsVCardAttributeRequired: function() {
24537  return this.autoCompleteAttribute && this.autoCompleteAttribute.name !== "autocomplete";
24538 },
24539 IsAutocompleteDropDownListRequiredOnFocus: function() {
24540  return !this.autoCompleteAttribute || this.IsVCardAttributeRequired();
24541 },
24542 IsAutocompleteOffRequiredOnInitialize: function() {
24543  return !this.isNative && (this.autoCompleteAttribute && this.autoCompleteAttribute.name === "autocomplete" || ASPx.Browser.WebKitFamily);
24544 },
24545 IsAutocompleteOffRequiredOnLostFocus: function() {
24546  return !this.autoCompleteAttribute && this.IsNullTextVisible() && !this.IsVCardAttributeRequired();
24547 },
24548 IsAutocompleteOffNotRequiredOnUnload: function() {
24549  return !this.IsNullTextVisible() || this.IsVCardAttributeRequired() || (this.maskInfo != null && this.GetValue() == null);
24550 },
24551 IsNullTextVisible: function() {
24552  return this.nullText && !this.GetValue() && !this.GetText();
24553 },
24554 GetModifyEvent: function() {
24555  return this.UserInput;
24556 },
24557 EnsureRequiredNativeAttributesExists: function() {
24558  var input = this.GetInputElement();
24559  if(!input.onfocus)
24560   ASPx.Evt.AttachEventToElement(input, "focus", function() { ASPx.EGotFocus(this.name); }.aspxBind(this));
24561  if(!input.onblur)
24562   ASPx.Evt.AttachEventToElement(input, "blur", function() { ASPx.ELostFocus(this.name); }.aspxBind(this));
24563 }
24564});
24565MaskValidationPattern = ASPx.CreateClass(ASPx.ValidationPattern, {
24566 constructor: function(errorText, maskInfo) {
24567  this.constructor.prototype.constructor.call(this, errorText);
24568  this.maskInfo = maskInfo;
24569 },
24570 EvaluateIsValid: function(value) {
24571  return this.maskInfo.IsValid();
24572 }
24573});
24574ASPx.Ident.IsASPxClientTextEdit = function(obj) {
24575 return !!obj.isASPxClientTextEdit;
24576};
24577var ASPxClientTextBoxBase = ASPx.CreateClass(ASPxClientTextEdit, {
24578 constructor: function(name) {
24579  this.constructor.prototype.constructor.call(this, name);
24580  this.sizingConfig.allowSetHeight = false;
24581  this.sizingConfig.adjustControl = true;
24582 }
24583});
24584var ASPxClientTextBox = ASPx.CreateClass(ASPxClientTextBoxBase, {
24585 constructor: function(name) {
24586  this.constructor.prototype.constructor.call(this, name);
24587  this.isASPxClientTextBox = true;
24588  this.isCaptchaTextBox = false;
24589 },
24590 NeedProcessUnload: function() {
24591  return ASPxClientTextBoxBase.prototype.NeedProcessUnload.call(this) && !this.isCaptchaTextBox;
24592 },
24593 IsValueRestoredByBrowser: function() {
24594  if(this.isCaptchaTextBox)
24595   return this.initializeInputValue !== "" && this.initializeInputValue !== this.nullText;
24596  return  ASPxClientTextBoxBase.prototype.IsValueRestoredByBrowser.call(this);
24597 },
24598 SynchronizeRestoredValue: function() {
24599  if(this.isCaptchaTextBox)
24600   this.SetText(null);
24601  else
24602   ASPxClientTextBoxBase.prototype.SynchronizeRestoredValue.call(this);
24603 },
24604});
24605ASPxClientTextBox.Cast = ASPxClientControl.Cast;
24606ASPx.Ident.IsASPxClientTextBox = function(obj) {
24607 return !!obj.isASPxClientTextBox;
24608};
24609var ASPxClientMemo = ASPx.CreateClass(ASPxClientTextEdit, { 
24610 constructor: function(name) {
24611  this.constructor.prototype.constructor.call(this, name);        
24612  this.isASPxClientMemo = true;
24613  this.raiseValueChangedOnEnter = false;
24614  this.maxLength = 0;
24615  this.pasteTimerID = -1;
24616  this.pasteTimerActivatorCount = 0;
24617 },
24618 Initialize: function() {
24619  ASPxClientTextEdit.prototype.Initialize.call(this);
24620  this.SaveChangedValue();
24621  this.maxLengthRestricted = this.maxLength > 0;
24622 },
24623 CutString: function() {
24624  var text = this.GetText();
24625  if(text.length > this.maxLength) {
24626   text = text.substring(0, this.maxLength);
24627   this.SetText(text);
24628  }
24629 },
24630 EventKeyCodeChangesTheInput: function(evt) {
24631  if(ASPx.IsPasteShortcut(evt))
24632   return true;
24633  else if(evt.ctrlKey)
24634   return false;
24635  var keyCode = ASPx.Evt.GetKeyCode(evt);
24636  var isSystemKey = ASPx.Key.Windows <= keyCode && keyCode <= ASPx.Key.ContextMenu;
24637  var isFKey = ASPx.Key.F1 <= keyCode && keyCode <= 127; 
24638  return ASPx.Key.Delete < keyCode && !isSystemKey && !isFKey || keyCode == ASPx.Key.Enter || keyCode == ASPx.Key.Space;
24639 },
24640 OnTextChangingCheck: function() {
24641  if(this.maxLengthRestricted)  
24642   this.CutString(); 
24643 },
24644 StartTextChangingTimer: function() {
24645  if(this.maxLengthRestricted) {
24646   if(this.pasteTimerActivatorCount == 0) 
24647    this.SetTextChangingTimer();
24648   this.pasteTimerActivatorCount ++;
24649  }
24650 },
24651 EndTextChangingTimer: function() {
24652  if(this.maxLengthRestricted) {
24653   this.pasteTimerActivatorCount --;
24654   if(this.pasteTimerActivatorCount == 0) 
24655    this.ClearTextChangingTimer();
24656  }
24657 },
24658 CollapseEditor: function() {
24659  if(!this.IsAdjustmentRequired()) return;
24660  var mainElement = this.GetMainElement();
24661  var inputElement = this.GetInputElement();
24662  if(!ASPx.IsExistsElement(mainElement) || !ASPx.IsExistsElement(inputElement))
24663   return;
24664  ASPxClientTextEdit.prototype.CollapseEditor.call(this);
24665  var mainElementCurStyle = ASPx.GetCurrentStyle(mainElement);
24666  if(this.heightCorrectionRequired && mainElement && inputElement) {
24667   if(mainElement.style.height == "100%" || mainElementCurStyle.height == "100%") {
24668    mainElement.style.height = "0";
24669    mainElement.wasCollapsed = true;
24670   }
24671   inputElement.style.height = "0";
24672  }
24673 },
24674 CorrectEditorHeight: function() {
24675  var mainElement = this.GetMainElement();
24676  if(mainElement.wasCollapsed) {
24677   mainElement.wasCollapsed = null;
24678   ASPx.SetOffsetHeight(mainElement, ASPx.GetClearClientHeight(ASPx.FindOffsetParent(mainElement)));
24679  }
24680  if(!this.isNative) {
24681   var inputElement = this.GetInputElement();
24682   var inputClearClientHeight = ASPx.GetClearClientHeight(ASPx.FindOffsetParent(inputElement));
24683   if(ASPx.Browser.IE) {
24684    inputClearClientHeight -= 2;
24685    var calculatedMainElementStyle = ASPx.GetCurrentStyle(mainElement);
24686    inputClearClientHeight += ASPx.PxToInt(calculatedMainElementStyle.borderTopWidth) + ASPx.PxToInt(calculatedMainElementStyle.borderBottomWidth);
24687   }
24688   if(inputClearClientHeight < memoMinHeight)
24689    inputClearClientHeight = memoMinHeight;
24690   ASPx.SetOffsetHeight(inputElement, inputClearClientHeight);
24691   mainElement.style.height = "100%";
24692   setTimeout(function() {
24693    var inputParentOffsetHeight = ASPx.GetClearClientHeight(ASPx.FindOffsetParent(inputElement));
24694    if(inputParentOffsetHeight != inputClearClientHeight) {
24695      ASPx.SetOffsetHeight(inputElement, inputParentOffsetHeight); 
24696     }
24697   }, 0);
24698  }
24699 },
24700 SetWidth: function(width) {
24701  ASPxClientTextEdit.prototype.SetWidth.call(this, width);
24702  if(ASPx.Browser.IE)
24703   this.AdjustControl();
24704 },
24705 SetHeight: function(height) {
24706  var textarea = this.GetInputElement();
24707  textarea.style.height = "1px";
24708  ASPxClientTextEdit.prototype.SetHeight.call(this, height);
24709  textarea.style.height = ASPx.GetClearClientHeight(this.GetMainElement()) - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(textarea) + "px";
24710 },
24711 ClearErrorFrameElementsStyles: function() {
24712  var textarea = this.GetInputElement();
24713  if(!textarea)
24714   return;
24715  var scrollBarPosition = textarea.scrollTop;
24716  ASPxClientTextEdit.prototype.ClearErrorFrameElementsStyles.call(this);
24717  if(ASPx.Browser.Firefox)
24718   textarea.scrollTop = scrollBarPosition;
24719 },
24720 OnMouseOver: function() {
24721  this.StartTextChangingTimer();
24722 },  
24723 OnMouseOut: function() {
24724  this.EndTextChangingTimer();
24725 },   
24726 OnFocus: function() {  
24727  this.StartTextChangingTimer();
24728  ASPxClientTextEdit.prototype.OnFocus.call(this);
24729 },
24730 OnLostFocus: function() {
24731  this.EndTextChangingTimer();
24732  ASPxClientTextEdit.prototype.OnLostFocus.call(this);
24733 },
24734 OnKeyDown: function(evt) { 
24735  if(this.NeedPreventBrowserUndoBehaviour(evt))
24736   return ASPx.Evt.PreventEvent(evt);
24737  if(this.maxLengthRestricted){
24738   var selection = ASPx.Selection.GetInfo(this.GetInputElement()); 
24739   var noCharToReplace = selection.startPos == selection.endPos;
24740   if(this.GetText().length >= this.maxLength && noCharToReplace && this.EventKeyCodeChangesTheInput(evt)) {
24741    return ASPx.Evt.PreventEvent(evt);
24742   }
24743  }
24744  ASPxClientEdit.prototype.OnKeyDown.call(this, evt);
24745 },
24746 SetTextChangingTimer: function() {
24747  this.pasteTimerID = ASPx.Timer.SetControlBoundInterval(this.OnTextChangingCheck, this, ASPx.PasteCheckInterval);
24748 },
24749 ClearTextChangingTimer: function() {
24750  this.pasteTimerID = ASPx.Timer.ClearInterval(this.pasteTimerID);
24751 },
24752 getFocusedNullTextElementTagName: function() {
24753  return "TEXTAREA";
24754 },
24755 getCopyFromInputElementStyles: function() {
24756  var result = ASPxClientTextEdit.prototype.getCopyFromInputElementStyles.call(this);
24757  result.push("resize");
24758  return result;
24759 }
24760});
24761ASPxClientMemo.Cast = ASPxClientControl.Cast;
24762ASPx.Ident.IsASPxClientMemo = function(obj) { return obj && !!obj.isASPxClientMemo; };
24763var CLEAR_BUTTON_INDEX = -100;
24764var HIDE_CONTENT_CSS_CLASS_NAME = "dxHideContent";
24765var setContentVisibility = function(clearButtonElement, value) {
24766 var action = value ? ASPx.RemoveClassNameFromElement : ASPx.AddClassNameToElement;
24767 action(clearButtonElement, HIDE_CONTENT_CSS_CLASS_NAME);
24768};
24769var CLEAR_BUTTON_DISPLAY_MODE = {
24770 AUTO: 'Auto',
24771 ALWAYS: 'Always',
24772 NEVER: 'Never',
24773 ON_HOVER: 'OnHover'
24774};
24775var AccessibilityFocusedButtonClassName = "dxAFB";
24776var ASPxClientButtonEditBase = ASPx.CreateClass(ASPxClientTextBoxBase, {
24777 constructor: function(name) {
24778  this.constructor.prototype.constructor.call(this, name);        
24779  this.allowUserInput = true;
24780  this.isValueChanging = false;
24781  this.allowMouseWheel = true;
24782  this.isMouseOver = false;
24783  this.buttonCount = 0;
24784  this.emptyValueMaskDisplayText = "";
24785  this.clearButtonDisplayMode = CLEAR_BUTTON_DISPLAY_MODE.AUTO;
24786  this.forceShowClearButtonAlways = false;
24787  this.recoverClearButtonVisibility = false;
24788  this.ButtonClick = new ASPxClientEvent();
24789 },
24790 Initialize: function() {
24791  ASPxClientTextBoxBase.prototype.Initialize.call(this);
24792  this.EnsureEmptyValueMaskDisplayText();
24793  if(this.HasClearButton())
24794   this.InitializeClearButton();
24795  this.InitAccessibilityCompliant();
24796 },
24797 InlineInitialize: function() {
24798  ASPxClientTextBoxBase.prototype.InlineInitialize.call(this);
24799  if(this.clearButtonDisplayMode === CLEAR_BUTTON_DISPLAY_MODE.AUTO) {
24800   this.clearButtonDisplayMode = this.IsClearButtonVisibleAuto() || this.forceShowClearButtonAlways ?
24801    CLEAR_BUTTON_DISPLAY_MODE.ALWAYS : CLEAR_BUTTON_DISPLAY_MODE.NEVER;
24802  }
24803  this.EnsureClearButtonVisibility();
24804 },
24805 InitializeClearButton: function() {
24806  if(this.clearButtonDisplayMode === CLEAR_BUTTON_DISPLAY_MODE.ON_HOVER) {
24807   ASPx.Evt.AttachMouseEnterToElement(this.GetHoverElementToShowClearButton(), this.OnMouseOver.aspxBind(this), this.OnMouseOut.aspxBind(this));
24808  }
24809 },
24810 GetHoverElementToShowClearButton: function() {
24811  return this.GetMainElement();
24812 },
24813 IsClearButtonVisibleAuto: function() {
24814  return ASPx.Browser.MobileUI;
24815 },
24816 SetEnabled: function(enabled) {
24817  ASPxClientTextBoxBase.prototype.SetEnabled.call(this, enabled);
24818  this.EnsureClearButtonVisibility();
24819 },
24820 EnsureEmptyValueMaskDisplayText: function() {
24821  if(this.maskInfo && this.HasClearButton()) {
24822   var savedText = this.maskInfo.GetText();
24823   this.maskInfo.SetText("");
24824   this.emptyValueMaskDisplayText = this.maskInfo.GetText();
24825   this.maskInfo.SetText(savedText);
24826  }
24827 },
24828 GetButton: function(number) {
24829  return this.GetChildElement("B" + number);
24830 },
24831 GetCustomButtonCollection: function() {
24832  var buttonElements = [];
24833  for(var i = 0; i < this.buttonCount; i++) {
24834   var button =  this.GetButton(i);
24835   if(!!button)
24836    buttonElements.push(button);
24837  }
24838  return buttonElements;
24839 },
24840 GetButtonCollection: function() {
24841  var buttonElements = [];
24842  var clearButton = this.GetClearButton();
24843  if(!!clearButton)
24844   buttonElements.push(clearButton);
24845  return buttonElements.concat(this.GetCustomButtonCollection());
24846 },
24847 GetAccessibilityAnchor: function(buttonElement) {
24848  var firstChild = buttonElement.firstElementChild;
24849  var isExistsAnchorElement = ASPx.Attr.GetAttribute(firstChild, "role") === "button";
24850  return isExistsAnchorElement ? firstChild : null;
24851 },
24852 GetButtonByAccessibilityAnchor: function(anchorElement) {
24853  return anchorElement.parentNode;
24854 },
24855 SetAccessibilityAnchorEnabled: function(buttonElement, enabled) {
24856  var anchorElement = this.GetAccessibilityAnchor(buttonElement);
24857  if(ASPx.IsExists(anchorElement))
24858   ASPx.Attr.SetOrRemoveAttribute(anchorElement, "tabindex", enabled ? "0" : "");
24859 },
24860 InitAccessibilityCompliant: function() {
24861  if(!this.accessibilityCompliant) return;
24862  var buttonElements = this.GetButtonCollection();
24863  var labelElements = ASPx.FindAssociatedLabelElements(this);
24864  for(var i = 0; i < buttonElements.length; i++)
24865   this.InitAccessibilityAnchor(this.GetAccessibilityAnchor(buttonElements[i]), labelElements);     
24866 },
24867 InitAccessibilityAnchor: function(anchorElement, labelElements) {
24868  if(!ASPx.IsExists(anchorElement))
24869   return;
24870  for(var i = 0; i < labelElements.length; i++)
24871   this.ariaExplanatoryTextManager.SetOrRemoveText([anchorElement], labelElements[i], true, false, false);
24872  this.InitAccessibilityAnchorEvents(anchorElement);
24873 },
24874 InitAccessibilityAnchorEvents: function(anchorElement) {
24875  ASPx.Evt.AttachEventToElement(anchorElement, "keydown", function(evt) { this.OnButtonKeysHandling(evt); }.aspxBind(this));
24876  ASPx.Evt.AttachEventToElement(anchorElement, "keyup", function(evt) { this.OnButtonKeysHandling(evt); }.aspxBind(this));
24877  ASPx.Evt.AttachEventToElement(anchorElement, "focus", function(evt) { this.OnButtonGotFocus(evt); }.aspxBind(this));
24878  ASPx.Evt.AttachEventToElement(anchorElement, "blur", function(evt) { this.OnButtonLostFocus(evt); }.aspxBind(this));
24879 },
24880 EmulateButtonMouseEvent: function(sourceElement) {
24881  var buttonElement = this.GetButtonByAccessibilityAnchor(sourceElement);
24882  var mouseEvent = buttonElement.onclick || buttonElement.onmousedown || buttonElement.ontouchstart || buttonElement.onpointerdown;
24883  var emulateMouseEvtArgs = { button: 0, which: 1, srcElement: buttonElement, target: buttonElement };
24884  if(!!mouseEvent) {
24885   ASPx.Attr.SetAttribute(sourceElement, "aria-pressed", true);
24886   setTimeout(function() {
24887    mouseEvent(emulateMouseEvtArgs);
24888    ASPx.Attr.RemoveAttribute(sourceElement, "aria-pressed");
24889   }, 300);
24890  }
24891 },
24892 OnButtonKeysHandling: function(evt) {
24893  var isKeyUp = evt.type == "keyup";
24894  var keyCode = ASPx.Evt.GetKeyCode(evt);
24895  var sourceElement = ASPx.Evt.GetEventSource(evt);
24896  if((keyCode == ASPx.Key.Space && isKeyUp) || (keyCode == ASPx.Key.Enter && !isKeyUp))
24897   this.EmulateButtonMouseEvent(sourceElement);
24898  if(keyCode != ASPx.Key.Tab) {
24899   evt.cancelBubble = true;
24900   evt.preventDefault();
24901  }
24902  return false;
24903 },
24904 OnButtonGotFocus: function(evt) {
24905  var editor = ASPx.GetControlCollection().Get(this.name);
24906  var sourceElement = ASPx.Evt.GetEventSource(evt);
24907  if(!!editor && !editor.CorrectAccessibilityButtonFocus(sourceElement)) {
24908   var buttonElement = editor.GetButtonByAccessibilityAnchor(sourceElement);
24909   ASPx.AddClassNameToElement(buttonElement, this.GetAccessibilityFocusedButtonClassName());
24910   ASPx.EGotFocus(editor.name);
24911   if(editor.specialKeyboardHandlingUsed)
24912    ASPx.ESGotFocus(editor.name);
24913  }
24914 },
24915 OnButtonLostFocus: function(evt) {
24916  var editor = ASPx.GetControlCollection().Get(this.name);
24917  var sourceElement = ASPx.Evt.GetEventSource(evt);
24918  if(!!editor) {
24919   var buttonElement = editor.GetButtonByAccessibilityAnchor(sourceElement);
24920   ASPx.RemoveClassNameFromElement(buttonElement, this.GetAccessibilityFocusedButtonClassName());
24921  }
24922  setTimeout(function() {
24923   if(!!editor && !editor.IsEditorElement(ASPx.GetActiveElement())) {
24924    ASPx.ELostFocus(editor.name);
24925    if(editor.specialKeyboardHandlingUsed)
24926     ASPx.ESLostFocus(editor.name);
24927   }
24928  }.aspxBind(this), 0);
24929 },
24930 ForceRefocusEditor: function(evt, isNativeFocus) {
24931  if(this.accessibilityCompliant) {
24932   var srcElement = ASPx.Evt.GetEventSource(evt);
24933   var customButtons = this.GetCustomButtonCollection();
24934   for(var i = 0; i < customButtons.length; i++)
24935    if(customButtons[i] == srcElement || ASPx.GetIsParent(customButtons[i], srcElement))
24936     return;
24937  }
24938  ASPxClientEdit.prototype.ForceRefocusEditor.call(this, evt, isNativeFocus);
24939  if(this.GetInputElement().type == "password") {
24940   window.setTimeout(function() { this.GetInputElement().focus(); }.bind(this), 0);
24941  }
24942 },
24943 CorrectAccessibilityButtonFocus: function(sourceElement) {
24944  if(ASPx.Attr.IsExistsAttribute(sourceElement, "tabindex"))
24945   return false;
24946  setTimeout(function() {
24947   var buttonElements = this.GetButtonCollection();
24948   for(var i = 0; i < buttonElements.length; i++)
24949    if(ASPx.GetIsParent(buttonElements[i], sourceElement))
24950     this.GetAccessibilityAnchor(buttonElements[i]).focus();
24951  }.aspxBind(this), 0);
24952  return true;
24953 },
24954 OnKeyDown: function(evt) { 
24955  if(this.NeedEnsureClearButtonVisibilityOnKeyDown()) {
24956   var hasClearButtonOnHover = this.HasClearButton() && this.clearButtonDisplayMode === CLEAR_BUTTON_DISPLAY_MODE.ON_HOVER;
24957   this.recoverClearButtonVisibility = hasClearButtonOnHover && ASPx.Evt.GetKeyCode(evt) == ASPx.Key.Tab && !evt.shiftKey;
24958  }
24959  ASPxClientTextBoxBase.prototype.OnKeyDown.call(this, evt);
24960 },
24961 NeedEnsureClearButtonVisibilityOnKeyDown: function() {
24962  return this.accessibilityCompliant;
24963 },
24964 GetAccessibilityFocusedButtonClassName: function() {
24965  return AccessibilityFocusedButtonClassName;
24966 },
24967 SetButtonVisible: function(number, value) {
24968  var button = this.GetButton(number);
24969  if(!button)
24970   return;
24971  var isAlwaysShownClearButton = number === CLEAR_BUTTON_INDEX && this.clearButtonDisplayMode === CLEAR_BUTTON_DISPLAY_MODE.ALWAYS;
24972  var visibilityModifier = isAlwaysShownClearButton ? setContentVisibility : ASPx.SetElementDisplay;
24973  if(isAlwaysShownClearButton && this.accessibilityCompliant && this.enabled)
24974   this.SetAccessibilityAnchorEnabled(button, value);
24975  visibilityModifier(button, value);
24976 },
24977 GetButtonVisible: function(number) {
24978  var button = this.GetButton(number);
24979  if(number === CLEAR_BUTTON_INDEX && this.clearButtonDisplayMode === CLEAR_BUTTON_DISPLAY_MODE.ALWAYS)
24980   return button && !ASPx.ElementHasCssClass(button, this.GetHideContentCssClassName());
24981  return button && ASPx.IsElementVisible(button);
24982 },
24983 GetHideContentCssClassName: function() {
24984  return HIDE_CONTENT_CSS_CLASS_NAME;
24985 },
24986 ProcessInternalButtonClick: function(buttonIndex) {
24987  return false;
24988 },
24989 OnButtonClick: function(number) {
24990  var processOnServer = this.RaiseButtonClick(number);
24991  if(!this.ProcessInternalButtonClick(number) && processOnServer)
24992   this.SendPostBack('BC:' + number);
24993 },
24994 GetLastSuccesfullValue: function() {
24995  return this.lastChangedValue;
24996 },
24997 OnClear: function() {
24998  this.startUserInputEventTimerIfRequired();
24999  this.ClearEditorValueAndForceOnChange();
25000  this.ForceRefocusEditor(null, true);
25001  window.setTimeout(this.EnsureClearButtonVisibility.aspxBind(this), 0);
25002 },
25003 ClearEditorValueAndForceOnChange: function() {
25004  if(this.readOnly || !this.GetButtonVisible(CLEAR_BUTTON_INDEX))
25005   return;
25006  var raiseOnChange = this.ClearEditorValueByClearButton();
25007  if(raiseOnChange)
25008   this.ForceStandardOnChange();
25009 },
25010 ClearEditorValueByClearButton: function() {
25011  var prevValue = this.GetLastSuccesfullValue();
25012  this.ClearEditorValueByClearButtonCore();
25013  return prevValue !== this.GetValue();
25014 },
25015 ClearEditorValueByClearButtonCore: function() {
25016  this.Clear();
25017  this.GetInputElement().value = '';
25018 },
25019 ForceStandardOnChange: function() {
25020  this.forceValueChanged = true;
25021  this.RaiseStandardOnChange();
25022  this.forceValueChanged = false;
25023 },
25024 IsValueChangeForced: function() {
25025  return this.forceValueChanged || ASPxClientTextBoxBase.prototype.IsValueChangeForced.call(this);
25026 },
25027 IsValueChanging: function() { return this.isValueChanging; },
25028 StartValueChanging: function() { this.isValueChanging = true; },
25029 EndValueChanging: function() { this.isValueChanging = false; },
25030 IsClearButtonElement: function(element) {
25031  return ASPx.GetIsParent(this.GetClearButton(), element);
25032 },
25033 OnFocusCore: function() {
25034  ASPxClientTextBoxBase.prototype.OnFocusCore.call(this);
25035  this.EnsureClearButtonVisibility();
25036 },
25037 OnLostFocusCore: function() {
25038  ASPxClientTextBoxBase.prototype.OnLostFocusCore.call(this);
25039  this.EnsureClearButtonVisibility();
25040  this.recoverClearButtonVisibility = false;
25041 },
25042 GetClearButton: function() {
25043  return this.GetButton(CLEAR_BUTTON_INDEX);
25044 },
25045 HasClearButton: function() {
25046  return !!this.GetClearButton();
25047 },
25048 RequireShowClearButton: function() {
25049  return !this.IsClearButtonDisabled() && !this.IsClearButtonNotRequired() && this.RequireShowClearButtonInternal();
25050 },
25051 IsClearButtonDisabled: function() {
25052  return !this.clientEnabled || !this.HasClearButton() || this.clearButtonDisplayMode === CLEAR_BUTTON_DISPLAY_MODE.NEVER;
25053 },
25054 IsClearButtonNotRequired: function() {
25055  return !this.IsFocused() && !this.isMouseOver && this.clearButtonDisplayMode !== CLEAR_BUTTON_DISPLAY_MODE.ALWAYS && !this.recoverClearButtonVisibility;
25056 },
25057 RequireShowClearButtonInternal: function () {
25058  return this.IsFocused() && this.RequireShowClearButtonCore() || !this.IsNullState();
25059 },
25060 RequireShowClearButtonCore: function() {
25061  var inputText = this.GetInputElement().value;
25062  return inputText !== this.GetEmptyValueDisplayText();
25063 },
25064 IsFocused: function() {
25065  return this === ASPx.GetFocusedEditor();
25066 },
25067 IsNullState: function() {
25068  var value = this.GetValue();
25069  return this.IsNull(value) || value == this.GetEmptyValueDisplayText();
25070 },
25071 GetEmptyValueDisplayText: function() { 
25072  return this.maskInfo ? this.emptyValueMaskDisplayText : "";
25073 },
25074 EnsureClearButtonVisibility: function() {
25075  this.SetButtonVisible(CLEAR_BUTTON_INDEX, this.RequireShowClearButton());
25076 },
25077 OnMouseOver: function() {
25078  this.isMouseOver = true;
25079  this.EnsureClearButtonVisibility();
25080 },
25081 OnMouseOut: function() {
25082  this.isMouseOver = false;
25083  this.EnsureClearButtonVisibility();
25084 },
25085 OnKeyPress: function(evt) {
25086  if(this.allowUserInput)
25087   ASPxClientTextBoxBase.prototype.OnKeyPress.call(this, evt);
25088 },
25089 OnKeyEventEnd: function(evt, withDelay) {
25090  ASPxClientTextBoxBase.prototype.OnKeyEventEnd.call(this, evt, withDelay);
25091  this.EnsureClearButtonVisibility();
25092 },
25093 RaiseButtonClick: function(number){
25094  var processOnServer = this.autoPostBack || this.IsServerEventAssigned("ButtonClick");
25095  if(!this.ButtonClick.IsEmpty()){
25096   var args = new ASPxClientButtonEditClickEventArgs(processOnServer, number);
25097   this.ButtonClick.FireEvent(this, args);
25098   processOnServer = args.processOnServer;
25099  }
25100  return processOnServer;
25101 },
25102 ChangeEnabledAttributes: function(enabled){
25103  ASPxClientTextEdit.prototype.ChangeEnabledAttributes.call(this, enabled);
25104  for(var i = 0; i < this.buttonCount; i++){
25105   var element = this.GetButton(i);
25106   if(element)
25107    this.ChangeButtonEnabledAttributes(element, this.GetChangeButtonEnabledAttributesMethod(enabled));
25108  }
25109  if(this.accessibilityCompliant)
25110   this.ChangeAccessibilityButtonEnabledAttributes(enabled);
25111 },
25112 ChangeEnabledStateItems: function(enabled){
25113  ASPxClientTextEdit.prototype.ChangeEnabledStateItems.call(this, enabled);
25114  for(var i = 0; i < this.buttonCount; i++){
25115   var element = this.GetButton(i);
25116   if(element) 
25117    ASPx.GetStateController().SetElementEnabled(element, enabled);
25118  }
25119 },
25120 GetChangeButtonEnabledAttributesMethod: function(enabled) {
25121  return ASPx.Attr.ChangeAttributesMethod(enabled);
25122 },
25123 ChangeButtonEnabledAttributes: function(element, method){
25124  method(element, "onclick");
25125  method(element, "ondblclick");
25126  if(ASPx.Browser.Edge)
25127   method(element, "onmousedown");
25128  method(element, "on" + ASPx.TouchUIHelper.touchMouseDownEventName);
25129  method(element, "on" + ASPx.TouchUIHelper.touchMouseUpEventName);
25130 },
25131 ChangeInputEnabled: function(element, enabled, readOnly) {
25132  ASPxClientTextEdit.prototype.ChangeInputEnabled.call(this, element, enabled, readOnly || !this.allowUserInput);
25133 },
25134 ChangeAccessibilityButtonEnabledAttributes: function(enabled) {
25135  var buttonElements = this.GetButtonCollection();
25136  for(var i = 0; i < buttonElements.length; i++)
25137   this.SetAccessibilityAnchorEnabled(buttonElements[i], enabled);
25138 },
25139 SetValue: function(value) {
25140  ASPxClientTextEdit.prototype.SetValue.call(this, value);
25141  if(!this.IsFocused())
25142   this.EnsureClearButtonVisibility();
25143 },
25144 OnAssociatedLabelClick: function(focusableElement) {
25145  var isValidElement = focusableElement && ASPx.IsActionElement(focusableElement) && ASPx.GetIsParent(this.GetMainElement(), focusableElement) && ASPx.IsElementVisible(focusableElement);
25146  if(isValidElement)
25147   focusableElement.focus();
25148  else
25149   this.SetFocus();
25150 }
25151});
25152var ASPxClientButtonEdit = ASPx.CreateClass(ASPxClientButtonEditBase, {
25153});
25154ASPxClientButtonEdit.Cast = ASPxClientControl.Cast;
25155var ASPxClientButtonEditClickEventArgs = ASPx.CreateClass(ASPxClientProcessingModeEventArgs, {
25156 constructor: function(processOnServer, buttonIndex){
25157  this.constructor.prototype.constructor.call(this, processOnServer);
25158  this.buttonIndex = buttonIndex;
25159 }
25160});
25161var ASPxClientTextEditHelpTextHAlign = {
25162 Left: "Left",
25163 Right: "Right",
25164 Center: "Center"
25165};
25166var ASPxClientTextEditHelpTextVAlign = {
25167 Top: "Top",
25168 Bottom: "Bottom",
25169 Middle: "Middle"
25170};
25171var ASPxClientTextEditHelpTextDisplayMode = {
25172 Inline: "Inline",
25173 Popup: "Popup"
25174};
25175var ASPxClientTextEditHelpTextConsts = {
25176 VERTICAL_ORIENTATION_CLASS_NAME: "dxeVHelpTextSys",
25177 HORIZONTAL_ORIENTATION_CLASS_NAME: "dxeHHelpTextSys"
25178};
25179var ASPxClientTextEditHelpText = ASPx.CreateClass(null, {
25180 constructor: function (editor, helpTextStyle, helpText, position, hAlign, vAlign, margins, animationEnabled, helpTextDisplayMode) {
25181  this.hAlign = hAlign;
25182  this.vAlign = vAlign;
25183  this.animationEnabled = animationEnabled;
25184  this.displayMode = helpTextDisplayMode;
25185  this.editor = editor;
25186  this.editorMainElement = editor.GetMainElement();
25187  this.margins = margins ? { Top: margins[0], Right: margins[1], Bottom: margins[2], Left: margins[3] } : null;
25188  this.defaultMargins = { Top: 10, Right: 10, Bottom: 10, Left: 10 };
25189  this.position = position;
25190  this.helpTextElement = this.createHelpTextElement();
25191  this.setHelpTextZIndex(true);
25192  this.prepareHelpTextElement(helpTextStyle, helpText);
25193 },
25194 getRows: function (table) {
25195  return ASPx.GetChildNodesByTagName(table, "TR");
25196 },
25197 getCells: function (row) {
25198  return ASPx.GetChildNodesByTagName(row, "TD");
25199 },
25200 getCellByIndex: function(row, cellIndex) {
25201  return this.getCells(row)[cellIndex];
25202 },
25203 getCellIndex: function(row, cell) {
25204  var cells = this.getCells(row);
25205  for(var i = 0; i < cells.length; i++) {
25206   if(cells[i] === cell)
25207    return i;
25208  }
25209 },
25210 isHorizontal: function(position) {
25211  return position === ASPx.Position.Left || position === ASPx.Position.Right;
25212 },
25213 isVertical: function (position) {
25214  return position === ASPx.Position.Top || position === ASPx.Position.Bottom;
25215 },
25216 createEmptyCell: function(assignClassName) {
25217  var cell = document.createElement("TD");
25218  if(assignClassName)
25219   cell.className = "dxeFakeEmptyCell";
25220  return cell;
25221 },
25222 addHelpTextCellToExternalTableWithTwoCells: function (captionCell, errorCell, helpTextCell, errorTableBody, tableRows) {
25223  var captionPosition = this.editor.captionPosition;
25224  var errorCellPosition = this.editor.errorCellPosition;
25225  var helpTextRow = this.isVertical(this.position) ? document.createElement("TR") : null;
25226  if(captionPosition === ASPx.Position.Left && this.position === ASPx.Position.Left && this.isHorizontal(errorCellPosition))
25227   captionCell.parentNode.insertBefore(helpTextCell, captionCell.nextSibling);
25228  if(captionPosition === ASPx.Position.Right && this.position === ASPx.Position.Right && this.isHorizontal(errorCellPosition))
25229   captionCell.parentNode.insertBefore(helpTextCell, captionCell);
25230  if(captionPosition === ASPx.Position.Left && this.position === ASPx.Position.Right && this.isHorizontal(errorCellPosition))
25231   tableRows[0].appendChild(helpTextCell);
25232  if(captionPosition === ASPx.Position.Right && this.position === ASPx.Position.Left && this.isHorizontal(errorCellPosition))
25233   tableRows[0].insertBefore(helpTextCell, tableRows[0].childNodes[0]);
25234  if(captionPosition === ASPx.Position.Top && this.position === ASPx.Position.Bottom && this.isVertical(errorCellPosition)) {
25235   helpTextRow.appendChild(helpTextCell);
25236   errorTableBody.appendChild(helpTextRow);
25237  }
25238  if(captionPosition === ASPx.Position.Bottom && this.position === ASPx.Position.Top && this.isVertical(errorCellPosition)) {
25239   helpTextRow.appendChild(helpTextCell);
25240   errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
25241  }
25242  if(captionPosition === ASPx.Position.Top && this.position === ASPx.Position.Top && this.isVertical(errorCellPosition)) {
25243   helpTextRow.appendChild(helpTextCell);
25244   errorTableBody.insertBefore(helpTextRow, captionCell.parentNode.nextSibling);
25245  }
25246  if(captionPosition === ASPx.Position.Bottom && this.position === ASPx.Position.Bottom && this.isVertical(errorCellPosition)) {
25247   helpTextRow.appendChild(helpTextCell);
25248   errorTableBody.insertBefore(helpTextRow, captionCell.parentNode);
25249  }
25250  if(captionPosition === ASPx.Position.Right && this.position === ASPx.Position.Top && this.isVertical(errorCellPosition)) {
25251   helpTextRow.appendChild(helpTextCell);
25252   helpTextRow.appendChild(this.createEmptyCell());
25253   errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
25254  }
25255  if(this.position === ASPx.Position.Bottom) {
25256   if(captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Top || captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Right) {
25257    helpTextRow.appendChild(helpTextCell);
25258    helpTextRow.appendChild(this.createEmptyCell());
25259    errorTableBody.appendChild(helpTextRow);
25260   }
25261  }
25262  if(captionPosition === ASPx.Position.Left && this.position === ASPx.Position.Top && this.isVertical(errorCellPosition)) {
25263   helpTextRow.appendChild(this.createEmptyCell());
25264   helpTextRow.appendChild(helpTextCell);
25265   errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
25266  }
25267  if(captionPosition === ASPx.Position.Left && this.position === ASPx.Position.Bottom && this.isVertical(errorCellPosition)) {
25268   helpTextRow.appendChild(this.createEmptyCell());
25269   helpTextRow.appendChild(helpTextCell);
25270   errorTableBody.appendChild(helpTextRow);
25271  }
25272  if(this.position === ASPx.Position.Right) {
25273   if(captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Left || captionPosition === ASPx.Position.Left && errorCellPosition === ASPx.Position.Top
25274    || captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Right) {
25275    tableRows[1].appendChild(helpTextCell);
25276    tableRows[0].appendChild(this.createEmptyCell());
25277   }
25278   if(captionPosition === ASPx.Position.Left && errorCellPosition === ASPx.Position.Bottom || captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Left) {
25279    tableRows[0].appendChild(helpTextCell);
25280    tableRows[1].appendChild(this.createEmptyCell());
25281   }
25282  }
25283  if(this.position === ASPx.Position.Left) {
25284   if(captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Top || captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Right
25285    || captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Left) {
25286    tableRows[1].insertBefore(helpTextCell, tableRows[1].childNodes[0]);
25287    tableRows[0].insertBefore(this.createEmptyCell(), tableRows[0].childNodes[0]);
25288   }
25289   if(captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Top || captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Bottom) {
25290    tableRows[1].insertBefore(helpTextCell, tableRows[1].childNodes[0]);
25291    tableRows[0].insertBefore(this.createEmptyCell(errorCellPosition === ASPx.Position.Top), tableRows[0].childNodes[0]);
25292    tableRows[2].insertBefore(this.createEmptyCell(errorCellPosition !== ASPx.Position.Top), tableRows[2].childNodes[0]);
25293   }
25294   if(captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Top) {
25295    tableRows[2].insertBefore(helpTextCell, tableRows[2].childNodes[0]);
25296    tableRows[0].insertBefore(this.createEmptyCell(false), tableRows[0].childNodes[0]);
25297    tableRows[1].insertBefore(this.createEmptyCell(true), tableRows[1].childNodes[0]);
25298   }
25299   if(captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Bottom) {
25300    tableRows[0].insertBefore(helpTextCell, tableRows[0].childNodes[0]);
25301    tableRows[1].insertBefore(this.createEmptyCell(true), tableRows[1].childNodes[0]);
25302    tableRows[2].insertBefore(this.createEmptyCell(false), tableRows[2].childNodes[0]);
25303   }
25304   if(captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Left || captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Bottom
25305    || captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Right) {
25306    tableRows[0].insertBefore(helpTextCell, tableRows[0].childNodes[0]);
25307    tableRows[1].insertBefore(this.createEmptyCell(), tableRows[1].childNodes[0]);
25308   }
25309   if(captionPosition === ASPx.Position.Left && this.isVertical(errorCellPosition)) {
25310    captionCell.parentNode.insertBefore(helpTextCell, captionCell.nextSibling);
25311    var emptyCellParentRow = errorCellPosition === ASPx.Position.Top ? tableRows[0] : tableRows[1];
25312    var helpTextCellIndex = this.getCellIndex(helpTextCell.parentNode, helpTextCell);
25313    emptyCellParentRow.insertBefore(this.createEmptyCell(), this.getCellByIndex(emptyCellParentRow, helpTextCellIndex));
25314   }
25315  }
25316  if(this.position === ASPx.Position.Right) {
25317   if(captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Top || captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Bottom) {
25318    tableRows[1].appendChild(helpTextCell);
25319    tableRows[0].appendChild(this.createEmptyCell(errorCellPosition === ASPx.Position.Top));
25320    tableRows[2].appendChild(this.createEmptyCell(errorCellPosition !== ASPx.Position.Top));
25321   }
25322   if(captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Top) {
25323    tableRows[2].appendChild(helpTextCell);
25324    tableRows[0].appendChild(this.createEmptyCell(false));
25325    tableRows[1].appendChild(this.createEmptyCell(true));
25326   }
25327   if(captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Bottom) {
25328    tableRows[0].appendChild(helpTextCell);
25329    tableRows[1].appendChild(this.createEmptyCell(true));
25330    tableRows[2].appendChild(this.createEmptyCell(false));
25331   }
25332   if(captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Right) {
25333    tableRows[0].appendChild(helpTextCell);
25334    tableRows[1].appendChild(this.createEmptyCell());
25335   }
25336   if(captionPosition === ASPx.Position.Right && this.isVertical(errorCellPosition)) {
25337    captionCell.parentNode.insertBefore(helpTextCell, captionCell);
25338    var emptyCellParentRow = errorCellPosition === ASPx.Position.Top ? tableRows[0] : tableRows[1];
25339    var helpTextCellIndex = this.getCellIndex(helpTextCell.parentNode, helpTextCell);
25340    emptyCellParentRow.insertBefore(this.createEmptyCell(), this.getCellByIndex(emptyCellParentRow, helpTextCellIndex));
25341   }
25342  }
25343  if(captionPosition === ASPx.Position.Top && this.position === ASPx.Position.Top && this.isHorizontal(errorCellPosition)) {
25344   if(errorCellPosition === ASPx.Position.Left) {
25345    helpTextRow.appendChild(this.createEmptyCell(true));
25346    helpTextRow.appendChild(helpTextCell);
25347   }
25348   else {
25349    helpTextRow.appendChild(helpTextCell);
25350    helpTextRow.appendChild(this.createEmptyCell());
25351   }
25352   errorTableBody.insertBefore(helpTextRow, captionCell.parentNode.nextSibling);
25353  }
25354  if(captionPosition === ASPx.Position.Bottom && this.position === ASPx.Position.Top && this.isHorizontal(errorCellPosition)) {
25355   if(errorCellPosition === ASPx.Position.Left) {
25356    helpTextRow.appendChild(this.createEmptyCell(true));
25357    helpTextRow.appendChild(helpTextCell);
25358   }
25359   else {
25360    helpTextRow.appendChild(helpTextCell);
25361    helpTextRow.appendChild(this.createEmptyCell());
25362   }
25363   errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
25364  }
25365  if(captionPosition === ASPx.Position.Bottom && this.position === ASPx.Position.Bottom && this.isHorizontal(errorCellPosition)) {
25366   if(errorCellPosition === ASPx.Position.Left) {
25367    helpTextRow.appendChild(this.createEmptyCell(true));
25368    helpTextRow.appendChild(helpTextCell);
25369   }
25370   else {
25371    helpTextRow.appendChild(helpTextCell);
25372    helpTextRow.appendChild(this.createEmptyCell());
25373   }
25374   errorTableBody.insertBefore(helpTextRow, captionCell.parentNode);
25375  }
25376  if(captionPosition === ASPx.Position.Top && this.position === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Left) {
25377   helpTextRow.appendChild(this.createEmptyCell(true));
25378   helpTextRow.appendChild(helpTextCell);
25379   errorTableBody.appendChild(helpTextRow);
25380  }
25381  if(captionPosition === ASPx.Position.Right && this.position === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Bottom) {
25382   helpTextRow.appendChild(helpTextCell);
25383   helpTextRow.appendChild(this.createEmptyCell());
25384   errorTableBody.appendChild(helpTextRow);
25385  }
25386  if(this.position === ASPx.Position.Bottom) {
25387   if(captionPosition === ASPx.Position.Left && errorCellPosition === ASPx.Position.Right || captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Left) {
25388    helpTextRow.appendChild(this.createEmptyCell(errorCellPosition !== ASPx.Position.Right));
25389    helpTextRow.appendChild(helpTextCell);
25390    helpTextRow.appendChild(this.createEmptyCell(errorCellPosition === ASPx.Position.Right));
25391    errorTableBody.appendChild(helpTextRow);
25392   }
25393   if(captionPosition === ASPx.Position.Left && errorCellPosition === ASPx.Position.Left) {
25394    helpTextRow.appendChild(this.createEmptyCell(false));
25395    helpTextRow.appendChild(this.createEmptyCell(true));
25396    helpTextRow.appendChild(helpTextCell);
25397    errorTableBody.appendChild(helpTextRow);
25398   }
25399   if(captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Right) {
25400    helpTextRow.appendChild(helpTextCell);
25401    helpTextRow.appendChild(this.createEmptyCell(true));
25402    helpTextRow.appendChild(this.createEmptyCell(false));
25403    errorTableBody.appendChild(helpTextRow);
25404   }   
25405  }
25406  if(this.position === ASPx.Position.Top) {
25407   if(captionPosition === ASPx.Position.Left && errorCellPosition === ASPx.Position.Right || captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Left) {
25408    helpTextRow.appendChild(this.createEmptyCell(errorCellPosition !== ASPx.Position.Right));
25409    helpTextRow.appendChild(helpTextCell);
25410    helpTextRow.appendChild(this.createEmptyCell(errorCellPosition === ASPx.Position.Right));
25411    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
25412   }
25413   if(captionPosition === ASPx.Position.Left && errorCellPosition === ASPx.Position.Left) {
25414    helpTextRow.appendChild(this.createEmptyCell(false));
25415    helpTextRow.appendChild(this.createEmptyCell(true));
25416    helpTextRow.appendChild(helpTextCell);
25417    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
25418   }
25419   if(captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Right) {
25420    helpTextRow.appendChild(helpTextCell);
25421    helpTextRow.appendChild(this.createEmptyCell(true));
25422    helpTextRow.appendChild(this.createEmptyCell(false));
25423    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
25424   }
25425  }
25426 },
25427 addHelpTextCellToExternalTableWithErrorCell: function (errorCell, helpTextCell, errorTableBody, tableRows) {
25428  var errorCellPosition = this.editor.errorCellPosition;
25429  var helpTextRow = document.createElement("TR");
25430  if(this.position === ASPx.Position.Left && this.isHorizontal(errorCellPosition))
25431   tableRows[0].insertBefore(helpTextCell, tableRows[0].childNodes[0]);
25432  if(this.position === ASPx.Position.Right && this.isHorizontal(errorCellPosition))
25433   tableRows[0].appendChild(helpTextCell);
25434  if(this.position === ASPx.Position.Top && this.isVertical(errorCellPosition)) {
25435   helpTextRow.appendChild(helpTextCell);
25436   
25436errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
25437  }
25438  if(this.position === ASPx.Position.Bottom && this.isVertical(errorCellPosition)) {
25439   helpTextRow.appendChild(helpTextCell);
25440   errorTableBody.appendChild(helpTextRow);
25441  }
25442  if(errorCellPosition === ASPx.Position.Left && this.isVertical(this.position)) {
25443   helpTextRow.appendChild(this.createEmptyCell(true));
25444   helpTextRow.appendChild(helpTextCell);
25445   if(this.position === ASPx.Position.Top)
25446    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
25447   else
25448    errorTableBody.appendChild(helpTextRow);
25449  }
25450  if(errorCellPosition === ASPx.Position.Right && this.isVertical(this.position)) {
25451   helpTextRow.appendChild(helpTextCell);
25452   helpTextRow.appendChild(this.createEmptyCell(true));
25453   if(this.position === ASPx.Position.Top)
25454    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
25455   else
25456    errorTableBody.appendChild(helpTextRow);
25457  }
25458  if(this.position === ASPx.Position.Left && this.isVertical(errorCellPosition)) {
25459   var helpTextParentRowIndex = errorCellPosition === ASPx.Position.Top ? 1 : 0;
25460   var emptyCellRowIndex = helpTextParentRowIndex === 0 ? 1 : 0;
25461   tableRows[helpTextParentRowIndex].insertBefore(helpTextCell, tableRows[helpTextParentRowIndex].childNodes[0]);
25462   tableRows[emptyCellRowIndex].insertBefore(this.createEmptyCell(true), tableRows[emptyCellRowIndex].childNodes[0]);
25463  }
25464  if(this.position === ASPx.Position.Right && this.isVertical(errorCellPosition)) {
25465   var helpTextParentRowIndex = errorCellPosition === ASPx.Position.Top ? 1 : 0;
25466   var emptyCellRowIndex = helpTextParentRowIndex === 0 ? 1 : 0;
25467   tableRows[helpTextParentRowIndex].appendChild(helpTextCell);
25468   tableRows[emptyCellRowIndex].appendChild(this.createEmptyCell(true));
25469  }
25470 },
25471 addHelpTextCellToExternalTableWithCaption: function (captionCell, helpTextCell, errorTableBody, tableRows) {
25472  var captionPosition = this.editor.captionPosition;
25473  var helpTextRow = document.createElement("TR");
25474  if(captionPosition === ASPx.Position.Left && this.isVertical(this.position)) {
25475   helpTextRow.appendChild(this.createEmptyCell());
25476   helpTextRow.appendChild(helpTextCell);
25477   if(this.position === ASPx.Position.Top)
25478    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
25479   else
25480    errorTableBody.appendChild(helpTextRow);
25481  }
25482  if(this.position === ASPx.Position.Left && this.isVertical(captionPosition)) {
25483   var helpTextParentRowIndex = captionPosition === ASPx.Position.Top ? 1 : 0;
25484   var emptyCellParentRowIndex = helpTextParentRowIndex === 0 ? 1 : 0;
25485   tableRows[helpTextParentRowIndex].insertBefore(helpTextCell, tableRows[helpTextParentRowIndex].childNodes[0]);
25486   tableRows[emptyCellParentRowIndex].insertBefore(this.createEmptyCell(), tableRows[emptyCellParentRowIndex].childNodes[0]);
25487  }
25488  if(this.position === ASPx.Position.Right && this.isVertical(captionPosition)) {
25489   var helpTextParentRowIndex = captionPosition === ASPx.Position.Top ? 1 : 0;
25490   var emptyCellParentRowIndex = helpTextParentRowIndex === 0 ? 1 : 0;
25491   tableRows[helpTextParentRowIndex].appendChild(helpTextCell);
25492   tableRows[emptyCellParentRowIndex].appendChild(this.createEmptyCell());
25493  }
25494  if(captionPosition === ASPx.Position.Right && this.isVertical(this.position)) {
25495   helpTextRow.appendChild(helpTextCell);
25496   helpTextRow.appendChild(this.createEmptyCell());
25497   if(this.position === ASPx.Position.Top)
25498    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
25499   else
25500    errorTableBody.appendChild(helpTextRow);
25501  }
25502  if(this.isVertical(captionPosition) && this.isVertical(this.position)) {
25503   helpTextRow.appendChild(helpTextCell);
25504   if(captionPosition === ASPx.Position.Top && this.position === ASPx.Position.Top)
25505    errorTableBody.insertBefore(helpTextRow, captionCell.parentNode.nextSibling);
25506   if(captionPosition === ASPx.Position.Top && this.position === ASPx.Position.Bottom)
25507    errorTableBody.appendChild(helpTextRow);
25508   if(captionPosition === ASPx.Position.Bottom && this.position === ASPx.Position.Top)
25509    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
25510   if(captionPosition === ASPx.Position.Bottom && this.position === ASPx.Position.Bottom)
25511    errorTableBody.insertBefore(helpTextRow, captionCell.parentNode);
25512  }
25513  if(captionPosition === ASPx.Position.Left && this.position === ASPx.Position.Left)
25514   captionCell.parentNode.insertBefore(helpTextCell, captionCell.nextSibling);
25515  if(captionPosition === ASPx.Position.Right && this.position === ASPx.Position.Right)
25516   captionCell.parentNode.insertBefore(helpTextCell, captionCell);
25517  if(captionPosition === ASPx.Position.Left && this.position === ASPx.Position.Right)
25518   tableRows[0].appendChild(helpTextCell);
25519  if(captionPosition === ASPx.Position.Right && this.position === ASPx.Position.Left)
25520   tableRows[0].insertBefore(helpTextCell, tableRows[0].childNodes[0]);
25521 },
25522 addHelpTextCellToExternalTableWithEditorOnly: function (helpTextCell, errorTableBody, tableRows) {
25523  if(this.isHorizontal(this.position)) {
25524   if(this.position === ASPx.Position.Left)
25525    tableRows[0].insertBefore(helpTextCell, tableRows[0].childNodes[0]);
25526   else
25527    tableRows[0].appendChild(helpTextCell);
25528  }
25529  else {
25530   var helpTextRow = document.createElement("TR");
25531   helpTextRow.appendChild(helpTextCell);
25532   if(this.position === ASPx.Position.Top)
25533    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
25534   else
25535    errorTableBody.appendChild(helpTextRow);
25536  }
25537 },
25538 addHelpTextCellToExternalTable: function (errorTable, helpTextCell) {
25539  var errorTableBody = ASPx.GetNodeByTagName(errorTable, "TBODY", 0);
25540  var tableRows = this.getRows(errorTableBody);
25541  var captionCell = this.editor.GetCaptionCell();
25542  var errorCell = this.editor.GetErrorCell();
25543  if(captionCell) {
25544   if(errorCell)
25545    this.addHelpTextCellToExternalTableWithTwoCells(captionCell, errorCell, helpTextCell, errorTableBody, tableRows);
25546   else
25547    this.addHelpTextCellToExternalTableWithCaption(captionCell, helpTextCell, errorTableBody, tableRows);
25548  }
25549  else if(errorCell)
25550   this.addHelpTextCellToExternalTableWithErrorCell(errorCell, helpTextCell, errorTableBody, tableRows);
25551  else
25552   this.addHelpTextCellToExternalTableWithEditorOnly(helpTextCell, errorTableBody, tableRows);
25553 },
25554 createExternalTable: function () {
25555  var externalTable = document.createElement("TABLE");
25556  externalTable.id = this.editor.name + ASPx.EditElementSuffix.ExternalTable;
25557  externalTable.cellPadding = 0;
25558  externalTable.cellSpacing = 0;
25559  this.applyExternalTableStyle(externalTable);
25560  var editorWidth = this.editorMainElement.style.width;
25561  if(ASPx.IsPercentageSize(editorWidth)) {
25562   externalTable.style.width = editorWidth;
25563   this.editorMainElement.style.width = "100%";
25564   this.editor.width = "100%";
25565  }
25566  var externalTableBody = document.createElement("TBODY");
25567  var externalTableRow = document.createElement("TR");
25568  var externalTableCell = document.createElement("TD");
25569  externalTable.appendChild(externalTableBody);
25570  externalTableBody.appendChild(externalTableRow);
25571  externalTableRow.appendChild(externalTableCell);
25572  this.editorMainElement.parentNode.appendChild(externalTable);
25573  ASPx.ChangeElementContainer(this.editorMainElement, externalTableCell, true);
25574  return externalTable;
25575 },
25576 applyExternalTableStyle: function (externalTable) {
25577  var externalTableStyle = this.editor.externalTableStyle;
25578  if(externalTableStyle.length > 0) {
25579   this.applyStyleToElement(externalTable, externalTableStyle);
25580  }
25581 },
25582 applyStyleToElement: function(element, style) {
25583  element.className = style[0];
25584  if(style[1]) {
25585   var styleSheet = ASPx.GetCurrentStyleSheet();
25586   element.className += " " + ASPx.CreateImportantStyleRule(styleSheet, style[1]);
25587  }
25588 },
25589 createInlineHelpTextElement: function () {
25590  var helpTextElement = document.createElement("TD");
25591  var externalTable = this.editor.GetExternalTable();
25592  if(!externalTable)
25593   externalTable = this.createExternalTable();
25594  this.addHelpTextCellToExternalTable(externalTable, helpTextElement);
25595  return helpTextElement;
25596 },
25597 createPopupHelpTextElement: function () {
25598  var helpTextElement = document.createElement("DIV");
25599  ASPx.InsertElementAfter(helpTextElement, this.editor.GetMainElement());
25600  ASPx.AnimationHelper.setOpacity(helpTextElement, 0);
25601  ASPx.SetElementDisplay(helpTextElement, false);
25602  return helpTextElement;
25603 },
25604 createHelpTextElement: function () {
25605  return this.displayMode === ASPxClientTextEditHelpTextDisplayMode.Popup ?
25606   this.createPopupHelpTextElement() : this.createInlineHelpTextElement();
25607 },
25608 prepareHelpTextElement: function (helpTextStyle, helpText) {
25609  this.helpTextElement.id = this.getHelpTextElementId();
25610  this.applyStyleToElement(this.helpTextElement, helpTextStyle);
25611  ASPx.SetInnerHtml(this.helpTextElement, "<SPAN>" + helpText + "</SPAN>");
25612  if(this.displayMode === ASPxClientTextEditHelpTextDisplayMode.Popup)
25613   this.updatePopupHelpTextPosition();
25614  else {
25615   var isVerticalOrientation = this.position === ASPx.Position.Top || this.position === ASPx.Position.Bottom;
25616   var orientationClassName = isVerticalOrientation ? ASPxClientTextEditHelpTextConsts.VERTICAL_ORIENTATION_CLASS_NAME :
25617    ASPxClientTextEditHelpTextConsts.HORIZONTAL_ORIENTATION_CLASS_NAME;
25618   this.helpTextElement.className += " " + orientationClassName;
25619   this.setInlineHelpTextElementAlign();
25620   ASPx.SetElementDisplay(this.helpTextElement, this.editor.clientVisible);
25621  }
25622 },
25623 getHelpTextElementId: function() {
25624  return this.editor.name + ASPx.TEHelpTextElementSuffix;
25625 },
25626 setInlineHelpTextElementAlign: function() {
25627  var hAlignValue = "", vAlignValue = "";
25628  switch(this.hAlign) {
25629   case ASPxClientTextEditHelpTextHAlign.Left: hAlignValue = "left"; break;
25630   case ASPxClientTextEditHelpTextHAlign.Right: hAlignValue = "right"; break;
25631   case ASPxClientTextEditHelpTextHAlign.Center: hAlignValue = "center"; break;
25632  }
25633  switch(this.vAlign) {
25634   case ASPxClientTextEditHelpTextVAlign.Top: vAlignValue = "top"; break;
25635   case ASPxClientTextEditHelpTextVAlign.Bottom: vAlignValue = "bottom"; break;
25636   case ASPxClientTextEditHelpTextVAlign.Middle: vAlignValue = "middle"; break;
25637  }
25638  this.helpTextElement.style.textAlign = hAlignValue;
25639  this.helpTextElement.style.verticalAlign = vAlignValue;
25640 },
25641 getHelpTextMargins: function() {
25642  if(this.margins)
25643   return this.margins;
25644  var result = this.defaultMargins;
25645  if(this.position === ASPx.Position.Top || this.position === ASPx.Position.Bottom)
25646   result.Left = result.Right = 0;
25647  else
25648   result.Top = result.Bottom = 0;
25649  return result;
25650 },
25651 updatePopupHelpTextPosition: function (editorMainElement) {
25652  var editorWidth = this.editorMainElement.offsetWidth;
25653  var editorHeight = this.editorMainElement.offsetHeight;
25654  var helpTextWidth = this.helpTextElement.offsetWidth;
25655  var helpTextHeight = this.helpTextElement.offsetHeight;
25656  var editorX = ASPx.GetAbsoluteX(this.editorMainElement);
25657  var editorY = ASPx.GetAbsoluteY(this.editorMainElement);
25658  var helpTextX = 0, helpTextY = 0;
25659  var margins = this.getHelpTextMargins();
25660  if(this.position === ASPx.Position.Top || this.position === ASPx.Position.Bottom) {
25661   if(this.position === ASPx.Position.Top)
25662    helpTextY = editorY - margins.Bottom - helpTextHeight;
25663   else if(this.position === ASPx.Position.Bottom)
25664    helpTextY = editorY + editorHeight + margins.Top;
25665   if(this.hAlign === ASPxClientTextEditHelpTextHAlign.Left)
25666    helpTextX = editorX + margins.Left;
25667   else if(this.hAlign === ASPxClientTextEditHelpTextHAlign.Right)
25668    helpTextX = editorX + editorWidth - helpTextWidth - margins.Right;
25669   else if(this.hAlign === ASPxClientTextEditHelpTextHAlign.Center) {
25670    var editorCenterX = editorX + editorWidth / 2;
25671    var helpTextWidthWithMargins = helpTextWidth + margins.Left + margins.Right;
25672    helpTextX = editorCenterX - helpTextWidthWithMargins / 2 + margins.Left;
25673   }
25674  } else {
25675   if(this.position === ASPx.Position.Left)
25676    helpTextX = editorX - margins.Right - helpTextWidth;
25677   else if(this.position === ASPx.Position.Right)
25678    helpTextX = editorX + editorWidth + margins.Left;
25679   if(this.vAlign === ASPxClientTextEditHelpTextVAlign.Top)
25680    helpTextY = editorY + margins.Top;
25681   else if(this.vAlign === ASPxClientTextEditHelpTextVAlign.Bottom)
25682    helpTextY = editorY + editorHeight - helpTextHeight - margins.Bottom;
25683   else if(this.vAlign === ASPxClientTextEditHelpTextVAlign.Middle) {
25684    var editorCenterY = editorY + editorHeight / 2;
25685    var helpTextHeightWithMargins = helpTextHeight + margins.Top + margins.Bottom;
25686    helpTextY = editorCenterY - helpTextHeightWithMargins / 2 + margins.Top;
25687   }
25688  }
25689  helpTextX = helpTextX < 0 ? 0 : helpTextX;
25690  helpTextY = helpTextY < 0 ? 0 : helpTextY;
25691  ASPx.SetAbsoluteX(this.helpTextElement, helpTextX);
25692  ASPx.SetAbsoluteY(this.helpTextElement, helpTextY);
25693 },
25694 setHelpTextZIndex: function (hide) { 
25695  var newZIndex = 41998 * (hide ? -1 : 1);
25696  if(this.helpTextElement.style.zIndex != newZIndex)
25697   this.helpTextElement.style.zIndex = newZIndex;
25698 },
25699 hide: function () {
25700  if(this.displayMode === ASPxClientTextEditHelpTextDisplayMode.Inline) {
25701   ASPx.SetElementDisplay(this.helpTextElement, false);
25702  }
25703  else
25704   this.hidePopupHelpText();
25705 },
25706 hidePopupHelpText: function() {
25707  var onHidePopupHelpTextComplete = function () {
25708   this.setHelpTextZIndex(true);
25709   ASPx.SetElementDisplay(this.helpTextElement, false);
25710  }.aspxBind(this);
25711  if(this.animationEnabled)
25712   ASPx.AnimationHelper.fadeOut(this.helpTextElement, onHidePopupHelpTextComplete);
25713  else {
25714   ASPx.AnimationHelper.setOpacity(this.helpTextElement, 0);
25715   onHidePopupHelpTextComplete();
25716  }    
25717 },
25718 show: function () {
25719  if(this.displayMode === ASPxClientTextEditHelpTextDisplayMode.Inline) {
25720   ASPx.SetElementDisplay(this.helpTextElement, true);
25721  }
25722  else
25723   this.showPopupHelpText();
25724 },
25725 showPopupHelpText: function () {
25726  ASPx.SetElementDisplay(this.helpTextElement, true);
25727  this.updatePopupHelpTextPosition();
25728  if(this.animationEnabled)
25729   ASPx.AnimationHelper.fadeIn(this.helpTextElement);
25730  else
25731   ASPx.AnimationHelper.setOpacity(this.helpTextElement, 1);
25732  this.setHelpTextZIndex(false);
25733 }
25734});
25735var ASPxOutOfRangeWarningManager = ASPx.CreateClass(null, {
25736 constructor: function (editor, minValue, maxValue, defaultMinValue, defaultMaxValue, outOfRangeWarningElementPosition, valueFormatter) {
25737  this.editor = editor;
25738  this.outOfRangeWarningElementPosition = outOfRangeWarningElementPosition;
25739  this.minValue = minValue;
25740  this.maxValue = maxValue;
25741  this.defaultMinValue = defaultMinValue;
25742  this.defaultMaxValue = defaultMaxValue;
25743  this.minMaxValueFormatter = valueFormatter;
25744  this.animationDuration = 150;
25745  this.CreateOutOfRangeWarningElement();
25746 },
25747 SetMinValue: function (minValue) {
25748  this.minValue = minValue;
25749  this.UpdateOutOfRangeWarningElementText();
25750 },
25751 SetMaxValue: function (maxValue) {
25752  this.maxValue = maxValue;
25753  this.UpdateOutOfRangeWarningElementText();
25754 },
25755 CreateOutOfRangeWarningElement: function () {
25756  this.outOfRangeWarningElement = document.createElement("DIV");
25757  this.outOfRangeWarningElement.id = this.editor.name + "OutOfRWarn";
25758  ASPx.InsertElementAfter(this.outOfRangeWarningElement, this.editor.GetOutOfRangeWarningElementPrevSibling());
25759  ASPx.AnimationHelper.setOpacity(this.outOfRangeWarningElement, 0);
25760  this.outOfRangeWarningElement.className = this.editor.outOfRangeWarningClassName;
25761  this.UpdateOutOfRangeWarningElementText();
25762 },
25763 IsValueInRange: function (value) {
25764  return (!this.IsMinValueExists() || value >= this.minValue)
25765   && (!this.IsMaxValueExists() || value <= this.maxValue);
25766 },
25767 IsMinValueExists: function() {
25768  return ASPx.IsExists(this.minValue) && !isNaN(this.minValue) && this.minValue !== this.defaultMinValue;
25769 },
25770 IsMaxValueExists: function () {
25771  return ASPx.IsExists(this.maxValue) && !isNaN(this.maxValue) && this.maxValue !== this.defaultMaxValue;
25772 },
25773 GetFormattedTextByValue: function(value) {
25774  if (this.minMaxValueFormatter)
25775   return this.minMaxValueFormatter.Format(value);
25776  return value;
25777 },
25778 GetWarningText: function() {
25779  var textTemplate = arguments[0];
25780  var valueTexts = [];
25781  for (var i = 1; i < arguments.length; i++) {
25782   var valueText = this.GetFormattedTextByValue(arguments[i]);
25783   valueTexts.push(valueText);
25784  }
25785  return ASPx.Formatter.Format(textTemplate, valueTexts);
25786 },
25787 UpdateOutOfRangeWarningElementText: function () {
25788  var text = "";
25789  if (this.IsMinValueExists() && this.IsMaxValueExists())
25790   text = this.GetWarningText(this.editor.outOfRangeWarningMessages[0], this.minValue, this.maxValue);
25791  if (this.IsMinValueExists() && !this.IsMaxValueExists())
25792   text = this.GetWarningText(this.editor.outOfRangeWarningMessages[1], this.minValue);
25793  if (!this.IsMinValueExists() && this.IsMaxValueExists())
25794   text = this.GetWarningText(this.editor.outOfRangeWarningMessages[2], this.maxValue);
25795  ASPx.SetInnerHtml(this.outOfRangeWarningElement, "<LABEL>" + text + "</LABEL>");
25796 },
25797 UpdateOutOfRangeWarningElementVisibility: function (currentValue) {
25798  var isValidValue = currentValue == null || this.IsValueInRange(currentValue);
25799  if (!isValidValue && !this.outOfRangeWarningElementShown)
25800   this.ShowOutOfRangeWarningElement();
25801  if (isValidValue && this.outOfRangeWarningElementShown)
25802   this.HideOutOfRangeWarningElement();
25803 },
25804 GetOutOfRangeWarningElementCoordinates: function() {
25805  var editorMainElement = this.editor.GetMainElement();
25806  var editorWidth = editorMainElement.offsetWidth;
25807  var editorHeight = editorMainElement.offsetHeight;
25808  var editorX = ASPx.GetAbsoluteX(editorMainElement);
25809  var editorY = ASPx.GetAbsoluteY(editorMainElement);
25810  var outOfRangeWarningElementX = this.outOfRangeWarningElementPosition === ASPx.Position.Right ? editorX + editorWidth : editorX;
25811  var outOfRangeWarningElementY = this.outOfRangeWarningElementPosition === ASPx.Position.Right ? editorY : editorY + editorHeight;
25812  outOfRangeWarningElementX = outOfRangeWarningElementX < 0 ? 0 : outOfRangeWarningElementX;
25813  outOfRangeWarningElementY = outOfRangeWarningElementY < 0 ? 0 : outOfRangeWarningElementY;
25814  return {
25815   x: outOfRangeWarningElementX,
25816   y: outOfRangeWarningElementY
25817  };
25818 },
25819 ShowOutOfRangeWarningElement: function () {
25820  this.outOfRangeWarningElement.style.display = "inline";
25821  var outOfRangeWarningElementCoordinates = this.GetOutOfRangeWarningElementCoordinates();
25822  ASPx.SetAbsoluteX(this.outOfRangeWarningElement, outOfRangeWarningElementCoordinates.x);
25823  ASPx.SetAbsoluteY(this.outOfRangeWarningElement, outOfRangeWarningElementCoordinates.y);
25824  ASPx.AnimationHelper.fadeIn(this.outOfRangeWarningElement, null, this.animationDuration);
25825  this.ScrollToWarningElementIfRequired(outOfRangeWarningElementCoordinates);
25826  this.outOfRangeWarningElementShown = true;
25827 },
25828 HideOutOfRangeWarningElement: function () {
25829  ASPx.AnimationHelper.fadeOut(this.outOfRangeWarningElement, function () {
25830   ASPx.SetElementDisplay(this.outOfRangeWarningElement, false);
25831  }.aspxBind(this), this.animationDuration);
25832  this.outOfRangeWarningElementShown = false;
25833 },
25834 ScrollToWarningElementIfRequired: function (outOfRangeWarningElementCoordinates) {
25835  if(this.outOfRangeWarningElementPosition === ASPx.Position.Right) {
25836   var warnElementRightPos = outOfRangeWarningElementCoordinates.x
25837    + ASPx.PxToInt(ASPx.GetCurrentStyle(this.outOfRangeWarningElement).marginLeft)
25838    + this.outOfRangeWarningElement.offsetWidth;
25839   if(warnElementRightPos > ASPx.GetDocumentClientWidth() + ASPx.GetDocumentScrollLeft())
25840    ASPx.SetDocumentScrollLeft(warnElementRightPos - ASPx.GetDocumentClientWidth());
25841  }
25842  if(this.outOfRangeWarningElementPosition === ASPx.Position.Bottom) {
25843   var warnElementBottomPos = outOfRangeWarningElementCoordinates.y
25844    + ASPx.PxToInt(ASPx.GetCurrentStyle(this.outOfRangeWarningElement).marginTop)
25845    + this.outOfRangeWarningElement.offsetHeight;
25846   if(warnElementBottomPos > ASPx.GetDocumentClientHeight() + ASPx.GetDocumentScrollTop())
25847    ASPx.SetDocumentScrollTop(warnElementBottomPos - ASPx.GetDocumentClientHeight());
25848  }
25849 }
25850});
25851ASPx.MMMouseOut = function(name, evt) {
25852 var edit = ASPx.GetControlCollection().Get(name);
25853 if(edit != null) edit.OnMouseOut(evt);
25854};
25855ASPx.MMMouseOver = function(name, evt) {
25856 var edit = ASPx.GetControlCollection().Get(name);
25857 if(edit != null) edit.OnMouseOver(evt);
25858};
25859ASPx.MaskHintTimerProc = function() {
25860 var focusedEditor = ASPx.GetFocusedEditor();
25861 if(focusedEditor != null && ASPx.IsFunction(focusedEditor.MaskHintTimerProc))
25862  focusedEditor.MaskHintTimerProc();
25863};
25864ASPx.ETextChanged = function(name) {
25865 var edit = ASPx.GetControlCollection().Get(name);
25866 if(edit != null) edit.OnTextChanged(); 
25867};
25868ASPx.BEClick = function(name,number){
25869 var edit = ASPx.GetControlCollection().Get(name);
25870 if(edit != null) edit.OnButtonClick(number);
25871};
25872ASPx.BEClear = function(name, evt) {
25873 var edit = ASPx.GetControlCollection().Get(name);
25874 if(edit && (evt.button === 0 || ASPx.Browser.TouchUI)) {
25875  var requireFocus = !ASPx.Browser.VirtualKeyboardSupported || ASPx.Browser.MSTouchUI;
25876  (function performOnClean() {
25877   if(edit.ownerListBox)
25878    edit.ownerListBox.ForceLockFocusEvents();
25879   if(requireFocus && !edit.IsFocused())
25880    edit.GetInputElement().focus();
25881   if(edit.IsFocused() || !requireFocus) {
25882    if(edit.ownerListBox)
25883     edit.ownerListBox.UnlockFocusEvents();
25884    edit.OnClear();
25885   }
25886   else
25887    window.setTimeout(performOnClean, 100);
25888  })();
25889 }
25890};
25891ASPx.SetFocusToTextEditWithDelay = function(name) {
25892 window.setTimeout(function() {
25893  var edit = ASPx.GetControlCollection().Get(name);
25894  if(!edit)
25895   return;
25896  if(ASPx.Browser.IE)
25897   edit.SetCaretPosition(0);
25898  else
25899   edit.SetFocus();
25900 }, 500);
25901};
25902window.ASPxClientTextEdit = ASPxClientTextEdit;
25903window.ASPxClientTextBoxBase = ASPxClientTextBoxBase;
25904window.ASPxClientTextBox = ASPxClientTextBox;
25905window.ASPxClientMemo = ASPxClientMemo;
25906window.ASPxClientButtonEditBase = ASPxClientButtonEditBase;
25907window.ASPxClientButtonEdit = ASPxClientButtonEdit;
25908window.ASPxClientButtonEditClickEventArgs = ASPxClientButtonEditClickEventArgs;
25909})();
25910
25911(function() {
25912var ASPxClientButton = ASPx.CreateClass(ASPxClientControl, {
25913 constructor: function(name) {
25914  this.constructor.prototype.constructor.call(this, name);
25915  this.isASPxClientButton = true;
25916  this.allowFocus = true;
25917  this.autoPostBackFunction = null;
25918  this.causesValidation = true;
25919  this.checked = false;
25920  this.clickLocked = false;
25921  this.groupName = "";
25922  this.focusElementSelected = false;
25923  this.pressed = false;
25924  this.useSubmitBehavior = true;
25925  this.validationGroup = "";
25926  this.validationContainerID = null;
25927  this.validateInvisibleEditors = false;
25928  this.originalWidth = null;
25929  this.originalHeight = null;
25930  this.needUpdateBounds = true;
25931  this.isTextEmpty = false;
25932  this.CheckedChanged = new ASPxClientEvent();
25933  this.GotFocus = new ASPxClientEvent();
25934  this.LostFocus = new ASPxClientEvent();
25935  this.Click = new ASPxClientEvent();
25936 },
25937 InlineInitialize: function() {
25938  var mainElement = this.GetMainElement();
25939  this.originalWidth = mainElement.style.width;
25940  this.originalHeight = mainElement.style.height;
25941  ASPxClientControl.prototype.InlineInitialize.call(this);
25942  this.InitializeElementIDs();
25943  this.InitializeEvents();
25944  this.InitializeEnabled();
25945  this.InitializeChecked();
25946  if(this.IsLink())
25947   this.InitializeLink();
25948  this.PreventButtonImageDragging();
25949  this.needUpdateBounds = ASPx.GetCurrentStyle(mainElement).display.indexOf("table") === -1;
25950  if(this.needUpdateBounds)
25951   mainElement.className = mainElement.className.replace("dxbTSys", "");
25952  else {
25953   var contentElement = this.GetContentDiv();
25954   if(contentElement) contentElement.style.verticalAlign = mainElement.style.verticalAlign;
25955  }
25956 },
25957 InitializeElementIDs: function(){
25958  var mainElement = this.GetMainElement();
25959  var contentElement = ASPx.GetNodeByTagName(mainElement, "DIV", 0);
25960  if(contentElement) contentElement.id = this.name + "_CD";
25961  var imageElement = ASPx.GetNodeByTagName(mainElement, "IMG", 0);
25962  if(imageElement) imageElement.id = this.name + "Img";
25963 },
25964 InitializeEnabled: function(){
25965  this.SetEnabledInternal(this.clientEnabled, true);
25966 },
25967 InitializeChecked: function(){
25968  this.SetCheckedInternal(this.checked, true);
25969 },
25970 InitializeLink: function(){
25971  var mainElement = this.GetMainElement();
25972  if(this.enabled)
25973   mainElement.href = "javascript:;";
25974  if(!this.allowFocus)
25975   mainElement.style.outline = 0;
25976  if(!this.GetTextContainer())
25977   mainElement.style.fontSize = "0pt";
25978 },
25979 InitializeEvents: function(){
25980  if(!this.isNative && !this.IsLink()) {
25981   var element = this.GetInternalButton();
25982   if(element)
25983    element.onfocus = null;
25984   var textControl = this.GetTextControl();
25985   if(textControl) {
25986    if(ASPx.Browser.IE)
25987     ASPx.Evt.AttachEventToElement(textControl, "mouseup", ASPx.Selection.Clear);
25988    ASPx.Evt.PreventElementDragAndSelect(textControl, false);
25989   }    
25990  }
25991  this.onClick = function(evt) {
25992   var processOnServer = ASPx.BClick(this.name, evt);
25993   if(!processOnServer)
25994    ASPx.Evt.PreventEvent(evt);
25995   return processOnServer;
25996  }.aspxBind(this);
25997  this.onImageMoseDown = function() { var el = ASPx.GetFocusedElement(); if(el) el.blur(); };
25998  this.onGotFocus = function() { this.OnFocus(); }.aspxBind(this);
25999  this.onLostFocus = function() { this.OnLostFocus(); }.aspxBind(this);
26000  this.onKeyUp = function(evt) { this.OnKeyUp(evt); }.aspxBind(this);
26001  this.onKeyDown = function(evt) { this.OnKeyDown(evt); }.aspxBind(this); 
26002  if(!this.isNative && !this.IsLink())
26003   this.InitializeNativeHandlers();
26004 },
26005 InitializeNativeHandlers: function() {
26006  this.AttachNativeHandlerToMainElement("focus", "SetFocus");
26007  this.AttachNativeHandlerToMainElement("click", "DoClick");
26008 },
26009 AdjustControlCore: function () {
26010  if(this.isNative || this.IsLink()) return;
26011  var buttonImage = this.GetButtonImage();  
26012  if(buttonImage && buttonImage.offsetHeight === 0 && buttonImage.offsetWidth === 0)
26013   buttonImage.onload = function() { this.UpdateSize(); }.aspxBind(this);
26014  else
26015   this.UpdateSize();
26016 },
26017 UpdateSize: function(){
26018  if(this.needUpdateBounds){
26019   this.UpdateWidth();
26020   this.UpdateHeight();
26021  }
26022  else
26023   this.CorrectWrappedText(this.GetContentDiv, "Text", true);
26024 },
26025 UpdateHeight: function(){
26026  if(this.isNative || this.IsLink() || this.originalHeight === null || ASPx.IsPercentageSize(this.originalHeight)) return;
26027  var height;
26028  var mainElement = this.GetMainElement();
26029  var contentDiv = this.GetContentDiv();
26030  var borderAndPadding = ASPx.GetTopBottomBordersAndPaddingsSummaryValue(mainElement);
26031  var contentHasExcessiveHeight = contentDiv.offsetHeight > mainElement.offsetHeight - borderAndPadding;
26032  var needSetAutoHeight = !this.originalHeight || (ASPx.Browser.Safari && contentHasExcessiveHeight);
26033  if(needSetAutoHeight) {
26034   mainElement.style.height = "";
26035   height = mainElement.offsetHeight - borderAndPadding;
26036  }
26037  else
26038   height = (ASPx.PxToInt(this.originalHeight) - borderAndPadding);
26039  if(height){
26040   mainElement.style.height = height + "px";
26041   if(contentDiv && contentDiv.offsetHeight > 0){
26042    var contentDivCurrentStyle = ASPx.GetCurrentStyle(contentDiv);
26043    var paddingTop = parseInt(contentDivCurrentStyle.paddingTop) || 0;
26044    var paddingBottom = parseInt(contentDivCurrentStyle.paddingBottom) || 0;
26045    var clientHeightDiff = height - contentDiv.offsetHeight;
26046    var verticalAlign = ASPx.GetCurrentStyle(mainElement).verticalAlign;
26047    if(verticalAlign == "top")
26048     paddingBottom = paddingBottom + clientHeightDiff;
26049    else if(verticalAlign == "bottom")
26050     paddingTop = paddingTop + clientHeightDiff;
26051    else {
26052     var halfClientHeightDiff = Math.floor(clientHeightDiff / 2);
26053     paddingTop = paddingTop + halfClientHeightDiff;
26054     paddingBottom = paddingBottom + (clientHeightDiff - halfClientHeightDiff);
26055    }
26056    contentDiv.style.paddingTop = (paddingTop > 0 ? paddingTop : 0) + "px";
26057    contentDiv.style.paddingBottom = (paddingBottom > 0 ? paddingBottom : 0) + "px";
26058   }
26059  }
26060 },
26061 UpdateWidth: function(){
26062  if(this.isNative || this.IsLink() || this.originalWidth === null) return;
26063  if(!ASPx.IsPercentageSize(this.originalWidth)) {
26064   var mainElement = this.GetMainElement();
26065   var borderAndPadding = ASPx.GetLeftRightBordersAndPaddingsSummaryValue(mainElement);
26066   if(this.originalWidth && ASPx.IsTextWrapped(this.GetTextContainer()))
26067    mainElement.style.width = (ASPx.PxToInt(this.originalWidth) - borderAndPadding) + "px";
26068   else
26069    mainElement.style.width = "auto";
26070   var width = mainElement.offsetWidth - borderAndPadding;
26071   if(this.originalWidth && width < ASPx.PxToInt(this.originalWidth) - borderAndPadding) 
26072    width = ASPx.PxToInt(this.originalWidth) - borderAndPadding;
26073   if(width)
26074    mainElement.style.width = (width > 0 ? width : 0)  + "px";
26075  }
26076  this.CorrectWrappedText(this.GetContentDiv, "Text", true);
26077 },
26078 GetAdjustedSizes: function() {
26079  var sizes = ASPxClientControl.prototype.GetAdjustedSizes.call(this);
26080  var image = this.GetButtonImage();
26081  if(image) {
26082   sizes.imageWidth = image.offsetWidth;
26083   sizes.imageHeight = image.offsetHeight;
26084  }
26085  return sizes;
26086 },
26087 PreventButtonImageDragging: function() {
26088  ASPx.Evt.PreventImageDragging(this.GetButtonImage());
26089 },
26090 AttachNativeHandlerToMainElement: function(handlerName, correspondingMethodName) {
26091  var mainElement = this.GetMainElement();
26092  if(!ASPx.IsExistsElement(mainElement))
26093   return;
26094  mainElement[handlerName] = function() { _aspxBCallButtonMethod(this.name, correspondingMethodName); }.aspxBind(this);
26095 },
26096 GetContentDiv: function(){
26097  return this.GetChildElement("CD");
26098 },       
26099 GetButtonImage: function(){
26100  return ASPx.CacheHelper.GetCachedElement(this, "buttonImage", 
26101   function() { 
26102    return ASPx.GetNodeByTagName(this.GetMainElement(), "IMG", 0); 
26103   });
26104 },
26105 GetInternalButton: function() {
26106  return ASPx.CacheHelper.GetCachedElement(this, "internalButton", 
26107   function() { 
26108    return this.isNative || this.IsLink() ? this.GetMainElement() : ASPx.GetNodeByTagName(this.GetMainElement(), "INPUT", 0);
26109   });
26110 },
26111 GetTextContainer: function() {
26112  return ASPx.CacheHelper.GetCachedElement(this, "textContainer", 
26113   function() { 
26114    if(this.isNative)
26115     return this.GetMainElement();
26116    else{
26117     var textElement = this.IsLink() ? this.GetMainElement() : this.GetContentDiv();
26118     return this.accessibilityCompliant ? ASPx.GetElementById(this.name + "_BTC") : ASPx.GetNodeByTagName(textElement, "SPAN", 0);
26119    }
26120   });
26121 },
26122 GetTextControl: function(){
26123  return ASPx.CacheHelper.GetCachedElement(this, "textControl", 
26124   function() { 
26125    var element = ASPx.GetParentByTagName(this.GetContentDiv(), "DIV");
26126    if(!ASPx.IsExistsElement(element) || (element.id == this.name))
26127     element = this.GetContentDiv();
26128    return element;
26129   });
26130 },
26131 IsLink: function(){
26132  if (this.GetMainElement())
26133   return this.GetMainElement().tagName === "A";
26134  return false;
26135 },   
26136 IsHovered: function(){
26137  var hoverElement = this.GetMainElement();
26138  return ASPx.GetStateController().currentHoverItemName == hoverElement.id;
26139 },   
26140 SetEnabledInternal: function(enabled, initialization) {
26141  if(!this.enabled)
26142   return;
26143  if(!initialization || !enabled)
26144   this.ChangeEnabledStateItems(enabled);
26145  this.ChangeEnabledAttributes(enabled);
26146 },
26147 ChangeEnabledAttributes: function(enabled) {
26148  var element = this.GetInternalButton();
26149  if(element) {
26150   if(this.IsLink()){
26151    var method = ASPx.Attr.ChangeAttributesMethod(enabled);
26152    var link = this.GetMainElement();
26153    method(link, "href");
26154    if(this.accessibilityCompliant)
26155     ASPx.Attr.SetOrRemoveAttribute(link, ASPx.Attr.GetTabIndexAttributeName(), enabled ? null : "0");
26156   } else
26157    element.disabled = !enabled;
26158  }
26159  this.ChangeEnabledEventsAttributes(ASPx.Attr.ChangeEventsMethod(enabled));
26160 },
26161 ChangeEnabledEventsAttributes: function(method) {
26162  var element = this.GetMainElement();
26163  method(element, "click", this.onClick);
26164  if(this.allowFocus){
26165   if(!this.isNative && !this.IsLink()) 
26166    element = this.GetInternalButton();
26167   if(element) {
26168    method(element, "focus", this.onGotFocus);
26169    method(element, "blur", this.onLostFocus);
26170    if(!this.isNative && !this.IsLink()){
26171     method(element, "keyup", this.onKeyUp);
26172     method(element, "blur", this.onKeyUp);
26173     method(element, "keydown", this.onKeyDown);
26174    }
26175   }
26176   if(ASPx.Browser.Firefox){
26177    var image = this.GetButtonImage();
26178    if(image)
26179     method(image, "mousedown", this.onImageMoseDown); 
26180   }
26181  }
26182 },
26183 ChangeEnabledStateItems: function(enabled){
26184  if(this.isNative) return;
26185  ASPx.GetStateController().SetElementEnabled(this.GetMainElement(), enabled);
26186  this.UpdateFocusedStyle();
26187 },
26188 RequiredPreventDoublePostback: function(){
26189  return ASPx.Browser.Firefox && !this.isNative; 
26190 },
26191 OnFocus: function() {
26192  if(!this.allowFocus)
26193   return false;
26194  this.focused = true;
26195  if(this.isInitialized)
26196   this.RaiseFocus();
26197  this.UpdateFocusedStyle();
26198 },  
26199 OnLostFocus: function() {
26200  if(!this.allowFocus)
26201   return false;
26202  this.focused = false;
26203  if(this.isInitialized)
26204   this.RaiseLostFocus();
26205  this.UpdateFocusedStyle();
26206 },
26207 CauseValidation: function() {
26208  if(this.causesValidation && ASPx.Ident.scripts.ASPxClientEdit)
26209   return this.validationContainerID != null ?
26210    ASPxClientEdit.ValidateEditorsInContainerById(this.validationContainerID, this.validationGroup, this.validateInvisibleEditors) :
26211    ASPxClientEdit.ValidateGroup(this.validationGroup, this.validateInvisibleEditors);
26212  else
26213   return true;
26214 },
26215 OnClick: function(evt) {
26216  if(this.clickLocked) return true;
26217  if(this.checked && this.groupName != "" && this.GetCheckedGroupList().length > 1) return;
26218  this.SetFocus();
26219  var isValid = this.CauseValidation();
26220  var processOnServer = this.autoPostBack;
26221  if(this.groupName != "") {
26222   if(this.GetCheckedGroupList().length == 1)
26223    this.SetCheckedInternal(!this.checked, false);
26224   else {
26225    this.SetCheckedInternal(true, false);
26226    this.ClearButtonGroupChecked(true);
26227   }
26228   processOnServer = this.RaiseCheckedChanged();
26229   if(processOnServer && isValid)
26230    this.SendPostBack("CheckedChanged");
26231  }
26232  var params = this.RaiseClick();
26233  if(evt && params.cancelEventAndBubble)
26234   ASPx.Evt.PreventEventAndBubble(evt);
26235  if(params.processOnServer && isValid) {
26236   var requiredPreventDoublePostback = this.RequiredPreventDoublePostback();
26237   var postponePostback = ASPx.Browser.AndroidMobilePlatform; 
26238   if(requiredPreventDoublePostback || postponePostback)
26239    window.setTimeout(function() { _aspxBCallButtonMethod(this.name, "SendPostBack", "Click"); }.aspxBind(this), 0); 
26240   else
26241    this.SendPostBack("Click");
26242   return !requiredPreventDoublePostback;
26243  }
26244  return false;
26245 },
26246 OnKeyUp: function(evt) {
26247  if(!this.pressed)
26248   return;
26249  this.pressed = false;
26250  ASPx.GetStateController().OnKeyUpOnElement(evt);
26251 },
26252 OnKeyDown: function(evt) {
26253  if(evt.keyCode == ASPx.Key.Enter || evt.keyCode == ASPx.Key.Space)
26254   this.SetPressed();
26255 },
26256 GetCheckedGroupList: function(){
26257  var result = [ ];
26258  ASPx.GetControlCollection().ForEachControl(function(control) {
26259   if(ASPx.Ident.IsASPxClientButton(control) && (control.groupName == this.groupName) && !control.IsDOMDisposed())
26260    result.push(control);
26261  }, this);
26262  return result;
26263 },
26264 ClearButtonGroupChecked: function(raiseCheckedChanged){
26265  var list = this.GetCheckedGroupList();
26266  for(var i = 0; i < list.length; i ++){
26267   if(list[i] != this && list[i].checked) {
26268    list[i].SetCheckedInternal(false, false);
26269    if(raiseCheckedChanged)
26270     list[i].RaiseCheckedChanged();
26271   }
26272  }
26273 },
26274 ApplyCheckedStyle: function(){
26275  var stateController = ASPx.GetStateController();
26276  if(this.IsHovered()) 
26277   stateController.SetCurrentHoverElement(null);  
26278  stateController.SelectElementBySrcElement(this.GetMainElement());
26279 }, 
26280 ApplyUncheckedStyle: function(){
26281  var stateController = ASPx.GetStateController();
26282  if(this.IsHovered()) 
26283   stateController.SetCurrentHoverElement(null);
26284  stateController.DeselectElementBySrcElement(this.GetMainElement());
26285 },  
26286 SetCheckedInternal: function(checked, initialization){
26287  if(initialization && checked || (this.checked != checked)){
26288   this.checked = checked;
26289   if(checked)
26290    this.ApplyCheckedStyle();
26291   else
26292    this.ApplyUncheckedStyle();
26293  }
26294 },
26295 UpdateStateObject: function(){
26296  if(this.groupName != "")
26297   this.UpdateStateObjectWithObject({ checked: this.checked });
26298 },
26299 GetStateHiddenFieldName: function() {
26300  return this.uniqueID + "$State";
26301 },
26302 ApplyPressedStyle: function(){
26303  ASPx.GetStateController().OnMouseDownOnElement(this.GetMainElement());
26304 },
26305 ApplyUnpressedStyle: function(){ 
26306  ASPx.GetStateController().OnMouseUpOnElement(this.GetMainElement());
26307 },
26308 SetPressed: function(){
26309  this.pressed = true;
26310  this.ApplyPressedStyle();
26311 }, 
26312 SetUnpressed: function(){
26313  this.pressed = false;
26314  this.ApplyUnpressedStyle();
26315 },
26316 SetFocus: function(){
26317  if(!this.allowFocus || this.focused)
26318   return;
26319  var element = this.GetInternalButton();
26320  if(element) {
26321   var hiddenInternalButtonRequiresVisibilityToGetFocused = ASPx.Browser.WebKitFamily  && !this.isNative  && !this.IsLink();
26322   if(hiddenInternalButtonRequiresVisibilityToGetFocused)
26323    ASPxClientButton.MakeHiddenElementFocusable(element);
26324   if(ASPx.IsFocusable(element) && ASPx.GetActiveElement() != element)
26325    element.focus();
26326   if(hiddenInternalButtonRequiresVisibilityToGetFocused)
26327    ASPxClientButton.RestoreHiddenElementAppearance(element);
26328  }
26329 },
26330 ApplyFocusedStyle: function(){
26331  if(this.focusElementSelected) return;
26332  if(typeof(ASPx.GetStateController) != "undefined")
26333   ASPx.GetStateController().SelectElementBySrcElement(this.GetContentDiv());
26334  this.focusElementSelected = true;
26335 },
26336 ApplyUnfocusedStyle: function(){ 
26337  if(!this.focusElementSelected) return;
26338  if(typeof(ASPx.GetStateController) != "undefined")
26339   ASPx.GetStateController().DeselectElementBySrcElement(this.GetContentDiv());
26340  this.focusElementSelected = false;
26341 },
26342 UpdateFocusedStyle: function(){
26343  if(this.isNative || this.IsLink()) return;
26344  if(this.enabled && this.clientEnabled && this.allowFocus && this.focused)
26345   this.ApplyFocusedStyle();
26346  else
26347   this.ApplyUnfocusedStyle();
26348 },
26349 SendPostBack: function(postBackArg){
26350  if(!this.enabled || !this.clientEnabled)
26351   return;
26352  var arg = postBackArg || "";
26353  if(this.autoPostBackFunction)
26354   this.autoPostBackFunction(arg);
26355  else if(!this.useSubmitBehavior || this.IsLink())
26356   ASPxClientControl.prototype.SendPostBack.call(this, arg);
26357  if(this.useSubmitBehavior && !this.isNative) 
26358   this.ClickInternalButton();
26359 },
26360 ClickInternalButton: function(){
26361  var element = this.GetInternalButton();
26362  if(element) {
26363   this.clickLocked = true;
26364   if(ASPx.Browser.NetscapeFamily)
26365    this.CreateUniqueIDCarrier(); 
26366   var postHandler = ASPx.GetPostHandler();
26367   postHandler.SetLastSubmitElementName(element.name);
26368   ASPx.Evt.DoElementClick(element);
26369   postHandler.SetLastSubmitElementName(null);
26370   if(ASPx.Browser.NetscapeFamily)
26371    this.RemoveUniqueIDCarrier(); 
26372   this.clickLocked = false;
26373  }
26374 },
26375 CreateUniqueIDCarrier: function() {
26376  var name = this.uniqueID;
26377  var id = this.GetUniqueIDCarrierID();
26378  var field = ASPx.CreateHiddenField(name, id);
26379  var form = this.GetParentForm();
26380  if(form) form.appendChild(field);
26381 },
26382 RemoveUniqueIDCarrier: function() {
26383  var field = document.getElementById(this.GetUniqueIDCarrierID());
26384  if(field)
26385   field.parentNode.removeChild(field);
26386 },
26387 GetUniqueIDCarrierID: function() {
26388  return this.uniqueID + "_UIDC";
26389 },
26390 DoClick: function(){
26391  if(!this.enabled || !this.clientEnabled)
26392   return;
26393  var button = (this.isNative || this.IsLink()) ? this.GetMainElement() : this.GetInternalButton();
26394  if(button)
26395   ASPx.Evt.DoElementClick(button);
26396  else 
26397   this.OnClick();   
26398 },
26399 GetChecked: function(){
26400  return this.checked;
26401 },
26402 SetChecked: function(checked){
26403  this.SetCheckedInternal(checked, false);
26404  this.ClearButtonGroupChecked(false);
26405 },
26406 GetText: function(){
26407  if(!this.isTextEmpty)
26408   return this.isNative ? this.GetTextContainer().value : this.GetTextContainer().innerHTML;
26409  return "";
26410 },
26411 SetText: function(text){
26412  this.isTextEmpty = (text == null || text == "");
26413  var textContainer = this.GetTextContainer();
26414  if(textContainer){
26415   if(this.isNative)
26416    textContainer.value = (text != null) ? text : "";
26417   else {
26418    var value = this.isTextEmpty ? "&nbsp;" : text;
26419      textContainer.innerHTML = value;
26420    var element = this.GetInternalButton();
26421    if(element)
26422     element.value = value;
26423    if(this.clientVisible && ASPx.Browser.IE && ASPx.Browser.Version >= 9) 
26424     ASPx.SetElementDisplay(this.GetMainElement(), true);
26425   }
26426   this.UpdateSize();
26427  }
26428 },
26429 GetImageUrl: function(){
26430  var img = this.GetButtonImage();
26431  return img ?  img.src : "";
26432 },
26433 SetImageUrl: function(url){
26434  var img = this.GetButtonImage();
26435  if(img) {
26436   img.src = url;
26437   this.UpdateSize();
26438  }
26439 },
26440 SetEnabled: function(enabled){
26441  if(this.clientEnabled != enabled) {
26442   if(!enabled && this.focused)
26443    this.OnLostFocus();
26444   this.clientEnabled = enabled;
26445   this.SetEnabledInternal(enabled, false);
26446  }
26447 },
26448 GetEnabled: function(){
26449  return this.enabled && this.clientEnabled;
26450 },
26451 Focus: function(){
26452  this.SetFocus();
26453 },
26454 RaiseCheckedChanged: function(){
26455  var processOnServer = this.autoPostBack || this.IsServerEventAssigned("CheckedChanged");
26456  if(!this.CheckedChanged.IsEmpty()){
26457   var args = new ASPxClientProcessingModeEventArgs(processOnServer);
26458   this.CheckedChanged.FireEvent(this, args);
26459   processOnServer = args.processOnServer;
26460  }
26461  return processOnServer;
26462 },
26463 RaiseFocus: function(){
26464  if(!this.GotFocus.IsEmpty()){
26465   var args = new ASPxClientEventArgs();
26466   this.GotFocus.FireEvent(this, args);
26467  }
26468 },
26469 RaiseLostFocus: function(){
26470  if(!this.LostFocus.IsEmpty()){
26471   var args = new ASPxClientEventArgs();
26472   this.LostFocus.FireEvent(this, args);
26473  }
26474 },
26475 RaiseClick: function() {
26476  var processOnServer = this.autoPostBack || this.IsServerEventAssigned("Click");
26477  var cancelEventAndBubble = false;
26478  if(!this.Click.IsEmpty()) {
26479   var args = new ASPxClientButtonClickEventArgs(processOnServer, cancelEventAndBubble);
26480   this.Click.FireEvent(this, args);
26481   cancelEventAndBubble = args.cancelEventAndBubble;
26482   processOnServer = args.processOnServer;
26483  }
26484  return {
26485   processOnServer: processOnServer,
26486   cancelEventAndBubble: cancelEventAndBubble
26487  };
26488 }
26489});
26490ASPxClientButton.Cast = ASPxClientControl.Cast;
26491var ASPxClientButtonClickEventArgs = ASPx.CreateClass(ASPxClientProcessingModeEventArgs, {
26492 constructor: function(processOnServer, cancelEventAndBubble) {
26493  this.constructor.prototype.constructor.call(this, processOnServer);
26494  this.cancelEventAndBubble = cancelEventAndBubble;
26495 }
26496});
26497ASPxClientButton.MakeHiddenElementFocusable = function(element) {
26498 element.__dxHiddenElementState = {
26499  parentDisplay: element.parentNode.style.display,
26500  height: element.style.height,
26501  width: element.style.width
26502 };
26503 element.parentNode.style.display = "block";
26504 element.style.height = "1px";
26505 element.style.width = "1px";
26506};
26507ASPxClientButton.RestoreHiddenElementAppearance = function(element) {
26508 var state = element.__dxHiddenElementState;
26509 element.parentNode.style.display = state.parentDisplay;
26510 element.style.height = state.height;
26511 element.style.width = state.width;
26512 delete element.__dxHiddenElementState;
26513};
26514ASPx.Ident.IsASPxClientButton = function(obj) {
26515 return !!obj.isASPxClientButton;
26516};
26517function _aspxBCallButtonMethod(name, methodName, arg) {
26518 var button = ASPx.GetControlCollection().Get(name); 
26519 if(button != null)
26520  button[methodName](arg);
26521}
26522ASPx.BClick = function(name, evt) {
26523 var button = ASPx.GetControlCollection().Get(name); 
26524 if(button != null)
26525  return button.OnClick(evt);
26526};
26527window.ASPxClientButton = ASPxClientButton;
26528})();
26529
26530(function(dx) {
26531 var BootstrapClientButton = ASPx.CreateClass(ASPxClientButton, {
26532  constructor: function(name) {
26533   this.constructor.prototype.constructor.call(this, name);
26534  },
26535  InitializeNativeHandlers: function() { },
26536  InitializeElementIDs: function() { },
26537  InitializeLink: function() { },
26538  UpdateSize: function() { },
26539  UpdateHeight: function() { },
26540  UpdateWidth: function() { },
26541  AdjustControlCore: function() { },
26542  ApplyCheckedStyle: function() {
26543   var btn = this.GetInternalButton();
26544   ASPx.AddClassNameToElement(btn, "active");
26545   ASPx.Attr.SetAttribute(btn, "aria-pressed", true);
26546  },
26547  ApplyUncheckedStyle: function() {
26548   var btn = this.GetInternalButton();
26549   ASPx.RemoveClassNameFromElement(btn, "active");
26550   ASPx.Attr.SetAttribute(btn, "aria-pressed", false);
26551  },
26552  ApplyPressedStyle: function() { },
26553  ApplyUnpressedStyle: function() { },
26554  ApplyFocusedStyle: function() { },
26555  ApplyUnfocusedStyle: function() { },
26556  ChangeEnabledStateItems: function(enabled) { },
26557  SetFocus: function () {
26558   if (!this.allowFocus || this.focused)
26559    return;
26560   this.focused = true;
26561   var element = this.GetInternalButton();
26562   if (element) {      
26563    if (ASPx.IsFocusable(element) && ASPx.GetActiveElement() != element)
26564     element.focus();
26565   }
26566  },
26567  ClickInternalButton: function() { },
26568  GetContentDiv: function() {
26569   return null;
26570  },
26571  GetInternalButton: function() {
26572   return this.GetMainElement();
26573  },
26574  GetButtonImage: function() {
26575   return null;
26576  },
26577  GetTextContainer: function() {
26578   return null;
26579  },
26580  GetTextControl: function() {
26581   return null;
26582  },
26583  GetBadgeControl: function() {
26584   return ASPx.BootstrapBadgeManager.findBadge(this.GetMainElement());
26585  },
26586  RequiredPreventDoublePostback: function() {
26587   return false;
26588  },
26589  GetText: function() {
26590   if(!this.isTextEmpty)
26591    return this.GetMainElement().value;
26592   return "";
26593  },
26594  SetText: function(text) {
26595   var buttonText = this.HtmlEncode(text);
26596   ASPxClientButton.prototype.SetText.call(this, buttonText);
26597   var buttonElement = this.GetMainElement();
26598   buttonElement.value = (buttonText != null) ? buttonText : "";
26599   var textNode = ASPx.GetNormalizedTextNode(buttonElement);
26600   if(textNode && textNode.parentNode == buttonElement)
26601    textNode.nodeValue = buttonText;
26602   else {
26603    textNode = document.createTextNode(buttonText);
26604    var badgeControl = this.GetBadgeControl();
26605    if(badgeControl)
26606     buttonElement.insertBefore(textNode, badgeControl);
26607    else
26608     buttonElement.appendChild(textNode);
26609   }
26610  },
26611  GetBadgeText: function() {
26612   return ASPx.BootstrapBadgeManager.getBadgeText(this.GetMainElement());
26613  },
26614  SetBadgeText: function(text) {
26615   var badgeText = this.HtmlEncode(text);
26616   var badgeControl = this.GetBadgeControl();
26617   if(badgeControl)
26618    ASPx.BootstrapBadgeManager.setBadgeText(badgeControl, badgeText);
26619   else
26620    this.GetMainElement().appendChild(ASPx.BootstrapBadgeManager.createBadge(badgeText));
26621  },
26622  GetBadgeIconCssClass: function() {
26623   return ASPx.BootstrapBadgeManager.getBadgeIconCssClass(this.GetMainElement());
26624  },
26625  SetBadgeIconCssClass: function(cssClass) {
26626   var badgeControl = this.GetBadgeControl();
26627   if(badgeControl)
26628    ASPx.BootstrapBadgeManager.setBadgeIconCssClass(badgeControl, cssClass);
26629   else
26630    this.GetMainElement().appendChild(ASPx.BootstrapBadgeManager.createBadge("", cssClass));
26631  }
26632 });
26633 dx.BootstrapClientButton = BootstrapClientButton;
26634})(dx || (dx = {}));

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.