PageSourceSearch

https://bakalari.kosinka.com/bakaweb/DXR.axd?r=1_11,1_12,1_23,1_63…189,1_191,1_17,1_41,1_193,1_185,1_192-CIbnk

js kosinka.com collected 2026-10-06 21:22:55 UTC 1,630,411 bytes, 42,513 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 = '/bakaweb/DXR.axd?r=1_87-CIbnk';
12ASPx.EmptyImageUrl = '/bakaweb/DXR.axd?r=1_88-CIbnk';
13ASPx.VersionInfo = 'Version=\'19.2.6.0\', File Version=\'19.2.6.0\', Date Modified=\'3/3/2020 2:52:50 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};
70function setInnerHtmlInternal(el, trustedHtmlString) { 
71 el.innerHTML = trustedHtmlString;
72}
73var DateUtils = { };
74DateUtils.GetInvariantDateString = function(date) {
75 if(!date)
76  return "01/01/0001";
77 var day = date.getDate();
78 var month = date.getMonth() + 1;
79 var year = date.getFullYear();
80 var result = "";
81 if(month < 10)
82  result += "0";
83 result += month.toString() + "/";
84 if(day < 10)
85  result += "0";
86 result += day.toString() + "/";
87 if(year < 1000)
88  result += "0";
89 result += year.toString();
90 return result;
91};
92DateUtils.GetInvariantDateTimeString = function(date) {
93 var dateTimeString = DateUtils.GetInvariantDateString(date);
94 var time = {
95  h: date.getHours(),
96  m: date.getMinutes(),
97  s: date.getSeconds()
98 };
99 for(var key in time) {
100  if(time.hasOwnProperty(key)) {
101   var str = time[key].toString();
102   if(str.length < 2)
103    str = "0" + str;
104   time[key] = str;
105  }
106 }
107 dateTimeString += " " + time.h + ":" + time.m + ":" + time.s;
108 var msec = date.getMilliseconds();
109 if(msec > 0)
110  dateTimeString += "." + ("000" + msec.toString()).substr(-3);
111 return dateTimeString;
112};
113DateUtils.ExpandTwoDigitYear = function(value) {
114 value += 1900;
115 if(value + 99 < ASPx.CultureInfo.twoDigitYearMax)
116  value += 100;
117 return value;  
118};
119DateUtils.GetTimeZoneOffsetDifference = function(firstDate, secondDate) {
120 if(!secondDate)
121  secondDate = DateUtils.GetUtcDate(firstDate);
122 return 60000 * (firstDate.getTimezoneOffset() - secondDate.getTimezoneOffset());
123};
124DateUtils.GetTimeZoneOffset = function(date) {
125 var isECMA262Support = ASPx.Browser.Chrome && ASPx.Browser.Version >= 67;
126 if(!isECMA262Support)
127  return date.getTimezoneOffset() * 60000;
128 var utcDate = DateUtils.GetUtcDate(date);
129 var utcTimezoneOffsetDifference = DateUtils.GetTimeZoneOffsetDifference(date);
130 if(utcTimezoneOffsetDifference !== 0)
131  utcDate.setTime(utcDate.valueOf() + utcTimezoneOffsetDifference);
132 return utcDate - date;
133};
134DateUtils.GetUtcDate = function(date) {
135 var utcFullYear = date.getUTCFullYear();
136 var result = new Date(utcFullYear, date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), date.getUTCMilliseconds());
137 if(utcFullYear < 100)
138  result.setFullYear(utcFullYear);
139 return result;
140};
141DateUtils.ToUtcTime = function(date) {
142 var result = new Date();
143 result.setTime(date.valueOf() + ASPx.DateUtils.GetTimeZoneOffset(date));
144 return result;
145};
146DateUtils.ToLocalTime = function(date) {
147 var result = new Date();
148 result.setTime(date.valueOf() - ASPx.DateUtils.GetTimeZoneOffset(date));
149 return result; 
150};
151DateUtils.AreDatesEqualExact = function(date1, date2) {
152 if(date1 == null && date2 == null)
153  return true;
154 if(date1 == null || date2 == null)
155  return false;
156 return date1.getTime() == date2.getTime(); 
157};
158DateUtils.FixTimezoneGap = function(oldDate, newDate) {
159 var diff = newDate.getHours() - oldDate.getHours();
160 if(diff == 0)
161  return;
162 var sign = (diff == 1 || diff == -23) ? -1 : 1;
163 var trial = new Date(newDate.getTime() + sign * 3600000);
164 var isDateChangedAsExpected = newDate.getHours() - trial.getHours() === diff;
165 if(isDateChangedAsExpected && (sign > 0 || trial.getDate() == newDate.getDate()))
166  newDate.setTime(trial.getTime());
167};
168DateUtils.GetDecadeStartYear = function(year) {
169 return 10 * Math.floor(year / 10);
170};
171DateUtils.GetCenturyStartYear = function(year) {
172 return 100 * Math.floor(year / 100);
173};
174DateUtils.GetCorrectedYear = function(date, pickerType) {
175 var year = date.getFullYear();
176 return pickerType != ASPx.DatePickerType.Decades ? year : DateUtils.GetDecadeStartYear(year);
177};
178DateUtils.GetCorrectedMonth = function(date, pickerType) {
179 return pickerType < ASPx.DatePickerType.Years ? date.getMonth() : 0;
180};
181DateUtils.GetCorrectedDay = function(date, pickerType) {
182 return pickerType == ASPx.DatePickerType.Days ? date.getDate() : 1;
183};
184DateUtils.CorrectDateByPickerType = function(date, pickerType) {
185 if(!ASPx.IsExists(pickerType))
186  pickerType = ASPx.DatePickerType.Days;
187 if(!date || pickerType == ASPx.DatePickerType.Days)
188  return date;
189 var correctedYear = DateUtils.GetCorrectedYear(date, pickerType);
190 var result = new Date(
191  correctedYear,
192  DateUtils.GetCorrectedMonth(date, pickerType),
193  DateUtils.GetCorrectedDay(date, pickerType),
194  date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()
195 );
196 result.setFullYear(correctedYear);
197 return result;
198};
199DateUtils.GetYearRangeFormatString = function(startYear, rangeLength) {
200 return startYear + " - " + (startYear + rangeLength - 1);
201};
202ASPx.DateUtils = DateUtils;
203var Timer = { };
204Timer.ClearTimer = function(timerID){
205 if(timerID > -1)
206  window.clearTimeout(timerID);
207 return -1;
208};
209Timer.ClearInterval = function(timerID){
210 if(timerID > -1)
211  window.clearInterval(timerID);
212 return -1;
213};
214var setControlBoundTimer = function(handler, control, setTimerFunction, clearTimerFunction, delay) {
215 var timerId;
216 var getTimerId = function() { return timerId; };
217 var controlMainElement = control.GetMainElement();
218 var boundHandler = function() {
219  var controlExists = control && ASPx.GetControlCollection().Get(control.name) === control && control.GetMainElement() === controlMainElement;
220  if(controlExists)
221   handler.aspxBind(control)();
222  else {
223   clearTimerFunction(getTimerId());
224   controlMainElement = null;
225  }
226 };
227 timerId = setTimerFunction(boundHandler, delay);
228 return timerId;
229};
230Timer.SetControlBoundTimeout = function(handler, control, delay) {
231 return setControlBoundTimer(handler, control, window.setTimeout, Timer.ClearTimer, delay);
232};
233Timer.SetControlBoundInterval = function(handler, control, delay) {
234 return setControlBoundTimer(handler, control, window.setInterval, Timer.ClearInterval, delay);
235};
236Timer.Throttle = function(func, delay) {
237 var isThrottled = false,
238   savedArgs,
239   savedThis = this;
240 function wrapper() {
241  if(isThrottled) {
242   savedArgs = arguments;
243   savedThis = this;
244   return;
245  }
246  func.apply(this, arguments);
247  isThrottled = true;
248  setTimeout(function() {
249   isThrottled = false;
250   if(savedArgs) {
251    wrapper.apply(savedThis, savedArgs);
252    savedArgs = null;
253   }
254  }, delay);
255 }
256 wrapper.cancel = function() {
257  clearTimeout(delay);
258  delay = savedArgs = savedThis = null;
259 };
260 return wrapper;
261};
262ASPx.Timer = Timer;
263var Browser = { };
264Browser.UserAgent = navigator.userAgent.toLowerCase();
265Browser.Mozilla = false;
266Browser.IE = false;
267Browser.Firefox = false;
268Browser.Netscape = false;
269Browser.Safari = false;
270Browser.Chrome = false;
271Browser.Opera = false;
272Browser.Edge = false;
273Browser.Version = undefined; 
274Browser.MajorVersion = undefined; 
275Browser.WindowsPlatform = false;
276Browser.MacOSPlatform = false;
277Browser.MacOSMobilePlatform = false;
278Browser.AndroidMobilePlatform = false;
279Browser.PlaformMajorVersion = false;
280Browser.WindowsPhonePlatform = false;
281Browser.AndroidDefaultBrowser = false;
282Browser.AndroidChromeBrowser = false;
283Browser.SamsungAndroidDevice = false;
284Browser.WebKitTouchUI = false;
285Browser.MSTouchUI = false;
286Browser.TouchUI = false;
287Browser.WebKitFamily = false; 
288Browser.NetscapeFamily = false; 
289Browser.HardwareAcceleration = false;
290Browser.VirtualKeyboardSupported = false;
291Browser.Info = "";
292Browser.IsQuirksMode = document.compatMode === "BackCompat";
293function indentPlatformMajorVersion(userAgent) {
294 var regex = /(?:(?:windows nt|macintosh|mac os|cpu os|cpu iphone os|android|windows phone|linux) )(\d+)(?:[-0-9_.])*/;
295 var matches = regex.exec(userAgent);
296 if(matches)
297  Browser.PlaformMajorVersion = matches[1];
298}
299function getIECompatibleVersionString() {
300 if(document.compatible) {
301  for(var i = 0; i < document.compatible.length; i++)
302   if(document.compatible[i].userAgent === "IE" && document.compatible[i].version)
303    return document.compatible[i].version.toLowerCase();
304 }
305 return "";
306}
307Browser.IdentUserAgent = function(userAgent, ignoreDocumentMode) {
308 var browserTypesOrderedList = [ "Mozilla", "IE", "Firefox", "Netscape", "Safari", "Chrome", "Opera", "Opera10", "Edge" ];
309 var defaultBrowserType = "IE";
310 var defaultPlatform = "Win";
311 var defaultVersions = { Safari: 2, Chrome: 0.1, Mozilla: 1.9, Netscape: 8, Firefox: 2, Opera: 9, IE: 6, Edge: 12 };
312 if(!userAgent || userAgent.length == 0) {
313  fillUserAgentInfo(browserTypesOrderedList, defaultBrowserType, defaultVersions[defaultBrowserType], defaultPlatform);
314  return;
315 }
316 userAgent = userAgent.toLowerCase();
317 indentPlatformMajorVersion(userAgent);
318 try {
319  var platformIdentStrings = {
320   "Windows": "Win",
321   "Macintosh": "Mac",
322   "Mac OS": "Mac",
323   "Mac_PowerPC": "Mac",
324   "cpu os": "MacMobile",
325   "cpu iphone os": "MacMobile",
326   "Android": "Android",
327   "!Windows Phone": "WinPhone",
328   "!WPDesktop": "WinPhone",
329   "!ZuneWP": "WinPhone"
330  };
331  var optSlashOrSpace = "(?:/|\\s*)?";
332  var version = "(\\d+)(?:\\.((?:\\d+?[1-9])|\\d)0*?)?";
333  var optVersion = "(?:" + version + ")?";
334  var patterns = {
335   Safari: "applewebkit(?:.*?(?:version/" + version + "[\\.\\w\\d]*?(?:\\s+mobile\/\\S*)?\\s+safari))?",
336   Chrome: "(?:chrome|crios)(?!frame)" + optSlashOrSpace + optVersion,
337   Mozilla: "mozilla(?:.*rv:" + optVersion + ".*Gecko)?",
338   Netscape: "(?:netscape|navigator)\\d*/?\\s*" + optVersion,
339   Firefox: "firefox" + optSlashOrSpace + optVersion,
340   Opera: "(?:opera|\sopr)" + optSlashOrSpace + optVersion,
341   Opera10: "opera.*\\s*version" + optSlashOrSpace + optVersion,
342   IE: "msie\\s*" + optVersion,
343   Edge: "edge" + optSlashOrSpace + optVersion
344  };
345  var browserType;
346  var version = -1;
347  for(var i = 0; i < browserTypesOrderedList.length; i++) {
348   var browserTypeCandidate = browserTypesOrderedList[i];
349   var regExp = new RegExp(patterns[browserTypeCandidate], "i");
350   if(regExp.compile)
351    regExp.compile(patterns[browserTypeCandidate], "i");
352   var matches = regExp.exec(userAgent);
353   if(matches && matches.index >= 0) {
354    if(browserType == "IE" && version >= 11 && browserTypeCandidate == "Safari") 
355     continue;
356    browserType = browserTypeCandidate;
357    if(browserType == "Opera10")
358     browserType = "Opera";
359    var tridentPattern = "trident" + optSlashOrSpace + optVersion;
360    version = Browser.GetBrowserVersion(userAgent, matches, tridentPattern, getIECompatibleVersionString());
361    if(browserType == "Mozilla" && version >= 11)
362     browserType = "IE";
363   }
364  }
365  if(!browserType)
366   browserType = defaultBrowserType;
367  var browserVersionDetected = version != -1;
368  if(!browserVersionDetected)
369   version = defaultVersions[browserType];
370  var platform;
371  var minOccurenceIndex = Number.MAX_VALUE;
372  for(var identStr in platformIdentStrings) {
373   if(!platformIdentStrings.hasOwnProperty(identStr)) continue;
374   var importantIdent = identStr.substr(0,1) == "!";
375   var occurenceIndex = userAgent.indexOf((importantIdent ? identStr.substr(1) : identStr).toLowerCase());
376   if(occurenceIndex >= 0 && (occurenceIndex < minOccurenceIndex || importantIdent)) {
377    minOccurenceIndex = importantIdent ? 0 : occurenceIndex;
378    platform = platformIdentStrings[identStr];
379   }
380  }
381  var samsungPattern = "SM-[A-Z]";
382  var matches = userAgent.toUpperCase().match(samsungPattern);
383  var isSamsungAndroidDevice = matches && matches.length > 0;
384  if(platform == "WinPhone" && version < 9)
385   version = Math.floor(getVersionFromTrident(userAgent, "trident" + optSlashOrSpace + optVersion));
386  if(!ignoreDocumentMode && browserType == "IE" && version > 7 && document.documentMode < version)
387   version = document.documentMode;
388  if(platform == "WinPhone")
389   version = Math.max(9, version);
390  if(!platform)
391   platform = defaultPlatform;
392  if(platform == platformIdentStrings["cpu os"] && !browserVersionDetected) 
393   version = 4;
394  fillUserAgentInfo(browserTypesOrderedList, browserType, version, platform, isSamsungAndroidDevice);
395 } catch(e) {
396  fillUserAgentInfo(browserTypesOrderedList, defaultBrowserType, defaultVersions[defaultBrowserType], defaultPlatform);
397 }
398};
399function getVersionFromMatches(matches) {
400 var result = -1;
401 var versionStr = "";
402 if(matches[1]) {
403  versionStr += matches[1];
404  if(matches[2])
405   versionStr += "." + matches[2];
406 }
407 if(versionStr != "") {
408  result = parseFloat(versionStr);
409  if(isNaN(result))
410   result = -1;
411 }
412 return result;
413}
414function getVersionFromTrident(userAgent, tridentPattern) {
415 var tridentDiffFromVersion = 4;
416 var matches = new RegExp(tridentPattern, "i").exec(userAgent);
417 return getVersionFromMatches(matches) + tridentDiffFromVersion;
418}
419Browser.GetBrowserVersion = function(userAgent, matches, tridentPattern, ieCompatibleVersionString) {
420 var version = getVersionFromMatches(matches);
421 if(ieCompatibleVersionString) {
422  var versionFromTrident = getVersionFromTrident(userAgent, tridentPattern);
423  if(ieCompatibleVersionString === "edge" || parseInt(ieCompatibleVersionString) === versionFromTrident)
424   return versionFromTrident;
425 }
426 return version;
427};
428function fillUserAgentInfo(browserTypesOrderedList, browserType, version, platform, isSamsungAndroidDevice) {
429 for(var i = 0; i < browserTypesOrderedList.length; i++) {
430  var type = browserTypesOrderedList[i];
431  Browser[type] = type == browserType;
432 }
433 Browser.Version = Math.floor(10.0 * version) / 10.0;
434 Browser.MajorVersion = Math.floor(Browser.Version);
435 Browser.WindowsPlatform = platform == "Win" || platform == "WinPhone";
436 Browser.MacOSPlatform = platform == "Mac";
437 var isMacWithTouchSupport = platform == "Mac" && (!!window.ontouchstart || window.navigator.maxTouchPoints > 0); 
438 Browser.MacOSMobilePlatform = platform == "MacMobile" || isMacWithTouchSupport;
439 if(Browser.MacOSMobilePlatform)
440  Browser.MacOSPlatform = false;
441 Browser.AndroidMobilePlatform = platform == "Android";
442 Browser.WindowsPhonePlatform = platform == "WinPhone";
443 Browser.WebKitFamily = Browser.Safari || Browser.Chrome || Browser.Opera && Browser.MajorVersion >= 15;
444 Browser.NetscapeFamily = Browser.Netscape || Browser.Mozilla || Browser.Firefox;
445 Browser.HardwareAcceleration = (Browser.IE && Browser.MajorVersion >= 9) || (Browser.Firefox && Browser.MajorVersion >= 4) || 
446  (Browser.AndroidMobilePlatform && Browser.Chrome) || (Browser.Chrome && Browser.MajorVersion >= 37) || 
447  (Browser.Safari && !Browser.WindowsPlatform) || Browser.Edge || (Browser.Opera && Browser.MajorVersion >= 46);
448 Browser.WebKitTouchUI = Browser.MacOSMobilePlatform || Browser.AndroidMobilePlatform;
449 var isIETouchUI = Browser.IE && Browser.MajorVersion > 9 && Browser.WindowsPlatform && Browser.UserAgent.toLowerCase().indexOf("touch") >= 0;
450 Browser.MSTouchUI = isIETouchUI || (Browser.Edge && !!window.navigator.maxTouchPoints);
451 Browser.TouchUI = Browser.WebKitTouchUI || Browser.MSTouchUI;
452 Browser.MobileUI = Browser.WebKitTouchUI || Browser.WindowsPhonePlatform;
453 Browser.AndroidDefaultBrowser = Browser.AndroidMobilePlatform && !Browser.Chrome;
454 Browser.AndroidChromeBrowser = Browser.AndroidMobilePlatform && Browser.Chrome;
455 if(isSamsungAndroidDevice)
456  Browser.SamsungAndroidDevice = isSamsungAndroidDevice;
457 if(Browser.MSTouchUI) {
458  var isARMArchitecture = Browser.UserAgent.toLowerCase().indexOf("arm;") > -1;    
459  Browser.VirtualKeyboardSupported = isARMArchitecture || Browser.WindowsPhonePlatform;   
460 } else {
461  Browser.VirtualKeyboardSupported = Browser.MobileUI || (Browser.Chrome && !!window.navigator.maxTouchPoints);
462 }
463 fillDocumentElementBrowserTypeClassNames(browserTypesOrderedList);
464}
465function fillDocumentElementBrowserTypeClassNames(browserTypesOrderedList) {
466 var documentElementClassName = "";
467 var browserTypeslist = browserTypesOrderedList.concat(["WindowsPlatform", "MacOSPlatform", "MacOSMobilePlatform", "AndroidMobilePlatform",
468   "WindowsPhonePlatform", "WebKitFamily", "WebKitTouchUI", "MSTouchUI", "TouchUI", "AndroidDefaultBrowser", "MobileUI"]);
469 for(var i = 0; i < browserTypeslist.length; i++) {
470  var type = browserTypeslist[i];
471  if(Browser[type])
472   documentElementClassName += "dx" + type + " ";
473 }
474 documentElementClassName += "dxBrowserVersion-" + Browser.MajorVersion;
475 if(document && document.documentElement) {
476  if(document.documentElement.className != "")
477   documentElementClassName = " " + documentElementClassName;
478  document.documentElement.className += documentElementClassName;
479  Browser.Info = documentElementClassName;
480 }
481}
482Browser.SupportsStickyPositioning = function() {
483 return this.Chrome && this.MajorVersion >= 56
484  || this.Firefox && this.MajorVersion >= 32
485  || this.Safari && this.MajorVersion >= 6 && this.Version !== "6"
486  || this.Opera && this.MajorVersion >= 42;
487};
488Browser.IdentUserAgent(Browser.UserAgent);
489ASPx.Browser = Browser;
490ASPx.BlankUrl = Browser.IE ? ASPx.SSLSecureBlankUrl : (Browser.Opera ? "about:blank" : "");
491var Data = { };
492Data.ArrayInsert = function(array, element, position){
493 if(0 <= position && position < array.length){
494  for(var i = array.length; i > position; i --)
495   array[i] = array[i - 1];
496  array[position] = element;
497 }
498 else
499  array.push(element);
500};
501Data.ArrayRemove = function(array, element){
502 var index = Data.ArrayIndexOf(array, element);
503 if(index > -1) Data.ArrayRemoveAt(array, index);
504};
505Data.ArrayRemoveAt = function(array, index){
506 if(index >= 0  && index < array.length){
507  for(var i = index; i < array.length - 1; i++)
508   array[i] = array[i + 1];
509  array.pop();
510 }
511};
512Data.ArrayClear = function(array){
513 while(array.length > 0)
514  array.pop();
515};
516Data.ArrayIndexOf = function(array, element, comparer) {
517 if(!comparer) {
518  for(var i = 0; i < array.length; i++) {
519   if(array[i] == element)
520    return i;
521  }
522 } else {
523  for(var i = 0; i < array.length; i++) {
524   if(comparer(array[i], element))
525    return i;
526  }
527 }
528 return -1;
529};
530Data.ArrayContains = function(array, element) { 
531 return Data.ArrayIndexOf(array, element) >= 0;
532};
533Data.ArrayEqual = function(array1, array2) {
534 var count1 = array1.length;
535 var count2 = array2.length;
536 if(count1 != count2)
537  return false;
538 for(var i = 0; i < count1; i++)
539  if(array1[i] != array2[i])
540   return false;
541 return true;
542};
543Data.ArraySame = function(array1, array2) {
544 if(array1.length !== array2.length)
545  return false;
546 return array1.every(function(elem) { return Data.ArrayContains(array2, elem); });
547};
548Data.ArrayGetIntegerEdgeValues = function(array) {
549 var arrayToSort = Data.CollectionToArray(array);
550 Data.ArrayIntegerAscendingSort(arrayToSort);
551 return {
552  start: arrayToSort[0],
553  end: arrayToSort[arrayToSort.length - 1]
554 };
555};
556Data.ArrayIntegerAscendingSort = function(array){
557 Data.ArrayIntegerSort(array);
558};
559Data.ArrayIntegerSort = function(array, desc) {
560 array.sort(function(i1, i2) {
561  var res = 0;
562  if(i1 > i2)
563   res = 1;
564  else if(i1 < i2)
565   res = -1;
566  if(desc)
567   res *= -1;
568  return res;
569 });
570};
571Data.CollectionsUnionToArray = function(firstCollection, secondCollection) {
572 var result = [];
573 var firstCollectionLength = firstCollection.length;
574 var secondCollectionLength = secondCollection.length;
575 for(var i = 0; i < firstCollectionLength + secondCollectionLength; i++) {
576  if(i < firstCollectionLength)
577   result.push(firstCollection[i]);
578  else
579   result.push(secondCollection[i - firstCollectionLength]);
580 }
581 return result;
582};
583Data.CollectionToArray = function(collection) {
584 var array = [];
585 for(var i = 0; i < collection.length; i++)
586  array.push(collection[i]);
587 return array;
588};
589Data.CreateHashTableFromArray = function(array) {
590 var hash = [];
591 for(var i = 0; i < array.length; i++)
592  hash[array[i]] = 1;
593 return hash;
594};
595Data.CreateIndexHashTableFromArray = function(array) {
596 var hash = [];
597 for(var i = 0; i < array.length; i++)
598  hash[array[i]] = i;
599 return hash;
600};
601Data.ArrayToHash = function(array, getKeyFunc, getValueFunc) {
602 if(!(array instanceof Array)) 
603  return { };
604 return array.reduce(function(map, element, index) { 
605  var key = getKeyFunc(element, index);
606  var value = getValueFunc(element, index);
607  map[key] = value;
608  return map; 
609 }, { });
610};
611Data.Sum = function(array, getValueFunc) {
612 if(!(array instanceof Array)) 
613  return 0;
614 return array.reduce(function(prevValue, item) {
615  var value = getValueFunc ? getValueFunc(item) : item;
616  if(!ASPx.IsNumber(value))
617   value = 0;
618  return prevValue + value;
619 }, 0);
620};
621Data.Min = function(array, getValueFunc) { return CalculateArrayMinMax(array, getValueFunc, false); };
622Data.Max = function(array, getValueFunc) { return CalculateArrayMinMax(array, getValueFunc, true); };
623var CalculateArrayMinMax = function(array, getValueFunc, isMax) {
624 if(!(array instanceof Array)) 
625  return 0;
626 var startValue = isMax ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY;
627 return array.reduce(function(prevValue, item) {
628  var value = getValueFunc ? getValueFunc(item) : item;
629  if(!ASPx.IsNumber(value))
630   value = startValue;
631  var func = isMax ? Math.max : Math.min;
632  return func(value, prevValue);
633 }, startValue);
634};
635var defaultBinarySearchComparer = function(array, index, value) {
636 var arrayElement = array[index];
637 if(arrayElement == value)
638  return 0;
639 else
640  return arrayElement < value ? -1 : 1;
641};
642Data.NearestLeftBinarySearchComparer = function(array, index, value) { 
643 var arrayElement = array[index];
644 var leftPoint = arrayElement < value;
645 var lastLeftPoint = leftPoint && index == array.length - 1;
646 var nearestLeftPoint = lastLeftPoint || (leftPoint && array[index + 1] >= value);
647 if(nearestLeftPoint)
648  return 0;
649 else
650  return arrayElement < value ? -1 : 1;
651};
652Data.ArrayBinarySearch = function(array, value, binarySearchComparer, startIndex, length) {
653 if(!binarySearchComparer)
654  binarySearchComparer = defaultBinarySearchComparer;
655 if(!ASPx.IsExists(startIndex))
656  startIndex = 0;
657 if(!ASPx.IsExists(length))
658  length = array.length - startIndex;
659 var endIndex = (startIndex + length) - 1;
660 while(startIndex <= endIndex) {
661  var middle = (startIndex + ((endIndex - startIndex) >> 1));
662  var compareResult = binarySearchComparer(array, middle, value);
663  if(compareResult == 0)
664   return middle;
665  if(compareResult < 0)
666   startIndex = middle + 1;
667  else
668   endIndex = middle - 1;
669 }
670 return -(startIndex + 1);
671};
672Data.ArrayFlatten = function(arrayOfArrays) {
673 return [].concat.apply([], arrayOfArrays);
674};
675Data.GetDistinctArray = function(array) {
676 var resultArray = [];
677 for(var i = 0; i < array.length; i++) {
678  var currentEntry = array[i];
679  if(Data.ArrayIndexOf(resultArray, currentEntry) == -1) {
680   resultArray.push(currentEntry);
681  }
682 }
683 return resultArray;
684};
685Data.ForEach = function(arr, callback) {
686 if(Array.prototype.forEach) {
687  Array.prototype.forEach.call(arr, callback);
688 } else {
689  for(var i = 0, len = arr.length; i < len; i++) {
690   callback(arr[i], i, arr);
691  }
692 }
693};
694Data.MergeHashTables = function(target, object) {
695 if(!object || typeof (object) == "string")
696  return target;
697 if(!target)
698  target = {};
699 for(var key in object)
700  if(key && !(key in target))
701   target[key] = object[key];
702 return target;
703};
704Data.Range = function(count, start) {
705 count = parseInt(count) || 0;
706 start = parseInt(start) || 0;
707 if(count < 0) count = 0;
708 if(start < 0) start = 0;
709 return Array.apply(null, Array(count)).map(function(val, i) { return start + i; });
710};
711ASPx.Data = Data;
712var Cookie = { };
713Cookie.DelCookie = function(name){
714 setCookieInternal(name, "", new Date(1970, 1, 1));
715};
716Cookie.GetCookie = function(name) {
717 name = escape(name);
718 var cookies = document.cookie.split(';');
719 for(var i = 0; i < cookies.length; i++) {
720  var cookie = Str.Trim(cookies[i]);
721  if(cookie.indexOf(name + "=") == 0)
722   return unescape(cookie.substring(name.length + 1, cookie.length));
723  else if(cookie.indexOf(name + ";") == 0 || cookie === name)
724   return "";
725 }
726 return null;
727};
728Cookie.SetCookie = function(name, value, expirationDate){
729 if(!ASPx.IsExists(value)) {
730  Cookie.DelCookie(name);
731  return;
732 }
733 if(!ASPx.Ident.IsDate(expirationDate)) {
734  expirationDate = new Date();
735  expirationDate.setFullYear(expirationDate.getFullYear() + 1);
736 }
737 setCookieInternal(name, value, expirationDate);
738};
739function setCookieInternal(name, value, date){
740 document.cookie = escape(name) + "=" + escape(value.toString()) + "; expires=" + date.toGMTString() + "; path=/";
741}
742ASPx.Cookie = Cookie;
743ASPx.ImageUtils = {
744 GetImageSrc: function (image){
745  return image.src;
746 },
747 SetImageSrc: function(image, src){
748  if(isSourceResetRequired())
749   image.src = "";
750  image.src = src;
751 },
752 SetSize: function(image, width, height){
753  image.style.width = width + "px";
754  image.style.height = height + "px";
755 },
756 GetSize: function(image, isWidth) {
757  return (isWidth ? ASPx.GetElementOffsetWidth(image) : ASPx.GetElementOffsetHeight(image));
758 }
759};
760var Str = { };
761Str.ApplyReplacement = function(text, replecementTable) {
762 if(typeof(text) != "string")
763  text = text.toString();
764 for(var i = 0; i < replecementTable.length; i++) {
765  var replacement = replecementTable[i];
766  text = text.replace(replacement[0], replacement[1]);
767 }
768 return text;
769};
770Str.CompleteReplace = function(text, regexp, newSubStr) {
771 if(typeof(text) != "string")
772  text = text.toString();
773 var textPrev;
774 do {
775  textPrev = text;
776  text = text.replace(regexp, newSubStr);
777 } while(text != textPrev);
778 return text;
779};
780Str.EncodeHtml = function(html) {
781 return Str.ApplyReplacement(html, [
782  [ /&amp;/g,  '&ampx;'  ], [ /&/g, '&amp;'  ],
783  [ /&quot;/g, '&quotx;' ], [ /"/g, '&quot;' ],
784  [ /&lt;/g,   '&ltx;'   ], [ /</g, '&lt;'   ],
785  [ /&gt;/g,   '&gtx;'   ], [ />/g, '&gt;'   ]
786 ]);
787};
788Str.DecodeHtml = function(html) {
789 return Str.ApplyReplacement(html, [
790  [ /&gt;/g,   '>' ], [ /&gtx;/g,  '&gt;'   ],
791  [ /&lt;/g,   '<' ], [ /&ltx;/g,  '&lt;'   ],
792  [ /&quot;/g, '"' ], [ /&quotx;/g,'&quot;' ],
793  [ /&amp;/g,  '&' ], [ /&ampx;/g, '&amp;'  ]
794 ]);
795};
796Str.DecodeHtmlViaTextArea = function(html) {
797 var textArea = document.createElement("TEXTAREA");
798 setInnerHtmlInternal(textArea, html);
799 return textArea.value;
800};
801Str.TrimStart = function(str) { 
802 return trimInternal(str, true);
803};
804Str.TrimEnd = function(str) { 
805 return trimInternal(str, false, true);
806};
807Str.Trim = function(str) { 
808 return trimInternal(str, true, true); 
809};
810Str.EscapeForRegEx = function(str) {
811 return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
812};
813var whiteSpaces = { 
814 0x0009: 1, 0x000a: 1, 0x000b: 1, 0x000c: 1, 0x000d: 1, 0x0020: 1, 0x0085: 1, 
815 0x00a0: 1, 0x1680: 1, 0x180e: 1, 0x2000: 1, 0x2001: 1, 0x2002: 1, 0x2003: 1, 
816 0x2004: 1, 0x2005: 1, 0x2006: 1, 0x2007: 1, 0x2008: 1, 0x2009: 1, 0x200a: 1, 
817 0x200b: 1, 0x2028: 1, 0x2029: 1, 0x202f: 1, 0x205f: 1, 0x3000: 1
818};
819var caretWidth = 1;
820function trimInternal(source, trimStart, trimEnd) {
821 var len = source.length;
822 if(!len)
823  return source;
824 var result = "";
825 if(len < 0xBABA1) 
826  result = trimSource(source, trimStart, trimEnd);
827 else
828  result = trimLargeSource(source, len, trimStart, trimEnd);
829 return Str.ClearString(result);
830}
831function trimSource(source, trimStart, trimEnd) {
832 var result = source;
833 if(trimStart)
834  result = result.replace(/^\s+/, "");
835 if(trimEnd)
836  result = result.replace(/\s+$/, "");
837 return result;
838}
839function trimLargeSource(source, len, trimStart, trimEnd) {
840 var start = 0;
841 if(trimEnd) {
842  while(len > 0 && whiteSpaces[source.charCodeAt(len - 1)]) {
843   len--;
844  }
845 }
846 if(trimStart && len > 0) {
847  while(start < len && whiteSpaces[source.charCodeAt(start)]) {
848   start++;
849  }
850 }
851 return source.substring(start, len);
852}
853var inlineStringLength = 12;
854Str.ClearString = function(str) { 
855 if(!ASPx.Browser.Chrome)
856  return str;
857 return str.length < inlineStringLength ? str : JSON.parse(JSON.stringify(str));
858};
859Str.Insert = function(str, subStr, index) { 
860 var leftText = str.slice(0, index);
861 var rightText = str.slice(index);
862 return leftText + subStr + rightText;
863};
864Str.InsertEx = function(str, subStr, startIndex, endIndex) { 
865 var leftText = str.slice(0, startIndex);
866 var rightText = str.slice(endIndex);
867 return leftText + subStr + rightText;
868};
869var greekSLFSigmaChar = String.fromCharCode(962);
870var greekSLSigmaChar = String.fromCharCode(963);
871Str.PrepareStringForFilter = function(s){
872 s = s.toLowerCase();
873 if(ASPx.Browser.WebKitFamily) {
874  return s.replace(new RegExp(greekSLFSigmaChar, "g"), greekSLSigmaChar);
875 }
876 return s;
877};
878Str.GetCoincideCharCount = function(text, filter, textMatchingDelegate) {
879 var coincideText = ASPx.Str.PrepareStringForFilter(filter);
880 var originText = ASPx.Str.PrepareStringForFilter(text);
881 while(coincideText != "" && !textMatchingDelegate(originText, coincideText)) {
882  coincideText = coincideText.slice(0, -1);
883 }
884 return coincideText.length;
885};
886ASPx.Str = Str;
887var Xml = { };
888Xml.Parse = function(xmlStr) {
889 if(window.DOMParser) {
890  var parser = new DOMParser();
891  return parser.parseFromString(xmlStr, "text/xml");
892 }
893 else if(window.ActiveXObject) {
894  var xmlDoc = new window.ActiveXObject("Microsoft.XMLDOM");
895  if(xmlDoc) {
896   xmlDoc.async = false;
897   xmlDoc.loadXML(xmlStr);
898   return xmlDoc;
899  }
900 }
901 return null;
902};
903ASPx.Xml = Xml;
904ASPx.Key = {
905 F1     : 112,
906 F2     : 113,
907 F3     : 114,
908 F4     : 115,
909 F5     : 116,
910 F6     : 117,
911 F7     : 118,
912 F8     : 119,
913 F9     : 120,
914 F10    : 121,
915 F11    : 122,
916 F12    : 123,
917 Ctrl   : 17,
918 Shift  : 16,
919 Alt    : 18,
920 Enter  : 13,
921 Home   : 36,
922 End    : 35,
923 Left   : 37,
924 Right  : 39,
925 Up     : 38,
926 Down   : 40,
927 PageUp    : 33,
928 PageDown  : 34,
929 Esc    : 27,
930 Space  : 32,
931 Tab    : 9,
932 Backspace : 8,
933 Delete    : 46,
934 Insert    : 45,
935 ContextMenu  : 93,
936 Windows   : 91,
937 Decimal   : 110
938};
939ASPx.ModifierKey = {
940 None: 0,
941 Ctrl: 1 << (0 + 16),
942 Shift: 1 << (2 + 16),
943 Alt: 1 << (4 + 16),
944 Meta: 1 << (8 + 16)
945};
946ASPx.KeyCode = {
947 Backspace : 8,
948 Tab    : 9,
949 Enter  : 13,
950 Pause  : 19,
951 CapsLock  : 20,
952 Esc    : 27,
953 Space  : 32,
954 PageUp    : 33,
955 PageDown  : 34,
956 End    : 35,
957 Home   : 36,
958 Left   : 37,
959 Up     : 38,
960 Right  : 39,
961 Down   : 40,
962 Insert    : 45,
963 Delete    : 46,
964 Key_0  : 48,
965 Key_1  : 49,
966 Key_2  : 50,
967 Key_3  : 51,
968 Key_4  : 52,
969 Key_5  : 53,
970 Key_6  : 54,
971 Key_7  : 55,
972 Key_8  : 56,
973 Key_9  : 57,
974 Key_a  : 65,
975 Key_b  : 66,
976 Key_c  : 67,
977 Key_d  : 68,
978 Key_e  : 69,
979 Key_f  : 70,
980 Key_g  : 71,
981 Key_h  : 72,
982 Key_i  : 73,
983 Key_j  : 74,
984 Key_k  : 75,
985 Key_l  : 76,
986 Key_m  : 77,
987 Key_n  : 78,
988 Key_o  : 79,
989 Key_p  : 80,
990 Key_q  : 81,
991 Key_r  : 82,
992 Key_s  : 83,
993 Key_t  : 84,
994 Key_u  : 85,
995 Key_v  : 86,
996 Key_w  : 87,
997 Key_x  : 88,
998 Key_y  : 89,
999 Key_z  : 90,
1000 Windows   : 91,
1001 ContextMenu  : 93,
1002 Numpad_0  : 96,
1003 Numpad_1  : 97,
1004 Numpad_2  : 98,
1005 Numpad_3  : 99,
1006 Numpad_4  : 100,
1007 Numpad_5  : 101,
1008 Numpad_6  : 102,
1009 Numpad_7  : 103,
1010 Numpad_8  : 104,
1011 Numpad_9  : 105,
1012 Multiply  : 106,
1013 Add    : 107,
1014 Subtract  : 109,
1015 Decimal   : 110,
1016 Divide    : 111,
1017 F1     : 112,
1018 F2     : 113,
1019 F3     : 114,
1020 F4     : 115,
1021 F5     : 116,
1022 F6     : 117,
1023 F7     : 118,
1024 F8     : 119,
1025 F9     : 120,
1026 F10    : 121,
1027 F11    : 122,
1028 F12    : 123,
1029 NumLock   : 144,
1030 ScrollLock   : 145,
1031 Semicolon : 186,
1032 Equals    : 187,
1033 Comma  : 188,
1034 Dash   : 189,
1035 Period    : 190,
1036 ForwardSlash : 191,
1037 GraveAccent  : 192,
1038 OpenBracket  : 219,
1039 BackSlash : 220,
1040 CloseBracket : 221,
1041 SingleQuote  : 222
1042};
1043ASPx.ScrollBarMode = { Hidden: 0, Visible: 1, Auto: 2 };
1044ASPx.ColumnResizeMode = { None: 0, Control: 1, NextColumn: 2 };
1045var Selection = { };
1046Selection.Set = function(input, startPos, endPos, scrollToSelection, isApi) {
1047 if(!ASPx.IsExistsElement(input))
1048  return;
1049 var isInputFocused = ASPx.GetActiveElement() === input;
1050 var isInputNativeFocusLocked = ASPx.VirtualKeyboardUI.getInputNativeFocusLocked();
1051 if(!isApi && Browser.VirtualKeyboardSupported && (!isInputFocused || isInputNativeFocusLocked))
1052  return;
1053 var textLen = input.value.length;
1054 startPos = ASPx.GetDefinedValue(startPos, 0);
1055 endPos = ASPx.GetDefinedValue(endPos, textLen);
1056 if(startPos < 0)
1057  startPos = 0;
1058 if(endPos < 0 || endPos > textLen)
1059  endPos = textLen;
1060 if(startPos > endPos)
1061  startPos = endPos;
1062 var makeReadOnly = false;
1063 if(Browser.WebKitFamily && input.readOnly) {
1064  input.readOnly = false;
1065  makeReadOnly = true;
1066 }
1067 try {
1068  if(Browser.Firefox && Browser.Version >= 8) 
1069   input.setSelectionRange(startPos, endPos, "backward");
1070  else if(Browser.IE && input.createTextRange) {
1071   var range = input.createTextRange();
1072   range.collapse(true);
1073   range.moveStart("character", startPos);
1074   range.moveEnd("character", endPos - startPos);
1075   range.select();
1076  } else {
1077   forceScrollToSelectionRange(input, startPos, endPos);
1078   input.setSelectionRange(startPos, endPos);
1079  }
1080  if(Browser.Opera || Browser.Firefox || Browser.Chrome || Browser.Edge) 
1081   input.focus();
1082 } catch(e) { }
1083 if(scrollToSelection && input.tagName == 'TEXTAREA') {
1084  var scrollHeight = input.scrollHeight;
1085  var approxCaretPos = startPos;
1086  var scrollTop = Math.max(Math.round(approxCaretPos * scrollHeight / textLen  - input.clientHeight / 2), 0);
1087  input.scrollTop = scrollTop;
1088 }
1089 if(makeReadOnly)
1090  input.readOnly = true;
1091};
1092var getTextWidthBeforePos = function(input, pos) {
1093 return ASPx.GetSizeOfText(input.value.toString().substr(0, pos), ASPx.GetCurrentStyle(input)).width;
1094};
1095var forceScrollToSelectionRange = function(input, startPos, endPos) {
1096 if(endPos === input.value.length)
1097  input.scrollLeft = input.scrollWidth;
1098 else if(startPos === 0 && endPos === 0)
1099  input.scrollLeft = 0;
1100 else {
1101  var inputRawWidth = ASPx.GetElementOffsetWidth(input) - ASPx.GetLeftRightBordersAndPaddingsSummaryValue(input);
1102  if(inputRawWidth < input.scrollWidth) {
1103   var widthBeforeEndPos = getTextWidthBeforePos(input, endPos) + caretWidth;
1104   if(input.scrollLeft < widthBeforeEndPos - inputRawWidth)
1105    input.scrollLeft = widthBeforeEndPos - inputRawWidth;
1106   else {
1107    var widthBeforeStartPos = getTextWidthBeforePos(input, startPos) - caretWidth;
1108    if(input.scrollLeft > widthBeforeStartPos)
1109     input.scrollLeft = widthBeforeStartPos;
1110   }
1111  }
1112 }
1113};
1114Selection.GetInfo = function(input) {
1115 var start, end;
1116 if(Browser.IE && Browser.Version < 9) {
1117  var range = document.selection.createRange();
1118  var rangeCopy = range.duplicate();
1119  range.move('character', -input.value.length);
1120  range.setEndPoint('EndToStart', rangeCopy);
1121  start = range.text.length;
1122  end = start + rangeCopy.text.length;
1123 } else {
1124  try {
1125   start = input.selectionStart;
1126   end = input.selectionEnd;
1127  } catch (e) {
1128  }
1129 }
1130 return { startPos: start, endPos: end };
1131};
1132Selection.GetExtInfo = function(input) {
1133 var start = 0, end = 0, textLen = 0;
1134 if(Browser.IE && Browser.Version < 9) {
1135  var normalizedValue;
1136  var range, textInputRange, textInputEndRange;
1137  range = document.selection.createRange();
1138  if(range && range.parentElement() == input) {
1139   textLen = input.value.length;
1140   normalizedValue = input.value.replace(/\r\n/g, "\n");
1141   textInputRange = input.createTextRange();
1142   textInputRange.moveToBookmark(range.getBookmark());
1143   textInputEndRange = input.createTextRange();
1144   textInputEndRange.collapse(false);
1145   if(textInputRange.compareEndPoints("StartToEnd", textInputEndRange) > -1) {
1146    start = textLen;
1147    end = textLen;
1148   } else {
1149    start = normalizedValue.slice(0, start).split("\n").length - textInputRange.moveStart("character", -textLen) -1;
1150    if(textInputRange.compareEndPoints("EndToEnd", textInputEndRange) > -1)
1151     end = textLen;
1152    else
1153     end = normalizedValue.slice(0, end).split("\n").length - textInputRange.moveEnd("character", -textLen) - 1;    
1154   }
1155  }
1156  return {startPos: start, endPos: end};
1157 }
1158 try {
1159  start = input.selectionStart;
1160  end = input.selectionEnd;
1161 } catch (e) {
1162 }
1163 return {startPos: start, endPos: end}; 
1164};
1165Selection.SetCaretPosition = function(input, caretPos) {
1166 if(typeof caretPos === "undefined" || caretPos < 0)
1167  caretPos = input.value.length;
1168 Selection.Set(input, caretPos, caretPos, true);
1169};
1170Selection.GetCaretPosition = function(element, isDialogMode) {
1171 var pos = 0;
1172 if("selectionStart" in element) {
1173  pos = element.selectionStart;
1174 } else if("selection" in document) {
1175  element.focus();
1176  var sel = document.selection.createRange(),
1177   selLength = document.selection.createRange().text.length;
1178  sel.moveStart("character", -element.value.length);
1179  pos = sel.text.length - selLength;
1180 }
1181 if(isDialogMode && !pos) {
1182  pos = element.value.length - 1;
1183 }
1184 return pos;
1185};
1186Selection.Clear = function() {
1187 try {
1188  if(window.getSelection) {
1189   window.getSelection().removeAllRanges();
1190  }
1191  else if(document.selection) {
1192   if(document.selection.empty)
1193    document.selection.empty();
1194   else if(document.selection.clear)
1195    document.selection.clear();
1196  }
1197 } catch(e) {
1198 }
1199};
1200Selection.ClearOnMouseMove = function(evt) {
1201 if(!Browser.IE || (evt.button != 0)) 
1202  Selection.Clear();
1203};
1204Selection.SetElementSelectionEnabled = function(element, value) {
1205 var userSelectValue = value ? "" : "none";
1206 var func = value ? Evt.DetachEventFromElement : Evt.AttachEventToElement;
1207 if(Browser.Firefox)
1208  element.style.MozUserSelect = userSelectValue;
1209 else if(Browser.WebKitFamily)
1210  element.style.webkitUserSelect = userSelectValue;
1211 else if(Browser.IE && Browser.Version > 10 || Browser.Edge)
1212  element.style.msUserSelect = userSelectValue;
1213 else if(Browser.Opera)
1214  func(element, "mousemove", Selection.Clear);
1215 else {
1216  func(element, "selectstart", ASPx.FalseFunction);
1217  func(element, "mousemove", Selection.Clear);
1218 }
1219};
1220Selection.SetElementAsUnselectable = function(element, isWithChild, recursive) {
1221 if(element && element.nodeType == 1) {
1222  element.unselectable = "on";
1223  if(Browser.NetscapeFamily)
1224   element.onmousedown = ASPx.FalseFunction;
1225  if((Browser.IE && Browser.Version >= 9) || Browser.WebKitFamily)
1226   Evt.AttachEventToElement(element, "mousedown", Evt.PreventEventAndBubble);
1227  if(isWithChild === true){
1228   for(var j = 0; j < element.childNodes.length; j ++)
1229    Selection.SetElementAsUnselectable(element.childNodes[j], (!!recursive ? true : false), (!!recursive));
1230  }
1231 }
1232};
1233Selection.AreEqual = function(selection1, selection2) {
1234 return selection1.startPos === selection2.startPos && selection1.endPos === selection2.endPos;
1235};
1236ASPx.Selection = Selection;
1237var MouseScroller = { };
1238MouseScroller.MinimumOffset = 10;
1239MouseScroller.Create = function(getElement, getScrollXElement, getScrollYElement, needPreventScrolling, vertRecursive, onMouseDown, onMouseMove, onMouseUp, onMouseUpMissed) {
1240 var element = getElement();
1241 if(!element) 
1242  return;
1243 if(!element.dxMouseScroller)
1244  element.dxMouseScroller = new MouseScroller.Extender(getElement, getScrollXElement, getScrollYElement, needPreventScrolling, vertRecursive, onMouseDown, onMouseMove, onMouseUp, onMouseUpMissed);
1245 return element.dxMouseScroller;
1246};
1247MouseScroller.Extender = function(getElement, getScrollXElement, getScrollYElement, needPreventScrolling, vertRecursive, onMouseDown, onMouseMove, onMouseUp, onMouseUpMissed) {
1248 this.getElement = getElement;
1249 this.getScrollXElement = getScrollXElement;
1250 this.getScrollYElement = getScrollYElement;
1251 this.needPreventScrolling = needPreventScrolling;
1252 this.vertRecursive = !!vertRecursive;
1253 this.createHandlers(onMouseDown || function() { }, onMouseMove || function() { }, onMouseUp || function() { }, onMouseUpMissed || function() { });
1254 this.update();
1255};
1256MouseScroller.Extender.prototype = {
1257 update: function() {
1258  if(this.element)
1259   Evt.DetachEventFromElement(this.element, ASPx.TouchUIHelper.touchMouseDownEventName, this.mouseDownHandler);
1260  this.element = this.getElement();
1261  Evt.AttachEventToElement(this.element, ASPx.TouchUIHelper.touchMouseDownEventName, this.mouseDownHandler);  
1262  Evt.AttachEventToElement(this.element, "click", this.mouseClickHandler);   
1263  if(Browser.MSTouchUI && this.element.className.indexOf(ASPx.TouchUIHelper.msTouchDraggableClassName) < 0)
1264   this.element.className += " " + ASPx.TouchUIHelper.msTouchDraggableClassName;
1265  this.scrollXElement = this.getScrollXElement();
1266  this.scrollYElement = this.getScrollYElement();
1267 },
1268 createHandlers: function(onMouseDown, onMouseMove, onMouseUp, onMouseUpMissed) {
1269  var mouseDownCounter = 0;
1270  this.onMouseDown = onMouseDown;
1271  this.onMouseMove = onMouseMove;
1272  this.onMouseUp = onMouseUp;  
1273  this.mouseDownHandler = function(e) {
1274   if(mouseDownCounter++ > 0) {
1275    this.finishScrolling();
1276    onMouseUpMissed();
1277   }
1278   var eventSource = Evt.GetEventSource(e);
1279   var requirePreventCustonScroll = ASPx.IsExists(ASPx.TouchUIHelper.RequirePreventCustomScroll) && ASPx.TouchUIHelper.RequirePreventCustomScroll(eventSource, this.element);
1280   this.requirePreventScroll = requirePreventCustonScroll || this.needPreventScrolling && this.needPreventScrolling(eventSource);
1281   if(this.requirePreventScroll)
1282    return;
1283   this.scrollableTreeLine = this.GetScrollableElements();
1284   this.firstX = this.prevX = Evt.GetEventX(e);
1285   this.firstY = this.prevY = Evt.GetEventY(e);
1286   Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseMoveEventName, this.mouseMoveHandler);
1287   Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseUpEventName, this.mouseUpHandler);
1288   this.onMouseDown(e);
1289  }.aspxBind(this);
1290  this.mouseMoveHandler = function(e) {
1291   if(ASPx.TouchUIHelper.isGesture)
1292    return;
1293   var x = Evt.GetEventX(e);
1294   var y = Evt.GetEventY(e);
1295   var xDiff = this.prevX - x;
1296   var yDiff = this.prevY - y;
1297   if(this.vertRecursive) {
1298    var isTopDirection = yDiff < 0;
1299    this.scrollYElement = this.GetElementForVertScrolling(isTopDirection, this.prevIsTopDirection, this.scrollYElement);
1300    this.prevIsTopDirection = isTopDirection;
1301   }
1302   if(this.scrollXElement && xDiff != 0)
1303    this.scrollXElement.scrollLeft += xDiff;
1304   if(this.scrollYElement && yDiff != 0) {
1305    this.scrollYElement.scrollTop += yDiff;
1306    var isOuterScrollableElement = this.scrollableTreeLine[this.scrollableTreeLine.length - 1] == this.scrollYElement;
1307    if(isOuterScrollableElement)
1308     y += yDiff;
1309   }
1310   this.prevX = x;
1311   this.prevY = y;
1312   Evt.PreventEvent(e);
1313   this.onMouseMove(e);
1314  }.aspxBind(this);
1315  this.mouseUpHandler = function(e) {
1316   this.finishScrolling();
1317   this.onMouseUp(e);
1318  }.aspxBind(this);
1319  this.mouseClickHandler = function(e){
1320   if(this.requirePreventScroll || (ASPx.IsExists(e.isTrusted) && !e.isTrusted))
1321    return;
1322   var xDiff = this.firstX - Evt.GetEventX(e);
1323   var yDiff = this.firstY - Evt.GetEventY(e);
1324   if(xDiff > MouseScroller.MinimumOffset || yDiff > MouseScroller.MinimumOffset)
1325    return Evt.PreventEventAndBubble(e);
1326  }.aspxBind(this);
1327  this.finishScrolling = function() {
1328   Evt.DetachEventFromDocument(ASPx.TouchUIHelper.touchMouseMoveEventName, this.mouseMoveHandler);
1329   Evt.DetachEventFromDocument(ASPx.TouchUIHelper.touchMouseUpEventName, this.mouseUpHandler);
1330   this.scrollableTreeLine = [];
1331   this.prevIsTopDirection = null;
1332   mouseDownCounter--;
1333  };
1334 },
1335 GetScrollableElements: function() {
1336  if(!this.vertRecursive) return [ ];
1337  var isHtmlScrollableElement = !ASPx.Browser.IsQuirksMode && !ASPx.Browser.Safari;
1338  var outerScrollableElementTag = isHtmlScrollableElement ? "HTML" : "BODY";
1339  return ASPx.GetElementTreeLine(this.element, null, function(el) { return el == document; })
1340   .filter(function(el) {
1341    var tagName = el.tagName;
1342    if(isHtmlScrollableElement && tagName == "BODY")
1343     return false;
1344    return ASPx.IsScrollableElement(el, false, true) || tagName == outerScrollableElementTag || el.dxScrollable;
1345   }.bind(this));
1346 },
1347 GetElementForVertScrolling: function(currentIsTop, prevIsTop, prevElement) {
1348  if(prevElement && currentIsTop === prevIsTop && this.GetVertScrollExcess(prevElement, currentIsTop) > 0)
1349   return prevElement;
1350  for(var i = 0; i < this.scrollableTreeLine.length; i++) {
1351   var element = this.scrollableTreeLine[i];
1352   var excess = this.GetVertScrollExcess(element, currentIsTop);
1353   if(excess > 0)
1354    return element;
1355  }
1356  return null;
1357 },
1358 GetVertScrollExcess: function(element, isTop) {
1359  if(isTop)
1360   return element.scrollTop;
1361  var isDocument = element.tagName == "HTML" || ASPx.Browser.Safari && !ASPx.Browser.IsQuirksMode && element.tagName == "BODY";
1362  var clientHeight = isDocument ? ASPx.GetDocumentClientHeight() : element.clientHeight;
1363  return element.scrollHeight - clientHeight - element.scrollTop;
1364 }
1365};
1366ASPx.MouseScroller = MouseScroller;
1367var Evt = { };
1368Evt.GetEvent = function(evt){
1369 return (typeof(event) != "undefined" && event != null && Browser.IE) ? event : evt; 
1370};
1371Evt.IsEventPrevented = function(evt) {
1372 return evt.defaultPrevented || evt.returnValue === false;
1373};
1374Evt.PreventEvent = function(evt){
1375 if(evt.preventDefault) {
1376  if(evt.cancelable)
1377   evt.preventDefault();
1378 }
1379 else
1380  evt.returnValue = false;
1381 return false;
1382};
1383Evt.PreventEventAndBubble = function(evt){
1384 Evt.PreventEvent(evt);
1385 if(evt.stopPropagation)
1386  evt.stopPropagation();
1387 evt.cancelBubble = true;
1388 return false;
1389};
1390Evt.CancelBubble = function(evt){
1391 evt.stopPropagation();
1392 return false;
1393};
1394Evt.PreventImageDragging = function(image) {
1395 if(image)
1396  image.ondragstart = function() { return false; };
1397};
1398Evt.PreventDragStart = function(evt) {
1399 evt = Evt.GetEvent(evt);
1400 var element = Evt.GetEventSource(evt);
1401 if(element.releaseCapture)
1402  element.releaseCapture(); 
1403 return false;
1404};
1405Evt.PreventElementDrag = function(element) {
1406 if(Browser.IE)
1407  Evt.AttachEventToElement(element, "dragstart", Evt.PreventEvent);
1408 else
1409  Evt.AttachEventToElement(element, "mousedown", Evt.PreventEvent);
1410};
1411Evt.PreventElementDragAndSelect = function(element, skipMouseMove, skipIESelect){
1412 if(Browser.WebKitFamily)
1413  Evt.AttachEventToElement(element, "selectstart", Evt.PreventEventAndBubble);
1414 if(Browser.IE){
1415  if(!skipIESelect)
1416   Evt.AttachEventToElement(element, "selectstart", ASPx.FalseFunction);
1417  if(!skipMouseMove)
1418   Evt.AttachEventToElement(element, "mousemove", Selection.ClearOnMouseMove);
1419  Evt.AttachEventToElement(element, "dragstart", Evt.PreventDragStart);
1420 }
1421};
1422Evt.GetEventSource = function(evt){
1423 if(!ASPx.IsExists(evt)) return null; 
1424 return evt.srcElement ? evt.srcElement : evt.target;
1425};
1426Evt.GetKeyCode = function(srcEvt) {
1427 return Browser.NetscapeFamily || Browser.Opera ? srcEvt.which : srcEvt.keyCode;
1428};
1429function clientEventRequiresDocScrollCorrection() {
1430 var isSafariVerLess3 = Browser.Safari && Browser.Version < 3,
1431  isMacOSMobileVerLess51 = Browser.MacOSMobilePlatform && Browser.Version < 5.1;
1432 return Browser.AndroidDefaultBrowser || Browser.AndroidChromeBrowser || !(isSafariVerLess3 || isMacOSMobileVerLess51);
1433}
1434Evt.GetEventX = function(evt){
1435 if(ASPx.TouchUIHelper.isTouchEvent(evt))
1436  return ASPx.TouchUIHelper.getEventX(evt);
1437 return evt.clientX + (clientEventRequiresDocScrollCorrection() ? ASPx.GetDocumentScrollLeft() : 0);
1438};
1439Evt.GetEventY = function(evt){
1440 if(ASPx.TouchUIHelper.isTouchEvent(evt))
1441  return ASPx.TouchUIHelper.getEventY(evt);
1442 return evt.clientY + (clientEventRequiresDocScrollCorrection() ? ASPx.GetDocumentScrollTop() : 0 );
1443};
1444Evt.IsLeftButtonPressed = function(evt) {
1445 if(ASPx.TouchUIHelper.isTouchEvent(evt))
1446  return true;
1447 evt = Evt.GetEvent(evt);
1448 if(!evt) return false;
1449 if(Browser.IE && Browser.Version < 11) {
1450  if(Browser.MSTouchUI)
1451   return true;
1452  return evt.button % 2 == 1; 
1453 } else if(Browser.WebKitFamily) {
1454  if(evt.type === "pointermove")
1455   return evt.buttons === 1;
1456  return evt.which == 1;
1457 } else if(Browser.NetscapeFamily || Browser.Edge || (Browser.IE && Browser.Version >= 11)) {
1458  if(evt.type === ASPx.TouchUIHelper.touchMouseMoveEventName)
1459   return evt.buttons === 1;
1460  return evt.which == 1;
1461 } else if(Browser.Opera)
1462  return evt.button == 0;
1463 return true;
1464};
1465Evt.IsRightButtonPressed = function(evt){
1466 evt = Evt.GetEvent(evt);
1467 if(!ASPx.IsExists(evt)) return false;
1468 if(Browser.IE || Browser.Edge) {
1469  if(evt.type === "pointermove")
1470   return evt.buttons === 2;
1471  return evt.button == 2;
1472 }
1473 else if(Browser.NetscapeFamily || Browser.WebKitFamily)
1474  return evt.which == 3;
1475 else if (Browser.Opera)
1476  return evt.button == 1;
1477 return true;
1478};
1479Evt.GetWheelDelta = function(evt) {
1480 var ret;
1481 if(Browser.NetscapeFamily && Browser.MajorVersion < 17)
1482  ret = -evt.detail;
1483 else if(Browser.Safari)
1484  ret = evt.wheelDelta;
1485 else
1486  ret = -evt.deltaY;
1487 if(Browser.Opera && Browser.Version < 9)
1488  ret = -ret;
1489 return ret;
1490};
1491Evt.IsWheelEventWithDirection = function(evt) {
1492 return ASPx.Data.ArrayContains(["wheel", "mousewheel"], evt.type);
1493};
1494Evt.GetWheelDeltaX = function(evt) {
1495 if(evt.type === "wheel")
1496  return -evt.deltaX;
1497 if(evt.type === "mousewheel")
1498  return evt.wheelDeltaX;
1499};
1500Evt.GetWheelDeltaY = function(evt) {
1501 if(evt.type === "wheel")
1502  return -evt.deltaY;
1503 if(evt.type === "mousewheel")
1504  return evt.wheelDeltaY;
1505};
1506Evt.IsPassiveListenersSupported = function() {
1507 if(Browser.Chrome && Browser.MajorVersion > 69 || Browser.Edge && Browser.MajorVersion > 15 || Browser.Firefox && Browser.MajorVersion > 62)
1508  return true;
1509 if(Evt.isPassiveListenersSupported === undefined) {
1510  Evt.isPassiveListenersSupported = false;
1511  try {
1512   var options = Object.defineProperty({}, "passive", { get: function() { Evt.isPassiveListenersSupported = true; } });
1513   window.addEventListener("test", options, options);
1514   window.removeEventListener("test", options, options);
1515  }
1516  catch(err) { Evt.isPassiveListenersSupported = false; }
1517 }
1518 return !!Evt.isPassiveListenersSupported;
1519};
1520Evt.AttachEventToElement = function(element, eventName, func, onlyBubbling, passive) {
1521 if(element.addEventListener)
1522  element.addEventListener(eventName, func, Evt.IsPassiveListenersSupported() ? { capture: !onlyBubbling, passive: !!passive } : !onlyBubbling);
1523 else
1524  element.attachEvent("on" + eventName, func);
1525};
1526Evt.DetachEventFromElement = function(element, eventName, func, onlyBubbling) {
1527 if(element.removeEventListener)
1528  element.removeEventListener(eventName, func, Evt.IsPassiveListenersSupported() ? { capture: !onlyBubbling } : !onlyBubbling);
1529 else
1530  element.detachEvent("on" + eventName, func);
1531};
1532Evt.AttachEventToDocument = function(eventName, func) {
1533 var attachingAllowed = ASPx.TouchUIHelper.onEventAttachingToDocument(eventName, func);
1534 if(attachingAllowed)
1535  Evt.AttachEventToDocumentCore(eventName, func);
1536};
1537Evt.AttachEventToDocumentCore = function(eventName, func) {
1538 Evt.AttachEventToElement(document, eventName, func);
1539};
1540Evt.DetachEventFromDocument = function(eventName, func) {
1541 Evt.DetachEventFromDocumentCore(eventName, func);
1542 ASPx.TouchUIHelper.onEventDettachedFromDocument(eventName, func);
1543};
1544Evt.DetachEventFromDocumentCore = function(eventName, func){
1545 Evt.DetachEventFromElement(document, eventName, func);
1546};
1547Evt.GetMouseWheelEventName = function() {
1548 if(Browser.Safari)
1549  return "mousewheel";
1550 if(Browser.NetscapeFamily && Browser.MajorVersion < 17)
1551  return "DOMMouseScroll";
1552 return "wheel";
1553};
1554Evt.AttachMouseEnterToElement = function (element, onMouseOverHandler, onMouseOutHandler) {
1555 Evt.AttachEventToElement(element, ASPx.TouchUIHelper.pointerEnabled ? ASPx.TouchUIHelper.pointerOverEventName : "mouseover", function (evt) { mouseEnterHandler(evt, element, onMouseOverHandler, onMouseOutHandler); });
1556 Evt.AttachEventToElement(element, ASPx.TouchUIHelper.pointerEnabled ? ASPx.TouchUIHelper.pointerOutEventName : "mouseout", function (evt) { mouseEnterHandler(evt, element, onMouseOverHandler, onMouseOutHandler); });
1557};
1558Evt.GetEventRelatedTarget = function(evt, isMouseOverEvent) {
1559 return evt.relatedTarget || (isMouseOverEvent ? evt.srcElement : evt.toElement);
1560};
1561function mouseEnterHandler(evt, element, onMouseOverHandler, onMouseOutHandler) {
1562 var isMouseOverExecuted = !!element.dxMouseOverExecuted;
1563 var isMouseOverEvent = (evt.type == "mouseover" || evt.type == ASPx.TouchUIHelper.pointerOverEventName);
1564 if(isMouseOverEvent && isMouseOverExecuted || !isMouseOverEvent && !isMouseOverExecuted)
1565  return;
1566 var source = Evt.GetEventRelatedTarget(evt, isMouseOverEvent);
1567 if(!ASPx.GetIsParent(element, source)) {
1568  element.dxMouseOverExecuted = isMouseOverEvent;
1569  if(isMouseOverEvent)
1570   onMouseOverHandler(element);
1571  else
1572   onMouseOutHandler(element);
1573 }
1574 else if(isMouseOverEvent && !isMouseOverExecuted) {
1575  element.dxMouseOverExecuted = true;
1576  onMouseOverHandler(element);
1577 }
1578}
1579Evt.DispatchEvent = function(target, eventName, canBubble, cancellable) {
1580 var event;
1581 if(Browser.IE && Browser.Version < 9) {
1582  eventName = "on" + eventName;
1583  if(eventName in target) {
1584   event = document.createEventObject();
1585   target.fireEvent("on" + eventName, event);
1586  }
1587 } else {
1588  event = document.createEvent("Event");
1589  event.initEvent(eventName, canBubble || false, cancellable || false);
1590  target.dispatchEvent(event);
1591 }
1592};
1593Evt.EmulateDocumentOnMouseDown = function(evt) {
1594 Evt.EmulateOnMouseDown(document, evt);
1595};
1596Evt.EmulateOnMouseDown = function(element, evt) {
1597 if(Browser.IE && Browser.Version < 9)
1598  element.fireEvent("onmousedown", evt);
1599 else if(!Browser.WebKitFamily){
1600  var emulatedEvt = document.createEvent("MouseEvents");
1601  emulatedEvt.initMouseEvent("mousedown", true, true, window, 0, evt.screenX, evt.screenY, 
1602   evt.clientX, evt.clientY, evt.ctrlKey, evt.altKey, evt.shiftKey, false, 0, null);
1603  element.dispatchEvent(emulatedEvt);
1604 }
1605};
1606Evt.EmulateOnMouseEvent = function (type, element, evt) {
1607 evt.type = type;
1608 var emulatedEvt = document.createEvent("MouseEvents");
1609 emulatedEvt.initMouseEvent(type, true, true, window, 0, evt.screenX, evt.screenY,
1610  evt.clientX, evt.clientY, evt.ctrlKey, evt.altKey, evt.shiftKey, false, 0, null);
1611 emulatedEvt.target = element;
1612 element.dispatchEvent(emulatedEvt);
1613};
1614Evt.EmulateMouseClick = function (element, evt) {
1615 var x = ASPx.GetElementOffsetWidth(element) / 2;
1616 var y = ASPx.GetElementOffsetHeight(element) / 2;
1617 if (!evt)
1618  evt = {
1619   bubbles: true,
1620   cancelable: true,
1621   view: window,
1622   detail: 1,
1623   screenX: 0,
1624   screenY: 0,
1625   clientX: x,
1626   clientY: y,
1627   ctrlKey: false,
1628   altKey: false,
1629   shiftKey: false,
1630   metaKey: false,
1631   button: 0,
1632   relatedTarget: null
1633  };
1634 Evt.EmulateOnMouseEvent("mousedown", element, evt);
1635 Evt.EmulateOnMouseEvent("mouseup", element, evt);
1636 Evt.EmulateOnMouseEvent("click", element, evt);
1637};
1638Evt.DoElementClick = function(element) {
1639 try{
1640  element.click();
1641 }
1642 catch(e){ 
1643 }
1644};
1645Evt.IsActionKeyPressed = function(evt) {
1646 return evt.keyCode === ASPx.Key.Space ||
1647     evt.keyCode === ASPx.Key.Enter ||
1648    (evt.keyCode === ASPx.Key.Down && evt.altKey);
1649};
1650Evt.InvokeMouseClickByKeyDown = function(evt, handler) {
1651 if(Evt.IsActionKeyPressed(evt)) {
1652  ASPx.Evt.PreventEvent(evt); 
1653  if(!handler)
1654   ASPx.Evt.GetEventSource(evt).onclick();
1655  else
1656   handler(evt);
1657 }
1658};
1659Evt.AttachContextMenuToElement = function (element, handler, onlyBubbling) {
1660 if (ASPx.TouchUIHelper.useLongTapHelper())
1661  element.detachContextMenuEventHandler = ASPx.TouchUIHelper.attachLongTapHandler(element, handler, onlyBubbling);
1662 else
1663  Evt.AttachEventToElement(element, "contextmenu", handler, onlyBubbling);
1664};
1665Evt.DetachContextMenuFromElement = function (element, handler) {
1666 if (element.detachContextMenuEventHandler)
1667  element.detachContextMenuEventHandler();
1668 else
1669  Evt.DetachEventFromElement(element, "contextmenu", handler);
1670};
1671Evt.PreventContextMenuOnElement = function(element) {
1672 Evt.AttachContextMenuToElement(element, function(evt) {
1673  Evt.PreventEvent(evt);
1674 });
1675};
1676ASPx.Evt = Evt;
1677var Attr = { };
1678Attr.GetAttribute = function(obj, attrName){
1679 if(obj.getAttribute)
1680  return obj.getAttribute(attrName);
1681 else if(obj.getPropertyValue) {
1682  if(Browser.Firefox) { 
1683   try {
1684    return obj.getPropertyValue(attrName);
1685   } catch(e) {
1686    return obj[attrName];
1687   }
1688  }
1689  return obj.getPropertyValue(attrName);
1690 }
1691 return null;
1692};
1693Attr.SetAttribute = function(obj, attrName, value){
1694 if(obj.setAttribute) {
1695  if(isSourceResetRequired() && attrName.toLowerCase() === "src") 
1696   obj.setAttribute(attrName, "");
1697  obj.setAttribute(attrName, value);
1698 } else if(obj.setProperty)
1699  obj.setProperty(attrName, value, "");
1700};
1701Attr.ToggleAttribute = function(obj, attrName, value, condition) {
1702 if(condition)
1703  Attr.SetAttribute(obj, attrName, value);
1704 else
1705  Attr.RemoveAttribute(obj, attrName);
1706};
1707Attr.RemoveAttribute = function(obj, attrName){
1708 if(obj.removeAttribute)
1709  obj.removeAttribute(attrName);
1710 else if(obj.removeProperty)
1711  obj.removeProperty(attrName);
1712};
1713Attr.IsExistsAttribute = function(obj, attrName){
1714 var value = Attr.GetAttribute(obj, attrName);
1715 return (value != null) && (value !== "");
1716};
1717Attr.SetOrRemoveAttribute = function(obj, attrName, value) {
1718 if(!value)
1719  Attr.RemoveAttribute(obj, attrName);
1720 else
1721  Attr.SetAttribute(obj, attrName, value);
1722};
1723Attr.SaveAttribute = function(obj, attrName, savedObj, savedAttrName){
1724 if(!Attr.IsExistsAttribute(savedObj, savedAttrName)){
1725  var oldValue = Attr.IsExistsAttribute(obj, attrName) ? Attr.GetAttribute(obj, attrName) : ASPx.EmptyObject;
1726  Attr.SetAttribute(savedObj, savedAttrName, oldValue);
1727 }
1728};
1729Attr.SaveStyleAttribute = function(obj, attrName){
1730 Attr.SaveAttribute(obj.style, attrName, obj, "saved" + attrName);
1731};
1732Attr.ChangeAttributeExtended = function(obj, attrName, savedObj, savedAttrName, newValue){
1733 Attr.SaveAttribute(obj, attrName, savedObj, savedAttrName);
1734 Attr.SetAttribute(obj, attrName, newValue);
1735};
1736Attr.ChangeAttribute = function(obj, attrName, newValue){
1737 Attr.ChangeAttributeExtended(obj, attrName, obj, "saved" + attrName, newValue);
1738};
1739Attr.ChangeStyleAttribute = function(obj, attrName, newValue){
1740 Attr.ChangeAttributeExtended(obj.style, attrName, obj, "saved" + attrName, newValue);
1741};
1742Attr.ResetAttributeExtended = function(obj, attrName, savedObj, savedAttrName){
1743 Attr.SaveAttribute(obj, attrName, savedObj, savedAttrName);
1744 Attr.SetAttribute(obj, attrName, "");
1745 Attr.RemoveAttribute(obj, attrName);
1746};
1747Attr.ResetAttribute = function(obj, attrName){
1748 Attr.ResetAttributeExtended(obj, attrName, obj, "saved" + attrName);
1749};
1750Attr.ResetStyleAttribute = function(obj, attrName){
1751 Attr.ResetAttributeExtended(obj.style, attrName, obj, "saved" + attrName);
1752};
1753Attr.RestoreAttributeExtended = function(obj, attrName, savedObj, savedAttrName){
1754 if(Attr.IsExistsAttribute(savedObj, savedAttrName)){
1755  var oldValue = Attr.GetAttribute(savedObj, savedAttrName);
1756  if(oldValue != ASPx.EmptyObject)
1757   Attr.SetAttribute(obj, attrName, oldValue);
1758  else
1759   Attr.RemoveAttribute(obj, attrName);
1760  Attr.RemoveAttribute(savedObj, savedAttrName);
1761  return true;
1762 }
1763 return false;
1764};
1765Attr.RestoreAttribute = function(obj, attrName){
1766 return Attr.RestoreAttributeExtended(obj, attrName, obj, "saved" + attrName);
1767};
1768Attr.RestoreStyleAttribute = function(obj, attrName){
1769 return Attr.RestoreAttributeExtended(obj.style, attrName, obj, "saved" + attrName);
1770};
1771Attr.CopyAllAttributes = function(sourceElem, destElement) {
1772 var attrs = sourceElem.attributes;
1773 for(var n = 0; n < attrs.length; n++) {
1774  var attr = attrs[n];
1775  if(attr.specified) {
1776   var attrName = attr.nodeName;
1777   var attrValue = sourceElem.getAttribute(attrName, 2);
1778   if(attrValue == null)
1779    attrValue = attr.nodeValue;
1780   destElement.setAttribute(attrName, attrValue, 0); 
1781  }
1782 }
1783 if(sourceElem.style.cssText !== '')
1784  destElement.style.cssText = sourceElem.style.cssText;
1785};
1786Attr.RemoveAllAttributes = function(element, excludedAttributes) {
1787 var excludedAttributesHashTable = {};
1788 if(excludedAttributes)
1789  excludedAttributesHashTable = Data.CreateHashTableFromArray(excludedAttributes);
1790 if(element.attributes) {
1791  var attrArray = element.attributes;
1792  for(var i = 0; i < attrArray.length; i++) {
1793   var attrName = attrArray[i].name;
1794   if(!ASPx.IsExists(excludedAttributesHashTable[attrName.toLowerCase()])) {
1795    try {
1796     attrArray.removeNamedItem(attrName);
1797    } catch (e) { }
1798   }
1799  }
1800 }
1801};
1802Attr.RemoveStyleAttribute = function(element, attrName) {
1803 if(element.style) {
1804  if(Browser.Firefox && element.style[attrName]) 
1805   element.style[attrName] = "";
1806  if(element.style.removeAttribute && element.style.removeAttribute != "")
1807   element.style.removeAttribute(attrName);
1808  else if(element.style.removeProperty && element.style.removeProperty != "")
1809   element.style.removeProperty(attrName);
1810 }
1811};
1812Attr.RemoveAllStyles = function(element) {
1813 if(element.style) {
1814  for(var key in element.style)
1815   Attr.RemoveStyleAttribute(element, key);
1816    Attr.RemoveAttribute(element, "style");
1817 }
1818};
1819Attr.GetTabIndexAttributeName = function(){
1820 return Browser.IE  ? "tabIndex" : "tabindex";
1821};
1822Attr.ChangeTabIndexAttribute = function(element){
1823 var attribute = Attr.GetTabIndexAttributeName(); 
1824 if(Attr.GetAttribute(element, attribute) != -1)
1825    Attr.ChangeAttribute(element, attribute, -1);
1826};
1827Attr.SaveTabIndexAttributeAndReset = function(element) {
1828 var attribute = Attr.GetTabIndexAttributeName();
1829 Attr.SaveAttribute(element, attribute, element, "saved" + attribute);
1830 Attr.SetAttribute(element, attribute, -1);
1831};
1832Attr.RestoreTabIndexAttribute = function(element){
1833 var attribute = Attr.GetTabIndexAttributeName();
1834 if(Attr.IsExistsAttribute(element, attribute)) {
1835  if(Attr.GetAttribute(element, attribute) == -1) {
1836   if(Attr.IsExistsAttribute(element, "saved" + attribute)){
1837    var oldValue = Attr.GetAttribute(element, "saved" + attribute);
1838    if(oldValue != ASPx.EmptyObject)
1839     Attr.SetAttribute(element, attribute, oldValue);
1840    else {
1841     if(Browser.WebKitFamily) 
1842      Attr.SetAttribute(element, attribute, 0); 
1843     Attr.RemoveAttribute(element, attribute);   
1844    }
1845    Attr.RemoveAttribute(element, "saved" + attribute); 
1846   }
1847  }
1848 }
1849};
1850Attr.ChangeAttributesMethod = function(enabled){
1851 return enabled ? Attr.RestoreAttribute : Attr.ResetAttribute;
1852};
1853Attr.InitiallyChangeAttributesMethod = function(enabled){
1854 return enabled ? Attr.ChangeAttribute : Attr.ResetAttribute;
1855};
1856Attr.ChangeStyleAttributesMethod = function(enabled){
1857 return enabled ? Attr.RestoreStyleAttribute : Attr.ResetStyleAttribute;
1858};
1859Attr.InitiallyChangeStyleAttributesMethod = function(enabled){
1860 return enabled ? Attr.ChangeStyleAttribute : Attr.ResetStyleAttribute;
1861};
1862Attr.ChangeEventsMethod = function(enabled){
1863 return enabled ? Evt.AttachEventToElement : Evt.DetachEventFromElement;
1864};
1865Attr.ChangeDocumentEventsMethod = function(enabled){
1866 return enabled ? Evt.AttachEventToDocument : Evt.DetachEventFromDocument;
1867};
1868Attr.ChangeCellSpanCount = function(cell, value, isColumnSpan) {
1869 if(!cell) return;
1870 var propertyKey = isColumnSpan ? "colSpan" : "rowSpan";
1871 var prevValue = cell[propertyKey];
1872 if(value > 1)
1873  cell[propertyKey] = value;
1874 else if(prevValue !== 1)
1875  Attr.RemoveAttribute(cell, propertyKey);
1876};
1877function isSourceResetRequired() {
1878 return Browser.IE && Browser.MajorVersion >= 11;
1879}
1880Attr.AppendScriptType = function(script) {
1881 if(!isHtml5Mode())
1882  script.type = "text/javascript";
1883};
1884Attr.AppendStyleType = function(style) {
1885 if(!isHtml5Mode())
1886  style.type = "text/css";
1887};
1888function isHtml5Mode() {
1889 return ASPx.DoctypeMode === "Html5";
1890}
1891ASPx.Attr = Attr;
1892var Aria = {
1893 atomic: "aria-atomic",
1894 checked: "aria-checked",
1895 descendant: "aria-activedescendant",
1896 described: "aria-describedby",
1897 disabled: "aria-disabled",
1898 expanded: "aria-expanded",
1899 haspopup: "aria-haspopup",
1900 invalid: "aria-invalid",
1901 label: "aria-label",
1902 labelled: "aria-labelledby",
1903 level: "aria-level",
1904 owns: "aria-owns",
1905 posinset: "aria-posinset",
1906 role: "role",
1907 selected: "aria-selected",
1908 setsize: "aria-setsize",
1909 valuemax: "aria-valuemax",
1910 valuemin: "aria-valuemin",
1911 valuenow: "aria-valuenow"
1912};
1913Aria.SetOrRemoveDescendant = function(obj, value) {
1914 ASPx.Attr.SetOrRemoveAttribute(obj, Aria.descendant, value);
1915};
1916Aria.SetOrRemoveLabel = function(obj, value) {
1917 ASPx.Attr.SetOrRemoveAttribute(obj, Aria.label, value);
1918};
1919Aria.SetOrRemoveDisabled = function(obj, value) {
1920 ASPx.Attr.SetOrRemoveAttribute(obj, Aria.disabled, value);
1921};
1922Aria.AppendLabel = function(obj, value, checkExists) {
1923 var currentValue = ASPx.Attr.GetAttribute(obj, Aria.label) || "";
1924 var resultParts = [ ];
1925 if(currentValue)
1926  resultParts.push(currentValue);
1927 var needAppendValue = value && (!checkExists || currentValue.indexOf(value) == -1);
1928 if(needAppendValue)
1929  resultParts.push(value);
1930 ASPx.Attr.SetAttribute(obj, Aria.label, resultParts.join(" "));
1931};
1932Aria.SetOrRemoveLabelled = function(obj, value) {
1933 ASPx.Attr.SetOrRemoveAttribute(obj, Aria.labelled, value);
1934};
1935Aria.SetApplicationRole = function(obj) {
1936  ASPx.Attr.SetAttribute(obj, Aria.role, "application");
1937};
1938Aria.SetSilence = function(obj) {
1939 ASPx.Attr.SetAttribute(obj, Aria.label, ";");
1940};
1941Aria.SetExpanded = function(obj, expanded) {
1942 if(!obj || !ASPx.Attr.GetAttribute(obj, Aria.expanded)) return;
1943 Aria.SetBoolAttribute(obj, Aria.expanded, expanded);
1944};
1945Aria.SetAtomic = function(obj, value) {
1946 Aria.SetBoolAttribute(obj, Aria.atomic, value);
1947};
1948Aria.SetBoolAttribute = function(obj, attribute, value) {
1949 if(value)
1950  ASPx.Attr.SetAttribute(obj, attribute, true);
1951 else 
1952  ASPx.Attr.SetAttribute(obj, attribute, false);
1953};
1954ASPx.Attr.Aria = Aria;
1955var Color = { };
1956function _aspxToHex(d) {
1957 return (d < 16) ? ("0" + d.toString(16)) : d.toString(16);
1958}
1959Color.RGBRegexp = /rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/;
1960Color.RGBARegexp = /rgba?\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*,?\s*([0-9]*\.?[0-9]*)\s*\)/;
1961Color.ColorToHexadecimal = function(colorValue, isRGBA) {
1962 if(typeof(colorValue) == "number") {
1963  var r = colorValue & 0xFF;
1964  var g = (colorValue >> 8) & 0xFF;
1965  var b = (colorValue >> 16) & 0xFF;
1966  return "#" + _aspxToHex(r) + _aspxToHex(g) + _aspxToHex(b);
1967 }
1968 if(colorValue && (colorValue.substr(0, 3).toLowerCase() == "rgb")) {
1969  var regResult = colorValue.toLowerCase().match(isRGBA ? Color.RGBARegexp : Color.RGBRegexp);
1970  if(regResult) {
1971   var r = parseInt(regResult[1]);
1972   var g = parseInt(regResult[2]);
1973   var b = parseInt(regResult[3]);
1974   if (isRGBA)
1975    return { r: r, g: g, b: b, a: regResult[4] !== undefined ? parseFloat(regResult[4]) : 1 };
1976   return "#" + _aspxToHex(r) + _aspxToHex(g) + _aspxToHex(b);
1977  }
1978  return null;
1979 } 
1980 if(colorValue && (colorValue.charAt(0) == "#"))
1981  return colorValue;
1982 return null;
1983};
1984Color.Names = {
1985 AddColorNames: function(stringResourcesObj) {
1986  if(stringResourcesObj) {
1987   for(var key in stringResourcesObj)
1988    if(stringResourcesObj.hasOwnProperty(key))
1989     this[key] = stringResourcesObj[key];
1990  }
1991 }
1992};
1993ASPx.Color = Color;
1994var Url = { };
1995Url.Navigate = function(url, target) {
1996 var javascriptPrefix = "javascript:";
1997 if(!url || url === "")
1998  return;
1999 else if(url.indexOf(javascriptPrefix) != -1) 
2000  eval(url.substr(javascriptPrefix.length));
2001 else {
2002  try{
2003   if(target != "")
2004    navigateTo(url, target);
2005   else
2006    location.href = url;
2007  }
2008  catch(e){
2009  }
2010 }
2011};
2012Url.NavigateByLink = function(linkElement) {
2013 Url.Navigate(Attr.GetAttribute(linkElement, "href"), linkElement.target);
2014};
2015Url.GetAbsoluteUrl = function(url) {
2016 if(url)
2017  url = Url.getURLObject(url).href;
2018 return url;
2019};
2020Url.Redirect = function(url) {
2021 if(!ASPx.Browser.IE)
2022  window.location.href = url;
2023 else { 
2024  var fakeLink = document.createElement("a");
2025  fakeLink.href = url;
2026  document.body.appendChild(fakeLink);
2027  try { fakeLink.click(); } catch(e) { } 
2028 }
2029};
2030var absolutePathPrefixes = 
2031 [ "about:", "file:///", "ftp://", "gopher://", "http://", "https://", "javascript:", "mailto:", "news:", "res://", "telnet://", "view-source:" ];
2032Url.isAbsoluteUrl = function(url) {
2033 if (url) {
2034  for (var i = 0; i < absolutePathPrefixes.length; i++) {
2035   if(url.indexOf(absolutePathPrefixes[i]) == 0)
2036    return true;
2037  }
2038 }
2039 return false;
2040};
2041Url.getURLObject = function(url) {
2042 var link = document.createElement('A');
2043 link.href = url || "";
2044 return { 
2045  href: link.href,
2046  protocol: link.protocol,
2047  host: link.host,
2048  port: link.port,
2049  pathname: link.pathname,
2050  search: link.search,
2051  hash: link.hash
2052 }; 
2053};
2054Url.getRootRelativeUrl = function(url) {
2055 return getRelativeUrl(url, !Url.isRootRelativeUrl(url), true); 
2056};
2057Url.getPathRelativeUrl = function(url) {
2058 return getRelativeUrl(url, !Url.isPathRelativeUrl(url), false);
2059};
2060function getRelativeUrl(url, isValid, isRootRelative) {
2061 if(url && !(/data:([^;]+\/?[^;]*)(;charset=[^;]*)?(;base64,)/.test(url)) && isValid) {
2062  var urlObject = Url.getURLObject(url);
2063  var baseUrlObject = Url.getURLObject();
2064  if(!Url.isAbsoluteUrl(url) || urlObject.host === baseUrlObject.host && urlObject.protocol === baseUrlObject.protocol) {
2065   url = urlObject.pathname;
2066   if(!isRootRelative)
2067    url = getPathRelativeUrl(baseUrlObject.pathname, url);
2068   url = url + urlObject.search + urlObject.hash;
2069  }
2070 }
2071 return url;   
2072}
2073function getPathRelativeUrl(baseUrl, url) {
2074 var requestSegments = getSegments(baseUrl, false);
2075 var urlSegments = getSegments(url, true);
2076 return buildPathRelativeUrl(requestSegments, urlSegments, 0, 0, "");
2077}
2078function getSegments(url, addTail) {
2079 var segments = [];
2080 var startIndex = 0;
2081 var endIndex = -1;
2082 while ((endIndex = url.indexOf("/", startIndex)) != -1) {
2083  segments.push(url.substring(startIndex, ++endIndex));
2084  startIndex = endIndex;
2085 }
2086 if(addTail && startIndex < url.length)
2087  segments.push(url.substring(startIndex, url.length)); 
2088 return segments;
2089}
2090function buildPathRelativeUrl(requestSegments, urlSegments, reqIndex, urlIndex, buffer) {
2091 if(urlIndex >= urlSegments.length)
2092  return buffer;
2093 if(reqIndex >= requestSegments.length)
2094  return buildPathRelativeUrl(requestSegments, urlSegments, reqIndex, urlIndex + 1, buffer + urlSegments[urlIndex]);
2095 if(requestSegments[reqIndex] === urlSegments[urlIndex] && urlIndex === reqIndex)
2096  return buildPathRelativeUrl(requestSegments, urlSegments, reqIndex + 1, urlIndex + 1, buffer);
2097 return buildPathRelativeUrl(requestSegments, urlSegments, reqIndex + 1, urlIndex, buffer + "../");
2098}
2099Url.isPathRelativeUrl = function(url) {
2100 return !!url && !Url.isAbsoluteUrl(url) && url.indexOf("/") != 0;  
2101};
2102Url.isRootRelativeUrl = function(url) {
2103 return !!url && !Url.isAbsoluteUrl(url) && url.indexOf("/") == 0 && url.indexOf("//") != 0;
2104};
2105function navigateTo(url, target) {
2106 var lowerCaseTarget = target.toLowerCase();
2107 if("_top" == lowerCaseTarget)
2108  top.location.href = url;
2109 else if("_self" == lowerCaseTarget)
2110  location.href = url;
2111 else if("_search" == lowerCaseTarget)
2112  openInNewWindow(url);
2113 else if("_media" == lowerCaseTarget)
2114  openInNewWindow(url);
2115 else if("_parent" == lowerCaseTarget)
2116  window.parent.location.href = url;
2117 else if("_blank" == lowerCaseTarget)
2118  openInNewWindow(url);
2119 else {
2120  var frame = getFrame(top.frames, target);
2121  if(frame != null)
2122   frame.location.href = url;
2123  else
2124   openInNewWindow(url);
2125 }
2126}
2127function openInNewWindow(url) {
2128 if(ASPx.Browser.Safari)
2129  openInNewWindowViaIframe(url);
2130 else {
2131  var newWindow = window.open();
2132  newWindow.opener = null;
2133  newWindow.location = url;
2134 }
2135}
2136function openInNewWindowViaIframe(url) {
2137 var iframe = document.createElement('iframe');
2138 iframe.style.display = 'none';
2139 document.body.appendChild(iframe);
2140 var iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
2141 var openArgs = '"' + url + '"';
2142 var script = iframeDoc.createElement('script');
2143 script.type = 'text/javascript';
2144 script.text = 'window.parent = null; ' +
2145  'window.top = null;' +
2146  'window.frameElement = null;' +
2147  'var child = window.open(' + openArgs + ');' +
2148  'child.opener = null';
2149 iframeDoc.body.appendChild(script);
2150 document.body.removeChild(iframe);
2151}
2152ASPx.Url = Url;
2153var Json = { };
2154function isValid(JsonString) {
2155 return !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(JsonString.replace(/"(\\.|[^"\\])*"/g, '')));
2156}
2157Json.Eval = function(jsonString, controlName) {
2158 if(isValid(jsonString))
2159  return eval("(" + jsonString + ")");
2160 else
2161  throw new Error(controlName + " received incorrect JSON-data: " + jsonString);
2162};
2163Json.ToJson = function(param, skipEncodeHtml){
2164 var paramType = typeof(param);
2165 if((paramType == "undefined") || (param == null))
2166  return null;
2167 if((paramType == "object") && (typeof(param.__toJson) == "function"))
2168  return param.__toJson();
2169 if((paramType == "number") || (paramType == "boolean"))
2170  return param;
2171 if(param.constructor == Date)
2172  return dateToJson(param);
2173 if(paramType == "string") {
2174  var result = param.replace(/\\/g, "\\\\");
2175  result = result.replace(/"/g, "\\\"");
2176  result = result.replace(/\n/g, "\\n");
2177  result = result.replace(/\r/g, "\\r");
2178  if(!skipEncodeHtml) {
2179   result = result.replace(/</g, "\\u003c");
2180   result = result.replace(/>/g, "\\u003e");
2181  }
2182  return "\"" + result + "\"";
2183 }
2184 if(param.constructor == Array){
2185  var values = [];
2186  for(var i = 0; i < param.length; i++) {
2187   var jsonValue = Json.ToJson(param[i], skipEncodeHtml);
2188   if(jsonValue === null)
2189    jsonValue = "null";
2190   values.push(jsonValue);
2191  }
2192  return "[" + values.join(",") + "]";
2193 }
2194 var exceptKeys = {};
2195 if(ASPx.Ident.IsArray(param.__toJsonExceptKeys))
2196  exceptKeys = Data.CreateHashTableFromArray(param.__toJsonExceptKeys);
2197 exceptKeys["__toJsonExceptKeys"] = 1;
2198 var values = [];
2199 for(var key in param) {
2200  if(param.hasOwnProperty(key)) {
2201   if(ASPx.IsFunction(param[key]))
2202    continue;
2203   if(exceptKeys[key] == 1)
2204    continue;
2205   values.push(Json.ToJson(key) + ":" + Json.ToJson(param[key], skipEncodeHtml));
2206  }
2207 }
2208 return "{" + values.join(",") + "}";
2209};
2210function dateToJson(date) {
2211 var result = [ 
2212  date.getFullYear(),
2213  date.getMonth(),
2214  date.getDate()
2215 ];
2216 var time = {
2217  h: date.getHours(),
2218  m: date.getMinutes(),
2219  s: date.getSeconds(),
2220  ms: date.getMilliseconds()
2221 };
2222 if(time.h || time.m || time.s || time.ms)
2223  result.push(time.h);
2224 if(time.m || time.s || time.ms)
2225  result.push(time.m);
2226 if(time.s || time.ms)
2227  result.push(time.s);
2228 if(time.ms)
2229  result.push(time.ms);
2230 return "new Date(" + result.join() + ")";
2231}
2232ASPx.Json = Json;
2233ASPx.CreateClass = function(parentClass, properties) {
2234 if(arguments.length == 1) {
2235  properties = parentClass;
2236  parentClass = null;
2237 }
2238 var ret = function() {
2239  if(ret.preparing) 
2240   return delete(ret.preparing);
2241  if(ret.constr) {
2242   this.constructor = ret;
2243   ret.constr.apply(this, arguments);
2244  }
2245 };
2246 ret.prototype = {};
2247 if(parentClass) {
2248  parentClass.preparing = true;
2249  for(var name in parentClass) {
2250   if(parentClass.hasOwnProperty(name) && name != 'constr' && ASPx.IsFunction(parentClass[name]) && !ret[name])
2251    ret[name] = parentClass[name].aspxBind(parentClass);
2252  }
2253  ret.prototype = new parentClass;
2254  ret.prototype.constructor = parentClass;
2255  ret.constr = parentClass;
2256 }
2257 if(properties) {
2258  var constructorName = "constructor";
2259  for(var name in properties) {
2260   if(!properties.hasOwnProperty(name)) 
2261    continue;
2262   var getter = Object.getOwnPropertyDescriptor(properties, name).get;
2263   var setter = Object.getOwnPropertyDescriptor(properties, name).set;
2264   if(getter || setter)
2265    Object.defineProperty(ret.prototype, name, {
2266     set: setter,
2267     get: getter,
2268     enumerable: true,
2269     configurable: true
2270    });
2271   if(name != constructorName && !getter && !setter)
2272    ret.prototype[name] = properties[name];
2273  }
2274  if(properties[constructorName] && properties[constructorName] != Object)
2275   ret.constr = properties[constructorName];
2276 }
2277 return ret;
2278};
2279var registeredMixins = {};
2280ASPx.GetMixin = function (name, baseClass) {
2281 var mixinCache = baseClass._mixins || (baseClass._mixins = {});
2282 var resultClass = mixinCache[name];
2283 if (!resultClass) {
2284  var mixinCodeBuilder = registeredMixins[name];
2285  if (!mixinCodeBuilder)
2286   throw new Error("mixin with the '" + name + "' is not registered");
2287  var mixinCode = mixinCodeBuilder(baseClass);
2288  mixinCode.mixinName = name;
2289  resultClass = ASPx.CreateClass(baseClass, mixinCode);
2290  mixinCache[name] = resultClass;
2291 }
2292 return resultClass;
2293};
2294ASPx.RegisterMixin = function() {
2295 var name = arguments.length == 1 ? "mixin_" + ASPx.CreateGuid() : arguments[0];
2296 var mixinCodeBuilder = arguments[arguments.length - 1];
2297 if (registeredMixins[name])
2298  throw new Error("mixin with the '" + name + "' name is already defined");
2299 registeredMixins[name] = mixinCodeBuilder;
2300 return function(baseClass) { return ASPx.GetMixin(name, baseClass); };
2301};
2302ASPx.FormatCallbackArg = function(prefix, arg) {
2303 if(prefix == null && arg == null)
2304  return ""; 
2305 if(prefix == null) prefix = "";
2306 if(arg == null) arg = "";
2307 if(arg != null && !ASPx.IsExists(arg.length) && ASPx.IsExists(arg.value))
2308  arg = arg.value;
2309 arg = arg.toString();
2310 return [prefix, '|', arg.length, '|' , arg].join('');
2311};
2312ASPx.FormatCallbackArgs = function(callbackData) {
2313 var sb = [ ];
2314 for(var i = 0; i < callbackData.length; i++)
2315  sb.push(ASPx.FormatCallbackArg(callbackData[i][0], callbackData[i][1]));
2316 return sb.join("");
2317};
2318ASPx.ParseShortcutString = function(shortcutString) {
2319 if(!shortcutString)
2320  return 0;
2321 var isCtrlKey = false;
2322 var isShiftKey = false;
2323 var isAltKey = false;
2324 var isMetaKey = false;
2325 var keyCode = null;
2326 var shcKeys = shortcutString.toString().split("+");
2327 if(shcKeys.length > 0) {
2328  for(var i = 0; i < shcKeys.length; i++) {
2329   var key = Str.Trim(shcKeys[i].toUpperCase());
2330   switch (key) {
2331    case "CONTROL":
2332    case "CONTROLKEY":
2333    case "CTRL":
2334     isCtrlKey = true;
2335     break;
2336    case "SHIFT":
2337    case "SHIFTKEY":
2338     isShiftKey = true;
2339     break;
2340    case "ALT":
2341     isAltKey = true;
2342     break;
2343    case "CMD":
2344     isMetaKey = true;
2345     break;
2346    case "F1": keyCode = ASPx.Key.F1; break;
2347    case "F2": keyCode = ASPx.Key.F2; break;
2348    case "F3": keyCode = ASPx.Key.F3; break;
2349    case "F4": keyCode = ASPx.Key.F4; break;
2350    case "F5": keyCode = ASPx.Key.F5; break;
2351    case "F6": keyCode = ASPx.Key.F6; break;
2352    case "F7": keyCode = ASPx.Key.F7; break;
2353    case "F8": keyCode = ASPx.Key.F8; break;
2354    case "F9": keyCode = ASPx.Key.F9; break;
2355    case "F10":   keyCode = ASPx.Key.F10; break;
2356    case "F11":   keyCode = ASPx.Key.F11; break;
2357    case "F12":   keyCode = ASPx.Key.F12; break;
2358    case "RETURN":
2359    case "ENTER": keyCode = ASPx.Key.Enter; break;
2360    case "HOME":  keyCode = ASPx.Key.Home; break;
2361    case "END":   keyCode = ASPx.Key.End; break;
2362    case "LEFT":  keyCode = ASPx.Key.Left; break;
2363    case "RIGHT": keyCode = ASPx.Key.Right; break;
2364    case "UP": keyCode = ASPx.Key.Up; break;
2365    case "DOWN":  keyCode = ASPx.Key.Down; break;
2366    case "PAGEUP": keyCode = ASPx.Key.PageUp; break;
2367    case "PAGEDOWN": keyCode = ASPx.Key.PageDown; break;
2368    case "SPACE": keyCode = ASPx.Key.Space; break;
2369    case "TAB":   keyCode = ASPx.Key.Tab; break;
2370    case "BACKSPACE": 
2371    case "BACK": keyCode = ASPx.Key.Backspace; break;
2372    case "CONTEXT": keyCode = ASPx.Key.ContextMenu; break;
2373    case "ESCAPE":
2374    case "ESC":
2375     keyCode = ASPx.Key.Esc;
2376     break;
2377    case "DELETE":
2378    case "DEL":
2379     keyCode = ASPx.Key.Delete;
2380     break;
2381    case "INSERT":
2382    case "INS":
2383     keyCode = ASPx.Key.Insert;
2384     break;
2385    case "PLUS":
2386     keyCode = "+".charCodeAt(0);
2387     break;
2388    default:
2389     keyCode = key.charCodeAt(0);
2390     break;
2391   }
2392  }
2393 } else
2394  ASPx.ShowErrorAlert("Invalid shortcut");
2395 return ASPx.GetShortcutCode(keyCode, isCtrlKey, isShiftKey, isAltKey, isMetaKey);
2396};
2397ASPx.GetShortcutCode = function(keyCode, isCtrlKey, isShiftKey, isAltKey, isMetaKey) {
2398 var value = keyCode;
2399 value |= isCtrlKey ? ASPx.ModifierKey.Ctrl : 0;
2400 value |= isShiftKey ? ASPx.ModifierKey.Shift : 0;
2401 value |= isAltKey ? ASPx.ModifierKey.Alt : 0;
2402 value |= isMetaKey ? ASPx.ModifierKey.Meta : 0;
2403 return value;
2404};
2405ASPx.GetShortcutCodeByEvent = function(evt) {
2406 return ASPx.GetShortcutCode(Evt.GetKeyCode(evt), evt.ctrlKey, evt.shiftKey, evt.altKey, ASPx.Browser.MacOSPlatform ? evt.metaKey : false);
2407};
2408ASPx.IsPasteShortcut = function(evt) {
2409 if(evt.type === "paste")
2410  return true;
2411 var keyCode = Evt.GetKeyCode(evt);
2412 if(Browser.NetscapeFamily && evt.which == 0)  
2413  keyCode = evt.keyCode;
2414 return (evt.ctrlKey && (keyCode == 118  || (keyCode == 86))) ||
2415     (evt.shiftKey && !evt.ctrlKey && !evt.altKey &&
2416     (keyCode == ASPx.Key.Insert)) ;
2417};
2418var NotPrintableKeyCodes = null;
2419ASPx.IsPrintableKey = function(keyCode) {
2420 if (!NotPrintableKeyCodes)
2421  NotPrintableKeyCodes = Object.keys(ASPx.Key).map(function(key) { return ASPx.Key[key]; });
2422 return !ASPx.Data.ArrayContains(NotPrintableKeyCodes, keyCode);
2423};
2424ASPx.SetFocus = function(element, selectAction) {
2425 function focusCore(element, selectAction){
2426  try {
2427    element.focus();
2428    if(Browser.IE && document.activeElement != element)
2429     element.focus();
2430    if(selectAction) {
2431     var currentSelection = Selection.GetInfo(element);
2432     if(currentSelection.startPos == currentSelection.endPos) {
2433      switch(selectAction) {
2434       case "start":
2435        Selection.SetCaretPosition(element, 0);
2436        break;
2437       case "all":
2438        Selection.Set(element);
2439        break;
2440      }
2441     }
2442    }
2443   } catch (e) {
2444  }
2445 }
2446 if(ASPxClientUtils.iOSPlatform) 
2447  focusCore(element, selectAction);
2448 else {
2449  window.setTimeout(function() { 
2450   focusCore(element, selectAction);
2451  }, 100);
2452 }
2453};
2454ASPx.IsFocusableCore = function(element, skipContainerVisibilityCheck) {
2455 var current = element;
2456 while(current && current.nodeType == 1) {
2457  if(current == element || !skipContainerVisibilityCheck(current)) {
2458   var tagName = current.tagName.toUpperCase();
2459   if(tagName == "BODY")
2460    return true;
2461   var disabledElementTags = ["INPUT", "BUTTON", "TEXTAREA", "SELECT", "OPTION"];
2462   if(disabledElementTags.indexOf(tagName) !== -1 && current.disabled || !ASPx.GetElementDisplay(current) || !ASPx.GetElementVisibility(current))
2463    return false;
2464  }
2465  current = current.parentNode;
2466 }
2467 return true;
2468};
2469ASPx.IsFocusable = function(element) {
2470 return ASPx.IsFocusableCore(element, ASPx.FalseFunction);
2471};
2472var ActionElementsCache = ASPx.CreateClass(null, {
2473 constructor: function() {
2474  this.usageCounter = 0;
2475  this.elements = [ ];
2476  this.values = [ ];
2477 },
2478 IsActive: function() { return this.usageCounter > 0; },
2479 BeginUsage: function() {
2480  this.usageCounter++;
2481 },
2482 EndUsage: function() {
2483  this.usageCounter--;
2484  if(this.usageCounter === 0)
2485   this.Clear();
2486 },
2487 Add: function(element, value) {
2488  var index = this.elements.length;
2489  this.elements[index] = element;
2490  this.values[index] = value;
2491 },
2492 Get: function(element) { 
2493  var index = this.elements.indexOf(element);
2494  var hasValue = index > -1;
2495  var value = hasValue ? this.values[index] : undefined;
2496  return { hasValue: hasValue, value: value };
2497 },
2498 Clear: function() { 
2499  this.elements = [ ];
2500  this.values = [ ];
2501 }
2502});
2503ASPx.ActionElementsCache = new ActionElementsCache();
2504ASPx.IsActionElement = function(element) {
2505 if(!ASPx.IsExistsElement(element))
2506  return false;
2507 var useCache = ASPx.ActionElementsCache.IsActive();
2508 if(useCache) {
2509  var cacheValue = ASPx.ActionElementsCache.Get(element);
2510  if(cacheValue.hasValue)
2511   return cacheValue.value;
2512 }
2513 var isActionElement = ASPx.IsActionElementCore(element);
2514 if(useCache)
2515  ASPx.ActionElementsCache.Add(element, isActionElement);
2516 return isActionElement;
2517};
2518ASPx.IsActionElementCore = function(element) {
2519 var tabIndex = parseInt(ASPx.Attr.GetAttribute(element, ASPx.Attr.GetTabIndexAttributeName()));
2520 var hasTabIndex = !isNaN(tabIndex);
2521 var hasNonNegativeTabIndex = hasTabIndex && tabIndex > -1;
2522 var hasNegativeTabIndex = hasTabIndex && tabIndex < 0;
2523 var tagName = element.tagName;
2524 var focusableElementTags = ["BUTTON", "SELECT", "TEXTAREA", "OPTION", "IFRAME"];
2525 var isFocusableCore = ASPx.IsFocusable(element);
2526 var isFocusableTag = focusableElementTags.indexOf(tagName) !== -1;
2527 var isFocusableLink = tagName === "A" && (!!element.href || hasNonNegativeTabIndex);
2528 var isFocusableInput = tagName === "INPUT" && element.type.toLowerCase() !== "hidden";
2529 var isFocusableByTabIndex = tagName !== "INPUT" && hasNonNegativeTabIndex;
2530 var isEditableDiv = tagName == "DIV" && element.contentEditable === "true";
2531 return isFocusableCore && !hasNegativeTabIndex && (isFocusableTag || isFocusableLink || isFocusableInput || isFocusableByTabIndex || isEditableDiv);
2532};
2533ASPx.GetCanBeActiveElementsInContainer = function(container) {
2534 var canBeActiveTags = ["INPUT", "A", "UL", "BUTTON", "TEXTAREA", "SELECT", "IFRAME"],
2535  canBeActiveElements = [];
2536 Data.ForEach(canBeActiveTags, function(tag) {
2537  var elements = container.getElementsByTagName(tag);
2538  canBeActiveElements = canBeActiveElements.concat([].slice.call(elements));
2539 });
2540 return canBeActiveElements;
2541};
2542function isActionElementAllowedByPredicate(element, predicate) {
2543  var allowedByPredicate = !predicate || predicate(element);
2544  return allowedByPredicate && ASPx.IsActionElement(element);
2545}
2546ASPx.FindChildActionElements = function(container, predicate) {
2547 return ASPx.GetNodes(container, function(el) {
2548  return isActionElementAllowedByPredicate(el, predicate);
2549 });
2550};
2551ASPx.FindAllSortedActionElements = function(container, predicate) {
2552 var result = [ ];
2553 if(!container || !container.getElementsByTagName) return result;
2554 var actionElements = ASPx.FindChildActionElements(container, predicate);
2555 var getTabOrderValue = function(el) {
2556  var tabIndex = parseInt(ASPx.Attr.GetAttribute(el, ASPx.Attr.GetTabIndexAttributeName()));
2557  return isNaN(tabIndex) ? 0 : tabIndex;
2558 };
2559 var positiveTabIndexElements = actionElements.filter(function(x) { return getTabOrderValue(x) > 0; });
2560 var nonPositiveTabIndexElements = actionElements.filter(function(x) { return getTabOrderValue(x) === 0; });
2561 var sortedTabIndexElements = positiveTabIndexElements.sort(function(x, y) { return getTabOrderValue(x) - getTabOrderValue(y); });
2562 result = sortedTabIndexElements.concat(nonPositiveTabIndexElements);
2563 return result;
2564};
2565ASPx.FindFirstChildActionElement = function(container, predicate) {
2566 if(!container || isActionElementAllowedByPredicate(container, predicate))
2567  return !container ? null : container;
2568 var sortedActionElements = ASPx.FindAllSortedActionElements(container, predicate);
2569 return sortedActionElements[0];
2570};
2571ASPx.FindLastChildActionElement = function(container, predicate) {
2572 if(!container)
2573  return null;
2574 var sortedActionElements = ASPx.FindAllSortedActionElements(container, predicate);
2575 var actionElement = sortedActionElements[sortedActionElements.length - 1];
2576 if(!actionElement && isActionElementAllowedByPredicate(container, predicate))
2577  actionElement = container;
2578 return actionElement;
2579};
2580ASPx.GetParentClientControls = function(name) {
2581 var nameParts = name.split("_");
2582 var result = [ ];
2583 var controlCollection = ASPx.GetControlCollection();
2584 for(var i = 1; i <= nameParts.length; i++) {
2585  var controlName = nameParts.slice(0, i).join("_");
2586  var control = controlCollection.Get(controlName);
2587  if(control)
2588   result.push(control);
2589 }
2590 return result;
2591};
2592ASPx.GetRootClientControl = function(childControlName) {
2593 var parentControls = ASPx.GetParentClientControls(childControlName);
2594 return parentControls[0];
2595};
2596ASPx.GetClientControlByElementID = function(elementID) {
2597 var parentControls = ASPx.GetParentClientControls(elementID);
2598 return parentControls[parentControls.length - 1];
2599};
2600ASPx.IsExists = function(obj){
2601 return (typeof(obj) != "undefined") && (obj != null);
2602};
2603ASPx.IsFunction = function(obj){
2604 return typeof(obj) == "function";
2605};
2606ASPx.IsNumber = function(str) {
2607 return !isNaN(parseFloat(str)) && isFinite(str);
2608};
2609ASPx.GetDefinedValue = function(value, defaultValue){
2610 return (typeof(value) != "undefined") ? value : defaultValue;
2611};
2612ASPx.CorrectJSFloatNumber = function(number) {
2613 var ret = 21; 
2614 var numString = number.toPrecision(21);
2615 numString = numString.replace("-", ""); 
2616 var integerDigitsCount = numString.indexOf(ASPx.PossibleNumberDecimalSeparators[0]);
2617 if(integerDigitsCount < 0)
2618  integerDigitsCount = numString.indexOf(ASPx.PossibleNumberDecimalSeparators[1]);
2619 var floatDigitsCount = numString.length - integerDigitsCount - 1;
2620 if(floatDigitsCount < 10)
2621  return number;
2622 if(integerDigitsCount > 0) {
2623  ret = integerDigitsCount + 12;
2624 }
2625 var toPrecisionNumber = Math.min(ret, 21);
2626 var newValueString = number.toPrecision(toPrecisionNumber);
2627 return parseFloat(newValueString, 10);
2628};
2629ASPx.CorrectRounding = function(number, step) { 
2630 var regex = /[,|.](.*)/,
2631  isFloatValue = regex.test(number),
2632  isFloatStep = regex.test(step);
2633 if(isFloatValue || isFloatStep) {
2634  var valueAccuracy = (isFloatValue) ? regex.exec(number)[0].length - 1 : 0,
2635   stepAccuracy = (isFloatStep) ? regex.exec(step)[0].length - 1 : 0,
2636   accuracy = Math.max(valueAccuracy, stepAccuracy);
2637  var multiplier = Math.pow(10, accuracy);
2638  number = Math.round((number + step) * multiplier) / multiplier;
2639  return number;
2640 }
2641 return number + step;
2642};
2643ASPx.GetActiveElement = function() {
2644 try{ return document.activeElement; } catch(e) { return null; }
2645};
2646var verticalScrollBarWidth;
2647ASPx.GetVerticalScrollBarWidth = function() {
2648 if(typeof(verticalScrollBarWidth) == "undefined") {
2649  var container = document.createElement("DIV");
2650  container.style.cssText = "position: absolute; top: 0px; left: 0px; visibility: hidden; width: 200px; height: 150px; overflow: hidden; box-sizing: content-box";
2651  document.body.appendChild(container);
2652  var child = document.createElement("P");
2653  container.appendChild(child);
2654  child.style.cssText = "width: 100%; height: 200px;";
2655  var widthWithoutScrollBar = child.offsetWidth;
2656  container.style.overflow = "scroll";
2657  var widthWithScrollBar = child.offsetWidth;
2658  if(widthWithoutScrollBar == widthWithScrollBar)
2659   widthWithScrollBar = container.clientWidth;
2660  verticalScrollBarWidth = widthWithoutScrollBar - widthWithScrollBar;
2661  document.body.removeChild(container);
2662 }
2663 return verticalScrollBarWidth;
2664};
2665function hideScrollBarCore(element, scrollName) {
2666 if(element.tagName == "IFRAME") {
2667  if((element.scrolling == "yes") || (element.scrolling == "auto")) {
2668   Attr.ChangeAttribute(element, "scrolling", "no");
2669   return true;
2670  }
2671 }
2672 else if(element.tagName == "DIV") {
2673  if((element.style[scrollName] == "scroll") || (element.style[scrollName] == "auto")) {
2674   Attr.ChangeStyleAttribute(element, scrollName, "hidden");
2675   return true;
2676  }
2677 }
2678 return false;
2679}
2680function restoreScrollBarCore(element, scrollName) {
2681 if(element.tagName == "IFRAME")
2682  return Attr.RestoreAttribute(element, "scrolling");
2683 else if(element.tagName == "DIV")
2684  return Attr.RestoreStyleAttribute(element, scrollName);
2685 return false;
2686}
2687ASPx.SetScrollBarVisibilityCore = function(element, scrollName, isVisible) {
2688 return isVisible ? restoreScrollBarCore(element, scrollName) : hideScrollBarCore(element, scrollName);
2689};
2690ASPx.SetScrollBarVisibility = function(element, isVisible) {
2691 if(ASPx.SetScrollBarVisibilityCore(element, "overflow", isVisible)) 
2692  return true;
2693 var result = ASPx.SetScrollBarVisibilityCore(element, "overflowX", isVisible)
2694  || ASPx.SetScrollBarVisibilityCore(element, "overflowY", isVisible);
2695 return result;
2696};
2697ASPx.SetInnerHtml = function(element, html) {
2698 if(Browser.IE) {
2699  setInnerHtmlInternal(element, "<em>&nbsp;</em>" + html);
2700  element.removeChild(element.firstChild);
2701 } else
2702  setInnerHtmlInternal(element, html);
2703};
2704ASPx.GetInnerText = function(container) {
2705 if(Browser.Safari && Browser.MajorVersion <= 5) {
2706  var filter = getHtml2PlainTextFilter();
2707  setInnerHtmlInternal(filter, container.innerHTML);
2708  ASPx.SetElementDisplay(filter, true);
2709  var innerText = filter.innerText;
2710  ASPx.SetElementDisplay(filter, false);
2711  return innerText;
2712 } else if(Browser.NetscapeFamily || Browser.WebKitFamily || (Browser.IE && Browser.Version >= 9) || Browser.Edge) {
2713  return container.textContent;
2714 } else
2715  return container.innerText;
2716};
2717ASPx.RemoveComment = function(text) {
2718 var result = text;
2719 var commentStart = "<!--";
2720 var commentEnd = "//-->";
2721 var positionStart = result.indexOf(commentStart);
2722 while(positionStart > -1) {
2723  var positionEnd = result.indexOf(commentEnd);
2724  var startStr = result.substring(0, positionStart);
2725  var endStr = result.substring(positionEnd + commentEnd.length);
2726  result = startStr + endStr;
2727  positionStart = result.indexOf(commentStart);
2728 }
2729 return result;
2730};
2731var html2PlainTextFilter = null;
2732function getHtml2PlainTextFilter() {
2733 if(html2PlainTextFilter == null) {
2734  html2PlainTextFilter = document.createElement("DIV");
2735  html2PlainTextFilter.style.width = "0";
2736  html2PlainTextFilter.style.height = "0";
2737  html2PlainTextFilter.style.overflow = "visible";
2738  ASPx.SetElementDisplay(html2PlainTextFilter, false);
2739  document.body.appendChild(html2PlainTextFilter);
2740 }
2741 return html2PlainTextFilter;
2742}
2743ASPx.CreateHiddenField = function(name, id, parent) {
2744 var input = document.createElement("INPUT");
2745 input.setAttribute("type", "hidden");
2746 if(name)
2747  input.setAttribute("name", name);
2748 if(id)
2749  input.setAttribute("id", id);
2750 if(parent)
2751  parent.appendChild(input);
2752 return input;
2753};
2754ASPx.CloneObject = function(srcObject) {
2755 if(typeof(srcObject) != 'object' || srcObject == null)
2756  return srcObject;
2757 var newObject = {};
2758 for(var i in srcObject)
2759  newObject[i] = srcObject[i];
2760 return newObject;
2761};
2762ASPx.InsertRowsBefore = function(table, rowsHtml, index) {
2763 var row = null;
2764 if(index >= 0 && index < table.rows.length)
2765  row = table.rows[index];
2766 var func = ASPx.Browser.IE && ASPx.Browser.Version < 10 ? insertRowsBefore_IE9 : insertRowsBefore;
2767 func(table, rowsHtml, row);
2768};
2769var insertRowsBefore = function(table, rowsHtml, row) {
2770 if(!row && table.tBodies.length > 0) {
2771  row = document.createElement("TR");
2772  table.tBodies[0].appendChild(row);
2773  row.shouldRemove = true;
2774 }
2775 if(row) {
2776  row.insertAdjacentHTML("beforeBegin", rowsHtml);
2777  if(row.shouldRemove)
2778   ASPx.RemoveElement(row);
2779 }
2780};
2781var insertRowsBefore_IE9 = function(table, rowsHtml, nextRow) {
2782 var row = document.createElement("TR");
2783 var cell = document.createElement("TD");
2784 setInnerHtmlInternal(cell, "<table><tbody>" + rowsHtml + "</tbody></table>");
2785 var tbody = table.tBodies[0];
2786 tbody.appendChild(row);
2787 row.appendChild(cell);
2788 var newTable = ASPx.GetNodeByTagName(cell, "TABLE", 0);
2789 var rowCount = newTable.rows.length;
2790 for(var i = rowCount - 1; i >= 0; i--) {
2791  var newRow = newTable.rows[i];
2792  if(nextRow == null)
2793   tbody.appendChild(newRow);
2794  else
2795   tbody.insertBefore(newRow, nextRow);
2796  nextRow = newRow;
2797 }
2798 ASPx.RemoveElement(row);
2799};
2800ASPx.IsPercentageSize = function(size) {
2801 return size && size.indexOf('%') != -1;
2802};
2803ASPx.GetElementById = function(id) {
2804 if(document.getElementById)
2805  return document.getElementById(id);
2806 else
2807  return document.all[id];
2808};
2809ASPx.GetInputElementById = function(id) {
2810 var elem = ASPx.GetElementById(id);
2811 if(!Browser.IE)
2812  return elem;
2813 if(elem) {
2814  if(elem.id == id)
2815   return elem;
2816  else {
2817   for(var i = 1; i < document.all[id].length; i++) {
2818    if(document.all[id][i].id == id)
2819     return document.all[id][i];
2820   }
2821  }
2822 }
2823 return null;
2824};
2825ASPx.GetElementByIdInDocument = function(documentObj, id) {
2826 if(documentObj.getElementById)
2827  return documentObj.getElementById(id);
2828 else
2829  return documentObj.all[id];
2830};
2831ASPx.GetIsParent = function(parentElement, element) {
2832 if(!parentElement || !element)
2833  return false;
2834 while(element){
2835  if(element === parentElement)
2836   return true;
2837  if(element.tagName === "BODY")
2838   return false;
2839  element = element.parentNode;
2840 }
2841 return false;
2842};
2843ASPx.GetParentById = function(element, id) {
2844 element = element.parentNode;
2845 while(element){
2846  if(element.id === id)
2847   return element;
2848  element = element.parentNode;
2849 }
2850 return null;
2851};
2852ASPx.GetParentByPartialId = function(element, idPart){
2853 while(element && element.tagName != "BODY") {
2854  if(element.id && element.id.match(idPart)) 
2855   return element;
2856  element = element.parentNode;
2857 }
2858 return null;
2859};
2860ASPx.GetParentByTagName = function(element, tagName) {
2861 tagName = tagName.toUpperCase();
2862 while(element) {
2863  if(element.tagName === "BODY")
2864   return null;
2865  if(element.tagName === tagName)
2866   return element;
2867  element = element.parentNode;
2868 }
2869 return null;
2870};
2871function getParentByCondition(element, conditionArg, condition) {
2872 while(element != null) {
2873  if(element.tagName == "BODY" || element.nodeName == "#document")
2874   return null;
2875  if (condition(element, conditionArg))
2876   return element;
2877  element = element.parentNode;
2878 }
2879 return null;
2880}
2881ASPx.GetParentByPartialClassName = function(element, className) {
2882 return getParentByCondition(element, className, ASPx.ElementContainsCssClass);
2883};
2884ASPx.GetParentByClassName = function(element, className) {
2885 return getParentByCondition(element, className, ASPx.ElementHasCssClass);
2886};
2887ASPx.GetParentBySelector = function (element, selector) {
2888 return getParentByCondition(element, selector, ASPx.ElementMatchesSelector);
2889};
2890ASPx.GetParentByTagNameAndAttributeValue = function(element, tagName, attrName, attrValue) {
2891 tagName = tagName.toUpperCase();
2892 while(element != null) {
2893  if(element.tagName == "BODY")
2894   return null;
2895  if(element.tagName == tagName && element[attrName] == attrValue)
2896   return element;
2897  element = element.parentNode;
2898 }
2899 return null;
2900};
2901ASPx.GetParent = function(element, testFunc){
2902 if (!ASPx.IsExists(testFunc)) return null;
2903 while(element != null && element.tagName != "BODY"){
2904  if(testFunc(element))
2905   return element;
2906  element = element.parentNode;
2907 }
2908 return null;
2909};
2910ASPx.GetElementTreeLine = function(element, stopTagName, stopFunc) {
2911 var result = [];
2912 stopTagName = stopTagName || "BODY";
2913 while(element != null) {
2914  if(!stopFunc && element.tagName == stopTagName)
2915   break;
2916  if(stopFunc && stopFunc(element))
2917   break;
2918  result.push(element);
2919  element = element.parentNode;
2920 }
2921 return result;
2922};
2923ASPx.IsScrollableElement = function(element, isHorzScrollable, isVertScrollable) {
2924 isHorzScrollable = ASPx.IsExists(isHorzScrollable) ? isHorzScrollable : true;
2925 isVertScrollable = ASPx.IsExists(isVertScrollable) ? isVertScrollable : true;
2926 var style = ASPx.GetCurrentStyle(element);
2927 var overflowStyleNames = ["overflow"];
2928 if(isHorzScrollable)
2929  overflowStyleNames.push("overflowX");
2930 if(isVertScrollable)
2931  overflowStyleNames.push("overflowY");
2932 for(var i = 0; i < overflowStyleNames.length; i++)
2933  if(style[overflowStyleNames[i]] == "scroll" || style[overflowStyleNames[i]] == "auto")
2934   return true;
2935 return false;
2936};
2937ASPx.GetPreviousSibling = function(el) {
2938 if(el.previousElementSibling) {
2939  return el.previousElementSibling;
2940 } else {
2941  while(el = el.previousSibling) {
2942   if(el.nodeType === 1)
2943    return el;
2944  }
2945 }
2946};
2947ASPx.ElementMatchesSelector = (function (e) {
2948 return (function (matches) {
2949  return function (el, selector) { return !!el && !!selector && matches.call(el, selector); };
2950 })(e.matches || e.matchesSelector || e.webkitMatchesSelector || e.mozMatchesSelector || e.msMatchesSelector || e.oMatchesSelector);
2951})(Element.prototype);
2952ASPx.ElementHasCssClass = function(element, className) {
2953 try {
2954  var elementClasses;
2955  var classList = ASPx.GetClassNameList(element);
2956  if(!classList) {
2957   var elementClassName = ASPx.GetClassName(element);
2958   if(!elementClassName) {
2959    return false;
2960   }
2961   elementClasses = elementClassName.split(" ");
2962  }
2963  var classNames = className.split(" ");
2964  for(var i = classNames.length - 1; i >= 0; i--) {
2965   if(classList) {
2966    if(classList.indexOf(classNames[i]) === -1)
2967     return false;
2968    continue;
2969   }
2970   if(Data.ArrayIndexOf(elementClasses, classNames[i]) < 0)
2971    return false;
2972  }
2973  return true;
2974 } catch(e) {
2975  return false;
2976 }
2977};
2978ASPx.ElementContainsCssClass = function(element, className) {
2979 try {
2980  var elementClassName = ASPx.GetClassName(element);
2981  if(!elementClassName) {
2982   return false;
2983  }
2984  return elementClassName.indexOf(className) != -1;
2985 } catch(e) {
2986  return false;
2987 }
2988};
2989ASPx.AddClassNameToElement = function (element, className) {
2990 if(!element || typeof(className) !== "string" ) return;
2991 className = className.trim();
2992 if(!ASPx.ElementHasCssClass(element, className) && className !== "") {
2993  var oldClassName = ASPx.GetClassName(element);
2994  ASPx.SetClassName(element, (oldClassName === "") ? className : oldClassName + " " + className);
2995 }
2996};
2997ASPx.RemoveClassNameFromElement = function(element, className) {
2998 if(!element) return;
2999 var elementClassName = ASPx.GetClassName(element);
3000 var updClassName = " " + elementClassName + " ";
3001 var newClassName = updClassName.replace(" " + className + " ", " ");
3002 if(updClassName.length != newClassName.length)
3003  ASPx.SetClassName(element, Str.Trim(newClassName));  
3004};
3005ASPx.RemoveClassNamesFromElement = function(element, classNames) {
3006 if(!element) return;
3007 for(var i = 0; i < classNames.length; i++) {
3008  var className = classNames[i];
3009  if(ASPx.Browser.IE && ASPx.Browser.Version < 10)
3010   ASPx.RemoveClassNameFromElement(element, className);
3011  else
3012   element.classList.remove(className);
3013 }
3014};
3015ASPx.ToggleClassNameToElement = function(element, className, toggleState) {
3016 if(!toggleState)
3017  ASPx.RemoveClassNameFromElement(element, className);
3018 if(toggleState && !ASPx.ElementHasCssClass(element, className))
3019  ASPx.AddClassNameToElement(element, className);
3020};
3021ASPx.GetClassNameList = function(element) {
3022 var result = [];
3023 if(element) {
3024  if(element.tagName === "svg") {
3025   result = ASPx.GetClassName(element).replace(/^\s+|\s+$/g, '').split(/\s+/);
3026  }
3027  else {
3028   result = element.classList ? [].slice.call(element.classList) : ASPx.GetClassName(element).replace(/^\s+|\s+$/g, '').split(/\s+/);
3029  }
3030 }
3031 return result;
3032};
3033ASPx.GetClassName = function(element) {
3034 var result = "";
3035 if(element) {
3036  if(element.tagName === "svg") {
3037   result = element.className.baseVal;
3038  }
3039  else {
3040   result = element.className ? element.className : "";
3041  }
3042 }
3043 return result;
3044};
3045ASPx.SetClassName = function(element, className) {
3046 if(element.tagName === "svg") {
3047  element.className.baseVal = Str.Trim(className);
3048 }
3049 else {
3050  element.className = Str.Trim(className);
3051 }
3052};
3053ASPx.GetElementOffsetWidth = function(element) {
3054 if(element.tagName === "svg") {
3055  return element.getBoundingClientRect().width;
3056 }
3057 else {
3058  return element.offsetWidth;
3059 }
3060};
3061ASPx.GetElementOffsetHeight = function(element) {
3062 if(element.tagName === "svg") {
3063  return element.getBoundingClientRect().height;
3064 }
3065 else {
3066  return element.offsetHeight;
3067 }
3068};
3069function nodeListToArray(nodeList, filter) {
3070 var result = [];
3071 for(var i = 0, element; element = nodeList[i]; i++) {
3072  if(filter && !filter(element))
3073   continue;
3074  result.push(element);
3075 }
3076 return result;
3077}
3078ASPx.NodeListToArray = nodeListToArray;
3079function getItemByIndex(collection, index) {
3080 if(!index) index = 0;
3081 if(collection != null && collection.length > index)
3082  return collection[index];
3083 return null;
3084}
3085ASPx.GetChildNodesByQuerySelector = function (parent, selector) {
3086 return nodeListToArray(parent.querySelectorAll(selector), function (el) { return el.parentNode === parent; });
3087};
3088ASPx.GetChildNodesByClassName = function(parent, className) {
3089 if(!parent) return [];
3090 if(parent.querySelectorAll) {
3091  var children = parent.querySelectorAll('.' + className);
3092  return nodeListToArray(children, function(element) { 
3093   return element.parentNode === parent;
3094  });
3095 }
3096 return ASPx.GetChildNodes(parent, function(elem) { return elem.className && ASPx.ElementHasCssClass(elem, className); });
3097};
3098ASPx.GetChildNodesByPartialClassName = function(element, className) {
3099 return ASPx.GetChildElementNodesByPredicate(element,
3100  function(child) {
3101   return ASPx.ElementContainsCssClass(child, className);
3102  });
3103};
3104ASPx.GetChildByPartialClassName = function(element, className, index) {
3105 if(element != null){    
3106  var collection = ASPx.GetChildNodesByPartialClassName(element, className);
3107  return getItemByIndex(collection, index);
3108 }
3109 return null;
3110};
3111ASPx.GetChildByClassName = function(element, className, index) {
3112 if(element != null){    
3113  var collection = ASPx.GetChildNodesByClassName(element, className);
3114  return getItemByIndex(collection, index);
3115 }
3116 return null;
3117};
3118ASPx.GetNodesByPartialClassName = function(element, className) {
3119 if(element.querySelectorAll) {
3120  var list = element.querySelectorAll('*[class*=' + className + ']');
3121  return nodeListToArray(list);
3122 }
3123 var collection = element.all || element.getElementsByTagName('*');
3124 var ret = [ ];
3125 if(collection != null) {
3126  for(var i = 0; i < collection.length; i ++) {
3127   if(ASPx.ElementContainsCssClass(collection[i], className))
3128    ret.push(collection[i]);
3129  }
3130 }
3131 return ret;
3132};
3133ASPx.GetNodesByClassName = function(parent, className) {
3134 if(parent.querySelectorAll) {
3135  var children = parent.querySelectorAll('.' + className);
3136  return nodeListToArray(children);
3137 }
3138 return ASPx.GetNodes(parent, function(elem) { return elem.className && ASPx.ElementHasCssClass(elem, className); });
3139};
3140ASPx.GetNodeByClassName = function(element, className, index) {
3141 if(element != null){    
3142  var collection = ASPx.GetNodesByClassName(element, className);
3143  return getItemByIndex(collection, index);
3144 }
3145 return null;
3146};
3147ASPx.GetChildById = function(element, id) {
3148 if(element.all) {
3149  var child = element.all[id];
3150  if(!child) {
3151   child = element.all(id); 
3152   if(!child)
3153    return Browser.IE ? document.getElementById(id) : null; 
3154  } 
3155  if(!ASPx.IsExists(child.length)) 
3156   return child;
3157  else
3158   return ASPx.GetElementById(id);
3159 }
3160 else
3161  return ASPx.GetElementById(id);
3162};
3163ASPx.GetNodesByPartialId = function(element, partialName, list) {
3164 if(element.id && element.id.indexOf(partialName) > -1) 
3165  list.push(element);
3166 if(element.childNodes) {
3167  for(var i = 0; i < element.childNodes.length; i ++) 
3168   ASPx.GetNodesByPartialId(element.childNodes[i], partialName, list);
3169 }
3170};
3171ASPx.GetNodesByTagName = function(element, tagName) {
3172 var tagNameToUpper = tagName.toUpperCase();
3173 var result = null;
3174 if(element) {
3175  if(element.getElementsByTagName) {
3176   result = element.getElementsByTagName(tagNameToUpper);
3177   if(result.length === 0) {
3178    result = element.getElementsByTagName(tagName);
3179   }
3180  }
3181  else if(element.all && element.all.tags !== undefined)
3182   result = Browser.Netscape ? element.all.tags[tagNameToUpper] : element.all.tags(tagNameToUpper);
3183 }
3184 return result;
3185};
3186ASPx.GetNodeByTagName = function(element, tagName, index) {
3187 if(element != null){    
3188  var collection = ASPx.GetNodesByTagName(element, tagName);
3189  return getItemByIndex(collection, index);
3190 }
3191 return null;
3192};
3193ASPx.GetChildNodesByTagName = function(parent, tagName) {
3194 return ASPx.GetChildNodes(parent, function (child) { return child.tagName === tagName; });
3195};
3196ASPx.GetChildByTagName = function(element, tagName, index) {
3197 if(element != null){    
3198  var collection = ASPx.GetChildNodesByTagName(element, tagName);
3199  return getItemByIndex(collection, index);
3200 }
3201 return null;
3202};
3203ASPx.RetrieveByPredicate = function(scourceCollection, predicate) {
3204 var result = [];
3205 for(var i = 0; i < scourceCollection.length; i++) {
3206  var element = scourceCollection[i];
3207  if(!predicate || predicate(element)) 
3208   result.push(element);
3209 }
3210 return result;
3211};
3212ASPx.GetChildNodes = function(parent, predicate) {
3213 return ASPx.RetrieveByPredicate(parent.childNodes, predicate);
3214};
3215ASPx.GetNodes = function(parent, predicate) {
3216 var c = parent.all || parent.getElementsByTagName('*');
3217 return ASPx.RetrieveByPredicate(c, predicate);
3218};
3219ASPx.GetChildElementNodes = function(parent) {
3220 if(!parent) return null;
3221 return ASPx.GetChildNodes(parent, function(e) { return e.nodeType == 1; });
3222};
3223ASPx.GetChildElementNodesByPredicate = function(parent, predicate) {
3224 if(!parent) return null;
3225 if(!predicate) return ASPx.GetChildElementNodes(parent);
3226 return ASPx.GetChildNodes(parent, function(e) { return e.nodeType == 1 && predicate(e); });
3227};
3228ASPx.GetTextNode = function(element, index) {
3229 if(element != null){
3230  var collection = [ ];
3231  ASPx.GetTextNodes(element, collection);
3232  return getItemByIndex(collection, index);
3233 }
3234 return null;
3235};
3236ASPx.GetTextNodes = function(element, collection) {
3237 if(element.tagName === "svg")
3238  return;
3239 for(var i = 0; i < element.childNodes.length; i ++){
3240  var childNode = element.childNodes[i];
3241  if(ASPx.IsExists(childNode.nodeValue))
3242   collection.push(childNode);
3243  ASPx.GetTextNodes(childNode, collection);
3244 }
3245};
3246ASPx.GetNormalizedTextNode = function(element, index) {
3247 var textNode = ASPx.GetTextNode(element, index);
3248 if(textNode != null)
3249  ASPx.MergeAdjacentTextNodes(textNode);
3250 return textNode;
3251};
3252ASPx.MergeAdjacentTextNodes = function(firstTextNode) {
3253 if(!ASPx.IsExists(firstTextNode.nodeValue))
3254  return;
3255 var textNode = firstTextNode;
3256 while(textNode.nextSibling && ASPx.IsExists(textNode.nextSibling.nodeValue)) {
3257  textNode.nodeValue += textNode.nextSibling.nodeValue;
3258  textNode.parentNode.removeChild(textNode.nextSibling);
3259 }
3260};
3261ASPx.GetElementDocument = function(element) {
3262 return element.document || element.ownerDocument;
3263};
3264ASPx.RemoveElement = function(element) {
3265 if(element && element.parentNode)
3266  element.parentNode.removeChild(element);
3267};
3268ASPx.ReplaceTagName = function(element, newTagName, cloneChilds) {
3269 if(element.nodeType != 1)
3270  return null;
3271 if(element.nodeName == newTagName)
3272  return element;
3273 cloneChilds = cloneChilds !== undefined ? cloneChilds : true;
3274 var doc = element.ownerDocument;
3275 var newElem = doc.createElement(newTagName);
3276 Attr.CopyAllAttributes(element, newElem);
3277 if(cloneChilds) {
3278  for(var i = 0; i < element.childNodes.length; i++)
3279   newElem.appendChild(element.childNodes[i].cloneNode(true));
3280 }
3281 else {
3282  for(var child; child = element.firstChild; )
3283   newElem.appendChild(child);
3284 }
3285 element.parentNode.replaceChild(newElem, element);
3286 return newElem;
3287};
3288ASPx.RemoveOuterTags = function(element) {
3289 if(ASPx.Browser.IE) {
3290  element.insertAdjacentHTML( 'beforeBegin', element.innerHTML ) ;
3291  ASPx.RemoveElement(element);
3292 } else {
3293  var docFragment = element.ownerDocument.createDocumentFragment();
3294  for(var i = 0; i < element.childNodes.length; i++)
3295   docFragment.appendChild(element.childNodes[i].cloneNode(true));
3296  element.parentNode.replaceChild(docFragment, element);
3297 }
3298};
3299ASPx.WrapElementInNewElement = function(element, newElementTagName) { 
3300 var wrapElement = null;
3301 if(Browser.IE) {
3302  var wrapElement = element.ownerDocument.createElement(newElementTagName);
3303  wrapElement.appendChild(element.cloneNode(true));
3304  element.parentNode.insertBefore(wrapElement, element);
3305  element.parentNode.removeChild(element);
3306 } else {
3307  var docFragment = element.ownerDocument.createDocumentFragment();
3308  wrapElement = element.ownerDocument.createElement(newElementTagName);
3309  docFragment.appendChild(wrapElement);
3310  wrapElement.appendChild(element.cloneNode(true));
3311  element.parentNode.replaceChild(docFragment, element);
3312 }
3313 return wrapElement;
3314};
3315ASPx.InsertElementAfter = function(newElement, targetElement) {
3316 var parentElem = targetElement.parentNode;
3317 if(parentElem.childNodes[parentElem.childNodes.length - 1] == targetElement)
3318  parentElem.appendChild(newElement);
3319 else if(newElement !== targetElement.nextSibling)
3320  parentElem.insertBefore(newElement, targetElement.nextSibling);
3321};
3322ASPx.SetElementOpacity = function(element, value) {
3323  var useOpacityStyle = !Browser.IE || Browser.Version > 8;
3324  if(useOpacityStyle){
3325   element.style.opacity = value;
3326  } else {
3327   if(typeof(element.filters) === "object" && element.filters["DXImageTransform.Microsoft.Alpha"])
3328    element.filters.item("DXImageTransform.Microsoft.Alpha").Opacity = value*100;
3329   else
3330   element.style.filter = "alpha(opacity=" + (value * 100) + ")";
3331  }
3332};
3333ASPx.GetElementOpacity = function(element) {
3334 var useOpacityStyle = !Browser.IE || Browser.Version > 8;
3335 if(useOpacityStyle)
3336  return parseFloat(ASPx.GetCurrentStyle(element).opacity);
3337 else {
3338  if(typeof(element.filters) === "object" && element.filters["DXImageTransform.Microsoft.Alpha"]){
3339   return element.filters.item("DXImageTransform.Microsoft.Alpha").Opacity / 100;
3340  } else {
3341   var alphaValue = ASPx.GetCurrentStyle(element).filter;
3342   var value = alphaValue.replace("alpha(opacity=", "");
3343   value = value.replace(")", "");
3344   return parseInt(value) / 100;
3345  }
3346  return 100;
3347 }
3348};
3349ASPx.HiddenChangable = "dx-hc";
3350ASPx.DefaultDisplayNoneSelectors = [ "dxmodalSys" ];
3351ASPx.DefaultDisplaySelectors = ["show"];
3352function getIsDefaultDisplayNone(element) {
3353 for(var i = 0; i < ASPx.DefaultDisplayNoneSelectors.length; i++) {
3354  if(ASPx.ElementHasCssClass(element, ASPx.DefaultDisplayNoneSelectors[i]))
3355   return true;
3356 }
3357 return false;
3358}
3359ASPx.GetElementDisplay = function(element, isCurrentStyle) {
3360 if(isCurrentStyle)
3361  return ASPx.GetCurrentStyle(element).display != "none";
3362 if(getIsDefaultDisplayNone(element))
3363  return element.style.display != "none" && element.style.display != "" || ASPx.DefaultDisplaySelectors.some(function(s) { return ASPx.ElementHasCssClass(element, s); });
3364 return element.style.display != "none" && !ASPx.ElementHasCssClass(element, ASPx.HiddenChangable);
3365};
3366ASPx.SetElementDisplay = function(element, value) {
3367 if(!element) return;
3368 if(ASPx.ElementHasCssClass(element, ASPx.HiddenChangable))
3369  ASPx.RemoveClassNameFromElement(element, ASPx.HiddenChangable);
3370 if(typeof(value) === "string")
3371  element.style.display = value;
3372 else if(getIsDefaultDisplayNone(element))
3373  element.style.display = value ? (element.tagName === "TABLE" ? "table" : "block") : "";
3374 else if(!value)
3375  element.style.display = "none";
3376 else
3377  element.style.display = "";
3378};
3379ASPx.GetElementVisibility = function(element, isCurrentStyle) {
3380 if(isCurrentStyle)
3381  return ASPx.GetCurrentStyle(element).visibility != "hidden";
3382 return element.style.visibility != "hidden";
3383};
3384ASPx.SetElementVisibility = function(element, value) {
3385 if(!element) return;
3386 if(typeof(value) === "string")
3387  element.style.visibility = value;
3388 else
3389  element.style.visibility = value ? "visible" : "hidden";
3390};
3391ASPx.IsElementVisible = function(element, isCurrentStyle) {
3392 while(element && element.tagName != "BODY") {
3393  if(!ASPx.GetElementDisplay(element, isCurrentStyle) || (!ASPx.GetElementVisibility(element, isCurrentStyle) && !Attr.IsExistsAttribute(element, "errorFrame")))
3394     return false;
3395  element = element.parentNode;
3396 }
3397 return true;
3398};
3399ASPx.IsElementDisplayed = function(element) {
3400 while(element && element.tagName != "BODY") {
3401  if(!ASPx.GetElementDisplay(element))
3402     return false;
3403  element = element.parentNode;
3404 }
3405 return true;
3406};
3407ASPx.GetElementInitializedFlag = function(element) {
3408 return element["dxinit"];
3409};
3410ASPx.SetElementInitializedFlag = function(element) {
3411 element["dxinit"] = true;
3412};
3413ASPx.AddStyleSheetLinkToDocument = function(doc, linkUrl) {
3414 var newLink = createStyleLink(doc, linkUrl);
3415 var head = ASPx.GetHeadElementOrCreateIfNotExist(doc);
3416 head.appendChild(newLink);
3417 return newLink;
3418};
3419ASPx.GetHeadElementOrCreateIfNotExist = function(doc) {
3420 var elements = ASPx.GetNodesByTagName(doc, "head");
3421 var head = null;
3422 if(elements.length == 0) {
3423  head = doc.createElement("head");
3424  head.visibility = "hidden";
3425  doc.insertBefore(head, doc.body);
3426 } else
3427  head = elements[0];
3428 return head;
3429};
3430function createStyleLink(doc, url) {
3431 var newLink = doc.createElement("link");
3432 Attr.SetAttribute(newLink, "href", url);
3433 Attr.SetAttribute(newLink, "rel", "stylesheet");
3434 Attr.AppendStyleType(newLink);
3435 return newLink;
3436}
3437ASPx.GetCurrentStyle = function(element) {
3438 if(document.defaultView && document.defaultView.getComputedStyle) { 
3439  var result = document.defaultView.getComputedStyle(element, null);
3440  if(!result && Browser.Firefox && window.frameElement) {
3441   var changes = [];
3442   var curElement = window.frameElement;
3443   while(!(result = document.defaultView.getComputedStyle(element, null))) {
3444    changes.push([curElement, curElement.style.display]);
3445    ASPx.SetStylesCore(curElement, "display", "block", true);
3446    curElement = curElement.tagName == "BODY" ? curElement.ownerDocument.defaultView.frameElement : curElement.parentNode;
3447   }
3448   result = ASPx.CloneObject(result);
3449   for(var ch, i = 0; ch = changes[i]; i++)
3450    ASPx.SetStylesCore(ch[0], "display", ch[1]);
3451   var dummy = document.body.offsetWidth; 
3452  }
3453  if(Browser.Firefox && Browser.MajorVersion >= 62 && window.frameElement && result.length === 0) { 
3454   result = ASPx.CloneObject(result);
3455   result.display = element.style.display;
3456  }
3457  return result;
3458 }
3459 return window.getComputedStyle(element, null);
3460};
3461ASPx.CreateStyleSheetInDocument = function(doc) {
3462 if(doc.createStyleSheet) {
3463  try {
3464   return doc.createStyleSheet();
3465  }
3466  catch(e) {
3467   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.";
3468   throw new Error(message);
3469  }
3470 }
3471 else {
3472  var styleSheet = doc.createElement("STYLE");
3473  ASPx.GetNodeByTagName(doc, "HEAD", 0).appendChild(styleSheet);
3474  return styleSheet.sheet;
3475 }
3476};
3477ASPx.currentStyleSheet = null;
3478ASPx.GetCurrentStyleSheet = function() {
3479 if(!ASPx.currentStyleSheet)
3480  ASPx.currentStyleSheet = ASPx.CreateStyleSheetInDocument(document);
3481 return ASPx.currentStyleSheet;
3482};
3483function getStyleSheetRules(styleSheet){
3484 try {
3485  if (styleSheet.href && styleSheet.href.indexOf("file:///") === 0)
3486   return null;
3487  return Browser.IE && Browser.Version == 8 ? styleSheet.rules : styleSheet.cssRules;
3488 }
3489 catch(e) {
3490  return null;
3491 }
3492}
3493ASPx.cachedCssRules = { };
3494ASPx.GetStyleSheetRules = function (className, stylesStorageDocument) {
3495 if(ASPx.cachedCssRules[className]) {
3496  if(ASPx.cachedCssRules[className] != ASPx.EmptyObject)
3497   return ASPx.cachedCssRules[className];
3498  return null;
3499 }
3500 var result = iterateStyleSheetRules(stylesStorageDocument, function(rule) {
3501  if(rule.selectorText == "." + className){
3502   ASPx.cachedCssRules[className] = rule;
3503   return rule;
3504  }
3505 });
3506 if(ASPx.IsExists(result))
3507  return result;
3508 ASPx.cachedCssRules[className] = ASPx.EmptyObject;
3509 return null;
3510};
3511function iterateStyleSheetRules(stylesStorageDocument, callback) {
3512 var doc = stylesStorageDocument || document;
3513 for(var i = 0; i < doc.styleSheets.length; i ++){
3514  var styleSheet = doc.styleSheets[i];
3515  var rules = getStyleSheetRules(styleSheet);
3516  if(rules != null){
3517   for(var j = 0; j < rules.length; j ++) {
3518    var result = callback(rules[j]);
3519    if(result !== undefined)
3520     return result;
3521   }
3522  }
3523 }
3524}
3525ASPx.ProcessStyleSheetRules = function(prefix, callback) {
3526 iterateStyleSheetRules(null, function(rule) {
3527  if(!!rule.selectorText && rule.selectorText.indexOf(prefix) === 0) {
3528   var name = rule.selectorText.substring(prefix.length);
3529   var result = callback(name, rule.style, rule);
3530   if(result !== undefined)
3531    return result;
3532  }
3533 });
3534};
3535ASPx.ClearCachedCssRules = function(){
3536 ASPx.cachedCssRules = { };
3537};
3538var styleCount = 0;
3539var styleNameCache = { };
3540ASPx.CreateImportantStyleRule = function(styleSheet, cssText, postfix, prefix) {
3541 styleSheet = styleSheet || ASPx.GetCurrentStyleSheet();
3542 var cacheKey = (postfix ? postfix + "||" : "") + cssText + (prefix ? "||" + prefix : "");
3543 if(styleNameCache[cacheKey])
3544  return styleNameCache[cacheKey];
3545 prefix = prefix ? prefix + " " : "";
3546 var className = "dxh" + styleCount + (postfix ? postfix : "");
3547 ASPx.AddStyleSheetRule(styleSheet, prefix + "." + className, ASPx.CreateImportantCssText(cssText));
3548 styleCount++;
3549 styleNameCache[cacheKey] = className;
3550 return className; 
3551};
3552ASPx.CreateImportantCssText = function(cssText) {
3553 var newText = "";
3554 var hasEncodedSemicolon = cssText.indexOf(ASPx.StyleValueEncodedSemicolon) > -1;
3555 var attributes = cssText.split(";");
3556 for(var i = 0; i < attributes.length; i++) {
3557  var rule = attributes[i];
3558  if(rule != "")
3559   newText += ASPx.CreateImportantCssRule(rule, hasEncodedSemicolon);
3560 }
3561 return newText;
3562};
3563ASPx.CreateImportantCssRule = function(rule, hasEncodedSemicolon) {
3564 var result = rule;
3565 if(hasEncodedSemicolon) {
3566  var regex = new RegExp(ASPx.StyleValueEncodedSemicolon, "g");
3567  result = result.replace(regex, ";");
3568 }
3569 result = result + " !important;";
3570 return result;
3571};
3572ASPx.AddStyleSheetRule = function(styleSheet, selector, cssText){
3573 if(!cssText) return;
3574 var index = styleSheet.cssRules.length;
3575 styleSheet.insertRule(selector + " { " + cssText + " }", index);
3576 return styleSheet.cssRules[index];
3577};
3578ASPx.GetPointerCursor = function() {
3579 return "pointer";
3580};
3581ASPx.SetPointerCursor = function(element) {
3582 if(element.style.cursor == "")
3583  element.style.cursor = ASPx.GetPointerCursor();
3584};
3585ASPx.SetElementFloat = function(element, value) {
3586 if(ASPx.IsExists(element.style.cssFloat))
3587  element.style.cssFloat = value;
3588 else if(ASPx.IsExists(element.style.styleFloat))
3589  element.style.styleFloat = value;
3590 else
3591  Attr.SetAttribute(element.style, "float", value);
3592};
3593ASPx.GetElementFloat = function(element) {
3594 var currentStyle = ASPx.GetCurrentStyle(element);
3595 if(ASPx.IsExists(currentStyle.cssFloat))
3596  return currentStyle.cssFloat;
3597 if(ASPx.IsExists(currentStyle.styleFloat))
3598  return currentStyle.styleFloat;
3599 return Attr.GetAttribute(currentStyle, "float");
3600};
3601function getElementDirection(element) {
3602 return ASPx.GetCurrentStyle(element).direction;
3603}
3604ASPx.IsElementRightToLeft = function(element) {
3605 return getElementDirection(element) == "rtl";
3606};
3607ASPx.AdjustVerticalMarginsInContainer = function(container) {
3608 var containerBorderAndPaddings = ASPx.GetTopBottomBordersAndPaddingsSummaryValue(container);
3609 var flowElements = [], floatElements = [], floatTextElements = [];
3610 var maxHeight = 0, maxFlowHeight = 0;
3611 for(var i = 0; i < container.childNodes.length; i++) {
3612  var element = container.childNodes[i];
3613  if(!element.offsetHeight) continue;
3614  ASPx.ClearVerticalMargins(element);
3615 }
3616 for(var i = 0; i < container.childNodes.length; i++) {
3617  var element = container.childNodes[i];
3618  if(!element.offsetHeight) continue;
3619  var float = ASPx.GetElementFloat(element);
3620  var isFloat = (float === "left" || float === "right");
3621  if(isFloat)
3622   floatElements.push(element);
3623  else {
3624   flowElements.push(element);
3625   if(element.tagName !== "IMG"){
3626    if(!ASPx.IsTextWrapped(element))
3627     element.style.verticalAlign = 'baseline'; 
3628    floatTextElements.push(element);
3629   }
3630   if(element.tagName === "DIV")
3631    Attr.ChangeStyleAttribute(element, "float", "left"); 
3632  }
3633  if(element.offsetHeight > maxHeight) 
3634   maxHeight = element.offsetHeight;
3635  if(!isFloat && element.offsetHeight > maxFlowHeight) 
3636   maxFlowHeight = element.offsetHeight;
3637 }
3638 for(var i = 0; i < flowElements.length; i++) 
3639  Attr.RestoreStyleAttribute(flowElements[i], "float");
3640 var containerBorderAndPaddings = ASPx.GetTopBottomBordersAndPaddingsSummaryValue(container);
3641 var containerHeight = container.offsetHeight - containerBorderAndPaddings;
3642 if(maxHeight == containerHeight) {
3643  var verticalAlign = ASPx.GetCurrentStyle(container).verticalAlign;
3644  for(var i = 0; i < floatTextElements.length; i++)
3645   floatTextElements[i].style.verticalAlign = '';
3646  containerHeight = container.offsetHeight - containerBorderAndPaddings;
3647  for(var i = 0; i < floatElements.length; i++)
3648   adjustVerticalMarginsCore(floatElements[i], containerHeight, verticalAlign, true);
3649  for(var i = 0; i < flowElements.length; i++) {
3650   if(maxFlowHeight != maxHeight)
3651    adjustVerticalMarginsCore(flowElements[i], containerHeight, verticalAlign);
3652  }
3653 }
3654};
3655ASPx.AdjustVerticalMargins = function(element) {
3656 ASPx.ClearVerticalMargins(element);
3657 var parentElement = element.parentNode;
3658 var parentHeight = parentElement.getBoundingClientRect().height - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(parentElement);
3659 adjustVerticalMarginsCore(element, parentHeight, ASPx.GetCurrentStyle(parentElement).verticalAlign);
3660};
3661function adjustVerticalMarginsCore(element, parentHeight, verticalAlign, toBottom) {
3662 var marginTop;
3663 if(verticalAlign == "top")
3664  marginTop = 0;
3665 else if(verticalAlign == "bottom")
3666  marginTop = parentHeight - element.getBoundingClientRect().height;
3667 else
3668  marginTop = (parentHeight - element.getBoundingClientRect().height) / 2;
3669 if(marginTop !== 0){
3670  element.style.marginTop = marginTop + "px";
3671 }
3672}
3673ASPx.ClearVerticalMargins = function(element) {
3674 element.style.marginTop = "";
3675 element.style.marginBottom = "";
3676};
3677ASPx.AdjustHeightInContainer = function(container) {
3678 var height = container.offsetHeight - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(container);
3679 for(var i = 0; i < container.childNodes.length; i++) {
3680  var element = container.childNodes[i];
3681  if(!element.offsetHeight) continue;
3682  ASPx.ClearHeight(element);
3683 }
3684 var elements = [];
3685 var childrenHeight = 0;
3686 for(var i = 0; i < container.childNodes.length; i++) {
3687  var element = container.childNodes[i];
3688  if(!element.offsetHeight) continue;
3689  childrenHeight += element.offsetHeight + ASPx.GetTopBottomMargins(element);
3690  elements.push(element);
3691 }
3692 if(elements.length > 0 && childrenHeight < height) {
3693  var correctedHeight = 0;
3694  for(var i = 0; i < elements.length; i++) {
3695   var elementHeight = 0;
3696   if(i < elements.length - 1){
3697    var elementHeight = Math.floor(height / elements.length);
3698    correctedHeight += elementHeight;
3699   }
3700   else{
3701    var elementHeight = height - correctedHeight;
3702    if(elementHeight < 0) elementHeight = 0;
3703   }
3704   adjustHeightCore(elements[i], elementHeight);
3705  }
3706 }
3707};
3708ASPx.AdjustHeight = function(element) {
3709 ASPx.ClearHeight(element);
3710 var parentElement = element.parentNode;
3711 var height = parentElement.getBoundingClientRect().height - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(parentElement);
3712 adjustHeightCore(element, height);
3713};
3714function adjustHeightCore(element, height) {
3715 var height = height - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(element);
3716 if(height < 0) height = 0;
3717 element.style.height = height + "px";
3718}
3719ASPx.ClearHeight = function(element) {
3720 element.style.height = "";
3721};
3722ASPx.ShrinkWrappedTextInContainer = function(container) {
3723 if(!container) return;
3724 for(var i = 0; i < container.childNodes.length; i++){
3725  var child = container.childNodes[i];
3726  if(child.style && ASPx.IsTextWrapped(child)) {
3727   Attr.ChangeStyleAttribute(child, "width", "1px");
3728   child.shrinkedTextContainer = true;
3729  }
3730 }
3731};
3732ASPx.AdjustWrappedTextInContainer = function(container) {
3733 if(!container) return;
3734 var textContainer, leftWidth = 0, rightWidth = 0;
3735 for(var i = 0; i < container.childNodes.length; i++){
3736  var child = container.childNodes[i];
3737  if(child.tagName === "BR")
3738   return;
3739  if(!child.tagName)
3740   continue;
3741  if(child.tagName !== "IMG"){
3742   textContainer = child;
3743   if(ASPx.IsTextWrapped(textContainer)){
3744    if(!textContainer.shrinkedTextContainer)
3745     textContainer.style.width = "";
3746    textContainer.style.marginRight = "";
3747   }
3748  }
3749  else {
3750   if(ASPx.GetElementOffsetWidth(child)=== 0)
3751    Evt.AttachEventToElement(child, "load", function(evt) { ASPx.AdjustWrappedTextInContainer(container); });
3752   else {
3753    var width = ASPx.GetElementOffsetWidth(child) + ASPx.GetLeftRightMargins(child);
3754    if(textContainer)
3755     rightWidth += width;
3756    else
3757     leftWidth += width;
3758   }
3759  }
3760 }
3761 if(textContainer && ASPx.IsTextWrapped(textContainer)) {
3762  var containerWidth = ASPx.GetElementOffsetWidth(container) - ASPx.GetLeftRightBordersAndPaddingsSummaryValue(container);
3763  if(textContainer.shrinkedTextContainer) {
3764   Attr.RestoreStyleAttribute(textContainer, "width");
3765   Attr.ChangeStyleAttribute(container, "width", containerWidth + "px");
3766  }
3767  if(ASPx.GetElementOffsetWidth(textContainer) + leftWidth + rightWidth >= containerWidth) {
3768    if(rightWidth > 0 && !textContainer.shrinkedTextContainer)
3769    textContainer.style.width = (containerWidth - rightWidth) + "px";
3770   else if(leftWidth > 0){
3771    if(ASPx.IsElementRightToLeft(container))
3772     textContainer.style.marginLeft = leftWidth + "px";
3773    else
3774     textContainer.style.marginRight = leftWidth + "px";
3775   }
3776  }
3777 }
3778};
3779ASPx.IsTextWrapped = function(element) {
3780 return element && element.tagName !== "IMG" && ASPx.GetCurrentStyle(element).whiteSpace !== "nowrap";
3781};
3782ASPx.IsValidPosition = function(pos){
3783 return pos != ASPx.InvalidPosition && pos != -ASPx.InvalidPosition;
3784};
3785ASPx.getSpriteMainElement = function(element) {
3786 var cssClassMarker = "dx-acc";
3787 if(ASPx.ElementContainsCssClass(element, cssClassMarker))
3788  return element;
3789 if(element.parentNode && ASPx.ElementContainsCssClass(element.parentNode, cssClassMarker))
3790  return element.parentNode;
3791 return element;
3792};
3793ASPx.GetAbsoluteX = function(curEl){
3794 return ASPx.GetAbsolutePositionX(curEl);
3795};
3796ASPx.GetAbsoluteY = function(curEl){
3797 return ASPx.GetAbsolutePositionY(curEl);
3798};
3799ASPx.SetAbsoluteX = function(element, x){
3800 element.style.left = ASPx.PrepareClientPosForElement(x, element, true) + "px";
3801};
3802ASPx.SetAbsoluteY = function(element, y){
3803 element.style.top = ASPx.PrepareClientPosForElement(y, element, false) + "px";
3804};
3805ASPx.GetAbsolutePositionX = function(element){
3806 if(Browser.IE)
3807  return getAbsolutePositionX_IE(element);
3808 else if(Browser.Firefox && Browser.Version >= 3)
3809  return getAbsolutePositionX_FF3(element);
3810 else if(Browser.Opera)
3811  return getAbsolutePositionX_Opera(element);
3812 else if(Browser.NetscapeFamily && (!Browser.Firefox || Browser.Version < 3))
3813  return getAbsolutePositionX_NS(element);
3814 else if(Browser.WebKitFamily || Browser.Edge)
3815  return getAbsolutePositionX_FF3(element);
3816 else
3817  return getAbsolutePositionX_Other(element);
3818};
3819function getAbsolutePositionX_Opera(curEl){
3820 var isFirstCycle = true;
3821 var pos = getAbsoluteScrollOffset_OperaFF(curEl, true);
3822 while(curEl != null) {
3823  pos += curEl.offsetLeft;
3824  if(!isFirstCycle)
3825   pos -= curEl.scrollLeft;
3826  curEl = curEl.offsetParent;
3827  isFirstCycle = false;
3828 }
3829 pos += document.body.scrollLeft;
3830 return pos;
3831}
3832function getAbsolutePositionX_IE(element){
3833 if(element == null || Browser.IE && element.parentNode == null) return 0; 
3834 return element.getBoundingClientRect().left + ASPx.GetDocumentScrollLeft();
3835}
3836function getAbsolutePositionX_FF3(element){
3837 if(element == null) return 0;
3838 var x = element.getBoundingClientRect().left + ASPx.GetDocumentScrollLeft();
3839 return x;
3840}
3841function getAbsolutePositionX_NS(curEl){
3842 var pos = getAbsoluteScrollOffset_OperaFF(curEl, true);
3843 var isFirstCycle = true;
3844 while(curEl != null) {
3845  pos += curEl.offsetLeft;
3846  if(!isFirstCycle && curEl.offsetParent != null)
3847   pos -= curEl.scrollLeft;
3848  if(!isFirstCycle && Browser.Firefox){
3849   var style = ASPx.GetCurrentStyle(curEl);
3850   if(curEl.tagName == "DIV" && style.overflow != "visible")
3851    pos += ASPx.PxToInt(style.borderLeftWidth);
3852  }
3853  isFirstCycle = false;
3854  curEl = curEl.offsetParent;
3855 }
3856 return pos;
3857}
3858function getAbsolutePositionX_Other(curEl){
3859 var pos = 0;
3860 var isFirstCycle = true;
3861 while(curEl != null) {
3862  pos += curEl.offsetLeft;
3863  if(!isFirstCycle && curEl.offsetParent != null)
3864   pos -= curEl.scrollLeft;
3865  isFirstCycle = false;
3866  curEl = curEl.offsetParent;
3867 }
3868 return pos;
3869}
3870ASPx.GetAbsolutePositionY = function(element){
3871 if(Browser.IE)
3872  return getAbsolutePositionY_IE(element);
3873 else if(Browser.Firefox && Browser.Version >= 3)
3874  return getAbsolutePositionY_FF3(element);
3875 else if(Browser.Opera)
3876  return getAbsolutePositionY_Opera(element);
3877 else if(Browser.NetscapeFamily && (!Browser.Firefox || Browser.Version < 3))
3878  return getAbsolutePositionY_NS(element);
3879 else if(Browser.WebKitFamily || Browser.Edge)
3880  return getAbsolutePositionY_FF3(element);
3881 else
3882  return getAbsolutePositionY_Other(element);
3883};
3884function getAbsolutePositionY_Opera(curEl){
3885 var isFirstCycle = true;
3886 if(curEl && curEl.tagName == "TR" && curEl.cells.length > 0)
3887  curEl = curEl.cells[0];
3888 var pos = getAbsoluteScrollOffset_OperaFF(curEl, false);
3889 while(curEl != null) {
3890  pos += curEl.offsetTop;
3891  if(!isFirstCycle)
3892   pos -= curEl.scrollTop;
3893  curEl = curEl.offsetParent;
3894  isFirstCycle = false;
3895 }
3896 pos += document.body.scrollTop;
3897 return pos;
3898}
3899function getAbsolutePositionY_IE(element){
3900 if(element == null || Browser.IE && element.parentNode == null) return 0; 
3901 return element.getBoundingClientRect().top + ASPx.GetDocumentScrollTop();
3902}
3903function getAbsolutePositionY_FF3(element){
3904 if(element == null) return 0;
3905 var y = element.getBoundingClientRect().top + ASPx.GetDocumentScrollTop();
3906 return y;
3907}
3908function getAbsolutePositionY_NS(curEl){
3909 var pos = getAbsoluteScrollOffset_OperaFF(curEl, false);
3910 var isFirstCycle = true;
3911 while(curEl != null) {
3912  pos += curEl.offsetTop;
3913  if(!isFirstCycle && curEl.offsetParent != null)
3914   pos -= curEl.scrollTop;
3915  if(!isFirstCycle && Browser.Firefox){
3916   var style = ASPx.GetCurrentStyle(curEl);
3917   if(curEl.tagName == "DIV" && style.overflow != "visible")
3918    pos += ASPx.PxToInt(style.borderTopWidth);
3919  }
3920  isFirstCycle = false;
3921  curEl = curEl.offsetParent;
3922 }
3923 return pos;
3924}
3925function getAbsoluteScrollOffset_OperaFF(curEl, isX) {
3926 var pos = 0;   
3927 var isFirstCycle = true;
3928 while(curEl != null) {
3929  if(curEl.tagName == "BODY")
3930   break;
3931  var style = ASPx.GetCurrentStyle(curEl);
3932  if(style.position == "absolute")
3933   break;
3934  if(!isFirstCycle && curEl.tagName == "DIV" && (style.position == "" || style.position == "static"))
3935   pos -= isX ? curEl.scrollLeft : curEl.scrollTop;
3936  curEl = curEl.parentNode;
3937  isFirstCycle = false;
3938 }
3939 return pos; 
3940}
3941function getAbsolutePositionY_Other(curEl){
3942 var pos = 0;
3943 var isFirstCycle = true;
3944 while(curEl != null) {
3945  pos += curEl.offsetTop;
3946  if(!isFirstCycle && curEl.offsetParent != null)
3947   pos -= curEl.scrollTop;
3948  isFirstCycle = false;
3949  curEl = curEl.offsetParent;
3950 }
3951 return pos;
3952}
3953function createElementMock(element) {
3954 var div = document.createElement('DIV');
3955 div.style.top = "0px";
3956 div.style.left = "0px";
3957 div.visibility = "hidden";
3958 div.style.position = ASPx.GetCurrentStyle(element).position;
3959 return div;
3960}
3961ASPx.PrepareClientPosElementForOtherParent = function(pos, element, otherParent, isX) {
3962 if(element.parentNode == otherParent)
3963  return ASPx.PrepareClientPosForElement(pos, element, isX);
3964 var elementMock = createElementMock(element);
3965 otherParent.appendChild(elementMock); 
3966 var preparedPos = ASPx.PrepareClientPosForElement(pos, elementMock, isX);
3967 otherParent.removeChild(elementMock);
3968 return preparedPos;
3969};
3970ASPx.PrepareClientPosForElement = function(pos, element, isX) {
3971 pos -= ASPx.GetPositionElementOffset(element, isX);
3972 return pos;
3973};
3974function getExperimentalPositionOffset(element, isX) {
3975 var div = createElementMock(element);
3976 if(div.style.position == "static")
3977  div.style.position = "absolute";
3978 element.parentNode.appendChild(div); 
3979 var realPos = isX ? ASPx.GetAbsoluteX(div) : ASPx.GetAbsoluteY(div);
3980 element.parentNode.removeChild(div);
3981 return realPos;
3982}
3983ASPx.GetPositionElementOffset = function(element, isX) {
3984 return getExperimentalPositionOffset(element, isX);
3985};
3986ASPx.GetSizeOfText = function(text, textCss) {
3987 var testContainer = document.createElement("tester");
3988 var defaultLineHeight = ASPx.Browser.Firefox ? "1" : "";
3989 testContainer.style.fontSize = textCss.fontSize;
3990 testContainer.style.fontFamily = textCss.fontFamily;
3991 testContainer.style.fontWeight = textCss.fontWeight;
3992 testContainer.style.letterSpacing = textCss.letterSpacing;
3993 testContainer.style.lineHeight = textCss.lineHeight || defaultLineHeight;
3994 testContainer.style.position = "absolute";
3995 testContainer.style.top = ASPx.InvalidPosition + "px";
3996 testContainer.style.left = ASPx.InvalidPosition + "px";
3997 testContainer.style.width = "auto";
3998 testContainer.style.whiteSpace = "nowrap";
3999 testContainer.appendChild(document.createTextNode(text));
4000 var testElement = document.body.appendChild(testContainer);
4001 var size = {
4002  "width": testElement.offsetWidth,
4003  "height": testElement.offsetHeight
4004 };
4005 document.body.removeChild(testElement);
4006 return size;
4007};
4008ASPx.PointToPixel = function(points, addPx) {  
4009 var result = 0;
4010 try {
4011  var indexOfPt = points.toLowerCase().indexOf("pt");
4012  if(indexOfPt > -1)
4013   result = parseInt(points.substr(0, indexOfPt)) * 96 / 72;
4014  else
4015   result = parseInt(points) * 96 / 72;
4016  if(addPx)
4017   result = result + "px";
4018 } catch(e) {}
4019 return result;
4020};
4021ASPx.PixelToPoint = function(pixels, addPt) { 
4022 var result = 0;
4023 try {
4024  var indexOfPx = pixels.toLowerCase().indexOf("px");
4025  if(indexOfPx > -1)
4026   result = parseInt(pixels.substr(0, indexOfPx)) * 72 / 96;
4027  else
4028   result = parseInt(pixels) * 72 / 96;
4029  if(addPt)
4030   result = result + "pt";
4031 } catch(e) {}
4032 return result;         
4033};
4034ASPx.PxToInt = function(px) {
4035 return pxToNumber(px, parseInt);
4036};
4037ASPx.PxToFloat = function(px) {
4038 return pxToNumber(px, parseFloat);
4039};
4040function pxToNumber(px, parseFunction) {
4041 var result = 0;
4042 if(px != null && px != "") {
4043  try {
4044   var indexOfPx = px.indexOf("px");
4045   if(indexOfPx > -1)
4046    result = parseFunction(px.substr(0, indexOfPx));
4047  } catch(e) { }
4048 }
4049 return result;
4050}
4051ASPx.PercentageToFloat = function(perc) {
4052 var result = 0;
4053 if(perc != null && perc != "") {
4054  try {
4055   var indexOfPerc = perc.indexOf("%");
4056   if(indexOfPerc > -1)
4057    result = parseFloat(perc.substr(0, indexOfPerc)) / 100;
4058  } catch(e) { }
4059 }
4060 return result;
4061};
4062ASPx.CreateGuid = function() {
4063 return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { 
4064   var r = Math.random()*16|0,v=c=='x'?r:r&0x3|0x8;
4065  return v.toString(16);
4066 });
4067};
4068ASPx.GetLeftRightBordersAndPaddingsSummaryValue = function(element, currentStyle) {
4069 return ASPx.GetLeftRightPaddings(element, currentStyle) + ASPx.GetHorizontalBordersWidth(element, currentStyle);
4070};
4071ASPx.GetTopBottomBordersAndPaddingsSummaryValue = function(element, currentStyle) {
4072 return ASPx.GetTopBottomPaddings(element, currentStyle) + ASPx.GetVerticalBordersWidth(element, currentStyle);
4073};
4074ASPx.GetVerticalBordersWidth = function(element, style) {
4075 if(!ASPx.IsExists(style))
4076  style = (Browser.IE && Browser.MajorVersion != 9 && window.getComputedStyle) ? window.getComputedStyle(element) : ASPx.GetCurrentStyle(element);
4077 var res = 0;
4078 if(style.borderTopStyle != "none") {
4079  res += ASPx.PxToFloat(style.borderTopWidth);
4080  if(Browser.IE && Browser.MajorVersion < 9)
4081   res += getIe8BorderWidthFromText(style.borderTopWidth);
4082 }
4083 if(style.borderBottomStyle != "none") {
4084  res += ASPx.PxToFloat(style.borderBottomWidth);
4085  if(Browser.IE && Browser.MajorVersion < 9)
4086   res += getIe8BorderWidthFromText(style.borderBottomWidth);
4087 }
4088 return res;
4089};
4090ASPx.GetHorizontalBordersWidth = function(element, style) {
4091 if(!ASPx.IsExists(style))
4092  style = (Browser.IE && window.getComputedStyle) ? window.getComputedStyle(element) : ASPx.GetCurrentStyle(element);
4093 var res = 0;
4094 if(style.borderLeftStyle != "none") {
4095  res += ASPx.PxToFloat(style.borderLeftWidth);
4096  if(Browser.IE && Browser.MajorVersion < 9)
4097   res += getIe8BorderWidthFromText(style.borderLeftWidth);
4098 }
4099 if(style.borderRightStyle != "none") {
4100  res += ASPx.PxToFloat(style.borderRightWidth);
4101  if(Browser.IE && Browser.MajorVersion < 9)
4102   res += getIe8BorderWidthFromText(style.borderRightWidth);
4103 }
4104 return res;
4105};
4106function getIe8BorderWidthFromText(textWidth) {
4107 var availableWidth = { "thin": 1, "medium" : 3, "thick": 5 };
4108 var width = availableWidth[textWidth];
4109 return width ? width : 0;
4110}
4111ASPx.GetTopBottomPaddings = function(element, style) {
4112 var currentStyle = style ? style : ASPx.GetCurrentStyle(element);
4113 return ASPx.PxToInt(currentStyle.paddingTop) + ASPx.PxToInt(currentStyle.paddingBottom);
4114};
4115ASPx.GetTopPaddings = function(element, style) {
4116 var currentStyle = style ? style : ASPx.GetCurrentStyle(element);
4117 return ASPx.PxToInt(currentStyle.paddingTop);
4118};
4119ASPx.GetBottomPaddings = function(element, style) {
4120 var currentStyle = style ? style : ASPx.GetCurrentStyle(element);
4121 return ASPx.PxToInt(currentStyle.paddingBottom);
4122};
4123ASPx.GetLeftRightPaddings = function(element, style) {
4124 var currentStyle = style ? style : ASPx.GetCurrentStyle(element);
4125 return ASPx.PxToInt(currentStyle.paddingLeft) + ASPx.PxToInt(currentStyle.paddingRight);
4126};
4127ASPx.GetTopBottomMargins = function(element, style) {
4128 var currentStyle = style ? style : ASPx.GetCurrentStyle(element);
4129 return ASPx.PxToInt(currentStyle.marginTop) + ASPx.PxToInt(currentStyle.marginBottom);
4130};
4131ASPx.GetLeftRightMargins = function(element, style) {
4132 var currentStyle = style ? style : ASPx.GetCurrentStyle(element);
4133 return ASPx.PxToInt(currentStyle.marginLeft) + ASPx.PxToInt(currentStyle.marginRight);
4134};
4135ASPx.GetClearClientWidth = function(element) {
4136 return ASPx.GetElementOffsetWidth(element)- ASPx.GetLeftRightBordersAndPaddingsSummaryValue(element);
4137};
4138ASPx.GetClearClientHeight = function(element) {
4139 return ASPx.GetElementOffsetHeight(element) - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(element);
4140};
4141ASPx.SetOffsetWidth = function(element, widthValue, currentStyle) {
4142 if(!ASPx.IsExists(currentStyle))
4143  currentStyle = ASPx.GetCurrentStyle(element);
4144 var value = widthValue - ASPx.PxToInt(currentStyle.marginLeft) - ASPx.PxToInt(currentStyle.marginRight);
4145  value -= ASPx.GetLeftRightBordersAndPaddingsSummaryValue(element, currentStyle);
4146 if(value > -1)
4147  element.style.width = value + "px";
4148};
4149ASPx.SetOffsetHeight = function(element, heightValue, currentStyle) {
4150 if(!ASPx.IsExists(currentStyle))
4151  currentStyle = ASPx.GetCurrentStyle(element);
4152 var value = heightValue - ASPx.PxToInt(currentStyle.marginTop) - ASPx.PxToInt(currentStyle.marginBottom);
4153  value -= ASPx.GetTopBottomBordersAndPaddingsSummaryValue(element, currentStyle);
4154 if(value > -1)
4155  element.style.height = value + "px";
4156};
4157ASPx.FindOffsetParent = function(element) {
4158 var currentElement = element.parentNode;
4159 while(ASPx.IsExistsElement(currentElement) && currentElement.tagName != "BODY") {
4160  if(ASPx.GetElementOffsetWidth(currentElement) > 0 && ASPx.GetElementOffsetHeight(currentElement) > 0)
4161   return currentElement;
4162  currentElement = currentElement.parentNode;
4163 }
4164 return document.body;
4165};
4166ASPx.GetDocumentScrollTop = function(){
4167 var isScrollBodyIE = Browser.IE && ASPx.GetCurrentStyle(document.body).overflow == "hidden" && document.body.scrollTop > 0;
4168 if(Browser.WebKitFamily || Browser.Edge || isScrollBodyIE) {
4169  if(Browser.MacOSMobilePlatform) 
4170   return window.pageYOffset;
4171  if(Browser.WebKitFamily)
4172   return document.documentElement.scrollTop || document.body.scrollTop;
4173  return document.body.scrollTop;
4174 }
4175 else
4176  return document.documentElement.scrollTop;
4177};
4178ASPx.SetDocumentScrollTop = function(scrollTop) {
4179 if(Browser.WebKitFamily && Browser.Version < 60 || Browser.Edge)
4180  document.body.scrollTop = scrollTop;
4181 else
4182  document.documentElement.scrollTop = scrollTop;
4183};
4184ASPx.GetDocumentScrollLeft = function(){
4185 var isScrollBodyIE = Browser.IE && ASPx.GetCurrentStyle(document.body).overflow == "hidden" && document.body.scrollLeft > 0;
4186 if(Browser.Edge || isScrollBodyIE)
4187  return document.body ? document.body.scrollLeft : document.documentElement.scrollLeft;
4188 if(Browser.WebKitFamily)
4189  return document.documentElement.scrollLeft || document.body.scrollLeft;
4190 return document.documentElement.scrollLeft;
4191};
4192ASPx.SetDocumentScrollLeft = function (scrollLeft) {
4193 if(Browser.WebKitFamily && Browser.Version < 60 || Browser.Edge)
4194  document.body.scrollLeft = scrollLeft;
4195 else
4196  document.documentElement.scrollLeft = scrollLeft;
4197};
4198ASPx.GetDocumentClientWidth = function(){
4199 if(document.documentElement.clientWidth == 0)
4200  return document.body.clientWidth;
4201 else
4202  return document.documentElement.clientWidth;
4203};
4204ASPx.GetDocumentClientHeight = function() {
4205 if(Browser.Firefox && window.innerHeight - document.documentElement.clientHeight > ASPx.GetVerticalScrollBarWidth()) {
4206  return window.innerHeight;
4207 } else if(Browser.Opera && Browser.Version < 9.6 || document.documentElement.clientHeight == 0) {
4208   return document.body.clientHeight;
4209 }
4210 return document.documentElement.clientHeight;
4211};
4212ASPx.GetDocumentWidth = function(){
4213 var bodyWidth = document.body.offsetWidth;
4214 var docWidth = Browser.IE ? document.documentElement.clientWidth : document.documentElement.offsetWidth;
4215 var bodyScrollWidth = document.body.scrollWidth;
4216 var docScrollWidth = document.documentElement.scrollWidth;
4217 return getMaxDimensionOf(bodyWidth, docWidth, bodyScrollWidth, docScrollWidth);
4218};
4219ASPx.GetDocumentHeight = function(){
4220 var bodyHeight = document.body.offsetHeight;
4221 var docHeight = Browser.IE ? document.documentElement.clientHeight : document.documentElement.offsetHeight;
4222 var bodyScrollHeight = document.body.scrollHeight;
4223 var docScrollHeight = document.documentElement.scrollHeight;
4224 var maxHeight = getMaxDimensionOf(bodyHeight, docHeight, bodyScrollHeight, docScrollHeight);
4225 if(Browser.Opera && Browser.Version >= 9.6){
4226  if(Browser.Version < 10)
4227   maxHeight = getMaxDimensionOf(bodyHeight, docHeight, bodyScrollHeight);
4228  var visibleHeightOfDocument = document.documentElement.clientHeight;
4229  if(maxHeight > visibleHeightOfDocument)
4230   maxHeight = getMaxDimensionOf(window.outerHeight, maxHeight);
4231  else
4232   maxHeight = document.documentElement.clientHeight;
4233  return maxHeight;
4234 }
4235 return maxHeight;
4236};
4237ASPx.GetDocumentMaxClientWidth = function(){
4238 var bodyWidth = document.body.offsetWidth;
4239 var docWidth = document.documentElement.offsetWidth;
4240 var docClientWidth = document.documentElement.clientWidth;
4241 return getMaxDimensionOf(bodyWidth, docWidth, docClientWidth);
4242};
4243ASPx.GetDocumentMaxClientHeight = function(){
4244 var bodyHeight = document.body.offsetHeight;
4245 var docHeight = document.documentElement.offsetHeight;
4246 var docClientHeight = document.documentElement.clientHeight;
4247 return getMaxDimensionOf(bodyHeight, docHeight, docClientHeight);
4248};
4249ASPx.verticalScrollIsNotHidden = null;
4250ASPx.horizontalScrollIsNotHidden = null;
4251ASPx.GetVerticalScrollIsNotHidden = function() {
4252 if(!ASPx.IsExists(ASPx.verticalScrollIsNotHidden))
4253  ASPx.verticalScrollIsNotHidden = ASPx.GetCurrentStyle(document.body).overflowY !== "hidden"
4254   && ASPx.GetCurrentStyle(document.documentElement).overflowY !== "hidden";
4255 return ASPx.verticalScrollIsNotHidden;
4256};
4257ASPx.GetHorizontalScrollIsNotHidden = function() {
4258 if(!ASPx.IsExists(ASPx.horizontalScrollIsNotHidden))
4259  ASPx.horizontalScrollIsNotHidden = ASPx.GetCurrentStyle(document.body).overflowX !== "hidden"
4260   && ASPx.GetCurrentStyle(document.documentElement).overflowX !== "hidden";
4261 return ASPx.horizontalScrollIsNotHidden;
4262};
4263ASPx.GetCurrentDocumentWidth = function() {
4264 var result = ASPx.GetDocumentClientWidth();
4265 if(!ASPx.Browser.Safari && ASPx.GetVerticalScrollIsNotHidden() && ASPx.GetDocumentHeight() > ASPx.GetDocumentClientHeight())
4266  result += ASPx.GetVerticalScrollBarWidth();
4267 return result;
4268};
4269ASPx.GetCurrentDocumentHeight = function() {
4270 var result = ASPx.GetDocumentClientHeight();
4271 if(!ASPx.Browser.Safari && ASPx.GetHorizontalScrollIsNotHidden() && ASPx.GetDocumentWidth() > ASPx.GetDocumentClientWidth())
4272  result += ASPx.GetVerticalScrollBarWidth();
4273 return result;
4274};
4275function getMaxDimensionOf(){
4276 var max = ASPx.InvalidDimension;
4277 for(var i = 0; i < arguments.length; i++){
4278  if(max < arguments[i])
4279   max = arguments[i];
4280 }
4281 return max;
4282}
4283ASPx.GetClientLeft = function(element) {
4284 return ASPx.IsExists(element.clientLeft) ? element.clientLeft : (ASPx.GetElementOffsetWidth(element)- element.clientWidth) / 2;
4285};
4286ASPx.GetClientTop = function(element) {
4287 return ASPx.IsExists(element.clientTop) ? element.clientTop : (ASPx.GetElementOffsetHeight(element) - element.clientHeight) / 2;
4288};
4289var requestAnimationFrameFunc = window.requestAnimationFrame || function(callback) { callback(); };
4290var cancelAnimationFrameFunc = window.cancelAnimationFrame || function(id) { };
4291ASPx.CancelAnimationFrame = function(id) { cancelAnimationFrameFunc(id); };
4292ASPx.RequestAnimationFrame = function (callback) { return requestAnimationFrameFunc(callback); };
4293ASPx.SetStyles = function(element, styles, makeImportant) {
4294 if(ASPx.IsExists(styles.cssText))
4295  element.style.cssText = styles.cssText;
4296 if(ASPx.IsExists(styles.className)) {
4297  ASPx.SetClassName(element, styles.className);
4298 }
4299 for(var property in styles) {
4300  if(!styles.hasOwnProperty(property))
4301   continue;
4302  var value = styles[property];
4303  switch (property) {
4304   case "cssText":
4305   case "className":
4306    break;
4307   case "float":
4308    ASPx.SetElementFloat(element, value);
4309    break;
4310   case "opacity":
4311    ASPx.SetElementOpacity(element, value);
4312    break;
4313   case "zIndex":
4314    ASPx.SetStylesCore(element, property, value, makeImportant);
4315    break;
4316   case "fontWeight":
4317    if(ASPx.Browser.IE && ASPx.Browser.Version < 9 && typeof(styles[property]) == "number")
4318     value = styles[property].toString();
4319   default:
4320    ASPx.SetStylesCore(element, property, value + (typeof (value) == "number" ? "px" : ""), makeImportant);
4321  }
4322 }
4323};
4324ASPx.SetStylesCore = function(element, property, value, makeImportant) {
4325 if(makeImportant) {
4326  var index = property.search("[A-Z]");
4327  if(index != -1)
4328   property = property.replace(property.charAt(index), "-" + property.charAt(index).toLowerCase());
4329  if(element.style.setProperty)
4330   element.style.setProperty(property, value, "important");
4331  else 
4332   element.style.cssText += ";" + property + ":" + value + "!important";
4333 }
4334 else
4335  element.style[property] = value;
4336};
4337ASPx.RemoveBordersAndShadows = function(el) {
4338 if(!el || !el.style)
4339  return;
4340 el.style.borderWidth = 0;
4341 if(ASPx.IsExists(el.style.boxShadow))
4342  el.style.boxShadow = "none";
4343 else if(ASPx.IsExists(el.style.MozBoxShadow))
4344  el.style.MozBoxShadow = "none";
4345 else if(ASPx.IsExists(el.style.webkitBoxShadow))
4346  el.style.webkitBoxShadow = "none";
4347};
4348ASPx.GetCellSpacing = function(element) {
4349 var val = parseInt(element.cellSpacing);
4350 if(!isNaN(val)) return val;
4351 val = parseInt(ASPx.GetCurrentStyle(element).borderSpacing);
4352 if(!isNaN(val)) return val;
4353 return 0;
4354};
4355ASPx.GetInnerScrollPositions = function(element) {
4356 var scrolls = [];
4357 getInnerScrollPositionsCore(element, scrolls);
4358 return scrolls;
4359};
4360function getInnerScrollPositionsCore(element, scrolls) {
4361 for(var child = element.firstChild; child; child = child.nextSibling) {
4362  var scrollTop = child.scrollTop,
4363   scrollLeft = child.scrollLeft;
4364  if(scrollTop > 0 || scrollLeft > 0)
4365   scrolls.push([child, scrollTop, scrollLeft]);
4366  getInnerScrollPositionsCore(child, scrolls);
4367 }
4368}
4369ASPx.RestoreInnerScrollPositions = function(scrolls) {
4370 for(var i = 0, scrollArr; scrollArr = scrolls[i]; i++) {
4371  if(scrollArr[1] > 0)
4372   scrollArr[0].scrollTop = scrollArr[1];
4373  if(scrollArr[2] > 0)
4374   scrollArr[0].scrollLeft = scrollArr[2];
4375 }
4376};
4377ASPx.GetOuterScrollPosition = function(element) {
4378 while(element && element.tagName !== "BODY") {
4379  var scrollTop = element.scrollTop,
4380   scrollLeft = element.scrollLeft;
4381  if(scrollTop > 0 || scrollLeft > 0) {
4382   return {
4383    scrollTop: scrollTop,
4384    scrollLeft: scrollLeft,
4385    element: element
4386   };
4387  }
4388  element = element.parentNode;
4389 }
4390 return {
4391  scrollTop: ASPx.GetDocumentScrollTop(),
4392  scrollLeft: ASPx.GetDocumentScrollLeft()
4393 };
4394};
4395ASPx.RestoreOuterScrollPosition = function(scrollInfo) {
4396 if(scrollInfo.element) {
4397  if(scrollInfo.scrollTop > 0)
4398   scrollInfo.element.scrollTop = scrollInfo.scrollTop;
4399  if(scrollInfo.scrollLeft > 0)
4400   scrollInfo.element.scrollLeft = scrollInfo.scrollLeft;
4401 }
4402 else {
4403  if(scrollInfo.scrollTop > 0)
4404   ASPx.SetDocumentScrollTop(scrollInfo.scrollTop);
4405  if(scrollInfo.scrollLeft > 0)
4406   ASPx.SetDocumentScrollLeft(scrollInfo.scrollLeft);
4407 }
4408};
4409ASPx.ChangeElementContainer = function(element, container, savePreviousContainer) {
4410 if(element.parentNode != container) {
4411  var parentNode = element.parentNode;
4412  parentNode.removeChild(element);
4413  container.appendChild(element);
4414  if(savePreviousContainer)
4415   element.previousContainer = parentNode;
4416 }
4417};
4418ASPx.RestoreElementContainer = function(element) {
4419 if(element.previousContainer) {
4420  ASPx.ChangeElementContainer(element, element.previousContainer, false);
4421  element.previousContainer = null;
4422 }
4423};
4424ASPx.MoveChildrenToElement = function(sourceElement, destinationElement){
4425 while(sourceElement.childNodes.length > 0)
4426  destinationElement.appendChild(sourceElement.childNodes[0]);
4427};
4428ASPx.GetScriptCode = function(script) {
4429 var useFirstChildElement = Browser.Chrome && Browser.Version < 11 || Browser.Safari && Browser.Version < 5; 
4430 var text = useFirstChildElement ? script.firstChild.data : script.text;
4431 var comment = "<!--";
4432 var pos = text.indexOf(comment);
4433 if(pos > -1)
4434  text = text.substr(pos + comment.length);
4435 return text;
4436};
4437ASPx.AppendScript = function(script) {
4438 var parent = document.getElementsByTagName("head")[0];
4439 if(!parent)
4440  parent = document.body;
4441 if(parent)
4442  parent.appendChild(script);
4443};
4444function getFrame(frames, name) {
4445 if(frames[name])
4446  return frames[name];
4447 for(var i = 0; i < frames.length; i++) {
4448  try {
4449   var frame = frames[i];
4450   if(frame.name == name) 
4451    return frame; 
4452   frame = getFrame(frame.frames, name);
4453   if(frame != null)   
4454    return frame; 
4455  } catch(e) {
4456  } 
4457 }
4458 return null;
4459}
4460ASPx.IsValidElement = function(element) {
4461 if(!element) 
4462  return false;
4463 if(!(Browser.Firefox && Browser.Version < 4)) {
4464  if(element.ownerDocument && element.ownerDocument.body && element.ownerDocument.body.compareDocumentPosition)
4465   return element.ownerDocument.body.compareDocumentPosition(element) % 2 === 0;
4466 }
4467 if(!Browser.Opera && !(Browser.IE && Browser.Version < 9) && element.offsetParent && element.parentNode.tagName)
4468  return true;
4469 while(element != null){
4470  if(element.tagName == "BODY")
4471   return true;
4472  element = element.parentNode;
4473 }
4474 return false;
4475};
4476ASPx.IsValidElements = function(elements) {
4477 if(!elements)
4478  return false; 
4479 for(var i = 0; i < elements.length; i++) {
4480  if(elements[i] && !ASPx.IsValidElement(elements[i]))
4481   return false;
4482 }
4483 return true;
4484};
4485ASPx.IsExistsElement = function(element) {
4486 return element && ASPx.IsValidElement(element);
4487};
4488ASPx.CreateHtmlElementFromString = function(str) {
4489 var dummy = ASPx.CreateHtmlElement();
4490 setInnerHtmlInternal(dummy, str);
4491 return dummy.firstChild;
4492};
4493ASPx.CreateHtmlElement = function(tagName, styles) {
4494 var element = document.createElement(tagName || "DIV");
4495 if(styles)
4496  ASPx.SetStyles(element, styles);
4497 return element;
4498};
4499ASPx.RestoreElementOriginalWidth = function(element) {
4500 if(!ASPx.IsExistsElement(element)) 
4501  return;
4502 element.style.width = element.dxOrigWidth = ASPx.GetElementOriginalWidth(element);
4503};
4504ASPx.GetElementOriginalWidth = function(element) {
4505 if(!ASPx.IsExistsElement(element)) 
4506  return null;
4507 var width;
4508 if(!ASPx.IsExists(element.dxOrigWidth)) {
4509  width = String(element.style.width).length > 0
4510   ? element.style.width
4511   : ASPx.GetElementOffsetWidth(element) + "px";
4512 } else {
4513  width = element.dxOrigWidth;
4514 }
4515 return width;
4516};
4517ASPx.DropElementOriginalWidth = function(element) {
4518 if(ASPx.IsExists(element.dxOrigWidth))
4519  element.dxOrigWidth = null;
4520};
4521ASPx.GetObjectKeys = function(obj) {
4522 if(!obj) return [ ];
4523 if(Object.keys)
4524  return Object.keys(obj);
4525 var keys = [ ];
4526 for(var key in obj) {
4527  if(obj.hasOwnProperty(key))
4528   keys.push(key);
4529 }
4530 return keys;
4531};
4532ASPx.ShowErrorAlert = function(message) {
4533 message = ASPx.Str.DecodeHtmlViaTextArea(message);
4534 if(ASPx.IsExists(message) && message !== "")
4535  alert(message);
4536};
4537ASPx.ShowKBErrorMessage = function(text, kbid) {
4538 ASPx.ShowErrorMessage(text + "https://www.devexpress.com/kbid=" + kbid + ".");
4539};
4540ASPx.ShowErrorMessage = function(errorMessage) {
4541 var console = window.console;
4542 if(!console || !ASPx.IsFunction(console.error))
4543  return;
4544 console.error(errorMessage);
4545};
4546ASPx.IsInteractiveControl = function(element, extremeParent) { 
4547 return Data.ArrayIndexOf(["A", "INPUT", "SELECT", "OPTION", "TEXTAREA", "BUTTON", "IFRAME"], element.tagName) > -1;
4548};
4549ASPx.IsUrlContainsClientScript = function(url) {
4550 return url.toLowerCase().indexOf("javascript:") !== -1;
4551};
4552ASPx.GetMSAjaxRequestManager = function() {
4553 if(window.Sys && Sys.WebForms && Sys.WebForms.PageRequestManager && Sys.WebForms.PageRequestManager.getInstance)
4554  return Sys.WebForms.PageRequestManager.getInstance();
4555 return null;
4556};
4557Function.prototype.aspxBind = function(scope) {
4558 var func = this;
4559 return function() {
4560  return func.apply(scope, arguments);
4561 };
4562};
4563var FilteringUtils = { };
4564FilteringUtils.EventKeyCodeChangesTheInput = function(evt) {
4565 if(ASPx.IsPasteShortcut(evt))
4566  return true;
4567 else if(evt.ctrlKey && !evt.altKey)
4568  return false;
4569 if(ASPx.Browser.AndroidMobilePlatform || ASPx.Browser.MacOSMobilePlatform) return true; 
4570 var keyCode = ASPx.Evt.GetKeyCode(evt);
4571 var isSystemKey = ASPx.Key.Windows <= keyCode && keyCode <= ASPx.Key.ContextMenu;
4572 var isFKey = ASPx.Key.F1 <= keyCode && keyCode <= 127; 
4573 return ASPx.Key.Delete <= keyCode && !isSystemKey && !isFKey || keyCode == ASPx.Key.Backspace || keyCode == ASPx.Key.Space;
4574};
4575FilteringUtils.FormatCallbackArg = function(prefix, arg) {
4576 return (ASPx.IsExists(arg) ? prefix + "|" + arg.length + ';' + arg + ';' : "");
4577};
4578ASPx.FilteringUtils = FilteringUtils;
4579var FormatStringHelper = { };
4580FormatStringHelper.PlaceHolderTemplateStruct = function(startIndex, length, index, placeHolderString){
4581 this.startIndex = startIndex;
4582 this.realStartIndex = 0;
4583 this.length = length;
4584 this.realLength = 0;
4585 this.index = index;
4586 this.placeHolderString = placeHolderString;
4587};
4588FormatStringHelper.GetPlaceHolderTemplates = function(formatString){
4589 formatString = this.CollapseDoubleBrackets(formatString);
4590 var templates = this.CreatePlaceHolderTemplates(formatString);
4591 return templates;
4592};
4593FormatStringHelper.CreatePlaceHolderTemplates = function(formatString){
4594 var templates = [];
4595 var templateStrings = formatString.match(/{[^}]+}/g);
4596 if(templateStrings != null){
4597  var pos = 0;
4598  for(var i = 0; i < templateStrings.length; i++){
4599   var tempString = templateStrings[i];
4600   var startIndex = formatString.indexOf(tempString, pos);
4601   var length = tempString.length;
4602   var indexString = tempString.slice(1).match(/^[0-9]+/);
4603   var index = parseInt(indexString);
4604   templates.push(new this.PlaceHolderTemplateStruct(startIndex, length, index, tempString));
4605   pos = startIndex + length;
4606  }
4607 }
4608 return templates;
4609};
4610FormatStringHelper.CollapseDoubleBrackets = function(formatString){
4611 formatString = this.CollapseOpenDoubleBrackets(formatString);
4612 formatString = this.CollapseCloseDoubleBrackets(formatString);
4613 return formatString;
4614};
4615FormatStringHelper.CollapseOpenDoubleBrackets = function(formatString){
4616 return formatString.replace(/{{/g, "_");
4617};
4618FormatStringHelper.CollapseCloseDoubleBrackets = function(formatString){
4619 while(true){
4620  var index = formatString.lastIndexOf("}}");
4621  if(index == -1) 
4622   break;
4623  else
4624   formatString = formatString.substr(0, index) + "_" + formatString.substr(index + 2);
4625 }
4626 return formatString;
4627};
4628ASPx.FormatStringHelper = FormatStringHelper;
4629var StartWithFilteringUtils = { };
4630StartWithFilteringUtils.HighlightSuggestedText = function(input, suggestedText, control, onChangeInput){
4631 if(this.NeedToLockAndoidKeyEvents(control))
4632  control.LockAndroidKeyEvents();
4633 var selInfo = ASPx.Selection.GetInfo(input);
4634 var currentTextLenght = ASPx.Str.GetCoincideCharCount(suggestedText, input.value, 
4635  function(text, filter) { 
4636   return text.indexOf(filter) == 0;
4637  });
4638 var suggestedTextLenght = suggestedText.length;
4639 var isSelected = selInfo.startPos == 0 && selInfo.endPos == currentTextLenght && 
4640  selInfo.endPos == suggestedTextLenght && input.value == suggestedText;
4641 if(!isSelected) { 
4642  input.value = suggestedText;
4643  if(onChangeInput)
4644   onChangeInput();
4645  if(this.NeedToLockAndoidKeyEvents(control)) {
4646   window.setTimeout(function() {
4647    this.SelectText(input, currentTextLenght, suggestedTextLenght);
4648    control.UnlockAndroidKeyEvents();
4649   }.aspxBind(this), control.adroidSamsungBugTimeout);
4650  } else
4651   this.SelectText(input, currentTextLenght, suggestedTextLenght);
4652 }
4653};
4654StartWithFilteringUtils.SelectText = function(input, startPos, stopPos) {
4655 if(startPos < stopPos)
4656  ASPx.Selection.Set(input, startPos, stopPos);
4657};
4658StartWithFilteringUtils.RollbackOneSuggestedChar = function(input){
4659 var currentText = input.value;
4660 var cutText = currentText.slice(0, -1);
4661 if(cutText != currentText)
4662  input.value = cutText;
4663};
4664StartWithFilteringUtils.NeedToLockAndoidKeyEvents = function(control) {
4665 return ASPx.Browser.AndroidMobilePlatform && control && control.LockAndroidKeyEvents;
4666};
4667ASPx.StartWithFilteringUtils = StartWithFilteringUtils;
4668var ContainsFilteringUtils = { };
4669ContainsFilteringUtils.ColumnSelectionStruct = function(index, startIndex, length){
4670 this.index = index;
4671 this.length = length;
4672 this.startIndex = startIndex;
4673};
4674ContainsFilteringUtils.IsFilterCrossPlaseHolder = function(filterStartIndex, filterEndIndex, template) {
4675 var left = Math.max(filterStartIndex, template.realStartIndex);
4676 var right = Math.min(filterEndIndex,  template.realStartIndex + template.realLength);
4677 return left < right;
4678};
4679ContainsFilteringUtils.GetColumnSelectionsForItem = function(itemValues, formatString, filterString) {
4680 if(formatString == "") 
4681  return this.GetSelectionForSingleColumnItem(itemValues, filterString); 
4682 var result = [];
4683 var formatedString = ASPx.Formatter.Format(formatString, itemValues);
4684 var filterStartIndex = ASPx.Str.PrepareStringForFilter(formatedString).indexOf(ASPx.Str.PrepareStringForFilter(filterString));
4685 if(filterStartIndex == -1) return result;
4686 var filterEndIndex = filterStartIndex + filterString.length;
4687 var templates = FormatStringHelper.GetPlaceHolderTemplates(formatString);
4688 this.SupplyTemplatesWithRealValues(itemValues, templates);
4689 for(var i = 0; i < templates.length ; i++) {
4690  if(this.IsFilterCrossPlaseHolder(filterStartIndex, filterEndIndex, templates[i])) 
4691   result.push(this.GetColumnSelectionsForItemValue(templates[i], filterStartIndex, filterEndIndex));
4692 }
4693 return result;
4694};
4695ContainsFilteringUtils.GetColumnSelectionsForItemValue = function(template, filterStartIndex, filterEndIndex) {
4696 var selectedTextStartIndex = filterStartIndex < template.realStartIndex ? 0 :
4697  filterStartIndex - template.realStartIndex;
4698 var selectedTextEndIndex = filterEndIndex >  template.realStartIndex + template.realLength ? template.realLength :
4699  filterEndIndex - template.realStartIndex;
4700 var selectedTextLength = selectedTextEndIndex - selectedTextStartIndex;
4701 return new this.ColumnSelectionStruct(template.index, selectedTextStartIndex, selectedTextLength);
4702};
4703ContainsFilteringUtils.GetSelectionForSingleColumnItem = function(itemValues, filterString) {
4704 var selectedTextStartIndex = ASPx.Str.PrepareStringForFilter(itemValues[0]).indexOf(ASPx.Str.PrepareStringForFilter(filterString));
4705 var selectedTextLength = filterString.length;
4706 return [new this.ColumnSelectionStruct(0, selectedTextStartIndex, selectedTextLength)];
4707};
4708ContainsFilteringUtils.ResetFormatStringIndex = function(formatString, index) {
4709 if(index != 0)
4710  return formatString.replace(index.toString(), "0");
4711 return formatString;
4712};
4713ContainsFilteringUtils.SupplyTemplatesWithRealValues = function(itemValues, templates) {
4714 var shift = 0;
4715 for(var i = 0; i < templates.length; i++) {
4716  var formatString = this.ResetFormatStringIndex(templates[i].placeHolderString, templates[i].index);
4717  var currentItemValue = itemValues[templates[i].index];
4718  templates[i].realLength = ASPx.Formatter.Format(formatString, currentItemValue).length;
4719  templates[i].realStartIndex  += templates[i].startIndex + shift; 
4720  shift += templates[i].realLength - templates[i].placeHolderString.length; 
4721 }
4722};
4723ContainsFilteringUtils.PrepareElementText = function(itemText) {
4724 return itemText ? itemText.replace(/\&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;") : '';
4725};
4726ContainsFilteringUtils.UnselectContainsTextInElement = function(element, selection, highlightTagName) {
4727 var currentText =  ASPx.Attr.GetAttribute (element, "DXText");
4728 if(ASPx.IsExists(currentText)) {
4729  currentText = ContainsFilteringUtils.PrepareElementText(currentText);
4730  ASPx.Security.setInnerHtml(element, currentText === "" ? "&nbsp;" : currentText, ASPx.Security.DataType.Trusted);
4731 }
4732};
4733ContainsFilteringUtils.ReselectContainsTextInElement = function(element, selection, highlightTagName) {
4734 var currentText = ASPx.GetInnerText(element);
4735 if(!highlightTagName)
4736  highlightTagName = "em";
4737 highlightTagName = highlightTagName.toLowerCase();
4738 if(currentText.indexOf("</" + highlightTagName + ">") != -1)
4739  ContainsFilteringUtils.UnselectContainsTextInElement(element, selection, highlightTagName);
4740 return ContainsFilteringUtils.SelectContainsTextInElement(element, selection, highlightTagName);
4741};
4742ContainsFilteringUtils.SelectContainsTextInElement = function(element, selection, highlightTagName) {
4743 if(selection.startIndex == -1)
4744  return;
4745 var currentText =  ASPx.Attr.GetAttribute (element, "DXText");
4746 if(!ASPx.IsExists(currentText)) ASPx.Attr.SetAttribute (element, "DXText", ASPx.GetInnerText(element));
4747 if(!highlightTagName)
4748  highlightTagName = "em";
4749 highlightTagName = highlightTagName.toLowerCase();
4750 var oldInnerText = ASPx.GetInnerText(element);
4751 var newInnerText = ContainsFilteringUtils.PrepareElementText(oldInnerText.substr(0, selection.startIndex)) + "<" + highlightTagName + ">" +
4752      ContainsFilteringUtils.PrepareElementText(oldInnerText.substr(selection.startIndex, selection.length)) + "</" + highlightTagName + ">" +
4753      ContainsFilteringUtils.PrepareElementText(oldInnerText.substr(selection.startIndex + selection.length));
4754 ASPx.Security.setInnerHtml(element, newInnerText, ASPx.Security.DataType.Trusted);
4755};
4756ASPx.ContainsFilteringUtils = ContainsFilteringUtils;
4757ASPx.MakeEqualControlsWidth = function(name1, name2){
4758 var control1 = ASPx.GetControlCollection().Get(name1);
4759 var control2 = ASPx.GetControlCollection().Get(name2);
4760 if(control1 && control2){
4761  var width = Math.max(control1.GetWidth(), control2.GetWidth());
4762  control1.SetWidth(width);
4763  control2.SetWidth(width);
4764 }
4765};
4766ASPx.HighContrastForeColorHighlightColorMap = {
4767 "#ffff00" : "#008000",
4768 "#00ff00" : "#0000ff",
4769 "#ffffff" : "#00838f",
4770 "#000000" : "#a347ff"
4771};
4772var BadgeManagerBase = ASPx.CreateClass(null, {
4773 createBadge: function(text, iconCssClass) {
4774  var badge = document.createElement("SPAN");
4775  ASPx.SetClassName(badge, this.getBadgeClassName());
4776  if(iconCssClass && iconCssClass.length)
4777   this.setBadgeIconCssClass(badge, iconCssClass);
4778  if(text && text.length)
4779   this.setBadgeText(badge, text);
4780  return badge;
4781 },
4782 findBadge: function(element) {
4783  if(!element)
4784   return null;
4785  return element.querySelector("." + this.getBadgeClassName());
4786 },
4787 setBadgeIconCssClass: function(badge, iconCssClass) {
4788  if(!badge || iconCssClass === undefined)
4789   return;
4790  var iconElement = this.getBadgeIconElement(badge);
4791  if(!iconCssClass) {
4792   if(iconElement)
4793    badge.removeChild(iconElement);
4794  }
4795  else {
4796   if(!iconElement) {
4797    iconElement = document.createElement("SPAN");
4798    badge.insertBefore(iconElement, badge.childNodes[0]);
4799   }
4800   ASPx.SetClassName(iconElement, iconCssClass + " " + this.getBadgeIconDefaultClassName());
4801  }
4802 },
4803 getBadgeIconCssClass: function(element) {
4804  var badge = this.findBadge(element);
4805  if(badge) {
4806   var iconElement = this.getBadgeIconElement(badge);
4807   var regEx = new RegExp("(?:^|\\s)" + this.getBadgeIconDefaultClassName() + "(?!\\S)");
4808   return iconElement ? ASPx.Str.Trim(ASPx.GetClassName(iconElement).replace(regEx, "")) : "";
4809  }
4810  return "";
4811 },
4812 setBadgeText: function(badge, text) {
4813  if(!badge || text === undefined)
4814   return;
4815  var textElement = this.getBadgeTextElement(badge);
4816  if(!text) {
4817   if(textElement)
4818    badge.removeChild(textElement);
4819  }
4820  else {
4821   if(!textElement) {
4822    textElement = document.createElement("SPAN");
4823    badge.appendChild(textElement);
4824   }
4825   ASPx.Security.setInnerHtml(textElement, text, ASPx.Security.DataType.Trusted);
4826  }
4827 },
4828 getBadgeText: function(element) {
4829  var badge = this.findBadge(element);
4830  if(badge) {
4831   var textElement = this.getBadgeTextElement(badge);
4832   return textElement ? ASPx.GetInnerText(textElement) : "";
4833  }
4834  return "";
4835 },
4836 getBadgeClassName: function() {
4837  return "";
4838 },
4839 getBadgeIconDefaultClassName: function() {
4840  return "";
4841 },
4842 getBadgeIconElement: function(badge) {
4843  return badge.childNodes.length ? badge.querySelector("." + this.getBadgeIconDefaultClassName()) : null;
4844 },
4845 getBadgeTextElement: function(badge) {
4846  return badge.childNodes.length ? badge.querySelector("span:not(." + this.getBadgeIconDefaultClassName() + ")") : null;
4847 }
4848});
4849ASPx.BadgeManagerBase = BadgeManagerBase;
4850var BadgeManager = ASPx.CreateClass(BadgeManagerBase, {
4851 getBadgeClassName: function() {
4852  return "dxBadge";
4853 },
4854 getBadgeIconDefaultClassName: function() {
4855  return "dxBadgeImage";
4856 }
4857});
4858ASPx.BadgeManager = new BadgeManager();
4859var AccessibilityUtils = {
4860 isInitialized: false,
4861 highContrastCssClassMarker: "dxHighContrast",
4862 highContrastBackgroundCssClassMarker: "dxHCB",
4863 highContrastDefaultBackgroundColor: "#a347ff",
4864 highContrastThemeActive: false,
4865 accessibleBackgroundCssMarker: ".dx-runtime-background",
4866 createAccessibleBackgrounds: function(control) {
4867  if(!this.highContrastThemeActive || control.accessibleBackgroundsCreated || !control.accessibilityCompliant)
4868   return;
4869  var className = this.accessibleBackgroundCssMarker;
4870  var styleSheetRuleNames = [];
4871  iterateStyleSheetRules(null, function(rule) {
4872   var selectorTxt = rule.selectorText;
4873   if(selectorTxt && selectorTxt.indexOf(className) > -1)
4874    styleSheetRuleNames.push(ASPx.Str.CompleteReplace(selectorTxt, className, "")); 
4875  });
4876  for(var i = 0; i < styleSheetRuleNames.length; i++) {
4877   var name = styleSheetRuleNames[i];
4878   var rule = ASPx.GetStyleSheetRules(name.substring(1));
4879   if(rule && rule.style && rule.style.backgroundImage)
4880    this.createAccessibleBackground(control.GetMainElement(), rule.style, name);
4881  }
4882  control.accessibleBackgroundsCreated = true;
4883 },
4884 createAccessibleBackground: function(container, style, selector) {
4885  if(!container)
4886   return;
4887  var backgroundUrl = style.backgroundImage.substring(5, style.backgroundImage.length - 2);
4888  var elements = container.querySelectorAll(selector);
4889  var accessibleBackgroundClassName = "dx-acc-bi";
4890  for(var i = 0; i < elements.length; i++) {
4891   var element = elements[i];
4892   if(ASPx.ElementHasCssClass(element, accessibleBackgroundClassName))
4893    continue;
4894   var image = null;
4895   if(element.tagName !== "IMG") {
4896    ASPx.AddClassNameToElement(element, accessibleBackgroundClassName);
4897    image = element.ownerDocument.createElement("IMG");
4898    ASPx.SetStyles(image, { width: "100%", height: "100%" });
4899    if(element.firstChild)
4900     element.insertBefore(image, element.firstChild);
4901    else
4902     element.appendChild(image);
4903   } else
4904    image = element;
4905   image.src = backgroundUrl;
4906  }
4907 },
4908 createHighContrastBackgroundStyle: function() {
4909  var style = document.createElement('style');
4910  ASPx.Attr.AppendStyleType(style);
4911  var styleContent = [
4912   "." + this.highContrastCssClassMarker + " ." + this.highContrastBackgroundCssClassMarker + ":after {",
4913   "border-image: url(" + this.getHighContrastBackgroundUrl() + ") 0 1 0 0 round;",
4914   "}",
4915  ];
4916  setInnerHtmlInternal(style, styleContent.join('\n'));
4917  document.getElementsByTagName('head')[0].appendChild(style);
4918 },
4919 getHighContrastBackgroundUrl: function() {
4920  var canvas = document.createElement("canvas"),
4921  ctx = canvas.getContext('2d');
4922  canvas.width = 1;
4923  canvas.height = 1;
4924  ctx.fillStyle = this.getHighContrastBackgroundColor();
4925  ctx.fillRect(0, 0, canvas.width, canvas.height);
4926  return canvas.toDataURL();
4927 },
4928 getHighContrastBackgroundColor: function() {
4929  var foreColor = ASPx.GetCurrentStyle(document.body).color;
4930  var hexColor = ASPx.Color.ColorToHexadecimal(foreColor);
4931  return ASPx.HighContrastForeColorHighlightColorMap[hexColor] || this.highContrastDefaultBackgroundColor;
4932 },
4933 initialize: function() {
4934  if(this.isInitialized)
4935   return;
4936  this.isInitialized = true;
4937  this.detectHighContrastTheme();
4938  if(this.highContrastThemeActive)
4939   this.createHighContrastBackgroundStyle();
4940 },
4941 detectHighContrastTheme: function() {
4942  var testElement = document.createElement("DIV");
4943  ASPx.SetStyles(testElement, {
4944   backgroundImage: "url('" + ASPx.EmptyImageUrl + "')",
4945   display: "none"
4946  }, true);
4947  var docElement = document.documentElement;
4948  docElement.appendChild(testElement);
4949  var actualBackgroundImg = ASPx.GetCurrentStyle(testElement).backgroundImage;
4950  docElement.removeChild(testElement);
4951  if(actualBackgroundImg === "none") {
4952   this.highContrastThemeActive = true;
4953   ASPx.AddClassNameToElement(docElement, this.highContrastCssClassMarker);
4954  }
4955 }
4956};
4957ASPx.AccessibilityUtils = AccessibilityUtils;
4958ASPx.AccessibilityUtils.SendMessageToAssistiveTechnology = function(message) {
4959 var messageParts = ASPx.Ident.IsArray(message) ? message : [message];
4960 var args = new ASPxClientControlBeforePronounceEventArgs(messageParts, null);
4961 ASPx.AccessibilityPronouncer.EnsureInitialize();
4962 ASPx.AccessibilityPronouncer.Pronounce(args, ASPx.AccessibilityPronouncerType.live);
4963};
4964ASPx.AccessibilityUtils.SetFocusAccessible = function(focusableElement) {
4965 if(!focusableElement)
4966  return;
4967 var elementId = focusableElement.id;
4968 if(!elementId) {
4969  var namedParent = ASPx.GetParent(focusableElement, function(element) {
4970   return !!element.id;
4971  });
4972  if(ASPx.IsExists(namedParent))
4973   elementId = namedParent.id;
4974 }
4975 var focusableControl = ASPx.GetClientControlByElementID(elementId);
4976 if(focusableControl && focusableControl.OnAssociatedLabelClick)
4977  focusableControl.OnAssociatedLabelClick(focusableElement);
4978 else
4979  window.setTimeout(function() {
4980   ASPx.AccessibilityUtils.SetFocusAccessibleCore(focusableElement);
4981  }, 0);
4982};
4983ASPx.AccessibilityUtils.SetFocusAccessibleCore = function(focusableElement) {
4984 if(!ASPx.IsExists(focusableElement))
4985  return;
4986 var isTabIndexChanged = ASPx.ControlTabIndexManager.getInstance().isElementWithChangedIndex(focusableElement);
4987 if(isTabIndexChanged)
4988  return;
4989 if(!ASPx.IsValidElement(focusableElement) && focusableElement.id)
4990  focusableElement = ASPx.GetElementById(focusableElement.id);
4991 if(!ASPx.IsActionElement(focusableElement))
4992  focusableElement = ASPx.RestoreFocusHelper.findNeighbourFocusElement(focusableElement, document.body);
4993 if(ASPx.IsExistsElement(focusableElement))
4994  focusableElement.focus();
4995};
4996var Security = {
4997 setInnerHtml: function(el, html, dataType) {
4998  if(!html) {
4999   while(el.firstChild)
5000    ASPx.RemoveElement(el.firstChild);
5001  } else
5002   Security.setData(html, function(d) { ASPx.SetInnerHtml.call(window, el, d); }, dataType);
5003 },
5004 setText: function(control, text, dataType) { Security.setData(text, control.SetText.aspxBind(control), dataType); },
5005 safeEncodeHtml: function(html) { return ASPx.Str.EncodeHtml(ASPx.Str.DecodeHtml(html)); },
5006 setData: function(data, dataSetter, dataType) {
5007  if(dataType === undefined)
5008   throw new Error("Specify the dataType");
5009  if(dataType == Security.DataType.Untrusted)
5010   data = Security.safeEncodeHtml(data);
5011  dataSetter(data);
5012 }
5013};
5014Security.DataType = {
5015 Trusted: 0,
5016 Untrusted: 1
5017};
5018ASPx.EnableCssAnimation = true;
5019var AnimationTransitionBase = ASPx.CreateClass(null, {
5020 constructor: function(element, options) {
5021  if(element) {
5022   AnimationTransitionBase.Cancel(element);
5023   this.element = element;
5024   this.element.aspxTransition = this;
5025  }
5026  this.duration = options.duration || AnimationConstants.Durations.DEFAULT;
5027  this.transition = options.transition || AnimationConstants.Transitions.SINE;
5028  this.property = options.property;
5029  this.unit = options.unit || "";
5030  this.onComplete = options.onComplete;
5031  this.to = null;
5032  this.from = null;
5033 },
5034 Start: function(from, to) {
5035  if(to != undefined) {
5036   this.to = to;
5037   this.from = from;
5038   this.SetValue(this.from);
5039  }
5040  else
5041   this.to = from;
5042 },
5043 Cancel: function() {
5044  if(!this.element)
5045   return;
5046  try {
5047   delete this.element.aspxTransition;
5048  } catch(e) {
5049   this.element.aspxTransition = undefined;
5050  }
5051 },
5052 GetValue: function() {
5053  return this.getValueInternal(this.element, this.property);
5054 },
5055 SetValue: function(value) {
5056  this.setValueInternal(this.element, this.property, this.unit, value);
5057 },
5058 setValueInternal: function(element, property, unit, value) {
5059  if(property == "opacity")
5060   AnimationUtils.setOpacity(element, value);
5061  else
5062   element.style[property] = value + unit;
5063 },
5064 getValueInternal: function(element, property) {
5065  if(property == "opacity")
5066   return ASPx.GetElementOpacity(element);
5067  var value = parseFloat(element.style[property]);
5068  return isNaN(value) ? 0 : value;
5069 },
5070 performOnComplete: function() {
5071  if(this.onComplete)
5072   this.onComplete(this.element);
5073 },
5074 getTransition: function() {
5075  return this.transition;
5076 }
5077});
5078AnimationTransitionBase.Cancel = function(element) {
5079 if(element.aspxTransition)
5080  element.aspxTransition.Cancel();
5081};
5082var AnimationConstants = {};
5083AnimationConstants.Durations = {
5084 SHORT: 200,
5085 DEFAULT: 400,
5086 LONG: 600
5087};
5088AnimationConstants.Transitions = {
5089 LINER: {
5090  Css: "cubic-bezier(0.250, 0.250, 0.750, 0.750)",
5091  Js: function(progress) { return progress; }
5092 },
5093 SINE: {
5094  Css: "cubic-bezier(0.470, 0.000, 0.745, 0.715)",
5095  Js: function(progress) { return Math.sin(progress * 1.57); }
5096 },
5097 POW: {
5098  Css: "cubic-bezier(0.755, 0.050, 0.855, 0.060)",
5099  Js: function(progress) { return Math.pow(progress, 4); }
5100 },
5101 POW_EASE_OUT: {
5102  Css: "cubic-bezier(0.165, 0.840, 0.440, 1.000)",
5103  Js: function(progress) { return 1 - AnimationConstants.Transitions.POW.Js(1 - progress); }
5104 },
5105 RIPPLE: {
5106  Css: "cubic-bezier(0.47, 0.06, 0.23, 0.99)",
5107  Js: function(progress) {
5108   return Math.pow((progress), 3) * 0.47 + 3 * progress * Math.pow((1 - progress), 2) * 0.06 + 3 * Math.pow(progress, 2) *
5109    (1 - progress) * 0.23 + 0.99 * Math.pow(progress, 3);
5110  }
5111 }
5112};
5113var JsAnimationTransition = ASPx.CreateClass(AnimationTransitionBase, {
5114 constructor: function(element, options) {
5115  this.constructor.prototype.constructor.call(this, element, options);
5116  this.onStep = options.onStep;
5117  this.fps = 60;
5118  this.startTime = null;
5119 },
5120 Start: function(from, to) {
5121  if(from == to) {
5122   this.from = this.to = from;
5123   setTimeout(this.complete.aspxBind(this), 0);
5124  }
5125  else {
5126   AnimationTransitionBase.prototype.Start.call(this, from, to);
5127   if(to == undefined)
5128    this.from = this.GetValue();
5129   this.initTimer();
5130  }
5131 },
5132 Cancel: function() {
5133  AnimationTransitionBase.prototype.Cancel.call(this);
5134  if(this.timerId)
5135   clearInterval(this.timerId);
5136 },
5137 initTimer: function() {
5138  this.startTime = new Date();
5139  this.timerId = window.setInterval(function() { this.onTick(); }.aspxBind(this), 1000 / this.fps);
5140 },
5141 onTick: function() {
5142  var progress = (new Date() - this.startTime) / this.duration;
5143  if(progress >= 1)
5144   this.complete();
5145  else {
5146   this.update(progress);
5147   if(this.onStep)
5148    this.onStep();
5149  }
5150 },
5151 update: function(progress) {
5152  this.SetValue(this.gatCalculatedValue(this.from, this.to, progress));
5153 },
5154 complete: function() {
5155  this.Cancel();
5156  this.update(1);
5157  this.performOnComplete();
5158 },
5159 gatCalculatedValue: function(from, to, progress) {
5160  if(progress == 1)
5161   return to;
5162  return from + (to - from) * this.getTransition()(progress);
5163 },
5164 getTransition: function() {
5165  return this.transition.Js;
5166 }
5167});
5168var SimpleAnimationTransition = ASPx.CreateClass(JsAnimationTransition, {
5169 constructor: function(options) {
5170  this.constructor.prototype.constructor.call(this, null, options);
5171  this.transition = options.transition || AnimationConstants.Transitions.POW_EASE_OUT;
5172  this.onUpdate = options.onUpdate;
5173  this.lastValue = 0;
5174 },
5175 SetValue: function(value) {
5176  this.onUpdate(value - this.lastValue);
5177  this.lastValue = value;
5178 },
5179 GetValue: function() {
5180  return this.lastValue;
5181 },
5182 performOnComplete: function() {
5183  if(this.onComplete)
5184   this.onComplete();
5185 }
5186});
5187var MultipleJsAnimationTransition = ASPx.CreateClass(JsAnimationTransition, {
5188 constructor: function(element, options) {
5189  this.constructor.prototype.constructor.call(this, element, options);
5190  this.properties = {};
5191 },
5192 Start: function(properties) {
5193  this.initProperties(properties);
5194  this.initTimer();
5195 },
5196 initProperties: function(properties) {
5197  this.properties = properties;
5198  for(var propName in this.properties)
5199   if(properties[propName].from == undefined)
5200    properties[propName].from = this.getValueInternal(this.element, propName);
5201 },
5202 update: function(progress) {
5203  for(var propName in this.properties) {
5204   if(this.properties.hasOwnProperty(propName)) {
5205    var property = this.properties[propName];
5206    if(property.from != property.to)
5207     this.setValueInternal(this.element, propName, property.unit, this.gatCalculatedValue(property.from, property.to, progress));
5208   }
5209  }
5210 }
5211});
5212var CssAnimationTransition = ASPx.CreateClass(AnimationTransitionBase, {
5213 constructor: function(element, options) {
5214  this.constructor.prototype.constructor.call(this, element, options);
5215  this.transitionPropertyName = AnimationUtils.CurrentTransition.property;
5216  this.eventName = AnimationUtils.CurrentTransition.event;
5217 },
5218 Start: function(from, to) {
5219  AnimationTransitionBase.prototype.Start.call(this, from, to);
5220  this.startTimerId = window.setTimeout(function() {
5221   if(this.from == this.to)
5222    this.onTransitionEnd();
5223   else {
5224    var isHidden = ASPx.GetElementOffsetHeight(this.element) == 0 && ASPx.GetElementOffsetWidth(this.element) == 0; 
5225    if(!isHidden)
5226     this.prepareElementBeforeAnimation();
5227    this.SetValue(this.to);
5228    if(isHidden)
5229     this.onTransitionEnd();
5230   }
5231  }.aspxBind(this), 0);
5232 },
5233 Cancel: function() {
5234  window.clearTimeout(this.startTimerId);
5235  AnimationTransitionBase.prototype.Cancel.call(this);
5236  ASPx.Evt.DetachEventFromElement(this.element, this.eventName, CssAnimationTransition.transitionEnd);
5237  this.setValueInternal(this.element, this.transitionPropertyName, "", "");
5238  this.stopAnimation();
5239 },
5240 prepareElementBeforeAnimation: function() {
5241  ASPx.Evt.AttachEventToElement(this.element, this.eventName, CssAnimationTransition.transitionEnd);
5242  var dummy = this.element.offsetHeight;
5243  this.element.style[this.transitionPropertyName] = this.getTransitionCssString();
5244  if(ASPx.Browser.Safari && ASPx.Browser.MacOSMobilePlatform && ASPx.Browser.MajorVersion >= 8) 
5245   setTimeout(function() {
5246    if(this.element && this.element.aspxTransition) {
5247     this.element.style[this.transitionPropertyName] = "";
5248     this.element.aspxTransition.onTransitionEnd();
5249    }
5250   }.aspxBind(this), this.duration + 100);
5251 },
5252 stopAnimation: function() {
5253  this.SetValue(ASPx.GetCurrentStyle(this.element)[this.property]);
5254 },
5255 onTransitionEnd: function() {
5256  this.Cancel();
5257  this.performOnComplete();
5258 },
5259 getTransition: function() {
5260  return this.transition.Css;
5261 },
5262 getTransitionCssString: function() {
5263  return this.getTransitionCssStringInternal(this.getCssName(this.property));
5264 },
5265 getTransitionCssStringInternal: function(cssProperty) {
5266  return cssProperty + " " + this.duration + "ms " + this.getTransition();
5267 },
5268 getCssName: function(property) {
5269  switch(property) {
5270   case "marginLeft":
5271    return "margin-left";
5272   case "marginTop":
5273    return "margin-top";
5274  }
5275  return property;
5276 }
5277});
5278var MultipleCssAnimationTransition = ASPx.CreateClass(CssAnimationTransition, {
5279 constructor: function(element, options) {
5280  this.constructor.prototype.constructor.call(this, element, options);
5281  this.properties = null;
5282 },
5283 Start: function(properties) {
5284  this.properties = properties;
5285  this.forEachProperties(function(property, propName) {
5286   if(property.from !== undefined)
5287    this.setValueInternal(this.element, propName, property.unit, property.from);
5288  }.aspxBind(this));
5289  this.prepareElementBeforeAnimation();
5290  window.setTimeout(function() {
5291   this.forEachProperties(function(property, propName) {
5292    this.setValueInternal(this.element, propName, property.unit, property.to);
5293   }.aspxBind(this));
5294  }.aspxBind(this), 0);
5295 },
5296 stopAnimation: function() {
5297  var style = ASPx.GetCurrentStyle(this.element);
5298  this.forEachProperties(function(property, propName) {
5299   this.setValueInternal(this.element, propName, "", style[propName]);
5300  }.aspxBind(this));
5301 },
5302 getTransitionCssString: function() {
5303  var str = "";
5304  this.forEachProperties(function(property, propName) {
5305   str += this.getTransitionCssStringInternal(this.getCssName(propName)) + ",";
5306  }.aspxBind(this));
5307  str = str.substring(0, str.length - 1);
5308  return str;
5309 },
5310 forEachProperties: function(func) {
5311  for(var propName in this.properties) {
5312   if(this.properties.hasOwnProperty(propName)) {
5313    var property = this.properties[propName];
5314    if(property.from == undefined)
5315     property.from = this.getValueInternal(this.element, propName);
5316    if(property.from != property.to)
5317     func(property, propName);
5318   }
5319  }
5320 }
5321});
5322CssAnimationTransition.transitionEnd = function(evt) {
5323 var element = evt.target;
5324 if(element && element.aspxTransition)
5325  element.aspxTransition.onTransitionEnd();
5326};
5327var AnimationUtils = {
5328 CanUseCssTransition: function() { return ASPx.EnableCssAnimation && this.CurrentTransition; },
5329 CanUseCssTransform: function() { return this.CanUseCssTransition() && this.CurrentTransform; },
5330 CurrentTransition: (function() {
5331  if(ASPx.Browser.IE) 
5332   return null;
5333  var transitions = [
5334   { property: "webkitTransition", event: "webkitTransitionEnd" },
5335   { property: "MozTransition", event: "transitionend" },
5336   { property: "OTransition", event: "oTransitionEnd" },
5337   { property: "transition", event: "transitionend" }
5338  ];
5339  var fakeElement = document.createElement("DIV");
5340  for(var i = 0; i < transitions.length; i++)
5341   if(transitions[i].property in fakeElement.style)
5342    return transitions[i];
5343 })(),
5344 CurrentTransform: (function() {
5345  var transforms = ["transform", "MozTransform", "-webkit-transform", "msTransform", "OTransform"];
5346  var fakeElement = document.createElement("DIV");
5347  for(var i = 0; i < transforms.length; i++)
5348   if(transforms[i] in fakeElement.style)
5349    return transforms[i];
5350 })(),
5351 SetTransformValue: function(element, position, isTop) {
5352  if(this.CanUseCssTransform())
5353   element.style[this.CurrentTransform] = this.GetTransformCssText(position, isTop);
5354  else
5355   element.style[!isTop ? "left" : "top"] = position + "px";
5356 },
5357 GetTransformValue: function(element, isTop) {
5358  if(this.CanUseCssTransform()) {
5359   var cssValue = element.style[this.CurrentTransform];
5360   return cssValue && cssValue != "none" ? Number(cssValue.replace('matrix(1, 0, 0, 1,', '').replace(')', '').split(',')[!isTop ? 0 : 1]) : 0;
5361  }
5362  else
5363   return !isTop ? element.offsetLeft : element.offsetTop;
5364 },
5365 GetTransformCssText: function(position, isTop) {
5366  if(!position)
5367   return "none";
5368  return "matrix(1, 0, 0, 1," + (!isTop ? position : 0) + ", " + (!isTop ? 0 : position) + ")";
5369 },
5370 createMultipleAnimationTransition: function (element, options) {
5371  return this.CanUseCssTransition() && !options.onStep ? new MultipleCssAnimationTransition(element, options) : new MultipleJsAnimationTransition(element, options);
5372 },
5373 createSimpleAnimationTransition: function(options) {
5374  return new SimpleAnimationTransition(options);
5375 },
5376 createJsAnimationTransition: function(element, options) {
5377  return new JsAnimationTransition(element, options);
5378 },
5379 createCssAnimationTransition: function(element, options) {
5380  return new CssAnimationTransition(element, options);
5381 },
5382 setOpacity: function(element, value) {
5383  ASPx.SetElementOpacity(element, value);
5384 }
5385};
5386var AsyncTracker = function() {
5387 var currentToken,
5388  lockedTokens,
5389  onDoneDelegates,
5390  lockedDelegates;
5391 function clearState() {
5392  currentToken = 1;
5393  lockedTokens = [];
5394  onDoneDelegates = [];
5395  lockedDelegates = {};
5396 }
5397 clearState();
5398 var log = function(msg) { };
5399 function setLog(delegate){
5400  log = delegate;
5401 }
5402 function getLockToken() {
5403  if(onDoneDelegates.length === 0)
5404   return -1;
5405  var token = currentToken++;
5406  lockedTokens.push(token);
5407  lockedDelegates[token] = [];
5408  for (var i = 0; i < onDoneDelegates.length; i++) {
5409   lockedDelegates[token].push(onDoneDelegates[i]);
5410  }
5411  log("module locks token " + token);
5412  return token;
5413 }
5414 function releaseToken(token) {
5415  if(token < 0) return;
5416  log("module releasing token " + token);
5417  ASPx.Data.ArrayRemove(lockedTokens, token);
5418  delete lockedDelegates[token];
5419  invokeUnlockedDelegates();
5420  if(lockedTokens.length === 0)
5421   clearState();
5422  log("module released token " + token);
5423 }
5424 function invokeUnlockedDelegates() {
5425  var onDoneDelegate;
5426  for (var i = onDoneDelegates.length - 1; i >= 0; i--) {
5427   if(onDoneDelegates[i] && !isDelegateLocked(onDoneDelegates[i])) {
5428    onDoneDelegate = onDoneDelegates[i];
5429    delete onDoneDelegates[i];
5430    onDoneDelegate();
5431   }
5432  }
5433 }
5434 function isDelegateLocked(delegate) {
5435  for (var i = lockedTokens.length - 1; i >= 0; i--) {
5436   var token = lockedTokens[i];
5437   var delegates = lockedDelegates[token];
5438   if(delegates) {
5439    for (var j = delegates.length - 1; j >= 0; j--) {
5440     if(delegates[j] && delegates[j] === delegate)
5441      return true;
5442    }
5443   }
5444  }
5445  return false;
5446 }
5447 function track(doDelegate, onDoneDelegate) {
5448  if(onDoneDelegate)
5449   onDoneDelegates.push(onDoneDelegate);
5450  doDelegate();
5451  if(onDoneDelegate)
5452   invokeUnlockedDelegates();
5453 }
5454 return {
5455  getLockToken: getLockToken,
5456  releaseToken: releaseToken,
5457  track: track,
5458  setLog:setLog,
5459 };
5460};
5461var GetEditorValuesInContainer = function(containerOrId, processInvisibleEditors, needSerialize) {
5462 var container = typeof(containerOrId) === "string" ? ASPx.GetElementById(containerOrId) : containerOrId;
5463 var result = {};
5464 if(!ASPx.ProcessEditorsInContainer) 
5465  return result;
5466 ASPx.ProcessEditorsInContainer(container, function(editor){
5467  result[editor.name] = GetCorrectedByTypeValue(ASPx.GetEditorValueByControl(editor), needSerialize);
5468 }, null, null, processInvisibleEditors, false);
5469 return result;
5470};
5471var SetEditorValues = function(values) {
5472 for(var controlName in values) {
5473  if(values.hasOwnProperty(controlName)) {
5474   var trackedControl = ASPxClientControl.GetControlCollection().Get(controlName);
5475   if(!trackedControl)
5476    continue;
5477   var setValueMethod = trackedControl.SetTokenCollection || trackedControl.SelectValues || trackedControl.SetValue;
5478   if(setValueMethod === trackedControl.SelectValues)
5479    trackedControl.UnselectAll();
5480   setValueMethod.call(trackedControl, values[controlName]);
5481  }
5482 }
5483};
5484var GetCorrectedByTypeValue = function(value, needSerialize){
5485 if(ASPx.Ident.IsArray(value))
5486  for(var i = 0; i < value.length; i++)
5487   value[i] = GetCorrectedByTypeValue(value[i]);
5488 if(needSerialize && ASPx.Ident.IsDate(value))
5489  return ASPx.DateUtils.GetInvariantDateTimeString(value);
5490 return value;
5491};
5492var ListBoxTemporaryCache = ASPx.CreateClass(null, {
5493 constructor: function() { 
5494  this.cache = { };
5495  this.invalidateTimerID = -1;
5496 },
5497 Get: function(key, getObjectFunc, context, args) {
5498  if(this.invalidateTimerID < 0) {
5499   this.invalidateTimerID = window.setTimeout(function() {
5500    this.Invalidate();
5501   }.aspxBind(this), 0);
5502  }
5503  if(!ASPx.IsExists(this.cache[key])) {
5504   if(!ASPx.IsExists(args))
5505    args = [ ];
5506   this.cache[key] = getObjectFunc.apply(context, args);
5507  }
5508  return this.cache[key];
5509 },
5510 Invalidate: function() {
5511  this.cache = { };
5512  this.invalidateTimerID = ASPx.Timer.ClearTimer(this.invalidateTimerID);
5513 }
5514});
5515ASPx.GetEditorValueByControl = function(control, needSerialize) {
5516 var result;
5517 if(ASPx.IsMultipleValueOwner(control))
5518  result = control.GetSelectedValues();
5519 if(ASPx.IsTokenBox(control)) {
5520  if(needSerialize)
5521   result = control.GetTokenValuesCollection();
5522  else
5523   result = control.GetTokenCollection();
5524 }
5525 return result || control.GetValue();
5526};
5527ASPx.IsMultipleValueOwner = function(control) {
5528 return ASPx.IsListBox(control) || ASPx.IsCheckBoxList(control);
5529};
5530ASPx.IsCheckBoxList = function(control) {
5531 return control && typeof(ASPxClientCheckBoxList) != "undefined" && control instanceof ASPxClientCheckBoxList;
5532};
5533ASPx.IsListBox = function(control) {
5534 return control && typeof(ASPxClientListBox) != "undefined" && control instanceof ASPxClientListBox;
5535};
5536ASPx.IsComboBox = function(control) {
5537 return control && typeof(ASPxClientComboBox) != "undefined" && control instanceof ASPxClientComboBox;
5538};
5539ASPx.IsTokenBox = function(control) {
5540 return control && typeof(ASPxClientTokenBox) != "undefined" && control instanceof ASPxClientTokenBox;
5541};
5542ASPx.IsGridLookup = function(control) {
5543 return control && typeof(MVCxClientGridLookup) != "undefined" && control instanceof MVCxClientGridLookup;
5544};
5545ASPx.IsSpinEdit = function(control) {
5546 return control && typeof(ASPxClientSpinEdit) != "undefined" && control instanceof ASPxClientSpinEdit;
5547};
5548ASPx.DatePickerType = {
5549 Days: 0,
5550 Months: 1,
5551 Years: 2,
5552 Decades: 3
5553};
5554ASPx.FullScreenUtils = {
5555 subscribeChange: function(handler) {
5556  Evt.AttachEventToElement(document, "fullscreenchange", handler);
5557  Evt.AttachEventToElement(document, "msfullscreenchange", handler); 
5558  Evt.AttachEventToElement(document, "MSFullscreenChange", handler); 
5559  Evt.AttachEventToElement(document, "webkitfullscreenchange", handler);
5560  Evt.AttachEventToElement(document, "mozfullscreenchange", handler);
5561 },
5562 unsubscribeChange: function(handler) {
5563  Evt.DetachEventFromElement(document, "fullscreenchange", handler);
5564  Evt.DetachEventFromElement(document, "msfullscreenchange", handler);
5565  Evt.DetachEventFromElement(document, "MSFullscreenChange", handler);
5566  Evt.DetachEventFromElement(document, "webkitfullscreenchange", handler);
5567  Evt.DetachEventFromElement(document, "mozfullscreenchange", handler);
5568 },
5569 setFullscreen: function(on) {
5570  var element = window.self.document.body;
5571  if(on) {
5572   if(element.requestFullscreen) {
5573    element.requestFullscreen();
5574   } else if(element.mozRequestFullScreen) {
5575    element.mozRequestFullScreen();
5576   } else if(element.webkitRequestFullscreen) {
5577    element.webkitRequestFullscreen();
5578   } else if(element.msRequestFullscreen) {
5579    element.msRequestFullscreen();
5580   }
5581  } else {
5582   if(document.exitFullscreen) {
5583    document.exitFullscreen();
5584   } else if(document.mozCancelFullScreen) {
5585    document.mozCancelFullScreen();
5586   } else if(document.webkitCancelFullScreen) {
5587    document.webkitCancelFullScreen();
5588   } else if(document.msExitFullscreen) {
5589    document.msExitFullscreen();
5590   }
5591  }
5592 },
5593 inFullscreen: function() {
5594  var fullscreenElement = document.fullscreenElement || document.msFullscreenElement || document.webkitFullscreenElement;
5595  var isInFullscreen = fullscreenElement === document.body || document.webkitIsFullScreen;
5596  return !!isInFullscreen;
5597 }
5598 };
5599ASPx.InitializeSVGSprite = function () {
5600 if (ASPx.SVGSprites && ASPx.SVGSprites.length > 0) {
5601  var svgContainer = document.getElementById('svgContainer');
5602  var hasSvgContainer = !!svgContainer;
5603  if (!hasSvgContainer) {
5604   svgContainer = document.createElement('div');
5605   svgContainer.id = 'svgContainer';
5606   svgContainer.style.display = "none";
5607   document.body.appendChild(svgContainer);
5608  }
5609  for (var i = 0; i < ASPx.SVGSprites.length; i++) {
5610   svgContainer.innerHTML += ASPx.SVGSprites[i];
5611  }
5612  ASPx.SVGSprites = null;
5613 }
5614};
5615var GridDynamicStyleSheetHelper = ASPx.CreateClass(null, {
5616 constructor: function() {
5617  this.styleSheet = {};
5618  this.rules = {};
5619  this.updateLock = 0;
5620 },
5621 Update: function(control, styleName, rules) {
5622  var key = control.name + "_" + styleName;
5623  this.BeginUpdate(key);
5624  this.ChangeRules(key, rules);
5625  this.EndUpdate(key);
5626 },
5627 ChangeRules: function(key, rules) {
5628  if(key && rules)
5629   this.rules[key] = rules;
5630 },
5631 BeginUpdate: function(key) {
5632  this.updateLock++;
5633  this.RemoveStyleSheetElement(key);
5634 },
5635 EndUpdate: function(key) {
5636  this.updateLock--;
5637  if(this.updateLock !== 0)
5638   return;
5639  var styleArgs = [];
5640  var controlRules = this.rules[key];
5641  for(var i = 0; i < controlRules.length; i++) {
5642   var rule = controlRules[i];
5643   styleArgs.push(rule.selector + " { " + rule.cssText + " } ");
5644  }
5645  this.styleSheet[key] = this.CreateStyleSheet(key, styleArgs.join(""));
5646 },
5647 CreateStyleSheet: function(key, cssText) {
5648  var container = document.createElement("DIV");
5649  ASPx.Security.setInnerHtml(container, "<style type='text/css' id='" + key + "'>" + cssText + "</style>", ASPx.Security.DataType.Trusted);
5650  styleSheet = ASPx.GetNodeByTagName(container, "style", 0);
5651  if(styleSheet)
5652   ASPx.GetNodeByTagName(document, "HEAD", 0).appendChild(styleSheet);
5653  return styleSheet;
5654 },
5655 ClearStyleSheet: function(control, styleName) {
5656  var key = control.name + "_" + styleName;
5657  this.RemoveStyleSheetElement(key);
5658 },
5659 RemoveStyleSheetElement: function(key) {
5660  if(this.styleSheet[key]) {
5661   ASPx.RemoveElement(this.styleSheet[key]);
5662   delete this.styleSheet[key];
5663  }
5664 }
5665});
5666GridDynamicStyleSheetHelper.Instance = new GridDynamicStyleSheetHelper();
5667ASPx.GridDynamicStyleSheetHelper = GridDynamicStyleSheetHelper;
5668ASPxClientUtils = {};
5669ASPxClientUtils.agent = Browser.UserAgent;
5670ASPxClientUtils.opera = Browser.Opera;
5671ASPxClientUtils.opera9 = Browser.Opera && Browser.MajorVersion == 9;
5672ASPxClientUtils.safari = Browser.Safari;
5673ASPxClientUtils.safari3 = Browser.Safari && Browser.MajorVersion == 3;
5674ASPxClientUtils.safariMacOS = Browser.Safari && Browser.MacOSPlatform;
5675ASPxClientUtils.chrome = Browser.Chrome;
5676ASPxClientUtils.ie = Browser.IE;
5677ASPxClientUtils.ie7 = Browser.IE && Browser.MajorVersion == 7;
5678ASPxClientUtils.firefox = Browser.Firefox;
5679ASPxClientUtils.firefox3 = Browser.Firefox && Browser.MajorVersion == 3;
5680ASPxClientUtils.mozilla = Browser.Mozilla;
5681ASPxClientUtils.netscape = Browser.Netscape;
5682ASPxClientUtils.browserVersion = Browser.Version;
5683ASPxClientUtils.browserMajorVersion = Browser.MajorVersion;
5684ASPxClientUtils.macOSPlatform = Browser.MacOSPlatform;
5685ASPxClientUtils.windowsPlatform = Browser.WindowsPlatform;
5686ASPxClientUtils.webKitFamily = Browser.WebKitFamily;
5687ASPxClientUtils.netscapeFamily = Browser.NetscapeFamily;
5688ASPxClientUtils.touchUI = Browser.TouchUI;
5689ASPxClientUtils.webKitTouchUI = Browser.WebKitTouchUI;
5690ASPxClientUtils.msTouchUI = Browser.MSTouchUI;
5691ASPxClientUtils.iOSPlatform = Browser.MacOSMobilePlatform;
5692ASPxClientUtils.androidPlatform = Browser.AndroidMobilePlatform;
5693ASPxClientUtils.ArrayInsert = Data.ArrayInsert;
5694ASPxClientUtils.ArrayRemove = Data.ArrayRemove;
5695ASPxClientUtils.ArrayRemoveAt = Data.ArrayRemoveAt;
5696ASPxClientUtils.ArrayClear = Data.ArrayClear;
5697ASPxClientUtils.ArrayIndexOf = Data.ArrayIndexOf;
5698ASPxClientUtils.AttachEventToElement = Evt.AttachEventToElement;
5699ASPxClientUtils.DetachEventFromElement = Evt.DetachEventFromElement;
5700ASPxClientUtils.GetEventSource = Evt.GetEventSource;
5701ASPxClientUtils.GetEventX = Evt.GetEventX;
5702ASPxClientUtils.GetEventY = Evt.GetEventY;
5703ASPxClientUtils.GetKeyCode = Evt.GetKeyCode;
5704ASPxClientUtils.PreventEvent = Evt.PreventEvent;
5705ASPxClientUtils.PreventEventAndBubble = Evt.PreventEventAndBubble;
5706ASPxClientUtils.PreventDragStart = Evt.PreventDragStart;
5707ASPxClientUtils.ClearSelection = Selection.Clear;
5708ASPxClientUtils.IsExists = ASPx.IsExists;
5709ASPxClientUtils.IsFunction = ASPx.IsFunction;
5710ASPxClientUtils.GetAbsoluteX = ASPx.GetAbsoluteX;
5711ASPxClientUtils.GetAbsoluteY = ASPx.GetAbsoluteY;
5712ASPxClientUtils.SetAbsoluteX = ASPx.SetAbsoluteX;
5713ASPxClientUtils.SetAbsoluteY = ASPx.SetAbsoluteY;
5714ASPxClientUtils.GetDocumentScrollTop = ASPx.GetDocumentScrollTop;
5715ASPxClientUtils.GetDocumentScrollLeft = ASPx.GetDocumentScrollLeft;
5716ASPxClientUtils.GetDocumentClientWidth = ASPx.GetDocumentClientWidth;
5717ASPxClientUtils.GetDocumentClientHeight = ASPx.GetDocumentClientHeight;
5718ASPxClientUtils.AddClassNameToElement = ASPx.AddClassNameToElement;
5719ASPxClientUtils.RemoveClassNameFromElement = ASPx.RemoveClassNameFromElement;
5720ASPxClientUtils.ToggleClassName = ASPx.ToggleClassNameToElement;
5721ASPxClientUtils.GetIsParent = ASPx.GetIsParent;
5722ASPxClientUtils.GetParentById = ASPx.GetParentById;
5723ASPxClientUtils.GetParentByTagName = ASPx.GetParentByTagName;
5724ASPxClientUtils.GetParentByClassName = ASPx.GetParentByPartialClassName;
5725ASPxClientUtils.GetChildById = ASPx.GetChildById;
5726ASPxClientUtils.GetChildByTagName = ASPx.GetChildByTagName;
5727ASPxClientUtils.SetCookie = Cookie.SetCookie;
5728ASPxClientUtils.GetCookie = Cookie.GetCookie;
5729ASPxClientUtils.DeleteCookie = Cookie.DelCookie;
5730ASPxClientUtils.GetShortcutCode = ASPx.GetShortcutCode; 
5731ASPxClientUtils.GetShortcutCodeByEvent = ASPx.GetShortcutCodeByEvent;
5732ASPxClientUtils.StringToShortcutCode = ASPx.ParseShortcutString;
5733ASPxClientUtils.Trim = Str.Trim; 
5734ASPxClientUtils.TrimStart = Str.TrimStart;
5735ASPxClientUtils.TrimEnd = Str.TrimEnd;
5736ASPxClientUtils.GetEditorValuesInContainer = GetEditorValuesInContainer;
5737ASPxClientUtils.SetEditorValues = SetEditorValues;
5738ASPxClientUtils.SendMessageToAssistiveTechnology = ASPx.AccessibilityUtils.SendMessageToAssistiveTechnology;
5739window.ASPxClientUtils = ASPxClientUtils;
5740window.ListBoxTemporaryCache = ListBoxTemporaryCache;
5741ASPx.AnimationUtils = AnimationUtils;
5742ASPx.AnimationTransitionBase = AnimationTransitionBase;
5743ASPx.AnimationConstants = AnimationConstants;
5744ASPx.AsyncTracker = AsyncTracker;
5745ASPx.Security = Security;
5746})(ASPx, dx);
5747
5748(function module(ASPx, options) {
5749ASPx.modules.Classes = module;
5750ASPx.classesScriptParsed = false;
5751ASPx.documentLoaded = false; 
5752ASPx.CallbackType = {
5753 Data: "d",
5754 Common: "c"
5755};
5756ASPx.callbackState = {
5757 aborted: "aborted",
5758 inTurn: "inTurn",
5759 sent: "sent"
5760};
5761var ASPxClientEvent = ASPx.CreateClass(null, {
5762 constructor: function() {
5763  this.handlerInfoList = [];
5764  this.firingIndex = -1;
5765 },
5766 AddHandler: function(handler, executionContext) {
5767  if(typeof(executionContext) == "undefined")
5768   executionContext = null;
5769  this.RemoveHandler(handler, executionContext);
5770  var handlerInfo = ASPxClientEvent.CreateHandlerInfo(handler, executionContext);
5771  this.handlerInfoList.push(handlerInfo);
5772 },
5773 RemoveHandler: function(handler, executionContext) {
5774  this.removeHandlerByCondition(function(handlerInfo) {
5775   return handlerInfo.handler == handler && 
5776    (!executionContext || handlerInfo.executionContext == executionContext);
5777  });
5778 },
5779 removeHandlerByCondition: function(predicate) {
5780   for(var i = this.handlerInfoList.length - 1; i >= 0; i--) {
5781   var handlerInfo = this.handlerInfoList[i];
5782   if(predicate(handlerInfo)) {
5783    ASPx.Data.ArrayRemoveAt(this.handlerInfoList, i);
5784    if(i <= this.firingIndex)
5785     this.firingIndex--;
5786   }
5787  }
5788 },
5789 removeHandlerByControlName: function(controlName) {
5790  this.removeHandlerByCondition(function(handlerInfo) {
5791   return handlerInfo.executionContext &&  
5792    handlerInfo.executionContext.name === controlName;
5793  });
5794 },
5795 ClearHandlers: function() {
5796  this.handlerInfoList.length = 0;
5797 },
5798 FireEvent: function(obj, args) {
5799  for(this.firingIndex = 0; this.firingIndex < this.handlerInfoList.length; this.firingIndex++) {
5800   var handlerInfo = this.handlerInfoList[this.firingIndex];
5801   handlerInfo.handler.call(handlerInfo.executionContext, obj, args);
5802  }
5803 },
5804 InsertFirstHandler: function(handler, executionContext){
5805  if(typeof(executionContext) == "undefined")
5806   executionContext = null;
5807  var handlerInfo = ASPxClientEvent.CreateHandlerInfo(handler, executionContext);
5808  ASPx.Data.ArrayInsert(this.handlerInfoList, handlerInfo, 0);
5809 },
5810 IsEmpty: function() {
5811  return this.handlerInfoList.length == 0;
5812 }
5813});
5814ASPxClientEvent.CreateHandlerInfo = function(handler, executionContext) {
5815 return {
5816  handler: handler,
5817  executionContext: executionContext
5818 };
5819};
5820var ASPxClientEventArgs = ASPx.CreateClass(null, {
5821 constructor: function() {
5822 }
5823});
5824ASPxClientEventArgs.Empty = new ASPxClientEventArgs();
5825var ASPxClientCancelEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
5826 constructor: function(){
5827  this.constructor.prototype.constructor.call(this);
5828  this.cancel = false;
5829 }
5830});
5831var ASPxClientProcessingModeEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
5832 constructor: function(processOnServer){
5833  this.constructor.prototype.constructor.call(this);
5834  this.processOnServer = !!processOnServer;
5835 }
5836});
5837var ASPxClientProcessingModeCancelEventArgs = ASPx.CreateClass(ASPxClientProcessingModeEventArgs, {
5838 constructor: function(processOnServer){
5839  this.constructor.prototype.constructor.call(this, processOnServer);
5840  this.cancel = false;
5841 }
5842});
5843var OrderedMap = ASPx.CreateClass(null, {
5844 constructor: function(){
5845  this.entries = {};
5846  this.firstEntry = null;
5847  this.lastEntry = null;
5848 },
5849 add: function(key, element) {
5850  var entry = this.addEntry(key, element);
5851  this.entries[key] = entry;
5852 },
5853 remove: function(key) {
5854  var entry = this.entries[key];
5855  if(entry === undefined)
5856   return;
5857  this.removeEntry(entry);
5858  delete this.entries[key];
5859 },
5860 clear: function() {
5861  this.markAllEntriesAsRemoved();
5862  this.entries = {};
5863  this.firstEntry = null;
5864  this.lastEntry = null;
5865 },
5866 get: function(key) {
5867  var entry = this.entries[key];
5868  return entry ? entry.value : undefined;
5869 },
5870 forEachEntry: function(processFunc, context) {
5871  context = context || this;
5872  for(var entry = this.firstEntry; entry; entry = entry.next) {
5873   if(entry.removed)
5874    continue;
5875   if(processFunc.call(context, entry.key, entry.value))
5876    return;
5877  }
5878 },
5879 addEntry: function(key, element) {
5880  var entry = { key: key, value: element, next: null, prev: null };
5881  if(!this.firstEntry)
5882   this.firstEntry = entry;
5883  else {
5884   entry.prev = this.lastEntry;
5885   this.lastEntry.next = entry;
5886  }
5887  this.lastEntry = entry;
5888  return entry;
5889 },
5890 removeEntry: function(entry) {
5891  if(this.firstEntry == entry)
5892   this.firstEntry = entry.next;
5893  if(this.lastEntry == entry)
5894   this.lastEntry = entry.prev;
5895  if(entry.prev)
5896   entry.prev.next = entry.next;
5897  if(entry.next)
5898   entry.next.prev = entry.prev;
5899  entry.removed = true;
5900 },
5901 markAllEntriesAsRemoved: function() {
5902  for(var entry = this.firstEntry; entry; entry = entry.next)
5903   entry.removed = true;
5904 }
5905});
5906var CollectionBase = ASPx.CreateClass(null, {
5907 constructor: function(){
5908  this.elementsMap = new OrderedMap();
5909  this.isASPxClientCollection = true;
5910 },
5911 Add: function(key, element) {
5912  this.elementsMap.add(key, element);
5913 },
5914 Remove: function(key) {
5915  this.elementsMap.remove(key);
5916 },
5917 Clear: function(){
5918  this.elementsMap.clear();
5919 },
5920 Get: function(key){
5921  return this.elementsMap.get(key);
5922 }
5923});
5924(function garbageCollector(ASPx, options) {
5925 ASPx.modules.garbageCollector = garbageCollector;
5926 var interval = options.GCCheckInterval;
5927 window.setInterval(collectObjects, interval);
5928 function canCollectObjects() {
5929  if (!ASPx.GetControlCollection) return false;
5930  var collection = ASPx.GetControlCollection();
5931  return collection && !collection.InCallback();
5932 }
5933 function collectObjects() {
5934  if (!canCollectObjects()) return;
5935  ASPx.GetControlCollectionCollection().RemoveDisposedControls();
5936  if(typeof(ASPx.GetStateController) != "undefined")
5937   ASPx.GetStateController().RemoveDisposedItems();
5938  if(ASPx.TableScrollHelperCollection)
5939   ASPx.TableScrollHelperCollection.RemoveDisposedObjects();
5940  if(ASPx.Ident.scripts.ASPxClientRatingControl)
5941   ASPxClientRatingControl.RemoveDisposedElementUnderCursor();
5942  var postHandler = ASPx.GetPostHandler();
5943  if(postHandler)
5944   postHandler.RemoveDisposedFormsFromCache();
5945 }
5946})(ASPx, options);
5947var ControlTree = ASPx.CreateClass(null, {
5948 constructor: function(controlCollection, container, controlFilter) {
5949  this.container = container;
5950  this.domMap = { };
5951  this.rootNode = this.createNode(null, null);
5952  this.createControlTree(controlCollection, container, controlFilter);
5953 },
5954 createControlTree: function(controlCollection, container, controlFilter) {
5955  controlCollection.ProcessControlsInContainer(container, function(control) {
5956   control.RegisterInControlTree(this);
5957  }.aspxBind(this), controlFilter);
5958  var fixedNodes = [];
5959  var fixedNodesChildren = [];
5960  for(var domElementID in this.domMap) {
5961   if(!this.domMap.hasOwnProperty(domElementID)) continue;
5962   var node = this.domMap[domElementID];
5963   var controlOwner = node.control ? node.control.controlOwner : null;
5964   if(controlOwner && this.domMap[controlOwner.name])
5965    continue;
5966   if(this.isFixedNode(node))
5967    fixedNodes.push(node);
5968   else {
5969    var parentNode = this.findParentNode(domElementID);
5970    parentNode = parentNode || this.rootNode;
5971    if(this.isFixedNode(parentNode))
5972     fixedNodesChildren.push(node);
5973    else {
5974     var childNode = node.mainNode || node;
5975     this.addChildNode(parentNode, childNode);
5976    }
5977   }
5978  }
5979  for(var i = fixedNodes.length - 1; i >= 0; i--)
5980   this.insertChildNode(this.rootNode, fixedNodes[i], 0);
5981  for(var i = fixedNodesChildren.length - 1; i >= 0; i--)
5982   this.insertChildNode(this.rootNode, fixedNodesChildren[i], 0);
5983 },
5984 findParentNode: function(id) {
5985  var element = document.getElementById(id).parentNode;
5986  while(element && element.tagName !== "BODY") {
5987   if(element.id) {
5988    var parentNode = this.domMap[element.id];
5989    if(parentNode)
5990     return parentNode;
5991   }
5992   element = element.parentNode;
5993  }
5994  return null;
5995 },
5996 addChildNode: function(node, childNode) {
5997  if(!childNode.parentNode) {
5998   node.children.push(childNode);
5999   childNode.parentNode = node;
6000  }
6001 },
6002 insertChildNode: function(node, childNode, index) {
6003  if(!childNode.parentNode) {
6004   ASPx.Data.ArrayInsert(node.children, childNode, index);
6005   childNode.parentNode = node;
6006  }
6007 },
6008 addRelatedNode: function(node, relatedNode) {
6009  this.addChildNode(node, relatedNode);
6010  relatedNode.mainNode = node;
6011 },
6012 isFixedNode: function(node) {
6013  var control = node.mainNode ? node.mainNode.control : node.control;
6014  return control && control.HasFixedPosition();
6015 },
6016 createNode: function(domElementID, control) {
6017  var node = {
6018   control: control,
6019   children: [],
6020   parentNode: null,
6021   mainNode: null
6022  };
6023  if(domElementID)
6024   this.domMap[domElementID] = node;
6025  return node;
6026 }
6027});
6028var ControlAdjuster = ASPx.CreateClass(null, {
6029 constructor: function() {
6030 },
6031 adjustControlsInHierarchy: function(controlCollection, adjustFunc, container, collapseControls, controlFilter) {
6032  var controlTree = new ASPx.ControlTree(controlCollection, container, controlFilter);
6033  this.adjustControlsInTree(controlTree.rootNode, adjustFunc, container, collapseControls);
6034 },
6035 adjustControlsInTree: function(treeNode, adjustFunc, container, collapseControls) {
6036  var observer = _aspxGetDomObserver();
6037  observer.pause(container, true);
6038  var documentScrollInfo;
6039  if(collapseControls) {
6040   documentScrollInfo = ASPx.GetOuterScrollPosition(document.body);
6041   this.collapseControls(treeNode);
6042  }
6043  var adjustNodes = [], 
6044   autoHeightNodes = [];
6045  var requireReAdjust = this.forEachControlCore(treeNode, collapseControls, adjustFunc, adjustNodes, autoHeightNodes);
6046  if(requireReAdjust)
6047   this.forEachControlsBackward(adjustNodes, collapseControls, adjustFunc);
6048  else {
6049   for(var i = 0, node; node = autoHeightNodes[i]; i++)
6050    node.control.AdjustAutoHeight();
6051  }
6052  if(collapseControls)
6053   ASPx.RestoreOuterScrollPosition(documentScrollInfo);
6054  observer.resume(container, true);
6055 },
6056 forEachControlCore: function(node, collapseControls, processFunc, adju
6056stNodes, autoHeightNodes) {
6057  var requireReAdjust = false,
6058   size, newSize;
6059  if(node.control) {
6060   var checkReadjustment = collapseControls && node.control.IsControlCollapsed() && node.control.CanCauseReadjustment();
6061   if(checkReadjustment)
6062    size = node.control.GetControlPercentMarkerSize(false, true);
6063   if(node.control.IsControlCollapsed() && !node.control.IsExpandableByAdjustment())
6064    node.control.ExpandControl();
6065   node.control.isInsideHierarchyAdjustment = true;
6066   processFunc(node.control);
6067   node.control.isInsideHierarchyAdjustment = false;
6068   if(checkReadjustment) {
6069    newSize = node.control.GetControlPercentMarkerSize(false, true);
6070    requireReAdjust = size.width !== newSize.width;
6071   }
6072   if(node.control.sizingConfig.supportAutoHeight)
6073    autoHeightNodes.push(node);
6074   node.control.ResetControlPercentMarkerSize();
6075  }
6076  for(var childNode, i = 0; childNode = node.children[i]; i++)
6077   requireReAdjust = this.forEachControlCore(childNode, collapseControls, processFunc, adjustNodes, autoHeightNodes) || requireReAdjust;
6078  adjustNodes.push(node);
6079  return requireReAdjust;
6080 },
6081 forEachControlsBackward: function(adjustNodes, collapseControls, processFunc) {
6082  for(var i = 0, node; node = adjustNodes[i]; i++)
6083   this.forEachControlsBackwardCore(node, collapseControls, processFunc);
6084 },
6085 forEachControlsBackwardCore: function(node, collapseControls, processFunc) {
6086  if(node.control)
6087   processFunc(node.control);
6088  if(node.children.length > 1) {
6089   for(var i = 0, childNode; childNode = node.children[i]; i++) {
6090    if(childNode.control)
6091     processFunc(childNode.control);
6092   }
6093  }
6094 },
6095 collapseControls: function(node) {
6096  for(var childNode, i = 0; childNode = node.children[i]; i++)
6097   this.collapseControls(childNode);
6098  if(node.control && node.control.NeedCollapseControl())
6099   node.control.CollapseControl();
6100 }
6101});
6102var controlAdjuster = null;
6103function GetControlAdjuster() {
6104 if(!controlAdjuster)
6105  controlAdjuster = new ControlAdjuster();
6106 return controlAdjuster;
6107}
6108function _aspxFunctionIsInCallstack(currentCallee, targetFunction, depthLimit) {
6109 var candidate = currentCallee;
6110 var depth = 0;
6111 while(candidate && depth <= depthLimit) {
6112  candidate = candidate.caller;
6113  if(candidate == targetFunction)
6114   return true;
6115  depth++;
6116 }
6117 return false;
6118}
6119ASPx.attachToReady(aspxClassesWindowOnLoad);
6120function aspxClassesWindowOnLoad(){
6121 ASPx.documentLoaded = true;
6122 _aspxMoveLinkElements();
6123 _aspxSweepDuplicatedLinks();
6124 ResourceManager.SynchronizeResources();
6125 var externalScriptProcessor = GetExternalScriptProcessor();
6126 if(externalScriptProcessor)
6127  externalScriptProcessor.ShowErrorMessages();
6128 ASPx.AccessibilityUtils.initialize();
6129 ASPx.GetControlCollection().Initialize();
6130 _aspxInitializeScripts();
6131 _aspxInitializeLinks();
6132 _aspxInitializeFocus();
6133 ASPx.GetControlCollection().FinalizeInitialization();
6134}
6135Ident = { };
6136Ident.IsDate = function(obj) {
6137 return obj && obj.constructor == Date;
6138};
6139Ident.IsRegExp = function(obj) {
6140 return obj && obj.constructor === RegExp;
6141};
6142Ident.IsArray = function(obj) {
6143 return obj && obj.constructor == Array;
6144};
6145Ident.IsASPxClientCollection = function(obj) {
6146 return obj && obj.isASPxClientCollection;
6147};
6148Ident.IsASPxClientControl = function(obj) {
6149 return obj && obj instanceof ASPxClientControlBase;
6150};
6151Ident.IsASPxClientEdit = function(obj) {
6152 return obj && obj.isASPxClientEdit;
6153};
6154Ident.IsFocusableElementRegardlessTabIndex = function (element) {
6155 var tagName = element.tagName;
6156 return tagName == "TEXTAREA" || tagName == "INPUT" || tagName == "A" ||
6157  tagName == "SELECT" || tagName == "IFRAME" || tagName == "OBJECT" || tagName == "BUTTON";
6158};
6159Ident.isDialogInvisibleControl = function(control) {
6160 return !!ASPx.Dialog && ASPx.Dialog.isDialogInvisibleControl(control);
6161};
6162Ident.isBatchEditUnusedEditor = function(control) {
6163 return !!ASPx.BatchEditHelper && ASPx.BatchEditHelper.isBatchEditUnusedEditor(control);
6164};
6165Ident.scripts = {};
6166if(ASPx.IsFunction(window.WebForm_InitCallbackAddField)) {
6167 (function() {
6168  var original = window.WebForm_InitCallbackAddField;
6169  window.WebForm_InitCallbackAddField = function(name, value) {
6170   if(typeof(name) == "string" && name)
6171    original.apply(null, arguments);
6172  };
6173 })();
6174}
6175ASPx.FireDefaultButton = function(evt, buttonID) {
6176 if(_aspxIsDefaultButtonEvent(evt, buttonID)) {
6177  var defaultButton = ASPx.GetElementById(buttonID);
6178  if(defaultButton && defaultButton.click) {
6179   if(ASPx.IsFocusable(defaultButton))
6180    defaultButton.focus();
6181   ASPx.Evt.DoElementClick(defaultButton);
6182   ASPx.Evt.PreventEventAndBubble(evt);
6183   return false;
6184  }
6185 }
6186 return true;
6187};
6188function _aspxIsDefaultButtonEvent(evt, defaultButtonID) {
6189 if(evt.keyCode != ASPx.Key.Enter)
6190  return false;
6191 var srcElement = ASPx.Evt.GetEventSource(evt);
6192 if(!srcElement || srcElement.id === defaultButtonID)
6193  return true;
6194 var tagName = srcElement.tagName;
6195 var type = srcElement.type;
6196 return tagName != "TEXTAREA" && tagName != "BUTTON" && tagName != "A" &&
6197  (tagName != "INPUT" || type != "checkbox" && type != "radio" && type != "button" && type != "submit" && type != "reset");
6198}
6199var PostHandler = ASPx.CreateClass(null, {
6200 constructor: function() {
6201  this.Post = new ASPxClientEvent();
6202  this.PostFinalization = new ASPxClientEvent();
6203  this.observableForms = [];
6204  this.dxCallbackTriggers = {};
6205  this.lastSubmitElementName = null;
6206  this.beforeOnSubmit = function() { };
6207  this.ReplaceGlobalPostFunctions();
6208  this.HandleDxCallbackBeginning();
6209  this.HandleMSAjaxRequestBeginning();
6210 },
6211 Update: function() {
6212  this.ReplaceFormsSubmit(true);
6213 },
6214 ProcessPostRequest: function(ownerID, isCallback, isMSAjaxRequest, isDXCallback) {
6215  this.cancelPostProcessing = false;
6216  this.isMSAjaxRequest = isMSAjaxRequest;
6217  if(this.SkipRaiseOnPost(ownerID, isCallback, isDXCallback))
6218   return;
6219  var args = new PostHandlerOnPostEventArgs(ownerID, isCallback, isMSAjaxRequest, isDXCallback);
6220  this.Post.FireEvent(this, args);
6221  this.cancelPostProcessing = args.cancel;
6222  if(!args.cancel)
6223   this.PostFinalization.FireEvent(this, args);
6224 },
6225 SkipRaiseOnPost: function(ownerID, isCallback, isDXCallback) { 
6226  if(!isCallback)
6227   return false;
6228  var dxOwner = isDXCallback && ASPx.GetControlCollection().GetByName(ownerID);
6229  if(dxOwner) {
6230   this.dxCallbackTriggers[dxOwner.uniqueID] = true;
6231   return false;
6232  }
6233  if(this.dxCallbackTriggers[ownerID]) {
6234   this.dxCallbackTriggers[ownerID] = false;
6235   return true;
6236  }
6237  return false;
6238 },
6239 ReplaceGlobalPostFunctions: function() {
6240  if(ASPx.IsFunction(window.__doPostBack))
6241   this.ReplaceDoPostBack();
6242  if(ASPx.IsFunction(window.WebForm_DoCallback))
6243   this.ReplaceDoCallback();
6244  if(ASPx.IsFunction(window.WebForm_ExecuteCallback))
6245   this.ReplaceExecuteCallback();
6246  this.ReplaceFormsSubmit();
6247 },
6248 HandleDxCallbackBeginning: function() {
6249  ASPx.GetControlCollection().BeforeInitCallback.AddHandler(function(s, e) {
6250   aspxRaisePostHandlerOnPost(e.callbackOwnerID, true, false, true); 
6251  });
6252 },
6253 HandleMSAjaxRequestBeginning: function() {
6254  var pageRequestManager = ASPx.GetMSAjaxRequestManager();
6255  if(pageRequestManager != null && Ident.IsArray(pageRequestManager._onSubmitStatements)) {
6256   pageRequestManager._onSubmitStatements.unshift(function() {
6257    var postbackSettings = Sys.WebForms.PageRequestManager.getInstance()._postBackSettings;
6258    var postHandler = aspxGetPostHandler();
6259    aspxRaisePostHandlerOnPost(postbackSettings.asyncTarget, true, true);
6260    return !postHandler.cancelPostProcessing;
6261   });
6262  }
6263 },
6264 ReplaceDoPostBack: function() {
6265  var original = __doPostBack;
6266  __doPostBack = function(eventTarget, eventArgument) {
6267   var postHandler = aspxGetPostHandler();
6268   aspxRaisePostHandlerOnPost(eventTarget);
6269   if(postHandler.cancelPostProcessing)
6270    return;
6271   ASPxClientControl.postHandlingLocked = true;
6272   original(eventTarget, eventArgument);
6273   delete ASPxClientControl.postHandlingLocked;
6274  };
6275 },
6276 ReplaceDoCallback: function() {
6277  var original = WebForm_DoCallback;
6278  WebForm_DoCallback = function(eventTarget, eventArgument, eventCallback, context, errorCallback, useAsync) {
6279   var postHandler = aspxGetPostHandler();
6280   aspxRaisePostHandlerOnPost(eventTarget, true);
6281   if(postHandler.cancelPostProcessing)
6282    return;
6283   return original(eventTarget, eventArgument, eventCallback, context, errorCallback, useAsync);
6284  };
6285 },
6286 ReplaceExecuteCallback: function() {
6287  var original = WebForm_ExecuteCallback;
6288  var handler = this;
6289  WebForm_ExecuteCallback = function(callbackObject) {
6290   var isDxCallback = callbackObject && callbackObject.context && ASPx.GetControlCollection().Get(callbackObject.context) !== null;
6291   ASPx.callbackProcessed = false;
6292   original(callbackObject);
6293   if(isDxCallback && !ASPx.callbackProcessed) {
6294    var request = callbackObject.xmlRequest;
6295    if(handler.HasAppErrorOnCallback(request) && ASPxClientUtils.IsExists(callbackObject.eventCallback))
6296     callbackObject.eventCallback(handler.GetServerErrorText(), callbackObject.context);
6297   }
6298  };
6299 },
6300 HasAppErrorOnCallback: function(request) {
6301  if(!request) return false;
6302  var isServerError = request.status && request.status == 500;
6303  var pattern = /<html[^>]*>([\w|\W]*)<\/html>/im;
6304  var text = request.responseText;
6305  return isServerError && !!text && pattern.test(text);
6306 },
6307 GetServerErrorText: function() {
6308  return "Internal Server Error";
6309 }, 
6310 ReplaceFormsSubmit: function(checkObservableCollection) {
6311  for(var i = 0; i < document.forms.length; i++) { 
6312   var form = document.forms[i];
6313   if(checkObservableCollection && ASPx.Data.ArrayIndexOf(this.observableForms, form) >= 0)
6314    continue;
6315   if(form.submit)
6316    this.ReplaceFormSubmit(form);
6317   this.ReplaceFormOnSumbit(form);
6318   this.observableForms.push(form);
6319  }
6320 },
6321 ReplaceFormSubmit: function(form) {
6322  var originalSubmit = form.submit;
6323  form.submit = function() {
6324   var postHandler = aspxGetPostHandler();
6325   aspxRaisePostHandlerOnPost();
6326   if(postHandler.cancelPostProcessing)
6327    return false;
6328   var callee = arguments.callee;
6329   this.submit = originalSubmit;
6330   var submitResult = this.submit();
6331   this.submit = callee;
6332   return submitResult;
6333  };
6334  form = null;
6335 },
6336 ReplaceFormOnSumbit: function(form) {
6337  var originalSubmit = form.onsubmit;
6338  form.onsubmit = function() {
6339   var postHandler = aspxGetPostHandler();
6340   postHandler.beforeOnSubmit();
6341   if(postHandler.isMSAjaxRequest)
6342    postHandler.isMsAjaxRequest = false;
6343   else
6344    aspxRaisePostHandlerOnPost(postHandler.GetLastSubmitElementName());
6345   if(postHandler.cancelPostProcessing)
6346    return false;
6347   return ASPx.IsFunction(originalSubmit)
6348    ? originalSubmit.apply(this, arguments)
6349    : true;
6350  };
6351  form = null;
6352 },
6353 SetBeforeOnSubmit: function(action) {
6354  this.beforeOnSubmit = action;
6355 },
6356 SetLastSubmitElementName: function(elementName) {
6357  this.lastSubmitElementName = elementName;
6358 },
6359 GetLastSubmitElementName: function() {
6360  return this.lastSubmitElementName;
6361 },
6362 RemoveDisposedFormsFromCache: function(){
6363  for(var i = 0; this.observableForms && i < this.observableForms.length; i++){
6364   var form = this.observableForms[i];
6365   if(!ASPx.IsExistsElement(form)){
6366    ASPx.Data.ArrayRemove(this.observableForms, form);
6367    i--;
6368   }
6369  }
6370 }
6371});
6372function aspxRaisePostHandlerOnPost(ownerID, isCallback, isMSAjaxRequest, isDXCallback) {
6373 if(ASPxClientControl.postHandlingLocked) return;
6374 var postHandler = aspxGetPostHandler();
6375 if(postHandler)
6376  postHandler.ProcessPostRequest(ownerID, isCallback, isMSAjaxRequest, isDXCallback);
6377}
6378var aspxPostHandler;
6379function aspxGetPostHandler() {
6380 if(!aspxPostHandler)
6381  aspxPostHandler = new PostHandler();
6382 return aspxPostHandler;
6383}
6384var PostHandlerOnPostEventArgs = ASPx.CreateClass(ASPxClientCancelEventArgs, {
6385 constructor: function(ownerID, isCallback, isMSAjaxCallback, isDXCallback){
6386  this.constructor.prototype.constructor.call(this);
6387  this.ownerID = ownerID;
6388  this.isCallback = !!isCallback;
6389  this.isDXCallback = !!isDXCallback;
6390  this.isMSAjaxCallback = !!isMSAjaxCallback;
6391 }
6392});
6393var ResourceManager = {
6394 HandlerStr: "DXR.axd?r=",
6395 ResourceHashes: {},
6396 SynchronizeResources: function(method){
6397  if(!method){
6398   method = function(name, resource) { 
6399    this.UpdateInputElements(name, resource); 
6400   }.aspxBind(this);
6401  }
6402  var resources = this.GetResourcesData();
6403  for(var name in resources)
6404   if(resources.hasOwnProperty(name))
6405    method(name, resources[name]);
6406 },
6407 GetResourcesData: function(){
6408  return {
6409   DXScript: this.GetResourcesElementsString(_aspxGetIncludeScripts(), "src", "DXScript"),
6410   DXCss: this.GetResourcesElementsString(_aspxGetLinks(), "href", "DXCss")
6411  };
6412 },
6413 ParseBundleSrc: function(elements, urlAttr){
6414  var timeStamp = "";
6415  var resourceUrlArray = [];
6416  for(var i = 0; i < elements.length; i++) {
6417   var resourceUrl = ASPx.Attr.GetAttribute(elements[i], urlAttr);
6418   if(resourceUrl) {
6419    var pos = resourceUrl.indexOf(this.HandlerStr);
6420    if(pos > -1){
6421     var list = resourceUrl.substr(pos + this.HandlerStr.length);
6422     var ampPos = list.lastIndexOf("-");
6423     if(ampPos > -1) {
6424      timeStamp = list.substr(ampPos);
6425      list = list.substr(0, ampPos);
6426     }
6427     var indexes = list.split(",");
6428     for(var j = 0; j < indexes.length; j++) {
6429      resourceUrlArray.push(indexes[j]);
6430     }
6431    }
6432    else
6433     resourceUrlArray.push(resourceUrl);
6434   }
6435  }
6436  return {
6437   'resourceUrlArray': resourceUrlArray,
6438   'timeStamp': timeStamp
6439  };
6440 },
6441 GetResourceHashes: function (id) {
6442  if (!this.ResourceHashes[id])
6443   this.ResourceHashes[id] = {};
6444  return this.ResourceHashes[id];
6445 },
6446 GetResourcesElementsString: function (elements, urlAttr, id) {
6447  var hash = this.GetResourceHashes(id);
6448  var resourceUrlArray = this.ParseBundleSrc(elements, urlAttr).resourceUrlArray;
6449  for(var i = 0; i < resourceUrlArray.length; i++) {
6450   hash[resourceUrlArray[i]] = resourceUrlArray[i];
6451  }
6452  var array = [];
6453  for(var key in hash)
6454   if(hash.hasOwnProperty(key))
6455    array.push(key);
6456  return array.join(",");
6457 },
6458 GetNewResourcesElementString: function (element, urlAttr, id) {
6459  var originalUrl = ASPx.Attr.GetAttribute(element, urlAttr);
6460  var handlerStrIndex = originalUrl.indexOf(this.HandlerStr);
6461  var dxResources = handlerStrIndex > -1;
6462  if(!dxResources) return element[urlAttr];
6463  var hash = this.GetResourceHashes(id);
6464  var srcInfo = this.ParseBundleSrc([element], urlAttr);
6465  var resourceUrlArray = srcInfo.resourceUrlArray;
6466  var timeStamp = srcInfo.timeStamp;
6467  var newResourceArray = [];
6468  for(var i = 0; i < resourceUrlArray.length; i++) {
6469    if(!hash[resourceUrlArray[i]])
6470    newResourceArray.push(resourceUrlArray[i]);
6471  }
6472  var newResources = "";
6473  if(newResourceArray.length > 0) {
6474   var baseUrl = originalUrl.substr(0, handlerStrIndex);
6475   newResources = baseUrl + this.HandlerStr + newResourceArray.join(",") + timeStamp;
6476  }
6477  return newResources;
6478 },
6479 UpdateInputElements: function(typeName, list){
6480  for(var i = 0; i < document.forms.length; i++){
6481   var inputElement = document.forms[i][typeName];
6482   if(!inputElement)
6483    inputElement = this.CreateInputElement(document.forms[i], typeName);
6484   inputElement.value = list;
6485  }
6486 },
6487 CreateInputElement: function(form, typeName){
6488  var inputElement = ASPx.CreateHiddenField(typeName);
6489  form.appendChild(inputElement);
6490  return inputElement;
6491 }
6492};
6493ASPx.includeScriptPrefix = "dxis_";
6494ASPx.startupScriptPrefix = "dxss_";
6495var includeScriptsCache = {};
6496var createdIncludeScripts = [];
6497var appendedScriptsCount = 0;
6498var callbackOwnerNames = [];
6499var scriptsRestartHandlers = { };
6500function _aspxIsKnownIncludeScript(script) {
6501 return !!includeScriptsCache[script.src];
6502}
6503function _aspxCacheIncludeScript(script) {
6504 includeScriptsCache[script.src] = 1;
6505}
6506function _aspxProcessScriptsAndLinks(ownerName, isCallback) {
6507 if(!ASPx.documentLoaded) return; 
6508 _aspxProcessScripts(ownerName, isCallback);
6509 getLinkProcessor().process();
6510 ASPx.ClearCachedCssRules();
6511}
6512function _aspxGetStartupScripts(container) {
6513 return _aspxGetScriptsCore(ASPx.startupScriptPrefix, container);
6514}
6515function _aspxGetIncludeScripts() {
6516 return _aspxGetScriptsCore(ASPx.includeScriptPrefix);
6517}
6518function _aspxGetScriptsCore(prefix, container) {
6519 var result = [];
6520 var scripts;
6521 if(ASPx.IsExists(container))
6522  scripts = ASPx.GetNodesByTagName(container, "SCRIPT");
6523 else
6524  scripts = document.getElementsByTagName("SCRIPT");
6525 for(var i = 0; i < scripts.length; i++) {
6526  if(scripts[i].id.indexOf(prefix) == 0)
6527   result.push(scripts[i]);
6528 }
6529 return result;
6530}
6531function _aspxGetLinks() {
6532 var result = [];
6533 var links = document.getElementsByTagName("LINK");
6534 for(var i = 0; i < links.length; i++) 
6535  result[i] = links[i];
6536 return result;
6537}
6538function _aspxIsLinksLoaded() {
6539 var links = _aspxGetLinks();
6540 for(var i = 0, link; link = links[i]; i++)
6541  if(link.readyState && link.readyState.toLowerCase() == "loading")
6542    return false;
6543 return true;
6544}
6545function _aspxInitializeLinks() {
6546 var links = _aspxGetLinks();
6547 for(var i = 0; i < links.length; i++)
6548  links[i].loaded = true; 
6549}
6550var scriptExecutedAttrName = "data-executed";
6551var scriptDelayedExecutionAttrName = "data-dx-delayedeval";
6552ASPx.MarkInnerScriptBlocksAsDelayedExecution = function(scriptsContainer) {
6553 var scripts = scriptsContainer.querySelectorAll("script[id^=" + ASPx.startupScriptPrefix + "]");
6554 for(var i = 0; i < scripts.length; i++)
6555  ASPx.Attr.SetAttribute(scripts[i], scriptDelayedExecutionAttrName, true);
6556};
6557function isScriptExecuted(script) {
6558 return ASPx.Attr.GetAttribute(script, scriptExecutedAttrName);
6559}
6560function markScriptAsExecuted(script) {
6561 if(ASPx.Attr.GetAttribute(script, scriptDelayedExecutionAttrName))
6562  ASPx.Attr.RemoveAttribute(script, scriptDelayedExecutionAttrName);
6563 else
6564  ASPx.Attr.SetAttribute(script, scriptExecutedAttrName, true);
6565}
6566function _aspxInitializeScripts() {
6567 var scripts = _aspxGetIncludeScripts();
6568 for(var i = 0; i < scripts.length; i++)
6569  _aspxCacheIncludeScript(scripts[i]);   
6570 var startupScripts = _aspxGetStartupScripts();
6571 for(var i = 0; i < startupScripts.length; i++)
6572  markScriptAsExecuted(startupScripts[i]);
6573}
6574function _aspxSweepDuplicatedLinks() {
6575 var hash = { };
6576 var links = _aspxGetLinks();
6577 for(var i = 0; i < links.length; i++) {
6578  var href = links[i].href;
6579  if(!href)
6580   continue;
6581  if(hash[href]){
6582   if((ASPx.Browser.IE || !hash[href].loaded) && links[i].loaded) {
6583    ASPx.RemoveElement(hash[href]);
6584    hash[href] = links[i];
6585   }
6586   else
6587    ASPx.RemoveElement(links[i]);
6588  }
6589  else
6590   hash[href] = links[i];
6591 }
6592}
6593function _aspxSweepDuplicatedScripts() {
6594 var hash = { };
6595 var scripts = _aspxGetIncludeScripts();
6596 for(var i = 0; i < scripts.length; i++) {
6597  var src = scripts[i].src;
6598  if(!src) continue;
6599  if(hash[src])
6600   ASPx.RemoveElement(scripts[i]);
6601  else
6602   hash[src] = scripts[i];
6603 }
6604}
6605function _aspxAreScriptsEqual(script1, script2) {
6606 return script1.src == script2.src;
6607}
6608function _aspxProcessScripts(ownerName, isCallback) {
6609 var scripts = _aspxGetIncludeScripts();
6610 var previousCreatedScript = null;
6611 var firstCreatedScript = null;
6612 for(var i = 0; i < scripts.length; i++) {
6613  var script = scripts[i];
6614  if(script.src == "") continue; 
6615  if(_aspxIsKnownIncludeScript(script))
6616   continue;
6617  var getOnlyNewResources = true;
6618  var onlyNewScripts = ResourceManager.GetNewResourcesElementString(script, "src", "DXScript", getOnlyNewResources);
6619  if (onlyNewScripts == "")
6620   continue;
6621  var createdScript = document.createElement("script");
6622  ASPx.Attr.AppendScriptType(createdScript);
6623  createdScript.src = onlyNewScripts;
6624  createdScript.id = script.id;
6625  if(ASPx.Data.ArrayIndexOf(createdIncludeScripts, createdScript, _aspxAreScriptsEqual) >= 0)
6626   continue;
6627  createdIncludeScripts.push(createdScript);
6628  ASPx.RemoveElement(script);
6629  if(ASPx.Browser.IE && ASPx.Browser.Version < 9) {
6630   createdScript.onreadystatechange = new Function("ASPx.OnScriptReadyStateChangedCallback(this, " + isCallback + ");");
6631  } else if(ASPx.Browser.Edge || ASPx.Browser.WebKitFamily || (ASPx.Browser.Firefox && ASPx.Browser.Version >= 4) || ASPx.Browser.IE && ASPx.Browser.Version >= 9) {
6632   createdScript.onload = new Function("ASPx.OnScriptLoadCallback(this, " + isCallback + ");");
6633   if(firstCreatedScript == null)
6634    firstCreatedScript = createdScript;
6635   createdScript.nextCreatedScript = null;
6636   if(previousCreatedScript != null)
6637    previousCreatedScript.nextCreatedScript = createdScript;
6638   previousCreatedScript = createdScript;
6639  } else {
6640   createdScript.onload = new Function("ASPx.OnScriptLoadCallback(this);");
6641   ASPx.AppendScript(createdScript);
6642   _aspxCacheIncludeScript(createdScript);
6643  }
6644 }
6645 if(firstCreatedScript != null) {
6646  ASPx.AppendScript(firstCreatedScript);
6647  _aspxCacheIncludeScript(firstCreatedScript);
6648 }
6649 if(isCallback)
6650  callbackOwnerNames.push(ownerName);
6651 if(createdIncludeScripts.length == 0) {
6652  var newLinks = ASPx.GetNodesByTagName(document.body, "link");
6653  var needProcessLinks = isCallback && newLinks.length > 0;
6654  if(needProcessLinks)
6655   needProcessLinks = getLinkProcessor().addLinks(newLinks);
6656  if(!needProcessLinks)
6657   ASPx.FinalizeScriptProcessing(isCallback);
6658 }
6659}
6660ASPx.FinalizeScriptProcessing = function(isCallback) {
6661 createdIncludeScripts = [];
6662 appendedScriptsCount = 0;
6663 var linkProcessor = getLinkProcessor();
6664 if(linkProcessor.hasLinks())
6665  _aspxSweepDuplicatedLinks();
6666 linkProcessor.reset();
6667 _aspxSweepDuplicatedScripts();
6668 ResourceManager.SynchronizeResources();
6669 _aspxRunStartupScripts(isCallback);
6670};
6671var startupScriptsRunning = false;
6672function _aspxRunStartupScripts(isCallback, container) {
6673 startupScriptsRunning = true;
6674 try {
6675  _aspxRunStartupScriptsCore(container);
6676 }
6677 finally {
6678  startupScriptsRunning = false;
6679 }
6680 if(ASPx.documentLoaded) {
6681  ASPx.GetControlCollection().ProcessActionByPredicate(
6682   function(collection) { collection.InitializeElements(isCallback); },
6683   function(control) { return !ASPx.IsExists(container) || ASPx.GetIsParent(container, control.GetMainElement()); }
6684  );
6685  for(var key in scriptsRestartHandlers)
6686   if(scriptsRestartHandlers.hasOwnProperty(key))
6687    scriptsRestartHandlers[key]();
6688  _aspxRunEndCallbackScript();
6689 }
6690}
6691function _aspxIsStartupScriptsRunning(isCallback) {
6692 return startupScriptsRunning;
6693}
6694function _aspxRunStartupScriptsCore(container) {
6695 var scripts = _aspxGetStartupScripts(container);
6696 var code;
6697 for(var i = 0; i < scripts.length; i++){
6698  var script = scripts[i];
6699  if(!isScriptExecuted(script)) {
6700   _aspxEnsureStartupScriptIsUnique(script.id); 
6701   code = ASPx.GetScriptCode(script);
6702   eval(code);
6703   markScriptAsExecuted(script);
6704  }
6705 }
6706}
6707function _aspxEnsureStartupScriptIsUnique(scriptId) {
6708 if(!scriptId)
6709  return;
6710 var scriptExecutedSelector = "script[" + scriptExecutedAttrName + "='true']#" + scriptId;
6711 ASPx.RemoveElement(document.querySelector(scriptExecutedSelector));
6712}
6713function _aspxRunEndCallbackScript() {
6714 while(callbackOwnerNames.length > 0) {
6715  var callbackOwnerName = callbackOwnerNames.pop();
6716  var callbackOwner = ASPx.GetControlCollection().Get(callbackOwnerName);
6717  if(callbackOwner)
6718   callbackOwner.DoEndCallback();
6719 }
6720}
6721ASPx.OnScriptReadyStateChangedCallback = function(scriptElement, isCallback) {
6722 if(scriptElement.readyState == "loaded") {
6723  _aspxCacheIncludeScript(scriptElement);
6724  for(var i = 0; i < createdIncludeScripts.length; i++) {
6725   var script = createdIncludeScripts[i];
6726   if(_aspxIsKnownIncludeScript(script)) {
6727    if(!isScriptExecuted(script)) {
6728     markScriptAsExecuted(script);
6729     ASPx.AppendScript(script);
6730     appendedScriptsCount++;
6731    }
6732   } else
6733    break;
6734  }
6735  if(createdIncludeScripts.length == appendedScriptsCount)
6736   ASPx.FinalizeScriptProcessing(isCallback);
6737 }
6738};
6739ASPx.OnScriptLoadCallback = function(scriptElement, isCallback) {
6740 appendedScriptsCount++;
6741 if(scriptElement.nextCreatedScript) {
6742  ASPx.AppendScript(scriptElement.nextCreatedScript);
6743  _aspxCacheIncludeScript(scriptElement.nextCreatedScript);
6744 }
6745 if(createdIncludeScripts.length == appendedScriptsCount)
6746  ASPx.FinalizeScriptProcessing(isCallback);
6747};
6748function _aspxAddScriptsRestartHandler(objectName, handler) {
6749 scriptsRestartHandlers[objectName] = handler;
6750}
6751function _aspxMoveLinkElements() {
6752 var head = ASPx.GetNodesByTagName(document, "head")[0];
6753 var bodyLinks = ASPx.GetNodesByTagName(document.body, "link");
6754 if(head && bodyLinks.length > 0){
6755  var headLinks = ASPx.GetNodesByTagName(head, "link");
6756  var dxLinkAnchor = head.firstChild;
6757  for(var i = 0; i < headLinks.length; i++){
6758   if(headLinks[i].href.indexOf(ResourceManager.HandlerStr) > -1)
6759    dxLinkAnchor = headLinks[i].nextSibling;
6760  }
6761  while(bodyLinks.length > 0) 
6762   head.insertBefore(bodyLinks[0], dxLinkAnchor);
6763 }
6764}
6765var LinkProcessor = ASPx.CreateClass(null, {
6766 constructor: function() {
6767  this.loadedLinkCount = 0;
6768  this.linkInfos = [];
6769  this.loadingObservationTimerID = -1;
6770 },
6771 process: function() {
6772  if(this.hasLinks()) {
6773   if(this.isLinkLoadEventSupported())
6774    this.processViaLoadEvent();
6775   else
6776    this.processViaTimer();
6777  }
6778  else
6779   _aspxSweepDuplicatedLinks();
6780  _aspxMoveLinkElements();
6781 },
6782 addLinks: function(links) {
6783  var prevLinkCount = this.linkInfos.length;
6784  for(var i = 0; i < links.length; i++) {
6785   var link = links[i];
6786   if(link.loaded || link.rel != "stylesheet" || link.href.toLowerCase().indexOf("dxr.axd?r=") == -1)
6787    continue;
6788   var linkInfo = {
6789    link: link,
6790    href: link.href
6791   };
6792   this.linkInfos.push(linkInfo);
6793  }
6794  return prevLinkCount != this.linkInfos.length;
6795 },
6796 hasLinks: function() {
6797  return this.linkInfos.length > 0;
6798 },
6799 reset: function() {
6800  this.linkInfos = [];
6801  this.loadedLinkCount = 0;
6802 },
6803 processViaLoadEvent: function() {
6804  var that = this;
6805  for(var i = 0, linkInfo; linkInfo = this.linkInfos[i]; i++) {
6806   if(ASPx.Browser.IE && ASPx.Browser.Version < 9)
6807    linkInfo.link.onreadystatechange = function() { that.onLinkReadyStateChanged(this); };
6808   else
6809    linkInfo.link.onload = this.onLinkLoad.aspxBind(this);
6810  }
6811 },
6812 isLinkLoadEventSupported: function() {
6813  return !(ASPx.Browser.Chrome && ASPx.Browser.MajorVersion < 19 || ASPx.Browser.Firefox && ASPx.Browser.MajorVersion < 9 ||
6814   ASPx.Browser.Safari && ASPx.Browser.MajorVersion < 6 || ASPx.Browser.AndroidDefaultBrowser && ASPx.Browser.MajorVersion < 4.4);
6815 },
6816 processViaTimer: function() {
6817  if(this.loadingObservationTimerID == -1)
6818   this.onLinksLoadingObserve();
6819 },
6820 onLinksLoadingObserve: function() {
6821  if(this.getIsAllLinksLoaded()) {
6822   this.loadingObservationTimerID = -1;
6823   this.onAllLinksLoad();
6824  }
6825  else
6826   this.loadingObservationTimerID = window.setTimeout(this.onLinksLoadingObserve.aspxBind(this), 100);
6827 },
6828 getIsAllLinksLoaded: function() {
6829  var styleSheets = document.styleSheets;
6830  var loadedLinkHrefs = { };
6831  for(var i = 0; i < styleSheets.length; i++) {
6832   var styleSheet = styleSheets[i];
6833   try {
6834    if(styleSheet.cssRules)
6835     loadedLinkHrefs[styleSheet.href] = 1;
6836   }
6837   catch(ex) { }
6838  }
6839  var loadedLinksCount = 0;
6840  for(var i = 0, linkInfo; linkInfo = this.linkInfos[i]; i++) {
6841   if(loadedLinkHrefs[linkInfo.href])
6842    loadedLinksCount++;
6843  }
6844  return loadedLinksCount == this.linkInfos.length;
6845 },
6846 onAllLinksLoad: function() {
6847  this.reset();
6848  _aspxSweepDuplicatedLinks();
6849  if(createdIncludeScripts.length == 0)
6850   ASPx.FinalizeScriptProcessing(true);
6851 },
6852 onLinkReadyStateChanged: function(linkElement) {
6853  if(linkElement.readyState == "complete")
6854   this.onLinkLoadCore(linkElement);
6855 },
6856 onLinkLoad: function(evt) {
6857  var linkElement = ASPx.Evt.GetEventSource(evt);
6858  this.onLinkLoadCore(linkElement);
6859 },
6860 onLinkLoadCore: function(linkElement) {
6861  if(!this.hasLinkElement(linkElement)) return;
6862  this.loadedLinkCount++;
6863  if(!ASPx.Browser.Firefox && this.loadedLinkCount == this.linkInfos.length || 
6864   ASPx.Browser.Firefox && this.loadedLinkCount == 2 * this.linkInfos.length) {
6865   this.onAllLinksLoad();
6866  }
6867 },
6868 hasLinkElement: function(linkElement) {
6869  for(var i = 0, linkInfo; linkInfo = this.linkInfos[i]; i++) {
6870   if(linkInfo.link == linkElement)
6871    return true;
6872  }
6873  return false;
6874 }
6875});
6876var linkProcessor = null;
6877function getLinkProcessor() {
6878 if(linkProcessor == null)
6879  linkProcessor = new LinkProcessor();
6880 return linkProcessor;
6881}
6882ASPx.LinkProcessor = LinkProcessor;
6883var IFrameHelper = ASPx.CreateClass(null, {
6884 constructor: function(params) {
6885  this.params = params || {};
6886  this.params.src = this.params.src || "";
6887  this.CreateElements();
6888 },
6889 CreateElements: function() {
6890  var elements = IFrameHelper.Create(this.params);
6891  this.containerElement = elements.container;
6892  this.iframeElement = elements.iframe;
6893  this.AttachOnLoadHandler(this, this.iframeElement);
6894  this.SetLoading(true);
6895  if(this.params.onCreate)
6896   this.params.onCreate(this.containerElement, this.iframeElement);
6897 },
6898 AttachOnLoadHandler: function(instance, element) {
6899  ASPx.Evt.AttachEventToElement(element, "load", function() {
6900   instance.OnLoad(element);
6901  });
6902 },
6903 OnLoad: function(element) {
6904  this.SetLoading(false, element);
6905  if(!element.preventCustomOnLoad && this.params.onLoad)
6906   this.params.onLoad();
6907 },
6908 IsLoading: function(element) {
6909  element = element || this.iframeElement;
6910  if(element)
6911   return element.loading;
6912  return false;
6913 },
6914 SetLoading: function(value, element) {
6915  element = element || this.iframeElement;
6916  if(element)
6917   element.loading = value;
6918 },
6919 GetContentUrl: function() {
6920  return this.params.src;
6921 },
6922 SetContentUrl: function(url, preventBrowserCaching) {
6923  if(url) {
6924   this.params.src = url;
6925   if(preventBrowserCaching)
6926    url = IFrameHelper.AddRandomParamToUrl(url);
6927   this.SetLoading(true);
6928   this.iframeElement.src = url;
6929  }
6930 },
6931 RefreshContentUrl: function() {
6932  if(this.IsLoading())
6933   return;
6934  this.SetLoading(true);
6935  var oldContainerElement = this.containerElement;
6936  var oldIframeElement = this.iframeElement;
6937  var postfix = "_del" + Math.floor(Math.random()*100000).toString();
6938  if(this.params.id)
6939   oldIframeElement.id = this.params.id + postfix;
6940  if(this.params.name)
6941   oldIframeElement.name = this.params.name + postfix;
6942  ASPx.SetStyles(oldContainerElement, { height: 0 });
6943  this.CreateElements();
6944  oldIframeElement.preventCustomOnLoad = true;
6945  oldIframeElement.src = ASPx.BlankUrl;
6946  window.setTimeout(function() {
6947   oldContainerElement.parentNode.removeChild(oldContainerElement);
6948  }, 10000); 
6949 }
6950});
6951IFrameHelper.Create = function(params) {
6952 var iframeHtmlStringParts = [ "<iframe frameborder='0'" ];
6953 if(params) {
6954  if(params.id)
6955   iframeHtmlStringParts.push(" id='", params.id, "'");
6956  if(params.name)
6957   iframeHtmlStringParts.push(" name='", params.name, "'");
6958  if(params.title)
6959   iframeHtmlStringParts.push(" title='", params.title, "'");
6960  if(params.scrolling)
6961   iframeHtmlStringParts.push(" scrolling='", params.scrolling, "'");
6962  if(params.src)
6963   iframeHtmlStringParts.push(" src='", params.src, "'");
6964 }
6965 iframeHtmlStringParts.push("></iframe>");
6966 var containerElement = ASPx.CreateHtmlElementFromString("<div style='border-width: 0px; padding: 0px; margin: 0px'></div>");
6967 var iframeElement = ASPx.CreateHtmlElementFromString(iframeHtmlStringParts.join(""));
6968 containerElement.appendChild(iframeElement);
6969 return {
6970  container: containerElement,
6971  iframe: iframeElement
6972 };
6973};
6974IFrameHelper.AddRandomParamToUrl = function(url) {
6975 var prefix = url.indexOf("?") > -1
6976  ? "&"
6977  : "?";
6978 var param = prefix + Math.floor(Math.random()*100000).toString();
6979 var anchorIndex = url.indexOf("#");
6980 return anchorIndex == -1
6981  ? url + param
6982  : url.substr(0, anchorIndex) + param + url.substr(anchorIndex);
6983};
6984IFrameHelper.GetWindow = function(name) {
6985 if(ASPx.Browser.IE)
6986  return window.frames[name].window;
6987 else{
6988  var frameElement = document.getElementById(name);
6989  return (frameElement != null) ? frameElement.contentWindow : null;
6990 }
6991};
6992IFrameHelper.GetDocument = function(name) {
6993 var frameElement;
6994 if(ASPx.Browser.IE) {
6995  frameElement = window.frames[name];
6996  return (frameElement != null) ? frameElement.document : null;
6997 }
6998 else {
6999  frameElement = document.getElementById(name);
7000  return (frameElement != null) ? frameElement.contentDocument : null;
7001 }
7002};
7003IFrameHelper.GetDocumentBody = function(name) {
7004 var doc = IFrameHelper.GetDocument(name);
7005 return (doc != null) ? doc.body : null;
7006};
7007IFrameHelper.GetDocumentHead = function (name) {
7008 var doc = IFrameHelper.GetDocument(name);
7009 return (doc != null) ? doc.head || doc.getElementsByTagName('head')[0] : null;
7010};
7011IFrameHelper.GetElement = function(name) {
7012 if(ASPx.Browser.IE)
7013  return window.frames[name].window.frameElement;
7014 else
7015  return document.getElementById(name);
7016};
7017var KbdHelper = ASPx.CreateClass(null, {
7018 constructor: function(control) {
7019  this.control = control;
7020 },
7021 Init: function() {
7022  KbdHelper.GlobalInit();
7023  var elements = this.getFocusableElements();
7024  for(var i = 0; i < elements.length; i++) {
7025   var element = elements[i];
7026   element.tabIndex = Math.max(element.tabIndex, 0);
7027   ASPx.Evt.AttachEventToElement(element, "click", function(e) { this.HandleClick(e); }.aspxBind(this));
7028   ASPx.Evt.AttachEventToElement(element, "focus", function(e) {    
7029    return this.onElementFocus(e);
7030   }.aspxBind(this));
7031   ASPx.Evt.AttachEventToElement(element, "blur", function () { this.onBlur(); }.aspxBind(this)); 
7032  }   
7033 },
7034 onElementFocus: function(e) {
7035  if(!this.CanFocus(e))
7036   return true;
7037  KbdHelper.active = this;
7038 },
7039 getFocusableElements: function() {
7040  return [this.GetFocusableElement()]; 
7041 },
7042 GetFocusableElement: function() { return this.control.GetMainElement(); },
7043 canHandleNoFocusAction: function() { 
7044  var focusableElements = this.getFocusableElements();
7045  for(var i = 0; i < focusableElements.length; i++) {
7046   if(focusableElements[i] === _aspxGetFocusedElement())
7047    return false;
7048  }
7049  return true;
7050 },
7051 RequirePreventScrollOnFocus: function() { return false; },
7052 CanFocus: function(e) {
7053  var tag = ASPx.Evt.GetEventSource(e).tagName;
7054  return !(tag === "A" || tag === "TEXTAREA" || tag === "INPUT" || tag === "SELECT" || tag === "IFRAME" || tag === "OBJECT");
7055 },
7056 HandleClick: function(e) {
7057  if(!this.CanFocus(e))
7058   return;
7059  this.Focus();
7060 },
7061 Focus: function() {
7062  var preventScroll = this.RequirePreventScrollOnFocus() && !ASPx.Browser.IE; 
7063  var savedDocumentScrollTop = preventScroll ? ASPx.GetDocumentScrollTop() : -1;
7064  try {
7065   this.GetFocusableElement().focus({ preventScroll: preventScroll });
7066  } catch(e) { }
7067  if(preventScroll && !this.IsNativePreventScrollOnFocusSupported() && savedDocumentScrollTop !== ASPx.GetDocumentScrollTop())
7068   ASPx.SetDocumentScrollTop(savedDocumentScrollTop);
7069 },
7070 IsNativePreventScrollOnFocusSupported: function() {
7071  if(this.isNativePreventScrollOnFocusSupported === undefined)
7072   this.isNativePreventScrollOnFocusSupported = this.CalcIsNativePreventScrollOnFocusSupported();
7073  return this.isNativePreventScrollOnFocusSupported;
7074 },
7075 CalcIsNativePreventScrollOnFocusSupported: function() {
7076  var result = false;
7077  try {
7078   ASPx.GetActiveElement().focus(Object.defineProperty({}, "preventScroll", { get: function() { result = true; } }));
7079  } catch(e) { result = false; }
7080  return result;
7081 },
7082 onBlur: function(){
7083  delete KbdHelper.active;
7084 },
7085 HandleKeyDown: function(e) { }, 
7086 HandleKeyPress: function(e) { }, 
7087 HandleKeyUp: function (e) { },
7088 HandleNoFocusAction: function(e) { },
7089 FocusByAccessKey: function () { }
7090});
7091KbdHelper.GlobalInit = function() {
7092 if(KbdHelper.ready)
7093  return;
7094 ASPx.Evt.AttachEventToDocument("keydown", KbdHelper.OnKeyDown);
7095 ASPx.Evt.AttachEventToDocument("keypress", KbdHelper.OnKeyPress);
7096 ASPx.Evt.AttachEventToDocument("keyup", KbdHelper.OnKeyUp);
7097 KbdHelper.ready = true; 
7098};
7099KbdHelper.swallowKey = false;
7100KbdHelper.accessKeys = { };
7101KbdHelper.ProcessKey = function(e, actionName) {
7102 if(!KbdHelper.active) 
7103  return;
7104 if (KbdHelper.active.canHandleNoFocusAction()) {
7105  KbdHelper.active["HandleNoFocusAction"](e, actionName);
7106  return;
7107 }
7108 var ctl = KbdHelper.active.control;
7109 if(ctl !== ASPx.GetControlCollection().Get(ctl.name)) {
7110  delete KbdHelper.active;
7111  return;
7112 }
7113 if(!KbdHelper.swallowKey) 
7114  KbdHelper.swallowKey = KbdHelper.active[actionName](e);
7115 if(KbdHelper.swallowKey)
7116  ASPx.Evt.PreventEvent(e);
7117};
7118KbdHelper.OnKeyDown = function(e) {
7119 KbdHelper.swallowKey = false;
7120 if(KbdHelper.TryAccessKey(KbdHelper.getKeyName(e)))
7121  ASPx.Evt.PreventEvent(e);
7122 else 
7123  KbdHelper.ProcessKey(e, "HandleKeyDown"); 
7124};
7125KbdHelper.OnKeyPress = function(e) { KbdHelper.ProcessKey(e, "HandleKeyPress"); };
7126KbdHelper.OnKeyUp = function(e) { KbdHelper.ProcessKey(e, "HandleKeyUp"); };
7127KbdHelper.RegisterAccessKey = function(obj) {
7128 var key;
7129 if(obj.accessKey)
7130  key = "CtrlShift" + obj.accessKey;
7131 else if(obj.keyTipModeShortcut)
7132  key = obj.keyTipModeShortcut;
7133 if(!key) return;
7134 KbdHelper.accessKeys[key.toLowerCase()] = obj.name;
7135};
7136KbdHelper.TryAccessKey = function(code) {
7137 var key = code.toLowerCase ? code.toLowerCase() : String.fromCharCode(code).toLowerCase();
7138 var name = KbdHelper.accessKeys[key];
7139 if(!name) return false;
7140 var obj = ASPx.GetControlCollection().Get(name);
7141 return KbdHelper.ClickAccessKey(obj);
7142};
7143KbdHelper.ClickAccessKey = function (control) {
7144 if (!control) return false;
7145 var el = control.GetMainElement();
7146 if (!el) return false;
7147 el.focus();
7148 setTimeout(function () {
7149  if (KbdHelper.active && KbdHelper.active.FocusByAccessKey)
7150   KbdHelper.active.FocusByAccessKey();
7151 }.aspxBind(this), 100);
7152 return true;
7153};
7154KbdHelper.getKeyName = function(e) {
7155 var name = "";
7156 if(e.altKey)
7157  name += "Alt";
7158 if(e.ctrlKey)
7159  name += "Ctrl";
7160 if(e.shiftKey)
7161  name += "Shift";
7162 var keyCode = e.key || e.code || String.fromCharCode(ASPx.Evt.GetKeyCode(e));
7163 if(keyCode.match(/key/i))
7164  name += keyCode.replace(/key/i, "");
7165 else if(keyCode.match(/digit/i))
7166  name += keyCode.replace(/digit/i, "");
7167 else if(keyCode.match(/arrow/i))
7168  name += keyCode.replace(/arrow/i, "");
7169 else if(keyCode.match(/ins/i))
7170  name += "Ins";
7171 else if(keyCode.match(/del/i))
7172  name += "Del";
7173 else if(keyCode.match(/back/i))
7174  name += "Back";
7175 else if(!keyCode.match(/alt/i) && !keyCode.match(/control/i) && !keyCode.match(/shift/i))
7176  name += keyCode;
7177 return name.replace(/^a-zA-Z0-9/, "");
7178};
7179AccessKeysHelper = ASPx.CreateClass(KbdHelper, {
7180 constructor: function (control) {
7181  this.constructor.prototype.constructor.call(this, control);
7182  this.accessKeysVisible = false;
7183  this.activeKey = null;
7184  this.accessKey = control.createAccessKey ? control.createAccessKey(control.accessKey) : new AccessKey(control.accessKey);
7185  this.accessKeys = this.accessKey.accessKeys;
7186  this.charIndex = 0;
7187  this.onFocusByAccessKey = null;
7188  this.onClose = null;
7189  this.manualStopProcessing = false;
7190  this.isActive = false;
7191  this.areAccessKeysShown = false;
7192 },
7193 Init: function (control) {
7194  KbdHelper.prototype.Init.call(this);
7195  KbdHelper.RegisterAccessKey(control);   
7196 },
7197 Add: function (accessKey) {
7198  this.accessKey.Add(accessKey);
7199 },
7200 HandleKeyDown: function (e) {
7201  var keyCode = ASPx.Evt.GetKeyCode(e);
7202  var stopProcessing = this.processKeyDown(keyCode);
7203  if (stopProcessing.value) {
7204   this.stopProcessing();
7205   if(this.onClosedOnEscape && (keyCode == ASPx.Key.Esc || stopProcessing.fireEvent))
7206    this.onClosedOnEscape();
7207  }
7208  return stopProcessing;
7209 },
7210 HandleNoFocusAction: function (e, actionName) {
7211  var keyCode = ASPx.Evt.GetKeyCode(e);
7212  if (this.onClosedOnEscape && keyCode == ASPx.Key.Esc && actionName == "HandleKeyDown")
7213   this.onClosedOnEscape();
7214 },
7215 Activate: function () {
7216  KbdHelper.ClickAccessKey(this.control);
7217  this.areAccessKeysShown = true;
7218 },
7219 Stop: function() {
7220  this.stopProcessing();
7221 },
7222 stopProcessing: function () {
7223  this.HideAccessKeys();
7224  if (KbdHelper.active && this.isActive) {
7225   this.isActive = false;
7226   KbdHelper.active.control.GetMainElement().blur();
7227   delete KbdHelper.active;
7228  }
7229 },
7230 onBlur: function() {
7231  if (this.manualStopProcessing) {
7232   this.manualStopProcessing = false;
7233   return;
7234  }
7235  this.HideAccessKeys();
7236  KbdHelper.prototype.onBlur.call(this);
7237 },
7238 processKeyDown: function (keyCode) {
7239  switch (keyCode) {
7240   case ASPx.Key.Left:
7241    this.TryMoveFocusLeft();
7242    return { value: false };
7243   case ASPx.Key.Right:
7244    this.TryMoveFocusRight();
7245    return { value: false };
7246   case ASPx.Key.Esc:
7247    if(this.control.hideAllPopups)
7248     this.control.hideAllPopups(true, true);
7249    if(this.activeKey)
7250     this.activeKey = this.activeKey.Return();
7251    this.charIndex = 0;
7252    if (!this.activeKey)
7253     return { value: true };
7254    break;
7255   case ASPx.Key.Enter:
7256    return { value: true };
7257   default:
7258    if (!ASPx.IsPrintableKey(keyCode))
7259     return { value: false };
7260    var char = String.fromCharCode(keyCode).toUpperCase();
7261    var needToContinue = { value: false };
7262    var keyResult;
7263    if(this.activeKey)
7264     keyResult = this.activeKey.TryAccessKey(char, this.charIndex, needToContinue);
7265    if (needToContinue.value) {
7266     this.charIndex++;
7267     return { value: false };
7268    }
7269    this.charIndex = 0;
7270    if(keyResult !== undefined)
7271     this.activeKey = keyResult;
7272    else
7273     return { value: true, fireEvent: true };
7274    if (!this.activeKey || !this.activeKey.accessKeys || this.activeKey.accessKeys.length == 0) {
7275     if (this.activeKey && this.activeKey.manualStopProcessing) {
7276      this.manualStopProcessing = true;
7277      break;
7278     }
7279     return { value: true, fireEvent: true };
7280    }
7281  }
7282  return { value: false };
7283 },
7284 TryMoveFocusLeft: function (modifier) {},
7285 TryMoveFocusRight: function (modifier) {},
7286 TryMoveFocusUp: function (modifier) {},
7287 TryMoveFocusDown: function (modifier) {},
7288 FocusByAccessKey: function() {
7289  if (this.onFocusByAccessKey)
7290   this.onFocusByAccessKey();
7291  this.HideAccessKeys();
7292  KbdHelper.prototype.FocusByAccessKey.call(this);
7293  this.activeKey = this.accessKey;
7294  this.activeKey.execute();
7295  this.isActive = true;
7296  this.areAccessKeysShown = true;
7297 },
7298 HideAccessKeys: function() {
7299  this.areAccessKeysShown = false;
7300  this.hideAccessKeys(this.accessKey);
7301 },
7302 Update: function() {
7303  this.throttleMethod(this.refresh, 100);
7304 },
7305 refresh: function() {
7306  if(this.activeKey && this.areAccessKeysShown) {
7307   this.activeKey.execute();
7308  }
7309 },
7310 throttleMethod: function(method, delay) {
7311  clearTimeout(method.timerId);
7312  method.timerId = setTimeout(function() {
7313   method.call(this);
7314  }.aspxBind(this), delay);
7315 },
7316 AreAccessKeysShown: function() {
7317  return this.areAccessKeysShown;
7318 },
7319 hideAccessKeys: function (accessKey) {
7320  for (var i = 0, ak; ak = accessKey.accessKeys[i]; i++) {
7321   this.hideAccessKeys(ak);
7322  }
7323  if (accessKey)
7324   accessKey.hide();
7325 },
7326 HandleClick: function(e) {
7327  KbdHelper.prototype.HandleClick.call(this, e);
7328  this.stopProcessing();
7329 }
7330});
7331AccessKey = ASPx.CreateClass(null, {
7332 constructor: function (popupItem, getPopupElement, keyTipElement, key, onlyClick, manualStopProcessing) {
7333  this.key = key ? key : keyTipElement ? ASPxClientUtils.Trim(ASPx.GetInnerText(keyTipElement)) : null;
7334  this.popupItem = popupItem;
7335  this.getPopupElement = getPopupElement;
7336  this.keyTipElement = keyTipElement;
7337  this.accessKeys = [];
7338  this.needShowChilds = true;
7339  this.parent = null;
7340  this.onlyClick = onlyClick;
7341  this.manualStopProcessing = manualStopProcessing;
7342 },
7343 Add: function (accessKey) {
7344  this.accessKeys.push(accessKey);
7345  accessKey.parent = this;
7346 },
7347 TryAccessKey: function (char, index, needToContinue) {
7348  if (!this.accessKeys || this.accessKeys.length == 0)
7349   return;
7350  for (var i = 0, accessKey; accessKey = this.accessKeys[i]; i++) {
7351   if (accessKey.key[index] == char && accessKey.isVisible()) {
7352    if (accessKey.key[index + 1]) {
7353     needToContinue.value = true;
7354    }
7355    else {
7356     accessKey.execute();
7357     return accessKey;
7358    }
7359   } else {
7360    accessKey.hide();
7361   }
7362  }
7363  for (var i = 0, accessKey; accessKey = this.accessKeys[i]; i++) {
7364   var key = accessKey.TryAccessKey(char, index, needToContinue);
7365   if (key)
7366    return key;
7367  }
7368  return;
7369 },
7370 isVisible: function(){
7371  return ASPx.GetElementVisibility(this.keyTipElement);
7372 },
7373 Return: function () {
7374  this.hideChildAccessKeys();
7375  if (this.parent) {
7376   this.parent.showAccessKeys(true);
7377  }  
7378  return this.parent;
7379 },
7380 execute: function () {
7381  this.hideAll();
7382  if (this.popupItem && this.popupItem.accessKeyClick && !this.onlyClick)
7383   this.popupItem.accessKeyClick();
7384  if (this.getPopupElement && this.onlyClick)
7385   ASPx.Evt.EmulateMouseClick(this.getPopupElement(this.popupItem));
7386  if (this.accessKeys)
7387   setTimeout(function () {
7388    this.showAccessKeys(true);
7389   }.aspxBind(this), 100);
7390 },
7391 showAccessKeys: function(directShow) {
7392  if (!directShow && !this.needShowChilds)
7393   return;
7394  for (var i = 0; i < this.accessKeys.length; i++) {
7395   var accessKey = this.accessKeys[i];
7396   if (accessKey) {
7397    var popupElement = accessKey.getPopupElement ? accessKey.getPopupElement(accessKey.popupItem) : null;
7398    if (popupElement && this.isElementVisible(popupElement)) {
7399     this.show(accessKey);
7400    }
7401    accessKey.showAccessKeys();
7402   }
7403  }
7404 },
7405 isElementVisible: function (el) { return ASPx.IsElementVisible(el, true); },
7406 show: function(accessKey) {
7407  var keyTipElement = accessKey.keyTipElement;
7408  var popupElement = accessKey.getPopupElement(accessKey.popupItem);
7409  this.showKeyTipElement(keyTipElement, this.calculateCoordinates(accessKey, keyTipElement, popupElement));
7410 },
7411 showKeyTipElement: function (keyTipElement, coordinates) {
7412  ASPx.SetAbsoluteY(keyTipElement, coordinates.top);
7413  ASPx.SetAbsoluteX(keyTipElement, coordinates.left);
7414  ASPx.SetElementVisibility(keyTipElement, true); 
7415 },
7416 calculateCoordinates: function (accessKey, keyTipElement, popupElement) {
7417  var top = ASPx.GetAbsolutePositionY(popupElement);
7418  var left = ASPx.GetAbsolutePositionX(popupElement);
7419  if (accessKey.popupItem.getAccessKeyPosition)
7420   switch (accessKey.popupItem.getAccessKeyPosition()) {
7421    case "AboveRight":
7422     left = left + popupElement.offsetWidth - keyTipElement.offsetWidth / 3;
7423     top = top - keyTipElement.offsetHeight / 2;
7424     break;
7425    case "Right":
7426     left = left + popupElement.offsetWidth - keyTipElement.offsetWidth / 3;
7427     top = top + popupElement.offsetHeight / 2 - keyTipElement.offsetHeight / 2;
7428     break;
7429    case "BelowRight":
7430     left = left + popupElement.offsetWidth - keyTipElement.offsetWidth / 3;
7431     top = top + keyTipElement.offsetHeight / 2;
7432     break;
7433    default:
7434     top = top + popupElement.offsetHeight;
7435     left = left + popupElement.offsetWidth / 2 - keyTipElement.offsetWidth / 2;
7436     break;
7437   }
7438  else {
7439   top = top + popupElement.offsetHeight;
7440   left = left + popupElement.offsetWidth / 2 - keyTipElement.offsetWidth / 2;
7441  }
7442  return { top: top, left: left };
7443 },
7444 hide: function() {
7445  if (this.keyTipElement)
7446   ASPx.SetElementVisibility(this.keyTipElement, false);
7447 },
7448 hideChildAccessKeys: function () {
7449  this.hideAccessKeys(this.accessKeys);
7450 },
7451 hideAccessKeys: function (accessKeys) {
7452  if (accessKeys) {
7453   for (var i = 0, accessKey; accessKey = accessKeys[i]; i++) {
7454    if (accessKey.keyTipElement)
7455     accessKey.hide();
7456    accessKey.hideChildAccessKeys();
7457   }
7458  }
7459 },
7460 hideAll: function () {
7461  this.getRoot(this).hideChildAccessKeys();
7462 },
7463 getRoot: function (accessKey) {
7464  if (!accessKey.parent)
7465   return accessKey;
7466  return this.getRoot(accessKey.parent);
7467 }
7468});
7469var focusedElement = null;
7470function aspxOnElementFocused(evt) {
7471 evt = ASPx.Evt.GetEvent(evt);
7472 if(evt && evt.target)
7473  focusedElement = evt.target;
7474}
7475function _aspxInitializeFocus() {
7476 if(!ASPx.GetActiveElement())
7477  ASPx.Evt.AttachEventToDocument("focus", aspxOnElementFocused);
7478}
7479function _aspxGetFocusedElement() {
7480 var activeElement = ASPx.GetActiveElement();
7481 return activeElement ? activeElement : focusedElement;
7482}
7483CheckBoxCheckState = {
7484 Checked : "Checked",
7485 Unchecked : "Unchecked",
7486 Indeterminate : "Indeterminate"
7487};
7488CheckBoxInputKey = { 
7489 Checked : "C",
7490 Unchecked : "U",
7491 Indeterminate : "I"
7492};
7493var CheckableElementStateController = ASPx.CreateClass(null, {
7494 constructor: function(imageProperties) {
7495  this.checkBoxStates = [];
7496  this.imageProperties = imageProperties;
7497  this.customImageMarkerClassName = "dxcbCI";
7498 },
7499 GetValueByInputKey: function(inputKey) {
7500  return this.GetFirstValueBySecondValue("Value", "StateInputKey", inputKey);
7501 },
7502 GetInputKeyByValue: function(value) {
7503  return this.GetFirstValueBySecondValue("StateInputKey", "Value", value);
7504 },
7505 GetImagePropertiesNumByInputKey: function(value) {
7506  return this.GetFirstValueBySecondValue("ImagePropertiesNumber", "StateInputKey", value);
7507 },
7508 GetNextCheckBoxValue: function(currentValue, allowGrayed) {
7509  var currentInputKey = this.GetInputKeyByValue(currentValue);
7510  var nextInputKey = '';
7511  switch(currentInputKey) {
7512   case CheckBoxInputKey.Checked:
7513    nextInputKey = CheckBoxInputKey.Unchecked; break;
7514   case CheckBoxInputKey.Unchecked:
7515    nextInputKey = allowGrayed ? CheckBoxInputKey.Indeterminate : CheckBoxInputKey.Checked; break;
7516   case CheckBoxInputKey.Indeterminate:
7517    nextInputKey = CheckBoxInputKey.Checked; break;
7518  }
7519  return this.GetValueByInputKey(nextInputKey);
7520 },
7521 GetCheckStateByInputKey: function(inputKey) {
7522  switch(inputKey) {
7523   case CheckBoxInputKey.Checked: 
7524    return CheckBoxCheckState.Checked;
7525   case CheckBoxInputKey.Unchecked: 
7526    return CheckBoxCheckState.Unchecked;
7527   case CheckBoxInputKey.Indeterminate: 
7528    return CheckBoxCheckState.Indeterminate;
7529  }
7530 },
7531 GetValueByCheckState: function(checkState) {
7532  switch(checkState) {
7533   case CheckBoxCheckState.Checked: 
7534    return this.GetValueByInputKey(CheckBoxInputKey.Checked);
7535   case CheckBoxCheckState.Unchecked: 
7536    return this.GetValueByInputKey(CheckBoxInputKey.Unchecked);
7537   case CheckBoxCheckState.Indeterminate: 
7538    return this.GetValueByInputKey(CheckBoxInputKey.Indeterminate);
7539  }
7540 },
7541 GetFirstValueBySecondValue: function(firstValueName, secondValueName, secondValue) {
7542  return this.GetValueByFunc(firstValueName, 
7543   function(checkBoxState) { return checkBoxState[secondValueName] === secondValue; });
7544 },
7545 GetValueByFunc: function(valueName, func) {
7546  for(var i = 0; i < this.checkBoxStates.length; i++) {
7547   if(func(this.checkBoxStates[i]))
7548    return this.checkBoxStates[i][valueName];
7549  }  
7550 },
7551 AssignElementClassName: function(element, cssClassPropertyKey, disabledCssClassPropertyKey, assignedClassName) {
7552  var classNames = [ ];
7553  for(var i = 0; i < this.imageProperties[cssClassPropertyKey].length; i++) {
7554   classNames.push(this.imageProperties[disabledCssClassPropertyKey][i]);
7555   classNames.push(this.imageProperties[cssClassPropertyKey][i]);
7556  }
7557  var elementClassName = element.className;
7558  for(var i = 0; i < classNames.length; i++) {
7559   var className = classNames[i];
7560   var index = elementClassName.indexOf(className);
7561   if(index > -1)
7562    elementClassName = elementClassName.replace((index == 0 ? '' : ' ') + className, "");
7563  }
7564  elementClassName += " " + assignedClassName;
7565  element.className = elementClassName;
7566 },
7567 UpdateInternalCheckBoxDecoration: function(mainElement, inputKey, enabled) {
7568  var imagePropertiesNumber = this.GetImagePropertiesNumByInputKey(inputKey);
7569  for(var imagePropertyKey in this.imageProperties) {
7570   if(this.imageProperties.hasOwnProperty(imagePropertyKey)) {
7571    var propertyValue = this.imageProperties[imagePropertyKey][imagePropertiesNumber];
7572    propertyValue = propertyValue || !isNaN(propertyValue) ? propertyValue : "";
7573    switch(imagePropertyKey) {
7574     case "0" : mainElement.title = propertyValue; break;
7575     case "1" : mainElement.style.width = propertyValue + (propertyValue != "" ? "px" : ""); break;
7576     case "2" : mainElement.style.height = propertyValue + (propertyValue != "" ? "px" : ""); break;
7577    }
7578    if(enabled) {
7579     switch(imagePropertyKey) {
7580      case "3" : this.SetImageSrc(mainElement, propertyValue); break;
7581      case "4" : 
7582       this.AssignElementClassName(mainElement, "4", "8", propertyValue);
7583       break;
7584      case "5" : this.SetBackgroundPosition(mainElement, propertyValue, true); break;
7585      case "6" : this.SetBackgroundPosition(mainElement, propertyValue, false); break;
7586     }
7587    } else {
7588     switch(imagePropertyKey) {
7589      case "7" : this.SetImageSrc(mainElement, propertyValue); break;
7590      case "8" : 
7591       this.AssignElementClassName(mainElement, "4", "8", propertyValue);
7592       break;
7593      case "9" : this.SetBackgroundPosition(mainElement, propertyValue, true); break;
7594      case "10" : this.SetBackgroundPosition(mainElement, propertyValue, false); break;
7595     }
7596    }
7597   }
7598  }
7599 },
7600 SetImageSrc: function(mainElement, src) {
7601  if(src === ""){
7602   mainElement.style.backgroundImage = "";
7603   mainElement.style.backgroundPosition = "";
7604   ASPx.RemoveClassNameFromElement(mainElement, this.customImageMarkerClassName);
7605  }
7606  else{
7607   mainElement.style.backgroundImage = "url('" + src + "')";
7608   this.SetBackgroundPosition(mainElement, 0, true);
7609   this.SetBackgroundPosition(mainElement, 0, false);
7610   ASPx.AddClassNameToElement(mainElement, this.customImageMarkerClassName);
7611  }
7612 },
7613 SetBackgroundPosition: function(element, value, isX) {
7614  if(value === "") {
7615   element.style.backgroundPosition = value;
7616   return;
7617  }
7618  if(element.style.backgroundPosition === "")
7619   element.style.backgroundPosition = isX ? "-" + value.toString() + "px 0px" : "0px -" + value.toString() + "px";
7620  else {
7621   var position = element.style.backgroundPosition.split(' ');
7622   element.style.backgroundPosition = isX ? '-' + value.toString() + "px " + position[1] :  position[0] + " -" + value.toString() + "px";
7623  }
7624 },
7625 AddState: function(value, stateInputKey, imagePropertiesNumber) {
7626  this.checkBoxStates.push({
7627   "Value" : value, 
7628   "StateInputKey" : stateInputKey, 
7629   "ImagePropertiesNumber" : imagePropertiesNumber
7630  });
7631 },
7632 GetAriaCheckedValue: function(state) {
7633  switch(state) {
7634   case ASPx.CheckBoxCheckState.Checked: return "true";
7635   case ASPx.CheckBoxCheckState.Unchecked: return "false";
7636   case ASPx.CheckBoxCheckState.Indeterminate: return "mixed";
7637   default: return "";
7638  }
7639 },
7640 GetAriaSelectedValue: function(state) {
7641  switch(state) {
7642   case ASPx.CheckBoxCheckState.Checked: return "true";
7643   case ASPx.CheckBoxCheckState.Unchecked: return "false";
7644   case ASPx.CheckBoxCheckState.Indeterminate: return "undefined";
7645   default: return "";
7646  }
7647 },
7648 SetAriaCheckedSelectedAttributes: function(mainElement, state) {
7649  if(mainElement.attributes["aria-checked"] !== undefined) {
7650   var ariaCheckedValue = this.GetAriaCheckedValue(state);
7651   mainElement.setAttribute("aria-checked", ariaCheckedValue);
7652  }
7653  if(mainElement.attributes["aria-selected"] !== undefined) {
7654   var ariaSelectedValue = this.GetAriaSelectedValue(state);
7655   mainElement.setAttribute("aria-selected", ariaSelectedValue);
7656  }
7657 }
7658});
7659CheckableElementStateController.Create = function(imageProperties, valueChecked, valueUnchecked, valueGrayed, allowGrayed) {
7660 var stateController = new CheckableElementStateController(imageProperties);
7661 stateController.AddState(valueChecked, CheckBoxInputKey.Checked, 0);
7662 stateController.AddState(valueUnchecked, CheckBoxInputKey.Unchecked, 1);
7663 if(typeof(valueGrayed) != "undefined")
7664  stateController.AddState(valueGrayed, CheckBoxInputKey.Indeterminate, allowGrayed ? 2 : 1);
7665 stateController.allowGrayed = allowGrayed;
7666 return stateController;
7667};
7668var CheckableElementHelper = ASPx.CreateClass(null, {
7669 InternalCheckBoxInitialize: function(internalCheckBox) {
7670  this.AttachToMainElement(internalCheckBox);
7671  this.AttachToInputElement(internalCheckBox);
7672 },
7673 AttachToMainElement: function(internalCheckBox) {
7674  var instance = this;
7675  if(internalCheckBox.mainElement) {
7676    var toggleEvent = internalCheckBox.displaySwitch ? ASPx.TouchUIHelper.touchMouseDownEventName : "click";
7677    ASPx.Evt.AttachEventToElement(internalCheckBox.mainElement, toggleEvent,
7678    function (evt) {
7679     if(ASPx.Evt.IsRightButtonPressed(evt))
7680      return;
7681     instance.InvokeClick(internalCheckBox, evt);
7682     if(!internalCheckBox.disableCancelBubble)
7683      return ASPx.Evt.PreventEventAndBubble(evt);
7684    }
7685   );
7686   ASPx.Evt.AttachEventToElement(internalCheckBox.mainElement, "mousedown",
7687    function (evt) {
7688     internalCheckBox.Refocus();
7689    }
7690   );
7691   ASPx.Evt.PreventElementDragAndSelect(internalCheckBox.mainElement, true);
7692  }
7693 },
7694 AttachToInputElement: function(internalCheckBox) {
7695  var instance = this;
7696  if(internalCheckBox.inputElement && internalCheckBox.mainElement) {
7697   var checkableElement = internalCheckBox.accessibilityCompliant ? internalCheckBox.mainElement : internalCheckBox.inputElement;
7698   ASPx.Evt.AttachEventToElement(checkableElement, "focus",
7699    function (evt) { 
7700     if(!internalCheckBox.enabled)
7701      checkableElement.blur();
7702     else
7703      internalCheckBox.OnFocus();
7704    }
7705   );
7706   ASPx.Evt.AttachEventToElement(checkableElement, "blur", 
7707    function (evt) { 
7708     internalCheckBox.OnLostFocus();
7709    }
7710   );
7711   ASPx.Evt.AttachEventToElement(checkableElement, "keyup",
7712    function (evt) { 
7713     if(ASPx.Evt.GetKeyCode(evt) == ASPx.Key.Space)
7714      instance.InvokeClick(internalCheckBox, evt);
7715    }
7716   );
7717   ASPx.Evt.AttachEventToElement(checkableElement, "keydown",
7718    function (evt) { 
7719     if(ASPx.Evt.GetKeyCode(evt) == ASPx.Key.Space)
7720      return ASPx.Evt.PreventEvent(evt);
7721    }
7722   );
7723  }
7724 },
7725 IsKBSInputWrapperExist: function() {
7726  return ASPx.Browser.Opera || ASPx.Browser.WebKitFamily;
7727 },
7728 GetICBMainElementByInput: function(icbInputElement) {
7729  return this.IsKBSInputWrapperExist() ? icbInputElement.parentNode.parentNode : icbInputElement.parentNode;
7730 },
7731 RequirePreventFocus: function() { return false; },
7732 InvokeClick: function(internalCheckBox, evt) {
7733  if(internalCheckBox.enabled && !internalCheckBox.GetReadOnly()) {
7734   var inputElementValue = internalCheckBox.inputElement.value;
7735   var focusableElement = internalCheckBox.accessibilityCompliant ? internalCheckBox.mainElement : internalCheckBox.inputElement; 
7736   if(!this.RequirePreventFocus())
7737    focusableElement.focus();
7738   if(!ASPx.Browser.IE) 
7739    internalCheckBox.inputElement.value = inputElementValue;
7740   this.InvokeClickCore(internalCheckBox, evt);
7741   }
7742 },
7743 InvokeClickCore: function(internalCheckBox, evt) {
7744  internalCheckBox.OnClick(evt);
7745 }
7746});
7747CheckableElementHelper.Instance = new CheckableElementHelper();
7748var CheckBoxInternal = ASPx.CreateClass(null, {
7749 constructor: function(inputElement, stateController, allowGrayed, allowGrayedByClick, helper, container, storeValueInInput, key, disableCancelBubble,
7750  accessibilityCompliant, displaySwitch) {
7751  this.inputElement = inputElement;
7752  this.mainElement = helper.GetICBMainElementByInput(this.inputElement);
7753  this.name = (key ? key : this.inputElement.id) + CheckBoxInternal.GetICBMainElementPostfix();
7754  this.mainElement.id = this.name;
7755  this.stateController = stateController;
7756  this.container = container;
7757  this.allowGrayed = allowGrayed;
7758  this.allowGrayedByClick = allowGrayedByClick;
7759  this.autoSwitchEnabled = true;
7760  this.displaySwitch = displaySwitch;
7761  this.storeValueInInput = !!storeValueInInput;
7762  this.storedInputKey = !this.storeValueInInput ? this.inputElement.value : null;
7763  this.disableCancelBubble = !!disableCancelBubble;
7764  this.accessibilityCompliant = accessibilityCompliant;
7765  this.focusDecoration = null;
7766  this.focused = false;
7767  this.focusLocked = false;
7768  this.enabled = !this.mainElement.className.match(/dxWeb_\w+Disabled(\b|_)/);
7769  this.readOnly = false;
7770  this.preventFocus = helper.RequirePreventFocus();
7771  this.CheckedChanged = new ASPxClientEvent();
7772  this.Focus = new ASPxClientEvent();
7773  this.LostFocus = new ASPxClientEvent();
7774  helper.InternalCheckBoxInitialize(this);
7775 },
7776 GetReadOnly: function() {
7777  return this.readOnly;
7778 },
7779 ChangeInputElementTabIndex: function() {  
7780  var changeMethod = this.enabled ? ASPx.Attr.RestoreTabIndexAttribute : ASPx.Attr.SaveTabIndexAttributeAndReset;
7781  changeMethod(this.inputElement);
7782 },
7783 CreateFocusDecoration: function(focusedStyle) {
7784   this.focusDecoration = new FocusedStyleDecoration(this);
7785   this.focusDecoration.AddStyle('F', focusedStyle[0], focusedStyle[1]);
7786   this.focusDecoration.AddPostfix("");
7787 },
7788 UpdateFocusDecoration: function() {
7789  this.focusDecoration.Update();
7790 },  
7791 StoreInputKey: function(inputKey) {
7792  if(this.storeValueInInput)
7793   this.inputElement.value = inputKey;
7794  else
7795   this.storedInputKey = inputKey;
7796 },
7797 GetStoredInputKey: function() {
7798  if(this.storeValueInInput)
7799   return this.inputElement.value;
7800  else
7801   return this.storedInputKey;
7802 },
7803 OnClick: function(e) {
7804  if(this.autoSwitchEnabled) {
7805   var currentValue = this.GetValue();
7806   var value = this.stateController.GetNextCheckBoxValue(currentValue, this.allowGrayedByClick && this.allowGrayed);
7807   this.SetValue(value);
7808  }
7809  this.CheckedChanged.FireEvent(this, e);
7810 },
7811 OnFocus: function() {
7812  if(!this.IsFocusLocked()) {
7813   this.focused = true;
7814   this.UpdateFocusDecoration();
7815   this.Focus.FireEvent(this, null);
7816  } else
7817   this.UnlockFocus();
7818 },
7819 OnLostFocus: function() {
7820  if(!this.IsFocusLocked()) {
7821   this.focused = false;
7822   this.UpdateFocusDecoration();
7823   this.LostFocus.FireEvent(this, null);
7824  }
7825 },
7826 Refocus: function() {
7827  if(this.preventFocus) return;
7828  if(this.focused) {
7829   this.LockFocus();
7830   this.inputElement.blur();
7831   if(ASPx.Browser.MacOSMobilePlatform) {
7832    window.setTimeout(function() {
7833     ASPx.SetFocus(this.inputElement);
7834    }, 100);
7835   } else {
7836    ASPx.SetFocus(this.inputElement);
7837   }
7838  }
7839 },
7840 LockFocus: function() {
7841  this.focusLocked = true;
7842 },
7843 UnlockFocus: function() {
7844  this.focusLocked = false;
7845 },
7846 IsFocusLocked: function() {
7847  if(!!ASPx.Attr.GetAttribute(this.mainElement, ASPx.Attr.GetTabIndexAttributeName()))
7848   return false;
7849  return this.focusLocked;
7850 },
7851 SetValue: function(value, force) {
7852  var currentValue = this.GetValue();
7853  if(currentValue !== value || force) {
7854   var newInputKey = this.stateController.GetInputKeyByValue(value);
7855   if(newInputKey) {
7856    this.StoreInputKey(newInputKey);   
7857    this.stateController.UpdateInternalCheckBoxDecoration(this.mainElement, newInputKey, this.enabled);
7858   }
7859  }
7860  if(this.accessibilityCompliant) {
7861   var state = this.GetCurrentCheckState();
7862   this.stateController.SetAriaCheckedSelectedAttributes(this.mainElement, state);
7863  }
7864 },
7865 GetValue: function() {
7866  return this.stateController.GetValueByInputKey(this.GetCurrentInputKey());
7867 },
7868 GetCurrentCheckState: function() {
7869  return this.stateController.GetCheckStateByInputKey(this.GetCurrentInputKey());
7870 },
7871 GetCurrentInputKey: function() {
7872  return this.GetStoredInputKey();
7873 },
7874 GetChecked: function() {
7875  return this.GetCurrentInputKey() === CheckBoxInputKey.Checked;
7876 },
7877 SetChecked: function(checked) {
7878  var newValue = this.stateController.GetValueByCheckState(checked ? CheckBoxCheckState.Checked : CheckBoxCheckState.Unchecked);
7879  this.SetValue(newValue);
7880 },
7881 SetEnabled: function(enabled) {
7882  if(this.enabled != enabled) {
7883   this.enabled = enabled;
7884   this.stateController.UpdateInternalCheckBoxDecoration(this.mainElement, this.GetCurrentInputKey(), this.enabled);
7885   this.ChangeInputElementTabIndex();
7886  }
7887 },
7888 GetEnabled: function() {
7889  return this.enabled;
7890 }
7891});
7892CheckBoxInternal.GetICBMainElementPostfix = function() {
7893 return "_D";
7894};
7895var CheckBoxInternalCollection = ASPx.CreateClass(CollectionBase, {
7896 constructor: function(imageProperties, allowGrayed, storeValueInInput, helper, disableCancelBubble, accessibilityCompliant) {
7897  this.constructor.prototype.constructor.call(this);
7898  this.stateController = allowGrayed 
7899   ? CheckableElementStateController.Create(imageProperties, CheckBoxInputKey.Checked, CheckBoxInputKey.Unchecked, CheckBoxInputKey.Indeterminate, true)
7900   : CheckableElementStateController.Create(imageProperties, CheckBoxInputKey.Checked, CheckBoxInputKey.Unchecked);
7901  this.helper = helper || CheckableElementHelper.Instance;
7902  this.storeValueInInput = !!storeValueInInput;
7903  this.disableCancelBubble = !!disableCancelBubble;
7904  this.accessibilityCompliant = accessibilityCompliant;
7905 },
7906 Add: function(key, inputElement, container) {
7907  this.Remove(key);
7908  var checkBox = this.CreateInternalCheckBox(key, inputElement, container);
7909  CollectionBase.prototype.Add.call(this, key, checkBox);
7910  return checkBox;
7911 },
7912 SetImageProperties: function(imageProperties) {
7913  this.stateController.imageProperties = imageProperties;
7914 },
7915 CreateInternalCheckBox: function(key, inputElement, container) {
7916  return new CheckBoxInternal(inputElement, this.stateController, this.stateController.allowGrayed, false, this.helper, container, 
7917   this.storeValueInInput, key, this.disableCancelBubble, this.accessibilityCompliant);
7918 }
7919});
7920var FocusedStyleDecoration = ASPx.CreateClass(null, {
7921 constructor: function(editor) {
7922  this.editor = editor;
7923  this.postfixList = [];
7924  this.styles = {};
7925  this.innerStyles = {};
7926 },
7927 AddPostfix: function(value) {
7928  this.postfixList.push(value);
7929 },
7930 AddStyle: function(key, className, cssText) {
7931  this.styles[key] = this.CreateRule(className, cssText);
7932  this.innerStyles[key] = this.CreateRule("", this.FilterInnerCss(cssText));
7933 },
7934 CreateRule: function(className, cssText) {
7935  return ASPx.Str.Trim(className + " " + ASPx.CreateImportantStyleRule(this.GetStyleSheet(), cssText));
7936 },
7937 GetStyleSheet: function() {
7938  return ASPx.GetCurrentStyleSheet();
7939 },
7940 FilterInnerCss: function(css) {
7941  return css.replace(/(border|background-image)[^:]*:[^;]+/gi, "");
7942 },
7943 Update: function() {
7944  for(var i = 0; i < this.postfixList.length; i++) {
7945   var postfix = this.postfixList[i];
7946   var inner = postfix.length > 0;
7947   var element = this.GetElementByPostfix(postfix);
7948   if(element)
7949    this.ApplyStyles(element, inner);
7950  }
7951 },
7952 GetElementByPostfix: function(postfix) {
7953  return ASPx.GetElementById(this.editor.name + postfix);
7954 },
7955 ApplyStyles: function(element, inner) {
7956  this.ApplyFocusedStyle(element, inner);
7957 },
7958 ApplyFocusedStyle: function(element, inner) {
7959  if(this.HasDecoration("F"))
7960   this.ApplyDecoration("F", element, inner, this.editor.focused);
7961 },
7962 HasDecoration: function(key) {
7963  return !!this.styles[key];
7964 },
7965 ApplyDecoration: function(key, element, inner, active) {
7966  var value = inner ? this.innerStyles[key] : this.styles[key];
7967  this.RemoveDecoration(element, value);
7968  if(active) {
7969   ASPx.AddClassNameToElement(element, value);
7970   if(ASPx.Browser.IE && ASPx.Browser.Version > 10 && element.border != null) 
7971    this.EnsureElementBorder(element);
7972  }
7973 },
7974 RemoveDecoration: function(element, value) {
7975  ASPx.RemoveClassNameFromElement(element, value);
7976  if(ASPx.Browser.IE && ASPx.Browser.MajorVersion >= 11)
7977   var dummy = element.offsetWidth; 
7978 },
7979 ApplyDecorationCore: function() {
7980 },
7981 EnsureElementBorder: function(element) {
7982  var border = parseInt(element.border) || 0;
7983  element.border = 1;
7984  element.border = border;
7985 }
7986});
7987var EditorStyleDecoration = ASPx.CreateClass(FocusedStyleDecoration, {
7988 constructor: function(editor) {
7989  this.constructor.prototype.constructor.call(this, editor);
7990  this.lockUpdate = false;
7991 },
7992 LockUpdate: function() {
7993  this.lockUpdate = true;
7994 },
7995 UnlockUpdate: function() {
7996  this.lockUpdate = false;
7997 },
7998 IsUpdateLocked: function() {
7999  return this.lockUpdate;
8000 },
8001 Update: function () {
8002  if(this.IsUpdateLocked())
8003   return;
8004  ASPx.FocusedStyleDecoration.prototype.Update.call(this);
8005 },
8006 ApplyStyles: function (element, inner) {
8007  this.ApplyInvalidStyle(element, inner);
8008  ASPx.FocusedStyleDecoration.prototype.ApplyStyles.call(this, element, inner);
8009 },
8010 ApplyInvalidStyle: function (element, inner) {
8011  if(this.HasDecoration("I")) {
8012   var isValid = this.editor.GetIsValid();
8013   this.ApplyDecoration("I", element, inner, !isValid);
8014  }
8015 }
8016});
8017var TextEditorStyleDecoration = ASPx.CreateClass(EditorStyleDecoration, {
8018 constructor: function(editor) {
8019  this.constructor.prototype.constructor.call(this, editor);
8020  this.nullTextClassName = "";
8021 },
8022 ApplyStyles: function(element, inner) {
8023  ASPx.EditorStyleDecoration.prototype.ApplyStyles.call(this, element, inner);
8024  this.ApplyNullTextStyle(element, inner);
8025 },
8026 ApplyNullTextStyle: function(element, inner) {
8027  if(!this.HasDecoration("N"))
8028   return;
8029  var apply = !this.editor.focused && this.editor.CanApplyNullTextDecoration();
8030  this.EnsureSpellcheckAttribute(element, apply);
8031  this.ApplyDecoration("N", element, inner, apply);
8032 },
8033 EnsureSpellcheckAttribute: function(element, apply) {
8034  if(apply)
8035   ASPx.Attr.ChangeAttribute(element, "spellcheck", "false");
8036  else
8037   ASPx.Attr.RestoreAttribute(element, "spellcheck");
8038 },
8039 ApplyNullTextClassName: function(active) {
8040  var nullTextClassName = this.GetNullTextClassName();
8041  var editorMainElement = this.editor.GetMainElement();
8042  if(active)
8043   ASPx.AddClassNameToElement(editorMainElement, nullTextClassName);
8044  else
8045   ASPx.RemoveClassNameFromElement(editorMainElement, nullTextClassName);
8046 },
8047 GetNullTextClassName: function() {
8048  if (!this.nullTextClassName)
8049   this.InitializeNullTextClassName();
8050  return this.nullTextClassName;
8051 },
8052 InitializeNullTextClassName: function() {
8053  var nullTextStyle = this.styles["N"];
8054  if (nullTextStyle) {
8055   var nullTextStyleClassNames = nullTextStyle.split(" ");
8056   for (var i = 0; i < nullTextStyleClassNames.length; i++)
8057    if (nullTextStyleClassNames[i].match("dxeNullText"))
8058     this.nullTextClassName = nullTextStyleClassNames[i];
8059  }
8060 }
8061});
8062var TouchUIHelper = {
8063 isGesture: false,
8064 isMouseEventFromScrolling: false,
8065 isNativeScrollingAllowed: true,
8066 clickSensetivity: 10,
8067 documentTouchHandlers: {},
8068 documentEventAttachingAllowed: true,
8069 msTouchDraggableClassName: "dxMSTouchDraggable",
8070 touchMouseDownEventName: ASPx.Browser.WebKitTouchUI ? "touchstart" : (ASPx.Browser.Edge && ASPx.Browser.MSTouchUI && window.PointerEvent ? "pointerdown" : "mousedown"),
8071 touchMouseUpEventName:   ASPx.Browser.WebKitTouchUI ? "touchend"   : (ASPx.Browser.Edge && ASPx.Browser.MSTouchUI && window.PointerEvent ? "pointerup" : "mouseup"),
8072 touchMouseMoveEventName: ASPx.Browser.WebKitTouchUI ? "touchmove"  : (ASPx.Browser.Edge && ASPx.Browser.MSTouchUI && window.PointerEvent ? "pointermove" : "mousemove"),
8073 isTouchEvent: function(evt) {
8074  if(!evt) return false;
8075  return ASPx.Browser.WebKitTouchUI && ASPx.IsExists(evt.changedTouches); 
8076 },
8077 isTouchEventName: function(eventName) {
8078  return ASPx.Browser.WebKitTouchUI && (eventName.indexOf("touch") > -1 || eventName.indexOf("gesture") > -1);
8079 },
8080 getEventX: function(evt) {
8081  if(ASPx.Browser.IE)
8082   return evt.pageX;
8083  var touchPoint = null;
8084  if(evt.changedTouches.length > 0)
8085   touchPoint = evt.changedTouches;
8086  else if(evt.targetTouches.length > 0)
8087   touchPoint = evt.targetTouches;
8088  return touchPoint ? touchPoint[0].pageX : 0;
8089 },
8090 getEventY: function(evt) { 
8091  if(ASPx.Browser.IE)
8092   return evt.pageY;
8093  var touchPoint = null;
8094  if(evt.changedTouches.length > 0)
8095   touchPoint = evt.changedTouches;
8096  else if(evt.targetTouches.length > 0)
8097   touchPoint = evt.targetTouches;
8098  return touchPoint ? touchPoint[0].pageY : 0;
8099 },
8100 getWebkitMajorVersion: function(){
8101  if(!this.webkitMajorVersion){
8102   var regExp = new RegExp("applewebkit/(\\d+)", "i");
8103   var matches = regExp.exec(ASPx.Browser.UserAgent);
8104   if(matches && matches.index >= 1)
8105    this.webkitMajorVersion = matches[1];
8106  }
8107  return this.webkitMajorVersion;
8108 },
8109 getIsLandscapeOrientation: function(){
8110  if(ASPx.Browser.MacOSMobilePlatform || ASPx.Browser.AndroidMobilePlatform)
8111   return Math.abs(window.orientation) == 90;
8112  return ASPx.GetDocumentClientWidth() > ASPx.GetDocumentClientHeight();
8113 },
8114 nativeScrollingSupported: function() {
8115  var allowedSafariVersion = ASPx.Browser.Version >= 5.1 && ASPx.Browser.Version < 8; 
8116  var webkitMajorVersion = this.getWebkitMajorVersion();
8117  var allowedWebKitVersion = webkitMajorVersion > 533 && webkitMajorVersion < 600;
8118  return (ASPx.Browser.MacOSMobilePlatform && (allowedSafariVersion || allowedWebKitVersion))
8119   || (ASPx.Browser.AndroidMobilePlatform && ASPx.Browser.PlaformMajorVersion >= 3) || (ASPx.Browser.MSTouchUI && (!ASPx.Browser.WindowsPhonePlatform || !ASPx.Browser.IE));
8120 },
8121 makeScrollableIfRequired: function(element, options) {
8122  if(ASPx.Browser.WebKitTouchUI && element) {
8123   var overflow = ASPx.GetCurrentStyle(element).overflow;
8124   if(element.tagName == "DIV" &&  overflow != "hidden" && overflow != "visible" ){
8125    return this.MakeScrollable(element);
8126   }
8127  }
8128 },
8129 preventScrollOnEvent: function(evt){
8130 },
8131 handleFastTapIfRequired: function(evt, action, preventCommonClickEvents) {
8132  if(ASPx.Browser.WebKitTouchUI && evt.type == 'touchstart' && action) {
8133   this.FastTapHelper.HandleFastTap(evt, action, preventCommonClickEvents);
8134   return true;
8135  }
8136  return false;
8137 },
8138 ensureDocumentSizesCorrect: function (){
8139  return (document.documentElement.clientWidth - document.documentElement.clientHeight) / (screen.width - screen.height) > 0;
8140 },
8141 ensureOrientationChanged: function(onOrientationChangedFunction){
8142  if(ASPxClientUtils.iOSPlatform || this.ensureDocumentSizesCorrect())
8143   onOrientationChangedFunction();
8144  else {
8145   window.setTimeout(function(){
8146    this.ensureOrientationChanged(onOrientationChangedFunction);
8147   }.aspxBind(this), 100);
8148  }
8149 },
8150 onEventAttachingToDocument: function(eventName, func){
8151  if(ASPx.Browser.MacOSMobilePlatform && this.isTouchEventName(eventName)) {
8152   if(!this.documentTouchHandlers[eventName])
8153    this.documentTouchHandlers[eventName] = [];
8154   this.documentTouchHandlers[eventName].push(func);
8155   return this.documentEventAttachingAllowed;
8156  }
8157  return true;
8158 },
8159 onEventDettachedFromDocument: function(eventName, func){
8160  if(ASPx.Browser.MacOSMobilePlatform && this.isTouchEventName(eventName)) {
8161   var handlers = this.documentTouchHandlers[eventName];
8162   if(handlers)
8163    ASPx.Data.ArrayRemove(handlers, func);
8164  }
8165 },
8166 processDocumentTouchEventHandlers: function(proc) {
8167  var touchEventNames = ["touchstart", "touchend", "touchmove", "gesturestart", "gestureend"];
8168  for(var i = 0; i < touchEventNames.length; i++) {
8169   var eventName = touchEventNames[i];
8170   var handlers = this.documentTouchHandlers[eventName];
8171   if(handlers) {
8172    for(var j = 0; j < handlers.length; j++) {
8173     proc(eventName,handlers[j]);
8174    }
8175   }
8176  }
8177 },
8178 removeDocumentTouchEventHandlers: function() {
8179  if(ASPx.Browser.MacOSMobilePlatform) {
8180   this.documentEventAttachingAllowed = false;
8181   this.processDocumentTouchEventHandlers(ASPx.Evt.DetachEventFromDocumentCore);
8182  }
8183 },
8184 restoreDocumentTouchEventHandlers: function () {
8185  if(ASPx.Browser.MacOSMobilePlatform) {
8186   this.documentEventAttachingAllowed = true;
8187   this.processDocumentTouchEventHandlers(ASPx.Evt.AttachEventToDocumentCore);
8188  }
8189 },
8190 IsNativeScrolling: function() {
8191  return TouchUIHelper.nativeScrollingSupported() && TouchUIHelper.isNativeScrollingAllowed;
8192 },
8193 pointerEnabled: !!(window.PointerEvent || window.MSPointerEvent),
8194 pointerDownEventName: window.PointerEvent ? "pointerdown" : "MSPointerDown",
8195 pointerUpEventName: window.PointerEvent ? "pointerup" : "MSPointerUp",
8196 pointerCancelEventName: window.PointerEvent ? "pointercancel" : "MSPointerCancel",
8197 pointerMoveEventName: window.PointerEvent ? "pointermove" : "MSPointerMove",
8198 pointerOverEventName: window.PointerEvent ? "pointerover" : "MSPointerOver",
8199 pointerOutEventName: window.PointerEvent ? "pointerout" : "MSPointerOut",
8200 pointerType: {
8201  Touch: (ASPx.Browser.IE && ASPx.Browser.Version == 10) ? 2 : "touch",
8202  Pen: (ASPx.Browser.IE && ASPx.Browser.Version == 10) ? 3 : "pen",
8203  Mouse: (ASPx.Browser.IE && ASPx.Browser.Version == 10) ? 4 : "mouse"
8204 },
8205 msGestureEnabled: !!(window.PointerEvent || window.MSPointerEvent) && typeof(MSGesture) != "undefined",
8206 msTouchCreateGesturesWrapper: function(element, onTap){
8207  if(!TouchUIHelper.msGestureEnabled) 
8208   return;
8209  var gesture = new MSGesture();
8210  gesture.target = element;
8211  ASPx.Evt.AttachEventToElement(element, TouchUIHelper.pointerDownEventName, function(evt){
8212   gesture.addPointer(evt.pointerId);
8213  });
8214  ASPx.Evt.AttachEventToElement(element, TouchUIHelper.pointerUpEventName, function(evt){
8215   gesture.stop();
8216  });
8217  if(onTap)
8218   ASPx.Evt.AttachEventToElement(element, "MSGestureTap", onTap);
8219  return gesture;
8220 },
8221 useLongTapHelper: function () {
8222  return ASPx.Browser.Safari && ASPx.Browser.TouchUI;
8223 },
8224 attachLongTapHandler: function(element, handler, onlyBubbling) {
8225  var timerID = -1;
8226  var timeout = 1000;
8227  var event = null;
8228  var preventClickEvent = false;
8229  var startX = -1;
8230  var startY = -1;
8231  var pixelLimit = 5;
8232  function onTouchMouseDown(evt) {
8233   abortWating();
8234   event = evt;
8235   startX = evt.pageX;
8236   startY = evt.pageY;
8237   preventClickEvent = false;
8238   timerID = window.setTimeout(onTimeout, timeout);
8239  }
8240  function onTouchMouseMove(evt) {
8241   if (!isUnderTouch())
8242    return;
8243   var shiftX = Math.abs(startX - evt.pageX),
8244    shiftY = Math.abs(startY - evt.pageY),
8245    maxShift = Math.max(shiftX, shiftY);
8246   if (maxShift > pixelLimit)
8247    abortWating();
8248  }
8249  function onTouchMouseUp(evt) {
8250   abortWating();
8251   if (preventClickEvent) {
8252    ASPx.Evt.PreventEventAndBubble(evt);
8253    preventClickEvent = false;
8254   }
8255  }
8256  function onTimeout() {
8257   handler(event);
8258   preventClickEvent = true;
8259   abortWatingInternal();
8260  }
8261  function isUnderTouch() {
8262   return timerID !== -1;
8263  }
8264  function abortWating() {
8265   if (isUnderTouch()) {
8266    window.clearTimeout(timerID);
8267    abortWatingInternal();
8268   }
8269  }
8270  function abortWatingInternal() {
8271   timerID = -1;
8272   event = null;
8273  }
8274  ASPx.Evt.AttachEventToElement(element, TouchUIHelper.touchMouseDownEventName, onTouchMouseDown, onlyBubbling);
8275  ASPx.Evt.AttachEventToElement(element, TouchUIHelper.touchMouseMoveEventName, onTouchMouseMove, onlyBubbling);
8276  ASPx.Evt.AttachEventToElement(element, TouchUIHelper.touchMouseUpEventName, onTouchMouseUp, onlyBubbling);
8277  element.style["-webkit-user-select"] = "none";
8278  return function () {
8279   ASPx.Evt.DetachEventFromElement(element, TouchUIHelper.touchMouseDownEventName, onTouchMouseDown);
8280   ASPx.Evt.DetachEventFromElement(element, TouchUIHelper.touchMouseMoveEventName, onTouchMouseMove);
8281   ASPx.Evt.DetachEventFromElement(element, TouchUIHelper.touchMouseUpEventName, onTouchMouseUp);
8282   element.style["-webkit-user-select"] = "";
8283  };
8284 }
8285};
8286var CacheHelper = {};
8287CacheHelper.GetCachedValueCore = function(obj, key, func, cacheObj, fillValueMethod) {
8288 if(!cacheObj)
8289  cacheObj = obj;
8290 if(!cacheObj.cache)
8291  cacheObj.cache = {};
8292 if(!key) 
8293  key = "default";
8294 fillValueMethod(obj, key, func, cacheObj);
8295 return cacheObj.cache[key];
8296};
8297CacheHelper.GetCachedValue = function(obj, key, func, cacheObj) {
8298 return CacheHelper.GetCachedValueCore(obj, key, func, cacheObj, 
8299  function(obj, key, func, cacheObj) {
8300   if(!ASPx.IsExists(cacheObj.cache[key]))
8301    cacheObj.cache[key] = func.apply(obj, []);
8302  });
8303};
8304CacheHelper.GetCachedElement = function(obj, key, func, cacheObj) {
8305 return CacheHelper.GetCachedValueCore(obj, key, func, cacheObj, 
8306  function(obj, key, func, cacheObj) {
8307   if(!ASPx.IsValidElement(cacheObj.cache[key]))
8308    cacheObj.cache[key] = func.apply(obj, []);
8309  });
8310};
8311CacheHelper.GetCachedElements = function(obj, key, func, cacheObj) {
8312 return CacheHelper.GetCachedValueCore(obj, key, func, cacheObj, 
8313  function(obj, key, func, cacheObj) {
8314   if(!ASPx.IsValidElements(cacheObj.cache[key])){
8315    var elements = func.apply(obj, []);
8316    if(!Ident.IsArray(elements))
8317     elements = [elements];
8318    cacheObj.cache[key] = elements;
8319   }
8320  });
8321};
8322CacheHelper.GetCachedElementById = function(obj, id, cacheObj) {
8323 return CacheHelper.GetCachedElement(obj, id, function() { return ASPx.GetElementById(id); }, cacheObj);
8324};
8325CacheHelper.GetCachedChildById = function(obj, parent, id, cacheObj) {
8326 return CacheHelper.GetCachedElement(obj, id, function() { return ASPx.GetChildById(parent, id); }, cacheObj);
8327};
8328CacheHelper.DropCachedValue = function(cacheObj, key) {
8329 cacheObj.cache[key] = null;
8330};  
8331CacheHelper.DropCache = function(cacheObj) {
8332 cacheObj.cache = null;
8333};  
8334var DomObserver = ASPx.CreateClass(null, {
8335 constructor: function() {
8336  this.items = { };
8337 },
8338 subscribe: function(elementID, callbackFunc) {
8339  var item = this.items[elementID];
8340  if(item)
8341   this.unsubscribe(elementID);
8342  item = {
8343   elementID: elementID,
8344   callbackFunc: callbackFunc,
8345   pauseCount: 0
8346  };
8347  this.prepareItem(item);
8348  this.items[elementID] = item;
8349 },
8350 prepareItem: function(item) {
8351 },
8352 unsubscribe: function(elementID) {
8353  this.items[elementID] = null;
8354 },
8355 getItemElement: function(item) {
8356  var element = this.getElementById(item.elementID);
8357  if(element)
8358   return element;
8359  this.unsubscribe(item.elementID);
8360  return null;
8361 },
8362 getElementById: function(elementID) {
8363  var element = document.getElementById(elementID);
8364  return element && ASPx.IsValidElement(element) ? element : null;
8365 },
8366 pause: function(element, includeSubtree) {
8367  this.changeItemsState(element, includeSubtree, true);
8368 },
8369 resume: function(element, includeSubtree) {
8370  this.changeItemsState(element, includeSubtree, false);
8371 },
8372 forEachItem: function(processFunc, context) {
8373  context = context || this;
8374  for(var itemName in this.items) {
8375   if(!this.items.hasOwnProperty(itemName))
8376    continue;
8377   var item = this.items[itemName];
8378   if(item) {
8379    var needBreak = processFunc.call(context, item);
8380    if(needBreak)
8381     return;
8382   }
8383  }
8384 },
8385 changeItemsState: function(element, includeSubtree, pause) {
8386  this.forEachItem(function(item) {
8387   if(!element)
8388    this.changeItemState(item, pause);
8389   else {
8390    var itemElement = this.getItemElement(item);
8391    if(itemElement && (element == itemElement || (includeSubtree && ASPx.GetIsParent(element, itemElement)))) {
8392     this.changeItemState(item, pause);
8393     if(!includeSubtree)
8394      return true;
8395    }
8396   }
8397  }.aspxBind(this));
8398 },
8399 changeItemState: function(item, pause) {
8400  if(pause)
8401   this.pauseItem(item);
8402  else
8403   this.resumeItem(item);
8404 },
8405 pauseItem: function(item) {
8406  item.paused = true;
8407  item.pauseCount++;
8408 },
8409 resumeItem: function(item) {
8410  if(item.pauseCount > 0) {
8411   if(item.pauseCount == 1)
8412    item.paused = false;
8413   item.pauseCount--;
8414  }
8415 }
8416});
8417DomObserver.IsMutationObserverAvailable = function() {
8418 return !!window.MutationObserver;
8419};
8420var TimerObserver = ASPx.CreateClass(DomObserver, {
8421 constructor: function() {
8422  this.constructor.prototype.constructor.call(this);
8423  this.timerID = -1;
8424  this.observationTimeout = 300;
8425 },
8426 subscribe: function(elementID, callbackFunc) {
8427  DomObserver.prototype.subscribe.call(this, elementID, callbackFunc);
8428  if(!this.isActivated())
8429   this.startObserving();
8430 },
8431 isActivated: function() {
8432  return this.timerID !== -1;
8433 },
8434 startObserving: function() {
8435  if(this.isActivated())
8436   window.clearTimeout(this.timerID);
8437  this.timerID = window.setTimeout(this.onTimeout, this.observationTimeout);
8438 },
8439 onTimeout: function() {
8440  var observer = _aspxGetDomObserver();
8441  observer.doObserve();
8442  observer.startObserving();
8443 },
8444 doObserve: function() {
8445  if(!ASPx.documentLoaded) return;
8446  this.forEachItem(function(item) {
8447   if(!item.paused)
8448    this.doObserveForItem(item);
8449  }.aspxBind(this));
8450 },
8451 doObserveForItem: function(item) {
8452  var element = this.getItemElement(item);
8453  if(element)
8454   item.callbackFunc.call(this, element);
8455 }
8456});
8457var MutationObserver = ASPx.CreateClass(DomObserver, {
8458 constructor: function() {
8459  this.constructor.prototype.constructor.call(this);
8460  this.callbackTimeout = 10;
8461 },
8462 prepareItem: function(item) {
8463  item.callbackTimerID = -1;
8464  var target = this.getElementById(item.elementID);
8465  if(!target)
8466   return;
8467  var observerCallbackFunc = function() {
8468   if(item.callbackTimerID === -1) {
8469    var timeoutHander = function() {
8470     item.callbackTimerID = -1;
8471     item.callbackFunc.call(this, target);
8472    }.aspxBind(this);
8473    item.callbackTimerID = window.setTimeout(timeoutHander, this.callbackTimeout);
8474   }
8475  }.aspxBind(this);
8476  var observer = new window.MutationObserver(observerCallbackFunc);
8477  var config = { attributes: true, childList: true, characterData: true, subtree: true };
8478  observer.observe(target, config);
8479  item.observer = observer;
8480  item.config = config;
8481 },
8482 unsubscribe: function(elementID) {
8483  var item = this.items[elementID];
8484  if(item) {
8485   item.observer.disconnect();
8486   item.observer = null;
8487  }
8488  DomObserver.prototype.unsubscribe.call(this, elementID);
8489 },
8490 pauseItem: function(item) {
8491  DomObserver.prototype.pauseItem.call(this, item);
8492  item.observer.disconnect();
8493 },
8494 resumeItem: function(item) {
8495  DomObserver.prototype.resumeItem.call(this, item);
8496  if(!item.paused) {
8497   var target = this.getItemElement(item);
8498   if(target)
8499    item.observer.observe(target, item.config);
8500  }
8501 }
8502});
8503var domObserver = null;
8504function _aspxGetDomObserver() {
8505 if(domObserver == null)
8506  domObserver = DomObserver.IsMutationObserverAvailable() ? new MutationObserver() : new TimerObserver();
8507 return domObserver;
8508}
8509var ControlUpdateWatcher = ASPx.CreateClass(null, {
8510 constructor: function() {
8511  this.helpers = { };
8512  this.clearLockerTimerID = -1;
8513  this.clearLockerTimerDelay = 15;
8514  this.postProcessing = false;
8515  this.init();
8516 },
8517 init: function() {
8518  var postHandler = aspxGetPostHandler();
8519  postHandler.Post.AddHandler(this.OnPost, this);
8520 },
8521 Add: function(helper) {
8522  this.helpers[helper.GetName()] = helper;
8523 },
8524 CanSendCallback: function(dxCallbackOwner, arg) {
8525  this.LockConfirmOnBeforeWindowUnload();
8526  var modifiedHelpers = this.FilterModifiedHelpersByDXCallbackOwner(this.GetModifiedHelpers(), dxCallbackOwner, arg);
8527  if(modifiedHelpers.length === 0) return true;
8528  var modifiedHelpersInfo = this.GetToConfirmAndToResetLists(modifiedHelpers, dxCallbackOwner.name);
8529  if(!modifiedHelpersInfo) return true;
8530  if(modifiedHelpersInfo.toConfirm.length === 0) {
8531   this.ResetClientChanges(modifiedHelpersInfo.toReset);
8532   return true;
8533  }
8534  var helper = modifiedHelpersInfo.toConfirm[0];
8535  if(!confirm(helper.GetConfirmUpdateText()))
8536   return false;
8537  this.ResetClientChanges(modifiedHelpersInfo.toReset);
8538  return true;
8539 },
8540 OnPost: function(s, e) {
8541  if(this.isDxCallback(e))
8542   return;
8543  this.postProcessing = true;
8544  this.LockConfirmOnBeforeWindowUnload();
8545  var modifiedHelpersInfo = this.GetModifedHelpersInfo(e);
8546  if(!modifiedHelpersInfo)
8547   return;
8548  if(modifiedHelpersInfo.toConfirm.length === 0) {
8549   this.ResetClientChanges(modifiedHelpersInfo.toReset);
8550   return;
8551  }
8552  var helper = modifiedHelpersInfo.toConfirm[0];
8553  if(!confirm(helper.GetConfirmUpdateText())) {
8554   e.cancel = true;
8555   this.finishPostProcessing();
8556  }
8557  if(!e.cancel)
8558   this.ResetClientChanges(modifiedHelpersInfo.toReset);
8559 },
8560 isDxCallback: function(e) {
8561  return e.isDXCallback || this.isInternalUploadControlCallback();
8562 },
8563 isInternalUploadControlCallback: function() {
8564  var isInCallback = false;
8565  for(var key in this.helpers) {
8566   if(this.helpers.hasOwnProperty(key)) {
8567    var helper = this.helpers[key];
8568    isInCallback = isInCallback || helper.isInUploadCallback();
8569   }
8570  }
8571  return isInCallback;
8572 },
8573 finishPostProcessing: function() {
8574  this.postProcessing = false;
8575 },
8576 GetModifedHelpersInfo: function(e) {
8577  var modifiedHelpers = this.FilterModifiedHelpers(this.GetModifiedHelpers(), e);
8578  if(modifiedHelpers.length === 0) return;
8579  return this.GetToConfirmAndToResetLists(modifiedHelpers, e && e.ownerID);
8580 },
8581 GetToConfirmAndToResetLists: function(modifiedHelpers, ownerID) {
8582  var resetList = [ ];
8583  var confirmList = [ ];
8584  for(var i = 0; i < modifiedHelpers.length; i++) {
8585   var helper = modifiedHelpers[i];
8586   if(!helper.GetConfirmUpdateText()) { 
8587    resetList.push(helper);
8588    continue;
8589   }
8590   if(helper.CanShowConfirm(ownerID)) { 
8591    resetList.push(helper);
8592    confirmList.push(helper);
8593   }
8594  }
8595  return { toConfirm: confirmList, toReset: resetList };
8596 },
8597 FilterModifiedHelpers: function(modifiedHelpers, e) {
8598  if(modifiedHelpers.length === 0)
8599   return [ ];
8600  if(this.RequireProcessUpdatePanelCallback(e))
8601   return this.FilterModifiedHelpersByUpdatePanels(modifiedHelpers);
8602  if(this.postProcessing)
8603   return this.FilterModifiedHelpersByPostback(modifiedHelpers);
8604  return modifiedHelpers;
8605 },
8606 FilterModifiedHelpersByDXCallbackOwner: function(modifiedHelpers, dxCallbackOwner, arg) {
8607  var result = [ ];
8608  for(var i = 0; i < modifiedHelpers.length; i++) {
8609   var helper = modifiedHelpers[i];
8610   if(helper.NeedConfirmOnCallback(dxCallbackOwner, arg))
8611    result.push(helper);
8612  }
8613  return result;
8614 },
8615 FilterModifiedHelpersByUpdatePanels: function(modifiedHelpers) {
8616  var result = [ ];
8617  var updatePanels = this.GetUpdatePanelsWaitedForUpdate();
8618  for(var i = 0; i < updatePanels.length; i++) {
8619   var panelID = updatePanels[i].replace(/\$/g, "_");
8620   var panel = ASPx.GetElementById(panelID);
8621   if(!panel) continue;
8622   for(var j = 0; j < modifiedHelpers.length; j++) {
8623    var helper = modifiedHelpers[j];
8624    if(ASPx.GetIsParent(panel, helper.GetControlMainElement()))
8625     result.push(helper);
8626   }
8627  }
8628  return result;
8629 },
8630 FilterModifiedHelpersByPostback: function(modifiedHelpers) {
8631  var result = [ ];
8632  for(var i = 0; i < modifiedHelpers.length; i++) {
8633   var helper = modifiedHelpers[i];
8634   if(helper.NeedConfirmOnPostback())
8635    result.push(helper);
8636  }
8637  return result;
8638 },
8639 RequireProcessUpdatePanelCallback: function(e) {
8640  var rManager = this.GetMSRequestManager();
8641  if(rManager && e && e.isMSAjaxCallback)
8642   return rManager._postBackSettings.async;
8643  return false;
8644 },
8645 GetUpdatePanelsWaitedForUpdate: function() {
8646  var rManager = this.GetMSRequestManager();
8647  if(!rManager) return [ ];
8648  var panelUniqueIDs = rManager._postBackSettings.panelsToUpdate || [ ];
8649  var panelClientIDs = [ ];
8650  for(var i = 0; i < panelUniqueIDs.length; i++) {
8651   var index = ASPx.Data.ArrayIndexOf(rManager._updatePanelIDs, panelUniqueIDs[i]);
8652   if(index >= 0)
8653    panelClientIDs.push(rManager._updatePanelClientIDs[index]);
8654  }
8655  return panelClientIDs;
8656 },
8657 GetMSRequestManager: function() {
8658  return ASPx.GetMSAjaxRequestManager();
8659 },
8660 GetModifiedHelpers: function() {
8661  var result = [ ];
8662  for(var key in this.helpers) { 
8663   if(this.helpers.hasOwnProperty(key)) {
8664    var helper = this.helpers[key];
8665    if(helper.HasChanges())
8666     result.push(helper);
8667   }
8668  }
8669  return result;
8670 },
8671 ResetClientChanges: function(modifiedHelpers) {
8672  for(var i = 0; i < modifiedHelpers.length; i++)
8673   modifiedHelpers[i].ResetClientChanges();
8674 },
8675 GetConfirmUpdateMessage: function() {
8676  if(this.confirmOnWindowUnloadLocked) return;
8677  var modifiedHelpersInfo = this.GetModifedHelpersInfo();
8678  if(!modifiedHelpersInfo || modifiedHelpersInfo.toConfirm.length === 0) 
8679   return;
8680  var helper = modifiedHelpersInfo.toConfirm[0];
8681  return helper.GetConfirmUpdateText();
8682 },
8683 LockConfirmOnBeforeWindowUnload: function() {
8684  this.confirmOnWindowUnloadLocked = true;
8685  this.clearLockerTimerID = ASPx.Timer.ClearTimer(this.clearLockerTimerID);
8686  this.clearLockerTimerID = window.setTimeout(function() {
8687   this.confirmOnWindowUnloadLocked = false;
8688  }.aspxBind(this), this.clearLockerTimerDelay);
8689 },
8690 OnWindowBeforeUnload: function(e) {
8691  var confirmMessage = this.GetConfirmUpdateMessage();
8692  if(confirmMessage)
8693   e.returnValue = confirmMessage;
8694  this.finishPostProcessing();
8695  return confirmMessage;
8696 },
8697 OnWindowUnload: function(e) {
8698  if(this.confirmOnWindowUnloadLocked) return;
8699  var modifiedHelpersInfo = this.GetModifedHelpersInfo();
8700  if(!modifiedHelpersInfo) return;
8701  this.ResetClientChanges(modifiedHelpersInfo.toReset);
8702 },
8703 OnMouseDown: function(e) {
8704  if(ASPx.Browser.IE)
8705   this.PreventBeforeUnloadOnLinkClick(e);
8706 },
8707 OnFocusIn: function(e) {
8708  if(ASPx.Browser.IE)
8709   this.PreventBeforeUnloadOnLinkClick(e);
8710 },
8711 PreventBeforeUnloadOnLinkClick: function(e) {
8712  if(ASPx.GetObjectKeys(this.helpers).length == 0)
8713   return;
8714  var link = ASPx.GetParentByTagName(ASPx.Evt.GetEventSource(e), "A");
8715  if(!link || link.dxgvLinkClickHanlderAssigned)
8716   return;
8717  var url = ASPx.Attr.GetAttribute(link, "href");
8718  if(!url || url.indexOf("javascript:") < 0)
8719   return;
8720  ASPx.Evt.AttachEventToElement(link, "click", function(ev) { return ASPx.Evt.PreventEvent(ev); });
8721  link.dxgvLinkClickHanlderAssigned = true;
8722 }
8723});
8724ControlUpdateWatcher.Instance = null;
8725ControlUpdateWatcher.getInstance = function () {
8726 if (!ControlUpdateWatcher.Instance) {
8727  ControlUpdateWatcher.Instance = new ControlUpdateWatcher();
8728  ASPx.Evt.AttachEventToElement(window, "beforeunload", function(e) {
8729   return ControlUpdateWatcher.Instance.OnWindowBeforeUnload(e);
8730  });
8731  ASPx.Evt.AttachEventToElement(window, "unload", function(e) {
8732   ControlUpdateWatcher.Instance.OnWindowUnload(e);
8733  });
8734  ASPx.Evt.AttachEventToDocument("mousedown", function(e) {
8735   ControlUpdateWatcher.Instance.OnMouseDown(e);
8736  });
8737  ASPx.Evt.AttachEventToDocument("focusin", function(e) {
8738   ControlUpdateWatcher.Instance.OnFocusIn(e);
8739  });
8740 }
8741 return ControlUpdateWatcher.Instance;
8742};
8743var UpdateWatcherHelper = ASPx.CreateClass(null, {
8744 constructor: function(owner) {
8745  this.owner = owner;
8746  this.ownerWatcher = ControlUpdateWatcher.getInstance();
8747  this.ownerWatcher.Add(this);
8748 },
8749 GetName: function() {
8750  return this.owner.name;
8751 },
8752 GetControlMainElement: function() {
8753  return this.owner.GetMainElement();
8754 },
8755 GetControlParentForm: function(){
8756  return ASPx.GetParentByTagName(this.GetControlMainElement(), "FORM");
8757 },
8758 CanShowConfirm: function(requestOwnerID) {
8759  return true;
8760 },
8761 HasChanges: function() {
8762  return false;
8763 },
8764 GetConfirmUpdateText: function() {
8765  return "";
8766 },
8767 NeedConfirmOnCallback: function(dxCallbackOwner) {
8768  return true;
8769 },
8770 NeedConfirmOnPostback: function() {
8771  if(ASPx.IsUploadSubmitRequest)
8772   return !ASPx.IsUploadSubmitRequest(this.GetControlParentForm(
8772));
8773  return true;
8774 },
8775 ResetClientChanges: function() {
8776 },
8777 ConfirmOnCustomControlEvent: function() {
8778  var confirmMessage = this.GetConfirmUpdateText();
8779  if(confirmMessage)
8780   return confirm(confirmMessage);
8781  return false;
8782 },
8783 isInUploadCallback: function() {
8784  return false;
8785 }
8786});
8787var ControlTabIndexManager = ASPx.CreateClass(null, {
8788 constructor: function() {
8789  this.elementsWithChangedTabIndex = {};
8790 },
8791 getChangedElementsForControlId: function(id) {
8792  if(!this.elementsWithChangedTabIndex[id])
8793   this.elementsWithChangedTabIndex[id] = [];
8794  return this.elementsWithChangedTabIndex[id];
8795 },
8796 isElementWithChangedIndex: function(element) {
8797  for(var key in this.elementsWithChangedTabIndex)
8798   if(this.elementsWithChangedTabIndex.hasOwnProperty(key))
8799    if(this.elementsWithChangedTabIndex[key].indexOf(element) !== -1)
8800     return true;
8801  return false;
8802 },
8803 changeTabIndexAttribute: function(element, id) {
8804  var elements = this.getChangedElementsForControlId(id);
8805  ASPx.Attr.ChangeTabIndexAttribute(element);
8806  if(elements.indexOf(element) === -1)
8807   elements.push(element);
8808 },
8809 restoreTabIndexAttribute: function(element, id) {
8810  var elements = this.getChangedElementsForControlId(id),
8811   index = elements.indexOf(element);
8812  if(index !== -1) {
8813   elements.splice(index, 1);
8814   if(!this.isElementWithChangedIndex(element))
8815    ASPx.Attr.RestoreTabIndexAttribute(element);
8816  }
8817 }
8818});
8819ControlTabIndexManager.Instance = null;
8820ControlTabIndexManager.getInstance = function() {
8821 if(!ControlTabIndexManager.Instance)
8822  ControlTabIndexManager.Instance = new ControlTabIndexManager();
8823 return ControlTabIndexManager.Instance;
8824};
8825var ControlCallbackHandlersQueue = ASPx.CreateClass(null, {
8826 constructor: function (owner) {
8827  this.owner = owner;
8828  this.handlerInfos = [];
8829 },
8830 addCallbackHandler: function(handlerInfo) {
8831  this.handlerInfos.push(handlerInfo);
8832 },
8833 executeCallbacksHandlers: function() {
8834  for(var i = 0, handlerInfo; handlerInfo = this.handlerInfos[i]; i++)
8835   handlerInfo.handler.call(this.owner, handlerInfo.result);
8836  this.handlerInfos = [];
8837 }
8838});
8839var ControlCallbackQueueHelper = ASPx.CreateClass(null, {
8840 constructor: function (owner) {
8841  this.owner = owner;
8842  this.pendingCallbacks = [];
8843  this.receivedCallbacks = [];
8844  this.attachEvents();
8845 },
8846 showLoadingElements: function () {
8847  this.owner.ShowLoadingDiv();
8848  if (this.owner.IsCallbackAnimationEnabled())
8849   this.owner.StartBeginCallbackAnimation();
8850  else
8851   this.owner.ShowLoadingElementsInternal();
8852 },
8853 attachEvents: function () {
8854  this.owner.EndCallback.AddHandler(this.onEndCallback.aspxBind(this));
8855  this.owner.CallbackError.AddHandler(this.onCallbackError.aspxBind(this));
8856 },
8857 detachEvents: function () {
8858  this.owner.EndCallback.RemoveHandler(this.onEndCallback);
8859  this.owner.CallbackError.RemoveHandler(this.onCallbackError);
8860 },
8861 onCallbackError: function (owner, result) {
8862  this.sendErrorToChildControl(result);
8863 },
8864 ignoreDuplicates: function () {
8865  return true;
8866 },
8867 hasDuplicate: function (arg) {
8868  for (var i in this.pendingCallbacks) {
8869   if (this.pendingCallbacks[i].arg == arg && this.pendingCallbacks[i].state != ASPx.callbackState.aborted)
8870    return true;
8871  }
8872  return false;
8873 },
8874 getToken: function (halperContext, callbackInfo) {
8875  return {
8876   cancel: function () {
8877    if (callbackInfo.state == ASPx.callbackState.sent) {
8878     callbackInfo.state = ASPx.callbackState.aborted;
8879     halperContext.sendNext();
8880    }
8881    if (callbackInfo.state == ASPx.callbackState.inTurn)
8882     ASPx.Data.ArrayRemove(halperContext.pendingCallbacks, callbackInfo);
8883   },
8884   callbackId: -1
8885  };
8886 },
8887 sendCallback: function (arg, handlerContext, handler, commandName, onBeforeSend) {
8888  if (this.ignoreDuplicates() && this.hasDuplicate(arg))
8889   return false;
8890  var handlerContext = handlerContext || this.owner;
8891  var callbackInfo = {
8892   arg: arg,
8893   handlerContext: handlerContext,
8894   handler: handler || handlerContext.OnCallback,
8895   state: ASPx.callbackState.inTurn,
8896   callbackId: -1,
8897   onBeforeSend: onBeforeSend
8898  };
8899  this.pendingCallbacks.push(callbackInfo);
8900  if (!this.hasActiveCallback()) {
8901   this.createCallbackByCallbackInfo(callbackInfo, commandName);
8902  }
8903  return this.getToken(this, callbackInfo);
8904 },
8905 hasActiveCallback: function () {
8906  return this.getCallbacksInfoByState(ASPx.callbackState.sent).length > 0;
8907 },
8908 sendNext: function () {
8909  var nextCallbackInfo = this.getCallbacksInfoByState(ASPx.callbackState.inTurn)[0];
8910  if (nextCallbackInfo) {
8911   this.createCallbackByCallbackInfo(nextCallbackInfo);
8912   return nextCallbackInfo.callbackId;
8913  }
8914 },
8915 createCallbackByCallbackInfo: function(callbackInfo, commandName) {
8916  if(callbackInfo.onBeforeSend)
8917   callbackInfo.onBeforeSend();
8918  callbackInfo.callbackId = this.owner.CreateCallback(callbackInfo.arg, commandName);
8919  callbackInfo.state = ASPx.callbackState.sent;
8920 },
8921 onEndCallback: function () {
8922  if (!this.owner.isErrorOnCallback && this.hasPendingCallbacks()) {
8923   var curCallbackId;
8924   var curCallbackInfo;
8925   var handlerContext;
8926   for (var i in this.receivedCallbacks) {
8927    if(this.receivedCallbacks.hasOwnProperty(i)) {
8928     curCallbackId = this.receivedCallbacks[i];
8929     curCallbackInfo = this.getCallbackInfoById(curCallbackId);
8930     if (curCallbackInfo.state != ASPx.callbackState.aborted) {
8931      handlerContext = curCallbackInfo.handlerContext;
8932      if (handlerContext.OnEndCallback)
8933       handlerContext.OnEndCallback();
8934      this.sendNext();
8935     }
8936     ASPx.Data.ArrayRemove(this.pendingCallbacks, curCallbackInfo);
8937    }
8938   }
8939   ASPx.Data.ArrayClear(this.receivedCallbacks);
8940  }
8941 },
8942 hasPendingCallbacks: function () {
8943  return this.pendingCallbacks && this.pendingCallbacks.length && this.pendingCallbacks.length > 0;
8944 },
8945 processCallback: function (result, callbackId) {
8946  this.receivedCallbacks.push(callbackId);
8947  if (this.hasPendingCallbacks()) {
8948   var callbackInfo = this.getCallbackInfoById(callbackId);
8949   if (callbackInfo.state != ASPx.callbackState.aborted)
8950    callbackInfo.handler.call(callbackInfo.handlerContext, result);
8951  }
8952 },
8953 getCallbackInfoById: function (id) {
8954  for (var i in this.pendingCallbacks) {
8955   if (this.pendingCallbacks[i].callbackId == id)
8956    return this.pendingCallbacks[i];
8957  }
8958 },
8959 getCallbacksInfoByState: function (state) {
8960  var result = [];
8961  for (var i in this.pendingCallbacks) {
8962   if (this.pendingCallbacks[i].state == state)
8963    result.push(this.pendingCallbacks[i]);
8964  }
8965  return result;
8966 },
8967 sendErrorToChildControl: function (callbackObj) {
8968  if (!this.hasPendingCallbacks())
8969   return;
8970  var callbackInfo = this.getCallbackInfoById(callbackObj.callbackId || 0);
8971  if (!callbackInfo)
8972   return;
8973  var hasChildControlHandler = (callbackInfo.handlerContext != this.owner) && callbackInfo.handlerContext.OnCallbackError;
8974  if (hasChildControlHandler)
8975   callbackInfo.handlerContext.OnCallbackError.call(callbackInfo.handlerContext, callbackObj.message, callbackObj.data);
8976 }
8977});
8978var AccessibilityHelperBase = ASPx.CreateClass(null, {
8979 constructor: function(control) {
8980  this.control = control;
8981  this.timerID = -1;
8982  this.pronounceMessageTimeout = 500;
8983  this.activeItem = this.getItems()[0];
8984  this.pronounceIsStarted = false;
8985 },
8986 PronounceMessage: function(text, activeItemArgs, inactiveItemArgs, mainElementArgs, ownerMainElement) {   
8987  this.timerID = ASPx.Timer.ClearTimer(this.timerID);
8988  this.pronounceIsStarted = true;
8989  this.timerID = window.setTimeout(function() {
8990   this.PronounceMessageCore(text, activeItemArgs, inactiveItemArgs, mainElementArgs, ownerMainElement);
8991  }.aspxBind(this), this.getPronounceTimeout());
8992 },
8993 PronounceMessageCore: function(text, activeItemArgs, inactiveItemArgs, mainElementArgs, ownerMainElement) {
8994  if(!this.getItems())
8995   return;
8996  this.toogleItem();
8997  var mainElement = this.getMainElement();
8998  var activeItem = this.getItem(true);
8999  var inactiveItem = this.getItem();
9000  if(ASPx.Attr.GetAttribute(mainElement, "role") != "application")
9001   mainElementArgs = this.addArguments(mainElementArgs, { "aria-activedescendant" : activeItem.id });
9002  var messageAttrObj = {};
9003  var activeItemRole = ASPx.Attr.GetAttribute(activeItem, "role");
9004  var attrName = activeItemRole == "combobox" ? "aria-label" : "innerHtml";
9005  messageAttrObj[attrName] = ASPx.Str.EncodeHtml(text);
9006  activeItemArgs = this.addArguments(activeItemArgs, messageAttrObj);
9007  messageAttrObj[attrName] = "";
9008  inactiveItemArgs = this.addArguments(inactiveItemArgs, messageAttrObj);
9009  var errorTextElement = null;
9010  if(this.control.GetErrorCell()) {
9011   errorTextElement = this.getAriaExplanatoryTextManager().GetErrorTextElement();
9012   activeItemArgs = this.addArguments(activeItemArgs,   {"aria-invalid"  : !this.control.isValid ? "true" : "" });
9013   mainElementArgs = this.addArguments(mainElementArgs, { "aria-invalid" : "" });
9014   inactiveItemArgs = this.addArguments(inactiveItemArgs,  { "aria-invalid" : "" });
9015  }
9016  this.changeActivityAttributes(activeItem, activeItemArgs);
9017  if(errorTextElement) {
9018   this.getAriaExplanatoryTextManager().SetOrRemoveText([activeItem], errorTextElement, !this.control.isValid, false, true);
9019   this.getAriaExplanatoryTextManager().SetOrRemoveText([mainElement, inactiveItem], errorTextElement, false, false, false);
9020  }
9021  this.changeActivityAttributes(mainElement, mainElementArgs);
9022  if(!!ownerMainElement && ASPx.Attr.GetAttribute(ownerMainElement, "role") != "application")
9023   this.changeActivityAttributes(ownerMainElement, { "aria-activedescendant": activeItem.id });
9024  this.changeActivityAttributes(inactiveItem, inactiveItemArgs);
9025  this.pronounceIsStarted = false;
9026 },
9027 GetActiveElement: function(inputIsMainElement) {
9028  if(this.pronounceIsStarted) return null;
9029  var mainElement = inputIsMainElement ? this.control.GetInputElement() : this.getMainElement();
9030  var activeElementId = ASPx.Attr.GetAttribute(mainElement, 'aria-activedescendant');
9031  return activeElementId ? ASPx.GetElementById(activeElementId) : mainElement;
9032 },
9033 getMainElement: function() {
9034  if(!ASPx.IsExistsElement(this.mainElement))
9035   this.mainElement = this.control.GetAccessibilityAssistantElement();
9036  return this.mainElement;
9037 },
9038 getItems: function() {
9039  if(!ASPx.IsExistsElement(this.items))
9040   this.items = ASPx.GetChildElementNodes(this.getMainElement());
9041  return this.items;
9042 },
9043 getItem: function(isActive) {
9044  if(isActive)
9045   return this.activeItem;
9046  var items = this.getItems();
9047  return items[0] === this.activeItem ? items[1] : items[0];
9048 },
9049 getAriaExplanatoryTextManager: function() { return this.control.ariaExplanatoryTextManager; },
9050 getPronounceTimeout: function() { return this.pronounceMessageTimeout; },
9051 toogleItem: function() {
9052  this.activeItem = this.getItem();
9053 },
9054 addArguments: function(targetArgs, newArgs) {
9055  if(!targetArgs) targetArgs = { };
9056  for(var key in newArgs) {
9057   if(newArgs.hasOwnProperty(key) && !targetArgs.hasOwnProperty(key))
9058    targetArgs[key] = newArgs[key];
9059  }
9060  return targetArgs;
9061 },
9062 changeActivityAttributes: function(element, args) {
9063  if(!element)
9064   return;
9065  for(var key in args) {
9066   if(args.hasOwnProperty(key)) {
9067    var value = args[key];
9068    if(key == "innerHtml")
9069     ASPx.SetInnerHtml(element, value);
9070    else {
9071     var action = value !== "" ? ASPx.Attr.SetAttribute : ASPx.Attr.RemoveAttribute;
9072     action(element, key, value);
9073    }
9074   }
9075  }
9076 }
9077});
9078var AccessibilityPronouncer = ASPx.CreateClass(null, {
9079 constructor: function() {
9080  this.pronouncerId = "dxPronouncer";
9081  this.initialized = false;
9082  this.focusableMessageElement = null;
9083  this.messageElement = null;
9084  this.pronouncers = {
9085   live: new AccessibilityLivePronouncer(this),
9086   descendant: new AccessibilityDescendantPronouncer(this)
9087  };
9088 },
9089 Pronounce: function(args, type) {
9090  this.pronouncers[type].Pronounce(args);
9091 },
9092 EnsureInitialize: function() {
9093  if(!this.initialized)
9094   this.initialize();
9095 },
9096 RemoveState: function() {
9097  for(var pronouncer in this.pronouncers)
9098   if(this.pronouncers.hasOwnProperty(pronouncer))
9099    pronouncer.RemoveState();
9100 },
9101 RestoreControlState: function(type, mainElement) {
9102  this.pronouncers[type].RestoreControlState(mainElement);
9103 },
9104 RestoreElementsState: function(type, elements) {
9105  this.pronouncers[type].RestoreElementsState(elements);
9106 },
9107 RestoreElementState: function(type, element) {
9108  this.pronouncers[type].RestoreElementState(element);
9109 },
9110 initialize: function() {
9111  this.createFocusableMessageElement();
9112  this.createMessageElement();
9113  this.prepareFocusableMessageElement();
9114  this.setAttributesForKeyboardNavigation();
9115  this.initialized = true;
9116 },
9117 createFocusableMessageElement: function() {
9118  var focusableMessageElement = document.createElement("DIV");
9119  document.body.appendChild(focusableMessageElement);
9120  this.focusableMessageElement = focusableMessageElement;   
9121 },
9122 prepareFocusableMessageElement: function() {
9123  this.focusableMessageElement.className = "dxAIFFE";
9124 },
9125 setAttributesForKeyboardNavigation: function() {
9126  ASPx.Attr.Aria.SetApplicationRole(this.focusableMessageElement);
9127  ASPx.Attr.Aria.SetSilence(this.focusableMessageElement);
9128 },
9129 createMessageElement: function() {
9130  var messageElement = document.createElement("DIV");
9131  messageElement.id = this.pronouncerId;
9132  ASPx.Attr.SetAttribute(messageElement, "role", "note");
9133  this.focusableMessageElement.appendChild(messageElement);
9134  this.messageElement = messageElement;
9135 },
9136 getMessage: function(messagePartsArg) {
9137  var messageParts = messagePartsArg.filter(function(x) { return ASPx.IsExists(x); });
9138  return messageParts.join(", ");
9139 }
9140});
9141var AccessibilityPronouncerBase = ASPx.CreateClass(null, {
9142 constructor: function() {
9143  this.state = { };
9144 },
9145 Pronounce: function(args) {
9146  var messageElement = this.getMessageElement();
9147  ASPx.Attr.Aria.SetOrRemoveLabel(messageElement);
9148  ASPx.SetInnerHtml(messageElement, "");
9149  this.PronounceCore(args);
9150 },
9151 PronounceCore: function(args) { },
9152 SaveElementState: function(element) { 
9153  if(this.state[element.id])
9154   return;
9155  this.state[element.id] = {
9156   element: element,
9157   descendant: ASPx.Attr.GetAttribute(element, ASPx.Attr.Aria.descendant)
9158  };
9159 },
9160 RemoveState: function() {
9161  this.state = { };
9162 },
9163 RestoreControlState: function(mainElement) { 
9164  for(var elementInfo in this.state) {
9165   if(this.state.hasOwnProperty(elementInfo)) {
9166    var element = this.state[elementInfo].element;
9167    if(!mainElement || ASPx.GetIsParent(mainElement, element))
9168     this.RestoreElementState(element);
9169   }
9170  }
9171 },
9172 RestoreElementsState: function(elements) { 
9173  for(var i = 0; i < elements.length; i++)
9174   this.RestoreElementState(elements[i]);
9175 },
9176 RestoreElementState: function(element) {
9177  var elementState = this.state[element.id];
9178  if(!elementState)
9179   return;
9180  ASPx.Attr.Aria.SetOrRemoveDescendant(element, elementState.descendant);
9181  delete this.state[element.id];
9182 },
9183 getMessage: function(args) {
9184  return ASPx.AccessibilityPronouncer.getMessage(args.messageParts);
9185 },
9186 getMessageElement: function() {
9187  return ASPx.AccessibilityPronouncer.messageElement;
9188 },
9189 getFocusableMessageElement: function() {
9190   return ASPx.AccessibilityPronouncer.focusableMessageElement;
9191 }
9192});
9193var AccessibilityLivePronouncer = ASPx.CreateClass(AccessibilityPronouncerBase, {
9194 constructor: function() {
9195  this.constructor.prototype.constructor.call(this);
9196 },
9197 PronounceCore: function(args) {
9198  var message = this.getMessage(args);
9199  var messageElement = this.getMessageElement();
9200  ASPx.Attr.SetAttribute(this.getFocusableMessageElement(), "aria-live", "assertive");
9201  ASPx.Attr.Aria.SetAtomic(this.getFocusableMessageElement(), "true");
9202  ASPx.SetInnerHtml(messageElement, ASPx.Str.EncodeHtml(message));
9203 }
9204});
9205var AccessibilityDescendantPronouncer = ASPx.CreateClass(AccessibilityPronouncerBase, {
9206 constructor: function() {
9207  this.constructor.prototype.constructor.call(this);
9208 },
9209 PronounceCore: function(args) {
9210  var message = this.getMessage(args);
9211  var activeElement = ASPx.GetActiveElement();
9212  var messageElement = this.getMessageElement();
9213  this.SaveElementState(activeElement);
9214  ASPx.Attr.RemoveAttribute(this.getFocusableMessageElement(), "aria-live");
9215  ASPx.Attr.RemoveAttribute(this.getFocusableMessageElement(), "aria-atomic");
9216  ASPx.Attr.Aria.SetOrRemoveLabel(messageElement, message);
9217  ASPx.Attr.Aria.SetOrRemoveDescendant(activeElement, messageElement.id);
9218 }
9219});
9220ASPx.AccessibilityPronouncerType = {
9221 live: "live",
9222 descendant: "descendant"
9223};
9224ASPx.AccessibilityPronouncer = new AccessibilityPronouncer();
9225var RestoreFocusHelper = ASPx.CreateClass(null, {
9226 constructor: function() {
9227  this.excludedIDs = [ "DXCBtn" ]; 
9228  this.pronouncerType = ASPx.AccessibilityPronouncerType.live;
9229  this.callbackQueue = [];
9230  this.Initialize();
9231 },
9232 Initialize: function() {
9233  var that = this;
9234  ASPx.attachToLoad(function() {
9235   ASPxClientControl.GetControlCollection().BeginCallback.AddHandler(that.OnBeginCallback, that);
9236   ASPxClientControl.GetControlCollection().EndCallback.AddHandler(that.OnEndCallback, that);
9237  });
9238 },
9239 OnBeginCallback: function(s, e) {
9240  var control = e.control;
9241  if(!control.allowRestoreFocusOnCallbacks())
9242   return;
9243  control.accessibilityFocusTreeLine = this.getFocusTreeLine(control);
9244  var controlHasCallbackTreeLine = this.callbackQueueContainsTreeLine(control);
9245  this.pushTreeLineInfoIntoCallbackQueue(control);
9246  if(control.accessibilityFocusTreeLine && !controlHasCallbackTreeLine)
9247   control.SendMessageToAssistiveTechnology(this.getDefaultCallbackMessage());
9248 },
9249 OnEndCallback: function(s, e) {
9250  var control = e.control;
9251  if(!control.allowRestoreFocusOnCallbacks())
9252   return;
9253  var treeLineInfo = this.shiftTreeLineInfoFromCallbackQueue(control);
9254  if(treeLineInfo.queueLength == 0) {
9255   if(!control.accessibilityFocusTreeLine && treeLineInfo.treeLine)
9256    control.accessibilityFocusTreeLine = treeLineInfo.treeLine;
9257   var focusElement = this.findFocusElement(control);
9258   var focusIsManagerByPopupwindow = this.isFocusManagedByActivePopupWindow(focusElement);
9259   var focusIsManagedByControl = control.shouldPreventFocusRestoringOnCallback && control.shouldPreventFocusRestoringOnCallback();
9260   if(!focusIsManagerByPopupwindow && !focusIsManagedByControl)
9261    ASPx.AccessibilityUtils.SetFocusAccessible(focusElement);
9262   delete control.accessibilityFocusTreeLine;
9263  }
9264 },
9265 pushTreeLineInfoIntoCallbackQueue: function(control) {
9266  var controlTreeLine = control.accessibilityFocusTreeLine ? control.accessibilityFocusTreeLine.slice(0) : null;
9267  if(!this.callbackQueue[control.name])
9268   this.callbackQueue[control.name] = [];
9269  this.callbackQueue[control.name].push(controlTreeLine);
9270 },
9271 shiftTreeLineInfoFromCallbackQueue: function(control) {
9272  var treeLineInfo = { queueLength: 0, treeLine: null };
9273  var treeLines = this.callbackQueue[control.name];
9274  if(treeLines && treeLines.length > 0) {
9275   treeLineInfo.treeLine = treeLines.shift();
9276   var linesCount = treeLines.length;
9277   treeLineInfo.queueLength = linesCount;
9278   if(linesCount > 0 && !treeLines[0] && treeLineInfo.treeLine)
9279    treeLines[0] = treeLineInfo.treeLine.slice(0);
9280  }
9281  return treeLineInfo;
9282 },
9283 callbackQueueContainsTreeLine: function(control) {
9284  var treeLines = this.callbackQueue[control.name];
9285  if(!treeLines || treeLines.length == 0) 
9286   return false;
9287  if(treeLines[treeLines.length - 1])
9288   return true;
9289  return false;
9290 },
9291 getDefaultCallbackMessage: function() {
9292  return ASPx.AccessibilitySR.DefaultCallbackMessage;
9293 },
9294 isFocusManagedByActivePopupWindow: function(focusElement) {
9295  var popupControl = this.getActivePopupControl();
9296  if(!popupControl || popupControl.accessibleFocusElement)
9297   return false;
9298  this.initializePopupAccessibleFocusElement(popupControl, focusElement);
9299  return popupControl.setFocusOnCallback;
9300 },
9301 getActivePopupControl: function() {
9302  var activePopupWindow = ASPx.GetPopupControlCollection && ASPx.GetPopupControlCollection().GetCurrentActiveWindowElement();
9303  if(!activePopupWindow)
9304   return null;
9305  var popupInfo = ASPx.GetPopupControlCollection().GetPopupWindowFromID(activePopupWindow.id);
9306  return popupInfo.popupControl;
9307 },
9308 initializePopupAccessibleFocusElement: function(popupControl, focusElement) {
9309  if(popupControl.setFocusOnCallback)
9310   popupControl.accessibleFocusElement = focusElement;
9311  else {
9312   var parentControl = popupControl.GetParentControl();
9313   if(parentControl && parentControl.GetMainElement())
9314    popupControl.accessibleFocusElement = ASPx.FindFirstChildActionElement(parentControl.GetMainElement());
9315  }
9316 },
9317 getFocusTreeLine: function(control) {
9318  var element = ASPx.GetActiveElement();
9319  if(!ASPx.IsExistsElement(element))
9320   return null;
9321  var mainElement = control.GetMainElement();
9322  if(!ASPx.GetIsParent(mainElement, element)) {
9323   var treeInfo = this.findFocusedControlElement(mainElement, element);
9324   element = treeInfo.focusElement;
9325   mainElement = treeInfo.rootElement;
9326  }
9327  return this.getTreeLineCore(mainElement, element);
9328 },
9329 getTreeLineCore: function(mainElement, element) {
9330  if(!element) return null;
9331  treeLine = [ ];
9332  while(element) {
9333   treeLine.push({ 
9334    id: element.id,
9335    tagName: element.tagName,
9336    index: ASPx.Data.ArrayIndexOf(element.parentNode.childNodes, element)
9337   });
9338   if(element === mainElement || element === document.body)
9339    break;
9340   element = element.parentNode;
9341  }
9342  return treeLine;
9343 },
9344 findFocusedControlElement: function(mainElement, activeElement) {
9345  var element = null;
9346  var parentElement = mainElement;
9347  var focusedEditor = ASPx.IsExists(ASPx.GetFocusedEditor) ? ASPx.GetFocusedEditor() : null;
9348  if(focusedEditor && ASPx.GetIsParent(mainElement, focusedEditor.GetMainElement()))
9349   element = focusedEditor.GetFocusableInputElement();
9350  else {
9351   if(mainElement && activeElement) {
9352    var mainControl = ASPx.GetClientControlByElementID(mainElement.id);
9353    var parentControls = ASPx.GetParentClientControls(activeElement.id);
9354    for(var i = parentControls.length - 1; i > -1; i--) {   
9355     if(mainControl.name == parentControls[i].name) {
9356      element = activeElement;
9357      var rootIndex = i > 0 ? i - 1 : i;
9358      parentElement = parentControls[rootIndex].GetMainElement();
9359      if(!parentElement && parentControls[rootIndex].GetCurrentWindowElement)
9360       parentElement = parentControls[rootIndex].GetCurrentWindowElement();
9361      break;
9362     }
9363    }
9364   }
9365  }
9366  return { focusElement: element, rootElement: parentElement }; 
9367 },
9368 findFocusElement: function(control) {
9369  if(!control.accessibilityFocusTreeLine)
9370   return;
9371  var treeLine = control.accessibilityFocusTreeLine.slice(0);
9372  var focusElementParent = this.findFocusElementParentById(treeLine);
9373  if(!focusElementParent) 
9374   return;
9375  return this.findFocusElementFromDOMTree(treeLine, focusElementParent);
9376 },
9377 findFocusElementParentById: function(treeLine) {
9378  for(var i = 0; i < treeLine.length; i++) {
9379   var id = treeLine[i].id;
9380   if(!this.isValidId(id))
9381    continue;
9382   var element = document.getElementById(id);
9383   if(element) {
9384    treeLine.splice(i, treeLine.length - i);
9385    treeLine.reverse();
9386    return element;
9387   }
9388  }
9389  return null;
9390 },
9391 findFocusElementFromDOMTree: function(treeLine, focusElementParent) {
9392  var element = focusElementParent;
9393  for(var i = 0; i < treeLine.length; i++) {
9394   var info = treeLine[i];
9395   if(info.index >= element.childNodes.length) {
9396    element = element.childNodes.length > 0 ? element.childNodes[element.childNodes.length - 1] : null;
9397    return this.findNeighbourFocusElement(element, focusElementParent);
9398   }
9399   var child = element.childNodes[info.index];
9400   if(child.tagName !== info.tagName)
9401    return this.findNeighbourFocusElement(child, focusElementParent);
9402   element = child;
9403  }
9404  return element;
9405 },
9406 findNeighbourFocusElement: function(element, focusElementParent) {
9407  ASPx.ActionElementsCache.BeginUsage();
9408  var result = this.findNeighbourFocusElementCore(element, focusElementParent);
9409  ASPx.ActionElementsCache.EndUsage();
9410  return result;
9411 },
9412 findNeighbourFocusElementCore: function(element, focusElementParent) {
9413  if(!element || !element.parentNode) return null;
9414  var neighbours = element.parentNode.childNodes;
9415  var indices = this.calcLeftRightIndices(ASPx.Data.ArrayIndexOf(neighbours, element), neighbours.length);
9416  for(var i = 0; i < indices.length; i++) {
9417   var index = indices[i];
9418   var actionElement = ASPx.FindFirstChildActionElement(neighbours[index]);
9419   if(actionElement)
9420    return actionElement;
9421  }
9422  if(element === focusElementParent)
9423   return null;
9424  return this.findNeighbourFocusElement(element.parentNode, focusElementParent);
9425 },
9426 calcLeftRightIndices: function(startIndex, count) {
9427  var indices = [ ];
9428  var incSides = [ 0, 0 ];
9429  var index = startIndex;
9430  for(var i = 0; i < count; i++) {
9431   indices.push(index);
9432   var even = i % 2 === 0;
9433   var nextIndex = this.calcNextIndex(startIndex, count, incSides, even);
9434   if(nextIndex < 0)
9435    nextIndex = this.calcNextIndex(startIndex, count, incSides, !even);
9436   index = nextIndex;
9437  }
9438  return indices;
9439 },
9440 calcNextIndex: function(startIndex, count, incSides, even) {
9441  var sideIndex = even ? 0 : 1;
9442  var inc = incSides[sideIndex];
9443  inc += even ? -1 : 1;
9444  var nextIndex = startIndex + inc;
9445  if(nextIndex >= 0 && nextIndex < count) {
9446   incSides[sideIndex] = inc;
9447   return nextIndex;
9448  }
9449  return -1;
9450 },
9451 isValidId: function(id) {
9452  return id && !this.isExcludedId(id);
9453 },
9454 isExcludedId: function(id) {
9455  var result = false;
9456  for(var i = 0; i < this.excludedIDs.length; i++) {
9457   if(id.indexOf(this.excludedIDs[i]) > -1) {
9458    result = true;
9459    break;
9460   }
9461  }
9462  return result;
9463 }
9464});
9465var EventStorage = ASPx.CreateClass(null, {
9466 constructor: function() {
9467  this.bag = { };
9468 },
9469 Save: function(e, data, overwrite) {
9470  var key = this.getEventKey(e);
9471  if(this.bag.hasOwnProperty(key) && !overwrite)
9472   return;
9473  this.bag[key] = data;
9474  window.setTimeout(function() { delete this.bag[key]; }.aspxBind(this), 100);
9475 },
9476 Load: function(e) {
9477  var key = this.getEventKey(e);
9478  return this.bag[key];
9479 },
9480 getEventKey: function(e) {
9481  if(ASPx.IsExists(e.timeStamp))
9482   return e.timeStamp.toString();
9483  var eventSource = ASPx.Evt.GetEventSource(e);
9484  var type = e.type.toString();
9485  return eventSource ? type + "_" + eventSource.uniqueID.toString() : type;
9486 }
9487});
9488ASPx.RestoreFocusHelper = new RestoreFocusHelper();
9489EventStorage.Instance = null;
9490EventStorage.getInstance = function() {
9491 if(!EventStorage.Instance)
9492  EventStorage.Instance = new EventStorage();
9493 return EventStorage.Instance;
9494};
9495var GetGlobalObject = function(objectName) {
9496 var fields = objectName.split('.');
9497 var obj = window[fields[0]];
9498 for(var i = 1;
9498 obj && i < fields.length; i++) {
9499  obj = obj[fields[i]];
9500 }
9501 return obj;
9502};
9503var GetExternalScriptProcessor = function() {
9504 return ASPx.ExternalScriptProcessor ? ASPx.ExternalScriptProcessor.getInstance() : null;
9505};
9506var SAVED_WIDTH_ATTR = "data-dx-ripple-saved-width";
9507var RIPPLE_FIXED_ROW_ATTR = "data-dx-ripple-locked";
9508var READ_ONLY_COMBOBOX_MARKER_CSS_CLASS = "dxICBReadonlyMarker";
9509var ThemesWithRipple = ['Material'];
9510var RippleHelper = {
9511 rippleTargetClassName: "dxRippleTarget",
9512 rippleTargetExternalClassName: "dxRippleTargetExternal",
9513 rippleContainerClassName: "dxRippleContainer",
9514 rippleClassName: "dxRipple",
9515 touchRadius: -1,
9516 isMobileExternalRipple: null,
9517 zoom: 1,
9518 Init: function() {
9519  if(this.getIsRippleFunctionalityEnabled()) {
9520   setTimeout(function() {
9521    this.calcTouchRadius();
9522   }.aspxBind(this), 0);
9523  }
9524 },
9525 calcTouchRadius: function() {
9526  var testBlock = document.createElement("DIV");
9527  ASPx.SetStyles(testBlock, {
9528   height: "1in",
9529   width: "1in",
9530   left: "-100%",
9531   top: "-100%",
9532   position: "absolute"
9533  });
9534  document.body.appendChild(testBlock);
9535  this.touchRadius = (1.8 / 2.54) * Math.max(testBlock.offsetWidth, testBlock.offsetHeight);
9536  document.body.removeChild(testBlock);
9537 },
9538 isRippleFunctionalityEnabled: null,
9539 checkRippleFunctionality: function() {
9540  if(ASPx.Browser.Safari && ASPx.Browser.Version <= 5.1)
9541   return false;
9542  for(var i = 0; i < ThemesWithRipple.length; i++) {
9543   var firstRippleThemeElement = document.querySelector("[class*='_" + ThemesWithRipple[i] + "']");
9544   if(firstRippleThemeElement)
9545    return true;
9546  }  
9547  return false;
9548 },
9549 ReInit: function() {
9550  this.isRippleFunctionalityEnabled = null;
9551  this.Init();
9552 },
9553 onDocumentMouseDown: function(evt) {
9554  if(RippleHelper.getIsRippleFunctionalityEnabled())
9555   RippleHelper.processMouseDown(evt);
9556 },
9557 getIsRippleFunctionalityEnabled: function() {
9558  if(!ASPx.IsExists(this.isRippleFunctionalityEnabled))
9559   this.isRippleFunctionalityEnabled = this.checkRippleFunctionality();
9560  return this.isRippleFunctionalityEnabled;
9561 },
9562   createTargetInfo: function(target) {
9563  return { 
9564   x: ASPx.GetAbsoluteX(target),
9565   y: ASPx.GetAbsoluteY(target),
9566   width: target.offsetWidth,
9567   height: target.offsetHeight,
9568   classNames: ASPx.GetClassNameList(target),
9569   getTarget: function() { return target; },
9570   getRect: function() { return {x: this.x, y: this.y, width: this.width, height: this.height }; }
9571  };
9572 },
9573 createEventInfo: function(evt) {
9574  return { x: this.getEventX(evt), y: this.getEventY(evt) };
9575 },
9576 processMouseDown: function(evt) {
9577  var evtSource = ASPx.Evt.GetEventSource(evt);
9578  var rippleTarget = this.getRippleTargetElement(evtSource);
9579  if(this.needToProcessRipple(rippleTarget, evtSource))
9580   this.processRipple(this.createTargetInfo(rippleTarget), this.createEventInfo(evt));
9581 },
9582 getRippleTargetElement: function(evtSource) {
9583  if(this.hasRippleMarker(evtSource))
9584   return evtSource;
9585  if(evtSource.tagName && evtSource.tagName.toLowerCase() == "input" && ASPx.ElementContainsCssClass(evtSource, "dxTI")) {
9586   var elements = ASPx.GetChildElementNodesByPredicate(evtSource.parentNode.parentNode, function(element) {
9587    return this.hasRippleMarker(element);
9588   }.aspxBind(this));
9589   return elements && elements[0];
9590  }
9591  return ASPx.GetParent(evtSource, function(element) {
9592   return this.hasRippleMarker(element);
9593  }.aspxBind(this));
9594 },
9595 hasRippleMarker: function(element) {
9596  if(!ASPx.IsExistsElement(element))
9597   return false;
9598  var computedStyles = window.getComputedStyle(element, ":before");
9599  if(ASPx.IsExists(computedStyles)) {
9600   var content = computedStyles.getPropertyValue("content");
9601   if(content.indexOf(this.rippleTargetExternalClassName) > -1) {
9602    ASPx.AddClassNameToElement(element, this.rippleTargetExternalClassName);
9603    return true;
9604   }
9605   return content.indexOf(this.rippleTargetClassName) > -1;
9606  }
9607  return false;
9608 },
9609 needToProcessRipple: function(rippleTarget, evtSource) {
9610  if(!rippleTarget || !ASPx.AnimationUtils)
9611   return false;
9612  var isClearButton = ASPx.ElementContainsCssClass(rippleTarget, "dxeButton") && rippleTarget.id && rippleTarget.id.indexOf("B-100") !== -1;
9613  var isEmptyCalendarDay = ASPx.ElementContainsCssClass(rippleTarget, "dxeCalendarDay") && ASPx.Str.Trim(rippleTarget.textContent) == "";
9614  var isReadonly = ASPx.ElementContainsCssClass(rippleTarget, READ_ONLY_COMBOBOX_MARKER_CSS_CLASS);
9615  var tempFixDisable = ASPx.ElementContainsCssClass(rippleTarget, "dxSwitcher") && ASPx.Browser.MacOSMobilePlatform;
9616  var rippleIsForbidden = isReadonly || isClearButton || isEmptyCalendarDay || ASPx.GetParentByPartialClassName(rippleTarget, "Disabled") ||
9617   ASPx.ElementContainsCssClass(rippleTarget, "dxgvBatchEditCell") || ASPx.ElementContainsCssClass(rippleTarget, "dxcvEditForm") ||
9618   ASPx.GetParentByPartialClassName(evtSource, "dxcvFocusedCell") || tempFixDisable;
9619  return !rippleIsForbidden;
9620 },
9621 hasBothOverflow: function(style) {
9622  return style.overflow == "scroll" || style.overflow == "auto" || style.overflow == "hidden";
9623 },
9624 hasOverflowX: function(style) {
9625  return style.overflowX == "scroll" || style.overflowX == "auto" || style.overflowX == "hidden";
9626 },
9627 hasOverflowY: function(style) {
9628  return style.overflowY == "scroll" || style.overflowY == "auto" || style.overflowY == "hidden";
9629 },
9630 getExternalRippleContainerSize: function(targetRect) {
9631  if(ASPx.Browser.MobileUI) {
9632   var origTouchRadius = this.getOriginTouchRadius();
9633   if(origTouchRadius < targetRect.width || origTouchRadius < targetRect.height)
9634    origTouchRadius = Math.max(targetRect.width, targetRect.height);
9635   return {x: targetRect.x + (targetRect.width - origTouchRadius) / 2, y: targetRect.y + (targetRect.height - origTouchRadius) / 2, width: origTouchRadius, height: origTouchRadius };
9636  }
9637  var result = { x: 0, y: 0, width: 0, height: 0 };
9638  var diff = targetRect.width - targetRect.height;
9639  if(diff > 0) {
9640   result.x = targetRect.x;
9641   result.y = targetRect.y - diff / 2;
9642   result.width = targetRect.width;
9643   result.height = targetRect.width;
9644  } else {
9645   result.x = targetRect.x + diff / 2;
9646   result.y = targetRect.y;
9647   result.width = targetRect.height;
9648   result.height = targetRect.height;
9649  }
9650  return result;
9651 },
9652 getInternalContainerSize: function(targetInfo) {
9653  var parentWithOverflow = RippleHelper.getParentWithOverflow(targetInfo.getTarget());
9654  if(!ASPx.IsExists(parentWithOverflow))
9655   return targetInfo;
9656  var parentWithOverflowStyle = ASPx.GetCurrentStyle(parentWithOverflow);
9657  var bothOverflow = this.hasBothOverflow(parentWithOverflowStyle);
9658  var overflowX = this.hasOverflowX(parentWithOverflowStyle);
9659  var overflowY = this.hasOverflowY(parentWithOverflowStyle);
9660  var parentRect = {
9661   x: ASPx.GetAbsoluteX(parentWithOverflow),
9662   y: ASPx.GetAbsoluteY(parentWithOverflow),
9663   width: parentWithOverflow.offsetWidth,
9664   height: parentWithOverflow.offsetHeight
9665  };
9666  return this.getInternalContainerSizeCore(targetInfo, parentRect, bothOverflow, overflowX, overflowY);
9667 },
9668 getInternalContainerSizeCore: function(targetRect, parentRect, bothOverflow, overflowX, overflowY) {
9669  var result = {};
9670  ASPx.Data.MergeHashTables(result, targetRect);
9671  if(bothOverflow || overflowX) {
9672   result.x = targetRect.x < parentRect.x ? parentRect.x : targetRect.x;
9673   if(targetRect.x + targetRect.width > parentRect.x + parentRect.width)
9674    result.width = parentRect.x + parentRect.width - targetRect.x;
9675   if(parentRect.x > targetRect.x)
9676    result.width -= (parentRect.x - targetRect.x);
9677  }
9678  if(bothOverflow || overflowY) {
9679   result.y = targetRect.y < parentRect.y ? parentRect.y : targetRect.y;
9680   if(targetRect.y + targetRect.height > parentRect.y + parentRect.height)
9681    result.height = parentRect.y + parentRect.height - targetRect.y;
9682   if(parentRect.y > targetRect.y)
9683    result.height -= (parentRect.y - targetRect.y);
9684  }
9685  return result;
9686 },
9687 calculateRippleContainerSize: function(targetInfo, isExternalRipple) {
9688  return isExternalRipple ? this.getExternalRippleContainerSize(targetInfo) : this.getInternalContainerSize(targetInfo);
9689 },
9690 getParentWithOverflow: function(rippleTarget) {
9691  var result = ASPx.GetParent(rippleTarget, function(element) {
9692   var elementStyle = ASPx.GetCurrentStyle(element);
9693   return this.hasBothOverflow(elementStyle) || this.hasOverflowX(elementStyle) || this.hasOverflowY(elementStyle);
9694  }.aspxBind(this));
9695  return result;
9696 },
9697 getDuration: function(targetInfo) {
9698  return this.IsExternalRipple(targetInfo) || ASPx.Browser.MobileUI ? 650 : 450;
9699 },
9700 createRippleTransition: function(container, rippleElement, radius, targetInfo) {
9701  var rippleSize = 2 * radius;
9702  var transitionEndIsAborted = true;
9703  var transitionProperties = {
9704   width: { from: 0, to: rippleSize, transition: ASPx.AnimationConstants.Transitions.RIPPLE, propName: "width", unit: "px" },
9705   height: { from: 0, to: rippleSize, transition: ASPx.AnimationConstants.Transitions.RIPPLE, propName: "height", unit: "px" },
9706   marginLeft: { from: 0, to: -rippleSize / 2, transition: ASPx.AnimationConstants.Transitions.RIPPLE, propName: "marginLeft", unit: "px" },
9707   marginTop: { from: 0, to: -rippleSize / 2, transition: ASPx.AnimationConstants.Transitions.RIPPLE, propName: "marginTop", unit: "px" },
9708   opacity: { from: 1, to: 0.05, transition: ASPx.AnimationConstants.Transitions.RIPPLE, propName: "o
9708pacity", unit: "%" }
9709  };
9710  var rippleTransition = ASPx.AnimationUtils.createMultipleAnimationTransition(rippleElement, {
9711   transition: ASPx.AnimationConstants.Transitions.RIPPLE,
9712   duration: this.getDuration(targetInfo),
9713   onComplete: function() {
9714    this.RemoveRippleContainer(container.parentElement);
9715    transitionEndIsAborted = false;
9716   }.bind(this)
9717  });
9718  rippleTransition.Start(transitionProperties);
9719  window.setTimeout(function() {
9720   if(transitionEndIsAborted)
9721    this.RemoveRippleContainer(container.parentElement);
9722  }.bind(this), 500);
9723 },
9724 calculateRadius: function(isExternalRipple, posX, posY, containerRect) {
9725  var radius = -1;
9726  if(isExternalRipple) {
9727   if(ASPx.Browser.MobileUI)
9728    radius = this.getOriginTouchRadius() / 2;
9729   else
9730    radius = Math.max(containerRect.height, containerRect.width);
9731  } else {
9732   var width1 = posX - containerRect.x;
9733   var width2 = containerRect.width - width1;
9734   var height1 = posY - containerRect.y;
9735   var height2 = containerRect.height - height1;
9736   var rippleWidth = Math.max(width1, width2);
9737   var rippleHeight = Math.max(height1, height2);
9738   radius = Math.sqrt(Math.pow(rippleHeight, 2) + Math.pow(rippleWidth, 2));
9739  }
9740  return radius;
9741 },
9742 createRippleElement: function(container, rippleCenter) {
9743  var rippleElement = document.createElement("DIV");
9744  rippleElement.className = this.rippleClassName;
9745  container.appendChild(rippleElement);
9746  ASPxClientUtils.SetAbsoluteX(rippleElement, rippleCenter.x);
9747  ASPxClientUtils.SetAbsoluteY(rippleElement, rippleCenter.y);
9748  return rippleElement;
9749 },
9750 processRipple: function(targetInfo, eventInfo) {
9751  this.initRippleProcess();
9752  var isExternalRipple = this.IsExternalRipple(targetInfo);
9753  var rippleCenter = this.getRippleCenter(targetInfo.getRect(), eventInfo, isExternalRipple);
9754  var container = this.createRippleContainer(targetInfo, isExternalRipple);
9755  var rippleElement = this.createRippleElement(container, rippleCenter);
9756  var radius = this.calculateRadius(isExternalRipple, rippleCenter.x, rippleCenter.y, this.getElementRect(container));
9757  this.createRippleTransition(container, rippleElement, radius, targetInfo);
9758 },
9759 initRippleProcess: function() {
9760  this.isMobileExternalRipple = null;
9761  this.zoom = screen.width / window.innerWidth;
9762 },
9763 getRippleCenter: function(targetInfo, eventInfo, isExternalRipple) {
9764  var posX = 0;
9765  var posY = 0;
9766  if(isExternalRipple) {
9767   posX = targetInfo.x + targetInfo.width / 2;
9768   posY = targetInfo.y + targetInfo.height / 2;
9769  } else {
9770   posX = eventInfo.x;
9771   posY = eventInfo.y;
9772  }
9773  return {x: posX, y: posY};
9774 },
9775 createRippleContainer: function(targetInfo, isExternalRipple) {
9776  var containerParent = targetInfo.getTarget();
9777  if(!containerParent)
9778   return;
9779  var containerTagName = containerParent.tagName == "TR" ? "TD" : "DIV";
9780  var container = document.createElement(containerTagName);
9781  container.className = this.rippleContainerClassName;
9782  if(containerParent.parentNode && containerParent.tagName == "IMG")
9783   containerParent = containerParent.parentNode;
9784  if(this.isARowInFixedLayoutTable(containerParent))
9785   this.lockFixedLayoutTableSizes(containerParent);
9786  containerParent.appendChild(container);
9787  if(isExternalRipple)
9788   container.style.borderRadius = "50%";
9789  var containerRect = this.calculateRippleContainerSize(targetInfo, isExternalRipple);
9790  this.assignContainerSettings(container, containerRect);
9791  return container;
9792 },
9793 isARowInFixedLayoutTable: function(containerParent) {
9794  if(containerParent.tagName !== "TR")
9795   return false;
9796  var parentTable = this.getParentTable(containerParent);
9797  return parentTable && ASPx.GetCurrentStyle(parentTable)["table-layout"] === "fixed";
9798 },
9799 processFirstRowOfFixedTable: function(containerRow, rowAction, cellAction) {
9800  var firstRow = this.getFirstRow(containerRow);
9801  rowAction(firstRow);
9802  var cells = ASPx.Data.CollectionToArray(firstRow.cells);
9803  cells.forEach(cellAction);
9804 },
9805 getParentTable: function(element) {
9806  var parentTable = element;
9807  while(parentTable && parentTable.tagName !== "TABLE")
9808   parentTable = parentTable.parentElement;
9809  return parentTable;
9810 },
9811 lockFixedLayoutTableSizes: function(containerRow) {
9812  var firstRow = this.getFirstRow(containerRow);
9813  if(this.incLockCount(firstRow) === 1) {
9814   var cells = ASPx.Data.CollectionToArray(firstRow.cells);
9815   var widths = cells.map(function(cell) { return cell.style.width; });
9816   var computedWidths = cells.map(function(cell) {
9817    if(ASPx.Browser.IE && ASPx.ElementHasCssClass(cell, "dxeCM"))
9818     return cell.offsetWidth + "px";
9819    return window.getComputedStyle(cell).width;
9820   });
9821   var fixWidth = function(cell, i) {
9822    if(ASPx.Attr.IsExistsAttribute(cell, SAVED_WIDTH_ATTR))
9823     return;
9824    if(widths[i])
9825     ASPx.Attr.SetAttribute(cell, SAVED_WIDTH_ATTR, widths[i]);
9826    cell.style.width = computedWidths[i];
9827   };
9828   cells.forEach(fixWidth);
9829  }
9830 }, 
9831 unlockFixedLayoutTableSizes: function(containerRow) {
9832  var firstRow = this.getFirstRow(containerRow);   
9833  if(this.decLockCount(firstRow) === 0) {
9834   var cells = ASPx.Data.CollectionToArray(firstRow.cells);
9835   var restoreState = function(cell) {
9836    if(ASPx.Attr.IsExistsAttribute(cell, SAVED_WIDTH_ATTR)) {
9837     cell.style.width = ASPx.Attr.GetAttribute(cell, SAVED_WIDTH_ATTR);
9838     ASPx.Attr.RemoveAttribute(cell, SAVED_WIDTH_ATTR);
9839    } else {
9840     cell.style.width = null;
9841    }
9842   };
9843   cells.forEach(restoreState);
9844  }
9845 },
9846 getFirstRow: function(containerRow) { return ASPx.GetChildByTagName(containerRow.parentElement, "TR", 0); },
9847 incLockCount: function(elem) { return this.changeLockCount(elem, 1); },
9848 decLockCount: function(elem) { return this.changeLockCount(elem, -1); },
9849 changeLockCount: function(elem, diff) {
9850  var lockCounter = this.getLockCount(elem);
9851  lockCounter += diff;
9852  lockCounter = Math.max(0, lockCounter);
9853  if(lockCounter === 0)
9854   ASPx.Attr.RemoveAttribute(elem, RIPPLE_FIXED_ROW_ATTR);
9855  else
9856   ASPx.Attr.SetAttribute(elem, RIPPLE_FIXED_ROW_ATTR, lockCounter);
9857  return lockCounter;
9858 },
9859 getLockCount: function(lockElement) {
9860  var attrValue = ASPx.Attr.GetAttribute(lockElement, RIPPLE_FIXED_ROW_ATTR);
9861  return parseInt(attrValue) || 0;
9862 },
9863 assignContainerSettings: function(container, containerRect) {
9864  var properties = {
9865   height: containerRect.height,
9866   width: containerRect.width,
9867   left: ASPx.PrepareClientPosForElement(containerRect.x, container, true),
9868   top: ASPx.PrepareClientPosForElement(containerRect.y, container, false)
9869  };
9870  if(ASPx.Browser.MobileUI)
9871   ASPx.Data.MergeHashTables(properties, {marginTop: 0, marginLeft: 0 });
9872  ASPx.SetStyles(container, properties, ASPx.Browser.MobileUI);
9873 },
9874 IsExternalRipple: function(targetInfo) {
9875  var hasExternalRippleClassName = ASPx.ElementContainsCssClass(targetInfo.getTarget(), this.rippleTargetExternalClassName);
9876  if(!ASPx.Browser.MobileUI)
9877   return hasExternalRippleClassName;
9878  return hasExternalRippleClassName || this.IsMobileExternalRipple(targetInfo);
9879 },
9880 IsMobileExternalRipple: function(targetInfo) {
9881  if(this.isMobileExternalRipple == null) {
9882   var originTouchRadius = this.getOriginTouchRadius();
9883   this.isMobileExternalRipple = ASPx.Browser.MobileUI && targetInfo.width < originTouchRadius && targetInfo.height < originTouchRadius;
9884  }
9885  return this.isMobileExternalRipple;
9886 },
9887 RemoveRippleContainer: function(element) {
9888  if(!element)
9889   return;
9890  var childs = ASPx.GetChildNodesByClassName(element, this.rippleContainerClassName);
9891  var rippleContainer = childs.length > 0 ? childs[0] : null;
9892  if(rippleContainer != null) {
9893   var containerParent = rippleContainer.parentNode;
9894   containerParent.removeChild(rippleContainer);
9895   if(this.isARowInFixedLayoutTable(containerParent))
9896    this.unlockFixedLayoutTableSizes(containerParent);
9897  }
9898 },
9899 getEventX: function(evt) {
9900  return ASPxClientUtils.GetEventX(evt);
9901 },
9902 getEventY: function(evt) {
9903  return ASPxClientUtils.GetEventY(evt);
9904 },
9905 getOriginTouchRadius: function() {
9906  return this.touchRadius / this.zoom;
9907 },
9908 getElementRect: function(element) {
9909  return { x: ASPx.GetAbsoluteX(element), y: ASPx.GetAbsoluteY(element), width: element.offsetWidth, height: element.offsetHeight };
9910 }
9911};
9912var AccessibilitySR = {
9913 AddStringResources: function(stringResourcesObj) {
9914  if(stringResourcesObj) {
9915   for(var key in stringResourcesObj)
9916    if(stringResourcesObj.hasOwnProperty(key))
9917     this[key] = stringResourcesObj[key];
9918  }
9919 }
9920};
9921ASPx.CollectionBase = CollectionBase;
9922ASPx.FunctionIsInCallstack = _aspxFunctionIsInCallstack;
9923ASPx.RaisePostHandlerOnPost = aspxRaisePostHandlerOnPost;
9924ASPx.GetPostHandler = aspxGetPostHandler;
9925ASPx.ProcessScriptsAndLinks = _aspxProcessScriptsAndLinks;
9926ASPx.InitializeLinks = _aspxInitializeLinks;
9927ASPx.InitializeScripts = _aspxInitializeScripts;
9928ASPx.RunStartupScripts = _aspxRunStartupScripts;
9929ASPx.IsStartupScriptsRunning = _aspxIsStartupScriptsRunning;
9930ASPx.AddScriptsRestartHandler = _aspxAddScriptsRestartHandler;
9931ASPx.GetFocusedElement = _aspxGetFocusedElement;
9932ASPx.GetDomObserver = _aspxGetDomObserver;
9933ASPx.CacheHelper = CacheHelper;
9934ASPx.ControlTree = ControlTree;
9935ASPx.ControlAdjuster = ControlAdjuster;
9936ASPx.GetControlAdjuster = GetControlAdjuster;
9937ASPx.ControlCallbackHandlersQueue = ControlCallbackHandlersQueue;
9938ASPx.ResourceManager = ResourceManager;
9939ASPx.UpdateWatcherHelper = UpdateWatcherHelper;
9940ASPx.EventStorage = EventStorage;
9941ASPx.GetGlobalObject = GetGlobalObject;
9942ASPx.GetExternalScriptProcessor = GetExternalScriptProcessor;
9943ASPx.CheckBoxCheckState = CheckBoxCheckState;
9944ASPx.CheckBoxInputKey = CheckBoxInputKey;
9945ASPx.CheckableElementStateController = CheckableElementStateController;
9946ASPx.CheckableElementHelper = CheckableElementHelper;
9947ASPx.CheckBoxInternal = CheckBoxInternal;
9948ASPx.CheckBoxInternalCollection = CheckBoxInternalCollection;
9949ASPx.ControlCallbackQueueHelper = ControlCallbackQueueHelper;
9950ASPx.FocusedStyleDecoration = FocusedStyleDecoration;
9951ASPx.EditorStyleDecoration = EditorStyleDecoration;
9952ASPx.TextEditorStyleDecoration = TextEditorStyleDecoration;
9953ASPx.AccessibilitySR = AccessibilitySR;
9954ASPx.KbdHelper = KbdHelper;
9955ASPx.AccessKeysHelper = AccessKeysHelper;
9956ASPx.AccessKey = AccessKey;
9957ASPx.IFrameHelper = IFrameHelper;
9958ASPx.Ident = Ident;
9959ASPx.TouchUIHelper = TouchUIHelper;
9960ASPx.ControlUpdateWatcher = ControlUpdateWatcher;
9961ASPx.ControlTabIndexManager = ControlTabIndexManager;
9962ASPx.AccessibilityHelperBase = AccessibilityHelperBase;
9963ASPx.RippleHelper = RippleHelper;
9964ASPx.ThemesWithRipple = ThemesWithRipple;
9965window.ASPxClientEvent = ASPxClientEvent;
9966window.ASPxClientEventArgs = ASPxClientEventArgs;
9967window.ASPxClientCancelEventArgs = ASPxClientCancelEventArgs;
9968window.ASPxClientProcessingModeEventArgs = ASPxClientProcessingModeEventArgs;
9969window.ASPxClientProcessingModeCancelEventArgs = ASPxClientProcessingModeCancelEventArgs;
9970ASPx.Evt.AttachEventToDocument(TouchUIHelper.touchMouseDownEventName, RippleHelper.onDocumentMouseDown);
9971ASPx.classesScriptParsed = true;
9972})(ASPx, { GCCheckInterval: 5000 });
9973
9974(function () {
9975ASPx.StateItemsExist = false;
9976ASPx.FocusedItemKind = "FocusedStateItem";
9977ASPx.HoverItemKind = "HoverStateItem";
9978ASPx.PressedItemKind = "PressedStateItem";
9979ASPx.SelectedItemKind = "SelectedStateItem";
9980ASPx.DisabledItemKind = "DisabledStateItem";
9981ASPx.ReadOnlyItemKind = "ReadOnlyStateItem";
9982ASPx.CachedStatePrefix = "cached";
9983ASPxStateItem = ASPx.CreateClass(null, {
9984 constructor: function(name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, kind, disableApplyingStyleToLink){
9985  this.name = name;
9986  this.classNames = classNames;
9987  this.customClassNames = [];
9988  this.resultClassNames = [];
9989  this.cssTexts = cssTexts;
9990  this.postfixes = postfixes;
9991  this.imageObjs = imageObjs;
9992  this.imagePostfixes = imagePostfixes;
9993  this.kind = kind;
9994  this.classNamePostfix = kind.substr(0, 1).toLowerCase();
9995  this.enabled = true;
9996  this.needRefreshBetweenElements = false;
9997  this.elements = null;
9998  this.images = null;
9999  this.links = [];
10000  this.linkColor = null;
10001  this.linkTextDecoration = null;
10002  this.disableApplyingStyleToLink = !!disableApplyingStyleToLink; 
10003 },
10004 GetCssText: function(index){
10005  if(ASPx.IsExists(this.cssTexts[index]))
10006   return this.cssTexts[index];
10007  return this.cssTexts[0];
10008 },
10009 CreateStyleRule: function(index){
10010  if(this.GetCssText(index) == "") return "";
10011  var styleSheet = ASPx.GetCurrentStyleSheet();
10012  if(styleSheet)
10013   return ASPx.CreateImportantStyleRule(styleSheet, this.GetCssText(index), this.classNamePostfix);  
10014  return ""; 
10015 },
10016 GetClassName: function(index){
10017  if(ASPx.IsExists(this.classNames[index]))
10018   return this.classNames[index];
10019  return this.classNames[0];
10020 },
10021 GetResultClassName: function(index){
10022  if(!ASPx.IsExists(this.resultClassNames[index])) {
10023   if(!ASPx.IsExists(this.customClassNames[index]))
10024    this.customClassNames[index] = this.CreateStyleRule(index);
10025   if(this.GetClassName(index) != "" && this.customClassNames[index] != "")
10026    this.resultClassNames[index] = this.GetClassName(index) + " " + this.customClassNames[index];
10027   else if(this.GetClassName(index) != "")
10028    this.resultClassNames[index] = this.GetClassName(index);
10029   else if(this.customClassNames[index] != "")
10030    this.resultClassNames[index] = this.customClassNames[index];
10031   else
10032    this.resultClassNames[index] = "";
10033  }
10034  return this.resultClassNames[index];
10035 },
10036 GetElements: function(element){
10037  if(!this.elements || !ASPx.IsValidElements(this.elements)){
10038   if(this.postfixes && this.postfixes.length > 0){
10039    this.elements = [ ];
10040    var parentNode = element.parentNode;
10041    if(parentNode){
10042     for(var i = 0; i < this.postfixes.length; i++){
10043      var id = this.name + this.postfixes[i];
10044      this.elements[i] = ASPx.GetChildById(parentNode, id);
10045      if(!this.elements[i])
10046       this.elements[i] = ASPx.GetElementById(id);
10047     }
10048    }
10049   }
10050   else
10051    this.elements = [element];
10052  }
10053  return this.elements;
10054 },
10055 GetImages: function(element){
10056  if(!this.images || !ASPx.IsValidElements(this.images)){
10057   this.images = [ ];
10058   if(this.imagePostfixes && this.imagePostfixes.length > 0){
10059    var elements = this.GetElements(element);
10060    for(var i = 0; i < this.imagePostfixes.length; i++){
10061     var id = this.name + this.imagePostfixes[i];
10062     for(var j = 0; j < elements.length; j++){
10063      if(!elements[j]) continue;
10064      if(elements[j].id == id)
10065       this.images[i] = elements[j];
10066      else
10067       this.images[i] = ASPx.GetChildById(elements[j], id);
10068      if(this.images[i])
10069       break;
10070     }
10071    }
10072   }
10073  }
10074  return this.images;
10075 },
10076 Apply: function(element){
10077  if(!this.enabled) return;
10078  try{
10079   this.ApplyStyle(element);
10080   if(this.imageObjs && this.imageObjs.length > 0)
10081    this.ApplyImage(element);
10082   if(ASPx.Browser.IE && ASPx.Browser.MajorVersion >= 11 && ASPx.Browser.PlaformMajorVersion < 10)
10083    this.ForceRedrawAppearance(element);
10084  }
10085  catch(e){
10086  }
10087 },
10088 ApplyStyle: function(element){
10089  var elements = this.GetElements(element);
10090  for(var i = 0; i < elements.length; i++){
10091   if(!elements[i]) continue;
10092   if(this.GetResultClassName(i) != "") {
10093    var className = elements[i].className.replace(this.GetResultClassName(i), "");
10094    elements[i].className = ASPx.Str.Trim(className) + " " + this.GetResultClassName(i);
10095   }
10096   if(!ASPx.Browser.Opera || ASPx.Browser.Version >= 9)
10097    this.ApplyStyleToLinks(elements, i);
10098  }
10099 },
10100 ApplyStyleToLinks: function(elements, index){
10101  if(this.disableApplyingStyleToLink)
10102   return;
10103  if(!ASPx.IsValidElements(this.links[index]))
10104   this.links[index] = ASPx.GetNodesByTagName(elements[index], "A");
10105  for(var i = 0; i < this.links[index].length; i++)
10106   this.ApplyStyleToLinkElement(this.links[index][i], index);
10107 },
10108 ApplyStyleToLinkElement: function(link, index){
10109  if(this.GetLinkColor(index) != "")
10110   ASPx.Attr.ChangeAttributeExtended(link.style, "color", link, "saved" + this.kind + "Color", this.GetLinkColor(index));
10111  if(this.GetLinkTextDecoration(index) != "")
10112   ASPx.Attr.ChangeAttributeExtended(link.style, "textDecoration", link, "saved" + this.kind + "TextDecoration", this.GetLinkTextDecoration(index));
10113 },
10114 ApplyImage: function(element){
10115  var images = this.GetImages(element);
10116  for(var i = 0; i < images.length; i++){
10117   if(!images[i] || !this.imageObjs[i]) continue;
10118   var useSpriteImage = typeof(this.imageObjs[i]) != "string";
10119   var newUrl = "", newCssClass = "", newBackground = "";
10120   if(useSpriteImage){
10121    newUrl = ASPx.EmptyImageUrl;           
10122    if(this.imageObjs[i].spriteCssClass) 
10123     newCssClass = this.imageObjs[i].spriteCssClass;
10124    if(this.imageObjs[i].spriteBackground)
10125     newBackground = this.imageObjs[i].spriteBackground;
10126   }
10127   else{
10128    newUrl = this.imageObjs[i];
10129    if(ASPx.Attr.IsExistsAttribute(images[i].style, "background"))   
10130     newBackground = " ";
10131   }
10132   if(newUrl != "")
10133    ASPx.Attr.ChangeAttributeExtended(images[i], "src", images[i], "saved" + this.kind + "Src", newUrl);
10134   if(newCssClass != "")
10135    this.ApplyImageClassName(images[i], newCssClass);
10136   if(newBackground != ""){
10137    if(ASPx.Browser.WebKitFamily) {
10138     var savedBackground = ASPx.Attr.GetAttribute(images[i].style, "background");
10139     if(!useSpriteImage)
10140      savedBackground += " " + images[i].style["backgroundPosition"];
10141     ASPx.Attr.SetAttribute(images[i], "saved" + this.kind + "Background", savedBackground);
10142     ASPx.Attr.SetAttribute(images[i].style, "background", newBackground);
10143    }
10144    else
10145     ASPx.Attr.ChangeAttributeExtended(images[i].style, "background", images[i], "saved" + this.kind + "Background", newBackground);
10146   }     
10147  }
10148 },
10149 ApplyImageClassName: function(element, newClassName){
10150  if(ASPx.Attr.GetAttribute(element, "saved" + this.kind + "ClassName"))
10151   this.CancelImageClassName(element);
10152  var className = element.className;
10153  ASPx.Attr.SetAttribute(element, "saved" + this.kind + "ClassName", className);
10154  element.className = className + " " + newClassName;
10155 },
10156 Cancel: function(element){
10157  if(!this.enabled) return;
10158  try{  
10159   if(this.imageObjs && this.imageObjs.length > 0)
10160    this.CancelImage(element);
10161   this.CancelStyle(element);
10162  }
10163  catch(e){
10164  }
10165 },
10166 CancelStyle: function(element){
10167  var elements = this.GetElements(element);
10168  for(var i = 0; i < elements.length; i++){
10169   if(!elements[i]) continue;
10170   if(this.GetResultClassName(i) != "") {
10171    var className = ASPx.Str.Trim(elements[i].className.replace(this.GetResultClassName(i), ""));
10172    elements[i].className = className;
10173   }
10174   if(!ASPx.Browser.Opera || ASPx.Browser.Version >= 9)
10175    this.CancelStyleFromLinks(elements, i);
10176  }
10177 },
10178 CancelStyleFromLinks: function(elements, index){
10179  if(this.disableApplyingStyleToLink)
10180   return;
10181  if(!ASPx.IsValidElements(this.links[index]))
10182   this.links[index] = ASPx.GetNodesByTagName(elements[index], "A");
10183  for(var i = 0; i < this.links[index].length; i++)
10184   this.CancelStyleFromLinkElement(this.links[index][i], index);
10185 },
10186 CancelStyleFromLinkElement: function(link, index){
10187  if(this.GetLinkColor(index) != "")
10188   ASPx.Attr.RestoreAttributeExtended(link.style, "color", link, "saved" + this.kind + "Color");
10189  if(this.GetLinkTextDecoration(index) != "")
10190   ASPx.Attr.RestoreAttributeExtended(link.style, "textDecoration", link, "saved" + this.kind + "TextDecoration");
10191 },
10192 CancelImage: function(element){
10193  var images = this.GetImages(element);
10194  for(var i = 0; i < images.length; i++){
10195   if(!images[i] || !this.imageObjs[i]) continue;
10196   ASPx.Attr.RestoreAttributeExtended(images[i], "src", images[i], "saved" + this.kind + "Src");
10197   this.CancelImageClassName(images[i]);
10198   ASPx.Attr.RestoreAttributeExtended(images[i].style, "background", images[i], "saved" + this.kind + "Background");
10199  }
10200 },
10201 CancelImageClassName: function(element){
10202  var savedClassName = ASPx.Attr.GetAttribute(element, "saved" + this.kind + "ClassName");
10203  if(ASPx.IsExists(savedClassName)) {
10204   element.className = savedClassName;
10205   ASPx.Attr.RemoveAttribute(element, "saved" + this.kind + "ClassName");
10206  }
10207 },
10208 Clone: function(){
10209  return new ASPxStateItem(this.name, this.classNames, this.cssTexts, this.postfixes, 
10210   this.imageObjs, this.imagePostfixes, this.kind, this.disableApplyingStyleToLink);
10211 },
10212 IsChildElement: function(element){
10213  if(element != null){
10214   var elements = this.GetElements(element);
10215   for(var i = 0; i < elements.length; i++){
10216    if(!elements[i]) continue;
10217    if(ASPx.GetIsParent(elements[i], element)) 
10218     return true;
10219   }
10220  }
10221  return false;
10222 },
10223 ForceRedrawAppearance: function(element) {
10224  if(!aspxGetStateController().IsForceRedrawAppearanceLocked()) {
10225   var value = element.style.opacity;
10226   element.style.opacity = "0.7777";
10227   var dummy = element.offsetWidth;
10228   element.style.opacity = value;
10229  }
10230 },
10231 GetLinkColor: function(index){
10232  if(!ASPx.IsExists(this.linkColor)){
10233   var rule = ASPx.GetStyleSheetRules(this.customClassNames[index]);
10234   this.linkColor = rule ? rule.style.color : null;
10235   if(!ASPx.IsExists(this.linkColor)){
10236    var rule = ASPx.GetStyleSheetRules(this.GetClassName(index));
10237    this.linkColor = rule ? rule.style.color : null;
10238   }
10239   if(this.linkColor == null) 
10240    this.linkColor = "";
10241  }
10242  return this.linkColor;
10243 },
10244 GetLinkTextDecoration: function(index){
10245  if(!ASPx.IsExists(this.linkTextDecoration)){
10246   var rule = ASPx.GetStyleSheetRules(this.customClassNames[index]);
10247   this.linkTextDecoration = rule ? rule.style.textDecoration : null;
10248   if(!ASPx.IsExists(this.linkTextDecoration)){
10249    var rule = ASPx.GetStyleSheetRules(this.GetClassName(index));
10250    this.linkTextDecoration = rule ? rule.style.textDecoration : null;
10251   }
10252   if(this.linkTextDecoration == null) 
10253    this.linkTextDecoration = "";
10254  }
10255  return this.linkTextDecoration;
10256 }
10257});
10258ASPxClientStateEventArgs = ASPx.CreateClass(null, {
10259 constructor: function(item, element){
10260  this.item = item;
10261  this.element = element;
10262  this.toElement = null;
10263  this.fromElement = null;
10264  this.htmlEvent = null;
10265 }
10266});
10267ASPxStateController = ASPx.CreateClass(null, {
10268 constructor: function(){
10269  this.focusedItems = { };
10270  this.hoverItems = { };
10271  this.pressedItems = { };
10272  this.selectedItems = { };
10273  this.disabledItems = {};
10274  this.readOnlyItems = {};
10275  this.disabledScheme = {};
10276  this.currentFocusedElement = null;
10277  this.currentFocusedItemName = null;
10278  this.currentHoverElement = null;
10279  this.currentHoverItemName = null;
10280  this.currentPressedElement = null;
10281  this.currentPressedItemName = null;
10282  this.savedCurrentPressedElement = null;
10283  this.savedCurrentMouseMoveSrcElement = null;
10284  this.forceRedrawAppearanceLockCount = 0;
10285  this.stateItemType = ASPxStateItem;
10286  this.AfterSetFocusedState = new ASPxClientEvent();
10287  this.AfterClearFocusedState = new ASPxClientEvent();
10288  this.AfterSetHoverState = new ASPxClientEvent();
10289  this.AfterClearHoverState = new ASPxClientEvent();
10290  this.AfterSetPressedState = new ASPxClientEvent();
10291  this.AfterClearPressedState = new ASPxClientEvent();
10292  this.AfterDisabled = new ASPxClientEvent();
10293  this.AfterEnabled = new ASPxClientEvent();
10294  this.BeforeSetFocusedState = new ASPxClientEvent();
10295  this.BeforeClearFocusedState = new ASPxClientEvent();
10296  this.BeforeSetHoverState = new ASPxClientEvent();
10297  this.BeforeClearHoverState = new ASPxClientEvent();
10298  this.BeforeSetPressedState = new ASPxClientEvent();
10299  this.BeforeClearPressedState = new ASPxClientEvent();
10300  this.BeforeDisabled = new ASPxClientEvent();
10301  this.BeforeEnabled = new ASPxClientEvent();
10302  this.FocusedItemKeyDown = new ASPxClientEvent();
10303 }, 
10304 AddHoverItem: function(name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, disableApplyingStyleToLink){
10305  this.AddItem(this.hoverItems, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, ASPx.HoverItemKind, disableApplyingStyleToLink);
10306  this.AddItem(this.focusedItems, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, ASPx.FocusedItemKind, disableApplyingStyleToLink);
10307 },
10308 AddPressedItem: function(name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, disableApplyingStyleToLink){
10309  this.AddItem(this.pressedItems, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, ASPx.PressedItemKind, disableApplyingStyleToLink);
10310 },
10311 AddSelectedItem: function(name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, disableApplyingStyleToLink){
10312  this.AddItem(this.selectedItems, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, ASPx.SelectedItemKind, disableApplyingStyleToLink);
10313 },
10314 AddDisabledItem: function (name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, disableApplyingStyleToLink, rootId) {
10315  this.AddItem(this.disabledItems, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes,
10316   ASPx.DisabledItemKind, disableApplyingStyleToLink, this.addIdToDisabledItemScheme, rootId);
10317 },
10318 AddReadOnlyItem: function(name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, disableApplyingStyleToLink) {
10319  this.AddItem(this.readOnlyItems, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, ASPx.ReadOnlyItemKind, disableApplyingStyleToLink);
10320 },
10321 addIdToDisabledItemScheme: function(rootId, childId) {
10322  if (!rootId)
10323   return;
10324  if (!this.disabledScheme[rootId])
10325   this.disabledScheme[rootId] = [rootId];
10326  if (childId && (rootId != childId) && ASPx.Data.ArrayIndexOf(this.disabledScheme[rootId], childId) == -1)
10327   this.disabledScheme[rootId].push(childId);
10328 },
10329 removeIdFromDisabledItemScheme: function(rootId, childId) {
10330  if (!rootId || !this.disabledScheme[rootId])
10331   return;
10332  ASPx.Data.ArrayRemove(this.disabledScheme[rootId], childId);
10333  if (this.disabledScheme[rootId].length == 0)
10334   delete this.disabledScheme[rootId];
10335 },
10336 AddItem: function (items, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, kind, disableApplyingStyleToLink, onAdd, rootId) {
10337  var type = this.getStateItemType();
10338  var stateItem = new type(name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, kind, disableApplyingStyleToLink);
10339  if (postfixes && postfixes.length > 0) {
10340   for (var i = 0; i < postfixes.length; i++) {
10341    items[name + postfixes[i]] = stateItem;
10342    if (onAdd)
10343     onAdd.call(this, rootId, name + postfixes[i]);
10344   }
10345  }
10346  else {
10347   if (onAdd)
10348    onAdd.call(this, rootId, name);
10349   items[name] = stateItem;
10350  }
10351  ASPx.StateItemsExist = true;
10352 },
10353 getStateItemType: function () { return this.stateItemType; },
10354 withCustomStateItemType: function (newType, callback) {
10355  this.stateItemType = newType;
10356  callback(this);
10357  this.stateItemType = ASPxStateItem;
10358 },
10359 RemoveHoverItem: function(name, postfixes){
10360  this.RemoveItem(this.hoverItems, name, postfixes);
10361  this.RemoveItem(this.focusedItems, name, postfixes);
10362 },
10363 RemovePressedItem: function(name, postfixes){
10364  this.RemoveItem(this.pressedItems, name, postfixes);
10365 },
10366 RemoveSelectedItem: function(name, postfixes){
10367  this.RemoveItem(this.selectedItems, name, postfixes);
10368 },
10369 RemoveDisabledItem: function (name, postfixes, rootId) {
10370  this.RemoveItem(this.disabledItems, name, postfixes, this.removeIdFromDisabledItemScheme, rootId);
10371 },
10372 RemoveReadOnlyItem: function(name, postfixes) {
10373  this.RemoveItem(this.readOnlyItems, name, postfixes);
10374 },
10375 RemoveItem: function (items, name, postfixes, onRemove, rootId) {
10376  if (postfixes && postfixes.length > 0) {
10377   for (var i = 0; i < postfixes.length; i++) {
10378    delete items[name + postfixes[i]];
10379    if (onRemove)
10380     onRemove.call(this, rootId, name + postfixes[i]);
10381   }
10382  }
10383  else {
10384   delete items[name];
10385   if (onRemove)
10386    onRemove.call(this, rootId, name);
10387  }
10388 },
10389 RemoveDisposedItems: function(){
10390  this.RemoveDisposedItemsByType(this.hoverItems);
10391  this.RemoveDisposedItemsByType(this.pressedItems);
10392  this.RemoveDisposedItemsByType(this.focusedItems);
10393  this.RemoveDisposedItemsByType(this.selectedItems);
10394  this.RemoveDisposedItemsByType(this.disabledItems);
10395  this.RemoveDisposedItemsByType(this.disabledScheme);
10396  this.RemoveDisposedItemsByType(this.readOnlyItems);
10397 },
10398 RemoveDisposedItemsByType: function(items){
10399  for(var key in items) {
10400   if(items.hasOwnProperty(key)) {
10401    var item = items[key];
10402    var element = document.getElementById(key);
10403    if(!element || !ASPx.IsValidElement(element))
10404     delete items[key];
10405    try {
10406     if(item && item.elements) {
10407      for(var i = 0; i < item.elements.length; i++) {
10408       if(!ASPx.IsValidElements(item.links[i]))
10409        item.links[i] = null;
10410      }
10411     }
10412    }
10413    catch(e) {
10414    }
10415   }
10416  }
10417 },
10418 GetFocusedElement: function(srcElement){
10419  return this.GetItemElement(srcElement, this.focusedItems, ASPx.FocusedItemKind);
10420 },
10421 GetHoverElement: function(srcElement){
10422  return this.GetItemElement(srcElement, this.hoverItems, ASPx.HoverItemKind);
10423 },
10424 GetPressedElement: function(srcElement){
10425  return this.GetItemElement(srcElement, this.pressedItems, ASPx.PressedItemKind);
10426 },
10427 GetSelectedElement: function(srcElement){
10428  return this.GetItemElement(srcElement, this.selectedItems, ASPx.SelectedItemKind);
10429 },
10430 GetDisabledElement: function(srcElement){
10431  return this.GetItemElement(srcElement, this.disabledItems, ASPx.DisabledItemKind);
10432 },
10433 GetReadOnlyElement: function(srcElement) {
10434  return this.GetItemElement(srcElement, this.readOnlyItems, ASPx.ReadOnlyItemKind);
10435 },
10436 GetItemElement: function(srcElement, items, kind){
10437  if(srcElement && srcElement[ASPx.CachedStatePrefix + kind]){
10438   var cachedElement = srcElement[ASPx.CachedStatePrefix + kind];
10439   if(cachedElement != ASPx.EmptyObject)
10440    return cachedElement;
10441   return null;
10442  }
10443  var element = srcElement;
10444  while(element != null) {
10445   var item = items[element.id];
10446   if(item){
10447    this.CacheItemElement(srcElement, kind, element);
10448    element[kind] = item;
10449    return element;
10450   }
10451   element = element.parentNode;
10452  }
10453  this.CacheItemElement(srcElement, kind, ASPx.EmptyObject);
10454  return null;
10455 },
10456 CacheItemElement: function(srcElement, kind, value){
10457  if(srcElement && !srcElement[ASPx.CachedStatePrefix + kind])
10458   srcElement[ASPx.CachedStatePrefix + kind] = value;
10459 },
10460 DoSetFocusedState: function(element, fromElement){
10461  var item = element[ASPx.FocusedItemKind];
10462  if(item){
10463   var args = new ASPxClientStateEventArgs(item, element);
10464   args.fromElement = fromElement;
10465   this.BeforeSetFocusedState.FireEvent(this, args);
10466   item.Apply(element);
10467   this.AfterSetFocusedState.FireEvent(this, args);
10468  }
10469 },
10470 DoClearFocusedState: function(element, toElement){
10471  var item = element[ASPx.FocusedItemKind];
10472  if(item){
10473   var args = new ASPxClientStateEventArgs(item, element);
10474   args.toElement = toElement;
10475   this.BeforeClearFocusedState.FireEvent(this, args);
10476   item.Cancel(element);
10477   this.AfterClearFocusedState.FireEvent(this, args);
10478  }
10479 },
10480 DoSetHoverState: function(element, fromElement){
10481  var item = element[ASPx.HoverItemKind];
10482  if(item){
10483   var args = new ASPxClientStateEventArgs(item, element);
10484   args.fromElement = fromElement;
10485   this.BeforeSetHoverState.FireEvent(this, args);
10486   item.Apply(element);
10487   this.AfterSetHoverState.FireEvent(this, args);
10488  }
10489 },
10490 DoClearHoverState: function(element, toElement){
10491  var item = element[ASPx.HoverItemKind];
10492  if(item){
10493   var args = new ASPxClientStateEventArgs(item, element);
10494   args.toElement = toElement;
10495   this.BeforeClearHoverState.FireEvent(this, args);
10496   item.Cancel(element);
10497   this.AfterClearHoverState.FireEvent(this, args);
10498  }
10499 },
10500 DoSetPressedState: function(element){
10501  var item = element[ASPx.PressedItemKind];
10502  if(item){
10503   var args = new ASPxClientStateEventArgs(item, element);
10504   this.BeforeSetPressedState.FireEvent(this, args);
10505   item.Apply(element);
10506   this.AfterSetPressedState.FireEvent(this, args);
10507  }
10508 },
10509 DoClearPressedState: function(element){
10510  var item = element[ASPx.PressedItemKind];
10511  if(item){
10512   var args = new ASPxClientStateEventArgs(item, element);
10513   this.BeforeClearPressedState.FireEvent(this, args);
10514   item.Cancel(element);
10515   this.AfterClearPressedState.FireEvent(this, args);
10516  }
10517 },
10518 SetCurrentFocusedElement: function(element){
10519  if(this.currentFocusedElement && !ASPx.IsValidElement(this.currentFocusedElement)){
10520   this.currentFocusedElement = null;
10521   this.currentFocusedItemName = "";
10522  }
10523  if(this.currentFocusedElement != element){
10524   var oldCurrentFocusedElement = this.currentFocusedElement;
10525   var item = (element != null) ? element[ASPx.FocusedItemKind] : null;
10526   var itemName = (item != null) ? item.name : "";
10527   if(this.currentFocusedItemName != itemName){
10528    if(this.currentHoverItemName != "")
10529     this.SetCurrentHoverElement(null);
10530    if(this.currentFocusedElement != null)
10531     this.DoClearFocusedState(this.currentFocusedElement, element);
10532    this.currentFocusedElement = element;
10533    item = (element != null) ? element[ASPx.FocusedItemKind] : null;
10534    this.currentFocusedItemName = (item != null) ? item.name : "";
10535    if(this.currentFocusedElement != null)
10536     this.DoSetFocusedState(this.currentFocusedElement, oldCurrentFocusedElement);
10537   }
10538  }
10539 },
10540 SetCurrentHoverElement: function(element){
10541  if(this.currentHoverElement && !ASPx.IsValidElement(this.currentHoverElement)){
10542   this.currentHoverElement = null;
10543   this.currentHoverItemName = "";
10544  }
10545  var item = (element != null) ? element[ASPx.HoverItemKind] : null;
10546  if(item && !item.enabled) { 
10547   element = this.GetItemElement(element.parentNode, this.hoverItems, ASPx.HoverItemKind);
10548   item = (element != null) ? element[ASPx.HoverItemKind] : null;
10549  }
10550  if(this.currentHoverElement != element){
10551   var oldCurrentHoverElement = this.currentHoverElement,
10552    itemName = (item != null) ? item.name : "";
10553   if(this.currentHoverItemName != itemName || (item != null && item.needRefreshBetweenElements)){
10554    if(this.currentHoverElement != null)
10555     this.DoClearHoverState(this.currentHoverElement, element);
10556    item = (element != null) ? element[ASPx.HoverItemKind] : null;
10557    if(item == null || item.enabled){
10558     this.currentHoverElement = element;
10559     this.currentHoverItemName = (item != null) ? item.name : "";
10560     if(this.currentHoverElement != null)
10561      this.DoSetHoverState(this.currentHoverElement, oldCurrentHoverElement);
10562    }
10563   }
10564  }
10565 },
10566 SetCurrentPressedElement: function(element){
10567  if(this.currentPressedElement && !ASPx.IsValidElement(this.currentPressedElement)){
10568   this.currentPressedElement = null;
10569   this.currentPressedItemName = "";
10570  }
10571  if(this.currentPressedElement != element){
10572   if(this.currentPressedElement != null)
10573    this.DoClearPressedState(this.currentPressedElement);
10574   var item = (element != null) ? element[ASPx.PressedItemKind] : null;
10575   if(item == null || item.enabled){
10576    this.currentPressedElement = element;
10577    this.currentPressedItemName = (item != null) ? item.name : "";
10578    if(this.currentPressedElement != null)
10579     this.DoSetPressedState(this.currentPressedElement);
10580   }
10581  }
10582 },
10583 SetCurrentFocusedElementBySrcElement: function(srcElement){
10584  var element = this.GetFocusedElement(srcElement);
10585  this.SetCurrentFocusedElement(element);
10586 },
10587 SetCurrentHoverElementBySrcElement: function(srcElement){
10588  var element = this.GetHoverElement(srcElement);
10589  this.SetCurrentHoverElement(element);
10590 },
10591 SetCurrentPressedElementBySrcElement: function(srcElement){
10592  var element = this.GetPressedElement(srcElement);
10593  this.SetCurrentPressedElement(element);
10594 },
10595 SetPressedElement: function (element) {
10596  this.SetCurrentHoverElement(null);
10597  this.SetCurrentPressedElementBySrcElement(element);
10598  this.savedCurrentPressedElement = this.currentPressedElement;
10599 },
10600 SelectElement: function (element) {
10601  var item = element[ASPx.SelectedItemKind];
10602  if(item)
10603   item.Apply(element);
10604 }, 
10605 SelectElementBySrcElement: function(srcElement){
10606  var element = this.GetSelectedElement(srcElement);
10607  if(element != null) this.SelectElement(element);
10608 }, 
10609 DeselectElement: function(element){
10610  var item = element[ASPx.SelectedItemKind];
10611  if(item)
10612   item.Cancel(element);
10613 }, 
10614 DeselectElementBySrcElement: function(srcElement){
10615  var element = this.GetSelectedElement(srcElement);
10616  if(element != null) this.DeselectElement(element);
10617 },
10618 SetElementEnabled: function(element, enable){
10619  if(enable)
10620   this.EnableElement(element);
10621  else
10622   this.DisableElement(element);
10623 },
10624 SetElementReadOnly: function(element, readOnly) {
10625  var element = this.GetReadOnlyElement(element);
10626  if (element != null) {
10627   var item = element[ASPx.ReadOnlyItemKind];
10628   if(item) {
10629    if(readOnly) {
10630     if(item.name == this.currentPressedItemName)
10631      this.SetCurrentPressedElement(null);
10632     if(item.name == this.currentHoverItemName)
10633      this.SetCurrentHoverElement(null);
10634    }
10635    if(readOnly)
10636     item.Apply(element);
10637    else
10638     item.Cancel(element);
10639   }
10640  }
10641 },
10642 SetElementWithChildNodesEnabled: function (parentName, enabled) {
10643  var procFunct = (enabled ? this.EnableElement : this.DisableElement);
10644  var childItems = this.disabledScheme[parentName];
10645  if (childItems && childItems.length > 0)
10646   for (var i = 0; i < childItems.length; i++) {
10647    procFunct.call(this, document.getElementById(childItems[i]));
10648   }
10649 },
10650 DisableElement: function (element) {
10651  var element = this.GetDisabledElement(element);
10652  if(element != null) {
10653   var item = element[ASPx.DisabledItemKind];
10654   if(item){
10655    var args = new ASPxClientStateEventArgs(item, element);
10656    this.BeforeDisabled.FireEvent(this, args);
10657    if(item.name == this.currentPressedItemName)
10658     this.SetCurrentPressedElement(null);
10659    if(item.name == this.currentHoverItemName)
10660     this.SetCurrentHoverElement(null);
10661    item.Apply(element);
10662    this.SetMouseStateItemsEnabled(item.name, item.postfixes, false);
10663    this.AfterDisabled.FireEvent(this, args);
10664   }
10665  }
10666 }, 
10667 EnableElement: function(element){
10668  var element = this.GetDisabledElement(element);
10669  if(element != null) {
10670   var item = element[ASPx.DisabledItemKind];
10671   if(item){
10672    var args = new ASPxClientStateEventArgs(item, element);
10673    this.BeforeEnabled.FireEvent(this, args);
10674    item.Cancel(element);
10675    this.SetMouseStateItemsEnabled(item.name, item.postfixes, true);
10676    this.AfterEnabled.FireEvent(this, args);
10677   }
10678  }
10679 }, 
10680 SetMouseStateItemsEnabled: function(name, postfixes, enabled){   
10681  if(postfixes && postfixes.length > 0){
10682   for(var i = 0; i < postfixes.length; i ++){
10683    this.SetItemsEnabled(this.hoverItems, name + postfixes[i], enabled);
10684    this.SetItemsEnabled(this.pressedItems, name + postfixes[i], enabled);
10685    this.SetItemsEnabled(this.focusedItems, name + postfixes[i], enabled);
10686   }
10687  }
10688  else{
10689   this.SetItemsEnabled(this.hoverItems, name, enabled);
10690   this.SetItemsEnabled(this.pressedItems, name, enabled);
10691   this.SetItemsEnabled(this.focusedItems, name, enabled);
10692  }  
10693 },
10694 SetItemsEnabled: function(items, name, enabled){   
10695  if(items[name])
10696   items[name].enabled = enabled;
10697 },
10698 OnFocusMove: function(evt){
10699  var element = ASPx.Evt.GetEventSource(evt);
10700  aspxGetStateController().SetCurrentFocusedElementBySrcElement(element);
10701 },
10702 OnMouseMove: function(evt, checkElementChanged){
10703  var srcElement = ASPx.Evt.GetEventSource(evt);
10704  if(checkElementChanged && srcElement == this.savedCurrentMouseMoveSrcElement) return;
10705  this.savedCurrentMouseMoveSrcElement = srcElement;
10706  if(ASPx.Browser.IE && !ASPx.Evt.IsLeftButtonPressed(evt) && this.savedCurrentPressedElement != null)
10707   this.ClearSavedCurrentPressedElement();
10708  if(this.savedCurrentPressedElement == null)
10709   this.SetCurrentHoverElementBySrcElement(srcElement);
10710  else{
10711   var element = this.GetPressedElement(srcElement);
10712   if(element != this.currentPressedElement){
10713    if(element == this.savedCurrentPressedElement)
10714     this.SetCurrentPressedElement(this.savedCurrentPressedElement);
10715    else
10716     this.SetCurrentPressedElement(null);
10717   }
10718  }
10719 },
10720 OnMouseDown: function(evt){
10721  if(!ASPx.Evt.IsLeftButtonPressed(evt)) return;
10722  var srcElement = ASPx.Evt.GetEventSource(evt);
10723  this.OnMouseDownOnElement(srcElement);
10724 },
10725 OnMouseDownOnElement: function (element) {
10726  if(this.GetPressedElement(element) == null) return;
10727  this.SetPressedElement(element);
10728 },
10729 OnMouseUp: function(evt){
10730  var srcElement = ASPx.Evt.GetEventSource(evt);
10731  this.OnMouseUpOnElement(srcElement);
10732 },
10733 OnMouseUpOnElement: function(element){
10734  if(this.savedCurrentPressedElement == null) return;
10735  this.ClearSavedCurrentPressedElement();
10736  this.SetCurrentHoverElementBySrcElement(element);
10737 },
10738 OnMouseOver: function(evt){
10739  var element = ASPx.Evt.GetEventSource(evt);
10740  if(element && element.tagName == "IFRAME")
10741   this.OnMouseMove(evt, true);
10742 },
10743 OnKeyDown: function(evt){
10744  var element = this.GetFocusedElement(ASPx.Evt.GetEventSource(evt));
10745  if(element != null && element == this.currentFocusedElement) {
10746   var item = element[ASPx.FocusedItemKind];
10747   if(item){
10748    var args = new ASPxClientStateEventArgs(item, element);
10749    args.htmlEvent = evt;
10750    this.FocusedItemKeyDown.FireEvent(this, args);
10751   }
10752  }
10753 },
10754 OnKeyUpOnElement: function(evt) {
10755  if(this.savedCurrentPressedElement != null && ASPx.Evt.IsActionKeyPressed(evt))
10756   this.ClearSavedCurrentPressedElement();
10757 },
10758 OnSelectStart: function(evt){
10759  if(this.savedCurrentPressedElement) {
10760   ASPx.Selection.Clear();
10761   return false;
10762  }
10763 },
10764 ClearSavedCurrentPressedElement: function() {
10765  this.savedCurrentPressedElement = null;
10766  this.SetCurrentPressedElement(null);
10767 },
10768 ClearCache: function(srcElement, kind) {
10769  if(srcElement[ASPx.CachedStatePrefix + kind])
10770   srcElement[ASPx.CachedStatePrefix + kind] = null;
10771 },
10772 ClearElementCache: function(srcElement) {
10773  this.ClearCache(srcElement, ASPx.FocusedItemKind);
10774  this.ClearCache(srcElement, ASPx.HoverItemKind);
10775  this.ClearCache(srcElement, ASPx.PressedItemKind);
10776  this.ClearCache(srcElement, ASPx.SelectedItemKind);
10777  this.ClearCache(srcElement, ASPx.DisabledItemKind);
10778 },
10779 LockForceRedrawAppearance: function() {
10780  this.forceRedrawAppearanceLockCount++;
10781 },
10782 UnlockForceRedrawAppearance: function() {
10783  this.forceRedrawAppearanceLockCount--;
10784 },
10785 IsForceRedrawAppearanceLocked: function() {
10786  return this.forceRedrawAppearanceLockCount > 0;
10787 }
10788});
10789var stateController = null;
10790function aspxGetStateController(){
10791 if(stateController == null)
10792  stateController = new ASPxStateController();
10793 return stateController;
10794}
10795function aspxAddStateItems(method, namePrefix, classes, disableApplyingStyleToLink){
10796 for(var i = 0; i < classes.length; i ++){
10797  for(var j = 0; j < classes[i][2].length; j ++) {
10798   var name = namePrefix;
10799   if(classes[i][2][j])
10800    name += "_" + classes[i][2][j];
10801   var postfixes = classes[i][3] || null;
10802   var imageObjs = (classes[i][4] && classes[i][4][j]) || null;
10803   var imagePostfixes = classes[i][5] || null;
10804   method.call(aspxGetStateController(), name, classes[i][0], classes[i][1], postfixes, imageObjs, imagePostfixes, disableApplyingStyleToLink, namePrefix);
10805  }
10806 }
10807}
10808ASPx.AddHoverItems = function(namePrefix, classes, disableApplyingStyleToLink){
10809 aspxAddStateItems(aspxGetStateController().AddHoverItem, namePrefix, classes, disableApplyingStyleToLink);
10810};
10811ASPx.AddPressedItems = function(namePrefix, classes, disableApplyingStyleToLink){
10812 aspxAddStateItems(aspxGetStateController().AddPressedItem, namePrefix, classes, disableApplyingStyleToLink);
10813};
10814ASPx.AddSelectedItems = function(namePrefix, classes, disableApplyingStyleToLink){
10815 aspxAddStateItems(aspxGetStateController().AddSelectedItem, namePrefix, classes, disableApplyingStyleToLink);
10816};
10817ASPx.AddDisabledItems = function(namePrefix, classes, disableApplyingStyleToLink){
10818 aspxAddStateItems(aspxGetStateController().AddDisabledItem, namePrefix, classes, disableApplyingStyleToLink);
10819};
10820ASPx.AddReadOnlyItems = function(namePrefix, classes, disableApplyingStyleToLink) {
10821 aspxAddStateItems(aspxGetStateController().AddReadOnlyItem, namePrefix, classes, disableApplyingStyleToLink);
10822};
10823function aspxRemoveStateItems(method, namePrefix, classes){
10824 for(var i = 0; i < classes.length; i ++){
10825  for(var j = 0; j < classes[i][0].length; j ++) {
10826   var name = namePrefix;
10827   if(classes[i][0][j])
10828    name += "_" + classes[i][0][j];
10829   method.call(aspxGetStateController(), name, classes[i][1], namePrefix);
10830  }
10831 }
10832}
10833ASPx.RemoveHoverItems = function(namePrefix, classes){
10834 aspxRemoveStateItems(aspxGetStateController().RemoveHoverItem, namePrefix, classes);
10835};
10836ASPx.RemovePressedItems = function(namePrefix, classes){
10837 aspxRemoveStateItems(aspxGetStateController().RemovePressedItem, namePrefix, classes);
10838};
10839ASPx.RemoveSelectedItems = function(namePrefix, classes){
10840 aspxRemoveStateItems(aspxGetStateController().RemoveSelectedItem, namePrefix, classes);
10841};
10842ASPx.RemoveDisabledItems = function(namePrefix, classes){
10843 aspxRemoveStateItems(aspxGetStateController().RemoveDisabledItem, namePrefix, classes);
10844};
10845ASPx.RemoveReadOnlyItems = function(namePrefix, classes) {
10846 aspxRemoveStateItems(aspxGetStateController().RemoveReadOnlyItem, namePrefix, classes);
10847};
10848ASPx.AddAfterClearFocusedState = function(handler){
10849 aspxGetStateController().AfterClearFocusedState.AddHandler(handler);
10850};
10851ASPx.AddAfterSetFocusedState = function(handler){
10852 aspxGetStateController().AfterSetFocusedState.AddHandler(handler);
10853};
10854ASPx.AddAfterClearHoverState = function(handler){
10855 aspxGetStateController().AfterClearHoverState.AddHandler(handler);
10856};
10857ASPx.AddAfterSetHoverState = function(handler){
10858 aspxGetStateController().AfterSetHoverState.AddHandler(handler);
10859};
10860ASPx.AddAfterClearPressedState = function(handler){
10861 aspxGetStateController().AfterClearPressedState.AddHandler(handler);
10862};
10863ASPx.AddAfterSetPressedState = function(handler){
10864 aspxGetStateController().AfterSetPressedState.AddHandler(handler);
10865};
10866ASPx.AddAfterDisabled = function(handler){
10867 aspxGetStateController().AfterDisabled.AddHandler(handler);
10868};
10869ASPx.AddAfterEnabled = function(handler){
10870 aspxGetStateController().AfterEnabled.AddHandler(handler);
10871};
10872ASPx.AddBeforeClearFocusedState = function(handler){
10873 aspxGetStateController().BeforeClearFocusedState.AddHandler(handler);
10874};
10875ASPx.AddBeforeSetFocusedState = function(handler){
10876 aspxGetStateController().BeforeSetFocusedState.AddHandler(handler);
10877};
10878ASPx.AddBeforeClearHoverState = function(handler){
10879 aspxGetStateController().BeforeClearHoverState.AddHandler(handler);
10880};
10881ASPx.AddBeforeSetHoverState = function(handler){
10882 aspxGetStateController().BeforeSetHoverState.AddHandler(handler);
10883};
10884ASPx.AddBeforeClearPressedState = function(handler){
10885 aspxGetStateController().BeforeClearPressedState.AddHandler(handler);
10886};
10887ASPx.AddBeforeSetPressedState = function(handler){
10888 aspxGetStateController().BeforeSetPressedState.AddHandler(handler);
10889};
10890ASPx.AddBeforeDisabled = function(handler){
10891 aspxGetStateController().BeforeDisabled.AddHandler(handler);
10892};
10893ASPx.AddBeforeEnabled = function(handler){
10894 aspxGetStateController().BeforeEnabled.AddHandler(handler);
10895};
10896ASPx.AddFocusedItemKeyDown = function(handler){
10897 aspxGetStateController().FocusedItemKeyDown.AddHandler(handler);
10898};
10899ASPx.SetHoverState = function(element){
10900 aspxGetStateController().SetCurrentHoverElementBySrcElement(element);
10901};
10902ASPx.ClearHoverState = function(evt){
10903 aspxGetStateController().SetCurrentHoverElementBySrcElement(null);
10904};
10905ASPx.UpdateHoverState = function(evt){
10906 aspxGetStateController().OnMouseMove(evt, false);
10907};
10908ASPx.SetFocusedState = function(element){
10909 aspxGetStateController().SetCurrentFocusedElementBySrcElement(element);
10910};
10911ASPx.ClearFocusedState = function(evt){
10912 aspxGetStateController().SetCurrentFocusedElementBySrcElement(null);
10913};
10914ASPx.UpdateFocusedState = function(evt){
10915 aspxGetStateController().OnFocusMove(evt);
10916};
10917ASPx.AccessibilityMarkerClass = "dxalink";
10918ASPx.AssignAccessibilityEventsToChildrenLinks = function(container, clearFocusedStateOnMouseOut){
10919 var links = ASPx.GetNodesByPartialClassName(container, ASPx.AccessibilityMarkerClass);
10920 for(var i = 0; i < links.length; i++)
10921  ASPx.AssignAccessibilityEventsToLink(links[i], clearFocusedStateOnMouseOut);
10922};
10923ASPx.AssignAccessibilityEventsToLink = function(link, clearFocusedStateOnMouseOut) {
10924 if(!ASPx.ElementContainsCssClass(link, ASPx.AccessibilityMarkerClass))
10925  return;
10926 ASPx.AssignAccessibilityEventsToLinkCore(link, clearFocusedStateOnMouseOut);
10927};
10928ASPx.AssignAccessibilityEventsToLinkCore = function (link, clearFocusedStateOnMouseOut) {
10929 ASPx.Evt.AttachEventToElement(link, "focus", function (e) { ASPx.UpdateFocusedState(e); });
10930 var clearFocusedStateHandler = function (e) { ASPx.ClearFocusedState(e); };
10931 ASPx.Evt.AttachEventToElement(link, "blur", clearFocusedStateHandler);
10932 if(clearFocusedStateOnMouseOut)
10933  ASPx.Evt.AttachEventToElement(link, "mouseout", clearFocusedStateHandler);
10934};
10935ASPx.Evt.AttachEventToDocument("mousemove", function(evt) {
10936 if(ASPx.classesScriptParsed && ASPx.StateItemsExist)
10937  aspxGetStateController().OnMouseMove(evt, true);
10938});
10939ASPx.Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseDownEventName, function(evt) {
10940 if(ASPx.classesScriptParsed && ASPx.StateItemsExist)
10941  aspxGetStateController().OnMouseDown(evt);
10942});
10943ASPx.Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseUpEventName, function(evt) {
10944 if(ASPx.classesScriptParsed && ASPx.StateItemsExist)
10945  aspxGetStateController().OnMouseUp(evt);
10946});
10947ASPx.Evt.AttachEventToDocument("mouseover", function(evt) {
10948 if(ASPx.classesScriptParsed && ASPx.StateItemsExist)
10949  aspxGetStateController().OnMouseOver(evt);
10950});
10951ASPx.Evt.AttachEventToDocument("keydown", function(evt) {
10952 if(ASPx.classesScriptParsed && ASPx.StateItemsExist)
10953  aspxGetStateController().OnKeyDown(evt);
10954});
10955ASPx.Evt.AttachEventToDocument("selectstart", function(evt) {
10956 if(ASPx.classesScriptParsed && ASPx.StateItemsExist)
10957  return aspxGetStateController().OnSelectStart(evt);
10958});
10959ASPx.GetStateController = aspxGetStateController;
10960ASPx.StateItem = ASPxStateItem;
10961})();
10962(function () {
10963 var ASPx = window.ASPx || {};
10964 ASPx.ASPxImageLoad = {};
10965 ASPx.ASPxImageLoad.dxDefaultLoadingImageCssClass = "dxe-loadingImage";
10966 ASPx.ASPxImageLoad.dxDefaultLoadingImageCssClassRegexp = new RegExp("dx\\w+-loadingImage");
10967 ASPx.ASPxImageLoad.OnLoad = function (image, customLoadingImage, isOldIE, customBackgroundImageUrl) {
10968  image.dxCustomBackgroundImageUrl = "";
10969  image.dxShowLoadingImage = true;
10970  image.dxCustomLoadingImage = customLoadingImage;
10971  if (customBackgroundImageUrl != "")
10972   image.dxCustomBackgroundImageUrl = "url('" + customBackgroundImageUrl + "')";
10973  ASPx.ASPxImageLoad.prepareImageBackground(image, isOldIE);
10974  ASPx.ASPxImageLoad.removeHandlers(image);
10975  image.className = image.className.replace(ASPx.ASPxImageLoad.dxDefaultLoadingImageCssClassRegexp, "");
10976 };
10977 ASPx.ASPxImageLoad.removeASPxImageBackground = function (image, isOldIE) {
10978  if (isOldIE) 
10979   image.style.removeAttribute("background-image");
10980  else 
10981   image.style.backgroundImage = "";
10982 };
10983 ASPx.ASPxImageLoad.prepareImageBackground = function (image, isOldIE) {
10984  ASPx.ASPxImageLoad.removeASPxImageBackground(image, isOldIE);
10985  if (image.dxCustomBackgroundImageUrl != "")
10986   image.style.backgroundImage = image.dxCustomBackgroundImageUrl;
10987 };
10988 ASPx.ASPxImageLoad.removeHandlers = function (image) {
10989  image.removeAttribute("onload");
10990  image.removeAttribute("onabort");
10991  image.removeAttribute("onerror");
10992 };
10993 window.ASPx = ASPx;
10994})();
10995(function() {
10996var CheckingScriptObjectCommand = ASPx.CreateClass(null, {
10997 constructor: function(scriptName, markerObjectName) {
10998  this.scriptName = scriptName;
10999  this.markerObjectName = markerObjectName;
11000  this.isExisted = false;
11001 },
11002 Run: function() {
11003  var markerObj = this.GetMarkerObject();
11004  this.isExisted = !!markerObj;
11005  if(this.isExisted)
11006   markerObj.DXPatched = true;
11007 },
11008 GetErrorMessage: function() {
11009  return this.GetErrorMessageCore(true);
11010 },
11011 GetErrorMessageCore: function(isScriptRequired){
11012  var markerObj = this.GetMarkerObject();
11013  if(this.isExisted && markerObj && markerObj.DXPatched || !isScriptRequired && !markerObj)
11014   return null;
11015  if(isScriptRequired && !this.GetMarkerObject()){
11016   if(this.isExisted)
11017    return this.scriptName + " script was attached but has been overridden.";
11018   else
11019    return this.scriptName + " script was not attached.";
11020  }
11021  if(!this.isExisted)
11022   return this.scriptName + " script was attached after DevExpress scripts.";
11023  return this.scriptName + " script was attached multiple times and mixed up with DevExpress scripts.";
11024 },
11025 GetMarkerObject: function() {
11026  return ASPx.GetGlobalObject(this.markerObjectName);
11027 }
11028});
11029var PatchScriptCommand = ASPx.CreateClass(CheckingScriptObjectCommand, {
11030 constructor: function(scriptName, markerObjectName, patchMethod, required) {
11031  this.constructor.prototype.constructor.call(this, scriptName, markerObjectName);
11032  this.required = required;
11033  this.patchMethod = patchMethod;
11034 },
11035 Run: function() {
11036  CheckingScriptObjectCommand.prototype.Run.call(this);
11037  if(this.isExisted)
11038   this.patchMethod();
11039 },
11040 GetErrorMessage: function() {  
11041  return this.GetErrorMessageCore(this.required);
11042 }
11043});
11044var ExternalScriptProcessor = ASPx.CreateClass(null, {
11045 constructor: function() {
11046  this.commands = {};
11047 },
11048 Process: function(scriptName, markerObjectName, patchMethod, required) {
11049  var newCommand = this.CreateCommand(scriptName, markerObjectName, patchMethod, !!required);
11050  var oldCommand = this.commands[markerObjectName];
11051  if(oldCommand) {
11052   if(!oldCommand.patchMethod && !newCommand.patchMethod)
11053    newCommand = null;
11054   else if(newCommand.patchMethod && (!oldCommand.patchMethod || oldCommand.required))
11055    newCommand.required = true;
11056   else if(oldCommand.patchMethod && !newCommand.patchMethod) {
11057    oldCommand.required = true;
11058    newCommand = null;
11059   }
11060  }
11061  if(newCommand) {
11062   this.commands[markerObjectName] = newCommand;
11063   newCommand.Run();
11064  }
11065 },
11066 CreateCommand: function(scriptName, markerObjectName, patchMethod, required) {
11067  if(patchMethod)
11068   return new PatchScriptCommand(scriptName, markerObjectName, patchMethod, required);
11069  return new CheckingScriptObjectCommand(scriptName, markerObjectName);
11070 },
11071 ShowErrorMessages: function() {
11072  var messages = this.GetErrorMessages();
11073  var console = window.console;
11074  if(!messages.length || !console || !ASPx.IsFunction(console.error))
11075   return;
11076  for(var i = 0; i < messages.length; i++) {
11077   console.error(messages[i]);
11078  }
11079  ASPx.ShowKBErrorMessage("Please check the correctness of script registration on the page. For details, see ", "T272309");
11080 },
11081 GetErrorMessages: function() {
11082  var messages = [];
11083  for (var key in this.commands) {
11084   if (this.commands.hasOwnProperty(key)) {
11085    var message = this.commands[key].GetErrorMessage();
11086    if (message)
11087     messages.push(message);
11088   }
11089  }
11090  return messages;
11091 }
11092});
11093ExternalScriptProcessor.Instance = null;
11094ExternalScriptProcessor.getInstance = function() {
11095 if(!ExternalScriptProcessor.Instance)
11096  ExternalScriptProcessor.Instance = new ExternalScriptProcessor();
11097 return ExternalScriptProcessor.Instance;
11098};
11099ASPx.ExternalScriptProcessor = ExternalScriptProcessor;
11100})();
11101(function module(ASPx) {
11102ASPx.modules.Controls = module;
11103var ASPxClientBeginCallbackEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
11104 constructor: function(command){
11105  this.constructor.prototype.constructor.call(this);
11106  this.command = command;
11107 }
11108});
11109var ASPxClientGlobalBeginCallbackEventArgs = ASPx.CreateClass(ASPxClientBeginCallbackEventArgs, {
11110 constructor: function(control, command){
11111  this.constructor.prototype.constructor.call(this, command);
11112  this.control = control;
11113 }
11114});
11115var ASPxClientEndCallbackEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
11116 constructor: function(command){
11117  this.constructor.prototype.constructor.call(this);
11118  this.command = command;
11119 }
11120});
11121var ASPxClientGlobalEndCallbackEventArgs = ASPx.CreateClass(ASPxClientEndCallbackEventArgs, {
11122 constructor: function(control){
11123  this.constructor.prototype.constructor.call(this);
11124  this.control = control;
11125 }
11126});
11127var ASPxClientCustomDataCallbackEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
11128 constructor: function(result) {
11129  this.constructor.prototype.constructor.call(this);
11130  this.result = result;
11131 }
11132});
11133var ASPxClientCallbackErrorEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
11134 constructor: function (message, callbackId) {
11135  this.constructor.prototype.constructor.call(this);
11136  this.message = message;
11137  this.handled = false;
11138  this.callbackId = callbackId;
11139 }
11140});
11141var ASPxClientGlobalCallbackErrorEventArgs = ASPx.CreateClass(ASPxClientCallbackErrorEventArgs, {
11142 constructor: function (control, message, callbackId) {
11143  this.constructor.prototype.constructor.call(this, message, callbackId);
11144  this.control = control;
11145 }
11146});
11147var ASPxClientValidationCompletedEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
11148 constructor: function (container, validationGroup, invisibleControlsValidated, isValid, firstInvalidControl, firstVisibleInvalidControl) {
11149  this.constructor.prototype.constructor.call(this);
11150  this.container = container;
11151  this.validationGroup = validationGroup;
11152  this.invisibleControlsValidated = invisibleControlsValidated;
11153  this.isValid = isValid;
11154  this.firstInvalidControl = firstInvalidControl;
11155  this.firstVisibleInvalidControl = firstVisibleInvalidControl;
11156 }
11157});
11158var ASPxClientControlsInitializedEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
11159 constructor: function(isCallback) {
11160  this.isCallback = isCallback;
11161 }
11162});
11163var ASPxClientControlBeforePronounceEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
11164 constructor: function(messageParts, control){
11165  this.constructor.prototype.constructor.call(this);
11166  this.messageParts = messageParts;
11167  this.control = control;
11168 }
11169});
11170var ASPxClientControlUnloadEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
11171 constructor: function(control){
11172  this.constructor.prototype.constructor.call(this);
11173  this.control = control;
11174 }
11175});
11176var ASPxClientEndFocusEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
11177 constructor: function(item) {
11178  this.constructor.prototype.constructor.call(this);
11179  this.item = item;
11180 }
11181});
11182var ASPxClientItemFocusedEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
11183 constructor: function(item) {
11184  this.constructor.prototype.constructor.call(this);
11185  this.item = item;
11186 }
11187});
11188var BeforeInitCallbackEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
11189 constructor: function(callbackOwnerID){
11190  this.constructor.prototype.constructor.call(this);
11191  this.callbackOwnerID = callbackOwnerID;
11192 }
11193});
11194ASPx.createControl = function(type, name, windowName, properties, events, setupMethod, data){
11195 var globalName = windowName && windowName.length > 0 ? windowName : name;
11196 var dxo = new type(name);
11197 var haveWrapper = ASPx.Platform === "NETCORE" && dxo.createWrapper && !DevExpress.AspNetCore.Internal.BackwardCompatibility.useLegacyClientAPI;
11198 if(haveWrapper) {
11199  window[globalName] = dxo.createWrapper();
11200  dxo.aspNetCoreWrapperInstance = window[globalName];
11201 }
11202 else
11203  dxo.InitGlobalVariable(globalName);
11204 if(properties)
11205  dxo.SetProperties(properties);
11206 if(events)
11207  dxo.SetEvents(events);
11208 if(setupMethod)
11209  setupMethod.call(dxo);
11210 if(data)
11211  dxo.SetData(data);
11212 dxo.AfterCreate();
11213};
11214var ASPxClientControlBase = ASPx.CreateClass(null, {
11215 constructor: function(name){
11216  this.name = name;
11217  this.uniqueID = name;   
11218  this.globalName = name;
11219  this.stateObject = null;
11220  this.needEncodeState = true;
11221  this.encodeHtml = true;
11222  this.enabled = true;
11223  this.clientEnabled = true;
11224  this.savedClientEnabled = true;
11225  this.clientVisible = true;
11226  this.accessibilityCompliant = false;
11227  this.parseJSPropertiesOnCallbackError = false;
11228  this.autoPostBack = false;
11229  this.allowMultipleCallbacks = true;
11230  this.callBack = null;
11231  this.enableCallbackAnimation = false;
11232  this.enableSlideCallbackAnimation = false;
11233  this.slideAnimationDirection = null;
11234  this.beginCallbackAnimationProcessing = false;
11235  this.endCallbackAnimationProcessing = false;
11236  this.savedCallbackResult = null;
11237  this.savedCallbacks = null;
11238  this.isCallbackAnimationPrevented = false;
11239  this.lpDelay = 300;
11240  this.lpTimer = -1;
11241  this.requestCount = 0;
11242  this.enableSwipeGestures = false;
11243  this.disableSwipeGestures = false;
11244  this.supportGestures = false;
11245  this.repeatedGestureValue = 0;
11246  this.repeatedGestureCount = 0;
11247  this.isInitialized = false;
11248  this.initialFocused = false;
11249  this.leadingAfterInitCall = ASPxClientControl.LeadingAfterInitCallConsts.None; 
11250  this.serverEvents = [];
11251  this.loadingPanelElement = null;
11252  this.loadingDivElement = null;  
11253  this.hasPhantomLoadingElements = false;
11254  this.mainElement = null;
11255  this.touchUIMouseScroller = null;
11256  this.hiddenFields = {};
11257  this.scPrefix = "dx";
11258  this.callbackHandlersQueue = new ASPx.ControlCallbackHandlersQueue(this);
11259  this.callbackCommand = {};
11260  this.currentCallbackID = -1;
11261  this.Init = new ASPxClientEvent();
11262  this.BeginCallback = new ASPxClientEvent();
11263  this.EndCallback = new ASPxClientEvent();
11264  this.EndCallbackAnimationStart = new ASPxClientEvent();
11265  this.CallbackError = new ASPxClientEvent();
11266  this.CustomDataCallback = new ASPxClientEvent();
11267  this.BeforePronounce = new ASPxClientEvent();
11268  this.Unload = new ASPxClientEvent();
11269  aspxGetControlCollection().Add(this);
11270 },
11271 Initialize: function() {
11272  if(this.callBack != null)
11273   this.InitializeCallBackData();
11274  if (this.useCallbackQueue())
11275   this.callbackQueueHelper = new ASPx.ControlCallbackQueueHelper(this);
11276  ASPx.AccessibilityUtils.createAccessibleBackgrounds(this);
11277  if(this.accessibilityCompliant)
11278   ASPx.AccessibilityPronouncer.EnsureInitialize();
11279 },
11280 FinalizeInitialization: function() { },
11281 InlineInitialize: function() {
11282  this.savedClientEnabled = this.clientEnabled;
11283 },
11284 InitializeGestures: function() {
11285  if(this.isSwipeGesturesEnabled() && this.supportGestures) {
11286   ASPx.GesturesHelper.AddSwipeGestureHandler(this.name, 
11287    function() { return this.GetCallbackAnimationElement(); }.aspxBind(this), 
11288    function(evt) { return this.CanHandleGestureCore(evt); }.aspxBind(this), 
11289    function(value) { return this.AllowStartGesture(value); }.aspxBind(this),
11290    function(value) { return this.StartGesture(); }.aspxBind(this),
11291    function(value) { return this.AllowExecuteGesture(value); }.aspxBind(this),
11292    function(value) { this.ExecuteGesture(value); }.aspxBind(this),
11293    function(value) { this.CancelGesture(value); }.aspxBind(this),
11294    this.GetDefaultanimationEngineType(),
11295    this.rtl
11296   );
11297   if(ASPx.Browser.MSTouchUI)
11298    this.touchUIMouseScroller = ASPx.MouseScroller.Create(
11299     function() { return this.GetCallbackAnimationElement(); }.aspxBind(this),
11300     function() { return null; },
11301     function() { return this.GetCallbackAnimationElement(); }.aspxBind(this),
11302     function(element) { return this.NeedPreventTouchUIMouseScrolling(element); }.aspxBind(this),
11303     true
11304    );
11305  }
11306 },
11307 isSwipeGesturesEnabled: function() {
11308  return !this.disableSwipeGestures && (this.enableSwipeGestures || ASPx.Browser.TouchUI);
11309 },
11310 isSlideCallbackAnimationEnabled: function() {
11311  return this.enableSlideCallbackAnimation || this.isSwipeGesturesEnabled(); 
11312 },
11313 InitGlobalVariable: function(varName){
11314  if(!window) return;
11315  this.globalName = varName;
11316  window[varName] = this;
11317 },
11318 SetElementDisplay: function(element, value, checkCurrentStyle, makeInline) {
11319  ASPx.SetElementDisplay(element, value, checkCurrentStyle, makeInline);
11320 },
11321 SetProperties: function(properties, obj){
11322  if(!obj) obj = this;
11323  var isAspNetCoreWrapperInstanceExist = !!obj.aspNetCoreWrapperInstance;
11324  for(var name in properties){
11325   if(!properties.hasOwnProperty(name)) continue;
11326   obj[name] = properties[name];
11327   if(isAspNetCoreWrapperInstanceExist && name.indexOf("cp") === 0)
11328    obj.aspNetCoreWrapperInstance[name] = properties[name]; 
11329  }
11330 },
11331 SetEvents: function(events, obj){
11332  if(!obj) obj = this;
11333  for(var name in events){
11334   if(events.hasOwnProperty(name) && obj[name] && obj[name].AddHandler)
11335    obj[name].AddHandler(events[name]);
11336  }
11337 },
11338 SetData: function(data){
11339 },
11340 useCallbackQueue: function(){
11341  return false;
11342 },
11343 NeedPreventTouchUIMouseScrolling: function(element) {
11344  return false;
11345 },
11346 InitailizeFocus: function() {
11347  if(this.initialFocused && this.IsVisible())
11348   this.Focus();
11349 },
11350 AfterCreate: function() {
11351  this.AddDefaultStateControllerItems();
11352  this.InlineInitialize();
11353  this.InitializeGestures();
11354 },
11355 AfterInitialize: function() {
11356  this.initializeAriaDescriptor();
11357  this.InitailizeFocus();
11358  this.isInitialized = true;
11359  this.RaiseInit();
11360  if(this.savedCallbacks) {
11361   for(var i = 0; i < this.savedCallbacks.length; i++) 
11362    this.CreateCallbackInternal(this.savedCallbacks[i].arg, this.savedCallbacks[i].command, 
11363     false, this.savedCallbacks[i].callbackInfo);
11364   this.savedCallbacks = null;
11365  }
11366 },
11367 InitializeCallBackData: function() {
11368 },
11369 AtlasPreInitialize: function() {
11370 },
11371 AtlasInitialize: function() {
11372 },
11373 IsDOMDisposed: function() { 
11374  return !ASPx.IsExistsElement(this.GetMainElement());
11375 },
11376 initializeAriaDescriptor: function() {
11377  if(this.ariaDescription) {
11378   var descriptionObject = ASPx.Json.Eval(this.ariaDescription);
11379   if(descriptionObject) {
11380    this.ariaDescriptor = new AriaDescriptor(this, descriptionObject);
11381    this.applyAccessibilityAttributes(this.ariaDescriptor); 
11382   }
11383  }
11384 },
11385 applyAccessibilityAttributes: function() { },
11386 setAriaDescription: function(selector, argsList) {
11387  if(this.ariaDescriptor)
11388   this.ariaDescriptor.setDescription(selector, argsList || [[]]);
11389 },
11390 allowRestoreFocusOnCallbacks: function(){
11391  return this.accessibilityCompliant;
11392 },
11393 HtmlEncode: function(text) {
11394  return this.encodeHtml ? ASPx.Str.EncodeHtml(text) : text;
11395 },
11396 IsServerEventAssigned: function(eventName){
11397  return ASPx.Data.ArrayIndexOf(this.serverEvents, eventName) >= 0;
11398 },
11399 OnPost: function(args){
11400  this.SerializeStateHiddenField();
11401 },
11402 SerializeStateHiddenField: function() {
11403  this.UpdateStateObject();
11404  if(this.stateObject != null)
11405   this.UpdateStateHiddenField();
11406 },
11407 OnPostFinalization: function(args){
11408 },
11409 UpdateStateObject: function(){
11410 },
11411 UpdateStateObjectWithObject: function(obj){
11412  if(!obj) return;
11413  if(!this.stateObject)
11414   this.stateObject = { };
11415  for(var key in obj)
11416   if(obj.hasOwnProperty(key))
11417    this.stateObject[key] = obj[key];
11418 },
11419 UpdateStateHiddenField: function() {
11420  var stateHiddenField = this.GetStateHiddenField();
11421  if(stateHiddenField) {
11422   var stateObjectStr = ASPx.Json.ToJson(this.stateObject, !this.needEncodeState);
11423   stateHiddenField.value = this.needEncodeState ? ASPx.Str.EncodeHtml(stateObjectStr) : stateObjectStr;
11424  }
11425 },
11426 GetStateHiddenField: function() {
11427  return this.GetHiddenField(this.GetStateHiddenFieldName(), this.GetStateHiddenFieldID(), 
11428   this.GetStateHiddenFieldParent(), this.GetStateHiddenFieldOrigin());
11429 },
11430 GetStateHiddenFieldName: function() {
11431  return this.uniqueID;
11432 },
11433 GetStateHiddenFieldID: function() {
11434  return this.name + "_State";
11435 },
11436 GetStateHiddenFieldOrigin: function() {
11437  return this.GetMainElement();
11438 },
11439 GetStateHiddenFieldParent: function() {
11440  var element = this.GetStateHiddenFieldOrigin();
11441  return element ? element.parentNode : null;
11442 },
11443 GetHiddenField: function(name, id, parent, beforeElement) {
11444  var hiddenField = this.hiddenFields[id];
11445  if(!hiddenField || !ASPx.IsValidElement(hiddenField)) {
11446   if(parent) {
11447    var existingHiddenField = ASPx.GetElementById(this.GetStateHiddenFieldID());
11448    this.hiddenFields[id] = hiddenField = existingHiddenField || ASPx.CreateHiddenField(name, id);
11449    if(existingHiddenField)
11450     return existingHiddenField;
11451    if(beforeElement)
11452     parent.insertBefore(hiddenField, beforeElement);
11453    else
11454     parent.appendChild(hiddenField);
11455   }
11456  }
11457  return hiddenField;
11458 },
11459 GetChildElement: function(idPostfix){
11460  var mainElement = this.GetMainElement();
11461  if(idPostfix.charAt && idPostfix.charAt(0) !== "_")
11462   idPostfix = "_" + idPostfix;
11463  return mainElement ? ASPx.CacheHelper.GetCachedChildById(this, mainElement, this.name + idPostfix) : null;
11464 },
11465 getChildControl: function(idPostfix) {
11466  var result = null;
11467  var childControlId = this.getChildControlUniqueID(idPostfix);
11468  ASPx.GetControlCollection().ProcessControlsInContainer(this.GetMainElement(), function(control) {
11469   if(control.uniqueID == childControlId)
11470    result = control;
11471  });
11472  return result;  
11473 },
11474 getChildControlUniqueID: function(idPostfix) {
11475  idPostfix = idPostfix.split("_").join("$");
11476  if(idPostfix.charAt && idPostfix.charAt(0) !== "$")
11477   idPostfix = "$" + idPostfix;
11478  return this.uniqueID + idPostfix;  
11479 },
11480 getInnerControl: function(idPostfix) {
11481  var name = this.name + idPostfix;
11482  var result = window[name];
11483  return result && Ident.IsASPxClientControl(result)
11484   ? result
11485   : null;
11486 },
11487 GetParentForm: function(){
11488  return ASPx.GetParentByTagName(this.GetMainElement(), "FORM");
11489 },
11490 GetMainElement: function(){
11491  if(!ASPx.IsExistsElement(this.mainElement))
11492   this.mainElement = ASPx.GetElementById(this.GetMainElementId());
11493  return this.mainElement;
11494 },
11495 GetMainElementId: function() {
11496  return this.name;
11497 },
11498 IsLoadingContainerVisible: function(){
11499  return this.IsVisible();
11500 },
11501 GetLoadingPanelElement: function(){
11502  return ASPx.GetElementById(this.name + "_LP");
11503 },
11504 GetClonedLoadingPanel: function(){
11505  return document.getElementById(this.GetLoadingPanelElement().id + "V"); 
11506 },
11507 CloneLoadingPanel: function(element, parent) {
11508  var clone = element.cloneNode(true);
11509  clone.id = element.id + "V";
11510  parent.appendChild(clone);
11511  return clone;
11512 },
11513 CreateLoadingPanelWithoutBordersInsideContainer: function(container) {
11514  var loadingPanel = this.CreateLoadingPanelInsideContainer(container, false, true, true);
11515  var contentStyle = ASPx.GetCurrentStyle(container);
11516  if(!loadingPanel || !contentStyle)
11517   return;
11518  var elements = [ ];
11519  var table = (loadingPanel.tagName == "TABLE") ? loadingPanel : ASPx.GetNodeByTagName(loadingPanel, "TABLE", 0);
11520  if(table != null)
11521   elements.push(table);
11522  else
11523   elements.push(loadingPanel);
11524  var cells = ASPx.GetNodesByTagName(loadingPanel, "TD");
11525  if(!cells) cells = [ ];
11526  for(var i = 0; i < cells.length; i++)
11527   elements.push(cells[i]);
11528  for(var i = 0; i < elements.length; i++) {
11529   var el = elements[i];
11530   el.style.backgroundColor = contentStyle.backgroundColor;
11531   ASPx.RemoveBordersAndShadows(el);
11532  }
11533 },
11534 CreateLoadingPanelInsideContainer: function(parentElement, hideContent, collapseHeight, collapseWidth) {
11535  if(this.ShouldHideExistingLoadingElements())
11536   this.HideLoadingPanel();
11537  if(parentElement == null)
11538   return null;
11539  if(!this.IsLoadingContainerVisible()) {
11540   this.hasPhantomLoadingElements = true;
11541   return null;
11542  }
11543  var element = this.GetLoadingPanelElement();
11544  if(element != null){
11545   var width = collapseWidth ? 0 : ASPx.GetClearClientWidth(parentElement);
11546   var height = collapseHeight ? 0 : ASPx.GetClearClientHeight(parentElement);
11547   if(hideContent){
11548    for(var i = parentElement.childNodes.length - 1; i > -1; i--){
11549     if(parentElement.childNodes[i].style)
11550      parentElement.childNodes[i].style.display = "none";
11551     else if(parentElement.childNodes[i].nodeType == 3) 
11552      parentElement.removeChild(parentElement.childNodes[i]);
11553    }
11554   }
11555   else
11556    parentElement.innerHTML = "";
11557   var table = document.createElement("TABLE");
11558   parentElement.appendChild(table);
11559   table.border = 0;
11560   table.cellPadding = 0;
11561   table.cellSpacing = 0;
11562   ASPx.SetStyles(table, {
11563    width: (width > 0) ? width : "100%",
11564    height: (height > 0) ? height : "100%"
11565   });
11566   var tbody = document.createElement("TBODY");
11567   table.appendChild(tbody);
11568   var tr = document.createElement("TR");
11569   tbody.appendChild(tr);
11570   var td = document.createElement("TD");
11571   tr.appendChild(td);
11572   td.align = "center";
11573   td.vAlign = "middle";
11574   element = this.CloneLoadingPanel(element, td);
11575   ASPx.SetElementDisplay(element, true);
11576   this.loadingPanelElement = element;
11577   return element;
11578  } else
11579   parentElement.innerHTML = "&nbsp;";
11580  return null;
11581 },
11582 CreateLoadingPanelWithAbsolutePosition: function(parentElement, offsetElement) {
11583  if(this.ShouldHideExistingLoadingElements())
11584   this.HideLoadingPanel();
11585  if(parentElement == null)
11586   return null;
11587  if(!this.IsLoadingContainerVisible()) {
11588   this.hasPhantomLoadingElements = true;
11589   return null;
11590  }
11591  if(!offsetElement)
11592   offsetElement = parentElement;
11593  var element = this.GetLoadingPanelElement();
11594  if(element != null) {
11595   element = this.CloneLoadingPanel(element, parentElement);
11596   ASPx.SetStyles(element, {
11597    position: "absolute"
11598   });
11599   ASPx.SetElementDisplay(element, true);
11600   ASPx.Evt.AttachEventToElement(element, ASPx.Evt.GetMouseWheelEventName(), ASPx.Evt.PreventEvent);
11601   this.SetLoadingPanelLocation(offsetElement, element);
11602   this.loadingPanelElement = element;
11603   return element;
11604  }
11605  return null;
11606 },
11607 CreateLoadingPanelInline: function(parentElement, centerInParent){
11608  if(this.ShouldHideExistingLoadingElements())
11609   this.HideLoadingPanel();
11610  if(parentElement == null)
11611   return null;
11612  if(!this.IsLoadingContainerVisible()) {
11613   this.hasPhantomLoadingElements = true;
11614   return null;
11615  }
11616  var element = this.GetLoadingPanelElement();
11617  if(element != null) {
11618   element = this.CloneLoadingPanel(element, parentElement);
11619   if(centerInParent){
11620    ASPx.SetElementDisplay(element, true);
11621    parentElement.style.textAlign = "center";
11622   }
11623   else
11624    ASPx.SetElementDisplay(element, true);
11625   this.loadingPanelElement = element;
11626   return element;
11627  }
11628  return null;
11629 },
11630 ShowLoadingPanel: function() {
11631 },
11632 ShowLoadingElements: function() {
11633  if(this.InCallback() || this.lpTimer > -1) return;
11634  this.ShowLoadingDiv();
11635  if(this.IsCallbackAnimationEnabled())
11636   this.StartBeginCallbackAnimation();
11637  else
11638   this.ShowLoadingElementsInternal();
11639 },
11640 ShowLoadingElementsInternal: function() {
11641  if(this.lpDelay > 0 && !this.IsCallbackAnimationEnabled()) 
11642   this.lpTimer = window.setTimeout(function() { 
11643    this.ShowLoadingPanelOnTimer(); 
11644   }.aspxBind(this), this.lpDelay);
11645  else {
11646   this.RestoreLoadingDivOpacity();
11647   this.ShowLoadingPanel();
11648  }
11649 },
11650 GetLoadingPanelOffsetElement: function (baseElement) {
11651  if(this.IsCallbackAnimationEnabled()) {
11652   var element = this.GetLoadingPanelCallbackAnimationOffsetElement();
11653   if(element) {
11654    var container = typeof(ASPx.AnimationHelper) != "undefined" ? ASPx.AnimationHelper.findSlideAnimationContainer(element) : null;
11655    if(container)
11656     return container.parentNode.parentNode;
11657    else
11658     return element;
11659   }
11660  }
11661  return baseElement;
11662 },
11663 GetLoadingPanelCallbackAnimationOffsetElement: function () {
11664  return this.GetCallbackAnimationElement();
11665 },
11666 IsCallbackAnimationEnabled: function () {
11667  return (this.enableCallbackAnimation || this.isSlideCallbackAnimationEnabled()) && !this.isCallbackAnimationPrevented;
11668 },
11669 GetDefaultanimationEngineType: function() {
11670  return ASPx.AnimationEngineType.DEFAULT;
11671 },
11672 StartBeginCallbackAnimation: function () {
11673  this.beginCallbackAnimationProcessing = true;
11674  this.isCallbackFinished = false;
11675  var element = this.GetCallbackAnimationElement();
11676  if (element && this.isSlideCallbackAnimationEnabled() && this.slideAnimationDirection)
11677   ASPx.AnimationHelper.slideOut(element, this.slideAnimationDirection, this.FinishBeginCallbackAnimation.aspxBind(this), this.GetDefaultanimationEngineType(), this.rtl);
11678  else if(element && this.enableCallbackAnimation) 
11679   ASPx.AnimationHelper.fadeOut(element, this.FinishBeginCallbackAnimation.aspxBind(this));
11680  else
11681   this.FinishBeginCallbackAnimation();
11682 },
11683 CancelBeginCallbackAnimation: function() {
11684  if(this.beginCallbackAnimationProcessing) {
11685   this.beginCallbackAnimationProcessing = false;
11686   var element = this.GetCallbackAnimationElement();
11687   ASPx.AnimationHelper.cancelAnimation(element);
11688  }
11689 },
11690 FinishBeginCallbackAnimation: function () {
11691  this.beginCallbackAnimationProcessing = false;
11692  if(!this.isCallbackFinished)
11693   this.ShowLoadingElementsInternal();
11694  else {
11695   this.DoCallback(this.savedCallbackResult);
11696   this.savedCallbackResult = null;
11697  }
11698 },
11699 CheckBeginCallbackAnimationInProgress: function(callbackResult) {
11700  if(this.beginCallbackAnimationProcessing) {
11701   this.savedCallbackResult = callbackResult;
11702   this.isCallbackFinished = true;
11703   return true;
11704  }
11705  return false;
11706 },
11707 StartEndCallbackAnimation: function () {
11708  this.HideLoadingPanel();
11709  this.SetInitialLoadingDivOpacity();
11710  this.RaiseEndCallbackAnimationStart();
11711  this.endCallbackAnimationProcessing = true;
11712  var element = this.GetCallbackAnimationElement();
11713  if(element && this.isSlideCallbackAnimationEnabled() && this.slideAnimationDirection) 
11714   ASPx.AnimationHelper.slideIn(element, this.slideAnimationDirection, this.FinishEndCallbackAnimation.aspxBind(this), this.GetDefaultanimationEngineType(), this.rtl);
11715  else if(element && this.enableCallbackAnimation) 
11716   ASPx.AnimationHelper.fadeIn(element, this.FinishEndCallbackAnimation.aspxBind(this));
11717  else
11718   this.FinishEndCallbackAnimation();
11719  this.slideAnimationDirection = null;
11720 },
11721 FinishEndCallbackAnimation: function () {
11722  this.DoEndCallback();
11723  this.endCallbackAnimationProcessing = false;
11724  this.CheckRepeatGesture();
11725 },
11726 CheckEndCallbackAnimationNeeded: function() {
11727  if(!this.endCallbackAnimationProcessing && this.requestCount == 1) {
11728   this.StartEndCallbackAnimation();
11729   return true;
11730  }
11731  return false;
11732 },
11733 PreventCallbackAnimation: function() {
11734  this.isCallbackAnimationPrevented = true;
11735 },
11736 GetCallbackAnimationElement: function() {
11737  return null;
11738 },
11739 AssignSlideAnimationDirectionByPagerArgument: function(arg, currentPageIndex) {
11740  this.slideAnimationDirection = null;
11741  if(this.isSlideCallbackAnimationEnabled() && typeof(ASPx.AnimationHelper) != "undefined") {
11742   if(arg == PagerCommands.Next || arg == PagerCommands.Last)
11743    this.slideAnimationDirection = ASPx.AnimationHelper.SLIDE_LEFT_DIRECTION;
11744   else if(arg == PagerCommands.First || arg == PagerCommands.Prev)
11745    this.slideAnimationDirection = ASPx.AnimationHelper.SLIDE_RIGHT_DIRECTION;
11746   else if(!isNaN(currentPageIndex) && arg.indexOf(PagerCommands.PageNumber) == 0) {
11747    var newPageIndex = parseInt(arg.substring(2));
11748    if (!isNaN(newPageIndex)) {
11749     var leftDir = this.rtl ? ASPx.AnimationHelper.SLIDE_LEFT_DIRECTION : ASPx.AnimationHelper.SLIDE_RIGHT_DIRECTION;
11750     var rightDir = this.rtl ? ASPx.AnimationHelper.SLIDE_RIGHT_DIRECTION : ASPx.AnimationHelper.SLIDE_LEFT_DIRECTION;
11751     this.slideAnimationDirection = newPageIndex < currentPageIndex ? leftDir : rightDir;
11752    }
11753   }
11754  }
11755 },
11756 TryShowPhantomLoadingElements: function () {
11757  if(this.hasPhantomLoadingElements && this.InCallback()) {
11758   this.hasPhantomLoadingElements = false;
11759   this.ShowLoadingDivAndPanel();
11760  }
11761 },
11762 ShowLoadingDivAndPanel: function () {
11763  this.ShowLoadingDiv();
11764  this.RestoreLoadingDivOpacity();
11765  this.ShowLoadingPanel();
11766 },
11767 HideLoadingElements: function() {
11768  this.CancelBeginCallbackAnimation();
11769  this.HideLoadingPanel();
11770  this.HideLoadingDiv();
11771 },
11772 ShowLoadingPanelOnTimer: function() {
11773  this.ClearLoadingPanelTimer();
11774  if(!this.IsDOMDisposed()) {
11775   this.RestoreLoadingDivOpacity();
11776   this.ShowLoadingPanel();
11777  }
11778 },
11779 ClearLoadingPanelTimer: function() {
11780  this.lpTimer = ASPx.Timer.ClearTimer(this.lpTimer);  
11781 },
11782 HideLoadingPanel: function() {
11783  this.ClearLoadingPanelTimer();
11784  this.hasPhantomLoadingElements = false;
11785  if(ASPx.IsExistsElement(this.loadingPanelElement)) {
11786   ASPx.RemoveElement(this.loadingPanelElement);
11787   this.loadingPanelElement = null;
11788  }
11789 },
11790 SetLoadingPanelLocation: function(offsetElement, loadingPanel, x, y, offsetX, offsetY) {
11791  if(!ASPx.IsExists(x) || !ASPx.IsExists(y)){
11792   var x1 = ASPx.GetAbsoluteX(offsetElement);
11793   var y1 = ASPx.GetAbsoluteY(offsetElement);
11794   var x2 = x1;
11795   var y2 = y1;
11796   if(offsetElement == document.body) {
11797    x1 = 0;
11798    y1 = 0;
11799    x2 = ASPx.GetDocumentMaxClientWidth();
11800    y2 = ASPx.GetDocumentMaxClientHeight();
11801   }
11802   else{
11803    x2 += offsetElement.offsetWidth;
11804    y2 += offsetElement.offsetHeight;
11805   }
11806   if(x1 < ASPx.GetDocumentScrollLeft())
11807    x1 = ASPx.GetDocumentScrollLeft();
11808   if(y1 < ASPx.GetDocumentScrollTop())
11809    y1 = ASPx.GetDocumentScrollTop();
11810   if(x2 > ASPx.GetDocumentScrollLeft() + ASPx.GetDocumentClientWidth())
11811    x2 = ASPx.GetDocumentScrollLeft() + ASPx.GetDocumentClientWidth();
11812   if(y2 > ASPx.GetDocumentScrollTop() + ASPx.GetDocumentClientHeight())
11813    y2 = ASPx.GetDocumentScrollTop() + ASPx.GetDocumentClientHeight();
11814   x = x1 + ((x2 - x1 - loadingPanel.offsetWidth) / 2);
11815   y = y1 + ((y2 - y1 - loadingPanel.offsetHeight) / 2);
11816  }
11817  if(ASPx.IsExists(offsetX) && ASPx.IsExists(offsetY)){
11818   x += offsetX;
11819   y += offsetY;
11820  }
11821  x = ASPx.PrepareClientPosForElement(x, loadingPanel, true);
11822  y = ASPx.PrepareClientPosForElement(y, loadingPanel, false);
11823  if(ASPx.Browser.IE && ASPx.Browser.Version > 8) {
11824   x = Math.round(x);
11825   y = Math.round(y);
11826  }
11827  ASPx.SetStyles(loadingPanel, { left: x, top: y });
11828 },
11829 GetLoadingDiv: function(){
11830  return ASPx.GetElementById(this.name + "_LD");
11831 },
11832 CreateLoadingDiv: function(parentElement, offsetElement){
11833  if(this.ShouldHideExistingLoadingElements())
11834   this.HideLoadingDiv();
11835  if(parentElement == null) 
11836   return null;
11837  if(!this.IsLoadingContainerVisible()) {
11838   this.hasPhantomLoadingElements = true;
11839   return null;
11840  }
11841  if(!offsetElement)
11842   offsetElement = parentElement;
11843  var div = this.GetLoadingDiv();
11844  if(div != null){
11845   div = div.cloneNode(true);
11846   parentElement.appendChild(div);
11847   ASPx.SetElementDisplay(div, true);
11848   ASPx.Evt.AttachEventToElement(div, ASPx.TouchUIHelper.touchMouseDownEventName, ASPx.Evt.PreventEvent);
11849   ASPx.Evt.AttachEventToElement(div, ASPx.TouchUIHelper.touchMouseMoveEventName, ASPx.Evt.PreventEvent);
11850   ASPx.Evt.AttachEventToElement(div, ASPx.TouchUIHelper.touchMouseUpEventName, ASPx.Evt.PreventEvent);
11851   ASPx.Evt.AttachEventToElement(div, ASPx.Evt.GetMouseWheelEventName(), ASPx.Evt.PreventEvent);
11852   this.SetLoadingDivBounds(offsetElement, div);
11853   this.loadingDivElement = div;
11854   this.SetInitialLoadingDivOpacity();
11855   return div;
11856  }
11857  return null;
11858 },
11859 SetInitialLoadingDivOpacity: function() {
11860  if(!this.loadingDivElement) return;
11861  ASPx.Attr.SaveStyleAttribute(this.loadingDivElement, "opacity");
11862  ASPx.Attr.SaveStyleAttribute(this.loadingDivElement, "filter");
11863  ASPx.SetElementOpacity(this.loadingDivElement, 0.01);
11864 },
11865 RestoreLoadingDivOpacity: function() {
11866  if(!this.loadingDivElement) return;
11867  ASPx.Attr.RestoreStyleAttribute(this.loadingDivElement, "opacity");
11868  ASPx.Attr.RestoreStyleAttribute(this.loadingDivElement, "filter");
11869 },
11870 SetLoadingDivBounds: function(offsetElement, loadingDiv) {
11871  var absX = (offsetElement == document.body) ? 0 : ASPx.GetAbsoluteX(offsetElement);
11872  var absY = (offsetElement == document.body) ? 0 : ASPx.GetAbsoluteY(offsetElement);
11873  ASPx.SetStyles(loadingDiv, {
11874   left: ASPx.PrepareClientPosForElement(absX, loadingDiv, true),
11875   top: ASPx.PrepareClientPosForElement(absY, loadingDiv, false)
11876  });
11877  var width = (offsetElement == document.body) ? ASPx.GetDocumentWidth() : offsetElement.offsetWidth;
11878  var height = (offsetElement == document.body) ? ASPx.GetDocumentHeight() : offsetElement.offsetHeight;
11879  if(height < 0) 
11880   height = 0;
11881  ASPx.SetStyles(loadingDiv, { width: width, height: height });
11882  var correctedWidth = 2 * width - loadingDiv.offsetWidth;
11883  if(correctedWidth <= 0) correctedWidth = width;
11884  var correctedHeight = 2 * height - loadingDiv.offsetHeight;
11885  if(correctedHeight <= 0) correctedHeight = height;
11886  ASPx.SetStyles(loadingDiv, { width: correctedWidth, height: correctedHeight });
11887 },
11888 ShowLoadingDiv: function() {
11889 },
11890 HideLoadingDiv: function() {
11891  this.hasPhantomLoadingElements = false;
11892  if(ASPx.IsExistsElement(this.loadingDivElement)){
11893   ASPx.RemoveElement(this.loadingDivElement);
11894   this.loadingDivElement = null;
11895  }
11896 },
11897 CanHandleGesture: function(evt) {
11898  return false;
11899 },
11900 CanHandleGestureCore: function(evt) {
11901  var source = ASPx.Evt.GetEventSource(evt);
11902  if(ASPx.GetIsParent(this.loadingPanelElement, source) || ASPx.GetIsParent(this.loadingDivElement, source))
11903   return true; 
11904  var callbackAnimationElement = this.GetCallbackAnimationElement();
11905  if(!callbackAnimationElement)
11906   return false;
11907  var animationContainer = ASPx.AnimationHelper.getSlideAnimationContainer(callbackAnimationElement, false, false);
11908  if(animationContainer && ASPx.GetIsParent(animationContainer, source) && !ASPx.GetIsParent(animationContainer.childNodes[0], source))
11909   return true; 
11910  return this.CanHandleGesture(evt); 
11911 },
11912 AllowStartGesture: function() {
11913  return !this.beginCallbackAnimationProcessing && !this.endCallbackAnimationProcessing;
11914 },
11915 StartGesture: function() {
11916 },
11917 AllowExecuteGesture: function(value) {
11918  return false;
11919 },
11920 ExecuteGesture: function(value) {
11921 },
11922 CancelGesture: function(value) {
11923  if(this.repeatedGestureCount === 0) {
11924   this.repeatedGestureValue = value;
11925   this.repeatedGestureCount = 1;
11926  }
11927  else {
11928   if(this.repeatedGestureValue * value > 0)
11929    this.repeatedGestureCount++;
11930   else
11931    this.repeatedGestureCount--;
11932   if(this.repeatedGestureCount === 0)
11933    this.repeatedGestureCount = 0;
11934  }
11935 },
11936 CheckRepeatGesture: function() {
11937  if(this.repeatedGestureCount !== 0) {
11938   if(this.AllowExecuteGesture(this.repeatedGestureValue))
11939    this.ExecuteGesture(this.repeatedGestureValue, this.repeatedGestureCount);
11940   this.repeatedGestureValue = 0;
11941   this.repeatedGestureCount = 0;
11942  }
11943 },
11944 AllowExecutePagerGesture: function (pageIndex, pageCount, value) {
11945  if(pageIndex < 0) return false;
11946  if(pageCount <= 1) return false;
11947  if(value > 0 && pageIndex === 0) return false;
11948  if(value < 0 && pageIndex === pageCount - 1) return false;
11949  return true;
11950 },
11951 ExecutePagerGesture: function(pageIndex, pageCount, value, count, method) {
11952  if(!count) count = 1;
11953  var pageIndex = pageIndex + (value < 0 ? count : -count);
11954  if(pageIndex < 0) pageIndex = 0;
11955  if(pageIndex > pageCount - 1) pageIndex = pageCount - 1;
11956  method(PagerCommands.PageNumber + pageIndex);
11957 },
11958 RaiseInit: function(){
11959  if(!this.Init.IsEmpty()){
11960   var args = new ASPxClientEventArgs();
11961   this.Init.FireEvent(this, args);
11962  }
11963 },
11964 RaiseBeginCallbackInternal: function(command){
11965  if(!this.BeginCallback.IsEmpty()){
11966   var args = new ASPxClientBeginCallbackEventArgs(command);
11967   this.BeginCallback.FireEvent(this, args);
11968  }
11969 },
11970 RaiseEndCallbackInternal: function(command) {
11971  if(!this.EndCallback.IsEmpty()){
11972   var args = new ASPxClientEndCallbackEventArgs(command);
11973   this.EndCallback.FireEvent(this, args);
11974  }
11975 },
11976 RaiseCallbackErrorInternal: function(message, callbackId) {
11977  if(!this.CallbackError.IsEmpty()) {
11978   var args = new ASPxClientCallbackErrorEventArgs(message, callbackId);
11979   this.CallbackError.FireEvent(this, args);
11980   if(args.handled)
11981    return { isHandled: true, errorMessage: args.message };
11982  }
11983 },
11984 RaiseBeginCallback: function(command){
11985  this.RaiseBeginCallbackInternal(command);    
11986  aspxGetControlCollection().RaiseBeginCallback(this, command);
11987 },
11988 RaiseEndCallback: function(command){
11989  this.RaiseEndCallbackInternal(command);
11990  aspxGetControlCollection().RaiseEndCallback(this, command);
11991 },
11992 RaiseCallbackError: function (message, callbackId) {
11993  var result = this.RaiseCallbackErrorInternal(message, callbackId);
11994  if(!result) 
11995   result = aspxGetControlCollection().RaiseCallbackError(this, message, callbackId);
11996  return result;
11997 },
11998 RaiseEndCallbackAnimationStart: function(){
11999  if(!this.EndCallbackAnimationStart.IsEmpty()){
12000   var args = new ASPxClientEventArgs();
12001   this.EndCallbackAnimationStart.FireEvent(this, args);
12002  }
12003 },
12004 RaiseBeforePronounce: function(message) {
12005  var args = new ASPxClientControlBeforePronounceEventArgs(message, this);
12006  if(!this.BeforePronounce.IsEmpty())
12007   this.BeforePronounce.FireEvent(this, args);
12008  return args;
12009 },
12010 RaiseUnload: function() {
12011  var args = new ASPxClientControlUnloadEventArgs(this);
12012  if(!this.Unload.IsEmpty())
12013   this.Unload.FireEvent(this, args);
12014 },
12015 SendMessageToAssistiveTechnology: function(message) {
12016  if(!this.accessibilityCompliant)
12017   return;
12018  this.PronounceMessageInternal(message, ASPx.AccessibilityPronouncerType.live);
12019 },
12020 PronounceMessageInternal: function(messageArg, type) {
12021  var message = messageArg;
12022  if(!ASPx.Ident.IsArray(messageArg))
12023   message = [messageArg];
12024  var args = this.RaiseBeforePronounce(message);
12025  ASPx.AccessibilityPronouncer.Pronounce(args, type);
12026 },
12027 IsVisible: function() {
12028  var element = this.GetMainElement();
12029  return ASPx.IsElementVisible(element);
12030 },
12031 IsDisplayedElement: function(element) {
12032  while(element && element.tagName != "BODY") {
12033   if(!ASPx.GetElementDisplay(element)) 
12034    return false;
12035   element = element.parentNode;
12036  }
12037  return true;
12038 },
12039 IsDisplayed: function() {
12040  return this.IsDisplayedElement(this.GetMainElement());
12041 },
12042 IsHiddenElement: function(element) {
12043  return element && element.offsetWidth == 0 && element.offsetHeight == 0;
12044 },
12045 IsHidden: function() {
12046  return this.IsHiddenElement(this.GetMainElement());
12047 },
12048 IsDisposed: function() {
12049  return this.disposed;
12050 },
12051 GetParentControl: function() {
12052  var mainElement = this.getActualMainElement();
12053  var popupPostfix = ASPx.PCWIdSuffix + "-1";
12054  var result = null;
12055  ASPx.GetParent(mainElement, function(element) {
12056   if(element === mainElement || !element.id)
12057    return false;
12058   var controlName = element.id.replace(popupPostfix, "");
12059   result = ASPx.GetControlCollection().Get(controlName);
12060   return !!result;
12061  });
12062  return result;
12063 },
12064 getActualMainElement: function() { return this.GetMainElement(); },
12065 findParentByType: function (type) {
12066  var ctrl = this;
12067  while (ctrl) {
12068   var parent = ctrl.GetParentControl();
12069   if (parent && parent instanceof type)
12070    return parent;
12071   ctrl = parent;
12072  }
12073  return null;
12074 },
12075 Focus: function() {
12076 },
12077 GetClientVisible: function(){
12078  return this.GetVisible();
12079 },
12080 SetClientVisible: function(visible){
12081  this.SetVisible(visible);
12082 },
12083 GetVisible: function(){
12084  return this.clientVisible;
12085 },
12086 SetVisible: function(visible){
12087  if(this.clientVisible != visible){
12088   this.clientVisible = visible;
12089   ASPx.SetElementDisplay(this.GetMainElement(), visible);
12090   if(visible) {
12091    this.AdjustControl();
12092    var mainElement = this.GetMainElement();
12093    if(mainElement)
12094     aspxGetControlCollection().AdjustControls(mainElement);
12095   }
12096  }
12097 },
12098 GetEnabled: function() {
12099  return this.clientEnabled;
12100 },
12101 SetEnabled: function(enabled) {
12102  this.clientEnabled = enabled;
12103  if(ASPxClientControl.setEnabledLocked)
12104   return;
12105  else
12106   ASPxClientControl.setEnabledLocked = true;
12107  this.savedClientEnabled = enabled;
12108  aspxGetControlCollection().ProcessControlsInContainer(this.GetMainElement(), function(control) {
12109   if(ASPx.IsFunction(control.SetEnabled))
12110    control.SetEnabled(enabled && control.savedClientEnabled);
12111  });
12112  delete ASPxClientControl.setEnabledLocked;
12113 },
12114 InCallback: function() {
12115  return this.requestCount > 0;
12116 },
12117 DoBeginCallback: function(command) {
12118  this.RaiseBeginCallback(command || "");
12119  aspxGetControlCollection().Before_WebForm_InitCallback(this.name);
12120  if(typeof(WebForm_InitCallback) != "undefined" && WebForm_InitCallback) {
12121   __theFormPostData = "";
12122   __theFormPostCollection = [ ];
12123   this.ClearPostBackEventInput("__EVENTTARGET");
12124   this.ClearPostBackEventInput("__EVENTARGUMENT");
12125   WebForm_InitCallback();
12126   this.savedFormPostData = __theFormPostData;   
12127   this.savedFormPostCollection = __theFormPostCollection;
12128  }
12129 },
12130 ClearPostBackEventInput: function(id){
12131  var element = ASPx.GetElementById(id);
12132  if(element != null) element.value = "";
12133 },
12134 PerformDataCallback: function(arg, handler) {
12135  this.CreateCustomDataCallback(arg, "", handler);
12136 },
12137 sendCallbackViaQueue: function (prefix, arg, showLoadingPanel, context, handler, onBeforeSend) {
12138  if (!this.useCallbackQueue())
12139   return false;
12140  var context = context || this;
12141  var token = this.callbackQueueHelper.sendCallback(ASPx.FormatCallbackArg(prefix, arg), context, handler || context.OnCallback, prefix, onBeforeSend);
12142  if (showLoadingPanel)
12143   this.callbackQueueHelper.showLoadingElements();
12144  return token;
12145 },
12146 CreateCallback: function (arg, command, handler) {
12147  var callbackInfo = this.CreateCallbackInfo(ASPx.CallbackType.Common, handler || null);
12148  var callbackID = this.CreateCallbackByInfo(arg, command, callbackInfo);
12149  return callbackID;
12150 },
12151 CreateCustomDataCallback: function(arg, command, handler) {
12152  var callbackInfo = this.CreateCallbackInfo(ASPx.CallbackType.Data, handler);
12153  this.CreateCallbackByInfo(arg, command, callbackInfo);
12154 },
12155 CreateCallbackByInfo: function(arg, command, callbackInfo) {
12156  if(!this.CanCreateCallback()) return;
12157  var callbackID;
12158  if(typeof(WebForm_DoCallback) != "undefined" && WebForm_DoCallback && ASPx.documentLoaded || ASPx.Platform === "NETCORE")
12159   callbackID = this.CreateCallbackInternal(arg, command, true, callbackInfo);
12160  else {
12161   if(!this.savedCallbacks)
12162    this.savedCallbacks = [];
12163   var callbackInfo = { arg: arg, command: command, callbackInfo: callbackInfo };
12164   if(this.allowMultipleCallbacks)
12165    this.savedCallbacks.push(callbackInfo);
12166   else
12167    this.savedCallbacks[0] = callbackInfo;
12168  }
12169  return callbackID;
12170 },
12171 CreateCallbackInternal: function(arg, command, viaTimer, callbackInfo) {
12172  var watcher = ASPx.ControlUpdateWatcher.getInstance();
12173  if(watcher && !watcher.CanSendCallback(this, arg)) {
12174   this.CancelCallbackInternal();
12175   return;
12176  }
12177  this.requestCount++;
12178  this.DoBeginCallback(command);
12179  if(typeof(arg) == "undefined")
12180   arg = "";
12181  if(typeof(command) == "undefined")
12182   command = "";
12183  var callbackID = this.SaveCallbackInfo(callbackInfo, command),
12184   customArgs = this.GetCustomCallbackArgs();
12185  if(viaTimer)
12186   window.setTimeout(function() { this.CreateCallbackCoreWithCustomArgs(arg, command, callbackID, customArgs); }.aspxBind(this), 0);
12187  else
12188   this.CreateCallbackCoreWithCustomArgs(arg, command, callbackID, customArgs);
12189  return callbackID;
12190 },
12191 CreateCallbackCoreWithCustomArgs: function(arg, command, callbackID, customArgs) {
12192  this.CreateCallbackCore(arg, command, callbackID);
12193 },
12194 GetCustomCallbackArgs: function() {
12195  return {};
12196 },
12197 CancelCallbackInternal: function() {
12198  this.CancelCallbackCore();
12199  this.HideLoadingElements();
12200 },
12201 CancelCallbackCore: function() {
12202 },
12203 CreateCallbackCore: function(arg, command, callbackID) {
12204  var callBackMethod = this.GetCallbackMethod(command);
12205  __theFormPostData = this.savedFormPostData;
12206  __theFormPostCollection = this.savedFormPostCollection;
12207  callBackMethod.call(this, this.GetSerializedCallbackInfoByID(callbackID) + arg);
12208 },
12209 GetCallbackMethod: function(command){
12210  return this.callBack;
12211 },
12212 CanCreateCallback: function() {
12213  return !this.InCallback() || (this.allowMultipleCallbacks && !this.beginCallbackA
12213nimationProcessing && !this.endCallbackAnimationProcessing);
12214 },
12215 DoLoadCallbackScripts: function() {
12216  ASPx.ProcessScriptsAndLinks(this.name, true);
12217 },
12218 DoEndCallback: function() {
12219  if(this.IsCallbackAnimationEnabled() && this.CheckEndCallbackAnimationNeeded()) 
12220   return;
12221  this.requestCount--;
12222  if (this.requestCount < 1) 
12223   this.callbackHandlersQueue.executeCallbacksHandlers();
12224  if(this.HideLoadingPanelOnCallback() && this.requestCount < 1) 
12225   this.HideLoadingElements();
12226  if(this.isSwipeGesturesEnabled() && this.supportGestures) {
12227   ASPx.GesturesHelper.UpdateSwipeAnimationContainer(this.name);
12228   if(this.touchUIMouseScroller)
12229    this.touchUIMouseScroller.update();
12230  }
12231  this.isCallbackAnimationPrevented = false;
12232  this.OnCallbackFinalized();
12233  this.AssignEllipsisTooltips();
12234  var command = this.GetCallbackCommand();
12235  this.RaiseEndCallback(command);
12236  this.currentCallbackID = -1;
12237 },
12238 DoFinalizeCallback: function() {
12239 },
12240 OnCallbackFinalized: function() {
12241 },
12242 AssignEllipsisTooltips: function() { },
12243 GetCallbackCommand: function() {
12244  var result = "";
12245  if(this.currentCallbackID != -1) {
12246   var command = this.callbackCommand[this.currentCallbackID];
12247   if(command)
12248    result = command;
12249  }
12250  return result;
12251 },
12252 HideLoadingPanelOnCallback: function() {
12253  return true;
12254 },
12255 ShouldHideExistingLoadingElements: function() {
12256  return true;
12257 },
12258 EvalCallbackResult: function(resultString){
12259  return eval(resultString);
12260 },
12261 ParseJSProperties: function(resultObj) {
12262  if(resultObj.cp) {
12263   for(var name in resultObj.cp)
12264    if(resultObj.cp.hasOwnProperty(name)) {
12265     this[name] = resultObj.cp[name];
12266     if(this.aspNetCoreWrapperInstance)
12267      this.aspNetCoreWrapperInstance[name] = resultObj.cp[name]; 
12268    }
12269  }
12270 },
12271 DoCallback: function(result) {
12272  if(this.IsCallbackAnimationEnabled() && this.CheckBeginCallbackA
12272nimationInProgress(result))
12273   return;
12274  result = ASPx.Str.Trim(result);
12275  if(result.indexOf(ASPx.CallbackResultPrefix) != 0) 
12276   this.ProcessCallbackGeneralError(result, false);
12277  else {
12278   var resultObj = null;
12279   try {
12280    resultObj = this.EvalCallbackResult(result);
12281   } 
12282   catch(e) {
12283   }
12284   if(resultObj) {
12285    this.currentCallbackID = resultObj.id;
12286    ASPx.CacheHelper.DropCache(this);
12287    if(resultObj.redirect) {
12288     this.ParseJSProperties(resultObj); 
12289     ASPx.Url.Redirect(resultObj.redirect);
12290    }
12291    else if(ASPx.IsExists(resultObj.generalError)) {
12292     this.ProcessCallbackGeneralError(resultObj.generalError, true);
12293    }
12294    else {
12295     var errorObj = resultObj.error;
12296     if(errorObj) { 
12297      if(this.parseJSPropertiesOnCallbackError)
12298       this.ParseJSProperties(resultObj);
12299      this.ProcessCallbackError(errorObj,resultObj.id);
12300     } else {
12301      this.ParseJSProperties(resultObj);
12302      var callbackInfo = this.DequeueCallbackInfo(resultObj.id);
12303      if(callbackInfo && callbackInfo.type == ASPx.CallbackType.Data)
12304       this.ProcessCustomDataCallback(resultObj.result, callbackInfo);
12305      else {
12306       if (this.useCallbackQueue() && this.callbackQueueHelper.getCallbackInfoById(resultObj.id))
12307        this.callbackQueueHelper.processCallback(resultObj.result, resultObj.id);
12308       else {
12309        this.ProcessCallback(resultObj.result, resultObj.id);
12310        if(callbackInfo && callbackInfo.handler) {
12311         var handlerInfo = { handler: callbackInfo.handler, result: resultObj.result.data };
12312         this.callbackHandlersQueue.addCallbackHandler(handlerInfo);
12313        }
12314       }
12315      }
12316     }
12317    }
12318   }
12319  }
12320  this.DoLoadCallbackScripts();
12321 },
12322 DoCallbackError: function(result) {
12323  this.HideLoadingElements();
12324  this.ProcessCallbackGeneralError(result, false); 
12325 },
12326 DoControlClick: function(evt) {
12327  this.OnControlClick(ASPx.Evt.GetEventSource(evt), evt);
12328 },
12329 ProcessCallback: function (result, callbackId) {
12330  this.OnCallback(result, callbackId);
12331 },
12332 ProcessCustomDataCallback: function(result, callbackInfo) {
12333  if(callbackInfo.handler != null)
12334   callbackInfo.handler(this, result);
12335  this.RaiseCustomDataCallback(result);
12336 },
12337 RaiseCustomDataCallback: function(result) {
12338  if(!this.CustomDataCallback.IsEmpty()) {
12339   var arg = new ASPxClientCustomDataCallbackEventArgs(result);
12340   this.CustomDataCallback.FireEvent(this, arg);
12341  }
12342 },
12343 OnCallback: function(result) {
12344 },
12345 CreateCallbackInfo: function(type, handler) {
12346  return { type: type, handler: handler };
12347 },
12348 GetSerializedCallbackInfoByID: function(callbackID) {
12349  return this.GetCallbackInfoByID(callbackID).type + callbackID + ASPx.CallbackSeparator;
12350 },
12351 SaveCallbackInfo: function(info, command) {
12352  var callbacks = this.GetActiveCallbacksInfo();
12353  var index = callbacks.indexOf(null);
12354  if(index === -1)
12355   index = callbacks.length;
12356  callbacks[index] = info;
12357  this.callbackCommand[index] = command;
12358  return index;
12359 },
12360 GetActiveCallbacksInfo: function() {
12361  var persistentProperties = this.GetPersistentProperties();
12362  if(!persistentProperties.activeCallbacks)
12363   persistentProperties.activeCallbacks = [ ];
12364  return persistentProperties.activeCallbacks;
12365 },
12366 GetPersistentProperties: function() {
12367  var storage = _aspxGetPersistentControlPropertiesStorage();
12368  var persistentProperties = storage[this.name];
12369  if(!persistentProperties) {
12370   persistentProperties = { };
12371   storage[this.name] = persistentProperties;
12372  }
12373  return persistentProperties;
12374 },
12375 GetCallbackInfoByID: function(callbackID) {
12376  return this.GetActiveCallbacksInfo()[callbackID];
12377 },
12378 DequeueCallbackInfo: function(index) {
12379  var activeCallbacksInfo = this.GetActiveCallbacksInfo();
12380  if(index < 0 || index >= activeCallbacksInfo.length)
12381   return null;
12382  var result = activeCallbacksInfo[index];
12383  activeCallbacksInfo[index] = null;
12384  return result;
12385 },
12386 ProcessCallbackError: function (errorObj, callbackId) {
12387  var data = ASPx.IsExists(errorObj.data) ? errorObj.data : null;
12388  var result = this.RaiseCallbackError(errorObj.message, callbackId);
12389  if(result.isHandled)
12390   this.OnCallbackErrorAfterUserHandle(result.errorMessage, data); 
12391  else
12392   this.OnCallbackError(result.errorMessage, data); 
12393 },
12394 OnCallbackError: function(errorMessage, data) {
12395  if(errorMessage)
12396   ASPx.ShowErrorAlert(errorMessage);
12397 },
12398 OnCallbackErrorAfterUserHandle: function(errorMessage, data) {
12399 },
12400 ProcessCallbackGeneralError: function(errorMessage, serverExceptionOnLastCallback) {
12401  this.serverExceptionOnLastCallback = serverExceptionOnLastCallback;
12402  var result = this.RaiseCallbackError(errorMessage);
12403  if(result.isHandled)
12404   this.OnCallbackGeneralErrorAfterUserHandle(result.errorMessage);
12405  else
12406   this.OnCallbackGeneralError(result.errorMessage);
12407 },
12408 OnCallbackGeneralError: function(errorMessage) {
12409  this.OnCallbackError(errorMessage, null);
12410 },
12411 OnCallbackGeneralErrorAfterUserHandle: function (errorMessage) {
12412 },
12413 SendPostBack: function(params, preventConvertToUpdatePanelCallback) {
12414  if(preventConvertToUpdatePanelCallback)
12415   this.sendMSAjaxCompatPostBack(params);
12416  else
12417   this.sendPostBackInternal(params);
12418 },
12419 sendPostBackInternal: function(params) {
12420  if(typeof(__doPostBack) != "undefined")
12421   __doPostBack(this.uniqueID, params);
12422  else{
12423   var form = this.GetParentForm();
12424   if(form) form.submit();
12425  }
12426 },
12427 sendMSAjaxCompatPostBack: function(params) {
12428  var rm = ASPx.GetMSAjaxRequestManager();
12429  var triggers = rm ? rm._postBackControlClientIDs : null;
12430  var needRegister = triggers && ASPx.Ident.IsArray(triggers) && ASPx.Data.ArrayIndexOf(triggers, this.name) == -1;
12431  if(needRegister)
12432   triggers.unshift(this.name);
12433  this.sendPostBackInternal(params);
12434  if(needRegister)
12435   triggers.shift();
12436 },
12437 IsValidInstance: function () {
12438  return aspxGetControlCollection().GetByName(this.name) === this;
12439 },
12440 OnDispose: function() { 
12441  var varName = this.globalName;
12442  if(varName && varName !== "" && window && window[varName] && window[varName] == this){
12443   try{
12444    delete window[varName];
12445   }
12446   catch(e){  }
12447  }
12448  if(this.callbackQueueHelper)
12449   this.callbackQueueHelper.detachEvents();
12450  if (!this.IsDisposed())
12451   this.disposed = true;
12452 },
12453 OnGlobalControlsInitialized: function(args) { 
12454 },
12455 OnGlobalBrowserWindowResized: function(args) { 
12456 },
12457 OnGlobalBeginCallback: function(args) { 
12458 },
12459 OnGlobalEndCallback: function(args) { 
12460 },
12461 OnGlobalCallbackError: function(args) { 
12462 },
12463 OnGlobalValidationCompleted: function(args) { 
12464 },
12465 AddDefaultStateControllerItems: function() {
12466  var states = this.scStates;
12467  if(!states) return;
12468  var postfix = this.scPostfix ? ("_" + this.scPostfix) : "";
12469  var mainElementId = this.GetMainElementId();
12470  if(states & 2)
12471   this.AddDefaultReadOnlyStateControllerItem(this.scPrefix + "ReadOnly" + postfix, mainElementId);
12472  if(states & 4)
12473   this.AddDefaultDisabledStateControllerItem(this.scPrefix + "Disabled" + postfix, mainElementId);
12474 },
12475 AddDefaultReadOnlyStateControllerItem: function(cssClass, mainElementId) { throw "Not implemented"; },
12476 AddDefaultDisabledStateControllerItem: function(cssClass, mainElementId) { throw "Not implemented"; },
12477 DOMContentLoaded: function() { },
12478 IsStateControllerEnabled: function() { return false; },
12479 InitializeDOM: function() {
12480  var mainElement = this.GetMainElement();
12481  if(mainElement)
12482   ASPx.SetElementInitializedFlag(mainElement);
12483 },
12484 IsDOMInitialized: function() {
12485  var mainElement = this.GetMainElement();
12486  return mainElement && ASPx.GetElementInitializedFlag(mainElement);
12487 },
12488 AdjustControl: function(nestedCall) { },
12489 OnBrowserWindowResizeInternal: function(e) { },
12490 RegisterInControlTree: function(tree) { }
12491});
12492ASPxClientControlBase.Cast = function(obj) {
12493 if(typeof obj == "string")
12494  return window[obj];
12495 return obj;
12496};
12497var persistentControlPropertiesStorage = null;
12498function _aspxGetPersistentControlPropertiesStorage() {
12499 if(persistentControlPropertiesStorage == null)
12500  persistentControlPropertiesStorage = { };
12501 return persistentControlPropertiesStorage;
12502}
12503var ELLIPSIS_MARKER_CLASS = "dx-ellipsis";
12504var ELLIPSIS_TOOLTIP_MARKER_ATTR = "dxEllipsisTitle";
12505var ASPxClientControl = ASPx.CreateClass(ASPxClientControlBase, {
12506 constructor: function(name){
12507  this.constructor.prototype.constructor.call(this, name);
12508  this.rtl = false;
12509  this.enableEllipsis = false;
12510  this.isNative = false;
12511  this.isControlCollapsed = false;
12512  this.isInsideHierarchyAdjustment = false;
12513  this.controlOwner = null;
12514  this.adjustedSizes = { };
12515  this.dialogContentHashTable = { };
12516  this.renderIFrameForPopupElements = false;
12517  this.widthValueSetInPercentage = false;
12518  this.heightValueSetInPercentage = false;
12519  this.verticalAlignedElements = { };
12520  this.wrappedTextContainers = { };
12521  this.scrollPositionState = { };
12522  this.sizingConfig = {
12523   allowSetWidth: true,
12524   allowSetHeight: true,
12525   correction : false,
12526   adjustControl : false,
12527   supportPercentHeight: false,
12528   supportAutoHeight: false
12529  };
12530  this.percentSizeConfig = {
12531   width: -1,
12532   height: -1,
12533   markerWidth: -1,
12534   markerHeight: -1
12535  };  
12536 },
12537 querySelector: function(selector) { return this.querySelectorAll(selector)[0] || null; },
12538 querySelectorAll: function(selector) {
12539  return ASPx.CacheHelper.GetCachedElement(this, "querySelectorAll_" + selector,
12540   function() { return Array.prototype.slice.call(this.GetMainElement().querySelectorAll(selector)); });
12541 },
12542 createAccessKey: function (popupItem, getPopupElement, keyTipElement, key, onlyClick, manualStopProcessing) {
12543  return new ASPx.AccessKey(popupItem, getPopupElement, keyTipElement, key, onlyClick, manualStopProcessing);
12544 },
12545 InlineInitialize: function() {
12546  this.InitializeDOM();
12547  ASPxClientControlBase.prototype.InlineInitialize.call(this);
12548 },
12549 AfterCreate: function() { 
12550  ASPxClientControlBase.prototype.AfterCreate.call(this);
12551  if(!this.CanInitializeAdjustmentOnDOMContentLoaded() || ASPx.IsStartupScriptsRunning())
12552   this.InitializeAdjustment();
12553 },
12554 DOMContentLoaded: function() {
12555  if(this.CanInitializeAdjustmentOnDOMContentLoaded()) 
12556   this.InitializeAdjustment();
12557 },
12558 CanInitializeAdjustmentOnDOMContentLoaded: function() {
12559  return !ASPx.Browser.IE || ASPx.Browser.Version >= 10; 
12560 },
12561 InitializeAdjustment: function() {
12562  this.UpdateAdjustmentFlags();
12563  this.AdjustControl();
12564 },
12565 AfterInitialize: function() {
12566  this.AdjustControl();
12567  ASPxClientControlBase.prototype.AfterInitialize.call(this);
12568 },
12569 IsStateControllerEnabled: function(){
12570  return typeof(ASPx.GetStateController) != "undefined" && ASPx.GetStateController();
12571 },
12572 GetWidth: function() {
12573  return this.GetMainElement().offsetWidth;
12574 },
12575 GetHeight: function() {
12576  return this.GetMainElement().offsetHeight;
12577 },
12578 SetWidth: function(width) {
12579  if(this.sizingConfig.allowSetWidth)
12580   this.SetSizeCore("width", width, "GetWidth", false);
12581 },
12582 SetHeight: function(height) {
12583  if(this.sizingConfig.allowSetHeight)
12584   this.SetSizeCore("height", height, "GetHeight", false);
12585 },
12586 SetSizeCore: function(sizePropertyName, size, getFunctionName, corrected) {
12587  if(size < 0 || !this.GetMainElement())
12588   return;
12589  this.GetMainElement().style[sizePropertyName] = size + "px";
12590  this.UpdateAdjustmentFlags(sizePropertyName);
12591  if(this.sizingConfig.adjustControl)
12592   this.AdjustControl(true);
12593  if(this.sizingConfig.correction && !corrected) {
12594   var realSize = this[getFunctionName]();
12595   if(realSize != size) {
12596    var correctedSize = size - (realSize - size);
12597    this.SetSizeCore(sizePropertyName, correctedSize, getFunctionName, true);
12598   }
12599  }
12600 },
12601 AdjustControl: function(nestedCall) {
12602  if(this.IsAdjustmentRequired() && (!ASPxClientControl.adjustControlLocked || nestedCall)) {
12603   ASPxClientControl.adjustControlLocked = true;
12604   try {
12605    if(!this.IsAdjustmentAllowed())
12606     return;
12607    this.AdjustControlCore();
12608    this.UpdateAdjustedSizes();
12609   } 
12610   finally {
12611    delete ASPxClientControl.adjustControlLocked;
12612   }
12613  }
12614  this.AssignEllipsisTooltips();
12615  this.TryShowPhantomLoadingElements();
12616 },
12617 ResetControlAdjustment: function () {
12618  this.adjustedSizes = { };
12619 },
12620 UpdateAdjustmentFlags: function(sizeProperty) {
12621  var mainElement = this.GetMainElement();
12622  if(mainElement) {
12623   var mainElementStyle = ASPx.GetCurrentStyle(mainElement);
12624   this.UpdatePercentSizeConfig([mainElementStyle.width, mainElement.style.width], [mainElementStyle.height, mainElement.style.height], sizeProperty);
12625  }
12626 },
12627 UpdatePercentSizeConfig: function(widths, heights, modifyStyleProperty) {
12628  switch(modifyStyleProperty) {
12629   case "width":
12630    this.UpdatePercentWidthConfig(widths);
12631    break;
12632   case "height":
12633    this.UpdatePercentHeightConfig(heights);
12634    break;
12635   default:
12636    this.UpdatePercentWidthConfig(widths);
12637    this.UpdatePercentHeightConfig(heights);
12638    break;
12639  }
12640  this.ResetControlPercentMarkerSize();
12641 },
12642 UpdatePercentWidthConfig: function(widths) {
12643  this.widthValueSetInPercentage = false;
12644  for(var i = 0; i < widths.length; i++) {
12645   if(this.IsPercentageWidth(widths[i])) {
12646    this.percentSizeConfig.width = widths[i];
12647    this.widthValueSetInPercentage = true;
12648    break;
12649   }
12650  }
12651 },
12652 IsPercentageWidth: function(width) { return ASPx.IsPercentageSize(width); },
12653 UpdatePercentHeightConfig: function(heights) {
12654  this.heightValueSetInPercentage = false;
12655    for(var i = 0; i < heights.length; i++) {
12656   if(ASPx.IsPercentageSize(heights[i])) {
12657    this.percentSizeConfig.height = heights[i];
12658    this.heightValueSetInPercentage = true;
12659    break;
12660   }
12661  }
12662 },
12663 GetAdjustedSizes: function() {
12664  var mainElement = this.GetMainElement();
12665  if(mainElement) 
12666   return { width: mainElement.offsetWidth, height: mainElement.offsetHeight };
12667  return { width: 0, height: 0 };
12668 },
12669 IsAdjusted: function() {
12670  return (this.adjustedSizes.width && this.adjustedSizes.width > 0) && (this.adjustedSizes.height && this.adjustedSizes.height > 0);
12671 },
12672 IsAdjustmentRequired: function() {
12673  if(!this.IsAdjusted())
12674   return true;
12675  if(this.widthValueSetInPercentage)
12676   return true;
12677  if(this.heightValueSetInPercentage)
12678   return true;
12679  var sizes = this.GetAdjustedSizes();
12680  for(var name in sizes){
12681   if(this.adjustedSizes[name] !== sizes[name])
12682    return true;
12683  }
12684  return false;
12685 },
12686 IsAdjustmentAllowed: function() {
12687  var mainElement = this.GetMainElement();
12688  return mainElement && this.IsDisplayed() && !this.IsHidden() && this.IsDOMInitialized();
12689 },
12690 UpdateAdjustedSizes: function() {
12691  var sizes = this.GetAdjustedSizes();
12692  for(var name in sizes)
12693   if(sizes.hasOwnProperty(name))
12694    this.adjustedSizes[name] = sizes[name];
12695 },
12696 AdjustControlCore: function() {
12697 },
12698 AdjustAutoHeight: function() {
12699 },
12700 IsControlCollapsed: function() {
12701  return this.isControlCollapsed;
12702 },
12703 NeedCollapseControl: function() {
12704  return this.NeedCollapseControlCore() && this.IsAdjustmentRequired() && this.IsAdjustmentAllowed();
12705 },
12706 NeedCollapseControlCore: function() {
12707  return false;
12708 },
12709 CollapseEditor: function() {
12710 },
12711 CollapseControl: function() {
12712  this.SaveScrollPositions();
12713  var mainElement = this.GetMainElement(),
12714   marker = this.GetControlPercentSizeMarker();
12715  marker.style.height = this.heightValueSetInPercentage && this.sizingConfig.supp
12715ortPercentHeight
12716   ? this.percentSizeConfig.height 
12717   : (mainElement.offsetHeight + "px");
12718  mainElement.style.display = "none";
12719  this.isControlCollapsed = true;
12720 },
12721 ExpandControl: function() {
12722  var mainElement = this.GetMainElement();
12723  mainElement.style.display = "";
12724  this.GetControlPercentSizeMarker().style.height = "0px";
12725  this.isControlCollapsed = false;
12726  this.RestoreScrollPositions();
12727 },
12728 CanCauseReadjustment: function() {
12729  return this.NeedCollapseControlCore();
12730 },
12731 IsExpandableByAdjustment: function() {
12732  return false;
12733 },
12734 HasFixedPosition: function() {
12735  return false;
12736 },
12737 SaveScrollPositions: function() {
12738  var mainElement = this.GetMainElement();
12739  this.scrollPositionState.outer = ASPx.GetOuterScrollPosition(mainElement.parentNode);
12740  this.scrollPositionState.inner = ASPx.GetInnerScrollPositions(mainElement);
12741 },
12742 RestoreScrollPositions: function() {
12743  ASPx.RestoreOuterScrollPosition(this.scrollPositionState.outer);
12744  ASPx.RestoreInnerScrollPositions(this.scrollPositionState.inner);
12745 },
12746 GetControlPercentSizeMarker: function() {
12747  if(this.percentSizeMarker === undefined) {
12748   this.percentSizeMarker = ASPx.CreateHtmlElementFromString("<div style='height:0px;font-size:0px;line-height:0;width:100%;'></div>");
12749   ASPx.InsertElementAfter(this.percentSizeMarker, this.GetMainElement());
12750  }
12751  return this.percentSizeMarker;
12752 },
12753 KeepControlPercentSizeMarker: function(needCollapse, needCalculateHeight) {
12754  var marker = this.GetControlPercentSizeMarker(),
12755   markerHeight;
12756  if(needCollapse)
12757   this.CollapseControl();
12758  if(this.widthValueSetInPercentage && marker.style.width !== this.percentSizeConfig.width)
12759   marker.style.width = this.percentSizeConfig.width;
12760  if(needCalculateHeight) {
12761   if(this.IsControlCollapsed())
12762    markerHeight = marker.style.height;
12763   marker.style.height = this.percentSizeConfig.height;
12764  }
12765  this.percentSizeConfig.markerWidth = marker.offsetWidth;
12766  if(needCalculateHeight) {
12767   this.percentSizeConfig.markerHeight = marker.offsetHeight;
12768   if(this.IsControlCollapsed())
12769    marker.style.height = markerHeight;
12770   else
12771    marker.style.height = "0px";
12772  }
12773  if(needCollapse)
12774   this.ExpandControl();
12775 },
12776 ResetControlPercentMarkerSize: function() {
12777  this.percentSizeConfig.markerWidth = -1;
12778  this.percentSizeConfig.markerHeight = -1;
12779 },
12780 GetControlPercentMarkerSize: function(hideControl, force) {
12781  var needCalculateHeight = this.heightValueSetInPercentage && this.sizingConfig.supportPercentHeight;
12782  if(force || this.percentSizeConfig.markerWidth < 1 || (needCalculateHeight && this.percentSizeConfig.markerHeight < 1))
12783   this.KeepControlPercentSizeMarker(hideControl && !this.IsControlCollapsed(), needCalculateHeight);
12784  return {
12785   width: this.percentSizeConfig.markerWidth,
12786   height: this.percentSizeConfig.markerHeight
12787  };
12788 },
12789 AssignEllipsisTooltips: function() {
12790  if(this.RequireAssignTooltips())
12791   this.AssignEllipsisTooltipsCore();
12792 },
12793 AssignEllipsisTooltipsCore: function(rootElement, reassingExistingTooltips) {
12794  var requirePaddingManipulation = ASPx.Browser.IE || ASPx.Browser.Edge || ASPx.Browser.Firefox;
12795  rootElement = rootElement || this.GetMainElement();
12796  var nodes = this.GetEllipsisNodes(rootElement);
12797  var nodeInfos = [];
12798  var nodesCount = nodes.length;
12799  for(var i = 0; i < nodesCount; i++) {
12800   var node = nodes[i];
12801   var info = { node: node };
12802   if(requirePaddingManipulation) {
12803    var style = ASPx.GetCurrentStyle(node);
12804    info.paddingLeft = node.style.paddingLeft;
12805    info.totalPadding = ASPx.GetLeftRightPaddings(node, style);
12806   }
12807   nodeInfos.push(info);
12808  }
12809  if(requirePaddingManipulation) {
12810   for(var i = 0; i < nodesCount; i++) {
12811    var info = nodeInfos[i];
12812    ASPx.SetStyles(info.node, { paddingLeft: info.totalPadding }, true);
12813   }
12814  }
12815  for(var i = 0; i < nodesCount; i++) {
12816   var info = nodeInfos[i];
12817   var node = info.node;
12818   info.isTextShortened = node.scrollWidth > node.clientWidth;
12819   info.hasTitle = ASPx.Attr.GetAttribute(node, "title") !== null;
12820   if(!info.hasTitle || reassingExistingTooltips)
12821    info.title = this.GetEllipsisTooltipText(node);
12822  }
12823  for(var i = 0; i < nodesCount; i++) {
12824   var info = nodeInfos[i];
12825   var node = info.node;
12826   if(info.isTextShortened && info.title) {
12827    ASPx.Attr.SetAttribute(node, "title", info.title);
12828    ASPx.Attr.SetAttribute(node, ELLIPSIS_TOOLTIP_MARKER_ATTR, true);
12829   }
12830   if(!info.isTextShortened && info.hasTitle)
12831    ASPx.Attr.RemoveAttribute(node, "title");
12832  }
12833  if(requirePaddingManipulation) {
12834   for(var i = 0; i < nodesCount; i++) {
12835    var info = nodeInfos[i];
12836    var node = info.node;
12837    node.style.paddingLeft = info.paddingLeft;
12838   }
12839  }
12840 },
12841 GetEllipsisNodes: function(element) {
12842  var ellipsibleNodes = ASPx.Data.CollectionToArray(ASPx.GetNodesByClassName(element, ELLIPSIS_MARKER_CLASS));
12843  if(ASPx.ElementHasCssClass(element, ELLIPSIS_MARKER_CLASS))
12844   ellipsibleNodes.push(element);
12845  return ellipsibleNodes.filter(function(node) {
12846   return !ASPx.Attr.IsExistsAttribute(node, "title") || ASPx.Attr.IsExistsAttribute(node, ELLIPSIS_TOOLTIP_MARKER_ATTR);
12847  });
12848 },
12849 GetEllipsisTooltipText: function(element) {
12850  return ASPx.GetInnerText(element);
12851 },
12852 RequireAssignTooltips: function() {
12853  return this.enableEllipsis && !ASPx.Browser.MobileUI;
12854 },
12855 RemoveEllipsisFromNode: function(node) {
12856  ASPx.RemoveClassNameFromElement(node, ELLIPSIS_MARKER_CLASS);
12857  this.RemoveEllipsisTooltip(node);
12858 },
12859 RemoveEllipsisTooltip: function(node) {
12860  if(ASPx.Attr.IsExistsAttribute(node, ELLIPSIS_TOOLTIP_MARKER_ATTR)) {
12861   ASPx.Attr.RemoveAttribute(node, "title");
12862   ASPx.Attr.RemoveAttribute(node, ELLIPSIS_TOOLTIP_MARKER_ATTR);
12863  }
12864 },
12865 OnBrowserWindowResize: function(e) {
12866 },
12867 OnBrowserWindowResizeInternal: function(e){
12868  if(this.BrowserWindowResizeSubscriber()) 
12869   this.OnBrowserWindowResize(e);
12870 },
12871 BrowserWindowResizeSubscriber: function() {
12872  return this.widthValueSetInPercentage || !this.IsAdjusted();
12873 },
12874 ShrinkWrappedText: function(getElements, key, reCorrect) {
12875  if(!ASPx.Browser.Safari) return;
12876  var elements = ASPx.CacheHelper.GetCachedElements(this, key, getElements, this.wrappedTextContainers);
12877  for(var i = 0; i < elements.length; i++)
12878   this.ShrinkWrappedTextInContainer(elements[i], reCorrect);
12879 },
12880 ShrinkWrappedTextInContainer: function(container, reCorrect) {
12881  if(!ASPx.Browser.Safari || !container || (container.dxWrappedTextShrinked && !reCorrect) || container.offsetWidth === 0) return;
12882  ASPx.ShrinkWrappedTextInContainer(container);
12883  container.dxWrappedTextShrinked = true;
12884 },
12885 CorrectWrappedText: function(getElements, key, reCorrect) {
12886  var elements = ASPx.CacheHelper.GetCachedElements(this, key, getElements, this.wrappedTextContainers);
12887  for(var i = 0; i < elements.length; i++)
12888   this.CorrectWrappedTextInContainer(elements[i], reCorrect);
12889 },
12890 CorrectWrappedTextInContainer: function(container, reCorrect) {
12891  if(!container || (container.dxWrappedTextCorrected && !reCorrect) || container.offsetWidth === 0) return;
12892  ASPx.AdjustWrappedTextInContainer(container);
12893  container.dxWrappedTextCorrected = true;
12894 },
12895 CorrectVerticalAlignment: function(alignMethod, getElements, key, reAlign) {
12896  var elements = ASPx.CacheHelper.GetCachedElements(this, key, getElements, this.verticalAlignedElements);
12897  for(var i = 0; i < elements.length; i++)
12898   this.CorrectElementVerticalAlignment(alignMethod, elements[i], reAlign);
12899 },
12900 CorrectElementVerticalAlignment: function(alignMethod, element, reAlign) {
12901  if(!element || (element.dxVerticalAligned && !reAlign) || element.offsetHeight === 0) return;
12902  alignMethod(element);
12903  element.dxVerticalAligned = true;
12904 },
12905 ClearVerticalAlignedElementsCache: function() {
12906  ASPx.CacheHelper.DropCache(this.verticalAlignedElements);
12907 },
12908 ClearWrappedTextContainersCache: function() {
12909  ASPx.CacheHelper.DropCache(this.wrappedTextContainers);
12910 },
12911 AdjustPagerControls: function() {
12912  if(typeof(ASPx.GetPagersCollection) != "undefined")
12913   ASPx.GetPagersCollection().AdjustControls(this.GetMainElement());
12914 },
12915 RegisterInControlTree: function(tree) {
12916  var mainElement = this.GetMainElement();
12917  if(mainElement && mainElement.id)
12918   tree.createNode(mainElement.id, this);
12919 },
12920 GetItemElementName: function(element) {
12921  var name = "";
12922  if(element.id)
12923   name = element.id.substring(this.name.length + 1);
12924  return name;
12925 },
12926 GetLinkElement: function(element) {
12927  if(element == null) return null;
12928  return (element.tagName == "A") ? element : ASPx.GetNodeByTagName(element, "A", 0);
12929 },
12930 GetInternalHyperlinkElement: function(parentElement, index) {
12931  var element = ASPx.GetNodeByTagName(parentElement, "A", index);
12932  if(element == null) 
12933   element = ASPx.GetNodeByTagName(parentElement, "SPAN", index);
12934  return element;
12935 },
12936 OnControlClick: function(clickedElement, htmlEvent) {
12937 }
12938});
12939ASPxClientControl.Cast = function(obj) {
12940 if(typeof obj == "string")
12941  return window[obj];
12942 return obj;
12943};
12944ASPxClientControl.AdjustControls = function(container, collapseControls){
12945 aspxGetControlCollection().AdjustControls(container, collapseControls);
12946};
12947ASPxClientControl.GetControlCollection = function(){
12948 return aspxGetControlCollection();
12949};
12950ASPxClientControl.LeadingAfterInitCallConsts = {
12951 None: 0,
12952 Direct: 1,
12953 Reverse: 2
12954};
12955var ASPxClientComponent = ASPx.CreateClass(ASPxClientControl, {
12956 constructor: function (name) {
12957  this.constructor.prototype.constructor.call(this, name);
12958 },
12959 IsDOMDisposed: function() { 
12960  return false;
12961 }
12962});
12963var ASPxClientControlCollection = ASPx.CreateClass(ASPx.CollectionBase, {
12964 constructor: function(){
12965  this.constructor.prototype.constructor.call(this);
12966  this.prevWndWidth = "";
12967  this.prevWndHeight = "";
12968  this.requestCountInternal = 0; 
12969  this.BeforeInitCallback = new ASPxClientEvent();
12970  this.ControlsInitialized = new ASPxClientEvent();
12971  this.BrowserWindowResized = new ASPxClientEvent();
12972  this.BeginCallback = new ASPxClientEvent();
12973  this.EndCallback = new ASPxClientEvent();
12974  this.CallbackError = new ASPxClientEvent();
12975  this.ValidationCompleted = new ASPxClientEvent();
12976  aspxGetControlCollectionCollection().Add(this);
12977 },
12978 Add: function(element) {
12979  var existsElement = this.Get(element.name);
12980  if(existsElement && existsElement !== element) 
12981   this.Remove(existsElement);
12982  ASPx.CollectionBase.prototype.Add.call(this, element.name, element);
12983 },
12984 Remove: function(element) {
12985  if(element && element instanceof ASPxClientControl && !element.IsDisposed())
12986   element.OnDispose();
12987  ASPx.CollectionBase.prototype.Remove.call(this, element.name);
12988 },
12989 GetGlobal: function(name) {
12990  var result = window[name];
12991  return result && Ident.IsASPxClientControl(result)
12992   ? result
12993   : null;
12994 },
12995 GetByName: function(name){
12996  return this.Get(name) || this.GetGlobal(name);
12997 },
12998 GetCollectionType: function(){
12999  return ASPxClientControlCollection.BaseCollectionType;
13000 },
13001 GetControlsByPredicate: function(predicate) {
13002  var result = [];
13003  this.ForEachControl(function(control) {
13004   if(!predicate || predicate(control))
13005    result.push(control);
13006  });
13007  return result;
13008 },
13009 GetControlsByType: function(type) {
13010  return this.GetControlsByPredicate(function(control) { 
13011   return type && (control instanceof type);
13012  });
13013 },
13014 ForEachControl: function(action, context) {
13015  context = context || this;
13016  this.elementsMap.forEachEntry(function(name, control) {
13017   if(Ident.IsASPxClientControl(control) && (!this.filterPredicate || this.filterPredicate(control)))
13018    return action.call(context, control);
13019  }, context);
13020 },
13021 ProcessActionByPredicate: function(action, predicate) {
13022  try {
13023   this.filterPredicate = predicate;
13024   action(this);
13025  }
13026  finally {
13027   this.filterPredicate = null;
13028  }
13029 },
13030 adjustControlsInternal: function(container, context, collapseControls, adjustFunc) {
13031  context = context || this;
13032  var func = function(control) {
13033   adjustFunc.call(context, control);
13034  };
13035  ASPx.GetControlAdjuster().adjustControlsInHierarchy(this, func, container, collapseControls);
13036 },
13037 AdjustControls: function(container, collapseControls) {
13038  container = container || null;
13039  window.setTimeout(function() {
13040   this.AdjustControlsCore(container, collapseControls);
13041  }.aspxBind(this), 0);
13042 },
13043 AdjustControlsCore: function(container, collapseControls) {
13044  var adjustFunction = function(control) { control.AdjustControl(); };
13045  this.adjustControlsInternal(container, this, collapseControls, adjustFunction);
13046 },
13047 CollapseControls: function(container) {
13048  this.ProcessControlsInContainer(container, function(control) {
13049   if(control.isASPxClientEdit)
13050    control.CollapseEditor();
13051   else if(!!window.ASPxClientRibbon && control instanceof ASPxClientRibbon)
13052    control.CollapseControl();
13053  });
13054 },
13055 AtlasInitialize: function(isCallback) {
13056  this.ForEachControl(function(control) {
13057   control.AtlasPreInitialize();
13058  });
13059  ASPx.ProcessScriptsAndLinks("", isCallback);
13060  this.ForEachControl(function(control) {
13061   control.AtlasInitialize();
13062  });
13063 },
13064 DOMContentLoaded: function() {
13065  this.ForEachControl(function(control){
13066    control.DOMContentLoaded();
13067  });
13068 },
13069 OnDocumentUnload: function() {
13070  this.ForEachControl(function(control) {
13071   control.RaiseUnload();
13072  });
13073 },
13074 Initialize: function() {
13075  ASPx.GetPostHandler().Post.AddHandler(
13076   function(s, e) { this.OnPost(e); }.aspxBind(this)
13077  );
13078  ASPx.GetPostHandler().PostFinalization.AddHandler(
13079   function(s, e) { this.OnPostFinalization(e); }.aspxBind(this)
13080  );
13081  this.InitializeElements(false );
13082  if(typeof(Sys) != "undefined" && typeof(Sys.Application) != "undefined") {
13083   var checkIsInitialized = function() {
13084    if(Sys.Application.get_isInitialized())
13085     Sys.Application.add_load(aspxCAInit);
13086    else
13087     setTimeout(checkIsInitialized, 0);
13088   };
13089   checkIsInitialized();
13090  }
13091  this.InitWindowSizeCache();
13092 },
13093 FinalizeInitialization: function() {
13094  this.ForEachControl(function(control) {
13095   control.FinalizeInitialization();
13096  });
13097 },
13098 InitializeElements: function(isCallback) {
13099  this.ForEachControl(function(control){
13100   if(!control.isInitialized)
13101    control.Initialize();
13102  });
13103  this.AfterInitializeElementsLeadingCall();
13104  this.AfterInitializeElements();
13105  this.RaiseControlsInitialized(isCallback);
13106 },
13107 AfterInitializeElementsLeadingCall: function() {
13108  var controls = {};
13109  controls[ASPxClientControl.LeadingAfterInitCallConsts.Direct] = [];
13110  controls[ASPxClientControl.LeadingAfterInitCallConsts.Reverse] = [];
13111  this.ForEachControl(function(control) {
13112   if(control.leadingAfterInitCall != ASPxClientControl.LeadingAfterInitCallConsts.None && !control.isInitialized)
13113    controls[control.leadingAfterInitCall].push(control);
13114  });
13115  var directInitControls = controls[ASPxClientControl.LeadingAfterInitCallConsts.Direct],
13116   reverseInitControls = controls[ASPxClientControl.LeadingAfterInitCallConsts.Reverse];
13117  for(var i = 0, control; control = directInitControls[i]; i++)
13118   control.AfterInitialize();
13119  for(var i = reverseInitControls.length - 1, control; control = reverseInitControls[i]; i--)
13120   control.AfterInitialize();
13121 },
13122 AfterInitializeElements: function() {
13123  this.ForEachControl(function(control) {
13124   if(control.leadingAfterInitCall == ASPxClientControl.LeadingAfterInitCallConsts.None && !control.isInitialized)
13125    control.AfterInitialize();
13126  });
13127  ASPx.RippleHelper.Init();
13128 },
13129 DoFinalizeCallback: function() {
13130  this.ForEachControl(function(control){
13131   control.DoFinalizeCallback();
13132  });
13133 },
13134 ProcessControlsInContainer: function(container, processFunc, filterFunc) {
13135  this.ForEachControl(function(control){
13136   if((!filterFunc || filterFunc(control)) && (!container || this.IsControlInContainer(container, control)))
13137    processFunc(control);
13138  });
13139 },
13140 IsControlInContainer: function(container, control) {
13141  if(control.GetMainElement) {
13142   var mainElement = control.GetMainElement();
13143   if(mainElement && (mainElement != container)) {
13144    if(ASPx.GetIsParent(container, mainElement))
13145     return true;
13146   }
13147  }
13148  return false;
13149 },
13150 RaiseControlsInitialized: function(isCallback) {
13151  if(typeof(isCallback) == "undefined")
13152   isCallback = true;
13153  var args = new ASPxClientControlsInitializedEventArgs(isCallback);
13154  if(!this.ControlsInitialized.IsEmpty())  
13155   this.ControlsInitialized.FireEvent(this, args);
13156  this.ForEachControl(function(control){
13157   control.OnGlobalControlsInitialized(args);
13158  });
13159 },
13160 RaiseBrowserWindowResized: function() {
13161  var args = new ASPxClientEventArgs();
13162  if(!this.BrowserWindowResized.IsEmpty())
13163   this.BrowserWindowResized.FireEvent(this, args);
13164  this.ForEachControl(function(control){
13165   control.OnGlobalBrowserWindowResized(args);
13166  });
13167 },
13168 RaiseBeginCallback: function (control, command) {
13169  var args = new ASPxClientGlobalBeginCallbackEventArgs(control, command);
13170  if(!this.BeginCallback.IsEmpty())
13171   this.BeginCallback.FireEvent(this, args);
13172  this.ForEachControl(function(control){
13173   control.OnGlobalBeginCallback(args);
13174  });
13175  this.IncrementRequestCount();
13176 },
13177 RaiseEndCallback: function (control) {
13178  var args = new ASPxClientGlobalEndCallbackEventArgs(control);
13179  if (!this.EndCallback.IsEmpty()) 
13180   this.EndCallback.FireEvent(this, args);
13181  this.ForEachControl(function(control){
13182   control.OnGlobalEndCallback(args);
13183  });
13184  this.DecrementRequestCount();
13185 },
13186 InCallback: function() {
13187  return this.requestCountInternal > 0;
13188 },
13189 RaiseCallbackError: function (control, message, callbackId) {
13190  var args = new ASPxClientGlobalCallbackErrorEventArgs(control, message, callbackId);
13191  if (!this.CallbackError.IsEmpty()) 
13192   this.CallbackError.FireEvent(this, args);
13193  this.ForEachControl(function(control){
13194   control.OnGlobalCallbackError(args);
13195  });
13196  if(args.handled)
13197   return { isHandled: true, errorMessage: args.message };  
13198  return { isHandled: false, errorMessage: message };
13199 },
13200 RaiseValidationCompleted: function (container, validationGroup, invisibleControlsValidated, isValid, firstInvalidControl, firstVisibleInvalidControl) {
13201  var args = new ASPxClientValidationCompletedEventArgs(container, validationGroup, invisibleControlsValidated, isValid, firstInvalidControl, firstVisibleInvalidControl);
13202  if (!this.ValidationCompleted.IsEmpty()) 
13203   this.ValidationCompleted.FireEvent(this, args);
13204  this.ForEachControl(function(control){
13205   control.OnGlobalValidationCompleted(args);
13206  });
13207  return args.isValid;
13208 },
13209 Before_WebForm_InitCallback: function(callbackOwnerID){
13210  var args = new BeforeInitCallbackEventArgs(callbackOwnerID);
13211  this.BeforeInitCallback.FireEvent(this, args);
13212 },
13213 InitWindowSizeCache: function(){
13214  this.prevWndWidth = ASPx.GetDocumentClientWidth();
13215  this.prevWndHeight = ASPx.GetDocumentClientHeight();
13216 },
13217 OnBrowserWindowResize: function(evt){
13218  var shouldIgnoreNestedEvents = ASPx.Browser.IE && ASPx.Browser.MajorVersion == 8;
13219  if(shouldIgnoreNestedEvents) {
13220   if(this.prevWndWidth === "" || this.prevWndHeight === "" || this.browserWindowResizeLocked)
13221    return;
13222   this.browserWindowResizeLocked = true;
13223  }
13224  this.OnBrowserWindowResizeCore(evt);
13225  if(shouldIgnoreNestedEvents)
13226   this.browserWindowResizeLocked = false;
13227 },
13228 OnBrowserWindowResizeCore: function(htmlEvent){
13229  var args = this.CreateOnBrowserWindowResizeEventArgs(htmlEvent);
13230  if(this.CalculateIsBrowserWindowSizeChanged()) {
13231   this.adjustControlsInternal(null, this, true, function(control) {
13232    if(control.IsDOMInitialized())
13233     control.OnBrowserWindowResizeInternal(args);
13234   });
13235   this.RaiseBrowserWindowResized();
13236  }
13237 },
13238 CreateOnBrowserWindowResizeEventArgs: function(htmlEvent){
13239  return {
13240   htmlEvent: htmlEvent,
13241   wndWidth: ASPx.GetDocumentClientWidth(),
13242   wndHeight: ASPx.GetDocumentClientHeight(),
13243   prevWndWidth: this.prevWndWidth,
13244   prevWndHeight: this.prevWndHeight
13245  };
13246 },
13247 CalculateIsBrowserWindowSizeChanged: function(){
13248  var wndWidth = ASPx.GetDocumentClientWidth();
13249  var wndHeight = ASPx.GetDocumentClientHeight();
13250  var isBrowserWindowSizeChanged = (this.prevWndWidth != wndWidth) || (this.prevWndHeight != wndHeight);
13251  if(isBrowserWindowSizeChanged){
13252   this.prevWndWidth = wndWidth;
13253   this.prevWndHeight = wndHeight;
13254   return true;
13255  }
13256  return false;
13257 },
13258 OnPost: function(args){
13259  this.ForEachControl(function(control) {
13260   control.OnPost(args);
13261  }, null);
13262 },
13263 OnPostFinalization: function(args){
13264  this.ForEachControl(function(control) {
13265   control.OnPostFinalization(args);
13266  }, null);
13267 },
13268 IncrementRequestCount: function() {
13269  this.requestCountInternal++;
13270 },
13271 DecrementRequestCount: function() {
13272  this.requestCountInternal--;
13273 },
13274 ResetRequestCount: function() {
13275  this.requestCountInternal = 0;
13276 }
13277});
13278ASPxClientControlCollection.BaseCollectionType = "Control";
13279var controlCollection = null;
13280function aspxGetControlCollection(){
13281 if(controlCollection == null) {
13282  controlCollection = new ASPxClientControlCollection();
13283  if(ASPx.loadControlCollectionPreloadHandlers)
13284   ASPx.loadControlCollectionPreloadHandlers(controlCollection);
13285 }
13286 return controlCollection;
13287}
13288var ControlCollectionCollection = ASPx.CreateClass(ASPx.CollectionBase, {
13289 constructor: function(){
13290  this.constructor.prototype.constructor.call(this);
13291 },
13292 Add: function(element) {
13293  var key = element.GetCollectionType();
13294  if(!key) throw "The collection type isn't specified.";
13295  if(this.Get(key)) throw "The collection with type='" + key + "' already exists.";
13296  ASPx.CollectionBase.prototype.Add.call(this, key, element);
13297 },
13298 RemoveDisposedControls: function(){
13299  var baseCollection = this.Get(ASPxClientControlCollection.BaseCollectionType);
13300  var disposedControls = [];
13301  baseCollection.elementsMap.forEachEntry(function(name, control) {
13302   if(!ASPx.Ident.IsASPxClientControl(control)) return;
13303   if(control.IsDOMDisposed())
13304    disposedControls.push(control);
13305  });
13306  this.RemoveControls(disposedControls);
13307 },
13308 RemoveControls: function(controls){
13309  for(var i = 0; i < controls.length; i++) {
13310   this.elementsMap.forEachEntry(function(key, collection) {
13311    if(ASPx.Ident.IsASPxClientCollection(collection))
13312     collection.Remove(controls[i]);
13313   });
13314  }
13315 }
13316});
13317var controlCollectionCollection = null;
13318function aspxGetControlCollectionCollection(){
13319 if(controlCollectionCollection == null)
13320  controlCollectionCollection = new ControlCollectionCollection();
13321 return controlCollectionCollection;
13322}
13323var AriaDescriptionAttributes = {
13324 Role: "0",
13325 AriaLabel: "1",
13326 TabIndex: "2",
13327 AriaOwns: "3",
13328 AriaDescribedBy: "4",
13329 AriaDisabled: "5",
13330 AriaHasPopup: "6",
13331 AriaLevel: "7"
13332};
13333var AriaDescriptor = ASPx.CreateClass(null, {
13334 constructor: function(ownerControl, description) {
13335  this.ownerControl = ownerControl;
13336  this.rootElement = ownerControl.GetMainElement();
13337  this.description = description;
13338 },
13339 setDescription: function(name, argList) {
13340  var description = this.findChildDescription(name);
13341  if(description) {
13342   var elements = name ? this.rootElement.querySelectorAll(this.getDescriptionSelector(description)) : [this.rootElement];
13343   for(var i = 0; i < elements.length; i++)
13344    this.applyDescriptionToElement(elements[i], description, argList[i] || argList[0]);
13345  }
13346 },
13347 getDescriptionName: function(description) {
13348  return description.n;
13349 },
13350 getDescriptionSelector: function(description) {
13351  return description.s;
13352 },
13353 findChildDescription: function(name) {
13354  if(name === this.getDescriptionName(this.description))
13355   return this.description;
13356  var childCollection = this.description.c || [];
13357  for(var i = 0; i < childCollection.length; i++) {
13358   var childDescription = childCollection[i];
13359   if(this.getDescriptionName(childDescription) === name)
13360    return childDescription;
13361  }
13362  return null;
13363 },
13364 applyDescriptionToElement: function(element, description, args) {
13365  if(!description || !element)
13366   return;
13367  this.trySetAriaOwnsAttribute(element, description);
13368  this.trySetAriaDescribedByAttribute(element, description);
13369  this.trySetAttribute(element, description, AriaDescriptionAttributes.Role, "role");
13370  this.trySetAttribute(element, description, AriaDescriptionAttributes.TabIndex, "tabindex");
13371  this.trySetAttribute(element, description, AriaDescriptionAttributes.AriaLevel, "aria-level");
13372  this.executeOnDescription(description, AriaDescriptionAttributes.AriaLabel, function(value) {
13373   ASPx.Attr.SetAttribute(element, "aria-label", ASPx.Str.ApplyReplacement(value, args));
13374  });
13375  this.executeOnDescription(description, AriaDescriptionAttributes.AriaDisabled, function(value) {
13376   ASPx.Attr.SetAttribute(element, "aria-disabled", !!value); 
13377  });
13378  this.executeOnDescription(description, AriaDescriptionAttributes.AriaHasPopup, function(value) {
13379   ASPx.Attr.SetAttribute(element, "aria-haspopup", !!value);
13380  });
13381 },
13382 trySetAriaDescribedByAttribute: function(element, description) {
13383  this.executeOnDescription(description, AriaDescriptionAttributes.AriaDescribedBy, function(selectorInfo) {
13384   var descriptor = this.getNodesBySelector(element, selectorInfo.descriptorSelector)[0];
13385   var target = this.getNodesBySelector(element, selectorInfo.targetSelector)[0];
13386   if(!target || !descriptor)
13387    return;
13388   ASPx.Attr.SetAttribute(target, "aria-describedby", this.getNodeId(descriptor));
13389  });
13390 },
13391 trySetAriaOwnsAttribute: function(element, description) {
13392  this.executeOnDescription(description, AriaDescriptionAttributes.AriaOwns, function(selector) {
13393   var ownedNodes = this.getNodesBySelector(element, selector);
13394   var ariaOwnsAttributeValue = "";
13395   for(var i = 0; i < ownedNodes.length; i++)
13396    ariaOwnsAttributeValue += (this.getNodeId(ownedNodes[i]) + (i != ownedNodes.length - 1 ? " " : ""));
13397   ASPx.Attr.SetAttribute(element, "aria-owns", ariaOwnsAttributeValue);
13398  });
13399 },
13400 trySetAttribute: function(element, description, ariaAttribute, attributeName) {
13401  this.executeOnDescription(description, ariaAttribute, function(value) { 
13402   ASPx.Attr.SetAttribute(element, attributeName, description[ariaAttribute]); 
13403  });
13404 },
13405 executeOnDescription: function(description, ariaDescAttr, callback) {
13406  var descInfo = description[ariaDescAttr];
13407  if(ASPx.IsExists(descInfo))
13408   callback.aspxBind(this)(descInfo);
13409 },
13410 getNodesBySelector: function(element, selector) {
13411  var id = element.id || "";
13412  var childNodes = element.querySelectorAll("#" + this.getNodeId(element) + " > " + selector);
13413  ASPx.Attr.SetOrRemoveAttribute(element, "id", id);
13414  return childNodes;
13415 },
13416 getNodeId: function(node) {
13417  if(!node.id)
13418   node.id = this.createRandomId();
13419  return node.id; 
13420 },
13421 createRandomId: function() {
13422  return "r" + ASPx.CreateGuid();
13423 }
13424});
13425PagerCommands = {
13426 Next : "PBN",
13427 Prev : "PBP",
13428 Last : "PBL",
13429 First : "PBF",
13430 PageNumber : "PN",
13431 PageSize : "PSP"
13432};
13433ASPx.callbackProcessed = false;
13434ASPx.Callback = function(result, context){ 
13435 var collection = aspxGetControlCollection();
13436 collection.DoFinalizeCallback();
13437 var control = collection.Get(context);
13438 if(control != null)
13439  control.DoCallback(result);
13440 ASPx.RippleHelper.ReInit();
13441 ASPx.callbackProcessed = true;
13442};
13443ASPx.CallbackError = function(result, context){
13444 var control = aspxGetControlCollection().Get(context);
13445 if(control != null)
13446  control.DoCallbackError(result, false);
13447 ASPx.callbackProcessed = true;
13448};
13449ASPx.CClick = function(name, evt) {
13450 var control = aspxGetControlCollection().Get(name);
13451 if(control != null) control.DoControlClick(evt);
13452};
13453function aspxCAInit() {
13454 var isAppInit = typeof(Sys$_Application$initialize) != "undefined" &&
13455  ASPx.FunctionIsInCallstack(arguments.callee, Sys$_Application$initialize, 10 );
13456 aspxGetControlCollection().AtlasInitialize(!isAppInit);
13457}
13458ASPx.Evt.AttachEventToElement(window, "resize", aspxGlobalWindowResize);
13459function aspxGlobalWindowResize(evt){
13460 aspxGetControlCollection().OnBrowserWindowResize(evt); 
13461}
13462ASPx.Evt.AttachEventToElement(window, "unload", aspxClassesUnload);
13463function aspxClassesUnload(evt) {
13464 aspxGetControlCollection().OnDocumentUnload();
13465}
13466ASPx.attachToLoad(aspxClassesDOMContentLoaded);
13467function aspxClassesDOMContentLoaded(evt){
13468 aspxGetControlCollection().DOMContentLoaded();
13469}
13470ASPx.GetControlCollection = aspxGetControlCollection;
13471ASPx.GetControlCollectionCollection = aspxGetControlCollectionCollection;
13472ASPx.GetPersistentControlPropertiesStorage = _aspxGetPersistentControlPropertiesStorage;
13473ASPx.PagerCommands = PagerCommands;
13474ASPx.ELLIPSIS_MARKER_CLASS = ELLIPSIS_MARKER_CLASS;
13475window.ASPxClientBeginCallbackEventArgs = ASPxClientBeginCallbackEventArgs;
13476window.ASPxClientGlobalBeginCallbackEventArgs = ASPxClientGlobalBeginCallbackEventArgs;
13477window.ASPxClientEndCallbackEventArgs = ASPxClientEndCallbackEventArgs;
13478window.ASPxClientGlobalEndCallbackEventArgs = ASPxClientGlobalEndCallbackEventArgs;
13479window.ASPxClientCallbackErrorEventArgs = ASPxClientCallbackErrorEventArgs;
13480window.ASPxClientGlobalCallbackErrorEventArgs = ASPxClientGlobalCallbackErrorEventArgs;
13481window.ASPxClientCustomDataCallbackEventArgs = ASPxClientCustomDataCallbackEventArgs;
13482window.ASPxClientValidationCompletedEventArgs = ASPxClientValidationCompletedEventArgs;
13483window.ASPxClientControlsInitializedEventArgs = ASPxClientControlsInitializedEventArgs;
13484window.ASPxClientControlBeforePronounceEventArgs = ASPxClientControlBeforePronounceEventArgs;
13485window.ASPxClientControlUnloadEventArgs = ASPxClientControlUnloadEventArgs;
13486window.ASPxClientEndFocusEventArgs = ASPxClientEndFocusEventArgs;
13487window.ASPxClientItemFocusedEventArgs = ASPxClientItemFocusedEventArgs;
13488window.ASPxClientControlCollection = ASPxClientControlCollection;
13489window.ASPxClientControlBase = ASPxClientControlBase;
13490window.ASPxClientControl = ASPxClientControl;
13491window.ASPxClientComponent = ASPxClientComponent;
13492})(ASPx);
13493
13494(function () {
13495 var PositionAnimationTransition = ASPx.CreateClass(ASPx.AnimationTransitionBase, {
13496  constructor: function (element, options) {
13497   this.constructor.prototype.constructor.call(this, element, options);
13498   this.direction = options.direction;
13499   this.animationTransition = this.createAnimationTransition();
13500   AnimationHelper.appendWKAnimationClassNameIfRequired(this.element);
13501  },
13502  Start: function (to) {
13503   var from = this.GetValue();
13504   if(ASPx.AnimationUtils.CanUseCssTransform()) {
13505    from = this.convertPosToCssTransformPos(from);
13506    to = this.convertPosToCssTransformPos(to);
13507   }
13508   this.animationTransition.Start(from, to);
13509  },
13510  SetValue: function (value) {
13511   ASPx.AnimationUtils.SetTransformValue(this.element, value, this.direction == AnimationHelper.SLIDE_VERTICAL_DIRECTION);
13512  },
13513  GetValue: function () {
13514   return ASPx.AnimationUtils.GetTransformValue(this.element, this.direction == AnimationHelper.SLIDE_VERTICAL_DIRECTION);
13515  },
13516  createAnimationTransition: function () {
13517   var transition = ASPx.AnimationUtils.CanUseCssTransform() ? this.createTransformAnimationTransition() : this.createPositionAnimationTransition();
13518   transition.transition = ASPx.AnimationConstants.Transitions.POW_EASE_OUT;
13519   return transition;
13520  },
13521  createTransformAnimationTransition: function () {
13522   return ASPx.AnimationUtils.createCssAnimationTransition(this.element, {
13523    property: ASPx.AnimationUtils.CanUseCssTransform(),
13524    duration: this.duration,
13525    onComplete: this.onComplete
13526   });
13527  },
13528  createPositionAnimationTransition: function () {
13529   return AnimationHelper.createAnimationTransition(this.element, {
13530    property: this.direction == AnimationHelper.SLIDE_VERTICAL_DIRECTION ? "top" : "left",
13531    unit: "px",
13532    duration: this.duration,
13533    onComplete: this.onComplete
13534   });
13535  },
13536  convertPosToCssTransformPos: function (position) {
13537   return ASPx.AnimationUtils.GetTransformCssText(position, this.direction == AnimationHelper.SLIDE_VERTICAL_DIRECTION);
13538  }
13539 });
13540 var AnimationHelper = {
13541  SLIDE_HORIZONTAL_DIRECTION: 0,
13542  SLIDE_VERTICAL_DIRECTION: 1,
13543  SLIDE_TOP_DIRECTION: 0,
13544  SLIDE_RIGHT_DIRECTION: 1,
13545  SLIDE_BOTTOM_DIRECTION: 2,
13546  SLIDE_LEFT_DIRECTION: 3,
13547  SLIDE_CONTAINER_CLASS: "dxAC",
13548  MAXIMUM_DEPTH: 3,
13549  createAnimationTransition: function (element, options) {
13550   if(options.onStep) 
13551    options.animationEngine = "js";
13552   switch (options.animationEngine) {
13553    case "js":
13554     return ASPx.AnimationUtils.createJsAnimationTransition(element, options);
13555    case "css":
13556     return ASPx.AnimationUtils.createCssAnimationTransition(element, options);
13557    default:
13558     return ASPx.AnimationUtils.CanUseCssTransition() ? ASPx.AnimationUtils.createCssAnimationTransition(element, options) :
13559      ASPx.AnimationUtils.createJsAnimationTransition(element, options);
13560   }
13561  },
13562  createMultipleAnimationTransition: function (element, options) {
13563   return ASPx.AnimationUtils.createMultipleAnimationTransition(element, options);
13564  },
13565  createSimpleAnimationTransition: function (options) {
13566   return ASPx.AnimationUtils.createSimpleAnimationTransition(options);
13567  },
13568  cancelAnimation: function (element) {
13569   ASPx.AnimationTransitionBase.Cancel(element);
13570  },
13571  fadeIn: function (element, onComplete, duration) {
13572   AnimationHelper.fadeTo(element, {
13573    from: 0, to: 1,
13574    onComplete: onComplete,
13575    duration: duration || ASPx.AnimationConstants.Durations.DEFAULT
13576   });
13577  },
13578  fadeOut: function (element, onComplete, duration) {
13579   AnimationHelper.fadeTo(element, {
13580    from: ASPx.GetElementOpacity(element), to: 0,
13581    onComplete: onComplete,
13582    duration: duration || ASPx.AnimationConstants.Durations.DEFAULT
13583   });
13584  },
13585  fadeTo: function (element, options) {
13586   options.property = "opacity";
13587   if(!options.duration)
13588    options.duration = ASPx.AnimationConstants.Durations.SHORT;
13589   var transition = AnimationHelper.createAnimationTransition(element, options);
13590   if(!ASPx.IsExists(options.from))
13591    options.from = transition.GetValue();
13592   transition.Start(options.from, options.to);
13593  },
13594  slideIn: function (element, direction, onComplete, animationEngineType, rtl) {
13595   AnimationHelper.setOpacity(element, 1);
13596   var animationContainer = AnimationHelper.getSlideAnimationContainer(element, true, true);
13597   var pos = AnimationHelper.getSlideInStartPos(animationContainer, direction, rtl);
13598   var transition = AnimationHelper.createSlideTransition(animationContainer, direction,
13599    function (el) {
13600     AnimationHelper.resetSlideAnimationContainerSize(animationContainer);
13601     if(onComplete)
13602      onComplete(el);
13603    }, animationEngineType, rtl);
13604   transition.Start(pos, 0);
13605  },
13606  slideOut: function (element, direction, onComplete, animationEngineType, rtl) {
13607   var animationContainer = AnimationHelper.getSlideAnimationContainer(element, true, true);
13608   var pos = AnimationHelper.getSlideOutFinishPos(animationContainer, direction, rtl);
13609   var transition = AnimationHelper.createSlideTransition(animationContainer, direction,
13610    function (el) {
13611     AnimationHelper.setOpacity(el.firstChild, 0);
13612     if(onComplete)
13613      onComplete(el);
13614    }, animationEngineType, rtl);
13615   transition.Start(pos);
13616  },
13617  slideTo: function (element, options) {
13618   if(!ASPx.IsExists(options.direction))
13619    options.direction = AnimationHelper.SLIDE_HORIZONTAL_DIRECTION;
13620   var transition = new PositionAnimationTransition(element, options);
13621   transition.Start(options.to);
13622  },
13623  setOpacity: function (element, value) {
13624   ASPx.AnimationUtils.setOpacity(element, value);
13625  },
13626  appendWKAnimationClassNameIfRequired: function (element) {
13627   if(ASPx.AnimationUtils.CanUseCssTransform() && ASPx.Browser.WebKitFamily && !ASPx.ElementHasCssClass(element, "dx-wbv"))
13628    element.className += " dx-wbv";
13629  },
13630  findSlideAnimationContainer: function (element) {
13631   var container = element;
13632   for(var i = 0; i < AnimationHelper.MAXIMUM_DEPTH; i++) {
13633    if(container.tagName == "BODY")
13634     return null;
13635    if(ASPx.ElementHasCssClass(container, AnimationHelper.SLIDE_CONTAINER_CLASS))
13636     return container;
13637    container = container.parentNode;
13638   }
13639   return null;
13640  },
13641  createSlideAnimationContainer: function (element) {
13642   var rootContainer = document.createElement("DIV");
13643   ASPx.SetStyles(rootContainer, {
13644    className: AnimationHelper.SLIDE_CONTAINER_CLASS,
13645    overflow: "hidden"
13646   });
13647   var elementContainer = document.createElement("DIV");
13648   rootContainer.appendChild(elementContainer);
13649   var parentNode = element.parentNode;
13650   parentNode.insertBefore(rootContainer, element);
13651   elementContainer.appendChild(element);
13652   return rootContainer;
13653  },
13654  getSlideAnimationContainer: function (element, create, fixSize) {
13655   if(!element) return;
13656   var width = element.offsetWidth;
13657   var height = element.offsetHeight;
13658   var container;
13659   if(element.className == AnimationHelper.SLIDE_CONTAINER_CLASS)
13660    container = element;
13661   if(!container)
13662    container = AnimationHelper.findSlideAnimationContainer(element);
13663   if(!container && create)
13664    container = AnimationHelper.createSlideAnimationContainer(element);
13665   if(container && fixSize) {
13666    ASPx.SetStyles(container, {
13667     width: width, height: height
13668    });
13669    ASPx.SetStyles(container.firstChild, {
13670     width: width, height: height
13671    });
13672   }
13673   return container;
13674  },
13675  resetSlideAnimationContainerSize: function (container) {
13676   ASPx.SetStyles(container, {
13677    width: "", height: ""
13678   });
13679   ASPx.SetStyles(container.firstChild, {
13680    width: "", height: ""
13681   });
13682  },
13683  getModifyProperty: function (direction, rtl) {
13684   if(direction == AnimationHelper.SLIDE_TOP_DIRECTION || direction == AnimationHelper.SLIDE_BOTTOM_DIRECTION)
13685    return "marginTop";
13686   return rtl ? "margin-right" : "margin-left";
13687  },
13688  createSlideTransition: function (animationContainer, direction, complete, animationEngineType, rtl) {
13689   if(rtl == undefined)
13690    rtl = false;
13691   var animationEngine = "";
13692   switch(animationEngineType) {
13693    case AnimationEngineType.JS:
13694     animationEngine = "js";
13695     break;
13696    case AnimationEngineType.CSS:
13697     animationEngine = "css";
13698     break;
13699   }
13700   return AnimationHelper.createAnimationTransition(animationContainer.firstChild, {
13701    unit: "px",
13702    property: AnimationHelper.getModifyProperty(direction, rtl),
13703    onComplete: complete,
13704    animationEngine: animationEngine
13705   });
13706  },
13707  getSlideInStartPos: function (animationContainer, direction, rtl) {
13708   var dir = rtl ? -1 : 1;
13709   switch (direction) {
13710    case AnimationHelper.SLIDE_TOP_DIRECTION:
13711     return animationContainer.offsetHeight;
13712    case AnimationHelper.SLIDE_LEFT_DIRECTION:
13713     return animationContainer.offsetWidth * dir;
13714    case AnimationHelper.SLIDE_RIGHT_DIRECTION:
13715     return -animationContainer.offsetWidth * dir;
13716    case AnimationHelper.SLIDE_BOTTOM_DIRECTION:
13717     return -animationContainer.offsetHeight;
13718   }
13719  },
13720  getSlideOutFinishPos: function (animationContainer, direction, rtl) {
13721   var dir = rtl ? -1 : 1;
13722   switch (direction) {
13723    case AnimationHelper.SLIDE_TOP_DIRECTION:
13724     return -animationContainer.offsetHeight;
13725    case AnimationHelper.SLIDE_LEFT_DIRECTION:
13726     return -animationContainer.offsetWidth * dir;
13727    case AnimationHelper.SLIDE_RIGHT_DIRECTION:
13728     return animationContainer.offsetWidth * dir;
13729    case AnimationHelper.SLIDE_BOTTOM_DIRECTION:
13730     return animationContainer.offsetHeight;
13731   }
13732  }
13733 };
13734 var GestureHandler = ASPx.CreateClass(null, {
13735  constructor: function (getAnimationElement, canHandle, allowStart) {
13736   this.getAnimationElement = getAnimationElement;
13737   this.canHandle = canHandle;
13738   this.allowStart = allowStart;
13739   this.startMousePosX = 0;
13740   this.startMousePosY = 0;
13741   this.startTime = null;
13742   this.isEventsPrevented = false;
13743   this.savedElements = [];
13744  },
13745  OnSelectStart: function(evt) {
13746   ASPx.Evt.PreventEvent(evt); 
13747  },
13748  OnDragStart: function(evt) {
13749   ASPx.Evt.PreventEvent(evt);  
13750  },
13751  OnMouseDown: function (evt) {
13752   this.startMousePosX = ASPx.Evt.GetEventX(evt);
13753   this.startMousePosY = ASPx.Evt.GetEventY(evt);
13754   this.startTime = new Date();
13755  },
13756  OnMouseMove: function(evt) {
13757   if(!ASPx.Browser.MobileUI)
13758    ASPx.Selection.Clear();
13759   if(Math.abs(this.GetCurrentDistanceX(evt)) < GestureHandler.SLIDER_MIN_START_DISTANCE && Math.abs(this.GetCurrentDistanceY(evt)) < GestureHandler.SLIDER_MIN_START_DISTANCE)
13760    GesturesHelper.isExecutedGesture = false;
13761  },
13762  OnMouseUp: function (evt) {
13763  },
13764  CanHandleEvent: function (evt) {
13765   return !this.canHandle || this.canHandle(evt);
13766  },
13767  IsStartAllowed: function(value) {
13768   return !this.allowStart || this.allowStart(value);
13769  },
13770  RollbackGesture: function () {
13771  },
13772  GetRubberPosition: function (position) {
13773   return position / GestureHandler.FACTOR_RUBBER;
13774  },
13775  GetCurrentDistanceX: function (evt) {
13776   return ASPx.Evt.GetEventX(evt) - this.startMousePosX;
13777  },
13778  GetCurrentDistanceY: function (evt) {
13779   return ASPx.Evt.GetEventY(evt) - this.startMousePosY;
13780  },
13781  GetDistanceLimit: function () {
13782   return (new Date() - this.startTime) < GestureHandler.MAX_TIME_SPAN ? GestureHandler.MIN_DISTANCE_LIMIT : GestureHandler.MAX_DISTANCE_LIMIT;
13783  },
13784  GetContainerElement: function () {
13785  },
13786  AttachPreventEvents: function (evt) {
13787   if(!this.isEventsPrevented) {
13788    var element = ASPx.Evt.GetEventSource(evt);
13789    var container = this.GetContainerElement();
13790    while(element && element != container) {
13791     ASPx.Evt.AttachEventToElement(element, "mouseup", ASPx.Evt.PreventEvent);
13792     ASPx.Evt.AttachEventToElement(element, "click", ASPx.Evt.PreventEvent);
13793     this.savedElements.push(element);
13794     element = element.parentNode;
13795    }
13796    this.isEventsPrevented = true;
13797   }
13798  },
13799  DetachPreventEvents: function () {
13800   if(this.isEventsPrevented) {
13801    window.setTimeout(function () {
13802     while(this.savedElements.length > 0) {
13803      var element = this.savedElements.pop();
13804      ASPx.Evt.DetachEventFromElement(element, "mouseup", ASPx.Evt.PreventEvent);
13805      ASPx.Evt.DetachEventFromElement(element, "click", ASPx.Evt.PreventEvent);
13806     }
13807    }.aspxBind(this), 0);
13808    this.isEventsPrevented = false;
13809   }
13810  }
13811 });
13812 GestureHandler.MAX_DISTANCE_LIMIT = 70;
13813 GestureHandler.MIN_DISTANCE_LIMIT = 10;
13814 GestureHandler.MIN_START_DISTANCE = 0;
13815 GestureHandler.SLIDER_MIN_START_DISTANCE = 5;
13816 GestureHandler.MAX_TIME_SPAN = 300;
13817 GestureHandler.FACTOR_RUBBER = 4;
13818 GestureHandler.RETURN_ANIMATION_DURATION = 150;
13819 var SwipeSlideGestureHandler = ASPx.CreateClass(GestureHandler, {
13820  constructor: function (getAnimationElement, direction, canHandle, backward, forward, rollback, move) {
13821   this.constructor.prototype.constructor.call(this, getAnimationElement, canHandle);
13822   this.slideElement = this.getAnimationElement();
13823   this.container = this.slideElement.parentNode;
13824   this.direction = direction;
13825   this.backward = backward;
13826   this.forward = forward;
13827   this.rollback = rollback;
13828   this.slideElementSize = 0;
13829   this.containerElementSize = 0;
13830   this.startSliderElementPosition = 0;
13831   this.centeredSlideElementPosition = 0;
13832  },
13833  OnMouseDown: function (evt) {
13834   GestureHandler.prototype.OnMouseDown.call(this, evt);
13835   this.slideElementSize = this.GetElementSize();
13836   this.startSliderElementPosition = this.GetElementPosition();
13837   this.containerElementSize = this.GetContainerElementSize();
13838   if(this.slideElementSize <= this.containerElementSize)
13839    this.centeredSlideElementPosition = (this.containerElementSize - this.slideElementSize) / 2;
13840  },
13841  OnMouseMove: function (evt) {
13842   GestureHandler.prototype.OnMouseMove.call(this, evt);
13843   if(!ASPx.Browser.TouchUI && !ASPx.GetIsParent(this.container, ASPx.Evt.GetEventSource(evt))) {
13844    GesturesHelper.OnDocumentMouseUp(evt);
13845    return;
13846   }
13847   var distance = this.GetCurrentDistance(evt);
13848   if(Math.abs(distance) < GestureHandler.SLIDER_MIN_START_DISTANCE || ASPx.TouchUIHelper.isGesture)
13849    return;
13850   this.SetElementPosition(this.GetCalculatedPosition(distance));
13851   this.AttachPreventEvents(evt);
13852   ASPx.Evt.PreventEvent(evt);
13853  },
13854  GetCalculatedPosition: function (distance) {
13855   ASPx.AnimationTransitionBase.Cancel(this.slideElement);
13856   var position = this.startSliderElementPosition + distance,
13857    maxPosition = -(this.slideElementSize - this.containerElementSize),
13858    minPosition = 0;
13859   if(this.centeredSlideElementPosition > 0)
13860    position = this.GetRubberPosition(distance) + this.centeredSlideElementPosition;
13861   else if(position > minPosition)
13862    position = this.GetRubberPosition(distance);
13863   else if(position < maxPosition)
13864    position = this.GetRubberPosition(distance) + maxPosition;
13865   return position;
13866  },
13867  OnMouseUp: function (evt) {
13868   this.DetachPreventEvents();
13869   if(this.GetCurrentDistance(evt) != 0)
13870    this.OnMouseUpCore(evt);
13871  },
13872  OnMouseUpCore: function (evt) {
13873   var distance = this.GetCurrentDistance(evt);
13874   if(this.centeredSlideElementPosition > 0 || this.CheckSlidePanelIsOutOfBounds())
13875    this.PerformRollback();
13876   else
13877    this.PerformAction(distance);
13878  },
13879  PerformAction: function (distance) {
13880   if(Math.abs(distance) < this.GetDistanceLimit())
13881    this.PerformRollback();
13882   else if(distance < 0)
13883    this.PerformForward();
13884   else
13885    this.PerformBackward();
13886  },
13887  PerformBackward: function () {
13888   this.backward();
13889  },
13890  PerformForward: function () {
13891   this.forward();
13892  },
13893  PerformRollback: function () {
13894   this.rollback();
13895  },
13896  CheckSlidePanelIsOutOfBounds: function () {
13897   var minOffset = -(this.slideElementSize - this.containerElementSize), maxOffset = 0;
13898   var slideElementPos = this.GetElementPosition();
13899   if(slideElementPos > maxOffset || slideElementPos < minOffset)
13900    return true;
13901   return false;
13902  },
13903  GetContainerElement: function () {
13904   return this.container;
13905  },
13906  GetElementSize: function () {
13907   return this.IsHorizontalDirection() ? this.slideElement.offsetWidth : this.slideElement.offsetHeight;
13908  },
13909  GetContainerElementSize: function () {
13910   return this.IsHorizontalDirection() ? ASPx.GetClearClientWidth(this.container) : ASPx.GetClearClientHeight(this.container);
13911  },
13912  GetCurrentDistance: function (evt) {
13913   return this.IsHorizontalDirection() ? this.GetCurrentDistanceX(evt) : this.GetCurrentDistanceY(evt);
13914  },
13915  GetElementPosition: function () {
13916   return ASPx.AnimationUtils.GetTransformValue(this.slideElement, !this.IsHorizontalDirection());
13917  },
13918  SetElementPosition: function (position) {
13919   ASPx.AnimationUtils.SetTransformValue(this.slideElement, position, !this.IsHorizontalDirection());
13920  },
13921  IsHorizontalDirection: function () {
13922   return this.direction == AnimationHelper.SLIDE_HORIZONTAL_DIRECTION;
13923  }
13924 });
13925 var SwipeSimpleSlideGestureHandler = ASPx.CreateClass(SwipeSlideGestureHandler, {
13926  constructor: function (getAnimationElement, direction, canHandle, backward, forward, rollback, updatePosition) {
13927   this.constructor.prototype.constructor.call(this, getAnimationElement, direction, canHandle, backward, forward, rollback);
13928   this.container = this.slideElement;
13929   this.updatePosition = updatePosition;
13930   this.prevDistance = 0;
13931  },
13932  OnMouseDown: function (evt) {
13933   GestureHandler.prototype.OnMouseDown.call(this, evt);
13934   this.prevDistance = 0;
13935  },
13936  OnMouseUpCore: function (evt) {
13937   this.PerformAction(this.GetCurrentDistance(evt));
13938  },
13939  PerformAction: function (distance) {
13940   if(Math.abs(distance) < this.GetDistanceLimit())
13941    this.PerformRollback();
13942   else if(distance < 0)
13943    this.PerformForward();
13944   else
13945    this.PerformBackward();
13946  },
13947  GetCalculatedPosition: function (distance) {
13948   var position = distance - this.prevDistance;
13949   this.prevDistance = distance;
13950   return position;
13951  },
13952  SetElementPosition: function (position) {
13953   this.updatePosition(position);
13954  }
13955 });
13956 var SwipeGestureHandler = ASPx.CreateClass(GestureHandler, {
13957  constructor: function (getAnimationElement, canHandle, allowStart, start, allowComplete, complete, cancel, animationEngineType, rtl) {
13958   this.constructor.prototype.constructor.call(this, getAnimationElement, canHandle, allowStart);
13959   this.start = start;
13960   this.allowComplete = allowComplete;
13961   this.complete = complete;
13962   this.cancel = cancel;
13963   this.animationTween = null;
13964   this.currentDistanceX = 0;
13965   this.currentDistanceY = 0;
13966   this.tryStartGesture = false;
13967   this.tryStartScrolling = false;
13968   this.animationEngineType = animationEngineType;
13969   this.rtl = rtl;
13970   this.UpdateAnimationContainer();
13971  },
13972  UpdateAnimationContainer: function () {
13973   this.animationContainer = AnimationHelper.getSlideAnimationContainer(this.getAnimationElement(), true, false);
13974  },
13975  CanHandleEvent: function (evt) {
13976   if(GestureHandler.prototype.CanHandleEvent.call(this, evt))
13977    return true;
13978   return this.animationTween && this.animationContainer && ASPx.GetIsParent(this.animationContainer, ASPx.Evt.GetEventSource(evt));
13979  },
13980  OnMouseDown: function (evt) {
13981   GestureHandler.prototype.OnMouseDown.call(this, evt);
13982   if(this.animationTween)
13983    this.animationTween.Cancel();
13984   this.currentDistanceX = 0;
13985   this.currentDistanceY = 0;
13986   this.tryStartGesture = false;
13987   this.tryStartScrolling = false;
13988  },
13989  OnMouseMove: function (evt) {
13990   GestureHandler.prototype.OnMouseMove.call(this, evt);
13991   var isZoomGestureConflict = evt.touches && evt.touches.length > 1;
13992   if (isZoomGestureConflict)
13993    return false;
13994   this.currentDistanceX = this.GetCurrentDistanceX(evt);
13995   this.currentDistanceY = this.GetCurrentDistanceY(evt);
13996   if(this.rtl)
13997    this.currentDistanceX = -this.currentDistanceX;
13998   if(!this.animationTween && !this.tryStartScrolling && (Math.abs(this.currentDistanceX) >
13999    GestureHandler.MIN_START_DISTANCE || Math.abs(this.currentDistanceY) > GestureHandler.MIN_START_DISTANCE)) {
14000    if(Math.abs(this.currentDistanceY) < Math.abs(this.currentDistanceX)) {
14001     this.tryStartGesture = true;
14002     if(this.IsStartAllowed(this.currentDistanceX)) {
14003      this.animationContainer = AnimationHelper.getSlideAnimationContainer(this.getAnimationElement(), true, true);
14004      this.animationTween = AnimationHelper.createSlideTransition(this.animationContainer, AnimationHelper.SLIDE_LEFT_DIRECTION,
14005       function () {
14006        AnimationHelper.resetSlideAnimationContainerSize(this.animationContainer);
14007        this.animationContainer = null;
14008        this.animationTween = null;
14009       }.aspxBind(this), this.animationEngineType, this.rtl);
14010      this.PerformStart(this.currentDistanceX);
14011      this.AttachPreventEvents(evt);
14012     }
14013    }
14014    else
14015     this.tryStartScrolling = true;
14016   }
14017   if(this.animationTween) {
14018    if(this.allowComplete && !this.allowComplete(this.currentDistanceX))
14019     this.currentDistanceX = this.GetRubberPosition(this.currentDistanceX);
14020    this.animationTween.SetValue(this.currentDistanceX);
14021   }
14022   if(!this.tryStartScrolling && !ASPx.TouchUIHelper.isGesture && evt.touches && evt.touches.length < 2)
14023    ASPx.Evt.PreventEvent(evt);
14024  },
14025  OnMouseUp: function (evt) {
14026   if(!this.animationTween) {
14027    if(this.tryStartGesture)
14028     this.PerformCancel(this.currentDistanceX);
14029   }
14030   else {
14031    if(Math.abs(this.currentDistanceX) < this.GetDistanceLimit())
14032     this.RollbackGesture();
14033    else {
14034     if(this.IsCompleteAllowed(this.currentDistanceX)) {
14035      this.PerformComplete(this.currentDistanceX);
14036      this.animationContainer = null;
14037      this.animationTween = null;
14038     }
14039     else
14040      this.RollbackGesture();
14041    }
14042   }
14043   this.DetachPreventEvents();
14044   this.tryStartGesture = false;
14045   this.tryStartScrolling = false;
14046  },
14047  PerformStart: function (value) {
14048   if(this.start)
14049    this.start(value);
14050  },
14051  IsCompleteAllowed: function (value) {
14052   return !this.allowComplete || this.allowComplete(value);
14053  },
14054  PerformComplete: function (value) {
14055   if(this.complete)
14056    this.complete(value);
14057  },
14058  PerformCancel: function (value) {
14059   if(this.cancel)
14060    this.cancel(value);
14061  },
14062  RollbackGesture: function () {
14063   this.animationTween.Start(this.currentDistanceX, 0);
14064  },
14065  ResetGestureElementPosition: function () {
14066   if (this.currentDistanceX === 0) return;
14067   var container = AnimationHelper.getSlideAnimationContainer(this.getAnimationElement());
14068   var onComplete = function () { AnimationHelper.resetSlideAnimationContainerSize(container); };
14069   var animation = AnimationHelper.createSlideTransition(container, AnimationHelper.SLIDE_LEFT_DIRECTION, onComplete, this.animationEngineType, this.rtl);
14070   animation.Start(this.currentDistanceX, 0);
14071  },
14072  GetContainerElement: function () {
14073   return this.animationContainer;
14074  }
14075 });
14076 var GesturesHelper = {
14077  handlers: {},
14078  activeHandler: null,
14079  isAttachedEvents: false,
14080  isExecutedGesture: false,
14081  AddSwipeGestureHandler: function (id, getAnimationElement, canHandle, allowStart, start, allowComplete, complete, cancel, animationEngineType, rtl) {
14082   this.handlers[id] = new SwipeGestureHandler(getAnimationElement, canHandle, allowStart, start, allowComplete, complete, cancel, animationEngineType, rtl);
14083  },
14084  UpdateSwipeAnimationContainer: function (id) {
14085   if(this.handlers[id])
14086    this.handlers[id].UpdateAnimationContainer();
14087  },
14088  AddSwipeSlideGestureHandler: function (id, getAnimationElement, direction, canHandle, backward, forward, rollback, updatePosition) {
14089   if(updatePosition)
14090    this.handlers[id] = new SwipeSimpleSlideGestureHandler(getAnimationElement, direction, canHandle, backward, forward, rollback, updatePosition);
14091   else
14092    this.handlers[id] = new SwipeSlideGestureHandler(getAnimationElement, direction, canHandle, backward, forward, rollback);
14093  },
14094  getParentDXEditorWithSwipeGestures: function(element) {
14095     return ASPx.GetParent(element, function(parent) {
14096      var parentObj = ASPx.GetControlCollection().Get(parent.id);
14097      return parentObj && parentObj.supportGestures && parentObj.isSwipeGesturesEnabled();
14098   });
14099  },
14100  canHandleMouseDown: function(evt) {
14101   if(!ASPx.Evt.IsLeftButtonPressed(evt))
14102    return false;
14103   var element = ASPx.Evt.GetEventSource(evt);
14104   var dxFocusedEditor = ASPx.Ident.scripts.ASPxClientEdit && ASPx.GetFocusedEditor();
14105   if(dxFocusedEditor && dxFocusedEditor.IsEditorElement(element)) {
14106    var elementParentDXEditorWithSwipeGestures = GesturesHelper.getParentDXEditorWithSwipeGestures(element);
14107    if(!elementParentDXEditorWithSwipeGestures || !dxFocusedEditor.IsEditorElement(elementParentDXEditorWithSwipeGestures))
14108     return false;
14109   }
14110   var isTextEditor = element.tagName == "TEXTAREA" || element.tagName == "INPUT" && ASPx.Attr.GetAttribute(element, "type") == "text";
14111   if(isTextEditor && document.activeElement == element)
14112    return false;
14113   return true;  
14114  },
14115  OnDocumentDragStart: function(evt) {
14116   if(GesturesHelper.activeHandler)
14117    GesturesHelper.activeHandler.OnDragStart(evt);
14118  },
14119  OnDocumentSelectStart: function(evt) {
14120   if(GesturesHelper.activeHandler)
14121    GesturesHelper.activeHandler.OnSelectStart(evt);
14122  },
14123  OnDocumentMouseDown: function (evt) {
14124   if(!GesturesHelper.canHandleMouseDown(evt))
14125    return;
14126   GesturesHelper.activeHandler = GesturesHelper.FindHandler(evt);
14127   if(GesturesHelper.activeHandler)
14128    GesturesHelper.activeHandler.OnMouseDown(evt);
14129  },
14130  OnDocumentMouseMove: function (evt) {
14131   if(GesturesHelper.activeHandler) {
14132    GesturesHelper.isExecutedGesture = true;
14133    GesturesHelper.activeHandler.OnMouseMove(evt);
14134   }
14135  },
14136  OnDocumentMouseUp: function (evt) {
14137   if(GesturesHelper.activeHandler) {
14138    GesturesHelper.activeHandler.OnMouseUp(evt);
14139    GesturesHelper.activeHandler = null;
14140    window.setTimeout(function () { GesturesHelper.isExecutedGesture = false; }, 0);
14141   }
14142  },
14143  AttachEvents: function () {
14144   if(!GesturesHelper.isAttachedEvents) {
14145    GesturesHelper.Attach(ASPx.Evt.AttachEventToElement);
14146    GesturesHelper.isAttachedEvents = true;
14147   }
14148  },
14149  DetachEvents: function () {
14150   if(GesturesHelper.isAttachedEvents) {
14151    GesturesHelper.Attach(ASPx.Evt.DetachEventFromElement);
14152    GesturesHelper.isAttachedEvents = false;
14153   }
14154  },
14155  Attach: function (changeEventsMethod) {
14156   var doc = window.document;
14157   changeEventsMethod(doc, ASPx.TouchUIHelper.touchMouseDownEventName, GesturesHelper.OnDocumentMouseDown);
14158   changeEventsMethod(doc, ASPx.TouchUIHelper.touchMouseMoveEventName, GesturesHelper.OnDocumentMouseMove);
14159   changeEventsMethod(doc, ASPx.TouchUIHelper.touchMouseUpEventName, GesturesHelper.OnDocumentMouseUp);
14160   if(!ASPx.Browser.MobileUI) {
14161    changeEventsMethod(doc, "selectstart", GesturesHelper.OnDocumentSelectStart);
14162    changeEventsMethod(doc, "dragstart", GesturesHelper.OnDocumentDragStart);
14163   }
14164  },
14165  FindHandler: function (evt) {
14166   var handlers = [];
14167   for(var id in GesturesHelper.handlers) {
14168    if(GesturesHelper.handlers.hasOwnProperty(id)) {
14169     var handler = GesturesHelper.handlers[id];
14170     if(handler.CanHandleEvent && handler.CanHandleEvent(evt))
14171      handlers.push(handler);
14172    }
14173   }
14174   if(!handlers.length)
14175    return null;
14176   handlers.sort(function (a, b) {
14177    return ASPx.GetIsParent(a.getAnimationElement(), b.getAnimationElement()) ? 1 : -1;
14178   });
14179   return handlers[0];
14180  },
14181  IsExecutedGesture: function () {
14182   return GesturesHelper.isExecutedGesture;
14183  }
14184 };
14185 GesturesHelper.AttachEvents();
14186 var AnimationEngineType = {
14187  "JS": 0,
14188  "CSS": 1,
14189  "DEFAULT" : 2
14190 };
14191 ASPx.AnimationEngineType = AnimationEngineType;
14192 ASPx.AnimationHelper = AnimationHelper;
14193 ASPx.GesturesHelper = GesturesHelper;
14194})();
14195
14196(function() {
14197var ASPxClientEditBase = ASPx.CreateClass(ASPxClientControl, {
14198 constructor: function(name) {
14199  this.constructor.prototype.constructor.call(this, name);
14200  this.EnabledChanged = new ASPxClientEvent();
14201  this.captionPosition = ASPx.Position.Left;
14202  this.showCaptionColon = true;
14203  this.scPrefix = "dxe";
14204 },
14205 InlineInitialize: function(){
14206  ASPxClientControl.prototype.InlineInitialize.call(this);
14207  this.InitializeEnabled(); 
14208  this.InitializeEvents();
14209 },
14210 InitializeEnabled: function() {
14211  this.SetEnabledInternal(this.clientEnabled, true);
14212 },
14213 InitializeEvents: function() { },
14214 AddDefaultReadOnlyStateControllerItem: function(cssClass, mainElementId) {
14215  ASPx.AddReadOnlyItems(mainElementId, [[[cssClass], [''], ['']]]);
14216 },
14217 AddDefaultDisabledStateControllerItem: function(cssClass, mainElementId) {
14218  ASPx.AddDisabledItems(mainElementId, [[[cssClass], [''], ['']]]);
14219 },
14220 GetValue: function() {
14221  var element = this.GetMainElement();
14222  if(ASPx.IsExistsElement(element))
14223   return element.innerHTML;
14224  return "";
14225 },
14226 GetValueString: function(){
14227  var value = this.GetValue();
14228  return (value == null) ? null : value.toString();
14229 },
14230 EnsureValueStringIsActual: function() {
14231  if(this.maskInfo != null)
14232   this.ParseValue();
14233 },
14234 SetValue: function(value) {
14235  if(value == null)
14236   value = "";
14237  var element = this.GetMainElement();
14238  if(ASPx.IsExistsElement(element))
14239   element.innerHTML = value;
14240 },
14241 GetEnabled: function(){
14242  return this.enabled && this.clientEnabled;
14243 },
14244 SetEnabled: function(enabled){
14245  if(this.clientEnabled != enabled) {
14246   var errorFrameRequiresUpdate = this.GetIsValid && !this.GetIsValid();
14247   if(errorFrameRequiresUpdate && !enabled)
14248    this.UpdateErrorFrameAndFocus(false , null , true );
14249   this.clientEnabled = enabled;
14250   this.SetEnabledInternal(enabled, false);
14251   if(errorFrameRequiresUpdate && enabled)
14252    this.UpdateErrorFrameAndFocus(false );
14253   this.RaiseEnabledChangedEvent();
14254  }
14255 },
14256 SetEnabledInternal: function(enabled, initialization){
14257  if(!this.enabled) return;
14258  if(!initialization || !enabled)
14259   this.ChangeEnabledStateItems(enabled);
14260  this.ChangeEnabledAttributes(enabled);
14261  if(ASPx.Browser.Chrome) {   
14262   var mainElement = this.GetMainElement();
14263   if(mainElement)
14264    mainElement.className = mainElement.className;
14265  } 
14266 },
14267 ChangeEnabledAttributes: function(enabled){
14268 },
14269 ChangeEnabledStateItems: function(enabled){
14270 },
14271 RaiseEnabledChangedEvent: function(){
14272  if(!this.EnabledChanged.IsEmpty()){
14273   var args = new ASPxClientEventArgs();
14274   this.EnabledChanged.FireEvent(this, args);
14275  }
14276 },
14277 GetDecodeValue: function (value) { 
14278  if(typeof (value) == "string" && value.length > 1)
14279   value = this.SimpleDecodeHtml(value);
14280  return value;
14281 },
14282 SimpleDecodeHtml: function (html) {
14283  return ASPx.Str.ApplyReplacement(html, [
14284   [/&lt;/g, '<'],
14285   [/&amp;/g, '&'],
14286   [/&quot;/g, '"'],
14287   [/&#39;/g, '\''],
14288   [/&#32;/g, ' ']
14289  ]);
14290 },
14291 GetCachedElementById: function(idSuffix) {
14292  return ASPx.CacheHelper.GetCachedElementById(this, this.name + idSuffix);
14293 },
14294 GetCaptionCell: function() {
14295  return this.GetCachedElementById(EditElementSuffix.CaptionCell);
14296 },
14297 GetExternalTable: function() {
14298  return this.GetCachedElementById(EditElementSuffix.ExternalTable);
14299 },
14300 getCaptionRelatedCellCount: function() {
14301  if(!this.captionRelatedCellCount)
14302   this.captionRelatedCellCount = ASPx.GetNodesByClassName(this.GetExternalTable(), CaptionRelatedCellClassName).length;
14303  return this.captionRelatedCellCount;
14304 },
14305 addCssClassToCaptionRelatedCells: function() {
14306  if(this.captionPosition == ASPx.Position.Left || this.captionPosition == ASPx.Position.Right) {
14307   var captionRelatedCellsIndex = this.captionPosition == ASPx.Position.Left ? 0 : this.GetCaptionCell().cellIndex;
14308   for(var i = 0; i < this.GetExternalTable().rows.length; i++)
14309    ASPx.AddClassNameToElement(this.GetExternalTable().rows[i].cells[captionRelatedCellsIndex], CaptionRelatedCellClassName);
14310  }
14311  if(this.captionPosition == ASPx.Position.Top || this.captionPosition == ASPx.Position.Bottom)
14312   for(var i = 0; i < this.GetCaptionCell().parentNode.cells.length; i++)
14313    ASPx.AddClassNameToElement(this.GetCaptionCell().parentNode.cells[i], CaptionRelatedCellClassName);
14314 },
14315 GetCaption: function() {
14316  if(ASPx.IsExists(this.GetCaptionCell()))
14317   return this.getCaptionInternal();
14318  return "";
14319 },
14320 SetCaption: function(caption) {
14321  if(!ASPx.IsExists(this.GetCaptionCell()))
14322   return;
14323  if(this.getCaptionRelatedCellCount() == 0)
14324   this.addCssClassToCaptionRelatedCells();
14325  if(caption !== "")
14326   ASPx.RemoveClassNameFromElement(this.GetExternalTable(), ASPxEditExternalTableClassNames.TableWithEmptyCaptionClassName);
14327  else
14328   ASPx.AddClassNameToElement(this.GetExternalTable(), ASPxEditExternalTableClassNames.TableWithEmptyCaptionClassName);
14329  this.setCaptionInternal(caption);
14330 },
14331 getCaptionTextNode: function() {
14332  var captionElement = ASPx.GetNodesByPartialClassName(this.GetCaptionCell(), CaptionElementPartialClassName)[0];
14333  return ASPx.GetNormalizedTextNode(captionElement);
14334 },
14335 getCaptionInternal: function() {
14336  var captionText = this.getCaptionTextNode().nodeValue;
14337  if(captionText !== "" && captionText[captionText.length - 1] == ":")
14338   captionText = captionText.substring(0, captionText.length - 1);
14339  return captionText;
14340 },
14341 setCaptionInternal: function(caption) {
14342  caption = ASPx.Str.Trim(caption);
14343  var captionTextNode = this.getCaptionTextNode();
14344  if(this.showCaptionColon && caption[caption.length - 1] != ":" && caption !== "")
14345   caption += ":";
14346  captionTextNode.nodeValue = caption;
14347 },
14348 onVirtualKeyboardUITouchStart: function(evt) { }
14349});
14350var ValidationPattern = ASPx.CreateClass(null, {
14351 constructor: function(errorText) {
14352  this.errorText = errorText;
14353 }
14354});
14355var RequiredFieldValidationPattern = ASPx.CreateClass(ValidationPattern, {
14356 constructor: function(errorText) {
14357  this.constructor.prototype.constructor.call(this, errorText);
14358 },
14359 EvaluateIsValid: function(value) {
14360  return value != null && (value.constructor == Array || ASPx.Str.Trim(value.toString()) != "");
14361 }
14362});
14363var RegularExpressionValidationPattern = ASPx.CreateClass(ValidationPattern, {
14364 constructor: function(errorText, pattern) {
14365  this.constructor.prototype.constructor.call(this, errorText);
14366  this.pattern = pattern;
14367 },
14368 EvaluateIsValid: function(value) {
14369  if(value == null) 
14370   return true;
14371  var strValue = value.toString();
14372  if(ASPx.Str.Trim(strValue).length == 0)
14373   return true;
14374  var regEx = new RegExp(this.pattern);
14375  var matches = regEx.exec(strValue);
14376  return matches != null && strValue == matches[0];
14377 }
14378});
14379function _aspxIsEditorFocusable(inputElement) {
14380 return ASPx.IsFocusableCore(inputElement, function(container) {
14381  return container.getAttribute("errorFrame") == "errorFrame";
14382 });
14383}
14384var invalidEditorToBeFocused = null;
14385var ValidationType = {
14386 PersonalOnValueChanged: "ValueChanged",
14387 PersonalViaScript: "CalledViaScript",
14388 MassValidation: "MassValidation"
14389};
14390var ErrorFrameDisplay = {
14391 None: "None",
14392 Static: "Static",
14393 Dynamic: "Dynamic"
14394};
14395var EditElementSuffix = {
14396 ExternalTable: "_ET",
14397 ControlCell: "_CC",
14398 ErrorCell: "_EC",
14399 ErrorTextCell: "_ETC",
14400 ErrorImage: "_EI",
14401 CaptionCell: "_CapC",
14402 AccessibilityAdditionalTextRow: "_AHTR"
14403};
14404var ASPxEditExternalTableClassNames = {
14405 ValidStaticTableClassName: "dxeValidStEditorTable",
14406 ValidDynamicTableClassName: "dxeValidDynEditorTable",
14407 TableWithSeparateBordersClassName: "tableWithSeparateBorders",
14408 TableWithEmptyCaptionClassName: "tableWithEmptyCaption"
14409};
14410var CaptionRelatedCellClassName = "dxeCaptionRelatedCell";
14411var CaptionElementPartialClassName = "dxeCaption";
14412var AccessibilityAssistantID = "AcAs";
14413var ASPxClientEdit = ASPx.CreateClass(ASPxClientEditBase, {
14414 constructor: function(name) {
14415  this.constructor.prototype.constructor.call(this, name);
14416  this.isASPxClientEdit = true;
14417  this.inputElement = null;
14418  this.convertEmptyStringToNull = true;
14419  this.readOnly = false;
14420  this.clientReadOnly = false;
14421  this.focused = false;
14422  this.focusEventsLocked = false;
14423  this.receiveGlobalMouseWheel = true;
14424  this.styleDecoration = null;
14425  this.heightCorrectionRequired = false;
14426  this.customValidationEnabled = false;
14427  this.display = ErrorFrameDisplay.Static;
14428  this.initialErrorText = "";
14429  this.causesValidation = false;
14430  this.validateOnLeave = true;
14431  this.validationGroup = "";
14432  this.sendPostBackWithValidation = null;
14433  this.validationPatterns = [];
14434  this.setFocusOnError = false;
14435  this.errorDisplayMode = "it";
14436  this.errorText = "";
14437  this.isValid = true;
14438  this.errorImageIsAssigned = false;
14439  this.notifyValidationSummariesToAcceptNewError = false;
14440  this.isErrorFrameRequired = false;
14441  this.enterProcessed = false;
14442  this.keyDownHandlers = {};
14443  this.keyPressHandlers = {};
14444  this.keyUpHandlers = {};
14445  this.specialKeyboardHandlingUsed = false;
14446  this.onKeyDownHandler = null;
14447  this.onKeyPressHandler = null;
14448  this.onKeyUpHandler = null;
14449  this.onGotFocusHandler = null;
14450  this.onLostFocusHandler = null;
14451  this.GotFocus = new ASPxClientEvent();
14452  this.LostFocus = new ASPxClientEvent();
14453  this.Validation = new ASPxClientEvent();
14454  this.ValueChanged = new ASPxClientEvent();
14455  this.KeyDown = new ASPxClientEvent();
14456  this.KeyPress = new ASPxClientEvent();
14457  this.KeyUp = new ASPxClientEvent();
14458  this.eventHandlersInitialized = false;
14459  this.errorCellVisibilityChanged = new ASPxClientEvent();
14460  this.ariaExplanatoryTextManager = null;
14461 },
14462 SetData: function(data){
14463  if(data.decorationStyles){
14464   for(var i = 0; i < data.decorationStyles.length; i++)
14465    this.AddDecorationStyle(data.decorationStyles[i].key, 
14466     data.decorationStyles[i].className, 
14467     data.decorationStyles[i].cssText);
14468  }
14469 },
14470 Initialize: function() {
14471  this.initialErrorText = this.errorText;
14472  ASPxClientEditBase.prototype.Initialize.call(this);
14473  this.InitializeKeyHandlers();
14474  this.UpdateClientValidationState();
14475  this.UpdateValidationSummaries(null , true );
14476 },
14477 InlineInitialize: function() {
14478  ASPxClientEditBase.prototype.InlineInitialize.call(this);
14479  this.UpdateStyleDecorations();
14480  var externalTable = this.GetExternalTable();
14481  if(externalTable && ASPx.IsPercentageSize(externalTable.style.width)) {
14482   this.width = "100%";
14483   this.GetMainElement().style.width = "100%";
14484   if(this.isErrorFrameRequired)
14485    externalTable.setAttribute("errorFrame", "errorFrame");
14486  }
14487  this.ariaExplanatoryTextManager = this.CreateAriaExplanatoryTextManager();
14488  if(this.clientReadOnly)
14489   this.SetReadOnlyInternal(true);
14490  this.UpdateErrorCellParentRowVisibility();
14491 }, 
14492 AfterInitialize: function() {
14493  this.ariaExplanatoryTextManager.SetCaptionAssociating();
14494  this.ariaExplanatoryTextManager.UpdateText();
14495  this.ariaExplanatoryTextManager.UpdateValidationState();
14496  ASPxClientEditBase.prototype.AfterInitialize.call(this);
14497 },
14498 UpdateStyleDecorations: function() {
14499  if(this.styleDecoration)
14500   this.styleDecoration.Update();
14501 },
14502 InitSpecialKeyboardHandling: function(){
14503  var name = this.name;
14504  this.onKeyDownHandler = function(evt) { ASPx.KBSIKeyDown(name,evt); };
14505  this.onKeyPressHandler = function(evt) { ASPx.KBSIKeyPress(name, evt); };
14506  this.onKeyUpHandler = function(evt) { ASPx.KBSIKeyUp(name, evt); };
14507  this.onGotFocusHandler = function(evt) { ASPx.ESGotFocus(name); };
14508  this.onLostFocusHandler = function(evt) { ASPx.ESLostFocus(name); };
14509  this.specialKeyboardHandlingUsed = true;
14510  this.InitializeDelayedSpecialFocus();
14511 },
14512 InitializeKeyHandlers: function() {
14513 },
14514 AddKeyDownHandler: function(key, handler) {
14515  this.keyDownHandlers[key] = handler;
14516 },
14517 AddKeyPressHandler: function(key, handler) {
14518  this.keyPressHandlers[key] = handler;
14519 },
14520 ChangeSpecialInputEnabledAttributes: function(element, method, doNotChangeAutoComplete){
14521  if(!doNotChangeAutoComplete) 
14522   element.autocomplete = "off";
14523  if(this.onKeyDownHandler != null)
14524   method(element, "keydown", this.onKeyDownHandler);
14525  if(this.onKeyPressHandler != null)
14526   method(element, "keypress", this.onKeyPressHandler);
14527  if(this.onKeyUpHandler != null)
14528   method(element, "keyup", this.onKeyUpHandler);
14529  if(this.onGotFocusHandler != null)
14530   method(element, "focus", this.onGotFocusHandler);
14531  if(this.onLostFocusHandler != null)
14532   method(element, "blur", this.onLostFocusHandler);
14533 },
14534 CreateAriaExplanatoryTextManager: function() {
14535  if(this.accessibilityCompliant)
14536   return new EditAccessibilityExplanatoryTextManager(this);
14537  else 
14538   return new DisableAccessibilityExplanatoryTextManager(this);
14539 },
14540 UpdateClientValidationState: function() {
14541  if(!this.customValidationEnabled)
14542   return;
14543  var mainElement = this.GetMainElement();
14544  if(mainElement) {
14545   var validationState = !this.GetIsValid() ? ("-" + this.GetErrorText()) : "";
14546   this.UpdateStateObjectWithObject({ validationState: validationState });
14547  }
14548 },
14549 UpdateValidationSummaries: function(validationType, initializing) {
14550  if(ASPx.Ident.scripts.ASPxClientValidationSummary) {
14551   var summaryCollection = ASPx.GetClientValidationSummaryCollection();
14552   summaryCollection.OnEditorIsValidStateChanged(this, validationType, initializing && this.notifyValidationSummariesToAcceptNewError);
14553  }
14554 },
14555 FindInputElement: function(){
14556  return null;
14557 },
14558 GetInputElement: function(){
14559  if(!ASPx.IsExistsElement(this.inputElement))
14560   this.inputElement = this.FindInputElement();
14561  return this.inputElement;
14562 },
14563 GetFocusableInputElement: function() {
14564  return this.GetInputElement();
14565 },
14566 GetAccessibilityActiveElements: function() {
14567  return [this.GetInputElement()];
14568 },
14569 GetAccessibilityFirstActiveElement: function() {
14570  return this.accessibilityHelper ? 
14571    this.accessibilityHelper.getMainElement() : 
14572    this.GetAccessibilityActiveElements()[0];
14573 },
14574 GetAccessibilityAssistantElement: function() {
14575  return this.GetChildElement(AccessibilityAssistantID);
14576 },
14577 GetErrorImage: function() {
14578  return this.GetCachedElementById(EditElementSuffix.ErrorImage);
14579 },
14580 GetControlCell: function() {
14581  return this.GetCachedElementById(EditElementSuffix.ControlCell);
14582 },
14583 GetErrorCell: function() {
14584  return this.GetCachedElementById(EditElementSuffix.ErrorCell);
14585 },
14586 GetErrorTextCell: function() {
14587  return this.GetCachedElementById(this.errorImageIsAssigned ? EditElementSuffix.ErrorTextCell : EditElementSuffix.ErrorCell);
14588 },
14589 GetReadOnly: function() {
14590  return this.readOnly || this.clientReadOnly;
14591 },
14592 SetReadOnly: function(readOnly) {
14593  readOnly = !!readOnly;
14594  if(this.clientReadOnly === readOnly || this.readOnly)
14595   return;
14596  this.SetReadOnlyInternal(readOnly);
14597 },
14598 SetReadOnlyInternal: function(readOnly) {
14599  this.clientReadOnly = readOnly;
14600  this.ChangeReadOnlyStateItems(readOnly);
14601 },
14602 ChangeReadOnlyStateItems: function(readOnly) {
14603  ASPx.GetStateController().SetElementReadOnly(this.GetMainElement(), readOnly);
14604 },
14605 SetVisible: function (isVisible) {
14606  if(this.clientVisible == isVisible)
14607   return;
14608  var externalTable = this.GetExternalTable();
14609  if(externalTable) {
14610   ASPx.SetElementDisplay(externalTable, isVisible);
14611   if(this.customValidationEnabled) {
14612    var isValid = !isVisible ? true : void (0);
14613    this.UpdateErrorFrameAndFocus(false , true , isValid );
14614   }
14615  }
14616  ASPxClientControl.prototype.SetVisible.call(this, isVisible);
14617 },
14618 GetStateHiddenFieldName: function() {
14619  return this.uniqueID + "$State";
14620 },
14621 GetValueInputToValidate: function() {
14622  return this.GetInputElement();
14623 },
14624 IsVisible: function() {
14625  if(!this.clientVisible)
14626   return false;
14627  var element = this.GetMainElement();
14628  if(!element) 
14629   return false;
14630  while(element && element.tagName != "BODY") {
14631   if(element.getAttribute("errorFrame") != "errorFrame" && (!ASPx.GetElementVisibility(element) || !ASPx.GetElementDisplay(element)))
14632    return false;
14633   element = element.parentNode;
14634  }
14635  return true;
14636 },
14637 AdjustControlCore: function() {
14638  this.CollapseEditor();
14639  this.UnstretchInputElement();
14640  if(this.heightCorrectionRequired)
14641   this.CorrectEditorHeight();
14642 },
14643 CorrectEditorHeight: function() {
14644 },
14645 UnstretchInputElement: function() {
14646 },
14647 UseDelayedSpecialFocus: function() {
14648  return false;
14649 },
14650 GetDelayedSpecialFocusTriggers: function() {
14651  return [ this.GetMainElement() ];
14652 },
14653 InitializeDelayedSpecialFocus: function() {
14654  if(!this.UseDelayedSpecialFocus())
14655   return;
14656  this.specialFocusTimer = -1;    
14657  var handler = function(evt) { this.OnDelayedSpecialFocusMouseDown(evt); }.aspxBind(this);
14658  var triggers = this.GetDelayedSpecialFocusTriggers();
14659  for(var i = 0; i < triggers.length; i++)
14660   ASPx.Evt.AttachEventToElement(triggers[i], "mousedown", handler);
14661 },
14662 OnDelayedSpecialFocusMouseDown: function(evt) {
14663  window.setTimeout(function() { this.SetFocus(); }.aspxBind(this), 0);
14664 },
14665 IsFocusEventsLocked: function() {
14666  return this.focusEventsLocked;
14667 },
14668 LockFocusEvents: function() {
14669  if(!this.focused) return;
14670  this.focusEventsLocked = true;
14671 },
14672 UnlockFocusEvents: function() {
14673  this.focusEventsLocked = false;
14674 },
14675 ForceRefocusEditor: function(evt, isNativeFocus) {
14676  if(ASPx.Browser.VirtualKeyboardSupported && !this.ownerListBox) {
14677   var focusedEditor = ASPx.VirtualKeyboardUI.getFocusedEditor();
14678   if(ASPx.VirtualKeyboardUI.getInputNativeFocusLocked() && (!focusedEditor || focusedEditor === this))
14679     return;
14680   ASPx.VirtualKeyboardUI.setInputNativeFocusLocked(!isNativeFocus);
14681  }
14682  this.LockFocusEvents();
14683  this.BlurInputElement();
14684  window.setTimeout(function() { 
14685   if(ASPx.Browser.VirtualKeyboardSupported && !this.ownerListBox) {
14686    ASPx.VirtualKeyboardUI.setFocusEditorCore(this);
14687   } else {
14688    this.SetFocus();
14689   }
14690  }.aspxBind(this), 0);
14691 },
14692 BlurInputElement: function() {
14693  var inputElement = this.GetFocusableInputElement();
14694  if(inputElement && inputElement.blur)
14695   inputElement.blur();
14696 },
14697 IsEditorElement: function(element) {
14698  return this.GetMainElement() == element || ASPx.GetIsParent(this.GetMainElement(), element);
14699 },
14700 IsClearButtonElement: function(element) {
14701  return false;
14702 },
14703 IsElementBelongToInputElement: function(element) {
14704  return this.GetInputElement() == element;
14705 },
14706 OnFocusCore: function() {
14707  if(this.UseDelayedSpecialFocus())
14708   window.clearTimeout(this.specialFocusTimer);
14709  if(!this.IsFocusEventsLocked()){
14710   this.focused = true;
14711   ASPx.SetFocusedEditor(this);
14712   if(this.styleDecoration)
14713    this.styleDecoration.Update();
14714   if(this.isInitialized)
14715    this.RaiseFocus();
14716  }
14717  else
14718   this.UnlockFocusEvents();
14719 },
14720 OnLostFocusCore: function() {
14721  if(!this.IsFocusEventsLocked()){
14722   this.focused = false;
14723   if(ASPx.GetFocusedEditor() === this)
14724    ASPx.SetFocusedEditor(null);
14725   if(this.styleDecoration)
14726    this.styleDecoration.Update();
14727   this.RaiseLostFocus();
14728  }
14729 },
14730 OnFocus: function() {
14731  if(!this.specialKeyboardHandlingUsed)
14732   this.OnFocusCore();
14733 },
14734 OnLostFocus: function() {
14735  if(this.isInitialized && !this.specialKeyboardHandlingUsed)
14736   this.OnLostFocusCore();
14737 },
14738 OnSpecialFocus: function() {
14739  if(this.isInitialized)
14740   this.OnFocusCore();
14741 },
14742 OnSpecialLostFocus: function() {
14743  if(this.isInitialized)
14744   this.OnLostFocusCore();
14745 },
14746 OnMouseWheel: function(evt){
14747 },
14748 OnValidation: function(validationType) {
14749  if(this.customValidationEnabled && this.isInitialized && ASPx.IsExistsElement(this.GetMainElement()) &&
14750   (!this.IsErrorFrameDisplayed() || this.GetElementRequiredForErrorFrame())) {
14751   this.BeginErrorFrameUpdate();
14752   try {
14753    if(this.validateOnLeave || validationType != ValidationType.PersonalOnValueChanged) {
14754     this.SetIsValid(true, true );
14755     this.SetErrorText(this.initialErrorText, true );
14756     this.ValidateWithPatterns();
14757     this.RaiseValidation();
14758    }
14759    this.UpdateErrorFrameAndFocus(this.editorFocusingRequired(validationType));
14760   } finally {
14761    this.EndErrorFrameUpdate();
14762   }
14763   this.UpdateValidationSummaries(validationType);
14764   this.ariaExplanatoryTextManager.UpdateValidationState(validationType);
14765  }
14766 },
14767 GetElementRequiredForErrorFrame: function() {
14768  return this.GetExternalTable();
14769 },
14770 editorFocusingRequired: function(validationType) {
14771  return !this.GetIsValid() &&
14772   validationType == ValidationType.PersonalViaScript && this.setFocusOnError;
14773 },
14774 OnValueChanged: function() {
14775  if(this.getProcessOnServerOnValueChanged())
14776   this.SendPostBackInternal("");
14777 },
14778 getProcessOnServerOnValueChanged: function() {
14779  var processOnServer = this.RaiseValidationInternal();
14780  return this.RaiseValueChangedEvent() && processOnServer;
14781 },
14782 ParseValue: function() {
14783 },
14784 RaisePersonalStandardValidation: function() {
14785  if(ASPx.IsFunction(window.ValidatorOnChange)) {
14786   var inputElement = this.GetValueInputToValidate();
14787   if(inputElement && inputElement.Validators)
14788    window.ValidatorOnChange({ srcElement: inputElement });
14789  }
14790 },
14791 RaiseValidationInternal: function() {
14792  if(this.isPostBackAllowed() && this.causesValidation && this.validateOnLeave)
14793   return ASPxClientEdit.ValidateGroup(this.validationGroup);
14794  else {
14795   this.OnValidation(ValidationType.PersonalOnValueChanged);
14796   return this.GetIsValid();
14797  }
14798 },
14799 RaiseValueChangedEvent: function(){
14800  return this.RaiseValueChanged();
14801 },
14802 SendPostBackInternal: function(postBackArg) {
14803  if(ASPx.IsFunction(this.sendPostBackWithValidation))
14804   this.sendPostBackWithValidation(postBackArg);
14805  else
14806   this.SendPostBack(postBackArg);
14807 },
14808 SetElementToBeFocused: function() {
14809  if(this.IsVisible())
14810   invalidEditorToBeFocused = this;
14811 },
14812 GetFocusSelectAction: function() {
14813  return null;
14814 },
14815 SetFocus: function() {
14816  var inputElement = this.GetFocusableInputElement();
14817  if(!inputElement) return; 
14818  var isIE9 = ASPx.Browser.IE && ASPx.Browser.Version >= 9;
14819  if((ASPx.GetActiveElement() != inputElement || isIE9) && _aspxIsEditorFocusable(inputElement))
14820   ASPx.SetFocus(inputElement, this.GetFocusSelectAction());
14821 },
14822 SetFocusOnError: function() {
14823  if(invalidEditorToBeFocused == this) {
14824   this.SetFocus();
14825   invalidEditorToBeFocused = null;
14826  }
14827 },
14828 BeginErrorFrameUpdate: function() {
14829  if(!this.errorFrameUpdateLocked)
14830   this.errorFrameUpdateLocked = true;
14831 },
14832 EndErrorFrameUpdate: function() {
14833  this.errorFrameUpdateLocked = false;
14834  var args = this.updateErrorFrameAndFocusLastCallArgs;
14835  if(args) {
14836   this.UpdateErrorFrameAndFocus(args[0], args[1]);
14837   delete this.updateErrorFrameAndFocusLastCallArgs;
14838  }
14839 },
14840 UpdateErrorFrameAndFocus: function(setFocusOnError, ignoreVisibilityCheck, isValid) {
14841  if(!this.GetEnabled() || !ignoreVisibilityCheck && !this.GetVisible())
14842   return;
14843  if(this.errorFrameUpdateLocked) {
14844   this.updateErrorFrameAndFocusLastCallArgs = [ setFocusOnError, ignoreVisibilityCheck ];
14845   return;
14846  }
14847  if(this.styleDecoration)
14848   this.styleDecoration.Update();
14849  if(typeof(isValid) == "undefined")
14850   isValid = this.GetIsValid();
14851  if(isValid && this.IsErrorFrameDisplayed())
14852   this.ChangeErrorFrameVisibility(false);
14853  else {
14854   var editorLocatedWithinVisibleContainer = this.IsVisible();
14855   if(this.IsErrorFrameDisplayed()) {
14856    this.UpdateErrorCellContent();
14857    this.ChangeErrorFrameVisibility(true);
14858   }
14859   if(editorLocatedWithinVisibleContainer) {
14860    if(setFocusOnError && this.setFocusOnError && invalidEditorToBeFocused == null) {
14861     this.SetElementToBeFocused();
14862     this.SetFocusOnError();
14863    }
14864   }
14865  }
14866 },
14867 ChangeErrorFrameVisibility: function(visible) {
14868  var externalTable = this.GetExternalTable();
14869  var isStaticDisplay = this.display == ErrorFrameDisplay.Static;
14870  if(!isStaticDisplay && visible) {
14871   this.EnsureControlCellStylesLoaded();
14872   this.RestoreControlCellStyles();
14873  }
14874  this.ChangeErrorCellVisibility(visible, isStaticDisplay);
14875  if(!isStaticDisplay && !visible) {
14876   this.EnsureControlCellStylesLoaded();
14877   this.ClearControlCellStyles();
14878  }
14879  var validExternalTableClassName = isStaticDisplay ? ASPxEditExternalTableClassNames.ValidStaticTableClassName
14880   : ASPxEditExternalTableClassNames.ValidDynamicTableClassName;
14881  ASPx.ToggleClassNameToElement(externalTable, validExternalTableClassName, !visible);
14882  this.UpdateErrorCellParentRowVisibility();
14883 },
14884 ChangeErrorCellVisibility: function(visible, useVisibilityAttribute) {
14885  var errorCell = this.GetErrorCell();
14886  if(errorCell) {
14887   if(useVisibilityAttribute)
14888    ASPx.SetElementVisibility(errorCell, visible);
14889   else {
14890    ASPx.SetElementDisplay(errorCell, visible);
14891    this.raiseErrorCellVisibilityChanged();
14892   }
14893  }
14894 },
14895 raiseErrorCellVisibilityChanged: function() {
14896  if(!this.errorCellVisibilityChanged.IsEmpty())
14897   this.errorCellVisibilityChanged.FireEvent(this);
14898 },
14899 UpdateErrorCellParentRowVisibility: function() {
14900  var errorCell = this.GetErrorCell();
14901  if(!errorCell || this.display == ErrorFrameDisplay.Static)
14902   return;
14903  var displayedCellCount = 0;
14904  var errorCellParentRow = errorCell.parentNode;
14905  for(var i = 0; i < errorCellParentRow.cells.length; i++) {
14906   var cell = errorCellParentRow.cells[i];
14907   if(ASPx.GetElementDisplay(cell))
14908    displayedCellCount++;
14909  }
14910  ASPx.SetElementDisplay(errorCellParentRow, displayedCellCount > 0);
14911 },
14912 EnsureControlCellStylesLoaded: function() {
14913  if(typeof(this.controlCellStyles) == "undefined") {
14914   var controlCell = this.GetControlCell();
14915   this.controlCellStyles = {
14916    cssClass: controlCell.className,
14917    style: this.ExtractElementStyleStringIgnoringVisibilityProps(controlCell)
14918   };
14919  }
14920 },
14921 ClearControlCellStyles: function() {
14922  this.ClearElementStyle(this.GetControlCell());
14923 },
14924 RestoreControlCellStyles: function() {
14925  var controlCell = this.GetControlCell();
14926  var externalTable = this.GetExternalTable();
14927  if(ASPx.Browser.WebKitFamily)
14928   this.MakeBorderSeparateForTable(externalTable);
14929  controlCell.className = this.controlCellStyles.cssClass;
14930  controlCell.style.cssText = this.controlCellStyles.style;
14931  if(ASPx.Browser.WebKitFamily)
14932   this.UndoBorderSeparateForTable(externalTable);
14933 },
14934 MakeBorderSeparateForTable: function(table) {
14935  ASPx.AddClassNameToElement(table, ASPxEditExternalTableClassNames.TableWithSeparateBordersClassName);
14936 },
14937 UndoBorderSeparateForTable: function(table) {
14938  setTimeout(function () {
14939   ASPx.RemoveClassNameFromElement(table, ASPxEditExternalTableClassNames.TableWithSeparateBordersClassName);
14940  }, 0);
14941 },
14942 ExtractElementStyleStringIgnoringVisibilityProps: function(element) {
14943  var savedVisibility = element.style.visibility;
14944  var savedDisplay = element.style.display;
14945  element.style.visibility = "";
14946  element.style.display = "";
14947  var styleStr = element.style.cssText;
14948  element.style.visibility = savedVisibility;
14949  element.style.display = savedDisplay;
14950  return styleStr;
14951 },
14952 ClearElementStyle: function(element) {
14953  if(!element)
14954   return;
14955  element.className = "";
14956  var excludedAttrNames = [
14957   "width", "display", "visibility",
14958   "position", "left", "top", "z-index",
14959   "margin", "margin-top", "margin-right", "margin-bottom", "margin-left",
14960   "float", "clear"
14961  ];
14962  var savedAttrValues = { };
14963  for(var i = 0; i < excludedAttrNames.length; i++) {
14964   var attrName = excludedAttrNames[i];
14965   var attrValue = element.style[attrName];
14966   if(attrValue)
14967    savedAttrValues[attrName] = attrValue;
14968  }
14969  element.style.cssText = "";
14970  for(var styleAttrName in savedAttrValues)
14971   if(savedAttrValues.hasOwnProperty(styleAttrName))
14972    element.style[styleAttrName] = savedAttrValues[styleAttrName];
14973 },
14974 Clear: function() {
14975  this.SetValue(null);
14976  this.SetIsValid(true);
14977  return true;
14978 },
14979 ResetEditorState: function() { },
14980 UpdateErrorCellContent: function() {
14981  if(this.errorDisplayMode.indexOf("t") > -1)
14982   this.UpdateErrorText();
14983  if(this.errorDisplayMode == "i")
14984   this.UpdateErrorImage();
14985 },
14986 UpdateErrorImage: function() {
14987  var image = this.GetErrorImage();
14988  if(ASPx.IsExistsElement(image)) {
14989   if(this.accessibilityCompliant) {
14990    ASPx.Attr.SetAttribute(image, "aria-label", this.errorText);
14991    var innerImg = ASPx.GetNodeByTagName(image, "IMG", 0);
14992    if(ASPx.IsExists(innerImg))
14993     innerImg.alt = this.errorText;
14994   }
14995   image.alt = this.errorText;
14996   image.title = this.errorText;
14997  } else {
14998   this.UpdateErrorText();
14999  }
15000 },
15001 UpdateErrorText: function() {
15002  var errorTextCell = this.GetErrorTextCell();
15003  if(ASPx.IsExistsElement(errorTextCell))
15004   errorTextCell.innerHTML = this.HtmlEncode(this.errorText);
15005 },
15006 ValidateWithPatterns: function() {
15007  if(this.validationPatterns.length > 0) {
15008   var value = this.GetValue();
15009   for(var i = 0; i < this.validationPatterns.length; i++) {
15010    var validator = this.validationPatterns[i];
15011    if(!validator.EvaluateIsValid(value)) {
15012     this.SetIsValid(false, true );
15013     this.SetErrorText(validator.errorText, true );
15014     return;
15015    }
15016   }
15017  }
15018 },
15019 OnSpecialKeyDown: function(evt){
15020  this.RaiseKeyDown(evt);
15021  var handler = this.keyDownHandlers[evt.keyCode];
15022  if(handler) 
15023   return this[handler](evt);
15024  return false;
15025 },
15026 OnSpecialKeyPress: function(evt){
15027  this.RaiseKeyPress(evt);
15028  var handler = this.keyPressHandlers[evt.keyCode];
15029  if(handler) 
15030   return this[handler](evt);
15031  if(ASPx.Browser.NetscapeFamily || ASPx.Browser.Opera){
15032   if(evt.keyCode == ASPx.Key.Enter)
15033    return this.enterProcessed;
15034  }
15035  return false;
15036 },
15037 OnSpecialKeyUp: function(evt){
15038  this.RaiseKeyUp(evt);
15039  var handler = this.keyUpHandlers[evt.keyCode];
15040  if(handler) 
15041   return this[handler](evt);
15042  return false;
15043 },
15044 OnKeyDown: function(evt) {
15045  if(!this.specialKeyboardHandlingUsed)
15046   this.RaiseKeyDown(evt);
15047 },
15048 OnKeyPress: function(evt) {
15049  if(!this.specialKeyboardHandlingUsed)
15050   this.RaiseKeyPress(evt);
15051 },
15052 OnKeyUp: function(evt) {
15053  if(!this.specialKeyboardHandlingUsed)
15054   this.RaiseKeyUp(evt);
15055 },
15056 RaiseKeyDown: function(evt){
15057  if(!this.KeyDown.IsEmpty()){
15058   var args = new ASPxClientEditKeyEventArgs(evt);
15059   this.KeyDown.FireEvent(this, args);
15060  }
15061 },
15062 RaiseKeyPress: function(evt){
15063  if(!this.KeyPress.IsEmpty()){
15064   var args = new ASPxClientEditKeyEventArgs(evt);
15065   this.KeyPress.FireEvent(this, args);
15066  }
15067 },
15068 RaiseKeyUp: function(evt){
15069  if(!this.KeyUp.IsEmpty()){
15070   var args = new ASPxClientEditKeyEventArgs(evt);
15071   this.KeyUp.FireEvent(this, args);
15072  }
15073 },
15074 RaiseFocus: function(){
15075  if(!this.GotFocus.IsEmpty()){
15076   var args = new ASPxClientEventArgs();
15077   this.GotFocus.FireEvent(this, args);
15078  }
15079 },
15080 RaiseLostFocus: function(){
15081  if(!this.LostFocus.IsEmpty()){
15082   var args = new ASPxClientEventArgs();
15083   this.LostFocus.FireEvent(this, args);
15084  }
15085 },
15086 RaiseValidation: function() {
15087  if(this.customValidationEnabled && !this.Validation.IsEmpty()) {
15088   var currentValue = this.GetValue();
15089   var args = new ASPxClientEditValidationEventArgs(currentValue, this.errorText, this.GetIsValid());
15090   this.Validation.FireEvent(this, args);
15091   this.SetErrorText(args.errorText, true );
15092   this.SetIsValid(args.isValid, true );
15093   if(args.value != currentValue)
15094    this.SetValue(args.value);
15095  }
15096 },
15097 RaiseValueChanged: function(){
15098  var processOnServer = this.isPostBackAllowed();
15099  if(!this.ValueChanged.IsEmpty()){
15100   var args = new ASPxClientProcessingModeEventArgs(processOnServer);
15101   this.ValueChanged.FireEvent(this, args);
15102   processOnServer = args.processOnServer;
15103  }
15104  return processOnServer;  
15105 },
15106 isPostBackAllowed: function() {
15107  return this.autoPostBack;
15108 },
15109 AddDecorationStyle: function(key, className, cssText) {
15110  if(!this.styleDecoration) 
15111   this.RequireStyleDecoration();
15112  this.styleDecoration.AddStyle(key, className, cssText);
15113 }, 
15114 RequireStyleDecoration: function() {
15115  this.styleDecoration = this.CreateStyleDecoration();
15116  this.PopulateStyleDecorationPostfixes();
15117 },
15118 CreateStyleDecoration: function() {
15119  return new ASPx.EditorStyleDecoration(this);
15120 },
15121 PopulateStyleDecorationPostfixes: function() {
15122  this.styleDecoration.AddPostfix("");
15123 },
15124 LockStyleDecorationUpdate: function() {
15125  if(this.styleDecoration)
15126   this.styleDecoration.LockUpdate();
15127 },
15128 UnlockStyleDecorationUpdate: function() {
15129  if(this.styleDecoration)
15130   this.styleDecoration.UnlockUpdate();
15131 },
15132 Focus: function(){
15133  this.SetFocus();
15134 },
15135 GetIsValid: function() {
15136  var hasRequiredInputElement = !this.RequireInputElementToValidate() || ASPx.IsExistsElement(this.GetInputElement());
15137  if(!hasRequiredInputElement || this.IsErrorFrameDisplayed() && !ASPx.IsExistsElement(this.GetElementRequiredForErrorFrame()))
15138   return true;
15139  return this.isValid;
15140 },
15141 RequireInputElementToValidate: function() {
15142  return true;
15143 },
15144 IsErrorFrameDisplayed: function() {
15145  return this.display !== ErrorFrameDisplay.None;
15146 },
15147 GetErrorText: function(){
15148  return this.errorText;
15149 },
15150 SetIsValid: function(isValid, validating){
15151  if(this.customValidationEnabled && this.isValid != isValid) {
15152   this.isValid = isValid;
15153   this.UpdateErrorFrameAndFocus(false );
15154   this.UpdateClientValidationState();
15155   if(!validating)
15156    this.UpdateValidationSummaries(ValidationType.PersonalViaScript);
15157  }
15158 },
15159 SetErrorText: function(errorText, validating){
15160  if(this.customValidationEnabled && this.errorText != errorText) {
15161   this.errorText = errorText;
15162   this.UpdateErrorFrameAndFocus(false );
15163   this.UpdateClientValidationState();
15164   if(!validating)
15165    this.UpdateValidationSummaries(ValidationType.PersonalViaScript);
15166  }
15167 },
15168 Validate: function(){
15169  this.ParseValue();
15170  this.OnValidation(ValidationType.PersonalViaScript);
15171 },
15172 GetModifyEvent: function() {
15173  return this.ValueChanged;
15174 },
15175 EnsureRequiredNativeAttributesExists: function() { }
15176});
15177ASPx.Ident.scripts.ASPxClientEdit = true;
15178ASPx.focusedEditorName = "";
15179ASPx.GetFocusedEditor = function() {
15180 var focusedEditor = ASPx.GetControlCollection().Get(ASPx.focusedEditorName);
15181 if(focusedEditor && !focusedEditor.focused){
15182  ASPx.SetFocusedEditor(null);
15183  focusedEditor = null;
15184 }
15185 return focusedEditor;
15186};
15187ASPx.SetFocusedEditor = function(editor) {
15188 ASPx.focusedEditorName = editor ? editor.name : "";
15189};
15190ASPx.FindAssociatedLabelElements = function(editor) {
15191 var assocciatedLabels = [];
15192 var inputElement = editor.GetInputElement();
15193 if(!ASPx.IsExists(inputElement) || !inputElement.id) 
15194  return assocciatedLabels;
15195 var labels = ASPx.GetNodesByTagName(document, "LABEL");
15196 for(var i = 0; i < labels.length; i++) {
15197  if(!!labels[i].htmlFor && labels[i].htmlFor === inputElement.id)
15198   assocciatedLabels.push(labels[i]);
15199 }
15200 return assocciatedLabels;
15201};
15202var DisableAccessibilityExplanatoryTextManager = ASPx.CreateClass(null, {
15203 constructor: function(editor) {
15204  this.editor = editor;
15205 },
15206 GetAdditionalTextRowId: function() {
15207  return this.editor.name + EditElementSuffix.AccessibilityAdditionalTextRow;
15208 },
15209 GetErrorTextElement: function () {
15210  return !!this.editor.GetErrorTextCell() ? this.editor.GetErrorTextCell() : this.editor.GetErrorImage();
15211 },
15212 GetTextElement: function() { return null; },
15213 SetCaptionAssociating: function() { },
15214 UpdateText: function() { },
15215 UpdateValidationState: function(validationType) { },
15216 ToggleErrorAlert: function() { },
15217 SetOrRemoveText: function(accessibilityElements, textElement, setText, isLabel, isFirst) { }
15218});
15219var EditAccessibilityExplanatoryTextManager = ASPx.CreateClass(DisableAccessibilityExplanatoryTextManager, {
15220 constructor: function(editor) {
15221  this.constructor.prototype.constructor.call(this, editor);
15222  this.invisibleRowCssClassName = "dxAIR";
15223 },
15224 GetTextElement: function() {
15225  var mainElement = this.editor.GetMainElement();
15226  if(!mainElement) return null;
15227  var explanatoryText = "";
15228  var explanatoryTextElement = null;
15229  if(!!this.editor.nullText)
15230   explanatoryText = this.editor.nullText;
15231  else if(!!this.editor.helpTextObj)
15232   explanatoryTextElement = this.editor.helpTextObj.helpTextElement;
15233  else if(!!mainElement.title)
15234   explanatoryText = mainElement.title;
15235  if(explanatoryText && mainElement.tagName == "TABLE") {
15236   var assistantElement = this.editor.GetAccessibilityFirstActiveElement();
15237   if(assistantElement)
15238    ASPx.Attr.Aria.AppendLabel(assistantElement, explanatoryText, true);
15239  }
15240  return explanatoryTextElement;
15241 },
15242 SetCaptionAssociating: function() {
15243  var captionCell = this.editor.GetCaptionCell();
15244  if(!captionCell || captionCell.childNodes[0].tagName == "LABEL") return;
15245  var labelElement = captionCell.childNodes[0];
15246  ASPx.EditAccessibilityExplanatoryTextManager.SetLabelAssociating(this.editor, this.editor.GetAccessibilityFirstActiveElement(), labelElement);
15247 },
15248 UpdateText: function() {
15249  var additionalTextElement = this.GetTextElement();
15250  if(ASPx.IsExists(additionalTextElement)) {
15251   var pronounceElement = this.editor.GetAccessibilityFirstActiveElement();
15252   var hasAnyLabel = !!ASPx.Attr.GetAttribute(pronounceElement, "aria-label") || 
15253    !!ASPx.Attr.GetAttribute(pronounceElement, "aria-labelledby") ||
15254    ASPx.FindAssociatedLabelElements(this.editor).length > 0;
15255   this.SetOrRemoveText([pronounceElement], additionalTextElement, true, !hasAnyLabel, false);
15256  }
15257 },
15258 UpdateValidationState: function(validationType) {
15259  if(validationType == ValidationType.PersonalOnValueChanged && this.editor.accessibilityHelper) return;
15260  var accessibilityElements = this.editor.GetAccessibilityActiveElements();
15261  var errorTextElement = this.GetErrorTextElement();
15262  this.SetOrRemoveText(accessibilityElements, errorTextElement, !this.editor.isValid, false, true);
15263  if(accessibilityElements.length > 0 && !!errorTextElement) {
15264   for(var i = 0; i < accessibilityElements.length; i++) {
15265    if(!ASPx.IsExists(accessibilityElements[i])) continue;
15266    ASPx.Attr.SetOrRemoveAttribute(accessibilityElements[i], "aria-invalid", !this.editor.isValid);
15267   }
15268  }
15269 },
15270 ToggleErrorAlert: function() {
15271  var errorTextElement = this.GetErrorTextElement();
15272  ASPx.SetElementDisplay(errorTextElement, false);
15273  ASPx.Attr.SetAttribute(errorTextElement, 'role', 'alert');
15274  ASPx.SetElementDisplay(errorTextElement, true);
15275  setTimeout(function() { ASPx.Attr.RemoveAttribute(errorTextElement, 'role'); }, 500);
15276 },
15277 SetOrRemoveText: function(accessibilityElements, textElement, setText, isLabel, isFirst) {
15278  var idsRefAttribute = isLabel ? ASPx.Attr.Aria.labelled : ASPx.Attr.Aria.described;
15279  if(!textElement) return;
15280  var textId = !!textElement.id ? textElement.id : textElement.parentNode.id;
15281  for(var i = 0; i < accessibilityElements.length; i++) {
15282   if(!accessibilityElements[i]) continue;
15283   var descRefString = ASPx.Attr.GetAttribute(accessibilityElements[i], idsRefAttribute);
15284   var descRefIds = !!descRefString ? descRefString.split(" ") : [ ];
15285   var descIndex = descRefIds.indexOf(textId);
15286   if(setText && descIndex == -1) {
15287    if(isFirst)
15288     descRefIds.unshift(textId);
15289    else
15290     descRefIds.push(textId);
15291   }
15292   else if(!setText && descIndex > -1)
15293    descRefIds.splice(descIndex, 1);
15294   ASPx.Attr.SetOrRemoveAttribute(accessibilityElements[i], idsRefAttribute, descRefIds.join(" "));
15295  }
15296 }
15297});
15298ASPx.DisableAccessibilityExplanatoryTextManager = DisableAccessibilityExplanatoryTextManager;
15299ASPx.EditAccessibilityExplanatoryTextManager = EditAccessibilityExplanatoryTextManager;
15300ASPx.EditAccessibilityExplanatoryTextManager.SetLabelAssociating = function(editor, activeElement, labelElement) {
15301 var clickHandler = function(evt) {
15302  if(editor && editor.OnAssociatedLabelClick)
15303   editor.OnAssociatedLabelClick(evt);
15304  else
15305   activeElement.click();
15306 };
15307 ASPx.Evt.AttachEventToElement(labelElement, "click", clickHandler);
15308 if(!!editor) {
15309  var hasAriaLabel = !!ASPx.Attr.GetAttribute(activeElement, "aria-label");
15310  editor.ariaExplanatoryTextManager.SetOrRemoveText([activeElement], labelElement, true, !hasAriaLabel, true);
15311 }
15312};
15313ASPxClientEdit.ClearEditorsInContainer = function(container, validationGroup, clearInvisibleEditors) {
15314 invalidEditorToBeFocused = null;
15315 ASPx.ProcessEditorsInContainer(container, ASPx.ClearProcessingProc, ASPx.ClearChoiceCondition, validationGroup, clearInvisibleEditors, true );
15316 ASPxClientEdit.ClearExternalControlsInContainer(container, validationGroup, clearInvisibleEditors, true );
15317};
15318ASPxClientEdit.ClearEditorsInContainerById = function(containerId, validationGroup, clearInvisibleEditors) {
15319 var container = document.getElementById(containerId);
15320 this.ClearEditorsInContainer(container, validationGroup, clearInvisibleEditors);
15321};
15322ASPxClientEdit.ClearGroup = function(validationGroup, clearInvisibleEditors) {
15323 return this.ClearEditorsInContainer(null, validationGroup, clearInvisibleEditors);
15324};
15325ASPxClientEdit.ValidateEditorsInContainer = function(container, validationGroup, validateInvisibleEditors) {
15326 var summaryCollection;
15327 if(ASPx.Ident.scripts.ASPxClientValidationSummary) {
15328  summaryCollection = ASPx.GetClientValidationSummaryCollection();
15329  summaryCollection.AllowNewErrorsAccepting(validationGroup);
15330 }
15331 var validationResult = ASPx.ProcessEditorsInContainer(container, ASPx.ValidateProcessingProc, _aspxValidateChoiceCondition, validationGroup, validateInvisibleEditors,
15332  false );
15333 validationResult.isValid = ASPxClientEdit.ValidateExternalControlsInContainer(container, validationGroup, validateInvisibleEditors,
15334  false ) && validationResult.isValid;
15335 if(typeof(validateInvisibleEditors) == "undefined")
15336  validateInvisibleEditors = false;
15337 if(typeof(validationGroup) == "undefined")
15338  validationGroup = null;    
15339 validationResult.isValid = ASPx.GetControlCollection().RaiseValidationCompleted(container, validationGroup,
15340 validateInvisibleEditors, validationResult.isValid, validationResult.firstInvalid, validationResult.firstVisibleInvalid);
15341 if(summaryCollection)
15342  summaryCollection.ForbidNewErrorsAccepting(validationGroup);
15343 if(!validationResult.isValid && !!validationResult.firstVisibleInvalid && validationResult.firstVisibleInvalid.accessibilityCompliant && !validationResult.firstVisibleInvalid.setFocusOnError) {
15344  var accessInvalidControl = validationResult.firstVisibleInvalid;
15345  if(!summaryCollection && !accessInvalidControl.focused) {
15346   var beforeDelayActiveElement = ASPx.GetActiveElement();
15347   setTimeout(function() {
15348    var currentActiveElement = ASPx.GetActiveElement();
15349    if(accessInvalidControl.focused || (currentActiveElement != beforeDelayActiveElement && ASPx.Attr.IsExistsAttribute(currentActiveElement, 'role')))
15350     return;
15351    accessInvalidControl.ariaExplanatoryTextManager.ToggleErrorAlert();
15352   }, 500);    
15353  }
15354 }
15355 return validationResult.isValid;
15356};
15357ASPxClientEdit.ValidateEditorsInContainerById = function(containerId, validationGroup, validateInvisibleEditors) {
15358 var container = document.getElementById(containerId);
15359 return this.ValidateEditorsInContainer(container, validationGroup, validateInvisibleEditors);
15360};
15361ASPxClientEdit.ValidateGroup = function(validationGroup, validateInvisibleEditors) {
15362 return this.ValidateEditorsInContainer(null, validationGroup, validateInvisibleEditors);
15363};
15364ASPxClientEdit.AreEditorsValid = function(containerOrContainerId, validationGroup, checkInvisibleEditors) {
15365 var container = typeof(containerOrContainerId) == "string" ? document.getElementById(containerOrContainerId) : containerOrContainerId;
15366 var checkResult = ASPx.ProcessEditorsInContainer(container, ASPx.EditorsValidProcessingProc, _aspxEditorsValidChoiceCondition, validationGroup,
15367  checkInvisibleEditors, false );
15368 checkResult.isValid = ASPxClientEdit.AreExternalControlsValidInContainer(containerOrContainerId, validationGroup,
15369  checkInvisibleEditors, false ) && checkResult.isValid;
15370 return checkResult.isValid;
15371};
15372ASPxClientEdit.AreExternalControlsValidInContainer = function(containerId, validationGroup, validateInvisibleEditors, processDisabledEditors) {
15373 if(ASPx.Ident.scripts.ASPxClientHtmlEditor)
15374  return ASPxClientHtmlEditor.AreEditorsValidInContainer(containerId, validationGroup, validateInvisibleEditors, processDisabledEditors);
15375 return true;
15376};
15377ASPxClientEdit.ClearExternalControlsInContainer = function(containerId, validationGroup, validateInvisibleEditors, processDisabledEditors) {
15378 if(ASPx.Ident.scripts.ASPxClientHtmlEditor)
15379  return ASPxClientHtmlEditor.ClearEditorsInContainer(containerId, validationGroup, validateInvisibleEditors, processDisabledEditors);
15380 return true;
15381};
15382ASPxClientEdit.ValidateExternalControlsInContainer = function(containerId, validationGroup, validateInvisibleEditors, processDisabledEditors) {
15383 if(ASPx.Ident.scripts.ASPxClientHtmlEditor)
15384  return ASPxClientHtmlEditor.ValidateEditorsInContainer(containerId, validationGroup, validateInvisibleEditors, processDisabledEditors);
15385 return true;
15386};
15387ASPxClientEdit.AttachEditorModificationListener = function(handler, predicate) {
15388 var processAction = function(event) { event.AddHandler(handler); };
15389 ASPxClientEdit.ProcessEditorModificationListener(handler, processAction, predicate);
15390};
15391ASPxClientEdit.DetachEditorModificationListener = function(handler, predicate) {
15392 var processAction = function(event) { event.RemoveHandler(handler); };
15393 ASPxClientEdit.ProcessEditorModificationListener(handler, processAction, predicate);
15394};
15395ASPxClientEdit.ProcessEditorModificationListener = function(handler, action, predicate) {
15396 ASPx.GetControlCollection().ForEachControl(function(control) {
15397  if(control.GetModifyEvent && predicate(control)) {
15398   if(control.isNative)
15399    control.EnsureRequiredNativeAttributesExists();
15400   action(control.GetModifyEvent());
15401  }
15402 });
15403};
15404var ASPxClientEditKeyEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
15405 constructor: function(htmlEvent) {
15406  this.constructor.prototype.constructor.call(this);
15407  this.htmlEvent = htmlEvent;
15408 }
15409});
15410var ASPxClientEditValidationEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
15411 constructor: function(value, errorText, isValid) {
15412  this.constructor.prototype.constructor.call(this);
15413  this.errorText = errorText;
15414  this.isValid = isValid;
15415  this.value = value;
15416 }
15417});
15418ASPx.ProcessEditorsInContainer = function(container, processingProc, choiceCondition, validationGroup, processInvisibleEditors, processDisabledEditors) {
15419 var allProcessedSuccessfull = true;
15420 var firstInvalid = null;
15421 var firstVisibleInvalid = null;
15422 var invalidEditorToBeFocused = null;
15423 ASPx.GetControlCollection().ForEachControl(function(control) {
15424  var canValidate = ASPx.CanValidateControl(control, container, processingProc, choiceCondition, validationGroup, processInvisibleEditors, processDisabledEditors);
15425  if(!canValidate) return;
15426  var isSuccess = processingProc(control);
15427  if(!isSuccess) {
15428   allProcessedSuccessfull = false;
15429   if(firstInvalid == null)
15430    firstInvalid = control;
15431   var isVisible = control.IsVisible();
15432   if(isVisible && firstVisibleInvalid == null)
15433    firstVisibleInvalid = control;
15434   if(control.setFocusOnError && invalidEditorToBeFocused == null && isVisible)
15435    invalidEditorToBeFocused = control;
15436  }
15437 }, this);
15438 if(invalidEditorToBeFocused != null)
15439  invalidEditorToBeFocused.SetFocus();
15440 return new ASPxValidationResult(allProcessedSuccessfull, firstInvalid, firstVisibleInvalid);
15441};
15442ASPx.CanValidateControl = function(control, container, processingProc, choiceCondition, validationGroup, processInvisibleEditors, processDisabledEditors) {
15443 var needToProcessRatingControl = window.ASPxClientRatingControl && (control instanceof ASPxClientRatingControl) && processingProc === ASPx.ClearProcessingProc;
15444 var mainElement = control.GetMainElement(); 
15445 if(!ASPx.Ident.IsASPxClientEdit(control) && !needToProcessRatingControl)
15446  return false;
15447 if(ASPx.Ident.isDialogInvisibleControl(control) || ASPx.Ident.isBatchEditUnusedEditor(control))
15448  return false; 
15449 if(!processDisabledEditors && !control.GetEnabled())
15450  return false;
15451 if(!mainElement || (container && !ASPx.GetIsParent(container, mainElement)))
15452  return false;
15453 if(!processInvisibleEditors && !control.IsVisible())
15454  return false;
15455 if(choiceCondition && !choiceCondition(control, validationGroup))
15456  return false;
15457 return true;
15458};
15459var ASPxValidationResult = ASPx.CreateClass(null, {
15460 constructor: function(isValid, firstInvalid, firstVisibleInvalid) {
15461  this.isValid = isValid;
15462  this.firstInvalid = firstInvalid;
15463  this.firstVisibleInvalid = firstVisibleInvalid;
15464 }
15465});
15466ASPx.ClearChoiceCondition = function(edit, validationGroup) {
15467 return !ASPx.IsExists(validationGroup) || (edit.validationGroup == validationGroup);
15468};
15469function _aspxValidateChoiceCondition(edit, validationGroup) {
15470 return ASPx.ClearChoiceCondition(edit, validationGroup) && edit.customValidationEnabled;
15471}
15472function _aspxEditorsValidChoiceCondition(edit, validationGroup) {
15473 return _aspxValidateChoiceCondition(edit, validationGroup);
15474}
15475function wrapLostFocusHandler(handler) {
15476 if(ASPx.Browser.Edge) {
15477  return function(name) {
15478   var edit = ASPx.GetControlCollection().Get(name);
15479   if(edit && !ASPx.IsElementVisible(edit.GetMainElement()))
15480    setTimeout(handler, 0, name);
15481   else
15482    handler(name);
15483  };
15484 }
15485 return handler;
15486}
15487ASPx.EGotFocus = function(name) {
15488 var edit = ASPx.GetControlCollection().Get(name); 
15489 if(!edit) return;
15490 if(!edit.isInitialized){
15491  var inputElement = edit.GetFocusableInputElement();
15492  if(inputElement && inputElement === document.activeElement) {
15493   if(ASPx.Browser.Firefox)
15494    window.setTimeout(function() { document.activeElement.blur(); }, 0);
15495   else
15496    document.activeElement.blur();
15497  }
15498  return;
15499 }
15500 if(ASPx.Browser.VirtualKeyboardSupported && !edit.ownerListBox)
15501  ASPx.VirtualKeyboardUI.onCallingVirtualKeyboard(edit, false);
15502 else
15503  edit.OnFocus();
15504};
15505ASPx.ELostFocusCore = function(name) {
15506 var edit = ASPx.GetControlCollection().Get(name);
15507 if(ASPx.Browser.VirtualKeyboardSupported && (!edit || !edit.ownerListBox)) {
15508  var supressLostFocus = ASPx.VirtualKeyboardUI.isInputNativeBluring();
15509  if(supressLostFocus)
15510   return;
15511  ASPx.VirtualKeyboardUI.resetFocusedEditor();
15512 }
15513 if(edit != null)
15514  edit.OnLostFocus();
15515};
15516ASPx.ELostFocus = wrapLostFocusHandler(ASPx.ELostFocusCore);
15517ASPx.ESGotFocus = function(name) {
15518 var edit = ASPx.GetControlCollection().Get(name); 
15519 if(!edit) return;
15520   if(ASPx.Browser.VirtualKeyboardSupported && !edit.ownerListBox) {
15521  ASPx.VirtualKeyboardUI.onCallingVirtualKeyboard(edit, true);
15522 } else {
15523  edit.OnSpecialFocus();
15524 }
15525};
15526ASPx.ESLostFocusCore = function(name) {
15527 var edit = ASPx.GetControlCollection().Get(name);
15528 if(ASPx.Browser.VirtualKeyboardSupported && (!edit || !edit.ownerListBox)) {
15529  var supressLostFocus = ASPx.VirtualKeyboardUI.isInputNativeBluring();
15530  if(supressLostFocus)
15531   return;
15532  ASPx.VirtualKeyboardUI.resetFocusedEditor();
15533 }
15534 if(!edit) return;
15535 if(edit.UseDelayedSpecialFocus())
15536  edit.specialFocusTimer = window.setTimeout(function() { edit.OnSpecialLostFocus(); }, 30);
15537 else
15538  edit.OnSpecialLostFocus();
15539};
15540ASPx.ESLostFocus = wrapLostFocusHandler(ASPx.ESLostFocusCore);
15541ASPx.EValueChanged = function(name) {
15542 var edit = ASPx.GetControlCollection().Get(name);
15543 if(edit != null)
15544  edit.OnValueChanged();
15545};
15546ASPx.VirtualKeyboardUI = (function() {
15547 var focusedEditor = null;
15548 var inputNativeFocusLocked = false;
15549 function elementBelongsToEditor(element) {
15550  if(!element) return false;
15551  var isBelongsToEditor = false;
15552  ASPx.GetControlCollection().ForEachControl(function(control) {
15553   if(ASPx.Ident.IsASPxClientEdit(control) && control.IsEditorElement(element)) {
15554    isBelongsToEditor = true;
15555    return true;
15556   }
15557  }, this);
15558  return isBelongsToEditor;
15559 }
15560 function elementBelongsToFocusedEditor(element) {
15561  return focusedEditor && focusedEditor.IsEditorElement(element);
15562 }
15563 return {
15564  onTouchStart: function (evt) {
15565   if (!ASPx.Browser.VirtualKeyboardSupported || this.isGooglePlaceAutocompleteElementTap(evt)) return;
15566   inputNativeFocusLocked = false;
15567   if(focusedEditor)
15568    focusedEditor.onVirtualKeyboardUITouchStart(evt);
15569   if(ASPx.TouchUIHelper.pointerEnabled) {
15570    if(evt.pointerType !== ASPx.TouchUIHelper.pointerType.Touch ||
15571       ASPx.Browser.AndroidMobilePlatform) 
15572     return;
15573    this.processFocusEditorControl(evt);
15574   } else
15575    ASPx.TouchUIHelper.handleFastTapIfRequired(evt,  function(){ this.processFocusEditorControl(evt); }.aspxBind(this), false);
15576  },
15577  processFocusEditorControl: function(evt) {
15578   var evtSource = ASPx.Evt.GetEventSource(evt);
15579   var timeEditHasAppliedFocus = focusedEditor && (ASPx.Ident.IsASPxClientTimeEdit && ASPx.Ident.IsASPxClientTimeEdit(focusedEditor));
15580   var focusedTimeEditBelongsToDateEdit = timeEditHasAppliedFocus && focusedEditor.OwnerDateEdit && focusedEditor.OwnerDateEdit.GetShowTimeSection();
15581   if(focusedTimeEditBelongsToDateEdit) {
15582    focusedEditor.OwnerDateEdit.ForceRefocusTimeSectionTimeEdit(evtSource);
15583    return;
15584   }
15585   var elementWithNativeFocus = ASPx.GetActiveElement();
15586   var someEditorInputIsFocused = elementBelongsToEditor(elementWithNativeFocus);
15587   var touchKeyboardIsVisible = someEditorInputIsFocused;
15588   var tapOutsideEditorAndInputs = !elementBelongsToEditor(evtSource) && !ASPx.Ident.IsFocusableElementRegardlessTabIndex(evtSource);
15589   var blurToHideTouchKeyboard = touchKeyboardIsVisible && tapOutsideEditorAndInputs;
15590   if(blurToHideTouchKeyboard) {
15591    elementWithNativeFocus.blur();
15592    return;
15593   }
15594   var tapOutsideFocusedEditor = focusedEditor && !elementBelongsToFocusedEditor(evtSource);
15595   if(tapOutsideFocusedEditor) {
15596    var focusedEditorWithBluredInput = !elementBelongsToFocusedEditor(elementWithNativeFocus);
15597    if(focusedEditorWithBluredInput) 
15598     this.lostAppliedFocusOfEditor();
15599   }
15600  },
15601  smartFocusEditor: function(edit) {
15602   if(!edit.focused) {
15603    this.setInputNativeFocusLocked(true);
15604    this.setFocusEditorCore(edit);
15605   } else {
15606    edit.ForceRefocusEditor();
15607   }
15608  },
15609  setFocusEditorCore: function(edit) {
15610   if(ASPx.Browser.MacOSMobilePlatform) {
15611    var timeoutDuration = ASPx.Browser.Chrome ? 250 : 30;
15612    window.setTimeout(function(){ edit.SetFocus(); }, timeoutDuration);
15613   } else {
15614    edit.SetFocus();
15615   }
15616  },
15617  onCallingVirtualKeyboard: function(edit, isSpecial) {
15618   this.setAppliedFocusOfEditor(edit, isSpecial);
15619   if(edit.specialKeyboardHandlingUsed == isSpecial && inputNativeFocusLocked)
15620    edit.BlurInputElement();
15621  },
15622  isInputNativeBluring: function() {
15623   return focusedEditor && inputNativeFocusLocked;
15624  },
15625  setInputNativeFocusLocked: function(locked) {
15626   inputNativeFocusLocked = locked;
15627  },
15628  getInputNativeFocusLocked: function() {
15629   return inputNativeFocusLocked;
15630  },
15631  setAppliedFocusOfEditor: function(edit, isSpecial) {
15632   if(focusedEditor === edit) {
15633    if(edit.specialKeyboardHandlingUsed == isSpecial) {
15634     focusedEditor.UnlockFocusEvents();
15635     if(focusedEditor.EnsureClearButtonVisibility)
15636      focusedEditor.EnsureClearButtonVisibility();
15637    }
15638    return;
15639   }
15640   if(edit.specialKeyboardHandlingUsed == isSpecial) {
15641    this.lostAppliedFocusOfEditor();
15642    focusedEditor = edit;
15643    ASPx.SetFocusedEditor(edit);
15644   }
15645   if(isSpecial)
15646    edit.OnSpecialFocus();
15647   else
15648    edit.OnFocus();
15649  },
15650  lostAppliedFocusOfEditor: function() {
15651   if(!focusedEditor) return;
15652   var curEditorName = focusedEditor.name; 
15653   var skbdHandlingUsed = focusedEditor.specialKeyboardHandlingUsed;
15654   var focusedEditorInputElementExists = focusedEditor.GetInputElement();
15655   focusedEditor = null;
15656   if(!focusedEditorInputElementExists)
15657    return;
15658   ASPx.ELostFocusCore(curEditorName);
15659   if(skbdHandlingUsed)
15660    ASPx.ESLostFocusCore(curEditorName);
15661  },
15662  getFocusedEditor: function() {
15663   return focusedEditor;
15664  },
15665  resetFocusedEditor: function() {
15666   focusedEditor = null;
15667  },
15668  focusableInputElementIsActive: function(edit) {
15669   var inputElement = edit.GetFocusableInputElement();
15670   return !!inputElement ? ASPx.GetActiveElement() === inputElement : false;
15671  },
15672  isGooglePlaceAutocompleteElementTap: function(evt) {
15673   var googlePlaceAutocompleteContainer = ASPx.GetNodeByClassName(document.body, "pac-container", 0);
15674   if(!googlePlaceAutocompleteContainer)
15675    return false;
15676   return ASPx.GetParentByClassName(ASPx.Evt.GetEventSource(evt), "pac-container") != null;
15677  }
15678 };
15679})();
15680if(ASPx.Browser.VirtualKeyboardSupported) {
15681 var touchEventName = ASPx.TouchUIHelper.pointerEnabled ? ASPx.TouchUIHelper.pointerDownEventName : 'touchstart';
15682 ASPx.Evt.AttachEventToDocument(touchEventName, function(evt){ ASPx.VirtualKeyboardUI.onTouchStart(evt); });
15683}
15684ASPx.Evt.AttachEventToDocument("mousedown", function(evt) {
15685 var editor = ASPx.GetFocusedEditor();
15686 if(!editor) 
15687  return;
15688 var evtSource = ASPx.Evt.GetEventSource(evt);
15689 if(editor.IsClearButtonElement(evtSource))
15690  return;
15691 if(editor.OwnerDateEdit && editor.OwnerDateEdit.GetShowTimeSection()) {
15692  editor.OwnerDateEdit.ForceRefocusTimeSectionTimeEdit(evtSource);
15693  return;
15694 }
15695 if(editor.ownerListBox && editor.ownerListBox.IsEditorElement(evtSource) && !editor.IsEditorElement(evtSource)) {
15696  editor.ownerListBox.ForceRefocusEditor(evt);
15697  ASPx.SetFocusedEditor(editor.ownerListBox);
15698  return;
15699 }
15700 if(editor.IsEditorElement(evtSource) && !editor.IsElementBelongToInputElement(evtSource))
15701  editor.ForceRefocusEditor(evt);
15702});
15703ASPx.Evt.AttachEventToDocument(ASPx.Evt.GetMouseWheelEventName(), function(evt) {
15704 var editor = ASPx.GetFocusedEditor();
15705 if(editor != null && ASPx.IsExistsElement(editor.GetMainElement()) && editor.focused && editor.receiveGlobalMouseWheel)
15706  editor.OnMouseWheel(evt);
15707});
15708ASPx.KBSIKeyDown = function(name, evt){
15709 var control = ASPx.GetControlCollection().Get(name);
15710 if(control != null){
15711  var isProcessed = control.OnSpecialKeyDown(evt);
15712  if(isProcessed)
15713   return ASPx.Evt.PreventEventAndBubble(evt);
15714 }
15715};
15716ASPx.KBSIKeyPress = function(name, evt){
15717 var control = ASPx.GetControlCollection().Get(name);
15718 if(control != null){
15719  var isProcessed = control.OnSpecialKeyPress(evt);
15720  if(isProcessed)
15721   return ASPx.Evt.PreventEventAndBubble(evt);
15722 }
15723};
15724ASPx.KBSIKeyUp = function(name, evt){
15725 var control = ASPx.GetControlCollection().Get(name);
15726 if(control != null){
15727  var isProcessed = control.OnSpecialKeyUp(evt);
15728  if(isProcessed)
15729   return ASPx.Evt.PreventEventAndBubble(evt);
15730 }
15731};
15732ASPx.ClearProcessingProc = function(edit) {
15733 return edit.Clear();
15734};
15735ASPx.ValidateProcessingProc = function(edit) {
15736 edit.OnValidation(ValidationType.MassValidation);
15737 return edit.GetIsValid();
15738};
15739ASPx.EditorsValidProcessingProc = function(edit) {
15740 return edit.GetIsValid();
15741};
15742var CheckEditElementHelper = ASPx.CreateClass(ASPx.CheckableElementHelper, {
15743 AttachToMainElement: function(internalCheckBox) {
15744  ASPx.CheckableElementHelper.prototype.AttachToMainElement.call(this, internalCheckBox);
15745  this.AttachToLabelElement(this.GetLabelElement(internalCheckBox.container), internalCheckBox);
15746 },
15747 AttachToLabelElement: function(labelElement, internalCheckBox) {
15748  var _this = this;
15749  if(labelElement) {
15750   ASPx.Evt.AttachEventToElement(labelElement, "click", 
15751    function (evt) { 
15752     _this.InvokeClick(internalCheckBox, evt);
15753    }
15754   );
15755   ASPx.Evt.AttachEventToElement(labelElement, "mousedown",
15756    function (evt) {
15757     internalCheckBox.Refocus();
15758    }
15759   );
15760  }
15761 },
15762 GetLabelElement: function(container) {
15763  var labelElement = ASPx.GetNodeByTagName(container, "LABEL", 0);
15764  if(!labelElement) {
15765   var labelCell = ASPx.GetNodeByClassName(container, "dxichTextCellSys", 0);
15766   labelElement = ASPx.GetNodeByTagName(labelCell, "SPAN", 0);
15767  }
15768  return labelElement;
15769 }
15770});
15771CheckEditElementHelper.Instance = new CheckEditElementHelper();
15772var CalendarSharedParameters = ASPx.CreateClass(null, {
15773 updateCalendarCallbackCommand: "UPDATE",
15774 constructor: function() {
15775  this.minDate = null;
15776  this.maxDate = null;
15777  this.disabledDates = [];
15778  this.calendarCustomDraw = false;
15779  this.hasCustomDisabledDatesViaCallback = false;
15780  this.dateRangeMode = false;
15781  this.currentDateEdit = null;
15782  this.DaysSelectingOnMouseOver = new ASPxClientEvent();
15783  this.VisibleDaysMouseOut = new ASPxClientEvent();
15784  this.CalendarSelectionChangedInternal = new ASPxClientEvent();
15785 },
15786 Assign: function(source) {
15787  this.minDate = source.minDate ? source.minDate : null;
15788  this.maxDate = source.maxDate ? source.maxDate : null;
15789  this.calendarCustomDraw = source.calendarCustomDraw ? source.calendarCustomDraw : false;
15790  this.hasCustomDisabledDatesViaCallback = source.hasCustomDisabledDatesViaCallback ? source.hasCustomDisabledDatesViaCallback : false;
15791  this.disabledDates = source.disabledDates ? source.disabledDates : [];
15792  this.currentDateEdit = source.currentDateEdit ? source.currentDateEdit : null;
15793 },
15794 GetUpdateCallbackParameters: function() {
15795  var callbackArgs = this.GetCallbackArgs();
15796  callbackArgs = this.FormatCallbackArg(this.updateCalendarCallbackCommand, callbackArgs);
15797  return callbackArgs;
15798 },
15799 GetCallbackArgs: function() {
15800  var args = {};
15801  if(this.minDate)
15802   args.clientMinDate = ASPx.DateUtils.GetInvariantDateString(this.minDate);
15803  if(this.maxDate)
15804   args.clientMaxDate = ASPx.DateUtils.GetInvariantDateString(this.maxDate);
15805  if(args.clientMinDate || args.clientMaxDate) {
15806   var jsonArgs = JSON.stringify(args);
15807   return ASPx.Str.EncodeHtml(jsonArgs);
15808  }
15809  return null;
15810 },
15811 FormatCallbackArg: function(prefix, arg) {
15812  if(!arg) return prefix;
15813  return [prefix, '|', arg.length, ';', arg, ';'].join('');
15814 }
15815});
15816ASPx.CalendarSharedParameters = CalendarSharedParameters;
15817ASPx.ValidationType = ValidationType;
15818ASPx.ErrorFrameDisplay = ErrorFrameDisplay;
15819ASPx.EditElementSuffix = EditElementSuffix;
15820ASPx.ValidationPattern = ValidationPattern;
15821ASPx.RequiredFieldValidationPattern = RequiredFieldValidationPattern;
15822ASPx.RegularExpressionValidationPattern = RegularExpressionValidationPattern;
15823ASPx.CheckEditElementHelper = CheckEditElementHelper;
15824ASPx.IsEditorFocusable = _aspxIsEditorFocusable;
15825window.ASPxClientEditBase = ASPxClientEditBase;
15826window.ASPxClientEdit = ASPxClientEdit;
15827window.ASPxClientEditKeyEventArgs = ASPxClientEditKeyEventArgs;
15828window.ASPxClientEditValidationEventArgs = ASPxClientEditValidationEventArgs;
15829})();
15830
15831(function() {
15832ASPx.TEInputSuffix = "_I";
15833ASPx.PasteCheckInterval = 50;
15834ASPx.CheckUserInputInterval = 10;
15835ASPx.TEHelpTextElementSuffix = "_HTE";
15836ASPx.TempHiddenInputSuffix = "_THI";
15837var passwordInputClonedSuffix = "_CLND";
15838var CHROME_AUTOFILL_SELECTOR = ":-webkit-autofill";
15839var BrowserHelper = {
15840 SAFARI_SYSTEM_CLASS_NAME: "dxeSafariSys",
15841 MOBILE_SAFARI_SYSTEM_CLASS_NAME: "dxeIPadSys",
15842 GetBrowserSpecificSystemClassName: function() {
15843  if(ASPx.Browser.Safari)
15844   return ASPx.Browser.MacOSMobilePlatform ? this.MOBILE_SAFARI_SYSTEM_CLASS_NAME : this.SAFARI_SYSTEM_CLASS_NAME;
15845  return "";
15846 }
15847};
15848var focusedNullTextClassName = "dxeFNTextSys";
15849var NullTextDisplayMode = {
15850 Unfocused: "Unfocused",
15851 UnfocusedAndFocused: "UnfocusedAndFocused"
15852};
15853ASPx.NullTextDisplayMode = NullTextDisplayMode;
15854var ASPxClientTextEdit = ASPx.CreateClass(ASPxClientEdit, {
15855 constructor: function(name) {
15856  this.constructor.prototype.constructor.call(this, name);      
15857  this.isASPxClientTextEdit = true;
15858  this.nullText = "";
15859  this.nullTextDisplayMode = NullTextDisplayMode.Unfocused;
15860  this.nullTextOnFocusCssText = "";
15861  this.focusedNullTextTimerID = -1;
15862  this.escCount = 0;
15863  this.raiseValueChangedOnEnter = true;
15864  this.autoResizeWithContainer = false;
15865  this.lastChangedValue = null;
15866  this.autoCompleteAttribute = null;
15867  this.isTextSelectionOnClickEnabled = false;
15868  this.trySelectInputTextOnClick = true;
15869  this.passwordNullTextIntervalID = -1;
15870  this.nullTextInputElement = null;
15871  this.helpText = "";
15872  this.helpTextObj = null;  
15873  this.helpTextStyle = [];
15874  this.externalTableStyle = [];
15875  this.helpTextPosition = ASPx.Position.Right;
15876  this.helpTextMargins = null;
15877  this.helpTextHAlign = ASPxClientTextEditHelpTextHAlign.Left;
15878  this.helpTextVAlign = ASPxClientTextEditHelpTextVAlign.Top;
15879  this.enableHelpTextPopupAnimation = true;
15880  this.helpTextDisplayMode = ASPxClientTextEditHelpTextDisplayMode.Inline;
15881  this.maskInfo = null;  
15882  this.maskValueBeforeUserInput = "";
15883  this.maskPasteTimerID = -1;
15884  this.maskPasteLock = false;    
15885  this.maskPasteCounter = 0;
15886  this.maskTextBeforePaste = "";    
15887  this.maskHintHtml = "";
15888  this.maskHintTimerID = -1;
15889  this.errorCellPosition = ASPx.Position.Right;
15890  this.inlineInitializeInputValue = null;
15891  this.initializeInputValue = null;
15892  this.displayFormat = null;
15893  this.TextChanged = new ASPxClientEvent();
15894  this.UserInput = new ASPxClientEvent();
15895  this.userInputEventTimerID = -1;
15896 },
15897 AddDefaultReadOnlyStateControllerItem: function(cssClass, mainElementId) {
15898  ASPx.AddReadOnlyItems(mainElementId, [[[cssClass], [''], ['', 'I']]]);
15899 },
15900 AddDefaultDisabledStateControllerItem: function(cssClass, mainElementId) {
15901  ASPx.AddDisabledItems(mainElementId, [[[cssClass], [''], ['', 'I']]]);
15902 },
15903 SetData: function(data){
15904  ASPxClientEdit.prototype.SetData.call(this, data);
15905  if(data.maskInfo) {
15906   var maskProperties = data.maskInfo.properties;
15907   var useInvariantCultureDecimalSymbol = maskProperties && maskProperties.useInvariantCultureDecimalSymbol || false;
15908   this.maskInfo = ASPx.MaskInfo.Create(data.maskInfo.maskText, data.maskInfo.dateTimeOnly, data.maskInfo.allowEscapingInEnums, useInvariantCultureDecimalSymbol);
15909   this.SetProperties(data.maskInfo.properties, this.maskInfo);
15910  }
15911 },
15912 InlineInitialize: function() {
15913  this.SaveInputValue(true);
15914  ASPxClientEdit.prototype.InlineInitialize.call(this);
15915  if(this.maskInfo != null)
15916   this.InitMask();
15917  this.ApplyBrowserSpecificClassName();
15918  this.helpTextInitialize();
15919  if(ASPx.Browser.IE && ASPx.Browser.Version >= 10 && this.nullText != "")
15920   this.addIEXButtonEventHandler();
15921 },
15922 Initialize: function(){
15923  this.SaveInputValue(false);
15924  this.SaveChangedValue();
15925  ASPxClientEdit.prototype.Initialize.call(this);
15926  this.CorrectInputMaxLength();
15927  this.SubscribeToIeDropEvent();
15928  if(ASPx.Browser.WebKitFamily)  
15929   this.CorrectMainElementWhiteSpaceStyle();
15930  this.InitializeTextDecoration();
15931  this.InitializeAutocompleteAttribute();
15932  if(this.IsValueRestoredByBrowser())
15933   this.SynchronizeRestoredValue();
15934 },
15935 InitializeEvents: function() {
15936  ASPxClientEdit.prototype.InitializeEvents.call(this);
15937  ASPx.Evt.AttachEventToElement(this.GetInputElement(), "keydown", this.OnKeyDown.aspxBind(this));
15938  ASPx.Evt.AttachEventToElement(this.GetInputElement(), "keyup", this.OnKeyUp.aspxBind(this));
15939  ASPx.Evt.AttachEventToElement(this.GetInputElement(), "keypress", this.OnKeyPress.aspxBind(this));
15940  if(this.isTextSelectionOnClickEnabled) {
15941   ASPx.Evt.AttachEventToElement(this.GetInputElement(), ASPx.TouchUIHelper.touchMouseDownEventName, this.OnMouseDown.aspxBind(this));
15942   ASPx.Evt.AttachEventToElement(this.GetInputElement(), "click", this.OnClick.aspxBind(this));
15943  }
15944  this.Unload.AddHandler(this.OnUnload.aspxBind(this));
15945 },
15946 InitializeTextDecoration: function() {
15947  var input = this.GetInputElement();
15948  if(input.type === "password" && !this.IsInputPasswordFilledAutomaticallyByChrome())
15949   this.ToggleTextDecoration();
15950 },
15951 IsInputPasswordFilledAutomaticallyByChrome: function() {
15952  if(!ASPx.Browser.Chrome)
15953   return false;
15954  var input = this.GetInputElement();
15955  return ASPx.ElementMatchesSelector(input, CHROME_AUTOFILL_SELECTOR);
15956 },
15957 OnMouseDown: function() {
15958  this.trySelectInputTextOnClick = ASPx.GetActiveElement() !== this.GetInputElement() && !this.IsFocusEventsLocked();
15959 },
15960 OnClick: function() {
15961  if(this.trySelectInputTextOnClick) {
15962   var input = this.GetInputElement();
15963   setTimeout(function() {
15964    var inputSelection = ASPx.Selection.GetInfo(input);
15965    if (inputSelection.startPos === inputSelection.endPos)
15966     ASPx.Selection.Set(input);
15967   }, 0);
15968  }
15969 },
15970 InitializeAutocompleteAttribute: function() {
15971  var input = this.GetInputElement();
15972  if(this.IsVCardAttributeRequired())
15973   ASPx.Attr.SetAttribute(input, this.autoCompleteAttribute.name, this.autoCompleteAttribute.value);
15974  else if(this.IsAutocompleteOffRequiredOnInitialize())
15975   ASPx.Attr.SetAttribute(input, "autocomplete", "off");
15976 },
15977 SaveInputValue: function(isInlineInitialize) {
15978  var input = this.GetInputElement();
15979  if(!input)
15980   return;
15981  var inputValue = input.value;
15982  if(inputValue === null)
15983   inputValue = "";
15984  if(isInlineInitialize)
15985   this.inlineInitializeInputValue = inputValue;
15986  else
15987   this.initializeInputValue = inputValue;
15988 },
15989 IsValueRestoredByBrowser: function() {
15990  if(this.displayFormat || this.isNative || this.inlineInitializeInputValue === null || this.initializeInputValue === null)
15991   return false;
15992  if(ASPx.Browser.Chrome)
15993   return this.IsValueRestoredByChrome();
15994  else if(ASPx.Browser.Firefox)
15995   return this.IsValueRestoredByFirefox();
15996  else if(ASPx.Browser.IE)
15997   return this.IsValueRestoredByIE();
15998  else
15999   return this.IsValueRestoredByBrowserCore();
16000 },
16001 IsValueRestoredByBrowserCore: function() {
16002  return this.IsValueChangedBeforeInitialize() || this.IsClientValueNotExists() || this.IsValueChangedOnMaskInitialize();
16003 },
16004 IsValueRestoredByChrome: function() {
16005  return this.IsValueRestoredByBrowserCore();
16006 },
16007 IsValueRestoredByFirefox: function() {
16008  return this.IsValueRestoredByBrowserCore();
16009 },
16010 IsValueRestoredByIE: function() {
16011  return this.IsValueRestoredByBrowserCore();
16012 },
16013 IsValueChangedBeforeInitialize: function() {
16014  return this.inlineInitializeInputValue !== this.initializeInputValue;
16015 },
16016 IsClientValueNotExists: function() {
16017  return this.inlineInitializeInputValue !== "" &&
16018      this.inlineInitializeInputValue !== this.nullText &&
16019      this.inlineInitializeInputValue !== this.GetValue() &&
16020      this.inlineInitializeInputValue !== this.GetText();
16021 },
16022 IsValueChangedOnMaskInitialize: function() {
16023  return this.maskInfo && this.inlineInitializeInputValue !== this.GetInputElement().value;
16024 },
16025 SynchronizeRestoredValue: function() {
16026  this.SetText(this.initializeInputValue);
16027 },
16028 AdjustControl: function() {
16029  ASPxClientEdit.prototype.AdjustControl.call(this);
16030  if(ASPx.Browser.IE && ASPx.Browser.Version > 8 && !this.isNative)
16031   this.correctInputElementHeight();
16032  this.ensureAdjustFocusedNullTextElement();
16033 },
16034 correctInputElementHeight: function() {
16035  var mainElement = this.GetMainElement();
16036  if(mainElement) {
16037   var mainElementHeight = mainElement.style.height;
16038   var mainElementHeightSpecified = mainElementHeight && mainElementHeight.indexOf('px') !== -1; 
16039   if(mainElementHeightSpecified) {
16040    var inputElement = this.GetInputElement();
16041    var inputElementHeight = this.getInputElementHeight();
16042    inputElement.style.height = inputElementHeight + "px";
16043    if(!ASPx.Ident.IsASPxClientMemo(this))
16044     inputElement.style.lineHeight = inputElementHeight + "px";
16045   }
16046  }
16047 },
16048 getInputElementHeight: function() {
16049  var mainElement = this.GetMainElement(),
16050   inputElement = this.GetInputElement();
16051  var inputElementHeight = ASPx.PxToInt(mainElement.style.height) - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(mainElement);
16052  var inputElementContainer = inputElement.parentNode,
16053   inputContainerStyle = ASPx.GetCurrentStyle(inputElementContainer);
16054  inputElementHeight -= ASPx.GetTopBottomBordersAndPaddingsSummaryValue(inputElementContainer, inputContainerStyle) 
16055   + ASPx.GetTopBottomMargins(inputElementContainer, inputContainerStyle);
16056  var mainElementCellspacing = ASPx.GetCellSpacing(mainElement);
16057  if(mainElementCellspacing)
16058   inputElementHeight -= mainElementCellspacing * 2;
16059  var inputStyle = ASPx.GetCurrentStyle(inputElement);
16060  inputElementHeight -= ASPx.GetTopBottomBordersAndPaddingsSummaryValue(inputElement, inputStyle) 
16061   + ASPx.GetTopBottomMargins(inputElement, inputStyle);
16062  return inputElementHeight;
16063 },
16064 getInputCell: function() {
16065  var inputElement = this.GetInputElement();
16066  if(inputElement)
16067   return inputElement.parentNode;
16068 },
16069 addIEXButtonEventHandler: function() {
16070  var inputElement = this.GetInputElement();
16071  if(ASPx.IsExists(inputElement)) {
16072   this.isDeleteOrBackspaceKeyClick = false;
16073   ASPx.Evt.AttachEventToElement(inputElement, "input", function (evt) {
16074    if(this.isDeleteOrBackspaceKeyClick) {
16075     this.isDeleteOrBackspaceKeyClick = false;
16076     return;
16077    }
16078    if(inputElement.value === '') {
16079     this.SyncRawValue();
16080    }
16081   }.aspxBind(this));
16082   ASPx.Evt.AttachEventToElement(inputElement, "keydown", function (evt) {
16083    this.isDeleteOrBackspaceKeyClick = (evt.keyCode == ASPx.Key.Delete || evt.keyCode == ASPx.Key.Backspace);
16084   }.aspxBind(this));
16085  }   
16086 },
16087 ensureOutOfRangeWarningManager: function (minValue, maxValue, defaultMinValue, defaultMaxValue, valueFormatter) {
16088  if (!this.outOfRangeWarningManager)
16089   this.outOfRangeWarningManager = new ASPxOutOfRangeWarningManager(this, minValue, maxValue, defaultMinValue, defaultMaxValue,
16090    this.showOutOfRangeWarningElementAtBottom() ? ASPx.Position.Bottom : ASPx.Position.Right, valueFormatter);
16091 },
16092 showOutOfRangeWarningElementAtBottom: function() {
16093  return this.hasRightPopupHelpText();
16094 },
16095 GetOutOfRangeWarningElementPrevSibling: function() {
16096  return this.GetMainElement();
16097 },
16098 helpTextInitialize: function () {
16099  if(this.helpText) {
16100   this.helpTextObj = new ASPxClientTextEditHelpText(this, this.helpTextStyle, this.helpText, this.helpTextPosition,
16101    this.helpTextHAlign, this.helpTextVAlign, this.helpTextMargins, this.enableHelpTextPopupAnimation, this.helpTextDisplayMode);
16102  }
16103 },
16104 hasPopupHelpText: function() {
16105  return this.helpText && this.helpTextDisplayMode === ASPxClientTextEditHelpTextDisplayMode.Popup;
16106 },
16107 hasRightPopupHelpText: function() {
16108  return this.hasPopupHelpText() && this.helpTextPosition === ASPx.Position.Right;
16109 },
16110 showHelpText: function () {
16111  if(this.helpTextObj)
16112   this.helpTextObj.show();
16113 },
16114 hideHelpText: function () {
16115  if(this.helpTextObj)
16116   this.helpTextObj.hide();
16117 },
16118 ApplyBrowserSpecificClassName: function() {
16119  var mainElement = this.GetMainElement();
16120  if(ASPx.IsExistsElement(mainElement)) {
16121   var className = BrowserHelper.GetBrowserSpecificSystemClassName();
16122   if(className)
16123    mainElement.className += " " + className;
16124  }
16125 },
16126  CorrectMainElementWhiteSpaceStyle: function() {
16127  var inputElement = this.GetInputElement();
16128  if(inputElement && inputElement.parentNode) {
16129   if(this.IsElementHasWhiteSpaceStyle(inputElement.parentNode))
16130    inputElement.parentNode.style.whiteSpace = "normal";
16131  }
16132 },
16133 IsElementHasWhiteSpaceStyle: function(element) {
16134  var currentStyle = ASPx.GetCurrentStyle(element);
16135  return currentStyle.whiteSpace == "nowrap" || currentStyle.whiteSpace == "pre";  
16136 },
16137 FindInputElement: function(){
16138  return this.isNative ? this.GetMainElement() : ASPx.GetElementById(this.name + ASPx.TEInputSuffix);
16139 },
16140 DecodeRawInputValue: function(value) {
16141  return value;
16142 },
16143 GetRawValue: function(value){
16144  return ASPx.IsExists(this.stateObject) ? this.stateObject.rawValue : null;
16145 },
16146 SetRawValue: function(value){
16147  if(ASPx.IsExists(value))
16148   value = value.toString();
16149  this.UpdateStateObjectWithObject({ rawValue: value });
16150 },
16151 SyncRawValue: function() {
16152  if(this.maskInfo != null)
16153   this.SetRawValue(this.maskInfo.GetValue(true));
16154  else
16155   this.SetRawValue(this.GetInputElement().value);
16156 },
16157 HasTextDecorators: function() {
16158  return this.nullText != "" || this.displayFormat != null;
16159 },
16160 CanApplyTextDecorators: function(){
16161  return !this.focused;
16162 },
16163 CreateStyleDecoration: function () {
16164  return new ASPx.TextEditorStyleDecoration(this);
16165 },
16166 CanApplyNullTextDecoration: function() {
16167  var value = this.GetValue();
16168  return this.IsNull(value);
16169 },
16170 GetDecoratedText: function(value) {
16171  var result = value;
16172  if(this.IsNull(value) && this.nullText != "" && this.CanApplyNullTextDecoration())
16173   result = this.nullText;
16174  else if(this.displayFormat != null)
16175   result = this.GetDisplayFormatText(value);
16176  else if(this.maskInfo != null)
16177   result = this.maskInfo.GetText();
16178  else if(value == null)
16179   result = "";
16180  return result;
16181 },
16182 GetDisplayFormatText: function(value) {
16183  return ASPx.Formatter.Format(this.displayFormat, value);
16184 },
16185 ToggleTextDecoration: function() {
16186  if(this.HasTextDecorators()) {
16187   if(this.focused) {
16188    var input = this.GetInputElement();
16189    var oldValue = input.value;
16190    var sel = ASPx.Selection.GetExtInfo(input);
16191    this.ToggleTextDecorationCore();
16192    this.ensureActivateFocusedNullTextMechanism();
16193    if(oldValue != input.value || !ASPx.Selection.AreEqual(sel, ASPx.Selection.GetExtInfo(input))) {
16194     if(sel.startPos == 0 && sel.endPos == oldValue.length)
16195      sel.endPos = input.value.length;
16196     else
16197      sel.endPos = sel.startPos;
16198     if(!this.accessibilityCompliant || ASPx.GetActiveElement() == input)
16199      this.SetSelectionOnToggleTextDecoration(input, sel);
16200    }
16201   } else {
16202    this.ToggleTextDecorationCore();
16203    this.ensureDeactivateFocusedNullTextMechanism();
16204   }
16205  }
16206 },
16207 SetSelectionOnToggleTextDecoration: function(input, sel) {
16208  ASPx.Selection.Set(input, sel.startPos, sel.endPos);
16209 },
16210 ToggleTextDecorationCore: function() {
16211  if(this.maskInfo != null) {   
16212   this.ApplyMaskInfo(false);
16213  } else {
16214   var input = this.GetInputElement();
16215   var rawValue = this.GetRawValue();
16216   var value = this.CanApplyTextDecorators() ? this.GetDecoratedText(rawValue) : rawValue;
16217   if(input.value != value) {
16218    if(input.type == "password")
16219     this.TogglePasswordInputTextDecoration(value);
16220    else
16221     input.value = value;
16222   }
16223  }
16224 },
16225 GetPasswordNullTextInputElement: function() {
16226  if(!this.isPasswordNullTextInputElementExists())
16227   this.nullTextInputElement = this.createPasswordNullTextInputElement();
16228  return this.nullTextInputElement;
16229 },
16230 createPasswordNullTextInputElement: function() {
16231  var inputElement = this.GetInputElement(),
16232   nullTextInputElement = document.createElement("INPUT");
16233  nullTextInputElement.className = inputElement.className;
16234  nullTextInputElement.style.cssText = inputElement.style.cssText;
16235  nullTextInputElement.id = inputElement.id + passwordInputClonedSuffix;
16236  nullTextInputElement.type = "text";
16237  if(ASPx.IsExists(inputElement.tabIndex))
16238   nullTextInputElement.tabIndex = inputElement.tabIndex;
16239  nullTextInputElement.disabled = inputElement.disabled;
16240  var onFocusEventHandler = function() {
16241   var inputElement = this.GetInputElement(),
16242    nullTextInputElement = this.GetPasswordNullTextInputElement();
16243   if(inputElement) {
16244    this.LockFocusEvents();  
16245    ASPx.SetElementDisplay(inputElement, true);
16246    inputElement.focus();
16247    ASPx.SetElementDisplay(nullTextInputElement, false);
16248    this.ensureAdjustFocusedNullTextElement();
16249    this.ReplaceAssociatedIdInLabels(nullTextInputElement.id, inputElement.id);
16250   }
16251  }.aspxBind(this);
16252  ASPx.Evt.AttachEventToElement(nullTextInputElement, "focus", onFocusEventHandler);
16253  return nullTextInputElement;
16254 },
16255 isPasswordNullTextInputElementExists: function() {
16256  return ASPx.IsExistsElement(this.nullTextInputElement);
16257 },
16258 TogglePasswordNullTextTimeoutChecker: function() {
16259  if(this.passwordNullTextIntervalID < 0) {
16260   var timeoutChecker = function() {
16261    var inputElement = this.GetInputElement();
16262    if(ASPx.GetControlCollection().GetByName(this.name) !== this || inputElement == null) {
16263     window.clearTimeout(this.passwordNullTextIntervalID);
16264     this.passwordNullTextIntervalID = -1;
16265     return;
16266    } else {
16267     if(!this.focused) {
16268      var passwordNullTextInputElement = this.GetPasswordNullTextInputElement();
16269      if(passwordNullTextInputElement.value != this.nullText && inputElement.value == "") { 
16270       passwordNullTextInputElement.value = this.nullText;
16271       this.SetValue(null);
16272      }
16273      if(inputElement.value != "") {
16274       if(inputElement.style.display == "none") {
16275        this.SetValue(inputElement.value);
16276        this.UnhidePasswordInput();
16277       }
16278      } else {
16279       if(inputElement.style.display != "none") {
16280        this.SetValue(null);
16281        this.HidePasswordInput();
16282       }
16283      }
16284     }
16285    }
16286   }.aspxBind(this);
16287   timeoutChecker(); 
16288   this.passwordNullTextIntervalID = window.setInterval(timeoutChecker, 100);
16289  }
16290 },
16291 TogglePasswordInputTextDecoration: function(value) {
16292  var inputElement = this.GetInputElement();
16293  var nullTextInputElement = this.GetPasswordNullTextInputElement();
16294  nullTextInputElement.value = value;
16295  var parentNode = inputElement.parentNode;
16296  if(ASPx.Data.ArrayIndexOf(parentNode.childNodes, nullTextInputElement) < 0) {
16297   ASPx.Attr.ChangeStyleAttribute(nullTextInputElement, "display", "none");
16298   parentNode.appendChild(nullTextInputElement);
16299  }
16300  this.HidePasswordInput();
16301  this.TogglePasswordNullTextTimeoutChecker();
16302 },
16303 HidePasswordInput: function() {
16304  ASPx.Attr.ChangeStyleAttribute(this.GetInputElement(), "display", "none");
16305  ASPx.Attr.ChangeStyleAttribute(this.GetPasswordNullTextInputElement(), "display", "");
16306  this.ReplaceAssociatedIdInLabels(this.GetInputElement().id, this.GetPasswordNullTextInputElement().id);
16307 },
16308 UnhidePasswordInput: function() {
16309  ASPx.Attr.ChangeStyleAttribute(this.GetInputElement(), "display", "");
16310  ASPx.Attr.ChangeStyleAttribute(this.GetPasswordNullTextInputElement(), "display", "none");
16311  this.ReplaceAssociatedIdInLabels(this.GetPasswordNullTextInputElement().id, this.GetInputElement().id);
16312 },
16313 ReplaceAssociatedIdInLabels: function(oldId, newId) {
16314  var labels = document.getElementsByTagName("LABEL");
16315  for(var i = 0; i < labels.length; i++) {
16316   if(labels[i].attributes["for"] && labels[i].attributes["for"].value == oldId)
16317    labels[i].attributes["for"].value = newId;
16318  }
16319 },
16320 GetFormattedText: function() {
16321  var value = this.GetValue();
16322  if(this.IsNull(value) && this.nullText != "")
16323   return this.GetText();
16324  return this.GetDecoratedText(value);
16325 },
16326 IsNull: function(value) {
16327  return value == null || value === "";
16328 },
16329 PopulateStyleDecorationPostfixes: function() {
16330  ASPxClientEdit.prototype.PopulateStyleDecorationPostfixes.call(this);
16331  this.styleDecoration.AddPostfix(ASPx.TEInputSuffix);
16332 },
16333 GetValue: function() {
16334  var value = null;
16335  if(this.maskInfo != null)
16336   value = this.maskInfo.GetValue();
16337  else if(this.HasTextDecorators())
16338   value = this.GetRawValue();
16339  else {
16340   var input = this.GetInputElement();
16341   value = input ? input.value : null;
16342  }
16343  return (value == "" && this.convertEmptyStringToNull) ? null : value;
16344 },
16345 SetValue: function(value) {
16346  if(value == null || value === undefined) 
16347   value = "";
16348  if(this.maskInfo != null) {
16349   this.maskInfo.SetValue(value.toString());
16350   this.ApplyMaskInfo(false);
16351   this.SavePrevMaskValue();
16352  } 
16353  else if(this.HasTextDecorators()) {
16354   this.SetRawValue(value);
16355   this.GetInputElement().value = this.CanApplyTextDecorators() && this.GetInputElement().type != "password" ? this.GetDecoratedText(value) : value;
16356  }
16357  else
16358   this.GetInputElement().value = value;
16359  this.UpdateStyleDecorations(); 
16360  this.SaveChangedValue();   
16361 },
16362 SetVisible: function(visible) {
16363  ASPxClientEdit.prototype.SetVisible.call(this, visible);
16364  if(this.helpTextDisplayMode === ASPxClientTextEditHelpTextDisplayMode.Inline) {
16365   if(visible)
16366    this.showHelpText();
16367   else
16368    this.hideHelpText();
16369  }
16370 },
16371 UnstretchInputElement: function(){
16372  var inputElement = this.GetInputElement();
16373  var mainElement = this.GetMainElement();
16374  var mainElementCurStyle = ASPx.GetCurrentStyle(mainElement);
16375  if(ASPx.IsExistsElement(mainElement) && ASPx.IsExistsElement(inputElement) && ASPx.IsExists(mainElementCurStyle) && 
16376   inputElement.style.width == "100%" &&
16377   (mainElementCurStyle.width == "" || mainElementCurStyle.width == "auto"))
16378   inputElement.style.width = "";
16379 },
16380 RestoreActiveElement: function(activeElement) {
16381  if(activeElement && activeElement.setActive && activeElement.tagName != "IFRAME")
16382   activeElement.setActive();
16383 },
16384 RaiseValueChangedEvent: function() {
16385  var processOnServer = ASPxClientEdit.prototype.RaiseValueChangedEvent.call(this);
16386  processOnServer = this.RaiseTextChanged(processOnServer);
16387  return processOnServer;
16388 },
16389 InitMask: function() {
16390  var rawValue = this.GetRawValue();
16391  this.SetValue(rawValue.length ? this.DecodeRawInputValue(rawValue) : this.maskInfo.GetValue());
16392  this.validationPatterns.unshift(new MaskValidationPattern(this.maskInfo.errorText, this.maskInfo));
16393 },
16394 SetMaskPasteTimer: function() {
16395  this.ClearMaskPasteTimer();
16396  this.maskPasteTimerID = ASPx.Timer.SetControlBoundInterval(this.MaskPasteTimerProc, this, ASPx.PasteCheckInterval);
16397 },
16398 ClearMaskPasteTimer: function() {
16399  this.maskPasteTimerID = ASPx.Timer.ClearInterval(this.maskPasteTimerID);
16400 },
16401 SavePrevMaskValue: function() {
16402  this.maskValueBeforeUserInput = this.maskInfo.GetValue();
16403 },
16404 FillMaskInfo: function() {
16405  var input = this.GetInputElement();
16406  if(!input) return; 
16407  var sel = ASPx.Selection.GetInfo(input);
16408  this.maskInfo.SetCaret(sel.startPos, sel.endPos - sel.startPos);  
16409 },
16410 ApplyMaskInfo: function(applyCaret) {
16411  this.SyncRawValue();
16412  var input = this.GetInputElement();
16413  var text = this.GetMaskDisplayText();
16414  this.maskTextBeforePaste = text;
16415  if(input.value != text)
16416   input.value = text;
16417  if(applyCaret)
16418   ASPx.Selection.Set(input, this.maskInfo.caretPos, this.maskInfo.caretPos + this.maskInfo.selectionLength);
16419 },
16420 GetMaskDisplayText: function() {
16421  if(!this.focused && this.HasTextDecorators())
16422   return this.GetDecoratedText(this.maskInfo.GetValue());
16423  return this.maskInfo.GetText();
16424 },
16425 ShouldCancelMaskKeyProcessing: function(htmlEvent, keyDownInfo) {
16426  return ASPx.Evt.IsEventPrevented(htmlEvent);
16427 }, 
16428 HandleMaskKeyDown: function(evt) {
16429  var keyInfo = ASPx.MaskManager.CreateKeyInfoByEvent(evt);
16430  ASPx.MaskManager.keyCancelled = this.ShouldCancelMaskKeyProcessing(evt, keyInfo);
16431  if(ASPx.MaskManager.keyCancelled) {
16432   ASPx.Evt.PreventEvent(evt);
16433   return;
16434  }
16435  this.maskPasteLock = true;
16436  this.FillMaskInfo();  
16437  var canHandle = ASPx.MaskManager.CanHandleControlKey(keyInfo);   
16438  ASPx.MaskManager.savedKeyDownKeyInfo = keyInfo;
16439  if(canHandle) {   
16440   ASPx.MaskManager.OnKeyDown(this.maskInfo, keyInfo);
16441   this.ApplyMaskInfo(true);
16442   ASPx.Evt.PreventEvent(evt);
16443  }
16444  ASPx.MaskManager.keyDownHandled = canHandle;
16445  this.maskPasteLock = false;
16446  this.UpdateMaskHintHtml();
16447 },
16448 HandleMaskKeyPress: function(evt) {
16449  var keyInfo = ASPx.MaskManager.CreateKeyInfoByEvent(evt);
16450  ASPx.MaskManager.keyCancelled = ASPx.MaskManager.keyCancelled || this.ShouldCancelMaskKeyProcessing(evt, ASPx.MaskManager.savedKeyDownKeyInfo);
16451  if(ASPx.MaskManager.keyCancelled) {
16452   ASPx.Evt.PreventEvent(evt);
16453   return;
16454  }
16455  this.maskPasteLock = true;  
16456  var printable = ASPx.MaskManager.savedKeyDownKeyInfo != null && ASPx.MaskManager.IsPrintableKeyCode(ASPx.MaskManager.savedKeyDownKeyInfo);
16457  if(printable) {
16458   ASPx.MaskManager.OnKeyPress(this.maskInfo, keyInfo);
16459   this.ApplyMaskInfo(true);
16460  }
16461  if(printable || ASPx.MaskManager.keyDownHandled)   
16462   ASPx.Evt.PreventEvent(evt); 
16463  this.maskPasteLock = false;
16464  this.UpdateMaskHintHtml();
16465 },
16466 MaskPasteTimerProc: function() {
16467  if(this.maskPasteLock || !this.maskInfo) return;
16468  this.maskPasteCounter++;
16469  var inputElement = this.inputElement;
16470  if(!inputElement || this.maskPasteCounter > 40) {
16471   this.maskPasteCounter = 0;
16472   inputElement = this.GetInputElement();
16473   if(!ASPx.IsExistsElement(inputElement)) {
16474    this.ClearMaskPasteTimer();
16475    return;
16476   }
16477  }
16478  if(this.maskTextBeforePaste !== inputElement.value)
16479   this.ProcessInputValueChangedOnTimer();
16480  if(!this.focused)
16481   this.ClearMaskPasteTimer();
16482 },
16483 ProcessInputValueChangedOnTimer: function() {
16484  var inputElement = this.inputElement;
16485  var selectionInfo = ASPx.Selection.GetInfo(inputElement);
16486  var startCaretPosition = selectionInfo.startPos;
16487  var endCaretPosition = selectionInfo.endPos;
16488  var oldText = this.maskTextBeforePaste;
16489  var newText = inputElement.value;
16490  var isAndroidBackSpacePressed = this.isAndroidBackSpacePressed(oldText, newText, startCaretPosition, endCaretPosition);
16491  var isLastTypedCharacter = newText.indexOf(oldText) == 0 && newText.length > oldText.length;
16492  if(isAndroidBackSpacePressed || isLastTypedCharacter) {
16493   this.SetText(newText);
16494   this.SetCaretPosition(endCaretPosition);
16495  } else {
16496   this.maskInfo.ProcessPaste(newText, endCaretPosition);
16497   this.ApplyMaskInfo(true);
16498  }
16499 },
16500 isAndroidBackSpacePressed: function(oldText, newText, startCaretPosition, endCaretPosition) {
16501  if(!ASPx.Browser.AndroidMobilePlatform || startCaretPosition !== endCaretPosition || newText.length >= oldText.length)
16502   return false;
16503  var startSubstring = newText.substring(0, startCaretPosition);
16504  var endSubstring = newText.substring(startCaretPosition);
16505  var isStartSubstringMatches = oldText.indexOf(startSubstring) == 0;
16506  var isEndSubstringMatches = endSubstring == "" || oldText.lastIndexOf(endSubstring) == oldText.length - endSubstring.length;
16507  return isStartSubstringMatches && isEndSubstringMatches;
16508 },
16509 BeginShowMaskHint: function() {
16510  if(!this.GetReadOnly() && this.maskHintTimerID == -1)
16511   this.maskHintTimerID = window.setInterval(ASPx.MaskHintTimerProc, 500);
16512 },
16513 EndShowMaskHint: function() {
16514  window.clearInterval(this.maskHintTimerID);
16515  this.maskHintTimerID = -1;
16516 },
16517 MaskHintTimerProc: function() {  
16518  if(this.maskInfo) {
16519   this.FillMaskInfo();
16520   this.UpdateMaskHintHtml();
16521  } else {
16522   this.EndShowMaskHint();
16523  }
16524 },
16525 UpdateMaskHintHtml: function() {  
16526  var hint =  this.GetMaskHintElement();
16527  if(!ASPx.IsExistsElement(hint))
16528   return;
16529  var html = ASPx.MaskManager.GetHintHtml(this.maskInfo);
16530  if(html == this.maskHintHtml)
16531   return;
16532  if(html != "") {
16533   var mainElement = this.GetMainElement();
16534   if(ASPx.IsExistsElement(mainElement)) {
16535    hint.innerHTML = html;
16536    hint.style.position = "absolute";  
16537    hint.style.left = ASPx.PrepareClientPosForElement(ASPx.GetAbsoluteX(mainElement), mainElement, true) + "px";
16538    hint.style.top = (ASPx.PrepareClientPosForElement(ASPx.GetAbsoluteY(mainElement), mainElement, false) + mainElement.offsetHeight + 2) + "px";
16539    hint.style.display = "block";    
16540   }   
16541  } else {
16542   hint.style.display = "none";
16543  }
16544  this.maskHintHtml = html;
16545 },
16546 HideMaskHint: function() {
16547  var hint =  this.GetMaskHintElement();
16548  if(ASPx.IsExistsElement(hint))
16549   hint.style.display = "none";
16550  this.maskHintHtml = "";
16551 },
16552 GetMaskHintElement: function() {
16553  return ASPx.GetElementById(this.name + "_MaskHint");
16554 },
16555 OnFocus: function() {
16556  if (this.maskInfo != null && !ASPx.GetControlCollection().InCallback()) {
16557   this.TrySetCursorToStartPosition();
16558   this.SetMaskPasteTimer();
16559  }
16560  if(this.IsAutocompleteDropDownListRequiredOnFocus())
16561   ASPx.Attr.RemoveAttribute(this.GetInputElement(), "autocomplete");
16562  ASPxClientEdit.prototype.OnFocus.call(this);
16563 },
16564 OnLostFocus: function() {
16565  if(this.IsAutocompleteOffRequiredOnLostFocus())
16566   ASPx.Attr.SetAttribute(this.GetInputElement(), "autocomplete", "off");
16567  ASPxClientEdit.prototype.OnLostFocus.call(this);
16568 },
16569 OnMouseWheel: function(evt){
16570  if(this.GetReadOnly() || this.maskInfo == null) return;
16571  this.FillMaskInfo();
16572  ASPx.MaskManager.OnMouseWheel(this.maskInfo, ASPx.Evt.GetWheelDelta(evt) < 0 ? -1 : 1);
16573  this.ApplyMaskInfo(true);
16574  ASPx.Evt.PreventEvent(evt);
16575  this.UpdateMaskHintHtml();
16576 }, 
16577 OnBrowserWindowResize: function(e) {
16578  if(!this.autoResizeWithContainer)
16579   this.AdjustControl();
16580 },
16581 IsValueChanged: function() {
16582  return this.GetValue() != this.lastChangedValue; 
16583 },
16584 OnKeyDown: function(evt) {        
16585  if(this.NeedPreventBrowserUndoBehaviour(evt))
16586   return ASPx.Evt.PreventEvent(evt);
16587  if(this.RequireHandleMaxlenManually()) {
16588   this.onKeyDownInputValue = this.GetInputElement().value;
16589   var selectionInfo = ASPx.Selection.GetExtInfo(this.GetInputElement());
16590   this.onKeyDownCursorPos = selectionInfo.startPos;
16591  }
16592  if(ASPx.Browser.IE && ASPx.Evt.GetKeyCode(evt) == ASPx.Key.Esc) {   
16593   if(++this.escCount > 1) {
16594    ASPx.Evt.PreventEvent(evt);
16595    return;
16596   }
16597  } else 
16598   this.escCount = 0;
16599  ASPxClientEdit.prototype.OnKeyDown.call(this, evt);
16600  if(!this.IsRaiseStandardOnChange(evt)) {
16601   if(!this.GetReadOnly() && this.maskInfo != null)
16602    this.HandleMaskKeyDown(evt);
16603  }
16604 },
16605 IsCtrlZ: function(evt) {
16606  return evt.ctrlKey && !evt.altKey && !evt.shiftKey && (ASPx.Evt.GetKeyCode(evt) == 122 || ASPx.Evt.GetKeyCode(evt) == 90);
16607 },
16608 NeedPreventBrowserUndoBehaviour: function(evt) {
16609  var inputElement = this.GetInputElement();
16610  return this.IsCtrlZ(evt) && !!inputElement && !inputElement.value;
16611 },
16612 OnKeyPress: function(evt) {
16613  ASPxClientEdit.prototype.OnKeyPress.call(this, evt);
16614  if(!this.GetReadOnly() && this.maskInfo != null && !this.IsRaiseStandardOnChange(evt))
16615   this.HandleMaskKeyPress(evt);
16616  if(this.NeedOnKeyEventEnd(evt, true))
16617   this.OnKeyEventEnd(evt);
16618 },
16619 OnKeyUp: function(evt) {
16620  if(ASPx.Browser.Firefox && !this.focused && ASPx.Evt.GetKeyCode(evt) === ASPx.Key.Tab)
16621   return;
16622  if(this.NeedOnKeyEventEnd(evt, false)) {
16623   var proccessNextCommingPress = ASPx.Evt.GetKeyCode(evt) === ASPx.Key.Alt; 
16624   this.OnKeyEventEnd(evt, proccessNextCommingPress);
16625  }
16626  if(this.RequireHandleMaxlenManually()) {
16627   var inputValueLength = this.GetInputElement().value.length;
16628   var maxLength = this.GetInputMaxLength();
16629   if(inputValueLength > maxLength && inputValueLength > this.onKeyDownInputValue.length) {
16630    this.GetInputElement().value = this.onKeyDownInputValue;
16631    this.SetCaretPosition(this.onKeyDownCursorPos);
16632   }
16633  }
16634  ASPxClientEdit.prototype.OnKeyUp.call(this, evt);
16635 },
16636 RequireHandleMaxlenManually: function() { 
16637  return ASPx.Browser.AndroidMobilePlatform && ASPx.Browser.SamsungAndroidDevice && ASPx.Browser.PlaformMajorVersion < 6 && this.GetInputMaxLength() !== -1;
16638 },
16639 GetInputMaxLength: function() {
16640  var input = this.GetInputElement();
16641  if(ASPx.Attr.IsExistsAttribute(input, "maxlength"))
16642   return input.maxLength;
16643  return -1;
16644 },
16645 NeedOnKeyEventEnd: function(evt, isKeyPress) { 
16646  var handleKeyPress = this.maskInfo != null && evt.keyCode == ASPx.Key.Enter;
16647  return handleKeyPress == isKeyPress;
16648 },
16649 OnKeyEventEnd: function(evt, withDelay){
16650  if(!this.GetReadOnly()) {
16651   if(this.IsRaiseStandardOnChange(evt))
16652    this.RaiseStandardOnChange();
16653   this.SyncRawValueIfHasTextDecorators(withDelay);
16654  }
16655 },
16656 SyncRawValueIfHasTextDecorators: function(withDelay) {
16657  if(this.HasTextDecorators()) {
16658   if(withDelay) {
16659    window.setTimeout(function() {
16660     this.SyncRawValue();
16661    }.aspxBind(this), 0);
16662   } else 
16663    this.SyncRawValue();
16664  }
16665 },
16666 IsRaiseStandardOnChange: function(evt){
16667  return !this.specialKeyboardHandlingUsed && this.raiseValueChangedOnEnter && evt.keyCode == ASPx.Key.Enter;
16668 },
16669 GetFocusSelectAction: function() {
16670  if (this.maskInfo)
16671   return this.maskInfo.IsEmpty() ? null : "start";
16672  return "all"; 
16673 },
16674 CorrectFocusWhenDisabled: function() {
16675  if(!this.GetEnabled()) {
16676   var inputElement = this.GetInputElement();
16677   if(inputElement)
16678    inputElement.blur();
16679   return true;
16680  }
16681  return false;
16682 },
16683 EnsureShowPopupHelpText: function() {
16684  if(this.helpTextDisplayMode === ASPxClientTextEditHelpTextDisplayMode.Popup)
16685   this.showHelpText();
16686 },
16687 EnsureHidePopupHelpText: function() {
16688  if(this.helpTextDisplayMode === ASPxClientTextEditHelpTextDisplayMode.Popup)
16689   this.hideHelpText();
16690 },
16691 OnFocusCore: function() {
16692  if(this.CorrectFocusWhenDisabled())
16693   return;
16694  var wasLocked = this.IsFocusEventsLocked();
16695  ASPxClientEdit.prototype.OnFocusCore.call(this);
16696  this.CorrectInputMaxLength(true);
16697  if(this.maskInfo != null) {
16698   this.SavePrevMaskValue();
16699   this.BeginShowMaskHint();
16700  }
16701  if(!wasLocked) {
16702   this.ToggleTextDecoration();
16703   this.startUserInputEventTimerIfRequired();
16704  }
16705  if(this.isPasswordNullTextInputElementExists())
16706   setTimeout(function() { this.EnsureShowPopupHelpText(); }.aspxBind(this), 0);
16707  else
16708   this.EnsureShowPopupHelpText();
16709 },
16710 startUserInputEventTimerIfRequired: function () {
16711  if(this.shouldStartUserInputTimer() && this.userInputEventTimerID === -1) {
16712   this.prevInputValue = this.GetInputElement().value;
16713   this.userInputEventTimerID = ASPx.Timer.SetControlBoundInterval(this.processUserInputEventTimer, this, ASPx.CheckUserInputInterval);
16714  }
16715 },
16716 shouldStartUserInputTimer: function() {
16717  return !this.UserInput.IsEmpty();
16718 },
16719 restartCurrentUserInputTimer: function() {
16720  if(this.userInputEventTimerID !== -1) {
16721   this.processUserInputEventTimer(true);
16722   this.clearUserInputEventTimerIfRequired();
16723   this.startUserInputEventTimerIfRequired();
16724  }
16725 },
16726 clearUserInputEventTimerIfRequired: function () {
16727  if (this.userInputEventTimerID !== -1)
16728   this.userInputEventTimerID = ASPx.Timer.ClearInterval(this.userInputEventTimerID);
16729 },
16730 processUserInputEventTimer: function(onRestart) {
16731  var currentInputValue = this.GetInputElement().value;
16732  if(currentInputValue !== this.prevInputValue) {
16733   this.onInputChangedOnUserInputTimer(onRestart);
16734   this.prevInputValue = currentInputValue;
16735  }
16736 },
16737 onInputChangedOnUserInputTimer: function(onRestart) {
16738  if(this.raiseUserInputTimeout > -1)
16739   clearTimeout(this.raiseUserInputTimeout);
16740  this.raiseUserInputTimeout = setTimeout(function() {
16741   this.RaiseUserInput();
16742   this.raiseUserInputTimeout = -1;
16743  }.bind(this), 0);
16744 },
16745 ensureFocusedNullTextElement: function () {
16746  if(!this.focusedNullTextElement)
16747   this.createFocusedNullTextElement();
16748 },
16749 getFocusedNullTextElementClassName: function() {
16750  return focusedNullTextClassName;
16751 },
16752 getFocusedNullTextElementTagName: function() {
16753  return "INPUT";
16754 },
16755 getCopyFromInputElementStyles: function() {
16756  return [ "paddingLeft", "paddingTop", "paddingRight", "paddingBottom", "borderCollapse", "borderLeftWidth", "borderTopWidth", "borderRightWidth", "borderBottomWidth" ];
16757 },
16758 copyStylesFromInputElementToFocusedNullTextElement: function() {
16759  var input = this.GetInputElement();
16760  var inputStyle = ASPx.GetCurrentStyle(input);
16761  var stylesToCopy = this.getCopyFromInputElementStyles();
16762  for(var i = 0; i < stylesToCopy.length; i++)
16763   this.focusedNullTextElement.style[stylesToCopy[i]] = inputStyle[stylesToCopy[i]];
16764 },
16765 createFocusedNullTextElement: function() {
16766  this.focusedNullTextElement = document.createElement(this.getFocusedNullTextElementTagName());
16767  this.focusedNullTextElement.value = this.nullText;
16768  this.focusedNullTextElement.className = this.getFocusedNullTextElementClassName();
16769  this.focusedNullTextElement.tabIndex = -1;
16770  ASPx.SetElementDisplay(this.focusedNullTextElement, false);
16771  if(this.accessibilityCompliant) {
16772   ASPx.Attr.SetAttribute(this.focusedNullTextElement, "aria-label", this.nullText);
16773   ASPx.Attr.SetAttribute(this.focusedNullTextElement, "aria-hidden", true);
16774  }
16775  this.copyStylesFromInputElementToFocusedNullTextElement();
16776  if (this.nullTextOnFocusCssText) {
16777   var styleSheet = ASPx.GetCurrentStyleSheet();
16778   this.focusedNullTextElement.className += " " + ASPx.CreateImportantStyleRule(styleSheet, this.nullTextOnFocusCssText);
16779  }
16780  var inputElement = this.GetInputElement();
16781  inputElement.parentNode.insertBefore(this.focusedNullTextElement, inputElement.nextSibling);
16782 },
16783 ensureActivateFocusedNullTextMechanism: function() {
16784  if (this.nullTextDisplayMode === NullTextDisplayMode.UnfocusedAndFocused) {
16785   if(this.IsNull(this.GetValue()))
16786    this.changeFocusedNullTextElementVisibility(true);
16787   this.setFocusedNullTextTimer();
16788  }
16789 },
16790 ensureDeactivateFocusedNullTextMechanism: function () {
16791  if (this.nullTextDisplayMode === NullTextDisplayMode.UnfocusedAndFocused) {
16792   this.clearFocusedNullTextTimer();
16793   this.changeFocusedNullTextElementVisibility(false);
16794  }
16795 },
16796 setFocusedNullTextTimer: function () {
16797  if(this.focusedNullTextTimerID === -1)
16798   this.focusedNullTextTimerID = ASPx.Timer.SetControlBoundInterval(this.onFocusedNullTextVisibilityCheck, this, ASPx.PasteCheckInterval);
16799 },
16800 clearFocusedNullTextTimer: function () {
16801  this.focusedNullTextTimerID = ASPx.Timer.ClearInterval(this.focusedNullTextTimerID);
16802 },
16803 onFocusedNullTextVisibilityCheck: function (evt) {
16804  if(!this.needShowFocusedNullText() && this.isFocusedNullTextElementDisplayed())
16805   this.changeFocusedNullTextElementVisibility(false);
16806  else if(this.needShowFocusedNullText() && !this.isFocusedNullTextElementDisplayed())
16807   this.changeFocusedNullTextElementVisibility(true);
16808 },
16809 isFocusedNullTextElementDisplayed: function() {
16810  return this.focusedNullTextElement && ASPx.GetElementDisplay(this.focusedNullTextElement);
16811 },
16812 needShowFocusedNullText: function() {
16813  if(this.focusedNullTextTimerID === -1)
16814   return this.IsNull(this.GetValue());
16815  var result = this.GetInputElement().value === "";
16816  if(this.CanApplyNullTextDecoration)
16817   result = result && this.CanApplyNullTextDecoration();
16818  return result;
16819 }, 
16820 changeFocusedNullTextElementVisibility: function (visible) {
16821  this.ensureFocusedNullTextElement();
16822  ASPx.SetElementDisplay(this.focusedNullTextElement, visible);
16823  if(visible)
16824   this.adjustFocusedNullTextElement();  
16825 },
16826 getInputElementAbsoluteX: function(input) {
16827  var result = ASPx.GetAbsoluteX(input);
16828  if(ASPx.Browser.Opera || ASPx.Browser.AndroidMobilePlatform) 
16829   result++;
16830  return result;
16831 },
16832 getInputElementAbsoluteY: function (input) {
16833  var result = ASPx.GetAbsoluteY(input);
16834  if(ASPx.Browser.Opera || ASPx.Browser.AndroidMobilePlatform) 
16835   result++;
16836  return result;
16837 },
16838 adjustFocusedNullTextElement: function() {
16839  var input = this.GetInputElement();
16840  this.focusedNullTextElement.style.width = input.offsetWidth + "px";
16841  this.focusedNullTextElement.style.height = input.offsetHeight + "px";
16842  var inputXPos = this.getInputElementAbsoluteX(input);
16843  var inputYPos = this.getInputElementAbsoluteY(input);
16844  ASPx.SetAbsoluteX(this.focusedNullTextElement, inputXPos);
16845  ASPx.SetAbsoluteY(this.focusedNullTextElement, inputYPos);
16846  var shiftByX = inputXPos - ASPx.GetAbsoluteX(this.focusedNullTextElement);
16847  var shiftByY = inputYPos - ASPx.GetAbsoluteY(this.focusedNullTextElement);
16848  if (shiftByX !== 0)
16849   this.focusedNullTextElement.style.left = ASPx.PxToFloat(this.focusedNullTextElement.style.left) + shiftByX + "px";
16850  if (shiftByY !== 0)
16851   this.focusedNullTextElement.style.top = ASPx.PxToFloat(this.focusedNullTextElement.style.top) + shiftByY + "px";
16852 },
16853 ensureAdjustFocusedNullTextElement: function () {
16854  if(this.isFocusedNullTextElementDisplayed())
16855   this.adjustFocusedNullTextElement(this.focusedNullTextElement);
16856 },
16857 TrySetCursorToStartPosition: function() {
16858  var input = this.GetInputElement();
16859  var sel = ASPx.Selection.GetInfo(input);
16860  if (sel.startPos === sel.endPos && this.IsMaskInfoEmpty()) {
16861   var pos = this.maskInfo.GetFirstNonLiteralPosition();
16862   var setCaret = ASPx.Selection.SetCaretPosition.bind(this, input, pos);
16863   setTimeout(function() {
16864    if (document.activeElement === input) {
16865     setCaret();
16866     setTimeout(setCaret, 50);
16867    }
16868   }, 0);
16869  }
16870 },
16871 IsMaskInfoEmpty: function() {
16872  return this.maskInfo.IsEmpty();
16873 },
16874 OnLostFocusCore: function() {
16875  var wasLocked = this.IsFocusEventsLocked();
16876  ASPxClientEdit.prototype.OnLostFocusCore.call(this);
16877  this.CorrectInputMaxLength();
16878  if(this.maskInfo != null) {
16879   this.EndShowMaskHint();
16880   this.HideMaskHint();   
16881   if(this.maskInfo.ApplyFixes(null))
16882    this.ApplyMaskInfo(false);
16883   this.RaiseStandardOnChange();
16884  }
16885  if(!wasLocked) {
16886   this.clearUserInputEventTimerIfRequired();
16887   this.ToggleTextDecoration();
16888  }
16889  this.escCount = 0;
16890  this.EnsureHidePopupHelpText();
16891 },
16892 InputMaxLengthCorrectionRequired: function () {
16893  return ASPx.Browser.IE && ASPx.Browser.Version >= 10 && (!this.isNative || this.nullText != "");
16894 },
16895 CorrectInputMaxLength: function (onFocus) {
16896  if(this.InputMaxLengthCorrectionRequired()) {
16897   var input = this.GetInputElement();
16898   if(!ASPx.IsExists(this.inputMaxLength))
16899    this.inputMaxLength = input.maxLength;
16900   input.maxLength = onFocus ? this.inputMaxLength : -1;
16901  }
16902 },
16903 SubscribeToIeDropEvent: function() {
16904  if(this.InputMaxLengthCorrectionRequired()) {
16905   var input = this.GetInputElement();
16906   ASPx.Evt.AttachEventToElement(input, "drop", function(e) { this.CorrectInputMaxLength(true); }.aspxBind(this));
16907  }
16908 },
16909 SetFocus: function() {
16910  if(this.isPasswordNullTextInputElementExists()) {
16911   this.GetPasswordNullTextInputElement().focus();
16912  } else {
16913     ASPxClientEdit.prototype.SetFocus.call(this);
16914  }
16915 },
16916 OnValueChanged: function() {
16917  if(this.maskInfo != null) {
16918   if(this.maskInfo.GetValue() == this.maskValueBeforeUserInput && !this.IsValueChangeForced())
16919    return;
16920   this.SavePrevMaskValue();
16921  }
16922  if(this.HasTextDecorators())
16923   this.SyncRawValue();
16924  if(!this.IsValueChanged() && !this.IsValueChangeForced())
16925   return;
16926  this.SaveChangedValue(); 
16927  ASPxClientEdit.prototype.OnValueChanged.call(this);
16928 },
16929 IsValueChangeForced: function() {
16930  return false;
16931 },
16932 OnTextChanged: function() {
16933 },
16934 ForceTextChanged: function() {
16935  this.OnTextChanged();
16936 },
16937 SaveChangedValue: function() {
16938  this.lastChangedValue = this.GetValue();
16939 },
16940 RaiseStandardOnChange: function(){
16941  var element = this.GetInputElement();
16942  if(element && element.onchange) {
16943   element.onchange({ target: this.GetInputElement() });
16944  }
16945  else if(this.ValueChanged) {
16946   this.ValueChanged.FireEvent(this);
16947  }
16948 },
16949 RaiseTextChanged: function(processOnServer){
16950  if(!this.TextChanged.IsEmpty()){
16951   var args = new ASPxClientProcessingModeEventArgs(processOnServer);
16952   this.TextChanged.FireEvent(this, args);
16953   processOnServer = args.processOnServer;
16954  }
16955  return processOnServer;  
16956 },
16957 RaiseUserInput: function () {
16958  if(!this.UserInput.IsEmpty()) {
16959   var args = new ASPxClientEventArgs();
16960   this.UserInput.FireEvent(this, args);
16961  }
16962 },
16963 GetText: function(){
16964  if(this.maskInfo != null) {
16965   return this.maskInfo.GetText();
16966  } else {
16967   var value = this.GetValue();
16968   return value != null ? value : "";
16969  }
16970 },
16971 SetText: function (value){
16972  if(this.maskInfo != null) {
16973   this.maskInfo.SetText(value);
16974   this.ApplyMaskInfo(false);
16975   this.SavePrevMaskValue();
16976  } else {
16977   this.SetValue(value);
16978  }
16979 },
16980 SelectAll: function() {
16981  this.SetSelection(0, -1, false);
16982 },
16983 SetCaretPosition: function(pos) {
16984  var inputElement = this.GetInputElement();
16985  ASPx.Selection.SetCaretPosition(inputElement, pos);
16986 },
16987 GetCaretPosition: function() {
16988  var inputElement = this.GetInputElement();
16989  return ASPx.Selection.GetCaretPosition(inputElement);
16990 },
16991 SetSelection: function(startPos, endPos, scrollToSelection) { 
16992  var inputElement = this.GetInputElement();
16993  ASPx.Selection.Set(inputElement, startPos, endPos, scrollToSelection, true);
16994 },
16995 ChangeEnabledAttributes: function(enabled){
16996  var inputElement = this.GetInputElement();
16997  if(inputElement){
16998   this.ChangeInputEnabledAttributes(inputElement, ASPx.Attr.ChangeAttributesMethod(enabled), enabled);
16999   if(this.specialKeyboardHandlingUsed)
17000    this.ChangeSpecialInputEnabledAttributes(inputElement, ASPx.Attr.ChangeEventsMethod(enabled), true);
17001   this.ChangeInputEnabled(inputElement, enabled, this.GetReadOnly());
17002   if(this.isPasswordNullTextInputElementExists())
17003    this.GetPasswordNullTextInputElement().disabled = inputElement.disabled;
17004  }
17005 },
17006 SetReadOnlyInternal: function(readOnly) {
17007  ASPxClientEdit.prototype.SetReadOnlyInternal.call(this, readOnly);
17008  this.ChangeInputReadOnly(readOnly);
17009 },
17010 ChangeReadOnlyStateItems: function(readOnly) {
17011  ASPxClientEdit.prototype.ChangeReadOnlyStateItems.call(this, readOnly);
17012  ASPx.GetStateController().SetElementReadOnly(this.GetInputElement(), readOnly);
17013 },
17014 ChangeInputReadOnly: function(readOnly) {
17015  var inputElement = this.GetInputElement();
17016  if(inputElement)
17017   inputElement.readOnly = readOnly || !this.GetEnabled() && this.UseReadOnlyForDisabled();
17018 },
17019 ChangeEnabledStateItems: function(enabled){
17020  if(!this.isNative) {
17021   var sc = ASPx.GetStateController();
17022   sc.SetElementEnabled(this.GetMainElement(), enabled);
17023   sc.SetElementEnabled(this.GetInputElement(), enabled);
17024  }
17025 },
17026 ChangeInputEnabled: function(element, enabled, readOnly) {
17027  if(this.UseReadOnlyForDisabled())
17028   element.readOnly = !enabled || readOnly;
17029  else
17030   element.disabled = !enabled;
17031 },
17032 ChangeInputEnabledAttributes: function(element, method, enabled) {
17033  var ieTabIndexFix = enabled && ASPx.Browser.IE && element.setAttribute && ASPx.Attr.IsExistsAttribute(element, "savedtabIndex");
17034  method(element, "tabIndex");
17035  if(!enabled) element.tabIndex = -1;
17036  if(ieTabIndexFix) { 
17037   window.setTimeout(function() {
17038    if(element && element.parentNode)
17039     element.parentNode.replaceChild(element, element); 
17040   }, 0);
17041  }
17042  method(element, "onclick");
17043  if(!this.NeedFocusCorrectionWhenDisabled())
17044   method(element, "onfocus");
17045  method(element, "onblur");
17046  method(element, "onkeydown");
17047  method(element, "onkeypress");
17048  method(element, "onkeyup");
17049 },
17050 UseReadOnlyForDisabled: function() {
17051  return (ASPx.Browser.IE && ASPx.Browser.Version < 10) && !this.isNative;
17052 },
17053 NeedFocusCorrectionWhenDisabled: function(){
17054  return (ASPx.Browser.IE && ASPx.Browser.Version < 10) && !this.isNative;
17055 },
17056 OnPostFinalization: function(args) {
17057  this.TryRestoreDisabledOnPost(args);
17058  this.TryClearInputTextDecorationOnPost(args);
17059 },
17060 TryRestoreDisabledOnPost: function(args) { 
17061  if(this.GetEnabled() || !this.UseReadOnlyForDisabled() || args.isDXCallback)
17062   return;
17063  var inputElement = this.GetInputElement();
17064  if(inputElement) {
17065   var inputDisabled = inputElement.disabled;
17066   inputElement.disabled = true;
17067   window.setTimeout(function() {
17068    inputElement.disabled = inputDisabled;
17069   }, 0);
17070  }
17071 },
17072 GetTempHiddenInputID: function() {
17073  return this.name + ASPx.TempHiddenInputSuffix;
17074 },
17075 TryClearInputTextDecorationOnPost: function(args) {
17076  if(ASPx.Platform === "NETCORE")
17077   return;
17078  if(this.HasTextDecorators() && !ASPx.IsExists(this.GetValue())) {
17079   var inputElement = this.GetInputElement();
17080   if(inputElement) {
17081    var name = ASPx.Attr.GetAttribute(inputElement, "name");
17082    if(name)
17083     this.TryClearInputTextDecorationOnPostCore(inputElement, name);
17084   }
17085  }
17086 },
17087 TryClearInputTextDecorationOnPostCore: function(inputElement, name) {
17088  var hiddenInput = ASPx.CreateHiddenField(name, this.GetTempHiddenInputID(), inputElement.parentNode);
17089  ASPx.Attr.SetAttribute(inputElement, "data-name", name);
17090  ASPx.Attr.RemoveAttribute(inputElement, "name");
17091  setTimeout(function() {
17092   ASPx.Attr.SetAttribute(inputElement, "name", name);
17093   ASPx.Attr.RemoveAttribute(inputElement, "data-name");
17094   ASPx.RemoveElement(hiddenInput);
17095  }, 0);
17096 },
17097 OnUnload: function() {
17098  var input = this.GetInputElement();
17099  if(!input)
17100   return;
17101  if(this.IsAutocompleteOffNotRequiredOnUnload())
17102   ASPx.Attr.RemoveAttribute(input, "autocomplete");
17103  if(this.focusedNullTextElement)
17104   ASPx.RemoveElement(this.focusedNullTextElement);
17105 },
17106 IsVCardAttributeRequired: function() {
17107  return this.autoCompleteAttribute && this.autoCompleteAttribute.name !== "autocomplete";
17108 },
17109 IsAutocompleteDropDownListRequiredOnFocus: function() {
17110  return !this.autoCompleteAttribute || this.IsVCardAttributeRequired();
17111 },
17112 IsAutocompleteOffRequiredOnInitialize: function() {
17113  return !this.isNative && (this.autoCompleteAttribute && this.autoCompleteAttribute.name === "autocomplete" || ASPx.Browser.WebKitFamily);
17114 },
17115 IsAutocompleteOffRequiredOnLostFocus: function() {
17116  return !this.autoCompleteAttribute && this.IsNullTextVisible() && !this.IsVCardAttributeRequired();
17117 },
17118 IsAutocompleteOffNotRequiredOnUnload: function() {
17119  return !this.IsNullTextVisible() || this.IsVCardAttributeRequired() || (this.maskInfo != null && this.GetValue() == null);
17120 },
17121 IsNullTextVisible: function() {
17122  return this.nullText && !this.GetValue() && !this.GetText();
17123 },
17124 GetModifyEvent: function() {
17125  return this.UserInput;
17126 },
17127 EnsureRequiredNativeAttributesExists: function() {
17128  var input = this.GetInputElement();
17129  if(!input.onfocus)
17130   ASPx.Evt.AttachEventToElement(input, "focus", function() { ASPx.EGotFocus(this.name); }.aspxBind(this));
17131  if(!input.onblur)
17132   ASPx.Evt.AttachEventToElement(input, "blur", function() { ASPx.ELostFocus(this.name); }.aspxBind(this));
17133 }
17134});
17135MaskValidationPattern = ASPx.CreateClass(ASPx.ValidationPattern, {
17136 constructor: function(errorText, maskInfo) {
17137  this.constructor.prototype.constructor.call(this, errorText);
17138  this.maskInfo = maskInfo;
17139 },
17140 EvaluateIsValid: function(value) {
17141  return this.maskInfo.IsValid();
17142 }
17143});
17144ASPx.Ident.IsASPxClientTextEdit = function(obj) {
17145 return !!obj.isASPxClientTextEdit;
17146};
17147var ASPxClientTextBoxBase = ASPx.CreateClass(ASPxClientTextEdit, {
17148 constructor: function(name) {
17149  this.constructor.prototype.constructor.call(this, name);
17150  this.sizingConfig.allowSetHeight = false;
17151  this.sizingConfig.adjustControl = true;
17152 }
17153});
17154var ASPxClientTextBox = ASPx.CreateClass(ASPxClientTextBoxBase, {
17155 constructor: function(name) {
17156  this.constructor.prototype.constructor.call(this, name);
17157  this.isASPxClientTextBox = true;
17158  this.isCaptchaTextBox = false;
17159 },
17160 NeedProcessUnload: function() {
17161  return ASPxClientTextBoxBase.prototype.NeedProcessUnload.call(this) && !this.isCaptchaTextBox;
17162 },
17163 IsValueRestoredByBrowser: function() {
17164  if(this.isCaptchaTextBox)
17165   return this.initializeInputValue !== "" && this.initializeInputValue !== this.nullText;
17166  return  ASPxClientTextBoxBase.prototype.IsValueRestoredByBrowser.call(this);
17167 },
17168 SynchronizeRestoredValue: function() {
17169  if(this.isCaptchaTextBox)
17170   this.SetText(null);
17171  else
17172   ASPxClientTextBoxBase.prototype.SynchronizeRestoredValue.call(this);
17173 },
17174});
17175ASPxClientTextBox.Cast = ASPxClientControl.Cast;
17176ASPx.Ident.IsASPxClientTextBox = function(obj) {
17177 return !!obj.isASPxClientTextBox;
17178};
17179var ASPxClientMemo = ASPx.CreateClass(ASPxClientTextEdit, { 
17180 constructor: function(name) {
17181  this.constructor.prototype.constructor.call(this, name);        
17182  this.isASPxClientMemo = true;
17183  this.raiseValueChangedOnEnter = false;
17184  this.maxLength = 0;
17185  this.pasteTimerID = -1;
17186  this.pasteTimerActivatorCount = 0;
17187 },
17188 Initialize: function() {
17189  ASPxClientTextEdit.prototype.Initialize.call(this);
17190  this.SaveChangedValue();
17191  this.maxLengthRestricted = this.maxLength > 0;
17192 },
17193 CutString: function() {
17194  var text = this.GetText();
17195  if(text.length > this.maxLength) {
17196   text = text.substring(0, this.maxLength);
17197   this.SetText(text);
17198  }
17199 },
17200 EventKeyCodeChangesTheInput: function(evt) {
17201  if(ASPx.IsPasteShortcut(evt))
17202   return true;
17203  else if(evt.ctrlKey)
17204   return false;
17205  var keyCode = ASPx.Evt.GetKeyCode(evt);
17206  var isSystemKey = ASPx.Key.Windows <= keyCode && keyCode <= ASPx.Key.ContextMenu;
17207  var isFKey = ASPx.Key.F1 <= keyCode && keyCode <= 127; 
17208  return ASPx.Key.Delete < keyCode && !isSystemKey && !isFKey || keyCode == ASPx.Key.Enter || keyCode == ASPx.Key.Space;
17209 },
17210 OnTextChangingCheck: function() {
17211  if(this.maxLengthRestricted)  
17212   this.CutString(); 
17213 },
17214 StartTextChangingTimer: function() {
17215  if(this.maxLengthRestricted) {
17216   if(this.pasteTimerActivatorCount == 0) 
17217    this.SetTextChangingTimer();
17218   this.pasteTimerActivatorCount ++;
17219  }
17220 },
17221 EndTextChangingTimer: function() {
17222  if(this.maxLengthRestricted) {
17223   this.pasteTimerActivatorCount --;
17224   if(this.pasteTimerActivatorCount == 0) 
17225    this.ClearTextChangingTimer();
17226  }
17227 },
17228 CollapseEditor: function() {
17229  if(!this.IsAdjustmentRequired()) return;
17230  var mainElement = this.GetMainElement();
17231  var inputElement = this.GetInputElement();
17232  if(!ASPx.IsExistsElement(mainElement) || !ASPx.IsExistsElement(inputElement))
17233   return;
17234  ASPxClientTextEdit.prototype.CollapseEditor.call(this);
17235  var mainElementCurStyle = ASPx.GetCurrentStyle(mainElement);
17236  if(this.heightCorrectionRequired && mainElement && inputElement) {
17237   if(mainElement.style.height == "100%" || mainElementCurStyle.height == "100%") {
17238    mainElement.style.height = "0";
17239    mainElement.wasCollapsed = true;
17240   }
17241   inputElement.style.height = "0";
17242  }
17243 },
17244 SetWidth: function(width) {
17245  ASPxClientTextEdit.prototype.SetWidth.call(this, width);
17246  if(ASPx.Browser.IE)
17247   this.AdjustControl();
17248 },
17249 SetHeight: function(height) {
17250  var textarea = this.GetInputElement();
17251  textarea.style.height = "1px";
17252  ASPxClientTextEdit.prototype.SetHeight.call(this, height);
17253  textarea.style.height = ASPx.GetClearClientHeight(this.GetMainElement()) - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(textarea) + "px";
17254 },
17255 ClearErrorFrameElementsStyles: function() {
17256  var textarea = this.GetInputElement();
17257  if(!textarea)
17258   return;
17259  var scrollBarPosition = textarea.scrollTop;
17260  ASPxClientTextEdit.prototype.ClearErrorFrameElementsStyles.call(this);
17261  if(ASPx.Browser.Firefox)
17262   textarea.scrollTop = scrollBarPosition;
17263 },
17264 OnMouseOver: function() {
17265  this.StartTextChangingTimer();
17266 },  
17267 OnMouseOut: function() {
17268  this.EndTextChangingTimer();
17269 },   
17270 OnFocus: function() {  
17271  this.StartTextChangingTimer();
17272  ASPxClientTextEdit.prototype.OnFocus.call(this);
17273 },
17274 OnLostFocus: function() {
17275  this.EndTextChangingTimer();
17276  ASPxClientTextEdit.prototype.OnLostFocus.call(this);
17277 },
17278 OnKeyDown: function(evt) { 
17279  if(this.NeedPreventBrowserUndoBehaviour(evt))
17280   return ASPx.Evt.PreventEvent(evt);
17281  if(this.maxLengthRestricted){
17282   var selection = ASPx.Selection.GetInfo(this.GetInputElement()); 
17283   var noCharToReplace = selection.startPos == selection.endPos;
17284   if(this.GetText().length >= this.maxLength && noCharToReplace && this.EventKeyCodeChangesTheInput(evt)) {
17285    return ASPx.Evt.PreventEvent(evt);
17286   }
17287  }
17288  ASPxClientEdit.prototype.OnKeyDown.call(this, evt);
17289 },
17290 SetTextChangingTimer: function() {
17291  this.pasteTimerID = ASPx.Timer.SetControlBoundInterval(this.OnTextChangingCheck, this, ASPx.PasteCheckInterval);
17292 },
17293 ClearTextChangingTimer: function() {
17294  this.pasteTimerID = ASPx.Timer.ClearInterval(this.pasteTimerID);
17295 },
17296 getFocusedNullTextElementTagName: function() {
17297  return "TEXTAREA";
17298 },
17299 getCopyFromInputElementStyles: function() {
17300  var result = ASPxClientTextEdit.prototype.getCopyFromInputElementStyles.call(this);
17301  result.push("resize");
17302  return result;
17303 }
17304});
17305ASPxClientMemo.Cast = ASPxClientControl.Cast;
17306ASPx.Ident.IsASPxClientMemo = function(obj) { return obj && !!obj.isASPxClientMemo; };
17307var CLEAR_BUTTON_INDEX = -100;
17308var HIDE_CONTENT_CSS_CLASS_NAME = "dxHideContent";
17309var setContentVisibility = function(clearButtonElement, value) {
17310 var action = value ? ASPx.RemoveClassNameFromElement : ASPx.AddClassNameToElement;
17311 action(clearButtonElement, HIDE_CONTENT_CSS_CLASS_NAME);
17312};
17313var CLEAR_BUTTON_DISPLAY_MODE = {
17314 AUTO: 'Auto',
17315 ALWAYS: 'Always',
17316 NEVER: 'Never',
17317 ON_HOVER: 'OnHover'
17318};
17319var AccessibilityFocusedButtonClassName = "dxAFB";
17320var ASPxClientButtonEditBase = ASPx.CreateClass(ASPxClientTextBoxBase, {
17321 constructor: function(name) {
17322  this.constructor.prototype.constructor.call(this, name);        
17323  this.allowUserInput = true;
17324  this.isValueChanging = false;
17325  this.allowMouseWheel = true;
17326  this.isMouseOver = false;
17327  this.buttonCount = 0;
17328  this.emptyValueMaskDisplayText = "";
17329  this.clearButtonDisplayMode = CLEAR_BUTTON_DISPLAY_MODE.AUTO;
17330  this.forceShowClearButtonAlways = false;
17331  this.recoverClearButtonVisibility = false;
17332  this.ButtonClick = new ASPxClientEvent();
17333 },
17334 Initialize: function() {
17335  ASPxClientTextBoxBase.prototype.Initialize.call(this);
17336  this.EnsureEmptyValueMaskDisplayText();
17337  if(this.HasClearButton())
17338   this.InitializeClearButton();
17339  this.InitAccessibilityCompliant();
17340 },
17341 InlineInitialize: function() {
17342  ASPxClientTextBoxBase.prototype.InlineInitialize.call(this);
17343  if(this.clearButtonDisplayMode === CLEAR_BUTTON_DISPLAY_MODE.AUTO) {
17344   this.clearButtonDisplayMode = this.IsClearButtonVisibleAuto() || this.forceShowClearButtonAlways ?
17345    CLEAR_BUTTON_DISPLAY_MODE.ALWAYS : CLEAR_BUTTON_DISPLAY_MODE.NEVER;
17346  }
17347  this.EnsureClearButtonVisibility();
17348 },
17349 InitializeClearButton: function() {
17350  if(this.clearButtonDisplayMode === CLEAR_BUTTON_DISPLAY_MODE.ON_HOVER) {
17351   ASPx.Evt.AttachMouseEnterToElement(this.GetHoverElementToShowClearButton(), this.OnMouseOver.aspxBind(this), this.OnMouseOut.aspxBind(this));
17352  }
17353 },
17354 GetHoverElementToShowClearButton: function() {
17355  return this.GetMainElement();
17356 },
17357 IsClearButtonVisibleAuto: function() {
17358  return ASPx.Browser.MobileUI;
17359 },
17360 SetEnabled: function(enabled) {
17361  ASPxClientTextBoxBase.prototype.SetEnabled.call(this, enabled);
17362  this.EnsureClearButtonVisibility();
17363 },
17364 EnsureEmptyValueMaskDisplayText: function() {
17365  if(this.maskInfo && this.HasClearButton()) {
17366   var savedText = this.maskInfo.GetText();
17367   this.maskInfo.SetText("");
17368   this.emptyValueMaskDisplayText = this.maskInfo.GetText();
17369   this.maskInfo.SetText(savedText);
17370  }
17371 },
17372 GetButton: function(number) {
17373  return this.GetChildElement("B" + number);
17374 },
17375 GetCustomButtonCollection: function() {
17376  var buttonElements = [];
17377  for(var i = 0; i < this.buttonCount; i++) {
17378   var button =  this.GetButton(i);
17379   if(!!button)
17380    buttonElements.push(button);
17381  }
17382  return buttonElements;
17383 },
17384 GetButtonCollection: function() {
17385  var buttonElements = [];
17386  var clearButton = this.GetClearButton();
17387  if(!!clearButton)
17388   buttonElements.push(clearButton);
17389  return buttonElements.concat(this.GetCustomButtonCollection());
17390 },
17391 GetAccessibilityAnchor: function(buttonElement) {
17392  var firstChild = buttonElement.firstElementChild;
17393  var isExistsAnchorElement = ASPx.Attr.GetAttribute(firstChild, "role") === "button";
17394  return isExistsAnchorElement ? firstChild : null;
17395 },
17396 GetButtonByAccessibilityAnchor: function(anchorElement) {
17397  return anchorElement.parentNode;
17398 },
17399 SetAccessibilityAnchorEnabled: function(buttonElement, enabled) {
17400  var anchorElement = this.GetAccessibilityAnchor(buttonElement);
17401  if(ASPx.IsExists(anchorElement))
17402   ASPx.Attr.SetOrRemoveAttribute(anchorElement, "tabindex", enabled ? "0" : "");
17403 },
17404 InitAccessibilityCompliant: function() {
17405  if(!this.accessibilityCompliant) return;
17406  var buttonElements = this.GetButtonCollection();
17407  var labelElements = ASPx.FindAssociatedLabelElements(this);
17408  for(var i = 0; i < buttonElements.length; i++)
17409   this.InitAccessibilityAnchor(this.GetAccessibilityAnchor(buttonElements[i]), labelElements);     
17410 },
17411 InitAccessibilityAnchor: function(anchorElement, labelElements) {
17412  if(!ASPx.IsExists(anchorElement))
17413   return;
17414  for(var i = 0; i < labelElements.length; i++)
17415   this.ariaExplanatoryTextManager.SetOrRemoveText([anchorElement], labelElements[i], true, false, false);
17416  this.InitAccessibilityAnchorEvents(anchorElement);
17417 },
17418 InitAccessibilityAnchorEvents: function(anchorElement) {
17419  ASPx.Evt.AttachEventToElement(anchorElement, "keydown", function(evt) { this.OnButtonKeysHandling(evt); }.aspxBind(this));
17420  ASPx.Evt.AttachEventToElement(anchorElement, "keyup", function(evt) { this.OnButtonKeysHandling(evt); }.aspxBind(this));
17421  ASPx.Evt.AttachEventToElement(anchorElement, "focus", function(evt) { this.OnButtonGotFocus(evt); }.aspxBind(this));
17422  ASPx.Evt.AttachEventToElement(anchorElement, "blur", function(evt) { this.OnButtonLostFocus(evt); }.aspxBind(this));
17423 },
17424 EmulateButtonMouseEvent: function(sourceElement) {
17425  var buttonElement = this.GetButtonByAccessibilityAnchor(sourceElement);
17426  var mouseEvent = buttonElement.onclick || buttonElement.onmousedown || buttonElement.ontouchstart || buttonElement.onpointerdown;
17427  var emulateMouseEvtArgs = { button: 0, which: 1, srcElement: buttonElement, target: buttonElement };
17428  if(!!mouseEvent) {
17429   ASPx.Attr.SetAttribute(sourceElement, "aria-pressed", true);
17430   setTimeout(function() {
17431    mouseEvent(emulateMouseEvtArgs);
17432    ASPx.Attr.RemoveAttribute(sourceElement, "aria-pressed");
17433   }, 300);
17434  }
17435 },
17436 OnButtonKeysHandling: function(evt) {
17437  var isKeyUp = evt.type == "keyup";
17438  var keyCode = ASPx.Evt.GetKeyCode(evt);
17439  var sourceElement = ASPx.Evt.GetEventSource(evt);
17440  if((keyCode == ASPx.Key.Space && isKeyUp) || (keyCode == ASPx.Key.Enter && !isKeyUp))
17441   this.EmulateButtonMouseEvent(sourceElement);
17442  if(keyCode != ASPx.Key.Tab)
17443   ASPx.Evt.PreventEventAndBubble(evt);
17444  return false;
17445 },
17446 OnButtonGotFocus: function(evt) {
17447  var editor = ASPx.GetControlCollection().Get(this.name);
17448  var sourceElement = ASPx.Evt.GetEventSource(evt);
17449  if(!!editor && !editor.CorrectAccessibilityButtonFocus(sourceElement)) {
17450   var buttonElement = editor.GetButtonByAccessibilityAnchor(sourceElement);
17451   ASPx.AddClassNameToElement(buttonElement, this.GetAccessibilityFocusedButtonClassName());
17452   ASPx.EGotFocus(editor.name);
17453   if(editor.specialKeyboardHandlingUsed)
17454    ASPx.ESGotFocus(editor.name);
17455  }
17456 },
17457 OnButtonLostFocus: function(evt) {
17458  var editor = ASPx.GetControlCollection().Get(this.name);
17459  var sourceElement = ASPx.Evt.GetEventSource(evt);
17460  if(!!editor) {
17461   var buttonElement = editor.GetButtonByAccessibilityAnchor(sourceElement);
17462   ASPx.RemoveClassNameFromElement(buttonElement, this.GetAccessibilityFocusedButtonClassName());
17463  }
17464  setTimeout(function() {
17465   if(!!editor && !editor.IsEditorElement(ASPx.GetActiveElement())) {
17466    ASPx.ELostFocus(editor.name);
17467    if(editor.specialKeyboardHandlingUsed)
17468     ASPx.ESLostFocus(editor.name);
17469   }
17470  }.aspxBind(this), 0);
17471 },
17472 ForceRefocusEditor: function(evt, isNativeFocus) {
17473  if(this.accessibilityCompliant) {
17474   var srcElement = ASPx.Evt.GetEventSource(evt);
17475   var customButtons = this.GetCustomButtonCollection();
17476   for(var i = 0; i < customButtons.length; i++)
17477    if(customButtons[i] == srcElement || ASPx.GetIsParent(customButtons[i], srcElement))
17478     return;
17479  }
17480  ASPxClientEdit.prototype.ForceRefocusEditor.call(this, evt, isNativeFocus);
17481  if(this.GetInputElement().type == "password") {
17482   window.setTimeout(function() { this.GetInputElement().focus(); }.bind(this), 0);
17483  }
17484 },
17485 CorrectAccessibilityButtonFocus: function(sourceElement) {
17486  if(ASPx.Attr.IsExistsAttribute(sourceElement, "tabindex"))
17487   return false;
17488  setTimeout(function() {
17489   var buttonElements = this.GetButtonCollection();
17490   for(var i = 0; i < buttonElements.length; i++)
17491    if(ASPx.GetIsParent(buttonElements[i], sourceElement))
17492     this.GetAccessibilityAnchor(buttonElements[i]).focus();
17493  }.aspxBind(this), 0);
17494  return true;
17495 },
17496 OnKeyDown: function(evt) { 
17497  if(this.NeedEnsureClearButtonVisibilityOnKeyDown()) {
17498   var hasClearButtonOnHover = this.HasClearButton() && this.clearButtonDisplayMode === CLEAR_BUTTON_DISPLAY_MODE.ON_HOVER;
17499   this.recoverClearButtonVisibility = hasClearButtonOnHover && ASPx.Evt.GetKeyCode(evt) == ASPx.Key.Tab && !evt.shiftKey;
17500  }
17501  ASPxClientTextBoxBase.prototype.OnKeyDown.call(this, evt);
17502 },
17503 NeedEnsureClearButtonVisibilityOnKeyDown: function() {
17504  return this.accessibilityCompliant;
17505 },
17506 GetAccessibilityFocusedButtonClassName: function() {
17507  return AccessibilityFocusedButtonClassName;
17508 },
17509 SetButtonVisible: function(number, value) {
17510  var button = this.GetButton(number);
17511  if(!button)
17512   return;
17513  var isAlwaysShownClearButton = number === CLEAR_BUTTON_INDEX && this.clearButtonDisplayMode === CLEAR_BUTTON_DISPLAY_MODE.ALWAYS;
17514  var visibilityModifier = isAlwaysShownClearButton ? setContentVisibility : ASPx.SetElementDisplay;
17515  if(isAlwaysShownClearButton && this.accessibilityCompliant && this.enabled)
17516   this.SetAccessibilityAnchorEnabled(button, value);
17517  visibilityModifier(button, value);
17518 },
17519 GetButtonVisible: function(number) {
17520  var button = this.GetButton(number);
17521  if(number === CLEAR_BUTTON_INDEX && this.clearButtonDisplayMode === CLEAR_BUTTON_DISPLAY_MODE.ALWAYS)
17522   return button && !ASPx.ElementHasCssClass(button, this.GetHideContentCssClassName());
17523  return button && ASPx.IsElementVisible(button);
17524 },
17525 GetHideContentCssClassName: function() {
17526  return HIDE_CONTENT_CSS_CLASS_NAME;
17527 },
17528 ProcessInternalButtonClick: function(buttonIndex) {
17529  return false;
17530 },
17531 OnButtonClick: function(number) {
17532  var processOnServer = this.RaiseButtonClick(number);
17533  if(!this.ProcessInternalButtonClick(number) && processOnServer)
17534   this.SendPostBack('BC:' + number);
17535 },
17536 GetLastSuccesfullValue: function() {
17537  return this.lastChangedValue;
17538 },
17539 OnClear: function() {
17540  this.startUserInputEventTimerIfRequired();
17541  this.ClearEditorValueAndForceOnChange();
17542  this.ForceRefocusEditor(null, true);
17543  window.setTimeout(this.EnsureClearButtonVisibility.aspxBind(this), 0);
17544 },
17545 ClearEditorValueAndForceOnChange: function() {
17546  if(this.GetReadOnly() || !this.GetButtonVisible(CLEAR_BUTTON_INDEX))
17547   return;
17548  var raiseOnChange = this.ClearEditorValueByClearButton();
17549  if(raiseOnChange)
17550   this.ForceStandardOnChange();
17551 },
17552 ClearEditorValueByClearButton: function() {
17553  var prevValue = this.GetLastSuccesfullValue();
17554  this.ClearEditorValueByClearButtonCore();
17555  return prevValue !== this.GetValue();
17556 },
17557 ClearEditorValueByClearButtonCore: function() {
17558  this.Clear();
17559  this.GetInputElement().value = '';
17560 },
17561 ForceStandardOnChange: function() {
17562  this.forceValueChanged = true;
17563  this.RaiseStandardOnChange();
17564  this.forceValueChanged = false;
17565 },
17566 IsValueChangeForced: function() {
17567  return this.forceValueChanged || ASPxClientTextBoxBase.prototype.IsValueChangeForced.call(this);
17568 },
17569 IsValueChanging: function() { return this.isValueChanging; },
17570 StartValueChanging: function() { this.isValueChanging = true; },
17571 EndValueChanging: function() { this.isValueChanging = false; },
17572 IsClearButtonElement: function(element) {
17573  return ASPx.GetIsParent(this.GetClearButton(), element);
17574 },
17575 OnFocusCore: function() {
17576  ASPxClientTextBoxBase.prototype.OnFocusCore.call(this);
17577  this.EnsureClearButtonVisibility();
17578 },
17579 OnLostFocusCore: function() {
17580  ASPxClientTextBoxBase.prototype.OnLostFocusCore.call(this);
17581  this.EnsureClearButtonVisibility();
17582  this.recoverClearButtonVisibility = false;
17583 },
17584 GetClearButton: function() {
17585  return this.GetButton(CLEAR_BUTTON_INDEX);
17586 },
17587 HasClearButton: function() {
17588  return !!this.GetClearButton();
17589 },
17590 RequireShowClearButton: function() {
17591  return !this.IsClearButtonDisabled() && !this.IsClearButtonNotRequired() && this.RequireShowClearButtonInternal();
17592 },
17593 IsClearButtonDisabled: function() {
17594  return !this.clientEnabled || !this.HasClearButton() || this.clearButtonDisplayMode === CLEAR_BUTTON_DISPLAY_MODE.NEVER;
17595 },
17596 IsClearButtonNotRequired: function() {
17597  return !this.IsFocused() && !this.isMouseOver && this.clearButtonDisplayMode !== CLEAR_BUTTON_DISPLAY_MODE.ALWAYS && !this.recoverClearButtonVisibility;
17598 },
17599 RequireShowClearButtonInternal: function () {
17600  return this.IsFocused() && this.RequireShowClearButtonCore() || !this.IsNullState();
17601 },
17602 RequireShowClearButtonCore: function() {
17603  var inputText = this.GetInputElement().value;
17604  return inputText !== this.GetEmptyValueDisplayText();
17605 },
17606 IsFocused: function() {
17607  return this === ASPx.GetFocusedEditor();
17608 },
17609 IsNullState: function() {
17610  var value = this.GetValue();
17611  return this.IsNull(value) || value === this.GetEmptyValueDisplayText();
17612 },
17613 GetEmptyValueDisplayText: function() { 
17614  return this.maskInfo ? this.emptyValueMaskDisplayText : "";
17615 },
17616 EnsureClearButtonVisibility: function() {
17617  this.SetButtonVisible(CLEAR_BUTTON_INDEX, this.RequireShowClearButton());
17618 },
17619 OnMouseOver: function() {
17620  this.isMouseOver = true;
17621  this.EnsureClearButtonVisibility();
17622 },
17623 OnMouseOut: function() {
17624  this.isMouseOver = false;
17625  this.EnsureClearButtonVisibility();
17626 },
17627 OnKeyPress: function(evt) {
17628  if(this.allowUserInput)
17629   ASPxClientTextBoxBase.prototype.OnKeyPress.call(this, evt);
17630 },
17631 OnKeyEventEnd: function(evt, withDelay) {
17632  ASPxClientTextBoxBase.prototype.OnKeyEventEnd.call(this, evt, withDelay);
17633  this.EnsureClearButtonVisibility();
17634 },
17635 RaiseButtonClick: function(number){
17636  var processOnServer = this.autoPostBack || this.IsServerEventAssigned("ButtonClick");
17637  if(!this.ButtonClick.IsEmpty()){
17638   var args = new ASPxClientButtonEditClickEventArgs(processOnServer, number);
17639   this.ButtonClick.FireEvent(this, args);
17640   processOnServer = args.processOnServer;
17641  }
17642  return processOnServer;
17643 },
17644 ChangeEnabledAttributes: function(enabled){
17645  ASPxClientTextEdit.prototype.ChangeEnabledAttributes.call(this, enabled);
17646  for(var i = 0; i < this.buttonCount; i++){
17647   var element = this.GetButton(i);
17648   if(element)
17649    this.ChangeButtonEnabledAttributes(element, this.GetChangeButtonEnabledAttributesMethod(enabled));
17650  }
17651  if(this.accessibilityCompliant)
17652   this.ChangeAccessibilityButtonEnabledAttributes(enabled);
17653 },
17654 ChangeEnabledStateItems: function(enabled){
17655  ASPxClientTextEdit.prototype.ChangeEnabledStateItems.call(this, enabled);
17656  for(var i = 0; i < this.buttonCount; i++){
17657   var element = this.GetButton(i);
17658   if(element) 
17659    ASPx.GetStateController().SetElementEnabled(element, enabled);
17660  }
17661 },
17662 GetChangeButtonEnabledAttributesMethod: function(enabled) {
17663  return ASPx.Attr.ChangeAttributesMethod(enabled);
17664 },
17665 ChangeButtonEnabledAttributes: function(element, method){
17666  method(element, "onclick");
17667  method(element, "ondblclick");
17668  if(ASPx.Browser.Edge)
17669   method(element, "onmousedown");
17670  method(element, "on" + ASPx.TouchUIHelper.touchMouseDownEventName);
17671  method(element, "on" + ASPx.TouchUIHelper.touchMouseUpEventName);
17672 },
17673 ChangeInputEnabled: function(element, enabled, readOnly) {
17674  ASPxClientTextEdit.prototype.ChangeInputEnabled.call(this, element, enabled, readOnly || !this.allowUserInput);
17675 },
17676 ChangeAccessibilityButtonEnabledAttributes: function(enabled) {
17677  var buttonElements = this.GetButtonCollection();
17678  for(var i = 0; i < buttonElements.length; i++)
17679   this.SetAccessibilityAnchorEnabled(buttonElements[i], enabled);
17680 },
17681 SetValue: function(value) {
17682  ASPxClientTextEdit.prototype.SetValue.call(this, value);
17683  if(!this.IsFocused())
17684   this.EnsureClearButtonVisibility();
17685 },
17686 OnAssociatedLabelClick: function(focusableElement) {
17687  var isValidElement = focusableElement && ASPx.IsActionElement(focusableElement) && ASPx.GetIsParent(this.GetMainElement(), focusableElement) && ASPx.IsElementVisible(focusableElement);
17688  if(isValidElement)
17689   focusableElement.focus();
17690  else
17691   this.SetFocus();
17692 },
17693 onClearButtonClick: function() {
17694  var requireFocus = !ASPx.Browser.VirtualKeyboardSupported || ASPx.Browser.MSTouchUI;
17695  if(this.ownerListBox)
17696   this.ownerListBox.ForceLockFocusEvents();
17697  if(requireFocus && !this.IsFocused())
17698   this.GetInputElement().focus();
17699  if(this.IsFocused() || !requireFocus) {
17700   if(this.ownerListBox)
17701    this.ownerListBox.UnlockFocusEvents();
17702   this.OnClear();
17703  }
17704  else
17705   window.setTimeout(this.onClearButtonClick.bind(this), 100);
17706 }
17707});
17708var ASPxClientButtonEdit = ASPx.CreateClass(ASPxClientButtonEditBase, {
17709});
17710ASPxClientButtonEdit.Cast = ASPxClientControl.Cast;
17711var ASPxClientButtonEditClickEventArgs = ASPx.CreateClass(ASPxClientProcessingModeEventArgs, {
17712 constructor: function(processOnServer, buttonIndex){
17713  this.constructor.prototype.constructor.call(this, processOnServer);
17714  this.buttonIndex = buttonIndex;
17715 }
17716});
17717var ASPxClientTextEditHelpTextHAlign = {
17718 Left: "Left",
17719 Right: "Right",
17720 Center: "Center"
17721};
17722var ASPxClientTextEditHelpTextVAlign = {
17723 Top: "Top",
17724 Bottom: "Bottom",
17725 Middle: "Middle"
17726};
17727var ASPxClientTextEditHelpTextDisplayMode = {
17728 Inline: "Inline",
17729 Popup: "Popup"
17730};
17731var ASPxClientTextEditHelpTextConsts = {
17732 VERTICAL_ORIENTATION_CLASS_NAME: "dxeVHelpTextSys",
17733 HORIZONTAL_ORIENTATION_CLASS_NAME: "dxeHHelpTextSys"
17734};
17735var ASPxClientTextEditHelpText = ASPx.CreateClass(null, {
17736 constructor: function (editor, helpTextStyle, helpText, position, hAlign, vAlign, margins, animationEnabled, helpTextDisplayMode) {
17737  this.hAlign = hAlign;
17738  this.vAlign = vAlign;
17739  this.animationEnabled = animationEnabled;
17740  this.displayMode = helpTextDisplayMode;
17741  this.editor = editor;
17742  this.editorMainElement = editor.GetMainElement();
17743  this.margins = margins ? { Top: margins[0], Right: margins[1], Bottom: margins[2], Left: margins[3] } : null;
17744  this.defaultMargins = { Top: 10, Right: 10, Bottom: 10, Left: 10 };
17745  this.position = position;
17746  this.helpTextElement = this.createHelpTextElement();
17747  this.setHelpTextZIndex(true);
17748  this.prepareHelpTextElement(helpTextStyle, helpText);
17749 },
17750 getRows: function (table) {
17751  return ASPx.GetChildNodesByTagName(table, "TR");
17752 },
17753 getCells: function (row) {
17754  return ASPx.GetChildNodesByTagName(row, "TD");
17755 },
17756 getCellByIndex: function(row, cellIndex) {
17757  return this.getCells(row)[cellIndex];
17758 },
17759 getCellIndex: function(row, cell) {
17760  var cells = this.getCells(row);
17761  for(var i = 0; i < cells.length; i++) {
17762   if(cells[i] === cell)
17763    return i;
17764  }
17765 },
17766 isHorizontal: function(position) {
17767  return position === ASPx.Position.Left || position === ASPx.Position.Right;
17768 },
17769 isVertical: function (position) {
17770  return position === ASPx.Position.Top || position === ASPx.Position.Bottom;
17771 },
17772 createEmptyCell: function(assignClassName) {
17773  var cell = document.createElement("TD");
17774  if(assignClassName)
17775   cell.className = "dxeFakeEmptyCell";
17776  return cell;
17777 },
17778 addHelpTextCellToExternalTableWithTwoCells: function (captionCell, errorCell, helpTextCell, errorTableBody, tableRows) {
17779  var captionPosition = this.editor.captionPosition;
17780  var errorCellPosition = this.editor.errorCellPosition;
17781  var helpTextRow = this.isVertical(this.position) ? document.createElement("TR") : null;
17782  if(captionPosition === ASPx.Position.Left && this.position === ASPx.Position.Left && this.isHorizontal(errorCellPosition))
17783   captionCell.parentNode.insertBefore(helpTextCell, captionCell.nextSibling);
17784  if(captionPosition === ASPx.Position.Right && this.position === ASPx.Position.Right && this.isHorizontal(errorCellPosition))
17785   captionCell.parentNode.insertBefore(helpTextCell, captionCell);
17786  if(captionPosition === ASPx.Position.Left && this.position === ASPx.Position.Right && this.isHorizontal(errorCellPosition))
17787   tableRows[0].appendChild(helpTextCell);
17788  if(captionPosition === ASPx.Position.Right && this.position === ASPx.Position.Left && this.isHorizontal(errorCellPosition))
17789   tableRows[0].insertBefore(helpTextCell, tableRows[0].childNodes[0]);
17790  if(captionPosition === ASPx.Position.Top && this.position === ASPx.Position.Bottom && this.isVertical(errorCellPosition)) {
17791   helpTextRow.appendChild(helpTextCell);
17792   errorTableBody.appendChild(helpTextRow);
17793  }
17794  if(captionPosition === ASPx.Position.Bottom && this.position === ASPx.Position.Top && this.isVertical(errorCellPosition)) {
17795   helpTextRow.appendChild(helpTextCell);
17796   errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
17797  }
17798  if(captionPosition === ASPx.Position.Top && this.position === ASPx.Position.Top && this.isVertical(errorCellPosition)) {
17799   helpTextRow.appendChild(helpTextCell);
17800   errorTableBody.insertBefore(helpTextRow, captionCell.parentNode.nextSibling);
17801  }
17802  if(captionPosition === ASPx.Position.Bottom && this.position === ASPx.Position.Bottom && this.isVertical(errorCellPosition)) {
17803   helpTextRow.appendChild(helpTextCell);
17804   errorTableBody.insertBefore(helpTextRow, captionCell.parentNode);
17805  }
17806  if(captionPosition === ASPx.Position.Right && this.position === ASPx.Position.Top && this.isVertical(errorCellPosition)) {
17807   helpTextRow.appendChild(helpTextCell);
17808   helpTextRow.appendChild(this.createEmptyCell());
17809   errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
17810  }
17811  if(this.position === ASPx.Position.Bottom) {
17812   if(captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Top || captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Right) {
17813    helpTextRow.appendChild(helpTextCell);
17814    helpTextRow.appendChild(this.createEmptyCell());
17815    errorTableBody.appendChild(helpTextRow);
17816   }
17817  }
17818  if(captionPosition === ASPx.Position.Left && this.position === ASPx.Position.Top && this.isVertical(errorCellPosition)) {
17819   helpTextRow.appendChild(this.createEmptyCell());
17820   helpTextRow.appendChild(helpTextCell);
17821   errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
17822  }
17823  if(captionPosition === ASPx.Position.Left && this.position === ASPx.Position.Bottom && this.isVertical(errorCellPosition)) {
17824   helpTextRow.appendChild(this.createEmptyCell());
17825   helpTextRow.appendChild(helpTextCell);
17826   errorTableBody.appendChild(helpTextRow);
17827  }
17828  if(this.position === ASPx.Position.Right) {
17829   if(captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Left || captionPosition === ASPx.Position.Left && errorCellPosition === ASPx.Position.Top
17830    || captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Right) {
17831    tableRows[1].appendChild(helpTextCell);
17832    tableRows[0].appendChild(this.createEmptyCell());
17833   }
17834   if(captionPosition === ASPx.Position.Left && errorCellPosition === ASPx.Position.Bottom || captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Left) {
17835    tableRows[0].appendChild(helpTextCell);
17836    tableRows[1].appendChild(this.createEmptyCell());
17837   }
17838  }
17839  if(this.position === ASPx.Position.Left) {
17840   if(captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Top || captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Right
17841    || captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Left) {
17842    tableRows[1].insertBefore(helpTextCell, tableRows[1].childNodes[0]);
17843    tableRows[0].insertBefore(this.createEmptyCell(), tableRows[0].childNodes[0]);
17844   }
17845   if(captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Top || captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Bottom) {
17846    tableRows[1].insertBefore(helpTextCell, tableRows[1].childNodes[0]);
17847    tableRows[0].insertBefore(this.createEmptyCell(errorCellPosition === ASPx.Position.Top), tableRows[0].childNodes[0]);
17848    tableRows[2].insertBefore(this.createEmptyCell(errorCellPosition !== ASPx.Position.Top), tableRows[2].childNodes[0]);
17849   }
17850   if(captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Top) {
17851    tableRows[2].insertBefore(helpTextCell, tableRows[2].childNodes[0]);
17852    tableRows[0].insertBefore(this.createEmptyCell(false), tableRows[0].childNodes[0]);
17853    tableRows[1].insertBefore(this.createEmptyCell(true), tableRows[1].childNodes[0]);
17854   }
17855   if(captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Bottom) {
17856    tableRows[0].insertBefore(helpTextCell, tableRows[0].childNodes[0]);
17857    tableRows[1].insertBefore(this.createEmptyCell(true), tableRows[1].childNodes[0]);
17858    tableRows[2].insertBefore(this.createEmptyCell(false), tableRows[2].childNodes[0]);
17859   }
17860   if(captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Left || captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Bottom
17861    || captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Right) {
17862    tableRows[0].insertBefore(helpTextCell, tableRows[0].childNodes[0]);
17863    tableRows[1].insertBefore(this.createEmptyCell(), tableRows[1].childNodes[0]);
17864   }
17865   if(captionPosition === ASPx.Position.Left && this.isVertical(errorCellPosition)) {
17866    captionCell.parentNode.insertBefore(helpTextCell, captionCell.nextSibling);
17867    var emptyCellParentRow = errorCellPosition === ASPx.Position.Top ? tableRows[0] : tableRows[1];
17868    var helpTextCellIndex = this.getCellIndex(helpTextCell.parentNode, helpTextCell);
17869    emptyCellParentRow.insertBefore(this.createEmptyCell(), this.getCellByIndex(emptyCellParentRow, helpTextCellIndex));
17870   }
17871  }
17872  if(this.position === ASPx.Position.Right) {
17873   if(captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Top || captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Bottom) {
17874    tableRows[1].appendChild(helpTextCell);
17875    tableRows[0].appendChild(this.createEmptyCell(errorCellPosition === ASPx.Position.Top));
17876    tableRows[2].appendChild(this.createEmptyCell(errorCellPosition !== ASPx.Position.Top));
17877   }
17878   if(captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Top) {
17879    tableRows[2].appendChild(helpTextCell);
17880    tableRows[0].appendChild(this.createEmptyCell(false));
17881    tableRows[1].appendChild(this.createEmptyCell(true));
17882   }
17883   if(captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Bottom) {
17884    tableRows[0].appendChild(helpTextCell);
17885    tableRows[1].appendChild(this.createEmptyCell(true));
17886    tableRows[2].appendChild(this.createEmptyCell(false));
17887   }
17888   if(captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Right) {
17889    tableRows[0].appendChild(helpTextCell);
17890    tableRows[1].appendChild(this.createEmptyCell());
17891   }
17892   if(captionPosition === ASPx.Position.Right && this.isVertical(errorCellPosition)) {
17893    captionCell.parentNode.insertBefore(helpTextCell, captionCell);
17894    var emptyCellParentRow = errorCellPosition === ASPx.Position.Top ? tableRows[0] : tableRows[1];
17895    var helpTextCellIndex = this.getCellIndex(helpTextCell.parentNode, helpTextCell);
17896    emptyCellParentRow.insertBefore(this.createEmptyCell(), this.getCellByIndex(emptyCellParentRow, helpTextCellIndex));
17897   }
17898  }
17899  if(captionPosition === ASPx.Position.Top && this.position === ASPx.Position.Top && this.isHorizontal(errorCellPosition)) {
17900   if(errorCellPosition === ASPx.Position.Left) {
17901    helpTextRow.appendChild(this.createEmptyCell(true));
17902    helpTextRow.appendChild(helpTextCell);
17903   }
17904   else {
17905    helpTextRow.appendChild(helpTextCell);
17906    helpTextRow.appendChild(this.createEmptyCell());
17907   }
17908   errorTableBody.insertBefore(helpTextRow, captionCell.parentNode.nextSibling);
17909  }
17910  if(captionPosition === ASPx.Position.Bottom && this.position === ASPx.Position.Top && this.isHorizontal(errorCellPosition)) {
17911   if(errorCellPosition === ASPx.Position.Left) {
17912    helpTextRow.appendChild(this.createEmptyCell(true));
17913    helpTextRow.appendChild(helpTextCell);
17914   }
17915   else {
17916    helpTextRow.appendChild(helpTextCell);
17917    helpTextRow.appendChild(this.createEmptyCell());
17918   }
17919   errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
17920  }
17921  if(captionPosition === ASPx.Position.Bottom && this.position === ASPx.Position.Bottom && this.isHorizontal(errorCellPosition)) {
17922   if(errorCellPosition === ASPx.Position.Left) {
17923    helpTextRow.appendChild(this.createEmptyCell(true));
17924    helpTextRow.appendChild(helpTextCell);
17925   }
17926   else {
17927    helpTextRow.appendChild(helpTextCell);
17928    helpTextRow.appendChild(this.createEmptyCell());
17929   }
17930   errorTableBody.insertBefore(helpTextRow, captionCell.parentNode);
17931  }
17932  if(captionPosition === ASPx.Position.Top && this.position === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Left) {
17933   helpTextRow.appendChild(this.createEmptyCell(true));
17934   helpTextRow.appendChild(helpTextCell);
17935   errorTableBody.appendChild(helpTextRow);
17936  }
17937  if(captionPosition === ASPx.Position.Right && this.position === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Bottom) {
17938   helpTextRow.appendChild(helpTextCell);
17939   helpTextRow.appendChild(this.createEmptyCell());
17940   errorTableBody.appendChild(helpTextRow);
17941  }
17942  if(this.position === ASPx.Position.Bottom) {
17943   if(captionPosition === ASPx.Position.Left && errorCellPosition === ASPx.Position.Right || captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Left) {
17944    helpTextRow.appendChild(this.createEmptyCell(errorCellPosition !== ASPx.Position.Right));
17945    helpTextRow.appendChild(helpTextCell);
17946    helpTextRow.appendChild(this.createEmptyCell(errorCellPosition === ASPx.Position.Right));
17947    errorTableBody.appendChild(helpTextRow);
17948   }
17949   if(captionPosition === ASPx.Position.Left && errorCellPosition === ASPx.Position.Left) {
17950    helpTextRow.appendChild(this.createEmptyCell(false));
17951    helpTextRow.appendChild(this.createEmptyCell(true));
17952    helpTextRow.appendChild(helpTextCell);
17953    errorTableBody.appendChild(helpTextRow);
17954   }
17955   if(captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Right) {
17956    helpTextRow.appendChild(helpTextCell);
17957    helpTextRow.appendChild(this.createEmptyCell(true));
17958    helpTextRow.appendChild(this.createEmptyCell(false));
17959    errorTableBody.appendChild(helpTextRow);
17960   }   
17961  }
17962  if(this.position === ASPx.Position.Top) {
17963   if(captionPosition === ASPx.Position.Left && errorCellPosition === ASPx.Position.Right || captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Left) {
17964    helpTextRow.appendChild(this.createEmptyCell(errorCellPosition !== ASPx.Position.Right));
17965    helpTextRow.appendChild(helpTextCell);
17966    helpTextRow.appendChild(this.createEmptyCell(errorCellPosition === ASPx.Position.Right));
17967    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
17968   }
17969   if(captionPosition === ASPx.Position.Left && errorCellPosition === ASPx.Position.Left) {
17970    helpTextRow.appendChild(this.createEmptyCell(false));
17971    helpTextRow.appendChild(this.createEmptyCell(true));
17972    helpTextRow.appendChild(helpTextCell);
17973    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
17974   }
17975   if(captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Right) {
17976    helpTextRow.appendChild(helpTextCell);
17977    helpTextRow.appendChild(this.createEmptyCell(true));
17978    helpTextRow.appendChild(this.createEmptyCell(false));
17979    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
17980   }
17981  }
17982 },
17983 addHelpTextCellToExternalTableWithErrorCell: function (errorCell, helpTextCell, errorTableBody, tableRows) {
17984  var errorCellPosition = this.editor.
17984errorCellPosition;
17985  var helpTextRow = document.createElement("TR");
17986  if(this.position === ASPx.Position.Left && this.isHorizontal(errorCellPosition))
17987   tableRows[0].insertBefore(helpTextCell, tableRows[0].childNodes[0]);
17988  if(this.position === ASPx.Position.Right && this.isHorizontal(errorCellPosition))
17989   tableRows[0].appendChild(helpTextCell);
17990  if(this.position === ASPx.Position.Top && this.isVertical(errorCellPosition)) {
17991   helpTextRow.appendChild(helpTextCell);
17992   errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
17993  }
17994  if(this.position === ASPx.Position.Bottom && this.isVertical(errorCellPosition)) {
17995   helpTextRow.appendChild(helpTextCell);
17996   errorTableBody.appendChild(helpTextRow);
17997  }
17998  if(errorCellPosition === ASPx.Position.Left && this.isVertical(this.position)) {
17999   helpTextRow.appendChild(this.createEmptyCell(true));
18000   helpTextRow.appendChild(helpTextCell);
18001   if(this.position === ASPx.Position.Top)
18002    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
18003   else
18004    errorTableBody.appendChild(helpTextRow);
18005  }
18006  if(errorCellPosition === ASPx.Position.Right && this.isVertical(this.position)) {
18007   helpTextRow.appendChild(helpTextCell);
18008   helpTextRow.appendChild(this.createEmptyCell(true));
18009   if(this.position === ASPx.Position.Top)
18010    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
18011   else
18012    errorTableBody.appendChild(helpTextRow);
18013  }
18014  if(this.position === ASPx.Position.Left && this.isVertical(errorCellPosition)) {
18015   var helpTextParentRowIndex = errorCellPosition === ASPx.Position.Top ? 1 : 0;
18016   var emptyCellRowIndex = helpTextParentRowIndex === 0 ? 1 : 0;
18017   tableRows[helpTextParentRowIndex].insertBefore(helpTextCell, tableRows[helpTextParentRowIndex].childNodes[0]);
18018   tableRows[emptyCellRowIndex].insertBefore(this.createEmptyCell(true), tableRows[emptyCellRowIndex].childNodes[0]);
18019  }
18020  if(this.position === ASPx.Position.Right && this.isVertical(errorCellPosition)) {
18021   var helpTextParentRowIndex = errorCellPosition === ASPx.Position.Top ? 1 : 0;
18022   var emptyCellRowIndex = helpTextParentRowIndex === 0 ? 1 : 0;
18023   tableRows[helpTextParentRowIndex].appendChild(helpTextCell);
18024   tableRows[emptyCellRowIndex].appendChild(this.createEmptyCell(true));
18025  }
18026 },
18027 addHelpTextCellToExternalTableWithCaption: function (captionCell, helpTextCell, errorTableBody, tableRows) {
18028  var captionPosition = this.editor.captionPosition;
18029  var helpTextRow = document.createElement("TR");
18030  if(captionPosition === ASPx.Position.Left && this.isVertical(this.position)) {
18031   helpTextRow.appendChild(this.createEmptyCell());
18032   helpTextRow.appendChild(helpTextCell);
18033   if(this.position === ASPx.Position.Top)
18034    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
18035   else
18036    errorTableBody.appendChild(helpTextRow);
18037  }
18038  if(this.position === ASPx.Position.Left && this.isVertical(captionPosition)) {
18039   var helpTextParentRowIndex = captionPosition === ASPx.Position.Top ? 1 : 0;
18040   var emptyCellParentRowIndex = helpTextParentRowIndex === 0 ? 1 : 0;
18041   tableRows[helpTextParentRowIndex].insertBefore(helpTextCell, tableRows[helpTextParentRowIndex].childNodes[0]);
18042   tableRows[emptyCellParentRowIndex].insertBefore(this.createEmptyCell(), tableRows[emptyCellParentRowIndex].childNodes[0]);
18043  }
18044  if(this.position === ASPx.Position.Right && this.isVertical(captionPosition)) {
18045   var helpTextParentRowIndex = captionPosition === ASPx.Position.Top ? 1 : 0;
18046   var emptyCellParentRowIndex = helpTextParentRowIndex === 0 ? 1 : 0;
18047   tableRows[helpTextParentRowIndex].appendChild(helpTextCell);
18048   tableRows[emptyCellParentRowIndex].appendChild(this.createEmptyCell());
18049  }
18050  if(captionPosition === ASPx.Position.Right && this.isVertical(this.position)) {
18051   helpTextRow.appendChild(helpTextCell);
18052   helpTextRow.appendChild(this.createEmptyCell());
18053   if(this.position === ASPx.Position.Top)
18054    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
18055   else
18056    errorTableBody.appendChild(helpTextRow);
18057  }
18058  if(this.isVertical(captionPosition) && this.isVertical(this.position)) {
18059   helpTextRow.appendChild(helpTextCell);
18060   if(captionPosition === ASPx.Position.Top && this.position === ASPx.Position.Top)
18061    errorTableBody.insertBefore(helpTextRow, captionCell.parentNode.nextSibling);
18062   if(captionPosition === ASPx.Position.Top && this.position === ASPx.Position.Bottom)
18063    errorTableBody.appendChild(helpTextRow);
18064   if(captionPosition === ASPx.Position.Bottom && this.position === ASPx.Position.Top)
18065    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
18066   if(captionPosition === ASPx.Position.Bottom && this.position === ASPx.Position.Bottom)
18067    errorTableBody.insertBefore(helpTextRow, captionCell.parentNode);
18068  }
18069  if(captionPosition === ASPx.Position.Left && this.position === ASPx.Position.Left)
18070   captionCell.parentNode.insertBefore(helpTextCell, captionCell.nextSibling);
18071  if(captionPosition === ASPx.Position.Right && this.position === ASPx.Position.Right)
18072   captionCell.parentNode.insertBefore(helpTextCell, captionCell);
18073  if(captionPosition === ASPx.Position.Left && this.position === ASPx.Position.Right)
18074   tableRows[0].appendChild(helpTextCell);
18075  if(captionPosition === ASPx.Position.Right && this.position === ASPx.Position.Left)
18076   tableRows[0].insertBefore(helpTextCell, tableRows[0].childNodes[0]);
18077 },
18078 addHelpTextCellToExternalTableWithEditorOnly: function (helpTextCell, errorTableBody, tableRows) {
18079  if(this.isHorizontal(this.position)) {
18080   if(this.position === ASPx.Position.Left)
18081    tableRows[0].insertBefore(helpTextCell, tableRows[0].childNodes[0]);
18082   else
18083    tableRows[0].appendChild(helpTextCell);
18084  }
18085  else {
18086   var helpTextRow = document.createElement("TR");
18087   helpTextRow.appendChild(helpTextCell);
18088   if(this.position === ASPx.Position.Top)
18089    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
18090   else
18091    errorTableBody.appendChild(helpTextRow);
18092  }
18093 },
18094 addHelpTextCellToExternalTable: function (errorTable, helpTextCell) {
18095  var errorTableBody = ASPx.GetNodeByTagName(errorTable, "TBODY", 0);
18096  var tableRows = this.getRows(errorTableBody);
18097  var captionCell = this.editor.GetCaptionCell();
18098  var errorCell = this.editor.GetErrorCell();
18099  if(captionCell) {
18100   if(errorCell)
18101    this.addHelpTextCellToExternalTableWithTwoCells(captionCell, errorCell, helpTextCell, errorTableBody, tableRows);
18102   else
18103    this.addHelpTextCellToExternalTableWithCaption(captionCell, helpTextCell, errorTableBody, tableRows);
18104  }
18105  else if(errorCell)
18106   this.addHelpTextCellToExternalTableWithErrorCell(errorCell, helpTextCell, errorTableBody, tableRows);
18107  else
18108   this.addHelpTextCellToExternalTableWithEditorOnly(helpTextCell, errorTableBody, tableRows);
18109 },
18110 createExternalTable: function () {
18111  var externalTable = document.createElement("TABLE");
18112  externalTable.id = this.editor.name + ASPx.EditElementSuffix.ExternalTable;
18113  externalTable.cellPadding = 0;
18114  externalTable.cellSpacing = 0;
18115  this.applyExternalTableStyle(externalTable);
18116  var editorWidth = this.editorMainElement.style.width;
18117  if(ASPx.IsPercentageSize(editorWidth)) {
18118   externalTable.style.width = editorWidth;
18119   this.editorMainElement.style.width = "100%";
18120   this.editor.width = "100%";
18121  }
18122  var externalTableBody = document.createElement("TBODY");
18123  var externalTableRow = document.createElement("TR");
18124  var externalTableCell = document.createElement("TD");
18125  externalTable.appendChild(externalTableBody);
18126  externalTableBody.appendChild(externalTableRow);
18127  externalTableRow.appendChild(externalTableCell);
18128  this.editorMainElement.parentNode.appendChild(externalTable);
18129  ASPx.ChangeElementContainer(this.editorMainElement, externalTableCell, true);
18130  if(this.editor.accessibilityCompliant)
18131   ASPx.Attr.SetAttribute(externalTable, "role", "presentation");
18132  return externalTable;
18133 },
18134 applyExternalTableStyle: function (externalTable) {
18135  var externalTableStyle = this.editor.externalTableStyle;
18136  if(externalTableStyle.length > 0) {
18137   this.applyStyleToElement(externalTable, externalTableStyle);
18138  }
18139 },
18140 applyStyleToElement: function(element, style) {
18141  element.className = style[0];
18142  if(style[1]) {
18143   var styleSheet = ASPx.GetCurrentStyleSheet();
18144   element.className += " " + ASPx.CreateImportantStyleRule(styleSheet, style[1]);
18145  }
18146 },
18147 createInlineHelpTextElement: function () {
18148  var helpTextElement = document.createElement("TD");
18149  var externalTable = this.editor.GetExternalTable();
18150  if(!externalTable)
18151   externalTable = this.createExternalTable();
18152  this.addHelpTextCellToExternalTable(externalTable, helpTextElement);
18153  return helpTextElement;
18154 },
18155 createPopupHelpTextElement: function () {
18156  var helpTextElement = document.createElement("DIV");
18157  ASPx.InsertElementAfter(helpTextElement, this.editor.GetMainElement());
18158  ASPx.AnimationHelper.setOpacity(helpTextElement, 0);
18159  ASPx.SetElementDisplay(helpTextElement, false);
18160  return helpTextElement;
18161 },
18162 createHelpTextElement: function () {
18163  return this.displayMode === ASPxClientTextEditHelpTextDisplayMode.Popup ?
18164   this.createPopupHelpTextElement() : this.createInlineHelpTextElement();
18165 },
18166 prepareHelpTextElement: function (helpTextStyle, helpText) {
18167  this.helpTextElement.id = this.getHelpTextElementId();
18168  this.applyStyleToElement(this.helpTextElement, helpTextStyle);
18169  ASPx.SetInnerHtml(this.helpTextElement, "<SPAN>" + helpText + "</SPAN>");
18170  if(this.displayMode === ASPxClientTextEditHelpTextDisplayMode.Popup)
18171   this.updatePopupHelpTextPosition();
18172  else {
18173   var isVerticalOrientation = this.position === ASPx.Position.Top || this.position === ASPx.Position.Bottom;
18174   var orientationClassName = isVerticalOrientation ? ASPxClientTextEditHelpTextConsts.VERTICAL_ORIENTATION_CLASS_NAME :
18175    ASPxClientTextEditHelpTextConsts.HORIZONTAL_ORIENTATION_CLASS_NAME;
18176   this.helpTextElement.className += " " + orientationClassName;
18177   this.setInlineHelpTextElementAlign();
18178   ASPx.SetElementDisplay(this.helpTextElement, this.editor.clientVisible);
18179  }
18180 },
18181 getHelpTextElementId: function() {
18182  return this.editor.name + ASPx.TEHelpTextElementSuffix;
18183 },
18184 setInlineHelpTextElementAlign: function() {
18185  var hAlignValue = "", vAlignValue = "";
18186  switch(this.hAlign) {
18187   case ASPxClientTextEditHelpTextHAlign.Left: hAlignValue = "left"; break;
18188   case ASPxClientTextEditHelpTextHAlign.Right: hAlignValue = "right"; break;
18189   case ASPxClientTextEditHelpTextHAlign.Center: hAlignValue = "center"; break;
18190  }
18191  switch(this.vAlign) {
18192   case ASPxClientTextEditHelpTextVAlign.Top: vAlignValue = "top"; break;
18193   case ASPxClientTextEditHelpTextVAlign.Bottom: vAlignValue = "bottom"; break;
18194   case ASPxClientTextEditHelpTextVAlign.Middle: vAlignValue = "middle"; break;
18195  }
18196  this.helpTextElement.style.textAlign = hAlignValue;
18197  this.helpTextElement.style.verticalAlign = vAlignValue;
18198 },
18199 getHelpTextMargins: function() {
18200  if(this.margins)
18201   return this.margins;
18202  var result = this.defaultMargins;
18203  if(this.position === ASPx.Position.Top || this.position === ASPx.Position.Bottom)
18204   result.Left = result.Right = 0;
18205  else
18206   result.Top = result.Bottom = 0;
18207  return result;
18208 },
18209 updatePopupHelpTextPosition: function (editorMainElement) {
18210  var editorWidth = this.editorMainElement.offsetWidth;
18211  var editorHeight = this.editorMainElement.offsetHeight;
18212  var helpTextWidth = this.helpTextElement.offsetWidth;
18213  var helpTextHeight = this.helpTextElement.offsetHeight;
18214  var editorX = ASPx.GetAbsoluteX(this.editorMainElement);
18215  var editorY = ASPx.GetAbsoluteY(this.editorMainElement);
18216  var helpTextX = 0, helpTextY = 0;
18217  var margins = this.getHelpTextMargins();
18218  if(this.position === ASPx.Position.Top || this.position === ASPx.Position.Bottom) {
18219   if(this.position === ASPx.Position.Top)
18220    helpTextY = editorY - margins.Bottom - helpTextHeight;
18221   else if(this.position === ASPx.Position.Bottom)
18222    helpTextY = editorY + editorHeight + margins.Top;
18223   if(this.hAlign === ASPxClientTextEditHelpTextHAlign.Left)
18224    helpTextX = editorX + margins.Left;
18225   else if(this.hAlign === ASPxClientTextEditHelpTextHAlign.Right)
18226    helpTextX = editorX + editorWidth - helpTextWidth - margins.Right;
18227   else if(this.hAlign === ASPxClientTextEditHelpTextHAlign.Center) {
18228    var editorCenterX = editorX + editorWidth / 2;
18229    var helpTextWidthWithMargins = helpTextWidth + margins.Left + margins.Right;
18230    helpTextX = editorCenterX - helpTextWidthWithMargins / 2 + margins.Left;
18231   }
18232  } else {
18233   if(this.position === ASPx.Position.Left)
18234    helpTextX = editorX - margins.Right - helpTextWidth;
18235   else if(this.position === ASPx.Position.Right)
18236    helpTextX = editorX + editorWidth + margins.Left;
18237   if(this.vAlign === ASPxClientTextEditHelpTextVAlign.Top)
18238    helpTextY = editorY + margins.Top;
18239   else if(this.vAlign === ASPxClientTextEditHelpTextVAlign.Bottom)
18240    helpTextY = editorY + editorHeight - helpTextHeight - margins.Bottom;
18241   else if(this.vAlign === ASPxClientTextEditHelpTextVAlign.Middle) {
18242    var editorCenterY = editorY + editorHeight / 2;
18243    var helpTextHeightWithMargins = helpTextHeight + margins.Top + margins.Bottom;
18244    helpTextY = editorCenterY - helpTextHeightWithMargins / 2 + margins.Top;
18245   }
18246  }
18247  helpTextX = helpTextX < 0 ? 0 : helpTextX;
18248  helpTextY = helpTextY < 0 ? 0 : helpTextY;
18249  ASPx.SetAbsoluteX(this.helpTextElement, helpTextX);
18250  ASPx.SetAbsoluteY(this.helpTextElement, helpTextY);
18251 },
18252 setHelpTextZIndex: function (hide) { 
18253  var newZIndex = 41998 * (hide ? -1 : 1);
18254  if(this.helpTextElement.style.zIndex != newZIndex)
18255   this.helpTextElement.style.zIndex = newZIndex;
18256 },
18257 hide: function () {
18258  if(this.displayMode === ASPxClientTextEditHelpTextDisplayMode.Inline) {
18259   ASPx.SetElementDisplay(this.helpTextElement, false);
18260  }
18261  else
18262   this.hidePopupHelpText();
18263 },
18264 hidePopupHelpText: function() {
18265  var onHidePopupHelpTextComplete = function () {
18266   this.setHelpTextZIndex(true);
18267   ASPx.SetElementDisplay(this.helpTextElement, false);
18268  }.aspxBind(this);
18269  if(this.animationEnabled)
18270   ASPx.AnimationHelper.fadeOut(this.helpTextElement, onHidePopupHelpTextComplete);
18271  else {
18272   ASPx.AnimationHelper.setOpacity(this.helpTextElement, 0);
18273   onHidePopupHelpTextComplete();
18274  }    
18275 },
18276 show: function () {
18277  if(this.displayMode === ASPxClientTextEditHelpTextDisplayMode.Inline) {
18278   ASPx.SetElementDisplay(this.helpTextElement, true);
18279  }
18280  else
18281   this.showPopupHelpText();
18282 },
18283 showPopupHelpText: function () {
18284  ASPx.SetElementDisplay(this.helpTextElement, true);
18285  this.updatePopupHelpTextPosition();
18286  if(this.animationEnabled)
18287   ASPx.AnimationHelper.fadeIn(this.helpTextElement);
18288  else
18289   ASPx.AnimationHelper.setOpacity(this.helpTextElement, 1);
18290  this.setHelpTextZIndex(false);
18291 }
18292});
18293var ASPxOutOfRangeWarningManager = ASPx.CreateClass(null, {
18294 constructor: function (editor, minValue, maxValue, defaultMinValue, defaultMaxValue, outOfRangeWarningElementPosition, valueFormatter) {
18295  this.editor = editor;
18296  this.outOfRangeWarningElementPosition = outOfRangeWarningElementPosition;
18297  this.minValue = minValue;
18298  this.maxValue = maxValue;
18299  this.defaultMinValue = defaultMinValue;
18300  this.defaultMaxValue = defaultMaxValue;
18301  this.minMaxValueFormatter = valueFormatter;
18302  this.animationDuration = 150;
18303  this.CreateOutOfRangeWarningElement();
18304 },
18305 SetMinValue: function (minValue) {
18306  this.minValue = minValue;
18307  this.UpdateOutOfRangeWarningElementText();
18308 },
18309 SetMaxValue: function (maxValue) {
18310  this.maxValue = maxValue;
18311  this.UpdateOutOfRangeWarningElementText();
18312 },
18313 CreateOutOfRangeWarningElement: function () {
18314  this.outOfRangeWarningElement = document.createElement("DIV");
18315  this.outOfRangeWarningElement.id = this.editor.name + "OutOfRWarn";
18316  ASPx.InsertElementAfter(this.outOfRangeWarningElement, this.editor.GetOutOfRangeWarningElementPrevSibling());
18317  ASPx.AnimationHelper.setOpacity(this.outOfRangeWarningElement, 0);
18318  this.outOfRangeWarningElement.className = this.editor.outOfRangeWarningClassName;
18319  this.UpdateOutOfRangeWarningElementText();
18320 },
18321 IsValueInRange: function (value) {
18322  return (!this.IsMinValueExists() || value >= this.minValue)
18323   && (!this.IsMaxValueExists() || value <= this.maxValue);
18324 },
18325 IsMinValueExists: function() {
18326  return ASPx.IsExists(this.minValue) && !isNaN(this.minValue) && this.minValue !== this.defaultMinValue;
18327 },
18328 IsMaxValueExists: function () {
18329  return ASPx.IsExists(this.maxValue) && !isNaN(this.maxValue) && this.maxValue !== this.defaultMaxValue;
18330 },
18331 GetFormattedTextByValue: function(value) {
18332  if (this.minMaxValueFormatter)
18333   return this.minMaxValueFormatter.Format(value);
18334  return value;
18335 },
18336 GetWarningText: function() {
18337  var textTemplate = arguments[0];
18338  var valueTexts = [];
18339  for (var i = 1; i < arguments.length; i++) {
18340   var valueText = this.GetFormattedTextByValue(arguments[i]);
18341   valueTexts.push(valueText);
18342  }
18343  return ASPx.Formatter.Format(textTemplate, valueTexts);
18344 },
18345 UpdateOutOfRangeWarningElementText: function () {
18346  var text = "";
18347  if (this.IsMinValueExists() && this.IsMaxValueExists())
18348   text = this.GetWarningText(this.editor.outOfRangeWarningMessages[0], this.minValue, this.maxValue);
18349  if (this.IsMinValueExists() && !this.IsMaxValueExists())
18350   text = this.GetWarningText(this.editor.outOfRangeWarningMessages[1], this.minValue);
18351  if (!this.IsMinValueExists() && this.IsMaxValueExists())
18352   text = this.GetWarningText(this.editor.outOfRangeWarningMessages[2], this.maxValue);
18353  ASPx.SetInnerHtml(this.outOfRangeWarningElement, "<LABEL>" + text + "</LABEL>");
18354 },
18355 UpdateOutOfRangeWarningElementVisibility: function (currentValue) {
18356  var isValidValue = currentValue == null || this.IsValueInRange(currentValue);
18357  if (!isValidValue && !this.outOfRangeWarningElementShown)
18358   this.ShowOutOfRangeWarningElement();
18359  if (isValidValue && this.outOfRangeWarningElementShown)
18360   this.HideOutOfRangeWarningElement();
18361 },
18362 GetOutOfRangeWarningElementCoordinates: function() {
18363  var editorMainElement = this.editor.GetMainElement();
18364  var editorWidth = editorMainElement.offsetWidth;
18365  var editorHeight = editorMainElement.offsetHeight;
18366  var editorX = ASPx.GetAbsoluteX(editorMainElement);
18367  var editorY = ASPx.GetAbsoluteY(editorMainElement);
18368  var outOfRangeWarningElementX = this.outOfRangeWarningElementPosition === ASPx.Position.Right ? editorX + editorWidth : editorX;
18369  var outOfRangeWarningElementY = this.outOfRangeWarningElementPosition === ASPx.Position.Right ? editorY : editorY + editorHeight;
18370  outOfRangeWarningElementX = outOfRangeWarningElementX < 0 ? 0 : outOfRangeWarningElementX;
18371  outOfRangeWarningElementY = outOfRangeWarningElementY < 0 ? 0 : outOfRangeWarningElementY;
18372  return {
18373   x: outOfRangeWarningElementX,
18374   y: outOfRangeWarningElementY
18375  };
18376 },
18377 ShowOutOfRangeWarningElement: function () {
18378  this.outOfRangeWarningElement.style.display = "inline";
18379  var outOfRangeWarningElementCoordinates = this.GetOutOfRangeWarningElementCoordinates();
18380  ASPx.SetAbsoluteX(this.outOfRangeWarningElement, outOfRangeWarningElementCoordinates.x);
18381  ASPx.SetAbsoluteY(this.outOfRangeWarningElement, outOfRangeWarningElementCoordinates.y);
18382  ASPx.AnimationHelper.fadeIn(this.outOfRangeWarningElement, null, this.animationDuration);
18383  this.ScrollToWarningElementIfRequired(outOfRangeWarningElementCoordinates);
18384  this.outOfRangeWarningElementShown = true;
18385 },
18386 HideOutOfRangeWarningElement: function () {
18387  ASPx.AnimationHelper.fadeOut(this.outOfRangeWarningElement, function () {
18388   ASPx.SetElementDisplay(this.outOfRangeWarningElement, false);
18389  }.aspxBind(this), this.animationDuration);
18390  this.outOfRangeWarningElementShown = false;
18391 },
18392 ScrollToWarningElementIfRequired: function (outOfRangeWarningElementCoordinates) {
18393  if(this.outOfRangeWarningElementPosition === ASPx.Position.Right) {
18394   var warnElementRightPos = outOfRangeWarningElementCoordinates.x
18395    + ASPx.PxToInt(ASPx.GetCurrentStyle(this.outOfRangeWarningElement).marginLeft)
18396    + this.outOfRangeWarningElement.offsetWidth;
18397   if(warnElementRightPos > ASPx.GetDocumentClientWidth() + ASPx.GetDocumentScrollLeft())
18398    ASPx.SetDocumentScrollLeft(warnElementRightPos - ASPx.GetDocumentClientWidth());
18399  }
18400  if(this.outOfRangeWarningElementPosition === ASPx.Position.Bottom) {
18401   var warnElementBottomPos = outOfRangeWarningElementCoordinates.y
18402    + ASPx.PxToInt(ASPx.GetCurrentStyle(this.outOfRangeWarningElement).marginTop)
18403    + this.outOfRangeWarningElement.offsetHeight;
18404   if(warnElementBottomPos > ASPx.GetDocumentClientHeight() + ASPx.GetDocumentScrollTop())
18405    ASPx.SetDocumentScrollTop(warnElementBottomPos - ASPx.GetDocumentClientHeight());
18406  }
18407 }
18408});
18409ASPx.MMMouseOut = function(name, evt) {
18410 var edit = ASPx.GetControlCollection().Get(name);
18411 if(edit != null) edit.OnMouseOut(evt);
18412};
18413ASPx.MMMouseOver = function(name, evt) {
18414 var edit = ASPx.GetControlCollection().Get(name);
18415 if(edit != null) edit.OnMouseOver(evt);
18416};
18417ASPx.MaskHintTimerProc = function() {
18418 var focusedEditor = ASPx.GetFocusedEditor();
18419 if(focusedEditor != null && ASPx.IsFunction(focusedEditor.MaskHintTimerProc))
18420  focusedEditor.MaskHintTimerProc();
18421};
18422ASPx.ETextChanged = function(name) {
18423 var edit = ASPx.GetControlCollection().Get(name);
18424 if(edit != null) edit.OnTextChanged(); 
18425};
18426ASPx.BEClick = function(name,number){
18427 var edit = ASPx.GetControlCollection().Get(name);
18428 if(edit != null) edit.OnButtonClick(number);
18429};
18430ASPx.BEClear = function(name, evt) {
18431 var edit = ASPx.GetControlCollection().Get(name);
18432 if(edit && (evt.button === 0 || ASPx.Browser.TouchUI))
18433  edit.onClearButtonClick();
18434};
18435ASPx.SetFocusToTextEditWithDelay = function(name) {
18436 window.setTimeout(function() {
18437  var edit = ASPx.GetControlCollection().Get(name);
18438  if(!edit)
18439   return;
18440  if(ASPx.Browser.IE)
18441   edit.SetCaretPosition(0);
18442  else
18443   edit.SetFocus();
18444 }, 500);
18445};
18446window.ASPxClientTextEdit = ASPxClientTextEdit;
18447window.ASPxClientTextBoxBase = ASPxClientTextBoxBase;
18448window.ASPxClientTextBox = ASPxClientTextBox;
18449window.ASPxClientMemo = ASPxClientMemo;
18450window.ASPxClientButtonEditBase = ASPxClientButtonEditBase;
18451window.ASPxClientButtonEdit = ASPxClientButtonEdit;
18452window.ASPxClientButtonEditClickEventArgs = ASPxClientButtonEditClickEventArgs;
18453})();
18454
18455(function() {
18456var DateFormatter = ASPx.CreateClass(null, {
18457 constructor: function() {
18458  this.date = new Date(2000, 0, 1);
18459  this.mask = "";
18460  this.specifiers = {};     
18461  this.spPositions = [];    
18462  this.parserKeys = [];
18463  this.knownSpecifiers = ["d", "M", "y", "H", "h", "m", "s", "f", "F", "g", "t"];
18464  this.savedYear = -1;
18465  this.isYearParsed = false;
18466  this.parsedMonth = -1;
18467  this.replacers = {
18468   "d": this.ReplaceDay,
18469   "M": this.ReplaceMonth,
18470   "y": this.ReplaceYear,
18471   "H": this.ReplaceHours23,
18472   "h": this.ReplaceHours12,
18473   "m": this.ReplaceMinutes,
18474   "s": this.ReplaceSeconds,
18475   "F": this.ReplaceMsTrimmed,
18476   "f": this.ReplaceMs,
18477   "g": this.ReplaceEra,
18478   "t": this.ReplaceAmPm
18479  };
18480  this.parsers = {
18481   "d": this.ParseDay,
18482   "M": this.ParseMonth,
18483   "y": this.ParseYear,
18484   "H": this.ParseHours,
18485   "h": this.ParseHours,
18486   "m": this.ParseMinutes,
18487   "s": this.ParseSeconds,
18488   "F": this.ParseMs,
18489   "f": this.ParseMs,
18490   "g": this.ParseEra,
18491   "t": this.ParseAmPm
18492  };
18493 },
18494 Format: function(date) {
18495  this.date = date;
18496  var sp;
18497  var pos;
18498  var replacerKey;
18499  var result = this.mask;
18500  for(var i = 0; i < this.spPositions.length; i++) {
18501   pos = this.spPositions[i];
18502   sp = this.specifiers[pos];
18503   replacerKey = sp.substr(0, 1);
18504   if(this.replacers[replacerKey]) {
18505    result = result.substr(0, pos) + this.replacers[replacerKey].call(this, sp.length) + result.substr(pos + sp.length);
18506   }
18507  }
18508  return result;
18509 }, 
18510 Parse: function(str, rememberParserKeys) {
18511  var now = new Date();  
18512  this.savedYear = now.getFullYear();
18513  this.isYearParsed = false;
18514  this.parsedMonth = -1;
18515  this.date = new Date(2000, 0, now.getDate());    
18516  this.strToParse = str;
18517  this.catchNumbers(str);  
18518  var parserKey;
18519  var sp;
18520  var pos;
18521  var parseResult;
18522  var error = false;
18523  this.hasAmPm = false;
18524  for(var i = 0; i < this.spPositions.length; i++) {
18525   pos = this.spPositions[i];
18526   sp = this.specifiers[pos];
18527   parserKey = sp.substr(0, 1);
18528   if(this.parsers[parserKey]) {
18529    if(rememberParserKeys)
18530     this.parserKeys.push(parserKey);
18531    parseResult = this.parsers[parserKey].call(this, sp.length);
18532    if(!parseResult) {
18533     error = true;
18534     break;
18535    }
18536   }
18537  }
18538  if(error)
18539   return false;
18540  if(this.hasAmPm) {
18541   if(!this.fixHours())
18542    return false;
18543  }
18544  if(!this.isYearParsed)
18545   this.date.setYear(this.savedYear);
18546  if(this.parsedMonth < 0)
18547   this.parsedMonth = now.getMonth();   
18548  this.ApplyMonth();
18549  return this.date;  
18550 },
18551 ParseAndMergeWithDate: function(str, sourceDate) {
18552  this.parserKeys = [];
18553  var date = this.Parse(str, true);
18554  if(date && sourceDate)
18555   date = new Date(
18556        this.HasYear() ? date.getFullYear() : sourceDate.getFullYear(),
18557        this.HasMonth() ? date.getMonth() : sourceDate.getMonth(),
18558        this.HasDay() ? date.getDate() : sourceDate.getDate(),
18559        this.HasHours() ? date.getHours() : sourceDate.getHours(),
18560        this.HasMinutes() ? date.getMinutes() : sourceDate.getMinutes(),
18561        this.HasSeconds() ? date.getSeconds() : sourceDate.getSeconds(),
18562        this.HasMilliseconds() ? date.getMilliseconds() : sourceDate.getMilliseconds()
18563        );
18564  this.parserKeys = [];
18565  return date;
18566 },
18567 HasYear: function() { return this.HasParserKey("y"); },
18568 HasMonth: function() { return this.HasParserKey("M"); },
18569 HasDay: function() { return this.HasParserKey("d"); },
18570 HasHours: function() { return this.HasParserKey("h") || this.HasParserKey("H"); },
18571 HasMinutes: function() { return this.HasParserKey("m"); },
18572 HasSeconds: function() { return this.HasParserKey("s"); },
18573 HasMilliseconds: function() { return this.HasParserKey("f") || this.HasParserKey("F"); },
18574 HasParserKey: function(key) { return ASPx.Data.ArrayIndexOf(this.parserKeys, key) !== -1; },
18575 ApplyMonth: function() {
18576  var trial;
18577  var day = this.date.getDate();
18578  while(true) {
18579   trial = new Date();
18580   trial.setTime(this.date.getTime());   
18581   trial.setMonth(this.parsedMonth);
18582   if(trial.getMonth() == this.parsedMonth)
18583    break;
18584   --day;
18585   this.date.setDate(day);
18586  }
18587  ASPx.DateUtils.FixTimezoneGap(this.date, trial);
18588  this.date = trial;
18589 },
18590 SetFormatString: function(mask) {
18591  if(mask.length == 2 && mask.charAt(0) == "%")
18592   mask = mask.charAt(1);
18593  var stringContainsDateSeparator = mask && mask.indexOf(ASPx.CultureInfo.ds) !== -1;
18594  this.specifiers = {}; 
18595  this.spPositions = [];
18596  this.mask = "";
18597  var subt = 0;
18598  var pos = 0;
18599  var startPos = 0;
18600  var ch;
18601  var prevCh = "";
18602  var skip = false;
18603  var backslash = false;
18604  var sp = "";
18605  while(true) {
18606   ch = mask.charAt(pos);
18607   if(ch == "") {
18608    if(sp.length > 0)
18609     this.RegisterSpecifier(startPos, sp, stringContainsDateSeparator);
18610    break;
18611   }
18612   if(ch == "\\" && !backslash) {
18613    backslash = true;
18614    subt++;
18615   } else {
18616    if(!backslash && (ch == "'" || ch == '"')) {
18617     skip = !skip;
18618     subt++;
18619    } else {     
18620     if(!skip) {
18621      if(ch == "/")
18622       ch = ASPx.CultureInfo.ds;
18623      else if(ch == ":")
18624       ch = ASPx.CultureInfo.ts;
18625      else if(this.IsKnownSpecifier(ch)) {
18626       if(prevCh.length == 0)
18627        prevCh = ch;
18628       if(ch == prevCh)
18629        sp += ch;
18630       else {
18631        if(sp.length > 0)
18632         this.RegisterSpecifier(startPos, sp, stringContainsDateSeparator);
18633        sp = ch;
18634        startPos = pos - subt;
18635       }
18636      }
18637     }     
18638     this.mask += ch;
18639    }      
18640    backslash = false;
18641   }            
18642   prevCh = ch;
18643   pos++;
18644  }
18645  this.spPositions.reverse();
18646 },
18647 RegisterSpecifier: function (pos, sp, stringContainsDateSeparator) {
18648  if(ASPx.CultureInfo.ds.length > 1 && this.mask && !stringContainsDateSeparator) {
18649   var dateParts = this.mask.split(ASPx.CultureInfo.ds);
18650   if(dateParts) {
18651    if(dateParts.length > 0 && dateParts[dateParts.length - 1] == "")
18652     dateParts.pop();
18653    pos += (dateParts.length - 1) * (ASPx.CultureInfo.ds.length - 1);
18654   }
18655  }
18656  this.spPositions.push(pos);
18657  this.specifiers[pos] = sp; 
18658 },
18659 ReplaceDay: function(length) {
18660  if(length < 3) {
18661   var value = this.date.getDate().toString();
18662   return length == 2 ? this.padLeft(value, 2) : value;  
18663  } else if(length == 3) {
18664   return ASPx.CultureInfo.abbrDayNames[this.date.getDay()];
18665  } else {
18666   return ASPx.CultureInfo.dayNames[this.date.getDay()];
18667  }
18668 }, 
18669 ReplaceMonth: function(length) {
18670  var value = 1 + this.date.getMonth();
18671  switch(length) {
18672   case 1:
18673    return value.toString();
18674   case 2:
18675    return this.padLeft(value.toString(), 2);
18676   case 3:
18677    return ASPx.CultureInfo.abbrMonthNames[value - 1];
18678   default:
18679    for(var i in this.specifiers) {
18680     if(this.specifiers.hasOwnProperty(i)) {
18681      var spec = this.specifiers[i];
18682      if(spec == "d" || spec == "dd")
18683       return ASPx.CultureInfo.genMonthNames[value - 1];
18684     }
18685    }
18686    return ASPx.CultureInfo.monthNames[value - 1];
18687  }
18688 },
18689 ReplaceYear: function(length) {
18690  var value = this.date.getFullYear();
18691  if(length <= 2)
18692   value = value % 100;
18693  return this.padLeft(value.toString(), length);
18694 },
18695 ReplaceHours23: function(length) {
18696  var value = this.date.getHours().toString();
18697  return length > 1 ? this.padLeft(value, 2) : value;
18698 },
18699 ReplaceHours12: function(length) {
18700  var value = this.date.getHours() % 12;
18701  if(value == 0)
18702   value = 12;
18703  value = value.toString();
18704  return length > 1 ? this.padLeft(value, 2) : value;
18705 },
18706 ReplaceMinutes: function(length) {
18707  var value = this.date.getMinutes().toString();
18708  return length > 1 ? this.padLeft(value, 2) : value;
18709 },
18710 ReplaceSeconds: function(length) {
18711  var value = this.date.getSeconds().toString();
18712  return length > 1 ? this.padLeft(value, 2) : value;
18713 },
18714 ReplaceMsTrimmed: function(length) {   
18715  return this.formatMs(length, true);
18716 },
18717 ReplaceMs: function(length) { 
18718  return this.formatMs(length, false);
18719 },
18720 ReplaceEra: function(length) {
18721  return "A.D.";
18722 },
18723 ReplaceAmPm: function(length) {
18724  var value = this.date.getHours() < 12 ? ASPx.CultureInfo.am : ASPx.CultureInfo.pm;
18725  return length < 2 ? value.charAt(0) : value;
18726 },
18727 catchNumbers: function(str) {
18728  this.parseNumbers = [];  
18729  var regex = /\d+/g;  
18730  var match;
18731  for(;;) {
18732   match = regex.exec(str);
18733   if(!match)
18734    break;
18735   this.parseNumbers.push(this.parseDecInt(match[0]));
18736  }  
18737  var spCount = 0;
18738  var now = new Date();
18739  for(var i in this.specifiers) {
18740   if(this.specifiers.hasOwnProperty(i)) {
18741    var sp = this.specifiers[i];
18742    if (sp.constructor != String || !this.IsNumericSpecifier(sp)) continue;
18743    spCount++;
18744    if(this.parseNumbers.length < spCount) {
18745     var defaultValue = 0;
18746     if (sp.charAt(0) == "y") defaultValue = now.getFullYear();
18747     this.parseNumbers.push(defaultValue);
18748    }
18749   }
18750  }
18751  var excess = this.parseNumbers.length - spCount;
18752  if(excess > 0)
18753   this.parseNumbers.splice(spCount, excess);  
18754  this.currentParseNumber = this.parseNumbers.length - 1;
18755 },
18756 popParseNumber: function() {
18757  return this.parseNumbers[this.currentParseNumber--];
18758 },
18759 findAbbrMonth: function() {
18760  return this.findMonthCore(ASPx.CultureInfo.abbrMonthNames);
18761 },
18762 findFullMonth: function() {
18763  return this.findMonthCore(ASPx.CultureInfo.genMonthNames);
18764 },
18765 findMonthCore: function(monthNames) {
18766  var inputLower = this.strToParse.toLowerCase();
18767  var matchMonthNames = monthNames.filter(function(n) { return inputLower.indexOf(n.toLowerCase()) > -1; });
18768  if(matchMonthNames.length == 0)
18769   return false;
18770  var sortedMatchNames = matchMonthNames.sort(function(a, b) { return b.length - a.length; });
18771  var name = sortedMatchNames[0];
18772  var emptyMonth = new Array(name.length + 1).join(" ");
18773  this.strToParse = this.strToParse.replace(new RegExp(name, "gi"), emptyMonth);
18774  return monthNames.indexOf(name) + 1;
18775 },
18776 ParseDay: function(length) {
18777  if(length < 3) {
18778   var value = this.popParseNumber();
18779   if(value < 1 || value > 31)
18780    return false;
18781   this.date.setDate(value);
18782  }
18783  return true;
18784 },
18785 ParseMonth: function(length) {
18786  var value;
18787  switch(length){
18788   case 1:
18789   case 2:
18790    value = this.popParseNumber();
18791    break; 
18792   case 3:
18793    value = this.findAbbrMonth();
18794    break;
18795   default:
18796    value = this.findFullMonth();
18797    break;
18798  }
18799  if(value < 1 || value > 12)
18800   return false;
18801  this.parsedMonth = value - 1;
18802  if(this.IsActualDayMonthTextContainsDigit("M", length) && length > 2)
18803   this.currentParseNumber--;
18804  return true;
18805 }, 
18806 ParseYear: function(length) {  
18807  var value = this.popParseNumber();
18808  if(value > 9999)
18809   return false;
18810  if(value < 100)
18811   value = ASPx.DateUtils.ExpandTwoDigitYear(value);
18812  this.date.setFullYear(value);
18813  this.isYearParsed = true;
18814  return true;
18815 },
18816 ParseHours: function(length) {
18817  var value = this.popParseNumber();
18818  if(value > 23)
18819   return false;
18820  this.date.setHours(value);
18821  return true;
18822 },
18823 ParseMinutes: function(length) {
18824  var value = this.parseMinSecCore();
18825  if(value == -1)
18826   return false;
18827  this.date.setMinutes(value);
18828  return true;
18829 },
18830 ParseSeconds: function(length) {
18831  var value = this.parseMinSecCore();
18832  if(value == -1)
18833   return false;
18834  this.date.setSeconds(value);
18835  return true;
18836 },
18837 ParseMs: function(length) {
18838  if(length > 3)
18839   length = 3;
18840  var thr = 1;
18841  for(var i = 0; i < length; i++)
18842   thr *= 10;
18843  thr -= 1;
18844  var value = this.popParseNumber();
18845  while(value > thr)
18846   value /= 10;
18847  this.date.setMilliseconds(Math.round(value));
18848  return true;
18849 },
18850 ParseEra: function(length) {
18851  return true;
18852 },
18853 ParseAmPm: function(length) {
18854  this.hasAmPm = ASPx.CultureInfo.am.length > 0 && ASPx.CultureInfo.pm.length > 0;
18855  return true;
18856 },
18857 parseDecInt: function(str) {
18858  return parseInt(str, 10);
18859 },
18860 padLeft: function(str, length) {
18861  while(str.length < length)
18862   str = "0" + str;
18863  return str;
18864 },
18865 formatMs: function(length, trim) {
18866  var value = Math.floor(this.date.getMilliseconds() * Math.pow(10, length - 3));
18867  value = this.padLeft(value.toString(), length);    
18868  if(trim) {
18869   var pos = value.length - 1;
18870   var req = false;
18871   while(value.charAt(pos) == "0") {
18872    req = true;
18873    pos--;
18874   }
18875   if(req)
18876    value = value.substring(0, pos + 1);   
18877  }
18878  return value;
18879 },
18880 parseMinSecCore: function() {
18881  var value = this.popParseNumber();
18882  return value > 59 ? -1 : value;
18883 },
18884 fixHours: function() {
18885  var state = this.getAmPmState(this.strToParse);
18886  if(!state) return true;
18887  var h = this.date.getHours();
18888  switch(state) {
18889   case "P":
18890    if(h > 12) return false;
18891    if(h < 12)
18892     this.date.setHours(12 + h);
18893    break;
18894   case "A":
18895    if(h == 12)
18896     this.date.setHours(0);
18897  }
18898  return true;
18899 },
18900 getAmPmState: function(str, skipCorrection) {
18901  var am = ASPx.CultureInfo.am.charAt(0).toLowerCase();
18902  var pm = ASPx.CultureInfo.pm.charAt(0).toLowerCase();
18903  var amMatches = new RegExp(am, "gi").exec(str);
18904  var pmMatches = new RegExp(pm, "gi").exec(str);
18905  var amCount = amMatches ? amMatches.length : 0;
18906  var pmCount = pmMatches ? pmMatches.length : 0;
18907  var hasAm = amCount > 0;
18908  var hasPm = pmCount > 0;
18909  if(hasAm ^ hasPm && amCount < 2 && pmCount < 2)
18910   return hasAm ? "A" : "P";
18911  if(!skipCorrection) {
18912   str = str.replace(new RegExp(this.getDayMonthNameReplacePattern(), "gi"), "");
18913   return this.getAmPmState(str, true);
18914  }
18915  return null;
18916 },
18917 getDayMonthNameReplacePattern: function() {
18918  if(!this.dayMonthNameReplacePattern)
18919   return this.createDayMonthNameReplacePattern();
18920  return this.dayMonthNameReplacePattern;
18921 },
18922 createDayMonthNameReplacePattern: function() {
18923  var parts = [ ] ;
18924  parts.push("(?:");
18925  parts.push(this.createReplacePattern(ASPx.CultureInfo.monthNames));
18926  parts.push(this.createReplacePattern(ASPx.CultureInfo.genMonthNames));
18927  parts.push(this.createReplacePattern(ASPx.CultureInfo.abbrMonthNames));
18928  parts.push(this.createReplacePattern(ASPx.CultureInfo.abbrDayNames));
18929  parts.push(this.createReplacePattern(ASPx.CultureInfo.dayNames));
18930  parts.push(")");
18931  return parts.join("");
18932 },
18933 createReplacePattern: function(names) {
18934  return names && names.length > 0 ? "\\b" + names.join("\\b|\\b") + "\\b" : "";
18935 },
18936 IsNumericSpecifier: function(sp) {
18937  var ch = sp.charAt(0);
18938  if(ch == "g" || ch == "t" || ((ch == "M" || ch == "d") && !this.IsActualDayMonthTextContainsDigit(ch, sp.length)))
18939   return false;
18940  return true;
18941 },
18942 IsActualDayMonthTextContainsDigit: function(datePart, datePartLength) {
18943  if(datePartLength < 3)
18944   return true;
18945  var targetNames;
18946  var useAbbrNames = datePartLength == 3;
18947  if(datePart == "d")
18948   targetNames = useAbbrNames ? ASPx.CultureInfo.abbrDayNames : ASPx.CultureInfo.dayNames;
18949  else
18950   targetNames = useAbbrNames ? ASPx.CultureInfo.abbrMonthNames : ASPx.CultureInfo.monthNames;
18951  return targetNames.length > 0 ? /\d+/g.test(targetNames[0]) : false;
18952 },
18953 IsKnownSpecifier: function(sp) {
18954  if(sp.length > 1)
18955   sp = sp.charAt(0);
18956  for(var i = 0; i < this.knownSpecifiers.length; i++) {
18957   if(this.knownSpecifiers[i] == sp)
18958    return true;
18959  }
18960  return false;
18961 }
18962});
18963DateFormatter.Create = function(format) {
18964 var instance = new DateFormatter();
18965 instance.SetFormatString(format);
18966 return instance;
18967};
18968DateFormatter.ExpandPredefinedFormat = function(format) {
18969 switch(format) {
18970  case "d":
18971   return ASPx.CultureInfo.shortDate;
18972  case "D":
18973   return ASPx.CultureInfo.longDate;
18974  case "t":
18975   return ASPx.CultureInfo.shortTime;
18976  case "T":
18977   return ASPx.CultureInfo.longTime;
18978  case "g":
18979   return ASPx.CultureInfo.shortDate + " " + ASPx.CultureInfo.shortTime;   
18980  case "f":
18981   return ASPx.CultureInfo.longDate + " " + ASPx.CultureInfo.shortTime;
18982  case "G":
18983   return ASPx.CultureInfo.shortDate + " " + ASPx.CultureInfo.longTime;
18984  case "F":
18985  case "U":
18986   return ASPx.CultureInfo.longDate + " " + ASPx.CultureInfo.longTime;   
18987  case "M":
18988  case "m":
18989   return ASPx.CultureInfo.monthDay;
18990  case "Y":
18991  case "y":
18992   return ASPx.CultureInfo.yearMonth;   
18993  case "O":
18994  case "o":
18995   return "yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffff";
18996  case "R":
18997  case "r":
18998   return "ddd, dd MMM yyyy HH':'mm':'ss 'GMT'";
18999  case "s":
19000   return "yyyy'-'MM'-'dd'T'HH':'mm':'ss";
19001  case "u":
19002    return "yyyy'-'MM'-'dd HH':'mm':'ss'Z'";
19003 }
19004 return format;
19005};
19006ASPx.DateFormatter = DateFormatter;
19007})();
19008(function() {
19009ASPx.Formatter = {
19010 Format: function() {
19011  if(arguments.length < 1) 
19012   return "";
19013  var format = arguments[0];
19014  if(format == null)
19015   return "";
19016  var args;
19017  if(arguments.length > 1 && arguments[1] != null && arguments[1].constructor == Array) {
19018   args = arguments[1];
19019  } else {
19020   args = [ ];
19021   for(var i = 1; i < arguments.length; i++)
19022    args.push(arguments[i]);
19023  }
19024  var bag = [ ];
19025  var pos = 0;
19026  var savedPos = 0;  
19027  while(pos < format.length) {
19028   var ch = format.charAt(pos);
19029   pos++;
19030   if(ch == '{') {
19031    bag.push(format.substr(savedPos, pos - savedPos - 1));    
19032    if(format.charAt(pos) == "{") {
19033     savedPos = pos;
19034     pos++;
19035     continue;
19036    }
19037    var spec = this.ParseSpec(format, pos);
19038    var pos = spec.pos;
19039    var arg = args[spec.index];
19040    var argString;
19041    if(arg == null) {
19042     argString = "";
19043    } else if(typeof arg == "number") {
19044     argString = ASPx.NumberFormatter.Format(spec.format, arg);
19045    } else if(arg.constructor == Date) {     
19046     if(spec.format != this.activeDateFormat) {
19047      this.activeDateFormat = spec.format;
19048      if(spec.format == "")
19049       spec.format = "G";      
19050      if(spec.format.length == 1)
19051       spec.format = ASPx.DateFormatter.ExpandPredefinedFormat(spec.format);
19052      this.GetDateFormatter().SetFormatString(spec.format);
19053     }
19054     if(this.activeDateFormat == "U")
19055      arg = ASPx.DateUtils.ToUtcTime(arg);
19056     argString = this.GetDateFormatter().Format(arg);
19057    } else {
19058     argString = String(arg);     
19059     if(spec.format != "" && argString.length > 0) {
19060      var num = Number(argString.replace(",", "."));
19061      if(!isNaN(num))
19062       argString = ASPx.NumberFormatter.Format(spec.format, num);
19063     }
19064    }
19065    var padLen = spec.width - argString.length;
19066    if(padLen > 0) {
19067     if(spec.left)
19068      bag.push(argString);
19069     for(var i = 0; i < padLen; i++)
19070      bag.push(" ");
19071     if(!spec.left)
19072      bag.push(argString);
19073    } else {
19074     bag.push(argString);
19075    }
19076    savedPos = pos;
19077   }
19078   else if(ch == "}" && pos < format.length && format.charAt(pos) == "}") {
19079    bag.push(format.substr(savedPos, pos - savedPos - 1));
19080    savedPos = pos;
19081    pos++;
19082   }
19083   else if (ch == "}") {
19084    return "";
19085   }
19086  }
19087  if(savedPos < format.length)
19088   bag.push(format.substr(savedPos));   
19089  return bag.join("");
19090 },
19091 ParseSpec: function(format, pos) {
19092  var result = {
19093   index: -1,   
19094   left: false,
19095   width: 0,
19096   format: "",
19097   pos: 0
19098  };
19099  var savedPos, ch;
19100  savedPos = pos;
19101  while(true) {   
19102   ch = format.charAt(pos);
19103   if(ch < "0" || ch > "9")
19104    break;
19105   pos++;
19106  }  
19107  if(pos > savedPos)
19108   result.index = Number(format.substr(savedPos, pos - savedPos));  
19109  if(format.charAt(pos) == ",") {
19110   pos++;
19111   while(true) {
19112    ch = format.charAt(pos);
19113    if(ch != " " && ch != "\t")
19114     break;
19115    pos++;
19116   }
19117   result.left = format.charAt(pos) == "-";
19118   if(result.left)
19119    pos++;   
19120   savedPos = pos;
19121   while(true) {
19122    ch = format.charAt(pos);
19123    if(ch < "0" || ch > "9")
19124     break;
19125    pos++;
19126   }
19127   if(pos > savedPos)
19128    result.width = Number(format.substr(savedPos, pos - savedPos));
19129  }
19130  if(format.charAt(pos) == ":") {
19131   pos++;
19132   savedPos = pos;
19133   while(format.charAt(pos) != "}")
19134    pos++;
19135   result.format = format.substr(savedPos, pos - savedPos);
19136  }
19137  pos++;
19138  result.pos = pos;
19139  return result;
19140 },
19141 activeDateFormat: null,
19142 GetDateFormatter: function() {
19143  if(!this.__dateFormatter)
19144   this.__dateFormatter = new ASPx.DateFormatter();
19145  return this.__dateFormatter;
19146 }
19147};
19148ASPx.NumberFormatter = {
19149 Format: function(format, value) {
19150  if(isNaN(value))
19151   return ASPx.CultureInfo.numNan;
19152  if(!isFinite(value)) {
19153   return value > 0 
19154    ? ASPx.CultureInfo.numPosInf 
19155    : ASPx.CultureInfo.numNegInf;
19156  }
19157  this.FillFormatInfo(format);
19158  if(this.spec == "X")
19159   return this.FormatHex(value);
19160  this.FillDigitInfo(value);  
19161  switch(this.spec) {
19162   case "C":
19163    return this.FormatCurrency();
19164   case "D":
19165    return this.FormatDecimal();
19166   case "E":
19167    return this.FormatExp();
19168   case "F":
19169    return this.FormatFixed();
19170   case "G":   
19171    return this.FormatGeneral();
19172   case "N":
19173    return this.FormatNumber();
19174   case "P":
19175    return this.FormatPercent();
19176   default:
19177    if(this.custom)
19178     return this.FormatCustom(format);
19179    return "?";
19180  }
19181 },
19182 positive: true,
19183 digits: null,
19184 pointPos: 0, 
19185 spec: "",
19186 prec: -1,  
19187 upper: true,
19188 custom: false,
19189 FormatCurrency: function() {  
19190  if(this.prec < 0)
19191   this.prec = ASPx.CultureInfo.currPrec;
19192  this.Round(this.prec);
19193  var bag = [ ];
19194  if(this.positive) {
19195   switch(ASPx.CultureInfo.currPosPattern) {
19196    case 0:
19197     bag.push(ASPx.CultureInfo.currency);
19198     break;
19199    case 2:
19200     bag.push(ASPx.CultureInfo.currency, " ");     
19201     break;     
19202   }
19203  } else {
19204   switch(ASPx.CultureInfo.currNegPattern) {
19205    case 0:
19206     bag.push("(", ASPx.CultureInfo.currency);
19207     break;
19208    case 1:
19209     bag.push("-", ASPx.CultureInfo.currency);
19210     break;
19211    case 2:
19212     bag.push(ASPx.CultureInfo.currency, "-");
19213     break;
19214    case 3:
19215     bag.push(ASPx.CultureInfo.currency);
19216     break;
19217    case 4:
19218     bag.push("(");
19219     break;
19220    case 5:
19221    case 8:
19222     bag.push("-");
19223     break;
19224    case 9:
19225     bag.push("-", ASPx.CultureInfo.currency, " ");
19226     break;
19227    case 11:
19228     bag.push(ASPx.CultureInfo.currency, " ");
19229     break;
19230    case 12:
19231     bag.push(ASPx.CultureInfo.currency, " -");
19232     break;
19233    case 14:
19234     bag.push("(", ASPx.CultureInfo.currency, " ");
19235     break;
19236    case 15:
19237     bag.push("(");
19238     break;
19239   }
19240  }
19241  this.AppendGroupedInteger(bag, ASPx.CultureInfo.currGroups, ASPx.CultureInfo.currGroupSeparator);
19242  if(this.prec > 0) {
19243   bag.push(ASPx.CultureInfo.currDecimalPoint);
19244   this.AppendDigits(bag, this.pointPos, this.pointPos + this.prec);
19245  }
19246  if(this.positive) {
19247   switch(ASPx.CultureInfo.currPosPattern) {
19248    case 1:
19249     bag.push(ASPx.CultureInfo.currency);
19250     break;
19251    case 3:
19252     bag.push(" ", ASPx.CultureInfo.currency);
19253     break;     
19254   }   
19255  } else {
19256   switch(ASPx.CultureInfo.currNegPattern) {
19257    case 0:
19258    case 14:
19259     bag.push(")");
19260     break;
19261    case 3:
19262     bag.push("-");
19263     break;
19264    case 4:
19265     bag.push(ASPx.CultureInfo.currency, ")");
19266     break;
19267    case 5:
19268     bag.push(ASPx.CultureInfo.currency);
19269     break;
19270    case 6:
19271     bag.push("-", ASPx.CultureInfo.currency);
19272     break;
19273    case 7:
19274     bag.push(ASPx.CultureInfo.currency, "-");
19275     break;
19276    case 8:
19277     bag.push(" ", ASPx.CultureInfo.currency);
19278     break;
19279    case 10:
19280     bag.push(" ", ASPx.CultureInfo.currency, "-");
19281     break;
19282    case 11:
19283     bag.push("-");
19284     break;
19285    case 13:
19286     bag.push("- ", ASPx.CultureInfo.currency);
19287     break;
19288    case 15:
19289     bag.push(" ", ASPx.CultureInfo.currency, ")");
19290     break;
19291   }
19292  }
19293  return bag.join("");
19294 }, 
19295 FormatDecimal: function() {
19296  if(this.prec < this.pointPos)
19297   this.prec = this.pointPos;
19298  if(this.prec < 1)
19299   return "0";
19300  var bag = [ ];
19301  if(!this.positive)
19302   bag.push("-");
19303  this.AppendDigits(bag, this.pointPos - this.prec, this.pointPos);
19304  return bag.join("");
19305 },
19306 FormatExp: function() {  
19307  if(this.prec < 0)
19308   this.prec = 6;
19309  this.Round(1 - this.pointPos + this.prec);
19310  return this.FormatExpCore(3);
19311 },
19312 FormatExpCore: function(minExpDigits) {
19313  var bag = [ ];
19314  if(!this.positive)
19315   bag.push("-");
19316  this.AppendDigits(bag, 0, 1);
19317  if(this.prec > 0) {
19318   bag.push(ASPx.CultureInfo.numDecimalPoint);
19319   this.AppendDigits(bag, 1, 1 + this.prec);
19320  }
19321  bag.push(this.upper ? "E" : "e");
19322  var order = this.pointPos - 1;  
19323  if(order >= 0) {
19324   bag.push("+");
19325  } else {
19326   bag.push("-");
19327   order = -order;
19328  }
19329  var orderStr = String(order);
19330  for(var i = orderStr.length; i < minExpDigits; i++)
19331   bag.push(0);
19332  bag.push(orderStr);
19333  return bag.join("");
19334 },
19335 FormatFixed: function() {
19336  if(this.prec < 0)
19337   this.prec = ASPx.CultureInfo.numPrec;
19338  this.Round(this.prec);
19339  var bag = [ ];
19340  if(!this.positive)
19341   bag.push("-");
19342  if(this.pointPos < 1)
19343   bag.push(0);
19344  else
19345   this.AppendDigits(bag, 0, this.pointPos);
19346  if(this.prec > 0) {
19347   bag.push(ASPx.CultureInfo.numDecimalPoint);
19348   this.AppendDigits(bag, this.pointPos, this.pointPos + this.prec);
19349  }
19350  return bag.join(""); 
19351 },
19352 FormatGeneral: function() {
19353  var hasFrac = this.pointPos < this.digits.length;
19354  var allowExp;
19355  if(this.prec < 0) {
19356   allowExp = hasFrac;
19357   this.prec = hasFrac ? 15 : 10;
19358  } else {   
19359   allowExp = true;
19360   if(this.prec < 1)
19361    this.prec = hasFrac ? 15 : 10;
19362   this.Round(this.prec - this.pointPos);
19363  }
19364  if(allowExp) {
19365   if(this.pointPos > this.prec || this.pointPos <= -4) {
19366    this.prec = this.digits.length - 1;
19367    return this.FormatExpCore(2);
19368   }
19369  }
19370  this.prec = Math.min(this.prec, Math.max(1, this.digits.length)) - this.pointPos;
19371  return this.FormatFixed();
19372 },
19373 FormatNumber: function() {
19374  if(this.prec < 0)
19375   this.prec = ASPx.CultureInfo.numPrec;
19376  this.Round(this.prec);
19377  var bag = [ ];
19378  if(!this.positive) {
19379   switch(ASPx.CultureInfo.numNegPattern) {
19380    case 0:
19381     bag.push("(");
19382     break;
19383    case 1:
19384     bag.push("-");
19385     break;
19386    case 2:
19387     bag.push("- ");
19388     break;
19389   }
19390  }
19391  this.AppendGroupedInteger(bag, ASPx.CultureInfo.numGroups, ASPx.CultureInfo.numGroupSeparator);
19392  if(this.prec > 0) {
19393   bag.push(ASPx.CultureInfo.numDecimalPoint);
19394   this.AppendDigits(bag, this.pointPos, this.pointPos + this.prec);
19395  }
19396  if(!this.positive) {
19397   switch(ASPx.CultureInfo.numNegPattern) {
19398    case 0:
19399     bag.push(")");
19400     break;
19401    case 3:
19402     bag.push("-");
19403     break;
19404    case 4:
19405     bag.push(" -");
19406     break;
19407   }
19408  }
19409  return bag.join("");
19410 },
19411 FormatPercent: function() {
19412  if(this.prec < 0)
19413   this.prec = ASPx.CultureInfo.numPrec;
19414  if(this.digits.length > 0)
19415   this.pointPos += 2;
19416  this.Round(this.prec);
19417  var bag = [ ];
19418  if(!this.positive)
19419   bag.push("-");
19420  if(ASPx.CultureInfo.percentPattern == 2)
19421   bag.push("%");    
19422  this.AppendGroupedInteger(bag, ASPx.CultureInfo.numGroups, ASPx.CultureInfo.numGroupSeparator);
19423  if(this.prec > 0) {
19424   bag.push(ASPx.CultureInfo.numDecimalPoint);
19425   this.AppendDigits(bag, this.pointPos, this.pointPos + this.prec);
19426  }  
19427  switch(ASPx.CultureInfo.percentPattern) {
19428   case 0:
19429    bag.push(" %");
19430    break;
19431   case 1:
19432    bag.push("%");
19433    break;
19434  }  
19435  return bag.join("");
19436 },
19437 FormatHex: function(value) {
19438  var result = value.toString(16);
19439  if(result.indexOf("(") > -1)
19440   return result;
19441  result = this.upper ? result.toUpperCase() : result.toLowerCase();
19442  if(this.prec <= result.length)
19443   return result;
19444  var bag = [ ];
19445  for(var i = result.length; i < this.prec; i++)
19446   bag.push(0);
19447  bag.push(result);
19448  return bag.join("");
19449 },
19450 FormatCustom: function(format) {
19451  var sectionList = this.GetCustomFormatSections(format);
19452  var section = this.SelectCustomFormatSection(sectionList);
19453  if(section == "")
19454   return this.positive ? "" : "-";
19455  var info = this.ParseCustomFormatSection(section);
19456  var lists = this.CreateCustomFormatLists(info);
19457  if(sectionList.length > 2 && section != sectionList[2]) {
19458   var zero = lists.i.concat(lists.f).join("").split(0).join("") == "";
19459   if(zero) {
19460    section = sectionList[2];
19461    info = this.ParseCustomFormatSection(section);
19462    lists = this.CreateCustomFormatLists(info);   
19463   }   
19464  }
19465  return this.FormatCustomCore(section, info, lists);
19466 },
19467 GetCustomFormatSections: function(format) {
19468  var sections = [ ];
19469  var escaping = false;
19470  var quote = "";
19471  var length = 0;
19472  var prevPos = 0;
19473  for(var i = 0; i < format.length; i++) {
19474   var ch = format.charAt(i);
19475   if(!escaping && quote == "" && ch == ";") {
19476    sections.push(format.substr(prevPos, length));
19477    length = 0;
19478    prevPos = i + 1;
19479    if(sections.length > 2)
19480     break;
19481   } else {
19482    if(escaping)
19483     escaping = false;
19484    else if(ch == quote)
19485     quote = quote == "" ? ch : "";
19486    else if(ch == "\\")
19487     escaping = true;
19488    else if(ch == "'" || ch == '"')
19489     quote = ch;
19490    ++length;
19491   }
19492  }
19493  if(length > 0)
19494   sections.push(format.substr(prevPos, length));
19495  if(sections.length < 1)
19496   sections.push(format);
19497  return sections;
19498 },
19499 SelectCustomFormatSection: function(sections) {
19500  if(!this.positive && sections.length > 1 && sections[1] != "") {
19501   this.positive = true;
19502   return sections[1];
19503  }
19504  if(this.digits.length < 1 && sections.length > 2 && sections[2] != "")
19505   return sections[2];
19506  return sections[0];
19507 },
19508 CreateCustomFormatInfo: function() {
19509  return {
19510   pointPos: -1,
19511   grouping: false,
19512   exp: false,
19513   expShowPlus: false,
19514   percent: false,
19515   scaling: 0,
19516   intDigits: 0,
19517   fracDigits: 0,
19518   expDigits: 0,
19519   intSharps: 0,
19520   fracSharps: 0, 
19521   expSharps: 0
19522  };
19523 },
19524 ParseCustomFormatSection: function(section) {  
19525  var quote = "";
19526  var area = "i"; 
19527  var canParseIntSharps = true;
19528  var result = this.CreateCustomFormatInfo();
19529  var groupSeparators = 0;  
19530  for(var i = 0; i < section.length; i++) {
19531   var ch = section.charAt(i);   
19532   if(ch == quote) {
19533    quote = "";    
19534    continue;
19535   }
19536   if(quote != "")
19537    continue;
19538   if(area == "e" && ch != "0" && ch != "#") {
19539    area = result.pointPos < 0 ? "i" : "f";
19540    i--;
19541    continue;
19542   }
19543   switch(ch) {
19544    case "\\":
19545     i++;
19546     continue;
19547    case "'":
19548    case '"':
19549     quote = ch;
19550     continue;
19551    case "#":
19552    case "0":
19553     if(ch == "#") {
19554      switch(area) {
19555       case "i":
19556        if(canParseIntSharps)
19557         result.intSharps++;
19558        break;
19559       case "f":
19560        result.fracSharps++;
19561        break;
19562       case "e":
19563        result.expSharps++;
19564        break;
19565      }
19566     } else {
19567      canParseIntSharps = false;
19568      switch(area) {
19569       case "f":
19570        result.fracSharps = 0;        
19571        break;
19572       case "e":
19573        result.expSharps = 0;
19574        break;
19575      }
19576     }
19577     switch(area) {
19578      case "i":
19579       result.intDigits++;
19580       if(groupSeparators > 0)
19581        result.grouping = true;
19582       groupSeparators = 0;
19583       break;
19584      case "f":
19585       result.fracDigits++;  
19586       break;
19587      case "e":
19588       result.expDigits++;
19589       break;
19590     }
19591     break;
19592    case "e":
19593    case "E":
19594     if(result.exp)
19595      break;
19596     result.exp = true;     
19597     area = "e"; 
19598     if(i < section.length - 1) {
19599      var next = section.charAt(1 + i);
19600      if(next == "+" || next == "-") {
19601       if(next == "+")
19602        result.expShowPlus = true;
19603       i++;
19604      }
19605      else if(next != "0" && next != "#") {
19606       result.exp = false;
19607       if(result.pointPos < 0)
19608        area = "i";       
19609      }
19610     }
19611     break;
19612    case ".":
19613     area = "f";
19614     if(result.pointPos < 0)
19615      result.pointPos = i;
19616     break;
19617    case "%":
19618     result.percent = true;     
19619     break;
19620    case ",":
19621     if(area == "i" && result.intDigits > 0)
19622      groupSeparators++;
19623     break;
19624    default:
19625     break;
19626   }
19627  }
19628  if(result.expDigits < 1)
19629   result.exp = false;
19630  else
19631   result.intSharps = 0;
19632  if(result.fracDigits < 1)
19633   result.pointPos = -1;
19634  result.scaling = 3 * groupSeparators;  
19635  return result;
19636 },
19637 CreateCustomFormatLists: function(info) {
19638  var intList = [ ];
19639  var fracList = [ ];
19640  var expList = [ ];
19641  if(this.digits.length > 0) {
19642   if(info.percent)
19643    this.pointPos += 2;
19644   this.pointPos -= info.scaling;
19645  }
19646  var expPositive = true;
19647  if(info.exp && (info.intDigits > 0 || info.fracDigits > 0)) {
19648   var diff = 0;
19649   if(this.digits.length > 0) {
19650    this.Round(info.intDigits + info.fracDigits - this.pointPos);
19651    diff -= this.pointPos - info.intDigits;
19652    this.pointPos = info.intDigits;
19653   }
19654   expPositive = diff <= 0;   
19655   expList = String(diff < 0 ? -diff : diff).split("");
19656  } else {
19657   this.Round(info.fracDigits);
19658  }
19659  if(this.digits.length < 1 || this.pointPos < 1)
19660   intList = [ 0 ];
19661  else
19662   this.AppendDigits(intList, 0, this.pointPos);
19663  this.AppendDigits(fracList, this.pointPos, this.digits.length);
19664  if(info.exp) {
19665   while(intList.length < info.intDigits)
19666    intList.unshift(0);
19667   while(expList.length < info.expDigits - info.expSharps)
19668    expList.unshift(0);
19669   if(expPositive && info.expShowPlus)
19670    expList.unshift("+");
19671   else if(!expPositive)
19672    expList.unshift("-");
19673  } else {
19674   while(intList.length < info.intDigits - info.intSharps)
19675    intList.unshift(0);    
19676   if(info.intSharps >= info.intDigits) {
19677    var zero = true;
19678    for(var i = 0; i < intList.length; i++) {
19679     if(intList[i] != 0) {
19680      zero = false;
19681      break;
19682     }
19683    }
19684    if(zero)
19685     intList = [ ];
19686   }
19687  }
19688  while(fracList.length < info.fracDigits - info.fracSharps)
19689   fracList.push(0);
19690  return {
19691   i: intList,
19692   f: fracList,
19693   e: expList
19694  };
19695 },
19696 FormatCustomCore: function(section, info, lists) {
19697  var intLen = 0; 
19698  var total = 0;
19699  var groupIndex = 0; 
19700  var counter = 0;
19701  var groupSize = 0;
19702  if(info.grouping && ASPx.CultureInfo.numGroups.length > 0) {
19703   intLen = lists.i.length;
19704   for(var i = 0; i < ASPx.CultureInfo.numGroups.length; i++) {
19705    if(total + ASPx.CultureInfo.numGroups[i] <= intLen) {
19706     total += ASPx.CultureInfo.numGroups[i];
19707     groupIndex = i;
19708    }
19709   }
19710   groupSize = ASPx.CultureInfo.numGroups[groupIndex];
19711   var fraction = intLen > total ? intLen - total : 0;
19712   if(groupSize == 0) {
19713    while(groupIndex >= 0 && ASPx.CultureInfo.numGroups[groupIndex] == 0)
19714     groupIndex--;
19715    groupSize = fraction > 0 ? fraction : ASPx.CultureInfo.numGroups[groupIndex];
19716   }
19717   if(fraction == 0) {
19718    counter = groupSize;
19719   } else {
19720    groupIndex += Math.floor(fraction / groupSize);
19721    counter = fraction % groupSize;
19722    if(counter == 0)
19723     counter = groupSize;
19724    else
19725     groupIndex++;
19726   }
19727  } else {
19728   info.grouping = false;
19729  }
19730  var bag = [ ];
19731  var area = "i";
19732  var intSharps = 0;
19733  var intListIndex = 0;
19734  var fracListIndex = 0;
19735  var savedCh = "";
19736  for(var i = 0; i < section.length; i++) {
19737   var ch = section.charAt(i);
19738   if(ch == savedCh) {
19739    savedCh = "";
19740    continue;
19741   }
19742   if(savedCh != "") {
19743    bag.push(ch);
19744    continue;
19745   }
19746   switch(ch) {
19747    case "\\":
19748     ++i;
19749     if(i < section.length)
19750      bag.push(section.charAt(i));
19751     continue;
19752    case "'":
19753    case '"':     
19754     savedCh = ch;
19755     continue;
19756    case "#":     
19757    case "0":
19758     if(area == "i") {
19759      intSharps++;
19760      if(ch == "0" || info.intDigits - intSharps < lists.i.length + intListIndex) {
19761       while(info.intDigits - intSharps + intListIndex < lists.i.length) {
19762        bag.push(lists.i[intListIndex]);
19763        intListIndex++;
19764        if(info.grouping && --intLen > 0 && --counter == 0) {
19765         bag.push(ASPx.CultureInfo.numGroupSeparator);
19766         if(--groupIndex < ASPx.CultureInfo.numGroups.length && groupIndex >= 0)
19767          groupSize = ASPx.CultureInfo.numGroups[groupIndex];
19768         counter = groupSize;
19769        }
19770       }
19771      }
19772     } else if(area == "f") {
19773      if(fracListIndex < lists.f.length) {
19774       bag.push(lists.f[fracListIndex]);
19775       fracListIndex++;
19776      }
19777     }
19778     break;
19779    case "e":
19780    case "E":
19781     if(lists.e == null || !info.exp) {
19782      bag.push(ch);
19783      break;
19784     }
19785     for(var q = i + 1; q < section.length; q++) {
19786      if(q == i + 1 && (section.charAt(q) == "+" || section.charAt(q) == "-"))
19787       continue;                   
19788      if(section.charAt(q) == "0" || section.charAt(q) == "#")
19789       continue;
19790      break;
19791     }
19792     i = q - 1;
19793     area = info.pointPos < 0 ? "i" : "f";
19794     bag.push(ch);
19795     bag = bag.concat(lists.e);
19796     lists.e = null;      
19797     break;
19798    case ".":
19799     if(info.pointPos == i && lists.f.length > 0)
19800      bag.push(ASPx.CultureInfo.numDecimalPoint);
19801     area = "f";
19802     break;
19803    case ",":
19804     break;
19805    default:
19806     bag.push(ch);
19807     break;
19808   }
19809  }
19810  if(!this.positive)
19811   bag.unshift("-");
19812  return bag.join("");
19813 },
19814 FillDigitInfo: function(value) {
19815  this.positive = true;
19816  if(value < 0) {
19817   value = -value;
19818   this.positive = false;   
19819  }
19820  this.digits = [ ];
19821  this.pointPos = 0;    
19822  if(value == 0 || !isFinite(value) || isNaN(value)) {
19823   this.pointPos = 1;
19824   return;
19825  }
19826  var list = String(value).split("e");
19827  var str = list[0];
19828  if(list.length > 1) {   
19829   this.pointPos = Number(list[1]);
19830  }
19831  var frac = false;
19832  var decimalCount = 0;
19833  for(var i = 0; i < str.length; i++) {
19834   var ch = str.charAt(i);
19835   if(ch == ".") {
19836    frac = true;
19837   } else {
19838    if(frac)
19839     decimalCount++;     
19840    if(ch != "0" || this.digits.length > 0)
19841     this.digits.push(Number(ch));
19842   }
19843  }
19844  this.pointPos += this.digits.length - decimalCount;
19845 },
19846 FillFormatInfo: function(format) {
19847  this.upper = true;
19848  this.custom = false;
19849  this.prec = -1;
19850  var spec;
19851  if(format == null || format.length < 1)
19852   spec = "G";
19853  else
19854   spec = format.charAt(0);
19855  if(spec >= "a" && spec <= "z") {
19856   spec = spec.toUpperCase();
19857   this.upper = false;
19858  }
19859  if(spec >= "A" && spec <= "Z") {   
19860   if(format != null && format.length > 1) {
19861    var prec = Number(format.substr(1));
19862    if(!isNaN(prec))
19863     this.prec = prec;
19864    else
19865     this.custom = true;
19866   }
19867  } else {
19868   this.custom = true;   
19869  }  
19870  this.spec = this.custom ? "0" : spec;
19871 },
19872 Round: function(shift) {
19873  var amount = this.digits.length - this.pointPos - shift;
19874  if(amount <= 0) 
19875   return;
19876  var cutPos = this.pointPos + shift;
19877  if(cutPos < 0) {
19878   this.digits = [ ];
19879   this.pointPos = 0;
19880   return;
19881  }
19882  var digit = this.digits[cutPos];
19883  if(digit > 4) { 
19884   for(var i = 0; i < amount; i++) {
19885    var index = cutPos - 1 - i;
19886    if(index < 0) {
19887     this.digits.unshift(0);
19888     this.pointPos++;
19889     cutPos++;
19890     index++;
19891    }
19892    digit = this.digits[index];    
19893    if(digit < 9) {
19894     this.digits[index] = 1 + digit;
19895     break;
19896    } else {
19897     this.digits[index] = 0;
19898     amount++;
19899    }
19900   }
19901  }
19902  for(var i = cutPos - 1; i >= 0; i--) {
19903   if(this.digits[i] > 0) break;
19904   cutPos--;
19905  }
19906  this.digits.splice(cutPos, this.digits.length - cutPos);
19907 },
19908 AppendGroupedInteger: function(list, groups, separator) { 
19909  if(this.pointPos < 1) {
19910   list.push(0);
19911   return;
19912  }
19913  var total = 0;
19914  var groupIndex = 0;
19915  for(var i = 0; i < groups.length; i++) {
19916   if(total + groups[i] <= this.pointPos) {
19917    total += groups[i];
19918    groupIndex = i;
19919   }
19920   else
19921    break;
19922  }
19923  if(groups.length > 0 && total > 0) {
19924   var counter;
19925   var groupSize = groups[groupIndex];
19926   var fraction = this.pointPos > total ? this.pointPos - total : 0;
19927   if(groupSize == 0) {
19928    while(groupIndex >= 0 && groups[groupIndex] == 0)
19929     groupIndex--;
19930    groupSize = fraction > 0 ? fraction : groups[groupIndex];
19931   }
19932   if(fraction == 0) {
19933    counter = groupSize;
19934   } else {
19935    groupIndex += Math.floor(fraction / groupSize);
19936    counter = fraction % groupSize;
19937    if(counter == 0)
19938     counter = groupSize;
19939    else
19940     groupIndex++;
19941   }
19942   var i = 0;
19943   while(true) {
19944    if(this.pointPos - i <= counter || counter == 0) {
19945     this.AppendDigits(list, i, this.pointPos);
19946     break;
19947    }
19948    this.AppendDigits(list, i, i + counter);
19949    list.push(separator);
19950    i += counter;    
19951    groupIndex--;     
19952    if(groupIndex < groups.length && groupIndex >= 0)
19953     groupSize = groups[groupIndex];
19954    counter = groupSize;
19955   }
19956  } else {
19957   this.AppendDigits(list, 0, this.pointPos);   
19958  }  
19959 },
19960 AppendDigits: function(list, start, end) {
19961  for(var i = start; i < end; i++) {
19962   if(i < 0 || i >= this.digits.length)
19963    list.push(0);
19964   else
19965    list.push(this.digits[i]);
19966  }
19967 }
19968};
19969})();
19970(function() {
19971var dropDownNameSuffix = "_DDD";
19972var itemImageCellClassName = "dxeIIC";
19973var CONSTANTS = {
19974 DROPDOWN_COMMAND_APPLY: "Apply",
19975 DROPDOWN_COMMAND_CLOSE: "Close",
19976 DROPDOWN_HELPTEXT_CLASS: "dxdd-help",
19977 DROPDOWN_CAPTION_CLASS: "dxdd-caption",
19978 DROPDOWN_HEADER_CLASS: "dxdd-header",
19979 DROPDOWN_MODALVISIBLE_CLASS: "dxdd-vmdd"
19980};
19981var DROPDOWN_ELEMENT_VISIBILITY = {
19982 Never: 0,
19983 DropDown: 1,
19984 ModalDropDown: 2,
19985 Always: 3
19986};
19987ASPx.DROPDOWN_ELEMENT_VISIBILITY = DROPDOWN_ELEMENT_VISIBILITY;
19988var ASPxClientDropDownEditBase = ASPx.CreateClass(ASPxClientButtonEditBase, {
19989 constructor: function(name) {
19990  this.constructor.prototype.constructor.call(this, name);
19991  this.DropDown = new ASPxClientEvent();
19992  this.CloseUp = new ASPxClientEvent();
19993  this.QueryCloseUp = new ASPxClientEvent();
19994  this.ddHeightCache = ASPx.InvalidDimension;
19995  this.ddWidthCache = ASPx.InvalidDimension;
19996  this.mainElementWidthCache = ASPx.InvalidDimension;
19997  this.dropDownButtonIndex = -1;
19998  this.droppedDown = false;
19999  this.ddButtonPushed = false;
20000  this.lastSuccessText = "";
20001  this.isToolbarItem = false;
20002  this.allowFocusDropDownWindow = false;
20003  this.pcIsShowingNow = false;
20004  this.needTimeoutForInputElementFocusEvent = false;
20005  this.ddButtonsVis = 0;
20006  this.ddmInput = false;
20007  this.ddDefCap = true;
20008  this.ddScrPicker = ASPx.DROPDOWN_ELEMENT_VISIBILITY.Never;
20009  aspxGetDropDownCollection().Add(this);
20010 },
20011 InitializeEvents: function() {
20012  ASPxClientButtonEditBase.prototype.InitializeEvents.call(this);
20013  var ddTargets = this.getDropDownEventTargets();
20014  ddTargets
20015   .filter(function(trg, index, arr) { return trg && arr.indexOf(trg) === index; })
20016   .forEach(function(trg) {
20017    ASPx.Evt.AttachEventToElement(trg, "click", this.onDropDownEvent.bind(this));
20018    ASPx.Evt.AttachEventToElement(trg, ASPx.TouchUIHelper.touchMouseDownEventName, this.onDropDownEvent.bind(this));
20019  }.bind(this));
20020 },
20021 getDropDownEventTargets: function() {
20022  return [
20023   this.GetDropDownItemImageCell(),
20024   this.GetDropDownButton()
20025  ];
20026 },
20027 onDropDownEvent: function(evt) {
20028  if(evt.type === this.getDropDownEvent() && ASPx.Evt.IsLeftButtonPressed(evt) && this.GetEnabled())
20029   return this.OnDropDown(evt);
20030 },
20031 getDropDownEvent: function() {
20032  return this.isDropDownModal() || ASPx.Browser.MobileUI ? "click" : ASPx.TouchUIHelper.touchMouseDownEventName;
20033 },
20034 Initialize: function(){
20035  this.initializePopupControl();
20036  this.AssignClientAttributes();
20037  this.InitLastSuccessText();
20038  if(this.RefocusOnClickRequired()){ 
20039   ASPx.Evt.AttachEventToElement(this.GetMainElement(), "click", function(evt) {
20040    if(this.GetInputElement() && ASPx.Evt.GetEventSource(evt).id != this.GetInputElement().id) 
20041     this.ForceRefocusEditor(evt);
20042   }.aspxBind(this));
20043  }
20044  if(this.accessibilityCompliant && ASPx.IsExists(this.GetAccessibilityAssistantElement())) {
20045   this.GotFocus.AddHandler(function() { 
20046    this.ariaExplanatoryTextManager.SetHelperLabel(); 
20047   }.aspxBind(this));
20048  }
20049  ASPxClientButtonEditBase.prototype.Initialize.call(this);
20050 },
20051 initializePopupControl: function() {
20052  var pc = this.GetPopupControl();
20053  if(!pc) return;
20054  pc.usedInDropDown = true;
20055  pc.dropDownEditName = this.name;
20056  pc.setFocusOnCallback = false;
20057  this.initializeDropDown(pc);
20058 },
20059 initializeDropDown: function(pc) {
20060  pc = pc || this.GetPopupControl();
20061  if(!pc)
20062   return;
20063  if(this.ddmBP !== undefined) {
20064   pc.AdaptiveModeChanged.AddHandler(function() {
20065    this.onDropDownModalChanged(pc.GetAdaptiveModalMode());
20066   }.bind(this));
20067   pc.PopUp.AddHandler(function() {
20068    if(pc.GetAdaptiveModalMode())
20069     this.onDropDownModalChanged(true);
20070   }.bind(this));
20071   pc.Closing.AddHandler(function() {
20072    if(pc.GetAdaptiveModalMode())
20073     this.onDropDownModalChanged(false);
20074   }.bind(this));
20075  }
20076  this.initializeDropDownCommandButtons(pc);
20077  if(this.flSettings) {
20078   this.initializeDropDownContent(pc, this.flSettings.caption, this.flSettings.helpText);
20079   delete this.flSettings;
20080  }
20081 },
20082 initializeDropDownCommandButtons: function(pc) {
20083  this.dropDownCommandButtons = {};
20084  [CONSTANTS.DROPDOWN_COMMAND_APPLY, CONSTANTS.DROPDOWN_COMMAND_CLOSE].forEac
20084h(function(cmd) {
20085   var button = this.createDropDownCommandButtonClientInstance(pc, cmd);
20086   if(button) {
20087    button.useSubmitBehavior = false;
20088    button.causesValidation = false;
20089    button.accessibilityCompliant = this.accessibilityCompliant;
20090    button.Click.AddHandler(this.onDropDownCommandButtonClick.bind(this, cmd));
20091    button.InlineInitialize();
20092    this.dropDownCommandButtons[cmd] = button;
20093   }
20094  }.bind(this));
20095  this.ensureDropDownApplyCommandState();
20096 },
20097 createDropDownCommandButtonClientInstance: function(pc, cmd) {
20098  var name = pc.name + "_" + cmd;
20099  return document.getElementById(name) ? new ASPxClientButton(name) : null;
20100 },
20101 initializeDropDownContent: function(pc, caption, helpText) {
20102  if(this.ddmBP === undefined)
20103   return;
20104  var container = pc.GetContentContainer(-1);
20105  if(helpText) {
20106   var helpTextContainer = container.querySelector(CONSTANTS.DROPDOWN_HELPTEXT_CLASS);
20107   if(!helpTextContainer) {
20108    helpTextContainer = document.createElement("div");
20109    helpTextContainer.innerHTML = this.HtmlEncode(helpText);
20110    helpTextContainer.className = CONSTANTS.DROPDOWN_HELPTEXT_CLASS + " " + CONSTANTS.DROPDOWN_MODALVISIBLE_CLASS;
20111    container.appendChild(helpTextContainer);
20112   }
20113  }
20114  if(caption && this.ddDefCap) {
20115   var captionContainer = container.querySelector("." + CONSTANTS.DROPDOWN_CAPTION_CLASS);
20116   if(!captionContainer) {
20117    captionContainer = document.createElement("div");
20118    captionContainer.className = CONSTANTS.DROPDOWN_CAPTION_CLASS + " " + CONSTANTS.DROPDOWN_MODALVISIBLE_CLASS;
20119    var headerContainer = container.querySelector("." + CONSTANTS.DROPDOWN_HEADER_CLASS);
20120    if(!headerContainer) {
20121     headerContainer = document.createElement("div");
20122     headerContainer.className = CONSTANTS.DROPDOWN_HEADER_CLASS + " " + CONSTANTS.DROPDOWN_MODALVISIBLE_CLASS;
20123     container.insertBefore(headerContainer, container.firstChild);
20124    }
20125    headerContainer.insertBefore(captionContainer, headerContainer.firstChild);
20126   }
20127   captionContainer.innerHTML = this.HtmlEncode(caption);
20128  }
20129 },
20130 InitLastSuccessText: function(){
20131  var rawText = this.GetTextInternal();
20132  this.SetLastSuccessText(rawText);
20133 },
20134 AssignClientAttributes: function(){
20135  var element = this.GetDropDownButton();
20136  if(ASPx.IsExistsElement(element))
20137   ASPx.Evt.PreventElementDragAndSelect(element, true);
20138 },
20139 RefocusOnClickRequired: function(){
20140  return false;
20141 },
20142 SetReadOnlyInternal: function(readOnly) {
20143  ASPxClientButtonEditBase.prototype.SetReadOnlyInternal.call(this, readOnly);
20144  if(this.isDropDownModal())
20145   this.ensureDropDownModalInputVisibility();
20146  this.ensureDropDownApplyCommandState();
20147 },
20148 SetEnabled: function(enabled) {
20149  ASPxClientButtonEditBase.prototype.SetEnabled.call(this, enabled);
20150  this.ensureDropDownApplyCommandState();
20151 },
20152 GetDropDownButton: function(){
20153  return this.GetButton(this.dropDownButtonIndex);
20154 },
20155 GetButtonCollection: function(){
20156  var buttonElements = ASPxClientButtonEditBase.prototype.GetButtonCollection.call(this);
20157  var dropDownButtonElement = this.GetDropDownButton();
20158  if(ASPx.IsExists(dropDownButtonElement))
20159   buttonElements.push(dropDownButtonElement);
20160  return buttonElements;
20161 },
20162 GetPopupControl: function(){
20163  var pc = ASPx.GetControlCollection().Get(this.name + dropDownNameSuffix);
20164  if(pc && pc.GetWindowElement(-1))
20165   return pc;
20166  else
20167   return null;
20168 },
20169 GetDropDownWindow: function() {
20170  var pc = this.GetPopupControl();
20171  if(pc)
20172   return pc.GetWindowElement(-1);
20173  return null;
20174 },
20175 GetDropDownInnerControlName: function(suffix){
20176  var pc = this.GetPopupControl();
20177  if(pc)
20178   return this.GetPopupControl().name + suffix;
20179  return "";
20180 },
20181 GetDropDownItemImageCell: function() {
20182  return ASPx.GetNodesByPartialClassName(this.GetMainElement(), itemImageCellClassName)[0];
20183 },
20184 GetIsControlWidthWasChanged: function(){
20185  return this.mainElementWidthCache == ASPx.InvalidDimension || this.mainElementWidthCache != this.GetMainElement().clientWidth;
20186 },
20187 GetDropDownHeight: function(){
20188  return null;
20189 },
20190 GetDropDownWidth: function(){
20191  return null;
20192 },
20193 GetDropDownIsWindowElement: function(id, pcPostfix) {
20194  var pos = id.lastIndexOf(pcPostfix);
20195  if(pos != -1) {
20196   var name = id.substring(0, pos);
20197   var pc = ASPx.GetPopupControlCollection().Get(name);
20198   if(pc && pc.dropDownEditName)
20199    return aspxGetDropDownCollection().Get(pc.dropDownEditName);
20200  }
20201  return null;
20202 },
20203 GetDropDownParents: function() {
20204  var parents = [ ];
20205  var mainElement = this.GetMainElement();
20206  var element = mainElement.parentNode;
20207  while(element != null){
20208   if(element.tagName == "BODY")
20209    break;
20210   var dropDown = this.GetElementIsDropDownParent(element);
20211   if(dropDown != null)
20212    parents.push(dropDown);
20213   element = element.parentNode;
20214  }
20215  return parents.reverse();
20216 },
20217 GetElementIsDropDownParent: function(element) {
20218  return ASPx.Attr.IsExistsAttribute(element, "id") 
20219   ? this.GetDropDownIsWindowElement(ASPx.Attr.GetAttribute(element, "id"), ASPx.PCWIdSuffix + "-1") : null;
20220 },
20221 BeforePopupControlResizing: function() {
20222 },
20223 AfterPopupControlResizing: function() {
20224 },
20225 AfterPopupControlShown: function() {
20226 },
20227 ShowDropDownArea: function(isRaiseEvent, forceSize) {
20228  this.SetPCIsShowingNow(true);
20229  aspxGetDropDownCollection().RegisterDroppedDownControl(this, this.GetDropDownParents());
20230  if(!this.droppedDown) 
20231   this.SetLockListBoxClick();
20232  this.lockClosing = true; 
20233  var pc = this.GetPopupControl();
20234  var element = this.GetMainElement();
20235  var pcwElement = pc.GetCurrentWindowElement();
20236  pc.OnBeforeDropdownShow();
20237  if(ASPx.Browser.Chrome && pcwElement.clientHeight <= 0) 
20238   this.RestorePopupInsideNonStaticPositionedContainer();
20239  var height = forceSize ? forceSize.height : this.GetDropDownHeight();
20240  var width = forceSize ? forceSize.width : this.GetDropDownWidth();
20241  this.BeforePopupControlResizing();
20242  if(this.ddHeightCache != height || this.ddWidthCache != width || forceSize) {
20243   pc.SetSize(width, height);
20244   if(!forceSize) {
20245    this.ddHeightCache = height;
20246    this.ddWidthCache = width;
20247   }
20248  }
20249  this.AfterPopupControlResizing();
20250  if(ASPx.Browser.Chrome && pcwElement.clientHeight <= 0) 
20251   this.RestorePopupInsideNonStaticPositionedContainer();
20252  this.RaiseDropDownEventRequired = isRaiseEvent;
20253  pc.ShowAtElement(element, true);
20254  this.AfterPopupControlShown();
20255  this.droppedDown = true;
20256  this.lockClosing = false;
20257 },
20258 HideDropDownArea: function(isRaiseEvent){
20259  if(this.lockClosing || !this.droppedDown) return;
20260  if(!this.RaiseQueryCloseUp()) {
20261   return;
20262  }
20263  this.RemoveLockListBoxClick();
20264  this.DropDownButtonPop();
20265  var pc = this.GetPopupControl();
20266  if(pc){
20267   aspxGetDropDownCollection().UnregisterDroppedDownControl(this);
20268   pc.Hide();
20269   if(isRaiseEvent)
20270    this.RaiseCloseUp();
20271   this.droppedDown = false;
20272  }
20273 },
20274 RaiseLostFocus: function() {
20275  this.ensureDropDownClosedOnLostFocus();
20276  ASPxClientButtonEditBase.prototype.RaiseLostFocus.call(this);
20277 },
20278 ensureDropDownClosedOnLostFocus: function() {
20279  if(!this.isDropDownModal() && this.droppedDown)
20280   this.HideDropDownArea(true);
20281 },
20282 RestorePopupInsideNonStaticPositionedContainer: function() {
20283  var pc = this.GetPopupControl();
20284  var pcwElement = pc.GetCurrentWindowElement();
20285  var pcwParentElement = pcwElement.parentNode;
20286  var offsetParentElement = pcwElement.offsetParent;
20287  if(!offsetParentElement || offsetParentElement.tagName == "BODY") return;
20288  pcwParentElement.style.position = "relative";
20289  setTimeout(
20290   function() { 
20291    pcwParentElement.style.position = "";
20292    if(this.focused)
20293     pc.ShowAtElement(this.GetMainElement());
20294   }.aspxBind(this), 0);
20295 },
20296 SetLockListBoxClick: function() {
20297  this.lockListBoxClick = true;
20298 },
20299 RemoveLockListBoxClick: function() {
20300  delete this.lockListBoxClick;
20301 },
20302 ProcessInternalButtonClick: function(buttonIndex) {
20303  return this.dropDownButtonIndex == buttonIndex;
20304 },
20305 ToggleDropDown: function(){
20306  this.OnApplyChanges();
20307  if(this.droppedDown)
20308   this.HideDropDownArea(true);
20309  else
20310   this.ShowDropDownArea(true);  
20311 },
20312 GetTextInternal: function(){
20313  var text = ASPxClientButtonEditBase.prototype.GetValue.call(this);
20314  return text != null ? text : "";
20315 },
20316 SetTextInternal: function(text){
20317  if(!this.GetReadOnly())
20318   this.SetTextBase(text);
20319 },
20320 SetTextBase: function(text) {
20321  ASPxClientButtonEditBase.prototype.SetValue.call(this, text);
20322 },
20323 SetValue: function(value) {
20324  ASPxClientButtonEditBase.prototype.SetValue.call(this, value);
20325  this.SetLastSuccessText(this.GetTextInternal());
20326 },
20327 SetLastSuccessText: function(text){
20328  var tmpText = text;
20329  if(text == null) tmpText = "";
20330  else if(typeof(text) != "string")
20331     tmpText = text.toString();
20332  this.lastSuccessText = tmpText;
20333 },
20334 SetVisible: function(visible) {
20335  ASPxClientButtonEditBase.prototype.SetVisible.call(this, visible);
20336  if(!visible)
20337   this.HideDropDown();
20338 },
20339 RollbackTextInputValue: function () {
20340  this.SetTextBase(this.lastSuccessText);
20341 },
20342 SetPCIsShowingNow: function(value){
20343  this.pcIsShowingNow = value;
20344 },
20345 GetLastSuccesfullValue: function() {
20346  return this.lastSuccessText !== '' ? this.lastSuccessText : null;
20347 },
20348 CreateAriaExplanatoryTextManager: function() {
20349  if(this.accessibilityCompliant)
20350   return new DropDownAccessibilityExplanatoryTextManager(this);
20351  else 
20352   return new ASPx.DisableAccessibilityExplanatoryTextManager(this);
20353 },
20354 GetAccessibilityText: function() {
20355  var labelText = "";
20356  var helperContainer = this.GetAccessibilityAssistantElement();
20357  if(ASPx.IsExists(helperContainer))
20358   labelText = ASPx.Attr.GetAttribute(helperContainer, "aria-label");
20359  return !!labelText ? labelText : this.GetTextInternal();
20360 },
20361 GetAccessibilityActiveElements: function() {
20362  var helperContainer = this.GetAccessibilityAssistantElement();
20363  if(!this.accessibilityCompliant || !ASPx.IsExists(helperContainer))
20364   return [this.GetInputElement()];
20365  else if(ASPx.IsExists(this.accessibilityHelper))
20366   return [this.accessibilityHelper.GetActiveElement(true)];
20367  else 
20368   return [helperContainer];
20369 },
20370 OnValueChanged: function() {
20371  this.SetLastSuccessText(this.GetTextInternal());
20372  ASPxClientEdit.prototype.OnValueChanged.call(this);
20373 },
20374 OnApplyChanges: function(){
20375 },
20376 OnCancelChanges: function(){
20377  var isCancelProcessed = (this.GetTextInternal() != this.lastSuccessText);
20378  this.SetTextInternal(this.lastSuccessText);
20379  return isCancelProcessed;
20380 },
20381 OnFocus: function () {
20382  if(this.CorrectFocusWhenDisabled())
20383   return;
20384  if(ASPx.Browser.IE && this.needTimeoutForInputElementFocusEvent) {
20385   setTimeout(function () {
20386    this.OnFocusInternal();
20387    this.needTimeoutForInputElementFocusEvent = false;
20388   }.aspxBind(this), 0);
20389  } else
20390   this.OnFocusInternal();
20391 },
20392 OnFocusInternal: function() {
20393  this.OnSetFocus(true);
20394  ASPxClientButtonEditBase.prototype.OnFocus.call(this);
20395 },
20396 OnLostFocus: function(){
20397  this.OnSetFocus(false);
20398  ASPxClientButtonEditBase.prototype.OnLostFocus.call(this);
20399 },
20400 OnSetFocus: function(isFocused){
20401  aspxGetDropDownCollection().SetFocusedDropDownName(isFocused ? this.name : "");
20402 },
20403 IsEditorElement: function(element) {
20404  if(ASPxClientButtonEditBase.prototype.IsEditorElement.call(this, element))
20405   return true;
20406  if(this.allowFocusDropDownWindow)
20407   return false;
20408  var pc = this.GetPopupControl();
20409  if(pc != null) {
20410   var windowElement = pc.GetCurrentWindowElement();
20411   return windowElement == element || ASPx.GetIsParent(windowElement, element);
20412  }
20413  return false;
20414 },
20415 OnPopupControlShown: function(){
20416  this.SetPCIsShowingNow(false);
20417  if(this.RaiseDropDownEventRequired){
20418   this.RaiseDropDownEventRequired = false;
20419   window.setTimeout(function() { this.RaiseDropDown(); }.aspxBind(this), 0);
20420  }
20421 },
20422 IsCanToDropDown: function(){
20423  return true;
20424 },
20425 OnDropDown: function(evt) { 
20426  if(!this.isInitialized) 
20427   return true;
20428  if(evt.type === ASPx.TouchUIHelper.touchMouseDownEventName && ASPx.Evt.GetEventSource(evt) === this.GetInputElement())
20429   this.OnMouseDown();
20430  if(!this.IsCanToDropDown()) {
20431   this.ForceRefocusEditor(evt);
20432   return true;
20433  }
20434  if(ASPx.Browser.IE && ASPx.Browser.Version < 9 || ASPx.Browser.Opera){
20435   if(!this.droppedDown) {
20436    ASPx.Evt.EmulateOnMouseDown(this.GetMainElement(), evt);
20437    ASPx.GetStateController().ClearSavedCurrentPressedElement();
20438   }
20439  }
20440  this.OnDropDownCore(evt);
20441  if(this.needCancelBubbleDropDownEvent())
20442   return ASPx.Evt.CancelBubble(evt); 
20443  return true;
20444 },
20445 OnDropDownCore: function(evt) {
20446  if(!this.droppedDown)
20447   this.DropDownButtonPush();
20448  this.ToggleDropDown();
20449  var isNativeFocus = this.isNativeFocus(evt);
20450  if(!isNativeFocus || !ASPx.Browser.MacOSMobilePlatform)
20451   this.ForceRefocusEditor(evt, isNativeFocus);
20452 },
20453 isNativeFocus: function(evt) {
20454  var inputElement = this.GetInputElement();
20455  return !!inputElement ? this.IsElementBelongToInputElement(ASPx.Evt.GetEventSource(evt)) : false;
20456 },
20457 needCancelBubbleDropDownEvent: function() {
20458  return true;
20459 },
20460 DropDownButtonPush: function(){
20461  if(this.droppedDown || this.ddButtonPushed) return;
20462  this.ddButtonPushed = true;
20463  if(ASPx.Browser.IE && ASPx.Browser.Version < 9 || ASPx.Browser.Opera)
20464   this.DropDownButtonPushPop(true);
20465  else
20466   this.DropDownButtonPushMozilla();
20467 }, 
20468 DropDownButtonPop: function(force){
20469  if((!this.droppedDown || !this.ddButtonPushed) && !force) return;
20470  this.ddButtonPushed = false;
20471  if(ASPx.Browser.IE && ASPx.Browser.Version < 9 || ASPx.Browser.Opera)
20472   this.DropDownButtonPushPop(false);
20473  else
20474   this.DropDownButtonPopMozilla();
20475 },
20476 DropDownButtonPushPop: function(isPush){
20477  var buttonElement = this.GetDropDownButton();
20478  if(buttonElement){
20479   var controller = ASPx.GetStateController();
20480   var element = controller.GetPressedElement(buttonElement);
20481   if(element){
20482    if(isPush){
20483     controller.SetCurrentHoverElement(null);
20484     controller.DoSetPressedState(element);
20485    } else {
20486     controller.DoClearPressedState(element);
20487     controller.SetCurrentPressedElement(null);
20488     controller.SetCurrentHoverElement(element);
20489    }
20490   }
20491  }
20492 },
20493 DropDownButtonPushMozilla: function(){
20494  this.DisableStyleControllerForDDButton();
20495  var controller = ASPx.GetStateController();
20496  controller.savedCurrentPressedElement = null;
20497 },
20498 DropDownButtonPopMozilla: function(){
20499  this.EnableStyleControllerForDDButton();
20500  var controller = ASPx.GetStateController();
20501  var buttonElement = this.GetDropDownButton();
20502  if(buttonElement){
20503   var element = controller.GetPressedElement(buttonElement);
20504   if(element)
20505    controller.DoClearPressedState(element);
20506   controller.currentPressedElement = null;
20507   element = controller.GetHoverElement(buttonElement);
20508   if(element)
20509    controller.SetCurrentHoverElement(element);
20510  }
20511 },
20512 EnableStyleControllerForDDButton: function(){
20513  var element = this.GetDropDownButton();
20514  if(element){
20515   var controller = ASPx.GetStateController();
20516   this.ReplaceElementControlStyleItem(controller.hoverItems, ASPx.HoverItemKind, element, this.ddButtonHoverStyle);
20517   this.ReplaceElementControlStyleItem(controller.pressedItems, ASPx.PressedItemKind, element, this.ddButtonPressedStyle);
20518   this.ReplaceElementControlStyleItem(controller.selectedItems, ASPx.SelectedItemKind, element, this.ddButtonSelectedStyle);
20519  }
20520 },
20521 DisableStyleControllerForDDButton: function(){
20522  var element = this.GetDropDownButton();
20523  if(element){
20524   var controller = ASPx.GetStateController();
20525   this.ddButtonHoverStyle = this.ReplaceElementControlStyleItem(controller.hoverItems, ASPx.HoverItemKind, element, null);
20526   this.ddButtonPressedStyle = this.ReplaceElementControlStyleItem(controller.pressedItems, ASPx.PressedItemKind, element, null);
20527   this.ddButtonSelectedStyle = this.ReplaceElementControlStyleItem(controller.selectedItems, ASPx.SelectedItemKind, element, null);
20528  }
20529 },
20530 ReplaceElementControlStyleItem: function(items, kind, element, newStyleItem){
20531  var styleItem = items[element.id];
20532  items[element.id] = newStyleItem;
20533  element[kind] = newStyleItem;
20534  return styleItem;
20535 },
20536 CloseDropDownByDocumentOrWindowEvent: function(causedByWindowResizing){
20537  if(!causedByWindowResizing || !this.pcIsShowingNow)
20538   this.HideDropDownArea(true);
20539 },
20540 OnDocumentMouseUp: function() {
20541  this.DropDownButtonPop();
20542 },
20543 OnDDButtonMouseMove: function(evt){
20544 },
20545 ShouldCloseOnMCMouseDown: function () {
20546  return true;
20547 },
20548 OnMainCellMouseDown: function (evt) {
20549  if(this.ShouldCloseOnMCMouseDown())
20550   this.OnCloseUp(evt);
20551 },
20552 OnCloseUp: function (evt) {
20553  if(ASPx.Browser.IE) {
20554   this.needTimeoutForInputElementFocusEvent = true;
20555   setTimeout(function () { this.HideDropDownArea(true); }.aspxBind(this), 0);
20556  } else {
20557   this.HideDropDownArea(true);
20558  }
20559 },
20560 OnOpenAnotherDropDown: function(){
20561  this.HideDropDownArea(true);
20562 },
20563 OnTextChanged: function() {
20564  if(!this.ChangedByEnterKeyPress())
20565   this.OnTextChangedInternal();
20566 },
20567 OnTextChangedInternal: function() {
20568  this.ParseValue();
20569 },
20570 ChangedByEnterKeyPress: function() {
20571  if(ASPx.Browser.Firefox || ASPx.Browser.WebKitFamily) 
20572   if(this.enterKeyPressed) {
20573    this.enterKeyPressed = false;
20574    return true;
20575   } 
20576  return false;
20577 },
20578 ChangeEnabledAttributes: function(enabled){
20579  ASPxClientButtonEditBase.prototype.ChangeEnabledAttributes.call(this, enabled);
20580  var btnElement = this.GetDropDownButton();
20581  if(btnElement)
20582   this.ChangeButtonEnabledAttributes(btnElement, this.GetChangeButtonEnabledAttributesMethod(enabled));
20583  var inputElement = this.GetInputElement();
20584  if(inputElement)
20585   this.ChangeInputCellEnabledAttributes(inputElement.parentNode, ASPx.Attr.ChangeAttributesMethod(enabled));
20586  var imageCell = this.GetDropDownItemImageCell();
20587  if(ASPx.IsExists(imageCell))
20588   this.ChangeImageCellEnabledAttributes(imageCell, ASPx.Attr.ChangeAttributesMethod(enabled));
20589 },
20590 ChangeEnabledStateItems: function(enabled){
20591  ASPxClientButtonEditBase.prototype.ChangeEnabledStateItems.call(this, enabled);
20592  var btnElement = this.GetDropDownButton();
20593  if(btnElement)
20594   ASPx.GetStateController().SetElementEnabled(btnElement, enabled);
20595 },
20596 ChangeInputCellEnabledAttributes: function(element, method){
20597  method(element, "onclick");
20598  method(element, "onkeyup");
20599  if(ASPx.Browser.Edge)
20600   method(element, "onmousedown");
20601  method(element, "on" + ASPx.TouchUIHelper.touchMouseDownEventName);
20602  method(element, "on" + ASPx.TouchUIHelper.touchMouseUpEventName);
20603 },
20604 ChangeImageCellEnabledAttributes: function(imageCell, method){
20605  method(imageCell, "onmousedown");
20606 },
20607 InitializeKeyHandlers: function() {
20608  this.AddKeyDownHandler(ASPx.Key.Enter, "OnEnter");
20609  this.AddKeyDownHandler(ASPx.Key.Esc, "OnEscape");
20610  this.AddKeyDownHandler(ASPx.Key.PageUp, "OnPageUp");
20611  this.AddKeyDownHandler(ASPx.Key.PageDown, "OnPageDown");
20612  this.AddKeyDownHandler(ASPx.Key.End, "OnEndKeyDown");
20613  this.AddKeyDownHandler(ASPx.Key.Home, "OnHomeKeyDown");
20614  this.AddKeyDownHandler(ASPx.Key.Left, "OnArrowLeft");
20615  this.AddKeyDownHandler(ASPx.Key.Right, "OnArrowRight");
20616  this.AddKeyDownHandler(ASPx.Key.Up, "OnArrowUp");
20617  this.AddKeyDownHandler(ASPx.Key.Down, "OnArrowDown");
20618  this.AddKeyDownHandler(ASPx.Key.Tab, "OnTab");
20619 },
20620 OnArrowUp: function(evt){
20621  if(evt.altKey) {
20622   this.ToggleDropDown();
20623   return true;
20624  }
20625  return false;
20626 },
20627 OnArrowDown: function(evt){
20628  if(evt.altKey) {
20629   this.ToggleDropDown();
20630   return true;
20631  }
20632  return false;
20633 },
20634 OnPageUp: function(evt){
20635  return false;
20636 }, 
20637 OnPageDown: function(evt){
20638  return false;
20639 },
20640 OnEndKeyDown: function(evt){
20641  return false;
20642 },
20643 OnHomeKeyDown: function(evt){
20644  return false;
20645 },
20646 OnArrowLeft: function(evt){
20647  return false;
20648 },
20649 OnArrowRight: function(evt){
20650  return false;
20651 },
20652 OnEscape: function(evt){
20653  return this.OnEscapeInternal();
20654 },
20655 OnEscapeInternal: function() {
20656  var isCancelProcessed = this.OnCancelChanges() || this.droppedDown;
20657  this.HideDropDownArea(true);
20658  return isCancelProcessed;
20659 },
20660 OnEnter: function(evt){
20661  return false;
20662 },
20663 OnTab: function(evt){
20664  return false;
20665 },
20666 isDropDownModal: function(undefinedIfPopupIsDifferent) {
20667  var result = this.ddmBP && window.innerWidth < this.ddmBP;
20668  if(undefinedIfPopupIsDifferent) {
20669   var pc = this.GetPopupControl();
20670   if(pc && pc.GetAdaptiveModalMode(-1) != result)
20671    return undefined;
20672  }
20673  return !!result;
20674 },
20675 onDropDownModalChanged: function(enabled) {
20676  if(!this.ddmInput)
20677   return;
20678  if(enabled)
20679   this.enableDropDownModal();
20680  else
20681   this.disableDropDownModal();
20682  if(this.focusedNullTextElement)
20683   this.ensureAdjustFocusedNullTextElement();
20684 },
20685 enableDropDownModal: function() {
20686  this.loadMainElementHeight();
20687  var pc = this.GetPopupControl();
20688  var contentContainer = pc.GetContentContainer(-1);
20689  var inputContainer = contentContainer.querySelector(".dxdd-input");
20690  var inputElement = this.GetInputElement();
20691  inputContainer.appendChild(inputElement);
20692  if(this.focusedNullTextElement)
20693   inputContainer.appendChild(this.focusedNullTextElement);
20694  this.initializeDropDownModalClearButton(inputContainer);
20695  if(this.dropDownModalClearButton)
20696   this.EnsureClearButtonVisibility();
20697  this.ensureDropDownModalInputVisibility(inputContainer);
20698 },
20699 disableDropDownModal: function() {
20700  this.resetMainElementHeight();
20701  var inputElement = this.GetInputElement();
20702  this.getInputCell().appendChild(inputElement);
20703  if(this.focusedNullTextElement)
20704   this.getInputCell().appendChild(this.focusedNullTextElement);
20705 },
20706 loadMainElementHeight: function() {
20707  var mainElement = this.GetMainElement();
20708  var mainElementHeight = mainElement.style.height;
20709  if(!mainElementHeight) {
20710   var currentHeight = mainElement.getBoundingClientRect().height;
20711   mainElement.style.height = currentHeight + "px";
20712   ASPx.Attr.SetAttribute(mainElement, "data-hasAssignedHeight", true);
20713  }
20714 },
20715 resetMainElementHeight: function() {
20716  var mainElement = this.GetMainElement();
20717  var hasAssignedHeight = ASPx.Attr.GetAttribute(mainElement, "data-hasAssignedHeight");
20718  if(hasAssignedHeight) {
20719   mainElement.style.height = "";
20720   ASPx.Attr.RemoveAttribute(mainElement, "data-hasAssignedHeight");
20721  }
20722 },
20723 ensureDropDownModalInputVisibility: function(inputContainer) {
20724  if(!inputContainer && this.ddmInput) {
20725   var pc = this.GetPopupControl();
20726   inputContainer = pc && pc.GetContentContainer(-1).querySelector(".dxdd-input");
20727  }
20728  if(!inputContainer)
20729   return;
20730  ASPx.ToggleClassNameToElement(inputContainer, "dxdd-readonly", this.GetReadOnly() || !this.GetEnabled());
20731 },
20732 onDropDownCommandButtonClick: function(command) {
20733  if(command === CONSTANTS.DROPDOWN_COMMAND_APPLY)
20734   this.onDropDownApplyCommandClick();
20735  this.onDropDownCloseCommandClick();
20736 },
20737 onDropDownApplyCommandClick: function() {
20738  throw "Not Implemented";
20739 },
20740 onDropDownCloseCommandClick: function() {
20741  throw "Not Implemented";
20742 },
20743 ensureDropDownApplyCommandState: function() {
20744  if(!this.dropDownCommandButtons)
20745   return;
20746  var button = this.dropDownCommandButtons[CONSTANTS.DROPDOWN_COMMAND_APPLY];
20747  if(button)
20748   button.SetEnabled(this.isDropDownApplyCommandEnabled());
20749 },
20750 isDropDownApplyCommandEnabled: function() {
20751  return this.GetEnabled() && !this.GetReadOnly();
20752 },
20753 initializeDropDownModalClearButton: function(inputContainer) {
20754  if(this.dropDownModalClearButton === undefined) {
20755   this.dropDownModalClearButton = inputContainer.querySelector(this.getDropDownModalClearButtonSelector()) || null;
20756   if(this.dropDownModalClearButton)
20757    ASPx.Evt.AttachEventToElement(this.dropDownModalClearButton, "click", this.onClearButtonClick.bind(this));
20758  }
20759 },
20760 getDropDownModalClearButtonSelector: function() {
20761  return ".dxdd-clearbutton";
20762 },
20763 EnsureClearButtonVisibility: function() {
20764  ASPxClientButtonEditBase.prototype.EnsureClearButtonVisibility.call(this);
20765  if(this.dropDownModalClearButton && this.isDropDownModal())
20766   ASPx.SetElementDisplay(this.dropDownModalClearButton, this.RequireShowClearButton());
20767 },
20768 applyFormLayoutItemSettings: function(settings) {
20769  var pc = this.GetPopupControl();
20770  if(pc)
20771   this.initializeDropDownContent(pc, settings.caption, settings.helpText);
20772  else
20773   this.flSettings = settings;
20774 },
20775 getInputCell: function() {
20776  var cell = ASPxClientButtonEditBase.prototype.getInputCell.call(this);
20777  return ASPx.ElementHasCssClass(cell, "dxic") ? cell : this.GetMainElement().querySelector(".dxic");
20778 },
20779 RaiseCloseUp: function(){
20780  if(!this.CloseUp.IsEmpty()){
20781   var args = new ASPxClientEventArgs();
20782   this.CloseUp.FireEvent(this, args);
20783  }
20784 },
20785 RaiseDropDown: function(){
20786  if(!this.DropDown.IsEmpty() && this.isInitialized){
20787   var args = new ASPxClientEventArgs();
20788   this.DropDown.FireEvent(this, args);
20789  }
20790 },
20791 RaiseQueryCloseUp: function(){
20792  if(!this.QueryCloseUp.IsEmpty() && this.isInitialized) {
20793   var args = new ASPxClientCancelEventArgs();
20794   this.QueryCloseUp.FireEvent(this, args);
20795   return !args.cancel;
20796  }
20797  return true;
20798 },
20799 AdjustDropDownWindow: function(){
20800  var pc = this.GetPopupControl();
20801  if(pc) {
20802   if(ASPx.Browser.IE)
20803    ASPx.GetPopupControlCollection().LockWindowResizeByBodyScrollVisibilityChanging();
20804   pc.AdjustSize();
20805   pc.UpdatePositionAtElement(this.GetMainElement());
20806   if(ASPx.Browser.IE)
20807    ASPx.GetPopupControlCollection().UnlockWindowResizeByBodyScrollVisibilityChanging();
20808  }
20809 },
20810 ResetDropDownSizeCache: function(){
20811  this.ddHeightCache = ASPx.InvalidDimension;
20812  this.ddWidthCache = ASPx.InvalidDimension;
20813 },
20814 ShowDropDown: function(){
20815  if(!this.droppedDown)
20816   this.ShowDropDownArea(false);
20817 },
20818 HideDropDown: function(){
20819  if(this.droppedDown)
20820   this.HideDropDownArea(false);
20821 }
20822});
20823var ASPxClientDropDownEdit = ASPx.CreateClass(ASPxClientDropDownEditBase, {
20824 constructor: function(name) {
20825  this.constructor.prototype.constructor.call(this, name);
20826  this.LostFocusInternal = new ASPxClientEvent();
20827  this.dropDownWindowHeight = "";
20828  this.dropDownWindowWidth = "";
20829  this.allowFocusDropDownWindow = true;
20830  this.needAdjustControlsInDropDownWindow = true;
20831  this.DropDownCommandButtonClick = new ASPxClientEvent();
20832 },
20833 InlineInitialize: function(){
20834  this.InitSpecialKeyboardHandling();
20835  ASPxClientDropDownEditBase.prototype.InlineInitialize.call(this);
20836 },
20837 getDropDownEventTargets: function() {
20838  return ASPxClientDropDownEditBase.prototype.getDropDownEventTargets.call(this).concat([
20839   this.shouldDropDownOnMCMouseDown() ? this.getInputCell() : null,
20840  ]);
20841 },
20842 shouldDropDownOnMCMouseDown: function() {
20843  return this.readOnly || !this.allowUserInput;
20844 },
20845 ShouldCloseOnMCMouseDown: function() {
20846  return !this.shouldDropDownOnMCMouseDown();
20847 },
20848 InitializeEvents: function() {
20849  this.LostFocus.AddHandler(this.ProcessLostFocus.aspxBind(this));
20850  this.QueryCloseUp.AddHandler(this.ProcessQueryCloseUp.aspxBind(this));
20851  ASPxClientDropDownEditBase.prototype.InitializeEvents.call(this);
20852 },
20853 RefocusOnClickRequired: function(){
20854  return ASPx.Browser.IE;
20855 },
20856 BeforePopupControlResizing: function() {
20857  var divContainer = this.GetDropDownDivContainer();
20858  if(divContainer && this.needAdjustControlsInDropDownWindow) {
20859   this.AdjustControlsInDropDownWindow();
20860   ASPx.SetElementDisplay(divContainer, false);
20861  }
20862 },
20863 AfterPopupControlResizing: function() {
20864  var divContainer = this.GetDropDownDivContainer();
20865  if(divContainer && this.needAdjustControlsInDropDownWindow) {
20866   ASPx.SetElementDisplay(divContainer, true);
20867   this.AdjustControlsInDropDownWindow();
20868   this.needAdjustControlsInDropDownWindow = false;
20869  }
20870 },
20871 AdjustControlsInDropDownWindow: function() {
20872  var pc = this.GetPopupControl();
20873  var pcwElement = pc.GetCurrentWindowElement();
20874  ASPx.GetControlCollection().ProcessControlsInContainer(pcwElement, function(control) {
20875   control.AdjustControl(false);
20876  });
20877 },
20878 GetDropDownDivContainer: function() {
20879  return ASPx.GetElementById(this.name + dropDownNameSuffix + "_DDDC");
20880 },
20881 GetDropDownHeight: function(){
20882  if(this.dropDownWindowHeight != "")
20883   return this.dropDownWindowHeight;
20884  return ASPxClientDropDownEditBase.prototype.GetDropDown
20884Height.call(this);
20885 },
20886 GetDropDownWidth: function(){
20887  if(this.dropDownWindowWidth != "")
20888   return this.dropDownWindowWidth;
20889  return this.GetMainElement().offsetWidth;
20890 },
20891 CloseDropDownByDocumentOrWindowEvent: function(causedByWindowResizing){
20892  if(!ASPx.GetPopupControlCollection().WindowResizeByBodyScrollVisibilityChangingLocked())
20893   ASPxClientDropDownEditBase.prototype.CloseDropDownByDocumentOrWindowEvent.call(this, causedByWindowResizing);
20894 },
20895 OnBrowserWindowResize: function(e){
20896  this.needAdjustControlsInDropDownWindow = true;
20897 },
20898 OnEnter: function(evt){
20899  return this.droppedDown;
20900 },
20901 OnEscape: function(evt){
20902  var isCancelProcessed = this.droppedDown;
20903  this.HideDropDownArea(true);
20904  return isCancelProcessed;
20905 },
20906 OnTextChanged: function() {
20907  this.OnValueChanged();
20908 },
20909 ProcessLostFocus: function() {
20910  if(!this.droppedDown)
20911   this.RaiseLostFocusInternal();
20912 },
20913 ProcessQueryCloseUp: function() {
20914  if(this.focused)
20915   return;
20916  var forceRefocusTimeout = 150;
20917  setTimeout(function() {
20918   if(!this.IsDropDownContainsFocus())
20919    this.RaiseLostFocusInternal();
20920  }.aspxBind(this), forceRefocusTimeout);
20921 },
20922 IsDropDownContainsFocus: function() {
20923  return ASPx.GetIsParent(this.GetDropDownWindow(), ASPx.GetActiveElement());
20924 },
20925 GetKeyValueInternal: function(){
20926  if(ASPx.IsExists(this.stateObject))
20927   return this.stateObject.keyValue;
20928  return null;
20929 },
20930 SetKeyValueInternal: function(keyValue){
20931  this.UpdateStateObjectWithObject({ keyValue: keyValue });
20932 },
20933 GetValueString: function() {
20934  var value = this.GetKeyValue();
20935  return (value == null) ? ASPxClientDropDownEditBase.prototype.GetValueString.call(this) : value.toString();
20936 },
20937 onDropDownCommandButtonClick: function(action) {
20938  this.raiseDropDownCommandButtonClick(action);
20939 },
20940 raiseDropDownCommandButtonClick: function(command) {
20941  var args = new ASPxClientDropDownCommandEventArgs(command);
20942  if(!this.DropDownCommandButtonClick.IsEmpty())
20943   this.DropDownCommandButtonClick.FireEvent(this, args);
20944  return !args.cancel;
20945 },
20946 GetKeyValue: function(){
20947  return this.GetKeyValueInternal();
20948 },
20949 SetKeyValue: function(keyValue){
20950  this.SetKeyValueInternal(keyValue);
20951 },
20952 RaiseLostFocusInternal: function() {
20953  if(!this.isInitialized)
20954   return;
20955  this.ensureDropDownClosedOnLostFocus();
20956  if(this.LostFocusInternal.IsEmpty())
20957   return;
20958  var args = new ASPxClientEventArgs();
20959  this.LostFocusInternal.FireEvent(this, args);
20960 },
20961 ensureDropDownClosedOnLostFocus: function() { }
20962});
20963ASPxClientDropDownEdit.Cast = ASPxClientControl.Cast;
20964var ASPxClientDropDownCollection = ASPx.CreateClass(ASPxClientControlCollection, {
20965 constructor: function() {
20966  this.constructor.prototype.constructor.call(this);
20967  this.droppedControlName = "";
20968  this.droppedParentNames = [ ];
20969  this.focusedControlName = "";
20970 },
20971 GetCollectionType: function(){
20972  return "DropDown";
20973 },
20974 SetFocusedDropDownName: function(name){
20975  this.focusedControlName = name;
20976 },
20977 ResetDroppedDownControl: function(){
20978  this.droppedControlName = "";
20979 },
20980 ResetDroppedDownParentCollection: function(startDroppedDownControlName) {
20981  var regArray = [ ];
20982  for(var i = 0; i < this.droppedParentNames.length; i++) {
20983   if(this.droppedParentNames[i] == startDroppedDownControlName)
20984    break;
20985   regArray.push(this.droppedParentNames[i]);
20986  }
20987  this.droppedParentNames = regArray;
20988  if(this.droppedParentNames.length > 0) {
20989   this.droppedControlName = this.droppedParentNames[this.droppedParentNames.length - 1];
20990   ASPx.Data.ArrayRemoveAt(this.droppedParentNames, this.droppedParentNames.length - 1);
20991  }
20992 },
20993 ResetFocusedControl: function(){
20994  this.focusedControlName = "";
20995 },
20996 GetFocusedDropDown: function(){
20997  var control = this.GetDropDownControlInternal(this.focusedControlName);
20998  if(control == null) this.ResetFocusedControl();
20999  return control;
21000 },
21001 GetDroppedDropDown: function(){
21002  var control = this.GetDropDownControlInternal(this.droppedControlName);
21003  if(control == null) this.ResetDroppedDownControl();
21004  return control;
21005 },
21006 GetDroppedDropDownParents: function(startDroppedDownControlName) {
21007  var dropDownArray = [ ];
21008  var isNeedGetControl = false;
21009  for(var i = 0; i < this.droppedParentNames.length; i++) {
21010   if(this.droppedParentNames[i] == startDroppedDownControlName) isNeedGetControl = true;
21011   if(isNeedGetControl) {
21012    var control = this.GetDropDownControlInternal(this.droppedParentNames[i]);
21013    if(control != null)
21014     dropDownArray.push(control);
21015   }
21016  }
21017  return dropDownArray;
21018 },
21019 FindFirstNameForClose: function(newDroppedDownParentArray) {
21020  var firstNameToClose = newDroppedDownParentArray.length > 0 ? "" : this.droppedParentNames[i];
21021  for(var i = 0; i < this.droppedParentNames.length; i++) {
21022   if(ASPx.Data.ArrayIndexOf(newDroppedDownParentArray, this.Get(this.droppedParentNames[i])) == -1) {
21023    firstNameToClose = this.droppedParentNames[i];
21024    break;
21025   }
21026  }
21027  return firstNameToClose;
21028 },
21029 GetDropDownControlInternal: function(name){
21030  var control = this.Get(name);
21031  var isControlExists = control && !control.IsDOMDisposed();
21032  if(!isControlExists)
21033   control = null;
21034  return control;
21035 },
21036 IsDroppedDropDownParentExist: function(name) {
21037  for(var i = 0; i < this.droppedParentNames.length; i++) {
21038   if(this.droppedParentNames[i] == name)
21039    return true;
21040  }
21041  return false;
21042 },
21043 OnDDButtonMouseMove: function(evt){
21044  var dropDownControl = this.GetDroppedDropDown();
21045  if(dropDownControl != null)
21046   dropDownControl.OnDDButtonMouseMove(evt);
21047 },
21048 OnDocumentMouseDown: function(evt){
21049  if(ASPxClientControl.documentDropDownMouseDownLocked) return; 
21050  if(!ASPx.TouchUIHelper.handleFastTapIfRequired(evt, function(){ this.CloseDropDownByDocumentOrWindowEvent(evt, false); }.aspxBind(this), false))
21051   this.CloseDropDownByDocumentOrWindowEvent(evt, false);
21052 },
21053 OnDocumentMouseUp: function(evt){
21054  var dropDownControl = this.GetDroppedDropDown();
21055  if(dropDownControl != null)
21056   dropDownControl.OnDocumentMouseUp();
21057 },
21058 OnBrowserWindowResize: function(e){
21059  if(typeof(ASPx.GetPopupControlCollection) != "undefined" && !ASPx.GetPopupControlCollection().WindowResizeByBodyScrollVisibilityChangingLocked()){
21060   this.CloseDropDownByDocumentOrWindowEvent(e.htmlEvent, true);
21061   this.AdjustControls();
21062  }
21063 },
21064 CloseDropDownByDocumentOrWindowEvent: function(evt, causedByWindowResizing){
21065  var dropDownControl = this.GetDroppedDropDown();
21066  if(dropDownControl != null && (this.IsEventNotFromControlSelf(evt, dropDownControl) || causedByWindowResizing))
21067   dropDownControl.CloseDropDownByDocumentOrWindowEvent(causedByWindowResizing);
21068  var childrenDropDownsToClose = this.GetDroppedDropDownParents(this.droppedParentNames[0]);
21069  if(childrenDropDownsToClose.length != 0) {
21070   childrenDropDownsToClose = childrenDropDownsToClose.reverse();
21071   this.ResetDroppedDownParentCollection(this.droppedParentNames[0]);
21072   var rollbackDroppedDownNames = [ ];
21073   for(var c = 0; c < childrenDropDownsToClose.length; c++) {
21074    if(this.IsEventNotFromControlSelf(evt, childrenDropDownsToClose[c]))
21075     childrenDropDownsToClose[c].CloseDropDownByDocumentOrWindowEvent(causedByWindowResizing);
21076    else
21077     rollbackDroppedDownNames.push(childrenDropDownsToClose[c].name);
21078   }
21079   if(rollbackDroppedDownNames != 0) {
21080    rollbackDroppedDownNames = rollbackDroppedDownNames.reverse();
21081    this.droppedParentNames = rollbackDroppedDownNames;
21082   }
21083  }
21084 },
21085 AdjustControls: function(){
21086  this.ForEachControl(function(control) {
21087   control.AdjustControl(false);
21088  });
21089 },
21090 IsEventNotFromControlSelf: function(evt, control){
21091  var srcElement = ASPx.Evt.GetEventSource(evt);
21092  var mainElement = control.GetMainElement();
21093  var dropDownWindow = control.GetDropDownWindow();
21094  if(!srcElement || !mainElement || !dropDownWindow) return true;
21095  return (!ASPx.GetIsParent(mainElement, srcElement) &&
21096   !ASPx.GetIsParent(dropDownWindow, srcElement) &&
21097   !this.IsEventFromSharedPopupOfInnerEditor(dropDownWindow, srcElement));
21098 },
21099 IsEventFromSharedPopupOfInnerEditor: function(dropDownWindow, srcElement) {
21100  var eventFromPopupOfInnerEditor = false;
21101  ASPx.GetControlCollection().ProcessControlsInContainer(dropDownWindow,
21102   function(control){
21103    if(control.calendarOwnerName) {
21104     var sharedCalendarPopup = control.GetCalendarOwner().GetDropDownWindow();
21105     if(ASPx.GetIsParent(sharedCalendarPopup, srcElement))
21106      eventFromPopupOfInnerEditor = true;
21107    }
21108  });
21109  return eventFromPopupOfInnerEditor;
21110 },
21111 RegisterDroppedDownControl: function(dropDownControl, droppedDownParentArray){
21112  var prevDropDownControl = this.GetDroppedDropDown();
21113  var areDroppedDownsCollectionParents = ASPx.Data.ArrayIndexOf(droppedDownParentArray, prevDropDownControl) != -1;
21114  if(prevDropDownControl != null && prevDropDownControl != dropDownControl && !areDroppedDownsCollectionParents)
21115   prevDropDownControl.OnOpenAnotherDropDown();
21116  if(this.droppedParentNames.length > 0) {
21117   var firstDropDownsNameToClose = this.FindFirstNameForClose(droppedDownParentArray);
21118   if(firstDropDownsNameToClose != "") {
21119    var childrenDropDownsToClose = this.GetDroppedDropDownParents(firstDropDownsNameToClose);
21120    this.ResetDroppedDownParentCollection(firstDropDownsNameToClose);
21121    this.CloseDroppedDownCollection(childrenDropDownsToClose.reverse());
21122   }
21123  }
21124  this.droppedControlName = dropDownControl.name;
21125  this.droppedParentNames = [ ];
21126  for(var i = 0; i < droppedDownParentArray.length; i++)
21127   this.droppedParentNames.push(droppedDownParentArray[i].name);
21128 },
21129 UnregisterDroppedDownControl: function(dropDownControl){
21130  if(this.droppedControlName == dropDownControl.name)
21131   this.ResetDroppedDownControl();
21132  if(this.IsDroppedDropDownParentExist(dropDownControl.name)) {
21133   var prevDropDownControl = this.GetDroppedDropDown();
21134   if(prevDropDownControl != null)
21135    prevDropDownControl.OnOpenAnotherDropDown();
21136   var childrenDropDownsToClose = this.GetDroppedDropDownParents(dropDownControl.name);
21137   this.ResetDroppedDownParentCollection(dropDownControl.name);
21138   ASPx.Data.ArrayRemoveAt(childrenDropDownsToClose, 0);
21139   this.CloseDroppedDownCollection(childrenDropDownsToClose.reverse());
21140  }
21141 },
21142 CloseDroppedDownCollection: function(dropDownParentArray) {
21143  for(var c = 0; c < dropDownParentArray.length; c++)
21144   dropDownParentArray[c].OnOpenAnotherDropDown();
21145 }
21146});
21147var DropDownAccessibilityExplanatoryTextManager = ASPx.CreateClass(ASPx.EditAccessibilityExplanatoryTextManager , {
21148 constructor: function(editor) {
21149  this.constructor.prototype.constructor.call(this, editor);
21150 },
21151 SetHelperLabel: function() {
21152  var pronounceText = this.editor.GetAccessibilityText();
21153  var labelElements = ASPx.FindAssociatedLabelElements(this.editor);
21154  if(labelElements.length > 0) {
21155   var labelText = labelElements.map(function(label) { return ASPx.GetInnerText(label); }).join(" ");
21156   if(pronounceText.indexOf(labelText) < 0)
21157    pronounceText = labelText + " " + pronounceText;
21158  }
21159  var pronounceElement = !!this.editor.accessibilityHelper ? 
21160   this.editor.accessibilityHelper.getItem(true) : 
21161   this.editor.GetAccessibilityAssistantElement();
21162  ASPx.Attr.SetAttribute(pronounceElement, "aria-label", pronounceText);
21163  var textElement = this.GetTextElement();
21164  if(ASPx.IsExists(textElement)) {
21165   if(!ASPx.IsExists(ASPx.Attr.GetAttribute(this.editor.GetInputElement(), 'aria-activedescendant')))
21166    pronounceElement = this.editor.GetInputElement();
21167   this.SetOrRemoveText([pronounceElement], textElement, true, false, false);
21168   setTimeout(function() {
21169    this.SetOrRemoveText([pronounceElement], textElement, false, false, false);
21170   }.aspxBind(this), 500);
21171  }
21172 }
21173});
21174var ASPxClientDropDownCommandEventArgs = ASPx.CreateClass(ASPxClientCancelEventArgs, {
21175 constructor: function (command) {
21176  this.constructor.prototype.constructor.call(this);
21177  this.commandName = command;
21178 }
21179});
21180var dropDownCollection = null;
21181function aspxGetDropDownCollection() {
21182 if(dropDownCollection == null)
21183  dropDownCollection  = new ASPxClientDropDownCollection();
21184 return dropDownCollection;
21185}
21186ASPx.Ident.IsASPxClientDateEdit = function(obj) {
21187 return !!obj.isASPxClientDateEdit;
21188};
21189ASPx.DDMC_MD = function(name, evt) {
21190 var dd = ASPx.GetControlCollection().Get(name);
21191 if(dd)
21192  dd.OnMainCellMouseDown(evt);
21193};
21194ASPx.DDBPCShown = function(name){
21195 var cb = ASPx.GetControlCollection().Get(name);
21196 if(cb != null) cb.OnPopupControlShown();
21197};
21198ASPx.CBLBSelectedIndexChanged = function(name, evt){
21199 var cb = ASPx.GetControlCollection().Get(name);
21200 if(cb != null) cb.OnLBSelectedIndexChanged();
21201};
21202ASPx.CBLBItemMouseUp = function(name, evt){
21203 var cb = ASPx.GetControlCollection().Get(name);
21204 if(cb != null) cb.OnListBoxItemMouseUp(evt);
21205};
21206ASPx.Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseDownEventName, function(evt) {
21207 return aspxGetDropDownCollection().OnDocumentMouseDown(evt);
21208});
21209ASPx.Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseUpEventName, function(evt) {
21210 return aspxGetDropDownCollection().OnDocumentMouseUp(evt);
21211});
21212window.ASPxClientDropDownEditBase = ASPxClientDropDownEditBase;
21213window.ASPxClientDropDownEdit = ASPxClientDropDownEdit;
21214ASPx.GetDropDownCollection = aspxGetDropDownCollection;
21215})();
21216
21217(function() {
21218var calendarNameSuffix = "_C";
21219var timeEditNameSiffix = calendarNameSuffix + "_TE";
21220var clockNameSiffix = calendarNameSuffix + "_CL";
21221var lbIPostfixes = ['C', 'I', 'T'];
21222var verticalTimeSectionClassName = "dxeCalendarVerticalDETS";
21223var timeSectionFooterClassName = "dxeDETSF";
21224var calendarWithFullWidthChildsClassName = "dxeCalendarFullWidth";
21225var calendarWithAutoWidthChildsClassName = "dxeCalendarCollapsed";
21226var DefaultMinMaxRangeValues = {
21227 Min: -1,
21228 Max: 0
21229};
21230var ASPxDateRangeHelper = {
21231 GetCurrentRangeRestrictions: function(dateRangePair) {
21232  if (dateRangePair.isInRangeMode)
21233  return {
21234   startDate: dateRangePair.startDateEdit.GetDate(),
21235   endDate: dateRangePair.endDateEdit.GetDate()
21236  };
21237  else
21238   return {
21239    startDate: null,
21240    endDate: null
21241   };
21242 },
21243 IsBothRangeRestrictionsExist: function (rangeRestricts) {
21244  return rangeRestricts.startDate && rangeRestricts.endDate;
21245 },
21246 IsNegativeRange: function (rangeRestricts) {
21247  return this.IsBothRangeRestrictionsExist(rangeRestricts)
21248   && rangeRestricts.startDate > rangeRestricts.endDate;
21249 },
21250 IsOneRestrictionExistsOnly: function (rangeRestricts) {
21251  return this.IsStartRestrictionExistsOnly(rangeRestricts)
21252   || this.IsEndRestrictionExistsOnly(rangeRestricts);
21253 },
21254 IsStartRestrictionExistsOnly: function (rangeRestricts) {
21255  return rangeRestricts.startDate && !rangeRestricts.endDate;
21256 },
21257 IsEndRestrictionExistsOnly: function (rangeRestricts) {
21258  return !rangeRestricts.startDate && rangeRestricts.endDate;
21259 },
21260 AreRestrictionsOfSamePeriod: function (rangeRestricts, pickerType) {
21261  return this.IsBothRangeRestrictionsExist(rangeRestricts)
21262   && ASPxClientCalendar.AreDatesOfSamePeriod(rangeRestricts.startDate, rangeRestricts.endDate, pickerType);
21263 },
21264 GetFullDaysInCurrentRange: function(rangeRestricts) {
21265  var timezoneOffsetDifference = ASPx.DateUtils.GetTimeZoneOffsetDifference(rangeRestricts.startDate, rangeRestricts.endDate);
21266  var rangeLength = rangeRestricts.endDate - rangeRestricts.startDate + timezoneOffsetDifference;
21267  return Math.floor(rangeLength / ASPx.calendarMsPerDay);
21268 },
21269 GetRangeLength: function(currentDateEdit, pickerType) {
21270  var dateRangePair = this.GetDateEditPair(currentDateEdit);
21271  if(!dateRangePair.isStart) {
21272   var rangeRestricts = this.GetCurrentRangeRestrictions(dateRangePair);
21273   if(this.IsBothRangeRestrictionsExist(rangeRestricts) && !this.IsNegativeRange(rangeRestricts))
21274    return this.GetRangeLengthCore(rangeRestricts, pickerType);
21275  }
21276  return -1;
21277 },
21278 GetRangeLengthCore: function(rangeRestricts, pickerType) {
21279  if(pickerType == ASPx.DatePickerType.Days)
21280   return this.GetFullDaysInCurrentRange(rangeRestricts);
21281  if(pickerType == ASPx.DatePickerType.Months)
21282   return ASPxClientCalendar.GetOffsetInMonths(rangeRestricts.startDate, rangeRestricts.endDate);
21283  if(pickerType == ASPx.DatePickerType.Years)
21284   return ASPxClientCalendar.GetOffsetInYears(rangeRestricts.startDate, rangeRestricts.endDate);
21285  if(pickerType == ASPx.DatePickerType.Decades)
21286   return ASPxClientCalendar.GetOffsetInDecades(rangeRestricts.startDate, rangeRestricts.endDate);
21287  return -1;
21288 },
21289 NeedCorrectSecondDateOnDateChanging: function (rangeRestricts, isStartDateChanged, minRange) {
21290  if (this.IsNegativeRange(rangeRestricts))
21291   return true;
21292  var isSecondDateEmpty = isStartDateChanged && this.IsStartRestrictionExistsOnly(rangeRestricts)
21293   || !isStartDateChanged && this.IsEndRestrictionExistsOnly(rangeRestricts);
21294  return isSecondDateEmpty && minRange > DefaultMinMaxRangeValues.Min;
21295 },
21296 GetDateEditPair: function(currentDateEdit) {
21297  if(currentDateEdit.IsInDateRangeMode()) {
21298   var startDE = currentDateEdit.GetStartDateEdit();
21299   startDE = (startDE == null) ? currentDateEdit : startDE;
21300   var endDE = startDE.endDateEdit;
21301   var isCurrentDateEditStart = currentDateEdit === startDE;
21302   return {
21303    startDateEdit: startDE,
21304    endDateEdit: endDE,
21305    isStart: isCurrentDateEditStart,
21306    isInRangeMode: true
21307   };
21308  }
21309  else
21310   return {
21311    startDateEdit: currentDateEdit,
21312    endDateEdit: null,
21313    isStart: true,
21314    isInRangeMode: false
21315   };
21316 }
21317};
21318var DateRangeValidationPattern = ASPx.CreateClass(ASPx.ValidationPattern, {
21319 constructor: function (endDateEdit) {
21320  this.constructor.prototype.constructor.call(this, endDateEdit.invalidDateRangeErrorText);
21321  this.startDateEdit = null;
21322  this.endDateEdit = endDateEdit;
21323  this.pickerType = endDateEdit.pickerType;
21324 },
21325 GetStartDateEdit: function() {
21326  if(!this.startDateEdit)
21327   this.startDateEdit = this.endDateEdit.GetStartDateEdit();
21328  return this.startDateEdit;
21329 },
21330 EvaluateIsValid: function(value) {
21331  var startDateEdit = this.GetStartDateEdit();
21332  if(!startDateEdit)
21333   return true;
21334  var dateEditPair = ASPxDateRangeHelper.GetDateEditPair(startDateEdit);
21335  var rangeRestricts = ASPxDateRangeHelper.GetCurrentRangeRestrictions(dateEditPair);
21336  if (this.endDateEdit.IsDateChangeProcessing()
21337   && ASPxDateRangeHelper.NeedCorrectSecondDateOnDateChanging(rangeRestricts, false, this.endDateEdit.minRange))
21338   return true;
21339  if (ASPxDateRangeHelper.IsOneRestrictionExistsOnly(rangeRestricts))
21340   return false;
21341  if (ASPxDateRangeHelper.IsBothRangeRestrictionsExist(rangeRestricts)) {
21342   var startDate = rangeRestricts.startDate;
21343   var endDate = rangeRestricts.endDate;
21344   return this.IsRangeFitToMinRange(startDate, endDate) && this.IsRangeFitToMaxRange(startDate, endDate);
21345  }
21346  return true;
21347 },
21348 IsRangeFitToMinRange: function(startDate, endDate) {
21349  return this.endDateEdit.minRange === DefaultMinMaxRangeValues.Min
21350   || ASPxClientCalendar.GetDateByOffset(startDate, this.endDateEdit.minRange, this.pickerType) <= endDate;
21351 },
21352 IsRangeFitToMaxRange: function(startDate, endDate) {
21353  return this.endDateEdit.maxRange === DefaultMinMaxRangeValues.Max
21354   || ASPxClientCalendar.GetDateByOffset(startDate, this.endDateEdit.maxRange, this.pickerType) >= endDate;
21355 },
21356});
21357var ASPxClientDateEdit = ASPx.CreateClass(ASPxClientDropDownEditBase, {
21358 constructor: function(name) {
21359  this.constructor.prototype.constructor.call(this, name);
21360  this.dateFormatter = null;
21361  this.isASPxClientDateEdit = true;
21362  this.date = null;
21363  this.dateOnError = "u";
21364  this.allowNull = true;
21365  this.calendarOwnerName = null;
21366  this.calendarConsumerName = null;
21367  this.textWasLastTemporaryChanged = false;
21368  this.showTimeSection = false;
21369  this.enableAdaptiveTimeSection = true;
21370  this.adjustInnerControls = true;
21371  this.pasteTimerID = -1;
21372  this.keyUpProcessing = false;
21373  this.showOutOfRangeWarning = true;
21374  this.startDateEditName = "";
21375  this.minRange = DefaultMinMaxRangeValues.Min;
21376  this.maxRange = DefaultMinMaxRangeValues.Max;
21377  this.sharedParameters = new ASPx.CalendarSharedParameters();
21378  this.endDateEdit = null;
21379  this.calendarController = null;
21380  this.rollersController = null;
21381  this.viewContainer = null;
21382  this.pickerType = ASPx.DatePickerType.Days;
21383  this.hasDecadeDisplayFormat = false;
21384  this.showHourWheel = false;
21385  this.showMinuteWheel = false;
21386  this.showSecondWheel = false;
21387  this.showMillisecondWheel = false;
21388  this.DateChanged = new ASPxClientEvent();
21389  this.ParseDate = new ASPxClientEvent();
21390  this.CalendarCustomDisabledDate = new ASPxClientEvent();
21391  this.CalendarCellClick = new ASPxClientEvent();
21392  this.CalendarShowing = new ASPxClientEvent();
21393  this.ValueSet = new ASPxClientEvent();
21394 },
21395 SetData: function(data){
21396  ASPxClientTextEdit.prototype.SetData.call(this, data);
21397  if(data.sharedParameters)
21398   this.SetProperties(data.sharedParameters, this.sharedParameters);
21399 },
21400 Initialize: function() {
21401  this.InitializeControllers();
21402  this.GetActiveController().InitializeViewHandlers();
21403  ASPxClientDropDownEditBase.prototype.Initialize.call(this);
21404  var startDateEdit = this.GetStartDateEdit();
21405  if(startDateEdit)
21406   this.GetActiveController().AssignDateRangeMode(startDateEdit);
21407  this.GetActiveController().AttachToDateEditClientEvents(startDateEdit);
21408  this.InitializeSharedParameters();
21409 },
21410 InitializeControllers: function() {
21411  var shouldDisplayCalendarOnInit = this.ShouldDisplayCalendarOnInit();
21412  if(this.ddScrPicker !== ASPx.DROPDOWN_ELEMENT_VISIBILITY.Always) {
21413   this.calendarController = new DateEditCalendarController(this);
21414   this.calendarController.Initialize(shouldDisplayCalendarOnInit);
21415  }
21416  if(this.ddScrPicker !== ASPx.DROPDOWN_ELEMENT_VISIBILITY.Never) {
21417   this.rollersController = this.CreateScrollPickerController(this.spOptions); 
21418   this.rollersController.Initialize(!shouldDisplayCalendarOnInit);   
21419  }
21420 },
21421 InitializeCalendarController: function() {
21422  if(this.ddScrPicker === ASPx.DROPDOWN_ELEMENT_VISIBILITY.Always)
21423   return;
21424  this.calendarController = new DateEditCalendarController(this);
21425  this.calendarController.Initialize();
21426 },
21427 ShouldDisplayCalendarOnInit: function() {
21428  return this.ddScrPicker === ASPx.DROPDOWN_ELEMENT_VISIBILITY.Never || this.ddScrPicker === ASPx.DROPDOWN_ELEMENT_VISIBILITY.ModalDropDown;
21429 },
21430 ShouldDisplayCalendar: function() {
21431  return this.ddScrPicker === ASPx.DROPDOWN_ELEMENT_VISIBILITY.Never ||
21432      this.ddScrPicker === ASPx.DROPDOWN_ELEMENT_VISIBILITY.DropDown && this.isDropDownModal() ||
21433      this.ddScrPicker === ASPx.DROPDOWN_ELEMENT_VISIBILITY.ModalDropDown && !this.isDropDownModal();
21434 },
21435 ShouldDisplayRoller: function() {
21436  return !this.ShouldDisplayCalendar();
21437 },
21438 InitializeRollerController: function() {
21439  if(this.ddScrPicker === ASPx.DROPDOWN_ELEMENT_VISIBILITY.Never)
21440   return;
21441  this.rollersController = this.CreateScrollPickerController(this.spOptions);
21442  this.rollersController.Initialize();
21443 },
21444 GetActiveController: function() {
21445  if(this.calendarController && this.calendarController.IsActive())
21446   return this.calendarController;
21447  return this.rollersController;
21448 },
21449 CreateScrollPickerController: function(spOptions) {
21450  return new DateEditScrollPickerController(this, spOptions);
21451 },
21452 UpdateActiveController: function(onDropDownShowing) {
21453  if(!this.calendarController || !this.rollersController)
21454   return;
21455  var shouldDisplayCalendar = this.ShouldDisplayCalendar();  
21456  this.calendarController.SetActive(shouldDisplayCalendar);
21457  this.rollersController.SetActive(!shouldDisplayCalendar);
21458  this.GetActiveController().SetSelectedDate(this.date, onDropDownShowing);
21459 },
21460 GetViewContainer: function() {
21461  var popupControl = this.GetPopupControl();
21462  if(!popupControl)
21463   return null;
21464  if(!this.viewContainer)
21465   this.viewContainer = popupControl.GetContentContainer(-1);
21466  return this.viewContainer;
21467 },
21468 IsInDateRangeMode: function() {
21469  var startDateEdit = this.GetStartDateEdit();
21470  return startDateEdit !== null || this.endDateEdit !== null;
21471 },
21472 MinOrMaxRangeExist: function() {
21473  return this.minRange !== DefaultMinMaxRangeValues.Min || this.maxRange !== DefaultMinMaxRangeValues.Max;
21474 },
21475 InitializeSharedParameters: function() {
21476  this.sharedParameters.currentDateEdit = this;
21477  this.sharedParameters.DaysSelectingOnMouseOver.AddHandler(function(s, e) {
21478   this.OnCalendarDayMouseOver(s, e);
21479  }.aspxBind(this));
21480  this.sharedParameters.VisibleDaysMouseOut.AddHandler(function(s, e) {
21481   UTILS.SelectRangeInCalendar(s, false);
21482  }.aspxBind(this));
21483  if(this.GetShowTimeSection())
21484   this.sharedParameters.CalendarSelectionChangedInternal.AddHandler(function(s, e) {
21485    UTILS.SelectRangeInCalendar(s, false);
21486   }.aspxBind(this));
21487 },
21488 OnCalendarDayMouseOver: function(targetCalendar, e) {
21489  var dateRangePair = ASPxDateRangeHelper.GetDateEditPair(ASPxClientDateEdit.active);
21490  if(!dateRangePair.isInRangeMode) {
21491   e.cancel = true;
21492   return;
21493  }
21494  var rangeRestricts = ASPxDateRangeHelper.GetCurrentRangeRestrictions(dateRangePair);
21495  var isRangeNegative = ASPxDateRangeHelper.IsNegativeRange(rangeRestricts);
21496  var isOverDateCorrectForSelection = false;
21497  if (!isRangeNegative) {
21498   var requiredStartDate = dateRangePair.isStart ? rangeRestricts.endDate : rangeRestricts.startDate;
21499   e.selectionStartDate = requiredStartDate ? ASPxClientCalendar.CloneDate(requiredStartDate) : null;
21500   isOverDateCorrectForSelection = e.selectionStartDate
21501    && (dateRangePair.isStart && e.selectionStartDate >= e.overDate
21502    || !dateRangePair.isStart && e.selectionStartDate <= e.overDate);
21503  }
21504  e.cancel = isRangeNegative || !e.selectionStartDate || !isOverDateCorrectForSelection;
21505 },   
21506 InlineInitialize: function(){
21507  this.InitSpecialKeyboardHandling();
21508  ASPxClientDropDownEditBase.prototype.InlineInitialize.call(this);
21509  this.lastValue = this.GetInputElement().value;
21510  if (this.UseRestrictions() && this.showOutOfRangeWarning)
21511   this.EnsureOutOfRangeWarningManager();
21512  if(this.MinOrMaxRangeExist())
21513   this.validationPatterns.push(new DateRangeValidationPattern(this));
21514 },
21515 GetStartDateEdit: function() {
21516  return this.startDateEditName ? ASPx.GetControlCollection().Get(this.startDateEditName) : null;
21517 },
21518 CloseDropDownByDocumentOrWindowEvent: function(causedByWindowResizing) {
21519  if((!causedByWindowResizing || !this.pcIsShowingNow) && (this.GetShowTimeSection() || !this.ShouldDisplayCalendar(
21519)))
21520   this.ApplyTimeSectionDateChanges(true);
21521  ASPxClientDropDownEditBase.prototype.CloseDropDownByDocumentOrWindowEvent.call(this, causedByWindowResizing);
21522 },
21523 UseRestrictions: function() {
21524  return this.GetMinDate() || this.GetMaxDate();
21525 },
21526 OnDropDownCore: function(evt) {
21527  ASPxClientDropDownEditBase.prototype.OnDropDownCore.call(this, evt);
21528  this.GetActiveController().OnDropDownCore();
21529 },
21530 CreateUpdateCallback: function(result) {
21531  this.CreateCallback(this.sharedParameters.GetUpdateCallbackParameters());
21532 },
21533 OnCallback: function(result) {
21534  var calendar = this.GetCalendar();
21535  if(calendar != null)
21536   calendar.OnCallback(result);
21537 },
21538 ShowDropDownArea: function(isRaiseEvent) {
21539  this.UpdateActiveController(true);
21540  this.GetActiveController().OnBeforeShowDropDown(this.date);
21541  ASPxClientDropDownEditBase.prototype.ShowDropDownArea.call(this, isRaiseEvent);  
21542  this.GetActiveController().OnAfterShowDropDown();
21543 },
21544 BrowserWindowResizeSubscriber: function() {
21545  return this.droppedDown && this.IsAdaptiveTimeSectionEnabled();
21546 },
21547 OnBrowserWindowResize: function(e) {
21548  this.GetActiveController().OnBrowserWindowResize();
21549 },
21550 BeforePopupControlResizing: function() {
21551  this.adjustTimeSection();
21552 },
21553 AfterPopupControlShown: function() {
21554  if(!this.isDropDownModal())
21555   this.adjustTimeSection(true);
21556 },
21557 adjustTimeSection: function(force) {
21558  var calendarOwner = this;
21559  if(this.calendarOwnerName)
21560   calendarOwner = this.GetCalendarOwner();
21561  if((force || calendarOwner.adjustInnerControls) && calendarOwner.GetTimeEdit()){
21562   calendarOwner.GetClock().AdjustControl();
21563   calendarOwner.GetTimeEdit().AdjustControl();
21564   calendarOwner.adjustInnerControls = false;
21565  }
21566 },
21567 onDropDownModalChanged: function(enabled) {
21568  ASPxClientDropDownEditBase.prototype.onDropDownModalChanged.call(this, enabled);
21569  this.UpdateActiveController();
21570  this.GetActiveController().onDropDownModalChanged(enabled);
21571  this.adjustTimeSection(true);
21572 },
21573 GetPopupControl: function() { 
21574  var calendarOwner = this.GetCalendarOwner();
21575  if(calendarOwner != null)
21576   return calendarOwner.GetPopupControl();
21577  return ASPxClientDropDownEditBase.prototype.GetPopupControl.call(this);
21578 },
21579 OnPopupControlShown: function() {
21580  if(this.calendarConsumerName != null)
21581   ASPx.GetControlCollection().Get(this.calendarConsumerName).OnPopupControlShown();
21582  else  
21583   ASPxClientDropDownEditBase.prototype.OnPopupControlShown.call(this);
21584  this.GetActiveController().OnPopupControlShown();
21585 },
21586 GetCalendar: function() { 
21587  var name = this.GetDropDownInnerControlName(calendarNameSuffix);
21588  return ASPx.GetControlCollection().Get(name);
21589 },
21590 GetTimeEdit: function() { 
21591  var name = this.GetDropDownInnerControlName(timeEditNameSiffix);
21592  return ASPx.GetControlCollection().Get(name);
21593 },
21594 GetClock: function() {
21595  var name = this.GetDropDownInnerControlName(clockNameSiffix);
21596  return ASPx.GetControlCollection().Get(name);
21597 },
21598 GetCalendarOwner: function() {
21599  if(!this.calendarOwnerName)
21600   return null;
21601  return ASPx.GetControlCollection().Get(this.calendarOwnerName);
21602 },
21603 GetShowTimeSection: function(){
21604  var calendarOwner = this.GetCalendarOwner();
21605  if(calendarOwner)
21606   return calendarOwner.showTimeSection;
21607  return this.showTimeSection;
21608 },
21609 IsAdaptiveTimeSectionEnabled: function() {
21610  if(!this.GetShowTimeSection())
21611   return false;
21612  var calendarOwner = this.GetCalendarOwner();
21613  if(calendarOwner)
21614   return calendarOwner.enableAdaptiveTimeSection;
21615  return this.enableAdaptiveTimeSection;
21616 },
21617 GetFormattedDate: function(date) {
21618  date = date || this.date;
21619  if(this.maskInfo != null)
21620   return this.maskInfo.GetValue();
21621  if(date == null)
21622   return this.focused ? "" : this.nullText;
21623  return this.dateFormatter.Format(date);
21624 },
21625 SetTextWasLastTemporaryChanged: function(value){
21626  this.textWasLastTemporaryChanged = value;
21627 },
21628 GetTextWasLastTemporaryChanged: function(){
21629  return this.textWasLastTemporaryChanged;
21630 },
21631 RaiseValueChangedEvent: function(isInternal) {
21632  if(!this.isInitialized) return false;
21633  var processOnServer = ASPxClientEdit.prototype.RaiseValueChangedEvent.call(this);
21634  processOnServer = this.RaiseDateChanged(processOnServer, isInternal);
21635  return processOnServer;
21636 },
21637 OnApplyChanges: function(){
21638  if(this.focused)
21639   this.OnTextChanged();
21640 },
21641 OnCalendarSelectionChanging: function(date, select) {
21642  if(this.GetShowTimeSection())
21643   return;
21644  if(!this.GetCalendar().isDateChangingByKeyboard) {
21645   this.HideDropDownArea(true);
21646   if(date != null)
21647    this.ApplyExistingTime(date);
21648   this.ChangeDate(date);
21649   if(select)
21650    ASPx.Selection.Set(this.GetInputElement());
21651   this.lastValue = this.GetInputElement().value;
21652  }
21653 },
21654 OnCalendarCustomDisabledDate: function(e) {
21655  this.RaiseCalendarCustomDisabledDate(e);
21656 },
21657 OnCustomDisabledDate: function(date) {
21658  return this.RaiseCustomDisabledDateEvent(date);
21659 },
21660 RaiseCustomDisabledDateEvent: function(date) {
21661  var args = new ASPxClientCalendarCustomDisabledDateEventArgs(date);
21662  this.CalendarCustomDisabledDate.FireEvent(this, args);
21663  return args;
21664 },
21665 RaiseCalendarCellClick: function(e) {
21666  if(!this.CalendarCellClick.IsEmpty())
21667   this.CalendarCellClick.FireEvent(this, e);
21668 },
21669 ForceRefocusTimeSectionTimeEdit: function(mouseDownSource) {
21670  var dateEdit = this;
21671  if(this.calendarConsumerName)
21672   dateEdit = ASPx.GetControlCollection().Get(this.calendarConsumerName);
21673  var timeEdit = dateEdit.GetTimeEdit();
21674  var isTimeEditElement = timeEdit.IsEditorElement(mouseDownSource);
21675  if(isTimeEditElement && !timeEdit.IsElementBelongToInputElement(mouseDownSource)) { 
21676   if(!ASPx.Browser.VirtualKeyboardSupported) 
21677    timeEdit.ForceRefocusEditor();
21678   return;
21679  }
21680  if(!dateEdit.IsEditorElement(mouseDownSource)) {
21681   if(ASPx.Browser.VirtualKeyboardSupported && !isTimeEditElement) {
21682    this.lockLostFocus = false;
21683    if(ASPx.VirtualKeyboardUI.focusableInputElementIsActive(timeEdit)) {
21684     timeEdit.GetInputElement().blur();
21685    } else {
21686     ASPx.VirtualKeyboardUI.lostAppliedFocusOfEditor();
21687    }
21688   }
21689   return;
21690  }
21691  if(ASPx.Browser.VirtualKeyboardSupported) {
21692   this.lockLostFocus = true;
21693  } else {
21694   dateEdit.ForceRefocusEditor();
21695   var input = timeEdit.GetInputElement();
21696   if(input)
21697    input.blur();
21698   window.setTimeout(function() { ASPx.SetFocusedEditor(dateEdit); }, 0);
21699  }
21700 },
21701 ApplyTimeSectionDateChanges: function(isApply) {
21702  if(this.GetReadOnly())
21703   return;
21704  var date = isApply ? this.GetActiveController().GetSelectedDate() : this.GetDate();
21705  this.ApplyParsedDate(date, isApply);
21706 },
21707 IsEditorElement: function(element) {
21708  var timeEdit = this.GetTimeEdit();
21709  if(this.GetShowTimeSection() && timeEdit && ASPx.GetIsParent(timeEdit.GetMainElement(), element)) {
21710   this.lockLostFocus = true;
21711   return false;
21712  }
21713  return ASPxClientDropDownEditBase.prototype.IsEditorElement.call(this, element);
21714 },
21715 OnFocus: function() {
21716  this.GetActiveController().SetActiveControl();
21717  ASPxClientDropDownEditBase.prototype.OnFocus.call(this);
21718  if(!ASPx.GetControlCollection().InCallback())
21719   this.SetTextChangingTimer();
21720 },
21721 OnLostFocusCore: function() {
21722  if(!this.isFocusUnlocked())
21723   return;
21724  ASPxClientDropDownEditBase.prototype.OnLostFocusCore.call(this);
21725  this.ClearTextChangingTimer();
21726  if(this.outOfRangeWarningManager)
21727   this.outOfRangeWarningManager.HideOutOfRangeWarningElement();
21728 },
21729 isFocusUnlocked: function() {
21730  return this.ensureFocusUnlockedOnShowTimeSection() && this.ensureFocusUnlockedOnShowDropDown();
21731 },
21732 ensureFocusUnlockedOnShowTimeSection: function() {
21733  var result = true;
21734  if(this.GetShowTimeSection() && this.lockLostFocus) {
21735   this.lockLostFocus = false;
21736   result = false;
21737  }
21738  return result;
21739 },
21740 ensureFocusUnlockedOnShowDropDown: function() {
21741  var result = true;
21742  if(this.accessibilityCompliant && ASPx.Browser.IE) {
21743   var calendar = this.GetCalendar();
21744   var activeElement = ASPx.GetActiveElement();
21745   if(calendar) {
21746    var isAccessibilityAssistantElementFocused = calendar.GetAccessibilityAssistantElement() === activeElement; 
21747    var isAnyCalendarElementFocused = ASPx.GetIsParent(calendar.GetMainElement(), activeElement); 
21748    if(isAccessibilityAssistantElementFocused || isAnyCalendarElementFocused) {
21749     this.ForceRefocusEditor();
21750     result = false;
21751    }
21752   }
21753  }
21754  return result;
21755 },
21756 OnTimeEditLostFocus: function() {
21757  this.OnLostFocusCore();
21758 },
21759 OnTimeEditEnter: function() {
21760  this.ForceRefocusEditor();
21761  this.ApplyTimeSectionDateChanges(true);
21762  this.HideDropDownArea(true);
21763  ASPx.Selection.Set(this.GetInputElement());
21764 },
21765 OnTimeEditEsc: function() {
21766  this.ForceRefocusEditor();
21767  this.HideDropDownArea(true);
21768 },
21769 OnTimeEditTab: function(shiftKey) {
21770  if(shiftKey && !this.GetCalendarOwner())
21771   this.ForceRefocusEditor();
21772  this.ApplyTimeSectionDateChanges(true);
21773  this.HideDropDownArea(true);
21774 },
21775 OnApplyButtonClick: function() {
21776  this.ApplyTimeSectionDateChanges(true);
21777  this.HideDropDownArea(true);
21778 },
21779 OnTimeSectionCancelClick: function() {
21780  this.ApplyTimeSectionDateChanges(false);
21781  this.HideDropDownArea(true);
21782 },
21783 OnTimeSectionClearClick: function() {
21784  this.ChangeDate(null);
21785  this.GetCalendar().ResetLastSelectedDate();
21786  this.HideDropDownArea(true);
21787 },
21788 OnTimeEditInternalValueChanging: function(date) {
21789  var clock = this.GetClock();
21790  if(clock)
21791   clock.SetDate(date);
21792 },
21793 OnArrowUp: function(evt){ 
21794  var isProcessed = ASPxClientDropDownEditBase.prototype.OnArrowUp.call(this, evt);
21795  if(!isProcessed && this.droppedDown)
21796   return this.OnCalendarMethod("OnArrowUp", evt);       
21797  return false;
21798 },
21799 OnArrowDown: function(evt){
21800  var isProcessed = ASPxClientDropDownEditBase.prototype.OnArrowDown.call(this, evt);
21801  if(!isProcessed && this.droppedDown)
21802   return this.OnCalendarMethod("OnArrowDown", evt);
21803  return false;
21804 },
21805 OnArrowLeft: function(evt){
21806  if(this.droppedDown) {
21807   this.OnCalendarMethod("OnArrowLeft", evt);
21808   return true;
21809  }
21810  return false;
21811 },
21812 OnArrowRight: function(evt){
21813  if(this.droppedDown) { 
21814   this.OnCalendarMethod("OnArrowRight", evt);
21815   return true;
21816  }
21817  return false;
21818 },
21819 OnPageUp: function(evt){
21820  if(this.droppedDown) { 
21821   this.OnCalendarMethod("OnPageUp", evt);
21822   return true;
21823  }
21824  return false;  
21825 },
21826 OnPageDown: function(evt){
21827  if(this.droppedDown) {
21828   this.OnCalendarMethod("OnPageDown", evt);
21829   return true;
21830  }
21831  return false;  
21832 },
21833 OnEndKeyDown: function(evt) {
21834  if(this.droppedDown) {
21835   this.OnCalendarMethod("OnEndKeyDown", evt);
21836   return true;
21837  }
21838  return false;
21839 },
21840 OnHomeKeyDown: function(evt) {
21841  if(this.droppedDown) {
21842   this.OnCalendarMethod("OnHomeKeyDown", evt);
21843   return true;
21844  }
21845  return false; 
21846 },
21847 OnCalendarMethod: function(methodName, evt){
21848  var calendar = this.GetCalendar();
21849  if(!calendar)
21850   return;
21851  if(!calendar.IsFastNavigationActive())
21852   this.SetTextWasLastTemporaryChanged(false);
21853  return calendar[methodName](evt);
21854 },
21855 GetDateByCurrentValueString: function(valueString) {
21856  var inputValueParseResult = this.dateFormatter.Parse(valueString);
21857  return inputValueParseResult ? inputValueParseResult : null;
21858 },
21859 OnKeyDown: function(evt) {
21860  ASPxClientDropDownEditBase.prototype.OnKeyDown.call(this, evt);
21861  this.keyUpProcessing = true;
21862 },
21863 OnKeyUp: function(evt) {
21864  if(ASPx.FilteringUtils.EventKeyCodeChangesTheInput(evt)){
21865   this.SetTextWasLastTemporaryChanged(true);
21866   if (this.UseRestrictions() && this.outOfRangeWarningManager) {
21867    var valueString = this.GetInputElement().value;
21868    this.lastValue = valueString;
21869    this.UpdateOutOfRangeWarning(valueString);
21870   }
21871  }
21872  this.keyUpProcessing = false;
21873  this.EnsureClearButtonVisibility();
21874 },
21875 UpdateOutOfRangeWarning: function(valueString) {
21876  var currentDate = this.GetDateByCurrentValueString(valueString);
21877  currentDate = this.CorrectDateByPickerType(currentDate);
21878  if(this.maskInfo && ASPx.DateUtils.AreDatesEqualExact(currentDate, new Date(100, 0, 1)))
21879   currentDate = null;
21880  this.outOfRangeWarningManager.UpdateOutOfRangeWarningElementVisibility(currentDate);
21881 },
21882 SetTextChangingTimer: function () {
21883  if(this.pasteTimerID === -1)
21884   this.pasteTimerID = ASPx.Timer.SetControlBoundInterval(this.OnTextChangingCheck, this, ASPx.PasteCheckInterval);
21885 },
21886 ClearTextChangingTimer: function () {
21887  this.pasteTimerID = ASPx.Timer.ClearInterval(this.pasteTimerID);
21888 },
21889 OnTextChangingCheck: function (evt) {
21890  var input = this.GetInputElement();
21891  if (!input)
21892   return;
21893  var curValueString = input.value.toString();
21894  if (this.lastValue != curValueString && !this.keyUpProcessing) {
21895   var isChromeOnAndroid = ASPx.Browser.AndroidMobilePlatform && ASPx.Browser.Chrome;
21896   if (!isChromeOnAndroid)
21897    this.OnPaste(curValueString);
21898  }
21899 },
21900 OnPaste: function (valueString) {
21901  this.lastValue = valueString;
21902  if(this.UseRestrictions() && this.outOfRangeWarningManager)
21903   this.UpdateOutOfRangeWarning(valueString);
21904 },
21905 OnEnter: function() {
21906  this.enterProcessed = false; 
21907  if(this.droppedDown) {
21908   this.GetActiveController().OnEnter();
21909   this.enterProcessed = true;
21910  }
21911  else
21912   this.OnApplyChanges();
21913  this.SetTextWasLastTemporaryChanged(false);
21914  return this.enterProcessed;
21915 },
21916 OnEscape: function() {
21917  if(this.droppedDown)
21918   this.GetActiveController().OnEscape();
21919  else
21920   this.ChangeDate(this.date);  
21921  this.SetTextWasLastTemporaryChanged(false);
21922  return true;
21923 },
21924 OnTab: function(evt){
21925  if(!this.droppedDown) return;
21926  this.GetActiveController().OnTab(evt);
21927 },
21928 HideDropDownArea: function(isRaiseEvent) {
21929  if(this.accessibilityCompliant && this.focused)
21930   this.OnHideCalendarAccessible();
21931  var calendar = this.GetCalendar();
21932  if(calendar)
21933   calendar.EnsureHideFastNavigation();
21934  ASPxClientDropDownEditBase.prototype.HideDropDownArea.call(this, isRaiseEvent);
21935 },
21936 OnTextChanged: function() {
21937  if(!this.IsFocusEventsLocked() || !this.droppedDown) {
21938   ASPxClientDropDownEditBase.prototype.OnTextChanged.call(this);
21939   var newText = this.GetInputElement().value;
21940   if(this.accessibilityCompliant) {
21941    if(!newText)
21942     newText = ASPx.AccessibilitySR.BlankEditorText;
21943    var accessibilityElement = this.GetAccessibilityAssistantElement();
21944    ASPx.Attr.SetAttribute(accessibilityElement, "aria-label", newText);
21945   }
21946  }
21947 },
21948 IsMaskInfoEmpty: function() {
21949  return this.maskInfo && (this.maskInfo.IsEmpty() || this.GetValue() == null);
21950 },
21951 OnMouseWheel: function(evt) {
21952  var source = ASPx.Evt.GetEventSource(evt);
21953  var parentWheel = ASPx.GetParentByClassName(source, "dxsp-wheel");
21954  if(!parentWheel)
21955   ASPxClientDropDownEditBase.prototype.OnMouseWheel.call(this, evt);
21956 },
21957 ParseValue: function() { 
21958  this.ParseValueCore(true);
21959 },
21960 ParseValueCore: function(raiseChangedEvent) {
21961  var date;
21962  if(this.maskInfo != null) {   
21963   date = ASPx.MaskDateTimeHelper.GetDate(this.maskInfo, this.date);
21964  } else {
21965   var text = this.GetInputElement().value;
21966   var userParseResult = this.GetUserParsedDate(text);
21967   if(userParseResult !== false) {
21968    date = userParseResult;
21969   } else {
21970    if(text == null || text == "" || text == this.nullText)
21971     date = null;
21972    else
21973     date = !this.focused && raiseChangedEvent ? this.date : this.dateFormatter.ParseAndMergeWithDate(text, this.date);
21974   }   
21975  }
21976  if(this.GetShowTimeSection() && !this.HasTimeInEditFormat() && date)
21977   this.ApplyExistingTime(date);
21978  date = this.CorrectDateByPickerType(date);
21979  this.ApplyParsedDate(date, raiseChangedEvent);
21980  this.lastValue = this.GetInputElement().value;
21981 },
21982 GetUserParsedDate: function(text) {
21983  if(!this.ParseDate.IsEmpty()) {
21984   var args = new ASPxClientParseDateEventArgs(text);
21985   this.ParseDate.FireEvent(this, args);
21986   if(args.handled)
21987    return args.date;
21988  }
21989  return false;
21990 },
21991 ApplyParsedDate: function(date, raiseChangedEvent) {
21992  if(date === false || !ASPxClientCalendarDateDisabledHelper.IsDateInRange(this.sharedParameters, date) ||
21993   this.IsDateDisabled(date)) {
21994   switch(this.dateOnError) {
21995    case "n":
21996     date = null;
21997     break;
21998    case "t":
21999     date = new Date();
22000     break;
22001    default:
22002     date = this.date;
22003     break;
22004   }
22005  }
22006  if(!this.allowNull && date == null)
22007   date = this.date;
22008  if(raiseChangedEvent)
22009   this.ChangeDate(date);  
22010  else
22011   this.SetValue(date);
22012 },
22013 CorrectDateByPickerType: function(date) {
22014  return ASPx.DateUtils.CorrectDateByPickerType(date, this.pickerType);
22015 },
22016 SetSelectionOnToggleTextDecoration: function(input, sel) {
22017  if(this.maskInfo != null && this.GetValue() === null)
22018   sel.endPos = sel.startPos = 0;
22019  ASPxClientDropDownEditBase.prototype.SetSelectionOnToggleTextDecoration.call(this, input, sel);
22020 },
22021 IsDateDisabled: function(date) {
22022  var calendar = this.GetCalendar();
22023  var currentViewType = calendar ? calendar.currentViewType : this.pickerType;
22024  return ASPxClientCalendarDateDisabledHelper.IsDateDisabled(this.sharedParameters, date, function(d) { return this.OnCustomDisabledDate(d); }.aspxBind(this), currentViewType, this.pickerType);
22025 },
22026 HasTimeInEditFormat: function() {
22027  if(this.maskInfo) {
22028   for(var i = 0; i < this.maskInfo.parts.length; i++) {
22029    var part = this.maskInfo.parts[i];
22030    if(part.dateTimeRole && part.dateTimeRole.toLowerCase() == "h")
22031     return true;
22032   }
22033   return false;
22034  }
22035  return this.dateFormatter.mask.toLowerCase().indexOf("h") != -1;
22036 },
22037 ApplyExistingTime: function(date) {
22038  if(this.date == null)  return;  
22039  var savedDay = date.getDate();
22040  date.setHours(this.date.getHours());
22041  var diff = date.getDate() - savedDay;
22042  if(diff != 0) {
22043   var sign = (diff == 1 || date.getDate() == 1) ? -1 : 1;
22044   date.setTime(date.getTime() + sign * 3600000);
22045  }
22046  date.setMinutes(this.date.getMinutes());
22047  date.setSeconds(this.date.getSeconds());
22048  date.setMilliseconds(this.date.getMilliseconds());
22049 },
22050 GetValue: function() {
22051  return this.date;
22052 },
22053 GetLastSuccesfullValue: function() {
22054  return this.GetValue();
22055 },
22056 GetValueString: function() {
22057  return this.date != null ? ASPx.DateUtils.GetInvariantDateTimeString(this.date) : null;
22058 },
22059 SetValue: function(date, isInputUpdate) {
22060  date = this.CorrectDateByPickerType(date);
22061  if(!isInputUpdate)
22062   this.date = date;
22063  this.SetValueInternal(date, isInputUpdate);
22064  this.RaiseValueSet(isInputUpdate);
22065 },
22066 SetValueInternal: function(date, isInputUpdate) {
22067  if(this.maskInfo != null)
22068   this.SetMaskValue(date);
22069  else
22070   this.SetValueCore(date, isInputUpdate);
22071  if(this.styleDecoration)
22072   this.styleDecoration.Update();
22073 },
22074 SetMaskValue: function(date) {
22075  ASPx.MaskDateTimeHelper.SetDate(this.maskInfo, date);
22076  this.ApplyMaskInfo(false);
22077  this.SavePrevMaskValue();
22078 },
22079 SetValueCore: function(date, isInputUpdate) {
22080  this.GetInputElement().value = this.GetFormattedDate(date);
22081  if(!isInputUpdate)
22082   this.SyncRawValue();
22083  if(this.CanApplyTextDecorators())
22084   this.ToggleTextDecoration();
22085 },
22086 RaiseValueSet: function(isInputUpdate) {
22087  if(!isInputUpdate && !this.ValueSet.IsEmpty())
22088   this.ValueSet.FireEvent(this);
22089 },
22090 ChangeDate: function(date) { 
22091  var changed = !ASPx.DateUtils.AreDatesEqualExact(this.date, date);
22092  this.SetValue(date);
22093  var forceValueChanged = this.IsValueChangeForced() && !this.IsValueChanging();
22094  if(changed || forceValueChanged) {
22095   try {
22096    this.StartValueChanging();
22097    this.dateChangeProcessing = true;
22098    this.RaisePersonalStandardValidation();
22099    this.OnValueChanged();
22100   }
22101   finally {
22102    this.dateChangeProcessing = false;
22103    this.EndValueChanging();
22104   }
22105  }
22106 },
22107 IsDateChangeProcessing: function() {
22108  return this.dateChangeProcessing;
22109 },
22110 getProcessOnServerOnValueChanged: function() {
22111  var dateRangePair = ASPxDateRangeHelper.GetDateEditPair(this);
22112  if(!dateRangePair.isInRangeMode)
22113   return ASPxClientDropDownEditBase.prototype.getProcessOnServerOnValueChanged.call(this);
22114  var processOnServer = this.RaiseValueChangedEvent();
22115  return this.RaiseValidationInternal() && processOnServer;
22116 },
22117 GetText: function() {
22118  return this.GetFormattedDate();
22119 },
22120 SetText: function(value) {
22121  ASPxClientTextEdit.prototype.SetValue.call(this, value);
22122  if(this.maskInfo == null)
22123   this.ParseValueCore(false);
22124 },
22125 GetFormattedText: function() {
22126  if(this.maskInfo != null)
22127   return this.GetMaskDisplayText();
22128  if(this.date == null)
22129   return this.nullText;
22130  if(this.displayFormat != null)
22131   return this.GetDisplayFormatText(this.date);
22132  return this.GetFormattedDate();
22133 },
22134 ClearEditorValueByClearButtonCore: function() {
22135  if(this.allowNull === false) 
22136   this.SetValue(this.GetLastSuccesfullValue());
22137  else
22138   ASPxClientDropDownEditBase.prototype.ClearEditorValueByClearButtonCore.call(this);
22139 },
22140 ShouldCancelMaskKeyProcessing: function(htmlEvent, keyDownInfo) {
22141  if(htmlEvent.altKey)
22142   return true;
22143  if(ASPxClientDropDownEditBase.prototype.ShouldCancelMaskKeyProcessing.call(this, htmlEvent, keyDownInfo))
22144   return true;  
22145  if(!this.droppedDown)
22146   return false;
22147  if(this.GetShowTimeSection() && htmlEvent.keyCode == ASPx.Key.Tab)
22148   return false;
22149  return !ASPx.MaskManager.IsPrintableKeyCode(keyDownInfo) 
22150   && keyDownInfo.keyCode != ASPx.Key.Backspace
22151   && keyDownInfo.keyCode != ASPx.Key.Delete;
22152 },
22153 DecodeRawInputValue: function(value) {
22154  if(value == "N") return null;
22155  var date = new Date();
22156  date.setTime(Number(value));
22157  var result = ASPx.DateUtils.ToUtcTime(date);
22158  var offsetDiff = ASPx.DateUtils.GetTimeZoneOffsetDifference(result, date);
22159  if(offsetDiff !== 0)
22160   result.setTime(result.valueOf() + offsetDiff);
22161  return result;
22162 },
22163 SyncRawValue: function() {
22164  this.SetRawValue(this.date == null ? "N" : ASPx.DateUtils.ToLocalTime(this.date).valueOf());
22165 }, 
22166 HasTextDecorators: function() {
22167  return (this.maskInfo != null && this.date == null) || ASPxClientDropDownEditBase.prototype.HasTextDecorators.call(this);
22168 },
22169 GetDisplayFormatText: function(value) {
22170  if(this.pickerType == ASPx.DatePickerType.Decades && this.hasDecadeDisplayFormat && value && value.getFullYear)
22171   return ASPx.DateUtils.GetYearRangeFormatString(value.getFullYear(), 10);
22172  return ASPxClientDropDownEditBase.prototype.GetDisplayFormatText.call(this, value);
22173 },
22174 GetMaskDisplayText: function() {
22175  if(!this.focused) {
22176   if(this.date == null)
22177    return this.nullText;
22178   if(this.HasTextDecorators())
22179    return this.GetDecoratedText(this.date);
22180  }
22181  return this.maskInfo.GetText();
22182 },
22183 ToggleTextDecorationCore: function() {
22184  if(this.maskInfo != null) {
22185   this.ApplyMaskInfo(false);
22186  } else {
22187   var text = this.focused ? this.GetFormattedDate() : this.GetFormattedText();
22188   var input = this.GetInputElement();
22189   if(input.value != text)
22190    input.value = text;
22191  }
22192 },
22193 BeginShowMaskHint: function() {
22194 },
22195 EnsureOutOfRangeWarningManager: function () {
22196  this.ensureOutOfRangeWarningManager(this.GetMinDate(), this.GetMaxDate(), null, null, this.dateFormatter);
22197 },
22198 SetReadOnlyInternal: function(readOnly) {
22199  ASPxClientDropDownEditBase.prototype.SetReadOnlyInternal.call(this, readOnly);
22200  var calendar = this.GetCalendar();
22201  if(calendar)
22202   calendar.SetReadOnly(readOnly);
22203  var timeEdit = this.GetTimeEdit();
22204  if(timeEdit)
22205   timeEdit.SetReadOnly(readOnly);
22206 },
22207 OnHideCalendarAccessible: function() {
22208  var inputElement = this.GetInputElement();
22209  var accessibilityElement = this.GetAccessibilityAssistantElement();
22210  var pronounceTimeout = 300;
22211  ASPx.Attr.RemoveAttribute(inputElement, "aria-activedescendant");
22212  window.setTimeout(function() { 
22213   ASPx.Attr.SetAttribute(accessibilityElement, "aria-label", inputElement.value);
22214   ASPx.Attr.SetAttribute(inputElement, "aria-activedescendant", accessibilityElement.id);
22215  }, pronounceTimeout);
22216 },
22217 onDropDownApplyCommandClick: function() {
22218  this.OnApplyButtonClick();
22219 },
22220 onDropDownCloseCommandClick: function() {
22221  this.OnTimeSectionCancelClick();
22222 },
22223 ensureDropDownClosedOnLostFocus: function() {
22224  if(this.accessibilityCompliant && this.GetShowTimeSection())
22225   return;
22226  ASPxClientDropDownEditBase.prototype.ensureDropDownClosedOnLostFocus.call(this);
22227 },
22228 RaiseDateChanged: function(processOnServer, isInternal) {
22229  if(!this.DateChanged.IsEmpty()) {
22230   var args = new ASPxClientProcessingModeEventArgs(processOnServer);
22231   if (isInternal)
22232    args.isInternal = true;
22233   this.DateChanged.FireEvent(this, args);
22234   processOnServer = args.processOnServer;
22235  }
22236  return processOnServer;
22237 },
22238 RaiseCalendarCustomDisabledDate: function(e) {
22239  this.CalendarCustomDisabledDate.FireEvent(this, e);
22240 },
22241 SetDate: function(date) {
22242  this.SetValue(date);
22243  if(this.droppedDown)
22244   this.GetActiveController().SetSelectedDate(this.date);
22245 },
22246 GetDate: function() {
22247  return this.date ? new Date(this.date.valueOf()) : null;
22248 },
22249 GetRangeDayCount: function () {
22250  return ASPxDateRangeHelper.GetRangeLength(this, ASPx.DatePickerType.Days);
22251 },
22252 GetRangeLength: function() {
22253  return ASPxDateRangeHelper.GetRangeLength(this, this.pickerType);
22254 },
22255 GetMinDate: function() {
22256  return this.sharedParameters.minDate;
22257 },
22258 SetMinDate: function(date) {
22259  this.SetMinDateCore(date);
22260  this.ownMinDate = this.GetMinDate();
22261 },
22262 SetMinDateCore: function(date) {
22263  var newMinDate = this.CorrectDateByPickerType(date);
22264  this.sharedParameters.minDate = newMinDate;
22265  if(this.droppedDown) {
22266   var calendar = this.GetCalendar();
22267   if(calendar)
22268    calendar.SetMinDate(newMinDate);
22269  }
22270  if(this.showOutOfRangeWarning) {
22271   this.EnsureOutOfRangeWarningManager();
22272   this.outOfRangeWarningManager.SetMinValue(this.GetMinDate());
22273  }
22274  if(this.droppedDown)
22275   this.GetActiveController().UpdateMinMaxYears();
22276 },
22277 GetMaxDate: function() {
22278  return this.sharedParameters.maxDate;
22279 },
22280 SetMaxDate: function(date) {
22281  var newMaxDate = this.CorrectDateByPickerType(date);
22282  this.sharedParameters.maxDate = newMaxDate;
22283  if(this.droppedDown) {
22284   var calendar = this.GetCalendar();
22285   if(calendar)
22286    calendar.SetMaxDate(newMaxDate);
22287  }
22288  if(this.showOutOfRangeWarning) {
22289   this.EnsureOutOfRangeWarningManager();
22290   this.outOfRangeWarningManager.SetMaxValue(this.GetMaxDate());
22291  }
22292  if(this.droppedDown)
22293   this.GetActiveController().UpdateMinMaxYears();
22294 },
22295 GetDropDownHeight: function(){
22296  return this.GetActiveController().GetDropDownHeight();
22297 },
22298 GetDropDownWidth: function(){
22299  return this.GetActiveController().GetDropDownWidth();
22300 },
22301 getThemeClassName: function() {
22302  var controlClassName = "dxeButtonEdit_";
22303  var controlClassNames = ASPx.GetClassNameList(this.GetMainElement());
22304  var themedClassName = controlClassNames
22305   .filter(function(className) { return className.indexOf(controlClassName) === 0; })[0];
22306  return themedClassName && themedClassName.substr(controlClassName.length);
22307 },
22308});
22309var DateEditController = ASPx.CreateClass(null, {
22310 constructor: function(owner) {
22311  this.owner = owner;
22312  this.active = false;
22313  this.isComboBoxList = true;
22314 },
22315 Initialize: function(toActivate) {
22316  this.SetActive(toActivate);
22317 },
22318 SetActive: function(active) {
22319  this.active = active;
22320  var viewContainer = this.GetViewContainer();
22321  if(viewContainer)
22322   ASPx.SetElementDisplay(viewContainer, active);
22323  if(active)
22324   this.AdjustViews();
22325 },
22326 IsActive: function() {
22327  return this.active;
22328 },
22329 AssignDateRangeMode: function(startDateEdit) {
22330  this.PrepareCalendarsToDateRangeMode(startDateEdit);
22331  this.owner.ownMinDate = this.owner.GetMinDate();
22332  UTILS.SetActualMinDate(this.owner);
22333 },
22334 PrepareCalendarsToDateRangeMode: function(startDateEdit) {
22335  startDateEdit.endDateEdit = this.owner;
22336  UTILS.SetCalendarDateRangeMode(startDateEdit, this.owner);
22337  UTILS.SetCalendarDateRangeMode(this.owner, this.owner);
22338 },
22339 GetViewContainer: function() {
22340  throw "Not Implemented";
22341 },
22342 AttachToDateEditClientEvents: function(startDateEdit) {
22343  this.owner.DateChanged.AddHandler(function(s, e) {
22344   if(!e.isInternal)
22345    UTILS.OnRangeRestrictionChanged(s);
22346  });
22347  this.owner.CalendarShowing.AddHandler(function(s, e) {
22348   UTILS.OnCalendarShowing(this.owner);
22349  }.aspxBind(this));
22350  if(startDateEdit)
22351   startDateEdit.ValueSet.AddHandler(function(s, e) {
22352    UTILS.SetActualMinDate(startDateEdit);
22353   });
22354 },
22355 InitializeViewHandlers: function() { },
22356 OnDropDownCore: function() { },
22357 GetDropDownHeight: function() { return; },
22358 GetDropDownWidth: function() { return; },
22359 AdjustViews: function() { },
22360 GetSelectedDate: function() { },
22361 SetActiveControl: function() {
22362  ASPxClientDateEdit.active = this.owner;
22363 },
22364 OnBeforeShowDropDown: function(date) {
22365  this.SetActiveControl();
22366  this.SetSelectedDate(date);
22367 },
22368 OnAfterShowDropDown: function() {
22369  this.AdjustViews();
22370 },
22371 onDropDownModalChanged: function(enabled) { },
22372 OnBrowserWindowResize: function(e) { },
22373 UpdateMinMaxYears: function() { },
22374 OnTab: function(evt) { },
22375 OnEnter: function() { },
22376 OnEscape: function() { },
22377 OnPopupControlShown: function() { },
22378 ResetControlAdjustment: function() { this.owner.ResetControlAdjustment(); }
22379});
22380var DateEditCalendarController = ASPx.CreateClass(DateEditController, {
22381 constructor: function(owner) {
22382  this.constructor.prototype.constructor.call(this, owner);
22383  this.dropDownPosition = 0;
22384 },
22385 Initialize: function(toActivate) {
22386  DateEditController.prototype.Initialize.call(this, toActivate);
22387  var calendar = this.GetCalendar();
22388  if(calendar)
22389   calendar.customDraw = calendar.customDraw || this.owner.sharedParameters.calendarCustomDraw;
22390 },
22391 GetCalendar: function() {
22392  return this.owner.GetCalendar();
22393 },
22394 GetTimeEdit: function() { 
22395  return this.owner.GetTimeEdit();
22396 },
22397 GetViewContainer: function() {
22398  var calendar = this.GetCalendar();
22399  return calendar ? calendar.GetMainElement() : null;
22400 },
22401 InitializeViewHandlers: function() {
22402  if(this.HasOwnedCalendar()) {
22403   this.InitializeCalendarHandlers();
22404   this.InitializeTimeEditHandlers();
22405  } else 
22406   UTILS.RegisterSharedCalendar(this.GetCalendar()); 
22407 },
22408 HasOwnedCalendar: function() {
22409  return this.owner.calendarOwnerName == null;
22410 },
22411 InitializeCalendarHandlers: function() {
22412  var calendar = this.GetCalendar();
22413  if(!calendar)
22414   return;
22415  calendar.SelectionChanging.AddHandler(ASPxClientDateEdit.HandleCalendarSelectionChanging);
22416  calendar.MainElementClick.AddHandler(ASPxClientDateEdit.HandleCalendarMainElementClick);
22417  this.ReAssignCalendarSharedEventHandlers(calendar);
22418  var calendarMainElement = calendar.GetMainElement();
22419  if(ASPx.Browser.NetscapeFamily && ASPx.IsExistsElement(calendarMainElement))
22420   calendarMainElement.style.borderCollapse = "separate";
22421 },
22422 ReAssignCalendarSharedEventHandlers: function(calendar) {
22423  calendar.CustomDisabledDate.ClearHandlers();
22424  calendar.CellClick.ClearHandlers();
22425  calendar.CustomDisabledDate.AddHandler(ASPxClientDateEdit.HandleCalendarCustomDisabledDate.aspxBind(this.owner));
22426  calendar.CellClick.AddHandler(ASPxClientDateEdit.HandleCalendarCellClick.aspxBind(this.owner));
22427 },   
22428 InitializeTimeEditHandlers: function() {
22429  var timeEdit = this.GetTimeEdit();
22430  if(timeEdit) {
22431   timeEdit.InternalValueChanging.AddHandler(ASPxClientDateEdit.HandleTimeEditInternalValueChanging);
22432   timeEdit.OwnerDateEdit = this.owner;
22433  }
22434 },
22435 OnDropDownCore: function() {
22436  DateEditController.prototype.OnDropDownCore.call(this);
22437  var cal = this.GetCalendar();
22438  if(cal && this.owner.droppedDown)
22439     cal.forceMouseDown = true;
22440  if(cal && this.owner.isDropDownModal())
22441   cal.forceMouseDown = false;
22442 },
22443 onDropDownModalChanged: function(enabled) {
22444  if(!enabled)
22445   this.AdjustTimeSectionLayoutOnShowDropDown();
22446 },
22447 EnsureCalendarSelectedDateIsActual: function() {
22448  var calendar = this.GetCalendar();
22449  if(calendar.sharedParameters.dateRangeMode && (calendar.lastSelectedDate || !this.owner.date))
22450   calendar.SetSelectedDate(calendar.lastSelectedDate);
22451 },
22452 IsCalendarShared: function() {
22453  var calendar = this.GetCalendar();
22454  var calendarName = calendar != null ? calendar.name : "";
22455  return ASPxClientDateEdit.SharedCalendarCollection.calendarIsShared(calendarName);
22456 },
22457 SetDateToCalendar: function(date) {
22458  var calendar = this.GetCalendar();
22459  if(!calendar) return;
22460  calendar.sharedParameters = this.owner.sharedParameters;
22461  if(this.IsCalendarShared())
22462   this.ReAssignCalendarSharedEventHandlers(calendar);
22463  calendar.forceUpdate = true;
22464  if(!date) {
22465   calendar.SetValue(null);
22466   this.SetDefaultVisibleDateToCalendar(calendar);
22467  } else {
22468   var dateWithoutTime = new Date(date.getFullYear(), date.getMonth(), date.getDate());
22469   calendar.SetValue(dateWithoutTime);
22470  }
22471 },
22472 SetDefaultVisibleDateToCalendar: function(calendar) {
22473  var minDate = this.owner.GetMinDate();
22474  var maxDate = this.owner.GetMaxDate();
22475  var requiredVisibleDate = new Date();
22476  if(minDate != null && minDate > requiredVisibleDate)
22477   requiredVisibleDate = minDate;
22478  else if(maxDate != null && maxDate < requiredVisibleDate)
22479   requiredVisibleDate = ASPxClientCalendar.AddMonths(maxDate, 1 - calendar.rows * calendar.columns);
22480  calendar.SetVisibleDate(new Date(
22481   requiredVisibleDate.getFullYear(),
22482   requiredVisibleDate.getMonth(),
22483   requiredVisibleDate.getDate())
22484  );
22485 },
22486 SetDateToTimeSection: function(date) {
22487  if(this.owner.GetShowTimeSection()) {
22488   var timeEdit = this.GetTimeEdit();
22489   if(timeEdit)
22490    timeEdit.SetValue(date);
22491  }
22492 },
22493 GetSelectedDate: function() {
22494  var hours = 0, minutes = 0, seconds = 0, milliseconds = 0;
22495  this.EnsureCalendarSelectedDateIsActual();
22496  var date = this.GetCalendar().GetSelectedDate();
22497  this.GetTimeEdit().ParseValue();
22498  var timeEditDate = this.GetTimeEdit().GetDate();
22499  if(timeEditDate) {
22500   hours = timeEditDate.getHours();
22501   minutes = timeEditDate.getMinutes();
22502   seconds = timeEditDate.getSeconds();
22503   milliseconds = timeEditDate.getMilliseconds();
22504  }
22505  if(!date && timeEditDate)
22506   date = new Date(100, 0, 1);
22507  if(date) {
22508   date.setHours(hours);
22509   date.setMinutes(minutes);
22510   date.setSeconds(seconds);
22511   date.setMilliseconds(milliseconds);
22512  }
22513  return date;
22514 },
22515 SetSelectedDate: function(date, needLockAnimation) {
22516  if(needLockAnimation)
22517   this.GetCalendar().LockUpdateAnimation();
22518  this.SetDateToCalendar(date);
22519  this.SetDateToTimeSection(date);
22520  if(needLockAnimation)
22521   this.GetCalendar().UnlockUpdateAnimation();
22522 },
22523 SetActiveControl: function() {
22524  var calendar = this.GetCalendar();
22525  ASPx.activeCalendar = calendar;
22526  DateEditController.prototype.SetActiveControl.call(this);  
22527 },
22528 OnBeforeShowDropDown: function(date) {
22529  this.GetCalendar().LockUpdateAnimation();
22530  DateEditController.prototype.OnBeforeShowDropDown.call(this, date);
22531  this.owner.CalendarShowing.FireEvent(this.owner);
22532 },
22533 OnAfterShowDropDown: function() {
22534  var calendar = this.GetCalendar();
22535  if(calendar)
22536   calendar.SwitchToInitialView();
22537  var calendarOwner = this.owner.GetCalendarOwner();
22538  if(calendarOwner != null)
22539   calendarOwner.calendarConsumerName = this.owner.name;
22540  this.owner.calendarConsumerName = null;
22541  DateEditController.prototype.OnAfterShowDropDown.call(this);
22542  this.GetCalendar().UnlockUpdateAnimation();
22543 },
22544 AdjustTimeSectionLayoutOnShowDropDown: function() {
22545  if(this.owner.IsAdaptiveTimeSectionEnabled()) {
22546   this.dropDownPosition = ASPx.GetAbsoluteX(this.owner.GetPopupControl().GetCurrentWindowElement());
22547   this.AdjustTimeSectionLayout();
22548  }
22549 },
22550 AdjustTimeSectionLayout: function() {
22551  this.EnsureCalendarMaxWidth();
22552  var requiredTimeSectionPos = this.GetRequiredTimeSectionPosition();
22553  var currentTimeSectionPos = this.GetCurrentTimeSectionPosition();
22554  if(requiredTimeSectionPos !== currentTimeSectionPos) {
22555   if(requiredTimeSectionPos === ASPx.Position.Bottom)
22556    this.SwitchToVerticalTimeSectionLayout();
22557   else
22558    this.SwitchToHorizontalTimeSectionLayout();
22559   if(this.owner.isDropDownModal() === false)
22560    this.owner.GetClock().RecreateRectBag();
22561  }
22562 },
22563 SetCalendarMinMaxWidth: function(value) {
22564  var calendarMainElement = this.GetCalendar().GetMainElement();
22565  if(value === undefined) {
22566   calendarMainElement.style.minWidth = "";
22567   calendarMainElement.style.maxWidth = "";
22568  }
22569  else {
22570   calendarMainElement.style.minWidth = value + "px";
22571   calendarMainElement.style.maxWidth = value + "px";
22572  }
22573 },
22574 SwitchToHorizontalTimeSectionLayout: function() {
22575  var calendarMainElement = this.GetCalendar().GetMainElement();
22576  ASPx.RemoveClassNameFromElement(calendarMainElement, verticalTimeSectionClassName);
22577  ASPx.RemoveClassNameFromElement(calendarMainElement, calendarWithFullWidthChildsClassName);
22578  this.SetCalendarMinMaxWidth(this.GetCalendarWithHorizontalTimeSectionWidth());
22579  ASPx.SetElementDisplay(this.owner.GetPopupControl().GetWindowElement(-1), true);
22580 },
22581 SwitchToVerticalTimeSectionLayout: function() {
22582  var calendarMainElement = this.GetCalendar().GetMainElement();
22583  ASPx.AddClassNameToElement(calendarMainElement, verticalTimeSectionClassName);
22584  this.SetCalendarMinMaxWidth(this.GetCalendarWithVerticalTimeSectionWidth());
22585  ASPx.AddClassNameToElement(calendarMainElement, calendarWithFullWidthChildsClassName);
22586  ASPx.SetElementDisplay(this.owner.GetPopupControl().GetWindowElement(-1), true); 
22587 },
22588 GetCalendarMainElementHorizontalBorderPaddings: function() {
22589  if(!this.calendarMainElementHorizontalBorderPaddings) {
22590   var calendarMainElement = this.GetCalendar().GetMainElement();
22591   this.calendarMainElementHorizontalBorderPaddings = ASPx.GetLeftRightPaddings(calendarMainElement);
22592   var calendarMainElementCurrentStyle = ASPx.GetCurrentStyle(calendarMainElement);
22593   if(calendarMainElementCurrentStyle && calendarMainElementCurrentStyle.borderCollapse == "collapse") {
22594    var calendarMainElementHorizontalBordersWidth = ASPx.GetHorizontalBordersWidth(calendarMainElement);
22595    if(!ASPx.Browser.IE && !ASPx.Browser.Edge)
22596     calendarMainElementHorizontalBordersWidth /= 2;
22597    this.calendarMainElementHorizontalBorderPaddings += calendarMainElementHorizontalBordersWidth;
22598   }
22599  }
22600  return this.calendarMainElementHorizontalBorderPaddings;
22601 },
22602 GetCalendarWithVerticalTimeSectionWidth: function() {
22603  if(this.owner.isDropDownModal())
22604   return undefined;
22605  if(!this.calendarWithVerticalTimeSectionWidth) {
22606   this.calendarWithVerticalTimeSectionWidth = 0;
22607   var calendarMainElement = this.GetCalendar().GetMainElement();
22608   var maxChildElementWidth = 0;
22609   ASPx.AddClassNameToElement(calendarMainElement, calendarWithAutoWidthChildsClassName);
22610   for(var i = 0; i < calendarMainElement.childNodes.length; i++) {
22611    var calendarChildElement = calendarMainElement.childNodes[i];
22612    if(calendarChildElement.tagName != "DIV")
22613     continue;
22614    var calendarChildElementWidth = calendarChildElement.getBoundingClientRect().width;
22615    if(calendarChildElementWidth > maxChildElementWidth)
22616     maxChildElementWidth = calendarChildElementWidth;
22617   }
22618   ASPx.RemoveClassNameFromElement(calendarMainElement, calendarWithAutoWidthChildsClassName);
22619   this.calendarWithVerticalTimeSectionWidth = maxChildElementWidth + this.GetCalendarMainElementHorizontalBorderPaddings();
22620   this.calendarWithVerticalTimeSectionWidth = Math.ceil(this.calendarWithVerticalTimeSectionWidth);
22621  }
22622  return this.calendarWithVerticalTimeSectionWidth;
22623 },
22624 EnsureCalendarMaxWidth: function() {
22625  var calendarMainElement = this.GetCalendar().GetMainElement();
22626  if(!calendarMainElement.style.maxWidth) {
22627   ASPx.RemoveClassNameFromElement(calendarMainElement, verticalTimeSectionClassName);
22628   ASPx.RemoveClassNameFromElement(calendarMainElement, calendarWithFullWidthChildsClassName);
22629   this.SetCalendarMinMaxWidth(this.GetCalendarWithHorizontalTimeSectionWidth());
22630  }
22631 },
22632 GetCalendarWithHorizontalTimeSectionWidth: function() {
22633  if(this.owner.isDropDownModal())
22634   return undefined;
22635  if(!this.calendarWithHorizontalTimeSectionWidth) {
22636   this.calendarWithHorizontalTimeSectionWidth = 0;
22637   var calendarMainElement = this.GetCalendar().GetMainElement();
22638   for(var i = 0; i < calendarMainElement.childNodes.length; i++) {
22639    var calendarChildElement = calendarMainElement.childNodes[i];
22640    if(calendarChildElement.tagName == "DIV" && !ASPx.ElementHasCssClass(calendarChildElement, timeSectionFooterClassName))
22641     this.calendarWithHorizontalTimeSectionWidth += calendarChildElement.getBoundingClientRect().width;
22642   }
22643   this.calendarWithHorizontalTimeSectionWidth += this.GetCalendarMainElementHorizontalBorderPaddings();
22644   this.calendarWithHorizontalTimeSectionWidth = Math.ceil(this.calendarWithHorizontalTimeSectionWidth);
22645  }
22646  return this.calendarWithHorizontalTimeSectionWidth;
22647 },
22648 GetRequiredTimeSectionPosition: function() {
22649  var horizontalTimeSectionRightPos = this.GetCalendarWithHorizontalTimeSectionWidth();
22650  if(this.owner.isDropDownModal()) {
22651   var modalSys = this.owner.GetPopupControl().GetModalWrapperElement(-1);
22652   var modalSysStyle = ASPx.GetCurrentStyle(modalSys);
22653   horizontalTimeSectionRightPos += ASPx.PxToInt(modalSysStyle.paddingLeft) + ASPx.PxToInt(modalSysStyle.paddingRight);
22654  }
22655  else
22656   horizontalTimeSectionRightPos += this.dropDownPosition;
22657  var verticalScrollBarWidth = ASPx.GetCurrentDocumentWidth() > ASPx.GetDocumentClientWidth() ? ASPx.GetVerticalScrollBarWidth() : 0;
22658  return horizontalTimeSectionRightPos <= ASPx.GetDocumentScrollLeft() + window.innerWidth - verticalScrollBarWidth ? ASPx.Position.Right : ASPx.Position.Bottom;
22659 },
22660 GetCurrentTimeSectionPosition: function() {
22661  var calendarMainElement = this.GetCalendar().GetMainElement();
22662  return ASPx.ElementHasCssClass(calendarMainElement, verticalTimeSectionClassName) ? ASPx.Position.Bottom : ASPx.Position.Right;
22663 },
22664 OnBrowserWindowResize: function(e) {
22665  if(this.owner.ddmBP === undefined || this.owner.isDropDownModal(true) !== undefined)
22666   this.AdjustTimeSectionLayout();
22667 },
22668 OnTab: function(evt) {
22669  var calendar = this.GetCalendar();
22670  if(calendar.IsFastNavigationActive())
22671   calendar.CancelFastNavigation();
22672  if(this.owner.GetShowTimeSection()) {
22673   this.owner.lockLostFocus = true;
22674   if(this.owner.GetCalendarOwner()) {
22675    ASPx.Evt.PreventEvent(evt);  
22676    this.owner.GetTimeEdit().SetFocus();
22677   }
22678   return;
22679  }
22680  if(this.owner.GetTextWasLastTemporaryChanged()){
22681   this.owner.ParseValue();
22682   this.owner.HideDropDownArea(true);
22683  } else 
22684   this.owner.OnCalendarSelectionChanging(this.GetCalendar().GetValue(), false);
22685  this.owner.SetTextWasLastTemporaryChanged(false);
22686 },
22687 OnEnter: function(evt) {
22688  var calendar = this.GetCalendar();
22689  if(calendar.IsFastNavigationActive())
22690   calendar.OnEnterDown();
22691  else if(this.owner.GetTextWasLastTemporaryChanged()){
22692   this.owner.ParseValue();
22693   this.owner.HideDropDownArea(true);
22694  } else {
22695   var calendarSelection = calendar.GetValue();
22696   if(this.owner.GetShowTimeSection()) {
22697    if(calendarSelection) {
22698     this.owner.ApplyTimeSectionDateChanges(true);
22699     ASPx.Selection.Set(this.owner.GetInputElement());
22700    } 
22701    this.owner.HideDropDownArea(true);
22702   } else
22703    this.owner.OnCalendarSelectionChanging(calendarSelection, true);
22704  }
22705 },
22706 OnEscape: function() {
22707  if(this.GetCalendar().IsFastNavigationActive())
22708   this.GetCalendar().OnEscape();
22709  else
22710   this.owner.HideDropDownArea(true);
22711 },
22712 OnPopupControlShown: function() {
22713  this.AdjustTimeSectionLayoutOnShowDropDown();
22714 }
22715});
22716var DateEditScrollPickerController = ASPx.CreateClass(DateEditController, {
22717 constructor: function(owner, spOptions) {
22718  this.constructor.prototype.constructor.call(this, owner, spOptions);
22719  this.mask = owner.dateFormatter.mask;
22720  this.width = owner.width;
22721  this.height = owner.height;
22722  this.viewContainer = null;
22723  this.processDate = false;
22724  this.tempCache = new ListBoxTemporaryCache();
22725  this.lastSuccessfulDayIndex = 0;
22726  this.daysViewFilterUpdate = false;
22727  this.spOptions = spOptions;
22728  this.views = {};
22729  this.groups = [];
22730  this.wheelsStructure = [];
22731 },
22732 Initialize: function(toActivate) {
22733  DateEditController.prototype.Initialize.call(this, toActivate);
22734  this.createWheels();
22735  this.InitializeEvents();
22736 },
22737 InitializeEvents: function() {
22738  this.AttachToYearViewFocusEvents();
22739  this.AttachToMonthViewFocusEvents();
22740  this.AttachToDayViewFocusEvents();
22741  this.AttachToHoursViewFocusEvents();
22742  this.AttachToMinutesViewFocusEvents();
22743  this.AttachToSecondsViewFocusEvents();
22744  this.AttachToMillisecondsViewFocusEvents();
22745  this.AttachToAmPmViewFocusEvents();
22746 },
22747 createWheels: function() {
22748  this.groups = this.createGroups();
22749  var container = this.GetViewContainer();
22750  if(!container)
22751   return;
22752  this.groups.forEach(function(g) {
22753   var groupElement = this.createWheelGroupElement(container);
22754   g.forEach(function(w) {
22755    this.views[w.key] = this.createRollerView(groupElement, w.items.call(this), [], w.id, false, w.caption);
22756   }.bind(this));
22757  }.bind(this));
22758 },
22759 createWheelGroupElement: function(container) {
22760  var el = document.createElement("div");
22761  el.className = this.GetGroupElementClassName();
22762  container.appendChild(el);
22763  return el;
22764 },
22765 createRollerView: function(container, itemsInfo, itemsValue, id, isComboBoxList, caption) {
22766  return new ASPx.ASPxClientRollersView(this, container, itemsInfo, itemsValue, id, isComboBoxList, caption);
22767 },
22768 createGroups: function() {
22769  return [
22770   [
22771    { key: "years", index: this.GetYearsViewIndex(), caption: this.spOptions.yearsCaption, id: "Y", items: this.GetYearsViewItems },
22772    { key: "months", index: this.GetMonthsViewIndex(), caption: this.spOptions.monthsCaption, id: "M", items: this.GetMonthViewItems },
22773    { key: "days", index: this.GetDaysViewIndex(), caption: this.spOptions.daysCaption, id: "D", items: this.GetDayViewItems }
22774   ],
22775   [
22776    { key: "hours", index: this.owner.showHourWheel ? 0 : -1, caption: this.spOptions.hoursCaption, id: "TH", items: this.GetHoursViewItems },
22777    { key: "minutes", index: this.owner.showMinuteWheel ? 1 : -1, caption: this.spOptions.minutesCaption, id: "TM", items: this.GetMinutesSecondsViewItems },
22778    { key: "seconds", index: this.owner.showSecondWheel ? 2 : -1, caption: this.spOptions.secondsCaption, id: "TS", items: this.GetMinutesSecondsViewItems },
22779    { key: "milliseconds", index: this.owner.showMillisecondWheel ? 3 : -1, caption: this.spOptions.millisecondsCaption, id: "TMS", items: this.GetMillisecondsViewItems },
22780    { key: "ampm", index: this.IsAmPmViewExists() ? 4 : -1, caption: this.spOptions.ampmCaption, id: "TAP", items: this.GetAmPmViewItems }
22781   ]
22782  ]
22783  .map(function(g) {
22784   return g
22785    .filter(function(w) { return w.index >= 0; })
22786    .sort(function(w1, w2) { return w1.index - w2.index; });
22787  })
22788  .filter(function(g) {
22789   return g.length;
22790  });
22791 },
22792 GetYearsViewIndex: function() {
22793  return this.GetDateComponentKeyIndex("y");
22794 },
22795 GetMonthsViewIndex: function() {
22796  if(this.owner.pickerType <= ASPx.DatePickerType.Months)
22797   return this.GetDateComponentKeyIndex("M");
22798  return -1;
22799 },
22800 GetDaysViewIndex: function() {
22801  if(this.owner.pickerType == ASPx.DatePickerType.Days)
22802   return this.GetDateComponentKeyIndex("d");
22803  return -1;
22804 },
22805 GetDateComponentKeyIndex: function(key) {
22806  return ASPx.Data.ArrayIndexOf(ASPx.CultureInfo.shortDate, key);
22807 },
22808 GetDayViewItems: function() {
22809  var result = [];
22810  for(var i = 1; i <= 31; i++)
22811   result.push({ texts: [i.toString()], value: i.toString() });
22812  return result;
22813 },
22814 GetMonthViewItems: function() {
22815  var result = [];
22816  var monthNames = ASPx.CultureInfo.genMonthNames.slice(0, 12);
22817  for(var i = 0; i < 12; i++)
22818   result.push({ texts: [monthNames[i]], value: i.toString() });
22819  return result;
22820 },
22821 GetYearsViewItems: function() {
22822  var result = [];
22823  for(var i = 100; i < 10000; i++)
22824   result.push({ texts: [i.toString()], value: i.toString() });
22825  return result;
22826 },
22827 IsAmPmExists: function() {
22828  return ASPx.CultureInfo.am || ASPx.CultureInfo.pm;
22829 },
22830 IsAmPmViewExists: function() {
22831  return this.owner.showHourWheel && this.IsAmPmExists();
22832 },
22833 GetHoursViewItems: function() {
22834  var result = [];
22835  var startHour = this.IsAmPmExists() ? 1 : 0;
22836  var endHour = this.IsAmPmExists() ? 12 : 23;
22837  for(var i = startHour; i <= endHour; i++)
22838   result.push({ texts: [i.toString()], value: i.toString() });
22839  return result;
22840 },
22841 GetMinutesSecondsViewItems: function() {
22842  var result = [];
22843  for(var i = 0; i < 60; i++) {
22844   var itemText = i.toString();
22845   if(itemText.length == 1)
22846    itemText = "0" + itemText;
22847   result.push({ texts: [itemText], value: i.toString() });
22848  }
22849  return result;
22850 },
22851 GetMillisecondsViewItems: function() {
22852  var result = [];
22853  for(var i = 0; i < 1000; i++) {
22854   var itemText = i.toString();
22855   while(itemText.length < 3)
22856    itemText = "0" + itemText;
22857   result.push({ texts: [itemText], value: i.toString() });
22858  }
22859  return result;
22860 },
22861 GetAmPmViewItems: function() {
22862  var result = [];
22863  result.push({ texts: [ASPx.CultureInfo.am], value: "am" });
22864  result.push({ texts: [ASPx.CultureInfo.pm], value: "pm" });
22865  return result;
22866 },
22867 GetViewContainer: function() {
22868  if(!this.viewContainer)
22869   this.viewContainer = this.CreateViewContainer();
22870  return this.viewContainer;
22871 },
22872 CreateViewContainer: function() {
22873  var viewContainer = this.owner.GetViewContainer();
22874  if(!viewContainer)
22875   return;
22876  var container = document.createElement("DIV");
22877  container.className = this.GetControllerClassName();
22878  container.id = this.GetControlName() + "_" + "controllerContainer";
22879  viewContainer.appendChild(container);
22880  return container;
22881 },
22882 GetControllerClassName: function() {
22883  var className = "dxScrollPicker";
22884  var theme = this.owner.getThemeClassName();
22885  if(theme)
22886   className += "_" + theme;
22887  return className + " dxScrollPickerSys";
22888 },
22889 GetGroupElementClassName: function() {
22890  return "dxsp-wgroup";
22891 },
22892 GetSelectedDayItem: function() {
22893  var daysView = this.views["days"];
22894  if(!daysView)
22895   return null;
22896  return daysView.GetFocusedItem();
22897 },
22898 GetSelectedDay: function() {
22899  var item = this.GetSelectedDayItem();
22900  if(item && item.value)
22901   return item.value;
22902  return 1;
22903 },
22904 GetSelectedDayIndex: function() {
22905  var item = this.GetSelectedDayItem();
22906  if(item)
22907   return item.index;
22908  return 0;
22909 },
22910 GetSelectedMonth: function() {
22911  var result = 0;
22912  var monthsView = this.views["months"];
22913  if(!monthsView)
22914   return result;
22915  var selectedItem = monthsView.GetFocusedItem();
22916  if(selectedItem && selectedItem.value)
22917   result = selectedItem.value;
22918  return result;
22919 },
22920 GetSelectedYearItem: function() {
22921  var yearsView = this.views["years"];
22922  if(!yearsView)
22923   return null;
22924  return this.views["years"].GetFocusedItem();
22925 },
22926 GetSelectedYear: function() {
22927  var item = this.GetSelectedYearItem();
22928  if(item && item.value)
22929   return item.value;
22930  return 100;
22931 },
22932 GetSelectedYearIndex: function() {
22933  var item = this.GetSelectedYearItem();
22934  if(item && item.index)
22935   return item.index;
22936  return 0;
22937 },
22938 GetSelectedHour: function() {
22939  var result = 0;
22940  var hoursView = this.views["hours"];
22941  if(!hoursView)
22942   return result;
22943  var selectedItem = hoursView.GetFocusedItem();
22944  if(selectedItem && selectedItem.value)
22945   result = selectedItem.value;
22946  result = this.ConvertAmPmValueToHours(result);
22947  return result;
22948 },
22949 GetSelectedMinute: function() {
22950  var result = 0;
22951  var minutesView = this.views["minutes"];
22952  if(!minutesView)
22953   return result;
22954  var selectedItem = minutesView.GetFocusedItem();
22955  if(selectedItem && selectedItem.value)
22956   result = selectedItem.value;
22957  return result;
22958 },
22959 GetSelectedSecond: function() {
22960  var result = 0;
22961  var secondsView = this.views["seconds"];
22962  if(!secondsView)
22963   return result;
22964  var selectedItem = secondsView.GetFocusedItem();
22965  if(selectedItem && selectedItem.value)
22966   result = selectedItem.value;
22967  return result;
22968 },
22969 GetSelectedMillisecond: function() {
22970  var result = 0;
22971  var millisecondsView = this.views["milliseconds"];
22972  if(!millisecondsView)
22973   return result;
22974  var selectedItem = millisecondsView.GetFocusedItem();
22975  if(selectedItem && selectedItem.value)
22976   result = selectedItem.value;
22977  return result;
22978 },
22979 GetSelectedAmPm: function() {
22980  var result = "am";
22981  var ampmView = this.views["ampm"];
22982  if(!ampmView)
22983   return result;
22984  var selectedItem = ampmView.GetFocusedItem();
22985  if(selectedItem && selectedItem.value)
22986   result = selectedItem.value;
22987  return result;
22988 },
22989 GetSelectedDate: function() {
22990  var result = new Date(
22991   this.GetSelectedYear(),
22992   this.GetSelectedMonth(),
22993   this.GetSelectedDay(),
22994   this.GetSelectedHour(),
22995   this.GetSelectedMinute(),
22996   this.GetSelectedSecond(),
22997   this.GetSelectedMillisecond()
22998  );
22999  return result;
23000 },
23001 SetSelectedDate: function(date) {
23002  this.processDate = true;
23003  date = date || new Date();
23004  this.currentMaxDayValue = date.getDate();
23005  setTimeout(function() {
23006   if(this.views["days"]) {
23007    this.views["days"].FocusItemByValue(date.getDate());
23008    this.UpdateLastSuccessfulDayIndex();
23009   }
23010   if(this.views["years"]) {
23011    this.UpdateMinMaxYears();
23012    this.views["years"].FocusItemByValue(date.getFullYear());
23013   }
23014   if(this.views["months"])
23015    this.views["months"].FocusItemByValue(date.getMonth());
23016   if(this.views["hours"]) {
23017    var value = this.ConvertHoursToAmPmValue(date.getHours());
23018    this.views["hours"].FocusItemByValue(value);
23019   }
23020   if(this.views["ampm"])
23021    this.views["ampm"].FocusItemByValue(date.getHours() >= 12 ? "pm" : "am");
23022   if(this.views["minutes"])
23023    this.views["minutes"].FocusItemByValue(date.getMinutes());
23024   if(this.views["seconds"])
23025    this.views["seconds"].FocusItemByValue(date.getSeconds());
23026   if(this.views["milliseconds"])
23027    this.views["milliseconds"].FocusItemByValue(date.getMilliseconds());
23028   this.processDate = false;
23029   this.UpdateInputDate();
23030   this.UpdateDaysViewFilter();
23031   }.bind(this), 0);
23032 },
23033 GetControlName: function() {
23034  return this.owner.name;
23035 },
23036 HasVirtualScrolling: function() {
23037  return true;
23038 },
23039 GetItemCellsIdPostfixes: function() {
23040  return [lbIPostfixes[2]];
23041 },
23042 FormatText: function(texts) {
23043  return texts[0];
23044 },
23045 IsMultiColumn: function() {
23046  return false;
23047 },
23048 LockSynchronization: function() {
23049 },
23050 GetSampleItemRow: function() {
23051  var row = document.createElement("DIV");
23052  row.className = "dxsp-item";
23053  row.id = "LBI-1T";
23054  return row;
23055 },
23056 GetAccessibilityHeaderRow: function() {
23057  return null;
23058 },
23059 GetItem: function (index) {
23060  return this.view.GetItem(index);
23061 },
23062 GetIsItemSelected: function(index) {
23063  return false;
23064 },
23065 InitializeItemAttributes: function(newItemRow, newClientId) {
23066  newItemRow.id = newClientId;
23067 },
23068 AddStateControllerClasses: function(newID) {
23069 },
23070 GetIsCheckColumnExists: function() {
23071  return false;
23072 },
23073 GetItemCellCount: function() {
23074  return 1;
23075 },
23076 SetItemSelectionAppearance: function() {
23077 },
23078 ChangeEnabledStateItem: function() {
23079 },
23080 TryApplyHighlighting: function() {
23081 },
23082 UnlockSynchronization: function() {
23083 },
23084 InitDXTextAttributes: function() {
23085 },
23086 isSimplifiedRowIndexCalculationApplicable: function() {
23087  return false;
23088 },
23089 GetTopScrollSpacerHeight: function() {
23090  return 0;
23091 },
23092 GetBottomScrollSpacerHeight: function() {
23093  return 0;
23094 },
23095 NeedToHandleCellWidth: function() {
23096  return false;
23097 },
23098 GetDropDownHeight: function(){
23099  if(this.owner.ddHeightCache != ASPx.InvalidDimension)
23100   return this.owner.ddHeightCache;
23101  this.EnsureDropDownWidth(); 
23102  var result = this.AdjustListBoxHeight();  
23103  return result;
23104 },
23105 GetDropDownWidth: function() {
23106  var result = this.owner.ddWidthCache;
23107  if(this.owner.ddWidthCache == ASPx.InvalidDimension || this.owner.GetIsControlWidthWasChanged())
23108   result = this.AdjustListBoxWidth();
23109  return result;
23110 },
23111 EnsureDropDownWidth: function() {
23112  this.GetDropDownWidth();
23113 },
23114 AttachToYearViewFocusEvents: function() {
23115  var yearsView = this.views["years"];
23116  if(!yearsView)
23117   return;
23118  yearsView.EndFocus.AddHandler(this.UpdateDaysViewFilter.aspxBind(this));
23119  yearsView.ItemFocused.AddHandler(function(s, e) {
23120   var value = parseInt(e.item.value);
23121   this.UpdateInputDate(value, yearsView.id);
23122  }.aspxBind(this));
23123 },
23124 AttachToMonthViewFocusEvents: function() {
23125  var monthView = this.views["months"];
23126  if(!monthView)
23127   return;
23128  monthView.EndFocus.AddHandler(this.UpdateDaysViewFilter.aspxBind(this));
23129  monthView.ItemFocused.AddHandler(function(s, e) {
23130   var value = parseInt(e.item.value);
23131   this.UpdateInputDate(value, monthView.id);
23132  }.aspxBind(this));
23133 },
23134 AttachToDayViewFocusEvents: function() {
23135  var daysView = this.views["days"];
23136  if(!daysView)
23137   return;
23138  daysView.EndFocus.AddHandler(this.UpdateLastSuccessfulDayIndex.aspxBind(this));
23139  daysView.ItemFocused.AddHandler(function(s, e) {
23140   var value = parseInt(e.item.value);
23141   this.UpdateInputDate(value, daysView.id);
23142  }.aspxBind(this));
23143 },
23144 AttachToHoursViewFocusEvents: function() {
23145  var hoursView = this.views["hours"];
23146  if(!hoursView)
23147   return;
23148  hoursView.ItemFocused.AddHandler(function(s, e) {
23149   var value = parseInt(e.item.value);
23150   var hours = this.ConvertAmPmValueToHours(value);
23151   this.UpdateInputDate(hours, hoursView.id);
23152  }.aspxBind(this));
23153 },
23154 AttachToMinutesViewFocusEvents: function() {
23155  var minutesView = this.views["minutes"];
23156  if(!minutesView)
23157   return;
23158  minutesView.ItemFocused.AddHandler(function(s, e) {
23159   var value = parseInt(e.item.value);
23160   this.UpdateInputDate(value, minutesView.id);
23161  }.aspxBind(this));
23162 },
23163 AttachToSecondsViewFocusEvents: function() {
23164  var secondsView = this.views["seconds"];
23165  if(!secondsView)
23166   return;
23167  secondsView.ItemFocused.AddHandler(function(s, e) {
23168   var value = parseInt(e.item.value);
23169   this.UpdateInputDate(value, secondsView.id);
23170  }.aspxBind(this));
23171 },
23172 AttachToMillisecondsViewFocusEvents: function() {
23173  var millisecondsView = this.views["milliseconds"];
23174  if(!millisecondsView)
23175   return;
23176  millisecondsView.ItemFocused.AddHandler(function(s, e) {
23177   var value = parseInt(e.item.value);
23178   this.UpdateInputDate(value, millisecondsView.id);
23179  }.aspxBind(this));
23180 },
23181 AttachToAmPmViewFocusEvents: function() {
23182  var ampmView = this.views["ampm"];
23183  if(!ampmView)
23184   return;
23185  ampmView.ItemFocused.AddHandler(function(s, e) {
23186   this.UpdateInputDate(e.item.value, ampmView.id);
23187  }.aspxBind(this));
23188 },
23189 UpdateDaysViewFilter: function() {
23190  if(this.processDate)
23191   return;
23192  var daysView = this.views["days"];
23193  if(!daysView)
23194   return;
23195  this.daysViewFilterUpdate = true;
23196  var year = this.GetSelectedYear();
23197  var month = this.GetSelectedMonth();
23198  var dayInMonth = this.GetDayCountInMonth(year, month);
23199  var visibleItemCount = daysView.GetVisibleItemCount();
23200  if(dayInMonth == visibleItemCount)
23201   return;
23202  var isSatisfyDelegate = function(day) { 
23203   return parseInt(day) <= dayInMonth;
23204  };
23205  var newDayIndices = [];
23206  var itemCount = daysView.GetItemCount();
23207  for(var i = 0; i < itemCount; i++) {
23208   var item = daysView.GetItem(i);
23209   var isSatisfy = isSatisfyDelegate(item.value);
23210   if(isSatisfy)
23211    newDayIndices.push(i);
23212   daysView.ApplyFilterToItem(i, isSatisfy);
23213  }
23214  daysView.RewriteFilteredItemIndices(newDayIndices);
23215  daysView.OnEndItemsFiltering();
23216  var focusedDayValue = this.GetFocusedDayValueAfterFiltering(year, month);
23217  daysView.FocusItemByValue(focusedDayValue);
23218  daysView.ProcessSmoothScroll(null, false);
23219  this.daysViewFilterUpdate = false;
23220 },
23221 UpdateLastSuccessfulDayIndex: function() {
23222  if(this.daysViewFilterUpdate)
23223   return;
23224  this.lastSuccessfulDayIndex = this.GetSelectedDayIndex();
23225 },
23226 UpdateInputDate: function(value, viewID) {
23227  if(this.processDate || this.IsReadOnly())
23228   return;
23229  var focusedDate = this.GetFocusedDate(value, viewID);
23230  this.owner.SetValue(focusedDate, true);
23231 },
23232 GetFocusedDayValueAfterFiltering: function(year, month) {
23233  var daysView = this.views["days"];
23234  var result = null;
23235  if(!daysView.IsItemFiltered(this.lastSuccessfulDayIndex))
23236   result = this.GetDayCountInMonth(year, month);
23237  else
23238   result = daysView.GetItem(this.lastSuccessfulDayIndex).value;
23239  return result;
23240 },
23241 GetFocusedDate: function(value, viewID) {
23242  var date = this.GetSelectedDate();
23243  switch(viewID) {
23244   case "Y": 
23245    date.setFullYear(value);
23246    break;
23247   case "M":
23248    date.setMonth(value);
23249    break;
23250   case "D":
23251    date.setDate(value);
23252    break;
23253   case "TH":
23254    date.setHours(value);
23255    break;
23256   case "TM":
23257    date.setMinutes(value);
23258    break;
23259   case "TS": 
23260    date.setSeconds(value);
23261    break;
23262   case "TMS": 
23263    date.setMilliseconds(value);
23264    break;
23265   case "TAP":
23266    var hours = date.getHours();
23267    var ampm = this.GetSelectedAmPm();
23268    if(ampm !== value) {
23269     if(value === "pm" && hours <= 12)
23270      hours = hours + 12;
23271     if(value === "am" && hours >= 12)
23272      hours = hours - 12;
23273    }
23274    date.setHours(hours);
23275    break;
23276   default: 
23277    break;
23278  }
23279  return date;
23280 },
23281 ConvertAmPmValueToHours: function(value) {
23282  var result = parseInt(value);
23283  if(!this.IsAmPmViewExists())
23284   return result;
23285  var ampm = this.GetSelectedAmPm();
23286  if(ampm === "pm" && result < 12)
23287   result = result + 12;
23288  if(ampm === "am" && result === 12)
23289   result = 0;
23290  return result;
23291 },
23292 ConvertHoursToAmPmValue: function(hours) {
23293  if(!this.IsAmPmViewExists())
23294   return hours;
23295  if(hours === 0)
23296   hours = hours + 12;
23297  if(hours > 12)
23298   hours = hours - 12;
23299  return hours;
23300 },
23301 GetDayCountInMonth: function(year, month) {
23302  return new Date(year, parseInt(month) + 1, 0).getDate();
23303 },
23304 UpdateMinMaxYears: function() {
23305  var minDate = this.owner.GetMinDate();
23306  var minYear = minDate ? minDate.getFullYear() : 100;
23307  var maxDate = this.owner.GetMaxDate();
23308  var maxYear = maxDate ? maxDate.getFullYear() : 9999;
23309  var isSatisfyDelegate = function(year) {
23310   return year >= minYear && year <= maxYear;
23311  };
23312  var selectedYear = parseInt(this.GetSelectedYear());
23313  var yearsView = this.views["years"];
23314  var newYearIndices = [];
23315  var itemCountHiddenFromTop = 0;
23316  var itemCount = yearsView.GetItemCount();
23317  for(var i = 0; i < itemCount; i++) {
23318   var item = yearsView.GetItem(i);
23319   var value = parseInt(item.value);
23320   var isSatisfy = isSatisfyDelegate(value);
23321   if(isSatisfy)
23322    newYearIndices.push(i);
23323   if(value < selectedYear) {
23324    if(item.filtered && !isSatisfy)
23325     itemCountHiddenFromTop++;
23326    if(!item.filtered && isSatisfy)
23327     itemCountHiddenFromTop--;
23328   }
23329   yearsView.ApplyFilterToItem(i, isSatisfy);
23330  }
23331  yearsView.RewriteFilteredItemIndices(newYearIndices);
23332  yearsView.OnEndItemsFiltering(itemCountHiddenFromTop);
23333 },
23334 AdjustListBoxHeight: function () {
23335  var height = 0;
23336  for(var key in this.views) {
23337   if(this.views.hasOwnProperty(key)) {
23338    var view = this.views[key];
23339    if(view) {
23340     height = Math.max(view.GetScrollDivElement().offsetHeight, height);
23341     view.Adjust();
23342    }
23343   }
23344  }     
23345  return height;
23346 },
23347 AdjustListBoxWidth: function () {
23348  var width = 0;
23349  for(var key in this.views) {
23350   if(this.views.hasOwnProperty(key)) {
23351    var view = this.views[key];
23352    if(view) {
23353     width = Math.max(view.GetScrollDivElement().offsetWidth, width);
23354     view.Adjust();
23355    }
23356   }
23357  }     
23358  return width;
23359 },
23360 InitMainElementCache: function(){
23361  this.mainElementWidthCache = this.GetMainElement().clientWidth;
23362 },
23363 AdjustViews: function() {
23364    for(var key in this.views) {
23365   if(this.views.hasOwnProperty(key)) {
23366    var view = this.views[key];
23367    if(view) {
23368     view.Adjust();
23369    }
23370   }
23371  }
23372 },
23373 IsDisplayed: function() {
23374  return this.owner.IsDisplayed();
23375 },
23376 OnTab: function(evt) { 
23377  this.owner.HideDropDownArea(true);
23378 },
23379 OnEnter: function() { 
23380  this.owner.ApplyTimeSectionDateChanges(true);
23381  this.owner.HideDropDownArea(true);
23382 },
23383 OnEscape: function() {
23384  this.owner.ApplyTimeSectionDateChanges(false);
23385  this.owner.HideDropDownArea(true);
23386 },
23387 IsReadOnly: function() {
23388  return this.owner.GetReadOnly();
23389 }
23390});
23391var UTILS = { 
23392 SetCalendarDateRangeMode: function(dateEdit, endDateEdit) {
23393  dateEdit.sharedParameters.dateRangeMode = true;
23394  if(!dateEdit.enabled)
23395   return;
23396  var isOperaOrIEVersionHigher8 = ASPx.Browser.IE && ASPx.Browser.Version > 8 || ASPx.Browser.Opera;
23397  var calendar = dateEdit.GetCalendar();
23398  if(calendar)
23399   calendar.updateDayStylesTwiceOnMouseOver = isOperaOrIEVersionHigher8 && this.DateEditHasParentWithRelativePosition(endDateEdit);
23400 },
23401 DateEditHasParentWithRelativePosition: function(endDateEdit) {
23402  return ASPx.GetParent(endDateEdit.GetMainElement(),
23403   function (element) { return ASPx.GetCurrentStyle(element).position === "relative"; }) != null;
23404 },
23405 SetActualMinDate: function(dateEdit) {
23406  var dateRangePair = ASPxDateRangeHelper.GetDateEditPair(dateEdit);
23407  if(!dateRangePair.isInRangeMode) return;
23408  var rangeRestricts = ASPxDateRangeHelper.GetCurrentRangeRestrictions(dateRangePair);
23409  var newMinDate = rangeRestricts.startDate ? rangeRestricts.startDate : dateRangePair.endDateEdit.ownMinDate;
23410  if(!ASPx.DateUtils.AreDatesEqualExact(dateRangePair.endDateEdit.GetMinDate(), newMinDate))
23411   dateRangePair.endDateEdit.SetMinDateCore(newMinDate);
23412 },
23413 OnRangeRestrictionChanged: function(dateEdit) {
23414  var dateRangePair = ASPxDateRangeHelper.GetDateEditPair(dateEdit);
23415  if(!dateRangePair.isInRangeMode) return;
23416  var rangeRestricts = ASPxDateRangeHelper.GetCurrentRangeRestrictions(dateRangePair);
23417  if(ASPxDateRangeHelper.NeedCorrectSecondDateOnDateChanging(rangeRestricts, dateRangePair.isStart, dateRangePair.endDateEdit.minRange))
23418   this.CorrestSecondRangeDate(dateRangePair);
23419  if(dateRangePair.isStart)
23420   dateRangePair.endDateEdit.Validate();
23421  else {
23422   UTILS.SetActualMinDate(dateRangePair.endDateEdit);
23423   dateRangePair.startDateEdit.Validate();
23424  }
23425 },
23426 CorrestSecondRangeDate: function(dateRangePair) {
23427  var changedDate = (dateRangePair.isStart) ? dateRangePair.startDateEdit.GetDate() : dateRangePair.endDateEdit.GetDate();
23428  var endDateMinRange = Math.max(dateRangePair.endDateEdit.minRange, 0);
23429  var dateDifference = dateRangePair.isStart ? endDateMinRange : -endDateMinRange;
23430  var secondDateEdit = dateRangePair.isStart ? dateRangePair.endDateEdit : dateRangePair.startDateEdit;
23431  var secondDate = ASPxClientCalendar.GetDateByOffset(changedDate, dateDifference, secondDateEdit.pickerType);
23432  secondDateEdit.SetDate(secondDate);
23433  secondDateEdit.RaiseValueChangedEvent(true);
23434 },
23435 UpdateCalendarVisibleDate: function(targetCalendar, dateRangePair) {
23436  var rangeRestricts = ASPxDateRangeHelper.GetCurrentRangeRestrictions(dateRangePair);
23437  targetCalendar.visibleDateColumnOffset = 0;
23438  if (ASPxDateRangeHelper.IsStartRestrictionExistsOnly(rangeRestricts) && !dateRangePair.isStart) {
23439   targetCalendar.SetVisibleDate(rangeRestricts.startDate);
23440  }
23441  if (ASPxDateRangeHelper.IsEndRestrictionExistsOnly(rangeRestricts)
23442   || ASPxDateRangeHelper.IsBothRangeRestrictionsExist(rangeRestricts) && !dateRangePair.isStart) {
23443   targetCalendar.SetVisibleDate(rangeRestricts.endDate);
23444   if(!ASPxDateRangeHelper.AreRestrictionsOfSamePeriod(rangeRestricts, targetCalendar.pickerType))
23445    targetCalendar.OnShiftMonth(-1 * (targetCalendar.columns - 1), true);
23446  }
23447 },
23448 GetRangeToSelectInCalendar: function(targetCalendar, dateRangePair, isCalendarShowing) {
23449  var rangeRestricts = ASPxDateRangeHelper.GetCurrentRangeRestrictions(dateRangePair);
23450  var calendarHasOwnSelectedDate = targetCalendar.lastSelectedDate != null;
23451  var correctRangeRestrictsForSelection = !isCalendarShowing && calendarHasOwnSelectedDate;
23452  if (correctRangeRestrictsForSelection) {
23453   var calendarLastSelectedDate = ASPxClientCalendar.CloneDate(targetCalendar.lastSelectedDate);
23454   if (dateRangePair.isStart)
23455    rangeRestricts.startDate = calendarLastSelectedDate;
23456   else
23457    rangeRestricts.endDate = calendarLastSelectedDate;
23458  }
23459  return rangeRestricts;
23460 },
23461 SelectRangeInCalendar: function(targetCalendar, isCalendarShowing) {
23462  var dateRangePair = ASPxDateRangeHelper.GetDateEditPair(ASPxClientDateEdit.active);
23463  if(!dateRangePair.isInRangeMode)
23464   return;
23465  var rangeRestrictsToSelect = this.GetRangeToSelectInCalendar(targetCalendar, dateRangePair, isCalendarShowing);
23466  if(ASPxDateRangeHelper.IsNegativeRange(rangeRestrictsToSelect))
23467   return;
23468  targetCalendar.clientUpdate = true;
23469  targetCalendar.LockUpdateAnimation();
23470  targetCalendar.ClearSelection();
23471  if(ASPxDateRangeHelper.IsBothRangeRestrictionsExist(rangeRestrictsToSelect))
23472   targetCalendar.SelectRange(rangeRestrictsToSelect.startDate, rangeRestrictsToSelect.endDate);
23473  if(ASPxDateRangeHelper.IsEndRestrictionExistsOnly(rangeRestrictsToSelect))
23474   targetCalendar.SelectDate(rangeRestrictsToSelect.endDate);
23475  if(ASPxDateRangeHelper.IsStartRestrictionExistsOnly(rangeRestrictsToSelect))
23476   targetCalendar.SelectDate(rangeRestrictsToSelect.startDate);
23477  targetCalendar.UnlockUpdateAnimation();
23478  targetCalendar.Update();
23479  targetCalendar.clientUpdate = false;
23480 },
23481 OnCalendarShowing: function(dateEdit) {
23482  var dateRangePair = ASPxDateRangeHelper.GetDateEditPair(ASPxClientDateEdit.active);
23483  if(!dateRangePair.isInRangeMode)
23484   return;
23485  var targetCalendar = ASPxClientDateEdit.active.GetCalendar();
23486  if(!targetCalendar)
23487   return;
23488  UTILS.UpdateCalendarVisibleDate(targetCalendar, dateRangePair);
23489  UTILS.SetActualMinDate(dateEdit);
23490  UTILS.SelectRangeInCalendar(targetCalendar, true);
23491 },
23492 RegisterSharedCalendar: function(calendar) {
23493  if(calendar)
23494   ASPxClientDateEdit.SharedCalendarCollection.registerCalendarId(calendar.name);   
23495 }
23496};
23497ASPxClientDateEdit.SharedCalendarCollection = (function(){
23498 var sharedCalendarIdCollection = [];
23499 return {
23500  registerCalendarId: function(calendarId) {
23501   if(ASPx.Data.ArrayIndexOf(sharedCalendarIdCollection, calendarId) == -1)
23502    sharedCalendarIdCollection.push(calendarId);
23503  },
23504  calendarIsShared: function(calendarId) {
23505   return ASPx.Data.ArrayIndexOf(sharedCalendarIdCollection, calendarId) != -1;
23506  }
23507 };
23508})();
23509ASPxClientDateEdit.Cast = ASPxClientControl.Cast;
23510ASPxClientDateEdit.active = null;
23511ASPxClientDateEdit.HandleCalendarSelectionChanging = function(s, e) {
23512 if(ASPxClientDateEdit.active == null) return;
23513 ASPxClientDateEdit.active.OnCalendarSelectionChanging(e.selection.GetFirstDate(), true);
23514};
23515ASPxClientDateEdit.HandleCalendarCustomDisabledDate = function(s, e) {
23516 this.OnCalendarCustomDisabledDate(e);
23517};
23518ASPxClientDateEdit.HandleCalendarCellClick = function(s, e) {
23519 this.RaiseCalendarCellClick(e);
23520};
23521ASPxClientDateEdit.HandleTimeEditInternalValueChanging = function(s, date) {
23522 if(ASPxClientDateEdit.active == null) return;
23523 ASPxClientDateEdit.active.OnTimeEditInternalValueChanging(date);
23524};
23525ASPxClientDateEdit.HandleCalendarMainElementClick = function(s, e) {
23526 var dateEdit = ASPxClientDateEdit.active;
23527 if(dateEdit == null) 
23528  return;
23529 var focusEditor = true;
23530 if(dateEdit.GetShowTimeSection())
23531  focusEditor = !ASPx.GetIsParent(dateEdit.GetTimeEdit().GetMainElement(), ASPx.Evt.GetEventSource(e));
23532 if(focusEditor) {
23533  if(ASPx.Browser.VirtualKeyboardSupported)
23534   ASPx.VirtualKeyboardUI.smartFocusEditor(dateEdit);
23535  else 
23536   dateEdit.SetFocus();
23537 }
23538};
23539var ASPxClientParseDateEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
23540 constructor: function(value) {
23541  this.constructor.prototype.constructor.call(this);
23542  this.value = value;
23543  this.date = null;
23544  this.handled = false;
23545 } 
23546});
23547ASPx.DECalClearClick = function() {
23548 var edit = ASPxClientDateEdit.active;
23549 if(edit)
23550  edit.OnTimeSectionClearClick();
23551};
23552ASPx.DETimeEditKeyDown = function(s,e) {
23553 var edit = ASPxClientDateEdit.active;
23554 if(!edit) return;
23555 switch(e.htmlEvent.keyCode) {
23556  case ASPx.Key.Enter:
23557   edit.OnTimeEditEnter();
23558   break;
23559  case ASPx.Key.Esc:
23560   edit.OnTimeEditEsc();
23561   break;
23562  case ASPx.Key.Tab:
23563   edit.OnTimeEditTab(e.htmlEvent.shiftKey);
23564   break;
23565 }
23566};
23567ASPx.DETimeEditLostFocus = function() {
23568 var edit = ASPxClientDateEdit.active;
23569 if(!edit) return;
23570 edit.OnTimeEditLostFocus();
23571};
23572window.ASPxClientDateEdit = ASPxClientDateEdit;
23573window.ASPxClientParseDateEventArgs = ASPxClientParseDateEventArgs;
23574ASPx.DateRangeValidationPattern = DateRangeValidationPattern;
23575ASPx.DateEditScrollPickerController = DateEditScrollPickerController;
23576})();
23577
23578(function () {
23579var PopupUtils = {
23580 NotSetAlignIndicator: "NotSet",
23581 InnerAlignIndicator: "Sides",
23582 OutsideLeftAlignIndicator: "OutsideLeft",
23583 LeftSidesAlignIndicator: "LeftSides",
23584 RightSidesAlignIndicator: "RightSides",
23585 OutsideRightAlignIndicator: "OutsideRight",
23586 CenterAlignIndicator: "Center",
23587 AboveAlignIndicator: "Above",
23588 TopSidesAlignIndicator: "TopSides",
23589 MiddleAlignIndicator: "Middle",
23590 BottomSidesAlignIndicator: "BottomSides",
23591 BelowAlignIndicator: "Below",
23592 WindowCenterAlignIndicator: "WindowCenter",
23593 LeftAlignIndicator: "Left",
23594 RightAlignIndicator: "Right",
23595 TopAlignIndicator: "Top",
23596 BottomAlignIndicator: "Bottom",
23597 WindowLeftAlignIndicator: "WindowLeft",
23598 WindowRightAlignIndicator: "WindowRight",
23599 WindowTopAlignIndicator: "WindowTop",
23600 WindowBottomAlignIndicator: "WindowBottom",
23601 IsAlignNotSet: function (align) {
23602  return align == PopupUtils.NotSetAlignIndicator;
23603 },
23604 IsInnerAlign: function (align) {
23605  return align.indexOf(PopupUtils.InnerAlignIndicator) != -1;
23606 },
23607 IsRightSidesAlign: function(align) {
23608  return align == PopupUtils.RightSidesAlignIndicator;
23609 },
23610 IsOutsideRightAlign: function(align) {
23611  return align == PopupUtils.OutsideRightAlignIndicator;
23612 },
23613 IsCenterAlign: function(align) {
23614  return align == PopupUtils.CenterAlignIndicator;
23615 },
23616 FindPopupElementById: function (id) {
23617  if(id == "")
23618   return null; 
23619  var popupElement = ASPx.GetElementById(id);
23620  if(!ASPx.IsExistsElement(popupElement)) {
23621   var idParts = id.split("_");
23622   var uniqueId = idParts.join("$");
23623   popupElement = ASPx.GetElementById(uniqueId);
23624  }
23625  return popupElement;
23626 },
23627 FindEventSourceParentByTestFunc: function (evt, testFunc) {
23628  return ASPx.GetParent(ASPx.Evt.GetEventSource(evt), testFunc);
23629 },
23630 PreventContextMenu: function (evt) {
23631  ASPx.Evt.PreventEventAndBubble(evt);
23632  if(ASPx.Browser.WebKitFamily)
23633   evt.returnValue = false;
23634 },
23635 GetDocumentClientWidthForPopup: function() {
23636  return ASPx.Browser.WebKitTouchUI ? document.body.offsetWidth : ASPx.GetDocumentClientWidth();
23637 },
23638 GetDocumentClientHeightForPopup: function() {
23639  return ASPx.Browser.WebKitTouchUI ? document.body.offsetHeight : ASPx.GetDocumentClientHeight();
23640 },
23641 AdjustPositionToClientScreen: function (element, pos, rtl, isX) {
23642  var min = isX ? ASPx.GetDocumentScrollLeft() : ASPx.GetDocumentScrollTop(),
23643   max = min + (isX ? ASPx.GetDocumentClientWidth() : ASPx.GetDocumentClientHeight());
23644  max -= (isX ? element.offsetWidth : element.offsetHeight);
23645  if(rtl && isX) {
23646   if(pos < min) pos = min;
23647   if(pos > max) pos = max;
23648  } else {
23649   if(pos > max) pos = max;
23650   if(pos < min) pos = min;
23651  }
23652  return pos;
23653 },
23654 GetPopupAbsoluteX: function(element, popupElement, hAlign, hOffset, x, left, rtl, isPopupFullCorrectionOn) {
23655  return PopupUtils.getPopupAbsolutePos(element, popupElement, hAlign, hOffset, x, left, rtl, isPopupFullCorrectionOn, false, false, true);
23656 },
23657 GetPopupAbsoluteY: function (element, popupElement, vAlign, vOffset, y, top, isPopupFullCorrectionOn, ignoreAlignWithoutScrollReserve, ignorePopupElementBorders) {
23658  return PopupUtils.getPopupAbsolutePos(element, popupElement, vAlign, vOffset, y, top, false, isPopupFullCorrectionOn, ignoreAlignWithoutScrollReserve, ignorePopupElementBorders, false);
23659 },
23660 getPopupAbsolutePos: function(element, popupElement, align, offset, startPos, startPosInit, rtl, isPopupFullCorrectionOn, ignoreAlignWithoutScrollReserve, ignorePopupElementBorders, isHorizontal) {
23661  var calculator = getPositionCalculator();
23662  calculator.applyParams(element, popupElement, align, offset, startPos, startPosInit, rtl, isPopupFullCorrectionOn, ignoreAlignWithoutScrollReserve, ignorePopupElementBorders, isHorizontal);
23663  var position = calculator.getPopupAbsolutePos();
23664  calculator.disposeState();
23665  return position;
23666 },
23667 RemoveFocus: function (parent) {
23668  var div = document.createElement('div');
23669  div.tabIndex = "-1";
23670  PopupUtils.ConcealDivElement(div);
23671  parent.appendChild(div);
23672  if(ASPx.IsFocusable(div))
23673   div.focus();
23674  ASPx.RemoveElement(div);
23675 },
23676 ConcealDivElement: function (div) {
23677  div.style.position = "absolute";
23678  div.style.left = 0;
23679  div.style.top = 0;
23680  if(ASPx.Browser.WebKitFamily) {
23681   div.style.opacity = 0;
23682   div.style.width = 1;
23683   div.style.height = 1;
23684  } else {
23685   div.style.border = 0;
23686   div.style.width = 0;
23687   div.style.height = 0;
23688  }
23689 },
23690 InitAnimationProperties: function(element, onAnimStopCallString) {
23691  element.popuping = true;
23692  element.onAnimStopCallString = onAnimStopCallString;
23693 },
23694 InitAnimationDiv: function (element, x, y, onAnimStopCallString, skipSizeInit) {
23695  PopupUtils.InitAnimationProperties(element, onAnimStopCallString);
23696  PopupUtils.InitAnimationDivCore(element);
23697  if(!skipSizeInit) {
23698   ASPx.SetStyles(element, { width: "", height: "" });
23699   ASPx.SetStyles(element, { width: element.offsetWidth, height: element.offsetHeight });
23700  }
23701  ASPx.SetStyles(element, { left: x, top: y });
23702 },
23703 InitAnimationDivCore: function (element) {
23704  ASPx.SetStyles(element, {
23705   overflow: "hidden",
23706   position: "absolute"
23707  });
23708 },
23709 StartSlideAnimation: function (animationDivElement, element, iframeElement, duration, preventChangingWidth, preventChangingHeight) {
23710  if(iframeElement) {
23711   var endLeft = ASPx.PxToInt(iframeElement.style.left);
23712   var endTop = ASPx.PxToInt(iframeElement.style.top);
23713   var startLeft = ASPx.PxToInt(element.style.left) < 0 ? endLeft : animationDivElement.offsetLeft + animationDivElement.offsetWidth;
23714   var startTop = ASPx.PxToInt(element.style.top) < 0 ? endTop : animationDivElement.offsetTop + animationDivElement.offsetHeight;
23715   var properties = {
23716    left: { from: startLeft, to: endLeft, unit: "px" },
23717    top: { from: startTop, to: endTop, unit: "px" }
23718   };
23719   if(!preventChangingWidth)
23720    properties.width = { to: element.offsetWidth, unit: "px" };
23721   if(!preventChangingHeight)
23722    properties.height = { to: element.offsetHeight, unit: "px" };
23723   ASPx.AnimationHelper.createMultipleAnimationTransition(iframeElement, {
23724    duration: duration
23725   }).Start(properties);
23726  }
23727  ASPx.AnimationHelper.createMultipleAnimationTransition(element, {
23728   duration: duration,
23729   onComplete: function () { PopupUtils.AnimationFinished(animationDivElement, element); }
23730  }).Start({
23731   left: { to: 0, unit: "px" },
23732   top: { to: 0, unit: "px" }
23733  });
23734 },
23735 AnimationFinished: function (animationDivElement, element) {
23736  if(PopupUtils.StopAnimation(animationDivElement, element) && ASPx.IsExists(animationDivElement.onAnimStopCallString) &&
23737   animationDivElement.onAnimStopCallString !== "") {
23738   window.setTimeout(animationDivElement.onAnimStopCallString, 0);
23739  }
23740 },
23741 StopAnimation: function (animationDivElement, element) {
23742  if(animationDivElement.popuping) {
23743   ASPx.AnimationHelper.cancelAnimation(element);
23744   animationDivElement.popuping = false;
23745   animationDivElement.style.overflow = "visible";
23746   return true;
23747  }
23748  return false;
23749 },
23750 GetAnimationHorizontalDirection: function (popupPosition, horizontalAlign, verticalAlign, rtl) {
23751  if(PopupUtils.IsInnerAlign(horizontalAlign)
23752   && !PopupUtils.IsInnerAlign(verticalAlign)
23753   && !PopupUtils.IsAlignNotSet(verticalAlign))
23754   return 0;
23755  var toTheLeft = (horizontalAlign == PopupUtils.OutsideLeftAlignIndicator || horizontalAlign == PopupUtils.RightSidesAlignIndicator || (horizontalAlign == PopupUtils.NotSetAlignIndicator && rtl)) ^ popupPosition.isInverted;
23756  return toTheLeft ? 1 : -1;
23757 },
23758 GetAnimationVerticalDirection: function (popupPosition, horizontalAlign, verticalAlign) {
23759  if(PopupUtils.IsInnerAlign(verticalAlign)
23760   && !PopupUtils.IsInnerAlign(horizontalAlign)
23761   && !PopupUtils.IsAlignNotSet(horizontalAlign))
23762   return 0;
23763  var toTheTop = (verticalAlign == PopupUtils.AboveAlignIndicator || verticalAlign == PopupUtils.BottomSidesAlignIndicator) ^ popupPosition.isInverted;
23764  return toTheTop ? 1 : -1;
23765 },
23766 IsVerticalScrollExists: function () {
23767  var scrollIsNotHidden = ASPx.GetCurrentStyle(document.body).overflowY !== "hidden" && ASPx.GetCurrentStyle(document.documentElement).overflowY !== "hidden";
23768  return (scrollIsNotHidden && ASPx.GetDocumentHeight() > ASPx.GetDocumentClientHeight());
23769 },
23770 CoordinatesInDocumentRect: function (x, y) {
23771  var docScrollLeft = ASPx.GetDocumentScrollLeft();
23772  var docScrollTop = ASPx.GetDocumentScrollTop();
23773  return (x > docScrollLeft && y > docScrollTop &&
23774   x < ASPx.GetDocumentClientWidth() + docScrollLeft &&
23775   y < ASPx.GetDocumentClientHeight() + docScrollTop);
23776 },
23777 GetElementZIndexArray: function (element) {
23778  var currentElement = element;
23779  var zIndexesArray = [0];
23780  while(currentElement && currentElement.tagName != "BODY") {
23781   if(currentElement.style) {
23782    if(typeof (currentElement.style.zIndex) != "undefined" && currentElement.style.zIndex != "")
23783     zIndexesArray.unshift(currentElement.style.zIndex);
23784   }
23785   currentElement = currentElement.parentNode;
23786  }
23787  return zIndexesArray;
23788 },
23789 IsHigher: function (higherZIndexArrat, zIndexArray) {
23790  if(zIndexArray == null) return true;
23791  var count = (higherZIndexArrat.length >= zIndexArray.length) ? higherZIndexArrat.length : zIndexArray.length;
23792  for(var i = 0; i < count; i++)
23793   if(typeof (higherZIndexArrat[i]) != "undefined" && typeof (zIndexArray[i]) != "undefined") {
23794    var higherZIndexArrayCurrentElement = parseInt(higherZIndexArrat[i].toString());
23795    var zIndexArrayCurrentElement = parseInt(zIndexArray[i].toString());
23796    if(higherZIndexArrayCurrentElement != zIndexArrayCurrentElement)
23797     return higherZIndexArrayCurrentElement > zIndexArrayCurrentElement;
23798   } else return typeof (zIndexArray[i]) == "undefined";
23799  return true;
23800 },
23801 TestIsPopupElement: function (element) {
23802  return !!element.DXPopupElementControl;
23803 },
23804 adjustViewportScrollWrapper: function(wrapper, wrapperScroll, windowElement) {
23805  var document = wrapper.ownerDocument;
23806  var window = document.defaultView || document.parentWindow;
23807  var isWindowElementDisplayed = ASPx.IsElementDisplayed(windowElement);
23808  if(!isWindowElementDisplayed) {
23809   wrapper.style.cssText = "";
23810   wrapperScroll.style.cssText = "";
23811   return; 
23812  }
23813  var windowRect = windowElement.getBoundingClientRect();
23814  var yAxis = this.calculateViewPortScrollDataByAxis(wrapper.style.top, windowRect.top, windowElement.offsetHeight, window.innerHeight, wrapper.scrollTop);
23815  var xAxis = this.calculateViewPortScrollDataByAxis(wrapper.style.left, windowRect.left, windowElement.offsetWidth, window.innerWidth, wrapper.scrollLeft);
23816  this.prepareViewPortScrollData(xAxis, yAxis);
23817  ASPx.SetStyles(windowElement, {
23818   top: yAxis.windowOffset,
23819   left: xAxis.windowOffset
23820  });
23821  ASPx.SetStyles(wrapper, {
23822   width: xAxis.wrapperSize,
23823   height: yAxis.wrapperSize,
23824   position: "absolute",
23825   overflow: ASPx.Browser.MobileUI ? "scroll" : "auto",
23826   zIndex: windowElement.style.zIndex
23827  });
23828  ASPx.SetAbsoluteX(wrapper, ASPx.GetDocumentScrollLeft());
23829  ASPx.SetAbsoluteY(wrapper, ASPx.GetDocumentScrollTop());
23830  ASPx.SetStyles(wrapperScroll, {
23831   width: xAxis.wrapperScrollSize,
23832   height: yAxis.wrapperScrollSize,
23833   position: "absolute",
23834   overflow: "hidden"
23835  });
23836  wrapper.scrollLeft = xAxis.scrollSize;
23837  wrapper.scrollTop = yAxis.scrollSize;
23838 },
23839 calculateViewPortScrollDataByAxis: function(wrapperOffsetStyle, windowOffset, windowSize, viewPortSize, scrollSize) {
23840  var isWindowOffsetNegative = windowOffset < 0;
23841  windowOffset = isWindowOffsetNegative ? 0 : windowOffset;
23842  var wrapperScrollSize = Math.max(viewPortSize + Math.abs(Math.min(0, windowOffset)), windowSize + Math.abs(windowOffset));
23843  return { 
23844   windowOffset: isWindowOffsetNegative ? 0 : windowOffset,
23845   wrapperSize: viewPortSize,
23846   wrapperScrollSize: wrapperScrollSize,
23847   scrollSize: isWindowOffsetNegative ? scrollSize + Math.abs(windowOffset) : 0,
23848   hasScroll: wrapperScrollSize > viewPortSize
23849  };
23850 },
23851 prepareViewPortScrollData: function(xAxis, yAxis) {
23852  var scrollBarSize = ASPx.GetVerticalScrollBarWidth();
23853  if(yAxis.hasScroll && !xAxis.hasScroll) {
23854   xAxis.wrapperScrollSize = Math.min(xAxis.wrapperSize - scrollBarSize, xAxis.wrapperScrollSize);
23855  } else if(xAxis.hasScroll && !yAxis.hasScroll) {
23856   yAxis.wrapperScrollSize = Math.min(yAxis.wrapperSize - scrollBarSize, yAxis.wrapperScrollSize);
23857  } else if(yAxis.hasScroll && xAxis.hasScroll) {
23858   yAxis.wrapperScrollSize -= scrollBarSize;
23859   xAxis.wrapperScrollSize -= scrollBarSize;
23860  }
23861 }
23862};
23863PopupUtils.OverControl = {
23864 GetPopupElementByEvt: function (evt) {
23865  return PopupUtils.FindEventSourceParentByTestFunc(evt, PopupUtils.TestIsPopupElement);
23866 },
23867 OnMouseEvent: function (evt, mouseOver) {
23868  var popupElement = PopupUtils.OverControl.GetPopupElementByEvt(evt);
23869  if(mouseOver)
23870   popupElement.DXPopupElementControl.OnPopupElementMouseOver(evt, popupElement);
23871  else
23872   popupElement.DXPopupElementControl.OnPopupElementMouseOut(evt, popupElement);
23873 },
23874 OnMouseOut: function (evt) {
23875  PopupUtils.OverControl.OnMouseEvent(evt, false);
23876 },
23877 OnMouseOver: function (evt) {
23878  PopupUtils.OverControl.OnMouseEvent(evt, true);
23879 }
23880};
23881PopupUtils.BodyScrollHelper = (function () {
23882 var windowScrollLock = {},
23883  windowScroll = {},
23884  hideScrollbarsClassName = "dxpc-hideScrollbars",
23885  savedHtmlOverflow = "";
23886 function lockWindowScroll(windowId) {
23887  windowScrollLock[windowId] = true;
23888 }
23889 function unlockWindowScroll(windowId) {
23890  delete windowScrollLock[windowId];
23891 }
23892 function isLocked(windowId) {
23893  return !!windowScrollLock[windowId];
23894 }
23895 function isAnyWindowScrollLocked() {
23896  for(var key in windowScrollLock) 
23897   if (windowScrollLock.hasOwnProperty(key) && windowScrollLock[key] === true)
23898    return true;
23899  return false;
23900 }
23901 function replaceVerticalScrollByPadding() {
23902  var currentBodyStyle = ASPx.GetCurrentStyle(document.body),
23903   paddingWidth = ASPx.GetVerticalScrollBarWidth() + ASPx.PxToInt(currentBodyStyle.paddingRight);
23904  ASPx.Attr.ChangeStyleAttribute(document.body, "padding-right", paddingWidth + "px");
23905 }
23906 function needToChangeOverflowUsingStyle() {
23907  return ASPx.Browser.IE && ASPx.Browser.Version >= 11;
23908 }
23909 function changeOverflow() {
23910  if(needToChangeOverflowUsingStyle()) { 
23911   savedHtmlOverflow = document.documentElement.style.overflow;
23912   document.documentElement.style.overflow = "hidden";
23913  }
23914  else
23915   ASPx.Attr.ChangeStyleAttribute(document.documentElement, "overflow", "hidden");
23916  if(ASPx.GetCurrentStyle(document.body).overflowY === "scroll")
23917   ASPx.Attr.ChangeStyleAttribute(document.body, "overflow", "hidden");
23918  resetOverflowCache();
23919 }
23920 function restoreOverflow() {
23921  if(needToChangeOverflowUsingStyle()) { 
23922   document.documentElement.style.overflow = savedHtmlOverflow;
23923   savedHtmlOverflow = "";
23924  }
23925  else
23926   ASPx.Attr.RestoreStyleAttribute(document.documentElement, "overflow");
23927  ASPx.Attr.RestoreStyleAttribute(document.body, "overflow");
23928  resetOverflowCache();
23929 }
23930 function resetOverflowCache() {
23931  ASPx.verticalScrollIsNotHidden = null;
23932  ASPx.horizontalScrollIsNotHidden = null;
23933 }
23934 function saveScrollPosition(windowId) {
23935  windowScroll[windowId] = {
23936   x: window.pageXOffset,
23937   y: window.pageYOffset
23938  };
23939 }
23940 function restoreScrollPosition(windowId) {
23941  var currentWindowScroll = windowScroll[windowId];
23942  if(!!currentWindowScroll)
23943   window.scrollTo(currentWindowScroll.x, currentWindowScroll.y);
23944 }
23945 function restoreBodyScroll(windowId) {
23946  unlockWindowScroll(windowId);
23947  if(isAnyWindowScrollLocked())
23948   return;
23949  if(ASPx.Browser.IE) {
23950   ASPx.Attr.RestoreAttribute(document.body, "scroll");
23951   restoreOverflow();
23952   restoreScrollPosition(windowId);
23953  } else if(ASPx.Browser.WebKitTouchUI) {
23954   ASPx.Attr.RestoreStyleAttribute(document.body, "position");
23955   ASPx.Attr.RestoreStyleAttribute(document.body, "height");
23956   ASPx.Attr.RestoreStyleAttribute(document.body, "margin");
23957   ASPx.RemoveClassNameFromElement(document.documentElement, hideScrollbarsClassName);
23958   ASPx.Attr.RestoreStyleAttribute(document.body, "overflow");
23959   restoreScrollPosition(windowId);
23960  } else {
23961   restoreOverflow();
23962   restoreScrollPosition(windowId);
23963  }
23964  if(ASPx.Browser.Chrome)
23965   var dummy = document.documentElement.scrollTop; 
23966  ASPx.Attr.RestoreStyleAttribute(document.body, "padding-right");
23967  ASPx.Attr.RestoreStyleAttribute(document.body, "height");
23968  ASPx.Attr.RestoreStyleAttribute(document.body, "width");
23969 }
23970 return {
23971  RestoreIfLocked: function(windowId) {
23972   if(isLocked(windowId))
23973    restoreBodyScroll(windowId);
23974  },
23975  HideBodyScroll: function(windowId) {
23976   if(isAnyWindowScrollLocked()) { 
23977    lockWindowScroll(windowId);
23978    return;
23979   }
23980   lockWindowScroll(windowId);
23981   if(PopupUtils.IsVerticalScrollExists())
23982    replaceVerticalScrollByPadding();
23983   if(ASPx.Browser.IE) {
23984    saveScrollPosition(windowId);
23985    ASPx.Attr.ChangeAttribute(document.body, "scroll", "no");
23986    changeOverflow();
23987   } else if(ASPx.Browser.WebKitTouchUI) {
23988    saveScrollPosition(windowId);
23989    ASPx.Attr.ChangeStyleAttribute(document.body, "overflow", "hidden");
23990    ASPx.Attr.ChangeStyleAttribute(document.body, "position", "relative");
23991    ASPx.Attr.ChangeStyleAttribute(document.body, "height", "100%");
23992    ASPx.Attr.ChangeStyleAttribute(document.body, "margin", "0");
23993    ASPx.AddClassNameToElement(document.documentElement, hideScrollbarsClassName);
23994   } else {
23995    saveScrollPosition(windowId);
23996    changeOverflow();
23997    var documentHeight = ASPx.GetDocumentHeight();
23998    var documentWidth = ASPx.GetDocumentWidth();
23999    if(window.pageYOffset > 0 && ASPx.PxToInt(window.getComputedStyle(document.body, null)) != documentHeight)
24000     ASPx.Attr.ChangeStyleAttribute(document.body, "height", documentHeight + "px");
24001    if(window.pageXOffset > 0 && ASPx.PxToInt(window.getComputedStyle(document.body, null)) != documentWidth)
24002     ASPx.Attr.ChangeStyleAttribute(document.body, "width", documentWidth + "px");
24003   }
24004  },
24005  RestoreBodyScroll: restoreBodyScroll
24006 };
24007})();
24008var PositionAlignConsts = {
24009 NOT_SET: 0,
24010 OUTSIDE_START: 1,
24011 NEAR_BOUND_START: 2,
24012 INNER_START: 3,
24013 CENTER: 4,
24014 INNER_END: 5,
24015 NEAR_BOUND_END: 6,
24016 OUTSIDE_END: 7,
24017 WINDOW_CENTER: 8,
24018 WINDOW_START: 9,
24019 WINDOW_END: 10
24020};
24021var AlignIndicatorTable = {};
24022var PositionCalculator = ASPx.CreateClass(null, {
24023 constructor: function() {
24024  this.element = null;
24025  this.popupElement = null;
24026  this.align = 0;
24027  this.offset = 0;
24028  this.startPos = 0;
24029  this.startPosInit = 0;
24030  this.rtl = false;
24031  this.isPopupFullCorrectionOn = false;
24032  this.isHorizontal = true;
24033  this.size = 0;
24034  this.bodySize = 0;
24035  this.actualBodySize = 0;
24036  this.elementStartPos = 0;
24037  this.scrollStartPos = 0;
24038  this.isInverted = false;
24039  this.popupElementSize = 0;
24040  this.boundStartPos = 0;
24041  this.boundEndPos = 0;
24042  this.innerBoundStartPos = 0;
24043  this.innerBoundEndPos = 0;
24044  this.isMoreFreeSpaceLeft = false;
24045  this.nearBoundOverlapRate = 0.25;
24046  this.functionsTable = {};
24047  this.initializeFunctionsTable();
24048 },
24049 applyParams: function(element, popupElement, align, offset, startPos, startPosInit, rtl, isPopupFullCorrectionOn, ignoreAlignWithoutScrollReserve, ignorePopupElementBorders, isHorizontal) {
24050  this.isHorizontal = isHorizontal;
24051  this.element = element;
24052  this.popupElement = popupElement;
24053  this.align = this.getAlignValueFromIndicator(align);
24054  this.offset = offset;
24055  this.startPos = startPos;
24056  this.startPosInit = startPosInit;
24057  this.rtl = rtl;
24058  this.isPopupFullCorrectionOn = isPopupFullCorrectionOn;
24059  this.ignoreAlignWithoutScrollReserve = ignoreAlignWithoutScrollReserve;
24060  this.ignorePopupElementBorders = ignorePopupElementBorders;
24061  this.calculateParams();
24062 },
24063 disposeState: function() {
24064  this.element = null;
24065  this.popupElement = null;
24066 },
24067 getPopupAbsolutePos: function() {
24068  if(this.isWindowAlign()) {
24069   var showAtPos = this.startPos != ASPx.InvalidPosition && !this.popupElement;
24070   if(showAtPos)
24071    this.align = PositionAlignConsts.NOT_SET;
24072   else
24073    return this.getWindowAlignPos();
24074  }
24075  if(this.popupElement)
24076   this.calculatePopupElement();
24077  else
24078   this.align = PositionAlignConsts.NOT_SET;
24079  return this.getPopupAbsolutePosCore();
24080 },
24081 initializeFunctionsTable: function() {
24082  var table = this.functionsTable;
24083  table[PositionAlignConsts.NOT_SET] = this.calculateNotSet;
24084  table[PositionAlignConsts.OUTSIDE_START] = this.calculateOutsideStart;
24085  table[PositionAlignConsts.INNER_START] = this.calculateInnerStart;
24086  table[PositionAlignConsts.CENTER] = this.calculateCenter;
24087  table[PositionAlignConsts.INNER_END] = this.calculateInnerEnd;
24088  table[PositionAlignConsts.OUTSIDE_END] = this.calculateOutsideEnd;
24089  table[PositionAlignConsts.NEAR_BOUND_START] = this.calculateNearBoundStart;
24090  table[PositionAlignConsts.NEAR_BOUND_END] = this.calculateNearBoundEnd;
24091  table[PositionAlignConsts.WINDOW_CENTER] = this.calculateWindowCenter;
24092  table[PositionAlignConsts.WINDOW_START] = this.calculateWindowStart;
24093  table[PositionAlignConsts.WINDOW_END] = this.calculateWindowEnd;
24094 },
24095 calculateParams: function() {
24096  this.size = this.getElementSize();
24097  if(this.isHorizontal) {
24098   this.bodySize = ASPx.GetDocumentClientWidth();
24099   this.elementStartPos = ASPx.GetAbsoluteX(this.popupElement) + this.getBorderCorrection();
24100   this.scrollStartPos = ASPx.GetDocumentScrollLeft();
24101  }
24102  else {
24103   this.bodySize = ASPx.GetDocumentClientHeight();
24104   this.elementStartPos = ASPx.GetAbsoluteY(this.popupElement) + this.getBorderCorrection();
24105   this.scrollStartPos = ASPx.GetDocumentScrollTop();
24106  }
24107 },
24108 getBorderCorrection: function() {
24109  if(!this.ignorePopupElementBorders)
24110   return 0;
24111  var style = getComputedStyle(this.popupElement);
24112  return ASPx.PxToInt(this.isHorizontal ? style.borderLeftWidth : style.borderTopWidth);
24113 },
24114 isWindowAlign: function() {
24115  return this.align == PositionAlignConsts.WINDOW_CENTER || this.align == PositionAlignConsts.WINDOW_START ||
24116   this.align == PositionAlignConsts.WINDOW_END;
24117 },
24118 getWindowAlignPos: function() {
24119  this.actualBodySize = ASPx.Browser.WebKitTouchUI ? this.getWindowInnerSize() : this.bodySize;
24120  return this.getPopupAbsolutePosCore();
24121 },
24122 getPopupAbsolutePosCore: function() {
24123  var calculationFunc = this.functionsTable[this.align];
24124  calculationFunc.call(this);
24125  return new ASPx.PopupPosition(this.startPos, this.isInverted);
24126 },
24127 calculateWindowCenter: function() {
24128  this.startPos = Math.max(Math.ceil(this.actualBodySize / 2 - this.size / 2), 0) + this.scrollStartPos + this.offset;
24129 },
24130 calculateWindowStart: function() {
24131  this.startPos = this.scrollStartPos + this.offset;
24132 },
24133 calculateWindowEnd: function() {
24134  this.startPos = this.scrollStartPos + this.actualBodySize - this.size + this.offset;
24135 },
24136 calculatePopupElement: function() {
24137  this.popupElementSize = this.getPopupElementSize();
24138  this.boundStartPos = this.elementStartPos - this.size;
24139  this.boundEndPos = this.elementStartPos + this.popupElementSize;
24140  this.innerBoundStartPos = this.elementStartPos;
24141  this.innerBoundEndPos = this.elementStartPos + this.popupElementSize - this.size;
24142  var hasLeftScrollReserve = this.boundStartPos >= 0;
24143  this.isMoreFreeSpaceLeft = (this.bodySize - (this.boundEndPos + this.size) < this.boundStartPos - 2 * this.scrollStartPos) && (!this.ignoreAlignWithoutScrollReserve || hasLeftScrollReserve);
24144 },
24145 calculateOutsideStart: function() {
24146  this.isInverted = this.isPopupFullCorrectionOn && (!(this.boundStartPos - this.scrollStartPos > 0 || this.isMoreFreeSpaceLeft));
24147  if(this.isInverted)
24148   this.startPos = this.boundEndPos - this.offset;
24149  else
24150   this.startPos = this.boundStartPos + this.offset;
24151 },
24152 calculateInnerStart: function() {
24153  this.startPos = this.innerBoundStartPos + this.offset;
24154  if(this.isPopupFullCorrectionOn)
24155   this.startPos = PopupUtils.AdjustPositionToClientScreen(this.element, this.startPos, this.rtl, this.isHorizontal);
24156 },
24157 calculateCenter: function() {
24158  this.startPos = this.elementStartPos + Math.round((this.popupElementSize - this.size) / 2) + this.offset;
24159 },
24160 calculateInnerEnd: function() {
24161  this.startPos = this.innerBoundEndPos + this.offset;
24162  if(this.isPopupFullCorrectionOn)
24163   this.startPos = PopupUtils.AdjustPositionToClientScreen(this.element, this.startPos, this.rtl, this.isHorizontal);
24164 },
24165 calculateOutsideEnd: function() {
24166  this.isInverted = this.isPopupFullCorrectionOn && (!(this.boundEndPos + this.size < this.bodySize + this.scrollStartPos || !this.isMoreFreeSpaceLeft));
24167  if(this.isInverted)
24168   this.startPos = this.boundStartPos - this.offset;
24169  else
24170   this.startPos = this.boundEndPos + this.offset;
24171 },
24172 calculateNotSet: function() {
24173  if(this.rtl)
24174   this.calculateNotSetRightToLeft();
24175  else
24176   this.calculateNotSetLeftToRight();
24177 },
24178 calculateNotSetLeftToRight: function() {
24179  if(!ASPx.IsValidPosition(this.startPos)) {
24180   if(this.popupElement)
24181    this.startPos = this.elementStartPos;
24182   else if(this.offset)
24183    this.startPos = 0;
24184   else
24185    this.startPos = this.startPosInit;
24186  }
24187  this.isInverted = this.isPopupFullCorrectionOn && (this.startPos - this.scrollStartPos + this.size > this.bodySize && this.startPos - this.scrollStartPos > this.bodySize / 2);
24188  if(this.isInverted)
24189   this.startPos = this.startPos - this.size - this.offset;
24190  else
24191   this.startPos = this.startPos + this.offset;
24192 },
24193 calculateNotSetRightToLeft: function() {
24194  if(!ASPx.IsValidPosition(this.startPos)) {
24195   if(this.popupElement)
24196    this.startPos = this.innerBoundEndPos;
24197   else if(this.offset)
24198    this.startPos = 0;
24199   else
24200    this.startPos = this.startPosInit;
24201  }
24202  else
24203   this.startPos -= this.size;
24204  this.isInverted = this.isPopupFullCorrectionOn && (this.startPos < this.scrollStartPos && this.startPos - this.scrollStartPos < this.bodySize / 2);
24205  if(this.isInverted)
24206   this.startPos = this.startPos + this.size + this.offset;
24207  else
24208   this.startPos = this.startPos - this.offset;
24209 },
24210 calculateNearBoundStart: function() {
24211  this.startPos = this.boundStartPos + this.offset + this.size * this.nearBoundOverlapRate;
24212  if(this.isPopupFullCorrectionOn)
24213   this.startPos = PopupUtils.AdjustPositionToClientScreen(this.element, this.startPos, this.rtl, this.isHorizontal);
24214 },
24215 calculateNearBoundEnd: function() {
24216  this.startPos = this.boundEndPos + this.offset - this.size * this.nearBoundOverlapRate;
24217  if(this.isPopupFullCorrectionOn)
24218   this.startPos = PopupUtils.AdjustPositionToClientScreen(this.element, this.startPos, this.rtl, this.isHorizontal);
24219 },
24220 getAlignValueFromIndicator: function(alignIndicator) {
24221  var alignValue = AlignIndicatorTable[alignIndicator];
24222  if(alignValue === undefined)
24223   throw "Incorrect align indicator.";
24224  return alignValue;
24225 },
24226 getElementSize: function() {
24227  return this.getCustomElementSize(this.element, false);
24228 },
24229 getPopupElementSize: function() {
24230  return this.getCustomElementSize(this.popupElement, this.ignorePopupElementBorders);
24231 },
24232 getCustomElementSize: function(customElement, ignoreBorders) {
24233  if(ignoreBorders) {
24234   return this.isHorizontal ? ASPx.GetClearClientWidth(customElement) : ASPx.GetClearClientHeight(customElement);
24235  }
24236  return this.isHorizontal ? ASPx.GetElementOffsetWidth(customElement) : ASPx.GetElementOffsetHeight(customElement);
24237 },
24238 getWindowInnerSize: function() {
24239  return this.isHorizontal ? window.innerWidth : window.innerHeight;
24240 }
24241});
24242var positionCalculator = null;
24243function getPositionCalculator() {
24244 if(positionCalculator == null)
24245  positionCalculator = new PositionCalculator();
24246 return positionCalculator;
24247}
24248function initializeAlignIndicatorTable() {
24249 AlignIndicatorTable[PopupUtils.NotSetAlignIndicator] = PositionAlignConsts.NOT_SET;
24250 AlignIndicatorTable[PopupUtils.OutsideLeftAlignIndicator] = PositionAlignConsts.OUT
24250SIDE_START;
24251 AlignIndicatorTable[PopupUtils.AboveAlignIndicator] = PositionAlignConsts.OUTSIDE_START;
24252 AlignIndicatorTable[PopupUtils.LeftAlignIndicator] = PositionAlignConsts.NEAR_BOUND_START;
24253 AlignIndicatorTable[PopupUtils.TopAlignIndicator] = PositionAlignConsts.NEAR_BOUND_START;
24254 AlignIndicatorTable[PopupUtils.LeftSidesAlignIndicator] = PositionAlignConsts.INNER_START;
24255 AlignIndicatorTable[PopupUtils.TopSidesAlignIndicator] = PositionAlignConsts.INNER_START;
24256 AlignIndicatorTable[PopupUtils.CenterAlignIndicator] = PositionAlignConsts.CENTER;
24257 AlignIndicatorTable[PopupUtils.MiddleAlignIndicator] = PositionAlignConsts.CENTER;
24258 AlignIndicatorTable[PopupUtils.RightSidesAlignIndicator] = PositionAlignConsts.INNER_END;
24259 AlignIndicatorTable[PopupUtils.BottomSidesAlignIndicator] = PositionAlignConsts.INNER_END;
24260 AlignIndicatorTable[PopupUtils.RightAlignIndicator] = PositionAlignConsts.NEAR_BOUND_END;
24261 AlignIndicatorTable[PopupUtils.BottomAlignIndicator] = PositionAlignConsts.NEAR_BOUND_END;
24262 AlignIndicatorTable[PopupUtils.OutsideRightAlignIndicator] = PositionAlignConsts.OUTSIDE_END;
24263 AlignIndicatorTable[PopupUtils.BelowAlignIndicator] = PositionAlignConsts.OUTSIDE_END;
24264 AlignIndicatorTable[PopupUtils.WindowCenterAlignIndicator] = PositionAlignConsts.WINDOW_CENTER;
24265 AlignIndicatorTable[PopupUtils.WindowLeftAlignIndicator] = PositionAlignConsts.WINDOW_START;
24266 AlignIndicatorTable[PopupUtils.WindowTopAlignIndicator] = PositionAlignConsts.WINDOW_START;
24267 AlignIndicatorTable[PopupUtils.WindowRightAlignIndicator] = PositionAlignConsts.WINDOW_END;
24268 AlignIndicatorTable[PopupUtils.WindowBottomAlignIndicator] = PositionAlignConsts.WINDOW_END;
24269}
24270initializeAlignIndicatorTable();
24271ASPx.PopupPosition = function(position, isInverted) {
24272 this.position = position;
24273 this.isInverted = isInverted;
24274};
24275ASPx.PopupSize = function(width, height) {
24276 this.width = width;
24277 this.height = height;
24278};
24279ASPx.PopupUtils = PopupUtils;
24280ASPx.PositionCalculator = PositionCalculator;
24281})();
24282(function() {
24283ASPx.PCWIdSuffix = "_PW";
24284var popupControlZIndex = 11998;
24285var defaultZIndexFromServer = "10000";
24286var ModalAlign = {
24287 WindowLeft: "WindowLeft",
24288 WindowCenter: "WindowCenter",
24289 WindowRight: "WindowRight",
24290 WindowTop: "WindowTop",
24291 WindowBottom: "WindowBottom"
24292};
24293function PCResizeCursorInfo(horizontalDirection, verticalDirection, horizontalOffset, verticalOffset) {
24294 this.horizontalDirection = horizontalDirection;
24295 this.verticalDirection = verticalDirection;
24296 this.horizontalOffset = horizontalOffset;
24297 this.verticalOffset = verticalOffset;
24298 this.course = verticalDirection + horizontalDirection;
24299}
24300var PopupControlCssClasses = {};
24301PopupControlCssClasses.Prefix = "dxpc-";
24302PopupControlCssClasses.SizeGripLiteCssClassName = PopupControlCssClasses.Prefix + "sizeGrip";
24303PopupControlCssClasses.LinkCssClassName = PopupControlCssClasses.Prefix + "link";
24304PopupControlCssClasses.ShadowLiteCssClassName = PopupControlCssClasses.Prefix + "shadow";
24305PopupControlCssClasses.MainDivLiteCssClass = PopupControlCssClasses.Prefix + "mainDiv";
24306PopupControlCssClasses.ContentWrapperCssClassName = PopupControlCssClasses.Prefix + "contentWrapper";
24307PopupControlCssClasses.ContentCssClassName = PopupControlCssClasses.Prefix + "content";
24308PopupControlCssClasses.HeaderContentCssClassName = PopupControlCssClasses.Prefix + "headerContent";
24309PopupControlCssClasses.FooterContentCssClassName = PopupControlCssClasses.Prefix + "footerContent";
24310PopupControlCssClasses.WindowWrapperCssClassName = PopupControlCssClasses.Prefix + "win-wrapper";
24311PopupControlCssClasses.WindowWrapperScrollCssClassName = PopupControlCssClasses.WindowWrapperCssClassName + "-scroll";
24312PopupControlCssClasses.HeaderCssClassName = "dxpc-header";
24313var LoadContentViaCallback = {
24314 Default: "Default",
24315 OnFirstShow: "OnFirstShow",
24316 OnPageLoad: "OnPageLoad"
24317};
24318var constants = {
24319 DEFAULT_WINDOW_WIDTH: 200,
24320 DEFAULT_WINDOW_HEIGHT: 0
24321};
24322var ASPxClientPopupControlBase = ASPx.CreateClass(ASPxClientControl, {
24323 constructor: function(name) {
24324  this.constructor.prototype.constructor.call(this, name);
24325  this.leadingAfterInitCall = ASPxClientControl.LeadingAfterInitCallConsts.Direct; 
24326  this.adjustInnerControlsSizeOnShow = true;
24327  this.shadowVisible = true;
24328  this.cookieName = "";
24329  this.popupAnimationType = "none";
24330  this.closeAnimationType = "none";
24331  this.closeAction = "OuterMouseClick";
24332  this.isPopupFullCorrectionOn = true;
24333  this.forceAdjustPositionToClientScreen = false;
24334  this.usedInDropDown = false; 
24335  this.popupHorizontalOffset = 0;
24336  this.popupVerticalOffset = 0;
24337  this.popupHorizontalAlign = ASPx.PopupUtils.NotSetAlignIndicator;
24338  this.popupVerticalAlign = ASPx.PopupUtils.NotSetAlignIndicator;
24339  this.contentLoadingMode = LoadContentViaCallback.Default;
24340  this.slideAnimationDuration = 80;
24341  this.fadeAnimationDuration = 400;
24342  this.enableAnimation = true;
24343  this.showOnPageLoad = false;
24344  this.isDragged = false;
24345  this.closeOnEscape = false;
24346  this.savedCallbackWindowIndex = null;
24347  this.animationLockCount = 0;
24348  this.windowRequestCount = [];
24349  this.lpTimers = [];
24350  this.callbackAnimationProcessings = [];
24351  this.isCallbackFinishedStates = [];
24352  this.savedCallbackResults = [];
24353  this.loadingPanels = [];
24354  this.loadingDivs = [];
24355  this.left = 0;
24356  this.top = 0;
24357  this.height = constants.DEFAULT_WINDOW_HEIGHT;
24358  this.width = constants.DEFAULT_WINDOW_WIDTH;
24359  this.minHeight = null;
24360  this.minWidth = null;
24361  this.maxHeight = null;
24362  this.maxWidth = null;
24363  this.isResized = false;
24364  this.cachedSize = null;
24365  this.enableContentScrolling = false;
24366  this.contentOverflowX = "None";
24367  this.contentOverflowY = "None";
24368  this.contentUrl = "";
24369  this.contentUrlIFrameTitle = "";
24370  this.iframeLoading = false;
24371  this.iframeAdjustingPostponed = false;
24372  this.isPopupPositionCorrectionOn = true;
24373  this.resizeSessionCache = {};
24374  this.ResizeBorderSize = ASPx.Browser.TouchUI ? 10 : 6;
24375  this.ResizeCornerBorderSize = 20;
24376  this.isLiveResizingMode = true;
24377  this.allowResize = false;
24378  this.allowDragging = false;
24379  this.allowDraggingInAdaptiveMode = false;
24380  this.isWindowDragging = false;
24381  this.prohibitClearSelectionOnMouseDown = false;
24382  this.windowElements = {};
24383  this.windowContentElements = {};
24384  this.zIndex = -1;
24385  this.appearAfter = 300;
24386  this.disappearAfter = 500;
24387  this.popupAction = "LeftMouseClick";
24388  this.autoUpdatePosition = false;
24389  this.defaultIsPopuped = false;
24390  this.defaultLastUsedPopupElementInfo = {};
24391  this.defaultWindowPopupElementList = [];
24392  this.defaultWindowPopupElementIDList = [];
24393  this.firstFocusableElement = null;
24394  this.lastFocusableElement = null;
24395  this.focusLastElementHandler = function(e) { this.loopFocusHandler(e, false); }.aspxBind(this);
24396  this.focusFirstElementHandler = function(e) { this.loopFocusHandler(e, true); }.aspxBind(this);
24397  this.setFocusOnCallback = true;
24398  this.accessibleFocusElement = null;
24399  this.preventAccessibilityFocus = false;
24400  this.CloseButtonClick = new ASPxClientEvent();
24401  this.CloseUp = new ASPxClientEvent();
24402  this.Closing = new ASPxClientEvent();
24403  this.PopUp = new ASPxClientEvent();
24404  this.Shown = new ASPxClientEvent();
24405  this.Resize = new ASPxClientEvent();
24406  this.Dragged = new ASPxClientEvent(); 
24407  this.BeforeDrag = new ASPxClientEvent(); 
24408  this.BeforeResizing = new ASPxClientEvent();
24409  this.AfterResizing = new ASPxClientEvent();
24410  aspxGetPopupControlCollection().Add(this);
24411 },
24412 WindowElementIDAssignmentMap: [
24413  { cssClass: PopupControlCssClasses.HeaderCssClassName, prefix: "_PWH" },
24414  { cssClass: "dxpc-headerText", prefix: "_PWH", postfix: "T" },
24415  { cssClass: "dxpc-headerImg", prefix: "_PWH", postfix: "I" },
24416  { cssClass: "dxpc-closeBtn", prefix: "_HCB" },
24417  { cssClass: "dxpc-pinBtn", prefix: "_HPB" },
24418  { cssClass: "dxpc-refreshBtn", prefix: "_HRB" },
24419  { cssClass: "dxpc-collapseBtn", prefix: "_HMNB" },
24420  { cssClass: "dxpc-maximizeBtn", prefix: "_HMXB" },
24421  { cssClass: "dxpc-content", prefix: "_PWC" },
24422  { cssClass: "dxpc-iFrame", prefix: "_CIF" },
24423  { cssClass: "dxpc-footer", prefix: "_PWF" },
24424  { cssClass: "dxpc-footerText", prefix: "_PWF", postfix: "T" },
24425  { cssClass: "dxpc-footerImg", prefix: "_PWF", postfix: "I" }
24426 ],
24427 Initialize: function() {
24428  this.InitializeBeforeAnyShow();
24429  ASPxClientControl.prototype.Initialize.call(this);
24430  if(this.accessibilityCompliant)
24431   this.InitializeAccessibleNavigation();
24432 },
24433 InitializeWindow: function(index) {
24434  ASPx.PopupUtils.BodyScrollHelper.RestoreIfLocked(this.GetWindowElementId(index));
24435  this.RemoveWindowAllPopupElements(index);
24436  this.PopulatePopupElements(index);
24437  var element = this.GetWindowElement(index);
24438  if(element != null) {
24439   this.AssignWindowElementsID(index, element);
24440   this.AssignWindowElementsEvents(index, element);
24441   element.DXPopupWindowElement = true;
24442   this.AttachOnDragStartEventToWindowImages(index);
24443   this.EnsureWindowContentUrl(index);
24444   element.isHiding = false;
24445   element.isPopupPositionCorrectionOn = this.isPopupPositionCorrectionOn || !this.GetShowOnPageLoad(index);
24446   if(this.GetShowOnPageLoad(index) && this.GetZIndex(index) > 0) {
24447    this.FirstShowWindow(index, false);
24448    this.SetWindowElementZIndex(element, this.GetZIndex(index));
24449    element.isPopupPositionCorrectionOn = true;
24450   }
24451   this.InitializeWindowEscKeyHandler(element, index);
24452   if(this.GetCanScrollViewPort(index))
24453    ensureViewPortSizeInterval();
24454   var headerImageElement = this.GetWindowHeaderImageCell(index);
24455   if(headerImageElement != null) {
24456    var headerImageHandler = function() {
24457     this.CorrectHeaderContentElementHeight(index);
24458    }.aspxBind(this);
24459    headerImageElement.addEventListener("load", headerImageHandler);
24460    headerImageElement.addEventListener("error", headerImageHandler);
24461   }
24462   var footerImageElement = this.GetWindowFooterImageCell(index);
24463   if(footerImageElement != null) {
24464    var footerImageHandler = function() {
24465     this.CorrectWindowSizeGripPositionLite(index);
24466     this.CorrectFooterTextElementWidth(index);
24467    }.aspxBind(this);
24468    footerImageElement.addEventListener("load", footerImageHandler);
24469    footerImageElement.addEventListener("error", footerImageHandler);
24470   }
24471  }
24472 },
24473 InitializeBeforeAnyShow: function() {
24474  this.InitializeEnableContentScrolling();
24475 },
24476 InitializeEnableContentScrolling: function() {
24477  this.enableContentScrolling = this.contentOverflowX != "None" || this.contentOverflowY != "None";
24478 },
24479 InitializeWindowEscKeyHandler: function(element, index) {
24480  if(!this.GetEnableCloseByEsc(index)) return;
24481  this.AddKeyDownHandler("ESC", this.OnEscKeyDown.aspxBind(this));
24482 },
24483 AfterInitialize: function() {
24484  if(this.HasDefaultWindow())
24485   this.AfterInitializeWindow(-1);
24486  for(var i = 0; i < this.GetWindowCount(); i++)
24487   this.AfterInitializeWindow(i);
24488  ASPxClientControl.prototype.AfterInitialize.call(this);
24489 },
24490 AfterInitializeWindow: function(index) {
24491  if(this.GetShowOnPageLoad(index) && this.GetZIndex(index) < 0) {
24492   this.FirstShowWindow(index, true);
24493   var element = this.GetWindowElement(index);
24494   if(element != null)
24495    element.isPopupPositionCorrectionOn = true;
24496  }
24497  this.EnsureContent(index, true);
24498 },
24499 AssignWindowElementsID: function(index, windowElement) {
24500  for(var i = 0; i < this.WindowElementIDAssignmentMap.length; i++) {
24501   var elementClass = this.WindowElementIDAssignmentMap[i].cssClass;
24502   var elements = ASPx.GetNodesByClassName(windowElement, elementClass);
24503   for(var j = 0; j < elements.length; j++) {
24504    var element = elements[j];
24505    if(this.GetFirstParentWindow(element) === windowElement)
24506     this.AssignElementID(element, index, this.WindowElementIDAssignmentMap[i].prefix, this.WindowElementIDAssignmentMap[i].postfix);
24507   }
24508  }
24509 },
24510 AssignElementID: function(element, index, prefix, postfix) {
24511  element.id = this.name + prefix + index + (postfix ? postfix : "");
24512 },
24513 AssignWindowElementsEvents: function(index, element) {
24514  var header = this.GetWindowHeaderElement(index);
24515  if(header && this.allowDragging && !this.isWindowDragging)
24516   ASPx.Evt.AttachEventToElement(header, ASPx.TouchUIHelper.touchMouseDownEventName, this.GetWindowHeaderElementMouseDownEventHandler(index), true);
24517  this.AssignHeaderButtonsEvents(index);
24518  var mdEventName = ASPx.TouchUIHelper.touchMouseDownEventName;
24519  ASPx.Evt.AttachEventToElement(element, mdEventName, this.GetWindowElementMouseDownEventHandler(index));
24520  if(this.IsResizeAllowed(index)) {
24521   var mmEventName = ASPx.TouchUIHelper.touchMouseMoveEventName;
24522   ASPx.Evt.AttachEventToElement(element, mmEventName, this.GetWindowElementMouseMoveEventHandler(index));
24523  }
24524  var sizeGrip = this.GetWindowSizeGripElement(index);
24525  if(sizeGrip) {
24526   var instance = this;
24527   ASPx.Evt.AttachEventToElement(sizeGrip, mdEventName, function(evt) {
24528    ASPx.PWGripMDown(evt, instance.name, index);
24529    ASPx.Evt.PreventEvent(evt);
24530   });
24531  }
24532 },
24533 AssignHeaderButtonsEvents: function(index) {
24534  this.AttachClickToHeaderButton(index, this.GetWindowCloseButton(index), "ASPx.PWCBClick");
24535  this.AttachClickToHeaderButton(index, this.GetWindowRefreshButton(index), "ASPx.PWRBClick");
24536 },
24537 AttachClickToHeaderButton: function(index, headerButton, eventFuncName) {
24538  var instance = this;
24539  if(headerButton) {
24540   ASPx.Evt.AttachEventToElement(headerButton, "click", function(evt) {
24541    eval(eventFuncName)(evt, instance.name, index);
24542   });
24543  }
24544 },
24545 AttachOnDragStartEventToWindowImages: function(index) {
24546  this.AttachChildImagesPreventDragStartEvent(this.GetWindowHeaderElement(index));
24547  this.AttachChildImagesPreventDragStartEvent(this.GetWindowFooterElement(index));
24548 },
24549 AttachChildImagesPreventDragStartEvent: function(parentElem) {
24550  var images = parentElem == null ? null : ASPx.GetNodesByTagName(parentElem, "img");
24551  if(images != null) {
24552   for(var i = 0; i < images.length; i++)
24553    ASPx.Evt.AttachEventToElement(images[i], "dragstart", ASPx.Evt.PreventEventAndBubble);
24554  }
24555 },
24556 GetPropertyValue: function(index, propName) {
24557  return this[propName];
24558 },
24559 SetPropertyValue: function(index, propName, value) {
24560  this[propName] = value;
24561 },
24562 GetStretchVerticallyByIndex: function(index) {
24563  return this.GetPropertyValue(index, "stretchVertically");
24564 },
24565 GetModalMaxWidth: function(index) {
24566  return this.GetPropertyValue(index, "modalMaxWidth");
24567 },
24568 SetAdaptiveMaxWidthByIndex: function(index, value) {
24569  value = this.ConvertDimensionValueToString(value);
24570  this.SetPropertyValue(index, "modalMaxWidth", value);
24571  this.GetWindowElement(index).style["maxWidth"] = value;
24572  if(value.indexOf("px") > 0)
24573   this.EnsureMaxWidthClassName(index, ASPx.PxToInt(value));
24574 },
24575 EnsureMaxWidthClassName: function(index, maxWidth) {
24576  var defaultPaddingsWidth = 20;
24577  ASPx.ToggleClassNameToElement(this.GetModalWrapperElement(index), "dxmodalMaxWidth", maxWidth < ASPx.MaxMobileWindowWidth - defaultPaddingsWidth);
24578 },
24579 GetModalMinWidth: function(index) {
24580  return this.GetPropertyValue(index, "modalMinWidth");
24581 },
24582 SetAdaptiveMinWidthByIndex: function(index, value) {
24583  value = this.ConvertDimensionValueToString(value);
24584  this.SetPropertyValue(index, "modalMinWidth", value);
24585  this.GetWindowElement(index).style["minWidth"] = value;
24586 },
24587 GetModalMinHeight: function(index) {
24588  return this.GetPropertyValue(index, "modalMinHeight");
24589 },
24590 SetContentElementsAdaptiveDisplayStyle: function(index) {
24591  if (!this.GetWindowContentIFrameElement(index) && !this.HasAnyScrollBars(index)) {
24592   var contentWrapper = this.GetWindowContentWrapperElement(index);
24593   var contentElement = this.GetWindowContentElement(index);
24594   contentWrapper.style.display = "table";
24595   contentElement.style.display = "table-cell";
24596  }
24597 },
24598 SetContentWrapperAdaptiveHeight: function(index, adaptiveHeight) {  
24599  var contentWrapper = this.GetWindowContentWrapperElement(index);
24600  contentWrapper.style.height = adaptiveHeight;  
24601 },
24602 SetAdaptiveMinHeightByIndex: function(index, value) {  
24603  this.StretchVerticallyByIndex(index, false);
24604  this.SetPropertyValue(index, "modalMinHeight", value);
24605  this.SetAdaptiveHeightDimension(index, "minHeight", value);
24606 },
24607 GetModalMaxHeight: function(index) {
24608  return this.GetPropertyValue(index, "modalMaxHeight");
24609 },
24610 SetAdaptiveMaxHeightByIndex: function(index, value) {
24611  this.SetPropertyValue(index, "modalMaxHeight", value);
24612  this.SetAdaptiveHeightDimension(index, "maxHeight", value);
24613 },
24614 GetFixedHeader: function(index) {
24615  return this.GetPropertyValue(index, "fixedHeader");
24616 },
24617 GetFixedFooter: function(index) {
24618  return this.GetPropertyValue(index, "fixedFooter");
24619 },
24620 GetWindowWidthInternal: function(index) {
24621  return this.GetPropertyValue(index, "width");
24622 },
24623 GetWindowHeightInternal: function(index) {
24624  return this.GetPropertyValue(index, "height");
24625 },
24626 SetWindowHeight: function(index, height) {
24627  this.SetPropertyValue(index, "height", height);
24628 },
24629 SetWindowWidth: function(index, width) {
24630  this.SetPropertyValue(index, "width", width);
24631 },
24632 GetWindowMinWidth: function(index) {
24633  return this.GetPropertyValue(index, "minWidth");
24634 },
24635 GetWindowMaxWidth: function(index) {
24636  return this.GetPropertyValue(index, "maxWidth");
24637 },
24638 GetWindowMinHeight: function(index) {
24639  return this.GetPropertyValue(index, "minHeight");
24640 },
24641 GetWindowMaxHeight: function(index) {
24642  return this.GetPropertyValue(index, "maxHeight");
24643 },
24644 SetWindowCachedSize: function(index, width, height) {
24645  this.SetPropertyValue(index, "cachedSize", new ASPx.PopupSize(width, height));
24646 },
24647 GetWindowCachedSize: function(index) {
24648  return this.GetPropertyValue(index, "cachedSize");
24649 },
24650 ResetWindowCachedSize: function(index) {
24651  this.SetPropertyValue(index, "cachedSize", null);
24652 },
24653 GetPosition: function(index, isLeft) {
24654  return this.GetPropertyValue(index, isLeft ? "left" : "top");
24655 },
24656 GetWindowTop: function(index) {
24657  return this.GetPropertyValue(index, "top");
24658 },
24659 SetWindowTop: function(index, top) {
24660  this.SetPropertyValue(index, "top", top);
24661 },
24662 GetWindowLeft: function(index) {
24663  return this.GetPropertyValue(index, "left");
24664 },
24665 SetWindowLeft: function(index, left) {
24666  this.SetPropertyValue(index, "left", left);
24667 },
24668 GetEnableCloseByEsc: function(index) {
24669  return this.GetPropertyValue(index, "closeOnEscape");
24670 },
24671 GetIsDragged: function(index) {
24672  return this.GetPropertyValue(index, "isDragged");
24673 },
24674 GetWindowContentIFrameUrl: function(index) {
24675  return this.GetPropertyValue(index, "contentUrl");
24676 },
24677 GetWindowContentIFrameTitle: function(index) {
24678  return this.GetPropertyValue(index, "contentUrlIFrameTitle");
24679 },
24680 GetWindowCloseAction: function(index) {
24681  return this.GetPropertyValue(index, "closeAction");
24682 },
24683 GetShowOnPageLoad: function(index) {
24684  return this.GetPropertyValue(index, "showOnPageLoad");
24685 },
24686 GetZIndex: function(index) {
24687  return this.GetPropertyValue(index, "zIndex");
24688 },
24689 GetIframeLoading: function(index) {
24690  return this.GetPropertyValue(index, "iframeLoading");
24691 },
24692 SetIframeLoading: function(index, value) {
24693  this.SetPropertyValue(index, "iframeLoading", value);
24694 },
24695 SetIsDragged: function(index, value) {
24696  this.SetPropertyValue(index, "isDragged", value);
24697 },
24698 GetIsResized: function(index) {
24699  return this.GetPropertyValue(index, "isResized");
24700 },
24701 SetIsResized: function(index, value) {
24702  this.SetPropertyValue(index, "isResized", value);
24703 },
24704 SetIframeAdjustingPostponed: function(index, value) {
24705  this.SetPropertyValue(index, "iframeAdjustingPostponed", value);
24706 },
24707 GetIframeAdjustingPostponed: function(index) {
24708  return this.GetPropertyValue(index, "iframeAdjustingPostponed");
24709 },
24710 GetWindowPopupAction: function(index) {
24711  return this.GetPropertyValue(index, "popupAction");
24712 },
24713 GetWindowElementMouseMoveEventHandler: function(index) {
24714  var instance = this;
24715  return function(evt) { ASPx.PWMMove(evt, instance.name, index); };
24716 },
24717 GetWindowElementMouseDownEventHandler: function(index) {
24718  var instance = this;
24719  return function(evt) {
24720   if(instance.AllowMouseDown(evt, index))
24721    ASPx.PWMDown(evt, instance.name, index, instance.isWindowDragging);
24722  };
24723 },
24724 GetWindowHeaderElementMouseDownEventHandler: function(index) {
24725  var instance = this;
24726  return function(evt) {
24727   if(instance.AllowMouseDown(evt, index))
24728    ASPx.PWDGMDown(evt, instance.name, index);
24729  };
24730 },
24731 AllowMouseDown: function(evt, index) {
24732  return !this.PreventHeaderButtonMouseDownBubbling(evt, this.GetWindowCloseButton(index)) &&
24733   !this.PreventHeaderButtonMouseDownBubbling(evt, this.GetWindowRefreshButton(index));
24734 },
24735 PreventHeaderButtonMouseDownBubbling: function(evt, hdrButton) {
24736  if(hdrButton) {
24737   var source = ASPx.Evt.GetEventSource(evt);
24738   if(ASPx.GetIsParent(hdrButton, source)) {
24739    ASPx.PWHMDown(evt);
24740    return true;
24741   }
24742  }
24743  return false;
24744 },
24745 PrepareToAdjustContentOnShow: function(index) {
24746  if(this.adjustInnerControlsSizeOnShow) {
24747   var windowContent = this.GetContentContainer(index),
24748    collection = ASPx.GetControlCollection();
24749   collection.CollapseControls(windowContent);
24750  }
24751 },
24752 AdjustContentOnShow: function(index) {
24753  if(this.adjustInnerControlsSizeOnShow) {
24754   var windowElement = this.GetWindowElement(index);
24755   ASPx.GetControlCollection().AdjustControls(windowElement, false);
24756  }
24757 },
24758 AdjustSize: function() {
24759  if(this.enableContentScrolling)
24760   return;
24761  this.SetSize(0, 0);
24762 },
24763 GetFirstParentWindow: function(el) {
24764  while(el && el.tagName != "BODY") {
24765   if(el.nodeType == 1 && el.className.indexOf("dxpclW") > -1 && !isNaN(this.GetWindowIndex(el)))
24766    return el;
24767   el = el.parentNode;
24768  }
24769 },
24770 getParentPopupControl: function(index) {
24771  var parentPopupWindowElement = this.GetFirstParentWindow(this.GetWindowElement(index).parentNode);
24772  if(parentPopupWindowElement)
24773   return aspxGetPopupControlCollection().GetPopupWindowFromID(parentPopupWindowElement.id);
24774 },
24775 registerAndActivateWindow: function(windowElement, index, allowChangeZIndex) {
24776  aspxGetPopupControlCollection().RegisterVisibleWindow(windowElement, this, index);
24777  if(allowChangeZIndex)
24778   aspxGetPopupControlCollection().ActivateWindowElement(windowElement, undefined, this.GetPopupType(), this.GetDefaultZIndexFromServer(), this.GetPopupControlZIndex());
24779 },
24780 HasCloseAnimation: function() {
24781  return this.closeAnimationType != ASPxClientPopupControlBase.AnimationType.None;
24782 },
24783 AddKeyDownHandler: function(shortcutString, handler) {
24784  if(typeof(this.keyDownHandlers) === "undefined")
24785   this.keyDownHandlers = [];
24786  this.keyDownHandlers[ASPx.ParseShortcutString(shortcutString)] = handler;
24787 },
24788 InternalIsWindowDisplayed: function(index) {
24789  var element = this.GetWindowElement(index);
24790  return (element != null) ? ASPx.GetElementDisplay(element) : false;
24791 },
24792 InternalIsWindowVisible: function(index) {
24793  var element = this.GetWindowElement(index);
24794  if(!element)
24795   return false;
24796  if(this.HasCloseAnimation() && !element.closeAnimationCompleted)
24797   return false;
24798  return ASPx.GetElementVisibility(element) && ASPx.GetElementDisplay(element);
24799 },
24800 IsWindowVisible: function(window) {
24801  var index = (window != null) ? window.index : -1;
24802  return this.InternalIsWindowVisible(index);
24803 },
24804 IsVisible: function() {
24805  return this.InternalIsWindowVisible(-1);
24806 },
24807 UpdateWindowsStateCookie: function() {
24808  if(this.cookieName == "") return;
24809  ASPx.Cookie.DelCookie(this.cookieName);
24810  ASPx.Cookie.SetCookie(this.cookieName, this.GetWindowsState());
24811 },
24812 SetWindowElementZIndex: function(element, zIndex) {
24813  element.style.zIndex = zIndex;
24814  var iFrame = element.overflowElement;
24815  if(iFrame)
24816   iFrame.style.zIndex = zIndex - 1;
24817  var modalElement = element.modalElement;
24818  if(modalElement)
24819   modalElement.style.zIndex = zIndex - 1;
24820  this.UpdateWindowsStateCookie();
24821 },
24822 SetWindowContentHtmlCore: function(index, html, useAnimation) {
24823  var element = this.GetContentContainer(index);
24824  if(element != null) {
24825   ASPx.SetInnerHtml(element, html);
24826   this.AfterSetWindowContentHtml(index, element, useAnimation);
24827  }
24828 },
24829 SetContentHtml: function(html, useAnimation) {
24830  this.SetWindowContentHtml(null, html, useAnimation);
24831  if(html && this.accessibilityCompliant)
24832   ASPx.GetControlCollection().ControlsInitialized.AddHandler(this.OnControlsInitialized, this);
24833 },
24834 SetWindowContentHtml: function(window, html, useAnimation) {
24835  var index = (window != null) ? window.index : -1;
24836  this.SetWindowContentHtmlCore(index, html, useAnimation);
24837 },
24838 GetContentHtml: function() {
24839  return this.GetWindowContentHtml(null);
24840 },
24841 AfterSetWindowContentHtml: function(index, contentContainer, useAnimation) {
24842  if(useAnimation && typeof (ASPx.AnimationHelper) != "undefined")
24843   ASPx.AnimationHelper.fadeIn(contentContainer, function() { this.ResizeWindowIFrame(index); }.aspxBind(this));
24844  else
24845   this.ResizeWindowIFrame(index);
24846 },
24847 ResizeWindowIFrame: function(index) {
24848  if(!this.renderIFrameForPopupElements || !this.InternalIsWindowVisible(index)) return;
24849  var iFrame = this.GetWindowIFrame(index);
24850  if(iFrame) {
24851   var cell = this.GetWindowMainCell(this.GetWindowElement(index));
24852   ASPx.SetStyles(iFrame, { width: cell.offsetWidth, height: cell.offsetHeight });
24853  }
24854 },
24855 DoHideWindow: function(index, dontRaiseClosing, closeReason) {
24856  if(!this.InternalIsWindowVisible(index)) return;
24857  var cancel = !dontRaiseClosing && this.RaiseClosing(index, closeReason);
24858  if(!cancel) {
24859   if(this.HasCloseAnimation())
24860    this.DoHideWindowCoreWithAnimation(index, closeReason);
24861   else {
24862    this.DoHideWindowCore(index, closeReason);
24863    this.RaiseCloseUp(index, closeReason);
24864   }
24865  }
24866  return cancel;
24867 },
24868 HasAnyScrollBars: function(index) {
24869  var contentElement = this.GetWindowContentElement(index);
24870  var hasBothScrollBars = contentElement.style.overflow == "scroll" || contentElement.style.overflow == "auto";
24871  return hasBothScrollBars || contentElement.style.overflowX == "scroll" ||
24872   contentElement.style.overflowY == "scroll" || contentElement.style.overflowX == "auto" ||
24873   contentElement.style.overflowY == "auto";
24874 },
24875 DoHideWindowModalElement: function(element, closeReason) {
24876  var modalElement = element.modalElement;
24877  if(modalElement && ASPx.GetElementVisibility(modalElement, true)) {
24878   var closeModalElement = function () {
24879    ASPx.SetStyles(modalElement, { width: 1, height: 1, zIndex: defaultZIndexFromServer - 1 });
24880    ASPx.SetElementVisibility(modalElement, false);
24881    ASPx.SetElementDisplay(modalElement, false);
24882   };
24883   aspxGetPopupControlCollection().UnregisterVisibleModalElement(modalElement);
24884   if(this.GetHideBodyScrollWhenModal(this.GetWindowIndex(element))) {
24885    if(ASPx.Browser.WebKitFamily)
24886     aspxGetPopupControlCollection().LockScrollEvent();
24887    if(!ASPx.Browser.WebKitTouchUI)
24888     ASPx.PopupUtils.BodyScrollHelper.RestoreBodyScroll(element.id);
24889    if(ASPx.Browser.WebKitFamily)
24890     aspxGetPopupControlCollection().UnlockScrollEvent();
24891   }
24892   if(closeReason == ASPxClientPopupControlCloseReason.OuterMouseClick) {     
24893    ASPx.SetStyles(modalElement, { opacity: 0 });
24894    if(!modalElement.mouseHandler) {
24895     modalElement.mouseHandler = function() {
24896      ASPx.SetStyles(modalElement, { opacity: "" });
24897      closeModalElement();
24898      ASPx.Evt.DetachEventFromElement(modalElement, "mouseup", modalElement.mouseHandler);
24899      ASPx.Evt.DetachEventFromElement(modalElement, "mouseout", modalElement.mouseHandler);
24900     };
24901    }
24902    ASPx.Evt.AttachEventToElement(modalElement, "mouseup", modalElement.mouseHandler);
24903    ASPx.Evt.AttachEventToElement(modalElement, "mouseout", modalElement.mouseHandler);
24904   } else
24905    closeModalElement();
24906  }
24907 },
24908 IncreaseWindowRequestCount: function (index) {
24909  if(!this.windowRequestCount[index])
24910   this.windowRequestCount[index] = 1;
24911  else
24912   this.windowRequestCount[index]++;
24913 },
24914 DecreaseWindowRequestCount: function(index) {
24915  this.windowRequestCount[index]--;
24916 },
24917 IsLoadingContainerVisible: function() {
24918  return true;
24919 },
24920 ShouldHideExistingLoadingElements: function() {
24921  return false;
24922 },
24923 GetModalElementEndAnimationOpacity: function(index) {
24924  if(typeof (this.modalElementOpacity) == "undefined")
24925   this.modalElementOpacity = [];
24926  if(typeof (this.modalElementOpacity[index]) == "undefined")
24927   this.modalElementOpacity[index] = ASPx.GetElementOpacity(this.GetWindowModalElement(index));
24928  return this.modalElementOpacity[index];
24929 },
24930 SetModalElementVisibilityWithAnimation: function(modalElement, index) {
24931  if(this.AllowModalElementAnimation(index)) {
24932   var endOpacity = this.GetModalElementEndAnimationOpacity(index);
24933   ASPx.AnimationHelper.setOpacity(modalElement, 0);
24934   ASPx.SetElementVisibility(modalElement, true);
24935   ASPx.AnimationHelper.fadeTo(modalElement, { to: endOpacity });
24936  } else
24937   ASPx.SetElementVisibility(modalElement, true);
24938 },
24939 AllowModalElementAnimation: function(index) {
24940  return this.popupAnimationType === ASPxClientPopupControlBase.AnimationType.Fade;
24941 },
24942 SetVisibleWithAnimation: function(element, isMoving, index, horizontalPopupPosition, verticalPopupPosition) {
24943  var isAnimationNeed = this.IsAnimationAllowed() && !isMoving;
24944  if(isAnimationNeed && this.popupAnimationType !== "none") {
24945   switch(this.popupAnimationType) {
24946    case ASPxClientPopupControlBase.AnimationType.Slide:
24947     this.StartSlideAnimation(element, index, horizontalPopupPosition, verticalPopupPosition);
24948     break;
24949    case ASPxClientPopupControlBase.AnimationType.Fade:
24950     this.StartFadeAnimation(element, index);
24951     break;
24952    case ASPxClientPopupControlBase.AnimationType.Auto:
24953     this.StartAutoAnimation(element, index, horizontalPopupPosition, verticalPopupPosition);
24954     break;
24955   }
24956  }
24957  else
24958   ASPx.SetElementVisibility(element, true);
24959 },
24960 StartAutoAnimation: function(element, index, horizontalPopupPosition, verticalPopupPosition) {
24961  ASPx.SetElementVisibility(element, true);
24962 },
24963 StartFadeAnimation: function(element, index) {
24964  ASPx.AnimationHelper.setOpacity(element, 0);
24965  ASPx.SetElementVisibility(element, true);
24966  var callback = function() {
24967   this.OnAnimationStop(index);
24968  }.aspxBind(this);
24969  ASPx.AnimationHelper.fadeIn(element, callback, this.fadeAnimationDuration);
24970 },
24971 StartSlideAnimation: function (animationDivElement, index, horizontalPopupPosition, verticalPopupPosition) {
24972  var element = this.GetWindowMainCell(animationDivElement);
24973  var clientX = horizontalPopupPosition.position;
24974  var clientY = verticalPopupPosition.position;
24975  var args = "(\"" + this.name + "\", " + index + ")";
24976  var onAnimStopCallString = "ASPx.PCAStop" + args;
24977  this.InitDivPosForShowSlideAnimation(index, animationDivElement, clientX, clientY, onAnimStopCallString);
24978  var horizontalDirection = this.GetAnimationHorizontalDirection(index, horizontalPopupPosition);
24979  var verticalDirection = this.GetAnimationVerticalDirection(index, verticalPopupPosition);
24980  var offsetCoefficient = this.GetSlideOffsetCoefficient(index);
24981  var xPos = horizontalDirection * animationDivElement.offsetWidth * offsetCoefficient;
24982  var yPos = verticalDirection * animationDivElement.offsetHeight * offsetCoefficient;
24983  neddToForceAnimation = xPos === 0 && yPos === 0;
24984  if(neddToForceAnimation) 
24985   yPos = 1;
24986  ASPx.SetStyles(element, { left: xPos, top: yPos });
24987  ASPx.SetElementVisibility(animationDivElement, true);
24988  this.DoShowWindowIFrame(index, clientX, clientY, 0, 0);
24989  ASPx.PopupUtils.StartSlideAnimation(animationDivElement, element, this.GetWindowIFrame(index), this.GetSlideAnimationDuration(index));
24990 },
24991 GetSlideAnimationDuration: function(index) {
24992  return this.slideAnimationDuration;
24993 },
24994 GetSlideOffsetCoefficient: function(index) {
24995  return 1;
24996 },
24997 InitDivPosForShowSlideAnimation: function(index, animationDivElement, clientX, clientY, onAnimStopCallString) {
24998  ASPx.PopupUtils.InitAnimationDiv(animationDivElement, clientX, clientY, onAnimStopCallString, true);
24999 },
25000 InitDivPosForHideSlideAnimation: function(animationDivElement) {
25001 },
25002 StopShowAnimation: function(index) {
25003  if(this.popupAnimationType != "none") {
25004   var windowElement = this.GetWindowElement(index);
25005   if(this.popupAnimationType === 'slide')
25006    ASPx.PopupUtils.StopAnimation(windowElement, this.GetWindowMainCell(windowElement));
25007   else
25008    ASPx.AnimationHelper.cancelAnimation(windowElement);
25009  }
25010 },
25011 StopCloseAnimation: function(index) {
25012  var element = this.GetWindowElement(index);
25013  if(this.HasCloseAnimation() && !element.closeAnimationCompleted) {
25014   ASPx.AnimationHelper.cancelAnimation(element);
25015   this.DoHideWindowCore(index);
25016  }
25017 },
25018 IsFadeCloseAnimation: function(index) {
25019  return this.closeAnimationType === ASPxClientPopupControlBase.AnimationType.Fade;
25020 },
25021 PrepareElementAfterCloseAnimation: function(index, element) {
25022  element.closeAnimationCompleted = true;
25023  if(this.IsFadeCloseAnimation(index))
25024   ASPx.SetStyles(element, { opacity: 1 });
25025  else
25026   ASPx.SetStyles(this.GetWindowMainCell(element), {
25027    left: 0,
25028    top: 0
25029   });
25030 },
25031 DoHideWindowCoreWithAnimation: function(index, closeReason) {
25032  this.StopShowAnimation(index);
25033  var element = this.GetWindowElement(index);
25034  element.closeAnimationCompleted = false;
25035  if(this.AllowModalElementAnimation(index) && this.CanManipulateWithModalElement(index))
25036   ASPx.AnimationHelper.fadeOut(element.modalElement, null, this.fadeAnimationDuration);
25037  switch(this.closeAnimationType) {
25038   case ASPxClientPopupControlBase.AnimationType.Slide:
25039    this.DoHideWindowWithSlideAnimation(index, closeReason);
25040    break;
25041   case ASPxClientPopupControlBase.AnimationType.Fade:
25042    this.DoHideWindowWithFadeAnimation(index, element, closeReason);
25043    break;
25044   case ASPxClientPopupControlBase.AnimationType.Auto:
25045    this.DoHideWindowWithAutoAnimation(index, element, closeReason);
25046    break;
25047  }
25048 },
25049 DoHideWindowWithAutoAnimation: function(index, element, closeReason) {
25050 },
25051 DoHideWindowWithFadeAnimation: function(index, element, closeReason) {
25052  ASPx.AnimationHelper.fadeOut(element, function() {
25053   this.DoHideWindowCore(index);
25054   this.RaiseCloseUp(index, closeReason);
25055  }.aspxBind(this), this.fadeAnimationDuration);
25056 },
25057 DoHideWindowWithSlideAnimation: function(index, closeReason) {
25058  var element = this.GetWindowElement(index);
25059  var horizontalPopupPosition = this.GetSlideAnimationPosition(element, true);
25060  var verticalPopupPosition = this.GetSlideAnimationPosition(element, false);
25061  var horizontalDirection = this.GetAnimationHorizontalDirection(index, horizontalPopupPosition);
25062  var verticalDirection = this.GetAnimationVerticalDirection(index, verticalPopupPosition);
25063  this.InitDivPosForHideSlideAnimation(element);
25064  var offsetCoefficient = this.GetSlideOffsetCoefficient(index);
25065  ASPx.AnimationHelper.createMultipleAnimationTransition(this.GetWindowMainCell(element), {
25066   duration: this.GetSlideAnimationDuration(index),
25067   onComplete: function(element) {
25068    this.DoHideWindowCore(index);
25069    this.RaiseCloseUp(index, closeReason);
25070   }.aspxBind(this)
25071  }).Start({
25072   left: { to: horizontalDirection * element.offsetWidth * offsetCoefficient, unit: "px" },
25073   top: { to: verticalDirection * element.offsetHeight * offsetCoefficient, unit: "px" }
25074  });
25075 },
25076 GetSlideAnimationPosition: function(element, isX) {
25077  return this.GetClientPopupPos(element, null, ASPx.InvalidPosition, isX, true);
25078 },
25079 GetAnimationHorizontalDirection: function(index, horizontalPopupPosition) {
25080  return ASPx.PopupUtils.GetAnimationHorizontalDirection(horizontalPopupPosition, this.popupHorizontalAlign, this.popupVerticalAlign, this.rtl);
25081 },
25082 GetAnimationVerticalDirection: function(index, verticalPopupPosition) {
25083  return ASPx.PopupUtils.GetAnimationVerticalDirection(verticalPopupPosition, this.popupHorizontalAlign, this.popupVerticalAlign);
25084 },
25085 OnAnimationStop: function(index) {
25086  this.OnWindowShown(index);
25087 },
25088 PerformCallback: function(parameter, onSuccess) {
25089  this.PerformWindowCallback(null, parameter, onSuccess);
25090 },
25091 PerformWindowCallback: function(window, parameter, onSuccess) {
25092  parameter = ASPx.IsExists(parameter) ? parameter.toString() : "";
25093  var index = (window != null) ? window.index : -1;
25094  if(!this.InWindowCallback(index)) {
25095   var windowCallbackArguments = index + ";" + parameter;
25096   this.CreateWindowCallback(index, windowCallbackArguments, onSuccess);
25097  }
25098 },
25099 InWindowCallback: function(windowIndex) {
25100  return this.windowRequestCount[windowIndex] > 0;
25101 },
25102 CreateWindowCallback: function(windowIndex, argument, handler) {
25103  this.IncreaseWindowRequestCount(windowIndex);
25104  var element = this.GetWindowElement(windowIndex);
25105  if(this.contentLoadingMode != LoadContentViaCallback.OnPageLoad || !element.loading || this.GetShowOnPageLoad(windowIndex))
25106   this.ShowWindowLoadingElements(windowIndex);
25107  this.CreateCallback(argument, null, handler);
25108 },
25109 OnCallback: function(result) {
25110  this.OnCallbackInternal(result.html, result.index, false);
25111 },
25112 OnCallbackError: function(result, data) {
25113  this.OnCallbackInternal(result, ASPx.IsExists(data) ? data : -1, true);
25114 },
25115 OnCallbackErrorAfterUserHandle: function(result, data) {
25116  this.DecreaseWindowRequestCount(data);
25117 },
25118 OnCallbackInternal: function(html, windowIndex, isError) {
25119  var element = this.GetWindowElement(windowIndex);
25120  element.loaded = !isError;
25121  element.loading = false;
25122  this.DecreaseWindowRequestCount(windowIndex);
25123  this.HideWindowLoadingPanel(windowIndex);
25124  this.SetWindowContentHtmlCore(windowIndex, html);
25125  this.UpdatePositionAfterCallback(windowIndex);
25126  this.savedCallbackWindowIndex = windowIndex;
25127  this.UpdateWindowsStateCookie();
25128 },
25129 RaiseCallbackError: function(message) {
25130  var result = ASPxClientControl.prototype.RaiseCallbackError.call(this, message);
25131  if(result.isHandled)
25132   this.HideAllLoadingPanels();
25133  return result;
25134 },
25135 StartWindowBeginCallbackAnimation: function(windowIndex) {
25136  this.callbackAnimationProcessings[windowIndex] = true;
25137  this.isCallbackFinishedStates[windowIndex] = false;
25138  ASPx.AnimationHelper.fadeOut(this.GetWindowContentElement(windowIndex), function() { this.FinishWindowBeginCallbackAnimation(windowIndex); }.aspxBind(this));
25139 },
25140 FinishWindowBeginCallbackAnimation: function(windowIndex) {
25141  this.callbackAnimationProcessings[windowIndex] = false;
25142  if(!this.isCallbackFinishedStates[windowIndex])
25143   this.ShowWindowLoadingElementsInternal(windowIndex);
25144  else
25145   this.DoCallback(this.savedCallbackResults[windowIndex]);
25146 },
25147 CheckBeginCallbackAnimationInProgress: function(callbackResult) {
25148  var result;
25149  try {
25150   result = this.EvalCallbackResult(callbackResult).result;
25151  } catch(e) {
25152   return false;
25153  }
25154  var windowIndex = result.index;
25155  if(this.enableCallbackAnimation && this.callbackAnimationProcessings[windowIndex]) {
25156   this.savedCallbackResults[windowIndex] = callbackResult;
25157   this.isCallbackFinishedStates[windowIndex] = true;
25158   return true;
25159  }
25160  return false;
25161 },
25162 StartWindowEndCallbackAnimation: function(windowIndex) {
25163  this.callbackAnimationProcessings[windowIndex] = true;
25164  ASPx.AnimationHelper.fadeIn(this.GetWindowContentElement(windowIndex), function() { this.FinishWindowEndCallbackAnimation(windowIndex); }.aspxBind(this));
25165 },
25166 FinishWindowEndCallbackAnimation: function(windowIndex) {
25167  this.DoEndCallback();
25168  this.callbackAnimationProcessings[windowIndex] = false;
25169 },
25170 CheckEndCallbackAnimationNeeded: function() {
25171  var windowIndex = this.savedCallbackWindowIndex;
25172  this.savedCallbackWindowIndex = null;
25173  if(windowIndex !== null && !this.callbackAnimationProcessings[windowIndex]) {
25174   this.StartWindowEndCallbackAnimation(windowIndex);
25175   return true;
25176  }
25177  return false;
25178 },
25179 EnsureContent: function(windowIndex, isInit) {
25180  var element = this.GetWindowElement(windowIndex);
25181  if(element && !element.loaded && !element.loading) {
25182   var shouldLoad = this.contentLoadingMode == LoadContentViaCallback.OnPageLoad || this.contentLoadingMode == LoadContentViaCallback.OnFirstShow && !isInit;
25183   if(shouldLoad) {
25184    element.loading = true;
25185    this.CreateWindowCallback(windowIndex, windowIndex);
25186   } else if(this.contentLoadingMode == LoadContentViaCallback.Default)
25187    element.loaded = true;
25188  }
25189 },
25190 HideAllLoadingPanels: function() {
25191  if(this.HasDefaultWindow())
25192   this.HideWindowLoadingPanel(-1);
25193  for(var i = 0; i < this.GetWindowCount() ; i++)
25194   this.HideWindowLoadingPanel(i);
25195 },
25196 HideWindowLoadingPanel: function(windowIndex) {
25197  this.ClearWindowLoadingPanelTimer(windowIndex);
25198  if(this.loadingDivs[windowIndex]) {
25199   ASPx.RemoveElement(this.loadingDivs[windowIndex]);
25200   this.loadingDivs[windowIndex] = null;
25201  }
25202  if(this.loadingPanels[windowIndex]) {
25203   ASPx.RemoveElement(this.loadingPanels[windowIndex]);
25204   this.loadingPanels[windowIndex] = null;
25205  }
25206 },
25207 ShowWindowLoadingElements: function(windowIndex) {
25208  if(this.lpTimers[windowIndex] && this.lpTimers[windowIndex] > -1) return;
25209  if(this.enableCallbackAnimation)
25210   this.StartWindowBeginCallbackAnimation(windowIndex);
25211  else
25212   this.ShowWindowLoadingElementsInternal(windowIndex);
25213 },
25214 ShowWindowLoadingPanelOnTimer: function(windowIndex) {
25215  this.ClearWindowLoadingPanelTimer(windowIndex);
25216  this.ShowWindowLoadingPanel(windowIndex);
25217 },
25218 ClearWindowLoadingPanelTimer: function(windowIndex) {
25219  this.lpTimers[windowIndex] = ASPx.Timer.ClearTimer(this.lpTimers[windowIndex]);
25220 },
25221 ShowWindowLoadingElementsInternal: function(windowIndex) {
25222  if(this.lpDelay > 1 && !this.enableCallbackAnimation) {
25223   var _this = this;
25224   this.lpTimers[windowIndex] = window.setTimeout(function() { _this.ShowWindowLoadingPanelOnTimer(windowIndex); }, this.lpDelay);
25225  }
25226  else
25227   this.ShowWindowLoadingPanel(windowIndex);
25228 },
25229 ShowWindowLoadingPanel: function(windowIndex) {
25230  if(!this.IsExistLoadingPanel())
25231   return;
25232  if(!this.loadingPanels[windowIndex] && this.InternalIsWindowVisible(windowIndex)) {
25233   var parentElement = this.GetWindowElement(windowIndex).parentNode;
25234   var offsetElement = this.GetLoadingPanelOffsetElement(windowIndex);
25235   this.loadingDivs[windowIndex] = this.CreateLoadingDiv(parentElement, offsetElement, windowIndex);
25236   this.loadingPanels[windowIndex] = this.CreateLoadingPanelWithAbsolutePosition(parentElement, offsetElement, windowIndex);
25237  }
25238 },
25239 GetLoadingPanelOffsetElement: function(windowIndex) {
25240  return this.GetWindowContentWrapperElement(windowIndex);
25241 },
25242 IsExistLoadingPanel: function() {
25243  return !!this.GetLoadingDiv();
25244 },
25245 LockAnimation: function() {
25246  this.animationLockCount++;
25247 },
25248 UnlockAnimation: function() {
25249  this.animationLockCount--;
25250 },
25251 IsAnimationLocked: function() {
25252  return this.animationLockCount > 0;
25253 },
25254 IsAnimationAllowed: function() {
25255  return this.enableAnimation && !this.IsAnimationLocked();
25256 },
25257 SetWindowSizeByIndexCore: function(index, width, height, isWindowCollapsed) {
25258  this.SetClientWindowSizeLite(index, width, height, isWindowCollapsed);
25259  var iFrame = this.GetWindowIFrame(index);
25260  if(iFrame && !isWindowCollapsed) {
25261   var winElememnt = this.GetWindowElement(index);
25262   var realWidth = winElememnt.offsetWidth;
25263   var realHeight = winElememnt.offsetHeight;
25264   ASPx.SetStyles(iFrame, { width: realWidth, height: realHeight });
25265  }
25266  this.UpdateWindowsStateCookie();
25267 },
25268 SetWindowSizeByIndex: function(index, width, height) {
25269  var minWidth = this.GetWindowMinWidth(index);
25270  var minHeight = this.GetWindowMinHeight(index);
25271  var maxWidth = this.GetWindowMaxWidth(index);
25272  var maxHeight = this.GetWindowMaxHeight(index);
25273  if(minWidth)
25274   width = Math.max(width, minWidth);
25275  if(minHeight)
25276   height = Math.max(height, minHeight);
25277  if(maxWidth)
25278   width = Math.min(width, maxWidth);
25279  if(maxHeight)
25280   height = Math.min(height, maxHeight);
25281  var isWindowMaximized = this.GetIsMaximized(index);
25282  var isWindowCollapsed = this.GetIsCollapsed(index);
25283  var isWindowMaximizedAndCollapsed = (isWindowMaximized && isWindowCollapsed);
25284  if(this.SizeCanBeSet(index, isWindowMaximizedAndCollapsed)) {
25285   if(!this.CollapseExecuting() && !this.MaximizationExecuting() && !this.ResizingForMaxWindowLocked()) {
25286    this.SetWindowCachedSize(index, width, height);
25287    this.SetIsResized(index, true);
25288   }
25289   if(isWindowCollapsed && !this.MaximizationExecuting() && !this.ResizingForMaxWindowLocked()) {
25290    this.SetWindowCachedSize(index, width, height);
25291    this.UpdateRestoredWindowSize(index, width, height);
25292    height = 0;
25293   }
25294   if(isWindowMaximized && !this.CollapseExecuting() && !this.ResizingForMaxWindowLocked()) {
25295    this.SetWindowCachedSize(index, width, height);
25296    this.UpdateRestoredWindowSize(index, width, height);
25297   } else {
25298    this.SetWindowSizeByIndexCore(index, width, height, isWindowCollapsed);
25299   }
25300  } else
25301   this.SetWindowCachedSize(index, width, height);
25302 },
25303 SizeCanBeSet: function(index, isWindowMaximizedAndCollapsed) {
25304  return this.InternalIsWindowDisplayed(index) && this.IsWindowElementsIDAssigned(index) && (!isWindowMaximizedAndCollapsed || this.ResizingForMaxWindowLocked());
25305 },
25306 RestoreWindowSizeFromCache: function(index) {
25307  var cachedSize = this.GetWindowCachedSize(index);
25308  if(cachedSize != null) {
25309   if(cachedSize.width !== this.GetClientWindowWidth(index, true, true) ||
25310      cachedSize.height !== this.GetClientWindowHeight(index, true, true))
25311    this.SetWindowSizeByIndex(index, cachedSize.width, cachedSize.height);
25312   this.ResetWindowCachedSize(index);
25313  }
25314 },
25315 CollapseExecuting: function() {
25316  return false;
25317 },
25318 MaximizationExecuting: function() {
25319  return false;
25320 },
25321 ResizingForMaxWindowLocked: function() {
25322  return false;
25323 },
25324 IsResizeAllowed: function(index) {
25325  return this.allowResize;
25326 },
25327 GetWindowDimensionByIndex: function(index, isWidth, forceFromCache) {
25328  var cachedSize = this.GetWindowCachedSize(index);
25329  var dimensionValue = null;
25330  if(forceFromCache == undefined && !this.GetWindowElement(index))
25331   forceFromCache = true;
25332  if(cachedSize && forceFromCache)
25333   dimensionValue = isWidth ? cachedSize.width : cachedSize.height;
25334  if(dimensionValue)
25335   return dimensionValue;
25336  else {
25337   var element = this.GetWindowElement(index);
25338   var sizeFromDOM = 0;
25339   if(this.GetIsCollapsed(index)) {
25340    var headerCell = this.GetWindowHeaderElement(index);
25341    sizeFromDOM = isWidth ? headerCell.offsetWidth : headerCell.offsetHeight;
25342   }
25343   else {
25344    var mainCell = this.GetWindowMainCell(element);
25345    sizeFromDOM = isWidth ? mainCell.offsetWidth : mainCell.offsetHeight;
25346   }
25347   if(sizeFromDOM === 0 && cachedSize)
25348    sizeFromDOM = isWidth ? cachedSize.width : cachedSize.height;
25349   return sizeFromDOM;
25350  }
25351 },
25352 SetWindowSize: function(window, width, height) {
25353  var index = (window != null) ? window.index : -1;
25354  this.SetWindowSizeByIndex(index, width, height);
25355 },
25356 SetSize: function(width, height) {
25357  this.SetWindowSize(null, width, height);
25358 },
25359 SetWidth: function(width) {
25360  var height = this.GetHeight();
25361  this.SetSize(width, height);
25362 },
25363 SetHeight: function(height) {
25364  var width = this.GetWidth();
25365  this.SetSize(width, height);
25366 },
25367 GetHeight: function() {
25368  return this.GetWindowDimensionByIndex(-1, false, false);
25369 },
25370 GetWidth: function() {
25371  return this.GetWindowDimensionByIndex(-1, true, false);
25372 },
25373 CanBeClosedByClickOnElement: function(index, srcElement, posX, id) {
25374  return srcElement === null || ASPx.GetParentById(srcElement, id) === null;
25375 },
25376 OnMouseDown: function(evt, index, isDraggingAllowed, pointOnScrollBar) {
25377  if(ASPx.Evt.IsLeftButtonPressed(evt)) {
25378   if((this.IsResizeAllowed(index) || isDraggingAllowed) && !this.prohibitClearSelectionOnMouseDown) 
25379    ASPx.Selection.Clear();
25380   var isResizing = this.ProcessResizeOnMouseDown(evt, index);
25381   var clickedOnScroll = pointOnScrollBar && this.GetEnableContentScrolling(index);
25382   if(isDraggingAllowed && !isResizing && !clickedOnScroll && !this.GetIsPinned(index) && !this.GetIsMaximized(index) && !ASPx.Ident.IsFocusableElementRegardlessTabIndex(evt.target))
25383    this.OnDragStart(evt, index);
25384  }
25385 },
25386 OnMouseMove: function(evt, index) {
25387  if(this.allowResize && !this.GetIsCollapsed(index) && !this.GetIsMaximized(index))
25388   this.CreateResizeCursorInfo(evt, index);
25389 },
25390 CreateResizeCursorInfo: function(evt, index) {
25391  var element = this.GetWindowElement(index);
25392  var mainCell = this.GetWindowMainCell(element);
25393  var clientWindow = this.GetWindowClientTable(index);
25394  var headerElement = this.GetWindowHeaderElement(index);
25395  var left = ASPx.GetAbsoluteX(mainCell);
25396  var top = ASPx.GetAbsoluteY(mainCell);
25397  var x = ASPx.Evt.GetEventX(evt);
25398  var y = ASPx.Evt.GetEventY(evt);
25399  var mainCellWidth = mainCell.offsetWidth;
25400  var mainCellHeight = mainCell.offsetHeight;
25401  var leftOffset = Math.abs(x - left);
25402  var rightOffset = Math.abs(x - left - mainCellWidth);
25403  var topOffset = Math.abs(y - top);
25404  var bottomOffset = Math.abs(y - top - mainCellHeight);
25405  var cursorInfo = this.CreateResizeBorderCursorInfo(index, leftOffset, rightOffset, topOffset, bottomOffset);
25406  var grip = this.GetWindowSizeGripElement(index);
25407  if(grip) {
25408   var gripCursorInfo = this.CreateGripCursorInfo(index, mainCell, grip, leftOffset, rightOffset, bottomOffset);
25409   if(gripCursorInfo)
25410    cursorInfo = gripCursorInfo;
25411  }
25412  this.UpdateResizeCursor(index, clientWindow, cursorInfo.verticalDirection, cursorInfo.horizontalDirection);
25413  this.UpdateResizeCursor(index, mainCell, cursorInfo.verticalDirection, cursorInfo.horizontalDirection);
25414  if(headerElement)
25415   this.UpdateResizeCursor(index, headerElement, cursorInfo.verticalDirection, cursorInfo.horizontalDirection);
25416  return cursorInfo;
25417 },
25418 UpdateResizeCursor: function(index, element, verticalDirection, horizontalDirection) {
25419  var cursor = verticalDirection + horizontalDirection;
25420  if(cursor == "")
25421   this.HideTemporaryCursor(element);
25422  else {
25423   cursor += "-resize";
25424   this.ShowTemporaryCursor(element, cursor);
25425  }
25426 },
25427 CreateGripCursorInfo: function(index, mainCell, grip, leftOffset, rightOffset, bottomOffset) {
25428  var gripWidth = this.rtl
25429   ? ASPx.GetAbsoluteX(grip) - ASPx.GetAbsoluteX(mainCell) + grip.offsetWidth
25430   : mainCell.offsetWidth - (ASPx.GetAbsoluteX(grip) - ASPx.GetAbsoluteX(mainCell));
25431  var gripHeight = mainCell.offsetHeight - (ASPx.GetAbsoluteY(grip) - ASPx.GetAbsoluteY(mainCell));
25432  if(gripHeight > bottomOffset) {
25433   if(this.rtl && gripWidth > leftOffset)
25434    return new PCResizeCursorInfo("w", "s", leftOffset, bottomOffset);
25435   if(gripWidth > rightOffset)
25436    return new PCResizeCursorInfo("e", "s", rightOffset, bottomOffset);
25437  }
25438  return null;
25439 },
25440 CreateResizeBorderCursorInfo: function(index, leftOffset, rightOffset, topOffset, bottomOffset) {
25441  var ResizeBorderSize = this.ResizeBorderSize;
25442  var verticalDirection = this.GetResizeVerticalCourse(ResizeBorderSize, topOffset, bottomOffset);
25443  ResizeBorderSize = verticalDirection != "" ? this.ResizeCornerBorderSize : this.ResizeBorderSize;
25444  var horizontalDirection = this.GetResizeHorizontalCourse(ResizeBorderSize, leftOffset, rightOffset);
25445  if(verticalDirection == "" && horizontalDirection != "")
25446   verticalDirection = this.GetResizeVerticalCourse(this.ResizeCornerBorderSize, topOffset, bottomOffset);
25447  var horizontalOffset = leftOffset < rightOffset ? leftOffset : rightOffset;
25448  var verticalOffset = topOffset < bottomOffset ? topOffset : bottomOffset;
25449  return new PCResizeCursorInfo(horizontalDirection, verticalDirection, horizontalOffset, verticalOffset);
25450 },
25451 GetResizeVerticalCourse: function(ResizeBorderSize, topOffset, bottomOffset) {
25452  if(ResizeBorderSize > topOffset) return "n";
25453  if(ResizeBorderSize > bottomOffset) return "s";
25454  return "";
25455 },
25456 GetResizeHorizontalCourse: function(ResizeBorderSize, leftOffset, rightOffset) {
25457  if(ResizeBorderSize > leftOffset) return "w";
25458  if(ResizeBorderSize > rightOffset) return "e";
25459  return "";
25460 },
25461 ProcessResizeOnMouseDown: function(evt, index) {
25462  var isResizing = false;
25463  if(this.IsResizeAllowed(index) && !this.GetIsCollapsed(index) && !this.GetIsMaximized(index)) {
25464   var eventSourceControl = ASPx.Evt.GetEventSource(evt);
25465   var eventFromPopupContainer = ASPx.ElementHasCssClass(eventSourceControl, PopupControlCssClasse
25465s.ContentCssClassName) ||
25466    !ASPx.GetParentByClassName(eventSourceControl, PopupControlCssClasses.ContentCssClassName) ||
25467    this.eventFromOwnPopupContent(eventSourceControl);
25468   if(eventFromPopupContainer && getComputedStyle(evt.target).cursor !== "pointer")
25469    isResizing = this.OnResizeStart(evt, index);
25470  }
25471  if(isResizing && ASPx.Browser.WebKitTouchUI)
25472   aspxGetPopupControlCollection().OverStop();
25473  return isResizing;
25474 },
25475 eventFromOwnPopupContent: function(element) {
25476  while(element != null) {
25477   if(element.tagName == "BODY")
25478    return false;
25479   if(element.style.position == "absolute") {
25480    var windowIndex = this.GetWindowIndex(element);
25481    var isPopupWindow = !isNaN(windowIndex);
25482    if(isPopupWindow) {
25483     if(this.GetWindowElementId(windowIndex) == element.id)
25484      return true;
25485     return false;
25486    } else {
25487     var elementIsOtherPopup = element.style.zIndex >= this.GetPopupControlZIndex(); 
25488     if(elementIsOtherPopup)
25489      return false;
25490    }
25491   }
25492   element = element.parentNode;
25493  }
25494  return false;
25495 },
25496 OnResizeStart: function(evt, index) {
25497  if(!aspxGetPopupControlCollection().IsResizeInint()) {
25498   var cursor = this.CreateResizeCursorInfo(evt, index);
25499   if(cursor.course != "") {
25500    aspxGetPopupControlCollection().setIframesMouseMoveEnabled(false);
25501    this.EnsureWindowCoverDiv(index);
25502    this.SetIsResized(index, true);
25503    var resizePanel = this.CreateResizePanel(index);
25504    this.UpdateResizeCursor(index, resizePanel, cursor.verticalDirection, cursor.horizontalDirection);
25505    aspxGetPopupControlCollection().InitResizeObject(this, index, cursor, resizePanel);
25506    this.OnResize(evt, index, cursor, resizePanel);
25507   }
25508  }
25509  return aspxGetPopupControlCollection().IsResizeInint();
25510 },
25511 OnResizeStop: function(evt, index, cursor, resizePanel) {
25512  if(this.IsResizeAllowed(index)) {
25513   aspxGetPopupControlCollection().setIframesMouseMoveEnabled(true);
25514   this.RemoveWindowCoverDiv();
25515   var windowElement;
25516   if(!this.isLiveResizingMode) {
25517    windowElement = this.GetWindowElement(index);
25518    ASPx.GetControlCollection().CollapseControls(windowElement);
25519    this.OnResizeWindow(index, cursor, resizePanel);
25520   }
25521   this.CreateResizeCursorInfo(evt, index);
25522   this.UpdateWindowsStateCookie();
25523   this.RaiseResize(index);
25524   if(!this.isLiveResizingMode)
25525    ASPx.GetControlCollection().AdjustControls(windowElement, true);
25526  }
25527  this.ResetResizeSessionCache();
25528 },
25529 OnResizeWindow: function(index, cursor, resizePanel) {
25530  var windowElement = this.GetWindowElement(index);
25531  var resizePanelDimensions = this.GetResizePanelDimensions();
25532  var left = resizePanelDimensions.left;
25533  var top = resizePanelDimensions.top;
25534  this.SetClientWindowSizeLite(index, resizePanelDimensions.offsetWidth, resizePanelDimensions.offsetHeight);
25535  if(this.fixedBottom)
25536   top = this.fixedBottom - windowElement.offsetHeight;
25537  if(this.fixedRight)
25538   left = this.fixedRight - windowElement.offsetWidth;
25539  this.fixedBottom = null;
25540  this.fixedRight = null;
25541  if(cursor.verticalDirection === "n")
25542   this.ChangePosOnResizeWindow(top, windowElement, false);
25543  if(cursor.horizontalDirection === "w")
25544   this.ChangePosOnResizeWindow(left, windowElement, true);
25545  if(this.InternalIsWindowVisible(index)) 
25546   this.DoShowWindowIFrame(index, left, top, ASPx.InvalidDimension, ASPx.InvalidDimension);
25547 },
25548 ChangePosOnResizeWindow: function(pos, windowElement, isX) {
25549  if(ASPx.Browser.IE && ASPx.Browser.Version >= 10)
25550   pos = Math.round(pos);
25551  windowElement.style[isX ? "left" : "top"] = pos + "px";
25552 },
25553 SetClientWindowSizeLite: function(index, width, height, isWindowCollapsed) {
25554  this.RaiseBeforeResizing(index);
25555  this.SetClientWindowSizeCoreLite(index, width, height, isWindowCollapsed);
25556  if(!this.IsRaiseAfterResizingLocked())
25557   this.RaiseAfterResizing(index);
25558 },
25559 SetClientWindowSizeCoreLite: function(index, width, height, isWindowCollapsed) {
25560  var contentUrl = this.GetWindowContentIFrameUrl(index);
25561  var needToHideContent = !contentUrl;
25562  var element = this.GetWindowElement(index);
25563  var contentWrapper = this.GetWindowContentWrapperElement(index);
25564  var contentElement = this.GetWindowContentElement(index);
25565  var scrollTop = null,
25566   scrollLeft = null;
25567  if(ASPx.Browser.IE && this.GetEnableContentScrolling(index)) {
25568   scrollTop = contentElement.scrollTop;
25569   scrollLeft = contentElement.scrollLeft;
25570  }
25571  var contentIframeElement = this.GetWindowContentIFrameElement(index);
25572  var iframeHeightCorrectionOnFirstShow = height > 0;
25573  if(contentIframeElement && (this.GetWindowIsShown(index) || iframeHeightCorrectionOnFirstShow))
25574   contentIframeElement.style.height = "0px";
25575  contentWrapper.style.height = "";
25576  contentWrapper.style.width = "";
25577  contentElement.style.height = "";
25578  contentElement.style.width = "";
25579  var hasAnyScrollBars = this.HasAnyScrollBars(index);
25580  var expectedHeight = (!ASPx.IsExists(height) && hasAnyScrollBars) ? this.GetExpectedHeight(index) : null;
25581  var contentElementChildrenScroll = null,
25582   contentElementChildren = null;
25583  if(needToHideContent) {
25584   if(ASPx.Browser.IE) {
25585    var contentElementChildren = this.GetContentElementChildren(index, contentElement),
25586     contentElementChildrenScroll = this.GetContentElementChildrenScroll(index, contentElementChildren);
25587   }
25588   contentElement.style.display = "none";
25589  }
25590  var elementsDisplayValue = this.GetWindowElementDisplayValue(hasAnyScrollBars, height);
25591  element.style.display = elementsDisplayValue;
25592  if(!this.GetIsCollapsed(index))
25593   contentWrapper.style.display = elementsDisplayValue;
25594  if(ASPx.IsExists(width)) {
25595   var actualWidth = width - this.GetElementBordersAndPaddings(index, element, true);
25596   if(actualWidth <= 0)
25597    actualWidth = ASPx.Browser.WebKitFamily ? 1 : 0; 
25598   element.style.width = actualWidth + "px";
25599  }
25600  var actualHeight;
25601  if(ASPx.IsExists(height)) {
25602   actualHeight = height - this.GetElementBordersAndPaddings(index, element, false);
25603   if(actualHeight < 0)
25604    actualHeight = 0;
25605   element.style.height = actualHeight + "px";
25606  } else {
25607   if(ASPx.IsExists(expectedHeight)) {
25608    actualHeight = expectedHeight;
25609    element.style.height = actualHeight + "px";
25610   }
25611  }
25612  this.CorrectWindowSizeGripPositionLite(index);
25613  this.CorrectWindowHeaderText(index);
25614  this.SetContentWrapperHeightLite(index, actualHeight, element, contentWrapper);
25615  var correctContentElementSize = hasAnyScrollBars || contentElement.style.overflow == "hidden" || contentElement.style.overflowX == "hidden" || contentElement.style.overflowY == "hidden";
25616  if((correctContentElementSize || contentUrl) && (height || expectedHeight)) {
25617   if(contentElement !== contentWrapper) {
25618    var contentHeight = ASPx.GetClearClientHeight(contentWrapper);
25619    if(contentHeight < 0)
25620     contentHeight = 0;
25621    contentElement.style.height = contentHeight + "px";
25622   }
25623  }
25624  if(correctContentElementSize && width && contentElement !== contentWrapper)
25625   contentElement.style.width = ASPx.GetClearClientWidth(contentWrapper) + "px";
25626  contentElement.style.display = this.getContentElementDisplay(correctContentElementSize, contentUrl);
25627  if(ASPx.IsExists(contentElementChildrenScroll) && contentElementChildrenScroll.length > 0) {
25628   for(var i = 0; i < contentElementChildrenScroll.length; i++) {
25629    var childScroll = contentElementChildrenScroll[i],
25630     childIndex = childScroll[0],
25631     childScrollLeft = childScroll[1],
25632     childScrollTop = childScroll[2];
25633    if(!!childScrollLeft)
25634     contentElementChildren[childIndex].scrollLeft = childScrollLeft;
25635    if(!!childScrollTop)
25636     contentElementChildren[childIndex].scrollTop = childScrollTop;
25637   }
25638  }
25639  if(ASPx.Browser.IE && this.GetEnableContentScrolling(index)) {
25640   contentElement.scrollTop = scrollTop;
25641   contentElement.scrollLeft = scrollLeft;
25642  }
25643  if(contentIframeElement)
25644   contentIframeElement.style.height = "100%";
25645  this.SetWindowWidth(index, width);
25646  this.SetWindowHeight(index, height);
25647  if(isWindowCollapsed)
25648   this.ResetWindowHeight(index);
25649 },
25650 GetExpectedHeight: function(index) {
25651  var height = this.GetWindowHeightInternal(index) || 0;
25652  height = Math.max(height, this.GetWindowMinHeight(index));
25653  if(this.HasAnyScrollBars(index)) {
25654   var windowHeight = this.GetWindowContentElement(index).offsetHeight + this.GetWindowHeightWithoutContent(index);
25655   height = Math.max(height, windowHeight);
25656  }
25657  var maxHeight = this.GetWindowMaxHeight(index);
25658  if(maxHeight)
25659   height = Math.min(height, maxHeight);
25660  return height;
25661 },
25662 IsRaiseAfterResizingLocked: function() {
25663  return false;
25664 },
25665 CreateResizePanel: function(index) {
25666  var element = this.GetWindowElement(index);
25667  var resizePanel = document.createElement("DIV");
25668  element.parentNode.appendChild(resizePanel);
25669  resizePanel.style.overflow = "hidden";
25670  resizePanel.style.position = "absolute";
25671  resizePanel.style.zIndex = this.GetPopupControlZIndex() + aspxGetPopupControlCollection().visiblePopupWindowIds.length * 2 + 2;
25672  if(!this.isLiveResizingMode)
25673   resizePanel.style.border = "black 1px dotted";
25674  return resizePanel;
25675 },
25676 OnResize: function(evt, index, cursor, resizePanel) {
25677  this.OnResizePanelLite(evt, index, cursor, resizePanel);
25678  if(this.isLiveResizingMode)
25679   this.OnResizeWindow(index, cursor, resizePanel);
25680  ASPx.Selection.Clear();
25681  if(ASPx.Browser.WebKitTouchUI)
25682   ASPx.Evt.PreventEvent(evt);
25683  if(this.GetIsPinned(index))
25684   this.HoldPosition(index, true, resizePanel);
25685 },
25686 OnResizePanelLite: function(evt, index, cursor, resizePanel) {
25687  var x = ASPx.Evt.GetEventX(evt);
25688  var y = ASPx.Evt.GetEventY(evt);
25689  var element = this.GetWindowElement(index);
25690  if(ASPx.Browser.IE && ASPx.Browser.Version >= 10) {
25691   x = Math.round(x);
25692   y = Math.round(y);
25693  }
25694  var elementTop = ASPx.GetAbsoluteY(element);
25695  var elementLeft = ASPx.GetAbsoluteX(element);
25696  var newLeft = ASPx.PxToInt(element.style.left);
25697  var newTop = ASPx.PxToInt(element.style.top);
25698  var newWidth = element.offsetWidth;
25699  var newHeight = element.offsetHeight;
25700  if(cursor.verticalDirection == "n") {
25701   if(!this.fixedBottom)
25702    this.fixedBottom = newTop + newHeight;
25703   newHeight += elementTop - y + cursor.verticalOffset;
25704   newTop = ASPx.PrepareClientPosForElement(y - cursor.verticalOffset, element, false);
25705  }
25706  if(cursor.verticalDirection == "s") {
25707   newHeight = y - elementTop + cursor.verticalOffset;
25708   this.fixedBottom = null;
25709  }
25710  if(cursor.horizontalDirection == "w") {
25711   if(!this.fixedRight)
25712    this.fixedRight = newLeft + newWidth;
25713   newWidth += elementLeft - x + cursor.horizontalOffset;
25714   newLeft = ASPx.PrepareClientPosForElement(x - cursor.horizontalOffset, element, true);
25715  }
25716  if(cursor.horizontalDirection == "e") {
25717   newWidth = x - elementLeft + cursor.horizontalOffset;
25718   this.fixedRight = null;
25719  }
25720  if(newWidth > 0 && newHeight > 0) {
25721   var minWidth = this.GetWindowMinWidth(index);
25722   var maxWidth = this.GetWindowMaxWidth(index);
25723   if(minWidth && newWidth < minWidth)
25724    newWidth = minWidth;
25725   if(maxWidth && newWidth > maxWidth)
25726    newWidth = maxWidth;
25727   var minHeight = this.GetWindowMinHeight(index);
25728   var maxHeight = this.GetWindowMaxHeight(index);
25729   if(minHeight && newHeight < minHeight)
25730    newHeight = minHeight;
25731   if(maxHeight && newHeight > maxHeight)
25732    newHeight = maxHeight;
25733   if(ASPx.Browser.IE && ASPx.Browser.Version >= 10) {
25734    newLeft = Math.round(newLeft);
25735    newTop = Math.round(newTop);
25736    newHeight = Math.round(newHeight);
25737    newWidth = Math.round(newWidth);
25738   }
25739   this.SetResizePanelDimensions(newLeft, newTop, newWidth, newHeight);
25740   var widthWithoutBorders = newWidth - this.getLeftRightBordersAndPaddingsSummaryValue(resizePanel);
25741   var heightWithoutBorders = newHeight - this.getTopBottomBordersAndPaddingsSummaryValue(resizePanel);
25742   ASPx.SetStyles(resizePanel, {
25743    left: newLeft, top: newTop,
25744    width: widthWithoutBorders, height: heightWithoutBorders
25745   });
25746   this.SetWindowLeft(index, elementLeft);
25747   this.SetWindowTop(index, elementTop);
25748  }
25749 },
25750 SetResizePanelDimensions: function(left, top, offsetWidth, offsetHeight) {
25751  var cache = this.GetResizeSessionCache();
25752  cache.resizePanelDimensions = {
25753   left: left,
25754   top: top,
25755   offsetWidth: offsetWidth,
25756   offsetHeight: offsetHeight
25757  };
25758 },
25759 GetResizePanelDimensions: function() {
25760  var cache = this.GetResizeSessionCache();
25761  return cache.resizePanelDimensions;
25762 },
25763 ResetResizeSessionCache: function() {
25764  this.resizeSessionCache = {};
25765 },
25766 GetResizeSessionCache: function() {
25767  return aspxGetPopupControlCollection().IsResizeInint() ? this.resizeSessionCache : {};
25768 },
25769 EnsureWindowCoverDiv: function(index) {
25770  this.windowCoverDiv = this.CreateCoverDiv(index);
25771  var windowElement = this.GetWindowElement(index);
25772  windowElement.parentNode.appendChild(this.windowCoverDiv);
25773 },
25774 CreateCoverDiv: function(index) {
25775  var coverDiv = document.createElement("DIV");
25776  ASPx.SetStyles(coverDiv, {
25777   position: "fixed",
25778   left: 0,
25779   top: 0,
25780   width: "100%",
25781   height: "100%"
25782  });
25783  return coverDiv;
25784 },
25785 RemoveWindowCoverDiv: function() {
25786  if(!!this.windowCoverDiv) {
25787   this.windowCoverDiv.parentNode.removeChild(this.windowCoverDiv);
25788   this.windowCoverDiv = null;
25789  }
25790 },
25791 OnDrag: function(index, x, y, xClientCorrection, yClientCorrection) {
25792  var element = this.GetWindowElement(index);
25793  if(element != null) {
25794   ASPx.SetStyles(element, { left: x, top: y });
25795   xClientCorrection = typeof (xClientCorrection) != "undefined" ? xClientCorrection : 0;
25796   yClientCorrection = typeof (yClientCorrection) != "undefined" ? yClientCorrection : 0;
25797   this.SetWindowLeft(index, x + xClientCorrection);
25798   this.SetWindowTop(index, y + yClientCorrection);
25799   var iFrame = element.overflowElement;
25800   if(iFrame)
25801    ASPx.SetStyles(iFrame, { left: x, top: y });
25802   if(ASPx.Browser.Opera)
25803    ASPx.Selection.Clear();
25804  }
25805 },
25806 OnDragStop: function(index) {
25807  this.HideDragCursor(index);
25808  this.UpdateWindowsStateCookie();
25809  if(this.GetWindowContentIFrameElement(index))
25810   this.SetIframeVisibleForDragging(index, true);
25811  this.RaiseDragged(index);
25812 },
25813 OnDragStart: function(evt, index) {
25814  this.RaiseBeforeDrag(index);
25815  this.SetIsDragged(index, true);
25816  this.ShowDragCursor(index);
25817  if(this.GetWindowContentIFrameElement(index))
25818   this.SetIframeVisibleForDragging(index, false);
25819  this.InitDragInfo(index, evt);
25820 },
25821 HideIframeElementBeforeDragging: function() {
25822 },
25823 InitDragInfo: function(index, evt) {
25824  var element = this.GetWindowElement(index);
25825  var gragXOffset = ASPx.GetAbsoluteX(element) - ASPx.Evt.GetEventX(evt);
25826  var gragYOffset = ASPx.GetAbsoluteY(element) - ASPx.Evt.GetEventY(evt);
25827  var xClientCorrection = this.GetDragCorrection(index, element, true);
25828  var yClientCorrection = this.GetDragCorrection(index, element, false);
25829  gragXOffset -= xClientCorrection;
25830  gragYOffset -= yClientCorrection;
25831  aspxGetPopupControlCollection().InitDragObject(this, index, gragXOffset, gragYOffset, xClientCorrection, yClientCorrection);
25832 },
25833 GetDragCorrection: function(index, element, isX) {
25834  return ASPx.GetPositionElementOffset(element, isX);
25835 },
25836 ShowDragCursor: function(index) {
25837  var dragElement = this.GetDragElement(index);
25838  if(dragElement)
25839   this.ShowTemporaryCursor(dragElement, "move");
25840 },
25841 ShowTemporaryCursor: function(element, cursor) {
25842  ASPx.Attr.ChangeStyleAttribute(element, "cursor", cursor);
25843 },
25844 HideDragCursor: function(index) {
25845  var dragElement = this.GetDragElement(index);
25846  if(dragElement != null)
25847   this.HideTemporaryCursor(dragElement);
25848 },
25849 GetDragElement: function(index) {
25850  var headerElement = this.GetWindowHeaderElement(index);
25851  var element = this.GetWindowElement(index);
25852  if(element != null)
25853   return (headerElement != null ? headerElement : this.GetWindowMainCell(element));
25854  return null;
25855 },
25856 HideTemporaryCursor: function(element) {
25857  ASPx.Attr.RestoreStyleAttribute(element, "cursor");
25858 },
25859 OnDocumentKeyDown: function(evt, popupWindow) {
25860  var handler = this.keyDownHandlers && this.keyDownHandlers[ASPx.GetShortcutCode(evt.keyCode, evt.ctrlKey, evt.shiftKey, evt.altKey)];
25861  if(handler)
25862   handler(this.GetWindowIndex(popupWindow));
25863 },
25864 OnEscKeyDown: function(index) {
25865  if(this.GetEnableCloseByEsc(index))
25866   this.DoHideWindow(index, false, ASPxClientPopupControlCloseReason.Escape);
25867 },
25868 OnRefreshButtonClick: function(index) {
25869  var contentIFrame = this.GetWindowContentIFrameElement(index);
25870  if(contentIFrame)
25871   this.RefreshWindowContentUrl(this.GetWindow(index));
25872  else
25873   this.PerformWindowCallback(this.GetWindow(index));
25874 },
25875 OnCloseButtonClick: function(index) {
25876  this.RaiseCloseButtonClick(index);
25877  if(this.GetWindowCloseAction(index) != "None")
25878   this.DoHideWindow(index, false, ASPxClientPopupControlCloseReason.CloseButton);
25879 },
25880 Show: function(popupElementIndex) {
25881  this.ShowWindowByIndex(-1, popupElementIndex);
25882 },
25883 Hide: function() {
25884  this.HideWindow(null);
25885 },
25886 HideWindow: function(window) {
25887  var index = (window != null) ? window.index : -1;
25888  this.DoHideWindow(index, false, ASPxClientPopupControlCloseReason.API);
25889 },
25890 RaiseEventByIndex: function(index, event, argsName) {
25891  if(!event.IsEmpty()) {
25892   var window = index < 0 ? null : this.GetWindow(index),
25893    args = new argsName(window);
25894   event.FireEvent(this, args);
25895  }
25896 },
25897 RaiseCloseButtonClick: function(index) {
25898  this.RaiseEventByIndex(index, this.CloseButtonClick, ASPxClientPopupWindowEventArgs);
25899 },
25900 RaiseShown: function(index) {
25901  this.RaiseEventByIndex(index, this.Shown, ASPxClientPopupWindowEventArgs);
25902 },
25903 RaisePopUp: function(index) {
25904  this.RaiseEventByIndex(index, this.PopUp, ASPxClientPopupWindowEventArgs);
25905 },
25906 RaiseBeforeResizing: function(index) {
25907  this.RaiseEventByIndex(index, this.BeforeResizing, ASPxClientPopupWindowEventArgs);
25908 },
25909 RaiseAfterResizing: function(index) {
25910  this.RaiseEventByIndex(index, this.AfterResizing, ASPxClientPopupWindowEventArgs);
25911 },
25912 RaiseDragged: function(index) {
25913  this.RaiseEventByIndex(index, this.Dragged, ASPxClientPopupWindowEventArgs);
25914 },
25915 RaiseBeforeDrag: function(index) {
25916  this.RaiseEventByIndex(index, this.BeforeDrag, ASPxClientPopupWindowEventArgs);
25917 },
25918 RaiseClosing: function(index, closeReason) {
25919  var window = index < 0 ? null : this.GetWindow(index);
25920  var cancel = false;
25921  if(!this.Closing.IsEmpty()) {
25922   var args = new ASPxClientPopupWindowCancelEventArgs(window, closeReason);
25923   this.Closing.FireEvent(this, args);
25924   cancel = args.cancel;
25925  }
25926  return cancel;
25927 },
25928 RaiseCloseUp: function(index, closeReason) {
25929  var window = index < 0 ? null : this.GetWindow(index);
25930  if(!this.CloseUp.IsEmpty()) {
25931   var args = new ASPxClientPopupWindowCloseUpEventArgs(window, closeReason);
25932   this.CloseUp.FireEvent(this, args);
25933  }
25934 },
25935 RaiseResize: function(index, resizeState) {
25936  var window = index < 0 ? null : this.GetWindow(index);
25937  if(!this.Resize.IsEmpty()) {
25938   if(!resizeState)
25939    resizeState = ASPxClientPopupControlResizeState.Resized;
25940   var args = new ASPxClientPopupWindowResizeEventArgs(window, resizeState);
25941   this.Resize.FireEvent(this, args);
25942  }
25943 },
25944 RaisePopupOnShow: function(isMoving, index) {
25945  if(!isMoving) {
25946   this.RaisePopUp(index);
25947   if(!this.IsAnimationAllowed())
25948    this.OnWindowShown(index);
25949  }
25950 },
25951 OnActivate: function(index, evt) {
25952  var element = this.GetWindowElement(index);
25953  if(element != null)
25954   aspxGetPopupControlCollection().ActivateWindowElement(element, evt, this.GetPopupType(), this.GetDefaultZIndexFromServer(), this.GetPopupControlZIndex());
25955 },
25956 OnPWHBClickCore: function(evt, index, method) {
25957  this.OnActivate(index, evt);
25958  if(ASPx.TouchUIHelper.handleFastTapIfRequired(evt,
25959   function() { this[method](index); }.aspxBind(this), true)) {
25960   return;
25961  }
25962  if(ASPx.Browser.Opera)
25963   ASPx.Evt.EmulateDocumentOnMouseDown(evt);
25964  this[method](index);
25965 },
25966 OnScroll: function(evt, index) {
25967  if(this.HasIframeOnIos(index))
25968   this.ResetWebkitScrolling(this.getTouchScrollerElement(index), 0);
25969  if(!this.GetIsPinned(index) || (this.lockScroll > 0)) return;
25970  this.AdjustPinPositionWhileScroll(index);
25971 },
25972 ResetWebkitScrolling: function(scrollElement, timeout) {
25973  if(scrollElement.scrollTop === 0) {
25974   var styleName = "-webkit-overflow-scrolling";
25975   scrollElement.style[styleName] = "auto";
25976   window.setTimeout(function() {
25977    scrollElement.style[styleName] = "touch";
25978   }.aspxBind(this), timeout);
25979  }
25980 },
25981 HaveSpecialDivForAnimation: function() {
25982  return this.enableAnimation;
25983 },
25984 HasIframeOnIos: function(index) {
25985  return ASPx.Browser.MacOSMobilePlatform && !!this.GetWindowContentIFrameElement(index);
25986 },
25987 WindowIsModal: function(index) {
25988  return this.GetPropertyValue(index, "modal");
25989 },
25990 GetIsPopuped: function(index) {
25991  if(0 <= index && index < this.GetWindowCountCore())
25992   return this.windowsIsPopupedList[index];
25993  return this.defaultIsPopuped;
25994 },
25995 SetIsPopuped: function(index, isPopuped) {
25996  if(0 <= index && index < this.GetWindowCountCore())
25997   this.windowsIsPopupedList[index] = isPopuped;
25998  this.defaultIsPopuped = isPopuped;
25999 },
26000 GetIsMaximized: function(index) {
26001  return false;
26002 },
26003 GetIsMaximizedInit: function(index) {
26004  return false;
26005 },
26006 GetCurrentLeft: function(index) {
26007  return this.GetPosition(index, true);
26008 },
26009 GetCurrentTop: function(index) {
26010  return this.GetPosition(index, false);
26011 },
26012 GetIsPinned: function(index) {
26013  return false;
26014 },
26015 GetIsCollapsed: function(index) {
26016  return false;
26017 }, 
26018 needToHidePinnedOutFromViewPort: function(index) {
26019  return false;
26020 },
26021 GetHideBodyScrollWhenModal: function(index) {
26022  return false;
26023 },
26024 GetCanScrollViewPort: function(index) {
26025  return false;
26026 },
26027 GetEnableContentScrolling: function(index) {
26028  return false;
26029 },
26030 AutoUpdateElementsPosition: function() {
26031 },
26032 GetWindowChild: function(index, idPostfix) {
26033  var elem = this.GetWindowElement(index);
26034  if(elem)
26035   return ASPx.GetChildById(elem, this.name + idPostfix);
26036  return null;
26037 },
26038 GetWindowIndex: function(element) {
26039  var id = element.id;
26040  var pos = id.lastIndexOf(ASPx.PCWIdSuffix);
26041  return parseInt(id.substr(pos + ASPx.PCWIdSuffix.length));
26042 },
26043 GetWindow: function(index) {
26044  return (0 <= index && index < this.windows.length) ? this.windows[index] : null;
26045 },
26046 DoShowWindowIFrame: function(index, x, y, width, height) {
26047  if(!this.renderIFrameForPopupElements) return;
26048  var element = this.GetWindowElement(index);
26049  var iFrame = this.GetWindowIFrame(index);
26050  if(element && iFrame) {
26051   var cell = this.GetWindowMainCell(element);
26052   if(width < 0)
26053    width = cell.offsetWidth;
26054   if(height < 0)
26055    height = cell.offsetHeight;
26056   ASPx.SetStyles(iFrame, { width: width, height: height });
26057   if(this.IsValidPosition(x) && this.IsValidPosition(y))
26058    ASPx.SetStyles(iFrame, { left: x, top: y });
26059   if(ASPx.Browser.IE || ASPx.Browser.Firefox)
26060    this.ClearWindowIframeBodyInnerHtml(iFrame);
26061   ASPx.SetElementDisplay(iFrame, true);
26062  }
26063 },
26064 IsValidPosition: function(pos) {
26065  return pos !== ASPx.InvalidPosition;
26066 },
26067 DoHideWindowIFrame: function(element) {
26068  if(!this.renderIFrameForPopupElements) return;
26069  var iFrame = element.overflowElement;
26070  if(iFrame)
26071   ASPx.SetElementDisplay(iFrame, false);
26072 },
26073 GetIframeBody: function(iFrame) {
26074  var document = iFrame.contentDocument || iFrame.contentWindow.document;
26075  if(document)
26076   return document.getElementsByTagName('body')[0];
26077 },
26078 ClearWindowIframeBodyInnerHtml: function(iFrame) {
26079  var iFrameBody = this.GetIframeBody(iFrame);
26080  if(iFrameBody)
26081   iFrameBody.innerHTML = "";
26082 },
26083 FindWindowIFrame: function(index) {
26084  return ASPx.GetElementById(this.name + "_DXPWIF" + index);
26085 },
26086 GetWindowIFrame: function(index) {
26087  var element = this.GetWindowElement(index);
26088  var iFrame = element.overflowElement;
26089  if(!iFrame) {
26090   iFrame = this.FindWindowIFrame(index);
26091   element.overflowElement = iFrame;
26092  }
26093  return iFrame;
26094 },
26095 CreateFakeDivForIframe: function(iframe) {
26096  var fakeDiv = document.createElement("div");
26097  ASPx.SetStyles(fakeDiv, { width: iframe.offsetWidth, height: iframe.offsetHeight });
26098  return fakeDiv;
26099 },
26100 CreateIframeCoverDiv: function(iframe, index) {
26101  if(!this.iframeCoverDiv)
26102   this.iframeCoverDiv = [];
26103  if(!this.iframeCoverDiv[index])
26104   this.iframeCoverDiv[index] = this.CreateFakeDivForIframe(iframe);
26105  this.iframeCoverDiv[index].style.position = "absolute";
26106  iframe.parentElement.appendChild(this.iframeCoverDiv[index]);
26107  ASPx.SetAbsoluteX(this.iframeCoverDiv[index], ASPx.GetAbsoluteX(iframe));
26108  ASPx.SetAbsoluteY(this.iframeCoverDiv[index], ASPx.GetAbsoluteY(iframe));
26109 },
26110 RemoveIframeCoverDiv: function(iframe, index) {
26111  iframe.parentElement.removeChild(this.iframeCoverDiv[index]);
26112  this.iframeCoverDiv[index] = null;
26113 },
26114 GetWindowBorderOwnerElement: function(windowElement) {
26115  if(ASPx.ElementHasCssClass(windowElement, PopupControlCssClasses.MainDivLiteCssClass))
26116   return windowElement;
26117  else
26118   return ASPx.GetNodeByClassName(windowElement, PopupControlCssClasses.MainDivLiteCssClass);
26119 },
26120 GetWindowContentIFrameElement: function(index) {
26121  return this.GetWindowChild(index, "_CIF" + index);
26122 },
26123 GetWindowContentElement: function(index) {
26124  return this.GetWindowChild(index, "_PWC" + index);
26125 },
26126 GetWindowContentIFrameElementId: function(index) {
26127  return this.name + "_CIF" + index;
26128 },
26129 GetContentContainer: function(index) {
26130  return this.GetWindowContentElement(index);
26131 },
26132 getTouchScrollerElement: function(index) {
26133  return this.GetContentContainer(index);
26134 },
26135 GetWindowHeaderElement: function(index) {
26136  return this.GetWindowChild(index, "_PWH" + index);
26137 },
26138 GetWindowFooterElement: function(index) {
26139  return this.GetWindowChild(index, "_PWF" + index);
26140 },
26141 GetWindowSizeGripElement: function(index) {
26142  var footer = this.GetWindowFooterElement(index);
26143  if(!footer)
26144   return null;
26145  var descendants = ASPx.GetNodesByClassName(footer, PopupControlCssClasses.SizeGripLiteCssClassName);
26146  return descendants.length > 0 ? descendants[0] : null;
26147 },
26148 GetWindowContentWrapperElement: function(index) {
26149  if(!ASPx.IsExistsElement(this.windowContentElements[index])) {
26150   var windowElem = this.GetWindowElement(index);
26151   var contentWrapperParent = this.GetWindowMainCell(windowElem);
26152   this.windowContentElements[index] = ASPx.GetChildByClassName(contentWrapperParent, PopupControlCssClasses.ContentWrapperCssClassName);
26153  }
26154  return this.windowContentElements[index];
26155 },
26156 GetWindowMainCell: function(element) {
26157  return this.HaveSpecialDivForAnimation() ? ASPx.GetNodeByTagName(element, "DIV", 0) : element;
26158 },
26159 GetWindowModalElement: function(index) {
26160  var element = this.GetWindowElement(index);
26161  if(!element) return;
26162  var modalElement = element.modalElement;
26163  if(!modalElement) {
26164   modalElement = this.FindWindowModalElement(index);
26165   element.modalElement = modalElement;
26166   if(modalElement) {
26167    modalElement.DXModalPopupControl = this;
26168    modalElement.DXModalPopupWindowIndex = index;
26169   }
26170  }
26171  return modalElement;
26172 },
26173 CanManipulateWithModalElement: function(index) {
26174  return this.WindowIsModal(index);
26175 },
26176 GetCurrentZIndex: function(index) {
26177  var element = this.GetWindowElement(index);
26178  if(element != null) {
26179   if(element.style.zIndex != "" && element.style.zIndex != this.GetDefaultZIndexFromServer())
26180    return element.style.zIndex;
26181   return this.GetZIndex(index);
26182  }
26183 },
26184 GetWindowsState: function() {
26185  var state = "";
26186  if(this.HasDefaultWindow()) {
26187   state += this.GetWindowState(-1);
26188  }
26189  return state;
26190 },
26191 GetWindowState: function(index) {
26192  var element = this.GetWindowElement(index);
26193  if(element != null) {
26194   var visibleFlag = (!this.InternalIsWindowVisible(index) || element.isHiding) ? "0" : "1";
26195   var isDraggedFlag = this.GetIsDragged(index) ? "1" : "0";
26196   var zIndex = this.GetCurrentZIndex(index);
26197   var isResized = this.GetIsResized(index);
26198   var isResizedFlag = isResized ? "1" : "0";
26199   var width = null, height=null;
26200   if(isResized) {
26201    width = this.GetWindowWidthInternal(index);
26202    height = this.GetIsCollapsed(index) ? this.GetWindowDimensionByIndex(index, false, true) : this.GetWindowHeightInternal(index);
26203   } else {
26204    width = ASPx.InvalidDimension;
26205    height = ASPx.InvalidDimension;
26206   }
26207   var contentWasLoaded = element.loaded ? "1" : "0";
26208   var left, top;
26209   var isMaximized = this.GetIsMaximized(index);
26210   if(isMaximized && !this.MaximizationExecuting()) {
26211    var restoredWindowData = this.GetRestoredWindowData(index);
26212    left = restoredWindowData.left;
26213    top = restoredWindowData.top;
26214   } else {
26215    left = this.GetCurrentLeft(index);
26216    top = this.GetCurrentTop(index);
26217   }
26218   var isPinned = this.GetIsPinned(index);
26219   if(isPinned) {
26220    left -= ASPx.GetDocumentScrollLeft();
26221    top -= ASPx.GetDocumentScrollTop();
26222   }
26223   left = Math.ceil(left);
26224   top = Math.ceil(top);
26225   var pinFlag = isPinned ? "1" : "0";
26226   var minFlag = this.GetIsCollapsed(index) ? "1" : "0";
26227   var maxFlag = isMaximized || this.GetIsMaximizedInit(index) ? "1" : "0";
26228   return [visibleFlag, isDraggedFlag, zIndex, left, top, isResizedFlag, width, height, contentWasLoaded, pinFlag, minFlag, maxFlag].join(":");
26229  }
26230  return "";
26231 },
26232 UpdateStateObject: function(){
26233  this.UpdateStateObjectWithObject({ windowsState: this.GetWindowsState() });
26234 },
26235 GetStateHiddenFieldOrigin: function() {
26236  return this.GetWindowElement(this.GetWindowCountCore() - 1);
26237 },
26238 GetPopupType: function() {
26239  return "aspxpopup";
26240 },
26241 GetDefaultZIndexFromServer: function() {
26242  return defaultZIndexFromServer;
26243 },
26244 GetPopupControlZIndex: function() {
26245  return popupControlZIndex;
26246 },
26247 FindWindowModalElement: function(index) {
26248  return ASPx.GetElementById(this.name + "_DXPWMB" + index);
26249 },
26250 GetWindowCloseButton: function(index) {
26251  return ASPx.GetElementById(this.name + "_HCB" + index);
26252 },
26253 GetWindowRefreshButton: function(index) {
26254  return ASPx.GetElementById(this.name + "_HRB" + index);
26255 },
26256 FirstShowWindow: function(index, allowChangeZIndex) {
26257  var popupHorizontalOffsetBackup = -1;
26258  var popupVerticalOffsetBackup = -1;
26259  var isFreeWindow = this.GetIsDragged(index);
26260  var x = ASPx.InvalidPosition;
26261  var y = ASPx.InvalidPosition;
26262  if(isFreeWindow) {
26263   x = this.GetWindowLeft(index);
26264   y = this.GetWindowTop(index);
26265   popupHorizontalOffsetBackup = this.popupHorizontalOffset;
26266   popupVerticalOffsetBackup = this.popupVerticalOffset;
26267   this.popupHorizontalOffset = 0;
26268   this.popupVerticalOffset = 0;
26269  }
26270  this.LockAnimation();
26271  this.DoShowWindowCore(index, x, y, isFreeWindow ? -1 : 0, false, allowChangeZIndex);
26272  this.UnlockAnimation();
26273  if(isFreeWindow) {
26274   this.popupHorizontalOffset = popupHorizontalOffsetBackup;
26275   this.popupVerticalOffset = popupVerticalOffsetBackup;
26276  }
26277  this.CorrectElementVerticalAlignment(ASPx.AdjustVerticalMarginsInContainer, this.GetWindowHeaderElement(index));
26278  this.CorrectFooterTextElementWidth(index);
26279 },
26280 HasDefaultWindow: function() {
26281  return true;
26282 },
26283 GetWindowCount: function() {
26284  return 0;
26285 },
26286 GetWindowContentHtml: function(window) {
26287  var index = (window != null) ? window.index : -1;
26288  var element = this.GetContentContainer(index);
26289  return (element != null) ? element.innerHTML : "";
26290 },
26291 GetWindowElementId: function(index) {
26292  return this.name + ASPx.PCWIdSuffix + index;
26293 },
26294 GetWindowElement: function(index) {
26295  if(!ASPx.IsExistsElement(this.windowElements[index]))
26296   this.windowElements[index] = ASPx.GetElementById(this.GetWindowElementId(index));
26297  return this.windowElements[index];
26298 },
26299 GetWindowClientTable: function(index) {
26300  return this.GetWindowElement(index);
26301 },
26302 GetCurrentWindowElement: function() {
26303  return this.GetWindowElement(-1);
26304 },
26305 getActualMainElement: function() { return this.GetCurrentWindowElement(); },
26306 ShowWindowContentUrl: function(index) {
26307  var contentIFrame = this.GetWindowContentIFrameElement(index);
26308  this.LoadWindowContentUrl(index);
26309  if(contentIFrame && contentIFrame.DXReloadAfterShowRequired) {
26310   this.RefreshWindowContentUrl(this.GetWindow(index));
26311   contentIFrame.DXReloadAfterShowRequired = false;
26312  }
26313 },
26314 RefreshWindowContentUrl: function(window) {
26315  var index = (window != null) ? window.index : -1;
26316  if(ASPx.Browser.IE)
26317   this.RefreshWindowContentUrlIE(index, window);
26318  else
26319   this.RefreshWindowContentUrlCommon(window);
26320 },
26321 RefreshContentUrl: function() {
26322  this.RefreshWindowContentUrl(null);
26323 },
26324 RefreshWindowContentUrlIE: function(index, window) {
26325  var windowVisible = this.InternalIsWindowVisible(index);
26326  if(windowVisible)
26327   this.RefreshWindowContentUrlIECore(index, window);
26328  else {
26329   var iframe = this.GetWindowContentIFrameElement(index);
26330   if(iframe)
26331    iframe.DXReloadAfterShowRequired = true;
26332  }
26333 },
26334 RefreshWindowContentUrlIECore: function(index, window) {
26335  try {
26336   if(!this.GetIframeLoading(index)) {
26337    var iframe = this.GetWindowContentIFrameElement(index);
26338    if(iframe)
26339     iframe.contentWindow.location.reload();
26340   }
26341  } catch (e) {
26342   this.RefreshWindowContentUrlCommon(window);
26343  }
26344 },
26345 RefreshWindowContentUrlCommon: function(window) {
26346  this.SetWindowContentUrl(window, this.GetWindowContentUrl(window));
26347 },
26348 GetContentUrl: function() {
26349  return this.GetWindowContentUrl(null);
26350 },
26351 GetWindowContentUrl: function(window) {
26352  var index = (window != null) ? window.index : -1;
26353  if(!this.IsWindowVisible(window))
26354   return this.GetWindowContentIFrameUrl(index);
26355  var element = this.GetWindowContentIFrameElement(index);
26356  return (element != null) ? element.src : "";
26357 },
26358 GetContentIFrame: function(window) {
26359  return this.GetWindowContentIFrame(null);
26360 },
26361 GetWindowContentIFrame: function(window) {
26362  var index = (window != null) ? window.index : -1;
26363  return this.GetWindowContentIFrameElement(index);
26364 },
26365 GetContentIFrameWindow: function() {
26366  var iframeElement = this.GetContentIFrame();
26367  return iframeElement.contentWindow;
26368 },
26369 SetContentUrl: function(url) {
26370  this.SetWindowContentUrl(null, url);
26371 },
26372 SetWindowContentUrl: function(window, url) {
26373  var index = (window != null) ? window.index : -1;
26374  this.SetWindowContentUrlInternal(index, url);
26375 },
26376 LoadWindowContentUrl: function(index) {
26377  var url = this.GetWindowContentIFrameUrl(index);
26378  this.LoadWindowContentFromUrl(index, url);
26379 },
26380 LoadWindowContentFromUrl: function(index, url) {
26381  var element = this.GetWindowContentIFrameElement(index);
26382  if(element && element.src != url && element.DXSrcRaw != url) {
26383   this.SetSrcToIframeElement(index, element, url);
26384   this.SetWindowContentIFrameUrl(index, element.src); 
26385  }
26386 },
26387 SetWindowContentIFrameUrl: function(index, url) {
26388  this.SetPropertyValue(index, "contentUrl", url);
26389 },
26390 SetWindowContentUrlInternal: function(index, url) {
26391  var element = this.GetWindowContentIFrameElement(index);
26392  var windowVisible = this.InternalIsWindowVisible(index);
26393  if(windowVisible && element != null)
26394   this.SetIframeVisibleForDragging(index, true);
26395  this.SetWindowContentIFrameUrl(index, url);
26396  var src = windowVisible ? url : ASPx.Browser.WebKitFamily && ASPx.Browser.Version >= 75 ? "about:blank" : ASPx.SSLSecureBlankUrl;
26397  if(element == null) {
26398   this.CreateWindowContentIFrameElement(index, src);
26399   this.RefreshDimensionsAfterCreateIframe(index);
26400  }
26401  else
26402   this.SetSrcToIframeElement(index, element, src);
26403  this.ReinitScrollForIframe(index);
26404 },
26405 ReinitScrollForIframe: function(index) {
26406  if(this.HasIframeOnIos(index)) {
26407   var scrollElement = this.getTouchScrollerElement(index);
26408   if(scrollElement) {
26409    var options = this.GetWindowTouchScrollOptions(index);
26410    ASPx.TouchUIHelper.InitNativeScrolling(scrollElement, options);
26411    if(!!this.touchUIScrollers[index]) {
26412     this.touchUIScrollers[index].Destroy();
26413     this.touchUIScrollers[index] = null;
26414    }
26415   }
26416  }
26417 },
26418 EnsureWindowContentUrl: function(index) {
26419  var contentUrl = this.GetWindowContentIFrameUrl(index);
26420  if(contentUrl != "")
26421   this.SetWindowContentUrlInternal(index, contentUrl);
26422 },
26423 CreateWindowContentIFrameElement: function(index, src) {
26424  var content = this.GetContentContainer(index);
26425  var iframeParent = content;
26426  content.innerHTML = "";
26427  content.style.display = "block";
26428  var iframe = this.CreateContentIFrameElement(index, src);
26429  this.RequireIFrameHeightAdjusting(index, iframe);
26430  iframeParent.appendChild(iframe);
26431  this.InitIFrame(index);
26432  return iframe;
26433 },
26434 InitIFrame: function(index) {
26435  var contentIFrameElement = this.GetWindowContentIFrameElement(index);
26436  if(contentIFrameElement) {
26437   contentIFrameElement.popupControlName = this.name;
26438   contentIFrameElement.pcWndIndex = index;
26439   ASPx.Evt.AttachEventToElement(contentIFrameElement, "load", ASPx.PCIframeLoad);
26440  }
26441 },
26442 OnIFrameLoad: function(index) {
26443  this.SetIframeLoading(index, false);
26444 },
26445 RequireIFrameHeightAdjusting: function(index, iframe) {
26446  if(this.InternalIsWindowVisible(index))
26447   this.AdjustIFrameHeight(index, iframe);
26448  else
26449   this.PostponeIframeAdjusting(index);
26450 },
26451 PostponeIframeAdjusting: function(index) {
26452  this.SetIframeAdjustingPostponed(index, true);
26453 },
26454 EnsureIFrameHeightAdjusted: function(index) {
26455  if(this.GetIframeAdjustingPostponed(index)) {
26456   var iframe = this.GetWindowContentIFrameElement(index);
26457   this.AdjustIFrameHeight(index, iframe);
26458  }
26459 },
26460 AdjustIFrameHeight: function(index, iframe) {
26461 },
26462 CreateContentIFrameElement: function(index, src) {
26463  var iframe = document.createElement("IFRAME");
26464  iframe.id = this.GetWindowContentIFrameElementId(index);
26465  iframe.scrolling = "auto";
26466  iframe.frameBorder = 0;
26467  iframe.style.width = "100%";
26468  iframe.style.height = "100%";
26469  iframe.style.overflow = "auto";
26470  if(ASPx.Browser.Chrome) iframe.style.webkitBackfaceVisibility = "hidden";
26471  if(ASPx.Browser.IE || ASPx.Browser.Edge)
26472   iframe.style["-ms-user-select"] = "text";
26473  var titleText = this.GetWindowContentIFrameTitle(index);
26474  if(!!titleText)
26475   iframe.title = titleText;
26476  this.SetSrcToIframeElement(index, iframe, src);
26477  return iframe;
26478 },
26479 SetSrcToIframeElement: function(index, iframeElement, src) {
26480  this.SetIframeLoading(index, true);
26481  iframeElement.src = src;
26482  if(ASPx.Browser.Chrome && src.indexOf("#"))
26483   this.PreventScrollingAfterIframeLoaded(iframeElement);
26484  iframeElement.DXSrcRaw = src;
26485 },
26486 PreventScrollingAfterIframeLoaded: function(iframeElement) {
26487  var docScrollTop = ASPx.GetDocumentScrollTop();
26488  var onIframeLoadedHandler = function() {
26489   window.setTimeout(function() {
26490    ASPx.SetDocumentScrollTop(docScrollTop);
26491    ASPx.Evt.DetachEventFromElement(iframeElement, "load", onIframeLoadedHandler);
26492   }, 0);
26493  };
26494  ASPx.Evt.AttachEventToElement(iframeElement, "load", onIframeLoadedHandler);
26495 },
26496 GetWindowHeaderTextCell: function(index) {
26497  return this.GetWindowChild(index, "_PWH" + index + "T");
26498 },
26499 GetWindowHeaderTextElement: function(index) {
26500  var element = this.GetWindowHeaderTextCell(index);
26501  if(element != null) {
26502   var link = ASPx.GetNodeByTagName(element, "A", 0);
26503   return link || element;
26504  }
26505  return null;
26506 },
26507 GetWindowHeaderLinkElement: function(index) {
26508  var element = this.GetWindowHeaderElement(index);
26509  return element ? ASPx.GetNodeByClassName(element, PopupControlCssClasse
26509s.LinkCssClassName) : null;
26510 },
26511 GetWindowHeaderImageCell: function(index) {
26512  return this.GetWindowChild(index, "_PWH" + index + "I");
26513 },
26514 GetWindowFooterTextCell: function(index) {
26515  return this.GetWindowChild(index, "_PWF" + index + "T");
26516 },
26517 GetWindowFooterTextElement: function(index) {
26518  var element = this.GetWindowFooterTextCell(index);
26519  if(element != null) {
26520   var link = ASPx.GetNodeByTagName(element, "A", 0);
26521   return link || element;
26522  }
26523  return null;
26524 },
26525 GetWindowFooterLinkElement: function(index) {
26526  var element = this.GetWindowFooterElement(index);
26527  return element ? ASPx.GetNodeByClassName(element, PopupControlCssClasses.LinkCssClassName) : null;
26528 },
26529 GetWindowFooterImageCell: function(index) {
26530  return this.GetWindowChild(index, "_PWF" + index + "I");
26531 },
26532 GetWindowHeaderImageUrl: function(index) {
26533  var element = this.GetWindowHeaderImageCell(index);
26534  return element ? element.src : "";
26535 },
26536 SetWindowHeaderImageUrl: function(index, url) {
26537  var element = this.GetWindowHeaderImageCell(index);
26538  if(element != null) {
26539   element.src = url;
26540  }
26541 },
26542 GetWindowFooterImageUrl: function(index) {
26543  var element = this.GetWindowFooterImageCell(index);
26544  return element ? element.src : "";
26545 },
26546 SetWindowFooterImageUrl: function(index, url) {
26547  var element = this.GetWindowFooterImageCell(index);
26548  if(element != null) {
26549   element.src = url;
26550  }
26551 },
26552 GetWindowHeaderNavigateUrl: function(index) {
26553  var link = this.GetWindowHeaderLinkElement(index);
26554  if(link)
26555   return link.href || ASPx.Attr.GetAttribute(linkEl, "savedhref");
26556  return "";
26557 },
26558 SetWindowHeaderNavigateUrl: function(index, url) {
26559  var link = this.GetWindowHeaderLinkElement(index);
26560  if(link) {
26561   if(ASPx.Attr.IsExistsAttribute(link, "savedhref"))
26562    ASPx.Attr.SetAttribute(link, "savedhref", url);
26563   else if(ASPx.Attr.IsExistsAttribute(link, "href"))
26564    link.href = url;
26565  }
26566 },
26567 GetWindowFooterNavigateUrl: function(index) {
26568  var link = this.GetWindowFooterLinkElement(index);
26569  if(link)
26570   return link.href || ASPx.Attr.GetAttribute(linkEl, "savedhref");
26571  return "";
26572 },
26573 SetWindowFooterNavigateUrl: function(index, url) {
26574  var link = this.GetWindowFooterLinkElement(index);
26575  if(link) {
26576   if(ASPx.Attr.IsExistsAttribute(link, "savedhref"))
26577    ASPx.Attr.SetAttribute(link, "savedhref", url);
26578   else if (ASPx.Attr.IsExistsAttribute(link, "href"))
26579    link.href = url;
26580  }
26581 },
26582 GetWindowHeaderText: function(index) {
26583  var element = this.GetWindowHeaderTextElement(index);
26584  if(element != null) 
26585    return element.innerHTML;
26586  return "";
26587 },
26588 SetWindowHeaderText: function(index, text) {
26589  var element = this.GetWindowHeaderTextElement(index);
26590  if(element != null) {
26591   element.innerHTML = text;
26592   this.CorrectHeaderContentElementHeight(index);
26593   this.CorrectElementVerticalAlignment(ASPx.AdjustVerticalMarginsInContainer, this.GetWindowHeaderElement(index), true);
26594  }
26595 },
26596 GetWindowFooterText: function(index) {
26597  var element = this.GetWindowFooterTextElement(index);
26598  if(element != null) 
26599   return element.innerHTML;
26600  return "";
26601 },
26602 SetWindowFooterText: function(index, text) {
26603  var element = this.GetWindowFooterTextElement(index);
26604  if(element != null) {
26605   element.innerHTML = text;
26606   this.CorrectWindowSizeGripPositionLite(index);
26607  }
26608 },
26609 CorrectWindowSizeGripPositionLite: function(index) {
26610  var sizeGrip = this.GetWindowSizeGripElement(index);
26611  if(!sizeGrip || sizeGrip.corrected) return;
26612  sizeGrip.style[this.rtl ? "marginRight" : "marginLeft"] = "-" + sizeGrip.offsetWidth + "px";
26613  sizeGrip.style.marginTop = "-" + sizeGrip.offsetHeight + "px";
26614  sizeGrip.corrected = true;
26615 },
26616 GetHeaderFooterHeightCore: function(index) {
26617  var extenders = [
26618   this.GetWindowHeaderElement(index),
26619   this.GetWindowFooterElement(index)
26620  ], height = 0;
26621  for(var i = 0; i < extenders.length; i++) {
26622   if(extenders[i])
26623    height += extenders[i].offsetHeight;
26624  }
26625  return height;
26626 },
26627 GetHeaderImageUrl: function() {
26628  return this.GetWindowHeaderImageUrl(-1);
26629 },
26630 SetHeaderImageUrl: function(value) {
26631  this.SetWindowHeaderImageUrl(-1, value);
26632 },
26633 GetFooterImageUrl: function() {
26634  return this.GetWindowFooterImageUrl(-1);
26635 },
26636 SetFooterImageUrl: function(value) {
26637  this.SetWindowFooterImageUrl(-1, value);
26638 },
26639 GetHeaderNavigateUrl: function() {
26640  return this.GetWindowHeaderNavigateUrl(-1);
26641 },
26642 SetHeaderNavigateUrl: function(value) {
26643  this.SetWindowHeaderNavigateUrl(-1, value);
26644 },
26645 GetFooterNavigateUrl: function() {
26646  return this.GetWindowFooterNavigateUrl(-1);
26647 },
26648 SetFooterNavigateUrl: function(value) {
26649  this.SetWindowFooterNavigateUrl(-1, value);
26650 },
26651 GetHeaderText: function() {
26652  return this.GetWindowHeaderText(-1);
26653 },
26654 SetHeaderText: function(value) {
26655  this.SetWindowHeaderText(-1, value);
26656 },
26657 GetFooterText: function() {
26658  return this.GetWindowFooterText(-1);
26659 },
26660 SetFooterText: function(value) {
26661  this.SetWindowFooterText(-1, value);
26662 },
26663 GetVisible: function() {
26664  return this.IsVisible();
26665 },
26666 SetVisible: function(visible) {
26667  if(visible && !this.IsVisible())
26668   this.Show();
26669  else if(!visible && this.IsVisible())
26670   this.Hide();
26671 },
26672 GetStateHiddenFieldName: function() {
26673  return this.uniqueID + "State";
26674 },
26675 GetWindowCountCore: function() {
26676  return 0; 
26677 },
26678 IsWindowElementsIDAssigned: function(index) {
26679  var contentElement = this.GetWindowContentElement(index);
26680  return ASPx.IsExistsElement(contentElement);
26681 },
26682 InitializeDOM: function () {
26683  var windowElement = this.GetWindowElement(this.GetWindowCountCore() - 1);
26684  if(windowElement)
26685   windowElement.dxinit = true;
26686 },
26687 IsDOMInitialized: function() {
26688  var windowElement = this.GetWindowElement(this.GetWindowCountCore() - 1);
26689  return windowElement && windowElement.dxinit;
26690 },
26691 IsDOMDisposed: function() { 
26692  var windowElement = this.GetWindowElement(this.GetWindowCountCore() - 1);
26693  return !ASPx.IsExistsElement(windowElement);
26694 },
26695 OnDispose: function() {
26696  ASPxClientControl.prototype.OnDispose.call(this);
26697  this.ClearPopupElementConnection();
26698 },
26699 RegisterInControlTree: function(tree) {
26700  var mainNode = tree.createNode(null, this);
26701  if(this.HasDefaultWindow())
26702   this.RegisterRelatedNodeForWindowElement(tree, -1, mainNode);
26703  for(var i = 0; i < this.GetWindowCount() ; i++)
26704   this.RegisterRelatedNodeForWindowElement(tree, i, mainNode);
26705 },
26706 RegisterRelatedNodeForWindowElement: function(tree, windowElementIndex, mainNode) {
26707  var windowElement = this.GetWindowElement(windowElementIndex);
26708  if(windowElement) {
26709   var childNode = tree.createNode(windowElement.id, null);
26710   tree.addRelatedNode(mainNode, childNode);
26711  }
26712 },
26713 CorrectWindowHeaderText: function(index) {
26714  var headerElement = this.GetWindowHeaderElement(index);
26715  if(!headerElement || headerElement.corrected) return;
26716  var leftChildrenWidth = 0, rightChildrenWidth = 0, headerContentElement;
26717  for(var i = 0; i < headerElement.childNodes.length; i++) {
26718   var child = headerElement.childNodes[i];
26719   if(!child.offsetWidth) continue;
26720   if(ASPx.GetElementFloat(child) === "right")
26721    rightChildrenWidth += child.offsetWidth + ASPx.GetLeftRightMargins(child);
26722   else if(ASPx.GetElementFloat(child) === "left")
26723    leftChildrenWidth += child.offsetWidth + ASPx.GetLeftRightMargins(child);
26724   else if(!headerContentElement)
26725    headerContentElement = child;
26726  }
26727  if(headerContentElement && (leftChildrenWidth > 0 || rightChildrenWidth > 0)) {
26728   var headerContentElementStyle = ASPx.GetCurrentStyle(headerContentElement);
26729   var originalMarginLeft = parseInt(headerContentElementStyle.marginLeft);
26730   var originalMarginRight = parseInt(headerContentElementStyle.marginRight);
26731   ASPx.SetStyles(headerContentElement, {
26732    marginLeft: leftChildrenWidth + originalMarginLeft,
26733    marginRight: rightChildrenWidth + originalMarginRight
26734   });
26735   this.CorrectHeaderContentElementHeight(index);
26736  }
26737  headerElement.corrected = true;
26738 },
26739 CorrectHeaderContentElementHeight: function(index) {
26740  var headerElement = this.GetWindowHeaderElement(index),
26741   headerContentElement = ASPx.GetChildByClassName(headerElement, PopupControlCssClasses.HeaderContentCssClassName);
26742  if(!headerElement || !headerContentElement) return;
26743  if(headerContentElement.style.height)
26744   headerContentElement.style.height = "";
26745  var contentElementHeight = ASPx.GetClearClientHeight(headerElement) - this.getTopBottomBordersAndPaddingsSummaryValue(headerContentElement),
26746   lineHeightForTextVerticalAlign = contentElementHeight,
26747   windowHeaderTextCell = this.GetWindowHeaderTextCell(index);
26748  if(windowHeaderTextCell)
26749   lineHeightForTextVerticalAlign -= this.getTopBottomBordersAndPaddingsSummaryValue(windowHeaderTextCell);
26750  ASPx.SetStyles(headerContentElement, { lineHeight: lineHeightForTextVerticalAlign, height: contentElementHeight }, false);
26751 },
26752 CorrectFooterTextElementWidth: function(index) {
26753  var footerElement = this.GetWindowFooterElement(index);
26754  var footerContentElement = ASPx.GetChildByClassName(footerElement, PopupControlCssClasses.FooterContentCssClassName);
26755  var footerTextElement = this.GetWindowFooterTextElement(index);
26756  var footerImageElement = this.GetWindowFooterImageCell(index);
26757  if(!footerElement || !footerContentElement || !footerTextElement)
26758   return;
26759  var footerTextMaxWidth = "";
26760  if(footerImageElement) {
26761   var footerTextMaxWidthCorrection = footerImageElement.offsetWidth + ASPx.GetLeftRightMargins(footerImageElement);
26762   footerTextMaxWidth = "calc(100% - " + footerTextMaxWidthCorrection + "px)";
26763  }
26764  ASPx.SetStyles(footerTextElement, { maxWidth: footerTextMaxWidth }, false);
26765 },
26766 OnBeforeDropdownShow: function() {
26767  var element = this.GetWindowElement(-1);
26768  if(!ASPx.GetElementDisplay(element)) {
26769   element.style.visibility = "hidden";
26770  }
26771  this.SetWindowDisplay(-1, true);
26772  if(this.adaptivityEnabled) {
26773   ASPx.SetElementDisplay(this.GetModalWrapperElement(-1), true);
26774   this.SetAdaptiveModalMode(-1, this.NeedAdaptiveModalMode());
26775  }
26776 },
26777 SetWindowDisplay: function(index, value) {
26778  var pcwElement = this.GetWindowElement(index);
26779  ASPx.SetElementDisplay(pcwElement, value);
26780 },
26781 getWindowHorizontalAlign: function(element) {
26782  return this.popupHorizontalAlign;
26783 },
26784 getWindowVerticalAlign: function(element) {
26785  return this.popupVerticalAlign;
26786 },
26787 getWindowHorizontalOffset: function(element) {
26788  return this.popupHorizontalOffset;
26789 },
26790 getWindowVerticalOffset: function(element) {
26791  return this.popupVerticalOffset;
26792 },
26793 GetHorizontalAlign: function() {
26794  return this.popupHorizontalAlign;
26795 },
26796 GetVerticalAlign: function() {
26797  return this.popupVerticalAlign;
26798 },
26799 GetPopupHorizontalOffset: function() {
26800  return this.popupHorizontalOffset;
26801 },
26802 SetPopupHorizontalOffset: function(offset) {
26803  this.popupHorizontalOffset = offset;
26804 },
26805 SetPopupVerticalOffset: function(offset) {
26806  this.popupVerticalOffset = offset;
26807 },
26808 GetPopupVerticalOffset: function() {
26809  return this.popupVerticalOffset;
26810 },
26811 ShowAtElement: function(htmlElement, savePopupElement) {
26812  this.ShowWindowAtElementByIndex(-1, htmlElement, savePopupElement);
26813 },
26814 ShowAtElementByID: function(id) {
26815  var htmlElement = document.getElementById(id);
26816  this.ShowAtElement(htmlElement);
26817 },
26818 ShowWindowAtElementByIndex: function(index, htmlElement, savePopupElement) {
26819  var lastIndexBackup = this.GetLastShownPopupElementIndex(index);
26820  this.ShowWindowByIndex(index, this.AddPopupElementInternal(index, htmlElement));
26821  if(!savePopupElement)
26822   this.RemovePopupElementInternal(index, htmlElement);
26823  this.SetLastShownPopupElementIndex(index, lastIndexBackup);
26824 },
26825 ShowWindowByIndex: function(index, popupElementIndex) {
26826  if(!this.isInitialized)
26827   return;
26828  if(popupElementIndex === undefined)
26829   popupElementIndex = this.GetLastShownPopupElementIndex(index);
26830  this.DoShowWindowCore(index, ASPx.InvalidPosition, ASPx.InvalidPosition, popupElementIndex, false, true);
26831 },
26832 DoShowWindowCore: function(index, x, y, popupElementIndex, closeOtherWindows, allowChangeZIndex, evt, closeOtherReason) {
26833 },
26834 DoShowWindow: function(index, popupElementIndex, evt) {
26835  if(!this.InternalIsWindowVisible(index)) {
26836   var x = ASPx.Evt.GetEventX(evt);
26837   var y = ASPx.Evt.GetEventY(evt);
26838   this.DoShowWindowCore(index, x, y, popupElementIndex, true, true, evt, ASPxClientPopupControlCloseReason.OuterMouseClick);
26839  }
26840 },
26841 SetWindowPos: function(index, element, x, y) {
26842  ASPx.SetStyles(element, { left: x, top: y });
26843  this.DoShowWindowIFrame(index, x, y, ASPx.InvalidDimension, ASPx.InvalidDimension);
26844  this.SetIsDragged(index, true);
26845  this.SetWindowLeft(index, ASPx.GetAbsoluteX(element));
26846  this.SetWindowTop(index, ASPx.GetAbsoluteY(element));
26847  this.UpdateWindowsStateCookie();
26848 },
26849 CorrectPopupPositionForClientWindow: function(element, popupPosition, isX) {
26850  if(element.isPopupPositionCorrectionOn && this.isPopupFullCorrectionOn || this.forceAdjustPositionToClientScreen) {
26851   popupPosition.position = ASPx.PopupUtils.AdjustPositionToClientScreen(element, popupPosition.position, this.rtl, isX);
26852  }
26853  return popupPosition;
26854 },
26855 GetClientPopupPos: function(element, popupElement, pos, isX, isDragged) {
26856  var index = this.GetWindowIndex(element);
26857  var popupPosition = null;
26858  if(this.GetIsMaximizedOnWebKitTouch(index))
26859   return new ASPx.PopupPosition(ASPx.PrepareClientPosForElement(0, element, isX), false);
26860  if(isDragged)
26861   popupPosition = new ASPx.PopupPosition(!this.IsValidPosition(pos) ? this.GetPosition(index, isX) : pos, false);
26862  else
26863   popupPosition = isX ? this.GetClientPopupPosX(element, popupElement, pos) : this.GetClientPopupPosY(element, popupElement, pos);
26864  popupPosition.position = ASPx.PrepareClientPosForElement(popupPosition.position, element, isX);
26865  if(ASPx.Browser.Firefox && ASPx.Browser.Version < 3 && this.GetWindowModalElement(index))
26866   popupPosition.position -= isX ? ASPx.GetDocumentScrollLeft() : ASPx.GetDocumentScrollTop();
26867  return popupPosition;
26868 },
26869 GetClientPopupPosX: function(element, popupElement, x) {
26870  var mainElement = this.GetWindowMainCell(element);
26871  var popupPosition = ASPx.PopupUtils.GetPopupAbsoluteX(mainElement, popupElement, this.getWindowHorizontalAlign(element), this.getWindowHorizontalOffset(element),
26872   x, this.GetWindowLeft(this.GetWindowIndex(element)), this.rtl, this.isPopupFullCorrectionOn);
26873  return this.CorrectPopupPositionForClientWindow(element, popupPosition, true);
26874 },
26875 GetClientPopupPosY: function(element, popupElement, y) {
26876  var mainElement = this.GetWindowMainCell(element);
26877  var popupPosition = ASPx.PopupUtils.GetPopupAbsoluteY(mainElement, popupElement, this.getWindowVerticalAlign(element), this.getWindowVerticalOffset(element),
26878   y, this.GetWindowTop(this.GetWindowIndex(element)), this.isPopupFullCorrectionOn, this.usedInDropDown, this.usedInDropDown);
26879  return this.usedInDropDown ? popupPosition : this.CorrectPopupPositionForClientWindow(element, popupPosition, false);
26880 },
26881 UpdateWindowPositionInternal: function(index, popupElement) {
26882  var positionUpdated = false,
26883   element = this.GetWindowElement(index);
26884  if(this.InternalIsWindowVisible(index) && element != null) {
26885   var horizontalPopupPosition;
26886   if(this.popupHorizontalAlign === ASPx.PopupUtils.WindowCenterAlignIndicator && window.innerWidth <= element.offsetWidth) {
26887    var scrollDiff = aspxGetPopupControlCollection().GetDocScrollDifference(),
26888     scrollInProgress = scrollDiff.horizontal !== 0 || scrollDiff.vertical !== 0;
26889    horizontalPopupPosition = scrollInProgress ? ASPx.PxToInt(element.style.left) : this.GetClientPopupPos(element, popupElement, ASPx.InvalidPosition, true, false);
26890   } else
26891    horizontalPopupPosition = this.GetClientPopupPos(element, popupElement, ASPx.InvalidPosition, true, false);
26892   var verticalPopupPosition = this.GetClientPopupPos(element, popupElement, ASPx.InvalidPosition, false, false);
26893   this.SetWindowPos(index, element, horizontalPopupPosition.position, verticalPopupPosition.position);
26894   positionUpdated = true;
26895  }
26896  return positionUpdated;
26897 },
26898 UpdatePositionAtElement: function(popupElement) {
26899  this.UpdateWindowPositionAtElement(null, popupElement);
26900 },
26901 UpdateWindowPositionAtElement: function(window, popupElement) {
26902  var index = (window != null) ? window.index : -1;
26903  this.UpdateWindowPositionInternal(index, popupElement);
26904 },
26905 TryAutoUpdatePosition: function(index) {
26906  if(this.GetAutoUpdatePosition(index))
26907   this.UpdateWindowPositionInternal(index, this.GetPopupElement(index, this.GetLastShownPopupElementIndex(index)));
26908 },
26909 GetLastShownPopupElementIndex: function(windowIndex) {
26910  var info = this.GetLastUsedPopupElementInfo(windowIndex);
26911  return ASPx.GetDefinedValue(info.shownPEIndex, 0);
26912 },
26913 SetLastShownPopupElementIndex: function(windowIndex, popupElementIndex) {
26914  var info = this.GetLastUsedPopupElementInfo(windowIndex);
26915  info.shownPEIndex = popupElementIndex;
26916 },
26917 GetLastUsedPopupElementInfo: function(index) {
26918  if(0 <= index && index < this.GetWindowCountCore())
26919   return this.windowsLastUsedPopupElementInfoList[index];
26920  return this.defaultLastUsedPopupElementInfo;
26921 },
26922 GetPopupElement: function(index, popupElementIndex) {
26923  var popupElement = this.GetPopupElementList(index)[popupElementIndex];
26924  return popupElement ? popupElement : null;
26925 },
26926 GetPopupElementList: function(index) {
26927  if(0 <= index && index < this.GetWindowCountCore())
26928   return this.windowsPopupElementList[index];
26929  return this.defaultWindowPopupElementList;
26930 },
26931 PopulatePopupElementsByIds: function(index) {
26932  var ids = this.GetPopupElementIDList(index);
26933  for(var i = 0; i < ids.length; i++) {
26934   var popupElement = ASPx.PopupUtils.FindPopupElementById(ids[i]);
26935   if(popupElement)
26936    this.AddWindowPopupElement(index, popupElement);
26937  }
26938 },
26939 PopulatePopupElements: function(index) {
26940  this.PopulatePopupElementsByIds(index);
26941 },
26942 SetPopupElementIDByIndex: function(index, popupElementId) {
26943  this.RemoveWindowAllPopupElements(index);
26944  this.SetPopupElementIDs(index, popupElementId.split(';'));
26945  if(aspxGetPopupControlCollection().IsDisappearTimerActive()) {
26946   aspxGetPopupControlCollection().ClearDisappearTimer();
26947   this.Hide(index);
26948  }
26949  this.PopulatePopupElements(index);
26950 },
26951 RefreshPopupElementConnection: function() {
26952  this.ClearPopupElementConnection();
26953  var index = this.HasDefaultWindow() ? -1 : 0;
26954  for(; index < this.GetWindowCount(); index++)
26955   this.PopulatePopupElements(index);
26956 },
26957 ClearPopupElementConnection: function() {
26958  var index = this.HasDefaultWindow() ? -1 : 0;
26959  for(; index < this.GetWindowCount(); index++)
26960   this.RemoveWindowAllPopupElements(index);
26961 },
26962 GetPopupElementIDList: function(index) {
26963  if(0 <= index && index < this.GetWindowCountCore())
26964   return this.windowsPopupElementIDList[index];
26965  return this.defaultWindowPopupElementIDList;
26966 },
26967 SetPopupElementIDs: function(index, ids) {
26968  if(0 <= index && index < this.GetWindowCountCore())
26969   this.windowsPopupElementIDList[index] = ids;
26970  this.defaultWindowPopupElementIDList = ids;
26971 },
26972 AddPopupElementInternal: function(index, element) {
26973  var popupElements = this.GetPopupElementList(index);
26974  for(var i = 0; i < popupElements.length; i++) {
26975   if(!popupElements[i]) {
26976    popupElements[i] = element;
26977    return i;
26978   }
26979  }
26980  popupElements.push(element);
26981  return popupElements.length - 1;
26982 },
26983 RemovePopupElementInternal: function(index, element) {
26984  var popupElements = this.GetPopupElementList(index);
26985  for(var i = 0; i < popupElements.length; i++) {
26986   if(popupElements[i] == element) {
26987    popupElements[i] = null;
26988    return;
26989   }
26990  }
26991 },
26992 AddPopupElement: function(popupElement) {
26993  this.AddWindowPopupElement(-1, popupElement);
26994 },
26995 AddWindowPopupElement: function(index, popupElement) {
26996  var popupElementIndex = this.AddPopupElementInternal(index, popupElement);
26997  this.SetPopupElementReference(index, popupElement, popupElementIndex, true);
26998 },
26999 RemovePopupElement: function(popupElement) {
27000  this.RemoveWindowPopupElement(-1, popupElement);
27001 },
27002 RemoveWindowPopupElement: function(index, popupElement) {
27003  this.RemovePopupElementInternal(index, popupElement);
27004  this.SetPopupElementReference(index, popupElement, null, false);
27005 },
27006 SetPopupElementReference: function(index, popupElement, popupElementIndex, attach) {
27007  if(!ASPx.IsExistsElement(popupElement)) return;
27008  var setReferenceFunction = this.getAttachReferenceFunction(attach);
27009  var setContextMenuReferenceFunction = attach ? ASPx.Evt.AttachContextMenuToElement : ASPx.Evt.DetachContextMenuFromElement;
27010  var windowPopupAction = this.GetWindowPopupAction(index);
27011  if(windowPopupAction == "LeftMouseClick")
27012   setReferenceFunction(popupElement, "mouseup", aspxPEMEvent);
27013  else if(windowPopupAction == "RightMouseClick")
27014   setContextMenuReferenceFunction(popupElement, aspxPEMEvent);
27015  else if(windowPopupAction == "MouseOver") {
27016   var windowElement = this.GetWindowElement(index);
27017   setReferenceFunction(popupElement, "mouseover", ASPx.PopupUtils.OverControl.OnMouseOver);
27018   setReferenceFunction(windowElement, "mouseover", aspxPWEMOver);
27019   if(attach)
27020    this.SetMSTouchMouseOverReference(popupElement, windowElement, this.name, index, this.appearAfter);
27021  }
27022  if(windowPopupAction == "LeftMouseClick" || windowPopupAction == "RightMouseClick") {
27023   setReferenceFunction(popupElement, "mousedown", aspxPEMEvent);
27024  }
27025  if(attach) {
27026   popupElement.DXPopupElementControl = this;
27027   popupElement.DXPopupWindowIndex = index;
27028   popupElement.DXPopupElementIndex = popupElementIndex;
27029  } else
27030   popupElement.DXPopupElementControl = popupElement.DXPopupWindowIndex = popupElement.DXPopupElementIndex = undefined;
27031 },
27032 getAttachReferenceFunction: function(attach) {
27033  return attach ? ASPx.Evt.AttachEventToElement : ASPx.Evt.DetachEventFromElement;
27034 },
27035 SetMSTouchMouseOverReference: function(popupElement, windowElement, popupName, index, appearAfter) {
27036  if(!ASPx.TouchUIHelper.pointerEnabled) return;
27037  popupElement.dxMsTouchGesture = popupElement.dxMsTouchGesture ||
27038   ASPx.TouchUIHelper.msTouchCreateGesturesWrapper(popupElement, function(evt) {
27039    window.setTimeout(function() {
27040     aspxGetPopupControlCollection().SetAppearTimer(popupName, index, popupElement.DXPopupElementIndex, appearAfter, evt);
27041    }, 0);
27042   });
27043  windowElement.dxMsTouchGesture = windowElement.dxMsTouchGesture || ASPx.TouchUIHelper.msTouchCreateGesturesWrapper(windowElement, function(evt) {
27044   window.setTimeout(function() {
27045    aspxGetPopupControlCollection().ClearDisappearTimer();
27046   }, 0);
27047  });
27048 },
27049 GetLastOverPopupElementIndex: function(windowIndex) {
27050  var info = this.GetLastUsedPopupElementInfo(windowIndex);
27051  return ASPx.GetDefinedValue(info.overPEIndex, -1);
27052 },
27053 SetLastOverPopupElementIndex: function(windowIndex, popupElementIndex) {
27054  var info = this.GetLastUsedPopupElementInfo(windowIndex);
27055  info.overPEIndex = popupElementIndex;
27056 },
27057 OnPopupElementMouseOver: function(evt, popupElement) {
27058  if(popupElement != null) {
27059   var index = popupElement.DXPopupWindowIndex;
27060   var isVisible = this.InternalIsWindowVisible(index);
27061   var popupElementIndex = popupElement.DXPopupElementIndex;
27062   if(this.GetLastOverPopupElementIndex(index) != popupElementIndex) {
27063    if(aspxGetPopupControlCollection().IsAppearTimerActive())
27064     aspxGetPopupControlCollection().ClearAppearTimer();
27065    if(aspxGetPopupControlCollection().IsDisappearTimerActive())
27066     aspxGetPopupControlCollection().ClearDisappearTimer();
27067    if(isVisible) {
27068     this.DoHideWindow(index, false, ASPxClientPopupControlCloseReason.MouseOut);
27069     isVisible = false;
27070    }
27071   }
27072   if(!isVisible) {
27073    aspxGetPopupControlCollection().SetAppearTimer(this.name, index, popupElement.DXPopupElementIndex, this.appearAfter, evt);
27074    aspxGetPopupControlCollection().InitOverObject(this, index, evt);
27075   }
27076   this.SetLastOverPopupElementIndex(index, popupElementIndex);
27077  }
27078 },
27079 OnPopupElementMouseOut: function(evt, popupElement) {
27080 },
27081 RemoveAllPopupElements: function() {
27082  this.RemoveWindowAllPopupElements(-1);
27083 },
27084 RemoveWindowAllPopupElements: function(index) {
27085  var popupElements = this.GetPopupElementList(index);
27086  for(var i = 0; i < popupElements.length; i++)
27087   this.RemoveWindowPopupElement(index, popupElements[i]);
27088 },
27089 GetWindowCurrentPopupElementByIndex: function(index) {
27090  var popupElement = this.GetPopupElement(index, this.GetLastShownPopupElementIndex(index));
27091  if(popupElement && popupElement.DXPopupElementControl)
27092   return popupElement;
27093  return null;
27094 },
27095 GetWindowCurrentPopupElementIndexByWindowIndex: function(windowIndex) {
27096  var popupElement = this.GetWindowCurrentPopupElementByIndex(windowIndex);
27097  return popupElement ? popupElement.DXPopupElementIndex : -1;
27098 },
27099 GetIsMaximizedOnWebKitTouch: function(index) {
27100  return false;
27101 },
27102 ProcessAccessibleElementOnHide: function() {
27103  if(this.accessibilityCompliant) {
27104   var focusElement = this.accessibleFocusElement ? this.accessibleFocusElement : this.GetCurrentPopupElement();
27105   ASPx.AccessibilityUtils.SetFocusAccessibleCore(focusElement);
27106   this.accessibleFocusElement = null;
27107  }
27108 },
27109 OnControlsInitialized: function() {
27110  this.InitializeAccessibleNavigationCore();
27111  setTimeout(function() {
27112   ASPx.GetControlCollection().ControlsInitialized.RemoveHandler(this.OnControlsInitialized, this);
27113  }.aspxBind(this), 0);
27114 },
27115 InitializeAccessibleNavigation: function() {
27116  this.Shown.AddHandler(this.InitializeAccessibleNavigationCore.aspxBind(this));
27117 },
27118 InitializeAccessibleNavigationCore: function() {
27119  this.resetFocusableElements();
27120  var focusableElement = this.getFirstFocusableElement();
27121  if(focusableElement) {
27122   var currentWindowContentCell = this.GetWindowContentElement(-1);
27123   var contentFirstActionElement = ASPx.FindFirstChildActionElement(currentWindowContentCell);
27124   if(contentFirstActionElement && contentFirstActionElement !== focusableElement)
27125    focusableElement = contentFirstActionElement;
27126   if(!this.preventAccessibilityFocus)
27127    ASPx.AccessibilityUtils.SetFocusAccessible(focusableElement);
27128   this.SetLoopingFocusHandlers();
27129  }
27130 },
27131 resetFocusableElements: function() {
27132  if(this.firstFocusableElement)
27133   ASPx.Evt.DetachEventFromElement(this.firstFocusableElement, "keydown", this.focusLastElementHandler);
27134  if(this.lastFocusableElement)
27135   ASPx.Evt.DetachEventFromElement(this.lastFocusableElement, "keydown", this.focusFirstElementHandler);
27136  this.firstFocusableElement = null;
27137  this.lastFocusableElement = null;
27138 },
27139 getFirstFocusableElement: function() {
27140  if(!this.firstFocusableElement)
27141   this.firstFocusableElement = ASPx.FindFirstChildActionElement(this.GetCurrentWindowElement());
27142  return this.firstFocusableElement;
27143 },
27144 getLastFocusableElement: function() {
27145  if(!this.lastFocusableElement)
27146   this.lastFocusableElement = ASPx.FindLastChildActionElement(this.GetCurrentWindowElement());
27147  return this.lastFocusableElement;
27148 },
27149 SetLoopingFocusHandlers: function() {
27150  ASPx.Evt.AttachEventToElement(this.getFirstFocusableElement(), "ke
27150ydown", this.focusLastElementHandler);
27151  ASPx.Evt.AttachEventToElement(this.getLastFocusableElement(), "keydown", this.focusFirstElementHandler);
27152 },
27153 loopFocusHandler: function(evt, isLastFocusableElement) {
27154  var keyCode = ASPx.Evt.GetKeyCode(evt);
27155  if(keyCode !== ASPx.Key.Tab)
27156   return;
27157  var targetElement = isLastFocusableElement ? this.getLastFocusableElement() : this.getFirstFocusableElement();
27158  if(ASPx.Evt.GetEventSource(evt) !== targetElement)
27159   return;
27160  var elementToFocus = null;
27161  if(!isLastFocusableElement && evt.shiftKey)
27162   elementToFocus = this.getLastFocusableElement();
27163  else if(isLastFocusableElement && !evt.shiftKey)
27164   elementToFocus = this.getFirstFocusableElement();
27165  if(elementToFocus) {
27166   ASPx.AccessibilityUtils.SetFocusAccessible(elementToFocus);
27167   ASPx.Evt.PreventEventAndBubble(evt);
27168  }
27169 },
27170 getLeftRightBordersAndPaddingsSummaryValue: function(element, currentStyle) {
27171  return ASPx.GetLeftRightBordersAndPaddingsSummaryValue(element, currentStyle);
27172 },
27173 getTopBottomBordersAndPaddingsSummaryValue: function(element, currentStyle) {
27174  return ASPx.GetTopBottomBordersAndPaddingsSummaryValue(element, currentStyle);
27175 },
27176 AdjustModalElementBounds: function(element) {
27177 },
27178 RefreshDimensionsAfterCreateIframe: function(index) {
27179 },
27180 UpdatePositionAfterCallback: function(windowIndex) {
27181 }
27182});
27183ASPxClientPopupControlBase.AnimationType = {
27184 Fade: "fade",
27185 Slide: "slide",
27186 Auto: "auto",
27187 None: "none"
27188};
27189var ASPxClientPopupControl = ASPx.CreateClass(ASPxClientPopupControlBase, {
27190 constructor: function(name) {
27191  this.constructor.prototype.constructor.call(this, name);
27192  this.popupActionArray = [];
27193  this.windowsPopupElementIDList = [];
27194  this.windowsPopupElementList = [];
27195  this.windowsLastUsedPopupElementInfoList = [];
27196  this.windowsIsPopupedList = [];
27197  this.windowsPopupReasonMouseEventList = [];
27198  this.defaultPopupReasonMouseEvent = null;
27199  this.modal = false;
27200  this.modalArray = [];
27201  this.isDraggedArray = [];
27202  this.closeActionArray = [];
27203  this.showOnPageLoadArray = [];
27204  this.windows = [];
27205  this.windowCount = 0;
27206  this.closeOnEscapeArray = [];
27207  this.leftArray = [];
27208  this.contentUrlArray = [];
27209  this.contentUrlIFrameTitleArray = [];
27210  this.iframeLoadingArray = [];
27211  this.iframeAdjustingPostponedArray = [];
27212  this.isResizedArray = [];
27213  this.zIndexArray = [];
27214  this.topArray = [];
27215  this.shownArray = [];
27216  this.heightArray = [];
27217  this.widthArray = [];
27218  this.widthFromServer = false;
27219  this.widthFromServerArray = [];
27220  this.minHeightArray = [];
27221  this.minWidthArray = [];
27222  this.maxHeightArray = [];
27223  this.maxWidthArray = [];
27224  this.hideBodyScrollWhenModal = true;
27225  this.hideBodyScrollWhenModalArray = [];
27226  this.hideBodyScrollWhenMaximized = true;
27227  this.canScrollViewPort = false;
27228  this.canScrollViewPortArray = [];
27229  this.autoUpdatePositionArray = [];
27230  this.cachedSizeArray = [];
27231  this.enableContentScrollingArray = [];
27232  this.contentOverflowXArray = [];
27233  this.contentOverflowYArray = [];
27234  this.isPinned = false;
27235  this.isPinnedArray = [];
27236  this.pinX = 0;
27237  this.pinXArray = [];
27238  this.pinY = 0;
27239  this.pinYArray = [];
27240  this.lockScroll = 0;
27241  this.isCollapsed = false;
27242  this.isCollapsedArray = [];
27243  this.isCollapsedInit = false;
27244  this.isCollapsedInitArray = [];
27245  this.collapseExecutingLockCount = 0;
27246  this.isMaximized = false;
27247  this.isMaximizedArray = [];
27248  this.isMaximizedInit = false;
27249  this.isMaximizedInitArray = [];
27250  this.maximizationExecutingLockCount = 0;
27251  this.restoredWindowValues = {};
27252  this.restoredWindowValuesArray = [];
27253  this.browserResizingForMaxWindowLockCount = 0;
27254  this.updateRestoredWindowSizeLockCount = 0;
27255  this.touchUIScrollers = {};
27256  this.adaptivityEnabled = false;
27257  this.DefaultModalMaxWidth = 500;
27258  this.DefaultModalMinWidth = 0;
27259  this.stretchVertically = false;
27260  this.stretchVerticallyArray = [];
27261  this.fixedHeader = true;
27262  this.fixedHeaderArray = [];
27263  this.fixedFooter = true;
27264  this.fixedFooterArray = [];
27265  this.modalMinHeight = null;
27266  this.modalMinHeightArray = [];
27267  this.modalMinWidth = null;
27268  this.modalMinWidthArray = [];
27269  this.modalMaxHeight = null;
27270  this.modalMaxHeightArray = [];
27271  this.modalMaxWidth = null;
27272  this.modalMaxWidthArray = [];
27273  this.modalVerticalAlign = ModalAlign.WindowTop;
27274  this.modalHorizontalAlign = ModalAlign.WindowCenter;
27275  this.adaptiveModalMode = false;
27276  this.adaptiveModalModeArray = [];
27277  this.switchAtWindowInnerWidth = ASPx.MaxMobileWindowWidth;
27278  this.PinnedChanged = new ASPxClientEvent();
27279  this.AdaptiveModeChanged = new ASPxClientEvent();
27280 },
27281 SetData: function(data){
27282  if(data.windows)
27283   this.CreateWindows(data.windows);
27284 },
27285 InlineInitialize: function() {
27286  ASPxClientControl.prototype.InlineInitialize.call(this);
27287  this.InitializeArrayCores();
27288 },
27289 Initialize: function() {
27290  ASPxClientPopupControlBase.prototype.Initialize.call(this);
27291  aspxGetPopupControlCollection().EnsureSaveScrollState();
27292  if(this.HasDefaultWindow())
27293   this.InitializeWindow(-1);
27294  for(var i = 0; i < this.GetWindowCount() ; i++)
27295   this.InitializeWindow(i);
27296  this.InitializeScrollbars();
27297 },
27298 InitializeEnableContentScrolling: function() {
27299  for(var windowIndex = 0; windowIndex < this.GetWindowCount() ; windowIndex++) {
27300   var contentOverflowX = this.GetWindowOverflowX(windowIndex);
27301   var contentOverflowY = this.GetWindowOverflowY(windowIndex);
27302   this.enableContentScrollingArray.push(contentOverflowX != "None" || contentOverflowY != "None");
27303  }
27304  ASPxClientPopupControlBase.prototype.InitializeEnableContentScrolling.call(this);
27305 },
27306 InitializeScrollbars: function() {
27307  if(!ASPx.Browser.WebKitTouchUI && !ASPx.Browser.MSTouchUI && (!ASPx.Browser.WindowsPhonePlatform || !ASPx.Browser.IE))
27308   return;
27309  this.ForEachWindow(function(windowIndex) {
27310   if(this.GetEnableContentScrolling(windowIndex)) {
27311    var scrollElement = this.getTouchScrollerElement(windowIndex);
27312    if(scrollElement) {
27313     if(ASPx.Browser.MSTouchUI)
27314      scrollElement.style.touchAction = "auto";
27315     else {
27316      var options = this.GetWindowTouchScrollOptions(windowIndex);
27317      if(!this.HasIframeOnIos(windowIndex))
27318       this.touchUIScrollers[windowIndex] = ASPx.TouchUIHelper.MakeScrollable(scrollElement, options);
27319     }
27320    }
27321   }
27322  }.aspxBind(this));
27323 },
27324 GetWindowTouchScrollOptions: function (index) {
27325  var contentOverflowX = this.GetWindowOverflowX(index),
27326   contentOverflowY = this.GetWindowOverflowY(index);
27327  return {
27328   showHorizontalScrollbar: contentOverflowX === "Auto" || contentOverflowX === "Scroll",
27329   showVerticalScrollbar: contentOverflowY === "Auto" || contentOverflowY === "Scroll"
27330  };
27331 },
27332 ForEachWindow: function(callback) {
27333  var indices = [];
27334  if(this.HasDefaultWindow())
27335   indices.push(-1);
27336  else {
27337   for(var i = 0; i < this.GetWindowCount(); i++)
27338    indices.push(i);
27339  }
27340  ASPx.Data.ForEach(indices, callback);
27341 },
27342 GetMainElementId: function() {
27343  return null;
27344 },
27345 preventParentOverlowOnIos: function(index) {
27346  if(!ASPx.Browser.MacOSMobilePlatform) return;
27347  var parent = this.getParentPopupControl(index);
27348  if(parent) 
27349   parent.popupControl.changeContentOverflow(parent.windowIndex);
27350 },
27351 restoreParentOverflowOnIos: function(index) {
27352  if(!ASPx.Browser.MacOSMobilePlatform) return;
27353  var parent = this.getParentPopupControl(index);
27354  if(parent) 
27355   parent.popupControl.restoreContentOverflow(parent.windowIndex);
27356 },
27357 changeContentOverflow: function(index) {
27358  var scrollerElement = this.getTouchScrollerElement(index);
27359  if(!scrollerElement) return;
27360  ASPx.Attr.ChangeStyleAttribute(scrollerElement, "overflow", "visible");
27361  ASPx.Attr.ChangeStyleAttribute(scrollerElement, "overflowX", "visible");
27362  ASPx.Attr.ChangeStyleAttribute(scrollerElement, "overflowY", "visible");
27363 },
27364 restoreContentOverflow: function(index) {
27365  var scrollerElement = this.getTouchScrollerElement(index);
27366  if(!scrollerElement) return;
27367  ASPx.Attr.RestoreStyleAttribute(scrollerElement, "overflow");
27368  ASPx.Attr.RestoreStyleAttribute(scrollerElement, "overflowX");
27369  ASPx.Attr.RestoreStyleAttribute(scrollerElement, "overflowY");
27370 },
27371 UpdateScrollbar: function(index) {
27372  var touchUIScroller = this.touchUIScrollers[index];
27373  if(!touchUIScroller)
27374   return;
27375  var scrollElement = this.GetContentContainer(index);
27376  if(scrollElement)
27377   touchUIScroller.ChangeElement(scrollElement);
27378 },
27379 InitializeArrayCores: function() {
27380  if(this.GetWindowCountCore() > 0) {
27381   this.InitializeWindowPopupElementList();
27382   this.InitializeWindowPopupElementIDList();
27383   this.InitializeWindowLastUsedPopupElementInfoList();
27384   this.InitializeArray(this.shownArray);
27385   this.InitializeArray(this.windowsPopupReasonMouseEventList, null);
27386   this.InitializeArray(this.windowsIsPopupedList, false);
27387   this.InitializeArray(this.contentUrlArray, "");
27388   this.InitializeArray(this.contentUrlIFrameTitleArray, "");
27389   this.InitializeArray(this.popupActionArray, this.popupAction);
27390   this.InitializeArray(this.closeActionArray, this.closeAction);
27391   this.InitializeArray(this.showOnPageLoadArray, false);
27392   this.InitializeArray(this.isDraggedArray, false);
27393   this.InitializeArray(this.isPinnedArray, false);
27394   this.InitializeArray(this.isCollapsedArray, false);
27395   this.InitializeArray(this.isCollapsedInitArray, false);
27396   this.InitializeArray(this.isMaximizedArray, false);
27397   this.InitializeArray(this.isMaximizedInitArray, false);
27398   this.InitializeArray(this.restoredWindowValuesArray, {});
27399   this.InitializeArray(this.iframeAdjustingPostponedArray, {});
27400   this.InitializeArray(this.isResizedArray, false);
27401   this.InitializeArray(this.zIndexArray, -1);
27402   this.InitializeArray(this.leftArray, 0);
27403   this.InitializeArray(this.topArray, 0);
27404   this.InitializeArray(this.widthArray, constants.DEFAULT_WINDOW_WIDTH);
27405   this.InitializeArray(this.heightArray, constants.DEFAULT_WINDOW_HEIGHT);
27406   this.InitializeArray(this.widthFromServerArray, false);
27407   this.InitializeArray(this.pinXArray, 0);
27408   this.InitializeArray(this.pinYArray, 0);
27409   this.InitializeArray(this.minWidthArray, null);
27410   this.InitializeArray(this.minHeightArray, null);
27411   this.InitializeArray(this.maxWidthArray, null);
27412   this.InitializeArray(this.maxHeightArray, null);
27413   this.InitializeArray(this.cachedSizeArray, null);
27414   this.InitializeArray(this.iframeLoadingArray, false);
27415   this.InitializeArray(this.autoUpdatePositionArray, false);
27416   this.InitializeArray(this.hideBodyScrollWhenModalArray, true);
27417   this.InitializeArray(this.canScrollViewPortArray, false);
27418   this.InitializeArray(this.closeOnEscapeArray, this.closeOnEscape);
27419   this.InitializeArray(this.modalArray, false);
27420   this.InitializeArray(this.adaptiveModalModeArray, false);
27421   this.InitializeArray(this.fixedHeaderArray, true);
27422   this.InitializeArray(this.fixedFooterArray, true);
27423   this.InitializeArray(this.modalMinWidthArray, null);
27424   this.InitializeArray(this.modalMinHeightArray, null);
27425   this.InitializeArray(this.modalMaxWidthArray, null);
27426   this.InitializeArray(this.modalMaxHeightArray, null);
27427   this.InitializeArray(this.stretchVerticallyArray, false);
27428  }
27429 },
27430 InitializeArray: function(array, defaultValue) {
27431  if(array.length == 0) {
27432   for(var i = 0; i < this.GetWindowCountCore() ; i++)
27433    array[i] = defaultValue;
27434  }
27435 },
27436 InitializeWindowPopupElementIDList: function() {
27437  for(var i = 0; i < this.GetWindowCountCore() ; i++) {
27438   if(!this.windowsPopupElementIDList[i])
27439    this.windowsPopupElementIDList[i] = [];
27440  }
27441 },
27442 InitializeWindowPopupElementList: function() {
27443  for(var i = 0; i < this.GetWindowCountCore() ; i++) {
27444   if(!this.windowsPopupElementList[i])
27445    this.windowsPopupElementList[i] = [];
27446  }
27447 },
27448 InitializeWindowLastUsedPopupElementInfoList: function() {
27449  for(var i = 0; i < this.GetWindowCountCore() ; i++) {
27450   if(!this.windowsLastUsedPopupElementInfoList[i])
27451    this.windowsLastUsedPopupElementInfoList[i] = {};
27452  }
27453 },
27454 AllowMouseDown: function(evt, index) {
27455  return ASPxClientPopupControlBase.prototype.AllowMouseDown.call(this, evt, index) &&
27456   !this.PreventHeaderButtonMouseDownBubbling(evt, this.GetWindowPinButton(index)) &&
27457   !this.PreventHeaderButtonMouseDownBubbling(evt, this.GetWindowCollapseButton(index)) &&
27458   !this.PreventHeaderButtonMouseDownBubbling(evt, this.GetWindowMaximizeButton(index));
27459 },
27460 AssignHeaderButtonsEvents: function(index) {
27461  ASPxClientPopupControlBase.prototype.AssignHeaderButtonsEvents.call(this, index);
27462  this.AttachClickToHeaderButton(index, this.GetWindowPinButton(index), "ASPx.PWPBClick");
27463  this.AttachClickToHeaderButton(index, this.GetWindowCollapseButton(index), "ASPx.PWMNBClick");
27464  this.AttachClickToHeaderButton(index, this.GetWindowMaximizeButton(index), "ASPx.PWMXBClick");
27465 },
27466 InitializeWindow: function(index) {
27467  ASPxClientPopupControlBase.prototype.InitializeWindow.call(this, index);
27468  if(this.adaptivityEnabled) {
27469   ASPx.Evt.AttachEventToElement(this.GetModalWrapperElement(index), "scroll", function(e) { this.OnModalWrapperScroll(e, index); }.aspxBind(this));
27470   if(ASPx.Browser.WebKitTouchUI) {
27471    ASPx.Evt.AttachEventToElement(this.GetModalWrapperElement(index), "touchstart", function(e) { this.OnModalWrapperTouchStart(e); }.aspxBind(this));
27472    ASPx.Evt.AttachEventToElement(this.GetModalWrapperElement(index), "touchmove", function(e) { this.OnModalWrapperTouchMove(e, index); }.aspxBind(this));
27473   }
27474  } else {
27475   var modalElement = this.GetWindowModalElement(index);
27476   if(modalElement)
27477    ASPx.Evt.AttachEventToElement(modalElement, "mousedown", aspxPWMEMDown);
27478  }
27479 },
27480 BrowserWindowResizeSubscriber: function() {
27481  return true;
27482 },
27483 OnBrowserWindowResize: function(e) {
27484  window.setTimeout(this.SetPopupMaximizedPositionOnBrowserResize.aspxBind(this), 0);
27485  this.ForEachWindow(this.updateContentScrollIfNeeded.aspxBind(this));
27486 },
27487 SetPopupMaximizedPositionOnBrowserResize: function() {
27488  this.ForEachWindow(this.SetMaximizedPositionOnBrowserResize.aspxBind(this));
27489 },
27490 UpdateResizeCursor: function(index, element, verticalDirection, horizontalDirection) {
27491  if(this.GetAdaptiveModalMode(index))
27492   this.HideTemporaryCursor(element);
27493  else
27494   ASPxClientPopupControlBase.prototype.UpdateResizeCursor.call(this, index, element, verticalDirection, horizontalDirection);
27495 },
27496 SetMaximizedPositionOnBrowserResize: function(index) {
27497  var element = this.GetWindowElement(index);
27498  if(element && this.GetIsMaximized(index) && this.InternalIsWindowVisible(index)) {
27499   var left = this.GetMaximizedPosition(element, true);
27500   var top = this.GetMaximizedPosition(element, false);
27501   this.SetWindowPos(index, element, left, top);
27502  }
27503 },
27504 InitCollapsedWindows: function(index) {
27505  if((this.isCollapsedInit && index == -1) || (index >= 0 && index < this.isCollapsedInitArray.length && this.isCollapsedInitArray[index])) {
27506   if(this.InternalIsWindowVisible(index)) {
27507    this.DoCollapse(index, true);
27508    if(index == -1)
27509     this.isCollapsedInit = false;
27510    else
27511     this.isCollapsedInitArray[index] = false;
27512   }
27513  }
27514 },
27515 InitMaximizedWindows: function(index) {
27516  if(this.GetIsMaximizedInit(index) && this.InternalIsWindowVisible(index)) {
27517   this.DoMaximize(index, true);
27518   this.SetIsMaximizedInit(index, false);
27519  }
27520 },
27521 InitPinnedWindows: function(index) {
27522  if((this.isPinned && index == -1) || (index >= 0 && index < this.isPinnedArray.length && this.isPinnedArray[index]))
27523   this.HoldPosition(index, true);
27524 },
27525 AfterInitializeWindow: function(index) {
27526  if(this.contentOverflowX !== "None" && !this.GetWindowWidthFromServer(index))
27527   this.SetWindowWidth(index, 0);
27528  ASPxClientPopupControlBase.prototype.AfterInitializeWindow.call(this, index);
27529  this.InitPinnedWindows(index);
27530  this.InitMaximizedWindows(index);
27531  this.InitCollapsedWindows(index);
27532 },
27533 OnDragStop: function(index) {
27534  ASPxClientPopupControlBase.prototype.OnDragStop.call(this, index);
27535  if(this.adaptivityEnabled)
27536   ASPxClientPopupControl.WindowResizeHelper.Initialize(this.GetWindowElement(index));
27537  else
27538   this.updateContentScrollIfNeeded(index);
27539 },
27540 GetPropertyValue: function(index, propName) {
27541  if(0 <= index && index < this.GetWindowCountCore())
27542   return this[propName + "Array"][index];
27543  return ASPxClientPopupControlBase.prototype.GetPropertyValue.call(this, index, propName);
27544 },
27545 SetPropertyValue: function(index, propName, value) {
27546  if(0 <= index && index < this.GetWindowCountCore())
27547   this[propName + "Array"][index] = value;
27548  else
27549   ASPxClientPopupControlBase.prototype.SetPropertyValue.call(this, index, propName, value);
27550 },
27551 GetAdaptiveModalMode: function(index) {
27552  return this.GetPropertyValue(index, "adaptiveModalMode");
27553 },
27554 GetAutoUpdatePosition: function(index) {
27555  return this.GetPropertyValue(index, "autoUpdatePosition") && !this.GetAdaptiveModalMode(index);
27556 },
27557 SetAdaptiveModalMode: function(index, enabled) {
27558  ASPx.ToggleClassNameToElement(this.GetModalWrapperElement(index), this.GetModalSystemCssClass(), enabled);
27559  this.SetPropertyValue(index, "adaptiveModalMode", enabled);
27560 },
27561 GetIsPinned: function(index) {
27562  return this.GetPropertyValue(index, "isPinned");
27563 },
27564 SetIsPinned: function(index, value) {
27565  this.SetPropertyValue(index, "isPinned", value);
27566 },
27567 GetPinPosX: function(index) {
27568  return this.GetPropertyValue(index, "pinX");
27569 },
27570 SetPinPosX: function(index, pinX) {
27571  this.SetPropertyValue(index, "pinX", pinX);
27572 },
27573 GetPinPosY: function(index) {
27574  return this.GetPropertyValue(index, "pinY");
27575 },
27576 SetPinPosY: function(index, pinY) {
27577  this.SetPropertyValue(index, "pinY", pinY);
27578 },
27579 GetIsCollapsed: function(index) {
27580  return this.GetPropertyValue(index, "isCollapsed");
27581 },
27582 SetIsCollapsed: function(index, value) {
27583  this.SetPropertyValue(index, "isCollapsed", value);
27584 },
27585 GetIsMaximized: function(index) {
27586  return this.GetPropertyValue(index, "isMaximized");
27587 },
27588 GetIsMaximizedOnWebKitTouch: function(index) {
27589  return this.GetIsMaximized(index) && ASPx.Browser.WebKitTouchUI;
27590 },
27591 SetIsMaximized: function(index, value) {
27592  this.SetPropertyValue(index, "isMaximized", value);
27593 },
27594 GetIsMaximizedInit: function(index) {
27595  return this.GetPropertyValue(index, "isMaximizedInit");
27596 },
27597 SetIsMaximizedInit: function(index, value) {
27598  this.SetPropertyValue(index, "isMaximizedInit", value);
27599 },
27600 GetRestoredWindowData: function(index) {
27601  return ASPx.CloneObject(this.GetPropertyValue(index, "restoredWindowValues"));
27602 },
27603 GetEnableContentScrolling: function(index) {
27604  return this.GetPropertyValue(index, "enableContentScrolling");
27605 },
27606 GetWindowOverflowX: function(index) {
27607  return this.GetPropertyValue(index, "contentOverflowX");
27608 },
27609 GetWindowOverflowY: function(index) {
27610  return this.GetPropertyValue(index, "contentOverflowY");
27611 },
27612 SetRestoredWindowData: function(index, value) {
27613  this.SetPropertyValue(index, "restoredWindowValues", value);
27614 },
27615 GetWindowIsShown: function(index) {
27616  return this.GetPropertyValue(index, "shown");
27617 },
27618 SetWindowIsShown: function(index, shown) {
27619  this.SetPropertyValue(index, "shown", shown);
27620 },
27621 GetWindowWidthFromServer: function(index) {
27622  return this.GetPropertyValue(index, "widthFromServer");
27623 },
27624 GetHideBodyScrollWhenModal: function(index) {
27625  return this.GetPropertyValue(index, "hideBodyScrollWhenModal");
27626 },
27627 SetHideBodyScrollWhenModal: function(index, value) {
27628  this.SetPropertyValue(index, "hideBodyScrollWhenModal", value);
27629 },
27630 GetCanScrollViewPort: function(index) {
27631  return this.GetPropertyValue(index, "canScrollViewPort");
27632 },
27633 HasDefaultWindow: function() {
27634  return this.GetWindowCountCore() === 0;
27635 },
27636 GetWindowFooterHeightLite: function(index) {
27637  var footer = this.GetWindowFooterElement(index);
27638  if(footer)
27639   return footer.offsetHeight;
27640  return null;
27641 },
27642 SetWindowPopUpReasonMouseEvent: function(index, evt) {
27643  evt = ASPx.CloneObject(evt);
27644  if(evt === undefined)
27645   evt = null;
27646  if(0 <= index && index < this.GetWindowCountCore())
27647   this.windowsPopupReasonMouseEventList[index] = evt;
27648  this.defaultPopupReasonMouseEvent = evt;
27649 },
27650 GetPopUpReasonMouseEvent: function() {
27651  return this.GetWindowPopUpReasonMouseEvent(null);
27652 },
27653 GetWindowPopUpReasonMouseEvent: function(window) {
27654  var index = (window != null) ? window.index : -1;
27655  if(0 <= index && index < this.GetWindowCountCore())
27656   return this.windowsPopupReasonMouseEventList[index];
27657  return this.defaultPopupReasonMouseEvent;
27658 },
27659 GetWindowCountCore: function() {
27660  return (this.windows.length > 0) ? this.windows.length : this.windowCount;
27661 },
27662 SetClientModality: function(isModal) {
27663  this.SetWindowClientModality(-1, isModal);
27664 },
27665 SetWindowClientModality: function(index, isModal) {
27666  var modalElement = this.GetWindowModalElement(index);
27667  if(isModal && !ASPx.IsElementVisible(modalElement))
27668   this.DoShowWindowModalElement(index);
27669  if(!isModal && ASPx.IsElementVisible(modalElement)) {
27670   var element = this.GetWindowElement(index);
27671   this.DoHideWindowModalElement(element);
27672  }
27673 },
27674 GetWindowPinButton: function(index) {
27675  return ASPx.GetElementById(this.name + "_HPB" + index);
27676 },
27677 GetWindowCollapseButton: function(index) {
27678  return ASPx.GetElementById(this.name + "_HMNB" + index);
27679 },
27680 GetWindowMaximizeButton: function(index) {
27681  return ASPx.GetElementById(this.name + "_HMXB" + index);
27682 },
27683 GetWindowScrollDiv: function(index) {
27684  return this.GetWindowChild(index, "_CSD" + index);
27685 },
27686 GetWindowElementDisplayValue: function(windowHasAnyScrollbars, windowHeight) {
27687  return windowHasAnyScrollbars && windowHeight ? "block" : "table";
27688 },
27689 GetMainWindowWidth: function(index, noCache) {
27690  return this.GetClientWindowWidth(index, true, noCache);
27691 },
27692 GetClientWindowWidth: function(index, outerSize, noCache) {
27693  if(!noCache && (this.GetIsCollapsed(index) || this.GetIsMaximized(index))) {
27694   var cachedSize = this.GetWindowCachedSize(index);
27695   if(cachedSize != null)
27696    return cachedSize.width;
27697  }
27698  var element = this.GetWindowElement(index);
27699  if(element != null)
27700   return element.offsetWidth;
27701 },
27702 GetMainWindowHeight: function(index, noCache) {
27703  return this.GetClientWindowHeight(index, true, noCache);
27704 },
27705 GetClientWindowHeight: function(index, outerSize, noCache) {
27706  if(!noCache && (this.GetIsCollapsed(index) || this.GetIsMaximized(index))) {
27707   var cachedSize = this.GetWindowCachedSize(index);
27708   if(cachedSize != null)
27709    return cachedSize.height;
27710  }
27711  var element = this.GetWindowElement(index);
27712  if(element != null)
27713   return element.offsetHeight;
27714 },
27715 ShowModal: function() {
27716  this.ShowModalByIndex(-1);
27717 },
27718 ShowModalByIndex: function(index) {
27719  if(this.adaptivityEnabled) {
27720   this.SetAdaptiveModalMode(index, true);
27721   this.ResetModalStyles(index);
27722   this.ResetPopupStyles(index);
27723   this.DoShowModal(index, ASPx.InvalidPosition, ASPx.InvalidPosition, this.GetLastShownPopupElementIndex(index));
27724  }
27725 },
27726 DoShowWindowCore: function(index, x, y, popupElementIndex, closeOtherWindows, allowChangeZIndex, evt, closeOtherReason) {
27727  if(this.IsDOMDisposed()) return;
27728  this.SetWindowPopUpReasonMouseEvent(index, evt);
27729  if(this.adaptivityEnabled) {
27730   this.SetAdaptiveModalMode(index, this.NeedAdaptiveModalMode(index));
27731   this.ResetModalStyles(index);
27732   if(this.GetAdaptiveModalMode(index)) {
27733    this.ResetPopupStyles(index);
27734    this.DoShowModal(index, x, y, popupElementIndex);
27735    return;
27736   }
27737  }
27738  this.DoShowWindowAtPos(index, x, y, popupElementIndex, closeOtherWindows, allowChangeZIndex, evt, closeOtherReason);
27739 },
27740 NeedAdaptiveModalMode: function(index) {
27741  return window.innerWidth < this.GetSwitchAtWindowInnerWidth();
27742 },
27743 GetSwitchAtWindowInnerWidth: function() {
27744  return this.switchAtWindowInnerWidth;
27745 },
27746 GetModalSystemCssClass: function() {
27747  return "dxmodalSys";
27748 },
27749 DoShowWindowAtPos: function(index, x, y, popupElementIndex, closeOtherWindows, allowChangeZIndex, evt, closeOtherReason) {
27750  if(!this.isInitialized)
27751   this.PopulatePopupElements(index);
27752  var element = this.GetWindowElement(index);
27753  if(element != null && this.IsWindowElementsIDAssigned(index)) {
27754   this.StopCloseAnimation(index);
27755   this.PrepareToAdjustContentOnShow(index);
27756   if(closeOtherWindows)
27757    aspxGetPopupControlCollection().DoHideAllWindows(element, this.GetWindowElementId(index), false, closeOtherReason, 0);
27758   var isMoving = this.InternalIsWindowVisible(index);
27759   ASPx.SetElementDisplay(element, true);
27760   element.style.display = this.GetWindowElementDisplayValue(this.HasAnyScrollBars(index), this.GetPopupWindowDimensionFromCache(index, false));
27761   element.style.position = "absolute";
27762   var scrollDiv = this.GetWindowScrollDiv(index),
27763    shouldResetScrollSize = scrollDiv && this.GetEnableContentScrolling(index) && ASPx.GetDocumentMaxClientHeight() <= element.offsetHeight,
27764    savedScrollDivHeight = shouldResetScrollSize && scrollDiv.style.height;
27765   if(shouldResetScrollSize)
27766    scrollDiv.style.height = 0;
27767   this.RestoreWindowSizeFromCache(index);
27768   if(!this.GetWindowIsShown(index)) {
27769    var width = this.GetPopupWindowDimensionFromCache(index, true),
27770     height = this.GetPopupWindowDimensionFromCache(index, false);
27771    this.SetClientWindowSizeCoreLite(index, width, height);
27772    this.SetWindowIsShown(index, true);
27773   }
27774   var popupElement = this.GetPopupElement(index, popupElementIndex);
27775   if(popupElement)
27776    this.SetLastShownPopupElementIndex(index, popupElementIndex);
27777   if(this.GetIsMaximized(index)) {
27778    if(this.hideBodyScrollWhenMaximized)
27779     ASPx.PopupUtils.BodyScrollHelper.HideBodyScroll(element.id);
27780    this.NormalizeMaximizedWindowSize(index);
27781   }
27782   var isDragged = this.GetIsDragged(index);
27783   var horizontalPopupPosition = this.GetClientPopupPos(element, popupElement, x, true, isDragged);
27784   var verticalPopupPosition = this.GetClientPopupPos(element, popupElement, y, false, isDragged);
27785   var clientX = horizontalPopupPosition.position;
27786   var clientY = verticalPopupPosition.position;
27787   this.SetWindowPos(index, element, clientX, clientY);
27788   if(shouldResetScrollSize)
27789    scrollDiv.style.height = savedScrollDivHeight;
27790   this.DoShowWindowModalElement(index);
27791   this.SetVisibleWithAnimation(element, isMoving, index, horizontalPopupPosition, verticalPopupPosition);
27792   this.ShowWindowContentUrl(index);
27793   this.AdjustContentOnShow(index);
27794   scrollDiv = this.GetWindowScrollDiv(index);
27795   if(scrollDiv && this.GetEnableContentScrolling(index)) {
27796    var dimension = null;
27797    var windowMainCell = this.GetWindowMainCell(element);
27798    if(windowMainCell.style.width && windowMainCell.style.height)
27799     dimension = 'both';
27800    else if(windowMainCell.style.width)
27801     dimension = 'width';
27802    else if(windowMainCell.style.height)
27803     dimension = 'height';
27804    if(!dimension)
27805     return;
27806    ASPx.SetElementDisplay(scrollDiv, false);
27807    this.SetWindowScrollDivSize(scrollDiv, index, dimension);
27808    ASPx.SetElementDisplay(scrollDiv, true);
27809   }
27810   this.registerAndActivateWindow(element, index, allowChangeZIndex);
27811   this.RaisePopupOnShow(isMoving, index);
27812   this.CorrectWindowSizeGripPositionLite(index);
27813   this.CorrectWindowHeaderText(index);
27814   this.InitMaximizedWindows(index);
27815   this.InitCollapsedWindows(index);
27816   if(this.GetIsPinned(index)) window.setTimeout(function() { this.HoldPosition(index, true); }.aspxBind(this), 0);
27817   if(!this.GetShowOnPageLoad(index))
27818    this.CorrectElementVerticalAlignment(ASPx.AdjustVerticalMarginsInContainer, this.GetWindowHeaderElement(index));
27819   if(element.style.width.indexOf("px") > -1) {
27820    element.style.width = ASPx.GetCurrentStyle(element).width;
27821   }
27822   this.updateContentScrollIfNeeded(index);
27823  }
27824 },
27825 DoShowModal: function(index, x, y, popupElementIndex) {
27826  var element = this.GetWindowElement(index);
27827  if(element != null) {
27828   this.StopCloseAnimation(index);
27829   this.EnsureIframeOnIosContentOverflow(index);
27830   this.PrepareToAdjustContentOnShow(index);
27831   if(!ASPx.Browser.WebKitTouchUI)
27832    ASPx.PopupUtils.BodyScrollHelper.HideBodyScroll(element.id);
27833   this.DoShowWindowModalElement(index);
27834   var isMoving = this.InternalIsWindowVisible(index);
27835   ASPx.SetElementDisplay(this.GetModalWrapperElement(index), true);
27836   this.ResetScroll(index);
27837   ASPx.SetElementDisplay(element, true);
27838   this.SetSizeBeforeShow(index);
27839   this.UpdateAlignment(index);
27840   var popupElement = this.GetPopupElement(index, popupElementIndex);
27841   if(popupElement)
27842    this.SetLastShownPopupElementIndex(index, popupElementIndex);
27843   this.SetContentElementsAdaptiveDisplayStyle(index);
27844   var horizontalPopupPosition = this.GetClientPopupPos(element, popupElement, x, true, false),
27845    verticalPopupPosition = this.GetClientPopupPos(element, popupElement, y, false, false);
27846   this.SetVisibleWithAnimation(element, isMoving, index, horizontalPopupPosition, verticalPopupPosition);
27847   this.ShowWindowContentUrl(index);
27848   this.AdjustContentOnShow(index);
27849   this.registerAndActivateWindow(element, index, true);
27850   this.RaisePopupOnShow(isMoving, index);
27851   this.CorrectWindowHeaderText(index);
27852   if(!this.GetShowOnPageLoad(index))
27853    this.CorrectElementVerticalAlignment(ASPx.AdjustVerticalMarginsInContainer, this.GetWindowHeaderElement(index));
27854  }
27855 },
27856 EnsureIframeOnIosContentOverflow: function(index) {
27857  if(this.HasIframeOnIos(index)) {
27858   var contentElement = this.GetWindowContentElement(index);
27859   if(contentElement.style.overflow === "")
27860    contentElement.style.overflow = "auto";
27861  }
27862 },
27863 SetWindowElementZIndex: function(element, zIndex) {
27864  ASPxClientPopupControlBase.prototype.SetWindowElementZIndex.call(this, element, zIndex);
27865  if(this.adaptivityEnabled)
27866   this.SetModalWrapperZIndex(this.GetWindowIndex(element), zIndex);
27867  else
27868   this.updateContentScrollIfNeeded(this.GetWindowIndex(element));
27869 },
27870 SetModalWrapperZIndex: function(index, zIndex) {
27871  if(!this.GetAdaptiveModalMode(index)) return;
27872  ASPx.SetStyles(this.GetModalWrapperElement(index), {
27873   zIndex: zIndex
27874  });
27875 },
27876 updateContentScrollIfNeeded: function(index) {
27877  var windowElement = this.GetWindowElement(index);
27878  var wrapper = this.getWindowWrapper(windowElement);
27879  var wrapperScroll = this.getWindowWrapperScroll(windowElement);
27880  if(!wrapper || !this.WindowIsModal(index) || !this.GetHideBodyScrollWhenModal(index))
27881   return;
27882  ASPx.PopupUtils.adjustViewportScrollWrapper(wrapper, wrapperScroll, windowElement);
27883 },
27884 getWindowWrapper: function(windowElement) {
27885  return ASPx.GetParentByClassName(windowElement, PopupControlCssClasses.WindowWrapperCssClassName);
27886 },
27887 getWindowWrapperScroll: function(windowElement) {
27888  return ASPx.GetParentByClassName(windowElement, PopupControlCssClasses.WindowWrapperScrollCssClassName);
27889 },
27890 SizeCanBeSet: function(index, isWindowMaximizedAndCollapsed) {
27891  return ASPxClientPopupControlBase.prototype.SizeCanBeSet.call(this, index, isWindowMaximizedAndCollapsed) && !this.GetAdaptiveModalMode(index);
27892 },
27893 GetPopupWindowDimensionFromCache: function(index, isWidth) {
27894  var dimension;
27895  if(isWidth) {
27896   dimension = this.GetWindowWidthInternal(index);
27897   if(ASPx.IsExists(dimension)) {
27898    dimension = Math.max(dimension, this.GetWindowMinWidth(index));
27899    var maxWidth = this.GetWindowMaxWidth(index);
27900    if(maxWidth)
27901     dimension = Math.min(dimension, maxWidth);
27902   }
27903  }
27904  else {
27905   dimension = this.GetWindowHeightInternal(index);
27906   if(ASPx.IsExists(dimension)) {
27907    if(this.HasAnyScrollBars(index) && dimension === constants.DEFAULT_WINDOW_HEIGHT)
27908     return undefined;
27909    dimension = Math.max(dimension, this.GetWindowMinHeight(index));
27910    var maxHeight = this.GetWindowMaxHeight(index);
27911    if(maxHeight)
27912     dimension = Math.min(dimension, maxHeight);
27913   }
27914  }
27915  return dimension;
27916 },
27917 NormalizeMaximizedWindowSize: function(index) {
27918  var width = this.GetPopupWindowDimensionFromCache(index, true),
27919   height = this.GetPopupWindowDimensionFromCache(index, false),
27920   dimensions = this.getDocumentDimensions(index),
27921   sizeNormalizationIsNeeded = width < dimensions.width || height < dimensions.height;
27922  if(sizeNormalizationIsNeeded)
27923   this.NormalizeWindowSize(index, true);
27924 },
27925 NormalizeWindowSize: function(index, isMaximized) {
27926  var width = this.GetClientWindowWidth(index),
27927   height = this.GetClientWindowHeight(index),
27928   normWidth = width,
27929   normHeight = height,
27930   maxWidth = this.GetWindowMaxWidth(index),
27931   minWidth = this.GetWindowMinWidth(index),
27932   maxHeight = this.GetWindowMaxHeight(index),
27933   minHeight = this.GetWindowMinHeight(index);
27934  if(maxWidth)
27935   normWidth = Math.min(normWidth, maxWidth);
27936  if(minWidth)
27937   normWidth = Math.max(normWidth, minWidth);
27938  if(maxHeight)
27939   normHeight = Math.min(normHeight, maxHeight);
27940  if(minHeight)
27941   normHeight = Math.max(normHeight, minHeight);
27942  if(normWidth !== width || normHeight !== height)
27943   this.SetWindowSize(this.GetWindow(index), normWidth, normHeight);
27944  if(isMaximized) {
27945   var dimensions = this.getDocumentDimensions(index);
27946   if(this.GetIsCollapsed(index)) {
27947    if(normWidth != dimensions.width) {
27948     this.SetWindowSizeByIndexCore(index, dimensions.width, normHeight, true);
27949    }
27950   } else {
27951    if(normWidth != dimensions.width || normHeight != dimensions.height) {
27952     this.SetWindowSizeByIndexCore(index, dimensions.width, dimensions.height, false);
27953    }
27954   }
27955  }
27956 },
27957 DoShowWindowModalElement: function(index) {
27958  if(this.CanManipulateWithModalElement(index)) {
27959   if(this.adaptivityEnabled) {
27960    this.DoShowWindowModalElementWithAdaptivity(index);
27961    return;
27962   }
27963   var modalElement = this.GetWindowModalElement(index);
27964   var bodyScrollHasJustBeingHidden = false;
27965   if(this.GetHideBodyScrollWhenModal(index) && (!this.IsWindowVisible(this.GetWindow(index)) || !ASPx.IsElementVisible(modalElement))) {
27966    bodyScrollHasJustBeingHidden = true;
27967    aspxGetPopupControlCollection().LockWindowResizeByBodyScrollVisibilityChanging();
27968    if(!ASPx.Browser.WebKitTouchUI)
27969     ASPx.PopupUtils.BodyScrollHelper.HideBodyScroll(this.GetWindowElementId(index));
27970   }
27971   if(ASPx.Browser.IE && this.GetHideBodyScrollWhenModal(index))
27972    ASPx.Evt.AttachEventToElement(modalElement, ASPx.Evt.GetMouseWheelEventName(), function(evt) { return ASPx.Evt.PreventEventAndBubble(evt); });
27973   ASPx.SetElementDisplay(modalElement, true);
27974   this.AdjustModalElementBounds(modalElement);
27975   this.SetModalElementVisibilityWithAnimation(modalElement, index);
27976   aspxGetPopupControlCollection().RegisterVisibleModalElement(modalElement);
27977   if(bodyScrollHasJustBeingHidden)
27978    aspxGetPopupControlCollection().UnlockWindowResizeByBodyScrollVisibilityChanging();
27979  }
27980 },
27981 DoShowWindowModalElementWithAdaptivity: function(index) {
27982  var overlayElement = this.GetOverlayElement(index);
27983  if(!overlayElement) return;
27984  ASPx.SetStyles(overlayElement, {
27985   right: 0,
27986   bottom: 0,
27987   width: "",
27988   height: ""
27989  });
27990  ASPx.SetElementDisplay(overlayElement, true);
27991  this.SetModalElementVisibilityWithAnimation(overlayElement, index);
27992  ASPx.GetPopupControlCollection().RegisterVisibleModalElement(overlayElement);
27993 },
27994 SetSizeBeforeShow: function(index) {
27995  if(this.GetModalMaxWidth(index) && this.GetModalMaxWidth(index) !== this.DefaultModalMaxWidth)
27996   this.SetAdaptiveMaxWidthByIndex(index, this.GetModalMaxWidth(index));
27997  if(this.GetModalMinWidth(index) !== this.DefaultModalMinWidth)
27998   this.SetAdaptiveMinWidthByIndex(index, this.GetModalMinWidth(index));
27999  this.UpdateHeightDimensions(index);
28000 },
28001 UpdateHeightDimensions: function(index) {
28002  this.UpdateAdaptiveMinHeight(index);
28003  this.UpdateAdaptiveMaxHeight(index);
28004 },
28005 UpdateAdaptiveMinHeight: function(index) {
28006  if(this.GetModalMinHeight(index) !== null)
28007   this.SetAdaptiveHeightDimension(index, "minHeight", this.GetModalMinHeight(index));
28008 },
28009 UpdateAdaptiveMaxHeight: function(index) {
28010  if(this.GetModalMaxHeight(index) !== null)
28011   this.SetAdaptiveHeightDimension(index, "maxHeight", this.GetModalMaxHeight(index));
28012 },
28013 GetClientPopupPos: function(element, popupElement, pos, isX, isDragged) {
28014  if(!this.GetAdaptiveModalMode(this.GetWindowIndex(element)))
28015   return ASPxClientPopupControlBase.prototype.GetClientPopupPos.call(this, element, popupElement, pos, isX, isDragged);
28016  var getPosFunc = isX ? ASPx.GetAbsolutePositionX : ASPx.GetAbsolutePositionY;
28017  return { position: getPosFunc(element) };
28018 },
28019 GetAnimationVerticalDirection: function(index, verticalPopupPosition) {
28020  if(!this.GetAdaptiveModalMode(index))
28021   return ASPxClientPopupControlBase.prototype.GetAnimationVerticalDirection.call(this, index, verticalPopupPosition);
28022  return ASPxClientPopupControl.Animation.GetVerticalDirection(this.modalVerticalAlign, this.modalHorizontalAlign);
28023 },
28024 GetAnimationHorizontalDirection: function(index, horizontalPopupPosition) {
28025  if(!this.GetAdaptiveModalMode(index))
28026   return ASPxClientPopupControlBase.prototype.GetAnimationHorizontalDirection.call(this, index, horizontalPopupPosition);
28027  return ASPxClientPopupControl.Animation.GetHorizontalDirection(this.modalHorizontalAlign);
28028 },
28029 GetDefaultVerticalOffset: function() {
28030  return this.IsSmallDisplay() ? 10 : 30;
28031 },
28032 IsSmallDisplay: function() {
28033  return window.innerWidth < this.GetScreenLimitForCss();
28034 },
28035 GetScreenLimitForCss: function() {
28036  return ASPx.MaxMobileWindowWidth;
28037 },
28038 StartAutoAnimation: function(element, index, horizontalPopupPosition, verticalPopupPosition) {
28039  if(this.adaptivityEnabled) {
28040   if(this.NeedFadeAnimation(index, this.popupAnimationType))
28041    this.StartFadeAnimation(element, index);
28042   else
28043    this.StartSlideAnimation(element, index, horizontalPopupPosition, verticalPopupPosition);
28044  } else 
28045   ASPxClientPopupControlBase.prototype.StartAutoAnimation.call(this, element, index, horizontalPopupPosition, verticalPopupPosition);
28046 },
28047 DoHideWindowWithAutoAnimation: function(index, element, closeReason) {
28048  if(this.NeedFadeAnimation(index, this.closeAnimationType))
28049   this.DoHideWindowWithFadeAnimation(index, element, closeReason);
28050  else
28051   this.DoHideWindowWithSlideAnimation(index, closeReason);
28052 },
28053 IsDraggingAllowed: function(index) {
28054  return this.allowDragging && (!this.GetAdaptiveModalMode(index) || this.allowDraggingInAdaptiveMode);
28055 },
28056 IsResizeAllowed: function(index) {
28057  return ASPxClientPopupControlBase.prototype.IsResizeAllowed.call(this, index) && !this.GetAdaptiveModalMode(index);
28058 },
28059 IsFadeCloseAnimation: function(index) {
28060  return ASPxClientPopupControlBase.prototype.IsFadeCloseAnimation.call(this, index) || this.NeedFadeAnimation(index, this.closeAnimationType);
28061 },
28062 NeedFadeAnimation: function(index, animationType) {
28063  return ASPxClientPopupControl.Animation.NeedFadeAnimation(this.modalHorizontalAlign, this.modalVerticalAlign,
28064   animationType, this.popupHorizontalAlign, this.popupVerticalAlign, this.GetAdaptiveModalMode(index));
28065 },
28066 AllowModalElementAnimation: function(index) {
28067  if(this.GetAdaptiveModalMode(index))
28068   return this.popupAnimationType !== ASPxClientPopupControlBase.AnimationType.None;
28069  return ASPxClientPopupControlBase.prototype.AllowModalElementAnimation.call(this, index);
28070 },
28071 DoHideWindowCore: function(index, closeReason) {
28072  var element = this.GetWindowElement(index);
28073  if(element != null) {
28074   if(this.HasCloseAnimation())
28075    this.PrepareElementAfterCloseAnimation(index, element);
28076   element.isHiding = true;
28077   element.style.zIndex = this.GetDefaultZIndexFromServer();
28078   this.SetIsDragged(index, false);
28079   this.UpdateWindowsStateCookie();
28080   element.isHiding = false;
28081   this.StopShowAnimation(index);
28082   if(ASPx.Browser.WebKitTouchUI || ASPx.Browser.Safari) {
28083    var dummy = element.offsetWidth; 
28084   }
28085   ASPx.SetElementDisplay(element, false);
28086   ASPx.SetElementVisibility(element, false);
28087   if(this.adaptivityEnabled) {
28088    ASPx.SetElementDisplay(this.GetModalWrapperElement(index), "");
28089    if(!ASPx.Browser.WebKitTouchUI)
28090     ASPx.PopupUtils.BodyScrollHelper.RestoreBodyScroll(element.i
28090d);
28091    this.SetWrapperScrollVisible(index, true);
28092    this.SetIsDragged(index, false);
28093   }
28094   if(this.hideBodyScrollWhenMaximized && this.GetIsMaximized(index))
28095    ASPx.PopupUtils.BodyScrollHelper.RestoreBodyScroll(element.id);
28096   this.DoHideWindowModalElement(element, closeReason);
28097   this.DoHideWindowIFrame(element);
28098   aspxGetPopupControlCollection().UnregisterVisibleWindow(element);
28099   this.ProcessAccessibleElementOnHide();
28100   this.HideWindowLoadingPanel(index);
28101  }
28102 },
28103 OnAnimationStop: function(index) {
28104  if(this.adaptivityEnabled) {
28105   this.SetWrapperScrollVisible(index, true);
28106   this.UnlockWrapperScrollEventEvent();
28107  }
28108  ASPxClientPopupControlBase.prototype.OnAnimationStop.call(this, index);
28109  if(!this.adaptivityEnabled && ASPx.Browser.Firefox)
28110   this.GetWindowElement(index).style.display = "table";
28111 },
28112 ResetModalStyles: function(index) {
28113  var element = this.GetWindowElement(index);
28114  if(element != null) {
28115   ASPx.SetStyles(element, {
28116    minWidth: "",
28117    maxWidth: "",
28118    marginTop: "",
28119    marginLeft: "",
28120    marginRight: "",
28121    position: ""
28122   });
28123   ASPx.SetStyles(this.GetWindowContentElement(index), {
28124    minHeight: "",
28125    maxHeight: "",
28126   });
28127   this.FixateFooter(index, false, 0);
28128   this.FixateHeader(index, false, 0);
28129   this.SetIsDragged(false);
28130   this.DoHideWindowModalElement(element);
28131  }
28132 },
28133 ResetPopupStyles: function(index) {
28134  var element = this.GetWindowElement(index);
28135  if(element != null) {
28136   ASPx.SetStyles(element, {
28137    left: "",
28138    top: "",
28139    width: "",
28140    height: "",
28141   });
28142   ASPx.SetStyles(this.GetWindowContentWrapperElement(index), {
28143    height: "",
28144    width: "",
28145    display: ""
28146   });
28147   ASPx.SetStyles(this.GetWindowContentElement(index), {
28148    display: "",
28149    width: "",
28150    height: ""
28151   });
28152   this.SetWindowIsShown(index, false);
28153  }
28154 },
28155 InitDivPosForHideSlideAnimation: function(animationDivElement) {
28156  ASPx.PopupUtils.InitAnimationDivCore(animationDivElement);
28157 },
28158 DoHideWindow: function(index, dontRaiseClosing, closeReason) {
28159  var cancel = ASPxClientPopupControlBase.prototype.DoHideWindow.call(this, index, dontRaiseClosing, closeReason);
28160  this.updateContentScrollIfNeeded(index);
28161  return cancel;
28162 },
28163 OnWindowShown: function(windowIndex) {
28164  this.EnsureContent(windowIndex, false);
28165  this.EnsureIFrameHeightAdjusted(windowIndex);
28166  if(this.GetAdaptiveModalMode(windowIndex))
28167   this.ChangeFooterFixed(windowIndex);
28168  else {
28169   var isMaximized = this.GetIsMaximized(windowIndex);
28170   if(isMaximized || this.HasAnyScrollBars(windowIndex))
28171    this.NormalizeWindowSize(windowIndex, isMaximized);
28172  }
28173  this.RaiseShown(windowIndex);
28174  var loadingElementsWillNotBeShown = !this.lpTimers[windowIndex] || this.lpTimers[windowIndex] < 0;
28175  if(this.InWindowCallback(windowIndex) && loadingElementsWillNotBeShown) {
28176   this.ShowWindowLoadingElementsInternal(windowIndex);
28177  }
28178  if(this.GetAdaptiveModalMode(windowIndex))
28179   this.UpdateAdaptiveMinHeight(windowIndex);
28180  aspxGetPopupControlCollection().RefreshModalRenderInIe(); 
28181 },
28182 RefreshModalRenderInIe: function(index) {
28183  var windowElement = this.GetWindowElement(index),
28184   zoom = windowElement.style.zoom;
28185  windowElement.style.zoom = "1";
28186  window.setTimeout(function() {
28187   windowElement.style.zoom = zoom;
28188  }, 100);
28189 },
28190 SetWrapperScrollVisible: function(index, visible) {
28191  if(!this.GetAdaptiveModalMode(index)) return;
28192  var modalWrapper = this.GetModalWrapperElement(index);
28193  if(visible) {
28194   ASPx.Attr.RestoreStyleAttribute(modalWrapper, "overflow-x");
28195   ASPx.Attr.RestoreStyleAttribute(modalWrapper, "overflow-y");
28196  } else {
28197   if(this.modalVerticalAlign === ModalAlign.WindowBottom && this.GetWindowElement(index).offsetHeight <= window.innerHeight)
28198    ASPx.Attr.ChangeStyleAttribute(modalWrapper, "overflow-y", "hidden");
28199   if(this.modalHorizontalAlign === ModalAlign.WindowRight)
28200    ASPx.Attr.ChangeStyleAttribute(modalWrapper, "overflow-x", "hidden");
28201  }
28202 },
28203 GetDragCorrection: function(index, element, isX) {
28204  if(this.adaptivityEnabled) {
28205   var offset = isX ? element.offsetLeft : element.offsetTop;
28206   offset -= ASPx.PxToInt(element.style[isX ? "left" : "top"]);
28207   return ASPx.GetPositionElementOffset(this.GetModalWrapperElement(index), isX) + offset;
28208  } else
28209   return ASPxClientPopupControlBase.prototype.GetDragCorrection.call(this, index, element, isX);
28210 },
28211 GetSlideAnimationDuration: function(index) {
28212  return !this.GetAdaptiveModalMode(index) ? ASPxClientPopupControlBase.prototype.GetSlideAnimationDuration.call(this, index) : 300;
28213 },
28214 GetSlideOffsetCoefficient: function(index) {
28215  return !this.GetAdaptiveModalMode(index) ? ASPxClientPopupControlBase.prototype.GetSlideOffsetCoefficient.call(this, index) : 0.25;
28216 },
28217 InitDivPosForShowSlideAnimation: function(index, animationDivElement, clientX, clientY, onAnimStopCallString) {
28218  if(!this.GetAdaptiveModalMode(index))
28219   ASPxClientPopupControlBase.prototype.InitDivPosForShowSlideAnimation.call(this, index, animationDivElement, clientX, clientY, onAnimStopCallString);
28220  else
28221   ASPx.PopupUtils.InitAnimationProperties(animationDivElement, onAnimStopCallString);
28222 },
28223 BeforeAnySlideAnimation: function(index) {
28224  this.FixateFooter(index, false, 0);
28225  this.FixateHeader(index, false, 0);
28226  this.SetWrapperScrollVisible(index, false);
28227 },
28228 StartSlideAnimation: function(animationDivElement, index, horizontalPopupPosition, verticalPopupPosition) {
28229  if(this.adaptivityEnabled) {
28230   this.LockWrapperScrollEvent();
28231   this.BeforeAnySlideAnimation(index);
28232  }
28233  ASPxClientPopupControlBase.prototype.StartSlideAnimation.call(this, animationDivElement, index, horizontalPopupPosition, verticalPopupPosition);
28234 },
28235 DoHideWindowWithSlideAnimation: function(index, closeReason) {
28236  if(this.adaptivityEnabled)
28237   this.BeforeAnySlideAnimation(index);
28238  ASPxClientPopupControlBase.prototype.DoHideWindowWithSlideAnimation.call(this, index, closeReason);
28239 },
28240 UpdatePositionAfterCallback: function(windowIndex) {
28241  if(this.adaptivityEnabled)
28242   this.TryAutoUpdatePosition(windowIndex);
28243  else if(this.contentLoadingMode === LoadContentViaCallback.OnFirstShow && this.InternalIsWindowVisible(windowIndex))
28244   this.UpdateWindowPositionInternal(windowIndex, this.GetPopupElement(windowIndex, this.GetLastShownPopupElementIndex(windowIndex)));
28245 },
28246 CreateLoadingDiv: function(parentElement, offsetElement, windowIndex) {
28247  if(typeof (windowIndex) != "undefined") { 
28248   var loadingDiv = ASPxClientControl.prototype.CreateLoadingDiv.call(this, parentElement, offsetElement);
28249   loadingDiv.id += windowIndex;
28250   return loadingDiv;
28251  }
28252 },
28253 CreateLoadingPanelWithAbsolutePosition: function(parentElement, offsetElement, windowIndex) {
28254  if(typeof (windowIndex) != "undefined") { 
28255   var loadingPanel = ASPxClientControl.prototype.CreateLoadingPanelWithAbsolutePosition.call(this, parentElement, offsetElement);
28256   loadingPanel.id += windowIndex;
28257   return loadingPanel;
28258  }
28259 },
28260 PerformWindowCallback: function(window, parameter, onSuccess) {
28261  ASPxClientPopupControlBase.prototype.PerformWindowCallback.call(this, window, parameter, onSuccess);
28262 },
28263 SetIframeVisibleForDragging: function(index, visible) {
28264  var iframeElement = this.GetWindowContentIFrameElement(index);
28265  if(ASPx.Browser.IE || ASPx.Browser.Edge) {
28266   if(ASPx.Browser.Edge || ASPx.Browser.Version >= 11)
28267    iframeElement.style.pointerEvents = visible ? "" : "none";
28268   else {
28269    if(visible)
28270     this.RemoveIframeCoverDiv(iframeElement, index);
28271    else
28272     this.CreateIframeCoverDiv(iframeElement, index);
28273   }
28274  }
28275  ASPx.SetElementVisibility(iframeElement, visible);
28276 },
28277 OnResizeStop: function(evt, index, cursor, resizePanel) {
28278  ASPxClientPopupControlBase.prototype.OnResizeStop.call(this, evt, index, cursor, resizePanel);
28279  if(this.IsResizeAllowed(index))
28280   this.SetWindowCachedSize(index, this.GetClientWindowWidth(index), this.GetClientWindowHeight(index));
28281  this.updateContentScrollIfNeeded(index);
28282 },
28283 OnMouseDownModalElement: function(evt, index) {
28284  aspxGetPopupControlCollection().DoHideAllWindows(ASPx.Evt.GetEventSource(evt), "", false, ASPxClientPopupControlCloseReason.OuterMouseClick, evt.offsetX);
28285  this.SetIsPopuped(index, true);
28286 },
28287 IsRaiseAfterResizingLocked: function() {
28288  return this.CollapseExecuting() || this.MaximizationExecuting();
28289 },
28290 GetContentElementChildren: function(index, contentElement) {
28291  var cache = this.GetResizeSessionCache();
28292  if(!cache.contentElementChildren || !cache.contentElementChildren[index]) {
28293   cache.contentElementChildren = [];
28294   cache.contentElementChildren[index] = contentElement.getElementsByTagName("*");
28295  }
28296  return cache.contentElementChildren[index];
28297 },
28298 GetContentElementChildrenScroll: function(index, contentElementChildren) {
28299  var cache = this.GetResizeSessionCache();
28300  if(!cache.contentElementChildrenScroll || !cache.contentElementChildrenScroll[index]) {
28301   cache.contentElementChildrenScroll = [];
28302   cache.contentElementChildrenScroll[index] = [];
28303   for(var i = 0, len = contentElementChildren.length; i < len; i++) {
28304    var child = contentElementChildren[i];
28305    if(!!child.scrollLeft || !!child.scrollTop)
28306     cache.contentElementChildrenScroll[index].push([i, child.scrollLeft, child.scrollTop]);
28307   }
28308  }
28309  return cache.contentElementChildrenScroll[index];
28310 },
28311 GetElementBordersAndPaddings: function(index, element, leftRight) {
28312  var cache = this.GetResizeSessionCache();
28313  if(!cache.elementBordersAndPaddings || !cache.elementBordersAndPaddings[index]) {
28314   cache.elementBordersAndPaddings = [];
28315   var style = ASPx.GetCurrentStyle(element);
28316   cache.elementBordersAndPaddings[index] = {
28317    leftRight: this.getLeftRightBordersAndPaddingsSummaryValue(element, style),
28318    topBottom: this.getTopBottomBordersAndPaddingsSummaryValue(element, style)
28319   };
28320  }
28321  return leftRight ? cache.elementBordersAndPaddings[index].leftRight : cache.elementBordersAndPaddings[index].topBottom;
28322 },
28323 GetHeaderFooterHeight: function(index) {
28324  var cache = this.GetResizeSessionCache();
28325  if(!cache.headerFooterHeight || !cache.headerFooterHeight[index]) {
28326   cache.headerFooterHeight = [];
28327   cache.headerFooterHeight[index] = this.GetHeaderFooterHeightCore(index);
28328  }
28329  return cache.headerFooterHeight[index];
28330 },
28331 getContentElementDisplay: function(correctContentElementSize, contentUrl) {
28332  return correctContentElementSize || contentUrl ? "block" : "table-cell";
28333 },
28334 SetContentWrapperHeightLite: function(index, actualHeight, windowElem, contentWrapper) {
28335  if(!windowElem.style.height || ASPx.IsPercentageSize(windowElem.style.height))
28336   return;
28337  var borderOwner = this.GetWindowBorderOwnerElement(windowElem);
28338  var height = borderOwner == windowElem ? actualHeight : actualHeight - (borderOwner ? ASPx.GetTopBottomBordersAndPaddingsSummaryValue(borderOwner) : 0);
28339  height -= this.GetHeaderFooterHeight(index);
28340  if(height > 0)
28341   contentWrapper.style.height = height + "px";
28342 },
28343 SetWindowScrollDivSize: function(scrollDiv, index, dimension) {
28344  var windowClientTable = this.GetWindowClientTable(index);
28345  var headerElement = this.GetWindowHeaderElement(index);
28346  var height = windowClientTable.offsetHeight;
28347  if(headerElement)
28348   height -= headerElement.offsetHeight;
28349  height -= this.GetWindowFooterHeightLite(index);
28350  if(dimension == 'height' || dimension == 'both')
28351   ASPx.SetOffsetHeight(scrollDiv, height);
28352  if(dimension == 'width' || dimension == 'both') {
28353   var width = windowClientTable.offsetWidth;
28354   var contentElement = this.GetWindowContentElement(index);
28355   width -= this.getLeftRightBordersAndPaddingsSummaryValue(scrollDiv) + ASPx.GetHorizontalBordersWidth(contentElement);
28356   if(width > -1)
28357    scrollDiv.style.width = width + "px";
28358  }
28359  scrollDiv.style.marginRight = "0px";
28360 },
28361 AdjustIFrameHeight: function(index, iframe) {
28362  ASPxClientPopupControlBase.prototype.AdjustIFrameHeight.call(this, index, iframe);
28363  if(!this.InternalIsWindowVisible(index) || !iframe || this.GetAdaptiveModalMode(index)) return;
28364  this.SetIframeAdjustingPostponed(index, false);
28365  var content = this.GetContentContainer(index);
28366  var contentWrapper = this.GetWindowContentWrapperElement(index);
28367  iframe.style.verticalAlign = "text-bottom";
28368  var iframeHeight = contentWrapper.offsetHeight - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(content);
28369  if(iframeHeight >= 0)
28370   iframe.style.height = iframeHeight + "px";
28371 },
28372 OnPinButtonClick: function(index) {
28373  var value = this.GetIsPinned(index);
28374  this.SetPinCore(index, !value);
28375 },
28376 SetPinCore: function(index, value) {
28377  if(this.GetIsPinned(index) != value) {
28378   this.SetIsPinned(index, value);
28379   this.HoldPosition(index, value);
28380   this.UpdateWindowsStateCookie();
28381   this.OnPinned(index, value);
28382  }
28383 },
28384 OnPinned: function(index, pinned) {
28385  this.RaisePinnedChanged(index, pinned);
28386 },
28387 HoldPosition: function(index, hold, element) {
28388  if(hold) {
28389   element = element || this.GetWindowElement(index);
28390   if(!element) return;
28391   var x = ASPx.GetAbsoluteX(element);
28392   var y = ASPx.GetAbsoluteY(element);
28393   scrollX = ASPx.GetDocumentScrollLeft();
28394   scrollY = ASPx.GetDocumentScrollTop();
28395   this.SetPinPosX(index, x - scrollX);
28396   this.SetPinPosY(index, y - scrollY);
28397  }
28398  this.UpdateHeaderButtonSelected(index, "GetWindowPinButton", hold);
28399  this.CheckHeaderCursor(index);
28400 },
28401 GetBodyWidth: function() {
28402  return aspxGetPopupControlCollection().GetSavedBodyWidth();
28403 },
28404 GetBodyHeight: function() {
28405  return aspxGetPopupControlCollection().GetSavedBodyHeight();
28406 },
28407 GetIsOutFromViewPort: function(index) {
28408  var element = this.GetWindowElement(index);
28409  if(!element) return false;
28410  var pinXTarget = this.GetPinPosX(index);
28411  var pinYTarget = this.GetPinPosY(index);
28412  var popupWindowWidth = this.GetClientWindowWidth(index);
28413  var docClientWidth = ASPx.GetDocumentClientWidth();
28414  var rightOutOffset = (pinXTarget + popupWindowWidth) - docClientWidth;
28415  var popupWindowHeight = this.GetClientWindowHeight(index);
28416  var docClientHeight = ASPx.GetDocumentClientHeight();
28417  var bottomOutOffset = (pinYTarget + popupWindowHeight) - docClientHeight;
28418  return (rightOutOffset > 0 || bottomOutOffset > 0);
28419 },
28420 needToHidePinnedOutFromViewPort: function(index) {
28421  return this.GetIsPinned(index) && this.GetIsOutFromViewPort(index);
28422 },
28423 AdjustPinPositionWhileScroll: function(index) {
28424  var element = this.GetWindowElement(index);
28425  if(!element) return;
28426  var x = ASPx.GetAbsoluteX(element);
28427  var y = ASPx.GetAbsoluteY(element);
28428  var scrollX = ASPx.GetDocumentScrollLeft();
28429  var scrollY = ASPx.GetDocumentScrollTop();
28430  var pinX = x - scrollX;
28431  var pinY = y - scrollY;
28432  var pinXTarget = this.GetPinPosX(index);
28433  var pinYTarget = this.GetPinPosY(index);
28434  if((pinX != pinXTarget) || (pinY != pinYTarget)) {
28435   this.lockScroll++;
28436   var xNew = pinXTarget + scrollX;
28437   var yNew = pinYTarget + scrollY;
28438   var bodyWidth = this.GetBodyWidth();
28439   var bodyHeight = this.GetBodyHeight();
28440   var popupWindowWidth = this.GetClientWindowWidth(index);
28441   var docClientWidth = ASPx.GetDocumentClientWidth();
28442   var rightOutOffset = (pinXTarget + popupWindowWidth) - docClientWidth;
28443   var popupWindowHeight = this.GetClientWindowHeight(index);
28444   var docClientHeight = ASPx.GetDocumentClientHeight();
28445   var bottomOutOffset = (pinYTarget + popupWindowHeight) - docClientHeight;
28446   var cancelScrollX = false;
28447   if(xNew + (popupWindowWidth - rightOutOffset) > bodyWidth) {
28448    xNew -= (xNew + (popupWindowWidth - rightOutOffset) - bodyWidth);
28449    cancelScrollX = true;
28450   }
28451   var cancelScrollY = false;
28452   if(yNew + (popupWindowHeight - bottomOutOffset) > bodyHeight) {
28453    yNew -= (yNew + (popupWindowHeight - bottomOutOffset) - bodyHeight);
28454    cancelScrollY = true;
28455   }
28456   xNew = ASPx.PrepareClientPosForElement(xNew, element, true);
28457   yNew = ASPx.PrepareClientPosForElement(yNew, element, false);
28458   this.SetWindowPos(index, element, xNew, yNew);
28459   if(cancelScrollX) {
28460    var scrollLeftMax = bodyWidth - ASPx.GetDocumentClientWidth();
28461    if((rightOutOffset > 0) && (scrollX > scrollLeftMax)) {
28462     this.lockScroll++;
28463     ASPx.SetDocumentScrollLeft(scrollLeftMax);
28464     this.lockScroll--;
28465    }
28466   }
28467   if(cancelScrollY) {
28468    var scrollTopMax = bodyHeight - ASPx.GetDocumentClientHeight();
28469    if((bottomOutOffset > 0) && (scrollY > scrollTopMax)) {
28470     this.lockScroll++;
28471     ASPx.SetDocumentScrollTop(scrollTopMax);
28472     this.lockScroll--;
28473    }
28474   }
28475   this.lockScroll--;
28476  }
28477 },
28478 OnCollapseButtonClick: function(index) {
28479  this.SetCollapsedCore(index, !this.GetIsCollapsed(index));
28480 },
28481 SetCollapsedCore: function(index, minimization) {
28482  if(this.GetIsCollapsed(index) == minimization) return;
28483  this.DoCollapse(index, minimization);
28484  this.OnCollapsed(index, minimization);
28485 },
28486 DoCollapse: function(index, minimization) {
28487  if(this.GetIsCollapsed(index) == minimization) return;
28488  this.StartCollapse();
28489  if(minimization) {
28490   var cachedWidth = this.GetClientWindowWidth(index);
28491   var cachedHeight = this.GetClientWindowHeight(index);
28492   var shouldUpdateRestoredSize = this.ShoulUpdatedRestoredWindowSizeOnCollapse(index);
28493   var width = this.GetMainWindowWidth(index, !shouldUpdateRestoredSize);
28494   var height = this.GetMainWindowHeight(index, !shouldUpdateRestoredSize);
28495   this.SetWindowSizeByIndex(index, width, 0);
28496   this.SetWindowContentVisible(index, false);
28497   this.SetWindowFooterVisible(index, false);
28498   this.ResetWindowHeight(index);
28499   this.SetIsCollapsed(index, minimization);
28500   this.SetWindowCachedSize(index, cachedWidth, cachedHeight);
28501   if(shouldUpdateRestoredSize)
28502    this.UpdateRestoredWindowSize(index, width, height);
28503  }
28504  else {
28505   if(this.MaximizationExecuting()) {
28506    var element = this.GetWindowElement(index);
28507    if(element) {
28508     element.style.left = ASPx.GetDocumentScrollLeft();
28509     element.style.top = ASPx.GetDocumentScrollTop();
28510    }
28511   }
28512   this.SetWindowContentVisible(index, true);
28513   this.SetWindowFooterVisible(index, true);
28514   this.SetIsCollapsed(index, minimization);
28515   if(this.GetIsMaximized(index)) {
28516    var documentClientWidth = ASPx.PopupUtils.GetDocumentClientWidthForPopup();
28517    var documentClientHeight = ASPx.PopupUtils.GetDocumentClientHeightForPopup();
28518    this.SetWindowSizeByIndex(index, documentClientWidth, documentClientHeight);
28519   } else {
28520    var restoredWindowData = this.GetRestoredWindowData(index);
28521    this.SetWindowSizeByIndex(index, restoredWindowData.width, restoredWindowData.height);
28522   }
28523   ASPx.GetControlCollection().AdjustControls(this.GetWindowElement(index));
28524  }
28525  this.UpdateHeaderButtonSelected(index, "GetWindowCollapseButton", minimization);
28526  this.EndCollapse();
28527  this.UpdateWindowsStateCookie();
28528 },
28529 ResetWindowHeight: function(index) {
28530  var element = this.GetWindowElement(index);
28531  if(element)
28532   element.style.height = "";
28533 },
28534 ShoulUpdatedRestoredWindowSizeOnCollapse: function(index) {
28535  return !this.GetIsMaximized(index);
28536 },
28537 OnCollapsed: function(index, value) {
28538  if(value)
28539   this.RaiseCollapsed(index);
28540  else
28541   this.RaiseExpanded(index);
28542  this.RaiseAfterResizing(index);
28543 },
28544 OnMaximizeButtonClick: function(index) {
28545  this.SetMaximizedCore(index, !this.GetIsMaximized(index));
28546 },
28547 SetMaximizedCore: function(index, maximization) {
28548  if(this.GetIsMaximized(index) == maximization) return;
28549  this.DoMaximize(index, maximization);
28550  this.OnMaximizedChanged(index, maximization);
28551 },
28552 GetMaximizedPosition: function(element, isX) {
28553  if(ASPx.Browser.WebKitTouchUI)
28554   return ASPx.PrepareClientPosForElement(0, element, isX);
28555  return ASPx.PrepareClientPosForElement(isX ? ASPx.GetDocumentScrollLeft() : ASPx.GetDocumentScrollTop(), element, isX);
28556 },
28557 PerformMaximaze: function (index, maximization, element) {
28558  if (this.hideBodyScrollWhenMaximized)
28559   ASPx.PopupUtils.BodyScrollHelper.HideBodyScroll(element.id);
28560  if (this.GetIsCollapsed(index))
28561   this.DoCollapse(index, false);
28562  var cachedWidth = this.GetClientWindowWidth(index);
28563  var cachedHeight = this.GetClientWindowHeight(index);
28564  var restoredWindowData = this.GetInitRestoredWindowData(index);
28565  var documentClientWidth = ASPx.PopupUtils.GetDocumentClientWidthForPopup();
28566  var documentClientHeight = ASPx.PopupUtils.GetDocumentClientHeightForPopup();
28567  var windowClientTable = this.GetWindowClientTable(index);
28568  var windowClientTableParent = windowClientTable.parentNode;
28569  childStyle = ASPx.GetCurrentStyle(windowClientTableParent);
28570  var left = this.GetMaximizedPosition(element, true);
28571  var top = this.GetMaximizedPosition(element, false);
28572  this.SetWindowPos(index, element, left, top);
28573  this.SetWindowSizeByIndex(index, documentClientWidth, documentClientHeight);
28574  this.SetWindowCachedSize(index, cachedWidth, cachedHeight);
28575  this.SetRestoredWindowData(index, restoredWindowData);
28576  this.SetIsMaximized(index, maximization);
28577 },
28578 PerformMinimize: function (index, maximization, element) {
28579  var restoredWindowData = this.GetRestoredWindowData(index);
28580  var width = restoredWindowData.width || this.GetMainWindowWidth(index);
28581  var height = restoredWindowData.height || this.GetMainWindowHeight(index);
28582  this.SetIsMaximized(index, maximization);
28583  var left = ASPx.PrepareClientPosForElement(restoredWindowData.left, element, true);
28584  var top = ASPx.PrepareClientPosForElement(restoredWindowData.top, element, false);
28585  this.SetWindowPos(index, element, left, top);
28586  this.SetWindowSizeByIndex(index, width, height);
28587  if (this.GetIsCollapsed(index)) {
28588   this.SetIsCollapsed(index, false);
28589   this.UpdateRestoredWindowSizeLock();
28590   this.DoCollapse(index, true);
28591   this.UpdateRestoredWindowSizeUnlock();
28592  }
28593  if (this.hideBodyScrollWhenMaximized)
28594   ASPx.PopupUtils.BodyScrollHelper.RestoreBodyScroll(element.id);
28595 },
28596 DoMaximize: function(index, maximization) {
28597  if(this.GetIsMaximized(index) == maximization) return;
28598  var element = this.GetWindowElement(index);
28599  if(!element) return;
28600  this.StartMaximization();
28601  if(maximization)
28602   this.PerformMaximaze(index, maximization, element);
28603  else
28604   this.PerformMinimize(index, maximization, element);
28605  if(this.GetIsPinned(index))
28606   this.HoldPosition(index, true, element);
28607  this.UpdateHeaderButtonSelected(index, "GetWindowMaximizeButton", maximization);
28608  this.EndMaximization();
28609  this.UpdateWindowsStateCookie();
28610  this.CheckHeaderCursor(index);
28611 },
28612 OnMaximizedChanged: function(index, value) {
28613  if(value)
28614   this.RaiseMaximized(index);
28615  else
28616   this.RaiseRestoredAfterMaximized(index);
28617  this.RaiseAfterResizing(index);
28618 },
28619 GetInitRestoredWindowData: function(index) {
28620  var restoredWindowData = this.GetRestoredWindowData(index);
28621  restoredWindowData.left = this.GetCurrentLeft(index);
28622  restoredWindowData.top = this.GetCurrentTop(index);
28623  restoredWindowData.width = this.GetMainWindowWidth(index);
28624  restoredWindowData.height = this.GetMainWindowHeight(index);
28625  return restoredWindowData;
28626 },
28627 getDocumentDimensions: function(index) {
28628  var documentClientWidth = ASPx.PopupUtils.GetDocumentClientWidthForPopup(),
28629   documentClientHeight = ASPx.PopupUtils.GetDocumentClientHeightForPopup();
28630  return { width: documentClientWidth, height: documentClientHeight };
28631 }, 
28632 UpdateMaximizedWindowSizeOnResize: function(index) {
28633  this.StartUpdateMaximizedWindowSizeOnResize();
28634  var dimensions = this.getDocumentDimensions(index);
28635  if(this.GetIsCollapsed(index)) dimensions.height = 0;
28636  this.SetWindowSizeByIndex(index, dimensions.width, dimensions.height);
28637  if(this.GetIsCollapsed(index)) {
28638   this.CorrectCollapsedSize(index);
28639  }
28640  window.setTimeout(function() { this.SetMaximizedWindowSizeAfterOnResize(index); }.aspxBind(this), 0);
28641  this.EndUpdateMaximizedWindowSizeOnResize();
28642 },
28643 SetMaximizedWindowSizeAfterOnResize: function(index) {
28644  this.StartUpdateMaximizedWindowSizeOnResize();
28645  var dimensions = this.getDocumentDimensions(index);
28646  windowWidthCurrent = this.GetMainWindowWidth(index, true);
28647  windowHeightCurrent = this.GetMainWindowHeight(index, true);
28648  if(this.GetIsCollapsed(index))
28649   dimensions.height = 0;
28650  if(dimensions.width != windowWidthCurrent || dimensions.height != windowHeightCurrent) {
28651   this.SetWindowSizeByIndex(index, dimensions.width, dimensions.height);
28652   if(this.GetIsCollapsed(index)) {
28653    this.CorrectCollapsedSize(index);
28654   }
28655  }
28656  this.EndUpdateMaximizedWindowSizeOnResize();
28657 },
28658 CorrectCollapsedSize: function(index) {
28659  var contentWrapper = this.GetWindowContentWrapperElement(index);
28660  if(contentWrapper && ASPx.IsElementVisible(contentWrapper))
28661   contentWrapper.style.display = 'none';
28662 },
28663 UpdateHeaderButtonSelected: function(index, methodGetWindowButton, flagSelected) {
28664  if(typeof (ASPx.GetStateController) != "undefined") {
28665   button = this[methodGetWindowButton](index);
28666   var method = flagSelected ? "SelectElementBySrcElement" : "DeselectElementBySrcElement";
28667   ASPx.GetStateController()[method](button);
28668  }
28669 },
28670 CheckHeaderCursor: function(index) {
28671  if(!this.allowDragging) return;
28672  var dragElement = this.GetDragElement(index);
28673  if(!dragElement) return;
28674  var styleCursor = dragElement.style.cursor;
28675  var isPinned = this.GetIsPinned(index);
28676  var isMaximized = this.GetIsMaximized(index);
28677  if((isPinned || isMaximized) && styleCursor != "default")
28678   dragElement.style.cursor = "default";
28679  else if(!isPinned && !isMaximized && styleCursor != "move")
28680   dragElement.style.cursor = "move";
28681 },
28682 StartCollapse: function() {
28683  this.collapseExecutingLockCount++;
28684 },
28685 EndCollapse: function() {
28686  this.collapseExecutingLockCount--;
28687 },
28688 CollapseExecuting: function() {
28689  return this.collapseExecutingLockCount > 0;
28690 },
28691 StartMaximization: function() {
28692  this.maximizationExecutingLockCount++;
28693 },
28694 EndMaximization: function() {
28695  this.maximizationExecutingLockCount--;
28696 },
28697 MaximizationExecuting: function() {
28698  return this.maximizationExecutingLockCount > 0;
28699 },
28700 StartUpdateMaximizedWindowSizeOnResize: function() {
28701  this.browserResizingForMaxWindowLockCount++;
28702 },
28703 EndUpdateMaximizedWindowSizeOnResize: function() {
28704  this.browserResizingForMaxWindowLockCount--;
28705 },
28706 ResizingForMaxWindowLocked: function() {
28707  return this.browserResizingForMaxWindowLockCount > 0;
28708 },
28709 UpdateRestoredWindowSizeLock: function() {
28710  this.updateRestoredWindowSizeLockCount++;
28711 },
28712 UpdateRestoredWindowSizeUnlock: function() {
28713  this.updateRestoredWindowSizeLockCount--;
28714 },
28715 UpdateRestoredWindowSizeLocked: function() {
28716  return this.updateRestoredWindowSizeLockCount > 0;
28717 },
28718 UpdateRestoredWindowSize: function(index, width, height) {
28719  if(!this.UpdateRestoredWindowSizeLocked()) {
28720   restoredMinWindowData = this.GetRestoredWindowData(index);
28721   restoredMinWindowData.width = width;
28722   restoredMinWindowData.height = height;
28723   this.SetRestoredWindowData(index, restoredMinWindowData);
28724  }
28725 },
28726 GetWindowsState: function() {
28727  var state = ASPxClientPopupControlBase.prototype.GetWindowsState.call(this);
28728  for(var i = 0; i < this.GetWindowCountCore() ; i++) {
28729   state += this.GetWindowState(i);
28730   if(i < this.GetWindowCountCore() - 1) state += ";";
28731  }
28732  return state;
28733 },
28734 CreateWindows: function(windowsNames) {
28735  for(var i = 0; i < windowsNames.length; i++) {
28736   var window = new ASPxClientPopupWindow(this, i, windowsNames[i]);
28737   this.windows.push(window);
28738  }
28739 },
28740 RaiseCloseButtonClick: function(index) {
28741  ASPxClientPopupControlBase.prototype.RaiseCloseButtonClick.call(this, index);
28742 },
28743 RaisePinnedChanged: function(index, pinned) {
28744  var window = index < 0 ? null : this.GetWindow(index);
28745  if(!this.PinnedChanged.IsEmpty()) {
28746   var args = new ASPxClientPopupWindowPinnedChangedEventArgs(window, pinned);
28747   this.PinnedChanged.FireEvent(this, args);
28748  }
28749 },
28750 RaiseCollapsed: function(index) {
28751  this.RaiseResize(index, ASPxClientPopupControlResizeState.Collapsed);
28752 },
28753 RaiseExpanded: function(index) {
28754  this.RaiseResize(index, ASPxClientPopupControlResizeState.Expanded);
28755 },
28756 RaiseMaximized: function(index) {
28757  this.RaiseResize(index, ASPxClientPopupControlResizeState.Maximized);
28758 },
28759 RaiseRestoredAfterMaximized: function(index) {
28760  this.RaiseResize(index, ASPxClientPopupControlResizeState.RestoredAfterMaximized);
28761 },
28762 GetContentWidth: function() {
28763  return this.GetWindowContentWidth(null);
28764 },
28765 GetContentHeight: function() {
28766  return this.GetWindowContentHeight(null);
28767 },
28768 SetSize: function(width, height) {
28769  ASPxClientPopupControlBase.prototype.SetSize.call(this, width, height);
28770 },
28771 GetWindowDimension: function(window, isWidth, forceFromCache) {
28772  var index = (window != null) ? window.index : -1;
28773  return this.GetWindowDimensionByIndex(index, isWidth, forceFromCache);
28774 },
28775 GetWindowContentDimension: function(window, isWidth) {
28776  var index = (window != null) ? window.index : -1,
28777   contentElem = this.GetWindowContentElement(index),
28778   dimensionHolder = contentElem.parentNode,
28779   paddingsHolder = contentElem;
28780  return isWidth ?
28781  (dimensionHolder.offsetWidth - this.getLeftRightBordersAndPaddingsSummaryValue(paddingsHolder)) :
28782  (dimensionHolder.offsetHeight - this.getTopBottomBordersAndPaddingsSummaryValue(paddingsHolder));
28783 },
28784 GetWindowContentWidth: function(window) {
28785  return this.GetWindowContentDimension(window, true);
28786 },
28787 GetWindowContentHeight: function(window) {
28788  return this.GetWindowContentDimension(window, false);
28789 },
28790 GetWindowHeight: function(window) {
28791  return this.GetWindowDimension(window, false);
28792 },
28793 GetWindowWidth: function(window) {
28794  return this.GetWindowDimension(window, true);
28795 },
28796 SetWindowSize: function(window, width, height) {
28797  return ASPxClientPopupControlBase.prototype.SetWindowSize.call(this, window, width, height);
28798 },
28799 GetContentHTML: function() {
28800  return this.GetContentHtml();
28801 },
28802 SetContentHTML: function(html) {
28803  this.SetContentHtml(html);
28804 },
28805 SetWindowPopupElementID: function(window, popupElementId) {
28806  var index = (window != null) ? window.index : -1;
28807  this.SetPopupElementIDByIndex(index, popupElementId);
28808 },
28809 SetPopupElementID: function(popupElementId) {
28810  this.SetPopupElementIDByIndex(-1, popupElementId);
28811 },
28812 GetCurrentPopupElementIndex: function() {
28813  return this.GetWindowCurrentPopupElementIndexByWindowIndex(-1);
28814 },
28815 GetWindowCurrentPopupElementIndex: function(window) {
28816  var index = (window != null) ? window.index : -1;
28817  return this.GetWindowCurrentPopupElementIndexByWindowIndex(index);
28818 },
28819 GetCurrentPopupElement: function() {
28820  return this.GetWindowCurrentPopupElementByIndex(-1);
28821 },
28822 GetWindowCurrentPopupElement: function(window) {
28823  var index = (window != null) ? window.index : -1;
28824  return this.GetWindowCurrentPopupElementByIndex(index);
28825 },
28826 ShowAtPos: function(x, y) {
28827  this.ShowWindowAtPos(null, Math.round(x), Math.round(y));
28828 },
28829 BringToFront: function() {
28830  this.BringWindowToFront(null);
28831 },
28832 IsWindowVisible: function(window) {
28833  return ASPxClientPopupControlBase.prototype.IsWindowVisible.call(this, window);
28834 },
28835 GetWindow: function(index) {
28836  return ASPxClientPopupControlBase.prototype.GetWindow.call(this, index);
28837 },
28838 GetWindowByName: function(name) {
28839  for(var i = 0; i < this.windows.length; i++)
28840   if(this.windows[i].name == name) return this.windows[i];
28841  return null;
28842 },
28843 GetWindowCount: function() {
28844  return this.GetWindowCountCore();
28845 },
28846 ShowWindow: function(window, popupElementIndex) {
28847  var index = (window != null) ? window.index : -1;
28848  this.ShowWindowByIndex(index, popupElementIndex);
28849 },
28850 ShowWindowAtElement: function(window, htmlElement) {
28851  var index = (window != null) ? window.index : -1;
28852  this.ShowWindowAtElementByIndex(index, htmlElement);
28853 },
28854 ShowWindowAtElementByID: function(window, id) {
28855  var htmlElement = document.getElementById(id);
28856  this.ShowWindowAtElement(window, htmlElement);
28857 },
28858 ShowWindowAtPos: function(window, x, y) {
28859  if(!this.isInitialized)
28860   return;
28861  var index = (window != null) ? window.index : -1;
28862  this.DoShowWindowCore(index, x, y, -1, false, true);
28863 },
28864 BringWindowToFront: function(window) {
28865  var index = (window != null) ? window.index : -1;
28866  var element = this.GetWindowElement(index);
28867  aspxGetPopupControlCollection().ActivateWindowElement(element, undefined, this.GetPopupType(), this.GetDefaultZIndexFromServer(), this.GetPopupControlZIndex());
28868 },
28869 HideWindow: function(window) {
28870  ASPxClientPopupControlBase.prototype.HideWindow.call(this, window);
28871 },
28872 GetWindowContentHTML: function(window) {
28873  return this.GetWindowContentHtml(window);
28874 },
28875 SetWindowContentHTML: function(window, html) {
28876  this.SetWindowContentHtml(window, html);
28877 },
28878 GetWindowContentHtml: function(window) {
28879  return ASPxClientPopupControlBase.prototype.GetWindowContentHtml.call(this, window);
28880 },
28881 SetWindowContentHtml: function(window, html, useAnimation) {
28882  ASPxClientPopupControlBase.prototype.SetWindowContentHtml.call(this, window, html, useAnimation);
28883 },
28884 AfterSetWindowContentHtml: function(index, contentContainer, useAnimation) {
28885  if(this.GetAdaptiveModalMode(index))
28886   this.TryAutoUpdatePosition(index);
28887  else if(this.InternalIsWindowVisible(index))
28888   this.RecalculateWindowSize(index);
28889  ASPxClientPopupControlBase.prototype.AfterSetWindowContentHtml.call(this, index, contentContainer, useAnimation);
28890  this.UpdateScrollbar(index);
28891 },
28892 UpdateAlignment: function(index) {
28893  if(this.GetIsDragged(index)) return;
28894  var element = this.GetWindowElement(index),
28895   wrapperStyle = getComputedStyle(this.GetModalWrapperElement(index)),
28896   top = ASPxClientPopupControl.AligmentCalculator.CalculateTopMargin(this.modalVerticalAlign, element.offsetHeight, this.GetDefaultVerticalOffset()),
28897   left = ASPxClientPopupControl.AligmentCalculator.CalculateLeftRightMargin(this.modalHorizontalAlign, ModalAlign.WindowLeft, wrapperStyle.paddingLeft),
28898   right = ASPxClientPopupControl.AligmentCalculator.CalculateLeftRightMargin(this.modalHorizontalAlign, ModalAlign.WindowRight, wrapperStyle.paddingRight);
28899  ASPx.SetStyles(element, {
28900   marginTop: top,
28901   marginLeft: left,
28902   marginRight: right
28903  });
28904 },
28905 GetOverlayElement: function(index) {
28906  return this.GetWindowModalElement(index);
28907 },
28908 GetModalWrapperElement: function(index) {
28909  if(!this.adaptivityEnabled) return null;
28910  var windowElement = this.GetWindowElement(index);
28911  return !!windowElement ? windowElement.parentNode : null;
28912 },
28913 GetWindowHeightWithoutContent: function(index) {
28914  var element = this.GetWindowElement(index),
28915   borderOwner = this.GetWindowBorderOwnerElement(element);
28916  return this.GetHeaderFooterHeightCore(index) + ASPx.GetVerticalBordersWidth(borderOwner);
28917 },
28918 StretchVertically: function() {
28919  this.StretchVerticallyByIndex(-1, true);
28920 },
28921 WindowStretchVertically: function(window) {
28922  var index = (window != null) ? window.index : -1;
28923  this.StretchVerticallyByIndex(index, true);
28924 },
28925 StretchVerticallyByIndex: function(index, value) {
28926  if(this.GetStretchVerticallyByIndex(index) !== value) {
28927   this.SetPropertyValue(index, "stretchVertically", value);
28928   var oldMinHeight = !!this.GetModalMinHeight(index) ? this.GetModalMinHeight(index) : 0;
28929   this.SetPropertyValue(index, "modalMinHeight", value ? "100vh" : this.minHeightBackup);
28930   this.minHeightBackup = oldMinHeight;
28931   this.UpdateHeightDimensions(index);
28932  }
28933 },
28934 SetAdaptiveMinWidth: function(minWidth) {
28935  this.SetAdaptiveMinWidthByIndex(-1, minWidth);
28936 },
28937 SetWindowAdaptiveMinWidth: function(window, minWidth) {
28938  var index = (window != null) ? window.index : -1;
28939  this.SetAdaptiveMinWidthByIndex(index, minWidth);
28940 },
28941 SetAdaptiveMaxWidth: function(maxWidth) {
28942  this.SetAdaptiveMaxWidthByIndex(-1, maxWidth);
28943 },
28944 SetWindowAdaptiveMaxWidth: function(window, maxWidth) {
28945  var index = (window != null) ? window.index : -1;
28946  this.SetAdaptiveMaxWidthByIndex(index, maxWidth);
28947 },
28948 SetAdaptiveMinHeight: function(minHeight) {
28949  this.SetAdaptiveMinHeightByIndex(-1, minHeight);
28950 },
28951 SetWindowAdaptiveMinHeight: function(window, minHeight) {
28952  var index = (window != null) ? window.index : -1;
28953  this.SetAdaptiveMinHeightByIndex(index, minHeight);
28954 },
28955 SetAdaptiveMaxHeight: function(maxHeight) {
28956  this.SetAdaptiveMaxHeightByIndex(-1, maxHeight);
28957 },
28958 SetWindowAdaptiveMaxHeight: function(window, maxHeight) {
28959  var index = (window != null) ? window.index : -1;
28960  this.SetAdaptiveMaxHeightByIndex(index, maxHeight);
28961 },
28962 SetAdaptiveHeightDimension: function(index, propertyName, value) {
28963  value = this.ConvertDimensionValueToString(value);
28964  value = value.indexOf("%") > -1 ? value.replace("%", "vh") : value;
28965  var margins = 0;
28966  if(this.stretchVertically && propertyName === "minHeight")
28967   margins = ASPx.GetTopBottomMargins(this.GetWindowElement(index));
28968  var contentElement = this.GetWindowContentElement(index);  
28969  var iframe = this.GetWindowContentIFrameElement(index);
28970  var additionalHeight = this.GetWindowHeightWithoutContent(index) + margins;
28971  var adaptiveHeight = "calc(" + value + " - " + additionalHeight + "px)";
28972  contentElement.style[propertyName] = adaptiveHeight;
28973  if (contentElement.style.minHeight) {
28974   if (iframe || this.HasAnyScrollBars(index))
28975    contentElement.style.height = "1px";
28976   else if (propertyName === "minHeight")
28977    this.SetContentWrapperAdaptiveHeight(index, adaptiveHeight);
28978  }
28979  if(iframe) {
28980   iframe.style.verticalAlign = "text-bottom";
28981   iframe.style.height = "100%";
28982  }
28983 },
28984 ConvertDimensionValueToString: function(value) {
28985  if(typeof value === "number")
28986   return value + "px";
28987  if(typeof value === "string")
28988   return value;
28989 },
28990 CanBeClosedByClickOnElement: function(index, srcElement, posX, id) {
28991  return ASPxClientPopupControlBase.prototype.CanBeClosedByClickOnElement.call(this, index, srcElement, posX, id) &&
28992   (!this.GetAdaptiveModalMode(index) || srcElement != this.GetModalWrapperElement(index) || posX < srcElement.offsetWidth - ASPx.GetVerticalScrollBarWidth());
28993 },
28994 SetWindowDisplay: function(index, value) {
28995  ASPxClientPopupControlBase.prototype.SetWindowDisplay.call(this, index, value);
28996  if(this.adaptivityEnabled) {
28997   var wrapper = this.GetModalWrapperElement(index);
28998   ASPx.SetElementDisplay(wrapper, value);
28999  }
29000 },
29001 HaveSpecialDivForAnimation: function() {
29002  return ASPxClientPopupControlBase.prototype.HaveSpecialDivForAnimation.call(this) || this.adaptivityEnabled;
29003 },
29004 WindowIsModal: function(index) {
29005  return ASPxClientPopupControlBase.prototype.WindowIsModal.call(this, index) || this.GetAdaptiveModalMode(index);
29006 },
29007 RecalculateWindowSize: function(index) {
29008  var window = this.GetWindowElement(index);
29009  var displayAfterSetSize = window.style.display;
29010  this.SetClientWindowSizeCoreLite(index, this.GetWindowWidthInternal(index), this.GetWindowHeightInternal(index), this.GetIsCollapsed(index));
29011  window.style.display = displayAfterSetSize;
29012  if(this.HasAnyScrollBars(index))
29013   this.NormalizeWindowSize(index, this.GetIsMaximized(index));
29014 },
29015 GetWindowContentIFrame: function(window) {
29016  return ASPxClientPopupControlBase.prototype.GetWindowContentIFrame.call(this, window);
29017 },
29018 GetWindowContentUrl: function(window) {
29019  return ASPxClientPopupControlBase.prototype.GetWindowContentUrl.call(this, window);
29020 },
29021 SetWindowContentUrl: function(window, url) {
29022  ASPxClientPopupControlBase.prototype.SetWindowContentUrl.call(this, window, url);
29023 },
29024 RefreshDimensionsAfterCreateIframe: function(index) {
29025  if(ASPx.IsElementVisible(this.GetWindowElement(index), true)) {
29026   var windowWidth = this.GetWindowDimensionByIndex(index, true, false);
29027   var windowHeight = this.GetWindowDimensionByIndex(index, false, false);
29028   this.SetClientWindowSizeCoreLite(index, windowWidth, windowHeight);
29029  }
29030 },
29031 GetPinned: function() {
29032  return this.GetIsPinned(-1);
29033 },
29034 SetPinned: function(value) {
29035  this.SetPinCore(-1, value);
29036 },
29037 GetWindowPinned: function(window) {
29038  var index = (window != null) ? window.index : -1;
29039  return this.GetIsPinned(index);
29040 },
29041 SetWindowPinned: function(window, value) {
29042  var index = (window != null) ? window.index : -1;
29043  this.SetPinCore(index, value);
29044 },
29045 GetMaximized: function() {
29046  return this.GetIsMaximized(-1);
29047 },
29048 SetMaximized: function(value) {
29049  this.SetMaximizedCore(-1, value);
29050 },
29051 GetWindowMaximized: function(window) {
29052  var index = (window != null) ? window.index : -1;
29053  return this.GetIsMaximized(index);
29054 },
29055 SetWindowMaximized: function(window, value) {
29056  var index = (window != null) ? window.index : -1;
29057  this.SetMaximizedCore(index, value);
29058 },
29059 GetCollapsed: function() {
29060  return this.GetIsCollapsed(-1);
29061 },
29062 SetCollapsed: function(value) {
29063  this.SetCollapsedCore(-1, value);
29064 },
29065 GetWindowCollapsed: function(window) {
29066  var index = (window != null) ? window.index : -1;
29067  return this.GetIsCollapsed(index);
29068 },
29069 SetWindowCollapsed: function(window, value) {
29070  var index = (window != null) ? window.index : -1;
29071  this.SetCollapsedCore(index, value);
29072 },
29073 RefreshWindowContentUrl: function(window) {
29074  ASPxClientPopupControlBase.prototype.RefreshWindowContentUrl.call(this, window);
29075 },
29076 SetWindowContentVisible: function(index, visible) {
29077  var contentElement = this.GetWindowContentWrapperElement(index);
29078  if(contentElement)
29079   this.SetWindowPartVisibleCore(contentElement, "DXPopupWindowContentDisplay", visible);
29080 },
29081 SetWindowFooterVisible: function(index, visible) {
29082  var footerElement = this.GetWindowFooterElement(index);
29083  if(footerElement)
29084   this.SetWindowPartVisibleCore(footerElement, "DXPopupWindowFooterDisplay", visible);
29085 },
29086 SetWindowPartVisibleCore: function(partElement, displayCacheName, visible) {
29087  var nothingChanged = ASPx.IsElementVisible(partElement) && visible;
29088  if(nothingChanged) return;
29089  if(!(ASPx.IsExists(partElement[displayCacheName])))
29090   partElement[displayCacheName] = partElement.style.display;
29091  partElement.style.display = visible ? partElement[displayCacheName] : 'none';
29092 },
29093 UpdatePosition: function() {
29094  this.UpdatePositionAtElement(this.GetPopupElement(-1, this.GetLastShownPopupElementIndex(-1)));
29095 },
29096 UpdatePositionAtElement: function(popupElement) {
29097  ASPxClientPopupControlBase.prototype.UpdatePositionAtElement.call(this, popupElement);
29098 },
29099 UpdateWindowPosition: function(window) {
29100  var index = (window != null) ? window.index : -1;
29101  this.UpdateWindowPositionAtElement(window, this.GetPopupElement(index, this.GetLastShownPopupElementIndex(index)));
29102 },
29103 UpdateWindowPositionAtElement: function(window, popupElement) {
29104  ASPxClientPopupControlBase.prototype.UpdateWindowPositionAtElement.call(this, window, popupElement);
29105 },
29106 UpdateWindowPositionInternal: function(index, popupElement) {
29107  if(this.GetAdaptiveModalMode(index)) {
29108   this.TryAutoUpdatePosition(index);
29109   return;
29110  }
29111  if(!ASPxClientPopupControlBase.prototype.UpdateWindowPositionInternal.call(this, index, popupElement))
29112   this.DoShowWindowAtPos(index, ASPx.InvalidDimension, ASPx.InvalidDimension, this.GetLastShownPopupElementIndex(index), false, false);
29113 },
29114 UpdateMode: function(index) {
29115  if(!this.adaptivityEnabled) return;
29116  var currentMode = this.GetAdaptiveModalMode(index),
29117   newMode = this.NeedAdaptiveModalMode(index);
29118  if(currentMode != newMode) {
29119   this.SetAdaptiveModalMode(index, newMode);
29120   this.ShowWindowByIndex(-1);
29121   this.RaiseAdaptiveModeChanged();
29122  }
29123 },
29124 RaiseAdaptiveModeChanged: function() {
29125  if(!this.AdaptiveModeChanged.IsEmpty()) {
29126   var args = new ASPxClientEventArgs();
29127   this.AdaptiveModeChanged.FireEvent(this, args);
29128  }
29129 },
29130 TryAutoUpdatePosition: function(index) {
29131  this.UpdateMode(index);
29132  ASPxClientPopupControlBase.prototype.TryAutoUpdatePosition.call(this, index);
29133  if(this.GetAdaptiveModalMode(index)) {
29134   this.CorrectScrollPositionOnAndroid(index, false);
29135   this.ResetWebkitScrolling(this.GetModalWrapperElement(index), 100);
29136   this.UpdateHeightDimensions(index);
29137   this.ChangeHeaderFixed(index);
29138   this.UpdateAlignment(index);
29139   this.ChangeFooterFixed(index);
29140   if(this.GetIsDragged(index) &&
29141    ASPxClientPopupControl.WindowResizeHelper.AdjustModalOnWindowResize(this.GetWindowElement(index)))
29142    this.SetIsDragged(index, false);
29143  }
29144  if(this.GetIsMaximized(index)) {
29145   this.CorrectScrollPositionOnAndroid(index, true);
29146   this.UpdateMaximizedWindowSizeOnResize(index);
29147  }
29148 },
29149 CorrectScrollPositionOnAndroid: function(index, checkElementIsInPopup) {
29150  if(ASPx.Browser.AndroidMobilePlatform) {
29151   var activeElement = this.GetActiveElementIncludingIframes();
29152   if(activeElement && (activeElement.tagName === "INPUT" || activeElement.tagName === "TEXTAREA") &&
29153    (!checkElementIsInPopup || this.GetWindowElement(index).contains(activeElement)))
29154    window.setTimeout(function() {
29155     if(activeElement.scrollIntoViewIfNeeded)
29156      activeElement.scrollIntoViewIfNeeded();
29157    }, 100);
29158  }
29159 },
29160 GetActiveElementIncludingIframes: function(document) {
29161  document = document || window.document;
29162  if(document.body === document.activeElement || document.activeElement.tagName === "IFRAME") {
29163   var iframes = document.getElementsByTagName("iframe");
29164   for(var i = 0; i < iframes.length; i++) {
29165    var iFrameDocument = null;
29166    try {
29167     iFrameDocument = iframes[i].contentWindow.document;
29168    }
29169    catch(e) {  }
29170    if(iFrameDocument !== null) {
29171     var focused = this.GetActiveElementIncludingIframes(iframes[i].contentWindow.document);
29172     if(focused !== false) {
29173      return focused;
29174     }
29175    }
29176   }
29177  } else 
29178   return document.activeElement;
29179  return false;
29180 },
29181 OnModalWrapperScroll: function(e, index) {
29182  if(!this.GetAdaptiveModalMode(index) || this.IsWrapperScrollEventLocked()) return;
29183  this.ChangeHeaderFixed(index);
29184  this.ChangeFooterFixed(index);
29185 },
29186 OnModalWrapperTouchStart: function(e) {
29187  this.touchStartY = e.touches[0].clientY;
29188 },
29189 OnModalWrapperTouchMove: function (e, index) {
29190  if(e.touches.length > 1)
29191   return;
29192  var preventScroll = this.RequirePreventScrollForAdaptiveMode(e, index);
29193  if(preventScroll)
29194   ASPx.Evt.PreventEvent(e);
29195  this.touchStartY = e.touches[0].clientY;
29196 },
29197 RequirePreventScrollForAdaptiveMode: function(e, index) {
29198  var modalWrapper = this.GetModalWrapperElement(index),
29199   zoom = modalWrapper.offsetWidth / window.innerWidth,
29200   activeElement = document.activeElement,
29201   activeTyping = !!activeElement && (activeElement["type"] === "text" || activeElement["type"] === "textarea"); 
29202  if(zoom !== 1 || activeTyping)
29203   return false;
29204  var currentY = e.touches[0].clientY,
29205   preventScroll = currentY > this.touchStartY && modalWrapper.scrollTop === 0 ||
29206    currentY < this.touchStartY && modalWrapper.scrollTop + modalWrapper.clientHeight >= modalWrapper.scrollHeight;
29207  if(!preventScroll)
29208   return false;
29209  var targetElement = ASPx.Evt.GetEventSource(e),
29210   contentWrapper = this.GetWindowContentWrapperElement(index);
29211  while(targetElement && targetElement !== contentWrapper && targetElement.tagName !== 'BODY') {
29212   if(this.ElementHasScroll(targetElement))
29213    return false;
29214   targetElement = targetElement.parentNode;
29215  }
29216  return true;
29217 },
29218 ElementHasScroll: function(elem) {
29219  var style = window.getComputedStyle(elem);
29220  return ["overflow", "overflow-x", "overflow-y"].some(function(prop) {
29221   return ASPx.Data.ArrayContains(["scroll","auto"], style[prop]);
29222  });
29223 },
29224 GetFixedHeaderMaxBottom: function(index) {
29225  var contentWrapper = this.GetWindowContentWrapperElement(index);
29226  return ASPx.GetAbsolutePositionY(contentWrapper) + contentWrapper.offsetHeight;
29227 },
29228 GetFixedFooterMaxTop: function(index) {
29229  var header = this.GetWindowHeaderElement(index),
29230   contentWrapper = this.GetWindowContentWrapperElement(index),
29231   headerBottom = !!header ? ASPx.GetAbsolutePositionY(header) + header.offsetHeight : ASPx.GetAbsolutePositionY(contentWrapper);
29232  return window.innerHeight - headerBottom;
29233 },
29234 ChangeHeaderFixed: function(index) {
29235  if(!this.GetFixedHeader(index)) return;
29236  var element = this.GetWindowElement(index),
29237   modalWrapper = this.GetModalWrapperElement(index),
29238   isHeaderPartiallyHidden = modalWrapper.scrollTop > element.offsetTop,
29239   maxBottom = isHeaderPartiallyHidden ? this.GetFixedHeaderMaxBottom(index) : 0;
29240  this.FixateHeader(index, isHeaderPartiallyHidden, maxBottom);
29241 },
29242 ChangeFooterFixed: function(index) {
29243  if(!this.GetFixedFooter(index) || !this.GetWindowFooterElement(index)) return;
29244  var element = this.GetWindowElement(index),
29245   modalWrapper = this.GetModalWrapperElement(index),
29246   isFooterPartiallyHidden = element.offsetTop + element.offsetHeight - modalWrapper.scrollTop > window.innerHeight,
29247   maxTop = isFooterPartiallyHidden ? this.GetFixedFooterMaxTop(index) : 0;
29248  this.FixateFooter(index, isFooterPartiallyHidden, maxTop);
29249 },
29250 ChangeHeaderFooterFixed: function(index, elementToFix, isFixed, fixedClassName, offsetName, maxPos) {
29251  if(!elementToFix) return;
29252  var element = this.GetWindowElement(index),
29253   contentWrapper = this.GetWindowContentWrapperElement(index),
29254   changeClassNameFunc = isFixed ? ASPx.AddClassNameToElement : ASPx.RemoveClassNameFromElement,
29255   elementToFixHeight = elementToFix.offsetHeight;
29256  if(isFixed) {
29257   var borderOwner = this.GetWindowBorderOwnerElement(element),
29258    width = ASPx.GetClearClientWidth(borderOwner);
29259   ASPx.SetOffsetWidth(elementToFix, width);
29260   elementToFix.style[offsetName] = maxPos < elementToFixHeight ? maxPos - elementToFixHeight + "px" : "";
29261  } else
29262   elementToFix.style.width = "";
29263  contentWrapper.style["margin-" + offsetName] = isFixed ? elementToFixHeight + "px" : 0;
29264  changeClassNameFunc(elementToFix, fixedClassName);
29265 },
29266 FixateFooter: function(index, isFixed, maxTop) {
29267  this.ChangeHeaderFooterFixed(index, this.GetWindowFooterElement(index), isFixed, "dxFixedFooter", "bottom", maxTop);
29268 },
29269 FixateHeader: function(index, isFixed, maxBottom) {
29270  this.ChangeHeaderFooterFixed(index, this.GetWindowHeaderElement(index), isFixed, "dxFixedHeader", "top", maxBottom);
29271 },
29272 LockWrapperScrollEvent: function() {
29273  this.wrapperScrollEventLocked = true;
29274 },
29275 UnlockWrapperScrollEventEvent: function() {
29276  this.wrapperScrollEventLocked = false;
29277 },
29278 IsWrapperScrollEventLocked: function() {
29279  return this.wrapperScrollEventLocked;
29280 },
29281 ResetScroll: function(index) {
29282  if(!this.GetAdaptiveModalMode(index)) return;
29283  this.LockWrapperScrollEvent();
29284  this.GetModalWrapperElement(index).scrollTop = 0;
29285  this.UnlockWrapperScrollEventEvent();
29286 },
29287 AdjustModalElementBounds: function(element) {
29288  if(!ASPx.IsExistsElement(element)) return;
29289  ASPx.SetStyles(element, {
29290   left: 0,
29291   top: 0,
29292   right: 0,
29293   bottom: 0,
29294   width: "",
29295   height: ""
29296  });
29297 },
29298 RefreshPopupElementConnection: function() {
29299  ASPxClientPopupControlBase.prototype.RefreshPopupElementConnection.call(this);
29300 }
29301});
29302ASPxClientPopupControl.AligmentCalculator = (function() {
29303 function CalculateTopMargin(verticalAlign, elementHeight, defaultOffset) {
29304  if(verticalAlign === ModalAlign.WindowTop)
29305   return "";
29306  if(elementHeight < window.innerHeight) {
29307   var freeSpace = window.innerHeight - elementHeight;
29308   switch(verticalAlign) {
29309    case ModalAlign.WindowCenter:
29310     return freeSpace / 2;
29311    case ModalAlign.WindowBottom:
29312     return freeSpace - defaultOffset;
29313   }
29314  }
29315  return "";
29316 }
29317 function CalculateLeftRightMargin(horizontalAlign, forAligmenment, wrapperPadding) {
29318  if(horizontalAlign === forAligmenment) {
29319   if(ASPx.PxToInt(wrapperPadding) !== 0)
29320    return 0;
29321   return 10;
29322  }
29323  return "";
29324 }
29325 return {
29326  CalculateTopMargin: CalculateTopMargin,
29327  CalculateLeftRightMargin: CalculateLeftRightMargin
29328 };
29329})();
29330ASPxClientPopupControl.Animation = (function() {
29331 function GetVerticalDirection(verticalAlign, horizontalAlign) {
29332  switch(verticalAlign) {
29333   case ModalAlign.WindowTop:
29334    return -1;
29335   case ModalAlign.WindowCenter:
29336    if(horizontalAlign === ModalAlign.WindowCenter)
29337     return -1;
29338    return 0;
29339   case ModalAlign.WindowBottom:
29340    return 1;
29341  }
29342 }
29343 function GetHorizontalDirection(horizontalAlign) {
29344  switch(horizontalAlign) {
29345   case ModalAlign.WindowLeft:
29346    return -1;
29347   case ModalAlign.WindowCenter:
29348    return 0;
29349   case ModalAlign.WindowRight:
29350    return 1;
29351  }
29352 }
29353 function NeedFadeAnimation(horizontalAlign, verticalAlign, animationType, popupHorizontalAlign, popupVerticalAlign, adaptiveModalMode) {
29354  if(animationType === ASPxClientPopupControlBase.AnimationType.Auto) {
29355   if(adaptiveModalMode)
29356    return horizontalAlign === ModalAlign.WindowCenter && verticalAlign === ModalAlign.WindowCenter;
29357   else
29358    return popupHorizontalAlign === ASPx.PopupUtils.WindowCenterAlignIndicator && popupVerticalAlign === ASPx.PopupUtils.WindowCenterAlignIndicator;
29359  }
29360  return false;
29361 }
29362 return {
29363  GetVerticalDirection: GetVerticalDirection,
29364  GetHorizontalDirection: GetHorizontalDirection,
29365  NeedFadeAnimation: NeedFadeAnimation
29366 };
29367})();
29368ASPxClientPopupControl.WindowResizeHelper = (function() {
29369 var previousInnerWidth = 0,
29370  previousMargin = 0;
29371 function AdjustModalOnWindowResize(element) {
29372  var offsetLeft = element.offsetLeft,
29373   offsetWidth = element.offsetWidth,
29374   windowWidth = window.innerWidth,
29375   expectedLeft = windowWidth / 2 - offsetWidth / 2,
29376   toTheRightOfCenter = offsetLeft > expectedLeft,
29377   dw = windowWidth - previousInnerWidth,
29378   computedStyle = getComputedStyle(element),
29379   left = ASPx.PxToFloat(computedStyle.left),
29380   currentMargin = ASPx.PxToFloat(computedStyle.marginLeft),
29381   dm = currentMargin - previousMargin,
29382   newLeft = left - dm;
29383  if(toTheRightOfCenter)
29384   newLeft += dw;
29385  ASPx.SetStyles(element, { left: newLeft + "px" });
29386  if(Math.abs(offsetLeft - expectedLeft) <= 10 || dw < 0 && toTheRightOfCenter !== (element.offsetLeft > expectedLeft)) {
29387   ASPx.SetStyles(element, { left: "" });
29388   ASPx.Attr.RestoreStyleAttribute(element, "top");
29389   ASPx.Attr.RestoreStyleAttribute(element, "margin-top");
29390   return true;
29391  }
29392  previousMargin = currentMargin;
29393  previousInnerWidth = windowWidth;
29394  return false;
29395 }
29396 function Initialize(element) {
29397  previousInnerWidth = window.innerWidth;
29398  ASPx.Attr.ChangeStyleAttribute(element, "top", element.offsetTop + "px");
29399  ASPx.Attr.ChangeStyleAttribute(element, "margin-top", "0");
29400  previousMargin = ASPx.PxToFloat(getComputedStyle(element).marginLeft);
29401 }
29402 return {
29403  Initialize: Initialize,
29404  AdjustModalOnWindowResize: AdjustModalOnWindowResize
29405 };
29406})();
29407ASPxClientPopupControl.Cast = ASPxClientControl.Cast;
29408ASPxClientPopupControl.GetPopupControlCollection = function() {
29409 return aspxGetPopupControlCollection();
29410};
29411var ASPxClientPopupWindow = ASPx.CreateClass(null, {
29412 constructor: function(popupControl, index, name) {
29413  this.popupControl = popupControl;
29414  this.index = index;
29415  this.name = name;
29416 },
29417 GetHeaderImageUrl: function() {
29418  return this.popupControl.GetWindowHeaderImageUrl(this.index);
29419 },
29420 SetHeaderImageUrl: function(value) {
29421  this.popupControl.SetWindowHeaderImageUrl(this.index, value);
29422 },
29423 GetFooterImageUrl: function() {
29424  return this.popupControl.GetWindowFooterImageUrl(this.index);
29425 },
29426 SetFooterImageUrl: function(value) {
29427  this.popupControl.SetWindowFooterImageUrl(this.index, value);
29428 },
29429 GetHeaderNavigateUrl: function() {
29430  return this.popupControl.GetWindowHeaderNavigateUrl(this.index);
29431 },
29432 SetHeaderNavigateUrl: function(value) {
29433  this.popupControl.SetWindowHeaderNavigateUrl(this.index, value);
29434 },
29435 GetFooterNavigateUrl: function() {
29436  return this.popupControl.GetWindowFooterNavigateUrl(this.index);
29437 },
29438 SetFooterNavigateUrl: function(value) {
29439  this.popupControl.SetWindowFooterNavigateUrl(this.index, value);
29440 },
29441 GetHeaderText: function() {
29442  return this.popupControl.GetWindowHeaderText(this.index);
29443 },
29444 SetHeaderText: function(value) {
29445  this.popupControl.SetWindowHeaderText(this.index, value);
29446 },
29447 GetFooterText: function() {
29448  return this.popupControl.GetWindowFooterText(this.index);
29449 },
29450 SetFooterText: function(value) {
29451  this.popupControl.SetWindowFooterText(this.index, value);
29452 }
29453});
29454var ASPxClientPopupWindowEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
29455 constructor: function(window) {
29456  this.constructor.prototype.constructor.call(this);
29457  this.window = window;
29458 }
29459});
29460var ASPxClientPopupWindowCancelEventArgs = ASPx.CreateClass(ASPxClientCancelEventArgs, {
29461 constructor: function(window, closeReason) {
29462  this.constructor.prototype.constructor.call(this);
29463  this.window = window;
29464  this.closeReason = closeReason;
29465 }
29466});
29467var ASPxClientPopupWindowCloseUpEventArgs = ASPx.CreateClass(ASPxClientPopupWindowEventArgs, {
29468 constructor: function(window, closeReason) {
29469  this.constructor.prototype.constructor.call(this, window);
29470  this.closeReason = closeReason;
29471 }
29472});
29473var ASPxClientPopupWindowResizeEventArgs = ASPx.CreateClass(ASPxClientPopupWindowEventArgs, {
29474 constructor: function(window, resizeState) {
29475  this.constructor.prototype.constructor.call(this, window);
29476  this.resizeState = resizeState;
29477 }
29478});
29479var ASPxClientPopupWindowPinnedChangedEventArgs = ASPx.CreateClass(ASPxClientPopupWindowEventArgs, {
29480 constructor: function(window, pinned) {
29481  this.constructor.prototype.constructor.call(this, window);
29482  this.pinned = pinned;
29483 }
29484});
29485var ASPxClientPopupControlCollection = ASPx.CreateClass(ASPxClientControlCollection, {
29486 constructor: function() {
29487  this.constructor.prototype.constructor.call(this);
29488  this.draggingControl = null;
29489  this.draggingWindowIndex = -1;
29490  this.gragXOffset = 0;
29491  this.gragYOffset = 0;
29492  this.visibleModalElements = [];
29493  this.visiblePopupWindowIds = [];
29494  this.windowResizeByBodyScrollVisibilityChangingLockCount = 0;
29495  this.savedBodyWidth = 0;
29496  this.savedBodyHeight = 0;
29497  this.overControl = null;
29498  this.overWindowIndex = -1;
29499  this.overXPos = ASPx.InvalidPosition;
29500  this.overYPos = ASPx.InvalidPosition;
29501  this.appearTimerID = -1;
29502  this.disappearTimerID = -1;
29503  this.scrollEventLockCount = 0;
29504  this.currentActiveWindowElement = null;
29505  this.resizeControl = null;
29506  this.resizeIndex = -2;
29507  this.resizeCursor = "";
29508  this.resizePanel = null;
29509  this.selectBanned = false;
29510  this.pcWindowsAreRestrictedByDocumentWindow = true;
29511  this.docScrollLeft = -1;
29512  this.docScrollTop = -1;
29513  this.EnsureSaveScrollState();
29514 },
29515 GetCollectionType: function(){
29516  return "Popup";
29517 },
29518 Remove: function(popupControl) {
29519  for(var i = this.visibleModalElements.length - 1; i >= 0; i--) {
29520   var modalElement = this.visibleModalElements[i];
29521   if(modalElement && modalElement.DXModalPopupControl === popupControl)
29522    this.UnregisterVisibleModalElement(modalElement);
29523  }
29524  for(var j = this.visiblePopupWindowIds.length - 1; j >= 0; j--) {
29525   var id = this.visiblePopupWindowIds[j];
29526   if(!ASPx.IsExists(id)) continue;
29527   var popupWindow = this.GetPopupWindowFromID(id);
29528   if(popupWindow.popupControl === popupControl) {
29529    var windowElement = popupControl.GetWindowElement(popupWindow.windowIndex);
29530    if(windowElement)
29531     this.UnregisterVisibleWindow(windowElement);
29532    else
29533     ASPx.Data.ArrayRemove(this.visiblePopupWindowIds, id);
29534   }
29535  }
29536  ASPxClientControlCollection.prototype.Remove.call(this, popupControl);
29537 },
29538 EnsureSaveScrollState: function() {
29539  if(ASPx.documentLoaded && this.docScrollLeft < 0 && this.docScrollTop < 0)
29540   this.SaveScrollState();
29541 },
29542 GetPopupWindowFromID: function(id) {
29543  var pos = id.lastIndexOf(ASPx.PCWIdSuffix);
29544  var name = id.substring(0, pos);
29545  var index = id.substr(pos + ASPx.PCWIdSuffix.length);
29546  var popupControl = aspxGetPopupControlCollection().Get(name);
29547  return { popupControl: popupControl, windowIndex: index };
29548 },
29549 DoHideAllWindows: function(srcElement, excptId, applyToAll, closeReason, posX) {
29550  for(var i = this.visiblePopupWindowIds.length - 1; i >= 0; i--) {
29551   var id = this.visiblePopupWindowIds[i];
29552   if(id == excptId) continue;
29553   var popupWindow = this.GetPopupWindowFromID(id),
29554    windowIndex = popupWindow.windowIndex,
29555    popupControl = popupWindow.popupControl;
29556   if(!popupControl.CanBeClosedByClickOnElement(windowIndex, srcElement, posX, id)) continue;
29557   if(popupControl != null) {
29558    var popupWindowZIndexArray = ASPx.PopupUtils.GetElementZIndexArray(popupControl.GetWindowElement(windowIndex));
29559    var isPopupHigherSrcElement = ASPx.PopupUtils.IsHigher(popupWindowZIndexArray, ASPx.PopupUtils.GetElementZIndexArray(srcElement)) || !popupControl.HasDefaultWindow();
29560    var windowCloseAction = popupControl.GetWindowCloseAction(windowIndex);
29561    if ((windowCloseAction != "CloseButton" && windowCloseAction != "None") && isPopupHigherSrcElement || applyToAll)
29562     popupControl.DoHideWindow(parseInt(windowIndex), false, closeReason);
29563   }
29564  }
29565 },
29566 RefreshModalRenderInIe: function() {
29567  if(ASPx.Browser.IE && ASPx.Browser.Version === 11 && this.visibleModalElements.length > 0) {
29568   var topModalWindow = this.GetTopModalWindow();
29569   if(topModalWindow) {
29570    var popupWindow = this.GetPopupWindowFromID(topModalWindow.id),
29571     windowIndex = popupWindow.windowIndex,
29572     popupControl = popupWindow.popupControl;
29573    if(popupControl)
29574     popupControl.RefreshModalRenderInIe(windowIndex);
29575   }
29576  }
29577 },
29578 DoShowAtCurrentPos: function(name, index, popupElementIndex, evtClone) {
29579  var pc = this.Get(name);
29580  if(pc != null && !pc.InternalIsWindowVisible(index))
29581   pc.DoShowWindowCore(index, this.overXPos, this.overYPos, popupElementIndex, true, true, evtClone, ASPxClientPopupControlCloseReason.MouseOut);
29582 },
29583 WindowZIndexWasInitialized: function(zIndex, pcZIndex) {
29584  return pcZIndex <= zIndex;
29585 },
29586 ActivateWindowElement: function(element, evt, popupType, defZIndex, zIndex) {
29587  var maxZIndex = this.GetMaxZIndex(popupType, defZIndex),
29588   topZIndex = this.WindowZIndexWasInitialized(maxZIndex, zIndex) ? parseInt(maxZIndex) : zIndex;
29589  if(this.WindowZIndexWasInitialized(element.style.zIndex, zIndex) && element.style.zIndex != topZIndex) {
29590   this.DeleteWindowFromZIndexOrder(element);
29591  }
29592  if(!this.WindowZIndexWasInitialized(element.style.zIndex, zIndex))
29593   topZIndex += 2;
29594  var popupWindow = this.GetPopupWindowFromID(element.id);
29595  popupWindow.popupControl.SetWindowElementZIndex(element, topZIndex);
29596  var pcWElementEventSource = ASPx.PopupUtils.FindEventSourceParentByTestFunc(evt, aspxTestPopupWindowElement);
29597  if(!evt || (evt && pcWElementEventSource == element)) { 
29598   if(this.GetCurrentActiveWindowElement() != element) {
29599    this.RefreshTabIndexes(false);
29600    this.SaveCurrentActiveWindowElement(element);
29601   }
29602  }
29603 },
29604 RefreshTabIndexes: function(forceRecalculate) {
29605  var topModalWindow = this.GetTopModalWindow();
29606  if(topModalWindow != null || forceRecalculate) {
29607   var topModalWindowZIndexArray = ASPx.PopupUtils.GetElementZIndexArray(topModalWindow);
29608   this.CalculateTabIndexes(topModalWindowZIndexArray);
29609  }
29610 },
29611 ElementHasTabIndex: function(element) {
29612  return ASPx.IsExists(ASPx.Attr.GetAttribute(element, "tabindex"));
29613 },
29614 IsElementCanBeActive: function(element) { 
29615  return element.tagName === "INPUT" || element.tagName === "A" ||
29616   element.tagName === "BUTTON" || element.tagName === "TEXTAREA" ||
29617   element.tagName === "SELECT" || this.ElementHasTabIndex(element);
29618 },
29619 GetCanBeActiveElements: function() { 
29620  var elements = document.getElementsByTagName("*"),
29621   canBeActiveElements = [];
29622  for(var i = 0; i < elements.length; i++) {
29623   if(this.IsElementCanBeActive(elements[i]))
29624    canBeActiveElements.push(elements[i]);
29625  }
29626  return canBeActiveElements;
29627 },
29628 GetEditableDivs: function(){
29629  if(document.querySelectorAll)
29630   return document.querySelectorAll("div[contenteditable=true]");
29631  var editableDivs = [ ];
29632  var allDivs = document.getElementsByTagName("DIV");
29633  for(var i = 0; i < allDivs.length; i++){
29634   var div = allDivs[i];
29635   if(div.getAttribute("contenteditable") == 'true')
29636    editableDivs.push(div);
29637  }
29638  return editableDivs;
29639 },
29640 CalculateTabIndexes: function(topModalWindowZIndexArray) {
29641  var elements = this.GetCanBeActiveElements();
29642  for(var i = 0; i < elements.length; i++) {
29643   var currentElementZIndexArray = ASPx.PopupUtils.GetElementZIndexArray(elements[i]),
29644    manager = ASPx.ControlTabIndexManager.getInstance(),
29645    tabIndexManagerGroupId = "pcCollection";
29646   if(ASPx.PopupUtils.IsHigher(currentElementZIndexArray, topModalWindowZIndexArray))
29647    manager.restoreTabIndexAttribute(elements[i], tabIndexManagerGroupId);
29648   else
29649    manager.changeTabIndexAttribute(elements[i], tabIndexManagerGroupId);
29650  }
29651 },
29652 PopupWindowIsModalByVisibleIndex: function(visiblePopupWindowIndex) {
29653  return this.PopupWindowIsModalByID(this.visiblePopupWindowIds[visiblePopupWindowIndex]);
29654 },
29655 PopupWindowIsModalByID: function(windowElementID) {
29656  var popupWindow = this.GetPopupWindowFromID(windowElementID);
29657  return popupWindow.popupControl.WindowIsModal(popupWindow.windowIndex);
29658 },
29659 SaveCurrentActiveWindowElement: function(windowElement) {
29660  this.currentActiveWindowElement = windowElement;
29661 },
29662 SkipCurrentActiveWindowElement: function(element) {
29663  if(element == this.GetCurrentActiveWindowElement())
29664   this.SaveCurrentActiveWindowElement(null);
29665 },
29666 GetCurrentActiveWindowElement: function() {
29667  return this.currentActiveWindowElement;
29668 },
29669 GetMaxZIndex: function (type, defaultZIndex) {
29670  var maxZIndex = defaultZIndex;
29671  for(var i = 0; i < this.visiblePopupWindowIds.length; i++) {
29672   var id = this.visiblePopupWindowIds[i];
29673   if(type !== undefined && this.GetPopupWindowFromID(id).popupControl.GetPopupType() !== type)
29674    continue;
29675   var currentWindow = ASPx.GetElementById(id);
29676   if(!!currentWindow && ASPx.IsElementVisible(currentWindow) && currentWindow.style && currentWindow.style.zIndex > maxZIndex)
29677    maxZIndex = currentWindow.style.zIndex;
29678  }
29679  return maxZIndex;
29680 },
29681 GetTopModalWindow: function() {
29682  return this.GetTopWindow(true);
29683 },
29684 GetTopWindow: function(onlyModal) {
29685  var topWindow = null;
29686  var topWindowZIndexArray = null;
29687  for(var i = 0; i < this.visiblePopupWindowIds.length; i++) {
29688   var currentWindow = ASPx.GetElementById(this.visiblePopupWindowIds[i]);
29689   if(onlyModal && !this.PopupWindowIsModalByVisibleIndex(i))
29690    continue;
29691   if(ASPx.IsElementVisible(currentWindow)) {
29692    var currentWindowZIndexArray = ASPx.PopupUtils.GetElementZIndexArray(currentWindow);
29693    if(topWindow == null || ASPx.PopupUtils.IsHigher(currentWindowZIndexArray, topWindowZIndexArray)) {
29694     topWindow = currentWindow;
29695     topWindowZIndexArray = currentWindowZIndexArray;
29696    }
29697   }
29698  }
29699  return topWindow;
29700 },
29701 DeleteWindowFromZIndexOrder: function(element) {
29702  for(var i = this.visiblePopupWindowIds.length - 1; i >= 0; i--) {
29703   var windowElement = ASPx.GetElementById(this.visiblePopupWindowIds[i]);
29704   if(!windowElement)
29705    ASPx.Data.ArrayRemoveAt(this.visiblePopupWindowIds, i);
29706   else if(windowElement.style.zIndex > element.style.zIndex) {
29707    var popupWindow = this.GetPopupWindowFromID(this.visiblePopupWindowIds[i]);
29708    popupWindow.popupControl.SetWindowElementZIndex(windowElement, windowElement.style.zIndex - 2);
29709   }
29710  }
29711 },
29712 AdjustModalElementsBounds: function() {
29713  for(var i = 0; i < this.visibleModalElements.length; i++)
29714   this.visibleModalElements[i].DXModalPopupControl.AdjustModalElementBounds(this.visibleModalElements[i]);
29715 },
29716 ClearAppearTimer: function() {
29717  this.appearTimerID = ASPx.Timer.ClearTimer(this.appearTimerID);
29718 },
29719 ClearDisappearTimer: function() {
29720  this.disappearTimerID = ASPx.Timer.ClearTimer(this.disappearTimerID);
29721 },
29722 IsAppearTimerActive: function() {
29723  return this.appearTimerID > -1;
29724 },
29725 IsDisappearTimerActive: function() {
29726  return this.disappearTimerID > -1;
29727 },
29728 SetAppearTimer: function(name, index, popupElementIndex, timeout, evt) {
29729  var evtClone = ASPx.CloneObject(evt);
29730  this.appearTimerID = window.setTimeout(function() {
29731   aspxGetPopupControlCollection().DoShowAtCurrentPos(name, index, popupElementIndex, evtClone);
29732  }, timeout);
29733 },
29734 SetDisappearTimer: function(name, index, timeout) {
29735  this.disappearTimerID = window.setTimeout(function() {
29736   aspxGetPopupControlCollection().OnPWDisappearTimer(name, index);
29737  }, timeout);
29738 },
29739 GetDocScrollDifference: function() {
29740  return new _aspxScrollDifference(ASPx.GetDocumentScrollLeft() - this.docScrollLeft, ASPx.GetDocumentScrollTop() - this.docScrollTop);
29741 },
29742 IsDocScrolled: function(scroll) {
29743  return scroll.horizontal != 0 || scroll.vertical != 0;
29744 },
29745 SaveScrollState: function() {
29746  this.docScrollLeft = ASPx.GetDocumentScrollLeft();
29747  this.docScrollTop = ASPx.GetDocumentScrollTop();
29748 },
29749 InitDragObject: function(control, index, x, y, xClientCorrection, yClientCorrection) {
29750  this.draggingControl = control;
29751  this.draggingWindowIndex = index;
29752  this.gragXOffset = x;
29753  this.gragYOffset = y;
29754  this.xClientCorrection = xClientCorrection;
29755  this.yClientCorrection = yClientCorrection;
29756  this.SetDocumentSelectionBan(true);
29757 },
29758 InitOverObject: function(control, index, evt) {
29759  this.overControl = control;
29760  this.overWindowIndex = index;
29761  if(evt)
29762   this.SaveCurrentMouseOverPos(evt);
29763 },
29764 InitResizeObject: function(control, index, cursor, resizePanel) {
29765  this.resizeControl = control;
29766  this.resizeIndex = index;
29767  this.resizeCursor = cursor;
29768  this.resizePanel = resizePanel;
29769  this.SetDocumentSelectionBan(true);
29770 },
29771 SetDocumentSelectionBan: function(value) {
29772  if(this.selectBanned === value)
29773   return;
29774  this.selectBanned = value;
29775  if(ASPx.Browser.WebKitFamily) {
29776   if(value) {
29777    if(!this.webkitUserSelectBackup && document.body.style.webkitUserSelect)
29778     this.webkitUserSelectBackup = document.body.style.webkitUserSelect;
29779    document.body.style.webkitUserSelect = "none";
29780   } else {
29781    if(this.webkitUserSelectBackup) {
29782     document.body.style.webkitUserSelect = this.webkitUserSelectBackup;
29783     delete this.webkitUserSelectBackup;
29784    } else
29785     document.body.style.webkitUserSelect = "auto";
29786   }
29787  }
29788 },
29789 IsResizeInint: function() {
29790  return this.resizeControl != null;
29791 },
29792 ClearDragObject: function() {
29793  this.draggingControl = null;
29794  this.draggingWindowIndex = -1;
29795  this.gragXOffset = 0;
29796  this.gragYOffset = 0;
29797  this.SetDocumentSelectionBan(this.resizeControl != null);
29798 },
29799 ClearResizeObject: function() {
29800  this.resizeControl = null;
29801  this.resizeIndex = -2;
29802  this.resizeCursor = "";
29803  this.SetDocumentSelectionBan(this.draggingControl != null);
29804  this.resizePanel.parentNode.removeChild(this.resizePanel);
29805 },
29806 Drag: function(evt) {
29807  if(ASPx.tableColumnResizing || ASPx.currentDragHelper || !ASPx.Evt.IsLeftButtonPressed(evt)) return;
29808  var x = ASPx.Evt.GetEventX(evt);
29809  var y = ASPx.Evt.GetEventY(evt);
29810  if(this.pcWindowsAreRestrictedByDocumentWindow && ASPx.PopupUtils.CoordinatesInDocumentRect(x, y)) {
29811   x += this.gragXOffset;
29812   y += this.gragYOffset;
29813   this.draggingControl.OnDrag(this.draggingWindowIndex, x, y, this.xClientCorrection, this.yClientCorrection, evt);
29814   if(ASPx.Browser.WebKitTouchUI)
29815    ASPx.Evt.PreventEvent(evt);
29816  }
29817 },
29818 DragStop: function() {
29819  this.draggingControl.OnDragStop(this.draggingWindowIndex);
29820  this.ClearDragObject();
29821 },
29822 ResizeStop: function(evt) {
29823  this.resizeControl.OnResizeStop(evt, this.resizeIndex, this.resizeCursor, this.resizePanel);
29824  aspxGetPopupControlCollection().ClearResizeObject();
29825 },
29826 setIframesMouseMoveEnabled: function(enabled) {
29827  for(var i = 0; i < this.visiblePopupWindowIds.length; i++) {
29828   var popupWindow = this.GetPopupWindowFromID(this.visiblePopupWindowIds[i]);
29829   var popupControl = popupWindow.popupControl;
29830   if(popupControl) {
29831    var iframe = popupControl.GetWindowContentIFrameElement(popupWindow.windowIndex);
29832    if(iframe) {
29833     iframe.style.pointerEvents = enabled ? "" : "none";
29834     if(ASPx.Browser.IE && ASPx.Browser.MajorVersion < 11) {
29835      if(enabled)
29836       popupControl.RemoveIframeCoverDiv(iframe, popupWindow.windowIndex);
29837      else
29838       popupControl.CreateIframeCoverDiv(iframe, popupWindow.windowIndex);
29839     }
29840    }
29841   }
29842  }
29843 },
29844 OnPWMouseMove: function(evt, name, index) {
29845  if(this.draggingControl == null &&
29846   this.overControl == null &&
29847   this.resizeControl == null) {
29848   var pc = aspxGetPopupControlCollection().Get(name);
29849   if(pc != null) pc.OnMouseMove(evt, index);
29850  }
29851 },
29852 OnPWMouseOver: function(evt) {
29853  if(!this.overControl || this.draggingControl) return;
29854  if(this.IsOverPopupWindow(evt))
29855   this.ClearDisappearTimer();
29856 },
29857 IsOverPopupWindow: function(evt) {
29858  return ASPx.PopupUtils.FindEventSourceParentByTestFunc(evt, aspxTestPopupControlOverElement) != null;
29859 },
29860 OnDocumentKeyDown: function(evt) {
29861  var windowElement = this.GetTopWindow(false);
29862  if(windowElement) {
29863   var window = this.GetPopupWindowFromID(windowElement.id);
29864   if(window.popupControl);
29865    window.popupControl.OnDocumentKeyDown(evt, windowElement);
29866  }
29867 },
29868 OnDocumentMouseDown: function(evt) {
29869  var popupElement = ASPx.PopupUtils.FindEventSourceParentByTestFunc(evt, aspxTestPopupControlElement);
29870  var excptId = popupElement == null ? "" :
29871   popupElement.DXPopupElementControl.GetWindowElementId(popupElement.DXPopupWindowIndex);
29872  this.OnMouseDownCore(evt, excptId);
29873 },
29874 OnMouseDown: function(evt) {
29875  this.OnMouseDownCore(evt, "");
29876 },
29877 OnMouseDownCore: function(evt, excptId) {
29878  var srcElement = ASPx.Evt.GetEventSource(evt);
29879  this.DoHideAllWindows(srcElement, excptId, false, ASPxClientPopupControlCloseReason.OuterMouseClick, ASPx.Evt.GetEventX(evt));
29880  aspxGetPopupControlCollection().ClearAppearTimer();
29881 },
29882 OnMouseMove: function (evt) {
29883  if(ASPx.Browser.WebKitTouchUI && ASPx.TouchUIHelper.isGesture)
29884   return;
29885  if(this.draggingControl != null) {
29886   this.Drag(evt);
29887  }
29888  else if(this.overControl != null) {
29889   this.OnMouseOver(evt);
29890  }
29891  else if(this.resizeControl != null) {
29892   if(ASPx.Browser.IE && !ASPx.Evt.IsLeftButtonPressed(evt))
29893    this.ResizeStop(evt);
29894   else
29895    this.resizeControl.OnResize(evt, this.resizeIndex, this.resizeCursor, this.resizePanel);
29896  }
29897 },
29898 OnMouseOver: function(evt) {
29899  var element = ASPx.PopupUtils.FindEventSourceParentByTestFunc(evt, aspxTestPopupControlOverElement);
29900  var curPopupElement = this.overControl.GetWindowCurrentPopupElementByIndex(this.overWindowIndex);
29901  var popup = element != null ? element.DXPopupElementControl : null;
29902  var isPopupActionMouseOver = popup && popup.GetWindowPopupAction(this.overWindowIndex) == 'MouseOver';
29903  var isCurPopupElement = element !== null && element === curPopupElement;
29904  var isCurPopupWindow = element != null && element.id === this.overControl.GetWindowElementId(this.overWindowIndex);
29905  var isCurPopupElementOrCurPopupWindow = isCurPopupElement || isCurPopupWindow || isPopupActionMouseOver;
29906  if(isCurPopupElementOrCurPopupWindow) {
29907   var clearTimer = true;
29908   popup = element.DXPopupElementControl;
29909   if(popup && popup.GetLastShownPopupElementIndex(element.DXPopupWindowIndex) != element.DXPopupElementIndex)
29910    clearTimer = false;
29911   if(clearTimer)
29912    this.ClearDisappearTimer();
29913   this.SaveCurrentMouseOverPos(evt);
29914   return;
29915  }
29916  this.OnMouseOut();
29917 },
29918 OnMouseOut: function(evt) {
29919  if(!this.overControl || this.draggingControl) return;
29920  this.ClearAppearTimer();
29921  var windowCloseAction = this.overControl.GetWindowCloseAction(this.overWindowIndex);
29922  if(windowCloseAction == "MouseOut" && this.overControl.InternalIsWindowVisible(this.overWindowIndex)) {
29923   if(!this.IsDisappearTimerActive() && this.IsDisappearAllowedByMouseOut(evt))
29924    this.SetDisappearTimer(this.overControl.name, this.overWindowIndex, this.overControl.disappearAfter);
29925  }
29926  else
29927   this.OverStop();
29928 },
29929 IsDisappearAllowedByMouseOut: function(evt) {
29930  return ASPx.Browser.Firefox || ASPx.Browser.Chrome ? !this.IsOverPopupWindow(evt) : true;  
29931 },
29932 OnMouseUp: function(evt) {
29933  if(this.draggingControl != null)
29934   this.DragStop();
29935  if(this.resizeControl != null)
29936   this.ResizeStop(evt);
29937 },
29938 OnResize: function(evt) {
29939  this.AutoUpdateElementsPosition();
29940  this.AdjustModalElementsBounds();
29941 },
29942 OnScroll: function(evt) {
29943  if(this.scrollEventLockCount > 0)
29944   return;
29945  var scroll = this.GetDocScrollDifference();
29946  if(this.IsDocScrolled(scroll)) { 
29947   this.CorrectPositionAtScroll(scroll);
29948   this.AdjustModalElementsBounds();
29949   this.SaveScrollState();
29950  }
29951  this.CalculateDocumentDimensionsWithoutPinnedWindows(evt);
29952  this.FireScrollEventToWindows(evt);
29953 },
29954 GetSavedBodyWidth: function() {
29955  if(this.savedBodyWidth == 0)
29956   this.CalculateDocumentDimensionsWithoutPinnedWindows();
29957  return this.savedBodyWidth;
29958 },
29959 GetSavedBodyHeight: function() {
29960  if(this.savedBodyHeight == 0)
29961   this.CalculateDocumentDimensionsWithoutPinnedWindows();
29962  return this.savedBodyHeight;
29963 },
29964 HidePinnedPopupsThatOutFromViewPort: function() {
29965  var popupsToRestoreVisible = [];
29966  for(var i = 0; i < this.visiblePopupWindowIds.length; i++) {
29967   var popupWindow = this.GetPopupWindowFromID(this.visiblePopupWindowIds[i]);
29968   var popupControl = popupWindow.popupControl;
29969   if(!popupControl.needToHidePinnedOutFromViewPort(popupWindow.windowIndex))
29970    continue;
29971   var element = popupControl.GetWindowElement(popupWindow.windowIndex);
29972   if(!element) continue;
29973   var restoreData = {};
29974   restoreData.element = element;
29975   restoreData.display = element.style.display;
29976   element.style.display = "none";
29977   popupsToRestoreVisible.push(restoreData);
29978  }
29979  return popupsToRestoreVisible;
29980 },
29981 RestorePinnedPopupsThatOutFromViewPort: function(popupsToRestoreVisible) {
29982  if(popupsToRestoreVisible.length > 0) {
29983   for(var i = 0; i < popupsToRestoreVisible.length; i++) {
29984    var restoreData = popupsToRestoreVisible[i];
29985    restoreData.element.style.display = restoreData.display;
29986   }
29987  }
29988 },
29989 CalculateDocumentDimensionsWithoutPinnedWindows: function(evt) { 
29990  var popupsToRestoreVisible = [];
29991  var needToHideRestorePopupsThatOutFromViewPort = !!evt && ASPx.Evt.GetEventSource(evt) == document;
29992  if(needToHideRestorePopupsThatOutFromViewPort)
29993   popupsToRestoreVisible = this.HidePinnedPopupsThatOutFromViewPort();
29994  this.savedBodyWidth = ASPx.GetDocumentWidth();
29995  this.savedBodyHeight = ASPx.GetDocumentHeight();
29996  if(needToHideRestorePopupsThatOutFromViewPort)
29997   this.RestorePinnedPopupsThatOutFromViewPort(popupsToRestoreVisible);
29998 },
29999 FireScrollEventToWindows: function(evt) {
30000  for(var i = 0; i < this.visiblePopupWindowIds.length; i++) {
30001   var popupWindow = this.GetPopupWindowFromID(this.visiblePopupWindowIds[i]);
30002   var popupControl = popupWindow.popupControl;
30003   popupControl.OnScroll(evt, popupWindow.windowIndex);
30004  }
30005 },
30006 CalculateDocumentDimensionsWithoutPinnedWindowsOldIE: function(onCalculateFinished, evt) {  
30007  var popupsToRestoreVisible = [];
30008  var needToHideRestorePopupsThatOutFromViewPort = !!evt && ASPx.Evt.GetEventSource(evt) == document;
30009  if(needToHideRestorePopupsThatOutFromViewPort)
30010   popupsToRestoreVisible = this.HidePinnedPopupsThatOutFromViewPort();
30011  this.scrollEventLockCount++;
30012  window.setTimeout(function() {
30013   this.savedBodyWidth = ASPx.GetDocumentWidth();
30014   this.savedBodyHeight = ASPx.GetDocumentHeight();
30015   if(needToHideRestorePopupsThatOutFromViewPort)
30016    this.RestorePinnedPopupsThatOutFromViewPort(popupsToRestoreVisible);
30017   if(onCalculateFinished)
30018    window.setTimeout(function() { onCalculateFinished(); }.aspxBind(this), 0);
30019   this.scrollEventLockCount--;
30020  }.aspxBind(this), 0);
30021 },
30022 FireScrollEventToWindowsOldIE: function(evt) {
30023  this.scrollEventLockCount++;
30024  this.FireScrollEventToWindows(evt);
30025  this.scrollEventLockCount--;
30026 },
30027 LockScrollEvent: function() {
30028  this.scrollEventLockCount++;
30029 },
30030 UnlockScrollEvent: function() {
30031  this.scrollEventLockCount--;
30032 },
30033 CorrectPositionAtScroll: function(scroll) {
30034  for(var i = 0; i < this.visiblePopupWindowIds.length; i++) {
30035   var popupWindow = this.GetPopupWindowFromID(this.visiblePopupWindowIds[i]);
30036   var popupControl = popupWindow.popupControl;
30037   if(popupControl != null && popupControl.InternalIsWindowVisible(popupWindow.windowIndex)) {
30038    if(popupControl.GetAutoUpdatePosition(popupWindow.windowIndex))
30039     popupWindow.popupControl.TryAutoUpdatePosition(popupWindow.windowIndex);
30040   }
30041  }
30042 },
30043 OnSelectStart: function() {
30044  return !this.selectBanned;
30045 },
30046 OverStop: function() {
30047  this.overControl = null;
30048  this.overWindowIndex = -1;
30049 },
30050 OnPWDisappearTimer: function(name, index) {
30051  var pc = this.Get(name);
30052  if(pc != null) {
30053   if(!pc.DoHideWindow(index, false, ASPxClientPopupControlCloseReason.MouseOut))
30054    this.OverStop();
30055   this.ClearDisappearTimer();
30056  }
30057 },
30058 SaveCurrentMouseOverPos: function(evt) {
30059  this.overXPos = ASPx.Evt.GetEventX(evt);
30060  this.overYPos = ASPx.Evt.GetEventY(evt);
30061 },
30062 RegisterVisibleModalElement: function(element) {
30063  if(ASPx.Data.ArrayIndexOf(this.visibleModalElements, element) == -1)
30064   this.visibleModalElements.push(element);
30065 },
30066 UnregisterVisibleModalElement: function(element) {
30067  ASPx.Data.ArrayRemove(this.visibleModalElements, element);
30068 },
30069 RegisterVisibleWindow: function(element, popupControl, index) {
30070  if(ASPx.Data.ArrayIndexOf(this.visiblePopupWindowIds, element.id) == -1) {
30071   this.visiblePopupWindowIds.push(element.id);
30072   if(popupControl && popupControl.GetWindowCloseAction(index) == "MouseOut")
30073    aspxGetPopupControlCollection().InitOverObject(popupControl, index, null);
30074   this.OnRegisteredVisibleWindow(element);
30075  }
30076 },
30077 OnRegisteredVisibleWindow: function(element) {
30078  var elementIndex = ASPx.Data.ArrayIndexOf(this.visiblePopupWindowIds, element.id);
30079  if(this.PopupWindowIsModalByVisibleIndex(elementIndex))
30080   ASPx.PopupUtils.RemoveFocus(element);
30081 },
30082 UnregisterVisibleWindow: function(element) {
30083  this.DeleteWindowFromZIndexOrder(element);
30084  ASPx.Data.ArrayRemove(this.visiblePopupWindowIds, element.id);
30085  var forceRecalculate = this.PopupWindowIsModalByID(element.id);
30086  this.RefreshTabIndexes(forceRecalculate);
30087  this.SkipCurrentActiveWindowElement(element);
30088 },
30089 AutoUpdateElementsPosition: function() {
30090  for(var i = 0; i < this.visiblePopupWindowIds.length; i++) {
30091   var popupWindow = this.GetPopupWindowFromID(this.visiblePopupWindowIds[i]);
30092   var popupControl = popupWindow.popupControl;
30093   if(popupControl != null && popupControl.InternalIsWindowVisible(popupWindow.windowIndex))
30094    popupControl.TryAutoUpdatePosition(popupWindow.windowIndex);
30095  }
30096 },
30097 LockWindowResizeByBodyScrollVisibilityChanging: function() {
30098  this.windowResizeByBodyScrollVisibilityChangingLockCount++;
30099 },
30100 UnlockWindowResizeByBodyScrollVisibilityChanging: function() {
30101  this.windowResizeByBodyScrollVisibilityChangingLockCount--;
30102 },
30103 WindowResizeByBodyScrollVisibilityChangingLocked: function() {
30104  return this.windowResizeByBodyScrollVisibilityChangingLockCount > 0;
30105 },
30106 HideAllWindows: function() {
30107  this.DoHideAllWindows(null, "", true, ASPxClientPopupControlCloseReason.API, 0);
30108 }
30109});
30110var ASPxClientPopupControlResizeState = {
30111 Resized: 0,
30112 Collapsed: 1,
30113 Expanded: 2,
30114 Maximized: 3,
30115 RestoredAfterMaximized: 4
30116};
30117var ASPxClientPopupControlCloseReason = {
30118 API: "API",
30119 CloseButton: "CloseButton",
30120 OuterMouseClick: "OuterMouseClick",
30121 MouseOut: "MouseOut",
30122 Escape: "Escape"
30123};
30124var popupControlCollection = null;
30125function aspxGetPopupControlCollection() {
30126 if(popupControlCollection == null)
30127  popupControlCollection = new ASPxClientPopupControlCollection();
30128 return popupControlCollection;
30129}
30130function _aspxScrollDifference(horizontal, vertical) {
30131 this.horizontal = horizontal;
30132 this.vertical = vertical;
30133}
30134function aspxPWEMOver(evt) {
30135 aspxGetPopupControlCollection().OnPWMouseOver(evt);
30136}
30137ASPx.PWHMDown = function(evt) {
30138 return ASPx.Evt.CancelBubble(evt);
30139};
30140ASPx.PWCBClick = function(evt, name, index) {
30141 var pc = aspxGetPopupControlCollection().Get(name);
30142 if(pc != null) pc.OnPWHBClickCore(evt, index, "OnCloseButtonClick");
30143};
30144ASPx.PWPBClick = function(evt, name, index) {
30145 var pc = aspxGetPopupControlCollection().Get(name);
30146 if(pc != null) pc.OnPWHBClickCore(evt, index, "OnPinButtonClick");
30147};
30148ASPx.PWRBClick = function(evt, name, index) {
30149 var pc = aspxGetPopupControlCollection().Get(name);
30150 if(pc != null) pc.OnPWHBClickCore(evt, index, "OnRefreshButtonClick");
30151};
30152ASPx.PWMNBClick = function(evt, name, index) {
30153 var pc = aspxGetPopupControlCollection().Get(name);
30154 if(pc != null) pc.OnPWHBClickCore(evt, index, "OnCollapseButtonClick");
30155};
30156ASPx.PWMXBClick = function(evt, name, index) {
30157 var pc = aspxGetPopupControlCollection().Get(name);
30158 if(pc != null) pc.OnPWHBClickCore(evt, index, "OnMaximizeButtonClick");
30159};
30160ASPx.PWDGMDown = function (evt, name, index) {
30161 var pc = aspxGetPopupControlCollection().Get(name);
30162 return ASPx.PWMDown(evt, name, index, pc.IsDraggingAllowed(index));
30163};
30164ASPx.PWGripMDown = function(evt, name, index) {
30165 aspxPWMDownCore(evt, name, index, false);
30166 return ASPx.PWHMDown(evt);
30167};
30168ASPx.PWMMove = function(evt, name, index) {
30169 aspxGetPopupControlCollection().OnPWMouseMove(evt, name, index);
30170};
30171ASPx.PWMDown = function(evt, name, index, isWindowContentDraggingAllowed) { 
30172 var pointOnScrollBar = false;
30173 var pc = aspxGetPopupControlCollection().Get(name);
30174 if(pc && pc.GetEnableContentScrolling(index)) {
30175  var rtl = pc.rtl && (ASPx.Browser.IE || ASPx.Browser.Firefox || ASPx.Browser.Opera);
30176  pointOnScrollBar = aspxPointOnElementScrollBar(pc.GetContentContainer(index), evt.clientX, evt.clientY, rtl);
30177 }
30178 aspxPWMDownCore(evt, name, index, isWindowContentDraggingAllowed, pointOnScrollBar);
30179 if(isWindowContentDraggingAllowed) { 
30180  aspxGetPopupControlCollection().OnDocumentMouseDown(evt); 
30181  if(typeof (ASPx.GetDropDownCollection) == "function")
30182   ASPx.GetDropDownCollection().OnDocumentMouseDown(evt); 
30183  if(!pointOnScrollBar) {
30184   if(!ASPx.Browser.WebKitTouchUI && ASPx.Evt.GetEventSource(evt).tagName == "IMG") 
30185    ASPx.Evt.PreventEvent(evt);
30186  }
30187 }
30188};
30189function aspxPWMDownCore(evt, name, index, isDraggingAllowed, pointOnScrollBar) {
30190 var pc = aspxGetPopupControlCollection().Get(name);
30191 if(pc != null) {
30192  pc.OnActivate(index, evt);
30193  pc.OnMouseDown(evt, index, isDraggingAllowed, pointOnScrollBar);
30194 }
30195}
30196function aspxPWMEMDown(evt) {
30197 var internalScrollableModalDiv = ASPx.Browser.AndroidDefaultBrowser ? ASPx.Evt.GetEventSource(evt) : null;
30198 var modalDiv = internalScrollableModalDiv ? internalScrollableModalDiv.parentNode : ASPx.Evt.GetEventSource(evt);
30199 if(modalDiv != null) 
30200  modalDiv.DXModalPopupControl.OnMouseDownModalElement(evt, modalDiv.DXModalPopupWindowIndex);
30201}
30202function aspxPEMEvent(evt) {
30203 var element = ASPx.PopupUtils.FindEventSourceParentByTestFunc(evt, aspxTestPopupControlElement);
30204 if(element != null) {
30205  var popupControl = element.DXPopupElementControl;
30206  var index = element.DXPopupWindowIndex;
30207  if(evt.type == "mousedown") {
30208   popupControl.SetIsPopuped(index, popupControl.InternalIsWindowVisible(index));
30209   aspxGetPopupControlCollection().OnMouseDown(evt);
30210  }
30211  else {
30212   var windowPopupAction = popupControl.GetWindowPopupAction(element.DXPopupWindowIndex);
30213   var leftMouseButtonAction = windowPopupAction == "LeftMouseClick" && ASPx.Evt.IsLeftButtonPressed(evt);
30214   var isAccessibleKeyboardAction = popupControl.accessibilityCompliant && ASPx.Evt.IsActionKeyPressed(evt);
30215   var rightMouseButtonAction = windowPopupAction == "RightMouseClick" && !ASPx.Evt.IsLeftButtonPressed(evt);
30216   if(leftMouseButtonAction || rightMouseButtonAction || isAccessibleKeyboardAction) {
30217    if(rightMouseButtonAction)
30218     ASPx.PopupUtils.PreventContextMenu(evt);
30219    var windowCloseAction = popupControl.GetWindowCloseAction(index);
30220    var isPopuped = popupControl.GetIsPopuped(index);
30221    var isNewPopupElement = popupControl.GetLastShownPopupElementIndex(index) != element.DXPopupElementIndex;
30222    if(isPopuped && isNewPopupElement) {
30223     popupControl.DoHideWindow(index, false, ASPxClientPopupControlCloseReason.OuterMouseClick);
30224     aspxGetPopupControlCollection().ClearDisappearTimer();
30225     isPopuped = false;
30226    }
30227    if(!(isPopuped && windowCloseAction == "OuterMouseClick")) {
30228     popupControl.DoShowWindow(index, element.DXPopupElementIndex, evt);
30229    }
30230    if(windowCloseAction == "MouseOut")
30231     aspxGetPopupControlCollection().InitOverObject(popupControl, element.DXPopupWindowIndex, evt);
30232    return false;
30233   }
30234  }
30235 }
30236}
30237ASPx.PopupElementMouseEvent = aspxPEMEvent;
30238function aspxPointOnElementScrollBar(element, x, y, rtl) {
30239 var scrollWidth = ASPx.GetVerticalScrollBarWidth();
30240 var hasHorizontalScroll = element.scrollWidth > element.clientWidth;
30241 var hasVerticalScroll = element.scrollHeight > element.clientHeight;
30242 var ceilX = rtl ? ASPx.GetAbsoluteX(element) + scrollWidth :
30243  ASPx.GetAbsoluteX(element) + (element.offsetWidth - ASPx.GetHorizontalBordersWidth(element));
30244 var ceilY = ASPx.GetAbsoluteY(element) + (element.offsetHeight - ASPx.GetVerticalBordersWidth(element));
30245 return (hasVerticalScroll && x >= ceilX - scrollWidth && x <= ceilX) ||
30246   (hasHorizontalScroll && y >= ceilY - scrollWidth && y <= ceilY);
30247}
30248ASPx.PCAStop = function(name, index) {
30249 var pc = aspxGetPopupControlCollection().Get(name);
30250 if(pc != null) pc.OnAnimationStop(index);
30251};
30252ASPx.PCIframeLoad = function(evt) {
30253 var srcElement = ASPx.Evt.GetEventSource(evt);
30254 if(srcElement) {
30255  var pcName = srcElement.popupControlName;
30256  var pcWndIndex = srcElement.pcWndIndex;
30257  if(pcName) {
30258   var pc = aspxGetPopupControlCollection().Get(pcName);
30259   if(pc) pc.OnIFrameLoad(pcWndIndex);
30260  }
30261 }
30262};
30263function aspxTestPopupWindowElement(element) {
30264 return !!element.DXPopupWindowElement;
30265}
30266function aspxTestPopupControlElement(element) {
30267 return element.DXPopupElementControl && ASPx.IsExists(element.DXPopupWindowIndex);
30268}
30269function aspxTestPopupControlOverElement(element) {
30270 var collection = aspxGetPopupControlCollection();
30271 var popupControl = collection.overControl;
30272 var index = collection.overWindowIndex;
30273 var windowId = popupControl.GetWindowElementId(index);
30274 if(element.id == windowId)
30275  return true;
30276 var popupElements = popupControl.GetPopupElementList(index);
30277 for(var i = 0; i < popupElements.length; i++)
30278  if(popupElements[i] == element)
30279   return true;
30280 return false;
30281}
30282ASPx.Evt.AttachEventToDocument("keydown", function(evt) {
30283 aspxGetPopupControlCollection().OnDocumentKeyDown(evt);
30284});
30285ASPx.Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseDownEventName, function(evt) {
30286 aspxGetPopupControlCollection().OnDocumentMouseDown(evt);
30287});
30288ASPx.Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseUpEventName, function(evt) {
30289 return aspxGetPopupControlCollection().OnMouseUp(evt);
30290});
30291ASPx.Evt.AttachEventToElement(window, ASPx.TouchUIHelper.touchMouseMoveEventName, function(evt) {
30292 if(typeof(aspxGetPopupControlCollection) != "undefined")
30293  aspxGetPopupControlCollection().OnMouseMove(evt);
30294}, false, !ASPx.Browser.WebKitTouchUI);
30295ASPx.Evt.AttachEventToDocument("mouseout", function(evt) {
30296 if(typeof (aspxGetPopupControlCollection) != "undefined")
30297  aspxGetPopupControlCollection().OnMouseOut(evt);
30298});
30299ASPx.Evt.AttachEventToElement(window, ASPx.Browser.MacOSMobilePlatform ? "orientationchange" : "resize", function(evt) {
30300 aspxGetPopupControlCollection().OnResize(evt);
30301});
30302ASPx.Evt.AttachEventToElement(window, "scroll", function(evt) {
30303 aspxGetPopupControlCollection().OnScroll(evt);
30304});
30305ASPx.Evt.AttachEventToDocument("selectstart", function(evt) {
30306 var ret = aspxGetPopupControlCollection().OnSelectStart(evt);
30307 if(!ret) return false; 
30308});
30309var currViewPortSize = null,
30310 viewPortSizeInterval = null;
30311function getViewPortSize() {
30312 return { 
30313  w: window.innerWidth, 
30314  h: window.innerHeight,
30315  x: window.pageXOffset,
30316  y: window.pageYOffset
30317 }; 
30318}
30319function ensureViewPortSizeInterval() {
30320 if(!!viewPortSizeInterval) return;
30321 viewPortSizeInterval = setInterval(function() {
30322  var size = getViewPortSize();
30323  if(currViewPortSize && (size.w != currViewPortSize.w || size.h != currViewPortSize.h || size.x != currViewPortSize.x || size.y != currViewPortSize.y)) {
30324   var controlCollection = aspxGetPopupControlCollection();
30325   controlCollection.ForEachControl(function(popupControl) {
30326    if(popupControl.GetCanScrollViewPort(-1) && popupControl.IsVisible()) {
30327     popupControl.updateContentScrollIfNeeded(-1);
30328     popupControl.UpdatePosition();
30329    }
30330   });
30331  }
30332  currViewPortSize = size;
30333 }, 50);
30334}
30335window.ASPxClientPopupControlBase = ASPxClientPopupControlBase;
30336window.ASPxClientPopupControl = ASPxClientPopupControl;
30337window.ASPxClientPopupWindow = ASPxClientPopupWindow;
30338window.ASPxClientPopupWindowEventArgs = ASPxClientPopupWindowEventArgs;
30339window.ASPxClientPopupWindowCancelEventArgs = ASPxClientPopupWindowCancelEventArgs;
30340window.ASPxClientPopupWindowResizeEventArgs = ASPxClientPopupWindowResizeEventArgs;
30341window.ASPxClientPopupWindowPinnedChangedEventArgs = ASPxClientPopupWindowPinnedChangedEventArgs;
30342window.ASPxClientPopupControlCollection = ASPxClientPopupControlCollection;
30343window.ASPxClientPopupControlResizeState = ASPxClientPopupControlResizeState;
30344window.ASPxClientPopupControlCloseReason = ASPxClientPopupControlCloseReason;
30345ASPx.GetPopupControlCollection = aspxGetPopupControlCollection;
30346ASPx.PopupControlCssClasses = PopupControlCssClasses;
30347})();
30348
30349(function() {
30350ASPx.activeCalendar = null;
30351ASPx.calendarMsPerDay = 86400000;
30352var calendarWeekCount = 6;
30353var viewsContainerClassName = "dxeCVC";
30354var emptyDateCellClassName = "dxeEmptyDC";
30355var ASPxClientCalendar = ASPx.CreateClass(ASPxClientEdit, {
30356 constructor: function(name) {
30357  this.constructor.prototype.constructor.call(this, name);
30358  this.SelectionChanging = new ASPxClientEvent();
30359  this.SelectionChanged = new ASPxClientEvent();
30360  this.VisibleMonthChanged = new ASPxClientEvent();
30361  this.CustomDisabledDate = new ASPxClientEvent();
30362  this.CellClick = new ASPxClientEvent();
30363  this.isMouseDown = false;  
30364  this.forceMouseDown = false;
30365  this.supportGestures = true;
30366  this.swipeGestureStated = false;
30367  this.updateAnimationProcessing = false;
30368  this.selection = new ASPxClientCalendarSelection();
30369  this.selectionTransaction = null;  
30370  this.selectionStartDate = null;
30371  this.selectionPrevStartDate = null;
30372  this.lastSelectedDate = null;
30373  this.selectionCtrl = false;
30374  this.selectionByWeeks = false;  
30375  this.titleFormatter = null;
30376  this.updateAnimationLockCount = 0;
30377  this.forceUpdate = false;
30378  this.needToSetCursor = true;
30379  this.visibleDate = new Date();
30380  this.visibleDates = {};
30381  this.selectedNavigationDates = {};
30382  this.firstDayOfWeek = 0;    
30383  this.columns = 1;
30384  this.rows = 1;
30385  this.switchToSingleMonthAtWindowInnerWidth = 0;
30386  this.enableFast = true;
30387  this.showFastPopup = false;
30388  this.pickerType = ASPx.DatePickerType.Days;
30389  this.maxViewType = ASPx.DatePickerType.Decades;
30390  this.initialViewType = ASPx.DatePickerType.Days;
30391  this.enableFastNavInlineAnimation = true;
30392  this.enableMulti = false;
30393  this.customDraw = false;  
30394  this.showWeekNumbers = true;
30395  this.showDayHeaders = true;
30396  this.isDateEditCalendar = false;
30397  this.sharedParameters = new ASPx.CalendarSharedParameters();
30398  this.visibleDateColumnOffset = 0;
30399  this.enableDaysViewPeriodNavigation = true;
30400  this.enableMonthsYearsViewPeriodNavigation = true;
30401  this.accessibilityHelper = null;
30402  this.sizingConfig.allowSetHeight = false;
30403  this.isDateChangingByKeyboard = false;
30404  this.MainElementClick = new ASPxClientEvent();
30405 },
30406 SetData: function(data){
30407  ASPxClientEdit.prototype.SetData.call(this, data);
30408  if(data.selection)
30409   this.selection.AddArray(data.selection);
30410  if(data.sharedParameters)
30411   this.SetProperties(data.sharedParameters, this.sharedParameters);
30412 },
30413 SetProperties: function(properties, obj) {
30414  ASPxClientEdit.prototype.SetProperties.call(this, properties, obj);
30415  this.selection.SetPickerType(this.pickerType);
30416 },
30417 Initialize: function() {
30418  this.selectionTransaction = new ASPxClientCalendarSelectionTransaction(this);
30419  this.selectionPrevStartDate = this.selection.GetFirstDate();
30420  ASPxClientEdit.prototype.Initialize.call(this);
30421  var mainElement = this.GetMainElement();
30422  ASPx.Evt.PreventElementDragAndSelect(mainElement, false, false);
30423  if(ASPx.Browser.Opera && !ASPx.Browser.WebKitFamily)
30424   ASPx.Selection.SetElementAsUnselectable(mainElement, true, true);
30425  this.EnsureTodayStyle();
30426  if(this.accessibilityCompliant)
30427   this.accessibilityHelper = new AccessibilityHelperCalendar(this);
30428 },
30429 InlineInitialize: function() {
30430  this.customDraw = this.sharedParameters.calendarCustomDraw;
30431  for(var i = this.pickerType; i <= this.maxViewType; i++) {
30432   this.visibleDates[i] = this.visibleDate;
30433   this.selectedNavigationDates[i] = this.visibleDate;
30434  }
30435  this.currentViewType = this.pickerType;
30436  this.CreateViews();
30437  if(this.NeedFastNavigation())
30438   this.InitializeFastNavigation();
30439  this.InitSpecialKeyboardHandling();
30440  if(this.isSlideCallbackAnimationEnabled() && !this.isSwipeGesturesEnabled() && typeof(ASPx.AnimationHelper) != "undefined")
30441   ASPx.AnimationHelper.getSlideAnimationContainer(this.GetCallbackAnimationElement(), true, false);
30442  ASPxClientEdit.prototype.InlineInitialize.call(this);
30443  if(!this.CustomDisabledDate.IsEmpty())
30444   this.Update();
30445  this.SetInitialVisibleDate();
30446  this.CreateAdaptivityCssRules();
30447  if(!this.isDateEditCalendar)
30448   this.SwitchToInitialView();
30449 },
30450 SwitchToInitialView: function() {
30451  if(this.pickerType !== this.initialViewType)
30452   this.SwitchToGreaterView(0, 0, this.initialViewType, true);
30453 },
30454 AddActiveViewHoverStateItems: function() {
30455  var activeViews = this.GetActiveViews();
30456  for(var key in activeViews) {
30457   if(activeViews.hasOwnProperty(key)) {
30458    var view = activeViews[key];
30459    view.AddHoverStateItems();
30460   }
30461  }
30462 },
30463 RemoveActiveViewHoverStateItems: function() {
30464  var activeViews = this.GetActiveViews();
30465  for(var key in activeViews) {
30466   if(activeViews.hasOwnProperty(key)) {
30467    var view = activeViews[key];
30468    view.RemoveHoverStateItems();
30469   }
30470  }
30471 },
30472 NeedFastNavigation: function() {
30473  return this.showFastPopup;
30474 },
30475 InitializeFastNavigation: function() {
30476  this.fastNavigation = this.CreateFastNavigation();
30477 },
30478 InitializeEvents: function() { 
30479  ASPxClientEdit.prototype.InitializeEvents.call(this);
30480  var clear = this.GetClearButton();
30481  if(clear)
30482   ASPx.Evt.AttachEventToElement(clear, "click", this.OnClearClick.bind(this));
30483  var today = this.GetTodayButton();
30484  if(today)
30485   ASPx.Evt.AttachEventToElement(today, "click", this.OnTodayClick.bind(this));
30486  if(this.isDateEditCalendar) {
30487   var ok = this.GetTimeSectionOkButton();
30488   if(ok)
30489    ASPx.Evt.AttachEventToElement(ok, "click", this.OnOkClick.bind(this));
30490   var cancel = this.GetTimeSectionCancelButton();
30491   if(cancel)
30492    ASPx.Evt.AttachEventToElement(cancel, "click", this.OnCancelClick.bind(this));
30493  }
30494 },
30495 CreateAdaptivityCssRules: function() {
30496  if (this.switchToSingleMonthAtWindowInnerWidth <= 0)
30497   return;
30498  var styleSheet = ASPx.GetCurrentStyleSheet();
30499  if (!styleSheet || !styleSheet.insertRule) return;
30500  var lastColumn = this.columns - 1;
30501  var rule =
30502  "@media all and (max-width: " + this.switchToSingleMonthAtWindowInnerWidth + "px) { " +
30503   "#" + this.name + ".dxeCVC > tbody > tr > td:not(.view-visible):not(#" + this.name + "_F) > * { display: none; }" +
30504   "#" + this.name + " .dxeCVC > tbody > tr > td:not(.view-visible):not(#" + this.name + "_F) > * { display: none; }" +
30505   ".view-visible #" + this.name + "_" + this.GetArrowButtonID("M", true, "0x0") + "," +
30506   ".view-visible #" + this.name + "_" + this.GetArrowButtonID("M", false, "0x" + lastColumn) + "," +
30507   ".view-visible #" + this.name + "_" + this.GetArrowButtonID("Y", true, "0x0") + "," +
30508   ".view-visible #" + this.name + "_" + this.GetArrowButtonID("Y", false, "0x" + lastColumn) + "," +
30509   ".view-visible #" + this.name + "_" + this.GetArrowButtonID("TP", true, "0x0") + "," +
30510   ".view-visible #" + this.name + "_" + this.GetArrowButtonID("TP", false, "0x" + lastColumn) +
30511    " { visibility: visible!important; } " +
30512   "}";
30513  styleSheet.insertRule(rule, styleSheet.cssRules.length);
30514 },
30515 OnNavigationImageClick: function(offset, isVisibleInAdaptiveOnly) {
30516  if(!isVisibleInAdaptiveOnly || (this.switchToSingleMonthAtWindowInnerWidth > 0 && window.innerWidth <= this.switchToSingleMonthAtWindowInnerWidth))
30517   this.OnShiftMonth(offset);
30518 },
30519 SetInitialVisibleDate: function() {
30520  this.initialVisibleDate = this.GetVisibleDate();
30521 },
30522 EnsureTodayStyle: function() {
30523  if(!ASPxClientCalendar.AreDatesEqual(this.serverCurrentDate, new Date())) {
30524   var activeViews = this.GetActiveViews();
30525   for(var key in activeViews) {
30526    if(activeViews.hasOwnProperty(key)) {
30527     var view = activeViews[key];
30528     view.EnsureTodayStyle();
30529    }
30530   }
30531  }
30532 },
30533 CreateFastNavigation: function() {
30534  return new ASPxClientCalendarFastNavigation(this);
30535 },
30536 GetCalendarRowElements: function() {
30537  if(!this.viewsContainer) {
30538   var mainElement = this.GetMainElement();
30539   var mainElementIsViewsContainer = ASPx.ElementHasCssClass(this.GetMainElement(), viewsContainerClassName);
30540   this.viewsContainer = mainElementIsViewsContainer ? mainElement : ASPx.GetNodeByClassName(mainElement, viewsContainerClassName);
30541  }
30542  return this.viewsContainer.rows;
30543 },
30544 GetCalendarViewCellElements: function(rowElement) {
30545  return rowElement.cells;
30546 },
30547 GetMonthTable: function(viewIdPostfix) {
30548  return this.GetChildElement("mt" + viewIdPostfix);
30549 },
30550 GetYearCell: function(viewIdPostfix) {
30551  return this.GetChildElement("yc" + viewIdPostfix);
30552 },
30553 GetYearCellChildArea: function(viewIdPostfix) {
30554  return this.GetChildElement("yt" + viewIdPostfix);
30555 },
30556 GetMonthCell: function(viewIdPostfix) {
30557  return this.GetChildElement("mc" + viewIdPostfix);
30558 },
30559 GetViewCell: function(viewIdPostfix) {
30560  if (this.switchToSingleMonthAtWindowInnerWidth <= 0)
30561   throw new Error("Not Implemented");
30562  return this.GetChildElement("v" + viewIdPostfix);
30563 },
30564 GetFastNavHeader: function(viewIdPostfix) {
30565  return this.GetChildElement("FNH" + viewIdPostfix);
30566 },
30567 GetFastNavHeaderTextElement: function(viewIdPostfix) {
30568  return this.GetChildElement("yt" + viewIdPostfix);
30569 },
30570 GetArrowButton: function(type, isNext, viewID) {
30571  return this.GetChildElement(this.GetArrowButtonID(type, isNext, viewID));
30572 },
30573 GetArrowButtonID: function(type, isNext, viewID) {
30574  var id = (isNext ? "N" : "P") + type.toUpperCase() + "C";
30575  if(this.IsMultiView() && viewID === undefined)
30576   id += "_0x" + (isNext ? this.columns - 1 : 0);
30577  else if (viewID)
30578   id += "_" + viewID;
30579  return id + "Img";
30580 },
30581 SetMonthTableCellContent: function(cell, content, isWeekNumber) {
30582  cell.innerHTML = content;
30583 },
30584 FindInputElement: function() {
30585  return this.accessibilityCompliant ? this.GetAccessibilityAssistantElement() : this.GetChildElement("KBS");
30586 },
30587 GetAccessibilityActiveElements: function() {
30588  return this.accessibilityCompliant ? [this.accessibilityHelper.GetActiveElement()] : [this.GetInputElement()];
30589 },
30590 GetClearButton: function() {
30591  return this.GetChildElement("BC");
30592 },
30593 GetTodayButton: function() {
30594  return this.GetChildElement("BT");
30595 },
30596 GetTimeSectionOkButton: function() {
30597  return this.GetChildElement("BO");
30598 },
30599 GetTimeSectionCancelButton: function() {
30600  return this.GetChildElement("BCN");
30601 },
30602 GetFooter: function() {
30603  return this.GetChildElement("F");
30604 },
30605 GetValue: function() {
30606  return this.selection.GetFirstDate();
30607 },
30608 GetValueString: function() {
30609  var value = this.GetValue();
30610  return value == null ? null : ASPx.DateUtils.GetInvariantDateString(value);
30611 },
30612 SetValue: function(date) {  
30613  if(date) {
30614   date = ASPxClientCalendarDateDisabledHelper.GetCorrectedDate(date);
30615   date = ASPxClientCalendar.GetCorrectedDate(date, this.pickerType);
30616   this.SetVisibleDate(date);
30617  }
30618  this.SetSelectedDate(date);
30619 },
30620 GetViewKey: function(row, column) {
30621  return row + "x" + column;
30622 },
30623 GetView: function(row, column, viewType) {
30624  if(!ASPx.IsExists(viewType))
30625   return this.GetActiveView(row, column);
30626  var key = this.GetViewKey(row, column);
30627  return this.GetViewByKey(viewType, key);
30628 },
30629 GetViewByKey: function(viewType, key) {
30630  return this.views[viewType][key];
30631 },
30632 GetActiveView: function(row, column) {
30633  var key = this.GetViewKey(row, column);
30634  return this.GetActiveViews()[key];
30635 },
30636 GetActiveViews: function() {
30637  return this.GetViews(this.currentViewType);
30638 },
30639 GetViews: function(viewType) {
30640  return this.views[viewType];
30641 },
30642 CreateViews: function() {
30643  this.views = { };
30644  var key;
30645  for(var i = this.pickerType; i <= this.maxViewType; i++) {
30646   if(i == this.pickerType)
30647    this.visibleDates[i] = this.visibleDate;
30648   this.views[i] = {};
30649   for(var row = 0 ; row < this.rows; row++) {
30650    for(var col = 0; col < this.columns; col++) {
30651     key = this.GetViewKey(row, col);
30652     var view = this.CreateView(i, row, col);
30653     view.Initialize();
30654     this.views[i][key] = view;
30655    }
30656   }
30657  }
30658  if (this.switchToSingleMonthAtWindowInnerWidth)
30659   this.GetActiveViews()["0x0"].EnsureVisible(true);
30660 },
30661 CreateView: function(viewType, row, column) {
30662  switch(viewType) {
30663   case ASPx.DatePickerType.Days:
30664    return new ASPxClientCalendarDaysView(this, row, column);
30665   case ASPx.DatePickerType.Months:
30666    return new ASPxClientCalendarMonthsView(this, row, column);
30667   case ASPx.DatePickerType.Years:
30668    return new ASPxClientCalendarYearsView(this, row, column);
30669   case ASPx.DatePickerType.Decades:
30670    return new ASPxClientCalendarDecadesView(this, row, column);
30671  }
30672 },
30673 ChangeView: function(newViewType, disableAnimation) {
30674  var needChangeMonthYearCellVisibility = this.currentViewType == ASPx.DatePickerType.Days || newViewType == ASPx.DatePickerType.Days;
30675  var needUpdateHoverStateItems = this.NeedUpdateHoverStateItemsOnViewChanging(this.currentViewType, newViewType);
30676  if(needUpdateHoverStateItems)
30677   this.RemoveActiveViewHoverStateItems();
30678  this.currentViewType = newViewType;
30679  if(needUpdateHoverStateItems)
30680   this.AddActiveViewHoverStateItems();
30681  if(needChangeMonthYearCellVisibility)
30682   this.ChangeMonthYearCellVisibility(newViewType == ASPx.DatePickerType.Days);
30683  if(this.enableFastNavInlineAnimation && !disableAnimation)
30684   this.PerformActiveViewAnimation();
30685  this.Update();
30686  ASPx.SetElementDisplay(this.GetClearButton(), !this.IsInlineFastNavigationActive());
30687 },
30688 NeedUpdateHoverStateItemsOnViewChanging: function(oldViewType, newViewType) {
30689  return this.pickerType !== ASPx.DatePickerType.Days && (oldViewType === this.pickerType || newViewType === this.pickerType);
30690 },
30691 PerformActiveViewAnimation: function() {
30692  var activeViews = this.GetActiveViews();
30693  for(var key in activeViews) {
30694   if(activeViews.hasOwnProperty(key)) {
30695    var view = activeViews[key];
30696    ASPx.AnimationHelper.fadeIn(view.GetMainElement());
30697   }
30698  }
30699 },
30700 ChangeMonthYearCellVisibility: function(showMonthCell) {
30701  var activeViews = this.GetActiveViews();
30702  for(var key in activeViews) {
30703   if(activeViews.hasOwnProperty(key)) {
30704    this.ChangeViewMonthYearCellVisibility(key, showMonthCell);
30705   }
30706  }
30707  var spacers = ASPx.GetNodesByClassName(this.GetMainElement(), "dxeCHS");
30708  spacers.forEach(function(spacer) { this.SetElementVisible(spacer, showMonthCell); }.aspxBind(this));
30709 },
30710 ChangeViewMonthYearCellVisibility: function(key, showMonthCell) {
30711  var monthView = this.GetViewByKey(ASPx.DatePickerType.Days, key);
30712  var yearView = this.GetViewByKey(ASPx.DatePickerType.Months, key);
30713  var monthViewMainElement = monthView.GetMainElement();
30714  var yearViewMainElement = yearView.GetMainElement();
30715  if(!showMonthCell) {
30716   yearViewMainElement.style.width = monthViewMainElement.offsetWidth + "px";
30717   yearViewMainElement.style.height = monthViewMainElement.offsetHeight + "px";
30718  }
30719  this.SetElementVisible(monthViewMainElement, showMonthCell);
30720  this.SetElementVisible(yearViewMainElement, !showMonthCell);
30721  this.SetViewMainElementParentsVisibility(monthViewMainElement, yearViewMainElement, showMonthCell);
30722  var monthViewNavigationCells = monthView.GetNavigationCells();
30723  var yearViewNavigationCells = yearView.GetNavigationCells();
30724  for(var i = 0; i < monthViewNavigationCells.length; i++)
30725   if(monthViewNavigationCells[i])
30726    this.SetElementVisible(monthViewNavigationCells[i], showMonthCell);
30727  for(var i = 0; i < yearViewNavigationCells.length; i++)
30728   if(yearViewNavigationCells[i])
30729    this.SetElementVisible(yearViewNavigationCells[i], !showMonthCell);
30730 },
30731 SetViewMainElementParentsVisibility: function(monthViewMainElement, yearViewMainElement, showMonthCell) {
30732  this.SetElementVisible(monthViewMainElement.parentNode, showMonthCell);
30733  this.SetElementVisible(yearViewMainElement.parentNode, !showMonthCell);
30734 },
30735 SetElementVisible: function(element, visible) {
30736  ASPx.SetElementDisplay(element, visible);
30737 },
30738 IsFastNavigationActive: function() {
30739  return this.IsPopupFastNavigationActive() || this.IsInlineFastNavigationActive();
30740 },
30741 IsPopupFastNavigationActive: function() {
30742  return this.fastNavigation && this.fastNavigation.IsActive();
30743 },
30744 IsInlineFastNavigationActive: function() {
30745  return this.currentViewType != this.pickerType;
30746 },
30747 IsDateSelected: function(date) {
30748  return this.selection.Contains(date);
30749 },
30750 IsDateVisible: function(date) {
30751  var startDate = ASPxClientCalendar.CloneDate(this.GetActiveView(0, 0).visibleDate);
30752  startDate.setDate(1);  
30753  var endDate = this.GetActiveView(this.rows - 1, this.columns - 1).GetMaxVisibleDate();
30754  return (date >= startDate) && (date < endDate);
30755 },
30756 IsDateWeekend: function(date) {
30757  var day = date.getDay();
30758  return day == 0 || day == 6;
30759 },
30760 IsCustomDisabledDatesViaCallback: function(){
30761  return (this.callBack && this.IsCustomDisabledDateEventEmpty() && this.sharedParameters.disabledDates.length > 0);
30762 },
30763 HasCallback: function () {
30764  if (this.isDateEditCalendar)
30765   return this.customDraw;
30766  else
30767   return this.callBack;
30768 },
30769 IsCustomDisabledDateEventEmpty: function() {
30770  if(this.isDateEditCalendar)
30771   return ASPxClientDateEdit.active == null || ASPxClientDateEdit.active.CalendarCustomDisabledDate.IsEmpty();
30772  return this.CustomDisabledDate.IsEmpty();
30773 },
30774 IsDateDisabled: function(date) {
30775  return ASPxClientCalendarDateDisabledHelper.IsDateDisabled(this.sharedParameters, date, function(d) { return this.OnCustomDisabledDate(d); }.aspxBind(this), this.currentViewType, this.pickerType);
30776 },
30777 IsMultiView: function() {
30778  return this.columns > 1 || this.rows > 1;
30779 },
30780 UpdateCustomDisabledDatesOnCallback: function(callbackResult) {
30781  var callbackDatesInfo = eval(callbackResult[callbackResult.length - 1]);
30782  this.RemoveVisibleDisabledDates(callbackDatesInfo);
30783  this.sharedParameters.disabledDates = this.sharedParameters.disabledDates
30784   .concat(callbackDatesInfo.disabledDates);
30785 },
30786 RemoveVisibleDisabledDates: function(callbackDatesInfo) {
30787  var firstVisibleDate = callbackDatesInfo.firstVisibleDate;
30788  var lastVisibleDate = callbackDatesInfo.lastVisibleDate;
30789  var currentVisibleDate = ASPxClientCalendar.CloneDate(firstVisibleDate);
30790  while(currentVisibleDate.getTime() <= lastVisibleDate.getTime()) {
30791   var disabledDateIndex = this.GetDisabledDateIndex(currentVisibleDate);
30792   if(disabledDateIndex > -1)
30793    this.sharedParameters.disabledDates.splice(disabledDateIndex, 1);
30794   currentVisibleDate = ASPxClientCalendar.GetNextDate(currentVisibleDate, this.pickerType);
30795  }
30796 },
30797 GetDisabledDateIndex: function(disabledDate) {
30798  return ASPx.Data.ArrayIndexOf(this.sharedParameters.disabledDates, disabledDate, function(date) {
30799   return ASPxClientCalendar.AreDatesEqual(date, disabledDate);
30800  });
30801 },
30802 ShowLoadingPanel: function(){
30803  this.CreateLoadingPanelWithAbsolutePosition(this.GetMainElement().parentNode, this.GetLoadingPanelOffsetElement(this.GetMainElement()));
30804 },
30805 ShowLoadingDiv: function () {
30806  this.CreateLoadingDiv(this.GetMainElement().parentNode, this.GetMainElement());
30807 },
30808 GetCallbackAnimationElement: function() {
30809  return !this.IsMultiView() ? this.GetActiveView(0, 0).GetAnimatedElement() : this.GetMainElement();
30810 },
30811 CanHandleGesture: function(evt) {
30812  if(!this.AllowShiftVisiblePeriod())
30813   return false;
30814  var source = ASPx.Evt.GetEventSource(evt);
30815  var element = !this.IsMultiView() ? this.GetActiveView(0, 0).GetMainElement() : this.GetMainElement();
30816  return ASPx.GetIsParent(element, source);
30817 },
30818 AllowStartGesture: function() {
30819  return ASPxClientControl.prototype.AllowStartGesture.call(this) && (!this.enableMulti || !this.selectionTransaction.isActive) && !this.updateAnimationProcessing;
30820 },
30821 StartGesture: function() {
30822  this.swipeGestureStated = true;
30823 },
30824 AllowExecuteGesture: function(value) {
30825  return true;
30826 },
30827 ExecuteGesture: function(value, count) {
30828  if(!count) count = 1;
30829  this.OnShiftMonth((value > 0 ? -1 : 1) * count);
30830 }, 
30831 Update: function() {
30832  if(this.customDraw && !this.clientUpdate && !this.IsInlineFastNavigationActive()) {
30833   if(!this.isDateEditCalendar)
30834    this.UpdateFromServer();
30835   else if (this.sharedParameters.currentDateEdit != null)
30836    this.sharedParameters.currentDateEdit.CreateUpdateCallback();
30837  }
30838  else {
30839   if(this.IsAnimationEnabled() && !this.forceUpdatingOnMouseOver)
30840    this.StartBeforeUpdateAnimation();
30841   else
30842    this.UpdateInternal();
30843  }
30844 },
30845 UpdateFromServer: function() {
30846  if(this.callBack) {
30847   this.ShowLoadingElements();
30848   this.CreateCallback(this.sharedParameters.GetUpdateCallbackParameters());
30849  }
30850  else {
30851   this.SendPostBack("");
30852  }
30853 },
30854 UpdateInternal: function() {
30855  if(this.NeedCalculateSelectionOnUpdating())
30856   this.selection.Clear();
30857  var activeViews = this.GetActiveViews();
30858  for(var key in activeViews) {
30859   if(activeViews.hasOwnProperty(key)) {
30860    var view = activeViews[key];
30861    if(!view.isASPxClientCalendarView) continue;
30862    view.Update();
30863    if (this.switchToSingleMonthAtWindowInnerWidth)
30864     view.EnsureVisible(view.GetIndex() === this.visibleDateColumnOffset);
30865   }
30866  }
30867  if(this.IsAnimationEnabled() && !this.forceUpdatingOnMouseOver)
30868   this.StartAfterUpdateAnimation();
30869 },
30870 IsAnimationEnabled: function() {
30871  return (this.isSlideCallbackAnimationEnabled() || this.enableCallbackAnimation) && !this.IsUpdateAnimationLocked();
30872 },
30873 LockUpdateAnimation: function() {
30874  this.updateAnimationLockCount++;
30875 },
30876 UnlockUpdateAnimation: function() {
30877  this.updateAnimationLockCount--;
30878 },
30879 IsUpdateAnimationLocked: function() {
30880  return this.updateAnimationLockCount > 0;
30881 },
30882 StartBeforeUpdateAnimation: function() {
30883  this.updateAnimationProcessing = true;
30884  var element = this.GetCallbackAnimationElement();
30885  if(this.isSlideCallbackAnimationEnabled() && this.slideAnimationDirection) 
30886   ASPx.AnimationHelper.slideOut(element, this.slideAnimationDirection, this.FinishBeforeUpdateAnimation.aspxBind(this), ASPx.AnimationEngineType.JS, this.rtl);
30887  else if(this.enableCallbackAnimation) 
30888   ASPx.AnimationHelper.fadeOut(element, this.FinishBeforeUpdateAnimation.aspxBind(this));
30889  else
30890   this.FinishBeforeUpdateAnimation();
30891 },
30892 FinishBeforeUpdateAnimation: function() {
30893  this.UpdateInternal();
30894 },
30895 StartAfterUpdateAnimation: function() {
30896  var element = this.GetCallbackAnimationElement();
30897  if (this.isSlideCallbackAnimationEnabled() && this.slideAnimationDirection)
30898   ASPx.AnimationHelper.slideIn(element, this.slideAnimationDirection, this.FinishAfterUpdateAnimation.aspxBind(this), ASPx.AnimationEngineType.JS, this.rtl);
30899  else if(this.enableCallbackAnimation) 
30900   ASPx.AnimationHelper.fadeIn(element, this.FinishAfterUpdateAnimation.aspxBind(this));
30901  else
30902   this.FinishAfterUpdateAnimation();
30903 },
30904 FinishAfterUpdateAnimation: function() {
30905  this.updateAnimationProcessing = false;
30906  this.slideAnimationDirection = null;
30907  this.CheckRepeatGesture();
30908 },
30909 ApplySelectionByDiff: function(selection, save) {
30910  var toShow = [ ];
30911  var toHide = [ ];
30912  var dates =  selection.GetDates();
30913  var oldDates = this.selection.GetDates();
30914  var selectionEdges = this.sharedParameters.dateRangeMode ? ASPx.Data.ArrayGetIntegerEdgeValues(dates) : null;
30915  var oldSelectionEdges = this.sharedParameters.dateRangeMode ? ASPx.Data.ArrayGetIntegerEdgeValues(oldDates) : null;
30916  var date;
30917  for(var i = 0; i < dates.length; i++) {
30918   date = dates[i];
30919   var isEdgeDateInSelection = selectionEdges
30920    && ASPxClientCalendar.IsFirstDateEqualToAnyOther(dates[i], selectionEdges.start, selectionEdges.end);
30921   var isEdgeDateInOldSelection = oldSelectionEdges
30922    && ASPxClientCalendar.IsFirstDateEqualToAnyOther(dates[i], oldSelectionEdges.start, oldSelectionEdges.end);
30923   if (!this.selection.Contains(date)
30924    || isEdgeDateInSelection && !isEdgeDateInOldSelection
30925    || !isEdgeDateInSelection && isEdgeDateInOldSelection)
30926    toShow.push(date);
30927  }
30928  for(var i = 0; i < oldDates.length; i++) {
30929   date = oldDates[i];
30930   if(!selection.Contains(date))
30931    toHide.push(date);
30932  }
30933  var activeViews = this.GetActiveViews();
30934  for(var key in activeViews) {
30935   if(activeViews.hasOwnProperty(key)) {
30936    var view = activeViews[key];
30937    if(!view.isASPxClientCalendarView) continue;
30938    view.UpdateSelection(toHide, false, selectionEdges);
30939    view.UpdateSelection(toShow, true, selectionEdges);
30940   }
30941  }
30942  this.selection.Assign(selection);
30943  if(this.accessibilityCompliant)
30944   this.accessibilityHelper.PronounceDates(dates);
30945 },
30946 GetDayInRangeClassName: function() {
30947  return ASPxClientCalendarView.DayInRangeClassName;
30948 },
30949 NeedApplySelectionToDayInRange: function() {
30950  return true;
30951 },
30952 ImportEtalonStyle: function(info, suffix) {
30953  var cell = this.GetEtalonStyleCell(suffix);
30954  if(ASPx.IsExistsElement(cell))
30955   info.Import(cell);   
30956 },
30957 GetEtalonStyleCell: function(name) {
30958  return ASPx.CacheHelper.GetCachedElementById(this, this.name + "_EC_" + name);
30959 },
30960 CanApplyDayCellStyle: function(suffix, isCurrentMonthDay) {
30961  return true;
30962 },
30963 UpdateStateObject: function() {
30964  var stateObject = { };
30965  var visibleDate = ASPxClientCalendarDateDisabledHelper.GetCorrectedDate(this.visibleDate);
30966  visibleDate = ASPxClientCalendar.GetCorrectedDate(visibleDate, this.pickerType);
30967  var initialVisibleDate = ASPxClientCalendarDateDisabledHelper.GetCorrectedDate(this.initialVisibleDate);
30968  initialVisibleDate = ASPxClientCalendar.GetCorrectedDate(initialVisibleDate, this.pickerType);
30969  stateObject.visibleDate = ASPx.DateUtils.GetInvariantDateString(visibleDate);
30970  stateObject.initialVisibleDate = ASPx.DateUtils.GetInvariantDateString(initialVisibleDate);
30971  stateObject.selectedDates = [];
30972  if(this.selection.count > 0) {
30973   var dates = this.selection.GetDates();
30974   for(var i = 0; i < dates.length; i++)
30975    stateObject.selectedDates.push(ASPx.DateUtils.GetInvariantDateString(dates[i]));
30976  }
30977  this.UpdateStateObjectWithObject(stateObject);
30978 },
30979 GetStateHiddenFieldName: function() {
30980  return this.uniqueID;
30981 },
30982 FormatDates: function(dates, separator) {
30983  var result = "";
30984  for(var i = 0; i < dates.length; i++) {
30985   if(result.length > 0)
30986    result += separator;
30987   result += ASPx.DateUtils.GetInvariantDateString(dates[i]);     
30988  }
30989  return result;
30990 },
30991 InitializeKeyHandlers: function() {
30992  this.AddKeyDownHandler(ASPx.Key.Enter, "OnEnterDown");
30993  this.AddKeyDownHandler(ASPx.Key.Esc, "OnEscape");
30994  this.AddKeyDownHandler(ASPx.Key.PageUp, "OnPageUp");
30995  this.AddKeyDownHandler(ASPx.Key.PageDown, "OnPageDown");
30996  this.AddKeyDownHandler(ASPx.Key.End, "OnEndKeyDown");
30997  this.AddKeyDownHandler(ASPx.Key.Home, "OnHomeKeyDown");
30998  this.AddKeyDownHandler(ASPx.Key.Left, this.rtl ? "OnArrowRight" : "OnArrowLeft");
30999  this.AddKeyDownHandler(ASPx.Key.Right, this.rtl ? "OnArrowLeft" : "OnArrowRight");
31000  this.AddKeyDownHandler(ASPx.Key.Up, "OnArrowUp");
31001  this.AddKeyDownHandler(ASPx.Key.Down, "OnArrowDown");
31002  this.AddKeyPressHandler(ASPx.Key.Enter, "OnEnterPressed");
31003 },
31004 OnArrowUp: function(evt) {
31005  if(this.IsPopupFastNavigationActive())
31006   this.fastNavigation.OnArrowUp(evt);
31007  else if(!this.GetReadOnly() || this.IsInlineFastNavigationActive()) {
31008   var newDate;
31009   if(!this.IsInlineFastNavigationActive()) {
31010    newDate = this.GetNearestDayForToday();
31011    if(this.lastSelectedDate)
31012     newDate = this.currentViewType == ASPx.DatePickerType.Days ? ASPxClientCalendar.GetPrevWeekDate(this.lastSelectedDate) : this.GetNearestDateFromUp(this.lastSelectedDate);
31013   }
31014   else
31015    newDate = this.GetNearestDateFromUp(this.selectedNavigationDates[this.currentViewType]);
31016   if(!ASPxClientCalendarDateDisabledHelper.IsDateWithinBoundaries(newDate))
31017    return true;
31018   if(this.CorrectVisibleMonth(newDate, false))
31019    this.DoKeyboardSelection(newDate, evt.shiftKey, "up");
31020  }
31021  return true;
31022 }, 
31023 OnArrowDown: function(evt) {
31024  if(this.IsPopupFastNavigationActive())
31025   this.fastNavigation.OnArrowDown(evt);
31026  else if(!this.GetReadOnly() || this.IsInlineFastNavigationActive()) {
31027   var newDate;
31028   if(!this.IsInlineFastNavigationActive()) {
31029    newDate = this.GetNearestDayForToday();
31030    if(this.lastSelectedDate)
31031     newDate = this.currentViewType == ASPx.DatePickerType.Days ? ASPxClientCalendar.GetNextWeekDate(this.lastSelectedDate) : this.GetNearestDateFromDown(this.lastSelectedDate);
31032   }
31033   else
31034    newDate = this.GetNearestDateFromDown(this.selectedNavigationDates[this.currentViewType]);
31035   if(this.CorrectVisibleMonth(newDate, true))
31036    this.DoKeyboardSelection(newDate, evt.shiftKey, "down");
31037  }
31038  return true;
31039 }, 
31040 OnArrowLeft: function(evt) {
31041  if(this.IsPopupFastNavigationActive())
31042   this.fastNavigation.OnArrowLeft(evt);
31043  else if(!this.GetReadOnly() || this.IsInlineFastNavigationActive()) {
31044   var newDate;
31045   if(!this.IsInlineFastNavigationActive()) {
31046    newDate = this.GetNearestDayForToday();
31047    if(this.lastSelectedDate)
31048     newDate = this.currentViewType == ASPx.DatePickerType.Days ? ASPxClientCalendar.GetYesterDate(this.lastSelectedDate) : this.GetNearestDateFromLeft(this.lastSelectedDate);
31049   }
31050   else
31051    newDate = this.GetNearestDateFromLeft(this.selectedNavigationDates[this.currentViewType]);
31052   if(!ASPxClientCalendarDateDisabledHelper.IsDateWithinBoundaries(newDate))
31053    return true;
31054   if(this.CorrectVisibleMonth(newDate, false))
31055    this.DoKeyboardSelection(newDate, evt.shiftKey, "left");
31056  }
31057  return true;
31058 }, 
31059 OnArrowRight: function(evt) {
31060  if(this.IsPopupFastNavigationActive())
31061   this.fastNavigation.OnArrowRight(evt);
31062  else if(!this.GetReadOnly() || this.IsInlineFastNavigationActive()) {
31063   var newDate;
31064   if(!this.IsInlineFastNavigationActive()) {
31065    newDate = this.GetNearestDayForToday();
31066    if(this.lastSelectedDate)
31067     newDate = this.currentViewType == ASPx.DatePickerType.Days ? ASPxClientCalendar.GetTomorrowDate(this.lastSelectedDate) : this.GetNearestDateFromRight(this.lastSelectedDate);
31068   }
31069   else
31070    newDate = this.GetNearestDateFromRight(this.selectedNavigationDates[this.currentViewType]);
31071   if(this.CorrectVisibleMonth(newDate, true))
31072    this.DoKeyboardSelection(newDate, evt.shiftKey, "right");
31073  }
31074  return true;
31075 }, 
31076 OnCallback: function(result){
31077  var rowElements = this.GetCalendarRowElements();
31078  for(var rowIndex = 0; rowIndex < this.rows; rowIndex++) {
31079   var viewCellElements = this.GetCalendarViewCellElements(rowElements[rowIndex]);
31080   for(var cellIndex = 0; cellIndex < this.columns; cellIndex++)
31081    ASPx.SetInnerHtml(viewCellElements[cellIndex], result[rowIndex * this.columns + cellIndex]);
31082  }
31083  if(this.sharedParameters.hasCustomDisabledDatesViaCallback)
31084   this.UpdateCustomDisabledDatesOnCallback(result);
31085  this.CreateViews();
31086  this.InitializeGestures();
31087  this.InitializeEnabled();
31088  if(!this.isDateEditCalendar)
31089   this.SetFocus();
31090  if(!this.sharedParameters.calendarCustomDraw)
31091   this.UpdateInternal();
31092  this.EnsureTodayStyle();
31093  this.SetInitialVisibleDate();
31094 }, 
31095 OnPageUp: function(evt) {
31096  if(this.IsPopupFastNavigationActive())
31097   this.fastNavigation.OnPageUp(evt);
31098  else if(!this.GetReadOnly() || this.IsInlineFastNavigationActive()) {
31099   var newDate;
31100   if(this.IsInlineFastNavigationActive())
31101    newDate = this.GetPageUpPageDownResultDate(true, evt.ctrlKey, this.selectedNavigationDates[this.currentViewType]);
31102   else if(this.lastSelectedDate)
31103    newDate = this.GetPageUpPageDownResultDate(true, evt.ctrlKey, this.lastSelectedDate);
31104   else
31105    newDate = this.GetNearestDayForToday();
31106   if(!ASPxClientCalendarDateDisabledHelper.IsDateWithinBoundaries(newDate))
31107    return true;
31108   if(this.CorrectVisibleMonth(newDate, false))
31109    this.DoKeyboardSelection(newDate, false, "left");
31110  }
31111  return true; 
31112 },
31113 OnPageDown: function(evt) {
31114  if(this.IsPopupFastNavigationActive())
31115   this.fastNavigation.OnPageDown(evt);
31116  else if(!this.GetReadOnly() || this.IsInlineFastNavigationActive()) {
31117   var newDate;
31118   if(this.IsInlineFastNavigationActive())
31119    newDate = this.GetPageUpPageDownResultDate(false, evt.ctrlKey, this.selectedNavigationDates[this.currentViewType]);
31120   else if(this.lastSelectedDate)
31121    newDate = this.GetPageUpPageDownResultDate(false, evt.ctrlKey, this.lastSelectedDate);
31122   else
31123    newDate = this.GetNearestDayForToday();
31124   if(!ASPxClientCalendarDateDisabledHelper.IsDateWithinBoundaries(newDate))
31125    return true;
31126   if(this.CorrectVisibleMonth(newDate, true))
31127    this.DoKeyboardSelection(newDate, false, "right");
31128  }
31129  return true;
31130 },
31131 OnEndKeyDown: function(evt) {
31132  if(!this.GetReadOnly() && !this.IsPopupFastNavigationActive() || this.IsInlineFastNavigationActive()) {
31133   var currentDate;
31134   if(this.IsInlineFastNavigationActive())
31135    currentDate = this.selectedNavigationDates[this.currentViewType];
31136   else
31137    currentDate = this.lastSelectedDate ?
31138     ASPxClientCalendar.CloneDate(this.lastSelectedDate) : this.GetNearestDayForToday();
31139   var newDate;
31140   if(this.currentViewType == ASPx.DatePickerType.Days)
31141    newDate = ASPxClientCalendar.GetLastDayInMonthDate(currentDate);
31142   if(this.currentViewType == ASPx.DatePickerType.Months)
31143    newDate = new Date(currentDate.getFullYear(), 11, 1);
31144   if(this.currentViewType == ASPx.DatePickerType.Years)
31145    newDate = new Date(ASPxClientCalendar.GetDecadeStartYear(currentDate.getFullYear()) + 9, 0, 1);
31146   if(this.currentViewType == ASPx.DatePickerType.Decades)
31147    newDate = new Date(ASPxClientCalendar.GetCenturyStartYear(currentDate.getFullYear()) + 90, 0, 1);
31148   if(this.CorrectVisibleMonth(newDate, true))
31149    this.DoKeyboardSelection(newDate, evt.shiftKey, "left");
31150  }
31151  return true;
31152 },
31153 OnHomeKeyDown: function(evt) {
31154  if(!this.GetReadOnly() && !this.IsPopupFastNavigationActive() || this.IsInlineFastNavigationActive()) {
31155   var currentDate;
31156   if(this.IsInlineFastNavigationActive())
31157    currentDate = this.selectedNavigationDates[this.currentViewType];
31158   else
31159    currentDate = this.lastSelectedDate ?
31160     ASPxClientCalendar.CloneDate(this.lastSelectedDate) : this.GetNearestDayForToday();
31161   var newDate;
31162   if(this.currentViewType == ASPx.DatePickerType.Days)
31163    newDate = ASPxClientCalendar.GetFirstDayInMonthDate(currentDate);
31164   if(this.currentViewType == ASPx.DatePickerType.Months)
31165    newDate = new Date(currentDate.getFullYear(), 0, 1);
31166   if(this.currentViewType == ASPx.DatePickerType.Years)
31167    newDate = new Date(ASPxClientCalendar.GetDecadeStartYear(currentDate.getFullYear()), 0, 1);
31168   if(this.currentViewType == ASPx.DatePickerType.Decades)
31169    newDate = new Date(ASPxClientCalendar.GetCenturyStartYear(currentDate.getFullYear()), 0, 1);
31170   if(this.CorrectVisibleMonth(newDate, false))
31171    this.DoKeyboardSelection(newDate, evt.shiftKey, "right");
31172  }
31173  return true;
31174 },
31175 GetPageUpPageDownResultDate: function(isPageUp, ctrlKey, currentDate) {
31176  var getNeighbourMonthDateAction = isPageUp ? ASPxClientCalendar.GetPrevMonthDate : ASPxClientCalendar.GetNextMonthDate;
31177  var getNeighbourYearDateAction = isPageUp ? ASPxClientCalendar.GetPrevYearDate : ASPxClientCalendar.GetNextYearDate;
31178  var offsetYearSign = isPageUp ? -1 : 1;
31179  if(this.currentViewType == ASPx.DatePickerType.Days)
31180   return ctrlKey ? getNeighbourYearDateAction(currentDate) : getNeighbourMonthDateAction(currentDate);
31181  if(this.currentViewType == ASPx.DatePickerType.Months)
31182   return ASPxClientCalendar.GetDateWithYearOffset(currentDate, offsetYearSign);
31183  if(this.currentViewType == ASPx.DatePickerType.Years)
31184   return ASPxClientCalendar.GetDateWithYearOffset(currentDate, offsetYearSign * 10);
31185  if(this.currentViewType == ASPx.DatePickerType.Decades)
31186   return ASPxClientCalendar.GetDateWithYearOffset(currentDate, offsetYearSign * 100);
31187 },
31188 OnEnterDown: function() {
31189  var isPopupFastNavActive = this.IsPopupFastNavigationActive();
31190  var isInlineFastNavActive = this.IsInlineFastNavigationActive();
31191  if(isPopupFastNavActive || isInlineFastNavActive) {
31192   if(isPopupFastNavActive)
31193    this.fastNavigation.ApplyChanges();
31194   else {
31195    var selectedNavigationDate = this.selectedNavigationDates[this.currentViewType];
31196    this.SwitchToLessView();
31197    this.RaiseCellClick(selectedNavigationDate);
31198   }
31199   return true;
31200  }
31201  return false;
31202 },
31203 OnEnterPressed: function() {
31204  return true;
31205 },
31206 OnEscape: function() {
31207  this.CancelFastNavigation();
31208  return true;
31209 },
31210 CancelFastNavigation: function() {
31211  var isPopupFastNavActive = this.IsPopupFastNavigationActive();
31212  var isInlineFastNavActive = this.IsInlineFastNavigationActive();
31213  if(isPopupFastNavActive || isInlineFastNavActive) {
31214   if(isPopupFastNavActive)
31215    this.fastNavigation.CancelChanges();
31216   else
31217    this.ChangeView(this.currentViewType - 1);
31218  }
31219  if(!this.IsInlineFastNavigationActive())
31220   this.OnMainElementClick();
31221 },
31222 OnShiftMonth: function(offset, keepVisibleInSingleMode) {
31223  if(offset) {
31224   var date = this.GetNewVisibleDateByOffset(offset);
31225   if(this.IsInlineFastNavigationActive())
31226    this.selectedNavigationDates[this.currentViewType] = this.GetNewSelectedNavigationDateByOffset(offset);
31227   this.OnVisibleMonthChanged(date);
31228   if (keepVisibleInSingleMode)
31229    this.visibleDateColumnOffset = Math.min(Math.abs(offset), this.columns - 1);
31230  }
31231 },
31232 GetNewVisibleDateByOffset: function(offset) {
31233  return this.GetNewVisibleOrSelectedNavigationDateByOffset(this.visibleDates[this.currentViewType], offset);
31234 },
31235 GetNewSelectedNavigationDateByOffset: function(offset) {
31236  return this.GetNewVisibleOrSelectedNavigationDateByOffset(this.selectedNavigationDates[this.currentViewType], offset);
31237 },
31238 GetNewVisibleOrSelectedNavigationDateByOffset: function(currentDate, offset) {
31239  var date = ASPxClientCalendar.CloneDate(currentDate);
31240  if(this.currentViewType == ASPx.DatePickerType.Days)
31241   return ASPxClientCalendar.AddMonths(date, offset);
31242  if(this.currentViewType == ASPx.DatePickerType.Months)
31243   return ASPxClientCalendar.AddYears(date, offset);
31244  if(this.currentViewType == ASPx.DatePickerType.Years)
31245   return ASPxClientCalendar.AddYears(date, offset * 10);
31246  if(this.currentViewType == ASPx.DatePickerType.Decades)
31247   return ASPxClientCalendar.AddYears(date, offset * 100);
31248 },
31249 OnDayMouseDown: function(date, shift, ctrl, byWeeks) {
31250  if(!this.IsInlineFastNavigationActive())
31251   this.OnPickerViewMouseDown(date, shift, ctrl, byWeeks);
31252  else {
31253   this.selectedNavigationDates[this.currentViewType] = date;
31254   this.SwitchToLessView();
31255  }
31256  this.RaiseCellClick(date);
31257 },
31258 OnPickerViewMouseDown: function(date, shift, ctrl, byWeeks) {
31259  this.isMouseDown = true;
31260  this.selectionByWeeks = byWeeks;
31261  if(!this.enableMulti && this.isSwipeGesturesEnabled())
31262   return;
31263  this.selectionTransaction.Start();
31264  if(this.enableMulti) {
31265   if(ctrl) {
31266    this.selectionCtrl = true;
31267    this.selectionTransaction.CopyFromBackup();
31268   } else
31269    this.selectionCtrl = false;
31270   if(shift && this.selectionPrevStartDate) {
31271    this.selectionStartDate = this.selectionPrevStartDate;         
31272    this.selectionTransaction.selection.AddRange(this.selectionStartDate, date);
31273    if(byWeeks)
31274     this.selectionTransaction.selection.AddWeek(date);
31275   } else {
31276    this.selectionStartDate = date;
31277    this.selectionPrevStartDate = date;
31278    if(byWeeks)
31279     this.selectionTransaction.selection.AddWeek(date);
31280    else
31281     this.selectionTransaction.selection.Add(date);
31282   }
31283  } 
31284  else 
31285   this.selectionTransaction.selection.Add(date);
31286  if(!ASPxClientCalendarDateDisabledHelper.IsDateWithinBoundaries(date))
31287   this.selectionTransaction.CopyFromBackup();
31288  if(this.enableMulti)
31289   this.RemoveDisabledDatesFromSelection(this.selectionTransaction.selection);
31290  this.ApplySelectionByDiff(this.selectionTransaction.selection, false);
31291 },
31292 OnDayMouseOver: function(date) {
31293  if(this.IsInlineFastNavigationActive())
31294   return;
31295  if (!this.sharedParameters.DaysSelectingOnMouseOver.IsEmpty()) {
31296   var args = new ASPxDaysSelectingOnMouseOverEventArgs(date);
31297   this.sharedParameters.DaysSelectingOnMouseOver.FireEvent(this, args);
31298   if (args.cancel)
31299    return;
31300   this.selectionStartDate = args.selectionStartDate;
31301   date = args.overDate;
31302  }
31303  if (!this.enableMulti && this.isSwipeGesturesEnabled() && !this.sharedParameters.dateRangeMode)
31304   return;
31305  if (this.enableMulti || this.sharedParameters.dateRangeMode) {
31306   if(this.selectionCtrl)
31307    this.selectionTransaction.CopyFromBackup();
31308   else
31309    this.selectionTransaction.selection.Clear();
31310   if(this.sharedParameters.dateRangeMode)
31311    this.CalculateRangeSelectionOnMouseOver(date);
31312   else
31313    this.selectionTransaction.selection.AddRange(this.selectionStartDate, date);
31314   if(this.selectionByWeeks) {
31315    this.selectionTransaction.selection.AddWeek(date);
31316    this.selectionTransaction.selection.AddWeek(this.selectionStartDate);
31317   }
31318  } 
31319  else {
31320   this.selectionTransaction.selection.Clear();
31321   this.selectionTransaction.selection.Add(date);
31322  }
31323  if (this.enableMulti || this.sharedParameters.dateRangeMode)
31324   this.RemoveDisabledDatesFromSelection(this.selectionTransaction.selection);
31325  this.ApplySelectionByDiff(this.selectionTransaction.selection, false);
31326  if (this.updateDayStylesTwiceOnMouseOver)
31327   this.ForceUpdateOnMouseOver();
31328 },
31329 ForceUpdateOnMouseOver: function() {
31330  this.forceUpdatingOnMouseOver = true;
31331  try {
31332   this.Update();
31333  }
31334  finally {
31335   this.forceUpdatingOnMouseOver = false;
31336  }
31337 },
31338 CalculateRangeSelectionOnMouseOver: function(overDate) {
31339  var selectedRangeRestrictions = {
31340   start: ASPxClientCalendar.GetMinDate(this.selectionStartDate, overDate),
31341   end: ASPxClientCalendar.GetMaxDate(this.selectionStartDate, overDate)
31342  };
31343  var visibleRangeRestrictions = this.GetVisibleRangeRestrictions();
31344  ASPxClientCalendar.AddSelectedRangeVisiblePartToSelection(this.selectionTransaction.selection, selectedRangeRestrictions, visibleRangeRestrictions);
31345 },
31346 RaiseVisibleDaysMouseOut: function() {
31347  if (!this.sharedParameters.VisibleDaysMouseOut.IsEmpty())
31348   this.sharedParameters.VisibleDaysMouseOut.FireEvent(this);
31349 },
31350 OnDayMouseUp: function(date) {
31351  if(this.IsInlineFastNavigationActive())
31352   return;
31353  if(!ASPx.Browser.IE && this.isMouseDown)
31354   this.OnMainElementClick();
31355  this.isMouseDown = false;
31356  if(!this.enableMulti && this.isSwipeGesturesEnabled() && this.swipeGestureStated)
31357   this.swipeGestureStated = false;
31358  if(this.enableMulti) {
31359   if(this.selectionCtrl && this.selectionTransaction.backup.Contains(date) &&
31360    ASPxClientCalendar.AreDatesEqual(date, this.selectionStartDate)) {
31361    if(this.selectionByWeeks)
31362     this.selectionTransaction.selection.RemoveWeek(date);
31363    else
31364     this.selectionTransaction.selection.Remove(date);
31365   }
31366  }
31367  else if(this.sharedParameters.dateRangeMode) {
31368   this.selectionTransaction.selection.Clear();
31369   this.selectionTransaction.selection.Add(date);
31370  }
31371  else if(this.isSwipeGesturesEnabled() && !this.swipeGestureStated) {
31372   this.selectionTransaction.selection.Add(date);
31373   if(!ASPxClientCalendarDateDisabledHelper.IsDateWithinBoundaries(date))
31374    this.selectionTransaction.CopyFromBackup();
31375   this.ApplySelectionByDiff(this.selectionTransaction.selection, false);
31376  }
31377  this.lastSelectedDate = ASPxClientCalendar.CloneDate(date);
31378  this.OnSelectionChanging();
31379 },
31380 GetTodayDate: function() {
31381  var parentSchedulerTodayDate = this.GetParentSchedulerTodayDate();
31382  if(parentSchedulerTodayDate)
31383   return parentSchedulerTodayDate;
31384  var now = new Date();
31385  var correctedNowDate = ASPxClientCalendar.GetCorrectedDate(now, this.pickerType);
31386  return new Date(correctedNowDate.getFullYear(), correctedNowDate.getMonth(), correctedNowDate.getDate());
31387 },
31388 GetParentSchedulerTodayDate: function() {
31389  return this.actualTodayDate;
31390 },
31391 EnsureHideFastNavigation: function() {
31392  if(this.fastNavigation)
31393   this.fastNavigation.Hide();
31394  else if(this.IsInlineFastNavigationActive())
31395   this.ChangeView(this.pickerType);
31396 },
31397 OnTodayClick: function() {
31398  this.EnsureHideFastNavigation();
31399  var todayDate = this.GetTodayDate();
31400  if(ASPxClientCalendarDateDisabledHelper.IsDateInRange(this.sharedParameters, todayDate)) {
31401   if(!this.IsDateDisabled(todayDate)) {
31402    this.selectionTransaction.Start();
31403    this.selectionTransaction.selection.Add(todayDate);
31404    this.lastSelectedDate = ASPxClientCalendar.CloneDate(todayDate);
31405    this.OnSelectionChanging();
31406   }
31407   if(!ASPxClientCalendar.AreDatesOfSamePeriod(todayDate, this.visibleDate, this.currentViewType))
31408    this.OnVisibleMonthChanged(todayDate);  
31409  }
31410 },
31411 OnClearClick: function() {
31412  if(this.isDateEditCalendar && ASPxClientDateEdit.active)
31413   ASPxClientDateEdit.active.OnTimeSectionClearClick();
31414  else {
31415   this.selectionTransaction.Start();
31416   this.OnSelectionChanging();
31417   this.selectionStartDate = null;
31418   this.selectionPrevStartDate = null;    
31419   this.ResetLastSelectedDate();
31420  }
31421 },
31422 OnOkClick: function() {
31423  var edit = ASPxClientDateEdit.active;
31424  if(edit)
31425   edit.OnApplyButtonClick();
31426 },
31427 OnCancelClick: function() {
31428  var edit = ASPxClientDateEdit.active;
31429  if(edit)
31430   edit.OnTimeSectionCancelClick();
31431 },
31432 ResetLastSelectedDate: function() {
31433  this.lastSelectedDate = null;
31434 },
31435 OnSelectMonth: function(row, column) {  
31436  var txn = this.selectionTransaction;
31437  txn.Start();
31438  var date = ASPxClientCalendar.CloneDate(this.GetActiveView(row, column).visibleDate);
31439  date.setDate(1);
31440  do {  
31441   if(ASPxClientCalendarDateDisabledHelper.IsDateInRange(this.sharedParameters, date) &&
31442    !this.IsDateDisabled(date))
31443    txn.selection.Add(date);
31444   date = ASPxClientCalendar.AddDays(date, 1);
31445  } while(date.getDate() > 1);
31446  this.OnSelectionChanging();
31447 },
31448 OnTitleClick: function(row, column) {
31449  if(!this.AllowProcessTitleClick())
31450   return;
31451  if(this.showFastPopup)
31452   this.ShowPopupFastNavigation(row, column);
31453  else
31454   this.SwitchToGreaterView(row, column);
31455 },
31456 SwitchToGreaterView: function(row, column, newViewType, disableAnimation) {
31457  newViewType = newViewType || this.currentViewType + 1;
31458  this.visibleDates[newViewType] = this.GetGreaterViewVisibleDate(newViewType, row, column);
31459  this.selectedNavigationDates[newViewType] = this.GetGreaterViewSelectedNavigationDate(newViewType, row, column);
31460  this.ChangeView(newViewType, disableAnimation);
31461 },
31462 SwitchToLessView: function() {
31463  var newViewType = this.currentViewType - 1;
31464  var selectedDate = this.selectedNavigationDates[this.currentViewType];
31465  this.visibleDates[newViewType] = this.GetLessViewVisibleDate(newViewType, selectedDate);
31466  var isSwitchedToPickerView = newViewType == this.pickerType;
31467  var oldVisibleDate = ASPxClientCalendar.CloneDate(this.visibleDate);
31468  if(isSwitchedToPickerView)
31469   this.visibleDate = this.visibleDates[newViewType];
31470  else
31471   this.selectedNavigationDates[newViewType] = selectedDate;
31472  this.ChangeView(newViewType);
31473  if(isSwitchedToPickerView && !ASPxClientCalendar.AreDatesOfSamePeriod(this.visibleDate, oldVisibleDate, this.pickerType))
31474   this.OnVisibleMonthChanged(this.visibleDate, oldVisibleDate, true);
31475 },
31476 GetViewByDate: function(date) {
31477  var activeViews = this.GetActiveViews();
31478  for(var key in activeViews) {
31479   if(activeViews.hasOwnProperty(key)) {
31480    var view = activeViews[key];
31481    if(view.IsDateVisible(date))
31482     return view;
31483   }
31484  }
31485 },
31486 GetGreaterViewVisibleDate: function(greaterViewType, currentRow, currentColumn) {
31487  var currentViewVisibleYear = this.GetActiveView(currentRow, currentColumn).visibleDate.getFullYear();
31488  var greaterViewTypeCurrentView = this.GetView(currentRow, currentColumn, greaterViewType);
31489  var greaterViewTypeCurrentViewVisibleYearOffset = greaterViewTypeCurrentView.GetVisibleDateOffsetInfo().year;
31490  var greaterViewTypeCurrentViewVisibleYear;
31491  if(greaterViewType == ASPx.DatePickerType.Months)
31492   greaterViewTypeCurrentViewVisibleYear = currentViewVisibleYear;
31493  if(greaterViewType == ASPx.DatePickerType.Years)
31494   greaterViewTypeCurrentViewVisibleYear = ASPxClientCalendar.GetDecadeStartYear(currentViewVisibleYear);
31495  if(greaterViewType == ASPx.DatePickerType.Decades)
31496   greaterViewTypeCurrentViewVisibleYear = ASPxClientCalendar.GetCenturyStartYear(currentViewVisibleYear);
31497  return new Date(greaterViewTypeCurrentViewVisibleYear - greaterViewTypeCurrentViewVisibleYearOff
31497set, 0, 1);
31498 },
31499 GetGreaterViewSelectedNavigationDate: function(greaterViewType, currentRow, currentColumn) {
31500  var currentViewVisibleDate = this.GetActiveView(currentRow, currentColumn).visibleDate;
31501  var currentViewVisibleYear = currentViewVisibleDate.getFullYear();
31502  var currentViewVisibleMonth = currentViewVisibleDate.getMonth();
31503  var resultYear = greaterViewType != ASPx.DatePickerType.Decades ? currentViewVisibleYear : ASPxClientCalendar.GetDecadeStartYear(currentViewVisibleYear);
31504  var resultMonth = greaterViewType == ASPx.DatePickerType.Months ? currentViewVisibleMonth : 0;
31505  return new Date(resultYear, resultMonth, 1);
31506 },
31507 GetLessViewVisibleDate: function(lessViewType, currentSelectedNavigationDate) {
31508  var result = null;
31509  var currentView = this.GetViewByDate(currentSelectedNavigationDate);
31510  var prevViewVisibleDateOffsetInfo = this.GetView(currentView.row, currentView.column, lessViewType).GetVisibleDateOffsetInfo();
31511  if(lessViewType == ASPx.DatePickerType.Days) {
31512   result = new Date(currentSelectedNavigationDate.getFullYear(), currentSelectedNavigationDate.getMonth(), 1);
31513   result = ASPxClientCalendar.AddMonths(result, (-1) * prevViewVisibleDateOffsetInfo.month);
31514  }
31515  else
31516   result = new Date(currentSelectedNavigationDate.getFullYear() - prevViewVisibleDateOffsetInfo.year, 0, 1);
31517  return result;
31518 },
31519 ShowPopupFastNavigation: function(row, column) {
31520  this.fastNavigation.activeView = this.GetActiveView(row, column);
31521  this.fastNavigation.Show();
31522 },
31523 AllowProcessTitleClick: function() {
31524  return this.showFastPopup || this.enableFast && this.currentViewType < this.maxViewType;
31525 },
31526 OnMainElementClick: function(mouseEvt) {
31527  this.MainElementClick.FireEvent(this, mouseEvt);
31528 },
31529 OnSelectionChanging: function() {
31530  if(!this.SelectionChanging.IsEmpty()){
31531   var args = new ASPxClientCalendarSelectionEventArgs(false, this.selectionTransaction.selection);
31532   this.SelectionChanging.FireEvent(this, args);  
31533  }
31534  var changed = this.selectionTransaction.IsChanged();
31535  this.selectionTransaction.Commit();
31536  if(changed)
31537   this.OnValueChanged();  
31538 },
31539 OnVisibleMonthChanged: function(date, oldDate, skipVisibleDateUpdating) {
31540  oldDate = oldDate || this.visibleDate;
31541  var offsetInternal = this.currentViewType == ASPx.DatePickerType.Days ? ASPxClientCalendar.GetOffsetInMonths(oldDate, date) : 0;
31542  if(!skipVisibleDateUpdating)
31543   this.SetVisibleDateInternal(date);
31544  var processOnServer = this.currentViewType == ASPx.DatePickerType.Days ? this.RaiseVisibleMonthChanged(offsetInternal) : this.autoPostBack;
31545  if(processOnServer && !this.customDraw && !this.IsInlineFastNavigationActive())
31546   this.SendPostBackInternal("");
31547 },
31548 OnSelectionCancelled: function() {
31549  this.isMouseDown = false;  
31550  this.selectionTransaction.Rollback();
31551 },
31552 OnCustomDisabledDate: function(date) {
31553  return this.RaiseCustomDisabledDate(date);
31554 },
31555 RaiseCustomDisabledDate: function(date) {
31556  var args = new ASPxClientCalendarCustomDisabledDateEventArgs(date);
31557  this.CustomDisabledDate.FireEvent(this, args);
31558  return args;
31559 },
31560 RaiseValueChangedEvent: function() {
31561  var processOnServer = ASPxClientEdit.prototype.RaiseValueChangedEvent.call(this);
31562  processOnServer = this.RaiseSelectionChanged(processOnServer);
31563  return processOnServer;
31564 },
31565 SetVisibleDate: function(date) {
31566  this.EnsureHideFastNavigation(); 
31567  this.SetVisibleDateInternal(date);
31568 }, 
31569 SetVisibleDateInternal: function(date) {
31570  var old = this.visibleDates[this.currentViewType];
31571  date = ASPxClientCalendarDateDisabledHelper.GetCorrectedDate(date);
31572  date = ASPxClientCalendar.GetCorrectedDate(date, this.pickerType);
31573  this.visibleDates[this.currentViewType] = date;
31574  if(!this.IsInlineFastNavigationActive())
31575   this.visibleDate = date;
31576  var leftDir = this.rtl ? ASPx.AnimationHelper.SLIDE_LEFT_DIRECTION : ASPx.AnimationHelper.SLIDE_RIGHT_DIRECTION;
31577  var rightDir = this.rtl ? ASPx.AnimationHelper.SLIDE_RIGHT_DIRECTION : ASPx.AnimationHelper.SLIDE_LEFT_DIRECTION;
31578  this.slideAnimationDirection = this.IsAnimationEnabled() ? ((old < this.visibleDates[this.currentViewType]) ? rightDir : leftDir) : null;
31579  if(!ASPxClientCalendar.AreDatesOfSamePeriod(date, old, this.currentViewType) || this.forceUpdate) {
31580   this.forceUpdate = false;
31581   this.Update(); 
31582  }
31583 },
31584 SetSelectedDate: function(date) {
31585  date = ASPxClientCalendar.GetCorrectedDate(date, this.pickerType);
31586  this.EnsureHideFastNavigation();
31587  if(ASPxClientCalendarDateDisabledHelper.IsDateInRange(this.sharedParameters, date) &&
31588   !this.IsDateDisabled(date)) {
31589   var selection = new ASPxClientCalendarSelection();
31590   selection.SetPickerType(this.pickerType);
31591   if(date != null) {
31592    selection.Add(date);
31593    this.lastSelectedDate = ASPxClientCalendar.CloneDate(date);
31594   }
31595   this.ApplySelectionByDiff(selection, true);
31596  }
31597 },
31598 AllowShiftVisiblePeriod: function() {
31599  return this.currentViewType == ASPx.DatePickerType.Days ?
31600   this.enableDaysViewPeriodNavigation : this.enableMonthsYearsViewPeriodNavigation;
31601 },
31602 CorrectVisibleMonth: function(newDate, isForwardDirection) {
31603  var offset = this.GetOffsetInCurrentViewTypePeriods(this.visibleDates[this.currentViewType], newDate);
31604  if(this.IsMultiView() && offset != 0) {
31605   var view = isForwardDirection ? this.GetActiveView(this.rows - 1, this.columns - 1) : 
31606            this.GetActiveView(0, 0);
31607   offset = this.IsDateVisible(newDate) ? 0 :
31608       this.GetOffsetInCurrentViewTypePeriods(view.visibleDate, newDate);
31609  }
31610  if(!this.IsInlineFastNavigationActive() && (!ASPxClientCalendarDateDisabledHelper.IsDateInRange(this.sharedParameters, newDate) ||
31611   this.IsDateDisabled(newDate)))
31612   offset = 0;
31613  var result = offset == 0 || this.AllowShiftVisiblePeriod();
31614  if(offset != 0 && this.AllowShiftVisiblePeriod())
31615   this.OnShiftMonth(offset);
31616  return result;
31617 },
31618 GetOffsetInCurrentViewTypePeriods: function(visibleDate, newDate) {
31619  return ASPxClientCalendar.GetOffsetInPeriods(visibleDate, newDate, this.currentViewType);
31620 },
31621 DoKeyboardSelection: function(date, shift, direction) {
31622  if(!this.IsInlineFastNavigationActive())
31623   this.DoKeyboardSelectionOnPickerView(date, shift, direction);
31624  else {
31625   var activeViews = this.GetActiveViews();
31626   for(var key in activeViews) {
31627    if(!activeViews.hasOwnProperty(key)) continue;
31628    var view = activeViews[key];
31629    view.UpdateSelection(this.selectedNavigationDates[this.currentViewType], false);
31630    view.UpdateSelection(date, true);
31631   }
31632   this.selectedNavigationDates[this.currentViewType] = date;
31633  }
31634 },
31635 DoKeyboardSelectionOnPickerView: function(date, shift, direction) {
31636  if(ASPxClientCalendarDateDisabledHelper.IsDateInRange(this.sharedParameters, date)) {
31637   this.isDateChangingByKeyboard = true;
31638   var existDate = this.IsDateDisabled(date) ? this.GetNearestDayForDate(date, direction) : date;
31639   if(existDate != null) {
31640    this.selectionTransaction.Start();
31641    if(this.enableMulti && shift && this.selectionStartDate) {
31642     this.selectionTransaction.selection.AddRange(this.selectionStartDate, existDate);
31643     this.RemoveDisabledDatesFromSelection(this.selectionTransaction.selection);
31644    } else {
31645     this.selectionTransaction.selection.Add(existDate);
31646     this.selectionStartDate = existDate;
31647    }
31648    this.lastSelectedDate = ASPxClientCalendar.CloneDate(existDate);
31649    this.OnSelectionChanging();
31650   }
31651   this.isDateChangingByKeyboard = false;
31652  }
31653 },
31654 RemoveDisabledDatesFromSelection: function(selection) {
31655  var selectedDates = selection.GetDates();
31656  for(var i = 0; i < selectedDates.length; i++) {
31657   if(this.IsDateDisabled(selectedDates[i]))
31658    selection.Remove(selectedDates[i]);
31659  }
31660 },
31661 GetNearestDayForToday: function() {
31662  var todayDate = this.GetTodayDate();
31663  if(this.sharedParameters.minDate && !ASPxClientCalendarDateDisabledHelper.IsDateInRange(this.sharedParameters, todayDate))
31664   todayDate = ASPxClientCalendar.CloneDate(this.IsDateDisabled(this.sharedParameters.minDate) ? this.GetNearestDayForDate(this.sharedParameters.minDate, "left") : this.sharedParameters.minDate);
31665  return todayDate;
31666 },
31667 GetNearestDayForDate: function(date, direction) {
31668  var nearestDate = null;
31669  var nextDate = date;
31670  while(nearestDate == null) {
31671   switch(direction) {
31672    case "up":
31673     nextDate = this.GetNearestDateFromUp(nextDate);
31674     break;
31675    case "down":
31676     nextDate = this.GetNearestDateFromDown(nextDate);
31677     break;
31678    case "left":
31679     nextDate = this.GetNearestDateFromLeft(nextDate);
31680     break;
31681    case "right":
31682     nextDate = this.GetNearestDateFromRight(nextDate);
31683     break;
31684   }
31685   var isForbiddenDate = !ASPxClientCalendarDateDisabledHelper.IsDateInRange(this.sharedParameters, nextDate) || this.IsDateDisabled(nextDate);
31686   nearestDate = isForbiddenDate ? null : nextDate;
31687  }
31688  return nearestDate;
31689 },
31690 GetNearestDateFromUp: function(date) {
31691  if(this.currentViewType == ASPx.DatePickerType.Days)
31692   return new Date(date.getTime() - (7 * 24 * 60 * 60 * 1000));
31693  if(this.currentViewType == ASPx.DatePickerType.Months) {
31694   var newDate = new Date(date.getTime());
31695   newDate = ASPxClientCalendar.AddMonths(newDate, -4);
31696   return newDate;
31697  }
31698  if(this.currentViewType == ASPx.DatePickerType.Years) {
31699   var newDate = new Date(date.getTime());
31700   newDate = ASPxClientCalendar.AddYears(newDate, -4);
31701   return newDate;
31702  }
31703  if(this.currentViewType == ASPx.DatePickerType.Decades) {
31704   var newDate = new Date(date.getTime());
31705   newDate = ASPxClientCalendar.AddYears(newDate, -40);
31706   return newDate;
31707  }
31708 },
31709 GetNearestDateFromDown: function(date) {
31710  if(this.currentViewType == ASPx.DatePickerType.Days)
31711   return new Date(date.getTime() + (7 * 24 * 60 * 60 * 1000));
31712  if(this.currentViewType == ASPx.DatePickerType.Months) {
31713   var newDate = new Date(date.getTime());
31714   newDate = ASPxClientCalendar.AddMonths(newDate, 4);
31715   return newDate;
31716  }
31717  if(this.currentViewType == ASPx.DatePickerType.Years) {
31718   var newDate = new Date(date.getTime());
31719   newDate = ASPxClientCalendar.AddYears(newDate, 4);
31720   return newDate;
31721  }
31722  if(this.currentViewType == ASPx.DatePickerType.Decades) {
31723   var newDate = new Date(date.getTime());
31724   newDate = ASPxClientCalendar.AddYears(newDate, 40);
31725   return newDate;
31726  }
31727 },
31728 GetNearestDateFromLeft: function(date) {
31729  if(this.currentViewType == ASPx.DatePickerType.Days)
31730   return new Date(date.getTime() - (1 * 24 * 60 * 60 * 1000));
31731  if(this.currentViewType == ASPx.DatePickerType.Months) {
31732   var newDate = new Date(date.getTime());
31733   newDate = ASPxClientCalendar.AddMonths(newDate, -1);
31734   return newDate;
31735  }
31736  if(this.currentViewType == ASPx.DatePickerType.Years) {
31737   var newDate = new Date(date.getTime());
31738   newDate = ASPxClientCalendar.AddYears(newDate, -1);
31739   return newDate;
31740  }
31741  if(this.currentViewType == ASPx.DatePickerType.Decades) {
31742   var newDate = new Date(date.getTime());
31743   newDate = ASPxClientCalendar.AddYears(newDate, -10);
31744   return newDate;
31745  }
31746 },
31747 GetNearestDateFromRight: function(date) {
31748  if(this.currentViewType == ASPx.DatePickerType.Days)
31749   return new Date(date.getTime() + (1 * 24 * 60 * 60 * 1000));
31750  if(this.currentViewType == ASPx.DatePickerType.Months) {
31751   var newDate = new Date(date.getTime());
31752   newDate = ASPxClientCalendar.AddMonths(newDate, 1);
31753   return newDate;
31754  }
31755  if(this.currentViewType == ASPx.DatePickerType.Years) {
31756   var newDate = new Date(date.getTime());
31757   newDate = ASPxClientCalendar.AddYears(newDate, 1);
31758   return newDate;
31759  }
31760  if(this.currentViewType == ASPx.DatePickerType.Decades) {
31761   var newDate = new Date(date.getTime());
31762   newDate = ASPxClientCalendar.AddYears(newDate, 10);
31763   return newDate;
31764  }
31765 },
31766 UseDelayedSpecialFocus: function() { 
31767  return true;
31768 },
31769 GetDelayedSpecialFocusTriggers: function() {
31770  var list = ASPxClientEdit.prototype.GetDelayedSpecialFocusTriggers.c
31770all(this);
31771  if(this.fastNavigation && this.showFastPopup)
31772   list.push(this.fastNavigation.GetPopupWindowElement());
31773  return list;
31774 },
31775 GetSelectedDate: function() {
31776  return this.GetValue();
31777 },
31778 GetVisibleDate: function() {
31779  return this.visibleDate;
31780 },
31781 SelectDate: function(date) {
31782  if(date) {
31783   date = ASPxClientCalendarDateDisabledHelper.GetCorrectedDate(date);
31784   this.selection.Add(date);
31785   this.Update();
31786  }
31787 },
31788 GetVisibleRangeRestrictions: function() {
31789  return {
31790   start: this.GetActiveView(0, 0).GetVisibleRangeRestrictions().start,
31791   end: this.GetActiveView(this.rows - 1, this.columns - 1).GetVisibleRangeRestrictions().end
31792  };
31793 },
31794 NeedCalculateSelectionOnUpdating: function() {
31795  return this.sharedParameters.dateRangeMode && this.selection.startDate && this.selection.endDate && !this.forceUpdatingOnMouseOver;
31796 },
31797 SelectRange: function(start, end) {
31798  if(start && end) {
31799   start = ASPxClientCalendarDateDisabledHelper.GetCorrectedDate(start);
31800   end = ASPxClientCalendarDateDisabledHelper.GetCorrectedDate(end);
31801   if(this.sharedParameters.dateRangeMode)
31802    this.selection.SetRestrictions(start, end);
31803   else
31804    this.selection.AddRange(start, end);
31805   this.Update();
31806  }
31807 },
31808 DeselectDate: function(date) {
31809  if(date) {
31810   this.selection.Remove(date);
31811   this.Update(); 
31812  }
31813 },
31814 DeselectRange: function(start, end) {
31815  if(start && end) {
31816   this.selection.RemoveRange(start, end);
31817   this.Update();
31818  }
31819 },
31820 ClearSelection: function() {
31821  this.selection.Clear();
31822  if(this.sharedParameters.dateRangeMode)
31823   this.selection.ResetRestrictions();
31824  this.Update();
31825 },
31826 GetSelectedDates: function() {
31827  return this.selection.GetDates();
31828 },
31829 RaiseSelectionChangedInternal: function(processOnServer) {
31830  if(!this.sharedParameters.CalendarSelectionChangedInternal.IsEmpty()) {
31831   var args = new ASPxClientProcessingModeEventArgs(processOnServer);
31832   this.sharedParameters.CalendarSelectionChangedInternal.FireEvent(this, args);
31833   processOnServer = args.processOnServer;
31834  }
31835  return processOnServer;
31836 },
31837 RaiseSelectionChanged: function(processOnServer) {
31838  processOnServer = this.RaiseSelectionChangedInternal(processOnServer);
31839  if(!this.SelectionChanged.IsEmpty()){
31840   var args = new ASPxClientProcessingModeEventArgs(processOnServer);  
31841   this.SelectionChanged.FireEvent(this, args);
31842   processOnServer = args.processOnServer;
31843  }
31844  return processOnServer;
31845 },
31846 RaiseVisibleMonthChanged: function(offsetInternal) {
31847  var processOnServer = this.autoPostBack;
31848  if(!this.VisibleMonthChanged.IsEmpty()){
31849   var args = new ASPxClientProcessingModeEventArgs(processOnServer);
31850   args.offsetInternal = offsetInternal;
31851   this.VisibleMonthChanged.FireEvent(this, args);
31852   processOnServer = args.processOnServer;
31853  }
31854  return processOnServer;
31855 },
31856 RaiseCellClick: function(date) {
31857  if(!this.CellClick.IsEmpty()) {
31858   var args = new ASPxClientCalendarCellClickEventArgs(date);
31859   this.CellClick.FireEvent(this, args);
31860  }
31861 },
31862 SetReadOnlyInternal: function(readOnly) {
31863  ASPxClientEdit.prototype.SetReadOnlyInternal.call(this, readOnly);
31864  this.ChangeReadOnlyAttributes(readOnly);
31865  var footer = this.GetFooter();
31866  if(footer)
31867   footer.style.display = readOnly ? "none" : "";
31868 },
31869 ChangeEnabledAttributes: function(enabled) {
31870  ASPx.Attr.ChangeDocumentEventsMethod(enabled)("mouseup", aspxCalDocMouseUp);
31871  ASPx.Attr.ChangeEventsMethod(enabled)(this.GetMainElement(), "click", ASPxClientCalendar.AnonymousHandlers.MainElementClick(this.name));
31872  var inputElement = this.GetInputElement();
31873  if(inputElement) {
31874   this.ChangeSpecialInputEnabledAttributes(inputElement, ASPx.Attr.ChangeEventsMethod(enabled));
31875   if(!this.accessibilityCompliant) {
31876    var changeMethod = enabled ? ASPx.Attr.RestoreTabIndexAttribute : ASPx.Attr.SaveTabIndexAttributeAndReset;
31877    changeMethod(inputElement);
31878   }
31879  }
31880  var btnElement = this.GetTodayButton();
31881  if(btnElement)
31882   this.ChangeButtonEnabledAttributes(btnElement, this.GetChangeButtonEnabledAttributesMethod(enabled));
31883  btnElement = this.GetClearButton();
31884  if(btnElement)
31885   this.ChangeButtonEnabledAttributes(btnElement, this.GetChangeButtonEnabledAttributesMethod(enabled));
31886  for(var i = this.pickerType; i <= this.maxViewType; i++) {
31887   var views = this.GetViews(i);
31888   for(var key in views) {
31889    if(views.hasOwnProperty(key)) {
31890     var view = views[key];
31891     if(!view.isASPxClientCalendarView) continue;
31892     view.ChangeEnabledAttributes(enabled);
31893     view.ChangeEditableAttributesOnChangeEnabledState(enabled);
31894    }
31895   }
31896  }
31897 },
31898 ChangeReadOnlyAttributes: function(readOnly) {
31899  if(!this.GetEnabled())
31900   return;
31901  for(var i = this.pickerType; i <= this.maxViewType; i++) {
31902   var views = this.GetViews(i);
31903   for(var key in views) {
31904    if(views.hasOwnProperty(key)) {
31905     var view = views[key];
31906     if(!view.isASPxClientCalendarView) continue;
31907     view.ChangeEditableAttributesOnChangeReadOnlyState(readOnly);
31908    }
31909   }
31910  }  
31911 },
31912 ChangeEnabledStateItems: function(enabled){
31913  ASPx.GetStateController().SetElementEnabled(this.GetMainElement(), enabled);
31914  var btnElement = this.GetTodayButton();
31915  if(btnElement)
31916   ASPx.GetStateController().SetElementEnabled(btnElement, enabled);
31917  btnElement = this.GetClearButton();
31918  if(btnElement)
31919   ASPx.GetStateController().SetElementEnabled(btnElement, enabled);
31920  this.EnsureHideFastNavigation();
31921  for(var i = this.pickerType; i <= this.maxViewType; i++) {
31922   var views = this.GetViews(i);
31923   for(var key in views) {
31924    if(views.hasOwnProperty(key)) {
31925     var view = views[key];
31926     if(!view.isASPxClientCalendarView) continue;
31927     view.ChangeEnabledStateItems(enabled);
31928    }
31929   }
31930  }
31931  this.UpdateInternal();   
31932 },
31933 ChangeButtonEnabledAttributes: function(element, method){
31934  method(element, "onclick");
31935  method(element, "ondblclick");
31936 },
31937 GetChangeButtonEnabledAttributesMethod: function(enabled) {
31938  return ASPx.Attr.ChangeAttributesMethod(enabled);
31939 },
31940 GetMinDate: function() {
31941  return this.sharedParameters.minDate;
31942 },
31943 SetMinDate: function(date) {
31944  date = ASPxClientCalendarDateDisabledHelper.GetCorrectedDate(date);
31945  date = ASPxClientCalendar.GetCorrectedDate(date, this.pickerType);
31946  this.sharedParameters.minDate = date;
31947  this.Update();
31948 },
31949 GetMaxDate: function() {
31950  return this.sharedParameters.maxDate;
31951 },
31952 SetMaxDate: function(date) {
31953  date = ASPxClientCalendarDateDisabledHelper.GetCorrectedDate(date);
31954  date = ASPxClientCalendar.GetCorrectedDate(date, this.pickerType);
31955  this.sharedParameters.maxDate = date;
31956  this.Update();
31957 },
31958 CheckDateEnabled: function(date){
31959  return !this.IsDateDisabled(date);
31960 },
31961 CanMouseDown: function(evt, date){
31962  if(!evt) return false;
31963  return ASPx.Evt.IsLeftButtonPressed(evt) && (!this.IsDateDisabled(date) || this.IsInlineFastNavigationActive());
31964 },
31965 CanMouseOver: function(date) {
31966  if(this.IsInlineFastNavigationActive())
31967   return false;
31968  if(this.forceMouseDown || this.isMouseDown || this.sharedParameters.dateRangeMode)
31969   return !this.IsDateDisabled(date);
31970  return false;
31971 },
31972 OnAssociatedLabelClick: function(evt) {
31973  ASPxClientCalendar.prototype.OnDelayedSpecialFocusMouseDown.call(this, evt);
31974 }
31975});
31976ASPxClientCalendar.Cast = ASPxClientControl.Cast;
31977var AccessibilityHelperCalendar = ASPx.CreateClass(ASPx.AccessibilityHelperBase, {
31978 constructor: function(calendar) {
31979  this.constructor.prototype.constructor.call(this, calendar);
31980  this.control.GotFocus.AddHandler(function() { this.PronounceDates(this.control.GetSelectedDates(), true); }.aspxBind(this));
31981  this.control.LostFocus.AddHandler(function() { 
31982   setTimeout(function() { this.changeActivityAttributes(this.getMainElement(), { "aria-activedescendant": "" }); }.aspxBind(this), 200); 
31983  }.aspxBind(this));
31984  this.pickerType = calendar.pickerType;
31985 },
31986 PronounceDates: function(dates, useDescriptionText) {
31987  var datesText = this.getDatesText(dates);
31988  var dateEditInput = null;
31989  var activeItemArgs = null;
31990  var inactiveItemArgs = null;
31991  if(this.control.isDateEditCalendar) {
31992   var dateEdit = this.control.sharedParameters.currentDateEdit;
31993   if(dateEdit)
31994    dateEditInput = dateEdit.GetInputElement();
31995   activeItemArgs = {
31996    "role"    : "option",
31997    "aria-selected" : true
31998   };
31999   inactiveItemArgs = {
32000    "role"    : "",
32001    "aria-selected" : ""
32002   };
32003  }
32004  if(!this.control.isDateEditCalendar && useDescriptionText) 
32005   datesText = ASPx.AccessibilitySR.CalendarDescription + " " + datesText;
32006  this.PronounceMessage(datesText, activeItemArgs, inactiveItemArgs, null, dateEditInput);
32007 },
32008 getDatesText: function(dates) {
32009  var datesText = "";
32010  if(dates.length == 0)
32011   datesText = this.control.isDateEditCalendar ? ASPx.AccessibilitySR.CalendarDescription : ASPx.AccessibilitySR.BlankEditorText;
32012  else {
32013   dates.sort(function(x, y) { return x.valueOf() - y.valueOf(); });
32014   var ranges = this.getDateRanges(dates);
32015   datesText = this.getRangesText(ranges);
32016  }
32017  return datesText;
32018 },
32019 GetActiveElement: function(inputIsMainElement) {
32020  var activeElement = ASPx.AccessibilityHelperBase.prototype.GetActiveElement.call(this, inputIsMainElement);
32021  var mainElement = inputIsMainElement ? this.control.GetInputElement() : this.getMainElement();
32022  return activeElement == mainElement ? null : activeElement;
32023 },
32024 getRangesText: function(ranges) {
32025  var dateText = "";
32026  var hasMultiSelect = ranges.length > 1 || ranges.length === 1 && ranges[0].count > 1;
32027  if(hasMultiSelect)
32028   dateText = ASPx.AccessibilitySR.CalendarMultiSelectText;
32029  var rangesLength = ranges.length;
32030  var rangeDatesTextArray = [ ];
32031  for(var i = 0; i < rangesLength; i++)
32032   rangeDatesTextArray.push(this.getRangeText(ranges[i]));
32033  return dateText + rangeDatesTextArray.join(', ');
32034 },
32035 getRangeText: function(range) {
32036  var rangeFormatString = ASPx.AccessibilitySR.CalendarRangeFormatString;
32037  var startDateString = this.getDateString(range.start);
32038  if(range.count === 1)
32039   return startDateString;
32040  var endDateString = this.getDateString(ASPxClientCalendar.GetDateByOffset(range.start, range.count - 1, this.pickerType));
32041  return ASPx.Str.ApplyReplacement(rangeFormatString, [["{0}", startDateString], ["{1}", endDateString]]);
32042 },
32043 getDateString: function(date) {
32044  var dateStringArray = [ ];
32045  dateStringArray.push(ASPx.CultureInfo.dayNames[date.getDay()]);
32046  dateStringArray.push(ASPx.CultureInfo.monthNames[date.getMonth()]);
32047  dateStringArray.push(date.getDate());
32048  dateStringArray.push(date.getFullYear());
32049  return dateStringArray.join(' ');
32050 },
32051 getDateRanges: function(dates) {
32052  var ranges = [ ];
32053  var start = null;
32054  var end = null;
32055  for(var i = 0; i < dates.length; i++) {
32056   var d1 = dates[i];
32057   var d2 = i < dates.length ? dates[i + 1] : d1;
32058   if(!start)
32059    start = end = d1;
32060   if(this.isNeibourDates(d1, d2)) {
32061    end = d2;
32062   } else {
32063    ranges.push({ start: start, count: ASPxClientCalendar.GetPeriodsInRange(start, end, this.pickerType) });
32064    start = end = null;
32065   }
32066  }
32067  return ranges;
32068 },
32069 isNeibourDates: function(date1, date2) {
32070  var nextDate = ASPxClientCalendar.GetNextDate(date1, this.pickerType);
32071  return ASPxClientCalendar.AreDatesEqual(nextDate, date2);
32072 }
32073});
32074var ASPxClientCalendarCustomDisabledDateEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
32075 constructor: function(date) {
32076  this.constructor.prototype.constructor.call(this);
32077  this.date = date;
32078  this.isDisabled = false;
32079 }
32080});
32081ASPxClientCalendar.AnonymousHandlers = { 
32082 MainElementClick: function(name) {
32083  return function(e) {
32084   var cal = ASPx.GetControlCollection().Get(name);
32085   if(cal)
32086    cal.OnMainElementClick(e);
32087  };
32088 },
32089 SelectMonth: function(name, row, column) {
32090  return function() {
32091   var cal = ASPx.GetControlCollection().Get(name);
32092   if(cal)
32093    cal.OnSelectMonth(row, column);
32094  };
32095 },
32096 NavigationButtonClick: function(name, offset, isVisibleInAdaptiveOnly) {
32097  return function() {
32098   var cal = ASPx.GetControlCollection().Get(name);
32099   if(cal)
32100    cal.OnNavigationImageClick(offset, isVisibleInAdaptiveOnly);
32101  };
32102 },
32103 TitleClick: function(name, row, column) {
32104  return function() {
32105   var cal = ASPx.GetControlCollection().Get(name);
32106   if(cal)
32107    cal.OnTitleClick(row, column);
32108  };
32109 },
32110 DayMouseEvent: function(name, row, column, index, byWeeks) {
32111  return function(e) {
32112   var cal = ASPx.GetControlCollection().Get(name);
32113   if(!cal)
32114    return;
32115   var view = cal.GetActiveView(row, column);
32116   if(!view.isNavigationView && cal.GetReadOnly())
32117    return;
32118   var date = view.GetDateByIndex(index);
32119   if(byWeeks)
32120    date = ASPxClientCalendar.AddDays(date, cal.firstDayOfWeek - date.getDay());
32121   var allowed = ASPxClientCalendarDateDisabledHelper.IsDateInRange(cal.sharedParameters, date) && (view.IsDateVisible(date) || byWeeks);
32122   if(view.isNavigationView)
32123    allowed = view.IsDateVisible(date);
32124   switch(e.type) {
32125    case "mousedown":
32126     if(allowed && cal.CanMouseDown(e, date)) {
32127      var ctrl = e.ctrlKey || ASPx.Browser.MacOSPlatform && e.metaKey;
32128      cal.OnDayMouseDown(date, e.shiftKey, ctrl, byWeeks);
32129     }
32130     break;
32131    case "mouseover":
32132     if(allowed && cal.CanMouseOver(date)) {
32133      if(cal.forceMouseDown)
32134       cal.OnDayMouseDown(date, false, false, false);
32135      else if (cal.isMouseDown || cal.sharedParameters.dateRangeMode)
32136       cal.OnDayMouseOver(date);
32137     }
32138     break;
32139    case "mouseup":
32140     if(cal.isMouseDown && !view.isNavigationView) {
32141      if(allowed && !cal.IsDateDisabled(date))
32142       cal.OnDayMouseUp(date);
32143      else
32144       cal.OnSelectionCancelled();
32145     }
32146     break;
32147    case "mouseout":
32148     if(cal.sharedParameters.dateRangeMode && !view.isNavigationView) {
32149      var isAllowedOverDate = false;
32150      var overCell = ASPx.Evt.GetEventRelatedTarget(e, false);
32151      var overCellIndex = view.GetDayCellIndex(overCell);
32152      if (ASPx.IsExists(overCellIndex)) {
32153       var overDate = view.GetDateByIndex(overCellIndex);
32154       isAllowedOverDate = overDate && ASPxClientCalendarDateDisabledHelper.IsDateInRange(cal.sharedParameters, overDate) && view.IsDateVisible(overDate) && !cal.IsDateDisabled(overDate);
32155      }
32156      if (!isAllowedOverDate) {
32157       cal.RaiseVisibleDaysMouseOut();
32158      }
32159     }
32160     break;
32161   }     
32162  };
32163 },
32164 FastNavMonthClick: function(name, month) {
32165  return function() {
32166   var cal = ASPx.GetControlCollection().Get(name);
32167   if(cal) {
32168    cal.fastNavigation.OnMonthClick(month);
32169   }
32170  };
32171 },
32172 FastNavYearClick: function(name, index) {
32173  return function() {
32174   var cal = ASPx.GetControlCollection().Get(name);
32175   if(cal)
32176    cal.fastNavigation.OnYearClick(index);
32177  };
32178 }
32179};
32180ASPxClientCalendar.GetMinDate = function(date1, date2) {
32181 return date1 < date2 ? date1 : date2;
32182};
32183ASPxClientCalendar.GetMaxDate = function(date1, date2) {
32184 return date1 > date2 ? date1 : date2;
32185};
32186ASPxClientCalendar.AddSelectedRangeVisiblePartToSelection = function(selection, selectedRangeRestrictions, visibleRangeRestrictions) {
32187 selection.Add(selectedRangeRestrictions.start);
32188 selection.Add(selectedRangeRestrictions.end);
32189 var bothRangeRestrictsLessThanVisibleStartDate = selectedRangeRestrictions.start < visibleRangeRestrictions.start
32190  && selectedRangeRestrictions.end < visibleRangeRestrictions.start;
32191 var bothRangeRestrictsGreaterThanVisibleEndDate = selectedRangeRestrictions.start > visibleRangeRestrictions.end
32192  && selectedRangeRestrictions.end > visibleRangeRestrictions.end;
32193 var rangeHasVisiblePart = !bothRangeRestrictsLessThanVisibleStartDate && !bothRangeRestrictsGreaterThanVisibleEndDate;
32194 if(rangeHasVisiblePart) {
32195  var requiredSelectionStart = ASPxClientCalendar.GetMaxDate(selectedRangeRestrictions.start, visibleRangeRestrictions.start);
32196  var requiredSelectionEnd = ASPxClientCalendar.GetMinDate(selectedRangeRestrictions.end, visibleRangeRestrictions.end);
32197  selection.AddRange(requiredSelectionStart, requiredSelectionEnd);
32198 }
32199};
32200ASPxClientCalendar.AreDatesEqual = function(date1, date2) {
32201 if(date1 == date2)  
32202  return true;
32203 if(!date1 || !date2)
32204  return false;
32205 return date1.getFullYear() == date2.getFullYear() && date1.getMonth() == date2.getMonth() && date1.getDate() == date2.getDate();
32206};
32207ASPxClientCalendar.IsFirstDateEqualToAnyOther = function () {
32208 var actualDate = arguments[0];
32209 for (var i = 1; i < arguments.length; i++)
32210  if (ASPxClientCalendar.AreDatesEqual(actualDate, arguments[i]))
32211   return true;
32212 return false;
32213};
32214ASPxClientCalendar.AreDatesOfSameMonth = function(date1, date2) {
32215 if(!date1 || !date2)
32216  return false;
32217 return date1.getFullYear() == date2.getFullYear() && date1.getMonth() == date2.getMonth();
32218};
32219ASPxClientCalendar.AreDatesOfSameYear = function(date1, date2) {
32220 if(!date1 || !date2)
32221  return false;
32222 return date1.getFullYear() == date2.getFullYear();
32223};
32224ASPxClientCalendar.AreDatesOfSameDecade = function(date1, date2) {
32225 if(!date1 || !date2)
32226  return false;
32227 return ASPxClientCalendar.GetDecadeStartYear(date1.getFullYear()) == ASPxClientCalendar.GetDecadeStartYear(date2.getFullYear());
32228};
32229ASPxClientCalendar.AreDatesOfSameCentury = function(date1, date2) {
32230 if(!date1 || !date2)
32231  return false;
32232 return ASPxClientCalendar.GetCenturyStartYear(date1.getFullYear()) == ASPxClientCalendar.GetCenturyStartYear(date2.getFullYear());
32233};
32234ASPxClientCalendar.AreDatesOfSamePeriod = function(date1, date2, viewT
32234ype) {
32235 if(viewType == ASPx.DatePickerType.Days)
32236  return ASPxClientCalendar.AreDatesOfSameMonth(date1, date2);
32237 if(viewType == ASPx.DatePickerType.Months)
32238  return ASPxClientCalendar.AreDatesOfSameYear(date1, date2);
32239 if(viewType == ASPx.DatePickerType.Years)
32240  return ASPxClientCalendar.AreDatesOfSameDecade(date1, date2);
32241 if(viewType == ASPx.DatePickerType.Decades)
32242  return ASPxClientCalendar.AreDatesOfSameCentury(date1, date2);
32243};
32244ASPxClientCalendar.GetUTCTime = function(date) {
32245 return Date.UTC(date.getFullYear(), date.getMonth(), date.getDate());
32246};
32247ASPxClientCalendar.GetFirstDayOfYear = function(date) {
32248 return new Date(date.getFullYear(), 0, 1);  
32249};
32250ASPxClientCalendar.GetDayOfYear = function(date) {
32251 var ms = ASPxClientCalendar.GetUTCTime(date) - 
32252  ASPxClientCalendar.GetUTCTime(ASPxClientCalendar.GetFirstDayOfYear(date));
32253 return 1 + Math.floor(ms / ASPx.calendarMsPerDay);
32254};
32255ASPxClientCalendar.GetISO8601WeekOfYear = function(date) {
32256 var firstDate = new Date(date.getFullYear(), 0, 1);
32257 var firstDayOfWeek = firstDate.getDay();
32258 if(firstDayOfWeek == 0)
32259  firstDayOfWeek = 7;
32260 var daysInFirstWeek = 8 - firstDayOfWeek;
32261 var lastDate = new Date(date.getFullYear(), 11, 31);   
32262 var lastDayOfWeek = lastDate.getDay();
32263 if(lastDayOfWeek == 0)
32264  lastDayOfWeek = 7;
32265 var fullWeeks = Math.ceil((ASPxClientCalendar.GetDayOfYear(date) - daysInFirstWeek) / 7);
32266 var result = fullWeeks;   
32267 if(daysInFirstWeek > 3)
32268  result++;
32269 var isThursday = firstDayOfWeek == 4 || lastDayOfWeek == 4;
32270 if(result > 52 && !isThursday)
32271  result = 1;
32272 if(result == 0)
32273  return ASPxClientCalendar.GetISO8601WeekOfYear(new Date(date.getFullYear() - 1, 11, 31));
32274 return result;
32275};
32276ASPxClientCalendar.GetNextWeekDate = function(date) {
32277 var ret = new Date(date.getTime()); 
32278 var newDay = date.getDate() + 7;
32279 ret.setDate(newDay);
32280 return ret;
32281};
32282ASPxClientCalendar.GetPrevWeekDate = function(date) {
32283 var ret = new Date(date.getTime());
32284 var newDay = date.getDate() - 7;
32285 ret.setDate(newDay);
32286 return ret;
32287};
32288ASPxClientCalendar.GetYesterDate = function(date) {
32289 var ret = new Date(date.getTime());
32290 ret.setDate(ret.getDate() - 1);
32291 return ret;
32292};
32293ASPxClientCalendar.GetTomorrowDate = function(date) {
32294 var ret = new Date(date.getTime());
32295 ret.setDate(ret.getDate() + 1);
32296 return ret;
32297};
32298ASPxClientCalendar.GetNextMonthDate = function(date) {
32299 var ret = new Date(date.getTime());
32300 var maxDateInNextMonth = ASPxClientCalendar.GetDaysInMonth(ret.getMonth() + 1, ret.getFullYear());
32301 if(ret.getDate() > maxDateInNextMonth)
32302  ret.setDate(maxDateInNextMonth);
32303 ret.setMonth(ret.getMonth() + 1);
32304 return ret;
32305};
32306ASPxClientCalendar.GetNextYearDate = function(date) {
32307 return ASPxClientCalendar.GetDateWithYearOffset(date, 1);
32308};
32309ASPxClientCalendar.GetDateWithYearOffset = function(date, offset) {
32310 var ret = new Date(date.getTime());
32311 var maxDateInPrevYearMonth = ASPxClientCalendar.GetDaysInMonth(ret.getMonth(), ret.getFullYear() + offset);
32312 if(ret.getDate() > maxDateInPrevYearMonth)
32313  ret.setDate(maxDateInPrevYearMonth);
32314 ret.setFullYear(ret.getFullYear() + offset);
32315 return ret;
32316};
32317ASPxClientCalendar.GetPrevMonthDate = function(date) {
32318 var ret = new Date(date.getTime());
32319 var maxDateInPrevMonth = ASPxClientCalendar.GetDaysInMonth(ret.getMonth() - 1, ret.getFullYear());
32320 if(ret.getDate() > maxDateInPrevMonth)
32321  ret.setDate(maxDateInPrevMonth);
32322 ret.setMonth(ret.getMonth() - 1);
32323 return ret;
32324};
32325ASPxClientCalendar.GetPrevYearDate = function(date) {
32326 return ASPxClientCalendar.GetDateWithYearOffset(date, -1);
32327};
32328ASPxClientCalendar.GetFirstDayInMonthDate = function(date) {
32329 var ret = new Date(date.getTime());
32330 ret.setDate(1);
32331 return ret;
32332};
32333ASPxClientCalendar.GetLastDayInMonthDate = function(date) {
32334 var ret = new Date(date.getTime());
32335 var maxDateInYearMonth = ASPxClientCalendar.GetDaysInMonth(ret.getMonth(), ret.getFullYear());
32336 ret.setDate(maxDateInYearMonth);
32337 return ret;
32338};
32339ASPxClientCalendar.AddDays = function(startDate, dayCount) {
32340 var date = ASPxClientCalendar.CloneDate(startDate);
32341 var dayDiff = 0;
32342 var hourInc = 3600000;
32343 if(dayCount < 0)
32344  hourInc = -1 * hourInc;
32345 dayCount = Math.abs(dayCount);
32346 while(true) {
32347  if(dayDiff == dayCount && startDate.getHours() == date.getHours())
32348   return date;
32349  if(dayDiff > dayCount) {
32350   date.setTime(-1 * hourInc + date.getTime());
32351   return date;
32352  }
32353  var day = date.getDate();
32354  date.setTime(hourInc + date.getTime());
32355  if(day != date.getDate())
32356   dayDiff++;
32357 }
32358 return date;
32359};
32360ASPxClientCalendar.AddMonths = function(date, count) {
32361 var newDate = ASPxClientCalendar.CloneDate(date);
32362 newDate.setMonth(count + newDate.getMonth());
32363 ASPx.DateUtils.FixTimezoneGap(date, newDate);
32364 if(newDate.getDate() < date.getDate())
32365  newDate = ASPxClientCalendar.AddDays(newDate, -newDate.getDate()); 
32366 return newDate;
32367};
32368ASPxClientCalendar.AddYears = function(date, count) {
32369 var newDate = ASPxClientCalendar.CloneDate(date);
32370 newDate.setFullYear(count + newDate.getFullYear());
32371 ASPx.DateUtils.FixTimezoneGap(date, newDate);
32372 return newDate;
32373};
32374ASPxClientCalendar.GetNextDate = function(date, viewType) {
32375 return ASPxClientCalendar.GetDateByOffset(date, 1, viewType);
32376};
32377ASPxClientCalendar.GetDateByOffset = function(date, offset, viewType) {
32378 if(viewType == ASPx.DatePickerType.Days)
32379  return ASPxClientCalendar.AddDays(date, offset);
32380 if(viewType == ASPx.DatePickerType.Months)
32381  return ASPxClientCalendar.AddMonths(date, offset);
32382 if(viewType == ASPx.DatePickerType.Years)
32383  return ASPxClientCalendar.AddYears(date, offset);
32384 if(viewType == ASPx.DatePickerType.Decades)
32385  return ASPxClientCalendar.AddYears(date, offset * 10);
32386};
32387ASPxClientCalendar.CloneDate = function(date) {
32388 var cloned = new Date();
32389 cloned.setTime(date.getTime());
32390 return cloned;
32391};
32392ASPxClientCalendar.GetDecadeStartYear = function(year) {
32393 return ASPx.DateUtils.GetDecadeStartYear(year);
32394};
32395ASPxClientCalendar.GetCenturyStartYear = function(year) {
32396 return ASPx.DateUtils.GetCenturyStartYear(year);
32397};
32398ASPxClientCalendar.GetDaysInRange = function(start, end) {
32399 return 1 + (ASPxClientCalendar.GetUTCTime(end) - ASPxClientCalendar.GetUTCTime(start)) / ASPx.calendarMsPerDay;
32400};
32401ASPxClientCalendar.GetDaysInMonth = function(month, year) {
32402 var d = new Date(year, month + 1, 0);
32403 return d.getDate();
32404};
32405ASPxClientCalendar.GetOffsetInMonths = function(start, end) {
32406 return end.getMonth() - start.getMonth() + 12 * (end.getFullYear() - start.getFullYear());
32407};
32408ASPxClientCalendar.GetOffsetInYears = function(start, end) {
32409 return end.getFullYear() - start.getFullYear();
32410};
32411ASPxClientCalendar.GetOffsetInDecades = function(start, end) {
32412 return (ASPxClientCalendar.GetDecadeStartYear(end.getFullYear()) - ASPxClientCalendar.GetDecadeStartYear(start.getFullYear())) / 10;
32413};
32414ASPxClientCalendar.GetOffsetInCenturies = function(start, end) {
32415 return (ASPxClientCalendar.GetCenturyStartYear(end.getFullYear()) - ASPxClientCalendar.GetCenturyStartYear(start.getFullYear())) / 100;
32416};
32417ASPxClientCalendar.GetOffsetInPeriods = function(start, end, viewType) {
32418 if(viewType == ASPx.DatePickerType.Days)
32419  return ASPxClientCalendar.GetOffsetInMonths(start, end);
32420 if(viewType == ASPx.DatePickerType.Months)
32421  return ASPxClientCalendar.GetOffsetInYears(start, end);
32422 if(viewType == ASPx.DatePickerType.Years)
32423  return ASPxClientCalendar.GetOffsetInDecades(start, end);
32424 if(viewType == ASPx.DatePickerType.Decades)
32425  return ASPxClientCalendar.GetOffsetInCenturies(start, end);
32426};
32427ASPxClientCalendar.GetPeriodsInRange = function(start, end, pickerType) {
32428 if(pickerType == ASPx.DatePickerType.Days)
32429  return ASPxClientCalendar.GetDaysInRange(start, end);
32430 if(pickerType == ASPx.DatePickerType.Months)
32431  return ASPxClientCalendar.GetOffsetInMonths(start, end) + 1;
32432 if(pickerType == ASPx.DatePickerType.Years)
32433  return ASPxClientCalendar.GetOffsetInYears(start, end) + 1;
32434 if(pickerType == ASPx.DatePickerType.Decades)
32435  return ASPxClientCalendar.GetOffsetInDecades(start, end) + 1;
32436};
32437ASPxClientCalendar.GetCorrectedDate = function(date, viewType) {
32438 return ASPx.DateUtils.CorrectDateByPickerType(date, viewType);
32439};
32440var ASPxClientCalendarDateDisabledHelper = {
32441 MinDate: new Date(100, 0, 1, 0, 0, 0, 0),
32442 MaxDate: new Date(9999, 11, 31, 23, 59, 59, 999),
32443 GetUpperLimitDate: function() {
32444  return this.MaxDate;
32445 },
32446 GetLowerLimitDate: function() {
32447  return this.MinDate;
32448 },
32449 IsDateWithinBoundaries: function(date) {
32450  return date >= this.GetLowerLimitDate() && date <= this.GetUpperLimitDate();
32451 },
32452 GetCorrectedDate: function(date) {
32453  if(!date)
32454   return null;
32455  if(this.IsDateWithinBoundaries(date))
32456   return date;
32457  else
32458   return date > this.GetUpperLimitDate() ? this.GetUpperLimitDate() : this.GetLowerLimitDate();
32459 },
32460 IsDateInRange: function(sharedParameters, date) {
32461  return date == null ||
32462   ((sharedParameters.minDate == null || this.IsDateFitToMinDate(sharedParameters, date)) &&
32463    (sharedParameters.maxDate == null || this.IsDateFitToMaxDate(sharedParameters, date)) &&
32464    this.IsDateWithinBoundaries(date));
32465 },
32466 IsDateFitToMinDate: function(sharedParameters, date) {
32467  var minDate = sharedParameters.minDate;
32468  return date >= new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate());
32469 },
32470 IsDateFitToMaxDate: function(sharedParameters, date) {
32471  var maxDate = sharedParameters.maxDate;
32472  return date <= new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate(), 23, 59, 59, 999);
32473 },
32474 IsDateDisabled: function(sharedParameters, date, OnCustomDisabledDate, viewType, pickerType) {
32475  if(viewType !== pickerType)
32476   return false;
32477  if(date != null) {
32478   var length = sharedParameters.disabledDates.length;
32479   var correctedDate = ASPxClientCalendar.CloneDate(date);
32480   if(length > 0 && date != null) {
32481    correctedDate = ASPxClientCalendar.GetCorrectedDate(date, pickerType);
32482    for(var i = 0; i < length; i++) {
32483     var disabledDate = sharedParameters.disabledDates[i];
32484     if(disabledDate.getDate() == correctedDate.getDate() &&
32485      disabledDate.getMonth() == correctedDate.getMonth() &&
32486      disabledDate.getFullYear() == correctedDate.getFullYear())
32487      return true;
32488    }
32489   }
32490   if(OnCustomDisabledDate(correctedDate).isDisabled)
32491    return true;
32492  }
32493  return false;
32494 }
32495};
32496var ASPxClientCalendarSelection = ASPx.CreateClass(null, {
32497 constructor: function() {
32498  this.dates = { };
32499  this.count = 0;
32500  this.pickerType = ASPx.DatePickerType.Days;
32501 },
32502 SetPickerType: function(pickerType) {
32503  this.pickerType = pickerType;
32504 },
32505 Assign: function(source) {
32506  this.Clear();
32507  for(var key in source.dates) {
32508   if(source.dates.hasOwnProperty(key)) {
32509    var item = source.dates[key];
32510    if(item.constructor != Date) continue;
32511    this.Add(item);
32512   }
32513  }
32514 },
32515 Clear: function() {
32516  if(this.count > 0) {
32517   this.dates = { };
32518   this.count = 0;
32519  }
32520 },
32521 Equals: function(selection) {
32522  if(this.count != selection.count)
32523   return false;
32524  for(var key in this.dates) {
32525   if(this.dates.hasOwnProperty(key)) {
32526    if(this.dates[key].constructor != Date) continue;
32527    if(!selection.ContainsKey(key))
32528     return false;
32529   }
32530  }
32531  return true;
32532 },
32533 Contains: function(date) {
32534  var key = this.GetKey(this.GetCorrectedDate(date));
32535  return this.ContainsKey(key);
32536 },
32537 ContainsKey: function(key) {
32538  return !!this.dates[key];
32539 },
32540 GetCorrectedDate: function(date) {
32541  return ASPxClientCalendar.GetCorrectedDate(date, this.pickerType);
32542 },
32543 GetCorrectedYear: function(date) {
32544  var year = date.getFullYear();
32545  return this.pickerType != ASPx.DatePickerType.Decades ? year : ASPxClientCalendar.GetDecadeStartYear(year);
32546 },
32547 GetCorrectedMonth: function(date) {
32548  return this.pickerType < ASPx.DatePickerType.Years ? date.getMonth() : 0;
32549 },
32550 GetCorrectedDay: function(date) {
32551  return this.pickerType == ASPx.DatePickerType.Days ? date.getDate() : 1;
32552 },
32553 Add: function(date) {
32554  var correctedDate = this.GetCorrectedDate(date);
32555  var key = this.GetKey(correctedDate);
32556  if(!this.ContainsKey(key)) {
32557   this.dates[key] = ASPxClientCalendar.CloneDate(correctedDate);
32558   this.count++;
32559  }
32560 },
32561 AddArray: function(dates) {
32562  for(var i = 0; i < dates.length; i++)
32563   this.Add(dates[i]);
32564 },
32565 AddRange: function(start, end) {
32566  var correctedStart = this.GetCorrectedDate(start);
32567  var correctedEnd = this.GetCorrectedDate(end);
32568  if(correctedEnd < correctedStart) {
32569   this.AddRange(correctedEnd, correctedStart);
32570   return;
32571  }
32572  var date = ASPxClientCalendar.CloneDate(correctedStart);
32573  while(date <= correctedEnd) {
32574   this.Add(date);
32575   date = ASPxClientCalendar.GetNextDate(date, this.pickerType);
32576  }
32577 },
32578 AddWeek: function(startDate) {
32579  this.AddRange(startDate, ASPxClientCalendar.AddDays(startDate, 6));
32580 },
32581 SetRestrictions: function(start, end) {
32582  this.startDate = this.GetCorrectedDate(ASPxClientCalendar.CloneDate(start));
32583  this.endDate = this.GetCorrectedDate(ASPxClientCalendar.CloneDate(end));
32584 },
32585 ResetRestrictions: function() {
32586  this.startDate = null;
32587  this.endDate = null;
32588 },
32589 Remove: function(date) {
32590  var correctedDate = this.GetCorrectedDate(date);
32591  var key = this.GetKey(correctedDate);
32592  if(this.ContainsKey(key)) {
32593   delete this.dates[key];
32594   this.count--;
32595  }
32596 },
32597 RemoveArray: function(dates) {
32598  for(var i = 0; i < dates.length; i++)
32599   this.Remove(dates[i]);
32600 },
32601 RemoveRange: function(start, end) {
32602  var correctedStart = this.GetCorrectedDate(start);
32603  var correctedEnd = this.GetCorrectedDate(end);
32604  if(correctedEnd < correctedStart) {
32605   this.RemoveRange(correctedEnd, correctedStart);
32606   return;
32607  }
32608  var date = ASPxClientCalendar.CloneDate(correctedStart);
32609  while(date <= correctedEnd) {
32610   this.Remove(date);
32611   date = ASPxClientCalendar.GetNextDate(date, this.pickerType);
32612  }
32613 },
32614 RemoveWeek: function(startDate) {
32615  this.RemoveRange(startDate, ASPxClientCalendar.AddDays(startDate, 6));
32616 },
32617 GetDates: function() {
32618  var result = [ ];
32619  for(var key in this.dates) {
32620   if(this.dates.hasOwnProperty(key)) {
32621    var item = this.dates[key];
32622    if(item.constructor != Date) continue;
32623    result.push(ASPxClientCalendar.CloneDate(item));
32624   }
32625  }
32626  return result;  
32627 },
32628 GetFirstDate: function() {
32629  if(this.count == 0)
32630   return null;
32631  for(var key in this.dates) {
32632   if(this.dates.hasOwnProperty(key)) {
32633    var item = this.dates[key];
32634    if(item.constructor != Date) continue;
32635    return ASPxClientCalendar.CloneDate(item);
32636   }
32637  }
32638  return null;
32639 },
32640 GetKey: function(date) {  
32641  return ASPx.DateUtils.GetInvariantDateString(date);
32642 }
32643});
32644var ASPxClientCalendarSelectionTransaction = ASPx.CreateClass(null, {
32645 constructor: function(calendar) {
32646  this.calendar = calendar;
32647  this.isActive = false;
32648  this.backup = new ASPxClientCalendarSelection();
32649  this.selection = new ASPxClientCalendarSelection();
32650  this.backup.SetPickerType(calendar.pickerType);
32651  this.selection.SetPickerType(calendar.pickerType);
32652 },
32653 Start: function() {
32654  if(this.isActive)
32655   this.Rollback();
32656  this.backup.Assign(this.calendar.selection);
32657  this.selection.Clear();
32658  this.isActive = true;
32659  ASPx.activeCalendar = this.calendar;
32660 },
32661 Commit: function() {  
32662  this.calendar.ApplySelectionByDiff(this.selection, true);
32663  this.Reset();
32664 },
32665 Rollback: function() {
32666  this.calendar.ApplySelectionByDiff(this.backup);  
32667  this.Reset();
32668 },
32669 Reset: function() {
32670  this.backup.Clear();
32671  this.selection.Clear();
32672  this.isActive = false;
32673  ASPx.activeCalendar = null;
32674 },
32675 CopyFromBackup: function() {
32676  this.selection.Assign(this.backup);
32677 },
32678 IsChanged: function() {
32679  return !this.backup.Equals(this.selection);
32680 }
32681});
32682var ASPxClientCalendarView = ASPx.CreateClass(null, {
32683 constructor: function(calendar, row, column) {
32684  this.row = row;
32685  this.column = column;
32686  this.calendar = calendar;
32687  this.isASPxClientCalendarView = true;
32688  var temp = column + row;
32689  this.isLowBoundary = temp == 0;
32690  this.isHighBoundary = temp == calendar.rows + calendar.columns - 2;
32691  this.isLastViewInFirstRow = row == 0 && column == calendar.columns - 1;
32692  this.visibleDate = null;
32693  this.startDate = null;
32694  this.dayFunctions = {};
32695  this.dayStyleCache = {};
32696  this.dayCellCache = {};
32697  this.navButtonFunctions = {};
32698  this.titleFunction = null;
32699  this.isNavigationView = this.GetViewType() > this.calendar.pickerType;
32700  this.isFirstNavigationView = this.GetViewType() === ASPx.DatePickerType.Months;
32701  this.isLastNavigationView = this.GetViewType() === this.calendar.maxViewType;
32702 },
32703 Initialize: function() {
32704  if(!this.isNavigationView || this.isFirstNavigationView) {
32705   this.UpdateDate();
32706   this.AddHoverStateItems();
32707   if(!this.isNavigationView) {
32708    this.UpdateTitle();
32709    this.EnsureSelection();
32710    this.MakeDisabledStateItems();
32711   }
32712  }
32713 },
32714 GetDateFunctionsHash: function(selectWeeks) {
32715  return this.dayFunctions;
32716 },
32717 GetViewCell: function() {
32718  return this.calendar.GetViewCell(this.calendar.IsMultiView() ? this.GetIDPostfix() : "");
32719 },
32720 GetIndex: function() {
32721  return this.row * this.calendar.columns + this.column;
32722 },
32723 GetTitleCell: function() {
32724  return this.GetChildElement("TC");
32725 },
32726 GetTitleElement: function() {
32727  return this.GetChildElement("T") || this.GetTitleCell();
32728 },
32729 EnsureVisible: function(visible) {
32730  if(this.calendar.switchToSingleMonthAtWindowInnerWidth <= 0) return;
32731  var cell = this.GetViewCell();
32732  ASPx.ToggleClassNameToElement(cell, "view-visible", visible);
32733 },
32734 AttachCancelSelect: function(method, element) {
32735  method(element, "mouseup", aspxCalCancelSelect);
32736 },
32737 IsValidIndex: function(index) {
32738  return index >= 0 && index <= this.GetMaxIndex();
32739 },
32740 GetIDPostfix: function() {
32741  return "_" + this.row.toString() + "x" + this.column.toString();
32742 },
32743 GetChildElement: function(postfix) {
32744  if(this.calendar.IsMultiView())
32745   postfix += this.GetIDPostfix();
32746  return this.calendar.GetChildElement(postfix);
32747 },
32748 AttachDayMouseEvents: function(method, cell, handler) {
32749  var types = ["down", "up", "over", "out"];
32750  for(var i = 0; i < types.length; i++)
32751   method(cell, "mouse" + types[i], handler);
32752 },
32753 GetDayMouseEventFunction: function(index, selectWeeks) {
32754  var hash = this.GetDateFunctionsHash(selectWeeks);
32755  if(!hash[index])
32756   hash[index] = ASPxClientCalendar.AnonymousHandlers.DayMouseEvent(this.calendar.name, this.row, this.column, index, selectWeeks);
32757  return hash[index];
32758 },
32759 GetNavButtonFunction: function(buttonID, offset, isVisibleInAdaptiveOnly) {
32760  if(!this.navButtonFunctions[buttonID])
32761   this.navButtonFunctions[buttonID] = ASPxClientCalendar.AnonymousHandlers.NavigationButtonClick(this.calendar.name, offset, isVisibleInAdaptiveOnly);
32762  return this.navButtonFunctions[buttonID];
32763 },
32764 GetTitleFunction: function() {
32765  if(!this.titleFunction)
32766   this.titleFunction = ASPxClientCalendar.AnonymousHandlers.TitleClick(this.calendar.name, this.row, this.column);
32767  return this.titleFunction;
32768 },
32769 UpdateDate: function() {
32770  this.visibleDate = this.GetCurrentVisibleDate();
32771  var date = ASPxClientCalendar.CloneDate(this.visibleDate);
32772  date.setDate(1);
32773  this.UpdateNavigationCells(date);
32774  this.startDate = this.GetCurrentStartDate(date);
32775 },
32776 UpdateTitle: function() {
32777  var el = this.GetTitleElement();
32778  if(!el) return;
32779  el.innerHTML = this.GetTitleText();
32780  el.style.cursor = this.isLastNavigationView && !this.calendar.showFastPopup ? "default" : ASPx.GetPointerCursor();
32781 },
32782 GetActualTodayDate: function() {
32783  if(!this.calendar || !this.calendar.actualTodayDate)
32784   return ASPxClientCalendar.GetCorrectedDate(new Date(), this.GetViewType());
32785  return this.calendar.actualTodayDate;
32786 },
32787 IsDateVisible: function(date) {
32788  var result = !this.calendar.IsMultiView() || !this.IsDateOtherPeriod(date);
32789  if(!result) {
32790   result = result || this.isLowBoundary && date <= this.visibleDate ||
32791    this.isHighBoundary && date >= this.visibleDate;
32792  }
32793  return result;
32794 },
32795 GetDayCell: function(index) {
32796  if(ASPx.IsExistsElement(this.dayCellCache[index]))
32797   return this.dayCellCache[index];
32798  var dateContainer = this.GetDateCellContainer();
32799  var colIndex = this.GetDateCellColIndex(index);
32800  var rowIndex = this.GetDateCellRowIndex(index);
32801  var cell = dateContainer.rows[rowIndex].cells[colIndex];
32802  this.dayCellCache[index] = cell;
32803  return cell;
32804 },
32805 GetDayCellIndex: function(cell) {
32806  var currentDate = ASPxClientCalendar.CloneDate(this.startDate);
32807  var maxIndex = this.GetMaxIndex();
32808  var currentIndex = 0;
32809  do {
32810   currentIndex = this.GetIndexByDate(currentDate);
32811   if(this.GetDayCell(currentIndex) === cell)
32812    return currentIndex;
32813   currentDate = this.GetNextDate(currentDate);
32814  }
32815  while(currentIndex < maxIndex);
32816  return null;
32817 },
32818 ChangeTitleElementEnabledAttributes: function(element, method) {
32819  method(element, "cursor");
32820 },
32821 RemoveDayCellStyle: function(cell, suffix) {
32822  var info = new ASPxClientCalendarStyleInfo();
32823  this.calendar.ImportEtalonStyle(info, suffix);
32824  info.Remove(cell);
32825 },
32826 ApplySelectionToCell: function(index, showSelection, applyDateInRangeStyle) {
32827  var cell = this.GetDayCell(index);
32828  var info;
32829  if(showSelection) {
32830   if(this.GetStateController())
32831    this.GetStateController().DoClearHoverState(cell);
32832   if(!this.dayStyleCache[index]) {
32833    var backup = new ASPxClientCalendarStyleInfo();
32834    backup.Import(cell);
32835    this.dayStyleCache[index] = backup;
32836    info = backup.Clone();
32837   } else
32838    info = this.dayStyleCache[index].Clone();
32839   if(!applyDateInRangeStyle || this.calendar.NeedApplySelectionToDayInRange())
32840    this.calendar.ImportEtalonStyle(info, this.GetCellSelectedStyleName());
32841  } else
32842   info = this.dayStyleCache[index];
32843  info.Apply(cell);
32844  if(applyDateInRangeStyle) {
32845   if(showSelection)
32846    ASPx.AddClassNameToElement(cell, this.calendar.GetDayInRangeClassName());
32847   else
32848    ASPx.RemoveClassNameFromElement(cell, this.calendar.GetDayInRangeClassName());
32849  }
32850 },
32851 UpdateSelection: function(dates, showSelection, totalSelectionEdges) {
32852  if(ASPx.Ident.IsArray(dates))
32853   for(var i = 0; i < dates.length; i++)
32854    this.UpdateDateSelection(dates[i], showSelection, totalSelectionEdges);
32855  else
32856   this.UpdateDateSelection(dates, showSelection, totalSelectionEdges);
32857 },
32858 UpdateDateSelection: function(date, showSelection, totalSelectionEdges) {
32859  var index = this.GetIndexByDate(date);
32860  if(!this.IsValidIndex(index) || !this.IsDateVisible(date))
32861   return;
32862  var applyDateInRangeStyle = totalSelectionEdges
32863   && !ASPxClientCalendar.IsFirstDateEqualToAnyOther(date, totalSelectionEdges.start, totalSelectionEdges.end);
32864  this.ApplySelectionToCell(index, showSelection, applyDateInRangeStyle);
32865 },
32866 EnsureSelection: function() {
32867  var selection = this.calendar.selection;
32868  var selectedRangeRestrictions = null;
32869  if(!this.isNavigationView) {
32870   selectedRangeRestrictions = this.calendar.sharedParameters.dateRangeMode ? ASPx.Data.ArrayGetIntegerEdgeValues(selection.GetDates()) : null;
32871   if(this.calendar.NeedCalculateSelectionOnUpdating()) {
32872    selectedRangeRestrictions.start = ASPxClientCalendar.CloneDate(selection.startDate);
32873    selectedRangeRestrictions.end = ASPxClientCalendar.CloneDate(selection.endDate);
32874    var visibleRangeRestrictions = this.GetVisibleRangeRestrictions();
32875    ASPxClientCalendar.AddSelectedRangeVisiblePartToSelection(selection, selectedRangeRestrictions, visibleRangeRestrictions);
32876   }
32877  }
32878  var selectedDates = !this.isNavigationView ? selection.GetDates() : this.calendar.selectedNavigationDates[this.GetViewType()];
32879  this.UpdateSelection(selectedDates, true, selectedRangeRestrictions);
32880 },
32881 Update: function() {
32882  this.dayStyleCache = {};
32883  this.UpdateDate();
32884  this.UpdateDateCellHtml();
32885  this.UpdateTitle();
32886  this.EnsureSelection();
32887 },
32888 GetVisibleRangeRestrictions: function() {
32889  return {
32890   start: this.GetDateByIndex(0),
32891   end: this.GetDateByIndex(this.GetMaxIndex())
32892  };
32893 },
32894 GetMaxVisibleDate: function() {
32895  return this.GetVisibleRangeRestrictions().end;
32896 },
32897 ChangeButtonEnabledAttributes: function(element, method) {
32898  method(element, "onclick");
32899  method(element, "ondblclick");
32900 },
32901 AddHeaderDisabledStateItem: function(element) {
32902  var cell = this.calendar.GetEtalonStyleCell("DD");
32903  if(cell)
32904   ASPx.GetStateController().AddDisabledItem(element.id, cell.className, cell.style.cssText, null, null, null);
32905 },
32906 ApplyDayCellStyle: function(cell, date) {
32907  cell.style.cursor = "";
32908  var cal = this.calendar;
32909  var info = new ASPxClientCalendarStyleInfo();
32910  var needPointer = false;
32911  var readOnly = cal.GetReadOnly();
32912  cal.ImportEtalonStyle(info, this.GetCellStyleName());
32913  var isDateDisabled = false;
32914  if(this.IsDateVisible(date)) {
32915   var isCurrentMonthDate = !this.IsDateOtherPeriod(date);
32916   if(cal.IsDateWeekend(date) && cal.CanApplyDayCellStyle("DW", isCurrentMonthDate) && this.SupportsWeekendStyle())
32917    cal.ImportEtalonStyle(info, "DW");
32918   if(!isCurrentMonthDate)
32919    cal.ImportEtalonStyle(info, this.GetCellOtherPeriodStyleName());
32920   if(!ASPxClientCalendarDateDisabledHelper.IsDateInRange(cal.sharedParameters, date)
32921    && cal.CanApplyDayCellStyle(this.GetCellOutOfRangeStyleName(), isCurrentMonthDate) && !this.isNavigationView)
32922    cal.ImportEtalonStyle(info, this.GetCellOutOfRangeStyleName());
32923   if(cal.IsDateDisabled(date) && cal.CanApplyDayCellStyle(this.GetCellDisabledStyleName(), isCurrentMonthDate) && !this.isNavigationView) {
32924    cal.ImportEtalonStyle(info, this.GetCellDisabledStyleName());
32925    isDateDisabled = true;
32926   }
32927   if(ASPxClientCalendar.AreDatesEqual(this.GetActualTodayDate(), date) && cal.CanApplyDayCellStyle("DT", isCurrentMonthDate) && !this.isNavigationView)
32928    cal.ImportEtalonStyle(info, "DT");
32929   if(!cal.clientEnabled && cal.CanApplyDayCellStyle("DD", isCurrentMonthDate) && !this.isNavigationView)
32930    cal.ImportEtalonStyle(info, "DD");
32931   else if(!cal.enableMulti && !isDateDisabled && !readOnly || this.isNavigationView)
32932    needPointer = true;
32933  } else
32934   info.AddClassName(emptyDateCellClassName);
32935  info.Apply(cell);
32936  if(needPointer && cal.needToSetCursor)
32937   ASPx.SetPointerCursor(cell);
32938 },
32939 EnsureTodayStyle: function() {
32940  var serverCurrentDateIndex = this.GetIndexByDate(this.calendar.serverCurrentDate);
32941  var clientCurrentDateIndex = this.GetIndexByDate(new Date());
32942  if(this.IsValidIndex(serverCurrentDateIndex))
32943   this.RemoveDayCellStyle(this.GetDayCell(serverCurrentDateIndex), "DT");
32944  if(this.IsValidIndex(clientCurrentDateIndex))
32945   this.ApplyDayCellStyle(this.GetDayCell(clientCurrentDateIndex), new Date());
32946  this.dayStyleCache[serverCurrentDateIndex] = null;
32947  this.dayStyleCache[clientCurrentDateIndex] = null;
32948  this.EnsureSelection();
32949 },
32950 GetHeaderCellElements: function() {
32951  var result = [
32952   this.GetTitleCell(),
32953   this.GetTitleElement()
32954  ];
32955  var navigationCells = this.GetNavigationCells();
32956  for(var i = 0; i < navigationCells.length; i++)
32957   if(navigationCells[i])
32958    result.push(navigationCells[i]);
32959  return result;
32960 },
32961 SetHeaderCellsEnabled: function(enabled) {
32962  var headerCellElements = this.GetHeaderCellElements();
32963  for(var i = 0; i < headerCellElements.length; i++)
32964   if(headerCellElements[i])
32965    ASPx.GetStateController().SetElementEnabled(headerCellElements[i], enabled);
32966 },
32967 MakeDisabledStateItems: function() {
32968  if(this.isNavigationView)
32969   return;
32970  var element = this.GetTitleCell();
32971  if(element)
32972   this.AddHeaderDisabledStateItem(element);
32973  var element = this.GetTitleElement();
32974  if(element)
32975   this.AddHeaderDisabledStateItem(element);
32976 },
32977 ChangeEnabledStateItems: function(enabled) {
32978  this.SetHeaderCellsEnabled(enabled);
32979  if(enabled)
32980   this.AddHoverStateItems();
32981  else
32982   this.RemoveHoverStateItems();
32983 },
32984 ChangeEnabledAttributes: function(enabled) {
32985  var element = this.GetTitleElement();
32986  if(element)
32987   this.ChangeTitleElementEnabledAttributes(element, ASPx.Attr.ChangeStyleAttributesMethod(enabled));
32988 },
32989 ChangeEditableAttributesOnChangeEnabledState: function(enabled) {
32990  if(!this.calendar.enabled)
32991   return;
32992  var eventMethod = ASPx.Attr.ChangeEventsMethod(enabled);
32993  if(!this.isNavigationView)
32994   this.AttachTitleMouseEvents(eventMethod);
32995  if(!this.isNavigationView || this.isFirstNavigationView) {
32996   this.AttachNavigationMouseEvents(eventMethod);
32997   if(this.AllowAttachDetachDateEventsOnChangeEnabled())
32998    this.AttachDateMouseEvents(eventMethod, ASPx.Attr.InitiallyChangeStyleAttributesMethod(enabled));
32999  }
33000 },
33001 ChangeEditableAttributesOnChangeReadOnlyState: function(readOnly) {
33002  if(!this.calendar.enabled)
33003   return;
33004  if(this.AllowAttachDetachDateEventsOnChangeReadOnly()) {
33005   var eventMethod = ASPx.Attr.ChangeEventsMethod(!readOnly);
33006   this.AttachDateMouseEvents(eventMethod, ASPx.Attr.InitiallyChangeStyleAttributesMethod(!readOnly));
33007  }
33008 },
33009 GetNextDate: function(date) {
33010  return ASPxClientCalendar.GetNextDate(date, this.GetViewType());
33011 },
33012 AttachTitleMouseEvents: function(eventMethod) {
33013  var title = this.GetTitleElement();
33014  if(title)
33015   eventMethod(title, "click", this.GetTitleFunction());
33016 },
33017 AttachNavigationMouseEvents: function(eventMethod) {
33018  var navigationCells = this.GetNavigationCells();
33019  for(var i = 0; i < navigationCells.length; i++)
33020   if(this.NeedToAttachNavigationEvent(navigationCells[i])) {
33021    var navigationCellImage = this.GetNavigationCellImage(navigationCells[i]);
33022    var offset = this.GetNavigationCellOffset(navigationCells[i]);
33023    var isVisibleInAdaptiveOnly = this.IsVisibleInAdaptiveModeNavigationCell(navigationCells[i]);
33024    this.AttachNavigationImageEvent(navigationCellImage || navigationCells[i], eventMethod, offset, isVisibleInAdaptiveOnly);
33025   }
33026 },
33027 NeedToAttachNavigationEvent: function(navigationCell) {
33028  if(!ASPx.IsExists(navigationCell))
33029   return false;
33030  return this.IsDefaultVisibleNavigationCell(navigationCell) || this.IsVisibleInAdaptiveModeNavigationCell(navigationCell);
33031 },
33032 IsDefaultVisibleNavigationCell: function(navigationCell) {
33033  return this.IsPrevNavCell(navigationCell) && this.isLowBoundary
33034   || this.IsNextNavCell(navigationCell) && this.isLastViewInFirstRow;
33035 },
33036 IsVisibleInAdaptiveModeNavigationCell: function(navigationCell) {
33037  return this.calendar.IsMultiView()
33038   && (this.IsNextNavCell(navigationCell) && this.isLowBoundary && !this.isLastViewInFirstRow
33039   || this.IsPrevNavCell(navigationCell) && this.isLastViewInFirstRow && !this.isLowBoundary);
33040 },
33041 GetNavigationCellImage: function(navigationCell) {
33042  return ASPx.GetChildByTagName(navigationCell, "IMG");
33043 },
33044 AttachNavigationImageEvent: function(navigationCellImage, eventMethod, offset, isVisibleInAdaptiveOnly) {
33045  eventMethod(navigationCellImage, "click", this.GetNavButtonFunction(navigationCellImage.id, offset, isVisibleInAdaptiveOnly));
33046 },
33047 GetDateCells: function() {
33048  if(!this.dateCells)
33049   this.dateCells = this.GetMainElement().querySelectorAll(this.GetDateCellSelector());
33050  return this.dateCells;
33051 },
33052 GetStateController: function() {
33053  return typeof (ASPx.GetStateController) != "undefined" ? ASPx.GetStateController() : null;
33054 },
33055 AddHoverStateItems: function() {
33056  var stateController = this.GetStateController();
33057  if(!stateController)
33058   return;
33059  var hoverStyleInfo = new ASPxClientCalendarStyleInfo();
33060  this.calendar.ImportEtalonStyle(hoverStyleInfo, this.GetCellHoverStyleName());
33061  var dateCells = this.GetDateCells();
33062  for(var i = 0; i < dateCells.length; i++) {
33063   var cell = dateCells[i];
33064   if(!cell.id)
33065    cell.id = this.GetDateCellID(i);
33066   stateController.ClearCache(cell, ASPx.HoverItemKind);
33067   stateController.AddHoverItem(cell.id, [hoverStyleInfo.className], [hoverStyleInfo.cssText], null, null, null);
33068  }
33069 },
33070 RemoveHoverStateItems: function() {
33071  var stateController = this.GetStateController();
33072  if(!stateController)
33073   return;
33074  var dateCells = this.GetDateCells();
33075  for(var i = 0; i < dateCells.length; i++) {
33076   var cell = dateCells[i];
33077   if(!cell.id)
33078    cell.id = this.GetDateCellID(i);
33079   stateController.RemoveHoverItem(cell.id);
33080   stateController.ClearCache(cell, ASPx.HoverItemKind);
33081  }
33082 },
33083 GetDateCellID: function(cellIndex) { return this.GetMainElement().id + "_" + cellIndex; },
33084 GetNavigationCells: function() { throw "Not Implemented"; },
33085 GetNavigationCellOffset: function(navigationCell) { throw "Not Implemented"; },
33086 GetTitleText: function() { throw "Not Implemented"; },
33087 IsDateOtherPeriod: function(date) { throw "Not Implemented"; },
33088 GetCurrentVisibleDate: function() { throw "Not Implemented"; },
33089 GetCurrentStartDate: function() { throw "Not Implemented"; },
33090 UpdateNavigationCells: function(date) { throw "Not Implemented"; },
33091 GetDateByIndex: function(index) { throw "Not Implemented"; },
33092 GetIndexByDate: function(date) { throw "Not Implemented"; },
33093 GetDateCellContainer: function() { throw "Not Implemented"; },
33094 GetMainElement: function() { throw "Not Implemented"; },
33095 GetAnimatedElement: function() { throw "Not Implemented"; },
33096 GetDateCellColIndex: function(index) { throw "Not Implemented"; },
33097 GetDateCellRowIndex: function(index) { throw "Not Implemented"; },
33098 UpdateDateCellHtml: function(date) { throw "Not Implemented"; },
33099 SupportsWeekendStyle: function(date) { throw "Not Implemented"; },
33100 AttachDateMouseEvents: function(eventMethod, styleMethod) { throw "Not Implemented"; },
33101 GetVisibleDateOffsetInfo: function() { throw "Not Implemented"; },
33102 GetViewType: function() { throw "Not Implemented"; },
33103 AllowAttachDetachDateEventsOnChangeEnabled: function() { throw "Not Implemented"; },
33104 AllowAttachDetachDateEventsOnChangeReadOnly: function() { throw "Not Implemented"; },
33105 IsPrevNavCell: function(navigationCell) { throw "Not Implemented"; },
33106 IsNextNavCell: function(navigationCell) { throw "Not Implemented"; },
33107 GetCellStyleName: function() { throw "Not Implemented"; },
33108 GetCellSelectedStyleName: function() { throw "Not Implemented"; },
33109 GetCellHoverStyleName: function() { throw "Not Implemented"; },
33110 GetCellOtherPeriodStyleName: function() { throw "Not Implemented"; },
33111 GetCellOutOfRangeStyleName: function() { throw "Not Implemented"; },
33112 GetCellDisabledStyleName: function() { throw "Not Implemented"; },
33113 GetDateCellSelector: function() { throw "Not Implemented"; },
33114});
33115var ASPxClientCalendarDaysView = ASPx.CreateClass(ASPxClientCalendarView, {
33116 constructor: function(calendar, row, column) {
33117  this.constructor.prototype.constructor.call(this, calendar, row, column);
33118  this.dayFunctionsWithWeekSelection = {};
33119 },
33120 AttachDateMouseEvents: function(eventMethod, styleMethod) {
33121  var index;
33122  var cell;
33123  if(this.calendar.showDayHeaders) {
33124   var headCells = this.GetMonthTable().rows[0].cells;
33125   var dayNameIndex = 0;
33126   if(this.calendar.showWeekNumbers) {
33127    dayNameIndex++;
33128    cell = headCells[0];
33129    if(this.calendar.enableMulti) {
33130     eventMethod(cell, "click", ASPxClientCalendar.AnonymousHandlers.SelectMonth(this.calendar.name, this.row, this.column));
33131     if(this.calendar.needToSetCursor)
33132      styleMethod(cell, "cursor", ASPx.GetPointerCursor());
33133    }
33134    this.AttachCancelSelect(eventMethod, cell);
33135   }
33136   for(var j = 0; j < 7; j++)
33137    this.AttachCancelSelect(eventMethod, headCells[dayNameIndex++]);
33138  }
33139  for(var i = 0; i < calendarWeekCount; i++) {
33140   if(this.calendar.showWeekNumbers) {
33141    cell = this.GetWeekNumberCell(i);
33142    if(this.calendar.enableMulti)
33143     this.AttachDayMouseEvents(eventMethod, cell, this.GetDayMouseEventFunction(7 * i, true));
33144    else
33145     this.AttachCancelSelect(eventMethod, cell);
33146   }
33147   var date;
33148   for(var j = 0; j < 7; j++) {
33149    index = i * 7 + j;
33150    cell = this.GetDayCell(index);
33151    date = this.GetDateByIndex(index);
33152    var cal = this.calendar;
33153    if(!this.calendar.enableMulti && this.IsDateVisible(date) &&
33154     ASPxClientCalendarDateDisabledHelper.IsDateInRange(cal.sharedParameters, date) &&
33155     !cal.IsDateDisabled(date)) {
33156     if(this.calendar.needToSetCursor && (!cell.style.cursor || cell.style.cursor == ASPx.GetPointerCursor()))
33157      styleMethod(cell, "cursor", ASPx.GetPointerCursor());
33158    }
33159    this.AttachDayMouseEvents(eventMethod, cell, this.GetDayMouseEventFunction(index, false));
33160   }
33161  }
33162 },
33163 GetDateFunctionsHash: function(selectWeeks) {
33164  return selectWeeks ? this.dayFunctionsWithWeekSelection : this.dayFunctions;
33165 },
33166 UpdateNavigationCells: function(date) {
33167  var prevYearCell = this.GetPrevYearCell();
33168  var prevMonthCell = this.GetPrevMonthCell();
33169  var isEnabledDate = date.getFullYear() > 100;
33170  if(prevYearCell && ASPx.GetElementVisibility(prevYearCell) != isEnabledDate) {
33171   ASPx.SetElementVisibility(prevYearCell, isEnabledDate);
33172  }
33173  if(prevMonthCell) {
33174   var isEnabledDate = isEnabledDate || (date.getFullYear() == 100 && date.getMonth() > 0);
33175   if(ASPx.GetElementVisibility(prevMonthCell) != isEnabledDate)
33176    ASPx.SetElementVisibility(prevMonthCell, isEnabledDate);
33177  }
33178  var nextYearCell = this.GetNextYearCell();
33179  var nextMonthCell = this.GetNextMonthCell();
33180  isEnabledDate = date.getFullYear() < 9999;
33181  if(nextYearCell && ASPx.GetElementVisibility(nextYearCell) != isEnabledDate) {
33182   ASPx.SetElementVisibility(nextYearCell, isEnabledDate);
33183  }
33184  if(nextMonthCell) {
33185   var isEnabledDate = isEnabledDate || (date.getFullYear() == 9999 && date.getMonth() < 11);
33186   if(ASPx.GetElementVisibility(nextMonthCell) != isEnabledDate)
33187    ASPx.SetElementVisibility(nextMonthCell, isEnabledDate);
33188  }
33189 },
33190 IsPrevNavCell: function(navigationCell) {
33191  return navigationCell == this.GetPrevMonthCell() || navigationCell == this.GetPrevYearCell();
33192 },
33193 IsNextNavCell: function(navigationCell) {
33194  return navigationCell == this.GetNextMonthCell() || navigationCell == this.GetNextYearCell();
33195 },
33196 GetNavigationCellOffset: function(navigationCell) {
33197  if(navigationCell == this.GetPrevYearCell())
33198   return -12;
33199  if(navigationCell == this.GetPrevMonthCell())
33200   return -1;
33201  if(navigationCell == this.GetNextMonthCell())
33202   return 1;
33203  if(navigationCell == this.GetNextYearCell())
33204   return 12;
33205  return 0;
33206 },
33207 GetCurrentVisibleDate: function() {
33208  return ASPxClientCalendar.AddMonths(this.calendar.visibleDates[this.GetViewType()], this.GetIndex());
33209 },
33210 GetCurrentStartDate: function(visibleDate) {
33211  var offset = visibleDate.getDay() - this.calendar.firstDayOfWeek;
33212  if(offset < 0)
33213   offset += 7;
33214  return ASPxClientCalendar.AddDays(visibleDate, -offset);
33215 },
33216 GetDateByIndex: function(index) {
33217  return ASPxClientCalendar.AddDays(this.startDate, index);
33218 },
33219 GetIndexByDate: function(date) {
33220  return ASPxClientCalendar.GetDaysInRange(this.startDate, date) - 1;
33221 },
33222 IsDateOtherPeriod: function(date) {
33223  if(date == null)
33224   return false;
33225  return date.getMonth() != this.visibleDate.getMonth() ||
33226   date.getFullYear() != this.visibleDate.getFullYear();
33227 },
33228 GetDateCellColIndex: function(index) {
33229  var result = index % 7;
33230  if(this.calendar.showWeekNumbers)
33231   result++;
33232  return result;
33233 },
33234 GetDateCellRowIndex: function(index) {
33235  var result = (index - index % 7) / 7;
33236  if(this.calendar.showDayHeaders)
33237   result++;
33238  return result;
33239 },
33240 GetMaxIndex: function() {
33241  return 7 * calendarWeekCount - 1;
33242 },
33243 GetMaxVisibleDate: function() {
33244  var result = ASPxClientCalendar.CloneDate(this.visibleDate);
33245  result.setDate(ASPxClientCalendar.GetDaysInMonth(result.getMonth(), result.getFullYear()));
33246  return result;
33247 },
33248 GetDateCellContainer: function() {
33249  return this.GetMonthTable();
33250 },
33251 GetMainElement: function() {
33252  return this.GetMonthCell();
33253 },
33254 GetAnimatedElement: function() {
33255  return this.GetMonthTable();
33256 },
33257 GetMonthTable: function() {
33258  return this.calendar.GetMonthTable(this.calendar.IsMultiView() ? this.GetIDPostfix() : "");
33259 },
33260 GetMonthCell: function() {
33261  return this.calendar.GetMonthCell(this.calendar.IsMultiView() ? this.GetIDPostfix() : "");
33262 },
33263 GetWeekNumberCell: function(index) {
33264  if(this.calendar.showDayHeaders)
33265   index++;
33266  return this.GetMonthTable().rows[index].cells[0];
33267 },
33268 GetPrevYearCell: function() {
33269  return this.GetChildElement("PYC");
33270 },
33271 GetPrevMonthCell: function() {
33272  return this.GetChildElement("PMC");
33273 },
33274 GetNextMonthCell: function() {
33275  return this.GetChildElement("NMC");
33276 },
33277 GetNextYearCell: function() {
33278  return this.GetChildElement("NYC");
33279 },
33280 UpdateDateCellHtml: function() {
33281  var date = ASPxClientCalendar.CloneDate(this.startDate);
33282  var offset = this.calendar.firstDayOfWeek - 1;
33283  if(offset < 0)
33284   offset += 7;
33285  var weekNumber = ASPxClientCalendar.GetISO8601WeekOfYear(ASPxClientCalendar.AddDays(date, offset));
33286  var cell;
33287  for(var i = 0; i < calendarWeekCount; i++) {
33288   if(this.calendar.showWeekNumbers)
33289    this.calendar.SetMonthTableCellContent(this.GetWeekNumberCell(i), (weekNumber < 10 ? "0" : "") + weekNumber.toString(), true);
33290   for(var j = 0; j < 7; j++) {
33291    cell = this.GetDayCell(i * 7 + j);
33292    this.calendar.SetMonthTableCellContent(cell, this.IsDateVisible(date) ? date.getDate() : "&nbsp;");
33293    this.ApplyDayCellStyle(cell, date);
33294    date = this.GetNextDate(date);
33295   }
33296   if(++weekNumber > 52)
33297    weekNumber = ASPxClientCalendar.GetISO8601WeekOfYear(ASPxClientCalendar.AddDays(date, offset));
33298  }
33299 },
33300 GetTitleText: function() {
33301  if(!this.titleFormatter) {
33302   this.titleFormatter = new ASPx.DateFormatter();
33303   this.titleFormatter.SetFormatString(this.calendar.rtl ? "MMMM yyyy" : ASPx.CultureInfo.yearMonth);
33304  }
33305  return this.titleFormatter.Format(this.visibleDate);
33306 },
33307 SupportsWeekendStyle: function(date) {
33308  return true;
33309 },
33310 MakeDisabledStateItems: function() {
33311  var cells = this.GetAuxCells();
33312  for(var i = 0; i < cells.length; i++)
33313   this.AddAuxDisabledStateItem(cells[i], this.GetAuxId(i));
33314  ASPxClientCalendarView.prototype.MakeDisabledStateItems.call(this);
33315 },
33316 ChangeEnabledStateItems: function(enabled) {
33317  this.SetAuxCellsEnabled(enabled);
33318  ASPxClientCalendarView.prototype.ChangeEnabledStateItems.call(this, enabled);
33319 },
33320 SetAuxCellsEnabled: function(enabled) {
33321  var cells = this.GetAuxCells();
33322  for(var i = 0; i < cells.length; i++)
33323   ASPx.GetStateController().SetElementEnabled(cells[i], enabled);
33324 },
33325 GetNavigationCells: function() {
33326  return [
33327   this.GetPrevYearCell(),
33328   this.GetPrevMonthCell(),
33329   this.GetNextMonthCell(),
33330   this.GetNextYearCell()
33331  ];
33332 },
33333 GetAuxCells: function() {
33334  if(this.auxCells == null) {
33335   this.auxCells = [];
33336   var table = this.GetMonthTable();
33337   for(var i = 0; i < table.rows.length; i++) {
33338    var row = table.rows[i];
33339    if(i == 0 && this.calendar.showDayHeaders) {
33340     for(var j = 0; j < row.cells.length; j++)
33341      this.auxCells.push(row.cells[j]);
33342    }
33343    if(i > 0 && this.calendar.showWeekNumbers)
33344     this.auxCells.push(row.cells[0]);
33345   }
33346  }
33347  return this.auxCells;
33348 },
33349 GetAuxId: function(index) {
33350  return this.calendar.name + "_AUX_" + this.row + "_" + this.column + "_" + index;
33351 },
33352 AddAuxDisabledStateItem: function(element, id) {
33353  var cell = this.calendar.GetEtalonStyleCell("DD");
33354  if(cell) {
33355   element.id = id;
33356   ASPx.GetStateController().AddDisabledItem(id, cell.className, cell.style.cssText, null, null, null);
33357  }
33358 },
33359 GetVisibleDateOffsetInfo: function() {
33360  return {
33361   month: this.GetIndex(),
33362   year: 0
33363  };
33364 },
33365 GetViewType: function() { return ASPx.DatePickerType.Days; },
33366 AllowAttachDetachDateEventsOnChangeEnabled: function() {
33367  return !this.calendar.GetReadOnly();
33368 },
33369 AllowAttachDetachDateEventsOnChangeReadOnly: function() {
33370  return this.calendar.clientEnabled;
33371 },
33372 GetCellStyleName: function() { return "D"; },
33373 GetCellSelectedStyleName: function() { return "DS"; },
33374 GetCellHoverStyleName: function() { return "DH"; },
33375 GetCellOtherPeriodStyleName: function() { return "DA"; },
33376 GetCellOutOfRangeStyleName: function() { return "DO"; },
33377 GetCellDisabledStyleName: function() { return "DDD"; },
33378 GetDateCellSelector: function() { return "td[class*=\"dxeCalendarDay\"]"; },
33379});
33380ASPxClientCalendarView.DayInRangeClassName = "dxeDayInRange";
33381var ASPxClientCalendarLargeTimePeriodView = ASPx.CreateClass(ASPxClientCalendarView, {
33382 constructor: function(calendar, row, column) {
33383  this.constructor.prototype.constructor.call(this, calendar, row, column);
33384  if(calendar.fastNavRollbackTexts && this.isNavigationView)
33385   this.headerRollbackText = calendar.fastNavRollbackTexts[this.GetViewType() - 1];
33386 },
33387 GetMaxIndex: function() {
33388  return 11;
33389 },
33390 GetPrevTimePeriodCell: function() {
33391  return this.GetChildElement("PTPC");
33392 },
33393 GetNextTimePeriodCell: function() {
33394  return this.GetChildElement("NTPC");
33395 },
33396 Update: function() {
33397  ASPxClientCalendarView.prototype.Update.call(this);
33398  this.UpdateFastNavHeader();
33399 },
33400 UpdateFastNavHeader: function() {
33401  var fastNavHeader = this.GetFastNavHeader();
33402  if(fastNavHeader) {
33403   ASPx.SetElementDisplay(fastNavHeader, this.isNavigationView);
33404   if(this.isNavigationView) {
33405    var textElement = this.GetFastNavHeaderTextElement();
33406    if(textElement)
33407     ASPx.SetInnerHtml(textElement, this.headerRollbackText);
33408   }
33409  }
33410 },
33411 UpdateNavigationCells: function(date) {
33412  var prevPeriodCell = this.GetPrevTimePeriodCell();
33413  var isEnabledDate = date.getFullYear() > 100;
33414  if(prevPeriodCell && ASPx.GetElementVisibility(prevPeriodCell) != isEnabledDate) {
33415   ASPx.SetElementVisibility(prevPeriodCell, isEnabledDate);
33416  }
33417  var nextPeriodCell = this.GetNextTimePeriodCell();
33418  isEnabledDate = date.getFullYear() < 9999;
33419  if(nextPeriodCell && ASPx.GetElementVisibility(nextPeriodCell) != isEnabledDate) {
33420   ASPx.SetElementVisibility(nextPeriodCell, isEnabledDate);
33421  }
33422 },
33423 IsPrevNavCell: function(navigationCell) {
33424  return navigationCell == this.GetPrevTimePeriodCell();
33425 },
33426 IsNextNavCell: function(navigationCell) {
33427  return navigationCell == this.GetNextTimePeriodCell();
33428 },
33429 GetNavigationCellOffset: function(navigationCell) {
33430  if(navigationCell == this.GetPrevTimePeriodCell())
33431   return -1;
33432  if(navigationCell == this.GetNextTimePeriodCell())
33433   return 1;
33434  return 0;
33435 },
33436 GetYearCell: function() {
33437  return this.calendar.GetYearCell(this.calendar.IsMultiView() ? this.GetIDPostfix() : "");
33438 },
33439 GetFastNavHeader: function() {
33440  return this.calendar.GetFastNavHeader(this.calendar.IsMultiView() ? this.GetIDPostfix() : "");
33441 },
33442 GetFastNavHeaderTextElement: function() {
33443  var idPostfix = this.calendar.IsMultiView() ? this.GetIDPostfix() : "";
33444  idPostfix += "_rt";
33445  return this.calendar.GetFastNavHeaderTextElement(idPostfix);
33446 },
33447 GetAnimatedElement: function() {
33448  return this.GetYearCell();
33449 },
33450 SupportsWeekendStyle: function(date) {
33451  return false;
33452 },
33453 GetNavigationCells: function() {
33454  return [
33455   this.GetPrevTimePeriodCell(),
33456   this.GetNextTimePeriodCell()
33457  ];
33458 },
33459 GetDateCellContainer: function() {
33460  var idPostfix = this.calendar.IsMultiView() ? this.GetIDPostfix() : "";
33461  idPostfix += "_n";
33462  return this.calendar.GetYearCellChildArea(idPostfix);
33463 },
33464 GetDateCellColIndex: function(index) {
33465  return index % 4;
33466 },
33467 GetDateCellRowIndex: function(index) {
33468  return (index - index % 4) / 4;
33469 },
33470 GetMainElement: function() {
33471  return this.GetYearCell();
33472 },
33473 ChangeEnabledStateItems: function(enabled) {
33474  if(!this.isNavigationView)
33475   ASPxClientCalendarView.prototype.ChangeEnabledStateItems.call(this, enabled);
33476 },
33477 ChangeEnabledAttributes: function(enabled) {
33478  if(!this.isNavigationView)
33479   ASPxClientCalendarView.prototype.ChangeEnabledAttributes.call(this, enabled);
33480 },
33481 AttachDateMouseEvents: function(eventMethod, styleMethod) {
33482  var index;
33483  var date;
33484  for(var index = 0; index <= this.GetMaxIndex() ; index++) {
33485   cell = this.GetDayCell(index);
33486   date = this.GetDateByIndex(index);
33487   var cal = this.calendar;
33488   if(!this.isNavigationView && !this.calendar.enableMulti && this.IsDateVisible(date) &&
33489    ASPxClientCalendarDateDisabledHelper.IsDateInRange(cal.sharedParameters, date) &&
33490    !cal.IsDateDisabled(date)) {
33491    if(this.calendar.needToSetCursor && (!cell.style.cursor || cell.style.cursor == ASPx.GetPointerCursor()))
33492     styleMethod(cell, "cursor", ASPx.GetPointerCursor());
33493   }
33494   this.AttachDayMouseEvents(eventMethod, cell, this.GetDayMouseEventFunction(index, false));
33495  }
33496 },
33497 AllowAttachDetachDateEventsOnChangeEnabled: function() {
33498  return true;
33499 },
33500 AllowAttachDetachDateEventsOnChangeReadOnly: function() {
33501  return false;
33502 },
33503 GetCellStyleName: function() { return this.isNavigationView ? "FNI" : "MY"; },
33504 GetCellHoverStyleName: function() { return this.isNavigationView ? "FNIH" : "MYH"; },
33505 GetCellSelectedStyleName: function() { return this.isNavigationView ? "FNIS" : "MYS"; },
33506 GetCellOtherPeriodStyleName: function() { return this.isNavigationView ? "FNIA" : "MYA"; },
33507 GetCellOutOfRangeStyleName: function() { return "MYO"; },
33508 GetCellDisabledStyleName: function() { return "MYDD"; },
33509 GetDateCellSelector: function() { return "td[class*=\"dxeCalendarFastNavItemArea\"] td[class*=\"dxeCalendarFastNavItem\"]"; }
33510});
33511var ASPxClientCalendarMonthsView = ASPx.CreateClass(ASPxClientCalendarLargeTimePeriodView, {
33512 constructor: function(calendar, row, column) {
33513  this.constructor.prototype.constructor.call(this, calendar, row, column);
33514 },
33515 GetTitleText: function() {
33516  return this.startDate.getFullYear();
33517 },
33518 IsDateOtherPeriod: function(date) {
33519  return date.getFullYear() != this.visibleDate.getFullYear();
33520 },
33521 GetCurrentVisibleDate: function() {
33522  return ASPxClientCalendar.AddYears(this.calendar.visibleDates[this.GetViewType()], this.GetIndex());
33523 },
33524 GetCurrentStartDate: function(visibleDate) {
33525  return new Date(visibleDate.getFullYear(), 0, 1);
33526 },
33527 GetDateByIndex: function(index) {
33528  return ASPxClientCalendar.AddMonths(this.startDate, index);
33529 },
33530 GetIndexByDate: function(date) {
33531  return date.getMonth() + 12 * (date.getFullYear() - this.startDate.getFullYear());
33532 },
33533 UpdateDateCellHtml: function() {
33534  var date = ASPxClientCalendar.CloneDate(this.startDate);
33535  var cell;
33536  for(var i = 0; i <= this.GetMaxIndex(); i++) {
33537   cell = this.GetDayCell(i);
33538   cell.innerHTML = ASPx.CultureInfo.abbrMonthNames[i];
33539   this.ApplyDayCellStyle(cell, date);
33540   date = this.GetNextDate(date);
33541  }
33542 },
33543 GetVisibleDateOffsetInfo: function() {
33544  return {
33545   month: 0,
33546   year: this.GetIndex()
33547  };
33548 },
33549 GetViewType: function() { return ASPx.DatePickerType.Months; },
33550});
33551var ASPxClientCalendarYearsView = ASPx.CreateClass(ASPxClientCalendarLargeTimePeriodView, {
33552 constructor: function(calendar, row, column) {
33553  this.constructor.prototype.constructor.call(this, calendar, row, column);
33554 },
33555 GetTitleText: function() {
33556  var startYear = this.startDate.getFullYear();
33557  return ASPx.DateUtils.GetYearRangeFormatString(startYear + 1, 10);
33558 },
33559 IsDateOtherPeriod: function(date) {
33560  return date != null && ASPxClientCalendar.GetDecadeStartYear(date.getFullYear()) !== ASPxClientCalendar.GetDecadeStartYear(this.visibleDate.getFullYear());
33561 },
33562 GetCurrentVisibleDate: function() {
33563  return ASPxClientCalendar.AddYears(this.calendar.visibleDates[this.GetViewType()], this.GetIndex() * 10);
33564 },
33565 GetCurrentStartDate: function(visibleDate) {
33566  var decadeStartYear = ASPxClientCalendar.GetDecadeStartYear(visibleDate.getFullYear());
33567  return new Date(decadeStartYear - 1, 0, 1);
33568 },
33569 GetDateByIndex: function(index) {
33570  return ASPxClientCalendar.AddYears(this.startDate, index);
33571 },
33572 GetIndexByDate: function(date) {
33573  return date.getFullYear() - this.startDate.getFullYear();
33574 },
33575 UpdateDateCellHtml: function() {
33576  var date = ASPxClientCalendar.CloneDate(this.startDate);
33577  var cell;
33578  for(var i = 0; i <= this.GetMaxIndex(); i++) {
33579   cell = this.GetDayCell(i);
33580   cell.innerHTML = this.IsDateVisible(date) ? date.getFullYear() : "";
33581   this.ApplyDayCellStyle(cell, date);
33582   date = this.GetNextDate(date);
33583  }
33584 },
33585 GetVisibleDateOffsetInfo: function() {
33586  return {
33587   month: 0,
33588   year: this.GetIndex() * 10
33589  };
33590 },
33591 GetViewType: function() { return ASPx.DatePickerType.Years; },
33592});
33593var ASPxClientCalendarDecadesView = ASPx.CreateClass(ASPxClientCalendarLargeTimePeriodView, {
33594 constructor: function(calendar, row, column) {
33595  this.constructor.prototype.constructor.call(this, calendar, row, column);
33596 },
33597 GetTitleText: function() {
33598  var startYear = this.startDate.getFullYear();
33599  return ASPx.DateUtils.GetYearRangeFormatString(startYear + 10, 100);
33600 },
33601 IsDateOtherPeriod: function(date) {
33602  return date != null && ASPxClientCalendar.GetCenturyStartYear(date.getFullYear()) !== ASPxClientCalendar.GetCenturyStartYear(this.visibleDate.getFullYear());
33603 },
33604 GetCurrentVisibleDate: function() {
33605  return ASPxClientCalendar.AddYears(this.calendar.visibleDates[this.GetViewType()], this.GetIndex() * 100);
33606 },
33607 GetCurrentStartDate: function(visibleDate) {
33608  var centuryStartYear = ASPxClientCalendar.GetCenturyStartYear(visibleDate.getFullYear());
33609  return new Date(centuryStartYear - 10, 0, 1);
33610 },
33611 GetDateByIndex: function(index) {
33612  return ASPxClientCalendar.AddYears(this.startDate, index * 10);
33613 },
33614 GetIndexByDate: function(date) {
33615  return Math.floor((date.getFullYear() - this.startDate.getFullYear()) / 10);
33616 },
33617 UpdateDateCellHtml: function() {
33618  var date = ASPxClientCalendar.CloneDate(this.startDate);
33619  var cell;
33620  for(var i = 0; i <= this.GetMaxIndex() ; i++) {
33621   cell = this.GetDayCell(i);
33622   var dateYear = date.getFullYear();
33623   cell.innerHTML = this.IsDateVisible(date) ? ASPx.DateUtils.GetYearRangeFormatString(dateYear, 10) : "";
33624   this.ApplyDayCellStyle(cell, date);
33625   date = this.GetNextDate(date);
33626  }
33627 },
33628 GetVisibleDateOffsetInfo: function() {
33629  return {
33630   month: 0,
33631   year: this.GetIndex() * 100
33632  };
33633 },
33634 GetViewType: function() { return ASPx.DatePickerType.Decades; },
33635});
33636var ASPxClientCalendarFastNavigation = ASPx.CreateClass(null, {
33637 constructor: function(calendar) {
33638  this.calendar = calendar;
33639  this.activeMonth = -1;
33640  this.activeYear = -1;
33641  this.startYear = -1;
33642  this.activeView = null;
33643  this.partialId = "FNP";
33644  this.InitializeUI();
33645 },
33646 InitializeUI: function() {
33647  var item;
33648  var prefix = this.GetId();
33649  for(var m = 0; m < 12; m++) {
33650   item = this.GetMonthItem(m);
33651   if(!ASPx.IsExistsElement(item))
33652    break;
33653   item.id = prefix + "_M" + m;
33654   ASPx.Evt.AttachEventToElement(item, "click", ASPxClientCalendar.AnonymousHandlers.FastNavMonthClick(this.calendar.name, m));
33655  }
33656  for(var i = 0; i < 10; i++) {
33657   item = this.GetYearItem(i);
33658   if(!ASPx.IsExistsElement(item))
33659    break;
33660   item.id = prefix + "_Y" + i;
33661   ASPx.Evt.AttachEventToElement(item, "click", ASPxClientCalendar.AnonymousHandlers.FastNavYearClick(this.calendar.name, i));
33662  }
33663  ASPx.Evt.AttachEventToElement(this.GetPopupWindowElement(), "click", ASPxClientCalendar.AnonymousHandlers.MainElementClick(this.calendar.name));
33664  this.InitializePopup();
33665 },
33666 InitializePopup: function() {
33667  var popup = this.GetPopup();
33668  if(popup)
33669   popup.CloseUp.AddHandler(function(s, e) { this.Hide(); }.aspxBind(this));
33670 },
33671 IsActive: function() {
33672  return this.GetPopup().IsVisible();
33673 },
33674 Show: function() {
33675  this.Prepare();
33676  this.GetPopup().ShowAtElement(this.activeView.GetTitleElement());
33677 },
33678 Hide: function() {
33679  this.GetPopup().Hide();
33680 },
33681 SetMonth: function(month) {
33682  if(month != this.activeMonth) {
33683   var prevCell = this.GetMonthItem(this.activeMonth);
33684   var cell = this.GetMonthItem(month);
33685   if(ASPx.IsExistsElement(prevCell))
33686    this.ApplyItemStyle(prevCell, false, "M");
33687   this.ApplyItemStyle(cell, true, "M");
33688   this.activeMonth = month;
33689  }
33690 },
33691 ShiftMonth: function(offset) {
33692  var month = (this.activeMonth + offset) % 12;
33693  month = (month < 0) ? month + 12 : month;
33694  this.SetMonth(month);
33695 },
33696 SetYear: function(year) {
33697  var startYear = Math.floor(year / 10) * 10;
33698  this.SetStartYear(startYear);
33699  this.SetYearIndex(year - startYear);
33700 },
33701 SetYearIndex: function(index) {
33702  var prevIndex = this.activeYear - this.startYear;
33703  if(index != prevIndex) {
33704   var prevCell = this.GetYearItem(prevIndex);
33705   if(ASPx.IsExistsElement(prevCell))
33706    this.ApplyItemStyle(prevCell, false, "Y");
33707   var cell = this.GetYearItem(index);
33708   this.ApplyItemStyle(cell, true, "Y");
33709   this.activeYear = index + this.startYear;
33710  }
33711 },
33712 SetStartYear: function(year) {
33713  if(this.startYear == year) return;
33714  this.startYear = year;
33715  this.PrepareYearList();
33716 },
33717 ShiftYear: function(offset) {
33718  if(this.activeYear + offset > 99 && this.activeYear + offset < 9999)
33719   this.SetYear(this.activeYear + offset);
33720 },
33721 ShiftStartYear: function(offset) {
33722  this.SetStartYear(this.startYear + offset);
33723 },
33724 ApplyChanges: function() {
33725  this.Hide();
33726  var offset = this.calendar.GetOffsetInCurrentViewTypePeriods(this.calendar.visibleDate, new Date(this.activeYear, this.activeMonth, 1));
33727  offset -= this.activeView.GetIndex();
33728  if(offset != 0) {
33729   var date = this.calendar.GetNewVisibleDateByOffset(offset);
33730   this.calendar.OnVisibleMonthChanged(date);
33731  }
33732  this.calendar.OnMainElementClick();
33733 },
33734 CancelChanges: function() {
33735  this.Hide();
33736 },
33737 Prepare: function() {
33738  var date = this.activeView.visibleDate;
33739  this.activeYear = date.getFullYear();
33740  this.activeMonth = date.getMonth();
33741  this.startYear = ASPxClientCalendar.GetDecadeStartYear(this.activeYear);
33742  this.PrepareMonthList();
33743  this.PrepareYearList();
33744 },
33745 PrepareMonthList: function() {
33746  var item;
33747  for(var month = 0; month < 12; month++) {
33748   item = this.GetMonthItem(month);
33749   if(item == null)
33750    return;
33751   this.ApplyItemStyle(item, month == this.activeMonth, "M");
33752  }
33753 },
33754 PrepareYearList: function() {
33755  var year = this.startYear;
33756  var item;
33757  for(var index = 0; index < 10; index++) {
33758   item = this.GetYearItem(index);
33759   if(item == null)
33760    return;
33761   item.innerHTML = year;
33762   this.ApplyItemStyle(item, year == this.activeYear, "Y");
33763   year++;
33764  }
33765  this.PreparePreviousYearListCell();
33766  this.PrepareNextYearListCell();
33767 },
33768 PreparePreviousYearListCell: function() {
33769  var yearListTable = this.GetChildElement("y");
33770  if(!ASPx.IsExistsElement(yearListTable))
33771   return;
33772  var isEnabledDate = this.startYear > 100;
33773  var prevYearListCell = yearListTable.rows[0].cells[0];
33774  var isPrevYearListCellVisible = ASPx.GetElementVisibility(prevYearListCell);
33775  if(isPrevYearListCellVisible != isEnabledDate)
33776   ASPx.SetElementVisibility(prevYearListCell, isEnabledDate);
33777 },
33778 PrepareNextYearListCell: function() {
33779  var yearListTable = this.GetChildElement("y");
33780  if(!ASPx.IsExistsElement(yearListTable))
33781   return;
33782  var firstYearListRow = yearListTable.rows[0];
33783  var nextYearListCell = firstYearListRow.cells[firstYearListRow.cells.length - 1];
33784  var isLastYear = this.startYear + 9 == 9999;
33785  ASPx.SetElementVisibility(nextYearListCell, !isLastYear);
33786 },
33787 GetMonthItem: function(month) {
33788  var t = this.GetChildElement("m");
33789  if(!ASPx.IsExistsElement(t))
33790   return null;
33791  var colIndex = month % 4;
33792  var rowIndex = (month - colIndex) / 4;
33793  return t.rows[rowIndex].cells[colIndex];
33794 },
33795 GetYearItem: function(index) {
33796  var t = this.GetChildElement("y");
33797  if(!ASPx.IsExistsElement(t) || index < 0 || index > 9)
33798   return null;
33799  var colIndex = index % 5;
33800  var rowIndex = (index - colIndex) / 5;
33801  if(rowIndex == 0)
33802   colIndex++;
33803  return t.rows[rowIndex].cells[colIndex];
33804 },
33805 GetPopup: function() {
33806  return ASPx.GetControlCollection().Get(this.GetId());
33807 },
33808 GetPopupWindowElement: function() {
33809  return this.GetPopup().GetWindowElement(-1);
33810 },
33811 ApplyItemStyle: function(item, isSelected, type) {
33812  var info = new ASPxClientCalendarStyleInfo();
33813  this.calendar.ImportEtalonStyle(info, "FN" + type);
33814  if(isSelected)
33815   this.calendar.ImportEtalonStyle(info, "FN" + type + "S");
33816  info.Apply(item);
33817 },
33818 GetChildElement: function(postfix) {
33819  return ASPx.CacheHelper.GetCachedElementById(this.calendar, this.calendar.name + "_" + this.partialId + "_" + postfix);
33820 },
33821 GetId: function() {
33822  return this.calendar.name + "_" + this.partialId;
33823 },
33824 OnArrowUp: function(evt) {
33825  if(evt.shiftKey)
33826   this.ShiftMonth(-4);
33827  else
33828   this.ShiftYear(-5);
33829 },
33830 OnArrowDown: function(evt) {
33831  if(!evt.shiftKey)
33832   this.ShiftYear(5);
33833  else
33834   this.ShiftMonth(4);
33835 },
33836 OnArrowLeft: function(evt) {
33837  if(evt.shiftKey)
33838   this.ShiftMonth(-1);
33839  else
33840   this.ShiftYear(-1);
33841 },
33842 OnArrowRight: function(evt) {
33843  if(!evt.shiftKey)
33844   this.ShiftYear(1);
33845  else
33846   this.ShiftMonth(1);
33847 },
33848 OnPageUp: function(evt) {
33849  this.ShiftYear(-10);
33850 },
33851 OnPageDown: function(evt) {
33852  this.ShiftYear(10);
33853 },
33854 OnEnter: function() {
33855  this.ApplyChanges();
33856 },
33857 OnMonthClick: function(month) {
33858  this.SetMonth(month);
33859 },
33860 OnYearClick: function(index) {
33861  this.SetYearIndex(index);
33862 },
33863 OnYearShuffle: function(offset) {
33864  this.ShiftStartYear(offset);
33865 }
33866});
33867ASPx.ASPxClientCalendarFastNavigation = ASPxClientCalendarFastNavigation;
33868var ASPxClientCalendarStyleInfo = ASPx.CreateClass(null, {
33869 constructor: function() {
33870  this.className = "";
33871  this.cssText = "";
33872 },
33873 Clone: function() {
33874  var clone = new ASPxClientCalendarStyleInfo();
33875  clone.className = this.className;
33876  clone.cssText = this.cssText;
33877  return clone;
33878 },
33879 Apply: function(element) {
33880  if(element.className != this.className)
33881   element.className = this.className;
33882  if(element._style != this.cssText) {
33883   element.style.cssText = this.cssText; 
33884   element._style = this.cssText; 
33885  } 
33886 },
33887 Remove: function(element) {
33888  ASPx.RemoveClassNameFromElement(element, this.className);
33889  var styleRules = this.cssText.split(";");
33890  for(var i = 0; i < styleRules.length; i++) {
33891   var styleRule = styleRules[i];
33892   if(styleRule && element.style.cssText.indexOf(styleRule) !== -1)
33893    element.style.cssText = element.style.cssText.replace(styleRule, "");
33894  }
33895  element.style.cssText = element.style.cssText.replace(new RegExp(";+"), ";");
33896 },
33897 Import: function(element) {
33898  if(element.className.length > 0)
33899   this.AddClassName(element.className);
33900  var cssText = element.style.cssText;
33901  if(cssText.length > 0) {
33902   var pos = cssText.length - 1;
33903   while(pos > -1 && cssText.charAt(pos) == " ")
33904    --pos;
33905   if(cssText.charAt(pos) != ";")
33906    cssText += ";";
33907   this.cssText += cssText;
33908  }
33909 },
33910 AddClassName: function(className) {
33911  if(this.className.length > 1)
33912   this.className += " ";
33913  this.className += className;
33914 },
33915});
33916var ASPxClientCalendarSelectionEventArgs = ASPx.CreateClass(ASPxClientProcessingModeEventArgs, {
33917 constructor: function(processOnServer, selection){
33918  this.constructor.prototype.constructor.call(this, processOnServer);
33919  this.selection = selection;
33920 }
33921});
33922var ASPxDaysSelectingOnMouseOverEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
33923 constructor: function (overDate) {
33924  this.constructor.prototype.constructor.call(this);
33925  this.overDate = overDate;
33926 }
33927});
33928var ASPxClientCalendarCellClickEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
33929 constructor: function(date) {
33930  this.constructor.prototype.constructor.call(this);
33931  this.date = date;
33932 }
33933});
33934function aspxCalDocMouseUp(evt) {
33935 var target = ASPx.Evt.GetEventSource(evt);
33936 if(ASPx.activeCalendar != null && ASPx.IsExistsElement(target)) {
33937  ASPx.activeCalendar.forceMouseDown = false;
33938  if(ASPx.activeCalendar.isMouseDown) {
33939   var activeViews = ASPx.activeCalendar.GetActiveViews();
33940   for(var key in activeViews) {
33941    if(activeViews.hasOwnProperty(key)) {
33942     var view = activeViews[key];
33943     if(!view.isASPxClientCalendarView || view.isNavigationView) continue;
33944     var monthCell = view.GetDateCellContainer();
33945     var parent = target.parentNode;
33946     while(ASPx.IsExistsElement(parent)) {
33947      if(parent == monthCell)
33948       return;
33949      parent = parent.parentNode;
33950     }
33951    }
33952   }
33953   ASPx.activeCalendar.OnSelectionCancelled();   
33954  }
33955  ASPx.activeCalendar = null;
33956 }
33957}
33958function aspxCalCancelSelect() {
33959 if(ASPx.activeCalendar != null) {
33960  ASPx.activeCalendar.forceMouseDown = false;
33961  ASPx.activeCalendar.OnSelectionCancelled();  
33962 }
33963}
33964ASPx.CalFNYShuffle = function(name, offset) {
33965 var edit = ASPx.GetControlCollection().Get(name);
33966 if(edit != null)
33967  edit.fastNavigation.OnYearShuffle(offset);
33968};
33969ASPx.CalFNBClick = function(name, action) {
33970 var edit = ASPx.GetControlCollection().Get(name);
33971 if(edit != null) {
33972  switch(action) {
33973   case "ok":
33974    if(edit.fastNavigation)
33975     edit.fastNavigation.ApplyChanges();
33976    break;
33977   case "cancel":
33978    edit.CancelFastNavigation();
33979    break;
33980  }    
33981 }
33982};
33983window.ASPxClientCalendar = ASPxClientCalendar;
33984window.ASPxClientCalendarCustomDisabledDateEventArgs = ASPxClientCalendarCustomDisabledDateEventArgs;
33985window.ASPxClientCalendarSelection = ASPxClientCalendarSelection;
33986window.ASPxClientCalendarDateDisabledHelper = ASPxClientCalendarDateDisabledHelper;
33987window.ASPxClientCalendarStyleInfo = ASPxClientCalendarStyleInfo;
33988window.ASPxClientCalendarSelectionEventArgs = ASPxClientCalendarSelectionEventArgs;
33989})();
33990
33991(function() {
33992var serializingSeparator = "|";
33993var serializingSeparatorLength = serializingSeparator.length;
33994var lbIPostfixes = ['C', 'I', 'T'];
33995var lbIIdSuffix = "LBI";
33996var lbSIIdSuffix = lbIIdSuffix + "-1";
33997var lbAIRIdSuffix = "AIR";
33998var lbAIRTIdSuffix = lbAIRIdSuffix + "-1";
33999var lbTSIdSuffix = "_TS";
34000var lbBSIdSuffix = "_BS";
34001var lbHeaderDivIdSuffix = "_H";
34002var lTableIdSuffix = "_LBT";
34003var leVISuffix = "_VI";
34004var lbDSuffix = "_D";
34005var emptyItemsRange = "0:-1";
34006var nbsp = "&nbsp;";
34007var nameSeparator = "_";
34008var nbspChar = String.fromCharCode(160);
34009var NullSizeCellClassName = "dxlbNullSizeCell";
34010var itemCellTextAttributeName = "data-item-cell-text";
34011var itemSerializedTextsAttributeName = "data-item-serialized-texts";
34012var FIRST_CELL_MARKER_CSS_CLASS_NAME = "dxeFTM";
34013var LAST_CELL_MARKER_CSS_CLASS_NAME = "dxeLTM";
34014var selectAllMainElementID = "LBSAME";
34015var selectAllCheckBoxID = "LBSACB";
34016var filterMainElementID = "LBF";
34017var filteringTextBoxID = "LBFE";
34018var showFilterButtonID = "LBSFEB";
34019var inactiveFilterElementClassName = "dxeLBInactiveFilterPanelSys";
34020var listTableCollapsedClassName = "dxeLBTCollapsed";
34021var ListBoxSelectionMode = { Single : 0, Multiple : 1, CheckColumn : 2 };
34022var ListBoxVirtualScrollTableContainerIDPostfix = "LBVSTC";
34023var CONSTANTS = {
34024 CALLBACK_PREFIXES: {
34025  CUSTOM: "LECC",
34026  CUSTOMPERFORM: "LECCP",
34027  LOAD_RANGE_ITEMS: "LBCRI",
34028  FILTERING: "CBLF",
34029  FILTERING_CORRECT: "CBCF"
34030 },
34031 CALLBACK_RESULTS: {
34032  ITEMS: "i",
34033  FILTER_CUSTOMHIGHLIGHTING: "fCH",
34034  FILTER_LENGTH: "fL"
34035 }
34036};
34037var ListBoxItemsManagerBase = ASPx.CreateClass(null, {
34038 constructor: function(listBox) {
34039  this.listBox = listBox;
34040  this.listTable = listBox.GetListTable();
34041 },
34042 Initialize: function() {
34043  this.AddStateItems(false, false);  
34044 },
34045 HasSampleItemStateItems: function() {
34046  return this.listBox.hasSampleItem;
34047 },
34048 AddStateItems: function(clearCache, hoverItemOnly) {
34049  if (typeof (ASPx.GetStateController) !== "undefined") {
34050   var itemCellsIdSuffixes = this.listBox.GetItemCellsIdPostfixes();
34051   this.AddStateItemsCore(ASPx.GetStateController(), clearCache, itemCellsIdSuffixes, hoverItemOnly);
34052  }
34053 },
34054 AddStateItemsCore: function (controller, clearCache, itemCellsIdSuffixes, hoverItemOnly) {
34055  if(this.HasSampleItemStateItems())
34056   this.AddItemStateItems(controller, clearCache, itemCellsIdSuffixes, hoverItemOnly, -1);
34057 },
34058 AddItemStateItems: function (controller, clearCache, itemCellsIdSuffixes, hoverItemOnly, index) {
34059  var name = this.listBox.name + "_" + lbIIdSuffix + index;
34060  if (clearCache)
34061   this.listBox.ClearStateItemCache(controller, name, itemCellsIdSuffixes);
34062  if (!ASPx.Browser.WebKitTouchUI)
34063   controller.AddHoverItem(name, this.listBox.hoverClasses, this.listBox.hoverCssArray, itemCellsIdSuffixes, null, null, true);
34064  if (!hoverItemOnly) {
34065   controller.AddSelectedItem(name, this.listBox.selectedClasses, this.listBox.selectedCssArray, itemCellsIdSuffixes, null, null, true);
34066   controller.AddDisabledItem(name, this.listBox.disabledClasses, this.listBox.disabledCssArray, itemCellsIdSuffixes, null, null, true);
34067  }
34068 },
34069 RemoveHoverStateItem: function() {
34070  if (typeof (ASPx.GetStateController) !== "undefined") {
34071   var itemCellsIdSuffixes = this.listBox.GetItemCellsIdPostfixes();
34072   this.RemoveHoverStateItemCore(ASPx.GetStateController(), itemCellsIdSuffixes);
34073  }
34074 },
34075 RemoveHoverStateItemCore: function(controller, itemCellsIdSuffixes) {
34076  if(this.HasSampleItemStateItems())
34077   this.RemoveItemStateHoverItem(controller, itemCellsIdSuffixes, -1);
34078 },
34079 RemoveItemStateHoverItem: function(controller, itemCellsIdSuffixes, index) {
34080  var name = this.listBox.name + "_" + lbIIdSuffix + index;
34081  this.listBox.ClearStateItemCache(controller, name, itemCellsIdSuffixes);
34082  if (!ASPx.Browser.WebKitTouchUI)
34083   controller.RemoveHoverItem(name, itemCellsIdSuffixes);
34084 },
34085 GetListTableRows: function() {
34086  return this.listTable ? this.listTable.rows : [];
34087 },
34088 GetItemHtmlContent: function(index) { return null; },
34089 GetItem: function () { return null; },
34090 GetItemIndexByRow: function (itemRow) { return null; },
34091 GetItemCount: function () { return 0; },
34092 GetItemRow: function (index) {
34093  if (this.listTable && index >= 0) {
34094   var rowIndex = this.ConvertItemIndexToRowIndex(index);
34095   var itemRow = this.listTable.rows[rowIndex];
34096   if (itemRow && ASPx.ElementContainsCssClass(itemRow, "dxeListBoxItemRow"))
34097    return itemRow;
34098  }
34099  return null;
34100 },
34101 GetItemElement: function (index) {
34102  var result = null;
34103  var itemRow = this.GetItemRow(index);
34104  if (itemRow)
34105   result = this.GetFirstVisibleCell(itemRow) || itemRow.cells[0];
34106  return result;
34107 },
34108 GetFirstVisibleCell: function (itemRow) {
34109  for (var i = 0; i < itemRow.cells.length; i++)
34110   if (ASPx.GetElementDisplay(itemRow.cells[i]))
34111    return itemRow.cells[i];
34112  return null;
34113 },
34114 GetItemHeight: function (index) {
34115  var itemElement = this.GetItemElement(index);
34116  return itemElement != null ? itemElement.getBoundingClientRect().height : this.GetDefaultItemHeight();
34117 },
34118 GetDefaultItemHeight: function () { return 0; },
34119 ResetItemHeightIfRequired: function () { return false; },
34120 GetItemsHeight: function() { return 0; },
34121 GetItemsWidth: function() { return 0; },
34122 GetVisibleItemCount: function () { return 0; },
34123 GetTopSpacersHeight: function() {
34124  return this.listBox.GetTopScrollSpacerHeight();
34125 },
34126 GetItemTopOffset: function(index) {
34127  return this.GetItemTopOffsetCore(index);
34128 },
34129 GetItemTopOffsetCore: function(index) {
34130  var itemElement = this.GetItemElement(index);
34131  return itemElement ? itemElement.offsetTop + this.GetTopSpacersHeight() : 0;
34132 },
34133 IsItemVisible: function(index) {
34134  return this.IsItemEdgeVisible(index, true, true);
34135 },
34136 IsItemEdgeVisible: function(index, checkTop, checkBottom) {
34137  var result = false;
34138  var itemElement = this.GetItemElement(index);
34139  if(itemElement != null) {
34140   var scrollDiv = this.listBox.GetScrollDivElement();
34141   var topScrollDivEdge = scrollDiv.scrollTop;
34142   var bottomScrollDivEdge = scrollDiv.scrollTop + scrollDiv.clientHeight;
34143   var topItemElementEdge = this.GetItemTopOffset(index);
34144   var bottomItemElementEdge = topItemElementEdge + itemElement.getBoundingClientRect().height;
34145   var checkTopVisibleResult = !checkTop || this.IsVisibleOffset(topItemElementEdge, topScrollDivEdge, bottomScrollDivEdge);
34146   var checkBottomVisibleResult = !checkBottom || this.IsVisibleOffset(bottomItemElementEdge, topScrollDivEdge, bottomScrollDivEdge);
34147   result = checkTopVisibleResult && checkBottomVisibleResult;
34148  }
34149  return result;
34150 },
34151 IsVisibleOffset: function(offset, topScrollDivEdge, bottomScrollDivEdge) {
34152  return offset >= topScrollDivEdge && offset <= bottomScrollDivEdge;
34153 },
34154 GetFirstVisibleItem: function () { return null; },
34155 GetFirstVisibleItemRow: function() {
34156  var firstVisibleItemIndex = this.GetFirstVisibleItem();
34157  return this.listTable.rows[this.ConvertItemIndexToRowIndex(firstVisibleItemIndex)];
34158 },
34159 GetFirstRenderedItem: function () { },
34160 GetLastRenderedItem: function () { },
34161 InitializeInternalCheckBoxCollection: function () { },
34162 GetScrollDivChildElementHeight: function () { return null; },
34163 RemoveItem: function(index) { this.RemoveItemCore(index); },
34164 RemoveItemCore: function(index) {
34165  this.listBox.RemoveItemRow(index);
34166 },
34167 InsertItem: function () { },
34168 CreateNewItemRow: function (index) {
34169  var newItemRow = this.listBox.GetSampleItemRow();
34170  if (ASPx.IsExistsElement(newItemRow))
34171   newItemRow = newItemRow.cloneNode(true);
34172  return newItemRow;
34173 },
34174 ClearItems: function () {
34175  this.ClearItemsCore();
34176 },
34177 ClearItemsCore: function() {
34178  var tBody = this.listBox.GetListTableRowParent();
34179  if(ASPx.Browser.IE)
34180   tBody.innerText = "";
34181  else
34182   tBody.innerHTML = "";
34183 },
34184 IsItemFiltered: function (index) { return false; },
34185 ConvertItemIndexToRowIndex: function () { return null; },
34186 Adjust: function () { },
34187 BeforeClientFiltering: function () { },
34188 ApplyFilterToItem: function (index, isSatisfy, savePrevState, isFilterReset) { },
34189 RestorePrevFilteredState: function (index) { },
34190 OnEndItemsFiltering: function () { },
34191 ChangeItemsFilteredState: function(action) {
34192  var count = this.GetItemCount();
34193  for (var i = 0; i < count; i++) {
34194   action(i);
34195   this.AfterChangeItemFilteredStateAction(i);
34196  }
34197 },
34198 AfterChangeItemFilteredStateAction: function() { },
34199 MakeAllItemsVisible: function () {
34200  this.ChangeItemsFilteredState(function (index) {
34201   this.ApplyFilterToItem(index, true, false, true);
34202  }.aspxBind(this));
34203 },
34204 RewriteFilteredItemIndices: function(newFilteredItemIndices) { },
34205 OnScrollSpacerVisibilityChanged: function () { },
34206 SetItemHtml: function (index, html) { },
34207 SetItemTooltip: function(index, tooltip) { },
34208 SetItemAttribute: function(index, attrName, attrValue) { },
34209 AddItemCssClass: function (index, className) { },
34210 RemoveItemCssClass: function (index, className) { },
34211 SetItemTextCellHtml: function (itemIndex, textCellIndex, html) { },
34212 SetItemTextCellTooltip: function(itemIndex, textCellIndex, tooltip) { },
34213 SetItemTextCellAttribute: function(itemIndex, textCellIndex, attrName, attrValue) { },
34214 AddItemTextCellCssClass: function (itemIndex, textCellIndex, className) { },
34215 RemoveItemTextCellCssClass: function (itemIndex, textCellIndex, className) { },
34216 OnDecoratedItemsRendering: function () { },
34217 DeactivateScrollHandler: function() { },
34218 ActivateScrollHandler: function() { },
34219 IsScrollActivated: function() { return true; },
34220 FixItemTruncatingIfRequired: function() { }
34221});
34222var ListBoxItemsDefaultManager = ASPx.CreateClass(ListBoxItemsManagerBase, {
34223 constructor: function (listBox) {
34224  this.constructor.prototype.constructor.call(this, listBox);
34225 },
34226 AddStateItemsCore: function (controller, clearCache, itemCellsIdSuffixes, hoverItemOnly) {
34227  ListBoxItemsManagerBase.prototype.AddStateItemsCore.call(this, controller, clearCache, itemCellsIdSuffixes, hoverItemOnly);
34228  var count = this.GetItemCount();
34229  for (var i = 0; i < count; i++)
34230   this.AddItemStateItems(controller, clearCache, itemCellsIdSuffixes, hoverItemOnly, i);
34231 },
34232 RemoveHoverStateItemCore: function(controller, itemCellsIdSuffixes) {
34233  ListBoxItemsManagerBase.prototype.RemoveHoverStateItemCore.call(this, controller, itemCellsIdSuffixes);
34234  var count = this.GetItemCount();
34235  for (var i = 0; i < count; i++)
34236   this.RemoveItemStateHoverItem(controller, itemCellsIdSuffixes, i);
34237 },
34238 GetItemIndexByRow: function (itemRow) {
34239  var result = itemRow.rowIndex;
34240  if (this.listBox.ContainsFixWidthRow())
34241   result--;
34242  return result;
34243 },
34244 GetItemCount: function () {
34245  if (this.listTable) {
34246   var rowLength = this.listTable.rows.length;
34247   if (!!this.listBox.GetAccessibilityHeaderRow())
34248    rowLength--;
34249   if (this.listBox.ContainsFixWidthRow())
34250    rowLength--;
34251   return rowLength;
34252  }
34253  return 0;
34254 },
34255 GetItem: function (index) {
34256  var rowLength = this.GetItemCount();
34257  if (!this.listTable || index < 0 || index >= rowLength)
34258   return null;
34259  var row = this.listBox.GetItemRow(index);
34260  var image = this.listBox.imageCellExists ? ASPx.GetNodeByTagName(row.cells[this.listBox.GetImageCellIndex()], "IMG", 0) : null;
34261  var src = image == null ? "" : ASPx.ImageUtils.GetImageSrc(image);
34262  var itemValue = this.listBox.itemsValue[index] !== undefined ? this.listBox.itemsValue[index] : null;
34263  return new ASPxClientListBoxItem(this.listBox, index, this.listBox.GetItemRowTexts(row), itemValue, src, this.listBox.GetIsItemSelected(index));
34264 },
34265 GetVisibleItemCount: function () {
34266  var count = this.GetItemCount();
34267  var visibleItemCount = 0;
34268  for (var i = 0; i < count; i++) {
34269   if (ASPx.GetElementDisplay(this.GetItemRow(i)))
34270    visibleItemCount++;
34271  }
34272  return visibleItemCount;
34273 },
34274 GetFirstVisibleItem: function () {
34275  var itemCount = this.GetItemCount();
34276  for (var i = 0; i < itemCount; i++)
34277   if (this.GetItemRow(i) && ASPx.GetElementDisplay(this.GetItemRow(i)))
34278    return i;
34279  return -1;
34280 },
34281 GetFirstFilteredItemIndex: function () {
34282  return this.GetFirstVisibleItem();
34283 },
34284 GetFirstRenderedItem: function () {
34285  return this.GetItemCount() > 0 ? this.GetItem(0) : null;
34286 },
34287 GetLastRenderedItem: function () {
34288  return this.GetItemCount() > 0 ? this.GetItem(this.GetItemCount() - 1) : null;
34289 },
34290 ConvertItemIndexToRowIndex: function (itemIndex) {
34291  return this.listBox.ContainsFixWidthRow() ? itemIndex + 1 : itemIndex;
34292 },
34293 GetScrollDivChildElementHeight: function () {
34294  return this.listBox.GetListTableHeight() + this.listBox.GetTopScrollSpacerHeight() + this.listBox.GetBottomScrollSpacerHeight();
34295 },
34296 IsItemFiltered: function (index) {
34297  return ASPx.GetElementDisplay(this.GetItemRow(index));
34298 },
34299 InsertItem: function (index, itemProperties) {
34300  this.listBox.InsertItemRow(index, itemProperties);
34301 },
34302 InitializeInternalCheckBoxCollection: function () {
34303  var count = this.GetItemCount();
34304  var enabled = this.listBox.GetEnabled();
34305  var changeEventMethod = ASPx.Attr.ChangeEventsMethod(enabled);
34306  for (var i = 0; i < count; i++)
34307   this.listBox.AddInternalCheckBoxToCollectionCore(i, enabled, changeEventMethod);
34308 },
34309 ApplyFilterToItem: function (index, isSatisfy, savePrevState, isFilterReset) {
34310  var itemRow = this.GetItemRow(index);
34311  if (savePrevState) {
34312   var newDisplayValue = isSatisfy ? "" : "none";
34313   ASPx.Attr.ChangeStyleAttribute(itemRow, "display", newDisplayValue);
34314  }
34315  else
34316   ASPx.SetElementDisplay(itemRow, isSatisfy);
34317 },
34318 RestorePrevFilteredState: function (index) {
34319  ASPx.Attr.RestoreStyleAttribute(this.GetItemRow(index), "display");
34320 },
34321 GetItemsHeight: function () {
34322  return this.listBox.GetListTableHeight();
34323 },
34324 GetItemsWidth: function() {
34325  return this.listTable.offsetWidth;
34326 },
34327 GetNewItemIndexInFilteredRange: function(selectedIndex, step) {
34328  var rows = Array.prototype.slice.call(this.listTable.rows);
34329  var filteredRows = rows.filter(function(row) { 
34330   return ASPx.GetElementDisplay(row);
34331  });
34332  var selectedRow = this.GetItemRow(selectedIndex);
34333  var itemIndexInFilteredRange = ASPx.Data.ArrayIndexOf(filteredRows, selectedRow);
34334  var newItemIndexInFilteredRange = itemIndexInFilteredRange + step;
34335  if(newItemIndexInFilteredRange >= filteredRows.length)
34336   newItemIndexInFilteredRange = filteredRows.length - 1;
34337  else if(newItemIndexInFilteredRange < 0)
34338   newItemIndexInFilteredRange = 0;
34339  var newSelectedRow = filteredRows[newItemIndexInFilteredRange];
34340  return this.GetItemIndexByRow(newSelectedRow);
34341 }
34342});
34343var ListBoxItemsVirtualManager = ASPx.CreateClass(ListBoxItemsManagerBase, {
34344 Initialize: function () {
34345  ListBoxItemsManagerBase.prototype.Initialize.call(this);
34346  this.virtualScrollTopInvisibleItemsCount = 1;
34347  this.virtualScrollBottomInvisibleItemsCount = 1;
34348  this.virtualScrollItemHeight = 0;
34349  this.virtualEmptyItemWidth = 0;
34350  this.showFilterButtonWidthCounted = false;
34351  this.isScrollProcessingActivated = true;
34352  this.InitializeItemRows();
34353  this.virtualScrollVisibleItemIndices = [];
34354 },
34355 GetItemIndexByRow: function (itemRow) {
34356  return itemRow.itemIndex;
34357 },
34358 GetItemCount: function () {
34359  return this.deserializedItems.length;
34360 },
34361 GetItem: function(index, preventEncodeText) {
34362  if (index < 0 || index >= this.GetItemCount())
34363   return null;
34364  var deserializedItem = this.deserializedItems[index];
34365  var itemTexts = this.AdjustItemTexts(deserializedItem, preventEncodeText);
34366  var result = new ASPxClientListBoxItem(this.listBox, index, itemTexts, deserializedItem.value,
34367   deserializedItem.imageUrl, this.listBox.GetIsItemSelected(index));
34368  result.insertOrderIndex = deserializedItem.insertOrderIndex;
34369  return result;
34370 },
34371 GetItemHtmlContent: function(index) {
34372  return this.deserializedItems[index] && this.deserializedItems[index].htmlContent;
34373 },
34374 AdjustItemTexts: function (item, preventEncodeText) {
34375  var itemInnerTexts = this.GetItemInnerTexts(item, preventEncodeText);
34376  if (this.listBox.IsMultiColumn()) {
34377   for (var i = itemInnerTexts.length; i < this.listBox.columnFieldNames.length; i++)
34378    itemInnerTexts.push("");
34379  }
34380  return itemInnerTexts;
34381 },
34382 GetItemInnerTexts: function(item, preventEncodeText) {
34383  if(!item.texts)
34384   return item.texts;
34385  var adjustedItemTexts = [];
34386  for(var i = 0; i < item.texts.length; i++) {
34387   var itemText = item.texts[i] || "";
34388   if(!this.listBox.encodeHtml && !preventEncodeText)
34389    itemText = this.GetEncodedItemInnerText(itemText);
34390   adjustedItemTexts[i] = itemText;
34391  }
34392  return adjustedItemTexts;
34393 },
34394 GetEncodedItemInnerText: function(itemText) {
34395  var result = itemText;
34396  var encodedItemText = ASPx.Str.EncodeHtml(itemText);
34397  if(itemText !== encodedItemText) {
34398   var div = document.createElement("DIV");
34399   ASPx.SetInnerHtml(div, itemText);
34400   result = ASPx.GetInnerText(div);
34401  }
34402  return result;
34403 },
34404 GetVisibleItemCount: function () {
34405  return this.filteredItemIndices.length;
34406 },
34407 GetItemsHeight: function () {
34408  this.EnsureVirtualScrollItemHeight();
34409  return this.filteredItemIndices.length * this.virtualScrollItemHeight;
34410 },
34411 GetItemsWidth: function() {
34412  var listTableOffsetWidth = this.listTable.offsetWidth;
34413  var showFilterButton = this.listBox.GetShowFilterButton();
34414  if(showFilterButton && !this.showFilterButtonWidthCounted) {
34415   listTableOffsetWidth += showFilterButton.GetMainElement().offsetWidth;
34416   this.showFilterButtonWidthCounted = true;
34417  } 
34418  var itemsWidth = this.UseVirtualItemWidth() ?
34419   Math.max(this.visibleItemTextMaxWidth + this.virtualEmptyItemWidth, listTableOffsetWidth)
34420   : listTableOffsetWidth;
34421  return itemsWidth;
34422 },
34423 UseVirtualItemWidth: function() {
34424  return !this.IsFixedWidth() && !this.listBox.hasDecoratedItems && !this.IsItemTextWrapEnabled();
34425 },
34426 IsFixedWidth: function() {
34427  return this.listBox.IsMultiColumn() || this.IsStandaloneListBoxWithFixedWidth();
34428 },
34429 IsStandaloneListBoxWithFixedWidth: function() {
34430  return !this.listBox.isComboBoxList && this.listBox.width !== "";
34431 },
34432 GetFirstRenderedItem: function () {
34433  for (var i = 0; i < this.listTable.rows.length; i++)
34434   if (this.listTable.rows[i].itemIndex !== undefined)
34435    return this.GetItem(this.listTable.rows[i].itemIndex);
34436  return null;
34437 },
34438 GetLastRenderedItem: function () {
34439  for (var i = this.listTable.rows.length - 1; i >= 0; i--)
34440   if (this.listTable.rows[i].itemIndex !== undefined)
34441    return this.GetItem(this.listTable.rows[i].itemIndex);
34442  return null;
34443 },
34444 GetDefaultItemHeight: function (index) {
34445  return this.virtualScrollItemHeight;
34446 },
34447 ResetItemHeightIfRequired: function () {
34448  var firstItemRow = this.GetFirstVisibleItemRow();
34449  var isResetRequired = firstItemRow && this.GetVirtualScrollItemHeight(firstItemRow) !== this.virtualScrollItemHeight;
34450  if(isResetRequired)
34451   this.virtualScrollItemHeight = 0;
34452  return isResetRequired;
34453 },
34454 GetTopSpacersHeight: function () {
34455  return ListBoxItemsManagerBase.prototype.GetTopSpacersHeight.call(this) + this.GetVirtualScrollTopSpacer().clientHeight;
34456 },
34457 GetItemTopOffset: function (index) {
34458  var baseItemTopOffset = this.GetItemTopOffsetCore(index);
34459  if(baseItemTopOffset == 0) {
34460   var renderedItemRange = this.GetRenderedItemRange();
34461   if (index < renderedItemRange.startIndex || index > renderedItemRange.endIndex) {
34462    itemIndexInFilteredRange = ASPx.Data.ArrayIndexOf(this.filteredItemIndices, index);
34463    var nearestRenderedItemIndex = index < renderedItemRange.startIndex ?
34464     renderedItemRange.startIndex : renderedItemRange.endIndex;
34465    var nearestRenderedItemIndexInFilteredRange = ASPx.Data.ArrayIndexOf(this.filteredItemIndices, nearestRenderedItemIndex);
34466    return this.GetItemTopOffset(nearestRenderedItemIndex)
34467      + this.virtualScrollItemHeight * (itemIndexInFilteredRange - nearestRenderedItemIndexInFilteredRange);
34468   }
34469   return 0;
34470  }
34471  return baseItemTopOffset;
34472 },
34473 IsItemVisible: function (index) {
34474  return this.IsItemRendered(index) ? ListBoxItemsManagerBase.prototype.IsItemVisible.call(this, index) : false;
34475 },
34476 AreAllItemsVisible: function() {
34477  return this.filteredItemIndices.length === this.GetItemCount();
34478 },
34479 IsLastItemBottomEdgeVisible: function() {
34480  return this.IsItemEdgeVisible(this.GetLastFilteredItemIndex(), false, true);
34481 },
34482 ConvertItemIndexToRowIndex: function (itemIndex) {
34483  if(this.listTable.rows.length < 1)
34484   return -1;
34485  if(this.AreAllItemsVisible() && this.listBox.syncLockCount < 1 && !this.listBox.hasItemTemplate){ 
34486   var rawIndex = itemIndex - this.listTable.rows[0].itemIndex;
34487   return rawIndex >= 0 && rawIndex < this.listTable.rows.length ? rawIndex : -1;
34488  }
34489  return ASPx.Data.ArrayIndexOf(this.listTable.rows, itemIndex, function (element) { return element.itemIndex === itemIndex; });
34490 },
34491 GetScrollDivChildElementHeight: function () {
34492  return this.GetVirtualScrollTableContainer().getBoundingClientRect().height;
34493 },
34494 IsItemFiltered: function (index) {
34495  return this.deserializedItems[index] && this.deserializedItems[index].filtered;
34496 },
34497 GetFirstVisibleItem: function () { 
34498  for(var i = 0; i < this.listTable.rows.length; i++)
34499   if (this.listTable.rows[i] && ASPx.ElementContainsCssClass(this.listTable.rows[i], "dxeListBoxItemRow"))
34500    return this.listTable.rows[i].itemIndex;
34501  return -1;
34502 },
34503 GetFirstFilteredItemIndex: function() {
34504  return this.filteredItemIndices.length > 0 ? this.filteredItemIndices[0] : -1;
34505 },
34506 GetLastFilteredItemIndex: function() {
34507  return this.filteredItemIndices.length > 0 ? this.filteredItemIndices[this.filteredItemIndices.length - 1] : 
34507-1;
34508 },
34509 GetNewItemIndexInFilteredRange: function(selectedIndex, step) {
34510  var itemIndexInFilteredRange = ASPx.Data.ArrayIndexOf(this.filteredItemIndices, selectedIndex);
34511  var newItemIndexInFilteredRange = itemIndexInFilteredRange + step;
34512  if(newItemIndexInFilteredRange >= this.filteredItemIndices.length)
34513   newItemIndexInFilteredRange = this.filteredItemIndices.length - 1;
34514  else if(newItemIndexInFilteredRange < 0)
34515   newItemIndexInFilteredRange = 0;
34516  return this.filteredItemIndices[newItemIndexInFilteredRange];
34517 },
34518 ShouldRenderItemOnInsert: function (index) {
34519  if (!this.listBox.IsDisplayed())
34520   return false;
34521  if (this.GetFirstVisibleItemRow() == null)
34522   return true;
34523  if (this.IsIndexInRenderedItemRange(index))
34524   return true;
34525  if (this.filteredItemIndices.length > 0) {
34526   var startFilteredItemIndex = this.filteredItemIndices[0];
34527   var endFilteredItemIndex = this.filteredItemIndices[this.filteredItemIndices.length - 1];
34528   return index < startFilteredItemIndex && this.IsItemVisible(startFilteredItemIndex)
34529    || index > endFilteredItemIndex && this.IsItemVisible(endFilteredItemIndex);
34530  }
34531  return false;
34532 },
34533 InsertItem: function (index, itemProperties) {
34534  var shouldRenderItemOnInsert = this.ShouldRenderItemOnInsert(index);
34535  var isItemInsertedToTop = this.virtualScrollVisibleItemIndices.length > 0 && index < this.virtualScrollVisibleItemIndices[0];
34536  ASPx.Data.ArrayInsert(this.deserializedItems, this.listBox.CreateItem(index, itemProperties), index);
34537  this.deserializedItems[index].filtered = true;
34538  this.deserializedItems[index].insertOrderIndex = this.listBox.FindFreeIndex();
34539  for (var i = 0; i < this.deserializedItems.length; i++)
34540   this.deserializedItems[i].index = i;
34541  var requiredItemIndexInFilteredRange = -1;
34542  for (var i = 0; i < this.filteredItemIndices.length; i++)
34543   if (this.filteredItemIndices[i] >= index) {
34544    this.filteredItemIndices[i]++;
34545    if (requiredItemIndexInFilteredRange == -1)
34546     requiredItemIndexInFilteredRange = i;
34547   }
34548  ASPx.Data.ArrayInsert(this.filteredItemIndices, index, requiredItemIndexInFilteredRange);
34549  if (shouldRenderItemOnInsert) {
34550   this.EnsureVirtualScrollItemHeight();
34551   if (this.GetFirstVisibleItemRow() == null)
34552    this.EnsureVirtualEmptyItemWidth();
34553  }
34554  this.virtualScrollVisibleItemIndices = [];
34555  var rows = this.GetListTableRows();
34556  for (var i = 0; i < rows.length; i++) {
34557   var row = rows[i];
34558   if (row.itemIndex !== undefined && row.itemIndex >= index)
34559    row.itemIndex++;
34560   this.virtualScrollVisibleItemIndices.push(row.itemIndex);
34561  }
34562  if(shouldRenderItemOnInsert) {
34563   ASPx.Data.ArrayInsert(this.virtualScrollVisibleItemIndices, index,
34564    ASPx.Data.ArrayIndexOf(this.virtualScrollVisibleItemIndices, index,
34565    function (element) { return element > index; }));
34566   this.listBox.InsertItemRow(index, itemProperties);
34567   this.RecreateItemRows();
34568  }
34569  this.UpdateScrollTableContainerHeight();
34570  if (isItemInsertedToTop)
34571   this.UpdateVirtualScrollSpacerHeight(this.virtualScrollVisibleItemIndices);
34572  this.UpdateItemTextMaxWidth(this.GetItem(index).text);
34573  if (!this.listBox.IsDisplayed())
34574   this.listBox.ResetControlAdjustment();
34575 },
34576 RemoveItem: function(index) {
34577  var shouldRecreateItemRows = this.listBox.IsDisplayed() && this.IsIndexInRenderedItemRange(index);
34578  var shouldRemoveFromRender = this.GetItemRow(index);
34579  var isItemRemovedFromTop = this.virtualScrollVisibleItemIndices.length > 0 && index < this.virtualScrollVisibleItemIndices[0];
34580  var needUpdateItemTextMaxWidth = this.NeedUpdateItemTextMaxWidthOnRemoveItem(index);
34581  ASPx.Data.ArrayRemoveAt(this.deserializedItems, index);
34582  ASPx.Data.ArrayRemove(this.filteredItemIndices, index);
34583  for (var i = 0; i < this.deserializedItems.length; i++)
34584   this.deserializedItems[i].index = i;
34585  for (var i = 0; i < this.filteredItemIndices.length; i++)
34586   if (this.filteredItemIndices[i] > index)
34587    this.filteredItemIndices[i]--;
34588  this.virtualScrollVisibleItemIndices = [];
34589  if (shouldRemoveFromRender)
34590   this.RemoveItemCore(index);
34591  var rows = this.GetListTableRows();
34592  for (var i = 0; i < rows.length; i++) {
34593   var row = rows[i];
34594   if (row.itemIndex !== undefined && row.itemIndex > index)
34595    row.itemIndex--;
34596   this.virtualScrollVisibleItemIndices.push(row.itemIndex);
34597  }
34598  if (shouldRecreateItemRows)
34599   this.RecreateItemRows();
34600  this.UpdateScrollTableContainerHeight();
34601  if (isItemRemovedFromTop)
34602   this.UpdateVirtualScrollSpacerHeight(this.virtualScrollVisibleItemIndices);
34603  if (needUpdateItemTextMaxWidth) {
34604   this.itemTextMaxWidth = 0;
34605   this.visibleItemTextMaxWidth = 0;
34606   for (var i = 0; i < this.GetItemCount() ; i++)
34607    this.UpdateItemTextMaxWidth(this.GetItem(i).text);
34608  }
34609  if (!this.listBox.IsDisplayed())
34610   this.listBox.ResetControlAdjustment();
34611 },
34612 ClearItems: function () {
34613  this.ClearItemsCore();
34614  this.deserializedItems = [];
34615  this.filteredItemIndices = [];
34616  this.virtualScrollVisibleItemIndices = [];
34617  if (this.listBox.isComboBoxList) {
34618   this.itemTextMaxWidth = 0;
34619   this.visibleItemTextMaxWidth = 0;
34620  }
34621  this.UpdateScrollTableContainerHeight();
34622  if (!this.listBox.IsDisplayed())
34623   this.listBox.ResetControlAdjustment();
34624 },
34625 CreateNewItemRow: function (index) {
34626  var newItemRow = ListBoxItemsManagerBase.prototype.CreateNewItemRow.call(this, index);
34627  newItemRow.itemIndex = index;
34628  return newItemRow;
34629 },
34630 Adjust: function () {
34631  if (this.GetItemCount() == 0 || !this.listBox.IsDisplayed())
34632   return;
34633  this.EnsureVirtualScrollItemHeight();
34634  this.EnsureVirtualEmptyItemWidth();
34635  this.RecreateItemRows();
34636  this.FixItemTruncatingIfRequired();
34637  this.listBox.InitializePageSize();
34638  if(!this.listBox.isComboBoxList)
34639   this.listBox.CorrectWidth();
34640 },
34641 UpdateItemTextMaxWidth: function (itemText, isFiltering) {
34642  if (!this.UseVirtualItemWidth())
34643   return;
34644  if (!ASPx.IsExists(this.visibleItemTextMaxWidth))
34645   this.visibleItemTextMaxWidth = 0;
34646  this.visibleItemTextMaxWidth = Math.max(this.GetItemTextWidth(itemText), this.visibleItemTextMaxWidth);
34647  if (!isFiltering)
34648   this.itemTextMaxWidth = this.visibleItemTextMaxWidth;
34649 },
34650 GetItemTextWidth: function (itemText) {
34651  return Math.round(this.GetItemTextMeasureContext().measureText(itemText).width);
34652 },
34653 GetItemTextMeasureContext: function() {
34654  if (!this.itemTextMeasureContext) {
34655   var itemTextMeasureCanvas = document.createElement("canvas");
34656   this.itemTextMeasureContext = itemTextMeasureCanvas.getContext("2d");
34657   var mainElementStyle = ASPx.GetCurrentStyle(this.listBox.GetMainElement());
34658   var mainElementFont = mainElementStyle.font ? mainElementStyle.font :
34659    mainElementStyle.fontStyle + " " + mainElementStyle.fontVariant + " " + mainElementStyle.fontWeight + " "
34660     + mainElementStyle.fontSize + " / " + mainElementStyle.lineHeight + " " + mainElementStyle.fontFamily;
34661   this.itemTextMeasureContext.font = mainElementFont;
34662  }
34663  return this.itemTextMeasureContext;
34664 },
34665 NeedUpdateItemTextMaxWidthOnRemoveItem: function(index) {
34666  return this.UseVirtualItemWidth() && this.listBox.isComboBoxList && this.IsItemWithMaxText(this.GetItem(index).text);
34667 },
34668 BeforeClientFiltering: function () {
34669  if (this.listBox.isComboBoxList)
34670   this.visibleItemTextMaxWidth = 0;
34671 },
34672 IsItemWithMaxText: function(itemText) {
34673  return this.GetItemTextWidth(itemText) === this.itemTextMaxWidth;
34674 },
34675 ApplyFilterToItem: function (index, isSatisfy, savePrevState, isFilterReset) {
34676  if (savePrevState && !ASPx.IsExists(this.deserializedItems[index].savedFiltered))
34677   this.deserializedItems[index].savedFiltered = this.deserializedItems[index].filtered;
34678  this.ChangeItemFilteredFlag(index, isSatisfy, isFilterReset);
34679 },
34680 RestorePrevFilteredState: function (index) {
34681  var savedFilteredState = this.deserializedItems[index].savedFiltered;
34682  if (ASPx.IsExists(savedFilteredState)) {
34683   this.ChangeItemFilteredFlag(index, savedFilteredState);
34684   delete this.deserializedItems[index].savedFiltered;
34685  }
34686 },
34687 ChangeItemFilteredFlag: function (index, newValue, isFilterReset) {
34688  var item = this.deserializedItems[index];
34689  item.filtered = newValue;
34690  if (!isFilterReset && this.listBox.isComboBoxList && newValue)
34691   this.UpdateItemTextMaxWidth(item.text);
34692 },
34693 OnEndItemsFiltering: function () {
34694  if (this.virtualScrollItemHeight && this.listBox.IsDisplayed()) {
34695   this.RecreateItemRows();
34696   this.UpdateScrollTableContainerHeight();
34697   if(!this.listBox.isComboBoxList)
34698    this.FixItemTruncatingIfRequired();
34699  }
34700 },
34701 ChangeItemsFilteredState: function (action) {
34702  this.filteredItemIndices = [];
34703  ListBoxItemsManagerBase.prototype.ChangeItemsFilteredState.call(this, action);
34704 },
34705 AfterChangeItemFilteredStateAction: function (index) {
34706  if (this.IsItemFiltered(index))
34707   this.filteredItemIndices.push(index);
34708 },
34709 RewriteFilteredItemIndices: function (newFilteredItemIndices) {
34710  this.filteredItemIndices = newFilteredItemIndices;
34711 },
34712 MakeAllItemsVisible: function () {
34713  ListBoxItemsManagerBase.prototype.MakeAllItemsVisible.call(this);
34714  this.visibleItemTextMaxWidth = this.itemTextMaxWidth;
34715 },
34716 InsertTempFirstItemRow: function() {
34717  try {
34718   this.listBox.LockRunStartupSciptsInItemRow();
34719   this.RecreateItemRowsByVisibleIndices([0]);
34720  }
34721  finally {
34722   this.listBox.UnlockRunStartupSciptsInItemRow();
34723  }
34724 },
34725 EnsureVirtualScrollItemHeight: function () {
34726  if (this.virtualScrollItemHeight == 0) {
34727   var firstItemRow = this.GetFirstVisibleItemRow();
34728   if (firstItemRow)
34729    this.virtualScrollItemHeight = this.GetVirtualScrollItemHeight(firstItemRow);
34730   else if(this.GetItemCount() > 0) {
34731    this.virtualScrollVisibleItemIndices = [];
34732    this.InsertTempFirstItemRow();
34733    firstItemRow = this.GetFirstVisibleItemRow();
34734    if(firstItemRow)
34735     this.virtualScrollItemHeight = this.GetVirtualScrollItemHeight(firstItemRow);
34736    this.RecreateItemRowsByVisibleIndices([]);
34737   }
34738   this.UpdateScrollTableContainerHeight();
34739  }
34740 },
34741 GetVirtualScrollItemHeight: function(virtualScrollItemRow) {
34742  return virtualScrollItemRow.getBoundingClientRect().height;
34743 },
34744 EnsureVirtualEmptyItemWidth: function () {
34745  if (this.virtualEmptyItemWidth == 0 && this.UseVirtualItemWidth() && this.GetItemCount() > 0) {
34746   this.InsertTempFirstItemRow();
34747   var firstItemRow = this.GetFirstVisibleItemRow();
34748   var itemTextCell = this.listBox.GetItemFirstTextCell(0);
34749   ASPx.SetInnerHtml(itemTextCell, "");
34750   ASPx.AddClassNameToElement(this.listTable, listTableCollapsedClassName);
34751   this.virtualEmptyItemWidth = firstItemRow.offsetWidth;
34752   ASPx.RemoveClassNameFromElement(this.listTable, listTableCollapsedClassName);
34753   this.RecreateItemRowsByVisibleIndices([]);
34754  }
34755 },
34756 UpdateScrollTableContainerHeight: function () {
34757  var virtualScrollTableContainer = this.GetVirtualScrollTableContainer();
34758  if (virtualScrollTableContainer)
34759   ASPx.SetStyles(virtualScrollTableContainer, {
34760    height: this.filteredItemIndices.length * this.virtualScrollItemHeight
34761     + this.listBox.GetTopScrollSpacerHeight()
34762     + this.listBox.GetBottomScrollSpacerHeight()
34763   });
34764 },
34765 UpdateVirtualScrollSpacerHeight: function(visibleIndices) {
34766  var firstVisibleIndex = visibleIndices.length > 0 && this.filteredItemIndices.length > 0 ? ASPx.Data.ArrayIndexOf(this.filteredItemIndices, visibleIndices[0]) : 0;
34767  var topSpacerHeight = this.virtualScrollItemHeight !== undefined ? firstVisibleIndex * this.virtualScrollItemHeight : 0;
34768  ASPx.SetStyles(this.GetVirtualScrollTopSpacer(), { height: topSpacerHeight });
34769 },
34770 OnScrollSpacerVisibilityChanged: function() {
34771  this.UpdateScrollTableContainerHeight();
34772 },
34773 SetItemHtml: function(index, html) {
34774  this.deserializedItems[index].htmlContent = html;
34775 },
34776 SetItemTooltip: function (index, tooltip) {
34777  this.deserializedItems[index].tooltip = tooltip;
34778 },
34779 SetItemAttribute: function(index, attrName, attrValue) {
34780  if(!this.deserializedItems[index].attributes)
34781   this.deserializedItems[index].attributes = {};
34782  this.deserializedItems[index].attributes[attrName] = attrValue;
34783 },
34784 AddClassNameToCssClass: function(cssClass, className) {
34785  return (cssClass == "" || cssClass == undefined) ? className : cssClass + " " + className;
34786 },
34787 RemoveClassNameFromCssClass: function (cssClass, className) {
34788  var updClassName = " " + cssClass + " ";
34789  var newClassName = updClassName.replace(" " + className + " ", " ");
34790  return updClassName.length != newClassName.length ? ASPx.Str.Trim(newClassName) : cssClass;
34791 },
34792 AddItemCssClass: function (index, className) {
34793  this.deserializedItems[index].cssClass = this.AddClassNameToCssClass(this.deserializedItems[index].cssClass, className);
34794 },
34795 RemoveItemCssClass: function (index, className) {
34796  this.deserializedItems[index].cssClass = this.RemoveClassNameFromCssClass(this.deserializedItems[index].cssClass, className);
34797 },
34798 SetItemTextCellHtml: function (itemIndex, textCellIndex, html) {
34799  if (!this.deserializedItems[itemIndex].htmlContents)
34800   this.deserializedItems[itemIndex].htmlContents = [];
34801  this.SetItemTextCellInfoValue(this.deserializedItems[itemIndex].htmlContents, textCellIndex, html);
34802 },
34803 SetItemTextCellTooltip: function (itemIndex, textCellIndex, tooltip) {
34804  if (!this.deserializedItems[itemIndex].cellTooltips)
34805   this.deserializedItems[itemIndex].cellTooltips = [];
34806  this.SetItemTextCellInfoValue(this.deserializedItems[itemIndex].cellTooltips, textCellIndex, tooltip);
34807 },
34808 SetItemTextCellAttribute: function(itemIndex, textCellIndex, attrName, attrValue) {
34809  if(!this.deserializedItems[itemIndex].cellAttributes)
34810   this.deserializedItems[itemIndex].cellAttributes = [];
34811  var setValueAction = function(itemInfo, value) {
34812   if(!itemInfo.value)
34813    itemInfo.value = {};
34814   itemInfo.value[value.attrName] = value.attrValue;
34815  };
34816  this.SetItemTextCellInfoValue(this.deserializedItems[itemIndex].cellAttributes, textCellIndex,
34817   { attrName: attrName, attrValue: attrValue }, setValueAction);
34818 },
34819 AddItemTextCellCssClass: function (itemIndex, textCellIndex, className) {
34820  if (!this.deserializedItems[itemIndex].cellCssClasses)
34821   this.deserializedItems[itemIndex].cellCssClasses = [];
34822  var newCssClass = this.AddClassNameToCssClass(this.deserializedItems[itemIndex].cellCssClasse
34822s[textCellIndex], className);
34823  this.SetItemTextCellInfoValue(this.deserializedItems[itemIndex].cellCssClasses, textCellIndex, newCssClass);
34824 },
34825 RemoveItemTextCellCssClass: function (itemIndex, textCellIndex, className) {
34826  if (!this.deserializedItems[itemIndex].cellCssClasses)
34827   this.deserializedItems[itemIndex].cellCssClasses = [];
34828  var newCssClass = this.RemoveClassNameFromCssClass(this.deserializedItems[itemIndex].cellCssClasses[textCellIndex], className);
34829  this.SetItemTextCellInfoValue(this.deserializedItems[itemIndex].cellCssClasses, textCellIndex, newCssClass);
34830 },
34831 SetItemTextCellInfoValue: function (infoArray, textCellIndex, value, setValueAction) {
34832  var itemInfo = null;
34833  var filteredArray = infoArray.filter(function (info) { return info.index === textCellIndex; });
34834  if (filteredArray.length == 0) {
34835   itemInfo = { index: textCellIndex };
34836   infoArray.push(itemInfo);
34837  }
34838  else
34839   itemInfo = filteredArray[0];
34840  if(setValueAction)
34841   setValueAction(itemInfo, value);
34842  else
34843   itemInfo.value = value;
34844 },
34845 InitializeItems: function(items, itemsValue) {
34846  this.deserializedItems = this.listBox.DeserializeItems(items);
34847  this.filteredItemIndices = [];
34848  this.visibleItemTextMaxWidth = 0;
34849  this.itemTextMaxWidth = 0;
34850  for (var i = 0; i < this.deserializedItems.length; i++) {
34851   this.listBox.AdjustItemProperties(this.deserializedItems[i]);
34852   itemsValue[i] = this.deserializedItems[i].value;
34853   this.filteredItemIndices[i] = this.deserializedItems[i].index;
34854   this.deserializedItems[i].filtered = true;
34855   this.deserializedItems[i].insertOrderIndex = this.listBox.FindFreeIndex();
34856   this.UpdateItemTextMaxWidth(this.deserializedItems[i].text);
34857  }
34858 },
34859 InitializeItemRows: function () {
34860  var topSpacer = ASPx.CreateHtmlElement("DIV");
34861  topSpacer.id = this.listBox.name + "VirtualScrollTopSpacer";
34862  var tableContainer = ASPx.CreateHtmlElement("DIV");
34863  tableContainer.id = this.listBox.name + ListBoxVirtualScrollTableContainerIDPostfix;
34864  tableContainer.appendChild(topSpacer);
34865  var scrollDiv = this.listBox.GetScrollDivElement();
34866  ASPx.MoveChildrenToElement(scrollDiv, tableContainer);
34867  scrollDiv.appendChild(tableContainer);
34868  ASPx.SetStyles(tableContainer, { overflow: "hidden", width: "100%" });
34869  ASPx.Evt.AttachEventToElement(scrollDiv, "scroll", function () {
34870   if(this.IsScrollActivated()) {
34871    this.RecreateItemRows();
34872    this.CorrectScrollTableContainerHeightByContent();
34873   } else
34874    this.ActivateScrollHandler();
34875  }.bind(this));
34876 },
34877 RecreateItemRows: function() {
34878  if(!this.listBox.IsDisplayed()) return;
34879  var scrollDiv = this.listBox.GetScrollDivElement();
34880  if(!scrollDiv) return;
34881  var scrollDivHeight = scrollDiv.clientHeight;
34882  var scrollTop = scrollDiv.scrollTop - this.listBox.GetTopScrollSpacerHeight();
34883  if(scrollTop < 0)
34884   scrollTop = 0;
34885  var firstVisibleItemIndex = Math.floor(scrollTop / this.virtualScrollItemHeight);
34886  var lastVisibleItemIndex = Math.floor((scrollTop + scrollDivHeight) / this.virtualScrollItemHeight);
34887  var topRenderedItemIndex = Math.max(firstVisibleItemIndex - this.virtualScrollTopInvisibleItemsCount, 0);
34888  var bottomRenderedItemIndex = Math.min(lastVisibleItemIndex + this.virtualScrollBottomInvisibleItemsCount, this.filteredItemIndices.length - 1);
34889  this.RecreateItemRowsCore(topRenderedItemIndex, bottomRenderedItemIndex);
34890  if(typeof(ASPxClientHint) != "undefined")
34891   this.UpdateHintControl();
34892  this.listBox.AssignEllipsisTooltips();
34893 },
34894 RecreateItemRowsCore: function(topRenderedItemIndex, bottomRenderedItemIndex) {
34895  if(topRenderedItemIndex > bottomRenderedItemIndex && this.filteredItemIndices.length > 0)
34896   return;
34897  var newVisibleIndices = this.filteredItemIndices.slice(topRenderedItemIndex, bottomRenderedItemIndex + 1);
34898  this.RecreateItemRowsByVisibleIndices(newVisibleIndices);
34899  this.OnDecoratedItemsRendering();
34900  this.CreateItemRowsInFreeSpace(false);
34901  if(this.listBox.NeedToHandleCellWidth())
34902   this.listBox.CorrectCellNullWidthStyle(this.GetFirstVisibleItemRow());
34903 },
34904 UpdateHintControl: function() {
34905  ASPxClientHint.hideByTargetsContainerElement(this.listTable, true);
34906  ASPxClientHint.Update();
34907 },
34908 CorrectScrollTableContainerHeightByContent: function() {
34909  if(this.virtualScrollVisibleItemIndices.length == 0) return;
34910  var scrollTableContainer = this.GetVirtualScrollTableContainer();
34911  if(!scrollTableContainer) return;
34912  var scrollDiv = this.listBox.GetScrollDivElement();
34913  var containerHeight = scrollTableContainer.getBoundingClientRect().height;
34914  var scrollDivHeight = scrollDiv.clientHeight;
34915  var containerOffsetTop = scrollTableContainer.offsetTop - scrollDiv.offsetTop;
34916  var isScrolledToBottomEdge = scrollDiv.scrollTop + scrollDivHeight >= containerOffsetTop + containerHeight;
34917  if(isScrolledToBottomEdge || this.IsLastItemBottomEdgeVisible()) {
34918   var contentHeight = this.GetScrollContentHeight();
34919   var heightError = 0.01;
34920   if(Math.abs(contentHeight - containerHeight) > heightError) {
34921    this.DeactivateScrollHandler();
34922    scrollTableContainer.style.height = contentHeight + "px";
34923    setTimeout(function() {
34924     scrollDiv.scrollTop = containerOffsetTop + scrollTableContainer.getBoundingClientRect().height - scrollDivHeight + 1;
34925     var isListBoxDisplayed = this.listBox.IsDisplayed();
34926     if(!isListBoxDisplayed)
34927      this.ActivateScrollHandler();
34928     if(isListBoxDisplayed && this.GetVisibleItemCount() > 0 && !this.IsLastItemBottomEdgeVisible()) {
34929      this.RecreateItemRowsByVisibleIndices([this.GetLastFilteredItemIndex()], true);
34930      scrollTableContainer.style.height = this.GetScrollContentHeight() + "px";
34931      this.CreateItemRowsInFreeSpace(true);
34932     }
34933    }.aspxBind(this), 0);
34934   }
34935  }
34936 },
34937 CreateItemRowsInFreeSpace: function(toTop, edgeRenderedItemIndexInFilteredRange) {
34938  if(this.virtualScrollVisibleItemIndices.length == 0)
34939   return;
34940  var edgeRenderedItemIndex = this.virtualScrollVisibleItemIndices[toTop ? 0 : this.virtualScrollVisibleItemIndices.length - 1];
34941  var edgeFilteredItemIndex = this.filteredItemIndices[toTop ? 0 : this.filteredItemIndices.length - 1];
34942  if(edgeRenderedItemIndex !== edgeFilteredItemIndex && this.IsItemVisible(edgeRenderedItemIndex)) {
34943   edgeRenderedItemIndexInFilteredRange = edgeRenderedItemIndexInFilteredRange || ASPx.Data.ArrayIndexOf(this.filteredItemIndices, edgeRenderedItemIndex);
34944   var newRenderedItemIndexInFilteredRange = toTop ? --edgeRenderedItemIndexInFilteredRange : ++edgeRenderedItemIndexInFilteredRange;
34945   var newRenderedItemIndex = this.filteredItemIndices[newRenderedItemIndexInFilteredRange];
34946   var newRenderedIndices = this.virtualScrollVisibleItemIndices.slice();
34947   if(toTop)
34948    newRenderedIndices.unshift(newRenderedItemIndex);
34949   else
34950    newRenderedIndices.push(newRenderedItemIndex);
34951   this.RecreateItemRowsByVisibleIndices(newRenderedIndices, toTop);
34952   if(toTop) {
34953    this.GetVirtualScrollTableContainer().style.height = this.GetScrollContentHeight() + "px";
34954    this.listBox.MakeItemVisible(this.filteredItemIndices[this.filteredItemIndices.length - 1]);
34955   }
34956   this.CreateItemRowsInFreeSpace(toTop, newRenderedItemIndexInFilteredRange);
34957  }
34958 },
34959 GetScrollContentHeight: function() {
34960  return this.GetVirtualScrollTopSpacer().getBoundingClientRect().height
34961   + this.listBox.GetTopScrollSpacerHeight() + this.listBox.GetBottomScrollSpacerHeight()
34962   + this.listTable.getBoundingClientRect().height;
34963 },
34964 FixItemTruncatingIfRequired: function() {
34965  var scrollDiv = this.listBox.GetScrollDivElement();
34966  var scrollTableContainer = this.GetVirtualScrollTableContainer();
34967  if(scrollTableContainer && scrollDiv.offsetHeight >= scrollTableContainer.offsetHeight) {
34968   this.CorrectScrollTableContainerHeightByContent();
34969   if(scrollDiv.offsetHeight < scrollTableContainer.offsetHeight)
34970    scrollDiv.style.height = scrollTableContainer.style.height;
34971  }
34972 },
34973 RecreateItemRowsByVisibleIndices: function (newVisibleIndices, keepTopSpacerHeight) {
34974  newVisibleIndices = newVisibleIndices || [];
34975  var indicesToRemove = this.virtualScrollVisibleItemIndices.filter(function (index) { return newVisibleIndices.indexOf(index) === -1; });
34976  var indicesToInsert = newVisibleIndices.filter(function (index) { return this.virtualScrollVisibleItemIndices.indexOf(index) === -1; }.bind(this));
34977  this.listBox.LockSynchronization();
34978  for (var i = 0; i < indicesToRemove.length; i++) {
34979   var itemIndex = indicesToRemove[i];
34980   this.listBox.RemoveItemRow(itemIndex);
34981  }
34982  for (var i = 0; i < indicesToInsert.length; i++) {
34983   var itemIndex = indicesToInsert[i];
34984   this.listBox.InsertItemRow(itemIndex, this.deserializedItems[itemIndex]);
34985   var isItemSelected = this.listBox.GetIsItemSelected(itemIndex);
34986   var stateController = typeof (ASPx.GetStateController) != "undefined" ? ASPx.GetStateController() : null;
34987   this.listBox.SetItemSelectionAppearance(itemIndex, isItemSelected, stateController, false);
34988   if (this.listBox.GetIsCheckColumnExists())
34989    this.listBox.SetCheckBoxChecked(itemIndex, isItemSelected);
34990   this.listBox.ChangeEnabledStateItem(itemIndex, this.listBox.clientEnabled, ASPx.GetStateController());
34991  }
34992  this.listBox.TryApplyHighlighting();
34993  this.listBox.UnlockSynchronization();
34994  if(!keepTopSpacerHeight)
34995   this.UpdateVirtualScrollSpacerHeight(newVisibleIndices);
34996  this.listBox.InitDXTextAttributes();
34997  this.virtualScrollVisibleItemIndices = newVisibleIndices;
34998 },
34999 RemoveHoverStateItemCore: function (controller, itemCellsIdSuffixes) {
35000  ListBoxItemsManagerBase.prototype.RemoveHoverStateItemCore.call(this, controller, itemCellsIdSuffixes);
35001  var range = this.GetRenderedItemRange();
35002  for (var i = range.startIndex; i <= range.endIndex; i++) {
35003   if(i >= 0)
35004    this.RemoveItemStateHoverItem(controller, itemCellsIdSuffixes, i);
35005  }
35006 },
35007 AddStateItemsCore: function (controller, clearCache, itemCellsIdSuffixes, hoverItemOnly) {
35008  ListBoxItemsManagerBase.prototype.AddStateItemsCore.call(this, controller, clearCache, itemCellsIdSuffixes, hoverItemOnly);
35009  var range = this.GetRenderedItemRange();
35010  for (var i = range.startIndex; i <= range.endIndex; i++) {
35011   if (i >= 0)
35012    this.AddItemStateItems(controller, clearCache, itemCellsIdSuffixes, hoverItemOnly, i);
35013  }
35014 },
35015 GetVirtualScrollTableContainer: function () {
35016  return this.listBox.tempCache.Get("virtualScrollTableContainer", this.GetVirtualScrollTableContainerCore.aspxBind(this), this.listBox);
35017 },
35018 GetVirtualScrollTableContainerCore: function () {
35019  if (!ASPx.IsExistsElement(this.listBox.virtualScrollTableContainer))
35020   this.listBox.virtualScrollTableContainer = ASPx.GetElementById(this.listBox.name + ListBoxVirtualScrollTableContainerIDPostfix);
35021  return this.listBox.virtualScrollTableContainer;
35022 },
35023 GetVirtualScrollTopSpacer: function () {
35024  return this.listBox.tempCache.Get("virtualScrollTopSpacer", this.GetVirtualScrollTopSpacerCore.aspxBind(this), this.listBox);
35025 },
35026 GetVirtualScrollTopSpacerCore: function () {
35027  if (!ASPx.IsExistsElement(this.listBox.virtualScrollTopSpacer))
35028   this.listBox.virtualScrollTopSpacer = ASPx.GetElementById(this.listBox.name + "VirtualScrollTopSpacer");
35029  return this.listBox.virtualScrollTopSpacer;
35030 },
35031 GetRenderedItemRange: function () {
35032  var firstRenderedItem = this.GetFirstRenderedItem();
35033  var lastRenderedItem = this.GetLastRenderedItem();
35034  return {
35035   startIndex: firstRenderedItem ? firstRenderedItem.index : -1,
35036   endIndex: lastRenderedItem ? lastRenderedItem.index : -1
35037  };
35038 },
35039 IsIndexInRenderedItemRange: function(index) {
35040  var renderedItemRange = this.GetRenderedItemRange();
35041  return index >= renderedItemRange.startIndex && index <= renderedItemRange.endIndex;
35042 },
35043 IsItemRendered: function (itemIndex) {
35044  return this.GetItemRow(itemIndex) !== null;
35045 },
35046 IsItemTextWrapEnabled: function() {
35047  if(!ASPx.IsExists(this.enableItemTextWrap)) {
35048   var sampleItemFirstTextCell = this.listBox.GetSampleItemFirstTextCell();
35049   this.enableItemTextWrap = sampleItemFirstTextCell && ASPx.GetCurrentStyle(sampleItemFirstTextCell).whiteSpace !== "nowrap";
35050  }
35051  return this.enableItemTextWrap;
35052 },
35053 OnDecoratedItemsRendering: function () {
35054  if(this.listBox.hasDecoratedItems && !this.IsFixedWidth() && this.listBox.IsDisplayed() && !this.IsItemTextWrapEnabled())
35055   this.listBox.CorrectWidth();
35056 },
35057 DeactivateScrollHandler: function() { 
35058  this.isScrollProcessingActivated = false;
35059 },
35060 ActivateScrollHandler: function() { 
35061  this.isScrollProcessingActivated = true;
35062 },
35063 IsScrollActivated: function() {
35064  return this.isScrollProcessingActivated;
35065 }
35066});
35067var ASPxClientListEdit = ASPx.CreateClass(ASPxClientEdit, {
35068 constructor: function(name) {
35069  this.constructor.prototype.constructor.call(this, name);
35070  this.SelectedIndexChanged = new ASPxClientEvent();
35071  this.savedSelectedIndex = -1;
35072 },
35073 FindInputElement: function() {
35074  return this.FindStateInputElement();
35075 },
35076 FindStateInputElement: function(){
35077  return document.getElementById(this.name + leVISuffix);
35078 },
35079 GetItem: function(index) {
35080  throw "Not implemented";
35081 },
35082 GetItemValue: function(index) {
35083  throw "Not implemented";
35084 },
35085 GetValue: function(){
35086  return this.GetItemValue(this.GetSelectedIndex());
35087 }, 
35088 GetSelectedIndexInternal: function(){
35089  return this.savedSelectedIndex;
35090 },
35091 SetSelectedIndexInternal: function(index){
35092  this.savedSelectedIndex = index;
35093 },
35094 FindItemIndexByValue: function(value){
35095  for(var i = 0; i < this.GetItemCount(); i++){
35096   if(this.GetItemValue(i) == value)
35097    return i;
35098  }
35099  return -1;
35100 },
35101 RaiseItemClick: function() {
35102  var processOnServer = this.autoPostBack;
35103  if(!this.ItemClick.IsEmpty()){
35104   var args = new ASPxClientProcessingModeEventArgs(processOnServer);
35105   this.ItemClick.FireEvent(this, args);
35106   processOnServer = args.processOnServer;
35107  }
35108  return processOnServer;
35109 },
35110 RaiseItemDoubleClick: function() {
35111  var processOnServer = this.autoPostBack;
35112  if(!this.ItemDoubleClick.IsEmpty()){
35113   var args = new ASPxClientProcessingModeEventArgs(processOnServer);
35114   this.ItemDoubleClick.FireEvent(this, args);
35115   processOnServer = args.processOnServer;
35116  }
35117  return processOnServer;
35118 },
35119 RaiseValueChangedEvent: function() {
35120  if(!this.isInitialized) return false;
35121  var processOnServer = ASPxClientEdit.prototype.RaiseValueChangedEvent.call(this);
35122  processOnServer = this.RaiseValueChangedAdditionalEvents(processOnServer);
35123  return processOnServer;
35124 },
35125 RaiseValueChangedAdditionalEvents: function(processOnServer){
35126  return this.RaiseSelectedIndexChanged(processOnServer);
35127 },
35128 RaiseSelectedIndexChanged: function (processOnServer) {
35129  this.RaiseValidationInternal();
35130  if(!this.SelectedIndexChanged.IsEmpty()){
35131   var args = new ASPxClientProcessingModeEventArgs(processOnServer);
35132   this.SelectedIndexChanged.FireEvent(this, args);
35133   processOnServer = args.processOnServer;
35134  }
35135  return processOnServer;
35136 },
35137 UpdateHiddenInputs: function(){
35138  var element = this.FindStateInputElement();
35139  if(ASPx.IsExistsElement(element)) {
35140   var value = this.GetValue();
35141   if(value == null)
35142    value = "";
35143   element.value = value;
35144  }
35145 },
35146 GetModifyEvent: function () {
35147  return this.SelectedIndexChanged;
35148 },
35149 GetSelectedItem: function(){
35150  var index = this.GetSelectedIndexInternal();
35151  return this.GetItem(index);
35152 },
35153 GetSelectedIndex: function(){
35154  return this.GetSelectedIndexInternal();
35155 },
35156 SetSelectedItem: function(item){
35157  var index = (item != null) ? item.index : -1;
35158  this.SetSelectedIndex(index);
35159 },
35160 SetSelectedIndex: function(index){
35161  this.SelectIndexSilent(index);
35162 },
35163 SelectIndexSilent: function(index){
35164  throw "Not implemented";
35165 },
35166 OnValueChanged: function () {
35167  var processOnServer = this.RaiseValueChangedEvent() && this.GetIsValid();
35168  if(processOnServer)
35169   this.SendPostBackInternal("");
35170 }
35171});
35172var ASPxClientListEditItem = ASPx.CreateClass(null, {
35173 constructor: function(listEditBase, index, text, value, imageUrl){
35174  this.listEditBase = listEditBase;
35175  this.index = index;
35176  this.imageUrl = imageUrl;
35177  this.text = text;
35178  this.value = value;
35179 }
35180});
35181var ASPxClientListBoxItem = ASPx.CreateClass(ASPxClientListEditItem, {
35182 constructor: function(listEditBase, index, texts, value, imageUrl, selected, cellStyles, cellCssClasses, cellTooltips, cellAttributes, htmlContents, style, cssClass, tooltip, attributes, htmlContent) {
35183  this.constructor.prototype.constructor.call(this, listEditBase, index, null, value, imageUrl);
35184  this.selected = !!selected;
35185  this.texts = texts;
35186  this.text = listEditBase.FormatText(texts, value);
35187  this.cellStyles = cellStyles;
35188  this.cellCssClasses = cellCssClasses;
35189  this.cellTooltips = cellTooltips;
35190  this.cellAttributes = cellAttributes;
35191  this.htmlContents = htmlContents;
35192  this.style = style;
35193  this.cssClass = cssClass;
35194  this.tooltip = tooltip;
35195  this.attributes = attributes;
35196  this.htmlContent = htmlContent;
35197 },
35198 GetColumnText: function(columnIndexOrFieldName){
35199  var columnIndex = -1;
35200  if(typeof(columnIndexOrFieldName) == "string")
35201   columnIndex = ASPx.Data.ArrayIndexOf(this.listEditBase.columnFieldNames, columnIndexOrFieldName);
35202  else if(typeof(columnIndexOrFieldName) == "number")
35203   columnIndex = columnIndexOrFieldName;
35204  return this.GetColumnTextByIndex(columnIndex);
35205 },
35206 GetColumnTextByIndex: function(columnIndex){
35207  if(0 <= columnIndex && columnIndex < this.texts.length)
35208   return this.texts[columnIndex];
35209  else
35210   return null;
35211 }
35212});
35213var ListBoxScrollCallbackHelperBase = ASPx.CreateClass(null, {
35214 constructor: function(listBoxControl) {
35215  this.listBoxControl = listBoxControl;
35216  this.itemsRange = "";
35217  this.defaultItemsRange = "0:" + (this.listBoxControl.callbackPageSize - 1);
35218 },
35219 OnScroll: function(){ },
35220 Reset: function(){ },
35221 IsScrolledToTopSpacer: function(){ return false; },
35222 IsScrolledToBottomSpacer: function(){ return false; },
35223 GetIsNeedToHideTopSpacer: function(){ return false; },
35224 GetIsNeedCallback: function(){ return false; },
35225 GetIsAnySpacerVisible: function() { return false; },
35226 GetItemsRangeForLoad: function(){ return this.defaultItemsRange; },
35227 SetItemsRangeForLoad: function(){}
35228});
35229var ListBoxScrollCallbackHelper = ASPx.CreateClass(ListBoxScrollCallbackHelperBase, {
35230 constructor: function(listBoxControl) {
35231  this.constructor.prototype.constructor.call(this, listBoxControl);
35232  this.isScrolledToTopSpacer = false;
35233  this.isScrolledToBottomSpacer = false;
35234 },
35235 OnScroll: function(){
35236  this.DetectScrollDirection();
35237  this.ResetItemsRange();
35238  if(this.GetIsAnySpacerVisible())
35239   this.RecalcItemsRangeForLoad();
35240 },
35241 DetectScrollDirection: function(){
35242  var listBoxControl = this.listBoxControl;
35243  var divElement = listBoxControl.GetScrollDivElement();
35244  var listTable = listBoxControl.GetListTable();
35245  var scrollTop = divElement.scrollTop;
35246  var scrollBottom = divElement.scrollTop + divElement.clientHeight;
35247  var isTopSpacerVisible = listBoxControl.GetScrollSpacerVisibility(true);
35248  var isBottomSpacerVisible = listBoxControl.GetScrollSpacerVisibility(false);
35249  this.isScrolledToTopSpacer = (scrollTop < parseInt(listBoxControl.GetTopSpacersHeight())) && isTopSpacerVisible;
35250  var listHeight = 0;
35251  if(listTable && listTable.tagName.toUpperCase() == "TABLE")
35252   listHeight = listTable.clientHeight;
35253  else {
35254   var itemElements = listBoxControl.GetItemElements();
35255   for(var i = 0; i < itemElements.length; i++)
35256    listHeight += itemElements[i].clientHeight;
35257  }
35258  this.isScrolledToBottomSpacer = (scrollBottom >= listBoxControl.GetTopSpacersHeight() + listHeight) && isBottomSpacerVisible;
35259 },
35260 Reset: function(){
35261  this.ResetItemsRange();
35262  this.isScrolledToTopSpacer = false;
35263  this.isScrolledToBottomSpacer = false;
35264 },
35265 ResetItemsRange: function(){
35266  this.itemsRange = "";
35267 },
35268 RecalcItemsRangeForLoad: function(){
35269  if(this.listBoxControl.isCallbackMode) {
35270   if(this.isScrolledToTopSpacer || this.isScrolledToBottomSpacer)
35271    this.SetItemsRangeForLoad(this.isScrolledToTopSpacer);
35272  }
35273 },
35274 IsScrolledToTopSpacer: function(){
35275  return this.isScrolledToTopSpacer;
35276 },
35277 IsScrolledToBottomSpacer: function(){
35278  return this.isScrolledToBottomSpacer;
35279 },
35280 GetIsAnySpacerVisible: function(){
35281  return this.isScrolledToTopSpacer || this.isScrolledToBottomSpacer;
35282 },
35283 GetIsNeedCallback: function(){
35284  return !this.GetIsItemsRangeEmpty();
35285 },
35286 GetIsNeedToHideTopSpacer: function(){
35287  return this.isScrolledToTopSpacer && this.GetIsItemsRangeEmpty();
35288 },
35289 GetItemsRangeForLoad: function(){
35290  return (!this.GetIsItemsRangeEmpty() ? this.itemsRange : this.defaultItemsRange);
35291 },
35292 SetItemsRangeForLoad: function(isForTop){
35293  var listbox = this.listBoxControl;
35294  var beginIndex = isForTop ? 
35295   listbox.serverIndexOfFirstItem - listbox.callbackPageSize : 
35296   listbox.serverIndexOfFirstItem + listbox.GetItemCount();
35297  beginIndex = beginIndex < 0 ? 0 : beginIndex;
35298  var endIndex = isForTop ? 
35299   listbox.serverIndexOfFirstItem - 1 : 
35300   beginIndex + listbox.callbackPageSize - 1;
35301  this.itemsRange = beginIndex + ":" + endIndex;
35302  this.isScrolledToTopSpacer = isForTop;
35303  this.isScrolledToBottomSpacer = !isForTop;
35304 },
35305 GetIsItemsRangeEmpty: function(){
35306  return (this.itemsRange == "" || this.itemsRange == emptyItemsRange);
35307 }
35308});
35309var ASPxClientListBoxBase = ASPx.CreateClass(ASPxClientListEdit, {
35310 constructor: function(name) {
35311  this.constructor.prototype.constructor.call(this, name);
35312  this.APILockCount = 0;
35313  this.updateSelectAllElementsLockCount = 0;
35314  this.enableSyncOnPerfCallback = false;
35315  this.scrollOnKBNavigationLockCount = 0;
35316  this.isComboBoxList = false;
35317  this.isSyncEnabled = true;
35318  this.ownerName = "";
35319  this.selectionEventsLockCount = 0;
35320  this.syncLockCount = 0;
35321  this.encodeHtml = true;
35322  this.useCaseInsensitiveSearch = true;
35323  this.serializingHelper = null;
35324  this.deletedItems = [];
35325  this.insertedItems = [];
35326  this.itemsValue = [];
35327  this.ItemDoubleClick = new ASPxClientEvent();
35328  this.ItemClick = new ASPxClientEvent();
35329 },
35330 InlineInitialize: function () {
35331  ASPxClientListEdit.prototype.InlineInitialize.call(this);
35332  for(var i = 0; i < this.itemsValue.length; i++)
35333   this.itemsValue[i] = this.GetDecodeValue(this.itemsValue[i]);
35334 },
35335 LockScrollOnKBNavigation: function(){
35336  this.scrollOnKBNavigationLockCount++;
35337 },
35338 UnlockScrollOnKBNavigation: function(){
35339  this.scrollOnKBNavigationLockCount--;
35340 },
35341 IsScrollOnKBNavigationLocked: function() {
35342  return this.scrollOnKBNavigationLockCount > 0;
35343 },
35344 LockSelectionEvents: function(){
35345  this.selectionEventsLockCount++;
35346 },
35347 UnlockSelectionEvents: function(){
35348  this.selectionEventsLockCount--;
35349 },
35350 IsSelectionEventsLocked: function(){
35351  return this.selectionEventsLockCount > 0;
35352 },
35353 LockSynchronizationOnInternalCallback: function(){
35354  if(!this.enableSyncOnPerfCallback)
35355   this.LockSynchronization();
35356 },
35357 UnlockSynchronizationOnInternalCallback: function (){
35358  if(!this.enableSyncOnPerfCallback)
35359   this.UnlockSynchronization();
35360 },
35361 GetItemCount: function(){
35362  return 0;
35363 },
35364 GetItemValue: function(index){
35365  if(0 <= index && index < this.GetItemCount())
35366   return this.PrepareItemValue(this.itemsValue[index]);
35367  return null;
35368 },
35369 GetItemTexts: function(item) {
35370  return item.text;
35371 },
35372 PrepareItemValue: function(value) {
35373  return (typeof(value) == "string" && value == "" && this.convertEmptyStringToNull) ? null : value;
35374 },
35375 LoadItemsFromCallback: function(isToTop, itemStrings){
35376 },
35377 SetValue: function(value){
35378  var index = this.FindItemIndexByValue(value);
35379  this.SelectIndexSilentAndMakeVisible(index);
35380 },
35381 FindItemIndexByText: function(text){
35382  var transformText = function(text) { return text; };
35383  var textIsString = typeof(text) === "string";
35384  if(this.useCaseInsensitiveSearch && textIsString)
35385   transformText = function(text) { return text.toUpperCase(); };
35386  text = transformText(text);
35387  for(var i = 0; i < this.GetItemCount(); i ++){
35388   if(transformText(this.GetItem(i).text) == text)
35389    return i;
35390  }
35391  return -1;
35392 },
35393 SelectIndex: function (index){ 
35394  if(this.SelectIndexSilentAndMakeVisible(index, false)){
35395   this.RaisePersonalStandardValidation();
35396   this.OnValueChanged();
35397  }
35398 },
35399 SelectIndexSilentAndMakeVisible: function(index, lockScrollingToItem){
35400  var selectionChanged = this.SelectIndexSilent(index);
35401  if(!this.IsScrollOnKBNavigationLocked() && !lockScrollingToItem)
35402   this.MakeItemVisible(index);
35403  return selectionChanged;
35404 },
35405 FormatText: function (texts) {
35406  return texts;
35407 },
35408 MakeItemVisible: function(index){
35409 },
35410 InitOnContainerMadeVisible: function(){
35411 },
35412 AddItem: function(texts, value, imageUrl) {
35413  return this.AddItemInternal(this.CreateItemProperties(texts, value, imageUrl));
35414 },
35415 AddItemInternal: function(itemProperties) {
35416  var index = this.GetItemCount();
35417  this.InsertItemInternal(index, itemProperties);
35418  if(!ASPx.IsExists(this.GetItem(index)))
35419   index = -1;
35420  return index;
35421 },
35422 InsertItem: function(index, texts, value, imageUrl) {
35423  this.InsertItemInternal(index, this.CreateItemProperties(texts, value, imageUrl));
35424 },
35425 CreateItemProperties: function(texts, value, imageUrl, htmlContent, cssClass, tooltip) {
35426  return {
35427   texts: texts,
35428   value: value,
35429   imageUrl: imageUrl,
35430   htmlContent: htmlContent,
35431   cssClass: cssClass,
35432   tooltip: tooltip
35433  };
35434 },
35435 InsertItemInternal: function(index, itemProperties) {
35436 },
35437 BeginUpdate: function(){
35438  this.APILockCount ++;
35439 },
35440 EndUpdate: function(){
35441  this.APILockCount --;
35442  this.Synchronize();
35443 },
35444 LockUpdateSelectAllElements: function() {
35445  this.updateSelectAllElementsLockCount++;
35446 },
35447 UnlockUpdateSelectAllElements: function () {
35448  this.updateSelectAllElementsLockCount--;
35449 },
35450 IsUpdateSelectAllElementsLocked: function() {
35451  return this.updateSelectAllElementsLockCount > 0;
35452 },
35453 ClearItems: function(){
35454  this.BeginUpdate();
35455  this.UpdateArraysItemsCleared();
35456  this.ClearItemsCore();
35457  this.EndUpdate();
35458 },
35459 ClearItemsCore: function(){
35460 },
35461 ClearItemsForPerformCallback: function(){
35462  this.itemsValue = [];
35463  this.ClearItemsCore();
35464 },
35465 RemoveItem: function(index){
35466 },
35467 FindItemByText: function(text){
35468  var index = this.FindItemIndexByText(text);
35469  return this.GetItem(index);
35470 },
35471 FindItemByValue: function(value){
35472  var index = this.FindItemIndexByValue(value);
35473  return this.GetItem(index);
35474 },
35475 PerformCallback: function(arg) {
35476 },
35477 GetCallbackArguments: function(){
35478  var args = this.GetCustomCallbackArg();
35479  args += this.GetLoadItemsRangeCallbackArg();
35480  if(this.filterStrategy)
35481   args += this.filterStrategy.GetCallbackArguments();
35482  return args;
35483 },
35484 GetLoadItemsRangeCallbackArg: function(){
35485  return this.GetLoadItemsRangeCallbackArgCore(this.GetItemsRangeForLoad());
35486 },
35487 GetLoadCustomItemsRangeCallbackArguments: function(beginIndex, endIndex, value) {
35488  var itemsRange = beginIndex + ":" + endIndex;
35489  if(ASPx.IsExists(value))
35490   itemsRange = itemsRange + ":" + ASPx.Json.ToJson(value);
35491  var args = this.GetCustomCallbackArg();
35492  args += this.GetLoadItemsRangeCallbackArgCore(itemsRange);
35493  return args;
35494 },
35495 GetLoadItemsRangeCallbackArgCore: function(itemsRange) {
35496  return this.FormatCallbackArg(CONSTANTS.CALLBACK_PREFIXES.LOAD_RANGE_ITEMS, itemsRange);
35497 },
35498 FormatCallbackArg: function(prefix, arg) { 
35499  arg = arg.toString();
35500  return (ASPx.IsExists(arg) ? prefix + "|" + arg.length + ';' + arg + ';' : "");
35501 },
35502 GetItemsRangeForLoad: function(){
35503  return emptyItemsRange;
35504 },
35505 GetCallbackOwnerControl: function(){
35506  if(this.ownerName && !this.ownerControl)
35507   this.ownerControl = ASPx.GetControlCollection().Get(this.ownerName);
35508  return this.ownerControl;
35509 },
35510 GetCustomCallbackArg: function(){
35511  return this.stateObject["CustomCallback"];
35512 },
35513 SetCustomCallbackArg: function(arg){
35514  this.UpdateStateObjectWithObject({ CustomCallback: arg });
35515 },
35516 FormatAndSetCustomCallbackArg: function(arg, onPerformCallback){
35517  arg = ASPx.IsExists(arg) ? arg.toString() : "";
35518  var formatArg = this.FormatCallbackArg(onPerformCallback ? CONSTANTS.CALLBACK_PREFIXES.CUSTOMPERFORM : CONSTANTS.CALLBACK_PREFIXES.CUSTOM, arg);
35519  this.SetCustomCallbackArg(formatArg);
35520 },
35521 SendCallback: function(){
35522 },
35523 LockSynchronization: function(){
35524  this.syncLockCount++;
35525 },
35526 UnlockSynchronization: function(){
35527  this.syncLockCount--;
35528 },
35529 IsSyncLocked: function(){
35530  return this.syncLockCount > 0;
35531 },
35532 IsSyncEnabled: function(){
35533  return this.isSyncEnabled && !this.IsSyncLocked();
35534 },
35535 RegisterInsertedItem: function(index, itemProperties){
35536  if(this.IsSyncEnabled()){
35537   this.RefreshSynchroArraysIndex(index, true);
35538   var item = this.CreateItem(index, itemProperties);
35539   this.insertedItems.push(item);
35540   this.Synchronize();
35541  }
35542 },
35543 CreateItem: function(index, itemProperties) {
35544  return new ASPxClientListBoxItem(this, index, itemProperties.texts || [itemProperties.text], itemProperties.value, itemProperties.imageUrl,
35545   itemProperties.selected, itemProperties.cellStyles, itemProperties.cellCssClasse
35545s, itemProperties.cellTooltips, itemProperties.cellAttributes, itemProperties.htmlContents,
35546   itemProperties.style, itemProperties.cssClass, itemProperties.tooltip, itemProperties.attributes, itemProperties.htmlContent);
35547 },
35548 UpdateSyncArraysItemDeleted: function(item, isValueRemovingRequired){
35549  if(isValueRemovingRequired)
35550   ASPx.Data.ArrayRemoveAt(this.itemsValue, item.index);
35551  if(this.IsSyncEnabled()){
35552   var index = this.FindItemInArray(this.insertedItems, item);
35553   if(index == -1){
35554    this.RefreshSynchroArraysIndex(item.index, false);
35555    this.deletedItems.push(item);
35556   } else {
35557    this.RefreshSynchroArraysIndex(item.index, false);
35558    ASPx.Data.ArrayRemoveAt(this.insertedItems, index);
35559   }
35560   this.Synchronize();
35561  }
35562 },
35563 UpdateArraysItemsCleared: function(){
35564  if(this.IsSyncEnabled()){
35565   for(var i = this.GetItemCount() - 1; i >= 0; i --)
35566    this.UpdateSyncArraysItemDeleted(this.GetItem(i), false);
35567  } 
35568  this.itemsValue = [];
35569 },
35570 RefreshSynchroArraysIndex: function(startIndex, isIncrease){
35571  this.RefreshSynchroArrayIndexIndex(this.deletedItems, startIndex, isIncrease);
35572  this.RefreshSynchroArrayIndexIndex(this.insertedItems, startIndex, isIncrease);
35573 },
35574 RefreshSynchroArrayIndexIndex: function(array, startIndex, isIncrease){
35575  var delta = isIncrease ? 1 : -1;
35576  for(var i = 0; i < array.length; i ++){
35577   if(array[i].index >= startIndex)
35578    array[i].index += delta;
35579  }   
35580 },
35581 FindItemInArray: function(array, item){
35582  for(var i = array.length - 1; i >= 0; i--){
35583   var currentItem = array[i];
35584   if((!this.encodeHtml || currentItem.text == item.text) && currentItem.value == item.value &&
35585    currentItem.imageUrl == item.imageUrl)
35586    break;
35587  }
35588  return i;
35589 },
35590 Synchronize: function(){
35591  if(this.APILockCount == 0){
35592   if(this.IsSyncEnabled()){
35593    this.SynchronizeItems(this.deletedItems, "DeletedItems");
35594    this.SynchronizeItems(this.insertedItems, "InsertedItems");
35595   }
35596   this.CorrectSizeByTimer();
35597  }
35598 },
35599 CorrectSizeByTimer: function(){
35600 },
35601 SynchronizeItems: function(items, syncType){
35602  var itemsObj = { };
35603  itemsObj[syncType] = this.SerializeItems(items);
35604  this.UpdateStateObjectWithObject(itemsObj);
35605 },
35606 GetSerializingHelper: function(){ 
35607  if(this.serializingHelper == null)
35608   this.serializingHelper = this.CreateSerializingHelper();
35609  return this.serializingHelper;
35610 },
35611 CreateSerializingHelper: function(){
35612  return new ListBoxBaseItemsSerializingHelper(this);
35613 },
35614 SerializeItems: function(items){
35615  var serialiser = this.GetSerializingHelper();
35616  return serialiser.SerializeItems(items);
35617 },
35618 DeserializeItems: function(items) {
35619  return items.map(function(itemProperties, index) {
35620   return this.CreateItem(index, itemProperties);
35621  }.bind(this));
35622 }
35623});
35624var ListBoxBaseItemsSerializingHelper = ASPx.CreateClass(null, {
35625 constructor: function(listBoxControl) {
35626  this.listBoxControl = listBoxControl;
35627  this.startPos = 0;
35628 },
35629 SerializeItems: function(items){
35630  var sb = [ ];
35631  for(var i = 0; i < items.length; i++)
35632   this.SerializeItem(sb, items[i]);
35633  return sb.join("");
35634 },
35635 SerializeItem: function(sb, item) {
35636  if(!item)
35637   return;
35638  this.SerializeAtomValue(sb, item.index);
35639  this.SerializeAtomValue(sb, item.value);
35640  this.SerializeAtomValue(sb, item.imageUrl);
35641  var texts = this.listBoxControl.GetItemTexts(item);
35642  if(typeof(texts) == "string")
35643   this.SerializeAtomValue(sb, texts);
35644  else {
35645   for(var i = 0; i < texts.length; i++)
35646    this.SerializeAtomValue(sb, texts[i]);
35647  }
35648 },
35649 SerializeAtomValue: function(sb, value) {
35650  var valueStr = ASPx.IsExists(value) ? value.toString() : "";
35651  sb.push(valueStr.length);
35652  sb.push('|');
35653  sb.push(valueStr);
35654 },
35655 ParseItemIndex: function(serializedItem){
35656  return parseInt(this.ParseString(serializedItem));
35657 },
35658 ParseItemValue: function(serializedItem){
35659  return this.ParseString(serializedItem);
35660 },
35661 ParseString: function(str){
35662  var indexOfSeparator = str.indexOf(serializingSeparator, this.startPos);
35663  var strLength = parseInt(str.substring(this.startPos, indexOfSeparator));
35664  var strStartPos = indexOfSeparator + serializingSeparatorLength;
35665  this.startPos = strStartPos + strLength;
35666  return str.substring(strStartPos, strStartPos + strLength);
35667 },
35668 ParseTexts: function(serializedItems){
35669  return this.ParseString(serializedItems);
35670 },
35671 DeserializeValues: function(serializedValues){
35672  var deserializedValues = [];
35673  this.startPos = 0;
35674  while(this.startPos < serializedValues.length){
35675   deserializedValues.push(this.ParseItemValue(serializedValues));
35676  }
35677  return deserializedValues;
35678 }
35679});
35680var ListBoxItemsSerializingHelper = ASPx.CreateClass(ListBoxBaseItemsSerializingHelper, {
35681 constructor: function(listBoxControl) {
35682  this.constructor.prototype.constructor.call(this, listBoxControl);
35683 },
35684 ParseTexts: function(serializedItems){
35685  var textColumnCount = this.listBoxControl.GetItemTextCellCount();
35686  return (textColumnCount > 1) ? this.DeserializeItemTexts(serializedItems, textColumnCount) 
35687   : ListBoxBaseItemsSerializingHelper.prototype.ParseTexts.call(this, serializedItems);
35688 },
35689 DeserializeItemTexts: function(serializedItem, textColumnCount){
35690  var texts = [];
35691  for(var i = 0; i < textColumnCount; i++)
35692   texts.push(this.ParseString(serializedItem));
35693  return texts;
35694 }
35695});
35696var ListBoxSingleSelectionHelper = ASPx.CreateClass(null, {
35697 constructor: function(listBoxControl) {
35698  this.listBoxControl = listBoxControl;
35699  this.savedSelectedIndex = listBoxControl.savedSelectedIndex;
35700  this.updateHiddenInputsLockCount = 0;
35701  this.cachedSelectionChangedArgs = [];
35702 },
35703 ClearSelection: function(){
35704  this.SetSelectedIndexCore(-1);
35705  this.OnSelectionCleared();
35706 },
35707 OnSelectionCleared: function(){
35708  this.cachedSelectionChangedArgs = [];
35709 },
35710 GetSelectedIndexInternal: function(){
35711  return this.savedSelectedIndex;
35712 }, 
35713 SetSelectedIndexInternal: function(index){
35714  this.savedSelectedIndex = index;
35715 }, 
35716 SetSelectedIndexCore: function(index){
35717  if(index != this.savedSelectedIndex && -1 <= index && index < this.GetItemCount()){
35718   this.BeginSelectionUpdate();
35719   this.SetSelectedIndexInternal(index);
35720   this.EndSelectionUpdate();
35721   return true;
35722  }
35723  return false;
35724 },
35725 GetSelectedIndex: function(){
35726  return this.GetSelectedIndexInternal();
35727 },
35728 SetSelectedIndex: function(index){
35729  this.ChangeSelectedItem(index);
35730  this.SetSelectedIndexCore(index);
35731  this.OnItemSelectionChanged(index, true);
35732 },
35733 GetSelectedIndices: function(){ 
35734  var selectedIndex = this.GetSelectedIndexInternal();
35735  return selectedIndex != -1 ? [selectedIndex] : [];
35736 },
35737 GetSelectedValues: function(){ 
35738  var selectedValue =  this.listBoxControl.GetValue();
35739  return selectedValue != null ? [selectedValue] : [];
35740 },
35741 GetSelectedItems: function(){ 
35742  var selectedItem = this.listBoxControl.GetSelectedItem();
35743  return selectedItem != null? [selectedItem] : [];
35744 },
35745 SelectIndices: function(indices){},
35746 SelectItems: function(items){},
35747 SelectValues: function(values){},
35748 UnselectIndices: function (selected) { this.SetSelectedIndex(-1); },
35749 UnselectItems: function(items){},
35750 UnselectValues: function(values){},
35751 GetIsItemSelected: function(index){ return index == this.GetSelectedIndexInternal(); },
35752 ResetSelectionCollectionsCache: function(){ },
35753 OnItemClick: function(index, evt){
35754  var selected = true;
35755  this.BeginSelectionUpdate();
35756  this.ChangeSelectedItem(index);
35757  var selectedIndexChanged = this.SetSelectedIndexCore(index);
35758  this.EndSelectionUpdate();
35759  if(selectedIndexChanged)
35760   this.OnItemSelectionChanged(index, selected);
35761 },
35762 ChangeSelectedItem: function(newSelectedIndex){
35763  var selected = true;
35764  var oldSelectedIndex = this.GetSelectedIndexInternal();
35765  this.BeginSelectionUpdate();
35766  this.SetItemSelectionState(oldSelectedIndex, !selected);
35767  this.SetItemSelectionState(newSelectedIndex, selected);
35768  this.EndSelectionUpdate();
35769 },
35770 SetItemSelectionState: function (itemIndex, selected, controller) {
35771  this.BeginSelectionUpdate();
35772  this.listBoxControl.SetItemSelectionAppearance(itemIndex, selected, controller, true);
35773  this.EndSelectionUpdate();
35774 },
35775 GetFocusedIndex: function(){
35776  return this.GetSelectedIndexInternal();
35777 },
35778 BeginSelectionUpdate: function(){
35779  this.updateHiddenInputsLockCount++;
35780 },
35781 EndSelectionUpdate: function(){
35782  this.updateHiddenInputsLockCount--;
35783  if(!this.IsUpdateInternalSelectionStateLocked()){
35784   this.listBoxControl.UpdateInternalState();
35785   this.FlushSelectionChanged();
35786  }
35787 },
35788 IsUpdateInternalSelectionStateLocked: function(){
35789  return this.updateHiddenInputsLockCount > 0;
35790 },
35791 GetItemCount: function(){
35792  return this.listBoxControl.GetItemCount();
35793 },
35794 OnItemSelectionChanged: function(index, selected){
35795  if(this.IsUpdateInternalSelectionStateLocked()){
35796   var a = {Index: index, Selected: selected};
35797   this.cachedSelectionChangedArgs.push(a);
35798  }
35799  else 
35800   this.listBoxControl.OnItemSelectionChanged(index, selected);
35801 },
35802 FlushSelectionChanged: function(){
35803  if(this.IsUpdateInternalSelectionStateLocked()) 
35804   return;
35805  for(var i = 0; i < this.cachedSelectionChangedArgs.length; i++)
35806   this.listBoxControl.OnItemSelectionChanged(this.cachedSelectionChangedArgs[i].Index, this.cachedSelectionChangedArgs[i].Selected);
35807  this.cachedSelectionChangedArgs = [];
35808 },
35809 OnItemInserted: function(index){
35810  if(index <= this.savedSelectedIndex && this.savedSelectedIndex != -1)
35811   this.SetSelectedIndexInternal(this.savedSelectedIndex + 1);
35812 },
35813 OnItemRemoved: function(index){
35814  if(index < this.savedSelectedIndex)
35815   this.SetSelectedIndexInternal( this.savedSelectedIndex - 1);
35816  else if(index == this.savedSelectedIndex)
35817   this.SetSelectedIndexInternal(-1);
35818 },
35819 OnItemsCleared: function(){
35820  this.ClearSelection();
35821 }
35822});
35823var ListBoxMultiSelectionHelper = ASPx.CreateClass(ListBoxSingleSelectionHelper, {
35824 constructor: function(listBoxControl) {
35825  this.constructor.prototype.constructor.call(this, listBoxControl);
35826  this.selectedValuesCache = [];
35827  this.selectedItemsCache = [];
35828  this.savedSelectedIndices = [];
35829  this.selectedIndicesSortingRequired = false;
35830  this.focusedIndex = -1;
35831  this.lastIndexFocusedWithoutShift = -1;
35832 },
35833 SetSelectedIndex: function(index){
35834  this.SingleIndexSelection(index);
35835 },
35836 SetSelectedIndexCore: function(index){
35837  ListBoxSingleSelectionHelper.prototype.SetSelectedIndexCore.call(this, index);
35838  this.updateSelectAllElementsState();
35839 },
35840 updateSelectAllElementsState: function() {
35841  this.listBoxControl.updateSelectAllElementsState();
35842 },
35843 ResetSelectionCollectionsCache: function(){
35844  this.selectedIndicesSortingRequired = true;
35845  this.selectedItemsCache = [];
35846  this.selectedValuesCache = [];
35847 },
35848 GetSelectedIndices: function(){
35849  return this.GetSortedSelectedIndices().slice();
35850 },
35851 GetSortedSelectedIndices: function() {
35852  if(this.savedSelectedIndices.length > 1 && this.selectedIndicesSortingRequired)
35853   this.SortSelectedIndices();
35854  return this.savedSelectedIndices;
35855 },
35856 GetSelectedValues: function(){ 
35857  if(this.savedSelectedIndices.length == 0)
35858   return [];
35859  if(this.selectedValuesCache.length == 0)
35860   this.selectedValuesCache = this.GetSelectedValuesCore();
35861  return this.selectedValuesCache;
35862 },
35863 GetSelectedValuesCore: function(){
35864  var selectedValues = [];
35865  var selectedIndices = this.GetSortedSelectedIndices();
35866  if(selectedIndices.length == 0)
35867   return selectedValues;
35868  for(var i = 0; i < selectedIndices.length; i++)
35869   selectedValues.push(this.listBoxControl.GetItemValue([selectedIndices[i]]));
35870  return selectedValues;
35871 },
35872 GetSelectedItems: function(){
35873  if(this.savedSelectedIndices.length == 0)
35874   return [];
35875  if(this.selectedItemsCache.length == 0)
35876   this.selectedItemsCache = this.GetSelectedItemsCore();
35877  return this.selectedItemsCache;
35878 },
35879 GetSelectedItemsCore: function(){
35880  var selectedItems = [];
35881  for(var i = 0; i < this.savedSelectedIndices.length; i++)
35882   selectedItems.push(this.listBoxControl.GetItem(this.savedSelectedIndices[i]));
35883  return selectedItems;
35884 },
35885 SetIndicesSelectionState: function(indices, selected){
35886  this.BeginSelectionUpdate();
35887  var controller = typeof(ASPx.GetStateController) != "undefined" ? ASPx.GetStateController() : null;
35888  this.LockForceRedrawAppearance(controller);
35889  if(indices){
35890   var itemCount = this.listBoxControl.GetItemCount();
35891   for(var i = 0; i < indices.length; i++) {
35892    var index = indices[i];
35893    if(index >= 0 && index < itemCount)
35894     this.SetItemSelectionState(indices[i], selected, controller);
35895   }
35896  } else if(this.IsClientFilterApplied())
35897   this.SetAllFilteredItemsSelectionState(selected, controller);
35898  else
35899   this.SetAllItemsSelectionState(selected, controller);
35900  this.UnlockForceRedrawAppearance(controller);
35901  this.SetSelectedIndexCore(this.GetFirstSelectedIndex());
35902  this.EndSelectionUpdate();
35903 },
35904 IsClientFilterApplied: function() {
35905  return this.listBoxControl.IsClientFilterApplied();
35906 },
35907 SetAllFilteredItemsSelectionState: function (selected, controller) {
35908  for (var i = 0; i < this.listBoxControl.GetItemCount() ; i++) {
35909   if (this.listBoxControl.IsItemFiltered && !this.listBoxControl.IsItemFiltered(i))
35910    continue;
35911   this.SetItemSelectionState(i, selected, controller);
35912  }
35913 },
35914 SetItemsSelectionState: function(items, selected){
35915  var indices = items ? this.ConvertItemsToIndices(items) : null;
35916  this.SetIndicesSelectionState(indices, selected);
35917 },
35918 SetValuesSelectionState: function(values, selected){
35919  var indices = values ? this.ConvertValuesToIndices(values)  : null;
35920  this.SetIndicesSelectionState(indices, selected);
35921 },
35922 ConvertValuesToIndices: function(values){
35923  var indices = [];
35924  for(var i = 0; i < values.length; i++)
35925   indices.push(this.listBoxControl.FindItemIndexByValue(values[i]));
35926  return indices;
35927 },
35928 ConvertItemsToIndices: function(items){
35929  var indices = [];
35930  for(var i = 0; i < items.length; i++)
35931   indices.push(items[i].index);
35932  return indices;
35933 },
35934 SelectIndices: function(indices){
35935  this.SetIndicesSelectionState(indices, true);
35936 },
35937 SelectItems: function(items){
35938  this.SetItemsSelectionState(items, true);
35939 },
35940 SelectValues: function(values){
35941  this.SetValuesSelectionState(values, true);
35942 },
35943 UnselectIndices: function(indices){
35944  this.SetIndicesSelectionState(indices, false);
35945 },
35946 UnselectItems: function(items){
35947  this.SetItemsSelectionState(items, false);
35948 },
35949 UnselectValues: function(values){
35950  this.SetValuesSelectionState(values, false);  
35951 },
35952 GetIsItemSelected: function(index){ 
35953  return ASPx.Data.ArrayBinarySearch(this.GetSortedSelectedIndices(), index) > -1;
35954 },
35955 OnItemClick: function(index, evt){
35956  this.BeginSelectionUpdate();
35957  var ctrlKey = evt.ctrlKey || evt.metaKey;
35958  var shift = evt.shiftKey;
35959  if(ctrlKey)
35960   this.AddSelectedIndex(index);
35961  else if(shift){
35962   var startIndex = index > this.lastIndexFocusedWithoutShift ? this.lastIndexFocusedWithoutShift + 1 : index;
35963   var endIndex = index > this.lastIndexFocusedWithoutShift ? index : this.lastIndexFocusedWithoutShift - 1;
35964   this.SelectRangeIndicesOnly(startIndex, endIndex);
35965   this.SetFocusedIndexInternal(index, true);
35966  }else 
35967   this.SingleIndexSelection(index);
35968  this.EndSelectionUpdate();
35969 },
35970 OnItemCheckBoxClick: function(index, evt){
35971  this.BeginSelectionUpdate();
35972  this.AddSelectedIndex(index);
35973  this.EndSelectionUpdate();
35974 },
35975 AddSelectedIndex: function(index){
35976  this.SetFocusedIndexInternal(index, false);
35977  var indexInSelectedIndices = ASPx.Data.ArrayIndexOf(this.savedSelectedIndices, index);
35978  var selectionOperation = indexInSelectedIndices == -1;
35979  this.SetItemSelectionState(index, selectionOperation);
35980  this.SetSelectedIndexCore(this.GetFirstSelectedIndex());
35981 },
35982 SelectRangeIndicesOnly: function(startIndex, endIndex){
35983  this.BeginSelectionUpdate();
35984  var controller = typeof(ASPx.GetStateController) != "undefined" ? ASPx.GetStateController() : null;
35985  if(startIndex < endIndex)
35986   this.LockForceRedrawAppearance(controller);
35987  var itemCount = this.GetItemCount();
35988  for(var i = 0; i < itemCount; i ++) {
35989   if(i == this.lastIndexFocusedWithoutShift) 
35990    continue;
35991   if(startIndex !== endIndex && this.listBoxControl.IsItemFiltered && !this.listBoxControl.IsItemFiltered(i))
35992    continue;
35993   this.SetItemSelectionState(i, i >= startIndex && i <= endIndex, controller);
35994  }
35995  this.SetSelectedIndexCore(this.GetFirstSelectedIndex());
35996  if(startIndex < endIndex)
35997   this.UnlockForceRedrawAppearance(controller);
35998  this.EndSelectionUpdate();
35999 },
36000 SingleIndexSelection: function(index){
36001  this.SetFocusedIndexInternal(-1, false);
36002  this.SelectRangeIndicesOnly(index, index);
36003  this.SetFocusedIndexInternal(index, false);
36004 },
36005 LockForceRedrawAppearance: function(controller) {
36006   if(controller && ASPx.Browser.IE && ASPx.Browser.MajorVersion >= 11)
36007   controller.LockForceRedrawAppearance();
36008 },
36009 UnlockForceRedrawAppearance: function(controller) {
36010  if(controller && ASPx.Browser.IE && ASPx.Browser.MajorVersion >= 11)
36011   controller.UnlockForceRedrawAppearance();
36012 },
36013 SetAllItemsSelectionState: function(selected, controller){
36014  this.BeginSelectionUpdate();
36015  this.savedSelectedIndices = [ ];
36016  var itemCount = this.GetItemCount();
36017  for (var i = 0; i < itemCount; i++) {
36018   this.SetItemSelectionStateCore(i, selected, controller);
36019   if(selected)
36020    this.PushSelectedIndex(i);
36021   this.OnItemSelectionChanged(i, selected);
36022  }
36023  this.ResetSelectionCollectionsCache();
36024  this.EndSelectionUpdate();
36025 },
36026 SetItemSelectionState: function(itemIndex, selected, controller){
36027  this.SetItemSelectionStateCore(itemIndex, selected, controller);
36028  this.ResetSelectionCollectionsCache();
36029  var indexInSelectionArray = this.savedSelectedIndices.indexOf(itemIndex);
36030  if(selected && indexInSelectionArray == -1){
36031   this.PushSelectedIndex(itemIndex);
36032   this.OnItemSelectionChanged(itemIndex, true);
36033  }
36034  if(!selected && indexInSelectionArray != -1){
36035   this.RemoveSelectedIndexAt(indexInSelectionArray);
36036   this.OnItemSelectionChanged(itemIndex, false);
36037  }
36038 },
36039 GetFirstSelectedIndex: function(){
36040  var selectedIndices = this.GetSelectedIndices();
36041  var selectedIndicesCount = selectedIndices.length;
36042  var firstSelectedIndex = -1;
36043  if(selectedIndicesCount > 0){
36044   firstSelectedIndex = selectedIndices[0];
36045   for(var i = 1; i < selectedIndices.length; i++){
36046    if(firstSelectedIndex > selectedIndices[i])
36047     firstSelectedIndex = selectedIndices[i];
36048   }
36049  }
36050  return firstSelectedIndex;
36051 },
36052 PushSelectedIndex: function(index){
36053  this.savedSelectedIndices.push(index);
36054 },
36055 RemoveSelectedIndex: function(index){
36056  ASPx.Data.ArrayRemove(this.savedSelectedIndices, index);
36057 },
36058 RemoveSelectedIndexAt: function(indexInArray){
36059  ASPx.Data.ArrayRemoveAt(this.savedSelectedIndices, indexInArray);
36060 },
36061 SortSelectedIndices: function(){
36062  ASPx.Data.ArrayIntegerAscendingSort(this.savedSelectedIndices);
36063  this.selectedIndicesSortingRequired = false;
36064 },
36065 SetItemSelectionStateCore: function(itemIndex, selected, controller){
36066  ListBoxSingleSelectionHelper.prototype.SetItemSelectionState.call(this, itemIndex, selected, controller);
36067 },
36068 GetFocusedIndex: function(){
36069  return this.focusedIndex;
36070 },
36071 SetFocusedIndexInternal: function(index, isShiftPressed){
36072  if(!isShiftPressed)
36073   this.lastIndexFocusedWithoutShift = index;
36074  this.focusedIndex = index;
36075 },
36076 OnItemInserted: function(index){
36077  this.ResetSelectionCollectionsCache();
36078  ListBoxSingleSelectionHelper.prototype.OnItemInserted.call(this, index);
36079  if(this.focusedIndex >= index)
36080   this.focusedIndex ++;
36081  for(var i = 0; i < this.savedSelectedIndices.length; i++){
36082   if(this.savedSelectedIndices[i] >= index)
36083    this.savedSelectedIndices[i]++;
36084  }
36085  this.updateSelectAllElementsState();
36086 },
36087 OnItemRemoved: function(index){
36088  this.ResetSelectionCollectionsCache();
36089  ListBoxSingleSelectionHelper.prototype.OnItemRemoved.call(this, index);
36090  if(this.focusedIndex == index)
36091   this.focusedIndex = -1;
36092  else if(this.focusedIndex > index)
36093   this.focusedIndex --;
36094  if(this.GetIsItemSelected(index))
36095   this.RemoveSelectedIndex(index);
36096  for(var i = 0; i < this.savedSelectedIndices.length; i++){
36097   if(this.savedSelectedIndices[i] > index)
36098    this.savedSelectedIndices[i]--;
36099  }
36100  if(this.GetSelectedIndex() == -1)
36101   this.SetSelectedIndexCore(this.GetFirstSelectedIndex());
36102  this.updateSelectAllElementsState();
36103 },
36104 ClearSelection: function(){
36105  this.ResetSelectionCollectionsCache();
36106  ASPx.Data.ArrayClear(this.savedSelectedIndices);
36107  this.OnSelectionCleared();
36108  this.SetSelectedIndexCore(-1);
36109 }
36110});
36111var CheckBoxListMultiSelectionHelper = ASPx.CreateClass(ListBoxMultiSelectionHelper, {
36112 OnItemClick: function(index){
36113  this.BeginSelectionUpdate();
36114  this.AddSelectedIndex(index);
36115  this.EndSelectionUpdate();
36116 },
36117 GetFocusedItemIndex: function(){
36118  return this.lastIndexFocusedWithoutShift;
36119 },
36120 updateSelectAllElementsState: function () { },
36121 IsClientFilterApplied: function() { return false; }
36122});
36123var ListBoxCheckSelectionHelper = ASPx.CreateClass(ListBoxMultiSelectionHelper, {
36124 OnItemClick: function(index, evt){
36125  this.BeginSelectionUpdate();
36126  if(evt.shiftKey)
36127   ListBoxMultiSelectionHelper.prototype.OnItemClick.call(this, index, evt);
36128  else
36129   this.AddSelectedIndex(index);
36130  this.EndSelectionUpdate();
36131 }
36132});
36133var ASPxClientListBox = ASPx.CreateClass(ASPxClientListBoxBase, {
36134 constructor: function(name) {
36135  this.constructor.prototype.constructor.call(this, name);
36136  this.freeUniqIndex = -1;
36137  this.isHasFakeRow = false;
36138  this.headerDiv = null;
36139  this.headerTable = null;
36140  this.listTable = null;
36141  this.sampleItemFirstTextCell = null;
36142  this.width = "";
36143  this.defaultHeight = "";
36144  this.hasSampleItem = false;
36145  this.hoverClasses = [""];
36146  this.hoverCssArray = [""];
36147  this.selectAllHoverClasses = [""];
36148  this.selectAllHoverCssArray = [""];
36149  this.selectAllDisabledClasses = [""];
36150  this.selectAllDisabledCssArray = [""];
36151  this.selectedClasses = [""];
36152  this.selectedCssArray = [""];
36153  this.disabledClasses = [""];
36154  this.disabledCssArray = [""];
36155  this.imageCellExists = false;
36156  this.scrollHandlerLockCount = 0;
36157  this.columnFieldNames = [];
36158  this.textFormatString = "";
36159  this.nullValueItemDisplayText = null;
36160  this.defaultImageUrl = "";
36161  this.selectionMode = 0;
36162  this.initSelectedIndices = [];
36163  this.itemHorizontalAlign = "";
36164  this.emptyTextRowCellIndices = null;
36165  this.accessibilityHelper = null;
36166  this.accessibilityHelperID = "";
36167  this.allowMultipleCallbacks = false;
36168  this.isCallbackMode = false;
36169  this.callbackPageSize = -1;
36170  this.isTopSpacerVisible = false;
36171  this.isBottomSpacerVisible = false;
36172  this.serverIndexOfFirstItem = 0;
36173  this.scrollHelper = null;
36174  this.changeSelectAfterCallback = 0;
36175  this.ownerControl = null;
36176  this.SampleItem = null;
36177  this.sampleHeaderRow = null;
36178  this.scrollDivElement = null;
36179  this.scrollPageSize = 4;
36180  this.itemsValue = [];
36181  this.cachedValue = null;
36182  this.tempCache = new ListBoxTemporaryCache();
36183  this.sizingConfig.adjustControl = true;
36184  this.disableScrolling = false;
36185  this.icbFocusedStyle = null;
36186  this.icbImageProperties = null;
36187  this.internalCheckBoxCollection = null;
36188  this.focusableCheckInput = null;
36189  this.nativeCheckOnFocusHandler = null;
36190  this.enableSelectAll = false;
36191  this.enableFiltering = false;
36192  this.filteringDelay = 100;
36193  this.filterMinLength = 1;
36194  this.filterTimerID = -1;
36195  this.customFilteringEditorID = "";
36196  this.filteringTextBox = null;
36197  this.filteringTextBoxInput = null;
36198  this.showFilterButtonInput = null;
36199  this.highlighting = this.CreateHighlightingHelper();
36200  this.hasDecoratedItems = false;
36201  this.scrollDivMinWidth = 0;
36202  this.ItemFiltering = new ASPxClientEvent();
36203  this.CustomHighlighting = new ASPxClientEvent();
36204 },
36205 Initialize: function() {   
36206  this.LockScrollHandler();
36207  this.InitScrollPos();
36208  if((ASPx.Browser.WebKitTouchUI || (ASPx.Browser.WindowsPhonePlatform && ASPx.Browser.IE)) && !this.disableScrolling)
36209   ASPx.TouchUIHelper.MakeScrollable(this.GetScrollDivElement(), {showHorizontalScrollbar: false});
36210  this.CreateInternalCheckBoxCollection();
36211  this.InitSelection();
36212  if(!this.isComboBoxList && this.ResetItemHeightIfRequired())
36213   this.AdjustControlCore();
36214  this.InitializeLoadOnDemand();
36215  this.UnlockScrollHandler();
36216  if(!this.HasVirtualScrolling())
36217   this.freeUniqIndex = this.GetItemCount();
36218  ASPxClientEdit.prototype.Initialize.call(this);
36219  if(this.NeedUnfocusableScrollDivElement())
36220   ASPx.Attr.SetAttribute(this.GetScrollDivElement(), "tabIndex", "-1");
36221  this.EnsureFilteringElements();
36222 },
36223 InitDXTextAttributes: function(){
36224  if(this.emptyTextRowCellIndices != null){
36225   var itemWithDXTextCount = this.emptyTextRowCellIndices.length;
36226   for(var i = 0; i < itemWithDXTextCount; i++){
36227    var itemIndex = this.emptyTextRowCellIndices[i][0];
36228    var cellIndices = this.emptyTextRowCellIndices[i][1];
36229    var itemRow = this.GetItemRow(itemIndex);
36230    if(!itemRow) continue;
36231    for(var j = 0; j < cellIndices.length; j++){
36232     ASPx.Attr.SetAttribute(itemRow.cells[cellIndices[j]], "DXText", "");
36233    }
36234   }
36235  }
36236 },
36237 InitSelection: function(){
36238  var valueFromLastTime = this.GetValueFromValueInput();
36239  if(this.MultiSelectionMode()){
36240   if(valueFromLastTime != ""){
36241    var serialiser = this.GetSerializingHelper();
36242    var selectedValuesFromLastTime = serialiser.DeserializeValues(valueFromLastTime);
36243    var selectedIdicesFromLastTime = [];
36244    for(var i = 0; i < selectedValuesFromLastTime.length; i++)
36245     selectedIdicesFromLastTime.push(this.FindItemIndexByValue(selectedValuesFromLastTime[i]));
36246    this.SelectIndices(selectedIdicesFromLastTime);
36247   } else
36248    this.SelectIndices(this.initSelectedIndices);
36249  } else {
36250   var selectedIndex = (valueFromLastTime != "") ? 
36251    this.FindItemIndexByValue(valueFromLastTime) : this.GetSelectedIndexInternal();
36252   this.SetSelectedIndexInternal(selectedIndex);
36253   this.SelectIndexSilent(selectedIndex);
36254   this.GetItemSelectionHelper().SetSelectedIndexInternal(selectedIndex);
36255  }
36256  this.CacheValue();
36257 },
36258 GetShowFilterButton: function() {
36259  return ASPx.GetControlCollection().Get(this.name + "_" + showFilterButtonID);
36260 },
36261 CreateHighlightingHelper: function() {
36262  return new ASPx.ListBoxHighlightingHelper(this, "em");
36263 },
36264 CreateInternalCheckBoxCollection: function() {
36265  if(this.IsNativeCheckBoxes() || this.internalCheckBoxCollection)
36266   return;
36267  this.internalCheckBoxCollection = new ASPx.CheckBoxInternalCollection(this.icbImageProperties, false, false, null, true, this.accessibilityCompliant);
36268  this.itemsManager.InitializeInternalCheckBoxCollection();
36269 },
36270 AddInternalCheckBoxToCollection: function(index) {
36271  if(!this.internalCheckBoxCollection)
36272   return;
36273  var enabled = this.GetEnabled();
36274  var changeEventMethod = ASPx.Attr.ChangeEventsMethod(enabled);
36275  this.AddInternalCheckBoxToCollectionCore(index, enabled, changeEventMethod);
36276 },
36277 AddInternalCheckBoxToCollectionCore: function(index, enabled, changeEventMethod) {
36278  var inputElement = this.GetItemCheckBoxInput(index);
36279  if(inputElement) {
36280   var internalCheckBox = this.internalCheckBoxCollection.Add(this.GetInternalCheckBoxKey(index), inputElement);
36281   internalCheckBox.CreateFocusDecoration(this.icbFocusedStyle);
36282   internalCheckBox.SetEnabled(enabled);
36283   internalCheckBox.autoSwitchEnabled = false;
36284   var checkBoxFocusableElement = this.GetCheckBoxFocusableElement(index);
36285   this.ChangeSpecialInputEnabledAttributes(checkBoxFocusableElement, changeEventMethod, true);
36286   internalCheckBox.CheckedChanged.AddHandler(
36287    function(s, e) {
36288     if(ASPx.Evt.GetKeyCode(e) == ASPx.Key.Space) {
36289      var element = ASPx.Evt.GetEventSource(e);
36290      this.GetItemSelectionHelper().OnItemCheckBoxClick(this.FindInternalCheckBoxIndex(element), e);
36291     }
36292    }.aspxBind(this)
36293   );
36294   internalCheckBox.Focus.AddHandler(
36295    function(s, e) {
36296     var index = this.FindInternalCheckBoxIndex(s.mainElement);
36297     window.setTimeout(function() { this.ScrollToItemVisible(index); }.aspxBind(this), 50);
36298    }.aspxBind(this)
36299   );
36300  }
36301 },
36302 ClearInternalCheckBoxCollection: function() {
36303  if(this.internalCheckBoxCollection)
36304   this.internalCheckBoxCollection.Clear();
36305 },
36306 RemoveInternalCheckBoxFromCollecntion: function(index) {
36307  if(this.internalCheckBoxCollection)
36308   this.internalCheckBoxCollection.Remove(this.GetItemValue(index));
36309 },
36310 GetInternalCheckBoxKey: function(index) {
36311  return this.name + nameSeparator + this.GetItemValue(index);
36312 },
36313 GetInternalCheckBox: function (index) {
36314  if(this.internalCheckBoxCollection == null)
36315   this.CreateInternalCheckBoxCollection();
36316  if(this.internalCheckBoxCollection)
36317   return this.internalCheckBoxCollection.Get(this.GetInternalCheckBoxKey(index));
36318  return null;
36319 },
36320 IsNativeCheckBoxes: function() {
36321  return !this.icbImageProperties;
36322 },
36323 SetCheckBoxChecked: function(index, checked) {
36324  var checkBox = this.IsNativeCheckBoxes() ? this.GetItemCheckBoxInput(index) : this.GetInternalCheckBox(index);
36325  if(checkBox)
36326   this.SetCheckBoxCheckedCore(checkBox, checked);
36327  if(this.accessibilityCompliant) {
36328   if(!this.accessibilityHelper)
36329    this.accessibilityHelper = new AccessibilityHelperListBox(this);
36330   setTimeout(function () { this.accessibilityHelper.SetCheckBoxesValidationAttributes(); }.aspxBind(this), 0);
36331  }
36332 },
36333 SetCheckBoxCheckedCore: function (checkBox, checked) {
36334  if(this.IsNativeCheckBoxes())
36335   checkBox.checked = checked;
36336  else
36337   checkBox.SetValue(checked ? ASPx.CheckBoxInputKey.Checked : ASPx.CheckBoxInputKey.Unchecked);
36338 },
36339 SetCheckBoxEnabled: function (index, enabled) {
36340  var checkBox = this.IsNativeCheckBoxes() ? this.GetItemCheckBoxInput(index) : this.GetInternalCheckBox(index);
36341  if (checkBox)
36342   this.SetCheckBoxEnabledCore(checkBox, enabled);
36343 },
36344 SetCheckBoxEnabledCore: function (checkbox, enabled) {
36345  if (this.IsNativeCheckBoxes()) {
36346   checkbox.disabled = !enabled;
36347   this.ChangeNativeCheckEnabledAttributes(checkbox, ASPx.Attr.ChangeEventsMethod(this.GetEnabled()));
36348  }
36349  else
36350   checkbox.SetEnabled(enabled);
36351  this.ChangeSpecialInputEnabledAttributes(this.IsNativeCheckBoxes() ?
36352   checkbox : checkbox.inputElement, ASPx.Attr.ChangeEventsMethod(enabled));
36353 },
36354 ClearItems: function() {
36355  ASPxClientListBoxBase.prototype.ClearItems.call(this);
36356  this.ClearInternalCheckBoxCollection();
36357  this.freeUniqIndex = this.GetItemCount();
36358 },
36359 OnDelayedSpecialFocusMouseDown: function (evt) {
36360  if(this.filteringTextBox) {
36361   var isEventFromFilteringTextBox = ASPx.Evt.GetEventSource(evt) == this.filteringTextBox.GetInputElement();
36362   this.filteringTextBoxInput = isEventFromFilteringTextBox ? this.filteringTextBox.GetInputElement() : null;
36363  }
36364  if(this.showFilterButton) {
36365   var isEventFromShowFilterButton = ASPx.GetIsParent(this.showFilterButton.GetMainElement(), ASPx.Evt.GetEventSource(evt));
36366   this.showFilterButtonInput = isEventFromShowFilterButton ? this.showFilterButton.GetInternalButton() : null;
36367   this.isFilterEditorShowing = isEventFromShowFilterButton;
36368  }
36369  if(this.GetIsCheckColumnExists())
36370   this.SetFocusableCheckInput(this.GetCheckBoxInputFromEvent(evt));
36371  ASPxClientListBoxBase.prototype.OnDelayedSpecialFocusMouseDown.call(this, evt);
36372  var shiftPressed = evt.shiftKey;
36373  var ctrlKey = evt.ctrlKey || evt.metaKey;
36374  if(shiftPressed || ctrlKey){
36375   ASPx.Selection.Clear();
36376   if(ASPx.Browser.IE)
36377    ASPx.Evt.PreventEventAndBubble(evt);
36378  }
36379 },
36380 GetCheckBoxInputFromEvent: function(evt) {
36381  var element = ASPx.Evt.GetEventSource(evt);
36382  if(this.IsNativeCheckBoxes())
36383   return element.type == "checkbox" ? element : null;
36384  var index = this.FindInternalCheckBoxIndex(element);
36385  if(index > -1)
36386   return this.GetCheckBoxFocusableElement(index);
36387  else if(this.IsSelectAllCheckBoxClicked(element))
36388   return this.GetSelectAllCheckBoxFocusableElement();
36389  return null;
36390 },
36391 IsSelectAllCheckBoxClicked: function(eventSource) {
36392  return this.selectAllCheckBox && ASPx.GetIsParent(this.selectAllCheckBox.container, eventSource)
36393   && (eventSource == this.selectAllCheckBox.mainElement || eventSource.tagName == "LABEL");
36394 },
36395 IsNativeSelectAllCheckBoxClicked: function (eventSource) {
36396  return this.nativeSelectAllCheckBox && ASPx.GetIsParent(this.nativeSelectAllCheckBox, eventSource);
36397 },
36398 GetSelectAllClickableElement: function() {
36399  return this.IsMultiColumn() ? this.selectAllMainElement.parentNode : this.selectAllMainElement;
36400 },
36401 GetSelectAllCheckBoxFocusableElement: function() {
36402  return this.accessibilityCompliant ? this.selectAllCheckBox.mainElement : this.selectAllCheckBox.inputElement;
36403 },
36404 GetCheckBoxFocusableElement: function(index) {
36405  var internalCheckBox = this.GetInternalCheckBox(index);
36406  if(!internalCheckBox)
36407   return null;
36408  return this.accessibilityCompliant ? internalCheckBox.mainElement : internalCheckBox.inputElement;
36409 },
36410 FindInternalCheckBoxIndex: function(element) {
36411  var level = 5;
36412  while(level > 0) {
36413   var id = element.id;
36414   if(id && element.tagName == "TD" && id.slice(-1) == lbIPostfixes[0])
36415    return this.GetItemIndexByRow(element.parentNode);
36416   element = element.parentNode;
36417   level--;
36418  }
36419  return -1;
36420 },
36421 IsCheckBoxClicked: function(evt) {
36422  return !!this.GetCheckBoxInputFromEvent(evt);
36423 },
36424 GetFocusableInputElement: function() {
36425  return this.showFilterButtonInput || this.filteringTextBoxInput || this.focusableCheckInput || this.GetInputElement();
36426 },
36427 IsElementBelongToInputElement: function (element) {
36428  return ASPxClientEdit.prototype.IsElementBelongToInputElement.call(this, element)
36429  || this.filteringTextBox && this.filteringTextBox.ownerListBox == this && this.filteringTextBox.IsElementBelongToInputElement(element);
36430 },
36431 SetFocusableCheckInput: function(element) {
36432  this.focusableCheckInput = element;
36433 },
36434 OnFocusCore: function() {
36435  if(this.UseDelayedSpecialFocus())
36436   window.clearTimeout(this.specialFocusTimer);
36437  if(this.focused)
36438   this.UnlockFocusEvents();
36439  else
36440   ASPxClientListBoxBase.prototype.OnFocusCore.call(this);
36441 },
36442 OnLostFocusCore: function() {
36443  if(!this.IsFocusEventsLocked()) { 
36444   this.SetFocusableCheckInput(null);
36445   this.filteringTextBoxInput = null;
36446   this.showFilterButtonInput = null;
36447  }
36448  ASPxClientListBoxBase.prototype.OnLostFocusCore.call(this);
36449 },
36450 IsFocusEventsLocked: function() {
36451  var result = ASPxClientEdit.prototype.IsFocusEventsLocked.call(this) ||
36452      this.IsInternalFilteringTextBoxFocusEventsLocked() ||
36453      this.isFilterEditorShowing;
36454  if(this.accessibilityCompliant)
36455   result = this.focused && (result || this.HasInternalFilteringTextBoxFocus());
36456  return result;
36457 },
36458 HasInternalFilteringTextBoxFocus: function() {
36459  return !this.customFilteringEditorID && this.filteringTextBox && ASPx.GetIsParent(this.filteringTextBox.GetMainElement(), ASPx.GetActiveElement());
36460 },
36461 IsInternalFilteringTextBoxFocusEventsLocked: function() {
36462  return !this.customFilteringEditorID && this.filteringTextBox && this.filteringTextBox.IsFocusEventsLocked();
36463 },
36464 ForceLockFocusEvents: function() {
36465  this.focusEventsLocked = true;
36466 },
36467 GetValueFromValueInput: function(){
36468  var valueInput = this.FindStateInputElement();
36469  if(ASPx.IsExistsElement(valueInput))
36470   return valueInput.value;
36471  return "";
36472 },
36473 NeedUnfocusableScrollDivElement: function() {
36474  return ASPx.Browser.Firefox;
36475 },
36476 GetInitSelectedIndex: function(){
36477  return this.savedSelectedIndex;
36478 },
36479 CacheValue: function(){
36480  this.cachedValue = this.GetValue();
36481 },
36482 InitScrollPos: function(){ 
36483  if(!this.isComboBoxList && this.isCallbackMode && this.GetInitSelectedIndex() == -1)
36484   this.GetScrollDivElement().scrollTop = 0;
36485 },
36486 InitializeLoadOnDemand: function(){
36487  var loadOnDemandRequired = this.isCallbackMode && this.GetEnabledByServer();
36488  this.scrollHelper = loadOnDemandRequired ? new ListBoxScrollCallbackHelper(this) : new ListBoxScrollCallbackHelperBase(this);
36489 },
36490 HasVirtualScrolling: function() { return !!this.itemsInfo || this.itemsManager instanceof ListBoxItemsVirtualManager; },
36491 CreateItemsManager: function() {
36492  if (this.HasVirtualScrolling()) {
36493   var manager = new ListBoxItemsVirtualManager(this);
36494   manager.InitializeItems(this.itemsInfo, this.itemsValue);
36495   delete this.itemsInfo;
36496   return manager;
36497  }
36498  return new ListBoxItemsDefaultManager(this);
36499 },
36500 InlineInitialize: function(){
36501  if(this.HasVirtualScrolling())
36502   this.freeUniqIndex = 0;
36503  this.itemsManager = this.CreateItemsManager();
36504  this.filterStrategy = this.isComboBoxList ? null : this.CreateFilterStrategy();
36505  this.EnsureFixWidthRow();
36506  this.InitializeNativeCheckHandlers();
36507  this.LockScrollHandler();
36508  this.InitSpecialKeyboardHandling();
36509  this.InitializeItemsAttributes();
36510  this.InitDXTextAttributes();
36511  this.itemsManager.Initialize();
36512  this.AddSelectAllStateItems(true);
36513  this.UnlockScrollHandler();
36514  if(this.NeedToHandleCellWidth()) {
36515   var headerTable = this.GetHeaderTableElement();
36516   var firstHeaderRow = !!headerTable && headerTable.rows[0];
36517   this.CorrectCellNullWidthStyle(firstHeaderRow);
36518   this.CorrectCellNullWidthStyle(this.itemsManager.GetFirstVisibleItemRow());
36519  }
36520  this.EnsureSelectAllElements();
36521  ASPxClientListBoxBase.prototype.InlineInitialize.call(this);
36522 },
36523 GetItemIndexByInsertionOrder: function (itemIndex) { 
36524  return this.HasVirtualScrolling() ? this.GetItem(itemIndex).insertOrderIndex : this.FindFreeIndex();
36525 },
36526 InsertItemRow: function (index, itemProperties) {
36527  var newItemRow = this.itemsManager.CreateNewItemRow(index);
36528  ASPx.Attr.RemoveAttribute(newItemRow, "id");
36529  var listTable = this.GetListTable();
36530  var tbody = this.GetTableRowParent(listTable);
36531  var rowBeforeNewItemRow = this.GetListTableRowBeforeNewItemRow(index, listTable);
36532  if(rowBeforeNewItemRow)
36533   tbody.insertBefore(newItemRow, rowBeforeNewItemRow);
36534  else
36535   tbody.appendChild(newItemRow);  
36536  var newIndex = this.GetItemIndexByInsertionOrder(index);
36537  var newId = this.CreateItemId(newIndex);
36538  var newClientId = this.CreateItemClientId(newIndex);
36539  this.InitializeItemAttributes(newItemRow, newClientId, true);
36540  this.AddStateControllerClasses(newId);
36541  this.PrepareItem(newItemRow, itemProperties);
36542  if (this.needUnselectableItemRows)
36543   this.SetItemRowUnselectable(newItemRow);
36544  if (this.GetIsCheckColumnExists() && !this.IsNativeCheckBoxes()) {
36545   if (!this.internalCheckBoxCollection)
36546    this.CreateInternalCheckBoxCollection();
36547   this.AddInternalCheckBoxToCollection(index);
36548  }
36549 },
36550 RemoveItemRow: function (index) {
36551  if (this.GetIsCheckColumnExists() && !this.IsNativeCheckBoxes())
36552   this.RemoveInternalCheckBoxFromCollecntion(index);
36553  var row = this.GetItemRow(index);
36554  if (ASPx.IsExistsElement(row)) {
36555   var firstCellId = this.GetItemElement(index).id;
36556   var itemId = firstCellId.match(/LBI\d+/)[0];
36557   this.RemoveStateControllerClasses(itemId);
36558   row.parentNode.removeChild(row);
36559  }
36560 },
36561 SetItemRowsUnselectable: function() {
36562  var count = this.GetItemCount();
36563  for (var i = 0; i < count; i++) {
36564   var itemRow = this.GetItemRow(i);
36565   if (itemRow)
36566    this.SetItemRowUnselectable(itemRow);
36567  }
36568  this.needUnselectableItemRows = true;
36569 },
36570 SetItemRowUnselectable: function (itemRow) {
36571  for (var j = 0; j < itemRow.cells.length; j++)
36572   ASPx.Selection.SetElementAsUnselectable(itemRow.cells[j], true);
36573 },
36574 GetInactiveFilterElementClassName: function() {
36575  return inactiveFilterElementClassName;
36576 },
36577 GetAnimatedFilterElementClassName: function() {
36578  return "dxeLBAnimatedFilterPanelSys";
36579 },
36580 GetCompactViewFilterAdjacentScrollDivSelector: function() {
36581  return "*[class*=\"dxeListBoxFilter\"]:not(.dxeLBInactiveFilterPanelSys) + *[class*=\"dxeListBoxSelectAll\"] + .dxlbd";
36582 },
36583 GetCompactViewInactiveFilterAdjacentScrollDivSelector: function() {
36584  return ".dxeLBInactiveFilterPanelSys + *[class*=\"dxeListBoxSelectAll\"] + .dxlbd";
36585 },
36586 EnsureFilteringElements: function () {
36587  if(this.enableFiltering) {
36588   this.EnsureFilteringTextBox();
36589   if(!this.customFilteringEditorID) {
36590    this.filterMainElement = this.GetChildElement(filterMainElementID);
36591    this.showFilterButton = this.GetShowFilterButton();
36592    if(this.showFilterButton) {
36593     this.showFilterButton.ownerListBox = this;
36594     var changeEventMethod = ASPx.Attr.ChangeEventsMethod(this.GetEnabled());
36595     this.ChangeSpecialInputEnabledAttributes(this.showFilterButton.GetInternalButton(), changeEventMethod, true);
36596     this.showFilterButton.SetEnabled(this.GetEnabled());
36597     this.UpdateFilterButtonHeight();
36598     this.UpdateShowHideFilterElementCssRules();
36599    }
36600   }
36601  }
36602 },
36603 CreateFilterStrategy: function() {
36604  if(this.enableFiltering)
36605   return new ListBoxFilterStrategy(this);
36606  return new ListEditFilterStrategyBase();
36607 },
36608 UpdateShowHideFilterElementCssRules: function() {
36609  var scrollDiv = this.GetScrollDivElement();
36610  var scrollDivClientHeight = scrollDiv.offsetHeight - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(scrollDiv);
36611  var filterMainElementOffsetHeight = this.GetFilterMainElementHeight();
36612  if (ASPx.GetElementVisibility(this.filteringTextBox.GetMainElement(), true))
36613   scrollDivClientHeight += filterMainElementOffsetHeight;
36614  var showHideFilterStyle = this.EnsureShowHideFilterStyle();
36615  var mainElementSelector = "#" + this.name;
36616  var styleContent = [
36617   mainElementSelector + " " + this.GetCompactViewFilterAdjacentScrollDivSelector()
36618    + " { max-height: " + (scrollDivClientHeight - filterMainElementOffsetHeight) + "px; }",
36619   mainElementSelector + " " + this.GetCompactViewInactiveFilterAdjacentScrollDivSelector()
36620    + " { max-height: " + scrollDivClientHeight + "px; }"
36621  ];
36622  showHideFilterStyle.innerHTML = styleContent.join('\n');
36623 },
36624 EnsureShowHideFilterStyle: function() {
36625  if(!this.showHideFilterStyle) {
36626   this.showHideFilterStyle = this.FindShowHideFilterStyle();
36627   if(!this.showHideFilterStyle) {
36628    this.showHideFilterStyle = document.createElement('style');
36629    this.showHideFilterStyle.id = this.GetShowHideFilterStyleID();
36630    ASPx.Attr.AppendStyleType(this.showHideFilterStyle);
36631    document.getElementsByTagName('head')[0].appendChild(this.showHideFilterStyle);
36632   }
36633  }
36634  return this.showHideFilterStyle;
36635 },
36636 FindShowHideFilterStyle: function() {
36637  return ASPx.GetChildById(document.getElementsByTagName('head')[0], this.GetShowHideFilterStyleID());
36638 },
36639 GetShowHideFilterStyleID: function() {
36640  return this.name + "ShowHideFilterStyle";
36641 },
36642 GetFilterMainElementHeight: function() {
36643  if(!this.filterMainElementHeight) {
36644   var filteringTextBoxClone = this.filteringTextBox.GetMainElement().cloneNode(true);
36645   filteringTextBoxClone.style.position = "absolute";
36646   filteringTextBoxClone.style.visibility = "hidden";
36647   document.body.appendChild(filteringTextBoxClone);
36648   this.filterMainElementHeight = filteringTextBoxClone.offsetHeight;
36649   document.body.removeChild(filteringTextBoxClone);
36650   var filterMainElementClone = this.filterMainElement.cloneNode(false);
36651   filterMainElementClone.style.position = "absolute";
36652   filterMainElementClone.style.visibility = "hidden";
36653   ASPx.RemoveClassNameFromElement(filterMainElementClone, this.GetInactiveFilterElementClassName());
36654   ASPx.RemoveClassNameFromElement(filterMainElementClone, this.GetAnimatedFilterElementClassName());
36655   document.body.appendChild(filterMainElementClone);
36656   this.filterMainElementHeight += ASPx.GetTopBottomBordersAndPaddingsSummaryValue(filterMainElementClone);
36657   document.body.removeChild(filterMainElementClone);
36658  }
36659  return this.filterMainElementHeight;
36660 },
36661 RemoveShowHideFilterCssRules: function () {
36662  var showHideFilterStyle = this.FindShowHideFilterStyle();
36663  if(showHideFilterStyle)
36664   showHideFilterStyle.innerHTML = "";
36665 },
36666 UpdateFilterButtonHeight: function() {
36667  setTimeout(function () {
36668   this.showFilterButton.SetHeight(this.selectAllMainElement.offsetHeight - ASPx.GetVerticalBordersWidth(this.selectAllMainElement));
36669  }.aspxBind(this), 0);
36670 },
36671 EnsureFilteringTextBox: function() {
36672  this.filteringTextBox = this.FindFilteringTextBox();
36673  if(this.filteringTextBox) {
36674   this.filteringTextBox.UserInput.AddHandler(this.filterStrategy.OnInput.bind(this.filterStrategy));
36675   if(!this.customFilteringEditorID) {
36676    this.filteringTextBox.ownerListBox = this;
36677    var changeEventMethod = ASPx.Attr.ChangeEventsMethod(this.GetEnabled());
36678    this.ChangeSpecialInputEnabledAttributes(this.filteringTextBox.GetInputElement(), changeEventMethod, true);
36679    this.filteringTextBox.SetEnabled(this.GetEnabled());
36680    this.filteringTextBox.KeyDown.AddHandler(function(sender, args) {
36681     if(ASPx.Evt.GetKeyCode(args.htmlEvent) === ASPx.Key.Esc)
36682      sender.GetInputElement().value = "";
36683    });
36684   }
36685  }
36686 },
36687 FindFilteringTextBox: function() {
36688  var actualFilteringTextBoxID = this.customFilteringEditorID ? this.customFilteringEditorID : this.name + "_" + filteringTextBoxID;
36689  return ASPx.GetControlCollection().Get(actualFilteringTextBoxID);
36690 },
36691 CollectionChanged: function(isFiltering) {
36692  if(this.APILockCount == 0) {
36693   if(ASPx.Browser.IE) { 
36694    var selectedIndex = this.GetSelectedIndex();
36695    if (selectedIndex > -1) {
36696     var selectedItemTextCell = this.GetItemFirstTextCell(selectedIndex);
36697     var controller = ASPx.GetStateController();
36698     controller.DeselectElementBySrcElement(selectedItemTextCell);
36699     controller.SelectElementBySrcElement(selectedItemTextCell);
36700    }
36701   }
36702  }
36703  if(isFiltering)
36704   this.itemsManager.OnEndItemsFiltering();
36705 },
36706 ChangeItemsFilteredState: function(action) {
36707  this.itemsManager.ChangeItemsFilteredState(action);
36708 },
36709 RewriteFilteredItemIndices: function (newFilteredItemIndices) {
36710  this.itemsManager.RewriteFilteredItemIndices(newFilteredItemIndices);
36711 },
36712 BeforeClientFiltering: function () {
36713  this.itemsManager.BeforeClientFiltering();
36714 },
36715 ApplyFilterToItem: function (index, isSatisfy, savePrevState, isFilterReset) {
36716  this.itemsManager.ApplyFilterToItem(index, isSatisfy, savePrevState, isFilterReset);
36717 },
36718 RestorePrevFilteredState: function (index) {
36719  this.itemsManager.RestorePrevFilteredState(index);
36720 },
36721 IsItemFiltered: function (index) {
36722  return this.itemsManager.IsItemFiltered(index);
36723 },
36724 IsClientFilterApplied: function() {
36725  return !this.isComboBoxList && this.filterStrategy.filter != "" && !this.isCallbackMode;
36726 },
36727 MakeAllItemsVisible: function () {
36728  this.itemsManager.MakeAllItemsVisible();
36729 },
36730 ShowFilterElement: function() {
36731  ASPx.RemoveClassNameFromElement(this.filterMainElement, this.GetInactiveFilterElementClassName());
36732  this.showFilterButton.SetVisible(false);
36733  if(ASPx.Browser.VirtualKeyboardSupported) {
36734   this.ReplaceFilteringTextBoxShowNullTextOnFocusFunction();
36735   this.isFilterEditorShowing = false;
36736   this.filteringTextBox.GetInputElement().focus();
36737  }
36738  else
36739   setTimeout(function () {
36740    this.isFilterEditorShowing = false;
36741    this.filteringTextBox.GetInputElement().focus();
36742   }.aspxBind(this), 200);
36743 },
36744 HideFilterElement: function () {
36745  ASPx.AddClassNameToElement(this.filterMainElement, this.GetInactiveFilterElementClassName());
36746  this.showFilterButton.SetVisible(true);
36747  this.UpdateFilterButtonHeight();
36748  this.CorrectHeight(true);
36749  setTimeout(function () {
36750   this.filteringTextBox.UnlockFocusEvents();
36751   this.showFilterButton.GetInternalButton().focus();
36752  }.aspxBind(this), 0);
36753 },
36754 ReplaceFilteringTextBoxShowNullTextOnFocusFunction: function () {
36755  if(this.filteringTextBox.nullTextDisplayMode === ASPx.NullTextDisplayMode.UnfocusedAndFocused) {
36756   var origin = this.filteringTextBox.ensureActivateFocusedNullTextMechanism;
36757   var filteringTextBox = this.filteringTextBox;
36758   this.filteringTextBox.ensureActivateFocusedNullTextMechanism = function() {
36759    setTimeout(function() {
36760     origin.call(filteringTextBox);
36761     filteringTextBox.ensureActivateFocusedNullTextMechanism = origin;
36762     setTimeout(function () {
36763      if(filteringTextBox.isFocusedNullTextElementDisplayed())
36764       filteringTextBox.adjustFocusedNullTextElement();
36765     }, 300);
36766    }, 400);
36767   };
36768  }
36769 },
36770 EnsureSelectAllElements: function () {
36771  if(this.enableSelectAll && !this.selectAllMainElement) {
36772   this.EnsureSelectAllCheckElement();
36773   this.selectAllMainElement = this.GetChildElement(selectAllMainElementID);
36774   var selectAllClickableElement = this.GetSelectAllClickableElement();
36775   ASPx.Evt.AttachEventToElement(selectAllClickableElement, "click", this.onSelectAllClickableElementClick.bind(this));
36776  }
36777 },
36778 EnsureSelectAllCheckElement: function () {
36779  var selectAllCheckBoxInput = null;
36780  if(!this.IsNativeCheckBoxes()) {
36781   this.CreateSelectAllCheckBox();
36782   selectAllCheckBoxInput = this.GetSelectAllCheckBoxFocusableElement();
36783  }
36784  else {
36785   this.nativeSelectAllCheckBox = this.GetChildElement(selectAllCheckBoxID + "_I");
36786   this.nativeSelectAllCheckBox.disabled = !this.GetEnabled();
36787   selectAllCheckBoxInput = this.nativeSelectAllCheckBox;
36788  }
36789  var changeEventMethod = ASPx.Attr.ChangeEventsMethod(this.GetEnabled());
36790  this.ChangeSpecialInputEnabledAttributes(selectAllCheckBoxInput, changeEventMethod, true);
36791 },
36792 CreateSelectAllCheckBox: function () {
36793  var selectAllCheckBoxElement = this.GetChildElement(selectAllCheckBoxID);
36794  var selectAllCheckBoxInputElement = this.GetChildElement(selectAllCheckBoxID + "_S");
36795  var selectAllStateController = ASPx.CheckableElementStateController.Create(this.icbImageProperties, CheckBoxInputKey.Checked, CheckBoxInputKey.Unchecked, CheckBoxInputKey.Indeterminate, true);  
36796  this.selectAllCheckBox = new ASPx.CheckBoxInternal(selectAllCheckBoxInputElement, selectAllStateController, true, false,
36797   ASPx.CheckEditElementHelper.Instance, selectAllCheckBoxElement, true, undefined, undefined, this.accessibilityCompliant);
36798  this.selectAllCheckBox.CreateFocusDecoration(this.icbFocusedStyle);
36799  this.selectAllCheckBox.SetEnabled(this.GetEnabled());
36800  this.selectAllCheckBox.GetReadOnly = this.GetReadOnly.bind(this);
36801  this.selectAllCheckBox.CheckedChanged.AddHandler(this.onSelectAll.aspxBind(this));
36802  if(ASPx.Browser.WebKitFamily)
36803   ASPx.Evt.AttachEventToElement(this.selectAllCheckBox.mainElement.parentNode, "selectstart", ASPx.Evt.PreventEventAndBubble);
36804 },
36805 onSelectAllClickableElementClick: function (evt) {
36806  if (!this.GetEnabled() || this.GetReadOnly()) {
36807   if (this.IsNativeCheckBoxes() || this.isNative)
36808    ASPx.Evt.PreventEvent(evt);
36809   return false;
36810  }
36811  if(this.IsSelectAllCheckBoxClicked(ASPx.Evt.GetEventSource(evt)))
36812   return;
36813  if(!this.IsNativeSelectAllCheckBoxClicked(ASPx.Evt.GetEventSource(evt))) {
36814   var currentCheckState = this.getSelectAllCheckElementState();
36815   var newCheckState = currentCheckState != ASPx.CheckBoxCheckState.Checked ?
36816    ASPx.CheckBoxCheckState.Checked : ASPx.CheckBoxCheckState.Unchecked;
36817   this.updateSelectAllCheckElementState(newCheckState);
36818  }
36819  this.onSelectAll();
36820 },
36821 onSelectAll: function () {
36822  this.LockUpdateSelectAllElements();
36823  var selectAllCheckState = this.getSelectAllCheckElementState();
36824  this.onSelectAllCore(selectAllCheckState);
36825  this.UnlockUpdateSelectAllElements();
36826 },
36827 onSelectAllCore: function (currentCheckState) {
36828  var toSelect = currentCheckState == ASPx.CheckBoxCheckState.Checked;
36829  var valueBeforeSelectAll = this.GetValue();
36830  var selectionBeforeSelectAll = this.GetValueFromValueInput();
36831  if (toSelect)
36832   this.SelectAll();
36833  else
36834   this.UnselectAll();
36835  if(selectionBeforeSelectAll !== this.GetValueFromValueInput())
36836   this.OnItemSelectionChanged(-1, toSelect, true, valueBeforeSelectAll !== this.GetValue());
36837 },
36838 getSelectAllCheckElementState: function () {
36839  if(this.selectAllCheckBox)
36840   return this.selectAllCheckBox.GetCurrentCheckState();
36841  if(this.nativeSelectAllCheckBox)
36842   return this.nativeSelectAllCheckBox.checked ? ASPx.CheckBoxCheckState.Checked : ASPx.CheckBoxCheckState.Unchecked;
36843  return null;
36844 },
36845 updateSelectAllCheckElementState: function (checkState) {
36846  if(this.selectAllCheckBox) {
36847   var checkValue = this.selectAllCheckBox.stateController.GetValueByCheckState(checkState);
36848   this.selectAllCheckBox.SetValue(checkValue, !this.isInitialized);
36849  } else if(this.nativeSelectAllCheckBox)
36850   this.nativeSelectAllCheckBox.checked = checkState === ASPx.CheckBoxCheckState.Checked;
36851 },
36852 updateSelectAllElementsState: function() {
36853  if(!this.IsUpdateSelectAllElementsLocked() && this.enableSelectAll) {
36854   this.EnsureSelectAllElements();
36855   this.updateSelectAllElementsStateCore();
36856  }
36857 },
36858 updateSelectAllElementsStateCore: function() {
36859  var selectAllCheckState = ASPx.CheckBoxCheckState.Unchecked;
36860  var isFilteredSelectedItemFound = false;
36861  var isFilteredUnselectedItemFound = false;
36862  var itemCount = this.GetItemCount();
36863  for(var i = 0; i < itemCount; i++) {
36864   if(this.IsItemFiltered(i)) {
36865    if(this.GetIsItemSelected(i))
36866     isFilteredSelectedItemFound = true;
36867    else
36868     isFilteredUnselectedItemFound = true;
36869   }
36870   if (isFilteredSelectedItemFound && isFilteredUnselectedItemFound) {
36871    selectAllCheckState = ASPx.CheckBoxCheckState.Indeterminate;
36872    break;
36873   }
36874   if(i == itemCount - 1 && isFilteredSelectedItemFound && !isFilteredUnselectedItemFound)
36875    selectAllCheckState = ASPx.CheckBoxCheckState.Checked;
36876  }
36877  this.updateSelectAllCheckElementState(selectAllCheckState);
36878 },
36879 changeSelectAllElementsEnabledState: function(enabled) {
36880  var selectAllCheckBoxInput = null;
36881  if(this.selectAllCheckBox) {
36882   this.selectAllCheckBox.SetEnabled(enabled);
36883   selectAllCheckBoxInput = this.GetSelectAllCheckBoxFocusableElement();
36884  }
36885  else if(this.nativeSelectAllCheckBox) {
36886   this.nativeSelectAllCheckBox.disabled = !enabled;
36887   selectAllCheckBoxInput = this.nativeSelectAllCheckBox;
36888  }
36889  if(selectAllCheckBoxInput) {
36890   var changeEventMethod = ASPx.Attr.ChangeEventsMethod(enabled);
36891   this.ChangeSpecialInputEnabledAttributes(selectAllCheckBoxInput, changeEventMethod, true);
36892  }
36893  ASPx.GetStateController().SetElementEnabled(this.selectAllMainElement, enabled);
36894 },
36895 NeedToHandleCellWidth: function() {
36896  return this.IsMultiColumn() && (ASPx.Browser.Firefox || ASPx.Browser.IE || ASPx.Browser.Edge);
36897 },
36898 CorrectCellNullWidthStyle: function(row) {
36899  if(!row) return;
36900  var cellCount = row.cells.length;
36901  for(var i = 0; i < cellCount; i++) {
36902   var cellStyle = !!window.getComputedStyle ? window.getComputedStyle(row.cells[i]) : ASPx.GetCurrentStyle(row.cells[i]);
36903   var originalWidth = parseInt(cellStyle.width);
36904   var needToApply = originalWidth === 0 || originalWidth <= ASPx.PxToInt(cellStyle.paddingLeft) || originalWidth <= ASPx.PxToInt(cellStyle.paddingRight);
36905   var action = needToApply ? ASPx.AddClassNameToElement : ASPx.RemoveClassNameFromElement;
36906   action(row.cells[i], NullSizeCellClassName);
36907  }
36908 },
36909 InitializeNativeCheckHandlers: function() {
36910  this.nativeCheckOnFocusHandler = function(evt) {
36911   this.SetFocusableCheckInput(ASPx.Evt.GetEventSource(evt));
36912  }.aspxBind(this);
36913 },
36914 ChangeNativeCheckEnabledAttributes: function(element, method) {
36915  if(this.nativeCheckOnFocusHandler)
36916   method(element, "focus", this.nativeCheckOnFocusHandler);
36917 },
36918 InitializeItemsAttributes: function() { 
36919  var listTable = this.GetListTable();
36920  if(this.isHasFakeRow){
36921   this.LockSynchronization();
36922   this.ClearItems();
36923   this.UnlockSynchronization();
36924  }
36925  listTable.ListBoxId = this.name;
36926  var rowIdConst = this.name + "_";
36927  if(this.hasSampleItem)
36928   this.InitializeItemAttributes(this.GetSampleItemRow(), rowIdConst + lbSIIdSuffix);
36929  if(!this.HasVirtualScrolling()) {
36930   rowIdConst += lbIIdSuffix;
36931   var count = this.GetItemCount();
36932   if (this.accessibilityCompliant && this.IsMultiColumn())
36933    count--;
36934   for (var i = 0; i < count; i++)
36935    this.InitializeItemAttributes(this.GetItemRow(i), rowIdConst + i);
36936  }
36937  var rows = listTable.rows;
36938  if(this.accessibilityCompliant && rows[rows.length - 1])
36939   rows[rows.length - 1].id = this.GetAccessibilityHeaderRowID();
36940 },
36941 InitializeItemAttributes: function(row, rowId) {
36942  var cells = row.cells;
36943  var itemCellsIdSuffixes = this.GetItemCellsIdPostfixes();
36944  for(var i = 0; i < row.cells.length; i++) {
36945   cells[i].style.textAlign = this.itemHorizontalAlign;
36946   cells[i].id = rowId + itemCellsIdSuffixes[i];
36947  }
36948  if(this.GetIsCheckColumnExists() && this.IsNativeCheckBoxes() && rowId != this.GetSampleItemRowID()) {
36949   var input = this.GetItemCheckBoxInput(this.GetItemIndexByRow(row));
36950   this.ChangeNativeCheckEnabledAttributes(input, ASPx.Attr.ChangeEventsMethod(this.GetEnabled()));
36951   this.ChangeSpecialInputEnabledAttributes(input, ASPx.Attr.ChangeEventsMethod(this.GetEnabled()));
36952  }
36953 },
36954 InitializePageSize: function(){
36955  var divElement = this.GetScrollDivElement();
36956  var count = this.GetItemCount();
36957  if (divElement && count > 0) {
36958   var firstVisibleRow = this.itemsManager.GetFirstVisibleItemRow();
36959   if(firstVisibleRow)
36960    this.scrollPageSize = Math.round(divElement.clientHeight / firstVisibleRow.offsetHeight) - 1;
36961  }
36962 },
36963 AddSelectAllStateItems: function(isInitialization) {
36964  if (this.enableSelectAll && typeof (ASPx.GetStateController) !== "undefined") {
36965   var stateController = ASPx.GetStateController();
36966   var name = this.name + "_" + selectAllMainElementID;
36967   if (!isInitialization)
36968    this.ClearStateItemCache(stateController, name, [""]);
36969   stateController.AddHoverItem(name, this.selectAllHoverClasses, this.selectAllHoverCssArray, "", null, null, true);
36970   stateController.AddDisabledItem(name, this.selectAllDisabledClasses, this.selectAllDisabledCssArray, "", null, null, true);
36971  }
36972 },
36973 RemoveSelectAllStateItems: function() {
36974  if (this.enableSelectAll && typeof (ASPx.GetStateController) !== "undefined") {
36975   var stateController = ASPx.GetStateController();
36976   var name = this.name + "_" + selectAllMainElementID;
36977   this.ClearStateItemCache(stateController, name, [""]);
36978   stateController.RemoveHoverItem(name, "");
36979   stateController.RemoveDisabledItem(name, "");
36980  }
36981 },
36982 ClearStateItemCache: function(stateController, name, suffixes) {
36983  for (var i = 0; i < suffixes.length; i++) {
36984   var element = document.getElementById(name + suffixes[i]);
36985   var elements = ASPx.GetNodes(element);
36986   elements.push(element);
36987   ASPx.Data.ForEach(elements, stateController.ClearElementCache.bind(stateController));
36988  }
36989 },
36990 AfterInitialize: function() {
36991  if(this.disableScrolling) {
36992   var scrollDiv = this.GetScrollDivElement();
36993   var mainElement = this.GetMainElement();
36994   var listTable = this.GetListTable();
36995   scrollDiv.style.height = mainElement.style.height = (listTable 
36996    ? ASPx.GetClearClientHeight(listTable)
36997    : this.GetListTableHeight() - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(mainElement)) + "px";
36998  }
36999  this.CallbackSpaceInit(true);
37000  if(this.accessibilityCompliant)
37001   this.accessibilityHelper = new AccessibilityHelperListBox(this);
37002  ASPxClientListBoxBase.prototype.AfterInitialize.call(this);
37003 },
37004 GetEnabledByServer: function(){
37005  return this.enabled;
37006 },
37007 SetEnabled: function(enabled){  
37008  ASPxClientListBoxBase.prototype.SetEnabled.call(this, enabled);
37009  this.CallbackSpaceInit(false);
37010 },
37011 SetReadOnlyInternal: function(readOnly) {
37012  ASPxClientListBoxBase.prototype.SetReadOnlyInternal.call(this, readOnly);
37013  if (readOnly) {
37014   this.RemoveSelectAllStateItems();
37015   this.itemsManager.RemoveHoverStateItem();
37016  }
37017  else {
37018   this.AddSelectAllStateItems(false);
37019   this.itemsManager.AddStateItems(true, true);
37020  }
37021 }, 
37022 CallbackSpaceInit: function(isInitialization){
37023  if(this.isCallbackMode){
37024   this.SetBottomScrollSpacerVisibility(this.GetScrollSpacerVisibility(false));
37025   this.SetTopScrollSpacerVisibility(this.GetScrollSpacerVisibility(true));
37026   if(isInitialization || this.isComboBoxList){
37027    this.EnsureSelectedItemVisible();
37028    ASPx.Evt.AttachEventToElement(this.GetScrollDivElement(), "scroll", aspxLBScroll);
37029   }
37030   this.itemsManager.FixItemTruncatingIfRequired();
37031  }
37032 },
37033 GetListTable: function() {
37034  return this.tempCache.Get("ListTable", this.GetListTableCore, this);
37035 },
37036 GetListTableCore: function(){
37037  if(!ASPx.IsExistsElement(this.listTable))
37038   this.listTable = ASPx.GetElementById(this.name + lTableIdSuffix);
37039  return this.listTable;
37040 },
37041 GetItemElements: function() {
37042  return this.GetListTable().rows;
37043 },
37044 GetListTableHeight: function(){
37045  return this.GetListTable().offsetHeight;
37046 },
37047 GetHeaderDivElement: function(){
37048  if(!ASPx.IsExistsElement(this.headerDiv))
37049   this.headerDiv = ASPx.GetElementById(this.name + lbHeaderDivIdSuffix);
37050  return this.headerDiv;
37051 },
37052 GetHeaderTableElement: function(){
37053  if(!ASPx.IsExistsElement(this.headerTable)){
37054   var headerDiv = this.GetHeaderDivElement();
37055   this.headerTable = ASPx.GetNodeByTagName(headerDiv, "table", 0);
37056  }
37057  return this.headerTable;
37058 },
37059 GetScrollDivElement: function(){
37060  if(!ASPx.IsExistsElement(this.scrollDivElement))
37061   this.scrollDivElement = document.getElementById(this.name + lbDSuffix);
37062  return this.scrollDivElement;
37063 },
37064 GetItemElement: function(index) {
37065  return this.itemsManager.GetItemElement(index);
37066 },
37067 GetItemRow: function(index){
37068  return this.itemsManager.GetItemRow(index);
37069 },
37070 GetItemIndexByRow: function (itemRow) {
37071  return this.itemsManager.GetItemIndexByRow(itemRow);
37072 },
37073 GetItemSelectableElementsByRow: function(row) {
37074  return row.cells;
37075 },
37076 GetItemTexts: function(item) {
37077  return item.texts ? item.texts : [ item.text ];
37078 },
37079 GetItemHtmlContent: function(index) {
37080  return this.itemsManager.GetItemHtmlContent(index);
37081 },
37082 GetItemCount: function(){
37083  return this.itemsManager.GetItemCount();
37084 },
37085 GetListTableRowParent: function() {
37086  var listTable = this.GetListTable();
37087  return this.GetTableRowParent(listTable);
37088 },
37089 EnsureFixWidthRow: function (isSetItemHtmlProcessing) {
37090  var needfixWidthRow = !this.ContainsFixWidthRow() && this.IsMultiColumn() && (isSetItemHtmlProcessing || this.hasItemTemplate);
37091  if (needfixWidthRow)
37092   this.CreateFixWidthRow();
37093 },
37094 CreateFixWidthRow: function() {
37095  this.fixWidthRow = document.createElement("TR");
37096  var etalonRow = this.GetSampleItemRow();
37097  for(var i = 0; i < etalonRow.cells.length; i++) {
37098   var fixWidthCell = document.createElement("TD");
37099   var etalonCell = etalonRow.cells[i];
37100   var etalonCellStyle = ASPx.GetCurrentStyle(etalonCell);
37101   fixWidthCell.style.width = etalonCell.style.width || etalonCellStyle.width;
37102   fixWidthCell.style.borderLeftWidth = etalonCellStyle.borderLeftWidth;
37103   fixWidthCell.style.borderRightWidth = etalonCellStyle.borderRightWidth;
37104   fixWidthCell.style.borderLeftStyle = etalonCellStyle.borderLeftStyle;
37105   fixWidthCell.style.borderRightStyle = etalonCellStyle.borderRightStyle;
37106   fixWidthCell.style.paddingLeft = etalonCellStyle.paddingLeft;
37107   fixWidthCell.style.paddingRight = etalonCellStyle.paddingRight;
37108   fixWidthCell.style.boxSizing = etalonCellStyle.boxSizing;
37109   fixWidthCell.style.display = etalonCellStyle.display;
37110   this.fixWidthRow.appendChild(fixWidthCell);
37111  }
37112  ASPx.SetElementVisibility(this.fixWidthRow, "hidden");
37113  this.fixWidthRow.style.height = "0px";
37114  var listTableBody = this.GetListTableRowParent();
37115  listTableBody.insertBefore(this.fixWidthRow, listTableBody.childNodes[0]);
37116 },
37117 ContainsFixWidthRow: function() {
37118  return this.fixWidthRow && this.fixWidthRow.parentNode === this.GetListTableRowParent();
37119 },
37120 GetVisibleItemCount: function () {
37121  return this.itemsManager.GetVisibleItemCount();
37122 },
37123 GetIndexVisibleItem: function(item) {
37124  var count = this.GetItemCount();
37125  var visibleItemCount = 0;
37126  for(var i = 0; i < count; i ++){
37127   if(this.IsItemFiltered(i))
37128    visibleItemCount++;
37129   var curItem = this.GetItem(i);
37130   if(item.value === curItem.value && item.text === curItem.text)
37131    break;
37132  }
37133  return visibleItemCount;
37134 },
37135 GetItemCellCount: function(){
37136  if(this.hasSampleItem)
37137   return this.GetSampleItemRow().cells.length;
37138  if(this.GetItemCount() > 0)
37139   return this.itemsManager.GetFirstVisibleItemRow().cells.length;
37140  return 0;
37141 },
37142 GetItemTextCellCount: function(){
37143  return this.GetItemCellCount() - this.GetItemFirstTextCellIndex();
37144 },
37145 GetItemFirstTextCellIndex: function(){
37146  var itemFirstTextCellIndex  = 0;
37147  if(this.GetIsCheckColumnExists())
37148   itemFirstTextCellIndex++;
37149  if(this.imageCellExists)
37150   itemFirstTextCellIndex++;
37151  return itemFirstTextCellIndex;
37152 },
37153 GetItemFirstTextCell: function(index){
37154  return this.GetItemTextCell(index, 0);
37155 },
37156 GetItemTextCell: function(itemIndex, textCellIndex) {
37157  var rowElement = this.GetItemRow(itemIndex);
37158  if(rowElement == null) 
37159   return null;
37160  return rowElement.cells[this.GetItemFirstTextCellIndex() + textCellIndex];
37161 },
37162 GetItemTopOffset: function(index){
37163  return this.itemsManager.GetItemTopOffset(index);
37164 },
37165 GetItemHeight: function(index){
37166  return this.itemsManager.GetItemHeight(index);
37167 },
37168 ResetItemHeightIfRequired: function (index) {
37169  return this.itemsManager.ResetItemHeightIfRequired(index);
37170 },
37171 GetItemsHeight: function(){
37172  return this.itemsManager.GetItemsHeight();
37173 },
37174 GetItemsWidth: function () {
37175  return this.itemsManager.GetItemsWidth();
37176 },
37177 GetItemCheckBoxInput: function(index){
37178  var itemRow = this.GetItemRow(index);
37179  var checkBoxCell = itemRow ? itemRow.cells[this.GetCheckBoxCellIndex()] : null;
37180  return checkBoxCell ? ASPx.GetNodesByTagName(checkBoxCell, "input")[0] : null;
37181 },
37182 GetIsCheckColumnExists: function(){
37183  if(!this.checkCellExists)
37184   this.checkCellExists = this.CheckColumnSelectionMode();
37185  return this.checkCellExists;
37186 },
37187 GetCheckBoxCellIndex: function(){
37188  return 0;
37189 },
37190 GetImageCellIndex: function(){
37191  return this.GetIsCheckColumnExists() ? 1 : 0;
37192 },
37193 GetItemCellsIdPostfixes: function(){
37194  if(this.itemCellsIdPostfixes == null){
37195   this.itemCellsIdPostfixes = [];
37196   var i = 0;
37197   if(this.GetIsCheckColumnExists()) {
37198    this.itemCellsIdPostfixes.push(lbIPostfixes[0]);
37199    i++;
37200   }
37201   if(this.imageCellExists){
37202    this.itemCellsIdPostfixes.push(lbIPostfixes[1]);
37203    i++;
37204   }
37205   var cellCount = this.GetItemCellCount();
37206   for(; i < cellCount; i++) 
37207    this.itemCellsIdPostfixes.push(lbIPostfixes[2] + i);
37208  }
37209  return this.itemCellsIdPostfixes;
37210 },
37211 AdjustControl: function (nestedCall) {
37212  if(this.IsAdjustmentRequired()) 
37213   this.heightCorrected = false;
37214  ASPxClientEdit.prototype.AdjustControl.call(this, nestedCall);
37215 },
37216 AdjustControlCore: function(){
37217  this.RemoveShowHideFilterCssRules();
37218  if(this.disableScrolling)
37219   return;
37220  ASPxClientEdit.prototype.AdjustControlCore.call(this);
37221  this.CorrectSize();
37222  this.itemsManager.Adjust();
37223  this.EnsureSelectedItemVisible();
37224  if(!this.isComboBoxList && ASPx.Browser.IE) 
37225   this.CorrectWidth();
37226  if(this.showFilterButton) {
37227   this.UpdateFilterButtonHeight();
37228   this.UpdateShowHideFilterElementCssRules();
37229  }
37230 },
37231 CorrectSize: function() {
37232  if(this.isComboBoxList || this.disableScrolling || this.filterStrategy.currentCallbackIsFiltration)
37233   return;
37234  this.LockScrollHandler();
37235  this.CorrectHeight();
37236  this.CorrectWidth();
37237  this.InitializePageSize();
37238  this.UnlockScrollHandler();
37239 },
37240 OnCorrectSizeByTimer: function() {
37241  if(this.IsVisible())
37242   this.CorrectSize();
37243 }, 
37244 SetProtectionFromFlick_inFF: function(changeVisibility, changeDisplay){
37245  if(!ASPx.Browser.Firefox) return;
37246  var listTable = this.GetListTable();
37247  if(changeVisibility)
37248   listTable.style.visibility = "hidden";
37249  if(changeDisplay)
37250   listTable.style.display = "none";
37251 },
37252 ResetProtectionFromFlick_inFF: function(){
37253  if(!ASPx.Browser.Firefox) return;
37254  var listTable = this.GetListTable();
37255  listTable.style.visibility = "";
37256  listTable.style.display = "";
37257 },
37258 CorrectHeight: function(force){
37259  if(ASPx.Browser.Firefox && this.heightCorrected && !force) return; 
37260  this.heightCorrected = true;
37261  var mainElement = this.GetMainElement();
37262  var divElement = this.GetScrollDivElement();
37263  divElement.style.height = "0px";
37264  var height = mainElement.offsetHeight;
37265  divElement.style.height = height + "px";
37266  var extrudedHeight = mainElement.offsetHeight;
37267  var heightCorrection = extrudedHeight - height;
37268  if(heightCorrection > 0){
37269   var divHeight = divElement.offsetHeight;
37270   this.SetProtectionFromFlick_inFF(true, false);
37271   divElement.style.height = (divHeight - heightCorrection) + "px";
37272   this.ResetProtectionFromFlick_inFF(); 
37273   extrudedHeight = mainElement.offsetHeight;
37274   var paddingsHeightCorrection = extrudedHeight - height;
37275   if(paddingsHeightCorrection > 0)
37276    divElement.style.height = (divHeight - heightCorrection - paddingsHeightCorrection) + "px";
37277  } 
37278 },
37279 IsMultiColumn: function(){
37280  return this.columnFieldNames.length > 0;
37281 },
37282 GetVisibleColumnCount: function() {
37283  if (!this.visibleColumnCount) {
37284   this.visibleColumnCount = this.IsMultiColumn() ?
37285    ASPx.Data.CollectionToArray(this.GetSampleItemRow().cells)
37286     .slice(this.GetItemFirstTextCellIndex())
37287     .filter(function (cell) { return ASPx.GetElementDisplay(cell); }).length
37288    : -1;
37289  }
37290  return this.visibleColumnCount;
37291 },
37292 CorrectWidth: function(){
37293  if(this.IsMultiColumn())
37294   this.CorrectMultiColumnWidth();
37295  else
37296   this.CorrectNonMultiColumnWidth();
37297 },
37298 CorrectMultiColumnWidth: function(){
37299  var scrollBarWidth = this.GetVerticalScrollBarWidth(); 
37300  this.CorrectMultiColumnHeaderWidth(scrollBarWidth);
37301 },
37302 CollapseMultiColumnHeaderWidth:function(){
37303  var headerDivElement = this.GetHeaderDivElement();
37304  headerDivElement.style.width = "0px";
37305 },
37306 CorrectMultiColumnHeaderWidth: function(scrollBarWidth){
37307  var headerDivElement = this.GetHeaderDivElement();
37308  if(ASPx.IsExistsElement(headerDivElement)){
37309   var headerTable;
37310   if(ASPx.Browser.WebKitFamily){
37311    headerTable = this.GetHeaderTableElement();
37312    if(!ASPx.IsExistsElement(headerTable))
37313     headerTable = null;
37314   }
37315   if(headerTable)
37316    headerTable.style.width = "0";
37317   if(this.rtl)
37318    headerDivElement.style.paddingLeft = scrollBarWidth + "px";
37319   else
37320    headerDivElement.style.paddingRight = scrollBarWidth + "px";
37321   if(headerTable)
37322    window.setTimeout(function() { headerTable.style.width = "100%"; }, 0);
37323  }
37324 },
37325 CorrectNonMultiColumnWidth: function(){
37326  var mainElement = this.GetMainElement(),
37327   divElement = this.GetScrollDivElement();
37328  if(this.width == ""){
37329   var itemsWidth = this.GetItemsWidth();
37330   if (itemsWidth != 0 || !ASPx.Browser.NetscapeFamily) { 
37331    divElement.style.width = Math.max((itemsWidth + this.GetVerticalScrollBarWidth()), this.scrollDivMinWidth) + "px";
37332    if(ASPx.Browser.Firefox) 
37333     mainElement.style.width = divElement.offsetWidth + "px";
37334   }
37335  } else {  
37336   mainElement.style.width = this.width;
37337   if(this.width !== "100%") {
37338    var scrollDivWidth = ASPx.Browser.WebKitFamily ? 1 : 0,
37339     isMicrosoftBrowser = ASPx.Browser.Edge || ASPx.Browser.IE;
37340    var oldScrollTop = divElement.scrollTop;
37341    divElement.style.width = scrollDivWidth + "px";
37342    scrollDivWidth = isMicrosoftBrowser ? mainElement.clientWidth - ASPx.GetHorizontalBordersWidth(mainElement) : mainElement.clientWidth;
37343    divElement.style.width = scrollDivWidth + "px";
37344    var isScrollEventWillRaised = divElement.scrollTop != oldScrollTop;
37345    if(isScrollEventWillRaised)
37346     this.itemsManager.DeactivateScrollHandler();
37347    divElement.scrollTop = oldScrollTop;
37348   }
37349  }
37350 },
37351 UpdateAdjustmentFlags: function() {
37352  var mainElement = this.GetMainElement();
37353  if(mainElement) {
37354   var mainElementStyle = ASPx.GetCurrentStyle(mainElement);
37355   this.UpdatePercentSizeConfig([this.width], [mainElementStyle.height, mainElement.style.height]);
37356  }
37357 },
37358 EnsureSelectedItemVisible: function(){
37359  var index = this.GetSelectedIndex();
37360  if(index != -1)
37361   this.MakeItemVisible(index);
37362 },
37363 MakeItemVisible: function(index){
37364  if(!this.IsItemVisible(index))
37365   this.ScrollItemToTop(index);
37366 },
37367 IsItemVisible: function(index){
37368  return this.itemsManager.IsItemVisible(index);
37369 },
37370 ScrollItemToTop: function(index){
37371  this.LockScrollHandler();
37372  this.SetScrollTop(this.GetItemTopOffset(index));
37373  this.UnlockScrollHandler();
37374 },
37375 ScrollToItemVisible: function(index){
37376  if(!this.IsItemVisible(index)){
37377   var scrollDiv = this.GetScrollDivElement();
37378   var scrollTop = scrollDiv.scrollTop;
37379   var scrollDivHeight = scrollDiv.clientHeight;
37380   var itemOffsetTop = this.GetItemTopOffset(index);
37381   var itemHeight = this.GetItemHeight(index);
37382   var itemAbove = scrollTop > itemOffsetTop;
37383   var itemBelow = scrollTop  + scrollDivHeight < itemOffsetTop + itemHeight;
37384   if(itemAbove)
37385    scrollDiv.scrollTop = itemOffsetTop;
37386   else if(itemBelow){
37387    var scrollDivChildElementHeight = this.GetScrollDivChildElementHeight();
37388    var scrollPaddings = scrollDiv.scrollHeight - scrollDivChildElementHeight;
37389    scrollDiv.scrollTop = itemOffsetTop + itemHeight - scrollDivHeight + scrollPaddings;
37390   }
37391  }
37392 },
37393 GetScrollDivChildElementHeight: function() {
37394  return this.itemsManager.GetScrollDivChildElementHeight();
37395 },
37396 SetScrollTop: function(scrollTop){
37397  var scrollDiv = this.GetScrollDivElement();
37398  if(scrollDiv){ 
37399   scrollDiv.scrollTop = scrollTop;
37400   if(ASPx.Browser.Opera) 
37401    this.CachedScrollTop();
37402  }   
37403 },
37404 CachedScrollTop: function(){
37405  var scrollDiv = this.GetScrollDivElement();
37406  scrollDiv.cachedScrollTop = scrollDiv.scrollTop;
37407 },
37408 RestoreScrollTopFromCache: function(){
37409  var scrollDiv = this.GetScrollDivElement();
37410  if(scrollDiv && ASPx.IsExists(scrollDiv.cachedScrollTop))
37411   scrollDiv.scrollTop = scrollDiv.cachedScrollTop;
37412 },
37413 IsListBoxWidthLessThenList: function(){
37414  var divElement = this.GetScrollDivElement();
37415  var listTable = this.GetListTable();
37416  var listTabelWidth = listTable.style.width;
37417  var isLess = false;
37418  listTable.style.width = "";
37419  isLess = listTable.offsetWidth < divElement.offsetWidth;
37420  listTable.style.width = listTabelWidth;
37421  return isLess;
37422 },
37423 GetVerticalScrollBarWidth: function(){
37424  var divElement = this.GetScrollDivElement(); 
37425  if(!this.verticalScrollBarWidth || this.verticalScrollBarWidth <= 0){
37426   this.verticalScrollBarWidth = this.GetVerticalScrollBarWidthCore(divElement);
37427   return this.verticalScrollBarWidth;
37428  } else
37429   return this.GetIsVerticalScrollBarVisible(divElement) ? this.verticalScrollBarWidth : 0;
37430 },
37431 GetIsVerticalScrollBarVisible: function(divElement){
37432  var verticalOverflow = this.GetVerticalOverflow(divElement);
37433  if(verticalOverflow != "auto"){
37434   return divElement.clientHeight < this.GetListTableHeight();
37435  } else {
37436   var borderWidthWithScroll = divElement.offsetWidth - divElement.clientWidth;
37437   return borderWidthWithScroll == this.scrollDivBordersWidthWithScroll;
37438  }
37439 },
37440 GetVerticalScrollBarWidthCore: function(divElement){
37441  var overflowYReserv = this.GetVerticalOverflow(divElement);
37442  this.SetVerticalOverflow(divElement, "auto");
37443  this.scrollDivBordersWidthWithScroll = divElement.offsetWidth - divElement.clientWidth;
37444  if(ASPx.Browser.IE)
37445   return this.scrollDivBordersWidthWithScroll; 
37446  this.SetProtectionFromFlick_inFF(false, true);
37447  this.SetVerticalOverflow(divElement, "hidden");
37448  var bordersWidthWithoutScroll = divElement.offsetWidth - divElement.clientWidth;
37449  this.SetVerticalOverflow(divElement, overflowYReserv);
37450  this.ResetProtectionFromFlick_inFF();
37451  return this.scrollDivBordersWidthWithScroll - bordersWidthWithoutScroll;
37452 },
37453 GetVerticalOverflow: function(element){
37454  if(ASPx.Browser.IE || ASPx.Browser.Safari && ASPx.Browser.Version >= 3 || ASPx.Browser.Chrome || ASPx.Browser.Firefox && ASPx.Browser.Version >= 3)
37455   return element.style.overflowY;
37456  return element.style.overflow;
37457 },
37458 SetVerticalOverflow: function(element, value) {
37459  if(ASPx.Browser.IE || ASPx.Browser.Safari && ASPx.Browser.Version >= 3 || ASPx.Browser.Chrome || ASPx.Browser.AndroidDefaultBrowser || ASPx.Browser.Firefox && ASPx.Browser.Version >= 3) {
37460   element.style.overflowY = value;
37461  } else {
37462   element.style.overflow = value;
37463  }
37464 },
37465 MultiSelectionMode: function(){
37466  return this.selectionMode != ListBoxSelectionMode.Single;
37467 },
37468 CheckColumnSelectionMode: function(){
37469  return this.selectionMode == ListBoxSelectionMode.CheckColumn;
37470 },
37471 OnItemClick: function(index, evt){
37472  if(!this.isInitialized) 
37473   return;
37474  if (this.GetReadOnly()) {
37475   ASPx.Evt.PreventEvent(evt);
37476   return this.OnItemClickOrDblClickReadOnly();
37477  }
37478  if(this.CheckColumnSelectionMode() && this.IsCheckBoxClicked(evt))
37479   this.GetItemSelectionHelper().OnItemCheckBoxClick(index, evt);
37480  else
37481   this.GetItemSelectionHelper().OnItemClick(index, evt);
37482  this.SetFocus();
37483  this.RaiseItemClick();
37484 },
37485 OnItemClickOrDblClickReadOnly: function(){
37486  return false;
37487 },
37488 OnItemDblClick: function(){
37489  if (this.GetReadOnly())
37490   return this.OnItemClickOrDblClickReadOnly();
37491  return this.RaiseItemDoubleClick();
37492 },
37493 CanChangeSelection: function(){
37494  return !this.GetReadOnly() || !this.isInitialized;
37495 },
37496 SelectIndexSilent: function(index){ 
37497  return this.SetItemSelectionStateSilent(index);
37498 },
37499 SetItemSelectionStateSilent: function(index){
37500  if(!this.CanChangeSelection())
37501   return;
37502  var oldSelectionIndex = this.GetSelectedIndex();
37503  this.LockSelectionEvents();
37504  this.SetSelectedIndexCore(index);
37505  this.UnlockSelectionEvents();
37506  return index != oldSelectionIndex;
37507 },
37508 SetItemSelectionAppearance: function (index, selected, controller, checkCanChangeSelection) {
37509  if (checkCanChangeSelection && !this.CanChangeSelection())
37510   return;
37511  if(!controller)
37512   controller = ASPx.GetStateController();
37513  var itemFirstTextCell = this.GetItemFirstTextCell(index);
37514  if(selected)
37515   controller.SelectElementBySrcElement(itemFirstTextCell);
37516  else
37517   controller.DeselectElementBySrcElement(itemFirstTextCell);
37518 },
37519 GetItemSelectionHelper: function(){
37520  if(!this.itemSelectionHelper)
37521   this.itemSelectionHelper = this.CreateItemSelectionHelper();
37522  return this.itemSelectionHelper;
37523 },
37524 CreateItemSelectionHelper: function(){
37525  if(this.selectionMode == ListBoxSelectionMode.Single)
37526   return new ListBoxSingleSelectionHelper(this);
37527  else if(this.selectionMode == ListBoxSelectionMode.Multiple)
37528   return new ListBoxMultiSelectionHelper(this);
37529  else if(this.selectionMode == ListBoxSelectionMode.CheckColumn)
37530   return new ListBoxCheckSelectionHelper(this);
37531 },
37532 GetValue: function(){
37533  var index = this.GetSelectedIndex();
37534  if(0 <= index && index < this.itemsValue.length)
37535   return this.itemsValue[index];
37536  return null;
37537 },
37538 SetValue: function(value){
37539  var index = this.FindItemIndexByValue(value);
37540  this.SetSelectedIndex(index);
37541 },
37542 GetSelectedItem: function(){
37543  var index = this.GetSelectedIndex();
37544  return this.GetItem(index);
37545 },
37546 GetSelectedIndex: function(){
37547  if(!this.itemSelectionHelper)
37548   return this.GetSelectedIndexInternal();
37549  return this.GetItemSelectionHelper().GetSelectedIndex();
37550 },
37551 SetSelectedIndex: function(index){
37552  this.LockSelectionEvents();
37553  this.SetSelectedIndexCore(index);
37554  this.EnsureSelectedItemVisible(index);
37555  this.UnlockSelectionEvents();
37556 },
37557 SetSelectedIndexCore: function(index){
37558  this.GetItemSelectionHelper().SetSelectedIndex(index);
37559 },
37560 GetSelectedIndices: function(){
37561  return this.GetItemSelectionHelper().GetSelectedIndices();
37562 },
37563 GetSelectedValues: function(){ 
37564  return this.GetItemSelectionHelper().GetSelectedValues();
37565 },
37566 GetSelectedItems: function(){
37567  return this.GetItemSelectionHelper().GetSelectedItems();
37568 },
37569 SelectAll: function(){
37570  this.SelectIndices();
37571 },
37572 UnselectAll: function(){
37573  this.UnselectIndices();
37574 },
37575 SelectIndices: function(indices){
37576  this.LockSelectionEvents();
37577  this.GetItemSelectionHelper().SelectIndices(indices);
37578  this.UnlockSelectionEvents();
37579 },
37580 SelectItems: function(items){
37581  this.LockSelectionEvents();
37582  this.GetItemSelectionHelper().SelectItems(items);
37583  this.UnlockSelectionEvents();
37584 },
37585 SelectValues: function(values){
37586  this.LockSelectionEvents();
37587  this.GetItemSelectionHelper().SelectValues(values);
37588  this.UnlockSelectionEvents();
37589 },
37590 UnselectIndices: function(indices){
37591  this.LockSelectionEvents();
37592  this.GetItemSelectionHelper().UnselectIndices(indices);
37593  this.UnlockSelectionEvents();
37594 },
37595 UnselectItems: function(items){
37596  this.LockSelectionEvents();
37597  this.GetItemSelectionHelper().UnselectItems(items);
37598  this.UnlockSelectionEvents();
37599 },
37600 UnselectValues: function(values){
37601  this.LockSelectionEvents();
37602  this.GetItemSelectionHelper().UnselectValues(values);
37603  this.UnlockSelectionEvents();
37604 },
37605 GetIsItemSelected: function(index){
37606  return this.GetItemSelectionHelper().GetIsItemSelected(index);
37607 },
37608 GetFocusedIndex: function(){
37609  return this.GetItemSelectionHelper().GetFocusedIndex();
37610 },
37611 UpdateInternalState: function(){
37612  this.UpdateHiddenInputs();
37613 },
37614 IsUpdateHiddenInputsLocked: function(){
37615  return this.GetItemSelectionHelper().IsUpdateInternalSelectionStateLocked();
37616 },
37617 UpdateHiddenInputs: function(){
37618  if(this.IsUpdateHiddenInputsLocked())
37619   return;
37620  if(this.MultiSelectionMode()){ 
37621   var element = this.FindStateInputElement();
37622   if(ASPx.IsExistsElement(element)) {
37623    var sb = [ ];
37624    var serialiser = this.GetSerializingHelper();
37625    var selectedIndices = this.GetSelectedIndices();
37626    for(var i = 0; i < selectedIndices.length; i++)
37627     serialiser.SerializeAtomValue(sb, this.GetItemValue(selectedIndices[i]));
37628    element.value = sb.join("");
37629   }
37630  } else 
37631   ASPxClientListBoxBase.prototype.UpdateHiddenInputs.call(this);
37632 },
37633 UseDelayedSpecialFocus: function() { 
37634  return true;
37635 },
37636 AdjustWidthInDropDown: function(parentComboBoxMainElement, isCallbackMode, customWidth) {
37637  var lbScrollDiv = this.GetScrollDivElement();
37638  var lbMainElement = this.GetMainElement();
37639  var scrollWidth = 0;
37640  if (this.IsMultiColumn() && isCallbackMode && this.GetScrollSpacerVisibility(false) && this.GetBottomScrollSpacerHeight() == 0)
37641   this.SetBottomScrollSpacerVisibility(true);
37642  var keepCurrentWidth = this.HasVirtualScrolling() && this.hasDecoratedItems && this.isComboBoxScrollingCallbackProcessing;
37643  if(!keepCurrentWidth) {
37644   lbMainElement.style.width = "";
37645   lbScrollDiv.style.paddingRight = "0px";
37646   lbScrollDiv.style.width = "100%";
37647  }
37648  else
37649   this.isComboBoxScrollingCallbackProcessing = false;
37650  if (customWidth != "") {
37651   lbMainElement.style.width = customWidth;
37652   var width = lbMainElement.clientWidth;
37653   var scrollInfo = this.SetScrollDivAndCorrectionForScroll(width, false);
37654   width = scrollInfo.scrollDivWidth;
37655   scrollWidth = scrollInfo.scrollWidth;
37656   if((!ASPx.Browser.IE || this.HasVirtualScrolling()) && !this.enableEllipsis) {
37657    var difference = this.GetItemsWidth() - lbScrollDiv.clientWidth;
37658    if (difference > 0) {
37659     lbMainElement.style.width = (lbMainElement.offsetWidth + difference) + "px";
37660     lbScrollDiv.style.width = (lbMainElement.clientWidth) + "px";
37661    }
37662   }
37663  } else {
37664   var width = this.GetItemsWidth();
37665   var scrollInfo = this.SetScrollDivAndCorrectionForScroll(width, true);
37666   width = scrollInfo.scrollDivWidth;
37667   scrollWidth = scrollInfo.scrollWidth;
37668   if (ASPx.Browser.Firefox && lbMainElement.offsetWidth < lbScrollDiv.offsetWidth)
37669    lbMainElement.style.width = "0%"; 
37670   if (parentComboBoxMainElement) {
37671    var widthDifference = parentComboBoxMainElement.offsetWidth - lbMainElement.offsetWidth;
37672    if (widthDifference > 0) {
37673     this.scrollDivMinWidth = width + widthDifference;
37674     lbScrollDiv.style.width = this.scrollDivMinWidth + "px";
37675     var twoBorderSize = (lbMainElement.offsetWidth - lbMainElement.clientWidth);
37676     lbMainElement.style.width = (width + widthDifference + twoBorderSize) + "px"; 
37677    }
37678   }
37679  }
37680  if (this.IsMultiColumn())
37681   this.CorrectMultiColumnHeaderWidth(scrollWidth);
37682  if (this.NeedToHandleCellWidth())
37683   this.CorrectCellNullWidthStyle(this.itemsManager.GetFirstVisibleItemRow());
37684  if (this.ContainsFixWidthRow()) {
37685   var lbHeaderDiv = this.GetHeaderDivElement();
37686   if (lbHeaderDiv)
37687    lbScrollDiv.style.width = lbHeaderDiv.offsetWidth - ASPx.GetLeftRightBordersAndPaddingsSummaryValue(lbScrollDiv) + "px";
37688  }
37689  return lbScrollDiv.offsetWidth;
37690 },
37691 SetScrollDivAndCorrectionForScroll: function(width, widthByContent) {
37692  var lbScrollDiv = this.GetScrollDivElement();
37693  var scrollWidth = this.GetVerticalScrollBarWidth();
37694  var browserCanHaveScroll = this.GetVerticalOverflow(lbScrollDiv) == "auto";
37695  if (widthByContent && browserCanHaveScroll)
37696   width += scrollWidth;
37697  lbScrollDiv.style.width = width + "px";
37698  return { scrollDivWidth: width, scrollWidth: scrollWidth };
37699 },
37700 BeforeAdjustHeightInDropDown: function() {
37701  this.GetMainElement().style.height = "0px";
37702 },
37703 AdjustHeightInDropDown: function(customHeight, visibleRowCount, getDefaultHeight) {
37704  this.BeforeAdjustHeightInDropDown();
37705  var lbHeight = 0;
37706  if (customHeight == "")
37707   lbHeight = this.GetHeightByContent(visibleRowCount, getDefaultHeight);
37708  else
37709   lbHeight = this.GetHeightByServerValue(customHeight);
37710  this.itemsManager.Adjust();
37711  this.InitializePageSize();
37712  return lbHeight;
37713 },
37714 GetHeightByContent: function(visibleRowCount, getDefaultHeight) {
37715  var lbScrollDiv = this.GetScrollDivElement(),
37716   itemCount = this.GetVisibleItemCount(),
37717   hasVerticalScrollbar = itemCount > visibleRowCount;
37718  lbScrollDiv.style.height = "";
37719  if (!hasVerticalScrollbar)
37720   lbScrollDiv.style.height = this.GetListTableHeight() + "px";
37721  var height = hasVerticalScrollbar ? this.GetItemsHeight() : Math.max(this.GetItemsHeight(), this.GetListTableHeight());
37722  if (hasVerticalScrollbar)
37723   height = getDefaultHeight(height, itemCount);
37724  else
37725   height = itemCount == 0 ? "0px" : height + "px";
37726  lbScrollDiv.style.height = height;
37727  height = lbScrollDiv.offsetHeight;
37728  height += ASPx.GetTopBottomBordersAndPaddingsSummaryValue(this.GetMainElement());
37729  var lbHeaderDiv = this.GetHeaderDivElement();
37730  if (ASPx.IsExists(lbHeaderDiv))
37731   height += lbHeaderDiv.offsetHeight;
37732  return height;
37733 },
37734 GetHeightByServerValue: function(customHeight) {
37735  var lbMainElement = this.GetMainElement();
37736  var lbScrollDiv = this.GetScrollDivElement();
37737  var height = customHeight;
37738  lbMainElement.style.height = "0px";
37739  lbScrollDiv.style.height = "0px";
37740  lbMainElement.style.height = height;
37741  var trueLbOffsetHeight = lbMainElement.offsetHeight;
37742  var trueLbClientHeight = lbMainElement.clientHeight;
37743  lbScrollDiv.style.height = lbMainElement.clientHeight + "px";
37744  var lbHeightCorrection = lbMainElement.offsetHeight - trueLbOffsetHeight;
37745  lbScrollDiv.style.height = (trueLbClientHeight - lbHeightCorrection) + "px";
37746  height = lbMainElement.offsetHeight;
37747  return height;
37748 },
37749 GetLoadingParentElement: function() {
37750  return this.GetScrollDivElement().parentNode;
37751 },
37752 ShowLoadingPanel: function() { 
37753  if(!this.isComboBoxList){
37754   var loadingParentElement = this.GetLoadingParentElement();
37755   var lp = this.CreateLoadingPanelWithAbsolutePosition(loadingParentElement);
37756   this.PreventMouseWheelOnElement(lp);
37757  }
37758 },
37759 ShowLoadingDiv: function () {
37760  if(!this.isComboBoxList){
37761   var loadingParentElement = this.GetLoadingParentElement();
37762   var ld = this.CreateLoadingDiv(loadingParentElement);
37763   this.PreventMouseWheelOnElement(ld);
37764  }
37765 },
37766 PreventMouseWheelOnElement: function(element) {
37767  if(!element) return;
37768  var wheelEventName = ASPx.Evt.GetMouseWheelEventName();
37769  ASPx.Evt.AttachEventToElement(element, wheelEventName, function(evt) {
37770   if(this.scrollHelper.GetIsAnySpacerVisible())
37771    ASPx.Evt.PreventEvent(evt);
37772  }.aspxBind(this));
37773 },
37774 ParseCallbackResult: function(result, shouldSelectSilentDelegate){
37775  var gottenEgdeOfCollection = false;
37776  var isLoadindToTopByScroll = this.scrollHelper.IsScrolledToTopSpacer();
37777  if(result[CONSTANTS.CALLBACK_RESULTS.ITEMS].length) {
37778   var deserializedItems = this.DeserializeItems(result[CONSTANTS.CALLBACK_RESULTS.ITEMS]);
37779   this.LoadItemsFromCallback(isLoadindToTopByScroll, deserializedItems, shouldSelectSilentDelegate);
37780   gottenEgdeOfCollection = deserializedItems.length < this.callbackPageSize;
37781  }
37782  var noMoreItemsForLoadThisDirection = !result[CONSTANTS.CALLBACK_RESULTS.ITEMS].length || gottenEgdeOfCollection;
37783  this.SetScrollSpacerVisibility(isLoadindToTopByScroll, !noMoreItemsForLoadThisDirection);
37784  this.scrollHelper.Reset();
37785 },
37786 LoadItemsFromCallback: function(isToTop, deserializedItems, shouldSelectSilentDelegate){
37787  this.LockSynchronizationOnInternalCallback();
37788  this.BeginUpdate();
37789  var isMultiSelect = this.MultiSelectionMode();
37790  this.RemoveAccessibilityHeaderRow();
37791  if(isToTop){
37792   var scrollHeightCorrection = 0;
37793   for(var i = deserializedItems.length - 1; i >= 0; i--) {
37794    this.InsertItemInternal(0, deserializedItems[i]);
37795    scrollHeightCorrection += this.GetItemHeight(0);
37796   } 
37797   this.GetScrollDivElement().scrollTop += scrollHeightCorrection;
37798   this.serverIndexOfFirstItem -= deserializedItems.length;
37799   if(this.serverIndexOfFirstItem < 0) this.serverIndexOfFirstItem = 0;
37800  } else {
37801   for(var i = 0; i < deserializedItems.length; i++) {
37802    var itemIndex = this.AddItemInternal(deserializedItems[i]);
37803    var shouldSelectSilent = shouldSelectSilentDelegate && shouldSelectSilentDelegate(deserializedItems[i].value, deserializedItems[i].text);
37804    this.SelectValueOnLoad(itemIndex, deserializedItems[i].selected, shouldSelectSilent, isMultiSelect);
37805   } 
37806  }
37807  if(this.changeSelectAfterCallback != 0) {
37808   var newIndex = this.GetSelectedIndex() + this.changeSelectAfterCallback;
37809   newIndex = this.GetAdjustedIndex(newIndex);
37810   this.SelectIndexSilent(newIndex);
37811   if(this.scrollHelper.isScrolledToTopSpacer)
37812    this.ScrollItemToTop(newIndex);
37813   else
37814    this.ScrollToItemVisible(newIndex);
37815  }
37816  this.AddAccessibilityHeaderRow();
37817  this.EndUpdate();
37818  this.UnlockSynchronizationOnInternalCallback();
37819 },
37820 SelectValueOnLoad: function (index, selected, shouldSelectSilent, isMultiSelect) {
37821  if(selected && this.changeSelectAfterCallback == 0) {
37822   if(isMultiSelect) {
37823    this.SelectIndices([index]);
37824   } else {
37825    if(shouldSelectSilent)
37826     this.SelectIndexSilent(index);
37827    else
37828     this.SelectIndex(index);
37829   }
37830  }
37831 },
37832 CreateSerializingHelper: function(){
37833  return new ListBoxItemsSerializingHelper(this);
37834 },
37835 InCallback: function(){
37836  var callbackOwner = this.GetCallbackOwnerControl();
37837  if(callbackOwner != null)
37838   return callbackOwner.InCallback();
37839  return ASPxClientListEdit.prototype.InCallback.call(this);
37840 },
37841 GetItemsRangeForLoad: function(){
37842  return this.scrollHelper.GetItemsRangeForLoad();
37843 },
37844 GetScrollSpacerElement: function(isTop){
37845  return document.getElementById(this.name + (isTop ? lbTSIdSuffix : lbBSIdSuffix));
37846 },
37847 GetScrollSpacerVisibility: function(isTop){
37848  if(!this.clientEnabled)
37849   return false;
37850  return isTop ? this.isTopSpacerVisible : this.isBottomSpacerVisible;
37851 },
37852 SetScrollSpacerVisibility: function(isTop, visibility){
37853  this.LockScrollHandler();
37854  var spacer = this.GetScrollSpacerElement(isTop);
37855  if(spacer){
37856   if(visibility)
37857    spacer.style.height = this.GetRequiredScrollSpacerHeight() + "px";
37858   if(this.clientEnabled){
37859    if(isTop)
37860     this.isTopSpacerVisible = visibility;
37861    else
37862     this.isBottomSpacerVisible = visibility;
37863   }
37864   if(ASPx.GetElementDisplay(spacer) != visibility){
37865    ASPx.SetElementDisplay(spacer, visibility);
37866    ASPx.GetElementVisibility(spacer, visibility);
37867   }
37868  }
37869  this.itemsManager.OnScrollSpacerVisibilityChanged();
37870  this.UnlockScrollHandler();
37871 },
37872 GetRequiredScrollSpacerHeight: function() {
37873  return this.GetScrollDivElement().clientHeight;
37874 },
37875 SetTopScrollSpacerVisibility: function(visibility){
37876  this.SetScrollSpacerVisibility(true, visibility);
37877 },
37878 SetBottomScrollSpacerVisibility: function(visibility){
37879  this.SetScrollSpacerVisibility(false, visibility);
37880 },
37881 GetTopScrollSpacerHeight: function(){
37882  return this.GetScrollSpacerVisibility(true) ? this.GetScrollSpacerElement(true).clientHeight : 0;
37883 },
37884 GetBottomScrollSpacerHeight: function(){
37885  return this.GetScrollSpacerVisibility(false) ? this.GetScrollSpacerElement(false).clientHeight : 0;
37886 },
37887 GetTopSpacersHeight: function() {
37888  return this.itemsManager.GetTopSpacersHeight();
37889 },
37890 SendCallback: function(onSuccess) {
37891  if(!this.InCallback()){
37892   this.ShowLoadingElements();
37893   var callbackOwner = this.GetCallbackOwnerControl();
37894   if(callbackOwner != null)
37895    callbackOwner.SendCallback(onSuccess);
37896   else {
37897    var argument = this.GetCallbackArguments();
37898    this.CreateCallback(argument, null, onSuccess);
37899   }
37900  }
37901 },
37902 OnCallback: function(result, shouldSelectSilentDelegate) {
37903  if(result.serverMode)
37904   this.UpdateStateObjectWithObject({serverMode: true});
37905  if(!this.filterStrategy || !this.filterStrategy.ShouldDiscardCallbackResult()) {
37906   this.ParseCallbackResult(result, shouldSelectSilentDelegate);
37907   if(!this.isComboBoxList)
37908    this.filterStrategy.OnCallback(result);
37909   this.OnCallbackFinally();
37910  }
37911 },
37912 OnCallbackError: function(result){
37913  ASPxClientListBoxBase.prototype.OnCallbackError.call(this, result);
37914  this.OnCallbackFinally();
37915 },
37916 OnCallbackFinally: function () {
37917  this.itemsManager.Adjust();
37918  this.HideLoadingPanel();
37919  this.changeSelectAfterCallback = 0;
37920 },
37921 DoEndCallback: function() {
37922  this.filterStrategy.OnBeforeDoEndCallback();
37923  ASPxClientListBoxBase.prototype.DoEndCallback.call(this);
37924  this.filterStrategy.OnAfterDoEndCallback();
37925 },
37926 RaiseEndCallback: function() {
37927  if(this.preventEndCallbackRising)
37928   this.preventEndCallbackRising = false;
37929  else
37930   ASPxClientListBoxBase.prototype.RaiseEndCallback.call(this);
37931 },
37932 LockScrollHandler: function(){
37933  this.scrollHandlerLockCount ++;
37934 },
37935 UnlockScrollHandler: function(){
37936  this.scrollHandlerLockCount --;
37937 },
37938 IsScrollHandlerLocked: function(){
37939  return this.scrollHandlerLockCount > 0;
37940 },
37941 OnScroll: function(){
37942  if(this.IsScrollHandlerLocked()) return;
37943  if(this.IsVisible() && !this.InCallback() && ( this.GetScrollSpacerVisibility(true) || this.GetScrollSpacerVisibility(false))) {
37944   this.scrollHelper.OnScroll();
37945   if(this.scrollHelper.GetIsNeedToHideTopSpacer())
37946    this.SetTopScrollSpacerVisibility(false);
37947   if(this.scrollHelper.GetIsNeedCallback()) {
37948    this.isComboBoxScrollingCallbackProcessing = this.isComboBoxList;
37949    this.SendCallback();
37950   }
37951  }
37952 },
37953 OnBrowserWindowResize: function(e) {
37954  if(this.IsVisible())
37955   this.CorrectSize();
37956 },
37957 KeyboardSupportAllowed: function(){
37958  return !this.CheckColumnSelectionMode();
37959 },
37960 InitializeKeyHandlers: function() {
37961  if(this.KeyboardSupportAllowed()){
37962   this.AddKeyDownHandler(ASPx.Key.PageUp, "OnPageUp");
37963   this.AddKeyDownHandler(ASPx.Key.PageDown, "OnPageDown");
37964   this.AddKeyDownHandler(ASPx.Key.End, "OnEndKeyDown");
37965   this.AddKeyDownHandler(ASPx.Key.Home, "OnHomeKeyDown");
37966   this.AddKeyDownHandler(ASPx.Key.Up, "OnArrowUp");
37967   this.AddKeyDownHandler(ASPx.Key.Down, "OnArrowDown");
37968  } else if(this.accessibilityCompliant && !this.IsNativeCheckBoxes()) {
37969   this.AddKeyDownHandler(ASPx.Key.Up, "OnAccessArrowUp");
37970   this.AddKeyDownHandler(ASPx.Key.Down, "OnAccessArrowDown");
37971  }
37972 },
37973 OnArrowUp: function(evt){
37974  if(this.isInitialized)
37975   this.SelectNeighbour(-1);
37976  return true;
37977 },
37978 OnArrowDown: function(evt){
37979  if(this.isInitialized)
37980   this.SelectNeighbour(1);
37981  return true;
37982 },
37983 OnAccessArrowUp: function(evt){
37984  if(!this.isInitialized) return true;
37985  var index = this.GetFocusedIndex();
37986  var isItemCheckBoxFocused = this.GetInternalCheckBox(index) && this.GetInternalCheckBox(index).focused;
37987  var isSelectAllCheckBoxFocused = this.selectAllCheckBox && this.selectAllCheckBox.focused;
37988  if(index > 0 && isItemCheckBoxFocused)
37989   this.SetFocusedIndex(index - 1);
37990  else if(index == 0 && this.selectAllCheckBox && !isSelectAllCheckBoxFocused) {
37991   this.selectAllCheckBox.mainElement.focus();
37992   this.GetItemSelectionHelper().SetFocusedIndexInternal(index, false);
37993  }
37994  else
37995   this.SetFocusedIndex(this.GetItemCount() - 1);
37996  return true;
37997 },
37998 OnAccessArrowDown: function(evt){
37999  if(!this.isInitialized) return true;
38000  var index = this.GetFocusedIndex();
38001  var isItemCheckBoxFocused = this.GetInternalCheckBox(index) && this.GetInternalCheckBox(index).focused;
38002  var isSelectAllCheckBoxFocused = this.selectAllCheckBox && this.selectAllCheckBox.focused;
38003  if(index < this.GetItemCount() - 1 && isItemCheckBoxFocused)
38004   this.SetFocusedIndex(index + 1);
38005  else if(index == this.GetItemCount() - 1 && this.selectAllCheckBox && !isSelectAllCheckBoxFocused) {
38006   this.selectAllCheckBox.mainElement.focus();
38007   this.GetItemSelectionHelper().SetFocusedIndexInternal(index, false);
38008  }
38009  else
38010   this.SetFocusedIndex(0);
38011  return true;
38012 },
38013 SetFocusedIndex: function(index) {
38014  if(this.GetIsCheckColumnExists()) {
38015   this.MakeItemVisible(index);
38016   setTimeout(function () { this.GetInternalCheckBox(index).mainElement.focus(); }.aspxBind(this), 0);
38017  }
38018  this.GetItemSelectionHelper().SetFocusedIndexInternal(index, false);
38019 },
38020 OnPageUp: function(evt){
38021  if(this.isInitialized)
38022   this.SelectNeighbour(-this.scrollPageSize);
38023  return true;
38024 },
38025 OnPageDown: function(evt){
38026  if(this.isInitialized)
38027   this.SelectNeighbour(this.scrollPageSize);
38028  return true;
38029 },
38030 OnHomeKeyDown: function(evt){
38031  if(this.isInitialized)
38032   this.SelectNeighbour(-this.GetItemCount());
38033  return true;
38034 },
38035 OnEndKeyDown: function(evt){
38036  if(this.isInitialized)
38037   this.SelectNeighbour(this.GetItemCount());
38038  return true;
38039 },
38040 GetAdjustedIndex: function(index){
38041  if(index < 0) index = 0;
38042  else{
38043   var itemCount = this.GetItemCount();
38044   if(index >= itemCount) index = itemCount - 1;
38045  }
38046  return index;
38047 },
38048 SelectNeighbour: function (step) {
38049  var itemCount = this.GetItemCount();
38050  if(itemCount > 0) {
38051   this.changeSelectAfterCallback = 0;
38052   var selectedIndex = this.GetFocusedIndex();
38053   var newSelectedIndex = this.GetNewSelectedIndex(selectedIndex, step);
38054   newSelectedIndex = this.GetAdjustedIndex(newSelectedIndex);
38055   if(selectedIndex != newSelectedIndex && this.IsItemFiltered(newSelectedIndex)) {
38056    this.LockScrollOnKBNavigation();
38057    this.SetSelectedIndexCore(newSelectedIndex);
38058    this.UnlockScrollOnKBNavigation();
38059   }
38060   if(this.GetIsNeedToCallbackLoadItemsToTop(newSelectedIndex, step, itemCount)) {
38061    this.LoadItemsOnCallback(true, newSelectedIndex);
38062   } else if(this.GetIsNeedToCallbackLoadItemsToBottom(newSelectedIndex, step, itemCount)) {
38063    this.LoadItemsOnCallback(false, newSelectedIndex);
38064   }
38065   this.ScrollToItemVisible(newSelectedIndex);
38066  }
38067 },
38068 GetNewSelectedIndex: function(selectedIndex, step) {
38069  var pageDownSize = step == 1 ? this.scrollPageSize + 1 : this.scrollPageSize; 
38070  var isFirstPageDown = selectedIndex == -1 && step == pageDownSize && step > 1;
38071  if(isFirstPageDown)
38072   step++;
38073  var newSelectedIndex = 0;
38074  var areThereUnfilteredItems = this.GetVisibleItemCount() < this.GetItemCount();
38075  if(areThereUnfilteredItems)
38076   newSelectedIndex = this.itemsManager.GetNewItemIndexInFilteredRange(selectedIndex, step);
38077  else
38078   newSelectedIndex = selectedIndex + step;
38079  return newSelectedIndex;
38080 },
38081 GetIsNeedToCallbackLoadItemsToTop: function(selectedIndex, step, itemCount){
38082  return this.isCallbackMode && this.GetScrollSpacerVisibility(true) && 
38083   this.serverIndexOfFirstItem > 0 && ((step < 0 && selectedIndex <= 0) || step <= -itemCount);
38084 },
38085 GetIsNeedToCallbackLoadItemsToBottom: function(selectedIndex, step, itemCount){
38086  return this.isCallbackMode && this.GetScrollSpacerVisibility(false) && 
38087   ((step > 0 && selectedIndex >= itemCount - 1) || step >= itemCount);
38088 },
38089 LoadItemsOnCallback: function(isToTop, index){
38090  this.changeSelectAfterCallback = index - this.GetSelectedIndex();
38091  this.scrollHelper.SetItemsRangeForLoad(isToTop);
38092  this.isComboBoxScrollingCallbackProcessing = this.isComboBoxList;
38093  this.SendCallback();
38094 },
38095 FindInputElement: function(){
38096  if(this.accessibilityCompliant)
38097   return this.isComboBoxList ? null : this.GetAccessibilityAssistantElement();
38098  return this.GetKBSInput();
38099 },
38100 GetKBSInput: function() {
38101  return this.GetChildElement("KBS");
38102 },
38103 GetAccessibilityActiveElements: function() {
38104  var accessibilityElements = [];
38105  if(this.CheckColumnSelectionMode()) {
38106   for(var i = 0; i < this.GetItemCount() ; i++) {
38107    var checkBoxFocusableElement = this.GetCheckBoxFocusableElement(i);
38108    if(checkBoxFocusableElement)
38109     accessibilityElements.push(checkBoxFocusableElement);
38110   }
38111  }
38112  accessibilityElements.push(this.accessibilityHelper ? this.accessibilityHelper.GetActiveElement() : this.GetInputElement());
38113  return accessibilityElements;
38114 },
38115 SetHoverElement: function(element){
38116  ASPx.GetStateController().SetCurrentHoverElementBySrcElement(element);
38117 },
38118 InitOnContainerMadeVisible: function(){
38119  this.AdjustControl();
38120 },
38121 ClearItemsCore: function(){
38122  this.itemsManager.ClearItems();
38123  this.EnsureFixWidthRow();
38124  this.AddAccessibilityHeaderRow();
38125  this.OnItemsCleared();
38126  this.SetValue(null);
38127 },
38128 OnItemsCleared: function(){
38129  this.GetItemSelectionHelper().OnItemsCleared();
38130 },
38131 CorrectCellWidthsOnFirstRowItemReplacement: function(oldFirstRowItemIndex, newFirstRowItemIndex) {
38132  if (!this.ContainsFixWidthRow() && !this.HasVirtualScrolling()) {
38133   var oldFirstRowItemHasTemplate = this.ItemRowHasTemplate(oldFirstRowItemIndex);
38134   var newFirstRowItemHasTemplate = this.ItemRowHasTemplate(newFirstRowItemIndex);
38135   if(!oldFirstRowItemHasTemplate && !newFirstRowItemHasTemplate)
38136    this.CopyCellWidths(oldFirstRowItemIndex, newFirstRowItemIndex);
38137  }
38138 },
38139 CopyCellWidths: function(sourceRowIndex, destinationRowIndex){
38140  var cellCount = this.GetItemCellCount();
38141  var sourceRow = this.GetItemRow(sourceRowIndex);
38142  var destRow = this.GetItemRow(destinationRowIndex);
38143  if (!sourceRow || !destRow) return; 
38144  var lastDestCellIndex = destRow.cells.length - 1;
38145  for(var i = 0; i < lastDestCellIndex; i++) {
38146   destRow.cells[i].style.width = sourceRow.cells[i].style.width;
38147  }
38148  if(destRow.cells.length === cellCount) {
38149   destRow.cells[lastDestCellIndex].style.width = sourceRow.cells[lastDestCellIndex].style.width;
38150  } else {
38151   var cellWidths = ASPx.Data.CollectionToArray(sourceRow.cells)
38152    .slice(lastDestCellIndex)
38153    .map(function(cell) { return ASPx.PxToInt(cell.style.width); })
38154    .reduce(function(accumulator, current) { return accumulator + current; }, 0);
38155   destRow.cells[lastDestCellIndex].style.width = cellWidths + "px";
38156  }
38157  if(this.NeedToHandleCellWidth())
38158   this.CorrectCellNullWidthStyle(destRow);
38159 },
38160 RemoveItem: function (index) {
38161  var firstRenderedItem = this.itemsManager.GetFirstRenderedItem();
38162  if (firstRenderedItem && index == firstRenderedItem.index && this.GetItemRow(firstRenderedItem.index + 1) !== null)
38163   this.CorrectCellWidthsOnFirstRowItemReplacement(firstRenderedItem.index, firstRenderedItem.index + 1);
38164  if (0 <= index && index < this.GetItemCount()) {
38165   this.UpdateSyncArraysItemDeleted(this.GetItem(index), true);
38166   this.itemsManager.RemoveItem(index);
38167   this.OnItemRemoved(index);
38168  }
38169 },
38170 GetItem: function(index, preventEncodeText) {
38171  return this.itemsManager.GetItem(index, preventEncodeText);
38172 },
38173 GetItemRowTexts: function(row) {
38174  var serializedTexts = this.GetTextsDataAttribute(row);
38175  if(ASPx.IsExists(serializedTexts))
38176   return JSON.parse(serializedTexts);
38177  var texts = [];
38178  var i = this.GetItemFirstTextCellIndex();
38179  var cellsLength = this.IsMultiColumn() ? row.cells.length : i + 1;
38180  for(; i < cellsLength; i++) {
38181   var textCell = row.cells[i];
38182   texts.push(ASPxClientListBox.GetItemCellInnerText(textCell));
38183  }
38184  return texts;
38185 },
38186 ItemRowHasTemplate: function(itemIndex) {
38187  var itemRow = this.GetItemRow(itemIndex);
38188  return itemRow ? this.ItemRowHasTemplateCore(itemRow) : false;
38189 },
38190 ItemRowHasTemplateCore: function(itemRow) {
38191  return this.ItemRowHasSerializedTextsAttr(itemRow);
38192 },
38193 ItemRowHasSerializedTextsAttr: function(itemRow) {
38194  return ASPx.Attr.IsExistsAttribute(itemRow, itemSerializedTextsAttributeName);
38195 },
38196 ItemCellHasTextAttr: function(itemTextCell) {
38197  return ASPx.Attr.IsExistsAttribute(itemTextCell, itemCellTextAttributeName);
38198 },
38199 GetFirstVisibleItem: function() {
38200  return this.itemsManager.GetFirstVisibleItem();
38201 },
38202 GetFirstFilteredItemIndex: function () {
38203  return this.itemsManager.GetFirstFilteredItemIndex();
38204 },
38205 PerformCallback: function(arg, onSuccess) {
38206  this.SetScrollSpacerVisibility(true, false);
38207  this.SetScrollSpacerVisibility(false, false);
38208  this.ClearItemsForPerformCallback();
38209  this.serverIndexOfFirstItem = 0;
38210  this.SetScrollSpacerVisibility(true, false);
38211  this.SetScrollSpacerVisibility(false, false);
38212  this.FormatAndSetCustomCallbackArg(arg, true);
38213  this.SendCallback(onSuccess);
38214  this.FormatAndSetCustomCallbackArg(arg, false);
38215 },
38216 GetTableRowParent: function(table){
38217  if(table.tBodies.length > 0)
38218   return table.tBodies[0];
38219  return table;
38220 },
38221 ProtectWhitespaceSerieses: function(text){
38222  if(text == "") 
38223   text = nbsp;
38224  else {
38225   if(text.charAt(0) == ' ')
38226    text = nbsp + text.slice(1);
38227   if(text.charAt(text.length - 1) == ' ')
38228    text = text.slice(0, -1) + nbsp;
38229   text = text.replace(new RegExp("  ", "g"), " &nbsp;");
38230  }
38231  return text;
38232 }, 
38233 InsertItemInternal: function(index, itemProperties) {
38234  if(!this.hasSampleItem) 
38235   return;
38236  this.AdjustItemProperties(itemProperties);
38237  ASPx.Data.ArrayInsert(this.itemsValue, itemProperties.value, index);
38238  this.itemsManager.InsertItem(index, itemProperties);
38239  this.RegisterInsertedItem(index, itemProperties);
38240  this.OnItemInserted(index);
38241 },
38242 GetListTableRowBeforeNewItemRow: function (newItemIndex, listTable) {
38243  var lastRenderedItem = this.itemsManager.GetLastRenderedItem();
38244  if (!lastRenderedItem || lastRenderedItem.index < newItemIndex) {
38245   var lastItemRow = lastRenderedItem ? this.GetItemRow(lastRenderedItem.index) : null;
38246   var lastListTableRow = listTable.rows[listTable.rows.length - 1];
38247   if (lastItemRow)
38248    return lastItemRow === lastListTableRow ? null : lastItemRow.nextSibling;
38249   if (!!this.GetAccessibilityHeaderRow())
38250    return this.ContainsFixWidthRow() ? listTable.rows[1] : listTable.rows[0];
38251   return null;
38252  }
38253  for (var i = 0; i < listTable.rows.length; i++)
38254   if (this.GetItemIndexByRow(listTable.rows[i]) >= newItemIndex)
38255    return listTable.rows[i];
38256  return null;
38257 },
38258 AdjustItemProperties: function(itemProperties) {
38259  if(!itemProperties.texts || itemProperties.texts.length == 0)
38260   itemProperties.texts = [""];
38261  else if(typeof (itemProperties.texts) === "string")
38262   itemProperties.texts = [itemProperties.texts];
38263  if(typeof (itemProperties.value) === "undefined")
38264   itemProperties.value = itemProperties.texts[0];
38265  if(!ASPx.IsExists(itemProperties.imageUrl) || itemProperties.imageUrl === "")
38266   itemProperties.imageUrl = this.defaultImageUrl;
38267 },
38268 AddStateControllerClasses: function(itemId){
38269  var itemCellsIdPostfixes = this.GetItemCellsIdPostfixes();
38270  var sampleItemFirstTextCell = this.GetSampleItemFirstTextCell();
38271  var styleController = ASPx.GetStateController();
38272  var hoverStyleClasses = this.CreateStyleClasses(itemId, itemCellsIdPostfixes, 
38273      styleController.GetHoverElement(sampleItemFirstTextCell), ASPx.HoverItemKind);
38274  var selectedStyleClasses = this.CreateStyleClasses(itemId, itemCellsIdPostfixes, 
38275      styleController.GetSelectedElement(sampleItemFirstTextCell), ASPx.SelectedItemKind);
38276  var disabledStyleClasses = this.CreateStyleClasses(itemId, itemCellsIdPostfixes, 
38277      styleController.GetDisabledElement(sampleItemFirstTextCell), ASPx.DisabledItemKind);
38278    ASPx.AddHoverItems(this.name, hoverStyleClasses, true);
38279    ASPx.AddSelectedItems(this.name, selectedStyleClasses, true);
38280    ASPx.AddDisabledItems(this.name, disabledStyleClasses, true);
38281  ASPx.Attr.RemoveAttribute(sampleItemFirstTextCell, ASPx.CachedStatePrefix + ASPx.HoverItemKind);
38282  ASPx.Attr.RemoveAttribute(sampleItemFirstTextCell, ASPx.CachedStatePrefix + ASPx.SelectedItemKind);
38283  ASPx.Attr.RemoveAttribute(sampleItemFirstTextCell, ASPx.CachedStatePrefix + ASPx.DisabledItemKind);
38284 },
38285 RemoveStateControllerClasses: function(itemId){
38286  var itemCellsIdPostfixes = this.GetItemCellsIdPostfixes();
38287  var classes = [];
38288  classes[0] = [];
38289  classes[0][0] = [itemId];
38290  classes[0][1] = itemCellsIdPostfixes;
38291    ASPx.RemoveHoverItems(this.name, classes);
38292    ASPx.RemoveSelectedItems(this.name, classes);
38293    ASPx.RemoveDisabledItems(this.name, classes);
38294 },
38295 GetCellInfo: function(index, infoArray) {
38296  if(!infoArray) return null;
38297  var filteredArray = infoArray.filter(function(info) { return info.index === index; });
38298  return filteredArray.length ? filteredArray[0].value : null;
38299 },
38300 PrepareItem: function(newItemRow, itemProperties) {
38301  var i = 0;
38302  if(this.GetIsCheckColumnExists())
38303   i++;
38304  if(this.imageCellExists) {
38305   this.PrepareItemImage(newItemRow, i, itemProperties.imageUrl);
38306   i++;
38307  }
38308  if(itemProperties.htmlContent) {
38309   this.SetItemHtmlContent(newItemRow, itemProperties.htmlContent);
38310   this.SetTextsDataAttribute(newItemRow, itemProperties.texts);
38311  } else {
38312   this.SetItemTextContent(i, newItemRow, itemProperties);
38313  }
38314  this.AssignDecorationSettingsToElement(newItemRow, itemProperties.style, itemProperties.cssClass, itemProperties.tooltip, itemProperties.attributes);
38315 },
38316 LockRunStartupSciptsInItemRow: function() {
38317  this.lockRunStartupScipts = true;
38318 },
38319 UnlockRunStartupSciptsInItemRow: function() {
38320  this.lockRunStartupScipts = false;
38321 },
38322 IsRunStartupSciptsInItemRowLocked: function() {
38323  return this.lockRunStartupScipts;
38324 },
38325 EnsureStartupScriptsInContainer: function(container) {
38326  if(!this.InCallback() && !this.IsRunStartupSciptsInItemRowLocked())
38327   ASPx.RunStartupScripts(false, container);
38328 },
38329 SetItemHtml: function(index, html) {
38330  this.hasDecoratedItems = true;
38331  this.hasItemTemplate = true;
38332  this.EnsureFixWidthRow(true);
38333  this.itemsManager.SetItemHtml(index, html);
38334  this.ProcessItemRow(index, function(itemRow) {
38335   if(!this.ItemRowHasSerializedTextsAttr(itemRow))
38336    this.SetTextsDataAttribute(itemRow, this.GetItem(index).texts);
38337   this.SetItemHtmlContent(itemRow, html);
38338   this.itemsManager.OnDecoratedItemsRendering();
38339  }.bind(this));
38340 },
38341 SetTextsDataAttribute: function(itemRow, texts) { ASPx.Attr.SetAttribute(itemRow, itemSerializedTextsAttributeName, JSON.stringify(texts)); },
38342 GetTextsDataAttribute: function(itemRow) { return ASPx.Attr.GetAttribute(itemRow, itemSerializedTextsAttributeName); },
38343 SetItemTooltip: function(index, tooltip) {
38344  this.itemsManager.SetItemTooltip(index, tooltip);
38345  this.ProcessItemRow(index, function(itemRow) { this.SetElementTooltip(itemRow, tooltip); }.aspxBind(this));
38346 },
38347 SetItemAttribute: function(index, attributeName, attributeValue) {
38348  this.itemsManager.SetItemAttribute(index, attributeName, attributeValue);
38349  this.ProcessItemRow(index, function(itemRow) { ASPx.Attr.SetAttribute(itemRow, attributeName, attributeValue); }.aspxBind(this));
38350 },
38351 AddItemCssClass: function(index, className) {
38352  this.hasDecoratedItems = true;
38353  this.itemsManager.AddItemCssClass(index, className);
38354  this.ProcessItemRow(index, function(itemRow) {
38355   ASPx.AddClassNameToElement(itemRow, className);
38356   this.itemsManager.OnDecoratedItemsRendering();
38357  }.bind(this));
38358 },
38359 RemoveItemCssClass: function(index, className) {
38360  this.hasDecoratedItems = true;
38361  this.itemsManager.RemoveItemCssClass(index, className);
38362  this.ProcessItemRow(index, function(itemRow) {
38363   ASPx.RemoveClassNameFromElement(itemRow, className);
38364   this.itemsManager.OnDecoratedItemsRendering();
38365  }.bind(this));
38366 },
38367 SetItemTextCellHtml: function(itemIndex, textCellIndex, html) {
38368  this.hasDecoratedItems = true;
38369  this.itemsManager.SetItemTextCellHtml(itemIndex, textCellIndex, html);
38370  this.ProcessItemTextCell(itemIndex, textCellIndex, function(textCell) {
38371   if(!this.ItemCellHasTextAttr(textCell))
38372    this.SetItemCellTextDataAttribute(textCell, this.GetItem(itemIndex).texts[textCellIndex]);
38373   this.SetItemTextCellHtmlContent(textCell, html);
38374   this.itemsManager.OnDecoratedItemsRendering();
38375  }.aspxBind(this));
38376 },
38377 SetItemCellTextDataAttribute: function(textCell, text) {
38378  ASPx.Attr.SetAttribute(textCell, itemCellTextAttributeName, text);
38379 },
38380 SetItemTextCellTooltip: function(itemIndex, textCellIndex, tooltip) {
38381  this.itemsManager.SetItemTextCellTooltip(itemIndex, textCellIndex, tooltip);
38382  this.ProcessItemTextCell(itemIndex, textCellIndex, function(textCell) { this.SetElementTooltip(textCell, tooltip); }.aspxBind(this));
38383 },
38384 SetItemTextCellAttribute: function(itemIndex, textCellIndex, attributeName, attributeValue) {
38385  this.itemsManager.SetItemTextCellAttribute(itemIndex, textCellIndex, attributeName, attributeValue);
38386  this.ProcessItemTextCell(itemIndex, textCellIndex, function(textCell) { ASPx.Attr.SetAttribute(textCell, attributeName, attributeValue); }.aspxBind(this));
38387 },
38388 AddItemTextCellCssClass: function(itemIndex, textCellIndex, className) {
38389  this.hasDecoratedItems = true;
38390  this.itemsManager.AddItemTextCellCssClass(itemIndex, textCellIndex, className);
38391  this.ProcessItemTextCell(itemIndex, textCellIndex, function(textCell) {
38392   ASPx.AddClassNameToElement(textCell, className);
38393   this.itemsManager.OnDecoratedItemsRendering();
38394  }.bind(this));
38395 },
38396 RemoveItemTextCellCssClass: function(itemIndex, textCellIndex, className) {
38397  this.hasDecoratedItems = true;
38398  this.itemsManager.RemoveItemTextCellCssClass(itemIndex, textCellIndex, className);
38399  this.ProcessItemTextCell(itemIndex, textCellIndex, function(textCell) {
38400   ASPx.RemoveClassNameFromElement(textCell, className);
38401   this.itemsManager.OnDecoratedItemsRendering();
38402  }.bind(this));
38403 },
38404 ProcessItemRow: function(index, action) {
38405  var itemRow = this.GetItemRow(index);
38406  if(itemRow)
38407   action(itemRow);
38408 },
38409 ProcessItemTextCell: function(itemIndex, textCellIndex, action) {
38410  var itemTextCell = this.GetItemTextCell(itemIndex, textCellIndex);
38411  if(itemTextCell && !this.ItemRowHasTemplateCore(itemTextCell.parentNode))
38412   action(itemTextCell);
38413 },
38414 SetItemHtmlContent: function(itemRow, html) {
38415  var redundantCells = ASPx.Data.CollectionToArray(itemRow.cells)
38416   .slice(this.GetItemFirstTextCellIndex(), itemRow.cells.length - 1);
38417  redundantCells.forEach(function(cell) { itemRow.removeChild(cell); });
38418  var itemHtmlContainerCell = itemRow.cells[itemRow.cells.length - 1];
38419  ASPx.SetElementDisplay(itemHtmlContainerCell, this.GetVisibleColumnCount() !== 0);
38420  itemHtmlContainerCell.colSpan = Math.max(itemHtmlContainerCell.colSpan, this.GetVisibleColumnCount());
38421  if(this.IsMultiColumn()) {
38422   if(this.GetItemFirstTextCellIndex() === 0)
38423    ASPx.AddClassNameToElement(itemHtmlContainerCell, FIRST_CELL_MARKER_CSS_CLASS_NAME);
38424   ASPx.AddClassNameToElement(itemHtmlContainerCell, LAST_CELL_MARKER_CSS_CLASS_NAME);
38425  }
38426  itemHtmlContainerCell.style.width = "";
38427  itemHtmlContainerCell.innerHTML = html;
38428  this.RemoveEllipsisFromNode(itemHtmlContainerCell);
38429  this.EnsureStartupScriptsInContainer(itemHtmlContainerCell);
38430 },
38431 SetItemTextContent: function(textCellIndex, newItemRow, itemProperties) {
38432  var cellCount = this.GetItemCellCount();
38433  for(var j = 0; textCellIndex < cellCount; textCellIndex++, j++) {
38434   var cellStyle = this.GetCellInfo(j, itemProperties.cellStyles);
38435   var cellCssClass = this.GetCellInfo(j, itemProperties.cellCssClasses);
38436   var cellTooltip = this.GetCellInfo(j, itemProperties.cellTooltips);
38437   var cellAttributes = this.GetCellInfo(j, itemProperties.cellAttributes);
38438   var htmlContent = this.GetCellInfo(j, itemProperties.htmlContents);
38439   this.PrepareItemTextCell(newItemRow.cells[textCellIndex], itemProperties.texts[j], cellStyle, cellCssClass, cellTooltip, cellAttributes, htmlContent);
38440  }
38441 },
38442 SetItemTextCellHtmlContent: function(cell, html) {
38443  cell.innerHTML = html;
38444  this.RemoveEllipsisFromNode(cell);
38445  this.EnsureStartupScriptsInContainer(cell);
38446 },
38447 PrepareItemImage: function(newItemRow, imageCellIndex, imageUrl){
38448  var imageCell = newItemRow.cells[imageCellIndex];
38449  var image = ASPx.GetNodeByTagName(imageCell, "IMG", 0);
38450  if(!imageUrl) {
38451   if(image)
38452    ASPx.RemoveElement(image);
38453   imageCell.innerHTML = "&nbsp;";
38454  } else {
38455   if(!image) {
38456    image = document.createElement("IMG");
38457    imageCell.innerHTML = "";
38458    imageCell.appendChild(image);
38459   }
38460   ASPx.ImageUtils.SetImageSrc(image, imageUrl);
38461  }
38462 }, 
38463 PrepareItemTextCell: function(cell, text, style, cssClass, tooltip, attributes, htmlContent) {
38464  if(!ASPx.IsExists(text)) 
38465   text = "";
38466  if(this.encodeHtml)
38467   text = ASPx.Str.EncodeHtml(text);
38468  if(htmlContent) {
38469   this.SetItemTextCellHtmlContent(cell, htmlContent);
38470   this.SetItemCellTextDataAttribute(cell, this.ProtectWhitespaceSerieses(text));
38471  }
38472  else {
38473   cell.innerHTML = this.ProtectWhitespaceSerieses(text);
38474   if(this.enableEllipsis)
38475    ASPx.AddClassNameToElement(cell, ASPx.ELLIPSIS_MARKER_CLASS);
38476  }
38477  this.AssignDecorationSettingsToElement(cell, style, cssClass, tooltip, attributes);
38478  if(text == "")
38479   ASPx.Attr.SetAttribute(cell, "DXText", text);
38480 },
38481 AssignDecorationSettingsToElement: function(element, style, cssClass, tooltip, attributes) {
38482  if(cssClass)
38483   ASPx.AddClassNameToElement(element, cssClass);
38484  if(style) {
38485   var styleSheet = ASPx.GetCurrentStyleSheet();
38486   ASPx.AddClassNameToElement(element, ASPx.CreateImportantStyleRule(styleSheet, style));
38487  }
38488  if(tooltip)
38489   this.SetElementTooltip(element, tooltip);
38490  if(attributes)
38491   for(var key in attributes)
38492    if(attributes.hasOwnProperty(key))
38493     ASPx.Attr.SetAttribute(element, key, attributes[key]);
38494 },
38495 SetElementTooltip: function(element, tooltip) {
38496  this.RemoveEllipsisTooltip(element);
38497  ASPx.Attr.SetAttribute(element, "title", tooltip);
38498 },
38499 FormatText: function(texts, value) {
38500  if(typeof(texts) === "string")
38501   return texts;
38502  else if(!this.IsMultiColumn())
38503   return texts[0];
38504  else
38505   return this.FormatTextCore(texts, value);
38506 },
38507 FormatTextCore: function(texts, value) {
38508  var result = "";
38509  if(this.isComboBoxList) {
38510   if(this.nullValueItemDisplayText !== null && value === null)
38511    result = this.nullValueItemDisplayText;
38512   else
38513    result = ASPx.Formatter.Format(this.textFormatString, texts);
38514  } else
38515   result = texts.join("; ");
38516  return result;
38517 },
38518 OnItemInserted: function(index){
38519  this.GetItemSelectionHelper().OnItemInserted(index);
38520 },
38521 OnItemRemoved: function(index){
38522  this.GetItemSelectionHelper().OnItemRemoved(index);
38523 },
38524 CreateItemId: function(index){
38525  return lbIIdSuffix + index;
38526 },
38527 CreateItemClientId: function(index){
38528  return this.name + "_" + lbIIdSuffix + index;
38529 },
38530 CreateStyleClasses: function(id, postfixes, item, kind){
38531  var classes = [];
38532  if(item && item[kind]){
38533   classes[0] = [];
38534   classes[0][0] = item[kind].classNames;
38535   classes[0][1] = item[kind].cssTexts;
38536   classes[0][2] = [];
38537   classes[0][2][0] = id;
38538   classes[0][3] = postfixes;
38539  }
38540  return classes;
38541 },
38542 CorrectSizeByTimer: function(){
38543  if(this.APILockCount == 0 && this.IsDisplayed())
38544   window.setTimeout(function() { this.OnCorrectSizeByTimer(); }.aspxBind(this), 0);
38545 },
38546 FindFreeIndex: function(){
38547  return this.freeUniqIndex ++;
38548 },
38549 GetSampleItemRowID: function(){
38550  return this.name + "_" + lbSIIdSuffix;
38551 },
38552 GetAccessibilitySampleHeaderRowID: function() {
38553  return this.name + "_" + lbAIRTIdSuffix;
38554 },
38555 GetSampleItemRow: function(){
38556  if(this.SampleItem == null)
38557   this.SampleItem = ASPx.GetElementById(this.GetSampleItemRowID());
38558  return this.SampleItem;
38559 },
38560 GetAccessibilitySampleHeaderRow: function() {
38561  if(this.sampleHeaderRow == null)
38562   this.sampleHeaderRow = ASPx.GetElementById(this.GetAccessibilitySampleHeaderRowID());
38563  return this.sampleHeaderRow;
38564 },
38565 AddAccessibilityHeaderRow: function() {
38566  if(!this.accessibilityCompliant || !this.IsMultiColumn()) return;
38567  var listTableBody = ASPx.GetChildByTagName(this.GetListTable(), "TBODY", 0);
38568  var headerRow = this.GetAccessibilitySampleHeaderRow().cloneNode(true);
38569  headerRow.id = this.GetAccessibilityHeaderRowID();
38570  listTableBody.appendChild(headerRow);
38571 },
38572 GetAccessibilityHeaderRow: function() {
38573  return this.GetChildElement(lbAIRIdSuffix);
38574 },
38575 RemoveAccessibilityHeaderRow: function() {
38576  var headerRow = this.GetAccessibilityHeaderRow();
38577  if(headerRow)
38578   ASPx.RemoveElement(headerRow);
38579 },
38580 GetAccessibilityHeaderRowID: function() {
38581  return this.name + "_" + lbAIRIdSuffix;
38582 },
38583 GetSampleItemFirstTextCell: function(){
38584  if(!ASPx.IsExistsElement(this.sampleItemFirstTextCell)){
38585   var sampleItemRow = this.GetSampleItemRow();
38586   if(ASPx.IsExistsElement(sampleItemRow))
38587    this.sampleItemFirstTextCell = sampleItemRow.cells[this.imageCellExists ? 1 : 0];
38588  }
38589  return this.sampleItemFirstTextCell;
38590 },
38591 ChangeEnabledAttributes: function(enabled){
38592  this.ChangeListTableEvents(this.GetListTable(), ASPx.Attr.ChangeEventsMethod(enabled));
38593  var focusableElement = this.GetInputElement();
38594  if(focusableElement) {
38595   this.ChangeSpecialInputEnabledAttributes(focusableElement, ASPx.Attr.ChangeEventsMethod(enabled));
38596   if(this.accessibilityCompliant)
38597    this.ChangeFocusableElementTabIndex(focusableElement, enabled);
38598   else if(!this.isComboBoxList) {
38599    var changeMethod = enabled ? ASPx.Attr.RestoreTabIndexAttribute : ASPx.Attr.SaveTabIndexAttributeAndReset;
38600    changeMethod(focusableElement);
38601   }
38602  }
38603 },
38604 ChangeFocusableElementTabIndex: function(focusableElement, enabled) {
38605  if(!this.isComboBoxList) {
38606   if(enabled)
38607    ASPx.Attr.SetAttribute(focusableElement, "tabindex", "0");
38608   else
38609    focusableElement.removeAttribute("tabindex");
38610  }
38611 },
38612 ChangeEnabledStateItems: function(enabled){
38613  var controller = ASPx.GetStateController();
38614  controller.SetElementEnabled(this.GetMainElement(), enabled);
38615  var count = this.GetItemCount();
38616  var i = this.hasSampleItem ? -1 : 0 ;
38617  for(; i < count; i ++){
38618   this.ChangeEnabledStateItem(i, enabled, controller);
38619  }
38620  this.changeSelectAllElementsEnabledState(enabled);
38621  var changeEventMethod = ASPx.Attr.ChangeEventsMethod(enabled);
38622  if(this.filteringTextBox && !this.customFilteringEditorID) {
38623   this.filteringTextBox.SetEnabled(enabled);
38624   this.ChangeSpecialInputEnabledAttributes(this.filteringTextBox.GetInputElement(), changeEventMethod, true);
38625  }
38626  if(this.showFilterButton) {
38627   this.showFilterButton.SetEnabled(enabled);
38628   this.ChangeSpecialInputEnabledAttributes(this.showFilterButton.GetInternalButton(), changeEventMethod, true);
38629  }
38630 },
38631 ChangeEnabledStateItem: function (index, enabled, controller) {
38632  var element = this.GetItemFirstTextCell(index);
38633  if (element)
38634   controller.SetElementEnabled(element, enabled);
38635  if (this.GetIsCheckColumnExists() && index >= 0)
38636   this.SetCheckBoxEnabled(index, enabled);
38637 },
38638 ChangeListTableEvents: function(listTable, method){
38639  if(this.isComboBoxList){
38640   method(listTable, "mouseup", aspxLBIClick);
38641   if(ASPx.Browser.Firefox)
38642    method(listTable, "mousedown", ASPx.Evt.PreventEvent); 
38643  }
38644  else{
38645   method(listTable, "click", aspxLBIClick);   
38646   method(listTable, "dblclick", aspxLBIClick); 
38647   if(this.MultiSelectionMode())
38648    this.AttachSelectStartHandlerToElement(listTable);
38649  }
38650 },
38651 AttachSelectStartHandlerToElement: function(element) {
38652  ASPx.Evt.AttachEventToElement(element, "selectstart", aspxLBTSelectStart);
38653 },
38654 IsValueChanged: function(){
38655  return this.cachedValue != this.GetValue();
38656 },
38657 OnItemSelectionChanged: function(index, selected, fromSelectAllClick, forceValueChanged){
38658  if(this.CheckColumnSelectionMode() && !fromSelectAllClick)
38659   this.SetCheckBoxChecked(index, selected);
38660  if(!this.IsSelectionEventsLocked()) {
38661   this.SetRaiseSelectedIndexChangedArguments(this.autoPostBack, index, selected);
38662   var valueChanged = this.IsValueChanged() || forceValueChanged;
38663   if(valueChanged) {
38664    this.RaisePersonalStandardValidation();
38665    this.OnValueChanged();
38666   } else {
38667    if(this.RaiseSelectedIndexChanged())
38668     this.SendPostBackInternal("");
38669   }
38670  }
38671  this.CacheValue();
38672  if(this.accessibilityHelper && !fromSelectAllClick)
38673   this.accessibilityHelper.OnSelectedIndexChanged(index);
38674 },
38675 SetRaiseSelectedIndexChangedArguments: function(processOnServer, index, selected){
38676  this.selectedIndexChangedArguments = {
38677   processOnServer: processOnServer,
38678   index: index,
38679   selected: selected
38680  };
38681 },
38682 GetRaiseSelectedIndexChangedArguments: function(){
38683  if(!this.selectedIndexChangedArguments)
38684   this.SetRaiseSelectedIndexChangedArguments(false, this.GetSelectedIndex(), true);
38685  return this.selectedIndexChangedArguments;
38686 },
38687 RaiseSelectedIndexChanged: function (processOnServer) {
38688  this.RaiseValidationInternal();
38689  var savedArgs = this.GetRaiseSelectedIndexChangedArguments();
38690  processOnServer = savedArgs.processOnServer || processOnServer;
38691  if(!this.SelectedIndexChanged.IsEmpty()){
38692   var args = new ASPxClientListEditItemSelectedChangedEventArgs(savedArgs.index, savedArgs.selected, processOnServer);
38693   this.SelectedIndexChanged.FireEvent(this, args);
38694   processOnServer = args.processOnServer;
38695  }
38696  return processOnServer;
38697 },
38698 RaiseItemFiltering: function(item, filter, isFit) {
38699  if(!this.ItemFiltering.IsEmpty()) {
38700   var args = new ASPxClientListEditItemFilteringEventArgs(item, filter, isFit);
38701   this.ItemFiltering.FireEvent(this, args);
38702   isFit = args.isFit;
38703  }
38704  return isFit;
38705 },
38706 RaiseCustomHighlighting: function(filter, callbackHighlighting) {
38707  if(!this.CustomHighlighting.IsEmpty()) {
38708   var args = new ASPxClientListEditCustomHighlightingEventArgs(filter);
38709   args.highlighting = callbackHighlighting;
38710   this.CustomHighlighting.FireEvent(this, args);
38711   return args.highlighting;
38712  }
38713  return callbackHighlighting;
38714 },
38715 SetWidth: function(width) {
38716  this.width = width + "px";
38717  this.GetScrollDivElement().style.width = "100%";
38718  ASPxClientListBoxBase.prototype.SetWidth.call(this, width);
38719 },
38720 SetHeight: function(height) {
38721  this.heightCorrected = false;
38722  ASPxClientListBoxBase.prototype.SetHeight.call(this, height);
38723  this.CorrectHeight();
38724 },
38725 OnAssociatedLabelClick: function(focusableElement) {
38726  var isValidElement = focusableElement && ASPx.IsActionElement(focusableElement) && ASPx.GetIsParent(this.GetMainElement(), focusableElement);
38727  if(isValidElement)
38728   focusableElement.focus();
38729  else
38730   ASPxClientListBoxBase.prototype.OnDelayedSpecialFocusMouseDown.call(this, null);
38731 },
38732 TryApplyHighlighting: function() {
38733  var ownerControl = this.GetCallbackOwnerControl();
38734  var filterStrategy = ownerControl && ownerControl.filterStrategy ? ownerControl.filterStrategy : this.filterStrategy;
38735  if(filterStrategy.ApplyHighlighting)
38736   filterStrategy.ApplyHighlighting();
38737 },
38738 onDropDownModalChanged: function(enabled) {
38739  if(!this.IsMultiColumn())
38740   return;
38741  if(enabled && !this.itemsManager.GetFirstVisibleItemRow())
38742   return;
38743  this.updateCellWidthsOnDropDownChanged(enabled);
38744 },
38745 updateCellWidthsOnDropDownChanged: function(enabled) {
38746  var applyFunction = this.getUpdateCellWidthsFunctionOnDropDownChanged(enabled);
38747  var sampleRow = this.GetSampleItemRow();
38748  var headerRow = this.GetHeaderTableElement().rows[0];
38749  var dataRows = this.itemsManager.GetListTableRows();
38750  for(var i = this.columnFieldNames.length - 1; i >= 0; i--) {
38751   applyFunction(sampleRow, i);
38752   applyFunction(headerRow, i);
38753   for(var row, j = 0; row = dataRows[j]; j++)
38754    applyFunction(row, i);
38755  }
38756 },
38757 getUpdateCellWidthsFunctionOnDropDownChanged: function(enabled) {
38758  if(enabled) {
38759   var row = this.itemsManager.GetFirstVisibleItemRow();
38760   var widths = Array.prototype.slice.call(row.cells, 0).map(function(cell) { return cell.offsetWidth; });
38761   var commonWidth = widths.reduce(function(a, b) { return a + b; }, 0);
38762   widths = widths.map(function(w) { return (w * 100) / commonWidth; });
38763   return function(row, cellIndex) {
38764    ASPx.Attr.ChangeStyleAttribute(row.cells[cellIndex], "width", widths[cellIndex] + "%");
38765   };
38766  }
38767  return function(row, cellIndex) {
38768   ASPx.Attr.RestoreStyleAttribute(row.cells[cellIndex], "width");
38769  };
38770 }
38771});
38772ASPxClientListBox.GetItemCellInnerText = function(itemTextCell) {
38773 var text;
38774 if(typeof(itemTextCell.attributes["DXText"]) != "undefined")
38775  text = ASPx.Attr.GetAttribute(itemTextCell, "DXText");
38776 else {
38777  var itemCellTextAttribute = ASPx.Attr.GetAttribute(itemTextCell, itemCellTextAttributeName);    
38778  text = ASPx.IsExists(itemCellTextAttribute) ? itemCellTextAttribute : ASPx.GetInnerText(itemTextCell);
38779 }
38780 text = text.replace(new RegExp(nbspChar, "g"), " ");
38781 return text;
38782};
38783var ASPxClientNativeListBox = ASPx.CreateClass(ASPxClientListBoxBase, {
38784 constructor: function(name) {
38785  this.constructor.prototype.constructor.call(this, name);
38786 },
38787 InitializeEvents: function() {
38788  ASPxClientListBoxBase.prototype.InitializeEvents.call(this);
38789  if(!!this.GetMainElement()) {
38790   ASPx.Evt.AttachEventToElement(this.GetMainElement(), "keydown", this.OnKeyDown.aspxBind(this));
38791   ASPx.Evt.AttachEventToElement(this.GetMainElement(), "keyup", this.OnKeyUp.aspxBind(this));
38792   ASPx.Evt.AttachEventToElement(this.GetMainElement(), "keypress", this.OnKeyPress.aspxBind(this));
38793  }
38794 },
38795 SetReadOnlyInternal: function(readOnly) {
38796  ASPxClientListBoxBase.prototype.SetReadOnlyInternal.call(this, readOnly);
38797  var options = this.GetMainElement().querySelectorAll("option");
38798  for (var i = 0, option; option = options[i]; i++) {
38799   if (readOnly)
38800    ASPx.Attr.SetAttribute(option, "disabled", "disabled");
38801   else
38802    ASPx.Attr.RemoveAttribute(option, "disabled");
38803  }
38804 }, 
38805 SetMainElement: function(mainElement){
38806  this.mainElement = mainElement;
38807 },
38808 FindInputElement: function(){
38809  return this.GetMainElement();
38810 }, 
38811 GetOptionCount: function(){
38812  return this.GetMainElement().options.length;
38813 },
38814 GetOption: function(index){
38815  return this.GetMainElement().options[index];
38816 },
38817 GetItemCount: function(){
38818  return this.GetOptionCount();
38819 },
38820 SelectIndexSilent: function(index){
38821  var selectedIndex = this.GetSelectedIndexInternal();
38822  var isValidIndex = (-1 <= index && index < this.GetItemCount());
38823  if((selectedIndex != index && isValidIndex) || !this.isInitialized){
38824   this.SetSelectedIndexInternal(index);
38825   return true;
38826  }
38827  return false;
38828 },
38829 GetSelectedIndexInternal: function(){
38830  return this.GetMainElement().selectedIndex; 
38831 },
38832 SetSelectedIndexInternal: function(index){
38833  this.GetMainElement().selectedIndex = index; 
38834 },
38835 ClearItemsCore: function(){
38836  this.GetMainElement().innerHTML = "";
38837 },
38838 RemoveItem: function(index){
38839  if(0 <= index && index < this.GetItemCount()){
38840   var oldSelectedIndex = this.GetSelectedIndexInternal();
38841   this.UpdateSyncArraysItemDeleted(this.GetItem(index), true);
38842   var option = this.GetOption(index);
38843   this.GetMainElement().removeChild(option);
38844   this.UpdateOptionValues();
38845   this.OnItemRemoved(oldSelectedIndex, index);
38846  }
38847 },
38848 OnItemRemoved: function(oldSelectedIndex, newSelectedIndex){
38849  if(newSelectedIndex == oldSelectedIndex && !this.MultiSelectionMode())
38850   this.SetSelectedIndexInternal(-1);
38851 },
38852 MultiSelectionMode: function(){
38853  return this.GetMainElement().multiple;
38854 },
38855 GetItem: function(index){
38856  if(0 <= index && index < this.GetOptionCount()) {
38857   var text = this.GetOption(index).text;
38858   var selected = this.GetMainElement().options[index].selected;
38859   var itemValue = this.itemsValue[index] !== undefined ? this.itemsValue[index] : null;
38860   if(ASPx.IsExists(text))
38861    return new ASPxClientListBoxItem(this, index, text, itemValue, "", selected);
38862  }
38863  return null;
38864 },
38865 PerformCallback: function(arg) {
38866  this.ClearItemsForPerformCallback();
38867  this.FormatAndSetCustomCallbackArg(arg, true);
38868  this.SendCallback();
38869  this.FormatAndSetCustomCallbackArg(arg, false);
38870 },
38871 SendCallback: function(){
38872  if(!this.InCallback()){
38873   var callbackOwner = this.GetCallbackOwnerControl();
38874   if(callbackOwner != null)
38875    callbackOwner.SendCallback();
38876    else {
38877    var argument = this.GetCallbackArguments();
38878    this.CreateCallback(argument);
38879   }
38880  }
38881 },
38882 ParseCallbackResult: function(result){
38883  var deserializedItems = this.DeserializeItems(result[CONSTANTS.CALLBACK_RESULTS.ITEMS]);
38884  this.LoadItemsFromCallback(true, deserializedItems);
38885 },
38886 InsertItemInternal: function(index, itemProperties) {
38887  if(typeof (itemProperties.value) == "undefined")
38888   itemProperties.value = itemProperties.texts;
38889  var oldSelectedIndex = this.GetSelectedIndexInternal();
38890  var isAdd = this.GetOptionCount() <= index;
38891  var newOption = document.createElement("OPTION");
38892  if(isAdd)
38893   this.GetMainElement().appendChild(newOption);
38894  else
38895   this.GetMainElement().insertBefore(newOption, this.GetOption(index));
38896  newOption.innerHTML = itemProperties.texts;
38897  this.UpdateOptionValues();
38898  ASPx.Data.ArrayInsert(this.itemsValue, itemProperties.value, index);
38899  this.RegisterInsertedItem(index, itemProperties); 
38900  if(index == oldSelectedIndex && index != -1)
38901   this.SetSelectedIndex(index + 1);
38902 },
38903 UpdateOptionValues: function() {
38904  if(this.APILockCount == 0){
38905   for(var i = 0; i < this.GetOptionCount(); i++)
38906    this.GetOption(i).value = i;
38907  }
38908 },
38909 ChangeEnabledAttributes: function(enabled){
38910  if(!this.isComboBoxList)
38911   this.GetMainElement().disabled = !enabled;
38912 },
38913 OnCallback: function(result) {
38914  this.ParseCallbackResult(result);
38915 },
38916 OnItemDblClick: function(){
38917  this.RaiseItemDoubleClick();
38918 },
38919 LoadItemsFromCallback: function(isToTop, deserializedItems){
38920  this.BeginUpdate();
38921  this.LockSynchronizationOnInternalCallback();
38922  var mainElement = this.GetMainElement();
38923  for(var i = deserializedItems.length - 1; i >= 0; i--) {
38924   this.InsertItemInternal(0, deserializedItems[i]);
38925   if(deserializedItems[i].selected)
38926    mainElement.options[0].selected = true;
38927  }
38928  this.UnlockSynchronizationOnInternalCallback();
38929  this.EndUpdate();
38930 },
38931 EndUpdate: function(){
38932  ASPxClientListBoxBase.prototype.EndUpdate.call(this);
38933  this.UpdateOptionValues();
38934 },
38935 GetSelectedIndices: function(){
38936  var selectedIndices = [];
38937  var mainElement = this.GetMainElement();
38938  for(var i = 0; i < mainElement.options.length; i++){
38939   if(mainElement.options[i].selected)
38940    selectedIndices.push(i);
38941  }
38942  return selectedIndices;
38943 },
38944 GetSelectedValues: function(){ 
38945  var selectedValues = [];
38946  var selectedIndices = this.GetSelectedIndices();
38947  for(var i = 0; i < selectedIndices.length; i++)
38948   selectedValues.push(this.GetItemValue(selectedIndices[i]));
38949  return selectedValues;
38950 },
38951 GetSelectedItems: function(){
38952  var selectedItems = [];
38953  var selectedIndices = this.GetSelectedIndices();
38954  for(var i = 0; i < selectedIndices.length; i++)
38955   selectedItems.push(this.GetItem(selectedIndices[i]));
38956  return selectedItems;
38957 },
38958 SelectAll: function(){
38959  this.SetAllItemsSelectedValue(true);
38960 },
38961 UnselectAll: function(){
38962  this.SetAllItemsSelectedValue(false);
38963 },
38964 SetAllItemsSelectedValue: function(selected){
38965  var mainElement = this.GetMainElement();
38966  for(var i = 0; i < mainElement.options.length; i++)
38967   mainElement.options[i].selected = selected;
38968 },
38969 SelectIndices: function(indices){
38970  this.SetIndicesSelectionState(indices, true);
38971 },
38972 UnselectIndices: function(indices){
38973  this.SetIndicesSelectionState(indices, false);
38974 },
38975 SetIndicesSelectionState: function(indices, selected){
38976  var mainElement = this.GetMainElement();
38977  for(var i = 0; i < indices.length; i++){
38978   mainElement.options[indices[i]].selected = selected;
38979  }
38980 },
38981 SelectItems: function(items){
38982  if(ASPx.IsExists(items))
38983   this.SetItemsSelectionState(items, true);
38984  else
38985   this.SelectAll();
38986 },
38987 UnselectItems: function(items){
38988  if(ASPx.IsExists(items))
38989   this.SetItemsSelectionState(items, false);
38990  else
38991   this.UnselectAll();
38992 },
38993 SetItemsSelectionState: function(items, selected){
38994  var mainElement = this.GetMainElement();
38995  for(var i = 0; i < items.length; i++){
38996   mainElement.options[items[i].index].selected = selected;
38997  }
38998 },
38999 SelectValues: function(values){
39000  this.SetValuesSelectedState(values, true);
39001 },
39002 UnselectValues: function(values){
39003  this.SetValuesSelectedState(values, false);
39004 },
39005 SetValuesSelectedState: function(values, selected){
39006  var mainElement = this.GetMainElement();
39007  var index;
39008  for(var i = 0; i < values.length; i++){
39009   index = this.FindItemIndexByValue(values[i]);
39010   mainElement.options[index].selected = selected;
39011  }
39012 },
39013 EnsureRequiredNativeAttributesExists: function() {
39014  var input = this.GetInputElement();
39015  if(!input.onchange)
39016   ASPx.Evt.AttachEventToElement(input, "change", function() { ASPx.EValueChanged(this.name); }.aspxBind(this));
39017 }
39018});
39019var AccessibilityHelperListBox = ASPx.CreateClass(ASPx.AccessibilityHelperBase, {
39020 constructor: function(listBox) {
39021  this.constructor.prototype.constructor.call(this, listBox);
39022  this.checkBoxRefocusTimeout = 1000;
39023  this.firstReadingColumnIndex = this.control.CheckColumnSelectionMode() ? 1 : 0;
39024  this.Initialize();
39025 },
39026 Initialize: function() {
39027  if(this.control.CheckColumnSelectionMode() && !this.control.IsNativeCheckBoxes())
39028   this.control.GotFocus.AddHandler(function() { this.SetActionElementFocus(); }.aspxBind(this));
39029  this.control.GotFocus.AddHandler(function() { this.OnSelectedIndexChanged(this.control.GetSelectedIndex()); }.aspxBind(this));
39030  this.control.LostFocus.AddHandler(function() { 
39031   setTimeout(function() { 
39032    this.changeActivityAttributes(this.getMainElement(), { "aria-activedescendant": "" }); 
39033   }.aspxBind(this), 200); 
39034  }.aspxBind(this));
39035 },
39036 OnSelectedIndexChanged: function(index) {
39037  var stateSelected = index != -1 && this.control.GetItem(index) && this.control.GetItem(index).selected;
39038  var selectedIndex = this.control.GetSelectedIndex();
39039  if(this.control.CheckColumnSelectionMode() || stateSelected || selectedIndex == -1)
39040   this.setSelectionAttributes(index, stateSelected);
39041 },
39042 getPronounceTimeout: function() {
39043  if(ASPx.Browser.WebKitFamily && this.control.CheckColumnSelectionMode())
39044   return 1000;
39045  return ASPx.AccessibilityHelperBase.prototype.getPronounceTimeout.call(this);
39046 },
39047 getHeaderCellCaptionText: function(index) {
39048  var headerDiv = this.control.GetHeaderDivElement();
39049  if(!headerDiv) return "";
39050  var headerTable = headerDiv.firstElementChild;
39051  return headerTable.rows[0].cells[this.firstReadingColumnIndex + index].textContent;
39052 },
39053 isItemCheckBoxFocused: function() {
39054  for(var i = 0; i < this.control.GetItemCount() ; i++) {
39055   var internalCheckBox = this.control.GetInternalCheckBox(i);
39056   if(internalCheckBox && internalCheckBox.focused)
39057    return true;
39058  }
39059  return false;
39060 },
39061 isSelectAllCheckBoxFocused: function() {
39062  return this.control.selectAllCheckBox && this.control.selectAllCheckBox.focused;
39063 },
39064 SetActionElementFocus: function() {
39065  if(this.control.enableFiltering) {
39066   if(!this.control.HasInternalFilteringTextBoxFocus())
39067    this.SetFilterPanelFocus();
39068  }
39069  else
39070   this.SetCheckBoxFocus();
39071 },
39072 SetCheckBoxFocus: function () {
39073  var isCheckBoxFocused = this.isItemCheckBoxFocused() || this.isSelectAllCheckBoxFocused();
39074  if(!isCheckBoxFocused)
39075   this.ProcessRefocusHandler(function() {
39076    this.control.SetFocusedIndex(0);
39077   }.aspxBind(this));
39078 },
39079 SetFilterPanelFocus: function() {
39080  if(this.control.customFilteringEditorID || ASPx.ElementHasCssClass(this.control.filterMainElement, this.control.GetInactiveFilterElementClassName())) {
39081   if(this.control.showFilterButton)
39082    this.ProcessRefocusHandler(function() {
39083     this.control.showFilterButton.Focus(); 
39084    }.aspxBind(this));
39085  } else 
39086    this.ProcessRefocusHandler(function() {
39087     ASPx.FindFirstChildActionElement(this.control.filterMainElement).focus(); 
39088    }.aspxBind(this));
39089 },
39090 ProcessRefocusHandler: function(handler) {
39091   setTimeout(function() {
39092   if(!this.control.focused) return;
39093   handler();
39094  }.aspxBind(this), this.checkBoxRefocusTimeout);
39095 },
39096 setSelectionAttributes: function(index, stateSelected) {
39097  if(index == -1) index = 0;
39098  var item = this.control.GetItem(index);
39099  if(!item) return;
39100  var assistText = "";
39101  if(!this.control.IsMultiColumn()) {
39102   assistText = item.text;
39103  } else {
39104   var columnsCount = this.control.columnFieldNames.length;
39105   var formatString = ASPx.AccessibilitySR.TableItemFormatString; 
39106   for(var i = 0; i < columnsCount; i++)
39107    assistText += ASPx.Str.ApplyReplacement(formatString, [["{0}", this.getHeaderCellCaptionText(i)], ["{1}", item.texts[i]]]);
39108  }
39109  var activeItemArgs = {
39110   "role"    : "option",
39111   "aria-posinset" : index + 1,
39112   "aria-setsize"  : this.control.itemTotalCount,
39113   "aria-selected" : stateSelected
39114  };
39115  var inactiveItemArgs = {
39116   "role"    : "",
39117   "aria-posinset" : "",
39118   "aria-setsize"  : "",
39119   "aria-selected" : ""
39120  };
39121  this.PronounceMessage(assistText, activeItemArgs, inactiveItemArgs);
39122 },
39123 SetCheckBoxesValidationAttributes: function() {
39124  if(!this.control.CheckColumnSelectionMode() || !this.control.GetErrorCell()) return;
39125  var errorTextElement = this.control.ariaExplanatoryTextManager.GetErrorTextElement();
39126  for (var i = 0; i < this.control.GetItemCount() ; i++) {
39127   var checkBoxFocusableElement = this.control.GetCheckBoxFocusableElement(i);
39128   if(checkBoxFocusableElement) {
39129    ASPx.Attr.SetOrRemoveAttribute(checkBoxFocusableElement, "aria-describedby", !this.control.isValid ? errorTextElement.id : null);
39130    ASPx.Attr.SetOrRemoveAttribute(checkBoxFocusableElement, "aria-invalid", !this.control.isValid);
39131   }
39132  }
39133 }
39134});
39135ASPxClientListBox.Cast = ASPxClientControl.Cast;
39136var ASPxClientCheckListBase = ASPx.CreateClass(ASPxClientListEdit, {
39137 constructor: function(name) {
39138  this.constructor.prototype.constructor.call(this, name);          
39139  this.imageProperties = null;
39140  this.internalButtonCollection = null; 
39141  this.icbFocusedStyle = [];
39142  this.items = [];
39143 },
39144 SetData: function(data){
39145  ASPxClientEdit.prototype.SetData.call(this, data);
39146  if(data.items)
39147   this.CreateItems(data.items);
39148 },
39149 Initialize: function() {
39150  ASPxClientListEdit.prototype.Initialize.call(this);
39151  this.UpdateInternalSelectedIndex(); 
39152 },
39153 UpdateInternalSelectedIndex: function() {
39154  var selectedIndexFromServer = this.GetSelectedIndex();
39155  var stateInput = this.FindStateInputElement();
39156  if(stateInput) {
39157   var restoredSelectedIndex = stateInput.value;
39158   if(restoredSelectedIndex != '' && restoredSelectedIndex != selectedIndexFromServer) {
39159    this.SetSelectedIndex(selectedIndexFromServer);
39160    this.SetSelectedIndex(restoredSelectedIndex);
39161   }
39162  }
39163 },
39164 CreateButtonInternalCollection: function() { 
39165  this.internalButtonCollection = this.CreateCheckBoxInternalCollection();
39166  for(var i = 0; i < this.GetItemCount(); i++) {
39167   var icbInputElement = this.GetItemInput(i);
39168   var internalButton = this.internalButtonCollection.Add(icbInputElement.id, icbInputElement, this.GetItemElement(i));
39169   internalButton.CreateFocusDecoration(this.icbFocusedStyle);
39170   internalButton.SetEnabled(this.GetEnabled());
39171   internalButton.GetReadOnly = this.GetReadOnly.bind(this);
39172   internalButton.CheckedChanged.AddHandler(function(s, e) {
39173    this.OnItemClick(this.GetItemIndexByElement(ASPx.Evt.GetEventSource(e)));
39174   }.aspxBind(this));
39175   internalButton.Focus.AddHandler(function(s, e) { this.OnFocus(); }.aspxBind(this));
39176   internalButton.LostFocus.AddHandler(function(s, e) { this.OnLostFocus(); }.aspxBind(this));
39177   this.attachToCellsClick(i);
39178   this.PrepareInternalButton(internalButton, i);
39179  }
39180  this.attachToMainElementMouseDown();
39181 },
39182 CreateCheckBoxInternalCollection: function () {
39183  return new ASPx.CheckBoxInternalCollection(this.imageProperties, false, true, ASPx.CheckEditElementHelper.Instance, undefined,
39184   this.accessibilityCompliant);
39185 },
39186 CheckableElementsExist: function() {
39187  return !!this.imageProperties;
39188 },
39189 SetEnabled: function(enabled){
39190  ASPxClientListEdit.prototype.SetEnabled.call(this, enabled);
39191  var stateInput = this.FindStateInputElement();
39192  if(enabled)
39193   ASPx.Attr.RemoveAttribute(stateInput, "disabled");
39194  else
39195   ASPx.Attr.SetAttribute(stateInput, "disabled", "disabled");
39196 },
39197 SetFocus: function() {
39198  this.UpdateFocus(); 
39199 },
39200 UpdateFocus: function() {
39201 },
39202 IsElementBelongToInputElement: function(element) {
39203  return this.GetItemIndexByElement(element) != -1;
39204 },
39205 attachToCellsClick: function(index) {
39206  var element = this.GetItemElement(index);
39207  ASPx.Evt.AttachEventToElement(element, "click", function(evt) {
39208   var src = ASPx.Evt.GetEventSource(evt);
39209   var label = ASPx.CheckEditElementHelper.Instance.GetLabelElement(element);
39210   var button = this.internalButtonCollection.Get(this.GetItemInput(index).id);
39211   if(!ASPx.GetIsParent(button.mainElement, src) && src !== label && src.parentElement !== label) {
39212    ASPx.CheckEditElementHelper.Instance.InvokeClick(button, evt);
39213   }
39214  }.aspxBind(this));
39215 },
39216 attachToMainElementMouseDown: function() {
39217  var mainElement = this.GetMainElement();
39218  ASPx.Evt.AttachEventToElement(mainElement, "mousedown", function() {
39219   if(!this.enabled || this.readOnly)
39220    return;
39221   this.LockFocusEvents();
39222   setTimeout(function() { this.UnlockFocusEvents(); }.aspxBind(this), 0);
39223  }.aspxBind(this));
39224 },
39225 GetItemIndexByElement: function(element) {
39226  for(var i = 0; i < this.GetItemCount(); i++) {
39227   var itemElement = this.GetItemElement(i);
39228   if(ASPx.GetIsParent(itemElement, element))
39229    return i;
39230  }
39231  return -1;  
39232 },
39233 GetItemInput: function(index) {
39234  return this.GetChildElement("RB" + index + "_I");
39235 },
39236 GetItemElement: function(index) {
39237  return this.GetChildElement("RB" + index);
39238 },
39239 GetItemFocusableElement: function(index) {
39240  return this.accessibilityCompliant ? this.GetChildElement("RB" + index + "_I_D") : this.GetItemInput(index);
39241 },
39242 GetAccessibilityActiveElements: function() {
39243  var accessibilityElements = [];
39244  for(var i = 0; i < this.GetItemCount(); i++) 
39245   accessibilityElements.push(this.GetItemFocusableElement(i));
39246  return accessibilityElements;
39247 },
39248 GetItemCount: function() {
39249  return this.items.length;
39250 },
39251 OnItemClick: function(index) {
39252 },
39253 OnItemClickReadonly: function() {
39254  var index = this.GetSelectedIndexInternal();
39255  this.SelectIndexSilent(index);
39256 },
39257 UpdateHiddenInputs: function(index) {
39258  var stateInput = this.FindStateInputElement();
39259  if(ASPx.IsExistsElement(stateInput))
39260   stateInput.value = index;
39261  var valueInput = this.GetValueInputElement();
39262  if(ASPx.IsExistsElement(valueInput)) {
39263   var value = this.GetValue();
39264   valueInput.value = ASPx.IsExists(value) ? value : " ";
39265  }
39266 },
39267 GetItemValue: function(index){
39268  if(index > -1 && index < this.items.length) {
39269   if(typeof(this.items[index].value) == "string" && this.items[index].value == "" && this.convertEmptyStringToNull)
39270    return null;
39271   else
39272    return this.items[index].value;
39273  }
39274  return null;
39275 },
39276 SetValue: function(value) {
39277  for(var i = 0; i < this.items.length; i++) {
39278   if(this.GetItemValue(i) == value) {   
39279    this.SelectIndexSilent(i);
39280    return;
39281   }
39282  } 
39283  this.SelectIndexSilent(-1);    
39284 },
39285 CreateItems: function(itemsProperties){
39286  for(var i = 0; i < itemsProperties.length; i++)
39287   this.CreateItem(i, { texts: itemsProperties[i][0], value: this.GetDecodeValue(itemsProperties[i][1]), imageUrl: itemsProperties[i][2] });
39288 },
39289 CreateItem: function(index, itemProperties){
39290  var item = new ASPxClientListEditItem(this, index, itemProperties.texts, itemProperties.value, itemProperties.imageUrl);
39291  this.items.push(item);
39292 },
39293 GetItem: function(index){
39294  return (0 <= index && index < this.items.length) ? this.items[index] : null;
39295 },
39296 ChangeEnabledAttributes: function(enabled){
39297  if(!this.CheckableElementsExist()) {
39298   for(var i = 0; i < this.GetItemCount(); i++){
39299    var element = this.GetItemInput(i);
39300    if(element){
39301     this.ChangeItemEnabledAttributes(element, ASPx.Attr.ChangeAttributesMethod(enabled));
39302     element.disabled = !enabled;
39303    }
39304   }
39305  } else {
39306   var selectedIndex = this.GetSelectedIndexInternal();
39307   this.UpdateCheckableElementDecorations(selectedIndex, enabled);
39308  }
39309 },
39310 ChangeEnabledStateItems: function(enabled){
39311  ASPx.GetStateController().SetElementEnabled(this.GetMainElement(), enabled);
39312  if(this.isNative){
39313   for(var i = 0; i < this.GetItemCount(); i++){
39314    var element = this.GetItemInput(i);
39315    if(element)
39316     ASPx.GetStateController().SetElementEnabled(element, enabled);
39317   }
39318  }
39319 },
39320 ChangeItemEnabledAttributes: function(element, method){
39321  method(element, "onclick");
39322 }
39323});
39324var ASPxClientRadioButtonList = ASPx.CreateClass(ASPxClientCheckListBase, {
39325 constructor: function(name) {
39326  this.constructor.prototype.constructor.call(this, name);          
39327 },
39328 InlineInitialize: function() {
39329  if(this.CheckableElementsExist()) 
39330   this.CreateButtonInternalCollection();
39331  ASPxClientCheckListBase.prototype.InlineInitialize.call(this);
39332 },
39333 Initialize: function() {
39334  ASPxClientCheckListBase.prototype.Initialize.call(this);
39335  this.UpdateHiddenInputs(this.GetSelectedIndex());
39336  this.SetSelectedIndex(this.GetSelectedIndex()); 
39337 },
39338 PrepareInternalButton: function(internalRadioButton){
39339  internalRadioButton.autoSwitchEnabled = false;
39340 },
39341 GetInputElement: function() {
39342  if(this.isNative) {
39343   var index = this.GetSelectedIndexInternal();
39344   return this.GetItemInput(index);
39345  } else 
39346   return this.GetValueInputElement();
39347 },
39348 GetValueInputElement: function() {
39349  if(this.valueInput == null) {
39350   var stateInput = this.FindStateInputElement();
39351   this.valueInput = this.GetHiddenField(null, this.name + "_ValueInput", stateInput.parentNode, stateInput);
39352  }
39353  return this.valueInput;
39354 },
39355 GetValueInputToValidate: function() {
39356  return this.GetValueInputElement();
39357 },
39358 SelectIndexSilent: function(index) {
39359  var itemCount = this.GetItemCount();
39360  var isValidIndex = (-1 <= index && index < itemCount);
39361  if(isValidIndex) {
39362   if(this.CheckableElementsExist()) 
39363    this.UpdateCheckableElementDecorations(index, this.GetEnabled());
39364   else {
39365    for(var i = 0; i < itemCount; i++) {
39366     var element = this.GetItemInput(i);
39367     if(element)
39368      element.checked = (i == index);
39369    }
39370   }
39371   this.SetSelectedIndexInternal(index);
39372   this.UpdateHiddenInputs(index);
39373  }
39374 },
39375 UpdateCheckableElementDecorations: function(selectedIndex, enabled) {
39376  if(this.CheckableElementsExist()) {
39377   for(var i = 0; i < this.items.length; i++) {
39378    var inputElement = this.GetItemInput(i);
39379    var internalButton = this.internalButtonCollection.Get(inputElement.id);
39380    internalButton.SetEnabled(enabled);
39381    internalButton.SetValue(i == selectedIndex ? ASPx.CheckBoxInputKey.Checked : ASPx.CheckBoxInputKey.Unchecked);
39382   }
39383  }
39384 },
39385 UpdateFocus: function() {
39386  var index = this.GetSelectedIndexInternal();
39387  if(index == -1)
39388   index = 0;
39389  var itemElement = this.GetItemFocusableElement(index);
39390  if(itemElement != null && ASPx.GetActiveElement() != itemElement && ASPx.IsEditorFocusable(itemElement)) 
39391   ASPx.SetFocus(itemElement);
39392 },
39393 OnItemClick: function(index) {
39394  if(this.GetSelectedIndexInternal() != index) {
39395   this.SelectIndexSilent(index);
39396   this.RaisePersonalStandardValidation();
39397   this.OnValueChanged();
39398  }
39399  this.UpdateFocus();
39400 },
39401 RequireInputElementToValidate: function() {
39402  return false;
39403 },
39404 GetItem: function(index){
39405  var item = ASPxClientCheckListBase.prototype.GetItem.call(this, index);
39406  if(item)
39407   item.selected = index == this.GetSelectedIndexInternal();
39408  return item;
39409 }
39410});
39411ASPxClientRadioButtonList.Cast = ASPxClientControl.Cast;
39412var ASPxClientCheckBoxList = ASPx.CreateClass(ASPxClientCheckListBase, {
39413 constructor: function(name) {
39414  this.constructor.prototype.constructor.call(this, name);          
39415  this.selectionEventsLockCount = 0;
39416  this.initializeInputValue = null;
39417  this.restoredSelectedIndices = null;
39418 },
39419 InlineInitialize: function() {
39420  if(this.CheckableElementsExist()) 
39421   this.CreateButtonInternalCollection();
39422  ASPxClientCheckListBase.prototype.InlineInitialize.call(this);
39423 },
39424 Initialize: function() {
39425  this.initializeInputValue = this.GetInputElement().value;
39426  ASPxClientCheckListBase.prototype.Initialize.call(this);
39427  this.SaveRestoredIndices();
39428  this.InitSelection();
39429 },
39430 SaveRestoredIndices: function() {
39431  var value = this.initializeInputValue;
39432  if(!ASPx.IsExists(value) || value === "")
39433   return;
39434  var serializer = this.GetSerializingHelper();
39435  var itemStringIndices = serializer.DeserializeValues(value);
39436  var itemIndices = [];
39437  for(var i = 0; i < itemStringIndices.length; i++) {
39438   var itemIndex = parseInt(itemStringIndices[i]);
39439   itemIndices.push(itemIndex);
39440  }
39441  this.restoredSelectedIndices = itemIndices;
39442 },
39443 InitSelection: function() {
39444  if(this.restoredSelectedIndices)
39445   this.UnselectAll();
39446  var selectedIndices = this.restoredSelectedIndices || this.initSelectedIndices;
39447  this.SelectIndices(selectedIndices);
39448  this.CacheValue();
39449 },
39450 PrepareInternalButton: function(internalCheckBox, index){
39451  internalCheckBox.autoSwitchEnabled = true;
39452  internalCheckBox.SetChecked(this.GetItemSelectionHelper().GetIsItemSelected(index));
39453 },
39454 SelectIndexSilent: function(index) {
39455  var itemCount = this.GetItemCount();
39456  var isValidIndex = (-1 <= index && index < itemCount);
39457  if(isValidIndex)
39458   this.SelectIndices([index]);
39459 },
39460 UpdateCheckableElementDecorations: function(selectedIndex, enabled) {
39461  if(this.CheckableElementsExist()) {
39462   for(var i = 0; i < this.items.length; i++) {
39463    var inputElement = this.GetItemInput(i);
39464    var internalButton = this.internalButtonCollection.Get(inputElement.id);
39465    internalButton.SetEnabled(enabled);
39466   }
39467  }
39468 },
39469 SetSelectionDecoration: function(index, selected){ 
39470  if(this.CheckableElementsExist()){
39471   var inputElement = this.GetItemInput(index);
39472   var internalButton = this.internalButtonCollection.Get(inputElement.id);
39473   internalButton.SetValue(selected ? ASPx.CheckBoxInputKey.Checked : ASPx.CheckBoxInputKey.Unchecked);
39474  } else {
39475   var element = this.GetItemInput(index);
39476   if(element)
39477    element.checked = (selected); 
39478  }
39479 },
39480 OnItemClick: function(index) {
39481  this.GetItemSelectionHelper().OnItemClick(index);
39482 },
39483 UpdateFocus: function() {
39484  var index = this.GetItemSelectionHelper().GetFocusedItemIndex();
39485  if(index == -1)
39486   index = this.GetSelectedIndexInternal();
39487  if(index == -1)
39488   index = 0;
39489  var itemElement = this.GetItemFocusableElement(index);
39490  if(itemElement != null && ASPx.GetActiveElement() != itemElement && ASPx.IsEditorFocusable(itemElement)) 
39491   ASPx.SetFocus(itemElement);
39492 },
39493 UpdateInternalState: function(){
39494  this.UpdateHiddenInputs();
39495 },
39496 IsUpdateHiddenInputsLocked: function(){
39497  return this.GetItemSelectionHelper().IsUpdateInternalSelectionStateLocked();
39498 },
39499 UpdateHiddenInputs: function(){
39500  if(this.IsUpdateHiddenInputsLocked()) 
39501   return;
39502  var element = this.FindStateInputElement();
39503  if(ASPx.IsExistsElement(element)) { 
39504   var sb = [ ];
39505   var serialiser = this.GetSerializingHelper();
39506   var selectedIndices = this.GetSelectedIndices();
39507   for(var i = 0; i < selectedIndices.length; i++)
39508    serialiser.SerializeAtomValue(sb, selectedIndices[i]);
39509   element.value = sb.join("");
39510  }
39511 },
39512 GetSerializingHelper: function(){ 
39513  if(this.serializingHelper == null)
39514   this.serializingHelper = new ListBoxBaseItemsSerializingHelper(this);
39515  return this.serializingHelper;
39516 },
39517 SetItemSelectionAppearance: function(index, selected, controller, checkCanChangeSelection){
39518 },
39519 LockSelectionEvents: function(){
39520  this.selectionEventsLockCount++;
39521 },
39522 UnlockSelectionEvents: function(){
39523  this.selectionEventsLockCount--;
39524 },
39525 IsSelectionEventsLocked: function(){
39526  return this.selectionEventsLockCount > 0;
39527 },
39528 CacheValue: function(){
39529  this.cachedValue = this.GetValue();
39530 },
39531 IsValueChanged: function(){
39532  return this.cachedValue != this.GetValue();
39533 },
39534 OnItemSelectionChanged: function(index, selected){
39535  this.SetSelectionDecoration(index, selected);
39536  if(!this.IsSelectionEventsLocked()) {
39537   this.SetRaiseSelectedIndexChangedArguments(this.autoPostBack, index, selected);
39538   var valueChanged = this.IsValueChanged();
39539   if(valueChanged) {
39540    this.RaisePersonalStandardValidation();
39541    this.OnValueChanged();
39542   } else {
39543    if(this.RaiseSelectedIndexChanged())
39544     this.SendPostBackInternal("");
39545   }
39546  }
39547  this.CacheValue();
39548 },
39549 SetRaiseSelectedIndexChangedArguments: function(processOnServer, index, selected){
39550  this.selectedIndexChangedArguments = {
39551   processOnServer: processOnServer,
39552   index: index,
39553   selected: selected
39554  };
39555 },
39556 GetRaiseSelectedIndexChangedArguments: function(){
39557  if(!this.selectedIndexChangedArguments)
39558   this.SetRaiseSelectedIndexChangedArguments(false, this.GetSelectedIndex(), true);
39559  return this.selectedIndexChangedArguments;
39560 },
39561 RaiseSelectedIndexChanged: function (processOnServer) {
39562  this.RaiseValidationInternal();
39563  var savedArgs = this.GetRaiseSelectedIndexChangedArguments();
39564  processOnServer = savedArgs.processOnServer || processOnServer;
39565  if(!this.SelectedIndexChanged.IsEmpty()){
39566   var args = new ASPxClientListEditItemSelectedChangedEventArgs(savedArgs.index, savedArgs.selected, processOnServer);
39567   this.SelectedIndexChanged.FireEvent(this, args);
39568   processOnServer = args.processOnServer;
39569  }
39570  return processOnServer;
39571 },
39572 GetItemSelectionHelper: function(){
39573  if(!this.itemSelectionHelper)
39574   this.itemSelectionHelper = this.CreateItemSelectionHelper();
39575  return this.itemSelectionHelper;
39576 },
39577 CreateItemSelectionHelper: function(){
39578  return new CheckBoxListMultiSelectionHelper(this);
39579 },
39580 GetItem: function(index){
39581  var item = ASPxClientCheckListBase.prototype.GetItem.call(this, index);
39582  item.selected = this.GetItemSelectionHelper().GetIsItemSelected(index);
39583  return item;
39584 },
39585 SetValue: function(value){
39586  var index = this.FindItemIndexByValue(value);
39587  this.SetSelectedIndex(index);
39588 },
39589 GetSelectedIndexInternal: function(){
39590  if(!this.isInitialized)
39591   return ASPxClientCheckListBase.prototype.GetSelectedIndexInternal.call(this);
39592  return this.GetItemSelectionHelper().GetSelectedIndex();
39593 },
39594 SetSelectedIndex: function(index){
39595  this.LockSelectionEvents();
39596  this.GetItemSelectionHelper().SetSelectedIndex(index);
39597  this.UnlockSelectionEvents();
39598 },
39599 GetSelectedIndices: function(){
39600  return this.GetItemSelectionHelper().GetSelectedIndices();
39601 },
39602 GetSelectedValues: function(){ 
39603  return this.GetItemSelectionHelper().GetSelectedValues();
39604 },
39605 GetSelectedItems: function(){
39606  return this.GetItemSelectionHelper().GetSelectedItems();
39607 },
39608 SelectAll: function(){
39609  this.SelectIndices();
39610 },
39611 UnselectAll: function(){
39612  this.UnselectIndices();
39613 },
39614 SelectIndices: function(indices){
39615  this.LockSelectionEvents();
39616  this.GetItemSelectionHelper().SelectIndices(indices);
39617  this.UnlockSelectionEvents();
39618 },
39619 SelectItems: function(items){
39620  this.LockSelectionEvents();
39621  this.GetItemSelectionHelper().SelectItems(items);
39622  this.UnlockSelectionEvents();
39623 },
39624 SelectValues: function(values){
39625  this.LockSelectionEvents();
39626  this.GetItemSelectionHelper().SelectValues(values);
39627  this.UnlockSelectionEvents();
39628 },
39629 UnselectIndices: function(indices){
39630  this.LockSelectionEvents();
39631  this.GetItemSelectionHelper().UnselectIndices(indices);
39632  this.UnlockSelectionEvents();
39633 },
39634 UnselectItems: function(items){
39635  this.LockSelectionEvents();
39636  this.GetItemSelectionHelper().UnselectItems(items);
39637  this.UnlockSelectionEvents();
39638 },
39639 UnselectValues: function(values){
39640  this.LockSelectionEvents();
39641  this.GetItemSelectionHelper().UnselectValues(values);
39642  this.UnlockSelectionEvents();
39643 }
39644});
39645ASPxClientCheckBoxList.Cast = ASPxClientControl.Cast;
39646var ASPxClientListEditItemSelectedChangedEventArgs = ASPx.CreateClass(ASPxClientProcessingModeEventArgs, {
39647 constructor: function(index, isSelected, processOnServer){
39648  this.constructor.prototype.constructor.call(this, processOnServer);
39649  this.index = index;
39650  this.isSelected = isSelected;
39651 }
39652});
39653function aspxLBTSelectStart(evt){
39654 var shiftPressed = evt.shiftKey;
39655 var ctrlKey = evt.ctrlKey || evt.metaKey;
39656 if(shiftPressed || ctrlKey){
39657  ASPx.Selection.Clear();
39658  ASPx.Evt.PreventEventAndBubble(evt);
39659 }
39660}
39661function aspxLBIClick(evt){
39662 if(ASPx.TouchUIHelper.isMouseEventFromScrolling) return;
39663 var element = ASPx.Evt.GetEventSource(evt);
39664 while(element != null && element.tagName != "BODY"){
39665  if(element.tagName == "TR"){
39666   var table = element.offsetParent;
39667   if(table && table.ListBoxId){
39668    var lb = ASPx.GetControlCollection().Get(table.ListBoxId);
39669    if(lb != null) {
39670     var retValue;
39671     if(evt.type == "dblclick") 
39672      retValue =lb.OnItemDblClick();
39673     else if(!lb.isComboBoxList || ASPx.Evt.IsLeftButtonPressed(evt)) {
39674      var itemIndex = lb.GetItemIndexByRow(element);
39675      retValue = lb.OnItemClick(itemIndex, evt);
39676     }
39677     if(typeof(retValue) != "undefined")
39678      return retValue;
39679    }
39680    break;
39681   }
39682  }
39683  element = element.parentNode;
39684 }
39685}
39686function aspxLBScroll(evt){
39687 var sourceId = ASPx.Evt.GetEventSource(evt).id;
39688 if(sourceId.slice(-lbDSuffix.length) == lbDSuffix){
39689  var name = sourceId.slice(0, -2);
39690  var lb = ASPx.GetControlCollection().Get(name);
39691  if(lb != null && lb.isInitialized) 
39692   lb.OnScroll();
39693 }
39694}
39695ASPx.NLBIDClick = function(evt) {
39696 var element = ASPx.Evt.GetEventSource(evt);
39697 if(element != null && element.tagName == "SELECT"){
39698  var lb = ASPx.GetControlCollection().Get(element.id);
39699  if(lb != null)
39700   lb.OnItemDblClick();
39701 }
39702};
39703ASPx.ERBLIClick = function(name, index) {
39704 var list = ASPx.GetControlCollection().Get(name);
39705 if(list != null) {
39706  if(list.GetReadOnly())
39707   return false;
39708  list.OnItemClick(index);
39709 }
39710};
39711ASPx.ERBLICancel = function(name) {
39712 var list = ASPx.GetControlCollection().Get(name);
39713 if(list != null)
39714  list.OnItemClickReadonly();
39715};
39716ASPx.ShowListBoxFilter = function(name) {
39717 var list = ASPx.GetControlCollection().Get(name);
39718 if(list != null)
39719  list.ShowFilterElement();
39720};
39721ASPx.HideListBoxFilter = function(name) {
39722 var list = ASPx.GetControlCollection().Get(name);
39723 if (list != null)
39724  list.HideFilterElement();
39725};
39726ASPx.ListBoxHighlightingHelper = ASPx.CreateClass(null, {
39727 constructor: function(listBox, tagName) {
39728  this.listBox = listBox;
39729  this.tagName = tagName;
39730  this.customReplacer = "<" + tagName + ">$&</" + tagName + ">";
39731 },
39732 Apply: function(text, isCustom) {
39733  if(text == "") return;
39734  if(isCustom)
39735   this.applyCustom(text);
39736  else
39737   this.apply(text, ASPx.ContainsFilteringUtils.SelectContainsTextInElement, false);
39738 },
39739 Remove: function(text, isCustom) {
39740  if(isCustom)
39741   this.removeCustom(text);
39742  else
39743   this.apply(text, ASPx.ContainsFilteringUtils.UnselectContainsTextInElement, true);
39744 },
39745 Refresh: function(text, isCustom) {
39746  if(text == "") return;
39747  if(isCustom)
39748   this.applyCustom(text, true);
39749  else
39750   this.apply(text, ASPx.ContainsFilteringUtils.ReselectContainsTextInElement, false);
39751 },
39752 applyCustom: function(highlighting, refreshing) { 
39753  var count = this.listBox.GetItemCount();
39754  var highlightingRegExpxByColumns = this.getCustomHighlightingRegExpsByColumns(highlighting);
39755  for(var i = 0; i < count; i++) {
39756   var item = this.listBox.GetItemRow(i);
39757   if(!item || this.listBox.ItemRowHasTemplate(i)) continue;
39758   this.applyCustomCore(item, highlightingRegExpxByColumns, refreshing);
39759  }
39760 },
39761 applyCustomCore: function(item, highlightingRegExpxByColumns, refreshing) {
39762  var firstTextCellIndex = this.getFirstTextCellIndex();
39763  var elements = Array.prototype.slice.call(this.listBox.GetItemSelectableElementsByRow(item), -firstTextCellIndex);
39764  for(var i = 0, el; el = elements[i]; i++) {
39765   if(refreshing)
39766    this.removeCustomFromItem(el);
39767   this.applyCustomToItem(el, highlightingRegExpxByColumns[i]);
39768  }
39769 },
39770 applyCustomToItem: function(element, regexp) {
39771  if(!regexp)
39772   return;
39773  var currentText = ASPx.Attr.GetAttribute(element, "DXText");
39774  if(!ASPx.IsExists(currentText)) ASPx.Attr.SetAttribute(element, "DXText", ASPx.GetInnerText(element));
39775  var oldInnerText = ASPx.GetInnerText(element);
39776  var newInnerText = oldInnerText.replace(regexp, this.customReplacer);
39777  if(newInnerText !== oldInnerText)
39778   ASPx.SetInnerHtml(element, newInnerText);
39779 },
39780 removeCustomFromItem: function(element) {
39781  var currentText = ASPx.Attr.GetAttribute(element, "DXText");
39782  if(ASPx.IsExists(currentText)) {
39783   currentText = ASPx.ContainsFilteringUtils.PrepareElementText(currentText);
39784   ASPx.SetInnerHtml(element, currentText === "" ? "&nbsp;" : currentText);
39785  }
39786 },
39787 removeCustom: function() {
39788  var count = this.listBox.GetItemCount();
39789  for(var i = 0; i < count; i++) {
39790   var item = this.listBox.GetItemRow(i);
39791   if(!item || this.listBox.ItemRowHasTemplate(i)) continue;
39792   this.removeCustomCore(item);
39793  }
39794 },
39795 removeCustomCore: function(item) {
39796  var firstTextCellIndex = this.getFirstTextCellIndex();
39797  var elements = Array.prototype.slice.call(this.listBox.GetItemSelectableElementsByRow(item), -firstTextCellIndex);
39798  for(var i = 0, el; el = elements[i]; i++)
39799   this.removeCustomFromItem(el);
39800 },
39801 getCustomHighlightingRegExpsByColumns: function(highlighting) {
39802  var columns = this.listBox.IsMultiColumn() ? this.listBox.columnFieldNames : [""];
39803  return columns.map(function(fieldName) {
39804   if(typeof (highlighting) === "string" || Array.isArray(highlighting) || highlighting instanceof RegExp)
39805    return this.arrayToRegEx(highlighting);
39806   if(typeof (highlighting) === "object")
39807    return this.arrayToRegEx(highlighting[fieldName]);
39808   return null;
39809  }.bind(this));
39810 },
39811 arrayToRegEx: function(texts) {
39812  if(texts instanceof RegExp)
39813   return texts;
39814  if(typeof (texts) === "string")
39815   return this.arrayToRegEx([texts]);
39816  if(Array.isArray(texts)) {
39817   texts = texts
39818    .filter(function(t) { return typeof (t) === "string" && t.length; })
39819    .sort(function(a, b) { return b.length - a.length; })
39820    .map(ASPx.Str.EscapeForRegEx);
39821   if(texts.length)
39822    return new RegExp("(" + texts.join("|") + ")", "gi");
39823  }
39824  return null;
39825 },
39826 apply: function(text, func, allColumns) {
39827  var count = this.listBox.GetItemCount();
39828  for (var i = 0; i < count; i++) {
39829   var item = this.listBox.GetItemRow(i);
39830   if (item && (allColumns || ASPx.GetElementDisplay(item)) && this.canApply(item)) {
39831    var elements = this.listBox.GetItemSelectableElementsByRow(item);
39832    this.applyToItem(text, elements, func, allColumns);
39833   }
39834  }
39835 },
39836 applyToItem: function(text, elements, func, allColumns) {
39837  var itemValues = this.getItemValues(elements);
39838  var itemSelection = ASPx.ContainsFilteringUtils.GetColumnSelectionsForItem(itemValues, this.listBox.textFormatString, text);
39839  var firstTextCellIndex = this.getFirstTextCellIndex();
39840  if (allColumns) {
39841   for (var i = 0; i < elements.length; i++)
39842    this.applyToItemCore(func, elements[i], itemSelection[i]);
39843  } else
39844   this.applyToTextCells(func, firstTextCellIndex, elements, itemSelection);
39845 },
39846 applyToTextCells: function(func, firstTextCellIndex, elements, itemSelection) {
39847  for(var i = 0; i < itemSelection.length; i++)
39848   this.applyToItemCore(func, elements[itemSelection[i].index + firstTextCellIndex], itemSelection[i]);
39849 },
39850 applyToItemCore: function (func, itemElement, itemSelection) {
39851  if (!this.listBox.ItemCellHasTextAttr(itemElement))
39852   func(itemElement, itemSelection, this.tagName);
39853 },
39854 getItemValues: function (elements) {
39855  var result = [];
39856  for (var i = this.getFirstTextCellIndex() ; i < elements.length; i++)
39857   result.push(ASPxClientListBox.GetItemCellInnerText(elements[i]));
39858  return result;
39859 },
39860 canApply: function (item) {
39861  return !this.listBox.ItemRowHasTemplateCore(item);
39862 },
39863 getFirstTextCellIndex: function () {
39864  return this.listBox.GetItemFirstTextCellIndex();
39865 }
39866});
39867var ListEditFilterStrategyBase = ASPx.CreateClass(null, {
39868 OnPaste: function(evt) { },
39869 OnInput: function() { },
39870 OnClearButtonClick: function() { },
39871 OnTextChanged: function() { },
39872 OnEscape: function() { },
39873 OnKeyDown: function(evt) { },
39874 OnAfterEnter: function() { },
39875 OnSelectedIndexChanged: function() { },
39876 OnLostFocus: function() { },
39877 OnCallback: function(result) { },
39878 OnBeforeDoEndCallback: function() { },
39879 OnAfterDoEndCallback: function() { },
39880 OnBeforeCallbackFinally: function() { },
39881 OnAfterCallbackFinally: function() { },
39882 OnPerformCallback: function() { },
39883 Filtering: function() { },
39884 CancelFiltering: function() { },
39885 ShouldDiscardCallbackResult: function() { },
39886 GetCallbackArguments: function() { return ""; },
39887 CanNavigateByKbd: function() { return true; },
39888 IsFilterMeetRequirementForMinLength: function (filter) { return true; },
39889 ResetCallbackState: function() { },
39890 OnDropDownHideArea: function() { },
39891 OnDropDownButtonClick: function() { },
39892 OnDropDownCloseByDocumentOrWindowEvent: function() { },
39893 OnApplyChanges: function() { },
39894 OnCancelChanges: function() { },
39895 OnUndo: function() { }
39896});
39897var ListEditIncrementalFilterStrategyBase = ASPx.CreateClass(ListEditFilterStrategyBase, {
39898 constructor: function(filterDelay, filterMinLength, isCallbackMode) {
39899  this.filterTimeoutId = -1;
39900  this.filterDelay = filterDelay;
39901  this.filterMinLength = filterMinLength;
39902  this.isCallbackMode = isCallbackMode;
39903  this.filter = "";
39904  this.highlighting = "";
39905  this.filterInitialized = false;
39906  this.needEmptyFilterBeforeFiltering = false;
39907  this.currentCallbackIsFiltration = false;
39908  this.refiltrationRequired = false;
39909 },
39910 GetInputFilterValue: function() { throw "Not Implemented"; },
39911 GetListBoxControl: function() { throw "Not Implemented"; },
39912 IsSatisfy: function(text, filter) { throw "Not Implemented"; },
39913 InCallback: function() { throw "Not Implemented"; },
39914 IsEnabled: function() { throw "Not Implemented"; },
39915 SendCallbackCore: function() { throw "Not Implemented"; },
39916 PreventEndCallbackRising: function() { throw "Not Implemented"; },
39917 GetSelectedIndex: function() { throw "Not Implemented"; },
39918 NotifyCollectionChanged: function() { throw "Not Implemented"; },
39919 OnCallbackCore: function(highlighting, newFilterLength) { throw "Not Implemented"; },
39920 RaiseItemFilteringEvent: function(item, filter, isFit) { throw "Not Implemented"; },
39921 RaiseCustomHighlightingEvent: function(filter, highlighting) { throw "Not Implemented"; },
39922 OnBeforeFilteringOnClient: function(filter) { }, 
39923 OnAfterFilteringOnClientCore: function (filter, firstSatisfyItemIndex) { throw "Not Implemented"; },
39924 SupportsFilterCorrection: function() { throw "Not Implemented"; },
39925 OnFirstSatisfiedItemFound: function(index, text, isTextClearing) { },
39926 TryProcessFilterLessMinLength: function() { return true; },
39927 AllowEmptyFilterResults: function() { return true; },
39928 OnBeforeFiltering: function() { },
39929 OnAfterFiltering: function() { },
39930 OnFilteringCancelled: function() { },
39931 OnTextChanged: function() { },
39932 OnFilterRollback: function() { },
39933 CanStartFilterOnInput: function() {
39934  return this.IsEnabled() && !this.InCallback();
39935 },
39936 OnAfterFilteringOnClient: function (filter, satisfyItemIndices) {
39937  this.GetListBoxControl().RewriteFilteredItemIndices(satisfyItemIndices);
39938  var firstSatisfyItemIndex = satisfyItemIndices.length > 0 ? satisfyItemIndices[0] : -1;
39939  this.OnAfterFilteringOnClientCore(filter, firstSatisfyItemIndex);
39940 },
39941 ShouldClearFilterBeforeFiltering: function(filter) { return false; },
39942 OnInput: function() {
39943  if(this.CanStartFilterOnInput()) {
39944   this.FilterStopTimer();
39945   this.FilterStartTimer();
39946  }
39947 },
39948 OnCallback: function(result) {
39949  this.OnCallbackCore(result[CONSTANTS.CALLBACK_RESULTS.FILTER_CUSTOMHIGHLIGHTING], result[CONSTANTS.CALLBACK_RESULTS.FILTER_LENGTH]);
39950  this.currentCallbackIsFiltration = false;
39951 },
39952 CancelFiltering: function() {
39953  this.FilterStopTimer();
39954 },
39955 Filtering: function(fromApi) {
39956  this.FilterStopTimer();
39957  var inputValue = this.GetInputFilterValue();
39958  this.needEmptyFilterBeforeFiltering = this.ShouldClearFilterBeforeFiltering(inputValue);
39959  var newFilter = this.needEmptyFilterBeforeFiltering ? "" : inputValue;
39960  var oldFilter = this.filter;
39961  if(!this.FilterCompare(newFilter)) {
39962   this.SetFilter(newFilter);
39963   if(!this.IsFilterMeetRequirementForMinLength() && this.TryProcessFilterLessMinLength(oldFilter))
39964    return;
39965   else {
39966    this.OnBeforeFiltering();
39967    if(this.isCallbackMode)
39968     this.FilteringOnServer();
39969    else
39970     this.FilteringOnClient();
39971    this.OnAfterFiltering();
39972   }
39973  }
39974  else
39975   this.OnFilteringCancelled(fromApi);
39976 },
39977 FilteringOnClient: function() {
39978  var listBox = this.GetListBoxControl(),
39979   count = listBox.GetItemCount(),
39980   filter = this.filter,
39981   listTable = listBox.GetListTable(),
39982   visibleItems = [],
39983   visibleItemFound = false;
39984  this.DiscardHighlighting();
39985  if(ASPx.Browser.IE && ASPx.Browser.Version > 9) 
39986   ASPx.SetElementDisplay(listTable, false);
39987  while(true) {
39988   var preparedFilter = ASPx.Str.PrepareStringForFilter(filter);
39989   listBox.BeforeClientFiltering();
39990   for(var i = 0; i < count; i++) {
39991    var item = listBox.GetItem(i);
39992    var isFit = this.IsSatisfy(item.text, preparedFilter);
39993    isFit = this.RaiseItemFilteringEvent(item, filter, isFit);
39994    if(isFit) {
39995     if(!visibleItemFound) {
39996      this.OnBeforeFilteringOnClient(filter);
39997      for(var j = 0; j < i; j++)
39998       listBox.ApplyFilterToItem(j, false);
39999      var isTextClearing = filter == "" && this.filter != item.text;
40000      this.OnFirstSatisfiedItemFound(i, item.text, isTextClearing);
40001      visibleItemFound = true;
40002     }
40003     visibleItems.push(i);
40004    }
40005    if(visibleItemFound)
40006     listBox.ApplyFilterToItem(i, isFit);
40007   }
40008   if(visibleItemFound || this.AllowEmptyFilterResults() || !filter)
40009    break;
40010   filter = filter.substr(0, filter.length - 1);
40011  }
40012  if(!visibleItemFound) {
40013   this.OnBeforeFilteringOnClient(filter); 
40014   if(this.AllowEmptyFilterResults()) {
40015    for(var i = 0; i < count; i++)
40016     listBox.ApplyFilterToItem(i, false);
40017   }
40018  }
40019  if(ASPx.Browser.IE && ASPx.Browser.Version > 9) 
40020   ASPx.SetElementDisplay(listTable, true);
40021  this.OnAfterFilteringOnClient(filter, visibleItems);
40022  this.SetHighlighting(filter);
40023  this.OnEndFiltering(visibleItemFound || this.AllowEmptyFilterResults());
40024 },
40025 FilteringOnServer: function() {
40026  if(!this.InCallback()) {
40027   var listBox = this.GetListBoxControl();
40028   listBox.ClearItems(); 
40029   listBox.serverIndexOfFirstItem = 0;
40030   listBox.SetScrollSpacerVisibility(true, false);
40031   listBox.SetScrollSpacerVisibility(false, false);
40032  }
40033  this.SendFilteringCallback();
40034 },
40035 SendFilteringCallback: function(owner) {
40036  this.currentCallbackIsFiltration = true;
40037  this.SendCallbackCore();
40038 },
40039 OnEndFiltering: function(visibleCollectionChanged) {
40040  if(visibleCollectionChanged)
40041   this.NotifyCollectionChanged();
40042  this.ApplyHighlighting();
40043 },
40044 IsFilterTimerActive: function() {
40045  return this.filterTimeoutId !== -1;
40046 },
40047 FilterStopTimer: function() {
40048  if(this.IsFilterTimerActive()) {
40049   clearTimeout(this.filterTimeoutId);
40050   this.filterTimeoutId = -1;
40051  }
40052 },
40053 FilterStartTimer: function() {
40054  this.filterTimeoutId = setTimeout(function() {
40055   this.filterTimeoutId = -1;
40056   this.Filtering();
40057  }.bind(this), this.filterDelay);
40058 },
40059 IsFilterMeetRequirementForMinLength: function(filter) {
40060  if(typeof (filter) !== "string")
40061   filter = this.GetInputFilterValue();
40062  return typeof (filter) === "string" ? filter.length >= this.filterMinLength : true;
40063 },
40064 GetCallbackArguments: function() {
40065  if(this.filter) {
40066   var callbackPrefix = this.SupportsFilterCorrection() ? CONSTANTS.CALLBACK_PREFIXES.FILTERING_CORRECT : CONSTANTS.CALLBACK_PREFIXES.FILTERING;
40067   return ASPx.FilteringUtils.FormatCallbackArg(callbackPrefix, this.filter);
40068  }
40069  return "";
40070 },
40071 OnAfterDoEndCallback: function() {
40072  if(this.refiltrationRequired) {
40073   this.refiltrationRequired = false;
40074   window.setTimeout(this.Filtering.bind(this), 0);
40075  }
40076 },
40077 OnBeforeDoEndCallback: function() {
40078  if(this.refiltrationRequired)
40079   this.PreventEndCallbackRising();
40080 },
40081 OnSelectedIndexChanged: function() {
40082  this.ClearFilterApplied();
40083 },
40084 SetHighlighting: function(filter, callbackHighlighting) {
40085  callbackHighlighting = this.ProcessCallbackHighlighting(callbackHighlighting);
40086  var customHighlighting = this.RaiseCustomHighlightingEvent(filter, callbackHighlighting);
40087  this.isCustomHighlighting = customHighlighting !== null && customHighlighting !== undefined;
40088  this.highlighting = this.isCustomHighlighting ? customHighlighting : filter;
40089 },
40090 ProcessCallbackHighlighting: function(obj) {
40091  if(obj === undefined || obj === null)
40092   return undefined;
40093  var val = obj.val;
40094  var regEx = !!obj.regEx;
40095  if(regEx) {
40096   if(typeof (val) === "string")
40097    val = new RegExp(val, "gi");
40098   if(!Array.isArray(val) && typeof (val) === "object") {
40099    for(var col in val) {
40100     if(!val.hasOwnProperty(col)) continue;
40101     if(typeof (val[col]) === "string")
40102      val[col] = new RegExp(val[col], "gi");
40103    }
40104   }
40105  }
40106  return val;
40107 },
40108 IsEmptyFilter: function() {
40109  return !this.filterInitialized || this.filter === "";
40110 },
40111 ShouldDiscardCallbackResult: function() {
40112  var discardCallbackResult = !this.needEmptyFilterBeforeFiltering && !this.IsFilterEqualInputValue() && this.currentCallbackIsFiltration;
40113  if(discardCallbackResult)
40114   this.refiltrationRequired = true;
40115  return discardCallbackResult;
40116 },
40117 IsFilterEqualInputValue: function() {
40118  var currentFilter = this.GetInputFilterValue();
40119  return this.FilterCompareLower(ASPx.Str.PrepareStringForFilter(currentFilter));
40120 },
40121 FilterCompare: function(value) {
40122  return this.filterInitialized && this.filter === value;
40123 },
40124 FilterCompareLower: function(value) {
40125  if(!this.filterInitialized)
40126   return false;
40127  return ASPx.Str.PrepareStringForFilter(this.filter) == value;
40128 },
40129 DiscardHighlighting: function() {
40130  this.GetListBoxControl().highlighting.Remove(this.highlighting, this.isCustomHighlighting);
40131 },
40132 ApplyHighlighting: function() {
40133  this.GetListBoxControl().highlighting.Apply(this.highlighting, this.isCustomHighlighting);
40134 },
40135 RefreshHighlighting: function() {
40136  this.GetListBoxControl().highlighting.Refresh(this.highlighting, this.isCustomHighlighting);
40137 },
40138 MakeAllItemsVisible: function() {
40139  this.GetListBoxControl().MakeAllItemsVisible();
40140 },
40141 SetFilter: function(newFilter) {
40142  this.filter = newFilter;
40143  this.highlighting = "";
40144  this.isCustomHighlighting = undefined;
40145  this.filterInitialized = true;
40146 },
40147 ClearFilter: function() {
40148  this.filter = "";
40149  this.highlighting = "";
40150  this.isCustomHighlighting = undefined;
40151  this.filterInitialized = false;
40152 },
40153 ClearFilterApplied: function() {
40154  this.filterInitialized = false;
40155 },
40156 FilteringBackspace: function() {
40157  throw "Not Implemented";
40158 },
40159});
40160var ListBoxFilterStrategy = ASPx.CreateClass(ListEditIncrementalFilterStrategyBase, {
40161 constructor: function(listBox) {
40162  this.constructor.prototype.constructor.call(this, listBox.filteringDelay, listBox.filterMinLength, listBox.isCallbackMode);
40163  this.listBox = listBox;
40164 },
40165 SupportsFilterCorrection: function() {
40166  return false;
40167 },
40168 IsEnabled: function() {
40169  return this.listBox.GetEnabled();
40170 },
40171 GetInputFilterValue: function() {
40172  return this.listBox.filteringTextBox.GetInputElement().value;
40173 },
40174 NotifyCollectionChanged: function() {
40175  this.listBox.CollectionChanged(true);
40176 },
40177 TryProcessFilterLessMinLength: function(oldFilter) {
40178  this.SetFilter("");
40179  return !oldFilter;
40180 },
40181 IsSatisfy: function(text, filter) {
40182  return ASPx.Str.PrepareStringForFilter(text).indexOf(filter) !== -1;
40183 },
40184 GetListBoxControl: function() {
40185  return this.listBox;
40186 },
40187 OnAfterFilteringOnClientCore: function (filter, firstSatisfyItemIndex) {
40188  if(firstSatisfyItemIndex !== -1)
40189   this.listBox.CorrectCellWidthsOnFirstRowItemReplacement(0, firstSatisfyItemIndex);
40190 },
40191 OnEndFiltering: function(visibleCollectionChanged) {
40192  ListEditIncrementalFilterStrategyBase.prototype.OnEndFiltering.call(this, visibleCollectionChanged);
40193  if(this.listBox.IsMultiColumn())
40194   this.listBox.CorrectWidth();
40195  this.listBox.updateSelectAllElementsState();
40196 },
40197 SendCallbackCore: function() {
40198  this.listBox.SendCallback();
40199 },
40200 InCallback: function() {
40201  return this.listBox.InCallback();
40202 },
40203 PreventEndCallbackRising: function() {
40204  this.listBox.preventEndCallbackRising = true;
40205 },
40206 GetSelectedIndex: function() {
40207  return this.listBox.GetSelectedIndex();
40208 },
40209 OnCallbackCore: function(highlighting, newFilterLength) {
40210  if(this.currentCallbackIsFiltration)
40211   this.SetHighlighting(this.filter, highlighting);
40212  if(this.filter)
40213   this.OnEndFiltering();
40214 },
40215 FilteringBackspace: function() {
40216  var textBox = this.listBox.filteringTextBox;
40217  if(textBox)
40218   ASPx.StartWithFilteringUtils.RollbackOneSuggestedChar(textBox.GetInputElement());
40219  this.FilterStartTimer();
40220 },
40221 RaiseItemFilteringEvent: function(item, filter, isFit) {
40222  return this.listBox.RaiseItemFiltering(item, filter, isFit);
40223 },
40224 RaiseCustomHighlightingEvent: function(filter, callbackHighlighting) {
40225  return this.listBox.RaiseCustomHighlighting(filter, callbackHighlighting);
40226 }
40227});
40228ASPx.ListBoxItemsDefaultManager = ListBoxItemsDefaultManager;
40229ASPx.ListBoxItemsVirtualManager = ListBoxItemsVirtualManager;
40230ASPx.ListEditIncrementalFilterStrategyBase = ListEditIncrementalFilterStrategyBase;
40231ASPx.ListBoxFilterStrategy = ListBoxFilterStrategy;
40232ASPx.ListEditFilterStrategyBase = ListEditFilterStrategyBase;
40233var ASPxClientListEditItemFilteringEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
40234 constructor: function(item, filter, isFit) {
40235  this.constructor.prototype.constructor.call(this);
40236  this.item = item;
40237  this.isFit = isFit;
40238  this.filter = filter;
40239 }
40240});
40241var ASPxClientListEditCustomHighlightingEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
40242 constructor: function(filter) {
40243  this.constructor.prototype.constructor.call(this);
40244  this.highlighting = null;
40245  this.filter = filter;
40246 }
40247});
40248window.ASPxClientListEdit = ASPxClientListEdit;
40249window.ASPxClientListEdit.CONSTANTS = CONSTANTS;
40250window.ASPxClientListEditItem = ASPxClientListEditItem;
40251window.ASPxClientListBoxItem = ASPxClientListBoxItem;
40252window.ASPxClientListBoxBase = ASPxClientListBoxBase;
40253window.ASPxClientListBox = ASPxClientListBox;
40254window.ASPxClientNativeListBox = ASPxClientNativeListBox;
40255window.ASPxClientCheckListBase = ASPxClientCheckListBase;
40256window.ASPxClientRadioButtonList = ASPxClientRadioButtonList;
40257window.ASPxClientCheckBoxList = ASPxClientCheckBoxList;
40258window.ASPxClientListEditItemSelectedChangedEventArgs = ASPxClientListEditItemSelectedChangedEventArgs;
40259window.ASPxClientListEditItemFilteringEventArgs = ASPxClientListEditItemFilteringEventArgs;
40260window.ASPxClientListEditCustomHighlightingEventArgs = ASPxClientListEditCustomHighlightingEventArgs;
40261})();
40262
40263(function() {
40264var currentSelectedItemCallbackPrefix = "CBSI";
40265var loadDropDownOnDemandCallbackPrefix = "CBLD";
40266var listBoxNameSuffix = "_L";
40267var comboBoxValueInputSuffix = "VI";
40268var ASPxClientComboBoxBase = ASPx.CreateClass(ASPxClientDropDownEditBase, {
40269 constructor: function(name) {
40270  this.constructor.prototype.constructor.call(this, name);
40271  this.lbEventLockCount = 0;
40272  this.receiveGlobalMouseWheel = false;
40273  this.collectCallbackIDs = false;
40274  this.callbackIDs = { };
40275  this.callbackIDsToReset = { };
40276  this.accessibilityHelper = null;
40277  this.listBox = null;
40278  this.lastSuccessValue = "";
40279  this.islastSuccessValueInit = false;
40280  this.SelectedIndexChanged = new ASPxClientEvent();
40281 },
40282 Initialize: function(){
40283  this.InitializeListBoxOwnerName();
40284  ASPxClientDropDownEditBase.prototype.Initialize.call(this);
40285  this.InitLastSuccessValue();
40286 },
40287 InitializeListBoxOwnerName: function(){
40288  var lb = this.GetListBoxControl();
40289  if(lb)
40290   lb.ownerName = this.name;
40291 },
40292 InitLastSuccessValue: function(){
40293  this.SetLastSuccessValue(this.GetValue());
40294 },
40295 SetLastSuccessValue: function (value) {
40296  if(this.convertEmptyStringToNull && value === "")
40297   value = null;
40298  this.lastSuccessValue = value;
40299  this.islastSuccessValueInit = true;
40300 },
40301 GetDropDownInnerControlName: function(suffix){
40302  return "";
40303 },
40304 GetAccessibilityHelper: function() {
40305  if(!this.accessibilityCompliant)
40306   return null;
40307  if(!this.accessibilityHelper)
40308   this.accessibilityHelper = new AccessibilityHelperComboBox(this);
40309  return this.accessibilityHelper;
40310 },
40311 GetListBoxControl: function(){
40312  if(!ASPx.IsExists(this.listBox)){
40313   var name = this.GetDropDownInnerControlName(listBoxNameSuffix);
40314   this.listBox = ASPx.GetControlCollection().Get(name);
40315  }
40316  if(this.isNative || (this.listBox && !!this.listBox.GetMainElement()))
40317   return this.listBox;
40318  return null;
40319 },
40320 GetCallbackArguments: function(){
40321  return this.GetListBoxCallbackArguments();
40322 },
40323 GetListBoxCallbackArguments: function(){
40324  var lb = this.GetListBoxControl();
40325  return lb.GetCallbackArguments();
40326 },
40327 SendCallback: function(onSuccess) {
40328  var callbackID = this.CreateCallback(this.GetCallbackArguments(), null, onSuccess);
40329  this.OnCreateCallback(callbackID);
40330 },
40331 SendSpecialCallback: function(args, handler) {
40332  var callbackID = this.CreateCallback(args, null, handler);
40333  this.OnCreateCallback(callbackID);
40334 },
40335 OnCreateCallback: function(callbackID) {
40336  if(this.collectCallbackIDs)
40337   this.callbackIDs[callbackID] = true;
40338  this.UnlockDoEndCallback();
40339 },
40340 CanProcessCallbackResult: function(callbackID) {
40341  var result = !this.collectCallbackIDs || !this.callbackIDsToReset[callbackID];
40342  delete this.callbackIDs[callbackID];
40343  delete this.callbackIDsToReset[callbackID];
40344  if(!result)
40345   this.LockDoEndCallback();
40346  return result;
40347 },
40348 LockDoEndCallback: function() {
40349  this.lockDoEndCallback = true;
40350  this.lockDoEndCallbackTimerId =  window.setTimeout(function() { this.lockDoEndCallback = false; }.bind(this), 200);
40351 },
40352 UnlockDoEndCallback: function() {
40353  this.lockDoEndCallback = false;
40354  ASPx.Timer.ClearTimer(this.lockDoEndCallbackTimerId);
40355 },
40356 IsDoEndCallbackLocked: function() { 
40357  return !!this.lockDoEndCallback; 
40358 },
40359 ResetWaitingCallbacks: function() {
40360  var ids = Object.keys(this.callbackIDs);
40361  if(ids.length === 0) return;
40362  ids.forEach(function(id) { this.callbackIDsToReset[id] = true; }.bind(this));
40363  this.callbackIDs = { };
40364  this.requestCount = 0;
40365  ASPx.GetControlCollection().ResetRequestCount(); 
40366  this.CancelCallbackInternal();
40367 },
40368 SetReadOnlyInternal: function(readOnly) {
40369  ASPxClientDropDownEditBase.prototype.SetReadOnlyInternal.call(this, readOnly);
40370  var lb = this.GetListBoxControl();
40371  if(lb)
40372   lb.SetReadOnly(readOnly);
40373 },
40374 SetText: function(text){
40375  var lb = this.GetListBoxControl();
40376  var index = this.GetAdjustedSelectedIndexByText(lb, text);
40377  var isAllowNullValue = !this.isDropDownListStyle || this.allowNull;
40378  var isChangingTextInEmpty = index < 0 && !text && this.lastSuccessText !== text;
40379  if(isAllowNullValue || !isChangingTextInEmpty) {
40380   this.SelectIndex(index, false);
40381   this.SetTextBase(text);
40382   this.SetLastSuccessText(text);
40383   this.SetLastSuccessValue(index >= 0 ? lb.GetValue() : text);
40384  }
40385 },
40386 GetValue: function(){
40387  var value = this.islastSuccessValueInit ? this.lastSuccessValue : this.GetValueInternal();
40388  if(this.convertEmptyStringToNull && value === "")
40389   value = null;
40390  return value;
40391 },
40392 GetValueInternal: function(){
40393  var text = this.GetTextInternal();
40394  var textChanges = text != this.lastSuccessText;
40395  if(textChanges){
40396   var lb = this.GetListBoxControl();
40397   if(lb){
40398    var index = this.GetAdjustedSelectedIndexByText(lb, text);
40399    this.SelectIndexSilent(lb, index); 
40400    if(index != -1)
40401     return lb.GetValue();
40402   }
40403  }
40404  return ASPxClientDropDownEditBase.prototype.GetValue.call(this);
40405 },
40406 GetLastSuccesfullValue: function() {
40407  return this.GetValue();
40408 },
40409 GetSetValueOptimizeHelper: function () {
40410  this.setValueOptimizeHelper = this.setValueOptimizeHelper || new setValueOptimizeHelper();
40411  return this.setValueOptimizeHelper;
40412 },
40413 SetValue: function (value) {
40414  this.GetSetValueOptimizeHelper().setValue(this, value);
40415  if(this.accessibilityCompliant)
40416   this.GetAccessibilityHelper().SetLabelAttribute(null, null);
40417 },
40418 SetValueInternal: function(value) {
40419  var lb = this.GetListBoxControl();
40420  if (lb) {
40421   lb.SetValue(value);
40422   var item = lb.GetSelectedItem();
40423   var text = item ? item.text : value;
40424   this.OnSelectionChangedCore(text, item, false);
40425   this.UpdateValueInput();
40426  }
40427 },
40428 Clear: function() {
40429  ASPxClientDropDownEditBase.prototype.Clear.call(this);
40430  if(!this.GetListBoxControl())
40431   this.islastSuccessValueInit = false;
40432 },
40433 GetFormattedText: function() {
40434  return this.GetText();
40435 },
40436 GetAdjustedSelectedIndexByText: function(lb, text){
40437  if(!lb)
40438   return -1;
40439  var lbSelectedItem = lb.GetSelectedItem();
40440  if(lbSelectedItem != null && (lbSelectedItem.text == text || !this.isInitialized))
40441   return lbSelectedItem.index;
40442  return this.FindItemIndexByText(lb, text);
40443 },
40444 FindItemIndexByText: function(lb, text){
40445  if(lb)
40446   return lb.FindItemIndexByText(text);
40447 },
40448 CollectionChanged: function(){
40449 },
40450 HasChanges: function(){
40451  return false;
40452 },
40453 SelectIndex: function(index, initialize){
40454  var lb = this.GetListBoxControl();
40455  if(!lb)
40456   return false;
40457  var isSelectionChanged = lb.SelectIndexSilentAndMakeVisible(index, initialize);
40458  var item = lb.GetSelectedItem();
40459  var text = item != null ? item.text : "";
40460  if(isSelectionChanged || this.HasChanges())
40461   this.OnSelectionChangedCore(text, item, false);
40462  this.UpdateValueInput();
40463  return isSelectionChanged;
40464 },
40465 OnSelectChanged: function(){
40466  if(this.lbEventLockCount > 0) return;
40467  var lb = this.GetListBoxControl();
40468  var item = lb.GetSelectedItem();
40469  var text = item != null ? item.text : "";
40470  this.OnSelectionChangedCore(text, item, false);
40471  this.OnChange();
40472 },
40473 OnSelectionChangedCore: function(text, item, canBeRolledBack){
40474  this.SetTextBase(text);
40475  this.ShowItemImage(item);
40476  if(!canBeRolledBack){
40477   this.SetLastSuccessText(text);
40478   this.SetLastSuccessValue(item != null ? item.value : text);
40479  }
40480  if(this.filterStrategy) {
40481   if(ASPx.Browser.IE) { 
40482    var inputElement = this.GetInputElement();
40483    if(ASPx.GetActiveElement() == inputElement)
40484     ASPx.Selection.Set(inputElement, inputElement.value.length, inputElement.value.length);
40485   }
40486  }
40487 },
40488 ShowItemImageByIndex: function(index){
40489  var item = this.GetItem(index);
40490  this.ShowItemImage(item);
40491 },
40492 ShowCurrentItemImage: function() {
40493  var selectedItem = this.GetSelectedItem();
40494  this.ShowItemImage(selectedItem);
40495 },
40496 ShowItemImage: function(item){
40497  var imageUrl = item != null ? item.imageUrl : "";
40498  this.SetSelectedImage(imageUrl);
40499 },
40500 GetDropDownImageElement: function(){
40501  var itemImageCell = this.GetDropDownItemImageCell();
40502  if(itemImageCell != null)
40503   return ASPx.GetNodeByTagName(itemImageCell, "IMG", 0);
40504  return null;
40505 },
40506 SetSelectedImage: function(imageUrl) {
40507  var imgElement = this.GetDropDownImageElement();
40508  if(imgElement != null) {
40509   var imageExists = imageUrl != "";
40510   imageUrl = imageExists ? imageUrl : ASPx.EmptyImageUrl;
40511   imgElement.src = imageUrl;
40512   var itemImageCell = this.GetDropDownItemImageCell();
40513   if(ASPx.GetElementDisplay(itemImageCell) != imageExists)
40514    ASPx.SetElementDisplay(itemImageCell, imageExists);
40515   if(ASPx.Browser.IE) {
40516    this.AdjustControl();
40517   }
40518  }
40519 },
40520 OnCallback: function(result) {
40521 },
40522 OnChange: function(){
40523  this.UpdateValueInput();
40524  this.RaisePersonalStandardValidation();
40525  this.OnValueChanged();
40526 },
40527 UpdateValueInput: function() {
40528 },
40529 RaiseValueChangedEvent: function() {
40530  if(!this.isInitialized) return;
40531  var processOnServer = ASPxClientTextEdit.prototype.RaiseValueChangedEvent.call(this);
40532  processOnServer = this.RaiseSelectedIndexChanged(processOnServer);
40533  return processOnServer;
40534 },
40535 RaiseSelectedIndexChanged: function(processOnServer) {
40536  if(!this.SelectedIndexChanged.IsEmpty()){
40537   var args = new ASPxClientProcessingModeEventArgs(processOnServer);
40538   this.SelectedIndexChanged.FireEvent(this, args);
40539   processOnServer = args.processOnServer;
40540  }
40541  return processOnServer;
40542 },
40543 GetItemHtmlContent: function(index) {
40544  var lb = this.GetListBoxControl();
40545  return lb && lb.GetItemHtmlContent(index);
40546 },
40547 AddItem: function(texts, value, imageUrl, htmlContent, cssClass, tooltip) {
40548  var index = this.GetListBoxControl().AddItem(texts, value, imageUrl, htmlContent, cssClass, tooltip);
40549  this.CollectionChanged();
40550  return index;
40551 },
40552 InsertItem: function(index, texts, value, imageUrl, htmlContent, cssClass, tooltip){
40553  this.GetListBoxControl().InsertItem(index, texts, value, imageUrl, htmlContent, cssClass, tooltip);
40554  this.CollectionChanged();
40555 },
40556 RemoveItem: function(index){
40557  this.GetListBoxControl().RemoveItem(index);
40558  this.CollectionChanged();
40559 },
40560 ClearItems: function(){
40561  this.GetListBoxControl().ClearItems();
40562  this.ClearItemsInternal();
40563 },
40564 BeginUpdate: function(){
40565   this.GetListBoxControl().BeginUpdate();
40566 },
40567 EndUpdate: function(){
40568  this.GetListBoxControl().EndUpdate();
40569  this.CollectionChanged();
40570 },
40571 MakeItemVisible: function(index){
40572 },
40573 GetItem: function(index){
40574  var lb = this.GetListBoxControl();
40575  if(lb)
40576   return this.GetItemCore(index);
40577  else
40578   return null;
40579 },
40580 GetItemCore: function(index) {
40581  return this.GetListBoxControl().GetItem(index);
40582 },
40583 FindItemByText: function(text) {
40584  var lb = this.GetListBoxControl();
40585  if(lb)
40586   return lb.FindItemByText(text);
40587  return null;
40588 },
40589 FindItemByValue: function(value){
40590  var lb = this.GetListBoxControl();
40591  if(lb)
40592   return lb.FindItemByValue(value);
40593  return null;
40594 },
40595 GetItemCount: function(){
40596  var lb = this.GetListBoxControl();
40597  if(lb)
40598   return lb.GetItemCount(); 
40599  return 0;
40600 },
40601 GetSelectedIndex: function(){
40602  var lb = this.GetListBoxControl();
40603  if(lb)
40604   return lb.GetSelectedIndex();
40605  else
40606   return -1;
40607 },
40608 SetSelectedIndex: function(index){
40609  this.SelectIndex(index, false);
40610 },
40611 GetSelectedItem: function(){
40612  var lb = this.GetListBoxControl();
40613  var index = lb.GetSelectedIndex();
40614  return lb.GetItem(index);
40615 },
40616 SetSelectedItem: function(item){
40617  var index = (item != null) ? item.index : -1;
40618  this.SelectIndex(index, false);
40619 },
40620 GetText: function(){
40621  return this.lastSuccessText;
40622 },
40623 PerformCallback: function(arg) {
40624 },
40625 ClearItemsInternal: function(){
40626  this.SetValue(null);
40627  this.CollectionChanged();
40628 },
40629 GetModifyEvent: function() {
40630  if(this.isNative)
40631   return this.SelectedIndexChanged;
40632  else
40633   return ASPxClientDropDownEditBase.prototype.GetModifyEvent.call(this);
40634 }
40635});
40636var ASPxClientComboBox = ASPx.CreateClass(ASPxClientComboBoxBase, {
40637 constructor: function(name) {
40638  this.constructor.prototype.constructor.call(this, name);
40639  this.allowMultipleCallbacks = false;
40640  this.allowNull = false;
40641  this.isCallbackMode = false;
40642  this.loadDropDownOnDemand = false;
40643  this.needToLoadDropDown = false;
40644  this.isPerformCallback = false;
40645  this.changeSelectAfterCallback = 0;
40646  this.incrementalFilteringMode = "Contains";
40647  this.filterStrategy = null;
40648  this.filterTimer = ASPx.Browser.WebKitTouchUI ? 300 : 100; 
40649  this.filterMinLength = 0;
40650  this.customFiltering = false;
40651  this.initTextCorrectionRequired = false;
40652  this.isDropDownListStyle = true;
40653  this.defaultDropDownHeight = "";
40654  this.dropDownHeight = "";
40655  this.dropDownWidth = "";
40656  this.dropDownRows = 7;
40657  this.enterKeyPressed = false;
40658  this.onLoadDropDownOnDemandCallbackFinalizedEventHandler = null;
40659  this.callBackCoreComplete = false; 
40660  this.adroidSamsungBugTimeout = 0; 
40661  this.isNeedToForceFirstShowLoadingPanel = true; 
40662  this.forceLoadCustomRangeOnDropDown = false;
40663  this.needToInitPopupWindowOnShow = false;
40664  this.ItemFiltering = new ASPxClientEvent();
40665  this.CustomHighlighting = new ASPxClientEvent();
40666 },
40667 Initialize: function(){
40668  this.needToLoadDropDown = this.loadDropDownOnDemand;
40669  var lb = this.GetListBoxControl();
40670  this.InitializeListBoxOwnerName();
40671  this.InitScrollSpacerVisibility();
40672  this.InitializeFilterStrategy();
40673  var mainElement = this.GetMainElement();
40674  var input = this.GetInputElement();    
40675  var ddbutton = this.GetDropDownButton();
40676  ASPx.Evt.AttachEventToElement(input, "paste", this.SyncRawValueIfHasTextDecorators.bind(this, true));
40677  if(this.isDropDownListStyle && (ASPx.Browser.IE || (ASPx.Browser.WindowsPlatform && ASPx.Browser.Safari))) {
40678   ASPx.Evt.AttachEventToElement(this.GetInputElement(), "blur", function() {
40679    var inputElementValue = this.GetInputElement().value;
40680    if(!this.focusEventsLocked && !inputElementValue && !!this.GetText())
40681     this.OnTextChanged();
40682   }.aspxBind(this)); 
40683   if(ASPx.Browser.IE) {
40684    ASPx.Evt.PreventElementDragAndSelect(mainElement, true, true);
40685    ASPx.Evt.PreventElementDragAndSelect(input, true, true);
40686    if(ddbutton)
40687     ASPx.Evt.PreventElementDragAndSelect(ddbutton, true);
40688   }
40689  }
40690  if(this.isToolbarItem){
40691   if(ASPx.Browser.IE && ASPx.Browser.Version == 9)
40692    input.onmousedown = function(evt) { ASPx.Evt.PreventEvent(evt); };
40693   else {
40694    mainElement.unselectable="on";
40695    input.unselectable="on";
40696    if(input.offsetParent)
40697     input.offsetParent.unselectable="on";
40698    if(ddbutton)
40699     ddbutton.unselectable="on";
40700    if(lb)
40701     lb.SetItemRowsUnselectable();
40702   }
40703  }
40704  this.RemoveRaisePSValidationFromListBox();
40705  this.RedirectStandardValidators();
40706  if(lb && lb.GetItemCount() > 0)
40707   this.EnsureListBoxSelectionSynchronized(lb);
40708  ASPxClientComboBoxBase.prototype.Initialize.call(this);
40709 },
40710 InitScrollSpacerVisibility: function() {
40711  var lb = this.GetListBoxControl();
40712  if(!lb || lb.GetItemCount() >= lb.callbackPageSize)
40713   return;
40714  lb.SetScrollSpacerVisibility(true, false);
40715  lb.SetScrollSpacerVisibility(false, false);
40716 },
40717 InitializeFilterStrategy: function() {
40718  var fs = this.filterStrategy;
40719  ASPx.Evt.AttachEventToElement(this.GetInputElement(), "keydown", fs.OnKeyDown.bind(fs));
40720 },
40721 CreateFilterStrategy: function() {
40722  if(this.incrementalFilteringMode == "Contains")
40723   return new ComboBoxContainsFilterStrategy(this);
40724  else if(this.incrementalFilteringMode == "StartsWith")
40725   return new ComboBoxStartsWithFilterStrategy(this);
40726  else if(this.incrementalFilteringMode == "None")
40727   return new ComboBoxDisabledFilterStrategy(this);
40728 },
40729 shouldStartUserInputTimer: function() {
40730  return true;
40731 },
40732 onInputChangedOnUserInputTimer: function(onRestart) {
40733  ASPxClientDropDownEditBase.prototype.onInputChangedOnUserInputTimer.call(this);
40734  if (!onRestart) {
40735   this.SyncRawValueIfHasTextDecorators();
40736   this.filterStrategy.OnInput();
40737  }
40738 },
40739 RaiseItemFiltering: function(item, filter, isFit) {
40740  if(!this.ItemFiltering.IsEmpty()) {
40741   var args = new ASPxClientListEditItemFilteringEventArgs(item, filter, isFit);
40742   this.ItemFiltering.FireEvent(this, args);
40743   isFit = args.isFit;
40744  }
40745  return isFit;
40746 },
40747 RaiseCustomHighlighting: function(filter, callbackHighlighting) {
40748  if(!this.CustomHighlighting.IsEmpty()) {
40749   var args = new ASPxClientListEditCustomHighlightingEventArgs(filter);
40750   args.highlighting = callbackHighlighting;
40751   this.CustomHighlighting.FireEvent(this, args);
40752   return args.highlighting;
40753  }
40754  return callbackHighlighting;
40755 },
40756 InlineInitialize: function() {
40757  this.BeforeInlineInitialize();
40758  this.filterStrategy = this.CreateFilterStrategy();
40759  this.InitSpecialKeyboardHandling();
40760  ASPxClientComboBoxBase.prototype.InlineInitialize.call(this);
40761 },
40762 IsClearButtonVisibleAuto: function() {
40763  return this.allowNull && ASPxClientComboBoxBase.prototype.IsClearButtonVisibleAuto.call(this);
40764 },
40765 BeforeInlineInitialize: function() {
40766  this.lastSuccessValue = this.GetDecodeValue(this.lastSuccessValue);
40767  this.InsureInputValueCorrect();
40768 },
40769 InsureInputValueCorrect: function(){ 
40770  if(this.initTextCorrectionRequired){
40771   var lb = this.GetListBoxControl();
40772   if(lb){
40773    var initSelectedIndex = lb.GetSelectedIndexInternal();
40774    if(initSelectedIndex >= 0){
40775     var initSelectedText = lb.GetItem(initSelectedIndex).text;
40776     var input = this.GetInputElement();
40777     if(ASPx.IsExists(this.GetRawValue()) && this.GetRawValue() != initSelectedText){
40778      this.SetRawValue(initSelectedText);
40779      this.SetInputValue(this.GetDecoratedText(initSelectedText));
40780     } 
40781     else if(input.value != initSelectedText)
40782      this.SetInputValue(initSelectedText);
40783    }
40784   }
40785  }
40786 },
40787 ChangeEnabledAttributes: function(enabled){
40788  ASPxClientComboBoxBase.prototype.ChangeEnabledAttributes.call(this, enabled);
40789  var changeEventsMethod = ASPx.Attr.ChangeEventsMethod(enabled);
40790  var mainElement = this.GetMainElement();
40791  if(mainElement)
40792   changeEventsMethod(mainElement, ASPx.Evt.GetMouseWheelEventName(), aspxCBMouseWheel);
40793  var btnElement = this.GetDropDownButton();
40794  if(btnElement)
40795   changeEventsMethod(btnElement, "onmousemove", ASPx.CBDDButtonMMove);
40796 },
40797 GetDropDownInnerControlName: function(suffix){
40798  return ASPxClientDropDownEditBase.prototype.GetDropDownInnerControlName.call(this, suffix);
40799 },
40800 AdjustControlCore: function() {
40801  ASPxClientEdit.prototype.AdjustControlCore.call(this);
40802  this.ResetDropDownSizeCache();
40803 },
40804 RemoveRaisePSValidationFromListBox: function() {
40805  var listBox = this.GetListBoxControl();
40806  if(listBox)
40807   listBox.RaisePersonalStandardValidation = function() { };
40808 },
40809 RedirectStandardValidators: function() {
40810  var valueInput = this.GetValueInput();
40811  if(ASPx.IsExistsElement(valueInput) && valueInput.Validators) {
40812   for(var i = 0; i < valueInput.Validators.length; i++)
40813    valueInput.Validators[i].controltovalidate = valueInput.id;
40814  }
40815 },
40816 GetValueInputToValidate: function(){
40817  return this.GetValueInput();
40818 },
40819 SetText: function(text, applyFilter) {
40820  ASPxClientComboBoxBase.prototype.SetText.call(this, text);
40821  if(applyFilter)
40822   this.filterStrategy.Filtering(true);
40823 },
40824 SetTextBase: function(text) {
40825  ASPxClientComboBoxBase.prototype.SetTextBase.call(this, text);
40826  this.restartCurrentUserInputTimer();
40827 },
40828 GetValueInput: function(){
40829  return document.getElementById(this.name + "_" + comboBoxValueInputSuffix);
40830 },
40831 GetListBoxScrollDivElement: function(){
40832  return this.GetListBoxControl().GetScrollDivElement();
40833 },
40834 RollbackValueInputValue: function(){
40835  var inputElement = this.GetValueInput();
40836  if(inputElement)
40837   inputElement.value = this.lastSuccessValue;
40838 },
40839 UpdateValueInput: function() {
40840  var inputElement = this.GetValueInput();
40841  if(inputElement) {
40842   var value = this.GetValue();
40843   inputElement.value = value != null ? value : "";
40844  }
40845 },
40846 SetInputValue: function(value) {
40847  var inputElement = this.GetInputElement();
40848  if(inputElement) {
40849   inputElement.value = value;
40850   this.restartCurrentUserInputTimer();
40851  }
40852 },
40853 CollectionChanged: function(filtering){
40854  this.GetSetValueOptimizeHelper().onItemCollectionChanged();
40855  var listBox = this.GetListBoxControl();
40856  listBox.CollectionChanged(filtering);
40857  var needUpdateDropDownPositionAndSize = listBox.APILockCount == 0 && (this.isShownAtFirst || filtering);
40858  if(needUpdateDropDownPositionAndSize)
40859   this.UpdateDropDownPositionAndSize();
40860 },
40861 UpdateDropDownPositionAndSize: function(){
40862  this.InitDropDownSize();
40863  if(this.droppedDown){
40864   var pc = this.GetPopupControl();
40865   var element = this.GetMainElement();
40866   pc.UpdatePositionAtElement(element);
40867  }
40868  if(!this.clientVisible)
40869   this.ResetControlAdjustment();
40870 },
40871 GetDropDownHeight: function(){
40872  if(this.ddHeightCache != ASPx.InvalidDimension)
40873   return this.ddHeightCache;
40874  this.EnsureDropDownWidth(); 
40875  return this.AdjustListBoxHeight();
40876 },
40877 GetDropDownWidth: function(){
40878  return (this.ddWidthCache != ASPx.InvalidDimension && !this.GetIsControlWidthWasChanged()) ? this.ddWidthCache : this.AdjustListBoxWidth();
40879 },
40880 EnsureDropDownWidth: function() {
40881  this.GetDropDownWidth();
40882 },
40883 InitDropDownSize: function() {
40884  if(!this.enabled || this.GetItemCount() == 0) return; 
40885  var pc = this.GetPopupControl();
40886  if(pc && this.IsDisplayed() && !this.IsHidden()) {
40887   var pcwElement = pc.GetCurrentWindowElement();
40888   if(ASPx.IsExistsElement(pcwElement)){
40889    var isPcwDisplayed = ASPx.GetElementDisplay(pcwElement);
40890    if(!isPcwDisplayed)
40891     pc.SetWindowDisplay(-1, true);
40892    var listBoxHeight = this.AdjustListBoxHeight();
40893    var listBoxWidth = this.AdjustListBoxWidth();
40894    if(listBoxHeight != this.ddHeightCache || listBoxWidth != this.ddWidthCache){
40895     this.ddHeightCache = listBoxHeight;
40896     this.ddWidthCache = listBoxWidth;
40897     pc.SetSize(this.ddWidthCache, this.ddHeightCache);
40898    }
40899    if(!isPcwDisplayed)
40900     pc.SetWindowDisplay(-1, false);
40901   }
40902  } else {
40903   this.needToInitPopupWindowOnShow = true;
40904  }
40905 },
40906 InitMainElementCache: function(){
40907  this.mainElementWidthCache = this.GetMainElement().clientWidth;
40908 },
40909 GetDefaultDropDownHeight: function(listHeight, count){
40910  if(this.defaultDropDownHeight == ""){
40911   this.defaultDropDownHeight = ((listHeight / count) * this.dropDownRows) + "px";
40912  }
40913  return this.defaultDropDownHeight;
40914 },
40915 AdjustListBoxHeight: function () {
40916  return this.GetListBoxControl().AdjustHeightInDropDown(this.dropDownHeight, this.dropDownRows, this.GetDefaultDropDownHeight.aspxBind(this));
40917 },
40918 AdjustListBoxWidth: function () {
40919  this.InitMainElementCache();
40920  return this.GetListBoxControl().AdjustWidthInDropDown(this.GetMainElement(), this.isCallbackMode, this.dropDownWidth);
40921 },
40922 SelectIndexSilent: function(lb, index, lockScrollingToItem){
40923  this.lbEventLockCount ++;
40924  lb.SelectIndexSilentAndMakeVisible(index, lockScrollingToItem);
40925  this.ShowItemImageByIndex(index);
40926  this.lbEventLockCount --;
40927 },
40928 GetDecoratedText: function(text) {
40929  var result;
40930  var lb = this.GetListBoxControl();
40931  var hasMultiColumnFormattedSelectedItem = this.displayFormat != null &&
40932              lb && lb.IsMultiColumn() &&
40933              this.GetSelectedItem() != null;
40934  if(hasMultiColumnFormattedSelectedItem)
40935   result = this.GetMultiColumnFormattedSelectedItemText(lb);
40936  else
40937   result = ASPxClientComboBoxBase.prototype.GetDecoratedText.call(this, text);
40938  return result;
40939 },
40940 GetMultiColumnFormattedSelectedItemText: function(lb) {
40941  var selectedItem = this.GetSelectedItem();
40942  var textColumnCount = this.GetTextColumnCountForTextDecoration(lb, selectedItem);
40943  var texts = [textColumnCount];
40944  for(var i = 0; i < textColumnCount; i++)
40945   texts[i] = selectedItem.GetColumnTextByIndex(i);
40946  return ASPx.Formatter.Format(this.displayFormat, texts);
40947 },
40948 GetTextColumnCountForTextDecoration: function(lb, item) {
40949  return lb.GetItemTextCellCount();
40950 },
40951 CanApplyNullTextDecoration: function() {
40952  var result;
40953  if(this.GetListBoxControl() || !this.loadDropDownOnDemand) {
40954   var value = this.isInitialized ? this.GetRawValue() : this.GetValue();
40955   var isValueNull = this.convertEmptyStringToNull && value === "" ? true : value === null;
40956   result = this.GetSelectedIndex() == -1 && isValueNull;
40957  } else
40958   result = this.GetCurrentText() === "";
40959  return result;
40960 },
40961 ForceTextChanged: function() {
40962  if(this.isCallbackMode && this.filterStrategy)
40963   this.filterStrategy.ClearFilterApplied();
40964  ASPxClientComboBoxBase.prototype.ForceTextChanged.call(this);
40965 },
40966 ShowDropDownArea: function(isRaiseEvent){
40967  if(this.needToLoadDropDown) {
40968   this.EnsureDropDownLoaded();
40969   return;
40970  }
40971  if(this.RequireLoadCustomRangeOnDropDown()){
40972   this.LoadCustomItemsRange();
40973   return;
40974  }
40975  var lb = this.GetListBoxControl();
40976  if(!lb || (!this.isDropDownModal() && !lb.GetItemCount()))
40977   return;
40978  if(!this.filterStrategy.IsFilterMeetRequirementForMinLength() && !this.isDropDownModal()) {
40979   this.DropDownButtonPop(true); 
40980   return;
40981  }
40982  if(this.needToInitPopupWindowOnShow) {
40983   this.needToInitPopupWindowOnShow = false;
40984   this.InitDropDownSize();
40985  }
40986  ASPxClientDropDownEditBase.prototype.ShowDropDownArea.call(this, isRaiseEvent);
40987  this.EnsureListBoxSelectionSynchronized(lb);
40988  this.EnsureSelectedItemVisibleOnShow(lb);
40989  lb.CallbackSpaceInit();
40990  if(this.accessibilityCompliant)
40991   this.GetAccessibilityHelper().SetExpandedState(true);
40992  if(!lb.GetItemCount())
40993   this.onNoResultsFiltering();
40994  if(!this.filterStrategy.IsFilterMeetRequirementForMinLength())
40995   this.onProcessFilterLessMinLength();
40996 },
40997 ForceShowLoadingPanel: function() {
40998  if(this.GetItemCount() == 0 && !this.needToLoadDropDown) {
40999   var lb = this.GetListBoxControl();
41000   if(lb) {
41001    var sizes = { width: this.GetWidth(), height: 100 };
41002    ASPxClientDropDownEditBase.prototype.ShowDropDownArea.call(this, false, sizes);
41003    lb.SetHeight(sizes.height);
41004    lb.SetWidth(sizes.width);
41005   }
41006  }
41007 },
41008 FireFoxRequiresCacheScrollBar: function(){
41009  return ASPx.Browser.Firefox && ASPx.Browser.Version >= 3.6; 
41010 },
41011 BrowserRequiresCacheScrollBar: function(){
41012  return ASPx.Browser.WebKitFamily || ASPx.Browser.Opera || this.FireFoxRequiresCacheScrollBar(); 
41013 },
41014 HideDropDownArea: function(isRaiseEvent){
41015  if(this.filterStrategy)
41016   this.filterStrategy.OnDropDownHideArea();
41017  if(this.BrowserRequiresCacheScrollBar())
41018   this.CachedScrollTop();
41019  ASPxClientDropDownEditBase.prototype.HideDropDownArea.call(this, isRaiseEvent);
41020  if(this.accessibilityCompliant)
41021   this.GetAccessibilityHelper().SetExpandedState(false);
41022 },
41023 EnsureSelectedItemTextSynchronized: function(){
41024  var selectedItem = this.GetSelectedItem();
41025  if(!this.CanSynchronizeSelectedItemText(selectedItem))
41026   return;
41027  var textUnsynchronized = this.GetText() !== selectedItem.text;
41028  var textDecorationUnsynchronized = this.HasTextDecorators() && this.CanApplyTextDecorators() && 
41029   this.GetDecoratedText(selectedItem.text) !== this.GetInputElement().value; 
41030  if(textUnsynchronized || textDecorationUnsynchronized || !this.IsImageSynchronized(selectedItem)) {
41031   this.SetTextBase(selectedItem.text);
41032   this.ShowItemImage(selectedItem);
41033   this.SetLastSuccessText(selectedItem.text);
41034   this.UpdateValueInput();
41035  }
41036 },
41037 IsImageSynchronized: function(selectedItem) {
41038  var ddImageElement = this.GetDropDownImageElement();
41039  var imageUrl = selectedItem.imageUrl != "" ? selectedItem.imageUrl : ASPx.Url.GetAbsoluteUrl(ASPx.EmptyImageUrl);
41040  return !ddImageElement || ASPx.ImageUtils.GetImageSrc(ddImageElement) === imageUrl;
41041 },
41042 CanSynchronizeSelectedItemText: function(selectedItem) {
41043  return !!selectedItem;
41044 },
41045 EnsureListBoxSelectionSynchronized: function(listBox){
41046  var rawText = this.GetTextInternal();
41047  var lbItem = listBox.GetSelectedItem();
41048  var lbText = lbItem != null ? lbItem.text : "";
41049  var isTextsExist = rawText != null && lbText != "";
41050  var needSynchronize = rawText != lbText || !this.isInitialized;
41051  if(needSynchronize && isTextsExist) {
41052   this.SynchronizeListBoxSelection(listBox, rawText);
41053   if(!this.isInitialized && this.IsValueRestoredByBrowser())
41054    this.SynchronizeListBoxInitSelection();
41055  }
41056 },
41057 SynchronizeListBoxSelection: function(listBox, rawText) {
41058  var newSelectedIndex = this.GetAdjustedSelectedIndexByText(listBox, rawText);
41059  listBox.SelectIndexSilent(newSelectedIndex, false);
41060 },
41061 SynchronizeListBoxInitSelection: function() {
41062  setTimeout(function () {
41063   var inputText = this.GetInputElement().value;
41064   var selectedItem = this.FindItemByText(inputText);
41065   if(selectedItem)
41066    this.SelectIndex(selectedItem.index, true);
41067  }.aspxBind(this), 0);
41068 },
41069 EnsureSelectedItemVisibleOnShow: function(listBox){
41070  if(this.BrowserRequiresCacheScrollBar()) 
41071   listBox.RestoreScrollTopFromCache();
41072  listBox.EnsureSelectedItemVisible();
41073 },
41074 CachedScrollTop: function(){
41075  this.GetListBoxControl().CachedScrollTop();
41076  if(this.BrowserRequiresCacheScrollBar()){ 
41077   var scrollDiv = this.GetListBoxScrollDivElement();
41078   if(scrollDiv != null)
41079    scrollDiv.scrollTop = 0;
41080  }
41081 },
41082 IsFilterEnabled: function() {
41083  return this.incrementalFilteringMode != "None";
41084 },
41085 ChangeInputEnabled: function(element, enabled, readOnly){
41086  ASPxClientTextEdit.prototype.ChangeInputEnabled.call(this, element, enabled, readOnly || (this.isDropDownListStyle && !this.IsFilterEnabled()));
41087 },
41088 GetCallbackArguments: function(){
41089  var args = ASPxClientComboBoxBase.prototype.GetCallbackArguments.call(this);
41090  args += this.filterStrategy.GetCallbackArguments();
41091  return args;
41092 },
41093 ClearEditorValueByClearButtonCore: function() {
41094  this.enterKeyPressed = false;
41095  ASPxClientDropDownEditBase.prototype.ClearEditorValueByClearButtonCore.call(this);
41096  if(!this.IsFilterEnabled() && this.isDropDownListStyle)
41097   this.HideDropDownArea();
41098  else
41099   this.filterStrategy.OnClearButtonClick();
41100 },
41101 ResetEditorState: function() {
41102  ASPxClientComboBoxBase.prototype.ResetEditorState.call(this);
41103  this.isNeedToForceFirstShowLoadingPanel = true;
41104  this.filterStrategy.ResetCallbackState();
41105 },
41106 IsFilterRollbackRequiredAfterApply: function() {
41107  var filterRollbackRequired = !this.GetSelectedItem() && !this.focused && this.InCallback();
41108  return filterRollbackRequired;
41109 },
41110 IsNullState: function() {
41111  return this.GetSelectedIndex() === -1 && ASPxClientComboBoxBase.prototype.IsNullState.call(this);
41112 },
41113 OnPost: function(args) {
41114  if(!args.isCallback && this.isDropDownListStyle && ASPx.GetFocusedElement() == this.GetInputElement())
41115   this.OnTextChangedInternal();
41116  ASPxClientComboBoxBase.prototype.OnPost.call(this, args);
41117 },
41118 GetLoadingParentElement: function(listBox) {
41119  return listBox.GetLoadingParentElement();
41120 },
41121 ShowLoadingPanel: function() { 
41122  var lb = this.GetListBoxControl();
41123  var loadingParentElement = this.GetLoadingParentElement(lb);
41124  if(!this.loadingPanelElement) {
41125   var loadingPanel = this.CreateLoadingPanelWithAbsolutePosition(loadingParentElement, loadingParentElement);
41126   lb.PreventMouseWheelOnElement(loadingPanel); 
41127  }
41128 },
41129 ShowLoadingDiv: function () {
41130  var lb = this.GetListBoxControl();
41131  var loadingParentElement = this.GetLoadingParentElement(lb);
41132  if(!this.loadingDivElement) {
41133   var loadingDiv = this.CreateLoadingDiv(loadingParentElement);
41134   lb.PreventMouseWheelOnElement(loadingDiv);
41135  }
41136 },
41137 HideLoadingPanelOnCallback: function(){
41138  return false;
41139 },
41140 OnCallback: function(result, callbackID) {
41141  if(!this.CanProcessCallbackResult(callbackID))
41142   return;
41143  this.defaultDropDownHeight = "";
41144  if(ASPx.Browser.WebKitTouchUI) { 
41145   if(this.needToLoadDropDown)
41146    this.OnLoadDropDownOnDemandCallback(result.c);
41147   window.setTimeout(function() {
41148    this.OnCallbackCore(result);
41149    this.DoEndCallback();
41150   }.aspxBind(this), 300);
41151  } else
41152   this.OnCallbackCore(result);
41153 },
41154 OnCallbackCore: function(result) {
41155  if(result.serverMode)
41156   this.UpdateStateObjectWithObject({serverMode: true});
41157  if(this.needToLoadDropDown) {
41158   if(!ASPx.Browser.WebKitTouchUI)
41159    this.OnLoadDropDownOnDemandCallback(result.c);
41160  } else if(!this.filterStrategy.ShouldDiscardCallbackResult()) {
41161   this.OnCallbackBeforeListBox();
41162   this.OnListBoxCallback(result);
41163   this.OnCallbackInternal(result);
41164   this.OnCallbackFinally(true);
41165  }
41166  this.callBackCoreComplete = true;
41167 },
41168 OnListBoxCallback: function(result) {
41169  var selectedValue = this.GetValue();
41170  var selectedText = this.GetText();
41171  function shouldSelectSilent(value, text) {
41172   return value === selectedValue || text === selectedText;
41173  }
41174  this.GetListBoxControl().OnCallback(result, shouldSelectSilent);
41175  this.EnsureSelectedItemTextSynchronized();
41176 },
41177 OnLoadDropDownOnDemandCallbackFinalized: function() {
41178  this.DoReInitializeAfterLoadDropDownOnDemand();
41179  this.HideLoadingPanel();
41180  this.HideLoadingDiv();
41181  var isCallbackForShowDropDownArea = !this.onLoadDropDownOnDemandCallbackFinalizedEventHandler;
41182  if(isCallbackForShowDropDownArea) {
41183   this.ShowDropDown();
41184   if(this.isDropDownModal())
41185    this.onDropDownModalChanged(true);
41186  }
41187  else
41188   this.onLoadDropDownOnDemandCallbackFinalizedEventHandler();
41189  this.FixButtonState();
41190  this.initializeDropDown();
41191 },
41192 OnCallbackFinalized: function() {
41193  if(this.needToLoadDropDown)
41194   this.OnLoadDropDownOnDemandCallbackFinalized();
41195 },
41196 OnLoadDropDownOnDemandCallback: function(html) {
41197  var node = this.GetLoadedDropDownPrevSibling();
41198  var tempDiv = node.ownerDocument.createElement('div');
41199  tempDiv.innerHTML = html;
41200  var len = tempDiv.childNodes.length;
41201  for(var ind = len - 1; ind >= 0; ind--) {
41202   ASPx.InsertElementAfter(tempDiv.childNodes.item(ind), node);
41203  }
41204 },
41205 GetLoadedDropDownPrevSibling: function() {
41206  return this.GetMainElement();
41207 },
41208 ProcessCallbackError: function(errorObj, callbackID) {
41209  if(!this.CanProcessCallbackResult(callbackID))
41210   return;
41211  this.callBackCoreComplete = true;
41212  ASPxClientDropDownEditBase.prototype.ProcessCallbackError.call(this, errorObj);
41213 },
41214 DoEndCallback: function(){ 
41215  if(!this.callBackCoreComplete && ASPx.Browser.WebKitTouchUI || this.IsDoEndCallbackLocked()) {
41216   this.UnlockDoEndCallback();
41217   return;
41218  }
41219  this.filterStrategy.OnBeforeDoEndCallback();
41220  ASPxClientDropDownEditBase.prototype.DoEndCallback.call(this);
41221  this.filterStrategy.OnAfterDoEndCallback();
41222  this.callBackCoreComplete = false; 
41223 },
41224 RaiseEndCallback: function(){
41225  if(this.preventEndCallbackRising) {
41226   this.preventEndCallbackRising = false;
41227   ASPx.GetControlCollection().DecrementRequestCount(); 
41228  } else {
41229   ASPxClientDropDownEditBase.prototype.RaiseEndCallback.call(this);
41230  }
41231 },
41232 OnCallbackError: function(result, data) {
41233  var lb = this.GetListBoxControl();
41234  if(lb)
41235   lb.OnCallbackError(result);
41236  else
41237   ASPxClientComboBoxBase.prototype.OnCallbackError.call(this, result, data);
41238  this.OnCallbackFinally(false);
41239 },
41240 OnCallbackFinally: function(isSuccessful){
41241  this.filterStrategy.OnBeforeCallbackFinally();
41242  this.CollectionChanged();
41243  this.HideLoadingElements();
41244  if(this.isNeedToForceFirstShowLoadingPanel)
41245   this.isNeedToForceFirstShowLoadingPanel = false;
41246  this.isPerformCallback = false;
41247  this.changeSelectAfterCallback = 0;
41248  if(isSuccessful)
41249   this.filterStrategy.OnAfterCallbackFinally();
41250 },
41251 OnCallbackBeforeListBox: function(){
41252  var lb = this.GetListBoxControl();
41253  this.changeSelectAfterCallback = lb.changeSelectAfterCallback;
41254 },
41255 OnCallbackCorrectSelectedIndex: function(){
41256  var lb = this.GetListBoxControl();
41257  if(this.changeSelectAfterCallback != 0)
41258   this.SetTextInternal(lb.GetSelectedItem().text);
41259 },
41260 OnCallbackInternal: function(result){
41261  this.OnCallbackCorrectSelectedIndex();
41262  if(this.isPerformCallback) {
41263   var lb = this.GetListBoxControl();
41264   if(!lb.GetItemCount()) {
41265    this.onNoResultsFiltering();
41266    if(!this.isDropDownModal())
41267     this.HideDropDownArea(true);
41268   }
41269  }
41270  this.filterStrategy.OnCallback(result);
41271 },
41272 DoReInitializeAfterLoadDropDownOnDemand: function() {
41273  this.InitializeListBoxOwnerName();
41274  this.needToLoadDropDown = false;
41275 },
41276 CancelLoadCustomRangeOnDropDown: function() {
41277  delete this.customItemsRangeInfo;
41278 },
41279 ForceLoadCustomItemsRangeOnDropDown: function(startIndex, valueToSelect) {
41280  var count = this.GetListBoxControl().callbackPageSize;
41281  this.customItemsRangeInfo = { startIndex: startIndex, endIndex: startIndex + count - 1, valueToSelect: valueToSelect };
41282 },
41283 RequireLoadCustomRangeOnDropDown: function() { return !!this.customItemsRangeInfo; },
41284 LoadCustomItemsRange: function() {
41285  if(this.InCallback()) return;
41286  this.ClearItems();
41287  this.ShowInputLoadingPanel();
41288  var startIndex = this.customItemsRangeInfo.startIndex;
41289  var endIndex = this.customItemsRangeInfo.endIndex;
41290  var value = this.customItemsRangeInfo.valueToSelect;
41291  var callbackArgs = this.GetListBoxControl().GetLoadCustomItemsRangeCallbackArguments(startIndex, endIndex, value);
41292  this.SendSpecialCallback(callbackArgs, function() { this.OnSuccessCustomItemsRangeLoad(); }.aspxBind(this));
41293 },
41294 OnSuccessCustomItemsRangeLoad: function() {
41295  var info = this.customItemsRangeInfo;
41296  if(!info) return;
41297  var listBox = this.GetListBoxControl();
41298  var startIndex = info.startIndex;
41299  listBox.serverIndexOfFirstItem = startIndex;
41300  listBox.SetScrollSpacerVisibility(true, startIndex > 0);
41301  if(ASPx.IsExists(info.valueToSelect))
41302   this.SetValue(info.valueToSelect);
41303  this.CancelLoadCustomRangeOnDropDown();
41304  this.ShowDropDown();
41305 },
41306 EnsureDropDownLoaded: function(callbackFunction) {
41307  if(this.needToLoadDropDown) {
41308   this.onLoadDropDownOnDemandCallbackFinalizedEventHandler = callbackFunction ? function() {
41309    callbackFunction();
41310   } : null;
41311   var args = this.FormatLoadDropDownOnDemandCallbackArguments();
41312   this.SendLoadDropDownOnDemandCallback(args);
41313  }
41314 },
41315 IsDropDownButtonClick: function(evt) {
41316  return ASPx.GetIsParent(this.GetDropDownButton(), ASPx.Evt.GetEventSource(evt));
41317 },
41318 OnDropDown: function(evt) {
41319  var returnValue = ASPxClientDropDownEditBase.prototype.OnDropDown.call(this, evt);
41320  if(this.IsDropDownButtonClick(evt) && this.IsCanToDropDown()) {
41321   this.OnDropDownButtonClick(evt);
41322   return returnValue;
41323  }
41324  return true;
41325 },
41326 OnDropDownButtonClick: function(evt) {
41327  if(this.filterStrategy != null)
41328   this.filterStrategy.OnDropDownButtonClick();     
41329  this.ForceRefocusEditor(evt);
41330 },
41331 SendCallback: function(onSuccess){
41332  if(!this.pcIsShowingNow)
41333   this.ShowLoadingElements();
41334  ASPxClientComboBoxBase.prototype.SendCallback.call(this, onSuccess);
41335 },
41336 IsAndroidKeyEventsLocked: function() {
41337  return ASPx.Browser.AndroidMobilePlatform && this.androidKeyEventsLocked;
41338 },
41339 LockAndroidKeyEvents: function() {
41340  this.androidKeyEventsLocked = true;
41341 },
41342 UnlockAndroidKeyEvents: function() {
41343  this.androidKeyEventsLocked = false;
41344 },
41345 CancelChangesOnUndo: function() {
41346  if(this.isCallbackMode)
41347   this.SetTextInternal(this.lastSuccessText);
41348  else
41349   this.OnCancelChanges();
41350  this.filterStrategy.OnUndo();
41351 },
41352 OnKeyDown: function(evt) {
41353  if(this.IsCtrlZ(evt)) {
41354   this.CancelChangesOnUndo();
41355   return ASPx.Evt.PreventEvent(evt);
41356  }
41357  var isClearKey = ASPx.Data.ArrayIndexOf([ASPx.Key.Delete, ASPx.Key.Backspace], evt.keyCode) >= 0;
41358  if(isClearKey && this.allowNull && (this.IsAllTextSelected() || this.isDropDownListStyle && !this.IsFilterEnabled()))
41359   this.ClearEditorValueAndForceOnChange();
41360  else if(this.IsAndroidKeyEventsLocked())
41361   return ASPx.Evt.PreventEventAndBubble(evt);
41362  else
41363   ASPxClientComboBoxBase.prototype.OnKeyDown.call(this, evt);
41364 },
41365 OnKeyUp: function(evt) {
41366  if(this.IsAndroidKeyEventsLocked())
41367   return ASPx.Evt.PreventEventAndBubble(evt);
41368  return ASPxClientComboBoxBase.prototype.OnKeyUp.call(this, evt);
41369 },
41370 IsAllTextSelected: function() {
41371  var input = this.GetInputElement();
41372  var textLength = input.value.length;
41373  if(textLength === 0)
41374   return false;
41375  var selectionInfo = ASPx.Selection.GetExtInfo(input);
41376  var selectionLength = selectionInfo.endPos - selectionInfo.startPos;
41377  return selectionLength === textLength;
41378 },
41379 SelectNeighbour: function (step){
41380  if((this.isToolBarItem && !this.droppedDown) || this.GetReadOnly()) return;
41381  this.SelectNeighbourInternal(step);
41382 },
41383 SelectNeighbourInternal: function(step){
41384  var lb = this.GetListBoxControl();
41385  if(this.droppedDown)
41386   this.lbEventLockCount ++;
41387  lb.SelectNeighbour(step);
41388  if(this.droppedDown) {
41389   var selectedItem = lb.GetSelectedItem();
41390   if (selectedItem) {
41391    this.OnSelectionChangedCore(selectedItem.text, selectedItem, true);
41392   }
41393   this.lbEventLockCount --;
41394  }
41395  if(this.accessibilityCompliant)
41396   this.GetAccessibilityHelper().SetLabelAttribute(null, null);
41397 },
41398 GetFocusSelectAction: function() {
41399  return (this.isToolbarItem || ASPx.Browser.IE && this.refocusWhenInputClicked) ? null : "all";
41400 },
41401 OnArrowUp: function(evt){
41402  if(!this.isInitialized) return true;
41403  if(this.RequireLoadCustomRangeOnDropDown() && !this.droppedDown) {
41404   this.LoadCustomItemsRange();
41405   return;
41406  }
41407  var isProcessed = ASPxClientDropDownEditBase.prototype.OnArrowUp.call(this, evt);
41408  if(!isProcessed && this.filterStrategy.CanNavigateByKbd())
41409   this.SelectNeighbour(-1);
41410  return true;
41411 },
41412 OnTextChanged: function(){
41413  if(!this.IsFocusEventsLocked())
41414   ASPxClientComboBoxBase.prototype.OnTextChanged.call(this);
41415 },
41416 OnTextChangedInternal: function() {
41417  if(!this.forceValueChanged) {
41418   var preserveFilterInInput = this.InCallback() && this.filterStrategy.currentCallbackIsFiltration;
41419   if(preserveFilterInInput) return;
41420  }
41421  ASPxClientComboBoxBase.prototype.OnTextChangedInternal.call(this);
41422  if(this.filterStrategy)
41423   this.filterStrategy.OnTextChanged();
41424 },
41425 OnArrowDown: function(evt){
41426  if(!this.isInitialized) return true;
41427  if(this.RequireLoadCustomRangeOnDropDown() && !this.droppedDown) {
41428   this.LoadCustomItemsRange();
41429   return;
41430  }
41431  var isProcessed = ASPxClientDropDownEditBase.prototype.OnArrowDown.call(this, evt);
41432  if(!isProcessed && this.filterStrategy.CanNavigateByKbd())
41433   this.SelectNeighbour(1);
41434  return true;
41435 },
41436 OnPageUp: function(){
41437  if(!this.isInitialized || !this.filterStrategy.CanNavigateByKbd()) return true;
41438  return this.OnPageButtonDown(false);
41439 },
41440 OnPageDown: function(){
41441  if(!this.isInitialized || !this.filterStrategy.CanNavigateByKbd()) return true;
41442  return this.OnPageButtonDown(true);
41443 },
41444 OnPageButtonDown: function(isDown){
41445  if(!this.isInitialized) return true;
41446  var lb = this.GetListBoxControl();
41447  if(lb){
41448   var direction = isDown ? 1 : -1;
41449   this.SelectNeighbour(lb.scrollPageSize * direction);
41450  }
41451  return true;
41452 },
41453 OnHomeKeyDown: function(evt){
41454  if(!this.isInitialized) return true;
41455  return this.OnHomeEndKeyDown(evt, true);
41456 },
41457 OnEndKeyDown: function(evt){
41458  if(!this.isInitialized) return true;
41459  return this.OnHomeEndKeyDown(evt, false);
41460 },
41461 OnHomeEndKeyDown: function(evt, isHome){
41462  if(!this.isInitialized) return true;
41463  var input = this.GetValueInput();
41464  if((input && input.readOnly) || evt.ctrlKey){
41465   var lb = this.GetListBoxControl();
41466   var count = lb.GetItemCount();
41467   this.SelectNeighbour(isHome ? -count : count);
41468   return true;
41469  }
41470  return false;
41471 },
41472 OnEscape: function() {
41473  this.filterStrategy.OnEscape();
41474  return ASPxClientComboBoxBase.prototype.OnEscape.call(this);
41475 },
41476 OnEnter: function(){
41477  if(!this.isInitialized) return true;
41478  if(this.isDropDownListStyle) this.enterKeyPressed = true;
41479  if(this.filterStrategy.IsCloseByEnterLocked()) return;
41480  this.enterProcessed = this.droppedDown; 
41481  if(!this.isEnterLocked) { 
41482   this.OnApplyChangesAndCloseWithEvents();
41483   this.filterStrategy.OnAfterEnter();
41484  }
41485  return this.enterProcessed;
41486 },
41487 OnTab: function(evt){
41488  if(!this.isInitialized) 
41489   return true;
41490  if(this.InCallback())
41491   this.filterStrategy.callbackProcessingStateManager.SetApply();
41492  else
41493   this.OnApplyChangesAndCloseWithEvents();
41494 },
41495 OnApplyChanges: function(){
41496  if(!this.focused || (this.isDropDownListStyle && !this.IsFilterEnabled())) return;
41497  this.OnApplyChangesInternal();
41498 },
41499 OnApplyChangesAndCloseWithEvents: function() {
41500  this.OnApplyChangesInternal();
41501  this.HideDropDownArea(true);
41502 },
41503 OnApplyChangesInternal: function(){
41504  var inCallback = this.InCallback();
41505  var lb = this.GetListBoxControl();
41506  var isChanged = this.HasChanges();
41507  var isRollback = false;
41508  if(isChanged || this.filterStrategy.isTotallyMismatchedFilter) {
41509   this.filterStrategy.isTotallyMismatchedFilter = false;
41510   this.filterStrategy.needEmptyFilterBeforeFiltering = false;
41511   var text = this.GetCurrentText();
41512   if(this.filterStrategy.OnApplyChanges())
41513    return;
41514   var adjustedSelectedIndex = this.GetAdjustedSelectedIndexByText(lb, text);
41515   var isNullState = this.allowNull && !text;
41516   var rollbackRequired = this.isDropDownListStyle && adjustedSelectedIndex < 0 && !isNullState;
41517   if(rollbackRequired) {
41518    var rollbackToItem = lb.GetSelectedItem();
41519    isRollback = rollbackToItem == null && this.isCallbackMode; 
41520    if(isRollback) {
41521     this.RollbackValueInputValue();
41522     this.RollbackTextInputValue();
41523    }
41524    text = rollbackToItem != null ? rollbackToItem.text : this.lastSuccessText;
41525   } 
41526   if(!isRollback) {
41527    var adjustedSelectedItem = this.GetItem(adjustedSelectedIndex);
41528    var adjustedSelectedItemText = adjustedSelectedItem && adjustedSelectedItem.text;
41529    text = adjustedSelectedItemText || text;
41530    var hasChanges = this.HasChanges(text);
41531    this.SetText(text);
41532    if(hasChanges)
41533     this.OnChange();
41534   }
41535   else if(!inCallback) {
41536    this.filterStrategy.OnFilterRollback();
41537   }
41538  } 
41539 },
41540 GetCurrentText: function(){
41541  var textDecorated = !this.focused && this.GetRawValue() != null;
41542  return textDecorated ? this.GetRawValue() : this.GetInputElement().value;
41543 },
41544 GetCurrentValue: function(){
41545  var value = null;
41546  var selectedItem = this.listBox.GetSelectedItem();
41547  if(selectedItem && (selectedItem.value !== "" || !this.convertEmptyStringToNull))
41548   value = selectedItem.value;
41549  return selectedItem ? value : this.GetValue();
41550 },
41551 HasChanges: function(currentText){
41552  currentText = currentText === undefined ? this.GetCurrentText() : currentText;
41553  return this.lastSuccessText != currentText || this.lastSuccessValue != this.GetCurrentValue();
41554 },
41555 OnButtonClick: function(number){
41556  if(number != this.dropDownButtonIndex) {
41557   if(this.droppedDown)
41558    this.OnApplyChangesAndCloseWithEvents(false);
41559   else
41560    ASPxClientComboBoxBase.prototype.OnTextChanged.call(this);
41561  }
41562  ASPxClientButtonEditBase.prototype.OnButtonClick.call(this, number);
41563 },
41564 OnCancelChanges: function(){
41565  var isCancelProcessed = ASPxClientDropDownEditBase.prototype.OnCancelChanges.call(this);
41566  this.filterStrategy.OnCancelChanges();
41567  var lb = this.GetListBoxControl();
41568  if(ASPx.IsExists(lb)) {
41569   var index = this.GetAdjustedSelectedIndexByText(lb, this.lastSuccessText);
41570   this.SelectIndexSilent(lb, index);
41571  }
41572  return isCancelProcessed;
41573 },
41574 ShouldCloseOnMCMouseDown: function () {
41575  return this.GetInputElement().readOnly;
41576 },
41577 OnCloseUp: function(evt){
41578  var evt = ASPx.Evt.GetEvent(evt);
41579  if(ASPx.Browser.Firefox && evt.type == "mouseup" && ASPx.Evt.GetEventSource(evt).tagName == "DIV") { 
41580   var scrollDiv = this.GetListBoxControl().GetScrollDivElement();
41581   var scrollDivID = scrollDiv ? scrollDiv.id : "";
41582   if(scrollDivID == ASPx.Evt.GetEventSource(evt).id) 
41583    return;
41584  }
41585  ASPxClientDropDownEditBase.prototype.OnCloseUp.call(this, evt);
41586 },
41587 OnDDButtonMouseMove: function(evt){
41588  return (this.droppedDown ? ASPx.Evt.CancelBubble(evt) : true);
41589 },
41590 CloseDropDownByDocumentOrWindowEvent: function(causedByWindowResizing) {
41591  if(!this.InCallback()) {
41592   this.OnApplyChangesInternal();
41593   ASPxClientDropDownEditBase.prototype.CloseDropDownByDocumentOrWindowEvent.call(this, causedByWindowResizing);
41594  }
41595  this.filterStrategy.OnDropDownCloseByDocumentOrWindowEvent();
41596 },
41597 IsCanToDropDown: function() {
41598  if(this.loadDropDownOnDemand) {
41599   var lb = this.GetListBoxControl();
41600   return (!this.needToLoadDropDown && (lb.GetItemCount() || this.isDropDownModal()));
41601  }
41602  return ASPxClientDropDownEditBase.prototype.IsCanToDropDown.call(this);
41603 },
41604 OnPopupControlShown: function(){
41605  if(!this.isInitialized) return;
41606  if(ASPx.Browser.Opera) 
41607   this.GetListBoxControl().RestoreScrollTopFromCache();
41608  if(this.lockListBoxClick)
41609   this.RemoveLockListBoxClick();
41610  if(this.InCallback()) 
41611   this.ShowLoadingDivAndPanel();
41612  ASPxClientDropDownEditBase.prototype.OnPopupControlShown.call(this);
41613  if(!this.isShownAtFirst) {
41614   if(this.GetListBoxControl().ResetItemHeightIfRequired()) {
41615    this.AdjustListBoxHeight();
41616    this.InitDropDownSize();
41617   }
41618   this.isShownAtFirst = true;
41619  }
41620 },
41621 OnLBSelectedIndexChanged: function(){
41622  if(!this.lockListBoxClick) {
41623   this.OnSelectChanged();
41624   this.filterStrategy.OnSelectedIndexChanged();
41625   if(this.IsNavigationOnKeyPress()){
41626    if(!this.droppedDown) {
41627     ASPx.Selection.Set(this.GetInputElement());
41628    }
41629   } else if(this.focused) {
41630    this.ForceRefocusEditor();
41631   }
41632  }
41633 },
41634 IsNavigationOnKeyPress: function() {
41635  var lb = this.GetListBoxControl();
41636  return lb.IsScrollOnKBNavigationLocked();
41637 },
41638 OnListBoxItemMouseUp: function(evt){
41639  if(!this.lockListBoxClick && !this.InCallback()){
41640   this.OnApplyChangesInternal();
41641   this.OnCloseUp(evt);
41642  }
41643 },
41644 OnMouseWheel: function(evt){
41645  if(this.allowMouseWheel && !this.droppedDown && this.filterStrategy.CanNavigateByKbd()) {
41646   var wheelDelta = ASPx.Evt.GetWheelDelta(evt);
41647   if(wheelDelta > 0)
41648    this.SelectNeighbour(-1);
41649   else  if(wheelDelta < 0)
41650    this.SelectNeighbour(1);
41651   return ASPx.Evt.PreventEvent(evt);
41652  }
41653 },
41654 OnOpenAnotherDropDown: function(){
41655  this.OnApplyChangesAndCloseWithEvents();
41656 },
41657 ParseValue: function() {
41658  var forceValueChanged = !this.IsValueChanging() && this.IsValueChangeForced();
41659  var newText = this.GetInputElement().value;
41660  var oldText = this.GetText();
41661  var isNeedToParseValue = oldText != newText;
41662  if(isNeedToParseValue || forceValueChanged) {
41663   this.StartValueChanging();
41664   if(this.CanTextBeAccepted(newText, oldText) || forceValueChanged){
41665    if(isNeedToParseValue || newText)
41666     this.SetText(newText);
41667    this.OnChange();
41668   } else
41669    this.SetTextInternal(oldText);
41670   this.EndValueChanging();
41671  }
41672 },
41673 CanTextBeAccepted: function(newText, oldText){
41674  var notAnyTextCanBeAccepted = this.isDropDownListStyle;
41675  if(notAnyTextCanBeAccepted){
41676   var lb = this.GetListBoxControl();
41677   var newTextPresentInItemCollection = this.GetAdjustedSelectedIndexByText(lb, newText) != -1;
41678   return newTextPresentInItemCollection;
41679  }
41680  var wasTextErased = !newText && oldText;
41681  if((!wasTextErased) && this.nullText && this.CanApplyNullTextDecoration()) {
41682   return false;
41683  }
41684  return true;
41685 },
41686 MakeItemVisible: function(index){
41687  var lb = this.GetListBoxControl();
41688  lb.MakeItemVisible(index);
41689 },
41690 PerformCallback: function(arg, onSuccess) {
41691  this.isPerformCallback = true;
41692  this.CancelLoadCustomRangeOnDropDown();
41693  this.filterStrategy.OnPerformCallback();
41694  if(this.needToLoadDropDown) {
41695   var formatCallbackArg = function(prefix, arg) {  
41696    arg = arg.toString();
41697    return (ASPx.IsExists(arg) ? prefix + "|" + arg.length + ';' + arg + ';' : "");
41698   };
41699   if(arg === undefined || arg == null)
41700    arg = "";
41701   var performArgs = formatCallbackArg(ASPxClientListEdit.CONSTANTS.CALLBACK_PREFIXES.CUSTOM, arg);
41702   this.onLoadDropDownOnDemandCallbackFinalizedEventHandler = function() {
41703    var selectedItem = this.listBox.GetSelectedItem();
41704    if(selectedItem != null)
41705     this.SetTextInternal(selectedItem.text);
41706    var lb = this.GetListBoxControl();
41707    if(lb)
41708     lb.SetCustomCallbackArg(performArgs);
41709   };
41710   var loadItemsRangeArgs = formatCallbackArg(ASPxClientListEdit.CONSTANTS.CALLBACK_PREFIXES.LOAD_RANGE_ITEMS, "0:-2");
41711   var args = this.FormatLoadDropDownOnDemandCallbackArguments(performArgs + loadItemsRangeArgs);
41712   this.SendLoadDropDownOnDemandCallback(args, onSuccess);
41713  } else {
41714   this.ClearItemsInternal();
41715   this.GetListBoxControl().PerformCallback(arg, onSuccess);
41716  }
41717 },
41718 ClearItemsInternal: function(){
41719  ASPxClientComboBoxBase.prototype.ClearItemsInternal.call(this);
41720  var lbScrollDiv = this.GetListBoxScrollDivElement();
41721  if(lbScrollDiv)
41722   lbScrollDiv.scrollTop = "0px";
41723 },
41724 SendLoadDropDownOnDemandCallback: function(args, handler) {
41725  this.ShowInputLoadingPanel();
41726  this.SendSpecialCallback(args, handler);
41727 },
41728 ShowInputLoadingPanel: function() {
41729  var inputElement = this.GetInputElement();
41730  var inputParentElement = inputElement.parentNode;
41731  this.CreateLoadingDiv(inputParentElement, inputElement);
41732  this.CreateLoadingPanelWithAbsolutePosition(inputParentElement, inputElement);
41733 },
41734 FormatLoadDropDownOnDemandCallbackArguments: function(args) {
41735  var internalArgs = ASPx.IsExists(args) ? args.toString() : "";
41736  var resultArgs = loadDropDownOnDemandCallbackPrefix + "|0;;";
41737  return resultArgs + internalArgs;
41738 },
41739 CorrectCaretPositionInChrome: function() {
41740  if(!ASPx.Browser.Chrome) return;
41741  var currentSelection = ASPx.Selection.GetInfo(this.GetInputElement());
41742  if(currentSelection.startPos === currentSelection.endPos)
41743   ASPx.Selection.SetCaretPosition(this.GetInputElement(), 0);
41744 },
41745 ForceRefocusEditor: function(evt, isNativeFocus) {
41746  this.CorrectCaretPositionInChrome();
41747  this.refocusWhenInputClicked = this.IsElementBelongToInputElement(ASPx.Evt.GetEventSource(evt));
41748  ASPxClientButtonEditBase.prototype.ForceRefocusEditor.call(this, evt, isNativeFocus);
41749 },
41750 OnFocus: function () {
41751  if(this.needToLoadDropDown) {
41752   var args = this.FormatLoadDropDownOnDemandCallbackArguments();
41753   this.SendLoadDropDownOnDemandCallback(args);
41754  } else
41755   this.FixButtonState();
41756  ASPxClientDropDownEditBase.prototype.OnFocus.call(this);
41757 },
41758 FixButtonState: function() {
41759  var lb = this.GetListBoxControl();
41760  if(lb && this.ddButtonPushed) {
41761   this.DropDownButtonPop(true);
41762  }
41763 },
41764 getDropDownEventTargets: function() {
41765  return ASPxClientComboBoxBase.prototype.getDropDownEventTargets.call(this).concat([
41766   this.isDropDownListStyle ? this.getInputCell() : null,
41767  ]);
41768 },
41769 onDropDownModalChanged: function(enabled) {
41770  ASPxClientComboBoxBase.prototype.onDropDownModalChanged.call(this, enabled);
41771  if(!enabled) {
41772   if(!this.GetItemCount() || !this.filterStrategy.IsFilterMeetRequirementForMinLength())
41773    setTimeout(this.HideDropDownArea.bind(this, true), 0);
41774   this.showDropDownModalMessageElement(false);
41775  }
41776  this.GetListBoxControl().onDropDownModalChanged(enabled);
41777  this.UpdateDropDownPositionAndSize();
41778 },
41779 onProcessFilterLessMinLength: function() {
41780  if(this.isDropDownModal() && this.droppedDown)
41781   this.showDropDownModalMessageElement(true, this.isDropDownListStyle ? this.msgFilterMinLength : (this.msgFilterMinLength + "<br />" + this.msgFilterNoResults));
41782  if(!this.isDropDownModal())
41783   this.HideDropDownArea(true);
41784 },
41785 onNoResultsFiltering: function() {
41786  if(this.isDropDownModal() && this.droppedDown)
41787   this.showDropDownModalMessageElement(true, this.msgFilterNoResults);
41788 },
41789 onBeforeFiltering: function() {
41790  if(this.isDropDownModal() && this.droppedDown)
41791   this.showDropDownModalMessageElement(false);
41792 },
41793 showDropDownModalMessageElement: function(visible, message) {
41794  var listBox = this.GetListBoxControl();
41795  if(!listBox) 
41796   return;
41797  if(visible && !this.dropDownModalMessageElement) {
41798   this.dropDownModalMessageElement = document.createElement("div");
41799   this.dropDownModalMessageElement.className = "dxdd-info";
41800   listBox.GetMainElement().parentNode.insertBefore(this.dropDownModalMessageElement, listBox.GetMainElement());
41801  }
41802  else if(visible)
41803   this.dropDownModalMessageElement.style.display = "";
41804  else if(!visible && this.dropDownModalMessageElement)
41805   this.dropDownModalMessageElement.style.display = "none";
41806  if(visible && message)
41807   this.dropDownModalMessageElement.innerHTML = message;
41808  if(this.dropDownModalMessageElement)
41809   ASPx.SetElementDisplay(listBox.GetMainElement(), !visible);
41810 },
41811 onDropDownApplyCommandClick: function() {
41812  this.OnApplyChangesAndCloseWithEvents();
41813 },
41814 onDropDownCloseCommandClick: function() {
41815  this.OnEscape();
41816 },
41817 SetItemHtml: function(index, html) {
41818  this.GetListBoxControl().SetItemHtml(index, html);
41819 },
41820 SetItemTooltip: function(index, tooltip) { this.GetListBoxControl().SetItemTooltip(index, tooltip); },
41821 SetItemAttribute: function(index, attributeName, attributeValue) { this.GetListBoxControl().SetItemAttribute(index, attributeName, attributeValue); },
41822 AddItemCssClass: function(index, className) { this.GetListBoxControl().AddItemCssClass(index, className); },
41823 RemoveItemCssClass: function(index, className) { this.GetListBoxControl().RemoveItemCssClass(index, className); },
41824 SetItemTextCellHtml: function(itemIndex, textCellIndex, html) { this.GetListBoxControl().SetItemTextCellHtml(itemIndex, textCellIndex, html); },
41825 SetItemTextCellTooltip: function(itemIndex, textCellIndex, tooltip) { this.GetListBoxControl().SetItemTextCellTooltip(itemIndex, textCellIndex, tooltip); },
41826 SetItemTextCellAttribute: function(itemIndex, textCellIndex, attributeName, attributeValue) { this.GetListBoxControl().SetItemTextCellAttribute(itemIndex, textCellIndex, attributeName, attributeValue); },
41827 AddItemTextCellCssClass: function(itemIndex, textCellIndex, className) { this.GetListBoxControl().AddItemTextCellCssClass(itemIndex, textCellIndex, className); },
41828 RemoveItemTextCellCssClass: function(itemIndex, textCellIndex, className) { this.GetListBoxControl().RemoveItemTextCellCssClass(itemIndex, textCellIndex, className); },
41829 GetAccessibilityText: function() {
41830  var helper = this.GetAccessibilityHelper();
41831  return helper && helper.getListSelectedItemText() || this.GetCurrentText();
41832 }
41833});
41834ASPx.Ident.scripts.ASPxClientComboBox = true;
41835ASPxClientComboBox.Cast = ASPxClientControl.Cast;
41836var CallbackProcessingStateManager = function(){
41837 var states = { 
41838  Default:   0,
41839  Rollback:     1,
41840  Apply:     2,
41841  ApplyAfterRollback: 3
41842 };
41843 var state = states.Default;
41844 return {
41845  ResetState: function() {
41846   state = states.Default;
41847  },
41848  IsApply: function() {
41849   return state == states.Apply;
41850  },
41851  IsRollback: function() {
41852   return state == states.Rollback;
41853  },
41854  IsApplyAfterRollback: function() {
41855   return state == states.ApplyAfterRollback;
41856  },
41857  NoFilterPostProcessing: function() {
41858   return !this.IsApply() && !this.IsApplyAfterRollback() && !this.IsRollback();
41859  },
41860  SetRollback: function() {
41861   if(state == states.Default)
41862    state = states.Rollback;
41863  },
41864  SetApply: function() {
41865   if(state == states.Default)
41866    state = states.Apply;
41867  },
41868  SetApplyAfterRollback: function() {
41869   if(state == states.Default || state == states.Apply)
41870    state = states.ApplyAfterRollback;
41871  },
41872  OnCallbackResult: function(filterRollbackRequired) {
41873   if(state == states.Apply) {
41874    state = filterRollbackRequired ? states.ApplyAfterRollback : states.Default;
41875    return;
41876   }
41877   if(state == states.Rollback) {
41878    state = states.ApplyAfterRollback;
41879    return;
41880   }
41881   if(state == states.ApplyAfterRollback) {
41882    state = states.Default;
41883    return;
41884   }
41885  }
41886 };
41887};
41888var ASPxClientNativeComboBox = ASPx.CreateClass(ASPxClientComboBoxBase, {
41889 constructor: function(name) {
41890  this.constructor.prototype.constructor.call(this, name);
41891  this.initSelectedIndex = -1;
41892  this.raiseValueChangedOnEnter = false;
41893 },
41894 InlineInitialize: function () {
41895  ASPxClientComboBoxBase.prototype.InlineInitialize.call(this);
41896  var lb = this.GetListBoxControl();
41897  if(lb != null) lb.SetMainElement(this.GetMainElement());
41898  if(this.initSelectedIndex == -1) { 
41899   this.SelectIndex(this.initSelectedIndex, true);
41900  }
41901 },
41902 FindInputElement: function(){
41903  return this.GetMainElement();
41904 }, 
41905 GetDropDownInnerControlName: function(suffix){
41906  return this.name + suffix;
41907 },
41908 PerformCallback: function(arg) {
41909  this.GetListBoxControl().PerformCallback(arg);
41910 },
41911 GetTextInternal: function(){
41912  var selectedItem = this.GetSelectedItem();
41913  return (selectedItem != null) ? selectedItem.text : "";
41914 },
41915 HasTextDecorators: function() {
41916  return false;
41917 },
41918 SetText: function (text){
41919  var lb = this.GetListBoxControl();
41920  var index = this.FindItemIndexByText(lb, text);
41921  this.SelectIndex(index, false);
41922  this.SetLastSuccessText((index > -1) ? text : "");
41923  this.SetLastSuccessValue((index > -1) ? lb.GetValue() : null);
41924 },
41925 GetValue: function(){
41926  var selectedItem = this.GetSelectedItem();
41927  return (selectedItem != null) ? selectedItem.value : null;
41928 },
41929 SetValue: function(value){
41930  var lb = this.GetListBoxControl();
41931  if(lb){
41932   lb.SetValue(value);
41933   var item = lb.GetSelectedItem();
41934   var text = item ? item.text : value;
41935   this.SetLastSuccessText(item != null ? text : "");
41936   this.SetLastSuccessValue(item != null ? item.value : null);
41937  }
41938 },
41939 ForceRefocusEditor: function(){
41940 },
41941 OnCallback: function(result) {
41942  this.GetListBoxControl().OnCallback(result);
41943  if(this.GetItemCount() > 0)
41944   this.SetSelectedIndex(0);
41945 },
41946 OnTextChanged: function() {
41947  this.OnChange();
41948 },
41949 OnFocus: function() { },
41950 SetTextInternal: function(text){
41951 },
41952 SetTextBase: function(text){
41953 },
41954 ChangeEnabledAttributes: function(enabled){
41955  this.GetMainElement().disabled = !enabled;
41956 }
41957});
41958var AccessibilityHelperComboBox = ASPx.CreateClass(ASPx.AccessibilityHelperBase, {
41959 constructor: function(comboBox) {
41960  this.constructor.prototype.constructor.call(this, comboBox);
41961  this.currentValue = null;
41962 },
41963 SetLabelAttribute: function(text, isItemSelected) {
41964  this.currentValue = this.control.GetValue();
41965  var message = text !== null ? this.getLabelText(text, isItemSelected) : this.getListSelectedItemText();
41966  this.PronounceMessage(message);
41967 },
41968 PronounceMessage: function(text) {
41969  var input = this.getInputElement();
41970  var expandArg = {"aria-expanded" : this.control.droppedDown };
41971  ASPx.AccessibilityHelperBase.prototype.PronounceMessage.call(this, text, expandArg, ASPx.CloneObject(expandArg), null, input);
41972 }, 
41973 SetExpandedState: function(expanded) {
41974  if(this.currentValue != this.control.GetValue()) {
41975   this.SetLabelAttribute(null, null);
41976  } else {
41977   var input = this.getInputElement();
41978   var expandArg =  { "aria-expanded": expanded };
41979   this.changeActivityAttributes(input, expandArg);
41980   this.changeActivityAttributes(this.getItem(true), expandArg);
41981  }
41982 },
41983 getLabelText: function(text, isItemSelected) {
41984  var blankText = ASPx.AccessibilitySR.BlankEditorText;
41985  if(!text)
41986   text = blankText;
41987  var itemsCount = this.getListBoxControl().GetVisibleItemCount();
41988  var formatString = ASPx.AccessibilitySR.ComboBoxFilteringResultFormatString;
41989  if(!isItemSelected || itemsCount == 1)
41990   formatString += ASPx.AccessibilitySR.ComboBoxCurrentTextFormatString;
41991  return ASPx.Str.ApplyReplacement(formatString, [["{0}", itemsCount],
41992   ["{1}", (isItemSelected || !this.control.lastSuccessText) ? text : this.control.lastSuccessText],
41993   ["{2}", this.getInputElement().value || blankText]]);
41994 },
41995 getListBoxControl: function() { return this.control.GetListBoxControl(); },
41996 getInputElement: function() { return this.control.GetInputElement(); },
41997 getListSelectedItemText: function() {
41998  var lb = this.getListBoxControl();
41999  var selectedItem = lb.GetSelectedItem();
42000  var itemText = "";
42001  if(!!selectedItem) {
42002   var formatString = ASPx.AccessibilitySR.ItemPositionFormatString;
42003   var visibleIndex = this.control.isCallbackMode ? selectedItem.index + 1 : lb.GetIndexVisibleItem(selectedItem);
42004   var itemPositionText = ASPx.Str.ApplyReplacement(formatString, [["{0}", visibleIndex], ["{1}", lb.GetVisibleItemCount()]]);
42005   itemText = selectedItem.text + itemPositionText;
42006  } else {
42007   var input = this.getInputElement();
42008   itemText = !!input.value ? input.value : ASPx.AccessibilitySR.BlankEditorText;
42009  }
42010  return itemText;
42011 }
42012});
42013function setValueOptimizeHelper() {
42014 var itemCollectionWasChangedSinceLastSetValue = false;
42015 function canReSetValue() {
42016  return itemCollectionWasChangedSinceLastSetValue;
42017 }
42018 function onSetValue() {
42019  itemCollectionWasChangedSinceLastSetValue = false;
42020 }
42021 return {
42022  onItemCollectionChanged: function () {
42023   itemCollectionWasChangedSinceLastSetValue = true;
42024  },
42025  setValue: function (comboBox, newValue, methodName) {
42026   var item = comboBox.FindItemByValue(newValue);
42027   var reSetValue = comboBox.GetValue() === newValue;
42028   if (reSetValue && !canReSetValue() && (!item || item.selected)) return;
42029   comboBox.SetValueInternal(newValue);
42030   onSetValue();
42031  }
42032 };
42033}
42034ASPx.CBDDButtonMMove = function(evt){
42035 return ASPx.GetDropDownCollection().OnDDButtonMouseMove(evt);
42036};
42037function aspxCBMouseWheel(evt){
42038 var srcElement = ASPx.Evt.GetEventSource(evt);
42039 var focusedCB = ASPx.GetDropDownCollection().GetFocusedDropDown();
42040 if(focusedCB != null && ASPx.GetIsParent(focusedCB.GetMainElement(), srcElement))
42041  return focusedCB.OnMouseWheel(evt);
42042}
42043var ComboBoxDisabledFilterStrategy = ASPx.CreateClass(ASPx.ListEditFilterStrategyBase, {
42044 constructor: function(comboBox) {
42045  this.constructor.prototype.constructor.call(this, comboBox.filterTimer, comboBox.filterMinLength, comboBox.isCallbackMode);
42046  this.comboBox = comboBox;
42047  this.callbackProcessingStateManager = new CallbackProcessingStateManager();
42048 },
42049 OnDropDownCloseByDocumentOrWindowEvent: function() {
42050  if(this.comboBox.InCallback())
42051   this.callbackProcessingStateManager.SetApply();
42052 },
42053 OnAfterCallbackFinally: function() {
42054  if(this.callbackProcessingStateManager.IsApply() || this.callbackProcessingStateManager.IsApplyAfterRollback()) {
42055   this.comboBox.OnApplyChangesAndCloseWithEvents();
42056   this.callbackProcessingStateManager.ResetState();
42057  }
42058 },
42059 IsCloseByEnterLocked: function() { return false; },
42060});
42061var ComboBoxIncrementalFilterStrategyBase = ASPx.CreateClass(ASPx.ListEditIncrementalFilterStrategyBase, {
42062 constructor: function(comboBox) {
42063  this.constructor.prototype.constructor.call(this, comboBox.filterTimer, comboBox.filterMinLength, comboBox.isCallbackMode);
42064  this.comboBox = comboBox;
42065  this.isDropDownListStyle = comboBox.isDropDownListStyle;
42066  this.callbackProcessingStateManager = new CallbackProcessingStateManager();
42067  this.isTotallyMismatchedFilter = false;
42068 },
42069 OnInput: function() {
42070  if (!this.comboBox.allowNull && !this.GetInputFilterValue())
42071   this.ClearFilterApplied();
42072  ASPx.ListEditIncrementalFilterStrategyBase.prototype.OnInput.call(this);
42073 },
42074 OnKeyDown: function(evt) {
42075  var cbInputElement = this.comboBox.GetInputElement();
42076  var selInfo = ASPx.Selection.GetInfo(cbInputElement);
42077  if(selInfo.startPos != selInfo.endPos && evt.keyCode == ASPx.Key.Backspace) {
42078   var currentText = cbInputElement.value;
42079   var cutText = currentText.slice(0, selInfo.startPos) + currentText.slice(selInfo.endPos);
42080   var newFilter = ASPx.Str.PrepareStringForFilter(cutText);
42081   if(cutText != currentText && this.comboBox.filterStrategy.FilterCompareLower(newFilter)) {
42082    cbInputElement.value = cutText; 
42083    ASPx.Selection.SetCaretPosition(cbInputElement, selInfo.startPos);
42084   }
42085  }
42086 },
42087 OnEscape: function() {
42088  this.FilterStopTimer();
42089  if(this.InCallback())
42090   this.callbackProcessingStateManager.SetRollback();
42091 },
42092 OnUndo: function() {
42093  if(this.isCallbackMode)
42094   this.Filtering();
42095  else {
42096   this.FilteringStopClient();
42097   this.GetListBoxControl().EnsureSelectedItemVisible();
42098  }
42099 },
42100 OnApplyChanges: function () {
42101  if (this.IsFilterTimerActive()) {
42102   this.FilterNowAndApply();
42103   return true;
42104  }
42105  return false;
42106 },
42107 OnCancelChanges: function () {
42108  this.OnFilterRollback();
42109 },
42110 OnClearButtonClick: function () {
42111  if (!this.InCallback()) {
42112   this.FilteringStop();
42113   if (this.isCallbackMode)
42114    this.Filtering();
42115  }
42116 },
42117 OnDropDownCloseByDocumentOrWindowEvent: function() {
42118  if(this.InCallback())
42119   this.callbackProcessingStateManager.SetApply();
42120 },
42121 PreventEndCallbackRising: function() {
42122  this.comboBox.preventEndCallbackRising = true;
42123 },
42124 OnBeforeCallbackFinally: function() {
42125  this.currentCallbackIsFiltration = false;
42126 },
42127 OnAfterCallbackFinally: function() {
42128  var filterRollbackRequired = false;
42129  if(this.callbackProcessingStateManager.IsApply() || this.callbackProcessingStateManager.IsApplyAfterRollback()) {
42130   this.ApplyAfterFinalFiltrationCallback();
42131   filterRollbackRequired = this.comboBox.IsFilterRollbackRequiredAfterApply();
42132  }
42133  if(this.callbackProcessingStateManager.IsRollback())
42134   filterRollbackRequired = true;
42135  this.callbackProcessingStateManager.OnCallbackResult(filterRollbackRequired);
42136  if(filterRollbackRequired)
42137   window.setTimeout(this.OnFilterRollback.bind(this), 0);
42138 },
42139 OnPerformCallback: function() {
42140  this.ClearFilter();
42141 },
42142 CanNavigateByKbd: function() {
42143  return this.IsFilterMeetRequirementForMinLength();
42144 },
42145 ApplyAfterFinalFiltrationCallback: function() {
42146  var itemIsSelected = this.TrySelectItemAfterFilter();
42147  this.comboBox.HideDropDownArea();
42148  var requiredApplyFailed = this.comboBox.isDropDownListStyle && !itemIsSelected && this.comboBox.focused && this.callbackProcessingStateManager.IsApply();
42149  if(requiredApplyFailed)
42150   this.comboBox.ShowDropDownArea(true);
42151  var needApplyChanges = itemIsSelected || !this.comboBox.focused;
42152  if(needApplyChanges)
42153   this.comboBox.OnApplyChangesInternal();
42154 },
42155 TrySelectItemAfterFilter: function() {
42156  var lb = this.GetListBoxControl();
42157  if(!lb) return false;
42158  var selectedItem;
42159  if(this.isDropDownListStyle)
42160   selectedItem = lb.GetVisibleItemCount() == 1 ? lb.GetItem(0) : null;
42161  else
42162   selectedItem = lb.FindItemByText(this.filter);
42163  if(selectedItem) {
42164   lb.SelectIndexSilent(selectedItem.index);
42165   this.comboBox.SetTextInternal(selectedItem.text);
42166  }
42167  return !!selectedItem;
42168 },
42169 IsEnabled: function() {
42170  return this.comboBox.GetEnabled();
42171 },
42172 Filtering: function(fromApi) {
42173  ASPx.ListEditIncrementalFilterStrategyBase.prototype.Filtering.call(this, fromApi);
42174  this.comboBox.EnsureClearButtonVisibility();
42175 },
42176 ShouldClearFilterBeforeFiltering: function(filter) {
42177  return this.TryRollbackLastSuccessText(this.GetInputFilterValue());
42178 },
42179 OnBeforeFiltering: function() {
42180  this.comboBox.onBeforeFiltering();
42181  this.EnsureDropDownAreaStateBeforeFiltering();
42182  if(this.isCallbackMode && !this.comboBox.droppedDown && this.comboBox.isNeedToForceFirstShowLoadingPanel)
42183   this.comboBox.ForceShowLoadingPanel();
42184 },
42185 OnAfterFiltering: function() {
42186  if(!this.isCallbackMode)
42187   this.ResetCallbackState();
42188 },
42189 OnFilteringCancelled: function(filteringFromApi) {
42190  if(this.comboBox.isCallbackMode) {
42191   var firstItem = this.GetListBoxControl().GetItem(0);
42192   if(firstItem && firstItem.selected) {
42193    this.HighlightTextAfterCallback(firstItem.text);
42194    this.EnsureDropDownAreaStateBeforeFiltering();
42195   }
42196   else if(filteringFromApi)
42197    this.EnsureDropDownAreaStateBeforeFiltering();
42198  }
42199  this.ResetCallbackState();
42200 },
42201 OnFilterRollback: function() {
42202  if(this.InCallback() && this.currentCallbackIsFiltration) 
42203   return;
42204  if(this.isCallbackMode && this.filterInitialized) {
42205   var listBox = this.GetListBoxControl();
42206   this.callbackProcessingStateManager.SetApplyAfterRollback();
42207   if(this.comboBox.GetText() != "" && this.comboBox.isDropDownListStyle) {
42208    listBox.ClearItems();
42209    this.needEmptyFilterBeforeFiltering = false;
42210    var currentSelectedItemCbArgs = ASPx.FilteringUtils.FormatCallbackArg(currentSelectedItemCallbackPrefix, "");
42211    this.comboBox.SendSpecialCallback(currentSelectedItemCbArgs);
42212   } else
42213    this.Filtering();
42214   this.SetFilter(this.comboBox.GetText());
42215   this.SetHighlighting(this.filter);
42216   this.ClearFilterApplied();
42217  }
42218 },
42219 NotifyCollectionChanged: function() {
42220  this.comboBox.CollectionChanged(true);
42221 },
42222 TryProcessFilterLessMinLength: function(oldFilter) {
42223  this.comboBox.onProcessFilterLessMinLength();
42224  this.ResetCallbackState();
42225  this.GetListBoxControl().SelectIndexSilent(-1, false);
42226  return true;
42227 },
42228 GetSelectedIndex: function() {
42229  return this.comboBox.GetSelectedIndex();
42230 },
42231 ResetCallbackState: function() {
42232  this.callbackProcessingStateManager.ResetState();
42233 },
42234 HighlightTextAfterCallback: function() { },
42235 IsCloseByEnterLocked: function() { return false; },
42236 TryRollbackLastSuccessText: function(filter) {
42237  if(this.comboBox.allowNull || filter) return false;
42238  var inpValue = this.comboBox.lastSuccessText;
42239  var inputElement = this.comboBox.GetInputElement();
42240  if(this.comboBox.HasTextDecorators()) {
42241   this.comboBox.SetRawValue(inpValue);
42242   if(this.comboBox.CanApplyTextDecorators())
42243    this.comboBox.SetInputValue(this.comboBox.GetDecoratedText(inpValue));
42244   else
42245    this.comboBox.SetInputValue(inpValue);
42246  }
42247  else if(inputElement.value != inpValue)
42248   this.comboBox.SetInputValue(inpValue);
42249  if(this.comboBox.focused)
42250   ASPx.Selection.Set(inputElement, 0, inputElement.value.length);
42251  var lb = this.comboBox.GetListBoxControl();
42252  if(lb) {
42253   if(this.comboBox.lastSuccessValue != null)
42254    lb.SetValue(this.comboBox.lastSuccessValue);
42255   else {
42256    var index = lb.FindItemIndexByText(this.comboBox.lastSuccessText);
42257    lb.SelectIndexSilent(index);
42258   }
42259  }
42260  this.comboBox.ShowCurrentItemImage();
42261  return true;
42262 },
42263 EnsureDropDownAreaStateBeforeFiltering: function() {
42264  var showDropDown = this.CanShowDropDownOnFocus(this.filter);
42265  if(this.callbackProcessingStateManager.NoFilterPostProcessing() && showDropDown) {
42266   var lb = this.GetListBoxControl();
42267   lb.LockScrollHandler();
42268   this.EnsureShowDropDownArea();
42269   lb.UnlockScrollHandler();
42270  } else if(!showDropDown)
42271   this.comboBox.HideDropDownArea();
42272 },
42273 EnsureShowDropDownArea: function() {
42274  if(!this.comboBox.droppedDown && this.comboBox.focused) {
42275   this.comboBox.CancelLoadCustomRangeOnDropDown();
42276   this.comboBox.ShowDropDownArea(true);
42277  }
42278 },
42279 CanShowDropDownOnFocus: function(filter) {
42280  if(filter != "")
42281   return true;
42282  return !!this.comboBox.showDropDownOnFocus ? this.comboBox.showDropDownOnFocus !== "Never" : true;
42283 },
42284 AllowEmptyFilterResults: function() {
42285  return !this.comboBox.isDropDownListStyle;
42286 },
42287 GetInputFilterValue: function() {
42288  var rawValue = this.comboBox.GetRawValue();
42289  return rawValue !== null && rawValue !== undefined ? rawValue : this.comboBox.GetInputElement().value;
42290 },
42291 GetListBoxControl: function() {
42292  return this.comboBox.GetListBoxControl();
42293 },
42294 OnBeforeFilteringOnClient: function(filter) {
42295  var comboBox = this.comboBox;
42296  if(comboBox.isDropDownListStyle) {
42297   if(this.GetInputFilterValue() != filter)
42298    comboBox.SetInputValue(filter);
42299   if(ASPx.IsExists(comboBox.GetRawValue()))
42300    comboBox.SetRawValue(filter);
42301   this.SetFilter(filter);
42302  }
42303  this.TryRollbackLastSuccessText(filter);
42304 },
42305 OnAfterFilteringOnClientCore: function (filter, firstSatisfyItemIndex) {
42306  if(firstSatisfyItemIndex !== -1 && this.CanShowDropDownOnFocus(filter))
42307   this.GetListBoxControl().CorrectCellWidthsOnFirstRowItemReplacement(0, firstSatisfyItemIndex);
42308  else {
42309   this.comboBox.onNoResultsFiltering();
42310   if(!this.comboBox.isDropDownModal())
42311    this.comboBox.HideDropDownArea(true);
42312  }
42313  this.needEmptyFilterBeforeFiltering = false;
42314 },
42315 FilteringStop: function() {
42316  if(!this.isCallbackMode)
42317   this.FilteringStopClient();
42318 },
42319 FilteringStopClient: function() {
42320  this.MakeAllItemsVisible();
42321  this.ClearFilter();
42322  this.DiscardHighlighting();
42323 },
42324 MakeAllItemsVisible: function() {
42325  ASPx.ListEditIncrementalFilterStrategyBase.prototype.MakeAllItemsVisible.call(this);
42326  this.NotifyCollectionChanged();
42327 },
42328 FilterNowAndApply: function() {
42329  this.callbackProcessingStateManager.SetApply();
42330  this.Filtering();
42331  if(!this.comboBox.isCallbackMode)
42332   this.comboBox.OnApplyChangesInternal();
42333 },
42334 InCallback: function() {
42335  return this.comboBox.InCallback();
42336 },
42337 OnCallbackCore: function(highlighting, newFilterLength) {
42338  if(this.currentCallbackIsFiltration) {
42339   var lb = this.GetListBoxControl();
42340   if(!lb.GetItemCount() || !this.CanShowDropDownOnFocus(this.filter)) {
42341    this.comboBox.onNoResultsFiltering();
42342    if(!this.comboBox.isDropDownModal())
42343     this.comboBox.HideDropDownArea(true);
42344   }
42345   else {
42346    this.OnFilterCallbackHighlightAndSelect(highlighting, newFilterLength);
42347    var isNeedToKeepDropDownVisible = !this.comboBox.isPerformCallback && this.callbackProcessingStateManager.NoFilterPostProcessing();
42348    if(!this.CanShowDropDownOnFocus(this.filter))
42349     this.comboBox.HideDropDownArea();
42350    else if(isNeedToKeepDropDownVisible)
42351     this.EnsureShowDropDownArea();
42352    this.OnEndFiltering();
42353   }
42354  }
42355  else
42356   this.RefreshHighlighting();
42357 },
42358 OnFilterCallbackHighlightAndSelect: function(highlighting, newFilterLength) {
42359  var listBox = this.GetListBoxControl();
42360  var firstItemText = listBox.GetItem(0).text;
42361  var isTextClearing = !this.comboBox.allowNull && this.IsEmptyFilter() && firstItemText;
42362  if(!isTextClearing) {
42363   var isFilterRollBack = this.CheckForFilterRollback(newFilterLength);
42364   var isNonFilterChangingCallback = (listBox.GetSelectedItem() == null);
42365   this.isTotallyMismatchedFilter = this.TryRollbackLastSuccessText(this.filter);
42366   var isNullState = this.comboBox.allowNull && !this.filter && !listBox.FindItemByText(this.filter);
42367   if(!this.isTotallyMismatchedFilter && !isNullState)
42368    this.SetHighlighting(this.filter, highlighting);
42369   if(!this.isTotallyMismatchedFilter && !isNullState && (isFilterRollBack || isNonFilterChangingCallback))
42370    this.HighlightTextAfterCallback(firstItemText);
42371   else
42372    this.DiscardHighlighting();
42373  }
42374  else
42375   this.TryRollbackLastSuccessText(this.filter);
42376 },
42377 CheckForFilterRollback: function(newFilterLength) {
42378  var filter = ASPx.Str.PrepareStringForFilter(this.filter);
42379  if(typeof(newFilterLength) === "number" && filter.length > newFilterLength) {
42380   this.SetFilter(filter.substring(0, newFilterLength));
42381   this.comboBox.SetInputValue(this.filter);
42382   return true;
42383  }
42384  return false;
42385 },
42386 SendCallbackCore: function() {
42387  this.comboBox.SendCallback();
42388 },
42389 SupportsFilterCorrection: function() {
42390  return this.isDropDownListStyle;
42391 },
42392 SetListBoxSuggestionSelection: function() {
42393  var lb = this.GetListBoxControl();
42394  var singleItem = lb && lb.GetVisibleItemCount() == 1;
42395  var canSuggest = this.comboBox.isDropDownListStyle && this.comboBox.droppedDown && singleItem;
42396  var itemIndex = -1;
42397  if(canSuggest) {
42398   itemIndex = lb.GetFirstFilteredItemIndex();
42399   this.comboBox.SelectIndexSilent(lb, itemIndex);
42400  }
42401  if(this.comboBox.accessibilityCompliant)
42402   this.comboBox.GetAccessibilityHelper().SetLabelAttribute(canSuggest ? lb.GetItem(itemIndex).text : this.GetInputFilterValue(), canSuggest);
42403 },
42404 FilteringBackspace: function() {
42405  var currentText = this.GetInputFilterValue();
42406  if(currentText.length)
42407   this.comboBox.SetInputValue(currentText.slice(0, -1));
42408  this.FilterStartTimer();
42409 },
42410 RaiseItemFilteringEvent: function(item, filter, isFit) {
42411  return this.comboBox.RaiseItemFiltering(item, filter, isFit);
42412 },
42413 RaiseCustomHighlightingEvent: function(filter, callbackHighlighting) {
42414  return this.comboBox.RaiseCustomHighlighting(filter, callbackHighlighting);
42415 }
42416});
42417var ComboBoxContainsFilterStrategy = ASPx.CreateClass(ComboBoxIncrementalFilterStrategyBase, {
42418 IsSatisfy: function(text, filter) {
42419  return ASPx.Str.PrepareStringForFilter(text).indexOf(filter) != -1;
42420 },
42421 OnDropDownHideArea: function() {
42422  if(!this.isCallbackMode)
42423   this.FilteringStopClient();
42424 },
42425 OnDropDownButtonClick: function() {
42426  var lb = this.GetListBoxControl();
42427  if(lb && lb.GetVisibleItemCount() == 0 && this.isDropDownListStyle)
42428   this.comboBox.OnCancelChanges();
42429 },
42430 OnTextChanged: function() {
42431  if(!this.comboBox.IsFocusEventsLocked())
42432   if(!this.comboBox.ChangedByEnterKeyPress())
42433    this.OnFilterRollback();
42434 },
42435 OnBeforeCallbackFinally: function () {
42436  this.RefreshHighlighting();
42437  this.SetListBoxSuggestionSelection();
42438  ComboBoxIncrementalFilterStrategyBase.prototype.OnBeforeCallbackFinally.call(this);
42439 },
42440 OnEndFiltering: function(visibleCollectionChanged) {
42441  ComboBoxIncrementalFilterStrategyBase.prototype.OnEndFiltering.call(this, visibleCollectionChanged);
42442  this.SetListBoxSuggestionSelection();
42443 },
42444 IsCloseByEnterLocked: function() {
42445  if(this.comboBox.isDropDownListStyle) {
42446   if(this.IsFilterTimerActive()) return false;
42447   var lb = this.GetListBoxControl();
42448   if(lb && lb.GetVisibleItemCount() == 1) return false;
42449   var selectedItem = this.comboBox.GetSelectedItem();
42450   if(selectedItem)
42451    if(this.GetInputFilterValue() == selectedItem.text)
42452     return false;
42453   return true;
42454  }
42455  return false;
42456 },
42457});
42458var ComboBoxStartsWithFilterStrategy = ASPx.CreateClass(ComboBoxIncrementalFilterStrategyBase, {
42459 HighlightTextAfterCallback: function(firstItemText) {
42460  var lb = this.GetListBoxControl();
42461  this.FilteringHighlightCompletedText(firstItemText);
42462  if(this.comboBox.accessibilityCompliant)
42463   this.comboBox.GetAccessibilityHelper().SetLabelAttribute(firstItemText, true);
42464  if(!this.comboBox.isPerformCallback)
42465   this.comboBox.SelectIndexSilent(lb, 0);
42466 },
42467 OnFirstSatisfiedItemFound: function(index, text, isTextClearing) {
42468  if(this.needEmptyFilterBeforeFiltering && isTextClearing) return;
42469  var lb = this.GetListBoxControl();
42470  if(!isTextClearing)
42471   this.FilteringHighlightCompletedText(text);
42472  this.comboBox.SelectIndexSilent(lb, isTextClearing ? -1 : index, true);
42473 },
42474 FilteringHighlightCompletedText: function(filterItemText) {
42475  var input = this.comboBox.GetInputElement();
42476  ASPx.StartWithFilteringUtils.HighlightSuggestedText(input, filterItemText, this.comboBox,
42477   this.comboBox.restartCurrentUserInputTimer.bind(this.comboBox));
42478  if(ASPx.IsExists(this.comboBox.GetRawValue()))
42479   this.comboBox.SyncRawValueIfHasTextDecorators(false);
42480 },
42481 IsSatisfy: function(text, filter) {
42482  return ASPx.Str.PrepareStringForFilter(text).indexOf(filter) == 0;
42483 },
42484 OnDropDownHideArea: function() {
42485  this.FilteringStop();
42486 },
42487 OnEndFiltering: function(visibleCollectionChanged) {
42488  ComboBoxIncrementalFilterStrategyBase.prototype.OnEndFiltering.call(this, visibleCollectionChanged);
42489  var selectedItem = this.GetListBoxControl().GetSelectedItem();
42490  if (selectedItem)
42491   this.GetListBoxControl().MakeItemVisible(selectedItem.index);
42492  if(this.comboBox.accessibilityCompliant) {
42493   this.comboBox.GetAccessibilityHelper().SetLabelAttribute(!!selectedItem ? selectedItem.text : this.GetInputFilterValue(), !!selectedItem);
42494  }
42495 },
42496 OnAfterEnter: function() {
42497  var inputElement = this.comboBox.GetInputElement();
42498  ASPx.Selection.SetCaretPosition(inputElement);
42499 },
42500 TrySelectItemAfterFilter: function() {
42501  var lb = this.GetListBoxControl();
42502  var selectedItem = lb.GetItem(0);
42503  return !!selectedItem;
42504 }
42505});
42506ASPx.ComboBoxDisabledFilterStrategy = ComboBoxDisabledFilterStrategy;
42507ASPx.ComboBoxContainsFilterStrategy = ComboBoxContainsFilterStrategy;
42508ASPx.ComboBoxStartsWithFilterStrategy = ComboBoxStartsWithFilterStrategy;
42509window.ASPxClientComboBoxBase = ASPxClientComboBoxBase;
42510window.ASPxClientComboBox = ASPxClientComboBox;
42511window.ASPxClientNativeComboBox = ASPxClientNativeComboBox;
42512})();
42513

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.