PageSourceSearch

https://iowaapindex.org/DXR.axd?r=1_9,1_10,1_253,1_21,1_62,1_12,1_…1_20,1_188,1_13,1_15,1_184,1_191,1_39-hxKJq

js iowaapindex.org collected 2026-10-04 05:19:22 UTC 1,402,861 bytes, 36,572 lines download raw bytes

1var ASPx = ASPx || {};
2var dx = dx || {};
3(function module(ASPx, dx) {
4ASPx.modules = { Utils: module };
5if(!ASPx.attachToReady)
6 ASPx.attachToReady = function (callback) { ASPx.Evt.AttachEventToElement(window, "load", callback); };
7if(!ASPx.attachToLoad)
8 ASPx.attachToLoad = function(callback) { ASPx.Evt.AttachEventToDocumentCore("DOMContentLoaded", callback); };
9ASPx.EmptyObject = { };
10ASPx.FalseFunction = function() { return false; };
11ASPx.SSLSecureBlankUrl = '/DXR.axd?r=1_86-hxKJq';
12ASPx.EmptyImageUrl = '/DXR.axd?r=1_87-hxKJq';
13ASPx.VersionInfo = 'Version=\'22.2.6.0\', File Version=\'22.2.6.0\', Date Modified=\'5/5/2023 8:16:11 PM\'';
14ASPx.Platform = 'ASP';
15ASPx.DoctypeMode = 'Html5';
16ASPx.InvalidDimension = -10000;
17ASPx.InvalidPosition = -10000;
18ASPx.AbsoluteLeftPosition = -10000;
19ASPx.EmptyGuid = "00000000-0000-0000-0000-000000000000";
20ASPx.CallbackSeparator = ":";
21ASPx.ItemIndexSeparator = "i";
22ASPx.CallbackResultPrefix = "/*DX*/";
23ASPx.StyleValueEncodedSemicolon = "DXsmcln";
24ASPx.AccessibilityEmptyUrl = "javascript:;";
25ASPx.AccessibilityPronounceTimeout = 500;
26ASPx.MaxMobileWindowWidth = 576;
27ASPx.PossibleNumberDecimalSeparators = [",", "."];
28ASPx.CultureInfo = {
29 twoDigitYearMax: 2029,
30 ts: ":",
31 ds: "/",
32 am: "AM",
33 pm: "PM",
34 monthNames: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "
34November", "December", ""],
35 genMonthNames: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", ""],
36 abbrMonthNames: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ""],
37 abbrDayNames: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
38 dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
39 invariantCultureDecimalPoint: ".",
40 numDecimalPoint: ".",
41 numPrec: 2,
42 numGroupSeparator: ",", 
43 numGroups: [ 3 ],
44 numNegPattern: 1,
45 numPosInf: "Infinity", 
46 numNegInf: "-Infinity", 
47 numNan: "NaN",
48 currency: "$",
49 currDecimalPoint: ".",
50 currPrec: 2,
51 currGroupSeparator: ",",
52 currGroups: [ 3 ],
53 currPosPattern: 0,
54 currNegPattern: 0,
55 percentPattern: 0,
56 shortTime: "h:mm tt",
57 longTime: "h:mm:ss tt",
58 shortDate: "M/d/yyyy",
59 longDate: "dddd, MMMM d, yyyy",
60 monthDay: "MMMM d",
61 yearMonth: "MMMM yyyy"
62};
63ASPx.CultureInfo.genMonthNames = ASPx.CultureInfo.monthNames;
64ASPx.Position = {
65 Left: "Left",
66 Right: "Right",
67 Top: "Top",
68 Bottom: "Bottom"
69};
70ASPx.FOCUS_TIMEOUT = 100;
71function setInnerHtmlInternal(el, trustedHtmlString) { 
72 el.innerHTML = trustedHtmlString;
73}
74var DateUtils = { };
75DateUtils.GetInvariantDateString = function(date) {
76 if(!date)
77  return "01/01/0001";
78 var day = date.getDate();
79 var month = date.getMonth() + 1;
80 var year = date.getFullYear();
81 var result = "";
82 if(month < 10)
83  result += "0";
84 result += month.toString() + "/";
85 if(day < 10)
86  result += "0";
87 result += day.toString() + "/";
88 if(year < 1000)
89  result += "0";
90 result += year.toString();
91 return result;
92};
93DateUtils.GetInvariantDateTimeString = function(date) {
94 var dateTimeString = DateUtils.GetInvariantDateString(date);
95 var time = {
96  h: date.getHours(),
97  m: date.getMinutes(),
98  s: date.getSeconds()
99 };
100 for(var key in time) {
101  if(time.hasOwnProperty(key)) {
102   var str = time[key].toString();
103   if(str.length < 2)
104    str = "0" + str;
105   time[key] = str;
106  }
107 }
108 dateTimeString += " " + time.h + ":" + time.m + ":" + time.s;
109 var msec = date.getMilliseconds();
110 if(msec > 0)
111  dateTimeString += "." + ("000" + msec.toString()).substr(-3);
112 return dateTimeString;
113};
114DateUtils.ExpandTwoDigitYear = function(value) {
115 value += 1900;
116 if(value + 99 < ASPx.CultureInfo.twoDigitYearMax)
117  value += 100;
118 return value;  
119};
120DateUtils.GetTimeZoneOffsetDifference = function(firstDate, secondDate) {
121 if(!secondDate)
122  secondDate = DateUtils.GetUtcDate(firstDate);
123 return 60000 * (firstDate.getTimezoneOffset() - secondDate.getTimezoneOffset());
124};
125DateUtils.GetTimeZoneOffset = function(date) {
126 var isECMA262Support = (ASPx.Browser.Chrome && ASPx.Browser.Version >= 67) || ASPx.Browser.EdgeWebKit;
127 if(!isECMA262Support)
128  return date.getTimezoneOffset() * 60000;
129 var utcDate = DateUtils.GetUtcDate(date);
130 var utcTimezoneOffsetDifference = DateUtils.GetTimeZoneOffsetDifference(date);
131 if(utcTimezoneOffsetDifference !== 0)
132  utcDate.setTime(utcDate.valueOf() + utcTimezoneOffsetDifference);
133 return utcDate - date;
134};
135DateUtils.GetUtcDate = function(date) {
136 var utcFullYear = date.getUTCFullYear();
137 var result = new Date(utcFullYear, date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), date.getUTCMilliseconds());
138 if(utcFullYear < 100)
139  result.setFullYear(utcFullYear);
140 return result;
141};
142DateUtils.ToUtcTime = function(date) {
143 var result = new Date();
144 result.setTime(date.valueOf() + ASPx.DateUtils.GetTimeZoneOffset(date));
145 return result;
146};
147DateUtils.ToLocalTime = function(date) {
148 var result = new Date();
149 result.setTime(date.valueOf() - ASPx.DateUtils.GetTimeZoneOffset(date));
150 return result; 
151};
152DateUtils.AreDatesEqualExact = function(date1, date2) {
153 if(date1 == null && date2 == null)
154  return true;
155 if(date1 == null || date2 == null)
156  return false;
157 return date1.getTime() == date2.getTime(); 
158};
159DateUtils.FixTimezoneGap = function(oldDate, newDate) {
160 var diff = newDate.getHours() - oldDate.getHours();
161 if(diff == 0)
162  return;
163 var sign = (diff == 1 || diff == -23) ? -1 : 1;
164 var trial = new Date(newDate.getTime() + sign * 3600000);
165 var isDateChangedAsExpected = newDate.getHours() - trial.getHours() === diff;
166 if(isDateChangedAsExpected && (sign > 0 || trial.getDate() == newDate.getDate()))
167  newDate.setTime(trial.getTime());
168};
169DateUtils.GetDecadeStartYear = function(year) {
170 return 10 * Math.floor(year / 10);
171};
172DateUtils.GetCenturyStartYear = function(year) {
173 return 100 * Math.floor(year / 100);
174};
175DateUtils.GetCorrectedYear = function(date, pickerType) {
176 var year = date.getFullYear();
177 return pickerType != ASPx.DatePickerType.Decades ? year : DateUtils.GetDecadeStartYear(year);
178};
179DateUtils.GetCorrectedMonth = function(date, pickerType) {
180 return pickerType < ASPx.DatePickerType.Years ? date.getMonth() : 0;
181};
182DateUtils.GetCorrectedDay = function(date, pickerType) {
183 return pickerType == ASPx.DatePickerType.Days ? date.getDate() : 1;
184};
185DateUtils.CorrectDateByPickerType = function(date, pickerType) {
186 if(!ASPx.IsExists(pickerType))
187  pickerType = ASPx.DatePickerType.Days;
188 if(!date || pickerType == ASPx.DatePickerType.Days)
189  return date;
190 var correctedYear = DateUtils.GetCorrectedYear(date, pickerType);
191 var result = new Date(
192  correctedYear,
193  DateUtils.GetCorrectedMonth(date, pickerType),
194  DateUtils.GetCorrectedDay(date, pickerType),
195  date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()
196 );
197 result.setFullYear(correctedYear);
198 return result;
199};
200DateUtils.GetYearRangeFormatString = function(startYear, rangeLength) {
201 return startYear + " - " + (startYear + rangeLength - 1);
202};
203ASPx.DateUtils = DateUtils;
204var Timer = { };
205Timer.ClearTimer = function(timerID){
206 if(timerID > -1)
207  window.clearTimeout(timerID);
208 return -1;
209};
210Timer.ClearInterval = function(timerID){
211 if(timerID > -1)
212  window.clearInterval(timerID);
213 return -1;
214};
215var setControlBoundTimer = function(handler, control, setTimerFunction, clearTimerFunction, delay) {
216 var timerId;
217 var getTimerId = function() { return timerId; };
218 var controlMainElement = control.GetMainElement();
219 var boundHandler = function() {
220  var controlExists = control && ASPx.GetControlCollection().Get(control.name) === control && control.GetMainElement() === controlMainElement;
221  if(controlExists)
222   handler.aspxBind(control)();
223  else {
224   clearTimerFunction(getTimerId());
225   controlMainElement = null;
226  }
227 };
228 timerId = setTimerFunction(boundHandler, delay);
229 return timerId;
230};
231Timer.SetControlBoundTimeout = function(handler, control, delay) {
232 return setControlBoundTimer(handler, control, window.setTimeout, Timer.ClearTimer, delay);
233};
234Timer.SetControlBoundInterval = function(handler, control, delay) {
235 return setControlBoundTimer(handler, control, window.setInterval, Timer.ClearInterval, delay);
236};
237Timer.Throttle = function(func, delay) {
238 var isThrottled = false,
239   savedArgs,
240   savedThis = this;
241 function wrapper() {
242  if(isThrottled) {
243   savedArgs = arguments;
244   savedThis = this;
245   return;
246  }
247  func.apply(this, arguments);
248  isThrottled = true;
249  setTimeout(function() {
250   isThrottled = false;
251   if(savedArgs) {
252    wrapper.apply(savedThis, savedArgs);
253    savedArgs = null;
254   }
255  }, delay);
256 }
257 wrapper.cancel = function() {
258  clearTimeout(delay);
259  delay = savedArgs = savedThis = null;
260 };
261 return wrapper;
262};
263ASPx.Timer = Timer;
264var Browser = { };
265Browser.UserAgent = navigator.userAgent.toLowerCase();
266Browser.Mozilla = false;
267Browser.IE = false;
268Browser.Firefox = false;
269Browser.Netscape = false;
270Browser.Safari = false;
271Browser.Chrome = false;
272Browser.Opera = false;
273Browser.Edge = false;
274Browser.EdgeWebKit = false;
275Browser.Version = undefined; 
276Browser.MajorVersion = undefined; 
277Browser.WindowsPlatform = false;
278Browser.MacOSPlatform = false;
279Browser.MacOSMobilePlatform = false;
280Browser.AndroidMobilePlatform = false;
281Browser.PlaformMajorVersion = false;
282Browser.WindowsPhonePlatform = false;
283Browser.AndroidDefaultBrowser = false;
284Browser.AndroidChromeBrowser = false;
285Browser.SamsungAndroidDevice = false;
286Browser.WebKitTouchUI = false;
287Browser.MSTouchUI = false;
288Browser.TouchUI = false;
289Browser.WebKitFamily = false; 
290Browser.NetscapeFamily = false; 
291Browser.VirtualKeyboardSupported = false;
292Browser.Info = "";
293Browser.IsQuirksMode = document.compatMode === "BackCompat";
294function indentPlatformMajorVersion(userAgent) {
295 var regex = /(?:(?:windows nt|macintosh|mac os|cpu os|cpu iphone os|android|windows phone|linux) )(\d+)(?:[-0-9_.])*/;
296 var matches = regex.exec(userAgent);
297 if(matches)
298  Browser.PlaformMajorVersion = matches[1];
299}
300function getIECompatibleVersionString() {
301 if(document.compatible) {
302  for(var i = 0; i < document.compatible.length; i++)
303   if(document.compatible[i].userAgent === "IE" && document.compatible[i].version)
304    return document.compatible[i].version.toLowerCase();
305 }
306 return "";
307}
308Browser.IdentUserAgent = function(userAgent, ignoreDocumentMode) {
309 var browserTypesOrderedList = ["Mozilla", "IE", "Firefox", "Netscape", "Safari", "Chrome", "Opera", "Opera10", "EdgeWebKit", "Edge" ];
310 var defaultBrowserType = "IE";
311 var defaultPlatform = "Win";
312 var defaultVersions = { Safari: 2, Chrome: 0.1, Mozilla: 1.9, Netscape: 8, Firefox: 2, Opera: 9, IE: 6, Edge: 12 };
313 if(!userAgent || userAgent.length == 0) {
314  fillUserAgentInfo(browserTypesOrderedList, defaultBrowserType, defaultVersions[defaultBrowserType], defaultPlatform);
315  return;
316 }
317 userAgent = userAgent.toLowerCase();
318 indentPlatformMajorVersion(userAgent);
319 try {
320  var platformIdentStrings = {
321   "Windows": "Win",
322   "Macintosh": "Mac",
323   "Mac OS": "Mac",
324   "Mac_PowerPC": "Mac",
325   "cpu os": "MacMobile",
326   "cpu iphone os": "MacMobile",
327   "Android": "Android",
328   "!Windows Phone": "WinPhone",
329   "!WPDesktop": "WinPhone",
330   "!ZuneWP": "WinPhone"
331  };
332  var optSlashOrSpace = "(?:/|\\s*)?";
333  var version = "(\\d+)(?:\\.((?:\\d+?[1-9])|\\d)0*?)?";
334  var optComma = "(?:,)?";
335  var appleVersion = "(\\d+)(?:\\.((?:\\d+?[1-9])|\\d)" + optComma + "0*?)?"; 
336  var optVersion = "(?:" + version + ")?";
337  var patterns = {
338   Safari: "applewebkit(?:.*?(?:version/" + appleVersion + "[\\.\\w\\d]*?(?:\\s+mobile\/\\S*)?\\s+safari))?",
339   Chrome: "(?:chrome|crios)(?!frame)" + optSlashOrSpace + optVersion,
340   Mozilla: "mozilla(?:.*rv:" + optVersion + ".*Gecko)?",
341   Netscape: "(?:netscape|navigator)\\d*/?\\s*" + optVersion,
342   Firefox: "firefox" + optSlashOrSpace + optVersion,
343   Opera: "(?:opera|\sopr)" + optSlashOrSpace + optVersion,
344   Opera10: "opera.*\\s*version" + optSlashOrSpace + optVersion,
345   IE: "msie\\s*" + optVersion,
346   EdgeWebKit: "edg" + optSlashOrSpace + optVersion,
347   Edge: "edge" + optSlashOrSpace + optVersion
348  };
349  var browserType;
350  var version = -1;
351  for(var i = 0; i < browserTypesOrderedList.length; i++) {
352   var browserTypeCandidate = browserTypesOrderedList[i];
353   var regExp = new RegExp(patterns[browserTypeCandidate], "i");
354   if(regExp.compile)
355    regExp.compile(patterns[browserTypeCandidate], "i");
356   var matches = regExp.exec(userAgent);
357   if(matches && matches.index >= 0) {
358    if(browserType == "IE" && version >= 11 && browserTypeCandidate == "Safari") 
359     continue;
360    browserType = browserTypeCandidate;
361    if(browserType == "Opera10")
362     browserType = "Opera";
363    var tridentPattern = "trident" + optSlashOrSpace + optVersion;
364    version = Browser.GetBrowserVersion(userAgent, matches, tridentPattern, getIECompatibleVersionString());
365    if(browserType == "Mozilla" && version >= 11)
366     browserType = "IE";
367   }
368  }
369  if(!browserType)
370   browserType = defaultBrowserType;
371  var browserVersionDetected = version != -1;
372  if(!browserVersionDetected)
373   version = defaultVersions[browserType];
374  var platform;
375  var minOccurenceIndex = Number.MAX_VALUE;
376  for(var identStr in platformIdentStrings) {
377   if(!platformIdentStrings.hasOwnProperty(identStr)) continue;
378   var importantIdent = identStr.substr(0,1) == "!";
379   var occurenceIndex = userAgent.indexOf((importantIdent ? identStr.substr(1) : identStr).toLowerCase());
380   if(occurenceIndex >= 0 && (occurenceIndex < minOccurenceIndex || importantIdent)) {
381    minOccurenceIndex = importantIdent ? 0 : occurenceIndex;
382    platform = platformIdentStrings[identStr];
383   }
384  }
385  var samsungPattern = "SM-[A-Z]";
386  var matches = userAgent.toUpperCase().match(samsungPattern);
387  var isSamsungAndroidDevice = matches && matches.length > 0;
388  if(platform == "WinPhone" && version < 9)
389   version = Math.floor(getVersionFromTrident(userAgent, "trident" + optSlashOrSpace + optVersion));
390  if(!ignoreDocumentMode && browserType == "IE" && version > 7 && document.documentMode < version)
391   version = document.documentMode;
392  if(platform == "WinPhone")
393   version = Math.max(9, version);
394  if(!platform)
395   platform = defaultPlatform;
396  if(platform == platformIdentStrings["cpu os"] && !browserVersionDetected) 
397   version = 4;
398  fillUserAgentInfo(browserTypesOrderedList, browserType, version, platform, isSamsungAndroidDevice);
399 } catch(e) {
400  fillUserAgentInfo(browserTypesOrderedList, defaultBrowserType, defaultVersions[defaultBrowserType], defaultPlatform);
401 }
402};
403function getVersionFromMatches(matches) {
404 var result = -1;
405 var versionStr = "";
406 if(matches[1]) {
407  versionStr += matches[1];
408  if(matches[2])
409   versionStr += "." + matches[2];
410 }
411 if(versionStr != "") {
412  result = parseFloat(versionStr);
413  if(isNaN(result))
414   result = -1;
415 }
416 return result;
417}
418function getVersionFromTrident(userAgent, tridentPattern) {
419 var tridentDiffFromVersion = 4;
420 var matches = new RegExp(tridentPattern, "i").exec(userAgent);
421 return getVersionFromMatches(matches) + tridentDiffFromVersion;
422}
423Browser.GetBrowserVersion = function(userAgent, matches, tridentPattern, ieCompatibleVersionString) {
424 var version = getVersionFromMatches(matches);
425 if(ieCompatibleVersionString) {
426  var versionFromTrident = getVersionFromTrident(userAgent, tridentPattern);
427  if(ieCompatibleVersionString === "edge" || parseInt(ieCompatibleVersionString) === versionFromTrident)
428   return versionFromTrident;
429 }
430 return version;
431};
432function fillUserAgentInfo(browserTypesOrderedList, browserType, version, platform, isSamsungAndroidDevice) {
433 for(var i = 0; i < browserTypesOrderedList.length; i++) {
434  var type = browserTypesOrderedList[i];
435  Browser[type] = type == browserType;
436 }
437 Browser.Version = Math.floor(10.0 * version) / 10.0;
438 Browser.MajorVersion = Math.floor(Browser.Version);
439 Browser.WindowsPlatform = platform == "Win" || platform == "WinPhone";
440 Browser.MacOSPlatform = platform == "Mac";
441 var isMacWithTouchSupport = platform == "Mac" && (!!window.ontouchstart || getMaxTouchPoints() > 0); 
442 Browser.MacOSMobilePlatform = platform == "MacMobile" || isMacWithTouchSupport;
443 if(Browser.MacOSMobilePlatform)
444  Browser.MacOSPlatform = false;
445 Browser.AndroidMobilePlatform = platform == "Android";
446 Browser.WindowsPhonePlatform = platform == "WinPhone";
447 Browser.WebKitFamily = Browser.Safari || Browser.Chrome || Browser.Opera && Browser.MajorVersion >= 15 || Browser.EdgeWebKit;
448 Browser.NetscapeFamily = Browser.Netscape || Browser.Mozilla || Browser.Firefox;
449 Browser.WebKitTouchUI = Browser.MacOSMobilePlatform || Browser.AndroidMobilePlatform;
450 var isIETouchUI = Browser.IE && Browser.MajorVersion > 9 && Browser.WindowsPlatform && Browser.UserAgent.toLowerCase().indexOf("touch") >= 0;
451 Browser.MSTouchUI = isIETouchUI || ((Browser.Edge || (Browser.EdgeWebKit && !Browser.AndroidMobilePlatform)) && !!getMaxTouchPoints());
452 Browser.TouchUI = Browser.WebKitTouchUI || Browser.MSTouchUI;
453 Browser.MobileUI = Browser.WebKitTouchUI || Browser.WindowsPhonePlatform;
454 Browser.AndroidDefaultBrowser = Browser.AndroidMobilePlatform && !Browser.Chrome;
455 Browser.AndroidChromeBrowser = Browser.AndroidMobilePlatform && Browser.Chrome;
456 if(isSamsungAndroidDevice)
457  Browser.SamsungAndroidDevice = isSamsungAndroidDevice;
458 if(Browser.MSTouchUI) {
459  var isARMArchitecture = Browser.UserAgent.toLowerCase().indexOf("arm;") > -1;    
460  Browser.VirtualKeyboardSupported = isARMArchitecture || Browser.WindowsPhonePlatform;   
461 } else {
462  Browser.VirtualKeyboardSupported = Browser.MobileUI;
463 }
464 fillDocumentElementBrowserTypeClassNames(browserTypesOrderedList);
465}
466function getMaxTouchPoints() { 
467 var result = navigator.maxTouchPoints;
468 if(window.testingTouchMode)
469  result = 10;
470 return result;
471}
472function fillDocumentElementBrowserTypeClassNames(browserTypesOrderedList) {
473 var documentElementClassName = "";
474 var browserTypeslist = browserTypesOrderedList.concat(["WindowsPlatform", "MacOSPlatform", "MacOSMobilePlatform", "AndroidMobilePlatform",
475   "WindowsPhonePlatform", "WebKitFamily", "WebKitTouchUI", "MSTouchUI", "TouchUI", "AndroidDefaultBrowser", "MobileUI"]);
476 for(var i = 0; i < browserTypeslist.length; i++) {
477  var type = browserTypeslist[i];
478  if(Browser[type])
479   documentElementClassName += "dx" + type + " ";
480 }
481 documentElementClassName += "dxBrowserVersion-" + Browser.MajorVersion;
482 if(document && document.documentElement) {
483  if(document.documentElement.className != "")
484   documentElementClassName = " " + documentElementClassName;
485  document.documentElement.className += documentElementClassName;
486  Browser.Info = documentElementClassName;
487 }
488}
489Browser.SupportsStickyPositioning = function() {
490 return this.Chrome && this.MajorVersion >= 56
491  || this.Firefox && this.MajorVersion >= 32
492  || this.Safari && this.MajorVersion >= 6 && this.Version !== "6"
493  || this.Opera && this.MajorVersion >= 42;
494};
495Browser.IdentUserAgent(Browser.UserAgent);
496ASPx.Browser = Browser;
497ASPx.BlankUrl = Browser.Opera ? "about:blank" : "";
498ASPx.FillDocumentElementDXThemeCssClassName = function(dxThemeName) {
499 document.documentElement.className += " dxTheme-" + dxThemeName;
500};
501var Data = { };
502Data.ArrayInsert = function(array, element, position){
503 if(0 <= position && position < array.length){
504  for(var i = array.length; i > position; i --)
505   array[i] = array[i - 1];
506  array[position] = element;
507 }
508 else
509  array.push(element);
510};
511Data.ArrayRemove = function(array, element){
512 var index = Data.ArrayIndexOf(array, element);
513 if(index > -1) Data.ArrayRemoveAt(array, index);
514};
515Data.ArrayRemoveAt = function(array, index){
516 if(index >= 0  && index < array.length){
517  for(var i = index; i < array.length - 1; i++)
518   array[i] = array[i + 1];
519  array.pop();
520 }
521};
522Data.ArrayClear = function(array){
523 while(array.length > 0)
524  array.pop();
525};
526Data.ArrayIndexOf = function(array, element, comparer) {
527 if(!comparer) {
528  for(var i = 0; i < array.length; i++) {
529   if(array[i] == element)
530    return i;
531  }
532 } else {
533  for(var i = 0; i < array.length; i++) {
534   if(comparer(array[i], element))
535    return i;
536  }
537 }
538 return -1;
539};
540Data.ArrayContains = function(array, element) { 
541 return Data.ArrayIndexOf(array, element) >= 0;
542};
543Data.ArrayEqual = function(array1, array2) {
544 var count1 = array1.length;
545 var count2 = array2.length;
546 if(count1 != count2)
547  return false;
548 for(var i = 0; i < count1; i++)
549  if(array1[i] != array2[i])
550   return false;
551 return true;
552};
553Data.ArraySame = function(array1, array2) {
554 if(array1.length !== array2.length)
555  return false;
556 return array1.every(function(elem) { return Data.ArrayContains(array2, elem); });
557};
558Data.ArrayGetIntegerEdgeValues = function(array) {
559 var arrayToSort = Data.CollectionToArray(array);
560 Data.ArrayIntegerAscendingSort(arrayToSort);
561 return {
562  start: arrayToSort[0],
563  end: arrayToSort[arrayToSort.length - 1]
564 };
565};
566Data.ArrayIntegerAscendingSort = function(array){
567 Data.ArrayIntegerSort(array);
568};
569Data.ArrayIntegerSort = function(array, desc) {
570 array.sort(function(i1, i2) {
571  var res = 0;
572  if(i1 > i2)
573   res = 1;
574  else if(i1 < i2)
575   res = -1;
576  if(desc)
577   res *= -1;
578  return res;
579 });
580};
581Data.CollectionsUnionToArray = function(firstCollection, secondCollection) {
582 var result = [];
583 var firstCollectionLength = firstCollection.length;
584 var secondCollectionLength = secondCollection.length;
585 for(var i = 0; i < firstCollectionLength + secondCollectionLength; i++) {
586  if(i < firstCollectionLength)
587   result.push(firstCollection[i]);
588  else
589   result.push(secondCollection[i - firstCollectionLength]);
590 }
591 return result;
592};
593Data.CollectionToArray = function(collection) {
594 var array = [];
595 for(var i = 0; i < collection.length; i++)
596  array.push(collection[i]);
597 return array;
598};
599Data.CreateHashTableFromArray = function(array) {
600 var hash = [];
601 for(var i = 0; i < array.length; i++)
602  hash[array[i]] = 1;
603 return hash;
604};
605Data.CreateIndexHashTableFromArray = function(array) {
606 var hash = [];
607 for(var i = 0; i < array.length; i++)
608  hash[array[i]] = i;
609 return hash;
610};
611Data.ArrayToHash = function(array, getKeyFunc, getValueFunc) {
612 if(!(array instanceof Array)) 
613  return { };
614 return array.reduce(function(map, element, index) { 
615  var key = getKeyFunc(element, index);
616  var value = getValueFunc(element, index);
617  map[key] = value;
618  return map; 
619 }, { });
620};
621Data.Sum = function(array, getValueFunc) {
622 if(!(array instanceof Array)) 
623  return 0;
624 return array.reduce(function(prevValue, item) {
625  var value = getValueFunc ? getValueFunc(item) : item;
626  if(!ASPx.IsNumber(value))
627   value = 0;
628  return prevValue + value;
629 }, 0);
630};
631Data.Min = function(array, getValueFunc) { return CalculateArrayMinMax(array, getValueFunc, false); };
632Data.Max = function(array, getValueFunc) { return CalculateArrayMinMax(array, getValueFunc, true); };
633var CalculateArrayMinMax = function(array, getValueFunc, isMax) {
634 if(!(array instanceof Array)) 
635  return 0;
636 var startValue = isMax ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY;
637 return array.reduce(function(prevValue, item) {
638  var value = getValueFunc ? getValueFunc(item) : item;
639  if(!ASPx.IsNumber(value))
640   value = startValue;
641  var func = isMax ? Math.max : Math.min;
642  return func(value, prevValue);
643 }, startValue);
644};
645var defaultBinarySearchComparer = function(array, index, value) {
646 var arrayElement = array[index];
647 if(arrayElement == value)
648  return 0;
649 else
650  return arrayElement < value ? -1 : 1;
651};
652Data.NearestLeftBinarySearchComparer = function(array, index, value) { 
653 var arrayElement = array[index];
654 var leftPoint = arrayElement < value;
655 var lastLeftPoint = leftPoint && index == array.length - 1;
656 var nearestLeftPoint = lastLeftPoint || (leftPoint && array[index + 1] >= value);
657 if(nearestLeftPoint)
658  return 0;
659 else
660  return arrayElement < value ? -1 : 1;
661};
662Data.ArrayBinarySearch = function(array, value, binarySearchComparer, startIndex, length) {
663 if(!binarySearchComparer)
664  binarySearchComparer = defaultBinarySearchComparer;
665 if(!ASPx.IsExists(startIndex))
666  startIndex = 0;
667 if(!ASPx.IsExists(length))
668  length = array.length - startIndex;
669 var endIndex = (startIndex + length) - 1;
670 while(startIndex <= endIndex) {
671  var middle = (startIndex + ((endIndex - startIndex) >> 1));
672  var compareResult = binarySearchComparer(array, middle, value);
673  if(compareResult == 0)
674   return middle;
675  if(compareResult < 0)
676   startIndex = middle + 1;
677  else
678   endIndex = middle - 1;
679 }
680 return -(startIndex + 1);
681};
682Data.ArrayFlatten = function(arrayOfArrays) {
683 return [].concat.apply([], arrayOfArrays);
684};
685Data.GetDistinctArray = function(array) {
686 var resultArray = [];
687 for(var i = 0; i < array.length; i++) {
688  var currentEntry = array[i];
689  if(Data.ArrayIndexOf(resultArray, currentEntry) == -1) {
690   resultArray.push(currentEntry);
691  }
692 }
693 return resultArray;
694};
695Data.ForEach = function(arr, callback) {
696 if(Array.prototype.forEach) {
697  Array.prototype.forEach.call(arr, callback);
698 } else {
699  for(var i = 0, len = arr.length; i < len; i++) {
700   callback(arr[i], i, arr);
701  }
702 }
703};
704Data.MergeHashTables = function(target, object) {
705 if(!object || typeof (object) == "string")
706  return target;
707 if(!target)
708  target = {};
709 for(var key in object)
710  if(key && !(key in target))
711   target[key] = object[key];
712 return target;
713};
714Data.Range = function(count, start) {
715 count = parseInt(count) || 0;
716 start = parseInt(start) || 0;
717 if(count < 0) count = 0;
718 if(start < 0) start = 0;
719 return Array.apply(null, Array(count)).map(function(val, i) { return start + i; });
720};
721ASPx.Data = Data;
722var Cookie = { };
723Cookie.DelCookie = function(name){
724 setCookieInternal(name, "", new Date(1970, 1, 1));
725};
726Cookie.GetCookie = function(name) {
727 name = escape(name);
728 var cookies = document.cookie.split(';');
729 for(var i = 0; i < cookies.length; i++) {
730  var cookie = Str.Trim(cookies[i]);
731  if(cookie.indexOf(name + "=") == 0)
732   return unescape(cookie.substring(name.length + 1, cookie.length));
733  else if(cookie.indexOf(name + ";") == 0 || cookie === name)
734   return "";
735 }
736 return null;
737};
738Cookie.SetCookie = function(name, value, expirationDate){
739 if(!ASPx.IsExists(value)) {
740  Cookie.DelCookie(name);
741  return;
742 }
743 if(!ASPx.Ident.IsDate(expirationDate)) {
744  expirationDate = new Date();
745  expirationDate.setFullYear(expirationDate.getFullYear() + 1);
746 }
747 setCookieInternal(name, value, expirationDate);
748};
749function setCookieInternal(name, value, date){
750 document.cookie = escape(name) + "=" + escape(value.toString()) + "; expires=" + date.toGMTString() + "; path=/";
751}
752ASPx.Cookie = Cookie;
753ASPx.ImageUtils = {
754 GetImageSrc: function (image){
755  return image.src;
756 },
757 SetImageSrc: function(image, src){
758  image.src = src;
759 },
760 SetSize: function(image, width, height){
761  image.style.width = width + "px";
762  image.style.height = height + "px";
763 },
764 GetSize: function(image, isWidth) {
765  return (isWidth ? ASPx.GetElementOffsetWidth(image) : ASPx.GetElementOffsetHeight(image));
766 }
767};
768var Str = { };
769Str.ApplyReplacement = function(text, replecementTable) {
770 if(typeof(text) != "string")
771  text = text.toString();
772 for(var i = 0; i < replecementTable.length; i++) {
773  var replacement = replecementTable[i];
774  text = text.replace(replacement[0], replacement[1]);
775 }
776 return text;
777};
778Str.CompleteReplace = function(text, regexp, newSubStr) {
779 if(typeof(text) != "string")
780  text = text.toString();
781 var textPrev;
782 do {
783  textPrev = text;
784  text = text.replace(regexp, newSubStr);
785 } while(text != textPrev);
786 return text;
787};
788Str.EncodeHtml = function(html) {
789 return Str.ApplyReplacement(html, [
790  [ /&amp;/g,  '&ampx;'  ], [ /&/g, '&amp;'  ],
791  [ /&quot;/g, '&quotx;' ], [ /"/g, '&quot;' ],
792  [ /&lt;/g,   '&ltx;'   ], [ /</g, '&lt;'   ],
793  [ /&gt;/g,   '&gtx;'   ], [ />/g, '&gt;'   ]
794 ]);
795};
796Str.DecodeHtml = function(html) {
797 return Str.ApplyReplacement(html, [
798  [ /&gt;/g,   '>' ], [ /&gtx;/g,  '&gt;'   ],
799  [ /&lt;/g,   '<' ], [ /&ltx;/g,  '&lt;'   ],
800  [ /&quot;/g, '"' ], [ /&quotx;/g,'&quot;' ],
801  [ /&amp;/g,  '&' ], [ /&ampx;/g, '&amp;'  ]
802 ]);
803};
804Str.DecodeHtmlViaTextArea = function(html) {
805 var textArea = document.createElement("TEXTAREA");
806 setInnerHtmlInternal(textArea, html);
807 return textArea.value;
808};
809Str.TrimStart = function(str) { 
810 return trimInternal(str, true);
811};
812Str.TrimEnd = function(str) { 
813 return trimInternal(str, false, true);
814};
815Str.Trim = function(str) { 
816 return trimInternal(str, true, true); 
817};
818Str.EscapeForRegEx = function(str) {
819 return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
820};
821var whiteSpaces = { 
822 0x0009: 1, 0x000a: 1, 0x000b: 1, 0x000c: 1, 0x000d: 1, 0x0020: 1, 0x0085: 1, 
823 0x00a0: 1, 0x1680: 1, 0x180e: 1, 0x2000: 1, 0x2001: 1, 0x2002: 1, 0x2003: 1, 
824 0x2004: 1, 0x2005: 1, 0x2006: 1, 0x2007: 1, 0x2008: 1, 0x2009: 1, 0x200a: 1, 
825 0x200b: 1, 0x2028: 1, 0x2029: 1, 0x202f: 1, 0x205f: 1, 0x3000: 1, 0xfeff: 1
826};
827var caretWidth = 1;
828function trimInternal(source, trimStart, trimEnd) {
829 var len = source.length;
830 if(!len)
831  return source;
832 var result = "";
833 if(len < 0xBABA1) 
834  result = trimSource(source, trimStart, trimEnd);
835 else
836  result = trimLargeSource(source, len, trimStart, trimEnd);
837 return Str.ClearString(result);
838}
839function trimSource(source, trimStart, trimEnd) {
840 var result = source;
841 if(trimStart)
842  result = result.replace(/^\s+/, "");
843 if(trimEnd)
844  result = result.replace(/\s+$/, "");
845 return result;
846}
847function trimLargeSource(source, len, trimStart, trimEnd) {
848 var start = 0;
849 if(trimEnd) {
850  while(len > 0 && whiteSpaces[source.charCodeAt(len - 1)]) {
851   len--;
852  }
853 }
854 if(trimStart && len > 0) {
855  while(start < len && whiteSpaces[source.charCodeAt(start)]) {
856   start++;
857  }
858 }
859 return source.substring(start, len);
860}
861var inlineStringLength = 12;
862Str.ClearString = function(str) { 
863 if(!ASPx.Browser.Chrome)
864  return str;
865 return str.length < inlineStringLength ? str : JSON.parse(JSON.stringify(str));
866};
867Str.Insert = function(str, subStr, index) { 
868 var leftText = str.slice(0, index);
869 var rightText = str.slice(index);
870 return leftText + subStr + rightText;
871};
872Str.InsertEx = function(str, subStr, startIndex, endIndex) { 
873 var leftText = str.slice(0, startIndex);
874 var rightText = str.slice(endIndex);
875 return leftText + subStr + rightText;
876};
877var greekSLFSigmaChar = String.fromCharCode(962);
878var greekSLSigmaChar = String.fromCharCode(963);
879Str.PrepareStringForFilter = function(s, saveCaseSensitive){
880 if(!saveCaseSensitive)
881  s = s.toLowerCase();
882 if(ASPx.Browser.WebKitFamily) {
883  return s.replace(new RegExp(greekSLFSigmaChar, "g"), greekSLSigmaChar);
884 }
885 return s;
886};
887Str.GetCoincideCharCount = function(text, filter, textMatchingDelegate) {
888 var coincideText = ASPx.Str.PrepareStringForFilter(filter);
889 var originText = ASPx.Str.PrepareStringForFilter(text);
890 while(coincideText != "" && !textMatchingDelegate(originText, coincideText)) {
891  coincideText = coincideText.slice(0, -1);
892 }
893 return coincideText.length;
894};
895Str.EndsWith = function(str, suffix) {
896 return str.indexOf(suffix, str.length - suffix.length) !== -1;
897};
898ASPx.Str = Str;
899var Xml = { };
900Xml.Parse = function(xmlStr) {
901 if(window.DOMParser) {
902  var parser = new DOMParser();
903  return parser.parseFromString(xmlStr, "text/xml");
904 }
905 else if(window.ActiveXObject) {
906  var xmlDoc = new window.ActiveXObject("Microsoft.XMLDOM");
907  if(xmlDoc) {
908   xmlDoc.async = false;
909   xmlDoc.loadXML(xmlStr);
910   return xmlDoc;
911  }
912 }
913 return null;
914};
915ASPx.Xml = Xml;
916ASPx.Key = {
917 F1     : 112,
918 F2     : 113,
919 F3     : 114,
920 F4     : 115,
921 F5     : 116,
922 F6     : 117,
923 F7     : 118,
924 F8     : 119,
925 F9     : 120,
926 F10    : 121,
927 F11    : 122,
928 F12    : 123,
929 Ctrl   : 17,
930 Shift  : 16,
931 Alt    : 18,
932 Enter  : 13,
933 Home   : 36,
934 End    : 35,
935 Left   : 37,
936 Right  : 39,
937 Up     : 38,
938 Down   : 40,
939 PageUp    : 33,
940 PageDown  : 34,
941 Esc    : 27,
942 Space  : 32,
943 Tab    : 9,
944 Backspace : 8,
945 Delete    : 46,
946 Insert    : 45,
947 ContextMenu  : 93,
948 Windows   : 91,
949 Decimal   : 110,
950 CapsLock  : 20
951};
952ASPx.ModifierKey = {
953 None: 0,
954 Ctrl: 1 << (0 + 16),
955 Shift: 1 << (2 + 16),
956 Alt: 1 << (4 + 16),
957 Meta: 1 << (8 + 16)
958};
959ASPx.KeyCode = {
960 Backspace : 8,
961 Tab    : 9,
962 Enter  : 13,
963 Pause  : 19,
964 CapsLock  : 20,
965 Esc    : 27,
966 Space  : 32,
967 PageUp    : 33,
968 PageDown  : 34,
969 End    : 35,
970 Home   : 36,
971 Left   : 37,
972 Up     : 38,
973 Right  : 39,
974 Down   : 40,
975 Insert    : 45,
976 Delete    : 46,
977 Key_0  : 48,
978 Key_1  : 49,
979 Key_2  : 50,
980 Key_3  : 51,
981 Key_4  : 52,
982 Key_5  : 53,
983 Key_6  : 54,
984 Key_7  : 55,
985 Key_8  : 56,
986 Key_9  : 57,
987 Key_a  : 65,
988 Key_b  : 66,
989 Key_c  : 67,
990 Key_d  : 68,
991 Key_e  : 69,
992 Key_f  : 70,
993 Key_g  : 71,
994 Key_h  : 72,
995 Key_i  : 73,
996 Key_j  : 74,
997 Key_k  : 75,
998 Key_l  : 76,
999 Key_m  : 77,
1000 Key_n  : 78,
1001 Key_o  : 79,
1002 Key_p  : 80,
1003 Key_q  : 81,
1004 Key_r  : 82,
1005 Key_s  : 83,
1006 Key_t  : 84,
1007 Key_u  : 85,
1008 Key_v  : 86,
1009 Key_w  : 87,
1010 Key_x  : 88,
1011 Key_y  : 89,
1012 Key_z  : 90,
1013 Windows   : 91,
1014 ContextMenu  : 93,
1015 Numpad_0  : 96,
1016 Numpad_1  : 97,
1017 Numpad_2  : 98,
1018 Numpad_3  : 99,
1019 Numpad_4  : 100,
1020 Numpad_5  : 101,
1021 Numpad_6  : 102,
1022 Numpad_7  : 103,
1023 Numpad_8  : 104,
1024 Numpad_9  : 105,
1025 Multiply  : 106,
1026 Add    : 107,
1027 Subtract  : 109,
1028 Decimal   : 110,
1029 Divide    : 111,
1030 F1     : 112,
1031 F2     : 113,
1032 F3     : 114,
1033 F4     : 115,
1034 F5     : 116,
1035 F6     : 117,
1036 F7     : 118,
1037 F8     : 119,
1038 F9     : 120,
1039 F10    : 121,
1040 F11    : 122,
1041 F12    : 123,
1042 NumLock   : 144,
1043 ScrollLock   : 145,
1044 Semicolon : 186,
1045 Equals    : 187,
1046 Comma  : 188,
1047 Dash   : 189,
1048 Period    : 190,
1049 ForwardSlash : 191,
1050 GraveAccent  : 192,
1051 OpenBracket  : 219,
1052 BackSlash : 220,
1053 CloseBracket : 221,
1054 SingleQuote  : 222
1055};
1056ASPx.ScrollBarMode = { Hidden: 0, Visible: 1, Auto: 2 };
1057ASPx.ColumnResizeMode = { None: 0, Control: 1, NextColumn: 2 };
1058var Selection = { };
1059Selection.Set = function(input, startPos, endPos, scrollToSelection, isApi) {
1060 if(!ASPx.IsExistsElement(input))
1061  return;
1062 var isInputFocused = ASPx.GetActiveElement() === input;
1063 var isInputNativeFocusLocked = ASPx.VirtualKeyboardUI.getInputNativeFocusLocked();
1064 if(!isApi && Browser.VirtualKeyboardSupported && (!isInputFocused || isInputNativeFocusLocked))
1065  return;
1066 var textLen = input.value.length;
1067 startPos = ASPx.GetDefinedValue(startPos, 0);
1068 endPos = ASPx.GetDefinedValue(endPos, textLen);
1069 if(startPos < 0)
1070  startPos = 0;
1071 if(endPos < 0 || endPos > textLen)
1072  endPos = textLen;
1073 if(startPos > endPos)
1074  startPos = endPos;
1075 var makeReadOnly = false;
1076 if(Browser.WebKitFamily && input.readOnly) {
1077  input.readOnly = false;
1078  makeReadOnly = true;
1079 }
1080 try {
1081  if(Browser.Firefox && Browser.Version >= 8) 
1082   input.setSelectionRange(startPos, endPos, "backward");
1083  else {
1084   forceScrollToSelectionRange(input, startPos, endPos);
1085   input.setSelectionRange(startPos, endPos);
1086  }
1087  if(Browser.Opera || Browser.Firefox || Browser.Chrome || Browser.Edge || Browser.EdgeWebKit) 
1088   input.focus();
1089 } catch(e) { }
1090 if(scrollToSelection && input.tagName == 'TEXTAREA') {
1091  var scrollHeight = input.scrollHeight;
1092  var approxCaretPos = startPos;
1093  var scrollTop = Math.max(Math.round(approxCaretPos * scrollHeight / textLen  - input.clientHeight / 2), 0);
1094  input.scrollTop = scrollTop;
1095 }
1096 if(makeReadOnly)
1097  input.readOnly = true;
1098};
1099var getTextWidthBeforePos = function(input, pos) {
1100 return ASPx.GetSizeOfText(input.value.toString().substr(0, pos), ASPx.GetCurrentStyle(input)).width;
1101};
1102var forceScrollToSelectionRange = function(input, startPos, endPos) {
1103 if(endPos === input.value.length)
1104  input.scrollLeft = input.scrollWidth;
1105 else if(startPos === 0 && endPos === 0)
1106  input.scrollLeft = 0;
1107 else {
1108  var inputRawWidth = ASPx.GetElementOffsetWidth(input) - ASPx.GetLeftRightBordersAndPaddingsSummaryValue(input);
1109  if(inputRawWidth < input.scrollWidth) {
1110   var widthBeforeEndPos = getTextWidthBeforePos(input, endPos) + caretWidth;
1111   if(input.scrollLeft < widthBeforeEndPos - inputRawWidth)
1112    input.scrollLeft = widthBeforeEndPos - inputRawWidth;
1113   else {
1114    var widthBeforeStartPos = getTextWidthBeforePos(input, startPos) - caretWidth;
1115    if(input.scrollLeft > widthBeforeStartPos)
1116     input.scrollLeft = widthBeforeStartPos;
1117   }
1118  }
1119 }
1120};
1121Selection.GetInfo = function(input) {
1122 var start, end;
1123 try {
1124  start = input.selectionStart;
1125  end = input.selectionEnd;
1126 } catch (e) {
1127 }
1128 return { startPos: start, endPos: end };
1129};
1130Selection.GetExtInfo = function(input) {
1131 var start = 0, end = 0;
1132 try {
1133  start = input.selectionStart;
1134  end = input.selectionEnd;
1135 } catch (e) {
1136 }
1137 return {startPos: start, endPos: end}; 
1138};
1139Selection.SetCaretPosition = function(input, caretPos) {
1140 if(typeof caretPos === "undefined" || caretPos < 0)
1141  caretPos = input.value.length;
1142 Selection.Set(input, caretPos, caretPos, true);
1143};
1144Selection.GetCaretPosition = function(element, isDialogMode) {
1145 var pos = 0;
1146 if("selectionStart" in element) {
1147  pos = element.selectionStart;
1148 } else if("selection" in document) {
1149  element.focus();
1150  var sel = document.selection.createRange(),
1151   selLength = document.selection.createRange().text.length;
1152  sel.moveStart("character", -element.value.length);
1153  pos = sel.text.length - selLength;
1154 }
1155 if(isDialogMode && !pos) {
1156  pos = element.value.length - 1;
1157 }
1158 return pos;
1159};
1160Selection.Clear = function() {
1161 try {
1162  if(window.getSelection) {
1163   window.getSelection().removeAllRanges();
1164  }
1165  else if(document.selection) {
1166   if(document.selection.empty)
1167    document.selection.empty();
1168   else if(document.selection.clear)
1169    document.selection.clear();
1170  }
1171 } catch(e) {
1172 }
1173};
1174Selection.ClearOnMouseMove = function(evt) {
1175 Selection.Clear();
1176};
1177Selection.SetElementSelectionEnabled = function(element, value) {
1178 var userSelectValue = value ? "" : "none";
1179 var func = value ? Evt.DetachEventFromElement : Evt.AttachEventToElement;
1180 if(Browser.Firefox)
1181  element.style.MozUserSelect = userSelectValue;
1182 else if(Browser.WebKitFamily)
1183  element.style.webkitUserSelect = userSelectValue;
1184 else if(Browser.Edge)
1185  element.style.msUserSelect = userSelectValue;
1186 else if(Browser.Opera)
1187  func(element, "mousemove", Selection.Clear);
1188 else {
1189  func(element, "selectstart", ASPx.FalseFunction);
1190  func(element, "mousemove", Selection.Clear);
1191 }
1192};
1193Selection.SetElementAsUnselectable = function(element, isWithChild, recursive) {
1194 if(element && element.nodeType == 1) {
1195  element.unselectable = "on";
1196  if(Browser.NetscapeFamily)
1197   element.onmousedown = ASPx.FalseFunction;
1198  if(Browser.WebKitFamily)
1199   Evt.AttachEventToElement(element, "mousedown", Evt.PreventEventAndBubble);
1200  if(isWithChild === true){
1201   for(var j = 0; j < element.childNodes.length; j ++)
1202    Selection.SetElementAsUnselectable(element.childNodes[j], (!!recursive ? true : false), (!!recursive));
1203  }
1204 }
1205};
1206Selection.AreEqual = function(selection1, selection2) {
1207 return selection1.startPos === selection2.startPos && selection1.endPos === selection2.endPos;
1208};
1209ASPx.Selection = Selection;
1210var MouseScroller = { };
1211MouseScroller.MinimumOffset = 10;
1212MouseScroller.Create = function(getElement, getScrollXElement, getScrollYElement, needPreventScrolling, vertRecursive, onMouseDown, onMouseMove, onMouseUp, onMouseUpMissed) {
1213 var element = getElement();
1214 if(!element) 
1215  return;
1216 if(!element.dxMouseScroller)
1217  element.dxMouseScroller = new MouseScroller.Extender(getElement, getScrollXElement, getScrollYElement, needPreventScrolling, vertRecursive, onMouseDown, onMouseMove, onMouseUp, onMouseUpMissed);
1218 return element.dxMouseScroller;
1219};
1220MouseScroller.Extender = function(getElement, getScrollXElement, getScrollYElement, needPreventScrolling, vertRecursive, onMouseDown, onMouseMove, onMouseUp, onMouseUpMissed) {
1221 this.getElement = getElement;
1222 this.getScrollXElement = getScrollXElement;
1223 this.getScrollYElement = getScrollYElement;
1224 this.needPreventScrolling = needPreventScrolling;
1225 this.vertRecursive = !!vertRecursive;
1226 this.createHandlers(onMouseDown || function() { }, onMouseMove || function() { }, onMouseUp || function() { }, onMouseUpMissed || function() { });
1227 this.update();
1228};
1229MouseScroller.Extender.prototype = {
1230 update: function() {
1231  if(this.element)
1232   Evt.DetachEventFromElement(this.element, ASPx.TouchUIHelper.touchMouseDownEventName, this.mouseDownHandler);
1233  this.element = this.getElement();
1234  Evt.AttachEventToElement(this.element, ASPx.TouchUIHelper.touchMouseDownEventName, this.mouseDownHandler);  
1235  Evt.AttachEventToElement(this.element, "click", this.mouseClickHandler);   
1236  if(Browser.MSTouchUI && this.element.className.indexOf(ASPx.TouchUIHelper.msTouchDraggableClassName) < 0)
1237   this.element.className += " " + ASPx.TouchUIHelper.msTouchDraggableClassName;
1238  this.scrollXElement = this.getScrollXElement();
1239  this.scrollYElement = this.getScrollYElement();
1240 },
1241 createHandlers: function(onMouseDown, onMouseMove, onMouseUp, onMouseUpMissed) {
1242  var mouseDownCounter = 0;
1243  this.onMouseDown = onMouseDown;
1244  this.onMouseMove = onMouseMove;
1245  this.onMouseUp = onMouseUp;  
1246  this.mouseDownHandler = function(e) {
1247   if(mouseDownCounter++ > 0) {
1248    this.finishScrolling();
1249    onMouseUpMissed();
1250   }
1251   var eventSource = Evt.GetEventSource(e);
1252   var requirePreventCustonScroll = ASPx.IsExists(ASPx.TouchUIHelper.RequirePreventCustomScroll) && ASPx.TouchUIHelper.RequirePreventCustomScroll(eventSource, this.element);
1253   this.requirePreventScroll = requirePreventCustonScroll || this.needPreventScrolling && this.needPreventScrolling(eventSource);
1254   if(this.requirePreventScroll)
1255    return;
1256   this.scrollableTreeLine = this.GetScrollableElements();
1257   this.firstX = this.prevX = Evt.GetEventX(e);
1258   this.firstY = this.prevY = Evt.GetEventY(e);
1259   Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseMoveEventName, this.mouseMoveHandler);
1260   Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseUpEventName, this.mouseUpHandler);
1261   this.onMouseDown(e);
1262  }.aspxBind(this);
1263  this.mouseMoveHandler = function(e) {
1264   if(ASPx.TouchUIHelper.isGesture)
1265    return;
1266   var x = Evt.GetEventX(e);
1267   var y = Evt.GetEventY(e);
1268   var xDiff = this.prevX - x;
1269   var yDiff = this.prevY - y;
1270   if(this.vertRecursive) {
1271    var isTopDirection = yDiff < 0;
1272    this.scrollYElement = this.GetElementForVertScrolling(isTopDirection, this.prevIsTopDirection, this.scrollYElement);
1273    this.prevIsTopDirection = isTopDirection;
1274   }
1275   if(this.scrollXElement && xDiff != 0)
1276    this.scrollXElement.scrollLeft += xDiff;
1277   if(this.scrollYElement && yDiff != 0) {
1278    this.scrollYElement.scrollTop += yDiff;
1279    var isOuterScrollableElement = this.scrollableTreeLine[this.scrollableTreeLine.length - 1] == this.scrollYElement;
1280    if(isOuterScrollableElement)
1281     y += yDiff;
1282   }
1283   this.prevX = x;
1284   this.prevY = y;
1285   Evt.PreventEvent(e);
1286   this.onMouseMove(e);
1287  }.aspxBind(this);
1288  this.mouseUpHandler = function(e) {
1289   this.finishScrolling();
1290   this.onMouseUp(e);
1291  }.aspxBind(this);
1292  this.mouseClickHandler = function(e){
1293   if(this.requirePreventScroll || (ASPx.IsExists(e.isTrusted) && !e.isTrusted))
1294    return;
1295   var xDiff = this.firstX - Evt.GetEventX(e);
1296   var yDiff = this.firstY - Evt.GetEventY(e);
1297   if(xDiff > MouseScroller.MinimumOffset || yDiff > MouseScroller.MinimumOffset)
1298    return Evt.PreventEventAndBubble(e);
1299  }.aspxBind(this);
1300  this.finishScrolling = function() {
1301   Evt.DetachEventFromDocument(ASPx.TouchUIHelper.touchMouseMoveEventName, this.mouseMoveHandler);
1302   Evt.DetachEventFromDocument(ASPx.TouchUIHelper.touchMouseUpEventName, this.mouseUpHandler);
1303   this.scrollableTreeLine = [];
1304   this.prevIsTopDirection = null;
1305   mouseDownCounter--;
1306  };
1307 },
1308 GetScrollableElements: function() {
1309  if(!this.vertRecursive) return [ ];
1310  var isHtmlScrollableElement = !ASPx.Browser.IsQuirksMode && !ASPx.Browser.Safari;
1311  var outerScrollableElementTag = isHtmlScrollableElement ? "HTML" : "BODY";
1312  return ASPx.GetElementTreeLine(this.element, null, function(el) { return el == document; })
1313   .filter(function(el) {
1314    var tagName = el.tagName;
1315    if(isHtmlScrollableElement && tagName == "BODY")
1316     return false;
1317    return ASPx.IsScrollableElement(el, false, true) || tagName == outerScrollableElementTag || el.dxScrollable;
1318   }.bind(this));
1319 },
1320 GetElementForVertScrolling: function(currentIsTop, prevIsTop, prevElement) {
1321  if(prevElement && currentIsTop === prevIsTop && this.GetVertScrollExcess(prevElement, currentIsTop) > 0)
1322   return prevElement;
1323  for(var i = 0; i < this.scrollableTreeLine.length; i++) {
1324   var element = this.scrollableTreeLine[i];
1325   var excess = this.GetVertScrollExcess(element, currentIsTop);
1326   if(excess > 0)
1327    return element;
1328  }
1329  return null;
1330 },
1331 GetVertScrollExcess: function(element, isTop) {
1332  if(isTop)
1333   return element.scrollTop;
1334  var isDocument = element.tagName == "HTML" || ASPx.Browser.Safari && !ASPx.Browser.IsQuirksMode && element.tagName == "BODY";
1335  var clientHeight = isDocument ? ASPx.GetDocumentClientHeight() : element.clientHeight;
1336  return element.scrollHeight - clientHeight - element.scrollTop;
1337 }
1338};
1339ASPx.MouseScroller = MouseScroller;
1340var Evt = { };
1341Evt.GetEvent = function(evt){
1342 return evt; 
1343};
1344Evt.IsEventPrevented = function(evt) {
1345 return evt.defaultPrevented || evt.returnValue === false;
1346};
1347Evt.PreventEvent = function(evt){
1348 if(evt.preventDefault) {
1349  if(evt.cancelable)
1350   evt.preventDefault();
1351 }
1352 else
1353  evt.returnValue = false;
1354 return false;
1355};
1356Evt.PreventEventAndBubble = function(evt){
1357 Evt.PreventEvent(evt);
1358 if(evt.stopPropagation)
1359  evt.stopPropagation();
1360 evt.cancelBubble = true;
1361 return false;
1362};
1363Evt.CancelBubble = function(evt){
1364 evt.stopPropagation();
1365 return false;
1366};
1367Evt.PreventImageDragging = function(image) {
1368 if(image)
1369  image.ondragstart = function() { return false; };
1370};
1371Evt.PreventDragStart = function(evt) {
1372 evt = Evt.GetEvent(evt);
1373 var element = Evt.GetEventSource(evt);
1374 if(element.releaseCapture)
1375  element.releaseCapture(); 
1376 return false;
1377};
1378Evt.PreventElementDrag = function(element) {
1379 Evt.AttachEventToElement(element, "mousedown", Evt.PreventEvent);
1380};
1381Evt.PreventElementDragAndSelect = function(element, skipMouseMove, skipIESelect){
1382 if(Browser.WebKitFamily)
1383  Evt.AttachEventToElement(element, "selectstart", Evt.PreventEventAndBubble);
1384};
1385Evt.GetEventSource = function(evt){
1386 if(!ASPx.IsExists(evt)) return null; 
1387 return evt.srcElement ? evt.srcElement : evt.target;
1388};
1389Evt.GetKeyCode = function(srcEvt) {
1390 return Browser.NetscapeFamily || Browser.Opera ? srcEvt.which : srcEvt.keyCode;
1391};
1392function clientEventRequiresDocScrollCorrection() {
1393 var isSafariVerLess3 = Browser.Safari && Browser.Version < 3,
1394  isMacOSMobileVerLess51 = Browser.MacOSMobilePlatform && Browser.Version < 5.1;
1395 return Browser.AndroidDefaultBrowser || Browser.AndroidChromeBrowser || !(isSafariVerLess3 || isMacOSMobileVerLess51);
1396}
1397Evt.GetEventX = function(evt){
1398 if(ASPx.TouchUIHelper.isTouchEvent(evt))
1399  return ASPx.TouchUIHelper.getEventX(evt);
1400 return evt.clientX + (clientEventRequiresDocScrollCorrection() ? ASPx.GetDocumentScrollLeft() : 0);
1401};
1402Evt.GetEventY = function(evt){
1403 if(ASPx.TouchUIHelper.isTouchEvent(evt))
1404  return ASPx.TouchUIHelper.getEventY(evt);
1405 return evt.clientY + (clientEventRequiresDocScrollCorrection() ? ASPx.GetDocumentScrollTop() : 0 );
1406};
1407Evt.IsLeftButtonPressed = function(evt) {
1408 if(ASPx.TouchUIHelper.isTouchEvent(evt))
1409  return true;
1410 evt = Evt.GetEvent(evt);
1411 if(!evt) return false;
1412 if(Browser.WebKitFamily) {
1413  if(evt.type === "pointermove")
1414   return evt.buttons === 1;
1415  return evt.which == 1;
1416 } else if(Browser.NetscapeFamily || Browser.Edge) {
1417  if(evt.type === ASPx.TouchUIHelper.touchMouseMoveEventName)
1418   return evt.buttons === 1;
1419  return evt.which == 1;
1420 } else if(Browser.Opera)
1421  return evt.button == 0;
1422 return true;
1423};
1424Evt.IsRightButtonPressed = function(evt){
1425 evt = Evt.GetEvent(evt);
1426 if(!ASPx.IsExists(evt)) return false;
1427 if(Browser.IE || Browser.Edge) {
1428  if(evt.type === "pointermove")
1429   return evt.buttons === 2;
1430  return evt.button == 2;
1431 }
1432 else if(Browser.NetscapeFamily || Browser.WebKitFamily)
1433  return evt.which == 3;
1434 else if (Browser.Opera)
1435  return evt.button == 1;
1436 return true;
1437};
1438Evt.GetWheelDelta = function(evt) {
1439 var ret;
1440 if(Browser.NetscapeFamily && Browser.MajorVersion < 17)
1441  ret = -evt.detail;
1442 else if(Browser.Safari)
1443  ret = evt.wheelDelta;
1444 else
1445  ret = -evt.deltaY;
1446 if(Browser.Opera && Browser.Version < 9)
1447  ret = -ret;
1448 return ret;
1449};
1450Evt.IsWheelEventWithDirection = function(evt) {
1451 return ASPx.Data.ArrayContains(["wheel", "mousewheel"], evt.type);
1452};
1453Evt.GetWheelDeltaX = function(evt) {
1454 if(evt.type === "wheel")
1455  return -evt.deltaX;
1456 if(evt.type === "mousewheel")
1457  return evt.wheelDeltaX;
1458};
1459Evt.GetWheelDeltaY = function(evt) {
1460 if(evt.type === "wheel")
1461  return -evt.deltaY;
1462 if(evt.type === "mousewheel")
1463  return evt.wheelDeltaY;
1464};
1465Evt.IsPassiveListenersSupported = function() {
1466 if(Browser.Chrome && Browser.MajorVersion > 69 || Browser.Edge && Browser.MajorVersion > 15 || Browser.Firefox && Browser.MajorVersion > 62)
1467  return true;
1468 if(Evt.isPassiveListenersSupported === undefined) {
1469  Evt.isPassiveListenersSupported = false;
1470  try {
1471   var options = Object.defineProperty({}, "passive", { get: function() { Evt.isPassiveListenersSupported = true; } });
1472   window.addEventListener("test", options, options);
1473   window.removeEventListener("test", options, options);
1474  }
1475  catch(err) { Evt.isPassiveListenersSupported = false; }
1476 }
1477 return !!Evt.isPassiveListenersSupported;
1478};
1479Evt.AttachEventToElement = function(element, eventName, func, onlyBubbling, passive) {
1480 if(element.addEventListener)
1481  element.addEventListener(eventName, func, Evt.IsPassiveListenersSupported() ? { capture: !onlyBubbling, passive: !!passive } : !onlyBubbling);
1482 else
1483  element.attachEvent("on" + eventName, func);
1484};
1485Evt.DetachEventFromElement = function(element, eventName, func, onlyBubbling) {
1486 if(element.removeEventListener)
1487  element.removeEventListener(eventName, func, Evt.IsPassiveListenersSupported() ? { capture: !onlyBubbling } : !onlyBubbling);
1488 else
1489  element.detachEvent("on" + eventName, func);
1490};
1491Evt.AttachEventToDocument = function(eventName, func) {
1492 var attachingAllowed = ASPx.TouchUIHelper.onEventAttachingToDocument(eventName, func);
1493 if(attachingAllowed)
1494  Evt.AttachEventToDocumentCore(eventName, func);
1495};
1496Evt.AttachEventToDocumentCore = function(eventName, func) {
1497 Evt.AttachEventToElement(document, eventName, func);
1498};
1499Evt.DetachEventFromDocument = function(eventName, func) {
1500 Evt.DetachEventFromDocumentCore(eventName, func);
1501 ASPx.TouchUIHelper.onEventDettachedFromDocument(eventName, func);
1502};
1503Evt.DetachEventFromDocumentCore = function(eventName, func){
1504 Evt.DetachEventFromElement(document, eventName, func);
1505};
1506Evt.GetMouseWheelEventName = function() {
1507 if(Browser.Safari)
1508  return "mousewheel";
1509 if(Browser.NetscapeFamily && Browser.MajorVersion < 17)
1510  return "DOMMouseScroll";
1511 return "wheel";
1512};
1513Evt.AttachMouseEnterToElement = function (element, onMouseOverHandler, onMouseOutHandler) {
1514 Evt.AttachEventToElement(element, ASPx.TouchUIHelper.pointerEnabled ? ASPx.TouchUIHelper.pointerOverEventName : "mouseover", function (evt) { mouseEnterHandler(evt, element, onMouseOverHandler, onMouseOutHandler); });
1515 Evt.AttachEventToElement(element, ASPx.TouchUIHelper.pointerEnabled ? ASPx.TouchUIHelper.pointerOutEventName : "mouseout", function (evt) { mouseEnterHandler(evt, element, onMouseOverHandler, onMouseOutHandler); });
1516};
1517Evt.GetEventRelatedTarget = function(evt, isMouseOverEvent) {
1518 return evt.relatedTarget || (isMouseOverEvent ? evt.srcElement : evt.toElement);
1519};
1520function mouseEnterHandler(evt, element, onMouseOverHandler, onMouseOutHandler) {
1521 var isMouseOverExecuted = !!element.dxMouseOverExecuted;
1522 var isMouseOverEvent = (evt.type == "mouseover" || evt.type == ASPx.TouchUIHelper.pointerOverEventName);
1523 if(isMouseOverEvent && isMouseOverExecuted || !isMouseOverEvent && !isMouseOverExecuted)
1524  return;
1525 var source = Evt.GetEventRelatedTarget(evt, isMouseOverEvent);
1526 if(!ASPx.GetIsParent(element, source)) {
1527  element.dxMouseOverExecuted = isMouseOverEvent;
1528  if(isMouseOverEvent)
1529   onMouseOverHandler(element);
1530  else
1531   onMouseOutHandler(element);
1532 }
1533 else if(isMouseOverEvent && !isMouseOverExecuted) {
1534  element.dxMouseOverExecuted = true;
1535  onMouseOverHandler(element);
1536 }
1537}
1538Evt.DispatchEvent = function(target, eventName, canBubble, cancellable) {
1539 var event = document.createEvent("Event");
1540 event.initEvent(eventName, canBubble || false, cancellable || false);
1541 target.dispatchEvent(event);
1542};
1543Evt.EmulateDocumentOnMouseDown = function(evt) {
1544 Evt.EmulateOnMouseDown(document, evt);
1545};
1546Evt.EmulateOnMouseDown = function(element, evt) {
1547 if(!Browser.WebKitFamily){
1548  var emulatedEvt = document.createEvent("MouseEvents");
1549  emulatedEvt.initMouseEvent("mousedown", true, true, window, 0, evt.screenX, evt.screenY, 
1550   evt.clientX, evt.clientY, evt.ctrlKey, evt.altKey, evt.shiftKey, false, 0, null);
1551  element.dispatchEvent(emulatedEvt);
1552 }
1553};
1554Evt.EmulateOnMouseEvent = function (type, element, evt) {
1555 evt.type = type;
1556 var emulatedEvt = document.createEvent("MouseEvents");
1557 emulatedEvt.initMouseEvent(type, true, true, window, 0, evt.screenX, evt.screenY,
1558  evt.clientX, evt.clientY, evt.ctrlKey, evt.altKey, evt.shiftKey, false, 0, null);
1559 emulatedEvt.target = element;
1560 element.dispatchEvent(emulatedEvt);
1561};
1562Evt.EmulateMouseClick = function (element, evt) {
1563 var x = ASPx.GetElementOffsetWidth(element) / 2;
1564 var y = ASPx.GetElementOffsetHeight(element) / 2;
1565 if (!evt)
1566  evt = {
1567   bubbles: true,
1568   cancelable: true,
1569   view: window,
1570   detail: 1,
1571   screenX: 0,
1572   screenY: 0,
1573   clientX: x,
1574   clientY: y,
1575   ctrlKey: false,
1576   altKey: false,
1577   shiftKey: false,
1578   metaKey: false,
1579   button: 0,
1580   relatedTarget: null
1581  };
1582 Evt.EmulateOnMouseEvent("mousedown", element, evt);
1583 Evt.EmulateOnMouseEvent("mouseup", element, evt);
1584 Evt.EmulateOnMouseEvent("click", element, evt);
1585};
1586Evt.DoElementClick = function(element) {
1587 try{
1588  element.click();
1589 }
1590 catch(e){ 
1591 }
1592};
1593Evt.IsActionKeyPressed = function(evt) {
1594 return evt.keyCode === ASPx.Key.Space ||
1595     evt.keyCode === ASPx.Key.Enter ||
1596    (evt.keyCode === ASPx.Key.Down && evt.altKey);
1597};
1598Evt.InvokeMouseClickByKeyDown = function(evt, handler) {
1599 if(Evt.IsActionKeyPressed(evt)) {
1600  ASPx.Evt.PreventEvent(evt); 
1601  if(!handler)
1602   ASPx.Evt.GetEventSource(evt).onclick();
1603  else
1604   handler(evt);
1605 }
1606};
1607Evt.AttachContextMenuToElement = function (element, handler, onlyBubbling) {
1608 if (ASPx.TouchUIHelper.useLongTapHelper())
1609  element.detachContextMenuEventHandler = ASPx.TouchUIHelper.attachLongTapHandler(element, handler, onlyBubbling);
1610 else
1611  Evt.AttachEventToElement(element, "contextmenu", handler, onlyBubbling);
1612};
1613Evt.DetachContextMenuFromElement = function (element, handler) {
1614 if (element.detachContextMenuEventHandler)
1615  element.detachContextMenuEventHandler();
1616 else
1617  Evt.DetachEventFromElement(element, "contextmenu", handler);
1618};
1619Evt.PreventContextMenuOnElement = function(element) {
1620 Evt.AttachContextMenuToElement(element, function(evt) {
1621  Evt.PreventEvent(evt);
1622 });
1623};
1624ASPx.Evt = Evt;
1625var Attr = { };
1626Attr.GetAttribute = function(obj, attrName){
1627 if(obj.getAttribute)
1628  return obj.getAttribute(attrName);
1629 else if(obj.getPropertyValue) {
1630  if(Browser.Firefox) { 
1631   try {
1632    return obj.getPropertyValue(attrName);
1633   } catch(e) {
1634    return obj[attrName];
1635   }
1636  }
1637  return obj.getPropertyValue(attrName);
1638 }
1639 return null;
1640};
1641Attr.SetAttribute = function(obj, attrName, value){
1642 if(obj.setAttribute)
1643  obj.setAttribute(attrName, value);
1644 else if(obj.setProperty)
1645  obj.setProperty(attrName, value, "");
1646};
1647Attr.ToggleAttribute = function(obj, attrName, value, condition) {
1648 if(condition)
1649  Attr.SetAttribute(obj, attrName, value);
1650 else
1651  Attr.RemoveAttribute(obj, attrName);
1652};
1653Attr.RemoveAttribute = function(obj, attrName){
1654 if(obj.removeAttribute)
1655  obj.removeAttribute(attrName);
1656 else if(obj.removeProperty)
1657  obj.removeProperty(attrName);
1658};
1659Attr.IsExistsAttribute = function(obj, attrName){
1660 var value = Attr.GetAttribute(obj, attrName);
1661 return (value != null) && (value !== "");
1662};
1663Attr.SetOrRemoveAttribute = function(obj, attrName, value) {
1664 if(!value)
1665  Attr.RemoveAttribute(obj, attrName);
1666 else
1667  Attr.SetAttribute(obj, attrName, value);
1668};
1669Attr.SaveAttribute = function(obj, attrName, savedObj, savedAttrName){
1670 if(!Attr.IsExistsAttribute(savedObj, savedAttrName)){
1671  var oldValue = Attr.IsExistsAttribute(obj, attrName) ? Attr.GetAttribute(obj, attrName) : ASPx.EmptyObject;
1672  Attr.SetAttribute(savedObj, savedAttrName, oldValue);
1673 }
1674};
1675Attr.SaveStyleAttribute = function(obj, attrName){
1676 Attr.SaveAttribute(obj.style, attrName, obj, "saved" + attrName);
1677};
1678Attr.ChangeAttributeExtended = function(obj, attrName, savedObj, savedAttrName, newValue){
1679 Attr.SaveAttribute(obj, attrName, savedObj, savedAttrName);
1680 Attr.SetAttribute(obj, attrName, newValue);
1681};
1682Attr.ChangeAttribute = function(obj, attrName, newValue){
1683 Attr.ChangeAttributeExtended(obj, attrName, obj, "saved" + attrName, newValue);
1684};
1685Attr.ChangeStyleAttribute = function(obj, attrName, newValue){
1686 Attr.ChangeAttributeExtended(obj.style, attrName, obj, "saved" + attrName, newValue);
1687};
1688Attr.ResetAttributeExtended = function(obj, attrName, savedObj, savedAttrName){
1689 Attr.SaveAttribute(obj, attrName, savedObj, savedAttrName);
1690 Attr.SetAttribute(obj, attrName, "");
1691 Attr.RemoveAttribute(obj, attrName);
1692};
1693Attr.ResetAttribute = function(obj, attrName){
1694 Attr.ResetAttributeExtended(obj, attrName, obj, "saved" + attrName);
1695};
1696Attr.ResetStyleAttribute = function(obj, attrName){
1697 Attr.ResetAttributeExtended(obj.style, attrName, obj, "saved" + attrName);
1698};
1699Attr.RestoreAttributeExtended = function(obj, attrName, savedObj, savedAttrName){
1700 if(Attr.IsExistsAttribute(savedObj, savedAttrName)){
1701  var oldValue = Attr.GetAttribute(savedObj, savedAttrName);
1702  if(oldValue != ASPx.EmptyObject)
1703   Attr.SetAttribute(obj, attrName, oldValue);
1704  else
1705   Attr.RemoveAttribute(obj, attrName);
1706  Attr.RemoveAttribute(savedObj, savedAttrName);
1707  return true;
1708 }
1709 return false;
1710};
1711Attr.RestoreAttribute = function(obj, attrName){
1712 return Attr.RestoreAttributeExtended(obj, attrName, obj, "saved" + attrName);
1713};
1714Attr.RestoreStyleAttribute = function(obj, attrName){
1715 return Attr.RestoreAttributeExtended(obj.style, attrName, obj, "saved" + attrName);
1716};
1717Attr.CopyAllAttributes = function(sourceElem, destElement) {
1718 var attrs = sourceElem.attributes;
1719 for(var n = 0; n < attrs.length; n++) {
1720  var attr = attrs[n];
1721  if(attr.specified) {
1722   var attrName = attr.nodeName;
1723   var attrValue = sourceElem.getAttribute(attrName, 2);
1724   if(attrValue == null)
1725    attrValue = attr.nodeValue;
1726   destElement.setAttribute(attrName, attrValue, 0); 
1727  }
1728 }
1729 if(sourceElem.style.cssText !== '')
1730  destElement.style.cssText = sourceElem.style.cssText;
1731};
1732Attr.RemoveAllAttributes = function(element, excludedAttributes) {
1733 var excludedAttributesHashTable = {};
1734 if(excludedAttributes)
1735  excludedAttributesHashTable = Data.CreateHashTableFromArray(excludedAttributes);
1736 if(element.attributes) {
1737  var attrArray = element.attributes;
1738  for(var i = 0; i < attrArray.length; i++) {
1739   var attrName = attrArray[i].name;
1740   if(!ASPx.IsExists(excludedAttributesHashTable[attrName.toLowerCase()])) {
1741    try {
1742     attrArray.removeNamedItem(attrName);
1743    } catch (e) { }
1744   }
1745  }
1746 }
1747};
1748Attr.RemoveStyleAttribute = function(element, attrName) {
1749 if(element.style) {
1750  if(Browser.Firefox && element.style[attrName]) 
1751   element.style[attrName] = "";
1752  if(element.style.removeAttribute && element.style.removeAttribute != "")
1753   element.style.removeAttribute(attrName);
1754  else if(element.style.removeProperty && element.style.removeProperty != "")
1755   element.style.removeProperty(attrName);
1756 }
1757};
1758Attr.RemoveAllStyles = function(element) {
1759 if(element.style) {
1760  for(var key in element.style)
1761   Attr.RemoveStyleAttribute(element, key);
1762    Attr.RemoveAttribute(element, "style");
1763 }
1764};
1765Attr.GetTabIndexAttributeName = function(){
1766 return "tabindex";
1767};
1768Attr.ChangeTabIndexAttribute = function(element){
1769 var attribute = Attr.GetTabIndexAttributeName(); 
1770 if(Attr.GetAttribute(element, attribute) != -1)
1771    Attr.ChangeAttribute(element, attribute, -1);
1772};
1773Attr.SaveTabIndexAttributeAndReset = function(element) {
1774 var attribute = Attr.GetTabIndexAttributeName();
1775 Attr.SaveAttribute(element, attribute, element, "saved" + attribute);
1776 Attr.SetAttribute(element, attribute, -1);
1777};
1778Attr.RestoreTabIndexAttribute = function(element){
1779 var attribute = Attr.GetTabIndexAttributeName();
1780 if(Attr.IsExistsAttribute(element, attribute)) {
1781  if(Attr.GetAttribute(element, attribute) == -1) {
1782   if(Attr.IsExistsAttribute(element, "saved" + attribute)){
1783    var oldValue = Attr.GetAttribute(element, "saved" + attribute);
1784    if(oldValue != ASPx.EmptyObject)
1785     Attr.SetAttribute(element, attribute, oldValue);
1786    else {
1787     if(Browser.WebKitFamily) 
1788      Attr.SetAttribute(element, attribute, 0); 
1789     Attr.RemoveAttribute(element, attribute);   
1790    }
1791    Attr.RemoveAttribute(element, "saved" + attribute); 
1792   }
1793  }
1794 }
1795};
1796Attr.ChangeAttributesMethod = function(enabled){
1797 return enabled ? Attr.RestoreAttribute : Attr.ResetAttribute;
1798};
1799Attr.InitiallyChangeAttributesMethod = function(enabled){
1800 return enabled ? Attr.ChangeAttribute : Attr.ResetAttribute;
1801};
1802Attr.ChangeStyleAttributesMethod = function(enabled){
1803 return enabled ? Attr.RestoreStyleAttribute : Attr.ResetStyleAttribute;
1804};
1805Attr.InitiallyChangeStyleAttributesMethod = function(enabled){
1806 return enabled ? Attr.ChangeStyleAttribute : Attr.ResetStyleAttribute;
1807};
1808Attr.ChangeEventsMethod = function(enabled){
1809 return enabled ? Evt.AttachEventToElement : Evt.DetachEventFromElement;
1810};
1811Attr.ChangeDocumentEventsMethod = function(enabled){
1812 return enabled ? Evt.AttachEventToDocument : Evt.DetachEventFromDocument;
1813};
1814Attr.ChangeCellSpanCount = function(cell, value, isColumnSpan) {
1815 if(!cell) return;
1816 var propertyKey = isColumnSpan ? "colSpan" : "rowSpan";
1817 var prevValue = cell[propertyKey];
1818 if(value > 1)
1819  cell[propertyKey] = value;
1820 else if(prevValue !== 1)
1821  Attr.RemoveAttribute(cell, propertyKey);
1822};
1823Attr.AppendScriptType = function(script) {
1824 if(!isHtml5Mode())
1825  script.type = "text/javascript";
1826};
1827Attr.AppendStyleType = function(style) {
1828 if(!isHtml5Mode())
1829  style.type = "text/css";
1830};
1831function isHtml5Mode() {
1832 return ASPx.DoctypeMode === "Html5";
1833}
1834ASPx.Attr = Attr;
1835var Aria = {
1836 atomic: "aria-atomic",
1837 checked: "aria-checked",
1838 descendant: "aria-activedescendant",
1839 described: "aria-describedby",
1840 disabled: "aria-disabled",
1841 expanded: "aria-expanded",
1842 haspopup: "aria-haspopup",
1843 invalid: "aria-invalid",
1844 label: "aria-label",
1845 labelled: "aria-labelledby",
1846 level: "aria-level",
1847 owns: "aria-owns",
1848 posinset: "aria-posinset",
1849 role: "role",
1850 selected: "aria-selected",
1851 setsize: "aria-setsize",
1852 valuemax: "aria-valuemax",
1853 valuemin: "aria-valuemin",
1854 valuenow: "aria-valuenow"
1855};
1856Aria.SetOrRemoveDescendant = function(obj, value) {
1857 ASPx.Attr.SetOrRemoveAttribute(obj, Aria.descendant, value);
1858};
1859Aria.SetOrRemoveLabel = function(obj, value) {
1860 ASPx.Attr.SetOrRemoveAttribute(obj, Aria.label, value);
1861};
1862Aria.SetOrRemoveDisabled = function(obj, value) {
1863 ASPx.Attr.SetOrRemoveAttribute(obj, Aria.disabled, value);
1864};
1865Aria.AppendLabel = function(obj, value, checkExists) {
1866 var currentValue = ASPx.Attr.GetAttribute(obj, Aria.label) || "";
1867 var resultParts = [ ];
1868 if(currentValue)
1869  resultParts.push(currentValue);
1870 var needAppendValue = value && (!checkExists || currentValue.indexOf(value) == -1);
1871 if(needAppendValue)
1872  resultParts.push(value);
1873 ASPx.Attr.SetAttribute(obj, Aria.label, resultParts.join(" "));
1874};
1875Aria.SetOrRemoveLabelled = function(obj, value) {
1876 ASPx.Attr.SetOrRemoveAttribute(obj, Aria.labelled, value);
1877};
1878Aria.SetApplicationRole = function(obj) {
1879  ASPx.Attr.SetAttribute(obj, Aria.role, "application");
1880};
1881Aria.SetSilence = function(obj) {
1882 ASPx.Attr.SetAttribute(obj, Aria.label, ";");
1883};
1884Aria.SetExpanded = function(obj, expanded) {
1885 if(!obj || !ASPx.Attr.GetAttribute(obj, Aria.expanded)) return;
1886 Aria.SetBoolAttribute(obj, Aria.expanded, expanded);
1887};
1888Aria.SetAtomic = function(obj, value) {
1889 Aria.SetBoolAttribute(obj, Aria.atomic, value);
1890};
1891Aria.SetBoolAttribute = function(obj, attribute, value) {
1892 if(value)
1893  ASPx.Attr.SetAttribute(obj, attribute, true);
1894 else 
1895  ASPx.Attr.SetAttribute(obj, attribute, false);
1896};
1897ASPx.Attr.Aria = Aria;
1898var Color = { };
1899function _aspxToHex(d) {
1900 return (d < 16) ? ("0" + d.toString(16)) : d.toString(16);
1901}
1902Color.RGBRegexp = /rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/;
1903Color.RGBARegexp = /rgba?\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*,?\s*([0-9]*\.?[0-9]*)\s*\)/;
1904Color.ColorToHexadecimal = function(colorValue, isRGBA) {
1905 if(typeof(colorValue) == "number") {
1906  var r = colorValue & 0xFF;
1907  var g = (colorValue >> 8) & 0xFF;
1908  var b = (colorValue >> 16) & 0xFF;
1909  return "#" + _aspxToHex(r) + _aspxToHex(g) + _aspxToHex(b);
1910 }
1911 if(colorValue && (colorValue.substr(0, 3).toLowerCase() == "rgb")) {
1912  var regResult = colorValue.toLowerCase().match(isRGBA ? Color.RGBARegexp : Color.RGBRegexp);
1913  if(regResult) {
1914   var r = parseInt(regResult[1]);
1915   var g = parseInt(regResult[2]);
1916   var b = parseInt(regResult[3]);
1917   if (isRGBA)
1918    return { r: r, g: g, b: b, a: regResult[4] !== undefined ? parseFloat(regResult[4]) : 1 };
1919   return "#" + _aspxToHex(r) + _aspxToHex(g) + _aspxToHex(b);
1920  }
1921  return null;
1922 } 
1923 if(colorValue && (colorValue.charAt(0) == "#"))
1924  return colorValue;
1925 return null;
1926};
1927Color.Names = {
1928 AddColorNames: function(stringResourcesObj) {
1929  if(stringResourcesObj) {
1930   for(var key in stringResourcesObj)
1931    if(stringResourcesObj.hasOwnProperty(key))
1932     this[key] = stringResourcesObj[key];
1933  }
1934 }
1935};
1936ASPx.Color = Color;
1937var Url = { };
1938Url.Navigate = function(url, target) {
1939 var javascriptPrefix = "javascript:";
1940 if(!url || url === "")
1941  return;
1942 else if(url.indexOf(javascriptPrefix) != -1)
1943  eval(url.substr(javascriptPrefix.length));
1944 else {
1945  try {
1946   if(target != "")
1947    navigateTo(url, target);
1948   else
1949    location.href = url;
1950  }
1951  catch(e) {
1952  }
1953 }
1954};
1955Url.NavigateByLink = function(linkElement) {
1956 Url.Navigate(Attr.GetAttribute(linkElement, "href"), linkElement.target);
1957};
1958Url.GetAbsoluteUrl = function(url) {
1959 if(url)
1960  url = Url.getURLObject(url).href;
1961 return url;
1962};
1963Url.Redirect = function(url) {
1964 window.location.href = url;
1965};
1966var absolutePathPrefixes = 
1967 [ "about:", "file:///", "ftp://", "gopher://", "http://", "https://", "javascript:", "mailto:", "news:", "res://", "telnet://", "view-source:" ];
1968Url.isAbsoluteUrl = function(url) {
1969 if (url) {
1970  for (var i = 0; i < absolutePathPrefixes.length; i++) {
1971   if(url.indexOf(absolutePathPrefixes[i]) == 0)
1972    return true;
1973  }
1974 }
1975 return false;
1976};
1977Url.getURLObject = function(url) {
1978 var link = document.createElement('A');
1979 link.href = url || "";
1980 return { 
1981  href: link.href,
1982  protocol: link.protocol,
1983  host: link.host,
1984  port: link.port,
1985  pathname: link.pathname,
1986  search: link.search,
1987  hash: link.hash
1988 }; 
1989};
1990Url.getRootRelativeUrl = function(url) {
1991 return getRelativeUrl(url, !Url.isRootRelativeUrl(url), true); 
1992};
1993Url.getPathRelativeUrl = function(url) {
1994 return getRelativeUrl(url, !Url.isPathRelativeUrl(url), false);
1995};
1996function getRelativeUrl(url, isValid, isRootRelative) {
1997 if(url && !(/data:([^;]+\/?[^;]*)(;charset=[^;]*)?(;base64,)/.test(url)) && isValid) {
1998  var urlObject = Url.getURLObject(url);
1999  var baseUrlObject = Url.getURLObject();
2000  if(!Url.isAbsoluteUrl(url) || urlObject.host === baseUrlObject.host && urlObject.protocol === baseUrlObject.protocol) {
2001   url = urlObject.pathname;
2002   if(!isRootRelative)
2003    url = getPathRelativeUrl(baseUrlObject.pathname, url);
2004   url = url + urlObject.search + urlObject.hash;
2005  }
2006 }
2007 return url;   
2008}
2009function getPathRelativeUrl(baseUrl, url) {
2010 var requestSegments = getSegments(baseUrl, false);
2011 var urlSegments = getSegments(url, true);
2012 return buildPathRelativeUrl(requestSegments, urlSegments, 0, 0, "");
2013}
2014function getSegments(url, addTail) {
2015 var segments = [];
2016 var startIndex = 0;
2017 var endIndex = -1;
2018 while ((endIndex = url.indexOf("/", startIndex)) != -1) {
2019  segments.push(url.substring(startIndex, ++endIndex));
2020  startIndex = endIndex;
2021 }
2022 if(addTail && startIndex < url.length)
2023  segments.push(url.substring(startIndex, url.length)); 
2024 return segments;
2025}
2026function buildPathRelativeUrl(requestSegments, urlSegments, reqIndex, urlIndex, buffer) {
2027 if(urlIndex >= urlSegments.length)
2028  return buffer;
2029 if(reqIndex >= requestSegments.length)
2030  return buildPathRelativeUrl(requestSegments, urlSegments, reqIndex, urlIndex + 1, buffer + urlSegments[urlIndex]);
2031 if(requestSegments[reqIndex] === urlSegments[urlIndex] && urlIndex === reqIndex)
2032  return buildPathRelativeUrl(requestSegments, urlSegments, reqIndex + 1, urlIndex + 1, buffer);
2033 return buildPathRelativeUrl(requestSegments, urlSegments, reqIndex + 1, urlIndex, buffer + "../");
2034}
2035Url.isPathRelativeUrl = function(url) {
2036 return !!url && !Url.isAbsoluteUrl(url) && url.indexOf("/") != 0;  
2037};
2038Url.isRootRelativeUrl = function(url) {
2039 return !!url && !Url.isAbsoluteUrl(url) && url.indexOf("/") == 0 && url.indexOf("//") != 0;
2040};
2041function navigateTo(url, target) {
2042 var lowerCaseTarget = target.toLowerCase();
2043 if("_top" == lowerCaseTarget)
2044  top.location.href = url;
2045 else if("_self" == lowerCaseTarget)
2046  location.href = url;
2047 else if("_search" == lowerCaseTarget)
2048  openInNewWindow(url);
2049 else if("_media" == lowerCaseTarget)
2050  openInNewWindow(url);
2051 else if("_parent" == lowerCaseTarget)
2052  window.parent.location.href = url;
2053 else if("_blank" == lowerCaseTarget)
2054  openInNewWindow(url);
2055 else {
2056  var frame = getFrame(top.frames, target);
2057  if(frame != null)
2058   frame.location.href = url;
2059  else
2060   openInNewWindow(url);
2061 }
2062}
2063function openInNewWindow(url) {
2064 if(ASPx.Browser.Safari)
2065  openInNewWindowViaIframe(url);
2066 else {
2067  var newWindow = window.open();
2068  newWindow.opener = null;
2069  newWindow.location = url;
2070 }
2071}
2072function openInNewWindowViaIframe(url) {
2073 var iframe = document.createElement('iframe');
2074 iframe.style.display = 'none';
2075 document.body.appendChild(iframe);
2076 var iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
2077 var openArgs = '"' + url + '"';
2078 var script = iframeDoc.createElement('script');
2079 script.type = 'text/javascript';
2080 script.text = 'window.parent = null; ' +
2081  'window.top = null;' +
2082  'window.frameElement = null;' +
2083  'var child = window.open(' + openArgs + ');' +
2084  'child.opener = null';
2085 iframeDoc.body.appendChild(script);
2086 document.body.removeChild(iframe);
2087}
2088ASPx.Url = Url;
2089var Json = { };
2090function isValid(JsonString) {
2091 return !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(JsonString.replace(/"(\\.|[^"\\])*"/g, '')));
2092}
2093Json.Eval = function(jsonString, controlName) {
2094 if(isValid(jsonString)) {
2095  return eval("(" + jsonString + ")");
2096 } else {
2097  throw new Error(controlName + " received incorrect JSON-data: " + jsonString);
2098 }
2099};
2100Json.ToJson = function(param, skipEncodeHtml){
2101 var paramType = typeof(param);
2102 if((paramType == "undefined") || (param == null))
2103  return null;
2104 if((paramType == "object") && (typeof(param.__toJson) == "function"))
2105  return param.__toJson();
2106 if((paramType == "number") || (paramType == "boolean"))
2107  return param;
2108 if(param.constructor == Date)
2109  return dateToJson(param);
2110 if(paramType == "string") {
2111  var result = param.replace(/\\/g, "\\\\");
2112  result = result.replace(/"/g, "\\\"");
2113  result = result.replace(/\n/g, "\\n");
2114  result = result.replace(/\r/g, "\\r");
2115  if(!skipEncodeHtml) {
2116   result = result.replace(/</g, "\\u003c");
2117   result = result.replace(/>/g, "\\u003e");
2118  }
2119  return "\"" + result + "\"";
2120 }
2121 if(param.constructor == Array){
2122  var values = [];
2123  for(var i = 0; i < param.length; i++) {
2124   var jsonValue = Json.ToJson(param[i], skipEncodeHtml);
2125   if(jsonValue === null)
2126    jsonValue = "null";
2127   values.push(jsonValue);
2128  }
2129  return "[" + values.join(",") + "]";
2130 }
2131 var exceptKeys = {};
2132 if(ASPx.Ident.IsArray(param.__toJsonExceptKeys))
2133  exceptKeys = Data.CreateHashTableFromArray(param.__toJsonExceptKeys);
2134 exceptKeys["__toJsonExceptKeys"] = 1;
2135 var values = [];
2136 for(var key in param) {
2137  if(param.hasOwnProperty(key)) {
2138   if(ASPx.IsFunction(param[key]))
2139    continue;
2140   if(exceptKeys[key] == 1)
2141    continue;
2142   values.push(Json.ToJson(key) + ":" + Json.ToJson(param[key], skipEncodeHtml));
2143  }
2144 }
2145 return "{" + values.join(",") + "}";
2146};
2147function dateToJson(date) {
2148 var result = [ 
2149  date.getFullYear(),
2150  date.getMonth(),
2151  date.getDate()
2152 ];
2153 var time = {
2154  h: date.getHours(),
2155  m: date.getMinutes(),
2156  s: date.getSeconds(),
2157  ms: date.getMilliseconds()
2158 };
2159 if(time.h || time.m || time.s || time.ms)
2160  result.push(time.h);
2161 if(time.m || time.s || time.ms)
2162  result.push(time.m);
2163 if(time.s || time.ms)
2164  result.push(time.s);
2165 if(time.ms)
2166  result.push(time.ms);
2167 return "new Date(" + result.join() + ")";
2168}
2169ASPx.Json = Json;
2170ASPx.CreateClass = function(parentClass, properties) {
2171 if(arguments.length == 1) {
2172  properties = parentClass;
2173  parentClass = null;
2174 }
2175 var ret = function() {
2176  if(ret.preparing) 
2177   return delete(ret.preparing);
2178  if(ret.constr) {
2179   this.constructor = ret;
2180   ret.constr.apply(this, arguments);
2181  }
2182 };
2183 ret.prototype = {};
2184 if(parentClass) {
2185  parentClass.preparing = true;
2186  for(var name in parentClass) {
2187   if(parentClass.hasOwnProperty(name) && name != 'constr' && ASPx.IsFunction(parentClass[name]) && !ret[name])
2188    ret[name] = parentClass[name].aspxBind(parentClass);
2189  }
2190  ret.prototype = new parentClass;
2191  ret.prototype.constructor = parentClass;
2192  ret.constr = parentClass;
2193 }
2194 if(properties) {
2195  var constructorName = "constructor";
2196  for(var name in properties) {
2197   if(!properties.hasOwnProperty(name)) 
2198    continue;
2199   var getter = Object.getOwnPropertyDescriptor(properties, name).get;
2200   var setter = Object.getOwnPropertyDescriptor(properties, name).set;
2201   if(getter || setter)
2202    Object.defineProperty(ret.prototype, name, {
2203     set: setter,
2204     get: getter,
2205     enumerable: true,
2206     configurable: true
2207    });
2208   if(name != constructorName && !getter && !setter)
2209    ret.prototype[name] = properties[name];
2210  }
2211  if(properties[constructorName] && properties[constructorName] != Object)
2212   ret.constr = properties[constructorName];
2213 }
2214 return ret;
2215};
2216var registeredMixins = {};
2217ASPx.GetMixin = function (name, baseClass) {
2218 var mixinCache = baseClass._mixins || (baseClass._mixins = {});
2219 var resultClass = mixinCache[name];
2220 if (!resultClass) {
2221  var mixinCodeBuilder = registeredMixins[name];
2222  if (!mixinCodeBuilder)
2223   throw new Error("mixin with the '" + name + "' is not registered");
2224  var mixinCode = mixinCodeBuilder(baseClass);
2225  mixinCode.mixinName = name;
2226  resultClass = ASPx.CreateClass(baseClass, mixinCode);
2227  mixinCache[name] = resultClass;
2228 }
2229 return resultClass;
2230};
2231ASPx.RegisterMixin = function() {
2232 var name = arguments.length == 1 ? "mixin_" + ASPx.CreateGuid() : arguments[0];
2233 var mixinCodeBuilder = arguments[arguments.length - 1];
2234 if (registeredMixins[name])
2235  throw new Error("mixin with the '" + name + "' name is already defined");
2236 registeredMixins[name] = mixinCodeBuilder;
2237 return function(baseClass) { return ASPx.GetMixin(name, baseClass); };
2238};
2239ASPx.FormatCallbackArg = function(prefix, arg) {
2240 if(prefix == null && arg == null)
2241  return ""; 
2242 if(prefix == null) prefix = "";
2243 if(arg == null) arg = "";
2244 if(arg != null && !ASPx.IsExists(arg.length) && ASPx.IsExists(arg.value))
2245  arg = arg.value;
2246 arg = arg.toString();
2247 return [prefix, '|', arg.length, '|' , arg].join('');
2248};
2249ASPx.FormatCallbackArgs = function(callbackData) {
2250 var sb = [ ];
2251 for(var i = 0; i < callbackData.length; i++)
2252  sb.push(ASPx.FormatCallbackArg(callbackData[i][0], callbackData[i][1]));
2253 return sb.join("");
2254};
2255ASPx.ParseShortcutString = function(shortcutString) {
2256 if(!shortcutString)
2257  return 0;
2258 var isCtrlKey = false;
2259 var isShiftKey = false;
2260 var isAltKey = false;
2261 var isMetaKey = false;
2262 var keyCode = null;
2263 var shcKeys = shortcutString.toString().split("+");
2264 if(shcKeys.length > 0) {
2265  for(var i = 0; i < shcKeys.length; i++) {
2266   var key = Str.Trim(shcKeys[i].toUpperCase());
2267   switch (key) {
2268    case "CONTROL":
2269    case "CONTROLKEY":
2270    case "CTRL":
2271     isCtrlKey = true;
2272     break;
2273    case "SHIFT":
2274    case "SHIFTKEY":
2275     isShiftKey = true;
2276     break;
2277    case "ALT":
2278     isAltKey = true;
2279     break;
2280    case "CMD":
2281     isMetaKey = true;
2282     break;
2283    case "F1": keyCode = ASPx.Key.F1; break;
2284    case "F2": keyCode = ASPx.Key.F2; break;
2285    case "F3": keyCode = ASPx.Key.F3; break;
2286    case "F4": keyCode = ASPx.Key.F4; break;
2287    case "F5": keyCode = ASPx.Key.F5; break;
2288    case "F6": keyCode = ASPx.Key.F6; break;
2289    case "F7": keyCode = ASPx.Key.F7; break;
2290    case "F8": keyCode = ASPx.Key.F8; break;
2291    case "F9": keyCode = ASPx.Key.F9; break;
2292    case "F10":   keyCode = ASPx.Key.F10; break;
2293    case "F11":   keyCode = ASPx.Key.F11; break;
2294    case "F12":   keyCode = ASPx.Key.F12; break;
2295    case "RETURN":
2296    case "ENTER": keyCode = ASPx.Key.Enter; break;
2297    case "HOME":  keyCode = ASPx.Key.Home; break;
2298    case "END":   keyCode = ASPx.Key.End; break;
2299    case "LEFT":  keyCode = ASPx.Key.Left; break;
2300    case "RIGHT": keyCode = ASPx.Key.Right; break;
2301    case "UP": keyCode = ASPx.Key.Up; break;
2302    case "DOWN":  keyCode = ASPx.Key.Down; break;
2303    case "PAGEUP": keyCode = ASPx.Key.PageUp; break;
2304    case "PAGEDOWN": keyCode = ASPx.Key.PageDown; break;
2305    case "SPACE": keyCode = ASPx.Key.Space; break;
2306    case "TAB":   keyCode = ASPx.Key.Tab; break;
2307    case "BACKSPACE": 
2308    case "BACK": keyCode = ASPx.Key.Backspace; break;
2309    case "CONTEXT": keyCode = ASPx.Key.ContextMenu; break;
2310    case "ESCAPE":
2311    case "ESC":
2312     keyCode = ASPx.Key.Esc;
2313     break;
2314    case "DELETE":
2315    case "DEL":
2316     keyCode = ASPx.Key.Delete;
2317     break;
2318    case "INSERT":
2319    case "INS":
2320     keyCode = ASPx.Key.Insert;
2321     break;
2322    case "PLUS":
2323     keyCode = "+".charCodeAt(0);
2324     break;
2325    default:
2326     keyCode = key.charCodeAt(0);
2327     break;
2328   }
2329  }
2330 } else
2331  ASPx.ShowErrorAlert("Invalid shortcut");
2332 return ASPx.GetShortcutCode(keyCode, isCtrlKey, isShiftKey, isAltKey, isMetaKey);
2333};
2334ASPx.GetShortcutCode = function(keyCode, isCtrlKey, isShiftKey, isAltKey, isMetaKey) {
2335 var value = keyCode;
2336 value |= isCtrlKey ? ASPx.ModifierKey.Ctrl : 0;
2337 value |= isShiftKey ? ASPx.ModifierKey.Shift : 0;
2338 value |= isAltKey ? ASPx.ModifierKey.Alt : 0;
2339 value |= isMetaKey ? ASPx.ModifierKey.Meta : 0;
2340 return value;
2341};
2342ASPx.GetShortcutCodeByEvent = function(evt) {
2343 return ASPx.GetShortcutCode(Evt.GetKeyCode(evt), evt.ctrlKey, evt.shiftKey, evt.altKey, ASPx.Browser.MacOSPlatform ? evt.metaKey : false);
2344};
2345ASPx.IsPasteShortcut = function(evt) {
2346 if(evt.type === "paste")
2347  return true;
2348 var keyCode = Evt.GetKeyCode(evt);
2349 if(Browser.NetscapeFamily && evt.which == 0)  
2350  keyCode = evt.keyCode;
2351 return (evt.ctrlKey && (keyCode == 118  || (keyCode == 86))) ||
2352     (evt.shiftKey && !evt.ctrlKey && !evt.altKey &&
2353     (keyCode == ASPx.Key.Insert)) ;
2354};
2355var NotPrintableKeyCodes = null;
2356ASPx.IsPrintableKey = function(keyCode) {
2357 if (!NotPrintableKeyCodes)
2358  NotPrintableKeyCodes = Object.keys(ASPx.Key).map(function(key) { return ASPx.Key[key]; });
2359 return !ASPx.Data.ArrayContains(NotPrintableKeyCodes, keyCode);
2360};
2361ASPx.SetFocus = function(element, selectAction) {
2362 function focusCore(element, selectAction){
2363  try {
2364    element.focus();
2365    if(selectAction) {
2366     var currentSelection = Selection.GetInfo(element);
2367     if(currentSelection.startPos == currentSelection.endPos) {
2368      switch(selectAction) {
2369       case "start":
2370        Selection.SetCaretPosition(element, 0);
2371        break;
2372       case "all":
2373        Selection.Set(element);
2374        break;
2375      }
2376     }
2377    }
2378   } catch (e) {
2379  }
2380 }
2381 if(ASPxClientUtils.iOSPlatform || ASPxClientUtils.androidPlatform) 
2382  focusCore(element, selectAction);
2383 else {
2384  window.setTimeout(function() { 
2385   focusCore(element, selectAction);
2386  }, ASPx.FOCUS_TIMEOUT);
2387 }
2388};
2389ASPx.IsFocusableCore = function(element, skipContainerVisibilityCheck) {
2390 var current = element;
2391 while(current && current.nodeType == 1) {
2392  if(current == element || !skipContainerVisibilityCheck(current)) {
2393   var tagName = current.tagName.toUpperCase();
2394   if(tagName == "BODY")
2395    return true;
2396   var disabledElementTags = ["INPUT", "BUTTON", "TEXTAREA", "SELECT", "OPTION"];
2397   if(disabledElementTags.indexOf(tagName) !== -1 && current.disabled || !ASPx.GetElementDisplay(current) || !ASPx.GetElementVisibility(current))
2398    return false;
2399  }
2400  current = current.parentNode;
2401 }
2402 return true;
2403};
2404ASPx.IsFocusable = function(element) {
2405 return ASPx.IsFocusableCore(element, ASPx.FalseFunction);
2406};
2407ASPx.RemoveFocus = function(parent) {
2408 var div = document.createElement('div');
2409 div.tabIndex = "-1";
2410 concealDivElement(div);
2411 parent.appendChild(div);
2412 if(ASPx.IsFocusable(div))
2413  div.focus();
2414 ASPx.RemoveElement(div);
2415};
2416function concealDivElement(div){
2417 div.style.position = "absolute";
2418 div.style.left = 0;
2419 div.style.top = 0;
2420 if(ASPx.Browser.WebKitFamily) {
2421  div.style.opacity = 0;
2422  div.style.width = 1;
2423  div.style.height = 1;
2424 } else {
2425  div.style.border = 0;
2426  div.style.width = 0;
2427  div.style.height = 0;
2428 }
2429}
2430var ActionElementsCache = ASPx.CreateClass(null, {
2431 constructor: function() {
2432  this.usageCounter = 0;
2433  this.elements = [ ];
2434  this.values = [ ];
2435 },
2436 IsActive: function() { return this.usageCounter > 0; },
2437 BeginUsage: function() {
2438  this.usageCounter++;
2439 },
2440 EndUsage: function() {
2441  this.usageCounter--;
2442  if(this.usageCounter === 0)
2443   this.Clear();
2444 },
2445 Add: function(element, value) {
2446  var index = this.elements.length;
2447  this.elements[index] = element;
2448  this.values[index] = value;
2449 },
2450 Get: function(element) { 
2451  var index = this.elements.indexOf(element);
2452  var hasValue = index > -1;
2453  var value = hasValue ? this.values[index] : undefined;
2454  return { hasValue: hasValue, value: value };
2455 },
2456 Clear: function() { 
2457  this.elements = [ ];
2458  this.values = [ ];
2459 }
2460});
2461ASPx.ActionElementsCache = new ActionElementsCache();
2462ASPx.IsActionElement = function(element) {
2463 if(!ASPx.IsExistsElement(element))
2464  return false;
2465 var useCache = ASPx.ActionElementsCache.IsActive();
2466 if(useCache) {
2467  var cacheValue = ASPx.ActionElementsCache.Get(element);
2468  if(cacheValue.hasValue)
2469   return cacheValue.value;
2470 }
2471 var isActionElement = ASPx.IsActionElementCore(element);
2472 if(useCache)
2473  ASPx.ActionElementsCache.Add(element, isActionElement);
2474 return isActionElement;
2475};
2476ASPx.IsActionElementCore = function(element) {
2477 var tabIndex = parseInt(ASPx.Attr.GetAttribute(element, ASPx.Attr.GetTabIndexAttributeName()));
2478 var hasTabIndex = !isNaN(tabIndex);
2479 var hasNonNegativeTabIndex = hasTabIndex && tabIndex > -1;
2480 var hasNegativeTabIndex = hasTabIndex && tabIndex < 0;
2481 var tagName = element.tagName;
2482 var focusableElementTags = ["BUTTON", "SELECT", "TEXTAREA", "OPTION", "IFRAME"];
2483 var isFocusableCore = ASPx.IsFocusable(element);
2484 var isFocusableTag = focusableElementTags.indexOf(tagName) !== -1;
2485 var isFocusableLink = tagName === "A" && (!!element.href || hasNonNegativeTabIndex);
2486 var isFocusableInput = tagName === "INPUT" && element.type.toLowerCase() !== "hidden";
2487 var isFocusableByTabIndex = tagName !== "INPUT" && hasNonNegativeTabIndex;
2488 var isEditableDiv = tagName == "DIV" && element.contentEditable === "true";
2489 return isFocusableCore && !hasNegativeTabIndex && (isFocusableTag || isFocusableLink || isFocusableInput || isFocusableByTabIndex || isEditableDiv);
2490};
2491ASPx.GetCanBeActiveElementsInContainer = function(container) {
2492 var canBeActiveTags = ["INPUT", "A", "UL", "BUTTON", "TEXTAREA", "SELECT", "IFRAME"],
2493  canBeActiveElements = [];
2494 Data.ForEach(canBeActiveTags, function(tag) {
2495  var elements = container.getElementsByTagName(tag);
2496  canBeActiveElements = canBeActiveElements.concat([].slice.call(elements));
2497 });
2498 return canBeActiveElements;
2499};
2500function isActionElementAllowedByPredicate(element, predicate) {
2501  var allowedByPredicate = !predicate || predicate(element);
2502  return allowedByPredicate && ASPx.IsActionElement(element);
2503}
2504ASPx.FindChildActionElements = function(container, predicate) {
2505 return ASPx.GetNodes(container, function(el) {
2506  return isActionElementAllowedByPredicate(el, predicate);
2507 });
2508};
2509ASPx.FindAllSortedActionElements = function(container, predicate) {
2510 var result = [ ];
2511 if(!container || !container.getElementsByTagName) return result;
2512 var actionElements = ASPx.FindChildActionElements(container, predicate);
2513 var getTabOrderValue = function(el) {
2514  var tabIndex = parseInt(ASPx.Attr.GetAttribute(el, ASPx.Attr.GetTabIndexAttributeName()));
2515  return isNaN(tabIndex) ? 0 : tabIndex;
2516 };
2517 var positiveTabIndexElements = actionElements.filter(function(x) { return getTabOrderValue(x) > 0; });
2518 var nonPositiveTabIndexElements = actionElements.filter(function(x) { return getTabOrderValue(x) === 0; });
2519 var sortedTabIndexElements = positiveTabIndexElements.sort(function(x, y) { return getTabOrderValue(x) - getTabOrderValue(y); });
2520 result = sortedTabIndexElements.concat(nonPositiveTabIndexElements);
2521 return result;
2522};
2523ASPx.FindFirstChildActionElement = function(container, predicate) {
2524 if(!container || isActionElementAllowedByPredicate(container, predicate))
2525  return !container ? null : container;
2526 var sortedActionElements = ASPx.FindAllSortedActionElements(container, predicate);
2527 return sortedActionElements[0];
2528};
2529ASPx.FindLastChildActionElement = function(container, predicate) {
2530 if(!container)
2531  return null;
2532 var sortedActionElements = ASPx.FindAllSortedActionElements(container, predicate);
2533 var actionElement = sortedActionElements[sortedActionElements.length - 1];
2534 if(!actionElement && isActionElementAllowedByPredicate(container, predicate))
2535  actionElement = container;
2536 return actionElement;
2537};
2538ASPx.GetParentClientControls = function(name) {
2539 var nameParts = name.split("_");
2540 var result = [ ];
2541 var controlCollection = ASPx.GetControlCollection();
2542 for(var i = 1; i <= nameParts.length; i++) {
2543  var controlName = nameParts.slice(0, i).join("_");
2544  var control = controlCollection.Get(controlName);
2545  if(control)
2546   result.push(control);
2547 }
2548 return result;
2549};
2550ASPx.GetRootClientControl = function(childControlName) {
2551 var parentControls = ASPx.GetParentClientControls(childControlName);
2552 return parentControls[0];
2553};
2554ASPx.GetClientControlByElementID = function(elementID) {
2555 var parentControls = ASPx.GetParentClientControls(elementID);
2556 return parentControls[parentControls.length - 1];
2557};
2558ASPx.IsExists = function(obj){
2559 return (typeof(obj) != "undefined") && (obj != null);
2560};
2561ASPx.IsFunction = function(obj){
2562 return typeof(obj) == "function";
2563};
2564ASPx.IsNumber = function(str) {
2565 return !isNaN(parseFloat(str)) && isFinite(str);
2566};
2567ASPx.GetDefinedValue = function(value, defaultValue){
2568 return (typeof(value) != "undefined") ? value : defaultValue;
2569};
2570ASPx.CorrectJSFloatNumber = function(number) {
2571 var ret = 21; 
2572 var numString = number.toPrecision(21);
2573 numString = numString.replace("-", ""); 
2574 var integerDigitsCount = numString.indexOf(ASPx.PossibleNumberDecimalSeparators[0]);
2575 if(integerDigitsCount < 0)
2576  integerDigitsCount = numString.indexOf(ASPx.PossibleNumberDecimalSeparators[1]);
2577 var floatDigitsCount = numString.length - integerDigitsCount - 1;
2578 if(floatDigitsCount < 10)
2579  return number;
2580 if(integerDigitsCount > 0) {
2581  ret = integerDigitsCount + 12;
2582 }
2583 var toPrecisionNumber = Math.min(ret, 21);
2584 var newValueString = number.toPrecision(toPrecisionNumber);
2585 return parseFloat(newValueString, 10);
2586};
2587ASPx.CorrectRounding = function(number, step) { 
2588 var regex = /[,|.](.*)/,
2589  isFloatValue = regex.test(number),
2590  isFloatStep = regex.test(step);
2591 if(isFloatValue || isFloatStep) {
2592  var valueAccuracy = (isFloatValue) ? regex.exec(number)[0].length - 1 : 0,
2593   stepAccuracy = (isFloatStep) ? regex.exec(step)[0].length - 1 : 0,
2594   accuracy = Math.max(valueAccuracy, stepAccuracy);
2595  var multiplier = Math.pow(10, accuracy);
2596  number = Math.round((number + step) * multiplier) / multiplier;
2597  return number;
2598 }
2599 return number + step;
2600};
2601ASPx.GetActiveElement = function() {
2602 try{ return document.activeElement; } catch(e) { return null; }
2603};
2604var verticalScrollBarWidth;
2605ASPx.GetVerticalScrollBarWidth = function(nonZero) {
2606 if(typeof(verticalScrollBarWidth) === "undefined") {
2607  var container = document.createElement("DIV");
2608  container.style.cssText = "position: absolute; top: 0px; left: 0px; visibility: hidden; width: 200px; height: 150px; overflow: hidden; box-sizing: content-box";
2609  document.body.appendChild(container);
2610  var child = document.createElement("P");
2611  container.appendChild(child);
2612  child.style.cssText = "width: 100%; height: 200px;";
2613  var widthWithoutScrollBar = child.offsetWidth;
2614  container.style.overflow = "scroll";
2615  var widthWithScrollBar = child.offsetWidth;
2616  if(widthWithoutScrollBar == widthWithScrollBar)
2617   widthWithScrollBar = container.clientWidth;
2618  verticalScrollBarWidth = widthWithoutScrollBar - widthWithScrollBar;
2619  document.body.removeChild(container);
2620 }
2621 if(nonZero && verticalScrollBarWidth === 0) {
2622  if(ASPx.Browser.MacOSPlatform || ASPx.Browser.Firefox)
2623   return 12;
2624 }
2625 return verticalScrollBarWidth;
2626};
2627function hideScrollBarCore(element, scrollName) {
2628 if(element.tagName == "IFRAME") {
2629  if((element.scrolling == "yes") || (element.scrolling == "auto")) {
2630   Attr.ChangeAttribute(element, "scrolling", "no");
2631   return true;
2632  }
2633 }
2634 else if(element.tagName == "DIV") {
2635  if((element.style[scrollName] == "scroll") || (element.style[scrollName] == "auto")) {
2636   Attr.ChangeStyleAttribute(element, scrollName, "hidden");
2637   return true;
2638  }
2639 }
2640 return false;
2641}
2642function restoreScrollBarCore(element, scrollName) {
2643 if(element.tagName == "IFRAME")
2644  return Attr.RestoreAttribute(element, "scrolling");
2645 else if(element.tagName == "DIV")
2646  return Attr.RestoreStyleAttribute(element, scrollName);
2647 return false;
2648}
2649ASPx.SetScrollBarVisibilityCore = function(element, scrollName, isVisible) {
2650 return isVisible ? restoreScrollBarCore(element, scrollName) : hideScrollBarCore(element, scrollName);
2651};
2652ASPx.SetScrollBarVisibility = function(element, isVisible) {
2653 if(ASPx.SetScrollBarVisibilityCore(element, "overflow", isVisible)) 
2654  return true;
2655 var result = ASPx.SetScrollBarVisibilityCore(element, "overflowX", isVisible)
2656  || ASPx.SetScrollBarVisibilityCore(element, "overflowY", isVisible);
2657 return result;
2658};
2659ASPx.SetInnerHtml = function(element, html) {
2660 setInnerHtmlInternal(element, html);
2661};
2662ASPx.GetInnerText = function(container) {
2663 if(Browser.Safari && Browser.MajorVersion <= 5) {
2664  var filter = getHtml2PlainTextFilter();
2665  setInnerHtmlInternal(filter, container.innerHTML);
2666  ASPx.SetElementDisplay(filter, true);
2667  var innerText = filter.innerText;
2668  ASPx.SetElementDisplay(filter, false);
2669  return innerText;
2670 } else if(Browser.NetscapeFamily || Browser.WebKitFamily || (Browser.IE && Browser.Version >= 9) || Browser.Edge) {
2671  return container.textContent;
2672 } else
2673  return container.innerText;
2674};
2675ASPx.GetEllipsisTooltipText = function(element) {
2676 var innerText = ASPx.GetInnerText(element);
2677 innerText = ASPx.RemoveComment(innerText);
2678 return innerText;
2679};
2680ASPx.RemoveComment = function(text) {
2681 var result = text;
2682 var commentStart = "<!--";
2683 var commentEnd = "//-->";
2684 var positionStart = result.indexOf(commentStart);
2685 while(positionStart > -1) {
2686  var positionEnd = result.indexOf(commentEnd);
2687  var startStr = result.substring(0, positionStart);
2688  var endStr = result.substring(positionEnd + commentEnd.length);
2689  result = startStr + endStr;
2690  positionStart = result.indexOf(commentStart);
2691 }
2692 return result;
2693};
2694var html2PlainTextFilter = null;
2695function getHtml2PlainTextFilter() {
2696 if(html2PlainTextFilter == null) {
2697  html2PlainTextFilter = document.createElement("DIV");
2698  html2PlainTextFilter.style.width = "0";
2699  html2PlainTextFilter.style.height = "0";
2700  html2PlainTextFilter.style.overflow = "visible";
2701  ASPx.SetElementDisplay(html2PlainTextFilter, false);
2702  document.body.appendChild(html2PlainTextFilter);
2703 }
2704 return html2PlainTextFilter;
2705}
2706ASPx.CreateHiddenField = function(name, id, parent) {
2707 var input = document.createElement("INPUT");
2708 input.setAttribute("type", "hidden");
2709 if(name)
2710  input.setAttribute("name", name);
2711 if(id)
2712  input.setAttribute("id", id);
2713 if(parent)
2714  parent.appendChild(input);
2715 return input;
2716};
2717ASPx.CloneObject = function(srcObject) {
2718 if(typeof(srcObject) != 'object' || srcObject == null)
2719  return srcObject;
2720 var newObject = {};
2721 for(var i in srcObject)
2722  newObject[i] = srcObject[i];
2723 return newObject;
2724};
2725ASPx.InsertRowsBefore = function(table, rowsHtml, index) {
2726 var row = null;
2727 if(index >= 0 && index < table.rows.length)
2728  row = table.rows[index];
2729 insertRowsBefore(table, rowsHtml, row);
2730};
2731var insertRowsBefore = function(table, rowsHtml, row) {
2732 if(!row && table.tBodies.length > 0) {
2733  row = document.createElement("TR");
2734  table.tBodies[0].appendChild(row);
2735  row.shouldRemove = true;
2736 }
2737 if(row) {
2738  row.insertAdjacentHTML("beforeBegin", rowsHtml);
2739  if(row.shouldRemove)
2740   ASPx.RemoveElement(row);
2741 }
2742};
2743ASPx.IsPercentageSize = function(size) {
2744 return size && size.indexOf('%') != -1;
2745};
2746ASPx.GetElementById = function(id) {
2747 if(document.getElementById)
2748  return document.getElementById(id);
2749 else
2750  return document.all[id];
2751};
2752ASPx.GetElementByIdInDocument = function(documentObj, id) {
2753 if(documentObj.getElementById)
2754  return documentObj.getElementById(id);
2755 else
2756  return documentObj.all[id];
2757};
2758ASPx.GetIsParent = function(parentElement, element) {
2759 if(!parentElement || !element)
2760  return false;
2761 while(element){
2762  if(element === parentElement)
2763   return true;
2764  if(element.tagName === "BODY")
2765   return false;
2766  element = element.parentNode;
2767 }
2768 return false;
2769};
2770ASPx.GetParentById = function(element, id) {
2771 element = element.parentNode;
2772 while(element){
2773  if(element.id === id)
2774   return element;
2775  element = element.parentNode;
2776 }
2777 return null;
2778};
2779ASPx.GetParentByPartialId = function(element, idPart){
2780 while(element && element.tagName != "BODY") {
2781  if(element.id && element.id.match(idPart)) 
2782   return element;
2783  element = element.parentNode;
2784 }
2785 return null;
2786};
2787ASPx.GetParentByTagName = function(element, tagName) {
2788 tagName = tagName.toUpperCase();
2789 while(element) {
2790  if(element.tagName === "BODY")
2791   return null;
2792  if(element.tagName === tagName)
2793   return element;
2794  element = element.parentNode;
2795 }
2796 return null;
2797};
2798function getParentByCondition(element, conditionArg, condition) {
2799 while(element != null) {
2800  if(element.tagName == "BODY" || element.nodeName == "#document")
2801   return null;
2802  if (condition(element, conditionArg))
2803   return element;
2804  element = element.parentNode;
2805 }
2806 return null;
2807}
2808ASPx.GetParentByPartialClassName = function(element, className) {
2809 return getParentByCondition(element, className, ASPx.ElementContainsCssClass);
2810};
2811ASPx.GetParentByClassName = function(element, className) {
2812 return getParentByCondition(element, className, ASPx.ElementHasCssClass);
2813};
2814ASPx.GetParentBySelector = function (element, selector) {
2815 return getParentByCondition(element, selector, ASPx.ElementMatchesSelector);
2816};
2817ASPx.GetParentByTagNameAndAttributeValue = function(element, tagName, attrName, attrValue) {
2818 tagName = tagName.toUpperCase();
2819 while(element != null) {
2820  if(element.tagName == "BODY")
2821   return null;
2822  if(element.tagName == tagName && element[attrName] == attrValue)
2823   return element;
2824  element = element.parentNode;
2825 }
2826 return null;
2827};
2828ASPx.GetParent = function(element, testFunc){
2829 if (!ASPx.IsExists(testFunc)) return null;
2830 while(element != null && element.tagName != "BODY"){
2831  if(testFunc(element))
2832   return element;
2833  element = element.parentNode;
2834 }
2835 return null;
2836};
2837ASPx.GetElementTreeLine = function(element, stopTagName, stopFunc) {
2838 var result = [];
2839 stopTagName = stopTagName || "BODY";
2840 while(element != null) {
2841  if(!stopFunc && element.tagName == stopTagName)
2842   break;
2843  if(stopFunc && stopFunc(element))
2844   break;
2845  result.push(element);
2846  element = element.parentNode;
2847 }
2848 return result;
2849};
2850ASPx.IsScrollableElement = function(element, isHorzScrollable, isVertScrollable) {
2851 isHorzScrollable = ASPx.IsExists(isHorzScrollable) ? isHorzScrollable : true;
2852 isVertScrollable = ASPx.IsExists(isVertScrollable) ? isVertScrollable : true;
2853 var style = ASPx.GetCurrentStyle(element);
2854 var overflowStyleNames = ["overflow"];
2855 if(isHorzScrollable)
2856  overflowStyleNames.push("overflowX");
2857 if(isVertScrollable)
2858  overflowStyleNames.push("overflowY");
2859 for(var i = 0; i < overflowStyleNames.length; i++)
2860  if(style[overflowStyleNames[i]] == "scroll" || style[overflowStyleNames[i]] == "auto")
2861   return true;
2862 return false;
2863};
2864ASPx.GetPreviousSibling = function(el) {
2865 if(el.previousElementSibling) {
2866  return el.previousElementSibling;
2867 } else {
2868  while(el = el.previousSibling) {
2869   if(el.nodeType === 1)
2870    return el;
2871  }
2872 }
2873};
2874ASPx.ElementMatchesSelector = (function (e) {
2875 return (function (matches) {
2876  return function (el, selector) { return !!el && !!selector && matches.call(el, selector); };
2877 })(e.matches || e.matchesSelector || e.webkitMatchesSelector || e.mozMatchesSelector || e.msMatchesSelector || e.oMatchesSelector);
2878})(Element.prototype);
2879ASPx.ElementHasCssClass = function(element, className) {
2880 try {
2881  var elementClasses;
2882  var classList = ASPx.GetClassNameList(element);
2883  if(!classList) {
2884   var elementClassName = ASPx.GetClassName(element);
2885   if(!elementClassName) {
2886    return false;
2887   }
2888   elementClasses = elementClassName.split(" ");
2889  }
2890  var classNames = className.split(" ");
2891  for(var i = classNames.length - 1; i >= 0; i--) {
2892   if(classList) {
2893    if(classList.indexOf(classNames[i]) === -1)
2894     return false;
2895    continue;
2896   }
2897   if(Data.ArrayIndexOf(elementClasses, classNames[i]) < 0)
2898    return false;
2899  }
2900  return true;
2901 } catch(e) {
2902  return false;
2903 }
2904};
2905ASPx.ElementContainsCssClass = function(element, className) {
2906 try {
2907  var elementClassName = ASPx.GetClassName(element);
2908  if(!elementClassName) {
2909   return false;
2910  }
2911  return elementClassName.indexOf(className) != -1;
2912 } catch(e) {
2913  return false;
2914 }
2915};
2916ASPx.AddClassNameToElement = function (element, className) {
2917 if(!element || typeof(className) !== "string" ) return;
2918 className = className.trim();
2919 if(!ASPx.ElementHasCssClass(element, className) && className !== "") {
2920  var oldClassName = ASPx.GetClassName(element);
2921  ASPx.SetClassName(element, (oldClassName === "") ? className : oldClassName + " " + className);
2922 }
2923};
2924ASPx.AddClassNamesToElement = function(element, classNames) {
2925 Data.ForEach(classNames, function(className) { ASPx.AddClassNameToElement(element, className); });
2926};
2927ASPx.CombineCssClasses = function() {
2928 return Array.prototype.slice.call(arguments).join(" ");
2929};
2930ASPx.RemoveClassNameFromElement = function(element, className) {
2931 if(!element) return;
2932 var elementClassName = ASPx.GetClassName(element);
2933 var updClassName = " " + elementClassName + " ";
2934 var newClassName = updClassName.replace(" " + className + " ", " ");
2935 if(updClassName.length != newClassName.length)
2936  ASPx.SetClassName(element, Str.Trim(newClassName));  
2937};
2938ASPx.RemoveClassNamesFromElement = function(element, classNames) {
2939 if(!element) return;
2940 for(var i = 0; i < classNames.length; i++) {
2941  var className = classNames[i];
2942  element.classList.remove(className);
2943 }
2944};
2945ASPx.ToggleClassNameToElement = function(element, className, toggleState) {
2946 if(!toggleState)
2947  ASPx.RemoveClassNameFromElement(element, className);
2948 if(toggleState && !ASPx.ElementHasCssClass(element, className))
2949  ASPx.AddClassNameToElement(element, className);
2950};
2951ASPx.GetClassNameList = function(element) {
2952 var result = [];
2953 if(element) {
2954  if(element.tagName === "svg") {
2955   result = ASPx.GetClassName(element).replace(/^\s+|\s+$/g, '').split(/\s+/);
2956  }
2957  else {
2958   result = element.classList ? [].slice.call(element.classList) : ASPx.GetClassName(element).replace(/^\s+|\s+$/g, '').split(/\s+/);
2959  }
2960 }
2961 return result;
2962};
2963ASPx.GetClassName = function(element) {
2964 var result = "";
2965 if(element) {
2966  if(element.tagName === "svg") {
2967   result = element.className.baseVal;
2968  }
2969  else {
2970   result = element.className ? element.className : "";
2971  }
2972 }
2973 return result;
2974};
2975ASPx.SetClassName = function(element, className) {
2976 if(element.tagName === "svg") {
2977  element.className.baseVal = Str.Trim(className);
2978 }
2979 else {
2980  element.className = Str.Trim(className);
2981 }
2982};
2983ASPx.GetElementOffsetWidth = function(element) {
2984 if(element.tagName === "svg") {
2985  return element.getBoundingClientRect().width;
2986 }
2987 else {
2988  return element.offsetWidth;
2989 }
2990};
2991ASPx.GetElementOffsetHeight = function(element) {
2992 if(element.tagName === "svg") {
2993  return element.getBoundingClientRect().height;
2994 }
2995 else {
2996  return element.offsetHeight;
2997 }
2998};
2999function nodeListToArray(nodeList, filter) {
3000 var result = [];
3001 for(var i = 0, element; element = nodeList[i]; i++) {
3002  if(filter && !filter(element))
3003   continue;
3004  result.push(element);
3005 }
3006 return result;
3007}
3008ASPx.NodeListToArray = nodeListToArray;
3009function getItemByIndex(collection, index) {
3010 if(!index) index = 0;
3011 if(collection != null && collection.length > index)
3012  return collection[index];
3013 return null;
3014}
3015ASPx.GetChildNodesByQuerySelector = function (parent, selector) {
3016 return nodeListToArray(parent.querySelectorAll(selector), function (el) { return el.parentNode === parent; });
3017};
3018ASPx.GetChildNodesByClassName = function(parent, className) {
3019 if(!parent) return [];
3020 if(parent.querySelectorAll) {
3021  var children = parent.querySelectorAll('.' + className);
3022  return nodeListToArray(children, function(element) { 
3023   return element.parentNode === parent;
3024  });
3025 }
3026 return ASPx.GetChildNodes(parent, function(elem) { return elem.className && ASPx.ElementHasCssClass(elem, className); });
3027};
3028ASPx.GetChildNodesByPartialClassName = function(element, className) {
3029 return ASPx.GetChildElementNodesByPredicate(element,
3030  function(child) {
3031   return ASPx.ElementContainsCssClass(child, className);
3032  });
3033};
3034ASPx.GetChildByPartialClassName = function(element, className, index) {
3035 if(element != null){    
3036  var collection = ASPx.GetChildNodesByPartialClassName(element, className);
3037  return getItemByIndex(collection, index);
3038 }
3039 return null;
3040};
3041ASPx.GetChildByClassName = function(element, className, index) {
3042 if(element != null){    
3043  var collection = ASPx.GetChildNodesByClassName(element, className);
3044  return getItemByIndex(collection, index);
3045 }
3046 return null;
3047};
3048ASPx.GetNodesByPartialClassName = function(element, className) {
3049 if(element.querySelectorAll) {
3050  var list = element.querySelectorAll('*[class*=' + className + ']');
3051  return nodeListToArray(list);
3052 }
3053 var collection = element.all || element.getElementsByTagName('*');
3054 var ret = [ ];
3055 if(collection != null) {
3056  for(var i = 0; i < collection.length; i ++) {
3057   if(ASPx.ElementContainsCssClass(collection[i], className))
3058    ret.push(collection[i]);
3059  }
3060 }
3061 return ret;
3062};
3063ASPx.GetNodesByClassName = function(parent, className) {
3064 if(parent.querySelectorAll) {
3065  var children = parent.querySelectorAll('.' + className);
3066  return nodeListToArray(children);
3067 }
3068 return ASPx.GetNodes(parent, function(elem) { return elem.className && ASPx.ElementHasCssClass(elem, className); });
3069};
3070ASPx.GetNodeByClassName = function(element, className, index) {
3071 if(element != null){    
3072  var collection = ASPx.GetNodesByClassName(element, className);
3073  return getItemByIndex(collection, index);
3074 }
3075 return null;
3076};
3077ASPx.GetChildById = function(element, id) {
3078 if(element.all) {
3079  var child = element.all[id];
3080  if(!child) {
3081   child = element.all(id); 
3082   if(!child)
3083    return null; 
3084  } 
3085  if(!ASPx.IsExists(child.length)) 
3086   return child;
3087  else
3088   return ASPx.GetElementById(id);
3089 }
3090 else
3091  return ASPx.GetElementById(id);
3092};
3093ASPx.GetNodesByPartialId = function(element, partialName, list) {
3094 if(element.id && element.id.indexOf(partialName) > -1) 
3095  list.push(element);
3096 if(element.childNodes) {
3097  for(var i = 0; i < element.childNodes.length; i ++) 
3098   ASPx.GetNodesByPartialId(element.childNodes[i], partialName, list);
3099 }
3100};
3101ASPx.GetNodesByTagName = function(element, tagName) {
3102 var tagNameToUpper = tagName.toUpperCase();
3103 var result = null;
3104 if(element) {
3105  if(element.getElementsByTagName) {
3106   result = element.getElementsByTagName(tagNameToUpper);
3107   if(result.length === 0) {
3108    result = element.getElementsByTagName(tagName);
3109   }
3110  }
3111  else if(element.all && element.all.tags !== undefined)
3112   result = Browser.Netscape ? element.all.tags[tagNameToUpper] : element.all.tags(tagNameToUpper);
3113 }
3114 return result;
3115};
3116ASPx.GetNodeByTagName = function(element, tagName, index) {
3117 if(element != null){    
3118  var collection = ASPx.GetNodesByTagName(element, tagName);
3119  return getItemByIndex(collection, index);
3120 }
3121 return null;
3122};
3123ASPx.GetChildNodesByTagName = function(parent, tagName) {
3124 return ASPx.GetChildNodes(parent, function (child) { return child.tagName === tagName; });
3125};
3126ASPx.GetChildByTagName = function(element, tagName, index) {
3127 if(element != null){    
3128  var collection = ASPx.GetChildNodesByTagName(element, tagName);
3129  return getItemByIndex(collection, index);
3130 }
3131 return null;
3132};
3133ASPx.RetrieveByPredicate = function(scourceCollection, predicate) {
3134 var result = [];
3135 for(var i = 0; i < scourceCollection.length; i++) {
3136  var element = scourceCollection[i];
3137  if(!predicate || predicate(element)) 
3138   result.push(element);
3139 }
3140 return result;
3141};
3142ASPx.GetChildNodes = function(parent, predicate) {
3143 return ASPx.RetrieveByPredicate(parent.childNodes, predicate);
3144};
3145ASPx.GetNodes = function(parent, predicate) {
3146 var c = parent.all || parent.getElementsByTagName('*');
3147 return ASPx.RetrieveByPredicate(c, predicate);
3148};
3149ASPx.GetChildElementNodes = function(parent) {
3150 if(!parent) return null;
3151 return ASPx.GetChildNodes(parent, function(e) { return e.nodeType == 1; });
3152};
3153ASPx.GetChildElementNodesByPredicate = function(parent, predicate) {
3154 if(!parent) return null;
3155 if(!predicate) return ASPx.GetChildElementNodes(parent);
3156 return ASPx.GetChildNodes(parent, function(e) { return e.nodeType == 1 && predicate(e); });
3157};
3158ASPx.GetTextNode = function(element, index) {
3159 if(element != null){
3160  var collection = [ ];
3161  ASPx.GetTextNodes(element, collection);
3162  return getItemByIndex(collection, index);
3163 }
3164 return null;
3165};
3166ASPx.GetTextNodes = function(element, collection) {
3167 if(element.tagName === "svg")
3168  return;
3169 for(var i = 0; i < element.childNodes.length; i ++){
3170  var childNode = element.childNodes[i];
3171  if(ASPx.IsExists(childNode.nodeValue))
3172   collection.push(childNode);
3173  ASPx.GetTextNodes(childNode, collection);
3174 }
3175};
3176ASPx.GetNormalizedTextNode = function(element, index) {
3177 var textNode = ASPx.GetTextNode(element, index);
3178 if(textNode != null)
3179  ASPx.MergeAdjacentTextNodes(textNode);
3180 return textNode;
3181};
3182ASPx.MergeAdjacentTextNodes = function(firstTextNode) {
3183 if(!ASPx.IsExists(firstTextNode.nodeValue))
3184  return;
3185 var textNode = firstTextNode;
3186 while(textNode.nextSibling && ASPx.IsExists(textNode.nextSibling.nodeValue)) {
3187  textNode.nodeValue += textNode.nextSibling.nodeValue;
3188  textNode.parentNode.removeChild(textNode.nextSibling);
3189 }
3190};
3191ASPx.GetElementDocument = function(element) {
3192 return element.document || element.ownerDocument;
3193};
3194ASPx.RemoveElement = function(element) {
3195 if(element && element.parentNode)
3196  element.parentNode.removeChild(element);
3197};
3198ASPx.ReplaceTagName = function(element, newTagName, cloneChilds) {
3199 if(element.nodeType != 1)
3200  return null;
3201 if(element.nodeName == newTagName)
3202  return element;
3203 cloneChilds = cloneChilds !== undefined ? cloneChilds : true;
3204 var doc = element.ownerDocument;
3205 var newElem = doc.createElement(newTagName);
3206 Attr.CopyAllAttributes(element, newElem);
3207 if(cloneChilds) {
3208  for(var i = 0; i < element.childNodes.length; i++)
3209   newElem.appendChild(element.childNodes[i].cloneNode(true));
3210 }
3211 else {
3212  for(var child; child = element.firstChild; )
3213   newElem.appendChild(child);
3214 }
3215 element.parentNode.replaceChild(newElem, element);
3216 return newElem;
3217};
3218ASPx.RemoveOuterTags = function(element) {
3219 var docFragment = element.ownerDocument.createDocumentFragment();
3220 for(var i = 0; i < element.childNodes.length; i++)
3221  docFragment.appendChild(element.childNodes[i].cloneNode(true));
3222 element.parentNode.replaceChild(docFragment, element);
3223};
3224ASPx.WrapElementInNewElement = function(element, newElementTagName) { 
3225 var wrapElement = null;
3226 var docFragment = element.ownerDocument.createDocumentFragment();
3227 wrapElement = element.ownerDocument.createElement(newElementTagName);
3228 docFragment.appendChild(wrapElement);
3229 wrapElement.appendChild(element.cloneNode(true));
3230 element.parentNode.replaceChild(docFragment, element);
3231 return wrapElement;
3232};
3233ASPx.InsertElementAfter = function(newElement, targetElement) {
3234 var parentElem = targetElement.parentNode;
3235 if(parentElem.childNodes[parentElem.childNodes.length - 1] == targetElement)
3236  parentElem.appendChild(newElement);
3237 else if(newElement !== targetElement.nextSibling)
3238  parentElem.insertBefore(newElement, targetElement.nextSibling);
3239};
3240ASPx.SetElementOpacity = function(element, value) {
3241  element.style.opacity = value;
3242};
3243ASPx.GetElementOpacity = function(element) {
3244 return parseFloat(ASPx.GetCurrentStyle(element).opacity);
3245};
3246ASPx.HiddenChangable = "dx-hc";
3247ASPx.DefaultDisplayNoneSelectors = [ "dxmodalSys" ];
3248ASPx.DefaultDisplaySelectors = ["show"];
3249function getIsDefaultDisplayNone(element) {
3250 for(var i = 0; i < ASPx.DefaultDisplayNoneSelectors.length; i++) {
3251  if(ASPx.ElementHasCssClass(element, ASPx.DefaultDisplayNoneSelectors[i]))
3252   return true;
3253 }
3254 return false;
3255}
3256ASPx.GetElementDisplay = function(element, isCurrentStyle) {
3257 if(isCurrentStyle) {
3258  var currentStyle = ASPx.GetCurrentStyle(element);
3259  if(currentStyle)
3260   return currentStyle.display != "none";
3261 }
3262 if(getIsDefaultDisplayNone(element))
3263  return element.style.display != "none" && element.style.display != "" || ASPx.DefaultDisplaySelectors.some(function(s) { return ASPx.ElementHasCssClass(element, s); });
3264 return element.style.display != "none" && !ASPx.ElementHasCssClass(element, ASPx.HiddenChangable);
3265};
3266ASPx.SetElementDisplay = function(element, value) {
3267 if(!element) return;
3268 if(ASPx.ElementHasCssClass(element, ASPx.HiddenChangable))
3269  ASPx.RemoveClassNameFromElement(element, ASPx.HiddenChangable);
3270 if(typeof(value) === "string")
3271  element.style.display = value;
3272 else if(getIsDefaultDisplayNone(element))
3273  element.style.display = value ? (element.tagName === "TABLE" ? "table" : "block") : "";
3274 else if(!value)
3275  element.style.display = "none";
3276 else
3277  element.style.display = "";
3278};
3279ASPx.GetElementVisibility = function(element, isCurrentStyle) {
3280 if(isCurrentStyle) {
3281  var currentStyle = ASPx.GetCurrentStyle(element);
3282  if(currentStyle)
3283   return currentStyle.visibility != "hidden";
3284 }
3285 return element.style.visibility != "hidden";
3286};
3287ASPx.SetElementVisibility = function(element, value) {
3288 if(!element) return;
3289 if(typeof(value) === "string")
3290  element.style.visibility = value;
3291 else
3292  element.style.visibility = value ? "visible" : "hidden";
3293};
3294ASPx.IsElementVisible = function(element, isCurrentStyle) {
3295 if(!element) return false;
3296 while(element && element.tagName != "BODY") {
3297  if(!ASPx.GetElementDisplay(element, isCurrentStyle) || (!ASPx.GetElementVisibility(element, isCurrentStyle) && !Attr.IsExistsAttribute(element, "errorFrame")))
3298     return false;
3299  element = element.parentNode;
3300 }
3301 return true;
3302};
3303ASPx.IsElementDisplayed = function(element) {
3304 if(!element) return false;
3305 while(element && element.tagName != "BODY") {
3306  if(!ASPx.GetElementDisplay(element))
3307     return false;
3308  element = element.parentNode;
3309 }
3310 return true;
3311};
3312ASPx.GetElementInitializedFlag = function(element) {
3313 return element["dxinit"];
3314};
3315ASPx.SetElementInitializedFlag = function(element) {
3316 element["dxinit"] = true;
3317};
3318ASPx.AddStyleSheetLinkToDocument = function(doc, linkUrl) {
3319 var newLink = createStyleLink(doc, linkUrl);
3320 var head = ASPx.GetHeadElementOrCreateIfNotExist(doc);
3321 head.appendChild(newLink);
3322 return newLink;
3323};
3324ASPx.GetHeadElementOrCreateIfNotExist = function(doc) {
3325 var elements = ASPx.GetNodesByTagName(doc, "head");
3326 var head = null;
3327 if(elements.length == 0) {
3328  head = doc.createElement("head");
3329  head.visibility = "hidden";
3330  doc.insertBefore(head, doc.body);
3331 } else
3332  head = elements[0];
3333 return head;
3334};
3335function createStyleLink(doc, url) {
3336 var newLink = doc.createElement("link");
3337 Attr.SetAttribute(newLink, "href", url);
3338 Attr.SetAttribute(newLink, "rel", "stylesheet");
3339 Attr.AppendStyleType(newLink);
3340 return newLink;
3341}
3342ASPx.GetCurrentStyle = function(element) {
3343 if(document.defaultView && document.defaultView.getComputedStyle) { 
3344  var result = document.defaultView.getComputedStyle(element, null);
3345  if(!result && Browser.Firefox && window.frameElement) {
3346   var changes = [];
3347   var curElement = window.frameElement;
3348   while(!(result = document.defaultView.getComputedStyle(element, null))) {
3349    changes.push([curElement, curElement.style.display]);
3350    ASPx.SetStylesCore(curElement, "display", "block", true);
3351    curElement = curElement.tagName == "BODY" ? curElement.ownerDocument.defaultView.frameElement : curElement.parentNode;
3352   }
3353   result = ASPx.CloneObject(result);
3354   for(var ch, i = 0; ch = changes[i]; i++)
3355    ASPx.SetStylesCore(ch[0], "display", ch[1]);
3356   var dummy = document.body.offsetWidth; 
3357  }
3358  if(Browser.Firefox && Browser.MajorVersion >= 62 && window.frameElement && result.length === 0) { 
3359   result = ASPx.CloneObject(result);
3360   result.display = element.style.display;
3361  }
3362  return result;
3363 }
3364 return window.getComputedStyle(element, null);
3365};
3366ASPx.CreateStyleSheetInDocument = function(doc) {
3367 if(doc.createStyleSheet) {
3368  try {
3369   return doc.createStyleSheet();
3370  }
3371  catch(e) {
3372   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.";
3373   throw new Error(message);
3374  }
3375 }
3376 else {
3377  var styleSheet = doc.createElement("STYLE");
3378  ASPx.GetNodeByTagName(doc, "HEAD", 0).appendChild(styleSheet);
3379  return styleSheet.sheet;
3380 }
3381};
3382ASPx.currentStyleSheet = null;
3383ASPx.GetCurrentStyleSheet = function() {
3384 if(!ASPx.currentStyleSheet)
3385  ASPx.currentStyleSheet = ASPx.CreateStyleSheetInDocument(document);
3386 return ASPx.currentStyleSheet;
3387};
3388function getStyleSheetRules(styleSheet){
3389 try {
3390  if (styleSheet.href && styleSheet.href.indexOf("file:///") === 0)
3391   return null;
3392  return styleSheet.cssRules;
3393 }
3394 catch(e) {
3395  return null;
3396 }
3397}
3398ASPx.cachedCssRules = { };
3399ASPx.GetStyleSheetRules = function (className, stylesStorageDocument) {
3400 if(ASPx.cachedCssRules[className]) {
3401  if(ASPx.cachedCssRules[className] != ASPx.EmptyObject)
3402   return ASPx.cachedCssRules[className];
3403  return null;
3404 }
3405 var result = iterateStyleSheetRules(stylesStorageDocument, function(rule) {
3406  if(rule.selectorText == "." + className){
3407   ASPx.cachedCssRules[className] = rule;
3408   return rule;
3409  }
3410 });
3411 if(ASPx.IsExists(result))
3412  return result;
3413 ASPx.cachedCssRules[className] = ASPx.EmptyObject;
3414 return null;
3415};
3416function iterateStyleSheetRules(stylesStorageDocument, callback) {
3417 var doc = stylesStorageDocument || document;
3418 for(var i = 0; i < doc.styleSheets.length; i ++){
3419  var styleSheet = doc.styleSheets[i];
3420  var rules = getStyleSheetRules(styleSheet);
3421  if(rules != null){
3422   for(var j = 0; j < rules.length; j ++) {
3423    var result = callback(rules[j]);
3424    if(result !== undefined)
3425     return result;
3426   }
3427  }
3428 }
3429}
3430ASPx.ProcessStyleSheetRules = function(prefix, callback) {
3431 iterateStyleSheetRules(null, function(rule) {
3432  if(!!rule.selectorText && rule.selectorText.indexOf(prefix) === 0) {
3433   var name = rule.selectorText.substring(prefix.length);
3434   var result = callback(name, rule.style, rule);
3435   if(result !== undefined)
3436    return result;
3437  }
3438 });
3439};
3440ASPx.ClearCachedCssRules = function(){
3441 ASPx.cachedCssRules = { };
3442};
3443var styleCount = 0;
3444var styleNameCache = { };
3445ASPx.CreateImportantStyleRule = function(styleSheet, cssText, postfix, prefix) {
3446 styleSheet = styleSheet || ASPx.GetCurrentStyleSheet();
3447 var cacheKey = (postfix ? postfix + "||" : "") + cssText + (prefix ? "||" + prefix : "");
3448 if(styleNameCache[cacheKey])
3449  return styleNameCache[cacheKey];
3450 prefix = prefix ? prefix + " " : "";
3451 var className = "dxh" + styleCount + (postfix ? postfix : "");
3452 ASPx.AddStyleSheetRule(styleSheet, prefix + "." + className, ASPx.CreateImportantCssText(cssText));
3453 styleCount++;
3454 styleNameCache[cacheKey] = className;
3455 return className; 
3456};
3457ASPx.CreateImportantCssText = function(cssText) {
3458 var newText = "";
3459 var hasEncodedSemicolon = cssText.indexOf(ASPx.StyleValueEncodedSemicolon) > -1;
3460 var attributes = cssText.split(";");
3461 for(var i = 0; i < attributes.length; i++) {
3462  var rule = attributes[i];
3463  if(rule != "")
3464   newText += ASPx.CreateImportantCssRule(rule, hasEncodedSemicolon);
3465 }
3466 return newText;
3467};
3468ASPx.CreateImportantCssRule = function(rule, hasEncodedSemicolon) {
3469 var result = rule;
3470 if(hasEncodedSemicolon) {
3471  var regex = new RegExp(ASPx.StyleValueEncodedSemicolon, "g");
3472  result = result.replace(regex, ";");
3473 }
3474 result = result + " !important;";
3475 return result;
3476};
3477ASPx.AddStyleSheetRule = function(styleSheet, selector, cssText){
3478 if(!cssText) return;
3479 var index = styleSheet.cssRules.length;
3480 styleSheet.insertRule(selector + " { " + cssText + " }", index);
3481 return styleSheet.cssRules[index];
3482};
3483ASPx.GetPointerCursor = function() {
3484 return "pointer";
3485};
3486ASPx.SetPointerCursor = function(element) {
3487 if(element.style.cursor == "")
3488  element.style.cursor = ASPx.GetPointerCursor();
3489};
3490ASPx.SetElementFloat = function(element, value) {
3491 if(ASPx.IsExists(element.style.cssFloat))
3492  element.style.cssFloat = value;
3493 else if(ASPx.IsExists(element.style.styleFloat))
3494  element.style.styleFloat = value;
3495 else
3496  Attr.SetAttribute(element.style, "float", value);
3497};
3498ASPx.GetElementFloat = function(element) {
3499 var currentStyle = ASPx.GetCurrentStyle(element);
3500 if(ASPx.IsExists(currentStyle.cssFloat))
3501  return currentStyle.cssFloat;
3502 if(ASPx.IsExists(currentStyle.styleFloat))
3503  return currentStyle.styleFloat;
3504 return Attr.GetAttribute(currentStyle, "float");
3505};
3506function getElementDirection(element) {
3507 return ASPx.GetCurrentStyle(element).direction;
3508}
3509ASPx.IsElementRightToLeft = function(element) {
3510 return getElementDirection(element) == "rtl";
3511};
3512ASPx.AdjustVerticalMarginsInContainer = function(container) {
3513 var containerBorderAndPaddings = ASPx.GetTopBottomBordersAndPaddingsSummaryValue(container);
3514 var flowElements = [], floatElements = [], floatTextElements = [];
3515 var maxHeight = 0, maxFlowHeight = 0;
3516 for(var i = 0; i < container.childNodes.length; i++) {
3517  var element = container.childNodes[i];
3518  if(!element.offsetHeight) continue;
3519  ASPx.ClearVerticalMargins(element);
3520 }
3521 for(var i = 0; i < container.childNodes.length; i++) {
3522  var element = container.childNodes[i];
3523  if(!element.offsetHeight) continue;
3524  var float = ASPx.GetElementFloat(element);
3525  var isFloat = (float === "left" || float === "right");
3526  if(isFloat)
3527   floatElements.push(element);
3528  else {
3529   flowElements.push(element);
3530   if(element.tagName !== "IMG"){
3531    if(!ASPx.IsTextWrapped(element))
3532     element.style.verticalAlign = 'baseline'; 
3533    floatTextElements.push(element);
3534   }
3535   if(element.tagName === "DIV")
3536    Attr.ChangeStyleAttribute(element, "float", "left"); 
3537  }
3538  if(element.offsetHeight > maxHeight) 
3539   maxHeight = element.offsetHeight;
3540  if(!isFloat && element.offsetHeight > maxFlowHeight) 
3541   maxFlowHeight = element.offsetHeight;
3542 }
3543 for(var i = 0; i < flowElements.length; i++) 
3544  Attr.RestoreStyleAttribute(flowElements[i], "float");
3545 var containerBorderAndPaddings = ASPx.GetTopBottomBordersAndPaddingsSummaryValue(container);
3546 var containerHeight = container.offsetHeight - containerBorderAndPaddings;
3547 if(maxHeight == containerHeight) {
3548  var verticalAlign = ASPx.GetCurrentStyle(container).verticalAlign;
3549  for(var i = 0; i < floatTextElements.length; i++)
3550   floatTextElements[i].style.verticalAlign = '';
3551  containerHeight = container.offsetHeight - containerBorderAndPaddings;
3552  for(var i = 0; i < floatElements.length; i++)
3553   adjustVerticalMarginsCore(floatElements[i], containerHeight, verticalAlign, true);
3554  for(var i = 0; i < flowElements.length; i++) {
3555   if(maxFlowHeight != maxHeight)
3556    adjustVerticalMarginsCore(flowElements[i], containerHeight, verticalAlign);
3557  }
3558 }
3559};
3560ASPx.AdjustVerticalMargins = function(element) {
3561 ASPx.ClearVerticalMargins(element);
3562 var parentElement = element.parentNode;
3563 var parentHeight = parentElement.getBoundingClientRect().height - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(parentElement);
3564 adjustVerticalMarginsCore(element, parentHeight, ASPx.GetCurrentStyle(parentElement).verticalAlign);
3565};
3566function adjustVerticalMarginsCore(element, parentHeight, verticalAlign, toBottom) {
3567 var marginTop;
3568 if(verticalAlign == "top")
3569  marginTop = 0;
3570 else if(verticalAlign == "bottom")
3571  marginTop = parentHeight - element.getBoundingClientRect().height;
3572 else
3573  marginTop = (parentHeight - element.getBoundingClientRect().height) / 2;
3574 if(marginTop !== 0){
3575  element.style.marginTop = marginTop + "px";
3576 }
3577}
3578ASPx.ClearVerticalMargins = function(element) {
3579 element.style.marginTop = "";
3580 element.style.marginBottom = "";
3581};
3582ASPx.AdjustHeightInContainer = function(container) {
3583 var height = container.offsetHeight - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(container);
3584 for(var i = 0; i < container.childNodes.length; i++) {
3585  var element = container.childNodes[i];
3586  if(!element.offsetHeight) continue;
3587  ASPx.ClearHeight(element);
3588 }
3589 var elements = [];
3590 var childrenHeight = 0;
3591 for(var i = 0; i < container.childNodes.length; i++) {
3592  var element = container.childNodes[i];
3593  if(!element.offsetHeight) continue;
3594  childrenHeight += element.offsetHeight + ASPx.GetTopBottomMargins(element);
3595  elements.push(element);
3596 }
3597 if(elements.length > 0 && childrenHeight < height) {
3598  var correctedHeight = 0;
3599  for(var i = 0; i < elements.length; i++) {
3600   var elementHeight = 0;
3601   if(i < elements.length - 1){
3602    var elementHeight = Math.floor(height / elements.length);
3603    correctedHeight += elementHeight;
3604   }
3605   else{
3606    var elementHeight = height - correctedHeight;
3607    if(elementHeight < 0) elementHeight = 0;
3608   }
3609   adjustHeightCore(elements[i], elementHeight);
3610  }
3611 }
3612};
3613ASPx.AdjustHeight = function(element) {
3614 ASPx.ClearHeight(element);
3615 var parentElement = element.parentNode;
3616 var height = parentElement.getBoundingClientRect().height - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(parentElement);
3617 adjustHeightCore(element, height);
3618};
3619function adjustHeightCore(element, height) {
3620 var height = height - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(element);
3621 if(height < 0) height = 0;
3622 element.style.height = height + "px";
3623}
3624ASPx.ClearHeight = function(element) {
3625 element.style.height = "";
3626};
3627ASPx.ShrinkWrappedTextInContainer = function(container) {
3628 if(!container) return;
3629 for(var i = 0; i < container.childNodes.length; i++){
3630  var child = container.childNodes[i];
3631  if(child.style && ASPx.IsTextWrapped(child)) {
3632   Attr.ChangeStyleAttribute(child, "width", "1px");
3633   child.shrinkedTextContainer = true;
3634  }
3635 }
3636};
3637ASPx.AdjustWrappedTextInContainer = function(container) {
3638 if(!container) return;
3639 var textContainer, leftWidth = 0, rightWidth = 0;
3640 for(var i = 0; i < container.childNodes.length; i++){
3641  var child = container.childNodes[i];
3642  if(child.tagName === "BR")
3643   return;
3644  if(!child.tagName)
3645   continue;
3646  if(child.tagName !== "IMG"){
3647   textContainer = child;
3648   if(ASPx.IsTextWrapped(textContainer)){
3649    if(!textContainer.shrinkedTextContainer)
3650     textContainer.style.width = "";
3651    textContainer.style.marginRight = "";
3652   }
3653  }
3654  else {
3655   if(ASPx.GetElementOffsetWidth(child)=== 0)
3656    Evt.AttachEventToElement(child, "load", function(evt) { ASPx.AdjustWrappedTextInContainer(container); });
3657   else {
3658    var width = ASPx.GetElementOffsetWidth(child) + ASPx.GetLeftRightMargins(child);
3659    if(textContainer)
3660     rightWidth += width;
3661    else
3662     leftWidth += width;
3663   }
3664  }
3665 }
3666 if(textContainer && ASPx.IsTextWrapped(textContainer)) {
3667  var containerWidth = ASPx.GetElementOffsetWidth(container) - ASPx.GetLeftRightBordersAndPaddingsSummaryValue(container);
3668  if(textContainer.shrinkedTextContainer) {
3669   Attr.RestoreStyleAttribute(textContainer, "width");
3670   Attr.ChangeStyleAttribute(container, "width", containerWidth + "px");
3671  }
3672  if(ASPx.GetElementOffsetWidth(textContainer) + leftWidth + rightWidth >= containerWidth) {
3673    if(rightWidth > 0 && !textContainer.shrinkedTextContainer)
3674    textContainer.style.width = (containerWidth - rightWidth) + "px";
3675   else if(leftWidth > 0){
3676    if(ASPx.IsElementRightToLeft(container))
3677     textContainer.style.marginLeft = leftWidth + "px";
3678    else
3679     textContainer.style.marginRight = leftWidth + "px";
3680   }
3681  }
3682 }
3683};
3684ASPx.IsTextWrapped = function(element) {
3685 return element && ASPx.GetCurrentStyle(element).whiteSpace !== "nowrap";
3686};
3687ASPx.IsValidPosition = function(pos){
3688 return pos != ASPx.InvalidPosition && pos != -ASPx.InvalidPosition;
3689};
3690ASPx.getSpriteMainElement = function(element) {
3691 var cssClassMarker = "dx-acc";
3692 if(ASPx.ElementContainsCssClass(element, cssClassMarker))
3693  return element;
3694 if(element.parentNode && ASPx.ElementContainsCssClass(element.parentNode, cssClassMarker))
3695  return element.parentNode;
3696 return element;
3697};
3698ASPx.GetAbsoluteX = function(curEl){
3699 return ASPx.GetAbsolutePositionX(curEl);
3700};
3701ASPx.GetAbsoluteY = function(curEl){
3702 return ASPx.GetAbsolutePositionY(curEl);
3703};
3704ASPx.SetAbsoluteX = function(element, x){
3705 element.style.left = ASPx.PrepareClientPosForElement(x, element, true) + "px";
3706};
3707ASPx.SetAbsoluteY = function(element, y){
3708 element.style.top = ASPx.PrepareClientPosForElement(y, element, false) + "px";
3709};
3710ASPx.GetAbsolutePositionX = function(element){
3711 if(Browser.Firefox && Browser.Version >= 3)
3712  return getAbsolutePositionX_FF3(element);
3713 else if(Browser.Opera)
3714  return getAbsolutePositionX_Opera(element);
3715 else if(Browser.NetscapeFamily && (!Browser.Firefox || Browser.Version < 3))
3716  return getAbsolutePositionX_NS(element);
3717 else if(Browser.WebKitFamily || Browser.Edge)
3718  return getAbsolutePositionX_FF3(element);
3719 else
3720  return getAbsolutePositionX_Other(element);
3721};
3722function getAbsolutePositionX_Opera(curEl){
3723 var isFirstCycle = true;
3724 var pos = getAbsoluteScrollOffset_OperaFF(curEl, true);
3725 while(curEl != null) {
3726  pos += curEl.offsetLeft;
3727  if(!isFirstCycle)
3728   pos -= curEl.scrollLeft;
3729  curEl = curEl.offsetParent;
3730  isFirstCycle = false;
3731 }
3732 pos += document.body.scrollLeft;
3733 return pos;
3734}
3735function getAbsolutePositionX_FF3(element){
3736 if(element == null) return 0;
3737 var x = element.getBoundingClientRect().left + ASPx.GetDocumentScrollLeft();
3738 return x;
3739}
3740function getAbsolutePositionX_NS(curEl){
3741 var pos = getAbsoluteScrollOffset_OperaFF(curEl, true);
3742 var isFirstCycle = true;
3743 while(curEl != null) {
3744  pos += curEl.offsetLeft;
3745  if(!isFirstCycle && curEl.offsetParent != null)
3746   pos -= curEl.scrollLeft;
3747  if(!isFirstCycle && Browser.Firefox){
3748   var style = ASPx.GetCurrentStyle(curEl);
3749   if(curEl.tagName == "DIV" && style.overflow != "visible")
3750    pos += ASPx.PxToInt(style.borderLeftWidth);
3751  }
3752  isFirstCycle = false;
3753  curEl = curEl.offsetParent;
3754 }
3755 return pos;
3756}
3757function getAbsolutePositionX_Other(curEl){
3758 var pos = 0;
3759 var isFirstCycle = true;
3760 while(curEl != null) {
3761  pos += curEl.offsetLeft;
3762  if(!isFirstCycle && curEl.offsetParent != null)
3763   pos -= curEl.scrollLeft;
3764  isFirstCycle = false;
3765  curEl = curEl.offsetParent;
3766 }
3767 return pos;
3768}
3769ASPx.GetAbsolutePositionY = function(element){
3770 if(Browser.Firefox && Browser.Version >= 3)
3771  return getAbsolutePositionY_FF3(element);
3772 else if(Browser.Opera)
3773  return getAbsolutePositionY_Opera(element);
3774 else if(Browser.NetscapeFamily && (!Browser.Firefox || Browser.Version < 3))
3775  return getAbsolutePositionY_NS(element);
3776 else if(Browser.WebKitFamily || Browser.Edge)
3777  return getAbsolutePositionY_FF3(element);
3778 else
3779  return getAbsolutePositionY_Other(element);
3780};
3781function getAbsolutePositionY_Opera(curEl){
3782 var isFirstCycle = true;
3783 if(curEl && curEl.tagName == "TR" && curEl.cells.length > 0)
3784  curEl = curEl.cells[0];
3785 var pos = getAbsoluteScrollOffset_OperaFF(curEl, false);
3786 while(curEl != null) {
3787  pos += curEl.offsetTop;
3788  if(!isFirstCycle)
3789   pos -= curEl.scrollTop;
3790  curEl = curEl.offsetParent;
3791  isFirstCycle = false;
3792 }
3793 pos += document.body.scrollTop;
3794 return pos;
3795}
3796function getAbsolutePositionY_FF3(element){
3797 if(element == null) return 0;
3798 var y = element.getBoundingClientRect().top + ASPx.GetDocumentScrollTop();
3799 return y;
3800}
3801function getAbsolutePositionY_NS(curEl){
3802 var pos = getAbsoluteScrollOffset_OperaFF(curEl, false);
3803 var isFirstCycle = true;
3804 while(curEl != null) {
3805  pos += curEl.offsetTop;
3806  if(!isFirstCycle && curEl.offsetParent != null)
3807   pos -= curEl.scrollTop;
3808  if(!isFirstCycle && Browser.Firefox){
3809   var style = ASPx.GetCurrentStyle(curEl);
3810   if(curEl.tagName == "DIV" && style.overflow != "visible")
3811    pos += ASPx.PxToInt(style.borderTopWidth);
3812  }
3813  isFirstCycle = false;
3814  curEl = curEl.offsetParent;
3815 }
3816 return pos;
3817}
3818function getAbsoluteScrollOffset_OperaFF(curEl, isX) {
3819 var pos = 0;   
3820 var isFirstCycle = true;
3821 while(curEl != null) {
3822  if(curEl.tagName == "BODY")
3823   break;
3824  var style = ASPx.GetCurrentStyle(curEl);
3825  if(style.position == "absolute")
3826   break;
3827  if(!isFirstCycle && curEl.tagName == "DIV" && (style.position == "" || style.position == "static"))
3828   pos -= isX ? curEl.scrollLeft : curEl.scrollTop;
3829  curEl = curEl.parentNode;
3830  isFirstCycle = false;
3831 }
3832 return pos; 
3833}
3834function getAbsolutePositionY_Other(curEl){
3835 var pos = 0;
3836 var isFirstCycle = true;
3837 while(curEl != null) {
3838  pos += curEl.offsetTop;
3839  if(!isFirstCycle && curEl.offsetParent != null)
3840   pos -= curEl.scrollTop;
3841  isFirstCycle = false;
3842  curEl = curEl.offsetParent;
3843 }
3844 return pos;
3845}
3846function createElementMock(element) {
3847 var div = document.createElement('DIV');
3848 div.style.top = "0px";
3849 div.style.left = "0px";
3850 div.visibility = "hidden";
3851 div.style.position = ASPx.GetCurrentStyle(element).position;
3852 return div;
3853}
3854ASPx.PrepareClientPosElementForOtherParent = function(pos, element, otherParent, isX) {
3855 if(element.parentNode == otherParent)
3856  return ASPx.PrepareClientPosForElement(pos, element, isX);
3857 var elementMock = createElementMock(element);
3858 otherParent.appendChild(elementMock); 
3859 var preparedPos = ASPx.PrepareClientPosForElement(pos, elementMock, isX);
3860 otherParent.removeChild(elementMock);
3861 return preparedPos;
3862};
3863ASPx.PrepareClientPosForElement = function(pos, element, isX) {
3864 pos -= ASPx.GetPositionElementOffset(element, isX);
3865 return pos;
3866};
3867function getExperimentalPositionOffset(element, isX) {
3868 var div = createElementMock(element);
3869 if(div.style.position == "static")
3870  div.style.position = "absolute";
3871 element.parentNode.appendChild(div); 
3872 var realPos = isX ? ASPx.GetAbsoluteX(div) : ASPx.GetAbsoluteY(div);
3873 element.parentNode.removeChild(div);
3874 return realPos;
3875}
3876ASPx.GetPositionElementOffset = function(element, isX) {
3877 return getExperimentalPositionOffset(element, isX);
3878};
3879ASPx.GetSizeOfText = function(text, textCss) {
3880 var testContainer = document.createElement("tester");
3881 var defaultLineHeight = ASPx.Browser.Firefox ? "1" : "";
3882 testContainer.style.fontSize = textCss.fontSize;
3883 testContainer.style.fontFamily = textCss.fontFamily;
3884 testContainer.style.fontWeight = textCss.fontWeight;
3885 testContainer.style.letterSpacing = textCss.letterSpacing;
3886 testContainer.style.lineHeight = textCss.lineHeight || defaultLineHeight;
3887 testContainer.style.position = "absolute";
3888 testContainer.style.top = ASPx.InvalidPosition + "px";
3889 testContainer.style.left = ASPx.InvalidPosition + "px";
3890 testContainer.style.width = "auto";
3891 testContainer.style.whiteSpace = "nowrap";
3892 testContainer.appendChild(document.createTextNode(text));
3893 var testElement = document.body.appendChild(testContainer);
3894 var size = {
3895  "width": testElement.offsetWidth,
3896  "height": testElement.offsetHeight
3897 };
3898 document.body.removeChild(testElement);
3899 return size;
3900};
3901ASPx.PointToPixel = function(points, addPx) {  
3902 var result = 0;
3903 try {
3904  var indexOfPt = points.toLowerCase().indexOf("pt");
3905  if(indexOfPt > -1)
3906   result = parseInt(points.substr(0, indexOfPt)) * 96 / 72;
3907  else
3908   result = parseInt(points) * 96 / 72;
3909  if(addPx)
3910   result = result + "px";
3911 } catch(e) {}
3912 return result;
3913};
3914ASPx.PixelToPoint = function(pixels, addPt) { 
3915 var result = 0;
3916 try {
3917  var indexOfPx = pixels.toLowerCase().indexOf("px");
3918  if(indexOfPx > -1)
3919   result = parseInt(pixels.substr(0, indexOfPx)) * 72 / 96;
3920  else
3921   result = parseInt(pixels) * 72 / 96;
3922  if(addPt)
3923   result = result + "pt";
3924 } catch(e) {}
3925 return result;         
3926};
3927ASPx.PxToInt = function(px) {
3928 return pxToNumber(px, parseInt);
3929};
3930ASPx.PxToFloat = function(px) {
3931 return pxToNumber(px, parseFloat);
3932};
3933function pxToNumber(px, parseFunction) {
3934 var result = 0;
3935 if(px != null && px != "") {
3936  try {
3937   var indexOfPx = px.indexOf("px");
3938   if(indexOfPx > -1)
3939    result = parseFunction(px.substr(0, indexOfPx));
3940  } catch(e) { }
3941 }
3942 return result;
3943}
3944ASPx.PercentageToFloat = function(perc) {
3945 var result = 0;
3946 if(perc != null && perc != "") {
3947  try {
3948   var indexOfPerc = perc.indexOf("%");
3949   if(indexOfPerc > -1)
3950    result = parseFloat(perc.substr(0, indexOfPerc)) / 100;
3951  } catch(e) { }
3952 }
3953 return result;
3954};
3955ASPx.CreateGuid = function() {
3956 return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { 
3957   var r = Math.random()*16|0,v=c=='x'?r:r&0x3|0x8;
3958  return v.toString(16);
3959 });
3960};
3961ASPx.GetLeftRightBordersAndPaddingsSummaryValue = function(element, currentStyle) {
3962 return ASPx.GetLeftRightPaddings(element, currentStyle) + ASPx.GetHorizontalBordersWidth(element, currentStyle);
3963};
3964ASPx.GetTopBottomBordersAndPaddingsSummaryValue = function(element, currentStyle) {
3965 return ASPx.GetTopBottomPaddings(element, currentStyle) + ASPx.GetVerticalBordersWidth(element, currentStyle);
3966};
3967ASPx.GetVerticalBordersWidth = function(element, style) {
3968 if(!ASPx.IsExists(style))
3969  style = ASPx.GetCurrentStyle(element);
3970 var res = 0;
3971 if(style.borderTopStyle != "none")
3972  res += ASPx.PxToFloat(style.borderTopWidth);
3973 if(style.borderBottomStyle != "none")
3974  res += ASPx.PxToFloat(style.borderBottomWidth);
3975 return res;
3976};
3977ASPx.GetHorizontalBordersWidth = function(element, style) {
3978 if(!ASPx.IsExists(style))
3979  style = ASPx.GetCurrentStyle(element);
3980 var res = 0;
3981 if(style.borderLeftStyle != "none")
3982  res += ASPx.PxToFloat(style.borderLeftWidth);
3983 if(style.borderRightStyle != "none")
3984  res += ASPx.PxToFloat(style.borderRightWidth);
3985 return res;
3986};
3987ASPx.GetTopBottomPaddings = function(element, style) {
3988 var currentStyle = style ? style : ASPx.GetCurrentStyle(element);
3989 return ASPx.PxToInt(currentStyle.paddingTop) + ASPx.PxToInt(currentStyle.paddingBottom);
3990};
3991ASPx.GetTopPaddings = function(element, style) {
3992 var currentStyle = style ? style : ASPx.GetCurrentStyle(element);
3993 return ASPx.PxToInt(currentStyle.paddingTop);
3994};
3995ASPx.GetBottomPaddings = function(element, style) {
3996 var currentStyle = style ? style : ASPx.GetCurrentStyle(element);
3997 return ASPx.PxToInt(currentStyle.paddingBottom);
3998};
3999ASPx.GetLeftRightPaddings = function(element, style) {
4000 var currentStyle = style ? style : ASPx.GetCurrentStyle(element);
4001 return ASPx.PxToInt(currentStyle.paddingLeft) + ASPx.PxToInt(currentStyle.paddingRight);
4002};
4003ASPx.GetTopBottomMargins = function(element, style) {
4004 var currentStyle = style ? style : ASPx.GetCurrentStyle(element);
4005 return ASPx.PxToInt(currentStyle.marginTop) + ASPx.PxToInt(currentStyle.marginBottom);
4006};
4007ASPx.GetLeftRightMargins = function(element, style) {
4008 var currentStyle = style ? style : ASPx.GetCurrentStyle(element);
4009 return ASPx.PxToInt(currentStyle.marginLeft) + ASPx.PxToInt(currentStyle.marginRight);
4010};
4011ASPx.GetClearClientWidth = function(element) {
4012 return ASPx.GetElementOffsetWidth(element)- ASPx.GetLeftRightBordersAndPaddingsSummaryValue(element);
4013};
4014ASPx.GetClearClientHeight = function(element) {
4015 return ASPx.GetElementOffsetHeight(element) - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(element);
4016};
4017ASPx.SetOffsetWidth = function(element, widthValue, currentStyle) {
4018 if(!ASPx.IsExists(currentStyle))
4019  currentStyle = ASPx.GetCurrentStyle(element);
4020 var value = widthValue - ASPx.PxToInt(currentStyle.marginLeft) - ASPx.PxToInt(currentStyle.marginRight);
4021  value -= ASPx.GetLeftRightBordersAndPaddingsSummaryValue(element, currentStyle);
4022 if(value > -1)
4023  element.style.width = value + "px";
4024};
4025ASPx.SetOffsetHeight = function(element, heightValue, currentStyle) {
4026 if(!ASPx.IsExists(currentStyle))
4027  currentStyle = ASPx.GetCurrentStyle(element);
4028 var value = heightValue - ASPx.PxToInt(currentStyle.marginTop) - ASPx.PxToInt(currentStyle.marginBottom);
4029  value -= ASPx.GetTopBottomBordersAndPaddingsSummaryValue(element, currentStyle);
4030 if(value > -1)
4031  element.style.height = value + "px";
4032};
4033ASPx.FindOffsetParent = function(element) {
4034 var currentElement = element.parentNode;
4035 while(ASPx.IsExistsElement(currentElement) && currentElement.tagName != "BODY") {
4036  if(ASPx.GetElementOffsetWidth(currentElement) > 0 && ASPx.GetElementOffsetHeight(currentElement) > 0)
4037   return currentElement;
4038  currentElement = currentElement.parentNode;
4039 }
4040 return document.body;
4041};
4042ASPx.GetDocumentScrollTop = function(){
4043 if(Browser.WebKitFamily || Browser.Edge) {
4044  if(Browser.MacOSMobilePlatform) 
4045   return window.pageYOffset;
4046  if(Browser.WebKitFamily)
4047   return document.documentElement.scrollTop || document.body.scrollTop;
4048  return document.body.scrollTop;
4049 }
4050 else
4051  return document.documentElement.scrollTop;
4052};
4053ASPx.SetDocumentScrollTop = function(scrollTop) {
4054 if(!Browser.MacOSMobilePlatform && (Browser.Safari || (Browser.Chrome && Browser.Version < 60) || (Browser.Opera && Browser.MajorVersion >= 15) || Browser.Edge))  
4055  document.body.scrollTop = scrollTop;
4056 else
4057  document.documentElement.scrollTop = scrollTop;
4058};
4059ASPx.GetDocumentScrollLeft = function(){
4060 if(Browser.Edge)
4061  return document.body ? document.body.scrollLeft : document.documentElement.scrollLeft;
4062 if(Browser.WebKitFamily)
4063  return document.documentElement.scrollLeft || document.body.scrollLeft;
4064 return document.documentElement.scrollLeft;
4065};
4066ASPx.SetDocumentScrollLeft = function (scrollLeft) {
4067 if(!Browser.MacOSMobilePlatform && (Browser.Safari || (Browser.Chrome && Browser.Version < 60) || (Browser.Opera && Browser.MajorVersion >= 15) || Browser.Edge))  
4068  document.body.scrollLeft = scrollLeft;
4069 else
4070  document.documentElement.scrollLeft = scrollLeft;
4071};
4072ASPx.GetDocumentClientWidth = function(){
4073 if(document.documentElement.clientWidth == 0)
4074  return document.body.clientWidth;
4075 else
4076  return document.documentElement.clientWidth;
4077};
4078ASPx.GetDocumentClientHeight = function() {
4079 if(Browser.Firefox && window.innerHeight - document.documentElement.clientHeight > ASPx.GetVerticalScrollBarWidth()) {
4080  return window.innerHeight;
4081 } else if(Browser.Opera && Browser.Version < 9.6 || document.documentElement.clientHeight == 0) {
4082   return document.body.clientHeight;
4083 }
4084 return document.documentElement.clientHeight;
4085};
4086ASPx.GetDocumentWidth = function(){
4087 var bodyWidth = document.body.offsetWidth;
4088 var docWidth = document.documentElement.offsetWidth;
4089 var bodyScrollWidth = document.body.scrollWidth;
4090 var docScrollWidth = document.documentElement.scrollWidth;
4091 return getMaxDimensionOf(bodyWidth, docWidth, bodyScrollWidth, docScrollWidth);
4092};
4093ASPx.GetDocumentHeight = function(){
4094 var bodyHeight = document.body.offsetHeight;
4095 var docHeight = document.documentElement.offsetHeight;
4096 var bodyScrollHeight = document.body.scrollHeight;
4097 var docScrollHeight = document.documentElement.scrollHeight;
4098 var maxHeight = getMaxDimensionOf(bodyHeight, docHeight, bodyScrollHeight, docScrollHeight);
4099 if(Browser.Opera && Browser.Version >= 9.6){
4100  if(Browser.Version < 10)
4101   maxHeight = getMaxDimensionOf(bodyHeight, docHeight, bodyScrollHeight);
4102  var visibleHeightOfDocument = document.documentElement.clientHeight;
4103  if(maxHeight > visibleHeightOfDocument)
4104   maxHeight = getMaxDimensionOf(window.outerHeight, maxHeight);
4105  else
4106   maxHeight = document.documentElement.clientHeight;
4107  return maxHeight;
4108 }
4109 return maxHeight;
4110};
4111ASPx.GetDocumentMaxClientWidth = function(){
4112 var bodyWidth = document.body.offsetWidth;
4113 var docWidth = document.documentElement.offsetWidth;
4114 var docClientWidth = document.documentElement.clientWidth;
4115 return getMaxDimensionOf(bodyWidth, docWidth, docClientWidth);
4116};
4117ASPx.GetDocumentMaxClientHeight = function(){
4118 var bodyHeight = document.body.offsetHeight;
4119 var docHeight = document.documentElement.offsetHeight;
4120 var docClientHeight = document.documentElement.clientHeight;
4121 return getMaxDimensionOf(bodyHeight, docHeight, docClientHeight);
4122};
4123ASPx.verticalScrollIsNotHidden = null;
4124ASPx.horizontalScrollIsNotHidden = null;
4125ASPx.GetVerticalScrollIsNotHidden = function() {
4126 if(!ASPx.IsExists(ASPx.verticalScrollIsNotHidden))
4127  ASPx.verticalScrollIsNotHidden = ASPx.GetCurrentStyle(document.body).overflowY !== "hidden"
4128   && ASPx.GetCurrentStyle(document.documentElement).overflowY !== "hidden";
4129 return ASPx.verticalScrollIsNotHidden;
4130};
4131ASPx.GetHorizontalScrollIsNotHidden = function() {
4132 if(!ASPx.IsExists(ASPx.horizontalScrollIsNotHidden))
4133  ASPx.horizontalScrollIsNotHidden = ASPx.GetCurrentStyle(document.body).overflowX !== "hidden"
4134   && ASPx.GetCurrentStyle(document.documentElement).overflowX !== "hidden";
4135 return ASPx.horizontalScrollIsNotHidden;
4136};
4137ASPx.GetCurrentDocumentWidth = function() {
4138 var result = ASPx.GetDocumentClientWidth();
4139 if(!ASPx.Browser.Safari && ASPx.GetVerticalScrollIsNotHidden() && ASPx.GetDocumentHeight() > ASPx.GetDocumentClientHeight())
4140  result += ASPx.GetVerticalScrollBarWidth();
4141 return result;
4142};
4143ASPx.GetCurrentDocumentHeight = function() {
4144 var result = ASPx.GetDocumentClientHeight();
4145 if(!ASPx.Browser.Safari && ASPx.GetHorizontalScrollIsNotHidden() && ASPx.GetDocumentWidth() > ASPx.GetDocumentClientWidth())
4146  result += ASPx.GetVerticalScrollBarWidth();
4147 return result;
4148};
4149function getMaxDimensionOf(){
4150 var max = ASPx.InvalidDimension;
4151 for(var i = 0; i < arguments.length; i++){
4152  if(max < arguments[i])
4153   max = arguments[i];
4154 }
4155 return max;
4156}
4157ASPx.GetClientLeft = function(element) {
4158 return ASPx.IsExists(element.clientLeft) ? element.clientLeft : (ASPx.GetElementOffsetWidth(element)- element.clientWidth) / 2;
4159};
4160ASPx.GetClientTop = function(element) {
4161 return ASPx.IsExists(element.clientTop) ? element.clientTop : (ASPx.GetElementOffsetHeight(element) - element.clientHeight) / 2;
4162};
4163var requestAnimationFrameFunc = window.requestAnimationFrame || function(callback) { callback(); };
4164var cancelAnimationFrameFunc = window.cancelAnimationFrame || function(id) { };
4165ASPx.CancelAnimationFrame = function(id) { cancelAnimationFrameFunc(id); };
4166ASPx.RequestAnimationFrame = function (callback) { return requestAnimationFrameFunc(callback); };
4167ASPx.SetStyles = function(element, styles, makeImportant) {
4168 if(ASPx.IsExists(styles.cssText))
4169  element.style.cssText = styles.cssText;
4170 if(ASPx.IsExists(styles.className)) {
4171  ASPx.SetClassName(element, styles.className);
4172 }
4173 for(var property in styles) {
4174  if(!styles.hasOwnProperty(property))
4175   continue;
4176  var value = styles[property];
4177  switch (property) {
4178   case "cssText":
4179   case "className":
4180    break;
4181   case "float":
4182    ASPx.SetElementFloat(element, value);
4183    break;
4184   case "opacity":
4185    ASPx.SetElementOpacity(element, value);
4186    break;
4187   case "zIndex":
4188    ASPx.SetStylesCore(element, property, value, makeImportant);
4189    break;
4190   default:
4191    ASPx.SetStylesCore(element, property, value + (typeof (value) == "number" ? "px" : ""), makeImportant);
4192  }
4193 }
4194};
4195ASPx.SetStylesCore = function(element, property, value, makeImportant) {
4196 if(makeImportant) {
4197  var index = property.search("[A-Z]");
4198  if(index != -1)
4199   property = property.replace(property.charAt(index), "-" + property.charAt(index).toLowerCase());
4200  if(element.style.setProperty)
4201   element.style.setProperty(property, value, "important");
4202  else 
4203   element.style.cssText += ";" + property + ":" + value + "!important";
4204 }
4205 else
4206  element.style[property] = value;
4207};
4208ASPx.RemoveBordersAndShadows = function(el) {
4209 if(!el || !el.style)
4210  return;
4211 el.style.borderWidth = 0;
4212 if(ASPx.IsExists(el.style.boxShadow))
4213  el.style.boxShadow = "none";
4214 else if(ASPx.IsExists(el.style.MozBoxShadow))
4215  el.style.MozBoxShadow = "none";
4216 else if(ASPx.IsExists(el.style.webkitBoxShadow))
4217  el.style.webkitBoxShadow = "none";
4218};
4219ASPx.GetCellSpacing = function(element) {
4220 var val = parseInt(element.cellSpacing);
4221 if(!isNaN(val)) return val;
4222 val = parseInt(ASPx.GetCurrentStyle(element).borderSpacing);
4223 if(!isNaN(val)) return val;
4224 return 0;
4225};
4226ASPx.GetInnerScrollPositions = function(element) {
4227 var scrolls = [];
4228 getInnerScrollPositionsCore(element, scrolls);
4229 return scrolls;
4230};
4231function getInnerScrollPositionsCore(element, scrolls) {
4232 for(var child = element.firstChild; child; child = child.nextSibling) {
4233  var scrollTop = child.scrollTop,
4234   scrollLeft = child.scrollLeft;
4235  if(scrollTop > 0 || scrollLeft > 0)
4236   scrolls.push([child, scrollTop, scrollLeft]);
4237  getInnerScrollPositionsCore(child, scrolls);
4238 }
4239}
4240ASPx.RestoreInnerScrollPositions = function(scrolls) {
4241 for(var i = 0, scrollArr; scrollArr = scrolls[i]; i++) {
4242  if(scrollArr[1] > 0)
4243   scrollArr[0].scrollTop = scrollArr[1];
4244  if(scrollArr[2] > 0)
4245   scrollArr[0].scrollLeft = scrollArr[2];
4246 }
4247};
4248ASPx.GetOuterScrollPosition = function(element) {
4249 while(element && element.tagName !== "BODY") {
4250  var scrollTop = element.scrollTop,
4251   scrollLeft = element.scrollLeft;
4252  if(scrollTop > 0 || scrollLeft > 0) {
4253   return {
4254    scrollTop: scrollTop,
4255    scrollLeft: scrollLeft,
4256    element: element
4257   };
4258  }
4259  element = element.parentNode;
4260 }
4261 return {
4262  scrollTop: ASPx.GetDocumentScrollTop(),
4263  scrollLeft: ASPx.GetDocumentScrollLeft()
4264 };
4265};
4266ASPx.RestoreOuterScrollPosition = function(scrollInfo) {
4267 if(scrollInfo.element) {
4268  if(scrollInfo.scrollTop > 0)
4269   scrollInfo.element.scrollTop = scrollInfo.scrollTop;
4270  if(scrollInfo.scrollLeft > 0)
4271   scrollInfo.element.scrollLeft = scrollInfo.scrollLeft;
4272 }
4273 else {
4274  if(scrollInfo.scrollTop > 0)
4275   ASPx.SetDocumentScrollTop(scrollInfo.scrollTop);
4276  if(scrollInfo.scrollLeft > 0)
4277   ASPx.SetDocumentScrollLeft(scrollInfo.scrollLeft);
4278 }
4279};
4280ASPx.ChangeElementContainer = function(element, container, savePreviousContainer) {
4281 if(element.parentNode != container) {
4282  var parentNode = element.parentNode;
4283  parentNode.removeChild(element);
4284  container.appendChild(element);
4285  if(savePreviousContainer)
4286   element.previousContainer = parentNode;
4287 }
4288};
4289ASPx.RestoreElementContainer = function(element) {
4290 if(element.previousContainer) {
4291  ASPx.ChangeElementContainer(element, element.previousContainer, false);
4292  element.previousContainer = null;
4293 }
4294};
4295ASPx.MoveChildrenToElement = function(sourceElement, destinationElement){
4296 while(sourceElement.childNodes.length > 0)
4297  destinationElement.appendChild(sourceElement.childNodes[0]);
4298};
4299ASPx.GetScriptCode = function(script) {
4300 var useFirstChildElement = Browser.Chrome && Browser.Version < 11 || Browser.Safari && Browser.Version < 5; 
4301 var text = useFirstChildElement ? script.firstChild.data : script.text;
4302 var comment = "<!--";
4303 var pos = text.indexOf(comment);
4304 if(pos > -1)
4305  text = text.substr(pos + comment.length);
4306 return text;
4307};
4308ASPx.AppendScript = function(script) {
4309 var parent = document.getElementsByTagName("head")[0];
4310 if(!parent)
4311  parent = document.body;
4312 if(parent)
4313  parent.appendChild(script);
4314};
4315function getFrame(frames, name) {
4316 if(frames[name])
4317  return frames[name];
4318 for(var i = 0; i < frames.length; i++) {
4319  try {
4320   var frame = frames[i];
4321   if(frame.name == name) 
4322    return frame; 
4323   frame = getFrame(frame.frames, name);
4324   if(frame != null)   
4325    return frame; 
4326  } catch(e) {
4327  } 
4328 }
4329 return null;
4330}
4331ASPx.IsValidElement = function(element) {
4332 if(!element) 
4333  return false;
4334 if(!(Browser.Firefox && Browser.Version < 4)) {
4335  if(element.ownerDocument && element.ownerDocument.body && element.ownerDocument.body.compareDocumentPosition)
4336   return element.ownerDocument.body.compareDocumentPosition(element) % 2 === 0;
4337 }
4338 if(!Browser.Opera && element.offsetParent && element.parentNode.tagName)
4339  return true;
4340 while(element != null){
4341  if(element.tagName == "BODY")
4342   return true;
4343  element = element.parentNode;
4344 }
4345 return false;
4346};
4347ASPx.IsValidElements = function(elements) {
4348 if(!elements)
4349  return false; 
4350 for(var i = 0; i < elements.length; i++) {
4351  if(elements[i] && !ASPx.IsValidElement(elements[i]))
4352   return false;
4353 }
4354 return true;
4355};
4356ASPx.IsExistsElement = function(element) {
4357 return element && ASPx.IsValidElement(element);
4358};
4359ASPx.CreateHtmlElementFromString = function(str) {
4360 var dummy = ASPx.CreateHtmlElement();
4361 setInnerHtmlInternal(dummy, str);
4362 return dummy.firstChild;
4363};
4364ASPx.CreateHtmlElement = function(tagName, styles) {
4365 var element = document.createElement(tagName || "DIV");
4366 if(styles)
4367  ASPx.SetStyles(element, styles);
4368 return element;
4369};
4370ASPx.RestoreElementOriginalWidth = function(element) {
4371 if(!ASPx.IsExistsElement(element)) 
4372  return;
4373 element.style.width = element.dxOrigWidth = ASPx.GetElementOriginalWidth(element);
4374};
4375ASPx.GetElementOriginalWidth = function(element) {
4376 if(!ASPx.IsExistsElement(element)) 
4377  return null;
4378 var width;
4379 if(!ASPx.IsExists(element.dxOrigWidth)) {
4380  width = String(element.style.width).length > 0
4381   ? element.style.width
4382   : ASPx.GetElementOffsetWidth(element) + "px";
4383 } else {
4384  width = element.dxOrigWidth;
4385 }
4386 return width;
4387};
4388ASPx.DropElementOriginalWidth = function(element) {
4389 if(ASPx.IsExists(element.dxOrigWidth))
4390  element.dxOrigWidth = null;
4391};
4392ASPx.GetObjectKeys = function(obj) {
4393 if(!obj) return [ ];
4394 if(Object.keys)
4395  return Object.keys(obj);
4396 var keys = [ ];
4397 for(var key in obj) {
4398  if(obj.hasOwnProperty(key))
4399   keys.push(key);
4400 }
4401 return keys;
4402};
4403ASPx.ShowErrorAlert = function(message) {
4404 message = ASPx.Str.DecodeHtmlViaTextArea(message);
4405 if(ASPx.IsExists(message) && message !== "")
4406  alert(message);
4407};
4408ASPx.ShowKBErrorMessage = function(text, kbid) {
4409 ASPx.ShowErrorMessage(text + "https://www.devexpress.com/kbid=" + kbid + ".");
4410};
4411ASPx.ShowErrorMessage = function(errorMessage) {
4412 var console = window.console;
4413 if(!console || !ASPx.IsFunction(console.error))
4414  return;
4415 console.error(errorMessage);
4416};
4417ASPx.IsInteractiveControl = function(element, extremeParent) { 
4418 return Data.ArrayIndexOf(["A", "INPUT", "SELECT", "OPTION", "TEXTAREA", "BUTTON", "IFRAME"], element.tagName) > -1;
4419};
4420ASPx.IsUrlContainsClientScript = function(url) {
4421 return url.toLowerCase().indexOf("javascript:") !== -1;
4422};
4423ASPx.GetMSAjaxRequestManager = function() {
4424 if(window.Sys && Sys.WebForms && Sys.WebForms.PageRequestManager && Sys.WebForms.PageRequestManager.getInstance)
4425  return Sys.WebForms.PageRequestManager.getInstance();
4426 return null;
4427};
4428Function.prototype.aspxBind = function(scope) {
4429 var func = this;
4430 return function() {
4431  return func.apply(scope, arguments);
4432 };
4433};
4434var FilteringUtils = { };
4435FilteringUtils.EventKeyCodeChangesTheInput = function(evt) {
4436 if(ASPx.IsPasteShortcut(evt))
4437  return true;
4438 else if(evt.ctrlKey && !evt.altKey)
4439  return false;
4440 if(ASPx.Browser.AndroidMobilePlatform || ASPx.Browser.MacOSMobilePlatform) return true; 
4441 var keyCode = ASPx.Evt.GetKeyCode(evt);
4442 var isSystemKey = ASPx.Key.Windows <= keyCode && keyCode <= ASPx.Key.ContextMenu;
4443 var isFKey = ASPx.Key.F1 <= keyCode && keyCode <= 127; 
4444 return ASPx.Key.Delete <= keyCode && !isSystemKey && !isFKey || keyCode == ASPx.Key.Backspace || keyCode == ASPx.Key.Space;
4445};
4446FilteringUtils.FormatCallbackArg = function(prefix, arg) {
4447 return (ASPx.IsExists(arg) ? prefix + "|" + arg.length + ';' + arg + ';' : "");
4448};
4449ASPx.FilteringUtils = FilteringUtils;
4450var FormatStringHelper = { };
4451FormatStringHelper.PlaceHolderTemplateStruct = function(startIndex, length, index, placeHolderString){
4452 this.startIndex = startIndex;
4453 this.realStartIndex = 0;
4454 this.length = length;
4455 this.realLength = 0;
4456 this.index = index;
4457 this.placeHolderString = placeHolderString;
4458};
4459FormatStringHelper.GetPlaceHolderTemplates = function(formatString){
4460 formatString = this.CollapseDoubleBrackets(formatString);
4461 var templates = this.CreatePlaceHolderTemplates(formatString);
4462 return templates;
4463};
4464FormatStringHelper.CreatePlaceHolderTemplates = function(formatString){
4465 var templates = [];
4466 var templateStrings = formatString.match(/{[^}]+}/g);
4467 if(templateStrings != null){
4468  var pos = 0;
4469  for(var i = 0; i < templateStrings.length; i++){
4470   var tempString = templateStrings[i];
4471   var startIndex = formatString.indexOf(tempString, pos);
4472   var length = tempString.length;
4473   var indexString = tempString.slice(1).match(/^[0-9]+/);
4474   var index = parseInt(indexString);
4475   templates.push(new this.PlaceHolderTemplateStruct(startIndex, length, index, tempString));
4476   pos = startIndex + length;
4477  }
4478 }
4479 return templates;
4480};
4481FormatStringHelper.CollapseDoubleBrackets = function(formatString){
4482 formatString = this.CollapseOpenDoubleBrackets(formatString);
4483 formatString = this.CollapseCloseDoubleBrackets(formatString);
4484 return formatString;
4485};
4486FormatStringHelper.CollapseOpenDoubleBrackets = function(formatString){
4487 return formatString.replace(/{{/g, "_");
4488};
4489FormatStringHelper.CollapseCloseDoubleBrackets = function(formatString){
4490 while(true){
4491  var index = formatString.lastIndexOf("}}");
4492  if(index == -1) 
4493   break;
4494  else
4495   formatString = formatString.substr(0, index) + "_" + formatString.substr(index + 2);
4496 }
4497 return formatString;
4498};
4499ASPx.FormatStringHelper = FormatStringHelper;
4500var StartWithFilteringUtils = { };
4501StartWithFilteringUtils.HighlightSuggestedText = function(input, suggestedText, control, onChangeInput){
4502 if(this.NeedToLockAndoidKeyEvents(control))
4503  control.LockAndroidKeyEvents();
4504 var selInfo = ASPx.Selection.GetInfo(input);
4505 var currentTextLenght = ASPx.Str.GetCoincideCharCount(suggestedText, input.value, 
4506  function(text, filter) { 
4507   return text.indexOf(filter) == 0;
4508  });
4509 var suggestedTextLenght = suggestedText.length;
4510 var isSelected = selInfo.startPos == 0 && selInfo.endPos == currentTextLenght && 
4511  selInfo.endPos == suggestedTextLenght && input.value == suggestedText;
4512 if(!isSelected) { 
4513  input.value = suggestedText;
4514  if(onChangeInput)
4515   onChangeInput();
4516  if(this.NeedToLockAndoidKeyEvents(control)) {
4517   window.setTimeout(function() {
4518    this.SelectText(input, currentTextLenght, suggestedTextLenght);
4519    control.UnlockAndroidKeyEvents();
4520   }.aspxBind(this), control.adroidSamsungBugTimeout);
4521  } else
4522   this.SelectText(input, currentTextLenght, suggestedTextLenght);
4523 }
4524};
4525StartWithFilteringUtils.SelectText = function(input, startPos, stopPos) {
4526 if(startPos < stopPos)
4527  ASPx.Selection.Set(input, startPos, stopPos);
4528};
4529StartWithFilteringUtils.RollbackOneSuggestedChar = function(input){
4530 var currentText = input.value;
4531 var cutText = currentText.slice(0, -1);
4532 if(cutText != currentText)
4533  input.value = cutText;
4534};
4535StartWithFilteringUtils.NeedToLockAndoidKeyEvents = function(control) {
4536 return ASPx.Browser.AndroidMobilePlatform && control && control.LockAndroidKeyEvents;
4537};
4538ASPx.StartWithFilteringUtils = StartWithFilteringUtils;
4539var ContainsFilteringUtils = { };
4540ContainsFilteringUtils.ColumnSelectionStruct = function(index, startIndex, length){
4541 this.index = index;
4542 this.length = length;
4543 this.startIndex = startIndex;
4544};
4545ContainsFilteringUtils.IsFilterCrossPlaseHolder = function(filterStartIndex, filterEndIndex, template) {
4546 var left = Math.max(filterStartIndex, template.realStartIndex);
4547 var right = Math.min(filterEndIndex,  template.realStartIndex + template.realLength);
4548 return left < right;
4549};
4550ContainsFilteringUtils.GetColumnSelectionsForItem = function(itemValues, formatString, filterString) {
4551 if(formatString == "") 
4552  return this.GetSelectionForSingleColumnItem(itemValues, filterString); 
4553 var result = [];
4554 var formatedString = ASPx.Formatter.Format(formatString, itemValues);
4555 var filterStartIndex = ASPx.Str.PrepareStringForFilter(formatedString).indexOf(ASPx.Str.PrepareStringForFilter(filterString));
4556 if(filterStartIndex == -1) return result;
4557 var filterEndIndex = filterStartIndex + filterString.length;
4558 var templates = FormatStringHelper.GetPlaceHolderTemplates(formatString);
4559 this.SupplyTemplatesWithRealValues(itemValues, templates);
4560 for(var i = 0; i < templates.length ; i++) {
4561  if(this.IsFilterCrossPlaseHolder(filterStartIndex, filterEndIndex, templates[i])) 
4562   result.push(this.GetColumnSelectionsForItemValue(templates[i], filterStartIndex, filterEndIndex));
4563 }
4564 return result;
4565};
4566ContainsFilteringUtils.GetColumnSelectionsForItemValue = function(template, filterStartIndex, filterEndIndex) {
4567 var selectedTextStartIndex = filterStartIndex < template.realStartIndex ? 0 :
4568  filterStartIndex - template.realStartIndex;
4569 var selectedTextEndIndex = filterEndIndex >  template.realStartIndex + template.realLength ? template.realLength :
4570  filterEndIndex - template.realStartIndex;
4571 var selectedTextLength = selectedTextEndIndex - selectedTextStartIndex;
4572 return new this.ColumnSelectionStruct(template.index, selectedTextStartIndex, selectedTextLength);
4573};
4574ContainsFilteringUtils.GetSelectionForSingleColumnItem = function(itemValues, filterString) {
4575 var selectedTextStartIndex = ASPx.Str.PrepareStringForFilter(itemValues[0]).indexOf(ASPx.Str.PrepareStringForFilter(filterString));
4576 var selectedTextLength = filterString.length;
4577 return [new this.ColumnSelectionStruct(0, selectedTextStartIndex, selectedTextLength)];
4578};
4579ContainsFilteringUtils.ResetFormatStringIndex = function(formatString, index) {
4580 if(index != 0)
4581  return formatString.replace(index.toString(), "0");
4582 return formatString;
4583};
4584ContainsFilteringUtils.SupplyTemplatesWithRealValues = function(itemValues, templates) {
4585 var shift = 0;
4586 for(var i = 0; i < templates.length; i++) {
4587  var formatString = this.ResetFormatStringIndex(templates[i].placeHolderString, templates[i].index);
4588  var currentItemValue = itemValues[templates[i].index];
4589  templates[i].realLength = ASPx.Formatter.Format(formatString, currentItemValue).length;
4590  templates[i].realStartIndex  += templates[i].startIndex + shift; 
4591  shift += templates[i].realLength - templates[i].placeHolderString.length; 
4592 }
4593};
4594ContainsFilteringUtils.PrepareElementText = function(itemText) {
4595 return itemText ? itemText.replace(/\&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;") : '';
4596};
4597ContainsFilteringUtils.UnselectContainsTextInElement = function(element, selection, highlightTagName) {
4598 var currentText =  ASPx.Attr.GetAttribute (element, "DXText");
4599 if(ASPx.IsExists(currentText)) {
4600  currentText = ContainsFilteringUtils.PrepareElementText(currentText);
4601  ASPx.Security.setInnerHtml(element, currentText === "" ? "&nbsp;" : currentText, ASPx.Security.DataType.Trusted);
4602 }
4603};
4604ContainsFilteringUtils.ReselectContainsTextInElement = function(element, selection, highlightTagName) {
4605 var currentText = ASPx.GetInnerText(element);
4606 if(!highlightTagName)
4607  highlightTagName = "em";
4608 highlightTagName = highlightTagName.toLowerCase();
4609 if(currentText.indexOf("</" + highlightTagName + ">") != -1)
4610  ContainsFilteringUtils.UnselectContainsTextInElement(element, selection, highlightTagName);
4611 return ContainsFilteringUtils.SelectContainsTextInElement(element, selection, highlightTagName);
4612};
4613ContainsFilteringUtils.SelectContainsTextInElement = function(element, selection, highlightTagName) {
4614 if(selection.startIndex == -1)
4615  return;
4616 var currentText =  ASPx.Attr.GetAttribute (element, "DXText");
4617 if(!ASPx.IsExists(currentText)) ASPx.Attr.SetAttribute (element, "DXText", ASPx.GetInnerText(element));
4618 if(!highlightTagName)
4619  highlightTagName = "em";
4620 highlightTagName = highlightTagName.toLowerCase();
4621 var oldInnerText = ASPx.GetInnerText(element);
4622 var newInnerText = ContainsFilteringUtils.PrepareElementText(oldInnerText.substr(0, selection.startIndex)) + "<" + highlightTagName + ">" +
4623      ContainsFilteringUtils.PrepareElementText(oldInnerText.substr(selection.startIndex, selection.length)) + "</" + highlightTagName + ">" +
4624      ContainsFilteringUtils.PrepareElementText(oldInnerText.substr(selection.startIndex + selection.length));
4625 ASPx.Security.setInnerHtml(element, newInnerText, ASPx.Security.DataType.Trusted);
4626};
4627ASPx.ContainsFilteringUtils = ContainsFilteringUtils;
4628ASPx.MakeEqualControlsWidth = function(name1, name2){
4629 var control1 = ASPx.GetControlCollection().Get(name1);
4630 var control2 = ASPx.GetControlCollection().Get(name2);
4631 if(control1 && control2){
4632  var width = Math.max(control1.GetWidth(), control2.GetWidth());
4633  control1.SetWidth(width);
4634  control2.SetWidth(width);
4635 }
4636};
4637ASPx.HighContrastForeColorHighlightColorMap = {
4638 "#ffff00" : "#008000",
4639 "#00ff00" : "#0000ff",
4640 "#ffffff" : "#00838f",
4641 "#000000" : "#a347ff"
4642};
4643var BadgeManagerBase = ASPx.CreateClass(null, {
4644 createBadge: function(text, iconCssClass) {
4645  var badge = document.createElement("SPAN");
4646  ASPx.SetClassName(badge, this.getBadgeClassName());
4647  if(iconCssClass && iconCssClass.length)
4648   this.setBadgeIconCssClass(badge, iconCssClass);
4649  if(text && text.length)
4650   this.setBadgeText(badge, text);
4651  return badge;
4652 },
4653 findBadge: function(element) {
4654  if(!element)
4655   return null;
4656  return element.querySelector("." + this.getBadgeClassName());
4657 },
4658 setBadgeIconCssClass: function(badge, iconCssClass) {
4659  if(!badge || iconCssClass === undefined)
4660   return;
4661  var iconElement = this.getBadgeIconElement(badge);
4662  if(!iconCssClass) {
4663   if(iconElement)
4664    badge.removeChild(iconElement);
4665  }
4666  else {
4667   if(!iconElement) {
4668    iconElement = document.createElement("SPAN");
4669    badge.insertBefore(iconElement, badge.childNodes[0]);
4670   }
4671   ASPx.SetClassName(iconElement, iconCssClass + " " + this.getBadgeIconDefaultClassName());
4672  }
4673 },
4674 getBadgeIconCssClass: function(element) {
4675  var badge = this.findBadge(element);
4676  if(badge) {
4677   var iconElement = this.getBadgeIconElement(badge);
4678   var regEx = new RegExp("(?:^|\\s)" + this.getBadgeIconDefaultClassName() + "(?!\\S)");
4679   return iconElement ? ASPx.Str.Trim(ASPx.GetClassName(iconElement).replace(regEx, "")) : "";
4680  }
4681  return "";
4682 },
4683 setBadgeText: function(badge, text) {
4684  if(!badge || text === undefined)
4685   return;
4686  var textElement = this.getBadgeTextElement(badge);
4687  if(!text) {
4688   if(textElement)
4689    badge.removeChild(textElement);
4690  }
4691  else {
4692   if(!textElement) {
4693    textElement = document.createElement("SPAN");
4694    badge.appendChild(textElement);
4695   }
4696   ASPx.Security.setInnerHtml(textElement, text, ASPx.Security.DataType.Trusted);
4697  }
4698 },
4699 getBadgeText: function(element) {
4700  var badge = this.findBadge(element);
4701  if(badge) {
4702   var textElement = this.getBadgeTextElement(badge);
4703   return textElement ? ASPx.GetInnerText(textElement) : "";
4704  }
4705  return "";
4706 },
4707 getBadgeClassName: function() {
4708  return "";
4709 },
4710 getBadgeIconDefaultClassName: function() {
4711  return "";
4712 },
4713 getBadgeIconElement: function(badge) {
4714  return badge.childNodes.length ? badge.querySelector("." + this.getBadgeIconDefaultClassName()) : null;
4715 },
4716 getBadgeTextElement: function(badge) {
4717  return badge.childNodes.length ? badge.querySelector("span:not(." + this.getBadgeIconDefaultClassName() + ")") : null;
4718 }
4719});
4720ASPx.BadgeManagerBase = BadgeManagerBase;
4721var BadgeManager = ASPx.CreateClass(BadgeManagerBase, {
4722 getBadgeClassName: function() {
4723  return "dxBadge";
4724 },
4725 getBadgeIconDefaultClassName: function() {
4726  return "dxBadgeImage";
4727 },
4728 createBadgeForButton: function(button) {
4729  var badge = ASPx.BadgeManager.createBadge();
4730  var buttonImage = button.GetButtonImage();
4731  var textContainer = button.GetTextContainer();
4732  var badgeRightSibling = !!buttonImage ? buttonImage : textContainer;
4733  badgeRightSibling.parentNode.insertBefore(badge, badgeRightSibling);
4734  if(button.IsLink() && buttonImage)
4735   ASPx.SetStyles(badge, { verticalAlign: "middle" });
4736  return badge;
4737 },
4738 createBadgeForToolbar: function(toolbarItem) {
4739  var badge = ASPx.BadgeManager.createBadge();
4740  var itemImage = toolbarItem.GetImage();
4741  var badgeRightSibling = itemImage;
4742  if(!itemImage) {
4743   var itemContentElement = toolbarItem.menu.GetItemContentElement(toolbarItem.indexPath);
4744   badgeRightSibling = toolbarItem.menu.GetContentTextElement(itemContentElement);
4745  }
4746  badgeRightSibling.parentNode.insertBefore(badge, badgeRightSibling);
4747  return badge;
4748 }
4749});
4750ASPx.BadgeManager = new BadgeManager();
4751var AccessibilityUtils = {
4752 isInitialized: false,
4753 highContrastCssClassMarker: "dxHighContrast",
4754 highContrastBackgroundCssClassMarker: "dxHCB",
4755 highContrastDefaultBackgroundColor: "#a347ff",
4756 highContrastThemeActive: false,
4757 accessibleBackgroundCssMarker: ".dx-runtime-background",
4758 createAccessibleBackgrounds: function(control) {
4759  if(!this.highContrastThemeActive || control.accessibleBackgroundsCreated || !control.accessibilityCompliant)
4760   return;
4761  var className = this.accessibleBackgroundCssMarker;
4762  var styleSheetRuleNames = [];
4763  iterateStyleSheetRules(null, function(rule) {
4764   var selectorTxt = rule.selectorText;
4765   if(selectorTxt && selectorTxt.indexOf(className) > -1)
4766    styleSheetRuleNames.push(ASPx.Str.CompleteReplace(selectorTxt, className, "")); 
4767  });
4768  for(var i = 0; i < styleSheetRuleNames.length; i++) {
4769   var name = styleSheetRuleNames[i];
4770   var rule = ASPx.GetStyleSheetRules(name.substring(1));
4771   if(rule && rule.style && rule.style.backgroundImage)
4772    this.createAccessibleBackground(control.GetMainElement(), rule.style, name);
4773  }
4774  control.accessibleBackgroundsCreated = true;
4775 },
4776 createAccessibleBackground: function(container, style, selector) {
4777  if(!container)
4778   return;
4779  var backgroundUrl = style.backgroundImage.substring(5, style.backgroundImage.length - 2);
4780  var elements = container.querySelectorAll(selector);
4781  var accessibleBackgroundClassName = "dx-acc-bi";
4782  for(var i = 0; i < elements.length; i++) {
4783   var element = elements[i];
4784   if(ASPx.ElementHasCssClass(element, accessibleBackgroundClassName))
4785    continue;
4786   var image = null;
4787   if(element.tagName !== "IMG") {
4788    ASPx.AddClassNameToElement(element, accessibleBackgroundClassName);
4789    image = element.ownerDocument.createElement("IMG");
4790    ASPx.SetStyles(image, { width: "100%", height: "100%" });
4791    if(element.firstChild)
4792     element.insertBefore(image, element.firstChild);
4793    else
4794     element.appendChild(image);
4795   } else
4796    image = element;
4797   image.src = backgroundUrl;
4798  }
4799 },
4800 createHighContrastBackgroundStyle: function() {
4801  var style = document.createElement('style');
4802  ASPx.Attr.AppendStyleType(style);
4803  var styleContent = [
4804   "." + this.highContrastCssClassMarker + " ." + this.highContrastBackgroundCssClassMarker + ":after {",
4805   "border-image: url(" + this.getHighContrastBackgroundUrl() + ") 0 1 0 0 round;",
4806   "}",
4807  ];
4808  setInnerHtmlInternal(style, styleContent.join('\n'));
4809  document.getElementsByTagName('head')[0].appendChild(style);
4810 },
4811 getHighContrastBackgroundUrl: function() {
4812  var canvas = document.createElement("canvas"),
4813  ctx = canvas.getContext('2d');
4814  canvas.width = 1;
4815  canvas.height = 1;
4816  ctx.fillStyle = this.getHighContrastBackgroundColor();
4817  ctx.fillRect(0, 0, canvas.width, canvas.height);
4818  return canvas.toDataURL();
4819 },
4820 getHighContrastBackgroundColor: function() {
4821  var foreColor = ASPx.GetCurrentStyle(document.body).color;
4822  var hexColor = ASPx.Color.ColorToHexadecimal(foreColor);
4823  return ASPx.HighContrastForeColorHighlightColorMap[hexColor] || this.highContrastDefaultBackgroundColor;
4824 },
4825 initialize: function() {
4826  if(this.isInitialized)
4827   return;
4828  this.isInitialized = true;
4829  this.detectHighContrastTheme();
4830  if(this.highContrastThemeActive)
4831   this.createHighContrastBackgroundStyle();
4832 },
4833 detectHighContrastTheme: function() {
4834  var testElement = document.createElement("DIV");
4835  ASPx.SetStyles(testElement, {
4836   backgroundColor: "rgb(255, 255, 255)",
4837   display: "none"
4838  }, true);
4839  var docElement = document.documentElement;
4840  docElement.appendChild(testElement);
4841  var actualBackgroundColor = ASPx.GetCurrentStyle(testElement).backgroundColor;
4842  docElement.removeChild(testElement);
4843  if(actualBackgroundColor === "rgb(0, 0, 0)") {
4844   this.highContrastThemeActive = true;
4845   ASPx.AddClassNameToElement(docElement, this.highContrastCssClassMarker);
4846  }
4847 }
4848};
4849ASPx.AccessibilityUtils = AccessibilityUtils;
4850ASPx.AccessibilityUtils.SendMessageToAssistiveTechnology = function(message) {
4851 var messageParts = ASPx.Ident.IsArray(message) ? message : [message];
4852 var args = new ASPxClientControlBeforePronounceEventArgs(messageParts, null);
4853 ASPx.AccessibilityPronouncer.EnsureInitialize();
4854 ASPx.AccessibilityPronouncer.Pronounce(args, ASPx.AccessibilityPronouncerType.live);
4855};
4856ASPx.AccessibilityUtils.SetFocusAccessible = function(focusableElement) {
4857 if(!focusableElement)
4858  return;
4859 var elementId = focusableElement.id;
4860 if(!elementId) {
4861  var namedParent = ASPx.GetParent(focusableElement, function(element) {
4862   return !!element.id;
4863  });
4864  if(ASPx.IsExists(namedParent))
4865   elementId = namedParent.id;
4866 }
4867 var focusableControl = ASPx.GetClientControlByElementID(elementId);
4868 if(focusableControl && focusableControl.OnAssociatedLabelClick)
4869  focusableControl.OnAssociatedLabelClick(focusableElement);
4870 else
4871  window.setTimeout(function() {
4872   ASPx.AccessibilityUtils.SetFocusAccessibleCore(focusableElement);
4873  }, 0);
4874};
4875ASPx.AccessibilityUtils.SetFocusAccessibleCore = function(focusableElement) {
4876 if(!ASPx.IsExists(focusableElement))
4877  return;
4878 var isTabIndexChanged = ASPx.ControlTabIndexManager.getInstance().isElementWithChangedIndex(focusableElement);
4879 if(isTabIndexChanged)
4880  return;
4881 if(!ASPx.IsValidElement(focusableElement) && focusableElement.id)
4882  focusableElement = ASPx.GetElementById(focusableElement.id);
4883 if(!ASPx.IsActionElement(focusableElement))
4884  focusableElement = ASPx.RestoreFocusHelper.findNeighbourFocusElement(focusableElement, document.body);
4885 if(ASPx.IsExistsElement(focusableElement))
4886  focusableElement.focus();
4887};
4888var Security = {
4889 setInnerHtml: function(el, html, dataType) {
4890  if(!html) {
4891   while(el.firstChild)
4892    ASPx.RemoveElement(el.firstChild);
4893  } else
4894   Security.setData(html, function(d) { ASPx.SetInnerHtml.call(window, el, d); }, dataType);
4895 },
4896 setText: function(control, text, dataType) { Security.setData(text, control.SetText.aspxBind(control), dataType); },
4897 safeEncodeHtml: function(html) { return ASPx.Str.EncodeHtml(ASPx.Str.DecodeHtml(html)); },
4898 setData: function(data, dataSetter, dataType) {
4899  if(dataType === undefined)
4900   throw new Error("Specify the dataType");
4901  if(dataType == Security.DataType.Untrusted)
4902   data = Security.safeEncodeHtml(data);
4903  dataSetter(data);
4904 }
4905};
4906Security.DataType = {
4907 Trusted: 0,
4908 Untrusted: 1
4909};
4910ASPx.EnableCssAnimation = true;
4911var AnimationTransitionBase = ASPx.CreateClass(null, {
4912 constructor: function(element, options) {
4913  if(element) {
4914   AnimationTransitionBase.Cancel(element);
4915   this.element = element;
4916   this.element.aspxTransition = this;
4917  }
4918  this.duration = options.duration || AnimationConstants.Durations.DEFAULT;
4919  this.transition = options.transition || AnimationConstants.Transitions.SINE;
4920  this.property = options.property;
4921  this.unit = options.unit || "";
4922  this.onComplete = options.onComplete;
4923  this.to = null;
4924  this.from = null;
4925 },
4926 Start: function(from, to) {
4927  if(to != undefined) {
4928   this.to = to;
4929   this.from = from;
4930   this.SetValue(this.from);
4931  }
4932  else
4933   this.to = from;
4934 },
4935 Cancel: function() {
4936  if(!this.element)
4937   return;
4938  try {
4939   delete this.element.aspxTransition;
4940  } catch(e) {
4941   this.element.aspxTransition = undefined;
4942  }
4943 },
4944 GetValue: function() {
4945  return this.getValueInternal(this.element, this.property);
4946 },
4947 SetValue: function(value) {
4948  this.setValueInternal(this.element, this.property, this.unit, value);
4949 },
4950 setValueInternal: function(element, property, unit, value) {
4951  if(property == "opacity")
4952   AnimationUtils.setOpacity(element, value);
4953  else
4954   element.style[property] = value + unit;
4955 },
4956 getValueInternal: function(element, property) {
4957  if(property == "opacity")
4958   return ASPx.GetElementOpacity(element);
4959  var value = parseFloat(element.style[property]);
4960  return isNaN(value) ? 0 : value;
4961 },
4962 performOnComplete: function() {
4963  if(this.onComplete)
4964   this.onComplete(this.element);
4965 },
4966 getTransition: function() {
4967  return this.transition;
4968 }
4969});
4970AnimationTransitionBase.Cancel = function(element) {
4971 if(element.aspxTransition)
4972  element.aspxTransition.Cancel();
4973};
4974var AnimationConstants = {};
4975AnimationConstants.Durations = {
4976 SHORT: 200,
4977 DEFAULT: 400,
4978 LONG: 600
4979};
4980AnimationConstants.Transitions = {
4981 LINER: {
4982  Css: "cubic-bezier(0.250, 0.250, 0.750, 0.750)",
4983  Js: function(progress) { return progress; }
4984 },
4985 SINE: {
4986  Css: "cubic-bezier(0.470, 0.000, 0.745, 0.715)",
4987  Js: function(progress) { return Math.sin(progress * 1.57); }
4988 },
4989 POW: {
4990  Css: "cubic-bezier(0.755, 0.050, 0.855, 0.060)",
4991  Js: function(progress) { return Math.pow(progress, 4); }
4992 },
4993 POW_EASE_OUT: {
4994  Css: "cubic-bezier(0.165, 0.840, 0.440, 1.000)",
4995  Js: function(progress) { return 1 - AnimationConstants.Transitions.POW.Js(1 - progress); }
4996 },
4997 RIPPLE: {
4998  Css: "cubic-bezier(0.47, 0.06, 0.23, 0.99)",
4999  Js: function(progress) {
5000   return Math.pow((progress), 3) * 0.47 + 3 * progress * Math.pow((1 - progress), 2) * 0.06 + 3 * Math.pow(progress, 2) *
5001    (1 - progress) * 0.23 + 0.99 * Math.pow(progress, 3);
5002  }
5003 }
5004};
5005var JsAnimationTransition = ASPx.CreateClass(AnimationTransitionBase, {
5006 constructor: function(element, options) {
5007  this.constructor.prototype.constructor.call(this, element, options);
5008  this.onStep = options.onStep;
5009  this.fps = 60;
5010  this.startTime = null;
5011 },
5012 Start: function(from, to) {
5013  if(from == to) {
5014   this.from = this.to = from;
5015   setTimeout(this.complete.aspxBind(this), 0);
5016  }
5017  else {
5018   AnimationTransitionBase.prototype.Start.call(this, from, to);
5019   if(to == undefined)
5020    this.from = this.GetValue();
5021   this.initTimer();
5022  }
5023 },
5024 Cancel: function() {
5025  AnimationTransitionBase.prototype.Cancel.call(this);
5026  if(this.timerId)
5027   clearInterval(this.timerId);
5028 },
5029 initTimer: function() {
5030  this.startTime = new Date();
5031  this.timerId = window.setInterval(function() { this.onTick(); }.aspxBind(this), 1000 / this.fps);
5032 },
5033 onTick: function() {
5034  var progress = (new Date() - this.startTime) / this.duration;
5035  if(progress >= 1)
5036   this.complete();
5037  else {
5038   this.update(progress);
5039   if(this.onStep)
5040    this.onStep();
5041  }
5042 },
5043 update: function(progress) {
5044  this.SetValue(this.gatCalculatedValue(this.from, this.to, progress));
5045 },
5046 complete: function() {
5047  this.Cancel();
5048  this.update(1);
5049  this.performOnComplete();
5050 },
5051 gatCalculatedValue: function(from, to, progress) {
5052  if(progress == 1)
5053   return to;
5054  return from + (to - from) * this.getTransition()(progress);
5055 },
5056 getTransition: function() {
5057  return this.transition.Js;
5058 }
5059});
5060var SimpleAnimationTransition = ASPx.CreateClass(JsAnimationTransition, {
5061 constructor: function(options) {
5062  this.constructor.prototype.constructor.call(this, null, options);
5063  this.transition = options.transition || AnimationConstants.Transitions.POW_EASE_OUT;
5064  this.onUpdate = options.onUpdate;
5065  this.lastValue = 0;
5066 },
5067 SetValue: function(value) {
5068  this.onUpdate(value - this.lastValue);
5069  this.lastValue = value;
5070 },
5071 GetValue: function() {
5072  return this.lastValue;
5073 },
5074 performOnComplete: function() {
5075  if(this.onComplete)
5076   this.onComplete();
5077 }
5078});
5079var MultipleJsAnimationTransition = ASPx.CreateClass(JsAnimationTransition, {
5080 constructor: function(element, options) {
5081  this.constructor.prototype.constructor.call(this, element, options);
5082  this.properties = {};
5083 },
5084 Start: function(properties) {
5085  this.initProperties(properties);
5086  this.initTimer();
5087 },
5088 initProperties: function(properties) {
5089  this.properties = properties;
5090  for(var propName in this.properties)
5091   if(properties[propName].from == undefined)
5092    properties[propName].from = this.getValueInternal(this.element, propName);
5093 },
5094 update: function(progress) {
5095  for(var propName in this.properties) {
5096   if(this.properties.hasOwnProperty(propName)) {
5097    var property = this.properties[propName];
5098    if(property.from != property.to)
5099     this.setValueInternal(this.element, propName, property.unit, this.gatCalculatedValue(property.from, property.to, progress));
5100   }
5101  }
5102 }
5103});
5104var CssAnimationTransition = ASPx.CreateClass(AnimationTransitionBase, {
5105 constructor: function(element, options) {
5106  this.constructor.prototype.constructor.call(this, element, options);
5107  this.transitionPropertyName = AnimationUtils.CurrentTransition.property;
5108  this.eventName = AnimationUtils.CurrentTransition.event;
5109  this.forceTransitionEndByTimer = true;
5110  this.needForceTransitionEndByTimerFlag = options.needForceTransitionEndByTimerFlag;
5111 },
5112 Start: function(from, to) {
5113  this.forceTransitionEndByTimer = true;
5114  AnimationTransitionBase.prototype.Start.call(this, from, to);
5115  this.startTimerId = window.setTimeout(function() {
5116   if(this.from == this.to)
5117    this.onTransitionEnd();
5118   else {
5119    var isHidden = ASPx.GetElementOffsetHeight(this.element) == 0 && ASPx.GetElementOffsetWidth(this.element) == 0; 
5120    if(!isHidden)
5121     this.prepareElementBeforeAnimation();
5122    this.SetValue(this.to);
5123    if(isHidden)
5124     this.onTransitionEnd();
5125   }
5126  }.aspxBind(this), 0);
5127 },
5128 Cancel: function() {
5129  this.forceTransitionEndByTimer = false;
5130  window.clearTimeout(this.startTimerId);
5131  AnimationTransitionBase.prototype.Cancel.call(this);
5132  ASPx.Evt.DetachEventFromElement(this.element, this.eventName, CssAnimationTransition.transitionEnd);
5133  this.setValueInternal(this.element, this.transitionPropertyName, "", "");
5134  this.stopAnimation();
5135 },
5136 prepareElementBeforeAnimation: function() {
5137  ASPx.Evt.AttachEventToElement(this.element, this.eventName, CssAnimationTransition.transitionEnd);
5138  var dummy = this.element.offsetHeight;
5139  this.element.style[this.transitionPropertyName] = this.getTransitionCssString();
5140  if(this.needForceTransitionEndByTimer()) {
5141   setTimeout(function() {
5142    if(this.forceTransitionEndByTimer && this.element && this.element.aspxTransition) {
5143     this.element.style[this.transitionPropertyName] = "";
5144     this.element.aspxTransition.onTransitionEnd();
5145    }
5146   }.aspxBind(this), this.duration + 100);
5147  }
5148 },
5149 needForceTransitionEndByTimer: function() {
5150  if(this.needForceTransitionEndByTimerFlag)
5151   return true;
5152  if(ASPx.Browser.Safari && ASPx.Browser.MacOSMobilePlatform && ASPx.Browser.MajorVersion >= 8) 
5153   return true;
5154  return ASPx.Browser.AndroidMobilePlatform; 
5155 },
5156 stopAnimation: function() {
5157  this.SetValue(ASPx.GetCurrentStyle(this.element)[this.property]);
5158 },
5159 onTransitionEnd: function() {
5160  this.Cancel();
5161  this.performOnComplete();
5162 },
5163 getTransition: function() {
5164  return this.transition.Css;
5165 },
5166 getTransitionCssString: function() {
5167  return this.getTransitionCssStringInternal(this.getCssName(this.property));
5168 },
5169 getTransitionCssStringInternal: function(cssProperty) {
5170  return cssProperty + " " + this.duration + "ms " + this.getTransition();
5171 },
5172 getCssName: function(property) {
5173  switch(property) {
5174   case "marginLeft":
5175    return "margin-left";
5176   case "marginTop":
5177    return "margin-top";
5178  }
5179  return property;
5180 }
5181});
5182var MultipleCssAnimationTransition = ASPx.CreateClass(CssAnimationTransition, {
5183 constructor: function(element, options) {
5184  this.constructor.prototype.constructor.call(this, element, options);
5185  this.properties = null;
5186 },
5187 Start: function(properties) {
5188  this.properties = properties;
5189  this.forEachProperties(function(property, propName) {
5190   if(property.from !== undefined)
5191    this.setValueInternal(this.element, propName, property.unit, property.from);
5192  }.aspxBind(this));
5193  this.prepareElementBeforeAnimation();
5194  window.setTimeout(function() {
5195   this.forEachProperties(function(property, propName) {
5196    this.setValueInternal(this.element, propName, property.unit, property.to);
5197   }.aspxBind(this));
5198  }.aspxBind(this), 0);
5199 },
5200 stopAnimation: function() {
5201  var style = ASPx.GetCurrentStyle(this.element);
5202  this.forEachProperties(function(property, propName) {
5203   this.setValueInternal(this.element, propName, "", style[propName]);
5204  }.aspxBind(this));
5205 },
5206 getTransitionCssString: function() {
5207  var str = "";
5208  this.forEachProperties(function(property, propName) {
5209   str += this.getTransitionCssStringInternal(this.getCssName(propName)) + ",";
5210  }.aspxBind(this));
5211  str = str.substring(0, str.length - 1);
5212  return str;
5213 },
5214 forEachProperties: function(func) {
5215  for(var propName in this.properties) {
5216   if(this.properties.hasOwnProperty(propName)) {
5217    var property = this.properties[propName];
5218    if(property.from == undefined)
5219     property.from = this.getValueInternal(this.element, propName);
5220    if(property.from != property.to)
5221     func(property, propName);
5222   }
5223  }
5224 }
5225});
5226CssAnimationTransition.transitionEnd = function(evt) {
5227 var element = evt.target;
5228 if(element && element.aspxTransition)
5229  element.aspxTransition.onTransitionEnd();
5230};
5231var AnimationUtils = {
5232 CanUseCssTransition: function() { return ASPx.EnableCssAnimation && this.CurrentTransition; },
5233 CanUseCssTransform: function() { return this.CanUseCssTransition() && this.CurrentTransform; },
5234 CurrentTransition: (function() {
5235  var transitions = [
5236   { property: "webkitTransition", event: "webkitTransitionEnd" },
5237   { property: "MozTransition", event: "transitionend" },
5238   { property: "OTransition", event: "oTransitionEnd" },
5239   { property: "transition", event: "transitionend" }
5240  ];
5241  var fakeElement = document.createElement("DIV");
5242  for(var i = 0; i < transitions.length; i++)
5243   if(transitions[i].property in fakeElement.style)
5244    return transitions[i];
5245 })(),
5246 CurrentTransform: (function() {
5247  var transforms = ["transform", "MozTransform", "-webkit-transform", "msTransform", "OTransform"];
5248  var fakeElement = document.createElement("DIV");
5249  for(var i = 0; i < transforms.length; i++)
5250   if(transforms[i] in fakeElement.style)
5251    return transforms[i];
5252 })(),
5253 SetTransformValue: function(element, position, isTop) {
5254  if(this.CanUseCssTransform())
5255   element.style[this.CurrentTransform] = this.GetTransformCssText(position, isTop);
5256  else
5257   element.style[!isTop ? "left" : "top"] = position + "px";
5258 },
5259 GetTransformValue: function(element, isTop) {
5260  if(this.CanUseCssTransform()) {
5261   var cssValue = element.style[this.CurrentTransform];
5262   return cssValue && cssValue != "none" ? Number(cssValue.replace('matrix(1, 0, 0, 1,', '').replace(')', '').split(',')[!isTop ? 0 : 1]) : 0;
5263  }
5264  else
5265   return !isTop ? element.offsetLeft : element.offsetTop;
5266 },
5267 GetTransformCssText: function(position, isTop) {
5268  if(!position)
5269   return "none";
5270  return "matrix(1, 0, 0, 1," + (!isTop ? position : 0) + ", " + (!isTop ? 0 : position) + ")";
5271 },
5272 createMultipleAnimationTransition: function (element, options) {
5273  return this.CanUseCssTransition() && !options.onStep ? new MultipleCssAnimationTransition(element, options) : new MultipleJsAnimationTransition(element, options);
5274 },
5275 createSimpleAnimationTransition: function(options) {
5276  return new SimpleAnimationTransition(options);
5277 },
5278 createJsAnimationTransition: function(element, options) {
5279  return new JsAnimationTransition(element, options);
5280 },
5281 createCssAnimationTransition: function(element, options) {
5282  return new CssAnimationTransition(element, options);
5283 },
5284 setOpacity: function(element, value) {
5285  ASPx.SetElementOpacity(element, value);
5286 }
5287};
5288var AsyncTracker = function() {
5289 var currentToken,
5290  lockedTokens,
5291  onDoneDelegates,
5292  lockedDelegates;
5293 function clearState() {
5294  currentToken = 1;
5295  lockedTokens = [];
5296  onDoneDelegates = [];
5297  lockedDelegates = {};
5298 }
5299 clearState();
5300 var log = function(msg) { };
5301 function setLog(delegate){
5302  log = delegate;
5303 }
5304 function getLockToken() {
5305  if(onDoneDelegates.length === 0)
5306   return -1;
5307  var token = currentToken++;
5308  lockedTokens.push(token);
5309  lockedDelegates[token] = [];
5310  for (var i = 0; i < onDoneDelegates.length; i++) {
5311   lockedDelegates[token].push(onDoneDelegates[i]);
5312  }
5313  log("module locks token " + token);
5314  return token;
5315 }
5316 function releaseToken(token) {
5317  if(token < 0) return;
5318  log("module releasing token " + token);
5319  ASPx.Data.ArrayRemove(lockedTokens, token);
5320  delete lockedDelegates[token];
5321  invokeUnlockedDelegates();
5322  if(lockedTokens.length === 0)
5323   clearState();
5324  log("module released token " + token);
5325 }
5326 function invokeUnlockedDelegates() {
5327  var onDoneDelegate;
5328  for (var i = onDoneDelegates.length - 1; i >= 0; i--) {
5329   if(onDoneDelegates[i] && !isDelegateLocked(onDoneDelegates[i])) {
5330    onDoneDelegate = onDoneDelegates[i];
5331    delete onDoneDelegates[i];
5332    onDoneDelegate();
5333   }
5334  }
5335 }
5336 function isDelegateLocked(delegate) {
5337  for (var i = lockedTokens.length - 1; i >= 0; i--) {
5338   var token = lockedTokens[i];
5339   var delegates = lockedDelegates[token];
5340   if(delegates) {
5341    for (var j = delegates.length - 1; j >= 0; j--) {
5342     if(delegates[j] && delegates[j] === delegate)
5343      return true;
5344    }
5345   }
5346  }
5347  return false;
5348 }
5349 function track(doDelegate, onDoneDelegate) {
5350  if(onDoneDelegate)
5351   onDoneDelegates.push(onDoneDelegate);
5352  doDelegate();
5353  if(onDoneDelegate)
5354   invokeUnlockedDelegates();
5355 }
5356 return {
5357  getLockToken: getLockToken,
5358  releaseToken: releaseToken,
5359  track: track,
5360  setLog:setLog,
5361 };
5362};
5363var GetEditorValuesInContainer = function(containerOrId, processInvisibleEditors, needSerialize) {
5364 var container = typeof(containerOrId) === "string" ? ASPx.GetElementById(containerOrId) : containerOrId;
5365 var result = {};
5366 if(!ASPx.ProcessEditorsInContainer) 
5367  return result;
5368 ASPx.ProcessEditorsInContainer(container, function(editor){
5369  result[editor.name] = GetCorrectedByTypeValue(ASPx.GetEditorValueByControl(editor), needSerialize);
5370  return true;
5371 }, null, null, processInvisibleEditors, false);
5372 return result;
5373};
5374var SetEditorValues = function(values) {
5375 for(var controlName in values) {
5376  if(values.hasOwnProperty(controlName)) {
5377   var trackedControl = ASPxClientControl.GetControlCollection().Get(controlName);
5378   if(!trackedControl)
5379    continue;
5380   var setValueMethod = trackedControl.SetTokenCollection || trackedControl.SelectValues || trackedControl.SetValue;
5381   if(setValueMethod === trackedControl.SelectValues)
5382    trackedControl.UnselectAll();
5383   setValueMethod.call(trackedControl, values[controlName]);
5384  }
5385 }
5386};
5387var GetCorrectedByTypeValue = function(value, needSerialize){
5388 if(ASPx.Ident.IsArray(value))
5389  for(var i = 0; i < value.length; i++)
5390   value[i] = GetCorrectedByTypeValue(value[i]);
5391 if(needSerialize && ASPx.Ident.IsDate(value))
5392  return ASPx.DateUtils.GetInvariantDateTimeString(value);
5393 return value;
5394};
5395var ListBoxTemporaryCache = ASPx.CreateClass(null, {
5396 constructor: function() { 
5397  this.cache = { };
5398  this.invalidateTimerID = -1;
5399 },
5400 Get: function(key, getObjectFunc, context, args) {
5401  if(this.invalidateTimerID < 0) {
5402   this.invalidateTimerID = window.setTimeout(function() {
5403    this.Invalidate();
5404   }.aspxBind(this), 0);
5405  }
5406  if(!ASPx.IsExists(this.cache[key])) {
5407   if(!ASPx.IsExists(args))
5408    args = [ ];
5409   this.cache[key] = getObjectFunc.apply(context, args);
5410  }
5411  return this.cache[key];
5412 },
5413 Invalidate: function() {
5414  this.cache = { };
5415  this.invalidateTimerID = ASPx.Timer.ClearTimer(this.invalidateTimerID);
5416 }
5417});
5418ASPx.GetEditorValueByControl = function(control, needSerialize) {
5419 var result;
5420 if(ASPx.IsMultipleValueOwner(control))
5421  result = control.GetSelectedValues();
5422 if(ASPx.IsTokenBox(control)) {
5423  if(needSerialize)
5424   result = control.GetTokenValuesCollection();
5425  else
5426   result = control.GetTokenCollection();
5427 }
5428 if(ASPx.IsDropDownEdit(control))
5429  result = control.GetKeyValue();
5430 if(ASPx.IsHtmlEditor(control))
5431  result = control.GetHtml();
5432 return result || control.GetValue();
5433};
5434ASPx.IsMultipleValueOwner = function(control) {
5435 return ASPx.IsListBox(control) || ASPx.IsCheckBoxList(control);
5436};
5437ASPx.IsCheckBoxList = function(control) {
5438 return control && typeof(ASPxClientCheckBoxList) != "undefined" && control instanceof ASPxClientCheckBoxList;
5439 };
5440ASPx.IsCheckBox = function(control) {
5441 return control && typeof (ASPxClientCheckBox) != "undefined" && control instanceof ASPxClientCheckBox;
5442};
5443ASPx.IsListBox = function(control) {
5444 return control && typeof(ASPxClientListBox) != "undefined" && control instanceof ASPxClientListBox;
5445};
5446ASPx.IsComboBox = function(control) {
5447 return control && typeof(ASPxClientComboBox) != "undefined" && control instanceof ASPxClientComboBox;
5448};
5449ASPx.IsTokenBox = function(control) {
5450 return control && typeof(ASPxClientTokenBox) != "undefined" && control instanceof ASPxClientTokenBox;
5451};
5452ASPx.IsDropDownEdit = function(control) {
5453 return control && typeof (ASPxClientDropDownEdit) != "undefined" && control instanceof ASPxClientDropDownEdit;
5454};
5455ASPx.IsGridLookup = function(control) {
5456 return control && typeof(MVCxClientGridLookup) != "undefined" && control instanceof MVCxClientGridLookup;
5457};
5458ASPx.IsSpinEdit = function(control) {
5459 return control && typeof(ASPxClientSpinEdit) != "undefined" && control instanceof ASPxClientSpinEdit;
5460};
5461ASPx.IsHtmlEditor = function(control) {
5462 return control && typeof (ASPxClientHtmlEditor) != "undefined" && control instanceof ASPxClientHtmlEditor;
5463};
5464ASPx.DatePickerType = {
5465 Days: 0,
5466 Months: 1,
5467 Years: 2,
5468 Decades: 3
5469};
5470ASPx.FullScreenUtils = {
5471 subscribeChange: function(handler) {
5472  Evt.AttachEventToElement(document, "fullscreenchange", handler);
5473  Evt.AttachEventToElement(document, "msfullscreenchange", handler); 
5474  Evt.AttachEventToElement(document, "MSFullscreenChange", handler); 
5475  Evt.AttachEventToElement(document, "webkitfullscreenchange", handler);
5476  Evt.AttachEventToElement(document, "mozfullscreenchange", handler);
5477 },
5478 unsubscribeChange: function(handler) {
5479  Evt.DetachEventFromElement(document, "fullscreenchange", handler);
5480  Evt.DetachEventFromElement(document, "msfullscreenchange", handler);
5481  Evt.DetachEventFromElement(document, "MSFullscreenChange", handler);
5482  Evt.DetachEventFromElement(document, "webkitfullscreenchange", handler);
5483  Evt.DetachEventFromElement(document, "mozfullscreenchange", handler);
5484 },
5485 setFullscreen: function(on) {
5486  var element = window.self.document.body;
5487  if(on) {
5488   if(element.requestFullscreen) {
5489    element.requestFullscreen();
5490   } else if(element.mozRequestFullScreen) {
5491    element.mozRequestFullScreen();
5492   } else if(element.webkitRequestFullscreen) {
5493    element.webkitRequestFullscreen();
5494   } else if(element.msRequestFullscreen) {
5495    element.msRequestFullscreen();
5496   }
5497  } else {
5498   if(document.exitFullscreen) {
5499    document.exitFullscreen();
5500   } else if(document.mozCancelFullScreen) {
5501    document.mozCancelFullScreen();
5502   } else if(document.webkitCancelFullScreen) {
5503    document.webkitCancelFullScreen();
5504   } else if(document.msExitFullscreen) {
5505    document.msExitFullscreen();
5506   }
5507  }
5508 },
5509 inFullscreen: function() {
5510  var fullscreenElement = document.fullscreenElement || document.msFullscreenElement || document.webkitFullscreenElement;
5511  var isInFullscreen = fullscreenElement === document.body || document.webkitIsFullScreen;
5512  return !!isInFullscreen;
5513 }
5514 };
5515ASPx.InitializeSVGSprite = function () {
5516 if (ASPx.SVGSprites && ASPx.SVGSprites.length > 0) {
5517  var svgContainer = document.getElementById('svgContainer');
5518  var hasSvgContainer = !!svgContainer;
5519  if (!hasSvgContainer) {
5520   svgContainer = document.createElement('div');
5521   svgContainer.id = 'svgContainer';
5522   svgContainer.style.display = "none";
5523   document.body.appendChild(svgContainer);
5524  }
5525  for (var i = 0; i < ASPx.SVGSprites.length; i++) {
5526   svgContainer.innerHTML += ASPx.SVGSprites[i];
5527  }
5528  ASPx.SVGSprites = null;
5529 }
5530};
5531var GridDynamicStyleSheetHelper = ASPx.CreateClass(null, {
5532 constructor: function() {
5533  this.styleSheet = {};
5534  this.rules = {};
5535  this.updateLock = 0;
5536 },
5537 Update: function(control, styleName, rules) {
5538  var key = control.name + "_" + styleName;
5539  this.BeginUpdate(key);
5540  this.ChangeRules(key, rules);
5541  this.EndUpdate(key);
5542 },
5543 ChangeRules: function(key, rules) {
5544  if(key && rules)
5545   this.rules[key] = rules;
5546 },
5547 BeginUpdate: function(key) {
5548  this.updateLock++;
5549  this.RemoveStyleSheetElement(key);
5550 },
5551 EndUpdate: function(key) {
5552  this.updateLock--;
5553  if(this.updateLock !== 0)
5554   return;
5555  var styleArgs = [];
5556  var controlRules = this.rules[key];
5557  for(var i = 0; i < controlRules.length; i++) {
5558   var rule = controlRules[i];
5559   styleArgs.push(rule.selector + " { " + rule.cssText + " } ");
5560  }
5561  this.styleSheet[key] = this.CreateStyleSheet(key, styleArgs.join(""));
5562 },
5563 CreateStyleSheet: function(key, cssText) {
5564  var container = document.createElement("DIV");
5565  ASPx.Security.setInnerHtml(container, "<style type='text/css' id='" + key + "'>" + cssText + "</style>", ASPx.Security.DataType.Trusted);
5566  styleSheet = ASPx.GetNodeByTagName(container, "style", 0);
5567  if(styleSheet)
5568   ASPx.GetNodeByTagName(document, "HEAD", 0).appendChild(styleSheet);
5569  return styleSheet;
5570 },
5571 ClearStyleSheet: function(control, styleName) {
5572  var key = control.name + "_" + styleName;
5573  this.RemoveStyleSheetElement(key);
5574 },
5575 RemoveStyleSheetElement: function(key) {
5576  if(this.styleSheet[key]) {
5577   ASPx.RemoveElement(this.styleSheet[key]);
5578   delete this.styleSheet[key];
5579  }
5580 }
5581});
5582GridDynamicStyleSheetHelper.Instance = new GridDynamicStyleSheetHelper();
5583ASPx.GridDynamicStyleSheetHelper = GridDynamicStyleSheetHelper;
5584ASPxClientUtils = {};
5585ASPxClientUtils.agent = Browser.UserAgent;
5586ASPxClientUtils.opera = Browser.Opera;
5587ASPxClientUtils.opera9 = Browser.Opera && Browser.MajorVersion == 9;
5588ASPxClientUtils.safari = Browser.Safari;
5589ASPxClientUtils.safari3 = Browser.Safari && Browser.MajorVersion == 3;
5590ASPxClientUtils.safariMacOS = Browser.Safari && Browser.MacOSPlatform;
5591ASPxClientUtils.chrome = Browser.Chrome;
5592ASPxClientUtils.ie = Browser.IE;
5593ASPxClientUtils.ie7 = Browser.IE && Browser.MajorVersion == 7;
5594ASPxClientUtils.firefox = Browser.Firefox;
5595ASPxClientUtils.firefox3 = Browser.Firefox && Browser.MajorVersion == 3;
5596ASPxClientUtils.mozilla = Browser.Mozilla;
5597ASPxClientUtils.netscape = Browser.Netscape;
5598ASPxClientUtils.browserVersion = Browser.Version;
5599ASPxClientUtils.browserMajorVersion = Browser.MajorVersion;
5600ASPxClientUtils.macOSPlatform = Browser.MacOSPlatform;
5601ASPxClientUtils.windowsPlatform = Browser.WindowsPlatform;
5602ASPxClientUtils.webKitFamily = Browser.WebKitFamily;
5603ASPxClientUtils.netscapeFamily = Browser.NetscapeFamily;
5604ASPxClientUtils.touchUI = Browser.TouchUI;
5605ASPxClientUtils.webKitTouchUI = Browser.WebKitTouchUI;
5606ASPxClientUtils.msTouchUI = Browser.MSTouchUI;
5607ASPxClientUtils.iOSPlatform = Browser.MacOSMobilePlatform;
5608ASPxClientUtils.androidPlatform = Browser.AndroidMobilePlatform;
5609ASPxClientUtils.ArrayInsert = Data.ArrayInsert;
5610ASPxClientUtils.ArrayRemove = Data.ArrayRemove;
5611ASPxClientUtils.ArrayRemoveAt = Data.ArrayRemoveAt;
5612ASPxClientUtils.ArrayClear = Data.ArrayClear;
5613ASPxClientUtils.ArrayIndexOf = Data.ArrayIndexOf;
5614ASPxClientUtils.AttachEventToElement = Evt.AttachEventToElement;
5615ASPxClientUtils.DetachEventFromElement = Evt.DetachEventFromElement;
5616ASPxClientUtils.GetEventSource = Evt.GetEventSource;
5617ASPxClientUtils.GetEventX = Evt.GetEventX;
5618ASPxClientUtils.GetEventY = Evt.GetEventY;
5619ASPxClientUtils.GetKeyCode = Evt.GetKeyCode;
5620ASPxClientUtils.PreventEvent = Evt.PreventEvent;
5621ASPxClientUtils.PreventEventAndBubble = Evt.PreventEventAndBubble;
5622ASPxClientUtils.PreventDragStart = Evt.PreventDragStart;
5623ASPxClientUtils.ClearSelection = Selection.Clear;
5624ASPxClientUtils.IsExists = ASPx.IsExists;
5625ASPxClientUtils.IsFunction = ASPx.IsFunction;
5626ASPxClientUtils.GetAbsoluteX = ASPx.GetAbsoluteX;
5627ASPxClientUtils.GetAbsoluteY = ASPx.GetAbsoluteY;
5628ASPxClientUtils.SetAbsoluteX = ASPx.SetAbsoluteX;
5629ASPxClientUtils.SetAbsoluteY = ASPx.SetAbsoluteY;
5630ASPxClientUtils.GetDocumentScrollTop = ASPx.GetDocumentScrollTop;
5631ASPxClientUtils.GetDocumentScrollLeft = ASPx.GetDocumentScrollLeft;
5632ASPxClientUtils.GetDocumentClientWidth = ASPx.GetDocumentClientWidth;
5633ASPxClientUtils.GetDocumentClientHeight = ASPx.GetDocumentClientHeight;
5634ASPxClientUtils.AddClassNameToElement = ASPx.AddClassNameToElement;
5635ASPxClientUtils.RemoveClassNameFromElement = ASPx.RemoveClassNameFromElement;
5636ASPxClientUtils.ToggleClassName = ASPx.ToggleClassNameToElement;
5637ASPxClientUtils.GetIsParent = ASPx.GetIsParent;
5638ASPxClientUtils.GetParentById = ASPx.GetParentById;
5639ASPxClientUtils.GetParentByTagName = ASPx.GetParentByTagName;
5640ASPxClientUtils.GetParentByClassName = ASPx.GetParentByPartialClassName;
5641ASPxClientUtils.GetChildById = ASPx.GetChildById;
5642ASPxClientUtils.GetChildByTagName = ASPx.GetChildByTagName;
5643ASPxClientUtils.SetCookie = Cookie.SetCookie;
5644ASPxClientUtils.GetCookie = Cookie.GetCookie;
5645ASPxClientUtils.DeleteCookie = Cookie.DelCookie;
5646ASPxClientUtils.GetShortcutCode = ASPx.GetShortcutCode; 
5647ASPxClientUtils.GetShortcutCodeByEvent = ASPx.GetShortcutCodeByEvent;
5648ASPxClientUtils.StringToShortcutCode = ASPx.ParseShortcutString;
5649ASPxClientUtils.Trim = Str.Trim; 
5650ASPxClientUtils.TrimStart = Str.TrimStart;
5651ASPxClientUtils.TrimEnd = Str.TrimEnd;
5652ASPxClientUtils.GetEditorValuesInContainer = GetEditorValuesInContainer;
5653ASPxClientUtils.SetEditorValues = SetEditorValues;
5654ASPxClientUtils.SendMessageToAssistiveTechnology = ASPx.AccessibilityUtils.SendMessageToAssistiveTechnology;
5655window.ASPxClientUtils = ASPxClientUtils;
5656window.ListBoxTemporaryCache = ListBoxTemporaryCache;
5657ASPx.AnimationUtils = AnimationUtils;
5658ASPx.AnimationTransitionBase = AnimationTransitionBase;
5659ASPx.AnimationConstants = AnimationConstants;
5660ASPx.AsyncTracker = AsyncTracker;
5661ASPx.Security = Security;
5662})(ASPx, dx);
5663
5664(function module(ASPx, options) {
5665ASPx.modules.Classes = module;
5666ASPx.classesScriptParsed = false;
5667ASPx.documentLoaded = false; 
5668ASPx.CallbackType = {
5669 Data: "d",
5670 Common: "c"
5671};
5672ASPx.callbackState = {
5673 aborted: "aborted",
5674 inTurn: "inTurn",
5675 sent: "sent"
5676};
5677var ASPxClientEvent = ASPx.CreateClass(null, {
5678 constructor: function() {
5679  this.handlerInfoList = [];
5680  this.firingIndex = -1;
5681 },
5682 AddHandler: function(handler, executionContext) {
5683  if(typeof(executionContext) == "undefined")
5684   executionContext = null;
5685  this.RemoveHandler(handler, executionContext);
5686  var handlerInfo = ASPxClientEvent.CreateHandlerInfo(handler, executionContext);
5687  this.handlerInfoList.push(handlerInfo);
5688 },
5689 RemoveHandler: function(handler, executionContext) {
5690  this.removeHandlerByCondition(function(handlerInfo) {
5691   return handlerInfo.handler == handler && 
5692    (!executionContext || handlerInfo.executionContext == executionContext);
5693  });
5694 },
5695 removeHandlerByCondition: function(predicate) {
5696   for(var i = this.handlerInfoList.length - 1; i >= 0; i--) {
5697   var handlerInfo = this.handlerInfoList[i];
5698   if(predicate(handlerInfo)) {
5699    ASPx.Data.ArrayRemoveAt(this.handlerInfoList, i);
5700    if(i <= this.firingIndex)
5701     this.firingIndex--;
5702   }
5703  }
5704 },
5705 removeHandlerByControlName: function(controlName) {
5706  this.removeHandlerByCondition(function(handlerInfo) {
5707   return handlerInfo.executionContext &&  
5708    handlerInfo.executionContext.name === controlName;
5709  });
5710 },
5711 ClearHandlers: function() {
5712  this.handlerInfoList.length = 0;
5713 },
5714 FireEvent: function(obj, args) {
5715  for(this.firingIndex = 0; this.firingIndex < this.handlerInfoList.length; this.firingIndex++) {
5716   var handlerInfo = this.handlerInfoList[this.firingIndex];
5717   handlerInfo.handler.call(handlerInfo.executionContext, obj, args);
5718  }
5719 },
5720 InsertFirstHandler: function(handler, executionContext){
5721  if(typeof(executionContext) == "undefined")
5722   executionContext = null;
5723  var handlerInfo = ASPxClientEvent.CreateHandlerInfo(handler, executionContext);
5724  ASPx.Data.ArrayInsert(this.handlerInfoList, handlerInfo, 0);
5725 },
5726 IsEmpty: function() {
5727  return this.handlerInfoList.length == 0;
5728 }
5729});
5730ASPxClientEvent.CreateHandlerInfo = function(handler, executionContext) {
5731 return {
5732  handler: handler,
5733  executionContext: executionContext
5734 };
5735};
5736var ASPxClientEventArgs = ASPx.CreateClass(null, {
5737 constructor: function() {
5738 }
5739});
5740ASPxClientEventArgs.Empty = new ASPxClientEventArgs();
5741var ASPxClientCancelEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
5742 constructor: function(){
5743  this.constructor.prototype.constructor.call(this);
5744  this.cancel = false;
5745 }
5746});
5747var ASPxClientProcessingModeEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
5748 constructor: function(processOnServer){
5749  this.constructor.prototype.constructor.call(this);
5750  this.processOnServer = !!processOnServer;
5751 }
5752});
5753var ASPxClientProcessingModeCancelEventArgs = ASPx.CreateClass(ASPxClientProcessingModeEventArgs, {
5754 constructor: function(processOnServer){
5755  this.constructor.prototype.constructor.call(this, processOnServer);
5756  this.cancel = false;
5757 }
5758});
5759var OrderedMap = ASPx.CreateClass(null, {
5760 constructor: function(){
5761  this.entries = {};
5762  this.firstEntry = null;
5763  this.lastEntry = null;
5764 },
5765 add: function(key, element) {
5766  var entry = this.addEntry(key, element);
5767  this.entries[key] = entry;
5768 },
5769 remove: function(key) {
5770  var entry = this.entries[key];
5771  if(entry === undefined)
5772   return;
5773  this.removeEntry(entry);
5774  delete this.entries[key];
5775 },
5776 clear: function() {
5777  this.markAllEntriesAsRemoved();
5778  this.entries = {};
5779  this.firstEntry = null;
5780  this.lastEntry = null;
5781 },
5782 get: function(key) {
5783  var entry = this.entries[key];
5784  return entry ? entry.value : undefined;
5785 },
5786 forEachEntry: function(processFunc, context) {
5787  context = context || this;
5788  for(var entry = this.firstEntry; entry; entry = entry.next) {
5789   if(entry.removed)
5790    continue;
5791   if(processFunc.call(context, entry.key, entry.value))
5792    return;
5793  }
5794 },
5795 addEntry: function(key, element) {
5796  var entry = { key: key, value: element, next: null, prev: null };
5797  if(!this.firstEntry)
5798   this.firstEntry = entry;
5799  else {
5800   entry.prev = this.lastEntry;
5801   this.lastEntry.next = entry;
5802  }
5803  this.lastEntry = entry;
5804  return entry;
5805 },
5806 removeEntry: function(entry) {
5807  if(this.firstEntry == entry)
5808   this.firstEntry = entry.next;
5809  if(this.lastEntry == entry)
5810   this.lastEntry = entry.prev;
5811  if(entry.prev)
5812   entry.prev.next = entry.next;
5813  if(entry.next)
5814   entry.next.prev = entry.prev;
5815  entry.removed = true;
5816 },
5817 markAllEntriesAsRemoved: function() {
5818  for(var entry = this.firstEntry; entry; entry = entry.next)
5819   entry.removed = true;
5820 }
5821});
5822var CollectionBase = ASPx.CreateClass(null, {
5823 constructor: function(){
5824  this.elementsMap = new OrderedMap();
5825  this.isASPxClientCollection = true;
5826 },
5827 Add: function(key, element) {
5828  this.elementsMap.add(key, element);
5829 },
5830 Remove: function(key) {
5831  this.elementsMap.remove(key);
5832 },
5833 Clear: function(){
5834  this.elementsMap.clear();
5835 },
5836 Get: function(key){
5837  return this.elementsMap.get(key);
5838 }
5839});
5840(function garbageCollector(ASPx, options) {
5841 ASPx.modules.garbageCollector = garbageCollector;
5842 var interval = options.GCCheckInterval;
5843 window.setInterval(collectObjects, interval);
5844 function canCollectObjects() {
5845  if (!ASPx.GetControlCollection) return false;
5846  var collection = ASPx.GetControlCollection();
5847  return collection && !collection.InCallback();
5848 }
5849 function collectObjects() {
5850  if (!canCollectObjects()) return;
5851  ASPx.GetControlCollectionCollection().RemoveDisposedControls();
5852  if(typeof(ASPx.GetStateController) != "undefined")
5853   ASPx.GetStateController().RemoveDisposedItems();
5854  if(ASPx.TableScrollHelperCollection)
5855   ASPx.TableScrollHelperCollection.RemoveDisposedObjects();
5856  if(ASPx.Ident.scripts.ASPxClientRatingControl)
5857   ASPxClientRatingControl.RemoveDisposedElementUnderCursor();
5858  var postHandler = ASPx.GetPostHandler();
5859  if(postHandler)
5860   postHandler.RemoveDisposedFormsFromCache();
5861 }
5862})(ASPx, options);
5863var ControlTree = ASPx.CreateClass(null, {
5864 constructor: function(controlCollection, container, controlFilter) {
5865  this.container = container;
5866  this.domMap = { };
5867  this.rootNode = this.createNode(null, null);
5868  this.createControlTree(controlCollection, container, controlFilter);
5869 },
5870 createControlTree: function(controlCollection, container, controlFilter) {
5871  controlCollection.ProcessControlsInContainer(container, function(control) {
5872   control.RegisterInControlTree(this);
5873  }.aspxBind(this), controlFilter);
5874  var fixedNodes = [];
5875  var fixedNodesChildren = [];
5876  for(var domElementID in this.domMap) {
5877   if(!this.domMap.hasOwnProperty(domElementID)) continue;
5878   var node = this.domMap[domElementID];
5879   var controlOwner = node.control ? node.control.controlOwner : null;
5880   if(controlOwner && this.domMap[controlOwner.name])
5881    continue;
5882   if(this.isFixedNode(node))
5883    fixedNodes.push(node);
5884   else {
5885    var parentNode = this.findParentNode(domElementID);
5886    parentNode = parentNode || this.rootNode;
5887    if(this.isFixedNode(parentNode))
5888     fixedNodesChildren.push(node);
5889    else {
5890     var childNode = node.mainNode || node;
5891     this.addChildNode(parentNode, childNode);
5892    }
5893   }
5894  }
5895  for(var i = fixedNodes.length - 1; i >= 0; i--)
5896   this.insertChildNode(this.rootNode, fixedNodes[i], 0);
5897  for(var i = fixedNodesChildren.length - 1; i >= 0; i--)
5898   this.insertChildNode(this.rootNode, fixedNodesChildren[i], 0);
5899 },
5900 findParentNode: function(id) {
5901  var element = document.getElementById(id).parentNode;
5902  while(element && element.tagName !== "BODY") {
5903   if(element.id) {
5904    var parentNode = this.domMap[element.id];
5905    if(parentNode)
5906     return parentNode;
5907   }
5908   element = element.parentNode;
5909  }
5910  return null;
5911 },
5912 addChildNode: function(node, childNode) {
5913  if(!childNode.parentNode) {
5914   node.children.push(childNode);
5915   childNode.parentNode = node;
5916  }
5917 },
5918 insertChildNode: function(node, childNode, index) {
5919  if(!childNode.parentNode) {
5920   ASPx.Data.ArrayInsert(node.children, childNode, index);
5921   childNode.parentNode = node;
5922  }
5923 },
5924 addRelatedNode: function(node, relatedNode) {
5925  this.addChildNode(node, relatedNode);
5926  relatedNode.mainNode = node;
5927 },
5928 isFixedNode: function(node) {
5929  var control = node.mainNode ? node.mainNode.control : node.control;
5930  return control && control.HasFixedPosition();
5931 },
5932 createNode: function(domElementID, control) {
5933  var node = {
5934   control: control,
5935   children: [],
5936   parentNode: null,
5937   mainNode: null
5938  };
5939  if(domElementID)
5940   this.domMap[domElementID] = node;
5941  return node;
5942 }
5943});
5944var ControlAdjuster = ASPx.CreateClass(null, {
5945 constructor: function() {
5946 },
5947 adjustControlsInHierarchy: function(controlCollection, adjustFunc, container, collapseControls, controlFilter) {
5948  var controlTree = new ASPx.ControlTree(controlCollection, container, controlFilter);
5949  this.adjustControlsInTree(controlTree.rootNode, adjustFunc, container, collapseControls);
5950 },
5951 adjustControlsInTree: function(treeNode, adjustFunc, container, collapseControls) {
5952  var observer = _aspxGetDomObserver();
5953  observer.pause(container, true);
5954  var documentScrollInfo;
5955  if(collapseControls) {
5956   documentScrollInfo = ASPx.GetOuterScrollPosition(document.body);
5957   this.collapseControls(treeNode);
5958  }
5959  var adjustNodes = [], 
5960   autoHeightNodes = [];
5961  var requireReAdjust = this.forEachControlCore(treeNode, collapseControls, adjustFunc, adjustNodes, autoHeightNodes);
5962  if(requireReAdjust)
5963   this.forEachControlsBackward(adjustNodes, collapseControls, adjustFunc);
5964  else {
5965   for(var i = 0, node; node = autoHeightNodes[i]; i++)
5966    node.control.AdjustAutoHeight();
5967  }
5968  if(collapseControls)
5969   ASPx.RestoreOuterScrollPosition(documentScrollInfo);
5970  observer.resume(container, true);
5971 },
5972 forEachControlCore: function(node, collapseControls, processFunc, adju
5972stNodes, autoHeightNodes) {
5973  var requireReAdjust = false,
5974   size, newSize;
5975  if(node.control) {
5976   var checkReadjustment = collapseControls && node.control.IsControlCollapsed() && node.control.CanCauseReadjustment();
5977   if(checkReadjustment)
5978    size = node.control.GetControlPercentMarkerSize(false, true);
5979   if(node.control.IsControlCollapsed() && !node.control.IsExpandableByAdjustment())
5980    node.control.ExpandControl();
5981   node.control.isInsideHierarchyAdjustment = true;
5982   processFunc(node.control);
5983   node.control.isInsideHierarchyAdjustment = false;
5984   if(checkReadjustment) {
5985    newSize = node.control.GetControlPercentMarkerSize(false, true);
5986    requireReAdjust = size.width !== newSize.width;
5987   }
5988   if(node.control.sizingConfig.supportAutoHeight)
5989    autoHeightNodes.push(node);
5990   node.control.ResetControlPercentMarkerSize();
5991  }
5992  for(var childNode, i = 0; childNode = node.children[i]; i++)
5993   requireReAdjust = this.forEachControlCore(childNode, collapseControls, processFunc, adjustNodes, autoHeightNodes) || requireReAdjust;
5994  adjustNodes.push(node);
5995  return requireReAdjust;
5996 },
5997 forEachControlsBackward: function(adjustNodes, collapseControls, processFunc) {
5998  for(var i = 0, node; node = adjustNodes[i]; i++)
5999   this.forEachControlsBackwardCore(node, collapseControls, processFunc);
6000 },
6001 forEachControlsBackwardCore: function(node, collapseControls, processFunc) {
6002  if(node.control)
6003   processFunc(node.control);
6004  if(node.children.length > 1) {
6005   for(var i = 0, childNode; childNode = node.children[i]; i++) {
6006    if(childNode.control)
6007     processFunc(childNode.control);
6008   }
6009  }
6010 },
6011 collapseControls: function(node) {
6012  for(var childNode, i = 0; childNode = node.children[i]; i++)
6013   this.collapseControls(childNode);
6014  if(node.control && node.control.NeedCollapseControl())
6015   node.control.CollapseControl();
6016 }
6017});
6018var controlAdjuster = null;
6019function GetControlAdjuster() {
6020 if(!controlAdjuster)
6021  controlAdjuster = new ControlAdjuster();
6022 return controlAdjuster;
6023}
6024function _aspxFunctionIsInCallstack(currentCallee, targetFunction, depthLimit) {
6025 var candidate = currentCallee;
6026 var depth = 0;
6027 while(candidate && depth <= depthLimit) {
6028  candidate = candidate.caller;
6029  if(candidate == targetFunction)
6030   return true;
6031  depth++;
6032 }
6033 return false;
6034}
6035ASPx.attachToReady(aspxClassesWindowOnLoad);
6036function aspxClassesWindowOnLoad(){
6037 ASPx.documentLoaded = true;
6038 _aspxMoveLinkElements();
6039 _aspxSweepDuplicatedLinks();
6040 ResourceManager.SynchronizeResources();
6041 var externalScriptProcessor = GetExternalScriptProcessor();
6042 if(externalScriptProcessor)
6043  externalScriptProcessor.ShowErrorMessages();
6044 ASPx.AccessibilityUtils.initialize();
6045 ASPx.GetControlCollection().Initialize();
6046 _aspxInitializeScripts();
6047 _aspxInitializeLinks();
6048 _aspxInitializeFocus();
6049 ASPx.GetControlCollection().FinalizeInitialization();
6050}
6051Ident = { };
6052Ident.IsDate = function(obj) {
6053 return obj && obj.constructor == Date;
6054};
6055Ident.IsRegExp = function(obj) {
6056 return obj && obj.constructor === RegExp;
6057};
6058Ident.IsArray = function(obj) {
6059 return obj && obj.constructor == Array;
6060};
6061Ident.IsASPxClientCollection = function(obj) {
6062 return obj && obj.isASPxClientCollection;
6063};
6064Ident.IsASPxClientControl = function(obj) {
6065 return obj && obj instanceof ASPxClientControlBase;
6066};
6067Ident.IsASPxClientEdit = function(obj) {
6068 return obj && obj.isASPxClientEdit;
6069};
6070Ident.IsFocusableElementRegardlessTabIndex = function (element) {
6071 var tagName = element.tagName;
6072 return tagName == "TEXTAREA" || tagName == "INPUT" || tagName == "A" ||
6073  tagName == "SELECT" || tagName == "IFRAME" || tagName == "OBJECT" || tagName == "BUTTON";
6074};
6075Ident.isDialogInvisibleControl = function(control) {
6076 return !!ASPx.Dialog && ASPx.Dialog.isDialogInvisibleControl(control);
6077};
6078Ident.isBatchEditUnusedEditor = function(control) {
6079 return !!ASPx.BatchEditHelper && ASPx.BatchEditHelper.isBatchEditUnusedEditor(control);
6080};
6081Ident.scripts = {};
6082if(ASPx.IsFunction(window.WebForm_InitCallbackAddField)) {
6083 (function() {
6084  var original = window.WebForm_InitCallbackAddField;
6085  window.WebForm_InitCallbackAddField = function(name, value) {
6086   if(typeof(name) == "string" && name)
6087    original.apply(null, arguments);
6088  };
6089 })();
6090}
6091ASPx.FireDefaultButton = function(evt, buttonID) {
6092 if(_aspxIsDefaultButtonEvent(evt, buttonID)) {
6093  var defaultButton = ASPx.GetElementById(buttonID);
6094  if(defaultButton && defaultButton.click) {
6095   if(ASPx.IsFocusable(defaultButton))
6096    defaultButton.focus();
6097   ASPx.Evt.DoElementClick(defaultButton);
6098   ASPx.Evt.PreventEventAndBubble(evt);
6099   return false;
6100  }
6101 }
6102 return true;
6103};
6104function _aspxIsDefaultButtonEvent(evt, defaultButtonID) {
6105 if(evt.keyCode != ASPx.Key.Enter)
6106  return false;
6107 var srcElement = ASPx.Evt.GetEventSource(evt);
6108 if(!srcElement || srcElement.id === defaultButtonID)
6109  return true;
6110 var tagName = srcElement.tagName;
6111 var type = srcElement.type;
6112 return tagName != "TEXTAREA" && tagName != "BUTTON" && tagName != "A" &&
6113  (tagName != "INPUT" || type != "checkbox" && type != "radio" && type != "button" && type != "submit" && type != "reset");
6114}
6115var PostHandler = ASPx.CreateClass(null, {
6116 constructor: function() {
6117  this.Post = new ASPxClientEvent();
6118  this.PostFinalization = new ASPxClientEvent();
6119  this.observableForms = [];
6120  this.dxCallbackTriggers = {};
6121  this.lastSubmitElementName = null;
6122  this.beforeOnSubmit = function() { };
6123  this.ReplaceGlobalPostFunctions();
6124  this.HandleDxCallbackBeginning();
6125  this.HandleMSAjaxRequestBeginning();
6126 },
6127 Update: function() {
6128  this.ReplaceFormsSubmit(true);
6129 },
6130 ProcessPostRequest: function(ownerID, isCallback, isMSAjaxRequest, isDXCallback) {
6131  this.cancelPostProcessing = false;
6132  this.isMSAjaxRequest = isMSAjaxRequest;
6133  if(this.SkipRaiseOnPost(ownerID, isCallback, isDXCallback))
6134   return;
6135  var args = new PostHandlerOnPostEventArgs(ownerID, isCallback, isMSAjaxRequest, isDXCallback);
6136  this.Post.FireEvent(this, args);
6137  this.cancelPostProcessing = args.cancel;
6138  if(!args.cancel)
6139   this.PostFinalization.FireEvent(this, args);
6140 },
6141 SkipRaiseOnPost: function(ownerID, isCallback, isDXCallback) { 
6142  if(!isCallback)
6143   return false;
6144  var dxOwner = isDXCallback && ASPx.GetControlCollection().GetByName(ownerID);
6145  if(dxOwner) {
6146   this.dxCallbackTriggers[dxOwner.uniqueID] = true;
6147   return false;
6148  }
6149  if(this.dxCallbackTriggers[ownerID]) {
6150   this.dxCallbackTriggers[ownerID] = false;
6151   return true;
6152  }
6153  return false;
6154 },
6155 ReplaceGlobalPostFunctions: function() {
6156  if(ASPx.IsFunction(window.__doPostBack))
6157   this.ReplaceDoPostBack();
6158  if(ASPx.IsFunction(window.WebForm_DoCallback))
6159   this.ReplaceDoCallback();
6160  if(ASPx.IsFunction(window.WebForm_ExecuteCallback))
6161   this.ReplaceExecuteCallback();
6162  this.ReplaceFormsSubmit();
6163 },
6164 HandleDxCallbackBeginning: function() {
6165  ASPx.GetControlCollection().BeforeInitCallback.AddHandler(function(s, e) {
6166   aspxRaisePostHandlerOnPost(e.callbackOwnerID, true, false, true); 
6167  });
6168 },
6169 HandleMSAjaxRequestBeginning: function() {
6170  var pageRequestManager = ASPx.GetMSAjaxRequestManager();
6171  if(pageRequestManager != null && Ident.IsArray(pageRequestManager._onSubmitStatements)) {
6172   pageRequestManager._onSubmitStatements.unshift(function() {
6173    var postbackSettings = Sys.WebForms.PageRequestManager.getInstance()._postBackSettings;
6174    var postHandler = aspxGetPostHandler();
6175    aspxRaisePostHandlerOnPost(postbackSettings.asyncTarget, true, true);
6176    return !postHandler.cancelPostProcessing;
6177   });
6178  }
6179 },
6180 ReplaceDoPostBack: function() {
6181  var original = __doPostBack;
6182  __doPostBack = function(eventTarget, eventArgument) {
6183   var postHandler = aspxGetPostHandler();
6184   aspxRaisePostHandlerOnPost(eventTarget);
6185   if(postHandler.cancelPostProcessing)
6186    return;
6187   ASPxClientControl.postHandlingLocked = true;
6188   original(eventTarget, eventArgument);
6189   delete ASPxClientControl.postHandlingLocked;
6190  };
6191 },
6192 ReplaceDoCallback: function() {
6193  var original = WebForm_DoCallback;
6194  WebForm_DoCallback = function(eventTarget, eventArgument, eventCallback, context, errorCallback, useAsync) {
6195   var postHandler = aspxGetPostHandler();
6196   aspxRaisePostHandlerOnPost(eventTarget, true);
6197   if(postHandler.cancelPostProcessing)
6198    return;
6199   return original(eventTarget, eventArgument, eventCallback, context, errorCallback, useAsync);
6200  };
6201 },
6202 ReplaceExecuteCallback: function() {
6203  var original = WebForm_ExecuteCallback;
6204  var handler = this;
6205  WebForm_ExecuteCallback = function(callbackObject) {
6206   var isDxCallback = callbackObject && callbackObject.context && ASPx.GetControlCollection().Get(callbackObject.context) !== null;
6207   ASPx.callbackProcessed = false;
6208   original(callbackObject);
6209   if(ASPx.Browser.Firefox && document.getElementById("__EVENTVALIDATION")) {
6210    var viewStateField = document.getElementById("__VIEWSTATE");
6211    if(viewStateField) {
6212     var response = callbackObject.xmlRequest.responseText;
6213     var separatorIndex = response.indexOf("|");
6214     var validationFieldLength = separatorIndex > 0 ? response.substring(0, separatorIndex) : null;
6215     if(ASPx.IsNumber(validationFieldLength))
6216      viewStateField.value = viewStateField.value; 
6217    }
6218   }
6219   if(isDxCallback && !ASPx.callbackProcessed) {
6220    var request = callbackObject.xmlRequest;
6221    if(handler.HasAppErrorOnCallback(request) && ASPxClientUtils.IsExists(callbackObject.eventCallback))
6222     callbackObject.eventCallback(handler.GetServerErrorText(), callbackObject.context);
6223   }
6224  };
6225 },
6226 HasAppErrorOnCallback: function(request) {
6227  if(!request) return false;
6228  var isServerError = request.status && request.status == 500;
6229  var pattern = /<html[^>]*>([\w|\W]*)<\/html>/im;
6230  var text = request.responseText;
6231  return isServerError && !!text && pattern.test(text);
6232 },
6233 GetServerErrorText: function() {
6234  return "Internal Server Error";
6235 }, 
6236 ReplaceFormsSubmit: function(checkObservableCollection) {
6237  for(var i = 0; i < document.forms.length; i++) { 
6238   var form = document.forms[i];
6239   if(checkObservableCollection && ASPx.Data.ArrayIndexOf(this.observableForms, form) >= 0)
6240    continue;
6241   if(form.submit)
6242    this.ReplaceFormSubmit(form);
6243   this.ReplaceFormOnSumbit(form);
6244   this.observableForms.push(form);
6245  }
6246 },
6247 ReplaceFormSubmit: function(form) {
6248  var originalSubmit = form.submit;
6249  form.submit = function() {
6250   var postHandler = aspxGetPostHandler();
6251   aspxRaisePostHandlerOnPost();
6252   if(postHandler.cancelPostProcessing)
6253    return false;
6254   var callee = arguments.callee;
6255   this.submit = originalSubmit;
6256   var submitResult = this.submit();
6257   this.submit = callee;
6258   return submitResult;
6259  };
6260  form = null;
6261 },
6262 ReplaceFormOnSumbit: function(form) {
6263  var originalSubmit = form.onsubmit;
6264  form.onsubmit = function() {
6265   var postHandler = aspxGetPostHandler();
6266   postHandler.beforeOnSubmit();
6267   if(postHandler.isMSAjaxRequest)
6268    postHandler.isMsAjaxRequest = false;
6269   else
6270    aspxRaisePostHandlerOnPost(postHandler.GetLastSubmitElementName());
6271   if(postHandler.cancelPostProcessing)
6272    return false;
6273   return ASPx.IsFunction(originalSubmit)
6274    ? originalSubmit.apply(this, arguments)
6275    : true;
6276  };
6277  form = null;
6278 },
6279 SetBeforeOnSubmit: function(action) {
6280  this.beforeOnSubmit = action;
6281 },
6282 SetLastSubmitElementName: function(elementName) {
6283  this.lastSubmitElementName = elementName;
6284 },
6285 GetLastSubmitElementName: function() {
6286  return this.lastSubmitElementName;
6287 },
6288 RemoveDisposedFormsFromCache: function(){
6289  for(var i = 0; this.observableForms && i < this.observableForms.length; i++){
6290   var form = this.observableForms[i];
6291   if(!ASPx.IsExistsElement(form)){
6292    ASPx.Data.ArrayRemove(this.observableForms, form);
6293    i--;
6294   }
6295  }
6296 }
6297});
6298function aspxRaisePostHandlerOnPost(ownerID, isCallback, isMSAjaxRequest, isDXCallback) {
6299 if(ASPxClientControl.postHandlingLocked) return;
6300 var postHandler = aspxGetPostHandler();
6301 if(postHandler)
6302  postHandler.ProcessPostRequest(ownerID, isCallback, isMSAjaxRequest, isDXCallback);
6303}
6304var aspxPostHandler;
6305function aspxGetPostHandler() {
6306 if(!aspxPostHandler)
6307  aspxPostHandler = new PostHandler();
6308 return aspxPostHandler;
6309}
6310var PostHandlerOnPostEventArgs = ASPx.CreateClass(ASPxClientCancelEventArgs, {
6311 constructor: function(ownerID, isCallback, isMSAjaxCallback, isDXCallback){
6312  this.constructor.prototype.constructor.call(this);
6313  this.ownerID = ownerID;
6314  this.isCallback = !!isCallback;
6315  this.isDXCallback = !!isDXCallback;
6316  this.isMSAjaxCallback = !!isMSAjaxCallback;
6317 }
6318});
6319var ResourceManager = {
6320 HandlerStr: "DXR.axd?r=",
6321 ResourceHashes: {},
6322 SynchronizeResources: function(method){
6323  if(!method){
6324   method = function(name, resource) { 
6325    this.UpdateInputElements(name, resource); 
6326   }.aspxBind(this);
6327  }
6328  var resources = this.GetResourcesData();
6329  for(var name in resources)
6330   if(resources.hasOwnProperty(name))
6331    method(name, resources[name]);
6332 },
6333 GetResourcesData: function(){
6334  return {
6335   DXScript: this.GetResourcesElementsString(_aspxGetIncludeScripts(), "src", "DXScript"),
6336   DXCss: this.GetResourcesElementsString(_aspxGetLinks(), "href", "DXCss")
6337  };
6338 },
6339 ParseBundleSrc: function(elements, urlAttr){
6340  var timeStamp = "";
6341  var resourceUrlArray = [];
6342  for(var i = 0; i < elements.length; i++) {
6343   var resourceUrl = ASPx.Attr.GetAttribute(elements[i], urlAttr);
6344   if(resourceUrl) {
6345    var pos = resourceUrl.indexOf(this.HandlerStr);
6346    if(pos > -1){
6347     var list = resourceUrl.substr(pos + this.HandlerStr.length);
6348     var ampPos = list.lastIndexOf("-");
6349     if(ampPos > -1) {
6350      timeStamp = list.substr(ampPos);
6351      list = list.substr(0, ampPos);
6352     }
6353     var indexes = list.split(",");
6354     for(var j = 0; j < indexes.length; j++) {
6355      resourceUrlArray.push(indexes[j]);
6356     }
6357    }
6358    else
6359     resourceUrlArray.push(resourceUrl);
6360   }
6361  }
6362  return {
6363   'resourceUrlArray': resourceUrlArray,
6364   'timeStamp': timeStamp
6365  };
6366 },
6367 GetResourceHashes: function (id) {
6368  if (!this.ResourceHashes[id])
6369   this.ResourceHashes[id] = {};
6370  return this.ResourceHashes[id];
6371 },
6372 GetResourcesElementsString: function (elements, urlAttr, id) {
6373  var hash = this.GetResourceHashes(id);
6374  var resourceUrlArray = this.ParseBundleSrc(elements, urlAttr).resourceUrlArray;
6375  for(var i = 0; i < resourceUrlArray.length; i++) {
6376   hash[resourceUrlArray[i]] = resourceUrlArray[i];
6377  }
6378  var array = [];
6379  for(var key in hash)
6380   if(hash.hasOwnProperty(key))
6381    array.push(key);
6382  return array.join(",");
6383 },
6384 GetNewResourcesElementString: function (element, urlAttr, id) {
6385  var originalUrl = ASPx.Attr.GetAttribute(element, urlAttr);
6386  var handlerStrIndex = originalUrl.indexOf(this.HandlerStr);
6387  var dxResources = handlerStrIndex > -1;
6388  if(!dxResources) return element[urlAttr];
6389  var hash = this.GetResourceHashes(id);
6390  var srcInfo = this.ParseBundleSrc([element], urlAttr);
6391  var resourceUrlArray = srcInfo.resourceUrlArray;
6392  var timeStamp = srcInfo.timeStamp;
6393  var newResourceArray = [];
6394  for(var i = 0; i < resourceUrlArray.length; i++) {
6395    if(!hash[resourceUrlArray[i]])
6396    newResourceArray.push(resourceUrlArray[i]);
6397  }
6398  var newResources = "";
6399  if(newResourceArray.length > 0) {
6400   var baseUrl = originalUrl.substr(0, handlerStrIndex);
6401   newResources = baseUrl + this.HandlerStr + newResourceArray.join(",") + timeStamp;
6402  }
6403  return newResources;
6404 },
6405 UpdateInputElements: function(typeName, list){
6406  for(var i = 0; i < document.forms.length; i++){
6407   var inputElement = document.forms[i][typeName];
6408   if(!inputElement)
6409    inputElement = this.CreateInputElement(document.forms[i], typeName);
6410   inputElement.value = list;
6411  }
6412 },
6413 CreateInputElement: function(form, typeName){
6414  var inputElement = ASPx.CreateHiddenField(typeName);
6415  form.appendChild(inputElement);
6416  return inputElement;
6417 }
6418};
6419ASPx.includeScriptPrefix = "dxis_";
6420ASPx.startupScriptPrefix = "dxss_";
6421var includeScriptsCache = {};
6422var createdIncludeScripts = [];
6423var appendedScriptsCount = 0;
6424var callbackOwnerNames = [];
6425var scriptsRestartHandlers = { };
6426function _aspxIsKnownIncludeScript(script) {
6427 return !!includeScriptsCache[script.src];
6428}
6429function _aspxCacheIncludeScript(script) {
6430 includeScriptsCache[script.src] = 1;
6431}
6432function _aspxProcessScriptsAndLinks(ownerName, isCallback) {
6433 if(!ASPx.documentLoaded) return; 
6434 _aspxProcessScripts(ownerName, isCallback);
6435 getLinkProcessor().process();
6436 ASPx.ClearCachedCssRules();
6437}
6438function _aspxGetStartupScripts(container) {
6439 return _aspxGetScriptsCore(ASPx.startupScriptPrefix, container);
6440}
6441function _aspxGetIncludeScripts() {
6442 return _aspxGetScriptsCore(ASPx.includeScriptPrefix);
6443}
6444function _aspxGetScriptsCore(prefix, container) {
6445 var result = [];
6446 var scripts;
6447 if(ASPx.IsExists(container))
6448  scripts = ASPx.GetNodesByTagName(container, "SCRIPT");
6449 else
6450  scripts = document.getElementsByTagName("SCRIPT");
6451 for(var i = 0; i < scripts.length; i++) {
6452  if(scripts[i].id.indexOf(prefix) == 0)
6453   result.push(scripts[i]);
6454 }
6455 return result;
6456}
6457function _aspxIsResourceLink(link) {
6458 if(typeof link !== "string")
6459  link = link.href;
6460 return link.toLowerCase().indexOf(ResourceManager.HandlerStr.toLowerCase()) >= 0;
6461}
6462function _aspxGetLinks(allLinks) {
6463 var result = [];
6464 var links = document.getElementsByTagName("LINK");
6465 for(var i = 0; i < links.length; i++) {
6466  if(allLinks || _aspxIsResourceLink(links[i]))
6467   result.push(links[i]);
6468 }
6469 return result;
6470}
6471function _aspxIsLinksLoaded() {
6472 var links = _aspxGetLinks(true);
6473 for(var i = 0, link; link = links[i]; i++)
6474  if(link.readyState && link.readyState.toLowerCase() == "loading")
6475    return false;
6476 return true;
6477}
6478function _aspxInitializeLinks() {
6479 var links = _aspxGetLinks(true);
6480 for(var i = 0; i < links.length; i++)
6481  links[i].loaded = true; 
6482}
6483var scriptExecutedAttrName = "data-executed";
6484var scriptDelayedExecutionAttrName = "data-dx-delayedeval";
6485ASPx.MarkInnerScriptBlocksAsDelayedExecution = function(scriptsContainer) {
6486 var scripts = scriptsContainer.querySelectorAll("script[id^=" + ASPx.startupScriptPrefix + "]");
6487 for(var i = 0; i < scripts.length; i++)
6488  ASPx.Attr.SetAttribute(scripts[i], scriptDelayedExecutionAttrName, true);
6489};
6490function isScriptExecuted(script) {
6491 return ASPx.Attr.GetAttribute(script, scriptExecutedAttrName);
6492}
6493function markScriptAsExecuted(script) {
6494 if(ASPx.Attr.GetAttribute(script, scriptDelayedExecutionAttrName))
6495  ASPx.Attr.RemoveAttribute(script, scriptDelayedExecutionAttrName);
6496 else
6497  ASPx.Attr.SetAttribute(script, scriptExecutedAttrName, true);
6498}
6499function _aspxInitializeScripts() {
6500 var scripts = _aspxGetIncludeScripts();
6501 for(var i = 0; i < scripts.length; i++)
6502  _aspxCacheIncludeScript(scripts[i]);   
6503 var startupScripts = _aspxGetStartupScripts();
6504 for(var i = 0; i < startupScripts.length; i++)
6505  markScriptAsExecuted(startupScripts[i]);
6506}
6507function _aspxSweepDuplicatedLinks() {
6508 var hash = { };
6509 var links = _aspxGetLinks();
6510 for(var i = 0; i < links.length; i++) {
6511  var href = links[i].href;
6512  if(!href)
6513   continue;
6514  if(hash[href]){
6515   if(!hash[href].loaded && links[i].loaded) {
6516    ASPx.RemoveElement(hash[href]);
6517    hash[href] = links[i];
6518   }
6519   else
6520    ASPx.RemoveElement(links[i]);
6521  }
6522  else
6523   hash[href] = links[i];
6524 }
6525}
6526function _aspxSweepDuplicatedScripts() {
6527 var hash = { };
6528 var scripts = _aspxGetIncludeScripts();
6529 for(var i = 0; i < scripts.length; i++) {
6530  var src = scripts[i].src;
6531  if(!src) continue;
6532  if(hash[src])
6533   ASPx.RemoveElement(scripts[i]);
6534  else
6535   hash[src] = scripts[i];
6536 }
6537}
6538function _aspxAreScriptsEqual(script1, script2) {
6539 return script1.src == script2.src;
6540}
6541function _aspxProcessScripts(ownerName, isCallback) {
6542 var scripts = _aspxGetIncludeScripts();
6543 var previousCreatedScript = null;
6544 var firstCreatedScript = null;
6545 for(var i = 0; i < scripts.length; i++) {
6546  var script = scripts[i];
6547  if(script.src == "") continue; 
6548  if(_aspxIsKnownIncludeScript(script))
6549   continue;
6550  var getOnlyNewResources = true;
6551  var onlyNewScripts = ResourceManager.GetNewResourcesElementString(script, "src", "DXScript", getOnlyNewResources);
6552  if (onlyNewScripts == "")
6553   continue;
6554  var createdScript = document.createElement("script");
6555  ASPx.Attr.AppendScriptType(createdScript);
6556  createdScript.src = onlyNewScripts;
6557  createdScript.id = script.id;
6558  if(ASPx.Data.ArrayIndexOf(createdIncludeScripts, createdScript, _aspxAreScriptsEqual) >= 0)
6559   continue;
6560  createdIncludeScripts.push(createdScript);
6561  ASPx.RemoveElement(script);
6562  if(ASPx.Browser.Edge || ASPx.Browser.WebKitFamily || (ASPx.Browser.Firefox && ASPx.Browser.Version >= 4) || ASPx.Browser.IE) {
6563   createdScript.onload = new Function("ASPx.OnScriptLoadCallback(this, " + isCallback + ");");
6564   if(firstCreatedScript == null)
6565    firstCreatedScript = createdScript;
6566   createdScript.nextCreatedScript = null;
6567   if(previousCreatedScript != null)
6568    previousCreatedScript.nextCreatedScript = createdScript;
6569   previousCreatedScript = createdScript;
6570  } else {
6571   createdScript.onload = new Function("ASPx.OnScriptLoadCallback(this);");
6572   ASPx.AppendScript(createdScript);
6573   _aspxCacheIncludeScript(createdScript);
6574  }
6575 }
6576 if(firstCreatedScript != null) {
6577  ASPx.AppendScript(firstCreatedScript);
6578  _aspxCacheIncludeScript(firstCreatedScript);
6579 }
6580 if(isCallback)
6581  callbackOwnerNames.push(ownerName);
6582 if(createdIncludeScripts.length == 0) {
6583  var newLinks = ASPx.GetNodesByTagName(document.body, "link");
6584  var needProcessLinks = isCallback && newLinks.length > 0;
6585  if(needProcessLinks)
6586   needProcessLinks = getLinkProcessor().addLinks(newLinks);
6587  if(!needProcessLinks)
6588   ASPx.FinalizeScriptProcessing(isCallback);
6589 }
6590}
6591ASPx.FinalizeScriptProcessing = function(isCallback) {
6592 createdIncludeScripts = [];
6593 appendedScriptsCount = 0;
6594 var linkProcessor = getLinkProcessor();
6595 if(linkProcessor.hasLinks())
6596  _aspxSweepDuplicatedLinks();
6597 linkProcessor.reset();
6598 _aspxSweepDuplicatedScripts();
6599 ResourceManager.SynchronizeResources();
6600 _aspxRunStartupScripts(isCallback);
6601};
6602var startupScriptsRunning = false;
6603function _aspxRunStartupScripts(isCallback, container) {
6604 startupScriptsRunning = true;
6605 try {
6606  _aspxRunStartupScriptsCore(container);
6607 }
6608 finally {
6609  startupScriptsRunning = false;
6610 }
6611 if(ASPx.documentLoaded) {
6612  ASPx.GetControlCollection().ProcessActionByPredicate(
6613   function(collection) { collection.InitializeElements(isCallback); },
6614   function(control) { return !ASPx.IsExists(container) || ASPx.GetIsParent(container, control.GetMainElement()); }
6615  );
6616  for(var key in scriptsRestartHandlers)
6617   if(scriptsRestartHandlers.hasOwnProperty(key))
6618    scriptsRestartHandlers[key]();
6619  if(isCallback)
6620   _aspxRunEndCallbackScript();
6621 }
6622}
6623function _aspxIsStartupScriptsRunning(isCallback) {
6624 return startupScriptsRunning;
6625}
6626function _aspxRunStartupScriptsCore(container) {
6627 var scripts = _aspxGetStartupScripts(container);
6628 var code;
6629 for(var i = 0; i < scripts.length; i++){
6630  var script = scripts[i];
6631  if(!isScriptExecuted(script)) {
6632   _aspxEnsureStartupScriptIsUnique(script.id); 
6633   code = ASPx.GetScriptCode(script);
6634   eval(code);
6635   markScriptAsExecuted(script);
6636  }
6637 }
6638}
6639function _aspxEnsureStartupScriptIsUnique(scriptId) {
6640 if(!scriptId)
6641  return;
6642 var scriptExecutedSelector = "script[" + scriptExecutedAttrName + "='true']#" + scriptId;
6643 ASPx.RemoveElement(document.querySelector(scriptExecutedSelector));
6644}
6645function _aspxRunEndCallbackScript() {
6646 while(callbackOwnerNames.length > 0) {
6647  var callbackOwnerName = callbackOwnerNames.pop();
6648  var callbackOwner = ASPx.GetControlCollection().Get(callbackOwnerName);
6649  if(callbackOwner)
6650   callbackOwner.DoEndCallback();
6651 }
6652}
6653ASPx.RunStartupScriptsCreatedOnClient = function(container) {
6654 _aspxRunStartupScriptsCore(container);
6655};
6656ASPx.OnScriptReadyStateChangedCallback = function(scriptElement, isCallback) {
6657 if(scriptElement.readyState == "loaded") {
6658  _aspxCacheIncludeScript(scriptElement);
6659  for(var i = 0; i < createdIncludeScripts.length; i++) {
6660   var script = createdIncludeScripts[i];
6661   if(_aspxIsKnownIncludeScript(script)) {
6662    if(!isScriptExecuted(script)) {
6663     markScriptAsExecuted(script);
6664     ASPx.AppendScript(script);
6665     appendedScriptsCount++;
6666    }
6667   } else
6668    break;
6669  }
6670  if(createdIncludeScripts.length == appendedScriptsCount)
6671   ASPx.FinalizeScriptProcessing(isCallback);
6672 }
6673};
6674ASPx.OnScriptLoadCallback = function(scriptElement, isCallback) {
6675 appendedScriptsCount++;
6676 if(scriptElement.nextCreatedScript) {
6677  ASPx.AppendScript(scriptElement.nextCreatedScript);
6678  _aspxCacheIncludeScript(scriptElement.nextCreatedScript);
6679 }
6680 if(createdIncludeScripts.length == appendedScriptsCount)
6681  ASPx.FinalizeScriptProcessing(isCallback);
6682};
6683function _aspxAddScriptsRestartHandler(objectName, handler) {
6684 scriptsRestartHandlers[objectName] = handler;
6685}
6686function _aspxMoveLinkElements() {
6687 var head = ASPx.GetNodesByTagName(document, "head")[0];
6688 var bodyLinks = ASPx.GetNodesByTagName(document.body, "link");
6689 if(head && bodyLinks.length > 0){
6690  var headLinks = ASPx.GetNodesByTagName(head, "link");
6691  var dxLinkAnchor = head.firstChild;
6692  for(var i = 0; i < headLinks.length; i++){
6693   if(_aspxIsResourceLink(headLinks[i]))
6694    dxLinkAnchor = headLinks[i].nextSibling;
6695  }
6696  while(bodyLinks.length > 0) 
6697   head.insertBefore(bodyLinks[0], dxLinkAnchor);
6698 }
6699}
6700var LinkProcessor = ASPx.CreateClass(null, {
6701 constructor: function() {
6702  this.linkInfos = [];
6703  this.loadingObservationTimerID = -1;
6704 },
6705 process: function() {
6706  if(this.hasLinks()) {
6707   if(this.isLinkLoadEventSupported())
6708    this.processViaLoadEvent();
6709   else
6710    this.processViaTimer();
6711  }
6712  else
6713   _aspxSweepDuplicatedLinks();
6714  _aspxMoveLinkElements();
6715 },
6716 addLinks: function(links) {
6717  var prevLinkCount = this.linkInfos.length;
6718  for(var i = 0; i < links.length; i++) {
6719   var link = links[i];
6720   if(link.loaded || link.rel != "stylesheet" || !_aspxIsResourceLink(link))
6721    continue;
6722   var linkInfo = {
6723    link: link,
6724    href: link.href
6725   };
6726   this.linkInfos.push(linkInfo);
6727  }
6728  return prevLinkCount != this.linkInfos.length;
6729 },
6730 hasLinks: function() {
6731  return this.linkInfos.length > 0;
6732 },
6733 reset: function() {
6734  this.linkInfos = [];
6735 },
6736 processViaLoadEvent: function() {
6737  for(var i = 0, linkInfo; linkInfo = this.linkInfos[i]; i++)
6738   linkInfo.link.onload = this.onLinkLoad.bind(this);
6739 },
6740 isLinkLoadEventSupported: function() {
6741  return !(ASPx.Browser.Chrome && ASPx.Browser.MajorVersion < 19 || ASPx.Browser.Firefox && ASPx.Browser.MajorVersion < 9 ||
6742   ASPx.Browser.Safari && ASPx.Browser.MajorVersion < 6 || ASPx.Browser.AndroidDefaultBrowser && ASPx.Browser.MajorVersion < 4.4);
6743 },
6744 processViaTimer: function() {
6745  if(this.loadingObservationTimerID == -1)
6746   this.onLinksLoadingObserve();
6747 },
6748 onLinksLoadingObserve: function() {
6749  if(this.getIsAllLinksLoaded()) {
6750   this.loadingObservationTimerID = -1;
6751   this.onAllLinksLoad();
6752  }
6753  else
6754   this.loadingObservationTimerID = window.setTimeout(this.onLinksLoadingObserve.aspxBind(this), 100);
6755 },
6756 getIsAllLinksLoaded: function() {
6757  var styleSheets = document.styleSheets;
6758  var loadedLinkHrefs = { };
6759  for(var i = 0; i < styleSheets.length; i++) {
6760   var styleSheet = styleSheets[i];
6761   try {
6762    if(styleSheet.cssRules)
6763     loadedLinkHrefs[styleSheet.href] = 1;
6764   }
6765   catch(ex) { }
6766  }
6767  var loadedLinksCount = 0;
6768  for(var i = 0, linkInfo; linkInfo = this.linkInfos[i]; i++) {
6769   if(loadedLinkHrefs[linkInfo.href])
6770    loadedLinksCount++;
6771  }
6772  return loadedLinksCount == this.linkInfos.length;
6773 },
6774 onAllLinksLoad: function() {
6775  this.reset();
6776  _aspxSweepDuplicatedLinks();
6777  if(createdIncludeScripts.length == 0)
6778   ASPx.FinalizeScriptProcessing(true);
6779 },
6780 onLinkReadyStateChanged: function(linkElement) {
6781  if(linkElement.readyState == "complete")
6782   this.onLinkLoadCore(linkElement);
6783 },
6784 onLinkLoad: function(evt) {
6785  var linkElement = ASPx.Evt.GetEventSource(evt);
6786  this.onLinkLoadCore(linkElement);
6787 },
6788 onLinkLoadCore: function(linkElement) {
6789  var linkInfo = this.getLinkInfo(linkElement);
6790  if(!linkInfo) return;
6791  linkInfo.loaded = true;
6792  var notLoadedLinks = this.linkInfos.filter(function(info) { return !info.loaded; });
6793  if(notLoadedLinks.length == 0)
6794   this.onAllLinksLoad();
6795 },
6796 getLinkInfo: function(linkElement) {
6797  for(var i = 0, linkInfo; linkInfo = this.linkInfos[i]; i++) {
6798   if(linkInfo.link == linkElement)
6799    return linkInfo;
6800  }
6801 }
6802});
6803var linkProcessor = null;
6804function getLinkProcessor() {
6805 if(linkProcessor == null)
6806  linkProcessor = new LinkProcessor();
6807 return linkProcessor;
6808}
6809ASPx.LinkProcessor = LinkProcessor;
6810var IFrameHelper = ASPx.CreateClass(null, {
6811 constructor: function(params) {
6812  this.params = params || {};
6813  this.params.src = this.params.src || "";
6814  this.CreateElements();
6815 },
6816 CreateElements: function() {
6817  var elements = IFrameHelper.Create(this.params);
6818  this.containerElement = elements.container;
6819  this.iframeElement = elements.iframe;
6820  this.AttachOnLoadHandler(this, this.iframeElement);
6821  this.SetLoading(true);
6822  if(this.params.onCreate)
6823   this.params.onCreate(this.containerElement, this.iframeElement);
6824 },
6825 AttachOnLoadHandler: function(instance, element) {
6826  ASPx.Evt.AttachEventToElement(element, "load", function() {
6827   instance.OnLoad(element);
6828  });
6829 },
6830 OnLoad: function(element) {
6831  this.SetLoading(false, element);
6832  if(!element.preventCustomOnLoad && this.params.onLoad)
6833   this.params.onLoad();
6834 },
6835 IsLoading: function(element) {
6836  element = element || this.iframeElement;
6837  if(element)
6838   return element.loading;
6839  return false;
6840 },
6841 SetLoading: function(value, element) {
6842  element = element || this.iframeElement;
6843  if(element)
6844   element.loading = value;
6845 },
6846 GetContentUrl: function() {
6847  return this.params.src;
6848 },
6849 SetContentUrl: function(url, preventBrowserCaching) {
6850  if(url) {
6851   this.params.src = url;
6852   if(preventBrowserCaching)
6853    url = IFrameHelper.AddRandomParamToUrl(url);
6854   this.SetLoading(true);
6855   this.iframeElement.src = url;
6856  }
6857 },
6858 RefreshContentUrl: function() {
6859  if(this.IsLoading())
6860   return;
6861  this.SetLoading(true);
6862  var oldContainerElement = this.containerElement;
6863  var oldIframeElement = this.iframeElement;
6864  var postfix = "_del" + Math.floor(Math.random()*100000).toString();
6865  if(this.params.id)
6866   oldIframeElement.id = this.params.id + postfix;
6867  if(this.params.name)
6868   oldIframeElement.name = this.params.name + postfix;
6869  ASPx.SetStyles(oldContainerElement, { height: 0 });
6870  this.CreateElements();
6871  oldIframeElement.preventCustomOnLoad = true;
6872  oldIframeElement.src = ASPx.BlankUrl;
6873  window.setTimeout(function() {
6874   oldContainerElement.parentNode.removeChild(oldContainerElement);
6875  }, 10000); 
6876 }
6877});
6878IFrameHelper.Create = function(params) {
6879 var iframeHtmlStringParts = [ "<iframe frameborder='0'" ];
6880 if(params) {
6881  if(params.id)
6882   iframeHtmlStringParts.push(" id='", params.id, "'");
6883  if(params.name)
6884   iframeHtmlStringParts.push(" name='", params.name, "'");
6885  if(params.title)
6886   iframeHtmlStringParts.push(" title='", params.title, "'");
6887  if(params.scrolling)
6888   iframeHtmlStringParts.push(" scrolling='", params.scrolling, "'");
6889  if(params.src)
6890   iframeHtmlStringParts.push(" src='", params.src, "'");
6891 }
6892 iframeHtmlStringParts.push("></iframe>");
6893 var containerElement = ASPx.CreateHtmlElementFromString("<div style='border-width: 0px; padding: 0px; margin: 0px'></div>");
6894 var iframeElement = ASPx.CreateHtmlElementFromString(iframeHtmlStringParts.join(""));
6895 containerElement.appendChild(iframeElement);
6896 return {
6897  container: containerElement,
6898  iframe: iframeElement
6899 };
6900};
6901IFrameHelper.AddRandomParamToUrl = function(url) {
6902 var prefix = url.indexOf("?") > -1
6903  ? "&"
6904  : "?";
6905 var param = prefix + Math.floor(Math.random()*100000).toString();
6906 var anchorIndex = url.indexOf("#");
6907 return anchorIndex == -1
6908  ? url + param
6909  : url.substr(0, anchorIndex) + param + url.substr(anchorIndex);
6910};
6911IFrameHelper.GetWindow = function(name) {
6912 var frameElement = document.getElementById(name);
6913 return (frameElement != null) ? frameElement.contentWindow : null;
6914};
6915IFrameHelper.GetDocument = function(name) {
6916 var frameElement = document.getElementById(name);
6917 return (frameElement != null) ? frameElement.contentDocument : null;
6918};
6919IFrameHelper.GetDocumentBody = function(name) {
6920 var doc = IFrameHelper.GetDocument(name);
6921 return (doc != null) ? doc.body : null;
6922};
6923IFrameHelper.GetDocumentHead = function (name) {
6924 var doc = IFrameHelper.GetDocument(name);
6925 return (doc != null) ? doc.head || doc.getElementsByTagName('head')[0] : null;
6926};
6927IFrameHelper.GetElement = function(name) {
6928 return document.getElementById(name);
6929};
6930var KbdHelper = ASPx.CreateClass(null, {
6931 constructor: function(control) {
6932  this.control = control;
6933  this.ready = false;
6934  this.clickHandler = this.HandleClick.bind(this);
6935  this.focusHandler = this.onElementFocus.bind(this);
6936  this.blurHandler = this.onBlur.bind(this);
6937 },
6938 Init: function() {
6939  if(!this.ready){
6940   KbdHelper.GlobalInit();
6941   var elements = this.getFocusableElements();
6942   for(var i = 0; i < elements.length; i++) {
6943    var element = elements[i];
6944    element.tabIndex = Math.max(element.tabIndex, 0);
6945    ASPx.Evt.AttachEventToElement(element, "click", this.clickHandler);
6946    ASPx.Evt.AttachEventToElement(element, "focus", this.focusHandler);
6947    ASPx.Evt.AttachEventToElement(element, "blur", this.blurHandler);
6948   }
6949   this.ready = true;
6950  }
6951 },
6952 Dispose: function() {
6953  if(this.ready) {
6954   var elements = this.getFocusableElements();
6955   for(var i = 0; i < elements.length; i++) {
6956    var element = elements[i];
6957    element.tabIndex = -1;
6958    ASPx.Evt.DetachEventFromElement(element, "click", this.clickHandler);
6959    ASPx.Evt.DetachEventFromElement(element, "focus", this.focusHandler);
6960    ASPx.Evt.DetachEventFromElement(element, "blur", this.blurHandler);
6961   }
6962   this.ready = false;
6963  }
6964 },
6965 onElementFocus: function(e) {
6966  if(!this.CanFocus(e))
6967   return true;
6968  KbdHelper.active = this;
6969 },
6970 getFocusableElements: function() {
6971  return [this.GetFocusableElement()]; 
6972 },
6973 GetFocusableElement: function() { return this.control.GetMainElement(); },
6974 canHandleNoFocusAction: function() { 
6975  var focusableElements = this.getFocusableElements();
6976  for(var i = 0; i < focusableElements.length; i++) {
6977   if(focusableElements[i] === _aspxGetFocusedElement())
6978    return false;
6979  }
6980  return true;
6981 },
6982 RequirePreventScrollOnFocus: function() { return false; },
6983 CanFocus: function(e) {
6984  var tag = ASPx.Evt.GetEventSource(e).tagName;
6985  return !(tag === "A" || tag === "TEXTAREA" || tag === "INPUT" || tag === "SELECT" || tag === "IFRAME" || tag === "OBJECT");
6986 },
6987 HandleClick: function(e) {
6988  if(!this.CanFocus(e))
6989   return;
6990  this.Focus();
6991 },
6992 Focus: function() {
6993  var preventScroll = this.RequirePreventScrollOnFocus();
6994  var savedDocumentScrollTop = preventScroll ? ASPx.GetDocumentScrollTop() : -1;
6995  try {
6996   this.GetFocusableElement().focus({ preventScroll: preventScroll });
6997  } catch(e) { }
6998  if(preventScroll && !this.IsNativePreventScrollOnFocusSupported() && savedDocumentScrollTop !== ASPx.GetDocumentScrollTop())
6999   ASPx.SetDocumentScrollTop(savedDocumentScrollTop);
7000 },
7001 IsNativePreventScrollOnFocusSupported: function() {
7002  if(this.isNativePreventScrollOnFocusSupported === undefined)
7003   this.isNativePreventScrollOnFocusSupported = this.CalcIsNativePreventScrollOnFocusSupported();
7004  return this.isNativePreventScrollOnFocusSupported;
7005 },
7006 CalcIsNativePreventScrollOnFocusSupported: function() {
7007  var result = false;
7008  try {
7009   ASPx.GetActiveElement().focus(Object.defineProperty({}, "preventScroll", { get: function() { result = true; } }));
7010  } catch(e) { result = false; }
7011  return result;
7012 },
7013 onBlur: function(){
7014  delete KbdHelper.active;
7015 },
7016 HandleKeyDown: function(e) { }, 
7017 HandleKeyPress: function(e) { }, 
7018 HandleKeyUp: function (e) { },
7019 HandleNoFocusAction: function(e) { },
7020 FocusByAccessKey: function () { }
7021});
7022KbdHelper.GlobalInit = function() {
7023 if(KbdHelper.ready)
7024  return;
7025 ASPx.Evt.AttachEventToDocument("keydown", KbdHelper.OnKeyDown);
7026 ASPx.Evt.AttachEventToDocument("keypress", KbdHelper.OnKeyPress);
7027 ASPx.Evt.AttachEventToDocument("keyup", KbdHelper.OnKeyUp);
7028 KbdHelper.ready = true; 
7029};
7030KbdHelper.swallowKey = false;
7031KbdHelper.accessKeys = { };
7032KbdHelper.ProcessKey = function(e, actionName) {
7033 if(!KbdHelper.active) 
7034  return;
7035 if (KbdHelper.active.canHandleNoFocusAction()) {
7036  KbdHelper.active["HandleNoFocusAction"](e, actionName);
7037  return;
7038 }
7039 var ctl = KbdHelper.active.control;
7040 if(ctl !== ASPx.GetControlCollection().Get(ctl.name)) {
7041  delete KbdHelper.active;
7042  return;
7043 }
7044 if(!KbdHelper.swallowKey) 
7045  KbdHelper.swallowKey = KbdHelper.active[actionName](e);
7046 if(KbdHelper.swallowKey)
7047  ASPx.Evt.PreventEvent(e);
7048};
7049KbdHelper.OnKeyDown = function(e) {
7050 KbdHelper.swallowKey = false;
7051 if(KbdHelper.TryAccessKey(KbdHelper.getKeyName(e)))
7052  ASPx.Evt.PreventEvent(e);
7053 else 
7054  KbdHelper.ProcessKey(e, "HandleKeyDown"); 
7055};
7056KbdHelper.OnKeyPress = function(e) { KbdHelper.ProcessKey(e, "HandleKeyPress"); };
7057KbdHelper.OnKeyUp = function(e) { KbdHelper.ProcessKey(e, "HandleKeyUp"); };
7058KbdHelper.RegisterAccessKey = function(obj) {
7059 var key;
7060 if(obj.accessKey)
7061  key = "CtrlShift" + obj.accessKey;
7062 else if(obj.keyTipModeShortcut)
7063  key = obj.keyTipModeShortcut;
7064 if(!key) return;
7065 KbdHelper.accessKeys[key.toLowerCase()] = obj.name;
7066};
7067KbdHelper.TryAccessKey = function(code) {
7068 var key = code.toLowerCase ? code.toLowerCase() : String.fromCharCode(code).toLowerCase();
7069 var name = KbdHelper.accessKeys[key];
7070 if(!name) return false;
7071 var obj = ASPx.GetControlCollection().Get(name);
7072 return KbdHelper.ClickAccessKey(obj);
7073};
7074KbdHelper.ClickAccessKey = function (control) {
7075 if (!control) return false;
7076 var el = control.GetMainElement();
7077 if (!el) return false;
7078 el.focus();
7079 setTimeout(function () {
7080  if (KbdHelper.active && KbdHelper.active.FocusByAccessKey)
7081   KbdHelper.active.FocusByAccessKey();
7082 }.aspxBind(this), ASPx.FOCUS_TIMEOUT);
7083 return true;
7084};
7085KbdHelper.getKeyName = function(e) {
7086 var name = "";
7087 if(e.altKey)
7088  name += "Alt";
7089 if(e.ctrlKey)
7090  name += "Ctrl";
7091 if(e.shiftKey)
7092  name += "Shift";
7093 var keyCode = e.key || e.code || String.fromCharCode(ASPx.Evt.GetKeyCode(e));
7094 if(keyCode.match(/key/i))
7095  name += keyCode.replace(/key/i, "");
7096 else if(keyCode.match(/digit/i))
7097  name += keyCode.replace(/digit/i, "");
7098 else if(keyCode.match(/arrow/i))
7099  name += keyCode.replace(/arrow/i, "");
7100 else if(keyCode.match(/ins/i))
7101  name += "Ins";
7102 else if(keyCode.match(/del/i))
7103  name += "Del";
7104 else if(keyCode.match(/back/i))
7105  name += "Back";
7106 else if(!keyCode.match(/alt/i) && !keyCode.match(/control/i) && !keyCode.match(/shift/i))
7107  name += keyCode;
7108 return name.replace(/^a-zA-Z0-9/, "");
7109};
7110AccessKeysHelper = ASPx.CreateClass(KbdHelper, {
7111 constructor: function (control) {
7112  this.constructor.prototype.constructor.call(this, control);
7113  this.accessKeysVisible = false;
7114  this.activeKey = null;
7115  this.accessKey = control.createAccessKey ? control.createAccessKey(control.accessKey) : new AccessKey(control.accessKey);
7116  this.accessKeys = this.accessKey.accessKeys;
7117  this.charIndex = 0;
7118  this.onFocusByAccessKey = null;
7119  this.onClose = null;
7120  this.manualStopProcessing = false;
7121  this.isActive = false;
7122  this.areAccessKeysShown = false;
7123 },
7124 Init: function (control) {
7125  KbdHelper.prototype.Init.call(this);
7126  KbdHelper.RegisterAccessKey(control);   
7127 },
7128 Add: function (accessKey) {
7129  this.accessKey.Add(accessKey);
7130 },
7131 HandleKeyDown: function (e) {
7132  var keyCode = ASPx.Evt.GetKeyCode(e);
7133  var stopProcessing = this.processKeyDown(keyCode);
7134  if (stopProcessing.value) {
7135   this.stopProcessing();
7136   if(this.onClosedOnEscape && (keyCode == ASPx.Key.Esc || stopProcessing.fireEvent))
7137    this.onClosedOnEscape();
7138  }
7139  return stopProcessing;
7140 },
7141 HandleNoFocusAction: function (e, actionName) {
7142  var keyCode = ASPx.Evt.GetKeyCode(e);
7143  if (this.onClosedOnEscape && keyCode == ASPx.Key.Esc && actionName == "HandleKeyDown")
7144   this.onClosedOnEscape();
7145 },
7146 Activate: function () {
7147  KbdHelper.ClickAccessKey(this.control);
7148  this.areAccessKeysShown = true;
7149 },
7150 Stop: function() {
7151  this.stopProcessing();
7152 },
7153 stopProcessing: function () {
7154  this.HideAccessKeys();
7155  if (KbdHelper.active && this.isActive) {
7156   this.isActive = false;
7157   KbdHelper.active.control.GetMainElement().blur();
7158   delete KbdHelper.active;
7159  }
7160 },
7161 onBlur: function() {
7162  if (this.manualStopProcessing) {
7163   this.manualStopProcessing = false;
7164   return;
7165  }
7166  this.HideAccessKeys();
7167  KbdHelper.prototype.onBlur.call(this);
7168 },
7169 processKeyDown: function (keyCode) {
7170  switch (keyCode) {
7171   case ASPx.Key.Left:
7172    this.TryMoveFocusLeft();
7173    return { value: false };
7174   case ASPx.Key.Right:
7175    this.TryMoveFocusRight();
7176    return { value: false };
7177   case ASPx.Key.Esc:
7178    if(this.control.hideAllPopups)
7179     this.control.hideAllPopups(true, true);
7180    if(this.activeKey)
7181     this.activeKey = this.activeKey.Return();
7182    this.charIndex = 0;
7183    if (!this.activeKey)
7184     return { value: true };
7185    break;
7186   case ASPx.Key.Enter:
7187    return { value: true };
7188   default:
7189    if (!ASPx.IsPrintableKey(keyCode))
7190     return { value: false };
7191    var char = String.fromCharCode(keyCode).toUpperCase();
7192    var needToContinue = { value: false };
7193    var keyResult;
7194    if(this.activeKey)
7195     keyResult = this.activeKey.TryAccessKey(char, this.charIndex, needToContinue);
7196    if (needToContinue.value) {
7197     this.charIndex++;
7198     return { value: false };
7199    }
7200    this.charIndex = 0;
7201    if(keyResult !== undefined)
7202     this.activeKey = keyResult;
7203    else
7204     return { value: true, fireEvent: true };
7205    if (!this.activeKey || !this.activeKey.accessKeys || this.activeKey.accessKeys.length == 0) {
7206     if (this.activeKey && this.activeKey.manualStopProcessing) {
7207      this.manualStopProcessing = true;
7208      break;
7209     }
7210     return { value: true, fireEvent: true };
7211    }
7212  }
7213  return { value: false };
7214 },
7215 TryMoveFocusLeft: function (modifier) {},
7216 TryMoveFocusRight: function (modifier) {},
7217 TryMoveFocusUp: function (modifier) {},
7218 TryMoveFocusDown: function (modifier) {},
7219 FocusByAccessKey: function() {
7220  if (this.onFocusByAccessKey)
7221   this.onFocusByAccessKey();
7222  this.HideAccessKeys();
7223  KbdHelper.prototype.FocusByAccessKey.call(this);
7224  this.activeKey = this.accessKey;
7225  this.activeKey.execute();
7226  this.isActive = true;
7227  this.areAccessKeysShown = true;
7228 },
7229 HideAccessKeys: function() {
7230  this.areAccessKeysShown = false;
7231  this.hideAccessKeys(this.accessKey);
7232 },
7233 Update: function() {
7234  this.throttleMethod(this.refresh, 100);
7235 },
7236 refresh: function() {
7237  if(this.activeKey && this.areAccessKeysShown) {
7238   this.activeKey.execute();
7239  }
7240 },
7241 throttleMethod: function(method, delay) {
7242  clearTimeout(method.timerId);
7243  method.timerId = setTimeout(function() {
7244   method.call(this);
7245  }.aspxBind(this), delay);
7246 },
7247 AreAccessKeysShown: function() {
7248  return this.areAccessKeysShown;
7249 },
7250 hideAccessKeys: function (accessKey) {
7251  for (var i = 0, ak; ak = accessKey.accessKeys[i]; i++) {
7252   this.hideAccessKeys(ak);
7253  }
7254  if (accessKey)
7255   accessKey.hide();
7256 },
7257 HandleClick: function(e) {
7258  KbdHelper.prototype.HandleClick.call(this, e);
7259  this.stopProcessing();
7260 }
7261});
7262AccessKey = ASPx.CreateClass(null, {
7263 constructor: function (popupItem, getPopupElement, keyTipElement, key, onlyClick, manualStopProcessing) {
7264  this.key = key ? key : keyTipElement ? ASPxClientUtils.Trim(ASPx.GetInnerText(keyTipElement)) : null;
7265  this.popupItem = popupItem;
7266  this.getPopupElement = getPopupElement;
7267  this.keyTipElement = keyTipElement;
7268  this.accessKeys = [];
7269  this.needShowChilds = true;
7270  this.parent = null;
7271  this.onlyClick = onlyClick;
7272  this.manualStopProcessing = manualStopProcessing;
7273 },
7274 Add: function (accessKey) {
7275  this.accessKeys.push(accessKey);
7276  accessKey.parent = this;
7277 },
7278 TryAccessKey: function (char, index, needToContinue) {
7279  if (!this.accessKeys || this.accessKeys.length == 0)
7280   return;
7281  for (var i = 0, accessKey; accessKey = this.accessKeys[i]; i++) {
7282   if (accessKey.key[index] == char && accessKey.isVisible()) {
7283    if (accessKey.key[index + 1]) {
7284     needToContinue.value = true;
7285    }
7286    else {
7287     accessKey.execute();
7288     return accessKey;
7289    }
7290   } else {
7291    accessKey.hide();
7292   }
7293  }
7294  for (var i = 0, accessKey; accessKey = this.accessKeys[i]; i++) {
7295   var key = accessKey.TryAccessKey(char, index, needToContinue);
7296   if (key)
7297    return key;
7298  }
7299  return;
7300 },
7301 isVisible: function(){
7302  return ASPx.GetElementVisibility(this.keyTipElement);
7303 },
7304 Return: function () {
7305  this.hideChildAccessKeys();
7306  if (this.parent) {
7307   this.parent.showAccessKeys(true);
7308  }  
7309  return this.parent;
7310 },
7311 execute: function () {
7312  this.hideAll();
7313  if (this.popupItem && this.popupItem.accessKeyClick && !this.onlyClick)
7314   this.popupItem.accessKeyClick();
7315  if (this.getPopupElement && this.onlyClick)
7316   ASPx.Evt.EmulateMouseClick(this.getPopupElement(this.popupItem));
7317  if (this.accessKeys)
7318   setTimeout(function () {
7319    this.showAccessKeys(true);
7320   }.aspxBind(this), 100);
7321 },
7322 showAccessKeys: function(directShow) {
7323  if (!directShow && !this.needShowChilds)
7324   return;
7325  for (var i = 0; i < this.accessKeys.length; i++) {
7326   var accessKey = this.accessKeys[i];
7327   if (accessKey) {
7328    var popupElement = accessKey.getPopupElement ? accessKey.getPopupElement(accessKey.popupItem) : null;
7329    if (popupElement && this.isElementVisible(popupElement)) {
7330     this.show(accessKey);
7331    }
7332    accessKey.showAccessKeys();
7333   }
7334  }
7335 },
7336 isElementVisible: function (el) { return ASPx.IsElementVisible(el, true); },
7337 show: function(accessKey) {
7338  var keyTipElement = accessKey.keyTipElement;
7339  var popupElement = accessKey.getPopupElement(accessKey.popupItem);
7340  this.showKeyTipElement(keyTipElement, this.calculateCoordinates(accessKey, keyTipElement, popupElement));
7341 },
7342 showKeyTipElement: function (keyTipElement, coordinates) {
7343  ASPx.SetAbsoluteY(keyTipElement, coordinates.top);
7344  ASPx.SetAbsoluteX(keyTipElement, coordinates.left);
7345  ASPx.SetElementVisibility(keyTipElement, true); 
7346 },
7347 calculateCoordinates: function (accessKey, keyTipElement, popupElement) {
7348  var top = ASPx.GetAbsolutePositionY(popupElement);
7349  var left = ASPx.GetAbsolutePositionX(popupElement);
7350  if (accessKey.popupItem.getAccessKeyPosition)
7351   switch (accessKey.popupItem.getAccessKeyPosition()) {
7352    case "AboveRight":
7353     left = left + popupElement.offsetWidth - keyTipElement.offsetWidth / 3;
7354     top = top - keyTipElement.offsetHeight / 2;
7355     break;
7356    case "Right":
7357     left = left + popupElement.offsetWidth - keyTipElement.offsetWidth / 3;
7358     top = top + popupElement.offsetHeight / 2 - keyTipElement.offsetHeight / 2;
7359     break;
7360    case "BelowRight":
7361     left = left + popupElement.offsetWidth - keyTipElement.offsetWidth / 3;
7362     top = top + keyTipElement.offsetHeight / 2;
7363     break;
7364    default:
7365     top = top + popupElement.offsetHeight;
7366     left = left + popupElement.offsetWidth / 2 - keyTipElement.offsetWidth / 2;
7367     break;
7368   }
7369  else {
7370   top = top + popupElement.offsetHeight;
7371   left = left + popupElement.offsetWidth / 2 - keyTipElement.offsetWidth / 2;
7372  }
7373  return { top: top, left: left };
7374 },
7375 hide: function() {
7376  if (this.keyTipElement)
7377   ASPx.SetElementVisibility(this.keyTipElement, false);
7378 },
7379 hideChildAccessKeys: function () {
7380  this.hideAccessKeys(this.accessKeys);
7381 },
7382 hideAccessKeys: function (accessKeys) {
7383  if (accessKeys) {
7384   for (var i = 0, accessKey; accessKey = accessKeys[i]; i++) {
7385    if (accessKey.keyTipElement)
7386     accessKey.hide();
7387    accessKey.hideChildAccessKeys();
7388   }
7389  }
7390 },
7391 hideAll: function () {
7392  this.getRoot(this).hideChildAccessKeys();
7393 },
7394 getRoot: function (accessKey) {
7395  if (!accessKey.parent)
7396   return accessKey;
7397  return this.getRoot(accessKey.parent);
7398 }
7399});
7400var focusedElement = null;
7401function aspxOnElementFocused(evt) {
7402 evt = ASPx.Evt.GetEvent(evt);
7403 if(evt && evt.target)
7404  focusedElement = evt.target;
7405}
7406function _aspxInitializeFocus() {
7407 if(!ASPx.GetActiveElement())
7408  ASPx.Evt.AttachEventToDocument("focus", aspxOnElementFocused);
7409}
7410function _aspxGetFocusedElement() {
7411 var activeElement = ASPx.GetActiveElement();
7412 return activeElement ? activeElement : focusedElement;
7413}
7414CheckBoxCheckState = {
7415 Checked : "Checked",
7416 Unchecked : "Unchecked",
7417 Indeterminate : "Indeterminate"
7418};
7419CheckBoxInputKey = { 
7420 Checked : "C",
7421 Unchecked : "U",
7422 Indeterminate : "I"
7423};
7424var CheckableElementStateController = ASPx.CreateClass(null, {
7425 constructor: function(imageProperties) {
7426  this.checkBoxStates = [];
7427  this.imageProperties = imageProperties;
7428  this.customImageMarkerClassName = "dxcbCI";
7429 },
7430 GetValueByInputKey: function(inputKey) {
7431  return this.GetFirstValueBySecondValue("Value", "StateInputKey", inputKey);
7432 },
7433 GetInputKeyByValue: function(value) {
7434  return this.GetFirstValueBySecondValue("StateInputKey", "Value", value);
7435 },
7436 GetImagePropertiesNumByInputKey: function(value) {
7437  return this.GetFirstValueBySecondValue("ImagePropertiesNumber", "StateInputKey", value);
7438 },
7439 GetNextCheckBoxValue: function(currentValue, allowGrayed) {
7440  var currentInputKey = this.GetInputKeyByValue(currentValue);
7441  var nextInputKey = '';
7442  switch(currentInputKey) {
7443   case CheckBoxInputKey.Checked:
7444    nextInputKey = CheckBoxInputKey.Unchecked; break;
7445   case CheckBoxInputKey.Unchecked:
7446    nextInputKey = allowGrayed ? CheckBoxInputKey.Indeterminate : CheckBoxInputKey.Checked; break;
7447   case CheckBoxInputKey.Indeterminate:
7448    nextInputKey = CheckBoxInputKey.Checked; break;
7449  }
7450  return this.GetValueByInputKey(nextInputKey);
7451 },
7452 GetCheckStateByInputKey: function(inputKey) {
7453  switch(inputKey) {
7454   case CheckBoxInputKey.Checked: 
7455    return CheckBoxCheckState.Checked;
7456   case CheckBoxInputKey.Unchecked: 
7457    return CheckBoxCheckState.Unchecked;
7458   case CheckBoxInputKey.Indeterminate: 
7459    return CheckBoxCheckState.Indeterminate;
7460  }
7461 },
7462 GetValueByCheckState: function(checkState) {
7463  switch(checkState) {
7464   case CheckBoxCheckState.Checked: 
7465    return this.GetValueByInputKey(CheckBoxInputKey.Checked);
7466   case CheckBoxCheckState.Unchecked: 
7467    return this.GetValueByInputKey(CheckBoxInputKey.Unchecked);
7468   case CheckBoxCheckState.Indeterminate: 
7469    return this.GetValueByInputKey(CheckBoxInputKey.Indeterminate);
7470  }
7471 },
7472 GetFirstValueBySecondValue: function(firstValueName, secondValueName, secondValue) {
7473  return this.GetValueByFunc(firstValueName, 
7474   function(checkBoxState) { return checkBoxState[secondValueName] === secondValue; });
7475 },
7476 GetValueByFunc: function(valueName, func) {
7477  for(var i = 0; i < this.checkBoxStates.length; i++) {
7478   if(func(this.checkBoxStates[i]))
7479    return this.checkBoxStates[i][valueName];
7480  }  
7481 },
7482 AssignElementClassName: function(element, cssClassPropertyKey, disabledCssClassPropertyKey, assignedClassName) {
7483  var classNames = [ ];
7484  for(var i = 0; i < this.imageProperties[cssClassPropertyKey].length; i++) {
7485   classNames.push(this.imageProperties[disabledCssClassPropertyKey][i]);
7486   classNames.push(this.imageProperties[cssClassPropertyKey][i]);
7487  }
7488  var elementClassName = element.className;
7489  for(var i = 0; i < classNames.length; i++) {
7490   var className = classNames[i];
7491   var index = elementClassName.indexOf(className);
7492   if(index > -1)
7493    elementClassName = elementClassName.replace((index == 0 ? '' : ' ') + className, "");
7494  }
7495  elementClassName += " " + assignedClassName;
7496  element.className = elementClassName;
7497 },
7498 UpdateInternalCheckBoxDecoration: function(mainElement, inputKey, enabled) {
7499  var imagePropertiesNumber = this.GetImagePropertiesNumByInputKey(inputKey);
7500  for(var imagePropertyKey in this.imageProperties) {
7501   if(this.imageProperties.hasOwnProperty(imagePropertyKey)) {
7502    var propertyValue = this.imageProperties[imagePropertyKey][imagePropertiesNumber];
7503    propertyValue = propertyValue || !isNaN(propertyValue) ? propertyValue : "";
7504    switch(imagePropertyKey) {
7505     case "0" : mainElement.title = propertyValue; break;
7506     case "1" : mainElement.style.width = propertyValue + (propertyValue != "" ? "px" : ""); break;
7507     case "2" : mainElement.style.height = propertyValue + (propertyValue != "" ? "px" : ""); break;
7508    }
7509    if(enabled) {
7510     switch(imagePropertyKey) {
7511      case "3" : this.SetImageSrc(mainElement, propertyValue); break;
7512      case "4" : 
7513       this.AssignElementClassName(mainElement, "4", "8", propertyValue);
7514       break;
7515      case "5" : this.SetBackgroundPosition(mainElement, propertyValue, true); break;
7516      case "6" : this.SetBackgroundPosition(mainElement, propertyValue, false); break;
7517     }
7518    } else {
7519     switch(imagePropertyKey) {
7520      case "7" : this.SetImageSrc(mainElement, propertyValue); break;
7521      case "8" : 
7522       this.AssignElementClassName(mainElement, "4", "8", propertyValue);
7523       break;
7524      case "9" : this.SetBackgroundPosition(mainElement, propertyValue, true); break;
7525      case "10" : this.SetBackgroundPosition(mainElement, propertyValue, false); break;
7526     }
7527    }
7528   }
7529  }
7530 },
7531 SetImageSrc: function(mainElement, src) {
7532  if(src === ""){
7533   mainElement.style.backgroundImage = "";
7534   mainElement.style.backgroundPosition = "";
7535   ASPx.RemoveClassNameFromElement(mainElement, this.customImageMarkerClassName);
7536  }
7537  else{
7538   mainElement.style.backgroundImage = "url('" + src + "')";
7539   this.SetBackgroundPosition(mainElement, 0, true);
7540   this.SetBackgroundPosition(mainElement, 0, false);
7541   ASPx.AddClassNameToElement(mainElement, this.customImageMarkerClassName);
7542  }
7543 },
7544 SetBackgroundPosition: function(element, value, isX) {
7545  if(value === "") {
7546   element.style.backgroundPosition = value;
7547   return;
7548  }
7549  if(element.style.backgroundPosition === "")
7550   element.style.backgroundPosition = isX ? "-" + value.toString() + "px 0px" : "0px -" + value.toString() + "px";
7551  else {
7552   var position = element.style.backgroundPosition.split(' ');
7553   element.style.backgroundPosition = isX ? '-' + value.toString() + "px " + position[1] :  position[0] + " -" + value.toString() + "px";
7554  }
7555 },
7556 AddState: function(value, stateInputKey, imagePropertiesNumber) {
7557  this.checkBoxStates.push({
7558   "Value" : value, 
7559   "StateInputKey" : stateInputKey, 
7560   "ImagePropertiesNumber" : imagePropertiesNumber
7561  });
7562 },
7563 GetAriaCheckedValue: function(state) {
7564  switch(state) {
7565   case ASPx.CheckBoxCheckState.Checked: return "true";
7566   case ASPx.CheckBoxCheckState.Unchecked: return "false";
7567   case ASPx.CheckBoxCheckState.Indeterminate: return "mixed";
7568   default: return "";
7569  }
7570 },
7571 GetAriaSelectedValue: function(state) {
7572  switch(state) {
7573   case ASPx.CheckBoxCheckState.Checked: return "true";
7574   case ASPx.CheckBoxCheckState.Unchecked: return "false";
7575   case ASPx.CheckBoxCheckState.Indeterminate: return "undefined";
7576   default: return "";
7577  }
7578 },
7579 SetAriaCheckedSelectedAttributes: function(mainElement, state) {
7580  if(mainElement.attributes["aria-checked"] !== undefined) {
7581   var ariaCheckedValue = this.GetAriaCheckedValue(state);
7582   mainElement.setAttribute("aria-checked", ariaCheckedValue);
7583  }
7584  if(mainElement.attributes["aria-selected"] !== undefined) {
7585   var ariaSelectedValue = this.GetAriaSelectedValue(state);
7586   mainElement.setAttribute("aria-selected", ariaSelectedValue);
7587  }
7588 }
7589});
7590CheckableElementStateController.Create = function(imageProperties, valueChecked, valueUnchecked, valueGrayed, allowGrayed) {
7591 var stateController = new CheckableElementStateController(imageProperties);
7592 stateController.AddState(valueChecked, CheckBoxInputKey.Checked, 0);
7593 stateController.AddState(valueUnchecked, CheckBoxInputKey.Unchecked, 1);
7594 if(typeof(valueGrayed) != "undefined")
7595  stateController.AddState(valueGrayed, CheckBoxInputKey.Indeterminate, allowGrayed ? 2 : 1);
7596 stateController.allowGrayed = allowGrayed;
7597 return stateController;
7598};
7599var CheckableElementHelper = ASPx.CreateClass(null, {
7600 InternalCheckBoxInitialize: function(internalCheckBox) {
7601  this.AttachToMainElement(internalCheckBox);
7602  this.AttachToInputElement(internalCheckBox);
7603 },
7604 AttachToMainElement: function(internalCheckBox) {
7605  var instance = this;
7606  if(internalCheckBox.mainElement) {
7607    var toggleEvent = internalCheckBox.displaySwitch ? ASPx.TouchUIHelper.touchMouseDownEventName : "click";
7608    ASPx.Evt.AttachEventToElement(internalCheckBox.mainElement, toggleEvent,
7609    function (evt) {
7610     if(ASPx.Evt.IsRightButtonPressed(evt))
7611      return;
7612     instance.InvokeClick(internalCheckBox, evt);
7613     if(!internalCheckBox.disableCancelBubble)
7614      return ASPx.Evt.PreventEventAndBubble(evt);
7615    }
7616   );
7617   ASPx.Evt.AttachEventToElement(internalCheckBox.mainElement, "mousedown",
7618    function (evt) {
7619     internalCheckBox.Refocus();
7620    }
7621   );
7622   ASPx.Evt.PreventElementDragAndSelect(internalCheckBox.mainElement, true);
7623  }
7624 },
7625 AttachToInputElement: function(internalCheckBox) {
7626  var instance = this;
7627  if(internalCheckBox.inputElement && internalCheckBox.mainElement) {
7628   var checkableElement = internalCheckBox.accessibilityCompliant ? internalCheckBox.mainElement : internalCheckBox.inputElement;
7629   ASPx.Evt.AttachEventToElement(checkableElement, "focus",
7630    function (evt) { 
7631     if(!internalCheckBox.enabled)
7632      checkableElement.blur();
7633     else
7634      internalCheckBox.OnFocus();
7635    }
7636   );
7637   ASPx.Evt.AttachEventToElement(checkableElement, "blur", 
7638    function (evt) { 
7639     internalCheckBox.OnLostFocus();
7640    }
7641   );
7642   ASPx.Evt.AttachEventToElement(checkableElement, "keyup",
7643    function (evt) { 
7644     if(ASPx.Evt.GetKeyCode(evt) == ASPx.Key.Space)
7645      instance.InvokeClick(internalCheckBox, evt);
7646    }
7647   );
7648   ASPx.Evt.AttachEventToElement(checkableElement, "keydown",
7649    function (evt) { 
7650     if(ASPx.Evt.GetKeyCode(evt) == ASPx.Key.Space)
7651      return ASPx.Evt.PreventEvent(evt);
7652    }
7653   );
7654  }
7655 },
7656 IsKBSInputWrapperExist: function() {
7657  return ASPx.Browser.Opera || ASPx.Browser.WebKitFamily;
7658 },
7659 GetICBMainElementByInput: function(icbInputElement) {
7660  return this.IsKBSInputWrapperExist() ? icbInputElement.parentNode.parentNode : icbInputElement.parentNode;
7661 },
7662 RequirePreventFocus: function() { return false; },
7663 InvokeClick: function(internalCheckBox, evt) {
7664  if(internalCheckBox.enabled && !internalCheckBox.GetReadOnly()) {
7665   var inputElementValue = internalCheckBox.inputElement.value;
7666   var focusableElement = internalCheckBox.accessibilityCompliant ? internalCheckBox.mainElement : internalCheckBox.inputElement; 
7667   if(!this.RequirePreventFocus())
7668    focusableElement.focus();
7669   internalCheckBox.inputElement.value = inputElementValue; 
7670   this.InvokeClickCore(internalCheckBox, evt);
7671   }
7672 },
7673 InvokeClickCore: function(internalCheckBox, evt) {
7674  internalCheckBox.OnClick(evt);
7675 }
7676});
7677CheckableElementHelper.Instance = new CheckableElementHelper();
7678var CheckBoxInternal = ASPx.CreateClass(null, {
7679 constructor: function(inputElement, stateController, allowGrayed, allowGrayedByClick, helper, container, storeValueInInput, key, disableCancelBubble,
7680  accessibilityCompliant, displaySwitch) {
7681  this.inputElement = inputElement;
7682  this.mainElement = helper.GetICBMainElementByInput(this.inputElement);
7683  this.name = (key ? key : this.inputElement.id) + CheckBoxInternal.GetICBMainElementPostfix();
7684  this.mainElement.id = this.name;
7685  this.stateController = stateController;
7686  this.container = container;
7687  this.allowGrayed = allowGrayed;
7688  this.allowGrayedByClick = allowGrayedByClick;
7689  this.autoSwitchEnabled = true;
7690  this.displaySwitch = displaySwitch;
7691  this.storeValueInInput = !!storeValueInInput;
7692  this.storedInputKey = !this.storeValueInInput ? this.inputElement.value : null;
7693  this.disableCancelBubble = !!disableCancelBubble;
7694  this.accessibilityCompliant = accessibilityCompliant;
7695  this.focusDecoration = null;
7696  this.focused = false;
7697  this.focusLocked = false;
7698  this.enabled = !this.mainElement.className.match(/dxWeb_\w+Disabled(\b|_)/);
7699  this.readOnly = false;
7700  this.preventFocus = helper.RequirePreventFocus();
7701  this.CheckedChanged = new ASPxClientEvent();
7702  this.Focus = new ASPxClientEvent();
7703  this.LostFocus = new ASPxClientEvent();
7704  helper.InternalCheckBoxInitialize(this);
7705 },
7706 GetReadOnly: function() {
7707  return this.readOnly;
7708 },
7709 ChangeInputElementTabIndex: function() {  
7710  var changeMethod = this.enabled ? ASPx.Attr.RestoreTabIndexAttribute : ASPx.Attr.SaveTabIndexAttributeAndReset;
7711  changeMethod(this.inputElement);
7712 },
7713 CreateFocusDecoration: function(focusedStyle) {
7714   this.focusDecoration = new FocusedStyleDecoration(this);
7715   this.focusDecoration.AddStyle('F', focusedStyle[0], focusedStyle[1]);
7716   this.focusDecoration.AddPostfix("");
7717 },
7718 UpdateFocusDecoration: function() {
7719  this.focusDecoration.Update();
7720 },  
7721 StoreInputKey: function(inputKey) {
7722  if(this.storeValueInInput)
7723   this.inputElement.value = inputKey;
7724  else
7725   this.storedInputKey = inputKey;
7726 },
7727 GetStoredInputKey: function() {
7728  if(this.storeValueInInput)
7729   return this.inputElement.value;
7730  else
7731   return this.storedInputKey;
7732 },
7733 OnClick: function(e) {
7734  if(this.autoSwitchEnabled) {
7735   var currentValue = this.GetValue();
7736   var value = this.stateController.GetNextCheckBoxValue(currentValue, this.allowGrayedByClick && this.allowGrayed);
7737   this.SetValue(value);
7738  }
7739  this.CheckedChanged.FireEvent(this, e);
7740 },
7741 OnFocus: function() {
7742  if(!this.IsFocusLocked()) {
7743   this.focused = true;
7744   this.UpdateFocusDecoration();
7745   this.Focus.FireEvent(this, null);
7746  } else
7747   this.UnlockFocus();
7748 },
7749 OnLostFocus: function() {
7750  if(!this.IsFocusLocked()) {
7751   this.focused = false;
7752   this.UpdateFocusDecoration();
7753   this.LostFocus.FireEvent(this, null);
7754  }
7755 },
7756 Refocus: function() {
7757  if(this.preventFocus) return;
7758  if(this.focused) {
7759   this.LockFocus();
7760   this.inputElement.blur();
7761   if(ASPx.Browser.MacOSMobilePlatform) {
7762    window.setTimeout(function() {
7763     ASPx.SetFocus(this.inputElement);
7764    }, ASPx.FOCUS_TIMEOUT);
7765   } else {
7766    ASPx.SetFocus(this.inputElement);
7767   }
7768  }
7769 },
7770 LockFocus: function() {
7771  this.focusLocked = true;
7772 },
7773 UnlockFocus: function() {
7774  this.focusLocked = false;
7775 },
7776 IsFocusLocked: function() {
7777  if(!!ASPx.Attr.GetAttribute(this.mainElement, ASPx.Attr.GetTabIndexAttributeName()))
7778   return false;
7779  return this.focusLocked;
7780 },
7781 SetValue: function(value, force) {
7782  var currentValue = this.GetValue();
7783  if(currentValue !== value || force) {
7784   var newInputKey = this.stateController.GetInputKeyByValue(value);
7785   if(newInputKey) {
7786    this.StoreInputKey(newInputKey);   
7787    this.stateController.UpdateInternalCheckBoxDecoration(this.mainElement, newInputKey, this.enabled);
7788   }
7789  }
7790  if(this.accessibilityCompliant) {
7791   var state = this.GetCurrentCheckState();
7792   this.stateController.SetAriaCheckedSelectedAttributes(this.mainElement, state);
7793  }
7794 },
7795 GetValue: function() {
7796  return this.stateController.GetValueByInputKey(this.GetCurrentInputKey());
7797 },
7798 GetCurrentCheckState: function() {
7799  return this.stateController.GetCheckStateByInputKey(this.GetCurrentInputKey());
7800 },
7801 GetCurrentInputKey: function() {
7802  return this.GetStoredInputKey();
7803 },
7804 GetChecked: function() {
7805  return this.GetCurrentInputKey() === CheckBoxInputKey.Checked;
7806 },
7807 SetChecked: function(checked) {
7808  var newValue = this.stateController.GetValueByCheckState(checked ? CheckBoxCheckState.Checked : CheckBoxCheckState.Unchecked);
7809  this.SetValue(newValue);
7810 },
7811 SetEnabled: function(enabled) {
7812  if(this.enabled != enabled) {
7813   this.enabled = enabled;
7814   this.stateController.UpdateInternalCheckBoxDecoration(this.mainElement, this.GetCurrentInputKey(), this.enabled);
7815   this.ChangeInputElementTabIndex();
7816  }
7817 },
7818 GetEnabled: function() {
7819  return this.enabled;
7820 }
7821});
7822CheckBoxInternal.GetICBMainElementPostfix = function() {
7823 return "_D";
7824};
7825var CheckBoxInternalCollection = ASPx.CreateClass(CollectionBase, {
7826 constructor: function(imageProperties, allowGrayed, storeValueInInput, helper, disableCancelBubble, accessibilityCompliant) {
7827  this.constructor.prototype.constructor.call(this);
7828  this.stateController = allowGrayed 
7829   ? CheckableElementStateController.Create(imageProperties, CheckBoxInputKey.Checked, CheckBoxInputKey.Unchecked, CheckBoxInputKey.Indeterminate, true)
7830   : CheckableElementStateController.Create(imageProperties, CheckBoxInputKey.Checked, CheckBoxInputKey.Unchecked);
7831  this.helper = helper || CheckableElementHelper.Instance;
7832  this.storeValueInInput = !!storeValueInInput;
7833  this.disableCancelBubble = !!disableCancelBubble;
7834  this.accessibilityCompliant = accessibilityCompliant;
7835 },
7836 Add: function(key, inputElement, container) {
7837  this.Remove(key);
7838  var checkBox = this.CreateInternalCheckBox(key, inputElement, container);
7839  CollectionBase.prototype.Add.call(this, key, checkBox);
7840  return checkBox;
7841 },
7842 SetImageProperties: function(imageProperties) {
7843  this.stateController.imageProperties = imageProperties;
7844 },
7845 CreateInternalCheckBox: function(key, inputElement, container) {
7846  return new CheckBoxInternal(inputElement, this.stateController, this.stateController.allowGrayed, false, this.helper, container, 
7847   this.storeValueInInput, key, this.disableCancelBubble, this.accessibilityCompliant);
7848 }
7849});
7850var FocusedStyleDecoration = ASPx.CreateClass(null, {
7851 constructor: function(editor) {
7852  this.editor = editor;
7853  this.postfixList = [];
7854  this.styles = {};
7855  this.innerStyles = {};
7856 },
7857 AddPostfix: function(value) {
7858  this.postfixList.push(value);
7859 },
7860 AddStyle: function(key, className, cssText) {
7861  this.styles[key] = this.CreateRule(className, cssText);
7862  this.innerStyles[key] = this.CreateRule("", this.FilterInnerCss(cssText));
7863 },
7864 CreateRule: function(className, cssText) {
7865  return ASPx.Str.Trim(className + " " + ASPx.CreateImportantStyleRule(this.GetStyleSheet(), cssText));
7866 },
7867 GetStyleSheet: function() {
7868  return ASPx.GetCurrentStyleSheet();
7869 },
7870 FilterInnerCss: function(css) {
7871  return css.replace(/(border|background-image)[^:]*:[^;]+/gi, "");
7872 },
7873 Update: function() {
7874  for(var i = 0; i < this.postfixList.length; i++) {
7875   var postfix = this.postfixList[i];
7876   var inner = postfix.length > 0;
7877   var element = this.GetElementByPostfix(postfix);
7878   if(element)
7879    this.ApplyStyles(element, inner);
7880  }
7881 },
7882 GetElementByPostfix: function(postfix) {
7883  return ASPx.GetElementById(this.editor.name + postfix);
7884 },
7885 ApplyStyles: function(element, inner) {
7886  this.ApplyFocusedStyle(element, inner);
7887 },
7888 ApplyFocusedStyle: function(element, inner) {
7889  if(this.HasDecoration("F"))
7890   this.ApplyDecoration("F", element, inner, this.editor.focused);
7891 },
7892 HasDecoration: function(key) {
7893  return !!this.styles[key];
7894 },
7895 ApplyDecoration: function(key, element, inner, active) {
7896  var value = inner ? this.innerStyles[key] : this.styles[key];
7897  this.RemoveDecoration(element, value);
7898  if(active)
7899   ASPx.AddClassNameToElement(element, value);
7900 },
7901 RemoveDecoration: function(element, value) {
7902  ASPx.RemoveClassNameFromElement(element, value);
7903 },
7904 ApplyDecorationCore: function() {
7905 },
7906 EnsureElementBorder: function(element) {
7907  var border = parseInt(element.border) || 0;
7908  element.border = 1;
7909  element.border = border;
7910 }
7911});
7912var EditorStyleDecoration = ASPx.CreateClass(FocusedStyleDecoration, {
7913 constructor: function(editor) {
7914  this.constructor.prototype.constructor.call(this, editor);
7915  this.lockUpdate = false;
7916 },
7917 LockUpdate: function() {
7918  this.lockUpdate = true;
7919 },
7920 UnlockUpdate: function() {
7921  this.lockUpdate = false;
7922 },
7923 IsUpdateLocked: function() {
7924  return this.lockUpdate;
7925 },
7926 Update: function () {
7927  if(this.IsUpdateLocked())
7928   return;
7929  ASPx.FocusedStyleDecoration.prototype.Update.call(this);
7930 },
7931 ApplyStyles: function (element, inner) {
7932  this.ApplyInvalidStyle(element, inner);
7933  ASPx.FocusedStyleDecoration.prototype.ApplyStyles.call(this, element, inner);
7934 },
7935 ApplyInvalidStyle: function (element, inner) {
7936  if(this.HasDecoration("I")) {
7937   var isValid = this.editor.GetIsValid();
7938   this.ApplyDecoration("I", element, inner, !isValid);
7939  }
7940 }
7941});
7942var TextEditorStyleDecoration = ASPx.CreateClass(EditorStyleDecoration, {
7943 constructor: function(editor) {
7944  this.constructor.prototype.constructor.call(this, editor);
7945  this.nullTextClassName = "";
7946 },
7947 ApplyStyles: function(element, inner) {
7948  ASPx.EditorStyleDecoration.prototype.ApplyStyles.call(this, element, inner);
7949  this.ApplyNullTextStyle(element, inner);
7950 },
7951 ApplyNullTextStyle: function(element, inner) {
7952  if(!this.HasDecoration("N"))
7953   return;
7954  var apply = !this.editor.focused && this.editor.CanApplyNullTextDecoration();
7955  this.EnsureSpellcheckAttribute(element, apply);
7956  this.ApplyDecoration("N", element, inner, apply);
7957 },
7958 EnsureSpellcheckAttribute: function(element, apply) {
7959  if(apply)
7960   ASPx.Attr.ChangeAttribute(element, "spellcheck", "false");
7961  else
7962   ASPx.Attr.RestoreAttribute(element, "spellcheck");
7963 },
7964 ApplyNullTextClassName: function(active) {
7965  var nullTextClassName = this.GetNullTextClassName();
7966  var editorMainElement = this.editor.GetMainElement();
7967  if(active)
7968   ASPx.AddClassNameToElement(editorMainElement, nullTextClassName);
7969  else
7970   ASPx.RemoveClassNameFromElement(editorMainElement, nullTextClassName);
7971 },
7972 GetNullTextClassName: function() {
7973  if (!this.nullTextClassName)
7974   this.InitializeNullTextClassName();
7975  return this.nullTextClassName;
7976 },
7977 InitializeNullTextClassName: function() {
7978  var nullTextStyle = this.styles["N"];
7979  if (nullTextStyle) {
7980   var nullTextStyleClassNames = nullTextStyle.split(" ");
7981   for (var i = 0; i < nullTextStyleClassNames.length; i++)
7982    if (nullTextStyleClassNames[i].match("dxeNullText"))
7983     this.nullTextClassName = nullTextStyleClassNames[i];
7984  }
7985 }
7986});
7987var touchUIHelperUsePointerEvents = (ASPx.Browser.Edge || ASPx.Browser.EdgeWebKit) && ASPx.Browser.MSTouchUI && !!window.PointerEvent;
7988var TouchUIHelper = {
7989 isGesture: false,
7990 isMouseEventFromScrolling: false,
7991 isNativeScrollingAllowed: true,
7992 clickSensetivity: 10,
7993 documentTouchHandlers: {},
7994 documentEventAttachingAllowed: true,
7995 msTouchDraggableClassName: "dxMSTouchDraggable",
7996 touchMouseDownEventName: ASPx.Browser.WebKitTouchUI ? "touchstart" : (touchUIHelperUsePointerEvents ? "pointerdown" : "mousedown"),
7997 touchMouseUpEventName: ASPx.Browser.WebKitTouchUI ? "touchend" : (touchUIHelperUsePointerEvents ? "pointerup" : "mouseup"),
7998 touchMouseMoveEventName: ASPx.Browser.WebKitTouchUI ? "touchmove" : (touchUIHelperUsePointerEvents ? "pointermove" : "mousemove"),
7999 startPreventingTouchMove: function() {
8000  if(touchUIHelperUsePointerEvents)
8001   ASPx.Evt.AttachEventToDocument("touchmove", ASPx.Evt.PreventEvent);
8002 },
8003 stopPreventingTouchMove: function() {
8004  if(touchUIHelperUsePointerEvents)
8005   ASPx.Evt.DetachEventFromDocument("touchmove", ASPx.Evt.PreventEvent);
8006 },
8007 isTouchEvent: function(evt) {
8008  if(!evt) return false;
8009  return ASPx.Browser.WebKitTouchUI && ASPx.IsExists(evt.changedTouches); 
8010 },
8011 isTouchEventName: function(eventName) {
8012  return ASPx.Browser.WebKitTouchUI && (eventName.indexOf("touch") > -1 || eventName.indexOf("gesture") > -1);
8013 },
8014 getEventX: function(evt) {
8015  var touchPoint = null;
8016  if(evt.changedTouches.length > 0)
8017   touchPoint = evt.changedTouches;
8018  else if(evt.targetTouches.length > 0)
8019   touchPoint = evt.targetTouches;
8020  return touchPoint ? touchPoint[0].pageX : 0;
8021 },
8022 getEventY: function(evt) { 
8023  var touchPoint = null;
8024  if(evt.changedTouches.length > 0)
8025   touchPoint = evt.changedTouches;
8026  else if(evt.targetTouches.length > 0)
8027   touchPoint = evt.targetTouches;
8028  return touchPoint ? touchPoint[0].pageY : 0;
8029 },
8030 getWebkitMajorVersion: function(){
8031  if(!this.webkitMajorVersion){
8032   var regExp = new RegExp("applewebkit/(\\d+)", "i");
8033   var matches = regExp.exec(ASPx.Browser.UserAgent);
8034   if(matches && matches.index >= 1)
8035    this.webkitMajorVersion = matches[1];
8036  }
8037  return this.webkitMajorVersion;
8038 },
8039 getIsLandscapeOrientation: function(){
8040  if(ASPx.Browser.MacOSMobilePlatform || ASPx.Browser.AndroidMobilePlatform)
8041   return Math.abs(window.orientation) == 90;
8042  return ASPx.GetDocumentClientWidth() > ASPx.GetDocumentClientHeight();
8043 },
8044 nativeScrollingSupported: function() {
8045  var allowedSafariVersion = ASPx.Browser.Version >= 5.1 && ASPx.Browser.Version < 8; 
8046  var webkitMajorVersion = this.getWebkitMajorVersion();
8047  var allowedWebKitVersion = webkitMajorVersion > 533 && webkitMajorVersion < 600;
8048  return (ASPx.Browser.MacOSMobilePlatform && (allowedSafariVersion || allowedWebKitVersion))
8049   || (ASPx.Browser.AndroidMobilePlatform && ASPx.Browser.PlaformMajorVersion >= 3) || (ASPx.Browser.MSTouchUI);
8050 },
8051 makeScrollableIfRequired: function(element, options) {
8052  if(ASPx.Browser.WebKitTouchUI && element) {
8053   var overflow = ASPx.GetCurrentStyle(element).overflow;
8054   if(element.tagName == "DIV" &&  overflow != "hidden" && overflow != "visible" ){
8055    return this.MakeScrollable(element);
8056   }
8057  }
8058 },
8059 preventScrollOnEvent: function(evt){
8060 },
8061 handleFastTapIfRequired: function(evt, action, preventCommonClickEvents) {
8062  if(ASPx.Browser.WebKitTouchUI && evt.type == 'touchstart' && action) {
8063   this.FastTapHelper.HandleFastTap(evt, action, preventCommonClickEvents);
8064   return true;
8065  }
8066  return false;
8067 },
8068 ensureDocumentSizesCorrect: function (){
8069  return (document.documentElement.clientWidth - document.documentElement.clientHeight) / (screen.width - screen.height) > 0;
8070 },
8071 ensureOrientationChanged: function(onOrientationChangedFunction){
8072  if(ASPxClientUtils.iOSPlatform || this.ensureDocumentSizesCorrect())
8073   onOrientationChangedFunction();
8074  else {
8075   window.setTimeout(function(){
8076    this.ensureOrientationChanged(onOrientationChangedFunction);
8077   }.aspxBind(this), 100);
8078  }
8079 },
8080 onEventAttachingToDocument: function(eventName, func){
8081  if(ASPx.Browser.MacOSMobilePlatform && this.isTouchEventName(eventName)) {
8082   if(!this.documentTouchHandlers[eventName])
8083    this.documentTouchHandlers[eventName] = [];
8084   this.documentTouchHandlers[eventName].push(func);
8085   return this.documentEventAttachingAllowed;
8086  }
8087  return true;
8088 },
8089 onEventDettachedFromDocument: function(eventName, func){
8090  if(ASPx.Browser.MacOSMobilePlatform && this.isTouchEventName(eventName)) {
8091   var handlers = this.documentTouchHandlers[eventName];
8092   if(handlers)
8093    ASPx.Data.ArrayRemove(handlers, func);
8094  }
8095 },
8096 processDocumentTouchEventHandlers: function(proc) {
8097  var touchEventNames = ["touchstart", "touchend", "touchmove", "gesturestart", "gestureend"];
8098  for(var i = 0; i < touchEventNames.length; i++) {
8099   var eventName = touchEventNames[i];
8100   var handlers = this.documentTouchHandlers[eventName];
8101   if(handlers) {
8102    for(var j = 0; j < handlers.length; j++) {
8103     proc(eventName,handlers[j]);
8104    }
8105   }
8106  }
8107 },
8108 removeDocumentTouchEventHandlers: function() {
8109  if(ASPx.Browser.MacOSMobilePlatform) {
8110   this.documentEventAttachingAllowed = false;
8111   this.processDocumentTouchEventHandlers(ASPx.Evt.DetachEventFromDocumentCore);
8112  }
8113 },
8114 restoreDocumentTouchEventHandlers: function () {
8115  if(ASPx.Browser.MacOSMobilePlatform) {
8116   this.documentEventAttachingAllowed = true;
8117   this.processDocumentTouchEventHandlers(ASPx.Evt.AttachEventToDocumentCore);
8118  }
8119 },
8120 IsNativeScrolling: function() {
8121  return TouchUIHelper.nativeScrollingSupported() && TouchUIHelper.isNativeScrollingAllowed;
8122 },
8123 pointerEnabled: !!(window.PointerEvent || window.MSPointerEvent),
8124 pointerDownEventName: window.PointerEvent ? "pointerdown" : "MSPointerDown",
8125 pointerUpEventName: window.PointerEvent ? "pointerup" : "MSPointerUp",
8126 pointerCancelEventName: window.PointerEvent ? "pointercancel" : "MSPointerCancel",
8127 pointerMoveEventName: window.PointerEvent ? "pointermove" : "MSPointerMove",
8128 pointerOverEventName: window.PointerEvent ? "pointerover" : "MSPointerOver",
8129 pointerOutEventName: window.PointerEvent ? "pointerout" : "MSPointerOut",
8130 pointerType: {
8131  Touch: "touch",
8132  Pen: "pen",
8133  Mouse: "mouse"
8134 },
8135 msGestureEnabled: !!(window.PointerEvent || window.MSPointerEvent) && typeof(MSGesture) != "undefined",
8136 msTouchCreateGesturesWrapper: function(element, onTap){
8137  if(!TouchUIHelper.msGestureEnabled) 
8138   return;
8139  var gesture = new MSGesture();
8140  gesture.target = element;
8141  ASPx.Evt.AttachEventToElement(element, TouchUIHelper.pointerDownEventName, function(evt){
8142   gesture.addPointer(evt.pointerId);
8143  });
8144  ASPx.Evt.AttachEventToElement(element, TouchUIHelper.pointerUpEventName, function(evt){
8145   gesture.stop();
8146  });
8147  if(onTap)
8148   ASPx.Evt.AttachEventToElement(element, "MSGestureTap", onTap);
8149  return gesture;
8150 },
8151 useLongTapHelper: function () {
8152  return ASPx.Browser.Safari && ASPx.Browser.TouchUI;
8153 },
8154 attachLongTapHandler: function(element, handler, onlyBubbling) {
8155  var timerID = -1;
8156  var timeout = 1000;
8157  var event = null;
8158  var preventClickEvent = false;
8159  var startX = -1;
8160  var startY = -1;
8161  var pixelLimit = 5;
8162  function onTouchMouseDown(evt) {
8163   abortWating();
8164   event = evt;
8165   startX = evt.pageX;
8166   startY = evt.pageY;
8167   preventClickEvent = false;
8168   timerID = window.setTimeout(onTimeout, timeout);
8169  }
8170  function onTouchMouseMove(evt) {
8171   if (!isUnderTouch())
8172    return;
8173   var shiftX = Math.abs(startX - evt.pageX),
8174    shiftY = Math.abs(startY - evt.pageY),
8175    maxShift = Math.max(shiftX, shiftY);
8176   if (maxShift > pixelLimit)
8177    abortWating();
8178  }
8179  function onTouchMouseUp(evt) {
8180   abortWating();
8181   if (preventClickEvent) {
8182    ASPx.Evt.PreventEventAndBubble(evt);
8183    preventClickEvent = false;
8184   }
8185  }
8186  function onTimeout() {
8187   handler(event);
8188   preventClickEvent = true;
8189   abortWatingInternal();
8190  }
8191  function isUnderTouch() {
8192   return timerID !== -1;
8193  }
8194  function abortWating() {
8195   if (isUnderTouch()) {
8196    window.clearTimeout(timerID);
8197    abortWatingInternal();
8198   }
8199  }
8200  function abortWatingInternal() {
8201   timerID = -1;
8202   event = null;
8203  }
8204  ASPx.Evt.AttachEventToElement(element, TouchUIHelper.touchMouseDownEventName, onTouchMouseDown, onlyBubbling);
8205  ASPx.Evt.AttachEventToElement(element, TouchUIHelper.touchMouseMoveEventName, onTouchMouseMove, onlyBubbling);
8206  ASPx.Evt.AttachEventToElement(element, TouchUIHelper.touchMouseUpEventName, onTouchMouseUp, onlyBubbling);
8207  element.style["-webkit-user-select"] = "none";
8208  return function () {
8209   ASPx.Evt.DetachEventFromElement(element, TouchUIHelper.touchMouseDownEventName, onTouchMouseDown);
8210   ASPx.Evt.DetachEventFromElement(element, TouchUIHelper.touchMouseMoveEventName, onTouchMouseMove);
8211   ASPx.Evt.DetachEventFromElement(element, TouchUIHelper.touchMouseUpEventName, onTouchMouseUp);
8212   element.style["-webkit-user-select"] = "";
8213  };
8214 }
8215};
8216var CacheHelper = {};
8217CacheHelper.GetCachedValueCore = function(obj, key, func, cacheObj, fillValueMethod) {
8218 if(!cacheObj)
8219  cacheObj = obj;
8220 if(!cacheObj.cache)
8221  cacheObj.cache = {};
8222 if(!key) 
8223  key = "default";
8224 fillValueMethod(obj, key, func, cacheObj);
8225 return cacheObj.cache[key];
8226};
8227CacheHelper.GetCachedValue = function(obj, key, func, cacheObj) {
8228 return CacheHelper.GetCachedValueCore(obj, key, func, cacheObj, 
8229  function(obj, key, func, cacheObj) {
8230   if(!ASPx.IsExists(cacheObj.cache[key]))
8231    cacheObj.cache[key] = func.apply(obj, []);
8232  });
8233};
8234CacheHelper.GetCachedElement = function(obj, key, func, cacheObj) {
8235 return CacheHelper.GetCachedValueCore(obj, key, func, cacheObj, 
8236  function(obj, key, func, cacheObj) {
8237   if(!ASPx.IsValidElement(cacheObj.cache[key]))
8238    cacheObj.cache[key] = func.apply(obj, []);
8239  });
8240};
8241CacheHelper.GetCachedElements = function(obj, key, func, cacheObj) {
8242 return CacheHelper.GetCachedValueCore(obj, key, func, cacheObj, 
8243  function(obj, key, func, cacheObj) {
8244   if(!ASPx.IsValidElements(cacheObj.cache[key])){
8245    var elements = func.apply(obj, []);
8246    if(!Ident.IsArray(elements))
8247     elements = [elements];
8248    cacheObj.cache[key] = elements;
8249   }
8250  });
8251};
8252CacheHelper.GetCachedElementById = function(obj, id, cacheObj) {
8253 return CacheHelper.GetCachedElement(obj, id, function() { return ASPx.GetElementById(id); }, cacheObj);
8254};
8255CacheHelper.GetCachedChildById = function(obj, parent, id, cacheObj) {
8256 return CacheHelper.GetCachedElement(obj, id, function() { return ASPx.GetChildById(parent, id); }, cacheObj);
8257};
8258CacheHelper.DropCachedValue = function(cacheObj, key) {
8259 cacheObj.cache[key] = null;
8260};  
8261CacheHelper.DropCache = function(cacheObj) {
8262 cacheObj.cache = null;
8263};  
8264var DomObserver = ASPx.CreateClass(null, {
8265 constructor: function() {
8266  this.items = { };
8267 },
8268 subscribe: function(elementID, callbackFunc) {
8269  var item = this.items[elementID];
8270  if(item)
8271   this.unsubscribe(elementID);
8272  item = {
8273   elementID: elementID,
8274   callbackFunc: callbackFunc,
8275   pauseCount: 0
8276  };
8277  this.prepareItem(item);
8278  this.items[elementID] = item;
8279 },
8280 prepareItem: function(item) {
8281 },
8282 unsubscribe: function(elementID) {
8283  this.items[elementID] = null;
8284 },
8285 getItemElement: function(item) {
8286  var element = this.getElementById(item.elementID);
8287  if(element)
8288   return element;
8289  this.unsubscribe(item.elementID);
8290  return null;
8291 },
8292 getElementById: function(elementID) {
8293  var element = document.getElementById(elementID);
8294  return element && ASPx.IsValidElement(element) ? element : null;
8295 },
8296 pause: function(element, includeSubtree) {
8297  this.changeItemsState(element, includeSubtree, true);
8298 },
8299 resume: function(element, includeSubtree) {
8300  this.changeItemsState(element, includeSubtree, false);
8301 },
8302 forEachItem: function(processFunc, context) {
8303  context = context || this;
8304  for(var itemName in this.items) {
8305   if(!this.items.hasOwnProperty(itemName))
8306    continue;
8307   var item = this.items[itemName];
8308   if(item) {
8309    var needBreak = processFunc.call(context, item);
8310    if(needBreak)
8311     return;
8312   }
8313  }
8314 },
8315 changeItemsState: function(element, includeSubtree, pause) {
8316  this.forEachItem(function(item) {
8317   if(!element)
8318    this.changeItemState(item, pause);
8319   else {
8320    var itemElement = this.getItemElement(item);
8321    if(itemElement && (element == itemElement || (includeSubtree && ASPx.GetIsParent(element, itemElement)))) {
8322     this.changeItemState(item, pause);
8323     if(!includeSubtree)
8324      return true;
8325    }
8326   }
8327  }.aspxBind(this));
8328 },
8329 changeItemState: function(item, pause) {
8330  if(pause)
8331   this.pauseItem(item);
8332  else
8333   this.resumeItem(item);
8334 },
8335 pauseItem: function(item) {
8336  item.paused = true;
8337  item.pauseCount++;
8338 },
8339 resumeItem: function(item) {
8340  if(item.pauseCount > 0) {
8341   if(item.pauseCount == 1)
8342    item.paused = false;
8343   item.pauseCount--;
8344  }
8345 }
8346});
8347DomObserver.IsMutationObserverAvailable = function() {
8348 return !!window.MutationObserver;
8349};
8350var TimerObserver = ASPx.CreateClass(DomObserver, {
8351 constructor: function() {
8352  this.constructor.prototype.constructor.call(this);
8353  this.timerID = -1;
8354  this.observationTimeout = 300;
8355 },
8356 subscribe: function(elementID, callbackFunc) {
8357  DomObserver.prototype.subscribe.call(this, elementID, callbackFunc);
8358  if(!this.isActivated())
8359   this.startObserving();
8360 },
8361 isActivated: function() {
8362  return this.timerID !== -1;
8363 },
8364 startObserving: function() {
8365  if(this.isActivated())
8366   window.clearTimeout(this.timerID);
8367  this.timerID = window.setTimeout(this.onTimeout, this.observationTimeout);
8368 },
8369 onTimeout: function() {
8370  var observer = _aspxGetDomObserver();
8371  observer.doObserve();
8372  observer.startObserving();
8373 },
8374 doObserve: function() {
8375  if(!ASPx.documentLoaded) return;
8376  this.forEachItem(function(item) {
8377   if(!item.paused)
8378    this.doObserveForItem(item);
8379  }.aspxBind(this));
8380 },
8381 doObserveForItem: function(item) {
8382  var element = this.getItemElement(item);
8383  if(element)
8384   item.callbackFunc.call(this, element);
8385 }
8386});
8387var MutationObserver = ASPx.CreateClass(DomObserver, {
8388 constructor: function() {
8389  this.constructor.prototype.constructor.call(this);
8390  this.callbackTimeout = 10;
8391 },
8392 prepareItem: function(item) {
8393  item.callbackTimerID = -1;
8394  var target = this.getElementById(item.elementID);
8395  if(!target)
8396   return;
8397  var observerCallbackFunc = function() {
8398   if(item.callbackTimerID === -1) {
8399    var timeoutHander = function() {
8400     item.callbackTimerID = -1;
8401     item.callbackFunc.call(this, target);
8402    }.aspxBind(this);
8403    item.callbackTimerID = window.setTimeout(timeoutHander, this.callbackTimeout);
8404   }
8405  }.aspxBind(this);
8406  var observer = new window.MutationObserver(observerCallbackFunc);
8407  var config = { attributes: true, childList: true, characterData: true, subtree: true };
8408  observer.observe(target, config);
8409  item.observer = observer;
8410  item.config = config;
8411 },
8412 unsubscribe: function(elementID) {
8413  var item = this.items[elementID];
8414  if(item) {
8415   item.observer.disconnect();
8416   item.observer = null;
8417  }
8418  DomObserver.prototype.unsubscribe.call(this, elementID);
8419 },
8420 pauseItem: function(item) {
8421  DomObserver.prototype.pauseItem.call(this, item);
8422  item.observer.disconnect();
8423 },
8424 resumeItem: function(item) {
8425  DomObserver.prototype.resumeItem.call(this, item);
8426  if(!item.paused) {
8427   var target = this.getItemElement(item);
8428   if(target)
8429    item.observer.observe(target, item.config);
8430  }
8431 }
8432});
8433var domObserver = null;
8434function _aspxGetDomObserver() {
8435 if(domObserver == null)
8436  domObserver = DomObserver.IsMutationObserverAvailable() ? new MutationObserver() : new TimerObserver();
8437 return domObserver;
8438}
8439var ControlUpdateWatcher = ASPx.CreateClass(null, {
8440 constructor: function() {
8441  this.helpers = { };
8442  this.clearLockerTimerID = -1;
8443  this.clearLockerTimerDelay = 15;
8444  this.postProcessing = false;
8445  this.init();
8446 },
8447 init: function() {
8448  var postHandler = aspxGetPostHandler();
8449  postHandler.Post.AddHandler(this.OnPost, this);
8450 },
8451 Add: function(helper) {
8452  this.helpers[helper.GetName()] = helper;
8453 },
8454 CanSendCallback: function(dxCallbackOwner, arg) {
8455  this.LockConfirmOnBeforeWindowUnload();
8456  var modifiedHelpers = this.FilterModifiedHelpersByDXCallbackOwner(this.GetModifiedHelpers(), dxCallbackOwner, arg);
8457  if(modifiedHelpers.length === 0) return true;
8458  var modifiedHelpersInfo = this.GetToConfirmAndToResetLists(modifiedHelpers, dxCallbackOwner.name);
8459  if(!modifiedHelpersInfo) return true;
8460  if(modifiedHelpersInfo.toConfirm.length === 0) {
8461   this.ResetClientChanges(modifiedHelpersInfo.toReset);
8462   return true;
8463  }
8464  var helper = modifiedHelpersInfo.toConfirm[0];
8465  if(!confirm(helper.GetConfirmUpdateText()))
8466   return false;
8467  this.ResetClientChanges(modifiedHelpersInfo.toReset);
8468  return true;
8469 },
8470 OnPost: function(s, e) {
8471  if(this.isDxCallback(e))
8472   return;
8473  this.postProcessing = true;
8474  this.LockConfirmOnBeforeWindowUnload();
8475  var modifiedHelpersInfo = this.GetModifedHelpersInfo(e);
8476  if(!modifiedHelpersInfo)
8477   return;
8478  if(modifiedHelpersInfo.toConfirm.length === 0) {
8479   this.ResetClientChanges(modifiedHelpersInfo.toReset);
8480   return;
8481  }
8482  var helper = modifiedHelpersInfo.toConfirm[0];
8483  if(!confirm(helper.GetConfirmUpdateText())) {
8484   e.cancel = true;
8485   this.finishPostProcessing();
8486  }
8487  if(!e.cancel)
8488   this.ResetClientChanges(modifiedHelpersInfo.toReset);
8489 },
8490 isDxCallback: function(e) {
8491  return e.isDXCallback || this.isInternalUploadControlCallback();
8492 },
8493 isInternalUploadControlCallback: function() {
8494  var isInCallback = false;
8495  for(var key in this.helpers) {
8496   if(this.helpers.hasOwnProperty(key)) {
8497    var helper = this.helpers[key];
8498    isInCallback = isInCallback || helper.isInUploadCallback();
8499   }
8500  }
8501  return isInCallback;
8502 },
8503 finishPostProcessing: function() {
8504  this.postProcessing = false;
8505 },
8506 GetModifedHelpersInfo: function(e) {
8507  var modifiedHelpers = this.FilterModifiedHelpers(this.GetModifiedHelpers(), e);
8508  if(modifiedHelpers.length === 0) return;
8509  return this.GetToConfirmAndToResetLists(modifiedHelpers, e && e.ownerID);
8510 },
8511 GetToConfirmAndToResetLists: function(modifiedHelpers, ownerID) {
8512  var resetList = [ ];
8513  var confirmList = [ ];
8514  for(var i = 0; i < modifiedHelpers.length; i++) {
8515   var helper = modifiedHelpers[i];
8516   if(!helper.GetConfirmUpdateText()) { 
8517    resetList.push(helper);
8518    continue;
8519   }
8520   if(helper.CanShowConfirm(ownerID)) { 
8521    resetList.push(helper);
8522    confirmList.push(helper);
8523   }
8524  }
8525  return { toConfirm: confirmList, toReset: resetList };
8526 },
8527 FilterModifiedHelpers: function(modifiedHelpers, e) {
8528  if(modifiedHelpers.length === 0)
8529   return [ ];
8530  if(this.RequireProcessUpdatePanelCallback(e))
8531   return this.FilterModifiedHelpersByUpdatePanels(modifiedHelpers);
8532  if(this.postProcessing)
8533   return this.FilterModifiedHelpersByPostback(modifiedHelpers);
8534  return modifiedHelpers;
8535 },
8536 FilterModifiedHelpersByDXCallbackOwner: function(modifiedHelpers, dxCallbackOwner, arg) {
8537  var result = [ ];
8538  for(var i = 0; i < modifiedHelpers.length; i++) {
8539   var helper = modifiedHelpers[i];
8540   if(helper.NeedConfirmOnCallback(dxCallbackOwner, arg))
8541    result.push(helper);
8542  }
8543  return result;
8544 },
8545 FilterModifiedHelpersByUpdatePanels: function(modifiedHelpers) {
8546  var result = [ ];
8547  var updatePanels = this.GetUpdatePanelsWaitedForUpdate();
8548  for(var i = 0; i < updatePanels.length; i++) {
8549   var panelID = updatePanels[i].replace(/\$/g, "_");
8550   var panel = ASPx.GetElementById(panelID);
8551   if(!panel) continue;
8552   for(var j = 0; j < modifiedHelpers.length; j++) {
8553    var helper = modifiedHelpers[j];
8554    if(ASPx.GetIsParent(panel, helper.GetControlMainElement()))
8555     result.push(helper);
8556   }
8557  }
8558  return result;
8559 },
8560 FilterModifiedHelpersByPostback: function(modifiedHelpers) {
8561  var result = [ ];
8562  for(var i = 0; i < modifiedHelpers.length; i++) {
8563   var helper = modifiedHelpers[i];
8564   if(helper.NeedConfirmOnPostback())
8565    result.push(helper);
8566  }
8567  return result;
8568 },
8569 RequireProcessUpdatePanelCallback: function(e) {
8570  var rManager = this.GetMSRequestManager();
8571  if(rManager && e && e.isMSAjaxCallback)
8572   return rManager._postBackSettings.async;
8573  return false;
8574 },
8575 GetUpdatePanelsWaitedForUpdate: function() {
8576  var rManager = this.GetMSRequestManager();
8577  if(!rManager) return [ ];
8578  var panelUniqueIDs = rManager._postBackSettings.panelsToUpdate || [ ];
8579  var panelClientIDs = [ ];
8580  for(var i = 0; i < panelUniqueIDs.length; i++) {
8581   var index = ASPx.Data.ArrayIndexOf(rManager._updatePanelIDs, panelUniqueIDs[i]);
8582   if(index >= 0)
8583    panelClientIDs.push(rManager._updatePanelClientIDs[index]);
8584  }
8585  return panelClientIDs;
8586 },
8587 GetMSRequestManager: function() {
8588  return ASPx.GetMSAjaxRequestManager();
8589 },
8590 GetModifiedHelpers: function() {
8591  var result = [ ];
8592  for(var key in this.helpers) { 
8593   if(this.helpers.hasOwnProperty(key)) {
8594    var helper = this.helpers[key];
8595    if(helper.HasChanges())
8596     result.push(helper);
8597   }
8598  }
8599  return result;
8600 },
8601 ResetClientChanges: function(modifiedHelpers) {
8602  for(var i = 0; i < modifiedHelpers.length; i++)
8603   modifiedHelpers[i].ResetClientChanges();
8604 },
8605 GetConfirmUpdateMessage: function() {
8606  if(this.confirmOnWindowUnloadLocked) return;
8607  var modifiedHelpersInfo = this.GetModifedHelpersInfo();
8608  if(!modifiedHelpersInfo || modifiedHelpersInfo.toConfirm.length === 0) 
8609   return;
8610  var helper = modifiedHelpersInfo.toConfirm[0];
8611  return helper.GetConfirmUpdateText();
8612 },
8613 LockConfirmOnBeforeWindowUnload: function() {
8614  this.confirmOnWindowUnloadLocked = true;
8615  this.clearLockerTimerID = ASPx.Timer.ClearTimer(this.clearLockerTimerID);
8616  this.clearLockerTimerID = window.setTimeout(function() {
8617   this.confirmOnWindowUnloadLocked = false;
8618  }.aspxBind(this), this.clearLockerTimerDelay);
8619 },
8620 OnWindowBeforeUnload: function(e) {
8621  var confirmMessage = this.GetConfirmUpdateMessage();
8622  if(confirmMessage)
8623   e.returnValue = confirmMessage;
8624  this.finishPostProcessing();
8625  return confirmMessage;
8626 },
8627 OnWindowUnload: function(e) {
8628  if(this.confirmOnWindowUnloadLocked) return;
8629  var modifiedHelpersInfo = this.GetModifedHelpersInfo();
8630  if(!modifiedHelpersInfo) return;
8631  this.ResetClientChanges(modifiedHelpersInfo.toReset);
8632 },
8633 OnMouseDown: function(e) {
8634 },
8635 OnFocusIn: function(e) {
8636 },
8637 PreventBeforeUnloadOnLinkClick: function(e) {
8638  if(ASPx.GetObjectKeys(this.helpers).length == 0)
8639   return;
8640  var link = ASPx.GetParentByTagName(ASPx.Evt.GetEventSource(e), "A");
8641  if(!link || link.dxgvLinkClickHanlderAssigned)
8642   return;
8643  var url = ASPx.Attr.GetAttribute(link, "href");
8644  if(!url || url.indexOf("javascript:") < 0)
8645   return;
8646  ASPx.Evt.AttachEventToElement(link, "click", function(ev) { return ASPx.Evt.PreventEvent(ev); });
8647  link.dxgvLinkClickHanlderAssigned = true;
8648 }
8649});
8650ControlUpdateWatcher.Instance = null;
8651ControlUpdateWatcher.getInstance = function () {
8652 if (!ControlUpdateWatcher.Instance) {
8653  ControlUpdateWatcher.Instance = new ControlUpdateWatcher();
8654  ASPx.Evt.AttachEventToElement(window, "beforeunload", function(e) {
8655   return ControlUpdateWatcher.Instance.OnWindowBeforeUnload(e);
8656  });
8657  ASPx.Evt.AttachEventToElement(window, "unload", function(e) {
8658   ControlUpdateWatcher.Instance.OnWindowUnload(e);
8659  });
8660  ASPx.Evt.AttachEventToDocument("mousedown", function(e) {
8661   ControlUpdateWatcher.Instance.OnMouseDown(e);
8662  });
8663  ASPx.Evt.AttachEventToDocument("focusin", function(e) {
8664   ControlUpdateWatcher.Instance.OnFocusIn(e);
8665  });
8666 }
8667 return ControlUpdateWatcher.Instance;
8668};
8669var UpdateWatcherHelper = ASPx.CreateClass(null, {
8670 constructor: function(owner) {
8671  this.owner = owner;
8672  this.ownerWatcher = ControlUpdateWatcher.getInstance();
8673  this.ownerWatcher.Add(this);
8674 },
8675 GetName: function() {
8676  return this.owner.name;
8677 },
8678 GetControlMainElement: function() {
8679  return this.owner.GetMainElement();
8680 },
8681 GetControlParentForm: function(){
8682  return ASPx.GetParentByTagName(this.GetControlMainElement(), "FORM");
8683 },
8684 CanShowConfirm: function(requestOwnerID) {
8685  return true;
8686 },
8687 HasChanges: function() {
8688  return false;
8689 },
8690 GetConfirmUpdateText: function() {
8691  return "";
8692 },
8693 NeedConfirmOnCallback: function(dxCallbackOwner) {
8694  return true;
8695 },
8696 NeedConfirmOnPostback: function() {
8697  if(ASPx.IsUploadSubmitRequest)
8698   return !ASPx.IsUploadSubmitRequest(this.GetControlParentForm(
8698));
8699  return true;
8700 },
8701 ResetClientChanges: function() {
8702 },
8703 ConfirmOnCustomControlEvent: function() {
8704  var confirmMessage = this.GetConfirmUpdateText();
8705  if(confirmMessage)
8706   return confirm(confirmMessage);
8707  return false;
8708 },
8709 isInUploadCallback: function() {
8710  return false;
8711 }
8712});
8713var ControlTabIndexManager = ASPx.CreateClass(null, {
8714 constructor: function() {
8715  this.elementsWithChangedTabIndex = {};
8716 },
8717 getChangedElementsForControlId: function(id) {
8718  if(!this.elementsWithChangedTabIndex[id])
8719   this.elementsWithChangedTabIndex[id] = [];
8720  return this.elementsWithChangedTabIndex[id];
8721 },
8722 isElementWithChangedIndex: function(element) {
8723  for(var key in this.elementsWithChangedTabIndex)
8724   if(this.elementsWithChangedTabIndex.hasOwnProperty(key))
8725    if(this.elementsWithChangedTabIndex[key].indexOf(element) !== -1)
8726     return true;
8727  return false;
8728 },
8729 changeTabIndexAttribute: function(element, id) {
8730  var elements = this.getChangedElementsForControlId(id);
8731  ASPx.Attr.ChangeTabIndexAttribute(element);
8732  if(elements.indexOf(element) === -1)
8733   elements.push(element);
8734 },
8735 restoreTabIndexAttribute: function(element, id) {
8736  var elements = this.getChangedElementsForControlId(id),
8737   index = elements.indexOf(element);
8738  if(index !== -1) {
8739   elements.splice(index, 1);
8740   if(!this.isElementWithChangedIndex(element))
8741    ASPx.Attr.RestoreTabIndexAttribute(element);
8742  }
8743 }
8744});
8745ControlTabIndexManager.Instance = null;
8746ControlTabIndexManager.getInstance = function() {
8747 if(!ControlTabIndexManager.Instance)
8748  ControlTabIndexManager.Instance = new ControlTabIndexManager();
8749 return ControlTabIndexManager.Instance;
8750};
8751var ControlCallbackHandlersQueue = ASPx.CreateClass(null, {
8752 constructor: function (owner) {
8753  this.owner = owner;
8754  this.handlerInfos = [];
8755 },
8756 addCallbackHandler: function(handlerInfo) {
8757  this.handlerInfos.push(handlerInfo);
8758 },
8759 executeCallbacksHandlers: function() {
8760  for(var i = 0, handlerInfo; handlerInfo = this.handlerInfos[i]; i++)
8761   handlerInfo.handler.call(this.owner, handlerInfo.result);
8762  this.handlerInfos = [];
8763 }
8764});
8765var ControlCallbackQueueHelper = ASPx.CreateClass(null, {
8766 constructor: function (owner) {
8767  this.owner = owner;
8768  this.pendingCallbacks = [];
8769  this.receivedCallbacks = [];
8770  this.attachEvents();
8771 },
8772 showLoadingElements: function () {
8773  this.owner.ShowLoadingDiv();
8774  if (this.owner.IsCallbackAnimationEnabled())
8775   this.owner.StartBeginCallbackAnimation();
8776  else
8777   this.owner.ShowLoadingElementsInternal();
8778 },
8779 attachEvents: function () {
8780  this.owner.EndCallback.AddHandler(this.onEndCallback.aspxBind(this));
8781  this.owner.CallbackError.AddHandler(this.onCallbackError.aspxBind(this));
8782 },
8783 detachEvents: function () {
8784  this.owner.EndCallback.RemoveHandler(this.onEndCallback);
8785  this.owner.CallbackError.RemoveHandler(this.onCallbackError);
8786 },
8787 onCallbackError: function (owner, result) {
8788  this.sendErrorToChildControl(result);
8789 },
8790 ignoreDuplicates: function () {
8791  return true;
8792 },
8793 hasDuplicate: function (arg) {
8794  for (var i in this.pendingCallbacks) {
8795   if (this.pendingCallbacks[i].arg == arg && this.pendingCallbacks[i].state != ASPx.callbackState.aborted)
8796    return true;
8797  }
8798  return false;
8799 },
8800 getToken: function (halperContext, callbackInfo) {
8801  return {
8802   cancel: function () {
8803    if (callbackInfo.state == ASPx.callbackState.sent) {
8804     callbackInfo.state = ASPx.callbackState.aborted;
8805     halperContext.sendNext();
8806    }
8807    if (callbackInfo.state == ASPx.callbackState.inTurn)
8808     ASPx.Data.ArrayRemove(halperContext.pendingCallbacks, callbackInfo);
8809   },
8810   callbackId: -1
8811  };
8812 },
8813 sendCallback: function (arg, handlerContext, handler, commandName, onBeforeSend) {
8814  if (this.ignoreDuplicates() && this.hasDuplicate(arg))
8815   return false;
8816  var handlerContext = handlerContext || this.owner;
8817  var callbackInfo = {
8818   arg: arg,
8819   handlerContext: handlerContext,
8820   handler: handler || handlerContext.OnCallback,
8821   state: ASPx.callbackState.inTurn,
8822   callbackId: -1,
8823   onBeforeSend: onBeforeSend
8824  };
8825  this.pendingCallbacks.push(callbackInfo);
8826  if (!this.hasActiveCallback()) {
8827   this.createCallbackByCallbackInfo(callbackInfo, commandName);
8828  }
8829  return this.getToken(this, callbackInfo);
8830 },
8831 hasActiveCallback: function () {
8832  return this.getCallbacksInfoByState(ASPx.callbackState.sent).length > 0;
8833 },
8834 sendNext: function () {
8835  var nextCallbackInfo = this.getCallbacksInfoByState(ASPx.callbackState.inTurn)[0];
8836  if (nextCallbackInfo) {
8837   this.createCallbackByCallbackInfo(nextCallbackInfo);
8838   return nextCallbackInfo.callbackId;
8839  }
8840 },
8841 createCallbackByCallbackInfo: function(callbackInfo, commandName) {
8842  if(callbackInfo.onBeforeSend)
8843   callbackInfo.onBeforeSend();
8844  callbackInfo.callbackId = this.owner.CreateCallback(callbackInfo.arg, commandName);
8845  callbackInfo.state = ASPx.callbackState.sent;
8846 },
8847 onEndCallback: function () {
8848  if (!this.owner.isErrorOnCallback && this.hasPendingCallbacks()) {
8849   var curCallbackId;
8850   var curCallbackInfo;
8851   var handlerContext;
8852   for (var i in this.receivedCallbacks) {
8853    if(this.receivedCallbacks.hasOwnProperty(i)) {
8854     curCallbackId = this.receivedCallbacks[i];
8855     curCallbackInfo = this.getCallbackInfoById(curCallbackId);
8856     if (curCallbackInfo.state != ASPx.callbackState.aborted) {
8857      handlerContext = curCallbackInfo.handlerContext;
8858      if (handlerContext.OnEndCallback)
8859       handlerContext.OnEndCallback();
8860      this.sendNext();
8861     }
8862     ASPx.Data.ArrayRemove(this.pendingCallbacks, curCallbackInfo);
8863    }
8864   }
8865   ASPx.Data.ArrayClear(this.receivedCallbacks);
8866  }
8867 },
8868 hasPendingCallbacks: function () {
8869  return this.pendingCallbacks && this.pendingCallbacks.length && this.pendingCallbacks.length > 0;
8870 },
8871 processCallback: function (result, callbackId) {
8872  this.receivedCallbacks.push(callbackId);
8873  if (this.hasPendingCallbacks()) {
8874   var callbackInfo = this.getCallbackInfoById(callbackId);
8875   if (callbackInfo.state != ASPx.callbackState.aborted)
8876    callbackInfo.handler.call(callbackInfo.handlerContext, result);
8877  }
8878 },
8879 getCallbackInfoById: function (id) {
8880  for (var i in this.pendingCallbacks) {
8881   if (this.pendingCallbacks[i].callbackId == id)
8882    return this.pendingCallbacks[i];
8883  }
8884 },
8885 getCallbacksInfoByState: function (state) {
8886  var result = [];
8887  for (var i in this.pendingCallbacks) {
8888   if (this.pendingCallbacks[i].state == state)
8889    result.push(this.pendingCallbacks[i]);
8890  }
8891  return result;
8892 },
8893 sendErrorToChildControl: function (callbackObj) {
8894  if (!this.hasPendingCallbacks())
8895   return;
8896  var callbackInfo = this.getCallbackInfoById(callbackObj.callbackId || 0);
8897  if (!callbackInfo)
8898   return;
8899  var hasChildControlHandler = (callbackInfo.handlerContext != this.owner) && callbackInfo.handlerContext.OnCallbackError;
8900  if (hasChildControlHandler)
8901   callbackInfo.handlerContext.OnCallbackError.call(callbackInfo.handlerContext, callbackObj.message, callbackObj.data);
8902 }
8903});
8904var AccessibilityHelperBase = ASPx.CreateClass(null, {
8905 constructor: function(control) {
8906  this.control = control;
8907  this.pronounceMessageTimeout = 500;
8908  this.pronounceIsStarted = false;
8909  this.timerID = -1;
8910 },
8911 PronounceMessage: function(text, activeItemArgs, inactiveItemArgs, mainElementArgs, ownerMainElement) {
8912  this.timerID = ASPx.Timer.ClearTimer(this.timerID);
8913  this.pronounceIsStarted = true;
8914  this.timerID = window.setTimeout(function() {
8915   this.PronounceMessageCore(text, activeItemArgs, inactiveItemArgs, mainElementArgs, ownerMainElement);
8916  }.aspxBind(this), this.getPronounceTimeout());
8917 },
8918 PronounceMessageCore: function(text) {
8919  this.processValidationState();
8920  if(this.control.IsFocused())
8921   this.control.SendMessageToAssistiveTechnology(text);
8922 },
8923 GetActiveElement: function(inputIsMainElement) {
8924  if(this.pronounceIsStarted) return null;
8925  var mainElement = inputIsMainElement ? this.control.GetInputElement() : this.getMainElement();
8926  var activeElementId = ASPx.Attr.GetAttribute(mainElement, 'aria-activedescendant');
8927  return activeElementId ? ASPx.GetElementById(activeElementId) : mainElement;
8928 },
8929 GetPronounceElement: function() { return null; },
8930 processValidationState: function() {
8931  var errorTextElement = null;
8932  if(this.control.GetErrorCell())
8933   errorTextElement = this.getAriaExplanatoryTextManager().GetErrorTextElement();
8934  var input = this.getInputElement();
8935  var invalidArg =  { "aria-invalid": !this.control.isValid ? "true" : "" };
8936  this.changeActivityAttributes(input, invalidArg);
8937  if(errorTextElement)
8938   this.getAriaExplanatoryTextManager().SetOrRemoveText([input], errorTextElement, !this.control.isValid, false, true);
8939 },
8940 getMainElement: function() {
8941  if(!ASPx.IsExistsElement(this.mainElement))
8942   this.mainElement = this.control.GetAccessibilityAssistantElement();
8943  return this.mainElement;
8944 },
8945 changeActivityAttributes: function(element, args) {
8946  if(!element)
8947   return;
8948  for(var key in args) {
8949   if(args.hasOwnProperty(key)) {
8950    var value = args[key];
8951    if(key == "innerHtml")
8952     ASPx.SetInnerHtml(element, value);
8953    else {
8954     var action = value !== "" ? ASPx.Attr.SetAttribute : ASPx.Attr.RemoveAttribute;
8955     action(element, key, value);
8956    }
8957   }
8958  }
8959 },
8960 getPronounceTimeout: function() { return this.pronounceMessageTimeout; },
8961 getInputElement: function() { return this.control.GetInputElement(); },
8962 getAriaExplanatoryTextManager: function() { return this.control.ariaExplanatoryTextManager; }
8963});
8964var AccessibilityHelper = ASPx.CreateClass(AccessibilityHelperBase, {
8965 constructor: function(control) {
8966  this.constructor.prototype.constructor.call(this, control);
8967  this.activeItem = this.getItems()[0];
8968 },
8969 PronounceMessageCore: function(text, activeItemArgs, inactiveItemArgs, mainElementArgs, ownerMainElement) {
8970  if(!this.getItems())
8971   return;
8972  this.toogleItem();
8973  var mainElement = this.getMainElement();
8974  var activeItem = this.getItem(true);
8975  var inactiveItem = this.getItem();
8976  if(ASPx.Attr.GetAttribute(mainElement, "role") != "application")
8977   mainElementArgs = this.addArguments(mainElementArgs, { "aria-activedescendant" : activeItem.id });
8978  var messageAttrObj = {};
8979  var activeItemRole = ASPx.Attr.GetAttribute(activeItem, "role");
8980  var attrName = activeItemRole == "combobox" ? "aria-label" : "innerHtml";
8981  messageAttrObj[attrName] = ASPx.Str.EncodeHtml(text);
8982  activeItemArgs = this.addArguments(activeItemArgs, messageAttrObj);
8983  messageAttrObj[attrName] = "";
8984  inactiveItemArgs = this.addArguments(inactiveItemArgs, messageAttrObj);
8985  var errorTextElement = null;
8986  if(this.control.GetErrorCell()) {
8987   errorTextElement = this.getAriaExplanatoryTextManager().GetErrorTextElement();
8988   activeItemArgs = this.addArguments(activeItemArgs,   {"aria-invalid"  : !this.control.isValid ? "true" : "" });
8989   mainElementArgs = this.addArguments(mainElementArgs, { "aria-invalid" : "" });
8990   inactiveItemArgs = this.addArguments(inactiveItemArgs,  { "aria-invalid" : "" });
8991  }
8992  this.changeActivityAttributes(activeItem, activeItemArgs);
8993  if(errorTextElement) {
8994   this.getAriaExplanatoryTextManager().SetOrRemoveText([activeItem], errorTextElement, !this.control.isValid, false, true);
8995   this.getAriaExplanatoryTextManager().SetOrRemoveText([mainElement, inactiveItem], errorTextElement, false, false, false);
8996  }
8997  this.changeActivityAttributes(mainElement, mainElementArgs);
8998  if(!!ownerMainElement && ASPx.Attr.GetAttribute(ownerMainElement, "role") != "application")
8999   this.changeActivityAttributes(ownerMainElement, { "aria-activedescendant": activeItem.id });
9000  this.changeActivityAttributes(inactiveItem, inactiveItemArgs);
9001  this.pronounceIsStarted = false;
9002 },
9003 GetPronounceElement: function() {
9004  return this.getItem(true);
9005 },
9006 getItems: function() {
9007  if(!ASPx.IsExistsElement(this.items))
9008   this.items = ASPx.GetChildElementNodes(this.getMainElement());
9009  return this.items;
9010 },
9011 getItem: function(isActive) {
9012  if(isActive)
9013   return this.activeItem;
9014  var items = this.getItems();
9015  return items[0] === this.activeItem ? items[1] : items[0];
9016 },
9017 toogleItem: function() {
9018  this.activeItem = this.getItem();
9019 },
9020 addArguments: function(targetArgs, newArgs) {
9021  if(!targetArgs) targetArgs = { };
9022  for(var key in newArgs) {
9023   if(newArgs.hasOwnProperty(key) && !targetArgs.hasOwnProperty(key))
9024    targetArgs[key] = newArgs[key];
9025  }
9026  return targetArgs;
9027 }
9028});
9029var AccessibilityPronouncer = ASPx.CreateClass(null, {
9030 constructor: function() {
9031  this.pronouncerId = "dxPronouncer";
9032  this.initialized = false;
9033  this.focusableMessageElement = null;
9034  this.messageElement = null;
9035  this.pronouncers = {
9036   live: new AccessibilityLivePronouncer(this),
9037   descendant: new AccessibilityDescendantPronouncer(this)
9038  };
9039 },
9040 Pronounce: function(args, type) {
9041  this.pronouncers[type].Pronounce(args);
9042 },
9043 EnsureInitialize: function() {
9044  if(!this.initialized)
9045   this.initialize();
9046 },
9047 RemoveState: function() {
9048  for(var pronouncer in this.pronouncers)
9049   if(this.pronouncers.hasOwnProperty(pronouncer))
9050    pronouncer.RemoveState();
9051 },
9052 RestoreControlState: function(type, mainElement) {
9053  this.pronouncers[type].RestoreControlState(mainElement);
9054 },
9055 RestoreElementsState: function(type, elements) {
9056  this.pronouncers[type].RestoreElementsState(elements);
9057 },
9058 RestoreElementState: function(type, element) {
9059  this.pronouncers[type].RestoreElementState(element);
9060 },
9061 initialize: function() {
9062  this.createFocusableMessageElement();
9063  this.createMessageElement();
9064  this.prepareFocusableMessageElement();
9065  this.setAttributesForKeyboardNavigation();
9066  this.initialized = true;
9067 },
9068 createFocusableMessageElement: function() {
9069  var focusableMessageElement = document.createElement("DIV");
9070  document.body.appendChild(focusableMessageElement);
9071  this.focusableMessageElement = focusableMessageElement;   
9072 },
9073 prepareFocusableMessageElement: function() {
9074  this.focusableMessageElement.className = "dxAIFME";
9075 },
9076 setAttributesForKeyboardNavigation: function() {
9077  ASPx.Attr.Aria.SetApplicationRole(this.focusableMessageElement);
9078  ASPx.Attr.Aria.SetSilence(this.focusableMessageElement);
9079 },
9080 createMessageElement: function() {
9081  var messageElement = document.createElement("DIV");
9082  messageElement.id = this.pronouncerId;
9083  ASPx.Attr.SetAttribute(messageElement, "role", "note");
9084  this.focusableMessageElement.appendChild(messageElement);
9085  this.messageElement = messageElement;
9086 },
9087 getMessage: function(messagePartsArg) {
9088  var messageParts = messagePartsArg.filter(function(x) { return ASPx.IsExists(x); });
9089  return messageParts.join(", ");
9090 }
9091});
9092var AccessibilityPronouncerBase = ASPx.CreateClass(null, {
9093 constructor: function() {
9094  this.state = { };
9095 },
9096 Pronounce: function(args) {
9097  var messageElement = this.getMessageElement();
9098  ASPx.Attr.Aria.SetOrRemoveLabel(messageElement);
9099  ASPx.SetInnerHtml(messageElement, "");
9100  this.PronounceCore(args);
9101 },
9102 PronounceCore: function(args) { },
9103 SaveElementState: function(element) { 
9104  if(this.state[element.id])
9105   return;
9106  this.state[element.id] = {
9107   element: element,
9108   descendant: ASPx.Attr.GetAttribute(element, ASPx.Attr.Aria.descendant)
9109  };
9110 },
9111 RemoveState: function() {
9112  this.state = { };
9113 },
9114 RestoreControlState: function(mainElement) { 
9115  for(var elementInfo in this.state) {
9116   if(this.state.hasOwnProperty(elementInfo)) {
9117    var element = this.state[elementInfo].element;
9118    if(!mainElement || ASPx.GetIsParent(mainElement, element))
9119     this.RestoreElementState(element);
9120   }
9121  }
9122 },
9123 RestoreElementsState: function(elements) { 
9124  for(var i = 0; i < elements.length; i++)
9125   this.RestoreElementState(elements[i]);
9126 },
9127 RestoreElementState: function(element) {
9128  var elementState = this.state[element.id];
9129  if(!elementState)
9130   return;
9131  ASPx.Attr.Aria.SetOrRemoveDescendant(element, elementState.descendant);
9132  delete this.state[element.id];
9133 },
9134 getMessage: function(args) {
9135  return ASPx.AccessibilityPronouncer.getMessage(args.messageParts);
9136 },
9137 getMessageElement: function() {
9138  return ASPx.AccessibilityPronouncer.messageElement;
9139 },
9140 getFocusableMessageElement: function() {
9141   return ASPx.AccessibilityPronouncer.focusableMessageElement;
9142 }
9143});
9144var AccessibilityLivePronouncer = ASPx.CreateClass(AccessibilityPronouncerBase, {
9145 constructor: function() {
9146  this.constructor.prototype.constructor.call(this);
9147 },
9148 PronounceCore: function(args) {
9149  var message = this.getMessage(args);
9150  var messageElement = this.getMessageElement();
9151  ASPx.Attr.SetAttribute(this.getFocusableMessageElement(), "aria-live", "assertive");
9152  ASPx.Attr.Aria.SetAtomic(this.getFocusableMessageElement(), "true");
9153  ASPx.SetInnerHtml(messageElement, ASPx.Str.EncodeHtml(message));
9154 }
9155});
9156var AccessibilityDescendantPronouncer = ASPx.CreateClass(AccessibilityPronouncerBase, {
9157 constructor: function() {
9158  this.constructor.prototype.constructor.call(this);
9159 },
9160 PronounceCore: function(args) {
9161  var message = this.getMessage(args);
9162  var activeElement = ASPx.GetActiveElement();
9163  var messageElement = this.getMessageElement();
9164  this.SaveElementState(activeElement);
9165  ASPx.Attr.RemoveAttribute(this.getFocusableMessageElement(), "aria-live");
9166  ASPx.Attr.RemoveAttribute(this.getFocusableMessageElement(), "aria-atomic");
9167  ASPx.Attr.Aria.SetOrRemoveLabel(messageElement, message);
9168  ASPx.Attr.Aria.SetOrRemoveDescendant(activeElement, messageElement.id);
9169 }
9170});
9171ASPx.AccessibilityPronouncerType = {
9172 live: "live",
9173 descendant: "descendant"
9174};
9175ASPx.AccessibilityPronouncer = new AccessibilityPronouncer();
9176var RestoreFocusHelper = ASPx.CreateClass(null, {
9177 constructor: function() {
9178  this.excludedIDs = [ "DXCBtn" ]; 
9179  this.pronouncerType = ASPx.AccessibilityPronouncerType.live;
9180  this.callbackQueue = [];
9181  this.Initialize();
9182 },
9183 Initialize: function() {
9184  var that = this;
9185  ASPx.attachToLoad(function() {
9186   ASPxClientControl.GetControlCollection().BeginCallback.AddHandler(that.OnBeginCallback, that);
9187   ASPxClientControl.GetControlCollection().EndCallback.AddHandler(that.OnEndCallback, that);
9188  });
9189 },
9190 OnBeginCallback: function(s, e) {
9191  var control = e.control;
9192  if(!control.allowRestoreFocusOnCallbacks())
9193   return;
9194  control.accessibilityFocusTreeLine = this.getFocusTreeLine(control);
9195  var controlHasCallbackTreeLine = this.callbackQueueContainsTreeLine(control);
9196  this.pushTreeLineInfoIntoCallbackQueue(control);
9197  if(control.accessibilityFocusTreeLine && !controlHasCallbackTreeLine)
9198   control.SendMessageToAssistiveTechnology(this.getDefaultCallbackMessage());
9199 },
9200 OnEndCallback: function(s, e) {
9201  var control = e.control;
9202  if(!control.allowRestoreFocusOnCallbacks())
9203   return;
9204  var treeLineInfo = this.shiftTreeLineInfoFromCallbackQueue(control);
9205  if(treeLineInfo.queueLength == 0) {
9206   if(!control.accessibilityFocusTreeLine && treeLineInfo.treeLine)
9207    control.accessibilityFocusTreeLine = treeLineInfo.treeLine;
9208   var focusElement = this.findFocusElement(control);
9209   var focusIsManagerByPopupwindow = this.isFocusManagedByActivePopupWindow(focusElement);
9210   var focusIsManagedByControl = control.shouldPreventFocusRestoringOnCallback && control.shouldPreventFocusRestoringOnCallback();
9211   if(!focusIsManagerByPopupwindow && !focusIsManagedByControl)
9212    ASPx.AccessibilityUtils.SetFocusAccessible(focusElement);
9213   delete control.accessibilityFocusTreeLine;
9214  }
9215 },
9216 pushTreeLineInfoIntoCallbackQueue: function(control) {
9217  var controlTreeLine = control.accessibilityFocusTreeLine ? control.accessibilityFocusTreeLine.slice(0) : null;
9218  if(!this.callbackQueue[control.name])
9219   this.callbackQueue[control.name] = [];
9220  this.callbackQueue[control.name].push(controlTreeLine);
9221 },
9222 shiftTreeLineInfoFromCallbackQueue: function(control) {
9223  var treeLineInfo = { queueLength: 0, treeLine: null };
9224  var treeLines = this.callbackQueue[control.name];
9225  if(treeLines && treeLines.length > 0) {
9226   treeLineInfo.treeLine = treeLines.shift();
9227   var linesCount = treeLines.length;
9228   treeLineInfo.queueLength = linesCount;
9229   if(linesCount > 0 && !treeLines[0] && treeLineInfo.treeLine)
9230    treeLines[0] = treeLineInfo.treeLine.slice(0);
9231  }
9232  return treeLineInfo;
9233 },
9234 callbackQueueContainsTreeLine: function(control) {
9235  var treeLines = this.callbackQueue[control.name];
9236  if(!treeLines || treeLines.length == 0) 
9237   return false;
9238  if(treeLines[treeLines.length - 1])
9239   return true;
9240  return false;
9241 },
9242 getDefaultCallbackMessage: function() {
9243  return ASPx.AccessibilitySR.DefaultCallbackMessage;
9244 },
9245 isFocusManagedByActivePopupWindow: function(focusElement) {
9246  var popupControl = this.getActivePopupControl();
9247  if(!popupControl || popupControl.accessibleFocusElement)
9248   return false;
9249  this.initializePopupAccessibleFocusElement(popupControl, focusElement);
9250  return popupControl.setFocusOnCallback;
9251 },
9252 getActivePopupControl: function() {
9253  var activePopupWindow = ASPx.GetPopupControlCollection && ASPx.GetPopupControlCollection().GetCurrentActiveWindowElement();
9254  if(!activePopupWindow)
9255   return null;
9256  var popupInfo = ASPx.GetPopupControlCollection().GetPopupWindowFromID(activePopupWindow.id);
9257  return popupInfo.popupControl;
9258 },
9259 initializePopupAccessibleFocusElement: function(popupControl, focusElement) {
9260  if(popupControl.setFocusOnCallback)
9261   popupControl.accessibleFocusElement = focusElement;
9262  else {
9263   var parentControl = popupControl.GetParentControl();
9264   if(parentControl && parentControl.GetMainElement())
9265    popupControl.accessibleFocusElement = ASPx.FindFirstChildActionElement(parentControl.GetMainElement());
9266  }
9267 },
9268 getFocusTreeLine: function(control) {
9269  var element = ASPx.GetActiveElement();
9270  if(!ASPx.IsExistsElement(element))
9271   return null;
9272  var mainElement = control.GetMainElement();
9273  if(!ASPx.GetIsParent(mainElement, element)) {
9274   var treeInfo = this.findFocusedControlElement(mainElement, element);
9275   element = treeInfo.focusElement;
9276   mainElement = treeInfo.rootElement;
9277  }
9278  return this.getTreeLineCore(mainElement, element);
9279 },
9280 getTreeLineCore: function(mainElement, element) {
9281  if(!element) return null;
9282  treeLine = [ ];
9283  while(element) {
9284   treeLine.push({ 
9285    id: element.id,
9286    tagName: element.tagName,
9287    index: ASPx.Data.ArrayIndexOf(element.parentNode.childNodes, element)
9288   });
9289   if(element === mainElement || element === document.body)
9290    break;
9291   element = element.parentNode;
9292  }
9293  return treeLine;
9294 },
9295 findFocusedControlElement: function(mainElement, activeElement) {
9296  var element = null;
9297  var parentElement = mainElement;
9298  var focusedEditor = ASPx.IsExists(ASPx.GetFocusedEditor) ? ASPx.GetFocusedEditor() : null;
9299  if(focusedEditor && ASPx.GetIsParent(mainElement, focusedEditor.GetMainElement()))
9300   element = focusedEditor.GetFocusableInputElement();
9301  else {
9302   if(mainElement && activeElement) {
9303    var mainControl = ASPx.GetClientControlByElementID(mainElement.id);
9304    var parentControls = ASPx.GetParentClientControls(activeElement.id);
9305    for(var i = parentControls.length - 1; i > -1; i--) {   
9306     if(mainControl.name == parentControls[i].name) {
9307      element = activeElement;
9308      var rootIndex = i > 0 ? i - 1 : i;
9309      parentElement = parentControls[rootIndex].GetMainElement();
9310      if(!parentElement && parentControls[rootIndex].GetCurrentWindowElement)
9311       parentElement = parentControls[rootIndex].GetCurrentWindowElement();
9312      break;
9313     }
9314    }
9315   }
9316  }
9317  return { focusElement: element, rootElement: parentElement }; 
9318 },
9319 findFocusElement: function(control) {
9320  if(!control.accessibilityFocusTreeLine)
9321   return;
9322  var treeLine = control.accessibilityFocusTreeLine.slice(0);
9323  var focusElementParent = this.findFocusElementParentById(treeLine);
9324  if(!focusElementParent) 
9325   return;
9326  return this.findFocusElementFromDOMTree(treeLine, focusElementParent);
9327 },
9328 findFocusElementParentById: function(treeLine) {
9329  for(var i = 0; i < treeLine.length; i++) {
9330   var id = treeLine[i].id;
9331   if(!this.isValidId(id))
9332    continue;
9333   var element = document.getElementById(id);
9334   if(element) {
9335    treeLine.splice(i, treeLine.length - i);
9336    treeLine.reverse();
9337    return element;
9338   }
9339  }
9340  return null;
9341 },
9342 findFocusElementFromDOMTree: function(treeLine, focusElementParent) {
9343  var element = focusElementParent;
9344  for(var i = 0; i < treeLine.length; i++) {
9345   var info = treeLine[i];
9346   if(info.index >= element.childNodes.length) {
9347    element = element.childNodes.length > 0 ? element.childNodes[element.childNodes.length - 1] : null;
9348    return this.findNeighbourFocusElement(element, focusElementParent);
9349   }
9350   var child = element.childNodes[info.index];
9351   if(child.tagName !== info.tagName)
9352    return this.findNeighbourFocusElement(child, focusElementParent);
9353   element = child;
9354  }
9355  return element;
9356 },
9357 findNeighbourFocusElement: function(element, focusElementParent) {
9358  ASPx.ActionElementsCache.BeginUsage();
9359  var result = this.findNeighbourFocusElementCore(element, focusElementParent);
9360  ASPx.ActionElementsCache.EndUsage();
9361  return result;
9362 },
9363 findNeighbourFocusElementCore: function(element, focusElementParent) {
9364  if(!element || !element.parentNode) return null;
9365  var neighbours = element.parentNode.childNodes;
9366  var indices = this.calcLeftRightIndices(ASPx.Data.ArrayIndexOf(neighbours, element), neighbours.length);
9367  for(var i = 0; i < indices.length; i++) {
9368   var index = indices[i];
9369   var actionElement = ASPx.FindFirstChildActionElement(neighbours[index]);
9370   if(actionElement)
9371    return actionElement;
9372  }
9373  if(element === focusElementParent)
9374   return null;
9375  return this.findNeighbourFocusElement(element.parentNode, focusElementParent);
9376 },
9377 calcLeftRightIndices: function(startIndex, count) {
9378  var indices = [ ];
9379  var incSides = [ 0, 0 ];
9380  var index = startIndex;
9381  for(var i = 0; i < count; i++) {
9382   indices.push(index);
9383   var even = i % 2 === 0;
9384   var nextIndex = this.calcNextIndex(startIndex, count, incSides, even);
9385   if(nextIndex < 0)
9386    nextIndex = this.calcNextIndex(startIndex, count, incSides, !even);
9387   index = nextIndex;
9388  }
9389  return indices;
9390 },
9391 calcNextIndex: function(startIndex, count, incSides, even) {
9392  var sideIndex = even ? 0 : 1;
9393  var inc = incSides[sideIndex];
9394  inc += even ? -1 : 1;
9395  var nextIndex = startIndex + inc;
9396  if(nextIndex >= 0 && nextIndex < count) {
9397   incSides[sideIndex] = inc;
9398   return nextIndex;
9399  }
9400  return -1;
9401 },
9402 isValidId: function(id) {
9403  return id && !this.isExcludedId(id);
9404 },
9405 isExcludedId: function(id) {
9406  var result = false;
9407  for(var i = 0; i < this.excludedIDs.length; i++) {
9408   if(id.indexOf(this.excludedIDs[i]) > -1) {
9409    result = true;
9410    break;
9411   }
9412  }
9413  return result;
9414 }
9415});
9416var EventStorage = ASPx.CreateClass(null, {
9417 constructor: function() {
9418  this.bag = { };
9419 },
9420 Save: function(e, data, overwrite) {
9421  var key = this.getEventKey(e);
9422  if(this.bag.hasOwnProperty(key) && !overwrite)
9423   return;
9424  this.bag[key] = data;
9425  window.setTimeout(function() { delete this.bag[key]; }.aspxBind(this), 100);
9426 },
9427 Load: function(e) {
9428  var key = this.getEventKey(e);
9429  return this.bag[key];
9430 },
9431 getEventKey: function(e) {
9432  if(ASPx.IsExists(e.timeStamp))
9433   return e.timeStamp.toString();
9434  var eventSource = ASPx.Evt.GetEventSource(e);
9435  var type = e.type.toString();
9436  return eventSource ? type + "_" + eventSource.uniqueID.toString() : type;
9437 }
9438});
9439ASPx.RestoreFocusHelper = new RestoreFocusHelper();
9440EventStorage.Instance = null;
9441EventStorage.getInstance = function() {
9442 if(!EventStorage.Instance)
9443  EventStorage.Instance = new EventStorage();
9444 return EventStorage.Instance;
9445};
9446var GetGlobalObject = function(objectName) {
9447 var fields = objectName.split('.');
9448 var obj = window[fields[0]];
9449 for(var i = 1;
9449 obj && i < fields.length; i++) {
9450  obj = obj[fields[i]];
9451 }
9452 return obj;
9453};
9454var GetExternalScriptProcessor = function() {
9455 return ASPx.ExternalScriptProcessor ? ASPx.ExternalScriptProcessor.getInstance() : null;
9456};
9457var SAVED_WIDTH_ATTR = "data-dx-ripple-saved-width";
9458var RIPPLE_FIXED_ROW_ATTR = "data-dx-ripple-locked";
9459var READ_ONLY_COMBOBOX_MARKER_CSS_CLASS = "dxICBReadonlyMarker";
9460var ThemesWithRipple = ['Material'];
9461var RippleHelper = {
9462 rippleTargetClassName: "dxRippleTarget",
9463 rippleTargetExternalClassName: "dxRippleTargetExternal",
9464 rippleContainerClassName: "dxRippleContainer",
9465 rippleClassName: "dxRipple",
9466 touchRadius: -1,
9467 isMobileExternalRipple: null,
9468 zoom: 1,
9469 Init: function() {
9470  if(this.getIsRippleFunctionalityEnabled()) {
9471   setTimeout(function() {
9472    this.calcTouchRadius();
9473   }.aspxBind(this), 0);
9474  }
9475 },
9476 calcTouchRadius: function() {
9477  var testBlock = document.createElement("DIV");
9478  ASPx.SetStyles(testBlock, {
9479   height: "1in",
9480   width: "1in",
9481   left: "-100%",
9482   top: "-100%",
9483   position: "absolute"
9484  });
9485  document.body.appendChild(testBlock);
9486  this.touchRadius = (1.8 / 2.54) * Math.max(testBlock.offsetWidth, testBlock.offsetHeight);
9487  document.body.removeChild(testBlock);
9488 },
9489 isRippleFunctionalityEnabled: null,
9490 checkRippleFunctionality: function() {
9491  if(ASPx.Browser.Safari && ASPx.Browser.Version <= 5.1)
9492   return false;
9493  for(var i = 0; i < ThemesWithRipple.length; i++) {
9494   var firstRippleThemeElement = document.querySelector("[class*='_" + ThemesWithRipple[i] + "']");
9495   if(firstRippleThemeElement)
9496    return true;
9497  }  
9498  return false;
9499 },
9500 ReInit: function() {
9501  this.isRippleFunctionalityEnabled = null;
9502  this.Init();
9503 },
9504 onDocumentMouseDown: function(evt) {
9505  if(RippleHelper.getIsRippleFunctionalityEnabled())
9506   RippleHelper.processMouseDown(evt);
9507 },
9508 getIsRippleFunctionalityEnabled: function() {
9509  if(!ASPx.IsExists(this.isRippleFunctionalityEnabled))
9510   this.isRippleFunctionalityEnabled = this.checkRippleFunctionality();
9511  return this.isRippleFunctionalityEnabled;
9512 },
9513   createTargetInfo: function(target) {
9514  return { 
9515   x: ASPx.GetAbsoluteX(target),
9516   y: ASPx.GetAbsoluteY(target),
9517   width: target.offsetWidth,
9518   height: target.offsetHeight,
9519   classNames: ASPx.GetClassNameList(target),
9520   getTarget: function() { return target; },
9521   getRect: function() { return {x: this.x, y: this.y, width: this.width, height: this.height }; }
9522  };
9523 },
9524 createEventInfo: function(evt) {
9525  return { x: this.getEventX(evt), y: this.getEventY(evt) };
9526 },
9527 processMouseDown: function(evt) {
9528  var evtSource = ASPx.Evt.GetEventSource(evt);
9529  var rippleTarget = this.getRippleTargetElement(evtSource);
9530  if(this.needToProcessRipple(rippleTarget, evtSource))
9531   this.processRipple(this.createTargetInfo(rippleTarget), this.createEventInfo(evt));
9532 },
9533 getRippleTargetElement: function(evtSource) {
9534  if(this.hasRippleMarker(evtSource))
9535   return evtSource;
9536  if(evtSource.tagName && evtSource.tagName.toLowerCase() == "input" && ASPx.ElementContainsCssClass(evtSource, "dxTI")) {
9537   var elements = ASPx.GetChildElementNodesByPredicate(evtSource.parentNode.parentNode, function(element) {
9538    return this.hasRippleMarker(element);
9539   }.aspxBind(this));
9540   return elements && elements[0];
9541  }
9542  return ASPx.GetParent(evtSource, function(element) {
9543   return this.hasRippleMarker(element);
9544  }.aspxBind(this));
9545 },
9546 hasRippleMarker: function(element) {
9547  if(!ASPx.IsExistsElement(element))
9548   return false;
9549  var computedStyles = window.getComputedStyle(element, ":before");
9550  if(ASPx.IsExists(computedStyles)) {
9551   var content = computedStyles.getPropertyValue("content");
9552   if(content.indexOf(this.rippleTargetExternalClassName) > -1) {
9553    ASPx.AddClassNameToElement(element, this.rippleTargetExternalClassName);
9554    return true;
9555   }
9556   return content.indexOf(this.rippleTargetClassName) > -1;
9557  }
9558  return false;
9559 },
9560 needToProcessRipple: function(rippleTarget, evtSource) {
9561  if(!rippleTarget || !ASPx.AnimationUtils)
9562   return false;
9563  var isClearButton = ASPx.ElementContainsCssClass(rippleTarget, "dxeButton") && rippleTarget.id && rippleTarget.id.indexOf("B-100") !== -1;
9564  var isEmptyCalendarDay = ASPx.ElementContainsCssClass(rippleTarget, "dxeCalendarDay") && ASPx.Str.Trim(rippleTarget.textContent) == "";
9565  var isReadonly = ASPx.ElementContainsCssClass(rippleTarget, READ_ONLY_COMBOBOX_MARKER_CSS_CLASS);
9566  var tempFixDisable = ASPx.ElementContainsCssClass(rippleTarget, "dxSwitcher") && ASPx.Browser.MacOSMobilePlatform;
9567  var rippleIsForbidden = isReadonly || isClearButton || isEmptyCalendarDay || ASPx.GetParentByPartialClassName(rippleTarget, "Disabled") ||
9568   ASPx.ElementContainsCssClass(rippleTarget, "dxgvBatchEditCell") || ASPx.ElementContainsCssClass(rippleTarget, "dxcvEditForm") ||
9569   ASPx.GetParentByPartialClassName(evtSource, "dxcvFocusedCell") || tempFixDisable;
9570  return !rippleIsForbidden;
9571 },
9572 hasBothOverflow: function(style) {
9573  return style.overflow == "scroll" || style.overflow == "auto" || style.overflow == "hidden";
9574 },
9575 hasOverflowX: function(style) {
9576  return style.overflowX == "scroll" || style.overflowX == "auto" || style.overflowX == "hidden";
9577 },
9578 hasOverflowY: function(style) {
9579  return style.overflowY == "scroll" || style.overflowY == "auto" || style.overflowY == "hidden";
9580 },
9581 getExternalRippleContainerSize: function(targetRect) {
9582  if(ASPx.Browser.MobileUI) {
9583   var origTouchRadius = this.getOriginTouchRadius();
9584   if(origTouchRadius < targetRect.width || origTouchRadius < targetRect.height)
9585    origTouchRadius = Math.max(targetRect.width, targetRect.height);
9586   return {x: targetRect.x + (targetRect.width - origTouchRadius) / 2, y: targetRect.y + (targetRect.height - origTouchRadius) / 2, width: origTouchRadius, height: origTouchRadius };
9587  }
9588  var result = { x: 0, y: 0, width: 0, height: 0 };
9589  var diff = targetRect.width - targetRect.height;
9590  if(diff > 0) {
9591   result.x = targetRect.x;
9592   result.y = targetRect.y - diff / 2;
9593   result.width = targetRect.width;
9594   result.height = targetRect.width;
9595  } else {
9596   result.x = targetRect.x + diff / 2;
9597   result.y = targetRect.y;
9598   result.width = targetRect.height;
9599   result.height = targetRect.height;
9600  }
9601  return result;
9602 },
9603 getInternalContainerSize: function(targetInfo) {
9604  var parentWithOverflow = RippleHelper.getParentWithOverflow(targetInfo.getTarget());
9605  if(!ASPx.IsExists(parentWithOverflow))
9606   return targetInfo;
9607  var parentWithOverflowStyle = ASPx.GetCurrentStyle(parentWithOverflow);
9608  var bothOverflow = this.hasBothOverflow(parentWithOverflowStyle);
9609  var overflowX = this.hasOverflowX(parentWithOverflowStyle);
9610  var overflowY = this.hasOverflowY(parentWithOverflowStyle);
9611  var parentRect = {
9612   x: ASPx.GetAbsoluteX(parentWithOverflow),
9613   y: ASPx.GetAbsoluteY(parentWithOverflow),
9614   width: parentWithOverflow.offsetWidth,
9615   height: parentWithOverflow.offsetHeight
9616  };
9617  return this.getInternalContainerSizeCore(targetInfo, parentRect, bothOverflow, overflowX, overflowY);
9618 },
9619 getInternalContainerSizeCore: function(targetRect, parentRect, bothOverflow, overflowX, overflowY) {
9620  var result = {};
9621  ASPx.Data.MergeHashTables(result, targetRect);
9622  if(bothOverflow || overflowX) {
9623   result.x = targetRect.x < parentRect.x ? parentRect.x : targetRect.x;
9624   if(targetRect.x + targetRect.width > parentRect.x + parentRect.width)
9625    result.width = parentRect.x + parentRect.width - targetRect.x;
9626   if(parentRect.x > targetRect.x)
9627    result.width -= (parentRect.x - targetRect.x);
9628  }
9629  if(bothOverflow || overflowY) {
9630   result.y = targetRect.y < parentRect.y ? parentRect.y : targetRect.y;
9631   if(targetRect.y + targetRect.height > parentRect.y + parentRect.height)
9632    result.height = parentRect.y + parentRect.height - targetRect.y;
9633   if(parentRect.y > targetRect.y)
9634    result.height -= (parentRect.y - targetRect.y);
9635  }
9636  return result;
9637 },
9638 calculateRippleContainerSize: function(targetInfo, isExternalRipple) {
9639  return isExternalRipple ? this.getExternalRippleContainerSize(targetInfo) : this.getInternalContainerSize(targetInfo);
9640 },
9641 getParentWithOverflow: function(rippleTarget) {
9642  var result = ASPx.GetParent(rippleTarget, function(element) {
9643   var elementStyle = ASPx.GetCurrentStyle(element);
9644   return this.hasBothOverflow(elementStyle) || this.hasOverflowX(elementStyle) || this.hasOverflowY(elementStyle);
9645  }.aspxBind(this));
9646  return result;
9647 },
9648 getDuration: function(targetInfo) {
9649  return this.IsExternalRipple(targetInfo) || ASPx.Browser.MobileUI ? 650 : 450;
9650 },
9651 createRippleTransition: function(container, rippleElement, radius, targetInfo) {
9652  var rippleSize = 2 * radius;
9653  var transitionProperties = {
9654   width: { from: 0, to: rippleSize, transition: ASPx.AnimationConstants.Transitions.RIPPLE, propName: "width", unit: "px" },
9655   height: { from: 0, to: rippleSize, transition: ASPx.AnimationConstants.Transitions.RIPPLE, propName: "height", unit: "px" },
9656   marginLeft: { from: 0, to: -rippleSize / 2, transition: ASPx.AnimationConstants.Transitions.RIPPLE, propName: "marginLeft", unit: "px" },
9657   marginTop: { from: 0, to: -rippleSize / 2, transition: ASPx.AnimationConstants.Transitions.RIPPLE, propName: "marginTop", unit: "px" },
9658   opacity: { from: 1, to: 0.05, transition: ASPx.AnimationConstants.Transitions.RIPPLE, propName: "o
9658pacity", unit: "%" }
9659  };
9660  var rippleTransition = ASPx.AnimationUtils.createMultipleAnimationTransition(rippleElement, {
9661   transition: ASPx.AnimationConstants.Transitions.RIPPLE,
9662   duration: this.getDuration(targetInfo),
9663   needForceTransitionEndByTimerFlag: true, 
9664   onComplete: function() {
9665    this.RemoveRippleContainer(container.parentElement);
9666   }.bind(this)
9667  });
9668  rippleTransition.Start(transitionProperties);
9669 },
9670 needForceTransitionEndByTimer: function() { return true; }, 
9671 calculateRadius: function(isExternalRipple, posX, posY, containerRect) {
9672  var radius = -1;
9673  if(isExternalRipple) {
9674   if(ASPx.Browser.MobileUI)
9675    radius = this.getOriginTouchRadius() / 2;
9676   else
9677    radius = Math.max(containerRect.height, containerRect.width);
9678  } else {
9679   var width1 = posX - containerRect.x;
9680   var width2 = containerRect.width - width1;
9681   var height1 = posY - containerRect.y;
9682   var height2 = containerRect.height - height1;
9683   var rippleWidth = Math.max(width1, width2);
9684   var rippleHeight = Math.max(height1, height2);
9685   radius = Math.sqrt(Math.pow(rippleHeight, 2) + Math.pow(rippleWidth, 2));
9686  }
9687  return radius;
9688 },
9689 createRippleElement: function(container, rippleCenter) {
9690  var rippleElement = document.createElement("DIV");
9691  rippleElement.className = this.rippleClassName;
9692  container.appendChild(rippleElement);
9693  ASPxClientUtils.SetAbsoluteX(rippleElement, rippleCenter.x);
9694  ASPxClientUtils.SetAbsoluteY(rippleElement, rippleCenter.y);
9695  return rippleElement;
9696 },
9697 processRipple: function(targetInfo, eventInfo) {
9698  this.initRippleProcess();
9699  var isExternalRipple = this.IsExternalRipple(targetInfo);
9700  var rippleCenter = this.getRippleCenter(targetInfo.getRect(), eventInfo, isExternalRipple);
9701  var container = this.createRippleContainer(targetInfo, isExternalRipple);
9702  var rippleElement = this.createRippleElement(container, rippleCenter);
9703  var radius = this.calculateRadius(isExternalRipple, rippleCenter.x, rippleCenter.y, this.getElementRect(container));
9704  this.createRippleTransition(container, rippleElement, radius, targetInfo);
9705 },
9706 initRippleProcess: function() {
9707  this.isMobileExternalRipple = null;
9708  this.zoom = screen.width / window.innerWidth;
9709 },
9710 getRippleCenter: function(targetInfo, eventInfo, isExternalRipple) {
9711  var posX = 0;
9712  var posY = 0;
9713  if(isExternalRipple) {
9714   posX = targetInfo.x + targetInfo.width / 2;
9715   posY = targetInfo.y + targetInfo.height / 2;
9716  } else {
9717   posX = eventInfo.x;
9718   posY = eventInfo.y;
9719  }
9720  return {x: posX, y: posY};
9721 },
9722 createRippleContainer: function(targetInfo, isExternalRipple) {
9723  var containerParent = targetInfo.getTarget();
9724  if(!containerParent)
9725   return;
9726  var containerTagName = containerParent.tagName == "TR" ? "TD" : "DIV";
9727  var container = document.createElement(containerTagName);
9728  container.className = this.rippleContainerClassName;
9729  if(containerParent.parentNode && containerParent.tagName == "IMG")
9730   containerParent = containerParent.parentNode;
9731  if(this.isARowInFixedLayoutTable(containerParent))
9732   this.lockFixedLayoutTableSizes(containerParent);
9733  containerParent.appendChild(container);
9734  if(isExternalRipple)
9735   container.style.borderRadius = "50%";
9736  var containerRect = this.calculateRippleContainerSize(targetInfo, isExternalRipple);
9737  this.assignContainerSettings(container, containerRect);
9738  return container;
9739 },
9740 isARowInFixedLayoutTable: function(containerParent) {
9741  if(containerParent.tagName !== "TR")
9742   return false;
9743  var parentTable = this.getParentTable(containerParent);
9744  return parentTable && ASPx.GetCurrentStyle(parentTable)["table-layout"] === "fixed";
9745 },
9746 processFirstRowOfFixedTable: function(containerRow, rowAction, cellAction) {
9747  var firstRow = this.getFirstRow(containerRow);
9748  rowAction(firstRow);
9749  var cells = ASPx.Data.CollectionToArray(firstRow.cells);
9750  cells.forEach(cellAction);
9751 },
9752 getParentTable: function(element) {
9753  var parentTable = element;
9754  while(parentTable && parentTable.tagName !== "TABLE")
9755   parentTable = parentTable.parentElement;
9756  return parentTable;
9757 },
9758 lockFixedLayoutTableSizes: function(containerRow) {
9759  var firstRow = this.getFirstRow(containerRow);
9760  if(this.incLockCount(firstRow) === 1) {
9761   var cells = ASPx.Data.CollectionToArray(firstRow.cells);
9762   var widths = cells.map(function(cell) { return cell.style.width; });
9763   var computedWidths = cells.map(function(cell) {
9764    return window.getComputedStyle(cell).width;
9765   });
9766   var fixWidth = function(cell, i) {
9767    if(ASPx.Attr.IsExistsAttribute(cell, SAVED_WIDTH_ATTR))
9768     return;
9769    if(widths[i])
9770     ASPx.Attr.SetAttribute(cell, SAVED_WIDTH_ATTR, widths[i]);
9771    cell.style.width = computedWidths[i];
9772   };
9773   cells.forEach(fixWidth);
9774  }
9775 }, 
9776 unlockFixedLayoutTableSizes: function(containerRow) {
9777  var firstRow = this.getFirstRow(containerRow);   
9778  if(this.decLockCount(firstRow) === 0) {
9779   var cells = ASPx.Data.CollectionToArray(firstRow.cells);
9780   var restoreState = function(cell) {
9781    if(ASPx.Attr.IsExistsAttribute(cell, SAVED_WIDTH_ATTR)) {
9782     cell.style.width = ASPx.Attr.GetAttribute(cell, SAVED_WIDTH_ATTR);
9783     ASPx.Attr.RemoveAttribute(cell, SAVED_WIDTH_ATTR);
9784    } else {
9785     cell.style.width = null;
9786    }
9787   };
9788   cells.forEach(restoreState);
9789  }
9790 },
9791 getFirstRow: function(containerRow) { return ASPx.GetChildByTagName(containerRow.parentElement, "TR", 0); },
9792 incLockCount: function(elem) { return this.changeLockCount(elem, 1); },
9793 decLockCount: function(elem) { return this.changeLockCount(elem, -1); },
9794 changeLockCount: function(elem, diff) {
9795  var lockCounter = this.getLockCount(elem);
9796  lockCounter += diff;
9797  lockCounter = Math.max(0, lockCounter);
9798  if(lockCounter === 0)
9799   ASPx.Attr.RemoveAttribute(elem, RIPPLE_FIXED_ROW_ATTR);
9800  else
9801   ASPx.Attr.SetAttribute(elem, RIPPLE_FIXED_ROW_ATTR, lockCounter);
9802  return lockCounter;
9803 },
9804 getLockCount: function(lockElement) {
9805  var attrValue = ASPx.Attr.GetAttribute(lockElement, RIPPLE_FIXED_ROW_ATTR);
9806  return parseInt(attrValue) || 0;
9807 },
9808 assignContainerSettings: function(container, containerRect) {
9809  var properties = {
9810   height: containerRect.height,
9811   width: containerRect.width,
9812   left: ASPx.PrepareClientPosForElement(containerRect.x, container, true),
9813   top: ASPx.PrepareClientPosForElement(containerRect.y, container, false)
9814  };
9815  if(ASPx.Browser.MobileUI)
9816   ASPx.Data.MergeHashTables(properties, {marginTop: 0, marginLeft: 0 });
9817  ASPx.SetStyles(container, properties, ASPx.Browser.MobileUI);
9818 },
9819 IsExternalRipple: function(targetInfo) {
9820  var hasExternalRippleClassName = ASPx.ElementContainsCssClass(targetInfo.getTarget(), this.rippleTargetExternalClassName);
9821  if(!ASPx.Browser.MobileUI)
9822   return hasExternalRippleClassName;
9823  return hasExternalRippleClassName || this.IsMobileExternalRipple(targetInfo);
9824 },
9825 IsMobileExternalRipple: function(targetInfo) {
9826  if(this.isMobileExternalRipple == null) {
9827   var originTouchRadius = this.getOriginTouchRadius();
9828   this.isMobileExternalRipple = ASPx.Browser.MobileUI && targetInfo.width < originTouchRadius && targetInfo.height < originTouchRadius;
9829  }
9830  return this.isMobileExternalRipple;
9831 },
9832 RemoveRippleContainer: function(element) {
9833  if(!element)
9834   return;
9835  var childs = ASPx.GetChildNodesByClassName(element, this.rippleContainerClassName);
9836  var rippleContainer = childs.length > 0 ? childs[0] : null;
9837  if(rippleContainer != null) {
9838   var containerParent = rippleContainer.parentNode;
9839   containerParent.removeChild(rippleContainer);
9840   if(this.isARowInFixedLayoutTable(containerParent))
9841    this.unlockFixedLayoutTableSizes(containerParent);
9842  }
9843 },
9844 getEventX: function(evt) {
9845  return ASPxClientUtils.GetEventX(evt);
9846 },
9847 getEventY: function(evt) {
9848  return ASPxClientUtils.GetEventY(evt);
9849 },
9850 getOriginTouchRadius: function() {
9851  return this.touchRadius / this.zoom;
9852 },
9853 getElementRect: function(element) {
9854  return { x: ASPx.GetAbsoluteX(element), y: ASPx.GetAbsoluteY(element), width: element.offsetWidth, height: element.offsetHeight };
9855 }
9856};
9857var AccessibilitySR = {
9858 AddStringResources: function(stringResourcesObj) {
9859  if(stringResourcesObj) {
9860   for(var key in stringResourcesObj)
9861    if(stringResourcesObj.hasOwnProperty(key))
9862     this[key] = stringResourcesObj[key];
9863  }
9864 }
9865};
9866ASPx.OrderedMap = OrderedMap;
9867ASPx.CollectionBase = CollectionBase;
9868ASPx.FunctionIsInCallstack = _aspxFunctionIsInCallstack;
9869ASPx.RaisePostHandlerOnPost = aspxRaisePostHandlerOnPost;
9870ASPx.GetPostHandler = aspxGetPostHandler;
9871ASPx.ProcessScriptsAndLinks = _aspxProcessScriptsAndLinks;
9872ASPx.InitializeLinks = _aspxInitializeLinks;
9873ASPx.InitializeScripts = _aspxInitializeScripts;
9874ASPx.RunStartupScripts = _aspxRunStartupScripts;
9875ASPx.IsStartupScriptsRunning = _aspxIsStartupScriptsRunning;
9876ASPx.AddScriptsRestartHandler = _aspxAddScriptsRestartHandler;
9877ASPx.GetFocusedElement = _aspxGetFocusedElement;
9878ASPx.GetDomObserver = _aspxGetDomObserver;
9879ASPx.CacheHelper = CacheHelper;
9880ASPx.ControlTree = ControlTree;
9881ASPx.ControlAdjuster = ControlAdjuster;
9882ASPx.GetControlAdjuster = GetControlAdjuster;
9883ASPx.ControlCallbackHandlersQueue = ControlCallbackHandlersQueue;
9884ASPx.ResourceManager = ResourceManager;
9885ASPx.UpdateWatcherHelper = UpdateWatcherHelper;
9886ASPx.EventStorage = EventStorage;
9887ASPx.GetGlobalObject = GetGlobalObject;
9888ASPx.GetExternalScriptProcessor = GetExternalScriptProcessor;
9889ASPx.CheckBoxCheckState = CheckBoxCheckState;
9890ASPx.CheckBoxInputKey = CheckBoxInputKey;
9891ASPx.CheckableElementStateController = CheckableElementStateController;
9892ASPx.CheckableElementHelper = CheckableElementHelper;
9893ASPx.CheckBoxInternal = CheckBoxInternal;
9894ASPx.CheckBoxInternalCollection = CheckBoxInternalCollection;
9895ASPx.ControlCallbackQueueHelper = ControlCallbackQueueHelper;
9896ASPx.FocusedStyleDecoration = FocusedStyleDecoration;
9897ASPx.EditorStyleDecoration = EditorStyleDecoration;
9898ASPx.TextEditorStyleDecoration = TextEditorStyleDecoration;
9899ASPx.AccessibilitySR = AccessibilitySR;
9900ASPx.KbdHelper = KbdHelper;
9901ASPx.AccessKeysHelper = AccessKeysHelper;
9902ASPx.AccessKey = AccessKey;
9903ASPx.IFrameHelper = IFrameHelper;
9904ASPx.Ident = Ident;
9905ASPx.TouchUIHelper = TouchUIHelper;
9906ASPx.ControlUpdateWatcher = ControlUpdateWatcher;
9907ASPx.ControlTabIndexManager = ControlTabIndexManager;
9908ASPx.AccessibilityHelperBase = AccessibilityHelperBase;
9909ASPx.AccessibilityHelper = AccessibilityHelper;
9910ASPx.RippleHelper = RippleHelper;
9911ASPx.ThemesWithRipple = ThemesWithRipple;
9912window.ASPxClientEvent = ASPxClientEvent;
9913window.ASPxClientEventArgs = ASPxClientEventArgs;
9914window.ASPxClientCancelEventArgs = ASPxClientCancelEventArgs;
9915window.ASPxClientProcessingModeEventArgs = ASPxClientProcessingModeEventArgs;
9916window.ASPxClientProcessingModeCancelEventArgs = ASPxClientProcessingModeCancelEventArgs;
9917ASPx.Evt.AttachEventToDocument(TouchUIHelper.touchMouseDownEventName, RippleHelper.onDocumentMouseDown);
9918ASPx.classesScriptParsed = true;
9919})(ASPx, { GCCheckInterval: 5000 });
9920
9921(function () {
9922 IntersectionObserversManager = ASPx.CreateClass(null, {
9923  constructor: function() {
9924   this.rootElementToObserverMap = this.createMap();
9925   this.elementToHandlerMap = this.createMap();
9926   this.clearInvalidElementsInterval = null;
9927   this.clearInvalidElementsPeriod = 5000;
9928  },
9929  AddTargetElement: function(element, rootElement, visibilityChangedHandler) {
9930   this.addTargetElementCore(element, rootElement, visibilityChangedHandler);
9931  },
9932  SubscribeElemensVisibilityChangeInBrowserWindow: function (element, visibilityChangedHandler) {
9933   this.addTargetElementCore(element, null, visibilityChangedHandler);
9934  },
9935  createMap: function() {
9936   return new Map();
9937  },
9938  getObserver: function() {
9939   return IntersectionObserver;
9940  },
9941  initializeObserver: function(rootElement) {
9942   if(!this.rootElementToObserverMap.get(rootElement)) {
9943    var options = {
9944     root: rootElement,
9945     rootMargin: '-1px',
9946     threshold: 0.0 
9947    };
9948    var observerClass = this.getObserver();
9949    var observer = new observerClass(this.visibilityChanged.bind(this), options);
9950    this.rootElementToObserverMap.set(rootElement, observer);
9951   }
9952  },
9953  addTargetElementCore: function(element, rootElement, visibilityChangedHandler) {
9954   this.initializeObserver(rootElement);
9955   if(!this.isAlreadyObserved(element)) {
9956    var observer = this.rootElementToObserverMap.get(rootElement);
9957    if(observer) {
9958     observer.observe(element);
9959     this.setObservedMarker(element);
9960     this.setElementVisibilityChangedHandler(element, visibilityChangedHandler, observer);
9961     if(this.clearInvalidElementsInterval === null) {
9962      this.clearInvalidElementsInterval = setInterval(this.removeDeletedElements.bind(this), this.clearInvalidElementsPeriod);
9963     }
9964    }
9965   }
9966  },
9967  visibilityChanged: function(entries, observer) {
9968   entries.forEach(function (entry) {
9969    if(ASPx.IsExistsElement(entry.target)){
9970     var element = this.elementToHandlerMap.get(observer);
9971     if(element) {
9972      var handler = element.get(entry.target);
9973      if(handler)
9974       handler(entry.isIntersecting);
9975     }
9976    }
9977   }.bind(this));
9978  },
9979  removeDeletedElements: function() {
9980   this.elementToHandlerMap.forEach(function(elements, observer) {
9981    elements.forEach(function(handler, element) {
9982     if(!ASPx.IsExistsElement(element)) {
9983      elements.delete(element);
9984     }
9985    }.bind(this));
9986    if(elements.size === 0) {
9987     this.elementToHandlerMap.delete(observer);
9988    }
9989   }.bind(this));
9990   if(this.elementToHandlerMap.size === 0) {
9991    clearInterval(this.clearInvalidElementsInterval);
9992    this.clearInvalidElementsInterval = null;
9993   }
9994  },
9995  setElementVisibilityChangedHandler: function(element, visibilityChangedHandler, observer) {
9996   if(!this.elementToHandlerMap.get(observer))
9997    this.elementToHandlerMap.set(observer, this.createMap());
9998   var el = this.elementToHandlerMap.get(observer);
9999   if(el)
10000    el.set(element, visibilityChangedHandler);
10001  },
10002  isAlreadyObserved: function(element) {
10003   return !!element.dxObserved;
10004  },
10005  setObservedMarker: function(element) {
10006   element.dxObserved = true;
10007  },
10008  reset: function() {
10009   this.rootElementToObserverMap.forEach(function(observer, rootElement) {
10010    observer.disconnect();
10011   }.bind(this));
10012   this.rootElementToObserverMap = this.createMap();
10013   this.elementToHandlerMap = this.createMap();
10014   this.clearInvalidElementsInterval = null;
10015   this.clearInvalidElementsPeriod = 5000;
10016  }
10017 });
10018 IntersectionObserversManagerForOldBrowsers = ASPx.CreateClass(null, {
10019  SubscribeElemensVisibilityChangeInBrowserWindow: function() { }
10020 });
10021 ASPx.IntersectionObserversManager = ASPx.IntersectionObserversManager || ((typeof(IntersectionObserver) !== "undefined") ? new IntersectionObserversManager() : new IntersectionObserversManagerForOldBrowsers());
10022}
10023)(ASPx);
10024
10025(function () {
10026ASPx.StateItemsExist = false;
10027ASPx.FocusedItemKind = "FocusedStateItem";
10028ASPx.HoverItemKind = "HoverStateItem";
10029ASPx.PressedItemKind = "PressedStateItem";
10030ASPx.SelectedItemKind = "SelectedStateItem";
10031ASPx.DisabledItemKind = "DisabledStateItem";
10032ASPx.ReadOnlyItemKind = "ReadOnlyStateItem";
10033ASPx.CachedStatePrefix = "cached";
10034ASPxStateItem = ASPx.CreateClass(null, {
10035 constructor: function(name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, kind, disableApplyingStyleToLink){
10036  this.name = name;
10037  this.classNames = classNames;
10038  this.customClassNames = [];
10039  this.resultClassNames = [];
10040  this.cssTexts = cssTexts;
10041  this.postfixes = postfixes;
10042  this.imageObjs = imageObjs;
10043  this.imagePostfixes = imagePostfixes;
10044  this.kind = kind;
10045  this.classNamePostfix = kind.substr(0, 1).toLowerCase();
10046  this.enabled = true;
10047  this.needRefreshBetweenElements = false;
10048  this.elements = null;
10049  this.images = null;
10050  this.links = [];
10051  this.colorChanged = [];
10052  this.textDecorationChanged = [];
10053  this.disableApplyingStyleToLink = !!disableApplyingStyleToLink; 
10054 },
10055 GetCssText: function(index){
10056  if(ASPx.IsExists(this.cssTexts[index]))
10057   return this.cssTexts[index];
10058  return this.cssTexts[0];
10059 },
10060 CreateStyleRule: function(index){
10061  if(this.GetCssText(index) == "") return "";
10062  var styleSheet = ASPx.GetCurrentStyleSheet();
10063  if(styleSheet)
10064   return ASPx.CreateImportantStyleRule(styleSheet, this.GetCssText(index), this.classNamePostfix);  
10065  return ""; 
10066 },
10067 GetClassName: function(index){
10068  if(ASPx.IsExists(this.classNames[index]))
10069   return this.classNames[index];
10070  return this.classNames[0];
10071 },
10072 GetResultClassName: function(index){
10073  if(!ASPx.IsExists(this.resultClassNames[index])) {
10074   if(!ASPx.IsExists(this.customClassNames[index]))
10075    this.customClassNames[index] = this.CreateStyleRule(index);
10076   if(this.GetClassName(index) != "" && this.customClassNames[index] != "")
10077    this.resultClassNames[index] = this.GetClassName(index) + " " + this.customClassNames[index];
10078   else if(this.GetClassName(index) != "")
10079    this.resultClassNames[index] = this.GetClassName(index);
10080   else if(this.customClassNames[index] != "")
10081    this.resultClassNames[index] = this.customClassNames[index];
10082   else
10083    this.resultClassNames[index] = "";
10084  }
10085  return this.resultClassNames[index];
10086 },
10087 GetElements: function(element){
10088  if(!this.elements || !ASPx.IsValidElements(this.elements)){
10089   if(this.postfixes && this.postfixes.length > 0){
10090    this.elements = [ ];
10091    var parentNode = element.parentNode;
10092    if(parentNode){
10093     for(var i = 0; i < this.postfixes.length; i++){
10094      var id = this.name + this.postfixes[i];
10095      this.elements[i] = ASPx.GetChildById(parentNode, id);
10096      if(!this.elements[i])
10097       this.elements[i] = ASPx.GetElementById(id);
10098     }
10099    }
10100   }
10101   else
10102    this.elements = [element];
10103  }
10104  return this.elements;
10105 },
10106 GetImages: function(element){
10107  if(!this.images || !ASPx.IsValidElements(this.images)){
10108   this.images = [ ];
10109   if(this.imagePostfixes && this.imagePostfixes.length > 0){
10110    var elements = this.GetElements(element);
10111    for(var i = 0; i < this.imagePostfixes.length; i++){
10112     var id = this.name + this.imagePostfixes[i];
10113     for(var j = 0; j < elements.length; j++){
10114      if(!elements[j]) continue;
10115      if(elements[j].id == id)
10116       this.images[i] = elements[j];
10117      else
10118       this.images[i] = ASPx.GetChildById(elements[j], id);
10119      if(this.images[i])
10120       break;
10121     }
10122    }
10123   }
10124  }
10125  return this.images;
10126 },
10127 Apply: function(element){
10128  if(!this.enabled) return;
10129  try{
10130   this.ApplyStyle(element);
10131   if(this.imageObjs && this.imageObjs.length > 0)
10132    this.ApplyImage(element);
10133  }
10134  catch(e){
10135  }
10136 },
10137 ApplyStyle: function(element){
10138  var elements = this.GetElements(element);
10139  for(var i = 0; i < elements.length; i++){
10140   if(!elements[i]) continue;
10141   var elementColor, elementTextDecoration;
10142   if(this.colorChanged[i] === undefined) {
10143    elementColor = window.getComputedStyle(elements[i]).color;
10144   }
10145   if(this.textDecorationChanged[i] === undefined) {
10146    elementTextDecoration = window.getComputedStyle(elements[i]).textDecoration;
10147   }
10148   if(this.GetResultClassName(i) != "") {
10149    var className = elements[i].className.replace(this.GetResultClassName(i), "");
10150    elements[i].className = ASPx.Str.Trim(className) + " " + this.GetResultClassName(i);
10151   }
10152   if(this.colorChanged[i] === undefined) {
10153    this.colorChanged[i] = window.getComputedStyle(elements[i]).color !== elementColor;
10154   }
10155   if(this.textDecorationChanged[i] === undefined) {
10156    this.textDecorationChanged[i] = window.getComputedStyle(elements[i]).textDecoration !== elementTextDecoration;
10157   }
10158   if(!ASPx.Browser.Opera || ASPx.Browser.Version >= 9)
10159    this.ApplyStyleToLinks(elements, i);
10160  }
10161 },
10162 ApplyStyleToLinks: function(elements, index){
10163  if(this.disableApplyingStyleToLink)
10164   return;
10165  if(!ASPx.IsValidElements(this.links[index]))
10166   this.links[index] = ASPx.GetNodesByTagName(elements[index], "A");
10167  for(var i = 0; i < this.links[index].length; i++)
10168   this.ApplyStyleToLinkElement(this.links[index][i], index);
10169 },
10170 ApplyStyleToLinkElement: function(link, index) {
10171  if(this.colorChanged[index])
10172   ASPx.Attr.ChangeAttributeExtended(link.style, "color", link, "saved" + this.kind + "Color", "inherit");
10173  if(this.textDecorationChanged[index])
10174   ASPx.Attr.ChangeAttributeExtended(link.style, "text-decoration", link, "saved" + this.kind + "TextDecoration", "inherit");
10175 },
10176 ApplyImage: function(element){
10177  var images = this.GetImages(element);
10178  for(var i = 0; i < images.length; i++){
10179   if(!images[i] || !this.imageObjs[i]) continue;
10180   var useSpriteImage = typeof(this.imageObjs[i]) != "string";
10181   var newUrl = "", newCssClass = "", newBackground = "";
10182   if(useSpriteImage){
10183    newUrl = ASPx.EmptyImageUrl;           
10184    if(this.imageObjs[i].spriteCssClass) 
10185     newCssClass = this.imageObjs[i].spriteCssClass;
10186    if(this.imageObjs[i].spriteBackground)
10187     newBackground = this.imageObjs[i].spriteBackground;
10188   }
10189   else{
10190    newUrl = this.imageObjs[i];
10191    if(ASPx.Attr.IsExistsAttribute(images[i].style, "background"))   
10192     newBackground = " ";
10193   }
10194   if(newUrl != "")
10195    ASPx.Attr.ChangeAttributeExtended(images[i], "src", images[i], "saved" + this.kind + "Src", newUrl);
10196   if(newCssClass != "")
10197    this.ApplyImageClassName(images[i], newCssClass);
10198   if(newBackground != ""){
10199    if(ASPx.Browser.WebKitFamily) {
10200     var savedBackground = ASPx.Attr.GetAttribute(images[i].style, "background");
10201     if(!useSpriteImage)
10202      savedBackground += " " + images[i].style["backgroundPosition"];
10203     ASPx.Attr.SetAttribute(images[i], "saved" + this.kind + "Background", savedBackground);
10204     ASPx.Attr.SetAttribute(images[i].style, "background", newBackground);
10205    }
10206    else
10207     ASPx.Attr.ChangeAttributeExtended(images[i].style, "background", images[i], "saved" + this.kind + "Background", newBackground);
10208   }     
10209  }
10210 },
10211 ApplyImageClassName: function(element, newClassName){
10212  if(ASPx.Attr.GetAttribute(element, "saved" + this.kind + "ClassName"))
10213   this.CancelImageClassName(element);
10214  var className = element.className;
10215  ASPx.Attr.SetAttribute(element, "saved" + this.kind + "ClassName", className);
10216  element.className = className + " " + newClassName;
10217 },
10218 Cancel: function(element){
10219  if(!this.enabled) return;
10220  try{  
10221   if(this.imageObjs && this.imageObjs.length > 0)
10222    this.CancelImage(element);
10223   this.CancelStyle(element);
10224  }
10225  catch(e){
10226  }
10227 },
10228 CancelStyle: function(element){
10229  var elements = this.GetElements(element);
10230  for(var i = 0; i < elements.length; i++){
10231   if(!elements[i]) continue;
10232   if(this.GetResultClassName(i) != "") {
10233    var className = ASPx.Str.Trim(elements[i].className.replace(this.GetResultClassName(i), ""));
10234    elements[i].className = className;
10235   }
10236   if(!ASPx.Browser.Opera || ASPx.Browser.Version >= 9)
10237    this.CancelStyleFromLinks(elements, i);
10238  }
10239 },
10240 CancelStyleFromLinks: function(elements, index){
10241  if(this.disableApplyingStyleToLink)
10242   return;
10243  if(!ASPx.IsValidElements(this.links[index]))
10244   this.links[index] = ASPx.GetNodesByTagName(elements[index], "A");
10245  for(var i = 0; i < this.links[index].length; i++)
10246   this.CancelStyleFromLinkElement(this.links[index][i], index);
10247 },
10248 CancelStyleFromLinkElement: function(link, index){
10249  ASPx.Attr.RestoreAttributeExtended(link.style, "color", link, "saved" + this.kind + "Color");
10250  ASPx.Attr.RestoreAttributeExtended(link.style, "text-decoration", link, "saved" + this.kind + "TextDecoration");
10251 },
10252 CancelImage: function(element){
10253  var images = this.GetImages(element);
10254  for(var i = 0; i < images.length; i++){
10255   if(!images[i] || !this.imageObjs[i]) continue;
10256   ASPx.Attr.RestoreAttributeExtended(images[i], "src", images[i], "saved" + this.kind + "Src");
10257   this.CancelImageClassName(images[i]);
10258   ASPx.Attr.RestoreAttributeExtended(images[i].style, "background", images[i], "saved" + this.kind + "Background");
10259  }
10260 },
10261 CancelImageClassName: function(element){
10262  var savedClassName = ASPx.Attr.GetAttribute(element, "saved" + this.kind + "ClassName");
10263  if(ASPx.IsExists(savedClassName)) {
10264   element.className = savedClassName;
10265   ASPx.Attr.RemoveAttribute(element, "saved" + this.kind + "ClassName");
10266  }
10267 },
10268 Clone: function(){
10269  return new ASPxStateItem(this.name, this.classNames, this.cssTexts, this.postfixes, 
10270   this.imageObjs, this.imagePostfixes, this.kind, this.disableApplyingStyleToLink);
10271 },
10272 IsChildElement: function(element){
10273  if(element != null){
10274   var elements = this.GetElements(element);
10275   for(var i = 0; i < elements.length; i++){
10276    if(!elements[i]) continue;
10277    if(ASPx.GetIsParent(elements[i], element)) 
10278     return true;
10279   }
10280  }
10281  return false;
10282 },
10283 ForceRedrawAppearance: function(element) {
10284  if(!aspxGetStateController().IsForceRedrawAppearanceLocked()) {
10285   var value = element.style.opacity;
10286   element.style.opacity = "0.7777";
10287   var dummy = element.offsetWidth;
10288   element.style.opacity = value;
10289  }
10290 }
10291});
10292ASPxClientStateEventArgs = ASPx.CreateClass(null, {
10293 constructor: function(item, element){
10294  this.item = item;
10295  this.element = element;
10296  this.toElement = null;
10297  this.fromElement = null;
10298  this.htmlEvent = null;
10299 }
10300});
10301ASPxStateController = ASPx.CreateClass(null, {
10302 constructor: function(){
10303  this.focusedItems = { };
10304  this.hoverItems = { };
10305  this.pressedItems = { };
10306  this.selectedItems = { };
10307  this.disabledItems = {};
10308  this.readOnlyItems = {};
10309  this.disabledScheme = {};
10310  this.currentFocusedElement = null;
10311  this.currentFocusedItemName = null;
10312  this.currentHoverElement = null;
10313  this.currentHoverItemName = null;
10314  this.currentPressedElement = null;
10315  this.currentPressedItemName = null;
10316  this.savedCurrentPressedElement = null;
10317  this.savedCurrentMouseMoveSrcElement = null;
10318  this.forceRedrawAppearanceLockCount = 0;
10319  this.stateItemType = ASPxStateItem;
10320  this.AfterSetFocusedState = new ASPxClientEvent();
10321  this.AfterClearFocusedState = new ASPxClientEvent();
10322  this.AfterSetHoverState = new ASPxClientEvent();
10323  this.AfterClearHoverState = new ASPxClientEvent();
10324  this.AfterSetPressedState = new ASPxClientEvent();
10325  this.AfterClearPressedState = new ASPxClientEvent();
10326  this.AfterDisabled = new ASPxClientEvent();
10327  this.AfterEnabled = new ASPxClientEvent();
10328  this.BeforeSetFocusedState = new ASPxClientEvent();
10329  this.BeforeClearFocusedState = new ASPxClientEvent();
10330  this.BeforeSetHoverState = new ASPxClientEvent();
10331  this.BeforeClearHoverState = new ASPxClientEvent();
10332  this.BeforeSetPressedState = new ASPxClientEvent();
10333  this.BeforeClearPressedState = new ASPxClientEvent();
10334  this.BeforeDisabled = new ASPxClientEvent();
10335  this.BeforeEnabled = new ASPxClientEvent();
10336  this.FocusedItemKeyDown = new ASPxClientEvent();
10337 }, 
10338 AddHoverItem: function(name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, disableApplyingStyleToLink){
10339  this.AddItem(this.hoverItems, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, ASPx.HoverItemKind, disableApplyingStyleToLink);
10340  this.AddItem(this.focusedItems, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, ASPx.FocusedItemKind, disableApplyingStyleToLink);
10341 },
10342 AddPressedItem: function(name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, disableApplyingStyleToLink){
10343  this.AddItem(this.pressedItems, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, ASPx.PressedItemKind, disableApplyingStyleToLink);
10344 },
10345 AddSelectedItem: function(name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, disableApplyingStyleToLink){
10346  this.AddItem(this.selectedItems, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, ASPx.SelectedItemKind, disableApplyingStyleToLink);
10347 },
10348 AddDisabledItem: function (name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, disableApplyingStyleToLink, rootId) {
10349  this.AddItem(this.disabledItems, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes,
10350   ASPx.DisabledItemKind, disableApplyingStyleToLink, this.addIdToDisabledItemScheme, rootId);
10351 },
10352 AddReadOnlyItem: function(name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, disableApplyingStyleToLink) {
10353  this.AddItem(this.readOnlyItems, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, ASPx.ReadOnlyItemKind, disableApplyingStyleToLink);
10354 },
10355 addIdToDisabledItemScheme: function(rootId, childId) {
10356  if (!rootId)
10357   return;
10358  if (!this.disabledScheme[rootId])
10359   this.disabledScheme[rootId] = [rootId];
10360  if (childId && (rootId != childId) && ASPx.Data.ArrayIndexOf(this.disabledScheme[rootId], childId) == -1)
10361   this.disabledScheme[rootId].push(childId);
10362 },
10363 removeIdFromDisabledItemScheme: function(rootId, childId) {
10364  if (!rootId || !this.disabledScheme[rootId])
10365   return;
10366  ASPx.Data.ArrayRemove(this.disabledScheme[rootId], childId);
10367  if (this.disabledScheme[rootId].length == 0)
10368   delete this.disabledScheme[rootId];
10369 },
10370 AddItem: function (items, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, kind, disableApplyingStyleToLink, onAdd, rootId) {
10371  var type = this.getStateItemType();
10372  var stateItem = new type(name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, kind, disableApplyingStyleToLink);
10373  if (postfixes && postfixes.length > 0) {
10374   for (var i = 0; i < postfixes.length; i++) {
10375    items[name + postfixes[i]] = stateItem;
10376    if (onAdd)
10377     onAdd.call(this, rootId, name + postfixes[i]);
10378   }
10379  }
10380  else {
10381   if (onAdd)
10382    onAdd.call(this, rootId, name);
10383   items[name] = stateItem;
10384  }
10385  ASPx.StateItemsExist = true;
10386 },
10387 getStateItemType: function () { return this.stateItemType; },
10388 withCustomStateItemType: function (newType, callback) {
10389  this.stateItemType = newType;
10390  callback(this);
10391  this.stateItemType = ASPxStateItem;
10392 },
10393 RemoveHoverItem: function(name, postfixes){
10394  this.RemoveItem(this.hoverItems, name, postfixes);
10395  this.RemoveItem(this.focusedItems, name, postfixes);
10396 },
10397 RemovePressedItem: function(name, postfixes){
10398  this.RemoveItem(this.pressedItems, name, postfixes);
10399 },
10400 RemoveSelectedItem: function(name, postfixes){
10401  this.RemoveItem(this.selectedItems, name, postfixes);
10402 },
10403 RemoveDisabledItem: function (name, postfixes, rootId) {
10404  this.RemoveItem(this.disabledItems, name, postfixes, this.removeIdFromDisabledItemScheme, rootId);
10405 },
10406 RemoveReadOnlyItem: function(name, postfixes) {
10407  this.RemoveItem(this.readOnlyItems, name, postfixes);
10408 },
10409 RemoveItem: function (items, name, postfixes, onRemove, rootId) {
10410  if (postfixes && postfixes.length > 0) {
10411   for (var i = 0; i < postfixes.length; i++) {
10412    delete items[name + postfixes[i]];
10413    if (onRemove)
10414     onRemove.call(this, rootId, name + postfixes[i]);
10415   }
10416  }
10417  else {
10418   delete items[name];
10419   if (onRemove)
10420    onRemove.call(this, rootId, name);
10421  }
10422 },
10423 RemoveDisposedItems: function(){
10424  this.RemoveDisposedItemsByType(this.hoverItems);
10425  this.RemoveDisposedItemsByType(this.pressedItems);
10426  this.RemoveDisposedItemsByType(this.focusedItems);
10427  this.RemoveDisposedItemsByType(this.selectedItems);
10428  this.RemoveDisposedItemsByType(this.disabledItems);
10429  this.RemoveDisposedItemsByType(this.disabledScheme);
10430  this.RemoveDisposedItemsByType(this.readOnlyItems);
10431 },
10432 RemoveDisposedItemsByType: function(items){
10433  for(var key in items) {
10434   if(items.hasOwnProperty(key)) {
10435    var item = items[key];
10436    var element = document.getElementById(key);
10437    if(!element || !ASPx.IsValidElement(element))
10438     delete items[key];
10439    try {
10440     if(item && item.elements) {
10441      for(var i = 0; i < item.elements.length; i++) {
10442       if(!ASPx.IsValidElements(item.links[i]))
10443        item.links[i] = null;
10444      }
10445     }
10446    }
10447    catch(e) {
10448    }
10449   }
10450  }
10451 },
10452 GetFocusedElement: function(srcElement){
10453  return this.GetItemElement(srcElement, this.focusedItems, ASPx.FocusedItemKind);
10454 },
10455 GetHoverElement: function(srcElement){
10456  return this.GetItemElement(srcElement, this.hoverItems, ASPx.HoverItemKind);
10457 },
10458 GetPressedElement: function(srcElement){
10459  return this.GetItemElement(srcElement, this.pressedItems, ASPx.PressedItemKind);
10460 },
10461 GetSelectedElement: function(srcElement){
10462  return this.GetItemElement(srcElement, this.selectedItems, ASPx.SelectedItemKind);
10463 },
10464 GetDisabledElement: function(srcElement){
10465  return this.GetItemElement(srcElement, this.disabledItems, ASPx.DisabledItemKind);
10466 },
10467 GetReadOnlyElement: function(srcElement) {
10468  return this.GetItemElement(srcElement, this.readOnlyItems, ASPx.ReadOnlyItemKind);
10469 },
10470 GetItemElement: function(srcElement, items, kind){
10471  if(srcElement && srcElement[ASPx.CachedStatePrefix + kind]){
10472   var cachedElement = srcElement[ASPx.CachedStatePrefix + kind];
10473   if(cachedElement != ASPx.EmptyObject)
10474    return cachedElement;
10475   return null;
10476  }
10477  var element = srcElement;
10478  while(element != null) {
10479   var item = items[element.id];
10480   if(item){
10481    this.CacheItemElement(srcElement, kind, element);
10482    element[kind] = item;
10483    return element;
10484   }
10485   element = element.parentNode;
10486  }
10487  this.CacheItemElement(srcElement, kind, ASPx.EmptyObject);
10488  return null;
10489 },
10490 CacheItemElement: function(srcElement, kind, value){
10491  if(srcElement && !srcElement[ASPx.CachedStatePrefix + kind])
10492   srcElement[ASPx.CachedStatePrefix + kind] = value;
10493 },
10494 DoSetFocusedState: function(element, fromElement){
10495  var item = element[ASPx.FocusedItemKind];
10496  if(item){
10497   var args = new ASPxClientStateEventArgs(item, element);
10498   args.fromElement = fromElement;
10499   this.BeforeSetFocusedState.FireEvent(this, args);
10500   item.Apply(element);
10501   this.AfterSetFocusedState.FireEvent(this, args);
10502  }
10503 },
10504 DoClearFocusedState: function(element, toElement){
10505  var item = element[ASPx.FocusedItemKind];
10506  if(item){
10507   var args = new ASPxClientStateEventArgs(item, element);
10508   args.toElement = toElement;
10509   this.BeforeClearFocusedState.FireEvent(this, args);
10510   item.Cancel(element);
10511   this.AfterClearFocusedState.FireEvent(this, args);
10512  }
10513 },
10514 DoSetHoverState: function(element, fromElement){
10515  var item = element[ASPx.HoverItemKind];
10516  if(item){
10517   var args = new ASPxClientStateEventArgs(item, element);
10518   args.fromElement = fromElement;
10519   this.BeforeSetHoverState.FireEvent(this, args);
10520   item.Apply(element);
10521   this.AfterSetHoverState.FireEvent(this, args);
10522  }
10523 },
10524 DoClearHoverState: function(element, toElement){
10525  var item = element[ASPx.HoverItemKind];
10526  if(item){
10527   var args = new ASPxClientStateEventArgs(item, element);
10528   args.toElement = toElement;
10529   this.BeforeClearHoverState.FireEvent(this, args);
10530   item.Cancel(element);
10531   this.AfterClearHoverState.FireEvent(this, args);
10532  }
10533 },
10534 DoSetPressedState: function(element){
10535  var item = element[ASPx.PressedItemKind];
10536  if(item){
10537   var args = new ASPxClientStateEventArgs(item, element);
10538   this.BeforeSetPressedState.FireEvent(this, args);
10539   item.Apply(element);
10540   this.AfterSetPressedState.FireEvent(this, args);
10541  }
10542 },
10543 DoClearPressedState: function(element){
10544  var item = element[ASPx.PressedItemKind];
10545  if(item){
10546   var args = new ASPxClientStateEventArgs(item, element);
10547   this.BeforeClearPressedState.FireEvent(this, args);
10548   item.Cancel(element);
10549   this.AfterClearPressedState.FireEvent(this, args);
10550  }
10551 },
10552 SetCurrentFocusedElement: function(element){
10553  if(this.currentFocusedElement && !ASPx.IsValidElement(this.currentFocusedElement)){
10554   this.currentFocusedElement = null;
10555   this.currentFocusedItemName = "";
10556  }
10557  if(this.currentFocusedElement != element){
10558   var oldCurrentFocusedElement = this.currentFocusedElement;
10559   var item = (element != null) ? element[ASPx.FocusedItemKind] : null;
10560   var itemName = (item != null) ? item.name : "";
10561   if(this.currentFocusedItemName != itemName){
10562    if(this.currentHoverItemName != "")
10563     this.SetCurrentHoverElement(null);
10564    if(this.currentFocusedElement != null)
10565     this.DoClearFocusedState(this.currentFocusedElement, element);
10566    this.currentFocusedElement = element;
10567    item = (element != null) ? element[ASPx.FocusedItemKind] : null;
10568    this.currentFocusedItemName = (item != null) ? item.name : "";
10569    if(this.currentFocusedElement != null)
10570     this.DoSetFocusedState(this.currentFocusedElement, oldCurrentFocusedElement);
10571   }
10572  }
10573 },
10574 GetCurrentHoverElement: function() {
10575  return this.currentHoverElement;
10576 },
10577 SetCurrentHoverElement: function(element){
10578  if(this.currentHoverElement && !ASPx.IsValidElement(this.currentHoverElement)){
10579   this.currentHoverElement = null;
10580   this.currentHoverItemName = "";
10581  }
10582  var item = (element != null) ? element[ASPx.HoverItemKind] : null;
10583  if(item && !item.enabled) { 
10584   element = this.GetItemElement(element.parentNode, this.hoverItems, ASPx.HoverItemKind);
10585   item = (element != null) ? element[ASPx.HoverItemKind] : null;
10586  }
10587  if(this.currentHoverElement != element){
10588   var oldCurrentHoverElement = this.currentHoverElement,
10589    itemName = (item != null) ? item.name : "";
10590   if(this.currentHoverItemName != itemName || (item != null && item.needRefreshBetweenElements)){
10591    if(this.currentHoverElement != null)
10592     this.DoClearHoverState(this.currentHoverElement, element);
10593    item = (element != null) ? element[ASPx.HoverItemKind] : null;
10594    if(item == null || item.enabled){
10595     this.currentHoverElement = element;
10596     this.currentHoverItemName = (item != null) ? item.name : "";
10597     if(this.currentHoverElement != null)
10598      this.DoSetHoverState(this.currentHoverElement, oldCurrentHoverElement);
10599    }
10600   }
10601  }
10602 },
10603 SetCurrentPressedElement: function(element){
10604  if(this.currentPressedElement && !ASPx.IsValidElement(this.currentPressedElement)){
10605   this.currentPressedElement = null;
10606   this.currentPressedItemName = "";
10607  }
10608  if(this.currentPressedElement != element){
10609   if(this.currentPressedElement != null)
10610    this.DoClearPressedState(this.currentPressedElement);
10611   var item = (element != null) ? element[ASPx.PressedItemKind] : null;
10612   if(item == null || item.enabled){
10613    this.currentPressedElement = element;
10614    this.currentPressedItemName = (item != null) ? item.name : "";
10615    if(this.currentPressedElement != null)
10616     this.DoSetPressedState(this.currentPressedElement);
10617   }
10618  }
10619 },
10620 SetCurrentFocusedElementBySrcElement: function(srcElement){
10621  var element = this.GetFocusedElement(srcElement);
10622  this.SetCurrentFocusedElement(element);
10623 },
10624 SetCurrentHoverElementBySrcElement: function(srcElement){
10625  var element = this.GetHoverElement(srcElement);
10626  this.SetCurrentHoverElement(element);
10627 },
10628 SetCurrentPressedElementBySrcElement: function(srcElement){
10629  var element = this.GetPressedElement(srcElement);
10630  this.SetCurrentPressedElement(element);
10631 },
10632 SetPressedElement: function (element) {
10633  this.SetCurrentHoverElement(null);
10634  this.SetCurrentPressedElementBySrcElement(element);
10635  this.savedCurrentPressedElement = this.currentPressedElement;
10636 },
10637 SelectElement: function (element) {
10638  var item = element[ASPx.SelectedItemKind];
10639  if(item)
10640   item.Apply(element);
10641 }, 
10642 SelectElementBySrcElement: function(srcElement){
10643  var element = this.GetSelectedElement(srcElement);
10644  if(element != null) this.SelectElement(element);
10645 }, 
10646 DeselectElement: function(element){
10647  var item = element[ASPx.SelectedItemKind];
10648  if(item)
10649   item.Cancel(element);
10650 }, 
10651 DeselectElementBySrcElement: function(srcElement){
10652  var element = this.GetSelectedElement(srcElement);
10653  if(element != null) this.DeselectElement(element);
10654 },
10655 SetElementEnabled: function(element, enable){
10656  if(enable)
10657   this.EnableElement(element);
10658  else
10659   this.DisableElement(element);
10660 },
10661 SetElementReadOnly: function(element, readOnly) {
10662  var element = this.GetReadOnlyElement(element);
10663  if (element != null) {
10664   var item = element[ASPx.ReadOnlyItemKind];
10665   if(item) {
10666    if(readOnly) {
10667     if(item.name == this.currentPressedItemName)
10668      this.SetCurrentPressedElement(null);
10669     if(item.name == this.currentHoverItemName)
10670      this.SetCurrentHoverElement(null);
10671    }
10672    if(readOnly)
10673     item.Apply(element);
10674    else
10675     item.Cancel(element);
10676   }
10677  }
10678 },
10679 SetElementWithChildNodesEnabled: function (parentName, enabled) {
10680  var procFunct = (enabled ? this.EnableElement : this.DisableElement);
10681  var childItems = this.disabledScheme[parentName];
10682  if (childItems && childItems.length > 0)
10683   for (var i = 0; i < childItems.length; i++) {
10684    procFunct.call(this, document.getElementById(childItems[i]));
10685   }
10686 },
10687 DisableElement: function (element) {
10688  var element = this.GetDisabledElement(element);
10689  if(element != null) {
10690   var item = element[ASPx.DisabledItemKind];
10691   if(item){
10692    var args = new ASPxClientStateEventArgs(item, element);
10693    this.BeforeDisabled.FireEvent(this, args);
10694    if(item.name == this.currentPressedItemName)
10695     this.SetCurrentPressedElement(null);
10696    if(item.name == this.currentHoverItemName)
10697     this.SetCurrentHoverElement(null);
10698    item.Apply(element);
10699    this.SetMouseStateItemsEnabled(item.name, item.postfixes, false);
10700    this.AfterDisabled.FireEvent(this, args);
10701   }
10702  }
10703 }, 
10704 EnableElement: function(element){
10705  var element = this.GetDisabledElement(element);
10706  if(element != null) {
10707   var item = element[ASPx.DisabledItemKind];
10708   if(item){
10709    var args = new ASPxClientStateEventArgs(item, element);
10710    this.BeforeEnabled.FireEvent(this, args);
10711    item.Cancel(element);
10712    this.SetMouseStateItemsEnabled(item.name, item.postfixes, true);
10713    this.AfterEnabled.FireEvent(this, args);
10714   }
10715  }
10716 }, 
10717 SetMouseStateItemsEnabled: function(name, postfixes, enabled){   
10718  if(postfixes && postfixes.length > 0){
10719   for(var i = 0; i < postfixes.length; i ++){
10720    this.SetItemsEnabled(this.hoverItems, name + postfixes[i], enabled);
10721    this.SetItemsEnabled(this.pressedItems, name + postfixes[i], enabled);
10722    this.SetItemsEnabled(this.focusedItems, name + postfixes[i], enabled);
10723   }
10724  }
10725  else{
10726   this.SetItemsEnabled(this.hoverItems, name, enabled);
10727   this.SetItemsEnabled(this.pressedItems, name, enabled);
10728   this.SetItemsEnabled(this.focusedItems, name, enabled);
10729  }  
10730 },
10731 SetItemsEnabled: function(items, name, enabled){   
10732  if(items[name])
10733   items[name].enabled = enabled;
10734 },
10735 OnFocusMove: function(evt){
10736  var element = ASPx.Evt.GetEventSource(evt);
10737  aspxGetStateController().SetCurrentFocusedElementBySrcElement(element);
10738 },
10739 OnMouseMove: function(evt, checkElementChanged){
10740  var srcElement = ASPx.Evt.GetEventSource(evt);
10741  if(checkElementChanged && srcElement == this.savedCurrentMouseMoveSrcElement) return;
10742  this.savedCurrentMouseMoveSrcElement = srcElement;
10743  if(this.savedCurrentPressedElement == null)
10744   this.SetCurrentHoverElementBySrcElement(srcElement);
10745  else{
10746   var element = this.GetPressedElement(srcElement);
10747   if(element != this.currentPressedElement){
10748    if(element == this.savedCurrentPressedElement)
10749     this.SetCurrentPressedElement(this.savedCurrentPressedElement);
10750    else
10751     this.SetCurrentPressedElement(null);
10752   }
10753  }
10754 },
10755 OnMouseDown: function(evt){
10756  if(!ASPx.Evt.IsLeftButtonPressed(evt)) return;
10757  var srcElement = ASPx.Evt.GetEventSource(evt);
10758  this.OnMouseDownOnElement(srcElement);
10759 },
10760 OnMouseDownOnElement: function (element) {
10761  if(this.GetPressedElement(element) == null) return;
10762  this.SetPressedElement(element);
10763 },
10764 OnMouseUp: function(evt){
10765  var srcElement = ASPx.Evt.GetEventSource(evt);
10766  this.OnMouseUpOnElement(srcElement);
10767 },
10768 OnMouseUpOnElement: function(element){
10769  if(this.savedCurrentPressedElement == null) return;
10770  this.ClearSavedCurrentPressedElement();
10771  this.SetCurrentHoverElementBySrcElement(element);
10772 },
10773 OnMouseOver: function(evt){
10774  var element = ASPx.Evt.GetEventSource(evt);
10775  if(element && element.tagName == "IFRAME")
10776   this.OnMouseMove(evt, true);
10777 },
10778 OnKeyDown: function(evt){
10779  var element = this.GetFocusedElement(ASPx.Evt.GetEventSource(evt));
10780  if(element != null && element == this.currentFocusedElement) {
10781   var item = element[ASPx.FocusedItemKind];
10782   if(item){
10783    var args = new ASPxClientStateEventArgs(item, element);
10784    args.htmlEvent = evt;
10785    this.FocusedItemKeyDown.FireEvent(this, args);
10786   }
10787  }
10788 },
10789 OnKeyUpOnElement: function(evt) {
10790  if(this.savedCurrentPressedElement != null && ASPx.Evt.IsActionKeyPressed(evt))
10791   this.ClearSavedCurrentPressedElement();
10792 },
10793 OnSelectStart: function(evt){
10794  if(this.savedCurrentPressedElement) {
10795   ASPx.Selection.Clear();
10796   return false;
10797  }
10798 },
10799 ClearSavedCurrentPressedElement: function() {
10800  this.savedCurrentPressedElement = null;
10801  this.SetCurrentPressedElement(null);
10802 },
10803 ClearCache: function(srcElement, kind) {
10804  if(srcElement[ASPx.CachedStatePrefix + kind])
10805   srcElement[ASPx.CachedStatePrefix + kind] = null;
10806 },
10807 ClearElementCache: function(srcElement) {
10808  this.ClearCache(srcElement, ASPx.FocusedItemKind);
10809  this.ClearCache(srcElement, ASPx.HoverItemKind);
10810  this.ClearCache(srcElement, ASPx.PressedItemKind);
10811  this.ClearCache(srcElement, ASPx.SelectedItemKind);
10812  this.ClearCache(srcElement, ASPx.DisabledItemKind);
10813 },
10814 ClearElementCacheInContainer: function(container) {
10815  var elements = ASPx.GetNodes(container);
10816  elements.push(container);
10817  ASPx.Data.ForEach(elements, this.ClearElementCache.bind(this));
10818 },
10819 LockForceRedrawAppearance: function() {
10820  this.forceRedrawAppearanceLockCount++;
10821 },
10822 UnlockForceRedrawAppearance: function() {
10823  this.forceRedrawAppearanceLockCount--;
10824 },
10825 IsForceRedrawAppearanceLocked: function() {
10826  return this.forceRedrawAppearanceLockCount > 0;
10827 },
10828 GetHoverItem: function(srcElement) {
10829  var element = this.GetHoverElement(srcElement);
10830  return (element != null) ? element[ASPx.HoverItemKind] : null;
10831 }
10832});
10833var stateController = null;
10834function aspxGetStateController(){
10835 if(stateController == null)
10836  stateController = new ASPxStateController();
10837 return stateController;
10838}
10839function aspxAddStateItems(method, namePrefix, classes, disableApplyingStyleToLink){
10840 for(var i = 0; i < classes.length; i ++){
10841  for(var j = 0; j < classes[i][2].length; j ++) {
10842   var name = namePrefix;
10843   if(classes[i][2][j])
10844    name += "_" + classes[i][2][j];
10845   var postfixes = classes[i][3] || null;
10846   var imageObjs = (classes[i][4] && classes[i][4][j]) || null;
10847   var imagePostfixes = classes[i][5] || null;
10848   method.call(aspxGetStateController(), name, classes[i][0], classes[i][1], postfixes, imageObjs, imagePostfixes, disableApplyingStyleToLink, namePrefix);
10849  }
10850 }
10851}
10852ASPx.AddHoverItems = function(namePrefix, classes, disableApplyingStyleToLink){
10853 aspxAddStateItems(aspxGetStateController().AddHoverItem, namePrefix, classes, disableApplyingStyleToLink);
10854};
10855ASPx.AddPressedItems = function(namePrefix, classes, disableApplyingStyleToLink){
10856 aspxAddStateItems(aspxGetStateController().AddPressedItem, namePrefix, classes, disableApplyingStyleToLink);
10857};
10858ASPx.AddSelectedItems = function(namePrefix, classes, disableApplyingStyleToLink){
10859 aspxAddStateItems(aspxGetStateController().AddSelectedItem, namePrefix, classes, disableApplyingStyleToLink);
10860};
10861ASPx.AddDisabledItems = function(namePrefix, classes, disableApplyingStyleToLink){
10862 aspxAddStateItems(aspxGetStateController().AddDisabledItem, namePrefix, classes, disableApplyingStyleToLink);
10863};
10864ASPx.AddReadOnlyItems = function(namePrefix, classes, disableApplyingStyleToLink) {
10865 aspxAddStateItems(aspxGetStateController().AddReadOnlyItem, namePrefix, classes, disableApplyingStyleToLink);
10866};
10867function aspxRemoveStateItems(method, namePrefix, classes){
10868 for(var i = 0; i < classes.length; i ++){
10869  for(var j = 0; j < classes[i][0].length; j ++) {
10870   var name = namePrefix;
10871   if(classes[i][0][j])
10872    name += "_" + classes[i][0][j];
10873   method.call(aspxGetStateController(), name, classes[i][1], namePrefix);
10874  }
10875 }
10876}
10877ASPx.RemoveHoverItems = function(namePrefix, classes){
10878 aspxRemoveStateItems(aspxGetStateController().RemoveHoverItem, namePrefix, classes);
10879};
10880ASPx.RemovePressedItems = function(namePrefix, classes){
10881 aspxRemoveStateItems(aspxGetStateController().RemovePressedItem, namePrefix, classes);
10882};
10883ASPx.RemoveSelectedItems = function(namePrefix, classes){
10884 aspxRemoveStateItems(aspxGetStateController().RemoveSelectedItem, namePrefix, classes);
10885};
10886ASPx.RemoveDisabledItems = function(namePrefix, classes){
10887 aspxRemoveStateItems(aspxGetStateController().RemoveDisabledItem, namePrefix, classes);
10888};
10889ASPx.RemoveReadOnlyItems = function(namePrefix, classes) {
10890 aspxRemoveStateItems(aspxGetStateController().RemoveReadOnlyItem, namePrefix, classes);
10891};
10892ASPx.AddAfterClearFocusedState = function(handler){
10893 aspxGetStateController().AfterClearFocusedState.AddHandler(handler);
10894};
10895ASPx.AddAfterSetFocusedState = function(handler){
10896 aspxGetStateController().AfterSetFocusedState.AddHandler(handler);
10897};
10898ASPx.AddAfterClearHoverState = function(handler){
10899 aspxGetStateController().AfterClearHoverState.AddHandler(handler);
10900};
10901ASPx.AddAfterSetHoverState = function(handler){
10902 aspxGetStateController().AfterSetHoverState.AddHandler(handler);
10903};
10904ASPx.AddAfterClearPressedState = function(handler){
10905 aspxGetStateController().AfterClearPressedState.AddHandler(handler);
10906};
10907ASPx.AddAfterSetPressedState = function(handler){
10908 aspxGetStateController().AfterSetPressedState.AddHandler(handler);
10909};
10910ASPx.AddAfterDisabled = function(handler){
10911 aspxGetStateController().AfterDisabled.AddHandler(handler);
10912};
10913ASPx.AddAfterEnabled = function(handler){
10914 aspxGetStateController().AfterEnabled.AddHandler(handler);
10915};
10916ASPx.AddBeforeClearFocusedState = function(handler){
10917 aspxGetStateController().BeforeClearFocusedState.AddHandler(handler);
10918};
10919ASPx.AddBeforeSetFocusedState = function(handler){
10920 aspxGetStateController().BeforeSetFocusedState.AddHandler(handler);
10921};
10922ASPx.AddBeforeClearHoverState = function(handler){
10923 aspxGetStateController().BeforeClearHoverState.AddHandler(handler);
10924};
10925ASPx.AddBeforeSetHoverState = function(handler){
10926 aspxGetStateController().BeforeSetHoverState.AddHandler(handler);
10927};
10928ASPx.AddBeforeClearPressedState = function(handler){
10929 aspxGetStateController().BeforeClearPressedState.AddHandler(handler);
10930};
10931ASPx.AddBeforeSetPressedState = function(handler){
10932 aspxGetStateController().BeforeSetPressedState.AddHandler(handler);
10933};
10934ASPx.AddBeforeDisabled = function(handler){
10935 aspxGetStateController().BeforeDisabled.AddHandler(handler);
10936};
10937ASPx.AddBeforeEnabled = function(handler){
10938 aspxGetStateController().BeforeEnabled.AddHandler(handler);
10939};
10940ASPx.AddFocusedItemKeyDown = function(handler){
10941 aspxGetStateController().FocusedItemKeyDown.AddHandler(handler);
10942};
10943ASPx.SetHoverState = function(element){
10944 aspxGetStateController().SetCurrentHoverElementBySrcElement(element);
10945};
10946ASPx.ClearHoverState = function(evt){
10947 aspxGetStateController().SetCurrentHoverElementBySrcElement(null);
10948};
10949ASPx.UpdateHoverState = function(evt){
10950 aspxGetStateController().OnMouseMove(evt, false);
10951};
10952ASPx.SetFocusedState = function(element){
10953 aspxGetStateController().SetCurrentFocusedElementBySrcElement(element);
10954};
10955ASPx.ClearFocusedState = function(evt){
10956 aspxGetStateController().SetCurrentFocusedElementBySrcElement(null);
10957};
10958ASPx.UpdateFocusedState = function(evt){
10959 aspxGetStateController().OnFocusMove(evt);
10960};
10961ASPx.AccessibilityMarkerClass = "dxalink";
10962ASPx.AssignAccessibilityEventsToChildrenLinks = function(container, clearFocusedStateOnMouseOut){
10963 var links = ASPx.GetNodesByPartialClassName(container, ASPx.AccessibilityMarkerClass);
10964 for(var i = 0; i < links.length; i++)
10965  ASPx.AssignAccessibilityEventsToLink(links[i], clearFocusedStateOnMouseOut);
10966};
10967ASPx.AssignAccessibilityEventsToLink = function(link, clearFocusedStateOnMouseOut) {
10968 if(!ASPx.ElementContainsCssClass(link, ASPx.AccessibilityMarkerClass))
10969  return;
10970 ASPx.AssignAccessibilityEventsToLinkCore(link, clearFocusedStateOnMouseOut);
10971};
10972ASPx.AssignAccessibilityEventsToLinkCore = function (link, clearFocusedStateOnMouseOut) {
10973 ASPx.Evt.AttachEventToElement(link, "focus", function (e) { ASPx.UpdateFocusedState(e); });
10974 var clearFocusedStateHandler = function (e) { ASPx.ClearFocusedState(e); };
10975 ASPx.Evt.AttachEventToElement(link, "blur", clearFocusedStateHandler);
10976 if(clearFocusedStateOnMouseOut)
10977  ASPx.Evt.AttachEventToElement(link, "mouseout", clearFocusedStateHandler);
10978};
10979ASPx.Evt.AttachEventToDocument("mousemove", function(evt) {
10980 if(ASPx.classesScriptParsed && ASPx.StateItemsExist)
10981  aspxGetStateController().OnMouseMove(evt, true);
10982});
10983ASPx.Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseDownEventName, function(evt) {
10984 if(ASPx.classesScriptParsed && ASPx.StateItemsExist)
10985  aspxGetStateController().OnMouseDown(evt);
10986});
10987ASPx.Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseUpEventName, function(evt) {
10988 if(ASPx.classesScriptParsed && ASPx.StateItemsExist)
10989  aspxGetStateController().OnMouseUp(evt);
10990});
10991ASPx.Evt.AttachEventToDocument("mouseover", function(evt) {
10992 if(ASPx.classesScriptParsed && ASPx.StateItemsExist)
10993  aspxGetStateController().OnMouseOver(evt);
10994});
10995ASPx.Evt.AttachEventToDocument("keydown", function(evt) {
10996 if(ASPx.classesScriptParsed && ASPx.StateItemsExist)
10997  aspxGetStateController().OnKeyDown(evt);
10998});
10999ASPx.Evt.AttachEventToDocument("selectstart", function(evt) {
11000 if(ASPx.classesScriptParsed && ASPx.StateItemsExist)
11001  return aspxGetStateController().OnSelectStart(evt);
11002});
11003ASPx.GetStateController = aspxGetStateController;
11004ASPx.StateItem = ASPxStateItem;
11005})();
11006
11007(function () {
11008 var ASPx = window.ASPx || {};
11009 ASPx.ASPxImageLoad = {};
11010 ASPx.ASPxImageLoad.dxDefaultLoadingImageCssClass = "dxe-loadingImage";
11011 ASPx.ASPxImageLoad.dxDefaultLoadingImageCssClassRegexp = new RegExp("dx\\w+-loadingImage");
11012 ASPx.ASPxImageLoad.OnLoad = function (image, customLoadingImage, isOldIE, customBackgroundImageUrl) {
11013  image.dxCustomBackgroundImageUrl = "";
11014  image.dxShowLoadingImage = true;
11015  image.dxCustomLoadingImage = customLoadingImage;
11016  if (customBackgroundImageUrl != "")
11017   image.dxCustomBackgroundImageUrl = "url('" + customBackgroundImageUrl + "')";
11018  ASPx.ASPxImageLoad.prepareImageBackground(image, isOldIE);
11019  ASPx.ASPxImageLoad.removeHandlers(image);
11020  image.className = image.className.replace(ASPx.ASPxImageLoad.dxDefaultLoadingImageCssClassRegexp, "");
11021 };
11022 ASPx.ASPxImageLoad.removeASPxImageBackground = function (image, isOldIE) {
11023  if (isOldIE) 
11024   image.style.removeAttribute("background-image");
11025  else 
11026   image.style.backgroundImage = "";
11027 };
11028 ASPx.ASPxImageLoad.prepareImageBackground = function (image, isOldIE) {
11029  ASPx.ASPxImageLoad.removeASPxImageBackground(image, isOldIE);
11030  if (image.dxCustomBackgroundImageUrl != "")
11031   image.style.backgroundImage = image.dxCustomBackgroundImageUrl;
11032 };
11033 ASPx.ASPxImageLoad.removeHandlers = function (image) {
11034  image.removeAttribute("onload");
11035  image.removeAttribute("onabort");
11036  image.removeAttribute("onerror");
11037 };
11038 window.ASPx = ASPx;
11039})();
11040(function module(ASPx) {
11041ASPx.modules.Controls = module;
11042var ASPxClientBeginCallbackEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
11043 constructor: function(command){
11044  this.constructor.prototype.constructor.call(this);
11045  this.command = command;
11046 }
11047});
11048var ASPxClientGlobalBeginCallbackEventArgs = ASPx.CreateClass(ASPxClientBeginCallbackEventArgs, {
11049 constructor: function(control, command){
11050  this.constructor.prototype.constructor.call(this, command);
11051  this.control = control;
11052 }
11053});
11054var ASPxClientEndCallbackEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
11055 constructor: function(command){
11056  this.constructor.prototype.constructor.call(this);
11057  this.command = command;
11058 }
11059});
11060var ASPxClientGlobalEndCallbackEventArgs = ASPx.CreateClass(ASPxClientEndCallbackEventArgs, {
11061 constructor: function(control){
11062  this.constructor.prototype.constructor.call(this);
11063  this.control = control;
11064 }
11065});
11066var ASPxClientCustomDataCallbackEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
11067 constructor: function(result) {
11068  this.constructor.prototype.constructor.call(this);
11069  this.result = result;
11070 }
11071});
11072var ASPxClientCallbackErrorEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
11073 constructor: function (message, callbackId) {
11074  this.constructor.prototype.constructor.call(this);
11075  this.message = message;
11076  this.handled = false;
11077  this.callbackId = callbackId;
11078 }
11079});
11080var ASPxClientGlobalCallbackErrorEventArgs = ASPx.CreateClass(ASPxClientCallbackErrorEventArgs, {
11081 constructor: function (control, message, callbackId) {
11082  this.constructor.prototype.constructor.call(this, message, callbackId);
11083  this.control = control;
11084 }
11085});
11086var ASPxClientValidationCompletedEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
11087 constructor: function (container, validationGroup, invisibleControlsValidated, isValid, firstInvalidControl, firstVisibleInvalidControl) {
11088  this.constructor.prototype.constructor.call(this);
11089  this.container = container;
11090  this.validationGroup = validationGroup;
11091  this.invisibleControlsValidated = invisibleControlsValidated;
11092  this.isValid = isValid;
11093  this.firstInvalidControl = firstInvalidControl;
11094  this.firstVisibleInvalidControl = firstVisibleInvalidControl;
11095 }
11096});
11097var ASPxClientControlsInitializedEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
11098 constructor: function(isCallback) {
11099  this.isCallback = isCallback;
11100 }
11101});
11102var ASPxClientControlBeforePronounceEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
11103 constructor: function(messageParts, control){
11104  this.constructor.prototype.constructor.call(this);
11105  this.messageParts = messageParts;
11106  this.control = control;
11107 }
11108});
11109var ASPxClientControlUnloadEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
11110 constructor: function(control){
11111  this.constructor.prototype.constructor.call(this);
11112  this.control = control;
11113 }
11114});
11115var ASPxClientEndFocusEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
11116 constructor: function(item) {
11117  this.constructor.prototype.constructor.call(this);
11118  this.item = item;
11119 }
11120});
11121var ASPxClientItemFocusedEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
11122 constructor: function(item) {
11123  this.constructor.prototype.constructor.call(this);
11124  this.item = item;
11125 }
11126});
11127var BeforeInitCallbackEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
11128 constructor: function(callbackOwnerID){
11129  this.constructor.prototype.constructor.call(this);
11130  this.callbackOwnerID = callbackOwnerID;
11131 }
11132});
11133var ASPxClientBrowserWindowResizedInternalEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
11134 constructor: function(eventInfo) {
11135  this.constructor.prototype.constructor.call(this);
11136  this.htmlEvent = eventInfo.htmlEvent;
11137  this.windowClientWidth = eventInfo.wndWidth;
11138  this.windowClientHeigth = eventInfo.wndHeight;
11139  this.previousWindowClientWidth = eventInfo.prevWndWidth;
11140  this.previousWindowClientHeight = eventInfo.prevWndHeight;
11141  this.virtualKeyboardShownOnAndroid = eventInfo.virtualKeyboardShownOnAndroid;
11142 }
11143});
11144ASPx.createControl = function(type, name, windowName, properties, events, setupMethod, data){
11145 var globalName = windowName && windowName.length > 0 ? windowName : name;
11146 var dxo = new type(name);
11147 var haveWrapper = ASPx.Platform === "NETCORE" && dxo.createWrapper && !DevExpress.AspNetCore.Internal.BackwardCompatibility.useLegacyClientAPI;
11148 if(haveWrapper) {
11149  window[globalName] = dxo.createWrapper();
11150  dxo.aspNetCoreWrapperInstance = window[globalName];
11151 }
11152 else
11153  dxo.InitGlobalVariable(globalName);
11154 if(properties)
11155  dxo.SetProperties(properties);
11156 if(events)
11157  dxo.SetEvents(events);
11158 if(setupMethod)
11159  setupMethod.call(dxo);
11160 if(data)
11161  dxo.SetData(data);
11162 dxo.AfterCreate();
11163};
11164var ASPxClientControlBase = ASPx.CreateClass(null, {
11165 constructor: function(name){
11166  this.name = name;
11167  this.uniqueID = name;   
11168  this.globalName = name;
11169  this.stateObject = null;
11170  this.needEncodeState = true;
11171  this.encodeHtml = true;
11172  this.enabled = true;
11173  this.clientEnabled = true;
11174  this.savedClientEnabled = true;
11175  this.clientVisible = true;
11176  this.accessibilityCompliant = false;
11177  this.parseJSPropertiesOnCallbackError = false;
11178  this.autoPostBack = false;
11179  this.allowMultipleCallbacks = true;
11180  this.callBack = null;
11181  this.enableCallbackAnimation = false;
11182  this.enableSlideCallbackAnimation = false;
11183  this.slideAnimationDirection = null;
11184  this.beginCallbackAnimationProcessing = false;
11185  this.endCallbackAnimationProcessing = false;
11186  this.savedCallbackResult = null;
11187  this.savedCallbacks = null;
11188  this.isCallbackAnimationPrevented = false;
11189  this.lpDelay = 300;
11190  this.lpTimer = -1;
11191  this.requestCount = 0;
11192  this.enableSwipeGestures = false;
11193  this.disableSwipeGestures = false;
11194  this.supportGestures = false;
11195  this.repeatedGestureValue = 0;
11196  this.repeatedGestureCount = 0;
11197  this.isInitialized = false;
11198  this.initialFocused = false;
11199  this.leadingAfterInitCall = ASPxClientControl.LeadingAfterInitCallConsts.None; 
11200  this.serverEvents = [];
11201  this.loadingPanelElement = null;
11202  this.loadingDivElement = null;  
11203  this.hasPhantomLoadingElements = false;
11204  this.mainElement = null;
11205  this.touchUIMouseScroller = null;
11206  this.hiddenFields = {};
11207  this.scPrefix = "dx";
11208  this.callbackHandlersQueue = new ASPx.ControlCallbackHandlersQueue(this);
11209  this.callbackCommand = {};
11210  this.currentCallbackID = -1;
11211  this.InitializeIntersectionObserversManager();
11212  this.Init = new ASPxClientEvent();
11213  this.BeginCallback = new ASPxClientEvent();
11214  this.EndCallback = new ASPxClientEvent();
11215  this.EndCallbackAnimationStart = new ASPxClientEvent();
11216  this.CallbackError = new ASPxClientEvent();
11217  this.CustomDataCallback = new ASPxClientEvent();
11218  this.BeforePronounce = new ASPxClientEvent();
11219  this.Unload = new ASPxClientEvent();
11220  this.Disposed = new ASPxClientEvent(); 
11221  aspxGetControlCollection().Add(this);
11222 },
11223 Initialize: function() {
11224  if(this.callBack != null)
11225   this.InitializeCallBackData();
11226  if (this.useCallbackQueue())
11227   this.callbackQueueHelper = new ASPx.ControlCallbackQueueHelper(this);
11228  ASPx.AccessibilityUtils.createAccessibleBackgrounds(this);
11229  if(this.accessibilityCompliant)
11230   ASPx.AccessibilityPronouncer.EnsureInitialize();
11231 },
11232 FinalizeInitialization: function() { },
11233 InlineInitialize: function() {
11234  this.savedClientEnabled = this.clientEnabled;
11235 },
11236 InitializeGestures: function() {
11237  if(this.isSwipeGesturesEnabled() && this.supportGestures) {
11238   ASPx.GesturesHelper.AddSwipeGestureHandler(this.name, 
11239    function() { return this.GetCallbackAnimationElement(); }.aspxBind(this), 
11240    function(evt) { return this.CanHandleGestureCore(evt); }.aspxBind(this), 
11241    function(value) { return this.AllowStartGesture(value); }.aspxBind(this),
11242    function(value) { return this.StartGesture(); }.aspxBind(this),
11243    function(value) { return this.AllowExecuteGesture(value); }.aspxBind(this),
11244    function(value) { this.ExecuteGesture(value); }.aspxBind(this),
11245    function(value) { this.CancelGesture(value); }.aspxBind(this),
11246    this.GetDefaultanimationEngineType(),
11247    this.rtl
11248   );
11249   if(ASPx.Browser.MSTouchUI)
11250    this.touchUIMouseScroller = ASPx.MouseScroller.Create(
11251     function() { return this.GetCallbackAnimationElement(); }.aspxBind(this),
11252     function() { return null; },
11253     function() { return this.GetCallbackAnimationElement(); }.aspxBind(this),
11254     function(element) { return this.NeedPreventTouchUIMouseScrolling(element); }.aspxBind(this),
11255     true
11256    );
11257  }
11258 },
11259 isSwipeGesturesEnabled: function() {
11260  return !this.disableSwipeGestures && (this.enableSwipeGestures || ASPx.Browser.TouchUI);
11261 },
11262 isSlideCallbackAnimationEnabled: function() {
11263  return this.enableSlideCallbackAnimation || this.isSwipeGesturesEnabled(); 
11264 },
11265 InitGlobalVariable: function(varName){
11266  if(!window) return;
11267  this.globalName = varName;
11268  window[varName] = this;
11269 },
11270 SetElementDisplay: function(element, value, checkCurrentStyle, makeInline) {
11271  ASPx.SetElementDisplay(element, value, checkCurrentStyle, makeInline);
11272 },
11273 SetProperties: function(properties, obj){
11274  if(!obj) obj = this;
11275  var isAspNetCoreWrapperInstanceExist = !!obj.aspNetCoreWrapperInstance;
11276  for(var name in properties){
11277   if(!properties.hasOwnProperty(name)) continue;
11278   obj[name] = properties[name];
11279   if(isAspNetCoreWrapperInstanceExist && name.indexOf("cp") === 0)
11280    obj.aspNetCoreWrapperInstance[name] = properties[name]; 
11281  }
11282 },
11283 SetEvents: function(events, obj){
11284  if(!obj) obj = this;
11285  for(var name in events){
11286   if(events.hasOwnProperty(name) && obj[name] && obj[name].AddHandler)
11287    obj[name].AddHandler(events[name]);
11288  }
11289 },
11290 SetData: function(data){
11291 },
11292 useCallbackQueue: function(){
11293  return false;
11294 },
11295 NeedPreventTouchUIMouseScrolling: function(element) {
11296  return false;
11297 },
11298 InitializeFocus: function() {
11299  if(this.initialFocused && this.IsVisible()) {
11300   if(ASPxClientUtils.iOSPlatform || ASPxClientUtils.androidPlatform)
11301    setTimeout(function() { this.Focus(); }.bind(this), ASPx.FOCUS_TIMEOUT);
11302   else
11303    this.Focus();
11304  }
11305 },
11306 AfterCreate: function() {
11307  this.AddDefaultStateControllerItems();
11308  this.InlineInitialize();
11309  this.InitializeGestures();
11310 },
11311 AfterInitialize: function() {
11312  this.initializeAriaDescriptor();
11313  this.InitializeFocus();
11314  this.isInitialized = true;
11315  this.RaiseInit();
11316  if(this.savedCallbacks) {
11317   for(var i = 0; i < this.savedCallbacks.length; i++) 
11318    this.CreateCallbackInternal(this.savedCallbacks[i].arg, this.savedCallbacks[i].command, 
11319     false, this.savedCallbacks[i].callbackInfo);
11320   this.savedCallbacks = null;
11321  }
11322 },
11323 InitializeCallBackData: function() {
11324 },
11325 AtlasPreInitialize: function() {
11326 },
11327 AtlasInitialize: function() {
11328 },
11329 IsDOMDisposed: function() { 
11330  return !ASPx.IsExistsElement(this.GetMainElement());
11331 },
11332 initializeAriaDescriptor: function() {
11333  if(this.ariaDescription) {
11334   var descriptionObject = ASPx.Json.Eval(this.ariaDescription);
11335   if(descriptionObject) {
11336    this.ariaDescriptor = new AriaDescriptor(this, descriptionObject);
11337    this.applyAccessibilityAttributes(this.ariaDescriptor); 
11338   }
11339  }
11340 },
11341 applyAccessibilityAttributes: function() { },
11342 setAriaDescription: function(selector, argsList) {
11343  if(this.ariaDescriptor)
11344   this.ariaDescriptor.setDescription(selector, argsList || [[]]);
11345 },
11346 allowRestoreFocusOnCallbacks: function(){
11347  return this.accessibilityCompliant;
11348 },
11349 HtmlEncode: function(text) {
11350  return this.encodeHtml ? ASPx.Str.EncodeHtml(text) : text;
11351 },
11352 IsServerEventAssigned: function(eventName){
11353  return ASPx.Data.ArrayIndexOf(this.serverEvents, eventName) >= 0;
11354 },
11355 OnPost: function(args){
11356  this.SerializeStateHiddenField();
11357 },
11358 SerializeStateHiddenField: function() {
11359  this.UpdateStateObject();
11360  if(this.stateObject != null)
11361   this.UpdateStateHiddenField();
11362 },
11363 OnPostFinalization: function(args){
11364 },
11365 UpdateStateObject: function(){
11366 },
11367 UpdateStateObjectWithObject: function(obj){
11368  if(!obj) return;
11369  if(!this.stateObject)
11370   this.stateObject = { };
11371  for(var key in obj)
11372   if(obj.hasOwnProperty(key))
11373    this.stateObject[key] = obj[key];
11374 },
11375 UpdateStateHiddenField: function() {
11376  var stateHiddenField = this.GetStateHiddenField();
11377  if(stateHiddenField) {
11378   var stateObjectStr = ASPx.Json.ToJson(this.stateObject, !this.needEncodeState);
11379   stateHiddenField.value = this.needEncodeState ? ASPx.Str.EncodeHtml(stateObjectStr) : stateObjectStr;
11380  }
11381 },
11382 GetStateHiddenField: function() {
11383  return this.GetHiddenField(this.GetStateHiddenFieldName(), this.GetStateHiddenFieldID(), 
11384   this.GetStateHiddenFieldParent(), this.GetStateHiddenFieldOrigin());
11385 },
11386 GetStateHiddenFieldName: function() {
11387  return this.uniqueID;
11388 },
11389 GetStateHiddenFieldID: function() {
11390  return this.name + "_State";
11391 },
11392 GetStateHiddenFieldOrigin: function() {
11393  return this.GetMainElement();
11394 },
11395 GetStateHiddenFieldParent: function() {
11396  var element = this.GetStateHiddenFieldOrigin();
11397  return element ? element.parentNode : null;
11398 },
11399 GetHiddenField: function(name, id, parent, beforeElement) {
11400  var hiddenField = this.hiddenFields[id];
11401  if(!hiddenField || !ASPx.IsValidElement(hiddenField)) {
11402   if(parent) {
11403    var existingHiddenField = ASPx.GetElementById(this.GetStateHiddenFieldID());
11404    this.hiddenFields[id] = hiddenField = existingHiddenField || ASPx.CreateHiddenField(name, id);
11405    if(existingHiddenField)
11406     return existingHiddenField;
11407    if(beforeElement)
11408     parent.insertBefore(hiddenField, beforeElement);
11409    else
11410     parent.appendChild(hiddenField);
11411   }
11412  }
11413  return hiddenField;
11414 },
11415 GetChildElement: function(idPostfix){
11416  var mainElement = this.GetMainElement();
11417  if(idPostfix.charAt && idPostfix.charAt(0) !== "_")
11418   idPostfix = "_" + idPostfix;
11419  return mainElement ? ASPx.CacheHelper.GetCachedChildById(this, mainElement, this.name + idPostfix) : null;
11420 },
11421 getChildControl: function(idPostfix) {
11422  var result = null;
11423  var childControlId = this.getChildControlUniqueID(idPostfix);
11424  ASPx.GetControlCollection().ProcessControlsInContainer(this.GetMainElement(), function(control) {
11425   if(control.uniqueID == childControlId)
11426    result = control;
11427  });
11428  return result;  
11429 },
11430 getChildControlUniqueID: function(idPostfix) {
11431  idPostfix = idPostfix.split("_").join("$");
11432  if(idPostfix.charAt && idPostfix.charAt(0) !== "$")
11433   idPostfix = "$" + idPostfix;
11434  return this.uniqueID + idPostfix;  
11435 },
11436 getInnerControl: function(idPostfix) {
11437  var name = this.name + idPostfix;
11438  var result = window[name];
11439  return result && Ident.IsASPxClientControl(result)
11440   ? result
11441   : null;
11442 },
11443 GetParentForm: function(){
11444  return ASPx.GetParentByTagName(this.GetMainElement(), "FORM");
11445 },
11446 GetMainElement: function(){
11447  if(!ASPx.IsExistsElement(this.mainElement))
11448   this.mainElement = ASPx.GetElementById(this.GetMainElementId());
11449  return this.mainElement;
11450 },
11451 GetMainElementId: function() {
11452  return this.name;
11453 },
11454 IsLoadingContainerVisible: function(){
11455  return this.IsVisible();
11456 },
11457 GetLoadingPanelElement: function(){
11458  return ASPx.GetElementById(this.name + "_LP");
11459 },
11460 GetClonedLoadingPanel: function(){
11461  return document.getElementById(this.GetLoadingPanelElement().id + "V"); 
11462 },
11463 CloneLoadingPanel: function(element, parent) {
11464  var clone = element.cloneNode(true);
11465  clone.id = element.id + "V";
11466  parent.appendChild(clone);
11467  return clone;
11468 },
11469 CreateLoadingPanelWithoutBordersInsideContainer: function(container) {
11470  var loadingPanel = this.CreateLoadingPanelInsideContainer(container, false, true, true);
11471  var contentStyle = ASPx.GetCurrentStyle(container);
11472  if(!loadingPanel || !contentStyle)
11473   return;
11474  var elements = [ ];
11475  var table = (loadingPanel.tagName == "TABLE") ? loadingPanel : ASPx.GetNodeByTagName(loadingPanel, "TABLE", 0);
11476  if(table != null)
11477   elements.push(table);
11478  else
11479   elements.push(loadingPanel);
11480  var cells = ASPx.GetNodesByTagName(loadingPanel, "TD");
11481  if(!cells) cells = [ ];
11482  for(var i = 0; i < cells.length; i++)
11483   elements.push(cells[i]);
11484  for(var i = 0; i < elements.length; i++) {
11485   var el = elements[i];
11486   el.style.backgroundColor = contentStyle.backgroundColor;
11487   ASPx.RemoveBordersAndShadows(el);
11488  }
11489 },
11490 CreateLoadingPanelInsideContainer: function(parentElement, hideContent, collapseHeight, collapseWidth) {
11491  if(this.ShouldHideExistingLoadingElements())
11492   this.HideLoadingPanel();
11493  if(parentElement == null)
11494   return null;
11495  if(!this.IsLoadingContainerVisible()) {
11496   this.hasPhantomLoadingElements = true;
11497   return null;
11498  }
11499  var element = this.GetLoadingPanelElement();
11500  if(element != null){
11501   var width = collapseWidth ? 0 : ASPx.GetClearClientWidth(parentElement);
11502   var height = collapseHeight ? 0 : ASPx.GetClearClientHeight(parentElement);
11503   if(hideContent){
11504    for(var i = parentElement.childNodes.length - 1; i > -1; i--){
11505     if(parentElement.childNodes[i].style)
11506      parentElement.childNodes[i].style.display = "none";
11507     else if(parentElement.childNodes[i].nodeType == 3) 
11508      parentElement.removeChild(parentElement.childNodes[i]);
11509    }
11510   }
11511   else
11512    parentElement.innerHTML = "";
11513   var table = document.createElement("TABLE");
11514   parentElement.appendChild(table);
11515   table.border = 0;
11516   table.cellPadding = 0;
11517   table.cellSpacing = 0;
11518   ASPx.SetStyles(table, {
11519    width: (width > 0) ? width : "100%",
11520    height: (height > 0) ? height : "100%"
11521   });
11522   var tbody = document.createElement("TBODY");
11523   table.appendChild(tbody);
11524   var tr = document.createElement("TR");
11525   tbody.appendChild(tr);
11526   var td = document.createElement("TD");
11527   tr.appendChild(td);
11528   td.align = "center";
11529   td.vAlign = "middle";
11530   element = this.CloneLoadingPanel(element, td);
11531   ASPx.SetElementDisplay(element, true);
11532   this.loadingPanelElement = element;
11533   return element;
11534  } else
11535   parentElement.innerHTML = "&nbsp;";
11536  return null;
11537 },
11538 CreateLoadingPanelWithAbsolutePosition: function(parentElement, offsetElement) {
11539  if(this.ShouldHideExistingLoadingElements())
11540   this.HideLoadingPanel();
11541  if(parentElement == null)
11542   return null;
11543  if(!this.IsLoadingContainerVisible()) {
11544   this.hasPhantomLoadingElements = true;
11545   return null;
11546  }
11547  if(!offsetElement)
11548   offsetElement = parentElement;
11549  var element = this.GetLoadingPanelElement();
11550  if(element != null) {
11551   element = this.CloneLoadingPanel(element, parentElement);
11552   ASPx.SetStyles(element, {
11553    position: "absolute"
11554   });
11555   ASPx.SetElementDisplay(element, true);
11556   ASPx.Evt.AttachEventToElement(element, ASPx.Evt.GetMouseWheelEventName(), ASPx.Evt.PreventEvent);
11557   this.SetLoadingPanelLocation(offsetElement, element);
11558   this.loadingPanelElement = element;
11559   return element;
11560  }
11561  return null;
11562 },
11563 CreateLoadingPanelInline: function(parentElement, centerInParent){
11564  if(this.ShouldHideExistingLoadingElements())
11565   this.HideLoadingPanel();
11566  if(parentElement == null)
11567   return null;
11568  if(!this.IsLoadingContainerVisible()) {
11569   this.hasPhantomLoadingElements = true;
11570   return null;
11571  }
11572  var element = this.GetLoadingPanelElement();
11573  if(element != null) {
11574   element = this.CloneLoadingPanel(element, parentElement);
11575   if(centerInParent){
11576    ASPx.SetElementDisplay(element, true);
11577    parentElement.style.textAlign = "center";
11578   }
11579   else
11580    ASPx.SetElementDisplay(element, true);
11581   this.loadingPanelElement = element;
11582   return element;
11583  }
11584  return null;
11585 },
11586 ShowLoadingPanel: function() {
11587 },
11588 ShowLoadingElements: function() {
11589  if(this.InCallback() || this.lpTimer > -1) return;
11590  this.ShowLoadingDiv();
11591  if(this.IsCallbackAnimationEnabled())
11592   this.StartBeginCallbackAnimation();
11593  else
11594   this.ShowLoadingElementsInternal();
11595 },
11596 ShowLoadingElementsInternal: function() {
11597  if(this.lpDelay > 0 && !this.IsCallbackAnimationEnabled()) 
11598   this.lpTimer = window.setTimeout(function() { 
11599    this.ShowLoadingPanelOnTimer(); 
11600   }.aspxBind(this), this.lpDelay);
11601  else {
11602   this.RestoreLoadingDivOpacity();
11603   this.ShowLoadingPanel();
11604  }
11605 },
11606 GetLoadingPanelOffsetElement: function (baseElement) {
11607  if(this.IsCallbackAnimationEnabled()) {
11608   var element = this.GetLoadingPanelCallbackAnimationOffsetElement();
11609   if(element) {
11610    var container = typeof(ASPx.AnimationHelper) != "undefined" ? ASPx.AnimationHelper.findSlideAnimationContainer(element) : null;
11611    if(container)
11612     return container.parentNode.parentNode;
11613    else
11614     return element;
11615   }
11616  }
11617  return baseElement;
11618 },
11619 GetLoadingPanelCallbackAnimationOffsetElement: function () {
11620  return this.GetCallbackAnimationElement();
11621 },
11622 IsCallbackAnimationEnabled: function () {
11623  return (this.enableCallbackAnimation || this.isSlideCallbackAnimationEnabled()) && !this.isCallbackAnimationPrevented;
11624 },
11625 GetDefaultanimationEngineType: function() {
11626  return ASPx.AnimationEngineType.DEFAULT;
11627 },
11628 StartBeginCallbackAnimation: function () {
11629  this.beginCallbackAnimationProcessing = true;
11630  this.isCallbackFinished = false;
11631  var element = this.GetCallbackAnimationElement();
11632  if (element && this.isSlideCallbackAnimationEnabled() && this.slideAnimationDirection)
11633   ASPx.AnimationHelper.slideOut(element, this.slideAnimationDirection, this.FinishBeginCallbackAnimation.aspxBind(this), this.GetDefaultanimationEngineType(), this.rtl);
11634  else if(element && this.enableCallbackAnimation) 
11635   ASPx.AnimationHelper.fadeOut(element, this.FinishBeginCallbackAnimation.aspxBind(this), null, ASPx.AnimationEngineType.JS);
11636  else
11637   this.FinishBeginCallbackAnimation();
11638 },
11639 CancelBeginCallbackAnimation: function() {
11640  if(this.beginCallbackAnimationProcessing) {
11641   this.beginCallbackAnimationProcessing = false;
11642   var element = this.GetCallbackAnimationElement();
11643   ASPx.AnimationHelper.cancelAnimation(element);
11644  }
11645 },
11646 FinishBeginCallbackAnimation: function () {
11647  this.beginCallbackAnimationProcessing = false;
11648  if(!this.isCallbackFinished)
11649   this.ShowLoadingElementsInternal();
11650  else {
11651   this.DoCallback(this.savedCallbackResult);
11652   this.savedCallbackResult = null;
11653  }
11654 },
11655 CheckBeginCallbackAnimationInProgress: function(callbackResult) {
11656  if(this.beginCallbackAnimationProcessing) {
11657   this.savedCallbackResult = callbackResult;
11658   this.isCallbackFinished = true;
11659   return true;
11660  }
11661  return false;
11662 },
11663 StartEndCallbackAnimation: function () {
11664  this.HideLoadingPanel();
11665  this.SetInitialLoadingDivOpacity();
11666  this.RaiseEndCallbackAnimationStart();
11667  this.endCallbackAnimationProcessing = true;
11668  var element = this.GetCallbackAnimationElement();
11669  if(element && this.isSlideCallbackAnimationEnabled() && this.slideAnimationDirection) 
11670   ASPx.AnimationHelper.slideIn(element, this.slideAnimationDirection, this.FinishEndCallbackAnimation.aspxBind(this), this.GetDefaultanimationEngineType(), this.rtl);
11671  else if(element && this.enableCallbackAnimation) 
11672   ASPx.AnimationHelper.fadeIn(element, this.FinishEndCallbackAnimation.aspxBind(this), null, ASPx.AnimationEngineType.JS);
11673  else
11674   this.FinishEndCallbackAnimation();
11675  this.slideAnimationDirection = null;
11676 },
11677 FinishEndCallbackAnimation: function () {
11678  this.DoEndCallback();
11679  this.endCallbackAnimationProcessing = false;
11680  this.CheckRepeatGesture();
11681 },
11682 CheckEndCallbackAnimationNeeded: function() {
11683  if(!this.endCallbackAnimationProcessing && this.requestCount == 1) {
11684   this.StartEndCallbackAnimation();
11685   return true;
11686  }
11687  return false;
11688 },
11689 PreventCallbackAnimation: function() {
11690  this.isCallbackAnimationPrevented = true;
11691 },
11692 GetCallbackAnimationElement: function() {
11693  return null;
11694 },
11695 AssignSlideAnimationDirectionByPagerArgument: function(arg, currentPageIndex) {
11696  this.slideAnimationDirection = null;
11697  if(this.isSlideCallbackAnimationEnabled() && typeof(ASPx.AnimationHelper) != "undefined") {
11698   if(arg == PagerCommands.Next || arg == PagerCommands.Last)
11699    this.slideAnimationDirection = ASPx.AnimationHelper.SLIDE_LEFT_DIRECTION;
11700   else if(arg == PagerCommands.First || arg == PagerCommands.Prev)
11701    this.slideAnimationDirection = ASPx.AnimationHelper.SLIDE_RIGHT_DIRECTION;
11702   else if(!isNaN(currentPageIndex) && arg.indexOf(PagerCommands.PageNumber) == 0) {
11703    var newPageIndex = parseInt(arg.substring(2));
11704    if (!isNaN(newPageIndex)) {
11705     var leftDir = this.rtl ? ASPx.AnimationHelper.SLIDE_LEFT_DIRECTION : ASPx.AnimationHelper.SLIDE_RIGHT_DIRECTION;
11706     var rightDir = this.rtl ? ASPx.AnimationHelper.SLIDE_RIGHT_DIRECTION : ASPx.AnimationHelper.SLIDE_LEFT_DIRECTION;
11707     this.slideAnimationDirection = newPageIndex < currentPageIndex ? leftDir : rightDir;
11708    }
11709   }
11710  }
11711 },
11712 TryShowPhantomLoadingElements: function () {
11713  if(this.hasPhantomLoadingElements && this.InCallback()) {
11714   this.hasPhantomLoadingElements = false;
11715   this.ShowLoadingDivAndPanel();
11716  }
11717 },
11718 ShowLoadingDivAndPanel: function () {
11719  this.ShowLoadingDiv();
11720  this.RestoreLoadingDivOpacity();
11721  this.ShowLoadingPanel();
11722 },
11723 HideLoadingElements: function() {
11724  this.CancelBeginCallbackAnimation();
11725  this.HideLoadingPanel();
11726  this.HideLoadingDiv();
11727 },
11728 ShowLoadingPanelOnTimer: function() {
11729  this.ClearLoadingPanelTimer();
11730  if(!this.IsDOMDisposed()) {
11731   this.RestoreLoadingDivOpacity();
11732   this.ShowLoadingPanel();
11733  }
11734 },
11735 ClearLoadingPanelTimer: function() {
11736  this.lpTimer = ASPx.Timer.ClearTimer(this.lpTimer);  
11737 },
11738 HideLoadingPanel: function() {
11739  this.ClearLoadingPanelTimer();
11740  this.hasPhantomLoadingElements = false;
11741  if(ASPx.IsExistsElement(this.loadingPanelElement)) {
11742   ASPx.RemoveElement(this.loadingPanelElement);
11743   this.loadingPanelElement = null;
11744  }
11745 },
11746 SetLoadingPanelLocation: function(offsetElement, loadingPanel, x, y, offsetX, offsetY) {
11747  if(!ASPx.IsExists(x) || !ASPx.IsExists(y)){
11748   var x1 = ASPx.GetAbsoluteX(offsetElement);
11749   var y1 = ASPx.GetAbsoluteY(offsetElement);
11750   var x2 = x1;
11751   var y2 = y1;
11752   if(offsetElement == document.body) {
11753    x1 = 0;
11754    y1 = 0;
11755    x2 = ASPx.GetDocumentMaxClientWidth();
11756    y2 = ASPx.GetDocumentMaxClientHeight();
11757   }
11758   else{
11759    x2 += offsetElement.offsetWidth;
11760    y2 += offsetElement.offsetHeight;
11761   }
11762   if(x1 < ASPx.GetDocumentScrollLeft())
11763    x1 = ASPx.GetDocumentScrollLeft();
11764   if(y1 < ASPx.GetDocumentScrollTop())
11765    y1 = ASPx.GetDocumentScrollTop();
11766   if(x2 > ASPx.GetDocumentScrollLeft() + ASPx.GetDocumentClientWidth())
11767    x2 = ASPx.GetDocumentScrollLeft() + ASPx.GetDocumentClientWidth();
11768   if(y2 > ASPx.GetDocumentScrollTop() + ASPx.GetDocumentClientHeight())
11769    y2 = ASPx.GetDocumentScrollTop() + ASPx.GetDocumentClientHeight();
11770   x = x1 + ((x2 - x1 - loadingPanel.offsetWidth) / 2);
11771   y = y1 + ((y2 - y1 - loadingPanel.offsetHeight) / 2);
11772  }
11773  if(ASPx.IsExists(offsetX) && ASPx.IsExists(offsetY)){
11774   x += offsetX;
11775   y += offsetY;
11776  }
11777  x = ASPx.PrepareClientPosForElement(x, loadingPanel, true);
11778  y = ASPx.PrepareClientPosForElement(y, loadingPanel, false);
11779  ASPx.SetStyles(loadingPanel, { left: x, top: y });
11780 },
11781 GetLoadingDiv: function(){
11782  return ASPx.GetElementById(this.name + "_LD");
11783 },
11784 CreateLoadingDiv: function(parentElement, offsetElement){
11785  if(this.ShouldHideExistingLoadingElements())
11786   this.HideLoadingDiv();
11787  if(parentElement == null) 
11788   return null;
11789  if(!this.IsLoadingContainerVisible()) {
11790   this.hasPhantomLoadingElements = true;
11791   return null;
11792  }
11793  if(!offsetElement)
11794   offsetElement = parentElement;
11795  var div = this.GetLoadingDiv();
11796  if(div != null){
11797   div = div.cloneNode(true);
11798   parentElement.appendChild(div);
11799   ASPx.SetElementDisplay(div, true);
11800   ASPx.Evt.AttachEventToElement(div, ASPx.TouchUIHelper.touchMouseDownEventName, ASPx.Evt.PreventEvent);
11801   ASPx.Evt.AttachEventToElement(div, ASPx.TouchUIHelper.touchMouseMoveEventName, ASPx.Evt.PreventEvent);
11802   ASPx.Evt.AttachEventToElement(div, ASPx.TouchUIHelper.touchMouseUpEventName, ASPx.Evt.PreventEvent);
11803   ASPx.Evt.AttachEventToElement(div, ASPx.Evt.GetMouseWheelEventName(), ASPx.Evt.PreventEvent);
11804   this.SetLoadingDivBounds(offsetElement, div);
11805   this.loadingDivElement = div;
11806   this.SetInitialLoadingDivOpacity();
11807   return div;
11808  }
11809  return null;
11810 },
11811 SetInitialLoadingDivOpacity: function() {
11812  if(!this.loadingDivElement) return;
11813  ASPx.Attr.SaveStyleAttribute(this.loadingDivElement, "opacity");
11814  ASPx.Attr.SaveStyleAttribute(this.loadingDivElement, "filter");
11815  ASPx.SetElementOpacity(this.loadingDivElement, 0.01);
11816 },
11817 RestoreLoadingDivOpacity: function() {
11818  if(!this.loadingDivElement) return;
11819  ASPx.Attr.RestoreStyleAttribute(this.loadingDivElement, "opacity");
11820  ASPx.Attr.RestoreStyleAttribute(this.loadingDivElement, "filter");
11821 },
11822 SetLoadingDivBounds: function(offsetElement, loadingDiv) {
11823  var absX = (offsetElement == document.body) ? 0 : ASPx.GetAbsoluteX(offsetElement);
11824  var absY = (offsetElement == document.body) ? 0 : ASPx.GetAbsoluteY(offsetElement);
11825  ASPx.SetStyles(loadingDiv, {
11826   left: ASPx.PrepareClientPosForElement(absX, loadingDiv, true),
11827   top: ASPx.PrepareClientPosForElement(absY, loadingDiv, false)
11828  });
11829  var width = (offsetElement == document.body) ? ASPx.GetDocumentWidth() : offsetElement.offsetWidth;
11830  var height = (offsetElement == document.body) ? ASPx.GetDocumentHeight() : offsetElement.offsetHeight;
11831  if(height < 0) 
11832   height = 0;
11833  ASPx.SetStyles(loadingDiv, { width: width, height: height });
11834  var correctedWidth = 2 * width - loadingDiv.offsetWidth;
11835  if(correctedWidth <= 0) correctedWidth = width;
11836  var correctedHeight = 2 * height - loadingDiv.offsetHeight;
11837  if(correctedHeight <= 0) correctedHeight = height;
11838  ASPx.SetStyles(loadingDiv, { width: correctedWidth, height: correctedHeight });
11839 },
11840 ShowLoadingDiv: function() {
11841 },
11842 HideLoadingDiv: function() {
11843  this.hasPhantomLoadingElements = false;
11844  if(ASPx.IsExistsElement(this.loadingDivElement)){
11845   ASPx.RemoveElement(this.loadingDivElement);
11846   this.loadingDivElement = null;
11847  }
11848 },
11849 CanHandleGesture: function(evt) {
11850  return false;
11851 },
11852 CanHandleGestureCore: function(evt) {
11853  var source = ASPx.Evt.GetEventSource(evt);
11854  if(ASPx.GetIsParent(this.loadingPanelElement, source) || ASPx.GetIsParent(this.loadingDivElement, source))
11855   return true; 
11856  var callbackAnimationElement = this.GetCallbackAnimationElement();
11857  if(!callbackAnimationElement)
11858   return false;
11859  var animationContainer = ASPx.AnimationHelper.getSlideAnimationContainer(callbackAnimationElement, false, false);
11860  if(animationContainer && ASPx.GetIsParent(animationContainer, source) && !ASPx.GetIsParent(animationContainer.childNodes[0], source))
11861   return true; 
11862  return this.CanHandleGesture(evt); 
11863 },
11864 AllowStartGesture: function() {
11865  return !this.beginCallbackAnimationProcessing && !this.endCallbackAnimationProcessing;
11866 },
11867 StartGesture: function() {
11868 },
11869 AllowExecuteGesture: function(value) {
11870  return false;
11871 },
11872 ExecuteGesture: function(value) {
11873 },
11874 CancelGesture: function(value) {
11875  if(this.repeatedGestureCount === 0) {
11876   this.repeatedGestureValue = value;
11877   this.repeatedGestureCount = 1;
11878  }
11879  else {
11880   if(this.repeatedGestureValue * value > 0)
11881    this.repeatedGestureCount++;
11882   else
11883    this.repeatedGestureCount--;
11884   if(this.repeatedGestureCount === 0)
11885    this.repeatedGestureCount = 0;
11886  }
11887 },
11888 CheckRepeatGesture: function() {
11889  if(this.repeatedGestureCount !== 0) {
11890   if(this.AllowExecuteGesture(this.repeatedGestureValue))
11891    this.ExecuteGesture(this.repeatedGestureValue, this.repeatedGestureCount);
11892   this.repeatedGestureValue = 0;
11893   this.repeatedGestureCount = 0;
11894  }
11895 },
11896 AllowExecutePagerGesture: function (pageIndex, pageCount, value) {
11897  if(pageIndex < 0) return false;
11898  if(pageCount <= 1) return false;
11899  if(value > 0 && pageIndex === 0) return false;
11900  if(value < 0 && pageIndex === pageCount - 1) return false;
11901  return true;
11902 },
11903 ExecutePagerGesture: function(pageIndex, pageCount, value, count, method) {
11904  if(!count) count = 1;
11905  var pageIndex = pageIndex + (value < 0 ? count : -count);
11906  if(pageIndex < 0) pageIndex = 0;
11907  if(pageIndex > pageCount - 1) pageIndex = pageCount - 1;
11908  method(PagerCommands.PageNumber + pageIndex);
11909 },
11910 RaiseInit: function(){
11911  if(!this.Init.IsEmpty()){
11912   var args = new ASPxClientEventArgs();
11913   this.Init.FireEvent(this, args);
11914  }
11915 },
11916 RaiseBeginCallbackInternal: function(command){
11917  if(!this.BeginCallback.IsEmpty()){
11918   var args = new ASPxClientBeginCallbackEventArgs(command);
11919   this.BeginCallback.FireEvent(this, args);
11920  }
11921 },
11922 RaiseEndCallbackInternal: function(command) {
11923  if(!this.EndCallback.IsEmpty()){
11924   var args = new ASPxClientEndCallbackEventArgs(command);
11925   this.EndCallback.FireEvent(this, args);
11926  }
11927 },
11928 RaiseCallbackErrorInternal: function(message, callbackId) {
11929  if(!this.CallbackError.IsEmpty()) {
11930   var args = new ASPxClientCallbackErrorEventArgs(message, callbackId);
11931   this.CallbackError.FireEvent(this, args);
11932   if(args.handled)
11933    return { isHandled: true, errorMessage: args.message };
11934  }
11935 },
11936 RaiseBeginCallback: function(command){
11937  this.RaiseBeginCallbackInternal(command);    
11938  aspxGetControlCollection().RaiseBeginCallback(this, command);
11939 },
11940 RaiseEndCallback: function(command){
11941  this.RaiseEndCallbackInternal(command);
11942  aspxGetControlCollection().RaiseEndCallback(this, command);
11943 },
11944 RaiseCallbackError: function (message, callbackId) {
11945  var result = this.RaiseCallbackErrorInternal(message, callbackId);
11946  if(!result) 
11947   result = aspxGetControlCollection().RaiseCallbackError(this, message, callbackId);
11948  return result;
11949 },
11950 RaiseEndCallbackAnimationStart: function(){
11951  if(!this.EndCallbackAnimationStart.IsEmpty()){
11952   var args = new ASPxClientEventArgs();
11953   this.EndCallbackAnimationStart.FireEvent(this, args);
11954  }
11955 },
11956 RaiseBeforePronounce: function(message) {
11957  var args = new ASPxClientControlBeforePronounceEventArgs(message, this);
11958  if(!this.BeforePronounce.IsEmpty())
11959   this.BeforePronounce.FireEvent(this, args);
11960  return args;
11961 },
11962 RaiseUnload: function() {
11963  var args = new ASPxClientControlUnloadEventArgs(this);
11964  if(!this.Unload.IsEmpty())
11965   this.Unload.FireEvent(this, args);
11966 },
11967 RaiseDisposed: function() {
11968  this.Disposed.FireEvent(this, new ASPxClientEventArgs(this));
11969 },
11970 SendMessageToAssistiveTechnology: function(message) {
11971  if(!this.accessibilityCompliant)
11972   return;
11973  this.PronounceMessageInternal(message, ASPx.AccessibilityPronouncerType.live);
11974 },
11975 PronounceMessageInternal: function(messageArg, type) {
11976  var message = messageArg;
11977  if(!ASPx.Ident.IsArray(messageArg))
11978   message = [messageArg];
11979  var args = this.RaiseBeforePronounce(message);
11980  ASPx.AccessibilityPronouncer.Pronounce(args, type);
11981 },
11982 IsVisible: function() {
11983  var element = this.GetMainElement();
11984  return ASPx.IsElementVisible(element);
11985 },
11986 IsDisplayedElement: function(element) {
11987  while(element && element.tagName != "BODY") {
11988   if(!ASPx.GetElementDisplay(element)) 
11989    return false;
11990   element = element.parentNode;
11991  }
11992  return true;
11993 },
11994 IsDisplayed: function() {
11995  return this.IsDisplayedElement(this.GetMainElement());
11996 },
11997 IsHiddenElement: function(element) {
11998  return element && element.offsetWidth == 0 && element.offsetHeight == 0;
11999 },
12000 IsHidden: function() {
12001  return this.IsHiddenElement(this.GetMainElement());
12002 },
12003 IsDisposed: function() {
12004  return this.disposed;
12005 },
12006 GetParentControl: function() {
12007  var mainElement = this.getActualMainElement();
12008  var popupPostfix = ASPx.PCWIdSuffix + "-1";
12009  var result = null;
12010  ASPx.GetParent(mainElement, function(element) {
12011   if(element === mainElement || !element.id)
12012    return false;
12013   var controlName = element.id.replace(popupPostfix, "");
12014   result = ASPx.GetControlCollection().Get(controlName);
12015   return !!result;
12016  });
12017  return result;
12018 },
12019 getActualMainElement: function() { return this.GetMainElement(); },
12020 findParentByType: function (type) {
12021  var ctrl = this;
12022  while (ctrl) {
12023   var parent = ctrl.GetParentControl();
12024   if (parent && parent instanceof type)
12025    return parent;
12026   ctrl = parent;
12027  }
12028  return null;
12029 },
12030 Focus: function() {
12031 },
12032 GetClientVisible: function(){
12033  return this.GetVisible();
12034 },
12035 SetClientVisible: function(visible){
12036  this.SetVisible(visible);
12037 },
12038 GetVisible: function(){
12039  return this.clientVisible;
12040 },
12041 SetVisible: function(visible){
12042  if(this.clientVisible != visible){
12043   this.clientVisible = visible;
12044   ASPx.SetElementDisplay(this.GetMainElement(), visible);
12045   if(visible) {
12046    this.AdjustControl();
12047    var mainElement = this.GetMainElement();
12048    if(mainElement)
12049     aspxGetControlCollection().AdjustControls(mainElement);
12050   }
12051  }
12052 },
12053 GetEnabled: function() {
12054  return this.clientEnabled;
12055 },
12056 SetEnabled: function(enabled) {
12057  this.clientEnabled = enabled;
12058  if(ASPxClientControl.setEnabledLocked)
12059   return;
12060  else
12061   ASPxClientControl.setEnabledLocked = true;
12062  this.savedClientEnabled = enabled;
12063  aspxGetControlCollection().ProcessControlsInContainer(this.GetMainElement(), function(control) {
12064   if(ASPx.IsFunction(control.SetEnabled))
12065    control.SetEnabled(enabled && control.savedClientEnabled);
12066  });
12067  delete ASPxClientControl.setEnabledLocked;
12068 },
12069 InCallback: function() {
12070  return this.requestCount > 0;
12071 },
12072 DoBeginCallback: function(command) {
12073  this.RaiseBeginCallback(command || "");
12074  aspxGetControlCollection().Before_WebForm_InitCallback(this.name);
12075  if(typeof(WebForm_InitCallback) != "undefined" && WebForm_InitCallback) {
12076   __theFormPostData = "";
12077   __theFormPostCollection = [ ];
12078   this.ClearPostBackEventInput("__EVENTTARGET");
12079   this.ClearPostBackEventInput("__EVENTARGUMENT");
12080   WebForm_InitCallback();
12081   this.savedFormPostData = __theFormPostData;
12082   this.savedFormPostCollection = __theFormPostCollection;
12083  }
12084 },
12085 ClearPostBackEventInput: function(id){
12086  var element = ASPx.GetElementById(id);
12087  if(element != null) element.value = "";
12088 },
12089 PerformDataCallback: function(arg, handler) {
12090  this.CreateCustomDataCallback(arg, "", handler);
12091 },
12092 sendCallbackViaQueue: function (prefix, arg, showLoadingPanel, context, handler, onBeforeSend) {
12093  if (!this.useCallbackQueue())
12094   return false;
12095  var context = context || this;
12096  var token = this.callbackQueueHelper.sendCallback(ASPx.FormatCallbackArg(prefix, arg), context, handler || context.OnCallback, prefix, onBeforeSend);
12097  if (showLoadingPanel)
12098   this.callbackQueueHelper.showLoadingElements();
12099  return token;
12100 },
12101 CreateCallback: function (arg, command, handler) {
12102  var callbackInfo = this.CreateCallbackInfo(ASPx.CallbackType.Common, handler || null);
12103  var callbackID = this.CreateCallbackByInfo(arg, command, callbackInfo);
12104  return callbackID;
12105 },
12106 CreateCustomDataCallback: function(arg, command, handler) {
12107  var callbackInfo = this.CreateCallbackInfo(ASPx.CallbackType.Data, handler);
12108  this.CreateCallbackByInfo(arg, command, callbackInfo);
12109 },
12110 CreateCallbackByInfo: function(arg, command, callbackInfo) {
12111  if(!this.CanCreateCallback()) return;
12112  var callbackID;
12113  if(typeof(WebForm_DoCallback) != "undefined" && WebForm_DoCallback && ASPx.documentLoaded || ASPx.Platform === "NETCORE")
12114   callbackID = this.CreateCallbackInternal(arg, command, true, callbackInfo);
12115  else {
12116   if(!this.savedCallbacks)
12117    this.savedCallbacks = [];
12118   var callbackInfo = { arg: arg, command: command, callbackInfo: callbackInfo };
12119   if(this.allowMultipleCallbacks)
12120    this.savedCallbacks.push(callbackInfo);
12121   else
12122    this.savedCallbacks[0] = callbackInfo;
12123  }
12124  return callbackID;
12125 },
12126 CreateCallbackInternal: function(arg, command, viaTimer, callbackInfo) {
12127  var watcher = ASPx.ControlUpdateWatcher.getInstance();
12128  if(watcher && !watcher.CanSendCallback(this, arg)) {
12129   this.CancelCallbackInternal();
12130   return;
12131  }
12132  this.requestCount++;
12133  this.DoBeginCallback(command);
12134  if(typeof(arg) == "undefined")
12135   arg = "";
12136  if(typeof(command) == "undefined")
12137   command = "";
12138  var callbackID = this.SaveCallbackInfo(callbackInfo, command),
12139   customArgs = this.GetCustomCallbackArgs();
12140  if(viaTimer)
12141   window.setTimeout(function() { this.CreateCallbackCoreWithCustomArgs(arg, command, callbackID, customArgs); }.aspxBind(this), 0);
12142  else
12143   this.CreateCallbackCoreWithCustomArgs(arg, command, callbackID, customArgs);
12144  return callbackID;
12145 },
12146 CreateCallbackCoreWithCustomArgs: function(arg, command, callbackID, customArgs) {
12147  this.CreateCallbackCore(arg, command, callbackID);
12148 },
12149 GetCustomCallbackArgs: function() {
12150  return {};
12151 },
12152 CancelCallbackInternal: function() {
12153  this.CancelCallbackCore();
12154  this.HideLoadingElements();
12155 },
12156 CancelCallbackCore: function() {
12157 },
12158 CreateCallbackCore: function(arg, command, callbackID) {
12159  var callBackMethod = this.GetCallbackMethod(command);
12160  __theFormPostData = this.savedFormPostData;
12161  __theFormPostCollection = this.savedFormPostCollection;
12162  callBackMethod.call(this, this.GetSerializedCallbackInfoByID(callbackID) + arg);
12163 },
12164 GetCallbackMethod: function(command){
12165  return this.callBack;
12166 },
12167 CanCreateCallback: function() {
12168  return !this.InCallback() || (this.allowMultipleCallbacks && !this.beginCallbackA
12168nimationProcessing && !this.endCallbackAnimationProcessing);
12169 },
12170 DoLoadCallbackScripts: function() {
12171  ASPx.ProcessScriptsAndLinks(this.name, true);
12172 },
12173 DoEndCallback: function() {
12174  if(this.IsCallbackAnimationEnabled() && this.CheckEndCallbackAnimationNeeded()) 
12175   return;
12176  this.requestCount--;
12177  if (this.requestCount < 1) 
12178   this.callbackHandlersQueue.executeCallbacksHandlers();
12179  if(this.HideLoadingPanelOnCallback() && this.requestCount < 1) 
12180   this.HideLoadingElements();
12181  if(this.isSwipeGesturesEnabled() && this.supportGestures) {
12182   ASPx.GesturesHelper.UpdateSwipeAnimationContainer(this.name);
12183   if(this.touchUIMouseScroller)
12184    this.touchUIMouseScroller.update();
12185  }
12186  this.isCallbackAnimationPrevented = false;
12187  this.OnCallbackFinalized();
12188  this.AssignEllipsisTooltips();
12189  var command = this.GetCallbackCommand();
12190  this.RaiseEndCallback(command);
12191  this.InitializeIntersectionObserversManager();
12192  this.currentCallbackID = -1;
12193 },
12194 DoFinalizeCallback: function() {
12195 },
12196 OnCallbackFinalized: function() {
12197 },
12198 AssignEllipsisTooltips: function() { },
12199 GetCallbackCommand: function() {
12200  var result = "";
12201  if(this.currentCallbackID != -1) {
12202   var command = this.callbackCommand[this.currentCallbackID];
12203   if(command)
12204    result = command;
12205  }
12206  return result;
12207 },
12208 HideLoadingPanelOnCallback: function() {
12209  return true;
12210 },
12211 ShouldHideExistingLoadingElements: function() {
12212  return true;
12213 },
12214 EvalCallbackResult: function(resultString) {
12215  return eval(resultString);
12216 },
12217 ParseJSProperties: function(resultObj) {
12218  if(resultObj.cp) {
12219   for(var name in resultObj.cp)
12220    if(resultObj.cp.hasOwnProperty(name)) {
12221     this[name] = resultObj.cp[name];
12222     if(this.aspNetCoreWrapperInstance)
12223      this.aspNetCoreWrapperInstance[name] = resultObj.cp[name]; 
12224    }
12225  }
12226 },
12227 DoCallback: function(result) {
12228  if(this.IsCallbackAnimationEnabled() && this.CheckBeginCallbackA
12228nimationInProgress(result))
12229   return;
12230  result = ASPx.Str.Trim(result);
12231  if(result.indexOf(ASPx.CallbackResultPrefix) != 0) 
12232   this.ProcessCallbackGeneralError(result, false);
12233  else {
12234   var resultObj = null;
12235   try {
12236    resultObj = this.EvalCallbackResult(result);
12237   } 
12238   catch(e) {
12239   }
12240   if(resultObj) {
12241    this.currentCallbackID = resultObj.id;
12242    ASPx.CacheHelper.DropCache(this);
12243    if(resultObj.redirect) {
12244     this.ParseJSProperties(resultObj); 
12245     ASPx.Url.Redirect(resultObj.redirect);
12246    }
12247    else if(ASPx.IsExists(resultObj.generalError)) {
12248     this.ProcessCallbackGeneralError(resultObj.generalError, true);
12249    }
12250    else {
12251     var errorObj = resultObj.error;
12252     if(errorObj) { 
12253      if(this.parseJSPropertiesOnCallbackError)
12254       this.ParseJSProperties(resultObj);
12255      this.ProcessCallbackError(errorObj,resultObj.id);
12256     } else {
12257      this.ParseJSProperties(resultObj);
12258      var callbackInfo = this.DequeueCallbackInfo(resultObj.id);
12259      if(callbackInfo && callbackInfo.type == ASPx.CallbackType.Data)
12260       this.ProcessCustomDataCallback(resultObj.result, callbackInfo);
12261      else {
12262       if (this.useCallbackQueue() && this.callbackQueueHelper.getCallbackInfoById(resultObj.id))
12263        this.callbackQueueHelper.processCallback(resultObj.result, resultObj.id);
12264       else {
12265        this.ProcessCallback(resultObj.result, resultObj.id);
12266        if(callbackInfo && callbackInfo.handler) {
12267         var handlerInfo = { handler: callbackInfo.handler, result: resultObj.result.data };
12268         this.callbackHandlersQueue.addCallbackHandler(handlerInfo);
12269        }
12270       }
12271      }
12272     }
12273    }
12274   }
12275  }
12276  this.DoLoadCallbackScripts();
12277 },
12278 DoCallbackError: function(result) {
12279  this.HideLoadingElements();
12280  this.ProcessCallbackGeneralError(result, false); 
12281 },
12282 DoControlClick: function(evt) {
12283  this.OnControlClick(ASPx.Evt.GetEventSource(evt), evt);
12284 },
12285 ProcessCallback: function (result, callbackId) {
12286  this.OnCallback(result, callbackId);
12287 },
12288 ProcessCustomDataCallback: function(result, callbackInfo) {
12289  if(callbackInfo.handler != null)
12290   callbackInfo.handler(this, result);
12291  this.RaiseCustomDataCallback(result);
12292 },
12293 RaiseCustomDataCallback: function(result) {
12294  if(!this.CustomDataCallback.IsEmpty()) {
12295   var arg = new ASPxClientCustomDataCallbackEventArgs(result);
12296   this.CustomDataCallback.FireEvent(this, arg);
12297  }
12298 },
12299 OnCallback: function(result) {
12300 },
12301 CreateCallbackInfo: function(type, handler) {
12302  return { type: type, handler: handler };
12303 },
12304 GetSerializedCallbackInfoByID: function(callbackID) {
12305  return this.GetCallbackInfoByID(callbackID).type + callbackID + ASPx.CallbackSeparator;
12306 },
12307 SaveCallbackInfo: function(info, command) {
12308  var callbacks = this.GetActiveCallbacksInfo();
12309  var index = callbacks.indexOf(null);
12310  if(index === -1)
12311   index = callbacks.length;
12312  callbacks[index] = info;
12313  this.callbackCommand[index] = command;
12314  return index;
12315 },
12316 GetActiveCallbacksInfo: function() {
12317  var persistentProperties = this.GetPersistentProperties();
12318  if(!persistentProperties.activeCallbacks)
12319   persistentProperties.activeCallbacks = [ ];
12320  return persistentProperties.activeCallbacks;
12321 },
12322 GetPersistentProperties: function() {
12323  var storage = _aspxGetPersistentControlPropertiesStorage();
12324  var persistentProperties = storage[this.name];
12325  if(!persistentProperties) {
12326   persistentProperties = { };
12327   storage[this.name] = persistentProperties;
12328  }
12329  return persistentProperties;
12330 },
12331 GetCallbackInfoByID: function(callbackID) {
12332  return this.GetActiveCallbacksInfo()[callbackID];
12333 },
12334 DequeueCallbackInfo: function(index) {
12335  var activeCallbacksInfo = this.GetActiveCallbacksInfo();
12336  if(index < 0 || index >= activeCallbacksInfo.length)
12337   return null;
12338  var result = activeCallbacksInfo[index];
12339  activeCallbacksInfo[index] = null;
12340  return result;
12341 },
12342 ProcessCallbackError: function (errorObj, callbackId) {
12343  var data = ASPx.IsExists(errorObj.data) ? errorObj.data : null;
12344  var result = this.RaiseCallbackError(errorObj.message, callbackId);
12345  if(result.isHandled)
12346   this.OnCallbackErrorAfterUserHandle(result.errorMessage, data); 
12347  else
12348   this.OnCallbackError(result.errorMessage, data); 
12349 },
12350 OnCallbackError: function(errorMessage, data) {
12351  if(errorMessage)
12352   ASPx.ShowErrorAlert(errorMessage);
12353 },
12354 OnCallbackErrorAfterUserHandle: function(errorMessage, data) {
12355 },
12356 ProcessCallbackGeneralError: function(errorMessage, serverExceptionOnLastCallback) {
12357  this.serverExceptionOnLastCallback = serverExceptionOnLastCallback;
12358  var result = this.RaiseCallbackError(errorMessage);
12359  if(result.isHandled)
12360   this.OnCallbackGeneralErrorAfterUserHandle(result.errorMessage);
12361  else
12362   this.OnCallbackGeneralError(result.errorMessage);
12363 },
12364 OnCallbackGeneralError: function(errorMessage) {
12365  this.OnCallbackError(errorMessage, null);
12366 },
12367 OnCallbackGeneralErrorAfterUserHandle: function (errorMessage) {
12368 },
12369 SendPostBack: function(params, preventConvertToUpdatePanelCallback) {
12370  if(preventConvertToUpdatePanelCallback)
12371   this.sendMSAjaxCompatPostBack(params);
12372  else
12373   this.sendPostBackInternal(params);
12374 },
12375 sendPostBackInternal: function(params) {
12376  if(typeof(__doPostBack) != "undefined")
12377   __doPostBack(this.uniqueID, params);
12378  else{
12379   var form = this.GetParentForm();
12380   if(form) form.submit();
12381  }
12382 },
12383 sendMSAjaxCompatPostBack: function(params) {
12384  var rm = ASPx.GetMSAjaxRequestManager();
12385  var triggers = rm ? rm._postBackControlClientIDs : null;
12386  var needRegister = triggers && ASPx.Ident.IsArray(triggers) && ASPx.Data.ArrayIndexOf(triggers, this.name) == -1;
12387  if(needRegister)
12388   triggers.unshift(this.name);
12389  this.sendPostBackInternal(params);
12390  if(needRegister)
12391   triggers.shift();
12392 },
12393 IsValidInstance: function () {
12394  return aspxGetControlCollection().GetByName(this.name) === this;
12395 },
12396 OnDispose: function() { 
12397  this.RaiseDisposed();
12398  var varName = this.globalName;
12399  if(varName && varName !== "" && window && window[varName] && window[varName] == this){
12400   try{
12401    delete window[varName];
12402   }
12403   catch(e){  }
12404  }
12405  if(this.callbackQueueHelper)
12406   this.callbackQueueHelper.detachEvents();
12407  if (!this.IsDisposed())
12408   this.disposed = true;
12409 },
12410 OnGlobalControlsInitialized: function(args) { 
12411 },
12412 OnGlobalBrowserWindowResized: function(args) { 
12413 },
12414 OnGlobalBeginCallback: function(args) { 
12415 },
12416 OnGlobalEndCallback: function(args) { 
12417 },
12418 OnGlobalCallbackError: function(args) { 
12419 },
12420 OnGlobalValidationCompleted: function(args) { 
12421 },
12422 AddDefaultStateControllerItems: function() {
12423  var states = this.scStates;
12424  if(!states) return;
12425  var postfix = this.scPostfix ? ("_" + this.scPostfix) : "";
12426  var mainElementId = this.GetMainElementId();
12427  if(states & 2)
12428   this.AddDefaultReadOnlyStateControllerItem(this.scPrefix + "ReadOnly" + postfix, mainElementId);
12429  if(states & 4)
12430   this.AddDefaultDisabledStateControllerItem(this.scPrefix + "Disabled" + postfix, mainElementId);
12431 },
12432 AddDefaultReadOnlyStateControllerItem: function(cssClass, mainElementId) { throw "Not implemented"; },
12433 AddDefaultDisabledStateControllerItem: function(cssClass, mainElementId) { throw "Not implemented"; },
12434 DOMContentLoaded: function() { },
12435 IsStateControllerEnabled: function() { return false; },
12436 InitializeDOM: function() {
12437  var mainElement = this.GetMainElement();
12438  if(mainElement)
12439   ASPx.SetElementInitializedFlag(mainElement);
12440 },
12441 IsDOMInitialized: function() {
12442  var mainElement = this.GetMainElement();
12443  return mainElement && ASPx.GetElementInitializedFlag(mainElement);
12444 },
12445 AdjustControl: function(nestedCall) { },
12446 OnBrowserWindowResizeInternal: function(e) { },
12447 RegisterInControlTree: function(tree) { },
12448 InitializeIntersectionObserversManager: function () {
12449  var elementToObserve = this.getElementToObserveVisibilityChange();
12450  if(elementToObserve) {
12451   ASPx.IntersectionObserversManager.SubscribeElemensVisibilityChangeInBrowserWindow(elementToObserve, this.processVisibilityChanged.bind(this));
12452  }
12453 },
12454 getElementToObserveVisibilityChange: function () { },
12455 processVisibilityChanged: function (visible) { }
12456});
12457ASPxClientControlBase.Cast = function(obj) {
12458 if(typeof obj == "string")
12459  return window[obj];
12460 return obj;
12461};
12462var persistentControlPropertiesStorage = null;
12463function _aspxGetPersistentControlPropertiesStorage() {
12464 if(persistentControlPropertiesStorage == null)
12465  persistentControlPropertiesStorage = { };
12466 return persistentControlPropertiesStorage;
12467}
12468var ELLIPSIS_MARKER_CLASS = "dx-ellipsis";
12469var ELLIPSIS_TOOLTIP_MARKER_ATTR = "dxEllipsisTitle";
12470var ASPxClientControl = ASPx.CreateClass(ASPxClientControlBase, {
12471 constructor: function(name){
12472  this.constructor.prototype.constructor.call(this, name);
12473  this.rtl = false;
12474  this.enableEllipsis = false;
12475  this.isNative = false;
12476  this.isControlCollapsed = false;
12477  this.isInsideHierarchyAdjustment = false;
12478  this.controlOwner = null;
12479  this.adjustedSizes = { };
12480  this.dialogContentHashTable = { };
12481  this.renderIFrameForPopupElements = false;
12482  this.widthValueSetInPercentage = false;
12483  this.heightValueSetInPercentage = false;
12484  this.verticalAlignedElements = { };
12485  this.wrappedTextContainers = { };
12486  this.scrollPositionState = { };
12487  this.sizingConfig = {
12488   allowSetWidth: true,
12489   allowSetHeight: true,
12490   correction : false,
12491   adjustControl : false,
12492   supportPercentHeight: false,
12493   supportAutoHeight: false
12494  };
12495  this.percentSizeConfig = {
12496   width: -1,
12497   height: -1,
12498   markerWidth: -1,
12499   markerHeight: -1
12500  };  
12501 },
12502 querySelector: function(selector) { return this.querySelectorAll(selector)[0] || null; },
12503 querySelectorAll: function(selector) {
12504  return ASPx.CacheHelper.GetCachedElement(this, "querySelectorAll_" + selector,
12505   function() { return Array.prototype.slice.call(this.GetMainElement().querySelectorAll(selector)); });
12506 },
12507 createAccessKey: function (popupItem, getPopupElement, keyTipElement, key, onlyClick, manualStopProcessing) {
12508  return new ASPx.AccessKey(popupItem, getPopupElement, keyTipElement, key, onlyClick, manualStopProcessing);
12509 },
12510 InlineInitialize: function() {
12511  this.InitializeDOM();
12512  ASPxClientControlBase.prototype.InlineInitialize.call(this);
12513 },
12514 AfterCreate: function() { 
12515  ASPxClientControlBase.prototype.AfterCreate.call(this);
12516  if(!this.CanInitializeAdjustmentOnDOMContentLoaded() || ASPx.IsStartupScriptsRunning())
12517   this.InitializeAdjustment();
12518 },
12519 DOMContentLoaded: function() {
12520  if(this.CanInitializeAdjustmentOnDOMContentLoaded()) 
12521   this.InitializeAdjustment();
12522 },
12523 CanInitializeAdjustmentOnDOMContentLoaded: function() {
12524  return true;
12525 },
12526 InitializeAdjustment: function() {
12527  this.UpdateAdjustmentFlags();
12528  this.AdjustControl();
12529 },
12530 AfterInitialize: function() {
12531  this.AdjustControl();
12532  ASPxClientControlBase.prototype.AfterInitialize.call(this);
12533 },
12534 IsStateControllerEnabled: function(){
12535  return typeof(ASPx.GetStateController) != "undefined" && ASPx.GetStateController();
12536 },
12537 GetWidth: function() {
12538  return this.GetMainElement().offsetWidth;
12539 },
12540 GetHeight: function() {
12541  return this.GetMainElement().offsetHeight;
12542 },
12543 SetWidth: function(width) {
12544  if(this.sizingConfig.allowSetWidth)
12545   this.SetSizeCore("width", width, "GetWidth", false);
12546 },
12547 SetHeight: function(height) {
12548  if(this.sizingConfig.allowSetHeight)
12549   this.SetSizeCore("height", height, "GetHeight", false);
12550 },
12551 SetSizeCore: function(sizePropertyName, size, getFunctionName, corrected) {
12552  if(size < 0 || !this.GetMainElement())
12553   return;
12554  this.GetMainElement().style[sizePropertyName] = size + "px";
12555  this.UpdateAdjustmentFlags(sizePropertyName);
12556  if(this.sizingConfig.adjustControl)
12557   this.AdjustControl(true);
12558  if(this.sizingConfig.correction && !corrected) {
12559   var realSize = this[getFunctionName]();
12560   if(realSize != size) {
12561    var correctedSize = size - (realSize - size);
12562    this.SetSizeCore(sizePropertyName, correctedSize, getFunctionName, true);
12563   }
12564  }
12565 },
12566 AdjustControl: function(nestedCall) {
12567  if(this.IsAdjustmentRequired() && (!ASPxClientControl.adjustControlLocked || nestedCall)) {
12568   ASPxClientControl.adjustControlLocked = true;
12569   try {
12570    if(!this.IsAdjustmentAllowed())
12571     return;
12572    this.AdjustControlCore();
12573    this.UpdateAdjustedSizes();
12574   } 
12575   finally {
12576    delete ASPxClientControl.adjustControlLocked;
12577   }
12578  }
12579  this.AssignEllipsisTooltips();
12580  this.TryShowPhantomLoadingElements();
12581 },
12582 ResetControlAdjustment: function () {
12583  this.adjustedSizes = { };
12584 },
12585 UpdateAdjustmentFlags: function(sizeProperty) {
12586  var mainElement = this.GetMainElement();
12587  if(mainElement) {
12588   var mainElementStyle = ASPx.GetCurrentStyle(mainElement);
12589   this.UpdatePercentSizeConfig([mainElementStyle.width, mainElement.style.width], [mainElementStyle.height, mainElement.style.height], sizeProperty);
12590  }
12591 },
12592 UpdatePercentSizeConfig: function(widths, heights, modifyStyleProperty) {
12593  switch(modifyStyleProperty) {
12594   case "width":
12595    this.UpdatePercentWidthConfig(widths);
12596    break;
12597   case "height":
12598    this.UpdatePercentHeightConfig(heights);
12599    break;
12600   default:
12601    this.UpdatePercentWidthConfig(widths);
12602    this.UpdatePercentHeightConfig(heights);
12603    break;
12604  }
12605  this.ResetControlPercentMarkerSize();
12606 },
12607 UpdatePercentWidthConfig: function(widths) {
12608  this.widthValueSetInPercentage = false;
12609  for(var i = 0; i < widths.length; i++) {
12610   if(this.IsPercentageWidth(widths[i])) {
12611    this.percentSizeConfig.width = widths[i];
12612    this.widthValueSetInPercentage = true;
12613    break;
12614   }
12615  }
12616 },
12617 IsPercentageWidth: function(width) { return ASPx.IsPercentageSize(width); },
12618 UpdatePercentHeightConfig: function(heights) {
12619  this.heightValueSetInPercentage = false;
12620    for(var i = 0; i < heights.length; i++) {
12621   if(ASPx.IsPercentageSize(heights[i])) {
12622    this.percentSizeConfig.height = heights[i];
12623    this.heightValueSetInPercentage = true;
12624    break;
12625   }
12626  }
12627 },
12628 GetAdjustedSizes: function() {
12629  var mainElement = this.GetMainElement();
12630  if(mainElement) 
12631   return { width: mainElement.offsetWidth, height: mainElement.offsetHeight };
12632  return { width: 0, height: 0 };
12633 },
12634 IsAdjusted: function() {
12635  return (this.adjustedSizes.width && this.adjustedSizes.width > 0) && (this.adjustedSizes.height && this.adjustedSizes.height > 0);
12636 },
12637 IsAdjustmentRequired: function() {
12638  if(!this.IsAdjusted())
12639   return true;
12640  if(this.widthValueSetInPercentage)
12641   return true;
12642  if(this.heightValueSetInPercentage)
12643   return true;
12644  var sizes = this.GetAdjustedSizes();
12645  for(var name in sizes){
12646   if(this.adjustedSizes[name] !== sizes[name])
12647    return true;
12648  }
12649  return false;
12650 },
12651 IsAdjustmentAllowed: function() {
12652  var mainElement = this.GetMainElement();
12653  return mainElement && this.IsDisplayed() && !this.IsHidden() && this.IsDOMInitialized();
12654 },
12655 UpdateAdjustedSizes: function() {
12656  var sizes = this.GetAdjustedSizes();
12657  for(var name in sizes)
12658   if(sizes.hasOwnProperty(name))
12659    this.adjustedSizes[name] = sizes[name];
12660 },
12661 AdjustControlCore: function() {
12662 },
12663 AdjustAutoHeight: function() {
12664 },
12665 IsControlCollapsed: function() {
12666  return this.isControlCollapsed;
12667 },
12668 NeedCollapseControl: function() {
12669  return this.NeedCollapseControlCore() && this.IsAdjustmentRequired() && this.IsAdjustmentAllowed();
12670 },
12671 NeedCollapseControlCore: function() {
12672  return false;
12673 },
12674 CollapseEditor: function() {
12675 },
12676 CollapseControl: function() {
12677  this.SaveScrollPositions();
12678  var mainElement = this.GetMainElement(),
12679   marker = this.GetControlPercentSizeMarker();
12680  marker.style.height = this.heightValueSetInPercentage && this.sizingConfig.supp
12680ortPercentHeight
12681   ? this.percentSizeConfig.height 
12682   : (mainElement.offsetHeight + "px");
12683  mainElement.style.display = "none";
12684  this.isControlCollapsed = true;
12685 },
12686 ExpandControl: function() {
12687  var mainElement = this.GetMainElement();
12688  mainElement.style.display = "";
12689  this.GetControlPercentSizeMarker().style.height = "0px";
12690  this.isControlCollapsed = false;
12691  this.RestoreScrollPositions();
12692 },
12693 CanCauseReadjustment: function() {
12694  return this.NeedCollapseControlCore();
12695 },
12696 IsExpandableByAdjustment: function() {
12697  return false;
12698 },
12699 HasFixedPosition: function() {
12700  return false;
12701 },
12702 SaveScrollPositions: function() {
12703  var mainElement = this.GetMainElement();
12704  this.scrollPositionState.outer = ASPx.GetOuterScrollPosition(mainElement.parentNode);
12705  this.scrollPositionState.inner = ASPx.GetInnerScrollPositions(mainElement);
12706 },
12707 RestoreScrollPositions: function() {
12708  ASPx.RestoreOuterScrollPosition(this.scrollPositionState.outer);
12709  ASPx.RestoreInnerScrollPositions(this.scrollPositionState.inner);
12710 },
12711 GetControlPercentSizeMarker: function() {
12712  if(this.percentSizeMarker === undefined) {
12713   this.percentSizeMarker = ASPx.CreateHtmlElementFromString("<div style='height:0px;font-size:0px;line-height:0;width:100%;'></div>");
12714   ASPx.InsertElementAfter(this.percentSizeMarker, this.GetMainElement());
12715  }
12716  return this.percentSizeMarker;
12717 },
12718 KeepControlPercentSizeMarker: function(needCollapse, needCalculateHeight) {
12719  var marker = this.GetControlPercentSizeMarker(),
12720   markerHeight;
12721  if(needCollapse)
12722   this.CollapseControl();
12723  if(this.widthValueSetInPercentage && marker.style.width !== this.percentSizeConfig.width)
12724   marker.style.width = this.percentSizeConfig.width;
12725  if(needCalculateHeight) {
12726   if(this.IsControlCollapsed())
12727    markerHeight = marker.style.height;
12728   marker.style.height = this.percentSizeConfig.height;
12729  }
12730  this.percentSizeConfig.markerWidth = marker.offsetWidth;
12731  if(needCalculateHeight) {
12732   this.percentSizeConfig.markerHeight = marker.offsetHeight;
12733   if(this.IsControlCollapsed())
12734    marker.style.height = markerHeight;
12735   else
12736    marker.style.height = "0px";
12737  }
12738  if(needCollapse)
12739   this.ExpandControl();
12740 },
12741 ResetControlPercentMarkerSize: function() {
12742  this.percentSizeConfig.markerWidth = -1;
12743  this.percentSizeConfig.markerHeight = -1;
12744 },
12745 GetControlPercentMarkerSize: function(hideControl, force) {
12746  var needCalculateHeight = this.heightValueSetInPercentage && this.sizingConfig.supportPercentHeight;
12747  if(force || this.percentSizeConfig.markerWidth < 1 || (needCalculateHeight && this.percentSizeConfig.markerHeight < 1))
12748   this.KeepControlPercentSizeMarker(hideControl && !this.IsControlCollapsed(), needCalculateHeight);
12749  return {
12750   width: this.percentSizeConfig.markerWidth,
12751   height: this.percentSizeConfig.markerHeight
12752  };
12753 },
12754 AssignEllipsisTooltips: function() {
12755  if(this.RequireAssignTooltips())
12756   this.AssignEllipsisTooltipsCore();
12757 },
12758 AssignEllipsisTooltipsCore: function(rootElement, reassingExistingTooltips) {
12759  var requirePaddingManipulation = ASPx.Browser.Edge || ASPx.Browser.Firefox;
12760  rootElement = rootElement || this.GetMainElement();
12761  var nodes = this.GetEllipsisNodes(rootElement);
12762  var nodeInfos = [];
12763  var nodesCount = nodes.length;
12764  for(var i = 0; i < nodesCount; i++) {
12765   var node = nodes[i];
12766   var info = { node: node };
12767   if(requirePaddingManipulation) {
12768    var style = ASPx.GetCurrentStyle(node);
12769    info.paddingLeft = node.style.paddingLeft;
12770    info.totalPadding = ASPx.GetLeftRightPaddings(node, style);
12771   }
12772   nodeInfos.push(info);
12773  }
12774  if(requirePaddingManipulation) {
12775   for(var i = 0; i < nodesCount; i++) {
12776    var info = nodeInfos[i];
12777    ASPx.SetStyles(info.node, { paddingLeft: info.totalPadding }, true);
12778   }
12779  }
12780  for(var i = 0; i < nodesCount; i++) {
12781   var info = nodeInfos[i];
12782   var node = info.node;
12783   info.isTextShortened = node.scrollWidth > node.clientWidth;
12784   info.hasTitle = ASPx.Attr.GetAttribute(node, "title") !== null;
12785   if(!info.hasTitle || reassingExistingTooltips)
12786    info.title = ASPx.GetEllipsisTooltipText(node);
12787  }
12788  for(var i = 0; i < nodesCount; i++) {
12789   var info = nodeInfos[i];
12790   var node = info.node;
12791   if(info.isTextShortened && info.title) {
12792    ASPx.Attr.SetAttribute(node, "title", info.title);
12793    ASPx.Attr.SetAttribute(node, ELLIPSIS_TOOLTIP_MARKER_ATTR, true);
12794   }
12795   if(!info.isTextShortened && info.hasTitle)
12796    ASPx.Attr.RemoveAttribute(node, "title");
12797  }
12798  if(requirePaddingManipulation) {
12799   for(var i = 0; i < nodesCount; i++) {
12800    var info = nodeInfos[i];
12801    var node = info.node;
12802    node.style.paddingLeft = info.paddingLeft;
12803   }
12804  }
12805 },
12806 GetEllipsisNodes: function(element) {
12807  var ellipsibleNodes = ASPx.Data.CollectionToArray(ASPx.GetNodesByClassName(element, ELLIPSIS_MARKER_CLASS));
12808  if(ASPx.ElementHasCssClass(element, ELLIPSIS_MARKER_CLASS))
12809   ellipsibleNodes.push(element);
12810  return ellipsibleNodes.filter(function(node) {
12811   return !ASPx.Attr.IsExistsAttribute(node, "title") || ASPx.Attr.IsExistsAttribute(node, ELLIPSIS_TOOLTIP_MARKER_ATTR);
12812  });
12813 },
12814 RequireAssignTooltips: function() {
12815  return this.enableEllipsis && !ASPx.Browser.MobileUI;
12816 },
12817 RemoveEllipsisFromNode: function(node) {
12818  ASPx.RemoveClassNameFromElement(node, ELLIPSIS_MARKER_CLASS);
12819  this.RemoveEllipsisTooltip(node);
12820 },
12821 RemoveEllipsisTooltip: function(node) {
12822  if(ASPx.Attr.IsExistsAttribute(node, ELLIPSIS_TOOLTIP_MARKER_ATTR)) {
12823   ASPx.Attr.RemoveAttribute(node, "title");
12824   ASPx.Attr.RemoveAttribute(node, ELLIPSIS_TOOLTIP_MARKER_ATTR);
12825  }
12826 },
12827 OnBrowserWindowResize: function(e) {
12828 },
12829 OnBrowserWindowResizeInternal: function(e){
12830  if(this.BrowserWindowResizeSubscriber()) 
12831   this.OnBrowserWindowResize(e);
12832 },
12833 BrowserWindowResizeSubscriber: function() {
12834  return this.widthValueSetInPercentage || !this.IsAdjusted();
12835 },
12836 ShrinkWrappedText: function(getElements, key, reCorrect) {
12837  if(!ASPx.Browser.Safari) return;
12838  var elements = ASPx.CacheHelper.GetCachedElements(this, key, getElements, this.wrappedTextContainers);
12839  for(var i = 0; i < elements.length; i++)
12840   this.ShrinkWrappedTextInContainer(elements[i], reCorrect);
12841 },
12842 ShrinkWrappedTextInContainer: function(container, reCorrect) {
12843  if(!ASPx.Browser.Safari || !container || (container.dxWrappedTextShrinked && !reCorrect) || container.offsetWidth === 0) return;
12844  ASPx.ShrinkWrappedTextInContainer(container);
12845  container.dxWrappedTextShrinked = true;
12846 },
12847 CorrectWrappedText: function(getElements, key, reCorrect) {
12848  var elements = ASPx.CacheHelper.GetCachedElements(this, key, getElements, this.wrappedTextContainers);
12849  for(var i = 0; i < elements.length; i++)
12850   this.CorrectWrappedTextInContainer(elements[i], reCorrect);
12851 },
12852 CorrectWrappedTextInContainer: function(container, reCorrect) {
12853  if(!container || (container.dxWrappedTextCorrected && !reCorrect) || container.offsetWidth === 0) return;
12854  ASPx.AdjustWrappedTextInContainer(container);
12855  container.dxWrappedTextCorrected = true;
12856 },
12857 CorrectVerticalAlignment: function(alignMethod, getElements, key, reAlign) {
12858  var elements = ASPx.CacheHelper.GetCachedElements(this, key, getElements, this.verticalAlignedElements);
12859  for(var i = 0; i < elements.length; i++)
12860   this.CorrectElementVerticalAlignment(alignMethod, elements[i], reAlign);
12861 },
12862 CorrectElementVerticalAlignment: function(alignMethod, element, reAlign) {
12863  if(!element || (element.dxVerticalAligned && !reAlign) || element.offsetHeight === 0) return;
12864  alignMethod(element);
12865  element.dxVerticalAligned = true;
12866 },
12867 ClearVerticalAlignedElementsCache: function() {
12868  ASPx.CacheHelper.DropCache(this.verticalAlignedElements);
12869 },
12870 ClearWrappedTextContainersCache: function() {
12871  ASPx.CacheHelper.DropCache(this.wrappedTextContainers);
12872 },
12873 AdjustPagerControls: function() {
12874  if(typeof(ASPx.GetPagersCollection) != "undefined")
12875   ASPx.GetPagersCollection().AdjustControls(this.GetMainElement());
12876 },
12877 RegisterInControlTree: function(tree) {
12878  var mainElement = this.GetMainElement();
12879  if(mainElement && mainElement.id)
12880   tree.createNode(mainElement.id, this);
12881 },
12882 GetItemElementName: function(element) {
12883  var name = "";
12884  if(element.id)
12885   name = element.id.substring(this.name.length + 1);
12886  return name;
12887 },
12888 GetLinkElement: function(element) {
12889  if(element == null) return null;
12890  return (element.tagName == "A") ? element : ASPx.GetNodeByTagName(element, "A", 0);
12891 },
12892 GetInternalHyperlinkElement: function(parentElement, index) {
12893  var element = ASPx.GetNodeByTagName(parentElement, "A", index);
12894  if(element == null) 
12895   element = ASPx.GetNodeByTagName(parentElement, "SPAN", index);
12896  return element;
12897 },
12898 OnControlClick: function(clickedElement, htmlEvent) {
12899 }
12900});
12901ASPxClientControl.Cast = function(obj) {
12902 if(typeof obj == "string")
12903  return window[obj];
12904 return obj;
12905};
12906ASPxClientControl.AdjustControls = function(container, collapseControls){
12907 aspxGetControlCollection().AdjustControls(container, collapseControls);
12908};
12909ASPxClientControl.GetControlCollection = function(){
12910 return aspxGetControlCollection();
12911};
12912ASPxClientControl.LeadingAfterInitCallConsts = {
12913 None: 0,
12914 Direct: 1,
12915 Reverse: 2
12916};
12917var ASPxClientComponent = ASPx.CreateClass(ASPxClientControl, {
12918 constructor: function (name) {
12919  this.constructor.prototype.constructor.call(this, name);
12920 },
12921 IsDOMDisposed: function() { 
12922  return false;
12923 }
12924});
12925var ASPxClientControlCollection = ASPx.CreateClass(ASPx.CollectionBase, {
12926 constructor: function(){
12927  this.constructor.prototype.constructor.call(this);
12928  this.prevWndWidth = "";
12929  this.prevWndHeight = "";
12930  this.requestCountInternal = 0; 
12931  this.BeforeInitCallback = new ASPxClientEvent();
12932  this.ControlsInitialized = new ASPxClientEvent();
12933  this.BrowserWindowResized = new ASPxClientEvent();
12934  this.BrowserWindowResizedInternal = new ASPxClientEvent();
12935  this.BeginCallback = new ASPxClientEvent();
12936  this.EndCallback = new ASPxClientEvent();
12937  this.CallbackError = new ASPxClientEvent();
12938  this.ValidationCompleted = new ASPxClientEvent();
12939  aspxGetControlCollectionCollection().Add(this);
12940 },
12941 Add: function(element) {
12942  var existsElement = this.Get(element.name);
12943  if(existsElement && existsElement !== element) 
12944   this.Remove(existsElement);
12945  ASPx.CollectionBase.prototype.Add.call(this, element.name, element);
12946 },
12947 Remove: function(element) {
12948  if(element && element instanceof ASPxClientControl && !element.IsDisposed())
12949   element.OnDispose();
12950  ASPx.CollectionBase.prototype.Remove.call(this, element.name);
12951 },
12952 GetGlobal: function(name) {
12953  var result = window[name];
12954  return result && Ident.IsASPxClientControl(result)
12955   ? result
12956   : null;
12957 },
12958 GetByName: function(name){
12959  return this.Get(name) || this.GetGlobal(name);
12960 },
12961 GetCollectionType: function(){
12962  return ASPxClientControlCollection.BaseCollectionType;
12963 },
12964 GetControlsByPredicate: function(predicate) {
12965  var result = [];
12966  this.ForEachControl(function(control) {
12967   if(!predicate || predicate(control))
12968    result.push(control);
12969  });
12970  return result;
12971 },
12972 GetControlsByType: function(type) {
12973  return this.GetControlsByPredicate(function(control) { 
12974   return type && (control instanceof type);
12975  });
12976 },
12977 ForEachControl: function(action, context) {
12978  context = context || this;
12979  this.elementsMap.forEachEntry(function(name, control) {
12980   if(Ident.IsASPxClientControl(control) && (!this.filterPredicate || this.filterPredicate(control)))
12981    return action.call(context, control);
12982  }, context);
12983 },
12984 ProcessActionByPredicate: function(action, predicate) {
12985  try {
12986   this.filterPredicate = predicate;
12987   action(this);
12988  }
12989  finally {
12990   this.filterPredicate = null;
12991  }
12992 },
12993 adjustControlsInternal: function(container, context, collapseControls, adjustFunc) {
12994  context = context || this;
12995  var func = function(control) {
12996   adjustFunc.call(context, control);
12997  };
12998  ASPx.GetControlAdjuster().adjustControlsInHierarchy(this, func, container, collapseControls);
12999 },
13000 AdjustControls: function(container, collapseControls) {
13001  container = container || null;
13002  window.setTimeout(function() {
13003   this.AdjustControlsCore(container, collapseControls);
13004  }.aspxBind(this), 0);
13005 },
13006 AdjustControlsCore: function(container, collapseControls) {
13007  var adjustFunction = function(control) { control.AdjustControl(); };
13008  this.adjustControlsInternal(container, this, collapseControls, adjustFunction);
13009 },
13010 CollapseControls: function(container) {
13011  this.ProcessControlsInContainer(container, function(control) {
13012   if(control.isASPxClientEdit)
13013    control.CollapseEditor();
13014   else if(!!window.ASPxClientRibbon && control instanceof ASPxClientRibbon)
13015    control.CollapseControl();
13016  });
13017 },
13018 AtlasInitialize: function(isCallback) {
13019  this.ForEachControl(function(control) {
13020   control.AtlasPreInitialize();
13021  });
13022  ASPx.ProcessScriptsAndLinks("", isCallback);
13023  this.ForEachControl(function(control) {
13024   control.AtlasInitialize();
13025  });
13026 },
13027 DOMContentLoaded: function() {
13028  this.ForEachControl(function(control){
13029    control.DOMContentLoaded();
13030  });
13031 },
13032 OnDocumentUnload: function() {
13033  this.ForEachControl(function(control) {
13034   control.RaiseUnload();
13035  });
13036 },
13037 Initialize: function() {
13038  ASPx.GetPostHandler().Post.AddHandler(
13039   function(s, e) { this.OnPost(e); }.aspxBind(this)
13040  );
13041  ASPx.GetPostHandler().PostFinalization.AddHandler(
13042   function(s, e) { this.OnPostFinalization(e); }.aspxBind(this)
13043  );
13044  this.InitializeElements(false );
13045  if(typeof(Sys) != "undefined" && typeof(Sys.Application) != "undefined") {
13046   var checkIsInitialized = function() {
13047    if(Sys.Application.get_isInitialized())
13048     Sys.Application.add_load(aspxCAInit);
13049    else
13050     setTimeout(checkIsInitialized, 0);
13051   };
13052   checkIsInitialized();
13053  }
13054  this.InitWindowSizeCache();
13055 },
13056 FinalizeInitialization: function() {
13057  this.ForEachControl(function(control) {
13058   control.FinalizeInitialization();
13059  });
13060 },
13061 InitializeElements: function(isCallback) {
13062  this.ForEachControl(function(control){
13063   if(!control.isInitialized)
13064    control.Initialize();
13065  });
13066  this.AfterInitializeElementsLeadingCall();
13067  this.AfterInitializeElements();
13068  this.RaiseControlsInitialized(isCallback);
13069 },
13070 AfterInitializeElementsLeadingCall: function() {
13071  var controls = {};
13072  controls[ASPxClientControl.LeadingAfterInitCallConsts.Direct] = [];
13073  controls[ASPxClientControl.LeadingAfterInitCallConsts.Reverse] = [];
13074  this.ForEachControl(function(control) {
13075   if(control.leadingAfterInitCall != ASPxClientControl.LeadingAfterInitCallConsts.None && !control.isInitialized)
13076    controls[control.leadingAfterInitCall].push(control);
13077  });
13078  var directInitControls = controls[ASPxClientControl.LeadingAfterInitCallConsts.Direct],
13079   reverseInitControls = controls[ASPxClientControl.LeadingAfterInitCallConsts.Reverse];
13080  for(var i = 0, control; control = directInitControls[i]; i++)
13081   control.AfterInitialize();
13082  for(var i = reverseInitControls.length - 1, control; control = reverseInitControls[i]; i--)
13083   control.AfterInitialize();
13084 },
13085 AfterInitializeElements: function() {
13086  this.ForEachControl(function(control) {
13087   if(control.leadingAfterInitCall == ASPxClientControl.LeadingAfterInitCallConsts.None && !control.isInitialized)
13088    control.AfterInitialize();
13089  });
13090  ASPx.RippleHelper.Init();
13091 },
13092 DoFinalizeCallback: function() {
13093  this.ForEachControl(function(control){
13094   control.DoFinalizeCallback();
13095  });
13096 },
13097 ProcessControlsInContainer: function(container, processFunc, filterFunc) {
13098  this.ForEachControl(function(control){
13099   if((!filterFunc || filterFunc(control)) && (!container || this.IsControlInContainer(container, control)))
13100    processFunc(control);
13101  });
13102 },
13103 IsControlInContainer: function(container, control) {
13104  if(control.GetMainElement) {
13105   var mainElement = control.GetMainElement();
13106   if(mainElement && (mainElement != container)) {
13107    if(ASPx.GetIsParent(container, mainElement))
13108     return true;
13109   }
13110  }
13111  return false;
13112 },
13113 RaiseControlsInitialized: function(isCallback) {
13114  if(typeof(isCallback) == "undefined")
13115   isCallback = true;
13116  var args = new ASPxClientControlsInitializedEventArgs(isCallback);
13117  if(!this.ControlsInitialized.IsEmpty())  
13118   this.ControlsInitialized.FireEvent(this, args);
13119  this.ForEachControl(function(control){
13120   control.OnGlobalControlsInitialized(args);
13121  });
13122 },
13123 RaiseBrowserWindowResized: function() {
13124  var args = new ASPxClientEventArgs();
13125  if(!this.BrowserWindowResized.IsEmpty())
13126   this.BrowserWindowResized.FireEvent(this, args);
13127  this.ForEachControl(function(control){
13128   control.OnGlobalBrowserWindowResized(args);
13129  });
13130 },
13131 RaiseBrowserWindowResizedInternal: function(eventInfo) {
13132  var args = new ASPxClientBrowserWindowResizedInternalEventArgs(eventInfo);
13133  if(!this.BrowserWindowResizedInternal.IsEmpty())
13134   this.BrowserWindowResizedInternal.FireEvent(this, args);
13135 },
13136 RaiseBeginCallback: function (control, command) {
13137  var args = new ASPxClientGlobalBeginCallbackEventArgs(control, command);
13138  if(!this.BeginCallback.IsEmpty())
13139   this.BeginCallback.FireEvent(this, args);
13140  this.ForEachControl(function(control){
13141   control.OnGlobalBeginCallback(args);
13142  });
13143  this.IncrementRequestCount();
13144 },
13145 RaiseEndCallback: function (control) {
13146  var args = new ASPxClientGlobalEndCallbackEventArgs(control);
13147  if (!this.EndCallback.IsEmpty()) 
13148   this.EndCallback.FireEvent(this, args);
13149  this.ForEachControl(function(control){
13150   control.OnGlobalEndCallback(args);
13151  });
13152  this.DecrementRequestCount();
13153 },
13154 InCallback: function() {
13155  return this.requestCountInternal > 0;
13156 },
13157 RaiseCallbackError: function (control, message, callbackId) {
13158  var args = new ASPxClientGlobalCallbackErrorEventArgs(control, message, callbackId);
13159  if (!this.CallbackError.IsEmpty()) 
13160   this.CallbackError.FireEvent(this, args);
13161  this.ForEachControl(function(control){
13162   control.OnGlobalCallbackError(args);
13163  });
13164  if(args.handled)
13165   return { isHandled: true, errorMessage: args.message };  
13166  return { isHandled: false, errorMessage: message };
13167 },
13168 RaiseValidationCompleted: function (container, validationGroup, invisibleControlsValidated, isValid, firstInvalidControl, firstVisibleInvalidControl) {
13169  var args = new ASPxClientValidationCompletedEventArgs(container, validationGroup, invisibleControlsValidated, isValid, firstInvalidControl, firstVisibleInvalidControl);
13170  if (!this.ValidationCompleted.IsEmpty()) 
13171   this.ValidationCompleted.FireEvent(this, args);
13172  this.ForEachControl(function(control){
13173   control.OnGlobalValidationCompleted(args);
13174  });
13175  return args.isValid;
13176 },
13177 Before_WebForm_InitCallback: function(callbackOwnerID){
13178  var args = new BeforeInitCallbackEventArgs(callbackOwnerID);
13179  this.BeforeInitCallback.FireEvent(this, args);
13180 },
13181 InitWindowSizeCache: function(){
13182  this.prevWndWidth = ASPx.GetDocumentClientWidth();
13183  this.prevWndHeight = ASPx.GetDocumentClientHeight();
13184 },
13185 OnBrowserWindowResize: function(evt){
13186  this.OnBrowserWindowResizeCore(evt);
13187 },
13188 OnBrowserWindowResizeCore: function(htmlEvent){
13189  var args = this.CreateOnBrowserWindowResizeEventArgs(htmlEvent);
13190  if(this.CalculateIsBrowserWindowSizeChanged()) {
13191   this.RaiseBrowserWindowResizedInternal(args);
13192   this.adjustControlsInternal(null, this, true, function(control) {
13193    if(control.IsDOMInitialized())
13194     control.OnBrowserWindowResizeInternal(args);
13195   });
13196   this.RaiseBrowserWindowResized();
13197  }
13198 },
13199 CreateOnBrowserWindowResizeEventArgs: function(htmlEvent) {
13200  return {
13201   htmlEvent: htmlEvent,
13202   wndWidth: ASPx.GetDocumentClientWidth(),
13203   wndHeight: ASPx.GetDocumentClientHeight(),
13204   prevWndWidth: this.prevWndWidth,
13205   prevWndHeight: this.prevWndHeight,
13206   virtualKeyboardShownOnAndroid: this.IsVirtualKeyboardShownOnAndroid()
13207  };
13208 },
13209 IsVirtualKeyboardShownOnAndroid: function() {
13210  if(!ASPx.Browser.AndroidMobilePlatform)
13211   return false;
13212  var documentClientWidth = ASPx.GetDocumentClientWidth();
13213  var documentClientHeight = ASPx.GetDocumentClientHeight();
13214  var isDocumentClientHeightChangedOnly = documentClientWidth === this.prevWndWidth && documentClientHeight !== this.prevWndHeight;
13215  return isDocumentClientHeightChangedOnly && this.IsElementSupportKeyboardInput(document.activeElement);
13216 },
13217 IsElementSupportKeyboardInput: function(element) {
13218  if(!element || !element.tagName)
13219   return false;
13220  var supportedKeyboardInputTagNames = ["INPUT", "TEXTAREA"];
13221  return supportedKeyboardInputTagNames.indexOf(element.tagName) !== -1;
13222 },
13223 CalculateIsBrowserWindowSizeChanged: function(){
13224  var wndWidth = ASPx.GetDocumentClientWidth();
13225  var wndHeight = ASPx.GetDocumentClientHeight();
13226  var isBrowserWindowSizeChanged = (this.prevWndWidth != wndWidth) || (this.prevWndHeight != wndHeight);
13227  if(isBrowserWindowSizeChanged){
13228   this.prevWndWidth = wndWidth;
13229   this.prevWndHeight = wndHeight;
13230   return true;
13231  }
13232  return false;
13233 },
13234 OnPost: function(args){
13235  this.ForEachControl(function(control) {
13236   control.OnPost(args);
13237  }, null);
13238 },
13239 OnPostFinalization: function(args){
13240  this.ForEachControl(function(control) {
13241   control.OnPostFinalization(args);
13242  }, null);
13243 },
13244 IncrementRequestCount: function() {
13245  this.requestCountInternal++;
13246 },
13247 DecrementRequestCount: function() {
13248  this.requestCountInternal--;
13249 },
13250 ResetRequestCount: function() {
13251  this.requestCountInternal = 0;
13252 }
13253});
13254ASPxClientControlCollection.BaseCollectionType = "Control";
13255var controlCollection = null;
13256function aspxGetControlCollection(){
13257 if(controlCollection == null) {
13258  controlCollection = new ASPxClientControlCollection();
13259  if(ASPx.loadControlCollectionPreloadHandlers)
13260   ASPx.loadControlCollectionPreloadHandlers(controlCollection);
13261 }
13262 return controlCollection;
13263}
13264var ControlCollectionCollection = ASPx.CreateClass(ASPx.CollectionBase, {
13265 constructor: function(){
13266  this.constructor.prototype.constructor.call(this);
13267 },
13268 Add: function(element) {
13269  var key = element.GetCollectionType();
13270  if(!key) throw "The collection type isn't specified.";
13271  if(this.Get(key)) throw "The collection with type='" + key + "' already exists.";
13272  ASPx.CollectionBase.prototype.Add.call(this, key, element);
13273 },
13274 RemoveDisposedControls: function(){
13275  var baseCollection = this.Get(ASPxClientControlCollection.BaseCollectionType);
13276  var disposedControls = [];
13277  baseCollection.elementsMap.forEachEntry(function(name, control) {
13278   if(!ASPx.Ident.IsASPxClientControl(control)) return;
13279   if(control.IsDOMDisposed())
13280    disposedControls.push(control);
13281  });
13282  this.RemoveControls(disposedControls);
13283 },
13284 RemoveControls: function(controls){
13285  for(var i = 0; i < controls.length; i++) {
13286   this.elementsMap.forEachEntry(function(key, collection) {
13287    if(ASPx.Ident.IsASPxClientCollection(collection))
13288     collection.Remove(controls[i]);
13289   });
13290  }
13291 }
13292});
13293var controlCollectionCollection = null;
13294function aspxGetControlCollectionCollection(){
13295 if(controlCollectionCollection == null)
13296  controlCollectionCollection = new ControlCollectionCollection();
13297 return controlCollectionCollection;
13298}
13299var AriaDescriptionAttributes = {
13300 Role: "0",
13301 AriaLabel: "1",
13302 TabIndex: "2",
13303 AriaOwns: "3",
13304 AriaDescribedBy: "4",
13305 AriaDisabled: "5",
13306 AriaHasPopup: "6",
13307 AriaLevel: "7"
13308};
13309var AriaDescriptor = ASPx.CreateClass(null, {
13310 constructor: function(ownerControl, description) {
13311  this.ownerControl = ownerControl;
13312  this.rootElement = ownerControl.GetMainElement();
13313  this.description = description;
13314 },
13315 setDescription: function(name, argList) {
13316  var description = this.findChildDescription(name);
13317  if(description) {
13318   var elements = name ? this.rootElement.querySelectorAll(this.getDescriptionSelector(description)) : [this.rootElement];
13319   for(var i = 0; i < elements.length; i++)
13320    this.applyDescriptionToElement(elements[i], description, argList[i] || argList[0]);
13321  }
13322 },
13323 getDescriptionName: function(description) {
13324  return description.n;
13325 },
13326 getDescriptionSelector: function(description) {
13327  return description.s;
13328 },
13329 findChildDescription: function(name) {
13330  if(name === this.getDescriptionName(this.description))
13331   return this.description;
13332  var childCollection = this.description.c || [];
13333  for(var i = 0; i < childCollection.length; i++) {
13334   var childDescription = childCollection[i];
13335   if(this.getDescriptionName(childDescription) === name)
13336    return childDescription;
13337  }
13338  return null;
13339 },
13340 applyDescriptionToElement: function(element, description, args) {
13341  if(!description || !element)
13342   return;
13343  this.trySetAriaOwnsAttribute(element, description);
13344  this.trySetAriaDescribedByAttribute(element, description);
13345  this.trySetAttribute(element, description, AriaDescriptionAttributes.Role, "role");
13346  this.trySetAttribute(element, description, AriaDescriptionAttributes.TabIndex, "tabindex");
13347  this.trySetAttribute(element, description, AriaDescriptionAttributes.AriaLevel, "aria-level");
13348  this.executeOnDescription(description, AriaDescriptionAttributes.AriaLabel, function(value) {
13349   ASPx.Attr.SetAttribute(element, "aria-label", ASPx.Str.ApplyReplacement(value, args
13349));
13350  });
13351  this.executeOnDescription(description, AriaDescriptionAttributes.AriaDisabled, function(value) {
13352   ASPx.Attr.SetAttribute(element, "aria-disabled", !!value); 
13353  });
13354  this.executeOnDescription(description, AriaDescriptionAttributes.AriaHasPopup, function(value) {
13355   ASPx.Attr.SetAttribute(element, "aria-haspopup", !!value);
13356  });
13357 },
13358 trySetAriaDescribedByAttribute: function(element, description) {
13359  this.executeOnDescription(description, AriaDescriptionAttributes.AriaDescribedBy, function(selectorInfo) {
13360   var descriptor = this.getNodesBySelector(element, selectorInfo.descriptorSelector)[0];
13361   var target = this.getNodesBySelector(element, selectorInfo.targetSelector)[0];
13362   if(!target || !descriptor)
13363    return;
13364   ASPx.Attr.SetAttribute(target, "aria-describedby", this.getNodeId(descriptor));
13365  });
13366 },
13367 trySetAriaOwnsAttribute: function(element, description) {
13368  this.executeOnDescription(description, AriaDescriptionAttributes.AriaOwns, function(selector) {
13369   var ownedNodes = this.getNodesBySelector(element, selector);
13370   var ariaOwnsAttributeValue = "";
13371   for(var i = 0; i < ownedNodes.length; i++)
13372    ariaOwnsAttributeValue += (this.getNodeId(ownedNodes[i]) + (i != ownedNodes.length - 1 ? " " : ""));
13373   ASPx.Attr.SetAttribute(element, "aria-owns", ariaOwnsAttributeValue);
13374  });
13375 },
13376 trySetAttribute: function(element, description, ariaAttribute, attributeName) {
13377  this.executeOnDescription(description, ariaAttribute, function(value) { 
13378   ASPx.Attr.SetAttribute(element, attributeName, description[ariaAttribute]); 
13379  });
13380 },
13381 executeOnDescription: function(description, ariaDescAttr, callback) {
13382  var descInfo = description[ariaDescAttr];
13383  if(ASPx.IsExists(descInfo))
13384   callback.aspxBind(this)(descInfo);
13385 },
13386 getNodesBySelector: function(element, selector) {
13387  var id = element.id || "";
13388  var childNodes = element.querySelectorAll("#" + this.getNodeId(element) + " > " + selector);
13389  ASPx.Attr.SetOrRemoveAttribute(element, "id", id);
13390  return childNodes;
13391 },
13392 getNodeId: function(node) {
13393  if(!node.id)
13394   node.id = this.createRandomId();
13395  return node.id; 
13396 },
13397 createRandomId: function() {
13398  return "r" + ASPx.CreateGuid();
13399 }
13400});
13401PagerCommands = {
13402 Next : "PBN",
13403 Prev : "PBP",
13404 Last : "PBL",
13405 First : "PBF",
13406 PageNumber : "PN",
13407 PageSize : "PSP"
13408};
13409ASPx.callbackProcessed = false;
13410ASPx.Callback = function(result, context){ 
13411 var collection = aspxGetControlCollection();
13412 collection.DoFinalizeCallback();
13413 var control = collection.Get(context);
13414 if(control != null)
13415  control.DoCallback(result);
13416 ASPx.RippleHelper.ReInit();
13417 ASPx.callbackProcessed = true;
13418};
13419ASPx.CallbackError = function(result, context){
13420 var control = aspxGetControlCollection().Get(context);
13421 if(control != null)
13422  control.DoCallbackError(result, false);
13423 ASPx.callbackProcessed = true;
13424};
13425ASPx.CClick = function(name, evt) {
13426 var control = aspxGetControlCollection().Get(name);
13427 if(control != null) control.DoControlClick(evt);
13428};
13429function aspxCAInit() {
13430 var isAppInit = typeof(Sys$_Application$initialize) != "undefined" &&
13431  ASPx.FunctionIsInCallstack(arguments.callee, Sys$_Application$initialize, 10 );
13432 aspxGetControlCollection().AtlasInitialize(!isAppInit);
13433}
13434ASPx.Evt.AttachEventToElement(window, "resize", aspxGlobalWindowResize);
13435function aspxGlobalWindowResize(evt){
13436 aspxGetControlCollection().OnBrowserWindowResize(evt); 
13437}
13438ASPx.Evt.AttachEventToElement(window, "unload", aspxClassesUnload);
13439function aspxClassesUnload(evt) {
13440 aspxGetControlCollection().OnDocumentUnload();
13441}
13442ASPx.attachToLoad(aspxClassesDOMContentLoaded);
13443function aspxClassesDOMContentLoaded(evt){
13444 aspxGetControlCollection().DOMContentLoaded();
13445}
13446ASPx.GetControlCollection = aspxGetControlCollection;
13447ASPx.GetControlCollectionCollection = aspxGetControlCollectionCollection;
13448ASPx.GetPersistentControlPropertiesStorage = _aspxGetPersistentControlPropertiesStorage;
13449ASPx.PagerCommands = PagerCommands;
13450ASPx.ELLIPSIS_MARKER_CLASS = ELLIPSIS_MARKER_CLASS;
13451window.ASPxClientBeginCallbackEventArgs = ASPxClientBeginCallbackEventArgs;
13452window.ASPxClientGlobalBeginCallbackEventArgs = ASPxClientGlobalBeginCallbackEventArgs;
13453window.ASPxClientEndCallbackEventArgs = ASPxClientEndCallbackEventArgs;
13454window.ASPxClientGlobalEndCallbackEventArgs = ASPxClientGlobalEndCallbackEventArgs;
13455window.ASPxClientCallbackErrorEventArgs = ASPxClientCallbackErrorEventArgs;
13456window.ASPxClientGlobalCallbackErrorEventArgs = ASPxClientGlobalCallbackErrorEventArgs;
13457window.ASPxClientCustomDataCallbackEventArgs = ASPxClientCustomDataCallbackEventArgs;
13458window.ASPxClientValidationCompletedEventArgs = ASPxClientValidationCompletedEventArgs;
13459window.ASPxClientControlsInitializedEventArgs = ASPxClientControlsInitializedEventArgs;
13460window.ASPxClientControlBeforePronounceEventArgs = ASPxClientControlBeforePronounceEventArgs;
13461window.ASPxClientControlUnloadEventArgs = ASPxClientControlUnloadEventArgs;
13462window.ASPxClientEndFocusEventArgs = ASPxClientEndFocusEventArgs;
13463window.ASPxClientItemFocusedEventArgs = ASPxClientItemFocusedEventArgs;
13464window.ASPxClientControlCollection = ASPxClientControlCollection;
13465window.ASPxClientControlBase = ASPxClientControlBase;
13466window.ASPxClientControl = ASPxClientControl;
13467window.ASPxClientComponent = ASPxClientComponent;
13468})(ASPx);
13469
13470(function() {
13471var ASPxClientEditBase = ASPx.CreateClass(ASPxClientControl, {
13472 constructor: function(name) {
13473  this.constructor.prototype.constructor.call(this, name);
13474  this.EnabledChanged = new ASPxClientEvent();
13475  this.captionPosition = ASPx.Position.Left;
13476  this.showCaptionColon = true;
13477  this.scPrefix = "dxe";
13478 },
13479 InlineInitialize: function(){
13480  ASPxClientControl.prototype.InlineInitialize.call(this);
13481  this.InitializeEnabled(); 
13482  this.InitializeEvents();
13483 },
13484 InitializeEnabled: function() {
13485  this.SetEnabledInternal(this.clientEnabled, true);
13486 },
13487 InitializeEvents: function() { },
13488 AddDefaultReadOnlyStateControllerItem: function(cssClass, mainElementId) {
13489  ASPx.AddReadOnlyItems(mainElementId, [[[cssClass], [''], ['']]]);
13490 },
13491 AddDefaultDisabledStateControllerItem: function(cssClass, mainElementId) {
13492  ASPx.AddDisabledItems(mainElementId, [[[cssClass], [''], ['']]]);
13493 },
13494 GetValue: function() {
13495  var element = this.GetMainElement();
13496  if(ASPx.IsExistsElement(element))
13497   return element.innerHTML;
13498  return "";
13499 },
13500 GetValueString: function(){
13501  var value = this.GetValue();
13502  return (value == null) ? null : value.toString();
13503 },
13504 EnsureValueStringIsActual: function() {
13505  if(this.maskInfo != null)
13506   this.ParseValue();
13507 },
13508 SetValue: function(value) {
13509  if(value == null)
13510   value = "";
13511  var element = this.GetMainElement();
13512  if(ASPx.IsExistsElement(element))
13513   element.innerHTML = value;
13514 },
13515 GetEnabled: function(){
13516  return this.enabled && this.clientEnabled;
13517 },
13518 SetEnabled: function(enabled){
13519  if(this.clientEnabled != enabled) {
13520   var errorFrameRequiresUpdate = this.GetIsValid && !this.GetIsValid();
13521   if(errorFrameRequiresUpdate && !enabled)
13522    this.UpdateErrorFrameAndFocus(false , null , true );
13523   this.clientEnabled = enabled;
13524   this.SetEnabledInternal(enabled, false);
13525   if(errorFrameRequiresUpdate && enabled)
13526    this.UpdateErrorFrameAndFocus(false );
13527   this.RaiseEnabledChangedEvent();
13528  }
13529 },
13530 SetEnabledInternal: function(enabled, initialization){
13531  if(!this.enabled) return;
13532  if(!initialization || !enabled)
13533   this.ChangeEnabledStateItems(enabled);
13534  this.ChangeEnabledAttributes(enabled);
13535  if(ASPx.Browser.Chrome) {   
13536   var mainElement = this.GetMainElement();
13537   if(mainElement)
13538    mainElement.className = mainElement.className;
13539  } 
13540 },
13541 ChangeEnabledAttributes: function(enabled){
13542 },
13543 ChangeEnabledStateItems: function(enabled){
13544 },
13545 RaiseEnabledChangedEvent: function(){
13546  if(!this.EnabledChanged.IsEmpty()){
13547   var args = new ASPxClientEventArgs();
13548   this.EnabledChanged.FireEvent(this, args);
13549  }
13550 },
13551 GetDecodeValue: function (value) { 
13552  if(typeof (value) == "string" && value.length > 1)
13553   value = this.SimpleDecodeHtml(value);
13554  return value;
13555 },
13556 SimpleDecodeHtml: function (html) {
13557  return ASPx.Str.ApplyReplacement(html, [
13558   [/&lt;/g, '<'],
13559   [/&amp;/g, '&'],
13560   [/&quot;/g, '"'],
13561   [/&#39;/g, '\''],
13562   [/&#32;/g, ' ']
13563  ]);
13564 },
13565 GetCachedElementById: function(idSuffix) {
13566  return ASPx.CacheHelper.GetCachedElementById(this, this.name + idSuffix);
13567 },
13568 GetCaptionCell: function() {
13569  return this.GetCachedElementById(EditElementSuffix.CaptionCell);
13570 },
13571 GetExternalTable: function() {
13572  return this.GetCachedElementById(EditElementSuffix.ExternalTable);
13573 },
13574 getCaptionRelatedCellCount: function() {
13575  if(!this.captionRelatedCellCount)
13576   this.captionRelatedCellCount = ASPx.GetNodesByClassName(this.GetExternalTable(), CaptionRelatedCellClassName).length;
13577  return this.captionRelatedCellCount;
13578 },
13579 addCssClassToCaptionRelatedCells: function() {
13580  if(this.captionPosition == ASPx.Position.Left || this.captionPosition == ASPx.Position.Right) {
13581   var captionRelatedCellsIndex = this.captionPosition == ASPx.Position.Left ? 0 : this.GetCaptionCell().cellIndex;
13582   for(var i = 0; i < this.GetExternalTable().rows.length; i++)
13583    ASPx.AddClassNameToElement(this.GetExternalTable().rows[i].cells[captionRelatedCellsIndex], CaptionRelatedCellClassName);
13584  }
13585  if(this.captionPosition == ASPx.Position.Top || this.captionPosition == ASPx.Position.Bottom)
13586   for(var i = 0; i < this.GetCaptionCell().parentNode.cells.length; i++)
13587    ASPx.AddClassNameToElement(this.GetCaptionCell().parentNode.cells[i], CaptionRelatedCellClassName);
13588 },
13589 GetCaption: function() {
13590  if(ASPx.IsExists(this.GetCaptionCell()))
13591   return this.getCaptionInternal();
13592  return "";
13593 },
13594 SetCaption: function(caption) {
13595  if(!ASPx.IsExists(this.GetCaptionCell()))
13596   return;
13597  if(this.getCaptionRelatedCellCount() == 0)
13598   this.addCssClassToCaptionRelatedCells();
13599  if(caption !== "")
13600   ASPx.RemoveClassNameFromElement(this.GetExternalTable(), ASPxEditExternalTableClassNames.TableWithEmptyCaptionClassName);
13601  else
13602   ASPx.AddClassNameToElement(this.GetExternalTable(), ASPxEditExternalTableClassNames.TableWithEmptyCaptionClassName);
13603  this.setCaptionInternal(caption);
13604 },
13605 getCaptionTextNode: function() {
13606  var captionElement = ASPx.GetNodesByPartialClassName(this.GetCaptionCell(), CaptionElementPartialClassName)[0];
13607  return ASPx.GetNormalizedTextNode(captionElement);
13608 },
13609 getCaptionInternal: function() {
13610  var captionText = this.getCaptionTextNode().nodeValue;
13611  if(captionText !== "" && captionText[captionText.length - 1] == ":")
13612   captionText = captionText.substring(0, captionText.length - 1);
13613  return captionText;
13614 },
13615 setCaptionInternal: function(caption) {
13616  caption = ASPx.Str.Trim(caption);
13617  var captionTextNode = this.getCaptionTextNode();
13618  if(this.showCaptionColon && caption[caption.length - 1] != ":" && caption !== "")
13619   caption += ":";
13620  captionTextNode.nodeValue = caption;
13621 },
13622 onVirtualKeyboardUITouchStart: function(evt) { }
13623});
13624var ValidationPattern = ASPx.CreateClass(null, {
13625 constructor: function(errorText) {
13626  this.errorText = errorText;
13627 }
13628});
13629var RequiredFieldValidationPattern = ASPx.CreateClass(ValidationPattern, {
13630 constructor: function(errorText) {
13631  this.constructor.prototype.constructor.call(this, errorText);
13632 },
13633 EvaluateIsValid: function(value) {
13634  return value != null && (value.constructor == Array || ASPx.Str.Trim(value.toString()) != "");
13635 }
13636});
13637var RegularExpressionValidationPattern = ASPx.CreateClass(ValidationPattern, {
13638 constructor: function(errorText, pattern) {
13639  this.constructor.prototype.constructor.call(this, errorText);
13640  this.pattern = pattern;
13641 },
13642 EvaluateIsValid: function(value) {
13643  if(value == null) 
13644   return true;
13645  var strValue = value.toString();
13646  if(ASPx.Str.Trim(strValue).length == 0)
13647   return true;
13648  var regEx = new RegExp(this.pattern);
13649  var matches = regEx.exec(strValue);
13650  return matches != null && strValue == matches[0];
13651 }
13652});
13653function _aspxIsEditorFocusable(inputElement) {
13654 return ASPx.IsFocusableCore(inputElement, function(container) {
13655  return container.getAttribute("errorFrame") == "errorFrame";
13656 });
13657}
13658var invalidEditorToBeFocused = null;
13659var ValidationType = {
13660 PersonalOnValueChanged: "ValueChanged",
13661 PersonalViaScript: "CalledViaScript",
13662 MassValidation: "MassValidation"
13663};
13664var ErrorFrameDisplay = {
13665 None: "None",
13666 Static: "Static",
13667 Dynamic: "Dynamic"
13668};
13669var EditElementSuffix = {
13670 ExternalTable: "_ET",
13671 ControlCell: "_CC",
13672 ErrorCell: "_EC",
13673 ErrorTextCell: "_ETC",
13674 ErrorImage: "_EI",
13675 CaptionCell: "_CapC",
13676 AccessibilityAdditionalTextRow: "_AHTR"
13677};
13678var ASPxEditExternalTableClassNames = {
13679 ValidStaticTableClassName: "dxeValidStEditorTable",
13680 ValidDynamicTableClassName: "dxeValidDynEditorTable",
13681 TableWithEmptyCaptionClassName: "tableWithEmptyCaption"
13682};
13683var CaptionRelatedCellClassName = "dxeCaptionRelatedCell";
13684var CaptionElementPartialClassName = "dxeCaption";
13685var AccessibilityAssistantID = "AcAs";
13686var ASPxClientEdit = ASPx.CreateClass(ASPxClientEditBase, {
13687 constructor: function(name) {
13688  this.constructor.prototype.constructor.call(this, name);
13689  this.isASPxClientEdit = true;
13690  this.inputElement = null;
13691  this.convertEmptyStringToNull = true;
13692  this.readOnly = false;
13693  this.clientReadOnly = false;
13694  this.focused = false;
13695  this.focusEventsLocked = false;
13696  this.focusEventsLockCount = 0;
13697  this.receiveGlobalMouseWheel = true;
13698  this.styleDecoration = null;
13699  this.heightCorrectionRequired = false;
13700  this.customValidationEnabled = false;
13701  this.display = ErrorFrameDisplay.Static;
13702  this.initialErrorText = "";
13703  this.causesValidation = false;
13704  this.validateOnLeave = true;
13705  this.validationGroup = "";
13706  this.sendPostBackWithValidation = null;
13707  this.validationPatterns = [];
13708  this.setFocusOnError = false;
13709  this.errorDisplayMode = "it";
13710  this.errorText = "";
13711  this.isValid = true;
13712  this.errorImageIsAssigned = false;
13713  this.notifyValidationSummariesToAcceptNewError = false;
13714  this.isErrorFrameRequired = false;
13715  this.enterProcessed = false;
13716  this.keyDownHandlers = {};
13717  this.keyPressHandlers = {};
13718  this.keyUpHandlers = {};
13719  this.onKeyDownHandler = null;
13720  this.onKeyPressHandler = null;
13721  this.onKeyUpHandler = null;
13722  this.onGotFocusHandler = null;
13723  this.onLostFocusHandler = null;
13724  this.GotFocus = new ASPxClientEvent();
13725  this.LostFocus = new ASPxClientEvent();
13726  this.Validation = new ASPxClientEvent();
13727  this.ValueChanged = new ASPxClientEvent();
13728  this.KeyDown = new ASPxClientEvent();
13729  this.KeyPress = new ASPxClientEvent();
13730  this.KeyUp = new ASPxClientEvent();
13731  this.eventHandlersInitialized = false;
13732  this.errorCellVisibilityChanged = new ASPxClientEvent();
13733  this.ariaExplanatoryTextManager = null;
13734  this.InitializeEventHandlers();
13735 },
13736 SetData: function(data){
13737  if(data.decorationStyles){
13738   for(var i = 0; i < data.decorationStyles.length; i++)
13739    this.AddDecorationStyle(data.decorationStyles[i].key, 
13740     data.decorationStyles[i].className, 
13741     data.decorationStyles[i].cssText);
13742  }
13743 },
13744 Initialize: function() {
13745  this.initialErrorText = this.errorText;
13746  ASPxClientEditBase.prototype.Initialize.call(this);
13747  this.InitializeKeyHandlers();
13748  this.UpdateClientValidationState();
13749  this.UpdateValidationSummaries(null , true );
13750 },
13751 InlineInitialize: function() {
13752  if(this.UseDelayedSpecialFocus())
13753   this.InitializeDelayedSpecialFocus();
13754  ASPxClientEditBase.prototype.InlineInitialize.call(this);
13755  this.UpdateStyleDecorations();
13756  var externalTable = this.GetExternalTable();
13757  if(externalTable && ASPx.IsPercentageSize(externalTable.style.width)) {
13758   this.width = "100%";
13759   this.GetMainElement().style.width = "100%";
13760   if(this.isErrorFrameRequired)
13761    externalTable.setAttribute("errorFrame", "errorFrame");
13762  }
13763  this.ariaExplanatoryTextManager = this.CreateAriaExplanatoryTextManager();
13764  if(this.clientReadOnly)
13765   this.SetReadOnlyInternal(true);
13766  this.UpdateErrorCellParentRowVisibility();
13767 }, 
13768 AfterInitialize: function() {
13769  this.ariaExplanatoryTextManager.SetCaptionAssociating();
13770  this.ariaExplanatoryTextManager.UpdateText();
13771  this.ariaExplanatoryTextManager.UpdateValidationState();
13772  ASPxClientEditBase.prototype.AfterInitialize.call(this);
13773 },
13774 UpdateStyleDecorations: function() {
13775  if(this.styleDecoration)
13776   this.styleDecoration.Update();
13777 },
13778 UseSpecialKeyboardHandling: function() {
13779  return false;
13780 },
13781 InitializeKeyHandlers: function() {
13782 },
13783 AddKeyDownHandler: function(key, handler) {
13784  this.keyDownHandlers[key] = handler;
13785 },
13786 AddKeyPressHandler: function(key, handler) {
13787  this.keyPressHandlers[key] = handler;
13788 },
13789 InitializeEventHandlers: function() {
13790  this.onGotFocusHandler = function(evt) { ASPx.EGotFocus(this.name); }.bind(this);
13791  this.onLostFocusHandler = function(evt) { ASPx.ELostFocus(this.name); }.bind(this);
13792  if(this.UseSpecialKeyboardHandling()) {
13793   this.onKeyDownHandler = function(evt) { ASPx.KBSIKeyDown(this.name, evt); }.bind(this);
13794   this.onKeyPressHandler = function(evt) { ASPx.KBSIKeyPress(this.name, evt); }.bind(this);
13795   this.onKeyUpHandler = function(evt) { ASPx.KBSIKeyUp(this.name, evt); }.bind(this);
13796  }
13797 },
13798 ChangeSpecialInputEnabledAttributes: function(element, method, doNotChangeAutoComplete) {
13799  if(!doNotChangeAutoComplete) 
13800   element.autocomplete = "off";
13801  if(this.onKeyDownHandler != null)
13802   method(element, "keydown", this.onKeyDownHandler);
13803  if(this.onKeyPressHandler != null)
13804   method(element, "keypress", this.onKeyPressHandler);
13805  if(this.onKeyUpHandler != null)
13806   method(element, "keyup", this.onKeyUpHandler);
13807  if(this.onGotFocusHandler != null)
13808   method(element, "focus", this.onGotFocusHandler);
13809  if(this.onLostFocusHandler != null)
13810   method(element, "blur", this.onLostFocusHandler);
13811 },
13812 CreateAriaExplanatoryTextManager: function() {
13813  if(this.accessibilityCompliant)
13814   return new EditAccessibilityExplanatoryTextManager(this);
13815  else 
13816   return new DisableAccessibilityExplanatoryTextManager(this);
13817 },
13818 UpdateClientValidationState: function() {
13819  if(!this.customValidationEnabled)
13820   return;
13821  var mainElement = this.GetMainElement();
13822  if(mainElement) {
13823   var validationState = !this.GetIsValid() ? ("-" + this.GetErrorText()) : "";
13824   this.UpdateStateObjectWithObject({ validationState: validationState });
13825  }
13826 },
13827 UpdateValidationSummaries: function(validationType, initializing) {
13828  if(ASPx.Ident.scripts.ASPxClientValidationSummary) {
13829   var summaryCollection = ASPx.GetClientValidationSummaryCollection();
13830   summaryCollection.OnEditorIsValidStateChanged(this, validationType, initializing && this.notifyValidationSummariesToAcceptNewError);
13831  }
13832 },
13833 FindInputElement: function(){
13834  return null;
13835 },
13836 GetInputElement: function(){
13837  if(!ASPx.IsExistsElement(this.inputElement))
13838   this.inputElement = this.FindInputElement();
13839  return this.inputElement;
13840 },
13841 GetFocusableInputElement: function() {
13842  return this.GetInputElement();
13843 },
13844 GetAccessibilityActiveElements: function() {
13845  return [this.GetInputElement()];
13846 },
13847 GetAccessibilityFirstActiveElement: function() {
13848  return this.accessibilityHelper ? 
13849    this.accessibilityHelper.getMainElement() : 
13850    this.GetAccessibilityActiveElements()[0];
13851 },
13852 GetAccessibilityAssistantElement: function() {
13853  return this.GetChildElement(AccessibilityAssistantID);
13854 },
13855 GetErrorImage: function() {
13856  return this.GetCachedElementById(EditElementSuffix.ErrorImage);
13857 },
13858 GetControlCell: function() {
13859  return this.GetCachedElementById(EditElementSuffix.ControlCell);
13860 },
13861 GetErrorCell: function() {
13862  return this.GetCachedElementById(EditElementSuffix.ErrorCell);
13863 },
13864 GetErrorTextCell: function() {
13865  return this.GetCachedElementById(this.errorImageIsAssigned ? EditElementSuffix.ErrorTextCell : EditElementSuffix.ErrorCell);
13866 },
13867 GetReadOnly: function() {
13868  return this.readOnly || this.clientReadOnly;
13869 },
13870 SetReadOnly: function(readOnly) {
13871  readOnly = !!readOnly;
13872  if(this.clientReadOnly === readOnly || this.readOnly)
13873   return;
13874  this.SetReadOnlyInternal(readOnly);
13875 },
13876 SetReadOnlyInternal: function(readOnly) {
13877  this.clientReadOnly = readOnly;
13878  this.ChangeReadOnlyStateItems(readOnly);
13879 },
13880 ChangeReadOnlyStateItems: function(readOnly) {
13881  ASPx.GetStateController().SetElementReadOnly(this.GetMainElement(), readOnly);
13882 },
13883 SetVisible: function (isVisible) {
13884  if(this.clientVisible == isVisible)
13885   return;
13886  var externalTable = this.GetExternalTable();
13887  if(externalTable) {
13888   ASPx.SetElementDisplay(externalTable, isVisible);
13889   if(this.customValidationEnabled) {
13890    var isValid = !isVisible ? true : void (0);
13891    this.UpdateErrorFrameAndFocus(false , true , isValid );
13892   }
13893  }
13894  ASPxClientControl.prototype.SetVisible.call(this, isVisible);
13895 },
13896 GetStateHiddenFieldName: function() {
13897  return this.uniqueID + "$State";
13898 },
13899 GetValueInputToValidate: function() {
13900  return this.GetInputElement();
13901 },
13902 IsVisible: function() {
13903  if(!this.clientVisible)
13904   return false;
13905  var element = this.GetMainElement();
13906  if(!element) 
13907   return false;
13908  while(element && element.tagName != "BODY") {
13909   if(element.getAttribute("errorFrame") != "errorFrame" && (!ASPx.GetElementVisibility(element) || !ASPx.GetElementDisplay(element)))
13910    return false;
13911   element = element.parentNode;
13912  }
13913  return true;
13914 },
13915 AdjustControlCore: function() {
13916  this.CollapseEditor();
13917  this.UnstretchInputElement();
13918  if(this.heightCorrectionRequired)
13919   this.CorrectEditorHeight();
13920 },
13921 CorrectEditorHeight: function() {
13922 },
13923 UnstretchInputElement: function() {
13924 },
13925 UseDelayedSpecialFocus: function() {
13926  return false;
13927 },
13928 GetInnerEditors: function() {
13929  return [];
13930 },
13931 GetDelayedSpecialFocusTriggers: function() {
13932  return [ this.GetMainElement() ];
13933 },
13934 InitializeDelayedSpecialFocus: function() {
13935  this.specialFocusTimer = -1;    
13936  var handler = function(evt) { this.OnDelayedSpecialFocusMouseDown(evt); }.aspxBind(this);
13937  var triggers = this.GetDelayedSpecialFocusTriggers();
13938  for(var i = 0; i < triggers.length; i++)
13939   ASPx.Evt.AttachEventToElement(triggers[i], "mousedown", handler);
13940 },
13941 OnDelayedSpecialFocusMouseDown: function(evt) {
13942  window.setTimeout(function() { this.SetFocus(); }.aspxBind(this), 0);
13943 },
13944 IsFocusEventsLocked: function() {
13945  return this.focusEventsLocked || this.focusEventsLockCount !== 0;
13946 },
13947 BeginFocusUpdate: function() {
13948  this.focusEventsLockCount++;
13949 },
13950 EndFocusUpdate: function() {
13951  this.focusEventsLockCount--;
13952  if(this.focusEventsLockCount === 0)
13953   if(this.focused && !this.IsEditorElement(document.activeElement)) 
13954    this.OnLostFocus();
13955 },
13956 LockFocusEvents: function() {
13957  if(!this.focused) return;
13958  this.focusEventsLocked = true;
13959 },
13960 UnlockFocusEvents: function() {
13961  this.focusEventsLocked = false;
13962 },
13963 ForceRefocusEditor: function(evt, isNativeFocus) {
13964  if(ASPx.Browser.VirtualKeyboardSupported && !this.ownerListBox) {
13965   var focusedEditor = ASPx.VirtualKeyboardUI.getFocusedEditor();
13966   if(ASPx.VirtualKeyboardUI.getInputNativeFocusLocked() && (!focusedEditor || focusedEditor === this))
13967     return;
13968   ASPx.VirtualKeyboardUI.setInputNativeFocusLocked(!isNativeFocus);
13969  }
13970  this.LockFocusEvents();
13971  this.BlurInputElement();
13972  window.setTimeout(function() { 
13973   if(ASPx.Browser.VirtualKeyboardSupported && !this.ownerListBox) {
13974    ASPx.VirtualKeyboardUI.setFocusToEditor(this);
13975   } else {
13976    this.SetFocus();
13977   }
13978  }.aspxBind(this), 0);
13979 },
13980 BlurInputElement: function() {
13981  var inputElement = this.GetFocusableInputElement();
13982  if(inputElement && inputElement.blur)
13983   inputElement.blur();
13984 },
13985 IsEditorElement: function(element) {
13986  return this.GetMainElement() == element || ASPx.GetIsParent(this.GetMainElement(), element);
13987 },
13988 IsClearButtonElement: function(element) {
13989  return false;
13990 },
13991 IsElementBelongToInputElement: function(element) {
13992  return this.GetInputElement() == element;
13993 },
13994 OnFocusCore: function() {
13995  if(this.UseDelayedSpecialFocus())
13996   this.specialFocusTimer = ASPx.Timer.ClearTimer(this.specialFocusTimer);
13997  if(!this.IsFocusEventsLocked()){
13998   this.focused = true;
13999   ASPx.SetFocusedEditor(this);
14000   if(this.styleDecoration)
14001    this.styleDecoration.Update();
14002   if(this.isInitialized)
14003    this.RaiseFocus();
14004  }
14005  else
14006   this.UnlockFocusEvents();
14007 },
14008 OnLostFocusCore: function() {
14009  if(!this.IsFocusEventsLocked()){
14010   this.focused = false;
14011   if(ASPx.GetFocusedEditor() === this)
14012    ASPx.SetFocusedEditor(null);
14013   if(this.styleDecoration)
14014    this.styleDecoration.Update();
14015   this.RaiseLostFocus();
14016  }
14017 },
14018 OnFocus: function() {
14019  var focusedEditor = ASPx.GetFocusedEditor();
14020  if(focusedEditor && focusedEditor.UseDelayedSpecialFocus() && focusedEditor !== this && focusedEditor.GetInnerEditors().indexOf(this) === -1 && ASPx.IsElementVisible(focusedEditor.GetMainElement())) {
14021   var lostFocusHandler = function() {
14022    focusedEditor.LostFocus.RemoveHandler(lostFocusHandler);
14023    this.OnFocusCore();
14024   }.bind(this);
14025   focusedEditor.LostFocus.AddHandler(lostFocusHandler);
14026  }
14027  else {
14028   this.OnFocusCore();
14029  }  
14030 },
14031 OnLostFocus: function() {
14032  if(this.isInitialized)
14033   this.OnLostFocusCore();
14034 },
14035 OnMouseWheel: function(evt){
14036 },
14037 OnValidation: function(validationType) {
14038  if(this.customValidationEnabled && this.isInitialized && ASPx.IsExistsElement(this.GetMainElement()) &&
14039   (!this.IsErrorFrameDisplayed() || this.GetElementRequiredForErrorFrame())) {
14040   this.BeginErrorFrameUpdate();
14041   try {
14042    if(this.validateOnLeave || validationType != ValidationType.PersonalOnValueChanged) {
14043     this.SetIsValid(true, true );
14044     this.SetErrorText(this.initialErrorText, true );
14045     this.ValidateWithPatterns();
14046     this.RaiseValidation();
14047    }
14048    this.UpdateErrorFrameAndFocus(this.editorFocusingRequired(validationType));
14049   } finally {
14050    this.EndErrorFrameUpdate();
14051   }
14052   this.UpdateValidationSummaries(validationType);
14053   this.ariaExplanatoryTextManager.UpdateValidationState(validationType);
14054  }
14055 },
14056 GetElementRequiredForErrorFrame: function() {
14057  return this.GetExternalTable();
14058 },
14059 editorFocusingRequired: function(validationType) {
14060  return !this.GetIsValid() &&
14061   validationType == ValidationType.PersonalViaScript && this.setFocusOnError;
14062 },
14063 OnValueChanged: function() {
14064  if(this.getProcessOnServerOnValueChanged())
14065   this.SendPostBackInternal("");
14066 },
14067 getProcessOnServerOnValueChanged: function() {
14068  var processOnServer = this.RaiseValidationInternal();
14069  return this.RaiseValueChangedEvent() && processOnServer;
14070 },
14071 ParseValue: function() {
14072 },
14073 RaisePersonalStandardValidation: function() {
14074  if(ASPx.IsFunction(window.ValidatorOnChange)) {
14075   var inputElement = this.GetValueInputToValidate();
14076   if(inputElement && inputElement.Validators)
14077    window.ValidatorOnChange({ srcElement: inputElement });
14078  }
14079 },
14080 RaiseValidationInternal: function() {
14081  if(this.isPostBackAllowed() && this.causesValidation && this.validateOnLeave)
14082   return ASPxClientEdit.ValidateGroup(this.validationGroup);
14083  else {
14084   this.OnValidation(ValidationType.PersonalOnValueChanged);
14085   return this.GetIsValid();
14086  }
14087 },
14088 RaiseValueChangedEvent: function(){
14089  return this.RaiseValueChanged();
14090 },
14091 SendPostBackInternal: function(postBackArg) {
14092  if(ASPx.IsFunction(this.sendPostBackWithValidation))
14093   this.sendPostBackWithValidation(postBackArg);
14094  else
14095   this.SendPostBack(postBackArg);
14096 },
14097 SetElementToBeFocused: function() {
14098  if(this.IsVisible())
14099   invalidEditorToBeFocused = this;
14100 },
14101 GetFocusSelectAction: function() {
14102  return null;
14103 },
14104 SetFocus: function() {
14105  var inputElement = this.GetFocusableInputElement();
14106  if(!inputElement) return; 
14107  if((ASPx.GetActiveElement() != inputElement) && _aspxIsEditorFocusable(inputElement))
14108   ASPx.SetFocus(inputElement, this.GetFocusSelectAction());
14109 },
14110 SetFocusOnError: function() {
14111  if(invalidEditorToBeFocused == this) {
14112   this.SetFocus();
14113   invalidEditorToBeFocused = null;
14114  }
14115 },
14116 BeginErrorFrameUpdate: function() {
14117  if(!this.errorFrameUpdateLocked)
14118   this.errorFrameUpdateLocked = true;
14119 },
14120 EndErrorFrameUpdate: function() {
14121  this.errorFrameUpdateLocked = false;
14122  var args = this.updateErrorFrameAndFocusLastCallArgs;
14123  if(args) {
14124   this.UpdateErrorFrameAndFocus(args[0], args[1]);
14125   delete this.updateErrorFrameAndFocusLastCallArgs;
14126  }
14127 },
14128 UpdateErrorFrameAndFocus: function(setFocusOnError, ignoreVisibilityCheck, isValid) {
14129  if(!ignoreVisibilityCheck && !this.GetVisible())
14130   return;
14131  if(this.errorFrameUpdateLocked) {
14132   this.updateErrorFrameAndFocusLastCallArgs = [ setFocusOnError, ignoreVisibilityCheck ];
14133   return;
14134  }
14135  if(this.styleDecoration)
14136   this.styleDecoration.Update();
14137  if(typeof(isValid) == "undefined")
14138   isValid = this.GetIsValid();
14139  if(isValid && this.IsErrorFrameDisplayed())
14140   this.ChangeErrorFrameVisibility(false);
14141  else {
14142   var editorLocatedWithinVisibleContainer = this.IsVisible();
14143   if(this.IsErrorFrameDisplayed()) {
14144    this.UpdateErrorCellContent();
14145    this.ChangeErrorFrameVisibility(true);
14146   }
14147   if(editorLocatedWithinVisibleContainer) {
14148    if(setFocusOnError && this.setFocusOnError && invalidEditorToBeFocused == null) {
14149     this.SetElementToBeFocused();
14150     this.SetFocusOnError();
14151    }
14152   }
14153  }
14154 },
14155 ChangeErrorFrameVisibility: function(visible) {
14156  var externalTable = this.GetExternalTable();
14157  var isStaticDisplay = this.display == ErrorFrameDisplay.Static;
14158  if(!isStaticDisplay && visible) {
14159   this.EnsureControlCellStylesLoaded();
14160   this.RestoreControlCellStyles();
14161  }
14162  this.ChangeErrorCellVisibility(visible, isStaticDisplay);
14163  if(!isStaticDisplay && !visible) {
14164   this.EnsureControlCellStylesLoaded();
14165   this.ClearControlCellStyles();
14166  }
14167  var validExternalTableClassName = isStaticDisplay ? ASPxEditExternalTableClassNames.ValidStaticTableClassName
14168   : ASPxEditExternalTableClassNames.ValidDynamicTableClassName;
14169  ASPx.ToggleClassNameToElement(externalTable, validExternalTableClassName, !visible);
14170  this.UpdateErrorCellParentRowVisibility();
14171 },
14172 ChangeErrorCellVisibility: function(visible, useVisibilityAttribute) {
14173  var errorCell = this.GetErrorCell();
14174  if(errorCell) {
14175   if(useVisibilityAttribute)
14176    ASPx.SetElementVisibility(errorCell, visible);
14177   else {
14178    ASPx.SetElementDisplay(errorCell, visible);
14179    this.raiseErrorCellVisibilityChanged();
14180   }
14181  }
14182 },
14183 raiseErrorCellVisibilityChanged: function() {
14184  if(!this.errorCellVisibilityChanged.IsEmpty())
14185   this.errorCellVisibilityChanged.FireEvent(this);
14186 },
14187 UpdateErrorCellParentRowVisibility: function() {
14188  var errorCell = this.GetErrorCell();
14189  if(!errorCell || this.display == ErrorFrameDisplay.Static)
14190   return;
14191  var displayedCellCount = 0;
14192  var errorCellParentRow = errorCell.parentNode;
14193  for(var i = 0; i < errorCellParentRow.cells.length; i++) {
14194   var cell = errorCellParentRow.cells[i];
14195   if(ASPx.GetElementDisplay(cell))
14196    displayedCellCount++;
14197  }
14198  ASPx.SetElementDisplay(errorCellParentRow, displayedCellCount > 0);
14199 },
14200 EnsureControlCellStylesLoaded: function() {
14201  if(typeof(this.controlCellStyles) == "undefined") {
14202   var controlCell = this.GetControlCell();
14203   this.controlCellStyles = {
14204    cssClass: controlCell.className,
14205    style: this.ExtractElementStyleStringIgnoringVisibilityProps(controlCell)
14206   };
14207  }
14208 },
14209 ClearControlCellStyles: function() {
14210  this.ClearElementStyle(this.GetControlCell());
14211 },
14212 RestoreControlCellStyles: function() {
14213  var controlCell = this.GetControlCell();
14214  controlCell.className = this.controlCellStyles.cssClass;
14215  controlCell.style.cssText = this.controlCellStyles.style;
14216 },
14217 ExtractElementStyleStringIgnoringVisibilityProps: function(element) {
14218  var savedVisibility = element.style.visibility;
14219  var savedDisplay = element.style.display;
14220  element.style.visibility = "";
14221  element.style.display = "";
14222  var styleStr = element.style.cssText;
14223  element.style.visibility = savedVisibility;
14224  element.style.display = savedDisplay;
14225  return styleStr;
14226 },
14227 ClearElementStyle: function(element) {
14228  if(!element)
14229   return;
14230  element.className = "";
14231  var excludedAttrNames = [
14232   "width", "display", "visibility",
14233   "position", "left", "top", "z-index",
14234   "margin", "margin-top", "margin-right", "margin-bottom", "margin-left",
14235   "float", "clear"
14236  ];
14237  var savedAttrValues = { };
14238  for(var i = 0; i < excludedAttrNames.length; i++) {
14239   var attrName = excludedAttrNames[i];
14240   var attrValue = element.style[attrName];
14241   if(attrValue)
14242    savedAttrValues[attrName] = attrValue;
14243  }
14244  element.style.cssText = "";
14245  for(var styleAttrName in savedAttrValues)
14246   if(savedAttrValues.hasOwnProperty(styleAttrName))
14247    element.style[styleAttrName] = savedAttrValues[styleAttrName];
14248 },
14249 Clear: function() {
14250  this.SetValue(null);
14251  this.SetIsValid(true);
14252  return true;
14253 },
14254 ResetEditorState: function() { },
14255 UpdateErrorCellContent: function() {
14256  if(this.errorDisplayMode.indexOf("t") > -1)
14257   this.UpdateErrorText();
14258  if(this.errorDisplayMode == "i")
14259   this.UpdateErrorImage();
14260 },
14261 UpdateErrorImage: function() {
14262  var image = this.GetErrorImage();
14263  if(ASPx.IsExistsElement(image)) {
14264   if(this.accessibilityCompliant) {
14265    ASPx.Attr.SetAttribute(image, "aria-label", this.errorText);
14266    var innerImg = ASPx.GetNodeByTagName(image, "IMG", 0);
14267    if(ASPx.IsExists(innerImg))
14268     innerImg.alt = this.errorText;
14269   }
14270   image.alt = this.errorText;
14271   image.title = this.errorText;
14272  } else {
14273   this.UpdateErrorText();
14274  }
14275 },
14276 UpdateErrorText: function() {
14277  var errorTextCell = this.GetErrorTextCell();
14278  if(ASPx.IsExistsElement(errorTextCell))
14279   errorTextCell.innerHTML = this.HtmlEncode(this.errorText);
14280 },
14281 ValidateWithPatterns: function() {
14282  if(this.validationPatterns.length > 0) {
14283   var value = this.GetValue();
14284   for(var i = 0; i < this.validationPatterns.length; i++) {
14285    var validator = this.validationPatterns[i];
14286    if(!validator.EvaluateIsValid(value)) {
14287     this.SetIsValid(false, true );
14288     this.SetErrorText(validator.errorText, true );
14289     return;
14290    }
14291   }
14292  }
14293 },
14294 OnSpecialKeyDown: function(evt){
14295  this.RaiseKeyDown(evt);
14296  var handler = this.keyDownHandlers[evt.keyCode];
14297  if(handler) 
14298   return this[handler](evt);
14299  return false;
14300 },
14301 OnSpecialKeyPress: function(evt){
14302  this.RaiseKeyPress(evt);
14303  var handler = this.keyPressHandlers[evt.keyCode];
14304  if(handler) 
14305   return this[handler](evt);
14306  if(ASPx.Browser.NetscapeFamily || ASPx.Browser.Opera){
14307   if(evt.keyCode == ASPx.Key.Enter)
14308    return this.enterProcessed;
14309  }
14310  return false;
14311 },
14312 OnSpecialKeyUp: function(evt){
14313  this.RaiseKeyUp(evt);
14314  var handler = this.keyUpHandlers[evt.keyCode];
14315  if(handler) 
14316   return this[handler](evt);
14317  return false;
14318 },
14319 OnKeyDown: function(evt) {
14320  if(!this.UseSpecialKeyboardHandling())
14321   this.RaiseKeyDown(evt);
14322 },
14323 OnKeyPress: function(evt) {
14324  if(!this.UseSpecialKeyboardHandling())
14325   this.RaiseKeyPress(evt);
14326 },
14327 OnKeyUp: function(evt) {
14328  if(!this.UseSpecialKeyboardHandling())
14329   this.RaiseKeyUp(evt);
14330 },
14331 RaiseKeyDown: function(evt){
14332  if(!this.KeyDown.IsEmpty()){
14333   var args = new ASPxClientEditKeyEventArgs(evt);
14334   this.KeyDown.FireEvent(this, args);
14335  }
14336 },
14337 RaiseKeyPress: function(evt){
14338  if(!this.KeyPress.IsEmpty()){
14339   var args = new ASPxClientEditKeyEventArgs(evt);
14340   this.KeyPress.FireEvent(this, args);
14341  }
14342 },
14343 RaiseKeyUp: function(evt){
14344  if(!this.KeyUp.IsEmpty()){
14345   var args = new ASPxClientEditKeyEventArgs(evt);
14346   this.KeyUp.FireEvent(this, args);
14347  }
14348 },
14349 RaiseFocus: function(){
14350  if(!this.GotFocus.IsEmpty()){
14351   var args = new ASPxClientEventArgs();
14352   this.GotFocus.FireEvent(this, args);
14353  }
14354 },
14355 RaiseLostFocus: function(){
14356  if(!this.LostFocus.IsEmpty()){
14357   var args = new ASPxClientEventArgs();
14358   this.LostFocus.FireEvent(this, args);
14359  }
14360 },
14361 RaiseValidation: function() {
14362  if(this.customValidationEnabled && !this.Validation.IsEmpty()) {
14363   var currentValue = this.GetValue();
14364   var args = new ASPxClientEditValidationEventArgs(currentValue, this.errorText, this.GetIsValid());
14365   this.Validation.FireEvent(this, args);
14366   this.SetErrorText(args.errorText, true );
14367   this.SetIsValid(args.isValid, true );
14368   if(args.value != currentValue)
14369    this.SetValue(args.value);
14370  }
14371 },
14372 RaiseValueChanged: function(){
14373  var processOnServer = this.isPostBackAllowed();
14374  if(!this.ValueChanged.IsEmpty()){
14375   var args = new ASPxClientProcessingModeEventArgs(processOnServer);
14376   this.ValueChanged.FireEvent(this, args);
14377   processOnServer = args.processOnServer;
14378  }
14379  return processOnServer;  
14380 },
14381 isPostBackAllowed: function() {
14382  return this.autoPostBack;
14383 },
14384 AddDecorationStyle: function(key, className, cssText) {
14385  if(!this.styleDecoration) 
14386   this.RequireStyleDecoration();
14387  this.styleDecoration.AddStyle(key, className, cssText);
14388 }, 
14389 RequireStyleDecoration: function() {
14390  this.styleDecoration = this.CreateStyleDecoration();
14391  this.PopulateStyleDecorationPostfixes();
14392 },
14393 CreateStyleDecoration: function() {
14394  return new ASPx.EditorStyleDecoration(this);
14395 },
14396 PopulateStyleDecorationPostfixes: function() {
14397  this.styleDecoration.AddPostfix("");
14398 },
14399 LockStyleDecorationUpdate: function() {
14400  if(this.styleDecoration)
14401   this.styleDecoration.LockUpdate();
14402 },
14403 UnlockStyleDecorationUpdate: function() {
14404  if(this.styleDecoration)
14405   this.styleDecoration.UnlockUpdate();
14406 },
14407 Focus: function(){
14408  this.SetFocus();
14409 },
14410 GetIsValid: function() {
14411  var hasRequiredInputElement = !this.RequireInputElementToValidate() || ASPx.IsExistsElement(this.GetInputElement());
14412  if(!hasRequiredInputElement || this.IsErrorFrameDisplayed() && !ASPx.IsExistsElement(this.GetElementRequiredForErrorFrame()))
14413   return true;
14414  return this.isValid;
14415 },
14416 RequireInputElementToValidate: function() {
14417  return true;
14418 },
14419 IsErrorFrameDisplayed: function() {
14420  return this.display !== ErrorFrameDisplay.None;
14421 },
14422 GetErrorText: function(){
14423  return this.errorText;
14424 },
14425 SetIsValid: function(isValid, validating){
14426  if(this.customValidationEnabled && this.isValid != isValid) {
14427   this.isValid = isValid;
14428   this.UpdateErrorFrameAndFocus(false );
14429   this.UpdateClientValidationState();
14430   if(!validating)
14431    this.UpdateValidationSummaries(ValidationType.PersonalViaScript);
14432  }
14433 },
14434 SetErrorText: function(errorText, validating){
14435  if(this.customValidationEnabled && this.errorText != errorText) {
14436   this.errorText = errorText;
14437   this.UpdateErrorFrameAndFocus(false );
14438   this.UpdateClientValidationState();
14439   if(!validating)
14440    this.UpdateValidationSummaries(ValidationType.PersonalViaScript);
14441  }
14442 },
14443 Validate: function(){
14444  this.ParseValue();
14445  this.OnValidation(ValidationType.PersonalViaScript);
14446 },
14447 GetModifyEvent: function() {
14448  return this.ValueChanged;
14449 },
14450 EnsureRequiredNativeAttributesExists: function() { }
14451});
14452ASPx.Ident.scripts.ASPxClientEdit = true;
14453ASPx.focusedEditorName = "";
14454ASPx.GetFocusedEditor = function() {
14455 var focusedEditor = ASPx.GetControlCollection().Get(ASPx.focusedEditorName);
14456 if(focusedEditor && !focusedEditor.focused){
14457  ASPx.SetFocusedEditor(null);
14458  focusedEditor = null;
14459 }
14460 return focusedEditor;
14461};
14462ASPx.SetFocusedEditor = function(editor) {
14463 ASPx.focusedEditorName = editor ? editor.name : "";
14464};
14465ASPx.FindAssociatedLabelElements = function(editor) {
14466 var assocciatedLabels = [];
14467 var inputElement = editor.GetInputElement();
14468 if(!ASPx.IsExists(inputElement) || !inputElement.id) 
14469  return assocciatedLabels;
14470 var labels = ASPx.GetNodesByTagName(document, "LABEL");
14471 for(var i = 0; i < labels.length; i++) {
14472  if(!!labels[i].htmlFor && labels[i].htmlFor === inputElement.id)
14473   assocciatedLabels.push(labels[i]);
14474 }
14475 return assocciatedLabels;
14476};
14477var DisableAccessibilityExplanatoryTextManager = ASPx.CreateClass(null, {
14478 constructor: function(editor) {
14479  this.editor = editor;
14480 },
14481 GetAdditionalTextRowId: function() {
14482  return this.editor.name + EditElementSuffix.AccessibilityAdditionalTextRow;
14483 },
14484 GetErrorTextElement: function () {
14485  return !!this.editor.GetErrorTextCell() ? this.editor.GetErrorTextCell() : this.editor.GetErrorImage();
14486 },
14487 GetTextElement: function() { return null; },
14488 SetCaptionAssociating: function() { },
14489 UpdateText: function() { },
14490 UpdateValidationState: function(validationType) { },
14491 ToggleErrorAlert: function() { },
14492 SetOrRemoveText: function(accessibilityElements, textElement, setText, isLabel, isFirst) { }
14493});
14494var EditAccessibilityExplanatoryTextManager = ASPx.CreateClass(DisableAccessibilityExplanatoryTextManager, {
14495 constructor: function(editor) {
14496  this.constructor.prototype.constructor.call(this, editor);
14497  this.invisibleRowCssClassName = "dxAIR";
14498 },
14499 GetTextElement: function() {
14500  var mainElement = this.editor.GetMainElement();
14501  if(!mainElement) return null;
14502  var explanatoryText = "";
14503  var explanatoryTextElement = null;
14504  if(!!this.editor.nullText)
14505   explanatoryText = this.editor.nullText;
14506  else if(!!this.editor.helpTextObj)
14507   explanatoryTextElement = this.editor.helpTextObj.helpTextElement;
14508  else if(!!mainElement.title)
14509   explanatoryText = mainElement.title;
14510  if(explanatoryText && mainElement.tagName == "TABLE") {
14511   var assistantElement = this.editor.GetAccessibilityFirstActiveElement();
14512   if(assistantElement)
14513    ASPx.Attr.Aria.AppendLabel(assistantElement, explanatoryText, true);
14514  }
14515  return explanatoryTextElement;
14516 },
14517 SetCaptionAssociating: function() {
14518  var captionCell = this.editor.GetCaptionCell();
14519  if(!captionCell || captionCell.childNodes[0].tagName == "LABEL") return;
14520  var labelElement = captionCell.childNodes[0];
14521  ASPx.EditAccessibilityExplanatoryTextManager.SetLabelAssociating(this.editor, this.editor.GetAccessibilityFirstActiveElement(), labelElement);
14522 },
14523 UpdateText: function() {
14524  var additionalTextElement = this.GetTextElement();
14525  if(ASPx.IsExists(additionalTextElement)) {
14526   var pronounceElement = this.editor.GetAccessibilityFirstActiveElement();
14527   var hasAnyLabel = !!ASPx.Attr.GetAttribute(pronounceElement, "aria-label") || 
14528    !!ASPx.Attr.GetAttribute(pronounceElement, "aria-labelledby") ||
14529    ASPx.FindAssociatedLabelElements(this.editor).length > 0;
14530   this.SetOrRemoveText([pronounceElement], additionalTextElement, true, !hasAnyLabel, false);
14531  }
14532 },
14533 UpdateValidationState: function(validationType) {
14534  if(validationType == ValidationType.PersonalOnValueChanged && this.editor.accessibilityHelper) return;
14535  var accessibilityElements = this.editor.GetAccessibilityActiveElements();
14536  var errorTextElement = this.GetErrorTextElement();
14537  this.SetOrRemoveText(accessibilityElements, errorTextElement, !this.editor.isValid, false, true);
14538  if(accessibilityElements.length > 0 && !!errorTextElement) {
14539   for(var i = 0; i < accessibilityElements.length; i++) {
14540    if(!ASPx.IsExists(accessibilityElements[i])) continue;
14541    ASPx.Attr.SetOrRemoveAttribute(accessibilityElements[i], "aria-invalid", !this.editor.isValid);
14542   }
14543  }
14544 },
14545 ToggleErrorAlert: function() {
14546  var errorTextElement = this.GetErrorTextElement();
14547  ASPx.SetElementDisplay(errorTextElement, false);
14548  ASPx.Attr.SetAttribute(errorTextElement, 'role', 'alert');
14549  ASPx.SetElementDisplay(errorTextElement, true);
14550  setTimeout(function() { ASPx.Attr.RemoveAttribute(errorTextElement, 'role'); }, 500);
14551 },
14552 SetOrRemoveText: function(accessibilityElements, textElement, setText, isLabel, isFirst) {
14553  var idsRefAttribute = isLabel ? ASPx.Attr.Aria.labelled : ASPx.Attr.Aria.described;
14554  if(!textElement) return;
14555  var textId = !!textElement.id ? textElement.id : textElement.parentNode.id;
14556  for(var i = 0; i < accessibilityElements.length; i++) {
14557   if(!accessibilityElements[i]) continue;
14558   var descRefString = ASPx.Attr.GetAttribute(accessibilityElements[i], idsRefAttribute);
14559   var descRefIds = !!descRefString ? descRefString.split(" ") : [ ];
14560   var descIndex = descRefIds.indexOf(textId);
14561   if(setText && descIndex == -1) {
14562    if(isFirst)
14563     descRefIds.unshift(textId);
14564    else
14565     descRefIds.push(textId);
14566   }
14567   else if(!setText && descIndex > -1)
14568    descRefIds.splice(descIndex, 1);
14569   ASPx.Attr.SetOrRemoveAttribute(accessibilityElements[i], idsRefAttribute, descRefIds.join(" "));
14570  }
14571 }
14572});
14573ASPx.DisableAccessibilityExplanatoryTextManager = DisableAccessibilityExplanatoryTextManager;
14574ASPx.EditAccessibilityExplanatoryTextManager = EditAccessibilityExplanatoryTextManager;
14575ASPx.EditAccessibilityExplanatoryTextManager.SetLabelAssociating = function(editor, activeElement, labelElement) {
14576 var clickHandler = function(evt) {
14577  if(editor && editor.OnAssociatedLabelClick)
14578   editor.OnAssociatedLabelClick(evt);
14579  else
14580   activeElement.click();
14581 };
14582 ASPx.Evt.AttachEventToElement(labelElement, "click", clickHandler);
14583 if(!!editor) {
14584  var hasAriaLabel = !!ASPx.Attr.GetAttribute(activeElement, "aria-label");
14585  editor.ariaExplanatoryTextManager.SetOrRemoveText([activeElement], labelElement, true, !hasAriaLabel, true);
14586 }
14587};
14588ASPxClientEdit.ClearEditorsInContainer = function(container, validationGroup, clearInvisibleEditors) {
14589 invalidEditorToBeFocused = null;
14590 ASPx.ProcessEditorsInContainer(container, ASPx.ClearProcessingProc, ASPx.ClearChoiceCondition, validationGroup, clearInvisibleEditors, true );
14591 ASPxClientEdit.ClearExternalControlsInContainer(container, validationGroup, clearInvisibleEditors, true );
14592};
14593ASPxClientEdit.ClearEditorsInContainerById = function(containerId, validationGroup, clearInvisibleEditors) {
14594 var container = document.getElementById(containerId);
14595 this.ClearEditorsInContainer(container, validationGroup, clearInvisibleEditors);
14596};
14597ASPxClientEdit.ClearGroup = function(validationGroup, clearInvisibleEditors) {
14598 return this.ClearEditorsInContainer(null, validationGroup, clearInvisibleEditors);
14599};
14600ASPxClientEdit.ValidateEditorsInContainer = function(container, validationGroup, validateInvisibleEditors) {
14601 var summaryCollection;
14602 if(ASPx.Ident.scripts.ASPxClientValidationSummary) {
14603  summaryCollection = ASPx.GetClientValidationSummaryCollection();
14604  summaryCollection.AllowNewErrorsAccepting(validationGroup);
14605 }
14606 var validationResult = ASPx.ProcessEditorsInContainer(container, ASPx.ValidateProcessingProc, _aspxValidateChoiceCondition, validationGroup, validateInvisibleEditors,
14607  false );
14608 validationResult.isValid = ASPxClientEdit.ValidateExternalControlsInContainer(container, validationGroup, validateInvisibleEditors,
14609  false ) && validationResult.isValid;
14610 if(typeof(validateInvisibleEditors) == "undefined")
14611  validateInvisibleEditors = false;
14612 if(typeof(validationGroup) == "undefined")
14613  validationGroup = null;    
14614 validationResult.isValid = ASPx.GetControlCollection().RaiseValidationCompleted(container, validationGroup,
14615 validateInvisibleEditors, validationResult.isValid, validationResult.firstInvalid, validationResult.firstVisibleInvalid);
14616 if(summaryCollection)
14617  summaryCollection.ForbidNewErrorsAccepting(validationGroup);
14618 if(!validationResult.isValid && !!validationResult.firstVisibleInvalid && validationResult.firstVisibleInvalid.accessibilityCompliant && !validationResult.firstVisibleInvalid.setFocusOnError) {
14619  var accessInvalidControl = validationResult.firstVisibleInvalid;
14620  if(!summaryCollection && !accessInvalidControl.focused) {
14621   var beforeDelayActiveElement = ASPx.GetActiveElement();
14622   setTimeout(function() {
14623    var currentActiveElement = ASPx.GetActiveElement();
14624    if(accessInvalidControl.focused || (currentActiveElement != beforeDelayActiveElement && ASPx.Attr.IsExistsAttribute(currentActiveElement, 'role')))
14625     return;
14626    accessInvalidControl.ariaExplanatoryTextManager.ToggleErrorAlert();
14627   }, 500);    
14628  }
14629 }
14630 return validationResult.isValid;
14631};
14632ASPxClientEdit.ValidateEditorsInContainerById = function(containerId, validationGroup, validateInvisibleEditors) {
14633 var container = document.getElementById(containerId);
14634 return this.ValidateEditorsInContainer(container, validationGroup, validateInvisibleEditors);
14635};
14636ASPxClientEdit.ValidateGroup = function(validationGroup, validateInvisibleEditors) {
14637 return this.ValidateEditorsInContainer(null, validationGroup, validateInvisibleEditors);
14638};
14639ASPxClientEdit.AreEditorsValid = function(containerOrContainerId, validationGroup, checkInvisibleEditors) {
14640 var container = typeof(containerOrContainerId) == "string" ? document.getElementById(containerOrContainerId) : containerOrContainerId;
14641 var checkResult = ASPx.ProcessEditorsInContainer(container, ASPx.EditorsValidProcessingProc, _aspxEditorsValidChoiceCondition, validationGroup,
14642  checkInvisibleEditors, false );
14643 checkResult.isValid = ASPxClientEdit.AreExternalControlsValidInContainer(containerOrContainerId, validationGroup,
14644  checkInvisibleEditors, false ) && checkResult.isValid;
14645 return checkResult.isValid;
14646};
14647ASPxClientEdit.AreExternalControlsValidInContainer = function(containerId, validationGroup, validateInvisibleEditors, processDisabledEditors) {
14648 if(ASPx.Ident.scripts.ASPxClientHtmlEditor)
14649  return ASPxClientHtmlEditor.AreEditorsValidInContainer(containerId, validationGroup, validateInvisibleEditors, processDisabledEditors);
14650 return true;
14651};
14652ASPxClientEdit.ClearExternalControlsInContainer = function(containerId, validationGroup, validateInvisibleEditors, processDisabledEditors) {
14653 if(ASPx.Ident.scripts.ASPxClientHtmlEditor)
14654  return ASPxClientHtmlEditor.ClearEditorsInContainer(containerId, validationGroup, validateInvisibleEditors, processDisabledEditors);
14655 return true;
14656};
14657ASPxClientEdit.ValidateExternalControlsInContainer = function(containerId, validationGroup, validateInvisibleEditors, processDisabledEditors) {
14658 if(ASPx.Ident.scripts.ASPxClientHtmlEditor)
14659  return ASPxClientHtmlEditor.ValidateEditorsInContainer(containerId, validationGroup, validateInvisibleEditors, processDisabledEditors);
14660 return true;
14661};
14662ASPxClientEdit.AttachEditorModificationListener = function(handler, predicate) {
14663 var processAction = function(event) { event.AddHandler(handler); };
14664 ASPxClientEdit.ProcessEditorModificationListener(handler, processAction, predicate);
14665};
14666ASPxClientEdit.DetachEditorModificationListener = function(handler, predicate) {
14667 var processAction = function(event) { event.RemoveHandler(handler); };
14668 ASPxClientEdit.ProcessEditorModificationListener(handler, processAction, predicate);
14669};
14670ASPxClientEdit.ProcessEditorModificationListener = function(handler, action, predicate) {
14671 ASPx.GetControlCollection().ForEachControl(function(control) {
14672  if(control.GetModifyEvent && predicate(control)) {
14673   if(control.isNative)
14674    control.EnsureRequiredNativeAttributesExists();
14675   action(control.GetModifyEvent());
14676  }
14677 });
14678};
14679var ASPxClientEditKeyEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
14680 constructor: function(htmlEvent) {
14681  this.constructor.prototype.constructor.call(this);
14682  this.htmlEvent = htmlEvent;
14683 }
14684});
14685var ASPxClientEditValidationEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
14686 constructor: function(value, errorText, isValid) {
14687  this.constructor.prototype.constructor.call(this);
14688  this.errorText = errorText;
14689  this.isValid = isValid;
14690  this.value = value;
14691 }
14692});
14693ASPx.ProcessEditorsInContainer = function(container, processingProc, choiceCondition, validationGroup, processInvisibleEditors, processDisabledEditors) {
14694 var allProcessedSuccessfull = true;
14695 var firstInvalid = null;
14696 var firstVisibleInvalid = null;
14697 var invalidEditorToBeFocused = null;
14698 ASPx.GetControlCollection().ForEachControl(function(control) {
14699  var canValidate = ASPx.CanValidateControl(control, container, processingProc, choiceCondition, validationGroup, processInvisibleEditors, processDisabledEditors);
14700  if(!canValidate) return;
14701  var isSuccess = processingProc(control);
14702  if(!isSuccess) {
14703   allProcessedSuccessfull = false;
14704   if(firstInvalid == null)
14705    firstInvalid = control;
14706   var isVisible = control.IsVisible();
14707   if(isVisible && firstVisibleInvalid == null)
14708    firstVisibleInvalid = control;
14709   if(control.setFocusOnError && invalidEditorToBeFocused == null && isVisible)
14710    invalidEditorToBeFocused = control;
14711  }
14712 }, this);
14713 if(invalidEditorToBeFocused != null)
14714  invalidEditorToBeFocused.SetFocus();
14715 return new ASPxValidationResult(allProcessedSuccessfull, firstInvalid, firstVisibleInvalid);
14716};
14717ASPx.CanValidateControl = function(control, container, processingProc, choiceCondition, validationGroup, processInvisibleEditors, processDisabledEditors) {
14718 var needToProcessRatingControl = window.ASPxClientRatingControl && (control instanceof ASPxClientRatingControl) && processingProc === ASPx.ClearProcessingProc;
14719 var mainElement = control.GetMainElement(); 
14720 if(!ASPx.Ident.IsASPxClientEdit(control) && !needToProcessRatingControl)
14721  return false;
14722 if(ASPx.Ident.isDialogInvisibleControl(control) || ASPx.Ident.isBatchEditUnusedEditor(control))
14723  return false; 
14724 if(!processDisabledEditors && !control.GetEnabled())
14725  return false;
14726 if(!mainElement || (container && !ASPx.GetIsParent(container, mainElement)))
14727  return false;
14728 if(!processInvisibleEditors && !control.IsVisible())
14729  return false;
14730 if(choiceCondition && !choiceCondition(control, validationGroup))
14731  return false;
14732 return true;
14733};
14734var ASPxValidationResult = ASPx.CreateClass(null, {
14735 constructor: function(isValid, firstInvalid, firstVisibleInvalid) {
14736  this.isValid = isValid;
14737  this.firstInvalid = firstInvalid;
14738  this.firstVisibleInvalid = firstVisibleInvalid;
14739 }
14740});
14741ASPx.ClearChoiceCondition = function(edit, validationGroup) {
14742 return !ASPx.IsExists(validationGroup) || (edit.validationGroup == validationGroup);
14743};
14744function _aspxValidateChoiceCondition(edit, validationGroup) {
14745 return ASPx.ClearChoiceCondition(edit, validationGroup) && edit.customValidationEnabled;
14746}
14747function _aspxEditorsValidChoiceCondition(edit, validationGroup) {
14748 return _aspxValidateChoiceCondition(edit, validationGroup);
14749}
14750function wrapLostFocusHandler(handler) {
14751 if(ASPx.Browser.Edge) {
14752  return function(name) {
14753   var edit = ASPx.GetControlCollection().Get(name);
14754   if(edit && !ASPx.IsElementVisible(edit.GetMainElement()))
14755    setTimeout(handler, 0, name);
14756   else
14757    handler(name);
14758  };
14759 }
14760 return handler;
14761}
14762ASPx.EGotFocus = function(name) {
14763 var edit = ASPx.GetControlCollection().Get(name);
14764 if(edit) {
14765  if(edit.isInitialized) {
14766   if(ASPx.Browser.VirtualKeyboardSupported && !edit.ownerListBox)
14767    ASPx.VirtualKeyboardUI.processEditorGotFocus(edit);
14768   else
14769    edit.OnFocus();
14770  }
14771  else {
14772   var inputElement = edit.GetFocusableInputElement();
14773   if(inputElement && inputElement === document.activeElement) {
14774    if(ASPx.Browser.Firefox)
14775     window.setTimeout(function() { document.activeElement.blur(); }, 0);
14776    else
14777     document.activeElement.blur();
14778   }
14779  }
14780 }
14781};
14782ASPx.ELostFocusCore = function(name) {
14783 var edit = ASPx.GetControlCollection().Get(name);
14784 if(ASPx.Browser.VirtualKeyboardSupported && (!edit || !edit.ownerListBox)) {
14785  var supressLostFocus = ASPx.VirtualKeyboardUI.isInputNativeBluring();
14786  if(!supressLostFocus)
14787   ASPx.VirtualKeyboardUI.resetFocusedEditorCore();
14788  else 
14789   return;
14790 }
14791 if(edit && edit.focused) {
14792  if(edit.UseDelayedSpecialFocus()) {
14793   if(edit.specialFocusTimer === -1)
14794    edit.specialFocusTimer = ASPx.Timer.SetControlBoundTimeout(function() { edit.OnLostFocus(); }, edit, 30);
14795  }
14796  else {
14797   edit.OnLostFocus();
14798  }
14799 }
14800};
14801ASPx.ELostFocus = wrapLostFocusHandler(ASPx.ELostFocusCore);
14802ASPx.EValueChanged = function(name) {
14803 var edit = ASPx.GetControlCollection().Get(name);
14804 if(edit != null)
14805  edit.OnValueChanged();
14806};
14807ASPx.VirtualKeyboardUI = (function() {
14808 var result = {
14809  focusedEditor: null,
14810  inputNativeFocusLocked: false,
14811  elementBelongsToEditor: function(element) {
14812   if(!element) return false;
14813   var isBelongsToEditor = false;
14814   ASPx.GetControlCollection().ForEachControl(function(control) {
14815    if(ASPx.Ident.IsASPxClientEdit(control) && control.IsEditorElement(element)) {
14816     isBelongsToEditor = true;
14817     return true;
14818    }
14819   }, this);
14820   return isBelongsToEditor;
14821  },
14822  elementBelongsToFocusedEditor: function (element) {
14823   return this.focusedEditor && this.focusedEditor.IsEditorElement(element);
14824  },
14825  onTouchStart: function (evt) {
14826   if (!ASPx.Browser.VirtualKeyboardSupported || this.isGooglePlaceAutocompleteElementTap(evt)) return;
14827   this.setInputNativeFocusLocked(false);
14828   if(this.focusedEditor)
14829    this.focusedEditor.onVirtualKeyboardUITouchStart(evt);
14830  },
14831  onTouchEnd: function(evt) {
14832   if(ASPx.TouchUIHelper.pointerEnabled) {  
14833    if(!window.testingTouchMode) { 
14834     if(evt.pointerType !== ASPx.TouchUIHelper.pointerType.Touch)
14835      return;
14836    }
14837    this.processFocusEditorControl(evt);
14838   } else
14839    ASPx.TouchUIHelper.handleFastTapIfRequired(evt,
14840     function() {
14841      this.processFocusEditorControl(evt);
14842     }.aspxBind(this), false);
14843  },
14844  processFocusEditorControl: function(evt) {
14845   var evtSource = ASPx.Evt.GetEventSource(evt);
14846   var focusedEditorIsTimeEdit = this.focusedEditor && (ASPx.Ident.IsASPxClientTimeEdit && ASPx.Ident.IsASPxClientTimeEdit(this.focusedEditor));
14847   var focusedTimeEditBelongsToDateEdit = focusedEditorIsTimeEdit && this.focusedEditor.OwnerDateEdit && this.focusedEditor.OwnerDateEdit.GetShowTimeSection();
14848   if(focusedTimeEditBelongsToDateEdit) {
14849    this.focusedEditor.OwnerDateEdit.ForceRefocusTimeSectionTimeEdit(evtSource);
14850    return;
14851   }
14852   var elementWithNativeFocus = ASPx.GetActiveElement();
14853   var someEditorInputIsFocused = this.elementBelongsToEditor(elementWithNativeFocus);
14854   var touchKeyboardIsVisible = someEditorInputIsFocused;
14855   var tapOutsideEditorAndInputs = !this.elementBelongsToEditor(evtSource) && !ASPx.Ident.IsFocusableElementRegardlessTabIndex(evtSource)
14856    && !this.isGooglePlaceAutocompleteElementTap(evt);
14857   var blurToHideTouchKeyboard = touchKeyboardIsVisible && tapOutsideEditorAndInputs;
14858   if(blurToHideTouchKeyboard) {
14859    elementWithNativeFocus.blur();
14860    return;
14861   }
14862   var tapOutsideFocusedEditor = this.focusedEditor && !this.elementBelongsToFocusedEditor(evtSource);
14863   if(tapOutsideFocusedEditor) {
14864    if(!this.elementBelongsToFocusedEditor(elementWithNativeFocus))
14865     this.resetFocusedEditor();
14866   }
14867  },
14868  focusEditor: function(edit) {
14869   if(!edit.focused) {
14870    this.setInputNativeFocusLocked(true);
14871    this.setFocusToEditor(edit);
14872   } else {
14873    edit.ForceRefocusEditor();
14874   }
14875  },
14876  setFocusToEditor: function(edit) {
14877   if(ASPx.Browser.MacOSMobilePlatform) {
14878    var timeoutDuration = ASPx.Browser.Chrome ? 250 : 30;
14879    window.setTimeout(function() {
14880     edit.SetFocus();
14881    }, timeoutDuration);
14882   } else {
14883    edit.SetFocus();
14884   }
14885  },
14886  processEditorGotFocus: function(edit) {
14887   if(this.focusedEditor === edit) {
14888    this.focusedEditor.UnlockFocusEvents();
14889    if(this.focusedEditor.EnsureClearButtonVisibility)
14890     this.focusedEditor.EnsureClearButtonVisibility();
14891   }
14892   else {
14893    this.setFocusedEditor(edit);
14894    if(this.getInputNativeFocusLocked())
14895     edit.BlurInputElement();
14896   }
14897  },
14898  setFocusedEditor: function(edit) {
14899   this.resetFocusedEditor();
14900   this.focusedEditor = edit;
14901   this.focusedEditor.Disposed.AddHandler(this.onFocusedEditorDisposed);
14902   this.focusedEditor.OnFocus();
14903   ASPx.SetFocusedEditor(this.focusedEditor);
14904  },
14905  isInputNativeBluring: function() {
14906   return this.focusedEditor && this.getInputNativeFocusLocked();
14907  },
14908  setInputNativeFocusLocked: function(locked) {
14909   this.inputNativeFocusLocked = locked;
14910  },
14911  getInputNativeFocusLocked: function() {
14912   return this.inputNativeFocusLocked;
14913  },
14914  resetFocusedEditor: function() {
14915   if(this.focusedEditor) {
14916    var curEditorName = this.focusedEditor.name;
14917    var focusedEditorInputElementExists = this.focusedEditor.GetInputElement();
14918    this.resetFocusedEditorCore();
14919    if(focusedEditorInputElementExists)
14920     ASPx.ELostFocusCore(curEditorName);
14921   }
14922  },
14923  resetFocusedEditorCore: function() { 
14924   if(this.focusedEditor)
14925    this.focusedEditor.Disposed.RemoveHandler(this.onFocusedEditorDisposed);
14926   this.focusedEditor = null;
14927  },
14928  getFocusedEditor: function() {
14929   return this.focusedEditor;
14930  },
14931  focusableInputElementIsActive: function(edit) {
14932   var inputElement = edit.GetFocusableInputElement();
14933   return !!inputElement ? ASPx.GetActiveElement() === inputElement : false;
14934  },
14935  isGooglePlaceAutocompleteElementTap: function(evt) {
14936   var googlePlaceAutocompleteContainer = ASPx.GetNodeByClassName(document.body, "pac-container", 0);
14937   if(!googlePlaceAutocompleteContainer)
14938    return false;
14939   return ASPx.GetParentByClassName(ASPx.Evt.GetEventSource(evt), "pac-container") != null;
14940  }
14941 };
14942 result.onFocusedEditorDisposed = function() {
14943  this.resetFocusedEditor();
14944 }.bind(result);
14945 return result;
14946})();
14947if(ASPx.Browser.VirtualKeyboardSupported) {
14948 var touchStartEventName = ASPx.TouchUIHelper.pointerEnabled ? ASPx.TouchUIHelper.pointerDownEventName : 'touchstart';
14949 var touchEndEventName = ASPx.TouchUIHelper.pointerEnabled ? ASPx.TouchUIHelper.pointerUpEventName : 'touchend';
14950 ASPx.Evt.AttachEventToDocument(touchStartEventName, function(evt) { ASPx.VirtualKeyboardUI.onTouchStart(evt); });
14951 ASPx.Evt.AttachEventToDocument(touchEndEventName, function(evt) { ASPx.VirtualKeyboardUI.onTouchEnd(evt); });
14952}
14953ASPx.Evt.AttachEventToDocument("mousedown", function(evt) {
14954 var editor = ASPx.GetFocusedEditor();
14955 if(!editor) 
14956  return;
14957 var evtSource = ASPx.Evt.GetEventSource(evt);
14958 if(editor.IsClearButtonElement(evtSource))
14959  return;
14960 if(editor.OwnerDateEdit && editor.OwnerDateEdit.GetShowTimeSection()) {
14961  editor.OwnerDateEdit.ForceRefocusTimeSectionTimeEdit(evtSource);
14962  return;
14963 }
14964 if(editor.ownerListBox && editor.ownerListBox.IsEditorElement(evtSource) && !editor.IsEditorElement(evtSource)) {
14965  editor.ownerListBox.ForceRefocusEditor(evt);
14966  ASPx.SetFocusedEditor(editor.ownerListBox);
14967  return;
14968 }
14969 if(editor.IsEditorElement(evtSource) && !editor.IsElementBelongToInputElement(evtSource))
14970  editor.ForceRefocusEditor(evt);
14971});
14972ASPx.Evt.AttachEventToDocument(ASPx.Evt.GetMouseWheelEventName(), function(evt) {
14973 var editor = ASPx.GetFocusedEditor();
14974 if(editor != null && ASPx.IsExistsElement(editor.GetMainElement()) && editor.focused && editor.receiveGlobalMouseWheel)
14975  editor.OnMouseWheel(evt);
14976});
14977ASPx.KBSIKeyDown = function(name, evt){
14978 var control = ASPx.GetControlCollection().Get(name);
14979 if(control != null){
14980  var isProcessed = control.OnSpecialKeyDown(evt);
14981  if(isProcessed)
14982   return ASPx.Evt.PreventEventAndBubble(evt);
14983 }
14984};
14985ASPx.KBSIKeyPress = function(name, evt){
14986 var control = ASPx.GetControlCollection().Get(name);
14987 if(control != null){
14988  var isProcessed = control.OnSpecialKeyPress(evt);
14989  if(isProcessed)
14990   return ASPx.Evt.PreventEventAndBubble(evt);
14991 }
14992};
14993ASPx.KBSIKeyUp = function(name, evt){
14994 var control = ASPx.GetControlCollection().Get(name);
14995 if(control != null){
14996  var isProcessed = control.OnSpecialKeyUp(evt);
14997  if(isProcessed)
14998   return ASPx.Evt.PreventEventAndBubble(evt);
14999 }
15000};
15001ASPx.ClearProcessingProc = function(edit) {
15002 return edit.Clear();
15003};
15004ASPx.ValidateProcessingProc = function(edit) {
15005 edit.OnValidation(ValidationType.MassValidation);
15006 return edit.GetIsValid();
15007};
15008ASPx.EditorsValidProcessingProc = function(edit) {
15009 return edit.GetIsValid();
15010};
15011var CheckEditElementHelper = ASPx.CreateClass(ASPx.CheckableElementHelper, {
15012 AttachToMainElement: function(internalCheckBox) {
15013  ASPx.CheckableElementHelper.prototype.AttachToMainElement.call(this, internalCheckBox);
15014  this.AttachToLabelElement(this.GetLabelElement(internalCheckBox.container), internalCheckBox);
15015 },
15016 AttachToLabelElement: function(labelElement, internalCheckBox) {
15017  var _this = this;
15018  if(labelElement) {
15019   ASPx.Evt.AttachEventToElement(labelElement, "click", 
15020    function (evt) { 
15021     _this.InvokeClick(internalCheckBox, evt);
15022    }
15023   );
15024   ASPx.Evt.AttachEventToElement(labelElement, "mousedown",
15025    function (evt) {
15026     internalCheckBox.Refocus();
15027    }
15028   );
15029  }
15030 },
15031 GetLabelElement: function(container) {
15032  var labelElement = ASPx.GetNodeByTagName(container, "LABEL", 0);
15033  if(!labelElement) {
15034   var labelCell = ASPx.GetNodeByClassName(container, "dxichTextCellSys", 0);
15035   labelElement = ASPx.GetNodeByTagName(labelCell, "SPAN", 0);
15036  }
15037  return labelElement;
15038 }
15039});
15040CheckEditElementHelper.Instance = new CheckEditElementHelper();
15041var CalendarSharedParameters = ASPx.CreateClass(null, {
15042 updateCalendarCallbackCommand: "UPDATE",
15043 constructor: function() {
15044  this.minDate = null;
15045  this.maxDate = null;
15046  this.disabledDates = [];
15047  this.calendarCustomDraw = false;
15048  this.hasCustomDisabledDatesViaCallback = false;
15049  this.dateRangeMode = false;
15050  this.currentDateEdit = null;
15051  this.DaysSelectingOnMouseOver = new ASPxClientEvent();
15052  this.VisibleDaysMouseOut = new ASPxClientEvent();
15053  this.CalendarSelectionChangedInternal = new ASPxClientEvent();
15054 },
15055 Assign: function(source) {
15056  this.minDate = source.minDate ? source.minDate : null;
15057  this.maxDate = source.maxDate ? source.maxDate : null;
15058  this.calendarCustomDraw = source.calendarCustomDraw ? source.calendarCustomDraw : false;
15059  this.hasCustomDisabledDatesViaCallback = source.hasCustomDisabledDatesViaCallback ? source.hasCustomDisabledDatesViaCallback : false;
15060  this.disabledDates = source.disabledDates ? source.disabledDates : [];
15061  this.currentDateEdit = source.currentDateEdit ? source.currentDateEdit : null;
15062 },
15063 GetUpdateCallbackParameters: function() {
15064  var callbackArgs = this.GetCallbackArgs();
15065  callbackArgs = this.FormatCallbackArg(this.updateCalendarCallbackCommand, callbackArgs);
15066  return callbackArgs;
15067 },
15068 GetCallbackArgs: function() {
15069  var args = {};
15070  if(this.minDate)
15071   args.clientMinDate = ASPx.DateUtils.GetInvariantDateString(this.minDate);
15072  if(this.maxDate)
15073   args.clientMaxDate = ASPx.DateUtils.GetInvariantDateString(this.maxDate);
15074  if(args.clientMinDate || args.clientMaxDate) {
15075   var jsonArgs = JSON.stringify(args);
15076   return ASPx.Str.EncodeHtml(jsonArgs);
15077  }
15078  return null;
15079 },
15080 FormatCallbackArg: function(prefix, arg) {
15081  if(!arg) return prefix;
15082  return [prefix, '|', arg.length, ';', arg, ';'].join('');
15083 }
15084});
15085ASPx.CalendarSharedParameters = CalendarSharedParameters;
15086ASPx.ValidationType = ValidationType;
15087ASPx.ErrorFrameDisplay = ErrorFrameDisplay;
15088ASPx.EditElementSuffix = EditElementSuffix;
15089ASPx.ValidationPattern = ValidationPattern;
15090ASPx.RequiredFieldValidationPattern = RequiredFieldValidationPattern;
15091ASPx.RegularExpressionValidationPattern = RegularExpressionValidationPattern;
15092ASPx.CheckEditElementHelper = CheckEditElementHelper;
15093ASPx.IsEditorFocusable = _aspxIsEditorFocusable;
15094window.ASPxClientEditBase = ASPxClientEditBase;
15095window.ASPxClientEdit = ASPxClientEdit;
15096window.ASPxClientEditKeyEventArgs = ASPxClientEditKeyEventArgs;
15097window.ASPxClientEditValidationEventArgs = ASPxClientEditValidationEventArgs;
15098})();
15099
15100(function() {
15101ASPx.TEInputSuffix = "_I";
15102ASPx.PasteCheckInterval = 50;
15103ASPx.CheckUserInputInterval = 10;
15104ASPx.TEHelpTextElementSuffix = "_HTE";
15105ASPx.TempHiddenInputSuffix = "_THI";
15106var passwordInputClonedSuffix = "_CLND";
15107var CHROME_AUTOFILL_SELECTOR = ":-webkit-autofill";
15108var BrowserHelper = {
15109 SAFARI_SYSTEM_CLASS_NAME: "dxeSafariSys",
15110 MOBILE_SAFARI_SYSTEM_CLASS_NAME: "dxeIPadSys",
15111 GetBrowserSpecificSystemClassName: function() {
15112  if(ASPx.Browser.Safari)
15113   return ASPx.Browser.MacOSMobilePlatform ? this.MOBILE_SAFARI_SYSTEM_CLASS_NAME : this.SAFARI_SYSTEM_CLASS_NAME;
15114  return "";
15115 }
15116};
15117var focusedNullTextClassName = "dxeFNTextSys";
15118var NullTextDisplayMode = {
15119 Unfocused: "Unfocused",
15120 UnfocusedAndFocused: "UnfocusedAndFocused"
15121};
15122ASPx.NullTextDisplayMode = NullTextDisplayMode;
15123var ASPxClientTextEdit = ASPx.CreateClass(ASPxClientEdit, {
15124 constructor: function(name) {
15125  this.constructor.prototype.constructor.call(this, name);      
15126  this.isASPxClientTextEdit = true;
15127  this.nullText = "";
15128  this.nullTextDisplayMode = NullTextDisplayMode.Unfocused;
15129  this.nullTextOnFocusCssText = "";
15130  this.focusedNullTextTimerID = -1;
15131  this.escCount = 0;
15132  this.raiseValueChangedOnEnter = true;
15133  this.autoResizeWithContainer = false;
15134  this.lastChangedValue = null;
15135  this.autoCompleteAttribute = null;
15136  this.isTextSelectionOnClickEnabled = false;
15137  this.trySelectInputTextOnClick = true;
15138  this.passwordNullTextIntervalID = -1;
15139  this.nullTextInputElement = null;
15140  this.helpText = "";
15141  this.helpTextObj = null;  
15142  this.helpTextStyle = [];
15143  this.externalTableStyle = [];
15144  this.helpTextPosition = ASPx.Position.Right;
15145  this.helpTextMargins = null;
15146  this.helpTextHAlign = ASPxClientTextEditHelpTextHAlign.Left;
15147  this.helpTextVAlign = ASPxClientTextEditHelpTextVAlign.Top;
15148  this.enableHelpTextPopupAnimation = true;
15149  this.helpTextDisplayMode = ASPxClientTextEditHelpTextDisplayMode.Inline;
15150  this.maskInfo = null;  
15151  this.maskValueBeforeUserInput = "";
15152  this.maskValueChangedByPassKeyPressOnAndroid = false;
15153  this.maskPasteTimerID = -1;
15154  this.maskPasteLock = false;    
15155  this.maskPasteCounter = 0;
15156  this.maskTextBeforePaste = "";    
15157  this.maskHintHtml = "";
15158  this.maskHintTimerID = -1;
15159  this.errorCellPosition = ASPx.Position.Right;
15160  this.inlineInitializeInputValue = null;
15161  this.initializeInputValue = null;
15162  this.displayFormat = null;
15163  this.TextChanged = new ASPxClientEvent();
15164  this.UserInput = new ASPxClientEvent();
15165  this.userInputEventTimerID = -1;
15166 },
15167 AddDefaultReadOnlyStateControllerItem: function(cssClass, mainElementId) {
15168  ASPx.AddReadOnlyItems(mainElementId, [[[cssClass], [''], ['', 'I']]]);
15169 },
15170 AddDefaultDisabledStateControllerItem: function(cssClass, mainElementId) {
15171  ASPx.AddDisabledItems(mainElementId, [[[cssClass], [''], ['', 'I']]]);
15172 },
15173 SetData: function(data){
15174  ASPxClientEdit.prototype.SetData.call(this, data);
15175  if(data.maskInfo) {
15176   var maskProperties = data.maskInfo.properties;
15177   var useInvariantCultureDecimalSymbol = maskProperties && maskProperties.useInvariantCultureDecimalSymbol || false;
15178   this.maskInfo = ASPx.MaskInfo.Create(data.maskInfo.maskText, data.maskInfo.dateTimeOnly, data.maskInfo.allowEscapingInEnums, useInvariantCultureDecimalSymbol);
15179   this.SetProperties(data.maskInfo.properties, this.maskInfo);
15180  }
15181 },
15182 InlineInitialize: function() {
15183  this.SaveInputValue(true);
15184  ASPxClientEdit.prototype.InlineInitialize.call(this);
15185  if(this.maskInfo != null)
15186   this.InitMask();
15187  this.ApplyBrowserSpecificClassName();
15188  this.helpTextInitialize();
15189 },
15190 Initialize: function(){
15191  this.SaveInputValue(false);
15192  this.SaveChangedValue();
15193  ASPxClientEdit.prototype.Initialize.call(this);
15194  if(ASPx.Browser.WebKitFamily)  
15195   this.CorrectMainElementWhiteSpaceStyle();
15196  this.InitializeTextDecoration();
15197  this.InitializeAutocompleteAttribute();
15198  if(this.IsValueRestoredByBrowser())
15199   this.SynchronizeRestoredValue();
15200 },
15201 InitializeEvents: function() {
15202  ASPxClientEdit.prototype.InitializeEvents.call(this);
15203  ASPx.Evt.AttachEventToElement(this.GetInputElement(), "keydown", this.OnKeyDown.aspxBind(this));
15204  ASPx.Evt.AttachEventToElement(this.GetInputElement(), "keyup", this.OnKeyUp.aspxBind(this));
15205  ASPx.Evt.AttachEventToElement(this.GetInputElement(), "keypress", this.OnKeyPress.aspxBind(this));
15206  if(this.isTextSelectionOnClickEnabled) {
15207   ASPx.Evt.AttachEventToElement(this.GetInputElement(), ASPx.TouchUIHelper.touchMouseDownEventName, this.OnMouseDown.aspxBind(this));
15208   ASPx.Evt.AttachEventToElement(this.GetInputElement(), "click", this.OnClick.aspxBind(this));
15209  }
15210  this.Unload.AddHandler(this.OnUnload.aspxBind(this));
15211 },
15212 InitializeTextDecoration: function() {
15213  var input = this.GetInputElement();
15214  if(input.type === "password" && !this.IsInputPasswordFilledAutomaticallyByChrome())
15215   this.ToggleTextDecoration();
15216 },
15217 IsInputPasswordFilledAutomaticallyByChrome: function() {
15218  if(!ASPx.Browser.Chrome)
15219   return false;
15220  var input = this.GetInputElement();
15221  return ASPx.ElementMatchesSelector(input, CHROME_AUTOFILL_SELECTOR);
15222 },
15223 OnMouseDown: function() {
15224  this.trySelectInputTextOnClick = ASPx.GetActiveElement() !== this.GetInputElement() && !this.IsFocusEventsLocked();
15225 },
15226 OnClick: function() {
15227  if(this.trySelectInputTextOnClick) {
15228   var input = this.GetInputElement();
15229   setTimeout(function() {
15230    var inputSelection = ASPx.Selection.GetInfo(input);
15231    if (inputSelection.startPos === inputSelection.endPos)
15232     ASPx.Selection.Set(input);
15233   }, 0);
15234  }
15235 },
15236 InitializeAutocompleteAttribute: function() {
15237  var input = this.GetInputElement();
15238  if(this.IsVCardAttributeRequired())
15239   ASPx.Attr.SetAttribute(input, this.autoCompleteAttribute.name, this.autoCompleteAttribute.value);
15240  else if(this.IsAutocompleteOffRequiredOnInitialize())
15241   ASPx.Attr.SetAttribute(input, "autocomplete", "off");
15242 },
15243 SaveInputValue: function(isInlineInitialize) {
15244  var input = this.GetInputElement();
15245  if(!input)
15246   return;
15247  var inputValue = input.value;
15248  if(inputValue === null)
15249   inputValue = "";
15250  if(isInlineInitialize)
15251   this.inlineInitializeInputValue = inputValue;
15252  else
15253   this.initializeInputValue = inputValue;
15254 },
15255 IsValueRestoredByBrowser: function() {
15256  if(this.displayFormat || this.isNative || this.inlineInitializeInputValue === null || this.initializeInputValue === null)
15257   return false;
15258  if(ASPx.Browser.Chrome)
15259   return this.IsValueRestoredByChrome();
15260  else if(ASPx.Browser.Firefox)
15261   return this.IsValueRestoredByFirefox();
15262  else
15263   return this.IsValueRestoredByBrowserCore();
15264 },
15265 IsValueRestoredByBrowserCore: function() {
15266  return this.IsValueChangedBeforeInitialize() || this.IsClientValueNotExists() || this.IsValueChangedOnMaskInitialize();
15267 },
15268 IsValueRestoredByChrome: function() {
15269  return this.IsValueRestoredByBrowserCore();
15270 },
15271 IsValueRestoredByFirefox: function() {
15272  return this.IsValueRestoredByBrowserCore();
15273 },
15274 IsValueChangedBeforeInitialize: function() {
15275  return this.inlineInitializeInputValue !== this.initializeInputValue;
15276 },
15277 IsClientValueNotExists: function() {
15278  return this.inlineInitializeInputValue !== "" &&
15279      this.inlineInitializeInputValue !== this.nullText &&
15280      this.inlineInitializeInputValue !== this.GetValue() &&
15281      this.inlineInitializeInputValue !== this.GetText();
15282 },
15283 IsValueChangedOnMaskInitialize: function() {
15284  return this.maskInfo && this.inlineInitializeInputValue !== this.GetInputElement().value;
15285 },
15286 SynchronizeRestoredValue: function() {
15287  this.SetText(this.initializeInputValue);
15288 },
15289 AdjustControl: function() {
15290  ASPxClientEdit.prototype.AdjustControl.call(this);
15291  this.ensureAdjustFocusedNullTextElement();
15292 },
15293 correctInputElementHeight: function() {
15294  var mainElement = this.GetMainElement();
15295  if(mainElement) {
15296   var mainElementHeight = mainElement.style.height;
15297   var mainElementHeightSpecified = mainElementHeight && mainElementHeight.indexOf('px') !== -1; 
15298   if(mainElementHeightSpecified) {
15299    var inputElement = this.GetInputElement();
15300    var inputElementHeight = this.getInputElementHeight();
15301    inputElement.style.height = inputElementHeight + "px";
15302    if(!ASPx.Ident.IsASPxClientMemo(this))
15303     inputElement.style.lineHeight = inputElementHeight + "px";
15304   }
15305  }
15306 },
15307 getInputElementHeight: function() {
15308  var mainElement = this.GetMainElement(),
15309   inputElement = this.GetInputElement();
15310  var inputElementHeight = ASPx.PxToInt(mainElement.style.height) - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(mainElement);
15311  var inputElementContainer = inputElement.parentNode,
15312   inputContainerStyle = ASPx.GetCurrentStyle(inputElementContainer);
15313  inputElementHeight -= ASPx.GetTopBottomBordersAndPaddingsSummaryValue(inputElementContainer, inputContainerStyle) 
15314   + ASPx.GetTopBottomMargins(inputElementContainer, inputContainerStyle);
15315  var mainElementCellspacing = ASPx.GetCellSpacing(mainElement);
15316  if(mainElementCellspacing)
15317   inputElementHeight -= mainElementCellspacing * 2;
15318  var inputStyle = ASPx.GetCurrentStyle(inputElement);
15319  inputElementHeight -= ASPx.GetTopBottomBordersAndPaddingsSummaryValue(inputElement, inputStyle) 
15320   + ASPx.GetTopBottomMargins(inputElement, inputStyle);
15321  return inputElementHeight;
15322 },
15323 getInputCell: function() {
15324  var inputElement = this.GetInputElement();
15325  if(inputElement)
15326   return inputElement.parentNode;
15327 },
15328 ensureOutOfRangeWarningManager: function (minValue, maxValue, defaultMinValue, defaultMaxValue, valueFormatter) {
15329  if (!this.outOfRangeWarningManager)
15330   this.outOfRangeWarningManager = new ASPxOutOfRangeWarningManager(this, minValue, maxValue, defaultMinValue, defaultMaxValue,
15331    this.showOutOfRangeWarningElementAtBottom() ? ASPx.Position.Bottom : ASPx.Position.Right, valueFormatter);
15332 },
15333 showOutOfRangeWarningElementAtBottom: function() {
15334  return this.hasRightPopupHelpText();
15335 },
15336 GetOutOfRangeWarningElementPrevSibling: function() {
15337  return this.GetMainElement();
15338 },
15339 helpTextInitialize: function () {
15340  if(this.helpText) {
15341   this.helpTextObj = new ASPxClientTextEditHelpText(this, this.helpTextStyle, this.helpText, this.helpTextPosition,
15342    this.helpTextHAlign, this.helpTextVAlign, this.helpTextMargins, this.enableHelpTextPopupAnimation, this.helpTextDisplayMode);
15343  }
15344 },
15345 hasPopupHelpText: function() {
15346  return this.helpText && this.helpTextDisplayMode === ASPxClientTextEditHelpTextDisplayMode.Popup;
15347 },
15348 hasRightPopupHelpText: function() {
15349  return this.hasPopupHelpText() && this.helpTextPosition === ASPx.Position.Right;
15350 },
15351 showHelpText: function () {
15352  if(this.helpTextObj)
15353   this.helpTextObj.show();
15354 },
15355 hideHelpText: function () {
15356  if(this.helpTextObj)
15357   this.helpTextObj.hide();
15358 },
15359 ApplyBrowserSpecificClassName: function() {
15360  var mainElement = this.GetMainElement();
15361  if(ASPx.IsExistsElement(mainElement)) {
15362   var className = BrowserHelper.GetBrowserSpecificSystemClassName();
15363   if(className)
15364    mainElement.className += " " + className;
15365  }
15366 },
15367  CorrectMainElementWhiteSpaceStyle: function() {
15368  var inputElement = this.GetInputElement();
15369  if(inputElement && inputElement.parentNode) {
15370   if(this.IsElementHasWhiteSpaceStyle(inputElement.parentNode))
15371    inputElement.parentNode.style.whiteSpace = "normal";
15372  }
15373 },
15374 IsElementHasWhiteSpaceStyle: function(element) {
15375  var currentStyle = ASPx.GetCurrentStyle(element);
15376  return currentStyle.whiteSpace == "nowrap" || currentStyle.whiteSpace == "pre";  
15377 },
15378 FindInputElement: function(){
15379  return this.isNative ? this.GetMainElement() : ASPx.GetElementById(this.name + ASPx.TEInputSuffix);
15380 },
15381 DecodeRawInputValue: function(value) {
15382  return value;
15383 },
15384 GetRawValue: function(value){
15385  return ASPx.IsExists(this.stateObject) ? this.stateObject.rawValue : null;
15386 },
15387 SetRawValue: function(value){
15388  if(ASPx.IsExists(value))
15389   value = value.toString();
15390  this.UpdateStateObjectWithObject({ rawValue: value });
15391 },
15392 SyncRawValue: function() {
15393  if(this.maskInfo != null)
15394   this.SetRawValue(this.maskInfo.GetValue(true));
15395  else
15396   this.SetRawValue(this.GetInputElement().value);
15397 },
15398 HasTextDecorators: function() {
15399  return this.nullText != "" || this.displayFormat != null;
15400 },
15401 CanApplyTextDecorators: function(){
15402  return !this.focused;
15403 },
15404 CreateStyleDecoration: function () {
15405  return new ASPx.TextEditorStyleDecoration(this);
15406 },
15407 CanApplyNullTextDecoration: function() {
15408  var value = this.GetValue();
15409  return this.IsNull(value);
15410 },
15411 GetDecoratedText: function(value) {
15412  var result = value;
15413  if(this.IsNull(value) && this.nullText != "" && this.CanApplyNullTextDecoration())
15414   result = this.nullText;
15415  else if(this.displayFormat != null)
15416   result = this.GetDisplayFormatText(value);
15417  else if(this.maskInfo != null)
15418   result = this.maskInfo.GetText();
15419  else if(value == null)
15420   result = "";
15421  return result;
15422 },
15423 GetDisplayFormatText: function(value) {
15424  return ASPx.Formatter.Format(this.displayFormat, value);
15425 },
15426 ToggleTextDecoration: function() {
15427  if(this.HasTextDecorators()) {
15428   if(this.focused) {
15429    var input = this.GetInputElement();
15430    var oldValue = input.value;
15431    var sel = ASPx.Selection.GetExtInfo(input);
15432    this.ToggleTextDecorationCore();
15433    this.ensureActivateFocusedNullTextMechanism();
15434    if(oldValue != input.value || !ASPx.Selection.AreEqual(sel, ASPx.Selection.GetExtInfo(input))) {
15435     if(sel.startPos == 0 && sel.endPos == oldValue.length)
15436      sel.endPos = input.value.length;
15437     else
15438      sel.endPos = sel.startPos;
15439     if(!this.accessibilityCompliant || ASPx.GetActiveElement() == input)
15440      this.SetSelectionOnToggleTextDecoration(input, sel);
15441    }
15442   } else {
15443    this.ToggleTextDecorationCore();
15444    this.ensureDeactivateFocusedNullTextMechanism();
15445   }
15446  }
15447 },
15448 SetSelectionOnToggleTextDecoration: function(input, sel) {
15449  ASPx.Selection.Set(input, sel.startPos, sel.endPos);
15450 },
15451 ToggleTextDecorationCore: function() {
15452  if(this.maskInfo != null) {   
15453   this.ApplyMaskInfo(false);
15454  } else {
15455   var input = this.GetInputElement();
15456   var rawValue = this.GetRawValue();
15457   var value = this.CanApplyTextDecorators() ? this.GetDecoratedText(rawValue) : rawValue;
15458   if(input.value != value) {
15459    if(input.type == "password")
15460     this.TogglePasswordInputTextDecoration(value);
15461    else
15462     input.value = value;
15463   }
15464  }
15465 },
15466 GetPasswordNullTextInputElement: function() {
15467  if(!this.isPasswordNullTextInputElementExists())
15468   this.nullTextInputElement = this.createPasswordNullTextInputElement();
15469  return this.nullTextInputElement;
15470 },
15471 createPasswordNullTextInputElement: function() {
15472  var inputElement = this.GetInputElement(),
15473   nullTextInputElement = document.createElement("INPUT");
15474  nullTextInputElement.className = inputElement.className;
15475  nullTextInputElement.style.cssText = inputElement.style.cssText;
15476  nullTextInputElement.id = inputElement.id + passwordInputClonedSuffix;
15477  nullTextInputElement.type = "text";
15478  if(ASPx.IsExists(inputElement.tabIndex))
15479   nullTextInputElement.tabIndex = inputElement.tabIndex;
15480  nullTextInputElement.disabled = inputElement.disabled;
15481  var onFocusEventHandler = function() {
15482   var inputElement = this.GetInputElement(),
15483    nullTextInputElement = this.GetPasswordNullTextInputElement();
15484   if(inputElement) {
15485    this.LockFocusEvents();  
15486    ASPx.SetElementDisplay(inputElement, true);
15487    if((ASPx.Browser.MacOSMobilePlatform && ASPx.Browser.PlaformMajorVersion >= 14) || (ASPx.Browser.MacOSPlatform && ASPx.Browser.Safari && ASPx.Browser.Version >= 14)) { 
15488     ASPx.GetCurrentStyle(inputElement).display; 
15489    }
15490    inputElement.focus();
15491    ASPx.SetElementDisplay(nullTextInputElement, false);
15492    this.ensureAdjustFocusedNullTextElement();
15493    this.ReplaceAssociatedIdInLabels(nullTextInputElement.id, inputElement.id);
15494   }
15495  }.aspxBind(this);
15496  ASPx.Evt.AttachEventToElement(nullTextInputElement, "focus", onFocusEventHandler);
15497  return nullTextInputElement;
15498 },
15499 isPasswordNullTextInputElementExists: function() {
15500  return ASPx.IsExistsElement(this.nullTextInputElement);
15501 },
15502 TogglePasswordNullTextTimeoutChecker: function() {
15503  if(this.passwordNullTextIntervalID < 0) {
15504   var timeoutChecker = function() {
15505    var inputElement = this.GetInputElement();
15506    if(ASPx.GetControlCollection().GetByName(this.name) !== this || inputElement == null) {
15507     window.clearTimeout(this.passwordNullTextIntervalID);
15508     this.passwordNullTextIntervalID = -1;
15509     return;
15510    } else {
15511     if(!this.focused) {
15512      var passwordNullTextInputElement = this.GetPasswordNullTextInputElement();
15513      if(passwordNullTextInputElement.value != this.nullText && inputElement.value == "") { 
15514       passwordNullTextInputElement.value = this.nullText;
15515       this.SetValue(null);
15516      }
15517      if(inputElement.value != "") {
15518       if(inputElement.style.display == "none") {
15519        this.SetValue(inputElement.value);
15520        this.UnhidePasswordInput();
15521       }
15522      } else {
15523       if(inputElement.style.display != "none") {
15524        this.SetValue(null);
15525        this.HidePasswordInput();
15526       }
15527      }
15528     }
15529     else {
15530      var passwordNullTextInputElement = this.GetPasswordNullTextInputElement();
15531      if(passwordNullTextInputElement.value !== this.nullText && passwordNullTextInputElement.value !== "") { 
15532       if(inputElement.value === "")
15533        inputElement.value = passwordNullTextInputElement.value;
15534       passwordNullTextInputElement.value = this.nullText;
15535      }
15536     }
15537    }
15538   }.aspxBind(this);
15539   timeoutChecker(); 
15540   this.passwordNullTextIntervalID = window.setInterval(timeoutChecker, 100);
15541  }
15542 },
15543 TogglePasswordInputTextDecoration: function(value) {
15544  var inputElement = this.GetInputElement();
15545  var nullTextInputElement = this.GetPasswordNullTextInputElement();
15546  nullTextInputElement.value = value;
15547  var parentNode = inputElement.parentNode;
15548  if(ASPx.Data.ArrayIndexOf(parentNode.childNodes, nullTextInputElement) < 0) {
15549   ASPx.Attr.ChangeStyleAttribute(nullTextInputElement, "display", "none");
15550   ASPx.InsertElementAfter(nullTextInputElement, inputElement);
15551  }
15552  this.HidePasswordInput();
15553  this.TogglePasswordNullTextTimeoutChecker();
15554 },
15555 HidePasswordInput: function() {
15556  ASPx.Attr.ChangeStyleAttribute(this.GetInputElement(), "display", "none");
15557  ASPx.Attr.ChangeStyleAttribute(this.GetPasswordNullTextInputElement(), "display", "");
15558  this.ReplaceAssociatedIdInLabels(this.GetInputElement().id, this.GetPasswordNullTextInputElement().id);
15559 },
15560 UnhidePasswordInput: function() {
15561  ASPx.Attr.ChangeStyleAttribute(this.GetInputElement(), "display", "");
15562  ASPx.Attr.ChangeStyleAttribute(this.GetPasswordNullTextInputElement(), "display", "none");
15563  this.ReplaceAssociatedIdInLabels(this.GetPasswordNullTextInputElement().id, this.GetInputElement().id);
15564 },
15565 ReplaceAssociatedIdInLabels: function(oldId, newId) {
15566  var labels = document.getElementsByTagName("LABEL");
15567  for(var i = 0; i < labels.length; i++) {
15568   if(labels[i].attributes["for"] && labels[i].attributes["for"].value == oldId)
15569    labels[i].attributes["for"].value = newId;
15570  }
15571 },
15572 GetFormattedText: function() {
15573  var value = this.GetValue();
15574  if(this.IsNull(value) && this.nullText != "")
15575   return this.GetText();
15576  return this.GetDecoratedText(value);
15577 },
15578 IsNull: function(value) {
15579  return value == null || value === "";
15580 },
15581 PopulateStyleDecorationPostfixes: function() {
15582  ASPxClientEdit.prototype.PopulateStyleDecorationPostfixes.call(this);
15583  this.styleDecoration.AddPostfix(ASPx.TEInputSuffix);
15584  if(this.GetInputElement().type === "password" && this.nullText !== "")
15585   this.styleDecoration.AddPostfix(ASPx.TEInputSuffix + passwordInputClonedSuffix);
15586 },
15587 GetValue: function() {
15588  var value = null;
15589  if(this.maskInfo != null)
15590   value = this.maskInfo.GetValue();
15591  else if(this.HasTextDecorators())
15592   value = this.GetRawValue();
15593  else {
15594   var input = this.GetInputElement();
15595   value = input ? input.value : null;
15596  }
15597  return (value == "" && this.convertEmptyStringToNull) ? null : value;
15598 },
15599 SetValue: function(value) {
15600  if(value == null || value === undefined) 
15601   value = "";
15602  if(this.maskInfo != null) {
15603   this.maskInfo.SetValue(value.toString());
15604   this.ApplyMaskInfo(false);
15605   this.SavePrevMaskValue();
15606  } 
15607  else if(this.HasTextDecorators()) {
15608   this.SetRawValue(value);
15609   this.GetInputElement().value = this.CanApplyTextDecorators() && this.GetInputElement().type != "password" ? this.GetDecoratedText(value) : value;
15610  }
15611  else
15612   this.GetInputElement().value = value;
15613  this.UpdateStyleDecorations(); 
15614  this.SaveChangedValue();   
15615 },
15616 SetVisible: function(visible) {
15617  ASPxClientEdit.prototype.SetVisible.call(this, visible);
15618  if(this.helpTextDisplayMode === ASPxClientTextEditHelpTextDisplayMode.Inline) {
15619   if(visible)
15620    this.showHelpText();
15621   else
15622    this.hideHelpText();
15623  }
15624 },
15625 UnstretchInputElement: function(){
15626  var inputElement = this.GetInputElement();
15627  var mainElement = this.GetMainElement();
15628  var mainElementCurStyle = ASPx.GetCurrentStyle(mainElement);
15629  if(ASPx.IsExistsElement(mainElement) && ASPx.IsExistsElement(inputElement) && ASPx.IsExists(mainElementCurStyle) && 
15630   inputElement.style.width == "100%" &&
15631   (mainElementCurStyle.width == "" || mainElementCurStyle.width == "auto"))
15632   inputElement.style.width = "";
15633 },
15634 RestoreActiveElement: function(activeElement) {
15635  if(activeElement && activeElement.setActive && activeElement.tagName != "IFRAME")
15636   activeElement.setActive();
15637 },
15638 RaiseValueChangedEvent: function() {
15639  var processOnServer = ASPxClientEdit.prototype.RaiseValueChangedEvent.call(this);
15640  processOnServer = this.RaiseTextChanged(processOnServer);
15641  return processOnServer;
15642 },
15643 InitMask: function() {
15644  var rawValue = this.GetRawValue();
15645  this.SetValue(rawValue.length ? this.DecodeRawInputValue(rawValue) : this.maskInfo.GetValue());
15646  this.validationPatterns.unshift(new MaskValidationPattern(this.maskInfo.errorText, this.maskInfo));
15647 },
15648 SetMaskPasteTimer: function() {
15649  this.ClearMaskPasteTimer();
15650  this.maskPasteTimerID = ASPx.Timer.SetControlBoundInterval(this.MaskPasteTimerProc, this, ASPx.PasteCheckInterval);
15651 },
15652 ClearMaskPasteTimer: function() {
15653  this.maskPasteTimerID = ASPx.Timer.ClearInterval(this.maskPasteTimerID);
15654 },
15655 SavePrevMaskValue: function() {
15656  this.maskValueBeforeUserInput = this.maskInfo.GetValue();
15657 },
15658 FillMaskInfo: function() {
15659  var input = this.GetInputElement();
15660  if(!input) return; 
15661  var sel = ASPx.Selection.GetInfo(input);
15662  this.maskInfo.SetCaret(sel.startPos, sel.endPos - sel.startPos);  
15663 },
15664 ApplyMaskInfo: function(applyCaret) {
15665  this.SyncRawValue();
15666  var input = this.GetInputElement();
15667  var text = this.GetMaskDisplayText();
15668  this.maskTextBeforePaste = text;
15669  if(input.value != text)
15670   input.value = text;
15671  if(applyCaret)
15672   ASPx.Selection.Set(input, this.maskInfo.caretPos, this.maskInfo.caretPos + this.maskInfo.selectionLength);
15673 },
15674 GetMaskDisplayText: function() {
15675  if(!this.focused && this.HasTextDecorators())
15676   return this.GetDecoratedText(this.maskInfo.GetValue());
15677  return this.maskInfo.GetText();
15678 },
15679 ShouldCancelMaskKeyProcessing: function(htmlEvent, keyDownInfo) {
15680  return ASPx.Evt.IsEventPrevented(htmlEvent);
15681 }, 
15682 HandleMaskKeyDown: function(evt) {
15683  var keyInfo = ASPx.MaskManager.CreateKeyInfoByEvent(evt);
15684  ASPx.MaskManager.keyCancelled = this.ShouldCancelMaskKeyProcessing(evt, keyInfo);
15685  if(ASPx.MaskManager.keyCancelled) {
15686   ASPx.Evt.PreventEvent(evt);
15687   return;
15688  }
15689  this.maskPasteLock = true;
15690  this.FillMaskInfo();  
15691  var canHandle = ASPx.MaskManager.CanHandleControlKey(keyInfo);   
15692  ASPx.MaskManager.savedKeyDownKeyInfo = keyInfo;
15693  if(canHandle) {   
15694   ASPx.MaskManager.OnKeyDown(this.maskInfo, keyInfo);
15695   this.ApplyMaskInfo(true);
15696   ASPx.Evt.PreventEvent(evt);
15697  }
15698  ASPx.MaskManager.keyDownHandled = canHandle;
15699  this.maskPasteLock = false;
15700  this.UpdateMaskHintHtml();
15701 },
15702 HandleMaskKeyPress: function(evt) {
15703  var keyInfo = ASPx.MaskManager.CreateKeyInfoByEvent(evt);
15704  ASPx.MaskManager.keyCancelled = ASPx.MaskManager.keyCancelled || this.ShouldCancelMaskKeyProcessing(evt, ASPx.MaskManager.savedKeyDownKeyInfo);
15705  if(ASPx.MaskManager.keyCancelled) {
15706   ASPx.Evt.PreventEvent(evt);
15707   return;
15708  }
15709  this.maskPasteLock = true;  
15710  var printable = ASPx.MaskManager.savedKeyDownKeyInfo != null && ASPx.MaskManager.IsPrintableKeyCode(ASPx.MaskManager.savedKeyDownKeyInfo);
15711  if(printable) {
15712   ASPx.MaskManager.OnKeyPress(this.maskInfo, keyInfo);
15713   this.ApplyMaskInfo(true);
15714  }
15715  if(printable || ASPx.MaskManager.keyDownHandled)   
15716   ASPx.Evt.PreventEvent(evt); 
15717  this.maskPasteLock = false;
15718  this.UpdateMaskHintHtml();
15719 },
15720 MaskPasteTimerProc: function() {
15721  if(this.maskPasteLock || !this.maskInfo) return;
15722  this.maskPasteCounter++;
15723  var inputElement = this.inputElement;
15724  if(!inputElement || this.maskPasteCounter > 40) {
15725   this.maskPasteCounter = 0;
15726   inputElement = this.GetInputElement();
15727   if(!ASPx.IsExistsElement(inputElement)) {
15728    this.ClearMaskPasteTimer();
15729    return;
15730   }
15731  }
15732  if(this.maskTextBeforePaste !== inputElement.value)
15733   this.ProcessInputValueChangedOnTimer();
15734  if(!this.focused)
15735   this.ClearMaskPasteTimer();
15736 },
15737 ProcessInputValueChangedOnTimer: function() {
15738  var inputElement = this.inputElement;
15739  var selectionInfo = ASPx.Selection.GetInfo(inputElement);
15740  var startCaretPosition = selectionInfo.startPos;
15741  var endCaretPosition = selectionInfo.endPos;
15742  var oldText = this.maskTextBeforePaste;
15743  var newText = inputElement.value;
15744  var isAndroidBackSpacePressed = this.isAndroidBackSpacePressed(oldText, newText, startCaretPosition, endCaretPosition);
15745  var isLastTypedCharacter = newText.indexOf(oldText) == 0 && newText.length > oldText.length;
15746  if(isAndroidBackSpacePressed || isLastTypedCharacter) {
15747   this.SetText(newText);
15748   this.SetCaretPosition(endCaretPosition);
15749   this.maskValueChangedByPassKeyPressOnAndroid = true;
15750  } else {
15751   this.maskInfo.ProcessPaste(newText, endCaretPosition);
15752   this.ApplyMaskInfo(true);
15753  }
15754 },
15755 isAndroidBackSpacePressed: function(oldText, newText, startCaretPosition, endCaretPosition) {
15756  if(!ASPx.Browser.AndroidMobilePlatform || startCaretPosition !== endCaretPosition || newText.length >= oldText.length)
15757   return false;
15758  var startSubstring = newText.substring(0, startCaretPosition);
15759  var endSubstring = newText.substring(startCaretPosition);
15760  var isStartSubstringMatches = oldText.indexOf(startSubstring) == 0;
15761  var isEndSubstringMatches = endSubstring == "" || oldText.lastIndexOf(endSubstring) == oldText.length - endSubstring.length;
15762  return isStartSubstringMatches && isEndSubstringMatches;
15763 },
15764 BeginShowMaskHint: function() {
15765  if(!this.GetReadOnly() && this.maskHintTimerID == -1)
15766   this.maskHintTimerID = window.setInterval(ASPx.MaskHintTimerProc, 500);
15767 },
15768 EndShowMaskHint: function() {
15769  window.clearInterval(this.maskHintTimerID);
15770  this.maskHintTimerID = -1;
15771 },
15772 MaskHintTimerProc: function() {  
15773  if(this.maskInfo) {
15774   this.FillMaskInfo();
15775   this.UpdateMaskHintHtml();
15776  } else {
15777   this.EndShowMaskHint();
15778  }
15779 },
15780 UpdateMaskHintHtml: function() {  
15781  var hint =  this.GetMaskHintElement();
15782  if(!ASPx.IsExistsElement(hint))
15783   return;
15784  var html = ASPx.MaskManager.GetHintHtml(this.maskInfo);
15785  if(html == this.maskHintHtml)
15786   return;
15787  if(html != "") {
15788   var mainElement = this.GetMainElement();
15789   if(ASPx.IsExistsElement(mainElement)) {
15790    hint.innerHTML = html;
15791    hint.style.position = "absolute";  
15792    hint.style.left = ASPx.PrepareClientPosForElement(ASPx.GetAbsoluteX(mainElement), mainElement, true) + "px";
15793    hint.style.top = (ASPx.PrepareClientPosForElement(ASPx.GetAbsoluteY(mainElement), mainElement, false) + mainElement.offsetHeight + 2) + "px";
15794    hint.style.display = "block";    
15795   }   
15796  } else {
15797   hint.style.display = "none";
15798  }
15799  this.maskHintHtml = html;
15800 },
15801 HideMaskHint: function() {
15802  var hint =  this.GetMaskHintElement();
15803  if(ASPx.IsExistsElement(hint))
15804   hint.style.display = "none";
15805  this.maskHintHtml = "";
15806 },
15807 GetMaskHintElement: function() {
15808  return ASPx.GetElementById(this.name + "_MaskHint");
15809 },
15810 OnLostFocus: function() {
15811  if(this.IsAutocompleteOffRequiredOnLostFocus())
15812   ASPx.Attr.SetAttribute(this.GetInputElement(), "autocomplete", "off");
15813  ASPxClientEdit.prototype.OnLostFocus.call(this);
15814 },
15815 OnMouseWheel: function(evt){
15816  if(this.GetReadOnly() || this.maskInfo == null || !this.maskInfo.allowMouseWheel)
15817   return;
15818  this.FillMaskInfo();
15819  ASPx.MaskManager.OnMouseWheel(this.maskInfo, ASPx.Evt.GetWheelDelta(evt) < 0 ? -1 : 1);
15820  this.ApplyMaskInfo(true);
15821  ASPx.Evt.PreventEvent(evt);
15822  this.UpdateMaskHintHtml();
15823 }, 
15824 OnBrowserWindowResize: function(e) {
15825  if(!this.autoResizeWithContainer)
15826   this.AdjustControl();
15827 },
15828 IsValueChanged: function() {
15829  return this.GetValue() != this.lastChangedValue; 
15830 },
15831 OnKeyDown: function(evt) {        
15832  if(this.NeedPreventBrowserUndoBehaviour(evt))
15833   return ASPx.Evt.PreventEvent(evt);
15834  if(this.RequireHandleMaxlenManually()) {
15835   this.onKeyDownInputValue = this.GetInputElement().value;
15836   var selectionInfo = ASPx.Selection.GetExtInfo(this.GetInputElement());
15837   this.onKeyDownCursorPos = selectionInfo.startPos;
15838  }
15839  this.escCount = 0;
15840  ASPxClientEdit.prototype.OnKeyDown.call(this, evt);
15841  if(!this.IsRaiseStandardOnChange(evt)) {
15842   if(!this.GetReadOnly() && this.maskInfo != null)
15843    this.HandleMaskKeyDown(evt);
15844  }
15845 },
15846 IsCtrlZ: function(evt) {
15847  return evt.ctrlKey && !evt.altKey && !evt.shiftKey && (ASPx.Evt.GetKeyCode(evt) == 122 || ASPx.Evt.GetKeyCode(evt) == 90);
15848 },
15849 NeedPreventBrowserUndoBehaviour: function(evt) {
15850  var inputElement = this.GetInputElement();
15851  return this.IsCtrlZ(evt) && !!inputElement && !inputElement.value;
15852 },
15853 OnKeyPress: function(evt) {
15854  ASPxClientEdit.prototype.OnKeyPress.call(this, evt);
15855  if(!this.GetReadOnly() && this.maskInfo != null && !this.IsRaiseStandardOnChange(evt))
15856   this.HandleMaskKeyPress(evt);
15857  if(this.NeedOnKeyEventEnd(evt, true))
15858   this.OnKeyEventEnd(evt);
15859 },
15860 OnKeyUp: function(evt) {
15861  if(ASPx.Browser.Firefox && !this.focused && ASPx.Evt.GetKeyCode(evt) === ASPx.Key.Tab)
15862   return;
15863  if(this.NeedOnKeyEventEnd(evt, false)) {
15864   var proccessNextCommingPress = ASPx.Evt.GetKeyCode(evt) === ASPx.Key.Alt; 
15865   this.OnKeyEventEnd(evt, proccessNextCommingPress);
15866  }
15867  if(this.RequireHandleMaxlenManually()) {
15868   var inputValueLength = this.GetInputElement().value.length;
15869   var maxLength = this.GetInputMaxLength();
15870   if(inputValueLength > maxLength && inputValueLength > this.onKeyDownInputValue.length) {
15871    this.GetInputElement().value = this.onKeyDownInputValue;
15872    this.SetCaretPosition(this.onKeyDownCursorPos);
15873   }
15874  }
15875  ASPxClientEdit.prototype.OnKeyUp.call(this, evt);
15876 },
15877 RequireHandleMaxlenManually: function() { 
15878  return ASPx.Browser.AndroidMobilePlatform && ASPx.Browser.SamsungAndroidDevice && ASPx.Browser.PlaformMajorVersion < 6 && this.GetInputMaxLength() !== -1;
15879 },
15880 GetInputMaxLength: function() {
15881  var input = this.GetInputElement();
15882  if(ASPx.Attr.IsExistsAttribute(input, "maxlength"))
15883   return input.maxLength;
15884  return -1;
15885 },
15886 NeedOnKeyEventEnd: function(evt, isKeyPress) { 
15887  var handleKeyPress = this.maskInfo != null && evt.keyCode == ASPx.Key.Enter;
15888  return handleKeyPress == isKeyPress;
15889 },
15890 OnKeyEventEnd: function(evt, withDelay){
15891  if(!this.GetReadOnly()) {
15892   if(this.IsRaiseStandardOnChange(evt))
15893    this.RaiseStandardOnChange();
15894   this.SyncRawValueIfHasTextDecorators(withDelay);
15895  }
15896 },
15897 SyncRawValueIfHasTextDecorators: function(withDelay) {
15898  if(this.HasTextDecorators()) {
15899   if(withDelay) {
15900    window.setTimeout(function() {
15901     this.SyncRawValue();
15902    }.aspxBind(this), 0);
15903   } else 
15904    this.SyncRawValue();
15905  }
15906 },
15907 IsRaiseStandardOnChange: function(evt){
15908  return !this.UseSpecialKeyboardHandling() && this.raiseValueChangedOnEnter && evt.keyCode == ASPx.Key.Enter;
15909 },
15910 GetFocusSelectAction: function() {
15911  if (this.maskInfo)
15912   return this.maskInfo.IsEmpty() ? null : "start";
15913  return "all"; 
15914 },
15915 CorrectFocusWhenDisabled: function() {
15916  if(!this.GetEnabled()) {
15917   var inputElement = this.GetInputElement();
15918   if(inputElement)
15919    inputElement.blur();
15920   return true;
15921  }
15922  return false;
15923 },
15924 EnsureShowPopupHelpText: function() {
15925  if(this.helpTextDisplayMode === ASPxClientTextEditHelpTextDisplayMode.Popup)
15926   this.showHelpText();
15927 },
15928 EnsureHidePopupHelpText: function() {
15929  if(this.helpTextDisplayMode === ASPxClientTextEditHelpTextDisplayMode.Popup)
15930   this.hideHelpText();
15931 },
15932 OnFocusCore: function() {
15933  if(this.maskInfo != null && !ASPx.GetControlCollection().InCallback()) {
15934   this.TrySetCursorToStartPosition();
15935   this.SetMaskPasteTimer();
15936  }
15937  if(this.IsAutocompleteDropDownListRequiredOnFocus())
15938   ASPx.Attr.RemoveAttribute(this.GetInputElement(), "autocomplete");
15939  if(this.CorrectFocusWhenDisabled())
15940   return;
15941  var wasLocked = this.IsFocusEventsLocked();
15942  ASPxClientEdit.prototype.OnFocusCore.call(this);
15943  if(this.maskInfo != null) {
15944   this.SavePrevMaskValue();
15945   this.BeginShowMaskHint();
15946  }
15947  if(!wasLocked) {
15948   this.ToggleTextDecoration();
15949   this.startUserInputEventTimerIfRequired();
15950  }
15951  if(this.isPasswordNullTextInputElementExists())
15952   setTimeout(function() { this.EnsureShowPopupHelpText(); }.aspxBind(this), 0);
15953  else
15954   this.EnsureShowPopupHelpText();
15955 },
15956 startUserInputEventTimerIfRequired: function () {
15957  if(this.shouldStartUserInputTimer() && this.userInputEventTimerID === -1) {
15958   this.prevInputValue = this.GetInputElement().value;
15959   this.userInputEventTimerID = ASPx.Timer.SetControlBoundInterval(this.processUserInputEventTimer, this, ASPx.CheckUserInputInterval);
15960  }
15961 },
15962 shouldStartUserInputTimer: function() {
15963  return !this.UserInput.IsEmpty();
15964 },
15965 restartCurrentUserInputTimer: function() {
15966  if(this.userInputEventTimerID !== -1) {
15967   this.processUserInputEventTimer(true);
15968   this.clearUserInputEventTimerIfRequired();
15969   this.startUserInputEventTimerIfRequired();
15970  }
15971 },
15972 clearUserInputEventTimerIfRequired: function () {
15973  if (this.userInputEventTimerID !== -1)
15974   this.userInputEventTimerID = ASPx.Timer.ClearInterval(this.userInputEventTimerID);
15975 },
15976 processUserInputEventTimer: function(onRestart) {
15977  var currentInputValue = this.GetInputElement().value;
15978  if(currentInputValue !== this.prevInputValue) {
15979   this.onInputChangedOnUserInputTimer(onRestart);
15980   this.prevInputValue = currentInputValue;
15981  }
15982 },
15983 onInputChangedOnUserInputTimer: function(onRestart) {
15984  if(this.raiseUserInputTimeout > -1)
15985   clearTimeout(this.raiseUserInputTimeout);
15986  this.raiseUserInputTimeout = setTimeout(function() {
15987   this.RaiseUserInput();
15988   this.raiseUserInputTimeout = -1;
15989  }.bind(this), 0);
15990 },
15991 ensureFocusedNullTextElement: function () {
15992  if(!this.focusedNullTextElement)
15993   this.createFocusedNullTextElement();
15994 },
15995 getFocusedNullTextElementClassName: function() {
15996  return focusedNullTextClassName;
15997 },
15998 getFocusedNullTextElementTagName: function() {
15999  return "INPUT";
16000 },
16001 getCopyFromInputElementStyles: function() {
16002  return [ "paddingLeft", "paddingTop", "paddingRight", "paddingBottom", "borderCollapse", "borderLeftWidth", "borderTopWidth", "borderRightWidth", "borderBottomWidth" ];
16003 },
16004 copyStylesFromInputElementToFocusedNullTextElement: function() {
16005  var input = this.GetInputElement();
16006  var inputStyle = ASPx.GetCurrentStyle(input);
16007  var stylesToCopy = this.getCopyFromInputElementStyles();
16008  for(var i = 0; i < stylesToCopy.length; i++)
16009   this.focusedNullTextElement.style[stylesToCopy[i]] = inputStyle[stylesToCopy[i]];
16010 },
16011 createFocusedNullTextElement: function() {
16012  this.focusedNullTextElement = document.createElement(this.getFocusedNullTextElementTagName());
16013  this.focusedNullTextElement.value = this.nullText;
16014  this.focusedNullTextElement.className = this.getFocusedNullTextElementClassName();
16015  this.focusedNullTextElement.tabIndex = -1;
16016  ASPx.SetElementDisplay(this.focusedNullTextElement, false);
16017  if(this.accessibilityCompliant) {
16018   ASPx.Attr.SetAttribute(this.focusedNullTextElement, "aria-label", this.nullText);
16019   ASPx.Attr.SetAttribute(this.focusedNullTextElement, "aria-hidden", true);
16020  }
16021  this.copyStylesFromInputElementToFocusedNullTextElement();
16022  if (this.nullTextOnFocusCssText) {
16023   var styleSheet = ASPx.GetCurrentStyleSheet();
16024   this.focusedNullTextElement.className += " " + ASPx.CreateImportantStyleRule(styleSheet, this.nullTextOnFocusCssText);
16025  }
16026  var inputElement = this.GetInputElement();
16027  inputElement.parentNode.insertBefore(this.focusedNullTextElement, inputElement.nextSibling);
16028 },
16029 ensureActivateFocusedNullTextMechanism: function() {
16030  if (this.nullTextDisplayMode === NullTextDisplayMode.UnfocusedAndFocused) {
16031   if(this.IsNull(this.GetValue()))
16032    this.changeFocusedNullTextElementVisibility(true);
16033   this.setFocusedNullTextTimer();
16034  }
16035 },
16036 ensureDeactivateFocusedNullTextMechanism: function () {
16037  if (this.nullTextDisplayMode === NullTextDisplayMode.UnfocusedAndFocused) {
16038   this.clearFocusedNullTextTimer();
16039   this.changeFocusedNullTextElementVisibility(false);
16040  }
16041 },
16042 setFocusedNullTextTimer: function () {
16043  if(this.focusedNullTextTimerID === -1)
16044   this.focusedNullTextTimerID = ASPx.Timer.SetControlBoundInterval(this.onFocusedNullTextVisibilityCheck, this, ASPx.PasteCheckInterval);
16045 },
16046 clearFocusedNullTextTimer: function () {
16047  this.focusedNullTextTimerID = ASPx.Timer.ClearInterval(this.focusedNullTextTimerID);
16048 },
16049 onFocusedNullTextVisibilityCheck: function (evt) {
16050  if(!this.needShowFocusedNullText() && this.isFocusedNullTextElementDisplayed())
16051   this.changeFocusedNullTextElementVisibility(false);
16052  else if(this.needShowFocusedNullText() && !this.isFocusedNullTextElementDisplayed())
16053   this.changeFocusedNullTextElementVisibility(true);
16054 },
16055 isFocusedNullTextElementDisplayed: function() {
16056  return this.focusedNullTextElement && ASPx.GetElementDisplay(this.focusedNullTextElement);
16057 },
16058 needShowFocusedNullText: function() {
16059  if(this.focusedNullTextTimerID === -1)
16060   return this.IsNull(this.GetValue());
16061  var result = this.GetInputElement().value === "";
16062  if(this.CanApplyNullTextDecoration)
16063   result = result && this.CanApplyNullTextDecoration();
16064  return result;
16065 }, 
16066 changeFocusedNullTextElementVisibility: function (visible) {
16067  this.ensureFocusedNullTextElement();
16068  ASPx.SetElementDisplay(this.focusedNullTextElement, visible);
16069  if(visible)
16070   this.adjustFocusedNullTextElement();  
16071 },
16072 getInputElementAbsoluteX: function(input) {
16073  var result = ASPx.GetAbsoluteX(input);
16074  if(ASPx.Browser.Opera || ASPx.Browser.AndroidMobilePlatform) 
16075   result++;
16076  return result;
16077 },
16078 getInputElementAbsoluteY: function (input) {
16079  var result = ASPx.GetAbsoluteY(input);
16080  if(ASPx.Browser.Opera || ASPx.Browser.AndroidMobilePlatform) 
16081   result++;
16082  return result;
16083 },
16084 adjustFocusedNullTextElement: function() {
16085  var input = this.GetInputElement();
16086  this.focusedNullTextElement.style.width = input.offsetWidth + "px";
16087  this.focusedNullTextElement.style.height = input.offsetHeight + "px";
16088  var inputXPos = this.getInputElementAbsoluteX(input);
16089  var inputYPos = this.getInputElementAbsoluteY(input);
16090  ASPx.SetAbsoluteX(this.focusedNullTextElement, inputXPos);
16091  ASPx.SetAbsoluteY(this.focusedNullTextElement, inputYPos);
16092  var shiftByX = inputXPos - ASPx.GetAbsoluteX(this.focusedNullTextElement);
16093  var shiftByY = inputYPos - ASPx.GetAbsoluteY(this.focusedNullTextElement);
16094  if (shiftByX !== 0)
16095   this.focusedNullTextElement.style.left = ASPx.PxToFloat(this.focusedNullTextElement.style.left) + shiftByX + "px";
16096  if (shiftByY !== 0)
16097   this.focusedNullTextElement.style.top = ASPx.PxToFloat(this.focusedNullTextElement.style.top) + shiftByY + "px";
16098 },
16099 ensureAdjustFocusedNullTextElement: function () {
16100  if(this.isFocusedNullTextElementDisplayed())
16101   this.adjustFocusedNullTextElement(this.focusedNullTextElement);
16102 },
16103 TrySetCursorToStartPosition: function() {
16104  var input = this.GetInputElement();
16105  var sel = ASPx.Selection.GetInfo(input);
16106  if (sel.startPos === sel.endPos && this.IsMaskInfoEmpty()) {
16107   var pos = this.maskInfo.GetFirstNonLiteralPosition();
16108   var setCaret = ASPx.Selection.SetCaretPosition.bind(this, input, pos);
16109   setTimeout(function() {
16110    if (document.activeElement === input) {
16111     setCaret();
16112     setTimeout(setCaret, 50);
16113    }
16114   }, 0);
16115  }
16116 },
16117 IsMaskInfoEmpty: function() {
16118  return this.maskInfo.IsEmpty();
16119 },
16120 OnLostFocusCore: function() {
16121  var wasLocked = this.IsFocusEventsLocked();
16122  ASPxClientEdit.prototype.OnLostFocusCore.call(this);
16123  if(this.maskInfo != null) {
16124   this.EndShowMaskHint();
16125   this.HideMaskHint();   
16126   if(this.maskInfo.ApplyFixes(null))
16127    this.ApplyMaskInfo(false);
16128   this.RaiseStandardOnChange();
16129  }
16130  if(!wasLocked) {
16131   this.clearUserInputEventTimerIfRequired();
16132   this.ToggleTextDecoration();
16133  }
16134  this.escCount = 0;
16135  this.EnsureHidePopupHelpText();
16136 },
16137 SetFocus: function() {
16138  if(this.isPasswordNullTextInputElementExists()) {
16139   this.GetPasswordNullTextInputElement().focus();
16140  } else {
16141     ASPxClientEdit.prototype.SetFocus.call(this);
16142  }
16143 },
16144 OnValueChanged: function() {
16145  if(this.maskInfo != null) {
16146   if(!this.maskValueChangedByPassKeyPressOnAndroid && this.maskInfo.GetValue() == this.maskValueBeforeUserInput && !this.IsValueChangeForced())
16147    return;
16148   if(this.maskValueChangedByPassKeyPressOnAndroid)
16149    this.maskValueChangedByPassKeyPressOnAndroid = false;
16150   this.SavePrevMaskValue();
16151  }
16152  if(this.HasTextDecorators())
16153   this.SyncRawValue();
16154  if(!this.IsValueChanged() && !this.IsValueChangeForced())
16155   return;
16156  this.SaveChangedValue(); 
16157  ASPxClientEdit.prototype.OnValueChanged.call(this);
16158 },
16159 IsValueChangeForced: function() {
16160  return false;
16161 },
16162 OnTextChanged: function() {
16163 },
16164 ForceTextChanged: function() {
16165  this.OnTextChanged();
16166 },
16167 SaveChangedValue: function() {
16168  this.lastChangedValue = this.GetValue();
16169 },
16170 RaiseStandardOnChange: function(){
16171  var element = this.GetInputElement();
16172  if(element && element.onchange) {
16173   element.onchange({ target: this.GetInputElement() });
16174  }
16175  else if(this.ValueChanged) {
16176   this.ValueChanged.FireEvent(this);
16177  }
16178 },
16179 RaiseTextChanged: function(processOnServer){
16180  if(!this.TextChanged.IsEmpty()){
16181   var args = new ASPxClientProcessingModeEventArgs(processOnServer);
16182   this.TextChanged.FireEvent(this, args);
16183   processOnServer = args.processOnServer;
16184  }
16185  return processOnServer;  
16186 },
16187 RaiseUserInput: function () {
16188  if(!this.UserInput.IsEmpty()) {
16189   var args = new ASPxClientEventArgs();
16190   this.UserInput.FireEvent(this, args);
16191  }
16192 },
16193 GetText: function(){
16194  if(this.maskInfo != null) {
16195   return this.maskInfo.GetText();
16196  } else {
16197   var value = this.GetValue();
16198   return value != null ? value : "";
16199  }
16200 },
16201 SetText: function (value){
16202  if(this.maskInfo != null) {
16203   this.maskInfo.SetText(value);
16204   this.ApplyMaskInfo(false);
16205   this.SavePrevMaskValue();
16206  } else {
16207   this.SetValue(value);
16208  }
16209 },
16210 SelectAll: function() {
16211  this.SetSelection(0, -1, false);
16212 },
16213 SetCaretPosition: function(pos) {
16214  var inputElement = this.GetInputElement();
16215  ASPx.Selection.SetCaretPosition(inputElement, pos);
16216 },
16217 GetCaretPosition: function() {
16218  var inputElement = this.GetInputElement();
16219  return ASPx.Selection.GetCaretPosition(inputElement);
16220 },
16221 SetSelection: function(startPos, endPos, scrollToSelection) { 
16222  var inputElement = this.GetInputElement();
16223  ASPx.Selection.Set(inputElement, startPos, endPos, scrollToSelection, true);
16224 },
16225 ChangeEnabledAttributes: function(enabled){
16226  var inputElement = this.GetInputElement();
16227  if(inputElement){
16228   this.ChangeInputEnabledAttributes(inputElement, ASPx.Attr.ChangeAttributesMethod(enabled), enabled);
16229   this.ChangeSpecialInputEnabledAttributes(inputElement, ASPx.Attr.ChangeEventsMethod(enabled), true);
16230   this.ChangeInputEnabled(inputElement, enabled, this.GetReadOnly());
16231   if(this.isPasswordNullTextInputElementExists())
16232    this.GetPasswordNullTextInputElement().disabled = inputElement.disabled;
16233  }
16234 },
16235 SetReadOnlyInternal: function(readOnly) {
16236  ASPxClientEdit.prototype.SetReadOnlyInternal.call(this, readOnly);
16237  this.ChangeInputReadOnly(readOnly);
16238 },
16239 ChangeReadOnlyStateItems: function(readOnly) {
16240  ASPxClientEdit.prototype.ChangeReadOnlyStateItems.call(this, readOnly);
16241  ASPx.GetStateController().SetElementReadOnly(this.GetInputElement(), readOnly);
16242  if(this.isPasswordNullTextInputElementExists())
16243   ASPx.GetStateController().SetElementReadOnly(this.GetPasswordNullTextInputElement(), readOnly);
16244 },
16245 ChangeInputReadOnly: function(readOnly) {
16246  var inputElement = this.GetInputElement();
16247  if(inputElement)
16248   inputElement.readOnly = readOnly || !this.GetEnabled() && this.UseReadOnlyForDisabled();
16249 },
16250 ChangeEnabledStateItems: function(enabled){
16251  if(!this.isNative) {
16252   var sc = ASPx.GetStateController();
16253   sc.SetElementEnabled(this.GetMainElement(), enabled);
16254   sc.SetElementEnabled(this.GetInputElement(), enabled);
16255   if(this.isPasswordNullTextInputElementExists())
16256    sc.SetElementEnabled(this.GetPasswordNullTextInputElement(), enabled);
16257  }
16258 },
16259 ChangeInputEnabled: function(element, enabled, readOnly) {
16260  if(this.UseReadOnlyForDisabled())
16261   element.readOnly = !enabled || readOnly;
16262  else
16263   element.disabled = !enabled;
16264 },
16265 ChangeInputEnabledAttributes: function(element, method, enabled) {
16266  method(element, "tabIndex");
16267  if(!enabled) element.tabIndex = -1;
16268  method(element, "onclick");
16269  method(element, "onkeydown");
16270  method(element, "onkeypress");
16271  method(element, "onkeyup");
16272 },
16273 UseReadOnlyForDisabled: function() {
16274  return false;
16275 },
16276 OnPostFinalization: function(args) {
16277  this.TryRestoreDisabledOnPost(args);
16278  this.TryClearInputTextDecorationOnPost(args);
16279 },
16280 TryRestoreDisabledOnPost: function(args) { 
16281  if(this.GetEnabled() || !this.UseReadOnlyForDisabled() || args.isDXCallback)
16282   return;
16283  var inputElement = this.GetInputElement();
16284  if(inputElement) {
16285   var inputDisabled = inputElement.disabled;
16286   inputElement.disabled = true;
16287   window.setTimeout(function() {
16288    inputElement.disabled = inputDisabled;
16289   }, 0);
16290  }
16291 },
16292 GetTempHiddenInputID: function() {
16293  return this.name + ASPx.TempHiddenInputSuffix;
16294 },
16295 TryClearInputTextDecorationOnPost: function(args) {
16296  if(ASPx.Platform === "NETCORE")
16297   return;
16298  if(this.HasTextDecorators() && !ASPx.IsExists(this.GetValue())) {
16299   var inputElement = this.GetInputElement();
16300   if(inputElement) {
16301    var name = ASPx.Attr.GetAttribute(inputElement, "name");
16302    if(name)
16303     this.TryClearInputTextDecorationOnPostCore(inputElement, name);
16304   }
16305  }
16306 },
16307 TryClearInputTextDecorationOnPostCore: function(inputElement, name) {
16308  var hiddenInput = ASPx.CreateHiddenField(name, this.GetTempHiddenInputID(), inputElement.parentNode);
16309  ASPx.Attr.SetAttribute(inputElement, "data-name", name);
16310  ASPx.Attr.RemoveAttribute(inputElement, "name");
16311  setTimeout(function() {
16312   ASPx.Attr.SetAttribute(inputElement, "name", name);
16313   ASPx.Attr.RemoveAttribute(inputElement, "data-name");
16314   ASPx.RemoveElement(hiddenInput);
16315  }, 0);
16316 },
16317 OnUnload: function() {
16318  var input = this.GetInputElement();
16319  if(!input)
16320   return;
16321  if(this.IsAutocompleteOffNotRequiredOnUnload())
16322   ASPx.Attr.RemoveAttribute(input, "autocomplete");
16323  if(this.focusedNullTextElement)
16324   ASPx.RemoveElement(this.focusedNullTextElement);
16325 },
16326 IsVCardAttributeRequired: function() {
16327  return this.autoCompleteAttribute && this.autoCompleteAttribute.name !== "autocomplete";
16328 },
16329 IsAutocompleteDropDownListRequiredOnFocus: function() {
16330  return !this.autoCompleteAttribute || this.IsVCardAttributeRequired();
16331 },
16332 IsAutocompleteOffRequiredOnInitialize: function() {
16333  return !this.isNative && (this.autoCompleteAttribute && this.autoCompleteAttribute.name === "autocomplete" || ASPx.Browser.WebKitFamily);
16334 },
16335 IsAutocompleteOffRequiredOnLostFocus: function() {
16336  return !this.autoCompleteAttribute && this.IsNullTextVisible() && !this.IsVCardAttributeRequired();
16337 },
16338 IsAutocompleteOffNotRequiredOnUnload: function() {
16339  return !this.IsNullTextVisible() || this.IsVCardAttributeRequired() || (this.maskInfo != null && this.GetValue() == null);
16340 },
16341 IsNullTextVisible: function() {
16342  return this.nullText && !this.GetValue() && !this.GetText();
16343 },
16344 GetModifyEvent: function() {
16345  return this.UserInput;
16346 }
16347});
16348MaskValidationPattern = ASPx.CreateClass(ASPx.ValidationPattern, {
16349 constructor: function(errorText, maskInfo) {
16350  this.constructor.prototype.constructor.call(this, errorText);
16351  this.maskInfo = maskInfo;
16352 },
16353 EvaluateIsValid: function(value) {
16354  return this.maskInfo.IsValid();
16355 }
16356});
16357ASPx.Ident.IsASPxClientTextEdit = function(obj) {
16358 return !!obj.isASPxClientTextEdit;
16359};
16360var ASPxClientTextBoxBase = ASPx.CreateClass(ASPxClientTextEdit, {
16361 constructor: function(name) {
16362  this.constructor.prototype.constructor.call(this, name);
16363  this.sizingConfig.allowSetHeight = false;
16364  this.sizingConfig.adjustControl = true;
16365 }
16366});
16367var ASPxClientTextBox = ASPx.CreateClass(ASPxClientTextBoxBase, {
16368 constructor: function(name) {
16369  this.constructor.prototype.constructor.call(this, name);
16370  this.isASPxClientTextBox = true;
16371  this.isCaptchaTextBox = false;
16372 },
16373 NeedProcessUnload: function() {
16374  return ASPxClientTextBoxBase.prototype.NeedProcessUnload.call(this) && !this.isCaptchaTextBox;
16375 },
16376 IsValueRestoredByBrowser: function() {
16377  if(this.isCaptchaTextBox)
16378   return this.initializeInputValue !== "" && this.initializeInputValue !== this.nullText;
16379  return  ASPxClientTextBoxBase.prototype.IsValueRestoredByBrowser.call(this);
16380 },
16381 SynchronizeRestoredValue: function() {
16382  if(this.isCaptchaTextBox)
16383   this.SetText(null);
16384  else
16385   ASPxClientTextBoxBase.prototype.SynchronizeRestoredValue.call(this);
16386 },
16387});
16388ASPxClientTextBox.Cast = ASPxClientControl.Cast;
16389ASPx.Ident.IsASPxClientTextBox = function(obj) {
16390 return !!obj.isASPxClientTextBox;
16391};
16392var ASPxClientMemo = ASPx.CreateClass(ASPxClientTextEdit, { 
16393 constructor: function(name) {
16394  this.constructor.prototype.constructor.call(this, name);        
16395  this.isASPxClientMemo = true;
16396  this.raiseValueChangedOnEnter = false;
16397  this.maxLength = 0;
16398  this.pasteTimerID = -1;
16399  this.pasteTimerActivatorCount = 0;
16400 },
16401 Initialize: function() {
16402  ASPxClientTextEdit.prototype.Initialize.call(this);
16403  this.SaveChangedValue();
16404  this.maxLengthRestricted = this.maxLength > 0;
16405 },
16406 CutString: function() {
16407  var text = this.GetText();
16408  if(text.length > this.maxLength) {
16409   text = text.substring(0, this.maxLength);
16410   this.SetText(text);
16411  }
16412 },
16413 EventKeyCodeChangesTheInput: function(evt) {
16414  if(ASPx.IsPasteShortcut(evt))
16415   return true;
16416  else if(evt.ctrlKey)
16417   return false;
16418  var keyCode = ASPx.Evt.GetKeyCode(evt);
16419  var isSystemKey = ASPx.Key.Windows <= keyCode && keyCode <= ASPx.Key.ContextMenu;
16420  var isFKey = ASPx.Key.F1 <= keyCode && keyCode <= 127; 
16421  return ASPx.Key.Delete < keyCode && !isSystemKey && !isFKey || keyCode == ASPx.Key.Enter || keyCode == ASPx.Key.Space;
16422 },
16423 OnTextChangingCheck: function() {
16424  if(this.maxLengthRestricted)  
16425   this.CutString(); 
16426 },
16427 StartTextChangingTimer: function() {
16428  if(this.maxLengthRestricted) {
16429   if(this.pasteTimerActivatorCount == 0) 
16430    this.SetTextChangingTimer();
16431   this.pasteTimerActivatorCount ++;
16432  }
16433 },
16434 EndTextChangingTimer: function() {
16435  if(this.maxLengthRestricted) {
16436   this.pasteTimerActivatorCount --;
16437   if(this.pasteTimerActivatorCount == 0) 
16438    this.ClearTextChangingTimer();
16439  }
16440 },
16441 CollapseEditor: function() {
16442  if(!this.IsAdjustmentRequired()) return;
16443  var mainElement = this.GetMainElement();
16444  var inputElement = this.GetInputElement();
16445  if(!ASPx.IsExistsElement(mainElement) || !ASPx.IsExistsElement(inputElement))
16446   return;
16447  ASPxClientTextEdit.prototype.CollapseEditor.call(this);
16448  var mainElementCurStyle = ASPx.GetCurrentStyle(mainElement);
16449  if(this.heightCorrectionRequired && mainElement && inputElement) {
16450   if(mainElement.style.height == "100%" || mainElementCurStyle.height == "100%") {
16451    mainElement.style.height = "0";
16452    mainElement.wasCollapsed = true;
16453   }
16454   inputElement.style.height = "0";
16455  }
16456 },
16457 SetWidth: function(width) {
16458  ASPxClientTextEdit.prototype.SetWidth.call(this, width);
16459 },
16460 ClearErrorFrameElementsStyles: function() {
16461  var textarea = this.GetInputElement();
16462  if(!textarea)
16463   return;
16464  var scrollBarPosition = textarea.scrollTop;
16465  ASPxClientTextEdit.prototype.ClearErrorFrameElementsStyles.call(this);
16466  if(ASPx.Browser.Firefox)
16467   textarea.scrollTop = scrollBarPosition;
16468 },
16469 OnMouseOver: function() {
16470  this.StartTextChangingTimer();
16471 },  
16472 OnMouseOut: function() {
16473  this.EndTextChangingTimer();
16474 },
16475 OnFocusCore: function() {  
16476  this.StartTextChangingTimer();
16477  ASPxClientTextEdit.prototype.OnFocusCore.call(this);
16478 },
16479 OnLostFocus: function() {
16480  this.EndTextChangingTimer();
16481  ASPxClientTextEdit.prototype.OnLostFocus.call(this);
16482 },
16483 OnKeyDown: function(evt) { 
16484  if(this.NeedPreventBrowserUndoBehaviour(evt))
16485   return ASPx.Evt.PreventEvent(evt);
16486  if(this.maxLengthRestricted){
16487   var selection = ASPx.Selection.GetInfo(this.GetInputElement()); 
16488   var noCharToReplace = selection.startPos == selection.endPos;
16489   if(this.GetText().length >= this.maxLength && noCharToReplace && this.EventKeyCodeChangesTheInput(evt)) {
16490    return ASPx.Evt.PreventEvent(evt);
16491   }
16492  }
16493  ASPxClientEdit.prototype.OnKeyDown.call(this, evt);
16494 },
16495 SetTextChangingTimer: function() {
16496  this.pasteTimerID = ASPx.Timer.SetControlBoundInterval(this.OnTextChangingCheck, this, ASPx.PasteCheckInterval);
16497 },
16498 ClearTextChangingTimer: function() {
16499  this.pasteTimerID = ASPx.Timer.ClearInterval(this.pasteTimerID);
16500 },
16501 getFocusedNullTextElementTagName: function() {
16502  return "TEXTAREA";
16503 },
16504 getCopyFromInputElementStyles: function() {
16505  var result = ASPxClientTextEdit.prototype.getCopyFromInputElementStyles.call(this);
16506  result.push("resize");
16507  return result;
16508 }
16509});
16510ASPxClientMemo.Cast = ASPxClientControl.Cast;
16511ASPx.Ident.IsASPxClientMemo = function(obj) { return obj && !!obj.isASPxClientMemo; };
16512var CLEAR_BUTTON_INDEX = -100;
16513var HIDE_CONTENT_CSS_CLASS_NAME = "dxHideContent";
16514var setContentVisibility = function(clearButtonElement, value) {
16515 var action = value ? ASPx.RemoveClassNameFromElement : ASPx.AddClassNameToElement;
16516 action(clearButtonElement, HIDE_CONTENT_CSS_CLASS_NAME);
16517};
16518var CLEAR_BUTTON_DISPLAY_MODE = {
16519 AUTO: 'Auto',
16520 ALWAYS: 'Always',
16521 NEVER: 'Never',
16522 ON_HOVER: 'OnHover'
16523};
16524var AccessibilityFocusedButtonClassName = "dxAFB";
16525var ButtonEditButtonLeftSystemClassName = "dxeButtonLeft";
16526var ASPxClientButtonEditBase = ASPx.CreateClass(ASPxClientTextBoxBase, {
16527 constructor: function(name) {
16528  this.constructor.prototype.constructor.call(this, name);        
16529  this.allowUserInput = true;
16530  this.isValueChanging = false;
16531  this.allowMouseWheel = true;
16532  this.isMouseOver = false;
16533  this.buttonCount = 0;
16534  this.emptyValueMaskDisplayText = "";
16535  this.clearButtonDisplayMode = CLEAR_BUTTON_DISPLAY_MODE.AUTO;
16536  this.forceShowClearButtonAlways = false;
16537  this.recoverClearButtonVisibility = false;
16538  this.ButtonClick = new ASPxClientEvent();
16539 },
16540 Initialize: function() {
16541  ASPxClientTextBoxBase.prototype.Initialize.call(this);
16542  this.EnsureEmptyValueMaskDisplayText();
16543  if(this.HasClearButton())
16544   this.InitializeClearButton();
16545  this.InitAccessibilityCompliant();
16546 },
16547 InlineInitialize: function() {
16548  ASPxClientTextBoxBase.prototype.InlineInitialize.call(this);
16549  if(this.clearButtonDisplayMode === CLEAR_BUTTON_DISPLAY_MODE.AUTO) {
16550   this.clearButtonDisplayMode = this.IsClearButtonVisibleAuto() || this.forceShowClearButtonAlways ?
16551    CLEAR_BUTTON_DISPLAY_MODE.ALWAYS : CLEAR_BUTTON_DISPLAY_MODE.NEVER;
16552  }
16553  this.EnsureClearButtonVisibility();
16554 },
16555 InitializeClearButton: function() {
16556  if(this.clearButtonDisplayMode === CLEAR_BUTTON_DISPLAY_MODE.ON_HOVER) {
16557   ASPx.Evt.AttachMouseEnterToElement(this.GetHoverElementToShowClearButton(), this.OnMouseOver.aspxBind(this), this.OnMouseOut.aspxBind(this));
16558  }
16559 },
16560 GetHoverElementToShowClearButton: function() {
16561  return this.GetMainElement();
16562 },
16563 IsClearButtonVisibleAuto: function() {
16564  return ASPx.Browser.MobileUI;
16565 },
16566 SetEnabled: function(enabled) {
16567  ASPxClientTextBoxBase.prototype.SetEnabled.call(this, enabled);
16568  this.EnsureClearButtonVisibility();
16569 },
16570 EnsureEmptyValueMaskDisplayText: function() {
16571  if(this.maskInfo && this.HasClearButton()) {
16572   var savedText = this.maskInfo.GetText();
16573   this.maskInfo.SetText("");
16574   this.emptyValueMaskDisplayText = this.maskInfo.GetText();
16575   this.maskInfo.SetText(savedText);
16576  }
16577 },
16578 GetButton: function(number) {
16579  return this.GetChildElement("B" + number);
16580 },
16581 GetCustomButtonCollection: function() {
16582  var buttonElements = [];
16583  for(var i = 0; i < this.buttonCount; i++) {
16584   var button =  this.GetButton(i);
16585   if(!!button)
16586    buttonElements.push(button);
16587  }
16588  return buttonElements;
16589 },
16590 GetButtonCollection: function() {
16591  var buttonElements = [];
16592  var clearButton = this.GetClearButton();
16593  if(!!clearButton)
16594   buttonElements.push(clearButton);
16595  return buttonElements.concat(this.GetCustomButtonCollection());
16596 },
16597 GetAccessibilityAnchor: function(buttonElement) {
16598  var firstChild = buttonElement.firstElementChild;
16599  var isExistsAnchorElement = ASPx.Attr.GetAttribute(firstChild, "role") === "button";
16600  return isExistsAnchorElement ? firstChild : null;
16601 },
16602 GetButtonByAccessibilityAnchor: function(anchorElement) {
16603  return anchorElement.parentNode;
16604 },
16605 SetAccessibilityAnchorEnabled: function(buttonElement, enabled) {
16606  var anchorElement = this.GetAccessibilityAnchor(buttonElement);
16607  if(ASPx.IsExists(anchorElement))
16608   ASPx.Attr.SetOrRemoveAttribute(anchorElement, "tabindex", enabled ? "0" : "");
16609 },
16610 InitAccessibilityCompliant: function() {
16611  if(!this.accessibilityCompliant) return;
16612  var buttonElements = this.GetButtonCollection();
16613  var labelElements = ASPx.FindAssociatedLabelElements(this);
16614  for(var i = 0; i < buttonElements.length; i++) {
16615   this.InitAccessibilityAnchor(this.GetAccessibilityAnchor(buttonElements[i]), labelElements);
16616   ASPx.Evt.AttachEventToElement(buttonElements[i], "mousedown", this.Button_MouseDown.bind(this));
16617  }
16618 },
16619 InitAccessibilityAnchor: function(anchorElement, labelElements) {
16620  if(!ASPx.IsExists(anchorElement))
16621   return;
16622  for(var i = 0; i < labelElements.length; i++)
16623   this.ariaExplanatoryTextManager.SetOrRemoveText([anchorElement], labelElements[i], true, false, false);
16624  this.InitAccessibilityAnchorEvents(anchorElement);
16625 },
16626 InitAccessibilityAnchorEvents: function(anchorElement) {
16627  ASPx.Evt.AttachEventToElement(anchorElement, "keydown", function(evt) { this.OnButtonKeysHandling(evt); }.aspxBind(this));
16628  ASPx.Evt.AttachEventToElement(anchorElement, "keyup", function(evt) { this.OnButtonKeysHandling(evt); }.aspxBind(this));
16629  ASPx.Evt.AttachEventToElement(anchorElement, "focus", function(evt) { this.OnButtonGotFocus(evt); }.aspxBind(this));
16630  ASPx.Evt.AttachEventToElement(anchorElement, "blur", function(evt) { this.OnButtonLostFocus(evt); }.aspxBind(this));
16631 },
16632 EmulateButtonMouseEvent: function(sourceElement) {
16633  var buttonElement = this.GetButtonByAccessibilityAnchor(sourceElement);
16634  var mouseEvent = buttonElement.onclick || buttonElement.onmousedown || buttonElement.ontouchstart || buttonElement.onpointerdown;
16635  var emulateMouseEvtArgs = { button: 0, which: 1, srcElement: buttonElement, target: buttonElement };
16636  if(!!mouseEvent) {
16637   ASPx.Attr.SetAttribute(sourceElement, "aria-pressed", true);
16638   setTimeout(function() {
16639    mouseEvent(emulateMouseEvtArgs);
16640    ASPx.Attr.RemoveAttribute(sourceElement, "aria-pressed");
16641   }, 300);
16642  }
16643 },
16644 OnButtonKeysHandling: function(evt) {
16645  var isKeyUp = evt.type == "keyup";
16646  var keyCode = ASPx.Evt.GetKeyCode(evt);
16647  var sourceElement = ASPx.Evt.GetEventSource(evt);
16648  if((keyCode == ASPx.Key.Space && isKeyUp) || (keyCode == ASPx.Key.Enter && !isKeyUp))
16649   this.EmulateButtonMouseEvent(sourceElement);
16650  if(keyCode != ASPx.Key.Tab)
16651   ASPx.Evt.PreventEventAndBubble(evt);
16652  return false;
16653 },
16654 OnButtonGotFocus: function(evt) {
16655  this.UnlockFocusEvents();
16656  var editor = ASPx.GetControlCollection().Get(this.name);
16657  var sourceElement = ASPx.Evt.GetEventSource(evt);
16658  if(!!editor && !editor.CorrectAccessibilityButtonFocus(sourceElement)) {
16659   var buttonElement = editor.GetButtonByAccessibilityAnchor(sourceElement);
16660   ASPx.AddClassNameToElement(buttonElement, this.GetAccessibilityFocusedButtonClassName());
16661   ASPx.EGotFocus(editor.name);
16662  }
16663 },
16664 OnButtonLostFocus: function(evt) {
16665  var editor = ASPx.GetControlCollection().Get(this.name);
16666  var sourceElement = ASPx.Evt.GetEventSource(evt);
16667  if(!!editor) {
16668   var buttonElement = editor.GetButtonByAccessibilityAnchor(sourceElement);
16669   ASPx.RemoveClassNameFromElement(buttonElement, this.GetAccessibilityFocusedButtonClassName());
16670  }
16671  setTimeout(function() {
16672   if(!!editor && !editor.IsEditorElement(ASPx.GetActiveElement())) {
16673    ASPx.ELostFocus(editor.name);
16674   }
16675  }.aspxBind(this), 0);
16676 },
16677 Button_MouseDown: function(evt) {
16678  var editor = ASPx.GetControlCollection().Get(this.name);
16679  if(!!editor) {
16680   var sourceElement = ASPx.Evt.GetEventSource(evt);
16681   if(document.activeElement !== sourceElement)
16682    this.LockFocusEvents();
16683  }
16684 },
16685 ForceRefocusEditor: function(evt, isNativeFocus) {
16686  if(this.accessibilityCompliant) {
16687   var srcElement = ASPx.Evt.GetEventSource(evt);
16688   var customButtons = this.GetCustomButtonCollection();
16689   for(var i = 0; i < customButtons.length; i++)
16690    if(customButtons[i] == srcElement || ASPx.GetIsParent(customButtons[i], srcElement))
16691     return;
16692  }
16693  ASPxClientEdit.prototype.ForceRefocusEditor.call(this, evt, isNativeFocus);
16694  if(this.GetInputElement().type == "password") {
16695   window.setTimeout(function() { this.GetInputElement().focus(); }.bind(this), 0);
16696  }
16697 },
16698 CorrectAccessibilityButtonFocus: function(sourceElement) {
16699  if(ASPx.Attr.IsExistsAttribute(sourceElement, "tabindex"))
16700   return false;
16701  setTimeout(function() {
16702   var buttonElements = this.GetButtonCollection();
16703   for(var i = 0; i < buttonElements.length; i++)
16704    if(ASPx.GetIsParent(buttonElements[i], sourceElement))
16705     this.GetAccessibilityAnchor(buttonElements[i]).focus();
16706  }.aspxBind(this), 0);
16707  return true;
16708 },
16709 OnKeyDown: function(evt) { 
16710  if(this.NeedEnsureClearButtonVisibilityOnKeyDown()) {
16711   var hasClearButtonOnHover = this.HasClearButton() && this.clearButtonDisplayMode === CLEAR_BUTTON_DISPLAY_MODE.ON_HOVER;
16712   this.recoverClearButtonVisibility = hasClearButtonOnHover && ASPx.Evt.GetKeyCode(evt) == ASPx.Key.Tab && !evt.shiftKey;
16713  }
16714  if(this.accessibilityCompliant) {
16715   var hasVisibleFocusableButtonToTheRIGHT = this.GetButtonCollection().some(function(buttonElement) {
16716    return this.IsButtonVisible(buttonElement)
16717     && !ASPx.ElementHasCssClass(buttonElement, ButtonEditButtonLeftSystemClassName)
16718     && this.GetAccessibilityAnchor(buttonElement) !== null;
16719   }, this);
16720   var hasVisibleFocusableButtonToTheLEFT = this.GetButtonCollection().some(function(buttonElement) {
16721    return this.IsButtonVisible(buttonElement)
16722     && ASPx.ElementHasCssClass(buttonElement, ButtonEditButtonLeftSystemClassName)
16723     && this.GetAccessibilityAnchor(buttonElement) !== null;
16724   }, this);
16725   if((ASPx.Evt.GetKeyCode(evt) === ASPx.Key.Tab && !evt.shiftKey && hasVisibleFocusableButtonToTheRIGHT) ||
16726    (ASPx.Evt.GetKeyCode(evt) === ASPx.Key.Tab && evt.shiftKey && hasVisibleFocusableButtonToTheLEFT ))
16727    this.LockFocusEvents();
16728  }
16729  ASPxClientTextBoxBase.prototype.OnKeyDown.call(this, evt);
16730 },
16731 NeedEnsureClearButtonVisibilityOnKeyDown: function() {
16732  return this.accessibilityCompliant;
16733 },
16734 GetAccessibilityFocusedButtonClassName: function() {
16735  return AccessibilityFocusedButtonClassName;
16736 },
16737 SetButtonVisible: function(number, value) {
16738  var button = this.GetButton(number);
16739  if(!button)
16740   return;
16741  var isClearButton = number === CLEAR_BUTTON_INDEX;
16742  var visibilityModifier = isClearButton ? setContentVisibility : ASPx.SetElementDisplay;
16743  if(isClearButton && this.clearButtonDisplayMode === CLEAR_BUTTON_DISPLAY_MODE.ALWAYS && this.accessibilityCompliant && this.enabled)
16744   this.SetAccessibilityAnchorEnabled(button, value);
16745  visibilityModifier(button, value);
16746 },
16747 GetButtonVisible: function(number) {
16748  var button = this.GetButton(number);
16749  return this.IsButtonVisible(button);
16750 },
16751 IsButtonVisible: function(button) {
16752  var result = false;
16753  if(button) {
16754   if(this.IsClearButtonElement(button) && this.clearButtonDisplayMode === CLEAR_BUTTON_DISPLAY_MODE.ALWAYS)
16755    result = !ASPx.ElementHasCssClass(button, this.GetHideContentCssClassName());
16756   else
16757    result = ASPx.IsElementVisible(button);
16758  }
16759  return result;
16760 },
16761 GetHideContentCssClassName: function() {
16762  return HIDE_CONTENT_CSS_CLASS_NAME;
16763 },
16764 ProcessInternalButtonClick: function(buttonIndex) {
16765  return false;
16766 },
16767 OnButtonClick: function(number) {
16768  var processOnServer = this.RaiseButtonClick(number);
16769  if(!this.ProcessInternalButtonClick(number) && processOnServer)
16770   this.SendPostBack('BC:' + number);
16771 },
16772 GetLastSuccesfullValue: function() {
16773  return this.lastChangedValue;
16774 },
16775 OnClear: function() {
16776  this.startUserInputEventTimerIfRequired();
16777  this.ClearEditorValueAndForceOnChange();
16778  this.ForceRefocusEditor(null, true);
16779  window.setTimeout(this.EnsureClearButtonVisibility.aspxBind(this), 0);
16780 },
16781 ClearEditorValueAndForceOnChange: function() {
16782  if(this.GetReadOnly() || !this.GetButtonVisible(CLEAR_BUTTON_INDEX))
16783   return;
16784  var raiseOnChange = this.ClearEditorValueByClearButton();
16785  if(raiseOnChange)
16786   this.ForceStandardOnChange();
16787 },
16788 ClearEditorValueByClearButton: function() {
16789  var prevValue = this.GetLastSuccesfullValue();
16790  this.ClearEditorValueByClearButtonCore();
16791  return prevValue !== this.GetValue();
16792 },
16793 ClearEditorValueByClearButtonCore: function() {
16794  this.Clear();
16795  this.GetInputElement().value = '';
16796 },
16797 ForceStandardOnChange: function() {
16798  this.forceValueChanged = true;
16799  this.RaiseStandardOnChange();
16800  this.forceValueChanged = false;
16801 },
16802 IsValueChangeForced: function() {
16803  return this.forceValueChanged || ASPxClientTextBoxBase.prototype.IsValueChangeForced.call(this);
16804 },
16805 IsValueChanging: function() { return this.isValueChanging; },
16806 StartValueChanging: function() { this.isValueChanging = true; },
16807 EndValueChanging: function() { this.isValueChanging = false; },
16808 IsClearButtonElement: function(element) {
16809  return ASPx.GetIsParent(this.GetClearButton(), element);
16810 },
16811 OnFocusCore: function() {
16812  if(this.accessibilityCompliant) {
16813   if(this.focused) 
16814    this.UnlockFocusEvents();   
16815   else 
16816    ASPxClientTextBoxBase.prototype.OnFocusCore.call(this);
16817  }
16818  else
16819   ASPxClientTextBoxBase.prototype.OnFocusCore.call(this);
16820  this.EnsureClearButtonVisibility();
16821 },
16822 OnLostFocusCore: function() {
16823  ASPxClientTextBoxBase.prototype.OnLostFocusCore.call(this);
16824  this.EnsureClearButtonVisibility();
16825  this.recoverClearButtonVisibility = false;
16826 },
16827 GetClearButton: function() {
16828  return this.GetButton(CLEAR_BUTTON_INDEX);
16829 },
16830 HasClearButton: function() {
16831  return !!this.GetClearButton();
16832 },
16833 RequireShowClearButton: function() {
16834  return !this.IsClearButtonDisabled() && !this.IsClearButtonNotRequired() && this.RequireShowClearButtonInternal();
16835 },
16836 IsClearButtonDisabled: function() {
16837  return !this.clientEnabled || !this.HasClearButton() || this.clearButtonDisplayMode === CLEAR_BUTTON_DISPLAY_MODE.NEVER;
16838 },
16839 IsClearButtonNotRequired: function() {
16840  return !this.IsFocused() && !this.isMouseOver && this.clearButtonDisplayMode !== CLEAR_BUTTON_DISPLAY_MODE.ALWAYS && !this.recoverClearButtonVisibility;
16841 },
16842 RequireShowClearButtonInternal: function () {
16843  return this.IsFocused() && this.RequireShowClearButtonCore() || !this.IsNullState();
16844 },
16845 RequireShowClearButtonCore: function() {
16846  var inputText = this.GetInputElement().value;
16847  return inputText !== this.GetEmptyValueDisplayText();
16848 },
16849 IsFocused: function() {
16850  return this === ASPx.GetFocusedEditor();
16851 },
16852 IsNullState: function() {
16853  var value = this.GetValue();
16854  return this.IsNull(value) || value === this.GetEmptyValueDisplayText();
16855 },
16856 GetEmptyValueDisplayText: function() { 
16857  return this.maskInfo ? this.emptyValueMaskDisplayText : "";
16858 },
16859 EnsureClearButtonVisibility: function() {
16860  this.SetButtonVisible(CLEAR_BUTTON_INDEX, this.RequireShowClearButton());
16861 },
16862 OnMouseOver: function() {
16863  this.isMouseOver = true;
16864  this.EnsureClearButtonVisibility();
16865 },
16866 OnMouseOut: function() {
16867  this.isMouseOver = false;
16868  this.EnsureClearButtonVisibility();
16869 },
16870 OnKeyPress: function(evt) {
16871  if(this.allowUserInput)
16872   ASPxClientTextBoxBase.prototype.OnKeyPress.call(this, evt);
16873 },
16874 OnKeyEventEnd: function(evt, withDelay) {
16875  ASPxClientTextBoxBase.prototype.OnKeyEventEnd.call(this, evt, withDelay);
16876  this.EnsureClearButtonVisibility();
16877 },
16878 RaiseButtonClick: function(number){
16879  var processOnServer = this.autoPostBack || this.IsServerEventAssigned("ButtonClick");
16880  if(!this.ButtonClick.IsEmpty()){
16881   var args = new ASPxClientButtonEditClickEventArgs(processOnServer, number);
16882   this.ButtonClick.FireEvent(this, args);
16883   processOnServer = args.processOnServer;
16884  }
16885  return processOnServer;
16886 },
16887 ChangeEnabledAttributes: function(enabled){
16888  ASPxClientTextEdit.prototype.ChangeEnabledAttributes.call(this, enabled);
16889  for(var i = 0; i < this.buttonCount; i++){
16890   var element = this.GetButton(i);
16891   if(element)
16892    this.ChangeButtonEnabledAttributes(element, this.GetChangeButtonEnabledAttributesMethod(enabled));
16893  }
16894  if(this.accessibilityCompliant)
16895   this.ChangeAccessibilityButtonEnabledAttributes(enabled);
16896 },
16897 ChangeEnabledStateItems: function(enabled){
16898  ASPxClientTextEdit.prototype.ChangeEnabledStateItems.call(this, enabled);
16899  for(var i = 0; i < this.buttonCount; i++){
16900   var element = this.GetButton(i);
16901   if(element) 
16902    ASPx.GetStateController().SetElementEnabled(element, enabled);
16903  }
16904 },
16905 GetChangeButtonEnabledAttributesMethod: function(enabled) {
16906  return ASPx.Attr.ChangeAttributesMethod(enabled);
16907 },
16908 ChangeButtonEnabledAttributes: function(element, method){
16909  method(element, "onclick");
16910  method(element, "ondblclick");
16911  if(ASPx.Browser.Edge)
16912   method(element, "onmousedown");
16913  method(element, "on" + ASPx.TouchUIHelper.touchMouseDownEventName);
16914  method(element, "on" + ASPx.TouchUIHelper.touchMouseUpEventName);
16915 },
16916 ChangeInputEnabled: function(element, enabled, readOnly) {
16917  ASPxClientTextEdit.prototype.ChangeInputEnabled.call(this, element, enabled, readOnly || !this.allowUserInput);
16918 },
16919 ChangeAccessibilityButtonEnabledAttributes: function(enabled) {
16920  var buttonElements = this.GetButtonCollection();
16921  for(var i = 0; i < buttonElements.length; i++)
16922   this.SetAccessibilityAnchorEnabled(buttonElements[i], enabled);
16923 },
16924 SetValue: function(value) {
16925  ASPxClientTextEdit.prototype.SetValue.call(this, value);
16926  if(!this.IsFocused())
16927   this.EnsureClearButtonVisibility();
16928 },
16929 OnAssociatedLabelClick: function(focusableElement) {
16930  var isValidElement = focusableElement && ASPx.IsActionElement(focusableElement) && ASPx.GetIsParent(this.GetMainElement(), focusableElement) && ASPx.IsElementVisible(focusableElement);
16931  if(isValidElement)
16932   focusableElement.focus();
16933  else
16934   this.SetFocus();
16935 },
16936 onClearButtonClick: function() {
16937  var requireFocus = !ASPx.Browser.VirtualKeyboardSupported || ASPx.Browser.MSTouchUI;
16938  if(this.ownerListBox)
16939   this.ownerListBox.ForceLockFocusEvents();
16940  if((requireFocus && !this.IsFocused()) || this.accessibilityCompliant)
16941   this.GetInputElement().focus();
16942  if(this.IsFocused() || !requireFocus) {
16943   if(this.ownerListBox)
16944    this.ownerListBox.UnlockFocusEvents();
16945   else if(this.accessibilityCompliant)
16946    this.UnlockFocusEvents();
16947   this.OnClear();
16948  }
16949  else
16950   window.setTimeout(this.onClearButtonClick.bind(this), 100);
16951 }
16952});
16953var ASPxClientButtonEdit = ASPx.CreateClass(ASPxClientButtonEditBase, {
16954});
16955ASPxClientButtonEdit.Cast = ASPxClientControl.Cast;
16956var ASPxClientButtonEditClickEventArgs = ASPx.CreateClass(ASPxClientProcessingModeEventArgs, {
16957 constructor: function(processOnServer, buttonIndex){
16958  this.constructor.prototype.constructor.call(this, processOnServer);
16959  this.buttonIndex = buttonIndex;
16960 }
16961});
16962var ASPxClientTextEditHelpTextHAlign = {
16963 Left: "Left",
16964 Right: "Right",
16965 Center: "Center"
16966};
16967var ASPxClientTextEditHelpTextVAlign = {
16968 Top: "Top",
16969 Bottom: "Bottom",
16970 Middle: "Middle"
16971};
16972var ASPxClientTextEditHelpTextDisplayMode = {
16973 Inline: "Inline",
16974 Popup: "Popup"
16975};
16976var ASPxClientTextEditHelpTextConsts = {
16977 VERTICAL_ORIENTATION_CLASS_NAME: "dxeVHelpTextSys",
16978 HORIZONTAL_ORIENTATION_CLASS_NAME: "dxeHHelpTextSys"
16979};
16980var ASPxClientTextEditHelpText = ASPx.CreateClass(null, {
16981 constructor: function (editor, helpTextStyle, helpText, position, hAlign, vAlign, margins, animationEnabled, helpTextDisplayMode) {
16982  this.hAlign = hAlign;
16983  this.vAlign = vAlign;
16984  this.animationEnabled = animationEnabled;
16985  this.displayMode = helpTextDisplayMode;
16986  this.editor = editor;
16987  this.editorMainElement = editor.GetMainElement();
16988  this.margins = margins ? { Top: margins[0], Right: margins[1], Bottom: margins[2], Left: margins[3] } : null;
16989  this.defaultMargins = { Top: 10, Right: 10, Bottom: 10, Left: 10 };
16990  this.position = position;
16991  this.helpTextElement = this.createHelpTextElement();
16992  this.setHelpTextZIndex(true);
16993  this.prepareHelpTextElement(helpTextStyle, helpText);
16994 },
16995 getRows: function (table) {
16996  return ASPx.GetChildNodesByTagName(table, "TR");
16997 },
16998 getCells: function (row) {
16999  return ASPx.GetChildNodesByTagName(row, "TD");
17000 },
17001 getCellByIndex: function(row, cellIndex) {
17002  return this.getCells(row)[cellIndex];
17003 },
17004 getCellIndex: function(row, cell) {
17005  var cells = this.getCells(row);
17006  for(var i = 0; i < cells.length; i++) {
17007   if(cells[i] === cell)
17008    return i;
17009  }
17010 },
17011 isHorizontal: function(position) {
17012  return position === ASPx.Position.Left || position === ASPx.Position.Right;
17013 },
17014 isVertical: function (position) {
17015  return position === ASPx.Position.Top || position === ASPx.Position.Bottom;
17016 },
17017 createEmptyCell: function(assignClassName) {
17018  var cell = document.createElement("TD");
17019  if(assignClassName)
17020   cell.className = "dxeFakeEmptyCell";
17021  return cell;
17022 },
17023 addHelpTextCellToExternalTableWithTwoCells: function (captionCell, errorCell, helpTextCell, errorTableBody, tableRows) {
17024  var captionPosition = this.editor.captionPosition;
17025  var errorCellPosition = this.editor.errorCellPosition;
17026  var helpTextRow = this.isVertical(this.position) ? document.createElement("TR") : null;
17027  if(captionPosition === ASPx.Position.Left && this.position === ASPx.Position.Left && this.isHorizontal(errorCellPosition))
17028   captionCell.parentNode.insertBefore(helpTextCell, captionCell.nextSibling);
17029  if(captionPosition === ASPx.Position.Right && this.position === ASPx.Position.Right && this.isHorizontal(errorCellPosition))
17030   captionCell.parentNode.insertBefore(helpTextCell, captionCell);
17031  if(captionPosition === ASPx.Position.Left && this.position === ASPx.Position.Right && this.isHorizontal(errorCellPosition))
17032   tableRows[0].appendChild(helpTextCell);
17033  if(captionPosition === ASPx.Position.Right && this.position === ASPx.Position.Left && this.isHorizontal(errorCellPosition))
17034   tableRows[0].insertBefore(helpTextCell, tableRows[0].childNodes[0]);
17035  if(captionPosition === ASPx.Position.Top && this.position === ASPx.Position.Bottom && this.isVertical(errorCellPosition)) {
17036   helpTextRow.appendChild(helpTextCell);
17037   errorTableBody.appendChild(helpTextRow);
17038  }
17039  if(captionPosition === ASPx.Position.Bottom && this.position === ASPx.Position.Top && this.isVertical(errorCellPosition)) {
17040   helpTextRow.appendChild(helpTextCell);
17041   errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
17042  }
17043  if(captionPosition === ASPx.Position.Top && this.position === ASPx.Position.Top && this.isVertical(errorCellPosition)) {
17044   helpTextRow.appendChild(helpTextCell);
17045   errorTableBody.insertBefore(helpTextRow, captionCell.parentNode.nextSibling);
17046  }
17047  if(captionPosition === ASPx.Position.Bottom && this.position === ASPx.Position.Bottom && this.isVertical(errorCellPosition)) {
17048   helpTextRow.appendChild(helpTextCell);
17049   errorTableBody.insertBefore(helpTextRow, captionCell.parentNode);
17050  }
17051  if(captionPosition === ASPx.Position.Right && this.position === ASPx.Position.Top && this.isVertical(errorCellPosition)) {
17052   helpTextRow.appendChild(helpTextCell);
17053   helpTextRow.appendChild(this.createEmptyCell());
17054   errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
17055  }
17056  if(this.position === ASPx.Position.Bottom) {
17057   if(captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Top || captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Right) {
17058    helpTextRow.appendChild(helpTextCell);
17059    helpTextRow.appendChild(this.createEmptyCell());
17060    errorTableBody.appendChild(helpTextRow);
17061   }
17062  }
17063  if(captionPosition === ASPx.Position.Left && this.position === ASPx.Position.Top && this.isVertical(errorCellPosition)) {
17064   helpTextRow.appendChild(this.createEmptyCell());
17065   helpTextRow.appendChild(helpTextCell);
17066   errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
17067  }
17068  if(captionPosition === ASPx.Position.Left && this.position === ASPx.Position.Bottom && this.isVertical(errorCellPosition)) {
17069   helpTextRow.appendChild(this.createEmptyCell());
17070   helpTextRow.appendChild(helpTextCell);
17071   errorTableBody.appendChild(helpTextRow);
17072  }
17073  if(this.position === ASPx.Position.Right) {
17074   if(captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Left || captionPosition === ASPx.Position.Left && errorCellPosition === ASPx.Position.Top
17075    || captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Right) {
17076    tableRows[1].appendChild(helpTextCell);
17077    tableRows[0].appendChild(this.createEmptyCell());
17078   }
17079   if(captionPosition === ASPx.Position.Left && errorCellPosition === ASPx.Position.Bottom || captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Left) {
17080    tableRows[0].appendChild(helpTextCell);
17081    tableRows[1].appendChild(this.createEmptyCell());
17082   }
17083  }
17084  if(this.position === ASPx.Position.Left) {
17085   if(captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Top || captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Right
17086    || captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Left) {
17087    tableRows[1].insertBefore(helpTextCell, tableRows[1].childNodes[0]);
17088    tableRows[0].insertBefore(this.createEmptyCell(), tableRows[0].childNodes[0]);
17089   }
17090   if(captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Top || captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Bottom) {
17091    tableRows[1].insertBefore(helpTextCell, tableRows[1].childNodes[0]);
17092    tableRows[0].insertBefore(this.createEmptyCell(errorCellPosition === ASPx.Position.Top), tableRows[0].childNodes[0]);
17093    tableRows[2].insertBefore(this.createEmptyCell(errorCellPosition !== ASPx.Position.Top), tableRows[2].childNodes[0]);
17094   }
17095   if(captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Top) {
17096    tableRows[2].insertBefore(helpTextCell, tableRows[2].childNodes[0]);
17097    tableRows[0].insertBefore(this.createEmptyCell(false), tableRows[0].childNodes[0]);
17098    tableRows[1].insertBefore(this.createEmptyCell(true), tableRows[1].childNodes[0]);
17099   }
17100   if(captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Bottom) {
17101    tableRows[0].insertBefore(helpTextCell, tableRows[0].childNodes[0]);
17102    tableRows[1].insertBefore(this.createEmptyCell(true), tableRows[1].childNodes[0]);
17103    tableRows[2].insertBefore(this.createEmptyCell(false), tableRows[2].childNodes[0]);
17104   }
17105   if(captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Left || captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Bottom
17106    || captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Right) {
17107    tableRows[0].insertBefore(helpTextCell, tableRows[0].childNodes[0]);
17108    tableRows[1].insertBefore(this.createEmptyCell(), tableRows[1].childNodes[0]);
17109   }
17110   if(captionPosition === ASPx.Position.Left && this.isVertical(errorCellPosition)) {
17111    captionCell.parentNode.insertBefore(helpTextCell, captionCell.nextSibling);
17112    var emptyCellParentRow = errorCellPosition === ASPx.Position.Top ? tableRows[0] : tableRows[1];
17113    var helpTextCellIndex = this.getCellIndex(helpTextCell.parentNode, helpTextCell);
17114    emptyCellParentRow.insertBefore(this.createEmptyCell(), this.getCellByIndex(emptyCellParentRow, helpTextCellIndex));
17115   }
17116  }
17117  if(this.position === ASPx.Position.Right) {
17118   if(captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Top || captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Bottom) {
17119    tableRows[1].appendChild(helpTextCell);
17120    tableRows[0].appendChild(this.createEmptyCell(errorCellPosition === ASPx.Position.Top));
17121    tableRows[2].appendChild(this.createEmptyCell(errorCellPosition !== ASPx.Position.Top));
17122   }
17123   if(captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Top) {
17124    tableRows[2].appendChild(helpTextCell);
17125    tableRows[0].appendChild(this.createEmptyCell(false));
17126    tableRows[1].appendChild(this.createEmptyCell(true));
17127   }
17128   if(captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Bottom) {
17129    tableRows[0].appendChild(helpTextCell);
17130    tableRows[1].appendChild(this.createEmptyCell(true));
17131    tableRows[2].appendChild(this.createEmptyCell(false));
17132   }
17133   if(captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Right) {
17134    tableRows[0].appendChild(helpTextCell);
17135    tableRows[1].appendChild(this.createEmptyCell());
17136   }
17137   if(captionPosition === ASPx.Position.Right && this.isVertical(errorCellPosition)) {
17138    captionCell.parentNode.insertBefore(helpTextCell, captionCell);
17139    var emptyCellParentRow = errorCellPosition === ASPx.Position.Top ? tableRows[0] : tableRows[1];
17140    var helpTextCellIndex = this.getCellIndex(helpTextCell.parentNode, helpTextCell);
17141    emptyCellParentRow.insertBefore(this.createEmptyCell(), this.getCellByIndex(emptyCellParentRow, helpTextCellIndex));
17142   }
17143  }
17144  if(captionPosition === ASPx.Position.Top && this.position === ASPx.Position.Top && this.isHorizontal(errorCellPosition)) {
17145   if(errorCellPosition === ASPx.Position.Left) {
17146    helpTextRow.appendChild(this.createEmptyCell(true));
17147    helpTextRow.appendChild(helpTextCell);
17148   }
17149   else {
17150    helpTextRow.appendChild(helpTextCell);
17151    helpTextRow.appendChild(this.createEmptyCell());
17152   }
17153   errorTableBody.insertBefore(helpTextRow, captionCell.parentNode.nextSibling);
17154  }
17155  if(captionPosition === ASPx.Position.Bottom && this.position === ASPx.Position.Top && this.isHorizontal(errorCellPosition)) {
17156   if(errorCellPosition === ASPx.Position.Left) {
17157    helpTextRow.appendChild(this.createEmptyCell(true));
17158    helpTextRow.appendChild(helpTextCell);
17159   }
17160   else {
17161    helpTextRow.appendChild(helpTextCell);
17162    helpTextRow.appendChild(this.createEmptyCell());
17163   }
17164   errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
17165  }
17166  if(captionPosition === ASPx.Position.Bottom && this.position === ASPx.Position.Bottom && this.isHorizontal(errorCellPosition)) {
17167   if(errorCellPosition === ASPx.Position.Left) {
17168    helpTextRow.appendChild(this.createEmptyCell(true));
17169    helpTextRow.appendChild(helpTextCell);
17170   }
17171   else {
17172    helpTextRow.appendChild(helpTextCell);
17173    helpTextRow.appendChild(this.createEmptyCell());
17174   }
17175   errorTableBody.insertBefore(helpTextRow, captionCell.parentNode);
17176  }
17177  if(captionPosition === ASPx.Position.Top && this.position === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Left) {
17178   helpTextRow.appendChild(this.createEmptyCell(true));
17179   helpTextRow.appendChild(helpTextCell);
17180   errorTableBody.appendChild(helpTextRow);
17181  }
17182  if(captionPosition === ASPx.Position.Right && this.position === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Bottom) {
17183   helpTextRow.appendChild(helpTextCell);
17184   helpTextRow.appendChild(this.createEmptyCell());
17185   errorTableBody.appendChild(helpTextRow);
17186  }
17187  if(this.position === ASPx.Position.Bottom) {
17188   if(captionPosition === ASPx.Position.Left && errorCellPosition === ASPx.Position.Right || captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Left) {
17189    helpTextRow.appendChild(this.createEmptyCell(errorCellPosition !== ASPx.Position.Right));
17190    helpTextRow.appendChild(helpTextCell);
17191    helpTextRow.appendChild(this.createEmptyCell(errorCellPosition === ASPx.Position.Right));
17192    errorTableBody.appendChild(helpTextRow);
17193   }
17194   if(captionPosition === ASPx.Position.Left && errorCellPosition === ASPx.Position.Left) {
17195    helpTextRow.appendChild(this.createEmptyCell(false));
17196    helpTextRow.appendChild(this.createEmptyCell(true));
17197    helpTextRow.appendChild(helpTextCell);
17198    errorTableBody.appendChild(helpTextRow);
17199   }
17200   if(captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Right) {
17201    helpTextRow.appendChild(helpTextCell);
17202    helpTextRow.appendChild(this.createEmptyCell(true));
17203    helpTextRow.appendChild(this.createEmptyCell(false));
17204    errorTableBody.appendChild(helpTextRow);
17205   }   
17206  }
17207  if(this.position === ASPx.Position.Top) {
17208   if(captionPosition === ASPx.Position.Left && errorCellPosition === ASPx.Position.Right || captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Left) {
17209    helpTextRow.appendChild(this.createEmptyCell(errorCellPosition !== ASPx.Position.Right));
17210    helpTextRow.appendChild(helpTextCell);
17211    helpTextRow.appendChild(this.createEmptyCell(errorCellPosition === ASPx.Position.Right));
17212    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
17213   }
17214   if(captionPosition === ASPx.Position.Left && errorCellPosition === ASPx.Position.Left) {
17215    helpTextRow.appendChild(this.createEmptyCell(false));
17216    helpTextRow.appendChild(this.createEmptyCell(true));
17217    helpTextRow.appendChild(helpTextCell);
17218    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
17219   }
17220   if(captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Right) {
17221    helpTextRow.appendChild(helpTextCell);
17222    helpTextRow.appendChild(this.createEmptyCell(true));
17223    helpTextRow.appendChild(this.createEmptyCell(false));
17224    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
17225   }
17226  }
17227 },
17228 addHelpTextCellToExternalTableWithErrorCell
17228: function (errorCell, helpTextCell, errorTableBody, tableRows) {
17229  var errorCellPosition = this.editor.errorCellPosition;
17230  var helpTextRow = document.createElement("TR");
17231  if(this.position === ASPx.Position.Left && this.isHorizontal(errorCellPosition))
17232   tableRows[0].insertBefore(helpTextCell, tableRows[0].childNodes[0]);
17233  if(this.position === ASPx.Position.Right && this.isHorizontal(errorCellPosition))
17234   tableRows[0].appendChild(helpTextCell);
17235  if(this.position === ASPx.Position.Top && this.isVertical(errorCellPosition)) {
17236   helpTextRow.appendChild(helpTextCell);
17237   errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
17238  }
17239  if(this.position === ASPx.Position.Bottom && this.isVertical(errorCellPosition)) {
17240   helpTextRow.appendChild(helpTextCell);
17241   errorTableBody.appendChild(helpTextRow);
17242  }
17243  if(errorCellPosition === ASPx.Position.Left && this.isVertical(this.position)) {
17244   helpTextRow.appendChild(this.createEmptyCell(true));
17245   helpTextRow.appendChild(helpTextCell);
17246   if(this.position === ASPx.Position.Top)
17247    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
17248   else
17249    errorTableBody.appendChild(helpTextRow);
17250  }
17251  if(errorCellPosition === ASPx.Position.Right && this.isVertical(this.position)) {
17252   helpTextRow.appendChild(helpTextCell);
17253   helpTextRow.appendChild(this.createEmptyCell(true));
17254   if(this.position === ASPx.Position.Top)
17255    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
17256   else
17257    errorTableBody.appendChild(helpTextRow);
17258  }
17259  if(this.position === ASPx.Position.Left && this.isVertical(errorCellPosition)) {
17260   var helpTextParentRowIndex = errorCellPosition === ASPx.Position.Top ? 1 : 0;
17261   var emptyCellRowIndex = helpTextParentRowIndex === 0 ? 1 : 0;
17262   tableRows[helpTextParentRowIndex].insertBefore(helpTextCell, tableRows[helpTextParentRowIndex].childNodes[0]);
17263   tableRows[emptyCellRowIndex].insertBefore(this.createEmptyCell(true), tableRows[emptyCellRowIndex].childNodes[0]);
17264  }
17265  if(this.position === ASPx.Position.Right && this.isVertical(errorCellPosition)) {
17266   var helpTextParentRowIndex = errorCellPosition === ASPx.Position.Top ? 1 : 0;
17267   var emptyCellRowIndex = helpTextParentRowIndex === 0 ? 1 : 0;
17268   tableRows[helpTextParentRowIndex].appendChild(helpTextCell);
17269   tableRows[emptyCellRowIndex].appendChild(this.createEmptyCell(true));
17270  }
17271 },
17272 addHelpTextCellToExternalTableWithCaption: function (captionCell, helpTextCell, errorTableBody, tableRows) {
17273  var captionPosition = this.editor.captionPosition;
17274  var helpTextRow = document.createElement("TR");
17275  if(captionPosition === ASPx.Position.Left && this.isVertical(this.position)) {
17276   helpTextRow.appendChild(this.createEmptyCell());
17277   helpTextRow.appendChild(helpTextCell);
17278   if(this.position === ASPx.Position.Top)
17279    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
17280   else
17281    errorTableBody.appendChild(helpTextRow);
17282  }
17283  if(this.position === ASPx.Position.Left && this.isVertical(captionPosition)) {
17284   var helpTextParentRowIndex = captionPosition === ASPx.Position.Top ? 1 : 0;
17285   var emptyCellParentRowIndex = helpTextParentRowIndex === 0 ? 1 : 0;
17286   tableRows[helpTextParentRowIndex].insertBefore(helpTextCell, tableRows[helpTextParentRowIndex].childNodes[0]);
17287   tableRows[emptyCellParentRowIndex].insertBefore(this.createEmptyCell(), tableRows[emptyCellParentRowIndex].childNodes[0]);
17288  }
17289  if(this.position === ASPx.Position.Right && this.isVertical(captionPosition)) {
17290   var helpTextParentRowIndex = captionPosition === ASPx.Position.Top ? 1 : 0;
17291   var emptyCellParentRowIndex = helpTextParentRowIndex === 0 ? 1 : 0;
17292   tableRows[helpTextParentRowIndex].appendChild(helpTextCell);
17293   tableRows[emptyCellParentRowIndex].appendChild(this.createEmptyCell());
17294  }
17295  if(captionPosition === ASPx.Position.Right && this.isVertical(this.position)) {
17296   helpTextRow.appendChild(helpTextCell);
17297   helpTextRow.appendChild(this.createEmptyCell());
17298   if(this.position === ASPx.Position.Top)
17299    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
17300   else
17301    errorTableBody.appendChild(helpTextRow);
17302  }
17303  if(this.isVertical(captionPosition) && this.isVertical(this.position)) {
17304   helpTextRow.appendChild(helpTextCell);
17305   if(captionPosition === ASPx.Position.Top && this.position === ASPx.Position.Top)
17306    errorTableBody.insertBefore(helpTextRow, captionCell.parentNode.nextSibling);
17307   if(captionPosition === ASPx.Position.Top && this.position === ASPx.Position.Bottom)
17308    errorTableBody.appendChild(helpTextRow);
17309   if(captionPosition === ASPx.Position.Bottom && this.position === ASPx.Position.Top)
17310    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
17311   if(captionPosition === ASPx.Position.Bottom && this.position === ASPx.Position.Bottom)
17312    errorTableBody.insertBefore(helpTextRow, captionCell.parentNode);
17313  }
17314  if(captionPosition === ASPx.Position.Left && this.position === ASPx.Position.Left)
17315   captionCell.parentNode.insertBefore(helpTextCell, captionCell.nextSibling);
17316  if(captionPosition === ASPx.Position.Right && this.position === ASPx.Position.Right)
17317   captionCell.parentNode.insertBefore(helpTextCell, captionCell);
17318  if(captionPosition === ASPx.Position.Left && this.position === ASPx.Position.Right)
17319   tableRows[0].appendChild(helpTextCell);
17320  if(captionPosition === ASPx.Position.Right && this.position === ASPx.Position.Left)
17321   tableRows[0].insertBefore(helpTextCell, tableRows[0].childNodes[0]);
17322 },
17323 addHelpTextCellToExternalTableWithEditorOnly: function (helpTextCell, errorTableBody, tableRows) {
17324  if(this.isHorizontal(this.position)) {
17325   if(this.position === ASPx.Position.Left)
17326    tableRows[0].insertBefore(helpTextCell, tableRows[0].childNodes[0]);
17327   else
17328    tableRows[0].appendChild(helpTextCell);
17329  }
17330  else {
17331   var helpTextRow = document.createElement("TR");
17332   helpTextRow.appendChild(helpTextCell);
17333   if(this.position === ASPx.Position.Top)
17334    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
17335   else
17336    errorTableBody.appendChild(helpTextRow);
17337  }
17338 },
17339 addHelpTextCellToExternalTable: function (errorTable, helpTextCell) {
17340  var errorTableBody = ASPx.GetNodeByTagName(errorTable, "TBODY", 0);
17341  var tableRows = this.getRows(errorTableBody);
17342  var captionCell = this.editor.GetCaptionCell();
17343  var errorCell = this.editor.GetErrorCell();
17344  if(captionCell) {
17345   if(errorCell)
17346    this.addHelpTextCellToExternalTableWithTwoCells(captionCell, errorCell, helpTextCell, errorTableBody, tableRows);
17347   else
17348    this.addHelpTextCellToExternalTableWithCaption(captionCell, helpTextCell, errorTableBody, tableRows);
17349  }
17350  else if(errorCell)
17351   this.addHelpTextCellToExternalTableWithErrorCell(errorCell, helpTextCell, errorTableBody, tableRows);
17352  else
17353   this.addHelpTextCellToExternalTableWithEditorOnly(helpTextCell, errorTableBody, tableRows);
17354 },
17355 createExternalTable: function () {
17356  var externalTable = document.createElement("TABLE");
17357  externalTable.id = this.editor.name + ASPx.EditElementSuffix.ExternalTable;
17358  externalTable.cellPadding = 0;
17359  externalTable.cellSpacing = 0;
17360  this.applyExternalTableStyle(externalTable);
17361  var editorWidth = this.editorMainElement.style.width;
17362  if(ASPx.IsPercentageSize(editorWidth)) {
17363   externalTable.style.width = editorWidth;
17364   this.editorMainElement.style.width = "100%";
17365   this.editor.width = "100%";
17366  }
17367  var externalTableBody = document.createElement("TBODY");
17368  var externalTableRow = document.createElement("TR");
17369  var externalTableCell = document.createElement("TD");
17370  externalTable.appendChild(externalTableBody);
17371  externalTableBody.appendChild(externalTableRow);
17372  externalTableRow.appendChild(externalTableCell);
17373  this.editorMainElement.parentNode.appendChild(externalTable);
17374  ASPx.ChangeElementContainer(this.editorMainElement, externalTableCell, true);
17375  if(this.editor.accessibilityCompliant)
17376   ASPx.Attr.SetAttribute(externalTable, "role", "presentation");
17377  return externalTable;
17378 },
17379 applyExternalTableStyle: function (externalTable) {
17380  var externalTableStyle = this.editor.externalTableStyle;
17381  if(externalTableStyle.length > 0) {
17382   this.applyStyleToElement(externalTable, externalTableStyle);
17383  }
17384 },
17385 applyStyleToElement: function(element, style) {
17386  element.className = style[0];
17387  if(style[1]) {
17388   var styleSheet = ASPx.GetCurrentStyleSheet();
17389   element.className += " " + ASPx.CreateImportantStyleRule(styleSheet, style[1]);
17390  }
17391 },
17392 createInlineHelpTextElement: function () {
17393  var helpTextElement = document.createElement("TD");
17394  var externalTable = this.editor.GetExternalTable();
17395  if(!externalTable)
17396   externalTable = this.createExternalTable();
17397  this.addHelpTextCellToExternalTable(externalTable, helpTextElement);
17398  return helpTextElement;
17399 },
17400 createPopupHelpTextElement: function () {
17401  var helpTextElement = document.createElement("DIV");
17402  ASPx.InsertElementAfter(helpTextElement, this.editor.GetMainElement());
17403  ASPx.AnimationHelper.setOpacity(helpTextElement, 0);
17404  ASPx.SetElementDisplay(helpTextElement, false);
17405  return helpTextElement;
17406 },
17407 createHelpTextElement: function () {
17408  return this.displayMode === ASPxClientTextEditHelpTextDisplayMode.Popup ?
17409   this.createPopupHelpTextElement() : this.createInlineHelpTextElement();
17410 },
17411 prepareHelpTextElement: function (helpTextStyle, helpText) {
17412  this.helpTextElement.id = this.getHelpTextElementId();
17413  this.applyStyleToElement(this.helpTextElement, helpTextStyle);
17414  ASPx.SetInnerHtml(this.helpTextElement, "<SPAN>" + helpText + "</SPAN>");
17415  if(this.displayMode === ASPxClientTextEditHelpTextDisplayMode.Popup)
17416   this.updatePopupHelpTextPosition();
17417  else {
17418   var isVerticalOrientation = this.position === ASPx.Position.Top || this.position === ASPx.Position.Bottom;
17419   var orientationClassName = isVerticalOrientation ? ASPxClientTextEditHelpTextConsts.VERTICAL_ORIENTATION_CLASS_NAME :
17420    ASPxClientTextEditHelpTextConsts.HORIZONTAL_ORIENTATION_CLASS_NAME;
17421   this.helpTextElement.className += " " + orientationClassName;
17422   this.setInlineHelpTextElementAlign();
17423   ASPx.SetElementDisplay(this.helpTextElement, this.editor.clientVisible);
17424  }
17425 },
17426 getHelpTextElementId: function() {
17427  return this.editor.name + ASPx.TEHelpTextElementSuffix;
17428 },
17429 setInlineHelpTextElementAlign: function() {
17430  var hAlignValue = "", vAlignValue = "";
17431  switch(this.hAlign) {
17432   case ASPxClientTextEditHelpTextHAlign.Left: hAlignValue = "left"; break;
17433   case ASPxClientTextEditHelpTextHAlign.Right: hAlignValue = "right"; break;
17434   case ASPxClientTextEditHelpTextHAlign.Center: hAlignValue = "center"; break;
17435  }
17436  switch(this.vAlign) {
17437   case ASPxClientTextEditHelpTextVAlign.Top: vAlignValue = "top"; break;
17438   case ASPxClientTextEditHelpTextVAlign.Bottom: vAlignValue = "bottom"; break;
17439   case ASPxClientTextEditHelpTextVAlign.Middle: vAlignValue = "middle"; break;
17440  }
17441  this.helpTextElement.style.textAlign = hAlignValue;
17442  this.helpTextElement.style.verticalAlign = vAlignValue;
17443 },
17444 getHelpTextMargins: function() {
17445  if(this.margins)
17446   return this.margins;
17447  var result = this.defaultMargins;
17448  if(this.position === ASPx.Position.Top || this.position === ASPx.Position.Bottom)
17449   result.Left = result.Right = 0;
17450  else
17451   result.Top = result.Bottom = 0;
17452  return result;
17453 },
17454 updatePopupHelpTextPosition: function (editorMainElement) {
17455  var editorWidth = this.editorMainElement.offsetWidth;
17456  var editorHeight = this.editorMainElement.offsetHeight;
17457  var helpTextWidth = this.helpTextElement.offsetWidth;
17458  var helpTextHeight = this.helpTextElement.offsetHeight;
17459  var editorX = ASPx.GetAbsoluteX(this.editorMainElement);
17460  var editorY = ASPx.GetAbsoluteY(this.editorMainElement);
17461  var helpTextX = 0, helpTextY = 0;
17462  var margins = this.getHelpTextMargins();
17463  if(this.position === ASPx.Position.Top || this.position === ASPx.Position.Bottom) {
17464   if(this.position === ASPx.Position.Top)
17465    helpTextY = editorY - margins.Bottom - helpTextHeight;
17466   else if(this.position === ASPx.Position.Bottom)
17467    helpTextY = editorY + editorHeight + margins.Top;
17468   if(this.hAlign === ASPxClientTextEditHelpTextHAlign.Left)
17469    helpTextX = editorX + margins.Left;
17470   else if(this.hAlign === ASPxClientTextEditHelpTextHAlign.Right)
17471    helpTextX = editorX + editorWidth - helpTextWidth - margins.Right;
17472   else if(this.hAlign === ASPxClientTextEditHelpTextHAlign.Center) {
17473    var editorCenterX = editorX + editorWidth / 2;
17474    var helpTextWidthWithMargins = helpTextWidth + margins.Left + margins.Right;
17475    helpTextX = editorCenterX - helpTextWidthWithMargins / 2 + margins.Left;
17476   }
17477  } else {
17478   if(this.position === ASPx.Position.Left)
17479    helpTextX = editorX - margins.Right - helpTextWidth;
17480   else if(this.position === ASPx.Position.Right)
17481    helpTextX = editorX + editorWidth + margins.Left;
17482   if(this.vAlign === ASPxClientTextEditHelpTextVAlign.Top)
17483    helpTextY = editorY + margins.Top;
17484   else if(this.vAlign === ASPxClientTextEditHelpTextVAlign.Bottom)
17485    helpTextY = editorY + editorHeight - helpTextHeight - margins.Bottom;
17486   else if(this.vAlign === ASPxClientTextEditHelpTextVAlign.Middle) {
17487    var editorCenterY = editorY + editorHeight / 2;
17488    var helpTextHeightWithMargins = helpTextHeight + margins.Top + margins.Bottom;
17489    helpTextY = editorCenterY - helpTextHeightWithMargins / 2 + margins.Top;
17490   }
17491  }
17492  helpTextX = helpTextX < 0 ? 0 : helpTextX;
17493  helpTextY = helpTextY < 0 ? 0 : helpTextY;
17494  ASPx.SetAbsoluteX(this.helpTextElement, helpTextX);
17495  ASPx.SetAbsoluteY(this.helpTextElement, helpTextY);
17496 },
17497 setHelpTextZIndex: function (hide) { 
17498  var newZIndex = 41998 * (hide ? -1 : 1);
17499  if(this.helpTextElement.style.zIndex != newZIndex)
17500   this.helpTextElement.style.zIndex = newZIndex;
17501 },
17502 hide: function () {
17503  if(this.displayMode === ASPxClientTextEditHelpTextDisplayMode.Inline) {
17504   ASPx.SetElementDisplay(this.helpTextElement, false);
17505  }
17506  else
17507   this.hidePopupHelpText();
17508 },
17509 hidePopupHelpText: function() {
17510  var onHidePopupHelpTextComplete = function () {
17511   this.setHelpTextZIndex(true);
17512   ASPx.SetElementDisplay(this.helpTextElement, false);
17513  }.aspxBind(this);
17514  if(this.animationEnabled)
17515   ASPx.AnimationHelper.fadeOut(this.helpTextElement, onHidePopupHelpTextComplete);
17516  else {
17517   ASPx.AnimationHelper.setOpacity(this.helpTextElement, 0);
17518   onHidePopupHelpTextComplete();
17519  }    
17520 },
17521 show: function () {
17522  if(this.displayMode === ASPxClientTextEditHelpTextDisplayMode.Inline) {
17523   ASPx.SetElementDisplay(this.helpTextElement, true);
17524  }
17525  else
17526   this.showPopupHelpText();
17527 },
17528 showPopupHelpText: function () {
17529  ASPx.SetElementDisplay(this.helpTextElement, true);
17530  this.updatePopupHelpTextPosition();
17531  if(this.animationEnabled)
17532   ASPx.AnimationHelper.fadeIn(this.helpTextElement);
17533  else
17534   ASPx.AnimationHelper.setOpacity(this.helpTextElement, 1);
17535  this.setHelpTextZIndex(false);
17536 }
17537});
17538var ASPxOutOfRangeWarningManager = ASPx.CreateClass(null, {
17539 constructor: function (editor, minValue, maxValue, defaultMinValue, defaultMaxValue, outOfRangeWarningElementPosition, valueFormatter) {
17540  this.editor = editor;
17541  this.outOfRangeWarningElementPosition = outOfRangeWarningElementPosition;
17542  this.minValue = minValue;
17543  this.maxValue = maxValue;
17544  this.defaultMinValue = defaultMinValue;
17545  this.defaultMaxValue = defaultMaxValue;
17546  this.minMaxValueFormatter = valueFormatter;
17547  this.animationDuration = 150;
17548  this.CreateOutOfRangeWarningElement();
17549 },
17550 SetMinValue: function (minValue) {
17551  this.minValue = minValue;
17552  this.UpdateOutOfRangeWarningElementText();
17553 },
17554 SetMaxValue: function (maxValue) {
17555  this.maxValue = maxValue;
17556  this.UpdateOutOfRangeWarningElementText();
17557 },
17558 CreateOutOfRangeWarningElement: function () {
17559  this.outOfRangeWarningElement = document.createElement("DIV");
17560  this.outOfRangeWarningElement.id = this.editor.name + "OutOfRWarn";
17561  ASPx.InsertElementAfter(this.outOfRangeWarningElement, this.editor.GetOutOfRangeWarningElementPrevSibling());
17562  ASPx.AnimationHelper.setOpacity(this.outOfRangeWarningElement, 0);
17563  this.outOfRangeWarningElement.className = this.editor.outOfRangeWarningClassName;
17564  this.UpdateOutOfRangeWarningElementText();
17565 },
17566 IsValueInRange: function (value) {
17567  return (!this.IsMinValueExists() || value >= this.minValue)
17568   && (!this.IsMaxValueExists() || value <= this.maxValue);
17569 },
17570 IsMinValueExists: function() {
17571  return ASPx.IsExists(this.minValue) && !isNaN(this.minValue) && this.minValue !== this.defaultMinValue;
17572 },
17573 IsMaxValueExists: function () {
17574  return ASPx.IsExists(this.maxValue) && !isNaN(this.maxValue) && this.maxValue !== this.defaultMaxValue;
17575 },
17576 GetFormattedTextByValue: function(value) {
17577  if (this.minMaxValueFormatter)
17578   return this.minMaxValueFormatter.Format(value);
17579  return value;
17580 },
17581 GetWarningText: function() {
17582  var textTemplate = arguments[0];
17583  var valueTexts = [];
17584  for (var i = 1; i < arguments.length; i++) {
17585   var valueText = this.GetFormattedTextByValue(arguments[i]);
17586   valueTexts.push(valueText);
17587  }
17588  return ASPx.Formatter.Format(textTemplate, valueTexts);
17589 },
17590 UpdateOutOfRangeWarningElementText: function () {
17591  var text = "";
17592  if (this.IsMinValueExists() && this.IsMaxValueExists())
17593   text = this.GetWarningText(this.editor.outOfRangeWarningMessages[0], this.minValue, this.maxValue);
17594  if (this.IsMinValueExists() && !this.IsMaxValueExists())
17595   text = this.GetWarningText(this.editor.outOfRangeWarningMessages[1], this.minValue);
17596  if (!this.IsMinValueExists() && this.IsMaxValueExists())
17597   text = this.GetWarningText(this.editor.outOfRangeWarningMessages[2], this.maxValue);
17598  ASPx.SetInnerHtml(this.outOfRangeWarningElement, "<LABEL>" + text + "</LABEL>");
17599 },
17600 UpdateOutOfRangeWarningElementVisibility: function (currentValue) {
17601  var isValidValue = currentValue == null || this.IsValueInRange(currentValue);
17602  if (!isValidValue && !this.outOfRangeWarningElementShown)
17603   this.ShowOutOfRangeWarningElement();
17604  if (isValidValue && this.outOfRangeWarningElementShown)
17605   this.HideOutOfRangeWarningElement();
17606 },
17607 GetOutOfRangeWarningElementCoordinates: function() {
17608  var editorMainElement = this.editor.GetMainElement();
17609  var editorWidth = editorMainElement.offsetWidth;
17610  var editorHeight = editorMainElement.offsetHeight;
17611  var editorX = ASPx.GetAbsoluteX(editorMainElement);
17612  var editorY = ASPx.GetAbsoluteY(editorMainElement);
17613  var outOfRangeWarningElementX = this.outOfRangeWarningElementPosition === ASPx.Position.Right ? editorX + editorWidth : editorX;
17614  var outOfRangeWarningElementY = this.outOfRangeWarningElementPosition === ASPx.Position.Right ? editorY : editorY + editorHeight;
17615  outOfRangeWarningElementX = outOfRangeWarningElementX < 0 ? 0 : outOfRangeWarningElementX;
17616  outOfRangeWarningElementY = outOfRangeWarningElementY < 0 ? 0 : outOfRangeWarningElementY;
17617  return {
17618   x: outOfRangeWarningElementX,
17619   y: outOfRangeWarningElementY
17620  };
17621 },
17622 ShowOutOfRangeWarningElement: function () {
17623  this.outOfRangeWarningElement.style.display = "inline";
17624  var outOfRangeWarningElementCoordinates = this.GetOutOfRangeWarningElementCoordinates();
17625  ASPx.SetAbsoluteX(this.outOfRangeWarningElement, outOfRangeWarningElementCoordinates.x);
17626  ASPx.SetAbsoluteY(this.outOfRangeWarningElement, outOfRangeWarningElementCoordinates.y);
17627  ASPx.AnimationHelper.fadeIn(this.outOfRangeWarningElement, null, this.animationDuration);
17628  this.ScrollToWarningElementIfRequired(outOfRangeWarningElementCoordinates);
17629  this.outOfRangeWarningElementShown = true;
17630 },
17631 HideOutOfRangeWarningElement: function () {
17632  ASPx.AnimationHelper.fadeOut(this.outOfRangeWarningElement, function () {
17633   ASPx.SetElementDisplay(this.outOfRangeWarningElement, false);
17634  }.aspxBind(this), this.animationDuration);
17635  this.outOfRangeWarningElementShown = false;
17636 },
17637 ScrollToWarningElementIfRequired: function (outOfRangeWarningElementCoordinates) {
17638  if(this.outOfRangeWarningElementPosition === ASPx.Position.Right) {
17639   var warnElementRightPos = outOfRangeWarningElementCoordinates.x
17640    + ASPx.PxToInt(ASPx.GetCurrentStyle(this.outOfRangeWarningElement).marginLeft)
17641    + this.outOfRangeWarningElement.offsetWidth;
17642   if(warnElementRightPos > ASPx.GetDocumentClientWidth() + ASPx.GetDocumentScrollLeft())
17643    ASPx.SetDocumentScrollLeft(warnElementRightPos - ASPx.GetDocumentClientWidth());
17644  }
17645  if(this.outOfRangeWarningElementPosition === ASPx.Position.Bottom) {
17646   var warnElementBottomPos = outOfRangeWarningElementCoordinates.y
17647    + ASPx.PxToInt(ASPx.GetCurrentStyle(this.outOfRangeWarningElement).marginTop)
17648    + this.outOfRangeWarningElement.offsetHeight;
17649   if(warnElementBottomPos > ASPx.GetDocumentClientHeight() + ASPx.GetDocumentScrollTop())
17650    ASPx.SetDocumentScrollTop(warnElementBottomPos - ASPx.GetDocumentClientHeight());
17651  }
17652 }
17653});
17654ASPx.MMMouseOut = function(name, evt) {
17655 var edit = ASPx.GetControlCollection().Get(name);
17656 if(edit != null) edit.OnMouseOut(evt);
17657};
17658ASPx.MMMouseOver = function(name, evt) {
17659 var edit = ASPx.GetControlCollection().Get(name);
17660 if(edit != null) edit.OnMouseOver(evt);
17661};
17662ASPx.MaskHintTimerProc = function() {
17663 var focusedEditor = ASPx.GetFocusedEditor();
17664 if(focusedEditor != null && ASPx.IsFunction(focusedEditor.MaskHintTimerProc))
17665  focusedEditor.MaskHintTimerProc();
17666};
17667ASPx.ETextChanged = function(name) {
17668 var edit = ASPx.GetControlCollection().Get(name);
17669 if(edit != null) edit.OnTextChanged(); 
17670};
17671ASPx.BEClick = function(name,number){
17672 var edit = ASPx.GetControlCollection().Get(name);
17673 if(edit != null) edit.OnButtonClick(number);
17674};
17675ASPx.BEClear = function(name, evt) {
17676 var edit = ASPx.GetControlCollection().Get(name);
17677 if(edit && (evt.button === 0 || ASPx.Browser.TouchUI))
17678  edit.onClearButtonClick();
17679};
17680ASPx.SetFocusToTextEditWithDelay = function(name) {
17681 window.setTimeout(function() {
17682  var edit = ASPx.GetControlCollection().Get(name);
17683  if(edit)
17684   edit.SetFocus();
17685 }, 500);
17686};
17687window.ASPxClientTextEdit = ASPxClientTextEdit;
17688window.ASPxClientTextBoxBase = ASPxClientTextBoxBase;
17689window.ASPxClientTextBox = ASPxClientTextBox;
17690window.ASPxClientMemo = ASPxClientMemo;
17691window.ASPxClientButtonEditBase = ASPxClientButtonEditBase;
17692window.ASPxClientButtonEdit = ASPxClientButtonEdit;
17693window.ASPxClientButtonEditClickEventArgs = ASPxClientButtonEditClickEventArgs;
17694})();
17695
17696(function() {
17697var DateFormatter = ASPx.CreateClass(null, {
17698 constructor: function() {
17699  this.date = new Date(2000, 0, 1);
17700  this.mask = "";
17701  this.specifiers = {};     
17702  this.spPositions = [];    
17703  this.parserKeys = [];
17704  this.knownSpecifiers = ["d", "M", "y", "H", "h", "m", "s", "f", "F", "g", "t"];
17705  this.savedYear = -1;
17706  this.isYearParsed = false;
17707  this.parsedMonth = -1;
17708  this.replacers = {
17709   "d": this.ReplaceDay,
17710   "M": this.ReplaceMonth,
17711   "y": this.ReplaceYear,
17712   "H": this.ReplaceHours23,
17713   "h": this.ReplaceHours12,
17714   "m": this.ReplaceMinutes,
17715   "s": this.ReplaceSeconds,
17716   "F": this.ReplaceMsTrimmed,
17717   "f": this.ReplaceMs,
17718   "g": this.ReplaceEra,
17719   "t": this.ReplaceAmPm
17720  };
17721  this.parsers = {
17722   "d": this.ParseDay,
17723   "M": this.ParseMonth,
17724   "y": this.ParseYear,
17725   "H": this.ParseHours,
17726   "h": this.ParseHours,
17727   "m": this.ParseMinutes,
17728   "s": this.ParseSeconds,
17729   "F": this.ParseMs,
17730   "f": this.ParseMs,
17731   "g": this.ParseEra,
17732   "t": this.ParseAmPm
17733  };
17734 },
17735 Format: function(date) {
17736  this.date = date;
17737  var sp;
17738  var pos;
17739  var replacerKey;
17740  var result = this.mask;
17741  for(var i = 0; i < this.spPositions.length; i++) {
17742   pos = this.spPositions[i];
17743   sp = this.specifiers[pos];
17744   replacerKey = sp.substr(0, 1);
17745   if(this.replacers[replacerKey]) {
17746    result = result.substr(0, pos) + this.replacers[replacerKey].call(this, sp.length) + result.substr(pos + sp.length);
17747   }
17748  }
17749  return result;
17750 }, 
17751 Parse: function(str, rememberParserKeys, spPositionsParam, specifiersParam) {
17752  var spPositions = !!spPositionsParam ? spPositionsParam : this.spPositions;
17753  var specifiers = !!specifiersParam ? specifiersParam : this.specifiers;
17754  var now = new Date();  
17755  this.savedYear = now.getFullYear();
17756  this.isYearParsed = false;
17757  this.parsedMonth = -1;
17758  this.date = new Date(2000, 0, now.getDate());    
17759  this.strToParse = str;
17760  this.catchNumbers(str, specifiers);
17761  var parserKey;
17762  var sp;
17763  var pos;
17764  var parseResult;
17765  var error = false;
17766  this.hasAmPm = false;
17767  for(var i = 0; i < spPositions.length; i++) {
17768   pos = spPositions[i];
17769   sp = specifiers[pos];
17770   parserKey = sp.substr(0, 1);
17771   if(this.parsers[parserKey]) {
17772    if(rememberParserKeys)
17773     this.parserKeys.push(parserKey);
17774    parseResult = this.parsers[parserKey].call(this, sp.length);
17775    if(!parseResult) {
17776     error = true;
17777     break;
17778    }
17779   }
17780  }
17781  if(error)
17782   return false;
17783  if(this.hasAmPm) {
17784   if(!this.fixHours())
17785    return false;
17786  }
17787  if(!this.isYearParsed)
17788   this.date.setYear(this.savedYear);
17789  if(this.parsedMonth < 0)
17790   this.parsedMonth = now.getMonth();   
17791  this.ApplyMonth();
17792  return this.date;  
17793 },
17794 ParseAndMergeWithDate: function(str, sourceDate) {
17795  this.parserKeys = [];
17796  var date = this.Parse(str, true);
17797  if(date && sourceDate)
17798   date = new Date(
17799        this.HasYear() ? date.getFullYear() : sourceDate.getFullYear(),
17800        this.HasMonth() ? date.getMonth() : sourceDate.getMonth(),
17801        this.HasDay() ? date.getDate() : sourceDate.getDate(),
17802        this.HasHours() ? date.getHours() : sourceDate.getHours(),
17803        this.HasMinutes() ? date.getMinutes() : sourceDate.getMinutes(),
17804        this.HasSeconds() ? date.getSeconds() : sourceDate.getSeconds(),
17805        this.HasMilliseconds() ? date.getMilliseconds() : sourceDate.getMilliseconds()
17806        );
17807  this.parserKeys = [];
17808  return date;
17809 },
17810 HasYear: function() { return this.HasParserKey("y"); },
17811 HasMonth: function() { return this.HasParserKey("M"); },
17812 HasDay: function() { return this.HasParserKey("d"); },
17813 HasHours: function() { return this.HasParserKey("h") || this.HasParserKey("H"); },
17814 HasMinutes: function() { return this.HasParserKey("m"); },
17815 HasSeconds: function() { return this.HasParserKey("s"); },
17816 HasMilliseconds: function() { return this.HasParserKey("f") || this.HasParserKey("F"); },
17817 HasParserKey: function(key) { return ASPx.Data.ArrayIndexOf(this.parserKeys, key) !== -1; },
17818 ApplyMonth: function() {
17819  var trial;
17820  var day = this.date.getDate();
17821  while(true) {
17822   trial = new Date();
17823   trial.setTime(this.date.getTime());   
17824   trial.setMonth(this.parsedMonth);
17825   if(trial.getMonth() == this.parsedMonth)
17826    break;
17827   --day;
17828   this.date.setDate(day);
17829  }
17830  ASPx.DateUtils.FixTimezoneGap(this.date, trial);
17831  this.date = trial;
17832 },
17833 SetFormatString: function(mask) {
17834  var format = this.GetFormat(mask);
17835  this.specifiers = format.specifiers;
17836  this.spPositions = format.spPositions;
17837  this.mask = format.mask;
17838 },
17839 GetFormat: function(maskParam) {
17840  if(maskParam.length == 2 && maskParam.charAt(0) == "%")
17841   maskParam = maskParam.charAt(1);
17842  var stringContainsDateSeparator = maskParam && maskParam.indexOf(ASPx.CultureInfo.ds) !== -1;
17843  var subt = 0;
17844  var pos = 0;
17845  var startPos = 0;
17846  var ch;
17847  var prevCh = "";
17848  var skip = false;
17849  var backslash = false;
17850  var sp = "";
17851  var specifiers = {};
17852  var spPositions = [];
17853  var mask = "";
17854  while(true) {
17855   ch = maskParam.charAt(pos);
17856   if(ch == "") {
17857    if(sp.length > 0) {
17858     var specifier = this.GetSpecifier(startPos, sp, stringContainsDateSeparator, mask);
17859     spPositions.push(specifier.pos);
17860     specifiers[specifier.pos] = specifier.sp;
17861    }
17862    break;
17863   }
17864   if(ch == "\\" && !backslash) {
17865    backslash = true;
17866    subt++;
17867   } else {
17868    if(!backslash && (ch == "'" || ch == '"')) {
17869     skip = !skip;
17870     subt++;
17871    } else {     
17872     if(!skip) {
17873      if(ch == "/")
17874       ch = ASPx.CultureInfo.ds;
17875      else if(ch == ":")
17876       ch = ASPx.CultureInfo.ts;
17877      else if(this.IsKnownSpecifier(ch)) {
17878       if(prevCh.length == 0)
17879        prevCh = ch;
17880       if(ch == prevCh)
17881        sp += ch;
17882       else {
17883        if(sp.length > 0) {
17884         var specifier = this.GetSpecifier(startPos, sp, stringContainsDateSeparator, mask);
17885         spPositions.push(specifier.pos);
17886         specifiers[specifier.pos] = specifier.sp;
17887        }
17888        sp = ch;
17889        startPos = pos - subt;
17890       }
17891      }
17892     }     
17893     mask += ch;
17894    }      
17895    backslash = false;
17896   }            
17897   prevCh = ch;
17898   pos++;
17899  }
17900  spPositions.reverse();
17901  return { specifiers: specifiers, spPositions: spPositions, mask: mask };
17902 },
17903 GetSpecifier: function (pos, sp, stringContainsDateSeparator, mask) {
17904  if(ASPx.CultureInfo.ds.length > 1 && mask && !stringContainsDateSeparator) {
17905   var dateParts = mask.split(ASPx.CultureInfo.ds);
17906   if(dateParts) {
17907    if(dateParts.length > 0 && dateParts[dateParts.length - 1] == "")
17908     dateParts.pop();
17909    pos += (dateParts.length - 1) * (ASPx.CultureInfo.ds.length - 1);
17910   }
17911  }
17912  return { pos: pos, sp: sp };
17913 },
17914 ReplaceDay: function(length) {
17915  if(length < 3) {
17916   var value = this.date.getDate().toString();
17917   return length == 2 ? this.padLeft(value, 2) : value;  
17918  } else if(length == 3) {
17919   return ASPx.CultureInfo.abbrDayNames[this.date.getDay()];
17920  } else {
17921   return ASPx.CultureInfo.dayNames[this.date.getDay()];
17922  }
17923 }, 
17924 ReplaceMonth: function(length) {
17925  var value = 1 + this.date.getMonth();
17926  switch(length) {
17927   case 1:
17928    return value.toString();
17929   case 2:
17930    return this.padLeft(value.toString(), 2);
17931   case 3:
17932    return ASPx.CultureInfo.abbrMonthNames[value - 1];
17933   default:
17934    for(var i in this.specifiers) {
17935     if(this.specifiers.hasOwnProperty(i)) {
17936      var spec = this.specifiers[i];
17937      if(spec == "d" || spec == "dd")
17938       return ASPx.CultureInfo.genMonthNames[value - 1];
17939     }
17940    }
17941    return ASPx.CultureInfo.monthNames[value - 1];
17942  }
17943 },
17944 ReplaceYear: function(length) {
17945  var value = this.date.getFullYear();
17946  if(length <= 2)
17947   value = value % 100;
17948  return this.padLeft(value.toString(), length);
17949 },
17950 ReplaceHours23: function(length) {
17951  var value = this.date.getHours().toString();
17952  return length > 1 ? this.padLeft(value, 2) : value;
17953 },
17954 ReplaceHours12: function(length) {
17955  var value = this.date.getHours() % 12;
17956  if(value == 0)
17957   value = 12;
17958  value = value.toString();
17959  return length > 1 ? this.padLeft(value, 2) : value;
17960 },
17961 ReplaceMinutes: function(length) {
17962  var value = this.date.getMinutes().toString();
17963  return length > 1 ? this.padLeft(value, 2) : value;
17964 },
17965 ReplaceSeconds: function(length) {
17966  var value = this.date.getSeconds().toString();
17967  return length > 1 ? this.padLeft(value, 2) : value;
17968 },
17969 ReplaceMsTrimmed: function(length) {   
17970  return this.formatMs(length, true);
17971 },
17972 ReplaceMs: function(length) { 
17973  return this.formatMs(length, false);
17974 },
17975 ReplaceEra: function(length) {
17976  return "A.D.";
17977 },
17978 ReplaceAmPm: function(length) {
17979  var value = this.date.getHours() < 12 ? ASPx.CultureInfo.am : ASPx.CultureInfo.pm;
17980  return length < 2 ? value.charAt(0) : value;
17981 },
17982 catchNumbers: function(str, specifiers) {
17983  this.parseNumbers = [];  
17984  var regex = /\d+/g;  
17985  var match;
17986  for(;;) {
17987   match = regex.exec(str);
17988   if(!match)
17989    break;
17990   this.parseNumbers.push(this.parseDecInt(match[0]));
17991  }  
17992  var spCount = 0;
17993  var now = new Date();
17994  for(var i in specifiers) {
17995   if(specifiers.hasOwnProperty(i)) {
17996    var sp = specifiers[i];
17997    if (sp.constructor != String || !this.IsNumericSpecifier(sp)) continue;
17998    spCount++;
17999    if(this.parseNumbers.length < spCount) {
18000     var defaultValue = 0;
18001     if (sp.charAt(0) == "y") defaultValue = now.getFullYear();
18002     this.parseNumbers.push(defaultValue);
18003    }
18004   }
18005  }
18006  var excess = this.parseNumbers.length - spCount;
18007  if(excess > 0)
18008   this.parseNumbers.splice(spCount, excess);  
18009  this.currentParseNumber = this.parseNumbers.length - 1;
18010 },
18011 popParseNumber: function() {
18012  return this.parseNumbers[this.currentParseNumber--];
18013 },
18014 findAbbrMonth: function() {
18015  return this.findMonthCore(ASPx.CultureInfo.abbrMonthNames);
18016 },
18017 findFullMonth: function() {
18018  return this.findMonthCore(ASPx.CultureInfo.genMonthNames);
18019 },
18020 findMonthCore: function(monthNames) {
18021  var inputLower = this.strToParse.toLowerCase();
18022  var matchMonthNames = monthNames.filter(function(n) { return inputLower.indexOf(n.toLowerCase()) > -1; });
18023  if(matchMonthNames.length == 0)
18024   return false;
18025  var sortedMatchNames = matchMonthNames.sort(function(a, b) { return b.length - a.length; });
18026  var name = sortedMatchNames[0];
18027  var emptyMonth = new Array(name.length + 1).join(" ");
18028  this.strToParse = this.strToParse.replace(new RegExp(name, "gi"), emptyMonth);
18029  return monthNames.indexOf(name) + 1;
18030 },
18031 ParseDay: function(length) {
18032  if(length < 3) {
18033   var value = this.popParseNumber();
18034   if(value < 1 || value > 31)
18035    return false;
18036   this.date.setDate(value);
18037  }
18038  return true;
18039 },
18040 ParseMonth: function(length) {
18041  var value;
18042  var actualMonthTextContainsDigitOnly = this.actualDayMonthTextContainsDigitOnly("M", length);
18043  if(length < 3 || actualMonthTextContainsDigitOnly)
18044   value = this.popParseNumber();
18045  else
18046   value = length === 3 ? this.findAbbrMonth() : this.findFullMonth();
18047  if(value < 1 || value > 12)
18048   return false;
18049  this.parsedMonth = value - 1;
18050  if(this.actualDayMonthTextContainsAnyDigit("M", length) && !actualMonthTextContainsDigitOnly && length > 2)
18051   this.currentParseNumber--;
18052  return true;
18053 }, 
18054 ParseYear: function(length) {  
18055  var value = this.popParseNumber();
18056  if(value > 9999)
18057   return false;
18058  if(value < 100)
18059   value = ASPx.DateUtils.ExpandTwoDigitYear(value);
18060  this.date.setFullYear(value);
18061  this.isYearParsed = true;
18062  return true;
18063 },
18064 ParseHours: function(length) {
18065  var value = this.popParseNumber();
18066  if(value > 23)
18067   return false;
18068  this.date.setHours(value);
18069  return true;
18070 },
18071 ParseMinutes: function(length) {
18072  var value = this.parseMinSecCore();
18073  if(value == -1)
18074   return false;
18075  this.date.setMinutes(value);
18076  return true;
18077 },
18078 ParseSeconds: function(length) {
18079  var value = this.parseMinSecCore();
18080  if(value == -1)
18081   return false;
18082  this.date.setSeconds(value);
18083  return true;
18084 },
18085 ParseMs: function(length) {
18086  if(length > 3)
18087   length = 3;
18088  var thr = 1;
18089  for(var i = 0; i < length; i++)
18090   thr *= 10;
18091  thr -= 1;
18092  var value = this.popParseNumber();
18093  while(value > thr)
18094   value /= 10;
18095  this.date.setMilliseconds(Math.round(value));
18096  return true;
18097 },
18098 ParseEra: function(length) {
18099  return true;
18100 },
18101 ParseAmPm: function(length) {
18102  this.hasAmPm = ASPx.CultureInfo.is12HoursCulture;
18103  return true;
18104 },
18105 parseDecInt: function(str) {
18106  return parseInt(str, 10);
18107 },
18108 padLeft: function(str, length) {
18109  while(str.length < length)
18110   str = "0" + str;
18111  return str;
18112 },
18113 formatMs: function(length, trim) {
18114  var value = Math.floor(this.date.getMilliseconds() * Math.pow(10, length - 3));
18115  value = this.padLeft(value.toString(), length);    
18116  if(trim) {
18117   var pos = value.length - 1;
18118   var req = false;
18119   while(value.charAt(pos) == "0") {
18120    req = true;
18121    pos--;
18122   }
18123   if(req)
18124    value = value.substring(0, pos + 1);   
18125  }
18126  return value;
18127 },
18128 parseMinSecCore: function() {
18129  var value = this.popParseNumber();
18130  return value > 59 ? -1 : value;
18131 },
18132 fixHours: function() {
18133  var state = this.getAmPmState(this.strToParse);
18134  if(!state) return true;
18135  var h = this.date.getHours();
18136  switch(state) {
18137   case "P":
18138    if(h > 12) return false;
18139    if(h < 12)
18140     this.date.setHours(12 + h);
18141    break;
18142   case "A":
18143    if(h == 12)
18144     this.date.setHours(0);
18145  }
18146  return true;
18147 },
18148 getAmPmState: function(str, skipCorrection) {
18149  var am = ASPx.CultureInfo.am.charAt(0).toLowerCase();
18150  var pm = ASPx.CultureInfo.pm.charAt(0).toLowerCase();
18151  var amMatches = new RegExp(am, "gi").exec(str);
18152  var pmMatches = new RegExp(pm, "gi").exec(str);
18153  var amCount = amMatches ? amMatches.length : 0;
18154  var pmCount = pmMatches ? pmMatches.length : 0;
18155  var hasAm = amCount > 0;
18156  var hasPm = pmCount > 0;
18157  if(hasAm ^ hasPm && amCount < 2 && pmCount < 2)
18158   return hasAm ? "A" : "P";
18159  if(!skipCorrection) {
18160   str = str.replace(new RegExp(this.getDayMonthNameReplacePattern(), "gi"), "");
18161   return this.getAmPmState(str, true);
18162  }
18163  return null;
18164 },
18165 getDayMonthNameReplacePattern: function() {
18166  if(!this.dayMonthNameReplacePattern)
18167   return this.createDayMonthNameReplacePattern();
18168  return this.dayMonthNameReplacePattern;
18169 },
18170 createDayMonthNameReplacePattern: function() {
18171  var parts = [ ] ;
18172  parts.push("(?:");
18173  parts.push(this.createReplacePattern(ASPx.CultureInfo.monthNames));
18174  parts.push(this.createReplacePattern(ASPx.CultureInfo.genMonthNames));
18175  parts.push(this.createReplacePattern(ASPx.CultureInfo.abbrMonthNames));
18176  parts.push(this.createReplacePattern(ASPx.CultureInfo.abbrDayNames));
18177  parts.push(this.createReplacePattern(ASPx.CultureInfo.dayNames));
18178  parts.push(")");
18179  return parts.join("");
18180 },
18181 createReplacePattern: function(names) {
18182  return names && names.length > 0 ? "\\b" + names.join("\\b|\\b") + "\\b" : "";
18183 },
18184 IsNumericSpecifier: function(sp) {
18185  var ch = sp.charAt(0);
18186  if(ch == "g" || ch == "t" || ((ch == "M" || ch == "d") && !this.actualDayMonthTextContainsAnyDigit(ch, sp.length)))
18187   return false;
18188  return true;
18189 },
18190 actualDayMonthTextContainsAnyDigit: function(datePart, datePartLength) {
18191  return this.actualDayMonthTextContainsDigitCore(datePart, datePartLength, function(name) { return /\d+/g.test(name); });
18192 },
18193 actualDayMonthTextContainsDigitOnly: function(datePart, datePartLength) {
18194  return this.actualDayMonthTextContainsDigitCore(datePart, datePartLength, function(name) { return !isNaN(parseInt(name)); });
18195 },
18196 actualDayMonthTextContainsDigitCore: function(datePart, datePartLength, matchDigitFunc) {
18197  if(datePartLength < 3)
18198   return true;
18199  var targetNames = this.getDayMonthNames(datePart, datePartLength);
18200  return targetNames.length > 0 ? matchDigitFunc(targetNames[0]) : false;
18201 },
18202 getDayMonthNames: function(datePart, datePartLength) {
18203  var result = [];
18204  var useAbbrNames = datePartLength == 3;
18205  if(datePart == "d")
18206   result = useAbbrNames ? ASPx.CultureInfo.abbrDayNames : ASPx.CultureInfo.dayNames;
18207  else
18208   result = useAbbrNames ? ASPx.CultureInfo.abbrMonthNames : ASPx.CultureInfo.monthNames;
18209  return result;
18210 },
18211 IsKnownSpecifier: function(sp) {
18212  if(sp.length > 1)
18213   sp = sp.charAt(0);
18214  for(var i = 0; i < this.knownSpecifiers.length; i++) {
18215   if(this.knownSpecifiers[i] == sp)
18216    return true;
18217  }
18218  return false;
18219 }
18220});
18221DateFormatter.Create = function(format) {
18222 var instance = new DateFormatter();
18223 instance.SetFormatString(format);
18224 return instance;
18225};
18226DateFormatter.ExpandPredefinedFormat = function(format) {
18227 switch(format) {
18228  case "d":
18229   return ASPx.CultureInfo.shortDate;
18230  case "D":
18231   return ASPx.CultureInfo.longDate;
18232  case "t":
18233   return ASPx.CultureInfo.shortTime;
18234  case "T":
18235   return ASPx.CultureInfo.longTime;
18236  case "g":
18237   return ASPx.CultureInfo.shortDate + " " + ASPx.CultureInfo.shortTime;   
18238  case "f":
18239   return ASPx.CultureInfo.longDate + " " + ASPx.CultureInfo.shortTime;
18240  case "G":
18241   return ASPx.CultureInfo.shortDate + " " + ASPx.CultureInfo.longTime;
18242  case "F":
18243  case "U":
18244   return ASPx.CultureInfo.longDate + " " + ASPx.CultureInfo.longTime;   
18245  case "M":
18246  case "m":
18247   return ASPx.CultureInfo.monthDay;
18248  case "Y":
18249  case "y":
18250   return ASPx.CultureInfo.yearMonth;   
18251  case "O":
18252  case "o":
18253   return "yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffff";
18254  case "R":
18255  case "r":
18256   return "ddd, dd MMM yyyy HH':'mm':'ss 'GMT'";
18257  case "s":
18258   return "yyyy'-'MM'-'dd'T'HH':'mm':'ss";
18259  case "u":
18260    return "yyyy'-'MM'-'dd HH':'mm':'ss'Z'";
18261 }
18262 return format;
18263};
18264ASPx.DateFormatter = DateFormatter;
18265})();
18266
18267(function() {
18268ASPx.Formatter = {
18269 Format: function() {
18270  if(arguments.length < 1) 
18271   return "";
18272  var format = arguments[0];
18273  if(format == null)
18274   return "";
18275  var args;
18276  if(arguments.length > 1 && arguments[1] != null && arguments[1].constructor == Array) {
18277   args = arguments[1];
18278  } else {
18279   args = [ ];
18280   for(var i = 1; i < arguments.length; i++)
18281    args.push(arguments[i]);
18282  }
18283  var bag = [ ];
18284  var pos = 0;
18285  var savedPos = 0;  
18286  while(pos < format.length) {
18287   var ch = format.charAt(pos);
18288   pos++;
18289   if(ch == '{') {
18290    bag.push(format.substr(savedPos, pos - savedPos - 1));    
18291    if(format.charAt(pos) == "{") {
18292     savedPos = pos;
18293     pos++;
18294     continue;
18295    }
18296    var spec = this.ParseSpec(format, pos);
18297    var pos = spec.pos;
18298    var arg = args[spec.index];
18299    var argString;
18300    if(arg == null) {
18301     argString = "";
18302    } else if(typeof arg == "number") {
18303     argString = ASPx.NumberFormatter.Format(spec.format, arg);
18304    } else if(arg.constructor == Date) {     
18305     if(spec.format != this.activeDateFormat) {
18306      this.activeDateFormat = spec.format;
18307      if(spec.format == "")
18308       spec.format = "G";      
18309      if(spec.format.length == 1)
18310       spec.format = ASPx.DateFormatter.ExpandPredefinedFormat(spec.format);
18311      this.GetDateFormatter().SetFormatString(spec.format);
18312     }
18313     if(this.activeDateFormat == "U")
18314      arg = ASPx.DateUtils.ToUtcTime(arg);
18315     argString = this.GetDateFormatter().Format(arg);
18316    } else {
18317     argString = String(arg);     
18318     if(spec.format != "" && argString.length > 0) {
18319      var num = Number(argString.replace(",", "."));
18320      if(!isNaN(num))
18321       argString = ASPx.NumberFormatter.Format(spec.format, num);
18322     }
18323    }
18324    var padLen = spec.width - argString.length;
18325    if(padLen > 0) {
18326     if(spec.left)
18327      bag.push(argString);
18328     for(var i = 0; i < padLen; i++)
18329      bag.push(" ");
18330     if(!spec.left)
18331      bag.push(argString);
18332    } else {
18333     bag.push(argString);
18334    }
18335    savedPos = pos;
18336   }
18337   else if(ch == "}" && pos < format.length && format.charAt(pos) == "}") {
18338    bag.push(format.substr(savedPos, pos - savedPos - 1));
18339    savedPos = pos;
18340    pos++;
18341   }
18342   else if (ch == "}") {
18343    return "";
18344   }
18345  }
18346  if(savedPos < format.length)
18347   bag.push(format.substr(savedPos));   
18348  return bag.join("");
18349 },
18350 ParseSpec: function(format, pos) {
18351  var result = {
18352   index: -1,   
18353   left: false,
18354   width: 0,
18355   format: "",
18356   pos: 0
18357  };
18358  var savedPos, ch;
18359  savedPos = pos;
18360  while(true) {   
18361   ch = format.charAt(pos);
18362   if(ch < "0" || ch > "9")
18363    break;
18364   pos++;
18365  }  
18366  if(pos > savedPos)
18367   result.index = Number(format.substr(savedPos, pos - savedPos));  
18368  if(format.charAt(pos) == ",") {
18369   pos++;
18370   while(true) {
18371    ch = format.charAt(pos);
18372    if(ch != " " && ch != "\t")
18373     break;
18374    pos++;
18375   }
18376   result.left = format.charAt(pos) == "-";
18377   if(result.left)
18378    pos++;   
18379   savedPos = pos;
18380   while(true) {
18381    ch = format.charAt(pos);
18382    if(ch < "0" || ch > "9")
18383     break;
18384    pos++;
18385   }
18386   if(pos > savedPos)
18387    result.width = Number(format.substr(savedPos, pos - savedPos));
18388  }
18389  if(format.charAt(pos) == ":") {
18390   pos++;
18391   savedPos = pos;
18392   while(format.charAt(pos) != "}")
18393    pos++;
18394   result.format = format.substr(savedPos, pos - savedPos);
18395  }
18396  pos++;
18397  result.pos = pos;
18398  return result;
18399 },
18400 activeDateFormat: null,
18401 GetDateFormatter: function() {
18402  if(!this.__dateFormatter)
18403   this.__dateFormatter = new ASPx.DateFormatter();
18404  return this.__dateFormatter;
18405 }
18406};
18407ASPx.NumberFormatter = {
18408 Format: function(format, value) {
18409  if(isNaN(value))
18410   return ASPx.CultureInfo.numNan;
18411  if(!isFinite(value)) {
18412   return value > 0 
18413    ? ASPx.CultureInfo.numPosInf 
18414    : ASPx.CultureInfo.numNegInf;
18415  }
18416  this.FillFormatInfo(format);
18417  if(this.spec == "X")
18418   return this.FormatHex(value);
18419  this.FillDigitInfo(value);  
18420  switch(this.spec) {
18421   case "C":
18422    return this.FormatCurrency();
18423   case "D":
18424    return this.FormatDecimal();
18425   case "E":
18426    return this.FormatExp();
18427   case "F":
18428    return this.FormatFixed();
18429   case "G":   
18430    return this.FormatGeneral();
18431   case "N":
18432    return this.FormatNumber();
18433   case "P":
18434    return this.FormatPercent();
18435   default:
18436    if(this.custom)
18437     return this.FormatCustom(format);
18438    return "?";
18439  }
18440 },
18441 positive: true,
18442 digits: null,
18443 pointPos: 0, 
18444 spec: "",
18445 prec: -1,  
18446 upper: true,
18447 custom: false,
18448 FormatCurrency: function() {  
18449  if(this.prec < 0)
18450   this.prec = ASPx.CultureInfo.currPrec;
18451  this.Round(this.prec);
18452  var bag = [ ];
18453  if(this.positive) {
18454   switch(ASPx.CultureInfo.currPosPattern) {
18455    case 0:
18456     bag.push(ASPx.CultureInfo.currency);
18457     break;
18458    case 2:
18459     bag.push(ASPx.CultureInfo.currency, " ");     
18460     break;     
18461   }
18462  } else {
18463   switch(ASPx.CultureInfo.currNegPattern) {
18464    case 0:
18465     bag.push("(", ASPx.CultureInfo.currency);
18466     break;
18467    case 1:
18468     bag.push("-", ASPx.CultureInfo.currency);
18469     break;
18470    case 2:
18471     bag.push(ASPx.CultureInfo.currency, "-");
18472     break;
18473    case 3:
18474     bag.push(ASPx.CultureInfo.currency);
18475     break;
18476    case 4:
18477     bag.push("(");
18478     break;
18479    case 5:
18480    case 8:
18481     bag.push("-");
18482     break;
18483    case 9:
18484     bag.push("-", ASPx.CultureInfo.currency, " ");
18485     break;
18486    case 11:
18487     bag.push(ASPx.CultureInfo.currency, " ");
18488     break;
18489    case 12:
18490     bag.push(ASPx.CultureInfo.currency, " -");
18491     break;
18492    case 14:
18493     bag.push("(", ASPx.CultureInfo.currency, " ");
18494     break;
18495    case 15:
18496     bag.push("(");
18497     break;
18498   }
18499  }
18500  this.AppendGroupedInteger(bag, ASPx.CultureInfo.currGroups, ASPx.CultureInfo.currGroupSeparator);
18501  if(this.prec > 0) {
18502   bag.push(ASPx.CultureInfo.currDecimalPoint);
18503   this.AppendDigits(bag, this.pointPos, this.pointPos + this.prec);
18504  }
18505  if(this.positive) {
18506   switch(ASPx.CultureInfo.currPosPattern) {
18507    case 1:
18508     bag.push(ASPx.CultureInfo.currency);
18509     break;
18510    case 3:
18511     bag.push(" ", ASPx.CultureInfo.currency);
18512     break;     
18513   }   
18514  } else {
18515   switch(ASPx.CultureInfo.currNegPattern) {
18516    case 0:
18517    case 14:
18518     bag.push(")");
18519     break;
18520    case 3:
18521     bag.push("-");
18522     break;
18523    case 4:
18524     bag.push(ASPx.CultureInfo.currency, ")");
18525     break;
18526    case 5:
18527     bag.push(ASPx.CultureInfo.currency);
18528     break;
18529    case 6:
18530     bag.push("-", ASPx.CultureInfo.currency);
18531     break;
18532    case 7:
18533     bag.push(ASPx.CultureInfo.currency, "-");
18534     break;
18535    case 8:
18536     bag.push(" ", ASPx.CultureInfo.currency);
18537     break;
18538    case 10:
18539     bag.push(" ", ASPx.CultureInfo.currency, "-");
18540     break;
18541    case 11:
18542     bag.push("-");
18543     break;
18544    case 13:
18545     bag.push("- ", ASPx.CultureInfo.currency);
18546     break;
18547    case 15:
18548     bag.push(" ", ASPx.CultureInfo.currency, ")");
18549     break;
18550   }
18551  }
18552  return bag.join("");
18553 }, 
18554 FormatDecimal: function() {
18555  if(this.prec < this.pointPos)
18556   this.prec = this.pointPos;
18557  if(this.prec < 1)
18558   return "0";
18559  var bag = [ ];
18560  if(!this.positive)
18561   bag.push("-");
18562  this.AppendDigits(bag, this.pointPos - this.prec, this.pointPos);
18563  return bag.join("");
18564 },
18565 FormatExp: function() {  
18566  if(this.prec < 0)
18567   this.prec = 6;
18568  this.Round(1 - this.pointPos + this.prec);
18569  return this.FormatExpCore(3);
18570 },
18571 FormatExpCore: function(minExpDigits) {
18572  var bag = [ ];
18573  if(!this.positive)
18574   bag.push("-");
18575  this.AppendDigits(bag, 0, 1);
18576  if(this.prec > 0) {
18577   bag.push(ASPx.CultureInfo.numDecimalPoint);
18578   this.AppendDigits(bag, 1, 1 + this.prec);
18579  }
18580  bag.push(this.upper ? "E" : "e");
18581  var order = this.pointPos - 1;  
18582  if(order >= 0) {
18583   bag.push("+");
18584  } else {
18585   bag.push("-");
18586   order = -order;
18587  }
18588  var orderStr = String(order);
18589  for(var i = orderStr.length; i < minExpDigits; i++)
18590   bag.push(0);
18591  bag.push(orderStr);
18592  return bag.join("");
18593 },
18594 FormatFixed: function() {
18595  if(this.prec < 0)
18596   this.prec = ASPx.CultureInfo.numPrec;
18597  this.Round(this.prec);
18598  var bag = [ ];
18599  if(!this.positive)
18600   bag.push("-");
18601  if(this.pointPos < 1)
18602   bag.push(0);
18603  else
18604   this.AppendDigits(bag, 0, this.pointPos);
18605  if(this.prec > 0) {
18606   bag.push(ASPx.CultureInfo.numDecimalPoint);
18607   this.AppendDigits(bag, this.pointPos, this.pointPos + this.prec);
18608  }
18609  return bag.join(""); 
18610 },
18611 FormatGeneral: function() {
18612  var hasFrac = this.pointPos < this.digits.length;
18613  var allowExp;
18614  if(this.prec < 0) {
18615   allowExp = hasFrac;
18616   this.prec = hasFrac ? 15 : 10;
18617  } else {   
18618   allowExp = true;
18619   if(this.prec < 1)
18620    this.prec = hasFrac ? 15 : 10;
18621   this.Round(this.prec - this.pointPos);
18622  }
18623  if(allowExp) {
18624   if(this.pointPos > this.prec || this.pointPos <= -4) {
18625    this.prec = this.digits.length - 1;
18626    return this.FormatExpCore(2);
18627   }
18628  }
18629  this.prec = Math.min(this.prec, Math.max(1, this.digits.length)) - this.pointPos;
18630  return this.FormatFixed();
18631 },
18632 FormatNumber: function() {
18633  if(this.prec < 0)
18634   this.prec = ASPx.CultureInfo.numPrec;
18635  this.Round(this.prec);
18636  var bag = [ ];
18637  if(!this.positive) {
18638   switch(ASPx.CultureInfo.numNegPattern) {
18639    case 0:
18640     bag.push("(");
18641     break;
18642    case 1:
18643     bag.push("-");
18644     break;
18645    case 2:
18646     bag.push("- ");
18647     break;
18648   }
18649  }
18650  this.AppendGroupedInteger(bag, ASPx.CultureInfo.numGroups, ASPx.CultureInfo.numGroupSeparator);
18651  if(this.prec > 0) {
18652   bag.push(ASPx.CultureInfo.numDecimalPoint);
18653   this.AppendDigits(bag, this.pointPos, this.pointPos + this.prec);
18654  }
18655  if(!this.positive) {
18656   switch(ASPx.CultureInfo.numNegPattern) {
18657    case 0:
18658     bag.push(")");
18659     break;
18660    case 3:
18661     bag.push("-");
18662     break;
18663    case 4:
18664     bag.push(" -");
18665     break;
18666   }
18667  }
18668  return bag.join("");
18669 },
18670 FormatPercent: function() {
18671  if(this.prec < 0)
18672   this.prec = ASPx.CultureInfo.numPrec;
18673  if(this.digits.length > 0)
18674   this.pointPos += 2;
18675  this.Round(this.prec);
18676  var bag = [ ];
18677  if(!this.positive)
18678   bag.push("-");
18679  if(ASPx.CultureInfo.percentPattern == 2)
18680   bag.push("%");    
18681  this.AppendGroupedInteger(bag, ASPx.CultureInfo.numGroups, ASPx.CultureInfo.numGroupSeparator);
18682  if(this.prec > 0) {
18683   bag.push(ASPx.CultureInfo.numDecimalPoint);
18684   this.AppendDigits(bag, this.pointPos, this.pointPos + this.prec);
18685  }  
18686  switch(ASPx.CultureInfo.percentPattern) {
18687   case 0:
18688    bag.push(" %");
18689    break;
18690   case 1:
18691    bag.push("%");
18692    break;
18693  }  
18694  return bag.join("");
18695 },
18696 FormatHex: function(value) {
18697  var result = value.toString(16);
18698  if(result.indexOf("(") > -1)
18699   return result;
18700  result = this.upper ? result.toUpperCase() : result.toLowerCase();
18701  if(this.prec <= result.length)
18702   return result;
18703  var bag = [ ];
18704  for(var i = result.length; i < this.prec; i++)
18705   bag.push(0);
18706  bag.push(result);
18707  return bag.join("");
18708 },
18709 FormatCustom: function(format) {
18710  var sectionList = this.GetCustomFormatSections(format);
18711  var section = this.SelectCustomFormatSection(sectionList);
18712  if(section == "")
18713   return this.positive ? "" : "-";
18714  var info = this.ParseCustomFormatSection(section);
18715  var lists = this.CreateCustomFormatLists(info);
18716  if(sectionList.length > 2 && section != sectionList[2]) {
18717   var zero = lists.i.concat(lists.f).join("").split(0).join("") == "";
18718   if(zero) {
18719    section = sectionList[2];
18720    info = this.ParseCustomFormatSection(section);
18721    lists = this.CreateCustomFormatLists(info);   
18722   }   
18723  }
18724  return this.FormatCustomCore(section, info, lists);
18725 },
18726 GetCustomFormatSections: function(format) {
18727  var sections = [ ];
18728  var escaping = false;
18729  var quote = "";
18730  var length = 0;
18731  var prevPos = 0;
18732  for(var i = 0; i < format.length; i++) {
18733   var ch = format.charAt(i);
18734   if(!escaping && quote == "" && ch == ";") {
18735    sections.push(format.substr(prevPos, length));
18736    length = 0;
18737    prevPos = i + 1;
18738    if(sections.length > 2)
18739     break;
18740   } else {
18741    if(escaping)
18742     escaping = false;
18743    else if(ch == quote)
18744     quote = quote == "" ? ch : "";
18745    else if(ch == "\\")
18746     escaping = true;
18747    else if(ch == "'" || ch == '"')
18748     quote = ch;
18749    ++length;
18750   }
18751  }
18752  if(length > 0)
18753   sections.push(format.substr(prevPos, length));
18754  if(sections.length < 1)
18755   sections.push(format);
18756  return sections;
18757 },
18758 SelectCustomFormatSection: function(sections) {
18759  if(!this.positive && sections.length > 1 && sections[1] != "") {
18760   this.positive = true;
18761   return sections[1];
18762  }
18763  if(this.digits.length < 1 && sections.length > 2 && sections[2] != "")
18764   return sections[2];
18765  return sections[0];
18766 },
18767 CreateCustomFormatInfo: function() {
18768  return {
18769   pointPos: -1,
18770   grouping: false,
18771   exp: false,
18772   expShowPlus: false,
18773   percent: false,
18774   scaling: 0,
18775   intDigits: 0,
18776   fracDigits: 0,
18777   expDigits: 0,
18778   intSharps: 0,
18779   fracSharps: 0, 
18780   expSharps: 0
18781  };
18782 },
18783 ParseCustomFormatSection: function(section) {  
18784  var quote = "";
18785  var area = "i"; 
18786  var canParseIntSharps = true;
18787  var result = this.CreateCustomFormatInfo();
18788  var groupSeparators = 0;  
18789  for(var i = 0; i < section.length; i++) {
18790   var ch = section.charAt(i);   
18791   if(ch == quote) {
18792    quote = "";    
18793    continue;
18794   }
18795   if(quote != "")
18796    continue;
18797   if(area == "e" && ch != "0" && ch != "#") {
18798    area = result.pointPos < 0 ? "i" : "f";
18799    i--;
18800    continue;
18801   }
18802   switch(ch) {
18803    case "\\":
18804     i++;
18805     continue;
18806    case "'":
18807    case '"':
18808     quote = ch;
18809     continue;
18810    case "#":
18811    case "0":
18812     if(ch == "#") {
18813      switch(area) {
18814       case "i":
18815        if(canParseIntSharps)
18816         result.intSharps++;
18817        break;
18818       case "f":
18819        result.fracSharps++;
18820        break;
18821       case "e":
18822        result.expSharps++;
18823        break;
18824      }
18825     } else {
18826      canParseIntSharps = false;
18827      switch(area) {
18828       case "f":
18829        result.fracSharps = 0;        
18830        break;
18831       case "e":
18832        result.expSharps = 0;
18833        break;
18834      }
18835     }
18836     switch(area) {
18837      case "i":
18838       result.intDigits++;
18839       if(groupSeparators > 0)
18840        result.grouping = true;
18841       groupSeparators = 0;
18842       break;
18843      case "f":
18844       result.fracDigits++;  
18845       break;
18846      case "e":
18847       result.expDigits++;
18848       break;
18849     }
18850     break;
18851    case "e":
18852    case "E":
18853     if(result.exp)
18854      break;
18855     result.exp = true;     
18856     area = "e"; 
18857     if(i < section.length - 1) {
18858      var next = section.charAt(1 + i);
18859      if(next == "+" || next == "-") {
18860       if(next == "+")
18861        result.expShowPlus = true;
18862       i++;
18863      }
18864      else if(next != "0" && next != "#") {
18865       result.exp = false;
18866       if(result.pointPos < 0)
18867        area = "i";       
18868      }
18869     }
18870     break;
18871    case ".":
18872     area = "f";
18873     if(result.pointPos < 0)
18874      result.pointPos = i;
18875     break;
18876    case "%":
18877     result.percent = true;     
18878     break;
18879    case ",":
18880     if(area == "i" && result.intDigits > 0)
18881      groupSeparators++;
18882     break;
18883    default:
18884     break;
18885   }
18886  }
18887  if(result.expDigits < 1)
18888   result.exp = false;
18889  else
18890   result.intSharps = 0;
18891  if(result.fracDigits < 1)
18892   result.pointPos = -1;
18893  result.scaling = 3 * groupSeparators;  
18894  return result;
18895 },
18896 CreateCustomFormatLists: function(info) {
18897  var intList = [ ];
18898  var fracList = [ ];
18899  var expList = [ ];
18900  if(this.digits.length > 0) {
18901   if(info.percent)
18902    this.pointPos += 2;
18903   this.pointPos -= info.scaling;
18904  }
18905  var expPositive = true;
18906  if(info.exp && (info.intDigits > 0 || info.fracDigits > 0)) {
18907   var diff = 0;
18908   if(this.digits.length > 0) {
18909    this.Round(info.intDigits + info.fracDigits - this.pointPos);
18910    diff -= this.pointPos - info.intDigits;
18911    this.pointPos = info.intDigits;
18912   }
18913   expPositive = diff <= 0;   
18914   expList = String(diff < 0 ? -diff : diff).split("");
18915  } else {
18916   this.Round(info.fracDigits);
18917  }
18918  if(this.digits.length < 1 || this.pointPos < 1)
18919   intList = [ 0 ];
18920  else
18921   this.AppendDigits(intList, 0, this.pointPos);
18922  this.AppendDigits(fracList, this.pointPos, this.digits.length);
18923  if(info.exp) {
18924   while(intList.length < info.intDigits)
18925    intList.unshift(0);
18926   while(expList.length < info.expDigits - info.expSharps)
18927    expList.unshift(0);
18928   if(expPositive && info.expShowPlus)
18929    expList.unshift("+");
18930   else if(!expPositive)
18931    expList.unshift("-");
18932  } else {
18933   while(intList.length < info.intDigits - info.intSharps)
18934    intList.unshift(0);    
18935   if(info.intSharps >= info.intDigits) {
18936    var zero = true;
18937    for(var i = 0; i < intList.length; i++) {
18938     if(intList[i] != 0) {
18939      zero = false;
18940      break;
18941     }
18942    }
18943    if(zero)
18944     intList = [ ];
18945   }
18946  }
18947  while(fracList.length < info.fracDigits - info.fracSharps)
18948   fracList.push(0);
18949  return {
18950   i: intList,
18951   f: fracList,
18952   e: expList
18953  };
18954 },
18955 FormatCustomCore: function(section, info, lists) {
18956  var intLen = 0; 
18957  var total = 0;
18958  var groupIndex = 0; 
18959  var counter = 0;
18960  var groupSize = 0;
18961  if(info.grouping && ASPx.CultureInfo.numGroups.length > 0) {
18962   intLen = lists.i.length;
18963   for(var i = 0; i < ASPx.CultureInfo.numGroups.length; i++) {
18964    if(total + ASPx.CultureInfo.numGroups[i] <= intLen) {
18965     total += ASPx.CultureInfo.numGroups[i];
18966     groupIndex = i;
18967    }
18968   }
18969   groupSize = ASPx.CultureInfo.numGroups[groupIndex];
18970   var fraction = intLen > total ? intLen - total : 0;
18971   if(groupSize == 0) {
18972    while(groupIndex >= 0 && ASPx.CultureInfo.numGroups[groupIndex] == 0)
18973     groupIndex--;
18974    groupSize = fraction > 0 ? fraction : ASPx.CultureInfo.numGroups[groupIndex];
18975   }
18976   if(fraction == 0) {
18977    counter = groupSize;
18978   } else {
18979    groupIndex += Math.floor(fraction / groupSize);
18980    counter = fraction % groupSize;
18981    if(counter == 0)
18982     counter = groupSize;
18983    else
18984     groupIndex++;
18985   }
18986  } else {
18987   info.grouping = false;
18988  }
18989  var bag = [ ];
18990  var area = "i";
18991  var intSharps = 0;
18992  var intListIndex = 0;
18993  var fracListIndex = 0;
18994  var savedCh = "";
18995  for(var i = 0; i < section.length; i++) {
18996   var ch = section.charAt(i);
18997   if(ch == savedCh) {
18998    savedCh = "";
18999    continue;
19000   }
19001   if(savedCh != "") {
19002    bag.push(ch);
19003    continue;
19004   }
19005   switch(ch) {
19006    case "\\":
19007     ++i;
19008     if(i < section.length)
19009      bag.push(section.charAt(i));
19010     continue;
19011    case "'":
19012    case '"':     
19013     savedCh = ch;
19014     continue;
19015    case "#":     
19016    case "0":
19017     if(area == "i") {
19018      intSharps++;
19019      if(ch == "0" || info.intDigits - intSharps < lists.i.length + intListIndex) {
19020       while(info.intDigits - intSharps + intListIndex < lists.i.length) {
19021        bag.push(lists.i[intListIndex]);
19022        intListIndex++;
19023        if(info.grouping && --intLen > 0 && --counter == 0) {
19024         bag.push(ASPx.CultureInfo.numGroupSeparator);
19025         if(--groupIndex < ASPx.CultureInfo.numGroups.length && groupIndex >= 0)
19026          groupSize = ASPx.CultureInfo.numGroups[groupIndex];
19027         counter = groupSize;
19028        }
19029       }
19030      }
19031     } else if(area == "f") {
19032      if(fracListIndex < lists.f.length) {
19033       bag.push(lists.f[fracListIndex]);
19034       fracListIndex++;
19035      }
19036     }
19037     break;
19038    case "e":
19039    case "E":
19040     if(lists.e == null || !info.exp) {
19041      bag.push(ch);
19042      break;
19043     }
19044     for(var q = i + 1; q < section.length; q++) {
19045      if(q == i + 1 && (section.charAt(q) == "+" || section.charAt(q) == "-"))
19046       continue;                   
19047      if(section.charAt(q) == "0" || section.charAt(q) == "#")
19048       continue;
19049      break;
19050     }
19051     i = q - 1;
19052     area = info.pointPos < 0 ? "i" : "f";
19053     bag.push(ch);
19054     bag = bag.concat(lists.e);
19055     lists.e = null;      
19056     break;
19057    case ".":
19058     if(info.pointPos == i && lists.f.length > 0)
19059      bag.push(ASPx.CultureInfo.numDecimalPoint);
19060     area = "f";
19061     break;
19062    case ",":
19063     break;
19064    default:
19065     bag.push(ch);
19066     break;
19067   }
19068  }
19069  if(!this.positive)
19070   bag.unshift("-");
19071  return bag.join("");
19072 },
19073 FillDigitInfo: function(value) {
19074  this.positive = true;
19075  if(value < 0) {
19076   value = -value;
19077   this.positive = false;   
19078  }
19079  this.digits = [ ];
19080  this.pointPos = 0;    
19081  if(value == 0 || !isFinite(value) || isNaN(value)) {
19082   this.pointPos = 1;
19083   return;
19084  }
19085  var list = String(value).split("e");
19086  var str = list[0];
19087  if(list.length > 1) {   
19088   this.pointPos = Number(list[1]);
19089  }
19090  var frac = false;
19091  var decimalCount = 0;
19092  for(var i = 0; i < str.length; i++) {
19093   var ch = str.charAt(i);
19094   if(ch == ".") {
19095    frac = true;
19096   } else {
19097    if(frac)
19098     decimalCount++;     
19099    if(ch != "0" || this.digits.length > 0)
19100     this.digits.push(Number(ch));
19101   }
19102  }
19103  this.pointPos += this.digits.length - decimalCount;
19104 },
19105 FillFormatInfo: function(format) {
19106  this.upper = true;
19107  this.custom = false;
19108  this.prec = -1;
19109  var spec;
19110  if(format == null || format.length < 1)
19111   spec = "G";
19112  else
19113   spec = format.charAt(0);
19114  if(spec >= "a" && spec <= "z") {
19115   spec = spec.toUpperCase();
19116   this.upper = false;
19117  }
19118  if(spec >= "A" && spec <= "Z") {   
19119   if(format != null && format.length > 1) {
19120    var prec = Number(format.substr(1));
19121    if(!isNaN(prec))
19122     this.prec = prec;
19123    else
19124     this.custom = true;
19125   }
19126  } else {
19127   this.custom = true;   
19128  }  
19129  this.spec = this.custom ? "0" : spec;
19130 },
19131 Round: function(shift) {
19132  var amount = this.digits.length - this.pointPos - shift;
19133  if(amount <= 0) 
19134   return;
19135  var cutPos = this.pointPos + shift;
19136  if(cutPos < 0) {
19137   this.digits = [ ];
19138   this.pointPos = 0;
19139   return;
19140  }
19141  var digit = this.digits[cutPos];
19142  if(digit > 4) { 
19143   for(var i = 0; i < amount; i++) {
19144    var index = cutPos - 1 - i;
19145    if(index < 0) {
19146     this.digits.unshift(0);
19147     this.pointPos++;
19148     cutPos++;
19149     index++;
19150    }
19151    digit = this.digits[index];    
19152    if(digit < 9) {
19153     this.digits[index] = 1 + digit;
19154     break;
19155    } else {
19156     this.digits[index] = 0;
19157     amount++;
19158    }
19159   }
19160  }
19161  for(var i = cutPos - 1; i >= 0; i--) {
19162   if(this.digits[i] > 0) break;
19163   cutPos--;
19164  }
19165  this.digits.splice(cutPos, this.digits.length - cutPos);
19166 },
19167 AppendGroupedInteger: function(list, groups, separator) { 
19168  if(this.pointPos < 1) {
19169   list.push(0);
19170   return;
19171  }
19172  var total = 0;
19173  var groupIndex = 0;
19174  for(var i = 0; i < groups.length; i++) {
19175   if(total + groups[i] <= this.pointPos) {
19176    total += groups[i];
19177    groupIndex = i;
19178   }
19179   else
19180    break;
19181  }
19182  if(groups.length > 0 && total > 0) {
19183   var counter;
19184   var groupSize = groups[groupIndex];
19185   var fraction = this.pointPos > total ? this.pointPos - total : 0;
19186   if(groupSize == 0) {
19187    while(groupIndex >= 0 && groups[groupIndex] == 0)
19188     groupIndex--;
19189    groupSize = fraction > 0 ? fraction : groups[groupIndex];
19190   }
19191   if(fraction == 0) {
19192    counter = groupSize;
19193   } else {
19194    groupIndex += Math.floor(fraction / groupSize);
19195    counter = fraction % groupSize;
19196    if(counter == 0)
19197     counter = groupSize;
19198    else
19199     groupIndex++;
19200   }
19201   var i = 0;
19202   while(true) {
19203    if(this.pointPos - i <= counter || counter == 0) {
19204     this.AppendDigits(list, i, this.pointPos);
19205     break;
19206    }
19207    this.AppendDigits(list, i, i + counter);
19208    list.push(separator);
19209    i += counter;    
19210    groupIndex--;     
19211    if(groupIndex < groups.length && groupIndex >= 0)
19212     groupSize = groups[groupIndex];
19213    counter = groupSize;
19214   }
19215  } else {
19216   this.AppendDigits(list, 0, this.pointPos);   
19217  }  
19218 },
19219 AppendDigits: function(list, start, end) {
19220  for(var i = start; i < end; i++) {
19221   if(i < 0 || i >= this.digits.length)
19222    list.push(0);
19223   else
19224    list.push(this.digits[i]);
19225  }
19226 }
19227};
19228})();
19229(function() {
19230var dropDownNameSuffix = "_DDD";
19231var itemImageCellClassName = "dxeIIC";
19232var CONSTANTS = {
19233 DROPDOWN_COMMAND_APPLY: "Apply",
19234 DROPDOWN_COMMAND_CLOSE: "Close",
19235 DROPDOWN_HELPTEXT_CLASS: "dxdd-help",
19236 DROPDOWN_CAPTION_CLASS: "dxdd-caption",
19237 DROPDOWN_HEADER_CLASS: "dxdd-header",
19238 DROPDOWN_MODALVISIBLE_CLASS: "dxdd-vmdd"
19239};
19240var DROPDOWN_ELEMENT_VISIBILITY = {
19241 Never: 0,
19242 DropDown: 1,
19243 ModalDropDown: 2,
19244 Always: 3
19245};
19246ASPx.DROPDOWN_ELEMENT_VISIBILITY = DROPDOWN_ELEMENT_VISIBILITY;
19247var ASPxClientDropDownEditBase = ASPx.CreateClass(ASPxClientButtonEditBase, {
19248 constructor: function(name) {
19249  this.constructor.prototype.constructor.call(this, name);
19250  this.DropDown = new ASPxClientEvent();
19251  this.CloseUp = new ASPxClientEvent();
19252  this.QueryCloseUp = new ASPxClientEvent();
19253  this.ddHeightCache = ASPx.InvalidDimension;
19254  this.ddWidthCache = ASPx.InvalidDimension;
19255  this.mainElementWidthCache = ASPx.InvalidDimension;
19256  this.dropDownButtonIndex = -1;
19257  this.droppedDown = false;
19258  this.ddButtonPushed = false;
19259  this.lastSuccessText = "";
19260  this.isToolbarItem = false;
19261  this.allowFocusDropDownWindow = false;
19262  this.pcIsShowingNow = false;
19263  this.needTimeoutForInputElementFocusEvent = false;
19264  this.ddButtonsVis = 0;
19265  this.ddmInput = false;
19266  this.ddDefCap = true;
19267  this.ddScrPicker = ASPx.DROPDOWN_ELEMENT_VISIBILITY.Never;
19268  this.accessibilityHelper = null;
19269  aspxGetDropDownCollection().Add(this);
19270 },
19271 InitializeEvents: function() {
19272  ASPxClientButtonEditBase.prototype.InitializeEvents.call(this);
19273  var ddTargets = this.getDropDownEventTargets();
19274  ddTargets
19275   .filter(function(trg, index, arr) { return trg && arr.indexOf(trg) === index; })
19276   .forEach(function(trg) {
19277    ASPx.Evt.AttachEventToElement(trg, "click", this.onDropDownEvent.bind(this));
19278    ASPx.Evt.AttachEventToElement(trg, ASPx.TouchUIHelper.touchMouseDownEventName, this.onDropDownEvent.bind(this));
19279  }.bind(this));
19280 },
19281 getDropDownEventTargets: function() {
19282  return [
19283   this.GetDropDownItemImageCell(),
19284   this.GetDropDownButton()
19285  ];
19286 },
19287 onDropDownEvent: function(evt) {
19288  if(evt.type === this.getDropDownEvent() && ASPx.Evt.IsLeftButtonPressed(evt) && this.GetEnabled())
19289   return this.OnDropDown(evt);
19290 },
19291 getDropDownEvent: function() {
19292  return this.isDropDownModal() || ASPx.Browser.MobileUI && !ASPx.Browser.MacOSMobilePlatform ? "click" : ASPx.TouchUIHelper.touchMouseDownEventName;
19293 },
19294 Initialize: function(){
19295  this.initializePopupControl();
19296  this.AssignClientAttributes();
19297  this.InitLastSuccessText();
19298  if(this.accessibilityCompliant && ASPx.IsExists(this.GetAccessibilityAssistantElement())) {
19299   this.GotFocus.AddHandler(function() { 
19300    this.ariaExplanatoryTextManager.SetHelperLabel(); 
19301   }.aspxBind(this));
19302  }
19303  ASPxClientButtonEditBase.prototype.Initialize.call(this);
19304 },
19305 initializePopupControl: function() {
19306  var pc = this.GetPopupControl();
19307  if(!pc) return;
19308  pc.usedInDropDown = true;
19309  pc.dropDownEditName = this.name;
19310  pc.setFocusOnCallback = false;
19311  this.initializeDropDown(pc);
19312 },
19313 initializeDropDown: function(pc) {
19314  pc = pc || this.GetPopupControl();
19315  if(!pc)
19316   return;
19317  if(this.ddmBP !== undefined) {
19318   pc.AdaptiveModeChanged.AddHandler(function() {
19319    this.onDropDownModalChanged(pc.GetAdaptiveModalMode());
19320   }.bind(this));
19321   pc.PopUp.AddHandler(function() {
19322    if(pc.GetAdaptiveModalMode())
19323     this.onDropDownModalChanged(true);
19324   }.bind(this));
19325   pc.Closing.AddHandler(function() {
19326    if(pc.GetAdaptiveModalMode())
19327     this.onDropDownModalChanged(false);
19328   }.bind(this));
19329  }
19330  this.initializeDropDownCommandButtons(pc);
19331  if(this.flSettings) {
19332   this.initializeDropDownContent(pc, this.flSettings.caption, this.flSettings.helpText);
19333   delete this.flSettings;
19334  }
19335 },
19336 initializeDropDownCommandButtons: function(pc) {
19337  this.dropDownCommandButtons = {};
19338  [CONSTANTS.DROPDOWN_COMMAND_APPLY, CONSTANTS.DROPDOWN_COMMAND_CLOSE].forEac
19338h(function(cmd) {
19339   var button = this.createDropDownCommandButtonClientInstance(pc, cmd);
19340   if(button) {
19341    button.allowFocus = false;
19342    button.useSubmitBehavior = false;
19343    button.causesValidation = false;
19344    button.accessibilityCompliant = this.accessibilityCompliant;
19345    button.Click.AddHandler(this.onDropDownCommandButtonClick.bind(this, cmd));
19346    button.InlineInitialize();
19347    this.dropDownCommandButtons[cmd] = button;
19348   }
19349  }.bind(this));
19350  this.ensureDropDownApplyCommandState();
19351 },
19352 createDropDownCommandButtonClientInstance: function(pc, cmd) {
19353  var buttonElementSelector = "." + CONSTANTS.DROPDOWN_HEADER_CLASS + " .dxbButtonSys[id*=" + cmd + "]";
19354  var popupContentContainer = pc.GetContentContainer(-1);
19355  var buttonElement = popupContentContainer ? popupContentContainer.querySelector(buttonElementSelector) : null;
19356  return buttonElement ? new ASPxClientButton(buttonElement.id) : null;  
19357 },
19358 initializeDropDownContent: function(pc, caption, helpText) {
19359  if(this.ddmBP === undefined)
19360   return;
19361  var container = pc.GetContentContainer(-1);
19362  if(helpText) {
19363   var helpTextContainer = container.querySelector(CONSTANTS.DROPDOWN_HELPTEXT_CLASS);
19364   if(!helpTextContainer) {
19365    helpTextContainer = document.createElement("div");
19366    helpTextContainer.innerHTML = this.HtmlEncode(helpText);
19367    helpTextContainer.className = CONSTANTS.DROPDOWN_HELPTEXT_CLASS + " " + CONSTANTS.DROPDOWN_MODALVISIBLE_CLASS;
19368    container.appendChild(helpTextContainer);
19369   }
19370  }
19371  if(caption && this.ddDefCap) {
19372   var captionContainer = container.querySelector("." + CONSTANTS.DROPDOWN_CAPTION_CLASS);
19373   if(!captionContainer) {
19374    captionContainer = document.createElement("div");
19375    captionContainer.className = CONSTANTS.DROPDOWN_CAPTION_CLASS + " " + CONSTANTS.DROPDOWN_MODALVISIBLE_CLASS;
19376    var headerContainer = container.querySelector("." + CONSTANTS.DROPDOWN_HEADER_CLASS);
19377    if(!headerContainer) {
19378     headerContainer = document.createElement("div");
19379     headerContainer.className = CONSTANTS.DROPDOWN_HEADER_CLASS + " " + CONSTANTS.DROPDOWN_MODALVISIBLE_CLASS;
19380     container.insertBefore(headerContainer, container.firstChild);
19381    }
19382    headerContainer.insertBefore(captionContainer, headerContainer.firstChild);
19383   }
19384   captionContainer.innerHTML = this.HtmlEncode(caption);
19385  }
19386 },
19387 InitLastSuccessText: function(){
19388  var rawText = this.GetTextInternal();
19389  this.SetLastSuccessText(rawText);
19390 },
19391 AssignClientAttributes: function(){
19392  var element = this.GetDropDownButton();
19393  if(ASPx.IsExistsElement(element))
19394   ASPx.Evt.PreventElementDragAndSelect(element, true);
19395 },
19396 SetReadOnlyInternal: function(readOnly) {
19397  ASPxClientButtonEditBase.prototype.SetReadOnlyInternal.call(this, readOnly);
19398  if(this.isDropDownModal())
19399   this.ensureDropDownModalInputVisibility();
19400  this.ensureDropDownApplyCommandState();
19401 },
19402 SetEnabled: function(enabled) {
19403  ASPxClientButtonEditBase.prototype.SetEnabled.call(this, enabled);
19404  this.ensureDropDownApplyCommandState();
19405 },
19406 GetDropDownButton: function(){
19407  return this.GetButton(this.dropDownButtonIndex);
19408 },
19409 GetButtonCollection: function(){
19410  var buttonElements = ASPxClientButtonEditBase.prototype.GetButtonCollection.call(this);
19411  var dropDownButtonElement = this.GetDropDownButton();
19412  if(ASPx.IsExists(dropDownButtonElement))
19413   buttonElements.push(dropDownButtonElement);
19414  return buttonElements;
19415 },
19416 GetPopupControl: function(){
19417  var pc = ASPx.GetControlCollection().Get(this.name + dropDownNameSuffix);
19418  if(pc && pc.GetWindowElement(-1))
19419   return pc;
19420  else
19421   return null;
19422 },
19423 GetDropDownWindow: function() {
19424  var pc = this.GetPopupControl();
19425  if(pc)
19426   return pc.GetWindowElement(-1);
19427  return null;
19428 },
19429 GetDropDownInnerControlName: function(suffix){
19430  var pc = this.GetPopupControl();
19431  if(pc)
19432   return this.GetPopupControl().name + suffix;
19433  return "";
19434 },
19435 GetDropDownItemImageCell: function() {
19436  return ASPx.GetNodesByPartialClassName(this.GetMainElement(), itemImageCellClassName)[0];
19437 },
19438 GetIsControlWidthWasChanged: function(){
19439  return this.mainElementWidthCache == ASPx.InvalidDimension || this.mainElementWidthCache != this.GetMainElement().clientWidth;
19440 },
19441 GetDropDownHeight: function(){
19442  return null;
19443 },
19444 GetDropDownWidth: function(){
19445  return null;
19446 },
19447 GetDropDownIsWindowElement: function(id, pcPostfix) {
19448  var pos = id.lastIndexOf(pcPostfix);
19449  if(pos != -1) {
19450   var name = id.substring(0, pos);
19451   var pc = ASPx.GetPopupControlCollection().Get(name);
19452   if(pc && pc.dropDownEditName)
19453    return aspxGetDropDownCollection().Get(pc.dropDownEditName);
19454  }
19455  return null;
19456 },
19457 GetDropDownParents: function() {
19458  var parents = [ ];
19459  var mainElement = this.GetMainElement();
19460  var element = mainElement.parentNode;
19461  while(element != null){
19462   if(element.tagName == "BODY")
19463    break;
19464   var dropDown = this.GetElementIsDropDownParent(element);
19465   if(dropDown != null)
19466    parents.push(dropDown);
19467   element = element.parentNode;
19468  }
19469  return parents.reverse();
19470 },
19471 GetElementIsDropDownParent: function(element) {
19472  return ASPx.Attr.IsExistsAttribute(element, "id") 
19473   ? this.GetDropDownIsWindowElement(ASPx.Attr.GetAttribute(element, "id"), ASPx.PCWIdSuffix + "-1") : null;
19474 },
19475 BeforePopupControlResizing: function() {
19476 },
19477 AfterPopupControlResizing: function() {
19478 },
19479 AfterPopupControlShown: function() {
19480 },
19481 ShowDropDownArea: function(isRaiseEvent, forceSize) {
19482  this.SetPCIsShowingNow(true);
19483  aspxGetDropDownCollection().RegisterDroppedDownControl(this, this.GetDropDownParents());
19484  if(!this.droppedDown) 
19485   this.SetLockListBoxClick();
19486  this.lockClosing = true; 
19487  var pc = this.GetPopupControl();
19488  var element = this.GetMainElement();
19489  var pcwElement = pc.GetCurrentWindowElement();
19490  pc.OnBeforeDropdownShow();
19491  if(ASPx.Browser.Chrome && pcwElement.clientHeight <= 0) 
19492   this.RestorePopupInsideNonStaticPositionedContainer();
19493  var height = forceSize ? forceSize.height : this.GetDropDownHeight();
19494  var width = forceSize ? forceSize.width : this.GetDropDownWidth();
19495  this.BeforePopupControlResizing();
19496  if(this.ddHeightCache != height || this.ddWidthCache != width || forceSize) {
19497   pc.SetSize(width, height);
19498   if(!forceSize) {
19499    this.ddHeightCache = height;
19500    this.ddWidthCache = width;
19501   }
19502  }
19503  this.AfterPopupControlResizing();
19504  if(ASPx.Browser.Chrome && pcwElement.clientHeight <= 0) 
19505   this.RestorePopupInsideNonStaticPositionedContainer();
19506  this.RaiseDropDownEventRequired = isRaiseEvent;
19507  pc.ShowAtElement(element, true);
19508  this.AfterPopupControlShown();
19509  this.droppedDown = true;
19510  this.lockClosing = false;
19511 },
19512 HideDropDownArea: function(isRaiseEvent){
19513  if(this.lockClosing || !this.droppedDown) return;
19514  if(!this.RaiseQueryCloseUp()) {
19515   return;
19516  }
19517  this.RemoveLockListBoxClick();
19518  this.DropDownButtonPop();
19519  var pc = this.GetPopupControl();
19520  if(pc){
19521   aspxGetDropDownCollection().UnregisterDroppedDownControl(this);
19522   pc.Hide();
19523   if(isRaiseEvent)
19524    this.RaiseCloseUp();
19525   this.droppedDown = false;
19526  }
19527 },
19528 RaiseLostFocus: function() {
19529  this.ensureDropDownClosedOnLostFocus();
19530  ASPxClientButtonEditBase.prototype.RaiseLostFocus.call(this);
19531 },
19532 ensureDropDownClosedOnLostFocus: function() {
19533  if(!this.isDropDownModal() && this.droppedDown)
19534   this.HideDropDownArea(true);
19535 },
19536 RestorePopupInsideNonStaticPositionedContainer: function() {
19537  var pc = this.GetPopupControl();
19538  var pcwElement = pc.GetCurrentWindowElement();
19539  var pcwParentElement = pcwElement.parentNode;
19540  var offsetParentElement = pcwElement.offsetParent;
19541  if(!offsetParentElement || offsetParentElement.tagName == "BODY") return;
19542  pcwParentElement.style.position = "relative";
19543  setTimeout(
19544   function() { 
19545    pcwParentElement.style.position = "";
19546    if(this.focused)
19547     pc.ShowAtElement(this.GetMainElement());
19548   }.aspxBind(this), 0);
19549 },
19550 SetLockListBoxClick: function() {
19551  this.lockListBoxClick = true;
19552 },
19553 RemoveLockListBoxClick: function() {
19554  delete this.lockListBoxClick;
19555 },
19556 ProcessInternalButtonClick: function(buttonIndex) {
19557  return this.dropDownButtonIndex == buttonIndex;
19558 },
19559 ToggleDropDown: function(){
19560  this.OnApplyChanges();
19561  if(this.droppedDown)
19562   this.HideDropDownArea(true);
19563  else
19564   this.ShowDropDownArea(true);  
19565 },
19566 GetTextInternal: function(){
19567  var text = ASPxClientButtonEditBase.prototype.GetValue.call(this);
19568  return text != null ? text : "";
19569 },
19570 SetTextInternal: function(text){
19571  if(!this.GetReadOnly())
19572   this.SetTextBase(text);
19573 },
19574 SetTextBase: function(text) {
19575  ASPxClientButtonEditBase.prototype.SetValue.call(this, text);
19576 },
19577 SetValue: function(value) {
19578  ASPxClientButtonEditBase.prototype.SetValue.call(this, value);
19579  this.SetLastSuccessText(this.GetTextInternal());
19580 },
19581 SetLastSuccessText: function(text){
19582  var tmpText = text;
19583  if(text == null) tmpText = "";
19584  else if(typeof(text) != "string")
19585     tmpText = text.toString();
19586  this.lastSuccessText = tmpText;
19587 },
19588 SetVisible: function(visible) {
19589  ASPxClientButtonEditBase.prototype.SetVisible.call(this, visible);
19590  if(!visible)
19591   this.HideDropDown();
19592 },
19593 RollbackTextInputValue: function () {
19594  this.SetTextBase(this.lastSuccessText);
19595 },
19596 SetPCIsShowingNow: function(value){
19597  this.pcIsShowingNow = value;
19598 },
19599 GetLastSuccesfullValue: function() {
19600  return this.lastSuccessText !== '' ? this.lastSuccessText : null;
19601 },
19602 GetAccessibilityHelper: function() {
19603  if(!this.accessibilityCompliant)
19604   return null;
19605  if(!this.accessibilityHelper)
19606   this.accessibilityHelper = this.CreateAccessibilityHelper();
19607  return this.accessibilityHelper;
19608 },
19609 CreateAccessibilityHelper: function() {
19610  return new ASPx.AccessibilityHelper(this);
19611 },
19612 CreateAriaExplanatoryTextManager: function() {
19613  if(this.accessibilityCompliant)
19614   return new DropDownAccessibilityExplanatoryTextManager(this);
19615  else 
19616   return new ASPx.DisableAccessibilityExplanatoryTextManager(this);
19617 },
19618 GetAccessibilityText: function() {
19619  var labelText = "";
19620  var helperContainer = this.GetAccessibilityAssistantElement();
19621  if(ASPx.IsExists(helperContainer))
19622   labelText = ASPx.Attr.GetAttribute(helperContainer, "aria-label");
19623  return !!labelText ? labelText : this.GetTextInternal();
19624 },
19625 GetAccessibilityActiveElements: function() {
19626  var helperContainer = this.GetAccessibilityAssistantElement();
19627  if(!this.accessibilityCompliant || !ASPx.IsExists(helperContainer))
19628   return [this.GetInputElement()];
19629  return [this.GetAccessibilityHelper().GetActiveElement(true)];
19630 },
19631 OnValueChanged: function() {
19632  this.SetLastSuccessText(this.GetTextInternal());
19633  ASPxClientEdit.prototype.OnValueChanged.call(this);
19634 },
19635 OnApplyChanges: function(){
19636 },
19637 OnCancelChanges: function(){
19638  var isCancelProcessed = (this.GetTextInternal() != this.lastSuccessText);
19639  this.SetTextInternal(this.lastSuccessText);
19640  return isCancelProcessed;
19641 },
19642 OnFocusCore: function () {
19643  if(!this.CorrectFocusWhenDisabled())
19644   this.OnFocusInternal();
19645 },
19646 OnFocusInternal: function() {
19647  this.OnSetFocus(true);
19648  ASPxClientButtonEditBase.prototype.OnFocusCore.call(this);
19649 },
19650 OnLostFocus: function(){
19651  this.OnSetFocus(false);
19652  ASPxClientButtonEditBase.prototype.OnLostFocus.call(this);
19653 },
19654 OnSetFocus: function(isFocused){
19655  aspxGetDropDownCollection().SetFocusedDropDownName(isFocused ? this.name : "");
19656 },
19657 IsEditorElement: function(element) {
19658  if(ASPxClientButtonEditBase.prototype.IsEditorElement.call(this, element))
19659   return true;
19660  if(this.allowFocusDropDownWindow)
19661   return false;
19662  var pc = this.GetPopupControl();
19663  if(pc != null) {
19664   var windowElement = pc.GetCurrentWindowElement();
19665   return windowElement == element || ASPx.GetIsParent(windowElement, element);
19666  }
19667  return false;
19668 },
19669 OnPopupControlShown: function(){
19670  this.SetPCIsShowingNow(false);
19671  if(this.RaiseDropDownEventRequired){
19672   this.RaiseDropDownEventRequired = false;
19673   window.setTimeout(function() { this.RaiseDropDown(); }.aspxBind(this), 0);
19674  }
19675 },
19676 IsCanToDropDown: function(){
19677  return true;
19678 },
19679 OnDropDown: function(evt) { 
19680  if(!this.isInitialized) 
19681   return true;
19682  if(evt.type === ASPx.TouchUIHelper.touchMouseDownEventName && ASPx.Evt.GetEventSource(evt) === this.GetInputElement())
19683   this.OnMouseDown();
19684  if(!this.IsCanToDropDown()) {
19685   this.ForceRefocusEditor(evt);
19686   return true;
19687  }
19688  if(ASPx.Browser.Opera){
19689   if(!this.droppedDown) {
19690    ASPx.Evt.EmulateOnMouseDown(this.GetMainElement(), evt);
19691    ASPx.GetStateController().ClearSavedCurrentPressedElement();
19692   }
19693  }
19694  this.OnDropDownCore(evt);
19695  if(this.needCancelBubbleDropDownEvent())
19696   return ASPx.Evt.CancelBubble(evt); 
19697  return true;
19698 },
19699 OnDropDownCore: function(evt) {
19700  if(!this.droppedDown)
19701   this.DropDownButtonPush();
19702  this.ToggleDropDown();
19703  var isNativeFocus = this.isNativeFocus(evt);
19704  if(!isNativeFocus || (!ASPx.Browser.MacOSMobilePlatform && !ASPx.Browser.AndroidMobilePlatform))
19705   this.ForceRefocusEditor(evt, isNativeFocus);
19706 },
19707 isNativeFocus: function(evt) {
19708  var inputElement = this.GetInputElement();
19709  return !!inputElement ? this.IsElementBelongToInputElement(ASPx.Evt.GetEventSource(evt)) : false;
19710 },
19711 needCancelBubbleDropDownEvent: function() {
19712  return true;
19713 },
19714 DropDownButtonPush: function(){
19715  if(this.droppedDown || this.ddButtonPushed) return;
19716  this.ddButtonPushed = true;
19717  if(ASPx.Browser.Opera)
19718   this.DropDownButtonPushPop(true);
19719  else
19720   this.DropDownButtonPushMozilla();
19721 }, 
19722 DropDownButtonPop: function(force){
19723  if((!this.droppedDown || !this.ddButtonPushed) && !force) return;
19724  this.ddButtonPushed = false;
19725  if(ASPx.Browser.Opera)
19726   this.DropDownButtonPushPop(false);
19727  else
19728   this.DropDownButtonPopMozilla();
19729 },
19730 DropDownButtonPushPop: function(isPush){
19731  var buttonElement = this.GetDropDownButton();
19732  if(buttonElement){
19733   var controller = ASPx.GetStateController();
19734   var element = controller.GetPressedElement(buttonElement);
19735   if(element){
19736    if(isPush){
19737     controller.SetCurrentHoverElement(null);
19738     controller.DoSetPressedState(element);
19739    } else {
19740     controller.DoClearPressedState(element);
19741     controller.SetCurrentPressedElement(null);
19742     controller.SetCurrentHoverElement(element);
19743    }
19744   }
19745  }
19746 },
19747 DropDownButtonPushMozilla: function(){
19748  this.DisableStyleControllerForDDButton();
19749  var controller = ASPx.GetStateController();
19750  controller.savedCurrentPressedElement = null;
19751 },
19752 DropDownButtonPopMozilla: function(){
19753  this.EnableStyleControllerForDDButton();
19754  var controller = ASPx.GetStateController();
19755  var buttonElement = this.GetDropDownButton();
19756  if(buttonElement){
19757   var element = controller.GetPressedElement(buttonElement);
19758   if(element)
19759    controller.DoClearPressedState(element);
19760   controller.currentPressedElement = null;
19761   element = controller.GetHoverElement(buttonElement);
19762   if(element)
19763    controller.SetCurrentHoverElement(element);
19764  }
19765 },
19766 EnableStyleControllerForDDButton: function(){
19767  var element = this.GetDropDownButton();
19768  if(element){
19769   var controller = ASPx.GetStateController();
19770   this.ReplaceElementControlStyleItem(controller.hoverItems, ASPx.HoverItemKind, element, this.ddButtonHoverStyle);
19771   this.ReplaceElementControlStyleItem(controller.pressedItems, ASPx.PressedItemKind, element, this.ddButtonPressedStyle);
19772   this.ReplaceElementControlStyleItem(controller.selectedItems, ASPx.SelectedItemKind, element, this.ddButtonSelectedStyle);
19773  }
19774 },
19775 DisableStyleControllerForDDButton: function(){
19776  var element = this.GetDropDownButton();
19777  if(element){
19778   var controller = ASPx.GetStateController();
19779   this.ddButtonHoverStyle = this.ReplaceElementControlStyleItem(controller.hoverItems, ASPx.HoverItemKind, element, null);
19780   this.ddButtonPressedStyle = this.ReplaceElementControlStyleItem(controller.pressedItems, ASPx.PressedItemKind, element, null);
19781   this.ddButtonSelectedStyle = this.ReplaceElementControlStyleItem(controller.selectedItems, ASPx.SelectedItemKind, element, null);
19782  }
19783 },
19784 ReplaceElementControlStyleItem: function(items, kind, element, newStyleItem){
19785  var styleItem = items[element.id];
19786  items[element.id] = newStyleItem;
19787  element[kind] = newStyleItem;
19788  return styleItem;
19789 },
19790 CloseDropDownByDocumentOrWindowEvent: function(causedByWindowResizing){
19791  if(!causedByWindowResizing || !this.pcIsShowingNow)
19792   this.HideDropDownArea(true);
19793 },
19794 OnDocumentMouseUp: function() {
19795  this.DropDownButtonPop();
19796 },
19797 OnDDButtonMouseMove: function(evt){
19798 },
19799 ShouldCloseOnMCMouseDown: function () {
19800  return true;
19801 },
19802 OnMainCellMouseDown: function (evt) {
19803  if(this.ShouldCloseOnMCMouseDown())
19804   this.OnCloseUp(evt);
19805 },
19806 OnCloseUp: function (evt) {
19807  this.HideDropDownArea(true);
19808 },
19809 OnOpenAnotherDropDown: function(){
19810  this.HideDropDownArea(true);
19811 },
19812 OnTextChanged: function() {
19813  if(!this.ChangedByEnterKeyPress())
19814   this.OnTextChangedInternal();
19815 },
19816 OnTextChangedInternal: function() {
19817  this.ParseValue();
19818 },
19819 ChangedByEnterKeyPress: function() {
19820  if(ASPx.Browser.Firefox || ASPx.Browser.WebKitFamily) 
19821   if(this.enterKeyPressed) {
19822    this.enterKeyPressed = false;
19823    return true;
19824   } 
19825  return false;
19826 },
19827 ChangeEnabledAttributes: function(enabled){
19828  ASPxClientButtonEditBase.prototype.ChangeEnabledAttributes.call(this, enabled);
19829  var btnElement = this.GetDropDownButton();
19830  if(btnElement)
19831   this.ChangeButtonEnabledAttributes(btnElement, this.GetChangeButtonEnabledAttributesMethod(enabled));
19832  var inputElement = this.GetInputElement();
19833  if(inputElement)
19834   this.ChangeInputCellEnabledAttributes(inputElement.parentNode, ASPx.Attr.ChangeAttributesMethod(enabled));
19835  var imageCell = this.GetDropDownItemImageCell();
19836  if(ASPx.IsExists(imageCell))
19837   this.ChangeImageCellEnabledAttributes(imageCell, ASPx.Attr.ChangeAttributesMethod(enabled));
19838 },
19839 ChangeEnabledStateItems: function(enabled){
19840  ASPxClientButtonEditBase.prototype.ChangeEnabledStateItems.call(this, enabled);
19841  var btnElement = this.GetDropDownButton();
19842  if(btnElement)
19843   ASPx.GetStateController().SetElementEnabled(btnElement, enabled);
19844 },
19845 ChangeInputCellEnabledAttributes: function(element, method){
19846  method(element, "onclick");
19847  method(element, "onkeyup");
19848  if(ASPx.Browser.Edge)
19849   method(element, "onmousedown");
19850  method(element, "on" + ASPx.TouchUIHelper.touchMouseDownEventName);
19851  method(element, "on" + ASPx.TouchUIHelper.touchMouseUpEventName);
19852 },
19853 ChangeImageCellEnabledAttributes: function(imageCell, method){
19854  method(imageCell, "onmousedown");
19855 },
19856 InitializeKeyHandlers: function() {
19857  this.AddKeyDownHandler(ASPx.Key.Enter, "OnEnter");
19858  this.AddKeyDownHandler(ASPx.Key.Esc, "OnEscape");
19859  this.AddKeyDownHandler(ASPx.Key.PageUp, "OnPageUp");
19860  this.AddKeyDownHandler(ASPx.Key.PageDown, "OnPageDown");
19861  this.AddKeyDownHandler(ASPx.Key.End, "OnEndKeyDown");
19862  this.AddKeyDownHandler(ASPx.Key.Home, "OnHomeKeyDown");
19863  this.AddKeyDownHandler(ASPx.Key.Left, "OnArrowLeft");
19864  this.AddKeyDownHandler(ASPx.Key.Right, "OnArrowRight");
19865  this.AddKeyDownHandler(ASPx.Key.Up, "OnArrowUp");
19866  this.AddKeyDownHandler(ASPx.Key.Down, "OnArrowDown");
19867  this.AddKeyDownHandler(ASPx.Key.Tab, "OnTab");
19868 },
19869 OnArrowUp: function(evt){
19870  if(evt.altKey) {
19871   this.ToggleDropDown();
19872   return true;
19873  }
19874  return false;
19875 },
19876 OnArrowDown: function(evt){
19877  if(evt.altKey) {
19878   this.ToggleDropDown();
19879   return true;
19880  }
19881  return false;
19882 },
19883 OnPageUp: function(evt){
19884  return false;
19885 }, 
19886 OnPageDown: function(evt){
19887  return false;
19888 },
19889 OnEndKeyDown: function(evt){
19890  return false;
19891 },
19892 OnHomeKeyDown: function(evt){
19893  return false;
19894 },
19895 OnArrowLeft: function(evt){
19896  return false;
19897 },
19898 OnArrowRight: function(evt){
19899  return false;
19900 },
19901 OnEscape: function(evt){
19902  return this.OnEscapeInternal();
19903 },
19904 OnEscapeInternal: function() {
19905  var isCancelProcessed = this.OnCancelChanges() || this.droppedDown;
19906  this.HideDropDownArea(true);
19907  return isCancelProcessed;
19908 },
19909 OnEnter: function(evt){
19910  return false;
19911 },
19912 OnTab: function(evt){
19913  return false;
19914 },
19915 isDropDownModalRequired: function() {
19916  return this.ddmBP && window.innerWidth < this.ddmBP;
19917 },
19918 isDropDownModal: function(undefinedIfPopupIsDifferent) {
19919  var result = this.isDropDownModalRequired();
19920  if(undefinedIfPopupIsDifferent) {
19921   var pc = this.GetPopupControl();
19922   if(pc && pc.GetAdaptiveModalMode(-1) != result)
19923    return undefined;
19924  }
19925  return !!result;
19926 },
19927 onDropDownModalChanged: function(enabled) {
19928  if(!this.ddmInput)
19929   return;
19930  if(enabled)
19931   this.enableDropDownModal();
19932  else
19933   this.disableDropDownModal();
19934  if(this.focusedNullTextElement)
19935   this.ensureAdjustFocusedNullTextElement();
19936 },
19937 enableDropDownModal: function() {
19938  this.loadMainElementHeight();
19939  var pc = this.GetPopupControl();
19940  var contentContainer = pc.GetContentContainer(-1);
19941  var inputContainer = contentContainer.querySelector(".dxdd-input");
19942  var inputElement = this.GetInputElement();
19943  inputContainer.appendChild(inputElement);
19944  if(this.focusedNullTextElement)
19945   inputContainer.appendChild(this.focusedNullTextElement);
19946  this.initializeDropDownModalClearButton(inputContainer);
19947  if(this.dropDownModalClearButton)
19948   this.EnsureClearButtonVisibility();
19949  this.ensureDropDownModalInputVisibility(inputContainer);
19950 },
19951 disableDropDownModal: function() {
19952  this.resetMainElementHeight();
19953  var inputElement = this.GetInputElement();
19954  this.getInputCell().appendChild(inputElement);
19955  if(this.focusedNullTextElement)
19956   this.getInputCell().appendChild(this.focusedNullTextElement);
19957 },
19958 loadMainElementHeight: function() {
19959  var mainElement = this.GetMainElement();
19960  var mainElementHeight = mainElement.style.height;
19961  if(!mainElementHeight) {
19962   var currentHeight = mainElement.getBoundingClientRect().height;
19963   mainElement.style.height = currentHeight + "px";
19964   ASPx.Attr.SetAttribute(mainElement, "data-hasAssignedHeight", true);
19965  }
19966 },
19967 resetMainElementHeight: function() {
19968  var mainElement = this.GetMainElement();
19969  var hasAssignedHeight = ASPx.Attr.GetAttribute(mainElement, "data-hasAssignedHeight");
19970  if(hasAssignedHeight) {
19971   mainElement.style.height = "";
19972   ASPx.Attr.RemoveAttribute(mainElement, "data-hasAssignedHeight");
19973  }
19974 },
19975 ensureDropDownModalInputVisibility: function(inputContainer) {
19976  if(!inputContainer && this.ddmInput) {
19977   var pc = this.GetPopupControl();
19978   inputContainer = pc && pc.GetContentContainer(-1).querySelector(".dxdd-input");
19979  }
19980  if(!inputContainer)
19981   return;
19982  ASPx.ToggleClassNameToElement(inputContainer, "dxdd-readonly", this.GetReadOnly() || !this.GetEnabled());
19983 },
19984 onDropDownCommandButtonClick: function(command) {
19985  if(command === CONSTANTS.DROPDOWN_COMMAND_APPLY)
19986   this.onDropDownApplyCommandClick();
19987  this.onDropDownCloseCommandClick();
19988 },
19989 onDropDownApplyCommandClick: function() {
19990  throw "Not Implemented";
19991 },
19992 onDropDownCloseCommandClick: function() {
19993  throw "Not Implemented";
19994 },
19995 ensureDropDownApplyCommandState: function() {
19996  if(!this.dropDownCommandButtons)
19997   return;
19998  var button = this.dropDownCommandButtons[CONSTANTS.DROPDOWN_COMMAND_APPLY];
19999  if(button)
20000   button.SetEnabled(this.isDropDownApplyCommandEnabled());
20001 },
20002 isDropDownApplyCommandEnabled: function() {
20003  return this.GetEnabled() && !this.GetReadOnly();
20004 },
20005 initializeDropDownModalClearButton: function(inputContainer) {
20006  if(this.dropDownModalClearButton === undefined) {
20007   this.dropDownModalClearButton = inputContainer.querySelector(this.getDropDownModalClearButtonSelector()) || null;
20008   if(this.dropDownModalClearButton)
20009    ASPx.Evt.AttachEventToElement(this.dropDownModalClearButton, "click", this.onClearButtonClick.bind(this));
20010  }
20011 },
20012 getDropDownModalClearButtonSelector: function() {
20013  return ".dxdd-clearbutton";
20014 },
20015 EnsureClearButtonVisibility: function() {
20016  ASPxClientButtonEditBase.prototype.EnsureClearButtonVisibility.call(this);
20017  if(this.dropDownModalClearButton && this.isDropDownModal())
20018   ASPx.SetElementDisplay(this.dropDownModalClearButton, this.RequireShowClearButton());
20019 },
20020 applyFormLayoutItemSettings: function(settings) {
20021  var pc = this.GetPopupControl();
20022  if(pc)
20023   this.initializeDropDownContent(pc, settings.caption, settings.helpText);
20024  else
20025   this.flSettings = settings;
20026 },
20027 getInputCell: function() {
20028  var cell = ASPxClientButtonEditBase.prototype.getInputCell.call(this);
20029  return ASPx.ElementHasCssClass(cell, "dxic") ? cell : this.GetMainElement().querySelector(".dxic");
20030 },
20031 RaiseCloseUp: function(){
20032  if(!this.CloseUp.IsEmpty()){
20033   var args = new ASPxClientEventArgs();
20034   this.CloseUp.FireEvent(this, args);
20035  }
20036 },
20037 RaiseDropDown: function(){
20038  if(!this.DropDown.IsEmpty() && this.isInitialized){
20039   var args = new ASPxClientEventArgs();
20040   this.DropDown.FireEvent(this, args);
20041  }
20042 },
20043 RaiseQueryCloseUp: function(){
20044  if(!this.QueryCloseUp.IsEmpty() && this.isInitialized) {
20045   var args = new ASPxClientCancelEventArgs();
20046   this.QueryCloseUp.FireEvent(this, args);
20047   return !args.cancel;
20048  }
20049  return true;
20050 },
20051 AdjustDropDownWindow: function(){
20052  var pc = this.GetPopupControl();
20053  if(pc) {
20054   pc.AdjustSize();
20055   pc.UpdatePositionAtElement(this.GetMainElement());
20056  }
20057 },
20058 ResetDropDownSizeCache: function(){
20059  this.ddHeightCache = ASPx.InvalidDimension;
20060  this.ddWidthCache = ASPx.InvalidDimension;
20061 },
20062 ShowDropDown: function(){
20063  if(!this.droppedDown)
20064   this.ShowDropDownArea(false);
20065 },
20066 HideDropDown: function(){
20067  if(this.droppedDown)
20068   this.HideDropDownArea(false);
20069 }
20070});
20071var ASPxClientDropDownEdit = ASPx.CreateClass(ASPxClientDropDownEditBase, {
20072 constructor: function(name) {
20073  this.constructor.prototype.constructor.call(this, name);
20074  this.LostFocusInternal = new ASPxClientEvent();
20075  this.dropDownWindowHeight = "";
20076  this.dropDownWindowWidth = "";
20077  this.allowFocusDropDownWindow = true;
20078  this.needAdjustControlsInDropDownWindow = true;
20079  this.DropDownCommandButtonClick = new ASPxClientEvent();
20080 },
20081 UseSpecialKeyboardHandling: function() {
20082  return true;
20083 },
20084 getDropDownEventTargets: function() {
20085  return ASPxClientDropDownEditBase.prototype.getDropDownEventTargets.call(this).concat([
20086   this.shouldDropDownOnMCMouseDown() ? this.getInputCell() : null,
20087  ]);
20088 },
20089 shouldDropDownOnMCMouseDown: function() {
20090  return this.readOnly || !this.allowUserInput;
20091 },
20092 ShouldCloseOnMCMouseDown: function() {
20093  return !this.shouldDropDownOnMCMouseDown();
20094 },
20095 InitializeEvents: function() {
20096  this.LostFocus.AddHandler(this.ProcessLostFocus.aspxBind(this));
20097  this.QueryCloseUp.AddHandler(this.ProcessQueryCloseUp.aspxBind(this));
20098  ASPxClientDropDownEditBase.prototype.InitializeEvents.call(this);
20099 },
20100 BeforePopupControlResizing: function() {
20101  var divContainer = this.GetDropDownDivContainer();
20102  if(divContainer && this.needAdjustControlsInDropDownWindow) {
20103   this.AdjustControlsInDropDownWindow();
20104   ASPx.SetElementDisplay(divContainer, false);
20105  }
20106 },
20107 AfterPopupControlResizing: function() {
20108  var divContainer = this.GetDropDownDivContainer();
20109  if(divContainer && this.needAdjustControlsInDropDownWindow) {
20110   ASPx.SetElementDisplay(divContainer, true);
20111   this.AdjustControlsInDropDownWindow();
20112   this.needAdjustControlsInDropDownWindow = false;
20113  }
20114 },
20115 AdjustControlsInDropDownWindow: function() {
20116  var pc = this.GetPopupControl();
20117  var pcwElement = pc.GetCurrentWindowElement();
20118  ASPx.GetControlCollection().ProcessControlsInContainer(pcwElement, function(control) {
20119   control.AdjustControl(false);
20120  });
20121 },
20122 GetDropDownDivContainer: function() {
20123  return ASPx.GetElementById(this.name + dropDownNameSuffix + "_DDDC");
20124 },
20125 GetDropDownHeight: function(){
20126  if(this.dropDownWindowHeight != "")
20127   return this.dropDownWindowHeight;
20128  return ASPxClientDropDownEditBase.prototype.GetDropDown
20128Height.call(this);
20129 },
20130 GetDropDownWidth: function(){
20131  if(this.dropDownWindowWidth != "")
20132   return this.dropDownWindowWidth;
20133  return this.GetMainElement().offsetWidth;
20134 },
20135 CloseDropDownByDocumentOrWindowEvent: function(causedByWindowResizing){
20136  if(!ASPx.GetPopupControlCollection().WindowResizeByBodyScrollVisibilityChangingLocked())
20137   ASPxClientDropDownEditBase.prototype.CloseDropDownByDocumentOrWindowEvent.call(this, causedByWindowResizing);
20138 },
20139 OnBrowserWindowResize: function(e){
20140  this.needAdjustControlsInDropDownWindow = true;
20141 },
20142 OnEnter: function(evt){
20143  return this.droppedDown;
20144 },
20145 OnEscape: function(evt){
20146  var isCancelProcessed = this.droppedDown;
20147  this.HideDropDownArea(true);
20148  return isCancelProcessed;
20149 },
20150 OnTextChanged: function() {
20151  this.OnValueChanged();
20152 },
20153 ProcessLostFocus: function() {
20154  if(!this.droppedDown)
20155   this.RaiseLostFocusInternal();
20156 },
20157 ProcessQueryCloseUp: function() {
20158  if(this.focused)
20159   return;
20160  var forceRefocusTimeout = 150;
20161  setTimeout(function() {
20162   if(!this.IsDropDownContainsFocus())
20163    this.RaiseLostFocusInternal();
20164  }.aspxBind(this), forceRefocusTimeout);
20165 },
20166 IsDropDownContainsFocus: function() {
20167  return ASPx.GetIsParent(this.GetDropDownWindow(), ASPx.GetActiveElement());
20168 },
20169 GetKeyValueInternal: function(){
20170  if(ASPx.IsExists(this.stateObject))
20171   return this.stateObject.keyValue;
20172  return null;
20173 },
20174 SetKeyValueInternal: function(keyValue){
20175  this.UpdateStateObjectWithObject({ keyValue: keyValue });
20176 },
20177 GetValueString: function() {
20178  var value = this.GetKeyValue();
20179  return (value === null || value === "") ? ASPxClientDropDownEditBase.prototype.GetValueString.call(this) : value.toString();
20180 },
20181 onDropDownCommandButtonClick: function(action) {
20182  this.raiseDropDownCommandButtonClick(action);
20183 },
20184 raiseDropDownCommandButtonClick: function(command) {
20185  var args = new ASPxClientDropDownCommandEventArgs(command);
20186  if(!this.DropDownCommandButtonClick.IsEmpty())
20187   this.DropDownCommandButtonClick.FireEvent(this, args);
20188  return !args.cancel;
20189 },
20190 GetKeyValue: function(){
20191  return this.GetKeyValueInternal();
20192 },
20193 SetKeyValue: function(keyValue){
20194  this.SetKeyValueInternal(keyValue);
20195 },
20196 RaiseLostFocusInternal: function() {
20197  if(!this.isInitialized)
20198   return;
20199  this.ensureDropDownClosedOnLostFocus();
20200  if(this.LostFocusInternal.IsEmpty())
20201   return;
20202  var args = new ASPxClientEventArgs();
20203  this.LostFocusInternal.FireEvent(this, args);
20204 },
20205 ensureDropDownClosedOnLostFocus: function() { }
20206});
20207ASPxClientDropDownEdit.Cast = ASPxClientControl.Cast;
20208var ASPxClientDropDownCollection = ASPx.CreateClass(ASPxClientControlCollection, {
20209 constructor: function() {
20210  this.constructor.prototype.constructor.call(this);
20211  this.droppedControlName = "";
20212  this.droppedParentNames = [ ];
20213  this.focusedControlName = "";
20214 },
20215 GetCollectionType: function(){
20216  return "DropDown";
20217 },
20218 SetFocusedDropDownName: function(name){
20219  this.focusedControlName = name;
20220 },
20221 ResetDroppedDownControl: function(){
20222  this.droppedControlName = "";
20223 },
20224 ResetDroppedDownParentCollection: function(startDroppedDownControlName) {
20225  var regArray = [ ];
20226  for(var i = 0; i < this.droppedParentNames.length; i++) {
20227   if(this.droppedParentNames[i] == startDroppedDownControlName)
20228    break;
20229   regArray.push(this.droppedParentNames[i]);
20230  }
20231  this.droppedParentNames = regArray;
20232  if(this.droppedParentNames.length > 0) {
20233   this.droppedControlName = this.droppedParentNames[this.droppedParentNames.length - 1];
20234   ASPx.Data.ArrayRemoveAt(this.droppedParentNames, this.droppedParentNames.length - 1);
20235  }
20236 },
20237 ResetFocusedControl: function(){
20238  this.focusedControlName = "";
20239 },
20240 GetFocusedDropDown: function(){
20241  var control = this.GetDropDownControlInternal(this.focusedControlName);
20242  if(control == null) this.ResetFocusedControl();
20243  return control;
20244 },
20245 GetDroppedDropDown: function(){
20246  var control = this.GetDropDownControlInternal(this.droppedControlName);
20247  if(control == null) this.ResetDroppedDownControl();
20248  return control;
20249 },
20250 GetDroppedDropDownParents: function(startDroppedDownControlName) {
20251  var dropDownArray = [ ];
20252  var isNeedGetControl = false;
20253  for(var i = 0; i < this.droppedParentNames.length; i++) {
20254   if(this.droppedParentNames[i] == startDroppedDownControlName) isNeedGetControl = true;
20255   if(isNeedGetControl) {
20256    var control = this.GetDropDownControlInternal(this.droppedParentNames[i]);
20257    if(control != null)
20258     dropDownArray.push(control);
20259   }
20260  }
20261  return dropDownArray;
20262 },
20263 FindFirstNameForClose: function(newDroppedDownParentArray) {
20264  var firstNameToClose = newDroppedDownParentArray.length > 0 ? "" : this.droppedParentNames[i];
20265  for(var i = 0; i < this.droppedParentNames.length; i++) {
20266   if(ASPx.Data.ArrayIndexOf(newDroppedDownParentArray, this.Get(this.droppedParentNames[i])) == -1) {
20267    firstNameToClose = this.droppedParentNames[i];
20268    break;
20269   }
20270  }
20271  return firstNameToClose;
20272 },
20273 GetDropDownControlInternal: function(name){
20274  var control = this.Get(name);
20275  var isControlExists = control && !control.IsDOMDisposed();
20276  if(!isControlExists)
20277   control = null;
20278  return control;
20279 },
20280 IsDroppedDropDownParentExist: function(name) {
20281  for(var i = 0; i < this.droppedParentNames.length; i++) {
20282   if(this.droppedParentNames[i] == name)
20283    return true;
20284  }
20285  return false;
20286 },
20287 OnDDButtonMouseMove: function(evt){
20288  var dropDownControl = this.GetDroppedDropDown();
20289  if(dropDownControl != null)
20290   dropDownControl.OnDDButtonMouseMove(evt);
20291 },
20292 OnDocumentMouseDown: function(evt){
20293  if(ASPxClientControl.documentDropDownMouseDownLocked) return; 
20294  if(!ASPx.TouchUIHelper.handleFastTapIfRequired(evt, function(){ this.CloseDropDownByDocumentOrWindowEvent(evt, false); }.aspxBind(this), false))
20295   this.CloseDropDownByDocumentOrWindowEvent(evt, false);
20296 },
20297 OnDocumentMouseUp: function(evt){
20298  var dropDownControl = this.GetDroppedDropDown();
20299  if(dropDownControl != null)
20300   dropDownControl.OnDocumentMouseUp();
20301 },
20302 OnBrowserWindowResize: function(e){
20303  if(typeof(ASPx.GetPopupControlCollection) != "undefined" && !ASPx.GetPopupControlCollection().WindowResizeByBodyScrollVisibilityChangingLocked()){
20304   this.CloseDropDownByDocumentOrWindowEvent(e.htmlEvent, true);
20305   this.AdjustControls();
20306  }
20307 },
20308 CloseDropDownByDocumentOrWindowEvent: function(evt, causedByWindowResizing){
20309  var dropDownControl = this.GetDroppedDropDown();
20310  if(dropDownControl != null && (this.IsEventNotFromControlSelf(evt, dropDownControl) || causedByWindowResizing))
20311   dropDownControl.CloseDropDownByDocumentOrWindowEvent(causedByWindowResizing);
20312  var childrenDropDownsToClose = this.GetDroppedDropDownParents(this.droppedParentNames[0]);
20313  if(childrenDropDownsToClose.length != 0) {
20314   childrenDropDownsToClose = childrenDropDownsToClose.reverse();
20315   this.ResetDroppedDownParentCollection(this.droppedParentNames[0]);
20316   var rollbackDroppedDownNames = [ ];
20317   for(var c = 0; c < childrenDropDownsToClose.length; c++) {
20318    if(this.IsEventNotFromControlSelf(evt, childrenDropDownsToClose[c]))
20319     childrenDropDownsToClose[c].CloseDropDownByDocumentOrWindowEvent(causedByWindowResizing);
20320    else
20321     rollbackDroppedDownNames.push(childrenDropDownsToClose[c].name);
20322   }
20323   if(rollbackDroppedDownNames != 0) {
20324    rollbackDroppedDownNames = rollbackDroppedDownNames.reverse();
20325    this.droppedParentNames = rollbackDroppedDownNames;
20326   }
20327  }
20328 },
20329 AdjustControls: function(){
20330  this.ForEachControl(function(control) {
20331   control.AdjustControl(false);
20332  });
20333 },
20334 IsEventNotFromControlSelf: function(evt, control){
20335  var srcElement = ASPx.Evt.GetEventSource(evt);
20336  var mainElement = control.GetMainElement();
20337  var dropDownWindow = control.GetDropDownWindow();
20338  if(!srcElement || !mainElement || !dropDownWindow) return true;
20339  return (!ASPx.GetIsParent(mainElement, srcElement) &&
20340   !ASPx.GetIsParent(dropDownWindow, srcElement) &&
20341   !this.IsEventFromSharedPopupOfInnerEditor(dropDownWindow, srcElement));
20342 },
20343 IsEventFromSharedPopupOfInnerEditor: function(dropDownWindow, srcElement) {
20344  var eventFromPopupOfInnerEditor = false;
20345  ASPx.GetControlCollection().ProcessControlsInContainer(dropDownWindow,
20346   function(control){
20347    if(control.calendarOwnerName) {
20348     var sharedCalendarPopup = control.GetCalendarOwner().GetDropDownWindow();
20349     if(ASPx.GetIsParent(sharedCalendarPopup, srcElement))
20350      eventFromPopupOfInnerEditor = true;
20351    }
20352  });
20353  return eventFromPopupOfInnerEditor;
20354 },
20355 RegisterDroppedDownControl: function(dropDownControl, droppedDownParentArray){
20356  var prevDropDownControl = this.GetDroppedDropDown();
20357  var areDroppedDownsCollectionParents = ASPx.Data.ArrayIndexOf(droppedDownParentArray, prevDropDownControl) != -1;
20358  if(prevDropDownControl != null && prevDropDownControl != dropDownControl && !areDroppedDownsCollectionParents)
20359   prevDropDownControl.OnOpenAnotherDropDown();
20360  if(this.droppedParentNames.length > 0) {
20361   var firstDropDownsNameToClose = this.FindFirstNameForClose(droppedDownParentArray);
20362   if(firstDropDownsNameToClose != "") {
20363    var childrenDropDownsToClose = this.GetDroppedDropDownParents(firstDropDownsNameToClose);
20364    this.ResetDroppedDownParentCollection(firstDropDownsNameToClose);
20365    this.CloseDroppedDownCollection(childrenDropDownsToClose.reverse());
20366   }
20367  }
20368  this.droppedControlName = dropDownControl.name;
20369  this.droppedParentNames = [ ];
20370  for(var i = 0; i < droppedDownParentArray.length; i++)
20371   this.droppedParentNames.push(droppedDownParentArray[i].name);
20372 },
20373 UnregisterDroppedDownControl: function(dropDownControl){
20374  if(this.droppedControlName == dropDownControl.name)
20375   this.ResetDroppedDownControl();
20376  if(this.IsDroppedDropDownParentExist(dropDownControl.name)) {
20377   var prevDropDownControl = this.GetDroppedDropDown();
20378   if(prevDropDownControl != null)
20379    prevDropDownControl.OnOpenAnotherDropDown();
20380   var childrenDropDownsToClose = this.GetDroppedDropDownParents(dropDownControl.name);
20381   this.ResetDroppedDownParentCollection(dropDownControl.name);
20382   ASPx.Data.ArrayRemoveAt(childrenDropDownsToClose, 0);
20383   this.CloseDroppedDownCollection(childrenDropDownsToClose.reverse());
20384  }
20385 },
20386 CloseDroppedDownCollection: function(dropDownParentArray) {
20387  for(var c = 0; c < dropDownParentArray.length; c++)
20388   dropDownParentArray[c].OnOpenAnotherDropDown();
20389 }
20390});
20391var DropDownAccessibilityExplanatoryTextManager = ASPx.CreateClass(ASPx.EditAccessibilityExplanatoryTextManager , {
20392 constructor: function(editor) {
20393  this.constructor.prototype.constructor.call(this, editor);
20394 },
20395 SetHelperLabel: function() {
20396  var pronounceText = this.editor.GetAccessibilityText();
20397  var labelElements = ASPx.FindAssociatedLabelElements(this.editor);
20398  if(labelElements.length > 0) {
20399   var labelText = labelElements.map(function(label) { return ASPx.GetInnerText(label); }).join(" ");
20400   if(pronounceText.indexOf(labelText) < 0)
20401    pronounceText = labelText + " " + pronounceText;
20402  }
20403  var pronounceElement = !!this.editor.accessibilityHelper ?
20404   this.editor.accessibilityHelper.GetPronounceElement() :
20405   this.editor.GetAccessibilityAssistantElement();
20406  ASPx.Attr.SetAttribute(pronounceElement, "aria-label", pronounceText);
20407  var textElement = this.GetTextElement();
20408  if(ASPx.IsExists(textElement)) {
20409   if(!ASPx.IsExists(ASPx.Attr.GetAttribute(this.editor.GetInputElement(), 'aria-activedescendant')))
20410    pronounceElement = this.editor.GetInputElement();
20411   this.SetOrRemoveText([pronounceElement], textElement, true, false, false);
20412   setTimeout(function() {
20413    this.SetOrRemoveText([pronounceElement], textElement, false, false, false);
20414   }.aspxBind(this), 500);
20415  }
20416 }
20417});
20418var ASPxClientDropDownCommandEventArgs = ASPx.CreateClass(ASPxClientCancelEventArgs, {
20419 constructor: function (command) {
20420  this.constructor.prototype.constructor.call(this);
20421  this.commandName = command;
20422 }
20423});
20424var dropDownCollection = null;
20425function aspxGetDropDownCollection() {
20426 if(dropDownCollection == null)
20427  dropDownCollection  = new ASPxClientDropDownCollection();
20428 return dropDownCollection;
20429}
20430ASPx.Ident.IsASPxClientDateEdit = function(obj) {
20431 return !!obj.isASPxClientDateEdit;
20432};
20433ASPx.DDMC_MD = function(name, evt) {
20434 var dd = ASPx.GetControlCollection().Get(name);
20435 if(dd)
20436  dd.OnMainCellMouseDown(evt);
20437};
20438ASPx.DDBPCShown = function(name){
20439 var cb = ASPx.GetControlCollection().Get(name);
20440 if(cb != null) cb.OnPopupControlShown();
20441};
20442ASPx.CBLBSelectedIndexChanged = function(name, evt){
20443 var cb = ASPx.GetControlCollection().Get(name);
20444 if(cb != null) cb.OnLBSelectedIndexChanged();
20445};
20446ASPx.CBLBItemMouseUp = function(name, evt){
20447 var cb = ASPx.GetControlCollection().Get(name);
20448 if(cb != null) cb.OnListBoxItemMouseUp(evt);
20449};
20450ASPx.Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseDownEventName, function(evt) {
20451 return aspxGetDropDownCollection().OnDocumentMouseDown(evt);
20452});
20453ASPx.Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseUpEventName, function(evt) {
20454 return aspxGetDropDownCollection().OnDocumentMouseUp(evt);
20455});
20456window.ASPxClientDropDownEditBase = ASPxClientDropDownEditBase;
20457window.ASPxClientDropDownEdit = ASPxClientDropDownEdit;
20458ASPx.GetDropDownCollection = aspxGetDropDownCollection;
20459})();
20460
20461(function () {
20462 var PositionAnimationTransition = ASPx.CreateClass(ASPx.AnimationTransitionBase, {
20463  constructor: function (element, options) {
20464   this.constructor.prototype.constructor.call(this, element, options);
20465   this.direction = options.direction;
20466   this.animationTransition = this.createAnimationTransition();
20467   AnimationHelper.appendWKAnimationClassNameIfRequired(this.element);
20468  },
20469  Start: function (to) {
20470   var from = this.GetValue();
20471   if(ASPx.AnimationUtils.CanUseCssTransform()) {
20472    from = this.convertPosToCssTransformPos(from);
20473    to = this.convertPosToCssTransformPos(to);
20474   }
20475   this.animationTransition.Start(from, to);
20476  },
20477  SetValue: function (value) {
20478   ASPx.AnimationUtils.SetTransformValue(this.element, value, this.direction == AnimationHelper.SLIDE_VERTICAL_DIRECTION);
20479  },
20480  GetValue: function () {
20481   return ASPx.AnimationUtils.GetTransformValue(this.element, this.direction == AnimationHelper.SLIDE_VERTICAL_DIRECTION);
20482  },
20483  createAnimationTransition: function () {
20484   var transition = ASPx.AnimationUtils.CanUseCssTransform() ? this.createTransformAnimationTransition() : this.createPositionAnimationTransition();
20485   transition.transition = ASPx.AnimationConstants.Transitions.POW_EASE_OUT;
20486   return transition;
20487  },
20488  createTransformAnimationTransition: function () {
20489   return ASPx.AnimationUtils.createCssAnimationTransition(this.element, {
20490    property: ASPx.AnimationUtils.CanUseCssTransform(),
20491    duration: this.duration,
20492    onComplete: this.onComplete
20493   });
20494  },
20495  createPositionAnimationTransition: function () {
20496   return AnimationHelper.createAnimationTransition(this.element, {
20497    property: this.direction == AnimationHelper.SLIDE_VERTICAL_DIRECTION ? "top" : "left",
20498    unit: "px",
20499    duration: this.duration,
20500    onComplete: this.onComplete
20501   });
20502  },
20503  convertPosToCssTransformPos: function (position) {
20504   return ASPx.AnimationUtils.GetTransformCssText(position, this.direction == AnimationHelper.SLIDE_VERTICAL_DIRECTION);
20505  }
20506 });
20507 var AnimationHelper = {
20508  SLIDE_HORIZONTAL_DIRECTION: 0,
20509  SLIDE_VERTICAL_DIRECTION: 1,
20510  SLIDE_TOP_DIRECTION: 0,
20511  SLIDE_RIGHT_DIRECTION: 1,
20512  SLIDE_BOTTOM_DIRECTION: 2,
20513  SLIDE_LEFT_DIRECTION: 3,
20514  SLIDE_CONTAINER_CLASS: "dxAC",
20515  MAXIMUM_DEPTH: 3,
20516  createAnimationTransition: function (element, options) {
20517   if(options.onStep)
20518    options.animationEngineType = AnimationEngineType.JS;
20519   switch(options.animationEngineType) {
20520    case AnimationEngineType.JS:
20521     return ASPx.AnimationUtils.createJsAnimationTransition(element, options);
20522    case AnimationEngineType.CSS:
20523     return ASPx.AnimationUtils.createCssAnimationTransition(element, options);
20524    default:
20525     return ASPx.AnimationUtils.CanUseCssTransition() ? ASPx.AnimationUtils.createCssAnimationTransition(element, options) :
20526      ASPx.AnimationUtils.createJsAnimationTransition(element, options);
20527   }
20528  },
20529  createMultipleAnimationTransition: function (element, options) {
20530   return ASPx.AnimationUtils.createMultipleAnimationTransition(element, options);
20531  },
20532  createSimpleAnimationTransition: function (options) {
20533   return ASPx.AnimationUtils.createSimpleAnimationTransition(options);
20534  },
20535  cancelAnimation: function (element) {
20536   ASPx.AnimationTransitionBase.Cancel(element);
20537  },
20538  fadeIn: function(element, onComplete, duration, animationEngineType) {
20539   AnimationHelper.fadeTo(element, {
20540    from: 0, to: 1,
20541    onComplete: onComplete,
20542    animationEngineType: animationEngineType || AnimationEngineType.DEFAULT,
20543    duration: duration || ASPx.AnimationConstants.Durations.DEFAULT
20544   });
20545  },
20546  fadeOut: function(element, onComplete, duration, animationEngineType) {
20547   AnimationHelper.fadeTo(element, {
20548    from: ASPx.GetElementOpacity(element), to: 0,
20549    onComplete: onComplete,
20550    animationEngineType: animationEngineType || AnimationEngineType.DEFAULT,
20551    duration: duration || ASPx.AnimationConstants.Durations.DEFAULT
20552   });
20553  },
20554  fadeTo: function (element, options) {
20555   options.property = "opacity";
20556   if(!options.duration)
20557    options.duration = ASPx.AnimationConstants.Durations.SHORT;
20558   var transition = AnimationHelper.createAnimationTransition(element, options);
20559   if(!ASPx.IsExists(options.from))
20560    options.from = transition.GetValue();
20561   transition.Start(options.from, options.to);
20562  },
20563  slideIn: function (element, direction, onComplete, animationEngineType, rtl) {
20564   AnimationHelper.setOpacity(element, 1);
20565   var animationContainer = AnimationHelper.getSlideAnimationContainer(element, true, true);
20566   var pos = AnimationHelper.getSlideInStartPos(animationContainer, direction, rtl);
20567   var transition = AnimationHelper.createSlideTransition(animationContainer, direction,
20568    function (el) {
20569     AnimationHelper.resetSlideAnimationContainerSize(animationContainer);
20570     if(onComplete)
20571      onComplete(el);
20572    }, animationEngineType, rtl);
20573   transition.Start(pos, 0);
20574  },
20575  slideOut: function (element, direction, onComplete, animationEngineType, rtl) {
20576   var animationContainer = AnimationHelper.getSlideAnimationContainer(element, true, true);
20577   var pos = AnimationHelper.getSlideOutFinishPos(animationContainer, direction, rtl);
20578   var transition = AnimationHelper.createSlideTransition(animationContainer, direction,
20579    function (el) {
20580     AnimationHelper.setOpacity(el.firstChild, 0);
20581     if(onComplete)
20582      onComplete(el);
20583    }, animationEngineType, rtl);
20584   transition.Start(pos);
20585  },
20586  slideTo: function (element, options) {
20587   if(!ASPx.IsExists(options.direction))
20588    options.direction = AnimationHelper.SLIDE_HORIZONTAL_DIRECTION;
20589   var transition = new PositionAnimationTransition(element, options);
20590   transition.Start(options.to);
20591  },
20592  setOpacity: function (element, value) {
20593   ASPx.AnimationUtils.setOpacity(element, value);
20594  },
20595  appendWKAnimationClassNameIfRequired: function (element) {
20596   if(ASPx.AnimationUtils.CanUseCssTransform() && ASPx.Browser.WebKitFamily && !ASPx.ElementHasCssClass(element, "dx-wbv"))
20597    element.className += " dx-wbv";
20598  },
20599  findSlideAnimationContainer: function (element) {
20600   var container = element;
20601   for(var i = 0; i < AnimationHelper.MAXIMUM_DEPTH; i++) {
20602    if(container.tagName == "BODY")
20603     return null;
20604    if(ASPx.ElementHasCssClass(container, AnimationHelper.SLIDE_CONTAINER_CLASS))
20605     return container;
20606    container = container.parentNode;
20607   }
20608   return null;
20609  },
20610  createSlideAnimationContainer: function (element) {
20611   var rootContainer = document.createElement("DIV");
20612   ASPx.SetStyles(rootContainer, {
20613    className: AnimationHelper.SLIDE_CONTAINER_CLASS,
20614    overflow: "hidden"
20615   });
20616   var elementContainer = document.createElement("DIV");
20617   rootContainer.appendChild(elementContainer);
20618   var parentNode = element.parentNode;
20619   parentNode.insertBefore(rootContainer, element);
20620   elementContainer.appendChild(element);
20621   return rootContainer;
20622  },
20623  getSlideAnimationContainer: function (element, create, fixSize) {
20624   if(!element) return;
20625   var width = element.offsetWidth;
20626   var height = element.offsetHeight;
20627   var container;
20628   if(element.className == AnimationHelper.SLIDE_CONTAINER_CLASS)
20629    container = element;
20630   if(!container)
20631    container = AnimationHelper.findSlideAnimationContainer(element);
20632   if(!container && create)
20633    container = AnimationHelper.createSlideAnimationContainer(element);
20634   if(container && fixSize) {
20635    ASPx.SetStyles(container, {
20636     width: width, height: height
20637    });
20638    ASPx.SetStyles(container.firstChild, {
20639     width: width, height: height
20640    });
20641   }
20642   return container;
20643  },
20644  resetSlideAnimationContainerSize: function (container) {
20645   ASPx.SetStyles(container, {
20646    width: "", height: ""
20647   });
20648   ASPx.SetStyles(container.firstChild, {
20649    width: "", height: ""
20650   });
20651  },
20652  getModifyProperty: function (direction, rtl) {
20653   if(direction == AnimationHelper.SLIDE_TOP_DIRECTION || direction == AnimationHelper.SLIDE_BOTTOM_DIRECTION)
20654    return "marginTop";
20655   return rtl ? "margin-right" : "margin-left";
20656  },
20657  createSlideTransition: function (animationContainer, direction, complete, animationEngineType, rtl) {
20658   if(rtl == undefined)
20659    rtl = false;
20660   return AnimationHelper.createAnimationTransition(animationContainer.firstChild, {
20661    unit: "px",
20662    property: AnimationHelper.getModifyProperty(direction, rtl),
20663    onComplete: complete,
20664    animationEngineType: animationEngineType
20665   });
20666  },
20667  getSlideInStartPos: function (animationContainer, direction, rtl) {
20668   var dir = rtl ? -1 : 1;
20669   switch (direction) {
20670    case AnimationHelper.SLIDE_TOP_DIRECTION:
20671     return animationContainer.offsetHeight;
20672    case AnimationHelper.SLIDE_LEFT_DIRECTION:
20673     return animationContainer.offsetWidth * dir;
20674    case AnimationHelper.SLIDE_RIGHT_DIRECTION:
20675     return -animationContainer.offsetWidth * dir;
20676    case AnimationHelper.SLIDE_BOTTOM_DIRECTION:
20677     return -animationContainer.offsetHeight;
20678   }
20679  },
20680  getSlideOutFinishPos: function (animationContainer, direction, rtl) {
20681   var dir = rtl ? -1 : 1;
20682   switch (direction) {
20683    case AnimationHelper.SLIDE_TOP_DIRECTION:
20684     return -animationContainer.offsetHeight;
20685    case AnimationHelper.SLIDE_LEFT_DIRECTION:
20686     return -animationContainer.offsetWidth * dir;
20687    case AnimationHelper.SLIDE_RIGHT_DIRECTION:
20688     return animationContainer.offsetWidth * dir;
20689    case AnimationHelper.SLIDE_BOTTOM_DIRECTION:
20690     return animationContainer.offsetHeight;
20691   }
20692  }
20693 };
20694 var GestureHandler = ASPx.CreateClass(null, {
20695  constructor: function (getAnimationElement, canHandle, allowStart) {
20696   this.getAnimationElement = getAnimationElement;
20697   this.canHandle = canHandle;
20698   this.allowStart = allowStart;
20699   this.startMousePosX = 0;
20700   this.startMousePosY = 0;
20701   this.startTime = null;
20702   this.isEventsPrevented = false;
20703   this.savedElements = [];
20704  },
20705  OnSelectStart: function(evt) {
20706   ASPx.Evt.PreventEvent(evt); 
20707  },
20708  OnDragStart: function(evt) {
20709   ASPx.Evt.PreventEvent(evt);  
20710  },
20711  OnMouseDown: function (evt) {
20712   this.startMousePosX = ASPx.Evt.GetEventX(evt);
20713   this.startMousePosY = ASPx.Evt.GetEventY(evt);
20714   this.startTime = new Date();
20715  },
20716  OnMouseMove: function(evt) {
20717   if(!ASPx.Browser.MobileUI)
20718    ASPx.Selection.Clear();
20719   if(Math.abs(this.GetCurrentDistanceX(evt)) < GestureHandler.SLIDER_MIN_START_DISTANCE && Math.abs(this.GetCurrentDistanceY(evt)) < GestureHandler.SLIDER_MIN_START_DISTANCE)
20720    GesturesHelper.isExecutedGesture = false;
20721  },
20722  OnMouseUp: function (evt) {
20723  },
20724  CanHandleEvent: function (evt) {
20725   return !this.canHandle || this.canHandle(evt);
20726  },
20727  IsStartAllowed: function(value) {
20728   return !this.allowStart || this.allowStart(value);
20729  },
20730  RollbackGesture: function () {
20731  },
20732  GetRubberPosition: function (position) {
20733   return position / GestureHandler.FACTOR_RUBBER;
20734  },
20735  GetCurrentDistanceX: function (evt) {
20736   return ASPx.Evt.GetEventX(evt) - this.startMousePosX;
20737  },
20738  GetCurrentDistanceY: function (evt) {
20739   return ASPx.Evt.GetEventY(evt) - this.startMousePosY;
20740  },
20741  GetDistanceLimit: function () {
20742   return (new Date() - this.startTime) < GestureHandler.MAX_TIME_SPAN ? GestureHandler.MIN_DISTANCE_LIMIT : GestureHandler.MAX_DISTANCE_LIMIT;
20743  },
20744  GetContainerElement: function () {
20745  },
20746  AttachPreventEvents: function (evt) {
20747   if(!this.isEventsPrevented) {
20748    var element = ASPx.Evt.GetEventSource(evt);
20749    var container = this.GetContainerElement();
20750    while(element && element != container) {
20751     ASPx.Evt.AttachEventToElement(element, "mouseup", ASPx.Evt.PreventEvent);
20752     ASPx.Evt.AttachEventToElement(element, "click", ASPx.Evt.PreventEvent);
20753     this.savedElements.push(element);
20754     element = element.parentNode;
20755    }
20756    this.isEventsPrevented = true;
20757   }
20758  },
20759  DetachPreventEvents: function () {
20760   if(this.isEventsPrevented) {
20761    window.setTimeout(function () {
20762     while(this.savedElements.length > 0) {
20763      var element = this.savedElements.pop();
20764      ASPx.Evt.DetachEventFromElement(element, "mouseup", ASPx.Evt.PreventEvent);
20765      ASPx.Evt.DetachEventFromElement(element, "click", ASPx.Evt.PreventEvent);
20766     }
20767    }.aspxBind(this), 0);
20768    this.isEventsPrevented = false;
20769   }
20770  }
20771 });
20772 GestureHandler.MAX_DISTANCE_LIMIT = 70;
20773 GestureHandler.MIN_DISTANCE_LIMIT = 10;
20774 GestureHandler.MIN_START_DISTANCE = 0;
20775 GestureHandler.SLIDER_MIN_START_DISTANCE = 5;
20776 GestureHandler.MAX_TIME_SPAN = 300;
20777 GestureHandler.FACTOR_RUBBER = 4;
20778 GestureHandler.RETURN_ANIMATION_DURATION = 150;
20779 var SwipeSlideGestureHandler = ASPx.CreateClass(GestureHandler, {
20780  constructor: function (getAnimationElement, direction, canHandle, backward, forward, rollback, move) {
20781   this.constructor.prototype.constructor.call(this, getAnimationElement, canHandle);
20782   this.slideElement = this.getAnimationElement();
20783   this.container = this.slideElement.parentNode;
20784   this.direction = direction;
20785   this.backward = backward;
20786   this.forward = forward;
20787   this.rollback = rollback;
20788   this.slideElementSize = 0;
20789   this.containerElementSize = 0;
20790   this.startSliderElementPosition = 0;
20791   this.centeredSlideElementPosition = 0;
20792  },
20793  OnMouseDown: function (evt) {
20794   GestureHandler.prototype.OnMouseDown.call(this, evt);
20795   this.slideElementSize = this.GetElementSize();
20796   this.startSliderElementPosition = this.GetElementPosition();
20797   this.containerElementSize = this.GetContainerElementSize();
20798   if(this.slideElementSize <= this.containerElementSize)
20799    this.centeredSlideElementPosition = (this.containerElementSize - this.slideElementSize) / 2;
20800  },
20801  OnMouseMove: function (evt) {
20802   GestureHandler.prototype.OnMouseMove.call(this, evt);
20803   if(!ASPx.Browser.TouchUI && !ASPx.GetIsParent(this.container, ASPx.Evt.GetEventSource(evt))) {
20804    GesturesHelper.OnDocumentMouseUp(evt);
20805    return;
20806   }
20807   var distance = this.GetCurrentDistance(evt);
20808   if(Math.abs(distance) < GestureHandler.SLIDER_MIN_START_DISTANCE || ASPx.TouchUIHelper.isGesture)
20809    return;
20810   this.SetElementPosition(this.GetCalculatedPosition(distance));
20811   this.AttachPreventEvents(evt);
20812   ASPx.Evt.PreventEvent(evt);
20813  },
20814  GetCalculatedPosition: function (distance) {
20815   ASPx.AnimationTransitionBase.Cancel(this.slideElement);
20816   var position = this.startSliderElementPosition + distance,
20817    maxPosition = -(this.slideElementSize - this.containerElementSize),
20818    minPosition = 0;
20819   if(this.centeredSlideElementPosition > 0)
20820    position = this.GetRubberPosition(distance) + this.centeredSlideElementPosition;
20821   else if(position > minPosition)
20822    position = this.GetRubberPosition(distance);
20823   else if(position < maxPosition)
20824    position = this.GetRubberPosition(distance) + maxPosition;
20825   return position;
20826  },
20827  OnMouseUp: function (evt) {
20828   this.DetachPreventEvents();
20829   if(this.GetCurrentDistance(evt) != 0)
20830    this.OnMouseUpCore(evt);
20831  },
20832  OnMouseUpCore: function (evt) {
20833   var distance = this.GetCurrentDistance(evt);
20834   if(this.centeredSlideElementPosition > 0 || this.CheckSlidePanelIsOutOfBounds())
20835    this.PerformRollback();
20836   else
20837    this.PerformAction(distance);
20838  },
20839  PerformAction: function (distance) {
20840   if(Math.abs(distance) < this.GetDistanceLimit())
20841    this.PerformRollback();
20842   else if(distance < 0)
20843    this.PerformForward();
20844   else
20845    this.PerformBackward();
20846  },
20847  PerformBackward: function () {
20848   this.backward();
20849  },
20850  PerformForward: function () {
20851   this.forward();
20852  },
20853  PerformRollback: function () {
20854   this.rollback();
20855  },
20856  CheckSlidePanelIsOutOfBounds: function () {
20857   var minOffset = -(this.slideElementSize - this.containerElementSize), maxOffset = 0;
20858   var slideElementPos = this.GetElementPosition();
20859   if(slideElementPos > maxOffset || slideElementPos < minOffset)
20860    return true;
20861   return false;
20862  },
20863  GetContainerElement: function () {
20864   return this.container;
20865  },
20866  GetElementSize: function () {
20867   return this.IsHorizontalDirection() ? this.slideElement.offsetWidth : this.slideElement.offsetHeight;
20868  },
20869  GetContainerElementSize: function () {
20870   return this.IsHorizontalDirection() ? ASPx.GetClearClientWidth(this.container) : ASPx.GetClearClientHeight(this.container);
20871  },
20872  GetCurrentDistance: function (evt) {
20873   return this.IsHorizontalDirection() ? this.GetCurrentDistanceX(evt) : this.GetCurrentDistanceY(evt);
20874  },
20875  GetElementPosition: function () {
20876   return ASPx.AnimationUtils.GetTransformValue(this.slideElement, !this.IsHorizontalDirection());
20877  },
20878  SetElementPosition: function (position) {
20879   ASPx.AnimationUtils.SetTransformValue(this.slideElement, position, !this.IsHorizontalDirection());
20880  },
20881  IsHorizontalDirection: function () {
20882   return this.direction == AnimationHelper.SLIDE_HORIZONTAL_DIRECTION;
20883  }
20884 });
20885 var SwipeSimpleSlideGestureHandler = ASPx.CreateClass(SwipeSlideGestureHandler, {
20886  constructor: function (getAnimationElement, direction, canHandle, backward, forward, rollback, updatePosition) {
20887   this.constructor.prototype.constructor.call(this, getAnimationElement, direction, canHandle, backward, forward, rollback);
20888   this.container = this.slideElement;
20889   this.updatePosition = updatePosition;
20890   this.prevDistance = 0;
20891  },
20892  OnMouseDown: function (evt) {
20893   GestureHandler.prototype.OnMouseDown.call(this, evt);
20894   this.prevDistance = 0;
20895  },
20896  OnMouseUpCore: function (evt) {
20897   this.PerformAction(this.GetCurrentDistance(evt));
20898  },
20899  PerformAction: function (distance) {
20900   if(Math.abs(distance) < this.GetDistanceLimit())
20901    this.PerformRollback();
20902   else if(distance < 0)
20903    this.PerformForward();
20904   else
20905    this.PerformBackward();
20906  },
20907  GetCalculatedPosition: function (distance) {
20908   var position = distance - this.prevDistance;
20909   this.prevDistance = distance;
20910   return position;
20911  },
20912  SetElementPosition: function (position) {
20913   this.updatePosition(position);
20914  }
20915 });
20916 var SwipeGestureHandler = ASPx.CreateClass(GestureHandler, {
20917  constructor: function (getAnimationElement, canHandle, allowStart, start, allowComplete, complete, cancel, animationEngineType, rtl) {
20918   this.constructor.prototype.constructor.call(this, getAnimationElement, canHandle, allowStart);
20919   this.start = start;
20920   this.allowComplete = allowComplete;
20921   this.complete = complete;
20922   this.cancel = cancel;
20923   this.animationTween = null;
20924   this.currentDistanceX = 0;
20925   this.currentDistanceY = 0;
20926   this.tryStartGesture = false;
20927   this.tryStartScrolling = false;
20928   this.animationEngineType = animationEngineType;
20929   this.rtl = rtl;
20930   this.UpdateAnimationContainer();
20931  },
20932  UpdateAnimationContainer: function () {
20933   this.animationContainer = AnimationHelper.getSlideAnimationContainer(this.getAnimationElement(), true, false);
20934  },
20935  CanHandleEvent: function (evt) {
20936   if(GestureHandler.prototype.CanHandleEvent.call(this, evt))
20937    return true;
20938   return this.animationTween && this.animationContainer && ASPx.GetIsParent(this.animationContainer, ASPx.Evt.GetEventSource(evt));
20939  },
20940  OnMouseDown: function (evt) {
20941   GestureHandler.prototype.OnMouseDown.call(this, evt);
20942   if(this.animationTween)
20943    this.animationTween.Cancel();
20944   this.currentDistanceX = 0;
20945   this.currentDistanceY = 0;
20946   this.tryStartGesture = false;
20947   this.tryStartScrolling = false;
20948  },
20949  OnMouseMove: function (evt) {
20950   GestureHandler.prototype.OnMouseMove.call(this, evt);
20951   var isZoomGestureConflict = evt.touches && evt.touches.length > 1;
20952   if (isZoomGestureConflict)
20953    return false;
20954   this.currentDistanceX = this.GetCurrentDistanceX(evt);
20955   this.currentDistanceY = this.GetCurrentDistanceY(evt);
20956   if(this.rtl)
20957    this.currentDistanceX = -this.currentDistanceX;
20958   if(!this.animationTween && !this.tryStartScrolling && (Math.abs(this.currentDistanceX) >
20959    GestureHandler.MIN_START_DISTANCE || Math.abs(this.currentDistanceY) > GestureHandler.MIN_START_DISTANCE)) {
20960    if(Math.abs(this.currentDistanceY) < Math.abs(this.currentDistanceX)) {
20961     this.tryStartGesture = true;
20962     if(this.IsStartAllowed(this.currentDistanceX)) {
20963      this.animationContainer = AnimationHelper.getSlideAnimationContainer(this.getAnimationElement(), true, true);
20964      this.animationTween = AnimationHelper.createSlideTransition(this.animationContainer, AnimationHelper.SLIDE_LEFT_DIRECTION,
20965       function () {
20966        AnimationHelper.resetSlideAnimationContainerSize(this.animationContainer);
20967        this.animationContainer = null;
20968        this.animationTween = null;
20969       }.aspxBind(this), this.animationEngineType, this.rtl);
20970      this.PerformStart(this.currentDistanceX);
20971      this.AttachPreventEvents(evt);
20972     }
20973    }
20974    else
20975     this.tryStartScrolling = true;
20976   }
20977   if(this.animationTween) {
20978    if(this.allowComplete && !this.allowComplete(this.currentDistanceX))
20979     this.currentDistanceX = this.GetRubberPosition(this.currentDistanceX);
20980    this.animationTween.SetValue(this.currentDistanceX);
20981   }
20982   if(!this.tryStartScrolling && !ASPx.TouchUIHelper.isGesture && evt.touches && evt.touches.length < 2)
20983    ASPx.Evt.PreventEvent(evt);
20984  },
20985  OnMouseUp: function (evt) {
20986   if(!this.animationTween) {
20987    if(this.tryStartGesture)
20988     this.PerformCancel(this.currentDistanceX);
20989   }
20990   else {
20991    if(Math.abs(this.currentDistanceX) < this.GetDistanceLimit())
20992     this.RollbackGesture();
20993    else {
20994     if(this.IsCompleteAllowed(this.currentDistanceX)) {
20995      this.PerformComplete(this.currentDistanceX);
20996      this.animationContainer = null;
20997      this.animationTween = null;
20998     }
20999     else
21000      this.RollbackGesture();
21001    }
21002   }
21003   this.DetachPreventEvents();
21004   this.tryStartGesture = false;
21005   this.tryStartScrolling = false;
21006  },
21007  PerformStart: function (value) {
21008   if(this.start)
21009    this.start(value);
21010  },
21011  IsCompleteAllowed: function (value) {
21012   return !this.allowComplete || this.allowComplete(value);
21013  },
21014  PerformComplete: function (value) {
21015   if(this.complete)
21016    this.complete(value);
21017  },
21018  PerformCancel: function (value) {
21019   if(this.cancel)
21020    this.cancel(value);
21021  },
21022  RollbackGesture: function () {
21023   this.animationTween.Start(this.currentDistanceX, 0);
21024  },
21025  ResetGestureElementPosition: function () {
21026   if (this.currentDistanceX === 0) return;
21027   var container = AnimationHelper.getSlideAnimationContainer(this.getAnimationElement());
21028   var onComplete = function () { AnimationHelper.resetSlideAnimationContainerSize(container); };
21029   var animation = AnimationHelper.createSlideTransition(container, AnimationHelper.SLIDE_LEFT_DIRECTION, onComplete, this.animationEngineType, this.rtl);
21030   animation.Start(this.currentDistanceX, 0);
21031  },
21032  GetContainerElement: function () {
21033   return this.animationContainer;
21034  }
21035 });
21036 var GesturesHelper = {
21037  handlers: {},
21038  activeHandler: null,
21039  isAttachedEvents: false,
21040  isExecutedGesture: false,
21041  AddSwipeGestureHandler: function (id, getAnimationElement, canHandle, allowStart, start, allowComplete, complete, cancel, animationEngineType, rtl) {
21042   this.handlers[id] = new SwipeGestureHandler(getAnimationElement, canHandle, allowStart, start, allowComplete, complete, cancel, animationEngineType, rtl);
21043  },
21044  UpdateSwipeAnimationContainer: function (id) {
21045   if(this.handlers[id])
21046    this.handlers[id].UpdateAnimationContainer();
21047  },
21048  AddSwipeSlideGestureHandler: function (id, getAnimationElement, direction, canHandle, backward, forward, rollback, updatePosition) {
21049   if(updatePosition)
21050    this.handlers[id] = new SwipeSimpleSlideGestureHandler(getAnimationElement, direction, canHandle, backward, forward, rollback, updatePosition);
21051   else
21052    this.handlers[id] = new SwipeSlideGestureHandler(getAnimationElement, direction, canHandle, backward, forward, rollback);
21053  },
21054  getParentDXEditorWithSwipeGestures: function(element) {
21055     return ASPx.GetParent(element, function(parent) {
21056      var parentObj = ASPx.GetControlCollection().Get(parent.id);
21057      return parentObj && parentObj.supportGestures && parentObj.isSwipeGesturesEnabled();
21058   });
21059  },
21060  canHandleMouseDown: function(evt) {
21061   if(!ASPx.Evt.IsLeftButtonPressed(evt))
21062    return false;
21063   var element = ASPx.Evt.GetEventSource(evt);
21064   var dxFocusedEditor = ASPx.Ident.scripts.ASPxClientEdit && ASPx.GetFocusedEditor();
21065   if(dxFocusedEditor && dxFocusedEditor.IsEditorElement(element)) {
21066    var elementParentDXEditorWithSwipeGestures = GesturesHelper.getParentDXEditorWithSwipeGestures(element);
21067    if(!elementParentDXEditorWithSwipeGestures || !dxFocusedEditor.IsEditorElement(elementParentDXEditorWithSwipeGestures))
21068     return false;
21069   }
21070   var isTextEditor = element.tagName == "TEXTAREA" || element.tagName == "INPUT" && ASPx.Attr.GetAttribute(element, "type") == "text";
21071   if(isTextEditor && document.activeElement == element)
21072    return false;
21073   return true;  
21074  },
21075  OnDocumentDragStart: function(evt) {
21076   if(GesturesHelper.activeHandler)
21077    GesturesHelper.activeHandler.OnDragStart(evt);
21078  },
21079  OnDocumentMouseDown: function (evt) {
21080   if(!GesturesHelper.canHandleMouseDown(evt))
21081    return;
21082   GesturesHelper.activeHandler = GesturesHelper.FindHandler(evt);
21083   if(GesturesHelper.activeHandler)
21084    GesturesHelper.activeHandler.OnMouseDown(evt);
21085  },
21086  OnDocumentMouseMove: function (evt) {
21087   if(GesturesHelper.activeHandler) {
21088    GesturesHelper.isExecutedGesture = true;
21089    GesturesHelper.activeHandler.OnMouseMove(evt);
21090   }
21091  },
21092  OnDocumentMouseUp: function (evt) {
21093   if(GesturesHelper.activeHandler) {
21094    GesturesHelper.activeHandler.OnMouseUp(evt);
21095    GesturesHelper.activeHandler = null;
21096    window.setTimeout(function () { GesturesHelper.isExecutedGesture = false; }, 0);
21097   }
21098  },
21099  AttachEvents: function () {
21100   if(!GesturesHelper.isAttachedEvents) {
21101    GesturesHelper.Attach(ASPx.Evt.AttachEventToElement);
21102    GesturesHelper.isAttachedEvents = true;
21103   }
21104  },
21105  DetachEvents: function () {
21106   if(GesturesHelper.isAttachedEvents) {
21107    GesturesHelper.Attach(ASPx.Evt.DetachEventFromElement);
21108    GesturesHelper.isAttachedEvents = false;
21109   }
21110  },
21111  Attach: function (changeEventsMethod) {
21112   var doc = window.document;
21113   changeEventsMethod(doc, ASPx.TouchUIHelper.touchMouseDownEventName, GesturesHelper.OnDocumentMouseDown);
21114   changeEventsMethod(doc, ASPx.TouchUIHelper.touchMouseMoveEventName, GesturesHelper.OnDocumentMouseMove);
21115   changeEventsMethod(doc, ASPx.TouchUIHelper.touchMouseUpEventName, GesturesHelper.OnDocumentMouseUp);
21116   if(!ASPx.Browser.MobileUI) {
21117    changeEventsMethod(doc, "dragstart", GesturesHelper.OnDocumentDragStart);
21118   }
21119  },
21120  FindHandler: function (evt) {
21121   var handlers = [];
21122   for(var id in GesturesHelper.handlers) {
21123    if(GesturesHelper.handlers.hasOwnProperty(id)) {
21124     var handler = GesturesHelper.handlers[id];
21125     if(handler.CanHandleEvent && handler.CanHandleEvent(evt))
21126      handlers.push(handler);
21127    }
21128   }
21129   if(!handlers.length)
21130    return null;
21131   handlers.sort(function (a, b) {
21132    return ASPx.GetIsParent(a.getAnimationElement(), b.getAnimationElement()) ? 1 : -1;
21133   });
21134   return handlers[0];
21135  },
21136  IsExecutedGesture: function () {
21137   return GesturesHelper.isExecutedGesture;
21138  }
21139 };
21140 GesturesHelper.AttachEvents();
21141 var AnimationEngineType = {
21142  "DEFAULT": 0,
21143  "CSS": 1,
21144  "JS": 2
21145 };
21146 ASPx.AnimationEngineType = AnimationEngineType;
21147 ASPx.AnimationHelper = AnimationHelper;
21148 ASPx.GesturesHelper = GesturesHelper;
21149})();
21150
21151(function () {
21152var PopupUtils = {
21153 NotSetAlignIndicator: "NotSet",
21154 InnerAlignIndicator: "Sides",
21155 OutsideLeftAlignIndicator: "OutsideLeft",
21156 LeftSidesAlignIndicator: "LeftSides",
21157 RightSidesAlignIndicator: "RightSides",
21158 OutsideRightAlignIndicator: "OutsideRight",
21159 CenterAlignIndicator: "Center",
21160 AboveAlignIndicator: "Above",
21161 TopSidesAlignIndicator: "TopSides",
21162 MiddleAlignIndicator: "Middle",
21163 BottomSidesAlignIndicator: "BottomSides",
21164 BelowAlignIndicator: "Below",
21165 WindowCenterAlignIndicator: "WindowCenter",
21166 LeftAlignIndicator: "Left",
21167 RightAlignIndicator: "Right",
21168 TopAlignIndicator: "Top",
21169 BottomAlignIndicator: "Bottom",
21170 WindowLeftAlignIndicator: "WindowLeft",
21171 WindowRightAlignIndicator: "WindowRight",
21172 WindowTopAlignIndicator: "WindowTop",
21173 WindowBottomAlignIndicator: "WindowBottom",
21174 IsAlignNotSet: function (align) {
21175  return align == PopupUtils.NotSetAlignIndicator;
21176 },
21177 IsInnerAlign: function (align) {
21178  return align.indexOf(PopupUtils.InnerAlignIndicator) != -1;
21179 },
21180 IsRightSidesAlign: function(align) {
21181  return align == PopupUtils.RightSidesAlignIndicator;
21182 },
21183 IsOutsideRightAlign: function(align) {
21184  return align == PopupUtils.OutsideRightAlignIndicator;
21185 },
21186 IsCenterAlign: function(align) {
21187  return align == PopupUtils.CenterAlignIndicator;
21188 },
21189 FindPopupElementById: function (id) {
21190  if(id == "")
21191   return null; 
21192  var popupElement = ASPx.GetElementById(id);
21193  if(!ASPx.IsExistsElement(popupElement)) {
21194   var idParts = id.split("_");
21195   var uniqueId = idParts.join("$");
21196   popupElement = ASPx.GetElementById(uniqueId);
21197  }
21198  return popupElement;
21199 },
21200 FindEventSourceParentByTestFunc: function (evt, testFunc) {
21201  return ASPx.GetParent(ASPx.Evt.GetEventSource(evt), testFunc);
21202 },
21203 PreventContextMenu: function (evt) {
21204  ASPx.Evt.PreventEventAndBubble(evt);
21205  if(ASPx.Browser.WebKitFamily)
21206   evt.returnValue = false;
21207 },
21208 GetDocumentClientWidthForPopup: function() {
21209  return ASPx.Browser.WebKitTouchUI ? document.body.offsetWidth : ASPx.GetDocumentClientWidth();
21210 },
21211 GetDocumentClientHeightForPopup: function() {
21212  return ASPx.Browser.WebKitTouchUI ? document.body.offsetHeight : ASPx.GetDocumentClientHeight();
21213 },
21214 AdjustPositionToClientScreen: function (element, pos, rtl, isX) {
21215  var min = isX ? ASPx.GetDocumentScrollLeft() : ASPx.GetDocumentScrollTop(),
21216   max = min + (isX ? ASPx.GetDocumentClientWidth() : ASPx.GetDocumentClientHeight());
21217  max -= (isX ? element.offsetWidth : element.offsetHeight);
21218  if(rtl && isX) {
21219   if(pos < min) pos = min;
21220   if(pos > max) pos = max;
21221  } else {
21222   if(pos > max) pos = max;
21223   if(pos < min) pos = min;
21224  }
21225  return pos;
21226 },
21227 GetPopupAbsoluteX: function(element, popupElement, hAlign, hOffset, x, left, rtl, isPopupFullCorrectionOn, showPopupInsideScreenBounds) {
21228  return PopupUtils.getPopupAbsolutePos(element, popupElement, hAlign, hOffset, x, left, rtl, isPopupFullCorrectionOn, false, false, true, showPopupInsideScreenBounds);
21229 },
21230 GetPopupAbsoluteY: function(element, popupElement, vAlign, vOffset, y, top, isPopupFullCorrectionOn, ignoreAlignWithoutScrollReserve, ignorePopupElementBorders, showPopupInsideScreenBounds) {
21231  return PopupUtils.getPopupAbsolutePos(element, popupElement, vAlign, vOffset, y, top, false, isPopupFullCorrectionOn, ignoreAlignWithoutScrollReserve, ignorePopupElementBorders, false, showPopupInsideScreenBounds);
21232 },
21233 getPopupAbsolutePos: function(element, popupElement, align, offset, startPos, startPosInit, rtl, isPopupFullCorrectionOn, ignoreAlignWithoutScrollReserve, ignorePopupElementBorders, isHorizontal, showPopupInsideScreenBounds) {
21234  var calculator = getPositionCalculator();
21235  calculator.applyParams(element, popupElement, align, offset, startPos, startPosInit, rtl, isPopupFullCorrectionOn, ignoreAlignWithoutScrollReserve, ignorePopupElementBorders, isHorizontal, showPopupInsideScreenBounds);
21236  var position = calculator.getPopupAbsolutePos();
21237  calculator.disposeState();
21238  return position;
21239 },
21240 InitAnimationProperties: function(element, onAnimStopCallString) {
21241  element.popuping = true;
21242  element.onAnimStopCallString = onAnimStopCallString;
21243 },
21244 InitAnimationDiv: function (element, x, y, onAnimStopCallString, skipSizeInit) {
21245  PopupUtils.InitAnimationProperties(element, onAnimStopCallString);
21246  PopupUtils.InitAnimationDivCore(element);
21247  if(!skipSizeInit) {
21248   ASPx.SetStyles(element, { width: "", height: "" });
21249   ASPx.SetStyles(element, { width: element.offsetWidth, height: element.offsetHeight });
21250  }
21251  ASPx.SetStyles(element, { left: x, top: y });
21252 },
21253 InitAnimationDivCore: function (element) {
21254  ASPx.SetStyles(element, {
21255   overflow: "hidden",
21256   position: "absolute"
21257  });
21258 },
21259 StartSlideAnimation: function (animationDivElement, element, iframeElement, duration, preventChangingWidth, preventChangingHeight) {
21260  if(iframeElement) {
21261   var endLeft = ASPx.PxToInt(iframeElement.style.left);
21262   var endTop = ASPx.PxToInt(iframeElement.style.top);
21263   var startLeft = ASPx.PxToInt(element.style.left) < 0 ? endLeft : animationDivElement.offsetLeft + animationDivElement.offsetWidth;
21264   var startTop = ASPx.PxToInt(element.style.top) < 0 ? endTop : animationDivElement.offsetTop + animationDivElement.offsetHeight;
21265   var properties = {
21266    left: { from: startLeft, to: endLeft, unit: "px" },
21267    top: { from: startTop, to: endTop, unit: "px" }
21268   };
21269   if(!preventChangingWidth)
21270    properties.width = { to: element.offsetWidth, unit: "px" };
21271   if(!preventChangingHeight)
21272    properties.height = { to: element.offsetHeight, unit: "px" };
21273   ASPx.AnimationHelper.createMultipleAnimationTransition(iframeElement, {
21274    duration: duration
21275   }).Start(properties);
21276  }
21277  ASPx.AnimationHelper.createMultipleAnimationTransition(element, {
21278   duration: duration,
21279   onComplete: function () { PopupUtils.AnimationFinished(animationDivElement, element); }
21280  }).Start({
21281   left: { to: 0, unit: "px" },
21282   top: { to: 0, unit: "px" }
21283  });
21284 },
21285 AnimationFinished: function (animationDivElement, element) {
21286  if(PopupUtils.StopAnimation(animationDivElement, element) && ASPx.IsExists(animationDivElement.onAnimStopCallString) &&
21287   animationDivElement.onAnimStopCallString !== "") {
21288   window.setTimeout(animationDivElement.onAnimStopCallString, 0);
21289  }
21290 },
21291 StopAnimation: function (animationDivElement, element) {
21292  if(animationDivElement.popuping) {
21293   ASPx.AnimationHelper.cancelAnimation(element);
21294   animationDivElement.popuping = false;
21295   animationDivElement.style.overflow = "visible";
21296   return true;
21297  }
21298  return false;
21299 },
21300 GetAnimationHorizontalDirection: function (popupPosition, horizontalAlign, verticalAlign, rtl) {
21301  if(PopupUtils.IsInnerAlign(horizontalAlign)
21302   && !PopupUtils.IsInnerAlign(verticalAlign)
21303   && !PopupUtils.IsAlignNotSet(verticalAlign))
21304   return 0;
21305  var toTheLeft = (horizontalAlign == PopupUtils.OutsideLeftAlignIndicator || horizontalAlign == PopupUtils.RightSidesAlignIndicator || (horizontalAlign == PopupUtils.NotSetAlignIndicator && rtl)) ^ popupPosition.isInverted;
21306  return toTheLeft ? 1 : -1;
21307 },
21308 GetAnimationVerticalDirection: function (popupPosition, horizontalAlign, verticalAlign) {
21309  if(PopupUtils.IsInnerAlign(verticalAlign)
21310   && !PopupUtils.IsInnerAlign(horizontalAlign)
21311   && !PopupUtils.IsAlignNotSet(horizontalAlign))
21312   return 0;
21313  var toTheTop = (verticalAlign == PopupUtils.AboveAlignIndicator || verticalAlign == PopupUtils.BottomSidesAlignIndicator) ^ popupPosition.isInverted;
21314  return toTheTop ? 1 : -1;
21315 },
21316 IsVerticalScrollExists: function () {
21317  var scrollIsNotHidden = ASPx.GetCurrentStyle(document.body).overflowY !== "hidden" && ASPx.GetCurrentStyle(document.documentElement).overflowY !== "hidden";
21318  return (scrollIsNotHidden && ASPx.GetDocumentHeight() > ASPx.GetDocumentClientHeight());
21319 },
21320 CoordinatesInDocumentRect: function (x, y) {
21321  var docScrollLeft = ASPx.GetDocumentScrollLeft();
21322  var docScrollTop = ASPx.GetDocumentScrollTop();
21323  return (x > docScrollLeft && y > docScrollTop &&
21324   x < ASPx.GetDocumentClientWidth() + docScrollLeft &&
21325   y < ASPx.GetDocumentClientHeight() + docScrollTop);
21326 },
21327 GetElementZIndexArray: function (element) {
21328  var currentElement = element;
21329  var zIndexesArray = [0];
21330  while(currentElement && currentElement.tagName != "BODY") {
21331   if(currentElement.style) {
21332    if(typeof (currentElement.style.zIndex) != "undefined" && currentElement.style.zIndex != "")
21333     zIndexesArray.unshift(currentElement.style.zIndex);
21334   }
21335   currentElement = currentElement.parentNode;
21336  }
21337  return zIndexesArray;
21338 },
21339 IsHigher: function (higherZIndexArrat, zIndexArray) {
21340  if(zIndexArray == null) return true;
21341  var count = (higherZIndexArrat.length >= zIndexArray.length) ? higherZIndexArrat.length : zIndexArray.length;
21342  for(var i = 0; i < count; i++)
21343   if(typeof (higherZIndexArrat[i]) != "undefined" && typeof (zIndexArray[i]) != "undefined") {
21344    var higherZIndexArrayCurrentElement = parseInt(higherZIndexArrat[i].toString());
21345    var zIndexArrayCurrentElement = parseInt(zIndexArray[i].toString());
21346    if(higherZIndexArrayCurrentElement != zIndexArrayCurrentElement)
21347     return higherZIndexArrayCurrentElement > zIndexArrayCurrentElement;
21348   } else return typeof (zIndexArray[i]) == "undefined";
21349  return true;
21350 },
21351 TestIsPopupElement: function (element) {
21352  return !!element.DXPopupElementControl;
21353 },
21354 adjustViewportScrollWrapper: function(wrapper, wrapperScroll, windowElement) {
21355  var document = wrapper.ownerDocument;
21356  var window = document.defaultView || document.parentWindow;
21357  var isWindowElementDisplayed = ASPx.IsElementDisplayed(windowElement);
21358  if(!isWindowElementDisplayed) {
21359   wrapper.style.cssText = "";
21360   wrapperScroll.style.cssText = "";
21361   return; 
21362  }
21363  var windowRect = windowElement.getBoundingClientRect();
21364  var yAxis = this.calculateViewPortScrollDataByAxis(wrapper.style.top, windowRect.top, windowElement.offsetHeight, window.innerHeight, wrapper.scrollTop);
21365  var xAxis = this.calculateViewPortScrollDataByAxis(wrapper.style.left, windowRect.left, windowElement.offsetWidth, window.innerWidth, wrapper.scrollLeft);
21366  this.prepareViewPortScrollData(xAxis, yAxis);
21367  ASPx.SetStyles(windowElement, {
21368   top: yAxis.windowOffset,
21369   left: xAxis.windowOffset
21370  });
21371  ASPx.SetStyles(wrapper, {
21372   width: xAxis.wrapperSize,
21373   height: yAxis.wrapperSize,
21374   position: "absolute",
21375   overflow: ASPx.Browser.MobileUI ? "scroll" : "auto",
21376   zIndex: windowElement.style.zIndex
21377  });
21378  ASPx.SetAbsoluteX(wrapper, ASPx.GetDocumentScrollLeft());
21379  ASPx.SetAbsoluteY(wrapper, ASPx.GetDocumentScrollTop());
21380  ASPx.SetStyles(wrapperScroll, {
21381   width: xAxis.wrapperScrollSize,
21382   height: yAxis.wrapperScrollSize,
21383   position: "absolute",
21384   overflow: "hidden"
21385  });
21386  wrapper.scrollLeft = xAxis.scrollSize;
21387  wrapper.scrollTop = yAxis.scrollSize;
21388 },
21389 calculateViewPortScrollDataByAxis: function(wrapperOffsetStyle, windowOffset, windowSize, viewPortSize, scrollSize) {
21390  var isWindowOffsetNegative = windowOffset < 0;
21391  windowOffset = isWindowOffsetNegative ? 0 : windowOffset;
21392  var wrapperScrollSize = Math.max(viewPortSize + Math.abs(Math.min(0, windowOffset)), windowSize + Math.abs(windowOffset));
21393  return { 
21394   windowOffset: isWindowOffsetNegative ? 0 : windowOffset,
21395   wrapperSize: viewPortSize,
21396   wrapperScrollSize: wrapperScrollSize,
21397   scrollSize: isWindowOffsetNegative ? scrollSize + Math.abs(windowOffset) : 0,
21398   hasScroll: wrapperScrollSize > viewPortSize
21399  };
21400 },
21401 prepareViewPortScrollData: function(xAxis, yAxis) {
21402  var scrollBarSize = ASPx.GetVerticalScrollBarWidth();
21403  if(yAxis.hasScroll && !xAxis.hasScroll) {
21404   xAxis.wrapperScrollSize = Math.min(xAxis.wrapperSize - scrollBarSize, xAxis.wrapperScrollSize);
21405  } else if(xAxis.hasScroll && !yAxis.hasScroll) {
21406   yAxis.wrapperScrollSize = Math.min(yAxis.wrapperSize - scrollBarSize, yAxis.wrapperScrollSize);
21407  } else if(yAxis.hasScroll && xAxis.hasScroll) {
21408   yAxis.wrapperScrollSize -= scrollBarSize;
21409   xAxis.wrapperScrollSize -= scrollBarSize;
21410  }
21411 }
21412};
21413PopupUtils.OverControl = {
21414 GetPopupElementByEvt: function (evt) {
21415  return PopupUtils.FindEventSourceParentByTestFunc(evt, PopupUtils.TestIsPopupElement);
21416 },
21417 OnMouseEvent: function (evt, mouseOver) {
21418  var popupElement = PopupUtils.OverControl.GetPopupElementByEvt(evt);
21419  if(mouseOver)
21420   popupElement.DXPopupElementControl.OnPopupElementMouseOver(evt, popupElement);
21421  else
21422   popupElement.DXPopupElementControl.OnPopupElementMouseOut(evt, popupElement);
21423 },
21424 OnMouseOut: function (evt) {
21425  PopupUtils.OverControl.OnMouseEvent(evt, false);
21426 },
21427 OnMouseOver: function (evt) {
21428  PopupUtils.OverControl.OnMouseEvent(evt, true);
21429 }
21430};
21431PopupUtils.BodyScrollHelper = (function () {
21432 var windowScrollLock = {},
21433  windowScroll = {},
21434  hideScrollbarsClassName = "dxpc-hideScrollbars";
21435 function lockWindowScroll(windowId) {
21436  windowScrollLock[windowId] = true;
21437 }
21438 function unlockWindowScroll(windowId) {
21439  delete windowScrollLock[windowId];
21440 }
21441 function isLocked(windowId) {
21442  return !!windowScrollLock[windowId];
21443 }
21444 function isAnyWindowScrollLocked() {
21445  for(var key in windowScrollLock) 
21446   if (windowScrollLock.hasOwnProperty(key) && windowScrollLock[key] === true)
21447    return true;
21448  return false;
21449 }
21450 function replaceVerticalScrollByPadding() {
21451  var currentBodyStyle = ASPx.GetCurrentStyle(document.body),
21452   paddingWidth = ASPx.GetVerticalScrollBarWidth() + ASPx.PxToInt(currentBodyStyle.paddingRight);
21453  ASPx.Attr.ChangeStyleAttribute(document.body, "padding-right", paddingWidth + "px");
21454 }
21455 function changeOverflow() {
21456  ASPx.Attr.ChangeStyleAttribute(document.documentElement, "overflow", "hidden");
21457  if(ASPx.GetCurrentStyle(document.body).overflowY === "scroll")
21458   ASPx.Attr.ChangeStyleAttribute(document.body, "overflow", "hidden");
21459  resetOverflowCache();
21460 }
21461 function restoreOverflow() {
21462  ASPx.Attr.RestoreStyleAttribute(document.documentElement, "overflow");
21463  ASPx.Attr.RestoreStyleAttribute(document.body, "overflow");
21464  resetOverflowCache();
21465 }
21466 function resetOverflowCache() {
21467  ASPx.verticalScrollIsNotHidden = null;
21468  ASPx.horizontalScrollIsNotHidden = null;
21469 }
21470 function saveScrollPosition(windowId) {
21471  windowScroll[windowId] = {
21472   x: window.pageXOffset,
21473   y: window.pageYOffset
21474  };
21475 }
21476 function restoreScrollPosition(windowId) {
21477  var currentWindowScroll = windowScroll[windowId];
21478  if(!!currentWindowScroll)
21479   window.scrollTo(currentWindowScroll.x, currentWindowScroll.y);
21480 }
21481 function restoreBodyScroll(windowId) {
21482  unlockWindowScroll(windowId);
21483  if(isAnyWindowScrollLocked())
21484   return;
21485  if(ASPx.Browser.WebKitTouchUI) {
21486   ASPx.Attr.RestoreStyleAttribute(document.body, "position");
21487   ASPx.Attr.RestoreStyleAttribute(document.body, "height");
21488   ASPx.Attr.RestoreStyleAttribute(document.body, "margin");
21489   ASPx.RemoveClassNameFromElement(document.documentElement, hideScrollbarsClassName);
21490   ASPx.Attr.RestoreStyleAttribute(document.body, "overflow");
21491   restoreScrollPosition(windowId);
21492  } else {
21493   restoreOverflow();
21494   restoreScrollPosition(windowId);
21495  }
21496  if(ASPx.Browser.Chrome)
21497   var dummy = document.documentElement.scrollTop; 
21498  ASPx.Attr.RestoreStyleAttribute(document.body, "padding-right");
21499  ASPx.Attr.RestoreStyleAttribute(document.body, "height");
21500  ASPx.Attr.RestoreStyleAttribute(document.body, "width");
21501 }
21502 return {
21503  RestoreIfLocked: function(windowId) {
21504   if(isLocked(windowId))
21505    restoreBodyScroll(windowId);
21506  },
21507  HideBodyScroll: function(windowId) {
21508   if(isAnyWindowScrollLocked()) { 
21509    lockWindowScroll(windowId);
21510    return;
21511   }
21512   lockWindowScroll(windowId);
21513   if(PopupUtils.IsVerticalScrollExists())
21514    replaceVerticalScrollByPadding();
21515   if(ASPx.Browser.WebKitTouchUI) {
21516    saveScrollPosition(windowId);
21517    ASPx.Attr.ChangeStyleAttribute(document.body, "overflow", "hidden");
21518    ASPx.Attr.ChangeStyleAttribute(document.body, "position", "relative");
21519    ASPx.Attr.ChangeStyleAttribute(document.body, "height", "100%");
21520    ASPx.Attr.ChangeStyleAttribute(document.body, "margin", "0");
21521    ASPx.AddClassNameToElement(document.documentElement, hideScrollbarsClassName);
21522   } else {
21523    saveScrollPosition(windowId);
21524    changeOverflow();
21525    var documentHeight = ASPx.GetDocumentHeight();
21526    var documentWidth = ASPx.GetDocumentWidth();
21527    if(window.pageYOffset > 0 && ASPx.PxToInt(window.getComputedStyle(document.body, null)) != documentHeight)
21528     ASPx.Attr.ChangeStyleAttribute(document.body, "height", documentHeight + "px");
21529    if(window.pageXOffset > 0 && ASPx.PxToInt(window.getComputedStyle(document.body, null)) != documentWidth)
21530     ASPx.Attr.ChangeStyleAttribute(document.body, "width", documentWidth + "px");
21531   }
21532  },
21533  RestoreBodyScroll: restoreBodyScroll
21534 };
21535})();
21536var PositionAlignConsts = {
21537 NOT_SET: 0,
21538 OUTSIDE_START: 1,
21539 NEAR_BOUND_START: 2,
21540 INNER_START: 3,
21541 CENTER: 4,
21542 INNER_END: 5,
21543 NEAR_BOUND_END: 6,
21544 OUTSIDE_END: 7,
21545 WINDOW_CENTER: 8,
21546 WINDOW_START: 9,
21547 WINDOW_END: 10
21548};
21549var AlignIndicatorTable = {};
21550var PositionCalculator = ASPx.CreateClass(null, {
21551 constructor: function() {
21552  this.element = null;
21553  this.popupElement = null;
21554  this.align = 0;
21555  this.offset = 0;
21556  this.startPos = 0;
21557  this.startPosInit = 0;
21558  this.rtl = false;
21559  this.isPopupFullCorrectionOn = false;
21560  this.isHorizontal = true;
21561  this.size = 0;
21562  this.bodySize = 0;
21563  this.actualBodySize = 0;
21564  this.elementStartPos = 0;
21565  this.scrollStartPos = 0;
21566  this.isInverted = false;
21567  this.popupElementSize = 0;
21568  this.boundStartPos = 0;
21569  this.boundEndPos = 0;
21570  this.innerBoundStartPos = 0;
21571  this.innerBoundEndPos = 0;
21572  this.isMoreFreeSpaceLeft = false;
21573  this.nearBoundOverlapRate = 0.25;
21574  this.functionsTable = {};
21575  this.initializeFunctionsTable();
21576 },
21577 applyParams: function(element, popupElement, align, offset, startPos, startPosInit, rtl, isPopupFullCorrectionOn, ignoreAlignWithoutScrollReserve, ignorePopupElementBorders, isHorizontal, showPopupInsideScreenBounds) {
21578  this.isHorizontal = isHorizontal;
21579  this.element = element;
21580  this.popupElement = popupElement;
21581  this.align = this.getAlignValueFromIndicator(align);
21582  this.offset = offset;
21583  this.startPos = startPos;
21584  this.startPosInit = startPosInit;
21585  this.rtl = rtl;
21586  this.isPopupFullCorrectionOn = isPopupFullCorrectionOn;
21587  this.ignoreAlignWithoutScrollReserve = ignoreAlignWithoutScrollReserve;
21588  this.ignorePopupElementBorders = ignorePopupElementBorders;
21589  this.showPopupInsideScreenBounds = showPopupInsideScreenBounds;
21590  this.calculateParams();
21591 },
21592 disposeState: function() {
21593  this.element = null;
21594  this.popupElement = null;
21595 },
21596 getPopupAbsolutePos: function() {
21597  if(this.isWindowAlign()) {
21598   var showAtPos = this.startPos != ASPx.InvalidPosition && !this.popupElement;
21599   if(showAtPos)
21600    this.align = PositionAlignConsts.NOT_SET;
21601   else
21602    return this.getWindowAlignPos();
21603  }
21604  if(this.popupElement)
21605   this.calculatePopupElement();
21606  else
21607   this.align = PositionAlignConsts.NOT_SET;
21608  return this.getPopupAbsolutePosCore();
21609 },
21610 initializeFunctionsTable: function() {
21611  var table = this.functionsTable;
21612  table[PositionAlignConsts.NOT_SET] = this.calculateNotSet;
21613  table[PositionAlignConsts.OUTSIDE_START] = this.calculateOutsideStart;
21614  table[PositionAlignConsts.INNER_START] = this.calculateInnerStart;
21615  table[PositionAlignConsts.CENTER] = this.calculateCenter;
21616  table[PositionAlignConsts.INNER_END] = this.calculateInnerEnd;
21617  table[PositionAlignConsts.OUTSIDE_END] = this.calculateOutsideEnd;
21618  table[PositionAlignConsts.NEAR_BOUND_START] = this.calculateNearBoundStart;
21619  table[PositionAlignConsts.NEAR_BOUND_END] = this.calculateNearBoundEnd;
21620  table[PositionAlignConsts.WINDOW_CENTER] = this.calculateWindowCenter;
21621  table[PositionAlignConsts.WINDOW_START] = this.calculateWindowStart;
21622  table[PositionAlignConsts.WINDOW_END] = this.calculateWindowEnd;
21623 },
21624 calculateParams: function() {
21625  this.size = this.getElementSize();
21626  if(this.isHorizontal) {
21627   this.bodySize = ASPx.GetDocumentClientWidth();
21628   this.elementStartPos = ASPx.GetAbsoluteX(this.popupElement) + this.getBorderCorrection();
21629   this.scrollStartPos = ASPx.GetDocumentScrollLeft();
21630  }
21631  else {
21632   this.bodySize = ASPx.GetDocumentClientHeight();
21633   this.elementStartPos = ASPx.GetAbsoluteY(this.popupElement) + this.getBorderCorrection();
21634   this.scrollStartPos = ASPx.GetDocumentScrollTop();
21635  }
21636 },
21637 getBorderCorrection: function() {
21638  if(!this.ignorePopupElementBorders)
21639   return 0;
21640  var style = getComputedStyle(this.popupElement);
21641  return ASPx.PxToInt(this.isHorizontal ? style.borderLeftWidth : style.borderTopWidth);
21642 },
21643 isWindowAlign: function() {
21644  return this.align == PositionAlignConsts.WINDOW_CENTER || this.align == PositionAlignConsts.WINDOW_START ||
21645   this.align == PositionAlignConsts.WINDOW_END;
21646 },
21647 getWindowAlignPos: function() {
21648  this.actualBodySize = ASPx.Browser.WebKitTouchUI ? this.getWindowInnerSize() : this.bodySize;
21649  return this.getPopupAbsolutePosCore();
21650 },
21651 getPopupAbsolutePosCore: function() {
21652  var calculationFunc = this.functionsTable[this.align];
21653  calculationFunc.call(this);
21654  return new ASPx.PopupPosition(this.startPos, this.isInverted);
21655 },
21656 calculateWindowCenter: function() {
21657  this.startPos = Math.max(Math.ceil(this.actualBodySize / 2 - this.size / 2), 0) + this.scrollStartPos + this.offset;
21658 },
21659 calculateWindowStart: function() {
21660  this.startPos = this.scrollStartPos + this.offset;
21661 },
21662 calculateWindowEnd: function() {
21663  this.startPos = this.scrollStartPos + this.actualBodySize - this.size + this.offset;
21664 },
21665 calculatePopupElement: function() {
21666  this.popupElementSize = this.getPopupElementSize();
21667  this.boundStartPos = this.elementStartPos - this.size;
21668  this.boundEndPos = this.elementStartPos + this.popupElementSize;
21669  this.innerBoundStartPos = this.elementStartPos;
21670  this.innerBoundEndPos = this.elementStartPos + this.popupElementSize - this.size;
21671  var hasLeftScrollReserve = this.boundStartPos >= 0;
21672  this.isMoreFreeSpaceLeft = (this.bodySize - (this.boundEndPos + this.size) < this.boundStartPos - 2 * this.scrollStartPos) && (!this.ignoreAlignWithoutScrollReserve || hasLeftScrollReserve);
21673 },
21674 calculateOutsideStart: function() {
21675  this.isInverted = this.isPopupFullCorrectionOn && (!(this.boundStartPos - this.scrollStartPos > 0 || this.isMoreFreeSpaceLeft));
21676  if(this.isInverted)
21677   this.startPos = this.boundEndPos - this.offset;
21678  else
21679   this.startPos = this.boundStartPos + this.offset;
21680 },
21681 calculateInnerStart: function() {
21682  this.startPos = this.innerBoundStartPos + this.offset;
21683  if(this.isPopupFullCorrectionOn)
21684   this.startPos = PopupUtils.AdjustPositionToClientScreen(this.element, this.startPos, this.rtl, this.isHorizontal);
21685 },
21686 calculateCenter: function() {
21687  this.startPos = this.elementStartPos + Math.round((this.popupElementSize - this.size) / 2) + this.offset;
21688  if(this.showPopupInsideScreenBounds) {
21689   if(this.startPos < 0)
21690    this.startPos = 0;
21691   if(this.startPos + this.size > this.bodySize)
21692    this.startPos = this.bodySize - this.size;
21693  }
21694 },
21695 calculateInnerEnd: function() {
21696  this.startPos = this.innerBoundEndPos + this.offset;
21697  if(this.isPopupFullCorrectionOn)
21698   this.startPos = PopupUtils.AdjustPositionToClientScreen(this.element, this.startPos, this.rtl, this.isHorizontal);
21699 },
21700 calculateOutsideEnd: function() {
21701  this.isInverted = this.isPopupFullCorrectionOn && (!(this.boundEndPos + this.size < this.bodySize + this.scrollStartPos || !this.isMoreFreeSpaceLeft));
21702  if(this.isInverted)
21703   this.startPos = this.boundStartPos - this.offset;
21704  else
21705   this.startPos = this.boundEndPos + this.offset;
21706 },
21707 calculateNotSet: function() {
21708  if(this.rtl)
21709   this.calculateNotSetRightToLeft();
21710  else
21711   this.calculateNotSetLeftToRight();
21712 },
21713 calculateNotSetLeftToRight: function() {
21714  if(!ASPx.IsValidPosition(this.startPos)) {
21715   if(this.popupElement)
21716    this.startPos = this.elementStartPos;
21717   else if(this.offset)
21718    this.startPos = 0;
21719   else
21720    this.startPos = this.startPosInit;
21721  }
21722  this.isInverted = this.isPopupFullCorrectionOn && (this.startPos - this.scrollStartPos + this.size > this.bodySize && this.startPos - this.scrollStartPos > this.bodySize / 2);
21723  if(this.isInverted)
21724   this.startPos = this.startPos - this.size - this.offset;
21725  else
21726   this.startPos = this.startPos + this.offset;
21727 },
21728 calculateNotSetRightToLeft: function() {
21729  if(!ASPx.IsValidPosition(this.startPos)) {
21730   if(this.popupElement)
21731    this.startPos = this.innerBoundEndPos;
21732   else if(this.offset)
21733    this.startPos = 0;
21734   else
21735    this.startPos = this.startPosInit;
21736  }
21737  else
21738   this.startPos -= this.size;
21739  this.isInverted = this.isPopupFullCorrectionOn && (this.startPos < this.scrollStartPos && this.startPos - this.scrollStartPos < this.bodySize / 2);
21740  if(this.isInverted)
21741   this.startPos = this.startPos + this.size + this.offset;
21742  else
21743   this.startPos = this.startPos - this.offset;
21744 },
21745 calculateNearBoundStart: function() {
21746  this.startPos = this.boundStartPos + this.offset + this.size * this.nearBoundOverlapRate;
21747  if(this.isPopupFullCorrectionOn)
21748   this.startPos = PopupUtils.AdjustPositionToClientScreen(this.element, this.startPos, this.rtl, this.isHorizontal);
21749 },
21750 calculateNearBoundEnd: function() {
21751  this.startPos = this.boundEndPos + this.offset - this.size * this.nearBoundOverlapRate;
21752  if(this.isPopupFullCorrectionOn)
21753   this.startPos = PopupUtils.AdjustPositionToClientScreen(this.element, this.startPos, this.rtl, this.isHorizontal);
21754 },
21755 getAlignValueFromIndicator: function(alignIndicator) {
21756  var alignValue = AlignIndicatorTable[alignIndicator];
21757  if(alignValue === undefined)
21758   throw "Incorrect align indicator.";
21759  return alignValue;
21760 },
21761 getElementSize: function() {
21762  return this.getCustomElementSize(this.element, false);
21763 },
21764 getPopupElementSize: function() {
21765  return this.getCustomElementSize(this.popupElement, this.ignorePopupElementBorders);
21766 },
21767 getCustomElementSize: function(customElement, ignoreBorders) {
21768  if(ignoreBorders) {
21769   return this.isHorizontal ? ASPx.GetClearClientWidth(customElement) : ASPx.GetClearClientHeight(customElement);
21770  }
21771  return this.isHorizontal ? ASPx.GetElementOffsetWidth(customElement) : ASPx.GetElementOffsetHeight(customElement);
21772 },
21773 getWindowInnerSize: function() {
21774  return this.isHorizontal ? window.innerWidth : window.innerHeight;
21775 }
21776});
21777var positionCalculator = null;
21778function getPositionCalculator() {
21779 if(positionCalculator == null)
21780  positionCalculator = new PositionCalculator();
21781 return positionCalculator;
21782}
21783function initializeAlignIndicatorTable() {
21784 AlignIndicatorTable[PopupUtils.NotSetAlignIndicator] = PositionAlignConsts.NOT_SET;
21785 AlignIndicatorTable[PopupUtils.OutsideLeftAlignIndicator] = PositionAlignConsts.OUT
21785SIDE_START;
21786 AlignIndicatorTable[PopupUtils.AboveAlignIndicator] = PositionAlignConsts.OUTSIDE_START;
21787 AlignIndicatorTable[PopupUtils.LeftAlignIndicator] = PositionAlignConsts.NEAR_BOUND_START;
21788 AlignIndicatorTable[PopupUtils.TopAlignIndicator] = PositionAlignConsts.NEAR_BOUND_START;
21789 AlignIndicatorTable[PopupUtils.LeftSidesAlignIndicator] = PositionAlignConsts.INNER_START;
21790 AlignIndicatorTable[PopupUtils.TopSidesAlignIndicator] = PositionAlignConsts.INNER_START;
21791 AlignIndicatorTable[PopupUtils.CenterAlignIndicator] = PositionAlignConsts.CENTER;
21792 AlignIndicatorTable[PopupUtils.MiddleAlignIndicator] = PositionAlignConsts.CENTER;
21793 AlignIndicatorTable[PopupUtils.RightSidesAlignIndicator] = PositionAlignConsts.INNER_END;
21794 AlignIndicatorTable[PopupUtils.BottomSidesAlignIndicator] = PositionAlignConsts.INNER_END;
21795 AlignIndicatorTable[PopupUtils.RightAlignIndicator] = PositionAlignConsts.NEAR_BOUND_END;
21796 AlignIndicatorTable[PopupUtils.BottomAlignIndicator] = PositionAlignConsts.NEAR_BOUND_END;
21797 AlignIndicatorTable[PopupUtils.OutsideRightAlignIndicator] = PositionAlignConsts.OUTSIDE_END;
21798 AlignIndicatorTable[PopupUtils.BelowAlignIndicator] = PositionAlignConsts.OUTSIDE_END;
21799 AlignIndicatorTable[PopupUtils.WindowCenterAlignIndicator] = PositionAlignConsts.WINDOW_CENTER;
21800 AlignIndicatorTable[PopupUtils.WindowLeftAlignIndicator] = PositionAlignConsts.WINDOW_START;
21801 AlignIndicatorTable[PopupUtils.WindowTopAlignIndicator] = PositionAlignConsts.WINDOW_START;
21802 AlignIndicatorTable[PopupUtils.WindowRightAlignIndicator] = PositionAlignConsts.WINDOW_END;
21803 AlignIndicatorTable[PopupUtils.WindowBottomAlignIndicator] = PositionAlignConsts.WINDOW_END;
21804}
21805initializeAlignIndicatorTable();
21806ASPx.PopupPosition = function(position, isInverted) {
21807 this.position = position;
21808 this.isInverted = isInverted;
21809};
21810ASPx.PopupSize = function(width, height) {
21811 this.width = width;
21812 this.height = height;
21813};
21814ASPx.PopupUtils = PopupUtils;
21815ASPx.PositionCalculator = PositionCalculator;
21816})();
21817
21818(function() {
21819var serializingSeparator = "|";
21820var serializingSeparatorLength = serializingSeparator.length;
21821var lbIPostfixes = ['C', 'I', 'T'];
21822var lbIIdSuffix = "LBI";
21823var lbSIIdSuffix = lbIIdSuffix + "-1";
21824var lbAIRIdSuffix = "AIR";
21825var lbAIRTIdSuffix = lbAIRIdSuffix + "-1";
21826var lbTSIdSuffix = "_TS";
21827var lbBSIdSuffix = "_BS";
21828var lbHeaderDivIdSuffix = "_H";
21829var lTableIdSuffix = "_LBT";
21830var leVISuffix = "_VI";
21831var lbDSuffix = "_D";
21832var emptyItemsRange = "0:-1";
21833var nbsp = "&nbsp;";
21834var nameSeparator = "_";
21835var nbspChar = String.fromCharCode(160);
21836var NullSizeCellClassName = "dxlbNullSizeCell";
21837var itemCellTextAttributeName = "data-item-cell-text";
21838var itemSerializedTextsAttributeName = "data-item-serialized-texts";
21839var FIRST_CELL_MARKER_CSS_CLASS_NAME = "dxeFTM";
21840var LAST_CELL_MARKER_CSS_CLASS_NAME = "dxeLTM";
21841var selectAllMainElementID = "LBSAME";
21842var selectAllCheckBoxID = "LBSACB";
21843var filterMainElementID = "LBF";
21844var filteringTextBoxID = "LBFE";
21845var showFilterButtonID = "LBSFEB";
21846var inactiveFilterElementClassName = "dxeLBInactiveFilterPanelSys";
21847var listTableCollapsedClassName = "dxeLBTCollapsed";
21848var ListBoxSelectionMode = { Single : 0, Multiple : 1, CheckColumn : 2 };
21849var ListBoxVirtualScrollTableContainerIDPostfix = "LBVSTC";
21850var CONSTANTS = {
21851 CALLBACK_PREFIXES: {
21852  CUSTOM: "LECC",
21853  CUSTOMPERFORM: "LECCP",
21854  LOAD_RANGE_ITEMS: "LBCRI",
21855  FILTERING: "CBLF",
21856  FILTERING_CORRECT: "CBCF"
21857 },
21858 CALLBACK_RESULTS: {
21859  ITEMS: "i",
21860  FILTER_CUSTOMHIGHLIGHTING: "fCH",
21861  FILTER_LENGTH: "fL"
21862 }
21863};
21864var ListBoxStateControllerManagerBase = ASPx.CreateClass(null, {
21865 constructor: function(listBox) {
21866  this.listBox = listBox;
21867 },
21868 Initialize: function() {
21869  this.AddStateItems(false, false);
21870 },
21871 AddStateItems: function(clearCache, hoverItemOnly) {
21872  if(typeof (ASPx.GetStateController) !== "undefined") {
21873   var itemCellsIdSuffixes = this.listBox.GetItemCellsIdPostfixes();
21874   this.AddStateItemsCore(ASPx.GetStateController(), clearCache, itemCellsIdSuffixes, hoverItemOnly);
21875  }
21876 },
21877 AddStateItemsCore: function(controller, clearCache, itemCellsIdSuffixes, hoverItemOnly) {
21878  if(this.HasSampleItemStateItems())
21879   this.AddItemStateItems(controller, clearCache, itemCellsIdSuffixes, hoverItemOnly,-1);
21880 },
21881 AddItemStateItems: function(controller, clearCache, itemCellsIdSuffixes, hoverItemOnly, index) {
21882  var name = this.listBox.name + "_" + lbIIdSuffix + index;
21883  if(clearCache)
21884   this.listBox.ClearStateItemCache(controller, name, itemCellsIdSuffixes);
21885  if(this.NeedAddHoverStateToItem())
21886   controller.AddHoverItem(name, this.listBox.hoverClasses, this.listBox.hoverCssArray, itemCellsIdSuffixes, null, null, true);
21887  if(!hoverItemOnly) {
21888   this.AddFunctionalStates(controller, name, itemCellsIdSuffixes);
21889  }
21890 },
21891 NeedAddHoverStateToItem: function() {
21892  return !ASPx.Browser.WebKitTouchUI;
21893 },
21894 AddFunctionalStates: function(controller, name, itemCellsIdSuffixes) {
21895  controller.AddSelectedItem(name, this.listBox.selectedClasses, this.listBox.selectedCssArray, itemCellsIdSuffixes, null, null, true);
21896  controller.AddDisabledItem(name, this.listBox.disabledClasses, this.listBox.disabledCssArray, itemCellsIdSuffixes, null, null, true);
21897 },
21898 RemoveHoverStateItem: function() {
21899  if(typeof (ASPx.GetStateController) !== "undefined") {
21900   var itemCellsIdSuffixes = this.listBox.GetItemCellsIdPostfixes();
21901   this.RemoveHoverStateItemCore(ASPx.GetStateController(), itemCellsIdSuffixes);
21902  }
21903 },
21904 RemoveHoverStateItemCore: function(controller, itemCellsIdSuffixes) {
21905  if(this.HasSampleItemStateItems())
21906   this.RemoveItemStateHoverItem(controller, itemCellsIdSuffixes, -1);
21907 },
21908 RemoveItemStateHoverItem: function(controller, itemCellsIdSuffixes, index) {
21909  var name = this.listBox.name + "_" + lbIIdSuffix + index;
21910  this.listBox.ClearStateItemCache(controller, name, itemCellsIdSuffixes);
21911  if(!ASPx.Browser.WebKitTouchUI)
21912   controller.RemoveHoverItem(name, itemCellsIdSuffixes);
21913 },
21914 HasSampleItemStateItems: function() {
21915  return this.listBox.hasSampleItem;
21916 },
21917});
21918var VirtualRenderListBoxStateControllerManager = ASPx.CreateClass(ListBoxStateControllerManagerBase, {
21919 constructor: function(listBox, virtualRenderItemsManager) {
21920  this.constructor.prototype.constructor.call(this, listBox);
21921  this.virtualRenderItemsManager = virtualRenderItemsManager;
21922 },
21923 AddStateItemsCore: function(controller, clearCache, itemCellsIdSuffixes, hoverItemOnly) {
21924  ListBoxStateControllerManagerBase.prototype.AddStateItemsCore.call(this, controller, clearCache, itemCellsIdSuffixes, hoverItemOnly);
21925  var range = this.virtualRenderItemsManager.GetRenderedItemRange();
21926  for(var i = range.startIndex;i <= range.endIndex;i++) {
21927   if(i >= 0)
21928    this.AddItemStateItems(controller, clearCache, itemCellsIdSuffixes, hoverItemOnly, i);
21929  }
21930 },
21931 RemoveHoverStateItemCore: function(controller, itemCellsIdSuffixes) {
21932  ListBoxStateControllerManagerBase.prototype.RemoveHoverStateItemCore.call(this, controller, itemCellsIdSuffixes);
21933  var range = this.virtualRenderItemsManager.GetRenderedItemRange();
21934  for(var i = range.startIndex; i <= range.endIndex; i++) {
21935   if(i >= 0)
21936    this.RemoveItemStateHoverItem(controller, itemCellsIdSuffixes, i);
21937  }
21938 },
21939});
21940var DefaultListBoxStateControllerManager = ASPx.CreateClass(ListBoxStateControllerManagerBase, {
21941 constructor: function(listBox) {
21942  this.constructor.prototype.constructor.call(this, listBox);
21943 },
21944 AddStateItemsCore: function(controller, clearCache, itemCellsIdSuffixes, hoverItemOnly) {
21945  ListBoxStateControllerManagerBase.prototype.AddStateItemsCore.call(this, controller, clearCache, itemCellsIdSuffixes, hoverItemOnly);
21946  var count = this.listBox.GetItemCount();
21947  for(var i = 0;i < count;i++)
21948   this.AddItemStateItems(controller, clearCache, itemCellsIdSuffixes, hoverItemOnly, i);
21949 },
21950 RemoveHoverStateItemCore: function(controller, itemCellsIdSuffixes) {
21951  ListBoxStateControllerManagerBase.prototype.RemoveHoverStateItemCore.call(this, controller, itemCellsIdSuffixes);
21952  var count = this.GetItemCount();
21953  for(var i = 0; i < count; i++)
21954   this.RemoveItemStateHoverItem(controller, itemCellsIdSuffixes, i);
21955 },
21956});
21957var ListBoxItemsManagerBase = ASPx.CreateClass(null, {
21958 constructor: function(listBox) {
21959  this.listBox = listBox;
21960  this.listTable = listBox.GetListTable();
21961 },
21962 Initialize: function() {
21963 },
21964 GetListTableRows: function() {
21965  return this.listTable ? this.listTable.rows : [];
21966 },
21967 GetItemHtmlContent: function(index) { return null; },
21968 GetItem: function () { return null; },
21969 GetItemIndexByRow: function (itemRow) { return null; },
21970 GetItemCount: function () { return 0; },
21971 GetItemRow: function (index) {
21972  if (this.listTable && index >= 0) {
21973   var rowIndex = this.ConvertItemIndexToRowIndex(index);
21974   var itemRow = this.listTable.rows[rowIndex];
21975   if (itemRow && ASPx.ElementContainsCssClass(itemRow, "dxeListBoxItemRow"))
21976    return itemRow;
21977  }
21978  return null;
21979 },
21980 GetItemElement: function (index) {
21981  var result = null;
21982  var itemRow = this.GetItemRow(index);
21983  if (itemRow)
21984   result = this.GetFirstVisibleCell(itemRow) || itemRow.cells[0];
21985  return result;
21986 },
21987 GetFirstVisibleCell: function (itemRow) {
21988  for (var i = 0; i < itemRow.cells.length; i++)
21989   if (ASPx.GetElementDisplay(itemRow.cells[i]))
21990    return itemRow.cells[i];
21991  return null;
21992 },
21993 GetItemHeight: function(index) {
21994  throw new Error("this method is abstract");
21995 },
21996 GetTotalItemsHeight: function(firstItemIndex, lastItemIndex) {
21997  throw new Error("this method is abstract");
21998 },
21999 GetItemsHeight: function() { return 0; },
22000 GetItemsWidth: function() { return 0; },
22001 GetVisibleItemCount: function () { return 0; },
22002 GetTopSpacersHeight: function() {
22003  return this.listBox.GetTopScrollSpacerHeight();
22004 },
22005 GetItemTopOffset: function(index) {
22006  return this.GetItemTopOffsetCore(index);
22007 },
22008 GetItemTopOffsetCore: function(index) {
22009  var itemElement = this.GetItemElement(index);
22010  return itemElement ? itemElement.offsetTop + this.GetTopSpacersHeight() : 0;
22011 },
22012 IsItemVisible: function(index) {
22013  return this.IsItemEdgeVisible(index, true, true);
22014 },
22015 IsItemEdgeVisible: function(index, checkTop, checkBottom) {
22016  var result = false;
22017  var itemElement = this.GetItemElement(index);
22018  if(itemElement != null) {
22019   var scrollDiv = this.listBox.GetScrollDivElement();
22020   var topScrollDivEdge = scrollDiv.scrollTop;
22021   var bottomScrollDivEdge = scrollDiv.scrollTop + scrollDiv.clientHeight;
22022   var topItemElementEdge = this.GetItemTopOffset(index);
22023   var bottomItemElementEdge = topItemElementEdge + itemElement.getBoundingClientRect().height;
22024   var checkTopVisibleResult = !checkTop || this.IsVisibleOffset(topItemElementEdge, topScrollDivEdge, bottomScrollDivEdge);
22025   var checkBottomVisibleResult = !checkBottom || this.IsVisibleOffset(bottomItemElementEdge, topScrollDivEdge, bottomScrollDivEdge);
22026   result = checkTopVisibleResult && checkBottomVisibleResult;
22027  }
22028  return result;
22029 },
22030 IsVisibleOffset: function(offset, topScrollDivEdge, bottomScrollDivEdge) {
22031  return offset >= topScrollDivEdge && offset <= bottomScrollDivEdge;
22032 },
22033 GetFirstVisibleItem: function () { return null; },
22034 GetFirstVisibleItemRow: function() {
22035  var firstVisibleItemIndex = this.GetFirstVisibleItem();
22036  return this.listTable.rows[this.ConvertItemIndexToRowIndex(firstVisibleItemIndex)];
22037 },
22038 GetFirstRenderedItem: function () { },
22039 GetLastRenderedItem: function () { },
22040 InitializeInternalCheckBoxCollection: function () { },
22041 GetScrollDivChildElementHeight: function () { return null; },
22042 RemoveItem: function(index) { this.RemoveItemCore(index); },
22043 RemoveItemCore: function(index) {
22044  this.listBox.RemoveItemRow(index);
22045 },
22046 InsertItem: function () { },
22047 CreateNewItemRow: function (index) {
22048  var newItemRow = this.listBox.GetSampleItemRow();
22049  if (ASPx.IsExistsElement(newItemRow))
22050   newItemRow = newItemRow.cloneNode(true);
22051  return newItemRow;
22052 },
22053 ClearItems: function () {
22054  this.ClearItemsCore();
22055 },
22056 ClearItemsCore: function() {
22057  var tBody = this.listBox.GetListTableRowParent();
22058  tBody.innerHTML = "";
22059 },
22060 IsItemFiltered: function (index) { return false; },
22061 ConvertItemIndexToRowIndex: function () { return null; },
22062 Adjust: function () { },
22063 BeforeClientFiltering: function () { },
22064 ApplyFilterToItem: function (index, isSatisfy, savePrevState, isFilterReset) { },
22065 RestorePrevFilteredState: function (index) { },
22066 OnEndItemsFiltering: function () { },
22067 ChangeItemsFilteredState: function(action) {
22068  var count = this.GetItemCount();
22069  for (var i = 0; i < count; i++) {
22070   action(i);
22071   this.AfterChangeItemFilteredStateAction(i);
22072  }
22073 },
22074 AfterChangeItemFilteredStateAction: function() { },
22075 MakeAllItemsVisible: function () {
22076  this.ChangeItemsFilteredState(function (index) {
22077   this.ApplyFilterToItem(index, true, false, true);
22078  }.aspxBind(this));
22079 },
22080 MakeItemVisibleAtTop: function(index) {
22081  var scrollDiv = this.listBox.GetScrollDivElement();
22082  scrollDiv.scrollTop = this.GetItemTopOffset(index);
22083 },
22084 MakeItemVisible: function(index) { 
22085  if(!this.IsItemVisible(index)) {
22086   var scrollDiv = this.listBox.GetScrollDivElement();
22087   var scrollTop = scrollDiv.scrollTop;
22088   var scrollDivHeight = scrollDiv.clientHeight;
22089   var itemOffsetTop = this.GetItemTopOffset(index);
22090   var itemHeight = this.GetItemHeight(index);
22091   var itemAbove = scrollTop > itemOffsetTop;
22092   var itemBelow = scrollTop + scrollDivHeight < itemOffsetTop + itemHeight;
22093   if(itemAbove) {
22094    this.MakeItemVisibleAtTop(index);
22095   }
22096   else if(itemBelow) {
22097    var scrollDivChildElementHeight = this.listBox.GetScrollDivChildElementHeight();
22098    var scrollPaddings = scrollDiv.scrollHeight - scrollDivChildElementHeight;
22099    scrollDiv.scrollTop = itemOffsetTop + itemHeight - scrollDivHeight + scrollPaddings;
22100   }
22101  }
22102 },
22103 RewriteFilteredItemIndices: function(newFilteredItemIndices) { },
22104 OnScrollSpacerVisibilityChanged: function () { },
22105 SetItemHtml: function (index, html) { },
22106 SetItemTooltip: function(index, tooltip) { },
22107 SetItemAttribute: function(index, attrName, attrValue) { },
22108 AddItemCssClass: function (index, className) { },
22109 RemoveItemCssClass: function (index, className) { },
22110 SetItemTextCellHtml: function (itemIndex, textCellIndex, html) { },
22111 SetItemTextCellTooltip: function(itemIndex, textCellIndex, tooltip) { },
22112 SetItemTextCellAttribute: function(itemIndex, textCellIndex, attrName, attrValue) { },
22113 AddItemTextCellCssClass: function (itemIndex, textCellIndex, className) { },
22114 RemoveItemTextCellCssClass: function (itemIndex, textCellIndex, className) { },
22115 OnDecoratedItemsRendering: function () { },
22116 DeactivateScrollHandler: function() { },
22117 ActivateScrollHandler: function() { },
22118 IsScrollActivated: function() { return true; },
22119 CorrectItemsHeight: function() {},
22120 BeginUpdate: function() { },
22121 EndUpdate: function() { }
22122});
22123var ListBoxItemsDefaultManager = ASPx.CreateClass(ListBoxItemsManagerBase, {
22124 constructor: function (listBox) {
22125  this.constructor.prototype.constructor.call(this, listBox);
22126 },
22127 GetItemIndexByRow: function (itemRow) {
22128  var result = itemRow.rowIndex;
22129  if (this.listBox.ContainsFixWidthRow())
22130   result--;
22131  return result;
22132 },
22133 GetItemCount: function () {
22134  if (this.listTable) {
22135   var rowLength = this.listTable.rows.length;
22136   if (!!this.listBox.GetAccessibilityHeaderRow())
22137    rowLength--;
22138   if (this.listBox.ContainsFixWidthRow())
22139    rowLength--;
22140   return rowLength;
22141  }
22142  return 0;
22143 },
22144 GetItem: function (index) {
22145  var rowLength = this.GetItemCount();
22146  if (!this.listTable || index < 0 || index >= rowLength)
22147   return null;
22148  var row = this.listBox.GetItemRow(index);
22149  var image = this.listBox.imageCellExists ? ASPx.GetNodeByTagName(row.cells[this.listBox.GetImageCellIndex()], "IMG", 0) : null;
22150  var src = image == null ? "" : ASPx.ImageUtils.GetImageSrc(image);
22151  var itemValue = this.listBox.itemsValue[index] !== undefined ? this.listBox.itemsValue[index] : null;
22152  return new ASPxClientListBoxItem(this.listBox, index, this.listBox.GetItemRowTexts(row), itemValue, src, this.listBox.GetIsItemSelected(index));
22153 },
22154 GetVisibleItemCount: function () {
22155  var count = this.GetItemCount();
22156  var visibleItemCount = 0;
22157  for (var i = 0; i < count; i++) {
22158   if (ASPx.GetElementDisplay(this.GetItemRow(i)))
22159    visibleItemCount++;
22160  }
22161  return visibleItemCount;
22162 },
22163 GetFirstVisibleItem: function () {
22164  var itemCount = this.GetItemCount();
22165  for (var i = 0; i < itemCount; i++)
22166   if (this.GetItemRow(i) && this.IsItemFiltered(i))
22167    return i;
22168  return -1;
22169 },
22170 GetFirstFilteredItemIndex: function () {
22171  return this.GetFirstVisibleItem();
22172 },
22173 GetLastFilteredItemIndex: function() {
22174  var itemCount = this.GetItemCount();
22175  for(var i = itemCount - 1; i >= 0; i--)
22176   if(this.GetItemRow(i) && this.IsItemFiltered(i))
22177    return i;
22178  return -1;
22179 },
22180 GetNextFilteredItemIndex: function(currentIndex) {
22181  var itemCount = this.GetItemCount();
22182  for(var i = currentIndex + 1; i < itemCount; i++)
22183   if(this.GetItemRow(i) && this.IsItemFiltered(i))
22184    return i;
22185  return -1;
22186 },
22187 GetPrevFilteredItemIndex: function(currentIndex) {
22188  for(var i = currentIndex - 1; i >= 0; i--)
22189   if(this.GetItemRow(i) && this.IsItemFiltered(i))
22190    return i;
22191  return -1;
22192 },
22193 GetFirstRenderedItem: function () {
22194  return this.GetItemCount() > 0 ? this.GetItem(0) : null;
22195 },
22196 GetLastRenderedItem: function () {
22197  return this.GetItemCount() > 0 ? this.GetItem(this.GetItemCount() - 1) : null;
22198 },
22199 ConvertItemIndexToRowIndex: function (itemIndex) {
22200  return this.listBox.ContainsFixWidthRow() ? itemIndex + 1 : itemIndex;
22201 },
22202 GetScrollDivChildElementHeight: function () {
22203  return this.listBox.GetListTableHeight() + this.listBox.GetTopScrollSpacerHeight() + this.listBox.GetBottomScrollSpacerHeight();
22204 },
22205 IsItemFiltered: function (index) {
22206  return ASPx.GetElementDisplay(this.GetItemRow(index));
22207 },
22208 InsertItem: function (index, itemProperties) {
22209  this.listBox.InsertItemRow(index, itemProperties);
22210 },
22211 InitializeInternalCheckBoxCollection: function () {
22212  var count = this.GetItemCount();
22213  var enabled = this.listBox.GetEnabled();
22214  var changeEventMethod = ASPx.Attr.ChangeEventsMethod(enabled);
22215  for (var i = 0; i < count; i++)
22216   this.listBox.AddInternalCheckBoxToCollectionCore(i, enabled, changeEventMethod);
22217 },
22218 ApplyFilterToItem: function (index, isSatisfy, savePrevState, isFilterReset) {
22219  var itemRow = this.GetItemRow(index);
22220  if (savePrevState) {
22221   var newDisplayValue = isSatisfy ? "" : "none";
22222   ASPx.Attr.ChangeStyleAttribute(itemRow, "display", newDisplayValue);
22223  }
22224  else
22225   ASPx.SetElementDisplay(itemRow, isSatisfy);
22226 },
22227 RestorePrevFilteredState: function (index) {
22228  ASPx.Attr.RestoreStyleAttribute(this.GetItemRow(index), "display");
22229 },
22230 GetItemsHeight: function () {
22231  return this.listBox.GetListTableHeight();
22232 },
22233 GetTotalItemsHeight: function(firstItemIndex, lastItemIndex) {
22234  var result = 0;
22235  var rows = Array.prototype.slice.call(this.listBox.GetItemElements());
22236  var visibleRowsIndexes = [];
22237  rows.forEach(function(row, index) {
22238   if(ASPx.GetElementDisplay(row))
22239    visibleRowsIndexes.push(index);
22240  });
22241  if(firstItemIndex > visibleRowsIndexes.length)
22242   lastItemIndex = visibleRowsIndexes.length - 1;
22243  if(lastItemIndex > visibleRowsIndexes.length)
22244   lastItemIndex = visibleRowsIndexes.length - 1;
22245  for(var i = firstItemIndex;i <= lastItemIndex;i++)
22246   result += this.GetItemHeight(visibleRowsIndexes[i]);
22247  return result;
22248 },
22249 GetItemHeight: function(index) {
22250  if((isNaN(index))) throw new Error("index must be a number");
22251  var itemElement = this.GetItemElement(index);
22252  return itemElement != null ? itemElement.getBoundingClientRect().height : 0;
22253 },
22254 GetItemsWidth: function() {
22255  return this.listTable.offsetWidth;
22256 },
22257 GetNewItemIndexInFilteredRange: function(selectedIndex, step) {
22258  var rows = Array.prototype.slice.call(this.listTable.rows);
22259  var filteredRows = rows.filter(function(row) { 
22260   return ASPx.GetElementDisplay(row);
22261  });
22262  var selectedRow = this.GetItemRow(selectedIndex);
22263  var itemIndexInFilteredRange = ASPx.Data.ArrayIndexOf(filteredRows, selectedRow);
22264  var newItemIndexInFilteredRange = itemIndexInFilteredRange + step;
22265  if(newItemIndexInFilteredRange >= filteredRows.length)
22266   newItemIndexInFilteredRange = filteredRows.length - 1;
22267  else if(newItemIndexInFilteredRange < 0)
22268   newItemIndexInFilteredRange = 0;
22269  var newSelectedRow = filteredRows[newItemIndexInFilteredRange];
22270  return this.GetItemIndexByRow(newSelectedRow);
22271 }
22272});
22273var ListBoxItemsVirtualManager = ASPx.CreateClass(ListBoxItemsManagerBase, {
22274 constructor: function(listBox) {
22275  this.constructor.prototype.constructor.call(this, listBox);
22276  this.smallestItemHeight = 0;
22277  this.smallestItemWidth = 0;
22278  this.previousScrollPosition = 0;
22279 },
22280 Initialize: function () {
22281  ListBoxItemsManagerBase.prototype.Initialize.call(this);
22282  this.virtualScrollTopInvisibleItemsCount = 1;
22283  this.virtualScrollBottomInvisibleItemsCount = 1;
22284  this.showFilterButtonWidthCounted = false;
22285  this.isScrollProcessingActivated = true;
22286  this.InitializeItemRows();
22287  this.virtualScrollVisibleItemIndices = [];
22288  this.updateSmallestItemSize();
22289  this.UpdateScrollTableContainerHeight();
22290 },
22291 GetItemIndexByRow: function (itemRow) {
22292  return itemRow.itemIndex;
22293 },
22294 GetItemCount: function () {
22295  return this.deserializedItems.length;
22296 },
22297 GetItem: function(index, preventEncodeText) {
22298  if (index < 0 || index >= this.GetItemCount())
22299   return null;
22300  var deserializedItem = this.deserializedItems[index];
22301  var itemTexts = this.AdjustItemTexts(deserializedItem, preventEncodeText);
22302  var result = new ASPxClientListBoxItem(this.listBox, index, itemTexts, deserializedItem.value,
22303   deserializedItem.imageUrl, this.listBox.GetIsItemSelected(index));
22304  result.insertOrderIndex = deserializedItem.insertOrderIndex;
22305  return result;
22306 },
22307 GetItemHtmlContent: function(index) {
22308  return this.deserializedItems[index] && this.deserializedItems[index].htmlContent;
22309 },
22310 AdjustItemTexts: function (item, preventEncodeText) {
22311  var itemInnerTexts = this.GetItemInnerTexts(item, preventEncodeText);
22312  if (this.listBox.IsMultiColumn()) {
22313   for (var i = itemInnerTexts.length; i < this.listBox.columnFieldNames.length; i++)
22314    itemInnerTexts.push("");
22315  }
22316  return itemInnerTexts;
22317 },
22318 GetItemInnerTexts: function(item, preventEncodeText) {
22319  if(!item.texts)
22320   return item.texts;
22321  var adjustedItemTexts = [];
22322  for(var i = 0; i < item.texts.length; i++) {
22323   var itemText = item.texts[i] || "";
22324   if(!this.listBox.encodeHtml && !preventEncodeText)
22325    itemText = this.GetEncodedItemInnerText(itemText);
22326   adjustedItemTexts[i] = itemText;
22327  }
22328  return adjustedItemTexts;
22329 },
22330 GetEncodedItemInnerText: function(itemText) {
22331  var result = itemText;
22332  var encodedItemText = ASPx.Str.EncodeHtml(itemText);
22333  if(itemText !== encodedItemText) {
22334   var div = document.createElement("DIV");
22335   ASPx.SetInnerHtml(div, itemText);
22336   result = ASPx.GetInnerText(div);
22337  }
22338  return result;
22339 },
22340 GetVisibleItemCount: function () {
22341  return this.filteredItemIndices.length;
22342 },
22343 GetItemsHeight: function () {
22344  var result = 0;
22345  ASPx.Data.ForEach(this.filteredItemIndices, function(itemIndex) {
22346   result += this.GetItemHeight(itemIndex);
22347  }.bind(this));
22348  return result;
22349 },
22350 GetTotalItemsHeight: function(firstItemIndex, lastItemIndex) {
22351  var result = 0;
22352  if(lastItemIndex >= this.filteredItemIndices.length)
22353   lastItemIndex = this.filteredItemIndices.length - 1;
22354  for(var i = firstItemIndex;i <= lastItemIndex;i++) {
22355   result += this.GetItemHeight(this.filteredItemIndices[i]);
22356  }
22357  return result;
22358 },
22359 GetItemHeight: function(index) {
22360  return this.deserializedItems[index].calculatedHeight ? this.deserializedItems[index].calculatedHeight : this.smallestItemHeight;
22361 },
22362 GetItemsWidth: function() {
22363  var listTableOffsetWidth = this.listTable.offsetWidth;
22364  var showFilterButton = this.listBox.GetShowFilterButton();
22365  if(showFilterButton && !this.showFilterButtonWidthCounted) {
22366   listTableOffsetWidth += showFilterButton.GetMainElement().offsetWidth;
22367   this.showFilterButtonWidthCounted = true;
22368  } 
22369  var itemsWidth = this.UseVirtualItemWidth() ?
22370   Math.max(this.visibleItemTextMaxWidth + this.smallestItemWidth, listTableOffsetWidth)
22371   : listTableOffsetWidth;
22372  return itemsWidth;
22373 },
22374 UseVirtualItemWidth: function() {
22375  return !this.IsFixedWidth() && !this.listBox.hasDecoratedItems && !this.IsItemTextWrapEnabled();
22376 },
22377 IsFixedWidth: function() {
22378  return this.listBox.IsMultiColumn() || this.IsStandaloneListBoxWithFixedWidth();
22379 },
22380 IsStandaloneListBoxWithFixedWidth: function() {
22381  return !this.listBox.isComboBoxList && this.listBox.width !== "";
22382 },
22383 GetFirstRenderedItem: function () {
22384  for (var i = 0; i < this.listTable.rows.length; i++)
22385   if (this.listTable.rows[i].itemIndex !== undefined)
22386    return this.GetItem(this.listTable.rows[i].itemIndex);
22387  return null;
22388 },
22389 GetLastRenderedItem: function () {
22390  for (var i = this.listTable.rows.length - 1; i >= 0; i--)
22391   if (this.listTable.rows[i].itemIndex !== undefined)
22392    return this.GetItem(this.listTable.rows[i].itemIndex);
22393  return null;
22394 },
22395 GetTopSpacersHeight: function () {
22396  return ListBoxItemsManagerBase.prototype.GetTopSpacersHeight.call(this) + this.GetVirtualScrollTopSpacer().clientHeight;
22397 },
22398 GetItemTopOffset: function (index) {
22399  var result = this.GetItemTopOffsetCore(index);
22400  if(result === 0) {
22401   var renderedItemRange = this.GetRenderedItemRange();
22402   if((renderedItemRange.startIndex >= 0 && renderedItemRange.endIndex >= 0) && (index < renderedItemRange.startIndex || index > renderedItemRange.endIndex)) {
22403    itemIndexInFilteredRange = ASPx.Data.ArrayIndexOf(this.filteredItemIndices, index);
22404    if(itemIndexInFilteredRange !== -1) {
22405     result = this.GetTotalItemsHeight(0, itemIndexInFilteredRange) - this.GetItemHeight(itemIndexInFilteredRange);
22406    }
22407   }
22408  }
22409  return result;
22410 },
22411 IsItemVisible: function (index) {
22412  return this.IsItemRendered(index) ? ListBoxItemsManagerBase.prototype.IsItemVisible.call(this, index) : false;
22413 },
22414 AreAllItemsVisible: function() {
22415  return this.filteredItemIndices.length === this.GetItemCount();
22416 },
22417 IsLastItemBottomEdgeVisible: function() {
22418  return this.IsItemEdgeVisible(this.GetLastFilteredItemIndex(), false, true);
22419 },
22420 ConvertItemIndexToRowIndex: function (itemIndex) {
22421  if(this.listTable.rows.length < 1)
22422   return -1;
22423  if(this.AreAllItemsVisible() && this.listBox.syncLockCount < 1 && !this.listBox.hasItemTemplate) { 
22424   var rawIndex = itemIndex - this.listTable.rows[0].itemIndex;
22425   return rawIndex >= 0 && rawIndex < this.listTable.rows.length
22426    ? rawIndex
22427    : ASPx.Data.ArrayIndexOf(this.listTable.rows, itemIndex, function(element) {return element.itemIndex === itemIndex;});
22428  }
22429  return ASPx.Data.ArrayIndexOf(this.listTable.rows, itemIndex, function (element) { return element.itemIndex === itemIndex; });
22430 },
22431 GetScrollDivChildElementHeight: function () {
22432  return this.GetVirtualScrollTableContainer().getBoundingClientRect().height;
22433 },
22434 IsItemFiltered: function (index) {
22435  return this.deserializedItems[index] && this.deserializedItems[index].filtered;
22436 },
22437 GetFirstVisibleItem: function () { 
22438  for(var i = 0; i < this.listTable.rows.length; i++)
22439   if (this.listTable.rows[i] && ASPx.ElementContainsCssClass(this.listTable.rows[i], "dxeListBoxItemRow"))
22440    return this.listTable.rows[i].itemIndex;
22441  return -1;
22442 },
22443 GetFirstFilteredItemIndex: function() {
22444  return this.filteredItemIndices.length > 0 ? this.filteredItemIndices[0] : -1;
22445 },
22446 GetLastFilteredItemIndex: function() {
22447  return this.filteredItemIndices.length > 0 ? this.filteredItemIndices[this.filteredItemIndices.length - 1] : 
22447-1;
22448 },
22449 GetNextFilteredItemIndex: function(currentFilteredItemIndex) {
22450  return this.filteredItemIndices.length > 0 ? this.filteredItemIndices[ASPx.Data.ArrayIndexOf(this.filteredItemIndices, currentFilteredItemIndex) + 1] : -1;
22451 },
22452 GetPrevFilteredItemIndex: function(currentFilteredItemIndex) {
22453  return this.filteredItemIndices.length > 0 ? this.filteredItemIndices[ASPx.Data.ArrayIndexOf(this.filteredItemIndices, currentFilteredItemIndex) - 1] : -1;
22454 },
22455 GetNewItemIndexInFilteredRange: function(selectedIndex, step) {
22456  var itemIndexInFilteredRange = ASPx.Data.ArrayIndexOf(this.filteredItemIndices, selectedIndex);
22457  var newItemIndexInFilteredRange = itemIndexInFilteredRange + step;
22458  if(newItemIndexInFilteredRange >= this.filteredItemIndices.length)
22459   newItemIndexInFilteredRange = this.filteredItemIndices.length - 1;
22460  else if(newItemIndexInFilteredRange < 0)
22461   newItemIndexInFilteredRange = 0;
22462  return this.filteredItemIndices[newItemIndexInFilteredRange];
22463 },
22464 ShouldRenderItemOnInsert: function(index) {
22465  if (!this.listBox.IsDisplayed())
22466   return false;
22467  if (this.GetFirstVisibleItemRow() == null)
22468   return true;
22469  if (this.IsIndexInRenderedItemRange(index))
22470   return true;
22471  if (this.filteredItemIndices.length > 0) {
22472   var startFilteredItemIndex = this.filteredItemIndices[0];
22473   var endFilteredItemIndex = this.filteredItemIndices[this.filteredItemIndices.length - 1];
22474   return index < startFilteredItemIndex && this.IsItemVisible(startFilteredItemIndex)
22475    || index > endFilteredItemIndex && this.IsItemVisible(endFilteredItemIndex);
22476  }
22477  return false;
22478 },
22479 InsertItem: function(index, itemProperties) {
22480  var isInsertToEnd = index === this.GetItemCount();
22481  var isInsertToEndWithLock = isInsertToEnd && this.updateLock;
22482  var shouldRenderItemOnInsert = !isInsertToEndWithLock && this.ShouldRenderItemOnInsert(index);
22483  var isItemInsertedToTop = this.virtualScrollVisibleItemIndices.length > 0 && index < this.virtualScrollVisibleItemIndices[0];
22484  ASPx.Data.ArrayInsert(this.deserializedItems, this.listBox.CreateItem(index, itemProperties), index);
22485  this.deserializedItems[index].filtered = true;
22486  this.deserializedItems[index].insertOrderIndex = this.listBox.FindFreeIndex();
22487  if(!isInsertToEnd) {
22488   for(var i = 0; i < this.deserializedItems.length; i++)
22489    this.deserializedItems[i].index = i;
22490   var requiredItemIndexInFilteredRange = -1;
22491   for(var i = 0; i < this.filteredItemIndices.length; i++)
22492    if(this.filteredItemIndices[i] >= index) {
22493     this.filteredItemIndices[i]++;
22494     if(requiredItemIndexInFilteredRange == -1)
22495      requiredItemIndexInFilteredRange = i;
22496    }
22497   ASPx.Data.ArrayInsert(this.filteredItemIndices, index, requiredItemIndexInFilteredRange);
22498  }
22499  else
22500   this.filteredItemIndices.push(index);
22501  if(shouldRenderItemOnInsert) {
22502   this.updateSmallestItemSize();
22503  }
22504  if(!isInsertToEndWithLock) {
22505   this.virtualScrollVisibleItemIndices = [];
22506   var rows = this.GetListTableRows();
22507   for(var i = 0; i < rows.length; i++) {
22508    var row = rows[i];
22509    if(row.itemIndex !== undefined) {
22510     if(row.itemIndex >= index)
22511      row.itemIndex++;
22512     this.virtualScrollVisibleItemIndices.push(row.itemIndex);
22513    }
22514   }
22515   if(shouldRenderItemOnInsert) {
22516    ASPx.Data.ArrayInsert(this.virtualScrollVisibleItemIndices, index,
22517     ASPx.Data.ArrayIndexOf(this.virtualScrollVisibleItemIndices, index,
22518     function(element) { return element > index; }));
22519    this.listBox.InsertItemRow(index, itemProperties);
22520    this.RecreateItemRowsCompletelly(this.getScrollPosition());
22521   }
22522   this.UpdateScrollTableContainerHeight();
22523   if(isItemInsertedToTop)
22524    this.UpdateVirtualScrollSpacerHeight(this.virtualScrollVisibleItemIndices, 0);
22525   if(!this.listBox.IsDisplayed())
22526    this.listBox.ResetControlAdjustment();
22527  }
22528  this.UpdateItemTextMaxWidth(this.GetItem(index).text);
22529 },
22530 BeginUpdate: function() {
22531  this.updateLock = true;
22532 },
22533 EndUpdate: function() {
22534  this.updateLock = false;
22535  this.updateSmallestItemSize();
22536  this.RecreateItemRowsCompletelly(this.getScrollPosition());
22537  this.UpdateScrollTableContainerHeight();
22538  if(!this.listBox.IsDisplayed())
22539   this.listBox.ResetControlAdjustment();
22540 },
22541 RemoveItem: function(index) {
22542  var shouldRecreateItemRows = this.listBox.IsDisplayed() && this.IsIndexInRenderedItemRange(index);
22543  var shouldRemoveFromRender = this.GetItemRow(index);
22544  var isItemRemovedFromTop = this.virtualScrollVisibleItemIndices.length > 0 && index < this.virtualScrollVisibleItemIndices[0];
22545  var needUpdateItemTextMaxWidth = this.NeedUpdateItemTextMaxWidthOnRemoveItem(index);
22546  ASPx.Data.ArrayRemoveAt(this.deserializedItems, index);
22547  ASPx.Data.ArrayRemove(this.filteredItemIndices, index);
22548  for (var i = 0; i < this.deserializedItems.length; i++)
22549   this.deserializedItems[i].index = i;
22550  for (var i = 0; i < this.filteredItemIndices.length; i++)
22551   if (this.filteredItemIndices[i] > index)
22552    this.filteredItemIndices[i]--;
22553  this.virtualScrollVisibleItemIndices = [];
22554  if (shouldRemoveFromRender)
22555   this.RemoveItemCore(index);
22556  var rows = this.GetListTableRows();
22557  for (var i = 0; i < rows.length; i++) {
22558   var row = rows[i];
22559   if (row.itemIndex !== undefined) {
22560    if(row.itemIndex > index)
22561     row.itemIndex--;
22562    this.virtualScrollVisibleItemIndices.push(row.itemIndex);
22563   }
22564  }
22565  if (shouldRecreateItemRows)
22566   this.RecreateItemRowsCompletelly(this.getScrollPosition());
22567  this.UpdateScrollTableContainerHeight();
22568  if (isItemRemovedFromTop)
22569   this.UpdateVirtualScrollSpacerHeight(this.virtualScrollVisibleItemIndices, 0
22569);
22570  if (needUpdateItemTextMaxWidth) {
22571   this.itemTextMaxWidth = 0;
22572   this.visibleItemTextMaxWidth = 0;
22573   for (var i = 0; i < this.GetItemCount() ; i++)
22574    this.UpdateItemTextMaxWidth(this.GetItem(i).text);
22575  }
22576  if (!this.listBox.IsDisplayed())
22577   this.listBox.ResetControlAdjustment();
22578 },
22579 ClearItems: function () {
22580  this.ClearItemsCore();
22581  this.deserializedItems = [];
22582  this.filteredItemIndices = [];
22583  this.virtualScrollVisibleItemIndices = [];
22584  if (this.listBox.isComboBoxList) {
22585   this.itemTextMaxWidth = 0;
22586   this.visibleItemTextMaxWidth = 0;
22587  }
22588  this.UpdateScrollTableContainerHeight();
22589  if (!this.listBox.IsDisplayed())
22590   this.listBox.ResetControlAdjustment();
22591 },
22592 CreateNewItemRow: function (index) {
22593  var newItemRow = ListBoxItemsManagerBase.prototype.CreateNewItemRow.call(this, index);
22594  newItemRow.itemIndex = index;
22595  return newItemRow;
22596 },
22597 Adjust: function() {
22598  if (this.GetItemCount() == 0 || !this.listBox.IsDisplayed())
22599   return;
22600  if(this.smallestItemHeight === 0) {
22601   this.updateSmallestItemSize();
22602   this.UpdateScrollTableContainerHeight();
22603  }
22604  if(this.smallestItemHeight !== 0) {
22605   if(this.IsItemTextWrapEnabled())
22606    this.CorrectItemsHeight();
22607   this.RecreateItemRowsCompletelly(this.getScrollPosition());
22608   this.listBox.InitializePageSize();
22609   if(!this.listBox.isComboBoxList)
22610    this.listBox.CorrectWidth();
22611  }
22612 },
22613 UpdateItemTextMaxWidth: function (itemText, isFiltering) {
22614  if (!this.UseVirtualItemWidth())
22615   return;
22616  if (!ASPx.IsExists(this.visibleItemTextMaxWidth))
22617   this.visibleItemTextMaxWidth = 0;
22618  this.visibleItemTextMaxWidth = Math.max(this.GetItemTextWidth(itemText), this.visibleItemTextMaxWidth);
22619  if (!isFiltering)
22620   this.itemTextMaxWidth = this.visibleItemTextMaxWidth;
22621 },
22622 GetItemTextWidth: function (itemText) {
22623  return Math.round(this.GetItemTextMeasureContext().measureText(itemText).width);
22624 },
22625 GetItemTextMeasureContext: function() {
22626  if (!this.itemTextMeasureContext) {
22627   var itemTextMeasureCanvas = document.createElement("canvas");
22628   this.itemTextMeasureContext = itemTextMeasureCanvas.getContext("2d");
22629   var mainElementStyle = ASPx.GetCurrentStyle(this.listBox.GetMainElement());
22630   var mainElementFont = mainElementStyle.font ? mainElementStyle.font :
22631    mainElementStyle.fontStyle + " " + mainElementStyle.fontVariant + " " + mainElementStyle.fontWeight + " "
22632     + mainElementStyle.fontSize + " / " + mainElementStyle.lineHeight + " " + mainElementStyle.fontFamily;
22633   this.itemTextMeasureContext.font = mainElementFont;
22634  }
22635  return this.itemTextMeasureContext;
22636 },
22637 NeedUpdateItemTextMaxWidthOnRemoveItem: function(index) {
22638  return this.UseVirtualItemWidth() && this.listBox.isComboBoxList && this.IsItemWithMaxText(this.GetItem(index).text);
22639 },
22640 BeforeClientFiltering: function () {
22641  if (this.listBox.isComboBoxList)
22642   this.visibleItemTextMaxWidth = 0;
22643 },
22644 IsItemWithMaxText: function(itemText) {
22645  return this.GetItemTextWidth(itemText) === this.itemTextMaxWidth;
22646 },
22647 ApplyFilterToItem: function (index, isSatisfy, savePrevState, isFilterReset) {
22648  if (savePrevState && !ASPx.IsExists(this.deserializedItems[index].savedFiltered))
22649   this.deserializedItems[index].savedFiltered = this.deserializedItems[index].filtered;
22650  this.ChangeItemFilteredFlag(index, isSatisfy, isFilterReset);
22651 },
22652 RestorePrevFilteredState: function (index) {
22653  var savedFilteredState = this.deserializedItems[index].savedFiltered;
22654  if (ASPx.IsExists(savedFilteredState)) {
22655   this.ChangeItemFilteredFlag(index, savedFilteredState);
22656   delete this.deserializedItems[index].savedFiltered;
22657  }
22658 },
22659 ChangeItemFilteredFlag: function (index, newValue, isFilterReset) {
22660  var item = this.deserializedItems[index];
22661  item.filtered = newValue;
22662  if (!isFilterReset && this.listBox.isComboBoxList && newValue)
22663   this.UpdateItemTextMaxWidth(item.text);
22664 },
22665 OnEndItemsFiltering: function() {
22666  if(this.listBox.IsDisplayed()) {
22667   this.RecreateItemRowsCompletelly(0);
22668  }
22669 },
22670 ChangeItemsFilteredState: function (action) {
22671  this.filteredItemIndices = [];
22672  ListBoxItemsManagerBase.prototype.ChangeItemsFilteredState.call(this, action);
22673 },
22674 AfterChangeItemFilteredStateAction: function (index) {
22675  if (this.IsItemFiltered(index))
22676   this.filteredItemIndices.push(index);
22677 },
22678 RewriteFilteredItemIndices: function (newFilteredItemIndices) {
22679  this.filteredItemIndices = newFilteredItemIndices;
22680 },
22681 MakeAllItemsVisible: function () {
22682  ListBoxItemsManagerBase.prototype.MakeAllItemsVisible.call(this);
22683  this.visibleItemTextMaxWidth = this.itemTextMaxWidth;
22684 },
22685 MakeItemVisible: function(index) { 
22686  if(index < 0) {
22687   index = 0;
22688  }
22689  ListBoxItemsManagerBase.prototype.MakeItemVisible.call(this, index);
22690 },
22691 InsertTempFirstItemRow: function() {
22692  try {
22693   this.listBox.LockRunStartupSciptsInItemRow();
22694   if(this.deserializedItems.length > 0)
22695    this.listBox.InsertItemRow(0, this.deserializedItems[0]);
22696  }
22697  finally {
22698   this.listBox.UnlockRunStartupSciptsInItemRow();
22699  }
22700 },
22701 RemoveFirstTempRow: function () {
22702  if (this.deserializedItems.length > 0)
22703   this.listBox.RemoveItemRow(0);
22704 },
22705 GetVirtualScrollItemHeight: function(virtualScrollItemRow) {
22706  return virtualScrollItemRow.getBoundingClientRect().height;
22707 },
22708 updateSmallestItemSize: function() {
22709  if(this.smallestItemHeight == 0 && this.GetItemCount() !== 0) {
22710   this.InsertTempFirstItemRow();
22711   var firstItemRow = this.GetFirstVisibleItemRow();
22712   var itemTextCell = this.listBox.GetItemFirstTextCell(0);
22713   var cellDisplay = itemTextCell.style.display; 
22714   itemTextCell.style.display = "";
22715   ASPx.SetInnerHtml(itemTextCell,".");
22716   this.smallestItemHeight = firstItemRow.offsetHeight;
22717   ASPx.AddClassNameToElement(this.listTable, listTableCollapsedClassName);
22718   ASPx.SetInnerHtml(itemTextCell,"");
22719   if(this.UseVirtualItemWidth() && this.smallestItemWidth === 0) {
22720    this.smallestItemWidth = firstItemRow.offsetWidth;
22721   }
22722   itemTextCell.style.display = cellDisplay;
22723   ASPx.RemoveClassNameFromElement(this.listTable, listTableCollapsedClassName);
22724   this.RemoveFirstTempRow();
22725  }
22726 },
22727 UpdateScrollTableContainerHeight: function () {
22728  var virtualScrollTableContainer = this.GetVirtualScrollTableContainer();
22729  if (virtualScrollTableContainer)
22730   ASPx.SetStyles(virtualScrollTableContainer, {
22731    height: this.GetItemsHeight()
22732     + this.listBox.GetTopScrollSpacerHeight()
22733     + this.listBox.GetBottomScrollSpacerHeight()
22734   });
22735 },
22736 UpdateVirtualScrollSpacerHeight: function(visibleIndices, scrollableContainerHeightDelta) {
22737  var firstVisibleIndex = visibleIndices.length > 0 && this.filteredItemIndices.length > 0 ? ASPx.Data.ArrayIndexOf(this.filteredItemIndices, visibleIndices[0]) : 0;
22738  var topSpacerHeight = 0;
22739  if(firstVisibleIndex > 0) {
22740   topSpacerHeight = this.GetTotalItemsHeight(0, firstVisibleIndex - 1);
22741  }
22742  if(!scrollableContainerHeightDelta)
22743   scrollableContainerHeightDelta = 0;
22744  ASPx.SetStyles(this.GetVirtualScrollTopSpacer(), { height: topSpacerHeight - scrollableContainerHeightDelta });
22745 },
22746 OnScrollSpacerVisibilityChanged: function() {
22747  this.UpdateScrollTableContainerHeight();
22748 },
22749 SetItemHtml: function(index, html) {
22750  this.deserializedItems[index].htmlContent = html;
22751 },
22752 SetItemTooltip: function (index, tooltip) {
22753  this.deserializedItems[index].tooltip = tooltip;
22754 },
22755 SetItemAttribute: function(index, attrName, attrValue) {
22756  if(!this.deserializedItems[index].attributes)
22757   this.deserializedItems[index].attributes = {};
22758  this.deserializedItems[index].attributes[attrName] = attrValue;
22759 },
22760 AddClassNameToCssClass: function(cssClass, className) {
22761  return (cssClass == "" || cssClass == undefined) ? className : cssClass + " " + className;
22762 },
22763 RemoveClassNameFromCssClass: function (cssClass, className) {
22764  var updClassName = " " + cssClass + " ";
22765  var newClassName = updClassName.replace(" " + className + " ", " ");
22766  return updClassName.length != newClassName.length ? ASPx.Str.Trim(newClassName) : cssClass;
22767 },
22768 AddItemCssClass: function (index, className) {
22769  this.deserializedItems[index].cssClass = this.AddClassNameToCssClass(this.deserializedItems[index].cssClass, className);
22770 },
22771 RemoveItemCssClass: function (index, className) {
22772  this.deserializedItems[index].cssClass = this.RemoveClassNameFromCssClass(this.deserializedItems[index].cssClass, className);
22773 },
22774 SetItemTextCellHtml: function (itemIndex, textCellIndex, html) {
22775  if (!this.deserializedItems[itemIndex].htmlContents)
22776   this.deserializedItems[itemIndex].htmlContents = [];
22777  this.SetItemTextCellInfoValue(this.deserializedItems[itemIndex].htmlContents, textCellIndex, html);
22778 },
22779 SetItemTextCellTooltip: function (itemIndex, textCellIndex, tooltip) {
22780  if (!this.deserializedItems[itemIndex].cellTooltips)
22781   this.deserializedItems[itemIndex].cellTooltips = [];
22782  this.SetItemTextCellInfoValue(this.deserializedItems[itemIndex].cellTooltips, textCellIndex, tooltip);
22783 },
22784 SetItemTextCellAttribute: function(itemIndex, textCellIndex, attrName, attrValue) {
22785  if(!this.deserializedItems[itemIndex].cellAttributes)
22786   this.deserializedItems[itemIndex].cellAttributes = [];
22787  var setValueAction = function(itemInfo, value) {
22788   if(!itemInfo.value)
22789    itemInfo.value = {};
22790   itemInfo.value[value.attrName] = value.attrValue;
22791  };
22792  this.SetItemTextCellInfoValue(this.deserializedItems[itemIndex].cellAttributes, textCellIndex,
22793   { attrName: attrName, attrValue: attrValue }, setValueAction);
22794 },
22795 AddItemTextCellCssClass: function (itemIndex, textCellIndex, className) {
22796  if (!this.deserializedItems[itemIndex].cellCssClasses)
22797   this.deserializedItems[itemIndex].cellCssClasses = [];
22798  var newCssClass = this.AddClassNameToCssClass(this.deserializedItems[itemIndex].cellCssClasses[textCellIndex], className);
22799  this.SetItemTextCellInfoValue(this.deserializedItems[itemIndex].cellCssClasses, textCellIndex, newCssClass);
22800 },
22801 RemoveItemTextCellCssClass: function (itemIndex, textCellIndex, className) {
22802  if (!this.deserializedItems[itemIndex].cellCssClasses)
22803   this.deserializedItems[itemIndex].cellCssClasses = [];
22804  var newCssClass = this.RemoveClassNameFromCssClass(this.deserializedItems[itemIndex].cellCssClasses[textCellIndex], className);
22805  this.SetItemTextCellInfoValue(this.deserializedItems[itemIndex].cellCssClasses, textCellIndex, newCssClass);
22806 },
22807 SetItemTextCellInfoValue: function (infoArray, textCellIndex, value, setValueAction) {
22808  var itemInfo = null;
22809  var filteredArray = infoArray.filter(function (info) { return info.index === textCellIndex; });
22810  if (filteredArray.length == 0) {
22811   itemInfo = { index: textCellIndex };
22812   infoArray.push(itemInfo);
22813  }
22814  else
22815   itemInfo = filteredArray[0];
22816  if(setValueAction)
22817   setValueAction(itemInfo, value);
22818  else
22819   itemInfo.value = value;
22820 },
22821 InitializeItems: function(items, itemsValue) {
22822  this.deserializedItems = this.listBox.DeserializeItems(items);
22823  this.filteredItemIndices = [];
22824  this.visibleItemTextMaxWidth = 0;
22825  this.itemTextMaxWidth = 0;
22826  for (var i = 0; i < this.deserializedItems.length; i++) {
22827   this.listBox.AdjustItemProperties(this.deserializedItems[i]);
22828   itemsValue[i] = this.deserializedItems[i].value;
22829   this.filteredItemIndices[i] = this.deserializedItems[i].index;
22830   this.deserializedItems[i].filtered = true;
22831   this.deserializedItems[i].insertOrderIndex = this.listBox.FindFreeIndex();
22832   this.UpdateItemTextMaxWidth(this.deserializedItems[i].text);
22833  }
22834 },
22835 InitializeItemRows: function () {
22836  var topSpacer = ASPx.CreateHtmlElement("DIV");
22837  topSpacer.id = this.listBox.name + "VirtualScrollTopSpacer";
22838  var tableContainer = ASPx.CreateHtmlElement("DIV");
22839  tableContainer.id = this.listBox.name + ListBoxVirtualScrollTableContainerIDPostfix;
22840  tableContainer.appendChild(topSpacer);
22841  var scrollDiv = this.listBox.GetScrollDivElement();
22842  ASPx.MoveChildrenToElement(scrollDiv, tableContainer);
22843  scrollDiv.appendChild(tableContainer);
22844  ASPx.SetStyles(tableContainer, { overflow: "hidden", width: "100%" });
22845  ASPx.Evt.AttachEventToElement(scrollDiv, "scroll", this.onScroll.bind(this));
22846 },
22847 getScrollPosition: function() {
22848  var scrollDiv = this.listBox.GetScrollDivElement();
22849  var scrollTop = scrollDiv.scrollTop - this.listBox.GetTopScrollSpacerHeight();
22850  if(scrollTop < 0)
22851   scrollTop = 0;
22852  return scrollTop;
22853 },
22854 onScroll: function() {
22855  var scrollTop = this.getScrollPosition();
22856  if(this.IsScrollActivated()) {
22857   var scrollDiv = this.listBox.GetScrollDivElement();
22858   if(!scrollDiv) return;
22859   var scrollDivHeight = scrollDiv.clientHeight;
22860   var scrollContainerHeight = this.GetScrollDivChildElementHeight();
22861   var scrollToBottom = scrollContainerHeight <= scrollDivHeight ? false : scrollTop >= scrollContainerHeight - scrollDivHeight;
22862   var virtualScrollTopSpacerHeight = this.GetVirtualScrollTopSpacer().getBoundingClientRect().height;
22863   var isSmallScroll = Math.abs(scrollTop - this.previousScrollPosition) < scrollDivHeight;
22864   if(isSmallScroll && virtualScrollTopSpacerHeight > scrollTop)
22865    isSmallScroll = false;
22866   if(isSmallScroll)
22867    this.RecreateItemRowsPartially(scrollTop);
22868   else
22869    this.RecreateItemRowsCompletelly(scrollTop);
22870   if(scrollToBottom) {
22871    this.DeactivateScrollHandler();
22872    scrollDiv.scrollTop = this.GetScrollDivChildElementHeight() - scrollDivHeight;
22873   }
22874  }
22875  else {
22876   this.ActivateScrollHandler();
22877  }
22878  this.previousScrollPosition = scrollTop;
22879 },
22880 RecreateItemRowsCompletelly: function(scrollTop) {
22881  this.RecreateItemRows(scrollTop, false);
22882 },
22883 RecreateItemRowsPartially: function(scrollTop) {
22884  this.RecreateItemRows(scrollTop, true);
22885 },
22886 RecreateItemRows: function(scrollTop, recreateItemsPartially) {
22887  if(recreateItemsPartially == "undefined") throw new Error("recreateItemsPartially");
22888  if(this.listBox.IsDisplayed()) {
22889   var firstVisibleItemIndex = this.getFirstVisibleItemIndex(scrollTop);
22890   var lastVisibleItemIndex = this.getLastVisibleItemIndex(scrollTop);
22891   this.RecreateItemRowsCore(firstVisibleItemIndex, lastVisibleItemIndex, recreateItemsPartially);
22892   if(typeof (ASPxClientHint) != "undefined")
22893    this.UpdateHintControl();
22894   this.listBox.AssignEllipsisTooltips();
22895  }
22896 },
22897 RecreateItemRowsCore: function(topRenderedItemIndex, bottomRenderedItemIndex, recreateItemsPartially) {
22898  if(topRenderedItemIndex > bottomRenderedItemIndex && this.filteredItemIndices.length > 0)
22899   return;
22900  var newVisibleIndices = this.filteredItemIndices.slice(topRenderedItemIndex, bottomRenderedItemIndex + 1);
22901  this.RecreateItemRowsByVisibleIndices(newVisibleIndices, false, recreateItemsPartially);
22902  this.OnDecoratedItemsRendering();
22903  if(this.listBox.NeedToHandleCellWidth())
22904   this.listBox.CorrectCellNullWidthStyle(this.GetFirstVisibleItemRow());
22905 },
22906 getFirstVisibleItemIndex: function(scrollTop) {
22907  var result = -1;
22908  var scrollDiv = this.listBox.GetScrollDivElement();
22909  var scrollDivHeight = scrollDiv.clientHeight;
22910  var scrollContainerHeight = this.GetScrollDivChildElementHeight();
22911  var scrollToBottom = scrollContainerHeight <= scrollDivHeight ? false : scrollTop >= scrollContainerHeight - scrollDivHeight;
22912  var height = 0;
22913  if(scrollToBottom) {
22914   for(var i = this.filteredItemIndices.length - 1;i >= 0;i--) {
22915    height += this.GetItemHeight(this.filteredItemIndices[i]);
22916    if(height > scrollDivHeight) {
22917     result = i;
22918     break;
22919    }
22920   }
22921  }
22922  else {
22923   for(var i = 0;i < this.filteredItemIndices.length;i++) {
22924    height += this.GetItemHeight(this.filteredItemIndices[i]);
22925    if(height > scrollTop) {
22926     result = i > 1 ? i - 1 : 0;
22927     break;
22928    }
22929   }
22930  }
22931  return result;
22932 },
22933 getLastVisibleItemIndex: function(scrollTop) {
22934  var result = -1;
22935  var scrollDiv = this.listBox.GetScrollDivElement();
22936  var scrollDivHeight = scrollDiv.clientHeight;
22937  var scrollContainerHeight = this.GetScrollDivChildElementHeight();
22938  var scrollToBottom = scrollContainerHeight <= scrollDivHeight ? false : scrollTop >= scrollContainerHeight - scrollDivHeight;
22939  if(scrollToBottom) {
22940   result = this.filteredItemIndices[this.filteredItemIndices.length - 1];
22941  }
22942  else {
22943   var height = 0;
22944   result = this.filteredItemIndices.length - 1;
22945   if(this.filteredItemIndices) {
22946    for(var i = 0;i < this.filteredItemIndices.length;i++) {
22947     height += this.GetItemHeight(this.filteredItemIndices[i]);
22948     if(height >= (scrollTop + scrollDivHeight)) {
22949      result = i;
22950      break;
22951     }
22952    }
22953   }
22954  }
22955  return result == this.filteredItemIndices.length - 1 ? result : result + 1;
22956 },
22957 UpdateHintControl: function() {
22958  ASPxClientHint.hideByTargetsContainerElement(this.listTable, true);
22959  ASPxClientHint.Update();
22960 },
22961 GetScrollContentHeight: function() {
22962  return this.GetVirtualScrollTopSpacer().getBoundingClientRect().height
22963   + this.listBox.GetTopScrollSpacerHeight() + this.listBox.GetBottomScrollSpacerHeight()
22964   + this.listTable.getBoundingClientRect().height;
22965 },
22966 removeItems: function(indicesToRemove) {
22967  var renderedItemIndexesBeforeModification = this.virtualScrollVisibleItemIndices;
22968  var removedFromTopItemsHeight = 0;
22969  for(var i = 0;i < indicesToRemove.length;i++) {
22970   var itemIndex = indicesToRemove[i];
22971   if(renderedItemIndexesBeforeModification.indexOf(itemIndex) === 0) {
22972    removedFromTopItemsHeight += this.GetItemHeight(itemIndex);
22973    renderedItemIndexesBeforeModification = renderedItemIndexesBeforeModification.slice(1);
22974   }
22975   this.listBox.RemoveItemRow(itemIndex);
22976  }
22977  return removedFromTopItemsHeight;
22978 },
22979 insertItems: function(indicesToInsert) {
22980  var firstVisibleItemIndexBeforeInsert = this.GetFirstVisibleItem();
22981  var scrollableContainerHeightDelta = 0;
22982  var insertedToTopItemsHeight = 0;
22983  for(var i = 0;i < indicesToInsert.length;i++) {
22984   var itemIndex = indicesToInsert[i];
22985   if(itemIndex < firstVisibleItemIndexBeforeInsert) {
22986    insertedToTopItemsHeight += this.GetItemHeight(itemIndex);
22987   }
22988   this.listBox.InsertItemRow(itemIndex, this.deserializedItems[itemIndex]);
22989   if(!this.deserializedItems[itemIndex].calculatedHeight) {
22990    var itemRowElement = this.GetItemRow(itemIndex);
22991    var imageElements = itemRowElement.querySelectorAll("img");
22992    var updateCalculatedHeightFunction = function(itemIndex, itemRowElement) {
22993     this.deserializedItems[itemIndex].calculatedHeight = this.GetVirtualScrollItemHeight(itemRowElement);
22994     this.RecreateItemRows(this.getScrollPosition(),true);
22995    };
22996    for(var j = 0;j < imageElements.length;j++) {
22997     var img = imageElements[j];
22998     if(!img.complete) {
22999      ASPx.Evt.AttachEventToElement(img, "load", updateCalculatedHeightFunction.bind(this, itemIndex, itemRowElement));
23000      ASPx.Evt.AttachEventToElement(img, "error", updateCalculatedHeightFunction.bind(this, itemIndex, itemRowElement));
23001     }
23002    }
23003    this.deserializedItems[itemIndex].calculatedHeight = this.GetVirtualScrollItemHeight(itemRowElement);
23004    if(itemIndex < firstVisibleItemIndexBeforeInsert) {
23005     scrollableContainerHeightDelta += this.deserializedItems[itemIndex].calculatedHeight - this.smallestItemHeight;
23006    }
23007   }
23008   var isItemSelected = this.listBox.GetIsItemSelected(itemIndex);
23009   var stateController = typeof (ASPx.GetStateController) != "undefined" ? ASPx.GetStateController() : null;
23010   this.listBox.SetItemSelectionAppearance(itemIndex, isItemSelected, stateController, false);
23011   if (this.listBox.GetIsCheckColumnExists())
23012    this.listBox.SetCheckBoxChecked(itemIndex, isItemSelected);
23013   this.listBox.ChangeEnabledStateItem(itemIndex, this.listBox.GetEnabled(), stateController);
23014  }
23015  return {
23016   scrollableContainerHeightDelta: scrollableContainerHeightDelta,
23017   insertedToTopItemsHeight: insertedToTopItemsHeight
23018  };
23019 },
23020 RecreateItemRowsByVisibleIndices: function(newVisibleIndices, keepTopSpacerHeight, recreateItemsPartially) {
23021  if(recreateItemsPartially == "undefined") throw new Error("recreateItemsPartially");
23022  if(keepTopSpacerHeight == "undefined") throw new Error("keepTopSpacerHeight");
23023  newVisibleIndices = newVisibleIndices || [];
23024  var indicesToRemove = this.virtualScrollVisibleItemIndices.filter(function(index) {
23025   return newVisibleIndices.indexOf(index) === -1;
23026  });
23027  var indicesToInsert = newVisibleIndices.filter(function(index) {
23028   return this.virtualScrollVisibleItemIndices.indexOf(index) === -1;
23029  }.bind(this));
23030  this.listBox.LockSynchronization();
23031  var removedFromTopItemsHeight = this.removeItems(indicesToRemove);
23032  var insertionInfo = this.insertItems(indicesToInsert);
23033  var scrollableContainerHeightDelta = insertionInfo.scrollableContainerHeightDelta;
23034  var insertedToTopItemsHeight = insertionInfo.insertedToTopItemsHeight;
23035  this.virtualScrollVisibleItemIndices = newVisibleIndices;
23036  this.UpdateScrollTableContainerHeight();
23037  this.listBox.TryApplyHighlighting();
23038  this.listBox.UnlockSynchronization();
23039  if(recreateItemsPartially) {
23040   var virtualScrollTopSpacer = this.GetVirtualScrollTopSpacer();
23041   var newHeight = virtualScrollTopSpacer.getBoundingClientRect().height - insertedToTopItemsHeight + removedFromTopItemsHeight;
23042   newHeight = newHeight >= 0 ? newHeight : 0;
23043   ASPx.SetStyles(virtualScrollTopSpacer, { height: newHeight });
23044   if(scrollableContainerHeightDelta !== 0) {
23045    this.DeactivateScrollHandler();
23046    this.listBox.GetScrollDivElement().scrollTop += scrollableContainerHeightDelta;
23047   }
23048  }
23049  else if(!keepTopSpacerHeight)
23050   this.UpdateVirtualScrollSpacerHeight(newVisibleIndices);
23051  this.listBox.InitDXTextAttributes();
23052 },
23053 GetVirtualScrollTableContainer: function () {
23054  return this.listBox.tempCache.Get("virtualScrollTableContainer", this.GetVirtualScrollTableContainerCore.aspxBind(this), this.listBox);
23055 },
23056 GetVirtualScrollTableContainerCore: function () {
23057  if (!ASPx.IsExistsElement(this.listBox.virtualScrollTableContainer))
23058   this.listBox.virtualScrollTableContainer = ASPx.GetElementById(this.listBox.name + ListBoxVirtualScrollTableContainerIDPostfix);
23059  return this.listBox.virtualScrollTableContainer;
23060 },
23061 GetVirtualScrollTopSpacer: function () {
23062  return this.listBox.tempCache.Get("virtualScrollTopSpacer", this.GetVirtualScrollTopSpacerCore.aspxBind(this), this.listBox);
23063 },
23064 GetVirtualScrollTopSpacerCore: function () {
23065  if (!ASPx.IsExistsElement(this.listBox.virtualScrollTopSpacer))
23066   this.listBox.virtualScrollTopSpacer = ASPx.GetElementById(this.listBox.name + "VirtualScrollTopSpacer");
23067  return this.listBox.virtualScrollTopSpacer;
23068 },
23069 GetRenderedItemRange: function () {
23070  var firstRenderedItem = this.GetFirstRenderedItem();
23071  var lastRenderedItem = this.GetLastRenderedItem();
23072  return {
23073   startIndex: firstRenderedItem ? firstRenderedItem.index : -1,
23074   endIndex: lastRenderedItem ? lastRenderedItem.index : -1
23075  };
23076 },
23077 IsIndexInRenderedItemRange: function(index) {
23078  var renderedItemRange = this.GetRenderedItemRange();
23079  return index >= renderedItemRange.startIndex && index <= renderedItemRange.endIndex;
23080 },
23081 IsItemRendered: function (itemIndex) {
23082  return this.GetItemRow(itemIndex) !== null;
23083 },
23084 IsItemTextWrapEnabled: function() {
23085  if(!ASPx.IsExists(this.enableItemTextWrap)) {
23086   var sampleItemFirstTextCell = this.listBox.GetSampleItemFirstTextCell();
23087   this.enableItemTextWrap = sampleItemFirstTextCell && ASPx.GetCurrentStyle(sampleItemFirstTextCell).whiteSpace !== "nowrap";
23088  }
23089  return this.enableItemTextWrap;
23090 },
23091 OnDecoratedItemsRendering: function () {
23092  if(this.listBox.hasDecoratedItems && !this.IsFixedWidth() && this.listBox.IsDisplayed() && !this.IsItemTextWrapEnabled())
23093   this.listBox.CorrectWidth();
23094 },
23095 DeactivateScrollHandler: function() { 
23096  this.isScrollProcessingActivated = false;
23097 },
23098 ActivateScrollHandler: function() { 
23099  this.isScrollProcessingActivated = true;
23100 },
23101 CorrectItemsHeight: function() {
23102  var needUpdateSmallestItemSize = false;
23103  var rows = this.GetListTableRows();
23104  for(var i = 0; i < rows.length; i++) {
23105   var row = rows[i];
23106   var index = row.itemIndex;
23107   if(index != undefined) {
23108    var deserializedItem = this.GetDeserializedItemByIndex(index);
23109    var rowHeight = this.GetVirtualScrollItemHeight(row);
23110    if(deserializedItem.calculatedHeight != rowHeight) {
23111     this.deserializedItems[index].calculatedHeight = rowHeight;
23112     needUpdateSmallestItemSize = true;
23113    }
23114   }
23115  }
23116  if(needUpdateSmallestItemSize) {
23117   this.smallestItemHeight = 0;
23118   this.updateSmallestItemSize();
23119  }
23120 },
23121 GetDeserializedItemByIndex: function(itemIndex) {
23122  return this.deserializedItems.filter(function(item) { return item.index == itemIndex; })[0];
23123 },
23124 IsScrollActivated: function() {
23125  return this.isScrollProcessingActivated;
23126 }
23127});
23128var ASPxClientListEdit = ASPx.CreateClass(ASPxClientEdit, {
23129 constructor: function(name) {
23130  this.constructor.prototype.constructor.call(this, name);
23131  this.SelectedIndexChanged = new ASPxClientEvent();
23132  this.savedSelectedIndex = -1;
23133 },
23134 FindInputElement: function() {
23135  return this.FindStateInputElement();
23136 },
23137 FindStateInputElement: function(){
23138  return document.getElementById(this.name + leVISuffix);
23139 },
23140 GetItem: function(index) {
23141  throw "Not implemented";
23142 },
23143 GetItemValue: function(index) {
23144  throw "Not implemented";
23145 },
23146 GetValue: function(){
23147  return this.GetItemValue(this.GetSelectedIndex());
23148 }, 
23149 GetSelectedIndexInternal: function(){
23150  return this.savedSelectedIndex;
23151 },
23152 SetSelectedIndexInternal: function(index){
23153  this.savedSelectedIndex = index;
23154 },
23155 FindItemIndexByValue: function(value){
23156  for(var i = 0; i < this.GetItemCount(); i++){
23157   if(this.GetItemValue(i) == value)
23158    return i;
23159  }
23160  return -1;
23161 },
23162 RaiseItemClick: function() {
23163  var processOnServer = this.autoPostBack;
23164  if(!this.ItemClick.IsEmpty()){
23165   var args = new ASPxClientProcessingModeEventArgs(processOnServer);
23166   this.ItemClick.FireEvent(this, args);
23167   processOnServer = args.processOnServer;
23168  }
23169  return processOnServer;
23170 },
23171 RaiseItemDoubleClick: function() {
23172  var processOnServer = this.autoPostBack;
23173  if(!this.ItemDoubleClick.IsEmpty()){
23174   var args = new ASPxClientProcessingModeEventArgs(processOnServer);
23175   this.ItemDoubleClick.FireEvent(this, args);
23176   processOnServer = args.processOnServer;
23177  }
23178  return processOnServer;
23179 },
23180 RaiseValueChangedEvent: function() {
23181  if(!this.isInitialized) return false;
23182  var processOnServer = ASPxClientEdit.prototype.RaiseValueChangedEvent.call(this);
23183  processOnServer = this.RaiseValueChangedAdditionalEvents(processOnServer);
23184  return processOnServer;
23185 },
23186 RaiseValueChangedAdditionalEvents: function(processOnServer){
23187  return this.RaiseSelectedIndexChanged(processOnServer);
23188 },
23189 RaiseSelectedIndexChanged: function (processOnServer) {
23190  this.RaiseValidationInternal();
23191  if(!this.SelectedIndexChanged.IsEmpty()){
23192   var args = new ASPxClientProcessingModeEventArgs(processOnServer);
23193   this.SelectedIndexChanged.FireEvent(this, args);
23194   processOnServer = args.processOnServer;
23195  }
23196  return processOnServer;
23197 },
23198 UpdateHiddenInputs: function(){
23199  var element = this.FindStateInputElement();
23200  if(ASPx.IsExistsElement(element)) {
23201   var value = this.GetValue();
23202   if(value == null)
23203    value = "";
23204   element.value = value;
23205  }
23206 },
23207 GetModifyEvent: function () {
23208  return this.SelectedIndexChanged;
23209 },
23210 GetSelectedItem: function(){
23211  var index = this.GetSelectedIndexInternal();
23212  return this.GetItem(index);
23213 },
23214 GetSelectedIndex: function(){
23215  return this.GetSelectedIndexInternal();
23216 },
23217 SetSelectedItem: function(item){
23218  var index = (item != null) ? item.index : -1;
23219  this.SetSelectedIndex(index);
23220 },
23221 SetSelectedIndex: function(index){
23222  this.SelectIndexSilent(index);
23223 },
23224 SelectIndexSilent: function(index){
23225  throw "Not implemented";
23226 },
23227 OnValueChanged: function () {
23228  var processOnServer = this.RaiseValueChangedEvent() && this.GetIsValid();
23229  if(processOnServer)
23230   this.SendPostBackInternal("");
23231 },
23232 getElementToObserveVisibilityChange: function () {
23233  return this.GetMainElement();
23234 },
23235 processVisibilityChanged: function (visible) {
23236  var focusHandlingInputForKeyboardSupport = this.GetMainElement().querySelector(".dxKBSI");
23237  ASPx.ToggleClassNameToElement(focusHandlingInputForKeyboardSupport, "dx-position-fixed", visible);
23238 }
23239});
23240var ASPxClientListEditItem = ASPx.CreateClass(null, {
23241 constructor: function(listEditBase, index, text, value, imageUrl){
23242  this.listEditBase = listEditBase;
23243  this.index = index;
23244  this.imageUrl = imageUrl;
23245  this.text = text;
23246  this.value = value;
23247 }
23248});
23249var ASPxClientListBoxItem = ASPx.CreateClass(ASPxClientListEditItem, {
23250 constructor: function(listEditBase, index, texts, value, imageUrl, selected, cellStyles, cellCssClasses, cellTooltips, cellAttributes, htmlContents, style, cssClass, tooltip, attributes, htmlContent) {
23251  this.constructor.prototype.constructor.call(this, listEditBase, index, null, value, imageUrl);
23252  this.selected = !!selected;
23253  this.texts = texts;
23254  this.text = listEditBase.FormatText(texts, value);
23255  this.cellStyles = cellStyles;
23256  this.cellCssClasses = cellCssClasses;
23257  this.cellTooltips = cellTooltips;
23258  this.cellAttributes = cellAttributes;
23259  this.htmlContents = htmlContents;
23260  this.style = style;
23261  this.cssClass = cssClass;
23262  this.tooltip = tooltip;
23263  this.attributes = attributes;
23264  this.htmlContent = htmlContent;
23265 },
23266 GetColumnText: function(columnIndexOrFieldName){
23267  var columnIndex = -1;
23268  if(typeof(columnIndexOrFieldName) == "string")
23269   columnIndex = ASPx.Data.ArrayIndexOf(this.listEditBase.columnFieldNames, columnIndexOrFieldName);
23270  else if(typeof(columnIndexOrFieldName) == "number")
23271   columnIndex = columnIndexOrFieldName;
23272  return this.GetColumnTextByIndex(columnIndex);
23273 },
23274 GetColumnTextByIndex: function(columnIndex){
23275  if(0 <= columnIndex && columnIndex < this.texts.length)
23276   return this.texts[columnIndex];
23277  else
23278   return null;
23279 }
23280});
23281var ListBoxScrollCallbackHelperBase = ASPx.CreateClass(null, {
23282 constructor: function(listBoxControl) {
23283  this.listBoxControl = listBoxControl;
23284  this.itemsRange = "";
23285  this.defaultItemsRange = "0:" + (this.listBoxControl.callbackPageSize - 1);
23286 },
23287 OnScroll: function(){ },
23288 Reset: function(){ },
23289 IsScrolledToTopSpacer: function(){ return false; },
23290 IsScrolledToBottomSpacer: function(){ return false; },
23291 GetIsNeedToHideTopSpacer: function(){ return false; },
23292 GetIsNeedCallback: function(){ return false; },
23293 GetIsAnySpacerVisible: function() { return false; },
23294 GetItemsRangeForLoad: function(){ return this.defaultItemsRange; },
23295 SetItemsRangeForLoad: function(){}
23296});
23297var ListBoxScrollCallbackHelper = ASPx.CreateClass(ListBoxScrollCallbackHelperBase, {
23298 constructor: function(listBoxControl) {
23299  this.constructor.prototype.constructor.call(this, listBoxControl);
23300  this.isScrolledToTopSpacer = false;
23301  this.isScrolledToBottomSpacer = false;
23302 },
23303 OnScroll: function(){
23304  this.DetectScrollDirection();
23305  this.ResetItemsRange();
23306  if(this.GetIsAnySpacerVisible())
23307   this.RecalcItemsRangeForLoad();
23308 },
23309 DetectScrollDirection: function(){
23310  var listBoxControl = this.listBoxControl;
23311  var divElement = listBoxControl.GetScrollDivElement();
23312  var scrollTop = divElement.scrollTop;
23313  var scrollBottom = divElement.scrollTop + divElement.clientHeight;
23314  var isTopSpacerVisible = listBoxControl.GetScrollSpacerVisibility(true);
23315  var isBottomSpacerVisible = listBoxControl.GetScrollSpacerVisibility(false);
23316  this.isScrolledToTopSpacer = (scrollTop < parseInt(listBoxControl.GetTopSpacersHeight())) && isTopSpacerVisible;
23317  var listHeight = this.GetListHeight();
23318  this.isScrolledToBottomSpacer = (scrollBottom >= listBoxControl.GetTopSpacersHeight() + listHeight) && isBottomSpacerVisible;
23319 },
23320 GetListHeight: function () {
23321  var listTable = this.listBoxControl.GetListTable();
23322  return listTable.clientHeight;
23323 },
23324 Reset: function(){
23325  this.ResetItemsRange();
23326  this.isScrolledToTopSpacer = false;
23327  this.isScrolledToBottomSpacer = false;
23328 },
23329 ResetItemsRange: function(){
23330  this.itemsRange = "";
23331 },
23332 RecalcItemsRangeForLoad: function(){
23333  if(this.listBoxControl.isCallbackMode) {
23334   if(this.isScrolledToTopSpacer || this.isScrolledToBottomSpacer)
23335    this.SetItemsRangeForLoad(this.isScrolledToTopSpacer);
23336  }
23337 },
23338 IsScrolledToTopSpacer: function(){
23339  return this.isScrolledToTopSpacer;
23340 },
23341 IsScrolledToBottomSpacer: function(){
23342  return this.isScrolledToBottomSpacer;
23343 },
23344 GetIsAnySpacerVisible: function(){
23345  return this.isScrolledToTopSpacer || this.isScrolledToBottomSpacer;
23346 },
23347 GetIsNeedCallback: function(){
23348  return !this.GetIsItemsRangeEmpty();
23349 },
23350 GetIsNeedToHideTopSpacer: function(){
23351  return this.isScrolledToTopSpacer && this.GetIsItemsRangeEmpty();
23352 },
23353 GetItemsRangeForLoad: function(){
23354  return (!this.GetIsItemsRangeEmpty() ? this.itemsRange : this.defaultItemsRange);
23355 },
23356 SetItemsRangeForLoad: function(isForTop){
23357  var listbox = this.listBoxControl;
23358  var beginIndex = isForTop ? 
23359   listbox.serverIndexOfFirstItem - listbox.callbackPageSize : 
23360   listbox.serverIndexOfFirstItem + listbox.GetItemCount();
23361  beginIndex = beginIndex < 0 ? 0 : beginIndex;
23362  var endIndex = isForTop ? 
23363   listbox.serverIndexOfFirstItem - 1 : 
23364   beginIndex + listbox.callbackPageSize - 1;
23365  this.itemsRange = beginIndex + ":" + endIndex;
23366  this.isScrolledToTopSpacer = isForTop;
23367  this.isScrolledToBottomSpacer = !isForTop;
23368 },
23369 GetIsItemsRangeEmpty: function(){
23370  return (this.itemsRange == "" || this.itemsRange == emptyItemsRange);
23371 }
23372});
23373var ASPxClientListBoxBase = ASPx.CreateClass(ASPxClientListEdit, {
23374 constructor: function(name) {
23375  this.constructor.prototype.constructor.call(this, name);
23376  this.APILockCount = 0;
23377  this.updateSelectAllElementsLockCount = 0;
23378  this.enableSyncOnPerfCallback = false;
23379  this.scrollOnKBNavigationLockCount = 0;
23380  this.isComboBoxList = false;
23381  this.isSyncEnabled = true;
23382  this.ownerName = "";
23383  this.selectionEventsLockCount = 0;
23384  this.syncLockCount = 0;
23385  this.encodeHtml = true;
23386  this.useCaseInsensitiveSearch = true;
23387  this.serializingHelper = null;
23388  this.deletedItems = [];
23389  this.insertedItems = [];
23390  this.itemsValue = [];
23391  this.ItemDoubleClick = new ASPxClientEvent();
23392  this.ItemClick = new ASPxClientEvent();
23393 },
23394 InlineInitialize: function () {
23395  ASPxClientListEdit.prototype.InlineInitialize.call(this);
23396  for(var i = 0; i < this.itemsValue.length; i++)
23397   this.itemsValue[i] = this.GetDecodeValue(this.itemsValue[i]);
23398 },
23399 LockScrollOnKBNavigation: function(){
23400  this.scrollOnKBNavigationLockCount++;
23401 },
23402 UnlockScrollOnKBNavigation: function(){
23403  this.scrollOnKBNavigationLockCount--;
23404 },
23405 IsScrollOnKBNavigationLocked: function() {
23406  return this.scrollOnKBNavigationLockCount > 0;
23407 },
23408 LockSelectionEvents: function(){
23409  this.selectionEventsLockCount++;
23410 },
23411 UnlockSelectionEvents: function(){
23412  this.selectionEventsLockCount--;
23413 },
23414 IsSelectionEventsLocked: function(){
23415  return this.selectionEventsLockCount > 0;
23416 },
23417 LockSynchronizationOnInternalCallback: function(){
23418  if(!this.enableSyncOnPerfCallback)
23419   this.LockSynchronization();
23420 },
23421 UnlockSynchronizationOnInternalCallback: function (){
23422  if(!this.enableSyncOnPerfCallback)
23423   this.UnlockSynchronization();
23424 },
23425 GetItemCount: function(){
23426  return 0;
23427 },
23428 GetItemValue: function(index){
23429  if(0 <= index && index < this.GetItemCount())
23430   return this.PrepareItemValue(this.itemsValue[index]);
23431  return null;
23432 },
23433 GetItemTexts: function(item) {
23434  return item.text;
23435 },
23436 PrepareItemValue: function(value) {
23437  return (typeof(value) == "string" && value == "" && this.convertEmptyStringToNull) ? null : value;
23438 },
23439 LoadItemsFromCallback: function(isToTop, itemStrings){
23440 },
23441 SetValue: function(value){
23442  var index = this.FindItemIndexByValue(value);
23443  this.SelectIndexSilentAndMakeVisible(index);
23444 },
23445 FindItemIndexByText: function(text){
23446  var transformText = function(text) { return text; };
23447  var textIsString = typeof(text) === "string";
23448  if(this.useCaseInsensitiveSearch && textIsString)
23449   transformText = function(text) { return text.toUpperCase(); };
23450  text = transformText(text);
23451  for(var i = 0; i < this.GetItemCount(); i ++){
23452   if(transformText(this.GetItem(i).text) == text)
23453    return i;
23454  }
23455  return -1;
23456 },
23457 SelectIndex: function (index){ 
23458  if(this.SelectIndexSilentAndMakeVisible(index, false)){
23459   this.RaisePersonalStandardValidation();
23460   this.OnValueChanged();
23461  }
23462 },
23463 SelectIndexSilentAndMakeVisible: function(index, lockScrollingToItem){
23464  var selectionChanged = this.SelectIndexSilent(index);
23465  if(!this.IsScrollOnKBNavigationLocked() && !lockScrollingToItem && selectionChanged)
23466   this.MakeItemVisible(index);
23467  return selectionChanged;
23468 },
23469 FormatText: function (texts) {
23470  return texts;
23471 },
23472 MakeItemVisible: function(index){
23473 },
23474 InitOnContainerMadeVisible: function(){
23475 },
23476 AddItem: function(texts, value, imageUrl) {
23477  return this.AddItemInternal(this.CreateItemProperties(texts, value, imageUrl));
23478 },
23479 AddItemInternal: function(itemProperties) {
23480  var index = this.GetItemCount();
23481  this.InsertItemInternal(index, itemProperties);
23482  if(!ASPx.IsExists(this.GetItem(index)))
23483   index = -1;
23484  return index;
23485 },
23486 InsertItem: function(index, texts, value, imageUrl) {
23487  this.InsertItemInternal(index, this.CreateItemProperties(texts, value, imageUrl));
23488 },
23489 CreateItemProperties: function(texts, value, imageUrl, htmlContent, cssClass, tooltip) {
23490  return {
23491   texts: texts,
23492   value: value,
23493   imageUrl: imageUrl,
23494   htmlContent: htmlContent,
23495   cssClass: cssClass,
23496   tooltip: tooltip
23497  };
23498 },
23499 InsertItemInternal: function(index, itemProperties) {
23500 },
23501 BeginUpdate: function(){
23502  this.APILockCount ++;
23503 },
23504 EndUpdate: function(){
23505  this.APILockCount --;
23506  this.Synchronize();
23507 },
23508 LockUpdateSelectAllElements: function() {
23509  this.updateSelectAllElementsLockCount++;
23510 },
23511 UnlockUpdateSelectAllElements: function () {
23512  this.updateSelectAllElementsLockCount--;
23513 },
23514 IsUpdateSelectAllElementsLocked: function() {
23515  return this.updateSelectAllElementsLockCount > 0;
23516 },
23517 ClearItems: function(){
23518  this.BeginUpdate();
23519  this.UpdateArraysItemsCleared();
23520  this.ClearItemsCore();
23521  this.EndUpdate();
23522 },
23523 ClearItemsCore: function(){
23524 },
23525 ClearItemsForPerformCallback: function(){
23526  this.itemsValue = [];
23527  this.ClearItemsCore();
23528 },
23529 RemoveItem: function(index){
23530 },
23531 FindItemByText: function(text){
23532  var index = this.FindItemIndexByText(text);
23533  return this.GetItem(index);
23534 },
23535 FindItemByValue: function(value){
23536  var index = this.FindItemIndexByValue(value);
23537  return this.GetItem(index);
23538 },
23539 PerformCallback: function(arg) {
23540 },
23541 GetCallbackArguments: function(){
23542  var args = this.GetCustomCallbackArg();
23543  args += this.GetLoadItemsRangeCallbackArg();
23544  if(this.filterStrategy)
23545   args += this.filterStrategy.GetCallbackArguments();
23546  return args;
23547 },
23548 GetLoadItemsRangeCallbackArg: function(){
23549  return this.GetLoadItemsRangeCallbackArgCore(this.GetItemsRangeForLoad());
23550 },
23551 GetLoadCustomItemsRangeCallbackArguments: function(beginIndex, endIndex, value) {
23552  var itemsRange = beginIndex + ":" + endIndex;
23553  if(ASPx.IsExists(value))
23554   itemsRange = itemsRange + ":" + ASPx.Json.ToJson(value);
23555  var args = this.GetCustomCallbackArg();
23556  args += this.GetLoadItemsRangeCallbackArgCore(itemsRange);
23557  return args;
23558 },
23559 GetLoadItemsRangeCallbackArgCore: function(itemsRange) {
23560  return this.FormatCallbackArg(CONSTANTS.CALLBACK_PREFIXES.LOAD_RANGE_ITEMS, itemsRange);
23561 },
23562 FormatCallbackArg: function(prefix, arg) { 
23563  arg = arg.toString();
23564  return (ASPx.IsExists(arg) ? prefix + "|" + arg.length + ';' + arg + ';' : "");
23565 },
23566 GetItemsRangeForLoad: function(){
23567  return emptyItemsRange;
23568 },
23569 GetCallbackOwnerControl: function(){
23570  if(this.ownerName && !this.ownerControl)
23571   this.ownerControl = ASPx.GetControlCollection().Get(this.ownerName);
23572  return this.ownerControl;
23573 },
23574 GetCustomCallbackArg: function(){
23575  return this.stateObject["CustomCallback"];
23576 },
23577 SetCustomCallbackArg: function(arg){
23578  this.UpdateStateObjectWithObject({ CustomCallback: arg });
23579 },
23580 FormatAndSetCustomCallbackArg: function(arg, onPerformCallback){
23581  arg = ASPx.IsExists(arg) ? arg.toString() : "";
23582  var formatArg = this.FormatCallbackArg(onPerformCallback ? CONSTANTS.CALLBACK_PREFIXES.CUSTOMPERFORM : CONSTANTS.CALLBACK_PREFIXES.CUSTOM, arg);
23583  this.SetCustomCallbackArg(formatArg);
23584 },
23585 SendCallback: function(){
23586 },
23587 LockSynchronization: function(){
23588  this.syncLockCount++;
23589 },
23590 UnlockSynchronization: function(){
23591  this.syncLockCount--;
23592 },
23593 IsSyncLocked: function(){
23594  return this.syncLockCount > 0;
23595 },
23596 IsSyncEnabled: function(){
23597  return this.isSyncEnabled && !this.IsSyncLocked();
23598 },
23599 RegisterInsertedItem: function(index, itemProperties){
23600  if(this.IsSyncEnabled()){
23601   this.RefreshSynchroArraysIndex(index, true);
23602   var item = this.CreateItem(index, itemProperties);
23603   this.insertedItems.push(item);
23604   this.Synchronize();
23605  }
23606 },
23607 CreateItem: function(index, itemProperties) {
23608  return new ASPxClientListBoxItem(this, index, itemProperties.texts || [itemProperties.text], itemProperties.value, itemProperties.imageUrl,
23609   itemProperties.selected, itemProperties.cellStyles, itemProperties.cellCssClasse
23609s, itemProperties.cellTooltips, itemProperties.cellAttributes, itemProperties.htmlContents,
23610   itemProperties.style, itemProperties.cssClass, itemProperties.tooltip, itemProperties.attributes, itemProperties.htmlContent);
23611 },
23612 UpdateSyncArraysItemDeleted: function(item, isValueRemovingRequired){
23613  if(isValueRemovingRequired)
23614   ASPx.Data.ArrayRemoveAt(this.itemsValue, item.index);
23615  if(this.IsSyncEnabled()){
23616   var index = this.FindItemInArray(this.insertedItems, item);
23617   if(index == -1){
23618    this.RefreshSynchroArraysIndex(item.index, false);
23619    this.deletedItems.push(item);
23620   } else {
23621    this.RefreshSynchroArraysIndex(item.index, false);
23622    ASPx.Data.ArrayRemoveAt(this.insertedItems, index);
23623   }
23624   this.Synchronize();
23625  }
23626 },
23627 UpdateArraysItemsCleared: function(){
23628  if(this.IsSyncEnabled()){
23629   for(var i = this.GetItemCount() - 1; i >= 0; i --)
23630    this.UpdateSyncArraysItemDeleted(this.GetItem(i), false);
23631  } 
23632  this.itemsValue = [];
23633 },
23634 RefreshSynchroArraysIndex: function(startIndex, isIncrease){
23635  this.RefreshSynchroArrayIndexIndex(this.deletedItems, startIndex, isIncrease);
23636  this.RefreshSynchroArrayIndexIndex(this.insertedItems, startIndex, isIncrease);
23637 },
23638 RefreshSynchroArrayIndexIndex: function(array, startIndex, isIncrease){
23639  var delta = isIncrease ? 1 : -1;
23640  for(var i = 0; i < array.length; i ++){
23641   if(array[i].index >= startIndex)
23642    array[i].index += delta;
23643  }   
23644 },
23645 FindItemInArray: function(array, item){
23646  for(var i = array.length - 1; i >= 0; i--){
23647   var currentItem = array[i];
23648   if((!this.encodeHtml || currentItem.text == item.text) && currentItem.value == item.value &&
23649    currentItem.imageUrl == item.imageUrl)
23650    break;
23651  }
23652  return i;
23653 },
23654 Synchronize: function(){
23655  if(this.APILockCount == 0){
23656   if(this.IsSyncEnabled()){
23657    this.SynchronizeItems(this.deletedItems, "DeletedItems");
23658    this.SynchronizeItems(this.insertedItems, "InsertedItems");
23659   }
23660   this.CorrectSizeByTimer();
23661  }
23662 },
23663 CorrectSizeByTimer: function(){
23664 },
23665 SynchronizeItems: function(items, syncType){
23666  var itemsObj = { };
23667  itemsObj[syncType] = this.SerializeItems(items);
23668  this.UpdateStateObjectWithObject(itemsObj);
23669 },
23670 GetSerializingHelper: function(){ 
23671  if(this.serializingHelper == null)
23672   this.serializingHelper = this.CreateSerializingHelper();
23673  return this.serializingHelper;
23674 },
23675 CreateSerializingHelper: function(){
23676  return new ListBoxBaseItemsSerializingHelper(this);
23677 },
23678 SerializeItems: function(items){
23679  var serialiser = this.GetSerializingHelper();
23680  return serialiser.SerializeItems(items);
23681 },
23682 DeserializeItems: function(items) {
23683  return items.map(function(itemProperties, index) {
23684   return this.CreateItem(index, itemProperties);
23685  }.bind(this));
23686 }
23687});
23688var ListBoxBaseItemsSerializingHelper = ASPx.CreateClass(null, {
23689 constructor: function(listBoxControl) {
23690  this.listBoxControl = listBoxControl;
23691  this.startPos = 0;
23692 },
23693 SerializeItems: function(items){
23694  var sb = [ ];
23695  for(var i = 0; i < items.length; i++)
23696   this.SerializeItem(sb, items[i]);
23697  return sb.join("");
23698 },
23699 SerializeItem: function(sb, item) {
23700  if(!item)
23701   return;
23702  this.SerializeAtomValue(sb, item.index);
23703  this.SerializeAtomValue(sb, item.value);
23704  this.SerializeAtomValue(sb, item.imageUrl);
23705  var texts = this.listBoxControl.GetItemTexts(item);
23706  if(typeof(texts) == "string")
23707   this.SerializeAtomValue(sb, texts);
23708  else {
23709   for(var i = 0; i < texts.length; i++)
23710    this.SerializeAtomValue(sb, texts[i]);
23711  }
23712 },
23713 SerializeAtomValue: function(sb, value) {
23714  var valueStr = ASPx.IsExists(value) ? value.toString() : "";
23715  sb.push(valueStr.length);
23716  sb.push('|');
23717  sb.push(valueStr);
23718 },
23719 ParseItemIndex: function(serializedItem){
23720  return parseInt(this.ParseString(serializedItem));
23721 },
23722 ParseItemValue: function(serializedItem){
23723  return this.ParseString(serializedItem);
23724 },
23725 ParseString: function(str){
23726  var indexOfSeparator = str.indexOf(serializingSeparator, this.startPos);
23727  var strLength = parseInt(str.substring(this.startPos, indexOfSeparator));
23728  var strStartPos = indexOfSeparator + serializingSeparatorLength;
23729  this.startPos = strStartPos + strLength;
23730  return str.substring(strStartPos, strStartPos + strLength);
23731 },
23732 ParseTexts: function(serializedItems){
23733  return this.ParseString(serializedItems);
23734 },
23735 DeserializeValues: function(serializedValues){
23736  var deserializedValues = [];
23737  this.startPos = 0;
23738  while(this.startPos < serializedValues.length){
23739   deserializedValues.push(this.ParseItemValue(serializedValues));
23740  }
23741  return deserializedValues;
23742 }
23743});
23744var ListBoxItemsSerializingHelper = ASPx.CreateClass(ListBoxBaseItemsSerializingHelper, {
23745 constructor: function(listBoxControl) {
23746  this.constructor.prototype.constructor.call(this, listBoxControl);
23747 },
23748 ParseTexts: function(serializedItems){
23749  var textColumnCount = this.listBoxControl.GetItemTextCellCount();
23750  return (textColumnCount > 1) ? this.DeserializeItemTexts(serializedItems, textColumnCount) 
23751   : ListBoxBaseItemsSerializingHelper.prototype.ParseTexts.call(this, serializedItems);
23752 },
23753 DeserializeItemTexts: function(serializedItem, textColumnCount){
23754  var texts = [];
23755  for(var i = 0; i < textColumnCount; i++)
23756   texts.push(this.ParseString(serializedItem));
23757  return texts;
23758 }
23759});
23760var ListBoxSingleSelectionHelper = ASPx.CreateClass(null, {
23761 constructor: function(listBoxControl) {
23762  this.listBoxControl = listBoxControl;
23763  this.savedSelectedIndex = listBoxControl.savedSelectedIndex;
23764  this.updateHiddenInputsLockCount = 0;
23765  this.cachedSelectionChangedArgs = [];
23766 },
23767 ClearSelection: function(){
23768  this.SetSelectedIndexCore(-1);
23769  this.OnSelectionCleared();
23770 },
23771 OnSelectionCleared: function(){
23772  this.cachedSelectionChangedArgs = [];
23773 },
23774 GetSelectedIndexInternal: function(){
23775  return this.savedSelectedIndex;
23776 }, 
23777 SetSelectedIndexInternal: function(index){
23778  this.savedSelectedIndex = index;
23779 }, 
23780 SetSelectedIndexCore: function(index){
23781  if(index != this.savedSelectedIndex && -1 <= index && index < this.GetItemCount()){
23782   this.BeginSelectionUpdate();
23783   this.SetSelectedIndexInternal(index);
23784   this.EndSelectionUpdate();
23785   return true;
23786  }
23787  return false;
23788 },
23789 GetSelectedIndex: function(){
23790  return this.GetSelectedIndexInternal();
23791 },
23792 SetSelectedIndex: function(index){
23793  this.ChangeSelectedItem(index);
23794  this.SetSelectedIndexCore(index);
23795  this.OnItemSelectionChanged(index, true);
23796 },
23797 GetSelectedIndices: function(){ 
23798  var selectedIndex = this.GetSelectedIndexInternal();
23799  return selectedIndex != -1 ? [selectedIndex] : [];
23800 },
23801 GetSelectedValues: function(){ 
23802  var selectedValue =  this.listBoxControl.GetValue();
23803  return selectedValue != null ? [selectedValue] : [];
23804 },
23805 GetSelectedItems: function(){ 
23806  var selectedItem = this.listBoxControl.GetSelectedItem();
23807  return selectedItem != null? [selectedItem] : [];
23808 },
23809 SelectIndices: function(indices){},
23810 SelectItems: function(items){},
23811 SelectValues: function(values){},
23812 UnselectIndices: function (selected) { this.SetSelectedIndex(-1); },
23813 UnselectItems: function(items){},
23814 UnselectValues: function(values){},
23815 GetIsItemSelected: function(index){ return index == this.GetSelectedIndexInternal(); },
23816 ResetSelectionCollectionsCache: function(){ },
23817 OnItemClick: function(index, evt){
23818  var selected = true;
23819  this.BeginSelectionUpdate();
23820  this.ChangeSelectedItem(index);
23821  var selectedIndexChanged = this.SetSelectedIndexCore(index);
23822  this.EndSelectionUpdate();
23823  if(selectedIndexChanged)
23824   this.OnItemSelectionChanged(index, selected);
23825 },
23826 ChangeSelectedItem: function(newSelectedIndex){
23827  var selected = true;
23828  var oldSelectedIndex = this.GetSelectedIndexInternal();
23829  this.BeginSelectionUpdate();
23830  this.SetItemSelectionState(oldSelectedIndex, !selected);
23831  this.SetItemSelectionState(newSelectedIndex, selected);
23832  this.EndSelectionUpdate();
23833 },
23834 SetItemSelectionState: function (itemIndex, selected, controller) {
23835  this.BeginSelectionUpdate();
23836  this.listBoxControl.SetItemSelectionAppearance(itemIndex, selected, controller, true);
23837  this.EndSelectionUpdate();
23838 },
23839 GetFocusedIndex: function(){
23840  return this.GetSelectedIndexInternal();
23841 },
23842 BeginSelectionUpdate: function(){
23843  this.updateHiddenInputsLockCount++;
23844 },
23845 EndSelectionUpdate: function(){
23846  this.updateHiddenInputsLockCount--;
23847  if(!this.IsUpdateInternalSelectionStateLocked()){
23848   this.listBoxControl.UpdateInternalState();
23849   this.FlushSelectionChanged();
23850  }
23851 },
23852 IsUpdateInternalSelectionStateLocked: function(){
23853  return this.updateHiddenInputsLockCount > 0;
23854 },
23855 GetItemCount: function(){
23856  return this.listBoxControl.GetItemCount();
23857 },
23858 OnItemSelectionChanged: function(index, selected){
23859  if(this.IsUpdateInternalSelectionStateLocked()){
23860   var a = {Index: index, Selected: selected};
23861   this.cachedSelectionChangedArgs.push(a);
23862  }
23863  else 
23864   this.listBoxControl.OnItemSelectionChanged(index, selected);
23865 },
23866 FlushSelectionChanged: function(){
23867  if(this.IsUpdateInternalSelectionStateLocked()) 
23868   return;
23869  for(var i = 0; i < this.cachedSelectionChangedArgs.length; i++)
23870   this.listBoxControl.OnItemSelectionChanged(this.cachedSelectionChangedArgs[i].Index, this.cachedSelectionChangedArgs[i].Selected);
23871  this.cachedSelectionChangedArgs = [];
23872 },
23873 OnItemInserted: function(index){
23874  if(index <= this.savedSelectedIndex && this.savedSelectedIndex != -1)
23875   this.SetSelectedIndexInternal(this.savedSelectedIndex + 1);
23876 },
23877 OnItemRemoved: function(index){
23878  if(index < this.savedSelectedIndex)
23879   this.SetSelectedIndexInternal( this.savedSelectedIndex - 1);
23880  else if(index == this.savedSelectedIndex)
23881   this.SetSelectedIndexInternal(-1);
23882 },
23883 OnItemsCleared: function(){
23884  this.ClearSelection();
23885 }
23886});
23887var ListBoxMultiSelectionHelper = ASPx.CreateClass(ListBoxSingleSelectionHelper, {
23888 constructor: function(listBoxControl) {
23889  this.constructor.prototype.constructor.call(this, listBoxControl);
23890  this.selectedValuesCache = [];
23891  this.selectedItemsCache = [];
23892  this.savedSelectedIndices = [];
23893  this.selectedIndicesSortingRequired = false;
23894  this.focusedIndex = -1;
23895  this.lastIndexFocusedWithoutShift = -1;
23896 },
23897 SetSelectedIndex: function(index){
23898  this.SingleIndexSelection(index);
23899 },
23900 SetSelectedIndexCore: function(index){
23901  ListBoxSingleSelectionHelper.prototype.SetSelectedIndexCore.call(this, index);
23902  this.updateSelectAllElementsState();
23903 },
23904 updateSelectAllElementsState: function() {
23905  this.listBoxControl.updateSelectAllElementsState();
23906 },
23907 ResetSelectionCollectionsCache: function(){
23908  this.selectedIndicesSortingRequired = true;
23909  this.selectedItemsCache = [];
23910  this.selectedValuesCache = [];
23911 },
23912 GetSelectedIndices: function(){
23913  return this.GetSortedSelectedIndices().slice();
23914 },
23915 GetSortedSelectedIndices: function() {
23916  if(this.savedSelectedIndices.length > 1 && this.selectedIndicesSortingRequired)
23917   this.SortSelectedIndices();
23918  return this.savedSelectedIndices;
23919 },
23920 GetSelectedValues: function(){ 
23921  if(this.savedSelectedIndices.length == 0)
23922   return [];
23923  if(this.selectedValuesCache.length == 0)
23924   this.selectedValuesCache = this.GetSelectedValuesCore();
23925  return this.selectedValuesCache;
23926 },
23927 GetSelectedValuesCore: function(){
23928  var selectedValues = [];
23929  var selectedIndices = this.GetSortedSelectedIndices();
23930  if(selectedIndices.length == 0)
23931   return selectedValues;
23932  for(var i = 0; i < selectedIndices.length; i++)
23933   selectedValues.push(this.listBoxControl.GetItemValue([selectedIndices[i]]));
23934  return selectedValues;
23935 },
23936 GetSelectedItems: function(){
23937  if(this.savedSelectedIndices.length == 0)
23938   return [];
23939  if(this.selectedItemsCache.length == 0)
23940   this.selectedItemsCache = this.GetSelectedItemsCore();
23941  return this.selectedItemsCache;
23942 },
23943 GetSelectedItemsCore: function(){
23944  var selectedItems = [];
23945  for(var i = 0; i < this.savedSelectedIndices.length; i++)
23946   selectedItems.push(this.listBoxControl.GetItem(this.savedSelectedIndices[i]));
23947  return selectedItems;
23948 },
23949 SetIndicesSelectionState: function(indices, selected){
23950  this.BeginSelectionUpdate();
23951  var controller = typeof(ASPx.GetStateController) != "undefined" ? ASPx.GetStateController() : null;
23952  if(indices){
23953   var itemCount = this.listBoxControl.GetItemCount();
23954   for(var i = 0; i < indices.length; i++) {
23955    var index = indices[i];
23956    if(index >= 0 && index < itemCount)
23957     this.SetItemSelectionState(indices[i], selected, controller);
23958   }
23959  } else if(this.IsClientFilterApplied())
23960   this.SetAllFilteredItemsSelectionState(selected, controller);
23961  else
23962   this.SetAllItemsSelectionState(selected, controller);
23963  this.SetSelectedIndexCore(this.GetFirstSelectedIndex());
23964  this.EndSelectionUpdate();
23965 },
23966 IsClientFilterApplied: function() {
23967  return this.listBoxControl.IsClientFilterApplied();
23968 },
23969 SetAllFilteredItemsSelectionState: function (selected, controller) {
23970  for (var i = 0; i < this.listBoxControl.GetItemCount() ; i++) {
23971   if (this.listBoxControl.IsItemFiltered && !this.listBoxControl.IsItemFiltered(i))
23972    continue;
23973   this.SetItemSelectionState(i, selected, controller);
23974  }
23975 },
23976 SetItemsSelectionState: function(items, selected){
23977  var indices = items ? this.ConvertItemsToIndices(items) : null;
23978  this.SetIndicesSelectionState(indices, selected);
23979 },
23980 SetValuesSelectionState: function(values, selected){
23981  var indices = values ? this.ConvertValuesToIndices(values)  : null;
23982  this.SetIndicesSelectionState(indices, selected);
23983 },
23984 ConvertValuesToIndices: function(values){
23985  var indices = [];
23986  for(var i = 0; i < values.length; i++)
23987   indices.push(this.listBoxControl.FindItemIndexByValue(values[i]));
23988  return indices;
23989 },
23990 ConvertItemsToIndices: function(items){
23991  var indices = [];
23992  for(var i = 0; i < items.length; i++)
23993   indices.push(items[i].index);
23994  return indices;
23995 },
23996 SelectIndices: function(indices){
23997  this.SetIndicesSelectionState(indices, true);
23998 },
23999 SelectItems: function(items){
24000  this.SetItemsSelectionState(items, true);
24001 },
24002 SelectValues: function(values){
24003  this.SetValuesSelectionState(values, true);
24004 },
24005 UnselectIndices: function(indices){
24006  this.SetIndicesSelectionState(indices, false);
24007 },
24008 UnselectItems: function(items){
24009  this.SetItemsSelectionState(items, false);
24010 },
24011 UnselectValues: function(values){
24012  this.SetValuesSelectionState(values, false);  
24013 },
24014 GetIsItemSelected: function(index){ 
24015  return ASPx.Data.ArrayBinarySearch(this.GetSortedSelectedIndices(), index) > -1;
24016 },
24017 OnItemClick: function(index, evt){
24018  this.BeginSelectionUpdate();
24019  var ctrlKey = evt.ctrlKey || evt.metaKey;
24020  var shift = evt.shiftKey;
24021  if(ctrlKey)
24022   this.AddSelectedIndex(index);
24023  else if(shift){
24024   var startIndex = index > this.lastIndexFocusedWithoutShift ? this.lastIndexFocusedWithoutShift + 1 : index;
24025   var endIndex = index > this.lastIndexFocusedWithoutShift ? index : this.lastIndexFocusedWithoutShift - 1;
24026   this.SelectRangeIndicesOnly(startIndex, endIndex);
24027   this.SetFocusedIndexInternal(index, true);
24028  }else 
24029   this.SingleIndexSelection(index);
24030  this.EndSelectionUpdate();
24031 },
24032 OnItemCheckBoxClick: function(index, evt){
24033  this.BeginSelectionUpdate();
24034  this.AddSelectedIndex(index);
24035  this.EndSelectionUpdate();
24036 },
24037 AddSelectedIndex: function(index){
24038  this.SetFocusedIndexInternal(index, false);
24039  var indexInSelectedIndices = ASPx.Data.ArrayIndexOf(this.savedSelectedIndices, index);
24040  var selectionOperation = indexInSelectedIndices == -1;
24041  this.SetItemSelectionState(index, selectionOperation);
24042  this.SetSelectedIndexCore(this.GetFirstSelectedIndex());
24043 },
24044 SelectRangeIndicesOnly: function(startIndex, endIndex){
24045  this.BeginSelectionUpdate();
24046  var controller = typeof(ASPx.GetStateController) != "undefined" ? ASPx.GetStateController() : null;
24047  var itemCount = this.GetItemCount();
24048  for(var i = 0; i < itemCount; i ++) {
24049   if(i == this.lastIndexFocusedWithoutShift) 
24050    continue;
24051   if(startIndex !== endIndex && this.listBoxControl.IsItemFiltered && !this.listBoxControl.IsItemFiltered(i))
24052    continue;
24053   this.SetItemSelectionState(i, i >= startIndex && i <= endIndex, controller);
24054  }
24055  this.SetSelectedIndexCore(this.GetFirstSelectedIndex());
24056  this.EndSelectionUpdate();
24057 },
24058 SingleIndexSelection: function(index){
24059  this.SetFocusedIndexInternal(-1, false);
24060  this.SelectRangeIndicesOnly(index, index);
24061  this.SetFocusedIndexInternal(index, false);
24062 },
24063 SetAllItemsSelectionState: function(selected, controller){
24064  this.BeginSelectionUpdate();
24065  this.savedSelectedIndices = [ ];
24066  var itemCount = this.GetItemCount();
24067  for (var i = 0; i < itemCount; i++) {
24068   this.SetItemSelectionStateCore(i, selected, controller);
24069   if(selected)
24070    this.PushSelectedIndex(i);
24071   this.OnItemSelectionChanged(i, selected);
24072  }
24073  this.ResetSelectionCollectionsCache();
24074  this.EndSelectionUpdate();
24075 },
24076 SetItemSelectionState: function(itemIndex, selected, controller){
24077  this.SetItemSelectionStateCore(itemIndex, selected, controller);
24078  this.ResetSelectionCollectionsCache();
24079  var indexInSelectionArray = this.savedSelectedIndices.indexOf(itemIndex);
24080  if(selected && indexInSelectionArray == -1){
24081   this.PushSelectedIndex(itemIndex);
24082   this.OnItemSelectionChanged(itemIndex, true);
24083  }
24084  if(!selected && indexInSelectionArray != -1){
24085   this.RemoveSelectedIndexAt(indexInSelectionArray);
24086   this.OnItemSelectionChanged(itemIndex, false);
24087  }
24088 },
24089 GetFirstSelectedIndex: function(){
24090  var selectedIndices = this.GetSelectedIndices();
24091  var selectedIndicesCount = selectedIndices.length;
24092  var firstSelectedIndex = -1;
24093  if(selectedIndicesCount > 0){
24094   firstSelectedIndex = selectedIndices[0];
24095   for(var i = 1; i < selectedIndices.length; i++){
24096    if(firstSelectedIndex > selectedIndices[i])
24097     firstSelectedIndex = selectedIndices[i];
24098   }
24099  }
24100  return firstSelectedIndex;
24101 },
24102 PushSelectedIndex: function(index){
24103  this.savedSelectedIndices.push(index);
24104 },
24105 RemoveSelectedIndex: function(index){
24106  ASPx.Data.ArrayRemove(this.savedSelectedIndices, index);
24107 },
24108 RemoveSelectedIndexAt: function(indexInArray){
24109  ASPx.Data.ArrayRemoveAt(this.savedSelectedIndices, indexInArray);
24110 },
24111 SortSelectedIndices: function(){
24112  ASPx.Data.ArrayIntegerAscendingSort(this.savedSelectedIndices);
24113  this.selectedIndicesSortingRequired = false;
24114 },
24115 SetItemSelectionStateCore: function(itemIndex, selected, controller){
24116  ListBoxSingleSelectionHelper.prototype.SetItemSelectionState.call(this, itemIndex, selected, controller);
24117 },
24118 GetFocusedIndex: function(){
24119  return this.focusedIndex;
24120 },
24121 SetFocusedIndexInternal: function(index, isShiftPressed){
24122  if(!isShiftPressed)
24123   this.lastIndexFocusedWithoutShift = index;
24124  this.focusedIndex = index;
24125 },
24126 OnItemInserted: function(index){
24127  this.ResetSelectionCollectionsCache();
24128  ListBoxSingleSelectionHelper.prototype.OnItemInserted.call(this, index);
24129  if(this.focusedIndex >= index)
24130   this.focusedIndex ++;
24131  for(var i = 0; i < this.savedSelectedIndices.length; i++){
24132   if(this.savedSelectedIndices[i] >= index)
24133    this.savedSelectedIndices[i]++;
24134  }
24135  this.updateSelectAllElementsState();
24136 },
24137 OnItemRemoved: function(index){
24138  this.ResetSelectionCollectionsCache();
24139  ListBoxSingleSelectionHelper.prototype.OnItemRemoved.call(this, index);
24140  if(this.focusedIndex == index)
24141   this.focusedIndex = -1;
24142  else if(this.focusedIndex > index)
24143   this.focusedIndex --;
24144  if(this.GetIsItemSelected(index))
24145   this.RemoveSelectedIndex(index);
24146  for(var i = 0; i < this.savedSelectedIndices.length; i++){
24147   if(this.savedSelectedIndices[i] > index)
24148    this.savedSelectedIndices[i]--;
24149  }
24150  if(this.GetSelectedIndex() == -1)
24151   this.SetSelectedIndexCore(this.GetFirstSelectedIndex());
24152  this.updateSelectAllElementsState();
24153 },
24154 ClearSelection: function(){
24155  this.ResetSelectionCollectionsCache();
24156  ASPx.Data.ArrayClear(this.savedSelectedIndices);
24157  this.OnSelectionCleared();
24158  this.SetSelectedIndexCore(-1);
24159 }
24160});
24161var CheckBoxListMultiSelectionHelper = ASPx.CreateClass(ListBoxMultiSelectionHelper, {
24162 OnItemClick: function(index){
24163  this.BeginSelectionUpdate();
24164  this.AddSelectedIndex(index);
24165  this.EndSelectionUpdate();
24166 },
24167 GetFocusedItemIndex: function(){
24168  return this.lastIndexFocusedWithoutShift;
24169 },
24170 updateSelectAllElementsState: function () { },
24171 IsClientFilterApplied: function() { return false; }
24172});
24173var ListBoxCheckSelectionHelper = ASPx.CreateClass(ListBoxMultiSelectionHelper, {
24174 OnItemClick: function(index, evt){
24175  this.BeginSelectionUpdate();
24176  if(evt.shiftKey)
24177   ListBoxMultiSelectionHelper.prototype.OnItemClick.call(this, index, evt);
24178  else
24179   this.AddSelectedIndex(index);
24180  this.EndSelectionUpdate();
24181 }
24182});
24183var ASPxClientListBox = ASPx.CreateClass(ASPxClientListBoxBase, {
24184 constructor: function(name) {
24185  this.constructor.prototype.constructor.call(this, name);
24186  this.freeUniqIndex = -1;
24187  this.isHasFakeRow = false;
24188  this.headerDiv = null;
24189  this.headerTable = null;
24190  this.listTable = null;
24191  this.sampleItemFirstTextCell = null;
24192  this.width = "";
24193  this.defaultHeight = "";
24194  this.hasSampleItem = false;
24195  this.hoverClasses = [""];
24196  this.hoverCssArray = [""];
24197  this.selectAllHoverClasses = [""];
24198  this.selectAllHoverCssArray = [""];
24199  this.selectAllDisabledClasses = [""];
24200  this.selectAllDisabledCssArray = [""];
24201  this.selectedClasses = [""];
24202  this.selectedCssArray = [""];
24203  this.disabledClasses = [""];
24204  this.disabledCssArray = [""];
24205  this.imageCellExists = false;
24206  this.scrollHandlerLockCount = 0;
24207  this.columnFieldNames = [];
24208  this.textFormatString = "";
24209  this.nullValueItemDisplayText = null;
24210  this.defaultImageUrl = "";
24211  this.selectionMode = 0;
24212  this.initSelectedIndices = [];
24213  this.itemHorizontalAlign = "";
24214  this.emptyTextRowCellIndices = null;
24215  this.accessibilityHelper = null;
24216  this.accessibilityHelperID = "";
24217  this.allowMultipleCallbacks = false;
24218  this.isCallbackMode = false;
24219  this.callbackPageSize = -1;
24220  this.isTopSpacerVisible = false;
24221  this.isBottomSpacerVisible = false;
24222  this.serverIndexOfFirstItem = 0;
24223  this.scrollHelper = null;
24224  this.changeSelectAfterCallback = 0;
24225  this.ownerControl = null;
24226  this.SampleItem = null;
24227  this.sampleHeaderRow = null;
24228  this.scrollDivElement = null;
24229  this.scrollPageSize = 4;
24230  this.itemsValue = [];
24231  this.cachedValue = null;
24232  this.tempCache = new ListBoxTemporaryCache();
24233  this.sizingConfig.adjustControl = true;
24234  this.disableScrolling = false;
24235  this.icbFocusedStyle = null;
24236  this.icbImageProperties = null;
24237  this.internalCheckBoxCollection = null;
24238  this.focusableCheckInput = null;
24239  this.nativeCheckOnFocusHandler = null;
24240  this.enableSelectAll = false;
24241  this.enableFiltering = false;
24242  this.filteringDelay = 100;
24243  this.filterMinLength = 1;
24244  this.filterTimerID = -1;
24245  this.customFilteringEditorID = "";
24246  this.filteringTextBox = null;
24247  this.filteringTextBoxInput = null;
24248  this.showFilterButtonInput = null;
24249  this.highlighting = this.CreateHighlightingHelper();
24250  this.hasDecoratedItems = false;
24251  this.scrollDivMinWidth = 0;
24252  this.ItemFiltering = new ASPxClientEvent();
24253  this.CustomHighlighting = new ASPxClientEvent();
24254 },
24255 Initialize: function() {   
24256  this.LockScrollHandler();
24257  this.InitScrollPos();
24258  if(ASPx.Browser.WebKitTouchUI && !this.disableScrolling)
24259   ASPx.TouchUIHelper.MakeScrollable(this.GetScrollDivElement(), {showHorizontalScrollbar: false});
24260  this.CreateInternalCheckBoxCollection();
24261  this.InitSelection();
24262  if(!this.isComboBoxList)
24263   this.AdjustControlCore();
24264  this.InitializeLoadOnDemand();
24265  this.UnlockScrollHandler();
24266  if(!this.HasVirtualScrolling())
24267   this.freeUniqIndex = this.GetItemCount();
24268  ASPxClientEdit.prototype.Initialize.call(this);
24269  if(this.NeedUnfocusableScrollDivElement())
24270   ASPx.Attr.SetAttribute(this.GetScrollDivElement(), "tabIndex", "-1");
24271  this.EnsureFilteringElements();
24272 },
24273 InitDXTextAttributes: function(){
24274  if(this.emptyTextRowCellIndices != null){
24275   var itemWithDXTextCount = this.emptyTextRowCellIndices.length;
24276   for(var i = 0; i < itemWithDXTextCount; i++){
24277    var itemIndex = this.emptyTextRowCellIndices[i][0];
24278    var cellIndices = this.emptyTextRowCellIndices[i][1];
24279    var itemRow = this.GetItemRow(itemIndex);
24280    if(!itemRow) continue;
24281    for(var j = 0; j < cellIndices.length; j++){
24282     ASPx.Attr.SetAttribute(itemRow.cells[cellIndices[j]], "DXText", "");
24283    }
24284   }
24285  }
24286 },
24287 InitSelection: function(){
24288  var valueFromLastTime = this.GetValueFromValueInput();
24289  if(this.MultiSelectionMode()){
24290   if(valueFromLastTime != ""){
24291    var serialiser = this.GetSerializingHelper();
24292    var selectedValuesFromLastTime = serialiser.DeserializeValues(valueFromLastTime);
24293    var selectedIdicesFromLastTime = [];
24294    for(var i = 0; i < selectedValuesFromLastTime.length; i++)
24295     selectedIdicesFromLastTime.push(this.FindItemIndexByValue(selectedValuesFromLastTime[i]));
24296    this.SelectIndices(selectedIdicesFromLastTime);
24297   } else
24298    this.SelectIndices(this.initSelectedIndices);
24299  } else {
24300   var selectedIndex = (valueFromLastTime != "") ? 
24301    this.FindItemIndexByValue(valueFromLastTime) : this.GetSelectedIndexInternal();
24302   this.SetSelectedIndexInternal(selectedIndex);
24303   this.SelectIndexSilent(selectedIndex);
24304   this.GetItemSelectionHelper().SetSelectedIndexInternal(selectedIndex);
24305  }
24306  this.CacheValue();
24307 },
24308 BeginUpdate: function() {
24309  ASPxClientListBoxBase.prototype.BeginUpdate.call(this);
24310  if(this.isInitialized)
24311   this.itemsManager.BeginUpdate();
24312 },
24313 EndUpdate: function() {
24314  ASPxClientListBoxBase.prototype.EndUpdate.call(this);
24315  if(this.isInitialized)
24316   this.itemsManager.EndUpdate();
24317 },
24318 GetShowFilterButton: function() {
24319  return ASPx.GetControlCollection().Get(this.name + "_" + showFilterButtonID);
24320 },
24321 GetAccessibilityHelper: function() {
24322  var result = null;
24323  if(this.accessibilityCompliant) {
24324   if(!this.accessibilityHelper) {
24325    this.accessibilityHelper = new AccessibilityHelperListBox(this);
24326   }
24327   result = this.accessibilityHelper;
24328  }
24329  return result;
24330 },
24331 CreateHighlightingHelper: function() {
24332  return new ASPx.ListBoxHighlightingHelper(this, "em");
24333 },
24334 CreateInternalCheckBoxCollection: function() {
24335  if(this.IsNativeCheckBoxes() || this.internalCheckBoxCollection)
24336   return;
24337  this.internalCheckBoxCollection = new ASPx.CheckBoxInternalCollection(this.icbImageProperties, false, false, null, true, this.accessibilityCompliant);
24338  this.itemsManager.InitializeInternalCheckBoxCollection();
24339 },
24340 AddInternalCheckBoxToCollection: function(index) {
24341  if(!this.internalCheckBoxCollection)
24342   return;
24343  var enabled = this.GetEnabled();
24344  var changeEventMethod = ASPx.Attr.ChangeEventsMethod(enabled);
24345  this.AddInternalCheckBoxToCollectionCore(index, enabled, changeEventMethod);
24346 },
24347 AddInternalCheckBoxToCollectionCore: function(index, enabled, changeEventMethod) {
24348  var inputElement = this.GetItemCheckBoxInput(index);
24349  if(inputElement) {
24350   var internalCheckBox = this.internalCheckBoxCollection.Add(this.GetInternalCheckBoxKey(index), inputElement);
24351   internalCheckBox.CreateFocusDecoration(this.icbFocusedStyle);
24352   internalCheckBox.SetEnabled(enabled);
24353   internalCheckBox.autoSwitchEnabled = false;
24354   var checkBoxFocusableElement = this.GetCheckBoxFocusableElement(index);
24355   this.ChangeSpecialInputEnabledAttributes(checkBoxFocusableElement, changeEventMethod, true);
24356   if(this.accessibilityCompliant) {
24357    this.SetupCheckBoxAccessibilityAttributes(checkBoxFocusableElement, index);
24358   }
24359   internalCheckBox.CheckedChanged.AddHandler(
24360    function(s, e) {
24361     if(ASPx.Evt.GetKeyCode(e) == ASPx.Key.Space) {
24362      var element = ASPx.Evt.GetEventSource(e);
24363      this.GetItemSelectionHelper().OnItemCheckBoxClick(this.FindInternalCheckBoxIndex(element), e);
24364     }
24365    }.aspxBind(this)
24366   );
24367   internalCheckBox.Focus.AddHandler(
24368    function(s, e) {
24369     var index = this.FindInternalCheckBoxIndex(s.mainElement);
24370     window.setTimeout(function() { this.MakeItemVisible(index); }.aspxBind(this),50);
24371    }.aspxBind(this)
24372   );
24373  }
24374 },
24375 SetupCheckBoxAccessibilityAttributes: function(checkBox, index) {
24376  if(index !== -1) { 
24377   ASPx.Attr.SetAttribute(checkBox, "aria-label", this.GetAccessibilityHelper().getTextForScreenReader(this.GetItem(index)));
24378  }
24379 },
24380 ClearInternalCheckBoxCollection: function() {
24381  if(this.internalCheckBoxCollection)
24382   this.internalCheckBoxCollection.Clear();
24383 },
24384 RemoveInternalCheckBoxFromCollecntion: function(index) {
24385  if(this.internalCheckBoxCollection)
24386   this.internalCheckBoxCollection.Remove(this.GetInternalCheckBoxKey(index));
24387 },
24388 GetInternalCheckBoxKey: function(index) {
24389  return this.name + nameSeparator + this.GetItemValue(index);
24390 },
24391 GetInternalCheckBox: function (index) {
24392  if(this.internalCheckBoxCollection == null)
24393   this.CreateInternalCheckBoxCollection();
24394  if(this.internalCheckBoxCollection)
24395   return this.internalCheckBoxCollection.Get(this.GetInternalCheckBoxKey(index));
24396  return null;
24397 },
24398 IsNativeCheckBoxes: function() {
24399  return !this.icbImageProperties;
24400 },
24401 SetCheckBoxChecked: function(index, checked) {
24402  var checkBox = this.IsNativeCheckBoxes() ? this.GetItemCheckBoxInput(index) : this.GetInternalCheckBox(index);
24403  if(checkBox)
24404   this.SetCheckBoxCheckedCore(checkBox, checked);
24405  if(this.accessibilityCompliant) {
24406   setTimeout(function() { this.GetAccessibilityHelper().SetCheckBoxesValidationAttributes(); }.bind(this), 0);
24407  }
24408 },
24409 SetCheckBoxCheckedCore: function (checkBox, checked) {
24410  if(this.IsNativeCheckBoxes())
24411   checkBox.checked = checked;
24412  else
24413   checkBox.SetValue(checked ? ASPx.CheckBoxInputKey.Checked : ASPx.CheckBoxInputKey.Unchecked);
24414 },
24415 SetCheckBoxEnabled: function (index, enabled) {
24416  var checkBox = this.IsNativeCheckBoxes() ? this.GetItemCheckBoxInput(index) : this.GetInternalCheckBox(index);
24417  if (checkBox)
24418   this.SetCheckBoxEnabledCore(checkBox, enabled);
24419 },
24420 SetCheckBoxEnabledCore: function (checkbox, enabled) {
24421  if (this.IsNativeCheckBoxes()) {
24422   checkbox.disabled = !enabled;
24423   this.ChangeNativeCheckEnabledAttributes(checkbox, ASPx.Attr.ChangeEventsMethod(this.GetEnabled()));
24424  }
24425  else
24426   checkbox.SetEnabled(enabled);
24427  this.ChangeSpecialInputEnabledAttributes(this.IsNativeCheckBoxes() ?
24428   checkbox : checkbox.inputElement, ASPx.Attr.ChangeEventsMethod(enabled));
24429 },
24430 ClearItems: function() {
24431  ASPxClientListBoxBase.prototype.ClearItems.call(this);
24432  this.ClearInternalCheckBoxCollection();
24433  this.freeUniqIndex = this.GetItemCount();
24434 },
24435 OnDelayedSpecialFocusMouseDown: function (evt) {
24436  if(this.filteringTextBox) {
24437   var isEventFromFilteringTextBox = ASPx.Evt.GetEventSource(evt) == this.filteringTextBox.GetInputElement();
24438   this.filteringTextBoxInput = isEventFromFilteringTextBox ? this.filteringTextBox.GetInputElement() : null;
24439  }
24440  if(this.showFilterButton) {
24441   var isEventFromShowFilterButton = ASPx.GetIsParent(this.showFilterButton.GetMainElement(), ASPx.Evt.GetEventSource(evt));
24442   this.showFilterButtonInput = isEventFromShowFilterButton ? this.showFilterButton.GetInternalButton() : null;
24443   this.isFilterEditorShowing = isEventFromShowFilterButton;
24444  }
24445  if(this.GetIsCheckColumnExists())
24446   this.SetFocusableCheckInput(this.GetCheckBoxInputFromEvent(evt));
24447  ASPxClientListBoxBase.prototype.OnDelayedSpecialFocusMouseDown.call(this, evt);
24448  var shiftPressed = evt.shiftKey;
24449  var ctrlKey = evt.ctrlKey || evt.metaKey;
24450  if(shiftPressed || ctrlKey)
24451   ASPx.Selection.Clear();
24452 },
24453 GetCheckBoxInputFromEvent: function(evt) {
24454  var element = ASPx.Evt.GetEventSource(evt);
24455  if(this.IsNativeCheckBoxes())
24456   return element.type == "checkbox" ? element : null;
24457  var index = this.FindInternalCheckBoxIndex(element);
24458  if(index > -1)
24459   return this.GetCheckBoxFocusableElement(index);
24460  else if(this.IsSelectAllCheckBoxClicked(element))
24461   return this.GetSelectAllCheckBoxFocusableElement();
24462  return null;
24463 },
24464 IsSelectAllCheckBoxClicked: function(eventSource) {
24465  return this.selectAllCheckBox && ASPx.GetIsParent(this.selectAllCheckBox.container, eventSource)
24466   && (eventSource == this.selectAllCheckBox.mainElement || eventSource.tagName == "LABEL");
24467 },
24468 IsNativeSelectAllCheckBoxClicked: function (eventSource) {
24469  return this.nativeSelectAllCheckBox && ASPx.GetIsParent(this.nativeSelectAllCheckBox, eventSource);
24470 },
24471 GetSelectAllClickableElement: function() {
24472  return this.IsMultiColumn() ? this.selectAllMainElement.parentNode : this.selectAllMainElement;
24473 },
24474 GetSelectAllCheckBoxFocusableElement: function() {
24475  return this.accessibilityCompliant ? this.selectAllCheckBox.mainElement : this.selectAllCheckBox.inputElement;
24476 },
24477 GetCheckBoxFocusableElement: function(index) {
24478  var internalCheckBox = this.GetInternalCheckBox(index);
24479  if(!internalCheckBox)
24480   return null;
24481  return this.accessibilityCompliant ? internalCheckBox.mainElement : internalCheckBox.inputElement;
24482 },
24483 FindInternalCheckBoxIndex: function(element) {
24484  var level = 5;
24485  while(level > 0) {
24486   var id = element.id;
24487   if(id && element.tagName == "TD" && id.slice(-1) == lbIPostfixes[0])
24488    return this.GetItemIndexByRow(element.parentNode);
24489   element = element.parentNode;
24490   level--;
24491  }
24492  return -1;
24493 },
24494 IsCheckBoxClicked: function(evt) {
24495  return !!this.GetCheckBoxInputFromEvent(evt);
24496 },
24497 GetFocusableInputElement: function() {
24498  return this.showFilterButtonInput || this.filteringTextBoxInput || this.focusableCheckInput || this.GetInputElement();
24499 },
24500 IsElementBelongToInputElement: function (element) {
24501  return ASPxClientEdit.prototype.IsElementBelongToInputElement.call(this, element)
24502  || this.filteringTextBox && this.filteringTextBox.ownerListBox == this && this.filteringTextBox.IsElementBelongToInputElement(element);
24503 },
24504 SetFocusableCheckInput: function(element) {
24505  this.focusableCheckInput = element;
24506 },
24507 OnFocusCore: function() {
24508  if(this.UseDelayedSpecialFocus())
24509   this.specialFocusTimer = ASPx.Timer.ClearTimer(this.specialFocusTimer);
24510  if(this.focused)
24511   this.UnlockFocusEvents();
24512  else
24513   ASPxClientListBoxBase.prototype.OnFocusCore.call(this);
24514 },
24515 OnLostFocusCore: function() {
24516  if(!this.IsFocusEventsLocked()) { 
24517   this.SetFocusableCheckInput(null);
24518   this.filteringTextBoxInput = null;
24519   this.showFilterButtonInput = null;
24520  }
24521  ASPxClientListBoxBase.prototype.OnLostFocusCore.call(this);
24522 },
24523 IsFocusEventsLocked: function() {
24524  var result = ASPxClientEdit.prototype.IsFocusEventsLocked.call(this) ||
24525      this.IsInternalFilteringTextBoxFocusEventsLocked() ||
24526      this.isFilterEditorShowing;
24527  if(this.accessibilityCompliant)
24528   result = this.focused && (result || this.HasInternalFilteringTextBoxFocus());
24529  return result;
24530 },
24531 HasInternalFilteringTextBoxFocus: function() {
24532  return !this.customFilteringEditorID && this.filteringTextBox && ASPx.GetIsParent(this.filteringTextBox.GetMainElement(), ASPx.GetActiveElement());
24533 },
24534 IsInternalFilteringTextBoxFocusEventsLocked: function() {
24535  return !this.customFilteringEditorID && this.filteringTextBox && this.filteringTextBox.IsFocusEventsLocked();
24536 },
24537 ForceLockFocusEvents: function() {
24538  this.focusEventsLocked = true;
24539 },
24540 GetValueFromValueInput: function(){
24541  var valueInput = this.FindStateInputElement();
24542  if(ASPx.IsExistsElement(valueInput))
24543   return valueInput.value;
24544  return "";
24545 },
24546 NeedUnfocusableScrollDivElement: function() {
24547  return ASPx.Browser.Firefox;
24548 },
24549 GetInitSelectedIndex: function(){
24550  return this.savedSelectedIndex;
24551 },
24552 CacheValue: function(){
24553  this.cachedValue = this.GetValue();
24554 },
24555 InitScrollPos: function(){ 
24556  if(!this.isComboBoxList && this.isCallbackMode && this.GetInitSelectedIndex() == -1)
24557   this.GetScrollDivElement().scrollTop = 0;
24558 },
24559 InitializeLoadOnDemand: function(){
24560  var loadOnDemandRequired = this.isCallbackMode && this.GetEnabledByServer();
24561  this.scrollHelper = this.CreateScrollHelper(loadOnDemandRequired);
24562 },
24563 CreateScrollHelper: function (loadOnDemandRequired) {
24564  if (loadOnDemandRequired)
24565   return new ListBoxScrollCallbackHelper(this);
24566  return new ListBoxScrollCallbackHelperBase(this);
24567 },
24568 HasVirtualScrolling: function() { return !!this.itemsInfo || this.itemsManager instanceof ListBoxItemsVirtualManager; },
24569 CreateItemsManager: function() {
24570  if (this.HasVirtualScrolling()) {
24571   var manager = new ListBoxItemsVirtualManager(this);
24572   manager.InitializeItems(this.itemsInfo, this.itemsValue);
24573   delete this.itemsInfo;
24574   return manager;
24575  }
24576  return new ListBoxItemsDefaultManager(this);
24577 },
24578 CreateStateControllerManager: function() {
24579  var result = null;
24580  if(this.HasVirtualScrolling()) {
24581   result = this.CreateVirtualRenderStateControllerManager();
24582  }
24583  else {
24584   result = this.CreateDefaultRenderStateControllerManager();
24585  }
24586  return result;
24587 },
24588 CreateVirtualRenderStateControllerManager: function() {
24589  return new VirtualRenderListBoxStateControllerManager(this, this.itemsManager);
24590 },
24591 CreateDefaultRenderStateControllerManager: function() {
24592  return new DefaultListBoxStateControllerManager(this);
24593 },
24594 InlineInitialize: function(){
24595  if(this.HasVirtualScrolling())
24596   this.freeUniqIndex = 0;
24597  this.itemsManager = this.CreateItemsManager();
24598  this.stateControllerManager = this.CreateStateControllerManager();
24599  this.filterStrategy = this.isComboBoxList ? null : this.CreateFilterStrategy();
24600  this.EnsureFixWidthRow();
24601  this.InitializeNativeCheckHandlers();
24602  this.LockScrollHandler();
24603  this.InitializeItemsAttributes();
24604  this.InitDXTextAttributes();
24605  this.stateControllerManager.Initialize();
24606  this.itemsManager.Initialize();
24607  this.AddSelectAllStateItems(true);
24608  this.UnlockScrollHandler();
24609  if(this.NeedToHandleCellWidth()) {
24610   var headerTable = this.GetHeaderTableElement();
24611   var firstHeaderRow = !!headerTable && headerTable.rows[0];
24612   this.CorrectCellNullWidthStyle(firstHeaderRow);
24613   this.CorrectCellNullWidthStyle(this.itemsManager.GetFirstVisibleItemRow());
24614  }
24615  ASPxClientListBoxBase.prototype.InlineInitialize.call(this);
24616  this.EnsureSelectAllElements();
24617 },
24618 IsItemVisible: function(index) {
24619  return this.itemsManager.IsItemVisible(index);
24620 },
24621 UseSpecialKeyboardHandling: function() {
24622  return true;
24623 },
24624 GetItemIndexByInsertionOrder: function (itemIndex) { 
24625  return this.HasVirtualScrolling() ? this.GetItem(itemIndex).insertOrderIndex : this.FindFreeIndex();
24626 },
24627 InsertItemRow: function (index, itemProperties) {
24628  var newItemRow = this.itemsManager.CreateNewItemRow(index);
24629  ASPx.Attr.RemoveAttribute(newItemRow, "id");
24630  var listTable = this.GetListTable();
24631  var tbody = this.GetTableRowParent(listTable);
24632  var rowBeforeNewItemRow = this.GetListTableRowBeforeNewItemRow(index, listTable);
24633  var scrollDiv = this.GetScrollDivElement();
24634  var oldScrollTop = scrollDiv.scrollTop;
24635  if(rowBeforeNewItemRow)
24636   tbody.insertBefore(newItemRow, rowBeforeNewItemRow);
24637  else
24638   tbody.appendChild(newItemRow);  
24639  if(ASPx.Browser.Firefox && scrollDiv.scrollTop != oldScrollTop)
24640   scrollDiv.scrollTop = oldScrollTop;
24641  var newIndex = this.GetItemIndexByInsertionOrder(index);
24642  var newId = this.CreateItemId(newIndex);
24643  var newClientId = this.CreateItemClientId(newIndex);
24644  this.InitializeItemAttributes(newItemRow, newClientId, true);
24645  this.AddStateControllerClasses(newId);
24646  this.PrepareItem(newItemRow, itemProperties);
24647  if (this.needUnselectableItemRows)
24648   this.SetItemRowUnselectable(newItemRow);
24649  if (this.GetIsCheckColumnExists() && !this.IsNativeCheckBoxes()) {
24650   if (!this.internalCheckBoxCollection)
24651    this.CreateInternalCheckBoxCollection();
24652   this.AddInternalCheckBoxToCollection(index);
24653  }
24654 },
24655 RemoveItemRow: function (index) {
24656  if (this.GetIsCheckColumnExists() && !this.IsNativeCheckBoxes())
24657   this.RemoveInternalCheckBoxFromCollecntion(index);
24658  var row = this.GetItemRow(index);
24659  if (ASPx.IsExistsElement(row)) {
24660   var firstCellId = this.GetItemElement(index).id;
24661   var itemId = firstCellId.match(/LBI\d+/)[0];
24662   this.RemoveStateControllerClasses(itemId);
24663   row.parentNode.removeChild(row);
24664  }
24665 },
24666 SetItemRowsUnselectable: function() {
24667  var count = this.GetItemCount();
24668  for (var i = 0; i < count; i++) {
24669   var itemRow = this.GetItemRow(i);
24670   if (itemRow)
24671    this.SetItemRowUnselectable(itemRow);
24672  }
24673  this.needUnselectableItemRows = true;
24674 },
24675 SetItemRowUnselectable: function (itemRow) {
24676  for (var j = 0; j < itemRow.cells.length; j++)
24677   ASPx.Selection.SetElementAsUnselectable(itemRow.cells[j], true);
24678 },
24679 GetInactiveFilterElementClassName: function() {
24680  return inactiveFilterElementClassName;
24681 },
24682 GetAnimatedFilterElementClassName: function() {
24683  return "dxeLBAnimatedFilterPanelSys";
24684 },
24685 GetCompactViewFilterAdjacentScrollDivSelector: function() {
24686  return "*[class*=\"dxeListBoxFilter\"]:not(.dxeLBInactiveFilterPanelSys) + *[class*=\"dxeListBoxSelectAll\"] + .dxlbd";
24687 },
24688 GetCompactViewInactiveFilterAdjacentScrollDivSelector: function() {
24689  return ".dxeLBInactiveFilterPanelSys + *[class*=\"dxeListBoxSelectAll\"] + .dxlbd";
24690 },
24691 EnsureFilteringElements: function () {
24692  if(this.enableFiltering) {
24693   this.EnsureFilteringTextBox();
24694   if(!this.customFilteringEditorID) {
24695    this.filterMainElement = this.GetChildElement(filterMainElementID);
24696    this.showFilterButton = this.GetShowFilterButton();
24697    if(this.showFilterButton) {
24698     this.showFilterButton.ownerListBox = this;
24699     var changeEventMethod = ASPx.Attr.ChangeEventsMethod(this.GetEnabled());
24700     var showFilterButtonInternalButton = this.showFilterButton.GetInternalButton();
24701     if(showFilterButtonInternalButton)
24702      this.ChangeSpecialInputEnabledAttributes(showFilterButtonInternalButton, changeEventMethod, true);
24703     this.showFilterButton.SetEnabled(this.GetEnabled());
24704     this.UpdateFilterButtonHeight();
24705     this.UpdateShowHideFilterElementCssRules();
24706    }
24707   }
24708  }
24709 },
24710 CreateFilterStrategy: function() {
24711  if(this.enableFiltering)
24712   return new ListBoxFilterStrategy(this);
24713  return new ListEditFilterStrategyBase();
24714 },
24715 UpdateShowHideFilterElementCssRules: function() {
24716  var scrollDiv = this.GetScrollDivElement();
24717  var scrollDivClientHeight = scrollDiv.offsetHeight - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(scrollDiv);
24718  var filterMainElementOffsetHeight = this.GetFilterMainElementHeight();
24719  if (ASPx.GetElementVisibility(this.filteringTextBox.GetMainElement(), true))
24720   scrollDivClientHeight += filterMainElementOffsetHeight;
24721  var showHideFilterStyle = this.EnsureShowHideFilterStyle();
24722  var mainElementSelector = "#" + this.name;
24723  var styleContent = [
24724   mainElementSelector + " " + this.GetCompactViewFilterAdjacentScrollDivSelector()
24725    + " { max-height: " + (scrollDivClientHeight - filterMainElementOffsetHeight) + "px; }",
24726   mainElementSelector + " " + this.GetCompactViewInactiveFilterAdjacentScrollDivSelector()
24727    + " { max-height: " + scrollDivClientHeight + "px; }"
24728  ];
24729  showHideFilterStyle.innerHTML = styleContent.join('\n');
24730 },
24731 EnsureShowHideFilterStyle: function() {
24732  if(!this.showHideFilterStyle) {
24733   this.showHideFilterStyle = this.FindShowHideFilterStyle();
24734   if(!this.showHideFilterStyle) {
24735    this.showHideFilterStyle = document.createElement('style');
24736    this.showHideFilterStyle.id = this.GetShowHideFilterStyleID();
24737    ASPx.Attr.AppendStyleType(this.showHideFilterStyle);
24738    document.getElementsByTagName('head')[0].appendChild(this.showHideFilterStyle);
24739   }
24740  }
24741  return this.showHideFilterStyle;
24742 },
24743 FindShowHideFilterStyle: function() {
24744  return ASPx.GetChildById(document.getElementsByTagName('head')[0], this.GetShowHideFilterStyleID());
24745 },
24746 GetShowHideFilterStyleID: function() {
24747  return this.name + "ShowHideFilterStyle";
24748 },
24749 GetFilterMainElementHeight: function() {
24750  if(!this.filterMainElementHeight) {
24751   var filteringTextBoxClone = this.filteringTextBox.GetMainElement().cloneNode(true);
24752   filteringTextBoxClone.style.position = "absolute";
24753   filteringTextBoxClone.style.visibility = "hidden";
24754   document.body.appendChild(filteringTextBoxClone);
24755   this.filterMainElementHeight = filteringTextBoxClone.offsetHeight;
24756   document.body.removeChild(filteringTextBoxClone);
24757   var filterMainElementClone = this.filterMainElement.cloneNode(false);
24758   filterMainElementClone.style.position = "absolute";
24759   filterMainElementClone.style.visibility = "hidden";
24760   ASPx.RemoveClassNameFromElement(filterMainElementClone, this.GetInactiveFilterElementClassName());
24761   ASPx.RemoveClassNameFromElement(filterMainElementClone, this.GetAnimatedFilterElementClassName());
24762   document.body.appendChild(filterMainElementClone);
24763   this.filterMainElementHeight += ASPx.GetTopBottomBordersAndPaddingsSummaryValue(filterMainElementClone);
24764   document.body.removeChild(filterMainElementClone);
24765  }
24766  return this.filterMainElementHeight;
24767 },
24768 RemoveShowHideFilterCssRules: function () {
24769  var showHideFilterStyle = this.FindShowHideFilterStyle();
24770  if(showHideFilterStyle)
24771   showHideFilterStyle.innerHTML = "";
24772 },
24773 UpdateFilterButtonHeight: function() {
24774  setTimeout(function () {
24775   this.showFilterButton.SetHeight(this.selectAllMainElement.offsetHeight - ASPx.GetVerticalBordersWidth(this.selectAllMainElement));
24776  }.aspxBind(this), 0);
24777 },
24778 EnsureFilteringTextBox: function() {
24779  this.filteringTextBox = this.FindFilteringTextBox();
24780  if(this.filteringTextBox) {
24781   this.filteringTextBox.UserInput.AddHandler(this.filterStrategy.OnInput.bind(this.filterStrategy));
24782   if(!this.customFilteringEditorID) {
24783    this.filteringTextBox.ownerListBox = this;
24784    var changeEventMethod = ASPx.Attr.ChangeEventsMethod(this.GetEnabled());
24785    this.ChangeSpecialInputEnabledAttributes(this.filteringTextBox.GetInputElement(), changeEventMethod, true);
24786    this.filteringTextBox.SetEnabled(this.GetEnabled());
24787    this.filteringTextBox.KeyDown.AddHandler(function(sender, args) {
24788     if(ASPx.Evt.GetKeyCode(args.htmlEvent) === ASPx.Key.Esc)
24789      sender.GetInputElement().value = "";
24790    });
24791   }
24792  }
24793 },
24794 FindFilteringTextBox: function() {
24795  var actualFilteringTextBoxID = this.customFilteringEditorID ? this.customFilteringEditorID : this.name + "_" + filteringTextBoxID;
24796  return ASPx.GetControlCollection().Get(actualFilteringTextBoxID);
24797 },
24798 CollectionChanged: function(isFiltering) {
24799  if(isFiltering)
24800   this.itemsManager.OnEndItemsFiltering();
24801 },
24802 ChangeItemsFilteredState: function(action) {
24803  this.itemsManager.ChangeItemsFilteredState(action);
24804 },
24805 RewriteFilteredItemIndices: function (newFilteredItemIndices) {
24806  this.itemsManager.RewriteFilteredItemIndices(newFilteredItemIndices);
24807 },
24808 BeforeClientFiltering: function () {
24809  this.itemsManager.BeforeClientFiltering();
24810 },
24811 ApplyFilterToItem: function (index, isSatisfy, savePrevState, isFilterReset) {
24812  this.itemsManager.ApplyFilterToItem(index, isSatisfy, savePrevState, isFilterReset);
24813 },
24814 RestorePrevFilteredState: function (index) {
24815  this.itemsManager.RestorePrevFilteredState(index);
24816 },
24817 IsItemFiltered: function (index) {
24818  return this.itemsManager.IsItemFiltered(index);
24819 },
24820 IsClientFilterApplied: function() {
24821  return !this.isComboBoxList && this.filterStrategy.filter != "" && !this.isCallbackMode;
24822 },
24823 MakeAllItemsVisible: function () {
24824  this.itemsManager.MakeAllItemsVisible();
24825 },
24826 ShowFilterElement: function() {
24827  ASPx.RemoveClassNameFromElement(this.filterMainElement, this.GetInactiveFilterElementClassName());
24828  this.showFilterButton.SetVisible(false);
24829  if(ASPx.Browser.VirtualKeyboardSupported) {
24830   this.ReplaceFilteringTextBoxShowNullTextOnFocusFunction();
24831   this.isFilterEditorShowing = false;
24832   this.filteringTextBox.GetInputElement().focus();
24833  }
24834  else
24835   setTimeout(function () {
24836    this.isFilterEditorShowing = false;
24837    this.filteringTextBox.GetInputElement().focus();
24838   }.aspxBind(this), 200);
24839 },
24840 HideFilterElement: function () {
24841  ASPx.AddClassNameToElement(this.filterMainElement, this.GetInactiveFilterElementClassName());
24842  this.showFilterButton.SetVisible(true);
24843  this.UpdateFilterButtonHeight();
24844  this.CorrectHeight(true);
24845  setTimeout(function () {
24846   this.filteringTextBox.UnlockFocusEvents();
24847   this.showFilterButton.GetInternalButton().focus();
24848  }.aspxBind(this), 0);
24849 },
24850 ReplaceFilteringTextBoxShowNullTextOnFocusFunction: function () {
24851  if(this.filteringTextBox.nullTextDisplayMode === ASPx.NullTextDisplayMode.UnfocusedAndFocused) {
24852   var origin = this.filteringTextBox.ensureActivateFocusedNullTextMechanism;
24853   var filteringTextBox = this.filteringTextBox;
24854   this.filteringTextBox.ensureActivateFocusedNullTextMechanism = function() {
24855    setTimeout(function() {
24856     origin.call(filteringTextBox);
24857     filteringTextBox.ensureActivateFocusedNullTextMechanism = origin;
24858     setTimeout(function () {
24859      if(filteringTextBox.isFocusedNullTextElementDisplayed())
24860       filteringTextBox.adjustFocusedNullTextElement();
24861     }, 300);
24862    }, 400);
24863   };
24864  }
24865 },
24866 EnsureSelectAllElements: function () {
24867  if(this.enableSelectAll && !this.selectAllMainElement) {
24868   this.EnsureSelectAllCheckElement();
24869   this.selectAllMainElement = this.GetChildElement(selectAllMainElementID);
24870   var selectAllClickableElement = this.GetSelectAllClickableElement();
24871   ASPx.Evt.AttachEventToElement(selectAllClickableElement, "click", this.onSelectAllClickableElementClick.bind(this));
24872  }
24873 },
24874 EnsureSelectAllCheckElement: function () {
24875  var selectAllCheckBoxInput = null;
24876  if(!this.IsNativeCheckBoxes()) {
24877   this.CreateSelectAllCheckBox();
24878   selectAllCheckBoxInput = this.GetSelectAllCheckBoxFocusableElement();
24879  }
24880  else {
24881   this.nativeSelectAllCheckBox = this.GetChildElement(selectAllCheckBoxID + "_I");
24882   this.nativeSelectAllCheckBox.disabled = !this.GetEnabled();
24883   selectAllCheckBoxInput = this.nativeSelectAllCheckBox;
24884  }
24885  var changeEventMethod = ASPx.Attr.ChangeEventsMethod(this.GetEnabled());
24886  this.ChangeSpecialInputEnabledAttributes(selectAllCheckBoxInput, changeEventMethod, true);
24887 },
24888 CreateSelectAllCheckBox: function () {
24889  var selectAllCheckBoxElement = this.GetChildElement(selectAllCheckBoxID);
24890  var selectAllCheckBoxInputElement = this.GetChildElement(selectAllCheckBoxID + "_S");
24891  var selectAllStateController = ASPx.CheckableElementStateController.Create(this.icbImageProperties, CheckBoxInputKey.Checked, CheckBoxInputKey.Unchecked, CheckBoxInputKey.Indeterminate, true);  
24892  this.selectAllCheckBox = new ASPx.CheckBoxInternal(selectAllCheckBoxInputElement, selectAllStateController, true, false,
24893   ASPx.CheckEditElementHelper.Instance, selectAllCheckBoxElement, true, undefined, undefined, this.accessibilityCompliant);
24894  this.selectAllCheckBox.CreateFocusDecoration(this.icbFocusedStyle);
24895  this.selectAllCheckBox.SetEnabled(this.GetEnabled());
24896  this.selectAllCheckBox.GetReadOnly = this.GetReadOnly.bind(this);
24897  this.selectAllCheckBox.CheckedChanged.AddHandler(this.onSelectAll.as
24897pxBind(this));
24898  if(ASPx.Browser.WebKitFamily)
24899   ASPx.Evt.AttachEventToElement(this.selectAllCheckBox.mainElement.parentNode, "selectstart", ASPx.Evt.PreventEventAndBubble);
24900 },
24901 onSelectAllClickableElementClick: function (evt) {
24902  if (!this.GetEnabled() || this.GetReadOnly()) {
24903   if (this.IsNativeCheckBoxes() || this.isNative)
24904    ASPx.Evt.PreventEvent(evt);
24905   return false;
24906  }
24907  if(this.IsSelectAllCheckBoxClicked(ASPx.Evt.GetEventSource(evt)))
24908   return;
24909  if(!this.IsNativeSelectAllCheckBoxClicked(ASPx.Evt.GetEventSource(evt))) {
24910   var currentCheckState = this.getSelectAllCheckElementState();
24911   var newCheckState = currentCheckState != ASPx.CheckBoxCheckState.Checked ?
24912    ASPx.CheckBoxCheckState.Checked : ASPx.CheckBoxCheckState.Unchecked;
24913   this.updateSelectAllCheckElementState(newCheckState);
24914  }
24915  this.onSelectAll();
24916 },
24917 onSelectAll: function () {
24918  this.LockUpdateSelectAllElements();
24919  var selectAllCheckState = this.getSelectAllCheckElementState();
24920  this.onSelectAllCore(selectAllCheckState);
24921  this.UnlockUpdateSelectAllElements();
24922 },
24923 onSelectAllCore: function (currentCheckState) {
24924  var toSelect = currentCheckState == ASPx.CheckBoxCheckState.Checked;
24925  var valueBeforeSelectAll = this.GetValue();
24926  var selectionBeforeSelectAll = this.GetValueFromValueInput();
24927  if (toSelect)
24928   this.SelectAll();
24929  else
24930   this.UnselectAll();
24931  if(selectionBeforeSelectAll !== this.GetValueFromValueInput())
24932   this.OnItemSelectionChanged(-1, toSelect, true, valueBeforeSelectAll !== this.GetValue());
24933 },
24934 getSelectAllCheckElementState: function () {
24935  if(this.selectAllCheckBox)
24936   return this.selectAllCheckBox.GetCurrentCheckState();
24937  if(this.nativeSelectAllCheckBox)
24938   return this.nativeSelectAllCheckBox.checked ? ASPx.CheckBoxCheckState.Checked : ASPx.CheckBoxCheckState.Unchecked;
24939  return null;
24940 },
24941 updateSelectAllCheckElementState: function (checkState) {
24942  if(this.selectAllCheckBox) {
24943   var checkValue = this.selectAllCheckBox.stateController.GetValueByCheckState(checkState);
24944   this.selectAllCheckBox.SetValue(checkValue, !this.isInitialized);
24945  } else if(this.nativeSelectAllCheckBox)
24946   this.nativeSelectAllCheckBox.checked = checkState === ASPx.CheckBoxCheckState.Checked;
24947 },
24948 updateSelectAllElementsState: function() {
24949  if(!this.IsUpdateSelectAllElementsLocked() && this.enableSelectAll) {
24950   this.EnsureSelectAllElements();
24951   this.updateSelectAllElementsStateCore();
24952  }
24953 },
24954 updateSelectAllElementsStateCore: function() {
24955  var selectAllCheckState = ASPx.CheckBoxCheckState.Unchecked;
24956  var isFilteredSelectedItemFound = false;
24957  var isFilteredUnselectedItemFound = false;
24958  var itemCount = this.GetItemCount();
24959  for(var i = 0; i < itemCount; i++) {
24960   if(this.IsItemFiltered(i)) {
24961    if(this.GetIsItemSelected(i))
24962     isFilteredSelectedItemFound = true;
24963    else
24964     isFilteredUnselectedItemFound = true;
24965   }
24966   if (isFilteredSelectedItemFound && isFilteredUnselectedItemFound) {
24967    selectAllCheckState = ASPx.CheckBoxCheckState.Indeterminate;
24968    break;
24969   }
24970   if(i == itemCount - 1 && isFilteredSelectedItemFound && !isFilteredUnselectedItemFound)
24971    selectAllCheckState = ASPx.CheckBoxCheckState.Checked;
24972  }
24973  this.updateSelectAllCheckElementState(selectAllCheckState);
24974 },
24975 changeSelectAllElementsEnabledState: function(enabled) {
24976  var selectAllCheckBoxInput = null;
24977  if(this.selectAllCheckBox) {
24978   this.selectAllCheckBox.SetEnabled(enabled);
24979   selectAllCheckBoxInput = this.GetSelectAllCheckBoxFocusableElement();
24980  }
24981  else if(this.nativeSelectAllCheckBox) {
24982   this.nativeSelectAllCheckBox.disabled = !enabled;
24983   selectAllCheckBoxInput = this.nativeSelectAllCheckBox;
24984  }
24985  if(selectAllCheckBoxInput) {
24986   var changeEventMethod = ASPx.Attr.ChangeEventsMethod(enabled);
24987   this.ChangeSpecialInputEnabledAttributes(selectAllCheckBoxInput, changeEventMethod, true);
24988  }
24989  ASPx.GetStateController().SetElementEnabled(this.selectAllMainElement, enabled);
24990 },
24991 NeedToHandleCellWidth: function() {
24992  return this.IsMultiColumn() && (ASPx.Browser.Firefox || ASPx.Browser.Edge);
24993 },
24994 CorrectCellNullWidthStyle: function(row) {
24995  if(!row) return;
24996  var cellCount = row.cells.length;
24997  for(var i = 0; i < cellCount; i++) {
24998   var cellStyle = !!window.getComputedStyle ? window.getComputedStyle(row.cells[i]) : ASPx.GetCurrentStyle(row.cells[i]);
24999   var originalWidth = parseInt(cellStyle.width);
25000   var needToApply = originalWidth === 0 || originalWidth <= ASPx.PxToInt(cellStyle.paddingLeft) || originalWidth <= ASPx.PxToInt(cellStyle.paddingRight);
25001   var action = needToApply ? ASPx.AddClassNameToElement : ASPx.RemoveClassNameFromElement;
25002   action(row.cells[i], NullSizeCellClassName);
25003  }
25004 },
25005 InitializeNativeCheckHandlers: function() {
25006  this.nativeCheckOnFocusHandler = function(evt) {
25007   this.SetFocusableCheckInput(ASPx.Evt.GetEventSource(evt));
25008  }.aspxBind(this);
25009 },
25010 ChangeNativeCheckEnabledAttributes: function(element, method) {
25011  if(this.nativeCheckOnFocusHandler)
25012   method(element, "focus", this.nativeCheckOnFocusHandler);
25013 },
25014 InitializeItemsAttributes: function() { 
25015  var listTable = this.GetListTable();
25016  if(this.isHasFakeRow){
25017   this.LockSynchronization();
25018   this.ClearItems();
25019   this.UnlockSynchronization();
25020  }
25021  listTable.ListBoxId = this.name;
25022  var rowIdConst = this.name + "_";
25023  if(this.hasSampleItem)
25024   this.InitializeItemAttributes(this.GetSampleItemRow(), rowIdConst + lbSIIdSuffix);
25025  if(!this.HasVirtualScrolling()) {
25026   rowIdConst += lbIIdSuffix;
25027   var count = this.GetItemCount();
25028   if(this.HasAccessibilityHeaderRow())
25029    count--;
25030   for (var i = 0; i < count; i++)
25031    this.InitializeItemAttributes(this.GetItemRow(i), rowIdConst + i);
25032  }
25033  var rows = listTable.rows;
25034  if(this.HasAccessibilityHeaderRow() && rows[rows.length - 1])
25035   rows[rows.length - 1].id = this.GetAccessibilityHeaderRowID();
25036 },
25037 InitializeItemAttributes: function(row, rowId) {
25038  var cells = row.cells;
25039  var itemCellsIdSuffixes = this.GetItemCellsIdPostfixes();
25040  for(var i = 0; i < row.cells.length; i++) {
25041   cells[i].style.textAlign = this.itemHorizontalAlign;
25042   cells[i].id = rowId + itemCellsIdSuffixes[i];
25043  }
25044  if(this.GetIsCheckColumnExists() && this.IsNativeCheckBoxes() && rowId != this.GetSampleItemRowID()) {
25045   var input = this.GetItemCheckBoxInput(this.GetItemIndexByRow(row));
25046   this.ChangeNativeCheckEnabledAttributes(input, ASPx.Attr.ChangeEventsMethod(this.GetEnabled()));
25047   this.ChangeSpecialInputEnabledAttributes(input, ASPx.Attr.ChangeEventsMethod(this.GetEnabled()));
25048  }
25049 },
25050 InitializePageSize: function(){
25051  var divElement = this.GetScrollDivElement();
25052  var count = this.GetItemCount();
25053  if (divElement && count > 0) {
25054   var firstVisibleRow = this.itemsManager.GetFirstVisibleItemRow();
25055   if(firstVisibleRow)
25056    this.scrollPageSize = Math.round(divElement.clientHeight / firstVisibleRow.offsetHeight) - 1;
25057  }
25058 },
25059 AddSelectAllStateItems: function(isInitialization) {
25060  if (this.enableSelectAll && typeof (ASPx.GetStateController) !== "undefined") {
25061   var stateController = ASPx.GetStateController();
25062   var name = this.name + "_" + selectAllMainElementID;
25063   if (!isInitialization)
25064    this.ClearStateItemCache(stateController, name, [""]);
25065   stateController.AddHoverItem(name, this.selectAllHoverClasses, this.selectAllHoverCssArray, "", null, null, true);
25066   stateController.AddDisabledItem(name, this.selectAllDisabledClasses, this.selectAllDisabledCssArray, "", null, null, true);
25067  }
25068 },
25069 RemoveSelectAllStateItems: function() {
25070  if (this.enableSelectAll && typeof (ASPx.GetStateController) !== "undefined") {
25071   var stateController = ASPx.GetStateController();
25072   var name = this.name + "_" + selectAllMainElementID;
25073   this.ClearStateItemCache(stateController, name, [""]);
25074   stateController.RemoveHoverItem(name, "");
25075   stateController.RemoveDisabledItem(name, "");
25076  }
25077 },
25078 ClearStateItemCache: function(stateController, name, suffixes) {
25079  for (var i = 0; i < suffixes.length; i++) {
25080   var element = document.getElementById(name + suffixes[i]);
25081   var elements = ASPx.GetNodes(element);
25082   elements.push(element);
25083   ASPx.Data.ForEach(elements, stateController.ClearElementCache.bind(stateController));
25084  }
25085 },
25086 AfterInitialize: function() {
25087  if(this.disableScrolling) {
25088   var scrollDiv = this.GetScrollDivElement();
25089   var mainElement = this.GetMainElement();
25090   var listTable = this.GetListTable();
25091   scrollDiv.style.height = mainElement.style.height = (listTable 
25092    ? ASPx.GetClearClientHeight(listTable)
25093    : this.GetListTableHeight() - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(mainElement)) + "px";
25094  }
25095  this.CallbackSpaceInit(true);
25096  ASPxClientListBoxBase.prototype.AfterInitialize.call(this);
25097 },
25098 GetEnabledByServer: function(){
25099  return this.enabled;
25100 },
25101 SetEnabled: function(enabled){  
25102  ASPxClientListBoxBase.prototype.SetEnabled.call(this, enabled);
25103  this.CallbackSpaceInit(false);
25104 },
25105 SetReadOnlyInternal: function(readOnly) {
25106  ASPxClientListBoxBase.prototype.SetReadOnlyInternal.call(this, readOnly);
25107  if (readOnly) {
25108   this.RemoveSelectAllStateItems();
25109   this.stateControllerManager.RemoveHoverStateItem();
25110  }
25111  else {
25112   this.AddSelectAllStateItems(false);
25113   this.stateControllerManager.AddStateItems(true, true);
25114  }
25115 }, 
25116 CallbackSpaceInit: function(isInitialization){
25117  if(this.isCallbackMode){
25118   this.SetBottomScrollSpacerVisibility(this.GetScrollSpacerVisibility(false));
25119   this.SetTopScrollSpacerVisibility(this.GetScrollSpacerVisibility(true));
25120   if(isInitialization || this.isComboBoxList){
25121    this.EnsureSelectedItemVisible();
25122    ASPx.Evt.AttachEventToElement(this.GetScrollDivElement(), "scroll", aspxLBScroll);
25123   }
25124  }
25125 },
25126 GetListTable: function() {
25127  return this.tempCache.Get("ListTable", this.GetListTableCore, this);
25128 },
25129 GetListTableCore: function(){
25130  if(!ASPx.IsExistsElement(this.listTable))
25131   this.listTable = ASPx.GetElementById(this.name + lTableIdSuffix);
25132  return this.listTable;
25133 },
25134 GetItemElements: function() {
25135  return this.GetListTable().rows;
25136 },
25137 GetListTableHeight: function(){
25138  return this.GetListTable().offsetHeight;
25139 },
25140 GetHeaderDivElement: function(){
25141  if(!ASPx.IsExistsElement(this.headerDiv))
25142   this.headerDiv = ASPx.GetElementById(this.name + lbHeaderDivIdSuffix);
25143  return this.headerDiv;
25144 },
25145 GetHeaderTableElement: function(){
25146  if(!ASPx.IsExistsElement(this.headerTable)){
25147   var headerDiv = this.GetHeaderDivElement();
25148   this.headerTable = ASPx.GetNodeByTagName(headerDiv, "table", 0);
25149  }
25150  return this.headerTable;
25151 },
25152 GetScrollDivElement: function(){
25153  if(!ASPx.IsExistsElement(this.scrollDivElement))
25154   this.scrollDivElement = document.getElementById(this.name + lbDSuffix);
25155  return this.scrollDivElement;
25156 },
25157 GetItemElement: function(index) {
25158  return this.itemsManager.GetItemElement(index);
25159 },
25160 GetItemRow: function(index){
25161  return this.itemsManager.GetItemRow(index);
25162 },
25163 GetItemIndexByRow: function (itemRow) {
25164  return this.itemsManager.GetItemIndexByRow(itemRow);
25165 },
25166 GetItemSelectableElementsByRow: function(row) {
25167  return row.cells;
25168 },
25169 GetItemTexts: function(item) {
25170  return item.texts ? item.texts : [ item.text ];
25171 },
25172 GetItemHtmlContent: function(index) {
25173  return this.itemsManager.GetItemHtmlContent(index);
25174 },
25175 GetItemCount: function(){
25176  return this.itemsManager.GetItemCount();
25177 },
25178 GetListTableRowParent: function() {
25179  var listTable = this.GetListTable();
25180  return this.GetTableRowParent(listTable);
25181 },
25182 EnsureFixWidthRow: function (isSetItemHtmlProcessing) {
25183  var needfixWidthRow = !this.ContainsFixWidthRow() && this.IsMultiColumn() && (isSetItemHtmlProcessing || this.hasItemTemplate);
25184  if (needfixWidthRow)
25185   this.CreateFixWidthRow();
25186 },
25187 CreateFixWidthRow: function() {
25188  this.fixWidthRow = document.createElement("TR");
25189  var etalonRow = this.GetSampleItemRow();
25190  for(var i = 0; i < etalonRow.cells.length; i++) {
25191   var fixWidthCell = document.createElement("TD");
25192   var etalonCell = etalonRow.cells[i];
25193   var etalonCellStyle = ASPx.GetCurrentStyle(etalonCell);
25194   fixWidthCell.style.width = etalonCell.style.width || etalonCellStyle.width;
25195   fixWidthCell.style.borderLeftWidth = etalonCellStyle.borderLeftWidth;
25196   fixWidthCell.style.borderRightWidth = etalonCellStyle.borderRightWidth;
25197   fixWidthCell.style.borderLeftStyle = etalonCellStyle.borderLeftStyle;
25198   fixWidthCell.style.borderRightStyle = etalonCellStyle.borderRightStyle;
25199   fixWidthCell.style.paddingLeft = etalonCellStyle.paddingLeft;
25200   fixWidthCell.style.paddingRight = etalonCellStyle.paddingRight;
25201   fixWidthCell.style.boxSizing = etalonCellStyle.boxSizing;
25202   fixWidthCell.style.display = etalonCellStyle.display;
25203   this.fixWidthRow.appendChild(fixWidthCell);
25204  }
25205  ASPx.SetElementVisibility(this.fixWidthRow, "hidden");
25206  this.fixWidthRow.style.height = "0px";
25207  var listTableBody = this.GetListTableRowParent();
25208  listTableBody.insertBefore(this.fixWidthRow, listTableBody.childNodes[0]);
25209 },
25210 ContainsFixWidthRow: function() {
25211  return this.fixWidthRow && this.fixWidthRow.parentNode === this.GetListTableRowParent();
25212 },
25213 GetVisibleItemCount: function () {
25214  return this.itemsManager.GetVisibleItemCount();
25215 },
25216 GetIndexVisibleItem: function(item) {
25217  var count = this.GetItemCount();
25218  var visibleItemCount = 0;
25219  for(var i = 0; i < count; i ++){
25220   if(this.IsItemFiltered(i))
25221    visibleItemCount++;
25222   var curItem = this.GetItem(i);
25223   if(item.value === curItem.value && item.text === curItem.text)
25224    break;
25225  }
25226  return visibleItemCount;
25227 },
25228 GetItemCellCount: function(){
25229  if(this.hasSampleItem)
25230   return this.GetSampleItemRow().cells.length;
25231  if(this.GetItemCount() > 0)
25232   return this.itemsManager.GetFirstVisibleItemRow().cells.length;
25233  return 0;
25234 },
25235 GetItemTextCellCount: function(){
25236  return this.GetItemCellCount() - this.GetItemFirstTextCellIndex();
25237 },
25238 GetItemFirstTextCellIndex: function(){
25239  var itemFirstTextCellIndex  = 0;
25240  if(this.GetIsCheckColumnExists())
25241   itemFirstTextCellIndex++;
25242  if(this.imageCellExists)
25243   itemFirstTextCellIndex++;
25244  return itemFirstTextCellIndex;
25245 },
25246 GetItemFirstTextCell: function(index){
25247  return this.GetItemTextCell(index, 0);
25248 },
25249 GetItemTextCell: function(itemIndex, textCellIndex) {
25250  var rowElement = this.GetItemRow(itemIndex);
25251  if(rowElement == null) 
25252   return null;
25253  return rowElement.cells[this.GetItemFirstTextCellIndex() + textCellIndex];
25254 },
25255 GetItemTextCells: function(item) {
25256  var firstTextCellIndex = this.GetItemFirstTextCellIndex();
25257  return Array.prototype.slice.call(this.GetItemSelectableElementsByRow(item), firstTextCellIndex);
25258 },
25259 GetItemTopOffset: function(index){
25260  return this.itemsManager.GetItemTopOffset(index);
25261 },
25262 GetItemHeight: function(index){
25263  return this.itemsManager.GetItemHeight(index);
25264 },
25265 GetItemsHeight: function(){
25266  return this.itemsManager.GetItemsHeight();
25267 },
25268 GetItemsWidth: function () {
25269  return this.itemsManager.GetItemsWidth();
25270 },
25271 GetItemCheckBoxInput: function(index){
25272  var itemRow = this.GetItemRow(index);
25273  var checkBoxCell = itemRow ? itemRow.cells[this.GetCheckBoxCellIndex()] : null;
25274  return checkBoxCell ? ASPx.GetNodesByTagName(checkBoxCell, "input")[0] : null;
25275 },
25276 GetIsCheckColumnExists: function(){
25277  if(!this.checkCellExists)
25278   this.checkCellExists = this.CheckColumnSelectionMode();
25279  return this.checkCellExists;
25280 },
25281 GetCheckBoxCellIndex: function(){
25282  return 0;
25283 },
25284 GetImageCellIndex: function(){
25285  return this.GetIsCheckColumnExists() ? 1 : 0;
25286 },
25287 GetItemCellsIdPostfixes: function(){
25288  if(this.itemCellsIdPostfixes == null){
25289   this.itemCellsIdPostfixes = [];
25290   var i = 0;
25291   if(this.GetIsCheckColumnExists()) {
25292    this.itemCellsIdPostfixes.push(lbIPostfixes[0]);
25293    i++;
25294   }
25295   if(this.imageCellExists){
25296    this.itemCellsIdPostfixes.push(lbIPostfixes[1]);
25297    i++;
25298   }
25299   var cellCount = this.GetItemCellCount();
25300   for(; i < cellCount; i++) 
25301    this.itemCellsIdPostfixes.push(lbIPostfixes[2] + i);
25302  }
25303  return this.itemCellsIdPostfixes;
25304 },
25305 AdjustControl: function (nestedCall) {
25306  if(this.IsAdjustmentRequired()) 
25307   this.heightCorrected = false;
25308  ASPxClientEdit.prototype.AdjustControl.call(this, nestedCall);
25309 },
25310 AdjustControlCore: function(){
25311  this.RemoveShowHideFilterCssRules();
25312  if(this.disableScrolling)
25313   return;
25314  ASPxClientEdit.prototype.AdjustControlCore.call(this);
25315  this.CorrectSize();
25316  this.itemsManager.Adjust();
25317  this.EnsureSelectedItemVisible();
25318  if(this.showFilterButton) {
25319   this.UpdateFilterButtonHeight();
25320   this.UpdateShowHideFilterElementCssRules();
25321  }
25322 },
25323 CorrectSize: function() {
25324  if(this.isComboBoxList || this.disableScrolling || this.filterStrategy.currentCallbackIsFiltration)
25325   return;
25326  this.LockScrollHandler();
25327  this.CorrectHeight();
25328  this.CorrectWidth();
25329  this.InitializePageSize();
25330  this.UnlockScrollHandler();
25331 },
25332 OnCorrectSizeByTimer: function() {
25333  if(this.IsVisible())
25334   this.CorrectSize();
25335 }, 
25336 SetProtectionFromFlick_inFF: function(changeVisibility, changeDisplay){
25337  if(!ASPx.Browser.Firefox) return;
25338  var listTable = this.GetListTable();
25339  if(changeVisibility)
25340   listTable.style.visibility = "hidden";
25341  if(changeDisplay)
25342   listTable.style.display = "none";
25343 },
25344 ResetProtectionFromFlick_inFF: function(){
25345  if(!ASPx.Browser.Firefox) return;
25346  var listTable = this.GetListTable();
25347  listTable.style.visibility = "";
25348  listTable.style.display = "";
25349 },
25350 CorrectHeight: function(force){
25351  if(ASPx.Browser.Firefox && this.heightCorrected && !force) return; 
25352  this.heightCorrected = true;
25353  var mainElement = this.GetMainElement();
25354  var divElement = this.GetScrollDivElement();
25355  divElement.style.height = "0px";
25356  var height = mainElement.offsetHeight;
25357  divElement.style.height = height + "px";
25358  var extrudedHeight = mainElement.offsetHeight;
25359  var heightCorrection = extrudedHeight - height;
25360  if(heightCorrection > 0){
25361   var divHeight = divElement.offsetHeight;
25362   this.SetProtectionFromFlick_inFF(true, false);
25363   divElement.style.height = (divHeight - heightCorrection) + "px";
25364   this.ResetProtectionFromFlick_inFF(); 
25365   extrudedHeight = mainElement.offsetHeight;
25366   var paddingsHeightCorrection = extrudedHeight - height;
25367   if(paddingsHeightCorrection > 0)
25368    divElement.style.height = (divHeight - heightCorrection - paddingsHeightCorrection) + "px";
25369  } 
25370 },
25371 IsMultiColumn: function(){
25372  return this.columnFieldNames.length > 0;
25373 },
25374 IsCorrectWidthRequired: function(){
25375  return true;
25376 },
25377 GetVisibleColumnCount: function() {
25378  if (!this.visibleColumnCount) {
25379   this.visibleColumnCount = this.IsMultiColumn() ?
25380    ASPx.Data.CollectionToArray(this.GetSampleItemRow().cells)
25381     .slice(this.GetItemFirstTextCellIndex())
25382     .filter(function (cell) { return ASPx.GetElementDisplay(cell); }).length
25383    : -1;
25384  }
25385  return this.visibleColumnCount;
25386 },
25387 CorrectWidth: function () {
25388  if(!this.IsCorrectWidthRequired()) return;
25389  if(this.IsMultiColumn())
25390   this.CorrectMultiColumnWidth();
25391  else
25392   this.CorrectNonMultiColumnWidth();
25393 },
25394 CorrectMultiColumnWidth: function(){
25395  var scrollBarWidth = this.GetVerticalScrollBarWidth(); 
25396  this.CorrectMultiColumnHeaderWidth(scrollBarWidth);
25397 },
25398 CollapseMultiColumnHeaderWidth:function(){
25399  var headerDivElement = this.GetHeaderDivElement();
25400  headerDivElement.style.width = "0px";
25401 },
25402 CorrectMultiColumnHeaderWidth: function(scrollBarWidth){
25403  var headerDivElement = this.GetHeaderDivElement();
25404  if(ASPx.IsExistsElement(headerDivElement)){
25405   var headerTable;
25406   if(ASPx.Browser.WebKitFamily){
25407    headerTable = this.GetHeaderTableElement();
25408    if(!ASPx.IsExistsElement(headerTable))
25409     headerTable = null;
25410   }
25411   if(this.rtl)
25412    headerDivElement.style.paddingLeft = scrollBarWidth + "px";
25413   else
25414    headerDivElement.style.paddingRight = scrollBarWidth + "px";
25415   if(headerTable)
25416    window.setTimeout(function() { headerTable.style.width = "100%"; }, 0);
25417  }
25418 },
25419 CorrectNonMultiColumnWidth: function(){
25420  var mainElement = this.GetMainElement(),
25421   divElement = this.GetScrollDivElement();
25422  if(this.width == ""){
25423   var itemsWidth = this.GetItemsWidth();
25424   if (itemsWidth != 0 || !ASPx.Browser.NetscapeFamily) { 
25425    divElement.style.width = Math.max((itemsWidth + this.GetVerticalScrollBarWidth()), this.scrollDivMinWidth) + "px";
25426    if(ASPx.Browser.Firefox) 
25427     mainElement.style.width = divElement.offsetWidth + "px";
25428   }
25429  } else {  
25430   mainElement.style.width = this.width;
25431   if(this.width !== "100%") {
25432    var scrollDivWidth = ASPx.Browser.WebKitFamily ? 1 : 0;
25433    var oldScrollTop = divElement.scrollTop;
25434    divElement.style.width = scrollDivWidth + "px";
25435    scrollDivWidth = ASPx.Browser.Edge ? mainElement.clientWidth - ASPx.GetHorizontalBordersWidth(mainElement) : mainElement.clientWidth;
25436    divElement.style.width = scrollDivWidth + "px";
25437    var isScrollEventWillRaised = divElement.scrollTop != oldScrollTop;
25438    if(isScrollEventWillRaised)
25439     this.itemsManager.DeactivateScrollHandler();
25440    divElement.scrollTop = oldScrollTop;
25441   }
25442  }
25443 },
25444 UpdateAdjustmentFlags: function() {
25445  var mainElement = this.GetMainElement();
25446  if(mainElement) {
25447   var mainElementStyle = ASPx.GetCurrentStyle(mainElement);
25448   this.UpdatePercentSizeConfig([this.width], [mainElementStyle.height, mainElement.style.height]);
25449  }
25450 },
25451 EnsureSelectedItemVisible: function() {
25452  var index = this.GetSelectedIndex();
25453  if(index != -1)
25454   this.itemsManager.MakeItemVisibleAtTop(index);
25455 },
25456 MakeItemVisible: function(index) { 
25457  if(!this.itemsManager.IsItemVisible(index))
25458   this.itemsManager.MakeItemVisibleAtTop(index);
25459 },
25460 ScrollItemToTop: function(index) {
25461  this.LockScrollHandler();
25462  this.SetScrollTop(this.GetItemTopOffset(index));
25463  this.UnlockScrollHandler();
25464 },
25465 GetScrollDivChildElementHeight: function() {
25466  return this.itemsManager.GetScrollDivChildElementHeight();
25467 },
25468 SetScrollTop: function(scrollTop){
25469  var scrollDiv = this.GetScrollDivElement();
25470  if(scrollDiv){ 
25471   scrollDiv.scrollTop = scrollTop;
25472   if(ASPx.Browser.Opera) 
25473    this.CachedScrollTop();
25474  }   
25475 },
25476 CachedScrollTop: function(){
25477  var scrollDiv = this.GetScrollDivElement();
25478  scrollDiv.cachedScrollTop = scrollDiv.scrollTop;
25479 },
25480 RestoreScrollTopFromCache: function(){
25481  var scrollDiv = this.GetScrollDivElement();
25482  if(scrollDiv && ASPx.IsExists(scrollDiv.cachedScrollTop))
25483   scrollDiv.scrollTop = scrollDiv.cachedScrollTop;
25484 },
25485 IsListBoxWidthLessThenList: function(){
25486  var divElement = this.GetScrollDivElement();
25487  var listTable = this.GetListTable();
25488  var listTabelWidth = listTable.style.width;
25489  var isLess = false;
25490  listTable.style.width = "";
25491  isLess = listTable.offsetWidth < divElement.offsetWidth;
25492  listTable.style.width = listTabelWidth;
25493  return isLess;
25494 },
25495 GetVerticalScrollBarWidth: function(){
25496  var divElement = this.GetScrollDivElement(); 
25497  if(!this.verticalScrollBarWidth || this.verticalScrollBarWidth <= 0){
25498   this.verticalScrollBarWidth = this.GetVerticalScrollBarWidthCore(divElement);
25499   return this.verticalScrollBarWidth;
25500  } else
25501   return this.GetIsVerticalScrollBarVisible(divElement) ? this.verticalScrollBarWidth : 0;
25502 },
25503 GetIsVerticalScrollBarVisible: function(divElement){
25504  var verticalOverflow = this.GetVerticalOverflow(divElement);
25505  if(verticalOverflow != "auto"){
25506   return divElement.clientHeight < this.GetListTableHeight();
25507  } else {
25508   var borderWidthWithScroll = divElement.offsetWidth - divElement.clientWidth;
25509   return borderWidthWithScroll == this.scrollDivBordersWidthWithScroll;
25510  }
25511 },
25512 GetVerticalScrollBarWidthCore: function(divElement){
25513  var overflowYReserv = this.GetVerticalOverflow(divElement);
25514  this.SetVerticalOverflow(divElement, "auto");
25515  this.scrollDivBordersWidthWithScroll = divElement.offsetWidth - divElement.clientWidth;
25516  this.SetProtectionFromFlick_inFF(false, true);
25517  this.SetVerticalOverflow(divElement, "hidden");
25518  var bordersWidthWithoutScroll = divElement.offsetWidth - divElement.clientWidth;
25519  this.SetVerticalOverflow(divElement, overflowYReserv);
25520  this.ResetProtectionFromFlick_inFF();
25521  return this.scrollDivBordersWidthWithScroll - bordersWidthWithoutScroll;
25522 },
25523 GetVerticalOverflowPropertyName: function() {
25524  if(ASPx.Browser.WebKitFamily || ASPx.Browser.AndroidDefaultBrowser || ASPx.Browser.Firefox && ASPx.Browser.Version >= 3)
25525   return "overflowY";
25526  return "overflow";
25527 },
25528 GetVerticalOverflow: function(element){
25529  return element.style[this.GetVerticalOverflowPropertyName()];
25530 },
25531 SetVerticalOverflow: function(element, value) {
25532  element.style[this.GetVerticalOverflowPropertyName()] = value;
25533 },
25534 MultiSelectionMode: function(){
25535  return this.selectionMode != ListBoxSelectionMode.Single;
25536 },
25537 CheckColumnSelectionMode: function(){
25538  return this.selectionMode == ListBoxSelectionMode.CheckColumn;
25539 },
25540 OnItemClick: function(index, evt){
25541  if(!this.isInitialized) 
25542   return;
25543  if (this.GetReadOnly()) {
25544   ASPx.Evt.PreventEvent(evt);
25545   return this.OnItemClickOrDblClickReadOnly();
25546  }
25547  if(this.CheckColumnSelectionMode() && this.IsCheckBoxClicked(evt))
25548   this.GetItemSelectionHelper().OnItemCheckBoxClick(index, evt);
25549  else
25550   this.GetItemSelectionHelper().OnItemClick(index, evt);
25551  this.SetFocus();
25552  this.RaiseItemClick();
25553 },
25554 OnItemClickOrDblClickReadOnly: function(){
25555  return false;
25556 },
25557 OnItemDblClick: function(){
25558  if (this.GetReadOnly())
25559   return this.OnItemClickOrDblClickReadOnly();
25560  return this.RaiseItemDoubleClick();
25561 },
25562 CanChangeSelection: function(){
25563  return !this.GetReadOnly() || !this.isInitialized;
25564 },
25565 SelectIndexSilent: function(index){ 
25566  return this.SetItemSelectionStateSilent(index);
25567 },
25568 SetItemSelectionStateSilent: function(index) {
25569  if(!this.CanChangeSelection())
25570   return;
25571  var oldSelectionIndex = this.GetSelectedIndex();
25572  this.LockSelectionEvents();
25573  this.SetSelectedIndexCore(index);
25574  this.UnlockSelectionEvents();
25575  return index !== oldSelectionIndex;
25576 },
25577 SetItemSelectionAppearance: function (index, selected, controller, checkCanChangeSelection) {
25578  if (checkCanChangeSelection && !this.CanChangeSelection())
25579   return;
25580  if(!controller)
25581   controller = ASPx.GetStateController();
25582  var itemFirstTextCell = this.GetItemFirstTextCell(index);
25583  if(selected)
25584   controller.SelectElementBySrcElement(itemFirstTextCell);
25585  else
25586   controller.DeselectElementBySrcElement(itemFirstTextCell);
25587 },
25588 GetItemSelectionHelper: function(){
25589  if(!this.itemSelectionHelper)
25590   this.itemSelectionHelper = this.CreateItemSelectionHelper();
25591  return this.itemSelectionHelper;
25592 },
25593 CreateItemSelectionHelper: function(){
25594  if(this.selectionMode == ListBoxSelectionMode.Single)
25595   return new ListBoxSingleSelectionHelper(this);
25596  else if(this.selectionMode == ListBoxSelectionMode.Multiple)
25597   return new ListBoxMultiSelectionHelper(this);
25598  else if(this.selectionMode == ListBoxSelectionMode.CheckColumn)
25599   return new ListBoxCheckSelectionHelper(this);
25600 },
25601 GetValue: function(){
25602  var index = this.GetSelectedIndex();
25603  if(0 <= index && index < this.itemsValue.length)
25604   return this.itemsValue[index];
25605  return null;
25606 },
25607 SetValue: function(value){
25608  var index = this.FindItemIndexByValue(value);
25609  this.SetSelectedIndex(index);
25610 },
25611 GetSelectedItem: function(){
25612  var index = this.GetSelectedIndex();
25613  return this.GetItem(index);
25614 },
25615 GetSelectedIndex: function(){
25616  if(!this.itemSelectionHelper)
25617   return this.GetSelectedIndexInternal();
25618  return this.GetItemSelectionHelper().GetSelectedIndex();
25619 },
25620 SetSelectedIndex: function(index){
25621  this.LockSelectionEvents();
25622  this.SetSelectedIndexCore(index);
25623  this.EnsureSelectedItemVisible(index);
25624  this.UnlockSelectionEvents();
25625 },
25626 SetSelectedIndexCore: function(index){
25627  this.GetItemSelectionHelper().SetSelectedIndex(index);
25628 },
25629 GetSelectedIndices: function(){
25630  return this.GetItemSelectionHelper().GetSelectedIndices();
25631 },
25632 GetSelectedValues: function(){ 
25633  return this.GetItemSelectionHelper().GetSelectedValues();
25634 },
25635 GetSelectedItems: function(){
25636  return this.GetItemSelectionHelper().GetSelectedItems();
25637 },
25638 SelectAll: function(){
25639  this.SelectIndices();
25640 },
25641 UnselectAll: function(){
25642  this.UnselectIndices();
25643 },
25644 SelectIndices: function(indices){
25645  this.LockSelectionEvents();
25646  this.GetItemSelectionHelper().SelectIndices(indices);
25647  this.UnlockSelectionEvents();
25648 },
25649 SelectItems: function(items){
25650  this.LockSelectionEvents();
25651  this.GetItemSelectionHelper().SelectItems(items);
25652  this.UnlockSelectionEvents();
25653 },
25654 SelectValues: function(values){
25655  this.LockSelectionEvents();
25656  this.GetItemSelectionHelper().SelectValues(values);
25657  this.UnlockSelectionEvents();
25658 },
25659 UnselectIndices: function(indices){
25660  this.LockSelectionEvents();
25661  this.GetItemSelectionHelper().UnselectIndices(indices);
25662  this.UnlockSelectionEvents();
25663 },
25664 UnselectItems: function(items){
25665  this.LockSelectionEvents();
25666  this.GetItemSelectionHelper().UnselectItems(items);
25667  this.UnlockSelectionEvents();
25668 },
25669 UnselectValues: function(values){
25670  this.LockSelectionEvents();
25671  this.GetItemSelectionHelper().UnselectValues(values);
25672  this.UnlockSelectionEvents();
25673 },
25674 GetIsItemSelected: function(index){
25675  return this.GetItemSelectionHelper().GetIsItemSelected(index);
25676 },
25677 GetFocusedIndex: function(){
25678  return this.GetItemSelectionHelper().GetFocusedIndex();
25679 },
25680 UpdateInternalState: function(){
25681  this.UpdateHiddenInputs();
25682 },
25683 IsUpdateHiddenInputsLocked: function(){
25684  return this.GetItemSelectionHelper().IsUpdateInternalSelectionStateLocked();
25685 },
25686 UpdateHiddenInputs: function(){
25687  if(this.IsUpdateHiddenInputsLocked())
25688   return;
25689  if(this.MultiSelectionMode()){ 
25690   var element = this.FindStateInputElement();
25691   if(ASPx.IsExistsElement(element)) {
25692    var sb = [ ];
25693    var serialiser = this.GetSerializingHelper();
25694    var selectedIndices = this.GetSelectedIndices();
25695    for(var i = 0; i < selectedIndices.length; i++)
25696     serialiser.SerializeAtomValue(sb, this.GetItemValue(selectedIndices[i]));
25697    element.value = sb.join("");
25698   }
25699  } else 
25700   ASPxClientListBoxBase.prototype.UpdateHiddenInputs.call(this);
25701 },
25702 UseDelayedSpecialFocus: function() { 
25703  return true;
25704 },
25705 GetInnerEditors: function() {
25706  var result = ASPxClientListBoxBase.prototype.GetInnerEditors();
25707  if(this.filteringTextBox) {
25708   result.push(this.filteringTextBox);
25709  }
25710  return result;
25711 },
25712 AdjustWidthInDropDown: function(parentComboBoxMainElement, isCallbackMode, customWidth) {
25713  var lbScrollDiv = this.GetScrollDivElement();
25714  var lbMainElement = this.GetMainElement();
25715  var scrollWidth = 0;
25716  if (this.IsMultiColumn() && isCallbackMode && this.GetScrollSpacerVisibility(false) && this.GetBottomScrollSpacerHeight() == 0)
25717   this.SetBottomScrollSpacerVisibility(true);
25718  var keepCurrentWidth = this.HasVirtualScrolling() && this.hasDecoratedItems && this.isComboBoxScrollingCallbackProcessing;
25719  if(!keepCurrentWidth) {
25720   lbMainElement.style.width = "";
25721   lbScrollDiv.style.paddingRight = "0px";
25722   lbScrollDiv.style.width = "100%";
25723  }
25724  else
25725   this.isComboBoxScrollingCallbackProcessing = false;
25726  if (customWidth != "") {
25727   lbMainElement.style.width = customWidth;
25728   var width = lbMainElement.clientWidth;
25729   var scrollInfo = this.SetScrollDivAndCorrectionForScroll(width, false);
25730   width = scrollInfo.scrollDivWidth;
25731   scrollWidth = scrollInfo.scrollWidth;
25732   if(!this.enableEllipsis) {
25733    var difference = this.GetItemsWidth() - lbScrollDiv.clientWidth;
25734    if (difference > 0) {
25735     lbMainElement.style.width = (lbMainElement.offsetWidth + difference) + "px";
25736     lbScrollDiv.style.width = (lbMainElement.clientWidth) + "px";
25737    }
25738   }
25739  } else {
25740   var width = this.GetItemsWidth();
25741   var scrollInfo = this.SetScrollDivAndCorrectionForScroll(width, true);
25742   width = scrollInfo.scrollDivWidth;
25743   scrollWidth = scrollInfo.scrollWidth;
25744   if (ASPx.Browser.Firefox && lbMainElement.offsetWidth < lbScrollDiv.offsetWidth)
25745    lbMainElement.style.width = "0%"; 
25746   if (parentComboBoxMainElement) {
25747    var widthDifference = parentComboBoxMainElement.offsetWidth - lbMainElement.offsetWidth;
25748    if (widthDifference > 0) {
25749     this.scrollDivMinWidth = width + widthDifference;
25750     lbScrollDiv.style.width = this.scrollDivMinWidth + "px";
25751     var twoBorderSize = (lbMainElement.offsetWidth - lbMainElement.clientWidth);
25752     lbMainElement.style.width = (width + widthDifference + twoBorderSize) + "px"; 
25753    }
25754   }
25755  }
25756  if (this.IsMultiColumn())
25757   this.CorrectMultiColumnHeaderWidth(scrollWidth);
25758  if (this.NeedToHandleCellWidth())
25759   this.CorrectCellNullWidthStyle(this.itemsManager.GetFirstVisibleItemRow());
25760  if (this.ContainsFixWidthRow()) {
25761   var lbHeaderDiv = this.GetHeaderDivElement();
25762   if (lbHeaderDiv)
25763    lbScrollDiv.style.width = lbHeaderDiv.offsetWidth - ASPx.GetLeftRightBordersAndPaddingsSummaryValue(lbScrollDiv) + "px";
25764  }
25765  return lbScrollDiv.offsetWidth;
25766 },
25767 SetScrollDivAndCorrectionForScroll: function(width, widthByContent) {
25768  var lbScrollDiv = this.GetScrollDivElement();
25769  var scrollWidth = this.GetVerticalScrollBarWidth();
25770  var browserCanHaveScroll = this.GetVerticalOverflow(lbScrollDiv) == "auto";
25771  if (widthByContent && browserCanHaveScroll)
25772   width += scrollWidth;
25773  lbScrollDiv.style.width = width + "px";
25774  return { scrollDivWidth: width, scrollWidth: scrollWidth };
25775 },
25776 BeforeAdjustHeightInDropDown: function() {
25777  this.GetMainElement().style.height = "0px";
25778 },
25779 AdjustHeightInDropDown: function(customHeight, visibleRowCount) {
25780  this.BeforeAdjustHeightInDropDown();
25781  if(this.itemsManager.smallestItemHeight === 0)
25782   this.itemsManager.updateSmallestItemSize();
25783  var lbHeight = 0;
25784  if (customHeight == "")
25785   lbHeight = this.GetHeightByContent(visibleRowCount);
25786  else
25787   lbHeight = this.GetHeightByServerValue(customHeight);
25788  this.itemsManager.Adjust(); 
25789  this.InitializePageSize();
25790  return lbHeight;
25791 },
25792 GetHeightByContent: function(visibleRowCount) {
25793  var lbScrollDiv = this.GetScrollDivElement(),
25794   itemCount = this.GetVisibleItemCount(),
25795   hasVerticalScrollbar = itemCount > visibleRowCount;
25796  lbScrollDiv.style.height = "";
25797  var height = 0;
25798  if (hasVerticalScrollbar)
25799   height = this.itemsManager.GetTotalItemsHeight(0, visibleRowCount - 1);
25800  else {
25801   if(itemCount !== 0) {
25802    height = this.GetItemsHeight();
25803   }
25804  }
25805  height += "px";
25806  lbScrollDiv.style.height = height;
25807  height = lbScrollDiv.offsetHeight;
25808  height += ASPx.GetTopBottomBordersAndPaddingsSummaryValue(this.GetMainElement());
25809  var lbHeaderDiv = this.GetHeaderDivElement();
25810  if (ASPx.IsExists(lbHeaderDiv))
25811   height += lbHeaderDiv.offsetHeight;
25812  return height;
25813 },
25814 GetHeightByServerValue: function(customHeight) {
25815  var lbMainElement = this.GetMainElement();
25816  var lbScrollDiv = this.GetScrollDivElement();
25817  var height = customHeight;
25818  lbMainElement.style.height = "0px";
25819  lbScrollDiv.style.height = "0px";
25820  lbMainElement.style.height = height;
25821  var trueLbOffsetHeight = lbMainElement.offsetHeight;
25822  var trueLbClientHeight = lbMainElement.clientHeight;
25823  lbScrollDiv.style.height = lbMainElement.clientHeight + "px";
25824  var lbHeightCorrection = lbMainElement.offsetHeight - trueLbOffsetHeight;
25825  lbScrollDiv.style.height = (trueLbClientHeight - lbHeightCorrection) + "px";
25826  height = lbMainElement.offsetHeight;
25827  return height;
25828 },
25829 GetLoadingParentElement: function() {
25830  return this.GetScrollDivElement().parentNode;
25831 },
25832 ShowLoadingPanel: function() { 
25833  if(!this.isComboBoxList){
25834   var loadingParentElement = this.GetLoadingParentElement();
25835   var lp = this.CreateLoadingPanelWithAbsolutePosition(loadingParentElement);
25836   this.PreventMouseWheelOnElement(lp);
25837  }
25838 },
25839 ShowLoadingDiv: function () {
25840  if(!this.isComboBoxList){
25841   var loadingParentElement = this.GetLoadingParentElement();
25842   var ld = this.CreateLoadingDiv(loadingParentElement);
25843   this.PreventMouseWheelOnElement(ld);
25844  }
25845 },
25846 PreventMouseWheelOnElement: function(element) {
25847  if(!element) return;
25848  var wheelEventName = ASPx.Evt.GetMouseWheelEventName();
25849  ASPx.Evt.AttachEventToElement(element, wheelEventName, function(evt) {
25850   if(this.scrollHelper.GetIsAnySpacerVisible())
25851    ASPx.Evt.PreventEvent(evt);
25852  }.aspxBind(this));
25853 },
25854 ParseCallbackResult: function(result, shouldSelectSilentDelegate){
25855  var gottenEgdeOfCollection = false;
25856  var isLoadindToTopByScroll = this.scrollHelper.IsScrolledToTopSpacer();
25857  if(result[CONSTANTS.CALLBACK_RESULTS.ITEMS].length) {
25858   var deserializedItems = this.DeserializeItems(result[CONSTANTS.CALLBACK_RESULTS.ITEMS]);
25859   this.LoadItemsFromCallback(isLoadindToTopByScroll, deserializedItems, shouldSelectSilentDelegate);
25860   gottenEgdeOfCollection = deserializedItems.length < this.callbackPageSize;
25861  }
25862  var noMoreItemsForLoadThisDirection = !result[CONSTANTS.CALLBACK_RESULTS.ITEMS].length || gottenEgdeOfCollection;
25863  this.SetScrollSpacerVisibility(isLoadindToTopByScroll, !noMoreItemsForLoadThisDirection);
25864  this.scrollHelper.Reset();
25865 },
25866 LoadItemsFromCallback: function(isToTop, deserializedItems, shouldSelectSilentDelegate){
25867  this.LockSynchronizationOnInternalCallback();
25868  this.BeginUpdate();
25869  var isMultiSelect = this.MultiSelectionMode();
25870  this.RemoveAccessibilityHeaderRow();
25871  if(isToTop){
25872   var scrollHeightCorrection = 0;
25873   for(var i = deserializedItems.length - 1; i >= 0; i--) {
25874    this.InsertItemInternal(0, deserializedItems[i]);
25875    scrollHeightCorrection += this.GetItemHeight(0);
25876   } 
25877   this.GetScrollDivElement().scrollTop += scrollHeightCorrection;
25878   this.serverIndexOfFirstItem -= deserializedItems.length;
25879   if(this.serverIndexOfFirstItem < 0) this.serverIndexOfFirstItem = 0;
25880  } else {
25881   for(var i = 0; i < deserializedItems.length; i++) {
25882    var itemIndex = this.AddItemInternal(deserializedItems[i]);
25883    var shouldSelectSilent = shouldSelectSilentDelegate && shouldSelectSilentDelegate(deserializedItems[i].value, deserializedItems[i].text);
25884    this.SelectValueOnLoad(itemIndex, deserializedItems[i].selected, shouldSelectSilent, isMultiSelect);
25885   } 
25886  }
25887  if(this.changeSelectAfterCallback != 0) {
25888   var newIndex = this.GetSelectedIndex() + this.changeSelectAfterCallback;
25889   newIndex = this.GetAdjustedIndex(newIndex);
25890   this.SelectIndexSilent(newIndex);
25891   if(this.scrollHelper.isScrolledToTopSpacer)
25892    this.ScrollItemToTop(newIndex);
25893   else
25894    this.MakeItemVisible(newIndex);
25895  }
25896  this.AddAccessibilityHeaderRow();
25897  this.EndUpdate();
25898  this.UnlockSynchronizationOnInternalCallback();
25899 },
25900 SelectValueOnLoad: function (index, selected, shouldSelectSilent, isMultiSelect) {
25901  if(selected && this.changeSelectAfterCallback == 0) {
25902   if(isMultiSelect) {
25903    this.SelectIndices([index]);
25904   } else {
25905    if(shouldSelectSilent)
25906     this.SelectIndexSilent(index);
25907    else
25908     this.SelectIndex(index);
25909   }
25910  }
25911 },
25912 CreateSerializingHelper: function(){
25913  return new ListBoxItemsSerializingHelper(this);
25914 },
25915 InCallback: function(){
25916  var callbackOwner = this.GetCallbackOwnerControl();
25917  if(callbackOwner != null)
25918   return callbackOwner.InCallback();
25919  return ASPxClientListEdit.prototype.InCallback.call(this);
25920 },
25921 GetItemsRangeForLoad: function(){
25922  return this.scrollHelper.GetItemsRangeForLoad();
25923 },
25924 GetScrollSpacerElement: function(isTop){
25925  return document.getElementById(this.name + (isTop ? lbTSIdSuffix : lbBSIdSuffix));
25926 },
25927 GetScrollSpacerVisibility: function(isTop){
25928  if(!this.clientEnabled)
25929   return false;
25930  return isTop ? this.isTopSpacerVisible : this.isBottomSpacerVisible;
25931 },
25932 SetScrollSpacerVisibility: function(isTop, visibility){
25933  this.LockScrollHandler();
25934  var spacer = this.GetScrollSpacerElement(isTop);
25935  if(spacer){
25936   if(visibility)
25937    spacer.style.height = this.GetRequiredScrollSpacerHeight() + "px";
25938   if(this.clientEnabled){
25939    if(isTop)
25940     this.isTopSpacerVisible = visibility;
25941    else
25942     this.isBottomSpacerVisible = visibility;
25943   }
25944   if(ASPx.GetElementDisplay(spacer) != visibility){
25945    ASPx.SetElementDisplay(spacer, visibility);
25946    ASPx.GetElementVisibility(spacer, visibility);
25947   }
25948  }
25949  this.itemsManager.OnScrollSpacerVisibilityChanged();
25950  this.UnlockScrollHandler();
25951 },
25952 GetRequiredScrollSpacerHeight: function() {
25953  return this.GetScrollDivElement().clientHeight;
25954 },
25955 SetTopScrollSpacerVisibility: function(visibility){
25956  this.SetScrollSpacerVisibility(true, visibility);
25957 },
25958 SetBottomScrollSpacerVisibility: function(visibility){
25959  this.SetScrollSpacerVisibility(false, visibility);
25960 },
25961 GetTopScrollSpacerHeight: function(){
25962  return this.GetScrollSpacerVisibility(true) ? this.GetScrollSpacerElement(true).clientHeight : 0;
25963 },
25964 GetBottomScrollSpacerHeight: function(){
25965  return this.GetScrollSpacerVisibility(false) ? this.GetScrollSpacerElement(false).clientHeight : 0;
25966 },
25967 GetTopSpacersHeight: function() {
25968  return this.itemsManager.GetTopSpacersHeight();
25969 },
25970 SendCallback: function(onSuccess) {
25971  if(!this.InCallback()){
25972   this.ShowLoadingElements();
25973   var callbackOwner = this.GetCallbackOwnerControl();
25974   if(callbackOwner != null)
25975    callbackOwner.SendCallback(onSuccess);
25976   else {
25977    var argument = this.GetCallbackArguments();
25978    this.CreateCallback(argument, null, onSuccess);
25979   }
25980  }
25981 },
25982 OnCallback: function(result, shouldSelectSilentDelegate) {
25983  if(result.serverMode)
25984   this.UpdateStateObjectWithObject({serverMode: true});
25985  if(!this.filterStrategy || !this.filterStrategy.ShouldDiscardCallbackResult()) {
25986   this.ParseCallbackResult(result, shouldSelectSilentDelegate);
25987   if(!this.isComboBoxList)
25988    this.filterStrategy.OnCallback(result);
25989   this.OnCallbackFinally();
25990  }
25991 },
25992 OnCallbackError: function(result){
25993  ASPxClientListBoxBase.prototype.OnCallbackError.call(this, result);
25994  this.OnCallbackFinally();
25995 },
25996 OnCallbackFinally: function () {
25997  this.HideLoadingPanel();
25998  this.changeSelectAfterCallback = 0;
25999 },
26000 DoEndCallback: function() {
26001  this.filterStrategy.OnBeforeDoEndCallback();
26002  ASPxClientListBoxBase.prototype.DoEndCallback.call(this);
26003  this.filterStrategy.OnAfterDoEndCallback();
26004 },
26005 RaiseEndCallback: function() {
26006  if(this.preventEndCallbackRising)
26007   this.preventEndCallbackRising = false;
26008  else
26009   ASPxClientListBoxBase.prototype.RaiseEndCallback.call(this);
26010 },
26011 LockScrollHandler: function(){
26012  this.scrollHandlerLockCount ++;
26013 },
26014 UnlockScrollHandler: function(){
26015  this.scrollHandlerLockCount --;
26016 },
26017 IsScrollHandlerLocked: function(){
26018  return this.scrollHandlerLockCount > 0;
26019 },
26020 OnScroll: function(){
26021  if(this.IsScrollHandlerLocked()) return;
26022  if(this.IsVisible() && !this.InCallback() && ( this.GetScrollSpacerVisibility(true) || this.GetScrollSpacerVisibility(false))) {
26023   this.scrollHelper.OnScroll();
26024   if(this.scrollHelper.GetIsNeedToHideTopSpacer())
26025    this.SetTopScrollSpacerVisibility(false);
26026   if(this.scrollHelper.GetIsNeedCallback()) {
26027    this.isComboBoxScrollingCallbackProcessing = this.isComboBoxList;
26028    this.SendCallback();
26029   }
26030  }
26031 },
26032 OnBrowserWindowResize: function(e) {
26033  if(this.IsVisible())
26034   this.CorrectSize();
26035 },
26036 KeyboardSupportAllowed: function(){
26037  return !this.CheckColumnSelectionMode();
26038 },
26039 InitializeKeyHandlers: function() {
26040  if(this.KeyboardSupportAllowed()){
26041   this.AddKeyDownHandler(ASPx.Key.PageUp, "OnPageUp");
26042   this.AddKeyDownHandler(ASPx.Key.PageDown, "OnPageDown");
26043   this.AddKeyDownHandler(ASPx.Key.End, "OnEndKeyDown");
26044   this.AddKeyDownHandler(ASPx.Key.Home, "OnHomeKeyDown");
26045   this.AddKeyDownHandler(ASPx.Key.Up, "OnArrowUp");
26046   this.AddKeyDownHandler(ASPx.Key.Down, "OnArrowDown");
26047  } else if(this.accessibilityCompliant && !this.IsNativeCheckBoxes()) {
26048   this.AddKeyDownHandler(ASPx.Key.Up, "OnAccessArrowUp");
26049   this.AddKeyDownHandler(ASPx.Key.Down, "OnAccessArrowDown");
26050  }
26051 },
26052 OnArrowUp: function(evt){
26053  if(this.isInitialized)
26054   this.SelectNeighbour(-1);
26055  return true;
26056 },
26057 OnArrowDown: function(evt){
26058  if(this.isInitialized)
26059   this.SelectNeighbour(1);
26060  return true;
26061 },
26062 OnAccessArrowUp: function(evt){
26063  if(!this.isInitialized) return true;
26064  var index = this.GetFocusedIndex();
26065  var isItemCheckBoxFocused = this.GetInternalCheckBox(index) && this.GetInternalCheckBox(index).focused;
26066  var isSelectAllCheckBoxFocused = this.selectAllCheckBox && this.selectAllCheckBox.focused;
26067  if(index > this.GetFirstFilteredItemIndex() && isItemCheckBoxFocused)
26068   this.SetFocusedIndex(this.GetPrevFilteredItemIndex(index));
26069  else if(index == this.GetFirstFilteredItemIndex() && this.selectAllCheckBox && !isSelectAllCheckBoxFocused) {
26070   this.selectAllCheckBox.mainElement.focus();
26071   this.GetItemSelectionHelper().SetFocusedIndexInternal(index, false);
26072  }
26073  else
26074   this.SetFocusedIndex(this.GetLastFilteredItemIndex());
26075  return true;
26076 },
26077 OnAccessArrowDown: function(evt){
26078  if(!this.isInitialized) return true;
26079  var index = this.GetFocusedIndex();
26080  var isItemCheckBoxFocused = this.GetInternalCheckBox(index) && this.GetInternalCheckBox(index).focused;
26081  var isSelectAllCheckBoxFocused = this.selectAllCheckBox && this.selectAllCheckBox.focused;
26082  if(index < this.GetLastFilteredItemIndex() && isItemCheckBoxFocused)
26083   this.SetFocusedIndex(this.GetNextFilteredItemIndex(index));
26084  else if(index == this.GetLastFilteredItemIndex() && this.selectAllCheckBox && !isSelectAllCheckBoxFocused) {
26085   this.selectAllCheckBox.mainElement.focus();
26086   this.GetItemSelectionHelper().SetFocusedIndexInternal(index, false);
26087  }
26088  else
26089   this.SetFocusedIndex(this.GetFirstFilteredItemIndex());
26090  return true;
26091 },
26092 SetFocusedIndex: function(index) {
26093  if(this.GetIsCheckColumnExists()) {
26094   this.MakeItemVisible(index);
26095   setTimeout(function () { this.GetInternalCheckBox(index).mainElement.focus(); }.aspxBind(this), 0);
26096  }
26097  this.GetItemSelectionHelper().SetFocusedIndexInternal(index, false);
26098 },
26099 OnPageUp: function(evt){
26100  if(this.isInitialized)
26101   this.SelectNeighbour(-this.scrollPageSize);
26102  return true;
26103 },
26104 OnPageDown: function(evt){
26105  if(this.isInitialized)
26106   this.SelectNeighbour(this.scrollPageSize);
26107  return true;
26108 },
26109 OnHomeKeyDown: function(evt){
26110  if(this.isInitialized)
26111   this.SelectNeighbour(-this.GetItemCount());
26112  return true;
26113 },
26114 OnEndKeyDown: function(evt){
26115  if(this.isInitialized)
26116   this.SelectNeighbour(this.GetItemCount());
26117  return true;
26118 },
26119 GetAdjustedIndex: function(index){
26120  if(index < 0) index = 0;
26121  else{
26122   var itemCount = this.GetItemCount();
26123   if(index >= itemCount) index = itemCount - 1;
26124  }
26125  return index;
26126 },
26127 SelectNeighbour: function (step) {
26128  var itemCount = this.GetItemCount();
26129  if(itemCount > 0) {
26130   this.changeSelectAfterCallback = 0;
26131   var selectedIndex = this.GetFocusedIndex();
26132   var newSelectedIndex = this.GetNewSelectedIndex(selectedIndex, step);
26133   newSelectedIndex = this.GetAdjustedIndex(newSelectedIndex);
26134   if(selectedIndex != newSelectedIndex && this.IsItemFiltered(newSelectedIndex)) {
26135    this.LockScrollOnKBNavigation();
26136    this.SetSelectedIndexCore(newSelectedIndex);
26137    this.UnlockScrollOnKBNavigation();
26138   }
26139   if(this.GetIsNeedToCallbackLoadItemsToTop(newSelectedIndex, step, itemCount)) {
26140    this.LoadItemsOnCallback(true, newSelectedIndex);
26141   } else if(this.GetIsNeedToCallbackLoadItemsToBottom(newSelectedIndex, step, itemCount)) {
26142    this.LoadItemsOnCallback(false, newSelectedIndex);
26143   }
26144   this.itemsManager.MakeItemVisible(newSelectedIndex);
26145  }
26146 },
26147 GetNewSelectedIndex: function(selectedIndex, step) {
26148  var pageDownSize = step == 1 ? this.scrollPageSize + 1 : this.scrollPageSize; 
26149  var isFirstPageDown = selectedIndex == -1 && step == pageDownSize && step > 1;
26150  if(isFirstPageDown)
26151   step++;
26152  var newSelectedIndex = 0;
26153  var areThereUnfilteredItems = this.GetVisibleItemCount() < this.GetItemCount();
26154  if(areThereUnfilteredItems)
26155   newSelectedIndex = this.itemsManager.GetNewItemIndexInFilteredRange(selectedIndex, step);
26156  else
26157   newSelectedIndex = selectedIndex + step;
26158  return newSelectedIndex;
26159 },
26160 GetIsNeedToCallbackLoadItemsToTop: function(selectedIndex, step, itemCount){
26161  return this.isCallbackMode && this.GetScrollSpacerVisibility(true) && 
26162   this.serverIndexOfFirstItem > 0 && ((step < 0 && selectedIndex <= 0) || step <= -itemCount);
26163 },
26164 GetIsNeedToCallbackLoadItemsToBottom: function(selectedIndex, step, itemCount){
26165  return this.isCallbackMode && this.GetScrollSpacerVisibility(false) && 
26166   ((step > 0 && selectedIndex >= itemCount - 1) || step >= itemCount);
26167 },
26168 LoadItemsOnCallback: function(isToTop, index){
26169  this.changeSelectAfterCallback = index - this.GetSelectedIndex();
26170  this.scrollHelper.SetItemsRangeForLoad(isToTop);
26171  this.isComboBoxScrollingCallbackProcessing = this.isComboBoxList;
26172  this.SendCallback();
26173 },
26174 FindInputElement: function(){
26175  if(this.accessibilityCompliant)
26176   return this.isComboBoxList ? null : this.GetAccessibilityAssistantElement();
26177  return this.GetKBSInput();
26178 },
26179 GetKBSInput: function() {
26180  return this.GetChildElement("KBS");
26181 },
26182 GetAccessibilityActiveElements: function() {
26183  var accessibilityElements = [];
26184  if(this.CheckColumnSelectionMode()) {
26185   for(var i = 0; i < this.GetItemCount() ; i++) {
26186    var checkBoxFocusableElement = this.GetCheckBoxFocusableElement(i);
26187    if(checkBoxFocusableElement)
26188     accessibilityElements.push(checkBoxFocusableElement);
26189   }
26190  }
26191  accessibilityElements.push(this.accessibilityCompliant ? this.GetAccessibilityHelper().GetActiveElement() : this.GetInputElement());
26192  return accessibilityElements;
26193 },
26194 SetHoverElement: function(element){
26195  ASPx.GetStateController().SetCurrentHoverElementBySrcElement(element);
26196 },
26197 InitOnContainerMadeVisible: function(){
26198  this.AdjustControl();
26199 },
26200 ClearItemsCore: function(){
26201  this.itemsManager.ClearItems();
26202  this.EnsureFixWidthRow();
26203  this.AddAccessibilityHeaderRow();
26204  this.OnItemsCleared();
26205  this.SetValue(null);
26206 },
26207 OnItemsCleared: function(){
26208  this.GetItemSelectionHelper().OnItemsCleared();
26209 },
26210 CorrectCellWidthsOnFirstRowItemReplacement: function(oldFirstRowItemIndex, newFirstRowItemIndex) {
26211  if (!this.ContainsFixWidthRow() && !this.HasVirtualScrolling()) {
26212   var oldFirstRowItemHasTemplate = this.ItemRowHasTemplate(oldFirstRowItemIndex);
26213   var newFirstRowItemHasTemplate = this.ItemRowHasTemplate(newFirstRowItemIndex);
26214   if(!oldFirstRowItemHasTemplate && !newFirstRowItemHasTemplate)
26215    this.CopyCellWidths(oldFirstRowItemIndex, newFirstRowItemIndex);
26216  }
26217 },
26218 CopyCellWidths: function(sourceRowIndex, destinationRowIndex){
26219  var cellCount = this.GetItemCellCount();
26220  var sourceRow = this.GetItemRow(sourceRowIndex);
26221  var destRow = this.GetItemRow(destinationRowIndex);
26222  if (!sourceRow || !destRow) return; 
26223  var lastDestCellIndex = destRow.cells.length - 1;
26224  for(var i = 0; i < lastDestCellIndex; i++) {
26225   destRow.cells[i].style.width = sourceRow.cells[i].style.width;
26226  }
26227  if(destRow.cells.length === cellCount) {
26228   destRow.cells[lastDestCellIndex].style.width = sourceRow.cells[lastDestCellIndex].style.width;
26229  } else {
26230   var cellWidths = ASPx.Data.CollectionToArray(sourceRow.cells)
26231    .slice(lastDestCellIndex)
26232    .map(function(cell) { return ASPx.PxToInt(cell.style.width); })
26233    .reduce(function(accumulator, current) { return accumulator + current; }, 0);
26234   destRow.cells[lastDestCellIndex].style.width = cellWidths + "px";
26235  }
26236  if(this.NeedToHandleCellWidth())
26237   this.CorrectCellNullWidthStyle(destRow);
26238 },
26239 RemoveItem: function (index) {
26240  var firstRenderedItem = this.itemsManager.GetFirstRenderedItem();
26241  if (firstRenderedItem && index == firstRenderedItem.index && this.GetItemRow(firstRenderedItem.index + 1) !== null)
26242   this.CorrectCellWidthsOnFirstRowItemReplacement(firstRenderedItem.index, firstRenderedItem.index + 1);
26243  if (0 <= index && index < this.GetItemCount()) {
26244   this.UpdateSyncArraysItemDeleted(this.GetItem(index), true);
26245   this.itemsManager.RemoveItem(index);
26246   this.OnItemRemoved(index);
26247  }
26248 },
26249 GetItem: function(index, preventEncodeText) {
26250  return this.itemsManager.GetItem(index, preventEncodeText);
26251 },
26252 GetItemRowTexts: function(row) {
26253  var serializedTexts = this.GetTextsDataAttribute(row);
26254  if(ASPx.IsExists(serializedTexts))
26255   return JSON.parse(serializedTexts);
26256  var texts = [];
26257  var i = this.GetItemFirstTextCellIndex();
26258  var cellsLength = this.IsMultiColumn() ? row.cells.length : i + 1;
26259  for(; i < cellsLength; i++) {
26260   var textCell = row.cells[i];
26261   texts.push(ASPxClientListBox.GetItemCellInnerText(textCell));
26262  }
26263  return texts;
26264 },
26265 ItemRowHasTemplate: function(itemIndex) {
26266  var itemRow = this.GetItemRow(itemIndex);
26267  return itemRow ? this.ItemRowHasTemplateCore(itemRow) : false;
26268 },
26269 ItemRowHasTemplateCore: function(itemRow) {
26270  return this.ItemRowHasSerializedTextsAttr(itemRow);
26271 },
26272 ItemRowHasSerializedTextsAttr: function(itemRow) {
26273  return ASPx.Attr.IsExistsAttribute(itemRow, itemSerializedTextsAttributeName);
26274 },
26275 ItemCellHasTextAttr: function(itemTextCell) {
26276  return ASPx.Attr.IsExistsAttribute(itemTextCell, itemCellTextAttributeName);
26277 },
26278 GetFirstVisibleItem: function() {
26279  return this.itemsManager.GetFirstVisibleItem();
26280 },
26281 GetFirstFilteredItemIndex: function () {
26282  return this.itemsManager.GetFirstFilteredItemIndex();
26283 },
26284 GetLastFilteredItemIndex: function() {
26285  return this.itemsManager.GetLastFilteredItemIndex();
26286 },
26287 GetNextFilteredItemIndex: function(currentFilteredItemIndex) {
26288  return this.itemsManager.GetNextFilteredItemIndex(currentFilteredItemIndex);
26289 },
26290 GetPrevFilteredItemIndex: function(currentFilteredItemIndex) {
26291  return this.itemsManager.GetPrevFilteredItemIndex(currentFilteredItemIndex);
26292 },
26293 PerformCallback: function(arg, onSuccess) {
26294  this.SetScrollSpacerVisibility(true, false);
26295  this.SetScrollSpacerVisibility(false, false);
26296  this.ClearItemsForPerformCallback();
26297  this.serverIndexOfFirstItem = 0;
26298  this.SetScrollSpacerVisibility(true, false);
26299  this.SetScrollSpacerVisibility(false, false);
26300  this.FormatAndSetCustomCallbackArg(arg, true);
26301  this.SendCallback(onSuccess);
26302  this.FormatAndSetCustomCallbackArg(arg, false);
26303 },
26304 GetTableRowParent: function(table){
26305  if(table.tBodies.length > 0)
26306   return table.tBodies[0];
26307  return table;
26308 },
26309 ProtectWhitespaceSerieses: function(text){
26310  if(text == "") 
26311   text = nbsp;
26312  else {
26313   if(text.charAt(0) == ' ')
26314    text = nbsp + text.slice(1);
26315   if(text.charAt(text.length - 1) == ' ')
26316    text = text.slice(0, -1) + nbsp;
26317   text = text.replace(new RegExp("  ", "g"), " &nbsp;");
26318  }
26319  return text;
26320 }, 
26321 InsertItemInternal: function(index, itemProperties) {
26322  if(!this.hasSampleItem) 
26323   return;
26324  this.AdjustItemProperties(itemProperties);
26325  ASPx.Data.ArrayInsert(this.itemsValue, itemProperties.value, index);
26326  this.itemsManager.InsertItem(index, itemProperties);
26327  this.RegisterInsertedItem(index, itemProperties);
26328  this.OnItemInserted(index);
26329 },
26330 GetListTableRowBeforeNewItemRow: function (newItemIndex, listTable) {
26331  var lastRenderedItem = this.itemsManager.GetLastRenderedItem();
26332  if (!lastRenderedItem || lastRenderedItem.index < newItemIndex) {
26333   var lastItemRow = lastRenderedItem ? this.GetItemRow(lastRenderedItem.index) : null;
26334   var lastListTableRow = listTable.rows[listTable.rows.length - 1];
26335   if (lastItemRow)
26336    return lastItemRow === lastListTableRow ? null : lastItemRow.nextSibling;
26337   if (!!this.GetAccessibilityHeaderRow())
26338    return this.ContainsFixWidthRow() ? listTable.rows[1] : listTable.rows[0];
26339   return null;
26340  }
26341  for (var i = 0; i < listTable.rows.length; i++)
26342   if (this.GetItemIndexByRow(listTable.rows[i]) >= newItemIndex)
26343    return listTable.rows[i];
26344  return null;
26345 },
26346 AdjustItemProperties: function(itemProperties) {
26347  if(!itemProperties.texts || itemProperties.texts.length == 0)
26348   itemProperties.texts = [""];
26349  else if(typeof (itemProperties.texts) === "string")
26350   itemProperties.texts = [itemProperties.texts];
26351  if(typeof (itemProperties.value) === "undefined")
26352   itemProperties.value = itemProperties.texts[0];
26353  if(!ASPx.IsExists(itemProperties.imageUrl) || itemProperties.imageUrl === "")
26354   itemProperties.imageUrl = this.defaultImageUrl;
26355 },
26356 AddStateControllerClasses: function(itemId){
26357  var itemCellsIdPostfixes = this.GetItemCellsIdPostfixes();
26358  var sampleItemFirstTextCell = this.GetSampleItemFirstTextCell();
26359  var styleController = ASPx.GetStateController();
26360  var hoverStyleClasses = this.CreateStyleClasses(itemId, itemCellsIdPostfixes, 
26361      styleController.GetHoverElement(sampleItemFirstTextCell), ASPx.HoverItemKind);
26362  var selectedStyleClasses = this.CreateStyleClasses(itemId, itemCellsIdPostfixes, 
26363      styleController.GetSelectedElement(sampleItemFirstTextCell), ASPx.SelectedItemKind);
26364  var disabledStyleClasses = this.CreateStyleClasses(itemId, itemCellsIdPostfixes, 
26365      styleController.GetDisabledElement(sampleItemFirstTextCell), ASPx.DisabledItemKind);
26366    ASPx.AddHoverItems(this.name, hoverStyleClasses, true);
26367    ASPx.AddSelectedItems(this.name, selectedStyleClasses, true);
26368    ASPx.AddDisabledItems(this.name, disabledStyleClasses, true);
26369  ASPx.Attr.RemoveAttribute(sampleItemFirstTextCell, ASPx.CachedStatePrefix + ASPx.HoverItemKind);
26370  ASPx.Attr.RemoveAttribute(sampleItemFirstTextCell, ASPx.CachedStatePrefix + ASPx.SelectedItemKind);
26371  ASPx.Attr.RemoveAttribute(sampleItemFirstTextCell, ASPx.CachedStatePrefix + ASPx.DisabledItemKind);
26372 },
26373 RemoveStateControllerClasses: function(itemId){
26374  var itemCellsIdPostfixes = this.GetItemCellsIdPostfixes();
26375  var classes = [];
26376  classes[0] = [];
26377  classes[0][0] = [itemId];
26378  classes[0][1] = itemCellsIdPostfixes;
26379    ASPx.RemoveHoverItems(this.name, classes);
26380    ASPx.RemoveSelectedItems(this.name, classes);
26381    ASPx.RemoveDisabledItems(this.name, classes);
26382 },
26383 GetCellInfo: function(index, infoArray) {
26384  if(!infoArray) return null;
26385  var filteredArray = infoArray.filter(function(info) { return info.index === index; });
26386  return filteredArray.length ? filteredArray[0].value : null;
26387 },
26388 PrepareItem: function(newItemRow, itemProperties) {
26389  var i = 0;
26390  if(this.GetIsCheckColumnExists())
26391   i++;
26392  if(this.imageCellExists) {
26393   this.PrepareItemImage(newItemRow, i, itemProperties.imageUrl);
26394   i++;
26395  }
26396  if(itemProperties.htmlContent) {
26397   this.SetItemHtmlContent(newItemRow, itemProperties.htmlContent);
26398   this.SetTextsDataAttribute(newItemRow, itemProperties.texts);
26399  } else {
26400   this.SetItemTextContent(i, newItemRow, itemProperties);
26401  }
26402  this.AssignDecorationSettingsToElement(newItemRow, itemProperties.style, itemProperties.cssClass, itemProperties.tooltip, itemProperties.attributes);
26403 },
26404 LockRunStartupSciptsInItemRow: function() {
26405  this.lockRunStartupScipts = true;
26406 },
26407 UnlockRunStartupSciptsInItemRow: function() {
26408  this.lockRunStartupScipts = false;
26409 },
26410 IsRunStartupSciptsInItemRowLocked: function() {
26411  return this.lockRunStartupScipts;
26412 },
26413 EnsureStartupScriptsInContainer: function(container) {
26414  if(!this.InCallback() && !this.IsRunStartupSciptsInItemRowLocked())
26415   ASPx.RunStartupScripts(false, container);
26416 },
26417 SetItemHtml: function(index, html) {
26418  this.hasDecoratedItems = true;
26419  this.hasItemTemplate = true;
26420  this.EnsureFixWidthRow(true);
26421  this.itemsManager.SetItemHtml(index, html);
26422  this.ProcessItemRow(index, function(itemRow) {
26423   if(!this.ItemRowHasSerializedTextsAttr(itemRow))
26424    this.SetTextsDataAttribute(itemRow, this.GetItem(index).texts);
26425   this.SetItemHtmlContent(itemRow, html);
26426   this.itemsManager.OnDecoratedItemsRendering();
26427  }.bind(this));
26428 },
26429 SetTextsDataAttribute: function(itemRow, texts) { ASPx.Attr.SetAttribute(itemRow, itemSerializedTextsAttributeName, JSON.stringify(texts)); },
26430 GetTextsDataAttribute: function(itemRow) { return ASPx.Attr.GetAttribute(itemRow, itemSerializedTextsAttributeName); },
26431 SetItemTooltip: function(index, tooltip) {
26432  this.itemsManager.SetItemTooltip(index, tooltip);
26433  this.ProcessItemRow(index, function(itemRow) { this.SetElementTooltip(itemRow, tooltip); }.aspxBind(this));
26434 },
26435 SetItemAttribute: function(index, attributeName, attributeValue) {
26436  this.itemsManager.SetItemAttribute(index, attributeName, attributeValue);
26437  this.ProcessItemRow(index, function(itemRow) { ASPx.Attr.SetAttribute(itemRow, attributeName, attributeValue); }.aspxBind(this));
26438 },
26439 AddItemCssClass: function(index, className) {
26440  this.hasDecoratedItems = true;
26441  this.itemsManager.AddItemCssClass(index, className);
26442  this.ProcessItemRow(index, function(itemRow) {
26443   ASPx.AddClassNameToElement(itemRow, className);
26444   this.itemsManager.OnDecoratedItemsRendering();
26445  }.bind(this));
26446 },
26447 RemoveItemCssClass: function(index, className) {
26448  this.hasDecoratedItems = true;
26449  this.itemsManager.RemoveItemCssClass(index, className);
26450  this.ProcessItemRow(index, function(itemRow) {
26451   ASPx.RemoveClassNameFromElement(itemRow, className);
26452   this.itemsManager.OnDecoratedItemsRendering();
26453  }.bind(this));
26454 },
26455 SetItemTextCellHtml: function(itemIndex, textCellIndex, html) {
26456  this.hasDecoratedItems = true;
26457  this.itemsManager.SetItemTextCellHtml(itemIndex, textCellIndex, html);
26458  this.ProcessItemTextCell(itemIndex, textCellIndex, function(textCell) {
26459   if(!this.ItemCellHasTextAttr(textCell))
26460    this.SetItemCellTextDataAttribute(textCell, this.GetItem(itemIndex).texts[textCellIndex]);
26461   this.SetItemTextCellHtmlContent(textCell, html);
26462   this.itemsManager.OnDecoratedItemsRendering();
26463  }.aspxBind(this));
26464 },
26465 SetItemCellTextDataAttribute: function(textCell, text) {
26466  ASPx.Attr.SetAttribute(textCell, itemCellTextAttributeName, text);
26467 },
26468 SetItemTextCellTooltip: function(itemIndex, textCellIndex, tooltip) {
26469  this.itemsManager.SetItemTextCellTooltip(itemIndex, textCellIndex, tooltip);
26470  this.ProcessItemTextCell(itemIndex, textCellIndex, function(textCell) { this.SetElementTooltip(textCell, tooltip); }.aspxBind(this));
26471 },
26472 SetItemTextCellAttribute: function(itemIndex, textCellIndex, attributeName, attributeValue) {
26473  this.itemsManager.SetItemTextCellAttribute(itemIndex, textCellIndex, attributeName, attributeValue);
26474  this.ProcessItemTextCell(itemIndex, textCellIndex, function(textCell) { ASPx.Attr.SetAttribute(textCell, attributeName, attributeValue); }.aspxBind(this));
26475 },
26476 AddItemTextCellCssClass: function(itemIndex, textCellIndex, className) {
26477  this.hasDecoratedItems = true;
26478  this.itemsManager.AddItemTextCellCssClass(itemIndex, textCellIndex, className);
26479  this.ProcessItemTextCell(itemIndex, textCellIndex, function(textCell) {
26480   ASPx.AddClassNameToElement(textCell, className);
26481   this.itemsManager.OnDecoratedItemsRendering();
26482  }.bind(this));
26483 },
26484 RemoveItemTextCellCssClass: function(itemIndex, textCellIndex, className) {
26485  this.hasDecoratedItems = true;
26486  this.itemsManager.RemoveItemTextCellCssClass(itemIndex, textCellIndex, className);
26487  this.ProcessItemTextCell(itemIndex, textCellIndex, function(textCell) {
26488   ASPx.RemoveClassNameFromElement(textCell, className);
26489   this.itemsManager.OnDecoratedItemsRendering();
26490  }.bind(this));
26491 },
26492 ProcessItemRow: function(index, action) {
26493  var itemRow = this.GetItemRow(index);
26494  if(itemRow)
26495   action(itemRow);
26496 },
26497 ProcessItemTextCell: function(itemIndex, textCellIndex, action) {
26498  var itemTextCell = this.GetItemTextCell(itemIndex, textCellIndex);
26499  if(itemTextCell && !this.ItemRowHasTemplateCore(itemTextCell.parentNode))
26500   action(itemTextCell);
26501 },
26502 SetItemHtmlContent: function(itemRow, html) {
26503  var redundantCells = ASPx.Data.CollectionToArray(itemRow.cells)
26504   .slice(this.GetItemFirstTextCellIndex(), itemRow.cells.length - 1);
26505  redundantCells.forEach(function(cell) { itemRow.removeChild(cell); });
26506  var itemHtmlContainerCell = itemRow.cells[itemRow.cells.length - 1];
26507  ASPx.SetElementDisplay(itemHtmlContainerCell, this.GetVisibleColumnCount() !== 0);
26508  itemHtmlContainerCell.colSpan = Math.max(itemHtmlContainerCell.colSpan, this.GetVisibleColumnCount());
26509  if(this.IsMultiColumn()) {
26510   if(this.GetItemFirstTextCellIndex() === 0)
26511    ASPx.AddClassNameToElement(itemHtmlContainerCell, FIRST_CELL_MARKER_CSS_CLASS_NAME);
26512   ASPx.AddClassNameToElement(itemHtmlContainerCell, LAST_CELL_MARKER_CSS_CLASS_NAME);
26513  }
26514  itemHtmlContainerCell.style.width = "";
26515  itemHtmlContainerCell.innerHTML = html;
26516  this.RemoveEllipsisFromNode(itemHtmlContainerCell);
26517  this.EnsureStartupScriptsInContainer(itemHtmlContainerCell);
26518 },
26519 SetItemTextContent: function(textCellIndex, newItemRow, itemProperties) {
26520  var cellCount = this.GetItemCellCount();
26521  for(var j = 0; textCellIndex < cellCount; textCellIndex++, j++) {
26522   var cellStyle = this.GetCellInfo(j, itemProperties.cellStyles);
26523   var cellCssClass = this.GetCellInfo(j, itemProperties.cellCssClasses);
26524   var cellTooltip = this.GetCellInfo(j, itemProperties.cellTooltips);
26525   var cellAttributes = this.GetCellInfo(j, itemProperties.cellAttributes);
26526   var htmlContent = this.GetCellInfo(j, itemProperties.htmlContents);
26527   this.PrepareItemTextCell(newItemRow.cells[textCellIndex], itemProperties.texts[j], cellStyle, cellCssClass, cellTooltip, cellAttributes, htmlContent);
26528  }
26529 },
26530 SetItemTextCellHtmlContent: function(cell, html) {
26531  cell.innerHTML = html;
26532  this.RemoveEllipsisFromNode(cell);
26533  this.EnsureStartupScriptsInContainer(cell);
26534 },
26535 PrepareItemImage: function(newItemRow, imageCellIndex, imageUrl){
26536  var imageCell = newItemRow.cells[imageCellIndex];
26537  var image = ASPx.GetNodeByTagName(imageCell, "IMG", 0);
26538  if(!imageUrl) {
26539   if(image)
26540    ASPx.RemoveElement(image);
26541   imageCell.innerHTML = "&nbsp;";
26542  } else {
26543   if(!image) {
26544    image = document.createElement("IMG");
26545    imageCell.innerHTML = "";
26546    imageCell.appendChild(image);
26547   }
26548   ASPx.ImageUtils.SetImageSrc(image, imageUrl);
26549  }
26550 }, 
26551 PrepareItemTextCell: function(cell, text, style, cssClass, tooltip, attributes, htmlContent) {
26552  if(!ASPx.IsExists(text)) 
26553   text = "";
26554  if(this.encodeHtml)
26555   text = ASPx.Str.EncodeHtml(text);
26556  if(htmlContent) {
26557   this.SetItemTextCellHtmlContent(cell, htmlContent);
26558   this.SetItemCellTextDataAttribute(cell, this.ProtectWhitespaceSerieses(text));
26559  }
26560  else {
26561   cell.innerHTML = this.ProtectWhitespaceSerieses(text);
26562   if(this.enableEllipsis)
26563    ASPx.AddClassNameToElement(cell, ASPx.ELLIPSIS_MARKER_CLASS);
26564  }
26565  this.AssignDecorationSettingsToElement(cell, style, cssClass, tooltip, attributes);
26566  if(text == "")
26567   ASPx.Attr.SetAttribute(cell, "DXText", text);
26568 },
26569 AssignDecorationSettingsToElement: function(element, style, cssClass, tooltip, attributes) {
26570  if(cssClass)
26571   ASPx.AddClassNameToElement(element, cssClass);
26572  if(style) {
26573   var styleSheet = ASPx.GetCurrentStyleSheet();
26574   ASPx.AddClassNameToElement(element, ASPx.CreateImportantStyleRule(styleSheet, style));
26575  }
26576  if(tooltip)
26577   this.SetElementTooltip(element, tooltip);
26578  if(attributes)
26579   for(var key in attributes)
26580    if(attributes.hasOwnProperty(key))
26581     ASPx.Attr.SetAttribute(element, key, attributes[key]);
26582 },
26583 SetElementTooltip: function(element, tooltip) {
26584  this.RemoveEllipsisTooltip(element);
26585  ASPx.Attr.SetAttribute(element, "title", tooltip);
26586 },
26587 FormatText: function(texts, value) {
26588  if(typeof(texts) === "string")
26589   return texts;
26590  else if(!this.IsMultiColumn())
26591   return texts[0];
26592  else
26593   return this.FormatTextCore(texts, value);
26594 },
26595 FormatTextCore: function(texts, value) {
26596  var result = "";
26597  if(this.isComboBoxList) {
26598   if(this.nullValueItemDisplayText !== null && value === null)
26599    result = this.nullValueItemDisplayText;
26600   else
26601    result = ASPx.Formatter.Format(this.textFormatString, texts);
26602  } else
26603   result = texts.join("; ");
26604  return result;
26605 },
26606 OnItemInserted: function(index){
26607  this.GetItemSelectionHelper().OnItemInserted(index);
26608 },
26609 OnItemRemoved: function(index){
26610  this.GetItemSelectionHelper().OnItemRemoved(index);
26611 },
26612 CreateItemId: function(index){
26613  return lbIIdSuffix + index;
26614 },
26615 CreateItemClientId: function(index){
26616  return this.name + "_" + lbIIdSuffix + index;
26617 },
26618 CreateStyleClasses: function(id, postfixes, item, kind){
26619  var classes = [];
26620  if(item && item[kind]){
26621   classes[0] = [];
26622   classes[0][0] = item[kind].classNames;
26623   classes[0][1] = item[kind].cssTexts;
26624   classes[0][2] = [];
26625   classes[0][2][0] = id;
26626   classes[0][3] = postfixes;
26627  }
26628  return classes;
26629 },
26630 CorrectSizeByTimer: function(){
26631  if(this.APILockCount == 0 && this.IsDisplayed())
26632   window.setTimeout(function() { this.OnCorrectSizeByTimer(); }.aspxBind(this), 0);
26633 },
26634 FindFreeIndex: function(){
26635  return this.freeUniqIndex ++;
26636 },
26637 GetSampleItemRowID: function(){
26638  return this.name + "_" + lbSIIdSuffix;
26639 },
26640 GetAccessibilitySampleHeaderRowID: function() {
26641  return this.name + "_" + lbAIRTIdSuffix;
26642 },
26643 GetSampleItemRow: function(){
26644  if(this.SampleItem == null)
26645   this.SampleItem = ASPx.GetElementById(this.GetSampleItemRowID());
26646  return this.SampleItem;
26647 },
26648 GetAccessibilitySampleHeaderRow: function() {
26649  if(this.sampleHeaderRow == null)
26650   this.sampleHeaderRow = ASPx.GetElementById(this.GetAccessibilitySampleHeaderRowID());
26651  return this.sampleHeaderRow;
26652 },
26653 AddAccessibilityHeaderRow: function() {
26654  if(!this.HasAccessibilityHeaderRow()) return;
26655  var listTableBody = ASPx.GetChildByTagName(this.GetListTable(), "TBODY", 0);
26656  var headerRow = this.GetAccessibilitySampleHeaderRow().cloneNode(true);
26657  headerRow.id = this.GetAccessibilityHeaderRowID();
26658  listTableBody.appendChild(headerRow);
26659 },
26660 HasAccessibilityHeaderRow: function() {
26661  return this.accessibilityCompliant && this.IsMultiColumn();
26662 },
26663 GetAccessibilityHeaderRow: function() {
26664  return this.GetChildElement(lbAIRIdSuffix);
26665 },
26666 RemoveAccessibilityHeaderRow: function() {
26667  var headerRow = this.GetAccessibilityHeaderRow();
26668  if(headerRow)
26669   ASPx.RemoveElement(headerRow);
26670 },
26671 GetAccessibilityHeaderRowID: function() {
26672  return this.name + "_" + lbAIRIdSuffix;
26673 },
26674 GetSampleItemFirstTextCell: function(){
26675  if(!ASPx.IsExistsElement(this.sampleItemFirstTextCell)){
26676   var sampleItemRow = this.GetSampleItemRow();
26677   if(ASPx.IsExistsElement(sampleItemRow))
26678    this.sampleItemFirstTextCell = sampleItemRow.cells[this.imageCellExists ? 1 : 0];
26679  }
26680  return this.sampleItemFirstTextCell;
26681 },
26682 ChangeEnabledAttributes: function(enabled){
26683  this.ChangeListTableEvents(this.GetListTable(), ASPx.Attr.ChangeEventsMethod(enabled));
26684  var focusableElement = this.GetInputElement();
26685  if(focusableElement) {
26686   this.ChangeSpecialInputEnabledAttributes(focusableElement, ASPx.Attr.ChangeEventsMethod(enabled));
26687   if(this.accessibilityCompliant)
26688    this.ChangeFocusableElementTabIndex(focusableElement, enabled);
26689   else if(!this.isComboBoxList) {
26690    var changeMethod = enabled ? ASPx.Attr.RestoreTabIndexAttribute : ASPx.Attr.SaveTabIndexAttributeAndReset;
26691    changeMethod(focusableElement);
26692   }
26693  }
26694 },
26695 ChangeFocusableElementTabIndex: function(focusableElement, enabled) {
26696  if(!this.isComboBoxList) {
26697   if(enabled)
26698    ASPx.Attr.SetAttribute(focusableElement, "tabindex", "0");
26699   else
26700    focusableElement.removeAttribute("tabindex");
26701  }
26702 },
26703 ChangeEnabledStateItems: function(enabled){
26704  var controller = ASPx.GetStateController();
26705  controller.SetElementEnabled(this.GetMainElement(), enabled);
26706  var count = this.GetItemCount();
26707  var i = this.hasSampleItem ? -1 : 0 ;
26708  for(; i < count; i ++){
26709   this.ChangeEnabledStateItem(i, enabled, controller);
26710  }
26711  this.changeSelectAllElementsEnabledState(enabled);
26712  var changeEventMethod = ASPx.Attr.ChangeEventsMethod(enabled);
26713  if(this.filteringTextBox && !this.customFilteringEditorID) {
26714   this.filteringTextBox.SetEnabled(enabled);
26715   this.ChangeSpecialInputEnabledAttributes(this.filteringTextBox.GetInputElement(), changeEventMethod, true);
26716  }
26717  if(this.showFilterButton) {
26718   this.showFilterButton.SetEnabled(enabled);
26719   this.ChangeSpecialInputEnabledAttributes(this.showFilterButton.GetInternalButton(), changeEventMethod, true);
26720  }
26721 },
26722 ChangeEnabledStateItem: function (index, enabled, controller) {
26723  var element = this.GetItemFirstTextCell(index);
26724  if (element)
26725   controller.SetElementEnabled(element, enabled);
26726  if (this.GetIsCheckColumnExists() && index >= 0)
26727   this.SetCheckBoxEnabled(index, enabled);
26728 },
26729 ChangeListTableEvents: function(listTable, method){
26730  if(this.isComboBoxList){
26731   method(listTable, "mouseup", aspxLBIClick);
26732   if(ASPx.Browser.Firefox)
26733    method(listTable, "mousedown", ASPx.Evt.PreventEvent); 
26734  }
26735  else{
26736   method(listTable, "click", aspxLBIClick);   
26737   method(listTable, "dblclick", aspxLBIClick); 
26738   if(this.MultiSelectionMode())
26739    this.AttachSelectStartHandlerToElement(listTable);
26740  }
26741 },
26742 AttachSelectStartHandlerToElement: function(element) {
26743  ASPx.Evt.AttachEventToElement(element, "selectstart", aspxLBTSelectStart);
26744 },
26745 IsValueChanged: function(){
26746  return this.cachedValue != this.GetValue();
26747 },
26748 OnItemSelectionChanged: function(index, selected, fromSelectAllClick, forceValueChanged){
26749  if(this.CheckColumnSelectionMode() && !fromSelectAllClick)
26750   this.SetCheckBoxChecked(index, selected);
26751  if(!this.IsSelectionEventsLocked()) {
26752   this.SetRaiseSelectedIndexChangedArguments(this.autoPostBack, index, selected);
26753   var valueChanged = this.IsValueChanged() || forceValueChanged;
26754   if(valueChanged) {
26755    this.RaisePersonalStandardValidation();
26756    this.OnValueChanged();
26757   } else {
26758    if(this.RaiseSelectedIndexChanged())
26759     this.SendPostBackInternal("");
26760   }
26761  }
26762  this.CacheValue();
26763  if(this.accessibilityCompliant && !fromSelectAllClick)
26764   this.GetAccessibilityHelper().OnSelectedIndexChanged(index);
26765 },
26766 SetRaiseSelectedIndexChangedArguments: function(processOnServer, index, selected){
26767  this.selectedIndexChangedArguments = {
26768   processOnServer: processOnServer,
26769   index: index,
26770   selected: selected
26771  };
26772 },
26773 GetRaiseSelectedIndexChangedArguments: function(){
26774  if(!this.selectedIndexChangedArguments)
26775   this.SetRaiseSelectedIndexChangedArguments(false, this.GetSelectedIndex(), true);
26776  return this.selectedIndexChangedArguments;
26777 },
26778 RaiseSelectedIndexChanged: function (processOnServer) {
26779  this.RaiseValidationInternal();
26780  var savedArgs = this.GetRaiseSelectedIndexChangedArguments();
26781  processOnServer = savedArgs.processOnServer || processOnServer;
26782  if(!this.SelectedIndexChanged.IsEmpty()){
26783   var args = new ASPxClientListEditItemSelectedChangedEventArgs(savedArgs.index, savedArgs.selected, processOnServer);
26784   this.SelectedIndexChanged.FireEvent(this, args);
26785   processOnServer = args.processOnServer;
26786  }
26787  return processOnServer;
26788 },
26789 RaiseItemFiltering: function(item, filter, isFit) {
26790  if(!this.ItemFiltering.IsEmpty()) {
26791   var args = new ASPxClientListEditItemFilteringEventArgs(item, filter, isFit);
26792   this.ItemFiltering.FireEvent(this, args);
26793   isFit = args.isFit;
26794  }
26795  return isFit;
26796 },
26797 RaiseCustomHighlighting: function(filter, callbackHighlighting) {
26798  if(!this.CustomHighlighting.IsEmpty()) {
26799   var args = new ASPxClientListEditCustomHighlightingEventArgs(filter);
26800   args.highlighting = callbackHighlighting;
26801   this.CustomHighlighting.FireEvent(this, args);
26802   return args.highlighting;
26803  }
26804  return callbackHighlighting;
26805 },
26806 SetWidth: function(width) {
26807  this.width = width + "px";
26808  this.GetScrollDivElement().style.width = "100%";
26809  ASPxClientListBoxBase.prototype.SetWidth.call(this, width);
26810 },
26811 SetHeight: function(height) {
26812  this.heightCorrected = false;
26813  ASPxClientListBoxBase.prototype.SetHeight.call(this, height);
26814  this.CorrectHeight();
26815 },
26816 OnAssociatedLabelClick: function(focusableElement) {
26817  var isValidElement = focusableElement && ASPx.IsActionElement(focusableElement) && ASPx.GetIsParent(this.GetMainElement(), focusableElement);
26818  if(isValidElement)
26819   focusableElement.focus();
26820  else
26821   ASPxClientListBoxBase.prototype.OnDelayedSpecialFocusMouseDown.call(this, null);
26822 },
26823 TryApplyHighlighting: function() {
26824  var ownerControl = this.GetCallbackOwnerControl();
26825  var filterStrategy = ownerControl && ownerControl.filterStrategy ? ownerControl.filterStrategy : this.filterStrategy;
26826  if(filterStrategy && filterStrategy.ApplyHighlighting)
26827   filterStrategy.ApplyHighlighting();
26828 },
26829 onDropDownModalChanged: function(enabled) {
26830  if(!this.IsMultiColumn())
26831   return;
26832  if(enabled && !this.itemsManager.GetFirstVisibleItemRow())
26833   return;
26834  this.updateCellWidthsOnDropDownChanged(enabled);
26835 },
26836 updateCellWidthsOnDropDownChanged: function(enabled) {
26837  var applyFunction = this.getUpdateCellWidthsFunctionOnDropDownChanged(enabled);
26838  var sampleRow = this.GetSampleItemRow();
26839  var headerRow = this.GetHeaderTableElement().rows[0];
26840  var dataRows = this.itemsManager.GetListTableRows();
26841  for(var i = this.columnFieldNames.length - 1; i >= 0; i--) {
26842   applyFunction(sampleRow, i);
26843   applyFunction(headerRow, i);
26844   for(var row, j = 0; row = dataRows[j]; j++)
26845    applyFunction(row, i);
26846  }
26847 },
26848 getUpdateCellWidthsFunctionOnDropDownChanged: function(enabled) {
26849  if(enabled) {
26850   var row = this.itemsManager.GetFirstVisibleItemRow();
26851   var widths = Array.prototype.slice.call(row.cells, 0).map(function(cell) { return cell.offsetWidth; });
26852   var commonWidth = widths.reduce(function(a, b) { return a + b; }, 0);
26853   widths = widths.map(function(w) { return (w * 100) / commonWidth; });
26854   return function(row, cellIndex) {
26855    ASPx.Attr.ChangeStyleAttribute(row.cells[cellIndex], "width", widths[cellIndex] + "%");
26856   };
26857  }
26858  return function(row, cellIndex) {
26859   ASPx.Attr.RestoreStyleAttribute(row.cells[cellIndex], "width");
26860  };
26861 }
26862});
26863ASPxClientListBox.GetItemCellInnerText = function(itemTextCell) {
26864 var text;
26865 if(typeof(itemTextCell.attributes["DXText"]) != "undefined")
26866  text = ASPx.Attr.GetAttribute(itemTextCell, "DXText");
26867 else {
26868  var itemCellTextAttribute = ASPx.Attr.GetAttribute(itemTextCell, itemCellTextAttributeName);    
26869  text = ASPx.IsExists(itemCellTextAttribute) ? itemCellTextAttribute : ASPx.GetInnerText(itemTextCell);
26870 }
26871 text = text.replace(new RegExp(nbspChar, "g"), " ");
26872 return text;
26873};
26874var ASPxClientNativeListBox = ASPx.CreateClass(ASPxClientListBoxBase, {
26875 constructor: function(name) {
26876  this.constructor.prototype.constructor.call(this, name);
26877 },
26878 InitializeEvents: function() {
26879  ASPxClientListBoxBase.prototype.InitializeEvents.call(this);
26880  if(!!this.GetMainElement()) {
26881   ASPx.Evt.AttachEventToElement(this.GetMainElement(), "keydown", this.OnKeyDown.aspxBind(this));
26882   ASPx.Evt.AttachEventToElement(this.GetMainElement(), "keyup", this.OnKeyUp.aspxBind(this));
26883   ASPx.Evt.AttachEventToElement(this.GetMainElement(), "keypress", this.OnKeyPress.aspxBind(this));
26884  }
26885 },
26886 SetReadOnlyInternal: function(readOnly) {
26887  ASPxClientListBoxBase.prototype.SetReadOnlyInternal.call(this, readOnly);
26888  var options = this.GetMainElement().querySelectorAll("option");
26889  for (var i = 0, option; option = options[i]; i++) {
26890   if (readOnly)
26891    ASPx.Attr.SetAttribute(option, "disabled", "disabled");
26892   else
26893    ASPx.Attr.RemoveAttribute(option, "disabled");
26894  }
26895 }, 
26896 SetMainElement: function(mainElement){
26897  this.mainElement = mainElement;
26898 },
26899 FindInputElement: function(){
26900  return this.GetMainElement();
26901 }, 
26902 GetOptionCount: function(){
26903  return this.GetMainElement().options.length;
26904 },
26905 GetOption: function(index){
26906  return this.GetMainElement().options[index];
26907 },
26908 GetItemCount: function(){
26909  return this.GetOptionCount();
26910 },
26911 SelectIndexSilent: function(index){
26912  var selectedIndex = this.GetSelectedIndexInternal();
26913  var isValidIndex = (-1 <= index && index < this.GetItemCount());
26914  if((selectedIndex != index && isValidIndex) || !this.isInitialized){
26915   this.SetSelectedIndexInternal(index);
26916   return true;
26917  }
26918  return false;
26919 },
26920 GetSelectedIndexInternal: function(){
26921  return this.GetMainElement().selectedIndex; 
26922 },
26923 SetSelectedIndexInternal: function(index){
26924  this.GetMainElement().selectedIndex = index; 
26925 },
26926 ClearItemsCore: function(){
26927  this.GetMainElement().innerHTML = "";
26928 },
26929 RemoveItem: function(index){
26930  if(0 <= index && index < this.GetItemCount()){
26931   var oldSelectedIndex = this.GetSelectedIndexInternal();
26932   this.UpdateSyncArraysItemDeleted(this.GetItem(index), true);
26933   var option = this.GetOption(index);
26934   this.GetMainElement().removeChild(option);
26935   this.UpdateOptionValues();
26936   this.OnItemRemoved(oldSelectedIndex, index);
26937  }
26938 },
26939 OnItemRemoved: function(oldSelectedIndex, newSelectedIndex){
26940  if(newSelectedIndex == oldSelectedIndex && !this.MultiSelectionMode())
26941   this.SetSelectedIndexInternal(-1);
26942 },
26943 MultiSelectionMode: function(){
26944  return this.GetMainElement().multiple;
26945 },
26946 GetItem: function(index){
26947  if(0 <= index && index < this.GetOptionCount()) {
26948   var text = this.GetOption(index).text;
26949   var selected = this.GetMainElement().options[index].selected;
26950   var itemValue = this.itemsValue[index] !== undefined ? this.itemsValue[index] : null;
26951   if(ASPx.IsExists(text))
26952    return new ASPxClientListBoxItem(this, index, text, itemValue, "", selected);
26953  }
26954  return null;
26955 },
26956 PerformCallback: function(arg) {
26957  this.ClearItemsForPerformCallback();
26958  this.FormatAndSetCustomCallbackArg(arg, true);
26959  this.SendCallback();
26960  this.FormatAndSetCustomCallbackArg(arg, false);
26961 },
26962 SendCallback: function(){
26963  if(!this.InCallback()){
26964   var callbackOwner = this.GetCallbackOwnerControl();
26965   if(callbackOwner != null)
26966    callbackOwner.SendCallback();
26967    else {
26968    var argument = this.GetCallbackArguments();
26969    this.CreateCallback(argument);
26970   }
26971  }
26972 },
26973 ParseCallbackResult: function(result){
26974  var deserializedItems = this.DeserializeItems(result[CONSTANTS.CALLBACK_RESULTS.ITEMS]);
26975  this.LoadItemsFromCallback(true, deserializedItems);
26976 },
26977 InsertItemInternal: function(index, itemProperties) {
26978  if(typeof (itemProperties.value) == "undefined")
26979   itemProperties.value = itemProperties.texts;
26980  var oldSelectedIndex = this.GetSelectedIndexInternal();
26981  var isAdd = this.GetOptionCount() <= index;
26982  var newOption = document.createElement("OPTION");
26983  if(isAdd)
26984   this.GetMainElement().appendChild(newOption);
26985  else
26986   this.GetMainElement().insertBefore(newOption, this.GetOption(index));
26987  newOption.innerHTML = itemProperties.texts;
26988  this.UpdateOptionValues();
26989  ASPx.Data.ArrayInsert(this.itemsValue, itemProperties.value, index);
26990  this.RegisterInsertedItem(index, itemProperties); 
26991  if(index == oldSelectedIndex && index != -1)
26992   this.SetSelectedIndex(index + 1);
26993 },
26994 UpdateOptionValues: function() {
26995  if(this.APILockCount == 0){
26996   for(var i = 0; i < this.GetOptionCount(); i++)
26997    this.GetOption(i).value = i;
26998  }
26999 },
27000 ChangeEnabledAttributes: function(enabled){
27001  if(!this.isComboBoxList) {
27002   this.GetMainElement().disabled = !enabled;
27003   this.ChangeSpecialInputEnabledAttributes(this.GetMainElement(), ASPx.Attr.ChangeEventsMethod(enabled), true);
27004  }
27005 },
27006 OnCallback: function(result) {
27007  this.ParseCallbackResult(result);
27008 },
27009 OnItemDblClick: function(){
27010  this.RaiseItemDoubleClick();
27011 },
27012 LoadItemsFromCallback: function(isToTop, deserializedItems){
27013  this.BeginUpdate();
27014  this.LockSynchronizationOnInternalCallback();
27015  var mainElement = this.GetMainElement();
27016  for(var i = deserializedItems.length - 1; i >= 0; i--) {
27017   this.InsertItemInternal(0, deserializedItems[i]);
27018   if(deserializedItems[i].selected)
27019    mainElement.options[0].selected = true;
27020  }
27021  this.UnlockSynchronizationOnInternalCallback();
27022  this.EndUpdate();
27023 },
27024 EndUpdate: function(){
27025  ASPxClientListBoxBase.prototype.EndUpdate.call(this);
27026  this.UpdateOptionValues();
27027 },
27028 GetSelectedIndices: function(){
27029  var selectedIndices = [];
27030  var mainElement = this.GetMainElement();
27031  for(var i = 0; i < mainElement.options.length; i++){
27032   if(mainElement.options[i].selected)
27033    selectedIndices.push(i);
27034  }
27035  return selectedIndices;
27036 },
27037 GetSelectedValues: function(){ 
27038  var selectedValues = [];
27039  var selectedIndices = this.GetSelectedIndices();
27040  for(var i = 0; i < selectedIndices.length; i++)
27041   selectedValues.push(this.GetItemValue(selectedIndices[i]));
27042  return selectedValues;
27043 },
27044 GetSelectedItems: function(){
27045  var selectedItems = [];
27046  var selectedIndices = this.GetSelectedIndices();
27047  for(var i = 0; i < selectedIndices.length; i++)
27048   selectedItems.push(this.GetItem(selectedIndices[i]));
27049  return selectedItems;
27050 },
27051 SelectAll: function(){
27052  this.SetAllItemsSelectedValue(true);
27053 },
27054 UnselectAll: function(){
27055  this.SetAllItemsSelectedValue(false);
27056 },
27057 SetAllItemsSelectedValue: function(selected){
27058  var mainElement = this.GetMainElement();
27059  for(var i = 0; i < mainElement.options.length; i++)
27060   mainElement.options[i].selected = selected;
27061 },
27062 SelectIndices: function(indices){
27063  this.SetIndicesSelectionState(indices, true);
27064 },
27065 UnselectIndices: function(indices){
27066  this.SetIndicesSelectionState(indices, false);
27067 },
27068 SetIndicesSelectionState: function(indices, selected){
27069  var mainElement = this.GetMainElement();
27070  for(var i = 0; i < indices.length; i++){
27071   mainElement.options[indices[i]].selected = selected;
27072  }
27073 },
27074 SelectItems: function(items){
27075  if(ASPx.IsExists(items))
27076   this.SetItemsSelectionState(items, true);
27077  else
27078   this.SelectAll();
27079 },
27080 UnselectItems: function(items){
27081  if(ASPx.IsExists(items))
27082   this.SetItemsSelectionState(items, false);
27083  else
27084   this.UnselectAll();
27085 },
27086 SetItemsSelectionState: function(items, selected){
27087  var mainElement = this.GetMainElement();
27088  for(var i = 0; i < items.length; i++){
27089   mainElement.options[items[i].index].selected = selected;
27090  }
27091 },
27092 SelectValues: function(values){
27093  this.SetValuesSelectedState(values, true);
27094 },
27095 UnselectValues: function(values){
27096  this.SetValuesSelectedState(values, false);
27097 },
27098 SetValuesSelectedState: function(values, selected){
27099  var mainElement = this.GetMainElement();
27100  var index;
27101  for(var i = 0; i < values.length; i++){
27102   index = this.FindItemIndexByValue(values[i]);
27103   mainElement.options[index].selected = selected;
27104  }
27105 },
27106 EnsureRequiredNativeAttributesExists: function() {
27107  var input = this.GetInputElement();
27108  if(!input.onchange)
27109   ASPx.Evt.AttachEventToElement(input, "change", function() { ASPx.EValueChanged(this.name); }.aspxBind(this));
27110 }
27111});
27112var AccessibilityHelperListBox = ASPx.CreateClass(ASPx.AccessibilityHelper, {
27113 constructor: function(listBox) {
27114  this.constructor.prototype.constructor.call(this, listBox);
27115  this.checkBoxRefocusTimeout = 1000;
27116  this.firstReadingColumnIndex = this.control.CheckColumnSelectionMode() ? 1 : 0;
27117  this.Initialize();
27118 },
27119 Initialize: function() {
27120  if(this.control.CheckColumnSelectionMode() && !this.control.IsNativeCheckBoxes())
27121   this.control.GotFocus.AddHandler(function() { this.SetActionElementFocus(); }.aspxBind(this));
27122  this.control.GotFocus.AddHandler(function() { this.OnSelectedIndexChanged(this.control.GetSelectedIndex()); }.aspxBind(this));
27123  this.control.LostFocus.AddHandler(function() { 
27124   setTimeout(function() { 
27125    this.changeActivityAttributes(this.getMainElement(), { "aria-activedescendant": "" }); 
27126   }.aspxBind(this), 200); 
27127  }.aspxBind(this));
27128 },
27129 OnSelectedIndexChanged: function(index) {
27130  var stateSelected = index != -1 && this.control.GetItem(index) && this.control.GetItem(index).selected;
27131  var selectedIndex = this.control.GetSelectedIndex();
27132  if(this.control.CheckColumnSelectionMode() || stateSelected || selectedIndex == -1)
27133   this.setSelectionAttributes(index, stateSelected);
27134 },
27135 getPronounceTimeout: function() {
27136  if(ASPx.Browser.WebKitFamily && this.control.CheckColumnSelectionMode())
27137   return 1000;
27138  return ASPx.AccessibilityHelper.prototype.getPronounceTimeout.call(this);
27139 },
27140 getHeaderCellCaptionText: function(index) {
27141  var headerDiv = this.control.GetHeaderDivElement();
27142  if(!headerDiv) return "";
27143  var headerTable = headerDiv.firstElementChild;
27144  return headerTable.rows[0].cells[this.firstReadingColumnIndex + index].textContent;
27145 },
27146 isItemCheckBoxFocused: function() {
27147  for(var i = 0; i < this.control.GetItemCount() ; i++) {
27148   var internalCheckBox = this.control.GetInternalCheckBox(i);
27149   if(internalCheckBox && internalCheckBox.focused)
27150    return true;
27151  }
27152  return false;
27153 },
27154 isSelectAllCheckBoxFocused: function() {
27155  return this.control.selectAllCheckBox && this.control.selectAllCheckBox.focused;
27156 },
27157 SetActionElementFocus: function() {
27158  if(this.control.enableFiltering) {
27159   if(!this.control.HasInternalFilteringTextBoxFocus())
27160    this.SetFilterPanelFocus();
27161  }
27162  else
27163   this.SetCheckBoxFocus();
27164 },
27165 SetCheckBoxFocus: function () {
27166  var isCheckBoxFocused = this.isItemCheckBoxFocused() || this.isSelectAllCheckBoxFocused();
27167  if(!isCheckBoxFocused)
27168   this.ProcessRefocusHandler(function() {
27169    this.control.SetFocusedIndex(0);
27170   }.aspxBind(this));
27171 },
27172 SetFilterPanelFocus: function() {
27173  if(this.control.customFilteringEditorID || ASPx.ElementHasCssClass(this.control.filterMainElement, this.control.GetInactiveFilterElementClassName())) {
27174   if(this.control.showFilterButton)
27175    this.ProcessRefocusHandler(function() {
27176     this.control.showFilterButton.Focus(); 
27177    }.aspxBind(this));
27178  } else 
27179    this.ProcessRefocusHandler(function() {
27180     ASPx.FindFirstChildActionElement(this.control.filterMainElement).focus(); 
27181    }.aspxBind(this));
27182 },
27183 ProcessRefocusHandler: function(handler) {
27184   setTimeout(function() {
27185   if(!this.control.focused) return;
27186   handler();
27187  }.aspxBind(this), this.checkBoxRefocusTimeout);
27188 },
27189 getTextForScreenReader: function(item) {
27190  var result = "";
27191  if(!this.control.IsMultiColumn()) {
27192   result= item.text;
27193  } else {
27194   var columnsCount = this.control.columnFieldNames.length;
27195   var formatString = ASPx.AccessibilitySR.TableItemFormatString;
27196   for(var i = 0; i < columnsCount; i++)
27197    result += ASPx.Str.ApplyReplacement(formatString, [["{0}", this.getHeaderCellCaptionText(i)], ["{1}", item.texts[i]]]);
27198  }
27199  return result;
27200 },
27201 setSelectionAttributes: function(index, stateSelected) {
27202  if(index == -1) index = 0;
27203  var item = this.control.GetItem(index);
27204  if(!item) return;
27205  var assistText = this.getTextForScreenReader(item);
27206  var activeItemArgs = {
27207   "role"    : "option",
27208   "aria-posinset" : index + 1,
27209   "aria-setsize"  : this.control.itemTotalCount,
27210   "aria-selected" : stateSelected
27211  };
27212  var inactiveItemArgs = {
27213   "role"    : "",
27214   "aria-posinset" : "",
27215   "aria-setsize"  : "",
27216   "aria-selected" : ""
27217  };
27218  this.PronounceMessage(assistText, activeItemArgs, inactiveItemArgs);
27219 },
27220 SetCheckBoxesValidationAttributes: function() {
27221  if(!this.control.CheckColumnSelectionMode() || !this.control.GetErrorCell()) return;
27222  var errorTextElement = this.control.ariaExplanatoryTextManager.GetErrorTextElement();
27223  for (var i = 0; i < this.control.GetItemCount() ; i++) {
27224   var checkBoxFocusableElement = this.control.GetCheckBoxFocusableElement(i);
27225   if(checkBoxFocusableElement) {
27226    ASPx.Attr.SetOrRemoveAttribute(checkBoxFocusableElement, "aria-describedby", !this.control.isValid ? errorTextElement.id : null);
27227    ASPx.Attr.SetOrRemoveAttribute(checkBoxFocusableElement, "aria-invalid", !this.control.isValid);
27228   }
27229  }
27230 }
27231});
27232ASPxClientListBox.Cast = ASPxClientControl.Cast;
27233var ASPxClientCheckListBase = ASPx.CreateClass(ASPxClientListEdit, {
27234 constructor: function(name) {
27235  this.constructor.prototype.constructor.call(this, name);          
27236  this.imageProperties = null;
27237  this.internalButtonCollection = null; 
27238  this.icbFocusedStyle = [];
27239  this.items = [];
27240 },
27241 SetData: function(data){
27242  ASPxClientEdit.prototype.SetData.call(this, data);
27243  if(data.items)
27244   this.CreateItems(data.items);
27245 },
27246 Initialize: function() {
27247  ASPxClientListEdit.prototype.Initialize.call(this);
27248  this.UpdateInternalSelectedIndex(); 
27249 },
27250 UpdateInternalSelectedIndex: function() {
27251  var selectedIndexFromServer = this.GetSelectedIndex();
27252  var stateInput = this.FindStateInputElement();
27253  if(stateInput) {
27254   var restoredSelectedIndex = stateInput.value;
27255   if(restoredSelectedIndex != '' && restoredSelectedIndex != selectedIndexFromServer) {
27256    this.SetSelectedIndex(selectedIndexFromServer);
27257    this.SetSelectedIndex(restoredSelectedIndex);
27258   }
27259  }
27260 },
27261 CreateButtonInternalCollection: function() { 
27262  this.internalButtonCollection = this.CreateCheckBoxInternalCollection();
27263  for(var i = 0; i < this.GetItemCount(); i++) {
27264   var icbInputElement = this.GetItemInput(i);
27265   var internalButton = this.internalButtonCollection.Add(icbInputElement.id, icbInputElement, this.GetItemElement(i));
27266   internalButton.CreateFocusDecoration(this.icbFocusedStyle);
27267   internalButton.SetEnabled(this.GetEnabled());
27268   internalButton.GetReadOnly = this.GetReadOnly.bind(this);
27269   internalButton.CheckedChanged.AddHandler(function(s, e) {
27270    this.OnItemClick(this.GetItemIndexByElement(ASPx.Evt.GetEventSource(e)));
27271   }.aspxBind(this));
27272   internalButton.Focus.AddHandler(function(s, e) {
27273    if(!this.focused)
27274     this.OnFocus();
27275   }.bind(this));
27276   internalButton.LostFocus.AddHandler(function(s, e) { this.OnLostFocus(); }.aspxBind(this));
27277   this.attachToCellsClick(i);
27278   this.PrepareInternalButton(internalButton, i);
27279  }
27280  this.attachToMainElementMouseDown();
27281 },
27282 CreateCheckBoxInternalCollection: function () {
27283  return new ASPx.CheckBoxInternalCollection(this.imageProperties, false, true, ASPx.CheckEditElementHelper.Instance, undefined,
27284   this.accessibilityCompliant);
27285 },
27286 CheckableElementsExist: function() {
27287  return !!this.imageProperties;
27288 },
27289 SetEnabled: function(enabled){
27290  ASPxClientListEdit.prototype.SetEnabled.call(this, enabled);
27291  var stateInput = this.FindStateInputElement();
27292  if(enabled)
27293   ASPx.Attr.RemoveAttribute(stateInput, "disabled");
27294  else
27295   ASPx.Attr.SetAttribute(stateInput, "disabled", "disabled");
27296 },
27297 SetFocus: function() {
27298  this.UpdateFocus(); 
27299 },
27300 UpdateFocus: function() {
27301 },
27302 IsElementBelongToInputElement: function(element) {
27303  return this.GetItemIndexByElement(element) != -1;
27304 },
27305 attachToCellsClick: function(index) {
27306  var element = this.GetItemElement(index);
27307  ASPx.Evt.AttachEventToElement(element, "click", function(evt) {
27308   var src = ASPx.Evt.GetEventSource(evt);
27309   var label = ASPx.CheckEditElementHelper.Instance.GetLabelElement(element);
27310   var button = this.internalButtonCollection.Get(this.GetItemInput(index).id);
27311   if(!ASPx.GetIsParent(button.mainElement, src) && src !== label && src.parentElement !== label) {
27312    ASPx.CheckEditElementHelper.Instance.InvokeClick(button, evt);
27313   }
27314  }.aspxBind(this));
27315 },
27316 attachToMainElementMouseDown: function() {
27317  var mainElement = this.GetMainElement();
27318  ASPx.Evt.AttachEventToElement(mainElement, "mousedown", function() {
27319   if(!this.enabled || this.readOnly)
27320    return;
27321   this.LockFocusEvents();
27322   setTimeout(function() { this.UnlockFocusEvents(); }.aspxBind(this), 0);
27323  }.aspxBind(this));
27324 },
27325 GetItemIndexByElement: function(element) {
27326  for(var i = 0; i < this.GetItemCount(); i++) {
27327   var itemElement = this.GetItemElement(i);
27328   if(ASPx.GetIsParent(itemElement, element))
27329    return i;
27330  }
27331  return -1;  
27332 },
27333 GetItemInput: function(index) {
27334  return this.GetChildElement("RB" + index + "_I");
27335 },
27336 GetItemElement: function(index) {
27337  return this.GetChildElement("RB" + index);
27338 },
27339 GetItemFocusableElement: function(index) {
27340  return this.accessibilityCompliant ? this.GetChildElement("RB" + index + "_I_D") : this.GetItemInput(index);
27341 },
27342 GetAccessibilityActiveElements: function() {
27343  var accessibilityElements = [];
27344  for(var i = 0; i < this.GetItemCount(); i++) 
27345   accessibilityElements.push(this.GetItemFocusableElement(i));
27346  return accessibilityElements;
27347 },
27348 GetItemCount: function() {
27349  return this.items.length;
27350 },
27351 OnItemClick: function(index) {
27352 },
27353 OnItemClickReadonly: function() {
27354  var index = this.GetSelectedIndexInternal();
27355  this.SelectIndexSilent(index);
27356 },
27357 UpdateHiddenInputs: function(index) {
27358  var stateInput = this.FindStateInputElement();
27359  if(ASPx.IsExistsElement(stateInput))
27360   stateInput.value = index;
27361  var valueInput = this.GetValueInputElement();
27362  if(ASPx.IsExistsElement(valueInput)) {
27363   var value = this.GetValue();
27364   valueInput.value = ASPx.IsExists(value) ? value : " ";
27365  }
27366 },
27367 GetItemValue: function(index){
27368  if(index > -1 && index < this.items.length) {
27369   if(typeof(this.items[index].value) == "string" && this.items[index].value == "" && this.convertEmptyStringToNull)
27370    return null;
27371   else
27372    return this.items[index].value;
27373  }
27374  return null;
27375 },
27376 SetValue: function(value) {
27377  for(var i = 0; i < this.items.length; i++) {
27378   if(this.GetItemValue(i) == value) {   
27379    this.SelectIndexSilent(i);
27380    return;
27381   }
27382  } 
27383  this.SelectIndexSilent(-1);    
27384 },
27385 CreateItems: function(itemsProperties){
27386  for(var i = 0; i < itemsProperties.length; i++)
27387   this.CreateItem(i, {
27388    texts: itemsProperties[i][0],
27389    value: this.GetDecodeValue(itemsProperties[i][1]),
27390    imageUrl: itemsProperties[i][2]
27391   });
27392 },
27393 CreateItem: function(index, itemProperties){
27394  var item = new ASPxClientListEditItem(this, index, itemProperties.texts, itemProperties.value, itemProperties.imageUrl);
27395  this.items.push(item);
27396 },
27397 GetItem: function(index){
27398  return (0 <= index && index < this.items.length) ? this.items[index] : null;
27399 },
27400 ChangeEnabledAttributes: function(enabled){
27401  if(!this.CheckableElementsExist()) {
27402   for(var i = 0; i < this.GetItemCount(); i++){
27403    var element = this.GetItemInput(i);
27404    if(element){
27405     this.ChangeItemEnabledAttributes(element, ASPx.Attr.ChangeAttributesMethod(enabled));
27406     this.ChangeSpecialInputEnabledAttributes(element, ASPx.Attr.ChangeEventsMethod(enabled), true);
27407     element.disabled = !enabled;
27408    }
27409   }
27410  } else {
27411   var selectedIndex = this.GetSelectedIndexInternal();
27412   this.UpdateCheckableElementDecorations(selectedIndex, enabled);
27413  }
27414 },
27415 ChangeEnabledStateItems: function(enabled){
27416  ASPx.GetStateController().SetElementEnabled(this.GetMainElement(), enabled);
27417  if(this.isNative){
27418   for(var i = 0; i < this.GetItemCount(); i++){
27419    var element = this.GetItemInput(i);
27420    if(element)
27421     ASPx.GetStateController().SetElementEnabled(element, enabled);
27422   }
27423  }
27424 },
27425 ChangeItemEnabledAttributes: function(element, method){
27426  method(element, "onclick");
27427 }
27428});
27429var ASPxClientRadioButtonList = ASPx.CreateClass(ASPxClientCheckListBase, {
27430 constructor: function(name) {
27431  this.constructor.prototype.constructor.call(this, name);          
27432 },
27433 InlineInitialize: function() {
27434  if(this.CheckableElementsExist()) 
27435   this.CreateButtonInternalCollection();
27436  ASPxClientCheckListBase.prototype.InlineInitialize.call(this);
27437 },
27438 Initialize: function() {
27439  ASPxClientCheckListBase.prototype.Initialize.call(this);
27440  this.UpdateHiddenInputs(this.GetSelectedIndex());
27441  this.SetSelectedIndex(this.GetSelectedIndex()); 
27442 },
27443 PrepareInternalButton: function(internalRadioButton){
27444  internalRadioButton.autoSwitchEnabled = false;
27445 },
27446 GetInputElement: function() {
27447  if(this.isNative) {
27448   var index = this.GetSelectedIndexInternal();
27449   return this.GetItemInput(index);
27450  } else 
27451   return this.GetValueInputElement();
27452 },
27453 GetValueInputElement: function() {
27454  if(this.valueInput == null) {
27455   var stateInput = this.FindStateInputElement();
27456   this.valueInput = this.GetHiddenField(null, this.name + "_ValueInput", stateInput.parentNode, stateInput);
27457  }
27458  return this.valueInput;
27459 },
27460 GetValueInputToValidate: function() {
27461  return this.GetValueInputElement();
27462 },
27463 SelectIndexSilent: function(index) {
27464  var itemCount = this.GetItemCount();
27465  var isValidIndex = (-1 <= index && index < itemCount);
27466  if(isValidIndex) {
27467   if(this.CheckableElementsExist()) 
27468    this.UpdateCheckableElementDecorations(index, this.GetEnabled());
27469   else {
27470    for(var i = 0; i < itemCount; i++) {
27471     var element = this.GetItemInput(i);
27472     if(element)
27473      element.checked = (i == index);
27474    }
27475   }
27476   this.SetSelectedIndexInternal(index);
27477   this.UpdateHiddenInputs(index);
27478  }
27479 },
27480 UpdateCheckableElementDecorations: function(selectedIndex, enabled) {
27481  if(this.CheckableElementsExist()) {
27482   for(var i = 0; i < this.items.length; i++) {
27483    var inputElement = this.GetItemInput(i);
27484    var internalButton = this.internalButtonCollection.Get(inputElement.id);
27485    internalButton.SetEnabled(enabled);
27486    internalButton.SetValue(i == selectedIndex ? ASPx.CheckBoxInputKey.Checked : ASPx.CheckBoxInputKey.Unchecked);
27487   }
27488  }
27489 },
27490 UpdateFocus: function() {
27491  var index = this.GetSelectedIndexInternal();
27492  if(index == -1)
27493   index = 0;
27494  var itemElement = this.GetItemFocusableElement(index);
27495  if(itemElement != null && ASPx.GetActiveElement() != itemElement && ASPx.IsEditorFocusable(itemElement)) 
27496   ASPx.SetFocus(itemElement);
27497 },
27498 OnItemClick: function(index) {
27499  if(this.GetSelectedIndexInternal() != index) {
27500   this.SelectIndexSilent(index);
27501   this.RaisePersonalStandardValidation();
27502   this.OnValueChanged();
27503  }
27504  this.UpdateFocus();
27505 },
27506 RequireInputElementToValidate: function() {
27507  return false;
27508 },
27509 GetItem: function(index){
27510  var item = ASPxClientCheckListBase.prototype.GetItem.call(this, index);
27511  if(item)
27512   item.selected = index == this.GetSelectedIndexInternal();
27513  return item;
27514 }
27515});
27516ASPxClientRadioButtonList.Cast = ASPxClientControl.Cast;
27517var ASPxClientCheckBoxList = ASPx.CreateClass(ASPxClientCheckListBase, {
27518 constructor: function(name) {
27519  this.constructor.prototype.constructor.call(this, name);          
27520  this.selectionEventsLockCount = 0;
27521  this.initializeInputValue = null;
27522  this.restoredSelectedIndices = null;
27523 },
27524 InlineInitialize: function() {
27525  if(this.CheckableElementsExist()) 
27526   this.CreateButtonInternalCollection();
27527  ASPxClientCheckListBase.prototype.InlineInitialize.call(this);
27528 },
27529 Initialize: function() {
27530  this.initializeInputValue = this.GetInputElement().value;
27531  ASPxClientCheckListBase.prototype.Initialize.call(this);
27532  this.SaveRestoredIndices();
27533  this.InitSelection();
27534 },
27535 SaveRestoredIndices: function() {
27536  var value = this.initializeInputValue;
27537  if(!ASPx.IsExists(value) || value === "")
27538   return;
27539  var serializer = this.GetSerializingHelper();
27540  var itemStringIndices = serializer.DeserializeValues(value);
27541  var itemIndices = [];
27542  for(var i = 0; i < itemStringIndices.length; i++) {
27543   var itemIndex = parseInt(itemStringIndices[i]);
27544   itemIndices.push(itemIndex);
27545  }
27546  this.restoredSelectedIndices = itemIndices;
27547 },
27548 InitSelection: function() {
27549  if(this.restoredSelectedIndices)
27550   this.UnselectAll();
27551  var selectedIndices = this.restoredSelectedIndices || this.initSelectedIndices;
27552  this.SelectIndices(selectedIndices);
27553  this.CacheValue();
27554 },
27555 PrepareInternalButton: function(internalCheckBox, index){
27556  internalCheckBox.autoSwitchEnabled = true;
27557  internalCheckBox.SetChecked(this.GetItemSelectionHelper().GetIsItemSelected(index));
27558 },
27559 SelectIndexSilent: function(index) {
27560  var itemCount = this.GetItemCount();
27561  var isValidIndex = (-1 <= index && index < itemCount);
27562  if(isValidIndex)
27563   this.SelectIndices([index]);
27564 },
27565 UpdateCheckableElementDecorations: function(selectedIndex, enabled) {
27566  if(this.CheckableElementsExist()) {
27567   for(var i = 0; i < this.items.length; i++) {
27568    var inputElement = this.GetItemInput(i);
27569    var internalButton = this.internalButtonCollection.Get(inputElement.id);
27570    internalButton.SetEnabled(enabled);
27571   }
27572  }
27573 },
27574 SetSelectionDecoration: function(index, selected){ 
27575  if(this.CheckableElementsExist()){
27576   var inputElement = this.GetItemInput(index);
27577   var internalButton = this.internalButtonCollection.Get(inputElement.id);
27578   internalButton.SetValue(selected ? ASPx.CheckBoxInputKey.Checked : ASPx.CheckBoxInputKey.Unchecked);
27579  } else {
27580   var element = this.GetItemInput(index);
27581   if(element)
27582    element.checked = (selected); 
27583  }
27584 },
27585 OnItemClick: function(index) {
27586  this.GetItemSelectionHelper().OnItemClick(index);
27587 },
27588 UpdateFocus: function() {
27589  var index = this.GetItemSelectionHelper().GetFocusedItemIndex();
27590  if(index == -1)
27591   index = this.GetSelectedIndexInternal();
27592  if(index == -1)
27593   index = 0;
27594  var itemElement = this.GetItemFocusableElement(index);
27595  if(itemElement != null && ASPx.GetActiveElement() != itemElement && ASPx.IsEditorFocusable(itemElement)) 
27596   ASPx.SetFocus(itemElement);
27597 },
27598 UpdateInternalState: function(){
27599  this.UpdateHiddenInputs();
27600 },
27601 IsUpdateHiddenInputsLocked: function(){
27602  return this.GetItemSelectionHelper().IsUpdateInternalSelectionStateLocked();
27603 },
27604 UpdateHiddenInputs: function(){
27605  if(this.IsUpdateHiddenInputsLocked()) 
27606   return;
27607  var element = this.FindStateInputElement();
27608  if(ASPx.IsExistsElement(element)) { 
27609   var sb = [ ];
27610   var serialiser = this.GetSerializingHelper();
27611   var selectedIndices = this.GetSelectedIndices();
27612   for(var i = 0; i < selectedIndices.length; i++)
27613    serialiser.SerializeAtomValue(sb, selectedIndices[i]);
27614   element.value = sb.join("");
27615  }
27616 },
27617 GetSerializingHelper: function(){ 
27618  if(this.serializingHelper == null)
27619   this.serializingHelper = new ListBoxBaseItemsSerializingHelper(this);
27620  return this.serializingHelper;
27621 },
27622 SetItemSelectionAppearance: function(index, selected, controller, checkCanChangeSelection){
27623 },
27624 LockSelectionEvents: function(){
27625  this.selectionEventsLockCount++;
27626 },
27627 UnlockSelectionEvents: function(){
27628  this.selectionEventsLockCount--;
27629 },
27630 IsSelectionEventsLocked: function(){
27631  return this.selectionEventsLockCount > 0;
27632 },
27633 CacheValue: function(){
27634  this.cachedValue = this.GetValue();
27635 },
27636 IsValueChanged: function(){
27637  return this.cachedValue != this.GetValue();
27638 },
27639 OnItemSelectionChanged: function(index, selected){
27640  this.SetSelectionDecoration(index, selected);
27641  if(!this.IsSelectionEventsLocked()) {
27642   this.SetRaiseSelectedIndexChangedArguments(this.autoPostBack, index, selected);
27643   var valueChanged = this.IsValueChanged();
27644   if(valueChanged) {
27645    this.RaisePersonalStandardValidation();
27646    this.OnValueChanged();
27647   } else {
27648    if(this.RaiseSelectedIndexChanged())
27649     this.SendPostBackInternal("");
27650   }
27651  }
27652  this.CacheValue();
27653 },
27654 SetRaiseSelectedIndexChangedArguments: function(processOnServer, index, selected){
27655  this.selectedIndexChangedArguments = {
27656   processOnServer: processOnServer,
27657   index: index,
27658   selected: selected
27659  };
27660 },
27661 GetRaiseSelectedIndexChangedArguments: function(){
27662  if(!this.selectedIndexChangedArguments)
27663   this.SetRaiseSelectedIndexChangedArguments(false, this.GetSelectedIndex(), true);
27664  return this.selectedIndexChangedArguments;
27665 },
27666 RaiseSelectedIndexChanged: function (processOnServer) {
27667  this.RaiseValidationInternal();
27668  var savedArgs = this.GetRaiseSelectedIndexChangedArguments();
27669  processOnServer = savedArgs.processOnServer || processOnServer;
27670  if(!this.SelectedIndexChanged.IsEmpty()){
27671   var args = new ASPxClientListEditItemSelectedChangedEventArgs(savedArgs.index, savedArgs.selected, processOnServer);
27672   this.SelectedIndexChanged.FireEvent(this, args);
27673   processOnServer = args.processOnServer;
27674  }
27675  return processOnServer;
27676 },
27677 GetItemSelectionHelper: function(){
27678  if(!this.itemSelectionHelper)
27679   this.itemSelectionHelper = this.CreateItemSelectionHelper();
27680  return this.itemSelectionHelper;
27681 },
27682 CreateItemSelectionHelper: function(){
27683  return new CheckBoxListMultiSelectionHelper(this);
27684 },
27685 GetItem: function(index){
27686  var item = ASPxClientCheckListBase.prototype.GetItem.call(this, index);
27687  item.selected = this.GetItemSelectionHelper().GetIsItemSelected(index);
27688  return item;
27689 },
27690 SetValue: function(value){
27691  var index = this.FindItemIndexByValue(value);
27692  this.SetSelectedIndex(index);
27693 },
27694 GetSelectedIndexInternal: function(){
27695  if(!this.isInitialized)
27696   return ASPxClientCheckListBase.prototype.GetSelectedIndexInternal.call(this);
27697  return this.GetItemSelectionHelper().GetSelectedIndex();
27698 },
27699 SetSelectedIndex: function(index){
27700  this.LockSelectionEvents();
27701  this.GetItemSelectionHelper().SetSelectedIndex(index);
27702  this.UnlockSelectionEvents();
27703 },
27704 GetSelectedIndices: function(){
27705  return this.GetItemSelectionHelper().GetSelectedIndices();
27706 },
27707 GetSelectedValues: function(){ 
27708  return this.GetItemSelectionHelper().GetSelectedValues();
27709 },
27710 GetSelectedItems: function(){
27711  return this.GetItemSelectionHelper().GetSelectedItems();
27712 },
27713 SelectAll: function(){
27714  this.SelectIndices();
27715 },
27716 UnselectAll: function(){
27717  this.UnselectIndices();
27718 },
27719 SelectIndices: function(indices){
27720  this.LockSelectionEvents();
27721  this.GetItemSelectionHelper().SelectIndices(indices);
27722  this.UnlockSelectionEvents();
27723 },
27724 SelectItems: function(items){
27725  this.LockSelectionEvents();
27726  this.GetItemSelectionHelper().SelectItems(items);
27727  this.UnlockSelectionEvents();
27728 },
27729 SelectValues: function(values){
27730  this.LockSelectionEvents();
27731  this.GetItemSelectionHelper().SelectValues(values);
27732  this.UnlockSelectionEvents();
27733 },
27734 UnselectIndices: function(indices){
27735  this.LockSelectionEvents();
27736  this.GetItemSelectionHelper().UnselectIndices(indices);
27737  this.UnlockSelectionEvents();
27738 },
27739 UnselectItems: function(items){
27740  this.LockSelectionEvents();
27741  this.GetItemSelectionHelper().UnselectItems(items);
27742  this.UnlockSelectionEvents();
27743 },
27744 UnselectValues: function(values){
27745  this.LockSelectionEvents();
27746  this.GetItemSelectionHelper().UnselectValues(values);
27747  this.UnlockSelectionEvents();
27748 }
27749});
27750ASPxClientCheckBoxList.Cast = ASPxClientControl.Cast;
27751var ASPxClientListEditItemSelectedChangedEventArgs = ASPx.CreateClass(ASPxClientProcessingModeEventArgs, {
27752 constructor: function(index, isSelected, processOnServer){
27753  this.constructor.prototype.constructor.call(this, processOnServer);
27754  this.index = index;
27755  this.isSelected = isSelected;
27756 }
27757});
27758function aspxLBTSelectStart(evt){
27759 var shiftPressed = evt.shiftKey;
27760 var ctrlKey = evt.ctrlKey || evt.metaKey;
27761 if(shiftPressed || ctrlKey){
27762  ASPx.Selection.Clear();
27763  ASPx.Evt.PreventEventAndBubble(evt);
27764 }
27765}
27766function aspxLBIClick(evt){
27767 if(ASPx.TouchUIHelper.isMouseEventFromScrolling) return;
27768 var element = ASPx.Evt.GetEventSource(evt);
27769 while(element != null && element.tagName != "BODY"){
27770  if(element.tagName == "TR"){
27771   var table = element.offsetParent;
27772   if(table && table.ListBoxId){
27773    var lb = ASPx.GetControlCollection().Get(table.ListBoxId);
27774    if(lb != null) {
27775     var retValue;
27776     if(evt.type == "dblclick") 
27777      retValue =lb.OnItemDblClick();
27778     else if(!lb.isComboBoxList || ASPx.Evt.IsLeftButtonPressed(evt)) {
27779      var itemIndex = lb.GetItemIndexByRow(element);
27780      retValue = lb.OnItemClick(itemIndex, evt);
27781     }
27782     if(typeof(retValue) != "undefined")
27783      return retValue;
27784    }
27785    break;
27786   }
27787  }
27788  element = element.parentNode;
27789 }
27790}
27791function aspxLBScroll(evt){
27792 var sourceId = ASPx.Evt.GetEventSource(evt).id;
27793 if(sourceId.slice(-lbDSuffix.length) == lbDSuffix){
27794  var name = sourceId.slice(0, -2);
27795  var lb = ASPx.GetControlCollection().Get(name);
27796  if(lb != null && lb.isInitialized) 
27797   lb.OnScroll();
27798 }
27799}
27800ASPx.NLBIDClick = function(evt) {
27801 var element = ASPx.Evt.GetEventSource(evt);
27802 if(element != null && element.tagName == "SELECT"){
27803  var lb = ASPx.GetControlCollection().Get(element.id);
27804  if(lb != null)
27805   lb.OnItemDblClick();
27806 }
27807};
27808ASPx.ERBLIClick = function(name, index) {
27809 var list = ASPx.GetControlCollection().Get(name);
27810 if(list != null) {
27811  if(list.GetReadOnly())
27812   return false;
27813  list.OnItemClick(index);
27814 }
27815};
27816ASPx.ERBLICancel = function(name) {
27817 var list = ASPx.GetControlCollection().Get(name);
27818 if(list != null)
27819  list.OnItemClickReadonly();
27820};
27821ASPx.ShowListBoxFilter = function(name) {
27822 var list = ASPx.GetControlCollection().Get(name);
27823 if(list != null)
27824  list.ShowFilterElement();
27825};
27826ASPx.HideListBoxFilter = function(name) {
27827 var list = ASPx.GetControlCollection().Get(name);
27828 if (list != null)
27829  list.HideFilterElement();
27830};
27831var highlightingOpeningGuid = "680fb6b5-de5f-4af1-b444-2617b6dc5aab";
27832var highlightingClosingGuid = "ee51e3d2-fb72-45fc-b737-6d3432008053";
27833ASPx.ListBoxHighlightingHelper = ASPx.CreateClass(null, {
27834 constructor: function(listBox, tagName) {
27835  this.listBox = listBox;
27836  this.tagName = tagName;
27837  this.highlightingOpeningTag = "<" + tagName + ">";
27838  this.highlightingClosingTag = "</" + tagName + ">";
27839  this.highlightingOpeningTagPlaceholder = new RegExp(highlightingOpeningGuid, "g");
27840  this.highlightingClosingTagPlaceholder = new RegExp(highlightingClosingGuid, "g");
27841  this.customReplacer = highlightingOpeningGuid + "$&" + highlightingClosingGuid;
27842 },
27843 Apply: function(text, isCustom) {
27844  if(text == "" || !this.listBox.encodeHtml) return;
27845  if(isCustom)
27846   this.applyCustom(text);
27847  else
27848   this.apply(text, ASPx.ContainsFilteringUtils.SelectContainsTextInElement, false);
27849 },
27850 Remove: function(text, isCustom) {
27851  if(isCustom)
27852   this.removeCustom(text);
27853  else
27854   this.apply(text, ASPx.ContainsFilteringUtils.UnselectContainsTextInElement, true);
27855 },
27856 Refresh: function(text, isCustom) {
27857  if(text == "") return;
27858  if(isCustom)
27859   this.applyCustom(text, true);
27860  else
27861   this.apply(text, ASPx.ContainsFilteringUtils.ReselectContainsTextInElement, false);
27862 },
27863 applyCustom: function(highlighting, refreshing) { 
27864  var count = this.listBox.GetItemCount();
27865  var highlightingRegExpxByColumns = this.getCustomHighlightingRegExpsByColumns(highlighting);
27866  for(var i = 0; i < count; i++) {
27867   var item = this.listBox.GetItemRow(i);
27868   if(!item || this.listBox.ItemRowHasTemplate(i)) continue;
27869   this.applyCustomCore(item, highlightingRegExpxByColumns, refreshing);
27870  }
27871 },
27872 applyCustomCore: function(item, highlightingRegExpxByColumns, refreshing) {
27873  var elements = this.getTextCellElements(item);
27874  for(var i = 0, el; el = elements[i]; i++) {
27875   if(refreshing)
27876    this.removeCustomFromItem(el);
27877   this.applyCustomToItem(el, highlightingRegExpxByColumns[i]);
27878  }
27879 },
27880 applyCustomToItem: function(element, regexp) {
27881  if(!regexp)
27882   return;
27883  var currentText = ASPx.Attr.GetAttribute(element, "DXText");
27884  if(!ASPx.IsExists(currentText)) ASPx.Attr.SetAttribute(element, "DXText", ASPx.GetInnerText(element));
27885  var oldInnerText = ASPx.GetInnerText(element);
27886  var newInnerText = oldInnerText.replace(regexp, this.customReplacer);
27887  newInnerText = ASPx.ContainsFilteringUtils.PrepareElementText(newInnerText)
27888   .replace(this.highlightingOpeningTagPlaceholder, this.highlightingOpeningTag)
27889   .replace(this.highlightingClosingTagPlaceholder, this.highlightingClosingTag);
27890  if(newInnerText !== oldInnerText)
27891   ASPx.SetInnerHtml(element, newInnerText);
27892 },
27893 removeCustomFromItem: function(element) {
27894  var currentText = ASPx.Attr.GetAttribute(element, "DXText");
27895  if(ASPx.IsExists(currentText)) {
27896   currentText = ASPx.ContainsFilteringUtils.PrepareElementText(currentText);
27897   ASPx.SetInnerHtml(element, currentText === "" ? "&nbsp;" : currentText);
27898  }
27899 },
27900 removeCustom: function() {
27901  var count = this.listBox.GetItemCount();
27902  for(var i = 0; i < count; i++) {
27903   var item = this.listBox.GetItemRow(i);
27904   if(!item || this.listBox.ItemRowHasTemplate(i)) continue;
27905   this.removeCustomCore(item);
27906  }
27907 },
27908 removeCustomCore: function(item) {
27909  var elements = this.getTextCellElements(item);
27910  for(var i = 0, el; el = elements[i]; i++)
27911   this.removeCustomFromItem(el);
27912 },
27913 getCustomHighlightingRegExpsByColumns: function(highlighting) {
27914  var columns = this.listBox.IsMultiColumn() ? this.listBox.columnFieldNames : [""];
27915  return columns.map(function(fieldName) {
27916   if(typeof (highlighting) === "string" || Array.isArray(highlighting) || highlighting instanceof RegExp)
27917    return this.arrayToRegEx(highlighting);
27918   if(typeof (highlighting) === "object")
27919    return this.arrayToRegEx(highlighting[fieldName]);
27920   return null;
27921  }.bind(this));
27922 },
27923 arrayToRegEx: function(texts) {
27924  if(texts instanceof RegExp)
27925   return texts;
27926  if(typeof (texts) === "string")
27927   return this.arrayToRegEx([texts]);
27928  if(Array.isArray(texts)) {
27929   texts = texts
27930    .filter(function(t) { return typeof (t) === "string" && t.length; })
27931    .sort(function(a, b) { return b.length - a.length; })
27932    .map(ASPx.Str.EscapeForRegEx);
27933   if(texts.length)
27934    return new RegExp("(" + texts.join("|") + ")", "gi");
27935  }
27936  return null;
27937 },
27938 apply: function(text, func, allColumns) {
27939  var count = this.listBox.GetItemCount();
27940  for (var i = 0; i < count; i++) {
27941   var item = this.listBox.GetItemRow(i);
27942   if (item && (allColumns || ASPx.GetElementDisplay(item)) && this.canApply(item)) {
27943    var elements = this.listBox.GetItemSelectableElementsByRow(item);
27944    this.applyToItem(text, elements, func, allColumns);
27945   }
27946  }
27947 },
27948 applyToItem: function(text, elements, func, allColumns) {
27949  var itemValues = this.getItemValues(elements);
27950  var itemSelection = this.getItemSelection(itemValues, this.listBox.textFormatString, text);
27951  var firstTextCellIndex = this.getFirstTextCellIndex();
27952  if (allColumns) {
27953   for (var i = 0; i < elements.length; i++)
27954    this.applyToItemCore(func, elements[i], itemSelection[i]);
27955  } else
27956   this.applyToTextCells(func, firstTextCellIndex, elements, itemSelection);
27957 },
27958 getItemSelection: function (itemValues, textFormatString, text) {
27959  return ASPx.ContainsFilteringUtils.GetColumnSelectionsForItem(itemValues, textFormatString, text);
27960 },
27961 applyToTextCells: function(func, firstTextCellIndex, elements, itemSelection) {
27962  for(var i = 0; i < itemSelection.length; i++)
27963   this.applyToItemCore(func, elements[itemSelection[i].index + firstTextCellIndex], itemSelection[i]);
27964 },
27965 applyToItemCore: function (func, itemElement, itemSelection) {
27966  if (!this.listBox.ItemCellHasTextAttr(itemElement))
27967   func(itemElement, itemSelection, this.tagName);
27968 },
27969 getItemValues: function (elements) {
27970  var result = [];
27971  for (var i = this.getFirstTextCellIndex() ; i < elements.length; i++)
27972   result.push(ASPxClientListBox.GetItemCellInnerText(elements[i]));
27973  return result;
27974 },
27975 canApply: function (item) {
27976  return !this.listBox.ItemRowHasTemplateCore(item);
27977 },
27978 getFirstTextCellIndex: function () {
27979  return this.listBox.GetItemFirstTextCellIndex();
27980 },
27981 getTextCellElements: function(item) {
27982  return this.listBox.GetItemTextCells(item);
27983 }
27984});
27985var ListEditFilterStrategyBase = ASPx.CreateClass(null, {
27986 OnPaste: function(evt) { },
27987 OnInput: function() { },
27988 OnClearButtonClick: function() { },
27989 OnTextChanged: function() { },
27990 OnEscape: function() { },
27991 OnKeyDown: function(evt) { },
27992 OnAfterEnter: function() { },
27993 OnSelectedIndexChanged: function() { },
27994 OnLostFocus: function() { },
27995 OnCallback: function(result) { },
27996 OnBeforeDoEndCallback: function() { },
27997 OnAfterDoEndCallback: function() { },
27998 OnBeforeCallbackFinally: function() { },
27999 OnAfterCallbackFinally: function() { },
28000 OnPerformCallback: function() { },
28001 Filtering: function() { },
28002 CancelFiltering: function() { },
28003 ShouldDiscardCallbackResult: function() { },
28004 GetCallbackArguments: function() { return ""; },
28005 CanNavigateByKbd: function() { return true; },
28006 IsFilterMeetRequirementForMinLength: function (filter) { return true; },
28007 ResetCallbackState: function() { },
28008 ClearFilterApplied: function() { },
28009 OnDropDownHideArea: function() { },
28010 OnDropDownButtonClick: function() { },
28011 OnDropDownCloseByDocumentOrWindowEvent: function() { },
28012 OnApplyChanges: function() { },
28013 OnCancelChanges: function() { },
28014 OnUndo: function() { }
28015});
28016var ListEditIncrementalFilterStrategyBase = ASPx.CreateClass(ListEditFilterStrategyBase, {
28017 constructor: function(filterDelay, filterMinLength, isCallbackMode) {
28018  this.filterTimeoutId = -1;
28019  this.filterDelay = filterDelay;
28020  this.filterMinLength = filterMinLength;
28021  this.isCallbackMode = isCallbackMode;
28022  this.filter = "";
28023  this.highlighting = "";
28024  this.filterInitialized = false;
28025  this.needEmptyFilterBeforeFiltering = false;
28026  this.currentCallbackIsFiltration = false;
28027  this.refiltrationRequired = false;
28028 },
28029 GetInputFilterValue: function() { throw "Not Implemented"; },
28030 GetListBoxControl: function() { throw "Not Implemented"; },
28031 IsSatisfy: function(text, filter) { throw "Not Implemented"; },
28032 InCallback: function() { throw "Not Implemented"; },
28033 IsEnabled: function() { throw "Not Implemented"; },
28034 SendCallbackCore: function() { throw "Not Implemented"; },
28035 PreventEndCallbackRising: function() { throw "Not Implemented"; },
28036 GetSelectedIndex: function() { throw "Not Implemented"; },
28037 NotifyCollectionChanged: function() { throw "Not Implemented"; },
28038 OnCallbackCore: function(highlighting, newFilterLength) { throw "Not Implemented"; },
28039 RaiseItemFilteringEvent: function(item, filter, isFit) { throw "Not Implemented"; },
28040 RaiseCustomHighlightingEvent: function(filter, highlighting) { throw "Not Implemented"; },
28041 OnBeforeFilteringOnClient: function(filter) { }, 
28042 OnAfterFilteringOnClientCore: function (filter, firstSatisfyItemIndex) { throw "Not Implemented"; },
28043 SupportsFilterCorrection: function() { throw "Not Implemented"; },
28044 OnFirstSatisfiedItemFound: function(index, text, isTextClearing) { },
28045 TryProcessFilterLessMinLength: function() { return true; },
28046 AllowEmptyFilterResults: function() { return true; },
28047 OnBeforeFiltering: function() { },
28048 OnAfterFiltering: function() { },
28049 OnFilteringCancelled: function() { },
28050 OnTextChanged: function() { },
28051 OnFilterRollback: function() { },
28052 CanStartFilterOnInput: function() {
28053  return this.IsEnabled() && !this.InCallback();
28054 },
28055 OnAfterFilteringOnClient: function (filter, satisfyItemIndices) {
28056  this.GetListBoxControl().RewriteFilteredItemIndices(satisfyItemIndices);
28057  var firstSatisfyItemIndex = satisfyItemIndices.length > 0 ? satisfyItemIndices[0] : -1;
28058  this.OnAfterFilteringOnClientCore(filter, firstSatisfyItemIndex);
28059 },
28060 ShouldClearFilterBeforeFiltering: function(filter) { return false; },
28061 OnInput: function() {
28062  if(this.CanStartFilterOnInput()) {
28063   this.FilterStopTimer();
28064   this.FilterStartTimer();
28065  }
28066 },
28067 OnCallback: function(result) {
28068  this.OnCallbackCore(result[CONSTANTS.CALLBACK_RESULTS.FILTER_CUSTOMHIGHLIGHTING], result[CONSTANTS.CALLBACK_RESULTS.FILTER_LENGTH]);
28069  this.currentCallbackIsFiltration = false;
28070 },
28071 CancelFiltering: function() {
28072  this.FilterStopTimer();
28073 },
28074 Filtering: function(fromApi) {
28075  this.FilterStopTimer();
28076  var inputValue = this.GetInputFilterValue();
28077  this.needEmptyFilterBeforeFiltering = this.ShouldClearFilterBeforeFiltering(inputValue);
28078  var newFilter = this.needEmptyFilterBeforeFiltering ? "" : inputValue;
28079  var oldFilter = this.filter;
28080  if(!this.FilterCompare(newFilter)) {
28081   this.SetFilter(newFilter);
28082   if(!this.IsFilterMeetRequirementForMinLength() && this.TryProcessFilterLessMinLength(oldFilter))
28083    return;
28084   else {
28085    this.OnBeforeFiltering();
28086    if(this.isCallbackMode)
28087     this.FilteringOnServer();
28088    else
28089     this.FilteringOnClient();
28090    this.OnAfterFiltering();
28091   }
28092  }
28093  else
28094   this.OnFilteringCancelled(fromApi);
28095 },
28096 FilteringOnClient: function() {
28097  var listBox = this.GetListBoxControl(),
28098   count = listBox.GetItemCount(),
28099   filter = this.filter,
28100   visibleItems = [],
28101   visibleItemFound = false;
28102  this.DiscardHighlighting();
28103  while(true) {
28104   var preparedFilter = ASPx.Str.PrepareStringForFilter(filter);
28105   listBox.BeforeClientFiltering();
28106   for(var i = 0; i < count; i++) {
28107    var item = listBox.GetItem(i);
28108    var isFit = this.IsSatisfy(item.text, preparedFilter);
28109    isFit = this.RaiseItemFilteringEvent(item, filter, isFit);
28110    if(isFit) {
28111     if(!visibleItemFound) {
28112      this.OnBeforeFilteringOnClient(filter);
28113      for(var j = 0; j < i; j++)
28114       listBox.ApplyFilterToItem(j, false);
28115      var isTextClearing = filter == "" && this.filter != item.text;
28116      this.OnFirstSatisfiedItemFound(i, item.text, isTextClearing);
28117      visibleItemFound = true;
28118     }
28119     visibleItems.push(i);
28120    }
28121    if(visibleItemFound)
28122     listBox.ApplyFilterToItem(i, isFit);
28123   }
28124   if(visibleItemFound || this.AllowEmptyFilterResults() || !filter)
28125    break;
28126   filter = filter.substr(0, filter.length - 1);
28127  }
28128  if(!visibleItemFound) {
28129   this.OnBeforeFilteringOnClient(filter); 
28130   if(this.AllowEmptyFilterResults()) {
28131    for(var i = 0; i < count; i++)
28132     listBox.ApplyFilterToItem(i, false);
28133   }
28134  }
28135  this.OnAfterFilteringOnClient(filter, visibleItems);
28136  this.SetHighlighting(filter);
28137  this.OnEndFiltering(visibleItemFound || this.AllowEmptyFilterResults());
28138 },
28139 FilteringOnServer: function() {
28140  if(!this.InCallback()) {
28141   var listBox = this.GetListBoxControl();
28142   listBox.ClearItems(); 
28143   listBox.serverIndexOfFirstItem = 0;
28144   listBox.SetScrollSpacerVisibility(true, false);
28145   listBox.SetScrollSpacerVisibility(false, false);
28146  }
28147  this.SendFilteringCallback();
28148 },
28149 SendFilteringCallback: function(owner) {
28150  this.currentCallbackIsFiltration = true;
28151  this.SendCallbackCore();
28152 },
28153 OnEndFiltering: function(visibleCollectionChanged) {
28154  if(visibleCollectionChanged)
28155   this.NotifyCollectionChanged();
28156  this.ApplyHighlighting();
28157 },
28158 IsFilterTimerActive: function() {
28159  return this.filterTimeoutId !== -1;
28160 },
28161 FilterStopTimer: function() {
28162  this.filterTimeoutId = ASPx.Timer.ClearTimer(this.filterTimeoutId);
28163 },
28164 FilterStartTimer: function() {
28165  this.filterTimeoutId = ASPx.Timer.SetControlBoundTimeout(function() {
28166   this.filterTimeoutId = -1;
28167   this.Filtering();
28168  }.bind(this), this.GetListBoxControl(), this.filterDelay);
28169 },
28170 IsFilterMeetRequirementForMinLength: function(filter) {
28171  if(typeof (filter) !== "string")
28172   filter = this.GetInputFilterValue();
28173  return typeof (filter) === "string" ? filter.length >= this.filterMinLength : true;
28174 },
28175 GetCallbackArguments: function() {
28176  if(this.filter) {
28177   var callbackPrefix = this.SupportsFilterCorrection() ? CONSTANTS.CALLBACK_PREFIXES.FILTERING_CORRECT : CONSTANTS.CALLBACK_PREFIXES.FILTERING;
28178   return ASPx.FilteringUtils.FormatCallbackArg(callbackPrefix, this.filter);
28179  }
28180  return "";
28181 },
28182 OnAfterDoEndCallback: function() {
28183  if(this.refiltrationRequired) {
28184   this.refiltrationRequired = false;
28185   window.setTimeout(this.Filtering.bind(this), 0);
28186  }
28187 },
28188 OnBeforeDoEndCallback: function() {
28189  if(this.refiltrationRequired)
28190   this.PreventEndCallbackRising();
28191 },
28192 OnSelectedIndexChanged: function() {
28193  this.ClearFilterApplied();
28194 },
28195 SetHighlighting: function(filter, callbackHighlighting) {
28196  callbackHighlighting = this.ProcessCallbackHighlighting(callbackHighlighting);
28197  var customHighlighting = this.RaiseCustomHighlightingEvent(filter, callbackHighlighting);
28198  this.isCustomHighlighting = customHighlighting !== null && customHighlighting !== undefined;
28199  this.highlighting = this.isCustomHighlighting ? customHighlighting : filter;
28200 },
28201 ProcessCallbackHighlighting: function(obj) {
28202  if(obj === undefined || obj === null)
28203   return undefined;
28204  var val = obj.val;
28205  var regEx = !!obj.regEx;
28206  if(regEx) {
28207   if(typeof (val) === "string")
28208    val = new RegExp(val, "gi");
28209   if(!Array.isArray(val) && typeof (val) === "object") {
28210    for(var col in val) {
28211     if(!val.hasOwnProperty(col)) continue;
28212     if(typeof (val[col]) === "string")
28213      val[col] = new RegExp(val[col], "gi");
28214    }
28215   }
28216  }
28217  return val;
28218 },
28219 IsEmptyFilter: function() {
28220  return !this.filterInitialized || this.filter === "";
28221 },
28222 ShouldDiscardCallbackResult: function() {
28223  var discardCallbackResult = !this.needEmptyFilterBeforeFiltering && !this.IsFilterEqualInputValue() && this.currentCallbackIsFiltration;
28224  if(discardCallbackResult)
28225   this.refiltrationRequired = true;
28226  return discardCallbackResult;
28227 },
28228 IsFilterEqualInputValue: function() {
28229  var currentFilter = this.GetInputFilterValue();
28230  return this.FilterCompareLower(ASPx.Str.PrepareStringForFilter(currentFilter));
28231 },
28232 FilterCompare: function(value) {
28233  return this.filterInitialized && this.filter === value;
28234 },
28235 FilterCompareLower: function(value) {
28236  if(!this.filterInitialized)
28237   return false;
28238  return ASPx.Str.PrepareStringForFilter(this.filter) == value;
28239 },
28240 DiscardHighlighting: function() {
28241  this.GetListBoxControl().highlighting.Remove(this.highlighting, this.isCustomHighlighting);
28242 },
28243 ApplyHighlighting: function() {
28244  this.GetListBoxControl().highlighting.Apply(this.highlighting, this.isCustomHighlighting);
28245 },
28246 RefreshHighlighting: function() {
28247  this.GetListBoxControl().highlighting.Refresh(this.highlighting, this.isCustomHighlighting);
28248 },
28249 MakeAllItemsVisible: function() {
28250  this.GetListBoxControl().MakeAllItemsVisible();
28251 },
28252 SetFilter: function(newFilter) {
28253  this.filter = newFilter;
28254  this.highlighting = "";
28255  this.isCustomHighlighting = undefined;
28256  this.filterInitialized = true;
28257 },
28258 ClearFilter: function() {
28259  this.filter = "";
28260  this.highlighting = "";
28261  this.isCustomHighlighting = undefined;
28262  this.filterInitialized = false;
28263 },
28264 ClearFilterApplied: function() {
28265  this.filterInitialized = false;
28266 },
28267 FilteringBackspace: function() {
28268  throw "Not Implemented";
28269 },
28270});
28271var ListBoxFilterStrategy = ASPx.CreateClass(ListEditIncrementalFilterStrategyBase, {
28272 constructor: function(listBox) {
28273  this.constructor.prototype.constructor.call(this, listBox.filteringDelay, listBox.filterMinLength, listBox.isCallbackMode);
28274  this.listBox = listBox;
28275 },
28276 SupportsFilterCorrection: function() {
28277  return false;
28278 },
28279 IsEnabled: function() {
28280  return this.listBox.GetEnabled();
28281 },
28282 GetInputFilterValue: function() {
28283  return this.listBox.filteringTextBox.GetInputElement().value;
28284 },
28285 NotifyCollectionChanged: function() {
28286  this.listBox.CollectionChanged(true);
28287 },
28288 TryProcessFilterLessMinLength: function(oldFilter) {
28289  this.SetFilter("");
28290  return !oldFilter;
28291 },
28292 IsSatisfy: function(text, filter) {
28293  return ASPx.Str.PrepareStringForFilter(text).indexOf(filter) !== -1;
28294 },
28295 GetListBoxControl: function() {
28296  return this.listBox;
28297 },
28298 OnAfterFilteringOnClientCore: function (filter, firstSatisfyItemIndex) {
28299  if(firstSatisfyItemIndex !== -1)
28300   this.listBox.CorrectCellWidthsOnFirstRowItemReplacement(0, firstSatisfyItemIndex);
28301 },
28302 OnEndFiltering: function(visibleCollectionChanged) {
28303  ListEditIncrementalFilterStrategyBase.prototype.OnEndFiltering.call(this, visibleCollectionChanged);
28304  if(this.listBox.IsMultiColumn())
28305   this.listBox.CorrectWidth();
28306  this.listBox.updateSelectAllElementsState();
28307 },
28308 SendCallbackCore: function() {
28309  this.listBox.SendCallback();
28310 },
28311 InCallback: function() {
28312  return this.listBox.InCallback();
28313 },
28314 PreventEndCallbackRising: function() {
28315  this.listBox.preventEndCallbackRising = true;
28316 },
28317 GetSelectedIndex: function() {
28318  return this.listBox.GetSelectedIndex();
28319 },
28320 OnCallbackCore: function(highlighting, newFilterLength) {
28321  if(this.currentCallbackIsFiltration)
28322   this.SetHighlighting(this.filter, highlighting);
28323  if(this.filter)
28324   this.OnEndFiltering();
28325 },
28326 FilteringBackspace: function() {
28327  var textBox = this.listBox.filteringTextBox;
28328  if(textBox)
28329   ASPx.StartWithFilteringUtils.RollbackOneSuggestedChar(textBox.GetInputElement());
28330  this.FilterStartTimer();
28331 },
28332 RaiseItemFilteringEvent: function(item, filter, isFit) {
28333  return this.listBox.RaiseItemFiltering(item, filter, isFit);
28334 },
28335 RaiseCustomHighlightingEvent: function(filter, callbackHighlighting) {
28336  return this.listBox.RaiseCustomHighlighting(filter, callbackHighlighting);
28337 }
28338});
28339ASPx.ListBoxItemsDefaultManager = ListBoxItemsDefaultManager;
28340ASPx.ListBoxItemsVirtualManager = ListBoxItemsVirtualManager;
28341ASPx.VirtualRenderListBoxStateControllerManager = VirtualRenderListBoxStateControllerManager;
28342ASPx.DefaultListBoxStateControllerManager = DefaultListBoxStateControllerManager;
28343ASPx.ListEditIncrementalFilterStrategyBase = ListEditIncrementalFilterStrategyBase;
28344ASPx.ListBoxFilterStrategy = ListBoxFilterStrategy;
28345ASPx.ListEditFilterStrategyBase = ListEditFilterStrategyBase;
28346var ASPxClientListEditItemFilteringEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
28347 constructor: function(item, filter, isFit) {
28348  this.constructor.prototype.constructor.call(this);
28349  this.item = item;
28350  this.isFit = isFit;
28351  this.filter = filter;
28352 }
28353});
28354var ASPxClientListEditCustomHighlightingEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
28355 constructor: function(filter) {
28356  this.constructor.prototype.constructor.call(this);
28357  this.highlighting = null;
28358  this.filter = filter;
28359 }
28360});
28361ASPx.ListBoxScrollCallbackHelper = ListBoxScrollCallbackHelper;
28362window.ASPxClientListEdit = ASPxClientListEdit;
28363window.ASPxClientListEdit.CONSTANTS = CONSTANTS;
28364window.ASPxClientListEditItem = ASPxClientListEditItem;
28365window.ASPxClientListBoxItem = ASPxClientListBoxItem;
28366window.ASPxClientListBoxBase = ASPxClientListBoxBase;
28367window.ASPxClientListBox = ASPxClientListBox;
28368window.ASPxClientNativeListBox = ASPxClientNativeListBox;
28369window.ASPxClientCheckListBase = ASPxClientCheckListBase;
28370window.ASPxClientRadioButtonList = ASPxClientRadioButtonList;
28371window.ASPxClientCheckBoxList = ASPxClientCheckBoxList;
28372window.ASPxClientListEditItemSelectedChangedEventArgs = ASPxClientListEditItemSelectedChangedEventArgs;
28373window.ASPxClientListEditItemFilteringEventArgs = ASPxClientListEditItemFilteringEventArgs;
28374window.ASPxClientListEditCustomHighlightingEventArgs = ASPxClientListEditCustomHighlightingEventArgs;
28375})();
28376
28377(function() {
28378var currentSelectedItemCallbackPrefix = "CBSI";
28379var loadDropDownOnDemandCallbackPrefix = "CBLD";
28380var listBoxNameSuffix = "_L";
28381var comboBoxValueInputSuffix = "VI";
28382var ASPxClientComboBoxBase = ASPx.CreateClass(ASPxClientDropDownEditBase, {
28383 constructor: function(name) {
28384  this.constructor.prototype.constructor.call(this, name);
28385  this.lbEventLockCount = 0;
28386  this.receiveGlobalMouseWheel = false;
28387  this.collectCallbackIDs = false;
28388  this.callbackIDs = { };
28389  this.callbackIDsToReset = { };
28390  this.listBox = null;
28391  this.lastSuccessValue = "";
28392  this.islastSuccessValueInit = false;
28393  this.SelectedIndexChanged = new ASPxClientEvent();
28394 },
28395 Initialize: function(){
28396  this.InitializeListBoxOwnerName();
28397  ASPxClientDropDownEditBase.prototype.Initialize.call(this);
28398  this.InitLastSuccessValue();
28399 },
28400 InitializeListBoxOwnerName: function(){
28401  var lb = this.GetListBoxControl();
28402  if(lb)
28403   lb.ownerName = this.name;
28404 },
28405 InitLastSuccessValue: function(){
28406  this.SetLastSuccessValue(this.GetValue());
28407 },
28408 SetLastSuccessValue: function (value) {
28409  if(this.convertEmptyStringToNull && value === "")
28410   value = null;
28411  this.lastSuccessValue = value;
28412  this.islastSuccessValueInit = true;
28413 },
28414 GetDropDownInnerControlName: function(suffix){
28415  return "";
28416 },
28417 CreateAccessibilityHelper: function() {
28418  return new AccessibilityHelperComboBox(this);
28419 },
28420 GetListBoxControl: function(){
28421  if(!ASPx.IsExists(this.listBox)){
28422   var name = this.GetDropDownInnerControlName(listBoxNameSuffix);
28423   this.listBox = ASPx.GetControlCollection().Get(name);
28424  }
28425  if(this.isNative || (this.listBox && !!this.listBox.GetMainElement()))
28426   return this.listBox;
28427  return null;
28428 },
28429 GetCallbackArguments: function(){
28430  return this.GetListBoxCallbackArguments();
28431 },
28432 GetListBoxCallbackArguments: function(){
28433  var lb = this.GetListBoxControl();
28434  return lb.GetCallbackArguments();
28435 },
28436 SendCallback: function(onSuccess) {
28437  var callbackID = this.CreateCallback(this.GetCallbackArguments(), null, onSuccess);
28438  this.OnCreateCallback(callbackID);
28439 },
28440 SendSpecialCallback: function(args, handler) {
28441  var callbackID = this.CreateCallback(args, null, handler);
28442  this.OnCreateCallback(callbackID);
28443 },
28444 OnCreateCallback: function(callbackID) {
28445  if(this.collectCallbackIDs)
28446   this.callbackIDs[callbackID] = true;
28447  this.UnlockDoEndCallback();
28448 },
28449 CanProcessCallbackResult: function(callbackID) {
28450  var result = !this.collectCallbackIDs || !this.callbackIDsToReset[callbackID];
28451  delete this.callbackIDs[callbackID];
28452  delete this.callbackIDsToReset[callbackID];
28453  if(!result)
28454   this.LockDoEndCallback();
28455  return result;
28456 },
28457 LockDoEndCallback: function() {
28458  this.lockDoEndCallback = true;
28459  this.lockDoEndCallbackTimerId =  window.setTimeout(function() { this.lockDoEndCallback = false; }.bind(this), 200);
28460 },
28461 UnlockDoEndCallback: function() {
28462  this.lockDoEndCallback = false;
28463  ASPx.Timer.ClearTimer(this.lockDoEndCallbackTimerId);
28464 },
28465 IsDoEndCallbackLocked: function() { 
28466  return !!this.lockDoEndCallback; 
28467 },
28468 ResetWaitingCallbacks: function() {
28469  var ids = Object.keys(this.callbackIDs);
28470  if(ids.length === 0) return;
28471  ids.forEach(function(id) { this.callbackIDsToReset[id] = true; }.bind(this));
28472  this.callbackIDs = { };
28473  this.requestCount = 0;
28474  ASPx.GetControlCollection().ResetRequestCount(); 
28475  this.CancelCallbackInternal();
28476 },
28477 SetReadOnlyInternal: function(readOnly) {
28478  ASPxClientDropDownEditBase.prototype.SetReadOnlyInternal.call(this, readOnly);
28479  var lb = this.GetListBoxControl();
28480  if(lb)
28481   lb.SetReadOnly(readOnly);
28482 },
28483 SetText: function(text){
28484  var lb = this.GetListBoxControl();
28485  var index = this.GetAdjustedSelectedIndexByText(lb, text);
28486  var isAllowNullValue = !this.isDropDownListStyle || this.allowNull;
28487  var isChangingTextInEmpty = index < 0 && !text && this.lastSuccessText !== text;
28488  if(isAllowNullValue || !isChangingTextInEmpty) {
28489   this.SelectIndex(index, false);
28490   this.SetTextBase(text);
28491   this.SetLastSuccessText(text);
28492   this.SetLastSuccessValue(index >= 0 ? lb.GetValue() : text);
28493  }
28494 },
28495 GetValue: function(){
28496  var value = this.islastSuccessValueInit ? this.lastSuccessValue : this.GetValueInternal();
28497  if(this.convertEmptyStringToNull && value === "")
28498   value = null;
28499  return value;
28500 },
28501 GetValueInternal: function(){
28502  var text = this.GetTextInternal();
28503  var textChanges = text != this.lastSuccessText;
28504  if(textChanges){
28505   var lb = this.GetListBoxControl();
28506   if(lb){
28507    var index = this.GetAdjustedSelectedIndexByText(lb, text);
28508    this.SelectIndexSilent(lb, index); 
28509    if(index != -1)
28510     return lb.GetValue();
28511   }
28512  }
28513  return ASPxClientDropDownEditBase.prototype.GetValue.call(this);
28514 },
28515 GetLastSuccesfullValue: function() {
28516  return this.GetValue();
28517 },
28518 GetSetValueOptimizeHelper: function () {
28519  this.setValueOptimizeHelper = this.setValueOptimizeHelper || new setValueOptimizeHelper();
28520  return this.setValueOptimizeHelper;
28521 },
28522 SetValue: function (value) {
28523  this.GetSetValueOptimizeHelper().setValue(this, value);
28524  if(this.accessibilityCompliant)
28525   this.GetAccessibilityHelper().SetLabelAttribute(null, null);
28526 },
28527 SetValueInternal: function(value) {
28528  var lb = this.GetListBoxControl();
28529  if (lb) {
28530   lb.SetValue(value);
28531   var item = lb.GetSelectedItem();
28532   var text = item ? item.text : value;
28533   this.OnSelectionChangedCore(text, item, false);
28534   this.UpdateValueInput();
28535  }
28536 },
28537 Clear: function() {
28538  ASPxClientDropDownEditBase.prototype.Clear.call(this);
28539  if(!this.GetListBoxControl())
28540   this.islastSuccessValueInit = false;
28541 },
28542 GetFormattedText: function() {
28543  return this.GetText();
28544 },
28545 GetAdjustedSelectedIndexByText: function(lb, text){
28546  if(!lb)
28547   return -1;
28548  var lbSelectedItem = lb.GetSelectedItem();
28549  if(lbSelectedItem != null && (lbSelectedItem.text == text || !this.isInitialized))
28550   return lbSelectedItem.index;
28551  return this.FindItemIndexByText(lb, text);
28552 },
28553 FindItemIndexByText: function(lb, text){
28554  if(lb)
28555   return lb.FindItemIndexByText(text);
28556 },
28557 CollectionChanged: function(){
28558 },
28559 HasChanges: function(){
28560  return false;
28561 },
28562 SelectIndex: function(index, initialize){
28563  var lb = this.GetListBoxControl();
28564  if(!lb)
28565   return false;
28566  var isSelectionChanged = lb.SelectIndexSilentAndMakeVisible(index, initialize);
28567  var item = lb.GetSelectedItem();
28568  var text = item != null ? item.text : "";
28569  if(isSelectionChanged || this.HasChanges())
28570   this.OnSelectionChangedCore(text, item, false);
28571  this.UpdateValueInput();
28572  return isSelectionChanged;
28573 },
28574 OnSelectChanged: function(){
28575  if(this.lbEventLockCount > 0) return;
28576  var lb = this.GetListBoxControl();
28577  var item = lb.GetSelectedItem();
28578  var text = item != null ? item.text : "";
28579  this.OnSelectionChangedCore(text, item, false);
28580  this.OnChange();
28581 },
28582 OnSelectionChangedCore: function(text, item, canBeRolledBack){
28583  this.SetTextBase(text);
28584  this.ShowItemImage(item);
28585  if(!canBeRolledBack){
28586   this.SetLastSuccessText(text);
28587   this.SetLastSuccessValue(item != null ? item.value : text);
28588  }
28589 },
28590 ShowItemImageByIndex: function(index){
28591  var item = this.GetItem(index);
28592  this.ShowItemImage(item);
28593 },
28594 ShowCurrentItemImage: function() {
28595  var selectedItem = this.GetSelectedItem();
28596  this.ShowItemImage(selectedItem);
28597 },
28598 ShowItemImage: function(item){
28599  var imageUrl = item != null ? item.imageUrl : "";
28600  this.SetSelectedImage(imageUrl);
28601 },
28602 GetDropDownImageElement: function(){
28603  var itemImageCell = this.GetDropDownItemImageCell();
28604  if(itemImageCell != null)
28605   return ASPx.GetNodeByTagName(itemImageCell, "IMG", 0);
28606  return null;
28607 },
28608 SetSelectedImage: function(imageUrl) {
28609  var imgElement = this.GetDropDownImageElement();
28610  if(imgElement != null) {
28611   var imageExists = imageUrl != "";
28612   imageUrl = imageExists ? imageUrl : ASPx.EmptyImageUrl;
28613   imgElement.src = imageUrl;
28614   var itemImageCell = this.GetDropDownItemImageCell();
28615   if(ASPx.GetElementDisplay(itemImageCell) != imageExists)
28616    ASPx.SetElementDisplay(itemImageCell, imageExists);
28617  }
28618 },
28619 OnCallback: function(result) {
28620 },
28621 OnChange: function(){
28622  this.UpdateValueInput();
28623  this.RaisePersonalStandardValidation();
28624  this.OnValueChanged();
28625 },
28626 UpdateValueInput: function() {
28627 },
28628 RaiseValueChangedEvent: function() {
28629  if(!this.isInitialized) return;
28630  var processOnServer = ASPxClientTextEdit.prototype.RaiseValueChangedEvent.call(this);
28631  processOnServer = this.RaiseSelectedIndexChanged(processOnServer);
28632  return processOnServer;
28633 },
28634 RaiseSelectedIndexChanged: function(processOnServer) {
28635  if(!this.SelectedIndexChanged.IsEmpty()){
28636   var args = new ASPxClientProcessingModeEventArgs(processOnServer);
28637   this.SelectedIndexChanged.FireEvent(this, args);
28638   processOnServer = args.processOnServer;
28639  }
28640  return processOnServer;
28641 },
28642 GetItemHtmlContent: function(index) {
28643  var lb = this.GetListBoxControl();
28644  return lb && lb.GetItemHtmlContent(index);
28645 },
28646 AddItem: function(texts, value, imageUrl, htmlContent, cssClass, tooltip) {
28647  var index = this.GetListBoxControl().AddItem(texts, value, imageUrl, htmlContent, cssClass, tooltip);
28648  this.CollectionChanged();
28649  return index;
28650 },
28651 InsertItem: function(index, texts, value, imageUrl, htmlContent, cssClass, tooltip){
28652  this.GetListBoxControl().InsertItem(index, texts, value, imageUrl, htmlContent, cssClass, tooltip);
28653  this.CollectionChanged();
28654 },
28655 RemoveItem: function(index){
28656  this.GetListBoxControl().RemoveItem(index);
28657  this.CollectionChanged();
28658 },
28659 ClearItems: function(){
28660  this.GetListBoxControl().ClearItems();
28661  this.ClearItemsInternal();
28662 },
28663 BeginUpdate: function(){
28664   this.GetListBoxControl().BeginUpdate();
28665 },
28666 EndUpdate: function(){
28667  this.GetListBoxControl().EndUpdate();
28668  this.CollectionChanged();
28669 },
28670 MakeItemVisible: function(index){
28671 },
28672 GetItem: function(index){
28673  var lb = this.GetListBoxControl();
28674  if(lb)
28675   return this.GetItemCore(index);
28676  else
28677   return null;
28678 },
28679 GetItemCore: function(index) {
28680  return this.GetListBoxControl().GetItem(index);
28681 },
28682 FindItemByText: function(text) {
28683  var lb = this.GetListBoxControl();
28684  if(lb)
28685   return lb.FindItemByText(text);
28686  return null;
28687 },
28688 FindItemByValue: function(value){
28689  var lb = this.GetListBoxControl();
28690  if(lb)
28691   return lb.FindItemByValue(value);
28692  return null;
28693 },
28694 GetItemCount: function(){
28695  var lb = this.GetListBoxControl();
28696  if(lb)
28697   return lb.GetItemCount(); 
28698  return 0;
28699 },
28700 GetSelectedIndex: function(){
28701  var lb = this.GetListBoxControl();
28702  if(lb)
28703   return lb.GetSelectedIndex();
28704  else
28705   return -1;
28706 },
28707 SetSelectedIndex: function(index){
28708  this.SelectIndex(index, false);
28709 },
28710 GetSelectedItem: function(){
28711  var lb = this.GetListBoxControl();
28712  var index = lb.GetSelectedIndex();
28713  return lb.GetItem(index);
28714 },
28715 SetSelectedItem: function(item){
28716  var index = (item != null) ? item.index : -1;
28717  this.SelectIndex(index, false);
28718 },
28719 GetText: function(){
28720  return this.lastSuccessText;
28721 },
28722 PerformCallback: function(arg) {
28723 },
28724 ClearItemsInternal: function(){
28725  this.SetValue(null);
28726  this.CollectionChanged();
28727 },
28728 GetModifyEvent: function() {
28729  if(this.isNative)
28730   return this.SelectedIndexChanged;
28731  else
28732   return ASPxClientDropDownEditBase.prototype.GetModifyEvent.call(this);
28733 }
28734});
28735var ASPxClientComboBox = ASPx.CreateClass(ASPxClientComboBoxBase, {
28736 constructor: function(name) {
28737  this.constructor.prototype.constructor.call(this, name);
28738  this.allowMultipleCallbacks = false;
28739  this.allowNull = false;
28740  this.isCallbackMode = false;
28741  this.loadDropDownOnDemand = false;
28742  this.needToLoadDropDown = false;
28743  this.isPerformCallback = false;
28744  this.changeSelectAfterCallback = 0;
28745  this.incrementalFilteringMode = "Contains";
28746  this.filterStrategy = null;
28747  this.filterTimer = ASPx.Browser.WebKitTouchUI ? 300 : 100; 
28748  this.filterMinLength = 0;
28749  this.customFiltering = false;
28750  this.initTextCorrectionRequired = false;
28751  this.isDropDownListStyle = true;
28752  this.defaultDropDownHeight = "";
28753  this.dropDownHeight = "";
28754  this.dropDownWidth = "";
28755  this.dropDownRows = 7;
28756  this.enterKeyPressed = false;
28757  this.onLoadDropDownOnDemandCallbackFinalizedEventHandler = null;
28758  this.callBackCoreComplete = false; 
28759  this.adroidSamsungBugTimeout = 0; 
28760  this.isNeedToForceFirstShowLoadingPanel = true; 
28761  this.forceLoadCustomRangeOnDropDown = false;
28762  this.needToInitPopupWindowOnShow = false;
28763  this.ItemFiltering = new ASPxClientEvent();
28764  this.CustomHighlighting = new ASPxClientEvent();
28765 },
28766 Initialize: function(){
28767  this.needToLoadDropDown = this.loadDropDownOnDemand;
28768  var lb = this.GetListBoxControl();
28769  this.InitializeListBoxOwnerName();
28770  this.InitScrollSpacerVisibility();
28771  this.InitializeFilterStrategy();
28772  var mainElement = this.GetMainElement();
28773  var input = this.GetInputElement();    
28774  var ddbutton = this.GetDropDownButton();
28775  ASPx.Evt.AttachEventToElement(input, "paste", this.SyncRawValueIfHasTextDecorators.bind(this, true));
28776  if(this.isDropDownListStyle && ASPx.Browser.WindowsPlatform && ASPx.Browser.Safari) {
28777   ASPx.Evt.AttachEventToElement(this.GetInputElement(), "blur", function() {
28778    var inputElementValue = this.GetInputElement().value;
28779    if(!this.focusEventsLocked && !inputElementValue && !!this.GetText())
28780     this.OnTextChanged();
28781   }.aspxBind(this)); 
28782  }
28783  if(this.isToolbarItem) {
28784   mainElement.unselectable="on";
28785   input.unselectable="on";
28786   if(input.offsetParent)
28787    input.offsetParent.unselectable="on";
28788   if(ddbutton)
28789    ddbutton.unselectable="on";
28790   if(lb)
28791    lb.SetItemRowsUnselectable();
28792  }
28793  this.RemoveRaisePSValidationFromListBox();
28794  this.RedirectStandardValidators();
28795  if(lb && lb.GetItemCount() > 0)
28796   this.EnsureListBoxSelectionSynchronized(lb);
28797  ASPxClientComboBoxBase.prototype.Initialize.call(this);
28798 },
28799 InitScrollSpacerVisibility: function() {
28800  var lb = this.GetListBoxControl();
28801  if(!lb || lb.GetItemCount() >= lb.callbackPageSize)
28802   return;
28803  lb.SetScrollSpacerVisibility(true, false);
28804  lb.SetScrollSpacerVisibility(false, false);
28805 },
28806 InitializeFilterStrategy: function() {
28807  var fs = this.filterStrategy;
28808  ASPx.Evt.AttachEventToElement(this.GetInputElement(), "keydown", fs.OnKeyDown.bind(fs));
28809 },
28810 CreateFilterStrategy: function() {
28811  if(this.incrementalFilteringMode == "Contains")
28812   return new ComboBoxContainsFilterStrategy(this);
28813  else if(this.incrementalFilteringMode == "StartsWith")
28814   return new ComboBoxStartsWithFilterStrategy(this);
28815  else if(this.incrementalFilteringMode == "None")
28816   return new ComboBoxDisabledFilterStrategy(this);
28817 },
28818 shouldStartUserInputTimer: function() {
28819  return true;
28820 },
28821 onInputChangedOnUserInputTimer: function(onRestart) {
28822  ASPxClientDropDownEditBase.prototype.onInputChangedOnUserInputTimer.call(this);
28823  if (!onRestart) {
28824   this.SyncRawValueIfHasTextDecorators();
28825   this.filterStrategy.OnInput();
28826  }
28827 },
28828 RaiseItemFiltering: function(item, filter, isFit) {
28829  if(!this.ItemFiltering.IsEmpty()) {
28830   var args = new ASPxClientListEditItemFilteringEventArgs(item, filter, isFit);
28831   this.ItemFiltering.FireEvent(this, args);
28832   isFit = args.isFit;
28833  }
28834  return isFit;
28835 },
28836 RaiseCustomHighlighting: function(filter, callbackHighlighting) {
28837  if(!this.CustomHighlighting.IsEmpty()) {
28838   var args = new ASPxClientListEditCustomHighlightingEventArgs(filter);
28839   args.highlighting = callbackHighlighting;
28840   this.CustomHighlighting.FireEvent(this, args);
28841   return args.highlighting;
28842  }
28843  return callbackHighlighting;
28844 },
28845 InlineInitialize: function() {
28846  this.BeforeInlineInitialize();
28847  this.filterStrategy = this.CreateFilterStrategy();
28848  ASPxClientComboBoxBase.prototype.InlineInitialize.call(this);
28849 },
28850 UseSpecialKeyboardHandling: function() {
28851  return true;
28852 },
28853 IsClearButtonVisibleAuto: function() {
28854  return this.allowNull && ASPxClientComboBoxBase.prototype.IsClearButtonVisibleAuto.call(this);
28855 },
28856 BeforeInlineInitialize: function() {
28857  this.lastSuccessValue = this.GetDecodeValue(this.lastSuccessValue);
28858  this.InsureInputValueCorrect();
28859 },
28860 InsureInputValueCorrect: function(){ 
28861  if(this.initTextCorrectionRequired){
28862   var lb = this.GetListBoxControl();
28863   if(lb){
28864    var initSelectedIndex = lb.GetSelectedIndexInternal();
28865    if(initSelectedIndex >= 0){
28866     var initSelectedText = lb.GetItem(initSelectedIndex).text;
28867     var input = this.GetInputElement();
28868     if(ASPx.IsExists(this.GetRawValue()) && this.GetRawValue() != initSelectedText){
28869      this.SetRawValue(initSelectedText);
28870      this.SetInputValue(this.GetDecoratedText(initSelectedText));
28871     } 
28872     else if(input.value != initSelectedText)
28873      this.SetInputValue(initSelectedText);
28874    }
28875   }
28876  }
28877 },
28878 ChangeEnabledAttributes: function(enabled){
28879  ASPxClientComboBoxBase.prototype.ChangeEnabledAttributes.call(this, enabled);
28880  var changeEventsMethod = ASPx.Attr.ChangeEventsMethod(enabled);
28881  var mainElement = this.GetMainElement();
28882  if(mainElement)
28883   changeEventsMethod(mainElement, ASPx.Evt.GetMouseWheelEventName(), aspxCBMouseWheel);
28884  var btnElement = this.GetDropDownButton();
28885  if(btnElement)
28886   changeEventsMethod(btnElement, "onmousemove", ASPx.CBDDButtonMMove);
28887 },
28888 GetDropDownInnerControlName: function(suffix){
28889  return ASPxClientDropDownEditBase.prototype.GetDropDownInnerControlName.call(this, suffix);
28890 },
28891 AdjustControlCore: function() {
28892  ASPxClientEdit.prototype.AdjustControlCore.call(this);
28893  this.ResetDropDownSizeCache();
28894 },
28895 RemoveRaisePSValidationFromListBox: function() {
28896  var listBox = this.GetListBoxControl();
28897  if(listBox)
28898   listBox.RaisePersonalStandardValidation = function() { };
28899 },
28900 RedirectStandardValidators: function() {
28901  var valueInput = this.GetValueInput();
28902  if(ASPx.IsExistsElement(valueInput) && valueInput.Validators) {
28903   for(var i = 0; i < valueInput.Validators.length; i++)
28904    valueInput.Validators[i].controltovalidate = valueInput.id;
28905  }
28906 },
28907 GetValueInputToValidate: function(){
28908  return this.GetValueInput();
28909 },
28910 SetText: function(text, applyFilter) {
28911  ASPxClientComboBoxBase.prototype.SetText.call(this, text);
28912  if(applyFilter)
28913   this.filterStrategy.Filtering(true);
28914 },
28915 SetTextBase: function(text) {
28916  ASPxClientComboBoxBase.prototype.SetTextBase.call(this, text);
28917  this.restartCurrentUserInputTimer();
28918 },
28919 SetReadOnly: function(readOnly) {
28920  if(this.isDropDownListStyle && this.incrementalFilteringMode === "None")
28921   return;
28922  ASPxClientComboBoxBase.prototype.SetReadOnly.call(this, readOnly);
28923 },
28924 GetValueInput: function(){
28925  return document.getElementById(this.name + "_" + comboBoxValueInputSuffix);
28926 },
28927 GetListBoxScrollDivElement: function(){
28928  return this.GetListBoxControl().GetScrollDivElement();
28929 },
28930 RollbackValueInputValue: function(){
28931  var inputElement = this.GetValueInput();
28932  if(inputElement)
28933   inputElement.value = this.lastSuccessValue;
28934 },
28935 UpdateValueInput: function() {
28936  var inputElement = this.GetValueInput();
28937  if(inputElement) {
28938   var value = this.GetValue();
28939   inputElement.value = value != null ? value : "";
28940  }
28941 },
28942 SetInputValue: function(value) {
28943  var inputElement = this.GetInputElement();
28944  if(inputElement) {
28945   inputElement.value = value;
28946   this.restartCurrentUserInputTimer();
28947  }
28948 },
28949 CollectionChanged: function(filtering){
28950  this.GetSetValueOptimizeHelper().onItemCollectionChanged();
28951  var listBox = this.GetListBoxControl();
28952  listBox.CollectionChanged(filtering);
28953  var needUpdateDropDownPositionAndSize = listBox.APILockCount == 0 && (this.isShownAtFirst || this.pcIsShowingNow);
28954  if(needUpdateDropDownPositionAndSize)
28955   this.UpdateDropDownPositionAndSize();
28956 },
28957 UpdateDropDownPositionAndSize: function(){
28958  this.InitDropDownSize();
28959  if(this.droppedDown){
28960   var pc = this.GetPopupControl();
28961   if(pc)
28962    pc.UpdatePositionAtElement(this.GetMainElement());
28963  }
28964  if(!this.clientVisible)
28965   this.ResetControlAdjustment();
28966 },
28967 GetDropDownHeight: function(){
28968  if(this.ddHeightCache != ASPx.InvalidDimension)
28969   return this.ddHeightCache;
28970  this.EnsureDropDownWidth(); 
28971  return this.AdjustListBoxHeight();
28972 },
28973 GetDropDownWidth: function(){
28974  return (this.ddWidthCache != ASPx.InvalidDimension && !this.GetIsControlWidthWasChanged()) ? this.ddWidthCache : this.AdjustListBoxWidth();
28975 },
28976 EnsureDropDownWidth: function() {
28977  this.GetDropDownWidth();
28978 },
28979 InitDropDownSize: function() {
28980  if(!this.enabled || this.GetItemCount() == 0) return; 
28981  var pc = this.GetPopupControl();
28982  if(pc && this.IsDisplayed() && !this.IsHidden()) {
28983   var pcwElement = pc.GetCurrentWindowElement();
28984   if(ASPx.IsExistsElement(pcwElement)){
28985    var isPcwDisplayed = ASPx.GetElementDisplay(pcwElement);
28986    if(!isPcwDisplayed)
28987     pc.SetWindowDisplay(-1, true);
28988    var listBoxWidth = this.AdjustListBoxWidth();
28989    var listBoxHeight = this.AdjustListBoxHeight();
28990    if(listBoxHeight != this.ddHeightCache || listBoxWidth != this.ddWidthCache){
28991     this.ddHeightCache = listBoxHeight;
28992     this.ddWidthCache = listBoxWidth;
28993     pc.SetSize(this.ddWidthCache, this.ddHeightCache);
28994     pc.SetIsDragged(-1, false);
28995     pc.ShowAtElement(this.GetMainElement(), true);
28996    }
28997    if(!isPcwDisplayed)
28998     pc.SetWindowDisplay(-1, false);
28999   }
29000  } else {
29001   this.needToInitPopupWindowOnShow = true;
29002  }
29003 },
29004 InitMainElementCache: function(){
29005  this.mainElementWidthCache = this.GetMainElement().clientWidth;
29006 },
29007 GetDefaultDropDownHeight: function(listHeight, count){
29008  if(this.defaultDropDownHeight == ""){
29009   this.defaultDropDownHeight = ((listHeight / count) * this.dropDownRows) + "px";
29010  }
29011  return this.defaultDropDownHeight;
29012 },
29013 AdjustListBoxHeight: function () {
29014  return this.GetListBoxControl().AdjustHeightInDropDown(this.dropDownHeight, this.dropDownRows);
29015 },
29016 AdjustListBoxWidth: function () {
29017  this.InitMainElementCache();
29018  return this.GetListBoxControl().AdjustWidthInDropDown(this.GetMainElement(), this.isCallbackMode, this.dropDownWidth);
29019 },
29020 SelectIndexSilent: function(lb, index, lockScrollingToItem){
29021  this.lbEventLockCount ++;
29022  lb.SelectIndexSilentAndMakeVisible(index, lockScrollingToItem);
29023  this.ShowItemImageByIndex(index);
29024  this.lbEventLockCount --;
29025 },
29026 GetDecoratedText: function(text) {
29027  var result;
29028  var lb = this.GetListBoxControl();
29029  var hasMultiColumnFormattedSelectedItem = this.displayFormat != null &&
29030              lb && lb.IsMultiColumn() &&
29031              this.GetSelectedItem() != null;
29032  if(hasMultiColumnFormattedSelectedItem)
29033   result = this.GetMultiColumnFormattedSelectedItemText(lb);
29034  else
29035   result = ASPxClientComboBoxBase.prototype.GetDecoratedText.call(this, text);
29036  return result;
29037 },
29038 GetMultiColumnFormattedSelectedItemText: function(lb) {
29039  var selectedItem = this.GetSelectedItem();
29040  var textColumnCount = this.GetTextColumnCountForTextDecoration(lb, selectedItem);
29041  var texts = [textColumnCount];
29042  for(var i = 0; i < textColumnCount; i++)
29043   texts[i] = selectedItem.GetColumnTextByIndex(i);
29044  return ASPx.Formatter.Format(this.displayFormat, texts);
29045 },
29046 GetTextColumnCountForTextDecoration: function(lb, item) {
29047  return lb.GetItemTextCellCount();
29048 },
29049 CanApplyNullTextDecoration: function() {
29050  var result;
29051  if(this.GetListBoxControl() || !this.loadDropDownOnDemand) {
29052   var value = this.isInitialized ? this.GetRawValue() : this.GetValue();
29053   var isValueNull = this.convertEmptyStringToNull && value === "" ? true : value === null;
29054   result = this.GetSelectedIndex() == -1 && isValueNull;
29055  } else
29056   result = this.GetCurrentText() === "";
29057  return result;
29058 },
29059 ForceTextChanged: function() {
29060  if(this.isCallbackMode && this.filterStrategy)
29061   this.filterStrategy.ClearFilterApplied();
29062  ASPxClientComboBoxBase.prototype.ForceTextChanged.call(this);
29063 },
29064 ShowDropDownArea: function(isRaiseEvent){
29065  if(this.needToLoadDropDown) {
29066   this.EnsureDropDownLoaded();
29067   return;
29068  }
29069  if(this.RequireLoadCustomRangeOnDropDown()){
29070   this.LoadCustomItemsRange();
29071   return;
29072  }
29073  var lb = this.GetListBoxControl();
29074  if(!lb || (!this.isDropDownModal() && !lb.GetItemCount()))
29075   return;
29076  if(!this.filterStrategy.IsFilterMeetRequirementForMinLength() && !this.isDropDownModal()) {
29077   this.DropDownButtonPop(true); 
29078   return;
29079  }
29080  if(this.needToInitPopupWindowOnShow) {
29081   this.needToInitPopupWindowOnShow = false;
29082   this.InitDropDownSize();
29083  }
29084  ASPxClientDropDownEditBase.prototype.ShowDropDownArea.call(this, isRaiseEvent);
29085  this.EnsureListBoxSelectionSynchronized(lb);
29086  this.EnsureSelectedItemVisibleOnShow(lb);
29087  lb.CallbackSpaceInit();
29088  if(this.accessibilityCompliant)
29089   this.GetAccessibilityHelper().SetExpandedState(true);
29090  if(!lb.GetItemCount())
29091   this.onNoResultsFiltering();
29092  if(!this.filterStrategy.IsFilterMeetRequirementForMinLength())
29093   this.onProcessFilterLessMinLength();
29094 },
29095 ForceShowLoadingPanel: function() {
29096  if(this.GetItemCount() == 0 && !this.needToLoadDropDown) {
29097   var lb = this.GetListBoxControl();
29098   if(lb) {
29099    var sizes = { width: this.GetWidth(), height: 100 };
29100    ASPxClientDropDownEditBase.prototype.ShowDropDownArea.call(this, false, sizes);
29101    lb.SetHeight(sizes.height);
29102    lb.SetWidth(sizes.width);
29103   }
29104  }
29105 },
29106 FireFoxRequiresCacheScrollBar: function(){
29107  return ASPx.Browser.Firefox && ASPx.Browser.Version >= 3.6; 
29108 },
29109 BrowserRequiresCacheScrollBar: function(){
29110  return ASPx.Browser.WebKitFamily || ASPx.Browser.Opera || this.FireFoxRequiresCacheScrollBar(); 
29111 },
29112 HideDropDownArea: function(isRaiseEvent){
29113  if(this.filterStrategy)
29114   this.filterStrategy.OnDropDownHideArea();
29115  if(this.BrowserRequiresCacheScrollBar())
29116   this.CachedScrollTop();
29117  ASPxClientDropDownEditBase.prototype.HideDropDownArea.call(this, isRaiseEvent);
29118  if(this.accessibilityCompliant)
29119   this.GetAccessibilityHelper().SetExpandedState(false);
29120 },
29121 EnsureSelectedItemTextSynchronized: function(){
29122  var selectedItem = this.GetSelectedItem();
29123  if(!this.CanSynchronizeSelectedItemText(selectedItem))
29124   return;
29125  var textUnsynchronized = this.GetText() !== selectedItem.text;
29126  var textDecorationUnsynchronized = this.HasTextDecorators() && this.CanApplyTextDecorators() && 
29127   this.GetDecoratedText(selectedItem.text) !== this.GetInputElement().value; 
29128  if(textUnsynchronized || textDecorationUnsynchronized || !this.IsImageSynchronized(selectedItem)) {
29129   this.SetTextBase(selectedItem.text);
29130   this.ShowItemImage(selectedItem);
29131   this.SetLastSuccessText(selectedItem.text);
29132   this.UpdateValueInput();
29133  }
29134 },
29135 IsImageSynchronized: function(selectedItem) {
29136  var ddImageElement = this.GetDropDownImageElement();
29137  var imageUrl = selectedItem.imageUrl != "" ? selectedItem.imageUrl : ASPx.Url.GetAbsoluteUrl(ASPx.EmptyImageUrl);
29138  return !ddImageElement || ASPx.ImageUtils.GetImageSrc(ddImageElement) === imageUrl;
29139 },
29140 CanSynchronizeSelectedItemText: function(selectedItem) {
29141  return !!selectedItem;
29142 },
29143 EnsureListBoxSelectionSynchronized: function(listBox){
29144  var rawText = this.GetTextInternal();
29145  var lbItem = listBox.GetSelectedItem();
29146  var lbText = lbItem != null ? lbItem.text : "";
29147  var isTextsExist = rawText != null && lbText != "";
29148  var needSynchronize = rawText != lbText || !this.isInitialized;
29149  if(needSynchronize && isTextsExist) {
29150   this.SynchronizeListBoxSelection(listBox, rawText);
29151   if(!this.isInitialized && this.IsValueRestoredByBrowser())
29152    this.SynchronizeListBoxInitSelection();
29153  }
29154 },
29155 SynchronizeListBoxSelection: function(listBox, rawText) {
29156  var newSelectedIndex = this.GetAdjustedSelectedIndexByText(listBox, rawText);
29157  listBox.SelectIndexSilent(newSelectedIndex, false);
29158 },
29159 SynchronizeListBoxInitSelection: function() {
29160  setTimeout(function () {
29161   var inputText = this.GetInputElement().value;
29162   var selectedItem = this.FindItemByText(inputText);
29163   if(selectedItem)
29164    this.SelectIndex(selectedItem.index, true);
29165  }.aspxBind(this), 0);
29166 },
29167 EnsureSelectedItemVisibleOnShow: function(listBox){
29168  if(this.BrowserRequiresCacheScrollBar()) 
29169   listBox.RestoreScrollTopFromCache();
29170  listBox.EnsureSelectedItemVisible();
29171 },
29172 CachedScrollTop: function(){
29173  this.GetListBoxControl().CachedScrollTop();
29174  if(this.BrowserRequiresCacheScrollBar()){ 
29175   var scrollDiv = this.GetListBoxScrollDivElement();
29176   if(scrollDiv != null)
29177    scrollDiv.scrollTop = 0;
29178  }
29179 },
29180 IsFilterEnabled: function() {
29181  return this.incrementalFilteringMode != "None";
29182 },
29183 ChangeInputEnabled: function(element, enabled, readOnly){
29184  ASPxClientTextEdit.prototype.ChangeInputEnabled.call(this, element, enabled, readOnly || (this.isDropDownListStyle && !this.IsFilterEnabled()));
29185 },
29186 GetCallbackArguments: function(){
29187  var args = ASPxClientComboBoxBase.prototype.GetCallbackArguments.call(this);
29188  args += this.filterStrategy.GetCallbackArguments();
29189  return args;
29190 },
29191 ClearEditorValueByClearButtonCore: function() {
29192  this.enterKeyPressed = false;
29193  ASPxClientDropDownEditBase.prototype.ClearEditorValueByClearButtonCore.call(this);
29194  if(!this.IsFilterEnabled() && this.isDropDownListStyle)
29195   this.HideDropDownArea();
29196  else
29197   this.filterStrategy.OnClearButtonClick();
29198 },
29199 ResetEditorState: function() {
29200  ASPxClientComboBoxBase.prototype.ResetEditorState.call(this);
29201  this.isNeedToForceFirstShowLoadingPanel = true;
29202  this.filterStrategy.ResetCallbackState();
29203 },
29204 IsFilterRollbackRequiredAfterApply: function() {
29205  var filterRollbackRequired = !this.GetSelectedItem() && !this.focused && this.InCallback();
29206  return filterRollbackRequired;
29207 },
29208 IsNullState: function() {
29209  return this.GetSelectedIndex() === -1 && ASPxClientComboBoxBase.prototype.IsNullState.call(this);
29210 },
29211 OnPost: function(args) {
29212  if(!args.isCallback && this.isDropDownListStyle && ASPx.GetFocusedElement() == this.GetInputElement())
29213   this.OnTextChangedInternal();
29214  ASPxClientComboBoxBase.prototype.OnPost.call(this, args);
29215 },
29216 GetLoadingParentElement: function(listBox) {
29217  return listBox.GetLoadingParentElement();
29218 },
29219 ShowLoadingPanel: function() { 
29220  var lb = this.GetListBoxControl();
29221  var loadingParentElement = this.GetLoadingParentElement(lb);
29222  if(!this.loadingPanelElement) {
29223   var loadingPanel = this.CreateLoadingPanelWithAbsolutePosition(loadingParentElement, loadingParentElement);
29224   lb.PreventMouseWheelOnElement(loadingPanel); 
29225  }
29226 },
29227 ShowLoadingDiv: function () {
29228  var lb = this.GetListBoxControl();
29229  var loadingParentElement = this.GetLoadingParentElement(lb);
29230  if(!this.loadingDivElement) {
29231   var loadingDiv = this.CreateLoadingDiv(loadingParentElement);
29232   lb.PreventMouseWheelOnElement(loadingDiv);
29233  }
29234 },
29235 HideLoadingPanelOnCallback: function(){
29236  return false;
29237 },
29238 OnCallback: function(result, callbackID) {
29239  if(!this.CanProcessCallbackResult(callbackID) || !this.GetMainElement())
29240   return;
29241  this.defaultDropDownHeight = "";
29242  if(ASPx.Browser.WebKitTouchUI) { 
29243   if(this.needToLoadDropDown)
29244    this.OnLoadDropDownOnDemandCallback(result.c);
29245   window.setTimeout(function() {
29246    this.OnCallbackCore(result);
29247    this.DoEndCallback();
29248   }.aspxBind(this), 300);
29249  } else
29250   this.OnCallbackCore(result);
29251 },
29252 OnCallbackCore: function(result) {
29253  if(result.serverMode)
29254   this.UpdateStateObjectWithObject({serverMode: true});
29255  if(this.needToLoadDropDown) {
29256   if(!ASPx.Browser.WebKitTouchUI)
29257    this.OnLoadDropDownOnDemandCallback(result.c);
29258  } else if(!this.filterStrategy.ShouldDiscardCallbackResult()) {
29259   this.OnCallbackBeforeListBox();
29260   this.OnListBoxCallback(result);
29261   this.OnCallbackInternal(result);
29262   this.OnCallbackFinally(true);
29263  }
29264  this.callBackCoreComplete = true;
29265 },
29266 OnListBoxCallback: function(result) {
29267  var selectedValue = this.GetValue();
29268  var selectedText = this.GetText();
29269  function shouldSelectSilent(value, text) {
29270   return value === selectedValue || text === selectedText;
29271  }
29272  this.GetListBoxControl().OnCallback(result, shouldSelectSilent);
29273  this.EnsureSelectedItemTextSynchronized();
29274 },
29275 OnLoadDropDownOnDemandCallbackFinalized: function() {
29276  this.DoReInitializeAfterLoadDropDownOnDemand();
29277  this.HideLoadingPanel();
29278  this.HideLoadingDiv();
29279  var isCallbackForShowDropDownArea = !this.onLoadDropDownOnDemandCallbackFinalizedEventHandler;
29280  if(isCallbackForShowDropDownArea) {
29281   this.ShowDropDown();
29282   if(this.isDropDownModal())
29283    this.onDropDownModalChanged(true);
29284  }
29285  else
29286   this.onLoadDropDownOnDemandCallbackFinalizedEventHandler();
29287  this.FixButtonState();
29288  this.initializeDropDown();
29289 },
29290 OnCallbackFinalized: function() {
29291  if(this.needToLoadDropDown)
29292   this.OnLoadDropDownOnDemandCallbackFinalized();
29293 },
29294 OnLoadDropDownOnDemandCallback: function(html) {
29295  var node = this.GetLoadedDropDownPrevSibling();
29296  var tempDiv = node.ownerDocument.createElement('div');
29297  tempDiv.innerHTML = html;
29298  var len = tempDiv.childNodes.length;
29299  for(var ind = len - 1; ind >= 0; ind--) {
29300   ASPx.InsertElementAfter(tempDiv.childNodes.item(ind), node);
29301  }
29302 },
29303 GetLoadedDropDownPrevSibling: function() {
29304  return this.GetMainElement();
29305 },
29306 ProcessCallbackError: function(errorObj, callbackID) {
29307  if(!this.CanProcessCallbackResult(callbackID))
29308   return;
29309  this.callBackCoreComplete = true;
29310  ASPxClientDropDownEditBase.prototype.ProcessCallbackError.call(this, errorObj);
29311 },
29312 DoEndCallback: function(){ 
29313  if(!this.callBackCoreComplete && ASPx.Browser.WebKitTouchUI || this.IsDoEndCallbackLocked()) {
29314   this.UnlockDoEndCallback();
29315   return;
29316  }
29317  this.filterStrategy.OnBeforeDoEndCallback();
29318  ASPxClientDropDownEditBase.prototype.DoEndCallback.call(this);
29319  this.filterStrategy.OnAfterDoEndCallback();
29320  this.callBackCoreComplete = false; 
29321 },
29322 RaiseEndCallback: function(){
29323  if(this.preventEndCallbackRising) {
29324   this.preventEndCallbackRising = false;
29325   ASPx.GetControlCollection().DecrementRequestCount(); 
29326  } else {
29327   ASPxClientDropDownEditBase.prototype.RaiseEndCallback.call(this);
29328  }
29329 },
29330 OnCallbackError: function(result, data) {
29331  var lb = this.GetListBoxControl();
29332  if(lb)
29333   lb.OnCallbackError(result);
29334  else
29335   ASPxClientComboBoxBase.prototype.OnCallbackError.call(this, result, data);
29336  this.OnCallbackFinally(false);
29337 },
29338 OnCallbackFinally: function(isSuccessful){
29339  this.filterStrategy.OnBeforeCallbackFinally();
29340  this.CollectionChanged();
29341  this.HideLoadingElements();
29342  if(this.isNeedToForceFirstShowLoadingPanel)
29343   this.isNeedToForceFirstShowLoadingPanel = false;
29344  this.isPerformCallback = false;
29345  this.changeSelectAfterCallback = 0;
29346  if(isSuccessful)
29347   this.filterStrategy.OnAfterCallbackFinally();
29348 },
29349 OnCallbackBeforeListBox: function(){
29350  var lb = this.GetListBoxControl();
29351  this.changeSelectAfterCallback = lb.changeSelectAfterCallback;
29352 },
29353 OnCallbackCorrectSelectedIndex: function(){
29354  var lb = this.GetListBoxControl();
29355  if(this.changeSelectAfterCallback != 0)
29356   this.SetTextInternal(lb.GetSelectedItem().text);
29357 },
29358 OnCallbackInternal: function(result){
29359  this.OnCallbackCorrectSelectedIndex();
29360  if(this.isPerformCallback) {
29361   var lb = this.GetListBoxControl();
29362   if(!lb.GetItemCount()) {
29363    this.onNoResultsFiltering();
29364    if(!this.isDropDownModal())
29365     this.HideDropDownArea(true);
29366   }
29367  }
29368  this.filterStrategy.OnCallback(result);
29369 },
29370 DoReInitializeAfterLoadDropDownOnDemand: function() {
29371  this.InitializeListBoxOwnerName();
29372  this.needToLoadDropDown = false;
29373 },
29374 CancelLoadCustomRangeOnDropDown: function() {
29375  delete this.customItemsRangeInfo;
29376 },
29377 ForceLoadCustomItemsRangeOnDropDown: function(startIndex, valueToSelect) {
29378  var count = this.GetListBoxControl().callbackPageSize;
29379  this.customItemsRangeInfo = { startIndex: startIndex, endIndex: startIndex + count - 1, valueToSelect: valueToSelect };
29380 },
29381 RequireLoadCustomRangeOnDropDown: function() { return !!this.customItemsRangeInfo; },
29382 LoadCustomItemsRange: function() {
29383  if(this.InCallback()) return;
29384  this.ClearItems();
29385  this.ShowInputLoadingPanel();
29386  var startIndex = this.customItemsRangeInfo.startIndex;
29387  var endIndex = this.customItemsRangeInfo.endIndex;
29388  var value = this.customItemsRangeInfo.valueToSelect;
29389  var callbackArgs = this.GetListBoxControl().GetLoadCustomItemsRangeCallbackArguments(startIndex, endIndex, value);
29390  this.SendSpecialCallback(callbackArgs, function() { this.OnSuccessCustomItemsRangeLoad(); }.aspxBind(this));
29391 },
29392 OnSuccessCustomItemsRangeLoad: function() {
29393  var info = this.customItemsRangeInfo;
29394  if(!info) return;
29395  var listBox = this.GetListBoxControl();
29396  var startIndex = info.startIndex;
29397  listBox.serverIndexOfFirstItem = startIndex;
29398  listBox.SetScrollSpacerVisibility(true, startIndex > 0);
29399  if(ASPx.IsExists(info.valueToSelect))
29400   this.SetValue(info.valueToSelect);
29401  this.CancelLoadCustomRangeOnDropDown();
29402  this.ShowDropDown();
29403 },
29404 EnsureDropDownLoaded: function(callbackFunction) {
29405  if(this.needToLoadDropDown) {
29406   this.onLoadDropDownOnDemandCallbackFinalizedEventHandler = callbackFunction ? function() {
29407    callbackFunction();
29408   } : null;
29409   var args = this.FormatLoadDropDownOnDemandCallbackArguments();
29410   this.SendLoadDropDownOnDemandCallback(args);
29411  }
29412 },
29413 IsDropDownButtonClick: function(evt) {
29414  return ASPx.GetIsParent(this.GetDropDownButton(), ASPx.Evt.GetEventSource(evt));
29415 },
29416 OnDropDown: function(evt) {
29417  var returnValue = ASPxClientDropDownEditBase.prototype.OnDropDown.call(this, evt);
29418  if(this.IsDropDownButtonClick(evt) && this.IsCanToDropDown()) {
29419   this.OnDropDownButtonClick(evt);
29420   return returnValue;
29421  }
29422  return true;
29423 },
29424 OnDropDownButtonClick: function(evt) {
29425  if(this.filterStrategy != null)
29426   this.filterStrategy.OnDropDownButtonClick();     
29427  this.ForceRefocusEditor(evt);
29428 },
29429 SendCallback: function(onSuccess){
29430  if(!this.pcIsShowingNow)
29431   this.ShowLoadingElements();
29432  ASPxClientComboBoxBase.prototype.SendCallback.call(this, onSuccess);
29433 },
29434 IsAndroidKeyEventsLocked: function() {
29435  return ASPx.Browser.AndroidMobilePlatform && this.androidKeyEventsLocked;
29436 },
29437 LockAndroidKeyEvents: function() {
29438  this.androidKeyEventsLocked = true;
29439 },
29440 UnlockAndroidKeyEvents: function() {
29441  this.androidKeyEventsLocked = false;
29442 },
29443 CancelChangesOnUndo: function() {
29444  if(this.isCallbackMode)
29445   this.SetTextInternal(this.lastSuccessText);
29446  else
29447   this.OnCancelChanges();
29448  this.filterStrategy.OnUndo();
29449 },
29450 OnKeyDown: function(evt) {
29451  if(this.IsCtrlZ(evt)) {
29452   this.CancelChangesOnUndo();
29453   return ASPx.Evt.PreventEvent(evt);
29454  }
29455  var isClearKey = ASPx.Data.ArrayIndexOf([ASPx.Key.Delete, ASPx.Key.Backspace], evt.keyCode) >= 0;
29456  if(isClearKey && this.allowNull && (this.IsAllTextSelected() || this.isDropDownListStyle && !this.IsFilterEnabled()))
29457   this.ClearEditorValueAndForceOnChange();
29458  else if(this.IsAndroidKeyEventsLocked())
29459   return ASPx.Evt.PreventEventAndBubble(evt);
29460  else
29461   ASPxClientComboBoxBase.prototype.OnKeyDown.call(this, evt);
29462 },
29463 OnKeyUp: function(evt) {
29464  if(this.IsAndroidKeyEventsLocked())
29465   return ASPx.Evt.PreventEventAndBubble(evt);
29466  return ASPxClientComboBoxBase.prototype.OnKeyUp.call(this, evt);
29467 },
29468 IsAllTextSelected: function() {
29469  var input = this.GetInputElement();
29470  var textLength = input.value.length;
29471  if(textLength === 0)
29472   return false;
29473  var selectionInfo = ASPx.Selection.GetExtInfo(input);
29474  var selectionLength = selectionInfo.endPos - selectionInfo.startPos;
29475  return selectionLength === textLength;
29476 },
29477 SelectNeighbour: function (step){
29478  if((this.isToolBarItem && !this.droppedDown) || this.GetReadOnly()) return;
29479  this.SelectNeighbourInternal(step);
29480 },
29481 SelectNeighbourInternal: function(step){
29482  var lb = this.GetListBoxControl();
29483  if(this.droppedDown)
29484   this.lbEventLockCount ++;
29485  lb.SelectNeighbour(step);
29486  if(this.droppedDown) {
29487   var selectedItem = lb.GetSelectedItem();
29488   if (selectedItem) {
29489    this.OnSelectionChangedCore(selectedItem.text, selectedItem, true);
29490   }
29491   this.lbEventLockCount --;
29492  }
29493  if(this.accessibilityCompliant)
29494   this.GetAccessibilityHelper().SetLabelAttribute(null, null);
29495 },
29496 GetFocusSelectAction: function() {
29497  return this.isToolbarItem ? null : "all";
29498 },
29499 OnArrowUp: function(evt){
29500  if(!this.isInitialized) return true;
29501  if(this.RequireLoadCustomRangeOnDropDown() && !this.droppedDown) {
29502   this.LoadCustomItemsRange();
29503   return;
29504  }
29505  var isProcessed = ASPxClientDropDownEditBase.prototype.OnArrowUp.call(this, evt);
29506  if(!isProcessed && this.filterStrategy.CanNavigateByKbd())
29507   this.SelectNeighbour(-1);
29508  return true;
29509 },
29510 OnTextChanged: function () {
29511  if(!this.IsFocusEventsLocked())
29512   ASPxClientComboBoxBase.prototype.OnTextChanged.call(this);
29513 },
29514 OnTextChangedInternal: function() {
29515  if(!this.forceValueChanged) {
29516   var preserveFilterInInput = this.InCallback() && this.filterStrategy.currentCallbackIsFiltration;
29517   if(preserveFilterInInput) return;
29518  }
29519  ASPxClientComboBoxBase.prototype.OnTextChangedInternal.call(this);
29520  if(this.filterStrategy)
29521   this.filterStrategy.OnTextChanged();
29522 },
29523 OnArrowDown: function(evt){
29524  if(!this.isInitialized) return true;
29525  if(this.RequireLoadCustomRangeOnDropDown() && !this.droppedDown) {
29526   this.LoadCustomItemsRange();
29527   return;
29528  }
29529  var isProcessed = ASPxClientDropDownEditBase.prototype.OnArrowDown.call(this, evt);
29530  if(!isProcessed && this.filterStrategy.CanNavigateByKbd())
29531   this.SelectNeighbour(1);
29532  return true;
29533 },
29534 OnPageUp: function(){
29535  if(!this.isInitialized || !this.filterStrategy.CanNavigateByKbd()) return true;
29536  return this.OnPageButtonDown(false);
29537 },
29538 OnPageDown: function(){
29539  if(!this.isInitialized || !this.filterStrategy.CanNavigateByKbd()) return true;
29540  return this.OnPageButtonDown(true);
29541 },
29542 OnPageButtonDown: function(isDown){
29543  if(!this.isInitialized) return true;
29544  var lb = this.GetListBoxControl();
29545  if(lb){
29546   var direction = isDown ? 1 : -1;
29547   this.SelectNeighbour(lb.scrollPageSize * direction);
29548  }
29549  return true;
29550 },
29551 OnHomeKeyDown: function(evt){
29552  if(!this.isInitialized) return true;
29553  return this.OnHomeEndKeyDown(evt, true);
29554 },
29555 OnEndKeyDown: function(evt){
29556  if(!this.isInitialized) return true;
29557  return this.OnHomeEndKeyDown(evt, false);
29558 },
29559 OnHomeEndKeyDown: function(evt, isHome){
29560  if(!this.isInitialized) return true;
29561  var input = this.GetValueInput();
29562  if((input && input.readOnly) || evt.ctrlKey){
29563   var lb = this.GetListBoxControl();
29564   var count = lb.GetItemCount();
29565   this.SelectNeighbour(isHome ? -count : count);
29566   return true;
29567  }
29568  return false;
29569 },
29570 OnEscape: function() {
29571  this.filterStrategy.OnEscape();
29572  return ASPxClientComboBoxBase.prototype.OnEscape.call(this);
29573 },
29574 OnEnter: function(){
29575  if(!this.isInitialized) return true;
29576  if(this.isDropDownListStyle) this.enterKeyPressed = true;
29577  if(this.filterStrategy.IsCloseByEnterLocked()) return;
29578  this.enterProcessed = this.droppedDown; 
29579  if(!this.isEnterLocked) { 
29580   this.OnApplyChangesAndCloseWithEvents();
29581   this.filterStrategy.OnAfterEnter();
29582  }
29583  return this.enterProcessed;
29584 },
29585 OnTab: function(evt){
29586  if(!this.isInitialized) 
29587   return true;
29588  if(this.InCallback())
29589   this.filterStrategy.callbackProcessingStateManager.SetApply();
29590  else
29591   this.OnApplyChangesAndCloseWithEvents();
29592 },
29593 OnApplyChanges: function(){
29594  if(!this.focused || (this.isDropDownListStyle && !this.IsFilterEnabled())) return;
29595  this.OnApplyChangesInternal();
29596 },
29597 OnApplyChangesAndCloseWithEvents: function() {
29598  this.OnApplyChangesInternal();
29599  this.HideDropDownArea(true);
29600 },
29601 OnApplyChangesInternal: function(){
29602  var inCallback = this.InCallback();
29603  var lb = this.GetListBoxControl();
29604  var isChanged = this.HasChanges();
29605  var isRollback = false;
29606  if(isChanged || this.filterStrategy.isTotallyMismatchedFilter) {
29607   this.filterStrategy.isTotallyMismatchedFilter = false;
29608   this.filterStrategy.needEmptyFilterBeforeFiltering = false;
29609   var text = this.GetCurrentText();
29610   if(this.filterStrategy.OnApplyChanges())
29611    return;
29612   var adjustedSelectedIndex = this.GetAdjustedSelectedIndexByText(lb, text);
29613   var isNullState = this.allowNull && !text;
29614   var rollbackRequired = this.isDropDownListStyle && adjustedSelectedIndex < 0 && !isNullState;
29615   if(rollbackRequired) {
29616    var rollbackToItem = lb.GetSelectedItem();
29617    isRollback = rollbackToItem == null && this.isCallbackMode; 
29618    if(isRollback) {
29619     this.RollbackValueInputValue();
29620     this.RollbackTextInputValue();
29621    }
29622    text = rollbackToItem != null ? rollbackToItem.text : this.lastSuccessText;
29623   } 
29624   if(!isRollback) {
29625    var adjustedSelectedItem = this.GetItem(adjustedSelectedIndex);
29626    var adjustedSelectedItemText = adjustedSelectedItem && adjustedSelectedItem.text;
29627    text = adjustedSelectedItemText || text;
29628    var hasChanges = this.HasChanges(text);
29629    this.SetText(text);
29630    if(hasChanges)
29631     this.OnChange();
29632   }
29633   else if(!inCallback) {
29634    this.filterStrategy.OnFilterRollback();
29635   }
29636  } 
29637 },
29638 GetCurrentText: function(){
29639  var textDecorated = !this.focused && this.GetRawValue() != null;
29640  return textDecorated ? this.GetRawValue() : this.GetInputElement().value;
29641 },
29642 GetCurrentValue: function(){
29643  var value = null;
29644  var selectedItem = this.listBox.GetSelectedItem();
29645  if(selectedItem && (selectedItem.value !== "" || !this.convertEmptyStringToNull))
29646   value = selectedItem.value;
29647  return selectedItem ? value : this.GetValue();
29648 },
29649 HasChanges: function(currentText){
29650  currentText = currentText === undefined ? this.GetCurrentText() : currentText;
29651  return this.lastSuccessText != currentText || this.lastSuccessValue != this.GetCurrentValue();
29652 },
29653 OnButtonClick: function(number){
29654  if(number != this.dropDownButtonIndex) {
29655   if(this.droppedDown)
29656    this.OnApplyChangesAndCloseWithEvents(false);
29657   else
29658    ASPxClientComboBoxBase.prototype.OnTextChanged.call(this);
29659  }
29660  ASPxClientButtonEditBase.prototype.OnButtonClick.call(this, number);
29661 },
29662 OnCancelChanges: function(){
29663  var isCancelProcessed = ASPxClientDropDownEditBase.prototype.OnCancelChanges.call(this);
29664  this.filterStrategy.OnCancelChanges();
29665  var lb = this.GetListBoxControl();
29666  if(ASPx.IsExists(lb)) {
29667   var index = this.GetAdjustedSelectedIndexByText(lb, this.lastSuccessText);
29668   this.SelectIndexSilent(lb, index);
29669  }
29670  return isCancelProcessed;
29671 },
29672 ShouldCloseOnMCMouseDown: function () {
29673  return this.GetInputElement().readOnly;
29674 },
29675 OnCloseUp: function(evt){
29676  var evt = ASPx.Evt.GetEvent(evt);
29677  if(ASPx.Browser.Firefox && evt.type == "mouseup" && ASPx.Evt.GetEventSource(evt).tagName == "DIV") { 
29678   var scrollDiv = this.GetListBoxControl().GetScrollDivElement();
29679   var scrollDivID = scrollDiv ? scrollDiv.id : "";
29680   if(scrollDivID == ASPx.Evt.GetEventSource(evt).id) 
29681    return;
29682  }
29683  ASPxClientDropDownEditBase.prototype.OnCloseUp.call(this, evt);
29684 },
29685 OnDDButtonMouseMove: function(evt){
29686  return (this.droppedDown ? ASPx.Evt.CancelBubble(evt) : true);
29687 },
29688 CloseDropDownByDocumentOrWindowEvent: function(causedByWindowResizing) {
29689  if(!this.InCallback()) {
29690   this.OnApplyChangesInternal();
29691   ASPxClientDropDownEditBase.prototype.CloseDropDownByDocumentOrWindowEvent.call(this, causedByWindowResizing);
29692  }
29693  this.filterStrategy.OnDropDownCloseByDocumentOrWindowEvent();
29694 },
29695 IsCanToDropDown: function() {
29696  if(this.loadDropDownOnDemand) {
29697   var lb = this.GetListBoxControl();
29698   return (!this.needToLoadDropDown && (lb.GetItemCount() || this.isDropDownModal()));
29699  }
29700  return ASPxClientDropDownEditBase.prototype.IsCanToDropDown.call(this);
29701 },
29702 OnPopupControlShown: function(){
29703  if(!this.isInitialized) return;
29704  if(ASPx.Browser.Opera) 
29705   this.GetListBoxControl().RestoreScrollTopFromCache();
29706  if(this.lockListBoxClick)
29707   this.RemoveLockListBoxClick();
29708  if(this.InCallback()) 
29709   this.ShowLoadingDivAndPanel();
29710  ASPxClientDropDownEditBase.prototype.OnPopupControlShown.call(this);
29711  if(!this.isShownAtFirst) {
29712   this.InitDropDownSize();
29713   this.isShownAtFirst = true;
29714  }
29715 },
29716 OnLBSelectedIndexChanged: function(){
29717  if(!this.lockListBoxClick) {
29718   this.OnSelectChanged();
29719   this.filterStrategy.OnSelectedIndexChanged();
29720   if(this.IsNavigationOnKeyPress()){
29721    if(!this.droppedDown) {
29722     ASPx.Selection.Set(this.GetInputElement());
29723    }
29724   } else if(this.focused) {
29725    if(ASPx.IsElementVisible(this.GetInputElement())) 
29726     this.ForceRefocusEditor();
29727    else {
29728     this.UnlockFocusEvents(); 
29729     this.OnLostFocus(); 
29730    }
29731   }
29732  }
29733 },
29734 IsNavigationOnKeyPress: function() {
29735  var lb = this.GetListBoxControl();
29736  return lb.IsScrollOnKBNavigationLocked();
29737 },
29738 OnListBoxItemMouseUp: function(evt){
29739  if(!this.lockListBoxClick && !this.InCallback()){
29740   this.OnApplyChangesInternal();
29741   this.OnCloseUp(evt);
29742  }
29743 },
29744 OnMouseWheel: function(evt){
29745  if(this.allowMouseWheel && !this.droppedDown && this.filterStrategy.CanNavigateByKbd()) {
29746   var wheelDelta = ASPx.Evt.GetWheelDelta(evt);
29747   if(wheelDelta > 0)
29748    this.SelectNeighbour(-1);
29749   else  if(wheelDelta < 0)
29750    this.SelectNeighbour(1);
29751   return ASPx.Evt.PreventEvent(evt);
29752  }
29753 },
29754 OnOpenAnotherDropDown: function(){
29755  this.OnApplyChangesAndCloseWithEvents();
29756 },
29757 ParseValue: function() {
29758  var forceValueChanged = !this.IsValueChanging() && this.IsValueChangeForced();
29759  var newText = this.GetInputElement().value;
29760  var oldText = this.GetText();
29761  var isNeedToParseValue = oldText != newText;
29762  if(isNeedToParseValue || forceValueChanged) {
29763   this.StartValueChanging();
29764   if(this.CanTextBeAccepted(newText, oldText) || forceValueChanged){
29765    if(isNeedToParseValue || newText)
29766     this.SetText(newText);
29767    this.OnChange();
29768   } else
29769    this.SetTextInternal(oldText);
29770   this.EndValueChanging();
29771  }
29772 },
29773 CanTextBeAccepted: function(newText, oldText){
29774  var notAnyTextCanBeAccepted = this.isDropDownListStyle;
29775  if(notAnyTextCanBeAccepted){
29776   var lb = this.GetListBoxControl();
29777   var newTextPresentInItemCollection = this.GetAdjustedSelectedIndexByText(lb, newText) != -1;
29778   return newTextPresentInItemCollection;
29779  }
29780  var wasTextErased = !newText && oldText;
29781  if((!wasTextErased) && this.nullText && this.CanApplyNullTextDecoration()) {
29782   return false;
29783  }
29784  return true;
29785 },
29786 MakeItemVisible: function(index){
29787  var lb = this.GetListBoxControl();
29788  lb.MakeItemVisible(index);
29789 },
29790 PerformCallback: function(arg, onSuccess) {
29791  this.isPerformCallback = true;
29792  this.CancelLoadCustomRangeOnDropDown();
29793  this.filterStrategy.OnPerformCallback();
29794  if(this.needToLoadDropDown) {
29795   var formatCallbackArg = function(prefix, arg) {  
29796    arg = arg.toString();
29797    return (ASPx.IsExists(arg) ? prefix + "|" + arg.length + ';' + arg + ';' : "");
29798   };
29799   if(arg === undefined || arg == null)
29800    arg = "";
29801   var performArgs = formatCallbackArg(ASPxClientListEdit.CONSTANTS.CALLBACK_PREFIXES.CUSTOM, arg);
29802   this.onLoadDropDownOnDemandCallbackFinalizedEventHandler = function() {
29803    var selectedItem = this.listBox.GetSelectedItem();
29804    if(selectedItem != null)
29805     this.SetTextInternal(selectedItem.text);
29806    var lb = this.GetListBoxControl();
29807    if(lb)
29808     lb.SetCustomCallbackArg(performArgs);
29809   };
29810   var loadItemsRangeArgs = formatCallbackArg(ASPxClientListEdit.CONSTANTS.CALLBACK_PREFIXES.LOAD_RANGE_ITEMS, "0:-2");
29811   var args = this.FormatLoadDropDownOnDemandCallbackArguments(performArgs + loadItemsRangeArgs);
29812   this.SendLoadDropDownOnDemandCallback(args, onSuccess);
29813  } else {
29814   this.ClearItemsInternal();
29815   this.GetListBoxControl().PerformCallback(arg, onSuccess);
29816  }
29817 },
29818 ClearItemsInternal: function(){
29819  ASPxClientComboBoxBase.prototype.ClearItemsInternal.call(this);
29820  var lbScrollDiv = this.GetListBoxScrollDivElement();
29821  if(lbScrollDiv)
29822   lbScrollDiv.scrollTop = "0px";
29823 },
29824 SendLoadDropDownOnDemandCallback: function(args, handler) {
29825  this.ShowInputLoadingPanel();
29826  this.SendSpecialCallback(args, handler);
29827 },
29828 ShowInputLoadingPanel: function() {
29829  var inputElement = this.GetInputElement();
29830  var inputParentElement = inputElement.parentNode;
29831  this.CreateLoadingDiv(inputParentElement, inputElement);
29832  this.CreateLoadingPanelWithAbsolutePosition(inputParentElement, inputElement);
29833 },
29834 FormatLoadDropDownOnDemandCallbackArguments: function(args) {
29835  var internalArgs = ASPx.IsExists(args) ? args.toString() : "";
29836  var resultArgs = loadDropDownOnDemandCallbackPrefix + "|0;;";
29837  return resultArgs + internalArgs;
29838 },
29839 CorrectCaretPositionInChrome: function() {
29840  if(!ASPx.Browser.Chrome) return;
29841  var currentSelection = ASPx.Selection.GetInfo(this.GetInputElement());
29842  if(currentSelection.startPos === currentSelection.endPos)
29843   ASPx.Selection.SetCaretPosition(this.GetInputElement(), 0);
29844 },
29845 ForceRefocusEditor: function(evt, isNativeFocus) {
29846  this.CorrectCaretPositionInChrome();
29847  this.refocusWhenInputClicked = this.IsElementBelongToInputElement(ASPx.Evt.GetEventSource(evt));
29848  ASPxClientButtonEditBase.prototype.ForceRefocusEditor.call(this, evt, isNativeFocus);
29849 },
29850 OnFocusCore: function () {
29851  if(this.needToLoadDropDown) {
29852   var args = this.FormatLoadDropDownOnDemandCallbackArguments();
29853   this.SendLoadDropDownOnDemandCallback(args);
29854  } else
29855   this.FixButtonState();
29856  ASPxClientDropDownEditBase.prototype.OnFocusCore.call(this);
29857 },
29858 FixButtonState: function() {
29859  var lb = this.GetListBoxControl();
29860  if(lb && this.ddButtonPushed) {
29861   this.DropDownButtonPop(true);
29862  }
29863 },
29864 getDropDownEventTargets: function() {
29865  return ASPxClientComboBoxBase.prototype.getDropDownEventTargets.call(this).concat([
29866   this.isDropDownListStyle ? this.getInputCell() : null,
29867  ]);
29868 },
29869 onDropDownModalChanged: function(enabled) {
29870  ASPxClientComboBoxBase.prototype.onDropDownModalChanged.call(this, enabled);
29871  if(!enabled) {
29872   if(!this.GetItemCount() || !this.filterStrategy.IsFilterMeetRequirementForMinLength())
29873    setTimeout(this.HideDropDownArea.bind(this, true), 0);
29874   this.showDropDownModalMessageElement(false);
29875  }
29876  this.GetListBoxControl().onDropDownModalChanged(enabled);
29877  this.UpdateDropDownPositionAndSize();
29878 },
29879 onProcessFilterLessMinLength: function() {
29880  if(this.isDropDownModal() && this.droppedDown)
29881   this.showDropDownModalMessageElement(true, this.isDropDownListStyle ? this.msgFilterMinLength : (this.msgFilterMinLength + "<br />" + this.msgFilterNoResults));
29882  if(!this.isDropDownModal())
29883   this.HideDropDownArea(true);
29884 },
29885 onNoResultsFiltering: function() {
29886  if(this.isDropDownModal() && this.droppedDown)
29887   this.showDropDownModalMessageElement(true, this.msgFilterNoResults);
29888 },
29889 onBeforeFiltering: function() {
29890  if(this.isDropDownModal() && this.droppedDown)
29891   this.showDropDownModalMessageElement(false);
29892 },
29893 showDropDownModalMessageElement: function(visible, message) {
29894  var listBox = this.GetListBoxControl();
29895  if(!listBox) 
29896   return;
29897  if(visible && !this.dropDownModalMessageElement) {
29898   this.dropDownModalMessageElement = document.createElement("div");
29899   this.dropDownModalMessageElement.className = "dxdd-info";
29900   listBox.GetMainElement().parentNode.insertBefore(this.dropDownModalMessageElement, listBox.GetMainElement());
29901  }
29902  else if(visible)
29903   this.dropDownModalMessageElement.style.display = "";
29904  else if(!visible && this.dropDownModalMessageElement)
29905   this.dropDownModalMessageElement.style.display = "none";
29906  if(visible && message)
29907   this.dropDownModalMessageElement.innerHTML = message;
29908  if(this.dropDownModalMessageElement)
29909   ASPx.SetElementDisplay(listBox.GetMainElement(), !visible);
29910 },
29911 onDropDownApplyCommandClick: function() {
29912  this.OnApplyChangesAndCloseWithEvents();
29913 },
29914 onDropDownCloseCommandClick: function() {
29915  this.OnEscape();
29916 },
29917 SetItemHtml: function(index, html) {
29918  this.GetListBoxControl().SetItemHtml(index, html);
29919 },
29920 SetItemTooltip: function(index, tooltip) { this.GetListBoxControl().SetItemTooltip(index, tooltip); },
29921 SetItemAttribute: function(index, attributeName, attributeValue) { this.GetListBoxControl().SetItemAttribute(index, attributeName, attributeValue); },
29922 AddItemCssClass: function(index, className) { this.GetListBoxControl().AddItemCssClass(index, className); },
29923 RemoveItemCssClass: function(index, className) { this.GetListBoxControl().RemoveItemCssClass(index, className); },
29924 SetItemTextCellHtml: function(itemIndex, textCellIndex, html) { this.GetListBoxControl().SetItemTextCellHtml(itemIndex, textCellIndex, html); },
29925 SetItemTextCellTooltip: function(itemIndex, textCellIndex, tooltip) { this.GetListBoxControl().SetItemTextCellTooltip(itemIndex, textCellIndex, tooltip); },
29926 SetItemTextCellAttribute: function(itemIndex, textCellIndex, attributeName, attributeValue) { this.GetListBoxControl().SetItemTextCellAttribute(itemIndex, textCellIndex, attributeName, attributeValue); },
29927 AddItemTextCellCssClass: function(itemIndex, textCellIndex, className) { this.GetListBoxControl().AddItemTextCellCssClass(itemIndex, textCellIndex, className); },
29928 RemoveItemTextCellCssClass: function(itemIndex, textCellIndex, className) { this.GetListBoxControl().RemoveItemTextCellCssClass(itemIndex, textCellIndex, className); },
29929 GetAccessibilityText: function() {
29930  var helper = this.GetAccessibilityHelper();
29931  return helper && helper.getListSelectedItemText() || this.GetCurrentText();
29932 }
29933});
29934ASPx.Ident.scripts.ASPxClientComboBox = true;
29935ASPxClientComboBox.Cast = ASPxClientControl.Cast;
29936var CallbackProcessingStateManager = function(){
29937 var states = { 
29938  Default:   0,
29939  Rollback:     1,
29940  Apply:     2,
29941  ApplyAfterRollback: 3
29942 };
29943 var state = states.Default;
29944 return {
29945  ResetState: function() {
29946   state = states.Default;
29947  },
29948  IsApply: function() {
29949   return state == states.Apply;
29950  },
29951  IsRollback: function() {
29952   return state == states.Rollback;
29953  },
29954  IsApplyAfterRollback: function() {
29955   return state == states.ApplyAfterRollback;
29956  },
29957  NoFilterPostProcessing: function() {
29958   return !this.IsApply() && !this.IsApplyAfterRollback() && !this.IsRollback();
29959  },
29960  SetRollback: function() {
29961   if(state == states.Default)
29962    state = states.Rollback;
29963  },
29964  SetApply: function() {
29965   if(state == states.Default)
29966    state = states.Apply;
29967  },
29968  SetApplyAfterRollback: function() {
29969   if(state == states.Default || state == states.Apply)
29970    state = states.ApplyAfterRollback;
29971  },
29972  OnCallbackResult: function(filterRollbackRequired) {
29973   if(state == states.Apply) {
29974    state = filterRollbackRequired ? states.ApplyAfterRollback : states.Default;
29975    return;
29976   }
29977   if(state == states.Rollback) {
29978    state = states.ApplyAfterRollback;
29979    return;
29980   }
29981   if(state == states.ApplyAfterRollback) {
29982    state = states.Default;
29983    return;
29984   }
29985  }
29986 };
29987};
29988var ASPxClientNativeComboBox = ASPx.CreateClass(ASPxClientComboBoxBase, {
29989 constructor: function(name) {
29990  this.constructor.prototype.constructor.call(this, name);
29991  this.initSelectedIndex = -1;
29992  this.raiseValueChangedOnEnter = false;
29993 },
29994 InlineInitialize: function () {
29995  ASPxClientComboBoxBase.prototype.InlineInitialize.call(this);
29996  var lb = this.GetListBoxControl();
29997  if(lb != null) lb.SetMainElement(this.GetMainElement());
29998  if(this.initSelectedIndex == -1) { 
29999   this.SelectIndex(this.initSelectedIndex, true);
30000  }
30001 },
30002 FindInputElement: function(){
30003  return this.GetMainElement();
30004 }, 
30005 GetDropDownInnerControlName: function(suffix){
30006  return this.name + suffix;
30007 },
30008 PerformCallback: function(arg) {
30009  this.GetListBoxControl().PerformCallback(arg);
30010 },
30011 GetTextInternal: function(){
30012  var selectedItem = this.GetSelectedItem();
30013  return (selectedItem != null) ? selectedItem.text : "";
30014 },
30015 HasTextDecorators: function() {
30016  return false;
30017 },
30018 SetText: function (text){
30019  var lb = this.GetListBoxControl();
30020  var index = this.FindItemIndexByText(lb, text);
30021  this.SelectIndex(index, false);
30022  this.SetLastSuccessText((index > -1) ? text : "");
30023  this.SetLastSuccessValue((index > -1) ? lb.GetValue() : null);
30024 },
30025 GetValue: function(){
30026  var selectedItem = this.GetSelectedItem();
30027  return (selectedItem != null) ? selectedItem.value : null;
30028 },
30029 SetValue: function(value){
30030  var lb = this.GetListBoxControl();
30031  if(lb){
30032   lb.SetValue(value);
30033   var item = lb.GetSelectedItem();
30034   var text = item ? item.text : value;
30035   this.SetLastSuccessText(item != null ? text : "");
30036   this.SetLastSuccessValue(item != null ? item.value : null);
30037  }
30038 },
30039 ForceRefocusEditor: function(){
30040 },
30041 OnCallback: function(result) {
30042  this.GetListBoxControl().OnCallback(result);
30043  if(this.GetItemCount() > 0)
30044   this.SetSelectedIndex(0);
30045 },
30046 OnTextChanged: function() {
30047  this.OnChange();
30048 },
30049 SetTextInternal: function(text){
30050 },
30051 SetTextBase: function(text){
30052 },
30053 ChangeEnabledAttributes: function(enabled){
30054  this.GetMainElement().disabled = !enabled;
30055  this.ChangeSpecialInputEnabledAttributes(this.GetMainElement(), ASPx.Attr.ChangeEventsMethod(enabled), true);
30056 }
30057});
30058var AccessibilityHelperComboBox = ASPx.CreateClass(ASPx.AccessibilityHelperBase, {
30059 constructor: function(comboBox) {
30060  this.constructor.prototype.constructor.call(this, comboBox);
30061  this.currentValue = null;
30062 },
30063 SetLabelAttribute: function(text, isItemSelected) {
30064  this.currentValue = this.control.GetValue();
30065  var message = text !== null ? this.getLabelText(text, isItemSelected) : this.getListSelectedItemText();
30066  this.PronounceMessage(message);
30067 },
30068 SetExpandedState: function(expanded) {
30069  this.SetLabelAttribute(null, null);
30070  var input = this.getInputElement();
30071  var expandArg =  { "aria-expanded": expanded };
30072  this.changeActivityAttributes(input, expandArg);
30073 },
30074 GetPronounceElement: function() {
30075  return this.getInputElement();
30076 },
30077 getLabelText: function(text, isItemSelected) {
30078  var blankText = ASPx.AccessibilitySR.BlankEditorText;
30079  if(!text)
30080   text = blankText;
30081  var itemsCount = this.getListBoxControl().GetVisibleItemCount();
30082  var formatString = ASPx.AccessibilitySR.ComboBoxFilteringResultFormatString;
30083  if(!isItemSelected || itemsCount == 1)
30084   formatString += ASPx.AccessibilitySR.ComboBoxCurrentTextFormatString;
30085  return ASPx.Str.ApplyReplacement(formatString, [["{0}", itemsCount],
30086   ["{1}", (isItemSelected || !this.control.lastSuccessText) ? text : this.control.lastSuccessText],
30087   ["{2}", this.getInputElement().value || blankText]]);
30088 },
30089 getListBoxControl: function() { return this.control.GetListBoxControl(); },
30090 getListSelectedItemText: function() {
30091  var lb = this.getListBoxControl();
30092  var selectedItem = lb.GetSelectedItem();
30093  var itemText = "";
30094  if(!!selectedItem) {
30095   var formatString = ASPx.AccessibilitySR.ItemPositionFormatString;
30096   var visibleIndex = this.control.isCallbackMode ? selectedItem.index + 1 : lb.GetIndexVisibleItem(selectedItem);
30097   var itemPositionText = ASPx.Str.ApplyReplacement(formatString, [["{0}", visibleIndex], ["{1}", lb.GetVisibleItemCount()]]);
30098   itemText = selectedItem.text + itemPositionText;
30099  } else {
30100   var input = this.getInputElement();
30101   itemText = !!input.value ? input.value : ASPx.AccessibilitySR.BlankEditorText;
30102  }
30103  return itemText;
30104 }
30105});
30106function setValueOptimizeHelper() {
30107 var itemCollectionWasChangedSinceLastSetValue = false;
30108 function canReSetValue() {
30109  return itemCollectionWasChangedSinceLastSetValue;
30110 }
30111 function onSetValue() {
30112  itemCollectionWasChangedSinceLastSetValue = false;
30113 }
30114 return {
30115  onItemCollectionChanged: function () {
30116   itemCollectionWasChangedSinceLastSetValue = true;
30117  },
30118  setValue: function (comboBox, newValue, methodName) {
30119   var item = comboBox.FindItemByValue(newValue);
30120   var reSetValue = comboBox.GetValue() === newValue;
30121   if (reSetValue && !canReSetValue() && (!item || item.selected)) return;
30122   comboBox.SetValueInternal(newValue);
30123   onSetValue();
30124  }
30125 };
30126}
30127ASPx.CBDDButtonMMove = function(evt){
30128 return ASPx.GetDropDownCollection().OnDDButtonMouseMove(evt);
30129};
30130function aspxCBMouseWheel(evt){
30131 var srcElement = ASPx.Evt.GetEventSource(evt);
30132 var focusedCB = ASPx.GetDropDownCollection().GetFocusedDropDown();
30133 if(focusedCB != null && ASPx.GetIsParent(focusedCB.GetMainElement(), srcElement))
30134  return focusedCB.OnMouseWheel(evt);
30135}
30136var ComboBoxDisabledFilterStrategy = ASPx.CreateClass(ASPx.ListEditFilterStrategyBase, {
30137 constructor: function(comboBox) {
30138  this.constructor.prototype.constructor.call(this, comboBox.filterTimer, comboBox.filterMinLength, comboBox.isCallbackMode);
30139  this.comboBox = comboBox;
30140  this.callbackProcessingStateManager = new CallbackProcessingStateManager();
30141 },
30142 OnDropDownCloseByDocumentOrWindowEvent: function() {
30143  if(this.comboBox.InCallback())
30144   this.callbackProcessingStateManager.SetApply();
30145 },
30146 OnAfterCallbackFinally: function() {
30147  if(this.callbackProcessingStateManager.IsApply() || this.callbackProcessingStateManager.IsApplyAfterRollback()) {
30148   this.comboBox.OnApplyChangesAndCloseWithEvents();
30149   this.callbackProcessingStateManager.ResetState();
30150  }
30151 },
30152 IsCloseByEnterLocked: function() { return false; },
30153});
30154var ComboBoxIncrementalFilterStrategyBase = ASPx.CreateClass(ASPx.ListEditIncrementalFilterStrategyBase, {
30155 constructor: function(comboBox) {
30156  this.constructor.prototype.constructor.call(this, comboBox.filterTimer, comboBox.filterMinLength, comboBox.isCallbackMode);
30157  this.comboBox = comboBox;
30158  this.isDropDownListStyle = comboBox.isDropDownListStyle;
30159  this.callbackProcessingStateManager = new CallbackProcessingStateManager();
30160  this.isTotallyMismatchedFilter = false;
30161 },
30162 OnInput: function() {
30163  if (!this.comboBox.allowNull && !this.GetInputFilterValue())
30164   this.ClearFilterApplied();
30165  ASPx.ListEditIncrementalFilterStrategyBase.prototype.OnInput.call(this);
30166 },
30167 OnKeyDown: function(evt) {
30168  var cbInputElement = this.comboBox.GetInputElement();
30169  var selInfo = ASPx.Selection.GetInfo(cbInputElement);
30170  if(selInfo.startPos != selInfo.endPos && evt.keyCode == ASPx.Key.Backspace) {
30171   var currentText = cbInputElement.value;
30172   var cutText = currentText.slice(0, selInfo.startPos) + currentText.slice(selInfo.endPos);
30173   var newFilter = ASPx.Str.PrepareStringForFilter(cutText);
30174   if(cutText != currentText && this.comboBox.filterStrategy.FilterCompareLower(newFilter)) {
30175    cbInputElement.value = cutText; 
30176    ASPx.Selection.SetCaretPosition(cbInputElement, selInfo.startPos);
30177   }
30178  }
30179 },
30180 OnEscape: function() {
30181  this.FilterStopTimer();
30182  if(this.InCallback())
30183   this.callbackProcessingStateManager.SetRollback();
30184 },
30185 OnUndo: function() {
30186  if(this.isCallbackMode)
30187   this.Filtering();
30188  else {
30189   this.FilteringStopClient();
30190   this.GetListBoxControl().EnsureSelectedItemVisible();
30191  }
30192 },
30193 OnApplyChanges: function () {
30194  if (this.IsFilterTimerActive()) {
30195   this.FilterNowAndApply();
30196   return true;
30197  }
30198  return false;
30199 },
30200 OnCancelChanges: function () {
30201  this.OnFilterRollback();
30202 },
30203 OnClearButtonClick: function () {
30204  if (!this.InCallback()) {
30205   this.FilteringStop();
30206   if (this.isCallbackMode)
30207    this.Filtering();
30208  }
30209 },
30210 OnDropDownCloseByDocumentOrWindowEvent: function() {
30211  if(this.InCallback())
30212   this.callbackProcessingStateManager.SetApply();
30213 },
30214 PreventEndCallbackRising: function() {
30215  this.comboBox.preventEndCallbackRising = true;
30216 },
30217 OnBeforeCallbackFinally: function() {
30218  this.currentCallbackIsFiltration = false;
30219 },
30220 OnAfterCallbackFinally: function() {
30221  var filterRollbackRequired = false;
30222  if(this.callbackProcessingStateManager.IsApply() || this.callbackProcessingStateManager.IsApplyAfterRollback()) {
30223   this.ApplyAfterFinalFiltrationCallback();
30224   filterRollbackRequired = this.comboBox.IsFilterRollbackRequiredAfterApply();
30225  }
30226  if(this.callbackProcessingStateManager.IsRollback())
30227   filterRollbackRequired = true;
30228  this.callbackProcessingStateManager.OnCallbackResult(filterRollbackRequired);
30229  if(filterRollbackRequired)
30230   window.setTimeout(this.OnFilterRollback.bind(this), 0);
30231 },
30232 OnPerformCallback: function() {
30233  this.ClearFilter();
30234 },
30235 CanNavigateByKbd: function() {
30236  return this.IsFilterMeetRequirementForMinLength();
30237 },
30238 ApplyAfterFinalFiltrationCallback: function() {
30239  var itemIsSelected = this.TrySelectItemAfterFilter();
30240  this.comboBox.HideDropDownArea();
30241  var requiredApplyFailed = this.comboBox.isDropDownListStyle && !itemIsSelected && this.comboBox.focused && this.callbackProcessingStateManager.IsApply();
30242  if(requiredApplyFailed)
30243   this.comboBox.ShowDropDownArea(true);
30244  var needApplyChanges = itemIsSelected || !this.comboBox.focused;
30245  if(needApplyChanges)
30246   this.comboBox.OnApplyChangesInternal();
30247 },
30248 TrySelectItemAfterFilter: function() {
30249  var lb = this.GetListBoxControl();
30250  if(!lb) return false;
30251  var selectedItem;
30252  if(this.isDropDownListStyle)
30253   selectedItem = lb.GetVisibleItemCount() == 1 ? lb.GetItem(0) : null;
30254  else
30255   selectedItem = lb.FindItemByText(this.filter);
30256  if(selectedItem) {
30257   lb.SelectIndexSilent(selectedItem.index);
30258   this.comboBox.SetTextInternal(selectedItem.text);
30259  }
30260  return !!selectedItem;
30261 },
30262 IsEnabled: function() {
30263  return this.comboBox.GetEnabled();
30264 },
30265 Filtering: function(fromApi) {
30266  ASPx.ListEditIncrementalFilterStrategyBase.prototype.Filtering.call(this, fromApi);
30267  this.comboBox.EnsureClearButtonVisibility();
30268 },
30269 ShouldClearFilterBeforeFiltering: function(filter) {
30270  return this.TryRollbackLastSuccessText(this.GetInputFilterValue());
30271 },
30272 OnBeforeFiltering: function() {
30273  this.comboBox.onBeforeFiltering();
30274  this.EnsureDropDownAreaStateBeforeFiltering();
30275  if(this.isCallbackMode && !this.comboBox.droppedDown && this.comboBox.isNeedToForceFirstShowLoadingPanel)
30276   this.comboBox.ForceShowLoadingPanel();
30277 },
30278 OnAfterFiltering: function() {
30279  if(!this.isCallbackMode)
30280   this.ResetCallbackState();
30281 },
30282 OnFilteringCancelled: function(filteringFromApi) {
30283  if(this.comboBox.isCallbackMode) {
30284   var firstItem = this.GetListBoxControl().GetItem(0);
30285   if(firstItem && firstItem.selected) {
30286    this.HighlightTextAfterCallback(firstItem.text);
30287    this.EnsureDropDownAreaStateBeforeFiltering();
30288   }
30289   else if(filteringFromApi)
30290    this.EnsureDropDownAreaStateBeforeFiltering();
30291  }
30292  this.ResetCallbackState();
30293 },
30294 OnFilterRollback: function() {
30295  if(this.InCallback() && this.currentCallbackIsFiltration) 
30296   return;
30297  if(this.isCallbackMode && this.filterInitialized) {
30298   var listBox = this.GetListBoxControl();
30299   this.callbackProcessingStateManager.SetApplyAfterRollback();
30300   if(this.comboBox.GetText() != "" && this.comboBox.isDropDownListStyle) {
30301    listBox.ClearItems();
30302    this.needEmptyFilterBeforeFiltering = false;
30303    var currentSelectedItemCbArgs = ASPx.FilteringUtils.FormatCallbackArg(currentSelectedItemCallbackPrefix, "");
30304    this.comboBox.SendSpecialCallback(currentSelectedItemCbArgs);
30305   } else
30306    this.Filtering();
30307   this.SetFilter(this.comboBox.GetText());
30308   this.SetHighlighting(this.filter);
30309   this.ClearFilterApplied();
30310  }
30311 },
30312 NotifyCollectionChanged: function() {
30313  this.comboBox.CollectionChanged(true);
30314 },
30315 TryProcessFilterLessMinLength: function(oldFilter) {
30316  this.comboBox.onProcessFilterLessMinLength();
30317  this.ResetCallbackState();
30318  this.GetListBoxControl().SelectIndexSilent(-1, false);
30319  return true;
30320 },
30321 GetSelectedIndex: function() {
30322  return this.comboBox.GetSelectedIndex();
30323 },
30324 ResetCallbackState: function() {
30325  this.callbackProcessingStateManager.ResetState();
30326 },
30327 HighlightTextAfterCallback: function() { },
30328 IsCloseByEnterLocked: function() { return false; },
30329 TryRollbackLastSuccessText: function(filter) {
30330  if(this.comboBox.allowNull || filter) return false;
30331  var inpValue = this.comboBox.lastSuccessText;
30332  var inputElement = this.comboBox.GetInputElement();
30333  if(this.comboBox.HasTextDecorators()) {
30334   this.comboBox.SetRawValue(inpValue);
30335   if(this.comboBox.CanApplyTextDecorators())
30336    this.comboBox.SetInputValue(this.comboBox.GetDecoratedText(inpValue));
30337   else
30338    this.comboBox.SetInputValue(inpValue);
30339  }
30340  else if(inputElement.value != inpValue)
30341   this.comboBox.SetInputValue(inpValue);
30342  if(this.comboBox.focused)
30343   ASPx.Selection.Set(inputElement, 0, inputElement.value.length);
30344  var lb = this.comboBox.GetListBoxControl();
30345  if(lb) {
30346   if(this.comboBox.lastSuccessValue != null)
30347    lb.SetValue(this.comboBox.lastSuccessValue);
30348   else {
30349    var index = lb.FindItemIndexByText(this.comboBox.lastSuccessText);
30350    lb.SelectIndexSilent(index);
30351   }
30352  }
30353  this.comboBox.ShowCurrentItemImage();
30354  return true;
30355 },
30356 EnsureDropDownAreaStateBeforeFiltering: function() {
30357  var showDropDown = this.CanShowDropDownOnFocus(this.filter);
30358  if(this.callbackProcessingStateManager.NoFilterPostProcessing() && showDropDown) {
30359   var lb = this.GetListBoxControl();
30360   if(lb)
30361    lb.LockScrollHandler();
30362   this.EnsureShowDropDownArea();
30363   if(lb)
30364    lb.UnlockScrollHandler();
30365  } else if(!showDropDown)
30366   this.comboBox.HideDropDownArea();
30367 },
30368 EnsureShowDropDownArea: function() {
30369  if(!this.comboBox.droppedDown && this.comboBox.focused) {
30370   this.comboBox.CancelLoadCustomRangeOnDropDown();
30371   this.comboBox.ShowDropDownArea(true);
30372  }
30373 },
30374 CanShowDropDownOnFocus: function(filter) {
30375  if(filter != "")
30376   return true;
30377  return !!this.comboBox.showDropDownOnFocus ? this.comboBox.showDropDownOnFocus !== "Never" : true;
30378 },
30379 AllowEmptyFilterResults: function() {
30380  return !this.comboBox.isDropDownListStyle;
30381 },
30382 GetInputFilterValue: function() {
30383  var rawValue = this.comboBox.GetRawValue();
30384  return rawValue !== null && rawValue !== undefined ? rawValue : this.comboBox.GetInputElement().value;
30385 },
30386 GetListBoxControl: function() {
30387  return this.comboBox.GetListBoxControl();
30388 },
30389 OnBeforeFilteringOnClient: function(filter) {
30390  var comboBox = this.comboBox;
30391  if(comboBox.isDropDownListStyle) {
30392   if(this.GetInputFilterValue() != filter)
30393    comboBox.SetInputValue(filter);
30394   if(ASPx.IsExists(comboBox.GetRawValue()))
30395    comboBox.SetRawValue(filter);
30396   this.SetFilter(filter);
30397  }
30398  this.TryRollbackLastSuccessText(filter);
30399 },
30400 OnAfterFilteringOnClientCore: function (filter, firstSatisfyItemIndex) {
30401  if(firstSatisfyItemIndex !== -1 && this.CanShowDropDownOnFocus(filter))
30402   this.GetListBoxControl().CorrectCellWidthsOnFirstRowItemReplacement(0, firstSatisfyItemIndex);
30403  else {
30404   this.comboBox.onNoResultsFiltering();
30405   if(!this.comboBox.isDropDownModal())
30406    this.comboBox.HideDropDownArea(true);
30407  }
30408  this.needEmptyFilterBeforeFiltering = false;
30409 },
30410 FilteringStop: function() {
30411  if(!this.isCallbackMode)
30412   this.FilteringStopClient();
30413 },
30414 FilteringStopClient: function() {
30415  this.MakeAllItemsVisible();
30416  this.ClearFilter();
30417  this.DiscardHighlighting();
30418 },
30419 MakeAllItemsVisible: function() {
30420  ASPx.ListEditIncrementalFilterStrategyBase.prototype.MakeAllItemsVisible.call(this);
30421  this.NotifyCollectionChanged();
30422 },
30423 FilterNowAndApply: function() {
30424  this.callbackProcessingStateManager.SetApply();
30425  this.Filtering();
30426  if(!this.comboBox.isCallbackMode)
30427   this.comboBox.OnApplyChangesInternal();
30428 },
30429 InCallback: function() {
30430  return this.comboBox.InCallback();
30431 },
30432 OnCallbackCore: function(highlighting, newFilterLength) {
30433  if(this.currentCallbackIsFiltration) {
30434   var lb = this.GetListBoxControl();
30435   if(!lb.GetItemCount() || !this.CanShowDropDownOnFocus(this.filter)) {
30436    this.comboBox.onNoResultsFiltering();
30437    if(!this.comboBox.isDropDownModal())
30438     this.comboBox.HideDropDownArea(true);
30439   }
30440   else {
30441    this.OnFilterCallbackHighlightAndSelect(highlighting, newFilterLength);
30442    var isNeedToKeepDropDownVisible = !this.comboBox.isPerformCallback && this.callbackProcessingStateManager.NoFilterPostProcessing();
30443    if(!this.CanShowDropDownOnFocus(this.filter))
30444     this.comboBox.HideDropDownArea();
30445    else if(isNeedToKeepDropDownVisible)
30446     this.EnsureShowDropDownArea();
30447    this.OnEndFiltering();
30448   }
30449  }
30450  else
30451   this.RefreshHighlighting();
30452 },
30453 OnFilterCallbackHighlightAndSelect: function(highlighting, newFilterLength) {
30454  var listBox = this.GetListBoxControl();
30455  var firstItemText = listBox.GetItem(0).text;
30456  var isTextClearing = !this.comboBox.allowNull && this.IsEmptyFilter() && firstItemText;
30457  if(!isTextClearing) {
30458   var isFilterRollBack = this.CheckForFilterRollback(newFilterLength);
30459   var isNonFilterChangingCallback = (listBox.GetSelectedItem() == null);
30460   this.isTotallyMismatchedFilter = this.TryRollbackLastSuccessText(this.filter);
30461   var isNullState = this.comboBox.allowNull && !this.filter && !listBox.FindItemByText(this.filter);
30462   if(!this.isTotallyMismatchedFilter && !isNullState)
30463    this.SetHighlighting(this.filter, highlighting);
30464   if(!this.isTotallyMismatchedFilter && !isNullState && (isFilterRollBack || isNonFilterChangingCallback))
30465    this.HighlightTextAfterCallback(firstItemText);
30466   else
30467    this.DiscardHighlighting();
30468  }
30469  else
30470   this.TryRollbackLastSuccessText(this.filter);
30471 },
30472 CheckForFilterRollback: function(newFilterLength) {
30473  var filter = ASPx.Str.PrepareStringForFilter(this.filter);
30474  if(typeof(newFilterLength) === "number" && filter.length > newFilterLength) {
30475   var inputText = this.GetCutInputText(this.filter, newFilterLength);
30476   this.SetFilter(filter.substring(0, newFilterLength));
30477   this.comboBox.SetInputValue(inputText);
30478   return true;
30479  }
30480  return false;
30481 },
30482 GetCutInputText: function(text, textLength) {
30483  var saveCaseSensitive = true;
30484  var result = ASPx.Str.PrepareStringForFilter(text, saveCaseSensitive);
30485  return result.substring(0, textLength);
30486 },
30487 SendCallbackCore: function() {
30488  this.comboBox.SendCallback();
30489 },
30490 SupportsFilterCorrection: function() {
30491  return this.isDropDownListStyle;
30492 },
30493 SetListBoxSuggestionSelection: function() {
30494  var lb = this.GetListBoxControl();
30495  var singleItem = lb && lb.GetVisibleItemCount() == 1;
30496  var canSuggest = this.comboBox.isDropDownListStyle && this.comboBox.droppedDown && singleItem;
30497  var itemIndex = -1;
30498  if(canSuggest) {
30499   itemIndex = lb.GetFirstFilteredItemIndex();
30500   this.comboBox.SelectIndexSilent(lb, itemIndex);
30501  }
30502  if(this.comboBox.accessibilityCompliant)
30503   this.comboBox.GetAccessibilityHelper().SetLabelAttribute(canSuggest ? lb.GetItem(itemIndex).text : this.GetInputFilterValue(), canSuggest);
30504 },
30505 FilteringBackspace: function() {
30506  var currentText = this.GetInputFilterValue();
30507  if(currentText.length)
30508   this.comboBox.SetInputValue(currentText.slice(0, -1));
30509  this.FilterStartTimer();
30510 },
30511 RaiseItemFilteringEvent: function(item, filter, isFit) {
30512  return this.comboBox.RaiseItemFiltering(item, filter, isFit);
30513 },
30514 RaiseCustomHighlightingEvent: function(filter, callbackHighlighting) {
30515  return this.comboBox.RaiseCustomHighlighting(filter, callbackHighlighting);
30516 }
30517});
30518var ComboBoxContainsFilterStrategy = ASPx.CreateClass(ComboBoxIncrementalFilterStrategyBase, {
30519 IsSatisfy: function(text, filter) {
30520  return ASPx.Str.PrepareStringForFilter(text).indexOf(filter) != -1;
30521 },
30522 OnDropDownHideArea: function() {
30523  if(!this.isCallbackMode)
30524   this.FilteringStopClient();
30525 },
30526 OnDropDownButtonClick: function() {
30527  var lb = this.GetListBoxControl();
30528  if(lb && lb.GetVisibleItemCount() == 0 && this.isDropDownListStyle)
30529   this.comboBox.OnCancelChanges();
30530 },
30531 OnTextChanged: function() {
30532  if(!this.comboBox.IsFocusEventsLocked())
30533   if(!this.comboBox.ChangedByEnterKeyPress())
30534    this.OnFilterRollback();
30535 },
30536 OnBeforeCallbackFinally: function () {
30537  this.RefreshHighlighting();
30538  this.SetListBoxSuggestionSelection();
30539  ComboBoxIncrementalFilterStrategyBase.prototype.OnBeforeCallbackFinally.call(this);
30540 },
30541 OnEndFiltering: function(visibleCollectionChanged) {
30542  ComboBoxIncrementalFilterStrategyBase.prototype.OnEndFiltering.call(this, visibleCollectionChanged);
30543  this.SetListBoxSuggestionSelection();
30544 },
30545 IsCloseByEnterLocked: function() {
30546  if(this.comboBox.isDropDownListStyle) {
30547   if(this.IsFilterTimerActive()) return false;
30548   var lb = this.GetListBoxControl();
30549   if(lb && lb.GetVisibleItemCount() == 1) return false;
30550   var selectedItem = this.comboBox.GetSelectedItem();
30551   if(selectedItem)
30552    if(this.GetInputFilterValue() == selectedItem.text)
30553     return false;
30554   return true;
30555  }
30556  return false;
30557 },
30558});
30559var ComboBoxStartsWithFilterStrategy = ASPx.CreateClass(ComboBoxIncrementalFilterStrategyBase, {
30560 HighlightTextAfterCallback: function(firstItemText) {
30561  var lb = this.GetListBoxControl();
30562  this.FilteringHighlightCompletedText(firstItemText);
30563  if(this.comboBox.accessibilityCompliant)
30564   this.comboBox.GetAccessibilityHelper().SetLabelAttribute(firstItemText, true);
30565  if(!this.comboBox.isPerformCallback)
30566   this.comboBox.SelectIndexSilent(lb, 0);
30567 },
30568 OnFirstSatisfiedItemFound: function(index, text, isTextClearing) {
30569  if(this.needEmptyFilterBeforeFiltering && isTextClearing) return;
30570  var lb = this.GetListBoxControl();
30571  if(!isTextClearing)
30572   this.FilteringHighlightCompletedText(text);
30573  this.comboBox.SelectIndexSilent(lb, isTextClearing ? -1 : index, true);
30574 },
30575 FilteringHighlightCompletedText: function(filterItemText) {
30576  var input = this.comboBox.GetInputElement();
30577  ASPx.StartWithFilteringUtils.HighlightSuggestedText(input, filterItemText, this.comboBox,
30578   this.comboBox.restartCurrentUserInputTimer.bind(this.comboBox));
30579  if(ASPx.IsExists(this.comboBox.GetRawValue()))
30580   this.comboBox.SyncRawValueIfHasTextDecorators(false);
30581 },
30582 IsSatisfy: function(text, filter) {
30583  return ASPx.Str.PrepareStringForFilter(text).indexOf(filter) == 0;
30584 },
30585 OnDropDownHideArea: function() {
30586  this.FilteringStop();
30587 },
30588 OnEndFiltering: function(visibleCollectionChanged) {
30589  ComboBoxIncrementalFilterStrategyBase.prototype.OnEndFiltering.call(this, visibleCollectionChanged);
30590  var selectedItem = this.GetListBoxControl().GetSelectedItem();
30591  if (selectedItem)
30592   this.GetListBoxControl().MakeItemVisible(selectedItem.index);
30593  if(this.comboBox.accessibilityCompliant) {
30594   this.comboBox.GetAccessibilityHelper().SetLabelAttribute(!!selectedItem ? selectedItem.text : this.GetInputFilterValue(), !!selectedItem);
30595  }
30596 },
30597 OnAfterEnter: function() {
30598  var inputElement = this.comboBox.GetInputElement();
30599  ASPx.Selection.SetCaretPosition(inputElement);
30600 },
30601 TrySelectItemAfterFilter: function() {
30602  var lb = this.GetListBoxControl();
30603  var selectedItem = lb.GetItem(0);
30604  return !!selectedItem;
30605 }
30606});
30607ASPx.ComboBoxDisabledFilterStrategy = ComboBoxDisabledFilterStrategy;
30608ASPx.ComboBoxContainsFilterStrategy = ComboBoxContainsFilterStrategy;
30609ASPx.ComboBoxStartsWithFilterStrategy = ComboBoxStartsWithFilterStrategy;
30610window.ASPxClientComboBoxBase = ASPxClientComboBoxBase;
30611window.ASPxClientComboBox = ASPxClientComboBox;
30612window.ASPxClientNativeComboBox = ASPxClientNativeComboBox;
30613})();
30614
30615(function() {
30616ASPx.PCWIdSuffix = "_PW";
30617var popupControlZIndex = 11998;
30618var defaultZIndexFromServer = "10000";
30619var ModalAlign = {
30620 WindowLeft: "WindowLeft",
30621 WindowCenter: "WindowCenter",
30622 WindowRight: "WindowRight",
30623 WindowTop: "WindowTop",
30624 WindowBottom: "WindowBottom"
30625};
30626function PCResizeCursorInfo(horizontalDirection, verticalDirection, horizontalOffset, verticalOffset) {
30627 this.horizontalDirection = horizontalDirection;
30628 this.verticalDirection = verticalDirection;
30629 this.horizontalOffset = horizontalOffset;
30630 this.verticalOffset = verticalOffset;
30631 this.course = verticalDirection + horizontalDirection;
30632}
30633var PopupControlCssClasses = {};
30634PopupControlCssClasses.Prefix = "dxpc-";
30635PopupControlCssClasses.SizeGripLiteCssClassName = PopupControlCssClasse
30635s.Prefix + "sizeGrip";
30636PopupControlCssClasses.LinkCssClassName = PopupControlCssClasses.Prefix + "link";
30637PopupControlCssClasses.ShadowLiteCssClassName = PopupControlCssClasses.Prefix + "shadow";
30638PopupControlCssClasses.MainDivLiteCssClass = PopupControlCssClasses.Prefix + "mainDiv";
30639PopupControlCssClasses.ContentWrapperCssClassName = PopupControlCssClasses.Prefix + "contentWrapper";
30640PopupControlCssClasses.ContentCssClassName = PopupControlCssClasses.Prefix + "content";
30641PopupControlCssClasses.HeaderContentCssClassName = PopupControlCssClasses.Prefix + "headerContent";
30642PopupControlCssClasses.FooterContentCssClassName = PopupControlCssClasses.Prefix + "footerContent";
30643PopupControlCssClasses.WindowWrapperCssClassName = PopupControlCssClasses.Prefix + "win-wrapper";
30644PopupControlCssClasses.WindowWrapperScrollCssClassName = PopupControlCssClasses.WindowWrapperCssClassName + "-scroll";
30645PopupControlCssClasses.HeaderCssClassName = "dxpc-header";
30646var LoadContentViaCallback = {
30647 Default: "Default",
30648 OnFirstShow: "OnFirstShow",
30649 OnPageLoad: "OnPageLoad"
30650};
30651var constants = {
30652 DEFAULT_WINDOW_WIDTH: 200,
30653 DEFAULT_WINDOW_HEIGHT: 0
30654};
30655var ASPxClientPopupControlBase = ASPx.CreateClass(ASPxClientControl, {
30656 constructor: function(name) {
30657  this.constructor.prototype.constructor.call(this, name);
30658  this.leadingAfterInitCall = ASPxClientControl.LeadingAfterInitCallConsts.Direct; 
30659  this.adjustInnerControlsSizeOnShow = true;
30660  this.shadowVisible = true;
30661  this.cookieName = "";
30662  this.popupAnimationType = "none";
30663  this.closeAnimationType = "none";
30664  this.closeAction = "OuterMouseClick";
30665  this.isPopupFullCorrectionOn = true;
30666  this.forceAdjustPositionToClientScreen = false;
30667  this.usedInDropDown = false; 
30668  this.popupHorizontalOffset = 0;
30669  this.popupVerticalOffset = 0;
30670  this.popupHorizontalAlign = ASPx.PopupUtils.NotSetAlignIndicator;
30671  this.popupVerticalAlign = ASPx.PopupUtils.NotSetAlignIndicator;
30672  this.contentLoadingMode = LoadContentViaCallback.Default;
30673  this.slideAnimationDuration = 80;
30674  this.fadeAnimationDuration = 400;
30675  this.enableAnimation = true;
30676  this.showOnPageLoad = false;
30677  this.isDragged = false;
30678  this.closeOnEscape = false;
30679  this.savedCallbackWindowIndex = null;
30680  this.animationLockCount = 0;
30681  this.windowRequestCount = [];
30682  this.lpTimers = [];
30683  this.callbackAnimationProcessings = [];
30684  this.isCallbackFinishedStates = [];
30685  this.savedCallbackResults = [];
30686  this.loadingPanels = [];
30687  this.loadingDivs = [];
30688  this.left = 0;
30689  this.top = 0;
30690  this.height = constants.DEFAULT_WINDOW_HEIGHT;
30691  this.width = constants.DEFAULT_WINDOW_WIDTH;
30692  this.minHeight = null;
30693  this.minWidth = null;
30694  this.maxHeight = null;
30695  this.maxWidth = null;
30696  this.isResized = false;
30697  this.cachedSize = null;
30698  this.enableContentScrolling = false;
30699  this.contentOverflowX = "None";
30700  this.contentOverflowY = "None";
30701  this.contentUrl = "";
30702  this.contentUrlIFrameTitle = "";
30703  this.iframeLoading = false;
30704  this.iframeAdjustingPostponed = false;
30705  this.isPopupPositionCorrectionOn = true;
30706  this.resizeSessionCache = {};
30707  this.ResizeBorderSize = ASPx.Browser.TouchUI ? 10 : 6;
30708  this.ResizeCornerBorderSize = 20;
30709  this.isLiveResizingMode = true;
30710  this.allowResize = false;
30711  this.allowDragging = false;
30712  this.allowDraggingInAdaptiveMode = false;
30713  this.isWindowDragging = false;
30714  this.prohibitClearSelectionOnMouseDown = false;
30715  this.windowElements = {};
30716  this.windowContentElements = {};
30717  this.zIndex = -1;
30718  this.appearAfter = 300;
30719  this.disappearAfter = 500;
30720  this.popupAction = "LeftMouseClick";
30721  this.autoUpdatePosition = false;
30722  this.defaultIsPopuped = false;
30723  this.defaultLastUsedPopupElementInfo = {};
30724  this.defaultWindowPopupElementList = [];
30725  this.defaultWindowPopupElementIDList = [];
30726  this.firstFocusableElement = null;
30727  this.lastFocusableElement = null;
30728  this.focusLastElementHandler = function(e) { this.loopFocusHandler(e, false); }.aspxBind(this);
30729  this.focusFirstElementHandler = function(e) { this.loopFocusHandler(e, true); }.aspxBind(this);
30730  this.setFocusOnCallback = true;
30731  this.accessibleFocusElement = null;
30732  this.preventAccessibilityFocus = false;
30733  this.CloseButtonClick = new ASPxClientEvent();
30734  this.CloseUp = new ASPxClientEvent();
30735  this.Closing = new ASPxClientEvent();
30736  this.PopUp = new ASPxClientEvent();
30737  this.Shown = new ASPxClientEvent();
30738  this.Resize = new ASPxClientEvent();
30739  this.Dragged = new ASPxClientEvent(); 
30740  this.BeforeDrag = new ASPxClientEvent(); 
30741  this.BeforeResizing = new ASPxClientEvent();
30742  this.AfterResizing = new ASPxClientEvent();
30743  aspxGetPopupControlCollection().Add(this);
30744 },
30745 WindowElementIDAssignmentMap: [
30746  { cssClass: PopupControlCssClasses.HeaderCssClassName, prefix: "_PWH" },
30747  { cssClass: "dxpc-headerText", prefix: "_PWH", postfix: "T" },
30748  { cssClass: "dxpc-headerImg", prefix: "_PWH", postfix: "I" },
30749  { cssClass: "dxpc-closeBtn", prefix: "_HCB" },
30750  { cssClass: "dxpc-pinBtn", prefix: "_HPB" },
30751  { cssClass: "dxpc-refreshBtn", prefix: "_HRB" },
30752  { cssClass: "dxpc-collapseBtn", prefix: "_HMNB" },
30753  { cssClass: "dxpc-maximizeBtn", prefix: "_HMXB" },
30754  { cssClass: "dxpc-content", prefix: "_PWC" },
30755  { cssClass: "dxpc-iFrame", prefix: "_CIF" },
30756  { cssClass: "dxpc-footer", prefix: "_PWF" },
30757  { cssClass: "dxpc-footerText", prefix: "_PWF", postfix: "T" },
30758  { cssClass: "dxpc-footerImg", prefix: "_PWF", postfix: "I" }
30759 ],
30760 Initialize: function() {
30761  this.InitializeBeforeAnyShow();
30762  ASPxClientControl.prototype.Initialize.call(this);
30763  if(this.accessibilityCompliant)
30764   this.InitializeAccessibleNavigation();
30765 },
30766 InitializeWindow: function(index) {
30767  ASPx.PopupUtils.BodyScrollHelper.RestoreIfLocked(this.GetWindowElementId(index));
30768  this.RemoveWindowAllPopupElements(index);
30769  this.PopulatePopupElements(index);
30770  var element = this.GetWindowElement(index);
30771  if(element != null) {
30772   this.AssignWindowElementsID(index, element);
30773   this.AssignWindowElementsEvents(index, element);
30774   element.DXPopupWindowElement = true;
30775   this.AttachOnDragStartEventToWindowImages(index);
30776   this.EnsureWindowContentUrl(index);
30777   element.isHiding = false;
30778   element.isPopupPositionCorrectionOn = this.isPopupPositionCorrectionOn || !this.GetShowOnPageLoad(index);
30779   if(this.GetShowOnPageLoad(index) && this.GetZIndex(index) > 0) {
30780    this.FirstShowWindow(index, false);
30781    this.SetWindowElementZIndex(element, this.GetZIndex(index));
30782    element.isPopupPositionCorrectionOn = true;
30783   }
30784   this.InitializeWindowEscKeyHandler(element, index);
30785   if(this.GetCanScrollViewPort(index))
30786    ensureViewPortSizeInterval();
30787   var headerImageElement = this.GetWindowHeaderImageCell(index);
30788   if(headerImageElement != null) {
30789    var headerImageHandler = function() {
30790     this.CorrectHeaderContentElementHeight(index);
30791    }.aspxBind(this);
30792    headerImageElement.addEventListener("load", headerImageHandler);
30793    headerImageElement.addEventListener("error", headerImageHandler);
30794   }
30795   var footerImageElement = this.GetWindowFooterImageCell(index);
30796   if(footerImageElement != null) {
30797    var footerImageHandler = function() {
30798     this.CorrectWindowSizeGripPositionLite(index);
30799     this.CorrectFooterTextElementWidth(index);
30800    }.aspxBind(this);
30801    footerImageElement.addEventListener("load", footerImageHandler);
30802    footerImageElement.addEventListener("error", footerImageHandler);
30803   }
30804  }
30805 },
30806 InitializeBeforeAnyShow: function() {
30807  this.InitializeEnableContentScrolling();
30808 },
30809 InitializeEnableContentScrolling: function() {
30810  this.enableContentScrolling = this.contentOverflowX != "None" || this.contentOverflowY != "None";
30811 },
30812 InitializeWindowEscKeyHandler: function(element, index) {
30813  if(!this.GetEnableCloseByEsc(index)) return;
30814  this.AddKeyDownHandler("ESC", this.OnEscKeyDown.aspxBind(this));
30815 },
30816 AfterInitialize: function() {
30817  if(this.HasDefaultWindow())
30818   this.AfterInitializeWindow(-1);
30819  for(var i = 0; i < this.GetWindowCount(); i++)
30820   this.AfterInitializeWindow(i);
30821  ASPxClientControl.prototype.AfterInitialize.call(this);
30822 },
30823 AfterInitializeWindow: function(index) {
30824  if(this.GetShowOnPageLoad(index) && this.GetZIndex(index) < 0) {
30825   this.FirstShowWindow(index, true);
30826   var element = this.GetWindowElement(index);
30827   if(element != null)
30828    element.isPopupPositionCorrectionOn = true;
30829  }
30830  this.EnsureContent(index, true);
30831 },
30832 AssignWindowElementsID: function(index, windowElement) {
30833  for(var i = 0; i < this.WindowElementIDAssignmentMap.length; i++) {
30834   var elementClass = this.WindowElementIDAssignmentMap[i].cssClass;
30835   var elements = ASPx.GetNodesByClassName(windowElement, elementClass);
30836   for(var j = 0; j < elements.length; j++) {
30837    var element = elements[j];
30838    if(this.GetFirstParentWindow(element) === windowElement)
30839     this.AssignElementID(element, index, this.WindowElementIDAssignmentMap[i].prefix, this.WindowElementIDAssignmentMap[i].postfix);
30840   }
30841  }
30842 },
30843 AssignElementID: function(element, index, prefix, postfix) {
30844  element.id = this.name + prefix + index + (postfix ? postfix : "");
30845 },
30846 AssignWindowElementsEvents: function(index, element) {
30847  var header = this.GetWindowHeaderElement(index);
30848  if(header && this.allowDragging && !this.isWindowDragging)
30849   ASPx.Evt.AttachEventToElement(header, ASPx.TouchUIHelper.touchMouseDownEventName, this.GetWindowHeaderElementMouseDownEventHandler(index), true);
30850  this.AssignHeaderButtonsEvents(index);
30851  var mdEventName = ASPx.TouchUIHelper.touchMouseDownEventName;
30852  ASPx.Evt.AttachEventToElement(element, mdEventName, this.GetWindowElementMouseDownEventHandler(index));
30853  if(this.IsResizeAllowed(index)) {
30854   var mmEventName = ASPx.TouchUIHelper.touchMouseMoveEventName;
30855   ASPx.Evt.AttachEventToElement(element, mmEventName, this.GetWindowElementMouseMoveEventHandler(index));
30856  }
30857  var sizeGrip = this.GetWindowSizeGripElement(index);
30858  if(sizeGrip) {
30859   var instance = this;
30860   ASPx.Evt.AttachEventToElement(sizeGrip, mdEventName, function(evt) {
30861    ASPx.PWGripMDown(evt, instance.name, index);
30862    ASPx.Evt.PreventEvent(evt);
30863   });
30864  }
30865 },
30866 AssignHeaderButtonsEvents: function(index) {
30867  this.AttachClickToHeaderButton(index, this.GetWindowCloseButton(index), "ASPx.PWCBClick");
30868  this.AttachClickToHeaderButton(index, this.GetWindowRefreshButton(index), "ASPx.PWRBClick");
30869 },
30870 AttachClickToHeaderButton: function(index, headerButton, eventFuncName) {
30871  var instance = this;
30872  if(headerButton) {
30873   ASPx.Evt.AttachEventToElement(headerButton, "click", function(evt) {
30874    eval(eventFuncName)(evt, instance.name, index);
30875   });
30876  }
30877 },
30878 AttachOnDragStartEventToWindowImages: function(index) {
30879  this.AttachChildImagesPreventDragStartEvent(this.GetWindowHeaderElement(index));
30880  this.AttachChildImagesPreventDragStartEvent(this.GetWindowFooterElement(index));
30881 },
30882 AttachChildImagesPreventDragStartEvent: function(parentElem) {
30883  var images = parentElem == null ? null : ASPx.GetNodesByTagName(parentElem, "img");
30884  if(images != null) {
30885   for(var i = 0; i < images.length; i++)
30886    ASPx.Evt.AttachEventToElement(images[i], "dragstart", ASPx.Evt.PreventEventAndBubble);
30887  }
30888 },
30889 GetPropertyValue: function(index, propName) {
30890  return this[propName];
30891 },
30892 SetPropertyValue: function(index, propName, value) {
30893  this[propName] = value;
30894 },
30895 GetStretchVerticallyByIndex: function(index) {
30896  return this.GetPropertyValue(index, "stretchVertically");
30897 },
30898 GetModalMaxWidth: function(index) {
30899  return this.GetPropertyValue(index, "modalMaxWidth");
30900 },
30901 SetAdaptiveMaxWidthByIndex: function(index, value) {
30902  value = this.ConvertDimensionValueToString(value);
30903  this.SetPropertyValue(index, "modalMaxWidth", value);
30904  this.GetWindowElement(index).style["maxWidth"] = value;
30905  if(value.indexOf("px") > 0)
30906   this.EnsureMaxWidthClassName(index, ASPx.PxToInt(value));
30907 },
30908 EnsureMaxWidthClassName: function(index, maxWidth) {
30909  var defaultPaddingsWidth = 20;
30910  ASPx.ToggleClassNameToElement(this.GetModalWrapperElement(index), "dxmodalMaxWidth", maxWidth < ASPx.MaxMobileWindowWidth - defaultPaddingsWidth);
30911 },
30912 GetModalMinWidth: function(index) {
30913  return this.GetPropertyValue(index, "modalMinWidth");
30914 },
30915 SetAdaptiveMinWidthByIndex: function(index, value) {
30916  value = this.ConvertDimensionValueToString(value);
30917  this.SetPropertyValue(index, "modalMinWidth", value);
30918  this.GetWindowElement(index).style["minWidth"] = value;
30919 },
30920 GetModalMinHeight: function(index) {
30921  return this.GetPropertyValue(index, "modalMinHeight");
30922 },
30923 SetContentElementsAdaptiveDisplayStyle: function(index) {
30924  var contentWrapper = this.GetWindowContentWrapperElement(index);
30925  ASPx.ToggleClassNameToElement(contentWrapper, "dxmodalTableSys", !this.GetWindowContentIFrameElement(index) && !this.HasAnyScrollBars(index));
30926 },
30927 SetContentWrapperAdaptiveHeight: function(index, adaptiveHeight) {  
30928  var contentWrapper = this.GetWindowContentWrapperElement(index);
30929  contentWrapper.style.height = adaptiveHeight;  
30930 },
30931 SetAdaptiveMinHeightByIndex: function(index, value) {  
30932  this.StretchVerticallyByIndex(index, false);
30933  this.SetPropertyValue(index, "modalMinHeight", value);
30934  this.SetAdaptiveHeightDimension(index, "minHeight", value);
30935 },
30936 GetModalMaxHeight: function(index) {
30937  return this.GetPropertyValue(index, "modalMaxHeight");
30938 },
30939 SetAdaptiveMaxHeightByIndex: function(index, value) {
30940  this.SetPropertyValue(index, "modalMaxHeight", value);
30941  this.SetAdaptiveHeightDimension(index, "maxHeight", value);
30942 },
30943 GetFixedHeader: function(index) {
30944  return this.GetPropertyValue(index, "fixedHeader");
30945 },
30946 GetFixedFooter: function(index) {
30947  return this.GetPropertyValue(index, "fixedFooter");
30948 },
30949 GetWindowWidthInternal: function(index) {
30950  return this.GetPropertyValue(index, "width");
30951 },
30952 GetWindowHeightInternal: function(index) {
30953  return this.GetPropertyValue(index, "height");
30954 },
30955 SetWindowHeight: function(index, height) {
30956  this.SetPropertyValue(index, "height", height);
30957 },
30958 SetWindowWidth: function(index, width) {
30959  this.SetPropertyValue(index, "width", width);
30960 },
30961 GetWindowMinWidth: function(index) {
30962  return this.GetPropertyValue(index, "minWidth");
30963 },
30964 GetWindowMaxWidth: function(index) {
30965  return this.GetPropertyValue(index, "maxWidth");
30966 },
30967 GetWindowMinHeight: function(index) {
30968  return this.GetPropertyValue(index, "minHeight");
30969 },
30970 GetWindowMaxHeight: function(index) {
30971  return this.GetPropertyValue(index, "maxHeight");
30972 },
30973 SetWindowMaxHeight: function(index, maxHeight) {
30974  this.SetPropertyValue(index, "maxHeight", maxHeight);
30975 },
30976 SetWindowCachedSize: function(index, width, height) {
30977  this.SetPropertyValue(index, "cachedSize", new ASPx.PopupSize(width, height));
30978 },
30979 GetWindowCachedSize: function(index) {
30980  return this.GetPropertyValue(index, "cachedSize");
30981 },
30982 ResetWindowCachedSize: function(index) {
30983  this.SetPropertyValue(index, "cachedSize", null);
30984 },
30985 GetPosition: function(index, isLeft) {
30986  return this.GetPropertyValue(index, isLeft ? "left" : "top");
30987 },
30988 GetWindowTop: function(index) {
30989  return this.GetPropertyValue(index, "top");
30990 },
30991 SetWindowTop: function(index, top) {
30992  this.SetPropertyValue(index, "top", top);
30993 },
30994 GetWindowLeft: function(index) {
30995  return this.GetPropertyValue(index, "left");
30996 },
30997 SetWindowLeft: function(index, left) {
30998  this.SetPropertyValue(index, "left", left);
30999 },
31000 GetEnableCloseByEsc: function(index) {
31001  return this.GetPropertyValue(index, "closeOnEscape");
31002 },
31003 GetIsDragged: function(index) {
31004  return this.GetPropertyValue(index, "isDragged");
31005 },
31006 GetWindowContentIFrameUrl: function(index) {
31007  return this.GetPropertyValue(index, "contentUrl");
31008 },
31009 GetWindowContentIFrameTitle: function(index) {
31010  return this.GetPropertyValue(index, "contentUrlIFrameTitle");
31011 },
31012 GetWindowCloseAction: function(index) {
31013  return this.GetPropertyValue(index, "closeAction");
31014 },
31015 GetShowOnPageLoad: function(index) {
31016  return this.GetPropertyValue(index, "showOnPageLoad");
31017 },
31018 GetZIndex: function(index) {
31019  return this.GetPropertyValue(index, "zIndex");
31020 },
31021 GetIframeLoading: function(index) {
31022  return this.GetPropertyValue(index, "iframeLoading");
31023 },
31024 SetIframeLoading: function(index, value) {
31025  this.SetPropertyValue(index, "iframeLoading", value);
31026 },
31027 SetIsDragged: function(index, value) {
31028  this.SetPropertyValue(index, "isDragged", value);
31029 },
31030 GetIsResized: function(index) {
31031  return this.GetPropertyValue(index, "isResized");
31032 },
31033 SetIsResized: function(index, value) {
31034  this.SetPropertyValue(index, "isResized", value);
31035 },
31036 SetIframeAdjustingPostponed: function(index, value) {
31037  this.SetPropertyValue(index, "iframeAdjustingPostponed", value);
31038 },
31039 GetIframeAdjustingPostponed: function(index) {
31040  return this.GetPropertyValue(index, "iframeAdjustingPostponed");
31041 },
31042 GetWindowPopupAction: function(index) {
31043  return this.GetPropertyValue(index, "popupAction");
31044 },
31045 GetWindowElementMouseMoveEventHandler: function(index) {
31046  var instance = this;
31047  return function(evt) { ASPx.PWMMove(evt, instance.name, index); };
31048 },
31049 GetWindowElementMouseDownEventHandler: function(index) {
31050  var instance = this;
31051  return function(evt) {
31052   if(instance.AllowMouseDown(evt, index))
31053    ASPx.PWMDown(evt, instance.name, index, instance.isWindowDragging);
31054  };
31055 },
31056 GetWindowHeaderElementMouseDownEventHandler: function(index) {
31057  var instance = this;
31058  return function(evt) {
31059   if(instance.AllowMouseDown(evt, index))
31060    ASPx.PWDGMDown(evt, instance.name, index);
31061  };
31062 },
31063 AllowMouseDown: function(evt, index) {
31064  return !this.PreventHeaderButtonMouseDownBubbling(evt, this.GetWindowCloseButton(index)) &&
31065   !this.PreventHeaderButtonMouseDownBubbling(evt, this.GetWindowRefreshButton(index));
31066 },
31067 PreventHeaderButtonMouseDownBubbling: function(evt, hdrButton) {
31068  if(hdrButton) {
31069   var source = ASPx.Evt.GetEventSource(evt);
31070   if(ASPx.GetIsParent(hdrButton, source)) {
31071    ASPx.PWHMDown(evt);
31072    return true;
31073   }
31074  }
31075  return false;
31076 },
31077 PrepareToAdjustContentOnShow: function(index) {
31078  if(this.adjustInnerControlsSizeOnShow) {
31079   var windowContent = this.GetContentContainer(index),
31080    collection = ASPx.GetControlCollection();
31081   collection.CollapseControls(windowContent);
31082  }
31083 },
31084 AdjustContentOnShow: function(index) {
31085  if(this.adjustInnerControlsSizeOnShow) {
31086   var windowElement = this.GetWindowElement(index);
31087   ASPx.GetControlCollection().AdjustControls(windowElement, false);
31088  }
31089 },
31090 AdjustSize: function() {
31091  if(this.enableContentScrolling)
31092   return;
31093  this.SetSize(0, 0);
31094 },
31095 GetFirstParentWindow: function(el) {
31096  while(el && el.tagName != "BODY") {
31097   if(el.nodeType == 1 && el.className.indexOf("dxpclW") > -1 && !isNaN(this.GetWindowIndex(el)))
31098    return el;
31099   el = el.parentNode;
31100  }
31101 },
31102 getParentPopupControl: function(index) {
31103  var parentPopupWindowElement = this.GetFirstParentWindow(this.GetWindowElement(index).parentNode);
31104  if(parentPopupWindowElement)
31105   return aspxGetPopupControlCollection().GetPopupWindowFromID(parentPopupWindowElement.id);
31106 },
31107 registerAndActivateWindow: function(windowElement, index, allowChangeZIndex) {
31108  aspxGetPopupControlCollection().RegisterVisibleWindow(windowElement, this, index);
31109  if(allowChangeZIndex)
31110   aspxGetPopupControlCollection().ActivateWindowElement(windowElement, undefined, this.GetPopupType(), this.GetDefaultZIndexFromServer(), this.GetPopupControlZIndex());
31111 },
31112 HasCloseAnimation: function() {
31113  return this.closeAnimationType !== ASPxClientPopupControlBase.AnimationType.None;
31114 },
31115 HasOpenAnimation: function() {
31116  return this.popupAnimationType !== ASPxClientPopupControlBase.AnimationType.None;
31117 },
31118 AddKeyDownHandler: function(shortcutString, handler) {
31119  if(typeof(this.keyDownHandlers) === "undefined")
31120   this.keyDownHandlers = [];
31121  this.keyDownHandlers[ASPx.ParseShortcutString(shortcutString)] = handler;
31122 },
31123 InternalIsWindowDisplayed: function(index) {
31124  var element = this.GetWindowElement(index);
31125  return (element != null) ? ASPx.GetElementDisplay(element) : false;
31126 },
31127 InternalIsWindowVisible: function(index) {
31128  var element = this.GetWindowElement(index);
31129  if(!element)
31130   return false;
31131  if(this.HasCloseAnimation() && !element.closeAnimationCompleted)
31132   return false;
31133  return ASPx.GetElementVisibility(element, true) && ASPx.GetElementDisplay(element);
31134 },
31135 IsWindowVisible: function(window) {
31136  var index = (window != null) ? window.index : -1;
31137  return this.InternalIsWindowVisible(index);
31138 },
31139 IsVisible: function() {
31140  return this.InternalIsWindowVisible(-1);
31141 },
31142 UpdateWindowsStateCookie: function() {
31143  if(this.cookieName == "") return;
31144  ASPx.Cookie.DelCookie(this.cookieName);
31145  ASPx.Cookie.SetCookie(this.cookieName, this.GetWindowsState());
31146 },
31147 SetWindowElementZIndex: function(element, zIndex) {
31148  element.style.zIndex = zIndex;
31149  var iFrame = element.overflowElement;
31150  if(iFrame)
31151   iFrame.style.zIndex = zIndex - 1;
31152  var modalElement = element.modalElement;
31153  if(modalElement)
31154   modalElement.style.zIndex = zIndex - 1;
31155  this.UpdateWindowsStateCookie();
31156 },
31157 SetWindowContentHtmlCore: function(index, html, useAnimation) {
31158  var element = this.GetContentContainer(index);
31159  if(element != null) {
31160   ASPx.SetInnerHtml(element, html);
31161   this.AfterSetWindowContentHtml(index, element, useAnimation);
31162  }
31163 },
31164 SetContentHtml: function(html, useAnimation) {
31165  this.SetWindowContentHtml(null, html, useAnimation);
31166  if(html && this.accessibilityCompliant)
31167   ASPx.GetControlCollection().ControlsInitialized.AddHandler(this.OnControlsInitialized, this);
31168 },
31169 SetWindowContentHtml: function(window, html, useAnimation) {
31170  var index = (window != null) ? window.index : -1;
31171  this.SetWindowContentHtmlCore(index, html, useAnimation);
31172 },
31173 GetContentHtml: function() {
31174  return this.GetWindowContentHtml(null);
31175 },
31176 AfterSetWindowContentHtml: function(index, contentContainer, useAnimation) {
31177  if(useAnimation && typeof (ASPx.AnimationHelper) != "undefined")
31178   ASPx.AnimationHelper.fadeIn(contentContainer, function() { this.ResizeWindowIFrame(index); }.aspxBind(this));
31179  else
31180   this.ResizeWindowIFrame(index);
31181 },
31182 ResizeWindowIFrame: function(index) {
31183  if(!this.renderIFrameForPopupElements || !this.InternalIsWindowVisible(index)) return;
31184  var iFrame = this.GetWindowIFrame(index);
31185  if(iFrame) {
31186   var cell = this.GetWindowMainCell(this.GetWindowElement(index));
31187   ASPx.SetStyles(iFrame, { width: cell.offsetWidth, height: cell.offsetHeight });
31188  }
31189 },
31190 DoHideWindow: function(index, dontRaiseClosing, closeReason) {
31191  if(!this.InternalIsWindowVisible(index)) return;
31192  var cancel = !dontRaiseClosing && this.RaiseClosing(index, closeReason);
31193  if(!cancel) {
31194   if(this.HasCloseAnimation() && this.IsAnimationAllowed())
31195    this.DoHideWindowCoreWithAnimation(index, closeReason);
31196   else {
31197    this.DoHideWindowCore(index, closeReason);
31198    this.RaiseCloseUp(index, closeReason);
31199   }
31200  }
31201  return cancel;
31202 },
31203 HasAnyScrollBars: function(index) {
31204  var contentElement = this.GetWindowContentElement(index);
31205  var hasBothScrollBars = contentElement.style.overflow == "scroll" || contentElement.style.overflow == "auto";
31206  return hasBothScrollBars || contentElement.style.overflowX == "scroll" ||
31207   contentElement.style.overflowY == "scroll" || contentElement.style.overflowX == "auto" ||
31208   contentElement.style.overflowY == "auto";
31209 },
31210 DoHideWindowModalElement: function(element, closeReason) {
31211  var modalElement = element.modalElement;
31212  if(modalElement && ASPx.GetElementVisibility(modalElement, true)) {
31213   var closeModalElement = function () {
31214    ASPx.SetStyles(modalElement, { width: 1, height: 1, zIndex: defaultZIndexFromServer - 1 });
31215    ASPx.SetElementVisibility(modalElement, false);
31216    ASPx.SetElementDisplay(modalElement, false);
31217   };
31218   aspxGetPopupControlCollection().UnregisterVisibleModalElement(modalElement);
31219   if(this.GetHideBodyScrollWhenModal(this.GetWindowIndex(element))) {
31220    if(ASPx.Browser.WebKitFamily)
31221     aspxGetPopupControlCollection().LockScrollEvent();
31222    if(!ASPx.Browser.WebKitTouchUI)
31223     ASPx.PopupUtils.BodyScrollHelper.RestoreBodyScroll(element.id);
31224    if(ASPx.Browser.WebKitFamily)
31225     aspxGetPopupControlCollection().UnlockScrollEvent();
31226   }
31227   if(closeReason == ASPxClientPopupControlCloseReason.OuterMouseClick) {     
31228    ASPx.SetStyles(modalElement, { opacity: 0 });
31229    if(!modalElement.mouseHandler) {
31230     modalElement.mouseHandler = function() {
31231      ASPx.SetStyles(modalElement, { opacity: "" });
31232      closeModalElement();
31233      ASPx.Evt.DetachEventFromElement(modalElement, "mouseup", modalElement.mouseHandler);
31234      ASPx.Evt.DetachEventFromElement(modalElement, "mouseout", modalElement.mouseHandler);
31235     };
31236    }
31237    ASPx.Evt.AttachEventToElement(modalElement, "mouseup", modalElement.mouseHandler);
31238    ASPx.Evt.AttachEventToElement(modalElement, "mouseout", modalElement.mouseHandler);
31239   } else
31240    closeModalElement();
31241  }
31242 },
31243 IncreaseWindowRequestCount: function (index) {
31244  if(!this.windowRequestCount[index])
31245   this.windowRequestCount[index] = 1;
31246  else
31247   this.windowRequestCount[index]++;
31248 },
31249 DecreaseWindowRequestCount: function(index) {
31250  this.windowRequestCount[index]--;
31251 },
31252 IsLoadingContainerVisible: function() {
31253  return true;
31254 },
31255 ShouldHideExistingLoadingElements: function() {
31256  return false;
31257 },
31258 GetModalElementEndAnimationOpacity: function(index) {
31259  if(typeof (this.modalElementOpacity) == "undefined")
31260   this.modalElementOpacity = [];
31261  if(typeof (this.modalElementOpacity[index]) == "undefined")
31262   this.modalElementOpacity[index] = ASPx.GetElementOpacity(this.GetWindowModalElement(index));
31263  return this.modalElementOpacity[index];
31264 },
31265 SetModalElementVisibilityWithAnimation: function(modalElement, index) {
31266  if(this.AllowModalElementAnimation(index)) {
31267   var endOpacity = this.GetModalElementEndAnimationOpacity(index);
31268   ASPx.AnimationHelper.setOpacity(modalElement, 0);
31269   ASPx.SetElementVisibility(modalElement, true);
31270   ASPx.AnimationHelper.fadeTo(modalElement, { to: endOpacity });
31271  } else
31272   ASPx.SetElementVisibility(modalElement, true);
31273 },
31274 AllowModalElementAnimation: function(index) {
31275  return this.popupAnimationType === ASPxClientPopupControlBase.AnimationType.Fade;
31276 },
31277 SetVisibleWithAnimation: function(element, isMoving, index, horizontalPopupPosition, verticalPopupPosition) {
31278  var isAnimationNeed = this.IsAnimationAllowed() && !isMoving;
31279  if(isAnimationNeed && this.popupAnimationType !== "none") {
31280   switch(this.popupAnimationType) {
31281    case ASPxClientPopupControlBase.AnimationType.Slide:
31282     this.StartSlideAnimation(element, index, horizontalPopupPosition, verticalPopupPosition);
31283     break;
31284    case ASPxClientPopupControlBase.AnimationType.Fade:
31285     this.StartFadeAnimation(element, index);
31286     break;
31287    case ASPxClientPopupControlBase.AnimationType.Auto:
31288     this.StartAutoAnimation(element, index, horizontalPopupPosition, verticalPopupPosition);
31289     break;
31290   }
31291  }
31292  else
31293   ASPx.SetElementVisibility(element, true);
31294 },
31295 StartAutoAnimation: function(element, index, horizontalPopupPosition, verticalPopupPosition) {
31296  ASPx.SetElementVisibility(element, true);
31297 },
31298 StartFadeAnimation: function(element, index) {
31299  ASPx.AnimationHelper.setOpacity(element, 0);
31300  ASPx.SetElementVisibility(element, true);
31301  var callback = function() {
31302   this.OnAnimationStop(index);
31303  }.aspxBind(this);
31304  ASPx.AnimationHelper.fadeIn(element, callback, this.fadeAnimationDuration);
31305 },
31306 StartSlideAnimation: function (animationDivElement, index, horizontalPopupPosition, verticalPopupPosition) {
31307  var element = this.GetWindowMainCell(animationDivElement);
31308  var clientX = horizontalPopupPosition.position;
31309  var clientY = verticalPopupPosition.position;
31310  var args = "(\"" + this.name + "\", " + index + ")";
31311  var onAnimStopCallString = "ASPx.PCAStop" + args;
31312  this.InitDivPosForShowSlideAnimation(index, animationDivElement, clientX, clientY, onAnimStopCallString);
31313  var horizontalDirection = this.GetAnimationHorizontalDirection(index, horizontalPopupPosition);
31314  var verticalDirection = this.GetAnimationVerticalDirection(index, verticalPopupPosition);
31315  var offsetCoefficient = this.GetSlideOffsetCoefficient(index);
31316  var xPos = horizontalDirection * animationDivElement.offsetWidth * offsetCoefficient;
31317  var yPos = verticalDirection * animationDivElement.offsetHeight * offsetCoefficient;
31318  neddToForceAnimation = xPos === 0 && yPos === 0;
31319  if(neddToForceAnimation) 
31320   yPos = 1;
31321  ASPx.SetStyles(element, { left: xPos, top: yPos });
31322  ASPx.SetElementVisibility(animationDivElement, true);
31323  this.DoShowWindowIFrame(index, clientX, clientY, 0, 0);
31324  ASPx.PopupUtils.StartSlideAnimation(animationDivElement, element, this.GetWindowIFrame(index), this.GetSlideAnimationDuration(index));
31325 },
31326 GetSlideAnimationDuration: function(index) {
31327  return this.slideAnimationDuration;
31328 },
31329 GetSlideOffsetCoefficient: function(index) {
31330  return 1;
31331 },
31332 InitDivPosForShowSlideAnimation: function(index, animationDivElement, clientX, clientY, onAnimStopCallString) {
31333  ASPx.PopupUtils.InitAnimationDiv(animationDivElement, clientX, clientY, onAnimStopCallString, true);
31334 },
31335 InitDivPosForHideSlideAnimation: function(animationDivElement) {
31336 },
31337 StopShowAnimation: function(index) {
31338  if(this.HasOpenAnimation()) {
31339   var windowElement = this.GetWindowElement(index);
31340   if(this.popupAnimationType === 'slide')
31341    ASPx.PopupUtils.StopAnimation(windowElement, this.GetWindowMainCell(windowElement));
31342   else
31343    ASPx.AnimationHelper.cancelAnimation(windowElement);
31344  }
31345 },
31346 StopCloseAnimation: function(index) {
31347  var element = this.GetWindowElement(index);
31348  if(this.HasCloseAnimation() && !element.closeAnimationCompleted) {
31349   ASPx.AnimationHelper.cancelAnimation(element);
31350   this.DoHideWindowCore(index);
31351  }
31352 },
31353 IsFadeCloseAnimation: function(index) {
31354  return this.closeAnimationType === ASPxClientPopupControlBase.AnimationType.Fade;
31355 },
31356 PrepareElementAfterCloseAnimation: function(index, element) {
31357  element.closeAnimationCompleted = true;
31358  if(this.IsFadeCloseAnimation(index))
31359   ASPx.SetStyles(element, { opacity: 1 });
31360  else
31361   ASPx.SetStyles(this.GetWindowMainCell(element), {
31362    left: 0,
31363    top: 0
31364   });
31365 },
31366 DoHideWindowCoreWithAnimation: function(index, closeReason) {
31367  this.StopShowAnimation(index);
31368  var element = this.GetWindowElement(index);
31369  element.closeAnimationCompleted = false;
31370  if(this.AllowModalElementAnimation(index) && this.CanManipulateWithModalElement(index))
31371   ASPx.AnimationHelper.fadeOut(element.modalElement, null, this.fadeAnimationDuration);
31372  switch(this.closeAnimationType) {
31373   case ASPxClientPopupControlBase.AnimationType.Slide:
31374    this.DoHideWindowWithSlideAnimation(index, closeReason);
31375    break;
31376   case ASPxClientPopupControlBase.AnimationType.Fade:
31377    this.DoHideWindowWithFadeAnimation(index, element, closeReason);
31378    break;
31379   case ASPxClientPopupControlBase.AnimationType.Auto:
31380    this.DoHideWindowWithAutoAnimation(index, element, closeReason);
31381    break;
31382  }
31383 },
31384 DoHideWindowWithAutoAnimation: function(index, element, closeReason) {
31385 },
31386 DoHideWindowWithFadeAnimation: function(index, element, closeReason) {
31387  ASPx.AnimationHelper.fadeOut(element, function() {
31388   this.DoHideWindowCore(index);
31389   this.RaiseCloseUp(index, closeReason);
31390  }.aspxBind(this), this.fadeAnimationDuration);
31391 },
31392 DoHideWindowWithSlideAnimation: function(index, closeReason) {
31393  var element = this.GetWindowElement(index);
31394  var horizontalPopupPosition = this.GetSlideAnimationPosition(element, true);
31395  var verticalPopupPosition = this.GetSlideAnimationPosition(element, false);
31396  var horizontalDirection = this.GetAnimationHorizontalDirection(index, horizontalPopupPosition);
31397  var verticalDirection = this.GetAnimationVerticalDirection(index, verticalPopupPosition);
31398  this.InitDivPosForHideSlideAnimation(element);
31399  var offsetCoefficient = this.GetSlideOffsetCoefficient(index);
31400  ASPx.AnimationHelper.createMultipleAnimationTransition(this.GetWindowMainCell(element), {
31401   duration: this.GetSlideAnimationDuration(index),
31402   onComplete: function(element) {
31403    this.DoHideWindowCore(index);
31404    this.RaiseCloseUp(index, closeReason);
31405   }.aspxBind(this)
31406  }).Start({
31407   left: { to: horizontalDirection * element.offsetWidth * offsetCoefficient, unit: "px" },
31408   top: { to: verticalDirection * element.offsetHeight * offsetCoefficient, unit: "px" }
31409  });
31410 },
31411 GetSlideAnimationPosition: function(element, isX) {
31412  return this.GetClientPopupPos(element, null, ASPx.InvalidPosition, isX, true);
31413 },
31414 GetAnimationHorizontalDirection: function(index, horizontalPopupPosition) {
31415  return ASPx.PopupUtils.GetAnimationHorizontalDirection(horizontalPopupPosition, this.popupHorizontalAlign, this.popupVerticalAlign, this.rtl);
31416 },
31417 GetAnimationVerticalDirection: function(index, verticalPopupPosition) {
31418  return ASPx.PopupUtils.GetAnimationVerticalDirection(verticalPopupPosition, this.popupHorizontalAlign, this.popupVerticalAlign);
31419 },
31420 OnAnimationStop: function(index) {
31421  this.OnWindowShown(index);
31422 },
31423 PerformCallback: function(parameter, onSuccess) {
31424  this.PerformWindowCallback(null, parameter, onSuccess);
31425 },
31426 PerformWindowCallback: function(window, parameter, onSuccess) {
31427  parameter = ASPx.IsExists(parameter) ? parameter.toString() : "";
31428  var index = (window != null) ? window.index : -1;
31429  if(!this.InWindowCallback(index)) {
31430   var windowCallbackArguments = index + ";" + parameter;
31431   this.CreateWindowCallback(index, windowCallbackArguments, onSuccess);
31432  }
31433 },
31434 InWindowCallback: function(windowIndex) {
31435  return this.windowRequestCount[windowIndex] > 0;
31436 },
31437 CreateWindowCallback: function(windowIndex, argument, handler) {
31438  this.IncreaseWindowRequestCount(windowIndex);
31439  var element = this.GetWindowElement(windowIndex);
31440  if(this.contentLoadingMode != LoadContentViaCallback.OnPageLoad || !element.loading || this.GetShowOnPageLoad(windowIndex))
31441   this.ShowWindowLoadingElements(windowIndex);
31442  this.CreateCallback(argument, null, handler);
31443 },
31444 OnCallback: function(result) {
31445  this.OnCallbackInternal(result.html, result.index, false);
31446 },
31447 OnCallbackError: function(result, data) {
31448  this.OnCallbackInternal(result, ASPx.IsExists(data) ? data : -1, true);
31449 },
31450 OnCallbackErrorAfterUserHandle: function(result, data) {
31451  this.DecreaseWindowRequestCount(data);
31452 },
31453 OnCallbackGeneralError: function(errorMessage) {
31454  this.OnCallbackInternal(errorMessage, -1, true);
31455 },
31456 OnCallbackGeneralErrorAfterUserHandle: function(errorMessage) {
31457  this.DecreaseWindowRequestCount(-1);
31458 },
31459 OnCallbackInternal: function(html, windowIndex, isError) {
31460  var element = this.GetWindowElement(windowIndex);
31461  element.loaded = !isError;
31462  element.loading = false;
31463  this.DecreaseWindowRequestCount(windowIndex);
31464  this.HideWindowLoadingPanel(windowIndex);
31465  this.SetWindowContentHtmlCore(windowIndex, html);
31466  this.UpdatePositionAfterCallback(windowIndex);
31467  this.savedCallbackWindowIndex = windowIndex;
31468  this.UpdateWindowsStateCookie();
31469  if(this.accessibilityCompliant)
31470   this.InitializeAccessibleNavigationCore();
31471 },
31472 RaiseCallbackError: function(message) {
31473  var result = ASPxClientControl.prototype.RaiseCallbackError.call(this, message);
31474  if(result.isHandled)
31475   this.HideAllLoadingPanels();
31476  return result;
31477 },
31478 StartWindowBeginCallbackAnimation: function(windowIndex) {
31479  this.callbackAnimationProcessings[windowIndex] = true;
31480  this.isCallbackFinishedStates[windowIndex] = false;
31481  ASPx.AnimationHelper.fadeOut(this.GetWindowContentElement(windowIndex), function() { this.FinishWindowBeginCallbackAnimation(windowIndex); }.aspxBind(this));
31482 },
31483 FinishWindowBeginCallbackAnimation: function(windowIndex) {
31484  this.callbackAnimationProcessings[windowIndex] = false;
31485  if(!this.isCallbackFinishedStates[windowIndex])
31486   this.ShowWindowLoadingElementsInternal(windowIndex);
31487  else
31488   this.DoCallback(this.savedCallbackResults[windowIndex]);
31489 },
31490 CheckBeginCallbackAnimationInProgress: function(callbackResult) {
31491  var result;
31492  try {
31493   result = this.EvalCallbackResult(callbackResult).result;
31494  } catch(e) {
31495   return false;
31496  }
31497  var windowIndex = result.index;
31498  if(this.enableCallbackAnimation && this.callbackAnimationProcessings[windowIndex]) {
31499   this.savedCallbackResults[windowIndex] = callbackResult;
31500   this.isCallbackFinishedStates[windowIndex] = true;
31501   return true;
31502  }
31503  return false;
31504 },
31505 StartWindowEndCallbackAnimation: function(windowIndex) {
31506  this.callbackAnimationProcessings[windowIndex] = true;
31507  ASPx.AnimationHelper.fadeIn(this.GetWindowContentElement(windowIndex), function() { this.FinishWindowEndCallbackAnimation(windowIndex); }.aspxBind(this));
31508 },
31509 FinishWindowEndCallbackAnimation: function(windowIndex) {
31510  this.DoEndCallback();
31511  this.callbackAnimationProcessings[windowIndex] = false;
31512 },
31513 CheckEndCallbackAnimationNeeded: function() {
31514  var windowIndex = this.savedCallbackWindowIndex;
31515  this.savedCallbackWindowIndex = null;
31516  if(windowIndex !== null && !this.callbackAnimationProcessings[windowIndex]) {
31517   this.StartWindowEndCallbackAnimation(windowIndex);
31518   return true;
31519  }
31520  return false;
31521 },
31522 EnsureContent: function(windowIndex, isInit) {
31523  var element = this.GetWindowElement(windowIndex);
31524  if(element && !element.loaded && !element.loading) {
31525   var shouldLoad = this.contentLoadingMode == LoadContentViaCallback.OnPageLoad || this.contentLoadingMode == LoadContentViaCallback.OnFirstShow && !isInit;
31526   if(shouldLoad) {
31527    element.loading = true;
31528    this.CreateWindowCallback(windowIndex, windowIndex);
31529   } else if(this.contentLoadingMode == LoadContentViaCallback.Default)
31530    element.loaded = true;
31531  }
31532 },
31533 HideAllLoadingPanels: function() {
31534  if(this.HasDefaultWindow())
31535   this.HideWindowLoadingPanel(-1);
31536  for(var i = 0; i < this.GetWindowCount() ; i++)
31537   this.HideWindowLoadingPanel(i);
31538 },
31539 HideWindowLoadingPanel: function(windowIndex) {
31540  this.ClearWindowLoadingPanelTimer(windowIndex);
31541  if(this.loadingDivs[windowIndex]) {
31542   ASPx.RemoveElement(this.loadingDivs[windowIndex]);
31543   this.loadingDivs[windowIndex] = null;
31544  }
31545  if(this.loadingPanels[windowIndex]) {
31546   ASPx.RemoveElement(this.loadingPanels[windowIndex]);
31547   this.loadingPanels[windowIndex] = null;
31548  }
31549 },
31550 ShowWindowLoadingElements: function(windowIndex) {
31551  if(this.lpTimers[windowIndex] && this.lpTimers[windowIndex] > -1) return;
31552  if(this.enableCallbackAnimation)
31553   this.StartWindowBeginCallbackAnimation(windowIndex);
31554  else
31555   this.ShowWindowLoadingElementsInternal(windowIndex);
31556 },
31557 ShowWindowLoadingPanelOnTimer: function(windowIndex) {
31558  this.ClearWindowLoadingPanelTimer(windowIndex);
31559  this.ShowWindowLoadingPanel(windowIndex);
31560 },
31561 ClearWindowLoadingPanelTimer: function(windowIndex) {
31562  this.lpTimers[windowIndex] = ASPx.Timer.ClearTimer(this.lpTimers[windowIndex]);
31563 },
31564 ShowWindowLoadingElementsInternal: function(windowIndex) {
31565  if(this.lpDelay > 1 && !this.enableCallbackAnimation) {
31566   var _this = this;
31567   this.lpTimers[windowIndex] = window.setTimeout(function() { _this.ShowWindowLoadingPanelOnTimer(windowIndex); }, this.lpDelay);
31568  }
31569  else
31570   this.ShowWindowLoadingPanel(windowIndex);
31571 },
31572 ShowWindowLoadingPanel: function(windowIndex) {
31573  if(!this.IsExistLoadingPanel())
31574   return;
31575  if(!this.loadingPanels[windowIndex] && this.InternalIsWindowVisible(windowIndex)) {
31576   var parentElement = this.GetWindowElement(windowIndex).parentNode;
31577   var offsetElement = this.GetLoadingPanelOffsetElement(windowIndex);
31578   this.loadingDivs[windowIndex] = this.CreateLoadingDiv(parentElement, offsetElement, windowIndex);
31579   this.loadingPanels[windowIndex] = this.CreateLoadingPanelWithAbsolutePosition(parentElement, offsetElement, windowIndex);
31580  }
31581 },
31582 GetLoadingPanelOffsetElement: function(windowIndex) {
31583  return this.GetWindowContentWrapperElement(windowIndex);
31584 },
31585 IsExistLoadingPanel: function() {
31586  return !!this.GetLoadingDiv();
31587 },
31588 LockAnimation: function() {
31589  this.animationLockCount++;
31590 },
31591 UnlockAnimation: function() {
31592  this.animationLockCount--;
31593 },
31594 IsAnimationLocked: function() {
31595  return this.animationLockCount > 0;
31596 },
31597 IsAnimationAllowed: function() {
31598  return this.enableAnimation && !this.IsAnimationLocked();
31599 },
31600 SetWindowSizeByIndexCore: function(index, width, height, isWindowCollapsed) {
31601  this.SetClientWindowSizeLite(index, width, height, isWindowCollapsed);
31602  var iFrame = this.GetWindowIFrame(index);
31603  if(iFrame && !isWindowCollapsed) {
31604   var winElememnt = this.GetWindowElement(index);
31605   var realWidth = winElememnt.offsetWidth;
31606   var realHeight = winElememnt.offsetHeight;
31607   ASPx.SetStyles(iFrame, { width: realWidth, height: realHeight });
31608  }
31609  this.UpdateWindowsStateCookie();
31610 },
31611 SetWindowSizeByIndex: function(index, width, height) {
31612  var minWidth = this.GetWindowMinWidth(index);
31613  var minHeight = this.GetWindowMinHeight(index);
31614  var maxWidth = this.GetWindowMaxWidth(index);
31615  var maxHeight = this.GetWindowMaxHeight(index);
31616  if(minWidth)
31617   width = Math.max(width, minWidth);
31618  if(minHeight)
31619   height = Math.max(height, minHeight);
31620  if(maxWidth)
31621   width = Math.min(width, maxWidth);
31622  if(maxHeight)
31623   height = Math.min(height, maxHeight);
31624  var isWindowMaximized = this.GetIsMaximized(index);
31625  var isWindowCollapsed = this.GetIsCollapsed(index);
31626  var isWindowMaximizedAndCollapsed = (isWindowMaximized && isWindowCollapsed);
31627  if(this.SizeCanBeSet(index, isWindowMaximizedAndCollapsed)) {
31628   if(!this.CollapseExecuting() && !this.MaximizationExecuting() && !this.ResizingForMaxWindowLocked()) {
31629    this.SetWindowCachedSize(index, width, height);
31630    this.SetIsResized(index, true);
31631   }
31632   if(isWindowCollapsed && !this.MaximizationExecuting() && !this.ResizingForMaxWindowLocked()) {
31633    this.SetWindowCachedSize(index, width, height);
31634    this.UpdateRestoredWindowSize(index, width, height);
31635    height = 0;
31636   }
31637   if(isWindowMaximized && !this.CollapseExecuting() && !this.ResizingForMaxWindowLocked()) {
31638    this.SetWindowCachedSize(index, width, height);
31639    this.UpdateRestoredWindowSize(index, width, height);
31640   } else {
31641    this.SetWindowSizeByIndexCore(index, width, height, isWindowCollapsed);
31642   }
31643  } else
31644   this.SetWindowCachedSize(index, width, height);
31645 },
31646 SizeCanBeSet: function(index, isWindowMaximizedAndCollapsed) {
31647  return this.InternalIsWindowDisplayed(index) && this.IsWindowElementsIDAssigned(index) && (!isWindowMaximizedAndCollapsed || this.ResizingForMaxWindowLocked());
31648 },
31649 RestoreWindowSizeFromCache: function(index) {
31650  var cachedSize = this.GetWindowCachedSize(index);
31651  if(cachedSize != null) {
31652   if(cachedSize.width !== this.GetClientWindowWidth(index, true, true) ||
31653      cachedSize.height !== this.GetClientWindowHeight(index, true, true))
31654    this.SetWindowSizeByIndex(index, cachedSize.width, cachedSize.height);
31655   this.ResetWindowCachedSize(index);
31656  }
31657 },
31658 CollapseExecuting: function() {
31659  return false;
31660 },
31661 MaximizationExecuting: function() {
31662  return false;
31663 },
31664 ResizingForMaxWindowLocked: function() {
31665  return false;
31666 },
31667 IsResizeAllowed: function(index) {
31668  return this.allowResize;
31669 },
31670 GetWindowDimensionByIndex: function(index, isWidth, forceFromCache) {
31671  var cachedSize = this.GetWindowCachedSize(index);
31672  var dimensionValue = null;
31673  if(forceFromCache == undefined && !this.GetWindowElement(index))
31674   forceFromCache = true;
31675  if(cachedSize && forceFromCache)
31676   dimensionValue = isWidth ? cachedSize.width : cachedSize.height;
31677  if(dimensionValue)
31678   return dimensionValue;
31679  else {
31680   var element = this.GetWindowElement(index);
31681   var sizeFromDOM = 0;
31682   if(this.GetIsCollapsed(index)) {
31683    var headerCell = this.GetWindowHeaderElement(index);
31684    sizeFromDOM = isWidth ? headerCell.offsetWidth : headerCell.offsetHeight;
31685   }
31686   else {
31687    var mainCell = this.GetWindowMainCell(element);
31688    sizeFromDOM = isWidth ? mainCell.offsetWidth : mainCell.offsetHeight;
31689   }
31690   if(sizeFromDOM === 0 && cachedSize)
31691    sizeFromDOM = isWidth ? cachedSize.width : cachedSize.height;
31692   return sizeFromDOM;
31693  }
31694 },
31695 SetWindowSize: function(window, width, height) {
31696  var index = (window != null) ? window.index : -1;
31697  this.SetWindowSizeByIndex(index, width, height);
31698 },
31699 SetSize: function(width, height) {
31700  this.SetWindowSize(null, width, height);
31701 },
31702 SetWidth: function(width) {
31703  var height = this.GetHeight();
31704  this.SetSize(width, height);
31705 },
31706 SetHeight: function(height) {
31707  var width = this.GetWidth();
31708  this.SetSize(width, height);
31709 },
31710 GetHeight: function() {
31711  return this.GetWindowDimensionByIndex(-1, false, false);
31712 },
31713 GetWidth: function() {
31714  return this.GetWindowDimensionByIndex(-1, true, false);
31715 },
31716 CanBeClosedByClickOnElement: function(index, srcElement, posX, id) {
31717  return srcElement === null || ASPx.GetParentById(srcElement, id) === null;
31718 },
31719 OnMouseDown: function(evt, index, isDraggingAllowed, pointOnScrollBar) {
31720  if(ASPx.Evt.IsLeftButtonPressed(evt)) {
31721   if((this.IsResizeAllowed(index) || isDraggingAllowed) && !this.prohibitClearSelectionOnMouseDown) 
31722    ASPx.Selection.Clear();
31723   var isResizing = this.ProcessResizeOnMouseDown(evt, index);
31724   var clickedOnScroll = pointOnScrollBar && this.GetEnableContentScrolling(index);
31725   if(isDraggingAllowed && !isResizing && !clickedOnScroll && !this.GetIsPinned(index) && !this.GetIsMaximized(index) && !ASPx.Ident.IsFocusableElementRegardlessTabIndex(evt.target))
31726    this.OnDragStart(evt, index);
31727  }
31728 },
31729 OnMouseMove: function(evt, index) {
31730  if(this.allowResize && !this.GetIsCollapsed(index) && !this.GetIsMaximized(index))
31731   this.CreateResizeCursorInfo(evt, index);
31732 },
31733 CreateResizeCursorInfo: function(evt, index) {
31734  var element = this.GetWindowElement(index);
31735  var mainCell = this.GetWindowMainCell(element);
31736  var clientWindow = this.GetWindowClientTable(index);
31737  var headerElement = this.GetWindowHeaderElement(index);
31738  var left = ASPx.GetAbsoluteX(mainCell);
31739  var top = ASPx.GetAbsoluteY(mainCell);
31740  var x = ASPx.Evt.GetEventX(evt);
31741  var y = ASPx.Evt.GetEventY(evt);
31742  var mainCellWidth = mainCell.offsetWidth;
31743  var mainCellHeight = mainCell.offsetHeight;
31744  var leftOffset = Math.abs(x - left);
31745  var rightOffset = Math.abs(x - left - mainCellWidth);
31746  var topOffset = Math.abs(y - top);
31747  var bottomOffset = Math.abs(y - top - mainCellHeight);
31748  var cursorInfo = this.CreateResizeBorderCursorInfo(index, leftOffset, rightOffset, topOffset, bottomOffset);
31749  var grip = this.GetWindowSizeGripElement(index);
31750  if(grip) {
31751   var gripCursorInfo = this.CreateGripCursorInfo(index, mainCell, grip, leftOffset, rightOffset, bottomOffset);
31752   if(gripCursorInfo)
31753    cursorInfo = gripCursorInfo;
31754  }
31755  this.UpdateResizeCursor(index, clientWindow, cursorInfo.verticalDirection, cursorInfo.horizontalDirection);
31756  this.UpdateResizeCursor(index, mainCell, cursorInfo.verticalDirection, cursorInfo.horizontalDirection);
31757  if(headerElement)
31758   this.UpdateResizeCursor(index, headerElement, cursorInfo.verticalDirection, cursorInfo.horizontalDirection);
31759  return cursorInfo;
31760 },
31761 UpdateResizeCursor: function(index, element, verticalDirection, horizontalDirection) {
31762  var cursor = verticalDirection + horizontalDirection;
31763  if(cursor == "")
31764   this.HideTemporaryCursor(element);
31765  else {
31766   cursor += "-resize";
31767   this.ShowTemporaryCursor(element, cursor);
31768  }
31769 },
31770 CreateGripCursorInfo: function(index, mainCell, grip, leftOffset, rightOffset, bottomOffset) {
31771  var gripWidth = this.rtl
31772   ? ASPx.GetAbsoluteX(grip) - ASPx.GetAbsoluteX(mainCell) + grip.offsetWidth
31773   : mainCell.offsetWidth - (ASPx.GetAbsoluteX(grip) - ASPx.GetAbsoluteX(mainCell));
31774  var gripHeight = mainCell.offsetHeight - (ASPx.GetAbsoluteY(grip) - ASPx.GetAbsoluteY(mainCell));
31775  if(gripHeight > bottomOffset) {
31776   if(this.rtl && gripWidth > leftOffset)
31777    return new PCResizeCursorInfo("w", "s", leftOffset, bottomOffset);
31778   if(gripWidth > rightOffset)
31779    return new PCResizeCursorInfo("e", "s", rightOffset, bottomOffset);
31780  }
31781  return null;
31782 },
31783 CreateResizeBorderCursorInfo: function(index, leftOffset, rightOffset, topOffset, bottomOffset) {
31784  var ResizeBorderSize = this.ResizeBorderSize;
31785  var verticalDirection = this.GetResizeVerticalCourse(ResizeBorderSize, topOffset, bottomOffset);
31786  ResizeBorderSize = verticalDirection != "" ? this.ResizeCornerBorderSize : this.ResizeBorderSize;
31787  var horizontalDirection = this.GetResizeHorizontalCourse(ResizeBorderSize, leftOffset, rightOffset);
31788  if(verticalDirection == "" && horizontalDirection != "")
31789   verticalDirection = this.GetResizeVerticalCourse(this.ResizeCornerBorderSize, topOffset, bottomOffset);
31790  var horizontalOffset = leftOffset < rightOffset ? leftOffset : rightOffset;
31791  var verticalOffset = topOffset < bottomOffset ? topOffset : bottomOffset;
31792  return new PCResizeCursorInfo(horizontalDirection, verticalDirection, horizontalOffset, verticalOffset);
31793 },
31794 GetResizeVerticalCourse: function(ResizeBorderSize, topOffset, bottomOffset) {
31795  if(ResizeBorderSize > topOffset) return "n";
31796  if(ResizeBorderSize > bottomOffset) return "s";
31797  return "";
31798 },
31799 GetResizeHorizontalCourse: function(ResizeBorderSize, leftOffset, rightOffset) {
31800  if(ResizeBorderSize > leftOffset) return "w";
31801  if(ResizeBorderSize > rightOffset) return "e";
31802  return "";
31803 },
31804 ProcessResizeOnMouseDown: function(evt, index) {
31805  var isResizing = false;
31806  if(this.IsResizeAllowed(index) && !this.GetIsCollapsed(index) && !this.GetIsMaximized(index)) {
31807   var eventSourceControl = ASPx.Evt.GetEventSource(evt);
31808   var eventFromPopupContainer = ASPx.ElementHasCssClass(eventSourceControl, PopupControlCssClasse
31808s.ContentCssClassName) ||
31809    !ASPx.GetParentByClassName(eventSourceControl, PopupControlCssClasses.ContentCssClassName) ||
31810    this.eventFromOwnPopupContent(eventSourceControl);
31811   if(eventFromPopupContainer && getComputedStyle(evt.target).cursor !== "pointer")
31812    isResizing = this.OnResizeStart(evt, index);
31813  }
31814  if(isResizing && ASPx.Browser.WebKitTouchUI)
31815   aspxGetPopupControlCollection().OverStop();
31816  return isResizing;
31817 },
31818 eventFromOwnPopupContent: function(element) {
31819  while(element != null) {
31820   if(element.tagName == "BODY")
31821    return false;
31822   if(element.style.position == "absolute") {
31823    var windowIndex = this.GetWindowIndex(element);
31824    var isPopupWindow = !isNaN(windowIndex);
31825    if(isPopupWindow) {
31826     if(this.GetWindowElementId(windowIndex) == element.id)
31827      return true;
31828     return false;
31829    } else {
31830     var elementIsOtherPopup = element.style.zIndex >= this.GetPopupControlZIndex(); 
31831     if(elementIsOtherPopup)
31832      return false;
31833    }
31834   }
31835   element = element.parentNode;
31836  }
31837  return false;
31838 },
31839 OnResizeStart: function(evt, index) {
31840  if(!aspxGetPopupControlCollection().IsResizeInint()) {
31841   var cursor = this.CreateResizeCursorInfo(evt, index);
31842   if(cursor.course != "") {
31843    aspxGetPopupControlCollection().setIframesMouseMoveEnabled(false);
31844    this.EnsureWindowCoverDiv(index);
31845    this.SetIsResized(index, true);
31846    var resizePanel = this.CreateResizePanel(index);
31847    this.UpdateResizeCursor(index, resizePanel, cursor.verticalDirection, cursor.horizontalDirection);
31848    aspxGetPopupControlCollection().InitResizeObject(this, index, cursor, resizePanel);
31849    this.OnResize(evt, index, cursor, resizePanel);
31850   }
31851   ASPx.TouchUIHelper.startPreventingTouchMove();
31852  }
31853  return aspxGetPopupControlCollection().IsResizeInint();
31854 },
31855 OnResizeStop: function(evt, index, cursor, resizePanel) {
31856  if(this.IsResizeAllowed(index)) {
31857   ASPx.TouchUIHelper.stopPreventingTouchMove();
31858   aspxGetPopupControlCollection().setIframesMouseMoveEnabled(true);
31859   this.RemoveWindowCoverDiv();
31860   var windowElement;
31861   if(!this.isLiveResizingMode) {
31862    windowElement = this.GetWindowElement(index);
31863    ASPx.GetControlCollection().CollapseControls(windowElement);
31864    this.OnResizeWindow(index, cursor, resizePanel);
31865   }
31866   this.CreateResizeCursorInfo(evt, index);
31867   this.UpdateWindowsStateCookie();
31868   this.RaiseResize(index);
31869   if(!this.isLiveResizingMode)
31870    ASPx.GetControlCollection().AdjustControls(windowElement, true);
31871  }
31872  this.ResetResizeSessionCache();
31873 },
31874 OnResizeWindow: function(index, cursor, resizePanel) {
31875  var windowElement = this.GetWindowElement(index);
31876  var resizePanelDimensions = this.GetResizePanelDimensions();
31877  var left = resizePanelDimensions.left;
31878  var top = resizePanelDimensions.top;
31879  this.SetClientWindowSizeLite(index, resizePanelDimensions.offsetWidth, resizePanelDimensions.offsetHeight);
31880  if(this.fixedBottom)
31881   top = this.fixedBottom - windowElement.offsetHeight;
31882  if(this.fixedRight)
31883   left = this.fixedRight - windowElement.offsetWidth;
31884  this.fixedBottom = null;
31885  this.fixedRight = null;
31886  if(cursor.verticalDirection === "n")
31887   this.ChangePosOnResizeWindow(top, windowElement, false);
31888  if(cursor.horizontalDirection === "w")
31889   this.ChangePosOnResizeWindow(left, windowElement, true);
31890  if(this.InternalIsWindowVisible(index)) 
31891   this.DoShowWindowIFrame(index, left, top, ASPx.InvalidDimension, ASPx.InvalidDimension);
31892 },
31893 ChangePosOnResizeWindow: function(pos, windowElement, isX) {
31894  windowElement.style[isX ? "left" : "top"] = pos + "px";
31895 },
31896 SetClientWindowSizeLite: function(index, width, height, isWindowCollapsed) {
31897  this.RaiseBeforeResizing(index);
31898  this.SetClientWindowSizeCoreLite(index, width, height, isWindowCollapsed);
31899  if(!this.IsRaiseAfterResizingLocked())
31900   this.RaiseAfterResizing(index);
31901 },
31902 SetClientWindowSizeCoreLite: function(index, width, height, isWindowCollapsed) {
31903  var contentUrl = this.GetWindowContentIFrameUrl(index);
31904  var needToHideContent = !contentUrl;
31905  var element = this.GetWindowElement(index);
31906  var contentWrapper = this.GetWindowContentWrapperElement(index);
31907  var contentElement = this.GetWindowContentElement(index);
31908  var contentIframeElement = this.GetWindowContentIFrameElement(index);
31909  var iframeHeightCorrectionOnFirstShow = height > 0;
31910  if(contentIframeElement && (this.GetWindowIsShown(index) || iframeHeightCorrectionOnFirstShow))
31911   contentIframeElement.style.height = "0px";
31912  contentWrapper.style.height = "";
31913  contentWrapper.style.width = "";
31914  contentElement.style.height = "";
31915  contentElement.style.width = "";
31916  var hasAnyScrollBars = this.HasAnyScrollBars(index);
31917  var expectedHeight = (!ASPx.IsExists(height) && hasAnyScrollBars) ? this.GetExpectedHeight(index) : null;
31918  if(needToHideContent)
31919   contentElement.style.display = "none";
31920  var elementsDisplayValue = this.GetWindowElementDisplayValue(hasAnyScrollBars, height);
31921  element.style.display = elementsDisplayValue;
31922  if(!this.GetIsCollapsed(index))
31923   contentWrapper.style.display = elementsDisplayValue;
31924  if(ASPx.IsExists(width)) {
31925   var actualWidth = width - this.GetElementBordersAndPaddings(index, element, true);
31926   if(actualWidth <= 0)
31927    actualWidth = ASPx.Browser.WebKitFamily ? 1 : 0; 
31928   element.style.width = actualWidth + "px";
31929  }
31930  var actualHeight;
31931  if(ASPx.IsExists(height)) {
31932   actualHeight = height - this.GetElementBordersAndPaddings(index, element, false);
31933   if(actualHeight < 0)
31934    actualHeight = 0;
31935   element.style.height = actualHeight + "px";
31936  } else {
31937   if(ASPx.IsExists(expectedHeight)) {
31938    actualHeight = expectedHeight;
31939    element.style.height = actualHeight + "px";
31940   }
31941  }
31942  this.CorrectWindowSizeGripPositionLite(index);
31943  this.CorrectWindowHeaderText(index);
31944  this.SetContentWrapperHeightLite(index, actualHeight, element, contentWrapper);
31945  var correctContentElementSize = hasAnyScrollBars || contentElement.style.overflow == "hidden" || contentElement.style.overflowX == "hidden" || contentElement.style.overflowY == "hidden";
31946  if((correctContentElementSize || contentUrl) && (height || expectedHeight)) {
31947   if(contentElement !== contentWrapper) {
31948    var contentHeight = ASPx.GetClearClientHeight(contentWrapper);
31949    if(contentHeight < 0)
31950     contentHeight = 0;
31951    contentElement.style.height = contentHeight + "px";
31952   }
31953  }
31954  if(correctContentElementSize && width && contentElement !== contentWrapper)
31955   contentElement.style.width = ASPx.GetClearClientWidth(contentWrapper) + "px";
31956  contentElement.style.display = this.getContentElementDisplay(correctContentElementSize, contentUrl);
31957  if(contentIframeElement)
31958   contentIframeElement.style.height = "100%";
31959  this.SetWindowWidth(index, width);
31960  this.SetWindowHeight(index, height);
31961  if(isWindowCollapsed)
31962   this.ResetWindowHeight(index);
31963 },
31964 GetExpectedHeight: function(index) {
31965  var height = this.GetWindowHeightInternal(index) || 0;
31966  height = Math.max(height, this.GetWindowMinHeight(index));
31967  if(this.HasAnyScrollBars(index)) {
31968   var windowHeight = this.GetWindowContentElement(index).offsetHeight + this.GetWindowHeightWithoutContent(index);
31969   height = Math.max(height, windowHeight);
31970  }
31971  var maxHeight = this.GetWindowMaxHeight(index);
31972  if(maxHeight)
31973   height = Math.min(height, maxHeight);
31974  return height;
31975 },
31976 IsRaiseAfterResizingLocked: function() {
31977  return false;
31978 },
31979 CreateResizePanel: function(index) {
31980  var element = this.GetWindowElement(index);
31981  var resizePanel = document.createElement("DIV");
31982  element.parentNode.appendChild(resizePanel);
31983  resizePanel.style.overflow = "hidden";
31984  resizePanel.style.position = "absolute";
31985  resizePanel.style.zIndex = this.GetPopupControlZIndex() + aspxGetPopupControlCollection().visiblePopupWindowIds.length * 2 + 2;
31986  if(!this.isLiveResizingMode)
31987   resizePanel.style.border = "black 1px dotted";
31988  return resizePanel;
31989 },
31990 OnResize: function(evt, index, cursor, resizePanel) {
31991  this.OnResizePanelLite(evt, index, cursor, resizePanel);
31992  if(this.isLiveResizingMode)
31993   this.OnResizeWindow(index, cursor, resizePanel);
31994  ASPx.Selection.Clear();
31995  if(ASPx.Browser.WebKitTouchUI)
31996   ASPx.Evt.PreventEvent(evt);
31997  if(this.GetIsPinned(index))
31998   this.HoldPosition(index, true, resizePanel);
31999 },
32000 OnResizePanelLite: function(evt, index, cursor, resizePanel) {
32001  var x = ASPx.Evt.GetEventX(evt);
32002  var y = ASPx.Evt.GetEventY(evt);
32003  var element = this.GetWindowElement(index);
32004  var elementTop = ASPx.GetAbsoluteY(element);
32005  var elementLeft = ASPx.GetAbsoluteX(element);
32006  var newLeft = ASPx.PxToInt(element.style.left);
32007  var newTop = ASPx.PxToInt(element.style.top);
32008  var newWidth = element.offsetWidth;
32009  var newHeight = element.offsetHeight;
32010  if(cursor.verticalDirection == "n") {
32011   if(!this.fixedBottom)
32012    this.fixedBottom = newTop + newHeight;
32013   newHeight += elementTop - y + cursor.verticalOffset;
32014   newTop = ASPx.PrepareClientPosForElement(y - cursor.verticalOffset, element, false);
32015  }
32016  if(cursor.verticalDirection == "s") {
32017   newHeight = y - elementTop + cursor.verticalOffset;
32018   this.fixedBottom = null;
32019  }
32020  if(cursor.horizontalDirection == "w") {
32021   if(!this.fixedRight)
32022    this.fixedRight = newLeft + newWidth;
32023   newWidth += elementLeft - x + cursor.horizontalOffset;
32024   newLeft = ASPx.PrepareClientPosForElement(x - cursor.horizontalOffset, element, true);
32025  }
32026  if(cursor.horizontalDirection == "e") {
32027   newWidth = x - elementLeft + cursor.horizontalOffset;
32028   this.fixedRight = null;
32029  }
32030  if(newWidth > 0 && newHeight > 0) {
32031   var minWidth = this.GetWindowMinWidth(index);
32032   var maxWidth = this.GetWindowMaxWidth(index);
32033   if(minWidth && newWidth < minWidth)
32034    newWidth = minWidth;
32035   if(maxWidth && newWidth > maxWidth)
32036    newWidth = maxWidth;
32037   var minHeight = this.GetWindowMinHeight(index);
32038   var maxHeight = this.GetWindowMaxHeight(index);
32039   if(minHeight && newHeight < minHeight)
32040    newHeight = minHeight;
32041   if(maxHeight && newHeight > maxHeight)
32042    newHeight = maxHeight;
32043   this.SetResizePanelDimensions(newLeft, newTop, newWidth, newHeight);
32044   var widthWithoutBorders = newWidth - this.getLeftRightBordersAndPaddingsSummaryValue(resizePanel);
32045   var heightWithoutBorders = newHeight - this.getTopBottomBordersAndPaddingsSummaryValue(resizePanel);
32046   ASPx.SetStyles(resizePanel, {
32047    left: newLeft, top: newTop,
32048    width: widthWithoutBorders, height: heightWithoutBorders
32049   });
32050   this.SetWindowLeft(index, elementLeft);
32051   this.SetWindowTop(index, elementTop);
32052  }
32053 },
32054 SetResizePanelDimensions: function(left, top, offsetWidth, offsetHeight) {
32055  var cache = this.GetResizeSessionCache();
32056  cache.resizePanelDimensions = {
32057   left: left,
32058   top: top,
32059   offsetWidth: offsetWidth,
32060   offsetHeight: offsetHeight
32061  };
32062 },
32063 GetResizePanelDimensions: function() {
32064  var cache = this.GetResizeSessionCache();
32065  return cache.resizePanelDimensions;
32066 },
32067 ResetResizeSessionCache: function() {
32068  this.resizeSessionCache = {};
32069 },
32070 GetResizeSessionCache: function() {
32071  return aspxGetPopupControlCollection().IsResizeInint() ? this.resizeSessionCache : {};
32072 },
32073 EnsureWindowCoverDiv: function(index) {
32074  this.windowCoverDiv = this.CreateCoverDiv(index);
32075  var windowElement = this.GetWindowElement(index);
32076  windowElement.parentNode.appendChild(this.windowCoverDiv);
32077 },
32078 CreateCoverDiv: function(index) {
32079  var coverDiv = document.createElement("DIV");
32080  ASPx.SetStyles(coverDiv, {
32081   position: "fixed",
32082   left: 0,
32083   top: 0,
32084   width: "100%",
32085   height: "100%"
32086  });
32087  return coverDiv;
32088 },
32089 RemoveWindowCoverDiv: function() {
32090  if(!!this.windowCoverDiv) {
32091   this.windowCoverDiv.parentNode.removeChild(this.windowCoverDiv);
32092   this.windowCoverDiv = null;
32093  }
32094 },
32095 OnDrag: function(index, x, y, xClientCorrection, yClientCorrection) {
32096  var element = this.GetWindowElement(index);
32097  if(element != null) {
32098   ASPx.SetStyles(element, { left: x, top: y });
32099   xClientCorrection = typeof (xClientCorrection) != "undefined" ? xClientCorrection : 0;
32100   yClientCorrection = typeof (yClientCorrection) != "undefined" ? yClientCorrection : 0;
32101   this.SetWindowLeft(index, x + xClientCorrection);
32102   this.SetWindowTop(index, y + yClientCorrection);
32103   var iFrame = element.overflowElement;
32104   if(iFrame)
32105    ASPx.SetStyles(iFrame, { left: x, top: y });
32106   if(ASPx.Browser.Opera)
32107    ASPx.Selection.Clear();
32108  }
32109 },
32110 OnDragStop: function(index) {
32111  this.HideDragCursor(index);
32112  this.UpdateWindowsStateCookie();
32113  if(this.GetWindowContentIFrameElement(index))
32114   this.SetIframeVisibleForDragging(index, true);
32115  ASPx.TouchUIHelper.stopPreventingTouchMove();
32116  this.RaiseDragged(index);
32117 },
32118 OnDragStart: function(evt, index) {
32119  this.RaiseBeforeDrag(index);
32120  this.SetIsDragged(index, true);
32121  this.ShowDragCursor(index);
32122  ASPx.TouchUIHelper.startPreventingTouchMove();
32123  if(this.GetWindowContentIFrameElement(index))
32124   this.SetIframeVisibleForDragging(index, false);
32125  this.InitDragInfo(index, evt);
32126 },
32127 HideIframeElementBeforeDragging: function() {
32128 },
32129 InitDragInfo: function(index, evt) {
32130  var element = this.GetWindowElement(index);
32131  var gragXOffset = ASPx.GetAbsoluteX(element) - ASPx.Evt.GetEventX(evt);
32132  var gragYOffset = ASPx.GetAbsoluteY(element) - ASPx.Evt.GetEventY(evt);
32133  var xClientCorrection = this.GetDragCorrection(index, element, true);
32134  var yClientCorrection = this.GetDragCorrection(index, element, false);
32135  gragXOffset -= xClientCorrection;
32136  gragYOffset -= yClientCorrection;
32137  aspxGetPopupControlCollection().InitDragObject(this, index, gragXOffset, gragYOffset, xClientCorrection, yClientCorrection);
32138 },
32139 GetDragCorrection: function(index, element, isX) {
32140  return ASPx.GetPositionElementOffset(element, isX);
32141 },
32142 ShowDragCursor: function(index) {
32143  var dragElement = this.GetDragElement(index);
32144  if(dragElement)
32145   this.ShowTemporaryCursor(dragElement, "move");
32146 },
32147 ShowTemporaryCursor: function(element, cursor) {
32148  ASPx.Attr.ChangeStyleAttribute(element, "cursor", cursor);
32149 },
32150 HideDragCursor: function(index) {
32151  var dragElement = this.GetDragElement(index);
32152  if(dragElement != null)
32153   this.HideTemporaryCursor(dragElement);
32154 },
32155 GetDragElement: function(index) {
32156  var headerElement = this.GetWindowHeaderElement(index);
32157  var element = this.GetWindowElement(index);
32158  if(element != null)
32159   return (headerElement != null ? headerElement : this.GetWindowMainCell(element));
32160  return null;
32161 },
32162 HideTemporaryCursor: function(element) {
32163  ASPx.Attr.RestoreStyleAttribute(element, "cursor");
32164 },
32165 OnDocumentKeyDown: function(evt, popupWindow) {
32166  var handler = this.keyDownHandlers && this.keyDownHandlers[ASPx.GetShortcutCode(evt.keyCode, evt.ctrlKey, evt.shiftKey, evt.altKey)];
32167  if(handler)
32168   handler(this.GetWindowIndex(popupWindow));
32169 },
32170 OnEscKeyDown: function(index) {
32171  if(this.GetEnableCloseByEsc(index))
32172   this.DoHideWindow(index, false, ASPxClientPopupControlCloseReason.Escape);
32173 },
32174 OnRefreshButtonClick: function(index) {
32175  var contentIFrame = this.GetWindowContentIFrameElement(index);
32176  if(contentIFrame)
32177   this.RefreshWindowContentUrl(this.GetWindow(index));
32178  else
32179   this.PerformWindowCallback(this.GetWindow(index));
32180 },
32181 OnCloseButtonClick: function(index) {
32182  this.RaiseCloseButtonClick(index);
32183  if(this.GetWindowCloseAction(index) != "None")
32184   this.DoHideWindow(index, false, ASPxClientPopupControlCloseReason.CloseButton);
32185 },
32186 Show: function(popupElementIndex) {
32187  this.ShowWindowByIndex(-1, popupElementIndex);
32188 },
32189 Hide: function() {
32190  this.HideWindow(null);
32191 },
32192 HideWindow: function(window) {
32193  var index = (window != null) ? window.index : -1;
32194  this.DoHideWindow(index, false, ASPxClientPopupControlCloseReason.API);
32195 },
32196 RaiseEventByIndex: function(index, event, argsName) {
32197  if(!event.IsEmpty()) {
32198   var window = index < 0 ? null : this.GetWindow(index),
32199    args = new argsName(window);
32200   event.FireEvent(this, args);
32201  }
32202 },
32203 RaiseCloseButtonClick: function(index) {
32204  this.RaiseEventByIndex(index, this.CloseButtonClick, ASPxClientPopupWindowEventArgs);
32205 },
32206 RaiseShown: function(index) {
32207  this.RaiseEventByIndex(index, this.Shown, ASPxClientPopupWindowEventArgs);
32208 },
32209 RaisePopUp: function(index) {
32210  this.RaiseEventByIndex(index, this.PopUp, ASPxClientPopupWindowEventArgs);
32211 },
32212 RaiseBeforeResizing: function(index) {
32213  this.RaiseEventByIndex(index, this.BeforeResizing, ASPxClientPopupWindowEventArgs);
32214 },
32215 RaiseAfterResizing: function(index) {
32216  this.RaiseEventByIndex(index, this.AfterResizing, ASPxClientPopupWindowEventArgs);
32217 },
32218 RaiseDragged: function(index) {
32219  this.RaiseEventByIndex(index, this.Dragged, ASPxClientPopupWindowEventArgs);
32220 },
32221 RaiseBeforeDrag: function(index) {
32222  this.RaiseEventByIndex(index, this.BeforeDrag, ASPxClientPopupWindowEventArgs);
32223 },
32224 RaiseClosing: function(index, closeReason) {
32225  var window = index < 0 ? null : this.GetWindow(index);
32226  var cancel = false;
32227  if(!this.Closing.IsEmpty()) {
32228   var args = new ASPxClientPopupWindowCancelEventArgs(window, closeReason);
32229   this.Closing.FireEvent(this, args);
32230   cancel = args.cancel;
32231  }
32232  return cancel;
32233 },
32234 RaiseCloseUp: function(index, closeReason) {
32235  var window = index < 0 ? null : this.GetWindow(index);
32236  if(!this.CloseUp.IsEmpty()) {
32237   var args = new ASPxClientPopupWindowCloseUpEventArgs(window, closeReason);
32238   this.CloseUp.FireEvent(this, args);
32239  }
32240 },
32241 RaiseResize: function(index, resizeState) {
32242  var window = index < 0 ? null : this.GetWindow(index);
32243  if(!this.Resize.IsEmpty()) {
32244   if(!resizeState)
32245    resizeState = ASPxClientPopupControlResizeState.Resized;
32246   var args = new ASPxClientPopupWindowResizeEventArgs(window, resizeState);
32247   this.Resize.FireEvent(this, args);
32248  }
32249 },
32250 RaisePopupOnShow: function(isMoving, index) {
32251  if(!isMoving) {
32252   this.RaisePopUp(index);
32253   if(!this.IsAnimationAllowed() || !this.HasOpenAnimation())
32254    this.OnWindowShown(index);
32255  }
32256 },
32257 OnActivate: function(index, evt) {
32258  var element = this.GetWindowElement(index);
32259  if(element != null)
32260   aspxGetPopupControlCollection().ActivateWindowElement(element, evt, this.GetPopupType(), this.GetDefaultZIndexFromServer(), this.GetPopupControlZIndex());
32261 },
32262 OnPWHBClickCore: function(evt, index, method) {
32263  this.OnActivate(index, evt);
32264  if(ASPx.TouchUIHelper.handleFastTapIfRequired(evt,
32265   function() { this[method](index); }.aspxBind(this), true)) {
32266   return;
32267  }
32268  if(ASPx.Browser.Opera)
32269   ASPx.Evt.EmulateDocumentOnMouseDown(evt);
32270  this[method](index);
32271 },
32272 OnScroll: function(evt, index) {
32273  if(this.HasIframeOnIos(index))
32274   this.ResetWebkitScrolling(this.getTouchScrollerElement(index), 0);
32275  if(!this.GetIsPinned(index) || (this.lockScroll > 0)) return;
32276  this.AdjustPinPositionWhileScroll(index);
32277 },
32278 ResetWebkitScrolling: function(scrollElement, timeout) {
32279  if(scrollElement.scrollTop === 0) {
32280   var styleName = "-webkit-overflow-scrolling";
32281   scrollElement.style[styleName] = "auto";
32282   window.setTimeout(function() {
32283    scrollElement.style[styleName] = "touch";
32284   }.aspxBind(this), timeout);
32285  }
32286 },
32287 HaveSpecialDivForAnimation: function() {
32288  return this.enableAnimation;
32289 },
32290 HasIframeOnIos: function(index) {
32291  return ASPx.Browser.MacOSMobilePlatform && !!this.GetWindowContentIFrameElement(index);
32292 },
32293 WindowIsModal: function(index) {
32294  return this.GetPropertyValue(index, "modal");
32295 },
32296 GetIsPopuped: function(index) {
32297  if(0 <= index && index < this.GetWindowCountCore())
32298   return this.windowsIsPopupedList[index];
32299  return this.defaultIsPopuped;
32300 },
32301 SetIsPopuped: function(index, isPopuped) {
32302  if(0 <= index && index < this.GetWindowCountCore())
32303   this.windowsIsPopupedList[index] = isPopuped;
32304  this.defaultIsPopuped = isPopuped;
32305 },
32306 GetIsMaximized: function(index) {
32307  return false;
32308 },
32309 GetIsMaximizedInit: function(index) {
32310  return false;
32311 },
32312 GetCurrentLeft: function(index) {
32313  return this.GetPosition(index, true);
32314 },
32315 GetCurrentTop: function(index) {
32316  return this.GetPosition(index, false);
32317 },
32318 GetIsPinned: function(index) {
32319  return false;
32320 },
32321 GetIsCollapsed: function(index) {
32322  return false;
32323 }, 
32324 needToHidePinnedOutFromViewPort: function(index) {
32325  return false;
32326 },
32327 GetHideBodyScrollWhenModal: function(index) {
32328  return false;
32329 },
32330 GetCanScrollViewPort: function(index) {
32331  return false;
32332 },
32333 GetEnableContentScrolling: function(index) {
32334  return false;
32335 },
32336 AutoUpdateElementsPosition: function() {
32337 },
32338 GetWindowChild: function(index, idPostfix) {
32339  var elem = this.GetWindowElement(index);
32340  if(elem)
32341   return ASPx.GetChildById(elem, this.name + idPostfix);
32342  return null;
32343 },
32344 GetWindowIndex: function(element) {
32345  var id = element.id;
32346  var pos = id.lastIndexOf(ASPx.PCWIdSuffix);
32347  return parseInt(id.substr(pos + ASPx.PCWIdSuffix.length));
32348 },
32349 GetWindow: function(index) {
32350  return (0 <= index && index < this.windows.length) ? this.windows[index] : null;
32351 },
32352 DoShowWindowIFrame: function(index, x, y, width, height) {
32353  if(!this.renderIFrameForPopupElements) return;
32354  var element = this.GetWindowElement(index);
32355  var iFrame = this.GetWindowIFrame(index);
32356  if(element && iFrame) {
32357   var cell = this.GetWindowMainCell(element);
32358   if(width < 0)
32359    width = cell.offsetWidth;
32360   if(height < 0)
32361    height = cell.offsetHeight;
32362   ASPx.SetStyles(iFrame, { width: width, height: height });
32363   if(this.IsValidPosition(x) && this.IsValidPosition(y))
32364    ASPx.SetStyles(iFrame, { left: x, top: y });
32365   if(ASPx.Browser.Firefox)
32366    this.ClearWindowIframeBodyInnerHtml(iFrame);
32367   ASPx.SetElementDisplay(iFrame, true);
32368  }
32369 },
32370 IsValidPosition: function(pos) {
32371  return pos !== ASPx.InvalidPosition;
32372 },
32373 DoHideWindowIFrame: function(element) {
32374  if(!this.renderIFrameForPopupElements) return;
32375  var iFrame = element.overflowElement;
32376  if(iFrame)
32377   ASPx.SetElementDisplay(iFrame, false);
32378 },
32379 GetIframeBody: function(iFrame) {
32380  var document = iFrame.contentDocument || iFrame.contentWindow.document;
32381  if(document)
32382   return document.getElementsByTagName('body')[0];
32383 },
32384 ClearWindowIframeBodyInnerHtml: function(iFrame) {
32385  var iFrameBody = this.GetIframeBody(iFrame);
32386  if(iFrameBody)
32387   iFrameBody.innerHTML = "";
32388 },
32389 FindWindowIFrame: function(index) {
32390  return ASPx.GetElementById(this.name + "_DXPWIF" + index);
32391 },
32392 GetWindowIFrame: function(index) {
32393  var element = this.GetWindowElement(index);
32394  var iFrame = element.overflowElement;
32395  if(!iFrame) {
32396   iFrame = this.FindWindowIFrame(index);
32397   element.overflowElement = iFrame;
32398  }
32399  return iFrame;
32400 },
32401 CreateFakeDivForIframe: function(iframe) {
32402  var fakeDiv = document.createElement("div");
32403  ASPx.SetStyles(fakeDiv, { width: iframe.offsetWidth, height: iframe.offsetHeight });
32404  return fakeDiv;
32405 },
32406 CreateIframeCoverDiv: function(iframe, index) {
32407  if(!this.iframeCoverDiv)
32408   this.iframeCoverDiv = [];
32409  if(!this.iframeCoverDiv[index])
32410   this.iframeCoverDiv[index] = this.CreateFakeDivForIframe(iframe);
32411  this.iframeCoverDiv[index].style.position = "absolute";
32412  iframe.parentElement.appendChild(this.iframeCoverDiv[index]);
32413  ASPx.SetAbsoluteX(this.iframeCoverDiv[index], ASPx.GetAbsoluteX(iframe));
32414  ASPx.SetAbsoluteY(this.iframeCoverDiv[index], ASPx.GetAbsoluteY(iframe));
32415 },
32416 RemoveIframeCoverDiv: function(iframe, index) {
32417  iframe.parentElement.removeChild(this.iframeCoverDiv[index]);
32418  this.iframeCoverDiv[index] = null;
32419 },
32420 GetWindowBorderOwnerElement: function(windowElement) {
32421  if(ASPx.ElementHasCssClass(windowElement, PopupControlCssClasses.MainDivLiteCssClass))
32422   return windowElement;
32423  else
32424   return ASPx.GetNodeByClassName(windowElement, PopupControlCssClasses.MainDivLiteCssClass);
32425 },
32426 GetWindowContentIFrameElement: function(index) {
32427  return this.GetWindowChild(index, "_CIF" + index);
32428 },
32429 GetWindowContentElement: function(index) {
32430  return this.GetWindowChild(index, "_PWC" + index);
32431 },
32432 GetWindowContentIFrameElementId: function(index) {
32433  return this.name + "_CIF" + index;
32434 },
32435 GetContentContainer: function(index) {
32436  return this.GetWindowContentElement(index);
32437 },
32438 getTouchScrollerElement: function(index) {
32439  return this.GetContentContainer(index);
32440 },
32441 GetWindowHeaderElement: function(index) {
32442  return this.GetWindowChild(index, "_PWH" + index);
32443 },
32444 GetWindowFooterElement: function(index) {
32445  return this.GetWindowChild(index, "_PWF" + index);
32446 },
32447 GetWindowSizeGripElement: function(index) {
32448  var footer = this.GetWindowFooterElement(index);
32449  if(!footer)
32450   return null;
32451  var descendants = ASPx.GetNodesByClassName(footer, PopupControlCssClasses.SizeGripLiteCssClassName);
32452  return descendants.length > 0 ? descendants[0] : null;
32453 },
32454 GetWindowContentWrapperElement: function(index) {
32455  if(!ASPx.IsExistsElement(this.windowContentElements[index])) {
32456   var windowElem = this.GetWindowElement(index);
32457   var contentWrapperParent = this.GetWindowMainCell(windowElem);
32458   this.windowContentElements[index] = ASPx.GetChildByClassName(contentWrapperParent, PopupControlCssClasses.ContentWrapperCssClassName);
32459  }
32460  return this.windowContentElements[index];
32461 },
32462 GetWindowMainCell: function(element) {
32463  return this.HaveSpecialDivForAnimation() ? ASPx.GetNodeByTagName(element, "DIV", 0) : element;
32464 },
32465 GetWindowModalElement: function(index) {
32466  var element = this.GetWindowElement(index);
32467  if(!element) return;
32468  var modalElement = element.modalElement;
32469  if(!modalElement) {
32470   modalElement = this.FindWindowModalElement(index);
32471   element.modalElement = modalElement;
32472   if(modalElement) {
32473    modalElement.DXModalPopupControl = this;
32474    modalElement.DXModalPopupWindowIndex = index;
32475   }
32476  }
32477  return modalElement;
32478 },
32479 CanManipulateWithModalElement: function(index) {
32480  return this.WindowIsModal(index);
32481 },
32482 GetCurrentZIndex: function(index) {
32483  var element = this.GetWindowElement(index);
32484  if(element != null) {
32485   if(element.style.zIndex != "" && element.style.zIndex != this.GetDefaultZIndexFromServer())
32486    return element.style.zIndex;
32487   return this.GetZIndex(index);
32488  }
32489 },
32490 GetWindowsState: function() {
32491  var state = "";
32492  if(this.HasDefaultWindow()) {
32493   state += this.GetWindowState(-1);
32494  }
32495  return state;
32496 },
32497 GetWindowState: function(index) {
32498  var element = this.GetWindowElement(index);
32499  if(element != null) {
32500   var visibleFlag = (!this.InternalIsWindowVisible(index) || element.isHiding) ? "0" : "1";
32501   var isDraggedFlag = this.GetIsDragged(index) ? "1" : "0";
32502   var zIndex = this.GetCurrentZIndex(index);
32503   var isResized = this.GetIsResized(index);
32504   var isResizedFlag = isResized ? "1" : "0";
32505   var width = null, height=null;
32506   if(isResized) {
32507    width = this.GetWindowWidthInternal(index);
32508    height = this.GetIsCollapsed(index) ? this.GetWindowDimensionByIndex(index, false, true) : this.GetWindowHeightInternal(index);
32509   } else {
32510    width = ASPx.InvalidDimension;
32511    height = ASPx.InvalidDimension;
32512   }
32513   var contentWasLoaded = element.loaded ? "1" : "0";
32514   var left, top;
32515   var isMaximized = this.GetIsMaximized(index);
32516   if(isMaximized && !this.MaximizationExecuting()) {
32517    var restoredWindowData = this.GetRestoredWindowData(index);
32518    left = restoredWindowData.left;
32519    top = restoredWindowData.top;
32520   } else {
32521    left = this.GetCurrentLeft(index);
32522    top = this.GetCurrentTop(index);
32523   }
32524   var isPinned = this.GetIsPinned(index);
32525   if(isPinned) {
32526    left -= ASPx.GetDocumentScrollLeft();
32527    top -= ASPx.GetDocumentScrollTop();
32528   }
32529   left = Math.ceil(left);
32530   top = Math.ceil(top);
32531   var pinFlag = isPinned ? "1" : "0";
32532   var minFlag = this.GetIsCollapsed(index) ? "1" : "0";
32533   var maxFlag = isMaximized || this.GetIsMaximizedInit(index) ? "1" : "0";
32534   return [visibleFlag, isDraggedFlag, zIndex, left, top, isResizedFlag, width, height, contentWasLoaded, pinFlag, minFlag, maxFlag].join(":");
32535  }
32536  return "";
32537 },
32538 UpdateStateObject: function(){
32539  this.UpdateStateObjectWithObject({ windowsState: this.GetWindowsState() });
32540 },
32541 GetStateHiddenFieldOrigin: function() {
32542  return this.GetWindowElement(this.GetWindowCountCore() - 1);
32543 },
32544 GetPopupType: function() {
32545  return "aspxpopup";
32546 },
32547 GetDefaultZIndexFromServer: function() {
32548  return defaultZIndexFromServer;
32549 },
32550 GetPopupControlZIndex: function() {
32551  return popupControlZIndex;
32552 },
32553 FindWindowModalElement: function(index) {
32554  return ASPx.GetElementById(this.name + "_DXPWMB" + index);
32555 },
32556 GetWindowCloseButton: function(index) {
32557  return ASPx.GetElementById(this.name + "_HCB" + index);
32558 },
32559 GetWindowRefreshButton: function(index) {
32560  return ASPx.GetElementById(this.name + "_HRB" + index);
32561 },
32562 FirstShowWindow: function(index, allowChangeZIndex) {
32563  var popupHorizontalOffsetBackup = -1;
32564  var popupVerticalOffsetBackup = -1;
32565  var isFreeWindow = this.GetIsDragged(index);
32566  var x = ASPx.InvalidPosition;
32567  var y = ASPx.InvalidPosition;
32568  if(isFreeWindow) {
32569   x = this.GetWindowLeft(index);
32570   y = this.GetWindowTop(index);
32571   popupHorizontalOffsetBackup = this.popupHorizontalOffset;
32572   popupVerticalOffsetBackup = this.popupVerticalOffset;
32573   this.popupHorizontalOffset = 0;
32574   this.popupVerticalOffset = 0;
32575  }
32576  this.LockAnimation();
32577  this.DoShowWindowCore(index, x, y, isFreeWindow ? -1 : 0, false, allowChangeZIndex);
32578  this.UnlockAnimation();
32579  if(isFreeWindow) {
32580   this.popupHorizontalOffset = popupHorizontalOffsetBackup;
32581   this.popupVerticalOffset = popupVerticalOffsetBackup;
32582  }
32583  this.CorrectElementVerticalAlignment(ASPx.AdjustVerticalMarginsInContainer, this.GetWindowHeaderElement(index));
32584  this.CorrectFooterTextElementWidth(index);
32585 },
32586 HasDefaultWindow: function() {
32587  return true;
32588 },
32589 GetWindowCount: function() {
32590  return 0;
32591 },
32592 GetWindowContentHtml: function(window) {
32593  var index = (window != null) ? window.index : -1;
32594  var element = this.GetContentContainer(index);
32595  return (element != null) ? element.innerHTML : "";
32596 },
32597 GetWindowElementId: function(index) {
32598  return this.name + ASPx.PCWIdSuffix + index;
32599 },
32600 GetWindowElement: function(index) {
32601  if(!ASPx.IsExistsElement(this.windowElements[index]))
32602   this.windowElements[index] = ASPx.GetElementById(this.GetWindowElementId(index));
32603  return this.windowElements[index];
32604 },
32605 GetWindowClientTable: function(index) {
32606  return this.GetWindowElement(index);
32607 },
32608 GetCurrentWindowElement: function() {
32609  return this.GetWindowElement(-1);
32610 },
32611 getActualMainElement: function() { return this.GetCurrentWindowElement(); },
32612 ShowWindowContentUrl: function(index) {
32613  var contentIFrame = this.GetWindowContentIFrameElement(index);
32614  this.LoadWindowContentUrl(index);
32615  if(contentIFrame && contentIFrame.DXReloadAfterShowRequired) {
32616   this.RefreshWindowContentUrl(this.GetWindow(index));
32617   contentIFrame.DXReloadAfterShowRequired = false;
32618  }
32619 },
32620 RefreshWindowContentUrl: function(window) {
32621  this.RefreshWindowContentUrlCommon(window);
32622 },
32623 RefreshContentUrl: function() {
32624  this.RefreshWindowContentUrl(null);
32625 },
32626 RefreshWindowContentUrlCommon: function(window) {
32627  this.SetWindowContentUrl(window, this.GetWindowContentUrl(window));
32628 },
32629 GetContentUrl: function() {
32630  return this.GetWindowContentUrl(null);
32631 },
32632 GetWindowContentUrl: function(window) {
32633  var index = (window != null) ? window.index : -1;
32634  if(!this.IsWindowVisible(window))
32635   return this.GetWindowContentIFrameUrl(index);
32636  var element = this.GetWindowContentIFrameElement(index);
32637  return (element != null) ? element.src : "";
32638 },
32639 GetContentIFrame: function(window) {
32640  return this.GetWindowContentIFrame(null);
32641 },
32642 GetWindowContentIFrame: function(window) {
32643  var index = (window != null) ? window.index : -1;
32644  return this.GetWindowContentIFrameElement(index);
32645 },
32646 GetContentIFrameWindow: function() {
32647  var iframeElement = this.GetContentIFrame();
32648  return iframeElement.contentWindow;
32649 },
32650 SetContentUrl: function(url) {
32651  this.SetWindowContentUrl(null, url);
32652 },
32653 SetWindowContentUrl: function(window, url) {
32654  var index = (window != null) ? window.index : -1;
32655  this.SetWindowContentUrlInternal(index, url);
32656 },
32657 LoadWindowContentUrl: function(index) {
32658  var url = this.GetWindowContentIFrameUrl(index);
32659  this.LoadWindowContentFromUrl(index, url);
32660 },
32661 LoadWindowContentFromUrl: function(index, url) {
32662  var element = this.GetWindowContentIFrameElement(index);
32663  if(element && element.src != url && element.DXSrcRaw != url) {
32664   this.SetSrcToIframeElement(index, element, url);
32665   this.SetWindowContentIFrameUrl(index, element.src); 
32666  }
32667 },
32668 SetWindowContentIFrameUrl: function(index, url) {
32669  this.SetPropertyValue(index, "contentUrl", url);
32670 },
32671 SetWindowContentUrlInternal: function(index, url) {
32672  var element = this.GetWindowContentIFrameElement(index);
32673  var windowVisible = this.InternalIsWindowVisible(index);
32674  if(windowVisible && element != null)
32675   this.SetIframeVisibleForDragging(index, true);
32676  this.SetWindowContentIFrameUrl(index, url);
32677  var src = windowVisible ? url : ASPx.Browser.WebKitFamily && ASPx.Browser.Version >= 75 ? "about:blank" : ASPx.SSLSecureBlankUrl;
32678  if(element == null) {
32679   this.CreateWindowContentIFrameElement(index, src);
32680   this.RefreshDimensionsAfterCreateIframe(index);
32681  }
32682  else
32683   this.SetSrcToIframeElement(index, element, src);
32684  this.ReinitScrollForIframe(index);
32685 },
32686 ReinitScrollForIframe: function(index) {
32687  if(this.HasIframeOnIos(index)) {
32688   var scrollElement = this.getTouchScrollerElement(index);
32689   if(scrollElement) {
32690    var options = this.GetWindowTouchScrollOptions(index);
32691    ASPx.TouchUIHelper.InitNativeScrolling(scrollElement, options);
32692    if(!!this.touchUIScrollers[index]) {
32693     this.touchUIScrollers[index].Destroy();
32694     this.touchUIScrollers[index] = null;
32695    }
32696   }
32697  }
32698 },
32699 EnsureWindowContentUrl: function(index) {
32700  var contentUrl = this.GetWindowContentIFrameUrl(index);
32701  if(contentUrl != "")
32702   this.SetWindowContentUrlInternal(index, contentUrl);
32703 },
32704 CreateWindowContentIFrameElement: function(index, src) {
32705  var content = this.GetContentContainer(index);
32706  var iframeParent = content;
32707  content.innerHTML = "";
32708  content.style.display = "block";
32709  var iframe = this.CreateContentIFrameElement(index, src);
32710  this.RequireIFrameHeightAdjusting(index, iframe);
32711  iframeParent.appendChild(iframe);
32712  this.InitIFrame(index);
32713  return iframe;
32714 },
32715 InitIFrame: function(index) {
32716  var contentIFrameElement = this.GetWindowContentIFrameElement(index);
32717  if(contentIFrameElement) {
32718   contentIFrameElement.popupControlName = this.name;
32719   contentIFrameElement.pcWndIndex = index;
32720   ASPx.Evt.AttachEventToElement(contentIFrameElement, "load", ASPx.PCIframeLoad);
32721  }
32722 },
32723 OnIFrameLoad: function(index) {
32724  this.SetIframeLoading(index, false);
32725 },
32726 RequireIFrameHeightAdjusting: function(index, iframe) {
32727  if(this.InternalIsWindowVisible(index))
32728   this.AdjustIFrameHeight(index, iframe);
32729  else
32730   this.PostponeIframeAdjusting(index);
32731 },
32732 PostponeIframeAdjusting: function(index) {
32733  this.SetIframeAdjustingPostponed(index, true);
32734 },
32735 EnsureIFrameHeightAdjusted: function(index) {
32736  if(this.GetIframeAdjustingPostponed(index)) {
32737   var iframe = this.GetWindowContentIFrameElement(index);
32738   this.AdjustIFrameHeight(index, iframe);
32739  }
32740 },
32741 AdjustIFrameHeight: function(index, iframe) {
32742 },
32743 CreateContentIFrameElement: function(index, src) {
32744  var iframe = document.createElement("IFRAME");
32745  iframe.id = this.GetWindowContentIFrameElementId(index);
32746  iframe.scrolling = "auto";
32747  iframe.frameBorder = 0;
32748  iframe.style.width = "100%";
32749  iframe.style.height = "100%";
32750  iframe.style.overflow = "auto";
32751  if(ASPx.Browser.Chrome) iframe.style.webkitBackfaceVisibility = "hidden";
32752  if(ASPx.Browser.Edge)
32753   iframe.style["-ms-user-select"] = "text";
32754  var titleText = this.GetWindowContentIFrameTitle(index);
32755  if(!!titleText)
32756   iframe.title = titleText;
32757  this.SetSrcToIframeElement(index, iframe, src);
32758  return iframe;
32759 },
32760 SetSrcToIframeElement: function(index, iframeElement, src) {
32761  this.SetIframeLoading(index, true);
32762  iframeElement.src = src;
32763  if(ASPx.Browser.Chrome && src.indexOf("#"))
32764   this.PreventScrollingAfterIframeLoaded(iframeElement);
32765  iframeElement.DXSrcRaw = src;
32766 },
32767 PreventScrollingAfterIframeLoaded: function(iframeElement) {
32768  var docScrollTop = ASPx.GetDocumentScrollTop();
32769  var onIframeLoadedHandler = function() {
32770   window.setTimeout(function() {
32771    ASPx.SetDocumentScrollTop(docScrollTop);
32772    ASPx.Evt.DetachEventFromElement(iframeElement, "load", onIframeLoadedHandler);
32773   }, 0);
32774  };
32775  ASPx.Evt.AttachEventToElement(iframeElement, "load", onIframeLoadedHandler);
32776 },
32777 GetWindowHeaderTextCell: function(index) {
32778  return this.GetWindowChild(index, "_PWH" + index + "T");
32779 },
32780 GetWindowHeaderTextElement: function(index) {
32781  var element = this.GetWindowHeaderTextCell(index);
32782  if(element != null) {
32783   var link = ASPx.GetNodeByTagName(element, "A", 0);
32784   return link || element;
32785  }
32786  return null;
32787 },
32788 GetWindowHeaderLinkElement: function(index) {
32789  var element = this.GetWindowHeaderElement(index);
32790  return element ? ASPx.GetNodeByClassName(element, PopupControlCssClasse
32790s.LinkCssClassName) : null;
32791 },
32792 GetWindowHeaderImageCell: function(index) {
32793  return this.GetWindowChild(index, "_PWH" + index + "I");
32794 },
32795 GetWindowFooterTextCell: function(index) {
32796  return this.GetWindowChild(index, "_PWF" + index + "T");
32797 },
32798 GetWindowFooterTextElement: function(index) {
32799  var element = this.GetWindowFooterTextCell(index);
32800  if(element != null) {
32801   var link = ASPx.GetNodeByTagName(element, "A", 0);
32802   return link || element;
32803  }
32804  return null;
32805 },
32806 GetWindowFooterLinkElement: function(index) {
32807  var element = this.GetWindowFooterElement(index);
32808  return element ? ASPx.GetNodeByClassName(element, PopupControlCssClasses.LinkCssClassName) : null;
32809 },
32810 GetWindowFooterImageCell: function(index) {
32811  return this.GetWindowChild(index, "_PWF" + index + "I");
32812 },
32813 GetWindowHeaderImageUrl: function(index) {
32814  var element = this.GetWindowHeaderImageCell(index);
32815  return element ? element.src : "";
32816 },
32817 SetWindowHeaderImageUrl: function(index, url) {
32818  var element = this.GetWindowHeaderImageCell(index);
32819  if(element != null) {
32820   element.src = url;
32821  }
32822 },
32823 GetWindowFooterImageUrl: function(index) {
32824  var element = this.GetWindowFooterImageCell(index);
32825  return element ? element.src : "";
32826 },
32827 SetWindowFooterImageUrl: function(index, url) {
32828  var element = this.GetWindowFooterImageCell(index);
32829  if(element != null) {
32830   element.src = url;
32831  }
32832 },
32833 GetWindowHeaderNavigateUrl: function(index) {
32834  var link = this.GetWindowHeaderLinkElement(index);
32835  if(link)
32836   return link.href || ASPx.Attr.GetAttribute(linkEl, "savedhref");
32837  return "";
32838 },
32839 SetWindowHeaderNavigateUrl: function(index, url) {
32840  var link = this.GetWindowHeaderLinkElement(index);
32841  if(link) {
32842   if(ASPx.Attr.IsExistsAttribute(link, "savedhref"))
32843    ASPx.Attr.SetAttribute(link, "savedhref", url);
32844   else if(ASPx.Attr.IsExistsAttribute(link, "href"))
32845    link.href = url;
32846  }
32847 },
32848 GetWindowFooterNavigateUrl: function(index) {
32849  var link = this.GetWindowFooterLinkElement(index);
32850  if(link)
32851   return link.href || ASPx.Attr.GetAttribute(linkEl, "savedhref");
32852  return "";
32853 },
32854 SetWindowFooterNavigateUrl: function(index, url) {
32855  var link = this.GetWindowFooterLinkElement(index);
32856  if(link) {
32857   if(ASPx.Attr.IsExistsAttribute(link, "savedhref"))
32858    ASPx.Attr.SetAttribute(link, "savedhref", url);
32859   else if (ASPx.Attr.IsExistsAttribute(link, "href"))
32860    link.href = url;
32861  }
32862 },
32863 GetWindowHeaderText: function(index) {
32864  var element = this.GetWindowHeaderTextElement(index);
32865  if(element != null) 
32866    return element.innerHTML;
32867  return "";
32868 },
32869 SetWindowHeaderText: function(index, text) {
32870  var element = this.GetWindowHeaderTextElement(index);
32871  if(element != null) {
32872   element.innerHTML = text;
32873   this.CorrectHeaderContentElementHeight(index);
32874   this.CorrectElementVerticalAlignment(ASPx.AdjustVerticalMarginsInContainer, this.GetWindowHeaderElement(index), true);
32875  }
32876 },
32877 GetWindowFooterText: function(index) {
32878  var element = this.GetWindowFooterTextElement(index);
32879  if(element != null) 
32880   return element.innerHTML;
32881  return "";
32882 },
32883 SetWindowFooterText: function(index, text) {
32884  var element = this.GetWindowFooterTextElement(index);
32885  if(element != null) {
32886   element.innerHTML = text;
32887   this.CorrectWindowSizeGripPositionLite(index);
32888  }
32889 },
32890 CorrectWindowSizeGripPositionLite: function(index) {
32891  var sizeGrip = this.GetWindowSizeGripElement(index);
32892  if(!sizeGrip || sizeGrip.corrected) return;
32893  sizeGrip.style[this.rtl ? "marginRight" : "marginLeft"] = "-" + sizeGrip.offsetWidth + "px";
32894  sizeGrip.style.marginTop = "-" + sizeGrip.offsetHeight + "px";
32895  sizeGrip.corrected = true;
32896 },
32897 GetHeaderFooterHeightCore: function(index) {
32898  var extenders = [
32899   this.GetWindowHeaderElement(index),
32900   this.GetWindowFooterElement(index)
32901  ], height = 0;
32902  for(var i = 0; i < extenders.length; i++) {
32903   if(extenders[i])
32904    height += extenders[i].offsetHeight;
32905  }
32906  return height;
32907 },
32908 GetHeaderImageUrl: function() {
32909  return this.GetWindowHeaderImageUrl(-1);
32910 },
32911 SetHeaderImageUrl: function(value) {
32912  this.SetWindowHeaderImageUrl(-1, value);
32913 },
32914 GetFooterImageUrl: function() {
32915  return this.GetWindowFooterImageUrl(-1);
32916 },
32917 SetFooterImageUrl: function(value) {
32918  this.SetWindowFooterImageUrl(-1, value);
32919 },
32920 GetHeaderNavigateUrl: function() {
32921  return this.GetWindowHeaderNavigateUrl(-1);
32922 },
32923 SetHeaderNavigateUrl: function(value) {
32924  this.SetWindowHeaderNavigateUrl(-1, value);
32925 },
32926 GetFooterNavigateUrl: function() {
32927  return this.GetWindowFooterNavigateUrl(-1);
32928 },
32929 SetFooterNavigateUrl: function(value) {
32930  this.SetWindowFooterNavigateUrl(-1, value);
32931 },
32932 GetHeaderText: function() {
32933  return this.GetWindowHeaderText(-1);
32934 },
32935 SetHeaderText: function(value) {
32936  this.SetWindowHeaderText(-1, value);
32937 },
32938 GetFooterText: function() {
32939  return this.GetWindowFooterText(-1);
32940 },
32941 SetFooterText: function(value) {
32942  this.SetWindowFooterText(-1, value);
32943 },
32944 GetVisible: function() {
32945  return this.IsVisible();
32946 },
32947 SetVisible: function(visible) {
32948  if(visible && !this.IsVisible())
32949   this.Show();
32950  else if(!visible && this.IsVisible())
32951   this.Hide();
32952 },
32953 GetStateHiddenFieldName: function() {
32954  return this.uniqueID + "State";
32955 },
32956 GetWindowCountCore: function() {
32957  return 0; 
32958 },
32959 IsWindowElementsIDAssigned: function(index) {
32960  var contentElement = this.GetWindowContentElement(index);
32961  return ASPx.IsExistsElement(contentElement);
32962 },
32963 InitializeDOM: function () {
32964  var windowElement = this.GetWindowElement(this.GetWindowCountCore() - 1);
32965  if(windowElement)
32966   windowElement.dxinit = true;
32967 },
32968 IsDOMInitialized: function() {
32969  var windowElement = this.GetWindowElement(this.GetWindowCountCore() - 1);
32970  return windowElement && windowElement.dxinit;
32971 },
32972 IsDOMDisposed: function() { 
32973  var windowElement = this.GetWindowElement(this.GetWindowCountCore() - 1);
32974  return !ASPx.IsExistsElement(windowElement);
32975 },
32976 OnDispose: function() {
32977  ASPxClientControl.prototype.OnDispose.call(this);
32978  this.ClearPopupElementConnection();
32979 },
32980 RegisterInControlTree: function(tree) {
32981  var mainNode = tree.createNode(null, this);
32982  if(this.HasDefaultWindow())
32983   this.RegisterRelatedNodeForWindowElement(tree, -1, mainNode);
32984  for(var i = 0; i < this.GetWindowCount() ; i++)
32985   this.RegisterRelatedNodeForWindowElement(tree, i, mainNode);
32986 },
32987 RegisterRelatedNodeForWindowElement: function(tree, windowElementIndex, mainNode) {
32988  var windowElement = this.GetWindowElement(windowElementIndex);
32989  if(windowElement) {
32990   var childNode = tree.createNode(windowElement.id, null);
32991   tree.addRelatedNode(mainNode, childNode);
32992  }
32993 },
32994 CorrectWindowHeaderText: function(index) {
32995  var headerElement = this.GetWindowHeaderElement(index);
32996  if(!headerElement || headerElement.corrected) return;
32997  var leftChildrenWidth = 0, rightChildrenWidth = 0, headerContentElement;
32998  for(var i = 0; i < headerElement.childNodes.length; i++) {
32999   var child = headerElement.childNodes[i];
33000   if(!child.offsetWidth) continue;
33001   if(ASPx.GetElementFloat(child) === "right")
33002    rightChildrenWidth += child.offsetWidth + ASPx.GetLeftRightMargins(child);
33003   else if(ASPx.GetElementFloat(child) === "left")
33004    leftChildrenWidth += child.offsetWidth + ASPx.GetLeftRightMargins(child);
33005   else if(!headerContentElement)
33006    headerContentElement = child;
33007  }
33008  if(headerContentElement && (leftChildrenWidth > 0 || rightChildrenWidth > 0)) {
33009   var headerContentElementStyle = ASPx.GetCurrentStyle(headerContentElement);
33010   var originalMarginLeft = parseInt(headerContentElementStyle.marginLeft);
33011   var originalMarginRight = parseInt(headerContentElementStyle.marginRight);
33012   ASPx.SetStyles(headerContentElement, {
33013    marginLeft: leftChildrenWidth + originalMarginLeft,
33014    marginRight: rightChildrenWidth + originalMarginRight
33015   });
33016   this.CorrectHeaderContentElementHeight(index);
33017  }
33018  headerElement.corrected = true;
33019 },
33020 CorrectHeaderContentElementHeight: function(index) {
33021  var headerElement = this.GetWindowHeaderElement(index),
33022   headerContentElement = ASPx.GetChildByClassName(headerElement, PopupControlCssClasses.HeaderContentCssClassName);
33023  if(!headerElement || !headerContentElement) return;
33024  if(headerContentElement.style.height)
33025   headerContentElement.style.height = "";
33026  var contentElementHeight = ASPx.GetClearClientHeight(headerElement) - this.getTopBottomBordersAndPaddingsSummaryValue(headerContentElement),
33027   lineHeightForTextVerticalAlign = contentElementHeight,
33028   windowHeaderTextCell = this.GetWindowHeaderTextCell(index);
33029  if(windowHeaderTextCell)
33030   lineHeightForTextVerticalAlign -= this.getTopBottomBordersAndPaddingsSummaryValue(windowHeaderTextCell);
33031  ASPx.SetStyles(headerContentElement, { lineHeight: lineHeightForTextVerticalAlign, height: contentElementHeight }, false);
33032 },
33033 CorrectFooterTextElementWidth: function(index) {
33034  var footerElement = this.GetWindowFooterElement(index);
33035  var footerContentElement = ASPx.GetChildByClassName(footerElement, PopupControlCssClasses.FooterContentCssClassName);
33036  var footerTextElement = this.GetWindowFooterTextElement(index);
33037  var footerImageElement = this.GetWindowFooterImageCell(index);
33038  if(!footerElement || !footerContentElement || !footerTextElement)
33039   return;
33040  var footerTextMaxWidth = "";
33041  if(footerImageElement) {
33042   var footerTextMaxWidthCorrection = footerImageElement.offsetWidth + ASPx.GetLeftRightMargins(footerImageElement);
33043   footerTextMaxWidth = "calc(100% - " + footerTextMaxWidthCorrection + "px)";
33044  }
33045  ASPx.SetStyles(footerTextElement, { maxWidth: footerTextMaxWidth }, false);
33046 },
33047 OnBeforeDropdownShow: function() {
33048  var element = this.GetWindowElement(-1);
33049  if(!ASPx.GetElementDisplay(element)) {
33050   element.style.visibility = "hidden";
33051  }
33052  this.SetWindowDisplay(-1, true);
33053  if(this.adaptivityEnabled) {
33054   ASPx.SetElementDisplay(this.GetModalWrapperElement(-1), true);
33055   this.SetAdaptiveModalMode(-1, this.NeedAdaptiveModalMode());
33056  }
33057 },
33058 SetWindowDisplay: function(index, value) {
33059  var pcwElement = this.GetWindowElement(index);
33060  ASPx.SetElementDisplay(pcwElement, value);
33061 },
33062 getWindowHorizontalAlign: function(element) {
33063  return this.popupHorizontalAlign;
33064 },
33065 getWindowVerticalAlign: function(element) {
33066  return this.popupVerticalAlign;
33067 },
33068 getWindowHorizontalOffset: function(element) {
33069  return this.popupHorizontalOffset;
33070 },
33071 getWindowVerticalOffset: function(element) {
33072  return this.popupVerticalOffset;
33073 },
33074 GetHorizontalAlign: function() {
33075  return this.popupHorizontalAlign;
33076 },
33077 GetVerticalAlign: function() {
33078  return this.popupVerticalAlign;
33079 },
33080 GetPopupHorizontalOffset: function() {
33081  return this.popupHorizontalOffset;
33082 },
33083 SetPopupHorizontalOffset: function(offset) {
33084  this.popupHorizontalOffset = offset;
33085 },
33086 SetPopupVerticalOffset: function(offset) {
33087  this.popupVerticalOffset = offset;
33088 },
33089 GetPopupVerticalOffset: function() {
33090  return this.popupVerticalOffset;
33091 },
33092 ShowAtElement: function(htmlElement, savePopupElement) {
33093  this.ShowWindowAtElementByIndex(-1, htmlElement, savePopupElement);
33094 },
33095 ShowAtElementByID: function(id) {
33096  var htmlElement = document.getElementById(id);
33097  this.ShowAtElement(htmlElement);
33098 },
33099 ShowWindowAtElementByIndex: function(index, htmlElement, savePopupElement) {
33100  var lastIndexBackup = this.GetLastShownPopupElementIndex(index);
33101  this.ShowWindowByIndex(index, this.AddPopupElementInternal(index, htmlElement));
33102  if(!savePopupElement)
33103   this.RemovePopupElementInternal(index, htmlElement);
33104  this.SetLastShownPopupElementIndex(index, lastIndexBackup);
33105 },
33106 ShowWindowByIndex: function(index, popupElementIndex) {
33107  if(!this.isInitialized)
33108   return;
33109  if(popupElementIndex === undefined)
33110   popupElementIndex = this.GetLastShownPopupElementIndex(index);
33111  this.DoShowWindowCore(index, ASPx.InvalidPosition, ASPx.InvalidPosition, popupElementIndex, false, true);
33112 },
33113 DoShowWindowCore: function(index, x, y, popupElementIndex, closeOtherWindows, allowChangeZIndex, evt, closeOtherReason) {
33114 },
33115 DoShowWindow: function(index, popupElementIndex, evt) {
33116  if(!this.InternalIsWindowVisible(index)) {
33117   var x = ASPx.Evt.GetEventX(evt);
33118   var y = ASPx.Evt.GetEventY(evt);
33119   this.DoShowWindowCore(index, x, y, popupElementIndex, true, true, evt, ASPxClientPopupControlCloseReason.OuterMouseClick);
33120  }
33121 },
33122 SetWindowPos: function(index, element, x, y) {
33123  ASPx.SetStyles(element, { left: x, top: y });
33124  this.DoShowWindowIFrame(index, x, y, ASPx.InvalidDimension, ASPx.InvalidDimension);
33125  this.SetIsDragged(index, true);
33126  this.SetWindowLeft(index, ASPx.GetAbsoluteX(element));
33127  this.SetWindowTop(index, ASPx.GetAbsoluteY(element));
33128  this.UpdateWindowsStateCookie();
33129 },
33130 CorrectPopupPositionForClientWindow: function(element, popupPosition, isX) {
33131  if(element.isPopupPositionCorrectionOn && this.isPopupFullCorrectionOn || this.forceAdjustPositionToClientScreen) {
33132   popupPosition.position = ASPx.PopupUtils.AdjustPositionToClientScreen(element, popupPosition.position, this.rtl, isX);
33133  }
33134  return popupPosition;
33135 },
33136 GetClientPopupPos: function(element, popupElement, pos, isX, isDragged) {
33137  var index = this.GetWindowIndex(element);
33138  var popupPosition = null;
33139  if(this.GetIsMaximizedOnWebKitTouch(index))
33140   return new ASPx.PopupPosition(ASPx.PrepareClientPosForElement(0, element, isX), false);
33141  if(isDragged)
33142   popupPosition = new ASPx.PopupPosition(!this.IsValidPosition(pos) ? this.GetPosition(index, isX) : pos, false);
33143  else
33144   popupPosition = isX ? this.GetClientPopupPosX(element, popupElement, pos) : this.GetClientPopupPosY(element, popupElement, pos);
33145  popupPosition.position = ASPx.PrepareClientPosForElement(popupPosition.position, element, isX);
33146  if(ASPx.Browser.Firefox && ASPx.Browser.Version < 3 && this.GetWindowModalElement(index))
33147   popupPosition.position -= isX ? ASPx.GetDocumentScrollLeft() : ASPx.GetDocumentScrollTop();
33148  return popupPosition;
33149 },
33150 GetClientPopupPosX: function(element, popupElement, x) {
33151  var mainElement = this.GetWindowMainCell(element);
33152  var popupPosition = ASPx.PopupUtils.GetPopupAbsoluteX(mainElement, popupElement, this.getWindowHorizontalAlign(element), this.getWindowHorizontalOffset(element),
33153   x, this.GetWindowLeft(this.GetWindowIndex(element)), this.rtl, this.isPopupFullCorrectionOn);
33154  return this.CorrectPopupPositionForClientWindow(element, popupPosition, true);
33155 },
33156 GetClientPopupPosY: function(element, popupElement, y) {
33157  var mainElement = this.GetWindowMainCell(element);
33158  var popupPosition = ASPx.PopupUtils.GetPopupAbsoluteY(mainElement, popupElement, this.getWindowVerticalAlign(element), this.getWindowVerticalOffset(element),
33159   y, this.GetWindowTop(this.GetWindowIndex(element)), this.isPopupFullCorrectionOn, this.usedInDropDown, this.usedInDropDown);
33160  return this.usedInDropDown ? popupPosition : this.CorrectPopupPositionForClientWindow(element, popupPosition, false);
33161 },
33162 UpdateWindowPositionInternal: function(index, popupElement) {
33163  var positionUpdated = false,
33164   element = this.GetWindowElement(index);
33165  if(this.InternalIsWindowVisible(index) && element != null) {
33166   var horizontalPopupPosition;
33167   if(this.popupHorizontalAlign === ASPx.PopupUtils.WindowCenterAlignIndicator && window.innerWidth <= element.offsetWidth) {
33168    var scrollDiff = aspxGetPopupControlCollection().GetDocScrollDifference(),
33169     scrollInProgress = scrollDiff.horizontal !== 0 || scrollDiff.vertical !== 0;
33170    horizontalPopupPosition = scrollInProgress ? ASPx.PxToInt(element.style.left) : this.GetClientPopupPos(element, popupElement, ASPx.InvalidPosition, true, false);
33171   } else
33172    horizontalPopupPosition = this.GetClientPopupPos(element, popupElement, ASPx.InvalidPosition, true, false);
33173   var verticalPopupPosition = this.GetClientPopupPos(element, popupElement, ASPx.InvalidPosition, false, false);
33174   this.SetWindowPos(index, element, horizontalPopupPosition.position, verticalPopupPosition.position);
33175   positionUpdated = true;
33176  }
33177  return positionUpdated;
33178 },
33179 UpdatePositionAtElement: function(popupElement) {
33180  this.UpdateWindowPositionAtElement(null, popupElement);
33181 },
33182 UpdateWindowPositionAtElement: function(window, popupElement) {
33183  var index = (window != null) ? window.index : -1;
33184  this.UpdateWindowPositionInternal(index, popupElement);
33185 },
33186 TryAutoUpdatePosition: function(index) {
33187  if(this.GetAutoUpdatePosition(index))
33188   this.UpdateWindowPositionInternal(index, this.GetPopupElement(index, this.GetLastShownPopupElementIndex(index)));
33189 },
33190 GetLastShownPopupElementIndex: function(windowIndex) {
33191  var info = this.GetLastUsedPopupElementInfo(windowIndex);
33192  return ASPx.GetDefinedValue(info.shownPEIndex, 0);
33193 },
33194 SetLastShownPopupElementIndex: function(windowIndex, popupElementIndex) {
33195  var info = this.GetLastUsedPopupElementInfo(windowIndex);
33196  info.shownPEIndex = popupElementIndex;
33197 },
33198 GetLastUsedPopupElementInfo: function(index) {
33199  if(0 <= index && index < this.GetWindowCountCore())
33200   return this.windowsLastUsedPopupElementInfoList[index];
33201  return this.defaultLastUsedPopupElementInfo;
33202 },
33203 GetPopupElement: function(index, popupElementIndex) {
33204  var popupElement = this.GetPopupElementList(index)[popupElementIndex];
33205  return popupElement ? popupElement : null;
33206 },
33207 GetPopupElementList: function(index) {
33208  if(0 <= index && index < this.GetWindowCountCore())
33209   return this.windowsPopupElementList[index];
33210  return this.defaultWindowPopupElementList;
33211 },
33212 PopulatePopupElementsByIds: function(index) {
33213  var ids = this.GetPopupElementIDList(index);
33214  for(var i = 0; i < ids.length; i++) {
33215   var popupElement = ASPx.PopupUtils.FindPopupElementById(ids[i]);
33216   if(popupElement)
33217    this.AddWindowPopupElement(index, popupElement);
33218  }
33219 },
33220 PopulatePopupElements: function(index) {
33221  this.PopulatePopupElementsByIds(index);
33222 },
33223 SetPopupElementIDByIndex: function(index, popupElementId) {
33224  this.RemoveWindowAllPopupElements(index);
33225  this.SetPopupElementIDs(index, popupElementId.split(';'));
33226  if(aspxGetPopupControlCollection().IsDisappearTimerActive()) {
33227   aspxGetPopupControlCollection().ClearDisappearTimer();
33228   this.Hide(index);
33229  }
33230  this.PopulatePopupElements(index);
33231 },
33232 RefreshPopupElementConnection: function() {
33233  this.ClearPopupElementConnection();
33234  var index = this.HasDefaultWindow() ? -1 : 0;
33235  for(; index < this.GetWindowCount(); index++)
33236   this.PopulatePopupElements(index);
33237 },
33238 ClearPopupElementConnection: function() {
33239  var index = this.HasDefaultWindow() ? -1 : 0;
33240  for(; index < this.GetWindowCount(); index++)
33241   this.RemoveWindowAllPopupElements(index);
33242 },
33243 GetPopupElementIDList: function(index) {
33244  if(0 <= index && index < this.GetWindowCountCore())
33245   return this.windowsPopupElementIDList[index];
33246  return this.defaultWindowPopupElementIDList;
33247 },
33248 SetPopupElementIDs: function(index, ids) {
33249  if(0 <= index && index < this.GetWindowCountCore())
33250   this.windowsPopupElementIDList[index] = ids;
33251  this.defaultWindowPopupElementIDList = ids;
33252 },
33253 AddPopupElementInternal: function(index, element) {
33254  var popupElements = this.GetPopupElementList(index);
33255  for(var i = 0; i < popupElements.length; i++) {
33256   if(!popupElements[i]) {
33257    popupElements[i] = element;
33258    return i;
33259   }
33260  }
33261  popupElements.push(element);
33262  return popupElements.length - 1;
33263 },
33264 RemovePopupElementInternal: function(index, element) {
33265  var popupElements = this.GetPopupElementList(index);
33266  for(var i = 0; i < popupElements.length; i++) {
33267   if(popupElements[i] == element) {
33268    popupElements[i] = null;
33269    return;
33270   }
33271  }
33272 },
33273 AddPopupElement: function(popupElement) {
33274  this.AddWindowPopupElement(-1, popupElement);
33275 },
33276 AddWindowPopupElement: function(index, popupElement) {
33277  var popupElementIndex = this.AddPopupElementInternal(index, popupElement);
33278  this.SetPopupElementReference(index, popupElement, popupElementIndex, true);
33279 },
33280 RemovePopupElement: function(popupElement) {
33281  this.RemoveWindowPopupElement(-1, popupElement);
33282 },
33283 RemoveWindowPopupElement: function(index, popupElement) {
33284  this.RemovePopupElementInternal(index, popupElement);
33285  this.SetPopupElementReference(index, popupElement, null, false);
33286 },
33287 SetPopupElementReference: function(index, popupElement, popupElementIndex, attach) {
33288  if(!ASPx.IsExistsElement(popupElement)) return;
33289  var setReferenceFunction = this.getAttachReferenceFunction(attach);
33290  var setContextMenuReferenceFunction = attach ? ASPx.Evt.AttachContextMenuToElement : ASPx.Evt.DetachContextMenuFromElement;
33291  var windowPopupAction = this.GetWindowPopupAction(index);
33292  if(windowPopupAction == "LeftMouseClick")
33293   setReferenceFunction(popupElement, "mouseup", aspxPEMEvent);
33294  else if(windowPopupAction == "RightMouseClick")
33295   setContextMenuReferenceFunction(popupElement, aspxPEMEvent);
33296  else if(windowPopupAction == "MouseOver") {
33297   var windowElement = this.GetWindowElement(index);
33298   setReferenceFunction(popupElement, "mouseover", ASPx.PopupUtils.OverControl.OnMouseOver);
33299   setReferenceFunction(windowElement, "mouseover", aspxPWEMOver);
33300   if(attach)
33301    this.SetMSTouchMouseOverReference(popupElement, windowElement, this.name, index, this.appearAfter);
33302  }
33303  if(windowPopupAction == "LeftMouseClick" || windowPopupAction == "RightMouseClick") {
33304   setReferenceFunction(popupElement, "mousedown", aspxPEMEvent);
33305  }
33306  if(attach) {
33307   popupElement.DXPopupElementControl = this;
33308   popupElement.DXPopupWindowIndex = index;
33309   popupElement.DXPopupElementIndex = popupElementIndex;
33310  } else
33311   popupElement.DXPopupElementControl = popupElement.DXPopupWindowIndex = popupElement.DXPopupElementIndex = undefined;
33312 },
33313 getAttachReferenceFunction: function(attach) {
33314  return attach ? ASPx.Evt.AttachEventToElement : ASPx.Evt.DetachEventFromElement;
33315 },
33316 SetMSTouchMouseOverReference: function(popupElement, windowElement, popupName, index, appearAfter) {
33317  if(!ASPx.TouchUIHelper.pointerEnabled) return;
33318  popupElement.dxMsTouchGesture = popupElement.dxMsTouchGesture ||
33319   ASPx.TouchUIHelper.msTouchCreateGesturesWrapper(popupElement, function(evt) {
33320    window.setTimeout(function() {
33321     aspxGetPopupControlCollection().SetAppearTimer(popupName, index, popupElement.DXPopupElementIndex, appearAfter, evt);
33322    }, 0);
33323   });
33324  windowElement.dxMsTouchGesture = windowElement.dxMsTouchGesture || ASPx.TouchUIHelper.msTouchCreateGesturesWrapper(windowElement, function(evt) {
33325   window.setTimeout(function() {
33326    aspxGetPopupControlCollection().ClearDisappearTimer();
33327   }, 0);
33328  });
33329 },
33330 GetLastOverPopupElementIndex: function(windowIndex) {
33331  var info = this.GetLastUsedPopupElementInfo(windowIndex);
33332  return ASPx.GetDefinedValue(info.overPEIndex, -1);
33333 },
33334 SetLastOverPopupElementIndex: function(windowIndex, popupElementIndex) {
33335  var info = this.GetLastUsedPopupElementInfo(windowIndex);
33336  info.overPEIndex = popupElementIndex;
33337 },
33338 OnPopupElementMouseOver: function(evt, popupElement) {
33339  if(popupElement != null) {
33340   var index = popupElement.DXPopupWindowIndex;
33341   var isVisible = this.InternalIsWindowVisible(index);
33342   var popupElementIndex = popupElement.DXPopupElementIndex;
33343   if(this.GetLastOverPopupElementIndex(index) != popupElementIndex) {
33344    if(aspxGetPopupControlCollection().IsAppearTimerActive())
33345     aspxGetPopupControlCollection().ClearAppearTimer();
33346    if(aspxGetPopupControlCollection().IsDisappearTimerActive())
33347     aspxGetPopupControlCollection().ClearDisappearTimer();
33348    if(isVisible) {
33349     this.DoHideWindow(index, false, ASPxClientPopupControlCloseReason.MouseOut);
33350     isVisible = false;
33351    }
33352   }
33353   if(!isVisible) {
33354    aspxGetPopupControlCollection().SetAppearTimer(this.name, index, popupElement.DXPopupElementIndex, this.appearAfter, evt);
33355    aspxGetPopupControlCollection().InitOverObject(this, index, evt);
33356   }
33357   this.SetLastOverPopupElementIndex(index, popupElementIndex);
33358  }
33359 },
33360 OnPopupElementMouseOut: function(evt, popupElement) {
33361 },
33362 RemoveAllPopupElements: function() {
33363  this.RemoveWindowAllPopupElements(-1);
33364 },
33365 RemoveWindowAllPopupElements: function(index) {
33366  var popupElements = this.GetPopupElementList(index);
33367  for(var i = 0; i < popupElements.length; i++)
33368   this.RemoveWindowPopupElement(index, popupElements[i]);
33369 },
33370 GetWindowCurrentPopupElementByIndex: function(index) {
33371  var popupElement = this.GetPopupElement(index, this.GetLastShownPopupElementIndex(index));
33372  if(popupElement && popupElement.DXPopupElementControl)
33373   return popupElement;
33374  return null;
33375 },
33376 GetWindowCurrentPopupElementIndexByWindowIndex: function(windowIndex) {
33377  var popupElement = this.GetWindowCurrentPopupElementByIndex(windowIndex);
33378  return popupElement ? popupElement.DXPopupElementIndex : -1;
33379 },
33380 GetIsMaximizedOnWebKitTouch: function(index) {
33381  return false;
33382 },
33383 ProcessAccessibleElementOnHide: function() {
33384  if(this.accessibilityCompliant) {
33385   var focusElement = this.accessibleFocusElement ? this.accessibleFocusElement : this.GetCurrentPopupElement();
33386   ASPx.AccessibilityUtils.SetFocusAccessibleCore(focusElement);
33387   this.accessibleFocusElement = null;
33388  }
33389 },
33390 OnControlsInitialized: function() {
33391  this.InitializeAccessibleNavigationCore();
33392  setTimeout(function() {
33393   ASPx.GetControlCollection().ControlsInitialized.RemoveHandler(this.OnControlsInitialized, this);
33394  }.aspxBind(this), 0);
33395 },
33396 InitializeAccessibleNavigation: function() {
33397  this.Shown.AddHandler(this.InitializeAccessibleNavigationCore.aspxBind(this));
33398 },
33399 InitializeAccessibleNavigationCore: function() {
33400  this.resetFocusableElements();
33401  var focusableElement = this.getFirstFocusableElement();
33402  if(focusableElement) {
33403   var currentWindowContentCell = this.GetWindowContentElement(-1);
33404   var contentFirstActionElement = ASPx.FindFirstChildActionElement(currentWindowContentCell);
33405   if(contentFirstActionElement && contentFirstActionElement !== focusableElement)
33406    focusableElement = contentFirstActionElement;
33407   if(!this.preventAccessibilityFocus)
33408    ASPx.AccessibilityUtils.SetFocusAccessible(focusableElement);
33409   this.SetLoopingFocusHandlers();
33410  }
33411 },
33412 resetFocusableElements: function() {
33413  if(this.firstFocusableElement)
33414   ASPx.Evt.DetachEventFromElement(this.firstFocusableElement, "keydown", this.focusLastElementHandler);
33415  if(this.lastFocusableElement)
33416   ASPx.Evt.DetachEventFromElement(this.lastFocusableElement, "keydown", this.focusFirstElementHandler);
33417  this.firstFocusableElement = null;
33418  this.lastFocusableElement = null;
33419 },
33420 getFirstFocusableElement: function() {
33421  if(!this.firstFocusableElement)
33422   this.firstFocusableElement = ASPx.FindFirstChildActionElement(this.GetCurrentWindowElement());
33423  return this.firstFocusableElement;
33424 },
33425 getLastFocusableElement: function() {
33426  if(!this.lastFocusableElement)
33427   this.lastFocusableElement = ASPx.FindLastChildActionElement(this.GetCurrentWindowElement());
33428  return this.lastFocusableElement;
33429 },
33430 SetLoopingFocusHandlers: function() {
33431  ASPx.Evt.AttachEventToElement(this.getFirstFocusableElement(), "ke
33431ydown", this.focusLastElementHandler);
33432  ASPx.Evt.AttachEventToElement(this.getLastFocusableElement(), "keydown", this.focusFirstElementHandler);
33433 },
33434 loopFocusHandler: function(evt, isLastFocusableElement) {
33435  var keyCode = ASPx.Evt.GetKeyCode(evt);
33436  if(keyCode !== ASPx.Key.Tab)
33437   return;
33438  var targetElement = isLastFocusableElement ? this.getLastFocusableElement() : this.getFirstFocusableElement();
33439  if(ASPx.Evt.GetEventSource(evt) !== targetElement)
33440   return;
33441  var elementToFocus = null;
33442  if(!isLastFocusableElement && evt.shiftKey)
33443   elementToFocus = this.getLastFocusableElement();
33444  else if(isLastFocusableElement && !evt.shiftKey)
33445   elementToFocus = this.getFirstFocusableElement();
33446  if(elementToFocus) {
33447   ASPx.AccessibilityUtils.SetFocusAccessible(elementToFocus);
33448   ASPx.Evt.PreventEventAndBubble(evt);
33449  }
33450 },
33451 getLeftRightBordersAndPaddingsSummaryValue: function(element, currentStyle) {
33452  return ASPx.GetLeftRightBordersAndPaddingsSummaryValue(element, currentStyle);
33453 },
33454 getTopBottomBordersAndPaddingsSummaryValue: function(element, currentStyle) {
33455  return ASPx.GetTopBottomBordersAndPaddingsSummaryValue(element, currentStyle);
33456 },
33457 AdjustModalElementBounds: function(element) {
33458 },
33459 RefreshDimensionsAfterCreateIframe: function(index) {
33460 },
33461 UpdatePositionAfterCallback: function(windowIndex) {
33462 }
33463});
33464ASPxClientPopupControlBase.AnimationType = {
33465 Fade: "fade",
33466 Slide: "slide",
33467 Auto: "auto",
33468 None: "none"
33469};
33470var ASPxClientPopupControl = ASPx.CreateClass(ASPxClientPopupControlBase, {
33471 constructor: function(name) {
33472  this.constructor.prototype.constructor.call(this, name);
33473  this.popupActionArray = [];
33474  this.windowsPopupElementIDList = [];
33475  this.windowsPopupElementList = [];
33476  this.windowsLastUsedPopupElementInfoList = [];
33477  this.windowsIsPopupedList = [];
33478  this.windowsPopupReasonMouseEventList = [];
33479  this.defaultPopupReasonMouseEvent = null;
33480  this.modal = false;
33481  this.modalArray = [];
33482  this.isDraggedArray = [];
33483  this.closeActionArray = [];
33484  this.showOnPageLoadArray = [];
33485  this.windows = [];
33486  this.windowCount = 0;
33487  this.closeOnEscapeArray = [];
33488  this.leftArray = [];
33489  this.contentUrlArray = [];
33490  this.contentUrlIFrameTitleArray = [];
33491  this.iframeLoadingArray = [];
33492  this.iframeAdjustingPostponedArray = [];
33493  this.isResizedArray = [];
33494  this.zIndexArray = [];
33495  this.topArray = [];
33496  this.shownArray = [];
33497  this.heightArray = [];
33498  this.widthArray = [];
33499  this.widthFromServer = false;
33500  this.widthFromServerArray = [];
33501  this.minHeightArray = [];
33502  this.minWidthArray = [];
33503  this.maxHeightArray = [];
33504  this.maxWidthArray = [];
33505  this.hideBodyScrollWhenModal = true;
33506  this.hideBodyScrollWhenModalArray = [];
33507  this.hideBodyScrollWhenMaximized = true;
33508  this.canScrollViewPort = false;
33509  this.canScrollViewPortArray = [];
33510  this.autoUpdatePositionArray = [];
33511  this.cachedSizeArray = [];
33512  this.enableContentScrollingArray = [];
33513  this.contentOverflowXArray = [];
33514  this.contentOverflowYArray = [];
33515  this.isPinned = false;
33516  this.isPinnedArray = [];
33517  this.pinX = 0;
33518  this.pinXArray = [];
33519  this.pinY = 0;
33520  this.pinYArray = [];
33521  this.lockScroll = 0;
33522  this.isCollapsed = false;
33523  this.isCollapsedArray = [];
33524  this.isCollapsedInit = false;
33525  this.isCollapsedInitArray = [];
33526  this.collapseExecutingLockCount = 0;
33527  this.isMaximized = false;
33528  this.isMaximizedArray = [];
33529  this.isMaximizedInit = false;
33530  this.isMaximizedInitArray = [];
33531  this.maximizationExecutingLockCount = 0;
33532  this.restoredWindowValues = {};
33533  this.restoredWindowValuesArray = [];
33534  this.browserResizingForMaxWindowLockCount = 0;
33535  this.updateRestoredWindowSizeLockCount = 0;
33536  this.touchUIScrollers = {};
33537  this.adaptivityEnabled = false;
33538  this.DefaultModalMaxWidth = 500;
33539  this.DefaultModalMinWidth = 0;
33540  this.stretchVertically = false;
33541  this.stretchVerticallyArray = [];
33542  this.fixedHeader = true;
33543  this.fixedHeaderArray = [];
33544  this.fixedFooter = true;
33545  this.fixedFooterArray = [];
33546  this.modalMinHeight = null;
33547  this.modalMinHeightArray = [];
33548  this.modalMinWidth = null;
33549  this.modalMinWidthArray = [];
33550  this.modalMaxHeight = null;
33551  this.modalMaxHeightArray = [];
33552  this.modalMaxWidth = null;
33553  this.modalMaxWidthArray = [];
33554  this.modalVerticalAlign = ModalAlign.WindowTop;
33555  this.modalHorizontalAlign = ModalAlign.WindowCenter;
33556  this.adaptiveModalMode = false;
33557  this.adaptiveModalModeArray = [];
33558  this.switchAtWindowInnerWidth = ASPx.MaxMobileWindowWidth;
33559  this.PinnedChanged = new ASPxClientEvent();
33560  this.AdaptiveModeChanged = new ASPxClientEvent();
33561 },
33562 SetData: function(data){
33563  if(data.windows)
33564   this.CreateWindows(data.windows);
33565 },
33566 InlineInitialize: function() {
33567  ASPxClientControl.prototype.InlineInitialize.call(this);
33568  this.InitializeArrayCores();
33569 },
33570 Initialize: function() {
33571  ASPxClientPopupControlBase.prototype.Initialize.call(this);
33572  aspxGetPopupControlCollection().EnsureSaveScrollState();
33573  if(this.HasDefaultWindow())
33574   this.InitializeWindow(-1);
33575  for(var i = 0; i < this.GetWindowCount() ; i++)
33576   this.InitializeWindow(i);
33577  this.InitializeScrollbars();
33578 },
33579 InitializeEnableContentScrolling: function() {
33580  for(var windowIndex = 0; windowIndex < this.GetWindowCount() ; windowIndex++) {
33581   var contentOverflowX = this.GetWindowOverflowX(windowIndex);
33582   var contentOverflowY = this.GetWindowOverflowY(windowIndex);
33583   this.enableContentScrollingArray.push(contentOverflowX != "None" || contentOverflowY != "None");
33584  }
33585  ASPxClientPopupControlBase.prototype.InitializeEnableContentScrolling.call(this);
33586 },
33587 InitializeScrollbars: function() {
33588  if(!ASPx.Browser.WebKitTouchUI && !ASPx.Browser.MSTouchUI && (!ASPx.Browser.WindowsPhonePlatform || !ASPx.Browser.IE))
33589   return;
33590  this.ForEachWindow(function(windowIndex) {
33591   if(this.GetEnableContentScrolling(windowIndex)) {
33592    var scrollElement = this.getTouchScrollerElement(windowIndex);
33593    if(scrollElement) {
33594     if(ASPx.Browser.MSTouchUI)
33595      scrollElement.style.touchAction = "auto";
33596     else {
33597      var options = this.GetWindowTouchScrollOptions(windowIndex);
33598      if(!this.HasIframeOnIos(windowIndex))
33599       this.touchUIScrollers[windowIndex] = ASPx.TouchUIHelper.MakeScrollable(scrollElement, options);
33600     }
33601    }
33602   }
33603  }.aspxBind(this));
33604 },
33605 GetWindowTouchScrollOptions: function (index) {
33606  var contentOverflowX = this.GetWindowOverflowX(index),
33607   contentOverflowY = this.GetWindowOverflowY(index);
33608  return {
33609   showHorizontalScrollbar: contentOverflowX === "Auto" || contentOverflowX === "Scroll",
33610   showVerticalScrollbar: contentOverflowY === "Auto" || contentOverflowY === "Scroll"
33611  };
33612 },
33613 ForEachWindow: function(callback) {
33614  var indices = [];
33615  if(this.HasDefaultWindow())
33616   indices.push(-1);
33617  else {
33618   for(var i = 0; i < this.GetWindowCount(); i++)
33619    indices.push(i);
33620  }
33621  ASPx.Data.ForEach(indices, callback);
33622 },
33623 GetMainElementId: function() {
33624  return null;
33625 },
33626 preventParentOverlowOnIos: function(index) {
33627  if(!ASPx.Browser.MacOSMobilePlatform) return;
33628  var parent = this.getParentPopupControl(index);
33629  if(parent) 
33630   parent.popupControl.changeContentOverflow(parent.windowIndex);
33631 },
33632 restoreParentOverflowOnIos: function(index) {
33633  if(!ASPx.Browser.MacOSMobilePlatform) return;
33634  var parent = this.getParentPopupControl(index);
33635  if(parent) 
33636   parent.popupControl.restoreContentOverflow(parent.windowIndex);
33637 },
33638 changeContentOverflow: function(index) {
33639  var scrollerElement = this.getTouchScrollerElement(index);
33640  if(!scrollerElement) return;
33641  ASPx.Attr.ChangeStyleAttribute(scrollerElement, "overflow", "visible");
33642  ASPx.Attr.ChangeStyleAttribute(scrollerElement, "overflowX", "visible");
33643  ASPx.Attr.ChangeStyleAttribute(scrollerElement, "overflowY", "visible");
33644 },
33645 restoreContentOverflow: function(index) {
33646  var scrollerElement = this.getTouchScrollerElement(index);
33647  if(!scrollerElement) return;
33648  ASPx.Attr.RestoreStyleAttribute(scrollerElement, "overflow");
33649  ASPx.Attr.RestoreStyleAttribute(scrollerElement, "overflowX");
33650  ASPx.Attr.RestoreStyleAttribute(scrollerElement, "overflowY");
33651 },
33652 UpdateScrollbar: function(index) {
33653  var touchUIScroller = this.touchUIScrollers[index];
33654  if(!touchUIScroller)
33655   return;
33656  var scrollElement = this.GetContentContainer(index);
33657  if(scrollElement)
33658   touchUIScroller.ChangeElement(scrollElement);
33659 },
33660 InitializeArrayCores: function() {
33661  if(this.GetWindowCountCore() > 0) {
33662   this.InitializeWindowPopupElementList();
33663   this.InitializeWindowPopupElementIDList();
33664   this.InitializeWindowLastUsedPopupElementInfoList();
33665   this.InitializeArray(this.shownArray);
33666   this.InitializeArray(this.windowsPopupReasonMouseEventList, null);
33667   this.InitializeArray(this.windowsIsPopupedList, false);
33668   this.InitializeArray(this.contentUrlArray, "");
33669   this.InitializeArray(this.contentUrlIFrameTitleArray, "");
33670   this.InitializeArray(this.popupActionArray, this.popupAction);
33671   this.InitializeArray(this.closeActionArray, this.closeAction);
33672   this.InitializeArray(this.showOnPageLoadArray, false);
33673   this.InitializeArray(this.isDraggedArray, false);
33674   this.InitializeArray(this.isPinnedArray, false);
33675   this.InitializeArray(this.isCollapsedArray, false);
33676   this.InitializeArray(this.isCollapsedInitArray, false);
33677   this.InitializeArray(this.isMaximizedArray, false);
33678   this.InitializeArray(this.isMaximizedInitArray, false);
33679   this.InitializeArray(this.restoredWindowValuesArray, {});
33680   this.InitializeArray(this.iframeAdjustingPostponedArray, {});
33681   this.InitializeArray(this.isResizedArray, false);
33682   this.InitializeArray(this.zIndexArray, -1);
33683   this.InitializeArray(this.leftArray, 0);
33684   this.InitializeArray(this.topArray, 0);
33685   this.InitializeArray(this.widthArray, constants.DEFAULT_WINDOW_WIDTH);
33686   this.InitializeArray(this.heightArray, constants.DEFAULT_WINDOW_HEIGHT);
33687   this.InitializeArray(this.widthFromServerArray, false);
33688   this.InitializeArray(this.pinXArray, 0);
33689   this.InitializeArray(this.pinYArray, 0);
33690   this.InitializeArray(this.minWidthArray, null);
33691   this.InitializeArray(this.minHeightArray, null);
33692   this.InitializeArray(this.maxWidthArray, null);
33693   this.InitializeArray(this.maxHeightArray, null);
33694   this.InitializeArray(this.cachedSizeArray, null);
33695   this.InitializeArray(this.iframeLoadingArray, false);
33696   this.InitializeArray(this.autoUpdatePositionArray, false);
33697   this.InitializeArray(this.hideBodyScrollWhenModalArray, true);
33698   this.InitializeArray(this.canScrollViewPortArray, false);
33699   this.InitializeArray(this.closeOnEscapeArray, this.closeOnEscape);
33700   this.InitializeArray(this.modalArray, false);
33701   this.InitializeArray(this.adaptiveModalModeArray, false);
33702   this.InitializeArray(this.fixedHeaderArray, true);
33703   this.InitializeArray(this.fixedFooterArray, true);
33704   this.InitializeArray(this.modalMinWidthArray, null);
33705   this.InitializeArray(this.modalMinHeightArray, null);
33706   this.InitializeArray(this.modalMaxWidthArray, null);
33707   this.InitializeArray(this.modalMaxHeightArray, null);
33708   this.InitializeArray(this.stretchVerticallyArray, false);
33709  }
33710 },
33711 InitializeArray: function(array, defaultValue) {
33712  if(array.length == 0) {
33713   for(var i = 0; i < this.GetWindowCountCore() ; i++)
33714    array[i] = defaultValue;
33715  }
33716 },
33717 InitializeWindowPopupElementIDList: function() {
33718  for(var i = 0; i < this.GetWindowCountCore() ; i++) {
33719   if(!this.windowsPopupElementIDList[i])
33720    this.windowsPopupElementIDList[i] = [];
33721  }
33722 },
33723 InitializeWindowPopupElementList: function() {
33724  for(var i = 0; i < this.GetWindowCountCore() ; i++) {
33725   if(!this.windowsPopupElementList[i])
33726    this.windowsPopupElementList[i] = [];
33727  }
33728 },
33729 InitializeWindowLastUsedPopupElementInfoList: function() {
33730  for(var i = 0; i < this.GetWindowCountCore() ; i++) {
33731   if(!this.windowsLastUsedPopupElementInfoList[i])
33732    this.windowsLastUsedPopupElementInfoList[i] = {};
33733  }
33734 },
33735 AllowMouseDown: function(evt, index) {
33736  return ASPxClientPopupControlBase.prototype.AllowMouseDown.call(this, evt, index) &&
33737   !this.PreventHeaderButtonMouseDownBubbling(evt, this.GetWindowPinButton(index)) &&
33738   !this.PreventHeaderButtonMouseDownBubbling(evt, this.GetWindowCollapseButton(index)) &&
33739   !this.PreventHeaderButtonMouseDownBubbling(evt, this.GetWindowMaximizeButton(index));
33740 },
33741 AssignHeaderButtonsEvents: function(index) {
33742  ASPxClientPopupControlBase.prototype.AssignHeaderButtonsEvents.call(this, index);
33743  this.AttachClickToHeaderButton(index, this.GetWindowPinButton(index), "ASPx.PWPBClick");
33744  this.AttachClickToHeaderButton(index, this.GetWindowCollapseButton(index), "ASPx.PWMNBClick");
33745  this.AttachClickToHeaderButton(index, this.GetWindowMaximizeButton(index), "ASPx.PWMXBClick");
33746 },
33747 InitializeWindow: function(index) {
33748  ASPxClientPopupControlBase.prototype.InitializeWindow.call(this, index);
33749  if(this.adaptivityEnabled) {
33750   ASPx.Evt.AttachEventToElement(this.GetModalWrapperElement(index), "scroll", function(e) { this.OnModalWrapperScroll(e, index); }.aspxBind(this));
33751   if(ASPx.Browser.WebKitTouchUI) {
33752    ASPx.Evt.AttachEventToElement(this.GetModalWrapperElement(index), "touchstart", function(e) { this.OnModalWrapperTouchStart(e); }.aspxBind(this));
33753    ASPx.Evt.AttachEventToElement(this.GetModalWrapperElement(index), "touchmove", function(e) { this.OnModalWrapperTouchMove(e, index); }.aspxBind(this));
33754   }
33755  } else {
33756   var modalElement = this.GetWindowModalElement(index);
33757   if(modalElement)
33758    ASPx.Evt.AttachEventToElement(modalElement, "mousedown", aspxPWMEMDown);
33759  }
33760 },
33761 BrowserWindowResizeSubscriber: function() {
33762  return true;
33763 },
33764 OnBrowserWindowResize: function(e) {
33765  window.setTimeout(this.SetPopupMaximizedPositionOnBrowserResize.aspxBind(this), 0);
33766  this.ForEachWindow(this.updateContentScrollIfNeeded.aspxBind(this));
33767 },
33768 SetPopupMaximizedPositionOnBrowserResize: function() {
33769  this.ForEachWindow(this.SetMaximizedPositionOnBrowserResize.aspxBind(this));
33770 },
33771 UpdateResizeCursor: function(index, element, verticalDirection, horizontalDirection) {
33772  if(this.GetAdaptiveModalMode(index))
33773   this.HideTemporaryCursor(element);
33774  else
33775   ASPxClientPopupControlBase.prototype.UpdateResizeCursor.call(this, index, element, verticalDirection, horizontalDirection);
33776 },
33777 SetMaximizedPositionOnBrowserResize: function(index) {
33778  var element = this.GetWindowElement(index);
33779  if(element && this.GetIsMaximized(index) && this.InternalIsWindowVisible(index)) {
33780   var left = this.GetMaximizedPosition(element, true);
33781   var top = this.GetMaximizedPosition(element, false);
33782   this.SetWindowPos(index, element, left, top);
33783  }
33784 },
33785 InitCollapsedWindows: function(index) {
33786  if((this.isCollapsedInit && index == -1) || (index >= 0 && index < this.isCollapsedInitArray.length && this.isCollapsedInitArray[index])) {
33787   if(this.InternalIsWindowVisible(index)) {
33788    this.DoCollapse(index, true);
33789    if(index == -1)
33790     this.isCollapsedInit = false;
33791    else
33792     this.isCollapsedInitArray[index] = false;
33793   }
33794  }
33795 },
33796 InitMaximizedWindows: function(index) {
33797  if(this.GetIsMaximizedInit(index) && this.InternalIsWindowVisible(index)) {
33798   this.DoMaximize(index, true);
33799   this.SetIsMaximizedInit(index, false);
33800  }
33801 },
33802 InitPinnedWindows: function(index) {
33803  if((this.isPinned && index == -1) || (index >= 0 && index < this.isPinnedArray.length && this.isPinnedArray[index]))
33804   this.HoldPosition(index, true);
33805 },
33806 AfterInitializeWindow: function(index) {
33807  if(this.contentOverflowX !== "None" && !this.GetWindowWidthFromServer(index))
33808   this.SetWindowWidth(index, 0);
33809  ASPxClientPopupControlBase.prototype.AfterInitializeWindow.call(this, index);
33810  this.InitPinnedWindows(index);
33811  this.InitMaximizedWindows(index);
33812  this.InitCollapsedWindows(index);
33813 },
33814 OnDragStop: function(index) {
33815  ASPxClientPopupControlBase.prototype.OnDragStop.call(this, index);
33816  if(this.adaptivityEnabled)
33817   ASPxClientPopupControl.WindowResizeHelper.Initialize(this.GetWindowElement(index));
33818  else
33819   this.updateContentScrollIfNeeded(index);
33820 },
33821 GetPropertyValue: function(index, propName) {
33822  if(0 <= index && index < this.GetWindowCountCore())
33823   return this[propName + "Array"][index];
33824  return ASPxClientPopupControlBase.prototype.GetPropertyValue.call(this, index, propName);
33825 },
33826 SetPropertyValue: function(index, propName, value) {
33827  if(0 <= index && index < this.GetWindowCountCore())
33828   this[propName + "Array"][index] = value;
33829  else
33830   ASPxClientPopupControlBase.prototype.SetPropertyValue.call(this, index, propName, value);
33831 },
33832 GetAdaptiveModalMode: function(index) {
33833  return this.GetPropertyValue(index, "adaptiveModalMode");
33834 },
33835 GetAutoUpdatePosition: function(index) {
33836  return this.GetPropertyValue(index, "autoUpdatePosition") && !this.GetAdaptiveModalMode(index);
33837 },
33838 SetAdaptiveModalMode: function(index, enabled) {
33839  ASPx.ToggleClassNameToElement(this.GetModalWrapperElement(index), this.GetModalSystemCssClass(), enabled);
33840  this.SetPropertyValue(index, "adaptiveModalMode", enabled);
33841 },
33842 GetIsPinned: function(index) {
33843  return this.GetPropertyValue(index, "isPinned");
33844 },
33845 SetIsPinned: function(index, value) {
33846  this.SetPropertyValue(index, "isPinned", value);
33847 },
33848 GetPinPosX: function(index) {
33849  return this.GetPropertyValue(index, "pinX");
33850 },
33851 SetPinPosX: function(index, pinX) {
33852  this.SetPropertyValue(index, "pinX", pinX);
33853 },
33854 GetPinPosY: function(index) {
33855  return this.GetPropertyValue(index, "pinY");
33856 },
33857 SetPinPosY: function(index, pinY) {
33858  this.SetPropertyValue(index, "pinY", pinY);
33859 },
33860 GetIsCollapsed: function(index) {
33861  return this.GetPropertyValue(index, "isCollapsed");
33862 },
33863 SetIsCollapsed: function(index, value) {
33864  this.SetPropertyValue(index, "isCollapsed", value);
33865 },
33866 GetIsMaximized: function(index) {
33867  return this.GetPropertyValue(index, "isMaximized");
33868 },
33869 GetIsMaximizedOnWebKitTouch: function(index) {
33870  return this.GetIsMaximized(index) && ASPx.Browser.WebKitTouchUI;
33871 },
33872 SetIsMaximized: function(index, value) {
33873  this.SetPropertyValue(index, "isMaximized", value);
33874 },
33875 GetIsMaximizedInit: function(index) {
33876  return this.GetPropertyValue(index, "isMaximizedInit");
33877 },
33878 SetIsMaximizedInit: function(index, value) {
33879  this.SetPropertyValue(index, "isMaximizedInit", value);
33880 },
33881 GetRestoredWindowData: function(index) {
33882  return ASPx.CloneObject(this.GetPropertyValue(index, "restoredWindowValues"));
33883 },
33884 GetEnableContentScrolling: function(index) {
33885  return this.GetPropertyValue(index, "enableContentScrolling");
33886 },
33887 GetWindowOverflowX: function(index) {
33888  return this.GetPropertyValue(index, "contentOverflowX");
33889 },
33890 GetWindowOverflowY: function(index) {
33891  return this.GetPropertyValue(index, "contentOverflowY");
33892 },
33893 SetRestoredWindowData: function(index, value) {
33894  this.SetPropertyValue(index, "restoredWindowValues", value);
33895 },
33896 GetWindowIsShown: function(index) {
33897  return this.GetPropertyValue(index, "shown");
33898 },
33899 SetWindowIsShown: function(index, shown) {
33900  this.SetPropertyValue(index, "shown", shown);
33901 },
33902 GetWindowWidthFromServer: function(index) {
33903  return this.GetPropertyValue(index, "widthFromServer");
33904 },
33905 GetHideBodyScrollWhenModal: function(index) {
33906  return this.GetPropertyValue(index, "hideBodyScrollWhenModal");
33907 },
33908 SetHideBodyScrollWhenModal: function(index, value) {
33909  this.SetPropertyValue(index, "hideBodyScrollWhenModal", value);
33910 },
33911 GetCanScrollViewPort: function(index) {
33912  return this.GetPropertyValue(index, "canScrollViewPort");
33913 },
33914 HasDefaultWindow: function() {
33915  return this.GetWindowCountCore() === 0;
33916 },
33917 GetWindowFooterHeightLite: function(index) {
33918  var footer = this.GetWindowFooterElement(index);
33919  if(footer)
33920   return footer.offsetHeight;
33921  return null;
33922 },
33923 SetWindowPopUpReasonMouseEvent: function(index, evt) {
33924  evt = ASPx.CloneObject(evt);
33925  if(evt === undefined)
33926   evt = null;
33927  if(0 <= index && index < this.GetWindowCountCore())
33928   this.windowsPopupReasonMouseEventList[index] = evt;
33929  this.defaultPopupReasonMouseEvent = evt;
33930 },
33931 GetPopUpReasonMouseEvent: function() {
33932  return this.GetWindowPopUpReasonMouseEvent(null);
33933 },
33934 GetWindowPopUpReasonMouseEvent: function(window) {
33935  var index = (window != null) ? window.index : -1;
33936  if(0 <= index && index < this.GetWindowCountCore())
33937   return this.windowsPopupReasonMouseEventList[index];
33938  return this.defaultPopupReasonMouseEvent;
33939 },
33940 GetWindowCountCore: function() {
33941  return (this.windows.length > 0) ? this.windows.length : this.windowCount;
33942 },
33943 SetClientModality: function(isModal) {
33944  this.SetWindowClientModality(-1, isModal);
33945 },
33946 SetWindowClientModality: function(index, isModal) {
33947  var modalElement = this.GetWindowModalElement(index);
33948  if(isModal && !ASPx.IsElementVisible(modalElement))
33949   this.DoShowWindowModalElement(index);
33950  if(!isModal && ASPx.IsElementVisible(modalElement)) {
33951   var element = this.GetWindowElement(index);
33952   this.DoHideWindowModalElement(element);
33953  }
33954 },
33955 GetWindowPinButton: function(index) {
33956  return ASPx.GetElementById(this.name + "_HPB" + index);
33957 },
33958 GetWindowCollapseButton: function(index) {
33959  return ASPx.GetElementById(this.name + "_HMNB" + index);
33960 },
33961 GetWindowMaximizeButton: function(index) {
33962  return ASPx.GetElementById(this.name + "_HMXB" + index);
33963 },
33964 GetWindowScrollDiv: function(index) {
33965  return this.GetWindowChild(index, "_CSD" + index);
33966 },
33967 GetWindowElementDisplayValue: function(windowHasAnyScrollbars, windowHeight) {
33968  return windowHasAnyScrollbars && windowHeight ? "block" : "table";
33969 },
33970 GetMainWindowWidth: function(index, noCache) {
33971  return this.GetClientWindowWidth(index, true, noCache);
33972 },
33973 GetClientWindowWidth: function(index, outerSize, noCache) {
33974  if(!noCache && (this.GetIsCollapsed(index) || this.GetIsMaximized(index))) {
33975   var cachedSize = this.GetWindowCachedSize(index);
33976   if(cachedSize != null)
33977    return cachedSize.width;
33978  }
33979  var element = this.GetWindowElement(index);
33980  if(element != null)
33981   return element.offsetWidth;
33982 },
33983 GetMainWindowHeight: function(index, noCache) {
33984  return this.GetClientWindowHeight(index, true, noCache);
33985 },
33986 GetClientWindowHeight: function(index, outerSize, noCache) {
33987  if(!noCache && (this.GetIsCollapsed(index) || this.GetIsMaximized(index))) {
33988   var cachedSize = this.GetWindowCachedSize(index);
33989   if(cachedSize != null)
33990    return cachedSize.height;
33991  }
33992  var element = this.GetWindowElement(index);
33993  if(element != null)
33994   return element.offsetHeight;
33995 },
33996 ShowModal: function() {
33997  this.ShowModalByIndex(-1);
33998 },
33999 ShowModalByIndex: function(index) {
34000  if(this.adaptivityEnabled) {
34001   this.SetAdaptiveModalMode(index, true);
34002   this.ResetModalStyles(index);
34003   this.ResetPopupStyles(index);
34004   this.DoShowModal(index, ASPx.InvalidPosition, ASPx.InvalidPosition, this.GetLastShownPopupElementIndex(index));
34005  }
34006 },
34007 DoShowWindowCore: function(index, x, y, popupElementIndex, closeOtherWindows, allowChangeZIndex, evt, closeOtherReason) {
34008  if(this.IsDOMDisposed()) return;
34009  this.SetWindowPopUpReasonMouseEvent(index, evt);
34010  if(this.adaptivityEnabled) {
34011   this.SetAdaptiveModalMode(index, this.NeedAdaptiveModalMode(index));
34012   this.ResetModalStyles(index);
34013   if(this.GetAdaptiveModalMode(index)) {
34014    this.ResetPopupStyles(index);
34015    this.DoShowModal(index, x, y, popupElementIndex);
34016    return;
34017   }
34018  }
34019  this.DoShowWindowAtPos(index, x, y, popupElementIndex, closeOtherWindows, allowChangeZIndex, evt, closeOtherReason);
34020 },
34021 NeedAdaptiveModalMode: function(index) {
34022  return window.innerWidth < this.GetSwitchAtWindowInnerWidth();
34023 },
34024 GetSwitchAtWindowInnerWidth: function() {
34025  return this.switchAtWindowInnerWidth;
34026 },
34027 GetModalSystemCssClass: function() {
34028  return "dxmodalSys";
34029 },
34030 DoShowWindowAtPos: function(index, x, y, popupElementIndex, closeOtherWindows, allowChangeZIndex, evt, closeOtherReason) {
34031  if(!this.isInitialized)
34032   this.PopulatePopupElements(index);
34033  var element = this.GetWindowElement(index);
34034  if(element != null && this.IsWindowElementsIDAssigned(index)) {
34035   this.StopCloseAnimation(index);
34036   this.PrepareToAdjustContentOnShow(index);
34037   if(closeOtherWindows)
34038    aspxGetPopupControlCollection().DoHideAllWindows(element, this.GetWindowElementId(index), false, closeOtherReason, 0);
34039   var isMoving = this.InternalIsWindowVisible(index);
34040   ASPx.SetElementDisplay(element, true);
34041   element.style.display = this.GetWindowElementDisplayValue(this.HasAnyScrollBars(index), this.GetPopupWindowDimensionFromCache(index, false));
34042   element.style.position = "absolute";
34043   var scrollDiv = this.GetWindowScrollDiv(index),
34044    shouldResetScrollSize = scrollDiv && this.GetEnableContentScrolling(index) && ASPx.GetDocumentMaxClientHeight() <= element.offsetHeight,
34045    savedScrollDivHeight = shouldResetScrollSize && scrollDiv.style.height;
34046   if(shouldResetScrollSize)
34047    scrollDiv.style.height = 0;
34048   this.RestoreWindowSizeFromCache(index);
34049   if(!this.GetWindowIsShown(index)) {
34050    var width = this.GetPopupWindowDimensionFromCache(index, true),
34051     height = this.GetPopupWindowDimensionFromCache(index, false);
34052    this.SetClientWindowSizeCoreLite(index, width, height);
34053    this.SetWindowIsShown(index, true);
34054   }
34055   var popupElement = this.GetPopupElement(index, popupElementIndex);
34056   if(popupElement)
34057    this.SetLastShownPopupElementIndex(index, popupElementIndex);
34058   if(this.GetIsMaximized(index)) {
34059    if(this.hideBodyScrollWhenMaximized)
34060     ASPx.PopupUtils.BodyScrollHelper.HideBodyScroll(element.id);
34061    this.NormalizeMaximizedWindowSize(index);
34062   }
34063   var isDragged = this.GetIsDragged(index);
34064   var horizontalPopupPosition = this.GetClientPopupPos(element, popupElement, x, true, isDragged);
34065   var verticalPopupPosition = this.GetClientPopupPos(element, popupElement, y, false, isDragged);
34066   var clientX = horizontalPopupPosition.position;
34067   var clientY = verticalPopupPosition.position;
34068   this.SetWindowPos(index, element, clientX, clientY);
34069   if(shouldResetScrollSize)
34070    scrollDiv.style.height = savedScrollDivHeight;
34071   this.DoShowWindowModalElement(index);
34072   this.SetVisibleWithAnimation(element, isMoving, index, horizontalPopupPosition, verticalPopupPosition);
34073   this.ShowWindowContentUrl(index);
34074   this.AdjustContentOnShow(index);
34075   scrollDiv = this.GetWindowScrollDiv(index);
34076   if(scrollDiv && this.GetEnableContentScrolling(index)) {
34077    var dimension = null;
34078    var windowMainCell = this.GetWindowMainCell(element);
34079    if(windowMainCell.style.width && windowMainCell.style.height)
34080     dimension = 'both';
34081    else if(windowMainCell.style.width)
34082     dimension = 'width';
34083    else if(windowMainCell.style.height)
34084     dimension = 'height';
34085    if(!dimension)
34086     return;
34087    ASPx.SetElementDisplay(scrollDiv, false);
34088    this.SetWindowScrollDivSize(scrollDiv, index, dimension);
34089    ASPx.SetElementDisplay(scrollDiv, true);
34090   }
34091   this.registerAndActivateWindow(element, index, allowChangeZIndex);
34092   this.RaisePopupOnShow(isMoving, index);
34093   this.CorrectWindowSizeGripPositionLite(index);
34094   this.CorrectWindowHeaderText(index);
34095   this.InitMaximizedWindows(index);
34096   this.InitCollapsedWindows(index);
34097   if(this.GetIsPinned(index)) window.setTimeout(function() { this.HoldPosition(index, true); }.aspxBind(this), 0);
34098   if(!this.GetShowOnPageLoad(index))
34099    this.CorrectElementVerticalAlignment(ASPx.AdjustVerticalMarginsInContainer, this.GetWindowHeaderElement(index));
34100   if(element.style.width.indexOf("px") > -1) {
34101    element.style.width = ASPx.GetCurrentStyle(element).width;
34102   }
34103   this.updateContentScrollIfNeeded(index);
34104  }
34105 },
34106 DoShowModal: function(index, x, y, popupElementIndex) {
34107  var element = this.GetWindowElement(index);
34108  if(element != null) {
34109   this.StopCloseAnimation(index);
34110   this.EnsureIframeOnIosContentOverflow(index);
34111   this.PrepareToAdjustContentOnShow(index);
34112   if(!ASPx.Browser.WebKitTouchUI)
34113    ASPx.PopupUtils.BodyScrollHelper.HideBodyScroll(element.id);
34114   this.DoShowWindowModalElement(index);
34115   var isMoving = this.InternalIsWindowVisible(index);
34116   ASPx.SetElementDisplay(this.GetModalWrapperElement(index), true);
34117   this.ResetScroll(index);
34118   ASPx.SetElementDisplay(element, true);
34119   this.SetSizeBeforeShow(index);
34120   this.UpdateAlignment(index);
34121   var popupElement = this.GetPopupElement(index, popupElementIndex);
34122   if(popupElement)
34123    this.SetLastShownPopupElementIndex(index, popupElementIndex);
34124   this.SetContentElementsAdaptiveDisplayStyle(index);
34125   var horizontalPopupPosition = this.GetClientPopupPos(element, popupElement, x, true, false),
34126    verticalPopupPosition = this.GetClientPopupPos(element, popupElement, y, false, false);
34127   this.SetVisibleWithAnimation(element, isMoving, index, horizontalPopupPosition, verticalPopupPosition);
34128   this.ShowWindowContentUrl(index);
34129   this.AdjustContentOnShow(index);
34130   this.registerAndActivateWindow(element, index, true);
34131   this.RaisePopupOnShow(isMoving, index);
34132   this.CorrectWindowHeaderText(index);
34133   if(!this.GetShowOnPageLoad(index))
34134    this.CorrectElementVerticalAlignment(ASPx.AdjustVerticalMarginsInContainer, this.GetWindowHeaderElement(index));
34135  }
34136 },
34137 EnsureIframeOnIosContentOverflow: function(index) {
34138  if(this.HasIframeOnIos(index)) {
34139   var contentElement = this.GetWindowContentElement(index);
34140   if(contentElement.style.overflow === "")
34141    contentElement.style.overflow = "auto";
34142  }
34143 },
34144 SetWindowElementZIndex: function(element, zIndex) {
34145  ASPxClientPopupControlBase.prototype.SetWindowElementZIndex.call(this, element, zIndex);
34146  if(this.adaptivityEnabled)
34147   this.SetModalWrapperZIndex(this.GetWindowIndex(element), zIndex);
34148  else
34149   this.updateContentScrollIfNeeded(this.GetWindowIndex(element));
34150 },
34151 SetModalWrapperZIndex: function(index, zIndex) {
34152  if(!this.GetAdaptiveModalMode(index)) return;
34153  ASPx.SetStyles(this.GetModalWrapperElement(index), {
34154   zIndex: zIndex
34155  });
34156 },
34157 updateContentScrollIfNeeded: function(index) {
34158  var windowElement = this.GetWindowElement(index);
34159  var wrapper = this.getWindowWrapper(windowElement);
34160  var wrapperScroll = this.getWindowWrapperScroll(windowElement);
34161  if(!wrapper || !this.WindowIsModal(index) || !this.GetHideBodyScrollWhenModal(index))
34162   return;
34163  ASPx.PopupUtils.adjustViewportScrollWrapper(wrapper, wrapperScroll, windowElement);
34164 },
34165 getWindowWrapper: function(windowElement) {
34166  return ASPx.GetParentByClassName(windowElement, PopupControlCssClasses.WindowWrapperCssClassName);
34167 },
34168 getWindowWrapperScroll: function(windowElement) {
34169  return ASPx.GetParentByClassName(windowElement, PopupControlCssClasses.WindowWrapperScrollCssClassName);
34170 },
34171 SizeCanBeSet: function(index, isWindowMaximizedAndCollapsed) {
34172  return ASPxClientPopupControlBase.prototype.SizeCanBeSet.call(this, index, isWindowMaximizedAndCollapsed) && !this.GetAdaptiveModalMode(index);
34173 },
34174 GetPopupWindowDimensionFromCache: function(index, isWidth) {
34175  var dimension;
34176  if(isWidth) {
34177   dimension = this.GetWindowWidthInternal(index);
34178   if(ASPx.IsExists(dimension)) {
34179    dimension = Math.max(dimension, this.GetWindowMinWidth(index));
34180    var maxWidth = this.GetWindowMaxWidth(index);
34181    if(maxWidth)
34182     dimension = Math.min(dimension, maxWidth);
34183   }
34184  }
34185  else {
34186   dimension = this.GetWindowHeightInternal(index);
34187   if(ASPx.IsExists(dimension)) {
34188    if(this.HasAnyScrollBars(index) && dimension === constants.DEFAULT_WINDOW_HEIGHT)
34189     return undefined;
34190    dimension = Math.max(dimension, this.GetWindowMinHeight(index));
34191    var maxHeight = this.GetWindowMaxHeight(index);
34192    if(maxHeight)
34193     dimension = Math.min(dimension, maxHeight);
34194   }
34195  }
34196  return dimension;
34197 },
34198 NormalizeMaximizedWindowSize: function(index) {
34199  var width = this.GetPopupWindowDimensionFromCache(index, true),
34200   height = this.GetPopupWindowDimensionFromCache(index, false),
34201   dimensions = this.getDocumentDimensions(index),
34202   sizeNormalizationIsNeeded = width < dimensions.width || height < dimensions.height;
34203  if(sizeNormalizationIsNeeded)
34204   this.NormalizeWindowSize(index, true);
34205 },
34206 NormalizeWindowSize: function(index, isMaximized) {
34207  var width = this.GetClientWindowWidth(index),
34208   height = this.GetClientWindowHeight(index),
34209   normWidth = width,
34210   normHeight = height,
34211   maxWidth = this.GetWindowMaxWidth(index),
34212   minWidth = this.GetWindowMinWidth(index),
34213   maxHeight = this.GetWindowMaxHeight(index),
34214   minHeight = this.GetWindowMinHeight(index);
34215  if(maxWidth)
34216   normWidth = Math.min(normWidth, maxWidth);
34217  if(minWidth)
34218   normWidth = Math.max(normWidth, minWidth);
34219  if(maxHeight)
34220   normHeight = Math.min(normHeight, maxHeight);
34221  if(minHeight)
34222   normHeight = Math.max(normHeight, minHeight);
34223  if(normWidth !== width || normHeight !== height)
34224   this.SetWindowSize(this.GetWindow(index), normWidth, normHeight);
34225  if(isMaximized) {
34226   var dimensions = this.getDocumentDimensions(index);
34227   if(this.GetIsCollapsed(index)) {
34228    if(normWidth != dimensions.width) {
34229     this.SetWindowSizeByIndexCore(index, dimensions.width, normHeight, true);
34230    }
34231   } else {
34232    if(normWidth != dimensions.width || normHeight != dimensions.height) {
34233     this.SetWindowSizeByIndexCore(index, dimensions.width, dimensions.height, false);
34234    }
34235   }
34236  }
34237 },
34238 DoShowWindowModalElement: function(index) {
34239  if(this.CanManipulateWithModalElement(index)) {
34240   if(this.adaptivityEnabled) {
34241    this.DoShowWindowModalElementWithAdaptivity(index);
34242    return;
34243   }
34244   var modalElement = this.GetWindowModalElement(index);
34245   var bodyScrollHasJustBeingHidden = false;
34246   if(this.GetHideBodyScrollWhenModal(index) && (!this.IsWindowVisible(this.GetWindow(index)) || !ASPx.IsElementVisible(modalElement))) {
34247    bodyScrollHasJustBeingHidden = true;
34248    aspxGetPopupControlCollection().LockWindowResizeByBodyScrollVisibilityChanging();
34249    if(!ASPx.Browser.WebKitTouchUI)
34250     ASPx.PopupUtils.BodyScrollHelper.HideBodyScroll(this.GetWindowElementId(index));
34251   }
34252   ASPx.SetElementDisplay(modalElement, true);
34253   this.AdjustModalElementBounds(modalElement);
34254   this.SetModalElementVisibilityWithAnimation(modalElement, index);
34255   aspxGetPopupControlCollection().RegisterVisibleModalElement(modalElement);
34256   if(bodyScrollHasJustBeingHidden)
34257    aspxGetPopupControlCollection().UnlockWindowResizeByBodyScrollVisibilityChanging();
34258  }
34259 },
34260 DoShowWindowModalElementWithAdaptivity: function(index) {
34261  var overlayElement = this.GetOverlayElement(index);
34262  if(!overlayElement) return;
34263  ASPx.SetStyles(overlayElement, {
34264   right: 0,
34265   bottom: 0,
34266   width: "",
34267   height: ""
34268  });
34269  ASPx.SetElementDisplay(overlayElement, true);
34270  this.SetModalElementVisibilityWithAnimation(overlayElement, index);
34271  ASPx.GetPopupControlCollection().RegisterVisibleModalElement(overlayElement);
34272 },
34273 SetSizeBeforeShow: function(index) {
34274  if(this.GetModalMaxWidth(index) && this.GetModalMaxWidth(index) !== this.DefaultModalMaxWidth)
34275   this.SetAdaptiveMaxWidthByIndex(index, this.GetModalMaxWidth(index));
34276  if(this.GetModalMinWidth(index) !== this.DefaultModalMinWidth)
34277   this.SetAdaptiveMinWidthByIndex(index, this.GetModalMinWidth(index));
34278  this.UpdateHeightDimensions(index);
34279 },
34280 UpdateHeightDimensions: function(index) {
34281  this.UpdateAdaptiveMinHeight(index);
34282  this.UpdateAdaptiveMaxHeight(index);
34283 },
34284 UpdateAdaptiveMinHeight: function(index) {
34285  if(this.GetModalMinHeight(index) !== null)
34286   this.SetAdaptiveHeightDimension(index, "minHeight", this.GetModalMinHeight(index));
34287 },
34288 UpdateAdaptiveMaxHeight: function(index) {
34289  if(this.GetModalMaxHeight(index) !== null)
34290   this.SetAdaptiveHeightDimension(index, "maxHeight", this.GetModalMaxHeight(index));
34291 },
34292 GetClientPopupPos: function(element, popupElement, pos, isX, isDragged) {
34293  if(!this.GetAdaptiveModalMode(this.GetWindowIndex(element)))
34294   return ASPxClientPopupControlBase.prototype.GetClientPopupPos.call(this, element, popupElement, pos, isX, isDragged);
34295  var getPosFunc = isX ? ASPx.GetAbsolutePositionX : ASPx.GetAbsolutePositionY;
34296  return { position: getPosFunc(element) };
34297 },
34298 GetAnimationVerticalDirection: function(index, verticalPopupPosition) {
34299  if(!this.GetAdaptiveModalMode(index))
34300   return ASPxClientPopupControlBase.prototype.GetAnimationVerticalDirection.call(this, index, verticalPopupPosition);
34301  return ASPxClientPopupControl.Animation.GetVerticalDirection(this.modalVerticalAlign, this.modalHorizontalAlign);
34302 },
34303 GetAnimationHorizontalDirection: function(index, horizontalPopupPosition) {
34304  if(!this.GetAdaptiveModalMode(index))
34305   return ASPxClientPopupControlBase.prototype.GetAnimationHorizontalDirection.call(this, index, horizontalPopupPosition);
34306  return ASPxClientPopupControl.Animation.GetHorizontalDirection(this.modalHorizontalAlign);
34307 },
34308 GetDefaultVerticalOffset: function() {
34309  return this.IsSmallDisplay() ? 10 : 30;
34310 },
34311 IsSmallDisplay: function() {
34312  return window.innerWidth < this.GetScreenLimitForCss();
34313 },
34314 GetScreenLimitForCss: function() {
34315  return ASPx.MaxMobileWindowWidth;
34316 },
34317 StartAutoAnimation: function(element, index, horizontalPopupPosition, verticalPopupPosition) {
34318  if(this.adaptivityEnabled) {
34319   if(this.NeedFadeAnimation(index, this.popupAnimationType))
34320    this.StartFadeAnimation(element, index);
34321   else
34322    this.StartSlideAnimation(element, index, horizontalPopupPosition, verticalPopupPosition);
34323  } else 
34324   ASPxClientPopupControlBase.prototype.StartAutoAnimation.call(this, element, index, horizontalPopupPosition, verticalPopupPosition);
34325 },
34326 DoHideWindowWithAutoAnimation: function(index, element, closeReason) {
34327  if(this.NeedFadeAnimation(index, this.closeAnimationType))
34328   this.DoHideWindowWithFadeAnimation(index, element, closeReason);
34329  else
34330   this.DoHideWindowWithSlideAnimation(index, closeReason);
34331 },
34332 IsDraggingAllowed: function(index) {
34333  return this.allowDragging && (!this.GetAdaptiveModalMode(index) || this.allowDraggingInAdaptiveMode);
34334 },
34335 IsResizeAllowed: function(index) {
34336  return ASPxClientPopupControlBase.prototype.IsResizeAllowed.call(this, index) && !this.GetAdaptiveModalMode(index);
34337 },
34338 IsFadeCloseAnimation: function(index) {
34339  return ASPxClientPopupControlBase.prototype.IsFadeCloseAnimation.call(this, index) || this.NeedFadeAnimation(index, this.closeAnimationType);
34340 },
34341 NeedFadeAnimation: function(index, animationType) {
34342  return ASPxClientPopupControl.Animation.NeedFadeAnimation(this.modalHorizontalAlign, this.modalVerticalAlign,
34343   animationType, this.popupHorizontalAlign, this.popupVerticalAlign, this.GetAdaptiveModalMode(index));
34344 },
34345 AllowModalElementAnimation: function(index) {
34346  if(this.GetAdaptiveModalMode(index))
34347   return this.HasOpenAnimation();
34348  return ASPxClientPopupControlBase.prototype.AllowModalElementAnimation.call(this, index);
34349 },
34350 DoHideWindowCore: function(index, closeReason) {
34351  var element = this.GetWindowElement(index);
34352  if(element != null) {
34353   if(this.HasCloseAnimation())
34354    this.PrepareElementAfterCloseAnimation(index, element);
34355   element.isHiding = true;
34356   element.style.zIndex = this.GetDefaultZIndexFromServer();
34357   this.SetIsDragged(index, false);
34358   this.UpdateWindowsStateCookie();
34359   element.isHiding = false;
34360   this.StopShowAnimation(index);
34361   if(ASPx.Browser.WebKitTouchUI || ASPx.Browser.Safari) {
34362    var dummy = element.offsetWidth; 
34363   }
34364   ASPx.SetElementDisplay(element, false);
34365   ASPx.SetElementVisibility(element, false);
34366   if(this.adaptivityEnabled) {
34367    ASPx.SetElementDisplay(this.GetModalWrapperElement(index), "");
34368    if(!ASPx.Browser.WebKitTouchUI)
34369     ASPx.PopupUtils.BodyScrollHelper.RestoreBodyScroll(element.i
34369d);
34370    this.SetWrapperScrollVisible(index, true);
34371    this.SetIsDragged(index, false);
34372   }
34373   if(this.hideBodyScrollWhenMaximized && this.GetIsMaximized(index))
34374    ASPx.PopupUtils.BodyScrollHelper.RestoreBodyScroll(element.id);
34375   this.DoHideWindowModalElement(element, closeReason);
34376   this.DoHideWindowIFrame(element);
34377   aspxGetPopupControlCollection().UnregisterVisibleWindow(element);
34378   this.ProcessAccessibleElementOnHide();
34379   this.HideWindowLoadingPanel(index);
34380  }
34381 },
34382 OnAnimationStop: function(index) {
34383  if(this.adaptivityEnabled) {
34384   this.SetWrapperScrollVisible(index, true);
34385   this.UnlockWrapperScrollEventEvent();
34386  }
34387  ASPxClientPopupControlBase.prototype.OnAnimationStop.call(this, index);
34388  if(!this.adaptivityEnabled && ASPx.Browser.Firefox)
34389   this.GetWindowElement(index).style.display = "table";
34390 },
34391 ResetModalStyles: function(index) {
34392  var element = this.GetWindowElement(index);
34393  if(element != null) {
34394   ASPx.SetStyles(element, {
34395    minWidth: "",
34396    maxWidth: "",
34397    marginTop: "",
34398    marginLeft: "",
34399    marginRight: "",
34400    position: ""
34401   });
34402   ASPx.SetStyles(this.GetWindowContentElement(index), {
34403    minHeight: "",
34404    maxHeight: "",
34405   });
34406   this.FixateFooter(index, false, 0);
34407   this.FixateHeader(index, false, 0);
34408   this.SetIsDragged(false);
34409   this.DoHideWindowModalElement(element);
34410  }
34411 },
34412 ResetPopupStyles: function(index) {
34413  var element = this.GetWindowElement(index);
34414  if(element != null) {
34415   ASPx.SetStyles(element, {
34416    left: "",
34417    top: "",
34418    width: "",
34419    height: "",
34420   });
34421   ASPx.SetStyles(this.GetWindowContentWrapperElement(index), {
34422    height: "",
34423    width: "",
34424    display: ""
34425   });
34426   ASPx.SetStyles(this.GetWindowContentElement(index), {
34427    display: "",
34428    width: "",
34429    height: ""
34430   });
34431   this.SetWindowIsShown(index, false);
34432  }
34433 },
34434 InitDivPosForHideSlideAnimation: function(animationDivElement) {
34435  ASPx.PopupUtils.InitAnimationDivCore(animationDivElement);
34436 },
34437 DoHideWindow: function(index, dontRaiseClosing, closeReason) {
34438  var cancel = ASPxClientPopupControlBase.prototype.DoHideWindow.call(this, index, dontRaiseClosing, closeReason);
34439  this.updateContentScrollIfNeeded(index);
34440  return cancel;
34441 },
34442 OnWindowShown: function(windowIndex) {
34443  this.EnsureContent(windowIndex, false);
34444  this.EnsureIFrameHeightAdjusted(windowIndex);
34445  if(this.GetAdaptiveModalMode(windowIndex))
34446   this.ChangeFooterFixed(windowIndex);
34447  else {
34448   var isMaximized = this.GetIsMaximized(windowIndex);
34449   if(isMaximized || this.HasAnyScrollBars(windowIndex))
34450    this.NormalizeWindowSize(windowIndex, isMaximized);
34451  }
34452  this.RaiseShown(windowIndex);
34453  var loadingElementsWillNotBeShown = !this.lpTimers[windowIndex] || this.lpTimers[windowIndex] < 0;
34454  if(this.InWindowCallback(windowIndex) && loadingElementsWillNotBeShown) {
34455   this.ShowWindowLoadingElementsInternal(windowIndex);
34456  }
34457  if(this.GetAdaptiveModalMode(windowIndex))
34458   this.UpdateAdaptiveMinHeight(windowIndex);
34459 },
34460 SetWrapperScrollVisible: function(index, visible) {
34461  if(!this.GetAdaptiveModalMode(index)) return;
34462  var modalWrapper = this.GetModalWrapperElement(index);
34463  if(visible) {
34464   ASPx.Attr.RestoreStyleAttribute(modalWrapper, "overflow-x");
34465   ASPx.Attr.RestoreStyleAttribute(modalWrapper, "overflow-y");
34466  } else {
34467   if(this.modalVerticalAlign === ModalAlign.WindowBottom && this.GetWindowElement(index).offsetHeight <= window.innerHeight)
34468    ASPx.Attr.ChangeStyleAttribute(modalWrapper, "overflow-y", "hidden");
34469   if(this.modalHorizontalAlign === ModalAlign.WindowRight)
34470    ASPx.Attr.ChangeStyleAttribute(modalWrapper, "overflow-x", "hidden");
34471  }
34472 },
34473 GetDragCorrection: function(index, element, isX) {
34474  if(this.adaptivityEnabled) {
34475   var offset = isX ? element.offsetLeft : element.offsetTop;
34476   offset -= ASPx.PxToInt(element.style[isX ? "left" : "top"]);
34477   return ASPx.GetPositionElementOffset(this.GetModalWrapperElement(index), isX) + offset;
34478  } else
34479   return ASPxClientPopupControlBase.prototype.GetDragCorrection.call(this, index, element, isX);
34480 },
34481 GetSlideAnimationDuration: function(index) {
34482  return !this.GetAdaptiveModalMode(index) ? ASPxClientPopupControlBase.prototype.GetSlideAnimationDuration.call(this, index) : 300;
34483 },
34484 GetSlideOffsetCoefficient: function(index) {
34485  return !this.GetAdaptiveModalMode(index) ? ASPxClientPopupControlBase.prototype.GetSlideOffsetCoefficient.call(this, index) : 0.25;
34486 },
34487 InitDivPosForShowSlideAnimation: function(index, animationDivElement, clientX, clientY, onAnimStopCallString) {
34488  if(!this.GetAdaptiveModalMode(index))
34489   ASPxClientPopupControlBase.prototype.InitDivPosForShowSlideAnimation.call(this, index, animationDivElement, clientX, clientY, onAnimStopCallString);
34490  else
34491   ASPx.PopupUtils.InitAnimationProperties(animationDivElement, onAnimStopCallString);
34492 },
34493 BeforeAnySlideAnimation: function(index) {
34494  this.FixateFooter(index, false, 0);
34495  this.FixateHeader(index, false, 0);
34496  this.SetWrapperScrollVisible(index, false);
34497 },
34498 StartSlideAnimation: function(animationDivElement, index, horizontalPopupPosition, verticalPopupPosition) {
34499  if(this.adaptivityEnabled) {
34500   this.LockWrapperScrollEvent();
34501   this.BeforeAnySlideAnimation(index);
34502  }
34503  ASPxClientPopupControlBase.prototype.StartSlideAnimation.call(this, animationDivElement, index, horizontalPopupPosition, verticalPopupPosition);
34504 },
34505 DoHideWindowWithSlideAnimation: function(index, closeReason) {
34506  if(this.adaptivityEnabled)
34507   this.BeforeAnySlideAnimation(index);
34508  ASPxClientPopupControlBase.prototype.DoHideWindowWithSlideAnimation.call(this, index, closeReason);
34509 },
34510 UpdatePositionAfterCallback: function(windowIndex) {
34511  if(!this.InternalIsWindowVisible(windowIndex)) return;
34512  if(this.adaptivityEnabled)
34513   this.TryAutoUpdatePosition(windowIndex);
34514  else if(this.contentLoadingMode === LoadContentViaCallback.OnFirstShow)
34515   this.UpdateWindowPositionInternal(windowIndex, this.GetPopupElement(windowIndex, this.GetLastShownPopupElementIndex(windowIndex)));
34516 },
34517 CreateLoadingDiv: function(parentElement, offsetElement, windowIndex) {
34518  if(typeof (windowIndex) != "undefined") { 
34519   var loadingDiv = ASPxClientControl.prototype.CreateLoadingDiv.call(this, parentElement, offsetElement);
34520   loadingDiv.id += windowIndex;
34521   return loadingDiv;
34522  }
34523 },
34524 CreateLoadingPanelWithAbsolutePosition: function(parentElement, offsetElement, windowIndex) {
34525  if(typeof (windowIndex) != "undefined") { 
34526   var loadingPanel = ASPxClientControl.prototype.CreateLoadingPanelWithAbsolutePosition.call(this, parentElement, offsetElement);
34527   loadingPanel.id += windowIndex;
34528   return loadingPanel;
34529  }
34530 },
34531 PerformWindowCallback: function(window, parameter, onSuccess) {
34532  ASPxClientPopupControlBase.prototype.PerformWindowCallback.call(this, window, parameter, onSuccess);
34533 },
34534 SetIframeVisibleForDragging: function(index, visible) {
34535  var iframeElement = this.GetWindowContentIFrameElement(index);
34536  if(ASPx.Browser.Edge)
34537   iframeElement.style.pointerEvents = visible ? "" : "none";
34538  ASPx.SetElementVisibility(iframeElement, visible);
34539 },
34540 OnResizeStop: function(evt, index, cursor, resizePanel) {
34541  ASPxClientPopupControlBase.prototype.OnResizeStop.call(this, evt, index, cursor, resizePanel);
34542  if(this.IsResizeAllowed(index))
34543   this.SetWindowCachedSize(index, this.GetClientWindowWidth(index), this.GetClientWindowHeight(index));
34544  this.updateContentScrollIfNeeded(index);
34545 },
34546 OnMouseDownModalElement: function(evt, index) {
34547  aspxGetPopupControlCollection().DoHideAllWindows(ASPx.Evt.GetEventSource(evt), "", false, ASPxClientPopupControlCloseReason.OuterMouseClick, evt.offsetX);
34548  this.SetIsPopuped(index, true);
34549 },
34550 IsRaiseAfterResizingLocked: function() {
34551  return this.CollapseExecuting() || this.MaximizationExecuting();
34552 },
34553 GetContentElementChildren: function(index, contentElement) {
34554  var cache = this.GetResizeSessionCache();
34555  if(!cache.contentElementChildren || !cache.contentElementChildren[index]) {
34556   cache.contentElementChildren = [];
34557   cache.contentElementChildren[index] = contentElement.getElementsByTagName("*");
34558  }
34559  return cache.contentElementChildren[index];
34560 },
34561 GetContentElementChildrenScroll: function(index, contentElementChildren) {
34562  var cache = this.GetResizeSessionCache();
34563  if(!cache.contentElementChildrenScroll || !cache.contentElementChildrenScroll[index]) {
34564   cache.contentElementChildrenScroll = [];
34565   cache.contentElementChildrenScroll[index] = [];
34566   for(var i = 0, len = contentElementChildren.length; i < len; i++) {
34567    var child = contentElementChildren[i];
34568    if(!!child.scrollLeft || !!child.scrollTop)
34569     cache.contentElementChildrenScroll[index].push([i, child.scrollLeft, child.scrollTop]);
34570   }
34571  }
34572  return cache.contentElementChildrenScroll[index];
34573 },
34574 GetElementBordersAndPaddings: function(index, element, leftRight) {
34575  var cache = this.GetResizeSessionCache();
34576  if(!cache.elementBordersAndPaddings || !cache.elementBordersAndPaddings[index]) {
34577   cache.elementBordersAndPaddings = [];
34578   var style = ASPx.GetCurrentStyle(element);
34579   cache.elementBordersAndPaddings[index] = {
34580    leftRight: this.getLeftRightBordersAndPaddingsSummaryValue(element, style),
34581    topBottom: this.getTopBottomBordersAndPaddingsSummaryValue(element, style)
34582   };
34583  }
34584  return leftRight ? cache.elementBordersAndPaddings[index].leftRight : cache.elementBordersAndPaddings[index].topBottom;
34585 },
34586 GetHeaderFooterHeight: function(index) {
34587  var cache = this.GetResizeSessionCache();
34588  if(!cache.headerFooterHeight || !cache.headerFooterHeight[index]) {
34589   cache.headerFooterHeight = [];
34590   cache.headerFooterHeight[index] = this.GetHeaderFooterHeightCore(index);
34591  }
34592  return cache.headerFooterHeight[index];
34593 },
34594 getContentElementDisplay: function(correctContentElementSize, contentUrl) {
34595  return correctContentElementSize || contentUrl ? "block" : "table-cell";
34596 },
34597 SetContentWrapperHeightLite: function(index, actualHeight, windowElem, contentWrapper) {
34598  if(!windowElem.style.height || ASPx.IsPercentageSize(windowElem.style.height))
34599   return;
34600  var borderOwner = this.GetWindowBorderOwnerElement(windowElem);
34601  var height = borderOwner == windowElem ? actualHeight : actualHeight - (borderOwner ? ASPx.GetTopBottomBordersAndPaddingsSummaryValue(borderOwner) : 0);
34602  height -= this.GetHeaderFooterHeight(index);
34603  if(height > 0)
34604   contentWrapper.style.height = height + "px";
34605 },
34606 SetWindowScrollDivSize: function(scrollDiv, index, dimension) {
34607  var windowClientTable = this.GetWindowClientTable(index);
34608  var headerElement = this.GetWindowHeaderElement(index);
34609  var height = windowClientTable.offsetHeight;
34610  if(headerElement)
34611   height -= headerElement.offsetHeight;
34612  height -= this.GetWindowFooterHeightLite(index);
34613  if(dimension == 'height' || dimension == 'both')
34614   ASPx.SetOffsetHeight(scrollDiv, height);
34615  if(dimension == 'width' || dimension == 'both') {
34616   var width = windowClientTable.offsetWidth;
34617   var contentElement = this.GetWindowContentElement(index);
34618   width -= this.getLeftRightBordersAndPaddingsSummaryValue(scrollDiv) + ASPx.GetHorizontalBordersWidth(contentElement);
34619   if(width > -1)
34620    scrollDiv.style.width = width + "px";
34621  }
34622  scrollDiv.style.marginRight = "0px";
34623 },
34624 AdjustIFrameHeight: function(index, iframe) {
34625  ASPxClientPopupControlBase.prototype.AdjustIFrameHeight.call(this, index, iframe);
34626  if(!this.InternalIsWindowVisible(index) || !iframe || this.GetAdaptiveModalMode(index)) return;
34627  this.SetIframeAdjustingPostponed(index, false);
34628  var content = this.GetContentContainer(index);
34629  var contentWrapper = this.GetWindowContentWrapperElement(index);
34630  iframe.style.verticalAlign = "text-bottom";
34631  var iframeHeight = contentWrapper.offsetHeight - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(content);
34632  if(iframeHeight >= 0)
34633   iframe.style.height = iframeHeight + "px";
34634 },
34635 OnPinButtonClick: function(index) {
34636  var value = this.GetIsPinned(index);
34637  this.SetPinCore(index, !value);
34638 },
34639 SetPinCore: function(index, value) {
34640  if(this.GetIsPinned(index) != value) {
34641   this.SetIsPinned(index, value);
34642   this.HoldPosition(index, value);
34643   this.UpdateWindowsStateCookie();
34644   this.OnPinned(index, value);
34645  }
34646 },
34647 OnPinned: function(index, pinned) {
34648  this.RaisePinnedChanged(index, pinned);
34649 },
34650 HoldPosition: function(index, hold, element) {
34651  if(hold) {
34652   element = element || this.GetWindowElement(index);
34653   if(!element) return;
34654   var x = ASPx.GetAbsoluteX(element);
34655   var y = ASPx.GetAbsoluteY(element);
34656   scrollX = ASPx.GetDocumentScrollLeft();
34657   scrollY = ASPx.GetDocumentScrollTop();
34658   this.SetPinPosX(index, x - scrollX);
34659   this.SetPinPosY(index, y - scrollY);
34660  }
34661  this.UpdateHeaderButtonSelected(index, "GetWindowPinButton", hold);
34662  this.CheckHeaderCursor(index);
34663 },
34664 GetBodyWidth: function() {
34665  return aspxGetPopupControlCollection().GetSavedBodyWidth();
34666 },
34667 GetBodyHeight: function() {
34668  return aspxGetPopupControlCollection().GetSavedBodyHeight();
34669 },
34670 GetIsOutFromViewPort: function(index) {
34671  var element = this.GetWindowElement(index);
34672  if(!element) return false;
34673  var pinXTarget = this.GetPinPosX(index);
34674  var pinYTarget = this.GetPinPosY(index);
34675  var popupWindowWidth = this.GetClientWindowWidth(index);
34676  var docClientWidth = ASPx.GetDocumentClientWidth();
34677  var rightOutOffset = (pinXTarget + popupWindowWidth) - docClientWidth;
34678  var popupWindowHeight = this.GetClientWindowHeight(index);
34679  var docClientHeight = ASPx.GetDocumentClientHeight();
34680  var bottomOutOffset = (pinYTarget + popupWindowHeight) - docClientHeight;
34681  return (rightOutOffset > 0 || bottomOutOffset > 0);
34682 },
34683 needToHidePinnedOutFromViewPort: function(index) {
34684  return this.GetIsPinned(index) && this.GetIsOutFromViewPort(index);
34685 },
34686 AdjustPinPositionWhileScroll: function(index) {
34687  var element = this.GetWindowElement(index);
34688  if(!element) return;
34689  var x = ASPx.GetAbsoluteX(element);
34690  var y = ASPx.GetAbsoluteY(element);
34691  var scrollX = ASPx.GetDocumentScrollLeft();
34692  var scrollY = ASPx.GetDocumentScrollTop();
34693  var pinX = x - scrollX;
34694  var pinY = y - scrollY;
34695  var pinXTarget = this.GetPinPosX(index);
34696  var pinYTarget = this.GetPinPosY(index);
34697  if((pinX != pinXTarget) || (pinY != pinYTarget)) {
34698   this.lockScroll++;
34699   var xNew = pinXTarget + scrollX;
34700   var yNew = pinYTarget + scrollY;
34701   var bodyWidth = this.GetBodyWidth();
34702   var bodyHeight = this.GetBodyHeight();
34703   var popupWindowWidth = this.GetClientWindowWidth(index);
34704   var docClientWidth = ASPx.GetDocumentClientWidth();
34705   var rightOutOffset = (pinXTarget + popupWindowWidth) - docClientWidth;
34706   var popupWindowHeight = this.GetClientWindowHeight(index);
34707   var docClientHeight = ASPx.GetDocumentClientHeight();
34708   var bottomOutOffset = (pinYTarget + popupWindowHeight) - docClientHeight;
34709   var cancelScrollX = false;
34710   if(xNew + (popupWindowWidth - rightOutOffset) > bodyWidth) {
34711    xNew -= (xNew + (popupWindowWidth - rightOutOffset) - bodyWidth);
34712    cancelScrollX = true;
34713   }
34714   var cancelScrollY = false;
34715   if(yNew + (popupWindowHeight - bottomOutOffset) > bodyHeight) {
34716    yNew -= (yNew + (popupWindowHeight - bottomOutOffset) - bodyHeight);
34717    cancelScrollY = true;
34718   }
34719   xNew = ASPx.PrepareClientPosForElement(xNew, element, true);
34720   yNew = ASPx.PrepareClientPosForElement(yNew, element, false);
34721   this.SetWindowPos(index, element, xNew, yNew);
34722   if(cancelScrollX) {
34723    var scrollLeftMax = bodyWidth - ASPx.GetDocumentClientWidth();
34724    if((rightOutOffset > 0) && (scrollX > scrollLeftMax)) {
34725     this.lockScroll++;
34726     ASPx.SetDocumentScrollLeft(scrollLeftMax);
34727     this.lockScroll--;
34728    }
34729   }
34730   if(cancelScrollY) {
34731    var scrollTopMax = bodyHeight - ASPx.GetDocumentClientHeight();
34732    if((bottomOutOffset > 0) && (scrollY > scrollTopMax)) {
34733     this.lockScroll++;
34734     ASPx.SetDocumentScrollTop(scrollTopMax);
34735     this.lockScroll--;
34736    }
34737   }
34738   this.lockScroll--;
34739  }
34740 },
34741 OnCollapseButtonClick: function(index) {
34742  this.SetCollapsedCore(index, !this.GetIsCollapsed(index));
34743 },
34744 SetCollapsedCore: function(index, minimization) {
34745  if(this.GetIsCollapsed(index) == minimization) return;
34746  this.DoCollapse(index, minimization);
34747  this.OnCollapsed(index, minimization);
34748 },
34749 DoCollapse: function(index, minimization) {
34750  if(this.GetIsCollapsed(index) == minimization) return;
34751  this.StartCollapse();
34752  if(minimization) {
34753   var cachedWidth = this.GetClientWindowWidth(index);
34754   var cachedHeight = this.GetClientWindowHeight(index);
34755   var shouldUpdateRestoredSize = this.ShoulUpdatedRestoredWindowSizeOnCollapse(index);
34756   var width = this.GetMainWindowWidth(index, !shouldUpdateRestoredSize);
34757   var height = this.GetMainWindowHeight(index, !shouldUpdateRestoredSize);
34758   this.SetWindowSizeByIndex(index, width, 0);
34759   this.SetWindowContentVisible(index, false);
34760   this.SetWindowFooterVisible(index, false);
34761   this.ResetWindowHeight(index);
34762   this.SetIsCollapsed(index, minimization);
34763   this.SetWindowCachedSize(index, cachedWidth, cachedHeight);
34764   if(shouldUpdateRestoredSize)
34765    this.UpdateRestoredWindowSize(index, width, height);
34766  }
34767  else {
34768   if(this.MaximizationExecuting()) {
34769    var element = this.GetWindowElement(index);
34770    if(element) {
34771     element.style.left = ASPx.GetDocumentScrollLeft();
34772     element.style.top = ASPx.GetDocumentScrollTop();
34773    }
34774   }
34775   this.SetWindowContentVisible(index, true);
34776   this.SetWindowFooterVisible(index, true);
34777   this.SetIsCollapsed(index, minimization);
34778   if(this.GetIsMaximized(index)) {
34779    var documentClientWidth = ASPx.PopupUtils.GetDocumentClientWidthForPopup();
34780    var documentClientHeight = ASPx.PopupUtils.GetDocumentClientHeightForPopup();
34781    this.SetWindowSizeByIndex(index, documentClientWidth, documentClientHeight);
34782   } else {
34783    var restoredWindowData = this.GetRestoredWindowData(index);
34784    this.SetWindowSizeByIndex(index, restoredWindowData.width, restoredWindowData.height);
34785   }
34786   ASPx.GetControlCollection().AdjustControls(this.GetWindowElement(index));
34787  }
34788  this.UpdateHeaderButtonSelected(index, "GetWindowCollapseButton", minimization);
34789  this.EndCollapse();
34790  this.UpdateWindowsStateCookie();
34791 },
34792 ResetWindowHeight: function(index) {
34793  var element = this.GetWindowElement(index);
34794  if(element)
34795   element.style.height = "";
34796 },
34797 ShoulUpdatedRestoredWindowSizeOnCollapse: function(index) {
34798  return !this.GetIsMaximized(index);
34799 },
34800 OnCollapsed: function(index, value) {
34801  if(value)
34802   this.RaiseCollapsed(index);
34803  else
34804   this.RaiseExpanded(index);
34805  this.RaiseAfterResizing(index);
34806 },
34807 OnMaximizeButtonClick: function(index) {
34808  this.SetMaximizedCore(index, !this.GetIsMaximized(index));
34809 },
34810 SetMaximizedCore: function(index, maximization) {
34811  if(this.GetIsMaximized(index) == maximization) return;
34812  this.DoMaximize(index, maximization);
34813  this.OnMaximizedChanged(index, maximization);
34814 },
34815 GetMaximizedPosition: function(element, isX) {
34816  if(ASPx.Browser.WebKitTouchUI)
34817   return ASPx.PrepareClientPosForElement(0, element, isX);
34818  return ASPx.PrepareClientPosForElement(isX ? ASPx.GetDocumentScrollLeft() : ASPx.GetDocumentScrollTop(), element, isX);
34819 },
34820 PerformMaximaze: function (index, maximization, element) {
34821  if (this.hideBodyScrollWhenMaximized)
34822   ASPx.PopupUtils.BodyScrollHelper.HideBodyScroll(element.id);
34823  if (this.GetIsCollapsed(index))
34824   this.DoCollapse(index, false);
34825  var cachedWidth = this.GetClientWindowWidth(index);
34826  var cachedHeight = this.GetClientWindowHeight(index);
34827  var restoredWindowData = this.GetInitRestoredWindowData(index);
34828  var documentClientWidth = ASPx.PopupUtils.GetDocumentClientWidthForPopup();
34829  var documentClientHeight = ASPx.PopupUtils.GetDocumentClientHeightForPopup();
34830  var windowClientTable = this.GetWindowClientTable(index);
34831  var windowClientTableParent = windowClientTable.parentNode;
34832  childStyle = ASPx.GetCurrentStyle(windowClientTableParent);
34833  var left = this.GetMaximizedPosition(element, true);
34834  var top = this.GetMaximizedPosition(element, false);
34835  this.SetWindowPos(index, element, left, top);
34836  this.SetWindowSizeByIndex(index, documentClientWidth, documentClientHeight);
34837  this.SetWindowCachedSize(index, cachedWidth, cachedHeight);
34838  this.SetRestoredWindowData(index, restoredWindowData);
34839  this.SetIsMaximized(index, maximization);
34840 },
34841 PerformMinimize: function (index, maximization, element) {
34842  var restoredWindowData = this.GetRestoredWindowData(index);
34843  var width = restoredWindowData.width || this.GetMainWindowWidth(index);
34844  var height = restoredWindowData.height || this.GetMainWindowHeight(index);
34845  this.SetIsMaximized(index, maximization);
34846  var left = ASPx.PrepareClientPosForElement(restoredWindowData.left, element, true);
34847  var top = ASPx.PrepareClientPosForElement(restoredWindowData.top, element, false);
34848  this.SetWindowPos(index, element, left, top);
34849  this.SetWindowSizeByIndex(index, width, height);
34850  if (this.GetIsCollapsed(index)) {
34851   this.SetIsCollapsed(index, false);
34852   this.UpdateRestoredWindowSizeLock();
34853   this.DoCollapse(index, true);
34854   this.UpdateRestoredWindowSizeUnlock();
34855  }
34856  if (this.hideBodyScrollWhenMaximized)
34857   ASPx.PopupUtils.BodyScrollHelper.RestoreBodyScroll(element.id);
34858 },
34859 DoMaximize: function(index, maximization) {
34860  if(this.GetIsMaximized(index) == maximization) return;
34861  var element = this.GetWindowElement(index);
34862  if(!element) return;
34863  this.StartMaximization();
34864  if(maximization)
34865   this.PerformMaximaze(index, maximization, element);
34866  else
34867   this.PerformMinimize(index, maximization, element);
34868  if(this.GetIsPinned(index))
34869   this.HoldPosition(index, true, element);
34870  this.UpdateHeaderButtonSelected(index, "GetWindowMaximizeButton", maximization);
34871  this.EndMaximization();
34872  this.UpdateWindowsStateCookie();
34873  this.CheckHeaderCursor(index);
34874 },
34875 OnMaximizedChanged: function(index, value) {
34876  if(value)
34877   this.RaiseMaximized(index);
34878  else
34879   this.RaiseRestoredAfterMaximized(index);
34880  this.RaiseAfterResizing(index);
34881 },
34882 GetInitRestoredWindowData: function(index) {
34883  var restoredWindowData = this.GetRestoredWindowData(index);
34884  restoredWindowData.left = this.GetCurrentLeft(index);
34885  restoredWindowData.top = this.GetCurrentTop(index);
34886  restoredWindowData.width = this.GetMainWindowWidth(index);
34887  restoredWindowData.height = this.GetMainWindowHeight(index);
34888  return restoredWindowData;
34889 },
34890 getDocumentDimensions: function(index) {
34891  var documentClientWidth = ASPx.PopupUtils.GetDocumentClientWidthForPopup(),
34892   documentClientHeight = ASPx.PopupUtils.GetDocumentClientHeightForPopup();
34893  return { width: documentClientWidth, height: documentClientHeight };
34894 }, 
34895 UpdateMaximizedWindowSizeOnResize: function(index) {
34896  this.StartUpdateMaximizedWindowSizeOnResize();
34897  var dimensions = this.getDocumentDimensions(index);
34898  if(this.GetIsCollapsed(index)) dimensions.height = 0;
34899  this.SetWindowSizeByIndex(index, dimensions.width, dimensions.height);
34900  if(this.GetIsCollapsed(index)) {
34901   this.CorrectCollapsedSize(index);
34902  }
34903  window.setTimeout(function() { this.SetMaximizedWindowSizeAfterOnResize(index); }.aspxBind(this), 0);
34904  this.EndUpdateMaximizedWindowSizeOnResize();
34905 },
34906 SetMaximizedWindowSizeAfterOnResize: function(index) {
34907  this.StartUpdateMaximizedWindowSizeOnResize();
34908  var dimensions = this.getDocumentDimensions(index);
34909  windowWidthCurrent = this.GetMainWindowWidth(index, true);
34910  windowHeightCurrent = this.GetMainWindowHeight(index, true);
34911  if(this.GetIsCollapsed(index))
34912   dimensions.height = 0;
34913  if(dimensions.width != windowWidthCurrent || dimensions.height != windowHeightCurrent) {
34914   this.SetWindowSizeByIndex(index, dimensions.width, dimensions.height);
34915   if(this.GetIsCollapsed(index)) {
34916    this.CorrectCollapsedSize(index);
34917   }
34918  }
34919  this.EndUpdateMaximizedWindowSizeOnResize();
34920 },
34921 CorrectCollapsedSize: function(index) {
34922  var contentWrapper = this.GetWindowContentWrapperElement(index);
34923  if(contentWrapper && ASPx.IsElementVisible(contentWrapper))
34924   contentWrapper.style.display = 'none';
34925 },
34926 UpdateHeaderButtonSelected: function(index, methodGetWindowButton, flagSelected) {
34927  if(typeof (ASPx.GetStateController) != "undefined") {
34928   button = this[methodGetWindowButton](index);
34929   var method = flagSelected ? "SelectElementBySrcElement" : "DeselectElementBySrcElement";
34930   ASPx.GetStateController()[method](button);
34931  }
34932 },
34933 CheckHeaderCursor: function(index) {
34934  if(!this.allowDragging) return;
34935  var dragElement = this.GetDragElement(index);
34936  if(!dragElement) return;
34937  var styleCursor = dragElement.style.cursor;
34938  var isPinned = this.GetIsPinned(index);
34939  var isMaximized = this.GetIsMaximized(index);
34940  if((isPinned || isMaximized) && styleCursor != "default")
34941   dragElement.style.cursor = "default";
34942  else if(!isPinned && !isMaximized && styleCursor != "move")
34943   dragElement.style.cursor = "move";
34944 },
34945 StartCollapse: function() {
34946  this.collapseExecutingLockCount++;
34947 },
34948 EndCollapse: function() {
34949  this.collapseExecutingLockCount--;
34950 },
34951 CollapseExecuting: function() {
34952  return this.collapseExecutingLockCount > 0;
34953 },
34954 StartMaximization: function() {
34955  this.maximizationExecutingLockCount++;
34956 },
34957 EndMaximization: function() {
34958  this.maximizationExecutingLockCount--;
34959 },
34960 MaximizationExecuting: function() {
34961  return this.maximizationExecutingLockCount > 0;
34962 },
34963 StartUpdateMaximizedWindowSizeOnResize: function() {
34964  this.browserResizingForMaxWindowLockCount++;
34965 },
34966 EndUpdateMaximizedWindowSizeOnResize: function() {
34967  this.browserResizingForMaxWindowLockCount--;
34968 },
34969 ResizingForMaxWindowLocked: function() {
34970  return this.browserResizingForMaxWindowLockCount > 0;
34971 },
34972 UpdateRestoredWindowSizeLock: function() {
34973  this.updateRestoredWindowSizeLockCount++;
34974 },
34975 UpdateRestoredWindowSizeUnlock: function() {
34976  this.updateRestoredWindowSizeLockCount--;
34977 },
34978 UpdateRestoredWindowSizeLocked: function() {
34979  return this.updateRestoredWindowSizeLockCount > 0;
34980 },
34981 UpdateRestoredWindowSize: function(index, width, height) {
34982  if(!this.UpdateRestoredWindowSizeLocked()) {
34983   restoredMinWindowData = this.GetRestoredWindowData(index);
34984   restoredMinWindowData.width = width;
34985   restoredMinWindowData.height = height;
34986   this.SetRestoredWindowData(index, restoredMinWindowData);
34987  }
34988 },
34989 GetWindowsState: function() {
34990  var state = ASPxClientPopupControlBase.prototype.GetWindowsState.call(this);
34991  for(var i = 0; i < this.GetWindowCountCore() ; i++) {
34992   state += this.GetWindowState(i);
34993   if(i < this.GetWindowCountCore() - 1) state += ";";
34994  }
34995  return state;
34996 },
34997 CreateWindows: function(windowsNames) {
34998  for(var i = 0; i < windowsNames.length; i++) {
34999   var window = new ASPxClientPopupWindow(this, i, windowsNames[i]);
35000   this.windows.push(window);
35001  }
35002 },
35003 RaiseCloseButtonClick: function(index) {
35004  ASPxClientPopupControlBase.prototype.RaiseCloseButtonClick.call(this, index);
35005 },
35006 RaisePinnedChanged: function(index, pinned) {
35007  var window = index < 0 ? null : this.GetWindow(index);
35008  if(!this.PinnedChanged.IsEmpty()) {
35009   var args = new ASPxClientPopupWindowPinnedChangedEventArgs(window, pinned);
35010   this.PinnedChanged.FireEvent(this, args);
35011  }
35012 },
35013 RaiseCollapsed: function(index) {
35014  this.RaiseResize(index, ASPxClientPopupControlResizeState.Collapsed);
35015 },
35016 RaiseExpanded: function(index) {
35017  this.RaiseResize(index, ASPxClientPopupControlResizeState.Expanded);
35018 },
35019 RaiseMaximized: function(index) {
35020  this.RaiseResize(index, ASPxClientPopupControlResizeState.Maximized);
35021 },
35022 RaiseRestoredAfterMaximized: function(index) {
35023  this.RaiseResize(index, ASPxClientPopupControlResizeState.RestoredAfterMaximized);
35024 },
35025 GetContentWidth: function() {
35026  return this.GetWindowContentWidth(null);
35027 },
35028 GetContentHeight: function() {
35029  return this.GetWindowContentHeight(null);
35030 },
35031 SetSize: function(width, height) {
35032  ASPxClientPopupControlBase.prototype.SetSize.call(this, width, height);
35033 },
35034 GetWindowDimension: function(window, isWidth, forceFromCache) {
35035  var index = (window != null) ? window.index : -1;
35036  return this.GetWindowDimensionByIndex(index, isWidth, forceFromCache);
35037 },
35038 GetWindowContentDimension: function(window, isWidth) {
35039  var index = (window != null) ? window.index : -1,
35040   contentElem = this.GetWindowContentElement(index),
35041   dimensionHolder = contentElem.parentNode,
35042   paddingsHolder = contentElem;
35043  return isWidth ?
35044  (dimensionHolder.offsetWidth - this.getLeftRightBordersAndPaddingsSummaryValue(paddingsHolder)) :
35045  (dimensionHolder.offsetHeight - this.getTopBottomBordersAndPaddingsSummaryValue(paddingsHolder));
35046 },
35047 GetWindowContentWidth: function(window) {
35048  return this.GetWindowContentDimension(window, true);
35049 },
35050 GetWindowContentHeight: function(window) {
35051  return this.GetWindowContentDimension(window, false);
35052 },
35053 GetWindowHeight: function(window) {
35054  return this.GetWindowDimension(window, false);
35055 },
35056 GetWindowWidth: function(window) {
35057  return this.GetWindowDimension(window, true);
35058 },
35059 SetWindowSize: function(window, width, height) {
35060  return ASPxClientPopupControlBase.prototype.SetWindowSize.call(this, window, width, height);
35061 },
35062 GetContentHTML: function() {
35063  return this.GetContentHtml();
35064 },
35065 SetContentHTML: function(html) {
35066  this.SetContentHtml(html);
35067 },
35068 SetWindowPopupElementID: function(window, popupElementId) {
35069  var index = (window != null) ? window.index : -1;
35070  this.SetPopupElementIDByIndex(index, popupElementId);
35071 },
35072 SetPopupElementID: function(popupElementId) {
35073  this.SetPopupElementIDByIndex(-1, popupElementId);
35074 },
35075 GetCurrentPopupElementIndex: function() {
35076  return this.GetWindowCurrentPopupElementIndexByWindowIndex(-1);
35077 },
35078 GetWindowCurrentPopupElementIndex: function(window) {
35079  var index = (window != null) ? window.index : -1;
35080  return this.GetWindowCurrentPopupElementIndexByWindowIndex(index);
35081 },
35082 GetCurrentPopupElement: function() {
35083  return this.GetWindowCurrentPopupElementByIndex(-1);
35084 },
35085 GetWindowCurrentPopupElement: function(window) {
35086  var index = (window != null) ? window.index : -1;
35087  return this.GetWindowCurrentPopupElementByIndex(index);
35088 },
35089 ShowAtPos: function(x, y) {
35090  this.ShowWindowAtPos(null, Math.round(x), Math.round(y));
35091 },
35092 BringToFront: function() {
35093  this.BringWindowToFront(null);
35094 },
35095 IsWindowVisible: function(window) {
35096  return ASPxClientPopupControlBase.prototype.IsWindowVisible.call(this, window);
35097 },
35098 GetWindow: function(index) {
35099  return ASPxClientPopupControlBase.prototype.GetWindow.call(this, index);
35100 },
35101 GetWindowByName: function(name) {
35102  for(var i = 0; i < this.windows.length; i++)
35103   if(this.windows[i].name == name) return this.windows[i];
35104  return null;
35105 },
35106 GetWindowCount: function() {
35107  return this.GetWindowCountCore();
35108 },
35109 ShowWindow: function(window, popupElementIndex) {
35110  var index = (window != null) ? window.index : -1;
35111  this.ShowWindowByIndex(index, popupElementIndex);
35112 },
35113 ShowWindowAtElement: function(window, htmlElement) {
35114  var index = (window != null) ? window.index : -1;
35115  this.ShowWindowAtElementByIndex(index, htmlElement);
35116 },
35117 ShowWindowAtElementByID: function(window, id) {
35118  var htmlElement = document.getElementById(id);
35119  this.ShowWindowAtElement(window, htmlElement);
35120 },
35121 ShowWindowAtPos: function(window, x, y) {
35122  if(!this.isInitialized)
35123   return;
35124  var index = (window != null) ? window.index : -1;
35125  this.DoShowWindowCore(index, x, y, -1, false, true);
35126 },
35127 BringWindowToFront: function(window) {
35128  var index = (window != null) ? window.index : -1;
35129  var element = this.GetWindowElement(index);
35130  aspxGetPopupControlCollection().ActivateWindowElement(element, undefined, this.GetPopupType(), this.GetDefaultZIndexFromServer(), this.GetPopupControlZIndex());
35131 },
35132 HideWindow: function(window) {
35133  ASPxClientPopupControlBase.prototype.HideWindow.call(this, window);
35134 },
35135 GetWindowContentHTML: function(window) {
35136  return this.GetWindowContentHtml(window);
35137 },
35138 SetWindowContentHTML: function(window, html) {
35139  this.SetWindowContentHtml(window, html);
35140 },
35141 GetWindowContentHtml: function(window) {
35142  return ASPxClientPopupControlBase.prototype.GetWindowContentHtml.call(this, window);
35143 },
35144 SetWindowContentHtml: function(window, html, useAnimation) {
35145  ASPxClientPopupControlBase.prototype.SetWindowContentHtml.call(this, window, html, useAnimation);
35146 },
35147 AfterSetWindowContentHtml: function(index, contentContainer, useAnimation) {
35148  if(this.GetAdaptiveModalMode(index))
35149   this.TryAutoUpdatePosition(index);
35150  else if(this.InternalIsWindowVisible(index))
35151   this.RecalculateWindowSize(index);
35152  ASPxClientPopupControlBase.prototype.AfterSetWindowContentHtml.call(this, index, contentContainer, useAnimation);
35153  this.UpdateScrollbar(index);
35154 },
35155 UpdateAlignment: function(index) {
35156  if(this.GetIsDragged(index)) return;
35157  var element = this.GetWindowElement(index),
35158   wrapperStyle = getComputedStyle(this.GetModalWrapperElement(index)),
35159   top = ASPxClientPopupControl.AligmentCalculator.CalculateTopMargin(this.modalVerticalAlign, element.offsetHeight, this.GetDefaultVerticalOffset()),
35160   left = ASPxClientPopupControl.AligmentCalculator.CalculateLeftRightMargin(this.modalHorizontalAlign, ModalAlign.WindowLeft, wrapperStyle.paddingLeft),
35161   right = ASPxClientPopupControl.AligmentCalculator.CalculateLeftRightMargin(this.modalHorizontalAlign, ModalAlign.WindowRight, wrapperStyle.paddingRight);
35162  ASPx.SetStyles(element, {
35163   marginTop: top,
35164   marginLeft: left,
35165   marginRight: right
35166  });
35167 },
35168 GetOverlayElement: function(index) {
35169  return this.GetWindowModalElement(index);
35170 },
35171 GetModalWrapperElement: function(index) {
35172  if(!this.adaptivityEnabled) return null;
35173  var windowElement = this.GetWindowElement(index);
35174  return !!windowElement ? windowElement.parentNode : null;
35175 },
35176 GetWindowHeightWithoutContent: function(index) {
35177  var element = this.GetWindowElement(index),
35178   borderOwner = this.GetWindowBorderOwnerElement(element);
35179  return this.GetHeaderFooterHeightCore(index) + ASPx.GetVerticalBordersWidth(borderOwner);
35180 },
35181 StretchVertically: function() {
35182  this.StretchVerticallyByIndex(-1, true);
35183 },
35184 WindowStretchVertically: function(window) {
35185  var index = (window != null) ? window.index : -1;
35186  this.StretchVerticallyByIndex(index, true);
35187 },
35188 StretchVerticallyByIndex: function(index, value) {
35189  if(this.GetStretchVerticallyByIndex(index) !== value) {
35190   this.SetPropertyValue(index, "stretchVertically", value);
35191   var oldMinHeight = !!this.GetModalMinHeight(index) ? this.GetModalMinHeight(index) : 0;
35192   this.SetPropertyValue(index, "modalMinHeight", value ? "100vh" : this.minHeightBackup);
35193   this.minHeightBackup = oldMinHeight;
35194   this.UpdateHeightDimensions(index);
35195  }
35196 },
35197 SetAdaptiveMinWidth: function(minWidth) {
35198  this.SetAdaptiveMinWidthByIndex(-1, minWidth);
35199 },
35200 SetWindowAdaptiveMinWidth: function(window, minWidth) {
35201  var index = (window != null) ? window.index : -1;
35202  this.SetAdaptiveMinWidthByIndex(index, minWidth);
35203 },
35204 SetAdaptiveMaxWidth: function(maxWidth) {
35205  this.SetAdaptiveMaxWidthByIndex(-1, maxWidth);
35206 },
35207 SetWindowAdaptiveMaxWidth: function(window, maxWidth) {
35208  var index = (window != null) ? window.index : -1;
35209  this.SetAdaptiveMaxWidthByIndex(index, maxWidth);
35210 },
35211 SetAdaptiveMinHeight: function(minHeight) {
35212  this.SetAdaptiveMinHeightByIndex(-1, minHeight);
35213 },
35214 SetWindowAdaptiveMinHeight: function(window, minHeight) {
35215  var index = (window != null) ? window.index : -1;
35216  this.SetAdaptiveMinHeightByIndex(index, minHeight);
35217 },
35218 SetAdaptiveMaxHeight: function(maxHeight) {
35219  this.SetAdaptiveMaxHeightByIndex(-1, maxHeight);
35220 },
35221 SetWindowAdaptiveMaxHeight: function(window, maxHeight) {
35222  var index = (window != null) ? window.index : -1;
35223  this.SetAdaptiveMaxHeightByIndex(index, maxHeight);
35224 },
35225 SetAdaptiveHeightDimension: function(index, propertyName, value) {
35226  value = this.ConvertDimensionValueToString(value);
35227  value = value.indexOf("%") > -1 ? value.replace("%", "vh") : value;
35228  var margins = 0;
35229  if(this.stretchVertically && propertyName === "minHeight")
35230   margins = ASPx.GetTopBottomMargins(this.GetWindowElement(index));
35231  var contentElement = this.GetWindowContentElement(index);  
35232  var iframe = this.GetWindowContentIFrameElement(index);
35233  var additionalHeight = this.GetWindowHeightWithoutContent(index) + margins;
35234  var adaptiveHeight = "calc(" + value + " - " + additionalHeight + "px)";
35235  contentElement.style[propertyName] = adaptiveHeight;
35236  if (contentElement.style.minHeight) {
35237   if (iframe || this.HasAnyScrollBars(index))
35238    contentElement.style.height = "1px";
35239   else if (propertyName === "minHeight")
35240    this.SetContentWrapperAdaptiveHeight(index, adaptiveHeight);
35241  }
35242  if(iframe) {
35243   iframe.style.verticalAlign = "text-bottom";
35244   iframe.style.height = "100%";
35245  }
35246 },
35247 ConvertDimensionValueToString: function(value) {
35248  if(typeof value === "number")
35249   return value + "px";
35250  if(typeof value === "string")
35251   return value;
35252 },
35253 CanBeClosedByClickOnElement: function(index, srcElement, posX, id) {
35254  return ASPxClientPopupControlBase.prototype.CanBeClosedByClickOnElement.call(this, index, srcElement, posX, id) &&
35255   (!this.GetAdaptiveModalMode(index) || srcElement != this.GetModalWrapperElement(index) || posX < srcElement.offsetWidth - ASPx.GetVerticalScrollBarWidth());
35256 },
35257 SetWindowDisplay: function(index, value) {
35258  ASPxClientPopupControlBase.prototype.SetWindowDisplay.call(this, index, value);
35259  if(this.adaptivityEnabled) {
35260   var wrapper = this.GetModalWrapperElement(index);
35261   ASPx.SetElementDisplay(wrapper, value);
35262  }
35263 },
35264 HaveSpecialDivForAnimation: function() {
35265  return ASPxClientPopupControlBase.prototype.HaveSpecialDivForAnimation.call(this) || this.adaptivityEnabled;
35266 },
35267 WindowIsModal: function(index) {
35268  return ASPxClientPopupControlBase.prototype.WindowIsModal.call(this, index) || this.GetAdaptiveModalMode(index);
35269 },
35270 RecalculateWindowSize: function(index) {
35271  var window = this.GetWindowElement(index);
35272  var displayAfterSetSize = window.style.display;
35273  this.SetClientWindowSizeCoreLite(index, this.GetWindowWidthInternal(index), this.GetWindowHeightInternal(index), this.GetIsCollapsed(index));
35274  window.style.display = displayAfterSetSize;
35275  if(this.HasAnyScrollBars(index))
35276   this.NormalizeWindowSize(index, this.GetIsMaximized(index));
35277 },
35278 GetWindowContentIFrame: function(window) {
35279  return ASPxClientPopupControlBase.prototype.GetWindowContentIFrame.call(this, window);
35280 },
35281 GetWindowContentUrl: function(window) {
35282  return ASPxClientPopupControlBase.prototype.GetWindowContentUrl.call(this, window);
35283 },
35284 SetWindowContentUrl: function(window, url) {
35285  ASPxClientPopupControlBase.prototype.SetWindowContentUrl.call(this, window, url);
35286 },
35287 RefreshDimensionsAfterCreateIframe: function(index) {
35288  if(ASPx.IsElementVisible(this.GetWindowElement(index), true)) {
35289   var windowWidth = this.GetWindowDimensionByIndex(index, true, false);
35290   var windowHeight = this.GetWindowDimensionByIndex(index, false, false);
35291   this.SetClientWindowSizeCoreLite(index, windowWidth, windowHeight);
35292  }
35293 },
35294 GetPinned: function() {
35295  return this.GetIsPinned(-1);
35296 },
35297 SetPinned: function(value) {
35298  this.SetPinCore(-1, value);
35299 },
35300 GetWindowPinned: function(window) {
35301  var index = (window != null) ? window.index : -1;
35302  return this.GetIsPinned(index);
35303 },
35304 SetWindowPinned: function(window, value) {
35305  var index = (window != null) ? window.index : -1;
35306  this.SetPinCore(index, value);
35307 },
35308 GetMaximized: function() {
35309  return this.GetIsMaximized(-1);
35310 },
35311 SetMaximized: function(value) {
35312  this.SetMaximizedCore(-1, value);
35313 },
35314 GetWindowMaximized: function(window) {
35315  var index = (window != null) ? window.index : -1;
35316  return this.GetIsMaximized(index);
35317 },
35318 SetWindowMaximized: function(window, value) {
35319  var index = (window != null) ? window.index : -1;
35320  this.SetMaximizedCore(index, value);
35321 },
35322 GetCollapsed: function() {
35323  return this.GetIsCollapsed(-1);
35324 },
35325 SetCollapsed: function(value) {
35326  this.SetCollapsedCore(-1, value);
35327 },
35328 GetWindowCollapsed: function(window) {
35329  var index = (window != null) ? window.index : -1;
35330  return this.GetIsCollapsed(index);
35331 },
35332 SetWindowCollapsed: function(window, value) {
35333  var index = (window != null) ? window.index : -1;
35334  this.SetCollapsedCore(index, value);
35335 },
35336 RefreshWindowContentUrl: function(window) {
35337  ASPxClientPopupControlBase.prototype.RefreshWindowContentUrl.call(this, window);
35338 },
35339 SetWindowContentVisible: function(index, visible) {
35340  var contentElement = this.GetWindowContentWrapperElement(index);
35341  if(contentElement)
35342   this.SetWindowPartVisibleCore(contentElement, "DXPopupWindowContentDisplay", visible);
35343 },
35344 SetWindowFooterVisible: function(index, visible) {
35345  var footerElement = this.GetWindowFooterElement(index);
35346  if(footerElement)
35347   this.SetWindowPartVisibleCore(footerElement, "DXPopupWindowFooterDisplay", visible);
35348 },
35349 SetWindowPartVisibleCore: function(partElement, displayCacheName, visible) {
35350  var nothingChanged = ASPx.IsElementVisible(partElement) && visible;
35351  if(nothingChanged) return;
35352  if(!(ASPx.IsExists(partElement[displayCacheName])))
35353   partElement[displayCacheName] = partElement.style.display;
35354  partElement.style.display = visible ? partElement[displayCacheName] : 'none';
35355 },
35356 UpdatePosition: function() {
35357  this.UpdatePositionAtElement(this.GetPopupElement(-1, this.GetLastShownPopupElementIndex(-1)));
35358 },
35359 UpdatePositionAtElement: function(popupElement) {
35360  ASPxClientPopupControlBase.prototype.UpdatePositionAtElement.call(this, popupElement);
35361 },
35362 UpdateWindowPosition: function(window) {
35363  var index = (window != null) ? window.index : -1;
35364  this.UpdateWindowPositionAtElement(window, this.GetPopupElement(index, this.GetLastShownPopupElementIndex(index)));
35365 },
35366 UpdateWindowPositionAtElement: function(window, popupElement) {
35367  ASPxClientPopupControlBase.prototype.UpdateWindowPositionAtElement.call(this, window, popupElement);
35368 },
35369 UpdateWindowPositionInternal: function(index, popupElement) {
35370  if(this.GetAdaptiveModalMode(index)) {
35371   this.TryAutoUpdatePosition(index);
35372   return;
35373  }
35374  if(!ASPxClientPopupControlBase.prototype.UpdateWindowPositionInternal.call(this, index, popupElement))
35375   this.DoShowWindowAtPos(index, ASPx.InvalidDimension, ASPx.InvalidDimension, this.GetLastShownPopupElementIndex(index), false, false);
35376 },
35377 UpdateMode: function(index) {
35378  if(!this.adaptivityEnabled) return;
35379  var currentMode = this.GetAdaptiveModalMode(index),
35380   newMode = this.NeedAdaptiveModalMode(index);
35381  if(currentMode != newMode) {
35382   this.SetAdaptiveModalMode(index, newMode);
35383   if(!newMode && !ASPx.Browser.WebKitTouchUI) {
35384    var element = this.GetWindowElement(index);
35385    ASPx.PopupUtils.BodyScrollHelper.RestoreBodyScroll(element.id);
35386   }
35387   this.ShowWindowByIndex(-1);
35388   this.RaiseAdaptiveModeChanged();
35389  }
35390 },
35391 RaiseAdaptiveModeChanged: function() {
35392  if(!this.AdaptiveModeChanged.IsEmpty()) {
35393   var args = new ASPxClientEventArgs();
35394   this.AdaptiveModeChanged.FireEvent(this, args);
35395  }
35396 },
35397 TryAutoUpdatePosition: function(index) {
35398  this.UpdateMode(index);
35399  ASPxClientPopupControlBase.prototype.TryAutoUpdatePosition.call(this, index);
35400  if(this.GetAdaptiveModalMode(index)) {
35401   this.CorrectScrollPositionOnAndroid(index, false);
35402   this.ResetWebkitScrolling(this.GetModalWrapperElement(index), 100);
35403   this.UpdateHeightDimensions(index);
35404   this.ChangeHeaderFixed(index);
35405   this.UpdateAlignment(index);
35406   this.ChangeFooterFixed(index);
35407   if(this.GetIsDragged(index) &&
35408    ASPxClientPopupControl.WindowResizeHelper.AdjustModalOnWindowResize(this.GetWindowElement(index)))
35409    this.SetIsDragged(index, false);
35410  }
35411  if(this.GetIsMaximized(index)) {
35412   this.CorrectScrollPositionOnAndroid(index, true);
35413   this.UpdateMaximizedWindowSizeOnResize(index);
35414  }
35415 },
35416 CorrectScrollPositionOnAndroid: function(index, checkElementIsInPopup) {
35417  if(ASPx.Browser.AndroidMobilePlatform) {
35418   var activeElement = this.GetActiveElementIncludingIframes();
35419   if(activeElement && (activeElement.tagName === "INPUT" || activeElement.tagName === "TEXTAREA") &&
35420    (!checkElementIsInPopup || this.GetWindowElement(index).contains(activeElement)))
35421    window.setTimeout(function() {
35422     if(activeElement.scrollIntoViewIfNeeded)
35423      activeElement.scrollIntoViewIfNeeded();
35424    }, 100);
35425  }
35426 },
35427 GetActiveElementIncludingIframes: function(document) {
35428  document = document || window.document;
35429  if(document.body === document.activeElement || document.activeElement.tagName === "IFRAME") {
35430   var iframes = document.getElementsByTagName("iframe");
35431   for(var i = 0; i < iframes.length; i++) {
35432    var iFrameDocument = null;
35433    try {
35434     iFrameDocument = iframes[i].contentWindow.document;
35435    }
35436    catch(e) {  }
35437    if(iFrameDocument !== null) {
35438     var focused = this.GetActiveElementIncludingIframes(iframes[i].contentWindow.document);
35439     if(focused !== false) {
35440      return focused;
35441     }
35442    }
35443   }
35444  } else 
35445   return document.activeElement;
35446  return false;
35447 },
35448 OnModalWrapperScroll: function(e, index) {
35449  if(!this.GetAdaptiveModalMode(index) || this.IsWrapperScrollEventLocked()) return;
35450  this.ChangeHeaderFixed(index);
35451  this.ChangeFooterFixed(index);
35452 },
35453 OnModalWrapperTouchStart: function(e) {
35454  this.touchStartY = e.touches[0].clientY;
35455 },
35456 OnModalWrapperTouchMove: function (e, index) {
35457  if(e.touches.length > 1)
35458   return;
35459  var preventScroll = this.RequirePreventScrollForAdaptiveMode(e, index);
35460  if(preventScroll)
35461   ASPx.Evt.PreventEvent(e);
35462  this.touchStartY = e.touches[0].clientY;
35463 },
35464 RequirePreventScrollForAdaptiveMode: function(e, index) {
35465  var modalWrapper = this.GetModalWrapperElement(index),
35466   zoom = modalWrapper.offsetWidth / window.innerWidth,
35467   activeElement = document.activeElement,
35468   activeTyping = !!activeElement && (activeElement["type"] === "text" || activeElement["type"] === "textarea"); 
35469  if(zoom !== 1 || activeTyping)
35470   return false;
35471  var currentY = e.touches[0].clientY,
35472   preventScroll = currentY > this.touchStartY && modalWrapper.scrollTop === 0 ||
35473    currentY < this.touchStartY && modalWrapper.scrollTop + modalWrapper.clientHeight >= modalWrapper.scrollHeight;
35474  if(!preventScroll)
35475   return false;
35476  var targetElement = ASPx.Evt.GetEventSource(e),
35477   contentWrapper = this.GetWindowContentWrapperElement(index);
35478  while(targetElement && targetElement !== contentWrapper && targetElement.tagName !== 'BODY') {
35479   if(this.ElementHasScroll(targetElement))
35480    return false;
35481   targetElement = targetElement.parentNode;
35482  }
35483  return true;
35484 },
35485 ElementHasScroll: function(elem) {
35486  var style = window.getComputedStyle(elem);
35487  return ["overflow", "overflow-x", "overflow-y"].some(function(prop) {
35488   return ASPx.Data.ArrayContains(["scroll","auto"], style[prop]);
35489  });
35490 },
35491 GetFixedHeaderMaxBottom: function(index) {
35492  var contentWrapper = this.GetWindowContentWrapperElement(index);
35493  return ASPx.GetAbsolutePositionY(contentWrapper) + contentWrapper.offsetHeight;
35494 },
35495 GetFixedFooterMaxTop: function(index) {
35496  var header = this.GetWindowHeaderElement(index),
35497   contentWrapper = this.GetWindowContentWrapperElement(index),
35498   headerBottom = !!header ? ASPx.GetAbsolutePositionY(header) + header.offsetHeight : ASPx.GetAbsolutePositionY(contentWrapper);
35499  return window.innerHeight - headerBottom;
35500 },
35501 ChangeHeaderFixed: function(index) {
35502  if(!this.GetFixedHeader(index)) return;
35503  var element = this.GetWindowElement(index),
35504   modalWrapper = this.GetModalWrapperElement(index),
35505   isHeaderPartiallyHidden = modalWrapper.scrollTop > element.offsetTop,
35506   maxBottom = isHeaderPartiallyHidden ? this.GetFixedHeaderMaxBottom(index) : 0;
35507  this.FixateHeader(index, isHeaderPartiallyHidden, maxBottom);
35508 },
35509 ChangeFooterFixed: function(index) {
35510  if(!this.GetFixedFooter(index) || !this.GetWindowFooterElement(index)) return;
35511  var element = this.GetWindowElement(index),
35512   modalWrapper = this.GetModalWrapperElement(index),
35513   isFooterPartiallyHidden = element.offsetTop + element.offsetHeight - modalWrapper.scrollTop > window.innerHeight,
35514   maxTop = isFooterPartiallyHidden ? this.GetFixedFooterMaxTop(index) : 0;
35515  this.FixateFooter(index, isFooterPartiallyHidden, maxTop);
35516 },
35517 ChangeHeaderFooterFixed: function(index, elementToFix, isFixed, fixedClassName, offsetName, maxPos) {
35518  if(!elementToFix) return;
35519  var element = this.GetWindowElement(index),
35520   contentWrapper = this.GetWindowContentWrapperElement(index),
35521   changeClassNameFunc = isFixed ? ASPx.AddClassNameToElement : ASPx.RemoveClassNameFromElement,
35522   elementToFixHeight = elementToFix.offsetHeight;
35523  if(isFixed) {
35524   var borderOwner = this.GetWindowBorderOwnerElement(element),
35525    width = ASPx.GetClearClientWidth(borderOwner);
35526   ASPx.SetOffsetWidth(elementToFix, width);
35527   elementToFix.style[offsetName] = maxPos < elementToFixHeight ? maxPos - elementToFixHeight + "px" : "";
35528  } else
35529   elementToFix.style.width = "";
35530  contentWrapper.style["margin-" + offsetName] = isFixed ? elementToFixHeight + "px" : 0;
35531  changeClassNameFunc(elementToFix, fixedClassName);
35532 },
35533 FixateFooter: function(index, isFixed, maxTop) {
35534  this.ChangeHeaderFooterFixed(index, this.GetWindowFooterElement(index), isFixed, "dxFixedFooter", "bottom", maxTop);
35535 },
35536 FixateHeader: function(index, isFixed, maxBottom) {
35537  this.ChangeHeaderFooterFixed(index, this.GetWindowHeaderElement(index), isFixed, "dxFixedHeader", "top", maxBottom);
35538 },
35539 LockWrapperScrollEvent: function() {
35540  this.wrapperScrollEventLocked = true;
35541 },
35542 UnlockWrapperScrollEventEvent: function() {
35543  this.wrapperScrollEventLocked = false;
35544 },
35545 IsWrapperScrollEventLocked: function() {
35546  return this.wrapperScrollEventLocked;
35547 },
35548 ResetScroll: function(index) {
35549  if(!this.GetAdaptiveModalMode(index)) return;
35550  this.LockWrapperScrollEvent();
35551  this.GetModalWrapperElement(index).scrollTop = 0;
35552  this.UnlockWrapperScrollEventEvent();
35553 },
35554 AdjustModalElementBounds: function(element) {
35555  if(!ASPx.IsExistsElement(element)) return;
35556  ASPx.SetStyles(element, {
35557   left: 0,
35558   top: 0,
35559   right: 0,
35560   bottom: 0,
35561   width: "",
35562   height: ""
35563  });
35564 },
35565 RefreshPopupElementConnection: function() {
35566  ASPxClientPopupControlBase.prototype.RefreshPopupElementConnection.call(this);
35567 }
35568});
35569ASPxClientPopupControl.AligmentCalculator = (function() {
35570 function CalculateTopMargin(verticalAlign, elementHeight, defaultOffset) {
35571  if(verticalAlign === ModalAlign.WindowTop)
35572   return "";
35573  if(elementHeight < window.innerHeight) {
35574   var freeSpace = window.innerHeight - elementHeight;
35575   switch(verticalAlign) {
35576    case ModalAlign.WindowCenter:
35577     return freeSpace / 2;
35578    case ModalAlign.WindowBottom:
35579     return freeSpace - defaultOffset;
35580   }
35581  }
35582  return "";
35583 }
35584 function CalculateLeftRightMargin(horizontalAlign, forAligmenment, wrapperPadding) {
35585  if(horizontalAlign === forAligmenment) {
35586   if(ASPx.PxToInt(wrapperPadding) !== 0)
35587    return 0;
35588   return 10;
35589  }
35590  return "";
35591 }
35592 return {
35593  CalculateTopMargin: CalculateTopMargin,
35594  CalculateLeftRightMargin: CalculateLeftRightMargin
35595 };
35596})();
35597ASPxClientPopupControl.Animation = (function() {
35598 function GetVerticalDirection(verticalAlign, horizontalAlign) {
35599  switch(verticalAlign) {
35600   case ModalAlign.WindowTop:
35601    return -1;
35602   case ModalAlign.WindowCenter:
35603    if(horizontalAlign === ModalAlign.WindowCenter)
35604     return -1;
35605    return 0;
35606   case ModalAlign.WindowBottom:
35607    return 1;
35608  }
35609 }
35610 function GetHorizontalDirection(horizontalAlign) {
35611  switch(horizontalAlign) {
35612   case ModalAlign.WindowLeft:
35613    return -1;
35614   case ModalAlign.WindowCenter:
35615    return 0;
35616   case ModalAlign.WindowRight:
35617    return 1;
35618  }
35619 }
35620 function NeedFadeAnimation(horizontalAlign, verticalAlign, animationType, popupHorizontalAlign, popupVerticalAlign, adaptiveModalMode) {
35621  if(animationType === ASPxClientPopupControlBase.AnimationType.Auto) {
35622   if(adaptiveModalMode)
35623    return horizontalAlign === ModalAlign.WindowCenter && verticalAlign === ModalAlign.WindowCenter;
35624   else
35625    return popupHorizontalAlign === ASPx.PopupUtils.WindowCenterAlignIndicator && popupVerticalAlign === ASPx.PopupUtils.WindowCenterAlignIndicator;
35626  }
35627  return false;
35628 }
35629 return {
35630  GetVerticalDirection: GetVerticalDirection,
35631  GetHorizontalDirection: GetHorizontalDirection,
35632  NeedFadeAnimation: NeedFadeAnimation
35633 };
35634})();
35635ASPxClientPopupControl.WindowResizeHelper = (function() {
35636 var previousInnerWidth = 0,
35637  previousMargin = 0;
35638 function AdjustModalOnWindowResize(element) {
35639  var offsetLeft = element.offsetLeft,
35640   offsetWidth = element.offsetWidth,
35641   windowWidth = window.innerWidth,
35642   expectedLeft = windowWidth / 2 - offsetWidth / 2,
35643   toTheRightOfCenter = offsetLeft > expectedLeft,
35644   dw = windowWidth - previousInnerWidth,
35645   computedStyle = getComputedStyle(element),
35646   left = ASPx.PxToFloat(computedStyle.left),
35647   currentMargin = ASPx.PxToFloat(computedStyle.marginLeft),
35648   dm = currentMargin - previousMargin,
35649   newLeft = left - dm;
35650  if(toTheRightOfCenter)
35651   newLeft += dw;
35652  ASPx.SetStyles(element, { left: newLeft + "px" });
35653  if(Math.abs(offsetLeft - expectedLeft) <= 10 || dw < 0 && toTheRightOfCenter !== (element.offsetLeft > expectedLeft)) {
35654   ASPx.SetStyles(element, { left: "" });
35655   ASPx.Attr.RestoreStyleAttribute(element, "top");
35656   ASPx.Attr.RestoreStyleAttribute(element, "margin-top");
35657   return true;
35658  }
35659  previousMargin = currentMargin;
35660  previousInnerWidth = windowWidth;
35661  return false;
35662 }
35663 function Initialize(element) {
35664  previousInnerWidth = window.innerWidth;
35665  ASPx.Attr.ChangeStyleAttribute(element, "top", element.offsetTop + "px");
35666  ASPx.Attr.ChangeStyleAttribute(element, "margin-top", "0");
35667  previousMargin = ASPx.PxToFloat(getComputedStyle(element).marginLeft);
35668 }
35669 return {
35670  Initialize: Initialize,
35671  AdjustModalOnWindowResize: AdjustModalOnWindowResize
35672 };
35673})();
35674ASPxClientPopupControl.Cast = ASPxClientControl.Cast;
35675ASPxClientPopupControl.GetPopupControlCollection = function() {
35676 return aspxGetPopupControlCollection();
35677};
35678var ASPxClientPopupWindow = ASPx.CreateClass(null, {
35679 constructor: function(popupControl, index, name) {
35680  this.popupControl = popupControl;
35681  this.index = index;
35682  this.name = name;
35683 },
35684 GetHeaderImageUrl: function() {
35685  return this.popupControl.GetWindowHeaderImageUrl(this.index);
35686 },
35687 SetHeaderImageUrl: function(value) {
35688  this.popupControl.SetWindowHeaderImageUrl(this.index, value);
35689 },
35690 GetFooterImageUrl: function() {
35691  return this.popupControl.GetWindowFooterImageUrl(this.index);
35692 },
35693 SetFooterImageUrl: function(value) {
35694  this.popupControl.SetWindowFooterImageUrl(this.index, value);
35695 },
35696 GetHeaderNavigateUrl: function() {
35697  return this.popupControl.GetWindowHeaderNavigateUrl(this.index);
35698 },
35699 SetHeaderNavigateUrl: function(value) {
35700  this.popupControl.SetWindowHeaderNavigateUrl(this.index, value);
35701 },
35702 GetFooterNavigateUrl: function() {
35703  return this.popupControl.GetWindowFooterNavigateUrl(this.index);
35704 },
35705 SetFooterNavigateUrl: function(value) {
35706  this.popupControl.SetWindowFooterNavigateUrl(this.index, value);
35707 },
35708 GetHeaderText: function() {
35709  return this.popupControl.GetWindowHeaderText(this.index);
35710 },
35711 SetHeaderText: function(value) {
35712  this.popupControl.SetWindowHeaderText(this.index, value);
35713 },
35714 GetFooterText: function() {
35715  return this.popupControl.GetWindowFooterText(this.index);
35716 },
35717 SetFooterText: function(value) {
35718  this.popupControl.SetWindowFooterText(this.index, value);
35719 }
35720});
35721var ASPxClientPopupWindowEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
35722 constructor: function(window) {
35723  this.constructor.prototype.constructor.call(this);
35724  this.window = window;
35725 }
35726});
35727var ASPxClientPopupWindowCancelEventArgs = ASPx.CreateClass(ASPxClientCancelEventArgs, {
35728 constructor: function(window, closeReason) {
35729  this.constructor.prototype.constructor.call(this);
35730  this.window = window;
35731  this.closeReason = closeReason;
35732 }
35733});
35734var ASPxClientPopupWindowCloseUpEventArgs = ASPx.CreateClass(ASPxClientPopupWindowEventArgs, {
35735 constructor: function(window, closeReason) {
35736  this.constructor.prototype.constructor.call(this, window);
35737  this.closeReason = closeReason;
35738 }
35739});
35740var ASPxClientPopupWindowResizeEventArgs = ASPx.CreateClass(ASPxClientPopupWindowEventArgs, {
35741 constructor: function(window, resizeState) {
35742  this.constructor.prototype.constructor.call(this, window);
35743  this.resizeState = resizeState;
35744 }
35745});
35746var ASPxClientPopupWindowPinnedChangedEventArgs = ASPx.CreateClass(ASPxClientPopupWindowEventArgs, {
35747 constructor: function(window, pinned) {
35748  this.constructor.prototype.constructor.call(this, window);
35749  this.pinned = pinned;
35750 }
35751});
35752var ASPxClientPopupControlCollection = ASPx.CreateClass(ASPxClientControlCollection, {
35753 constructor: function() {
35754  this.constructor.prototype.constructor.call(this);
35755  this.draggingControl = null;
35756  this.draggingWindowIndex = -1;
35757  this.gragXOffset = 0;
35758  this.gragYOffset = 0;
35759  this.visibleModalElements = [];
35760  this.visiblePopupWindowIds = [];
35761  this.windowResizeByBodyScrollVisibilityChangingLockCount = 0;
35762  this.savedBodyWidth = 0;
35763  this.savedBodyHeight = 0;
35764  this.overControl = null;
35765  this.overWindowIndex = -1;
35766  this.overXPos = ASPx.InvalidPosition;
35767  this.overYPos = ASPx.InvalidPosition;
35768  this.appearTimerID = -1;
35769  this.disappearTimerID = -1;
35770  this.scrollEventLockCount = 0;
35771  this.currentActiveWindowElement = null;
35772  this.resizeControl = null;
35773  this.resizeIndex = -2;
35774  this.resizeCursor = "";
35775  this.resizePanel = null;
35776  this.selectBanned = false;
35777  this.pcWindowsAreRestrictedByDocumentWindow = true;
35778  this.docScrollLeft = -1;
35779  this.docScrollTop = -1;
35780  this.EnsureSaveScrollState();
35781 },
35782 GetCollectionType: function(){
35783  return "Popup";
35784 },
35785 Remove: function(popupControl) {
35786  for(var i = this.visibleModalElements.length - 1; i >= 0; i--) {
35787   var modalElement = this.visibleModalElements[i];
35788   if(modalElement && modalElement.DXModalPopupControl === popupControl)
35789    this.UnregisterVisibleModalElement(modalElement);
35790  }
35791  for(var j = this.visiblePopupWindowIds.length - 1; j >= 0; j--) {
35792   var id = this.visiblePopupWindowIds[j];
35793   if(!ASPx.IsExists(id)) continue;
35794   var popupWindow = this.GetPopupWindowFromID(id);
35795   if(popupWindow.popupControl === popupControl) {
35796    var windowElement = popupControl.GetWindowElement(popupWindow.windowIndex);
35797    if(windowElement)
35798     this.UnregisterVisibleWindow(windowElement);
35799    else
35800     ASPx.Data.ArrayRemove(this.visiblePopupWindowIds, id);
35801   }
35802  }
35803  ASPxClientControlCollection.prototype.Remove.call(this, popupControl);
35804 },
35805 EnsureSaveScrollState: function() {
35806  if(ASPx.documentLoaded && this.docScrollLeft < 0 && this.docScrollTop < 0)
35807   this.SaveScrollState();
35808 },
35809 GetPopupWindowFromID: function(id) {
35810  var pos = id.lastIndexOf(ASPx.PCWIdSuffix);
35811  var name = id.substring(0, pos);
35812  var index = id.substr(pos + ASPx.PCWIdSuffix.length);
35813  var popupControl = aspxGetPopupControlCollection().Get(name);
35814  return { popupControl: popupControl, windowIndex: index };
35815 },
35816 DoHideAllWindows: function(srcElement, excptId, applyToAll, closeReason, posX) {
35817  for(var i = this.visiblePopupWindowIds.length - 1; i >= 0; i--) {
35818   var id = this.visiblePopupWindowIds[i];
35819   if(id == excptId) continue;
35820   var popupWindow = this.GetPopupWindowFromID(id),
35821    windowIndex = popupWindow.windowIndex,
35822    popupControl = popupWindow.popupControl;
35823   if(!popupControl.CanBeClosedByClickOnElement(windowIndex, srcElement, posX, id)) continue;
35824   if(popupControl != null) {
35825    var popupWindowZIndexArray = ASPx.PopupUtils.GetElementZIndexArray(popupControl.GetWindowElement(windowIndex));
35826    var isPopupHigherSrcElement = ASPx.PopupUtils.IsHigher(popupWindowZIndexArray, ASPx.PopupUtils.GetElementZIndexArray(srcElement)) || !popupControl.HasDefaultWindow();
35827    var windowCloseAction = popupControl.GetWindowCloseAction(windowIndex);
35828    if ((windowCloseAction != "CloseButton" && windowCloseAction != "None") && isPopupHigherSrcElement || applyToAll)
35829     popupControl.DoHideWindow(parseInt(windowIndex), false, closeReason);
35830   }
35831  }
35832 },
35833 DoShowAtCurrentPos: function(name, index, popupElementIndex, evtClone) {
35834  var pc = this.Get(name);
35835  if(pc != null && !pc.InternalIsWindowVisible(index))
35836   pc.DoShowWindowCore(index, this.overXPos, this.overYPos, popupElementIndex, true, true, evtClone, ASPxClientPopupControlCloseReason.MouseOut);
35837 },
35838 WindowZIndexWasInitialized: function(zIndex, pcZIndex) {
35839  return pcZIndex <= zIndex;
35840 },
35841 ActivateWindowElement: function(element, evt, popupType, defZIndex, zIndex) {
35842  var maxZIndex = this.GetMaxZIndex(popupType, defZIndex),
35843   topZIndex = this.WindowZIndexWasInitialized(maxZIndex, zIndex) ? parseInt(maxZIndex) : zIndex;
35844  if(this.WindowZIndexWasInitialized(element.style.zIndex, zIndex) && element.style.zIndex != topZIndex) {
35845   this.DeleteWindowFromZIndexOrder(element);
35846  }
35847  if(!this.WindowZIndexWasInitialized(element.style.zIndex, zIndex))
35848   topZIndex += 2;
35849  var popupWindow = this.GetPopupWindowFromID(element.id);
35850  popupWindow.popupControl.SetWindowElementZIndex(element, topZIndex);
35851  var pcWElementEventSource = ASPx.PopupUtils.FindEventSourceParentByTestFunc(evt, aspxTestPopupWindowElement);
35852  if(!evt || (evt && pcWElementEventSource == element)) { 
35853   if(this.GetCurrentActiveWindowElement() != element) {
35854    this.RefreshTabIndexes(false);
35855    this.SaveCurrentActiveWindowElement(element);
35856   }
35857  }
35858 },
35859 RefreshTabIndexes: function(forceRecalculate) {
35860  var topModalWindow = this.GetTopModalWindow();
35861  if(topModalWindow != null || forceRecalculate) {
35862   var topModalWindowZIndexArray = ASPx.PopupUtils.GetElementZIndexArray(topModalWindow);
35863   this.CalculateTabIndexes(topModalWindowZIndexArray);
35864  }
35865 },
35866 ElementHasTabIndex: function(element) {
35867  return ASPx.IsExists(ASPx.Attr.GetAttribute(element, "tabindex"));
35868 },
35869 IsElementCanBeActive: function(element) { 
35870  return element.tagName === "INPUT" || element.tagName === "A" ||
35871   element.tagName === "BUTTON" || element.tagName === "TEXTAREA" ||
35872   element.tagName === "SELECT" || this.ElementHasTabIndex(element);
35873 },
35874 GetCanBeActiveElements: function() { 
35875  var elements = document.getElementsByTagName("*"),
35876   canBeActiveElements = [];
35877  for(var i = 0; i < elements.length; i++) {
35878   if(this.IsElementCanBeActive(elements[i]))
35879    canBeActiveElements.push(elements[i]);
35880  }
35881  return canBeActiveElements;
35882 },
35883 GetEditableDivs: function(){
35884  if(document.querySelectorAll)
35885   return document.querySelectorAll("div[contenteditable=true]");
35886  var editableDivs = [ ];
35887  var allDivs = document.getElementsByTagName("DIV");
35888  for(var i = 0; i < allDivs.length; i++){
35889   var div = allDivs[i];
35890   if(div.getAttribute("contenteditable") == 'true')
35891    editableDivs.push(div);
35892  }
35893  return editableDivs;
35894 },
35895 CalculateTabIndexes: function(topModalWindowZIndexArray) {
35896  var elements = this.GetCanBeActiveElements();
35897  for(var i = 0; i < elements.length; i++) {
35898   var currentElementZIndexArray = ASPx.PopupUtils.GetElementZIndexArray(elements[i]),
35899    manager = ASPx.ControlTabIndexManager.getInstance(),
35900    tabIndexManagerGroupId = "pcCollection";
35901   if(ASPx.PopupUtils.IsHigher(currentElementZIndexArray, topModalWindowZIndexArray))
35902    manager.restoreTabIndexAttribute(elements[i], tabIndexManagerGroupId);
35903   else
35904    manager.changeTabIndexAttribute(elements[i], tabIndexManagerGroupId);
35905  }
35906 },
35907 PopupWindowIsModalByVisibleIndex: function(visiblePopupWindowIndex) {
35908  return this.PopupWindowIsModalByID(this.visiblePopupWindowIds[visiblePopupWindowIndex]);
35909 },
35910 PopupWindowIsModalByID: function(windowElementID) {
35911  var popupWindow = this.GetPopupWindowFromID(windowElementID);
35912  return popupWindow.popupControl.WindowIsModal(popupWindow.windowIndex);
35913 },
35914 SaveCurrentActiveWindowElement: function(windowElement) {
35915  this.currentActiveWindowElement = windowElement;
35916 },
35917 SkipCurrentActiveWindowElement: function(element) {
35918  if(element == this.GetCurrentActiveWindowElement())
35919   this.SaveCurrentActiveWindowElement(null);
35920 },
35921 GetCurrentActiveWindowElement: function() {
35922  return this.currentActiveWindowElement;
35923 },
35924 GetMaxZIndex: function (type, defaultZIndex) {
35925  var maxZIndex = defaultZIndex;
35926  for(var i = 0; i < this.visiblePopupWindowIds.length; i++) {
35927   var id = this.visiblePopupWindowIds[i];
35928   if(type !== undefined && this.GetPopupWindowFromID(id).popupControl.GetPopupType() !== type)
35929    continue;
35930   var currentWindow = ASPx.GetElementById(id);
35931   if(!!currentWindow && ASPx.IsElementVisible(currentWindow) && currentWindow.style && currentWindow.style.zIndex > maxZIndex)
35932    maxZIndex = currentWindow.style.zIndex;
35933  }
35934  return maxZIndex;
35935 },
35936 GetTopModalWindow: function() {
35937  return this.GetTopWindow(true);
35938 },
35939 GetTopWindow: function(onlyModal) {
35940  var topWindow = null;
35941  var topWindowZIndexArray = null;
35942  for(var i = 0; i < this.visiblePopupWindowIds.length; i++) {
35943   var currentWindow = ASPx.GetElementById(this.visiblePopupWindowIds[i]);
35944   if(onlyModal && !this.PopupWindowIsModalByVisibleIndex(i))
35945    continue;
35946   if(ASPx.IsElementVisible(currentWindow)) {
35947    var currentWindowZIndexArray = ASPx.PopupUtils.GetElementZIndexArray(currentWindow);
35948    if(topWindow == null || ASPx.PopupUtils.IsHigher(currentWindowZIndexArray, topWindowZIndexArray)) {
35949     topWindow = currentWindow;
35950     topWindowZIndexArray = currentWindowZIndexArray;
35951    }
35952   }
35953  }
35954  return topWindow;
35955 },
35956 DeleteWindowFromZIndexOrder: function(element) {
35957  for(var i = this.visiblePopupWindowIds.length - 1; i >= 0; i--) {
35958   var windowElement = ASPx.GetElementById(this.visiblePopupWindowIds[i]);
35959   if(!windowElement)
35960    ASPx.Data.ArrayRemoveAt(this.visiblePopupWindowIds, i);
35961   else if(windowElement.style.zIndex > element.style.zIndex) {
35962    var popupWindow = this.GetPopupWindowFromID(this.visiblePopupWindowIds[i]);
35963    popupWindow.popupControl.SetWindowElementZIndex(windowElement, windowElement.style.zIndex - 2);
35964   }
35965  }
35966 },
35967 AdjustModalElementsBounds: function() {
35968  for(var i = 0; i < this.visibleModalElements.length; i++)
35969   this.visibleModalElements[i].DXModalPopupControl.AdjustModalElementBounds(this.visibleModalElements[i]);
35970 },
35971 ClearAppearTimer: function() {
35972  this.appearTimerID = ASPx.Timer.ClearTimer(this.appearTimerID);
35973 },
35974 ClearDisappearTimer: function() {
35975  this.disappearTimerID = ASPx.Timer.ClearTimer(this.disappearTimerID);
35976 },
35977 IsAppearTimerActive: function() {
35978  return this.appearTimerID > -1;
35979 },
35980 IsDisappearTimerActive: function() {
35981  return this.disappearTimerID > -1;
35982 },
35983 SetAppearTimer: function(name, index, popupElementIndex, timeout, evt) {
35984  var evtClone = ASPx.CloneObject(evt);
35985  this.appearTimerID = window.setTimeout(function() {
35986   aspxGetPopupControlCollection().DoShowAtCurrentPos(name, index, popupElementIndex, evtClone);
35987  }, timeout);
35988 },
35989 SetDisappearTimer: function(name, index, timeout) {
35990  this.disappearTimerID = window.setTimeout(function() {
35991   aspxGetPopupControlCollection().OnPWDisappearTimer(name, index);
35992  }, timeout);
35993 },
35994 GetDocScrollDifference: function() {
35995  return new _aspxScrollDifference(ASPx.GetDocumentScrollLeft() - this.docScrollLeft, ASPx.GetDocumentScrollTop() - this.docScrollTop);
35996 },
35997 IsDocScrolled: function(scroll) {
35998  return scroll.horizontal != 0 || scroll.vertical != 0;
35999 },
36000 SaveScrollState: function() {
36001  this.docScrollLeft = ASPx.GetDocumentScrollLeft();
36002  this.docScrollTop = ASPx.GetDocumentScrollTop();
36003 },
36004 InitDragObject: function(control, index, x, y, xClientCorrection, yClientCorrection) {
36005  this.draggingControl = control;
36006  this.draggingWindowIndex = index;
36007  this.gragXOffset = x;
36008  this.gragYOffset = y;
36009  this.xClientCorrection = xClientCorrection;
36010  this.yClientCorrection = yClientCorrection;
36011  this.SetDocumentSelectionBan(true);
36012 },
36013 InitOverObject: function(control, index, evt) {
36014  this.overControl = control;
36015  this.overWindowIndex = index;
36016  if(evt)
36017   this.SaveCurrentMouseOverPos(evt);
36018 },
36019 InitResizeObject: function(control, index, cursor, resizePanel) {
36020  this.resizeControl = control;
36021  this.resizeIndex = index;
36022  this.resizeCursor = cursor;
36023  this.resizePanel = resizePanel;
36024  this.SetDocumentSelectionBan(true);
36025 },
36026 SetDocumentSelectionBan: function(value) {
36027  if(this.selectBanned === value)
36028   return;
36029  this.selectBanned = value;
36030  if(ASPx.Browser.WebKitFamily) {
36031   if(value) {
36032    if(!this.webkitUserSelectBackup && document.body.style.webkitUserSelect)
36033     this.webkitUserSelectBackup = document.body.style.webkitUserSelect;
36034    document.body.style.webkitUserSelect = "none";
36035   } else {
36036    if(this.webkitUserSelectBackup) {
36037     document.body.style.webkitUserSelect = this.webkitUserSelectBackup;
36038     delete this.webkitUserSelectBackup;
36039    } else
36040     document.body.style.webkitUserSelect = "auto";
36041   }
36042  }
36043 },
36044 IsResizeInint: function() {
36045  return this.resizeControl != null;
36046 },
36047 ClearDragObject: function() {
36048  this.draggingControl = null;
36049  this.draggingWindowIndex = -1;
36050  this.gragXOffset = 0;
36051  this.gragYOffset = 0;
36052  this.SetDocumentSelectionBan(this.resizeControl != null);
36053 },
36054 ClearResizeObject: function() {
36055  this.resizeControl = null;
36056  this.resizeIndex = -2;
36057  this.resizeCursor = "";
36058  this.SetDocumentSelectionBan(this.draggingControl != null);
36059  this.resizePanel.parentNode.removeChild(this.resizePanel);
36060 },
36061 Drag: function(evt) {
36062  if(ASPx.tableColumnResizing || ASPx.currentDragHelper || !ASPx.Evt.IsLeftButtonPressed(evt)) return;
36063  var x = ASPx.Evt.GetEventX(evt);
36064  var y = ASPx.Evt.GetEventY(evt);
36065  if(this.pcWindowsAreRestrictedByDocumentWindow && ASPx.PopupUtils.CoordinatesInDocumentRect(x, y)) {
36066   x += this.gragXOffset;
36067   y += this.gragYOffset;
36068   this.draggingControl.OnDrag(this.draggingWindowIndex, x, y, this.xClientCorrection, this.yClientCorrection, evt);
36069   if(ASPx.Browser.WebKitTouchUI)
36070    ASPx.Evt.PreventEvent(evt);
36071  }
36072 },
36073 DragStop: function() {
36074  this.draggingControl.OnDragStop(this.draggingWindowIndex);
36075  this.ClearDragObject();
36076 },
36077 ResizeStop: function(evt) {
36078  this.resizeControl.OnResizeStop(evt, this.resizeIndex, this.resizeCursor, this.resizePanel);
36079  aspxGetPopupControlCollection().ClearResizeObject();
36080 },
36081 setIframesMouseMoveEnabled: function(enabled) {
36082  for(var i = 0; i < this.visiblePopupWindowIds.length; i++) {
36083   var popupWindow = this.GetPopupWindowFromID(this.visiblePopupWindowIds[i]);
36084   var popupControl = popupWindow.popupControl;
36085   if(popupControl) {
36086    var iframe = popupControl.GetWindowContentIFrameElement(popupWindow.windowIndex);
36087    if(iframe)
36088     iframe.style.pointerEvents = enabled ? "" : "none";
36089   }
36090  }
36091 },
36092 OnPWMouseMove: function(evt, name, index) {
36093  if(this.draggingControl == null &&
36094   this.overControl == null &&
36095   this.resizeControl == null) {
36096   var pc = aspxGetPopupControlCollection().Get(name);
36097   if(pc != null) pc.OnMouseMove(evt, index);
36098  }
36099 },
36100 OnPWMouseOver: function(evt) {
36101  if(!this.overControl || this.draggingControl) return;
36102  if(this.IsOverPopupWindow(evt))
36103   this.ClearDisappearTimer();
36104 },
36105 IsOverPopupWindow: function(evt) {
36106  return ASPx.PopupUtils.FindEventSourceParentByTestFunc(evt, aspxTestPopupControlOverElement) != null;
36107 },
36108 OnDocumentKeyDown: function(evt) {
36109  var windowElement = this.GetTopWindow(false);
36110  if(windowElement) {
36111   var window = this.GetPopupWindowFromID(windowElement.id);
36112   if(window.popupControl);
36113    window.popupControl.OnDocumentKeyDown(evt, windowElement);
36114  }
36115 },
36116 OnDocumentMouseDown: function(evt) {
36117  var popupElement = ASPx.PopupUtils.FindEventSourceParentByTestFunc(evt, aspxTestPopupControlElement);
36118  var excptId = popupElement == null ? "" :
36119   popupElement.DXPopupElementControl.GetWindowElementId(popupElement.DXPopupWindowIndex);
36120  this.OnMouseDownCore(evt, excptId);
36121 },
36122 OnMouseDown: function(evt) {
36123  this.OnMouseDownCore(evt, "");
36124 },
36125 OnMouseDownCore: function(evt, excptId) {
36126  var srcElement = ASPx.Evt.GetEventSource(evt);
36127  this.DoHideAllWindows(srcElement, excptId, false, ASPxClientPopupControlCloseReason.OuterMouseClick, ASPx.Evt.GetEventX(evt));
36128  aspxGetPopupControlCollection().ClearAppearTimer();
36129 },
36130 OnMouseMove: function (evt) {
36131  if(ASPx.Browser.WebKitTouchUI && ASPx.TouchUIHelper.isGesture)
36132   return;
36133  if(this.draggingControl != null) {
36134   this.Drag(evt);
36135  }
36136  else if(this.overControl != null) {
36137   this.OnMouseOver(evt);
36138  }
36139  else if(this.resizeControl != null) {
36140   this.resizeControl.OnResize(evt, this.resizeIndex, this.resizeCursor, this.resizePanel);
36141  }
36142 },
36143 OnMouseOver: function(evt) {
36144  var element = ASPx.PopupUtils.FindEventSourceParentByTestFunc(evt, aspxTestPopupControlOverElement);
36145  var curPopupElement = this.overControl.GetWindowCurrentPopupElementByIndex(this.overWindowIndex);
36146  var popup = element != null ? element.DXPopupElementControl : null;
36147  var isPopupActionMouseOver = popup && popup.GetWindowPopupAction(this.overWindowIndex) == 'MouseOver';
36148  var isCurPopupElement = element !== null && element === curPopupElement;
36149  var isCurPopupWindow = element != null && element.id === this.overControl.GetWindowElementId(this.overWindowIndex);
36150  var isCurPopupElementOrCurPopupWindow = isCurPopupElement || isCurPopupWindow || isPopupActionMouseOver;
36151  if(isCurPopupElementOrCurPopupWindow) {
36152   var clearTimer = true;
36153   popup = element.DXPopupElementControl;
36154   if(popup && popup.GetLastShownPopupElementIndex(element.DXPopupWindowIndex) != element.DXPopupElementIndex)
36155    clearTimer = false;
36156   if(clearTimer)
36157    this.ClearDisappearTimer();
36158   this.SaveCurrentMouseOverPos(evt);
36159   return;
36160  }
36161  this.OnMouseOut();
36162 },
36163 OnMouseOut: function(evt) {
36164  if(!this.overControl || this.draggingControl) return;
36165  this.ClearAppearTimer();
36166  var windowCloseAction = this.overControl.GetWindowCloseAction(this.overWindowIndex);
36167  if(windowCloseAction == "MouseOut" && this.overControl.InternalIsWindowVisible(this.overWindowIndex)) {
36168   if(!this.IsDisappearTimerActive() && this.IsDisappearAllowedByMouseOut(evt))
36169    this.SetDisappearTimer(this.overControl.name, this.overWindowIndex, this.overControl.disappearAfter);
36170  }
36171  else
36172   this.OverStop();
36173 },
36174 IsDisappearAllowedByMouseOut: function(evt) {
36175  return ASPx.Browser.Firefox || ASPx.Browser.Chrome ? !this.IsOverPopupWindow(evt) : true;  
36176 },
36177 OnMouseUp: function(evt) {
36178  if(this.draggingControl != null)
36179   this.DragStop();
36180  if(this.resizeControl != null)
36181   this.ResizeStop(evt);
36182 },
36183 OnResize: function(evt) {
36184  this.AutoUpdateElementsPosition();
36185  this.AdjustModalElementsBounds();
36186 },
36187 OnScroll: function(evt) {
36188  if(this.scrollEventLockCount > 0)
36189   return;
36190  var scroll = this.GetDocScrollDifference();
36191  if(this.IsDocScrolled(scroll)) { 
36192   this.CorrectPositionAtScroll(scroll);
36193   this.AdjustModalElementsBounds();
36194   this.SaveScrollState();
36195  }
36196  this.CalculateDocumentDimensionsWithoutPinnedWindows(evt);
36197  this.FireScrollEventToWindows(evt);
36198 },
36199 GetSavedBodyWidth: function() {
36200  if(this.savedBodyWidth == 0)
36201   this.CalculateDocumentDimensionsWithoutPinnedWindows();
36202  return this.savedBodyWidth;
36203 },
36204 GetSavedBodyHeight: function() {
36205  if(this.savedBodyHeight == 0)
36206   this.CalculateDocumentDimensionsWithoutPinnedWindows();
36207  return this.savedBodyHeight;
36208 },
36209 HidePinnedPopupsThatOutFromViewPort: function() {
36210  var popupsToRestoreVisible = [];
36211  for(var i = 0; i < this.visiblePopupWindowIds.length; i++) {
36212   var popupWindow = this.GetPopupWindowFromID(this.visiblePopupWindowIds[i]);
36213   var popupControl = popupWindow.popupControl;
36214   if(!popupControl.needToHidePinnedOutFromViewPort(popupWindow.windowIndex))
36215    continue;
36216   var element = popupControl.GetWindowElement(popupWindow.windowIndex);
36217   if(!element) continue;
36218   var restoreData = {};
36219   restoreData.element = element;
36220   restoreData.display = element.style.display;
36221   element.style.display = "none";
36222   popupsToRestoreVisible.push(restoreData);
36223  }
36224  return popupsToRestoreVisible;
36225 },
36226 RestorePinnedPopupsThatOutFromViewPort: function(popupsToRestoreVisible) {
36227  if(popupsToRestoreVisible.length > 0) {
36228   for(var i = 0; i < popupsToRestoreVisible.length; i++) {
36229    var restoreData = popupsToRestoreVisible[i];
36230    restoreData.element.style.display = restoreData.display;
36231   }
36232  }
36233 },
36234 CalculateDocumentDimensionsWithoutPinnedWindows: function(evt) { 
36235  var popupsToRestoreVisible = [];
36236  var needToHideRestorePopupsThatOutFromViewPort = !!evt && ASPx.Evt.GetEventSource(evt) == document;
36237  if(needToHideRestorePopupsThatOutFromViewPort)
36238   popupsToRestoreVisible = this.HidePinnedPopupsThatOutFromViewPort();
36239  this.savedBodyWidth = ASPx.GetDocumentWidth();
36240  this.savedBodyHeight = ASPx.GetDocumentHeight();
36241  if(needToHideRestorePopupsThatOutFromViewPort)
36242   this.RestorePinnedPopupsThatOutFromViewPort(popupsToRestoreVisible);
36243 },
36244 FireScrollEventToWindows: function(evt) {
36245  for(var i = 0; i < this.visiblePopupWindowIds.length; i++) {
36246   var popupWindow = this.GetPopupWindowFromID(this.visiblePopupWindowIds[i]);
36247   var popupControl = popupWindow.popupControl;
36248   popupControl.OnScroll(evt, popupWindow.windowIndex);
36249  }
36250 },
36251 LockScrollEvent: function() {
36252  this.scrollEventLockCount++;
36253 },
36254 UnlockScrollEvent: function() {
36255  this.scrollEventLockCount--;
36256 },
36257 CorrectPositionAtScroll: function(scroll) {
36258  for(var i = 0; i < this.visiblePopupWindowIds.length; i++) {
36259   var popupWindow = this.GetPopupWindowFromID(this.visiblePopupWindowIds[i]);
36260   var popupControl = popupWindow.popupControl;
36261   if(popupControl != null && popupControl.InternalIsWindowVisible(popupWindow.windowIndex)) {
36262    if(popupControl.GetAutoUpdatePosition(popupWindow.windowIndex))
36263     popupWindow.popupControl.TryAutoUpdatePosition(popupWindow.windowIndex);
36264   }
36265  }
36266 },
36267 OnSelectStart: function() {
36268  return !this.selectBanned;
36269 },
36270 OverStop: function() {
36271  this.overControl = null;
36272  this.overWindowIndex = -1;
36273 },
36274 OnPWDisappearTimer: function(name, index) {
36275  var pc = this.Get(name);
36276  if(pc != null) {
36277   if(!pc.DoHideWindow(index, false, ASPxClientPopupControlCloseReason.MouseOut))
36278    this.OverStop();
36279   this.ClearDisappearTimer();
36280  }
36281 },
36282 SaveCurrentMouseOverPos: function(evt) {
36283  this.overXPos = ASPx.Evt.GetEventX(evt);
36284  this.overYPos = ASPx.Evt.GetEventY(evt);
36285 },
36286 RegisterVisibleModalElement: function(element) {
36287  if(ASPx.Data.ArrayIndexOf(this.visibleModalElements, element) == -1)
36288   this.visibleModalElements.push(element);
36289 },
36290 UnregisterVisibleModalElement: function(element) {
36291  ASPx.Data.ArrayRemove(this.visibleModalElements, element);
36292 },
36293 RegisterVisibleWindow: function(element, popupControl, index) {
36294  if(ASPx.Data.ArrayIndexOf(this.visiblePopupWindowIds, element.id) == -1) {
36295   this.visiblePopupWindowIds.push(element.id);
36296   if(popupControl && popupControl.GetWindowCloseAction(index) == "MouseOut")
36297    aspxGetPopupControlCollection().InitOverObject(popupControl, index, null);
36298   this.OnRegisteredVisibleWindow(element);
36299  }
36300 },
36301 OnRegisteredVisibleWindow: function(element) {
36302  var elementIndex = ASPx.Data.ArrayIndexOf(this.visiblePopupWindowIds, element.id);
36303  if(this.PopupWindowIsModalByVisibleIndex(elementIndex))
36304   ASPx.RemoveFocus(element);
36305 },
36306 UnregisterVisibleWindow: function(element) {
36307  this.DeleteWindowFromZIndexOrder(element);
36308  ASPx.Data.ArrayRemove(this.visiblePopupWindowIds, element.id);
36309  var forceRecalculate = this.PopupWindowIsModalByID(element.id);
36310  this.RefreshTabIndexes(forceRecalculate);
36311  this.SkipCurrentActiveWindowElement(element);
36312 },
36313 AutoUpdateElementsPosition: function() {
36314  for(var i = 0; i < this.visiblePopupWindowIds.length; i++) {
36315   var popupWindow = this.GetPopupWindowFromID(this.visiblePopupWindowIds[i]);
36316   var popupControl = popupWindow.popupControl;
36317   if(popupControl != null && popupControl.InternalIsWindowVisible(popupWindow.windowIndex))
36318    popupControl.TryAutoUpdatePosition(popupWindow.windowIndex);
36319  }
36320 },
36321 LockWindowResizeByBodyScrollVisibilityChanging: function() {
36322  this.windowResizeByBodyScrollVisibilityChangingLockCount++;
36323 },
36324 UnlockWindowResizeByBodyScrollVisibilityChanging: function() {
36325  this.windowResizeByBodyScrollVisibilityChangingLockCount--;
36326 },
36327 WindowResizeByBodyScrollVisibilityChangingLocked: function() {
36328  return this.windowResizeByBodyScrollVisibilityChangingLockCount > 0;
36329 },
36330 HideAllWindows: function() {
36331  this.DoHideAllWindows(null, "", true, ASPxClientPopupControlCloseReason.API, 0);
36332 }
36333});
36334var ASPxClientPopupControlResizeState = {
36335 Resized: 0,
36336 Collapsed: 1,
36337 Expanded: 2,
36338 Maximized: 3,
36339 RestoredAfterMaximized: 4
36340};
36341var ASPxClientPopupControlCloseReason = {
36342 API: "API",
36343 CloseButton: "CloseButton",
36344 OuterMouseClick: "OuterMouseClick",
36345 MouseOut: "MouseOut",
36346 Escape: "Escape"
36347};
36348var popupControlCollection = null;
36349function aspxGetPopupControlCollection() {
36350 if(popupControlCollection == null)
36351  popupControlCollection = new ASPxClientPopupControlCollection();
36352 return popupControlCollection;
36353}
36354function _aspxScrollDifference(horizontal, vertical) {
36355 this.horizontal = horizontal;
36356 this.vertical = vertical;
36357}
36358function aspxPWEMOver(evt) {
36359 aspxGetPopupControlCollection().OnPWMouseOver(evt);
36360}
36361ASPx.PWHMDown = function(evt) {
36362 return ASPx.Evt.CancelBubble(evt);
36363};
36364ASPx.PWCBClick = function(evt, name, index) {
36365 var pc = aspxGetPopupControlCollection().Get(name);
36366 if(pc != null) pc.OnPWHBClickCore(evt, index, "OnCloseButtonClick");
36367};
36368ASPx.PWPBClick = function(evt, name, index) {
36369 var pc = aspxGetPopupControlCollection().Get(name);
36370 if(pc != null) pc.OnPWHBClickCore(evt, index, "OnPinButtonClick");
36371};
36372ASPx.PWRBClick = function(evt, name, index) {
36373 var pc = aspxGetPopupControlCollection().Get(name);
36374 if(pc != null) pc.OnPWHBClickCore(evt, index, "OnRefreshButtonClick");
36375};
36376ASPx.PWMNBClick = function(evt, name, index) {
36377 var pc = aspxGetPopupControlCollection().Get(name);
36378 if(pc != null) pc.OnPWHBClickCore(evt, index, "OnCollapseButtonClick");
36379};
36380ASPx.PWMXBClick = function(evt, name, index) {
36381 var pc = aspxGetPopupControlCollection().Get(name);
36382 if(pc != null) pc.OnPWHBClickCore(evt, index, "OnMaximizeButtonClick");
36383};
36384ASPx.PWDGMDown = function (evt, name, index) {
36385 var pc = aspxGetPopupControlCollection().Get(name);
36386 return ASPx.PWMDown(evt, name, index, pc.IsDraggingAllowed(index));
36387};
36388ASPx.PWGripMDown = function(evt, name, index) {
36389 aspxPWMDownCore(evt, name, index, false);
36390 return ASPx.PWHMDown(evt);
36391};
36392ASPx.PWMMove = function(evt, name, index) {
36393 aspxGetPopupControlCollection().OnPWMouseMove(evt, name, index);
36394};
36395ASPx.PWMDown = function(evt, name, index, isWindowContentDraggingAllowed) { 
36396 var pointOnScrollBar = false;
36397 var pc = aspxGetPopupControlCollection().Get(name);
36398 if(pc && pc.GetEnableContentScrolling(index)) {
36399  var rtl = pc.rtl && (ASPx.Browser.Firefox || ASPx.Browser.Opera);
36400  pointOnScrollBar = aspxPointOnElementScrollBar(pc.GetContentContainer(index), evt.clientX, evt.clientY, rtl);
36401 }
36402 aspxPWMDownCore(evt, name, index, isWindowContentDraggingAllowed, pointOnScrollBar);
36403 if(isWindowContentDraggingAllowed) { 
36404  aspxGetPopupControlCollection().OnDocumentMouseDown(evt); 
36405  if(typeof (ASPx.GetDropDownCollection) == "function")
36406   ASPx.GetDropDownCollection().OnDocumentMouseDown(evt); 
36407  if(!pointOnScrollBar) {
36408   if(!ASPx.Browser.WebKitTouchUI && ASPx.Evt.GetEventSource(evt).tagName == "IMG") 
36409    ASPx.Evt.PreventEvent(evt);
36410  }
36411 }
36412};
36413function aspxPWMDownCore(evt, name, index, isDraggingAllowed, pointOnScrollBar) {
36414 var pc = aspxGetPopupControlCollection().Get(name);
36415 if(pc != null) {
36416  pc.OnActivate(index, evt);
36417  pc.OnMouseDown(evt, index, isDraggingAllowed, pointOnScrollBar);
36418 }
36419}
36420function aspxPWMEMDown(evt) {
36421 var internalScrollableModalDiv = ASPx.Browser.AndroidDefaultBrowser ? ASPx.Evt.GetEventSource(evt) : null;
36422 var modalDiv = internalScrollableModalDiv ? internalScrollableModalDiv.parentNode : ASPx.Evt.GetEventSource(evt);
36423 if(modalDiv != null) 
36424  modalDiv.DXModalPopupControl.OnMouseDownModalElement(evt, modalDiv.DXModalPopupWindowIndex);
36425}
36426function aspxPEMEvent(evt) {
36427 var element = ASPx.PopupUtils.FindEventSourceParentByTestFunc(evt, aspxTestPopupControlElement);
36428 if(element != null) {
36429  var popupControl = element.DXPopupElementControl;
36430  var index = element.DXPopupWindowIndex;
36431  if(evt.type == "mousedown") {
36432   popupControl.SetIsPopuped(index, popupControl.InternalIsWindowVisible(index));
36433   aspxGetPopupControlCollection().OnMouseDown(evt);
36434  }
36435  else {
36436   var windowPopupAction = popupControl.GetWindowPopupAction(element.DXPopupWindowIndex);
36437   var leftMouseButtonAction = windowPopupAction == "LeftMouseClick" && ASPx.Evt.IsLeftButtonPressed(evt);
36438   var isAccessibleKeyboardAction = popupControl.accessibilityCompliant && ASPx.Evt.IsActionKeyPressed(evt);
36439   var rightMouseButtonAction = windowPopupAction == "RightMouseClick" && !ASPx.Evt.IsLeftButtonPressed(evt);
36440   if(leftMouseButtonAction || rightMouseButtonAction || isAccessibleKeyboardAction) {
36441    if(rightMouseButtonAction)
36442     ASPx.PopupUtils.PreventContextMenu(evt);
36443    var windowCloseAction = popupControl.GetWindowCloseAction(index);
36444    var isPopuped = popupControl.GetIsPopuped(index);
36445    var isNewPopupElement = popupControl.GetLastShownPopupElementIndex(index) != element.DXPopupElementIndex;
36446    if(isPopuped && isNewPopupElement) {
36447     popupControl.DoHideWindow(index, false, ASPxClientPopupControlCloseReason.OuterMouseClick);
36448     aspxGetPopupControlCollection().ClearDisappearTimer();
36449     isPopuped = false;
36450    }
36451    if(!(isPopuped && windowCloseAction == "OuterMouseClick")) {
36452     popupControl.DoShowWindow(index, element.DXPopupElementIndex, evt);
36453    }
36454    if(windowCloseAction == "MouseOut")
36455     aspxGetPopupControlCollection().InitOverObject(popupControl, element.DXPopupWindowIndex, evt);
36456    return false;
36457   }
36458  }
36459 }
36460}
36461ASPx.PopupElementMouseEvent = aspxPEMEvent;
36462function aspxPointOnElementScrollBar(element, x, y, rtl) {
36463 var scrollWidth = ASPx.GetVerticalScrollBarWidth();
36464 var hasHorizontalScroll = element.scrollWidth > element.clientWidth;
36465 var hasVerticalScroll = element.scrollHeight > element.clientHeight;
36466 var ceilX = rtl ? ASPx.GetAbsoluteX(element) + scrollWidth :
36467  ASPx.GetAbsoluteX(element) + (element.offsetWidth - ASPx.GetHorizontalBordersWidth(element));
36468 var ceilY = ASPx.GetAbsoluteY(element) + (element.offsetHeight - ASPx.GetVerticalBordersWidth(element));
36469 return (hasVerticalScroll && x >= ceilX - scrollWidth && x <= ceilX) ||
36470   (hasHorizontalScroll && y >= ceilY - scrollWidth && y <= ceilY);
36471}
36472ASPx.PCAStop = function(name, index) {
36473 var pc = aspxGetPopupControlCollection().Get(name);
36474 if(pc != null) pc.OnAnimationStop(index);
36475};
36476ASPx.PCIframeLoad = function(evt) {
36477 var srcElement = ASPx.Evt.GetEventSource(evt);
36478 if(srcElement) {
36479  var pcName = srcElement.popupControlName;
36480  var pcWndIndex = srcElement.pcWndIndex;
36481  if(pcName) {
36482   var pc = aspxGetPopupControlCollection().Get(pcName);
36483   if(pc) pc.OnIFrameLoad(pcWndIndex);
36484  }
36485 }
36486};
36487function aspxTestPopupWindowElement(element) {
36488 return !!element.DXPopupWindowElement;
36489}
36490function aspxTestPopupControlElement(element) {
36491 return element.DXPopupElementControl && ASPx.IsExists(element.DXPopupWindowIndex);
36492}
36493function aspxTestPopupControlOverElement(element) {
36494 var collection = aspxGetPopupControlCollection();
36495 var popupControl = collection.overControl;
36496 var index = collection.overWindowIndex;
36497 var windowId = popupControl.GetWindowElementId(index);
36498 if(element.id == windowId)
36499  return true;
36500 var popupElements = popupControl.GetPopupElementList(index);
36501 for(var i = 0; i < popupElements.length; i++)
36502  if(popupElements[i] == element)
36503   return true;
36504 return false;
36505}
36506ASPx.Evt.AttachEventToDocument("keydown", function(evt) {
36507 aspxGetPopupControlCollection().OnDocumentKeyDown(evt);
36508});
36509ASPx.Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseDownEventName, function(evt) {
36510 aspxGetPopupControlCollection().OnDocumentMouseDown(evt);
36511});
36512ASPx.Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseUpEventName, function(evt) {
36513 return aspxGetPopupControlCollection().OnMouseUp(evt);
36514});
36515ASPx.Evt.AttachEventToElement(window, ASPx.TouchUIHelper.touchMouseMoveEventName, function(evt) {
36516 if(typeof(aspxGetPopupControlCollection) != "undefined")
36517  aspxGetPopupControlCollection().OnMouseMove(evt);
36518}, false, !ASPx.Browser.WebKitTouchUI);
36519ASPx.Evt.AttachEventToDocument("mouseout", function(evt) {
36520 if(typeof (aspxGetPopupControlCollection) != "undefined")
36521  aspxGetPopupControlCollection().OnMouseOut(evt);
36522});
36523 ASPx.Evt.AttachEventToElement(window, "resize", function(evt) {
36524 aspxGetPopupControlCollection().OnResize(evt);
36525});
36526ASPx.Evt.AttachEventToElement(window, "scroll", function(evt) {
36527 aspxGetPopupControlCollection().OnScroll(evt);
36528});
36529ASPx.Evt.AttachEventToDocument("selectstart", function(evt) {
36530 var ret = aspxGetPopupControlCollection().OnSelectStart(evt);
36531 if(!ret) return false; 
36532});
36533var currViewPortSize = null,
36534 viewPortSizeInterval = null;
36535function getViewPortSize() {
36536 return { 
36537  w: window.innerWidth, 
36538  h: window.innerHeight,
36539  x: window.pageXOffset,
36540  y: window.pageYOffset
36541 }; 
36542}
36543function ensureViewPortSizeInterval() {
36544 if(!!viewPortSizeInterval) return;
36545 viewPortSizeInterval = setInterval(function() {
36546  var size = getViewPortSize();
36547  if(currViewPortSize && (size.w != currViewPortSize.w || size.h != currViewPortSize.h || size.x != currViewPortSize.x || size.y != currViewPortSize.y)) {
36548   var controlCollection = aspxGetPopupControlCollection();
36549   controlCollection.ForEachControl(function(popupControl) {
36550    if(popupControl.GetCanScrollViewPort(-1) && popupControl.IsVisible()) {
36551     popupControl.updateContentScrollIfNeeded(-1);
36552     popupControl.UpdatePosition();
36553    }
36554   });
36555  }
36556  currViewPortSize = size;
36557 }, 50);
36558}
36559window.ASPxClientPopupControlBase = ASPxClientPopupControlBase;
36560window.ASPxClientPopupControl = ASPxClientPopupControl;
36561window.ASPxClientPopupWindow = ASPxClientPopupWindow;
36562window.ASPxClientPopupWindowEventArgs = ASPxClientPopupWindowEventArgs;
36563window.ASPxClientPopupWindowCancelEventArgs = ASPxClientPopupWindowCancelEventArgs;
36564window.ASPxClientPopupWindowResizeEventArgs = ASPxClientPopupWindowResizeEventArgs;
36565window.ASPxClientPopupWindowPinnedChangedEventArgs = ASPxClientPopupWindowPinnedChangedEventArgs;
36566window.ASPxClientPopupControlCollection = ASPxClientPopupControlCollection;
36567window.ASPxClientPopupControlResizeState = ASPxClientPopupControlResizeState;
36568window.ASPxClientPopupControlCloseReason = ASPxClientPopupControlCloseReason;
36569ASPx.GetPopupControlCollection = aspxGetPopupControlCollection;
36570ASPx.PopupControlCssClasses = PopupControlCssClasses;
36571})();
36572

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.