PageSourceSearch

https://sentradigital.com/DXR.axd?r=1_14,1_15,1_26,1_64,1_17,1_18,…1_24,1_25,1_140,1_233,1_20,1_42,1_235-c1xCh

js sentradigital.com collected 2026-10-02 19:04:05 UTC 1,221,653 bytes, 32,257 lines download raw bytes

1var ASPx = ASPx || {};
2var dx = dx || {};
3(function () {
4ASPx.EmptyObject = { };
5ASPx.FalseFunction = function() { return false; };
6ASPx.SSLSecureBlankUrl = '/DXR.axd?r=1_109-c1xCh';
7ASPx.EmptyImageUrl = '/DXR.axd?r=1_110-c1xCh';
8ASPx.VersionInfo = 'Version=\'18.1.6.0\', File Version=\'18.1.6.0\', Date Modified=\'10/17/2018 12:46:15 AM\'';
9ASPx.Platform = 'ASP';
10ASPx.InvalidDimension = -10000;
11ASPx.InvalidPosition = -10000;
12ASPx.AbsoluteLeftPosition = -10000;
13ASPx.EmptyGuid = "00000000-0000-0000-0000-000000000000";
14ASPx.CallbackSeparator = ":";
15ASPx.ItemIndexSeparator = "i";
16ASPx.CallbackResultPrefix = "/*DX*/";
17ASPx.AccessibilityEmptyUrl = "javascript:;";
18ASPx.AccessibilityPronounceTimeout = 500;
19ASPx.MaxMobileWindowWidth = 576;
20ASPx.PossibleNumberDecimalSeparators = [",", "."];
21ASPx.CultureInfo = {
22 twoDigitYearMax: 2029,
23 ts: ":",
24 ds: "/",
25 am: "AM",
26 pm: "PM",
27 monthNames: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", ""],
28 genMonthNames: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "
28November", "December", ""],
29 abbrMonthNames: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ""],
30 abbrDayNames: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
31 dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
32 invariantCultureDecimalPoint: ".",
33 numDecimalPoint: ".",
34 numPrec: 2,
35 numGroupSeparator: ",", 
36 numGroups: [ 3 ],
37 numNegPattern: 1,
38 numPosInf: "Infinity", 
39 numNegInf: "-Infinity", 
40 numNan: "NaN",
41 currency: "$",
42 currDecimalPoint: ".",
43 currPrec: 2,
44 currGroupSeparator: ",",
45 currGroups: [ 3 ],
46 currPosPattern: 0,
47 currNegPattern: 0,
48 percentPattern: 0,
49 shortTime: "h:mm tt",
50 longTime: "h:mm:ss tt",
51 shortDate: "M/d/yyyy",
52 longDate: "dddd, MMMM d, yyyy",
53 monthDay: "MMMM d",
54 yearMonth: "MMMM yyyy"
55};
56ASPx.CultureInfo.genMonthNames = ASPx.CultureInfo.monthNames;
57ASPx.Position = {
58 Left: "Left",
59 Right: "Right",
60 Top: "Top",
61 Bottom: "Bottom"
62};
63function setInnerHtmlInternal(el, trustedHtmlString) { 
64 el.innerHTML = trustedHtmlString;
65}
66var DateUtils = { };
67DateUtils.GetInvariantDateString = function(date) {
68 if(!date)
69  return "01/01/0001";
70 var day = date.getDate();
71 var month = date.getMonth() + 1;
72 var year = date.getFullYear();
73 var result = "";
74 if(month < 10)
75  result += "0";
76 result += month.toString() + "/";
77 if(day < 10)
78  result += "0";
79 result += day.toString() + "/";
80 if(year < 1000)
81  result += "0";
82 result += year.toString();
83 return result;
84};
85DateUtils.GetInvariantDateTimeString = function(date) {
86 var dateTimeString = DateUtils.GetInvariantDateString(date);
87 var time = {
88  h: date.getHours(),
89  m: date.getMinutes(),
90  s: date.getSeconds()
91 };
92 for(var key in time) {
93  if(time.hasOwnProperty(key)) {
94   var str = time[key].toString();
95   if(str.length < 2)
96    str = "0" + str;
97   time[key] = str;
98  }
99 }
100 dateTimeString += " " + time.h + ":" + time.m + ":" + time.s;
101 var msec = date.getMilliseconds();
102 if(msec > 0)
103  dateTimeString += "." + ("000" + msec.toString()).substr(-3);
104 return dateTimeString;
105};
106DateUtils.ExpandTwoDigitYear = function(value) {
107 value += 1900;
108 if(value + 99 < ASPx.CultureInfo.twoDigitYearMax)
109  value += 100;
110 return value;  
111};
112DateUtils.GetTimeZoneOffset = function(date) {
113 var utcFullYear = date.getUTCFullYear();
114 var utcDate = new Date(utcFullYear, date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(),
115  date.getUTCMinutes(), date.getUTCSeconds(), date.getUTCMilliseconds());
116 if (utcFullYear < 100)
117  utcDate.setFullYear(utcFullYear);
118 return utcDate - date;
119};
120DateUtils.ToUtcTime = function(date) {
121 var result = new Date();
122 result.setTime(date.valueOf() + ASPx.DateUtils.GetTimeZoneOffset(date));
123 return result;
124};
125DateUtils.ToLocalTime = function(date) {
126 var result = new Date();
127 result.setTime(date.valueOf() - ASPx.DateUtils.GetTimeZoneOffset(date));
128 return result; 
129};
130DateUtils.AreDatesEqualExact = function(date1, date2) {
131 if(date1 == null && date2 == null)
132  return true;
133 if(date1 == null || date2 == null)
134  return false;
135 return date1.getTime() == date2.getTime(); 
136};
137DateUtils.FixTimezoneGap = function(oldDate, newDate) {
138 var diff = newDate.getHours() - oldDate.getHours();
139 if(diff == 0)
140  return;
141 var sign = (diff == 1 || diff == -23) ? -1 : 1;
142 var trial = new Date(newDate.getTime() + sign * 3600000);
143 var isDateChangedAsExpected = newDate.getHours() - trial.getHours() === diff;
144 if(isDateChangedAsExpected && (sign > 0 || trial.getDate() == newDate.getDate()))
145  newDate.setTime(trial.getTime());
146};
147ASPx.DateUtils = DateUtils;
148var Timer = { };
149Timer.ClearTimer = function(timerID){
150 if(timerID > -1)
151  window.clearTimeout(timerID);
152 return -1;
153};
154Timer.ClearInterval = function(timerID){
155 if(timerID > -1)
156  window.clearInterval(timerID);
157 return -1;
158};
159var setControlBoundTimer = function(handler, control, setTimerFunction, clearTimerFunction, delay) {
160 var timerId;
161 var getTimerId = function() { return timerId; };
162 var boundHandler = function() {
163  var controlExists = control && ASPx.GetControlCollection().Get(control.name) === control && !control.IsDOMDisposed();
164  if(controlExists)
165   handler.aspxBind(control)();
166  else
167   clearTimerFunction(getTimerId());
168 };
169 timerId = setTimerFunction(boundHandler, delay);
170 return timerId;
171};
172Timer.SetControlBoundTimeout = function(handler, control, delay) {
173 return setControlBoundTimer(handler, control, window.setTimeout, Timer.ClearTimer, delay);
174};
175Timer.SetControlBoundInterval = function(handler, control, delay) {
176 return setControlBoundTimer(handler, control, window.setInterval, Timer.ClearInterval, delay);
177};
178Timer.Throttle = function(func, delay) {
179 var isThrottled = false,
180   savedArgs,
181   savedThis = this;
182 function wrapper() {
183  if(isThrottled) {
184   savedArgs = arguments;
185   savedThis = this;
186   return;
187  }
188  func.apply(this, arguments);
189  isThrottled = true;
190  setTimeout(function() {
191   isThrottled = false;
192   if(savedArgs) {
193    wrapper.apply(savedThis, savedArgs);
194    savedArgs = null;
195   }
196  }, delay);
197 }
198 wrapper.cancel = function() {
199  clearTimeout(delay);
200  delay = savedArgs = savedThis = null;
201 };
202 return wrapper;
203};
204ASPx.Timer = Timer;
205var Browser = { };
206Browser.UserAgent = navigator.userAgent.toLowerCase();
207Browser.Mozilla = false;
208Browser.IE = false;
209Browser.Firefox = false;
210Browser.Netscape = false;
211Browser.Safari = false;
212Browser.Chrome = false;
213Browser.Opera = false;
214Browser.Edge = false;
215Browser.Version = undefined; 
216Browser.MajorVersion = undefined; 
217Browser.WindowsPlatform = false;
218Browser.MacOSPlatform = false;
219Browser.MacOSMobilePlatform = false;
220Browser.AndroidMobilePlatform = false;
221Browser.PlaformMajorVersion = false;
222Browser.WindowsPhonePlatform = false;
223Browser.AndroidDefaultBrowser = false;
224Browser.AndroidChromeBrowser = false;
225Browser.SamsungAndroidDevice = false;
226Browser.WebKitTouchUI = false;
227Browser.MSTouchUI = false;
228Browser.TouchUI = false;
229Browser.WebKitFamily = false; 
230Browser.NetscapeFamily = false; 
231Browser.HardwareAcceleration = false;
232Browser.VirtualKeyboardSupported = false;
233Browser.Info = "";
234function indentPlatformMajorVersion(userAgent) {
235 var regex = /(?:(?:windows nt|macintosh|mac os|cpu os|cpu iphone os|android|windows phone|linux) )(\d+)(?:[-0-9_.])*/;
236 var matches = regex.exec(userAgent);
237 if(matches)
238  Browser.PlaformMajorVersion = matches[1];
239}
240function getIECompatibleVersionString() {
241 if(document.compatible) {
242  for(var i = 0; i < document.compatible.length; i++)
243   if(document.compatible[i].userAgent === "IE" && document.compatible[i].version)
244    return document.compatible[i].version.toLowerCase();
245 }
246 return "";
247}
248Browser.IdentUserAgent = function(userAgent, ignoreDocumentMode) {
249 var browserTypesOrderedList = [ "Mozilla", "IE", "Firefox", "Netscape", "Safari", "Chrome", "Opera", "Opera10", "Edge" ];
250 var defaultBrowserType = "IE";
251 var defaultPlatform = "Win";
252 var defaultVersions = { Safari: 2, Chrome: 0.1, Mozilla: 1.9, Netscape: 8, Firefox: 2, Opera: 9, IE: 6, Edge: 12 };
253 if(!userAgent || userAgent.length == 0) {
254  fillUserAgentInfo(browserTypesOrderedList, defaultBrowserType, defaultVersions[defaultBrowserType], defaultPlatform);
255  return;
256 }
257 userAgent = userAgent.toLowerCase();
258 indentPlatformMajorVersion(userAgent);
259 try {
260  var platformIdentStrings = {
261   "Windows": "Win",
262   "Macintosh": "Mac",
263   "Mac OS": "Mac",
264   "Mac_PowerPC": "Mac",
265   "cpu os": "MacMobile",
266   "cpu iphone os": "MacMobile",
267   "Android": "Android",
268   "!Windows Phone": "WinPhone",
269   "!WPDesktop": "WinPhone",
270   "!ZuneWP": "WinPhone"
271  };
272  var optSlashOrSpace = "(?:/|\\s*)?";
273  var version = "(\\d+)(?:\\.((?:\\d+?[1-9])|\\d)0*?)?";
274  var optVersion = "(?:" + version + ")?";
275  var patterns = {
276   Safari: "applewebkit(?:.*?(?:version/" + version + "[\\.\\w\\d]*?(?:\\s+mobile\/\\S*)?\\s+safari))?",
277   Chrome: "(?:chrome|crios)(?!frame)" + optSlashOrSpace + optVersion,
278   Mozilla: "mozilla(?:.*rv:" + optVersion + ".*Gecko)?",
279   Netscape: "(?:netscape|navigator)\\d*/?\\s*" + optVersion,
280   Firefox: "firefox" + optSlashOrSpace + optVersion,
281   Opera: "(?:opera|\sopr)" + optSlashOrSpace + optVersion,
282   Opera10: "opera.*\\s*version" + optSlashOrSpace + optVersion,
283   IE: "msie\\s*" + optVersion,
284   Edge: "edge" + optSlashOrSpace + optVersion
285  };
286  var browserType;
287  var version = -1;
288  for(var i = 0; i < browserTypesOrderedList.length; i++) {
289   var browserTypeCandidate = browserTypesOrderedList[i];
290   var regExp = new RegExp(patterns[browserTypeCandidate], "i");
291   if(regExp.compile)
292    regExp.compile(patterns[browserTypeCandidate], "i");
293   var matches = regExp.exec(userAgent);
294   if(matches && matches.index >= 0) {
295    if(browserType == "IE" && version >= 11 && browserTypeCandidate == "Safari") 
296     continue;
297    browserType = browserTypeCandidate;
298    if(browserType == "Opera10")
299     browserType = "Opera";
300    var tridentPattern = "trident" + optSlashOrSpace + optVersion;
301    version = Browser.GetBrowserVersion(userAgent, matches, tridentPattern, getIECompatibleVersionString());
302    if(browserType == "Mozilla" && version >= 11)
303     browserType = "IE";
304   }
305  }
306  if(!browserType)
307   browserType = defaultBrowserType;
308  var browserVersionDetected = version != -1;
309  if(!browserVersionDetected)
310   version = defaultVersions[browserType];
311  var platform;
312  var minOccurenceIndex = Number.MAX_VALUE;
313  for(var identStr in platformIdentStrings) {
314   if(!platformIdentStrings.hasOwnProperty(identStr)) continue;
315   var importantIdent = identStr.substr(0,1) == "!";
316   var occurenceIndex = userAgent.indexOf((importantIdent ? identStr.substr(1) : identStr).toLowerCase());
317   if(occurenceIndex >= 0 && (occurenceIndex < minOccurenceIndex || importantIdent)) {
318    minOccurenceIndex = importantIdent ? 0 : occurenceIndex;
319    platform = platformIdentStrings[identStr];
320   }
321  }
322  var samsungPattern = "SM-[A-Z]";
323  var matches = userAgent.toUpperCase().match(samsungPattern);
324  var isSamsungAndroidDevice = matches && matches.length > 0;
325  if(platform == "WinPhone" && version < 9)
326   version = Math.floor(getVersionFromTrident(userAgent, "trident" + optSlashOrSpace + optVersion));
327  if(!ignoreDocumentMode && browserType == "IE" && version > 7 && document.documentMode < version)
328   version = document.documentMode;
329  if(platform == "WinPhone")
330   version = Math.max(9, version);
331  if(!platform)
332   platform = defaultPlatform;
333  if(platform == platformIdentStrings["cpu os"] && !browserVersionDetected) 
334   version = 4;
335  fillUserAgentInfo(browserTypesOrderedList, browserType, version, platform, isSamsungAndroidDevice);
336 } catch(e) {
337  fillUserAgentInfo(browserTypesOrderedList, defaultBrowserType, defaultVersions[defaultBrowserType], defaultPlatform);
338 }
339};
340function getVersionFromMatches(matches) {
341 var result = -1;
342 var versionStr = "";
343 if(matches[1]) {
344  versionStr += matches[1];
345  if(matches[2])
346   versionStr += "." + matches[2];
347 }
348 if(versionStr != "") {
349  result = parseFloat(versionStr);
350  if(isNaN(result))
351   result = -1;
352 }
353 return result;
354}
355function getVersionFromTrident(userAgent, tridentPattern) {
356 var tridentDiffFromVersion = 4;
357 var matches = new RegExp(tridentPattern, "i").exec(userAgent);
358 return getVersionFromMatches(matches) + tridentDiffFromVersion;
359}
360Browser.GetBrowserVersion = function(userAgent, matches, tridentPattern, ieCompatibleVersionString) {
361 var version = getVersionFromMatches(matches);
362 if(ieCompatibleVersionString) {
363  var versionFromTrident = getVersionFromTrident(userAgent, tridentPattern);
364  if(ieCompatibleVersionString === "edge" || parseInt(ieCompatibleVersionString) === versionFromTrident)
365   return versionFromTrident;
366 }
367 return version;
368};
369function fillUserAgentInfo(browserTypesOrderedList, browserType, version, platform, isSamsungAndroidDevice) {
370 for(var i = 0; i < browserTypesOrderedList.length; i++) {
371  var type = browserTypesOrderedList[i];
372  Browser[type] = type == browserType;
373 }
374 Browser.Version = Math.floor(10.0 * version) / 10.0;
375 Browser.MajorVersion = Math.floor(Browser.Version);
376 Browser.WindowsPlatform = platform == "Win" || platform == "WinPhone";
377 Browser.MacOSPlatform = platform == "Mac";
378 Browser.MacOSMobilePlatform = platform == "MacMobile";
379 Browser.AndroidMobilePlatform = platform == "Android";
380 Browser.WindowsPhonePlatform = platform == "WinPhone";
381 Browser.WebKitFamily = Browser.Safari || Browser.Chrome || Browser.Opera && Browser.MajorVersion >= 15;
382 Browser.NetscapeFamily = Browser.Netscape || Browser.Mozilla || Browser.Firefox;
383 Browser.HardwareAcceleration = (Browser.IE && Browser.MajorVersion >= 9) || (Browser.Firefox && Browser.MajorVersion >= 4) || 
384  (Browser.AndroidMobilePlatform && Browser.Chrome) || (Browser.Chrome && Browser.MajorVersion >= 37) || 
385  (Browser.Safari && !Browser.WindowsPlatform) || Browser.Edge || (Browser.Opera && Browser.MajorVersion >= 46);
386 Browser.WebKitTouchUI = Browser.MacOSMobilePlatform || Browser.AndroidMobilePlatform;
387 var isIETouchUI = Browser.IE && Browser.MajorVersion > 9 && Browser.WindowsPlatform && Browser.UserAgent.toLowerCase().indexOf("touch") >= 0;
388 Browser.MSTouchUI = isIETouchUI || (Browser.Edge && !!window.navigator.maxTouchPoints);
389 Browser.TouchUI = Browser.WebKitTouchUI || Browser.MSTouchUI;
390 Browser.MobileUI = Browser.WebKitTouchUI || Browser.WindowsPhonePlatform;
391 Browser.AndroidDefaultBrowser = Browser.AndroidMobilePlatform && !Browser.Chrome;
392 Browser.AndroidChromeBrowser = Browser.AndroidMobilePlatform && Browser.Chrome;
393 if(isSamsungAndroidDevice)
394  Browser.SamsungAndroidDevice = isSamsungAndroidDevice;
395 if(Browser.MSTouchUI) {
396  var isARMArchitecture = Browser.UserAgent.toLowerCase().indexOf("arm;") > -1;    
397  Browser.VirtualKeyboardSupported = isARMArchitecture || Browser.WindowsPhonePlatform;   
398 } else {
399  Browser.VirtualKeyboardSupported = Browser.WebKitTouchUI;
400 }
401 fillDocumentElementBrowserTypeClassNames(browserTypesOrderedList);
402}
403function fillDocumentElementBrowserTypeClassNames(browserTypesOrderedList) {
404 var documentElementClassName = "";
405 var browserTypeslist = browserTypesOrderedList.concat(["WindowsPlatform", "MacOSPlatform", "MacOSMobilePlatform", "AndroidMobilePlatform",
406   "WindowsPhonePlatform", "WebKitFamily", "WebKitTouchUI", "MSTouchUI", "TouchUI", "AndroidDefaultBrowser"]);
407 for(var i = 0; i < browserTypeslist.length; i++) {
408  var type = browserTypeslist[i];
409  if(Browser[type])
410   documentElementClassName += "dx" + type + " ";
411 }
412 documentElementClassName += "dxBrowserVersion-" + Browser.MajorVersion;
413 if(document && document.documentElement) {
414  if(document.documentElement.className != "")
415   documentElementClassName = " " + documentElementClassName;
416  document.documentElement.className += documentElementClassName;
417  Browser.Info = documentElementClassName;
418 }
419}
420Browser.IdentUserAgent(Browser.UserAgent);
421ASPx.Browser = Browser;
422ASPx.BlankUrl = Browser.IE ? ASPx.SSLSecureBlankUrl : (Browser.Opera ? "about:blank" : "");
423var Data = { };
424Data.ArrayInsert = function(array, element, position){
425 if(0 <= position && position < array.length){
426  for(var i = array.length; i > position; i --)
427   array[i] = array[i - 1];
428  array[position] = element;
429 }
430 else
431  array.push(element);
432};
433Data.ArrayRemove = function(array, element){
434 var index = Data.ArrayIndexOf(array, element);
435 if(index > -1) Data.ArrayRemoveAt(array, index);
436};
437Data.ArrayRemoveAt = function(array, index){
438 if(index >= 0  && index < array.length){
439  for(var i = index; i < array.length - 1; i++)
440   array[i] = array[i + 1];
441  array.pop();
442 }
443};
444Data.ArrayClear = function(array){
445 while(array.length > 0)
446  array.pop();
447};
448Data.ArrayIndexOf = function(array, element, comparer) {
449 if(!comparer) {
450  for(var i = 0; i < array.length; i++) {
451   if(array[i] == element)
452    return i;
453  }
454 } else {
455  for(var i = 0; i < array.length; i++) {
456   if(comparer(array[i], element))
457    return i;
458  }
459 }
460 return -1;
461};
462Data.ArrayContains = function(array, element) { 
463 return Data.ArrayIndexOf(array, element) >= 0;
464};
465Data.ArrayEqual = function(array1, array2) {
466 var count1 = array1.length;
467 var count2 = array2.length;
468 if(count1 != count2)
469  return false;
470 for(var i = 0; i < count1; i++)
471  if(array1[i] != array2[i])
472   return false;
473 return true;
474};
475Data.ArraySame = function(array1, array2) {
476 if(array1.length !== array2.length)
477  return false;
478 return array1.every(function(elem) { return Data.ArrayContains(array2, elem); });
479};
480Data.ArrayGetIntegerEdgeValues = function(array) {
481 var arrayToSort = Data.CollectionToArray(array);
482 Data.ArrayIntegerAscendingSort(arrayToSort);
483 return {
484  start: arrayToSort[0],
485  end: arrayToSort[arrayToSort.length - 1]
486 };
487};
488Data.ArrayIntegerAscendingSort = function(array){
489 Data.ArrayIntegerSort(array);
490};
491Data.ArrayIntegerSort = function(array, desc) {
492 array.sort(function(i1, i2) {
493  var res = 0;
494  if(i1 > i2)
495   res = 1;
496  else if(i1 < i2)
497   res = -1;
498  if(desc)
499   res *= -1;
500  return res;
501 });
502};
503Data.CollectionsUnionToArray = function(firstCollection, secondCollection) {
504 var result = [];
505 var firstCollectionLength = firstCollection.length;
506 var secondCollectionLength = secondCollection.length;
507 for(var i = 0; i < firstCollectionLength + secondCollectionLength; i++) {
508  if(i < firstCollectionLength)
509   result.push(firstCollection[i]);
510  else
511   result.push(secondCollection[i - firstCollectionLength]);
512 }
513 return result;
514};
515Data.CollectionToArray = function(collection) {
516 var array = [];
517 for(var i = 0; i < collection.length; i++)
518  array.push(collection[i]);
519 return array;
520};
521Data.CreateHashTableFromArray = function(array) {
522 var hash = [];
523 for(var i = 0; i < array.length; i++)
524  hash[array[i]] = 1;
525 return hash;
526};
527Data.CreateIndexHashTableFromArray = function(array) {
528 var hash = [];
529 for(var i = 0; i < array.length; i++)
530  hash[array[i]] = i;
531 return hash;
532};
533Data.ArrayToHash = function(array, getKeyFunc, getValueFunc) {
534 if(!(array instanceof Array)) 
535  return { };
536 return array.reduce(function(map, element, index) { 
537  var key = getKeyFunc(element, index);
538  var value = getValueFunc(element, index);
539  map[key] = value;
540  return map; 
541 }, { });
542};
543Data.Sum = function(array, getValueFunc) {
544 if(!(array instanceof Array)) 
545  return 0;
546 return array.reduce(function(prevValue, item) {
547  var value = getValueFunc ? getValueFunc(item) : item;
548  if(!ASPx.IsNumber(value))
549   value = 0;
550  return prevValue + value;
551 }, 0);
552};
553Data.Min = function(array, getValueFunc) { return CalculateArrayMinMax(array, getValueFunc, false); };
554Data.Max = function(array, getValueFunc) { return CalculateArrayMinMax(array, getValueFunc, true); };
555var CalculateArrayMinMax = function(array, getValueFunc, isMax) {
556 if(!(array instanceof Array)) 
557  return 0;
558 var startValue = isMax ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY;
559 return array.reduce(function(prevValue, item) {
560  var value = getValueFunc ? getValueFunc(item) : item;
561  if(!ASPx.IsNumber(value))
562   value = startValue;
563  var func = isMax ? Math.max : Math.min;
564  return func(value, prevValue);
565 }, startValue);
566};
567var defaultBinarySearchComparer = function(array, index, value) {
568 var arrayElement = array[index];
569 if(arrayElement == value)
570  return 0;
571 else
572  return arrayElement < value ? -1 : 1;
573};
574Data.NearestLeftBinarySearchComparer = function(array, index, value) { 
575 var arrayElement = array[index];
576 var leftPoint = arrayElement < value;
577 var lastLeftPoint = leftPoint && index == array.length - 1;
578 var nearestLeftPoint = lastLeftPoint || (leftPoint && array[index + 1] >= value);
579 if(nearestLeftPoint)
580  return 0;
581 else
582  return arrayElement < value ? -1 : 1;
583};
584Data.ArrayBinarySearch = function(array, value, binarySearchComparer, startIndex, length) {
585 if(!binarySearchComparer)
586  binarySearchComparer = defaultBinarySearchComparer;
587 if(!ASPx.IsExists(startIndex))
588  startIndex = 0;
589 if(!ASPx.IsExists(length))
590  length = array.length - startIndex;
591 var endIndex = (startIndex + length) - 1;
592 while(startIndex <= endIndex) {
593  var middle = (startIndex + ((endIndex - startIndex) >> 1));
594  var compareResult = binarySearchComparer(array, middle, value);
595  if(compareResult == 0)
596   return middle;
597  if(compareResult < 0)
598   startIndex = middle + 1;
599  else
600   endIndex = middle - 1;
601 }
602 return -(startIndex + 1);
603};
604Data.ArrayFlatten = function(arrayOfArrays) {
605 return [].concat.apply([], arrayOfArrays);
606};
607Data.GetDistinctArray = function(array) {
608 var resultArray = [];
609 for(var i = 0; i < array.length; i++) {
610  var currentEntry = array[i];
611  if(Data.ArrayIndexOf(resultArray, currentEntry) == -1) {
612   resultArray.push(currentEntry);
613  }
614 }
615 return resultArray;
616};
617Data.ForEach = function(arr, callback) {
618 if(Array.prototype.forEach) {
619  Array.prototype.forEach.call(arr, callback);
620 } else {
621  for(var i = 0, len = arr.length; i < len; i++) {
622   callback(arr[i], i, arr);
623  }
624 }
625};
626Data.MergeHashTables = function(target, object) {
627 if(!object || typeof (object) == "string")
628  return target;
629 if(!target)
630  target = {};
631 for(var key in object)
632  if(key && !(key in target))
633   target[key] = object[key];
634 return target;
635};
636Data.Range = function(count, start) {
637 count = parseInt(count) || 0;
638 start = parseInt(start) || 0;
639 if(count < 0) count = 0;
640 if(start < 0) start = 0;
641 return Array.apply(null, Array(count)).map(function(val, i) { return start + i; });
642};
643ASPx.Data = Data;
644var Cookie = { };
645Cookie.DelCookie = function(name){
646 setCookieInternal(name, "", new Date(1970, 1, 1));
647};
648Cookie.GetCookie = function(name) {
649 name = escape(name);
650 var cookies = document.cookie.split(';');
651 for(var i = 0; i < cookies.length; i++) {
652  var cookie = Str.Trim(cookies[i]);
653  if(cookie.indexOf(name + "=") == 0)
654   return unescape(cookie.substring(name.length + 1, cookie.length));
655  else if(cookie.indexOf(name + ";") == 0 || cookie === name)
656   return "";
657 }
658 return null;
659};
660Cookie.SetCookie = function(name, value, expirationDate){
661 if(!ASPx.IsExists(value)) {
662  Cookie.DelCookie(name);
663  return;
664 }
665 if(!ASPx.Ident.IsDate(expirationDate)) {
666  expirationDate = new Date();
667  expirationDate.setFullYear(expirationDate.getFullYear() + 1);
668 }
669 setCookieInternal(name, value, expirationDate);
670};
671function setCookieInternal(name, value, date){
672 document.cookie = escape(name) + "=" + escape(value.toString()) + "; expires=" + date.toGMTString() + "; path=/";
673}
674ASPx.Cookie = Cookie;
675ASPx.ImageUtils = {
676 GetImageSrc: function (image){
677  return image.src;
678 },
679 SetImageSrc: function(image, src){
680  if(isSourceResetRequired())
681   image.src = "";
682  image.src = src;
683 },
684 SetSize: function(image, width, height){
685  image.style.width = width + "px";
686  image.style.height = height + "px";
687 },
688 GetSize: function(image, isWidth){
689  return (isWidth ? image.offsetWidth : image.offsetHeight);
690 }
691};
692var Str = { };
693Str.ApplyReplacement = function(text, replecementTable) {
694 if(typeof(text) != "string")
695  text = text.toString();
696 for(var i = 0; i < replecementTable.length; i++) {
697  var replacement = replecementTable[i];
698  text = text.replace(replacement[0], replacement[1]);
699 }
700 return text;
701};
702Str.CompleteReplace = function(text, regexp, newSubStr) {
703 if(typeof(text) != "string")
704  text = text.toString();
705 var textPrev;
706 do {
707  textPrev = text;
708  text = text.replace(regexp, newSubStr);
709 } while(text != textPrev);
710 return text;
711};
712Str.EncodeHtml = function(html) {
713 return Str.ApplyReplacement(html, [
714  [ /&amp;/g,  '&ampx;'  ], [ /&/g, '&amp;'  ],
715  [ /&quot;/g, '&quotx;' ], [ /"/g, '&quot;' ],
716  [ /&lt;/g,   '&ltx;'   ], [ /</g, '&lt;'   ],
717  [ /&gt;/g,   '&gtx;'   ], [ />/g, '&gt;'   ]
718 ]);
719};
720Str.DecodeHtml = function(html) {
721 return Str.ApplyReplacement(html, [
722  [ /&gt;/g,   '>' ], [ /&gtx;/g,  '&gt;'   ],
723  [ /&lt;/g,   '<' ], [ /&ltx;/g,  '&lt;'   ],
724  [ /&quot;/g, '"' ], [ /&quotx;/g,'&quot;' ],
725  [ /&amp;/g,  '&' ], [ /&ampx;/g, '&amp;'  ]
726 ]);
727};
728Str.DecodeHtmlViaTextArea = function(html) {
729 var textArea = document.createElement("TEXTAREA");
730 setInnerHtmlInternal(textArea, html);
731 return textArea.value;
732};
733Str.TrimStart = function(str) { 
734 return trimInternal(str, true);
735};
736Str.TrimEnd = function(str) { 
737 return trimInternal(str, false, true);
738};
739Str.Trim = function(str) { 
740 return trimInternal(str, true, true); 
741};
742Str.EscapeForRegEx = function(str) {
743 return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
744};
745var whiteSpaces = { 
746 0x0009: 1, 0x000a: 1, 0x000b: 1, 0x000c: 1, 0x000d: 1, 0x0020: 1, 0x0085: 1, 
747 0x00a0: 1, 0x1680: 1, 0x180e: 1, 0x2000: 1, 0x2001: 1, 0x2002: 1, 0x2003: 1, 
748 0x2004: 1, 0x2005: 1, 0x2006: 1, 0x2007: 1, 0x2008: 1, 0x2009: 1, 0x200a: 1, 
749 0x200b: 1, 0x2028: 1, 0x2029: 1, 0x202f: 1, 0x205f: 1, 0x3000: 1
750};
751var caretWidth = 1;
752function trimInternal(source, trimStart, trimEnd) {
753 var len = source.length;
754 if(!len)
755  return source;
756 if(len < 0xBABA1) { 
757  var result = source;
758  if(trimStart) {
759   result = result.replace(/^\s+/, "");
760  }
761  if(trimEnd) {
762   result = result.replace(/\s+$/, "");
763  }
764  return result;  
765 } else {
766  var start = 0;
767  if(trimEnd) {   
768   while(len > 0 && whiteSpaces[source.charCodeAt(len - 1)]) {
769    len--;
770   }
771  }
772  if(trimStart && len > 0) {
773   while(start < len && whiteSpaces[source.charCodeAt(start)]) { 
774    start++; 
775   }   
776  }
777  return source.substring(start, len);
778 }
779}
780Str.Insert = function(str, subStr, index) { 
781 var leftText = str.slice(0, index);
782 var rightText = str.slice(index);
783 return leftText + subStr + rightText;
784};
785Str.InsertEx = function(str, subStr, startIndex, endIndex) { 
786 var leftText = str.slice(0, startIndex);
787 var rightText = str.slice(endIndex);
788 return leftText + subStr + rightText;
789};
790var greekSLFSigmaChar = String.fromCharCode(962);
791var greekSLSigmaChar = String.fromCharCode(963);
792Str.PrepareStringForFilter = function(s){
793 s = s.toLowerCase();
794 if(ASPx.Browser.WebKitFamily) {
795  return s.replace(new RegExp(greekSLFSigmaChar, "g"), greekSLSigmaChar);
796 }
797 return s;
798};
799Str.GetCoincideCharCount = function(text, filter, textMatchingDelegate) {
800 var coincideText = ASPx.Str.PrepareStringForFilter(filter);
801 var originText = ASPx.Str.PrepareStringForFilter(text);
802 while(coincideText != "" && !textMatchingDelegate(originText, coincideText)) {
803  coincideText = coincideText.slice(0, -1);
804 }
805 return coincideText.length;
806};
807ASPx.Str = Str;
808var Xml = { };
809Xml.Parse = function(xmlStr) {
810 if(window.DOMParser) {
811  var parser = new DOMParser();
812  return parser.parseFromString(xmlStr, "text/xml");
813 }
814 else if(window.ActiveXObject) {
815  var xmlDoc = new window.ActiveXObject("Microsoft.XMLDOM");
816  if(xmlDoc) {
817   xmlDoc.async = false;
818   xmlDoc.loadXML(xmlStr);
819   return xmlDoc;
820  }
821 }
822 return null;
823};
824ASPx.Xml = Xml;
825ASPx.Key = {
826 F1     : 112,
827 F2     : 113,
828 F3     : 114,
829 F4     : 115,
830 F5     : 116,
831 F6     : 117,
832 F7     : 118,
833 F8     : 119,
834 F9     : 120,
835 F10    : 121,
836 F11    : 122,
837 F12    : 123,
838 Ctrl   : 17,
839 Shift  : 16,
840 Alt    : 18,
841 Enter  : 13,
842 Home   : 36,
843 End    : 35,
844 Left   : 37,
845 Right  : 39,
846 Up     : 38,
847 Down   : 40,
848 PageUp    : 33,
849 PageDown  : 34,
850 Esc    : 27,
851 Space  : 32,
852 Tab    : 9,
853 Backspace : 8,
854 Delete    : 46,
855 Insert    : 45,
856 ContextMenu  : 93,
857 Windows   : 91,
858 Decimal   : 110
859};
860ASPx.ModifierKey = {
861 None: 0,
862 Ctrl: 1 << (0 + 16),
863 Shift: 1 << (2 + 16),
864 Alt: 1 << (4 + 16),
865 Meta: 1 << (8 + 16)
866};
867ASPx.KeyCode = {
868 Backspace : 8,
869 Tab    : 9,
870 Enter  : 13,
871 Pause  : 19,
872 CapsLock  : 20,
873 Esc    : 27,
874 Space  : 32,
875 PageUp    : 33,
876 PageDown  : 34,
877 End    : 35,
878 Home   : 36,
879 Left   : 37,
880 Up     : 38,
881 Right  : 39,
882 Down   : 40,
883 Insert    : 45,
884 Delete    : 46,
885 Key_0  : 48,
886 Key_1  : 49,
887 Key_2  : 50,
888 Key_3  : 51,
889 Key_4  : 52,
890 Key_5  : 53,
891 Key_6  : 54,
892 Key_7  : 55,
893 Key_8  : 56,
894 Key_9  : 57,
895 Key_a  : 65,
896 Key_b  : 66,
897 Key_c  : 67,
898 Key_d  : 68,
899 Key_e  : 69,
900 Key_f  : 70,
901 Key_g  : 71,
902 Key_h  : 72,
903 Key_i  : 73,
904 Key_j  : 74,
905 Key_k  : 75,
906 Key_l  : 76,
907 Key_m  : 77,
908 Key_n  : 78,
909 Key_o  : 79,
910 Key_p  : 80,
911 Key_q  : 81,
912 Key_r  : 82,
913 Key_s  : 83,
914 Key_t  : 84,
915 Key_u  : 85,
916 Key_v  : 86,
917 Key_w  : 87,
918 Key_x  : 88,
919 Key_y  : 89,
920 Key_z  : 90,
921 Windows   : 91,
922 ContextMenu  : 93,
923 Numpad_0  : 96,
924 Numpad_1  : 97,
925 Numpad_2  : 98,
926 Numpad_3  : 99,
927 Numpad_4  : 100,
928 Numpad_5  : 101,
929 Numpad_6  : 102,
930 Numpad_7  : 103,
931 Numpad_8  : 104,
932 Numpad_9  : 105,
933 Multiply  : 106,
934 Add    : 107,
935 Subtract  : 109,
936 Decimal   : 110,
937 Divide    : 111,
938 F1     : 112,
939 F2     : 113,
940 F3     : 114,
941 F4     : 115,
942 F5     : 116,
943 F6     : 117,
944 F7     : 118,
945 F8     : 119,
946 F9     : 120,
947 F10    : 121,
948 F11    : 122,
949 F12    : 123,
950 NumLock   : 144,
951 ScrollLock   : 145,
952 Semicolon : 186,
953 Equals    : 187,
954 Comma  : 188,
955 Dash   : 189,
956 Period    : 190,
957 ForwardSlash : 191,
958 GraveAccent  : 192,
959 OpenBracket  : 219,
960 BackSlash : 220,
961 CloseBracket : 221,
962 SingleQuote  : 222
963};
964ASPx.ScrollBarMode = { Hidden: 0, Visible: 1, Auto: 2 };
965ASPx.ColumnResizeMode = { None: 0, Control: 1, NextColumn: 2 };
966var Selection = { };
967Selection.Set = function(input, startPos, endPos, scrollToSelection) {
968 if(!ASPx.IsExistsElement(input))
969  return;
970 if(Browser.VirtualKeyboardSupported && (ASPx.GetActiveElement() !== input || ASPx.VirtualKeyboardUI.getInputNativeFocusLocked()))
971  return;
972 var textLen = input.value.length;
973 startPos = ASPx.GetDefinedValue(startPos, 0);
974 endPos = ASPx.GetDefinedValue(endPos, textLen);
975 if(startPos < 0)
976  startPos = 0;
977 if(endPos < 0 || endPos > textLen)
978  endPos = textLen;
979 if(startPos > endPos)
980  startPos = endPos;
981 var makeReadOnly = false;
982 if(Browser.WebKitFamily && input.readOnly) {
983  input.readOnly = false;
984  makeReadOnly = true;
985 }
986 try {
987  if(Browser.Firefox && Browser.Version >= 8) 
988   input.setSelectionRange(startPos, endPos, "backward");
989  else if(Browser.IE && input.createTextRange) {
990   var range = input.createTextRange();
991   range.collapse(true);
992   range.moveStart("character", startPos);
993   range.moveEnd("character", endPos - startPos);
994   range.select();
995  } else {
996   forceScrollToSelectionRange(input, startPos, endPos);
997   input.setSelectionRange(startPos, endPos);
998  }
999  if(Browser.Opera || Browser.Firefox || Browser.Chrome) 
1000   input.focus();
1001 } catch(e) { 
1002 }
1003 if(scrollToSelection && input.tagName == 'TEXTAREA') {
1004  var scrollHeight = input.scrollHeight;
1005  var approxCaretPos = startPos;
1006  var scrollTop = Math.max(Math.round(approxCaretPos * scrollHeight / textLen  - input.clientHeight / 2), 0);
1007  input.scrollTop = scrollTop;
1008 }
1009 if(makeReadOnly)
1010  input.readOnly = true;
1011};
1012var getTextWidthBeforePos = function(input, pos) {
1013 return ASPx.GetSizeOfText(input.value.toString().substr(0, pos), ASPx.GetCurrentStyle(input)).width;
1014};
1015var forceScrollToSelectionRange = function(input, startPos, endPos) {
1016 var widthBeforeStartPos = getTextWidthBeforePos(input, startPos) - caretWidth;
1017 var widthBeforeEndPos = getTextWidthBeforePos(input, endPos) + caretWidth;
1018 var inputRawWidth = input.offsetWidth - ASPx.GetLeftRightBordersAndPaddingsSummaryValue(input);
1019 if(input.scrollLeft < widthBeforeEndPos - inputRawWidth)
1020  input.scrollLeft = widthBeforeEndPos - inputRawWidth;
1021 else if(input.scrollLeft > widthBeforeStartPos)
1022  input.scrollLeft = widthBeforeStartPos;
1023};
1024Selection.GetInfo = function(input) {
1025 var start, end;
1026 if(Browser.IE && Browser.Version < 9) {
1027  var range = document.selection.createRange();
1028  var rangeCopy = range.duplicate();
1029  range.move('character', -input.value.length);
1030  range.setEndPoint('EndToStart', rangeCopy);
1031  start = range.text.length;
1032  end = start + rangeCopy.text.length;
1033 } else {
1034  try {
1035   start = input.selectionStart;
1036   end = input.selectionEnd;
1037  } catch (e) {
1038  }
1039 }
1040 return { startPos: start, endPos: end };
1041};
1042Selection.GetExtInfo = function(input) {
1043 var start = 0, end = 0, textLen = 0;
1044 if(Browser.IE && Browser.Version < 9) {
1045  var normalizedValue;
1046  var range, textInputRange, textInputEndRange;
1047  range = document.selection.createRange();
1048  if(range && range.parentElement() == input) {
1049   textLen = input.value.length;
1050   normalizedValue = input.value.replace(/\r\n/g, "\n");
1051   textInputRange = input.createTextRange();
1052   textInputRange.moveToBookmark(range.getBookmark());
1053   textInputEndRange = input.createTextRange();
1054   textInputEndRange.collapse(false);
1055   if(textInputRange.compareEndPoints("StartToEnd", textInputEndRange) > -1) {
1056    start = textLen;
1057    end = textLen;
1058   } else {
1059    start = normalizedValue.slice(0, start).split("\n").length - textInputRange.moveStart("character", -textLen) -1;
1060    if(textInputRange.compareEndPoints("EndToEnd", textInputEndRange) > -1)
1061     end = textLen;
1062    else
1063     end = normalizedValue.slice(0, end).split("\n").length - textInputRange.moveEnd("character", -textLen) - 1;    
1064   }
1065  }
1066  return {startPos: start, endPos: end};
1067 }
1068 try {
1069  start = input.selectionStart;
1070  end = input.selectionEnd;
1071 } catch (e) {
1072 }
1073 return {startPos: start, endPos: end}; 
1074};
1075Selection.SetCaretPosition = function(input, caretPos) {
1076 if(typeof caretPos === "undefined" || caretPos < 0)
1077  caretPos = input.value.length;
1078 Selection.Set(input, caretPos, caretPos, true);
1079};
1080Selection.GetCaretPosition = function(element, isDialogMode) {
1081 var pos = 0;
1082 if("selectionStart" in element) {
1083  pos = element.selectionStart;
1084 } else if("selection" in document) {
1085  element.focus();
1086  var sel = document.selection.createRange(),
1087   selLength = document.selection.createRange().text.length;
1088  sel.moveStart("character", -element.value.length);
1089  pos = sel.text.length - selLength;
1090 }
1091 if(isDialogMode && !pos) {
1092  pos = element.value.length - 1;
1093 }
1094 return pos;
1095};
1096Selection.Clear = function() {
1097 try {
1098  if(window.getSelection) {
1099   window.getSelection().removeAllRanges();
1100  }
1101  else if(document.selection) {
1102   if(document.selection.empty)
1103    document.selection.empty();
1104   else if(document.selection.clear)
1105    document.selection.clear();
1106  }
1107 } catch(e) {
1108 }
1109};
1110Selection.ClearOnMouseMove = function(evt) {
1111 if(!Browser.IE || (evt.button != 0)) 
1112  Selection.Clear();
1113};
1114Selection.SetElementSelectionEnabled = function(element, value) {
1115 var userSelectValue = value ? "" : "none";
1116 var func = value ? Evt.DetachEventFromElement : Evt.AttachEventToElement;
1117 if(Browser.Firefox)
1118  element.style.MozUserSelect = userSelectValue;
1119 else if(Browser.WebKitFamily)
1120  element.style.webkitUserSelect = userSelectValue;
1121 else if(Browser.IE && Browser.Version > 10 || Browser.Edge)
1122  element.style.msUserSelect = userSelectValue;
1123 else if(Browser.Opera)
1124  func(element, "mousemove", Selection.Clear);
1125 else {
1126  func(element, "selectstart", ASPx.FalseFunction);
1127  func(element, "mousemove", Selection.Clear);
1128 }
1129};
1130Selection.SetElementAsUnselectable = function(element, isWithChild, recursive) {
1131 if(element && element.nodeType == 1) {
1132  element.unselectable = "on";
1133  if(Browser.NetscapeFamily)
1134   element.onmousedown = ASPx.FalseFunction;
1135  if((Browser.IE && Browser.Version >= 9) || Browser.WebKitFamily)
1136   Evt.AttachEventToElement(element, "mousedown", Evt.PreventEventAndBubble);
1137  if(isWithChild === true){
1138   for(var j = 0; j < element.childNodes.length; j ++)
1139    Selection.SetElementAsUnselectable(element.childNodes[j], (!!recursive ? true : false), (!!recursive));
1140  }
1141 }
1142};
1143Selection.AreEqual = function(selection1, selection2) {
1144 return selection1.startPos === selection2.startPos && selection1.endPos === selection2.endPos;
1145};
1146ASPx.Selection = Selection;
1147var MouseScroller = { };
1148MouseScroller.MinimumOffset = 10;
1149MouseScroller.Create = function(getElement, getScrollXElement, getScrollYElement, needPreventScrolling, vertRecursive, onMouseDown, onMouseMove, onMouseUp, onMouseUpMissed) {
1150 var element = getElement();
1151 if(!element) 
1152  return;
1153 if(!element.dxMouseScroller)
1154  element.dxMouseScroller = new MouseScroller.Extender(getElement, getScrollXElement, getScrollYElement, needPreventScrolling, vertRecursive, onMouseDown, onMouseMove, onMouseUp, onMouseUpMissed);
1155 return element.dxMouseScroller;
1156};
1157MouseScroller.Extender = function(getElement, getScrollXElement, getScrollYElement, needPreventScrolling, vertRecursive, onMouseDown, onMouseMove, onMouseUp, onMouseUpMissed) {
1158 this.getElement = getElement;
1159 this.getScrollXElement = getScrollXElement;
1160 this.getScrollYElement = getScrollYElement;
1161 this.needPreventScrolling = needPreventScrolling;
1162 this.vertRecursive = !!vertRecursive;
1163 this.createHandlers(onMouseDown || function() { }, onMouseMove || function() { }, onMouseUp || function() { }, onMouseUpMissed || function() { });
1164 this.update();
1165};
1166MouseScroller.Extender.prototype = {
1167 update: function() {
1168  if(this.element)
1169   Evt.DetachEventFromElement(this.element, ASPx.TouchUIHelper.touchMouseDownEventName, this.mouseDownHandler);
1170  this.element = this.getElement();
1171  Evt.AttachEventToElement(this.element, ASPx.TouchUIHelper.touchMouseDownEventName, this.mouseDownHandler);  
1172  Evt.AttachEventToElement(this.element, "click", this.mouseClickHandler);   
1173  if(Browser.MSTouchUI && this.element.className.indexOf(ASPx.TouchUIHelper.msTouchDraggableClassName) < 0)
1174   this.element.className += " " + ASPx.TouchUIHelper.msTouchDraggableClassName;
1175  this.scrollXElement = this.getScrollXElement();
1176  this.scrollYElement = this.getScrollYElement();
1177 },
1178 createHandlers: function(onMouseDown, onMouseMove, onMouseUp, onMouseUpMissed) {
1179  var mouseDownCounter = 0;
1180  this.onMouseDown = onMouseDown;
1181  this.onMouseMove = onMouseMove;
1182  this.onMouseUp = onMouseUp;  
1183  this.mouseDownHandler = function(e) {
1184   if(mouseDownCounter++ > 0) {
1185    this.finishScrolling();
1186    onMouseUpMissed();
1187   }
1188   var eventSource = Evt.GetEventSource(e);
1189   var requirePreventCustonScroll = ASPx.IsExists(ASPx.TouchUIHelper.RequirePreventCustomScroll) && ASPx.TouchUIHelper.RequirePreventCustomScroll(eventSource, this.element);
1190   this.requirePreventScroll = requirePreventCustonScroll || this.needPreventScrolling && this.needPreventScrolling(eventSource);
1191   if(this.requirePreventScroll)
1192    return;
1193   this.scrollableTreeLine = this.GetScrollableElements();
1194   this.firstX = this.prevX = Evt.GetEventX(e);
1195   this.firstY = this.prevY = Evt.GetEventY(e);
1196   Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseMoveEventName, this.mouseMoveHandler);
1197   Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseUpEventName, this.mouseUpHandler);
1198   this.onMouseDown(e);
1199  }.aspxBind(this);
1200  this.mouseMoveHandler = function(e) {
1201   if(ASPx.TouchUIHelper.isGesture)
1202    return;
1203   var x = Evt.GetEventX(e);
1204   var y = Evt.GetEventY(e);
1205   var xDiff = this.prevX - x;
1206   var yDiff = this.prevY - y;
1207   if(this.vertRecursive) {
1208    var isTopDirection = yDiff < 0;
1209    this.scrollYElement = this.GetElementForVertScrolling(isTopDirection, this.prevIsTopDirection, this.scrollYElement);
1210    this.prevIsTopDirection = isTopDirection;
1211   }
1212   if(this.scrollXElement && xDiff != 0)
1213    this.scrollXElement.scrollLeft += xDiff;
1214   if(this.scrollYElement && yDiff != 0) {
1215    this.scrollYElement.scrollTop += yDiff;
1216    var isOuterScrollableElement = this.scrollableTreeLine[this.scrollableTreeLine.length - 1] == this.scrollYElement;
1217    if(isOuterScrollableElement)
1218     y += yDiff;
1219   }
1220   this.prevX = x;
1221   this.prevY = y;
1222   e.preventDefault();
1223   this.onMouseMove(e);
1224  }.aspxBind(this);
1225  this.mouseUpHandler = function(e) {
1226   this.finishScrolling();
1227   this.onMouseUp(e);
1228  }.aspxBind(this);
1229  this.mouseClickHandler = function(e){
1230   if(this.requirePreventScroll)
1231    return;
1232   var xDiff = this.firstX - Evt.GetEventX(e);
1233   var yDiff = this.firstY - Evt.GetEventY(e);
1234   if(xDiff > MouseScroller.MinimumOffset || yDiff > MouseScroller.MinimumOffset)
1235    return Evt.PreventEventAndBubble(e);
1236  }.aspxBind(this);
1237  this.finishScrolling = function() {
1238   Evt.DetachEventFromDocument(ASPx.TouchUIHelper.touchMouseMoveEventName, this.mouseMoveHandler);
1239   Evt.DetachEventFromDocument(ASPx.TouchUIHelper.touchMouseUpEventName, this.mouseUpHandler);
1240   this.scrollableTreeLine = [];
1241   this.prevIsTopDirection = null;
1242   mouseDownCounter--;
1243  };
1244 },
1245 GetScrollableElements: function() {
1246  if(!this.vertRecursive) return [ ];
1247  var outerScrollableElementTag = ASPx.Browser.IE ? "HTML" : "BODY";
1248  return ASPx.GetElementTreeLine(this.element, null, function(el) { return el == document; })
1249   .filter(function(el) { return ASPx.IsScrollableElement(el, false, true) || el.tagName == outerScrollableElementTag; }.bind(this));
1250 },
1251 GetElementForVertScrolling: function(currentIsTop, prevIsTop, prevElement) {
1252  if(prevElement && currentIsTop === prevIsTop && this.GetVertScrollExcess(prevElement, currentIsTop) > 0)
1253   return prevElement;
1254  for(var i = 0; i < this.scrollableTreeLine.length; i++) {
1255   var element = this.scrollableTreeLine[i];
1256   var excess = this.GetVertScrollExcess(element, currentIsTop);
1257   if(excess > 0)
1258    return element;
1259  }
1260  return null;
1261 },
1262 GetVertScrollExcess: function(element, isTop) {
1263  if(isTop)
1264   return element.scrollTop;
1265  var isBodyElement = element.tagName == "BODY";
1266  var clientHeight = isBodyElement ? ASPx.GetDocumentClientHeight() : element.clientHeight;
1267  return element.scrollHeight - clientHeight - element.scrollTop;
1268 }
1269};
1270ASPx.MouseScroller = MouseScroller;
1271var Evt = { };
1272Evt.GetEvent = function(evt){
1273 return (typeof(event) != "undefined" && event != null && Browser.IE) ? event : evt; 
1274};
1275Evt.IsEventPrevented = function(evt) {
1276 return evt.defaultPrevented || evt.returnValue === false;
1277};
1278Evt.PreventEvent = function(evt){
1279 if(evt.preventDefault)
1280  evt.preventDefault();
1281 else
1282  evt.returnValue = false;
1283 return false;
1284};
1285Evt.PreventEventAndBubble = function(evt){
1286 Evt.PreventEvent(evt);
1287 if(evt.stopPropagation)
1288  evt.stopPropagation();
1289 evt.cancelBubble = true;
1290 return false;
1291};
1292Evt.CancelBubble = function(evt){
1293 evt.cancelBubble = true;
1294 return false;
1295};
1296Evt.PreventImageDragging = function(image) {
1297 if(image)
1298  image.ondragstart = function() { return false; };
1299};
1300Evt.PreventDragStart = function(evt) {
1301 evt = Evt.GetEvent(evt);
1302 var element = Evt.GetEventSource(evt);
1303 if(element.releaseCapture)
1304  element.releaseCapture(); 
1305 return false;
1306};
1307Evt.PreventElementDrag = function(element) {
1308 if(Browser.IE)
1309  Evt.AttachEventToElement(element, "dragstart", Evt.PreventEvent);
1310 else
1311  Evt.AttachEventToElement(element, "mousedown", Evt.PreventEvent);
1312};
1313Evt.PreventElementDragAndSelect = function(element, skipMouseMove, skipIESelect){
1314 if(Browser.WebKitFamily)
1315  Evt.AttachEventToElement(element, "selectstart", Evt.PreventEventAndBubble);
1316 if(Browser.IE){
1317  if(!skipIESelect)
1318   Evt.AttachEventToElement(element, "selectstart", ASPx.FalseFunction);
1319  if(!skipMouseMove)
1320   Evt.AttachEventToElement(element, "mousemove", Selection.ClearOnMouseMove);
1321  Evt.AttachEventToElement(element, "dragstart", Evt.PreventDragStart);
1322 }
1323};
1324Evt.GetEventSource = function(evt){
1325 if(!ASPx.IsExists(evt)) return null; 
1326 return evt.srcElement ? evt.srcElement : evt.target;
1327};
1328Evt.GetKeyCode = function(srcEvt) {
1329 return Browser.NetscapeFamily || Browser.Opera ? srcEvt.which : srcEvt.keyCode;
1330};
1331function clientEventRequiresDocScrollCorrection() {
1332 var isSafariVerLess3 = Browser.Safari && Browser.Version < 3,
1333  isMacOSMobileVerLess51 = Browser.MacOSMobilePlatform && Browser.Version < 5.1;
1334 return Browser.AndroidDefaultBrowser || Browser.AndroidChromeBrowser || !(isSafariVerLess3 || isMacOSMobileVerLess51);
1335}
1336Evt.GetEventX = function(evt){
1337 if(ASPx.TouchUIHelper.isTouchEvent(evt))
1338  return ASPx.TouchUIHelper.getEventX(evt);
1339 return evt.clientX + (clientEventRequiresDocScrollCorrection() ? ASPx.GetDocumentScrollLeft() : 0);
1340};
1341Evt.GetEventY = function(evt){
1342 if(ASPx.TouchUIHelper.isTouchEvent(evt))
1343  return ASPx.TouchUIHelper.getEventY(evt);
1344 return evt.clientY + (clientEventRequiresDocScrollCorrection() ? ASPx.GetDocumentScrollTop() : 0 );
1345};
1346Evt.IsLeftButtonPressed = function(evt) {
1347 if(ASPx.TouchUIHelper.isTouchEvent(evt))
1348  return true;
1349 evt = Evt.GetEvent(evt);
1350 if(!evt) return false;
1351 if(Browser.IE && Browser.Version < 11) {
1352  if(Browser.MSTouchUI)
1353   return true;
1354  return evt.button % 2 == 1; 
1355 } else if(Browser.WebKitFamily) {
1356  if(evt.type === "pointermove")
1357   return evt.buttons === 1;
1358  return evt.which == 1;
1359 } else if(Browser.NetscapeFamily || Browser.Edge || (Browser.IE && Browser.Version >= 11)) {
1360  if(evt.type === ASPx.TouchUIHelper.touchMouseMoveEventName)
1361   return evt.buttons === 1;
1362  return evt.which == 1;
1363 } else if(Browser.Opera)
1364  return evt.button == 0;
1365 return true;
1366};
1367Evt.IsRightButtonPressed = function(evt){
1368 evt = Evt.GetEvent(evt);
1369 if(!ASPx.IsExists(evt)) return false;
1370 if(Browser.IE || Browser.Edge) {
1371  if(evt.type === "pointermove")
1372   return evt.buttons === 2;
1373  return evt.button == 2;
1374 }
1375 else if(Browser.NetscapeFamily || Browser.WebKitFamily)
1376  return evt.which == 3;
1377 else if (Browser.Opera)
1378  return evt.button == 1;
1379 return true;
1380};
1381Evt.GetWheelDelta = function(evt) {
1382 var ret;
1383 if(Browser.NetscapeFamily && Browser.MajorVersion < 17)
1384  ret = -evt.detail;
1385 else if(Browser.Safari)
1386  ret = evt.wheelDelta;
1387 else
1388  ret = -evt.deltaY;
1389 if(Browser.Opera && Browser.Version < 9)
1390  ret = -ret;
1391 return ret;
1392};
1393Evt.IsWheelEventWithDirection = function(evt) {
1394 return ASPx.Data.ArrayContains(["wheel", "mousewheel"], evt.type);
1395};
1396Evt.GetWheelDeltaX = function(evt) {
1397 if(evt.type === "wheel")
1398  return -evt.deltaX;
1399 if(evt.type === "mousewheel")
1400  return evt.wheelDeltaX;
1401};
1402Evt.GetWheelDeltaY = function(evt) {
1403 if(evt.type === "wheel")
1404  return -evt.deltaY;
1405 if(evt.type === "mousewheel")
1406  return evt.wheelDeltaY;
1407};
1408Evt.AttachEventToElement = function(element, eventName, func, onlyBubbling) {
1409 if(element.addEventListener)
1410  element.addEventListener(eventName, func, !onlyBubbling);
1411 else
1412  element.attachEvent("on" + eventName, func);
1413};
1414Evt.DetachEventFromElement = function(element, eventName, func) {
1415 if(element.removeEventListener)
1416  element.removeEventListener(eventName, func, true);
1417 else
1418  element.detachEvent("on" + eventName, func);
1419};
1420Evt.AttachEventToDocument = function(eventName, func) {
1421 var attachingAllowed = ASPx.TouchUIHelper.onEventAttachingToDocument(eventName, func);
1422 if(attachingAllowed)
1423  Evt.AttachEventToDocumentCore(eventName, func);
1424};
1425Evt.AttachEventToDocumentCore = function(eventName, func) {
1426 Evt.AttachEventToElement(document, eventName, func);
1427};
1428Evt.DetachEventFromDocument = function(eventName, func) {
1429 Evt.DetachEventFromDocumentCore(eventName, func);
1430 ASPx.TouchUIHelper.onEventDettachedFromDocument(eventName, func);
1431};
1432Evt.DetachEventFromDocumentCore = function(eventName, func){
1433 Evt.DetachEventFromElement(document, eventName, func);
1434};
1435Evt.GetMouseWheelEventName = function() {
1436 if(Browser.Safari)
1437  return "mousewheel";
1438 if(Browser.NetscapeFamily && Browser.MajorVersion < 17)
1439  return "DOMMouseScroll";
1440 return "wheel";
1441};
1442Evt.AttachMouseEnterToElement = function (element, onMouseOverHandler, onMouseOutHandler) {
1443 Evt.AttachEventToElement(element, ASPx.TouchUIHelper.pointerEnabled ? ASPx.TouchUIHelper.pointerOverEventName : "mouseover", function (evt) { mouseEnterHandler(evt, element, onMouseOverHandler, onMouseOutHandler); });
1444 Evt.AttachEventToElement(element, ASPx.TouchUIHelper.pointerEnabled ? ASPx.TouchUIHelper.pointerOutEventName : "mouseout", function (evt) { mouseEnterHandler(evt, element, onMouseOverHandler, onMouseOutHandler); });
1445};
1446Evt.GetEventRelatedTarget = function(evt, isMouseOverEvent) {
1447 return evt.relatedTarget || (isMouseOverEvent ? evt.srcElement : evt.toElement);
1448};
1449function mouseEnterHandler(evt, element, onMouseOverHandler, onMouseOutHandler) {
1450 var isMouseOverExecuted = !!element.dxMouseOverExecuted;
1451 var isMouseOverEvent = (evt.type == "mouseover" || evt.type == ASPx.TouchUIHelper.pointerOverEventName);
1452 if(isMouseOverEvent && isMouseOverExecuted || !isMouseOverEvent && !isMouseOverExecuted)
1453  return;
1454 var source = Evt.GetEventRelatedTarget(evt, isMouseOverEvent);
1455 if(!ASPx.GetIsParent(element, source)) {
1456  element.dxMouseOverExecuted = isMouseOverEvent;
1457  if(isMouseOverEvent)
1458   onMouseOverHandler(element);
1459  else
1460   onMouseOutHandler(element);
1461 }
1462 else if(isMouseOverEvent && !isMouseOverExecuted) {
1463  element.dxMouseOverExecuted = true;
1464  onMouseOverHandler(element);
1465 }
1466}
1467Evt.DispatchEvent = function(target, eventName, canBubble, cancellable) {
1468 var event;
1469 if(Browser.IE && Browser.Version < 9) {
1470  eventName = "on" + eventName;
1471  if(eventName in target) {
1472   event = document.createEventObject();
1473   target.fireEvent("on" + eventName, event);
1474  }
1475 } else {
1476  event = document.createEvent("Event");
1477  event.initEvent(eventName, canBubble || false, cancellable || false);
1478  target.dispatchEvent(event);
1479 }
1480};
1481Evt.EmulateDocumentOnMouseDown = function(evt) {
1482 Evt.EmulateOnMouseDown(document, evt);
1483};
1484Evt.EmulateOnMouseDown = function(element, evt) {
1485 if(Browser.IE && Browser.Version < 9)
1486  element.fireEvent("onmousedown", evt);
1487 else if(!Browser.WebKitFamily){
1488  var emulatedEvt = document.createEvent("MouseEvents");
1489  emulatedEvt.initMouseEvent("mousedown", true, true, window, 0, evt.screenX, evt.screenY, 
1490   evt.clientX, evt.clientY, evt.ctrlKey, evt.altKey, evt.shiftKey, false, 0, null);
1491  element.dispatchEvent(emulatedEvt);
1492 }
1493};
1494Evt.EmulateOnMouseEvent = function (type, element, evt) {
1495 evt.type = type;
1496 var emulatedEvt = document.createEvent("MouseEvents");
1497 emulatedEvt.initMouseEvent(type, true, true, window, 0, evt.screenX, evt.screenY,
1498  evt.clientX, evt.clientY, evt.ctrlKey, evt.altKey, evt.shiftKey, false, 0, null);
1499 emulatedEvt.target = element;
1500 element.dispatchEvent(emulatedEvt);
1501};
1502Evt.EmulateMouseClick = function (element, evt) {
1503 var x = element.offsetWidth / 2;
1504 var y = element.offsetHeight / 2;
1505 if (!evt)
1506  evt = {
1507   bubbles: true,
1508   cancelable: true,
1509   view: window,
1510   detail: 1,
1511   screenX: 0,
1512   screenY: 0,
1513   clientX: x,
1514   clientY: y,
1515   ctrlKey: false,
1516   altKey: false,
1517   shiftKey: false,
1518   metaKey: false,
1519   button: 0,
1520   relatedTarget: null
1521  };
1522 Evt.EmulateOnMouseEvent("mousedown", element, evt);
1523 Evt.EmulateOnMouseEvent("mouseup", element, evt);
1524 Evt.EmulateOnMouseEvent("click", element, evt);
1525};
1526Evt.DoElementClick = function(element) {
1527 try{
1528  element.click();
1529 }
1530 catch(e){ 
1531 }
1532};
1533Evt.IsActionKeyPressed = function(evt) {
1534 return evt.keyCode === ASPx.Key.Space ||
1535     evt.keyCode === ASPx.Key.Enter ||
1536    (evt.keyCode === ASPx.Key.Down && evt.altKey);
1537};
1538Evt.InvokeMouseClickByKeyDown = function(evt, handler) {
1539 if(Evt.IsActionKeyPressed(evt)) {
1540  ASPx.Evt.PreventEvent(evt); 
1541  if(!handler)
1542   ASPx.Evt.GetEventSource(evt).onclick();
1543  else
1544   handler(evt);
1545 }
1546};
1547Evt.AttachContextMenuToElement = function (element, handler, onlyBubbling) {
1548 if (ASPx.TouchUIHelper.useLongTapHelper())
1549  element.detachContextMenuEventHandler = ASPx.TouchUIHelper.attachLongTapHandler(element, handler, onlyBubbling);
1550 else
1551  Evt.AttachEventToElement(element, "contextmenu", handler, onlyBubbling);
1552};
1553Evt.DetachContextMenuFromElement = function (element, handler) {
1554 if (element.detachContextMenuEventHandler)
1555  element.detachContextMenuEventHandler();
1556 else
1557  Evt.DetachEventFromElement(element, "contextmenu", handler);
1558};
1559ASPx.Evt = Evt;
1560var Attr = { };
1561Attr.GetAttribute = function(obj, attrName){
1562 if(obj.getAttribute)
1563  return obj.getAttribute(attrName);
1564 else if(obj.getPropertyValue) {
1565  if(Browser.Firefox) { 
1566   try {
1567    return obj.getPropertyValue(attrName);
1568   } catch(e) {
1569    return obj[attrName];
1570   }
1571  }
1572  return obj.getPropertyValue(attrName);
1573 }
1574 return null;
1575};
1576Attr.SetAttribute = function(obj, attrName, value){
1577 if(obj.setAttribute) {
1578  if(isSourceResetRequired() && attrName.toLowerCase() === "src") 
1579   obj.setAttribute(attrName, "");
1580  obj.setAttribute(attrName, value);
1581 } else if(obj.setProperty)
1582  obj.setProperty(attrName, value, "");
1583};
1584Attr.RemoveAttribute = function(obj, attrName){
1585 if(obj.removeAttribute)
1586  obj.removeAttribute(attrName);
1587 else if(obj.removeProperty)
1588  obj.removeProperty(attrName);
1589};
1590Attr.IsExistsAttribute = function(obj, attrName){
1591 var value = Attr.GetAttribute(obj, attrName);
1592 return (value != null) && (value !== "");
1593};
1594Attr.SetOrRemoveAttribute = function(obj, attrName, value) {
1595 if(!value)
1596  Attr.RemoveAttribute(obj, attrName);
1597 else
1598  Attr.SetAttribute(obj, attrName, value);
1599};
1600Attr.SaveAttribute = function(obj, attrName, savedObj, savedAttrName){
1601 if(!Attr.IsExistsAttribute(savedObj, savedAttrName)){
1602  var oldValue = Attr.IsExistsAttribute(obj, attrName) ? Attr.GetAttribute(obj, attrName) : ASPx.EmptyObject;
1603  Attr.SetAttribute(savedObj, savedAttrName, oldValue);
1604 }
1605};
1606Attr.SaveStyleAttribute = function(obj, attrName){
1607 Attr.SaveAttribute(obj.style, attrName, obj, "saved" + attrName);
1608};
1609Attr.ChangeAttributeExtended = function(obj, attrName, savedObj, savedAttrName, newValue){
1610 Attr.SaveAttribute(obj, attrName, savedObj, savedAttrName);
1611 Attr.SetAttribute(obj, attrName, newValue);
1612};
1613Attr.ChangeAttribute = function(obj, attrName, newValue){
1614 Attr.ChangeAttributeExtended(obj, attrName, obj, "saved" + attrName, newValue);
1615};
1616Attr.ChangeStyleAttribute = function(obj, attrName, newValue){
1617 Attr.ChangeAttributeExtended(obj.style, attrName, obj, "saved" + attrName, newValue);
1618};
1619Attr.ResetAttributeExtended = function(obj, attrName, savedObj, savedAttrName){
1620 Attr.SaveAttribute(obj, attrName, savedObj, savedAttrName);
1621 Attr.SetAttribute(obj, attrName, "");
1622 Attr.RemoveAttribute(obj, attrName);
1623};
1624Attr.ResetAttribute = function(obj, attrName){
1625 Attr.ResetAttributeExtended(obj, attrName, obj, "saved" + attrName);
1626};
1627Attr.ResetStyleAttribute = function(obj, attrName){
1628 Attr.ResetAttributeExtended(obj.style, attrName, obj, "saved" + attrName);
1629};
1630Attr.RestoreAttributeExtended = function(obj, attrName, savedObj, savedAttrName){
1631 if(Attr.IsExistsAttribute(savedObj, savedAttrName)){
1632  var oldValue = Attr.GetAttribute(savedObj, savedAttrName);
1633  if(oldValue != ASPx.EmptyObject)
1634   Attr.SetAttribute(obj, attrName, oldValue);
1635  else
1636   Attr.RemoveAttribute(obj, attrName);
1637  Attr.RemoveAttribute(savedObj, savedAttrName);
1638  return true;
1639 }
1640 return false;
1641};
1642Attr.RestoreAttribute = function(obj, attrName){
1643 return Attr.RestoreAttributeExtended(obj, attrName, obj, "saved" + attrName);
1644};
1645Attr.RestoreStyleAttribute = function(obj, attrName){
1646 return Attr.RestoreAttributeExtended(obj.style, attrName, obj, "saved" + attrName);
1647};
1648Attr.CopyAllAttributes = function(sourceElem, destElement) {
1649 var attrs = sourceElem.attributes;
1650 for(var n = 0; n < attrs.length; n++) {
1651  var attr = attrs[n];
1652  if(attr.specified) {
1653   var attrName = attr.nodeName;
1654   var attrValue = sourceElem.getAttribute(attrName, 2);
1655   if(attrValue == null)
1656    attrValue = attr.nodeValue;
1657   destElement.setAttribute(attrName, attrValue, 0); 
1658  }
1659 }
1660 if(sourceElem.style.cssText !== '')
1661  destElement.style.cssText = sourceElem.style.cssText;
1662};
1663Attr.RemoveAllAttributes = function(element, excludedAttributes) {
1664 var excludedAttributesHashTable = {};
1665 if(excludedAttributes)
1666  excludedAttributesHashTable = Data.CreateHashTableFromArray(excludedAttributes);
1667 if(element.attributes) {
1668  var attrArray = element.attributes;
1669  for(var i = 0; i < attrArray.length; i++) {
1670   var attrName = attrArray[i].name;
1671   if(!ASPx.IsExists(excludedAttributesHashTable[attrName.toLowerCase()])) {
1672    try {
1673     attrArray.removeNamedItem(attrName);
1674    } catch (e) { }
1675   }
1676  }
1677 }
1678};
1679Attr.RemoveStyleAttribute = function(element, attrName) {
1680 if(element.style) {
1681  if(Browser.Firefox && element.style[attrName]) 
1682   element.style[attrName] = "";
1683  if(element.style.removeAttribute && element.style.removeAttribute != "")
1684   element.style.removeAttribute(attrName);
1685  else if(element.style.removeProperty && element.style.removeProperty != "")
1686   element.style.removeProperty(attrName);
1687 }
1688};
1689Attr.RemoveAllStyles = function(element) {
1690 if(element.style) {
1691  for(var key in element.style)
1692   Attr.RemoveStyleAttribute(element, key);
1693    Attr.RemoveAttribute(element, "style");
1694 }
1695};
1696Attr.GetTabIndexAttributeName = function(){
1697 return Browser.IE  ? "tabIndex" : "tabindex";
1698};
1699Attr.ChangeTabIndexAttribute = function(element){
1700 var attribute = Attr.GetTabIndexAttributeName(); 
1701 if(Attr.GetAttribute(element, attribute) != -1)
1702    Attr.ChangeAttribute(element, attribute, -1);
1703};
1704Attr.SaveTabIndexAttributeAndReset = function(element) {
1705 var attribute = Attr.GetTabIndexAttributeName();
1706 Attr.SaveAttribute(element, attribute, element, "saved" + attribute);
1707 Attr.SetAttribute(element, attribute, -1);
1708};
1709Attr.RestoreTabIndexAttribute = function(element){
1710 var attribute = Attr.GetTabIndexAttributeName();
1711 if(Attr.IsExistsAttribute(element, attribute)) {
1712  if(Attr.GetAttribute(element, attribute) == -1) {
1713   if(Attr.IsExistsAttribute(element, "saved" + attribute)){
1714    var oldValue = Attr.GetAttribute(element, "saved" + attribute);
1715    if(oldValue != ASPx.EmptyObject)
1716     Attr.SetAttribute(element, attribute, oldValue);
1717    else {
1718     if(Browser.WebKitFamily) 
1719      Attr.SetAttribute(element, attribute, 0); 
1720     Attr.RemoveAttribute(element, attribute);   
1721    }
1722    Attr.RemoveAttribute(element, "saved" + attribute); 
1723   }
1724  }
1725 }
1726};
1727Attr.ChangeAttributesMethod = function(enabled){
1728 return enabled ? Attr.RestoreAttribute : Attr.ResetAttribute;
1729};
1730Attr.InitiallyChangeAttributesMethod = function(enabled){
1731 return enabled ? Attr.ChangeAttribute : Attr.ResetAttribute;
1732};
1733Attr.ChangeStyleAttributesMethod = function(enabled){
1734 return enabled ? Attr.RestoreStyleAttribute : Attr.ResetStyleAttribute;
1735};
1736Attr.InitiallyChangeStyleAttributesMethod = function(enabled){
1737 return enabled ? Attr.ChangeStyleAttribute : Attr.ResetStyleAttribute;
1738};
1739Attr.ChangeEventsMethod = function(enabled){
1740 return enabled ? Evt.AttachEventToElement : Evt.DetachEventFromElement;
1741};
1742Attr.ChangeDocumentEventsMethod = function(enabled){
1743 return enabled ? Evt.AttachEventToDocument : Evt.DetachEventFromDocument;
1744};
1745Attr.ChangeCellSpanCount = function(cell, value, isColumnSpan) {
1746 if(!cell) return;
1747 var propertyKey = isColumnSpan ? "colSpan" : "rowSpan";
1748 var prevValue = cell[propertyKey];
1749 if(value > 1)
1750  cell[propertyKey] = value;
1751 else if(prevValue !== 1)
1752  Attr.RemoveAttribute(cell, propertyKey);
1753};
1754function isSourceResetRequired() {
1755 return Browser.IE && Browser.MajorVersion >= 11;
1756}
1757ASPx.Attr = Attr;
1758var Aria = {
1759 atomic: "aria-atomic",
1760 checked: "aria-checked",
1761 descendant: "aria-activedescendant",
1762 described: "aria-describedby",
1763 disabled: "aria-disabled",
1764 expanded: "aria-expanded",
1765 haspopup: "aria-haspopup",
1766 invalid: "aria-invalid",
1767 label: "aria-label",
1768 labelled: "aria-labelledby",
1769 level: "aria-level",
1770 owns: "aria-owns",
1771 posinset: "aria-posinset",
1772 role: "role",
1773 selected: "aria-selected",
1774 setsize: "aria-setsize",
1775 valuemax: "aria-valuemax",
1776 valuemin: "aria-valuemin",
1777 valuenow: "aria-valuenow"
1778};
1779Aria.SetOrRemoveDescendant = function(obj, value) {
1780 ASPx.Attr.SetOrRemoveAttribute(obj, Aria.descendant, value);
1781};
1782Aria.SetOrRemoveLabel = function(obj, value) {
1783 ASPx.Attr.SetOrRemoveAttribute(obj, Aria.label, value);
1784};
1785Aria.AppendLabel = function(obj, value, checkExists) {
1786 var currentValue = ASPx.Attr.GetAttribute(obj, Aria.label) || "";
1787 var resultParts = [ ];
1788 if(currentValue)
1789  resultParts.push(currentValue);
1790 var needAppendValue = value && (!checkExists || currentValue.indexOf(value) == -1);
1791 if(needAppendValue)
1792  resultParts.push(value);
1793 ASPx.Attr.SetAttribute(obj, Aria.label, resultParts.join(" "));
1794};
1795Aria.SetOrRemoveLabelled = function(obj, value) {
1796 ASPx.Attr.SetOrRemoveAttribute(obj, Aria.labelled, value);
1797};
1798Aria.SetApplicationRole = function(obj) {
1799  ASPx.Attr.SetAttribute(obj, Aria.role, "application");
1800};
1801Aria.SetSilence = function(obj) {
1802 ASPx.Attr.SetAttribute(obj, Aria.label, ";");
1803};
1804Aria.SetExpanded = function(obj, expanded) {
1805 if(!obj || !ASPx.Attr.GetAttribute(obj, Aria.expanded)) return;
1806 Aria.SetBoolAttribute(obj, Aria.expanded, expanded);
1807};
1808Aria.SetAtomic = function(obj, value) {
1809 Aria.SetBoolAttribute(obj, Aria.atomic, value);
1810};
1811Aria.SetBoolAttribute = function(obj, attribute, value) {
1812 if(value)
1813  ASPx.Attr.SetAttribute(obj, attribute, true);
1814 else 
1815  ASPx.Attr.SetAttribute(obj, attribute, false);
1816};
1817ASPx.Attr.Aria = Aria;
1818var Color = { };
1819function _aspxToHex(d) {
1820 return (d < 16) ? ("0" + d.toString(16)) : d.toString(16);
1821}
1822Color.RGBRegexp = /rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/;
1823Color.ColorToHexadecimal = function(colorValue) {
1824 if(typeof(colorValue) == "number") {
1825  var r = colorValue & 0xFF;
1826  var g = (colorValue >> 8) & 0xFF;
1827  var b = (colorValue >> 16) & 0xFF;
1828  return "#" + _aspxToHex(r) + _aspxToHex(g) + _aspxToHex(b);
1829 }
1830 if(colorValue && (colorValue.substr(0, 3).toLowerCase() == "rgb")) {
1831  var regResult = colorValue.toLowerCase().match(Color.RGBRegexp);
1832  if(regResult) {
1833   var r = parseInt(regResult[1]);
1834   var g = parseInt(regResult[2]);
1835   var b = parseInt(regResult[3]);
1836   return "#" + _aspxToHex(r) + _aspxToHex(g) + _aspxToHex(b);
1837  }
1838  return null;
1839 } 
1840 if(colorValue && (colorValue.charAt(0) == "#"))
1841  return colorValue;
1842 return null;
1843};
1844Color.Names = {
1845 AddColorNames: function(stringResourcesObj) {
1846  if(stringResourcesObj) {
1847   for(var key in stringResourcesObj)
1848    if(stringResourcesObj.hasOwnProperty(key))
1849     this[key] = stringResourcesObj[key];
1850  }
1851 }
1852};
1853ASPx.Color = Color;
1854var Url = { };
1855Url.Navigate = function(url, target) {
1856 var javascriptPrefix = "javascript:";
1857 if(!url || url === "")
1858  return;
1859 else if(url.indexOf(javascriptPrefix) != -1) 
1860  eval(url.substr(javascriptPrefix.length));
1861 else {
1862  try{
1863   if(target != "")
1864    navigateTo(url, target);
1865   else
1866    location.href = url;
1867  }
1868  catch(e){
1869  }
1870 }
1871};
1872Url.NavigateByLink = function(linkElement) {
1873 Url.Navigate(Attr.GetAttribute(linkElement, "href"), linkElement.target);
1874};
1875Url.GetAbsoluteUrl = function(url) {
1876 if(url)
1877  url = Url.getURLObject(url).href;
1878 return url;
1879};
1880Url.Redirect = function(url) {
1881 if(!ASPx.Browser.IE)
1882  window.location.href = url;
1883 else { 
1884  var fakeLink = document.createElement("a");
1885  fakeLink.href = url;
1886  document.body.appendChild(fakeLink);
1887  try { fakeLink.click(); } catch(e) { } 
1888 }
1889};
1890var absolutePathPrefixes = 
1891 [ "about:", "file:///", "ftp://", "gopher://", "http://", "https://", "javascript:", "mailto:", "news:", "res://", "telnet://", "view-source:" ];
1892Url.isAbsoluteUrl = function(url) {
1893 if (url) {
1894  for (var i = 0; i < absolutePathPrefixes.length; i++) {
1895   if(url.indexOf(absolutePathPrefixes[i]) == 0)
1896    return true;
1897  }
1898 }
1899 return false;
1900};
1901Url.getURLObject = function(url) {
1902 var link = document.createElement('A');
1903 link.href = url || "";
1904 return { 
1905  href: link.href,
1906  protocol: link.protocol,
1907  host: link.host,
1908  port: link.port,
1909  pathname: link.pathname,
1910  search: link.search,
1911  hash: link.hash
1912 }; 
1913};
1914Url.getRootRelativeUrl = function(url) {
1915 return getRelativeUrl(url, !Url.isRootRelativeUrl(url), true); 
1916};
1917Url.getPathRelativeUrl = function(url) {
1918 return getRelativeUrl(url, !Url.isPathRelativeUrl(url), false);
1919};
1920function getRelativeUrl(url, isValid, isRootRelative) {
1921 if(url && !(/data:([^;]+\/?[^;]*)(;charset=[^;]*)?(;base64,)/.test(url)) && isValid) {
1922  var urlObject = Url.getURLObject(url);
1923  var baseUrlObject = Url.getURLObject();
1924  if(!Url.isAbsoluteUrl(url) || urlObject.host === baseUrlObject.host && urlObject.protocol === baseUrlObject.protocol) {
1925   url = urlObject.pathname;
1926   if(!isRootRelative)
1927    url = getPathRelativeUrl(baseUrlObject.pathname, url);
1928   url = url + urlObject.search + urlObject.hash;
1929  }
1930 }
1931 return url;   
1932}
1933function getPathRelativeUrl(baseUrl, url) {
1934 var requestSegments = getSegments(baseUrl, false);
1935 var urlSegments = getSegments(url, true);
1936 return buildPathRelativeUrl(requestSegments, urlSegments, 0, 0, "");
1937}
1938function getSegments(url, addTail) {
1939 var segments = [];
1940 var startIndex = 0;
1941 var endIndex = -1;
1942 while ((endIndex = url.indexOf("/", startIndex)) != -1) {
1943  segments.push(url.substring(startIndex, ++endIndex));
1944  startIndex = endIndex;
1945 }
1946 if(addTail && startIndex < url.length)
1947  segments.push(url.substring(startIndex, url.length)); 
1948 return segments;
1949}
1950function buildPathRelativeUrl(requestSegments, urlSegments, reqIndex, urlIndex, buffer) {
1951 if(urlIndex >= urlSegments.length)
1952  return buffer;
1953 if(reqIndex >= requestSegments.length)
1954  return buildPathRelativeUrl(requestSegments, urlSegments, reqIndex, urlIndex + 1, buffer + urlSegments[urlIndex]);
1955 if(requestSegments[reqIndex] === urlSegments[urlIndex] && urlIndex === reqIndex)
1956  return buildPathRelativeUrl(requestSegments, urlSegments, reqIndex + 1, urlIndex + 1, buffer);
1957 return buildPathRelativeUrl(requestSegments, urlSegments, reqIndex + 1, urlIndex, buffer + "../");
1958}
1959Url.isPathRelativeUrl = function(url) {
1960 return !!url && !Url.isAbsoluteUrl(url) && url.indexOf("/") != 0;  
1961};
1962Url.isRootRelativeUrl = function(url) {
1963 return !!url && !Url.isAbsoluteUrl(url) && url.indexOf("/") == 0 && url.indexOf("//") != 0;
1964};
1965function navigateTo(url, target) {
1966 var lowerCaseTarget = target.toLowerCase();
1967 if("_top" == lowerCaseTarget)
1968  top.location.href = url;
1969 else if("_self" == lowerCaseTarget)
1970  location.href = url;
1971 else if("_search" == lowerCaseTarget)
1972  openInNewWindow(url);
1973 else if("_media" == lowerCaseTarget)
1974  openInNewWindow(url);
1975 else if("_parent" == lowerCaseTarget)
1976  window.parent.location.href = url;
1977 else if("_blank" == lowerCaseTarget)
1978  openInNewWindow(url);
1979 else {
1980  var frame = getFrame(top.frames, target);
1981  if(frame != null)
1982   frame.location.href = url;
1983  else
1984   openInNewWindow(url);
1985 }
1986}
1987function openInNewWindow(url) {
1988 if(ASPx.Browser.Safari)
1989  openInNewWindowViaIframe(url);
1990 else {
1991  var newWindow = window.open();
1992  newWindow.opener = null;
1993  newWindow.location = url;
1994 }
1995}
1996function openInNewWindowViaIframe(url) {
1997 var iframe = document.createElement('iframe');
1998 iframe.style.display = 'none';
1999 document.body.appendChild(iframe);
2000 var iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
2001 var openArgs = '"' + url + '"';
2002 var script = iframeDoc.createElement('script');
2003 script.type = 'text/javascript';
2004 script.text = 'window.parent = null; ' +
2005  'window.top = null;' +
2006  'window.frameElement = null;' +
2007  'var child = window.open(' + openArgs + ');' +
2008  'child.opener = null';
2009 iframeDoc.body.appendChild(script);
2010 document.body.removeChild(iframe);
2011}
2012ASPx.Url = Url;
2013var Json = { };
2014function isValid(JsonString) {
2015 return !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(JsonString.replace(/"(\\.|[^"\\])*"/g, '')));
2016}
2017Json.Eval = function(jsonString, controlName) {
2018 if(isValid(jsonString))
2019  return eval("(" + jsonString + ")");
2020 else
2021  throw new Error(controlName + " received incorrect JSON-data: " + jsonString);
2022};
2023Json.ToJson = function(param){
2024 var paramType = typeof(param);
2025 if((paramType == "undefined") || (param == null))
2026  return null;
2027 if((paramType == "object") && (typeof(param.__toJson) == "function"))
2028  return param.__toJson();
2029 if((paramType == "number") || (paramType == "boolean"))
2030  return param;
2031 if(param.constructor == Date)
2032  return dateToJson(param);
2033 if(paramType == "string") {
2034  var result = param.replace(/\\/g, "\\\\");
2035  result = result.replace(/"/g, "\\\"");
2036  result = result.replace(/\n/g, "\\n");
2037  result = result.replace(/\r/g, "\\r");
2038  result = result.replace(/</g, "\\u003c");
2039  result = result.replace(/>/g, "\\u003e");
2040  return "\"" + result + "\"";
2041 }
2042 if(param.constructor == Array){
2043  var values = [];
2044  for(var i = 0; i < param.length; i++) {
2045   var jsonValue = Json.ToJson(param[i]);
2046   if(jsonValue === null)
2047    jsonValue = "null";
2048   values.push(jsonValue);
2049  }
2050  return "[" + values.join(",") + "]";
2051 }
2052 var exceptKeys = {};
2053 if(ASPx.Ident.IsArray(param.__toJsonExceptKeys))
2054  exceptKeys = Data.CreateHashTableFromArray(param.__toJsonExceptKeys);
2055 exceptKeys["__toJsonExceptKeys"] = 1;
2056 var values = [];
2057 for(var key in param) {
2058  if(param.hasOwnProperty(key)) {
2059   if(ASPx.IsFunction(param[key]))
2060    continue;
2061   if(exceptKeys[key] == 1)
2062    continue;
2063   values.push(Json.ToJson(key) + ":" + Json.ToJson(param[key]));
2064  }
2065 }
2066 return "{" + values.join(",") + "}";
2067};
2068function dateToJson(date) {
2069 var result = [ 
2070  date.getFullYear(),
2071  date.getMonth(),
2072  date.getDate()
2073 ];
2074 var time = {
2075  h: date.getHours(),
2076  m: date.getMinutes(),
2077  s: date.getSeconds(),
2078  ms: date.getMilliseconds()
2079 };
2080 if(time.h || time.m || time.s || time.ms)
2081  result.push(time.h);
2082 if(time.m || time.s || time.ms)
2083  result.push(time.m);
2084 if(time.s || time.ms)
2085  result.push(time.s);
2086 if(time.ms)
2087  result.push(time.ms);
2088 return "new Date(" + result.join() + ")";
2089}
2090ASPx.Json = Json;
2091ASPx.CreateClass = function(parentClass, properties) {
2092 if(arguments.length == 1) {
2093  properties = parentClass;
2094  parentClass = null;
2095 }
2096 var ret = function() {
2097  if(ret.preparing) 
2098   return delete(ret.preparing);
2099  if(ret.constr) {
2100   this.constructor = ret;
2101   ret.constr.apply(this, arguments);
2102  }
2103 };
2104 ret.prototype = {};
2105 if(parentClass) {
2106  parentClass.preparing = true;
2107  for(var name in parentClass) {
2108   if(parentClass.hasOwnProperty(name) && name != 'constr' && ASPx.IsFunction(parentClass[name]) && !ret[name])
2109    ret[name] = parentClass[name].aspxBind(parentClass);
2110  }
2111  ret.prototype = new parentClass;
2112  ret.prototype.constructor = parentClass;
2113  ret.constr = parentClass;
2114 }
2115 if(properties) {
2116  var constructorName = "constructor";
2117  for(var name in properties) {
2118   if(!properties.hasOwnProperty(name)) 
2119    continue;
2120   var getter = Object.getOwnPropertyDescriptor(properties, name).get;
2121   var setter = Object.getOwnPropertyDescriptor(properties, name).set;
2122   if(getter || setter)
2123    Object.defineProperty(ret.prototype, name, {
2124     set: setter,
2125     get: getter,
2126     enumerable: true,
2127     configurable: true
2128    });
2129   if(name != constructorName && !getter && !setter)
2130    ret.prototype[name] = properties[name];
2131  }
2132  if(properties[constructorName] && properties[constructorName] != Object)
2133   ret.constr = properties[constructorName];
2134 }
2135 return ret;
2136};
2137ASPx.FormatCallbackArg = function(prefix, arg) {
2138 if(prefix == null && arg == null)
2139  return ""; 
2140 if(prefix == null) prefix = "";
2141 if(arg == null) arg = "";
2142 if(arg != null && !ASPx.IsExists(arg.length) && ASPx.IsExists(arg.value))
2143  arg = arg.value;
2144 arg = arg.toString();
2145 return [prefix, '|', arg.length, '|' , arg].join('');
2146};
2147ASPx.FormatCallbackArgs = function(callbackData) {
2148 var sb = [ ];
2149 for(var i = 0; i < callbackData.length; i++)
2150  sb.push(ASPx.FormatCallbackArg(callbackData[i][0], callbackData[i][1]));
2151 return sb.join("");
2152};
2153ASPx.ParseShortcutString = function(shortcutString) {
2154 if(!shortcutString)
2155  return 0;
2156 var isCtrlKey = false;
2157 var isShiftKey = false;
2158 var isAltKey = false;
2159 var isMetaKey = false;
2160 var keyCode = null;
2161 var shcKeys = shortcutString.toString().split("+");
2162 if(shcKeys.length > 0) {
2163  for(var i = 0; i < shcKeys.length; i++) {
2164   var key = Str.Trim(shcKeys[i].toUpperCase());
2165   switch (key) {
2166    case "CONTROL":
2167    case "CONTROLKEY":
2168    case "CTRL":
2169     isCtrlKey = true;
2170     break;
2171    case "SHIFT":
2172    case "SHIFTKEY":
2173     isShiftKey = true;
2174     break;
2175    case "ALT":
2176     isAltKey = true;
2177     break;
2178    case "CMD":
2179     isMetaKey = true;
2180     break;
2181    case "F1": keyCode = ASPx.Key.F1; break;
2182    case "F2": keyCode = ASPx.Key.F2; break;
2183    case "F3": keyCode = ASPx.Key.F3; break;
2184    case "F4": keyCode = ASPx.Key.F4; break;
2185    case "F5": keyCode = ASPx.Key.F5; break;
2186    case "F6": keyCode = ASPx.Key.F6; break;
2187    case "F7": keyCode = ASPx.Key.F7; break;
2188    case "F8": keyCode = ASPx.Key.F8; break;
2189    case "F9": keyCode = ASPx.Key.F9; break;
2190    case "F10":   keyCode = ASPx.Key.F10; break;
2191    case "F11":   keyCode = ASPx.Key.F11; break;
2192    case "F12":   keyCode = ASPx.Key.F12; break;
2193    case "RETURN":
2194    case "ENTER": keyCode = ASPx.Key.Enter; break;
2195    case "HOME":  keyCode = ASPx.Key.Home; break;
2196    case "END":   keyCode = ASPx.Key.End; break;
2197    case "LEFT":  keyCode = ASPx.Key.Left; break;
2198    case "RIGHT": keyCode = ASPx.Key.Right; break;
2199    case "UP": keyCode = ASPx.Key.Up; break;
2200    case "DOWN":  keyCode = ASPx.Key.Down; break;
2201    case "PAGEUP": keyCode = ASPx.Key.PageUp; break;
2202    case "PAGEDOWN": keyCode = ASPx.Key.PageDown; break;
2203    case "SPACE": keyCode = ASPx.Key.Space; break;
2204    case "TAB":   keyCode = ASPx.Key.Tab; break;
2205    case "BACKSPACE": 
2206    case "BACK": keyCode = ASPx.Key.Backspace; break;
2207    case "CONTEXT": keyCode = ASPx.Key.ContextMenu; break;
2208    case "ESCAPE":
2209    case "ESC":
2210     keyCode = ASPx.Key.Esc;
2211     break;
2212    case "DELETE":
2213    case "DEL":
2214     keyCode = ASPx.Key.Delete;
2215     break;
2216    case "INSERT":
2217    case "INS":
2218     keyCode = ASPx.Key.Insert;
2219     break;
2220    case "PLUS":
2221     keyCode = "+".charCodeAt(0);
2222     break;
2223    default:
2224     keyCode = key.charCodeAt(0);
2225     break;
2226   }
2227  }
2228 } else
2229  ASPx.ShowErrorAlert("Invalid shortcut");
2230 return ASPx.GetShortcutCode(keyCode, isCtrlKey, isShiftKey, isAltKey, isMetaKey);
2231};
2232ASPx.GetShortcutCode = function(keyCode, isCtrlKey, isShiftKey, isAltKey, isMetaKey) {
2233 var value = keyCode;
2234 value |= isCtrlKey ? ASPx.ModifierKey.Ctrl : 0;
2235 value |= isShiftKey ? ASPx.ModifierKey.Shift : 0;
2236 value |= isAltKey ? ASPx.ModifierKey.Alt : 0;
2237 value |= isMetaKey ? ASPx.ModifierKey.Meta : 0;
2238 return value;
2239};
2240ASPx.GetShortcutCodeByEvent = function(evt) {
2241 return ASPx.GetShortcutCode(Evt.GetKeyCode(evt), evt.ctrlKey, evt.shiftKey, evt.altKey, ASPx.Browser.MacOSPlatform ? evt.metaKey : false);
2242};
2243ASPx.IsPasteShortcut = function(evt) {
2244 if(evt.type === "paste")
2245  return true;
2246 var keyCode = Evt.GetKeyCode(evt);
2247 if(Browser.NetscapeFamily && evt.which == 0)  
2248  keyCode = evt.keyCode;
2249 return (evt.ctrlKey && (keyCode == 118  || (keyCode == 86))) ||
2250     (evt.shiftKey && !evt.ctrlKey && !evt.altKey &&
2251     (keyCode == ASPx.Key.Insert)) ;
2252};
2253var NotPrintableKeyCodes = null;
2254ASPx.IsPrintableKey = function(keyCode) {
2255 if (!NotPrintableKeyCodes)
2256  NotPrintableKeyCodes = Object.keys(ASPx.Key).map(function(key) { return ASPx.Key[key]; });
2257 return !ASPx.Data.ArrayContains(NotPrintableKeyCodes, keyCode);
2258};
2259ASPx.SetFocus = function(element, selectAction) {
2260 function focusCore(element, selectAction){
2261  try {
2262    element.focus();
2263    if(Browser.IE && document.activeElement != element)
2264     element.focus();
2265    if(selectAction) {
2266     var currentSelection = Selection.GetInfo(element);
2267     if(currentSelection.startPos == currentSelection.endPos) {
2268      switch(selectAction) {
2269       case "start":
2270        Selection.SetCaretPosition(element, 0);
2271        break;
2272       case "all":
2273        Selection.Set(element);
2274        break;
2275      }
2276     }
2277    }
2278   } catch (e) {
2279  }
2280 }
2281 if(ASPxClientUtils.iOSPlatform) 
2282  focusCore(element, selectAction);
2283 else {
2284  window.setTimeout(function() { 
2285   focusCore(element, selectAction);
2286  }, 100);
2287 }
2288};
2289ASPx.IsFocusableCore = function(element, skipContainerVisibilityCheck) {
2290 var current = element;
2291 while(current && current.nodeType == 1) {
2292  if(current == element || !skipContainerVisibilityCheck(current)) {
2293   var tagName = current.tagName.toUpperCase();
2294   if(tagName == "BODY")
2295    return true;
2296   var disabledElementTags = ["INPUT", "BUTTON", "TEXTAREA", "SELECT", "OPTION"];
2297   if(disabledElementTags.indexOf(tagName) !== -1 && current.disabled || !ASPx.GetElementDisplay(current) || !ASPx.GetElementVisibility(current))
2298    return false;
2299  }
2300  current = current.parentNode;
2301 }
2302 return true;
2303};
2304ASPx.IsFocusable = function(element) {
2305 return ASPx.IsFocusableCore(element, ASPx.FalseFunction);
2306};
2307ASPx.IsActionElement = function(element) {
2308 if(!ASPx.IsExistsElement(element))
2309  return false;
2310 var tabIndex = parseInt(ASPx.Attr.GetAttribute(element, ASPx.Attr.GetTabIndexAttributeName()));
2311 var hasTabIndex = !isNaN(tabIndex);
2312 var hasNonNegativeTabIndex = hasTabIndex && tabIndex > -1;
2313 var hasNegativeTabIndex = hasTabIndex && tabIndex < 0;
2314 var tagName = element.tagName;
2315 var focusableElementTags = ["BUTTON", "SELECT", "TEXTAREA", "OPTION", "IFRAME"];
2316 var isFocusableCore = ASPx.IsFocusable(element);
2317 var isFocusableTag = focusableElementTags.indexOf(tagName) !== -1;
2318 var isFocusableLink = tagName === "A" && (!!element.href || hasNonNegativeTabIndex);
2319 var isFocusableInput = tagName === "INPUT" && element.type.toLowerCase() !== "hidden";
2320 var isFocusableByTabIndex = tagName !== "INPUT" && hasNonNegativeTabIndex;
2321 var isEditableDiv = tagName == "DIV" && element.contentEditable === "true";
2322 return isFocusableCore && !hasNegativeTabIndex && (isFocusableTag || isFocusableLink || isFocusableInput || isFocusableByTabIndex || isEditableDiv);
2323};
2324ASPx.GetCanBeActiveElementsInContainer = function(container) {
2325 var canBeActiveTags = ["INPUT", "A", "UL", "BUTTON", "TEXTAREA", "SELECT", "IFRAME"],
2326  canBeActiveElements = [];
2327 Data.ForEach(canBeActiveTags, function(tag) {
2328  var elements = container.getElementsByTagName(tag);
2329  canBeActiveElements = canBeActiveElements.concat([].slice.call(elements));
2330 });
2331 return canBeActiveElements;
2332};
2333function isActionElementAllowedByPredicate(element, predicate) {
2334  var allowedByPredicate = !predicate || predicate(element);
2335  return allowedByPredicate && ASPx.IsActionElement(element);
2336}
2337ASPx.FindChildActionElements = function(container, predicate) {
2338 return ASPx.GetNodes(container, function(el) {
2339  return isActionElementAllowedByPredicate(el, predicate);
2340 });
2341};
2342ASPx.FindAllSortedActionElements = function(container, predicate) {
2343 var result = [ ];
2344 if(!container || !container.getElementsByTagName) return result;
2345 var actionElements = ASPx.FindChildActionElements(container, predicate);
2346 var getTabOrderValue = function(el) {
2347  var tabIndex = parseInt(ASPx.Attr.GetAttribute(el, ASPx.Attr.GetTabIndexAttributeName()));
2348  return isNaN(tabIndex) ? 0 : tabIndex;
2349 };
2350 var positiveTabIndexElements = actionElements.filter(function(x) { return getTabOrderValue(x) > 0; });
2351 var nonPositiveTabIndexElements = actionElements.filter(function(x) { return getTabOrderValue(x) === 0; });
2352 var sortedTabIndexElements = positiveTabIndexElements.sort(function(x, y) { return getTabOrderValue(x) - getTabOrderValue(y); });
2353 result = sortedTabIndexElements.concat(nonPositiveTabIndexElements);
2354 return result;
2355};
2356ASPx.FindFirstChildActionElement = function(container, predicate) {
2357 if(!container || isActionElementAllowedByPredicate(container, predicate))
2358  return !container ? null : container;
2359 var sortedActionElements = ASPx.FindAllSortedActionElements(container, predicate);
2360 return sortedActionElements[0];
2361};
2362ASPx.FindLastChildActionElement = function(container, predicate) {
2363 if(!container)
2364  return null;
2365 var sortedActionElements = ASPx.FindAllSortedActionElements(container, predicate);
2366 var actionElement = sortedActionElements[sortedActionElements.length - 1];
2367 if(!actionElement && isActionElementAllowedByPredicate(container, predicate))
2368  actionElement = container;
2369 return actionElement;
2370};
2371ASPx.GetParentClientControls = function(name) {
2372 var nameParts = name.split("_");
2373 var result = [ ];
2374 var controlCollection = ASPx.GetControlCollection();
2375 for(var i = 1; i <= nameParts.length; i++) {
2376  var controlName = nameParts.slice(0, i).join("_");
2377  var control = controlCollection.Get(controlName);
2378  if(control)
2379   result.push(control);
2380 }
2381 return result;
2382};
2383ASPx.GetRootClientControl = function(childControlName) {
2384 var parentControls = ASPx.GetParentClientControls(childControlName);
2385 return parentControls[0];
2386};
2387ASPx.GetClientControlByElementID = function(elementID) {
2388 var parentControls = ASPx.GetParentClientControls(elementID);
2389 return parentControls[parentControls.length - 1];
2390};
2391ASPx.IsExists = function(obj){
2392 return (typeof(obj) != "undefined") && (obj != null);
2393};
2394ASPx.IsFunction = function(obj){
2395 return typeof(obj) == "function";
2396};
2397ASPx.IsNumber = function(str) {
2398 return !isNaN(parseFloat(str)) && isFinite(str);
2399};
2400ASPx.GetDefinedValue = function(value, defaultValue){
2401 return (typeof(value) != "undefined") ? value : defaultValue;
2402};
2403ASPx.CorrectJSFloatNumber = function(number) {
2404 var ret = 21; 
2405 var numString = number.toPrecision(21);
2406 numString = numString.replace("-", ""); 
2407 var integerDigitsCount = numString.indexOf(ASPx.PossibleNumberDecimalSeparators[0]);
2408 if(integerDigitsCount < 0)
2409  integerDigitsCount = numString.indexOf(ASPx.PossibleNumberDecimalSeparators[1]);
2410 var floatDigitsCount = numString.length - integerDigitsCount - 1;
2411 if(floatDigitsCount < 10)
2412  return number;
2413 if(integerDigitsCount > 0) {
2414  ret = integerDigitsCount + 12;
2415 }
2416 var toPrecisionNumber = Math.min(ret, 21);
2417 var newValueString = number.toPrecision(toPrecisionNumber);
2418 return parseFloat(newValueString, 10);
2419};
2420ASPx.CorrectRounding = function(number, step) { 
2421 var regex = /[,|.](.*)/,
2422  isFloatValue = regex.test(number),
2423  isFloatStep = regex.test(step);
2424 if(isFloatValue || isFloatStep) {
2425  var valueAccuracy = (isFloatValue) ? regex.exec(number)[0].length - 1 : 0,
2426   stepAccuracy = (isFloatStep) ? regex.exec(step)[0].length - 1 : 0,
2427   accuracy = Math.max(valueAccuracy, stepAccuracy);
2428  var multiplier = Math.pow(10, accuracy);
2429  number = Math.round((number + step) * multiplier) / multiplier;
2430  return number;
2431 }
2432 return number + step;
2433};
2434ASPx.GetActiveElement = function() {
2435 try{ return document.activeElement; } catch(e) { return null; }
2436};
2437var verticalScrollBarWidth;
2438ASPx.GetVerticalScrollBarWidth = function() {
2439 if(typeof(verticalScrollBarWidth) == "undefined") {
2440  var container = document.createElement("DIV");
2441  container.style.cssText = "position: absolute; top: 0px; left: 0px; visibility: hidden; width: 200px; height: 150px; overflow: hidden; box-sizing: content-box";
2442  document.body.appendChild(container);
2443  var child = document.createElement("P");
2444  container.appendChild(child);
2445  child.style.cssText = "width: 100%; height: 200px;";
2446  var widthWithoutScrollBar = child.offsetWidth;
2447  container.style.overflow = "scroll";
2448  var widthWithScrollBar = child.offsetWidth;
2449  if(widthWithoutScrollBar == widthWithScrollBar)
2450   widthWithScrollBar = container.clientWidth;
2451  verticalScrollBarWidth = widthWithoutScrollBar - widthWithScrollBar;
2452  document.body.removeChild(container);
2453 }
2454 return verticalScrollBarWidth;
2455};
2456function hideScrollBarCore(element, scrollName) {
2457 if(element.tagName == "IFRAME") {
2458  if((element.scrolling == "yes") || (element.scrolling == "auto")) {
2459   Attr.ChangeAttribute(element, "scrolling", "no");
2460   return true;
2461  }
2462 }
2463 else if(element.tagName == "DIV") {
2464  if((element.style[scrollName] == "scroll") || (element.style[scrollName] == "auto")) {
2465   Attr.ChangeStyleAttribute(element, scrollName, "hidden");
2466   return true;
2467  }
2468 }
2469 return false;
2470}
2471function restoreScrollBarCore(element, scrollName) {
2472 if(element.tagName == "IFRAME")
2473  return Attr.RestoreAttribute(element, "scrolling");
2474 else if(element.tagName == "DIV")
2475  return Attr.RestoreStyleAttribute(element, scrollName);
2476 return false;
2477}
2478ASPx.SetScrollBarVisibilityCore = function(element, scrollName, isVisible) {
2479 return isVisible ? restoreScrollBarCore(element, scrollName) : hideScrollBarCore(element, scrollName);
2480};
2481ASPx.SetScrollBarVisibility = function(element, isVisible) {
2482 if(ASPx.SetScrollBarVisibilityCore(element, "overflow", isVisible)) 
2483  return true;
2484 var result = ASPx.SetScrollBarVisibilityCore(element, "overflowX", isVisible)
2485  || ASPx.SetScrollBarVisibilityCore(element, "overflowY", isVisible);
2486 return result;
2487};
2488ASPx.SetInnerHtml = function(element, html) {
2489 if(Browser.IE) {
2490  setInnerHtmlInternal(element, "<em>&nbsp;</em>" + html);
2491  element.removeChild(element.firstChild);
2492 } else
2493  setInnerHtmlInternal(element, html);
2494};
2495ASPx.GetInnerText = function(container) {
2496 if(Browser.Safari && Browser.MajorVersion <= 5) {
2497  var filter = getHtml2PlainTextFilter();
2498  setInnerHtmlInternal(filter, container.innerHTML);
2499  ASPx.SetElementDisplay(filter, true);
2500  var innerText = filter.innerText;
2501  ASPx.SetElementDisplay(filter, false);
2502  return innerText;
2503 } else if(Browser.NetscapeFamily || Browser.WebKitFamily || (Browser.IE && Browser.Version >= 9) || Browser.Edge) {
2504  return container.textContent;
2505 } else
2506  return container.innerText;
2507};
2508var html2PlainTextFilter = null;
2509function getHtml2PlainTextFilter() {
2510 if(html2PlainTextFilter == null) {
2511  html2PlainTextFilter = document.createElement("DIV");
2512  html2PlainTextFilter.style.width = "0";
2513  html2PlainTextFilter.style.height = "0";
2514  html2PlainTextFilter.style.overflow = "visible";
2515  ASPx.SetElementDisplay(html2PlainTextFilter, false);
2516  document.body.appendChild(html2PlainTextFilter);
2517 }
2518 return html2PlainTextFilter;
2519}
2520ASPx.CreateHiddenField = function(name, id, parent) {
2521 var input = document.createElement("INPUT");
2522 input.setAttribute("type", "hidden");
2523 if(name)
2524  input.setAttribute("name", name);
2525 if(id)
2526  input.setAttribute("id", id);
2527 if(parent)
2528  parent.appendChild(input);
2529 return input;
2530};
2531ASPx.CloneObject = function(srcObject) {
2532 if(typeof(srcObject) != 'object' || srcObject == null)
2533  return srcObject;
2534 var newObject = {};
2535 for(var i in srcObject)
2536  newObject[i] = srcObject[i];
2537 return newObject;
2538};
2539ASPx.InsertRowsBefore = function(table, rowsHtml, index) {
2540 var row = null;
2541 if(index >= 0 && index < table.rows.length)
2542  row = table.rows[index];
2543 var func = ASPx.Browser.IE && ASPx.Browser.Version < 10 ? insertRowsBefore_IE9 : insertRowsBefore;
2544 func(table, rowsHtml, row);
2545};
2546var insertRowsBefore = function(table, rowsHtml, row) {
2547 if(!row && table.tBodies.length > 0) {
2548  row = document.createElement("TR");
2549  table.tBodies[0].appendChild(row);
2550  row.shouldRemove = true;
2551 }
2552 if(row) {
2553  row.insertAdjacentHTML("beforeBegin", rowsHtml);
2554  if(row.shouldRemove)
2555   ASPx.RemoveElement(row);
2556 }
2557};
2558var insertRowsBefore_IE9 = function(table, rowsHtml, nextRow) {
2559 var row = document.createElement("TR");
2560 var cell = document.createElement("TD");
2561 setInnerHtmlInternal(cell, "<table><tbody>" + rowsHtml + "</tbody></table>");
2562 var tbody = table.tBodies[0];
2563 tbody.appendChild(row);
2564 row.appendChild(cell);
2565 var newTable = ASPx.GetNodeByTagName(cell, "TABLE", 0);
2566 var rowCount = newTable.rows.length;
2567 for(var i = rowCount - 1; i >= 0; i--) {
2568  var newRow = newTable.rows[i];
2569  if(nextRow == null)
2570   tbody.appendChild(newRow);
2571  else
2572   tbody.insertBefore(newRow, nextRow);
2573  nextRow = newRow;
2574 }
2575 ASPx.RemoveElement(row);
2576};
2577ASPx.IsPercentageSize = function(size) {
2578 return size && size.indexOf('%') != -1;
2579};
2580ASPx.GetElementById = function(id) {
2581 if(document.getElementById)
2582  return document.getElementById(id);
2583 else
2584  return document.all[id];
2585};
2586ASPx.GetInputElementById = function(id) {
2587 var elem = ASPx.GetElementById(id);
2588 if(!Browser.IE)
2589  return elem;
2590 if(elem) {
2591  if(elem.id == id)
2592   return elem;
2593  else {
2594   for(var i = 1; i < document.all[id].length; i++) {
2595    if(document.all[id][i].id == id)
2596     return document.all[id][i];
2597   }
2598  }
2599 }
2600 return null;
2601};
2602ASPx.GetElementByIdInDocument = function(documentObj, id) {
2603 if(documentObj.getElementById)
2604  return documentObj.getElementById(id);
2605 else
2606  return documentObj.all[id];
2607};
2608ASPx.GetIsParent = function(parentElement, element) {
2609 if(!parentElement || !element)
2610  return false;
2611 while(element){
2612  if(element === parentElement)
2613   return true;
2614  if(element.tagName === "BODY")
2615   return false;
2616  element = element.parentNode;
2617 }
2618 return false;
2619};
2620ASPx.GetParentById = function(element, id) {
2621 element = element.parentNode;
2622 while(element){
2623  if(element.id === id)
2624   return element;
2625  element = element.parentNode;
2626 }
2627 return null;
2628};
2629ASPx.GetParentByPartialId = function(element, idPart){
2630 while(element && element.tagName != "BODY") {
2631  if(element.id && element.id.match(idPart)) 
2632   return element;
2633  element = element.parentNode;
2634 }
2635 return null;
2636};
2637ASPx.GetParentByTagName = function(element, tagName) {
2638 tagName = tagName.toUpperCase();
2639 while(element) {
2640  if(element.tagName === "BODY")
2641   return null;
2642  if(element.tagName === tagName)
2643   return element;
2644  element = element.parentNode;
2645 }
2646 return null;
2647};
2648function getParentByClassNameInternal(element, className, selector) {
2649 while(element != null) {
2650  if(element.tagName == "BODY" || element.nodeName == "#document")
2651   return null;
2652  if(selector(element, className))
2653   return element;
2654  element = element.parentNode;
2655 }
2656 return null;
2657}
2658ASPx.GetParentByPartialClassName = function(element, className) {
2659 return getParentByClassNameInternal(element, className, ASPx.ElementContainsCssClass);
2660};
2661ASPx.GetParentByClassName = function(element, className) {
2662 return getParentByClassNameInternal(element, className, ASPx.ElementHasCssClass);
2663};
2664ASPx.GetParentByTagNameAndAttributeValue = function(element, tagName, attrName, attrValue) {
2665 tagName = tagName.toUpperCase();
2666 while(element != null) {
2667  if(element.tagName == "BODY")
2668   return null;
2669  if(element.tagName == tagName && element[attrName] == attrValue)
2670   return element;
2671  element = element.parentNode;
2672 }
2673 return null;
2674};
2675ASPx.GetParent = function(element, testFunc){
2676 if (!ASPx.IsExists(testFunc)) return null;
2677 while(element != null && element.tagName != "BODY"){
2678  if(testFunc(element))
2679   return element;
2680  element = element.parentNode;
2681 }
2682 return null;
2683};
2684ASPx.GetElementTreeLine = function(element, stopTagName, stopFunc) {
2685 var result = [];
2686 stopTagName = stopTagName || "BODY";
2687 while(element != null) {
2688  if(!stopFunc && element.tagName == stopTagName)
2689   break;
2690  if(stopFunc && stopFunc(element))
2691   break;
2692  result.push(element);
2693  element = element.parentNode;
2694 }
2695 return result;
2696};
2697ASPx.IsScrollableElement = function(element, isHorzScrollable, isVertScrollable) {
2698 isHorzScrollable = ASPx.IsExists(isHorzScrollable) ? isHorzScrollable : true;
2699 isVertScrollable = ASPx.IsExists(isVertScrollable) ? isVertScrollable : true;
2700 var style = ASPx.GetCurrentStyle(element);
2701 var overflowStyleNames = ["overflow"];
2702 if(isHorzScrollable)
2703  overflowStyleNames.push("overflowX");
2704 if(isVertScrollable)
2705  overflowStyleNames.push("overflowY");
2706 for(var i = 0; i < overflowStyleNames.length; i++)
2707  if(style[overflowStyleNames[i]] == "scroll" || style[overflowStyleNames[i]] == "auto")
2708   return true;
2709 return false;
2710};
2711ASPx.GetPreviousSibling = function(el) {
2712 if(el.previousElementSibling) {
2713  return el.previousElementSibling;
2714 } else {
2715  while(el = el.previousSibling) {
2716   if(el.nodeType === 1)
2717    return el;
2718  }
2719 }
2720};
2721ASPx.ElementHasCssClass = function(element, className) {
2722 try {
2723  var elementClasses;
2724  var classList = element.classList;
2725  if(!classList) {
2726   if(!element.className)
2727    return false;
2728   elementClasses = element.className.split(" ");
2729  }
2730  var classNames = className.split(" ");
2731  for(var i = classNames.length - 1; i >= 0; i--) {
2732   if(classList) {
2733    if(!classList.contains(classNames[i]))
2734     return false;
2735    continue;
2736   }
2737   if(Data.ArrayIndexOf(elementClasses, classNames[i]) < 0)
2738    return false;
2739  }
2740  return true;
2741 } catch(e) {
2742  return false;
2743 }
2744};
2745ASPx.ElementContainsCssClass = function(element, className) {
2746 try {
2747  if(!element.className)
2748   return false;
2749  return element.className.indexOf(className) != -1;
2750 } catch(e) {
2751  return false;
2752 }
2753};
2754ASPx.AddClassNameToElement = function (element, className) {
2755 if(!element || typeof(className) !== "string" ) return;
2756 className = className.trim();
2757 if(!ASPx.ElementHasCssClass(element, className) && className !== "")
2758  element.className = (element.className === "") ? className : element.className + " " + className;
2759};
2760ASPx.RemoveClassNameFromElement = function(element, className) {
2761 if(!element) return;
2762 var updClassName = " " + element.className + " ";
2763 var newClassName = updClassName.replace(" " + className + " ", " ");
2764 if(updClassName.length != newClassName.length)
2765  element.className = Str.Trim(newClassName);
2766};
2767ASPx.ToggleClassNameToElement = function(element, className, contains) {
2768 if (!contains)
2769  ASPx.RemoveClassNameFromElement(element, className);
2770 if (contains && !ASPx.ElementHasCssClass(element, className))
2771  ASPx.AddClassNameToElement(element, className);
2772};
2773ASPx.GetClassNameList = function(element) {
2774 if(element.classList)
2775  return [ ].slice.call(element.classList);
2776 return element.className.replace(/^\s+|\s+$/g, '').split(/\s+/);
2777};
2778function nodeListToArray(nodeList, filter) {
2779 var result = [];
2780 for(var i = 0, element; element = nodeList[i]; i++) {
2781  if(filter && !filter(element))
2782   continue;
2783  result.push(element);
2784 }
2785 return result;
2786}
2787ASPx.NodeListToArray = nodeListToArray;
2788function getItemByIndex(collection, index) {
2789 if(!index) index = 0;
2790 if(collection != null && collection.length > index)
2791  return collection[index];
2792 return null;
2793}
2794ASPx.GetChildNodesByQuerySelector = function (parent, selector) {
2795 return nodeListToArray(parent.querySelectorAll(selector), function (el) { return el.parentNode === parent; });
2796};
2797ASPx.GetChildNodesByClassName = function(parent, className) {
2798 if(!parent) return [];
2799 if(parent.querySelectorAll) {
2800  var children = parent.querySelectorAll('.' + className);
2801  return nodeListToArray(children, function(element) { 
2802   return element.parentNode === parent;
2803  });
2804 }
2805 return ASPx.GetChildNodes(parent, function(elem) { return elem.className && ASPx.ElementHasCssClass(elem, className); });
2806};
2807ASPx.GetChildNodesByPartialClassName = function(element, className) {
2808 return ASPx.GetChildElementNodesByPredicate(element,
2809  function(child) {
2810   return ASPx.ElementContainsCssClass(child, className);
2811  });
2812};
2813ASPx.GetChildByPartialClassName = function(element, className, index) {
2814 if(element != null){    
2815  var collection = ASPx.GetChildNodesByPartialClassName(element, className);
2816  return getItemByIndex(collection, index);
2817 }
2818 return null;
2819};
2820ASPx.GetChildByClassName = function(element, className, index) {
2821 if(element != null){    
2822  var collection = ASPx.GetChildNodesByClassName(element, className);
2823  return getItemByIndex(collection, index);
2824 }
2825 return null;
2826};
2827ASPx.GetNodesByPartialClassName = function(element, className) {
2828 if(element.querySelectorAll) {
2829  var list = element.querySelectorAll('*[class*=' + className + ']');
2830  return nodeListToArray(list);
2831 }
2832 var collection = element.all || element.getElementsByTagName('*');
2833 var ret = [ ];
2834 if(collection != null) {
2835  for(var i = 0; i < collection.length; i ++) {
2836   if(ASPx.ElementContainsCssClass(collection[i], className))
2837    ret.push(collection[i]);
2838  }
2839 }
2840 return ret;
2841};
2842ASPx.GetNodesByClassName = function(parent, className) {
2843 if(parent.querySelectorAll) {
2844  var children = parent.querySelectorAll('.' + className);
2845  return nodeListToArray(children);
2846 }
2847 return ASPx.GetNodes(parent, function(elem) { return elem.className && ASPx.ElementHasCssClass(elem, className); });
2848};
2849ASPx.GetNodeByClassName = function(element, className, index) {
2850 if(element != null){    
2851  var collection = ASPx.GetNodesByClassName(element, className);
2852  return getItemByIndex(collection, index);
2853 }
2854 return null;
2855};
2856ASPx.GetChildById = function(element, id) {
2857 if(element.all) {
2858  var child = element.all[id];
2859  if(!child) {
2860   child = element.all(id); 
2861   if(!child)
2862    return Browser.IE ? document.getElementById(id) : null; 
2863  } 
2864  if(!ASPx.IsExists(child.length)) 
2865   return child;
2866  else
2867   return ASPx.GetElementById(id);
2868 }
2869 else
2870  return ASPx.GetElementById(id);
2871};
2872ASPx.GetNodesByPartialId = function(element, partialName, list) {
2873 if(element.id && element.id.indexOf(partialName) > -1) 
2874  list.push(element);
2875 if(element.childNodes) {
2876  for(var i = 0; i < element.childNodes.length; i ++) 
2877   ASPx.GetNodesByPartialId(element.childNodes[i], partialName, list);
2878 }
2879};
2880ASPx.GetNodesByTagName = function(element, tagName) {
2881 tagName = tagName.toUpperCase();
2882 if(element) {
2883  if(element.getElementsByTagName) 
2884   return element.getElementsByTagName(tagName);
2885  else if(element.all && element.all.tags !== undefined)
2886   return Browser.Netscape ? element.all.tags[tagName] : element.all.tags(tagName);
2887 }
2888 return null;
2889};
2890ASPx.GetNodeByTagName = function(element, tagName, index) {
2891 if(element != null){    
2892  var collection = ASPx.GetNodesByTagName(element, tagName);
2893  return getItemByIndex(collection, index);
2894 }
2895 return null;
2896};
2897ASPx.GetChildNodesByTagName = function(parent, tagName) {
2898 return ASPx.GetChildNodes(parent, function (child) { return child.tagName === tagName; });
2899};
2900ASPx.GetChildByTagName = function(element, tagName, index) {
2901 if(element != null){    
2902  var collection = ASPx.GetChildNodesByTagName(element, tagName);
2903  return getItemByIndex(collection, index);
2904 }
2905 return null;
2906};
2907ASPx.RetrieveByPredicate = function(scourceCollection, predicate) {
2908 var result = [];
2909 for(var i = 0; i < scourceCollection.length; i++) {
2910  var element = scourceCollection[i];
2911  if(!predicate || predicate(element)) 
2912   result.push(element);
2913 }
2914 return result;
2915};
2916ASPx.GetChildNodes = function(parent, predicate) {
2917 return ASPx.RetrieveByPredicate(parent.childNodes, predicate);
2918};
2919ASPx.GetNodes = function(parent, predicate) {
2920 var c = parent.all || parent.getElementsByTagName('*');
2921 return ASPx.RetrieveByPredicate(c, predicate);
2922};
2923ASPx.GetChildElementNodes = function(parent) {
2924 if(!parent) return null;
2925 return ASPx.GetChildNodes(parent, function(e) { return e.nodeType == 1; });
2926};
2927ASPx.GetChildElementNodesByPredicate = function(parent, predicate) {
2928 if(!parent) return null;
2929 if(!predicate) return ASPx.GetChildElementNodes(parent);
2930 return ASPx.GetChildNodes(parent, function(e) { return e.nodeType == 1 && predicate(e); });
2931};
2932ASPx.GetTextNode = function(element, index) {
2933 if(element != null){
2934  var collection = [ ];
2935  ASPx.GetTextNodes(element, collection);
2936  return getItemByIndex(collection, index);
2937 }
2938 return null;
2939};
2940ASPx.GetTextNodes = function(element, collection) {
2941 for(var i = 0; i < element.childNodes.length; i ++){
2942  var childNode = element.childNodes[i];
2943  if(ASPx.IsExists(childNode.nodeValue))
2944   collection.push(childNode);
2945  ASPx.GetTextNodes(childNode, collection);
2946 }
2947};
2948ASPx.GetNormalizedTextNode = function(element, index) {
2949 var textNode = ASPx.GetTextNode(element, index);
2950 if(textNode != null)
2951  ASPx.MergeAdjacentTextNodes(textNode);
2952 return textNode;
2953};
2954ASPx.MergeAdjacentTextNodes = function(firstTextNode) {
2955 if(!ASPx.IsExists(firstTextNode.nodeValue))
2956  return;
2957 var textNode = firstTextNode;
2958 while(textNode.nextSibling && ASPx.IsExists(textNode.nextSibling.nodeValue)) {
2959  textNode.nodeValue += textNode.nextSibling.nodeValue;
2960  textNode.parentNode.removeChild(textNode.nextSibling);
2961 }
2962};
2963ASPx.GetElementDocument = function(element) {
2964 return element.document || element.ownerDocument;
2965};
2966ASPx.RemoveElement = function(element) {
2967 if(element && element.parentNode)
2968  element.parentNode.removeChild(element);
2969};
2970ASPx.ReplaceTagName = function(element, newTagName, cloneChilds) {
2971 if(element.nodeType != 1)
2972  return null;
2973 if(element.nodeName == newTagName)
2974  return element;
2975 cloneChilds = cloneChilds !== undefined ? cloneChilds : true;
2976 var doc = element.ownerDocument;
2977 var newElem = doc.createElement(newTagName);
2978 Attr.CopyAllAttributes(element, newElem);
2979 if(cloneChilds) {
2980  for(var i = 0; i < element.childNodes.length; i++)
2981   newElem.appendChild(element.childNodes[i].cloneNode(true));
2982 }
2983 else {
2984  for(var child; child = element.firstChild; )
2985   newElem.appendChild(child);
2986 }
2987 element.parentNode.replaceChild(newElem, element);
2988 return newElem;
2989};
2990ASPx.RemoveOuterTags = function(element) {
2991 if(ASPx.Browser.IE) {
2992  element.insertAdjacentHTML( 'beforeBegin', element.innerHTML ) ;
2993  ASPx.RemoveElement(element);
2994 } else {
2995  var docFragment = element.ownerDocument.createDocumentFragment();
2996  for(var i = 0; i < element.childNodes.length; i++)
2997   docFragment.appendChild(element.childNodes[i].cloneNode(true));
2998  element.parentNode.replaceChild(docFragment, element);
2999 }
3000};
3001ASPx.WrapElementInNewElement = function(element, newElementTagName) { 
3002 var wrapElement = null;
3003 if(Browser.IE) {
3004  var wrapElement = element.ownerDocument.createElement(newElementTagName);
3005  wrapElement.appendChild(element.cloneNode(true));
3006  element.parentNode.insertBefore(wrapElement, element);
3007  element.parentNode.removeChild(element);
3008 } else {
3009  var docFragment = element.ownerDocument.createDocumentFragment();
3010  wrapElement = element.ownerDocument.createElement(newElementTagName);
3011  docFragment.appendChild(wrapElement);
3012  wrapElement.appendChild(element.cloneNode(true));
3013  element.parentNode.replaceChild(docFragment, element);
3014 }
3015 return wrapElement;
3016};
3017ASPx.InsertElementAfter = function(newElement, targetElement) {
3018 var parentElem = targetElement.parentNode;
3019 if(parentElem.childNodes[parentElem.childNodes.length - 1] == targetElement)
3020  parentElem.appendChild(newElement);
3021 else
3022  parentElem.insertBefore(newElement, targetElement.nextSibling);
3023};
3024ASPx.SetElementOpacity = function(element, value) {
3025  var useOpacityStyle = !Browser.IE || Browser.Version > 8;
3026  if(useOpacityStyle){
3027   element.style.opacity = value;
3028  } else {
3029   if(typeof(element.filters) === "object" && element.filters["DXImageTransform.Microsoft.Alpha"])
3030    element.filters.item("DXImageTransform.Microsoft.Alpha").Opacity = value*100;
3031   else
3032   element.style.filter = "alpha(opacity=" + (value * 100) + ")";
3033  }
3034};
3035ASPx.GetElementOpacity = function(element) {
3036 var useOpacityStyle = !Browser.IE || Browser.Version > 8;
3037 if(useOpacityStyle)
3038  return parseFloat(ASPx.GetCurrentStyle(element).opacity);
3039 else {
3040  if(typeof(element.filters) === "object" && element.filters["DXImageTransform.Microsoft.Alpha"]){
3041   return element.filters.item("DXImageTransform.Microsoft.Alpha").Opacity / 100;
3042  } else {
3043   var alphaValue = ASPx.GetCurrentStyle(element).filter;
3044   var value = alphaValue.replace("alpha(opacity=", "");
3045   value = value.replace(")", "");
3046   return parseInt(value) / 100;
3047  }
3048  return 100;
3049 }
3050};
3051ASPx.GetElementDisplay = function(element, isCurrentStyle) {
3052 if (isCurrentStyle)
3053  return ASPx.GetCurrentStyle(element).display != "none";
3054 return element.style.display != "none";
3055};
3056ASPx.SetElementDisplay = function(element, value, checkCurrentStyle, makeInline) {
3057 if(!element) return;
3058 if(typeof(value) === "string")
3059  element.style.display = value;
3060 else if(!value)
3061  element.style.display = "none";
3062 else {
3063  element.style.display = "";
3064  if(checkCurrentStyle && ASPx.GetCurrentStyle(element).display === "none"){
3065   var displayAddon = makeInline ? "inline-" : "";
3066   switch(element.tagName){
3067    case "TABLE": {
3068     element.style.display = displayAddon + "table";
3069     break;
3070    }
3071    default: {
3072     element.style.display = displayAddon + "block";
3073     break;
3074    }
3075   }
3076  }
3077 }
3078};
3079ASPx.GetElementVisibility = function(element, isCurrentStyle) {
3080 if(isCurrentStyle)
3081  return ASPx.GetCurrentStyle(element).visibility != "hidden";
3082 return element.style.visibility != "hidden";
3083};
3084ASPx.SetElementVisibility = function(element, value) {
3085 if(!element) return;
3086 if(typeof(value) === "string")
3087  element.style.visibility = value;
3088 else
3089  element.style.visibility = value ? "visible" : "hidden";
3090};
3091ASPx.IsElementVisible = function(element, isCurrentStyle) {
3092 while(element && element.tagName != "BODY") {
3093  if(!ASPx.GetElementDisplay(element, isCurrentStyle) || (!ASPx.GetElementVisibility(element, isCurrentStyle) && !Attr.IsExistsAttribute(element, "errorFrame")))
3094     return false;
3095  element = element.parentNode;
3096 }
3097 return true;
3098};
3099ASPx.IsElementDisplayed = function(element) {
3100 while(element && element.tagName != "BODY") {
3101  if(!ASPx.GetElementDisplay(element))
3102     return false;
3103  element = element.parentNode;
3104 }
3105 return true;
3106};
3107ASPx.GetElementInitializedFlag = function(element) {
3108 return element["dxinit"];
3109};
3110ASPx.SetElementInitializedFlag = function(element) {
3111 element["dxinit"] = true;
3112};
3113ASPx.AddStyleSheetLinkToDocument = function(doc, linkUrl) {
3114 var newLink = createStyleLink(doc, linkUrl);
3115 var head = ASPx.GetHeadElementOrCreateIfNotExist(doc);
3116 head.appendChild(newLink);
3117};
3118ASPx.GetHeadElementOrCreateIfNotExist = function(doc) {
3119 var elements = ASPx.GetNodesByTagName(doc, "head");
3120 var head = null;
3121 if(elements.length == 0) {
3122  head = doc.createElement("head");
3123  head.visibility = "hidden";
3124  doc.insertBefore(head, doc.body);
3125 } else
3126  head = elements[0];
3127 return head;
3128};
3129function createStyleLink(doc, url) {
3130 var newLink = doc.createElement("link");
3131 Attr.SetAttribute(newLink, "href", url);
3132 Attr.SetAttribute(newLink, "type", "text/css");
3133 Attr.SetAttribute(newLink, "rel", "stylesheet");
3134 return newLink;
3135}
3136ASPx.GetCurrentStyle = function(element) {
3137 if(element.currentStyle)
3138  return element.currentStyle;
3139 else if(document.defaultView && document.defaultView.getComputedStyle) { 
3140  var result = document.defaultView.getComputedStyle(element, null);
3141  if(!result && Browser.Firefox && window.frameElement) {
3142   var changes = [];
3143   var curElement = window.frameElement;
3144   while(!(result = document.defaultView.getComputedStyle(element, null))) {
3145    changes.push([curElement, curElement.style.display]);
3146    ASPx.SetStylesCore(curElement, "display", "block", true);
3147    curElement = curElement.tagName == "BODY" ? curElement.ownerDocument.defaultView.frameElement : curElement.parentNode;
3148   }
3149   result = ASPx.CloneObject(result);
3150   for(var ch, i = 0; ch = changes[i]; i++)
3151    ASPx.SetStylesCore(ch[0], "display", ch[1]);
3152   var dummy = document.body.offsetWidth; 
3153  }
3154  return result;
3155 }
3156 return window.getComputedStyle(element, null);
3157};
3158ASPx.CreateStyleSheetInDocument = function(doc) {
3159 if(doc.createStyleSheet) {
3160  try {
3161   return doc.createStyleSheet();
3162  }
3163  catch(e) {
3164   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.";
3165   throw new Error(message);
3166  }
3167 }
3168 else {
3169  var styleSheet = doc.createElement("STYLE");
3170  ASPx.GetNodeByTagName(doc, "HEAD", 0).appendChild(styleSheet);
3171  return styleSheet.sheet;
3172 }
3173};
3174ASPx.currentStyleSheet = null;
3175ASPx.GetCurrentStyleSheet = function() {
3176 if(!ASPx.currentStyleSheet)
3177  ASPx.currentStyleSheet = ASPx.CreateStyleSheetInDocument(document);
3178 return ASPx.currentStyleSheet;
3179};
3180function getStyleSheetRules(styleSheet){
3181 try {
3182  return Browser.IE && Browser.Version == 8 ? styleSheet.rules : styleSheet.cssRules;
3183 }
3184 catch(e) {
3185  return null;
3186 }
3187}
3188ASPx.cachedCssRules = { };
3189ASPx.GetStyleSheetRules = function (className, stylesStorageDocument) {
3190 if(ASPx.cachedCssRules[className]) {
3191  if(ASPx.cachedCssRules[className] != ASPx.EmptyObject)
3192   return ASPx.cachedCssRules[className];
3193  return null;
3194 }
3195 var result = iterateStyleSheetRules(stylesStorageDocument, function(rule) {
3196  if(rule.selectorText == "." + className){
3197   ASPx.cachedCssRules[className] = rule;
3198   return rule;
3199  }
3200 });
3201 if(ASPx.IsExists(result))
3202  return result;
3203 ASPx.cachedCssRules[className] = ASPx.EmptyObject;
3204 return null;
3205};
3206function iterateStyleSheetRules(stylesStorageDocument, callback) {
3207 var doc = stylesStorageDocument || document;
3208 for(var i = 0; i < doc.styleSheets.length; i ++){
3209  var styleSheet = doc.styleSheets[i];
3210  var rules = getStyleSheetRules(styleSheet);
3211  if(rules != null){
3212   for(var j = 0; j < rules.length; j ++) {
3213    var result = callback(rules[j]);
3214    if(result !== undefined)
3215     return result;
3216   }
3217  }
3218 }
3219}
3220ASPx.ProcessStyleSheetRules = function(prefix, callback) {
3221 iterateStyleSheetRules(null, function(rule) {
3222  if(!!rule.selectorText && rule.selectorText.indexOf(prefix) === 0) {
3223   var name = rule.selectorText.substring(prefix.length);
3224   callback(name, rule.style, rule);
3225  }
3226 });
3227};
3228ASPx.ClearCachedCssRules = function(){
3229 ASPx.cachedCssRules = { };
3230};
3231var styleCount = 0;
3232var styleNameCache = { };
3233ASPx.CreateImportantStyleRule = function(styleSheet, cssText, postfix, prefix) {
3234 styleSheet = styleSheet || ASPx.GetCurrentStyleSheet();
3235 var cacheKey = (postfix ? postfix + "||" : "") + cssText + (prefix ? "||" + prefix : "");
3236 if(styleNameCache[cacheKey])
3237  return styleNameCache[cacheKey];
3238 prefix = prefix ? prefix + " " : "";
3239 var className = "dxh" + styleCount + (postfix ? postfix : "");
3240 ASPx.AddStyleSheetRule(styleSheet, prefix + "." + className, ASPx.CreateImportantCssText(cssText));
3241 styleCount++;
3242 styleNameCache[cacheKey] = className;
3243 return className; 
3244};
3245ASPx.CreateImportantCssText = function(cssText) {
3246 var newText = "";
3247 var attributes = cssText.split(";");
3248 for(var i = 0; i < attributes.length; i++){
3249  if(attributes[i] != "")
3250   newText += attributes[i] + " !important;";
3251 }
3252 return newText;
3253};
3254ASPx.AddStyleSheetRule = function(styleSheet, selector, cssText){
3255 if(!cssText) return;
3256 styleSheet.insertRule(selector + " { " + cssText + " }", styleSheet.cssRules.length);
3257};
3258ASPx.GetPointerCursor = function() {
3259 return "pointer";
3260};
3261ASPx.SetPointerCursor = function(element) {
3262 if(element.style.cursor == "")
3263  element.style.cursor = ASPx.GetPointerCursor();
3264};
3265ASPx.SetElementFloat = function(element, value) {
3266 if(ASPx.IsExists(element.style.cssFloat))
3267  element.style.cssFloat = value;
3268 else if(ASPx.IsExists(element.style.styleFloat))
3269  element.style.styleFloat = value;
3270 else
3271  Attr.SetAttribute(element.style, "float", value);
3272};
3273ASPx.GetElementFloat = function(element) {
3274 var currentStyle = ASPx.GetCurrentStyle(element);
3275 if(ASPx.IsExists(currentStyle.cssFloat))
3276  return currentStyle.cssFloat;
3277 if(ASPx.IsExists(currentStyle.styleFloat))
3278  return currentStyle.styleFloat;
3279 return Attr.GetAttribute(currentStyle, "float");
3280};
3281function getElementDirection(element) {
3282 return ASPx.GetCurrentStyle(element).direction;
3283}
3284ASPx.IsElementRightToLeft = function(element) {
3285 return getElementDirection(element) == "rtl";
3286};
3287ASPx.AdjustVerticalMarginsInContainer = function(container) {
3288 var containerBorderAndPaddings = ASPx.GetTopBottomBordersAndPaddingsSummaryValue(container);
3289 var flowElements = [], floatElements = [], floatTextElements = [];
3290 var maxHeight = 0, maxFlowHeight = 0;
3291 for(var i = 0; i < container.childNodes.length; i++) {
3292  var element = container.childNodes[i];
3293  if(!element.offsetHeight) continue;
3294  ASPx.ClearVerticalMargins(element);
3295 }
3296 for(var i = 0; i < container.childNodes.length; i++) {
3297  var element = container.childNodes[i];
3298  if(!element.offsetHeight) continue;
3299  var float = ASPx.GetElementFloat(element);
3300  var isFloat = (float === "left" || float === "right");
3301  if(isFloat)
3302   floatElements.push(element);
3303  else {
3304   flowElements.push(element);
3305   if(element.tagName !== "IMG"){
3306    if(!ASPx.IsTextWrapped(element))
3307     element.style.verticalAlign = 'baseline'; 
3308    floatTextElements.push(element);
3309   }
3310   if(element.tagName === "DIV")
3311    Attr.ChangeStyleAttribute(element, "float", "left"); 
3312  }
3313  if(element.offsetHeight > maxHeight) 
3314   maxHeight = element.offsetHeight;
3315  if(!isFloat && element.offsetHeight > maxFlowHeight) 
3316   maxFlowHeight = element.offsetHeight;
3317 }
3318 for(var i = 0; i < flowElements.length; i++) 
3319  Attr.RestoreStyleAttribute(flowElements[i], "float");
3320 var containerBorderAndPaddings = ASPx.GetTopBottomBordersAndPaddingsSummaryValue(container);
3321 var containerHeight = container.offsetHeight - containerBorderAndPaddings;
3322 if(maxHeight == containerHeight) {
3323  var verticalAlign = ASPx.GetCurrentStyle(container).verticalAlign;
3324  for(var i = 0; i < floatTextElements.length; i++)
3325   floatTextElements[i].style.verticalAlign = '';
3326  containerHeight = container.offsetHeight - containerBorderAndPaddings;
3327  for(var i = 0; i < floatElements.length; i++)
3328   adjustVerticalMarginsCore(floatElements[i], containerHeight, verticalAlign, true);
3329  for(var i = 0; i < flowElements.length; i++) {
3330   if(maxFlowHeight != maxHeight)
3331    adjustVerticalMarginsCore(flowElements[i], containerHeight, verticalAlign);
3332  }
3333 }
3334};
3335ASPx.AdjustVerticalMargins = function(element) {
3336 ASPx.ClearVerticalMargins(element);
3337 var parentElement = element.parentNode;
3338 var parentHeight = parentElement.getBoundingClientRect().height - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(parentElement);
3339 adjustVerticalMarginsCore(element, parentHeight, ASPx.GetCurrentStyle(parentElement).verticalAlign);
3340};
3341function adjustVerticalMarginsCore(element, parentHeight, verticalAlign, toBottom) {
3342 var marginTop;
3343 if(verticalAlign == "top")
3344  marginTop = 0;
3345 else if(verticalAlign == "bottom")
3346  marginTop = parentHeight - element.getBoundingClientRect().height;
3347 else
3348  marginTop = (parentHeight - element.getBoundingClientRect().height) / 2;
3349 if(marginTop !== 0){
3350  element.style.marginTop = marginTop + "px";
3351 }
3352}
3353ASPx.ClearVerticalMargins = function(element) {
3354 element.style.marginTop = "";
3355 element.style.marginBottom = "";
3356};
3357ASPx.AdjustHeightInContainer = function(container) {
3358 var height = container.offsetHeight - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(container);
3359 for(var i = 0; i < container.childNodes.length; i++) {
3360  var element = container.childNodes[i];
3361  if(!element.offsetHeight) continue;
3362  ASPx.ClearHeight(element);
3363 }
3364 var elements = [];
3365 var childrenHeight = 0;
3366 for(var i = 0; i < container.childNodes.length; i++) {
3367  var element = container.childNodes[i];
3368  if(!element.offsetHeight) continue;
3369  childrenHeight += element.offsetHeight + ASPx.GetTopBottomMargins(element);
3370  elements.push(element);
3371 }
3372 if(elements.length > 0 && childrenHeight < height) {
3373  var correctedHeight = 0;
3374  for(var i = 0; i < elements.length; i++) {
3375   var elementHeight = 0;
3376   if(i < elements.length - 1){
3377    var elementHeight = Math.floor(height / elements.length);
3378    correctedHeight += elementHeight;
3379   }
3380   else{
3381    var elementHeight = height - correctedHeight;
3382    if(elementHeight < 0) elementHeight = 0;
3383   }
3384   adjustHeightCore(elements[i], elementHeight);
3385  }
3386 }
3387};
3388ASPx.AdjustHeight = function(element) {
3389 ASPx.ClearHeight(element);
3390 var parentElement = element.parentNode;
3391 var height = parentElement.getBoundingClientRect().height - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(parentElement);
3392 adjustHeightCore(element, height);
3393};
3394function adjustHeightCore(element, height) {
3395 var height = height - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(element);
3396 if(height < 0) height = 0;
3397 element.style.height = height + "px";
3398}
3399ASPx.ClearHeight = function(element) {
3400 element.style.height = "";
3401};
3402ASPx.ShrinkWrappedTextInContainer = function(container) {
3403 if(!container) return;
3404 for(var i = 0; i < container.childNodes.length; i++){
3405  var child = container.childNodes[i];
3406  if(child.style && ASPx.IsTextWrapped(child)) {
3407   Attr.ChangeStyleAttribute(child, "width", "1px");
3408   child.shrinkedTextContainer = true;
3409  }
3410 }
3411};
3412ASPx.AdjustWrappedTextInContainer = function(container) {
3413 if(!container) return;
3414 var textContainer, leftWidth = 0, rightWidth = 0;
3415 for(var i = 0; i < container.childNodes.length; i++){
3416  var child = container.childNodes[i];
3417  if(child.tagName === "BR")
3418   return;
3419  if(!child.tagName)
3420   continue;
3421  if(child.tagName !== "IMG"){
3422   textContainer = child;
3423   if(ASPx.IsTextWrapped(textContainer)){
3424    if(!textContainer.shrinkedTextContainer)
3425     textContainer.style.width = "";
3426    textContainer.style.marginRight = "";
3427   }
3428  }
3429  else {
3430   if(child.offsetWidth === 0)
3431    Evt.AttachEventToElement(child, "load", function(evt) { ASPx.AdjustWrappedTextInContainer(container); });
3432   else {
3433    var width = child.offsetWidth + ASPx.GetLeftRightMargins(child);
3434    if(textContainer)
3435     rightWidth += width;
3436    else
3437     leftWidth += width;
3438   }
3439  }
3440 }
3441 if(textContainer && ASPx.IsTextWrapped(textContainer)) {
3442  var containerWidth = container.offsetWidth - ASPx.GetLeftRightBordersAndPaddingsSummaryValue(container);
3443  if(textContainer.shrinkedTextContainer) {
3444   Attr.RestoreStyleAttribute(textContainer, "width");
3445   Attr.ChangeStyleAttribute(container, "width", containerWidth + "px");
3446  }
3447  if(textContainer.offsetWidth + leftWidth + rightWidth >= containerWidth) {
3448    if(rightWidth > 0 && !textContainer.shrinkedTextContainer)
3449    textContainer.style.width = (containerWidth - rightWidth) + "px";
3450   else if(leftWidth > 0){
3451    if(ASPx.IsElementRightToLeft(container))
3452     textContainer.style.marginLeft = leftWidth + "px";
3453    else
3454     textContainer.style.marginRight = leftWidth + "px";
3455   }
3456  }
3457 }
3458};
3459ASPx.IsTextWrapped = function(element) {
3460 return element && ASPx.GetCurrentStyle(element).whiteSpace !== "nowrap";
3461};
3462ASPx.IsValidPosition = function(pos){
3463 return pos != ASPx.InvalidPosition && pos != -ASPx.InvalidPosition;
3464};
3465ASPx.getSpriteMainElement = function(element) {
3466 var cssClassMarker = "dx-acc";
3467 if(ASPx.ElementContainsCssClass(element, cssClassMarker))
3468  return element;
3469 if(element.parentNode && ASPx.ElementContainsCssClass(element.parentNode, cssClassMarker))
3470  return element.parentNode;
3471 return element;
3472};
3473ASPx.GetAbsoluteX = function(curEl){
3474 return ASPx.GetAbsolutePositionX(curEl);
3475};
3476ASPx.GetAbsoluteY = function(curEl){
3477 return ASPx.GetAbsolutePositionY(curEl);
3478};
3479ASPx.SetAbsoluteX = function(element, x){
3480 element.style.left = ASPx.PrepareClientPosForElement(x, element, true) + "px";
3481};
3482ASPx.SetAbsoluteY = function(element, y){
3483 element.style.top = ASPx.PrepareClientPosForElement(y, element, false) + "px";
3484};
3485ASPx.GetAbsolutePositionX = function(element){
3486 if(Browser.IE)
3487  return getAbsolutePositionX_IE(element);
3488 else if(Browser.Firefox && Browser.Version >= 3)
3489  return getAbsolutePositionX_FF3(element);
3490 else if(Browser.Opera)
3491  return getAbsolutePositionX_Opera(element);
3492 else if(Browser.NetscapeFamily && (!Browser.Firefox || Browser.Version < 3))
3493  return getAbsolutePositionX_NS(element);
3494 else if(Browser.WebKitFamily || Browser.Edge)
3495  return getAbsolutePositionX_FF3(element);
3496 else
3497  return getAbsolutePositionX_Other(element);
3498};
3499function getAbsolutePositionX_Opera(curEl){
3500 var isFirstCycle = true;
3501 var pos = getAbsoluteScrollOffset_OperaFF(curEl, true);
3502 while(curEl != null) {
3503  pos += curEl.offsetLeft;
3504  if(!isFirstCycle)
3505   pos -= curEl.scrollLeft;
3506  curEl = curEl.offsetParent;
3507  isFirstCycle = false;
3508 }
3509 pos += document.body.scrollLeft;
3510 return pos;
3511}
3512function getAbsolutePositionX_IE(element){
3513 if(element == null || Browser.IE && element.parentNode == null) return 0; 
3514 return element.getBoundingClientRect().left + ASPx.GetDocumentScrollLeft();
3515}
3516function getAbsolutePositionX_FF3(element){
3517 if(element == null) return 0;
3518 var x = element.getBoundingClientRect().left + ASPx.GetDocumentScrollLeft();
3519 return Math.round(x);
3520}
3521function getAbsolutePositionX_NS(curEl){
3522 var pos = getAbsoluteScrollOffset_OperaFF(curEl, true);
3523 var isFirstCycle = true;
3524 while(curEl != null) {
3525  pos += curEl.offsetLeft;
3526  if(!isFirstCycle && curEl.offsetParent != null)
3527   pos -= curEl.scrollLeft;
3528  if(!isFirstCycle && Browser.Firefox){
3529   var style = ASPx.GetCurrentStyle(curEl);
3530   if(curEl.tagName == "DIV" && style.overflow != "visible")
3531    pos += ASPx.PxToInt(style.borderLeftWidth);
3532  }
3533  isFirstCycle = false;
3534  curEl = curEl.offsetParent;
3535 }
3536 return pos;
3537}
3538function getAbsolutePositionX_Other(curEl){
3539 var pos = 0;
3540 var isFirstCycle = true;
3541 while(curEl != null) {
3542  pos += curEl.offsetLeft;
3543  if(!isFirstCycle && curEl.offsetParent != null)
3544   pos -= curEl.scrollLeft;
3545  isFirstCycle = false;
3546  curEl = curEl.offsetParent;
3547 }
3548 return pos;
3549}
3550ASPx.GetAbsolutePositionY = function(element){
3551 if(Browser.IE)
3552  return getAbsolutePositionY_IE(element);
3553 else if(Browser.Firefox && Browser.Version >= 3)
3554  return getAbsolutePositionY_FF3(element);
3555 else if(Browser.Opera)
3556  return getAbsolutePositionY_Opera(element);
3557 else if(Browser.NetscapeFamily && (!Browser.Firefox || Browser.Version < 3))
3558  return getAbsolutePositionY_NS(element);
3559 else if(Browser.WebKitFamily || Browser.Edge)
3560  return getAbsolutePositionY_FF3(element);
3561 else
3562  return getAbsolutePositionY_Other(element);
3563};
3564function getAbsolutePositionY_Opera(curEl){
3565 var isFirstCycle = true;
3566 if(curEl && curEl.tagName == "TR" && curEl.cells.length > 0)
3567  curEl = curEl.cells[0];
3568 var pos = getAbsoluteScrollOffset_OperaFF(curEl, false);
3569 while(curEl != null) {
3570  pos += curEl.offsetTop;
3571  if(!isFirstCycle)
3572   pos -= curEl.scrollTop;
3573  curEl = curEl.offsetParent;
3574  isFirstCycle = false;
3575 }
3576 pos += document.body.scrollTop;
3577 return pos;
3578}
3579function getAbsolutePositionY_IE(element){
3580 if(element == null || Browser.IE && element.parentNode == null) return 0; 
3581 return element.getBoundingClientRect().top + ASPx.GetDocumentScrollTop();
3582}
3583function getAbsolutePositionY_FF3(element){
3584 if(element == null) return 0;
3585 var y = element.getBoundingClientRect().top + ASPx.GetDocumentScrollTop();
3586 return Math.round(y);
3587}
3588function getAbsolutePositionY_NS(curEl){
3589 var pos = getAbsoluteScrollOffset_OperaFF(curEl, false);
3590 var isFirstCycle = true;
3591 while(curEl != null) {
3592  pos += curEl.offsetTop;
3593  if(!isFirstCycle && curEl.offsetParent != null)
3594   pos -= curEl.scrollTop;
3595  if(!isFirstCycle && Browser.Firefox){
3596   var style = ASPx.GetCurrentStyle(curEl);
3597   if(curEl.tagName == "DIV" && style.overflow != "visible")
3598    pos += ASPx.PxToInt(style.borderTopWidth);
3599  }
3600  isFirstCycle = false;
3601  curEl = curEl.offsetParent;
3602 }
3603 return pos;
3604}
3605function getAbsoluteScrollOffset_OperaFF(curEl, isX) {
3606 var pos = 0;   
3607 var isFirstCycle = true;
3608 while(curEl != null) {
3609  if(curEl.tagName == "BODY")
3610   break;
3611  var style = ASPx.GetCurrentStyle(curEl);
3612  if(style.position == "absolute")
3613   break;
3614  if(!isFirstCycle && curEl.tagName == "DIV" && (style.position == "" || style.position == "static"))
3615   pos -= isX ? curEl.scrollLeft : curEl.scrollTop;
3616  curEl = curEl.parentNode;
3617  isFirstCycle = false;
3618 }
3619 return pos; 
3620}
3621function getAbsolutePositionY_Other(curEl){
3622 var pos = 0;
3623 var isFirstCycle = true;
3624 while(curEl != null) {
3625  pos += curEl.offsetTop;
3626  if(!isFirstCycle && curEl.offsetParent != null)
3627   pos -= curEl.scrollTop;
3628  isFirstCycle = false;
3629  curEl = curEl.offsetParent;
3630 }
3631 return pos;
3632}
3633function createElementMock(element) {
3634 var div = document.createElement('DIV');
3635 div.style.top = "0px";
3636 div.style.left = "0px";
3637 div.visibility = "hidden";
3638 div.style.position = ASPx.GetCurrentStyle(element).position;
3639 return div;
3640}
3641ASPx.PrepareClientPosElementForOtherParent = function(pos, element, otherParent, isX) {
3642 if(element.parentNode == otherParent)
3643  return ASPx.PrepareClientPosForElement(pos, element, isX);
3644 var elementMock = createElementMock(element);
3645 otherParent.appendChild(elementMock); 
3646 var preparedPos = ASPx.PrepareClientPosForElement(pos, elementMock, isX);
3647 otherParent.removeChild(elementMock);
3648 return preparedPos;
3649};
3650ASPx.PrepareClientPosForElement = function(pos, element, isX) {
3651 pos -= ASPx.GetPositionElementOffset(element, isX);
3652 return pos;
3653};
3654function getExperimentalPositionOffset(element, isX) {
3655 var div = createElementMock(element);
3656 if(div.style.position == "static")
3657  div.style.position = "absolute";
3658 element.parentNode.appendChild(div); 
3659 var realPos = isX ? ASPx.GetAbsoluteX(div) : ASPx.GetAbsoluteY(div);
3660 element.parentNode.removeChild(div);
3661 return Math.round(realPos);
3662}
3663ASPx.GetPositionElementOffset = function(element, isX) {
3664 return getExperimentalPositionOffset(element, isX);
3665};
3666ASPx.GetSizeOfText = function(text, textCss) {
3667 var testContainer = document.createElement("tester");
3668 var defaultLineHeight = ASPx.Browser.Firefox ? "1" : "";
3669 testContainer.style.fontSize = textCss.fontSize;
3670 testContainer.style.fontFamily = textCss.fontFamily;
3671 testContainer.style.fontWeight = textCss.fontWeight;
3672 testContainer.style.letterSpacing = textCss.letterSpacing;
3673 testContainer.style.lineHeight = textCss.lineHeight || defaultLineHeight;
3674 testContainer.style.position = "absolute";
3675 testContainer.style.top = ASPx.InvalidPosition + "px";
3676 testContainer.style.left = ASPx.InvalidPosition + "px";
3677 testContainer.style.width = "auto";
3678 testContainer.style.whiteSpace = "nowrap";
3679 testContainer.appendChild(document.createTextNode(text));
3680 var testElement = document.body.appendChild(testContainer);
3681 var size = {
3682  "width": testElement.offsetWidth,
3683  "height": testElement.offsetHeight
3684 };
3685 document.body.removeChild(testElement);
3686 return size;
3687};
3688ASPx.PointToPixel = function(points, addPx) {  
3689 var result = 0;
3690 try {
3691  var indexOfPt = points.toLowerCase().indexOf("pt");
3692  if(indexOfPt > -1)
3693   result = parseInt(points.substr(0, indexOfPt)) * 96 / 72;
3694  else
3695   result = parseInt(points) * 96 / 72;
3696  if(addPx)
3697   result = result + "px";
3698 } catch(e) {}
3699 return result;
3700};
3701ASPx.PixelToPoint = function(pixels, addPt) { 
3702 var result = 0;
3703 try {
3704  var indexOfPx = pixels.toLowerCase().indexOf("px");
3705  if(indexOfPx > -1)
3706   result = parseInt(pixels.substr(0, indexOfPx)) * 72 / 96;
3707  else
3708   result = parseInt(pixels) * 72 / 96;
3709  if(addPt)
3710   result = result + "pt";
3711 } catch(e) {}
3712 return result;         
3713};
3714ASPx.PxToInt = function(px) {
3715 return pxToNumber(px, parseInt);
3716};
3717ASPx.PxToFloat = function(px) {
3718 return pxToNumber(px, parseFloat);
3719};
3720function pxToNumber(px, parseFunction) {
3721 var result = 0;
3722 if(px != null && px != "") {
3723  try {
3724   var indexOfPx = px.indexOf("px");
3725   if(indexOfPx > -1)
3726    result = parseFunction(px.substr(0, indexOfPx));
3727  } catch(e) { }
3728 }
3729 return result;
3730}
3731ASPx.PercentageToFloat = function(perc) {
3732 var result = 0;
3733 if(perc != null && perc != "") {
3734  try {
3735   var indexOfPerc = perc.indexOf("%");
3736   if(indexOfPerc > -1)
3737    result = parseFloat(perc.substr(0, indexOfPerc)) / 100;
3738  } catch(e) { }
3739 }
3740 return result;
3741};
3742ASPx.CreateGuid = function() {
3743 return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { 
3744   var r = Math.random()*16|0,v=c=='x'?r:r&0x3|0x8;
3745  return v.toString(16);
3746 });
3747};
3748ASPx.GetLeftRightBordersAndPaddingsSummaryValue = function(element, currentStyle) {
3749 return ASPx.GetLeftRightPaddings(element, currentStyle) + ASPx.GetHorizontalBordersWidth(element, currentStyle);
3750};
3751ASPx.GetTopBottomBordersAndPaddingsSummaryValue = function(element, currentStyle) {
3752 return ASPx.GetTopBottomPaddings(element, currentStyle) + ASPx.GetVerticalBordersWidth(element, currentStyle);
3753};
3754ASPx.GetVerticalBordersWidth = function(element, style) {
3755 if(!ASPx.IsExists(style))
3756  style = (Browser.IE && Browser.MajorVersion != 9 && window.getComputedStyle) ? window.getComputedStyle(element) : ASPx.GetCurrentStyle(element);
3757 var res = 0;
3758 if(style.borderTopStyle != "none") {
3759  res += ASPx.PxToFloat(style.borderTopWidth);
3760  if(Browser.IE && Browser.MajorVersion < 9)
3761   res += getIe8BorderWidthFromText(style.borderTopWidth);
3762 }
3763 if(style.borderBottomStyle != "none") {
3764  res += ASPx.PxToFloat(style.borderBottomWidth);
3765  if(Browser.IE && Browser.MajorVersion < 9)
3766   res += getIe8BorderWidthFromText(style.borderBottomWidth);
3767 }
3768 return res;
3769};
3770ASPx.GetHorizontalBordersWidth = function(element, style) {
3771 if(!ASPx.IsExists(style))
3772  style = (Browser.IE && window.getComputedStyle) ? window.getComputedStyle(element) : ASPx.GetCurrentStyle(element);
3773 var res = 0;
3774 if(style.borderLeftStyle != "none") {
3775  res += ASPx.PxToFloat(style.borderLeftWidth);
3776  if(Browser.IE && Browser.MajorVersion < 9)
3777   res += getIe8BorderWidthFromText(style.borderLeftWidth);
3778 }
3779 if(style.borderRightStyle != "none") {
3780  res += ASPx.PxToFloat(style.borderRightWidth);
3781  if(Browser.IE && Browser.MajorVersion < 9)
3782   res += getIe8BorderWidthFromText(style.borderRightWidth);
3783 }
3784 return res;
3785};
3786function getIe8BorderWidthFromText(textWidth) {
3787 var availableWidth = { "thin": 1, "medium" : 3, "thick": 5 };
3788 var width = availableWidth[textWidth];
3789 return width ? width : 0;
3790}
3791ASPx.GetTopBottomPaddings = function(element, style) {
3792 var currentStyle = style ? style : ASPx.GetCurrentStyle(element);
3793 return ASPx.PxToInt(currentStyle.paddingTop) + ASPx.PxToInt(currentStyle.paddingBottom);
3794};
3795ASPx.GetLeftRightPaddings = function(element, style) {
3796 var currentStyle = style ? style : ASPx.GetCurrentStyle(element);
3797 return ASPx.PxToInt(currentStyle.paddingLeft) + ASPx.PxToInt(currentStyle.paddingRight);
3798};
3799ASPx.GetTopBottomMargins = function(element, style) {
3800 var currentStyle = style ? style : ASPx.GetCurrentStyle(element);
3801 return ASPx.PxToInt(currentStyle.marginTop) + ASPx.PxToInt(currentStyle.marginBottom);
3802};
3803ASPx.GetLeftRightMargins = function(element, style) {
3804 var currentStyle = style ? style : ASPx.GetCurrentStyle(element);
3805 return ASPx.PxToInt(currentStyle.marginLeft) + ASPx.PxToInt(currentStyle.marginRight);
3806};
3807ASPx.GetClearClientWidth = function(element) {
3808 return element.offsetWidth - ASPx.GetLeftRightBordersAndPaddingsSummaryValue(element);
3809};
3810ASPx.GetClearClientHeight = function(element) {
3811 return element.offsetHeight - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(element);
3812};
3813ASPx.SetOffsetWidth = function(element, widthValue, currentStyle) {
3814 if(!ASPx.IsExists(currentStyle))
3815  currentStyle = ASPx.GetCurrentStyle(element);
3816 var value = widthValue - ASPx.PxToInt(currentStyle.marginLeft) - ASPx.PxToInt(currentStyle.marginRight);
3817  value -= ASPx.GetLeftRightBordersAndPaddingsSummaryValue(element, currentStyle);
3818 if(value > -1)
3819  element.style.width = value + "px";
3820};
3821ASPx.SetOffsetHeight = function(element, heightValue, currentStyle) {
3822 if(!ASPx.IsExists(currentStyle))
3823  currentStyle = ASPx.GetCurrentStyle(element);
3824 var value = heightValue - ASPx.PxToInt(currentStyle.marginTop) - ASPx.PxToInt(currentStyle.marginBottom);
3825  value -= ASPx.GetTopBottomBordersAndPaddingsSummaryValue(element, currentStyle);
3826 if(value > -1)
3827  element.style.height = value + "px";
3828};
3829ASPx.FindOffsetParent = function(element) {
3830 var currentElement = element.parentNode;
3831 while(ASPx.IsExistsElement(currentElement) && currentElement.tagName != "BODY") {
3832  if(currentElement.offsetWidth > 0 && currentElement.offsetHeight > 0)
3833   return currentElement;
3834  currentElement = currentElement.parentNode;
3835 }
3836 return document.body;
3837};
3838ASPx.GetDocumentScrollTop = function(){
3839 var isScrollBodyIE = Browser.IE && ASPx.GetCurrentStyle(document.body).overflow == "hidden" && document.body.scrollTop > 0;
3840 if(Browser.WebKitFamily || Browser.Edge || isScrollBodyIE) {
3841  if(Browser.MacOSMobilePlatform) 
3842   return window.pageYOffset;
3843  if(Browser.WebKitFamily)
3844   return document.documentElement.scrollTop || document.body.scrollTop;
3845  return document.body.scrollTop;
3846 }
3847 else
3848  return document.documentElement.scrollTop;
3849};
3850ASPx.SetDocumentScrollTop = function(scrollTop) {
3851 if(Browser.WebKitFamily && Browser.Version < 60 || Browser.Edge)
3852  document.body.scrollTop = scrollTop;
3853 else
3854  document.documentElement.scrollTop = scrollTop;
3855};
3856ASPx.GetDocumentScrollLeft = function(){
3857 var isScrollBodyIE = Browser.IE && ASPx.GetCurrentStyle(document.body).overflow == "hidden" && document.body.scrollLeft > 0;
3858 if(Browser.Edge || isScrollBodyIE)
3859  return document.body ? document.body.scrollLeft : document.documentElement.scrollLeft;
3860 if(Browser.WebKitFamily)
3861  return document.documentElement.scrollLeft || document.body.scrollLeft;
3862 return document.documentElement.scrollLeft;
3863};
3864ASPx.SetDocumentScrollLeft = function (scrollLeft) {
3865 if(Browser.WebKitFamily && Browser.Version < 60 || Browser.Edge)
3866  document.body.scrollLeft = scrollLeft;
3867 else
3868  document.documentElement.scrollLeft = scrollLeft;
3869};
3870ASPx.GetDocumentClientWidth = function(){
3871 if(document.documentElement.clientWidth == 0)
3872  return document.body.clientWidth;
3873 else
3874  return document.documentElement.clientWidth;
3875};
3876ASPx.GetDocumentClientHeight = function() {
3877 if(Browser.Firefox && window.innerHeight - document.documentElement.clientHeight > ASPx.GetVerticalScrollBarWidth()) {
3878  return window.innerHeight;
3879 } else if(Browser.Opera && Browser.Version < 9.6 || document.documentElement.clientHeight == 0) {
3880   return document.body.clientHeight;
3881 }
3882 return document.documentElement.clientHeight;
3883};
3884ASPx.GetDocumentWidth = function(){
3885 var bodyWidth = document.body.offsetWidth;
3886 var docWidth = Browser.IE ? document.documentElement.clientWidth : document.documentElement.offsetWidth;
3887 var bodyScrollWidth = document.body.scrollWidth;
3888 var docScrollWidth = document.documentElement.scrollWidth;
3889 return getMaxDimensionOf(bodyWidth, docWidth, bodyScrollWidth, docScrollWidth);
3890};
3891ASPx.GetDocumentHeight = function(){
3892 var bodyHeight = document.body.offsetHeight;
3893 var docHeight = Browser.IE ? document.documentElement.clientHeight : document.documentElement.offsetHeight;
3894 var bodyScrollHeight = document.body.scrollHeight;
3895 var docScrollHeight = document.documentElement.scrollHeight;
3896 var maxHeight = getMaxDimensionOf(bodyHeight, docHeight, bodyScrollHeight, docScrollHeight);
3897 if(Browser.Opera && Browser.Version >= 9.6){
3898  if(Browser.Version < 10)
3899   maxHeight = getMaxDimensionOf(bodyHeight, docHeight, bodyScrollHeight);
3900  var visibleHeightOfDocument = document.documentElement.clientHeight;
3901  if(maxHeight > visibleHeightOfDocument)
3902   maxHeight = getMaxDimensionOf(window.outerHeight, maxHeight);
3903  else
3904   maxHeight = document.documentElement.clientHeight;
3905  return maxHeight;
3906 }
3907 return maxHeight;
3908};
3909ASPx.GetDocumentMaxClientWidth = function(){
3910 var bodyWidth = document.body.offsetWidth;
3911 var docWidth = document.documentElement.offsetWidth;
3912 var docClientWidth = document.documentElement.clientWidth;
3913 return getMaxDimensionOf(bodyWidth, docWidth, docClientWidth);
3914};
3915ASPx.GetDocumentMaxClientHeight = function(){
3916 var bodyHeight = document.body.offsetHeight;
3917 var docHeight = document.documentElement.offsetHeight;
3918 var docClientHeight = document.documentElement.clientHeight;
3919 return getMaxDimensionOf(bodyHeight, docHeight, docClientHeight);
3920};
3921ASPx.verticalScrollIsNotHidden = null;
3922ASPx.horizontalScrollIsNotHidden = null;
3923ASPx.GetVerticalScrollIsNotHidden = function() {
3924 if(!ASPx.IsExists(ASPx.verticalScrollIsNotHidden))
3925  ASPx.verticalScrollIsNotHidden = ASPx.GetCurrentStyle(document.body).overflowY !== "hidden"
3926   && ASPx.GetCurrentStyle(document.documentElement).overflowY !== "hidden";
3927 return ASPx.verticalScrollIsNotHidden;
3928};
3929ASPx.GetHorizontalScrollIsNotHidden = function() {
3930 if(!ASPx.IsExists(ASPx.horizontalScrollIsNotHidden))
3931  ASPx.horizontalScrollIsNotHidden = ASPx.GetCurrentStyle(document.body).overflowX !== "hidden"
3932   && ASPx.GetCurrentStyle(document.documentElement).overflowX !== "hidden";
3933 return ASPx.horizontalScrollIsNotHidden;
3934};
3935ASPx.GetCurrentDocumentWidth = function() {
3936 var result = ASPx.GetDocumentClientWidth();
3937 if(!ASPx.Browser.Safari && ASPx.GetVerticalScrollIsNotHidden() && ASPx.GetDocumentHeight() > ASPx.GetDocumentClientHeight())
3938  result += ASPx.GetVerticalScrollBarWidth();
3939 return result;
3940};
3941ASPx.GetCurrentDocumentHeight = function() {
3942 var result = ASPx.GetDocumentClientHeight();
3943 if(!ASPx.Browser.Safari && ASPx.GetHorizontalScrollIsNotHidden() && ASPx.GetDocumentWidth() > ASPx.GetDocumentClientWidth())
3944  result += ASPx.GetVerticalScrollBarWidth();
3945 return result;
3946};
3947function getMaxDimensionOf(){
3948 var max = ASPx.InvalidDimension;
3949 for(var i = 0; i < arguments.length; i++){
3950  if(max < arguments[i])
3951   max = arguments[i];
3952 }
3953 return max;
3954}
3955ASPx.GetClientLeft = function(element){
3956 return ASPx.IsExists(element.clientLeft) ? element.clientLeft : (element.offsetWidth - element.clientWidth) / 2;
3957};
3958ASPx.GetClientTop = function(element){
3959 return ASPx.IsExists(element.clientTop) ? element.clientTop : (element.offsetHeight - element.clientHeight) / 2;
3960};
3961ASPx.SetStyles = function(element, styles, makeImportant) {
3962 if(ASPx.IsExists(styles.cssText))
3963  element.style.cssText = styles.cssText;
3964 if(ASPx.IsExists(styles.className))
3965  element.className = styles.className;
3966 for(var property in styles) {
3967  if(!styles.hasOwnProperty(property))
3968   continue;
3969  var value = styles[property];
3970  switch (property) {
3971   case "cssText":
3972   case "className":
3973    break;
3974   case "float":
3975    ASPx.SetElementFloat(element, value);
3976    break;
3977   case "opacity":
3978    ASPx.SetElementOpacity(element, value);
3979    break;
3980   case "zIndex":
3981    ASPx.SetStylesCore(element, property, value, makeImportant);
3982    break;
3983   case "fontWeight":
3984    if(ASPx.Browser.IE && ASPx.Browser.Version < 9 && typeof(styles[property]) == "number")
3985     value = styles[property].toString();
3986   default:
3987    ASPx.SetStylesCore(element, property, value + (typeof (value) == "number" ? "px" : ""), makeImportant);
3988  }
3989 }
3990};
3991ASPx.SetStylesCore = function(element, property, value, makeImportant) {
3992 if(makeImportant) {
3993  var index = property.search("[A-Z]");
3994  if(index != -1)
3995   property = property.replace(property.charAt(index), "-" + property.charAt(index).toLowerCase());
3996  if(element.style.setProperty)
3997   element.style.setProperty(property, value, "important");
3998  else 
3999   element.style.cssText += ";" + property + ":" + value + "!important";
4000 }
4001 else
4002  element.style[property] = value;
4003};
4004ASPx.RemoveBordersAndShadows = function(el) {
4005 if(!el || !el.style)
4006  return;
4007 el.style.borderWidth = 0;
4008 if(ASPx.IsExists(el.style.boxShadow))
4009  el.style.boxShadow = "none";
4010 else if(ASPx.IsExists(el.style.MozBoxShadow))
4011  el.style.MozBoxShadow = "none";
4012 else if(ASPx.IsExists(el.style.webkitBoxShadow))
4013  el.style.webkitBoxShadow = "none";
4014};
4015ASPx.GetCellSpacing = function(element) {
4016 var val = parseInt(element.cellSpacing);
4017 if(!isNaN(val)) return val;
4018 val = parseInt(ASPx.GetCurrentStyle(element).borderSpacing);
4019 if(!isNaN(val)) return val;
4020 return 0;
4021};
4022ASPx.GetInnerScrollPositions = function(element) {
4023 var scrolls = [];
4024 getInnerScrollPositionsCore(element, scrolls);
4025 return scrolls;
4026};
4027function getInnerScrollPositionsCore(element, scrolls) {
4028 for(var child = element.firstChild; child; child = child.nextSibling) {
4029  var scrollTop = child.scrollTop,
4030   scrollLeft = child.scrollLeft;
4031  if(scrollTop > 0 || scrollLeft > 0)
4032   scrolls.push([child, scrollTop, scrollLeft]);
4033  getInnerScrollPositionsCore(child, scrolls);
4034 }
4035}
4036ASPx.RestoreInnerScrollPositions = function(scrolls) {
4037 for(var i = 0, scrollArr; scrollArr = scrolls[i]; i++) {
4038  if(scrollArr[1] > 0)
4039   scrollArr[0].scrollTop = scrollArr[1];
4040  if(scrollArr[2] > 0)
4041   scrollArr[0].scrollLeft = scrollArr[2];
4042 }
4043};
4044ASPx.GetOuterScrollPosition = function(element) {
4045 while(element && element.tagName !== "BODY") {
4046  var scrollTop = element.scrollTop,
4047   scrollLeft = element.scrollLeft;
4048  if(scrollTop > 0 || scrollLeft > 0) {
4049   return {
4050    scrollTop: scrollTop,
4051    scrollLeft: scrollLeft,
4052    element: element
4053   };
4054  }
4055  element = element.parentNode;
4056 }
4057 return {
4058  scrollTop: ASPx.GetDocumentScrollTop(),
4059  scrollLeft: ASPx.GetDocumentScrollLeft()
4060 };
4061};
4062ASPx.RestoreOuterScrollPosition = function(scrollInfo) {
4063 if(scrollInfo.element) {
4064  if(scrollInfo.scrollTop > 0)
4065   scrollInfo.element.scrollTop = scrollInfo.scrollTop;
4066  if(scrollInfo.scrollLeft > 0)
4067   scrollInfo.element.scrollLeft = scrollInfo.scrollLeft;
4068 }
4069 else {
4070  if(scrollInfo.scrollTop > 0)
4071   ASPx.SetDocumentScrollTop(scrollInfo.scrollTop);
4072  if(scrollInfo.scrollLeft > 0)
4073   ASPx.SetDocumentScrollLeft(scrollInfo.scrollLeft);
4074 }
4075};
4076ASPx.ChangeElementContainer = function(element, container, savePreviousContainer) {
4077 if(element.parentNode != container) {
4078  var parentNode = element.parentNode;
4079  parentNode.removeChild(element);
4080  container.appendChild(element);
4081  if(savePreviousContainer)
4082   element.previousContainer = parentNode;
4083 }
4084};
4085ASPx.RestoreElementContainer = function(element) {
4086 if(element.previousContainer) {
4087  ASPx.ChangeElementContainer(element, element.previousContainer, false);
4088  element.previousContainer = null;
4089 }
4090};
4091ASPx.MoveChildrenToElement = function(sourceElement, destinationElement){
4092 while(sourceElement.childNodes.length > 0)
4093  destinationElement.appendChild(sourceElement.childNodes[0]);
4094};
4095ASPx.GetScriptCode = function(script) {
4096 var useFirstChildElement = Browser.Chrome && Browser.Version < 11 || Browser.Safari && Browser.Version < 5; 
4097 var text = useFirstChildElement ? script.firstChild.data : script.text;
4098 var comment = "<!--";
4099 var pos = text.indexOf(comment);
4100 if(pos > -1)
4101  text = text.substr(pos + comment.length);
4102 return text;
4103};
4104ASPx.AppendScript = function(script) {
4105 var parent = document.getElementsByTagName("head")[0];
4106 if(!parent)
4107  parent = document.body;
4108 if(parent)
4109  parent.appendChild(script);
4110};
4111function getFrame(frames, name) {
4112 if(frames[name])
4113  return frames[name];
4114 for(var i = 0; i < frames.length; i++) {
4115  try {
4116   var frame = frames[i];
4117   if(frame.name == name) 
4118    return frame; 
4119   frame = getFrame(frame.frames, name);
4120   if(frame != null)   
4121    return frame; 
4122  } catch(e) {
4123  } 
4124 }
4125 return null;
4126}
4127ASPx.IsValidElement = function(element) {
4128 if(!element) 
4129  return false;
4130 if(!(Browser.Firefox && Browser.Version < 4)) {
4131  if(element.ownerDocument && element.ownerDocument.body && element.ownerDocument.body.compareDocumentPosition)
4132   return element.ownerDocument.body.compareDocumentPosition(element) % 2 === 0;
4133 }
4134 if(!Browser.Opera && !(Browser.IE && Browser.Version < 9) && element.offsetParent && element.parentNode.tagName)
4135  return true;
4136 while(element != null){
4137  if(element.tagName == "BODY")
4138   return true;
4139  element = element.parentNode;
4140 }
4141 return false;
4142};
4143ASPx.IsValidElements = function(elements) {
4144 if(!elements)
4145  return false; 
4146 for(var i = 0; i < elements.length; i++) {
4147  if(elements[i] && !ASPx.IsValidElement(elements[i]))
4148   return false;
4149 }
4150 return true;
4151};
4152ASPx.IsExistsElement = function(element) {
4153 return element && ASPx.IsValidElement(element);
4154};
4155ASPx.CreateHtmlElementFromString = function(str) {
4156 var dummy = ASPx.CreateHtmlElement();
4157 setInnerHtmlInternal(dummy, str);
4158 return dummy.firstChild;
4159};
4160ASPx.CreateHtmlElement = function(tagName, styles) {
4161 var element = document.createElement(tagName || "DIV");
4162 if(styles)
4163  ASPx.SetStyles(element, styles);
4164 return element;
4165};
4166ASPx.RestoreElementOriginalWidth = function(element) {
4167 if(!ASPx.IsExistsElement(element)) 
4168  return;
4169 element.style.width = element.dxOrigWidth = ASPx.GetElementOriginalWidth(element);
4170};
4171ASPx.GetElementOriginalWidth = function(element) {
4172 if(!ASPx.IsExistsElement(element)) 
4173  return null;
4174 var width;
4175 if(!ASPx.IsExists(element.dxOrigWidth)) {
4176   width = String(element.style.width).length > 0
4177  ? element.style.width
4178  : element.offsetWidth + "px";
4179 } else {
4180  width = element.dxOrigWidth;
4181 }
4182 return width;
4183};
4184ASPx.DropElementOriginalWidth = function(element) {
4185 if(ASPx.IsExists(element.dxOrigWidth))
4186  element.dxOrigWidth = null;
4187};
4188ASPx.GetObjectKeys = function(obj) {
4189 if(!obj) return [ ];
4190 if(Object.keys)
4191  return Object.keys(obj);
4192 var keys = [ ];
4193 for(var key in obj) {
4194  if(obj.hasOwnProperty(key))
4195   keys.push(key);
4196 }
4197 return keys;
4198};
4199ASPx.ShowErrorAlert = function(message) {
4200 message = ASPx.Str.DecodeHtmlViaTextArea(message);
4201 if(ASPx.IsExists(message) && message !== "")
4202  alert(message);
4203};
4204ASPx.ShowKBErrorMessage = function(text, kbid) {
4205 ASPx.ShowErrorMessage(text + "https://www.devexpress.com/kbid=" + kbid + ".");
4206};
4207ASPx.ShowErrorMessage = function(errorMessage) {
4208 var console = window.console;
4209 if(!console || !ASPx.IsFunction(console.error))
4210  return;
4211 console.error(errorMessage);
4212};
4213ASPx.IsInteractiveControl = function(element, extremeParent) { 
4214 return Data.ArrayIndexOf(["A", "INPUT", "SELECT", "OPTION", "TEXTAREA", "BUTTON", "IFRAME"], element.tagName) > -1;
4215};
4216ASPx.IsUrlContainsClientScript = function(url) {
4217 return url.toLowerCase().indexOf("javascript:") !== -1;
4218};
4219ASPx.GetMSAjaxRequestManager = function() {
4220 if(window.Sys && Sys.WebForms && Sys.WebForms.PageRequestManager && Sys.WebForms.PageRequestManager.getInstance)
4221  return Sys.WebForms.PageRequestManager.getInstance();
4222 return null;
4223};
4224Function.prototype.aspxBind = function(scope) {
4225 var func = this;
4226 return function() {
4227  return func.apply(scope, arguments);
4228 };
4229};
4230var FilteringUtils = { };
4231FilteringUtils.EventKeyCodeChangesTheInput = function(evt) {
4232 if(ASPx.IsPasteShortcut(evt))
4233  return true;
4234 else if(evt.ctrlKey && !evt.altKey)
4235  return false;
4236 if(ASPx.Browser.AndroidMobilePlatform || ASPx.Browser.MacOSMobilePlatform) return true; 
4237 var keyCode = ASPx.Evt.GetKeyCode(evt);
4238 var isSystemKey = ASPx.Key.Windows <= keyCode && keyCode <= ASPx.Key.ContextMenu;
4239 var isFKey = ASPx.Key.F1 <= keyCode && keyCode <= 127; 
4240 return ASPx.Key.Delete <= keyCode && !isSystemKey && !isFKey || keyCode == ASPx.Key.Backspace || keyCode == ASPx.Key.Space;
4241};
4242FilteringUtils.FormatCallbackArg = function(prefix, arg) {
4243 return (ASPx.IsExists(arg) ? prefix + "|" + arg.length + ';' + arg + ';' : "");
4244};
4245ASPx.FilteringUtils = FilteringUtils;
4246var FormatStringHelper = { };
4247FormatStringHelper.PlaceHolderTemplateStruct = function(startIndex, length, index, placeHolderString){
4248 this.startIndex = startIndex;
4249 this.realStartIndex = 0;
4250 this.length = length;
4251 this.realLength = 0;
4252 this.index = index;
4253 this.placeHolderString = placeHolderString;
4254};
4255FormatStringHelper.GetPlaceHolderTemplates = function(formatString){
4256 formatString = this.CollapseDoubleBrackets(formatString);
4257 var templates = this.CreatePlaceHolderTemplates(formatString);
4258 return templates;
4259};
4260FormatStringHelper.CreatePlaceHolderTemplates = function(formatString){
4261 var templates = [];
4262 var templateStrings = formatString.match(/{[^}]+}/g);
4263 if(templateStrings != null){
4264  var pos = 0;
4265  for(var i = 0; i < templateStrings.length; i++){
4266   var tempString = templateStrings[i];
4267   var startIndex = formatString.indexOf(tempString, pos);
4268   var length = tempString.length;
4269   var indexString = tempString.slice(1).match(/^[0-9]+/);
4270   var index = parseInt(indexString);
4271   templates.push(new this.PlaceHolderTemplateStruct(startIndex, length, index, tempString));
4272   pos = startIndex + length;
4273  }
4274 }
4275 return templates;
4276};
4277FormatStringHelper.CollapseDoubleBrackets = function(formatString){
4278 formatString = this.CollapseOpenDoubleBrackets(formatString);
4279 formatString = this.CollapseCloseDoubleBrackets(formatString);
4280 return formatString;
4281};
4282FormatStringHelper.CollapseOpenDoubleBrackets = function(formatString){
4283 return formatString.replace(/{{/g, "_");
4284};
4285FormatStringHelper.CollapseCloseDoubleBrackets = function(formatString){
4286 while(true){
4287  var index = formatString.lastIndexOf("}}");
4288  if(index == -1) 
4289   break;
4290  else
4291   formatString = formatString.substr(0, index) + "_" + formatString.substr(index + 2);
4292 }
4293 return formatString;
4294};
4295ASPx.FormatStringHelper = FormatStringHelper;
4296var StartWithFilteringUtils = { };
4297StartWithFilteringUtils.HighlightSuggestedText = function(input, suggestedText, control, onChangeInput){
4298 if(this.NeedToLockAndoidKeyEvents(control))
4299  control.LockAndroidKeyEvents();
4300 var selInfo = ASPx.Selection.GetInfo(input);
4301 var currentTextLenght = ASPx.Str.GetCoincideCharCount(suggestedText, input.value, 
4302  function(text, filter) { 
4303   return text.indexOf(filter) == 0;
4304  });
4305 var suggestedTextLenght = suggestedText.length;
4306 var isSelected = selInfo.startPos == 0 && selInfo.endPos == currentTextLenght && 
4307  selInfo.endPos == suggestedTextLenght && input.value == suggestedText;
4308 if(!isSelected) { 
4309  input.value = suggestedText;
4310  if(onChangeInput)
4311   onChangeInput();
4312  if(this.NeedToLockAndoidKeyEvents(control)) {
4313   window.setTimeout(function() {
4314    this.SelectText(input, currentTextLenght, suggestedTextLenght);
4315    control.UnlockAndroidKeyEvents();
4316   }.aspxBind(this), control.adroidSamsungBugTimeout);
4317  } else
4318   this.SelectText(input, currentTextLenght, suggestedTextLenght);
4319 }
4320};
4321StartWithFilteringUtils.SelectText = function(input, startPos, stopPos) {
4322 if(startPos < stopPos)
4323  ASPx.Selection.Set(input, startPos, stopPos);
4324};
4325StartWithFilteringUtils.RollbackOneSuggestedChar = function(input){
4326 var currentText = input.value;
4327 var cutText = currentText.slice(0, -1);
4328 if(cutText != currentText)
4329  input.value = cutText;
4330};
4331StartWithFilteringUtils.NeedToLockAndoidKeyEvents = function(control) {
4332 return ASPx.Browser.AndroidMobilePlatform && control && control.LockAndroidKeyEvents;
4333};
4334ASPx.StartWithFilteringUtils = StartWithFilteringUtils;
4335var ContainsFilteringUtils = { };
4336ContainsFilteringUtils.ColumnSelectionStruct = function(index, startIndex, length){
4337 this.index = index;
4338 this.length = length;
4339 this.startIndex = startIndex;
4340};
4341ContainsFilteringUtils.IsFilterCrossPlaseHolder = function(filterStartIndex, filterEndIndex, template) {
4342 var left = Math.max(filterStartIndex, template.realStartIndex);
4343 var right = Math.min(filterEndIndex,  template.realStartIndex + template.realLength);
4344 return left < right;
4345};
4346ContainsFilteringUtils.GetColumnSelectionsForItem = function(itemValues, formatString, filterString) {
4347 if(formatString == "") 
4348  return this.GetSelectionForSingleColumnItem(itemValues, filterString); 
4349 var result = [];
4350 var formatedString = ASPx.Formatter.Format(formatString, itemValues);
4351 var filterStartIndex = ASPx.Str.PrepareStringForFilter(formatedString).indexOf(ASPx.Str.PrepareStringForFilter(filterString));
4352 if(filterStartIndex == -1) return result;
4353 var filterEndIndex = filterStartIndex + filterString.length;
4354 var templates = FormatStringHelper.GetPlaceHolderTemplates(formatString);
4355 this.SupplyTemplatesWithRealValues(itemValues, templates);
4356 for(var i = 0; i < templates.length ; i++) {
4357  if(this.IsFilterCrossPlaseHolder(filterStartIndex, filterEndIndex, templates[i])) 
4358   result.push(this.GetColumnSelectionsForItemValue(templates[i], filterStartIndex, filterEndIndex));
4359 }
4360 return result;
4361};
4362ContainsFilteringUtils.GetColumnSelectionsForItemValue = function(template, filterStartIndex, filterEndIndex) {
4363 var selectedTextStartIndex = filterStartIndex < template.realStartIndex ? 0 :
4364  filterStartIndex - template.realStartIndex;
4365 var selectedTextEndIndex = filterEndIndex >  template.realStartIndex + template.realLength ? template.realLength :
4366  filterEndIndex - template.realStartIndex;
4367 var selectedTextLength = selectedTextEndIndex - selectedTextStartIndex;
4368 return new this.ColumnSelectionStruct(template.index, selectedTextStartIndex, selectedTextLength);
4369};
4370ContainsFilteringUtils.GetSelectionForSingleColumnItem = function(itemValues, filterString) {
4371 var selectedTextStartIndex = ASPx.Str.PrepareStringForFilter(itemValues[0]).indexOf(ASPx.Str.PrepareStringForFilter(filterString));
4372 var selectedTextLength = filterString.length;
4373 return [new this.ColumnSelectionStruct(0, selectedTextStartIndex, selectedTextLength)];
4374};
4375ContainsFilteringUtils.ResetFormatStringIndex = function(formatString, index) {
4376 if(index != 0)
4377  return formatString.replace(index.toString(), "0");
4378 return formatString;
4379};
4380ContainsFilteringUtils.SupplyTemplatesWithRealValues = function(itemValues, templates) {
4381 var shift = 0;
4382 for(var i = 0; i < templates.length; i++) {
4383  var formatString = this.ResetFormatStringIndex(templates[i].placeHolderString, templates[i].index);
4384  var currentItemValue = itemValues[templates[i].index];
4385  templates[i].realLength = ASPx.Formatter.Format(formatString, currentItemValue).length;
4386  templates[i].realStartIndex  += templates[i].startIndex + shift; 
4387  shift += templates[i].realLength - templates[i].placeHolderString.length; 
4388 }
4389};
4390ContainsFilteringUtils.PrepareElementText = function(itemText) {
4391 return itemText ? itemText.replace(/\&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;") : '';
4392};
4393ContainsFilteringUtils.UnselectContainsTextInElement = function(element, selection, highlightTagName) {
4394 var currentText =  ASPx.Attr.GetAttribute (element, "DXText");
4395 if(ASPx.IsExists(currentText)) {
4396  currentText = ContainsFilteringUtils.PrepareElementText(currentText);
4397  ASPx.Security.setInnerHtml(element, currentText === "" ? "&nbsp;" : currentText, ASPx.Security.DataType.Trusted);
4398 }
4399};
4400ContainsFilteringUtils.ReselectContainsTextInElement = function(element, selection, highlightTagName) {
4401 var currentText = ASPx.GetInnerText(element);
4402 if(!highlightTagName)
4403  highlightTagName = "em";
4404 highlightTagName = highlightTagName.toLowerCase();
4405 if(currentText.indexOf("</" + highlightTagName + ">") != -1)
4406  ContainsFilteringUtils.UnselectContainsTextInElement(element, selection, highlightTagName);
4407 return ContainsFilteringUtils.SelectContainsTextInElement(element, selection, highlightTagName);
4408};
4409ContainsFilteringUtils.SelectContainsTextInElement = function(element, selection, highlightTagName) {
4410 if(selection.startIndex == -1)
4411  return;
4412 var currentText =  ASPx.Attr.GetAttribute (element, "DXText");
4413 if(!ASPx.IsExists(currentText)) ASPx.Attr.SetAttribute (element, "DXText", ASPx.GetInnerText(element));
4414 if(!highlightTagName)
4415  highlightTagName = "em";
4416 highlightTagName = highlightTagName.toLowerCase();
4417 var oldInnerText = ASPx.GetInnerText(element);
4418 var newInnerText = ContainsFilteringUtils.PrepareElementText(oldInnerText.substr(0, selection.startIndex)) + "<" + highlightTagName + ">" +
4419      ContainsFilteringUtils.PrepareElementText(oldInnerText.substr(selection.startIndex, selection.length)) + "</" + highlightTagName + ">" +
4420      ContainsFilteringUtils.PrepareElementText(oldInnerText.substr(selection.startIndex + selection.length));
4421 ASPx.Security.setInnerHtml(element, newInnerText, ASPx.Security.DataType.Trusted);
4422};
4423ASPx.ContainsFilteringUtils = ContainsFilteringUtils;
4424ASPx.MakeEqualControlsWidth = function(name1, name2){
4425 var control1 = ASPx.GetControlCollection().Get(name1);
4426 var control2 = ASPx.GetControlCollection().Get(name2);
4427 if(control1 && control2){
4428  var width = Math.max(control1.GetWidth(), control2.GetWidth());
4429  control1.SetWidth(width);
4430  control2.SetWidth(width);
4431 }
4432};
4433ASPx.HighContrastForeColorHighlightColorMap = {
4434 "#ffff00" : "#008000",
4435 "#00ff00" : "#0000ff",
4436 "#ffffff" : "#00838f",
4437 "#000000" : "#a347ff"
4438};
4439var AccessibilityUtils = {
4440 isInitialized: false,
4441 highContrastCssClassMarker: "dxHighContrast",
4442 highContrastBackgroundCssClassMarker: "dxHCB",
4443 highContrastDefaultBackgroundColor: "#a347ff",
4444 highContrastThemeActive: false,
4445 accessibleBackgroundCssMarker: ".dx-runtime-background",
4446 createAccessibleBackgrounds: function(control) {
4447  if(!this.highContrastThemeActive || control.accessibleBackgroundsCreated || !control.accessibilityCompliant)
4448   return;
4449  var className = this.accessibleBackgroundCssMarker;
4450  var styleSheetRuleNames = [];
4451  iterateStyleSheetRules(null, function(rule) {
4452   var selectorTxt = rule.selectorText;
4453   if(selectorTxt && selectorTxt.indexOf(className) > -1)
4454    styleSheetRuleNames.push(ASPx.Str.CompleteReplace(selectorTxt, className, "")); 
4455  });
4456  for(var i = 0; i < styleSheetRuleNames.length; i++) {
4457   var name = styleSheetRuleNames[i];
4458   var rule = ASPx.GetStyleSheetRules(name.substring(1));
4459   if(rule && rule.style && rule.style.backgroundImage)
4460    this.createAccessibleBackground(control.GetMainElement(), rule.style, name);
4461  }
4462  control.accessibleBackgroundsCreated = true;
4463 },
4464 createAccessibleBackground: function(container, style, selector) {
4465  if(!container)
4466   return;
4467  var backgroundUrl = style.backgroundImage.substring(5, style.backgroundImage.length - 2);
4468  var elements = container.querySelectorAll(selector);
4469  var accessibleBackgroundClassName = "dx-acc-bi";
4470  for(var i = 0; i < elements.length; i++) {
4471   var element = elements[i];
4472   if(ASPx.ElementHasCssClass(element, accessibleBackgroundClassName))
4473    continue;
4474   var image = null;
4475   if(element.tagName !== "IMG") {
4476    ASPx.AddClassNameToElement(element, accessibleBackgroundClassName);
4477    image = element.ownerDocument.createElement("IMG");
4478    ASPx.SetStyles(image, { width: "100%", height: "100%" });
4479    if(element.firstChild)
4480     element.insertBefore(image, element.firstChild);
4481    else
4482     element.appendChild(image);
4483   } else
4484    image = element;
4485   image.src = backgroundUrl;
4486  }
4487 },
4488 createHighContrastBackgroundStyle: function() {
4489  var style = document.createElement('style');
4490  style.type = 'text/css';
4491  var styleContent = [
4492   "." + this.highContrastCssClassMarker + " ." + this.highContrastBackgroundCssClassMarker + ":after {",
4493   "border-image: url(" + this.getHighContrastBackgroundUrl() + ") 0 1 0 0 round;",
4494   "}",
4495  ];
4496  setInnerHtmlInternal(style, styleContent.join('\n'));
4497  document.getElementsByTagName('head')[0].appendChild(style);
4498 },
4499 getHighContrastBackgroundUrl: function() {
4500  var canvas = document.createElement("canvas"),
4501  ctx = canvas.getContext('2d');
4502  canvas.width = 1;
4503  canvas.height = 1;
4504  ctx.fillStyle = this.getHighContrastBackgroundColor();
4505  ctx.fillRect(0, 0, canvas.width, canvas.height);
4506  return canvas.toDataURL();
4507 },
4508 getHighContrastBackgroundColor: function() {
4509  var foreColor = ASPx.GetCurrentStyle(document.body).color;
4510  var hexColor = ASPx.Color.ColorToHexadecimal(foreColor);
4511  return ASPx.HighContrastForeColorHighlightColorMap[hexColor] || this.highContrastDefaultBackgroundColor;
4512 },
4513 initialize: function() {
4514  if(this.isInitialized)
4515   return;
4516  this.isInitialized = true;
4517  this.detectHighContrastTheme();
4518  if(this.highContrastThemeActive)
4519   this.createHighContrastBackgroundStyle();
4520 },
4521 detectHighContrastTheme: function() {
4522  var testElement = document.createElement("DIV");
4523  ASPx.SetStyles(testElement, {
4524   backgroundImage: "url('" + ASPx.EmptyImageUrl + "')",
4525   display: "none"
4526  }, true);
4527  var docElement = document.documentElement;
4528  docElement.appendChild(testElement);
4529  var actualBackgroundImg = ASPx.GetCurrentStyle(testElement).backgroundImage;
4530  docElement.removeChild(testElement);
4531  if(actualBackgroundImg === "none") {
4532   this.highContrastThemeActive = true;
4533   ASPx.AddClassNameToElement(docElement, this.highContrastCssClassMarker);
4534  }
4535 }
4536};
4537ASPx.AccessibilityUtils = AccessibilityUtils;
4538ASPx.AccessibilityUtils.SendMessageToAssistiveTechnology = function(message) {
4539 var messageParts = ASPx.Ident.IsArray(message) ? message : [message];
4540 var args = new ASPxClientControlBeforePronounceEventArgs(messageParts, null);
4541 ASPx.AccessibilityPronouncer.EnsureInitialize();
4542 ASPx.AccessibilityPronouncer.Pronounce(args, ASPx.AccessibilityPronouncerType.live);
4543};
4544ASPx.AccessibilityUtils.SetFocusAccessible = function(focusableElement) {
4545 if(!focusableElement)
4546  return;
4547 var elementId = focusableElement.id;
4548 if(!elementId) {
4549  var namedParent = ASPx.GetParent(focusableElement, function(element) {
4550   return !!element.id;
4551  });
4552  if(ASPx.IsExists(namedParent))
4553   elementId = namedParent.id;
4554 }
4555 var focusableControl = ASPx.GetClientControlByElementID(elementId);
4556 if(focusableControl && focusableControl.OnAssociatedLabelClick)
4557  focusableControl.OnAssociatedLabelClick(focusableElement);
4558 else
4559  window.setTimeout(function() {
4560   ASPx.AccessibilityUtils.SetFocusAccessibleCore(focusableElement);
4561  }, 0);
4562};
4563ASPx.AccessibilityUtils.SetFocusAccessibleCore = function(focusableElement) {
4564 if(!ASPx.IsExists(focusableElement))
4565  return;
4566 if(!ASPx.IsValidElement(focusableElement) && focusableElement.id)
4567  focusableElement = ASPx.GetElementById(focusableElement.id);
4568 if(!ASPx.IsActionElement(focusableElement))
4569  focusableElement = ASPx.RestoreFocusHelper.findNeighbourFocusElement(focusableElement, document.body);
4570 if(ASPx.IsExistsElement(focusableElement))
4571  focusableElement.focus();
4572};
4573var Security = {
4574 setInnerHtml: function(el, html, dataType) {
4575  if(!html) {
4576   while(el.firstChild)
4577    ASPx.RemoveElement(el.firstChild);
4578  } else
4579   Security.setData(html, function(d) { ASPx.SetInnerHtml.call(window, el, d); }, dataType);
4580 },
4581 setText: function(control, text, dataType) { Security.setData(text, control.SetText.aspxBind(control), dataType); },
4582 safeEncodeHtml: function(html) { return ASPx.Str.EncodeHtml(ASPx.Str.DecodeHtml(html)); },
4583 setData: function(data, dataSetter, dataType) {
4584  if(dataType === undefined)
4585   throw new Error("Specify the dataType");
4586  if(dataType == Security.DataType.Untrusted)
4587   data = Security.safeEncodeHtml(data);
4588  dataSetter(data);
4589 }
4590};
4591Security.DataType = {
4592 Trusted: 0,
4593 Untrusted: 1
4594};
4595ASPx.EnableCssAnimation = true;
4596var AnimationTransitionBase = ASPx.CreateClass(null, {
4597 constructor: function(element, options) {
4598  if(element) {
4599   AnimationTransitionBase.Cancel(element);
4600   this.element = element;
4601   this.element.aspxTransition = this;
4602  }
4603  this.duration = options.duration || AnimationConstants.Durations.DEFAULT;
4604  this.transition = options.transition || AnimationConstants.Transitions.SINE;
4605  this.property = options.property;
4606  this.unit = options.unit || "";
4607  this.onComplete = options.onComplete;
4608  this.to = null;
4609  this.from = null;
4610 },
4611 Start: function(from, to) {
4612  if(to != undefined) {
4613   this.to = to;
4614   this.from = from;
4615   this.SetValue(this.from);
4616  }
4617  else
4618   this.to = from;
4619 },
4620 Cancel: function() {
4621  if(!this.element)
4622   return;
4623  try {
4624   delete this.element.aspxTransition;
4625  } catch(e) {
4626   this.element.aspxTransition = undefined;
4627  }
4628 },
4629 GetValue: function() {
4630  return this.getValueInternal(this.element, this.property);
4631 },
4632 SetValue: function(value) {
4633  this.setValueInternal(this.element, this.property, this.unit, value);
4634 },
4635 setValueInternal: function(element, property, unit, value) {
4636  if(property == "opacity")
4637   AnimationUtils.setOpacity(element, value);
4638  else
4639   element.style[property] = value + unit;
4640 },
4641 getValueInternal: function(element, property) {
4642  if(property == "opacity")
4643   return ASPx.GetElementOpacity(element);
4644  var value = parseFloat(element.style[property]);
4645  return isNaN(value) ? 0 : value;
4646 },
4647 performOnComplete: function() {
4648  if(this.onComplete)
4649   this.onComplete(this.element);
4650 },
4651 getTransition: function() {
4652  return this.transition;
4653 }
4654});
4655AnimationTransitionBase.Cancel = function(element) {
4656 if(element.aspxTransition)
4657  element.aspxTransition.Cancel();
4658};
4659var AnimationConstants = {};
4660AnimationConstants.Durations = {
4661 SHORT: 200,
4662 DEFAULT: 400,
4663 LONG: 600
4664};
4665AnimationConstants.Transitions = {
4666 LINER: {
4667  Css: "cubic-bezier(0.250, 0.250, 0.750, 0.750)",
4668  Js: function(progress) { return progress; }
4669 },
4670 SINE: {
4671  Css: "cubic-bezier(0.470, 0.000, 0.745, 0.715)",
4672  Js: function(progress) { return Math.sin(progress * 1.57); }
4673 },
4674 POW: {
4675  Css: "cubic-bezier(0.755, 0.050, 0.855, 0.060)",
4676  Js: function(progress) { return Math.pow(progress, 4); }
4677 },
4678 POW_EASE_OUT: {
4679  Css: "cubic-bezier(0.165, 0.840, 0.440, 1.000)",
4680  Js: function(progress) { return 1 - AnimationConstants.Transitions.POW.Js(1 - progress); }
4681 },
4682 RIPPLE: {
4683  Css: "cubic-bezier(0.47, 0.06, 0.23, 0.99)",
4684  Js: function(progress) {
4685   return Math.pow((progress), 3) * 0.47 + 3 * progress * Math.pow((1 - progress), 2) * 0.06 + 3 * Math.pow(progress, 2) *
4686    (1 - progress) * 0.23 + 0.99 * Math.pow(progress, 3);
4687  }
4688 }
4689};
4690var JsAnimationTransition = ASPx.CreateClass(AnimationTransitionBase, {
4691 constructor: function(element, options) {
4692  this.constructor.prototype.constructor.call(this, element, options);
4693  this.onStep = options.onStep;
4694  this.fps = 60;
4695  this.startTime = null;
4696 },
4697 Start: function(from, to) {
4698  if(from == to) {
4699   this.from = this.to = from;
4700   setTimeout(this.complete.aspxBind(this), 0);
4701  }
4702  else {
4703   AnimationTransitionBase.prototype.Start.call(this, from, to);
4704   if(to == undefined)
4705    this.from = this.GetValue();
4706   this.initTimer();
4707  }
4708 },
4709 Cancel: function() {
4710  AnimationTransitionBase.prototype.Cancel.call(this);
4711  if(this.timerId)
4712   clearInterval(this.timerId);
4713 },
4714 initTimer: function() {
4715  this.startTime = new Date();
4716  this.timerId = window.setInterval(function() { this.onTick(); }.aspxBind(this), 1000 / this.fps);
4717 },
4718 onTick: function() {
4719  var progress = (new Date() - this.startTime) / this.duration;
4720  if(progress >= 1)
4721   this.complete();
4722  else {
4723   this.update(progress);
4724   if(this.onStep)
4725    this.onStep();
4726  }
4727 },
4728 update: function(progress) {
4729  this.SetValue(this.gatCalculatedValue(this.from, this.to, progress));
4730 },
4731 complete: function() {
4732  this.Cancel();
4733  this.update(1);
4734  this.performOnComplete();
4735 },
4736 gatCalculatedValue: function(from, to, progress) {
4737  if(progress == 1)
4738   return to;
4739  return from + (to - from) * this.getTransition()(progress);
4740 },
4741 getTransition: function() {
4742  return this.transition.Js;
4743 }
4744});
4745var SimpleAnimationTransition = ASPx.CreateClass(JsAnimationTransition, {
4746 constructor: function(options) {
4747  this.constructor.prototype.constructor.call(this, null, options);
4748  this.transition = options.transition || AnimationConstants.Transitions.POW_EASE_OUT;
4749  this.onUpdate = options.onUpdate;
4750  this.lastValue = 0;
4751 },
4752 SetValue: function(value) {
4753  this.onUpdate(value - this.lastValue);
4754  this.lastValue = value;
4755 },
4756 GetValue: function() {
4757  return this.lastValue;
4758 },
4759 performOnComplete: function() {
4760  if(this.onComplete)
4761   this.onComplete();
4762 }
4763});
4764var MultipleJsAnimationTransition = ASPx.CreateClass(JsAnimationTransition, {
4765 constructor: function(element, options) {
4766  this.constructor.prototype.constructor.call(this, element, options);
4767  this.properties = {};
4768 },
4769 Start: function(properties) {
4770  this.initProperties(properties);
4771  this.initTimer();
4772 },
4773 initProperties: function(properties) {
4774  this.properties = properties;
4775  for(var propName in this.properties)
4776   if(properties[propName].from == undefined)
4777    properties[propName].from = this.getValueInternal(this.element, propName);
4778 },
4779 update: function(progress) {
4780  for(var propName in this.properties) {
4781   if(this.properties.hasOwnProperty(propName)) {
4782    var property = this.properties[propName];
4783    if(property.from != property.to)
4784     this.setValueInternal(this.element, propName, property.unit, this.gatCalculatedValue(property.from, property.to, progress));
4785   }
4786  }
4787 }
4788});
4789var CssAnimationTransition = ASPx.CreateClass(AnimationTransitionBase, {
4790 constructor: function(element, options) {
4791  this.constructor.prototype.constructor.call(this, element, options);
4792  this.transitionPropertyName = AnimationUtils.CurrentTransition.property;
4793  this.eventName = AnimationUtils.CurrentTransition.event;
4794 },
4795 Start: function(from, to) {
4796  AnimationTransitionBase.prototype.Start.call(this, from, to);
4797  this.startTimerId = window.setTimeout(function() {
4798   if(this.from == this.to)
4799    this.onTransitionEnd();
4800   else {
4801    var isHidden = this.element.offsetHeight == 0 && this.element.offsetWidth == 0; 
4802    if(!isHidden)
4803     this.prepareElementBeforeAnimation();
4804    this.SetValue(this.to);
4805    if(isHidden)
4806     this.onTransitionEnd();
4807   }
4808  }.aspxBind(this), 0);
4809 },
4810 Cancel: function() {
4811  window.clearTimeout(this.startTimerId);
4812  AnimationTransitionBase.prototype.Cancel.call(this);
4813  ASPx.Evt.DetachEventFromElement(this.element, this.eventName, CssAnimationTransition.transitionEnd);
4814  this.setValueInternal(this.element, this.transitionPropertyName, "", "");
4815  this.stopAnimation();
4816 },
4817 prepareElementBeforeAnimation: function() {
4818  ASPx.Evt.AttachEventToElement(this.element, this.eventName, CssAnimationTransition.transitionEnd);
4819  var dummy = this.element.offsetHeight;
4820  this.element.style[this.transitionPropertyName] = this.getTransitionCssString();
4821  if(ASPx.Browser.Safari && ASPx.Browser.MacOSMobilePlatform && ASPx.Browser.MajorVersion >= 8) 
4822   setTimeout(function() {
4823    if(this.element && this.element.aspxTransition) {
4824     this.element.style[this.transitionPropertyName] = "";
4825     this.element.aspxTransition.onTransitionEnd();
4826    }
4827   }.aspxBind(this), this.duration + 100);
4828 },
4829 stopAnimation: function() {
4830  this.SetValue(ASPx.GetCurrentStyle(this.element)[this.property]);
4831 },
4832 onTransitionEnd: function() {
4833  this.Cancel();
4834  this.performOnComplete();
4835 },
4836 getTransition: function() {
4837  return this.transition.Css;
4838 },
4839 getTransitionCssString: function() {
4840  return this.getTransitionCssStringInternal(this.getCssName(this.property));
4841 },
4842 getTransitionCssStringInternal: function(cssProperty) {
4843  return cssProperty + " " + this.duration + "ms " + this.getTransition();
4844 },
4845 getCssName: function(property) {
4846  switch(property) {
4847   case "marginLeft":
4848    return "margin-left";
4849   case "marginTop":
4850    return "margin-top";
4851  }
4852  return property;
4853 }
4854});
4855var MultipleCssAnimationTransition = ASPx.CreateClass(CssAnimationTransition, {
4856 constructor: function(element, options) {
4857  this.constructor.prototype.constructor.call(this, element, options);
4858  this.properties = null;
4859 },
4860 Start: function(properties) {
4861  this.properties = properties;
4862  this.forEachProperties(function(property, propName) {
4863   if(property.from !== undefined)
4864    this.setValueInternal(this.element, propName, property.unit, property.from);
4865  }.aspxBind(this));
4866  this.prepareElementBeforeAnimation();
4867  window.setTimeout(function() {
4868   this.forEachProperties(function(property, propName) {
4869    this.setValueInternal(this.element, propName, property.unit, property.to);
4870   }.aspxBind(this));
4871  }.aspxBind(this), 0);
4872 },
4873 stopAnimation: function() {
4874  var style = ASPx.GetCurrentStyle(this.element);
4875  this.forEachProperties(function(property, propName) {
4876   this.setValueInternal(this.element, propName, "", style[propName]);
4877  }.aspxBind(this));
4878 },
4879 getTransitionCssString: function() {
4880  var str = "";
4881  this.forEachProperties(function(property, propName) {
4882   str += this.getTransitionCssStringInternal(this.getCssName(propName)) + ",";
4883  }.aspxBind(this));
4884  str = str.substring(0, str.length - 1);
4885  return str;
4886 },
4887 forEachProperties: function(func) {
4888  for(var propName in this.properties) {
4889   if(this.properties.hasOwnProperty(propName)) {
4890    var property = this.properties[propName];
4891    if(property.from == undefined)
4892     property.from = this.getValueInternal(this.element, propName);
4893    if(property.from != property.to)
4894     func(property, propName);
4895   }
4896  }
4897 }
4898});
4899CssAnimationTransition.transitionEnd = function(evt) {
4900 var element = evt.target;
4901 if(element && element.aspxTransition)
4902  element.aspxTransition.onTransitionEnd();
4903};
4904var AnimationUtils = {
4905 CanUseCssTransition: function() { return ASPx.EnableCssAnimation && this.CurrentTransition; },
4906 CanUseCssTransform: function() { return this.CanUseCssTransition() && this.CurrentTransform; },
4907 CurrentTransition: (function() {
4908  if(ASPx.Browser.IE) 
4909   return null;
4910  var transitions = [
4911   { property: "webkitTransition", event: "webkitTransitionEnd" },
4912   { property: "MozTransition", event: "transitionend" },
4913   { property: "OTransition", event: "oTransitionEnd" },
4914   { property: "transition", event: "transitionend" }
4915  ];
4916  var fakeElement = document.createElement("DIV");
4917  for(var i = 0; i < transitions.length; i++)
4918   if(transitions[i].property in fakeElement.style)
4919    return transitions[i];
4920 })(),
4921 CurrentTransform: (function() {
4922  var transforms = ["transform", "MozTransform", "-webkit-transform", "msTransform", "OTransform"];
4923  var fakeElement = document.createElement("DIV");
4924  for(var i = 0; i < transforms.length; i++)
4925   if(transforms[i] in fakeElement.style)
4926    return transforms[i];
4927 })(),
4928 SetTransformValue: function(element, position, isTop) {
4929  if(this.CanUseCssTransform())
4930   element.style[this.CurrentTransform] = this.GetTransformCssText(position, isTop);
4931  else
4932   element.style[!isTop ? "left" : "top"] = position + "px";
4933 },
4934 GetTransformValue: function(element, isTop) {
4935  if(this.CanUseCssTransform()) {
4936   var cssValue = element.style[this.CurrentTransform];
4937   return cssValue && cssValue != "none" ? Number(cssValue.replace('matrix(1, 0, 0, 1,', '').replace(')', '').split(',')[!isTop ? 0 : 1]) : 0;
4938  }
4939  else
4940   return !isTop ? element.offsetLeft : element.offsetTop;
4941 },
4942 GetTransformCssText: function(position, isTop) {
4943  if(!position)
4944   return "none";
4945  return "matrix(1, 0, 0, 1," + (!isTop ? position : 0) + ", " + (!isTop ? 0 : position) + ")";
4946 },
4947 createMultipleAnimationTransition: function (element, options) {
4948  return this.CanUseCssTransition() && !options.onStep ? new MultipleCssAnimationTransition(element, options) : new MultipleJsAnimationTransition(element, options);
4949 },
4950 createSimpleAnimationTransition: function(options) {
4951  return new SimpleAnimationTransition(options);
4952 },
4953 createJsAnimationTransition: function(element, options) {
4954  return new JsAnimationTransition(element, options);
4955 },
4956 createCssAnimationTransition: function(element, options) {
4957  return new CssAnimationTransition(element, options);
4958 },
4959 setOpacity: function(element, value) {
4960  ASPx.SetElementOpacity(element, value);
4961 }
4962};
4963var AsyncTracker = function() {
4964 var currentToken,
4965  lockedTokens,
4966  onDoneDelegates,
4967  lockedDelegates;
4968 function clearState() {
4969  currentToken = 1;
4970  lockedTokens = [];
4971  onDoneDelegates = [];
4972  lockedDelegates = {};
4973 }
4974 clearState();
4975 var log = function(msg) { };
4976 function setLog(delegate){
4977  log = delegate;
4978 }
4979 function getLockToken() {
4980  if(onDoneDelegates.length === 0)
4981   return -1;
4982  var token = currentToken++;
4983  lockedTokens.push(token);
4984  lockedDelegates[token] = [];
4985  for (var i = 0; i < onDoneDelegates.length; i++) {
4986   lockedDelegates[token].push(onDoneDelegates[i]);
4987  }
4988  log("module locks token " + token);
4989  return token;
4990 }
4991 function releaseToken(token) {
4992  if(token < 0) return;
4993  log("module releasing token " + token);
4994  ASPx.Data.ArrayRemove(lockedTokens, token);
4995  delete lockedDelegates[token];
4996  invokeUnlockedDelegates();
4997  if(lockedTokens.length === 0)
4998   clearState();
4999  log("module released token " + token);
5000 }
5001 function invokeUnlockedDelegates() {
5002  var onDoneDelegate;
5003  for (var i = onDoneDelegates.length - 1; i >= 0; i--) {
5004   if(onDoneDelegates[i] && !isDelegateLocked(onDoneDelegates[i])) {
5005    onDoneDelegate = onDoneDelegates[i];
5006    delete onDoneDelegates[i];
5007    onDoneDelegate();
5008   }
5009  }
5010 }
5011 function isDelegateLocked(delegate) {
5012  for (var i = lockedTokens.length - 1; i >= 0; i--) {
5013   var token = lockedTokens[i];
5014   var delegates = lockedDelegates[token];
5015   if(delegates) {
5016    for (var j = delegates.length - 1; j >= 0; j--) {
5017     if(delegates[j] && delegates[j] === delegate)
5018      return true;
5019    }
5020   }
5021  }
5022  return false;
5023 }
5024 function track(doDelegate, onDoneDelegate) {
5025  if(onDoneDelegate)
5026   onDoneDelegates.push(onDoneDelegate);
5027  doDelegate();
5028  if(onDoneDelegate)
5029   invokeUnlockedDelegates();
5030 }
5031 return {
5032  getLockToken: getLockToken,
5033  releaseToken: releaseToken,
5034  track: track,
5035  setLog:setLog,
5036 };
5037};
5038var GetEditorValuesInContainer = function(containerOrId, processInvisibleEditors, needSerialize) {
5039 var container = typeof(containerOrId) === "string" ? ASPx.GetElementById(containerOrId) : containerOrId;
5040 var result = {};
5041 ASPx.ProcessEditorsInContainer(container, function(editor){
5042  result[editor.name] = GetCorrectedByTypeValue(ASPx.GetEditorValueByControl(editor), needSerialize);
5043 }, null, null, processInvisibleEditors, false);
5044 return result;
5045};
5046var GetCorrectedByTypeValue = function(value, needSerialize){
5047 if(ASPx.Ident.IsArray(value))
5048  for(var i = 0; i < value.length; i++)
5049   value[i] = GetCorrectedByTypeValue(value[i]);
5050 if(needSerialize && ASPx.Ident.IsDate(value))
5051  return ASPx.DateUtils.GetInvariantDateTimeString(value);
5052 return value;
5053};
5054ASPx.GetEditorValueByControl = function(control, needSerialize) {
5055 var result;
5056 if(ASPx.IsMultipleValueOwner(control))
5057  result = control.GetSelectedValues();
5058 if(ASPx.IsTokenBox(control)) {
5059  if(needSerialize)
5060   result = control.GetTokenValuesCollection();
5061  else
5062   result = control.GetTokenCollection();
5063 }
5064 return result || control.GetValue();
5065};
5066ASPx.IsMultipleValueOwner = function(control) {
5067 return ASPx.IsListBox(control) || ASPx.IsCheckBoxList(control);
5068};
5069ASPx.IsCheckBoxList = function(control) {
5070 return control && typeof(ASPxClientCheckBoxList) != "undefined" && control instanceof ASPxClientCheckBoxList;
5071};
5072ASPx.IsListBox = function(control) {
5073 return control && typeof(ASPxClientListBox) != "undefined" && control instanceof ASPxClientListBox;
5074};
5075ASPx.IsComboBox = function(control) {
5076 return control && typeof(ASPxClientComboBox) != "undefined" && control instanceof ASPxClientComboBox;
5077};
5078ASPx.IsTokenBox = function(control) {
5079 return control && typeof(ASPxClientTokenBox) != "undefined" && control instanceof ASPxClientTokenBox;
5080};
5081ASPx.IsGridLookup = function(control) {
5082 return control && typeof(MVCxClientGridLookup) != "undefined" && control instanceof MVCxClientGridLookup;
5083};
5084ASPx.IsSpinEdit = function(control) {
5085 return control && typeof(ASPxClientSpinEdit) != "undefined" && control instanceof ASPxClientSpinEdit;
5086};
5087ASPxClientUtils = {};
5088ASPxClientUtils.agent = Browser.UserAgent;
5089ASPxClientUtils.opera = Browser.Opera;
5090ASPxClientUtils.opera9 = Browser.Opera && Browser.MajorVersion == 9;
5091ASPxClientUtils.safari = Browser.Safari;
5092ASPxClientUtils.safari3 = Browser.Safari && Browser.MajorVersion == 3;
5093ASPxClientUtils.safariMacOS = Browser.Safari && Browser.MacOSPlatform;
5094ASPxClientUtils.chrome = Browser.Chrome;
5095ASPxClientUtils.ie = Browser.IE;
5096ASPxClientUtils.ie7 = Browser.IE && Browser.MajorVersion == 7;
5097ASPxClientUtils.firefox = Browser.Firefox;
5098ASPxClientUtils.firefox3 = Browser.Firefox && Browser.MajorVersion == 3;
5099ASPxClientUtils.mozilla = Browser.Mozilla;
5100ASPxClientUtils.netscape = Browser.Netscape;
5101ASPxClientUtils.browserVersion = Browser.Version;
5102ASPxClientUtils.browserMajorVersion = Browser.MajorVersion;
5103ASPxClientUtils.macOSPlatform = Browser.MacOSPlatform;
5104ASPxClientUtils.windowsPlatform = Browser.WindowsPlatform;
5105ASPxClientUtils.webKitFamily = Browser.WebKitFamily;
5106ASPxClientUtils.netscapeFamily = Browser.NetscapeFamily;
5107ASPxClientUtils.touchUI = Browser.TouchUI;
5108ASPxClientUtils.webKitTouchUI = Browser.WebKitTouchUI;
5109ASPxClientUtils.msTouchUI = Browser.MSTouchUI;
5110ASPxClientUtils.iOSPlatform = Browser.MacOSMobilePlatform;
5111ASPxClientUtils.androidPlatform = Browser.AndroidMobilePlatform;
5112ASPxClientUtils.ArrayInsert = Data.ArrayInsert;
5113ASPxClientUtils.ArrayRemove = Data.ArrayRemove;
5114ASPxClientUtils.ArrayRemoveAt = Data.ArrayRemoveAt;
5115ASPxClientUtils.ArrayClear = Data.ArrayClear;
5116ASPxClientUtils.ArrayIndexOf = Data.ArrayIndexOf;
5117ASPxClientUtils.AttachEventToElement = Evt.AttachEventToElement;
5118ASPxClientUtils.DetachEventFromElement = Evt.DetachEventFromElement;
5119ASPxClientUtils.GetEventSource = Evt.GetEventSource;
5120ASPxClientUtils.GetEventX = Evt.GetEventX;
5121ASPxClientUtils.GetEventY = Evt.GetEventY;
5122ASPxClientUtils.GetKeyCode = Evt.GetKeyCode;
5123ASPxClientUtils.PreventEvent = Evt.PreventEvent;
5124ASPxClientUtils.PreventEventAndBubble = Evt.PreventEventAndBubble;
5125ASPxClientUtils.PreventDragStart = Evt.PreventDragStart;
5126ASPxClientUtils.ClearSelection = Selection.Clear;
5127ASPxClientUtils.IsExists = ASPx.IsExists;
5128ASPxClientUtils.IsFunction = ASPx.IsFunction;
5129ASPxClientUtils.GetAbsoluteX = ASPx.GetAbsoluteX;
5130ASPxClientUtils.GetAbsoluteY = ASPx.GetAbsoluteY;
5131ASPxClientUtils.SetAbsoluteX = ASPx.SetAbsoluteX;
5132ASPxClientUtils.SetAbsoluteY = ASPx.SetAbsoluteY;
5133ASPxClientUtils.GetDocumentScrollTop = ASPx.GetDocumentScrollTop;
5134ASPxClientUtils.GetDocumentScrollLeft = ASPx.GetDocumentScrollLeft;
5135ASPxClientUtils.GetDocumentClientWidth = ASPx.GetDocumentClientWidth;
5136ASPxClientUtils.GetDocumentClientHeight = ASPx.GetDocumentClientHeight;
5137ASPxClientUtils.GetIsParent = ASPx.GetIsParent;
5138ASPxClientUtils.GetParentById = ASPx.GetParentById;
5139ASPxClientUtils.GetParentByTagName = ASPx.GetParentByTagName;
5140ASPxClientUtils.GetParentByClassName = ASPx.GetParentByPartialClassName;
5141ASPxClientUtils.GetChildById = ASPx.GetChildById;
5142ASPxClientUtils.GetChildByTagName = ASPx.GetChildByTagName;
5143ASPxClientUtils.SetCookie = Cookie.SetCookie;
5144ASPxClientUtils.GetCookie = Cookie.GetCookie;
5145ASPxClientUtils.DeleteCookie = Cookie.DelCookie;
5146ASPxClientUtils.GetShortcutCode = ASPx.GetShortcutCode; 
5147ASPxClientUtils.GetShortcutCodeByEvent = ASPx.GetShortcutCodeByEvent;
5148ASPxClientUtils.StringToShortcutCode = ASPx.ParseShortcutString;
5149ASPxClientUtils.Trim = Str.Trim; 
5150ASPxClientUtils.TrimStart = Str.TrimStart;
5151ASPxClientUtils.TrimEnd = Str.TrimEnd;
5152ASPxClientUtils.GetEditorValuesInContainer = GetEditorValuesInContainer;
5153ASPxClientUtils.SendMessageToAssistiveTechnology = ASPx.AccessibilityUtils.SendMessageToAssistiveTechnology;
5154window.ASPxClientUtils = ASPxClientUtils;
5155ASPx.AnimationUtils = AnimationUtils;
5156ASPx.AnimationTransitionBase = AnimationTransitionBase;
5157ASPx.AnimationConstants = AnimationConstants;
5158ASPx.AsyncTracker = AsyncTracker;
5159ASPx.Security = Security;
5160})();
5161
5162(function () {
5163ASPx.classesScriptParsed = false;
5164ASPx.documentLoaded = false; 
5165ASPx.CallbackType = {
5166 Data: "d",
5167 Common: "c"
5168};
5169ASPx.callbackState = {
5170 aborted: "aborted",
5171 inTurn: "inTurn",
5172 sent: "sent"
5173};
5174var ASPxClientEvent = ASPx.CreateClass(null, {
5175 constructor: function() {
5176  this.handlerInfoList = [];
5177  this.firingIndex = -1;
5178 },
5179 AddHandler: function(handler, executionContext) {
5180  if(typeof(executionContext) == "undefined")
5181   executionContext = null;
5182  this.RemoveHandler(handler, executionContext);
5183  var handlerInfo = ASPxClientEvent.CreateHandlerInfo(handler, executionContext);
5184  this.handlerInfoList.push(handlerInfo);
5185 },
5186 RemoveHandler: function(handler, executionContext) {
5187  this.removeHandlerByCondition(function(handlerInfo) {
5188   return handlerInfo.handler == handler && 
5189    (!executionContext || handlerInfo.executionContext == executionContext);
5190  });
5191 },
5192 removeHandlerByCondition: function(predicate) {
5193   for(var i = this.handlerInfoList.length - 1; i >= 0; i--) {
5194   var handlerInfo = this.handlerInfoList[i];
5195   if(predicate(handlerInfo)) {
5196    ASPx.Data.ArrayRemoveAt(this.handlerInfoList, i);
5197    if(i <= this.firingIndex)
5198     this.firingIndex--;
5199   }
5200  }
5201 },
5202 removeHandlerByControlName: function(controlName) {
5203  this.removeHandlerByCondition(function(handlerInfo) {
5204   return handlerInfo.executionContext &&  
5205    handlerInfo.executionContext.name === controlName;
5206  });
5207 },
5208 ClearHandlers: function() {
5209  this.handlerInfoList.length = 0;
5210 },
5211 FireEvent: function(obj, args) {
5212  for(this.firingIndex = 0; this.firingIndex < this.handlerInfoList.length; this.firingIndex++) {
5213   var handlerInfo = this.handlerInfoList[this.firingIndex];
5214   handlerInfo.handler.call(handlerInfo.executionContext, obj, args);
5215  }
5216 },
5217 InsertFirstHandler: function(handler, executionContext){
5218  if(typeof(executionContext) == "undefined")
5219   executionContext = null;
5220  var handlerInfo = ASPxClientEvent.CreateHandlerInfo(handler, executionContext);
5221  ASPx.Data.ArrayInsert(this.handlerInfoList, handlerInfo, 0);
5222 },
5223 IsEmpty: function() {
5224  return this.handlerInfoList.length == 0;
5225 }
5226});
5227ASPxClientEvent.CreateHandlerInfo = function(handler, executionContext) {
5228 return {
5229  handler: handler,
5230  executionContext: executionContext
5231 };
5232};
5233var ASPxClientEventArgs = ASPx.CreateClass(null, {
5234 constructor: function() {
5235 }
5236});
5237ASPxClientEventArgs.Empty = new ASPxClientEventArgs();
5238var ASPxClientCancelEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
5239 constructor: function(){
5240  this.constructor.prototype.constructor.call(this);
5241  this.cancel = false;
5242 }
5243});
5244var ASPxClientProcessingModeEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
5245 constructor: function(processOnServer){
5246  this.constructor.prototype.constructor.call(this);
5247  this.processOnServer = !!processOnServer;
5248 }
5249});
5250var ASPxClientProcessingModeCancelEventArgs = ASPx.CreateClass(ASPxClientProcessingModeEventArgs, {
5251 constructor: function(processOnServer){
5252  this.constructor.prototype.constructor.call(this, processOnServer);
5253  this.cancel = false;
5254 }
5255});
5256var OrderedMap = ASPx.CreateClass(null, {
5257 constructor: function(){
5258  this.entries = {};
5259  this.firstEntry = null;
5260  this.lastEntry = null;
5261 },
5262 add: function(key, element) {
5263  var entry = this.addEntry(key, element);
5264  this.entries[key] = entry;
5265 },
5266 remove: function(key) {
5267  var entry = this.entries[key];
5268  if(entry === undefined)
5269   return;
5270  this.removeEntry(entry);
5271  delete this.entries[key];
5272 },
5273 clear: function() {
5274  this.markAllEntriesAsRemoved();
5275  this.entries = {};
5276  this.firstEntry = null;
5277  this.lastEntry = null;
5278 },
5279 get: function(key) {
5280  var entry = this.entries[key];
5281  return entry ? entry.value : undefined;
5282 },
5283 forEachEntry: function(processFunc, context) {
5284  context = context || this;
5285  for(var entry = this.firstEntry; entry; entry = entry.next) {
5286   if(entry.removed)
5287    continue;
5288   if(processFunc.call(context, entry.key, entry.value))
5289    return;
5290  }
5291 },
5292 addEntry: function(key, element) {
5293  var entry = { key: key, value: element, next: null, prev: null };
5294  if(!this.firstEntry)
5295   this.firstEntry = entry;
5296  else {
5297   entry.prev = this.lastEntry;
5298   this.lastEntry.next = entry;
5299  }
5300  this.lastEntry = entry;
5301  return entry;
5302 },
5303 removeEntry: function(entry) {
5304  if(this.firstEntry == entry)
5305   this.firstEntry = entry.next;
5306  if(this.lastEntry == entry)
5307   this.lastEntry = entry.prev;
5308  if(entry.prev)
5309   entry.prev.next = entry.next;
5310  if(entry.next)
5311   entry.next.prev = entry.prev;
5312  entry.removed = true;
5313 },
5314 markAllEntriesAsRemoved: function() {
5315  for(var entry = this.firstEntry; entry; entry = entry.next)
5316   entry.removed = true;
5317 }
5318});
5319var CollectionBase = ASPx.CreateClass(null, {
5320 constructor: function(){
5321  this.elementsMap = new OrderedMap();
5322  this.isASPxClientCollection = true;
5323 },
5324 Add: function(key, element) {
5325  this.elementsMap.add(key, element);
5326 },
5327 Remove: function(key) {
5328  this.elementsMap.remove(key);
5329 },
5330 Clear: function(){
5331  this.elementsMap.clear();
5332 },
5333 Get: function(key){
5334  return this.elementsMap.get(key);
5335 }
5336});
5337var GarbageCollector = ASPx.CreateClass(null, {
5338 constructor: function() {
5339  this.interval = 5000;
5340  this.intervalID = window.setInterval(function(){ this.CollectObjects(); }.aspxBind(this), this.interval);
5341 },
5342 CollectObjects: function(){
5343  if(ASPx.GetControlCollection().InCallback()) return;
5344  ASPx.GetControlCollectionCollection().RemoveDisposedControls();
5345  if(typeof(ASPx.GetStateController) != "undefined")
5346   ASPx.GetStateController().RemoveDisposedItems();
5347  if(ASPx.TableScrollHelperCollection)
5348   ASPx.TableScrollHelperCollection.RemoveDisposedObjects();
5349  if(ASPx.Ident.scripts.ASPxClientRatingControl)
5350   ASPxClientRatingControl.RemoveDisposedElementUnderCursor();
5351  var postHandler = aspxGetPostHandler();
5352  if(postHandler)
5353   postHandler.RemoveDisposedFormsFromCache();
5354 }
5355});
5356var dummyGcCollector = new GarbageCollector(); 
5357var ControlTree = ASPx.CreateClass(null, {
5358 constructor: function(controlCollection, container, controlFilter) {
5359  this.container = container;
5360  this.domMap = { };
5361  this.rootNode = this.createNode(null, null);
5362  this.createControlTree(controlCollection, container, controlFilter);
5363 },
5364 createControlTree: function(controlCollection, container, controlFilter) {
5365  controlCollection.ProcessControlsInContainer(container, function(control) {
5366   control.RegisterInControlTree(this);
5367  }.aspxBind(this), controlFilter);
5368  var fixedNodes = [];
5369  var fixedNodesChildren = [];
5370  for(var domElementID in this.domMap) {
5371   if(!this.domMap.hasOwnProperty(domElementID)) continue;
5372   var node = this.domMap[domElementID];
5373   var controlOwner = node.control ? node.control.controlOwner : null;
5374   if(controlOwner && this.domMap[controlOwner.name])
5375    continue;
5376   if(this.isFixedNode(node))
5377    fixedNodes.push(node);
5378   else {
5379    var parentNode = this.findParentNode(domElementID);
5380    parentNode = parentNode || this.rootNode;
5381    if(this.isFixedNode(parentNode))
5382     fixedNodesChildren.push(node);
5383    else {
5384     var childNode = node.mainNode || node;
5385     this.addChildNode(parentNode, childNode);
5386    }
5387   }
5388  }
5389  for(var i = fixedNodes.length - 1; i >= 0; i--)
5390   this.insertChildNode(this.rootNode, fixedNodes[i], 0);
5391  for(var i = fixedNodesChildren.length - 1; i >= 0; i--)
5392   this.insertChildNode(this.rootNode, fixedNodesChildren[i], 0);
5393 },
5394 findParentNode: function(id) {
5395  var element = document.getElementById(id).parentNode;
5396  while(element && element.tagName !== "BODY") {
5397   if(element.id) {
5398    var parentNode = this.domMap[element.id];
5399    if(parentNode)
5400     return parentNode;
5401   }
5402   element = element.parentNode;
5403  }
5404  return null;
5405 },
5406 addChildNode: function(node, childNode) {
5407  if(!childNode.parentNode) {
5408   node.children.push(childNode);
5409   childNode.parentNode = node;
5410  }
5411 },
5412 insertChildNode: function(node, childNode, index) {
5413  if(!childNode.parentNode) {
5414   ASPx.Data.ArrayInsert(node.children, childNode, index);
5415   childNode.parentNode = node;
5416  }
5417 },
5418 addRelatedNode: function(node, relatedNode) {
5419  this.addChildNode(node, relatedNode);
5420  relatedNode.mainNode = node;
5421 },
5422 isFixedNode: function(node) {
5423  var control = node.mainNode ? node.mainNode.control : node.control;
5424  return control && control.HasFixedPosition();
5425 },
5426 createNode: function(domElementID, control) {
5427  var node = {
5428   control: control,
5429   children: [],
5430   parentNode: null,
5431   mainNode: null
5432  };
5433  if(domElementID)
5434   this.domMap[domElementID] = node;
5435  return node;
5436 }
5437});
5438var ControlAdjuster = ASPx.CreateClass(null, {
5439 constructor: function() {
5440 },
5441 adjustControlsInHierarchy: function(controlCollection, adjustFunc, container, collapseControls, controlFilter) {
5442  var controlTree = new ASPx.ControlTree(controlCollection, container, controlFilter);
5443  this.adjustControlsInTree(controlTree.rootNode, adjustFunc, container, collapseControls);
5444 },
5445 adjustControlsInTree: function(treeNode, adjustFunc, container, collapseControls) {
5446  var observer = _aspxGetDomObserver();
5447  observer.pause(container, true);
5448  var documentScrollInfo;
5449  if(collapseControls) {
5450   documentScrollInfo = ASPx.GetOuterScrollPosition(document.body);
5451   this.collapseControls(treeNode);
5452  }
5453  var adjustNodes = [], 
5454   autoHeightNodes = [];
5455  var requireReAdjust = this.forEachControlCore(treeNode, collapseControls, adjustFunc, adjustNodes, autoHeightNodes);
5456  if(requireReAdjust)
5457   this.forEachControlsBackward(adjustNodes, collapseControls, adjustFunc);
5458  else {
5459   for(var i = 0, node; node = autoHeightNodes[i]; i++)
5460    node.control.AdjustAutoHeight();
5461  }
5462  if(collapseControls)
5463   ASPx.RestoreOuterScrollPosition(documentScrollInfo);
5464  observer.resume(container, true);
5465 },
5466 forEachControlCore: function(node, collapseControls, processFunc, adju
5466stNodes, autoHeightNodes) {
5467  var requireReAdjust = false,
5468   size, newSize;
5469  if(node.control) {
5470   var checkReadjustment = collapseControls && node.control.IsControlCollapsed() && node.control.CanCauseReadjustment();
5471   if(checkReadjustment)
5472    size = node.control.GetControlPercentMarkerSize(false, true);
5473   if(node.control.IsControlCollapsed() && !node.control.IsExpandableByAdjustment())
5474    node.control.ExpandControl();
5475   node.control.isInsideHierarchyAdjustment = true;
5476   processFunc(node.control);
5477   node.control.isInsideHierarchyAdjustment = false;
5478   if(checkReadjustment) {
5479    newSize = node.control.GetControlPercentMarkerSize(false, true);
5480    requireReAdjust = size.width !== newSize.width;
5481   }
5482   if(node.control.sizingConfig.supportAutoHeight)
5483    autoHeightNodes.push(node);
5484   node.control.ResetControlPercentMarkerSize();
5485  }
5486  for(var childNode, i = 0; childNode = node.children[i]; i++)
5487   requireReAdjust = this.forEachControlCore(childNode, collapseControls, processFunc, adjustNodes, autoHeightNodes) || requireReAdjust;
5488  adjustNodes.push(node);
5489  return requireReAdjust;
5490 },
5491 forEachControlsBackward: function(adjustNodes, collapseControls, processFunc) {
5492  for(var i = 0, node; node = adjustNodes[i]; i++)
5493   this.forEachControlsBackwardCore(node, collapseControls, processFunc);
5494 },
5495 forEachControlsBackwardCore: function(node, collapseControls, processFunc) {
5496  if(node.control)
5497   processFunc(node.control);
5498  if(node.children.length > 1) {
5499   for(var i = 0, childNode; childNode = node.children[i]; i++) {
5500    if(childNode.control)
5501     processFunc(childNode.control);
5502   }
5503  }
5504 },
5505 collapseControls: function(node) {
5506  for(var childNode, i = 0; childNode = node.children[i]; i++)
5507   this.collapseControls(childNode);
5508  if(node.control && node.control.NeedCollapseControl())
5509   node.control.CollapseControl();
5510 }
5511});
5512var controlAdjuster = null;
5513function GetControlAdjuster() {
5514 if(!controlAdjuster)
5515  controlAdjuster = new ControlAdjuster();
5516 return controlAdjuster;
5517}
5518function _aspxFunctionIsInCallstack(currentCallee, targetFunction, depthLimit) {
5519 var candidate = currentCallee;
5520 var depth = 0;
5521 while(candidate && depth <= depthLimit) {
5522  candidate = candidate.caller;
5523  if(candidate == targetFunction)
5524   return true;
5525  depth++;
5526 }
5527 return false;
5528}
5529ASPx.Evt.AttachEventToElement(window, "load", aspxClassesWindowOnLoad);
5530function aspxClassesWindowOnLoad(evt){
5531 ASPx.documentLoaded = true;
5532 _aspxSweepDuplicatedLinks();
5533 ResourceManager.SynchronizeResources();
5534 var externalScriptProcessor = GetExternalScriptProcessor();
5535 if(externalScriptProcessor)
5536  externalScriptProcessor.ShowErrorMessages();
5537 ASPx.AccessibilityUtils.initialize();
5538 ASPx.GetControlCollection().Initialize();
5539 _aspxInitializeScripts();
5540 _aspxInitializeLinks();
5541 _aspxInitializeFocus();
5542 ASPx.GetControlCollection().FinalizeInitialization();
5543}
5544Ident = { };
5545Ident.IsDate = function(obj) {
5546 return obj && obj.constructor == Date;
5547};
5548Ident.IsRegExp = function(obj) {
5549 return obj && obj.constructor === RegExp;
5550};
5551Ident.IsArray = function(obj) {
5552 return obj && obj.constructor == Array;
5553};
5554Ident.IsASPxClientCollection = function(obj) {
5555 return obj && obj.isASPxClientCollection;
5556};
5557Ident.IsASPxClientControl = function(obj) {
5558 return obj && obj instanceof ASPxClientControlBase;
5559};
5560Ident.IsASPxClientEdit = function(obj) {
5561 return obj && obj.isASPxClientEdit;
5562};
5563Ident.IsFocusableElementRegardlessTabIndex = function (element) {
5564 var tagName = element.tagName;
5565 return tagName == "TEXTAREA" || tagName == "INPUT" || tagName == "A" || 
5566  tagName == "SELECT" || tagName == "IFRAME" || tagName == "OBJECT";
5567};
5568Ident.isDialogInvisibleControl = function(control) {
5569 return !!ASPx.Dialog && ASPx.Dialog.isDialogInvisibleControl(control);
5570};
5571Ident.scripts = {};
5572if(ASPx.IsFunction(window.WebForm_InitCallbackAddField)) {
5573 (function() {
5574  var original = window.WebForm_InitCallbackAddField;
5575  window.WebForm_InitCallbackAddField = function(name, value) {
5576   if(typeof(name) == "string" && name)
5577    original.apply(null, arguments);
5578  };
5579 })();
5580}
5581ASPx.FireDefaultButton = function(evt, buttonID) {
5582 if(_aspxIsDefaultButtonEvent(evt, buttonID)) {
5583  var defaultButton = ASPx.GetElementById(buttonID);
5584  if(defaultButton && defaultButton.click) {
5585   if(ASPx.IsFocusable(defaultButton))
5586    defaultButton.focus();
5587   ASPx.Evt.DoElementClick(defaultButton);
5588   ASPx.Evt.PreventEventAndBubble(evt);
5589   return false;
5590  }
5591 }
5592 return true;
5593};
5594function _aspxIsDefaultButtonEvent(evt, defaultButtonID) {
5595 if(evt.keyCode != ASPx.Key.Enter)
5596  return false;
5597 var srcElement = ASPx.Evt.GetEventSource(evt);
5598 if(!srcElement || srcElement.id === defaultButtonID)
5599  return true;
5600 var tagName = srcElement.tagName;
5601 var type = srcElement.type;
5602 return tagName != "TEXTAREA" && tagName != "BUTTON" && tagName != "A" &&
5603  (tagName != "INPUT" || type != "checkbox" && type != "radio" && type != "button" && type != "submit" && type != "reset");
5604}
5605var PostHandler = ASPx.CreateClass(null, {
5606 constructor: function() {
5607  this.Post = new ASPxClientEvent();
5608  this.PostFinalization = new ASPxClientEvent();
5609  this.observableForms = [];
5610  this.dxCallbackTriggers = {};
5611  this.lastSubmitElementName = null;
5612  this.beforeOnSubmit = function() { };
5613  this.ReplaceGlobalPostFunctions();
5614  this.HandleDxCallbackBeginning();
5615  this.HandleMSAjaxRequestBeginning();
5616 },
5617 Update: function() {
5618  this.ReplaceFormsSubmit(true);
5619 },
5620 ProcessPostRequest: function(ownerID, isCallback, isMSAjaxRequest, isDXCallback) {
5621  this.cancelPostProcessing = false;
5622  this.isMSAjaxRequest = isMSAjaxRequest;
5623  if(this.SkipRaiseOnPost(ownerID, isCallback, isDXCallback))
5624   return;
5625  var args = new PostHandlerOnPostEventArgs(ownerID, isCallback, isMSAjaxRequest, isDXCallback);
5626  this.Post.FireEvent(this, args);
5627  this.cancelPostProcessing = args.cancel;
5628  if(!args.cancel)
5629   this.PostFinalization.FireEvent(this, args);
5630 },
5631 SkipRaiseOnPost: function(ownerID, isCallback, isDXCallback) { 
5632  if(!isCallback)
5633   return false;
5634  var dxOwner = isDXCallback && ASPx.GetControlCollection().GetByName(ownerID);
5635  if(dxOwner) {
5636   this.dxCallbackTriggers[dxOwner.uniqueID] = true;
5637   return false;
5638  }
5639  if(this.dxCallbackTriggers[ownerID]) {
5640   this.dxCallbackTriggers[ownerID] = false;
5641   return true;
5642  }
5643  return false;
5644 },
5645 ReplaceGlobalPostFunctions: function() {
5646  if(ASPx.IsFunction(window.__doPostBack))
5647   this.ReplaceDoPostBack();
5648  if(ASPx.IsFunction(window.WebForm_DoCallback))
5649   this.ReplaceDoCallback();
5650  this.ReplaceFormsSubmit();
5651 },
5652 HandleDxCallbackBeginning: function() {
5653  ASPx.GetControlCollection().BeforeInitCallback.AddHandler(function(s, e) {
5654   aspxRaisePostHandlerOnPost(e.callbackOwnerID, true, false, true); 
5655  });
5656 },
5657 HandleMSAjaxRequestBeginning: function() {
5658  var pageRequestManager = ASPx.GetMSAjaxRequestManager();
5659  if(pageRequestManager != null && Ident.IsArray(pageRequestManager._onSubmitStatements)) {
5660   pageRequestManager._onSubmitStatements.unshift(function() {
5661    var postbackSettings = Sys.WebForms.PageRequestManager.getInstance()._postBackSettings;
5662    var postHandler = aspxGetPostHandler();
5663    aspxRaisePostHandlerOnPost(postbackSettings.asyncTarget, true, true);
5664    return !postHandler.cancelPostProcessing;
5665   });
5666  }
5667 },
5668 ReplaceDoPostBack: function() {
5669  var original = __doPostBack;
5670  __doPostBack = function(eventTarget, eventArgument) {
5671   var postHandler = aspxGetPostHandler();
5672   aspxRaisePostHandlerOnPost(eventTarget);
5673   if(postHandler.cancelPostProcessing)
5674    return;
5675   ASPxClientControl.postHandlingLocked = true;
5676   original(eventTarget, eventArgument);
5677   delete ASPxClientControl.postHandlingLocked;
5678  };
5679 },
5680 ReplaceDoCallback: function() {
5681  var original = WebForm_DoCallback;
5682  WebForm_DoCallback = function(eventTarget, eventArgument, eventCallback, context, errorCallback, useAsync) {
5683   var postHandler = aspxGetPostHandler();
5684   aspxRaisePostHandlerOnPost(eventTarget, true);
5685   if(postHandler.cancelPostProcessing)
5686    return;
5687   return original(eventTarget, eventArgument, eventCallback, context, errorCallback, useAsync);
5688  };
5689 },
5690 ReplaceFormsSubmit: function(checkObservableCollection) {
5691  for(var i = 0; i < document.forms.length; i++) { 
5692   var form = document.forms[i];
5693   if(checkObservableCollection && ASPx.Data.ArrayIndexOf(this.observableForms, form) >= 0)
5694    continue;
5695   if(form.submit)
5696    this.ReplaceFormSubmit(form);
5697   this.ReplaceFormOnSumbit(form);
5698   this.observableForms.push(form);
5699  }
5700 },
5701 ReplaceFormSubmit: function(form) {
5702  var originalSubmit = form.submit;
5703  form.submit = function() {
5704   var postHandler = aspxGetPostHandler();
5705   aspxRaisePostHandlerOnPost();
5706   if(postHandler.cancelPostProcessing)
5707    return false;
5708   var callee = arguments.callee;
5709   this.submit = originalSubmit;
5710   var submitResult = this.submit();
5711   this.submit = callee;
5712   return submitResult;
5713  };
5714  form = null;
5715 },
5716 ReplaceFormOnSumbit: function(form) {
5717  var originalSubmit = form.onsubmit;
5718  form.onsubmit = function() {
5719   var postHandler = aspxGetPostHandler();
5720   postHandler.beforeOnSubmit();
5721   if(postHandler.isMSAjaxRequest)
5722    postHandler.isMsAjaxRequest = false;
5723   else
5724    aspxRaisePostHandlerOnPost(postHandler.GetLastSubmitElementName());
5725   if(postHandler.cancelPostProcessing)
5726    return false;
5727   return ASPx.IsFunction(originalSubmit)
5728    ? originalSubmit.apply(this, arguments)
5729    : true;
5730  };
5731  form = null;
5732 },
5733 SetBeforeOnSubmit: function(action) {
5734  this.beforeOnSubmit = action;
5735 },
5736 SetLastSubmitElementName: function(elementName) {
5737  this.lastSubmitElementName = elementName;
5738 },
5739 GetLastSubmitElementName: function() {
5740  return this.lastSubmitElementName;
5741 },
5742 RemoveDisposedFormsFromCache: function(){
5743  for(var i = 0; this.observableForms && i < this.observableForms.length; i++){
5744   var form = this.observableForms[i];
5745   if(!ASPx.IsExistsElement(form)){
5746    ASPx.Data.ArrayRemove(this.observableForms, form);
5747    i--;
5748   }
5749  }
5750 }
5751});
5752function aspxRaisePostHandlerOnPost(ownerID, isCallback, isMSAjaxRequest, isDXCallback) {
5753 if(ASPxClientControl.postHandlingLocked) return;
5754 var postHandler = aspxGetPostHandler();
5755 if(postHandler)
5756  postHandler.ProcessPostRequest(ownerID, isCallback, isMSAjaxRequest, isDXCallback);
5757}
5758var aspxPostHandler;
5759function aspxGetPostHandler() {
5760 if(!aspxPostHandler)
5761  aspxPostHandler = new PostHandler();
5762 return aspxPostHandler;
5763}
5764var PostHandlerOnPostEventArgs = ASPx.CreateClass(ASPxClientCancelEventArgs, {
5765 constructor: function(ownerID, isCallback, isMSAjaxCallback, isDXCallback){
5766  this.constructor.prototype.constructor.call(this);
5767  this.ownerID = ownerID;
5768  this.isCallback = !!isCallback;
5769  this.isDXCallback = !!isDXCallback;
5770  this.isMSAjaxCallback = !!isMSAjaxCallback;
5771 }
5772});
5773var ResourceManager = {
5774 HandlerStr: "DXR.axd?r=",
5775 ResourceHashes: {},
5776 SynchronizeResources: function(method){
5777  if(!method){
5778   method = function(name, resource) { 
5779    this.UpdateInputElements(name, resource); 
5780   }.aspxBind(this);
5781  }
5782  var resources = this.GetResourcesData();
5783  for(var name in resources)
5784   if(resources.hasOwnProperty(name))
5785    method(name, resources[name]);
5786 },
5787 GetResourcesData: function(){
5788  return {
5789   DXScript: this.GetResourcesElementsString(_aspxGetIncludeScripts(), "src", "DXScript"),
5790   DXCss: this.GetResourcesElementsString(_aspxGetLinks(), "href", "DXCss")
5791  };
5792 },
5793 ParseBundleSrc: function(elements, urlAttr){
5794  var timeStamp = "";
5795  var resourceUrlArray = [];
5796  for(var i = 0; i < elements.length; i++) {
5797   var resourceUrl = ASPx.Attr.GetAttribute(elements[i], urlAttr);
5798   if(resourceUrl) {
5799    var pos = resourceUrl.indexOf(this.HandlerStr);
5800    if(pos > -1){
5801     var list = resourceUrl.substr(pos + this.HandlerStr.length);
5802     var ampPos = list.lastIndexOf("-");
5803     if(ampPos > -1) {
5804      timeStamp = list.substr(ampPos);
5805      list = list.substr(0, ampPos);
5806     }
5807     var indexes = list.split(",");
5808     for(var j = 0; j < indexes.length; j++) {
5809      resourceUrlArray.push(indexes[j]);
5810     }
5811    }
5812    else
5813     resourceUrlArray.push(resourceUrl);
5814   }
5815  }
5816  return {
5817   'resourceUrlArray': resourceUrlArray,
5818   'timeStamp': timeStamp
5819  };
5820 },
5821 GetResourceHashes: function (id) {
5822  if (!this.ResourceHashes[id])
5823   this.ResourceHashes[id] = {};
5824  return this.ResourceHashes[id];
5825 },
5826 GetResourcesElementsString: function (elements, urlAttr, id) {
5827  var hash = this.GetResourceHashes(id);
5828  var resourceUrlArray = this.ParseBundleSrc(elements, urlAttr).resourceUrlArray;
5829  for(var i = 0; i < resourceUrlArray.length; i++) {
5830   hash[resourceUrlArray[i]] = resourceUrlArray[i];
5831  }
5832  var array = [];
5833  for(var key in hash)
5834   if(hash.hasOwnProperty(key))
5835    array.push(key);
5836  return array.join(",");
5837 },
5838 GetNewResourcesElementString: function (element, urlAttr, id) {
5839  var dxResources = element[urlAttr].indexOf(this.HandlerStr) > -1;
5840  if(!dxResources) return element[urlAttr];
5841  var hash = this.GetResourceHashes(id);
5842  var srcInfo = this.ParseBundleSrc([element], urlAttr);
5843  var resourceUrlArray = srcInfo.resourceUrlArray;
5844  var timeStamp = srcInfo.timeStamp;
5845  var newResourceArray = [];
5846  for(var i = 0; i < resourceUrlArray.length; i++) {
5847    if(!hash[resourceUrlArray[i]])
5848    newResourceArray.push(resourceUrlArray[i]);
5849  }
5850  var newResources = "";
5851  if (newResourceArray.length > 0) {
5852   newResources = this.HandlerStr + newResourceArray.join(",") + timeStamp;
5853  }
5854  return newResources;
5855 },
5856 UpdateInputElements: function(typeName, list){
5857  for(var i = 0; i < document.forms.length; i++){
5858   var inputElement = document.forms[i][typeName];
5859   if(!inputElement)
5860    inputElement = this.CreateInputElement(document.forms[i], typeName);
5861   inputElement.value = list;
5862  }
5863 },
5864 CreateInputElement: function(form, typeName){
5865  var inputElement = ASPx.CreateHiddenField(typeName);
5866  form.appendChild(inputElement);
5867  return inputElement;
5868 }
5869};
5870ASPx.includeScriptPrefix = "dxis_";
5871ASPx.startupScriptPrefix = "dxss_";
5872var includeScriptsCache = {};
5873var createdIncludeScripts = [];
5874var appendedScriptsCount = 0;
5875var callbackOwnerNames = [];
5876var scriptsRestartHandlers = { };
5877function _aspxIsKnownIncludeScript(script) {
5878 return !!includeScriptsCache[script.src];
5879}
5880function _aspxCacheIncludeScript(script) {
5881 includeScriptsCache[script.src] = 1;
5882}
5883function _aspxProcessScriptsAndLinks(ownerName, isCallback) {
5884 if(!ASPx.documentLoaded) return; 
5885 _aspxProcessScripts(ownerName, isCallback);
5886 getLinkProcessor().process();
5887 ASPx.ClearCachedCssRules();
5888}
5889function _aspxGetStartupScripts() {
5890 return _aspxGetScriptsCore(ASPx.startupScriptPrefix);
5891}
5892function _aspxGetIncludeScripts() {
5893 return _aspxGetScriptsCore(ASPx.includeScriptPrefix);
5894}
5895function _aspxGetScriptsCore(prefix) {
5896 var result = [];
5897 var scripts = document.getElementsByTagName("SCRIPT");
5898 for(var i = 0; i < scripts.length; i++) {
5899  if(scripts[i].id.indexOf(prefix) == 0)
5900   result.push(scripts[i]);
5901 }
5902 return result;
5903}
5904function _aspxGetLinks() {
5905 var result = [];
5906 var links = document.getElementsByTagName("LINK");
5907 for(var i = 0; i < links.length; i++) 
5908  result[i] = links[i];
5909 return result;
5910}
5911function _aspxIsLinksLoaded() {
5912 var links = _aspxGetLinks();
5913 for(var i = 0, link; link = links[i]; i++)
5914  if(link.readyState && link.readyState.toLowerCase() == "loading")
5915    return false;
5916 return true;
5917}
5918function _aspxInitializeLinks() {
5919 var links = _aspxGetLinks();
5920 for(var i = 0; i < links.length; i++)
5921  links[i].loaded = true; 
5922}
5923var scriptExecutedAttrName = "data-executed";
5924var scriptDelayedExecutionAttrName = "data-dx-delayedeval";
5925ASPx.MarkInnerScriptBlocksAsDelayedExecution = function(scriptsContainer) {
5926 var scripts = scriptsContainer.querySelectorAll("script[id^=" + ASPx.startupScriptPrefix + "]");
5927 for(var i = 0; i < scripts.length; i++)
5928  ASPx.Attr.SetAttribute(scripts[i], scriptDelayedExecutionAttrName, true);
5929};
5930function isScriptExecuted(script) {
5931 return ASPx.Attr.GetAttribute(script, scriptExecutedAttrName);
5932}
5933function markScriptAsExecuted(script) {
5934 if(ASPx.Attr.GetAttribute(script, scriptDelayedExecutionAttrName))
5935  ASPx.Attr.RemoveAttribute(script, scriptDelayedExecutionAttrName);
5936 else
5937  ASPx.Attr.SetAttribute(script, scriptExecutedAttrName, true);
5938}
5939function _aspxInitializeScripts() {
5940 var scripts = _aspxGetIncludeScripts();
5941 for(var i = 0; i < scripts.length; i++)
5942  _aspxCacheIncludeScript(scripts[i]);   
5943 var startupScripts = _aspxGetStartupScripts();
5944 for(var i = 0; i < startupScripts.length; i++)
5945  markScriptAsExecuted(startupScripts[i]);
5946}
5947function _aspxSweepDuplicatedLinks() {
5948 var hash = { };
5949 var links = _aspxGetLinks();
5950 for(var i = 0; i < links.length; i++) {
5951  var href = links[i].href;
5952  if(!href)
5953   continue;
5954  if(hash[href]){
5955   if((ASPx.Browser.IE || !hash[href].loaded) && links[i].loaded) {
5956    ASPx.RemoveElement(hash[href]);
5957    hash[href] = links[i];
5958   }
5959   else
5960    ASPx.RemoveElement(links[i]);
5961  }
5962  else
5963   hash[href] = links[i];
5964 }
5965}
5966function _aspxSweepDuplicatedScripts() {
5967 var hash = { };
5968 var scripts = _aspxGetIncludeScripts();
5969 for(var i = 0; i < scripts.length; i++) {
5970  var src = scripts[i].src;
5971  if(!src) continue;
5972  if(hash[src])
5973   ASPx.RemoveElement(scripts[i]);
5974  else
5975   hash[src] = scripts[i];
5976 }
5977}
5978function _aspxAreScriptsEqual(script1, script2) {
5979 return script1.src == script2.src;
5980}
5981function _aspxProcessScripts(ownerName, isCallback) {
5982 var scripts = _aspxGetIncludeScripts();
5983 var previousCreatedScript = null;
5984 var firstCreatedScript = null;
5985 for(var i = 0; i < scripts.length; i++) {
5986  var script = scripts[i];
5987  if(script.src == "") continue; 
5988  if(_aspxIsKnownIncludeScript(script))
5989   continue;
5990  var getOnlyNewResources = true;
5991  var onlyNewScripts = ResourceManager.GetNewResourcesElementString(script, "src", "DXScript", getOnlyNewResources);
5992  if (onlyNewScripts == "")
5993   continue;
5994  var createdScript = document.createElement("script");
5995  createdScript.type = "text/javascript";
5996  createdScript.src = onlyNewScripts;
5997  createdScript.id = script.id;
5998  if(ASPx.Data.ArrayIndexOf(createdIncludeScripts, createdScript, _aspxAreScriptsEqual) >= 0)
5999   continue;
6000  createdIncludeScripts.push(createdScript);
6001  ASPx.RemoveElement(script);
6002  if(ASPx.Browser.IE && ASPx.Browser.Version < 9) {
6003   createdScript.onreadystatechange = new Function("ASPx.OnScriptReadyStateChangedCallback(this, " + isCallback + ");");
6004  } else if(ASPx.Browser.Edge || ASPx.Browser.WebKitFamily || (ASPx.Browser.Firefox && ASPx.Browser.Version >= 4) || ASPx.Browser.IE && ASPx.Browser.Version >= 9) {
6005   createdScript.onload = new Function("ASPx.OnScriptLoadCallback(this, " + isCallback + ");");
6006   if(firstCreatedScript == null)
6007    firstCreatedScript = createdScript;
6008   createdScript.nextCreatedScript = null;
6009   if(previousCreatedScript != null)
6010    previousCreatedScript.nextCreatedScript = createdScript;
6011   previousCreatedScript = createdScript;
6012  } else {
6013   createdScript.onload = new Function("ASPx.OnScriptLoadCallback(this);");
6014   ASPx.AppendScript(createdScript);
6015   _aspxCacheIncludeScript(createdScript);
6016  }
6017 }
6018 if(firstCreatedScript != null) {
6019  ASPx.AppendScript(firstCreatedScript);
6020  _aspxCacheIncludeScript(firstCreatedScript);
6021 }
6022 if(isCallback)
6023  callbackOwnerNames.push(ownerName);
6024 if(createdIncludeScripts.length == 0) {
6025  var newLinks = ASPx.GetNodesByTagName(document.body, "link");
6026  var needProcessLinks = isCallback && newLinks.length > 0;
6027  if(needProcessLinks)
6028   needProcessLinks = getLinkProcessor().addLinks(newLinks);
6029  if(!needProcessLinks)
6030   ASPx.FinalizeScriptProcessing(isCallback);
6031 }
6032}
6033ASPx.FinalizeScriptProcessing = function(isCallback) {
6034 createdIncludeScripts = [];
6035 appendedScriptsCount = 0;
6036 var linkProcessor = getLinkProcessor();
6037 if(linkProcessor.hasLinks())
6038  _aspxSweepDuplicatedLinks();
6039 linkProcessor.reset();
6040 _aspxSweepDuplicatedScripts();
6041 ResourceManager.SynchronizeResources();
6042 _aspxRunStartupScripts(isCallback);
6043};
6044var startupScriptsRunning = false;
6045function _aspxRunStartupScripts(isCallback) {
6046 startupScriptsRunning = true;
6047 try {
6048  _aspxRunStartupScriptsCore();
6049 }
6050 finally {
6051  startupScriptsRunning = false;
6052 }
6053 if(ASPx.documentLoaded) {
6054  ASPx.GetControlCollection().InitializeElements(isCallback);
6055  for(var key in scriptsRestartHandlers)
6056   if(scriptsRestartHandlers.hasOwnProperty(key))
6057    scriptsRestartHandlers[key]();
6058  _aspxRunEndCallbackScript();
6059 }
6060}
6061function _aspxIsStartupScriptsRunning(isCallback) {
6062 return startupScriptsRunning;
6063}
6064function _aspxRunStartupScriptsCore() {
6065 var scripts = _aspxGetStartupScripts();
6066 var code;
6067 for(var i = 0; i < scripts.length; i++){
6068  var script = scripts[i];
6069  if(!isScriptExecuted(script)) {
6070   _aspxEnsureStartupScriptIsUnique(script.id); 
6071   code = ASPx.GetScriptCode(script);
6072   eval(code);
6073   markScriptAsExecuted(script);
6074  }
6075 }
6076}
6077function _aspxEnsureStartupScriptIsUnique(scriptId) {
6078 if(!scriptId)
6079  return;
6080 var scriptExecutedSelector = "script[" + scriptExecutedAttrName + "='true']#" + scriptId;
6081 ASPx.RemoveElement(document.querySelector(scriptExecutedSelector));
6082}
6083function _aspxRunEndCallbackScript() {
6084 while(callbackOwnerNames.length > 0) {
6085  var callbackOwnerName = callbackOwnerNames.pop();
6086  var callbackOwner = ASPx.GetControlCollection().Get(callbackOwnerName);
6087  if(callbackOwner)
6088   callbackOwner.DoEndCallback();
6089 }
6090}
6091ASPx.OnScriptReadyStateChangedCallback = function(scriptElement, isCallback) {
6092 if(scriptElement.readyState == "loaded") {
6093  _aspxCacheIncludeScript(scriptElement);
6094  for(var i = 0; i < createdIncludeScripts.length; i++) {
6095   var script = createdIncludeScripts[i];
6096   if(_aspxIsKnownIncludeScript(script)) {
6097    if(!isScriptExecuted(script)) {
6098     markScriptAsExecuted(script);
6099     ASPx.AppendScript(script);
6100     appendedScriptsCount++;
6101    }
6102   } else
6103    break;
6104  }
6105  if(createdIncludeScripts.length == appendedScriptsCount)
6106   ASPx.FinalizeScriptProcessing(isCallback);
6107 }
6108};
6109ASPx.OnScriptLoadCallback = function(scriptElement, isCallback) {
6110 appendedScriptsCount++;
6111 if(scriptElement.nextCreatedScript) {
6112  ASPx.AppendScript(scriptElement.nextCreatedScript);
6113  _aspxCacheIncludeScript(scriptElement.nextCreatedScript);
6114 }
6115 if(createdIncludeScripts.length == appendedScriptsCount)
6116  ASPx.FinalizeScriptProcessing(isCallback);
6117};
6118function _aspxAddScriptsRestartHandler(objectName, handler) {
6119 scriptsRestartHandlers[objectName] = handler;
6120}
6121function _aspxMoveLinkElements() {
6122 var head = ASPx.GetNodesByTagName(document, "head")[0];
6123 var bodyLinks = ASPx.GetNodesByTagName(document.body, "link");
6124 if(head && bodyLinks.length > 0){
6125  var headLinks = ASPx.GetNodesByTagName(head, "link");
6126  var dxLinkAnchor = head.firstChild;
6127  for(var i = 0; i < headLinks.length; i++){
6128   if(headLinks[i].href.indexOf(ResourceManager.HandlerStr) > -1)
6129    dxLinkAnchor = headLinks[i].nextSibling;
6130  }
6131  while(bodyLinks.length > 0) 
6132   head.insertBefore(bodyLinks[0], dxLinkAnchor);
6133 }
6134}
6135var LinkProcessor = ASPx.CreateClass(null, {
6136 constructor: function() {
6137  this.loadedLinkCount = 0;
6138  this.linkInfos = [];
6139  this.loadingObservationTimerID = -1;
6140 },
6141 process: function() {
6142  if(this.hasLinks()) {
6143   if(this.isLinkLoadEventSupported())
6144    this.processViaLoadEvent();
6145   else
6146    this.processViaTimer();
6147  }
6148  else
6149   _aspxSweepDuplicatedLinks();
6150  _aspxMoveLinkElements();
6151 },
6152 addLinks: function(links) {
6153  var prevLinkCount = this.linkInfos.length;
6154  for(var i = 0; i < links.length; i++) {
6155   var link = links[i];
6156   if(link.loaded || link.rel != "stylesheet" || link.type != "text/css" || link.href.toLowerCase().indexOf("dxr.axd?r=") == -1)
6157    continue;
6158   var linkInfo = {
6159    link: link,
6160    href: link.href
6161   };
6162   this.linkInfos.push(linkInfo);
6163  }
6164  return prevLinkCount != this.linkInfos.length;
6165 },
6166 hasLinks: function() {
6167  return this.linkInfos.length > 0;
6168 },
6169 reset: function() {
6170  this.linkInfos = [];
6171  this.loadedLinkCount = 0;
6172 },
6173 processViaLoadEvent: function() {
6174  var that = this;
6175  for(var i = 0, linkInfo; linkInfo = this.linkInfos[i]; i++) {
6176   if(ASPx.Browser.IE && ASPx.Browser.Version < 9)
6177    linkInfo.link.onreadystatechange = function() { that.onLinkReadyStateChanged(this); };
6178   else
6179    linkInfo.link.onload = this.onLinkLoad.aspxBind(this);
6180  }
6181 },
6182 isLinkLoadEventSupported: function() {
6183  return !(ASPx.Browser.Chrome && ASPx.Browser.MajorVersion < 19 || ASPx.Browser.Firefox && ASPx.Browser.MajorVersion < 9 ||
6184   ASPx.Browser.Safari && ASPx.Browser.MajorVersion < 6 || ASPx.Browser.AndroidDefaultBrowser && ASPx.Browser.MajorVersion < 4.4);
6185 },
6186 processViaTimer: function() {
6187  if(this.loadingObservationTimerID == -1)
6188   this.onLinksLoadingObserve();
6189 },
6190 onLinksLoadingObserve: function() {
6191  if(this.getIsAllLinksLoaded()) {
6192   this.loadingObservationTimerID = -1;
6193   this.onAllLinksLoad();
6194  }
6195  else
6196   this.loadingObservationTimerID = window.setTimeout(this.onLinksLoadingObserve.aspxBind(this), 100);
6197 },
6198 getIsAllLinksLoaded: function() {
6199  var styleSheets = document.styleSheets;
6200  var loadedLinkHrefs = { };
6201  for(var i = 0; i < styleSheets.length; i++) {
6202   var styleSheet = styleSheets[i];
6203   try {
6204    if(styleSheet.cssRules)
6205     loadedLinkHrefs[styleSheet.href] = 1;
6206   }
6207   catch(ex) { }
6208  }
6209  var loadedLinksCount = 0;
6210  for(var i = 0, linkInfo; linkInfo = this.linkInfos[i]; i++) {
6211   if(loadedLinkHrefs[linkInfo.href])
6212    loadedLinksCount++;
6213  }
6214  return loadedLinksCount == this.linkInfos.length;
6215 },
6216 onAllLinksLoad: function() {
6217  this.reset();
6218  _aspxSweepDuplicatedLinks();
6219  if(createdIncludeScripts.length == 0)
6220   ASPx.FinalizeScriptProcessing(true);
6221 },
6222 onLinkReadyStateChanged: function(linkElement) {
6223  if(linkElement.readyState == "complete")
6224   this.onLinkLoadCore(linkElement);
6225 },
6226 onLinkLoad: function(evt) {
6227  var linkElement = ASPx.Evt.GetEventSource(evt);
6228  this.onLinkLoadCore(linkElement);
6229 },
6230 onLinkLoadCore: function(linkElement) {
6231  if(!this.hasLinkElement(linkElement)) return;
6232  this.loadedLinkCount++;
6233  if(!ASPx.Browser.Firefox && this.loadedLinkCount == this.linkInfos.length || 
6234   ASPx.Browser.Firefox && this.loadedLinkCount == 2 * this.linkInfos.length) {
6235   this.onAllLinksLoad();
6236  }
6237 },
6238 hasLinkElement: function(linkElement) {
6239  for(var i = 0, linkInfo; linkInfo = this.linkInfos[i]; i++) {
6240   if(linkInfo.link == linkElement)
6241    return true;
6242  }
6243  return false;
6244 }
6245});
6246var linkProcessor = null;
6247function getLinkProcessor() {
6248 if(linkProcessor == null)
6249  linkProcessor = new LinkProcessor();
6250 return linkProcessor;
6251}
6252ASPx.LinkProcessor = LinkProcessor;
6253var IFrameHelper = ASPx.CreateClass(null, {
6254 constructor: function(params) {
6255  this.params = params || {};
6256  this.params.src = this.params.src || "";
6257  this.CreateElements();
6258 },
6259 CreateElements: function() {
6260  var elements = IFrameHelper.Create(this.params);
6261  this.containerElement = elements.container;
6262  this.iframeElement = elements.iframe;
6263  this.AttachOnLoadHandler(this, this.iframeElement);
6264  this.SetLoading(true);
6265  if(this.params.onCreate)
6266   this.params.onCreate(this.containerElement, this.iframeElement);
6267 },
6268 AttachOnLoadHandler: function(instance, element) {
6269  ASPx.Evt.AttachEventToElement(element, "load", function() {
6270   instance.OnLoad(element);
6271  });
6272 },
6273 OnLoad: function(element) {
6274  this.SetLoading(false, element);
6275  if(!element.preventCustomOnLoad && this.params.onLoad)
6276   this.params.onLoad();
6277 },
6278 IsLoading: function(element) {
6279  element = element || this.iframeElement;
6280  if(element)
6281   return element.loading;
6282  return false;
6283 },
6284 SetLoading: function(value, element) {
6285  element = element || this.iframeElement;
6286  if(element)
6287   element.loading = value;
6288 },
6289 GetContentUrl: function() {
6290  return this.params.src;
6291 },
6292 SetContentUrl: function(url, preventBrowserCaching) {
6293  if(url) {
6294   this.params.src = url;
6295   if(preventBrowserCaching)
6296    url = IFrameHelper.AddRandomParamToUrl(url);
6297   this.SetLoading(true);
6298   this.iframeElement.src = url;
6299  }
6300 },
6301 RefreshContentUrl: function() {
6302  if(this.IsLoading())
6303   return;
6304  this.SetLoading(true);
6305  var oldContainerElement = this.containerElement;
6306  var oldIframeElement = this.iframeElement;
6307  var postfix = "_del" + Math.floor(Math.random()*100000).toString();
6308  if(this.params.id)
6309   oldIframeElement.id = this.params.id + postfix;
6310  if(this.params.name)
6311   oldIframeElement.name = this.params.name + postfix;
6312  ASPx.SetStyles(oldContainerElement, { height: 0 });
6313  this.CreateElements();
6314  oldIframeElement.preventCustomOnLoad = true;
6315  oldIframeElement.src = ASPx.BlankUrl;
6316  window.setTimeout(function() {
6317   oldContainerElement.parentNode.removeChild(oldContainerElement);
6318  }, 10000); 
6319 }
6320});
6321IFrameHelper.Create = function(params) {
6322 var iframeHtmlStringParts = [ "<iframe frameborder='0'" ];
6323 if(params) {
6324  if(params.id)
6325   iframeHtmlStringParts.push(" id='", params.id, "'");
6326  if(params.name)
6327   iframeHtmlStringParts.push(" name='", params.name, "'");
6328  if(params.title)
6329   iframeHtmlStringParts.push(" title='", params.title, "'");
6330  if(params.scrolling)
6331   iframeHtmlStringParts.push(" scrolling='", params.scrolling, "'");
6332  if(params.src)
6333   iframeHtmlStringParts.push(" src='", params.src, "'");
6334 }
6335 iframeHtmlStringParts.push("></iframe>");
6336 var containerElement = ASPx.CreateHtmlElementFromString("<div style='border-width: 0px; padding: 0px; margin: 0px'></div>");
6337 var iframeElement = ASPx.CreateHtmlElementFromString(iframeHtmlStringParts.join(""));
6338 containerElement.appendChild(iframeElement);
6339 return {
6340  container: containerElement,
6341  iframe: iframeElement
6342 };
6343};
6344IFrameHelper.AddRandomParamToUrl = function(url) {
6345 var prefix = url.indexOf("?") > -1
6346  ? "&"
6347  : "?";
6348 var param = prefix + Math.floor(Math.random()*100000).toString();
6349 var anchorIndex = url.indexOf("#");
6350 return anchorIndex == -1
6351  ? url + param
6352  : url.substr(0, anchorIndex) + param + url.substr(anchorIndex);
6353};
6354IFrameHelper.GetWindow = function(name) {
6355 if(ASPx.Browser.IE)
6356  return window.frames[name].window;
6357 else{
6358  var frameElement = document.getElementById(name);
6359  return (frameElement != null) ? frameElement.contentWindow : null;
6360 }
6361};
6362IFrameHelper.GetDocument = function(name) {
6363 var frameElement;
6364 if(ASPx.Browser.IE) {
6365  frameElement = window.frames[name];
6366  return (frameElement != null) ? frameElement.document : null;
6367 }
6368 else {
6369  frameElement = document.getElementById(name);
6370  return (frameElement != null) ? frameElement.contentDocument : null;
6371 }
6372};
6373IFrameHelper.GetDocumentBody = function(name) {
6374 var doc = IFrameHelper.GetDocument(name);
6375 return (doc != null) ? doc.body : null;
6376};
6377IFrameHelper.GetDocumentHead = function (name) {
6378 var doc = IFrameHelper.GetDocument(name);
6379 return (doc != null) ? doc.head || doc.getElementsByTagName('head')[0] : null;
6380};
6381IFrameHelper.GetElement = function(name) {
6382 if(ASPx.Browser.IE)
6383  return window.frames[name].window.frameElement;
6384 else
6385  return document.getElementById(name);
6386};
6387var KbdHelper = ASPx.CreateClass(null, {
6388 constructor: function(control) {
6389  this.control = control;
6390 },
6391 Init: function() {
6392  KbdHelper.GlobalInit();
6393  var elements = this.getFocusableElements();
6394  for(var i = 0; i < elements.length; i++) {
6395   var element = elements[i];
6396   element.tabIndex = Math.max(element.tabIndex, 0);
6397   ASPx.Evt.AttachEventToElement(element, "click", function(e) { this.HandleClick(e); }.aspxBind(this));
6398   ASPx.Evt.AttachEventToElement(element, "focus", function(e) {    
6399    return this.onElementFocus(e);
6400   }.aspxBind(this));
6401   ASPx.Evt.AttachEventToElement(element, "blur", function () { this.onBlur(); }.aspxBind(this)); 
6402  }   
6403 },
6404 onElementFocus: function(e) {
6405  if(!this.CanFocus(e))
6406   return true;
6407  KbdHelper.active = this;
6408 },
6409 getFocusableElements: function() {
6410  return [this.GetFocusableElement()]; 
6411 },
6412 GetFocusableElement: function() { return this.control.GetMainElement(); },
6413 canHandleNoFocusAction: function() { 
6414  var focusableElements = this.getFocusableElements();
6415  for(var i = 0; i < focusableElements.length; i++) {
6416   if(focusableElements[i] === _aspxGetFocusedElement())
6417    return false;
6418  }
6419  return true;
6420 },
6421 CanFocus: function(e) {
6422  var tag = ASPx.Evt.GetEventSource(e).tagName;
6423  if(tag == "A" || tag == "TEXTAREA" || tag == "INPUT" || tag == "SELECT" || tag == "IFRAME" || tag == "OBJECT")
6424   return false; 
6425  return true;
6426 },
6427 HandleClick: function(e) {
6428  if(!this.CanFocus(e))
6429   return;
6430  this.Focus();
6431 },
6432 Focus: function() {
6433  try {
6434   this.GetFocusableElement().focus();   
6435  } catch(e) {
6436  }
6437 },
6438 onBlur: function(){
6439  delete KbdHelper.active;
6440 },
6441 HandleKeyDown: function(e) { }, 
6442 HandleKeyPress: function(e) { }, 
6443 HandleKeyUp: function (e) { },
6444 HandleNoFocusAction: function(e) { },
6445 FocusByAccessKey: function () { }
6446});
6447KbdHelper.GlobalInit = function() {
6448 if(KbdHelper.ready)
6449  return;
6450 ASPx.Evt.AttachEventToDocument("keydown", KbdHelper.OnKeyDown);
6451 ASPx.Evt.AttachEventToDocument("keypress", KbdHelper.OnKeyPress);
6452 ASPx.Evt.AttachEventToDocument("keyup", KbdHelper.OnKeyUp);
6453 KbdHelper.ready = true; 
6454};
6455KbdHelper.swallowKey = false;
6456KbdHelper.accessKeys = { };
6457KbdHelper.ProcessKey = function(e, actionName) {
6458 if(!KbdHelper.active) 
6459  return;
6460 if (KbdHelper.active.canHandleNoFocusAction()) {
6461  KbdHelper.active["HandleNoFocusAction"](e, actionName);
6462  return;
6463 }
6464 var ctl = KbdHelper.active.control;
6465 if(ctl !== ASPx.GetControlCollection().Get(ctl.name)) {
6466  delete KbdHelper.active;
6467  return;
6468 }
6469 if(!KbdHelper.swallowKey) 
6470  KbdHelper.swallowKey = KbdHelper.active[actionName](e);
6471 if(KbdHelper.swallowKey)
6472  ASPx.Evt.PreventEvent(e);
6473};
6474KbdHelper.OnKeyDown = function(e) {
6475 KbdHelper.swallowKey = false;
6476 if(KbdHelper.TryAccessKey(KbdHelper.getKeyName(e)))
6477  ASPx.Evt.PreventEvent(e);
6478 else 
6479  KbdHelper.ProcessKey(e, "HandleKeyDown"); 
6480};
6481KbdHelper.OnKeyPress = function(e) { KbdHelper.ProcessKey(e, "HandleKeyPress"); };
6482KbdHelper.OnKeyUp = function(e) { KbdHelper.ProcessKey(e, "HandleKeyUp"); };
6483KbdHelper.RegisterAccessKey = function(obj) {
6484 var key;
6485 if(obj.accessKey)
6486  key = "CtrlShift" + obj.accessKey;
6487 else if(obj.keyTipModeShortcut)
6488  key = obj.keyTipModeShortcut;
6489 if(!key) return;
6490 KbdHelper.accessKeys[key.toLowerCase()] = obj.name;
6491};
6492KbdHelper.TryAccessKey = function(code) {
6493 var key = code.toLowerCase ? code.toLowerCase() : String.fromCharCode(code).toLowerCase();
6494 var name = KbdHelper.accessKeys[key];
6495 if(!name) return false;
6496 var obj = ASPx.GetControlCollection().Get(name);
6497 return KbdHelper.ClickAccessKey(obj);
6498};
6499KbdHelper.ClickAccessKey = function (control) {
6500 if (!control) return false;
6501 var el = control.GetMainElement();
6502 if (!el) return false;
6503 el.focus();
6504 setTimeout(function () {
6505  if (KbdHelper.active && KbdHelper.active.FocusByAccessKey)
6506   KbdHelper.active.FocusByAccessKey();
6507 }.aspxBind(this), 100);
6508 return true;
6509};
6510KbdHelper.getKeyName = function(e) {
6511 var name = "";
6512 if(e.altKey)
6513  name += "Alt";
6514 if(e.ctrlKey)
6515  name += "Ctrl";
6516 if(e.shiftKey)
6517  name += "Shift";
6518 var keyCode = e.key || e.code || String.fromCharCode(ASPx.Evt.GetKeyCode(e));
6519 if(keyCode.match(/key/i))
6520  name += keyCode.replace(/key/i, "");
6521 else if(keyCode.match(/digit/i))
6522  name += keyCode.replace(/digit/i, "");
6523 else if(keyCode.match(/arrow/i))
6524  name += keyCode.replace(/arrow/i, "");
6525 else if(keyCode.match(/ins/i))
6526  name += "Ins";
6527 else if(keyCode.match(/del/i))
6528  name += "Del";
6529 else if(keyCode.match(/back/i))
6530  name += "Back";
6531 else if(!keyCode.match(/alt/i) && !keyCode.match(/control/i) && !keyCode.match(/shift/i))
6532  name += keyCode;
6533 return name.replace(/^a-zA-Z0-9/, "");
6534};
6535AccessKeysHelper = ASPx.CreateClass(KbdHelper, {
6536 constructor: function (control) {
6537  this.constructor.prototype.constructor.call(this, control);
6538  this.accessKeysVisible = false;
6539  this.activeKey = null;
6540  this.accessKey = new AccessKey(control.accessKey);
6541  this.accessKeys = this.accessKey.accessKeys;
6542  this.charIndex = 0;
6543  this.onFocusByAccessKey = null;
6544  this.onClose = null;
6545  this.manualStopProcessing = false;
6546  this.isActive = false;
6547  this.areAccessKeysShown = false;
6548 },
6549 Init: function (control) {
6550  KbdHelper.prototype.Init.call(this);
6551  KbdHelper.RegisterAccessKey(control);   
6552 },
6553 Add: function (accessKey) {
6554  this.accessKey.Add(accessKey);
6555 },
6556 HandleKeyDown: function (e) {
6557  var keyCode = ASPx.Evt.GetKeyCode(e);
6558  var stopProcessing = this.processKeyDown(keyCode);
6559  if (stopProcessing.value) {
6560   this.stopProcessing();
6561   if(this.onClosedOnEscape && (keyCode == ASPx.Key.Esc || stopProcessing.fireEvent))
6562    this.onClosedOnEscape();
6563  }
6564  return stopProcessing;
6565 },
6566 HandleNoFocusAction: function (e, actionName) {
6567  var keyCode = ASPx.Evt.GetKeyCode(e);
6568  if (this.onClosedOnEscape && keyCode == ASPx.Key.Esc && actionName == "HandleKeyDown")
6569   this.onClosedOnEscape();
6570 },
6571 Activate: function () {
6572  KbdHelper.ClickAccessKey(this.control);
6573  this.areAccessKeysShown = true;
6574 },
6575 Stop: function() {
6576  this.stopProcessing();
6577 },
6578 stopProcessing: function () {
6579  this.HideAccessKeys();
6580  if (KbdHelper.active && this.isActive) {
6581   this.isActive = false;
6582   KbdHelper.active.control.GetMainElement().blur();
6583   delete KbdHelper.active;
6584  }
6585 },
6586 onBlur: function() {
6587  if (this.manualStopProcessing) {
6588   this.manualStopProcessing = false;
6589   return;
6590  }
6591  this.HideAccessKeys();
6592  KbdHelper.prototype.onBlur.call(this);
6593 },
6594 processKeyDown: function (keyCode) {
6595  switch (keyCode) {
6596   case ASPx.Key.Left:
6597    this.TryMoveFocusLeft();
6598    return { value: false };
6599   case ASPx.Key.Right:
6600    this.TryMoveFocusRight();
6601    return { value: false };
6602   case ASPx.Key.Esc:
6603    if(this.control.hideAllPopups)
6604     this.control.hideAllPopups(true, true);
6605    if(this.activeKey)
6606     this.activeKey = this.activeKey.Return();
6607    this.charIndex = 0;
6608    if (!this.activeKey)
6609     return { value: true };
6610    break;
6611   case ASPx.Key.Enter:
6612    return { value: true };
6613   default:
6614    if (!ASPx.IsPrintableKey(keyCode))
6615     return { value: false };
6616    var char = String.fromCharCode(keyCode).toUpperCase();
6617    var needToContinue = { value: false };
6618    var keyResult;
6619    if(this.activeKey)
6620     keyResult = this.activeKey.TryAccessKey(char, this.charIndex, needToContinue);
6621    if (needToContinue.value) {
6622     this.charIndex++;
6623     return { value: false };
6624    }
6625    this.charIndex = 0;
6626    if(keyResult !== undefined)
6627     this.activeKey = keyResult;
6628    else
6629     return { value: true, fireEvent: true };
6630    if (!this.activeKey || !this.activeKey.accessKeys || this.activeKey.accessKeys.length == 0) {
6631     if (this.activeKey && this.activeKey.manualStopProcessing) {
6632      this.manualStopProcessing = true;
6633      break;
6634     }
6635     return { value: true, fireEvent: true };
6636    }
6637  }
6638  return { value: false };
6639 },
6640 TryMoveFocusLeft: function (modifier) {},
6641 TryMoveFocusRight: function (modifier) {},
6642 TryMoveFocusUp: function (modifier) {},
6643 TryMoveFocusDown: function (modifier) {},
6644 FocusByAccessKey: function() {
6645  if (this.onFocusByAccessKey)
6646   this.onFocusByAccessKey();
6647  this.HideAccessKeys();
6648  KbdHelper.prototype.FocusByAccessKey.call(this);
6649  this.activeKey = this.accessKey;
6650  this.activeKey.execute();
6651  this.isActive = true;
6652  this.areAccessKeysShown = true;
6653 },
6654 HideAccessKeys: function() {
6655  this.areAccessKeysShown = false;
6656  this.hideAccessKeys(this.accessKey);
6657 },
6658 Update: function() {
6659  this.throttleMethod(this.refresh, 100);
6660 },
6661 refresh: function() {
6662  if(this.activeKey && this.areAccessKeysShown) {
6663   this.activeKey.execute();
6664  }
6665 },
6666 throttleMethod: function(method, delay) {
6667  clearTimeout(method.timerId);
6668  method.timerId = setTimeout(function() {
6669   method.call(this);
6670  }.aspxBind(this), delay);
6671 },
6672 AreAccessKeysShown: function() {
6673  return this.areAccessKeysShown;
6674 },
6675 hideAccessKeys: function (accessKey) {
6676  for (var i = 0, ak; ak = accessKey.accessKeys[i]; i++) {
6677   this.hideAccessKeys(ak);
6678  }
6679  if (accessKey)
6680   accessKey.hide();
6681 },
6682 HandleClick: function(e) {
6683  KbdHelper.prototype.HandleClick.call(this, e);
6684  this.stopProcessing();
6685 }
6686});
6687AccessKey = ASPx.CreateClass(null, {
6688 constructor: function (popupItem, getPopupElement, keyTipElement, key, onlyClick, manualStopProcessing) {
6689  this.key = key ? key : keyTipElement ? ASPxClientUtils.Trim(ASPx.GetInnerText(keyTipElement)) : null;
6690  this.popupItem = popupItem;
6691  this.getPopupElement = getPopupElement;
6692  this.keyTipElement = keyTipElement;
6693  this.accessKeys = [];
6694  this.needShowChilds = true;
6695  this.parent = null;
6696  this.onlyClick = onlyClick;
6697  this.manualStopProcessing = manualStopProcessing;
6698 },
6699 Add: function (accessKey) {
6700  this.accessKeys.push(accessKey);
6701  accessKey.parent = this;
6702 },
6703 TryAccessKey: function (char, index, needToContinue) {
6704  if (!this.accessKeys || this.accessKeys.length == 0)
6705   return;
6706  for (var i = 0, accessKey; accessKey = this.accessKeys[i]; i++) {
6707   if (accessKey.key[index] == char && accessKey.isVisible()) {
6708    if (accessKey.key[index + 1]) {
6709     needToContinue.value = true;
6710    }
6711    else {
6712     accessKey.execute();
6713     return accessKey;
6714    }
6715   } else {
6716    accessKey.hide();
6717   }
6718  }
6719  for (var i = 0, accessKey; accessKey = this.accessKeys[i]; i++) {
6720   var key = accessKey.TryAccessKey(char, index, needToContinue);
6721   if (key)
6722    return key;
6723  }
6724  return;
6725 },
6726 isVisible: function(){
6727  return ASPx.GetElementVisibility(this.keyTipElement);
6728 },
6729 Return: function () {
6730  this.hideChildAccessKeys();
6731  if (this.parent) {
6732   this.parent.showAccessKeys(true);
6733  }  
6734  return this.parent;
6735 },
6736 execute: function () {
6737  this.hideAll();
6738  if (this.popupItem && this.popupItem.accessKeyClick && !this.onlyClick)
6739   this.popupItem.accessKeyClick();
6740  if (this.getPopupElement && this.onlyClick)
6741   ASPx.Evt.EmulateMouseClick(this.getPopupElement(this.popupItem));
6742  if (this.accessKeys)
6743   setTimeout(function () {
6744    this.showAccessKeys(true);
6745   }.aspxBind(this), 100);
6746 },
6747 showAccessKeys: function(directShow) {
6748  if (!directShow && !this.needShowChilds)
6749   return;
6750  for (var i = 0; i < this.accessKeys.length; i++) {
6751   var accessKey = this.accessKeys[i];
6752   if (accessKey) {
6753    var popupElement = accessKey.getPopupElement ? accessKey.getPopupElement(accessKey.popupItem) : null;
6754    if (popupElement && ASPx.IsElementVisible(popupElement, true)) {
6755     this.show(accessKey);
6756    }
6757    accessKey.showAccessKeys();
6758   }
6759  }
6760 },
6761 show: function(accessKey) {
6762  var keyTipElement = accessKey.keyTipElement;
6763  var popupElement = accessKey.getPopupElement(accessKey.popupItem);
6764  var top = ASPx.GetAbsolutePositionY(popupElement);
6765  var left = ASPx.GetAbsolutePositionX(popupElement);
6766  if (accessKey.popupItem.getAccessKeyPosition)
6767   switch (accessKey.popupItem.getAccessKeyPosition()) {
6768    case "AboveRight":
6769     left = left + popupElement.offsetWidth - keyTipElement.offsetWidth / 3;
6770     top = top - keyTipElement.offsetHeight / 2;
6771     break;
6772    case "Right":
6773     left = left + popupElement.offsetWidth - keyTipElement.offsetWidth / 3;
6774     top = top + popupElement.offsetHeight / 2 - keyTipElement.offsetHeight / 2;
6775     break;
6776    case "BelowRight":
6777     left = left + popupElement.offsetWidth - keyTipElement.offsetWidth / 3;
6778     top = top + keyTipElement.offsetHeight / 2;
6779     break;
6780    default:
6781     top = top + popupElement.offsetHeight;
6782     left = left + popupElement.offsetWidth / 2 - keyTipElement.offsetWidth / 2;
6783     break;
6784   }
6785  else {
6786   top = top + popupElement.offsetHeight;
6787   left = left + popupElement.offsetWidth / 2 - keyTipElement.offsetWidth / 2;
6788  }
6789  ASPx.SetAbsoluteY(keyTipElement, top);
6790  ASPx.SetAbsoluteX(keyTipElement, left);
6791  ASPx.SetElementVisibility(keyTipElement, true); 
6792 },
6793 hide: function() {
6794  if (this.keyTipElement)
6795   ASPx.SetElementVisibility(this.keyTipElement, false);
6796 },
6797 hideChildAccessKeys: function () {
6798  this.hideAccessKeys(this.accessKeys);
6799 },
6800 hideAccessKeys: function (accessKeys) {
6801  if (accessKeys) {
6802   for (var i = 0, accessKey; accessKey = accessKeys[i]; i++) {
6803    if (accessKey.keyTipElement)
6804     accessKey.hide();
6805    accessKey.hideChildAccessKeys();
6806   }
6807  }
6808 },
6809 hideAll: function () {
6810  this.getRoot(this).hideChildAccessKeys();
6811 },
6812 getRoot: function (accessKey) {
6813  if (!accessKey.parent)
6814   return accessKey;
6815  return this.getRoot(accessKey.parent);
6816 }
6817});
6818var focusedElement = null;
6819function aspxOnElementFocused(evt) {
6820 evt = ASPx.Evt.GetEvent(evt);
6821 if(evt && evt.target)
6822  focusedElement = evt.target;
6823}
6824function _aspxInitializeFocus() {
6825 if(!ASPx.GetActiveElement())
6826  ASPx.Evt.AttachEventToDocument("focus", aspxOnElementFocused);
6827}
6828function _aspxGetFocusedElement() {
6829 var activeElement = ASPx.GetActiveElement();
6830 return activeElement ? activeElement : focusedElement;
6831}
6832CheckBoxCheckState = {
6833 Checked : "Checked",
6834 Unchecked : "Unchecked",
6835 Indeterminate : "Indeterminate"
6836};
6837CheckBoxInputKey = { 
6838 Checked : "C",
6839 Unchecked : "U",
6840 Indeterminate : "I"
6841};
6842var CheckableElementStateController = ASPx.CreateClass(null, {
6843 constructor: function(imageProperties) {
6844  this.checkBoxStates = [];
6845  this.imageProperties = imageProperties;
6846  this.customImageMarkerClassName = "dxcbCI";
6847 },
6848 GetValueByInputKey: function(inputKey) {
6849  return this.GetFirstValueBySecondValue("Value", "StateInputKey", inputKey);
6850 },
6851 GetInputKeyByValue: function(value) {
6852  return this.GetFirstValueBySecondValue("StateInputKey", "Value", value);
6853 },
6854 GetImagePropertiesNumByInputKey: function(value) {
6855  return this.GetFirstValueBySecondValue("ImagePropertiesNumber", "StateInputKey", value);
6856 },
6857 GetNextCheckBoxValue: function(currentValue, allowGrayed) {
6858  var currentInputKey = this.GetInputKeyByValue(currentValue);
6859  var nextInputKey = '';
6860  switch(currentInputKey) {
6861   case CheckBoxInputKey.Checked:
6862    nextInputKey = CheckBoxInputKey.Unchecked; break;
6863   case CheckBoxInputKey.Unchecked:
6864    nextInputKey = allowGrayed ? CheckBoxInputKey.Indeterminate : CheckBoxInputKey.Checked; break;
6865   case CheckBoxInputKey.Indeterminate:
6866    nextInputKey = CheckBoxInputKey.Checked; break;
6867  }
6868  return this.GetValueByInputKey(nextInputKey);
6869 },
6870 GetCheckStateByInputKey: function(inputKey) {
6871  switch(inputKey) {
6872   case CheckBoxInputKey.Checked: 
6873    return CheckBoxCheckState.Checked;
6874   case CheckBoxInputKey.Unchecked: 
6875    return CheckBoxCheckState.Unchecked;
6876   case CheckBoxInputKey.Indeterminate: 
6877    return CheckBoxCheckState.Indeterminate;
6878  }
6879 },
6880 GetValueByCheckState: function(checkState) {
6881  switch(checkState) {
6882   case CheckBoxCheckState.Checked: 
6883    return this.GetValueByInputKey(CheckBoxInputKey.Checked);
6884   case CheckBoxCheckState.Unchecked: 
6885    return this.GetValueByInputKey(CheckBoxInputKey.Unchecked);
6886   case CheckBoxCheckState.Indeterminate: 
6887    return this.GetValueByInputKey(CheckBoxInputKey.Indeterminate);
6888  }
6889 },
6890 GetFirstValueBySecondValue: function(firstValueName, secondValueName, secondValue) {
6891  return this.GetValueByFunc(firstValueName, 
6892   function(checkBoxState) { return checkBoxState[secondValueName] === secondValue; });
6893 },
6894 GetValueByFunc: function(valueName, func) {
6895  for(var i = 0; i < this.checkBoxStates.length; i++) {
6896   if(func(this.checkBoxStates[i]))
6897    return this.checkBoxStates[i][valueName];
6898  }  
6899 },
6900 AssignElementClassName: function(element, cssClassPropertyKey, disabledCssClassPropertyKey, assignedClassName) {
6901  var classNames = [ ];
6902  for(var i = 0; i < this.imageProperties[cssClassPropertyKey].length; i++) {
6903   classNames.push(this.imageProperties[disabledCssClassPropertyKey][i]);
6904   classNames.push(this.imageProperties[cssClassPropertyKey][i]);
6905  }
6906  var elementClassName = element.className;
6907  for(var i = 0; i < classNames.length; i++) {
6908   var className = classNames[i];
6909   var index = elementClassName.indexOf(className);
6910   if(index > -1)
6911    elementClassName = elementClassName.replace((index == 0 ? '' : ' ') + className, "");
6912  }
6913  elementClassName += " " + assignedClassName;
6914  element.className = elementClassName;
6915 },
6916 UpdateInternalCheckBoxDecoration: function(mainElement, inputKey, enabled) {
6917  var imagePropertiesNumber = this.GetImagePropertiesNumByInputKey(inputKey);
6918  for(var imagePropertyKey in this.imageProperties) {
6919   if(this.imageProperties.hasOwnProperty(imagePropertyKey)) {
6920    var propertyValue = this.imageProperties[imagePropertyKey][imagePropertiesNumber];
6921    propertyValue = propertyValue || !isNaN(propertyValue) ? propertyValue : "";
6922    switch(imagePropertyKey) {
6923     case "0" : mainElement.title = propertyValue; break;
6924     case "1" : mainElement.style.width = propertyValue + (propertyValue != "" ? "px" : ""); break;
6925     case "2" : mainElement.style.height = propertyValue + (propertyValue != "" ? "px" : ""); break;
6926    }
6927    if(enabled) {
6928     switch(imagePropertyKey) {
6929      case "3" : this.SetImageSrc(mainElement, propertyValue); break;
6930      case "4" : 
6931       this.AssignElementClassName(mainElement, "4", "8", propertyValue);
6932       break;
6933      case "5" : this.SetBackgroundPosition(mainElement, propertyValue, true); break;
6934      case "6" : this.SetBackgroundPosition(mainElement, propertyValue, false); break;
6935     }
6936    } else {
6937     switch(imagePropertyKey) {
6938      case "7" : this.SetImageSrc(mainElement, propertyValue); break;
6939      case "8" : 
6940       this.AssignElementClassName(mainElement, "4", "8", propertyValue);
6941       break;
6942      case "9" : this.SetBackgroundPosition(mainElement, propertyValue, true); break;
6943      case "10" : this.SetBackgroundPosition(mainElement, propertyValue, false); break;
6944     }
6945    }
6946   }
6947  }
6948 },
6949 SetImageSrc: function(mainElement, src) {
6950  if(src === ""){
6951   mainElement.style.backgroundImage = "";
6952   mainElement.style.backgroundPosition = "";
6953   ASPx.RemoveClassNameFromElement(mainElement, this.customImageMarkerClassName);
6954  }
6955  else{
6956   mainElement.style.backgroundImage = "url('" + src + "')";
6957   this.SetBackgroundPosition(mainElement, 0, true);
6958   this.SetBackgroundPosition(mainElement, 0, false);
6959   ASPx.AddClassNameToElement(mainElement, this.customImageMarkerClassName);
6960  }
6961 },
6962 SetBackgroundPosition: function(element, value, isX) {
6963  if(value === "") {
6964   element.style.backgroundPosition = value;
6965   return;
6966  }
6967  if(element.style.backgroundPosition === "")
6968   element.style.backgroundPosition = isX ? "-" + value.toString() + "px 0px" : "0px -" + value.toString() + "px";
6969  else {
6970   var position = element.style.backgroundPosition.split(' ');
6971   element.style.backgroundPosition = isX ? '-' + value.toString() + "px " + position[1] :  position[0] + " -" + value.toString() + "px";
6972  }
6973 },
6974 AddState: function(value, stateInputKey, imagePropertiesNumber) {
6975  this.checkBoxStates.push({
6976   "Value" : value, 
6977   "StateInputKey" : stateInputKey, 
6978   "ImagePropertiesNumber" : imagePropertiesNumber
6979  });
6980 },
6981 GetAriaCheckedValue: function(state) {
6982  switch(state) {
6983   case ASPx.CheckBoxCheckState.Checked: return "true";
6984   case ASPx.CheckBoxCheckState.Unchecked: return "false";
6985   case ASPx.CheckBoxCheckState.Indeterminate: return "mixed";
6986   default: return "";
6987  }
6988 }
6989});
6990CheckableElementStateController.Create = function(imageProperties, valueChecked, valueUnchecked, valueGrayed, allowGrayed) {
6991 var stateController = new CheckableElementStateController(imageProperties);
6992 stateController.AddState(valueChecked, CheckBoxInputKey.Checked, 0);
6993 stateController.AddState(valueUnchecked, CheckBoxInputKey.Unchecked, 1);
6994 if(typeof(valueGrayed) != "undefined")
6995  stateController.AddState(valueGrayed, CheckBoxInputKey.Indeterminate, allowGrayed ? 2 : 1);
6996 stateController.allowGrayed = allowGrayed;
6997 return stateController;
6998};
6999var CheckableElementHelper = ASPx.CreateClass(null, {
7000 InternalCheckBoxInitialize: function(internalCheckBox) {
7001  this.AttachToMainElement(internalCheckBox);
7002  this.AttachToInputElement(internalCheckBox);
7003 },
7004 AttachToMainElement: function(internalCheckBox) {
7005  var instance = this;
7006  if(internalCheckBox.mainElement) {
7007    var toggleEvent = internalCheckBox.displaySwitch ? ASPx.TouchUIHelper.touchMouseDownEventName : "click";
7008    ASPx.Evt.AttachEventToElement(internalCheckBox.mainElement, toggleEvent,
7009    function (evt) {
7010     if(ASPx.Evt.IsRightButtonPressed(evt))
7011      return;
7012     instance.InvokeClick(internalCheckBox, evt);
7013     if(!internalCheckBox.disableCancelBubble)
7014      return ASPx.Evt.PreventEventAndBubble(evt);
7015    }
7016   );
7017   ASPx.Evt.AttachEventToElement(internalCheckBox.mainElement, "mousedown",
7018    function (evt) {
7019     internalCheckBox.Refocus();
7020    }
7021   );
7022   ASPx.Evt.PreventElementDragAndSelect(internalCheckBox.mainElement, true);
7023  }
7024 },
7025 AttachToInputElement: function(internalCheckBox) {
7026  var instance = this;
7027  if(internalCheckBox.inputElement && internalCheckBox.mainElement) {
7028   var checkableElement = internalCheckBox.accessibilityCompliant ? internalCheckBox.mainElement : internalCheckBox.inputElement;
7029   ASPx.Evt.AttachEventToElement(checkableElement, "focus",
7030    function (evt) { 
7031     if(!internalCheckBox.enabled)
7032      checkableElement.blur();
7033     else
7034      internalCheckBox.OnFocus();
7035    }
7036   );
7037   ASPx.Evt.AttachEventToElement(checkableElement, "blur", 
7038    function (evt) { 
7039     internalCheckBox.OnLostFocus();
7040    }
7041   );
7042   ASPx.Evt.AttachEventToElement(checkableElement, "keyup",
7043    function (evt) { 
7044     if(ASPx.Evt.GetKeyCode(evt) == ASPx.Key.Space)
7045      instance.InvokeClick(internalCheckBox, evt);
7046    }
7047   );
7048   ASPx.Evt.AttachEventToElement(checkableElement, "keydown",
7049    function (evt) { 
7050     if(ASPx.Evt.GetKeyCode(evt) == ASPx.Key.Space)
7051      return ASPx.Evt.PreventEvent(evt);
7052    }
7053   );
7054  }
7055 },
7056 IsKBSInputWrapperExist: function() {
7057  return ASPx.Browser.Opera || ASPx.Browser.WebKitFamily;
7058 },
7059 GetICBMainElementByInput: function(icbInputElement) {
7060  return this.IsKBSInputWrapperExist() ? icbInputElement.parentNode.parentNode : icbInputElement.parentNode;
7061 },
7062 RequirePreventFocus: function() { return false; },
7063 InvokeClick: function(internalCheckBox, evt) {
7064  if(internalCheckBox.enabled && !internalCheckBox.GetReadOnly()) {
7065   var inputElementValue = internalCheckBox.inputElement.value;
7066   var focusableElement = internalCheckBox.accessibilityCompliant ? internalCheckBox.mainElement : internalCheckBox.inputElement; 
7067   if(!this.RequirePreventFocus())
7068    focusableElement.focus();
7069   if(!ASPx.Browser.IE) 
7070    internalCheckBox.inputElement.value = inputElementValue;
7071   this.InvokeClickCore(internalCheckBox, evt);
7072   }
7073 },
7074 InvokeClickCore: function(internalCheckBox, evt) {
7075  internalCheckBox.OnClick(evt);
7076 }
7077});
7078CheckableElementHelper.Instance = new CheckableElementHelper();
7079var CheckBoxInternal = ASPx.CreateClass(null, {
7080 constructor: function(inputElement, stateController, allowGrayed, allowGrayedByClick, helper, container, storeValueInInput, key, disableCancelBubble,
7081  accessibilityCompliant, displaySwitch) {
7082  this.inputElement = inputElement;
7083  this.mainElement = helper.GetICBMainElementByInput(this.inputElement);
7084  this.name = (key ? key : this.inputElement.id) + CheckBoxInternal.GetICBMainElementPostfix();
7085  this.mainElement.id = this.name;
7086  this.stateController = stateController;
7087  this.container = container;
7088  this.allowGrayed = allowGrayed;
7089  this.allowGrayedByClick = allowGrayedByClick;
7090  this.autoSwitchEnabled = true;
7091  this.displaySwitch = displaySwitch;
7092  this.storeValueInInput = !!storeValueInInput;
7093  this.storedInputKey = !this.storeValueInInput ? this.inputElement.value : null;
7094  this.disableCancelBubble = !!disableCancelBubble;
7095  this.accessibilityCompliant = accessibilityCompliant;
7096  this.focusDecoration = null;
7097  this.focused = false;
7098  this.focusLocked = false;
7099  this.enabled = !this.mainElement.className.match(/dxWeb_\w+Disabled(\b|_)/);
7100  this.readOnly = false;
7101  this.preventFocus = helper.RequirePreventFocus();
7102  this.CheckedChanged = new ASPxClientEvent();
7103  this.Focus = new ASPxClientEvent();
7104  this.LostFocus = new ASPxClientEvent();
7105  helper.InternalCheckBoxInitialize(this);
7106 },
7107 GetReadOnly: function() {
7108  return this.readOnly;
7109 },
7110 ChangeInputElementTabIndex: function() {  
7111  var changeMethod = this.enabled ? ASPx.Attr.RestoreTabIndexAttribute : ASPx.Attr.SaveTabIndexAttributeAndReset;
7112  changeMethod(this.inputElement);
7113 },
7114 CreateFocusDecoration: function(focusedStyle) {
7115   this.focusDecoration = new FocusedStyleDecoration(this);
7116   this.focusDecoration.AddStyle('F', focusedStyle[0], focusedStyle[1]);
7117   this.focusDecoration.AddPostfix("");
7118 },
7119 UpdateFocusDecoration: function() {
7120  this.focusDecoration.Update();
7121 },  
7122 StoreInputKey: function(inputKey) {
7123  if(this.storeValueInInput)
7124   this.inputElement.value = inputKey;
7125  else
7126   this.storedInputKey = inputKey;
7127 },
7128 GetStoredInputKey: function() {
7129  if(this.storeValueInInput)
7130   return this.inputElement.value;
7131  else
7132   return this.storedInputKey;
7133 },
7134 OnClick: function(e) {
7135  if(this.autoSwitchEnabled) {
7136   var currentValue = this.GetValue();
7137   var value = this.stateController.GetNextCheckBoxValue(currentValue, this.allowGrayedByClick && this.allowGrayed);
7138   this.SetValue(value);
7139  }
7140  this.CheckedChanged.FireEvent(this, e);
7141 },
7142 OnFocus: function() {
7143  if(!this.IsFocusLocked()) {
7144   this.focused = true;
7145   this.UpdateFocusDecoration();
7146   this.Focus.FireEvent(this, null);
7147  } else
7148   this.UnlockFocus();
7149 },
7150 OnLostFocus: function() {
7151  if(!this.IsFocusLocked()) {
7152   this.focused = false;
7153   this.UpdateFocusDecoration();
7154   this.LostFocus.FireEvent(this, null);
7155  }
7156 },
7157 Refocus: function() {
7158  if(this.preventFocus) return;
7159  if(this.focused) {
7160   this.LockFocus();
7161   this.inputElement.blur();
7162   if(ASPx.Browser.MacOSMobilePlatform) {
7163    window.setTimeout(function() {
7164     ASPx.SetFocus(this.inputElement);
7165    }, 100);
7166   } else {
7167    ASPx.SetFocus(this.inputElement);
7168   }
7169  }
7170 },
7171 LockFocus: function() {
7172  this.focusLocked = true;
7173 },
7174 UnlockFocus: function() {
7175  this.focusLocked = false;
7176 },
7177 IsFocusLocked: function() {
7178  if(!!ASPx.Attr.GetAttribute(this.mainElement, ASPx.Attr.GetTabIndexAttributeName()))
7179   return false;
7180  return this.focusLocked;
7181 },
7182 SetValue: function(value, force) {
7183  var currentValue = this.GetValue();
7184  if(currentValue !== value || force) {
7185   var newInputKey = this.stateController.GetInputKeyByValue(value);
7186   if(newInputKey) {
7187    this.StoreInputKey(newInputKey);   
7188    this.stateController.UpdateInternalCheckBoxDecoration(this.mainElement, newInputKey, this.enabled);
7189   }
7190  }
7191  if(this.accessibilityCompliant) {
7192   var state = this.GetCurrentCheckState();
7193   var value = this.stateController.GetAriaCheckedValue(state);
7194   if(this.mainElement.attributes["aria-checked"] !== undefined)
7195    this.mainElement.setAttribute("aria-checked", value); 
7196   if(this.mainElement.attributes["aria-selected"] !== undefined)
7197    this.mainElement.setAttribute("aria-selected", value); 
7198  }
7199 },
7200 GetValue: function() {
7201  return this.stateController.GetValueByInputKey(this.GetCurrentInputKey());
7202 },
7203 GetCurrentCheckState: function() {
7204  return this.stateController.GetCheckStateByInputKey(this.GetCurrentInputKey());
7205 },
7206 GetCurrentInputKey: function() {
7207  return this.GetStoredInputKey();
7208 },
7209 GetChecked: function() {
7210  return this.GetCurrentInputKey() === CheckBoxInputKey.Checked;
7211 },
7212 SetChecked: function(checked) {
7213  var newValue = this.stateController.GetValueByCheckState(checked ? CheckBoxCheckState.Checked : CheckBoxCheckState.Unchecked);
7214  this.SetValue(newValue);
7215 },
7216 SetEnabled: function(enabled) {
7217  if(this.enabled != enabled) {
7218   this.enabled = enabled;
7219   this.stateController.UpdateInternalCheckBoxDecoration(this.mainElement, this.GetCurrentInputKey(), this.enabled);
7220   this.ChangeInputElementTabIndex();
7221  }
7222 },
7223 GetEnabled: function() {
7224  return this.enabled;
7225 }
7226});
7227CheckBoxInternal.GetICBMainElementPostfix = function() {
7228 return "_D";
7229};
7230var CheckBoxInternalCollection = ASPx.CreateClass(CollectionBase, {
7231 constructor: function(imageProperties, allowGrayed, storeValueInInput, helper, disableCancelBubble, accessibilityCompliant) {
7232  this.constructor.prototype.constructor.call(this);
7233  this.stateController = allowGrayed 
7234   ? CheckableElementStateController.Create(imageProperties, CheckBoxInputKey.Checked, CheckBoxInputKey.Unchecked, CheckBoxInputKey.Indeterminate, true)
7235   : CheckableElementStateController.Create(imageProperties, CheckBoxInputKey.Checked, CheckBoxInputKey.Unchecked);
7236  this.helper = helper || CheckableElementHelper.Instance;
7237  this.storeValueInInput = !!storeValueInInput;
7238  this.disableCancelBubble = !!disableCancelBubble;
7239  this.accessibilityCompliant = accessibilityCompliant;
7240 },
7241 Add: function(key, inputElement, container) {
7242  this.Remove(key);
7243  var checkBox = this.CreateInternalCheckBox(key, inputElement, container);
7244  CollectionBase.prototype.Add.call(this, key, checkBox);
7245  return checkBox;
7246 },
7247 SetImageProperties: function(imageProperties) {
7248  this.stateController.imageProperties = imageProperties;
7249 },
7250 CreateInternalCheckBox: function(key, inputElement, container) {
7251  return new CheckBoxInternal(inputElement, this.stateController, this.stateController.allowGrayed, false, this.helper, container, 
7252   this.storeValueInInput, key, this.disableCancelBubble, this.accessibilityCompliant);
7253 }
7254});
7255var FocusedStyleDecoration = ASPx.CreateClass(null, {
7256 constructor: function(editor) {
7257  this.editor = editor;
7258  this.postfixList = [];
7259  this.styles = {};
7260  this.innerStyles = {};
7261 },
7262 AddPostfix: function(value) {
7263  this.postfixList.push(value);
7264 },
7265 AddStyle: function(key, className, cssText) {
7266  this.styles[key] = this.CreateRule(className, cssText);
7267  this.innerStyles[key] = this.CreateRule("", this.FilterInnerCss(cssText));
7268 },
7269 CreateRule: function(className, cssText) {
7270  return ASPx.Str.Trim(className + " " + ASPx.CreateImportantStyleRule(this.GetStyleSheet(), cssText));
7271 },
7272 GetStyleSheet: function() {
7273  return ASPx.GetCurrentStyleSheet();
7274 },
7275 FilterInnerCss: function(css) {
7276  return css.replace(/(border|background-image)[^:]*:[^;]+/gi, "");
7277 },
7278 Update: function() {
7279  for(var i = 0; i < this.postfixList.length; i++) {
7280   var postfix = this.postfixList[i];
7281   var inner = postfix.length > 0;
7282   var element = this.GetElementByPostfix(postfix);
7283   if(element)
7284    this.ApplyStyles(element, inner);
7285  }
7286 },
7287 GetElementByPostfix: function(postfix) {
7288  return ASPx.GetElementById(this.editor.name + postfix);
7289 },
7290 ApplyStyles: function(element, inner) {
7291  this.ApplyFocusedStyle(element, inner);
7292 },
7293 ApplyFocusedStyle: function(element, inner) {
7294  if(this.HasDecoration("F"))
7295   this.ApplyDecoration("F", element, inner, this.editor.focused);
7296 },
7297 HasDecoration: function(key) {
7298  return !!this.styles[key];
7299 },
7300 ApplyDecoration: function(key, element, inner, active) {
7301  var value = inner ? this.innerStyles[key] : this.styles[key];
7302  this.RemoveDecoration(element, value);
7303  if(active) {
7304   ASPx.AddClassNameToElement(element, value);
7305   if(ASPx.Browser.IE && ASPx.Browser.Version > 10 && element.border != null) 
7306    this.EnsureElementBorder(element);
7307  }
7308 },
7309 RemoveDecoration: function(element, value) {
7310  ASPx.RemoveClassNameFromElement(element, value);
7311  if(ASPx.Browser.IE && ASPx.Browser.MajorVersion >= 11)
7312   var dummy = element.offsetWidth; 
7313 },
7314 ApplyDecorationCore: function() {
7315 },
7316 EnsureElementBorder: function(element) {
7317  var border = parseInt(element.border) || 0;
7318  element.border = 1;
7319  element.border = border;
7320 }
7321});
7322var EditorStyleDecoration = ASPx.CreateClass(FocusedStyleDecoration, {
7323 constructor: function(editor) {
7324  this.constructor.prototype.constructor.call(this, editor);
7325  this.lockUpdate = false;
7326 },
7327 LockUpdate: function() {
7328  this.lockUpdate = true;
7329 },
7330 UnlockUpdate: function() {
7331  this.lockUpdate = false;
7332 },
7333 IsUpdateLocked: function() {
7334  return this.lockUpdate;
7335 },
7336 Update: function () {
7337  if(this.IsUpdateLocked())
7338   return;
7339  ASPx.FocusedStyleDecoration.prototype.Update.call(this);
7340 },
7341 ApplyStyles: function (element, inner) {
7342  this.ApplyInvalidStyle(element, inner);
7343  ASPx.FocusedStyleDecoration.prototype.ApplyStyles.call(this, element, inner);
7344 },
7345 ApplyInvalidStyle: function (element, inner) {
7346  if(this.HasDecoration("I")) {
7347   var isValid = this.editor.GetIsValid();
7348   this.ApplyDecoration("I", element, inner, !isValid);
7349  }
7350 }
7351});
7352var TextEditorStyleDecoration = ASPx.CreateClass(EditorStyleDecoration, {
7353 constructor: function(editor) {
7354  this.constructor.prototype.constructor.call(this, editor);
7355  this.nullTextClassName = "";
7356 },
7357 ApplyStyles: function(element, inner) {
7358  ASPx.EditorStyleDecoration.prototype.ApplyStyles.call(this, element, inner);
7359  this.ApplyNullTextStyle(element, inner);
7360 },
7361 ApplyNullTextStyle: function(element, inner) {
7362  if(!this.HasDecoration("N"))
7363   return;
7364  var apply = !this.editor.focused && this.editor.CanApplyNullTextDecoration();
7365  this.EnsureSpellcheckAttribute(element, apply);
7366  this.ApplyDecoration("N", element, inner, apply);
7367 },
7368 EnsureSpellcheckAttribute: function(element, apply) {
7369  if(apply)
7370   ASPx.Attr.ChangeAttribute(element, "spellcheck", "false");
7371  else
7372   ASPx.Attr.RestoreAttribute(element, "spellcheck");
7373 },
7374 ApplyNullTextClassName: function(active) {
7375  var nullTextClassName = this.GetNullTextClassName();
7376  var editorMainElement = this.editor.GetMainElement();
7377  if(active)
7378   ASPx.AddClassNameToElement(editorMainElement, nullTextClassName);
7379  else
7380   ASPx.RemoveClassNameFromElement(editorMainElement, nullTextClassName);
7381 },
7382 GetNullTextClassName: function() {
7383  if (!this.nullTextClassName)
7384   this.InitializeNullTextClassName();
7385  return this.nullTextClassName;
7386 },
7387 InitializeNullTextClassName: function() {
7388  var nullTextStyle = this.styles["N"];
7389  if (nullTextStyle) {
7390   var nullTextStyleClassNames = nullTextStyle.split(" ");
7391   for (var i = 0; i < nullTextStyleClassNames.length; i++)
7392    if (nullTextStyleClassNames[i].match("dxeNullText"))
7393     this.nullTextClassName = nullTextStyleClassNames[i];
7394  }
7395 }
7396});
7397var TouchUIHelper = {
7398 isGesture: false,
7399 isMouseEventFromScrolling: false,
7400 isNativeScrollingAllowed: true,
7401 clickSensetivity: 10,
7402 documentTouchHandlers: {},
7403 documentEventAttachingAllowed: true,
7404 msTouchDraggableClassName: "dxMSTouchDraggable",
7405 touchMouseDownEventName: ASPx.Browser.WebKitTouchUI ? "touchstart" : (ASPx.Browser.Edge && ASPx.Browser.MSTouchUI && window.PointerEvent ? "pointerdown" : "mousedown"),
7406 touchMouseUpEventName:   ASPx.Browser.WebKitTouchUI ? "touchend"   : (ASPx.Browser.Edge && ASPx.Browser.MSTouchUI && window.PointerEvent ? "pointerup" : "mouseup"),
7407 touchMouseMoveEventName: ASPx.Browser.WebKitTouchUI ? "touchmove"  : (ASPx.Browser.Edge && ASPx.Browser.MSTouchUI && window.PointerEvent ? "pointermove" : "mousemove"),
7408 isTouchEvent: function(evt) {
7409  if(!evt) return false;
7410  return ASPx.Browser.WebKitTouchUI && ASPx.IsExists(evt.changedTouches); 
7411 },
7412 isTouchEventName: function(eventName) {
7413  return ASPx.Browser.WebKitTouchUI && (eventName.indexOf("touch") > -1 || eventName.indexOf("gesture") > -1);
7414 },
7415 getEventX: function(evt) { 
7416  return ASPx.Browser.IE ? evt.pageX : evt.changedTouches[0].pageX; 
7417 },
7418 getEventY: function (evt) { 
7419  return ASPx.Browser.IE ? evt.pageY :evt.changedTouches[0].pageY; 
7420 },
7421 getWebkitMajorVersion: function(){
7422  if(!this.webkitMajorVersion){
7423   var regExp = new RegExp("applewebkit/(\\d+)", "i");
7424   var matches = regExp.exec(ASPx.Browser.UserAgent);
7425   if(matches && matches.index >= 1)
7426    this.webkitMajorVersion = matches[1];
7427  }
7428  return this.webkitMajorVersion;
7429 },
7430 getIsLandscapeOrientation: function(){
7431  if(ASPx.Browser.MacOSMobilePlatform || ASPx.Browser.AndroidMobilePlatform)
7432   return Math.abs(window.orientation) == 90;
7433  return ASPx.GetDocumentClientWidth() > ASPx.GetDocumentClientHeight();
7434 },
7435 nativeScrollingSupported: function() {
7436  var allowedSafariVersion = ASPx.Browser.Version >= 5.1 && ASPx.Browser.Version < 8; 
7437  var allowedWebKitVersion = this.getWebkitMajorVersion() >
7437 533 && (ASPx.Browser.Chrome || this.getWebkitMajorVersion() < 600);
7438  return (ASPx.Browser.MacOSMobilePlatform && (allowedSafariVersion || allowedWebKitVersion))
7439   || (ASPx.Browser.AndroidMobilePlatform && ASPx.Browser.PlaformMajorVersion >= 3) || (ASPx.Browser.MSTouchUI && (!ASPx.Browser.WindowsPhonePlatform || !ASPx.Browser.IE));
7440 },
7441 makeScrollableIfRequired: function(element, options) {
7442  if(ASPx.Browser.WebKitTouchUI && element) {
7443   var overflow = ASPx.GetCurrentStyle(element).overflow;
7444   if(element.tagName == "DIV" &&  overflow != "hidden" && overflow != "visible" ){
7445    return this.MakeScrollable(element);
7446   }
7447  }
7448 },
7449 preventScrollOnEvent: function(evt){
7450 },
7451 handleFastTapIfRequired: function(evt, action, preventCommonClickEvents) {
7452  if(ASPx.Browser.WebKitTouchUI && evt.type == 'touchstart' && action) {
7453   this.FastTapHelper.HandleFastTap(evt, action, preventCommonClickEvents);
7454   return true;
7455  }
7456  return false;
7457 },
7458 ensureDocumentSizesCorrect: function (){
7459  return (document.documentElement.clientWidth - document.documentElement.clientHeight) / (screen.width - screen.height) > 0;
7460 },
7461 ensureOrientationChanged: function(onOrientationChangedFunction){
7462  if(ASPxClientUtils.iOSPlatform || this.ensureDocumentSizesCorrect())
7463   onOrientationChangedFunction();
7464  else {
7465   window.setTimeout(function(){
7466    this.ensureOrientationChanged(onOrientationChangedFunction);
7467   }.aspxBind(this), 100);
7468  }
7469 },
7470 onEventAttachingToDocument: function(eventName, func){
7471  if(ASPx.Browser.MacOSMobilePlatform && this.isTouchEventName(eventName)) {
7472   if(!this.documentTouchHandlers[eventName])
7473    this.documentTouchHandlers[eventName] = [];
7474   this.documentTouchHandlers[eventName].push(func);
7475   return this.documentEventAttachingAllowed;
7476  }
7477  return true;
7478 },
7479 onEventDettachedFromDocument: function(eventName, func){
7480  if(ASPx.Browser.MacOSMobilePlatform && this.isTouchEventName(eventName)) {
7481   var handlers = this.documentTouchHandlers[eventName];
7482   if(handlers)
7483    ASPx.Data.ArrayRemove(handlers, func);
7484  }
7485 },
7486 processDocumentTouchEventHandlers: function(proc) {
7487  var touchEventNames = ["touchstart", "touchend", "touchmove", "gesturestart", "gestureend"];
7488  for(var i = 0; i < touchEventNames.length; i++) {
7489   var eventName = touchEventNames[i];
7490   var handlers = this.documentTouchHandlers[eventName];
7491   if(handlers) {
7492    for(var j = 0; j < handlers.length; j++) {
7493     proc(eventName,handlers[j]);
7494    }
7495   }
7496  }
7497 },
7498 removeDocumentTouchEventHandlers: function() {
7499  if(ASPx.Browser.MacOSMobilePlatform) {
7500   this.documentEventAttachingAllowed = false;
7501   this.processDocumentTouchEventHandlers(ASPx.Evt.DetachEventFromDocumentCore);
7502  }
7503 },
7504 restoreDocumentTouchEventHandlers: function () {
7505  if(ASPx.Browser.MacOSMobilePlatform) {
7506   this.documentEventAttachingAllowed = true;
7507   this.processDocumentTouchEventHandlers(ASPx.Evt.AttachEventToDocumentCore);
7508  }
7509 },
7510 IsNativeScrolling: function() {
7511  return TouchUIHelper.nativeScrollingSupported() && TouchUIHelper.isNativeScrollingAllowed;
7512 },
7513 pointerEnabled: !!(window.PointerEvent || window.MSPointerEvent),
7514 pointerDownEventName: window.PointerEvent ? "pointerdown" : "MSPointerDown",
7515 pointerUpEventName: window.PointerEvent ? "pointerup" : "MSPointerUp",
7516 pointerCancelEventName: window.PointerEvent ? "pointercancel" : "MSPointerCancel",
7517 pointerMoveEventName: window.PointerEvent ? "pointermove" : "MSPointerMove",
7518 pointerOverEventName: window.PointerEvent ? "pointerover" : "MSPointerOver",
7519 pointerOutEventName: window.PointerEvent ? "pointerout" : "MSPointerOut",
7520 pointerType: {
7521  Touch: (ASPx.Browser.IE && ASPx.Browser.Version == 10) ? 2 : "touch",
7522  Pen: (ASPx.Browser.IE && ASPx.Browser.Version == 10) ? 3 : "pen",
7523  Mouse: (ASPx.Browser.IE && ASPx.Browser.Version == 10) ? 4 : "mouse"
7524 },
7525 msGestureEnabled: !!(window.PointerEvent || window.MSPointerEvent) && typeof(MSGesture) != "undefined",
7526 msTouchCreateGesturesWrapper: function(element, onTap){
7527  if(!TouchUIHelper.msGestureEnabled) 
7528   return;
7529  var gesture = new MSGesture();
7530  gesture.target = element;
7531  ASPx.Evt.AttachEventToElement(element, TouchUIHelper.pointerDownEventName, function(evt){
7532   gesture.addPointer(evt.pointerId);
7533  });
7534  ASPx.Evt.AttachEventToElement(element, TouchUIHelper.pointerUpEventName, function(evt){
7535   gesture.stop();
7536  });
7537  if(onTap)
7538   ASPx.Evt.AttachEventToElement(element, "MSGestureTap", onTap);
7539  return gesture;
7540 },
7541 useLongTapHelper: function () {
7542  return ASPx.Browser.Safari && ASPx.Browser.TouchUI;
7543 },
7544 attachLongTapHandler: function(element, handler, onlyBubbling) {
7545  var timerID = -1;
7546  var timeout = 1000;
7547  var event = null;
7548  var preventClickEvent = false;
7549  var startX = -1;
7550  var startY = -1;
7551  var pixelLimit = 5;
7552  function onTouchMouseDown(evt) {
7553   abortWating();
7554   event = evt;
7555   startX = evt.pageX;
7556   startY = evt.pageY;
7557   preventClickEvent = false;
7558   timerID = window.setTimeout(onTimeout, timeout);
7559  }
7560  function onTouchMouseMove(evt) {
7561   if (!isUnderTouch())
7562    return;
7563   var shiftX = Math.abs(startX - evt.pageX),
7564    shiftY = Math.abs(startY - evt.pageY),
7565    maxShift = Math.max(shiftX, shiftY);
7566   if (maxShift > pixelLimit)
7567    abortWating();
7568  }
7569  function onTouchMouseUp(evt) {
7570   abortWating();
7571   if (preventClickEvent) {
7572    ASPx.Evt.PreventEventAndBubble(evt);
7573    preventClickEvent = false;
7574   }
7575  }
7576  function onTimeout() {
7577   handler(event);
7578   preventClickEvent = true;
7579   abortWatingInternal();
7580  }
7581  function isUnderTouch() {
7582   return timerID !== -1;
7583  }
7584  function abortWating() {
7585   if (isUnderTouch()) {
7586    window.clearTimeout(timerID);
7587    abortWatingInternal();
7588   }
7589  }
7590  function abortWatingInternal() {
7591   timerID = -1;
7592   event = null;
7593  }
7594  ASPx.Evt.AttachEventToElement(element, TouchUIHelper.touchMouseDownEventName, onTouchMouseDown, onlyBubbling);
7595  ASPx.Evt.AttachEventToElement(element, TouchUIHelper.touchMouseMoveEventName, onTouchMouseMove, onlyBubbling);
7596  ASPx.Evt.AttachEventToElement(element, TouchUIHelper.touchMouseUpEventName, onTouchMouseUp, onlyBubbling);
7597  element.style["-webkit-user-select"] = "none";
7598  return function () {
7599   ASPx.Evt.DetachEventFromElement(element, TouchUIHelper.touchMouseDownEventName, onTouchMouseDown);
7600   ASPx.Evt.DetachEventFromElement(element, TouchUIHelper.touchMouseMoveEventName, onTouchMouseMove);
7601   ASPx.Evt.DetachEventFromElement(element, TouchUIHelper.touchMouseUpEventName, onTouchMouseUp);
7602   element.style["-webkit-user-select"] = "";
7603  };
7604 }
7605};
7606var CacheHelper = {};
7607CacheHelper.GetCachedValueCore = function(obj, key, func, cacheObj, fillValueMethod) {
7608 if(!cacheObj)
7609  cacheObj = obj;
7610 if(!cacheObj.cache)
7611  cacheObj.cache = {};
7612 if(!key) 
7613  key = "default";
7614 fillValueMethod(obj, key, func, cacheObj);
7615 return cacheObj.cache[key];
7616};
7617CacheHelper.GetCachedValue = function(obj, key, func, cacheObj) {
7618 return CacheHelper.GetCachedValueCore(obj, key, func, cacheObj, 
7619  function(obj, key, func, cacheObj) {
7620   if(!ASPx.IsExists(cacheObj.cache[key]))
7621    cacheObj.cache[key] = func.apply(obj, []);
7622  });
7623};
7624CacheHelper.GetCachedElement = function(obj, key, func, cacheObj) {
7625 return CacheHelper.GetCachedValueCore(obj, key, func, cacheObj, 
7626  function(obj, key, func, cacheObj) {
7627   if(!ASPx.IsValidElement(cacheObj.cache[key]))
7628    cacheObj.cache[key] = func.apply(obj, []);
7629  });
7630};
7631CacheHelper.GetCachedElements = function(obj, key, func, cacheObj) {
7632 return CacheHelper.GetCachedValueCore(obj, key, func, cacheObj, 
7633  function(obj, key, func, cacheObj) {
7634   if(!ASPx.IsValidElements(cacheObj.cache[key])){
7635    var elements = func.apply(obj, []);
7636    if(!Ident.IsArray(elements))
7637     elements = [elements];
7638    cacheObj.cache[key] = elements;
7639   }
7640  });
7641};
7642CacheHelper.GetCachedElementById = function(obj, id, cacheObj) {
7643 return CacheHelper.GetCachedElement(obj, id, function() { return ASPx.GetElementById(id); }, cacheObj);
7644};
7645CacheHelper.GetCachedChildById = function(obj, parent, id, cacheObj) {
7646 return CacheHelper.GetCachedElement(obj, id, function() { return ASPx.GetChildById(parent, id); }, cacheObj);
7647};
7648CacheHelper.DropCachedValue = function(cacheObj, key) {
7649 cacheObj.cache[key] = null;
7650};  
7651CacheHelper.DropCache = function(cacheObj) {
7652 cacheObj.cache = null;
7653};  
7654var DomObserver = ASPx.CreateClass(null, {
7655 constructor: function() {
7656  this.items = { };
7657 },
7658 subscribe: function(elementID, callbackFunc) {
7659  var item = this.items[elementID];
7660  if(item)
7661   this.unsubscribe(elementID);
7662  item = {
7663   elementID: elementID,
7664   callbackFunc: callbackFunc,
7665   pauseCount: 0
7666  };
7667  this.prepareItem(item);
7668  this.items[elementID] = item;
7669 },
7670 prepareItem: function(item) {
7671 },
7672 unsubscribe: function(elementID) {
7673  this.items[elementID] = null;
7674 },
7675 getItemElement: function(item) {
7676  var element = this.getElementById(item.elementID);
7677  if(element)
7678   return element;
7679  this.unsubscribe(item.elementID);
7680  return null;
7681 },
7682 getElementById: function(elementID) {
7683  var element = document.getElementById(elementID);
7684  return element && ASPx.IsValidElement(element) ? element : null;
7685 },
7686 pause: function(element, includeSubtree) {
7687  this.changeItemsState(element, includeSubtree, true);
7688 },
7689 resume: function(element, includeSubtree) {
7690  this.changeItemsState(element, includeSubtree, false);
7691 },
7692 forEachItem: function(processFunc, context) {
7693  context = context || this;
7694  for(var itemName in this.items) {
7695   if(!this.items.hasOwnProperty(itemName))
7696    continue;
7697   var item = this.items[itemName];
7698   if(item) {
7699    var needBreak = processFunc.call(context, item);
7700    if(needBreak)
7701     return;
7702   }
7703  }
7704 },
7705 changeItemsState: function(element, includeSubtree, pause) {
7706  this.forEachItem(function(item) {
7707   if(!element)
7708    this.changeItemState(item, pause);
7709   else {
7710    var itemElement = this.getItemElement(item);
7711    if(itemElement && (element == itemElement || (includeSubtree && ASPx.GetIsParent(element, itemElement)))) {
7712     this.changeItemState(item, pause);
7713     if(!includeSubtree)
7714      return true;
7715    }
7716   }
7717  }.aspxBind(this));
7718 },
7719 changeItemState: function(item, pause) {
7720  if(pause)
7721   this.pauseItem(item);
7722  else
7723   this.resumeItem(item);
7724 },
7725 pauseItem: function(item) {
7726  item.paused = true;
7727  item.pauseCount++;
7728 },
7729 resumeItem: function(item) {
7730  if(item.pauseCount > 0) {
7731   if(item.pauseCount == 1)
7732    item.paused = false;
7733   item.pauseCount--;
7734  }
7735 }
7736});
7737DomObserver.IsMutationObserverAvailable = function() {
7738 return !!window.MutationObserver;
7739};
7740var TimerObserver = ASPx.CreateClass(DomObserver, {
7741 constructor: function() {
7742  this.constructor.prototype.constructor.call(this);
7743  this.timerID = -1;
7744  this.observationTimeout = 300;
7745 },
7746 subscribe: function(elementID, callbackFunc) {
7747  DomObserver.prototype.subscribe.call(this, elementID, callbackFunc);
7748  if(!this.isActivated())
7749   this.startObserving();
7750 },
7751 isActivated: function() {
7752  return this.timerID !== -1;
7753 },
7754 startObserving: function() {
7755  if(this.isActivated())
7756   window.clearTimeout(this.timerID);
7757  this.timerID = window.setTimeout(this.onTimeout, this.observationTimeout);
7758 },
7759 onTimeout: function() {
7760  var observer = _aspxGetDomObserver();
7761  observer.doObserve();
7762  observer.startObserving();
7763 },
7764 doObserve: function() {
7765  if(!ASPx.documentLoaded) return;
7766  this.forEachItem(function(item) {
7767   if(!item.paused)
7768    this.doObserveForItem(item);
7769  }.aspxBind(this));
7770 },
7771 doObserveForItem: function(item) {
7772  var element = this.getItemElement(item);
7773  if(element)
7774   item.callbackFunc.call(this, element);
7775 }
7776});
7777var MutationObserver = ASPx.CreateClass(DomObserver, {
7778 constructor: function() {
7779  this.constructor.prototype.constructor.call(this);
7780  this.callbackTimeout = 10;
7781 },
7782 prepareItem: function(item) {
7783  item.callbackTimerID = -1;
7784  var target = this.getElementById(item.elementID);
7785  if(!target)
7786   return;
7787  var observerCallbackFunc = function() {
7788   if(item.callbackTimerID === -1) {
7789    var timeoutHander = function() {
7790     item.callbackTimerID = -1;
7791     item.callbackFunc.call(this, target);
7792    }.aspxBind(this);
7793    item.callbackTimerID = window.setTimeout(timeoutHander, this.callbackTimeout);
7794   }
7795  }.aspxBind(this);
7796  var observer = new window.MutationObserver(observerCallbackFunc);
7797  var config = { attributes: true, childList: true, characterData: true, subtree: true };
7798  observer.observe(target, config);
7799  item.observer = observer;
7800  item.config = config;
7801 },
7802 unsubscribe: function(elementID) {
7803  var item = this.items[elementID];
7804  if(item) {
7805   item.observer.disconnect();
7806   item.observer = null;
7807  }
7808  DomObserver.prototype.unsubscribe.call(this, elementID);
7809 },
7810 pauseItem: function(item) {
7811  DomObserver.prototype.pauseItem.call(this, item);
7812  item.observer.disconnect();
7813 },
7814 resumeItem: function(item) {
7815  DomObserver.prototype.resumeItem.call(this, item);
7816  if(!item.paused) {
7817   var target = this.getItemElement(item);
7818   if(target)
7819    item.observer.observe(target, item.config);
7820  }
7821 }
7822});
7823var domObserver = null;
7824function _aspxGetDomObserver() {
7825 if(domObserver == null)
7826  domObserver = DomObserver.IsMutationObserverAvailable() ? new MutationObserver() : new TimerObserver();
7827 return domObserver;
7828}
7829var ControlUpdateWatcher = ASPx.CreateClass(null, {
7830 constructor: function() {
7831  this.helpers = { };
7832  this.clearLockerTimerID = -1;
7833  this.clearLockerTimerDelay = 15;
7834  this.postProcessing = false;
7835  this.init();
7836 },
7837 init: function() {
7838  var postHandler = aspxGetPostHandler();
7839  postHandler.Post.AddHandler(this.OnPost, this);
7840 },
7841 Add: function(helper) {
7842  this.helpers[helper.GetName()] = helper;
7843 },
7844 CanSendCallback: function(dxCallbackOwner, arg) {
7845  this.LockConfirmOnBeforeWindowUnload();
7846  var modifiedHelpers = this.FilterModifiedHelpersByDXCallbackOwner(this.GetModifiedHelpers(), dxCallbackOwner, arg);
7847  if(modifiedHelpers.length === 0) return true;
7848  var modifiedHelpersInfo = this.GetToConfirmAndToResetLists(modifiedHelpers, dxCallbackOwner.name);
7849  if(!modifiedHelpersInfo) return true;
7850  if(modifiedHelpersInfo.toConfirm.length === 0) {
7851   this.ResetClientChanges(modifiedHelpersInfo.toReset);
7852   return true;
7853  }
7854  var helper = modifiedHelpersInfo.toConfirm[0];
7855  if(!confirm(helper.GetConfirmUpdateText()))
7856   return false;
7857  this.ResetClientChanges(modifiedHelpersInfo.toReset);
7858  return true;
7859 },
7860 OnPost: function(s, e) {
7861  if(e.isDXCallback) return;
7862  this.postProcessing = true;
7863  this.LockConfirmOnBeforeWindowUnload();
7864  var modifiedHelpersInfo = this.GetModifedHelpersInfo(e);
7865  if(!modifiedHelpersInfo) return;
7866  if(modifiedHelpersInfo.toConfirm.length === 0) {
7867   this.ResetClientChanges(modifiedHelpersInfo.toReset);
7868   return;
7869  }
7870  var helper = modifiedHelpersInfo.toConfirm[0];
7871  if(!confirm(helper.GetConfirmUpdateText())) {
7872   e.cancel = true;
7873   this.finishPostProcessing();
7874  }
7875  if(!e.cancel)
7876   this.ResetClientChanges(modifiedHelpersInfo.toReset);
7877 },
7878 finishPostProcessing: function() {
7879  this.postProcessing = false;
7880 },
7881 GetModifedHelpersInfo: function(e) {
7882  var modifiedHelpers = this.FilterModifiedHelpers(this.GetModifiedHelpers(), e);
7883  if(modifiedHelpers.length === 0) return;
7884  return this.GetToConfirmAndToResetLists(modifiedHelpers, e && e.ownerID);
7885 },
7886 GetToConfirmAndToResetLists: function(modifiedHelpers, ownerID) {
7887  var resetList = [ ];
7888  var confirmList = [ ];
7889  for(var i = 0; i < modifiedHelpers.length; i++) {
7890   var helper = modifiedHelpers[i];
7891   if(!helper.GetConfirmUpdateText()) { 
7892    resetList.push(helper);
7893    continue;
7894   }
7895   if(helper.CanShowConfirm(ownerID)) { 
7896    resetList.push(helper);
7897    confirmList.push(helper);
7898   }
7899  }
7900  return { toConfirm: confirmList, toReset: resetList };
7901 },
7902 FilterModifiedHelpers: function(modifiedHelpers, e) {
7903  if(modifiedHelpers.length === 0)
7904   return [ ];
7905  if(this.RequireProcessUpdatePanelCallback(e))
7906   return this.FilterModifiedHelpersByUpdatePanels(modifiedHelpers);
7907  if(this.postProcessing)
7908   return this.FilterModifiedHelpersByPostback(modifiedHelpers);
7909  return modifiedHelpers;
7910 },
7911 FilterModifiedHelpersByDXCallbackOwner: function(modifiedHelpers, dxCallbackOwner, arg) {
7912  var result = [ ];
7913  for(var i = 0; i < modifiedHelpers.length; i++) {
7914   var helper = modifiedHelpers[i];
7915   if(helper.NeedConfirmOnCallback(dxCallbackOwner, arg))
7916    result.push(helper);
7917  }
7918  return result;
7919 },
7920 FilterModifiedHelpersByUpdatePanels: function(modifiedHelpers) {
7921  var result = [ ];
7922  var updatePanels = this.GetUpdatePanelsWaitedForUpdate();
7923  for(var i = 0; i < updatePanels.length; i++) {
7924   var panelID = updatePanels[i].replace(/\$/g, "_");
7925   var panel = ASPx.GetElementById(panelID);
7926   if(!panel) continue;
7927   for(var j = 0; j < modifiedHelpers.length; j++) {
7928    var helper = modifiedHelpers[j];
7929    if(ASPx.GetIsParent(panel, helper.GetControlMainElement()))
7930     result.push(helper);
7931   }
7932  }
7933  return result;
7934 },
7935 FilterModifiedHelpersByPostback: function(modifiedHelpers) {
7936  var result = [ ];
7937  for(var i = 0; i < modifiedHelpers.length; i++) {
7938   var helper = modifiedHelpers[i];
7939   if(helper.NeedConfirmOnPostback())
7940    result.push(helper);
7941  }
7942  return result;
7943 },
7944 RequireProcessUpdatePanelCallback: function(e) {
7945  var rManager = this.GetMSRequestManager();
7946  if(rManager && e && e.isMSAjaxCallback)
7947   return rManager._postBackSettings.async;
7948  return false;
7949 },
7950 GetUpdatePanelsWaitedForUpdate: function() {
7951  var rManager = this.GetMSRequestManager();
7952  if(!rManager) return [ ];
7953  var panelUniqueIDs = rManager._postBackSettings.panelsToUpdate || [ ];
7954  var panelClientIDs = [ ];
7955  for(var i = 0; i < panelUniqueIDs.length; i++) {
7956   var index = ASPx.Data.ArrayIndexOf(rManager._updatePanelIDs, panelUniqueIDs[i]);
7957   if(index >= 0)
7958    panelClientIDs.push(rManager._updatePanelClientIDs[index]);
7959  }
7960  return panelClientIDs;
7961 },
7962 GetMSRequestManager: function() {
7963  return ASPx.GetMSAjaxRequestManager();
7964 },
7965 GetModifiedHelpers: function() {
7966  var result = [ ];
7967  for(var key in this.helpers) { 
7968   if(this.helpers.hasOwnProperty(key)) {
7969    var helper = this.helpers[key];
7970    if(helper.HasChanges())
7971     result.push(helper);
7972   }
7973  }
7974  return result;
7975 },
7976 ResetClientChanges: function(modifiedHelpers) {
7977  for(var i = 0; i < modifiedHelpers.length; i++)
7978   modifiedHelpers[i].ResetClientChanges();
7979 },
7980 GetConfirmUpdateMessage: function() {
7981  if(this.confirmOnWindowUnloadLocked) return;
7982  var modifiedHelpersInfo = this.GetModifedHelpersInfo();
7983  if(!modifiedHelpersInfo || modifiedHelpersInfo.toConfirm.length === 0) 
7984   return;
7985  var helper = modifiedHelpersInfo.toConfirm[0];
7986  return helper.GetConfirmUpdateText();
7987 },
7988 LockConfirmOnBeforeWindowUnload: function() {
7989  this.confirmOnWindowUnloadLocked = true;
7990  this.clearLockerTimerID = ASPx.Timer.ClearTimer(this.clearLockerTimerID);
7991  this.clearLockerTimerID = window.setTimeout(function() {
7992   this.confirmOnWindowUnloadLocked = false;
7993  }.aspxBind(this), this.clearLockerTimerDelay);
7994 },
7995 OnWindowBeforeUnload: function(e) {
7996  var confirmMessage = this.GetConfirmUpdateMessage();
7997  if(confirmMessage)
7998   e.returnValue = confirmMessage;
7999  this.finishPostProcessing();
8000  return confirmMessage;
8001 },
8002 OnWindowUnload: function(e) {
8003  if(this.confirmOnWindowUnloadLocked) return;
8004  var modifiedHelpersInfo = this.GetModifedHelpersInfo();
8005  if(!modifiedHelpersInfo) return;
8006  this.ResetClientChanges(modifiedHelpersInfo.toReset);
8007 },
8008 OnMouseDown: function(e) {
8009  if(ASPx.Browser.IE)
8010   this.PreventBeforeUnloadOnLinkClick(e);
8011 },
8012 OnFocusIn: function(e) {
8013  if(ASPx.Browser.IE)
8014   this.PreventBeforeUnloadOnLinkClick(e);
8015 },
8016 PreventBeforeUnloadOnLinkClick: function(e) {
8017  if(ASPx.GetObjectKeys(this.helpers).length == 0)
8018   return;
8019  var link = ASPx.GetParentByTagName(ASPx.Evt.GetEventSource(e), "A");
8020  if(!link || link.dxgvLinkClickHanlderAssigned)
8021   return;
8022  var url = ASPx.Attr.GetAttribute(link, "href");
8023  if(!url || url.indexOf("javascript:") < 0)
8024   return;
8025  ASPx.Evt.AttachEventToElement(link, "click", function(ev) { return ASPx.Evt.PreventEvent(ev); });
8026  link.dxgvLinkClickHanlderAssigned = true;
8027 }
8028});
8029ControlUpdateWatcher.Instance = null;
8030ControlUpdateWatcher.getInstance = function () {
8031 if (!ControlUpdateWatcher.Instance) {
8032  ControlUpdateWatcher.Instance = new ControlUpdateWatcher();
8033  ASPx.Evt.AttachEventToElement(window, "beforeunload", function(e) {
8034   return ControlUpdateWatcher.Instance.OnWindowBeforeUnload(e);
8035  });
8036  ASPx.Evt.AttachEventToElement(window, "unload", function(e) {
8037   ControlUpdateWatcher.Instance.OnWindowUnload(e);
8038  });
8039  ASPx.Evt.AttachEventToDocument("mousedown", function(e) {
8040   ControlUpdateWatcher.Instance.OnMouseDown(e);
8041  });
8042  ASPx.Evt.AttachEventToDocument("focusin", function(e) {
8043   ControlUpdateWatcher.Instance.OnFocusIn(e);
8044  });
8045 }
8046 return ControlUpdateWatcher.Instance;
8047};
8048var UpdateWatcherHelper = ASPx.CreateClass(null, {
8049 constructor: function(owner) {
8050  this.owner = owner;
8051  this.ownerWatcher = ControlUpdateWatcher.getInstance();
8052  this.ownerWatcher.Add(this);
8053 },
8054 GetName: function() {
8055  return this.owner.name;
8056 },
8057 GetControlMainElement: function() {
8058  return this.owner.GetMainElement();
8059 },
8060 GetControlParentForm: function(){
8061  return ASPx.GetParentByTagName(this.GetControlMainElement(), "FORM");
8062 },
8063 CanShowConfirm: function(requestOwnerID) {
8064  return true;
8065 },
8066 HasChanges: function() {
8067  return false;
8068 },
8069 GetConfirmUpdateText: function() {
8070  return "";
8071 },
8072 NeedConfirmOnCallback: function(dxCallbackOwner) {
8073  return true;
8074 },
8075 NeedConfirmOnPostback: function() {
8076  if(ASPx.IsUploadSubmitRequest)
8077   return !ASPx.IsUploadSubmitRequest(this.GetControlParentForm(
8077));
8078  return true;
8079 },
8080 ResetClientChanges: function() {
8081 },
8082 ConfirmOnCustomControlEvent: function() {
8083  var confirmMessage = this.GetConfirmUpdateText();
8084  if(confirmMessage)
8085   return confirm(confirmMessage);
8086  return false;
8087 }
8088});
8089var ControlCallbackHandlersQueue = ASPx.CreateClass(null, {
8090 constructor: function (owner) {
8091  this.owner = owner;
8092  this.handlerInfos = [];
8093 },
8094 addCallbackHandler: function(handlerInfo) {
8095  this.handlerInfos.push(handlerInfo);
8096 },
8097 executeCallbacksHandlers: function() {
8098  for(var i = 0, handlerInfo; handlerInfo = this.handlerInfos[i]; i++)
8099   handlerInfo.handler.call(this.owner, handlerInfo.result);
8100  this.handlerInfos = [];
8101 }
8102});
8103var ControlCallbackQueueHelper = ASPx.CreateClass(null, {
8104 constructor: function (owner) {
8105  this.owner = owner;
8106  this.pendingCallbacks = [];
8107  this.receivedCallbacks = [];
8108  this.attachEvents();
8109 },
8110 showLoadingElements: function () {
8111  this.owner.ShowLoadingDiv();
8112  if (this.owner.IsCallbackAnimationEnabled())
8113   this.owner.StartBeginCallbackA
8113nimation();
8114  else
8115   this.owner.ShowLoadingElementsInternal();
8116 },
8117 attachEvents: function () {
8118  this.owner.EndCallback.AddHandler(this.onEndCallback.aspxBind(this));
8119  this.owner.CallbackError.AddHandler(this.onCallbackError.aspxBind(this));
8120 },
8121 detachEvents: function () {
8122  this.owner.EndCallback.RemoveHandler(this.onEndCallback);
8123  this.owner.CallbackError.RemoveHandler(this.onCallbackError);
8124 },
8125 onCallbackError: function (owner, result) {
8126  this.sendErrorToChildControl(result);
8127 },
8128 ignoreDuplicates: function () {
8129  return true;
8130 },
8131 hasDuplicate: function (arg) {
8132  for (var i in this.pendingCallbacks) {
8133   if (this.pendingCallbacks[i].arg == arg && this.pendingCallbacks[i].state != ASPx.callbackState.aborted)
8134    return true;
8135  }
8136  return false;
8137 },
8138 getToken: function (halperContext, callbackInfo) {
8139  return {
8140   cancel: function () {
8141    if (callbackInfo.state == ASPx.callbackState.sent) {
8142     callbackInfo.state = ASPx.callbackState.aborted;
8143     halperContext.sendNext();
8144    }
8145    if (callbackInfo.state == ASPx.callbackState.inTurn)
8146     ASPx.Data.ArrayRemove(halperContext.pendingCallbacks, callbackInfo);
8147   },
8148   callbackId: -1
8149  };
8150 },
8151 sendCallback: function (arg, handlerContext, handler, commandName, onBeforeSend) {
8152  if (this.ignoreDuplicates() && this.hasDuplicate(arg))
8153   return false;
8154  var handlerContext = handlerContext || this.owner;
8155  var callbackInfo = {
8156   arg: arg,
8157   handlerContext: handlerContext,
8158   handler: handler || handlerContext.OnCallback,
8159   state: ASPx.callbackState.inTurn,
8160   callbackId: -1,
8161   onBeforeSend: onBeforeSend
8162  };
8163  this.pendingCallbacks.push(callbackInfo);
8164  if (!this.hasActiveCallback()) {
8165   this.createCallbackByCallbackInfo(callbackInfo, commandName);
8166  }
8167  return this.getToken(this, callbackInfo);
8168 },
8169 hasActiveCallback: function () {
8170  return this.getCallbacksInfoByState(ASPx.callbackState.sent).length > 0;
8171 },
8172 sendNext: function () {
8173  var nextCallbackInfo = this.getCallbacksInfoByState(ASPx.callbackState.inTurn)[0];
8174  if (nextCallbackInfo) {
8175   this.createCallbackByCallbackInfo(nextCallbackInfo);
8176   return nextCallbackInfo.callbackId;
8177  }
8178 },
8179 createCallbackByCallbackInfo: function(callbackInfo, commandName) {
8180  if(callbackInfo.onBeforeSend)
8181   callbackInfo.onBeforeSend();
8182  callbackInfo.callbackId = this.owner.CreateCallback(callbackInfo.arg, commandName);
8183  callbackInfo.state = ASPx.callbackState.sent;
8184 },
8185 onEndCallback: function () {
8186  if (!this.owner.isErrorOnCallback && this.hasPendingCallbacks()) {
8187   var curCallbackId;
8188   var curCallbackInfo;
8189   var handlerContext;
8190   for (var i in this.receivedCallbacks) {
8191    if(this.receivedCallbacks.hasOwnProperty(i)) {
8192     curCallbackId = this.receivedCallbacks[i];
8193     curCallbackInfo = this.getCallbackInfoById(curCallbackId);
8194     if (curCallbackInfo.state != ASPx.callbackState.aborted) {
8195      handlerContext = curCallbackInfo.handlerContext;
8196      if (handlerContext.OnEndCallback)
8197       handlerContext.OnEndCallback();
8198      this.sendNext();
8199     }
8200     ASPx.Data.ArrayRemove(this.pendingCallbacks, curCallbackInfo);
8201    }
8202   }
8203   ASPx.Data.ArrayClear(this.receivedCallbacks);
8204  }
8205 },
8206 hasPendingCallbacks: function () {
8207  return this.pendingCallbacks && this.pendingCallbacks.length && this.pendingCallbacks.length > 0;
8208 },
8209 processCallback: function (result, callbackId) {
8210  this.receivedCallbacks.push(callbackId);
8211  if (this.hasPendingCallbacks()) {
8212   var callbackInfo = this.getCallbackInfoById(callbackId);
8213   if (callbackInfo.state != ASPx.callbackState.aborted)
8214    callbackInfo.handler.call(callbackInfo.handlerContext, result);
8215  }
8216 },
8217 getCallbackInfoById: function (id) {
8218  for (var i in this.pendingCallbacks) {
8219   if (this.pendingCallbacks[i].callbackId == id)
8220    return this.pendingCallbacks[i];
8221  }
8222 },
8223 getCallbacksInfoByState: function (state) {
8224  var result = [];
8225  for (var i in this.pendingCallbacks) {
8226   if (this.pendingCallbacks[i].state == state)
8227    result.push(this.pendingCallbacks[i]);
8228  }
8229  return result;
8230 },
8231 sendErrorToChildControl: function (callbackObj) {
8232  if (!this.hasPendingCallbacks())
8233   return;
8234  var callbackInfo = this.getCallbackInfoById(callbackObj.callbackId || 0);
8235  if (!callbackInfo)
8236   return;
8237  var hasChildControlHandler = (callbackInfo.handlerContext != this.owner) && callbackInfo.handlerContext.OnCallbackError;
8238  if (hasChildControlHandler)
8239   callbackInfo.handlerContext.OnCallbackError.call(callbackInfo.handlerContext, callbackObj.message, callbackObj.data);
8240 }
8241});
8242var AccessibilityHelperBase = ASPx.CreateClass(null, {
8243 constructor: function(control) {
8244  this.control = control;
8245  this.timerID = -1;
8246  this.pronounceMessageTimeout = 500;
8247  this.activeItem = this.getItems()[0];
8248  this.pronounceIsStarted = false;
8249 },
8250 PronounceMessage: function(text, activeItemArgs, inactiveItemArgs, mainElementArgs, ownerMainElement) {   
8251  this.timerID = ASPx.Timer.ClearTimer(this.timerID);
8252  this.pronounceIsStarted = true;
8253  this.timerID = window.setTimeout(function() {
8254   this.PronounceMessageCore(text, activeItemArgs, inactiveItemArgs, mainElementArgs, ownerMainElement);
8255  }.aspxBind(this), this.getPronounceTimeout());
8256 },
8257 PronounceMessageCore: function(text, activeItemArgs, inactiveItemArgs, mainElementArgs, ownerMainElement) {
8258  if(!this.getItems())
8259   return;
8260  this.toogleItem();
8261  var mainElement = this.getMainElement();
8262  var activeItem = this.getItem(true);
8263  var inactiveItem = this.getItem();
8264  if(ASPx.Attr.GetAttribute(mainElement, "role") != "application")
8265   mainElementArgs = this.addArguments(mainElementArgs, { "aria-activedescendant" : activeItem.id });
8266  var messageAttrObj = {};
8267  var activeItemRole = ASPx.Attr.GetAttribute(activeItem, "role");
8268  var attrName = activeItemRole == "combobox" ? "aria-label" : "innerHtml";
8269  messageAttrObj[attrName] = ASPx.Str.EncodeHtml(text);
8270  activeItemArgs = this.addArguments(activeItemArgs, messageAttrObj);
8271  messageAttrObj[attrName] = "";
8272  inactiveItemArgs = this.addArguments(inactiveItemArgs, messageAttrObj);
8273  var errorTextElement = null;
8274  if(this.control.GetErrorCell()) {
8275   errorTextElement = this.getAriaExplanatoryTextManager().GetErrorTextElement();
8276   activeItemArgs = this.addArguments(activeItemArgs,   {"aria-invalid"  : !this.control.isValid ? "true" : "" });
8277   mainElementArgs = this.addArguments(mainElementArgs, { "aria-invalid" : "" });
8278   inactiveItemArgs = this.addArguments(inactiveItemArgs,  { "aria-invalid" : "" });
8279  }
8280  this.changeActivityAttributes(activeItem, activeItemArgs);
8281  if(errorTextElement) {
8282   this.getAriaExplanatoryTextManager().SetOrRemoveText([activeItem], errorTextElement, !this.control.isValid, false, true);
8283   this.getAriaExplanatoryTextManager().SetOrRemoveText([mainElement, inactiveItem], errorTextElement, false, false, false);
8284  }
8285  this.changeActivityAttributes(mainElement, mainElementArgs);
8286  if(!!ownerMainElement && ASPx.Attr.GetAttribute(ownerMainElement, "role") != "application")
8287   this.changeActivityAttributes(ownerMainElement, { "aria-activedescendant": activeItem.id });
8288  this.changeActivityAttributes(inactiveItem, inactiveItemArgs);
8289  this.pronounceIsStarted = false;
8290 },
8291 GetActiveElement: function(inputIsMainElement) {
8292  if(this.pronounceIsStarted) return null;
8293  var mainElement = inputIsMainElement ? this.control.GetInputElement() : this.getMainElement();
8294  var activeElementId = ASPx.Attr.GetAttribute(mainElement, 'aria-activedescendant');
8295  return activeElementId ? ASPx.GetElementById(activeElementId) : mainElement;
8296 },
8297 getMainElement: function() {
8298  if(!ASPx.IsExistsElement(this.mainElement))
8299   this.mainElement = this.control.GetAccessibilityAssistantElement();
8300  return this.mainElement;
8301 },
8302 getItems: function() {
8303  if(!ASPx.IsExistsElement(this.items))
8304   this.items = ASPx.GetChildElementNodes(this.getMainElement());
8305  return this.items;
8306 },
8307 getItem: function(isActive) {
8308  if(isActive)
8309   return this.activeItem;
8310  var items = this.getItems();
8311  return items[0] === this.activeItem ? items[1] : items[0];
8312 },
8313 getAriaExplanatoryTextManager: function() { return this.control.ariaExplanatoryTextManager; },
8314 getPronounceTimeout: function() { return this.pronounceMessageTimeout; },
8315 toogleItem: function() {
8316  this.activeItem = this.getItem();
8317 },
8318 addArguments: function(targetArgs, newArgs) {
8319  if(!targetArgs) targetArgs = { };
8320  for(var key in newArgs) {
8321   if(newArgs.hasOwnProperty(key) && !targetArgs.hasOwnProperty(key))
8322    targetArgs[key] = newArgs[key];
8323  }
8324  return targetArgs;
8325 },
8326 changeActivityAttributes: function(element, args) {
8327  if(!element)
8328   return;
8329  for(var key in args) {
8330   if(args.hasOwnProperty(key)) {
8331    var value = args[key];
8332    if(key == "innerHtml")
8333     ASPx.SetInnerHtml(element, value);
8334    else {
8335     var action = value !== "" ? ASPx.Attr.SetAttribute : ASPx.Attr.RemoveAttribute;
8336     action(element, key, value);
8337    }
8338   }
8339  }
8340 }
8341});
8342var AccessibilityPronouncer = ASPx.CreateClass(null, {
8343 constructor: function() {
8344  this.pronouncerId = "dxPronouncer";
8345  this.initialized = false;
8346  this.focusableMessageElement = null;
8347  this.messageElement = null;
8348  this.pronouncers = {
8349   live: new AccessibilityLivePronouncer(this),
8350   descendant: new AccessibilityDescendantPronouncer(this)
8351  };
8352 },
8353 Pronounce: function(args, type) {
8354  this.pronouncers[type].Pronounce(args);
8355 },
8356 EnsureInitialize: function() {
8357  if(!this.initialized)
8358   this.initialize();
8359 },
8360 RemoveState: function() {
8361  for(var pronouncer in this.pronouncers)
8362   if(this.pronouncers.hasOwnProperty(pronouncer))
8363    pronouncer.RemoveState();
8364 },
8365 RestoreControlState: function(type, mainElement) {
8366  this.pronouncers[type].RestoreControlState(mainElement);
8367 },
8368 RestoreElementsState: function(type, elements) {
8369  this.pronouncers[type].RestoreElementsState(elements);
8370 },
8371 RestoreElementState: function(type, element) {
8372  this.pronouncers[type].RestoreElementState(element);
8373 },
8374 initialize: function() {
8375  this.createFocusableMessageElement();
8376  this.createMessageElement();
8377  this.prepareFocusableMessageElement();
8378  this.setAttributesForKeyboardNavigation();
8379  this.initialized = true;
8380 },
8381 createFocusableMessageElement: function() {
8382  var focusableMessageElement = document.createElement("DIV");
8383  document.body.appendChild(focusableMessageElement);
8384  this.focusableMessageElement = focusableMessageElement;   
8385 },
8386 prepareFocusableMessageElement: function() {
8387  this.focusableMessageElement.className = "dxAIFME";
8388 },
8389 setAttributesForKeyboardNavigation: function() {
8390  ASPx.Attr.Aria.SetApplicationRole(this.focusableMessageElement);
8391  ASPx.Attr.Aria.SetSilence(this.focusableMessageElement);
8392 },
8393 createMessageElement: function() {
8394  var messageElement = document.createElement("DIV");
8395  messageElement.id = this.pronouncerId;
8396  ASPx.Attr.SetAttribute(messageElement, "role", "note");
8397  this.focusableMessageElement.appendChild(messageElement);
8398  this.messageElement = messageElement;
8399 },
8400 getMessage: function(messagePartsArg) {
8401  var messageParts = messagePartsArg.filter(function(x) { return ASPx.IsExists(x); });
8402  return messageParts.join(", ");
8403 }
8404});
8405var AccessibilityPronouncerBase = ASPx.CreateClass(null, {
8406 constructor: function() {
8407  this.state = { };
8408 },
8409 Pronounce: function(args) {
8410  var messageElement = this.getMessageElement();
8411  ASPx.Attr.Aria.SetOrRemoveLabel(messageElement);
8412  ASPx.SetInnerHtml(messageElement, "");
8413  this.PronounceCore(args);
8414 },
8415 PronounceCore: function(args) { },
8416 SaveElementState: function(element) { 
8417  if(this.state[element.id])
8418   return;
8419  this.state[element.id] = {
8420   element: element,
8421   descendant: ASPx.Attr.GetAttribute(element, ASPx.Attr.Aria.descendant)
8422  };
8423 },
8424 RemoveState: function() {
8425  this.state = { };
8426 },
8427 RestoreControlState: function(mainElement) { 
8428  for(var elementInfo in this.state) {
8429   if(this.state.hasOwnProperty(elementInfo)) {
8430    var element = this.state[elementInfo].element;
8431    if(!mainElement || ASPx.GetIsParent(mainElement, element))
8432     this.RestoreElementState(element);
8433   }
8434  }
8435 },
8436 RestoreElementsState: function(elements) { 
8437  for(var i = 0; i < elements.length; i++)
8438   this.RestoreElementState(elements[i]);
8439 },
8440 RestoreElementState: function(element) {
8441  var elementState = this.state[element.id];
8442  if(!elementState)
8443   return;
8444  ASPx.Attr.Aria.SetOrRemoveDescendant(element, elementState.descendant);
8445  delete this.state[element.id];
8446 },
8447 getMessage: function(args) {
8448  return ASPx.AccessibilityPronouncer.getMessage(args.messageParts);
8449 },
8450 getMessageElement: function() {
8451  return ASPx.AccessibilityPronouncer.messageElement;
8452 },
8453 getFocusableMessageElement: function() {
8454   return ASPx.AccessibilityPronouncer.focusableMessageElement;
8455 }
8456});
8457var AccessibilityLivePronouncer = ASPx.CreateClass(AccessibilityPronouncerBase, {
8458 constructor: function() {
8459  this.constructor.prototype.constructor.call(this);
8460 },
8461 PronounceCore: function(args) {
8462  var message = this.getMessage(args);
8463  var messageElement = this.getMessageElement();
8464  ASPx.Attr.SetAttribute(this.getFocusableMessageElement(), "aria-live", "assertive");
8465  ASPx.Attr.Aria.SetAtomic(this.getFocusableMessageElement(), "true");
8466  ASPx.SetInnerHtml(messageElement, ASPx.Str.EncodeHtml(message));
8467 }
8468});
8469var AccessibilityDescendantPronouncer = ASPx.CreateClass(AccessibilityPronouncerBase, {
8470 constructor: function() {
8471  this.constructor.prototype.constructor.call(this);
8472 },
8473 PronounceCore: function(args) {
8474  var message = this.getMessage(args);
8475  var activeElement = ASPx.GetActiveElement();
8476  var messageElement = this.getMessageElement();
8477  this.SaveElementState(activeElement);
8478  ASPx.Attr.RemoveAttribute(this.getFocusableMessageElement(), "aria-live");
8479  ASPx.Attr.RemoveAttribute(this.getFocusableMessageElement(), "aria-atomic");
8480  ASPx.Attr.Aria.SetOrRemoveLabel(messageElement, message);
8481  ASPx.Attr.Aria.SetOrRemoveDescendant(activeElement, messageElement.id);
8482 }
8483});
8484ASPx.AccessibilityPronouncerType = {
8485 live: "live",
8486 descendant: "descendant"
8487};
8488ASPx.AccessibilityPronouncer = new AccessibilityPronouncer();
8489var RestoreFocusHelper = ASPx.CreateClass(null, {
8490 constructor: function() {
8491  this.excludedIDs = [ "DXCBtn" ]; 
8492  this.pronouncerType = ASPx.AccessibilityPronouncerType.live;
8493  this.callbackQueue = [];
8494  this.Initialize();
8495 },
8496 Initialize: function() {
8497  var that = this;
8498  ASPx.Evt.AttachEventToDocumentCore("DOMContentLoaded", function() {
8499   ASPxClientControl.GetControlCollection().BeginCallback.AddHandler(that.OnBeginCallback, that);
8500   ASPxClientControl.GetControlCollection().EndCallback.AddHandler(that.OnEndCallback, that);
8501  });
8502 },
8503 OnBeginCallback: function(s, e) {
8504  var control = e.control;
8505  if(!control.allowRestoreFocusOnCallbacks())
8506   return;
8507  control.accessibilityFocusTreeLine = this.getFocusTreeLine(control);
8508  var controlHasCallbackTreeLine = this.callbackQueueContainsTreeLine(control);
8509  this.pushTreeLineInfoIntoCallbackQueue(control);
8510  if(control.accessibilityFocusTreeLine && !controlHasCallbackTreeLine)
8511   control.SendMessageToAssistiveTechnology(this.getDefaultCallbackMessage());
8512 },
8513 OnEndCallback: function(s, e) {
8514  var control = e.control;
8515  if(!control.allowRestoreFocusOnCallbacks())
8516   return;
8517  var treeLineInfo = this.shiftTreeLineInfoFromCallbackQueue(control);
8518  if(treeLineInfo.queueLength == 0) {
8519   if(!control.accessibilityFocusTreeLine && treeLineInfo.treeLine)
8520    control.accessibilityFocusTreeLine = treeLineInfo.treeLine;
8521   var focusElement = this.findFocusElement(control);
8522   if(!this.handleActivePopupWindow(focusElement))
8523    ASPx.AccessibilityUtils.SetFocusAccessible(focusElement);
8524   delete control.accessibilityFocusTreeLine;
8525  }
8526 },
8527 pushTreeLineInfoIntoCallbackQueue: function(control) {
8528  var controlTreeLine = control.accessibilityFocusTreeLine ? control.accessibilityFocusTreeLine.slice(0) : null;
8529  if(!this.callbackQueue[control.name])
8530   this.callbackQueue[control.name] = [];
8531  this.callbackQueue[control.name].push(controlTreeLine);
8532 },
8533 shiftTreeLineInfoFromCallbackQueue: function(control) {
8534  var treeLineInfo = { queueLength: 0, treeLine: null };
8535  var treeLines = this.callbackQueue[control.name];
8536  if(treeLines && treeLines.length > 0) {
8537   treeLineInfo.treeLine = treeLines.shift();
8538   var linesCount = treeLines.length;
8539   treeLineInfo.queueLength = linesCount;
8540   if(linesCount > 0 && !treeLines[0] && treeLineInfo.treeLine)
8541    treeLines[0] = treeLineInfo.treeLine.slice(0);
8542  }
8543  return treeLineInfo;
8544 },
8545 callbackQueueContainsTreeLine: function(control) {
8546  var treeLines = this.callbackQueue[control.name];
8547  if(!treeLines || treeLines.length == 0) 
8548   return false;
8549  if(treeLines[treeLines.length - 1])
8550   return true;
8551  return false;
8552 },
8553 getDefaultCallbackMessage: function() {
8554  return ASPx.AccessibilitySR.DefaultCallbackMessage;
8555 },
8556 handleActivePopupWindow: function(focusElement) {
8557  if(!ASPx.GetPopupControlCollection)
8558   return false;
8559  var activePopupWindow = ASPx.GetPopupControlCollection().GetCurrentActiveWindowElement();
8560  if(activePopupWindow) {
8561   var popupInfo = ASPx.GetPopupControlCollection().GetPopupWindowFromID(activePopupWindow.id);
8562   if(!popupInfo.popupControl.accessibleFocusElement) {
8563    if(popupInfo.popupControl.setFocusOnCallback)
8564     popupInfo.popupControl.accessibleFocusElement = focusElement;
8565    else {
8566     var parentControl = popupInfo.popupControl.GetParentControl();
8567     if(parentControl && parentControl.GetMainElement())
8568      popupInfo.popupControl.accessibleFocusElement = ASPx.FindFirstChildActionElement(parentControl.GetMainElement());
8569    }
8570    return true;
8571   }
8572  }
8573  return false;
8574 },
8575 getFocusTreeLine: function(control) {
8576  var element = document.activeElement;
8577  var mainElement = control.GetMainElement();
8578  if(!ASPx.GetIsParent(mainElement, element)) {
8579   var treeInfo = this.findFocusedControlElement(mainElement, element);
8580   element = treeInfo.focusElement;
8581   mainElement = treeInfo.rootElement;
8582  }
8583  return this.getTreeLineCore(mainElement, element);
8584 },
8585 getTreeLineCore: function(mainElement, element) {
8586  if(!element) return null;
8587  treeLine = [ ];
8588  while(element) {
8589   treeLine.push({ 
8590    id: element.id,
8591    tagName: element.tagName,
8592    index: ASPx.Data.ArrayIndexOf(element.parentNode.childNodes, element)
8593   });
8594   if(element === mainElement || element === document.body)
8595    break;
8596   element = element.parentNode;
8597  }
8598  return treeLine;
8599 },
8600 findFocusedControlElement: function(mainElement, activeElement) {
8601  var element = null;
8602  var parentElement = mainElement;
8603  var focusedEditor = ASPx.IsExists(ASPx.GetFocusedEditor) ? ASPx.GetFocusedEditor() : null;
8604  if(focusedEditor && ASPx.GetIsParent(mainElement, focusedEditor.GetMainElement()))
8605   element = focusedEditor.GetFocusableInputElement();
8606  else {
8607   if(mainElement && activeElement) {
8608    var mainControl = ASPx.GetClientControlByElementID(mainElement.id);
8609    var parentControls = ASPx.GetParentClientControls(activeElement.id);
8610    for(var i = parentControls.length - 1; i > -1; i--) {   
8611     if(mainControl.name == parentControls[i].name) {
8612      element = activeElement;
8613      var rootIndex = i > 0 ? i - 1 : i;
8614      parentElement = parentControls[rootIndex].GetMainElement();
8615      if(!parentElement && parentControls[rootIndex].GetCurrentWindowElement)
8616       parentElement = parentControls[rootIndex].GetCurrentWindowElement();
8617      break;
8618     }
8619    }
8620   }
8621  }
8622  return { focusElement: element, rootElement: parentElement }; 
8623 },
8624 findFocusElement: function(control) {
8625  if(!control.accessibilityFocusTreeLine)
8626   return;
8627  var treeLine = control.accessibilityFocusTreeLine.slice(0);
8628  var focusElementParent = this.findFocusElementParentById(treeLine);
8629  if(!focusElementParent) 
8630   return;
8631  return this.findFocusElementFromDOMTree(treeLine, focusElementParent);
8632 },
8633 findFocusElementParentById: function(treeLine) {
8634  for(var i = 0; i < treeLine.length; i++) {
8635   var id = treeLine[i].id;
8636   if(!this.isValidId(id))
8637    continue;
8638   var element = document.getElementById(id);
8639   if(element) {
8640    treeLine.splice(i, treeLine.length - i);
8641    treeLine.reverse();
8642    return element;
8643   }
8644  }
8645  return null;
8646 },
8647 findFocusElementFromDOMTree: function(treeLine, focusElementParent) {
8648  var element = focusElementParent;
8649  for(var i = 0; i < treeLine.length; i++) {
8650   var info = treeLine[i];
8651   if(info.index >= element.childNodes.length) {
8652    element = element.childNodes.length > 0 ? element.childNodes[element.childNodes.length - 1] : null;
8653    return this.findNeighbourFocusElement(element, focusElementParent);
8654   }
8655   var child = element.childNodes[info.index];
8656   if(child.tagName !== info.tagName)
8657    return this.findNeighbourFocusElement(child, focusElementParent);
8658   element = child;
8659  }
8660  return element;
8661 },
8662 findNeighbourFocusElement: function(element, focusElementParent) {
8663  if(!element || !element.parentNode) return null;
8664  var neighbours = element.parentNode.childNodes;
8665  var indices = this.calcLeftRightIndices(ASPx.Data.ArrayIndexOf(neighbours, element), neighbours.length);
8666  for(var i = 0; i < indices.length; i++) {
8667   var index = indices[i];
8668   var actionElement = ASPx.FindFirstChildActionElement(neighbours[index]);
8669   if(actionElement)
8670    return actionElement;
8671  }
8672  if(element === focusElementParent)
8673   return null;
8674  return this.findNeighbourFocusElement(element.parentNode, focusElementParent);
8675 },
8676 calcLeftRightIndices: function(startIndex, count) {
8677  var indices = [ ];
8678  var incSides = [ 0, 0 ];
8679  var index = startIndex;
8680  for(var i = 0; i < count; i++) {
8681   indices.push(index);
8682   var even = i % 2 === 0;
8683   var nextIndex = this.calcNextIndex(startIndex, count, incSides, even);
8684   if(nextIndex < 0)
8685    nextIndex = this.calcNextIndex(startIndex, count, incSides, !even);
8686   index = nextIndex;
8687  }
8688  return indices;
8689 },
8690 calcNextIndex: function(startIndex, count, incSides, even) {
8691  var sideIndex = even ? 0 : 1;
8692  var inc = incSides[sideIndex];
8693  inc += even ? -1 : 1;
8694  var nextIndex = startIndex + inc;
8695  if(nextIndex >= 0 && nextIndex < count) {
8696   incSides[sideIndex] = inc;
8697   return nextIndex;
8698  }
8699  return -1;
8700 },
8701 isValidId: function(id) {
8702  return id && !this.isExcludedId(id);
8703 },
8704 isExcludedId: function(id) {
8705  var result = false;
8706  for(var i = 0; i < this.excludedIDs.length; i++) {
8707   if(id.indexOf(this.excludedIDs[i]) > -1) {
8708    result = true;
8709    break;
8710   }
8711  }
8712  return result;
8713 }
8714});
8715var EventStorage = ASPx.CreateClass(null, {
8716 constructor: function() {
8717  this.bag = { };
8718 },
8719 Save: function(e, data, overwrite) {
8720  var key = this.getEventKey(e);
8721  if(this.bag.hasOwnProperty(key) && !overwrite)
8722   return;
8723  this.bag[key] = data;
8724  window.setTimeout(function() { delete this.bag[key]; }.aspxBind(this), 100);
8725 },
8726 Load: function(e) {
8727  var key = this.getEventKey(e);
8728  return this.bag[key];
8729 },
8730 getEventKey: function(e) {
8731  if(ASPx.IsExists(e.timeStamp))
8732   return e.timeStamp.toString();
8733  var eventSource = ASPx.Evt.GetEventSource(e);
8734  var type = e.type.toString();
8735  return eventSource ? type + "_" + eventSource.uniqueID.toString() : type;
8736 }
8737});
8738ASPx.RestoreFocusHelper = new RestoreFocusHelper();
8739EventStorage.Instance = null;
8740EventStorage.getInstance = function() {
8741 if(!EventStorage.Instance)
8742  EventStorage.Instance = new EventStorage();
8743 return EventStorage.Instance;
8744};
8745var GetGlobalObject = function(objectName) {
8746 var fields = objectName.split('.');
8747 var obj = window[fields[0]];
8748 for(var i = 1;
8748 obj && i < fields.length; i++) {
8749  obj = obj[fields[i]];
8750 }
8751 return obj;
8752};
8753var GetExternalScriptProcessor = function() {
8754 return ASPx.ExternalScriptProcessor ? ASPx.ExternalScriptProcessor.getInstance() : null;
8755};
8756var SAVED_WIDTH_ATTR = "data-dx-ripple-saved-width";
8757var RIPPLE_FIXED_ROW_ATTR = "data-dx-ripple-locked";
8758var READ_ONLY_COMBOBOX_MARKER_CSS_CLASS = "dxICBReadonlyMarker";
8759var ThemesWithRipple = ['Material'];
8760var RippleHelper = {
8761 rippleTargetClassName: "dxRippleTarget",
8762 rippleTargetExternalClassName: "dxRippleTargetExternal",
8763 rippleContainerClassName: "dxRippleContainer",
8764 rippleClassName: "dxRipple",
8765 touchRadius: -1,
8766 isMobileExternalRipple: null,
8767 zoom: 1,
8768 Init: function() {
8769  if(this.getIsRippleFunctionalityEnabled()) {
8770   setTimeout(function() {
8771    this.calcTouchRadius();
8772   }.aspxBind(this), 0);
8773  }
8774 },
8775 calcTouchRadius: function() {
8776  var testBlock = document.createElement("DIV");
8777  ASPx.SetStyles(testBlock, {
8778   height: "1in",
8779   width: "1in",
8780   left: "-100%",
8781   top: "-100%",
8782   position: "absolute"
8783  });
8784  document.body.appendChild(testBlock);
8785  this.touchRadius = (1.8 / 2.54) * Math.max(testBlock.offsetWidth, testBlock.offsetHeight);
8786  document.body.removeChild(testBlock);
8787 },
8788 isRippleFunctionalityEnabled: null,
8789 checkRippleFunctionality: function() {
8790  if(ASPx.Browser.Safari && ASPx.Browser.Version <= 5.1)
8791   return false;
8792  for(var i = 0; i < ThemesWithRipple.length; i++) {
8793   var firstRippleThemeElement = document.querySelector("[class*='_" + ThemesWithRipple[i] + "']");
8794   if(firstRippleThemeElement)
8795    return true;
8796  }  
8797  return false;
8798 },
8799 ReInit: function() {
8800  this.isRippleFunctionalityEnabled = null;
8801  this.Init();
8802 },
8803 onDocumentMouseDown: function(evt) {
8804  if(RippleHelper.getIsRippleFunctionalityEnabled())
8805   RippleHelper.processMouseDown(evt);
8806 },
8807 getIsRippleFunctionalityEnabled: function() {
8808  if(!ASPx.IsExists(this.isRippleFunctionalityEnabled))
8809   this.isRippleFunctionalityEnabled = this.checkRippleFunctionality();
8810  return this.isRippleFunctionalityEnabled;
8811 },
8812   createTargetInfo: function(target) {
8813  return { 
8814   x: ASPx.GetAbsoluteX(target),
8815   y: ASPx.GetAbsoluteY(target),
8816   width: target.offsetWidth,
8817   height: target.offsetHeight,
8818   classNames: ASPx.GetClassNameList(target),
8819   getTarget: function() { return target; },
8820   getRect: function() { return {x: this.x, y: this.y, width: this.width, height: this.height }; }
8821  };
8822 },
8823 createEventInfo: function(evt) {
8824  return { x: this.getEventX(evt), y: this.getEventY(evt) };
8825 },
8826 processMouseDown: function(evt) {
8827  var evtSource = ASPx.Evt.GetEventSource(evt);
8828  var rippleTarget = this.getRippleTargetElement(evtSource);
8829  if(this.needToProcessRipple(rippleTarget, evtSource))
8830   this.processRipple(this.createTargetInfo(rippleTarget), this.createEventInfo(evt));
8831 },
8832 getRippleTargetElement: function(evtSource) {
8833  if(this.hasRippleMarker(evtSource))
8834   return evtSource;
8835  if(evtSource.tagName && evtSource.tagName.toLowerCase() == "input" && ASPx.ElementContainsCssClass(evtSource, "dxTI")) {
8836   var elements = ASPx.GetChildElementNodesByPredicate(evtSource.parentNode.parentNode, function(element) {
8837    return this.hasRippleMarker(element);
8838   }.aspxBind(this));
8839   return elements && elements[0];
8840  }
8841  return ASPx.GetParent(evtSource, function(element) {
8842   return this.hasRippleMarker(element);
8843  }.aspxBind(this));
8844 },
8845 hasRippleMarker: function(element) {
8846  if(!ASPx.IsExistsElement(element))
8847   return false;
8848  var computedStyles = window.getComputedStyle(element, ":before");
8849  if(ASPx.IsExists(computedStyles)) {
8850   var content = computedStyles.getPropertyValue("content");
8851   if(content.indexOf(this.rippleTargetExternalClassName) > -1) {
8852    ASPx.AddClassNameToElement(element, this.rippleTargetExternalClassName);
8853    return true;
8854   }
8855   return content.indexOf(this.rippleTargetClassName) > -1;
8856  }
8857  return false;
8858 },
8859 needToProcessRipple: function(rippleTarget, evtSource) {
8860  if(!rippleTarget || !ASPx.AnimationUtils)
8861   return false;
8862  var isClearButton = ASPx.ElementContainsCssClass(rippleTarget, "dxeButton") && rippleTarget.id && rippleTarget.id.indexOf("B-100") !== -1;
8863  var isEmptyCalendarDay = ASPx.ElementContainsCssClass(rippleTarget, "dxeCalendarDay") && ASPx.Str.Trim(rippleTarget.textContent) == "";
8864  var isReadonly = ASPx.ElementContainsCssClass(rippleTarget, READ_ONLY_COMBOBOX_MARKER_CSS_CLASS);
8865  var tempFixDisable = ASPx.ElementContainsCssClass(rippleTarget, "dxSwitcher") && ASPx.Browser.MacOSMobilePlatform;
8866  var rippleIsForbidden = isReadonly || isClearButton || isEmptyCalendarDay || ASPx.GetParentByPartialClassName(rippleTarget, "Disabled") ||
8867   ASPx.ElementContainsCssClass(rippleTarget, "dxgvBatchEditCell") || ASPx.ElementContainsCssClass(rippleTarget, "dxcvEditForm") ||
8868   ASPx.GetParentByPartialClassName(evtSource, "dxcvFocusedCell") || tempFixDisable;
8869  return !rippleIsForbidden;
8870 },
8871 hasBothOverflow: function(style) {
8872  return style.overflow == "scroll" || style.overflow == "auto" || style.overflow == "hidden";
8873 },
8874 hasOverflowX: function(style) {
8875  return style.overflowX == "scroll" || style.overflowX == "auto" || style.overflowX == "hidden";
8876 },
8877 hasOverflowY: function(style) {
8878  return style.overflowY == "scroll" || style.overflowY == "auto" || style.overflowY == "hidden";
8879 },
8880 getExternalRippleContainerSize: function(targetRect) {
8881  if(ASPx.Browser.MobileUI) {
8882   var origTouchRadius = this.getOriginTouchRadius();
8883   if(origTouchRadius < targetRect.width || origTouchRadius < targetRect.height)
8884    origTouchRadius = Math.max(targetRect.width, targetRect.height);
8885   return {x: targetRect.x + (targetRect.width - origTouchRadius) / 2, y: targetRect.y + (targetRect.height - origTouchRadius) / 2, width: origTouchRadius, height: origTouchRadius };
8886  }
8887  var result = { x: 0, y: 0, width: 0, height: 0 };
8888  var diff = targetRect.width - targetRect.height;
8889  if(diff > 0) {
8890   result.x = targetRect.x;
8891   result.y = targetRect.y - diff / 2;
8892   result.width = targetRect.width;
8893   result.height = targetRect.width;
8894  } else {
8895   result.x = targetRect.x + diff / 2;
8896   result.y = targetRect.y;
8897   result.width = targetRect.height;
8898   result.height = targetRect.height;
8899  }
8900  return result;
8901 },
8902 getInternalContainerSize: function(targetInfo) {
8903  var parentWithOverflow = RippleHelper.getParentWithOverflow(targetInfo.getTarget());
8904  if(!ASPx.IsExists(parentWithOverflow))
8905   return targetInfo;
8906  var parentWithOverflowStyle = ASPx.GetCurrentStyle(parentWithOverflow);
8907  var bothOverflow = this.hasBothOverflow(parentWithOverflowStyle);
8908  var overflowX = this.hasOverflowX(parentWithOverflowStyle);
8909  var overflowY = this.hasOverflowY(parentWithOverflowStyle);
8910  var parentRect = {
8911   x: ASPx.GetAbsoluteX(parentWithOverflow),
8912   y: ASPx.GetAbsoluteY(parentWithOverflow),
8913   width: parentWithOverflow.offsetWidth,
8914   height: parentWithOverflow.offsetHeight
8915  };
8916  return this.getInternalContainerSizeCore(targetInfo, parentRect, bothOverflow, overflowX, overflowY);
8917 },
8918 getInternalContainerSizeCore: function(targetRect, parentRect, bothOverflow, overflowX, overflowY) {
8919  var result = {};
8920  ASPx.Data.MergeHashTables(result, targetRect);
8921  if(bothOverflow || overflowX) {
8922   result.x = targetRect.x < parentRect.x ? parentRect.x : targetRect.x;
8923   if(targetRect.x + targetRect.width > parentRect.x + parentRect.width)
8924    result.width = parentRect.x + parentRect.width - targetRect.x;
8925   if(parentRect.x > targetRect.x)
8926    result.width -= (parentRect.x - targetRect.x);
8927  }
8928  if(bothOverflow || overflowY) {
8929   result.y = targetRect.y < parentRect.y ? parentRect.y : targetRect.y;
8930   if(targetRect.y + targetRect.height > parentRect.y + parentRect.height)
8931    result.height = parentRect.y + parentRect.height - targetRect.y;
8932   if(parentRect.y > targetRect.y)
8933    result.height -= (parentRect.y - targetRect.y);
8934  }
8935  return result;
8936 },
8937 calculateRippleContainerSize: function(targetInfo, isExternalRipple) {
8938  return isExternalRipple ? this.getExternalRippleContainerSize(targetInfo) : this.getInternalContainerSize(targetInfo);
8939 },
8940 getParentWithOverflow: function(rippleTarget) {
8941  var result = ASPx.GetParent(rippleTarget, function(element) {
8942   var elementStyle = ASPx.GetCurrentStyle(element);
8943   return this.hasBothOverflow(elementStyle) || this.hasOverflowX(elementStyle) || this.hasOverflowY(elementStyle);
8944  }.aspxBind(this));
8945  return result;
8946 },
8947 getDuration: function(targetInfo) {
8948  return this.IsExternalRipple(targetInfo) || ASPx.Browser.MobileUI ? 650 : 450;
8949 },
8950 createRippleTransition: function(container, rippleElement, radius, targetInfo) {
8951  var rippleSize = 2 * radius;
8952  var transitionEndIsAborted = true;
8953  var transitionProperties = {
8954   width: { from: 0, to: rippleSize, transition: ASPx.AnimationConstants.Transitions.RIPPLE, propName: "width", unit: "px" },
8955   height: { from: 0, to: rippleSize, transition: ASPx.AnimationConstants.Transitions.RIPPLE, propName: "height", unit: "px" },
8956   marginLeft: { from: 0, to: -rippleSize / 2, transition: ASPx.AnimationConstants.Transitions.RIPPLE, propName: "marginLeft", unit: "px" },
8957   marginTop: { from: 0, to: -rippleSize / 2, transition: ASPx.AnimationConstants.Transitions.RIPPLE, propName: "marginTop", unit: "px" },
8958   opacity: { from: 1, to: 0.05, transition: ASPx.AnimationConstants.Transitions.RIPPLE, propName: "o
8958pacity", unit: "%" }
8959  };
8960  var rippleTransition = ASPx.AnimationUtils.createMultipleAnimationTransition(rippleElement, {
8961   transition: ASPx.AnimationConstants.Transitions.RIPPLE,
8962   duration: this.getDuration(targetInfo),
8963   onComplete: function() {
8964    this.RemoveRippleContainer(container.parentElement);
8965    transitionEndIsAborted = false;
8966   }.bind(this)
8967  });
8968  rippleTransition.Start(transitionProperties);
8969  window.setTimeout(function() {
8970   if(transitionEndIsAborted)
8971    this.RemoveRippleContainer(container.parentElement);
8972  }.bind(this), 500);
8973 },
8974 calculateRadius: function(isExternalRipple, posX, posY, containerRect) {
8975  var radius = -1;
8976  if(isExternalRipple) {
8977   if(ASPx.Browser.MobileUI)
8978    radius = this.getOriginTouchRadius() / 2;
8979   else
8980    radius = Math.max(containerRect.height, containerRect.width);
8981  } else {
8982   var width1 = posX - containerRect.x;
8983   var width2 = containerRect.width - width1;
8984   var height1 = posY - containerRect.y;
8985   var height2 = containerRect.height - height1;
8986   var rippleWidth = Math.max(width1, width2);
8987   var rippleHeight = Math.max(height1, height2);
8988   radius = Math.sqrt(Math.pow(rippleHeight, 2) + Math.pow(rippleWidth, 2));
8989  }
8990  return radius;
8991 },
8992 createRippleElement: function(container, rippleCenter) {
8993  var rippleElement = document.createElement("DIV");
8994  rippleElement.className = this.rippleClassName;
8995  container.appendChild(rippleElement);
8996  ASPxClientUtils.SetAbsoluteX(rippleElement, rippleCenter.x);
8997  ASPxClientUtils.SetAbsoluteY(rippleElement, rippleCenter.y);
8998  return rippleElement;
8999 },
9000 processRipple: function(targetInfo, eventInfo) {
9001  this.initRippleProcess();
9002  var isExternalRipple = this.IsExternalRipple(targetInfo);
9003  var rippleCenter = this.getRippleCenter(targetInfo.getRect(), eventInfo, isExternalRipple);
9004  var container = this.createRippleContainer(targetInfo, isExternalRipple);
9005  var rippleElement = this.createRippleElement(container, rippleCenter);
9006  var radius = this.calculateRadius(isExternalRipple, rippleCenter.x, rippleCenter.y, this.getElementRect(container));
9007  this.createRippleTransition(container, rippleElement, radius, targetInfo);
9008 },
9009 initRippleProcess: function() {
9010  this.isMobileExternalRipple = null;
9011  this.zoom = screen.width / window.innerWidth;
9012 },
9013 getRippleCenter: function(targetInfo, eventInfo, isExternalRipple) {
9014  var posX = 0;
9015  var posY = 0;
9016  if(isExternalRipple) {
9017   posX = targetInfo.x + targetInfo.width / 2;
9018   posY = targetInfo.y + targetInfo.height / 2;
9019  } else {
9020   posX = eventInfo.x;
9021   posY = eventInfo.y;
9022  }
9023  return {x: posX, y: posY};
9024 },
9025 createRippleContainer: function(targetInfo, isExternalRipple) {
9026  var containerParent = targetInfo.getTarget();
9027  if(!containerParent)
9028   return;
9029  var containerTagName = containerParent.tagName == "TR" ? "TD" : "DIV";
9030  var container = document.createElement(containerTagName);
9031  container.className = this.rippleContainerClassName;
9032  if(containerParent.parentNode && containerParent.tagName == "IMG")
9033   containerParent = containerParent.parentNode;
9034  if(this.isARowInFixedLayoutTable(containerParent))
9035   this.lockFixedLayoutTableSizes(containerParent);
9036  containerParent.appendChild(container);
9037  if(isExternalRipple)
9038   container.style.borderRadius = "50%";
9039  var containerRect = this.calculateRippleContainerSize(targetInfo, isExternalRipple);
9040  this.assignContainerSettings(container, containerRect);
9041  return container;
9042 },
9043 isARowInFixedLayoutTable: function(containerParent) {
9044  if(containerParent.tagName !== "TR")
9045   return false;
9046  var parentTable = this.getParentTable(containerParent);
9047  return parentTable && ASPx.GetCurrentStyle(parentTable)["table-layout"] === "fixed";
9048 },
9049 processFirstRowOfFixedTable: function(containerRow, rowAction, cellAction) {
9050  var firstRow = this.getFirstRow(containerRow);
9051  rowAction(firstRow);
9052  var cells = ASPx.Data.CollectionToArray(firstRow.cells);
9053  cells.forEach(cellAction);
9054 },
9055 getParentTable: function(element) {
9056  var parentTable = element;
9057  while(parentTable && parentTable.tagName !== "TABLE")
9058   parentTable = parentTable.parentElement;
9059  return parentTable;
9060 },
9061 lockFixedLayoutTableSizes: function(containerRow) {
9062  var firstRow = this.getFirstRow(containerRow);
9063  if(this.incLockCount(firstRow) === 1) {
9064   var cells = ASPx.Data.CollectionToArray(firstRow.cells);
9065   var widths = cells.map(function(cell) { return cell.style.width; });
9066   var computedWidths = cells.map(function(cell) {
9067    if(ASPx.Browser.IE && ASPx.ElementHasCssClass(cell, "dxeCM"))
9068     return cell.offsetWidth + "px";
9069    return window.getComputedStyle(cell).width;
9070   });
9071   var fixWidth = function(cell, i) {
9072    if(ASPx.Attr.IsExistsAttribute(cell, SAVED_WIDTH_ATTR))
9073     return;
9074    if(widths[i])
9075     ASPx.Attr.SetAttribute(cell, SAVED_WIDTH_ATTR, widths[i]);
9076    cell.style.width = computedWidths[i];
9077   };
9078   cells.forEach(fixWidth);
9079  }
9080 }, 
9081 unlockFixedLayoutTableSizes: function(containerRow) {
9082  var firstRow = this.getFirstRow(containerRow);   
9083  if(this.decLockCount(firstRow) === 0) {
9084   var cells = ASPx.Data.CollectionToArray(firstRow.cells);
9085   var restoreState = function(cell) {
9086    if(ASPx.Attr.IsExistsAttribute(cell, SAVED_WIDTH_ATTR)) {
9087     cell.style.width = ASPx.Attr.GetAttribute(cell, SAVED_WIDTH_ATTR);
9088     ASPx.Attr.RemoveAttribute(cell, SAVED_WIDTH_ATTR);
9089    } else {
9090     cell.style.width = null;
9091    }
9092   };
9093   cells.forEach(restoreState);
9094  }
9095 },
9096 getFirstRow: function(containerRow) { return ASPx.GetChildByTagName(containerRow.parentElement, "TR", 0); },
9097 incLockCount: function(elem) { return this.changeLockCount(elem, 1); },
9098 decLockCount: function(elem) { return this.changeLockCount(elem, -1); },
9099 changeLockCount: function(elem, diff) {
9100  var lockCounter = this.getLockCount(elem);
9101  lockCounter += diff;
9102  lockCounter = Math.max(0, lockCounter);
9103  if(lockCounter === 0)
9104   ASPx.Attr.RemoveAttribute(elem, RIPPLE_FIXED_ROW_ATTR);
9105  else
9106   ASPx.Attr.SetAttribute(elem, RIPPLE_FIXED_ROW_ATTR, lockCounter);
9107  return lockCounter;
9108 },
9109 getLockCount: function(lockElement) {
9110  var attrValue = ASPx.Attr.GetAttribute(lockElement, RIPPLE_FIXED_ROW_ATTR);
9111  return parseInt(attrValue) || 0;
9112 },
9113 assignContainerSettings: function(container, containerRect) {
9114  var properties = {
9115   height: containerRect.height,
9116   width: containerRect.width,
9117   left: ASPx.PrepareClientPosForElement(containerRect.x, container, true),
9118   top: ASPx.PrepareClientPosForElement(containerRect.y, container, false)
9119  };
9120  if(ASPx.Browser.MobileUI)
9121   ASPx.Data.MergeHashTables(properties, {marginTop: 0, marginLeft: 0 });
9122  ASPx.SetStyles(container, properties, ASPx.Browser.MobileUI);
9123 },
9124 IsExternalRipple: function(targetInfo) {
9125  var hasExternalRippleClassName = ASPx.ElementContainsCssClass(targetInfo.getTarget(), this.rippleTargetExternalClassName);
9126  if(!ASPx.Browser.MobileUI)
9127   return hasExternalRippleClassName;
9128  return hasExternalRippleClassName || this.IsMobileExternalRipple(targetInfo);
9129 },
9130 IsMobileExternalRipple: function(targetInfo) {
9131  if(this.isMobileExternalRipple == null) {
9132   var originTouchRadius = this.getOriginTouchRadius();
9133   this.isMobileExternalRipple = ASPx.Browser.MobileUI && targetInfo.width < originTouchRadius && targetInfo.height < originTouchRadius;
9134  }
9135  return this.isMobileExternalRipple;
9136 },
9137 RemoveRippleContainer: function(element) {
9138  if(!element)
9139   return;
9140  var childs = ASPx.GetChildNodesByClassName(element, this.rippleContainerClassName);
9141  var rippleContainer = childs.length > 0 ? childs[0] : null;
9142  if(rippleContainer != null) {
9143   var containerParent = rippleContainer.parentNode;
9144   containerParent.removeChild(rippleContainer);
9145   if(this.isARowInFixedLayoutTable(containerParent))
9146    this.unlockFixedLayoutTableSizes(containerParent);
9147  }
9148 },
9149 getEventX: function(evt) {
9150  return ASPxClientUtils.GetEventX(evt);
9151 },
9152 getEventY: function(evt) {
9153  return ASPxClientUtils.GetEventY(evt);
9154 },
9155 getOriginTouchRadius: function() {
9156  return this.touchRadius / this.zoom;
9157 },
9158 getElementRect: function(element) {
9159  return { x: ASPx.GetAbsoluteX(element), y: ASPx.GetAbsoluteY(element), width: element.offsetWidth, height: element.offsetHeight };
9160 }
9161};
9162var AccessibilitySR = {
9163 AddStringResources: function(stringResourcesObj) {
9164  if(stringResourcesObj) {
9165   for(var key in stringResourcesObj)
9166    if(stringResourcesObj.hasOwnProperty(key))
9167     this[key] = stringResourcesObj[key];
9168  }
9169 }
9170};
9171ASPx.CollectionBase = CollectionBase;
9172ASPx.FunctionIsInCallstack = _aspxFunctionIsInCallstack;
9173ASPx.RaisePostHandlerOnPost = aspxRaisePostHandlerOnPost;
9174ASPx.GetPostHandler = aspxGetPostHandler;
9175ASPx.ProcessScriptsAndLinks = _aspxProcessScriptsAndLinks;
9176ASPx.InitializeLinks = _aspxInitializeLinks;
9177ASPx.InitializeScripts = _aspxInitializeScripts;
9178ASPx.RunStartupScripts = _aspxRunStartupScripts;
9179ASPx.IsStartupScriptsRunning = _aspxIsStartupScriptsRunning;
9180ASPx.AddScriptsRestartHandler = _aspxAddScriptsRestartHandler;
9181ASPx.GetFocusedElement = _aspxGetFocusedElement;
9182ASPx.GetDomObserver = _aspxGetDomObserver;
9183ASPx.CacheHelper = CacheHelper;
9184ASPx.ControlTree = ControlTree;
9185ASPx.ControlAdjuster = ControlAdjuster;
9186ASPx.GetControlAdjuster = GetControlAdjuster;
9187ASPx.ControlCallbackHandlersQueue = ControlCallbackHandlersQueue;
9188ASPx.ResourceManager = ResourceManager;
9189ASPx.UpdateWatcherHelper = UpdateWatcherHelper;
9190ASPx.EventStorage = EventStorage;
9191ASPx.GetGlobalObject = GetGlobalObject;
9192ASPx.GetExternalScriptProcessor = GetExternalScriptProcessor;
9193ASPx.CheckBoxCheckState = CheckBoxCheckState;
9194ASPx.CheckBoxInputKey = CheckBoxInputKey;
9195ASPx.CheckableElementStateController = CheckableElementStateController;
9196ASPx.CheckableElementHelper = CheckableElementHelper;
9197ASPx.CheckBoxInternal = CheckBoxInternal;
9198ASPx.CheckBoxInternalCollection = CheckBoxInternalCollection;
9199ASPx.ControlCallbackQueueHelper = ControlCallbackQueueHelper;
9200ASPx.FocusedStyleDecoration = FocusedStyleDecoration;
9201ASPx.EditorStyleDecoration = EditorStyleDecoration;
9202ASPx.TextEditorStyleDecoration = TextEditorStyleDecoration;
9203ASPx.AccessibilitySR = AccessibilitySR;
9204ASPx.KbdHelper = KbdHelper;
9205ASPx.AccessKeysHelper = AccessKeysHelper;
9206ASPx.AccessKey = AccessKey;
9207ASPx.IFrameHelper = IFrameHelper;
9208ASPx.Ident = Ident;
9209ASPx.TouchUIHelper = TouchUIHelper;
9210ASPx.ControlUpdateWatcher = ControlUpdateWatcher;
9211ASPx.AccessibilityHelperBase = AccessibilityHelperBase;
9212ASPx.RippleHelper = RippleHelper;
9213ASPx.ThemesWithRipple = ThemesWithRipple;
9214window.ASPxClientEvent = ASPxClientEvent;
9215window.ASPxClientEventArgs = ASPxClientEventArgs;
9216window.ASPxClientCancelEventArgs = ASPxClientCancelEventArgs;
9217window.ASPxClientProcessingModeEventArgs = ASPxClientProcessingModeEventArgs;
9218window.ASPxClientProcessingModeCancelEventArgs = ASPxClientProcessingModeCancelEventArgs;
9219ASPx.Evt.AttachEventToDocument(TouchUIHelper.touchMouseDownEventName, RippleHelper.onDocumentMouseDown);
9220ASPx.classesScriptParsed = true;
9221})();
9222
9223(function () {
9224ASPx.StateItemsExist = false;
9225ASPx.FocusedItemKind = "FocusedStateItem";
9226ASPx.HoverItemKind = "HoverStateItem";
9227ASPx.PressedItemKind = "PressedStateItem";
9228ASPx.SelectedItemKind = "SelectedStateItem";
9229ASPx.DisabledItemKind = "DisabledStateItem";
9230ASPx.ReadOnlyItemKind = "ReadOnlyStateItem";
9231ASPx.CachedStatePrefix = "cached";
9232ASPxStateItem = ASPx.CreateClass(null, {
9233 constructor: function(name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, kind, disableApplyingStyleToLink){
9234  this.name = name;
9235  this.classNames = classNames;
9236  this.customClassNames = [];
9237  this.resultClassNames = [];
9238  this.cssTexts = cssTexts;
9239  this.postfixes = postfixes;
9240  this.imageObjs = imageObjs;
9241  this.imagePostfixes = imagePostfixes;
9242  this.kind = kind;
9243  this.classNamePostfix = kind.substr(0, 1).toLowerCase();
9244  this.enabled = true;
9245  this.needRefreshBetweenElements = false;
9246  this.elements = null;
9247  this.images = null;
9248  this.links = [];
9249  this.linkColor = null;
9250  this.linkTextDecoration = null;
9251  this.disableApplyingStyleToLink = !!disableApplyingStyleToLink; 
9252 },
9253 GetCssText: function(index){
9254  if(ASPx.IsExists(this.cssTexts[index]))
9255   return this.cssTexts[index];
9256  return this.cssTexts[0];
9257 },
9258 CreateStyleRule: function(index){
9259  if(this.GetCssText(index) == "") return "";
9260  var styleSheet = ASPx.GetCurrentStyleSheet();
9261  if(styleSheet)
9262   return ASPx.CreateImportantStyleRule(styleSheet, this.GetCssText(index), this.classNamePostfix);  
9263  return ""; 
9264 },
9265 GetClassName: function(index){
9266  if(ASPx.IsExists(this.classNames[index]))
9267   return this.classNames[index];
9268  return this.classNames[0];
9269 },
9270 GetResultClassName: function(index){
9271  if(!ASPx.IsExists(this.resultClassNames[index])) {
9272   if(!ASPx.IsExists(this.customClassNames[index]))
9273    this.customClassNames[index] = this.CreateStyleRule(index);
9274   if(this.GetClassName(index) != "" && this.customClassNames[index] != "")
9275    this.resultClassNames[index] = this.GetClassName(index) + " " + this.customClassNames[index];
9276   else if(this.GetClassName(index) != "")
9277    this.resultClassNames[index] = this.GetClassName(index);
9278   else if(this.customClassNames[index] != "")
9279    this.resultClassNames[index] = this.customClassNames[index];
9280   else
9281    this.resultClassNames[index] = "";
9282  }
9283  return this.resultClassNames[index];
9284 },
9285 GetElements: function(element){
9286  if(!this.elements || !ASPx.IsValidElements(this.elements)){
9287   if(this.postfixes && this.postfixes.length > 0){
9288    this.elements = [ ];
9289    var parentNode = element.parentNode;
9290    if(parentNode){
9291     for(var i = 0; i < this.postfixes.length; i++){
9292      var id = this.name + this.postfixes[i];
9293      this.elements[i] = ASPx.GetChildById(parentNode, id);
9294      if(!this.elements[i])
9295       this.elements[i] = ASPx.GetElementById(id);
9296     }
9297    }
9298   }
9299   else
9300    this.elements = [element];
9301  }
9302  return this.elements;
9303 },
9304 GetImages: function(element){
9305  if(!this.images || !ASPx.IsValidElements(this.images)){
9306   this.images = [ ];
9307   if(this.imagePostfixes && this.imagePostfixes.length > 0){
9308    var elements = this.GetElements(element);
9309    for(var i = 0; i < this.imagePostfixes.length; i++){
9310     var id = this.name + this.imagePostfixes[i];
9311     for(var j = 0; j < elements.length; j++){
9312      if(!elements[j]) continue;
9313      if(elements[j].id == id)
9314       this.images[i] = elements[j];
9315      else
9316       this.images[i] = ASPx.GetChildById(elements[j], id);
9317      if(this.images[i])
9318       break;
9319     }
9320    }
9321   }
9322  }
9323  return this.images;
9324 },
9325 Apply: function(element){
9326  if(!this.enabled) return;
9327  try{
9328   this.ApplyStyle(element);
9329   if(this.imageObjs && this.imageObjs.length > 0)
9330    this.ApplyImage(element);
9331   if(ASPx.Browser.IE && ASPx.Browser.MajorVersion >= 11 && ASPx.Browser.PlaformMajorVersion < 10)
9332    this.ForceRedrawAppearance(element);
9333  }
9334  catch(e){
9335  }
9336 },
9337 ApplyStyle: function(element){
9338  var elements = this.GetElements(element);
9339  for(var i = 0; i < elements.length; i++){
9340   if(!elements[i]) continue;
9341   if(this.GetResultClassName(i) != "") {
9342    var className = elements[i].className.replace(this.GetResultClassName(i), "");
9343    elements[i].className = ASPx.Str.Trim(className) + " " + this.GetResultClassName(i);
9344   }
9345   if(!ASPx.Browser.Opera || ASPx.Browser.Version >= 9)
9346    this.ApplyStyleToLinks(elements, i);
9347  }
9348 },
9349 ApplyStyleToLinks: function(elements, index){
9350  if(this.disableApplyingStyleToLink)
9351   return;
9352  if(!ASPx.IsValidElements(this.links[index]))
9353   this.links[index] = ASPx.GetNodesByTagName(elements[index], "A");
9354  for(var i = 0; i < this.links[index].length; i++)
9355   this.ApplyStyleToLinkElement(this.links[index][i], index);
9356 },
9357 ApplyStyleToLinkElement: function(link, index){
9358  if(this.GetLinkColor(index) != "")
9359   ASPx.Attr.ChangeAttributeExtended(link.style, "color", link, "saved" + this.kind + "Color", this.GetLinkColor(index));
9360  if(this.GetLinkTextDecoration(index) != "")
9361   ASPx.Attr.ChangeAttributeExtended(link.style, "textDecoration", link, "saved" + this.kind + "TextDecoration", this.GetLinkTextDecoration(index));
9362 },
9363 ApplyImage: function(element){
9364  var images = this.GetImages(element);
9365  for(var i = 0; i < images.length; i++){
9366   if(!images[i] || !this.imageObjs[i]) continue;
9367   var useSpriteImage = typeof(this.imageObjs[i]) != "string";
9368   var newUrl = "", newCssClass = "", newBackground = "";
9369   if(useSpriteImage){
9370    newUrl = ASPx.EmptyImageUrl;           
9371    if(this.imageObjs[i].spriteCssClass) 
9372     newCssClass = this.imageObjs[i].spriteCssClass;
9373    if(this.imageObjs[i].spriteBackground)
9374     newBackground = this.imageObjs[i].spriteBackground;
9375   }
9376   else{
9377    newUrl = this.imageObjs[i];
9378    if(ASPx.Attr.IsExistsAttribute(images[i].style, "background"))   
9379     newBackground = " ";
9380   }
9381   if(newUrl != "")
9382    ASPx.Attr.ChangeAttributeExtended(images[i], "src", images[i], "saved" + this.kind + "Src", newUrl);
9383   if(newCssClass != "")
9384    this.ApplyImageClassName(images[i], newCssClass);
9385   if(newBackground != ""){
9386    if(ASPx.Browser.WebKitFamily) {
9387     var savedBackground = ASPx.Attr.GetAttribute(images[i].style, "background");
9388     if(!useSpriteImage)
9389      savedBackground += " " + images[i].style["backgroundPosition"];
9390     ASPx.Attr.SetAttribute(images[i], "saved" + this.kind + "Background", savedBackground);
9391     ASPx.Attr.SetAttribute(images[i].style, "background", newBackground);
9392    }
9393    else
9394     ASPx.Attr.ChangeAttributeExtended(images[i].style, "background", images[i], "saved" + this.kind + "Background", newBackground);
9395   }     
9396  }
9397 },
9398 ApplyImageClassName: function(element, newClassName){
9399  if(ASPx.Attr.GetAttribute(element, "saved" + this.kind + "ClassName"))
9400   this.CancelImageClassName(element);
9401  var className = element.className;
9402  ASPx.Attr.SetAttribute(element, "saved" + this.kind + "ClassName", className);
9403  element.className = className + " " + newClassName;
9404 },
9405 Cancel: function(element){
9406  if(!this.enabled) return;
9407  try{  
9408   if(this.imageObjs && this.imageObjs.length > 0)
9409    this.CancelImage(element);
9410   this.CancelStyle(element);
9411  }
9412  catch(e){
9413  }
9414 },
9415 CancelStyle: function(element){
9416  var elements = this.GetElements(element);
9417  for(var i = 0; i < elements.length; i++){
9418   if(!elements[i]) continue;
9419   if(this.GetResultClassName(i) != "") {
9420    var className = ASPx.Str.Trim(elements[i].className.replace(this.GetResultClassName(i), ""));
9421    elements[i].className = className;
9422   }
9423   if(!ASPx.Browser.Opera || ASPx.Browser.Version >= 9)
9424    this.CancelStyleFromLinks(elements, i);
9425  }
9426 },
9427 CancelStyleFromLinks: function(elements, index){
9428  if(this.disableApplyingStyleToLink)
9429   return;
9430  if(!ASPx.IsValidElements(this.links[index]))
9431   this.links[index] = ASPx.GetNodesByTagName(elements[index], "A");
9432  for(var i = 0; i < this.links[index].length; i++)
9433   this.CancelStyleFromLinkElement(this.links[index][i], index);
9434 },
9435 CancelStyleFromLinkElement: function(link, index){
9436  if(this.GetLinkColor(index) != "")
9437   ASPx.Attr.RestoreAttributeExtended(link.style, "color", link, "saved" + this.kind + "Color");
9438  if(this.GetLinkTextDecoration(index) != "")
9439   ASPx.Attr.RestoreAttributeExtended(link.style, "textDecoration", link, "saved" + this.kind + "TextDecoration");
9440 },
9441 CancelImage: function(element){
9442  var images = this.GetImages(element);
9443  for(var i = 0; i < images.length; i++){
9444   if(!images[i] || !this.imageObjs[i]) continue;
9445   ASPx.Attr.RestoreAttributeExtended(images[i], "src", images[i], "saved" + this.kind + "Src");
9446   this.CancelImageClassName(images[i]);
9447   ASPx.Attr.RestoreAttributeExtended(images[i].style, "background", images[i], "saved" + this.kind + "Background");
9448  }
9449 },
9450 CancelImageClassName: function(element){
9451  var savedClassName = ASPx.Attr.GetAttribute(element, "saved" + this.kind + "ClassName");
9452  if(ASPx.IsExists(savedClassName)) {
9453   element.className = savedClassName;
9454   ASPx.Attr.RemoveAttribute(element, "saved" + this.kind + "ClassName");
9455  }
9456 },
9457 Clone: function(){
9458  return new ASPxStateItem(this.name, this.classNames, this.cssTexts, this.postfixes, 
9459   this.imageObjs, this.imagePostfixes, this.kind, this.disableApplyingStyleToLink);
9460 },
9461 IsChildElement: function(element){
9462  if(element != null){
9463   var elements = this.GetElements(element);
9464   for(var i = 0; i < elements.length; i++){
9465    if(!elements[i]) continue;
9466    if(ASPx.GetIsParent(elements[i], element)) 
9467     return true;
9468   }
9469  }
9470  return false;
9471 },
9472 ForceRedrawAppearance: function(element) {
9473  if(!aspxGetStateController().IsForceRedrawAppearanceLocked()) {
9474   var value = element.style.opacity;
9475   element.style.opacity = "0.7777";
9476   var dummy = element.offsetWidth;
9477   element.style.opacity = value;
9478  }
9479 },
9480 GetLinkColor: function(index){
9481  if(!ASPx.IsExists(this.linkColor)){
9482   var rule = ASPx.GetStyleSheetRules(this.customClassNames[index]);
9483   this.linkColor = rule ? rule.style.color : null;
9484   if(!ASPx.IsExists(this.linkColor)){
9485    var rule = ASPx.GetStyleSheetRules(this.GetClassName(index));
9486    this.linkColor = rule ? rule.style.color : null;
9487   }
9488   if(this.linkColor == null) 
9489    this.linkColor = "";
9490  }
9491  return this.linkColor;
9492 },
9493 GetLinkTextDecoration: function(index){
9494  if(!ASPx.IsExists(this.linkTextDecoration)){
9495   var rule = ASPx.GetStyleSheetRules(this.customClassNames[index]);
9496   this.linkTextDecoration = rule ? rule.style.textDecoration : null;
9497   if(!ASPx.IsExists(this.linkTextDecoration)){
9498    var rule = ASPx.GetStyleSheetRules(this.GetClassName(index));
9499    this.linkTextDecoration = rule ? rule.style.textDecoration : null;
9500   }
9501   if(this.linkTextDecoration == null) 
9502    this.linkTextDecoration = "";
9503  }
9504  return this.linkTextDecoration;
9505 }
9506});
9507ASPxClientStateEventArgs = ASPx.CreateClass(null, {
9508 constructor: function(item, element){
9509  this.item = item;
9510  this.element = element;
9511  this.toElement = null;
9512  this.fromElement = null;
9513  this.htmlEvent = null;
9514 }
9515});
9516ASPxStateController = ASPx.CreateClass(null, {
9517 constructor: function(){
9518  this.focusedItems = { };
9519  this.hoverItems = { };
9520  this.pressedItems = { };
9521  this.selectedItems = { };
9522  this.disabledItems = {};
9523  this.readOnlyItems = {};
9524  this.disabledScheme = {};
9525  this.currentFocusedElement = null;
9526  this.currentFocusedItemName = null;
9527  this.currentHoverElement = null;
9528  this.currentHoverItemName = null;
9529  this.currentPressedElement = null;
9530  this.currentPressedItemName = null;
9531  this.savedCurrentPressedElement = null;
9532  this.savedCurrentMouseMoveSrcElement = null;
9533  this.forceRedrawAppearanceLockCount = 0;
9534  this.AfterSetFocusedState = new ASPxClientEvent();
9535  this.AfterClearFocusedState = new ASPxClientEvent();
9536  this.AfterSetHoverState = new ASPxClientEvent();
9537  this.AfterClearHoverState = new ASPxClientEvent();
9538  this.AfterSetPressedState = new ASPxClientEvent();
9539  this.AfterClearPressedState = new ASPxClientEvent();
9540  this.AfterDisabled = new ASPxClientEvent();
9541  this.AfterEnabled = new ASPxClientEvent();
9542  this.BeforeSetFocusedState = new ASPxClientEvent();
9543  this.BeforeClearFocusedState = new ASPxClientEvent();
9544  this.BeforeSetHoverState = new ASPxClientEvent();
9545  this.BeforeClearHoverState = new ASPxClientEvent();
9546  this.BeforeSetPressedState = new ASPxClientEvent();
9547  this.BeforeClearPressedState = new ASPxClientEvent();
9548  this.BeforeDisabled = new ASPxClientEvent();
9549  this.BeforeEnabled = new ASPxClientEvent();
9550  this.FocusedItemKeyDown = new ASPxClientEvent();
9551 }, 
9552 AddHoverItem: function(name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, disableApplyingStyleToLink){
9553  this.AddItem(this.hoverItems, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, ASPx.HoverItemKind, disableApplyingStyleToLink);
9554  this.AddItem(this.focusedItems, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, ASPx.FocusedItemKind, disableApplyingStyleToLink);
9555 },
9556 AddPressedItem: function(name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, disableApplyingStyleToLink){
9557  this.AddItem(this.pressedItems, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, ASPx.PressedItemKind, disableApplyingStyleToLink);
9558 },
9559 AddSelectedItem: function(name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, disableApplyingStyleToLink){
9560  this.AddItem(this.selectedItems, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, ASPx.SelectedItemKind, disableApplyingStyleToLink);
9561 },
9562 AddDisabledItem: function (name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, disableApplyingStyleToLink, rootId) {
9563  this.AddItem(this.disabledItems, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes,
9564   ASPx.DisabledItemKind, disableApplyingStyleToLink, this.addIdToDisabledItemScheme, rootId);
9565 },
9566 AddReadOnlyItem: function(name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, disableApplyingStyleToLink) {
9567  this.AddItem(this.readOnlyItems, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, ASPx.ReadOnlyItemKind, disableApplyingStyleToLink);
9568 },
9569 addIdToDisabledItemScheme: function(rootId, childId) {
9570  if (!rootId)
9571   return;
9572  if (!this.disabledScheme[rootId])
9573   this.disabledScheme[rootId] = [rootId];
9574  if (childId && (rootId != childId) && ASPx.Data.ArrayIndexOf(this.disabledScheme[rootId], childId) == -1)
9575   this.disabledScheme[rootId].push(childId);
9576 },
9577 removeIdFromDisabledItemScheme: function(rootId, childId) {
9578  if (!rootId || !this.disabledScheme[rootId])
9579   return;
9580  ASPx.Data.ArrayRemove(this.disabledScheme[rootId], childId);
9581  if (this.disabledScheme[rootId].length == 0)
9582   delete this.disabledScheme[rootId];
9583 },
9584 AddItem: function (items, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, kind, disableApplyingStyleToLink, onAdd, rootId) {
9585  var stateItem = new ASPxStateItem(name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, kind, disableApplyingStyleToLink);
9586  if (postfixes && postfixes.length > 0) {
9587   for (var i = 0; i < postfixes.length; i++) {
9588    items[name + postfixes[i]] = stateItem;
9589    if (onAdd)
9590     onAdd.call(this, rootId, name + postfixes[i]);
9591   }
9592  }
9593  else {
9594   if (onAdd)
9595    onAdd.call(this, rootId, name);
9596   items[name] = stateItem;
9597  }
9598  ASPx.StateItemsExist = true;
9599 },
9600 RemoveHoverItem: function(name, postfixes){
9601  this.RemoveItem(this.hoverItems, name, postfixes);
9602  this.RemoveItem(this.focusedItems, name, postfixes);
9603 },
9604 RemovePressedItem: function(name, postfixes){
9605  this.RemoveItem(this.pressedItems, name, postfixes);
9606 },
9607 RemoveSelectedItem: function(name, postfixes){
9608  this.RemoveItem(this.selectedItems, name, postfixes);
9609 },
9610 RemoveDisabledItem: function (name, postfixes, rootId) {
9611  this.RemoveItem(this.disabledItems, name, postfixes, this.removeIdFromDisabledItemScheme, rootId);
9612 },
9613 RemoveReadOnlyItem: function(name, postfixes) {
9614  this.RemoveItem(this.readOnlyItems, name, postfixes);
9615 },
9616 RemoveItem: function (items, name, postfixes, onRemove, rootId) {
9617  if (postfixes && postfixes.length > 0) {
9618   for (var i = 0; i < postfixes.length; i++) {
9619    delete items[name + postfixes[i]];
9620    if (onRemove)
9621     onRemove.call(this, rootId, name + postfixes[i]);
9622   }
9623  }
9624  else {
9625   delete items[name];
9626   if (onRemove)
9627    onRemove.call(this, rootId, name);
9628  }
9629 },
9630 RemoveDisposedItems: function(){
9631  this.RemoveDisposedItemsByType(this.hoverItems);
9632  this.RemoveDisposedItemsByType(this.pressedItems);
9633  this.RemoveDisposedItemsByType(this.focusedItems);
9634  this.RemoveDisposedItemsByType(this.selectedItems);
9635  this.RemoveDisposedItemsByType(this.disabledItems);
9636  this.RemoveDisposedItemsByType(this.disabledScheme);
9637  this.RemoveDisposedItemsByType(this.readOnlyItems);
9638 },
9639 RemoveDisposedItemsByType: function(items){
9640  for(var key in items) {
9641   if(items.hasOwnProperty(key)) {
9642    var item = items[key];
9643    var element = document.getElementById(key);
9644    if(!element || !ASPx.IsValidElement(element))
9645     delete items[key];
9646    try {
9647     if(item && item.elements) {
9648      for(var i = 0; i < item.elements.length; i++) {
9649       if(!ASPx.IsValidElements(item.links[i]))
9650        item.links[i] = null;
9651      }
9652     }
9653    }
9654    catch(e) {
9655    }
9656   }
9657  }
9658 },
9659 GetFocusedElement: function(srcElement){
9660  return this.GetItemElement(srcElement, this.focusedItems, ASPx.FocusedItemKind);
9661 },
9662 GetHoverElement: function(srcElement){
9663  return this.GetItemElement(srcElement, this.hoverItems, ASPx.HoverItemKind);
9664 },
9665 GetPressedElement: function(srcElement){
9666  return this.GetItemElement(srcElement, this.pressedItems, ASPx.PressedItemKind);
9667 },
9668 GetSelectedElement: function(srcElement){
9669  return this.GetItemElement(srcElement, this.selectedItems, ASPx.SelectedItemKind);
9670 },
9671 GetDisabledElement: function(srcElement){
9672  return this.GetItemElement(srcElement, this.disabledItems, ASPx.DisabledItemKind);
9673 },
9674 GetReadOnlyElement: function(srcElement) {
9675  return this.GetItemElement(srcElement, this.readOnlyItems, ASPx.ReadOnlyItemKind);
9676 },
9677 GetItemElement: function(srcElement, items, kind){
9678  if(srcElement && srcElement[ASPx.CachedStatePrefix + kind]){
9679   var cachedElement = srcElement[ASPx.CachedStatePrefix + kind];
9680   if(cachedElement != ASPx.EmptyObject)
9681    return cachedElement;
9682   return null;
9683  }
9684  var element = srcElement;
9685  while(element != null) {
9686   var item = items[element.id];
9687   if(item){
9688    this.CacheItemElement(srcElement, kind, element);
9689    element[kind] = item;
9690    return element;
9691   }
9692   element = element.parentNode;
9693  }
9694  this.CacheItemElement(srcElement, kind, ASPx.EmptyObject);
9695  return null;
9696 },
9697 CacheItemElement: function(srcElement, kind, value){
9698  if(srcElement && !srcElement[ASPx.CachedStatePrefix + kind])
9699   srcElement[ASPx.CachedStatePrefix + kind] = value;
9700 },
9701 DoSetFocusedState: function(element, fromElement){
9702  var item = element[ASPx.FocusedItemKind];
9703  if(item){
9704   var args = new ASPxClientStateEventArgs(item, element);
9705   args.fromElement = fromElement;
9706   this.BeforeSetFocusedState.FireEvent(this, args);
9707   item.Apply(element);
9708   this.AfterSetFocusedState.FireEvent(this, args);
9709  }
9710 },
9711 DoClearFocusedState: function(element, toElement){
9712  var item = element[ASPx.FocusedItemKind];
9713  if(item){
9714   var args = new ASPxClientStateEventArgs(item, element);
9715   args.toElement = toElement;
9716   this.BeforeClearFocusedState.FireEvent(this, args);
9717   item.Cancel(element);
9718   this.AfterClearFocusedState.FireEvent(this, args);
9719  }
9720 },
9721 DoSetHoverState: function(element, fromElement){
9722  var item = element[ASPx.HoverItemKind];
9723  if(item){
9724   var args = new ASPxClientStateEventArgs(item, element);
9725   args.fromElement = fromElement;
9726   this.BeforeSetHoverState.FireEvent(this, args);
9727   item.Apply(element);
9728   this.AfterSetHoverState.FireEvent(this, args);
9729  }
9730 },
9731 DoClearHoverState: function(element, toElement){
9732  var item = element[ASPx.HoverItemKind];
9733  if(item){
9734   var args = new ASPxClientStateEventArgs(item, element);
9735   args.toElement = toElement;
9736   this.BeforeClearHoverState.FireEvent(this, args);
9737   item.Cancel(element);
9738   this.AfterClearHoverState.FireEvent(this, args);
9739  }
9740 },
9741 DoSetPressedState: function(element){
9742  var item = element[ASPx.PressedItemKind];
9743  if(item){
9744   var args = new ASPxClientStateEventArgs(item, element);
9745   this.BeforeSetPressedState.FireEvent(this, args);
9746   item.Apply(element);
9747   this.AfterSetPressedState.FireEvent(this, args);
9748  }
9749 },
9750 DoClearPressedState: function(element){
9751  var item = element[ASPx.PressedItemKind];
9752  if(item){
9753   var args = new ASPxClientStateEventArgs(item, element);
9754   this.BeforeClearPressedState.FireEvent(this, args);
9755   item.Cancel(element);
9756   this.AfterClearPressedState.FireEvent(this, args);
9757  }
9758 },
9759 SetCurrentFocusedElement: function(element){
9760  if(this.currentFocusedElement && !ASPx.IsValidElement(this.currentFocusedElement)){
9761   this.currentFocusedElement = null;
9762   this.currentFocusedItemName = "";
9763  }
9764  if(this.currentFocusedElement != element){
9765   var oldCurrentFocusedElement = this.currentFocusedElement;
9766   var item = (element != null) ? element[ASPx.FocusedItemKind] : null;
9767   var itemName = (item != null) ? item.name : "";
9768   if(this.currentFocusedItemName != itemName){
9769    if(this.currentHoverItemName != "")
9770     this.SetCurrentHoverElement(null);
9771    if(this.currentFocusedElement != null)
9772     this.DoClearFocusedState(this.currentFocusedElement, element);
9773    this.currentFocusedElement = element;
9774    item = (element != null) ? element[ASPx.FocusedItemKind] : null;
9775    this.currentFocusedItemName = (item != null) ? item.name : "";
9776    if(this.currentFocusedElement != null)
9777     this.DoSetFocusedState(this.currentFocusedElement, oldCurrentFocusedElement);
9778   }
9779  }
9780 },
9781 SetCurrentHoverElement: function(element){
9782  if(this.currentHoverElement && !ASPx.IsValidElement(this.currentHoverElement)){
9783   this.currentHoverElement = null;
9784   this.currentHoverItemName = "";
9785  }
9786  var item = (element != null) ? element[ASPx.HoverItemKind] : null;
9787  if(item && !item.enabled) { 
9788   element = this.GetItemElement(element.parentNode, this.hoverItems, ASPx.HoverItemKind);
9789   item = (element != null) ? element[ASPx.HoverItemKind] : null;
9790  }
9791  if(this.currentHoverElement != element){
9792   var oldCurrentHoverElement = this.currentHoverElement,
9793    itemName = (item != null) ? item.name : "";
9794   if(this.currentHoverItemName != itemName || (item != null && item.needRefreshBetweenElements)){
9795    if(this.currentHoverElement != null)
9796     this.DoClearHoverState(this.currentHoverElement, element);
9797    item = (element != null) ? element[ASPx.HoverItemKind] : null;
9798    if(item == null || item.enabled){
9799     this.currentHoverElement = element;
9800     this.currentHoverItemName = (item != null) ? item.name : "";
9801     if(this.currentHoverElement != null)
9802      this.DoSetHoverState(this.currentHoverElement, oldCurrentHoverElement);
9803    }
9804   }
9805  }
9806 },
9807 SetCurrentPressedElement: function(element){
9808  if(this.currentPressedElement && !ASPx.IsValidElement(this.currentPressedElement)){
9809   this.currentPressedElement = null;
9810   this.currentPressedItemName = "";
9811  }
9812  if(this.currentPressedElement != element){
9813   if(this.currentPressedElement != null)
9814    this.DoClearPressedState(this.currentPressedElement);
9815   var item = (element != null) ? element[ASPx.PressedItemKind] : null;
9816   if(item == null || item.enabled){
9817    this.currentPressedElement = element;
9818    this.currentPressedItemName = (item != null) ? item.name : "";
9819    if(this.currentPressedElement != null)
9820     this.DoSetPressedState(this.currentPressedElement);
9821   }
9822  }
9823 },
9824 SetCurrentFocusedElementBySrcElement: function(srcElement){
9825  var element = this.GetFocusedElement(srcElement);
9826  this.SetCurrentFocusedElement(element);
9827 },
9828 SetCurrentHoverElementBySrcElement: function(srcElement){
9829  var element = this.GetHoverElement(srcElement);
9830  this.SetCurrentHoverElement(element);
9831 },
9832 SetCurrentPressedElementBySrcElement: function(srcElement){
9833  var element = this.GetPressedElement(srcElement);
9834  this.SetCurrentPressedElement(element);
9835 },
9836 SetPressedElement: function (element) {
9837  this.SetCurrentHoverElement(null);
9838  this.SetCurrentPressedElementBySrcElement(element);
9839  this.savedCurrentPressedElement = this.currentPressedElement;
9840 },
9841 SelectElement: function (element) {
9842  var item = element[ASPx.SelectedItemKind];
9843  if(item)
9844   item.Apply(element);
9845 }, 
9846 SelectElementBySrcElement: function(srcElement){
9847  var element = this.GetSelectedElement(srcElement);
9848  if(element != null) this.SelectElement(element);
9849 }, 
9850 DeselectElement: function(element){
9851  var item = element[ASPx.SelectedItemKind];
9852  if(item)
9853   item.Cancel(element);
9854 }, 
9855 DeselectElementBySrcElement: function(srcElement){
9856  var element = this.GetSelectedElement(srcElement);
9857  if(element != null) this.DeselectElement(element);
9858 },
9859 SetElementEnabled: function(element, enable){
9860  if(enable)
9861   this.EnableElement(element);
9862  else
9863   this.DisableElement(element);
9864 },
9865 SetElementReadOnly: function(element, readOnly) {
9866  var element = this.GetReadOnlyElement(element);
9867  if (element != null) {
9868   var item = element[ASPx.ReadOnlyItemKind];
9869   if(item) {
9870    if(readOnly) {
9871     if(item.name == this.currentPressedItemName)
9872      this.SetCurrentPressedElement(null);
9873     if(item.name == this.currentHoverItemName)
9874      this.SetCurrentHoverElement(null);
9875    }
9876    if(readOnly)
9877     item.Apply(element);
9878    else
9879     item.Cancel(element);
9880   }
9881  }
9882 },
9883 SetElementWithChildNodesEnabled: function (parentName, enabled) {
9884  var procFunct = (enabled ? this.EnableElement : this.DisableElement);
9885  var childItems = this.disabledScheme[parentName];
9886  if (childItems && childItems.length > 0)
9887   for (var i = 0; i < childItems.length; i++) {
9888    procFunct.call(this, document.getElementById(childItems[i]));
9889   }
9890 },
9891 DisableElement: function (element) {
9892  var element = this.GetDisabledElement(element);
9893  if(element != null) {
9894   var item = element[ASPx.DisabledItemKind];
9895   if(item){
9896    var args = new ASPxClientStateEventArgs(item, element);
9897    this.BeforeDisabled.FireEvent(this, args);
9898    if(item.name == this.currentPressedItemName)
9899     this.SetCurrentPressedElement(null);
9900    if(item.name == this.currentHoverItemName)
9901     this.SetCurrentHoverElement(null);
9902    item.Apply(element);
9903    this.SetMouseStateItemsEnabled(item.name, item.postfixes, false);
9904    this.AfterDisabled.FireEvent(this, args);
9905   }
9906  }
9907 }, 
9908 EnableElement: function(element){
9909  var element = this.GetDisabledElement(element);
9910  if(element != null) {
9911   var item = element[ASPx.DisabledItemKind];
9912   if(item){
9913    var args = new ASPxClientStateEventArgs(item, element);
9914    this.BeforeEnabled.FireEvent(this, args);
9915    item.Cancel(element);
9916    this.SetMouseStateItemsEnabled(item.name, item.postfixes, true);
9917    this.AfterEnabled.FireEvent(this, args);
9918   }
9919  }
9920 }, 
9921 SetMouseStateItemsEnabled: function(name, postfixes, enabled){   
9922  if(postfixes && postfixes.length > 0){
9923   for(var i = 0; i < postfixes.length; i ++){
9924    this.SetItemsEnabled(this.hoverItems, name + postfixes[i], enabled);
9925    this.SetItemsEnabled(this.pressedItems, name + postfixes[i], enabled);
9926    this.SetItemsEnabled(this.focusedItems, name + postfixes[i], enabled);
9927   }
9928  }
9929  else{
9930   this.SetItemsEnabled(this.hoverItems, name, enabled);
9931   this.SetItemsEnabled(this.pressedItems, name, enabled);
9932   this.SetItemsEnabled(this.focusedItems, name, enabled);
9933  }  
9934 },
9935 SetItemsEnabled: function(items, name, enabled){   
9936  if(items[name])
9937   items[name].enabled = enabled;
9938 },
9939 OnFocusMove: function(evt){
9940  var element = ASPx.Evt.GetEventSource(evt);
9941  aspxGetStateController().SetCurrentFocusedElementBySrcElement(element);
9942 },
9943 OnMouseMove: function(evt, checkElementChanged){
9944  var srcElement = ASPx.Evt.GetEventSource(evt);
9945  if(checkElementChanged && srcElement == this.savedCurrentMouseMoveSrcElement) return;
9946  this.savedCurrentMouseMoveSrcElement = srcElement;
9947  if(ASPx.Browser.IE && !ASPx.Evt.IsLeftButtonPressed(evt) && this.savedCurrentPressedElement != null)
9948   this.ClearSavedCurrentPressedElement();
9949  if(this.savedCurrentPressedElement == null)
9950   this.SetCurrentHoverElementBySrcElement(srcElement);
9951  else{
9952   var element = this.GetPressedElement(srcElement);
9953   if(element != this.currentPressedElement){
9954    if(element == this.savedCurrentPressedElement)
9955     this.SetCurrentPressedElement(this.savedCurrentPressedElement);
9956    else
9957     this.SetCurrentPressedElement(null);
9958   }
9959  }
9960 },
9961 OnMouseDown: function(evt){
9962  if(!ASPx.Evt.IsLeftButtonPressed(evt)) return;
9963  var srcElement = ASPx.Evt.GetEventSource(evt);
9964  this.OnMouseDownOnElement(srcElement);
9965 },
9966 OnMouseDownOnElement: function (element) {
9967  if(this.GetPressedElement(element) == null) return;
9968  this.SetPressedElement(element);
9969 },
9970 OnMouseUp: function(evt){
9971  var srcElement = ASPx.Evt.GetEventSource(evt);
9972  this.OnMouseUpOnElement(srcElement);
9973 },
9974 OnMouseUpOnElement: function(element){
9975  if(this.savedCurrentPressedElement == null) return;
9976  this.ClearSavedCurrentPressedElement();
9977  this.SetCurrentHoverElementBySrcElement(element);
9978 },
9979 OnMouseOver: function(evt){
9980  var element = ASPx.Evt.GetEventSource(evt);
9981  if(element && element.tagName == "IFRAME")
9982   this.OnMouseMove(evt, true);
9983 },
9984 OnKeyDown: function(evt){
9985  var element = this.GetFocusedElement(ASPx.Evt.GetEventSource(evt));
9986  if(element != null && element == this.currentFocusedElement) {
9987   var item = element[ASPx.FocusedItemKind];
9988   if(item){
9989    var args = new ASPxClientStateEventArgs(item, element);
9990    args.htmlEvent = evt;
9991    this.FocusedItemKeyDown.FireEvent(this, args);
9992   }
9993  }
9994 },
9995 OnKeyUpOnElement: function(evt) {
9996  if(this.savedCurrentPressedElement != null && ASPx.Evt.IsActionKeyPressed(evt))
9997   this.ClearSavedCurrentPressedElement();
9998 },
9999 OnSelectStart: function(evt){
10000  if(this.savedCurrentPressedElement) {
10001   ASPx.Selection.Clear();
10002   return false;
10003  }
10004 },
10005 ClearSavedCurrentPressedElement: function() {
10006  this.savedCurrentPressedElement = null;
10007  this.SetCurrentPressedElement(null);
10008 },
10009 ClearCache: function(srcElement, kind) {
10010  if(srcElement[ASPx.CachedStatePrefix + kind])
10011   srcElement[ASPx.CachedStatePrefix + kind] = null;
10012 },
10013 ClearElementCache: function(srcElement) {
10014  this.ClearCache(srcElement, ASPx.FocusedItemKind);
10015  this.ClearCache(srcElement, ASPx.HoverItemKind);
10016  this.ClearCache(srcElement, ASPx.PressedItemKind);
10017  this.ClearCache(srcElement, ASPx.SelectedItemKind);
10018  this.ClearCache(srcElement, ASPx.DisabledItemKind);
10019 },
10020 LockForceRedrawAppearance: function() {
10021  this.forceRedrawAppearanceLockCount++;
10022 },
10023 UnlockForceRedrawAppearance: function() {
10024  this.forceRedrawAppearanceLockCount--;
10025 },
10026 IsForceRedrawAppearanceLocked: function() {
10027  return this.forceRedrawAppearanceLockCount > 0;
10028 }
10029});
10030var stateController = null;
10031function aspxGetStateController(){
10032 if(stateController == null)
10033  stateController = new ASPxStateController();
10034 return stateController;
10035}
10036function aspxAddStateItems(method, namePrefix, classes, disableApplyingStyleToLink){
10037 for(var i = 0; i < classes.length; i ++){
10038  for(var j = 0; j < classes[i][2].length; j ++) {
10039   var name = namePrefix;
10040   if(classes[i][2][j])
10041    name += "_" + classes[i][2][j];
10042   var postfixes = classes[i][3] || null;
10043   var imageObjs = (classes[i][4] && classes[i][4][j]) || null;
10044   var imagePostfixes = classes[i][5] || null;
10045   method.call(aspxGetStateController(), name, classes[i][0], classes[i][1], postfixes, imageObjs, imagePostfixes, disableApplyingStyleToLink, namePrefix);
10046  }
10047 }
10048}
10049ASPx.AddHoverItems = function(namePrefix, classes, disableApplyingStyleToLink){
10050 aspxAddStateItems(aspxGetStateController().AddHoverItem, namePrefix, classes, disableApplyingStyleToLink);
10051};
10052ASPx.AddPressedItems = function(namePrefix, classes, disableApplyingStyleToLink){
10053 aspxAddStateItems(aspxGetStateController().AddPressedItem, namePrefix, classes, disableApplyingStyleToLink);
10054};
10055ASPx.AddSelectedItems = function(namePrefix, classes, disableApplyingStyleToLink){
10056 aspxAddStateItems(aspxGetStateController().AddSelectedItem, namePrefix, classes, disableApplyingStyleToLink);
10057};
10058ASPx.AddDisabledItems = function(namePrefix, classes, disableApplyingStyleToLink){
10059 aspxAddStateItems(aspxGetStateController().AddDisabledItem, namePrefix, classes, disableApplyingStyleToLink);
10060};
10061ASPx.AddReadOnlyItems = function(namePrefix, classes, disableApplyingStyleToLink) {
10062 aspxAddStateItems(aspxGetStateController().AddReadOnlyItem, namePrefix, classes, disableApplyingStyleToLink);
10063};
10064function aspxRemoveStateItems(method, namePrefix, classes){
10065 for(var i = 0; i < classes.length; i ++){
10066  for(var j = 0; j < classes[i][0].length; j ++) {
10067   var name = namePrefix;
10068   if(classes[i][0][j])
10069    name += "_" + classes[i][0][j];
10070   method.call(aspxGetStateController(), name, classes[i][1], namePrefix);
10071  }
10072 }
10073}
10074ASPx.RemoveHoverItems = function(namePrefix, classes){
10075 aspxRemoveStateItems(aspxGetStateController().RemoveHoverItem, namePrefix, classes);
10076};
10077ASPx.RemovePressedItems = function(namePrefix, classes){
10078 aspxRemoveStateItems(aspxGetStateController().RemovePressedItem, namePrefix, classes);
10079};
10080ASPx.RemoveSelectedItems = function(namePrefix, classes){
10081 aspxRemoveStateItems(aspxGetStateController().RemoveSelectedItem, namePrefix, classes);
10082};
10083ASPx.RemoveDisabledItems = function(namePrefix, classes){
10084 aspxRemoveStateItems(aspxGetStateController().RemoveDisabledItem, namePrefix, classes);
10085};
10086ASPx.RemoveReadOnlyItems = function(namePrefix, classes) {
10087 aspxRemoveStateItems(aspxGetStateController().RemoveReadOnlyItem, namePrefix, classes);
10088};
10089ASPx.AddAfterClearFocusedState = function(handler){
10090 aspxGetStateController().AfterClearFocusedState.AddHandler(handler);
10091};
10092ASPx.AddAfterSetFocusedState = function(handler){
10093 aspxGetStateController().AfterSetFocusedState.AddHandler(handler);
10094};
10095ASPx.AddAfterClearHoverState = function(handler){
10096 aspxGetStateController().AfterClearHoverState.AddHandler(handler);
10097};
10098ASPx.AddAfterSetHoverState = function(handler){
10099 aspxGetStateController().AfterSetHoverState.AddHandler(handler);
10100};
10101ASPx.AddAfterClearPressedState = function(handler){
10102 aspxGetStateController().AfterClearPressedState.AddHandler(handler);
10103};
10104ASPx.AddAfterSetPressedState = function(handler){
10105 aspxGetStateController().AfterSetPressedState.AddHandler(handler);
10106};
10107ASPx.AddAfterDisabled = function(handler){
10108 aspxGetStateController().AfterDisabled.AddHandler(handler);
10109};
10110ASPx.AddAfterEnabled = function(handler){
10111 aspxGetStateController().AfterEnabled.AddHandler(handler);
10112};
10113ASPx.AddBeforeClearFocusedState = function(handler){
10114 aspxGetStateController().BeforeClearFocusedState.AddHandler(handler);
10115};
10116ASPx.AddBeforeSetFocusedState = function(handler){
10117 aspxGetStateController().BeforeSetFocusedState.AddHandler(handler);
10118};
10119ASPx.AddBeforeClearHoverState = function(handler){
10120 aspxGetStateController().BeforeClearHoverState.AddHandler(handler);
10121};
10122ASPx.AddBeforeSetHoverState = function(handler){
10123 aspxGetStateController().BeforeSetHoverState.AddHandler(handler);
10124};
10125ASPx.AddBeforeClearPressedState = function(handler){
10126 aspxGetStateController().BeforeClearPressedState.AddHandler(handler);
10127};
10128ASPx.AddBeforeSetPressedState = function(handler){
10129 aspxGetStateController().BeforeSetPressedState.AddHandler(handler);
10130};
10131ASPx.AddBeforeDisabled = function(handler){
10132 aspxGetStateController().BeforeDisabled.AddHandler(handler);
10133};
10134ASPx.AddBeforeEnabled = function(handler){
10135 aspxGetStateController().BeforeEnabled.AddHandler(handler);
10136};
10137ASPx.AddFocusedItemKeyDown = function(handler){
10138 aspxGetStateController().FocusedItemKeyDown.AddHandler(handler);
10139};
10140ASPx.SetHoverState = function(element){
10141 aspxGetStateController().SetCurrentHoverElementBySrcElement(element);
10142};
10143ASPx.ClearHoverState = function(evt){
10144 aspxGetStateController().SetCurrentHoverElementBySrcElement(null);
10145};
10146ASPx.UpdateHoverState = function(evt){
10147 aspxGetStateController().OnMouseMove(evt, false);
10148};
10149ASPx.SetFocusedState = function(element){
10150 aspxGetStateController().SetCurrentFocusedElementBySrcElement(element);
10151};
10152ASPx.ClearFocusedState = function(evt){
10153 aspxGetStateController().SetCurrentFocusedElementBySrcElement(null);
10154};
10155ASPx.UpdateFocusedState = function(evt){
10156 aspxGetStateController().OnFocusMove(evt);
10157};
10158ASPx.AccessibilityMarkerClass = "dxalink";
10159ASPx.AssignAccessibilityEventsToChildrenLinks = function(container, clearFocusedStateOnMouseOut){
10160 var links = ASPx.GetNodesByPartialClassName(container, ASPx.AccessibilityMarkerClass);
10161 for(var i = 0; i < links.length; i++)
10162  ASPx.AssignAccessibilityEventsToLink(links[i], clearFocusedStateOnMouseOut);
10163};
10164ASPx.AssignAccessibilityEventsToLink = function(link, clearFocusedStateOnMouseOut) {
10165 if(!ASPx.ElementContainsCssClass(link, ASPx.AccessibilityMarkerClass))
10166  return;
10167 ASPx.AssignAccessibilityEventsToLinkCore(link, clearFocusedStateOnMouseOut);
10168};
10169ASPx.AssignAccessibilityEventsToLinkCore = function (link, clearFocusedStateOnMouseOut) {
10170 ASPx.Evt.AttachEventToElement(link, "focus", function (e) { ASPx.UpdateFocusedState(e); });
10171 var clearFocusedStateHandler = function (e) { ASPx.ClearFocusedState(e); };
10172 ASPx.Evt.AttachEventToElement(link, "blur", clearFocusedStateHandler);
10173 if(clearFocusedStateOnMouseOut)
10174  ASPx.Evt.AttachEventToElement(link, "mouseout", clearFocusedStateHandler);
10175};
10176ASPx.Evt.AttachEventToDocument("mousemove", function(evt) {
10177 if(ASPx.classesScriptParsed && ASPx.StateItemsExist)
10178  aspxGetStateController().OnMouseMove(evt, true);
10179});
10180ASPx.Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseDownEventName, function(evt) {
10181 if(ASPx.classesScriptParsed && ASPx.StateItemsExist)
10182  aspxGetStateController().OnMouseDown(evt);
10183});
10184ASPx.Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseUpEventName, function(evt) {
10185 if(ASPx.classesScriptParsed && ASPx.StateItemsExist)
10186  aspxGetStateController().OnMouseUp(evt);
10187});
10188ASPx.Evt.AttachEventToDocument("mouseover", function(evt) {
10189 if(ASPx.classesScriptParsed && ASPx.StateItemsExist)
10190  aspxGetStateController().OnMouseOver(evt);
10191});
10192ASPx.Evt.AttachEventToDocument("keydown", function(evt) {
10193 if(ASPx.classesScriptParsed && ASPx.StateItemsExist)
10194  aspxGetStateController().OnKeyDown(evt);
10195});
10196ASPx.Evt.AttachEventToDocument("selectstart", function(evt) {
10197 if(ASPx.classesScriptParsed && ASPx.StateItemsExist)
10198  return aspxGetStateController().OnSelectStart(evt);
10199});
10200ASPx.GetStateController = aspxGetStateController;
10201})();
10202(function () {
10203 var ASPx = window.ASPx || {};
10204 ASPx.ASPxImageLoad = {};
10205 ASPx.ASPxImageLoad.dxDefaultLoadingImageCssClass = "dxe-loadingImage";
10206 ASPx.ASPxImageLoad.dxDefaultLoadingImageCssClassRegexp = new RegExp("dx\\w+-loadingImage");
10207 ASPx.ASPxImageLoad.OnLoad = function (image, customLoadingImage, isOldIE, customBackgroun
10207dImageUrl) {
10208  image.dxCustomBackgroundImageUrl = "";
10209  image.dxShowLoadingImage = true;
10210  image.dxCustomLoadingImage = customLoadingImage;
10211  if (customBackgroundImageUrl != "")
10212   image.dxCustomBackgroundImageUrl = "url('" + customBackgroundImageUrl + "')";
10213  ASPx.ASPxImageLoad.prepareImageBackground(image, isOldIE);
10214  ASPx.ASPxImageLoad.removeHandlers(image);
10215  image.className = image.className.replace(ASPx.ASPxImageLoad.dxDefaultLoadingImageCssClassRegexp, "");
10216 };
10217 ASPx.ASPxImageLoad.removeASPxImageBackground = function (image, isOldIE) {
10218  if (isOldIE) 
10219   image.style.removeAttribute("background-image");
10220  else 
10221   image.style.backgroundImage = "";
10222 };
10223 ASPx.ASPxImageLoad.prepareImageBackground = function (image, isOldIE) {
10224  ASPx.ASPxImageLoad.removeASPxImageBackground(image, isOldIE);
10225  if (image.dxCustomBackgroundImageUrl != "")
10226   image.style.backgroundImage = image.dxCustomBackgroundImageUrl;
10227 };
10228 ASPx.ASPxImageLoad.removeHandlers = function (image) {
10229  image.removeAttribute("onload");
10230  image.removeAttribute("onabort");
10231  image.removeAttribute("onerror");
10232 };
10233 window.ASPx = ASPx;
10234})();
10235(function () {
10236var ASPxClientBeginCallbackEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
10237 constructor: function(command){
10238  this.constructor.prototype.constructor.call(this);
10239  this.command = command;
10240 }
10241});
10242var ASPxClientGlobalBeginCallbackEventArgs = ASPx.CreateClass(ASPxClientBeginCallbackEventArgs, {
10243 constructor: function(control, command){
10244  this.constructor.prototype.constructor.call(this, command);
10245  this.control = control;
10246 }
10247});
10248var ASPxClientEndCallbackEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
10249 constructor: function(){
10250  this.constructor.prototype.constructor.call(this);
10251 }
10252});
10253var ASPxClientGlobalEndCallbackEventArgs = ASPx.CreateClass(ASPxClientEndCallbackEventArgs, {
10254 constructor: function(control){
10255  this.constructor.prototype.constructor.call(this);
10256  this.control = control;
10257 }
10258});
10259var ASPxClientCustomDataCallbackEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
10260 constructor: function(result) {
10261  this.constructor.prototype.constructor.call(this);
10262  this.result = result;
10263 }
10264});
10265var ASPxClientCallbackErrorEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
10266 constructor: function (message, callbackId) {
10267  this.constructor.prototype.constructor.call(this);
10268  this.message = message;
10269  this.handled = false;
10270  this.callbackId = callbackId;
10271 }
10272});
10273var ASPxClientGlobalCallbackErrorEventArgs = ASPx.CreateClass(ASPxClientCallbackErrorEventArgs, {
10274 constructor: function (control, message, callbackId) {
10275  this.constructor.prototype.constructor.call(this, message, callbackId);
10276  this.control = control;
10277 }
10278});
10279var ASPxClientValidationCompletedEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
10280 constructor: function (container, validationGroup, invisibleControlsValidated, isValid, firstInvalidControl, firstVisibleInvalidControl) {
10281  this.constructor.prototype.constructor.call(this);
10282  this.container = container;
10283  this.validationGroup = validationGroup;
10284  this.invisibleControlsValidated = invisibleControlsValidated;
10285  this.isValid = isValid;
10286  this.firstInvalidControl = firstInvalidControl;
10287  this.firstVisibleInvalidControl = firstVisibleInvalidControl;
10288 }
10289});
10290var ASPxClientControlsInitializedEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
10291 constructor: function(isCallback) {
10292  this.isCallback = isCallback;
10293 }
10294});
10295var ASPxClientControlBeforePronounceEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
10296 constructor: function(messageParts, control){
10297  this.constructor.prototype.constructor.call(this);
10298  this.messageParts = messageParts;
10299  this.control = control;
10300 }
10301});
10302var ASPxClientControlUnloadEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
10303 constructor: function(control){
10304  this.constructor.prototype.constructor.call(this);
10305  this.control = control;
10306 }
10307});
10308var BeforeInitCallbackEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
10309 constructor: function(callbackOwnerID){
10310  this.constructor.prototype.constructor.call(this);
10311  this.callbackOwnerID = callbackOwnerID;
10312 }
10313});
10314ASPx.createControl = function(type, name, windowName, properties, events, setupMethod, data){
10315 var globalName = windowName && windowName.length > 0 ? windowName : name;
10316 var dxo = new type(name);
10317 var haveWrapper = ASPx.Platform === "NETCORE" && dxo.createWrapper && !DevExpress.AspNetCore.Internal.BackwardCompatibility.useLegacyClientAPI;
10318 if(haveWrapper) {
10319  window[globalName] = dxo.createWrapper();
10320  dxo.aspNetCoreWrapperInstance = window[globalName];
10321 }
10322 else
10323  dxo.InitGlobalVariable(globalName);
10324 if(properties)
10325  dxo.SetProperties(properties);
10326 if(events)
10327  dxo.SetEvents(events);
10328 if(setupMethod)
10329  setupMethod.call(dxo);
10330 if(data)
10331  dxo.SetData(data);
10332 dxo.AfterCreate();
10333};
10334var ASPxClientControlBase = ASPx.CreateClass(null, {
10335 constructor: function(name){
10336  this.name = name;
10337  this.uniqueID = name;   
10338  this.globalName = name;
10339  this.stateObject = null;
10340  this.encodeHtml = true;
10341  this.enabled = true;
10342  this.clientEnabled = true;
10343  this.savedClientEnabled = true;
10344  this.clientVisible = true;
10345  this.accessibilityCompliant = false;
10346  this.parseJSPropertiesOnCallbackError = false;
10347  this.autoPostBack = false;
10348  this.allowMultipleCallbacks = true;
10349  this.callBack = null;
10350  this.enableCallbackAnimation = false;
10351  this.enableSlideCallbackAnimation = false;
10352  this.slideAnimationDirection = null;
10353  this.beginCallbackAnimationProcessing = false;
10354  this.endCallbackAnimationProcessing = false;
10355  this.savedCallbackResult = null;
10356  this.savedCallbacks = null;
10357  this.isCallbackAnimationPrevented = false;
10358  this.lpDelay = 300;
10359  this.lpTimer = -1;
10360  this.requestCount = 0;
10361  this.enableSwipeGestures = false;
10362  this.disableSwipeGestures = false;
10363  this.supportGestures = false;
10364  this.repeatedGestureValue = 0;
10365  this.repeatedGestureCount = 0;
10366  this.isInitialized = false;
10367  this.initialFocused = false;
10368  this.leadingAfterInitCall = ASPxClientControl.LeadingAfterInitCallConsts.None; 
10369  this.serverEvents = [];
10370  this.loadingPanelElement = null;
10371  this.loadingDivElement = null;  
10372  this.hasPhantomLoadingElements = false;
10373  this.mainElement = null;
10374  this.touchUIMouseScroller = null;
10375  this.hiddenFields = {};
10376  this.scPrefix = "dx";
10377  this.callbackHandlersQueue = new ASPx.ControlCallbackHandlersQueue(this);
10378  this.Init = new ASPxClientEvent();
10379  this.BeginCallback = new ASPxClientEvent();
10380  this.EndCallback = new ASPxClientEvent();
10381  this.EndCallbackAnimationStart = new ASPxClientEvent();
10382  this.CallbackError = new ASPxClientEvent();
10383  this.CustomDataCallback = new ASPxClientEvent();
10384  this.BeforePronounce = new ASPxClientEvent();
10385  this.Unload = new ASPxClientEvent();
10386  aspxGetControlCollection().Add(this);
10387 },
10388 Initialize: function() {
10389  if(this.callBack != null)
10390   this.InitializeCallBackData();
10391  if (this.useCallbackQueue())
10392   this.callbackQueueHelper = new ASPx.ControlCallbackQueueHelper(this);
10393  ASPx.AccessibilityUtils.createAccessibleBackgrounds(this);
10394  if(this.accessibilityCompliant)
10395   ASPx.AccessibilityPronouncer.EnsureInitialize();
10396 },
10397 FinalizeInitialization: function() { },
10398 InlineInitialize: function() {
10399  this.savedClientEnabled = this.clientEnabled;
10400 },
10401 InitializeGestures: function() {
10402  if(this.isSwipeGesturesEnabled() && this.supportGestures) {
10403   ASPx.GesturesHelper.AddSwipeGestureHandler(this.name, 
10404    function() { return this.GetCallbackAnimationElement(); }.aspxBind(this), 
10405    function(evt) { return this.CanHandleGestureCore(evt); }.aspxBind(this), 
10406    function(value) { return this.AllowStartGesture(value); }.aspxBind(this),
10407    function(value) { return this.StartGesture(); }.aspxBind(this),
10408    function(value) { return this.AllowExecuteGesture(value); }.aspxBind(this),
10409    function(value) { this.ExecuteGesture(value); }.aspxBind(this),
10410    function(value) { this.CancelGesture(value); }.aspxBind(this),
10411    this.GetDefaultanimationEngineType(),
10412    this.rtl
10413   );
10414   if(ASPx.Browser.MSTouchUI)
10415    this.touchUIMouseScroller = ASPx.MouseScroller.Create(
10416     function() { return this.GetCallbackAnimationElement(); }.aspxBind(this),
10417     function() { return null; },
10418     function() { return this.GetCallbackAnimationElement(); }.aspxBind(this),
10419     function(element) { return this.NeedPreventTouchUIMouseScrolling(element); }.aspxBind(this),
10420     true
10421    );
10422  }
10423 },
10424 isSwipeGesturesEnabled: function() {
10425  return !this.disableSwipeGestures && (this.enableSwipeGestures || ASPx.Browser.TouchUI);
10426 },
10427 isSlideCallbackAnimationEnabled: function() {
10428  return this.enableSlideCallbackAnimation || this.isSwipeGesturesEnabled(); 
10429 },
10430 InitGlobalVariable: function(varName){
10431  if(!window) return;
10432  this.globalName = varName;
10433  window[varName] = this;
10434 },
10435 SetProperties: function(properties, obj){
10436  if(!obj) obj = this;
10437  var isAspNetCoreWrapperInstanceExist = !!obj.aspNetCoreWrapperInstance;
10438  for(var name in properties){
10439   if(!properties.hasOwnProperty(name)) continue;
10440   obj[name] = properties[name];
10441   if(isAspNetCoreWrapperInstanceExist && name.indexOf("cp") === 0)
10442    obj.aspNetCoreWrapperInstance[name] = properties[name]; 
10443  }
10444 },
10445 SetEvents: function(events, obj){
10446  if(!obj) obj = this;
10447  for(var name in events){
10448   if(events.hasOwnProperty(name) && obj[name] && obj[name].AddHandler)
10449    obj[name].AddHandler(events[name]);
10450  }
10451 },
10452 SetData: function(data){
10453 },
10454 useCallbackQueue: function(){
10455  return false;
10456 },
10457 NeedPreventTouchUIMouseScrolling: function(element) {
10458  return false;
10459 },
10460 InitailizeFocus: function() {
10461  if(this.initialFocused && this.IsVisible())
10462   this.Focus();
10463 },
10464 AfterCreate: function() {
10465  this.AddDefaultStateControllerItems();
10466  this.InlineInitialize();
10467  this.InitializeGestures();
10468 },
10469 AfterInitialize: function() {
10470  this.initializeAriaDescriptor();
10471  this.InitailizeFocus();
10472  this.isInitialized = true;
10473  this.RaiseInit();
10474  if(this.savedCallbacks) {
10475   for(var i = 0; i < this.savedCallbacks.length; i++) 
10476    this.CreateCallbackInternal(this.savedCallbacks[i].arg, this.savedCallbacks[i].command, 
10477     false, this.savedCallbacks[i].callbackInfo);
10478   this.savedCallbacks = null;
10479  }
10480 },
10481 InitializeCallBackData: function() {
10482 },
10483 AtlasPreInitialize: function() {
10484 },
10485 AtlasInitialize: function() {
10486 },
10487 IsDOMDisposed: function() { 
10488  return !ASPx.IsExistsElement(this.GetMainElement());
10489 },
10490 initializeAriaDescriptor: function() {
10491  if(this.ariaDescription) {
10492   var descriptionObject = ASPx.Json.Eval(this.ariaDescription);
10493   if(descriptionObject) {
10494    this.ariaDescriptor = new AriaDescriptor(this, descriptionObject);
10495    this.applyAccessibilityAttributes(this.ariaDescriptor); 
10496   }
10497  }
10498 },
10499 applyAccessibilityAttributes: function() { },
10500 setAriaDescription: function(selector, argsList) {
10501  if(this.ariaDescriptor)
10502   this.ariaDescriptor.setDescription(selector, argsList || [[]]);
10503 },
10504 allowRestoreFocusOnCallbacks: function(){
10505  return this.accessibilityCompliant;
10506 },
10507 HtmlEncode: function(text) {
10508  return this.encodeHtml ? ASPx.Str.EncodeHtml(text) : text;
10509 },
10510 IsServerEventAssigned: function(eventName){
10511  return ASPx.Data.ArrayIndexOf(this.serverEvents, eventName) >= 0;
10512 },
10513 OnPost: function(args){
10514  this.SerializeStateHiddenField();
10515 },
10516 SerializeStateHiddenField: function() {
10517  this.UpdateStateObject();
10518  if(this.stateObject != null)
10519   this.UpdateStateHiddenField();
10520 },
10521 OnPostFinalization: function(args){
10522 },
10523 UpdateStateObject: function(){
10524 },
10525 UpdateStateObjectWithObject: function(obj){
10526  if(!obj) return;
10527  if(!this.stateObject)
10528   this.stateObject = { };
10529  for(var key in obj)
10530   if(obj.hasOwnProperty(key))
10531    this.stateObject[key] = obj[key];
10532 },
10533 UpdateStateHiddenField: function(){
10534  var stateHiddenField = this.GetStateHiddenField();
10535  if(stateHiddenField) {
10536   var stateObjectStr = ASPx.Json.ToJson(this.stateObject);
10537   stateHiddenField.value = ASPx.Str.EncodeHtml(stateObjectStr);
10538  }
10539 },
10540 GetStateHiddenField: function() {
10541  return this.GetHiddenField(this.GetStateHiddenFieldName(), this.GetStateHiddenFieldID(), 
10542   this.GetStateHiddenFieldParent(), this.GetStateHiddenFieldOrigin());
10543 },
10544 GetStateHiddenFieldName: function() {
10545  return this.uniqueID;
10546 },
10547 GetStateHiddenFieldID: function() {
10548  return this.name + "_State";
10549 },
10550 GetStateHiddenFieldOrigin: function() {
10551  return this.GetMainElement();
10552 },
10553 GetStateHiddenFieldParent: function() {
10554  var element = this.GetStateHiddenFieldOrigin();
10555  return element ? element.parentNode : null;
10556 },
10557 GetHiddenField: function(name, id, parent, beforeElement) {
10558  var hiddenField = this.hiddenFields[id];
10559  if(!hiddenField || !ASPx.IsValidElement(hiddenField)) {
10560   if(parent) {
10561    var existingHiddenField = ASPx.GetElementById(this.GetStateHiddenFieldID());
10562    this.hiddenFields[id] = hiddenField = existingHiddenField || ASPx.CreateHiddenField(name, id);
10563    if(existingHiddenField)
10564     return existingHiddenField;
10565    if(beforeElement)
10566     parent.insertBefore(hiddenField, beforeElement);
10567    else
10568     parent.appendChild(hiddenField);
10569   }
10570  }
10571  return hiddenField;
10572 },
10573 GetChildElement: function(idPostfix){
10574  var mainElement = this.GetMainElement();
10575  if(idPostfix.charAt && idPostfix.charAt(0) !== "_")
10576   idPostfix = "_" + idPostfix;
10577  return mainElement ? ASPx.CacheHelper.GetCachedChildById(this, mainElement, this.name + idPostfix) : null;
10578 },
10579 getChildControl: function(idPostfix) {
10580  var result = null;
10581  var childControlId = this.getChildControlUniqueID(idPostfix);
10582  ASPx.GetControlCollection().ProcessControlsInContainer(this.GetMainElement(), function(control) {
10583   if(control.uniqueID == childControlId)
10584    result = control;
10585  });
10586  return result;  
10587 },
10588 getChildControlUniqueID: function(idPostfix) {
10589  idPostfix = idPostfix.split("_").join("$");
10590  if(idPostfix.charAt && idPostfix.charAt(0) !== "$")
10591   idPostfix = "$" + idPostfix;
10592  return this.uniqueID + idPostfix;  
10593 },
10594 getInnerControl: function(idPostfix) {
10595  var name = this.name + idPostfix;
10596  var result = window[name];
10597  return result && Ident.IsASPxClientControl(result)
10598   ? result
10599   : null;
10600 },
10601 GetParentForm: function(){
10602  return ASPx.GetParentByTagName(this.GetMainElement(), "FORM");
10603 },
10604 GetMainElement: function(){
10605  if(!ASPx.IsExistsElement(this.mainElement))
10606   this.mainElement = ASPx.GetElementById(this.GetMainElementId());
10607  return this.mainElement;
10608 },
10609 GetMainElementId: function() {
10610  return this.name;
10611 },
10612 IsLoadingContainerVisible: function(){
10613  return this.IsVisible();
10614 },
10615 GetLoadingPanelElement: function(){
10616  return ASPx.GetElementById(this.name + "_LP");
10617 },
10618 GetClonedLoadingPanel: function(){
10619  return document.getElementById(this.GetLoadingPanelElement().id + "V"); 
10620 },
10621 CloneLoadingPanel: function(element, parent) {
10622  var clone = element.cloneNode(true);
10623  clone.id = element.id + "V";
10624  parent.appendChild(clone);
10625  return clone;
10626 },
10627 CreateLoadingPanelWithoutBordersInsideContainer: function(container) {
10628  var loadingPanel = this.CreateLoadingPanelInsideContainer(container, false, true, true);
10629  var contentStyle = ASPx.GetCurrentStyle(container);
10630  if(!loadingPanel || !contentStyle)
10631   return;
10632  var elements = [ ];
10633  var table = (loadingPanel.tagName == "TABLE") ? loadingPanel : ASPx.GetNodeByTagName(loadingPanel, "TABLE", 0);
10634  if(table != null)
10635   elements.push(table);
10636  else
10637   elements.push(loadingPanel);
10638  var cells = ASPx.GetNodesByTagName(loadingPanel, "TD");
10639  if(!cells) cells = [ ];
10640  for(var i = 0; i < cells.length; i++)
10641   elements.push(cells[i]);
10642  for(var i = 0; i < elements.length; i++) {
10643   var el = elements[i];
10644   el.style.backgroundColor = contentStyle.backgroundColor;
10645   ASPx.RemoveBordersAndShadows(el);
10646  }
10647 },
10648 CreateLoadingPanelInsideContainer: function(parentElement, hideContent, collapseHeight, collapseWidth) {
10649  if(this.ShouldHideExistingLoadingElements())
10650   this.HideLoadingPanel();
10651  if(parentElement == null)
10652   return null;
10653  if(!this.IsLoadingContainerVisible()) {
10654   this.hasPhantomLoadingElements = true;
10655   return null;
10656  }
10657  var element = this.GetLoadingPanelElement();
10658  if(element != null){
10659   var width = collapseWidth ? 0 : ASPx.GetClearClientWidth(parentElement);
10660   var height = collapseHeight ? 0 : ASPx.GetClearClientHeight(parentElement);
10661   if(hideContent){
10662    for(var i = parentElement.childNodes.length - 1; i > -1; i--){
10663     if(parentElement.childNodes[i].style)
10664      parentElement.childNodes[i].style.display = "none";
10665     else if(parentElement.childNodes[i].nodeType == 3) 
10666      parentElement.removeChild(parentElement.childNodes[i]);
10667    }
10668   }
10669   else
10670    parentElement.innerHTML = "";
10671   var table = document.createElement("TABLE");
10672   parentElement.appendChild(table);
10673   table.border = 0;
10674   table.cellPadding = 0;
10675   table.cellSpacing = 0;
10676   ASPx.SetStyles(table, {
10677    width: (width > 0) ? width : "100%",
10678    height: (height > 0) ? height : "100%"
10679   });
10680   var tbody = document.createElement("TBODY");
10681   table.appendChild(tbody);
10682   var tr = document.createElement("TR");
10683   tbody.appendChild(tr);
10684   var td = document.createElement("TD");
10685   tr.appendChild(td);
10686   td.align = "center";
10687   td.vAlign = "middle";
10688   element = this.CloneLoadingPanel(element, td);
10689   ASPx.SetElementDisplay(element, true, true);
10690   this.loadingPanelElement = element;
10691   return element;
10692  } else
10693   parentElement.innerHTML = "&nbsp;";
10694  return null;
10695 },
10696 CreateLoadingPanelWithAbsolutePosition: function(parentElement, offsetElement) {
10697  if(this.ShouldHideExistingLoadingElements())
10698   this.HideLoadingPanel();
10699  if(parentElement == null)
10700   return null;
10701  if(!this.IsLoadingContainerVisible()) {
10702   this.hasPhantomLoadingElements = true;
10703   return null;
10704  }
10705  if(!offsetElement)
10706   offsetElement = parentElement;
10707  var element = this.GetLoadingPanelElement();
10708  if(element != null) {
10709   element = this.CloneLoadingPanel(element, parentElement);
10710   ASPx.SetStyles(element, {
10711    position: "absolute"
10712   });
10713   ASPx.SetElementDisplay(element, true, true);
10714   ASPx.Evt.AttachEventToElement(element, ASPx.Evt.GetMouseWheelEventName(), ASPx.Evt.PreventEvent);
10715   this.SetLoadingPanelLocation(offsetElement, element);
10716   this.loadingPanelElement = element;
10717   return element;
10718  }
10719  return null;
10720 },
10721 CreateLoadingPanelInline: function(parentElement, centerInParent){
10722  if(this.ShouldHideExistingLoadingElements())
10723   this.HideLoadingPanel();
10724  if(parentElement == null)
10725   return null;
10726  if(!this.IsLoadingContainerVisible()) {
10727   this.hasPhantomLoadingElements = true;
10728   return null;
10729  }
10730  var element = this.GetLoadingPanelElement();
10731  if(element != null) {
10732   element = this.CloneLoadingPanel(element, parentElement);
10733   if(centerInParent){
10734    ASPx.SetElementDisplay(element, true, true, true);
10735    parentElement.style.textAlign = "center";
10736   }
10737   else
10738    ASPx.SetElementDisplay(element, true, true);
10739   this.loadingPanelElement = element;
10740   return element;
10741  }
10742  return null;
10743 },
10744 ShowLoadingPanel: function() {
10745 },
10746 ShowLoadingElements: function() {
10747  if(this.InCallback() || this.lpTimer > -1) return;
10748  this.ShowLoadingDiv();
10749  if(this.IsCallbackAnimationEnabled())
10750   this.StartBeginCallbackAnimation();
10751  else
10752   this.ShowLoadingElementsInternal();
10753 },
10754 ShowLoadingElementsInternal: function() {
10755  if(this.lpDelay > 0 && !this.IsCallbackAnimationEnabled()) 
10756   this.lpTimer = window.setTimeout(function() { 
10757    this.ShowLoadingPanelOnTimer(); 
10758   }.aspxBind(this), this.lpDelay);
10759  else {
10760   this.RestoreLoadingDivOpacity();
10761   this.ShowLoadingPanel();
10762  }
10763 },
10764 GetLoadingPanelOffsetElement: function (baseElement) {
10765  if(this.IsCallbackAnimationEnabled()) {
10766   var element = this.GetLoadingPanelCallbackAnimationOffsetElement();
10767   if(element) {
10768    var container = typeof(ASPx.AnimationHelper) != "undefined" ? ASPx.AnimationHelper.findSlideAnimationContainer(element) : null;
10769    if(container)
10770     return container.parentNode.parentNode;
10771    else
10772     return element;
10773   }
10774  }
10775  return baseElement;
10776 },
10777 GetLoadingPanelCallbackAnimationOffsetElement: function () {
10778  return this.GetCallbackAnimationElement();
10779 },
10780 IsCallbackAnimationEnabled: function () {
10781  return (this.enableCallbackAnimation || this.isSlideCallbackAnimationEnabled()) && !this.isCallbackAnimationPrevented;
10782 },
10783 GetDefaultanimationEngineType: function() {
10784  return ASPx.AnimationEngineType.DEFAULT;
10785 },
10786 StartBeginCallbackAnimation: function () {
10787  this.beginCallbackAnimationProcessing = true;
10788  this.isCallbackFinished = false;
10789  var element = this.GetCallbackAnimationElement();
10790  if (element && this.isSlideCallbackAnimationEnabled() && this.slideAnimationDirection)
10791   ASPx.AnimationHelper.slideOut(element, this.slideAnimationDirection, this.FinishBeginCallbackAnimation.aspxBind(this), this.GetDefaultanimationEngineType(), this.rtl);
10792  else if(element && this.enableCallbackAnimation) 
10793   ASPx.AnimationHelper.fadeOut(element, this.FinishBeginCallbackAnimation.aspxBind(this));
10794  else
10795   this.FinishBeginCallbackAnimation();
10796 },
10797 CancelBeginCallbackAnimation: function() {
10798  if(this.beginCallbackAnimationProcessing) {
10799   this.beginCallbackAnimationProcessing = false;
10800   var element = this.GetCallbackAnimationElement();
10801   ASPx.AnimationHelper.cancelAnimation(element);
10802  }
10803 },
10804 FinishBeginCallbackAnimation: function () {
10805  this.beginCallbackAnimationProcessing = false;
10806  if(!this.isCallbackFinished)
10807   this.ShowLoadingElementsInternal();
10808  else {
10809   this.DoCallback(this.savedCallbackResult);
10810   this.savedCallbackResult = null;
10811  }
10812 },
10813 CheckBeginCallbackAnimationInProgress: function(callbackResult) {
10814  if(this.beginCallbackAnimationProcessing) {
10815   this.savedCallbackResult = callbackResult;
10816   this.isCallbackFinished = true;
10817   return true;
10818  }
10819  return false;
10820 },
10821 StartEndCallbackAnimation: function () {
10822  this.HideLoadingPanel();
10823  this.SetInitialLoadingDivOpacity();
10824  this.RaiseEndCallbackAnimationStart();
10825  this.endCallbackAnimationProcessing = true;
10826  var element = this.GetCallbackAnimationElement();
10827  if(element && this.isSlideCallbackAnimationEnabled() && this.slideAnimationDirection) 
10828   ASPx.AnimationHelper.slideIn(element, this.slideAnimationDirection, this.FinishEndCallbackAnimation.aspxBind(this), this.GetDefaultanimationEngineType(), this.rtl);
10829  else if(element && this.enableCallbackAnimation) 
10830   ASPx.AnimationHelper.fadeIn(element, this.FinishEndCallbackAnimation.aspxBind(this));
10831  else
10832   this.FinishEndCallbackAnimation();
10833  this.slideAnimationDirection = null;
10834 },
10835 FinishEndCallbackAnimation: function () {
10836  this.DoEndCallback();
10837  this.endCallbackAnimationProcessing = false;
10838  this.CheckRepeatGesture();
10839 },
10840 CheckEndCallbackAnimationNeeded: function() {
10841  if(!this.endCallbackAnimationProcessing && this.requestCount == 1) {
10842   this.StartEndCallbackAnimation();
10843   return true;
10844  }
10845  return false;
10846 },
10847 PreventCallbackAnimation: function() {
10848  this.isCallbackAnimationPrevented = true;
10849 },
10850 GetCallbackAnimationElement: function() {
10851  return null;
10852 },
10853 AssignSlideAnimationDirectionByPagerArgument: function(arg, currentPageIndex) {
10854  this.slideAnimationDirection = null;
10855  if(this.isSlideCallbackAnimationEnabled() && typeof(ASPx.AnimationHelper) != "undefined") {
10856   if(arg == PagerCommands.Next || arg == PagerCommands.Last)
10857    this.slideAnimationDirection = ASPx.AnimationHelper.SLIDE_LEFT_DIRECTION;
10858   else if(arg == PagerCommands.First || arg == PagerCommands.Prev)
10859    this.slideAnimationDirection = ASPx.AnimationHelper.SLIDE_RIGHT_DIRECTION;
10860   else if(!isNaN(currentPageIndex) && arg.indexOf(PagerCommands.PageNumber) == 0) {
10861    var newPageIndex = parseInt(arg.substring(2));
10862    if (!isNaN(newPageIndex)) {
10863     var leftDir = this.rtl ? ASPx.AnimationHelper.SLIDE_LEFT_DIRECTION : ASPx.AnimationHelper.SLIDE_RIGHT_DIRECTION;
10864     var rightDir = this.rtl ? ASPx.AnimationHelper.SLIDE_RIGHT_DIRECTION : ASPx.AnimationHelper.SLIDE_LEFT_DIRECTION;
10865     this.slideAnimationDirection = newPageIndex < currentPageIndex ? leftDir : rightDir;
10866    }
10867   }
10868  }
10869 },
10870 TryShowPhantomLoadingElements: function () {
10871  if(this.hasPhantomLoadingElements && this.InCallback()) {
10872   this.hasPhantomLoadingElements = false;
10873   this.ShowLoadingDivAndPanel();
10874  }
10875 },
10876 ShowLoadingDivAndPanel: function () {
10877  this.ShowLoadingDiv();
10878  this.RestoreLoadingDivOpacity();
10879  this.ShowLoadingPanel();
10880 },
10881 HideLoadingElements: function() {
10882  this.CancelBeginCallbackAnimation();
10883  this.HideLoadingPanel();
10884  this.HideLoadingDiv();
10885 },
10886 ShowLoadingPanelOnTimer: function() {
10887  this.ClearLoadingPanelTimer();
10888  if(!this.IsDOMDisposed()) {
10889   this.RestoreLoadingDivOpacity();
10890   this.ShowLoadingPanel();
10891  }
10892 },
10893 ClearLoadingPanelTimer: function() {
10894  this.lpTimer = ASPx.Timer.ClearTimer(this.lpTimer);  
10895 },
10896 HideLoadingPanel: function() {
10897  this.ClearLoadingPanelTimer();
10898  this.hasPhantomLoadingElements = false;
10899  if(ASPx.IsExistsElement(this.loadingPanelElement)) {
10900   ASPx.RemoveElement(this.loadingPanelElement);
10901   this.loadingPanelElement = null;
10902  }
10903 },
10904 SetLoadingPanelLocation: function(offsetElement, loadingPanel, x, y, offsetX, offsetY) {
10905  if(!ASPx.IsExists(x) || !ASPx.IsExists(y)){
10906   var x1 = ASPx.GetAbsoluteX(offsetElement);
10907   var y1 = ASPx.GetAbsoluteY(offsetElement);
10908   var x2 = x1;
10909   var y2 = y1;
10910   if(offsetElement == document.body) {
10911    x1 = 0;
10912    y1 = 0;
10913    x2 = ASPx.GetDocumentMaxClientWidth();
10914    y2 = ASPx.GetDocumentMaxClientHeight();
10915   }
10916   else{
10917    x2 += offsetElement.offsetWidth;
10918    y2 += offsetElement.offsetHeight;
10919   }
10920   if(x1 < ASPx.GetDocumentScrollLeft())
10921    x1 = ASPx.GetDocumentScrollLeft();
10922   if(y1 < ASPx.GetDocumentScrollTop())
10923    y1 = ASPx.GetDocumentScrollTop();
10924   if(x2 > ASPx.GetDocumentScrollLeft() + ASPx.GetDocumentClientWidth())
10925    x2 = ASPx.GetDocumentScrollLeft() + ASPx.GetDocumentClientWidth();
10926   if(y2 > ASPx.GetDocumentScrollTop() + ASPx.GetDocumentClientHeight())
10927    y2 = ASPx.GetDocumentScrollTop() + ASPx.GetDocumentClientHeight();
10928   x = x1 + ((x2 - x1 - loadingPanel.offsetWidth) / 2);
10929   y = y1 + ((y2 - y1 - loadingPanel.offsetHeight) / 2);
10930  }
10931  if(ASPx.IsExists(offsetX) && ASPx.IsExists(offsetY)){
10932   x += offsetX;
10933   y += offsetY;
10934  }
10935  x = ASPx.PrepareClientPosForElement(x, loadingPanel, true);
10936  y = ASPx.PrepareClientPosForElement(y, loadingPanel, false);
10937  if(ASPx.Browser.IE && ASPx.Browser.Version > 8) {
10938   x = Math.round(x);
10939   y = Math.round(y);
10940  }
10941  ASPx.SetStyles(loadingPanel, { left: x, top: y });
10942 },
10943 GetLoadingDiv: function(){
10944  return ASPx.GetElementById(this.name + "_LD");
10945 },
10946 CreateLoadingDiv: function(parentElement, offsetElement){
10947  if(this.ShouldHideExistingLoadingElements())
10948   this.HideLoadingDiv();
10949  if(parentElement == null) 
10950   return null;
10951  if(!this.IsLoadingContainerVisible()) {
10952   this.hasPhantomLoadingElements = true;
10953   return null;
10954  }
10955  if(!offsetElement)
10956   offsetElement = parentElement;
10957  var div = this.GetLoadingDiv();
10958  if(div != null){
10959   div = div.cloneNode(true);
10960   parentElement.appendChild(div);
10961   ASPx.SetElementDisplay(div, true, true);
10962   ASPx.Evt.AttachEventToElement(div, ASPx.TouchUIHelper.touchMouseDownEventName, ASPx.Evt.PreventEvent);
10963   ASPx.Evt.AttachEventToElement(div, ASPx.TouchUIHelper.touchMouseMoveEventName, ASPx.Evt.PreventEvent);
10964   ASPx.Evt.AttachEventToElement(div, ASPx.TouchUIHelper.touchMouseUpEventName, ASPx.Evt.PreventEvent);
10965   ASPx.Evt.AttachEventToElement(div, ASPx.Evt.GetMouseWheelEventName(), ASPx.Evt.PreventEvent);
10966   this.SetLoadingDivBounds(offsetElement, div);
10967   this.loadingDivElement = div;
10968   this.SetInitialLoadingDivOpacity();
10969   return div;
10970  }
10971  return null;
10972 },
10973 SetInitialLoadingDivOpacity: function() {
10974  if(!this.loadingDivElement) return;
10975  ASPx.Attr.SaveStyleAttribute(this.loadingDivElement, "opacity");
10976  ASPx.Attr.SaveStyleAttribute(this.loadingDivElement, "filter");
10977  ASPx.SetElementOpacity(this.loadingDivElement, 0.01);
10978 },
10979 RestoreLoadingDivOpacity: function() {
10980  if(!this.loadingDivElement) return;
10981  ASPx.Attr.RestoreStyleAttribute(this.loadingDivElement, "opacity");
10982  ASPx.Attr.RestoreStyleAttribute(this.loadingDivElement, "filter");
10983 },
10984 SetLoadingDivBounds: function(offsetElement, loadingDiv) {
10985  var absX = (offsetElement == document.body) ? 0 : ASPx.GetAbsoluteX(offsetElement);
10986  var absY = (offsetElement == document.body) ? 0 : ASPx.GetAbsoluteY(offsetElement);
10987  ASPx.SetStyles(loadingDiv, {
10988   left: ASPx.PrepareClientPosForElement(absX, loadingDiv, true),
10989   top: ASPx.PrepareClientPosForElement(absY, loadingDiv, false)
10990  });
10991  var width = (offsetElement == document.body) ? ASPx.GetDocumentWidth() : offsetElement.offsetWidth;
10992  var height = (offsetElement == document.body) ? ASPx.GetDocumentHeight() : offsetElement.offsetHeight;
10993  if(height < 0) 
10994   height = 0;
10995  ASPx.SetStyles(loadingDiv, { width: width, height: height });
10996  var correctedWidth = 2 * width - loadingDiv.offsetWidth;
10997  if(correctedWidth <= 0) correctedWidth = width;
10998  var correctedHeight = 2 * height - loadingDiv.offsetHeight;
10999  if(correctedHeight <= 0) correctedHeight = height;
11000  ASPx.SetStyles(loadingDiv, { width: correctedWidth, height: correctedHeight });
11001 },
11002 ShowLoadingDiv: function() {
11003 },
11004 HideLoadingDiv: function() {
11005  this.hasPhantomLoadingElements = false;
11006  if(ASPx.IsExistsElement(this.loadingDivElement)){
11007   ASPx.RemoveElement(this.loadingDivElement);
11008   this.loadingDivElement = null;
11009  }
11010 },
11011 CanHandleGesture: function(evt) {
11012  return false;
11013 },
11014 CanHandleGestureCore: function(evt) {
11015  var source = ASPx.Evt.GetEventSource(evt);
11016  if(ASPx.GetIsParent(this.loadingPanelElement, source) || ASPx.GetIsParent(this.loadingDivElement, source))
11017   return true; 
11018  var callbackAnimationElement = this.GetCallbackAnimationElement();
11019  if(!callbackAnimationElement)
11020   return false;
11021  var animationContainer = ASPx.AnimationHelper.getSlideAnimationContainer(callbackAnimationElement, false, false);
11022  if(animationContainer && ASPx.GetIsParent(animationContainer, source) && !ASPx.GetIsParent(animationContainer.childNodes[0], source))
11023   return true; 
11024  return this.CanHandleGesture(evt); 
11025 },
11026 AllowStartGesture: function() {
11027  return !this.beginCallbackAnimationProcessing && !this.endCallbackAnimationProcessing;
11028 },
11029 StartGesture: function() {
11030 },
11031 AllowExecuteGesture: function(value) {
11032  return false;
11033 },
11034 ExecuteGesture: function(value) {
11035 },
11036 CancelGesture: function(value) {
11037  if(this.repeatedGestureCount === 0) {
11038   this.repeatedGestureValue = value;
11039   this.repeatedGestureCount = 1;
11040  }
11041  else {
11042   if(this.repeatedGestureValue * value > 0)
11043    this.repeatedGestureCount++;
11044   else
11045    this.repeatedGestureCount--;
11046   if(this.repeatedGestureCount === 0)
11047    this.repeatedGestureCount = 0;
11048  }
11049 },
11050 CheckRepeatGesture: function() {
11051  if(this.repeatedGestureCount !== 0) {
11052   if(this.AllowExecuteGesture(this.repeatedGestureValue))
11053    this.ExecuteGesture(this.repeatedGestureValue, this.repeatedGestureCount);
11054   this.repeatedGestureValue = 0;
11055   this.repeatedGestureCount = 0;
11056  }
11057 },
11058 AllowExecutePagerGesture: function (pageIndex, pageCount, value) {
11059  if(pageIndex < 0) return false;
11060  if(pageCount <= 1) return false;
11061  if(value > 0 && pageIndex === 0) return false;
11062  if(value < 0 && pageIndex === pageCount - 1) return false;
11063  return true;
11064 },
11065 ExecutePagerGesture: function(pageIndex, pageCount, value, count, method) {
11066  if(!count) count = 1;
11067  var pageIndex = pageIndex + (value < 0 ? count : -count);
11068  if(pageIndex < 0) pageIndex = 0;
11069  if(pageIndex > pageCount - 1) pageIndex = pageCount - 1;
11070  method(PagerCommands.PageNumber + pageIndex);
11071 },
11072 RaiseInit: function(){
11073  if(!this.Init.IsEmpty()){
11074   var args = new ASPxClientEventArgs();
11075   this.Init.FireEvent(this, args);
11076  }
11077 },
11078 RaiseBeginCallbackInternal: function(command){
11079  if(!this.BeginCallback.IsEmpty()){
11080   var args = new ASPxClientBeginCallbackEventArgs(command);
11081   this.BeginCallback.FireEvent(this, args);
11082  }
11083 },
11084 RaiseEndCallbackInternal: function() {
11085  if(!this.EndCallback.IsEmpty()){
11086   var args = new ASPxClientEndCallbackEventArgs();
11087   this.EndCallback.FireEvent(this, args);
11088  }
11089 },
11090 RaiseCallbackErrorInternal: function(message, callbackId) {
11091  if(!this.CallbackError.IsEmpty()) {
11092   var args = new ASPxClientCallbackErrorEventArgs(message, callbackId);
11093   this.CallbackError.FireEvent(this, args);
11094   if(args.handled)
11095    return { isHandled: true, errorMessage: args.message };
11096  }
11097 },
11098 RaiseBeginCallback: function(command){
11099  this.RaiseBeginCallbackInternal(command);    
11100  aspxGetControlCollection().RaiseBeginCallback(this, command);
11101 },
11102 RaiseEndCallback: function(){
11103  this.RaiseEndCallbackInternal();
11104  aspxGetControlCollection().RaiseEndCallback(this);
11105 },
11106 RaiseCallbackError: function (message, callbackId) {
11107  var result = this.RaiseCallbackErrorInternal(message, callbackId);
11108  if(!result) 
11109   result = aspxGetControlCollection().RaiseCallbackError(this, message, callbackId);
11110  return result;
11111 },
11112 RaiseEndCallbackAnimationStart: function(){
11113  if(!this.EndCallbackAnimationStart.IsEmpty()){
11114   var args = new ASPxClientEventArgs();
11115   this.EndCallbackAnimationStart.FireEvent(this, args);
11116  }
11117 },
11118 RaiseBeforePronounce: function(message) {
11119  var args = new ASPxClientControlBeforePronounceEventArgs(message, this);
11120  if(!this.BeforePronounce.IsEmpty())
11121   this.BeforePronounce.FireEvent(this, args);
11122  return args;
11123 },
11124 RaiseUnload: function() {
11125  var args = new ASPxClientControlUnloadEventArgs(this);
11126  if(!this.Unload.IsEmpty())
11127   this.Unload.FireEvent(this, args);
11128 },
11129 SendMessageToAssistiveTechnology: function(message) {
11130  if(!this.accessibilityCompliant)
11131   return;
11132  this.PronounceMessageInternal(message, ASPx.AccessibilityPronouncerType.live);
11133 },
11134 PronounceMessageInternal: function(messageArg, type) {
11135  var message = messageArg;
11136  if(!ASPx.Ident.IsArray(messageArg))
11137   message = [messageArg];
11138  var args = this.RaiseBeforePronounce(message);
11139  ASPx.AccessibilityPronouncer.Pronounce(args, type);
11140 },
11141 IsVisible: function() {
11142  var element = this.GetMainElement();
11143  return ASPx.IsElementVisible(element);
11144 },
11145 IsDisplayedElement: function(element) {
11146  while(element && element.tagName != "BODY") {
11147   if(!ASPx.GetElementDisplay(element)) 
11148    return false;
11149   element = element.parentNode;
11150  }
11151  return true;
11152 },
11153 IsDisplayed: function() {
11154  return this.IsDisplayedElement(this.GetMainElement());
11155 },
11156 IsHiddenElement: function(element) {
11157  return element && element.offsetWidth == 0 && element.offsetHeight == 0;
11158 },
11159 IsHidden: function() {
11160  return this.IsHiddenElement(this.GetMainElement());
11161 },
11162 GetParentControl: function() {
11163  var mainElement = this.GetMainElement() || (this.GetCurrentWindowElement && this.GetCurrentWindowElement());
11164  var popupPostfix = ASPx.PCWIdSuffix + "-1";
11165  var result = null;
11166  ASPx.GetParent(mainElement, function(element) {
11167   if(element === mainElement || !element.id)
11168    return false;
11169   var controlName = element.id.replace(popupPostfix, "");
11170   result = ASPx.GetControlCollection().Get(controlName);
11171   return !!result;
11172  });
11173  return result;
11174 },
11175 findParentByType: function (type) {
11176  var ctrl = this;
11177  while (ctrl) {
11178   var parent = ctrl.GetParentControl();
11179   if (parent && parent instanceof type)
11180    return parent;
11181   ctrl = parent;
11182  }
11183  return null;
11184 },
11185 Focus: function() {
11186 },
11187 GetClientVisible: function(){
11188  return this.GetVisible();
11189 },
11190 SetClientVisible: function(visible){
11191  this.SetVisible(visible);
11192 },
11193 GetVisible: function(){
11194  return this.clientVisible;
11195 },
11196 SetVisible: function(visible){
11197  if(this.clientVisible != visible){
11198   this.clientVisible = visible;
11199   ASPx.SetElementDisplay(this.GetMainElement(), visible);
11200   if(visible) {
11201    this.AdjustControl();
11202    var mainElement = this.GetMainElement();
11203    if(mainElement)
11204     aspxGetControlCollection().AdjustControls(mainElement);
11205   }
11206  }
11207 },
11208 GetEnabled: function() {
11209  return this.clientEnabled;
11210 },
11211 SetEnabled: function(enabled) {
11212  this.clientEnabled = enabled;
11213  if(ASPxClientControl.setEnabledLocked)
11214   return;
11215  else
11216   ASPxClientControl.setEnabledLocked = true;
11217  this.savedClientEnabled = enabled;
11218  aspxGetControlCollection().ProcessControlsInContainer(this.GetMainElement(), function(control) {
11219   if(ASPx.IsFunction(control.SetEnabled))
11220    control.SetEnabled(enabled && control.savedClientEnabled);
11221  });
11222  delete ASPxClientControl.setEnabledLocked;
11223 },
11224 InCallback: function() {
11225  return this.requestCount > 0;
11226 },
11227 DoBeginCallback: function(command) {
11228  this.RaiseBeginCallback(command || "");
11229  aspxGetControlCollection().Before_WebForm_InitCallback(this.name);
11230  if(typeof(WebForm_InitCallback) != "undefined" && WebForm_InitCallback) {
11231   __theFormPostData = "";
11232   __theFormPostCollection = [ ];
11233   this.ClearPostBackEventInput("__EVENTTARGET");
11234   this.ClearPostBackEventInput("__EVENTARGUMENT");
11235   WebForm_InitCallback();
11236   this.savedFormPostData = __theFormPostData;   
11237   this.savedFormPostCollection = __theFormPostCollection;
11238  }
11239 },
11240 ClearPostBackEventInput: function(id){
11241  var element = ASPx.GetElementById(id);
11242  if(element != null) element.value = "";
11243 },
11244 PerformDataCallback: function(arg, handler) {
11245  this.CreateCustomDataCallback(arg, "", handler);
11246 },
11247 sendCallbackViaQueue: function (prefix, arg, showLoadingPanel, context, handler, onBeforeSend) {
11248  if (!this.useCallbackQueue())
11249   return false;
11250  var context = context || this;
11251  var token = this.callbackQueueHelper.sendCallback(ASPx.FormatCallbackArg(prefix, arg), context, handler || context.OnCallback, prefix, onBeforeSend);
11252  if (showLoadingPanel)
11253   this.callbackQueueHelper.showLoadingElements();
11254  return token;
11255 },
11256 CreateCallback: function (arg, command, handler) {
11257  var callbackInfo = this.CreateCallbackInfo(ASPx.CallbackType.Common, handler || null);
11258  var callbackID = this.CreateCallbackByInfo(arg, command, callbackInfo);
11259  return callbackID;
11260 },
11261 CreateCustomDataCallback: function(arg, command, handler) {
11262  var callbackInfo = this.CreateCallbackInfo(ASPx.CallbackType.Data, handler);
11263  this.CreateCallbackByInfo(arg, command, callbackInfo);
11264 },
11265 CreateCallbackByInfo: function(arg, command, callbackInfo) {
11266  if(!this.CanCreateCallback()) return;
11267  var callbackID;
11268  if(typeof(WebForm_DoCallback) != "undefined" && WebForm_DoCallback && ASPx.documentLoaded || ASPx.Platform === "NETCORE")
11269   callbackID = this.CreateCallbackInternal(arg, command, true, callbackInfo);
11270  else {
11271   if(!this.savedCallbacks)
11272    this.savedCallbacks = [];
11273   var callbackInfo = { arg: arg, command: command, callbackInfo: callbackInfo };
11274   if(this.allowMultipleCallbacks)
11275    this.savedCallbacks.push(callbackInfo);
11276   else
11277    this.savedCallbacks[0] = callbackInfo;
11278  }
11279  return callbackID;
11280 },
11281 CreateCallbackInternal: function(arg, command, viaTimer, callbackInfo) {
11282  var watcher = ASPx.ControlUpdateWatcher.getInstance();
11283  if(watcher && !watcher.CanSendCallback(this, arg)) {
11284   this.CancelCallbackInternal();
11285   return;
11286  }
11287  this.requestCount++;
11288  this.DoBeginCallback(command);
11289  if(typeof(arg) == "undefined")
11290   arg = "";
11291  if(typeof(command) == "undefined")
11292   command = "";
11293  var callbackID = this.SaveCallbackInfo(callbackInfo);
11294  if(viaTimer)
11295   window.setTimeout(function() { this.CreateCallbackCore(arg, command, callbackID); }.aspxBind(this), 0);
11296  else
11297   this.CreateCallbackCore(arg, command, callbackID);
11298  return callbackID;
11299 },
11300 CancelCallbackInternal: function() {
11301  this.CancelCallbackCore();
11302  this.HideLoadingElements();
11303 },
11304 CancelCallbackCore: function() {
11305 },
11306 CreateCallbackCore: function(arg, command, callbackID) {
11307  var callBackMethod = this.GetCallbackMethod(command);
11308  __theFormPostData = this.savedFormPostData;
11309  __theFormPostCollection = this.savedFormPostCollection;
11310  callBackMethod.call(this, this.GetSerializedCallbackInfoByID(callbackID) + arg);
11311 },
11312 GetCallbackMethod: function(command){
11313  return this.callBack;
11314 },
11315 CanCreateCallback: function() {
11316  return !this.InCallback() || (this.allowMultipleCallbacks && !this.beginCallbackA
11316nimationProcessing && !this.endCallbackAnimationProcessing);
11317 },
11318 DoLoadCallbackScripts: function() {
11319  ASPx.ProcessScriptsAndLinks(this.name, true);
11320 },
11321 DoEndCallback: function() {
11322  if(this.IsCallbackAnimationEnabled() && this.CheckEndCallbackAnimationNeeded()) 
11323   return;
11324  this.requestCount--;
11325  if (this.requestCount < 1) 
11326   this.callbackHandlersQueue.executeCallbacksHandlers();
11327  if(this.HideLoadingPanelOnCallback() && this.requestCount < 1) 
11328   this.HideLoadingElements();
11329  if(this.isSwipeGesturesEnabled() && this.supportGestures) {
11330   ASPx.GesturesHelper.UpdateSwipeAnimationContainer(this.name);
11331   if(this.touchUIMouseScroller)
11332    this.touchUIMouseScroller.update();
11333  }
11334  this.isCallbackAnimationPrevented = false;
11335  this.OnCallbackFinalized();
11336  this.AssignEllipsisTooltips();
11337  this.RaiseEndCallback();
11338 },
11339 DoFinalizeCallback: function() {
11340 },
11341 OnCallbackFinalized: function() {
11342 },
11343 AssignEllipsisTooltips: function() { },
11344 HideLoadingPanelOnCallback: function() {
11345  return true;
11346 },
11347 ShouldHideExistingLoadingElements: function() {
11348  return true;
11349 },
11350 EvalCallbackResult: function(resultString){
11351  return eval(resultString);
11352 },
11353 ParseJSProperties: function(resultObj) {
11354  if(resultObj.cp) {
11355   for(var name in resultObj.cp)
11356    if(resultObj.cp.hasOwnProperty(name)) {
11357     this[name] = resultObj.cp[name];
11358     if(this.aspNetCoreWrapperInstance)
11359      this.aspNetCoreWrapperInstance[name] = resultObj.cp[name]; 
11360    }
11361  }
11362 },
11363 DoCallback: function(result) {
11364  if(this.IsCallbackAnimationEnabled() && this.CheckBeginCallbackA
11364nimationInProgress(result))
11365   return;
11366  result = ASPx.Str.Trim(result);
11367  if(result.indexOf(ASPx.CallbackResultPrefix) != 0) 
11368   this.ProcessCallbackGeneralError(result, false);
11369  else {
11370   var resultObj = null;
11371   try {
11372    resultObj = this.EvalCallbackResult(result);
11373   } 
11374   catch(e) {
11375   }
11376   if(resultObj) {
11377    ASPx.CacheHelper.DropCache(this);
11378    if(resultObj.redirect) {
11379     this.ParseJSProperties(resultObj); 
11380     ASPx.Url.Redirect(resultObj.redirect);
11381    }
11382    else if(ASPx.IsExists(resultObj.generalError)) {
11383     this.ProcessCallbackGeneralError(resultObj.generalError, true);
11384    }
11385    else {
11386     var errorObj = resultObj.error;
11387     if(errorObj) { 
11388      if(this.parseJSPropertiesOnCallbackError)
11389       this.ParseJSProperties(resultObj);
11390      this.ProcessCallbackError(errorObj,resultObj.id);
11391     } else {
11392      this.ParseJSProperties(resultObj);
11393      var callbackInfo = this.DequeueCallbackInfo(resultObj.id);
11394      if(callbackInfo && callbackInfo.type == ASPx.CallbackType.Data)
11395       this.ProcessCustomDataCallback(resultObj.result, callbackInfo);
11396      else {
11397       if (this.useCallbackQueue() && this.callbackQueueHelper.getCallbackInfoById(resultObj.id))
11398        this.callbackQueueHelper.processCallback(resultObj.result, resultObj.id);
11399       else {
11400        this.ProcessCallback(resultObj.result, resultObj.id);
11401        if(callbackInfo && callbackInfo.handler) {
11402         var handlerInfo = { handler: callbackInfo.handler, result: resultObj.result.data };
11403         this.callbackHandlersQueue.addCallbackHandler(handlerInfo);
11404        }
11405       }
11406      }
11407     }
11408    }
11409   } 
11410  }
11411  this.DoLoadCallbackScripts();
11412 },
11413 DoCallbackError: function(result) {
11414  this.HideLoadingElements();
11415  this.ProcessCallbackGeneralError(result, false); 
11416 },
11417 DoControlClick: function(evt) {
11418  this.OnControlClick(ASPx.Evt.GetEventSource(evt), evt);
11419 },
11420 ProcessCallback: function (result, callbackId) {
11421  this.OnCallback(result, callbackId);
11422 },
11423 ProcessCustomDataCallback: function(result, callbackInfo) {
11424  if(callbackInfo.handler != null)
11425   callbackInfo.handler(this, result);
11426  this.RaiseCustomDataCallback(result);
11427 },
11428 RaiseCustomDataCallback: function(result) {
11429  if(!this.CustomDataCallback.IsEmpty()) {
11430   var arg = new ASPxClientCustomDataCallbackEventArgs(result);
11431   this.CustomDataCallback.FireEvent(this, arg);
11432  }
11433 },
11434 OnCallback: function(result) {
11435 },
11436 CreateCallbackInfo: function(type, handler) {
11437  return { type: type, handler: handler };
11438 },
11439 GetSerializedCallbackInfoByID: function(callbackID) {
11440  return this.GetCallbackInfoByID(callbackID).type + callbackID + ASPx.CallbackSeparator;
11441 },
11442 SaveCallbackInfo: function(callbackInfo) {
11443  var activeCallbacksInfo = this.GetActiveCallbacksInfo();
11444  for(var i = 0; i < activeCallbacksInfo.length; i++) {
11445   if(activeCallbacksInfo[i] == null) {
11446    activeCallbacksInfo[i] = callbackInfo;
11447    return i;
11448   }
11449  }
11450  activeCallbacksInfo.push(callbackInfo);
11451  return activeCallbacksInfo.length - 1;
11452 },
11453 GetActiveCallbacksInfo: function() {
11454  var persistentProperties = this.GetPersistentProperties();
11455  if(!persistentProperties.activeCallbacks)
11456   persistentProperties.activeCallbacks = [ ];
11457  return persistentProperties.activeCallbacks;
11458 },
11459 GetPersistentProperties: function() {
11460  var storage = _aspxGetPersistentControlPropertiesStorage();
11461  var persistentProperties = storage[this.name];
11462  if(!persistentProperties) {
11463   persistentProperties = { };
11464   storage[this.name] = persistentProperties;
11465  }
11466  return persistentProperties;
11467 },
11468 GetCallbackInfoByID: function(callbackID) {
11469  return this.GetActiveCallbacksInfo()[callbackID];
11470 },
11471 DequeueCallbackInfo: function(index) {
11472  var activeCallbacksInfo = this.GetActiveCallbacksInfo();
11473  if(index < 0 || index >= activeCallbacksInfo.length)
11474   return null;
11475  var result = activeCallbacksInfo[index];
11476  activeCallbacksInfo[index] = null;
11477  return result;
11478 },
11479 ProcessCallbackError: function (errorObj, callbackId) {
11480  var data = ASPx.IsExists(errorObj.data) ? errorObj.data : null;
11481  var result = this.RaiseCallbackError(errorObj.message, callbackId);
11482  if(result.isHandled)
11483   this.OnCallbackErrorAfterUserHandle(result.errorMessage, data); 
11484  else
11485   this.OnCallbackError(result.errorMessage, data); 
11486 },
11487 OnCallbackError: function(errorMessage, data) {
11488  if(errorMessage)
11489   ASPx.ShowErrorAlert(errorMessage);
11490 },
11491 OnCallbackErrorAfterUserHandle: function(errorMessage, data) {
11492 },
11493 ProcessCallbackGeneralError: function(errorMessage, serverExceptionOnLastCallback) {
11494  this.serverExceptionOnLastCallback = serverExceptionOnLastCallback;
11495  var result = this.RaiseCallbackError(errorMessage);
11496  if(result.isHandled)
11497   this.OnCallbackGeneralErrorAfterUserHandle(result.errorMessage);
11498  else
11499   this.OnCallbackGeneralError(result.errorMessage);
11500 },
11501 OnCallbackGeneralError: function(errorMessage) {
11502  this.OnCallbackError(errorMessage, null);
11503 },
11504 OnCallbackGeneralErrorAfterUserHandle: function (errorMessage) {
11505 },
11506 SendPostBack: function(params, preventConvertToUpdatePanelCallback) {
11507  if(preventConvertToUpdatePanelCallback)
11508   this.sendMSAjaxCompatPostBack(params);
11509  else
11510   this.sendPostBackInternal(params);
11511 },
11512 sendPostBackInternal: function(params) {
11513  if(typeof(__doPostBack) != "undefined")
11514   __doPostBack(this.uniqueID, params);
11515  else{
11516   var form = this.GetParentForm();
11517   if(form) form.submit();
11518  }
11519 },
11520 sendMSAjaxCompatPostBack: function(params) {
11521  var rm = ASPx.GetMSAjaxRequestManager();
11522  var triggers = rm ? rm._postBackControlClientIDs : null;
11523  var needRegister = triggers && ASPx.Ident.IsArray(triggers) && ASPx.Data.ArrayIndexOf(triggers, this.name) == -1;
11524  if(needRegister)
11525   triggers.unshift(this.name);
11526  this.sendPostBackInternal(params);
11527  if(needRegister)
11528   triggers.shift();
11529 },
11530 IsValidInstance: function () {
11531  return aspxGetControlCollection().GetByName(this.name) === this;
11532 },
11533 OnDispose: function() { 
11534  var varName = this.globalName;
11535  if(varName && varName !== "" && window && window[varName] && window[varName] == this){
11536   try{
11537    delete window[varName];
11538   }
11539   catch(e){  }
11540  }
11541  if(this.callbackQueueHelper)
11542   this.callbackQueueHelper.detachEvents();
11543 },
11544 OnGlobalControlsInitialized: function(args) { 
11545 },
11546 OnGlobalBrowserWindowResized: function(args) { 
11547 },
11548 OnGlobalBeginCallback: function(args) { 
11549 },
11550 OnGlobalEndCallback: function(args) { 
11551 },
11552 OnGlobalCallbackError: function(args) { 
11553 },
11554 OnGlobalValidationCompleted: function(args) { 
11555 },
11556 AddDefaultStateControllerItems: function() {
11557  var states = this.scStates;
11558  if(!states) return;
11559  var postfix = this.scPostfix ? ("_" + this.scPostfix) : "";
11560  var mainElementId = this.GetMainElementId();
11561  if(states & 2)
11562   this.AddDefaultReadOnlyStateControllerItem(this.scPrefix + "ReadOnly" + postfix, mainElementId);
11563  if(states & 4)
11564   this.AddDefaultDisabledStateControllerItem(this.scPrefix + "Disabled" + postfix, mainElementId);
11565 },
11566 AddDefaultReadOnlyStateControllerItem: function(cssClass, mainElementId) { throw "Not implemented"; },
11567 AddDefaultDisabledStateControllerItem: function(cssClass, mainElementId) { throw "Not implemented"; },
11568 DOMContentLoaded: function() { },
11569 IsStateControllerEnabled: function() { return false; },
11570 InitializeDOM: function() {
11571  var mainElement = this.GetMainElement();
11572  if(mainElement)
11573   ASPx.SetElementInitializedFlag(mainElement);
11574 },
11575 IsDOMInitialized: function() {
11576  var mainElement = this.GetMainElement();
11577  return mainElement && ASPx.GetElementInitializedFlag(mainElement);
11578 },
11579 AdjustControl: function(nestedCall) { },
11580 OnBrowserWindowResizeInternal: function(e) { },
11581 RegisterInControlTree: function(tree) { }
11582});
11583ASPxClientControlBase.Cast = function(obj) {
11584 if(typeof obj == "string")
11585  return window[obj];
11586 return obj;
11587};
11588var persistentControlPropertiesStorage = null;
11589function _aspxGetPersistentControlPropertiesStorage() {
11590 if(persistentControlPropertiesStorage == null)
11591  persistentControlPropertiesStorage = { };
11592 return persistentControlPropertiesStorage;
11593}
11594var ELLIPSIS_MARKER_CLASS = "dx-ellipsis";
11595var ELLIPSIS_TOOLTIP_MARKER_ATTR = "dxEllipsisTitle";
11596var ASPxClientControl = ASPx.CreateClass(ASPxClientControlBase, {
11597 constructor: function(name){
11598  this.constructor.prototype.constructor.call(this, name);
11599  this.rtl = false;
11600  this.enableEllipsis = false;
11601  this.isNative = false;
11602  this.isControlCollapsed = false;
11603  this.isInsideHierarchyAdjustment = false;
11604  this.controlOwner = null;
11605  this.adjustedSizes = { };
11606  this.dialogContentHashTable = { };
11607  this.renderIFrameForPopupElements = false;
11608  this.widthValueSetInPercentage = false;
11609  this.heightValueSetInPercentage = false;
11610  this.verticalAlignedElements = { };
11611  this.wrappedTextContainers = { };
11612  this.scrollPositionState = { };
11613  this.sizingConfig = {
11614   allowSetWidth: true,
11615   allowSetHeight: true,
11616   correction : false,
11617   adjustControl : false,
11618   supportPercentHeight: false,
11619   supportAutoHeight: false
11620  };
11621  this.percentSizeConfig = {
11622   width: -1,
11623   height: -1,
11624   markerWidth: -1,
11625   markerHeight: -1
11626  };  
11627 },
11628 InlineInitialize: function() {
11629  this.InitializeDOM();
11630  ASPxClientControlBase.prototype.InlineInitialize.call(this);
11631 },
11632 AfterCreate: function() { 
11633  ASPxClientControlBase.prototype.AfterCreate.call(this);
11634  if(!this.CanInitializeAdjustmentOnDOMContentLoaded() || ASPx.IsStartupScriptsRunning())
11635   this.InitializeAdjustment();
11636 },
11637 DOMContentLoaded: function() {
11638  if(this.CanInitializeAdjustmentOnDOMContentLoaded()) 
11639   this.InitializeAdjustment();
11640 },
11641 CanInitializeAdjustmentOnDOMContentLoaded: function() {
11642  return !ASPx.Browser.IE || ASPx.Browser.Version >= 10; 
11643 },
11644 InitializeAdjustment: function() {
11645  this.UpdateAdjustmentFlags();
11646  this.AdjustControl();
11647 },
11648 AfterInitialize: function() {
11649  this.AdjustControl();
11650  ASPxClientControlBase.prototype.AfterInitialize.call(this);
11651 },
11652 IsStateControllerEnabled: function(){
11653  return typeof(ASPx.GetStateController) != "undefined" && ASPx.GetStateController();
11654 },
11655 GetWidth: function() {
11656  return this.GetMainElement().offsetWidth;
11657 },
11658 GetHeight: function() {
11659  return this.GetMainElement().offsetHeight;
11660 },
11661 SetWidth: function(width) {
11662  if(this.sizingConfig.allowSetWidth)
11663   this.SetSizeCore("width", width, "GetWidth", false);
11664 },
11665 SetHeight: function(height) {
11666  if(this.sizingConfig.allowSetHeight)
11667   this.SetSizeCore("height", height, "GetHeight", false);
11668 },
11669 SetSizeCore: function(sizePropertyName, size, getFunctionName, corrected) {
11670  if(size < 0)
11671   return;
11672  this.GetMainElement().style[sizePropertyName] = size + "px";
11673  this.UpdateAdjustmentFlags(sizePropertyName);
11674  if(this.sizingConfig.adjustControl)
11675   this.AdjustControl(true);
11676  if(this.sizingConfig.correction && !corrected) {
11677   var realSize = this[getFunctionName]();
11678   if(realSize != size) {
11679    var correctedSize = size - (realSize - size);
11680    this.SetSizeCore(sizePropertyName, correctedSize, getFunctionName, true);
11681   }
11682  }
11683 },
11684 AdjustControl: function(nestedCall) {
11685  if(this.IsAdjustmentRequired() && (!ASPxClientControl.adjustControlLocked || nestedCall)) {
11686   ASPxClientControl.adjustControlLocked = true;
11687   try {
11688    if(!this.IsAdjustmentAllowed())
11689     return;
11690    this.AdjustControlCore();
11691    this.UpdateAdjustedSizes();
11692   } 
11693   finally {
11694    delete ASPxClientControl.adjustControlLocked;
11695   }
11696  }
11697  this.AssignEllipsisTooltips();
11698  this.TryShowPhantomLoadingElements();
11699 },
11700 ResetControlAdjustment: function () {
11701  this.adjustedSizes = { };
11702 },
11703 UpdateAdjustmentFlags: function(sizeProperty) {
11704  var mainElement = this.GetMainElement();
11705  if(mainElement) {
11706   var mainElementStyle = ASPx.GetCurrentStyle(mainElement);
11707   this.UpdatePercentSizeConfig([mainElementStyle.width, mainElement.style.width], [mainElementStyle.height, mainElement.style.height], sizeProperty);
11708  }
11709 },
11710 UpdatePercentSizeConfig: function(widths, heights, modifyStyleProperty) {
11711  switch(modifyStyleProperty) {
11712   case "width":
11713    this.UpdatePercentWidthConfig(widths);
11714    break;
11715   case "height":
11716    this.UpdatePercentHeightConfig(heights);
11717    break;
11718   default:
11719    this.UpdatePercentWidthConfig(widths);
11720    this.UpdatePercentHeightConfig(heights);
11721    break;
11722  }
11723  this.ResetControlPercentMarkerSize();
11724 },
11725 UpdatePercentWidthConfig: function(widths) {
11726  this.widthValueSetInPercentage = false;
11727  for(var i = 0; i < widths.length; i++) {
11728   if(this.IsPercentageWidth(widths[i])) {
11729    this.percentSizeConfig.width = widths[i];
11730    this.widthValueSetInPercentage = true;
11731    break;
11732   }
11733  }
11734 },
11735 IsPercentageWidth: function(width) { return ASPx.IsPercentageSize(width); },
11736 UpdatePercentHeightConfig: function(heights) {
11737  this.heightValueSetInPercentage = false;
11738    for(var i = 0; i < heights.length; i++) {
11739   if(ASPx.IsPercentageSize(heights[i])) {
11740    this.percentSizeConfig.height = heights[i];
11741    this.heightValueSetInPercentage = true;
11742    break;
11743   }
11744  }
11745 },
11746 GetAdjustedSizes: function() {
11747  var mainElement = this.GetMainElement();
11748  if(mainElement) 
11749   return { width: mainElement.offsetWidth, height: mainElement.offsetHeight };
11750  return { width: 0, height: 0 };
11751 },
11752 IsAdjusted: function() {
11753  return (this.adjustedSizes.width && this.adjustedSizes.width > 0) && (this.adjustedSizes.height && this.adjustedSizes.height > 0);
11754 },
11755 IsAdjustmentRequired: function() {
11756  if(!this.IsAdjusted())
11757   return true;
11758  if(this.widthValueSetInPercentage)
11759   return true;
11760  if(this.heightValueSetInPercentage)
11761   return true;
11762  var sizes = this.GetAdjustedSizes();
11763  for(var name in sizes){
11764   if(this.adjustedSizes[name] !== sizes[name])
11765    return true;
11766  }
11767  return false;
11768 },
11769 IsAdjustmentAllowed: function() {
11770  var mainElement = this.GetMainElement();
11771  return mainElement && this.IsDisplayed() && !this.IsHidden() && this.IsDOMInitialized();
11772 },
11773 UpdateAdjustedSizes: function() {
11774  var sizes = this.GetAdjustedSizes();
11775  for(var name in sizes)
11776   if(sizes.hasOwnProperty(name))
11777    this.adjustedSizes[name] = sizes[name];
11778 },
11779 AdjustControlCore: function() {
11780 },
11781 AdjustAutoHeight: function() {
11782 },
11783 IsControlCollapsed: function() {
11784  return this.isControlCollapsed;
11785 },
11786 NeedCollapseControl: function() {
11787  return this.NeedCollapseControlCore() && this.IsAdjustmentRequired() && this.IsAdjustmentAllowed();
11788 },
11789 NeedCollapseControlCore: function() {
11790  return false;
11791 },
11792 CollapseEditor: function() {
11793 },
11794 CollapseControl: function() {
11795  this.SaveScrollPositions();
11796  var mainElement = this.GetMainElement(),
11797   marker = this.GetControlPercentSizeMarker();
11798  marker.style.height = this.heightValueSetInPercentage && this.sizingConfig.supp
11798ortPercentHeight
11799   ? this.percentSizeConfig.height 
11800   : (mainElement.offsetHeight + "px");
11801  mainElement.style.display = "none";
11802  this.isControlCollapsed = true;
11803 },
11804 ExpandControl: function() {
11805  var mainElement = this.GetMainElement();
11806  mainElement.style.display = "";
11807  this.GetControlPercentSizeMarker().style.height = "0px";
11808  this.isControlCollapsed = false;
11809  this.RestoreScrollPositions();
11810 },
11811 CanCauseReadjustment: function() {
11812  return this.NeedCollapseControlCore();
11813 },
11814 IsExpandableByAdjustment: function() {
11815  return false;
11816 },
11817 HasFixedPosition: function() {
11818  return false;
11819 },
11820 SaveScrollPositions: function() {
11821  var mainElement = this.GetMainElement();
11822  this.scrollPositionState.outer = ASPx.GetOuterScrollPosition(mainElement.parentNode);
11823  this.scrollPositionState.inner = ASPx.GetInnerScrollPositions(mainElement);
11824 },
11825 RestoreScrollPositions: function() {
11826  ASPx.RestoreOuterScrollPosition(this.scrollPositionState.outer);
11827  ASPx.RestoreInnerScrollPositions(this.scrollPositionState.inner);
11828 },
11829 GetControlPercentSizeMarker: function() {
11830  if(this.percentSizeMarker === undefined) {
11831   this.percentSizeMarker = ASPx.CreateHtmlElementFromString("<div style='height:0px;font-size:0px;line-height:0;width:100%;'></div>");
11832   ASPx.InsertElementAfter(this.percentSizeMarker, this.GetMainElement());
11833  }
11834  return this.percentSizeMarker;
11835 },
11836 KeepControlPercentSizeMarker: function(needCollapse, needCalculateHeight) {
11837  var marker = this.GetControlPercentSizeMarker(),
11838   markerHeight;
11839  if(needCollapse)
11840   this.CollapseControl();
11841  if(this.widthValueSetInPercentage && marker.style.width !== this.percentSizeConfig.width)
11842   marker.style.width = this.percentSizeConfig.width;
11843  if(needCalculateHeight) {
11844   if(this.IsControlCollapsed())
11845    markerHeight = marker.style.height;
11846   marker.style.height = this.percentSizeConfig.height;
11847  }
11848  this.percentSizeConfig.markerWidth = marker.offsetWidth;
11849  if(needCalculateHeight) {
11850   this.percentSizeConfig.markerHeight = marker.offsetHeight;
11851   if(this.IsControlCollapsed())
11852    marker.style.height = markerHeight;
11853   else
11854    marker.style.height = "0px";
11855  }
11856  if(needCollapse)
11857   this.ExpandControl();
11858 },
11859 ResetControlPercentMarkerSize: function() {
11860  this.percentSizeConfig.markerWidth = -1;
11861  this.percentSizeConfig.markerHeight = -1;
11862 },
11863 GetControlPercentMarkerSize: function(hideControl, force) {
11864  var needCalculateHeight = this.heightValueSetInPercentage && this.sizingConfig.supportPercentHeight;
11865  if(force || this.percentSizeConfig.markerWidth < 1 || (needCalculateHeight && this.percentSizeConfig.markerHeight < 1))
11866   this.KeepControlPercentSizeMarker(hideControl && !this.IsControlCollapsed(), needCalculateHeight);
11867  return {
11868   width: this.percentSizeConfig.markerWidth,
11869   height: this.percentSizeConfig.markerHeight
11870  };
11871 },
11872 AssignEllipsisTooltips: function() {
11873  if(this.RequireAssignTooltips())
11874   this.AssignEllipsisTooltipsCore();
11875 },
11876 AssignEllipsisTooltipsCore: function(rootElement, reassingExistingTooltips) {
11877  var requirePaddingManipulation = ASPx.Browser.IE || ASPx.Browser.Edge || ASPx.Browser.Firefox;
11878  rootElement = rootElement || this.GetMainElement();
11879  var nodes = this.GetEllipsisNodes(rootElement);
11880  var nodeInfos = [];
11881  var nodesCount = nodes.length;
11882  for(var i = 0; i < nodesCount; i++) {
11883   var node = nodes[i];
11884   var info = { node: node };
11885   if(requirePaddingManipulation) {
11886    var style = ASPx.GetCurrentStyle(node);
11887    info.paddingLeft = node.style.paddingLeft;
11888    info.totalPadding = ASPx.GetLeftRightPaddings(node, style);
11889   }
11890   nodeInfos.push(info);
11891  }
11892  if(requirePaddingManipulation) {
11893   for(var i = 0; i < nodesCount; i++) {
11894    var info = nodeInfos[i];
11895    ASPx.SetStyles(info.node, { paddingLeft: info.totalPadding }, true);
11896   }
11897  }
11898  for(var i = 0; i < nodesCount; i++) {
11899   var info = nodeInfos[i];
11900   var node = info.node;
11901   info.isTextShortened = node.scrollWidth > node.clientWidth;
11902   info.hasTitle = ASPx.Attr.GetAttribute(node, "title") !== null;
11903   if(!info.hasTitle || reassingExistingTooltips)
11904    info.title = this.GetEllipsisTooltipText(node);
11905  }
11906  for(var i = 0; i < nodesCount; i++) {
11907   var info = nodeInfos[i];
11908   var node = info.node;
11909   if(info.isTextShortened && info.title) {
11910    ASPx.Attr.SetAttribute(node, "title", info.title);
11911    ASPx.Attr.SetAttribute(node, ELLIPSIS_TOOLTIP_MARKER_ATTR, true);
11912   }
11913   if(!info.isTextShortened && info.hasTitle)
11914    ASPx.Attr.RemoveAttribute(node, "title");
11915  }
11916  if(requirePaddingManipulation) {
11917   for(var i = 0; i < nodesCount; i++) {
11918    var info = nodeInfos[i];
11919    var node = info.node;
11920    node.style.paddingLeft = info.paddingLeft;
11921   }
11922  }
11923 },
11924 GetEllipsisNodes: function(element) {
11925  var ellipsibleNodes = ASPx.Data.CollectionToArray(ASPx.GetNodesByClassName(element, ELLIPSIS_MARKER_CLASS));
11926  if(ASPx.ElementHasCssClass(element, ELLIPSIS_MARKER_CLASS))
11927   ellipsibleNodes.push(element);
11928  return ellipsibleNodes.filter(function(node) {
11929   return !ASPx.Attr.IsExistsAttribute(node, "title") || ASPx.Attr.IsExistsAttribute(node, ELLIPSIS_TOOLTIP_MARKER_ATTR);
11930  });
11931 },
11932 GetEllipsisTooltipText: function(element) {
11933  if(element && ASPx.IsExists(element.innerText))
11934   return element.innerText;
11935  return ASPx.GetInnerText(element);
11936 },
11937 RequireAssignTooltips: function() {
11938  return this.enableEllipsis && !ASPx.Browser.MobileUI;
11939 },
11940 OnBrowserWindowResize: function(e) {
11941 },
11942 OnBrowserWindowResizeInternal: function(e){
11943  if(this.BrowserWindowResizeSubscriber()) 
11944   this.OnBrowserWindowResize(e);
11945 },
11946 BrowserWindowResizeSubscriber: function() {
11947  return this.widthValueSetInPercentage || !this.IsAdjusted();
11948 },
11949 ShrinkWrappedText: function(getElements, key, reCorrect) {
11950  if(!ASPx.Browser.Safari) return;
11951  var elements = ASPx.CacheHelper.GetCachedElements(this, key, getElements, this.wrappedTextContainers);
11952  for(var i = 0; i < elements.length; i++)
11953   this.ShrinkWrappedTextInContainer(elements[i], reCorrect);
11954 },
11955 ShrinkWrappedTextInContainer: function(container, reCorrect) {
11956  if(!ASPx.Browser.Safari || !container || (container.dxWrappedTextShrinked && !reCorrect) || container.offsetWidth === 0) return;
11957  ASPx.ShrinkWrappedTextInContainer(container);
11958  container.dxWrappedTextShrinked = true;
11959 },
11960 CorrectWrappedText: function(getElements, key, reCorrect) {
11961  var elements = ASPx.CacheHelper.GetCachedElements(this, key, getElements, this.wrappedTextContainers);
11962  for(var i = 0; i < elements.length; i++)
11963   this.CorrectWrappedTextInContainer(elements[i], reCorrect);
11964 },
11965 CorrectWrappedTextInContainer: function(container, reCorrect) {
11966  if(!container || (container.dxWrappedTextCorrected && !reCorrect) || container.offsetWidth === 0) return;
11967  ASPx.AdjustWrappedTextInContainer(container);
11968  container.dxWrappedTextCorrected = true;
11969 },
11970 CorrectVerticalAlignment: function(alignMethod, getElements, key, reAlign) {
11971  var elements = ASPx.CacheHelper.GetCachedElements(this, key, getElements, this.verticalAlignedElements);
11972  for(var i = 0; i < elements.length; i++)
11973   this.CorrectElementVerticalAlignment(alignMethod, elements[i], reAlign);
11974 },
11975 CorrectElementVerticalAlignment: function(alignMethod, element, reAlign) {
11976  if(!element || (element.dxVerticalAligned && !reAlign) || element.offsetHeight === 0) return;
11977  alignMethod(element);
11978  element.dxVerticalAligned = true;
11979 },
11980 ClearVerticalAlignedElementsCache: function() {
11981  ASPx.CacheHelper.DropCache(this.verticalAlignedElements);
11982 },
11983 ClearWrappedTextContainersCache: function() {
11984  ASPx.CacheHelper.DropCache(this.wrappedTextContainers);
11985 },
11986 AdjustPagerControls: function() {
11987  if(typeof(ASPx.GetPagersCollection) != "undefined")
11988   ASPx.GetPagersCollection().AdjustControls(this.GetMainElement());
11989 },
11990 RegisterInControlTree: function(tree) {
11991  var mainElement = this.GetMainElement();
11992  if(mainElement && mainElement.id)
11993   tree.createNode(mainElement.id, this);
11994 },
11995 GetItemElementName: function(element) {
11996  var name = "";
11997  if(element.id)
11998   name = element.id.substring(this.name.length + 1);
11999  return name;
12000 },
12001 GetLinkElement: function(element) {
12002  if(element == null) return null;
12003  return (element.tagName == "A") ? element : ASPx.GetNodeByTagName(element, "A", 0);
12004 },
12005 GetInternalHyperlinkElement: function(parentElement, index) {
12006  var element = ASPx.GetNodeByTagName(parentElement, "A", index);
12007  if(element == null) 
12008   element = ASPx.GetNodeByTagName(parentElement, "SPAN", index);
12009  return element;
12010 },
12011 OnControlClick: function(clickedElement, htmlEvent) {
12012 }
12013});
12014ASPxClientControl.Cast = function(obj) {
12015 if(typeof obj == "string")
12016  return window[obj];
12017 return obj;
12018};
12019ASPxClientControl.AdjustControls = function(container, collapseControls){
12020 aspxGetControlCollection().AdjustControls(container, collapseControls);
12021};
12022ASPxClientControl.GetControlCollection = function(){
12023 return aspxGetControlCollection();
12024};
12025ASPxClientControl.LeadingAfterInitCallConsts = {
12026 None: 0,
12027 Direct: 1,
12028 Reverse: 2
12029};
12030var ASPxClientComponent = ASPx.CreateClass(ASPxClientControl, {
12031 constructor: function (name) {
12032  this.constructor.prototype.constructor.call(this, name);
12033 },
12034 IsDOMDisposed: function() { 
12035  return false;
12036 }
12037});
12038var ASPxClientControlCollection = ASPx.CreateClass(ASPx.CollectionBase, {
12039 constructor: function(){
12040  this.constructor.prototype.constructor.call(this);
12041  this.prevWndWidth = "";
12042  this.prevWndHeight = "";
12043  this.requestCountInternal = 0; 
12044  this.BeforeInitCallback = new ASPxClientEvent();
12045  this.ControlsInitialized = new ASPxClientEvent();
12046  this.BrowserWindowResized = new ASPxClientEvent();
12047  this.BeginCallback = new ASPxClientEvent();
12048  this.EndCallback = new ASPxClientEvent();
12049  this.CallbackError = new ASPxClientEvent();
12050  this.ValidationCompleted = new ASPxClientEvent();
12051  aspxGetControlCollectionCollection().Add(this);
12052 },
12053 Add: function(element) {
12054  var existsElement = this.Get(element.name);
12055  if(existsElement && existsElement !== element) 
12056   this.Remove(existsElement);
12057  ASPx.CollectionBase.prototype.Add.call(this, element.name, element);
12058 },
12059 Remove: function(element) {
12060  if(element && element instanceof ASPxClientControl)
12061   element.OnDispose();
12062  ASPx.CollectionBase.prototype.Remove.call(this, element.name);
12063 },
12064 GetGlobal: function(name) {
12065  var result = window[name];
12066  return result && Ident.IsASPxClientControl(result)
12067   ? result
12068   : null;
12069 },
12070 GetByName: function(name){
12071  return this.Get(name) || this.GetGlobal(name);
12072 },
12073 GetCollectionType: function(){
12074  return ASPxClientControlCollection.BaseCollectionType;
12075 },
12076 GetControlsByPredicate: function(predicate) {
12077  var result = [];
12078  this.ForEachControl(function(control) {
12079   if(!predicate || predicate(control))
12080    result.push(control);
12081  });
12082  return result;
12083 },
12084 GetControlsByType: function(type) {
12085  return this.GetControlsByPredicate(function(control) { 
12086   return type && (control instanceof type);
12087  });
12088 },
12089 ForEachControl: function(action, context) {
12090  context = context || this;
12091  this.elementsMap.forEachEntry(function(name, control) {
12092   if(Ident.IsASPxClientControl(control))
12093    return action.call(context, control);
12094  }, context);
12095 },
12096 adjustControlsInternal: function(container, context, collapseControls, adjustFunc) {
12097  context = context || this;
12098  var func = function(control) {
12099   adjustFunc.call(context, control);
12100  };
12101  ASPx.GetControlAdjuster().adjustControlsInHierarchy(this, func, container, collapseControls);
12102 },
12103 AdjustControls: function(container, collapseControls) {
12104  container = container || null;
12105  window.setTimeout(function() {
12106   this.AdjustControlsCore(container, collapseControls);
12107  }.aspxBind(this), 0);
12108 },
12109 AdjustControlsCore: function(container, collapseControls) {
12110  this.adjustControlsInternal(container, this, collapseControls, function(control) {
12111   control.AdjustControl();
12112  });
12113 },
12114 CollapseControls: function(container) {
12115  this.ProcessControlsInContainer(container, function(control) {
12116   if(control.isASPxClientEdit)
12117    control.CollapseEditor();
12118   else if(!!window.ASPxClientRibbon && control instanceof ASPxClientRibbon)
12119    control.CollapseControl();
12120  });
12121 },
12122 AtlasInitialize: function(isCallback) {
12123  this.ForEachControl(function(control) {
12124   control.AtlasPreInitialize();
12125  });
12126  ASPx.ProcessScriptsAndLinks("", isCallback);
12127  this.ForEachControl(function(control) {
12128   control.AtlasInitialize();
12129  });
12130 },
12131 DOMContentLoaded: function() {
12132  this.ForEachControl(function(control){
12133    control.DOMContentLoaded();
12134  });
12135 },
12136 OnDocumentUnload: function() {
12137  this.ForEachControl(function(control) {
12138   control.RaiseUnload();
12139  });
12140 },
12141 Initialize: function() {
12142  ASPx.GetPostHandler().Post.AddHandler(
12143   function(s, e) { this.OnPost(e); }.aspxBind(this)
12144  );
12145  ASPx.GetPostHandler().PostFinalization.AddHandler(
12146   function(s, e) { this.OnPostFinalization(e); }.aspxBind(this)
12147  );
12148  this.InitializeElements(false );
12149  if(typeof(Sys) != "undefined" && typeof(Sys.Application) != "undefined") {
12150   var checkIsInitialized = function() {
12151    if(Sys.Application.get_isInitialized())
12152     Sys.Application.add_load(aspxCAInit);
12153    else
12154     setTimeout(checkIsInitialized, 0);
12155   };
12156   checkIsInitialized();
12157  }
12158  this.InitWindowSizeCache();
12159 },
12160 FinalizeInitialization: function() {
12161  this.ForEachControl(function(control) {
12162   control.FinalizeInitialization();
12163  });
12164 },
12165 InitializeElements: function(isCallback) {
12166  this.ForEachControl(function(control){
12167   if(!control.isInitialized)
12168    control.Initialize();
12169  });
12170  this.AfterInitializeElementsLeadingCall();
12171  this.AfterInitializeElements();
12172  this.RaiseControlsInitialized(isCallback);
12173 },
12174 AfterInitializeElementsLeadingCall: function() {
12175  var controls = {};
12176  controls[ASPxClientControl.LeadingAfterInitCallConsts.Direct] = [];
12177  controls[ASPxClientControl.LeadingAfterInitCallConsts.Reverse] = [];
12178  this.ForEachControl(function(control) {
12179   if(control.leadingAfterInitCall != ASPxClientControl.LeadingAfterInitCallConsts.None && !control.isInitialized)
12180    controls[control.leadingAfterInitCall].push(control);
12181  });
12182  var directInitControls = controls[ASPxClientControl.LeadingAfterInitCallConsts.Direct],
12183   reverseInitControls = controls[ASPxClientControl.LeadingAfterInitCallConsts.Reverse];
12184  for(var i = 0, control; control = directInitControls[i]; i++)
12185   control.AfterInitialize();
12186  for(var i = reverseInitControls.length - 1, control; control = reverseInitControls[i]; i--)
12187   control.AfterInitialize();
12188 },
12189 AfterInitializeElements: function() {
12190  this.ForEachControl(function(control) {
12191   if(control.leadingAfterInitCall == ASPxClientControl.LeadingAfterInitCallConsts.None && !control.isInitialized)
12192    control.AfterInitialize();
12193  });
12194  ASPx.RippleHelper.Init();
12195 },
12196 DoFinalizeCallback: function() {
12197  this.ForEachControl(function(control){
12198   control.DoFinalizeCallback();
12199  });
12200 },
12201 ProcessControlsInContainer: function(container, processFunc, filterFunc) {
12202  this.ForEachControl(function(control){
12203   if((!filterFunc || filterFunc(control)) && (!container || this.IsControlInContainer(container, control)))
12204    processFunc(control);
12205  });
12206 },
12207 IsControlInContainer: function(container, control) {
12208  if(control.GetMainElement) {
12209   var mainElement = control.GetMainElement();
12210   if(mainElement && (mainElement != container)) {
12211    if(ASPx.GetIsParent(container, mainElement))
12212     return true;
12213   }
12214  }
12215  return false;
12216 },
12217 RaiseControlsInitialized: function(isCallback) {
12218  if(typeof(isCallback) == "undefined")
12219   isCallback = true;
12220  var args = new ASPxClientControlsInitializedEventArgs(isCallback);
12221  if(!this.ControlsInitialized.IsEmpty())  
12222   this.ControlsInitialized.FireEvent(this, args);
12223  this.ForEachControl(function(control){
12224   control.OnGlobalControlsInitialized(args);
12225  });
12226 },
12227 RaiseBrowserWindowResized: function() {
12228  var args = new ASPxClientEventArgs();
12229  if(!this.BrowserWindowResized.IsEmpty())
12230   this.BrowserWindowResized.FireEvent(this, args);
12231  this.ForEachControl(function(control){
12232   control.OnGlobalBrowserWindowResized(args);
12233  });
12234 },
12235 RaiseBeginCallback: function (control, command) {
12236  var args = new ASPxClientGlobalBeginCallbackEventArgs(control, command);
12237  if(!this.BeginCallback.IsEmpty())
12238   this.BeginCallback.FireEvent(this, args);
12239  this.ForEachControl(function(control){
12240   control.OnGlobalBeginCallback(args);
12241  });
12242  this.IncrementRequestCount();
12243 },
12244 RaiseEndCallback: function (control) {
12245  var args = new ASPxClientGlobalEndCallbackEventArgs(control);
12246  if (!this.EndCallback.IsEmpty()) 
12247   this.EndCallback.FireEvent(this, args);
12248  this.ForEachControl(function(control){
12249   control.OnGlobalEndCallback(args);
12250  });
12251  this.DecrementRequestCount();
12252 },
12253 InCallback: function() {
12254  return this.requestCountInternal > 0;
12255 },
12256 RaiseCallbackError: function (control, message, callbackId) {
12257  var args = new ASPxClientGlobalCallbackErrorEventArgs(control, message, callbackId);
12258  if (!this.CallbackError.IsEmpty()) 
12259   this.CallbackError.FireEvent(this, args);
12260  this.ForEachControl(function(control){
12261   control.OnGlobalCallbackError(args);
12262  });
12263  if(args.handled)
12264   return { isHandled: true, errorMessage: args.message };  
12265  return { isHandled: false, errorMessage: message };
12266 },
12267 RaiseValidationCompleted: function (container, validationGroup, invisibleControlsValidated, isValid, firstInvalidControl, firstVisibleInvalidControl) {
12268  var args = new ASPxClientValidationCompletedEventArgs(container, validationGroup, invisibleControlsValidated, isValid, firstInvalidControl, firstVisibleInvalidControl);
12269  if (!this.ValidationCompleted.IsEmpty()) 
12270   this.ValidationCompleted.FireEvent(this, args);
12271  this.ForEachControl(function(control){
12272   control.OnGlobalValidationCompleted(args);
12273  });
12274 },
12275 Before_WebForm_InitCallback: function(callbackOwnerID){
12276  var args = new BeforeInitCallbackEventArgs(callbackOwnerID);
12277  this.BeforeInitCallback.FireEvent(this, args);
12278 },
12279 InitWindowSizeCache: function(){
12280  this.prevWndWidth = ASPx.GetDocumentClientWidth();
12281  this.prevWndHeight = ASPx.GetDocumentClientHeight();
12282 },
12283 OnBrowserWindowResize: function(evt){
12284  var shouldIgnoreNestedEvents = ASPx.Browser.IE && ASPx.Browser.MajorVersion == 8;
12285  if(shouldIgnoreNestedEvents) {
12286   if(this.prevWndWidth === "" || this.prevWndHeight === "" || this.browserWindowResizeLocked)
12287    return;
12288   this.browserWindowResizeLocked = true;
12289  }
12290  this.OnBrowserWindowResizeCore(evt);
12291  if(shouldIgnoreNestedEvents)
12292   this.browserWindowResizeLocked = false;
12293 },
12294 OnBrowserWindowResizeCore: function(htmlEvent){
12295  var args = this.CreateOnBrowserWindowResizeEventArgs(htmlEvent);
12296  if(this.CalculateIsBrowserWindowSizeChanged()) {
12297   this.adjustControlsInternal(null, this, true, function(control) {
12298    if(control.IsDOMInitialized())
12299     control.OnBrowserWindowResizeInternal(args);
12300   });
12301   this.RaiseBrowserWindowResized();
12302  }
12303 },
12304 CreateOnBrowserWindowResizeEventArgs: function(htmlEvent){
12305  return {
12306   htmlEvent: htmlEvent,
12307   wndWidth: ASPx.GetDocumentClientWidth(),
12308   wndHeight: ASPx.GetDocumentClientHeight(),
12309   prevWndWidth: this.prevWndWidth,
12310   prevWndHeight: this.prevWndHeight
12311  };
12312 },
12313 CalculateIsBrowserWindowSizeChanged: function(){
12314  var wndWidth = ASPx.GetDocumentClientWidth();
12315  var wndHeight = ASPx.GetDocumentClientHeight();
12316  var isBrowserWindowSizeChanged = (this.prevWndWidth != wndWidth) || (this.prevWndHeight != wndHeight);
12317  if(isBrowserWindowSizeChanged){
12318   this.prevWndWidth = wndWidth;
12319   this.prevWndHeight = wndHeight;
12320   return true;
12321  }
12322  return false;
12323 },
12324 OnPost: function(args){
12325  this.ForEachControl(function(control) {
12326   control.OnPost(args);
12327  }, null);
12328 },
12329 OnPostFinalization: function(args){
12330  this.ForEachControl(function(control) {
12331   control.OnPostFinalization(args);
12332  }, null);
12333 },
12334 IncrementRequestCount: function() {
12335  this.requestCountInternal++;
12336 },
12337 DecrementRequestCount: function() {
12338  this.requestCountInternal--;
12339 },
12340 ResetRequestCount: function() {
12341  this.requestCountInternal = 0;
12342 }
12343});
12344ASPxClientControlCollection.BaseCollectionType = "Control";
12345var controlCollection = null;
12346function aspxGetControlCollection(){
12347 if(controlCollection == null) 
12348  controlCollection = new ASPxClientControlCollection();
12349 return controlCollection;
12350}
12351var ControlCollectionCollection = ASPx.CreateClass(ASPx.CollectionBase, {
12352 constructor: function(){
12353  this.constructor.prototype.constructor.call(this);
12354 },
12355 Add: function(element) {
12356  var key = element.GetCollectionType();
12357  if(!key) throw "The collection type isn't specified.";
12358  if(this.Get(key)) throw "The collection with type='" + key + "' already exists.";
12359  ASPx.CollectionBase.prototype.Add.call(this, key, element);
12360 },
12361 RemoveDisposedControls: function(){
12362  var baseCollection = this.Get(ASPxClientControlCollection.BaseCollectionType);
12363  var disposedControls = [];
12364  baseCollection.elementsMap.forEachEntry(function(name, control) {
12365   if(!ASPx.Ident.IsASPxClientControl(control)) return;
12366   if(control.IsDOMDisposed())
12367    disposedControls.push(control);
12368  });
12369  this.RemoveControls(disposedControls);
12370 },
12371 RemoveControls: function(controls){
12372  for(var i = 0; i < controls.length; i++) {
12373   this.elementsMap.forEachEntry(function(key, collection) {
12374    if(ASPx.Ident.IsASPxClientCollection(collection))
12375     collection.Remove(controls[i]);
12376   });
12377  }
12378 }
12379});
12380var controlCollectionCollection = null;
12381function aspxGetControlCollectionCollection(){
12382 if(controlCollectionCollection == null)
12383  controlCollectionCollection = new ControlCollectionCollection();
12384 return controlCollectionCollection;
12385}
12386var AriaDescriptionAttributes = {
12387 Role: "0",
12388 AriaLabel: "1",
12389 TabIndex: "2",
12390 AriaOwns: "3",
12391 AriaDescribedBy: "4",
12392 AriaDisabled: "5",
12393 AriaHasPopup: "6",
12394 AriaLevel: "7"
12395};
12396var AriaDescriptor = ASPx.CreateClass(null, {
12397 constructor: function(ownerControl, description) {
12398  this.ownerControl = ownerControl;
12399  this.rootElement = ownerControl.GetMainElement();
12400  this.description = description;
12401 },
12402 setDescription: function(name, argList) {
12403  var description = this.findChildDescription(name);
12404  if(description) {
12405   var elements = name ? this.rootElement.querySelectorAll(this.getDescriptionSelector(description)) : [this.rootElement];
12406   for(var i = 0; i < elements.length; i++)
12407    this.applyDescriptionToElement(elements[i], description, argList[i] || argList[0]);
12408  }
12409 },
12410 getDescriptionName: function(description) {
12411  return description.n;
12412 },
12413 getDescriptionSelector: function(description) {
12414  return description.s;
12415 },
12416 findChildDescription: function(name) {
12417  if(name === this.getDescriptionName(this.description))
12418   return this.description;
12419  var childCollection = this.description.c || [];
12420  for(var i = 0; i < childCollection.length; i++) {
12421   var childDescription = childCollection[i];
12422   if(this.getDescriptionName(childDescription) === name)
12423    return childDescription;
12424  }
12425  return null;
12426 },
12427 applyDescriptionToElement: function(element, description, args) {
12428  if(!description || !element)
12429   return;
12430  this.trySetAriaOwnsAttribute(element, description);
12431  this.trySetAriaDescribedByAttribute(element, description);
12432  this.trySetAttribute(element, description, AriaDescriptionAttributes.Role, "role");
12433  this.trySetAttribute(element, description, AriaDescriptionAttributes.TabIndex, "tabindex");
12434  this.trySetAttribute(element, description, AriaDescriptionAttributes.AriaLevel, "aria-level");
12435  this.executeOnDescription(description, AriaDescriptionAttributes.AriaLabel, function(value) {
12436   ASPx.Attr.SetAttribute(element, "aria-label", ASPx.Str.ApplyReplacement(value, args));
12437  });
12438  this.executeOnDescription(description, AriaDescriptionAttributes.AriaDisabled, function(value) {
12439   ASPx.Attr.SetAttribute(element, "aria-disabled", !!value); 
12440  });
12441  this.executeOnDescription(description, AriaDescriptionAttributes.AriaHasPopup, function(value) {
12442   ASPx.Attr.SetAttribute(element, "aria-haspopup", !!value);
12443  });
12444 },
12445 trySetAriaDescribedByAttribute: function(element, description) {
12446  this.executeOnDescription(description, AriaDescriptionAttributes.AriaDescribedBy, function(selectorInfo) {
12447   var descriptor = this.getNodesBySelector(element, selectorInfo.descriptorSelector)[0];
12448   var target = this.getNodesBySelector(element, selectorInfo.targetSelector)[0];
12449   if(!target || !descriptor)
12450    return;
12451   ASPx.Attr.SetAttribute(target, "aria-describedby", this.getNodeId(descriptor));
12452  });
12453 },
12454 trySetAriaOwnsAttribute: function(element, description) {
12455  this.executeOnDescription(description, AriaDescriptionAttributes.AriaOwns, function(selector) {
12456   var ownedNodes = this.getNodesBySelector(element, selector);
12457   var ariaOwnsAttributeValue = "";
12458   for(var i = 0; i < ownedNodes.length; i++)
12459    ariaOwnsAttributeValue += (this.getNodeId(ownedNodes[i]) + (i != ownedNodes.length - 1 ? " " : ""));
12460   ASPx.Attr.SetAttribute(element, "aria-owns", ariaOwnsAttributeValue);
12461  });
12462 },
12463 trySetAttribute: function(element, description, ariaAttribute, attributeName) {
12464  this.executeOnDescription(description, ariaAttribute, function(value) { 
12465   ASPx.Attr.SetAttribute(element, attributeName, description[ariaAttribute]); 
12466  });
12467 },
12468 executeOnDescription: function(description, ariaDescAttr, callback) {
12469  var descInfo = description[ariaDescAttr];
12470  if(ASPx.IsExists(descInfo))
12471   callback.aspxBind(this)(descInfo);
12472 },
12473 getNodesBySelector: function(element, selector) {
12474  var id = element.id || "";
12475  var childNodes = element.querySelectorAll("#" + this.getNodeId(element) + " > " + selector);
12476  ASPx.Attr.SetOrRemoveAttribute(element, "id", id);
12477  return childNodes;
12478 },
12479 getNodeId: function(node) {
12480  if(!node.id)
12481   node.id = this.createRandomId();
12482  return node.id; 
12483 },
12484 createRandomId: function() {
12485  return "r" + ASPx.CreateGuid();
12486 }
12487});
12488PagerCommands = {
12489 Next : "PBN",
12490 Prev : "PBP",
12491 Last : "PBL",
12492 First : "PBF",
12493 PageNumber : "PN",
12494 PageSize : "PSP"
12495};
12496ASPx.Callback = function(result, context){
12497 var collection = aspxGetControlCollection();
12498 collection.DoFinalizeCallback();
12499 var control = collection.Get(context);
12500 if(control != null)
12501  control.DoCallback(result);
12502 ASPx.RippleHelper.ReInit();
12503};
12504ASPx.CallbackError = function(result, context){
12505 var control = aspxGetControlCollection().Get(context);
12506 if(control != null)
12507  control.DoCallbackError(result, false);
12508};
12509ASPx.CClick = function(name, evt) {
12510 var control = aspxGetControlCollection().Get(name);
12511 if(control != null) control.DoControlClick(evt);
12512};
12513function aspxCAInit() {
12514 var isAppInit = typeof(Sys$_Application$initialize) != "undefined" &&
12515  ASPx.FunctionIsInCallstack(arguments.callee, Sys$_Application$initialize, 10 );
12516 aspxGetControlCollection().AtlasInitialize(!isAppInit);
12517}
12518ASPx.Evt.AttachEventToElement(window, "resize", aspxGlobalWindowResize);
12519function aspxGlobalWindowResize(evt){
12520 aspxGetControlCollection().OnBrowserWindowResize(evt); 
12521}
12522ASPx.Evt.AttachEventToElement(window, "unload", aspxClassesUnload);
12523function aspxClassesUnload(evt) {
12524 aspxGetControlCollection().OnDocumentUnload();
12525}
12526ASPx.Evt.AttachEventToElement(window.document, "DOMContentLoaded", aspxClassesDOMContentLoaded);
12527function aspxClassesDOMContentLoaded(evt){
12528 aspxGetControlCollection().DOMContentLoaded();
12529}
12530ASPx.GetControlCollection = aspxGetControlCollection;
12531ASPx.GetControlCollectionCollection = aspxGetControlCollectionCollection;
12532ASPx.GetPersistentControlPropertiesStorage = _aspxGetPersistentControlPropertiesStorage;
12533ASPx.PagerCommands = PagerCommands;
12534window.ASPxClientBeginCallbackEventArgs = ASPxClientBeginCallbackEventArgs;
12535window.ASPxClientGlobalBeginCallbackEventArgs = ASPxClientGlobalBeginCallbackEventArgs;
12536window.ASPxClientEndCallbackEventArgs = ASPxClientEndCallbackEventArgs;
12537window.ASPxClientGlobalEndCallbackEventArgs = ASPxClientGlobalEndCallbackEventArgs;
12538window.ASPxClientCallbackErrorEventArgs = ASPxClientCallbackErrorEventArgs;
12539window.ASPxClientGlobalCallbackErrorEventArgs = ASPxClientGlobalCallbackErrorEventArgs;
12540window.ASPxClientCustomDataCallbackEventArgs = ASPxClientCustomDataCallbackEventArgs;
12541window.ASPxClientValidationCompletedEventArgs = ASPxClientValidationCompletedEventArgs;
12542window.ASPxClientControlsInitializedEventArgs = ASPxClientControlsInitializedEventArgs;
12543window.ASPxClientControlBeforePronounceEventArgs = ASPxClientControlBeforePronounceEventArgs;
12544window.ASPxClientControlUnloadEventArgs = ASPxClientControlUnloadEventArgs;
12545window.ASPxClientControlCollection = ASPxClientControlCollection;
12546window.ASPxClientControlBase = ASPxClientControlBase;
12547window.ASPxClientControl = ASPxClientControl;
12548window.ASPxClientComponent = ASPxClientComponent;
12549})();
12550(function () {
12551 var PositionAnimationTransition = ASPx.CreateClass(ASPx.AnimationTransitionBase, {
12552  constructor: function (element, options) {
12553   this.constructor.prototype.constructor.call(this, element, options);
12554   this.direction = options.direction;
12555   this.animationTransition = this.createAnimationTransition();
12556   AnimationHelper.appendWKAnimationClassNameIfRequired(this.element);
12557  },
12558  Start: function (to) {
12559   var from = this.GetValue();
12560   if(ASPx.AnimationUtils.CanUseCssTransform()) {
12561    from = this.convertPosToCssTransformPos(from);
12562    to = this.convertPosToCssTransformPos(to);
12563   }
12564   this.animationTransition.Start(from, to);
12565  },
12566  SetValue: function (value) {
12567   ASPx.AnimationUtils.SetTransformValue(this.element, value, this.direction == AnimationHelper.SLIDE_VERTICAL_DIRECTION);
12568  },
12569  GetValue: function () {
12570   return ASPx.AnimationUtils.GetTransformValue(this.element, this.direction == AnimationHelper.SLIDE_VERTICAL_DIRECTION);
12571  },
12572  createAnimationTransition: function () {
12573   var transition = ASPx.AnimationUtils.CanUseCssTransform() ? this.createTransformAnimationTransition() : this.createPositionAnimationTransition();
12574   transition.transition = ASPx.AnimationConstants.Transitions.POW_EASE_OUT;
12575   return transition;
12576  },
12577  createTransformAnimationTransition: function () {
12578   return ASPx.AnimationUtils.createCssAnimationTransition(this.element, {
12579    property: ASPx.AnimationUtils.CanUseCssTransform(),
12580    duration: this.duration,
12581    onComplete: this.onComplete
12582   });
12583  },
12584  createPositionAnimationTransition: function () {
12585   return AnimationHelper.createAnimationTransition(this.element, {
12586    property: this.direction == AnimationHelper.SLIDE_VERTICAL_DIRECTION ? "top" : "left",
12587    unit: "px",
12588    duration: this.duration,
12589    onComplete: this.onComplete
12590   });
12591  },
12592  convertPosToCssTransformPos: function (position) {
12593   return ASPx.AnimationUtils.GetTransformCssText(position, this.direction == AnimationHelper.SLIDE_VERTICAL_DIRECTION);
12594  }
12595 });
12596 var AnimationHelper = {
12597  SLIDE_HORIZONTAL_DIRECTION: 0,
12598  SLIDE_VERTICAL_DIRECTION: 1,
12599  SLIDE_TOP_DIRECTION: 0,
12600  SLIDE_RIGHT_DIRECTION: 1,
12601  SLIDE_BOTTOM_DIRECTION: 2,
12602  SLIDE_LEFT_DIRECTION: 3,
12603  SLIDE_CONTAINER_CLASS: "dxAC",
12604  MAXIMUM_DEPTH: 3,
12605  createAnimationTransition: function (element, options) {
12606   if(options.onStep) 
12607    options.animationEngine = "js";
12608   switch (options.animationEngine) {
12609    case "js":
12610     return ASPx.AnimationUtils.createJsAnimationTransition(element, options);
12611    case "css":
12612     return ASPx.AnimationUtils.createCssAnimationTransition(element, options);
12613    default:
12614     return ASPx.AnimationUtils.CanUseCssTransition() ? ASPx.AnimationUtils.createCssAnimationTransition(element, options) :
12615      ASPx.AnimationUtils.createJsAnimationTransition(element, options);
12616   }
12617  },
12618  createMultipleAnimationTransition: function (element, options) {
12619   return ASPx.AnimationUtils.createMultipleAnimationTransition(element, options);
12620  },
12621  createSimpleAnimationTransition: function (options) {
12622   return ASPx.AnimationUtils.createSimpleAnimationTransition(options);
12623  },
12624  cancelAnimation: function (element) {
12625   ASPx.AnimationTransitionBase.Cancel(element);
12626  },
12627  fadeIn: function (element, onComplete, duration) {
12628   AnimationHelper.fadeTo(element, {
12629    from: 0, to: 1,
12630    onComplete: onComplete,
12631    duration: duration || ASPx.AnimationConstants.Durations.DEFAULT
12632   });
12633  },
12634  fadeOut: function (element, onComplete, duration) {
12635   AnimationHelper.fadeTo(element, {
12636    from: ASPx.GetElementOpacity(element), to: 0,
12637    onComplete: onComplete,
12638    duration: duration || ASPx.AnimationConstants.Durations.DEFAULT
12639   });
12640  },
12641  fadeTo: function (element, options) {
12642   options.property = "opacity";
12643   if(!options.duration)
12644    options.duration = ASPx.AnimationConstants.Durations.SHORT;
12645   var transition = AnimationHelper.createAnimationTransition(element, options);
12646   if(!ASPx.IsExists(options.from))
12647    options.from = transition.GetValue();
12648   transition.Start(options.from, options.to);
12649  },
12650  slideIn: function (element, direction, onComplete, animationEngineType, rtl) {
12651   AnimationHelper.setOpacity(element, 1);
12652   var animationContainer = AnimationHelper.getSlideAnimationContainer(element, true, true);
12653   var pos = AnimationHelper.getSlideInStartPos(animationContainer, direction, rtl);
12654   var transition = AnimationHelper.createSlideTransition(animationContainer, direction,
12655    function (el) {
12656     AnimationHelper.resetSlideAnimationContainerSize(animationContainer);
12657     if(onComplete)
12658      onComplete(el);
12659    }, animationEngineType, rtl);
12660   transition.Start(pos, 0);
12661  },
12662  slideOut: function (element, direction, onComplete, animationEngineType, rtl) {
12663   var animationContainer = AnimationHelper.getSlideAnimationContainer(element, true, true);
12664   var pos = AnimationHelper.getSlideOutFinishPos(animationContainer, direction, rtl);
12665   var transition = AnimationHelper.createSlideTransition(animationContainer, direction,
12666    function (el) {
12667     AnimationHelper.setOpacity(el.firstChild, 0);
12668     if(onComplete)
12669      onComplete(el);
12670    }, animationEngineType, rtl);
12671   transition.Start(pos);
12672  },
12673  slideTo: function (element, options) {
12674   if(!ASPx.IsExists(options.direction))
12675    options.direction = AnimationHelper.SLIDE_HORIZONTAL_DIRECTION;
12676   var transition = new PositionAnimationTransition(element, options);
12677   transition.Start(options.to);
12678  },
12679  setOpacity: function (element, value) {
12680   ASPx.AnimationUtils.setOpacity(element, value);
12681  },
12682  appendWKAnimationClassNameIfRequired: function (element) {
12683   if(ASPx.AnimationUtils.CanUseCssTransform() && ASPx.Browser.WebKitFamily && !ASPx.ElementHasCssClass(element, "dx-wbv"))
12684    element.className += " dx-wbv";
12685  },
12686  findSlideAnimationContainer: function (element) {
12687   var container = element;
12688   for(var i = 0; i < AnimationHelper.MAXIMUM_DEPTH; i++) {
12689    if(container.tagName == "BODY")
12690     return null;
12691    if(ASPx.ElementHasCssClass(container, AnimationHelper.SLIDE_CONTAINER_CLASS))
12692     return container;
12693    container = container.parentNode;
12694   }
12695   return null;
12696  },
12697  createSlideAnimationContainer: function (element) {
12698   var rootContainer = document.createElement("DIV");
12699   ASPx.SetStyles(rootContainer, {
12700    className: AnimationHelper.SLIDE_CONTAINER_CLASS,
12701    overflow: "hidden"
12702   });
12703   var elementContainer = document.createElement("DIV");
12704   rootContainer.appendChild(elementContainer);
12705   var parentNode = element.parentNode;
12706   parentNode.insertBefore(rootContainer, element);
12707   elementContainer.appendChild(element);
12708   return rootContainer;
12709  },
12710  getSlideAnimationContainer: function (element, create, fixSize) {
12711   if(!element) return;
12712   var width = element.offsetWidth;
12713   var height = element.offsetHeight;
12714   var container;
12715   if(element.className == AnimationHelper.SLIDE_CONTAINER_CLASS)
12716    container = element;
12717   if(!container)
12718    container = AnimationHelper.findSlideAnimationContainer(element);
12719   if(!container && create)
12720    container = AnimationHelper.createSlideAnimationContainer(element);
12721   if(container && fixSize) {
12722    ASPx.SetStyles(container, {
12723     width: width, height: height
12724    });
12725    ASPx.SetStyles(container.firstChild, {
12726     width: width, height: height
12727    });
12728   }
12729   return container;
12730  },
12731  resetSlideAnimationContainerSize: function (container) {
12732   ASPx.SetStyles(container, {
12733    width: "", height: ""
12734   });
12735   ASPx.SetStyles(container.firstChild, {
12736    width: "", height: ""
12737   });
12738  },
12739  getModifyProperty: function (direction, rtl) {
12740   if(direction == AnimationHelper.SLIDE_TOP_DIRECTION || direction == AnimationHelper.SLIDE_BOTTOM_DIRECTION)
12741    return "marginTop";
12742   return rtl ? "margin-right" : "margin-left";
12743  },
12744  createSlideTransition: function (animationContainer, direction, complete, animationEngineType, rtl) {
12745   if(rtl == undefined)
12746    rtl = false;
12747   var animationEngine = "";
12748   switch(animationEngineType) {
12749    case AnimationEngineType.JS:
12750     animationEngine = "js";
12751     break;
12752    case AnimationEngineType.CSS:
12753     animationEngine = "css";
12754     break;
12755   }
12756   return AnimationHelper.createAnimationTransition(animationContainer.firstChild, {
12757    unit: "px",
12758    property: AnimationHelper.getModifyProperty(direction, rtl),
12759    onComplete: complete,
12760    animationEngine: animationEngine
12761   });
12762  },
12763  getSlideInStartPos: function (animationContainer, direction, rtl) {
12764   var dir = rtl ? -1 : 1;
12765   switch (direction) {
12766    case AnimationHelper.SLIDE_TOP_DIRECTION:
12767     return animationContainer.offsetHeight;
12768    case AnimationHelper.SLIDE_LEFT_DIRECTION:
12769     return animationContainer.offsetWidth * dir;
12770    case AnimationHelper.SLIDE_RIGHT_DIRECTION:
12771     return -animationContainer.offsetWidth * dir;
12772    case AnimationHelper.SLIDE_BOTTOM_DIRECTION:
12773     return -animationContainer.offsetHeight;
12774   }
12775  },
12776  getSlideOutFinishPos: function (animationContainer, direction, rtl) {
12777   var dir = rtl ? -1 : 1;
12778   switch (direction) {
12779    case AnimationHelper.SLIDE_TOP_DIRECTION:
12780     return -animationContainer.offsetHeight;
12781    case AnimationHelper.SLIDE_LEFT_DIRECTION:
12782     return -animationContainer.offsetWidth * dir;
12783    case AnimationHelper.SLIDE_RIGHT_DIRECTION:
12784     return animationContainer.offsetWidth * dir;
12785    case AnimationHelper.SLIDE_BOTTOM_DIRECTION:
12786     return animationContainer.offsetHeight;
12787   }
12788  }
12789 };
12790 var GestureHandler = ASPx.CreateClass(null, {
12791  constructor: function (getAnimationElement, canHandle, allowStart) {
12792   this.getAnimationElement = getAnimationElement;
12793   this.canHandle = canHandle;
12794   this.allowStart = allowStart;
12795   this.startMousePosX = 0;
12796   this.startMousePosY = 0;
12797   this.startTime = null;
12798   this.isEventsPrevented = false;
12799   this.savedElements = [];
12800  },
12801  OnSelectStart: function(evt) {
12802   ASPx.Evt.PreventEvent(evt); 
12803  },
12804  OnDragStart: function(evt) {
12805   ASPx.Evt.PreventEvent(evt);  
12806  },
12807  OnMouseDown: function (evt) {
12808   this.startMousePosX = ASPx.Evt.GetEventX(evt);
12809   this.startMousePosY = ASPx.Evt.GetEventY(evt);
12810   this.startTime = new Date();
12811  },
12812  OnMouseMove: function(evt) {
12813   if(!ASPx.Browser.MobileUI)
12814    ASPx.Selection.Clear();
12815   if(Math.abs(this.GetCurrentDistanceX(evt)) < GestureHandler.SLIDER_MIN_START_DISTANCE && Math.abs(this.GetCurrentDistanceY(evt)) < GestureHandler.SLIDER_MIN_START_DISTANCE)
12816    GesturesHelper.isExecutedGesture = false;
12817  },
12818  OnMouseUp: function (evt) {
12819  },
12820  CanHandleEvent: function (evt) {
12821   return !this.canHandle || this.canHandle(evt);
12822  },
12823  IsStartAllowed: function(value) {
12824   return !this.allowStart || this.allowStart(value);
12825  },
12826  RollbackGesture: function () {
12827  },
12828  GetRubberPosition: function (position) {
12829   return position / GestureHandler.FACTOR_RUBBER;
12830  },
12831  GetCurrentDistanceX: function (evt) {
12832   return ASPx.Evt.GetEventX(evt) - this.startMousePosX;
12833  },
12834  GetCurrentDistanceY: function (evt) {
12835   return ASPx.Evt.GetEventY(evt) - this.startMousePosY;
12836  },
12837  GetDistanceLimit: function () {
12838   return (new Date() - this.startTime) < GestureHandler.MAX_TIME_SPAN ? GestureHandler.MIN_DISTANCE_LIMIT : GestureHandler.MAX_DISTANCE_LIMIT;
12839  },
12840  GetContainerElement: function () {
12841  },
12842  AttachPreventEvents: function (evt) {
12843   if(!this.isEventsPrevented) {
12844    var element = ASPx.Evt.GetEventSource(evt);
12845    var container = this.GetContainerElement();
12846    while(element && element != container) {
12847     ASPx.Evt.AttachEventToElement(element, "mouseup", ASPx.Evt.PreventEvent);
12848     ASPx.Evt.AttachEventToElement(element, "click", ASPx.Evt.PreventEvent);
12849     this.savedElements.push(element);
12850     element = element.parentNode;
12851    }
12852    this.isEventsPrevented = true;
12853   }
12854  },
12855  DetachPreventEvents: function () {
12856   if(this.isEventsPrevented) {
12857    window.setTimeout(function () {
12858     while(this.savedElements.length > 0) {
12859      var element = this.savedElements.pop();
12860      ASPx.Evt.DetachEventFromElement(element, "mouseup", ASPx.Evt.PreventEvent);
12861      ASPx.Evt.DetachEventFromElement(element, "click", ASPx.Evt.PreventEvent);
12862     }
12863    }.aspxBind(this), 0);
12864    this.isEventsPrevented = false;
12865   }
12866  }
12867 });
12868 GestureHandler.MAX_DISTANCE_LIMIT = 70;
12869 GestureHandler.MIN_DISTANCE_LIMIT = 10;
12870 GestureHandler.MIN_START_DISTANCE = 0;
12871 GestureHandler.SLIDER_MIN_START_DISTANCE = 5;
12872 GestureHandler.MAX_TIME_SPAN = 300;
12873 GestureHandler.FACTOR_RUBBER = 4;
12874 GestureHandler.RETURN_ANIMATION_DURATION = 150;
12875 var SwipeSlideGestureHandler = ASPx.CreateClass(GestureHandler, {
12876  constructor: function (getAnimationElement, direction, canHandle, backward, forward, rollback, move) {
12877   this.constructor.prototype.constructor.call(this, getAnimationElement, canHandle);
12878   this.slideElement = this.getAnimationElement();
12879   this.container = this.slideElement.parentNode;
12880   this.direction = direction;
12881   this.backward = backward;
12882   this.forward = forward;
12883   this.rollback = rollback;
12884   this.slideElementSize = 0;
12885   this.containerElementSize = 0;
12886   this.startSliderElementPosition = 0;
12887   this.centeredSlideElementPosition = 0;
12888  },
12889  OnMouseDown: function (evt) {
12890   GestureHandler.prototype.OnMouseDown.call(this, evt);
12891   this.slideElementSize = this.GetElementSize();
12892   this.startSliderElementPosition = this.GetElementPosition();
12893   this.containerElementSize = this.GetContainerElementSize();
12894   if(this.slideElementSize <= this.containerElementSize)
12895    this.centeredSlideElementPosition = (this.containerElementSize - this.slideElementSize) / 2;
12896  },
12897  OnMouseMove: function (evt) {
12898   GestureHandler.prototype.OnMouseMove.call(this, evt);
12899   if(!ASPx.Browser.TouchUI && !ASPx.GetIsParent(this.container, ASPx.Evt.GetEventSource(evt))) {
12900    GesturesHelper.OnDocumentMouseUp(evt);
12901    return;
12902   }
12903   var distance = this.GetCurrentDistance(evt);
12904   if(Math.abs(distance) < GestureHandler.SLIDER_MIN_START_DISTANCE || ASPx.TouchUIHelper.isGesture)
12905    return;
12906   this.SetElementPosition(this.GetCalculatedPosition(distance));
12907   this.AttachPreventEvents(evt);
12908   ASPx.Evt.PreventEvent(evt);
12909  },
12910  GetCalculatedPosition: function (distance) {
12911   ASPx.AnimationTransitionBase.Cancel(this.slideElement);
12912   var position = this.startSliderElementPosition + distance,
12913    maxPosition = -(this.slideElementSize - this.containerElementSize),
12914    minPosition = 0;
12915   if(this.centeredSlideElementPosition > 0)
12916    position = this.GetRubberPosition(distance) + this.centeredSlideElementPosition;
12917   else if(position > minPosition)
12918    position = this.GetRubberPosition(distance);
12919   else if(position < maxPosition)
12920    position = this.GetRubberPosition(distance) + maxPosition;
12921   return position;
12922  },
12923  OnMouseUp: function (evt) {
12924   this.DetachPreventEvents();
12925   if(this.GetCurrentDistance(evt) != 0)
12926    this.OnMouseUpCore(evt);
12927  },
12928  OnMouseUpCore: function (evt) {
12929   var distance = this.GetCurrentDistance(evt);
12930   if(this.centeredSlideElementPosition > 0 || this.CheckSlidePanelIsOutOfBounds())
12931    this.PerformRollback();
12932   else
12933    this.PerformAction(distance);
12934  },
12935  PerformAction: function (distance) {
12936   if(Math.abs(distance) < this.GetDistanceLimit())
12937    this.PerformRollback();
12938   else if(distance < 0)
12939    this.PerformForward();
12940   else
12941    this.PerformBackward();
12942  },
12943  PerformBackward: function () {
12944   this.backward();
12945  },
12946  PerformForward: function () {
12947   this.forward();
12948  },
12949  PerformRollback: function () {
12950   this.rollback();
12951  },
12952  CheckSlidePanelIsOutOfBounds: function () {
12953   var minOffset = -(this.slideElementSize - this.containerElementSize), maxOffset = 0;
12954   var slideElementPos = this.GetElementPosition();
12955   if(slideElementPos > maxOffset || slideElementPos < minOffset)
12956    return true;
12957   return false;
12958  },
12959  GetContainerElement: function () {
12960   return this.container;
12961  },
12962  GetElementSize: function () {
12963   return this.IsHorizontalDirection() ? this.slideElement.offsetWidth : this.slideElement.offsetHeight;
12964  },
12965  GetContainerElementSize: function () {
12966   return this.IsHorizontalDirection() ? ASPx.GetClearClientWidth(this.container) : ASPx.GetClearClientHeight(this.container);
12967  },
12968  GetCurrentDistance: function (evt) {
12969   return this.IsHorizontalDirection() ? this.GetCurrentDistanceX(evt) : this.GetCurrentDistanceY(evt);
12970  },
12971  GetElementPosition: function () {
12972   return ASPx.AnimationUtils.GetTransformValue(this.slideElement, !this.IsHorizontalDirection());
12973  },
12974  SetElementPosition: function (position) {
12975   ASPx.AnimationUtils.SetTransformValue(this.slideElement, position, !this.IsHorizontalDirection());
12976  },
12977  IsHorizontalDirection: function () {
12978   return this.direction == AnimationHelper.SLIDE_HORIZONTAL_DIRECTION;
12979  }
12980 });
12981 var SwipeSimpleSlideGestureHandler = ASPx.CreateClass(SwipeSlideGestureHandler, {
12982  constructor: function (getAnimationElement, direction, canHandle, backward, forward, rollback, updatePosition) {
12983   this.constructor.prototype.constructor.call(this, getAnimationElement, direction, canHandle, backward, forward, rollback);
12984   this.container = this.slideElement;
12985   this.updatePosition = updatePosition;
12986   this.prevDistance = 0;
12987  },
12988  OnMouseDown: function (evt) {
12989   GestureHandler.prototype.OnMouseDown.call(this, evt);
12990   this.prevDistance = 0;
12991  },
12992  OnMouseUpCore: function (evt) {
12993   this.PerformAction(this.GetCurrentDistance(evt));
12994  },
12995  PerformAction: function (distance) {
12996   if(Math.abs(distance) < this.GetDistanceLimit())
12997    this.PerformRollback();
12998   else if(distance < 0)
12999    this.PerformForward();
13000   else
13001    this.PerformBackward();
13002  },
13003  GetCalculatedPosition: function (distance) {
13004   var position = distance - this.prevDistance;
13005   this.prevDistance = distance;
13006   return position;
13007  },
13008  SetElementPosition: function (position) {
13009   this.updatePosition(position);
13010  }
13011 });
13012 var SwipeGestureHandler = ASPx.CreateClass(GestureHandler, {
13013  constructor: function (getAnimationElement, canHandle, allowStart, start, allowComplete, complete, cancel, animationEngineType, rtl) {
13014   this.constructor.prototype.constructor.call(this, getAnimationElement, canHandle, allowStart);
13015   this.start = start;
13016   this.allowComplete = allowComplete;
13017   this.complete = complete;
13018   this.cancel = cancel;
13019   this.animationTween = null;
13020   this.currentDistanceX = 0;
13021   this.currentDistanceY = 0;
13022   this.tryStartGesture = false;
13023   this.tryStartScrolling = false;
13024   this.animationEngineType = animationEngineType;
13025   this.rtl = rtl;
13026   this.UpdateAnimationContainer();
13027  },
13028  UpdateAnimationContainer: function () {
13029   this.animationContainer = AnimationHelper.getSlideAnimationContainer(this.getAnimationElement(), true, false);
13030  },
13031  CanHandleEvent: function (evt) {
13032   if(GestureHandler.prototype.CanHandleEvent.call(this, evt))
13033    return true;
13034   return this.animationTween && this.animationContainer && ASPx.GetIsParent(this.animationContainer, ASPx.Evt.GetEventSource(evt));
13035  },
13036  OnMouseDown: function (evt) {
13037   GestureHandler.prototype.OnMouseDown.call(this, evt);
13038   if(this.animationTween)
13039    this.animationTween.Cancel();
13040   this.currentDistanceX = 0;
13041   this.currentDistanceY = 0;
13042   this.tryStartGesture = false;
13043   this.tryStartScrolling = false;
13044  },
13045  OnMouseMove: function (evt) {
13046   GestureHandler.prototype.OnMouseMove.call(this, evt);
13047   var isZoomGestureConflict = evt.touches && evt.touches.length > 1;
13048   if (isZoomGestureConflict)
13049    return false;
13050   this.currentDistanceX = this.GetCurrentDistanceX(evt);
13051   this.currentDistanceY = this.GetCurrentDistanceY(evt);
13052   if(this.rtl)
13053    this.currentDistanceX = -this.currentDistanceX;
13054   if(!this.animationTween && !this.tryStartScrolling && (Math.abs(this.currentDistanceX) >
13055    GestureHandler.MIN_START_DISTANCE || Math.abs(this.currentDistanceY) > GestureHandler.MIN_START_DISTANCE)) {
13056    if(Math.abs(this.currentDistanceY) < Math.abs(this.currentDistanceX)) {
13057     this.tryStartGesture = true;
13058     if(this.IsStartAllowed(this.currentDistanceX)) {
13059      this.animationContainer = AnimationHelper.getSlideAnimationContainer(this.getAnimationElement(), true, true);
13060      this.animationTween = AnimationHelper.createSlideTransition(this.animationContainer, AnimationHelper.SLIDE_LEFT_DIRECTION,
13061       function () {
13062        AnimationHelper.resetSlideAnimationContainerSize(this.animationContainer);
13063        this.animationContainer = null;
13064        this.animationTween = null;
13065       }.aspxBind(this), this.animationEngineType, this.rtl);
13066      this.PerformStart(this.currentDistanceX);
13067      this.AttachPreventEvents(evt);
13068     }
13069    }
13070    else
13071     this.tryStartScrolling = true;
13072   }
13073   if(this.animationTween) {
13074    if(this.allowComplete && !this.allowComplete(this.currentDistanceX))
13075     this.currentDistanceX = this.GetRubberPosition(this.currentDistanceX);
13076    this.animationTween.SetValue(this.currentDistanceX);
13077   }
13078   if(!this.tryStartScrolling && !ASPx.TouchUIHelper.isGesture && evt.touches && evt.touches.length < 2)
13079    ASPx.Evt.PreventEvent(evt);
13080  },
13081  OnMouseUp: function (evt) {
13082   if(!this.animationTween) {
13083    if(this.tryStartGesture)
13084     this.PerformCancel(this.currentDistanceX);
13085   }
13086   else {
13087    if(Math.abs(this.currentDistanceX) < this.GetDistanceLimit())
13088     this.RollbackGesture();
13089    else {
13090     if(this.IsCompleteAllowed(this.currentDistanceX)) {
13091      this.PerformComplete(this.currentDistanceX);
13092      this.animationContainer = null;
13093      this.animationTween = null;
13094     }
13095     else
13096      this.RollbackGesture();
13097    }
13098   }
13099   this.DetachPreventEvents();
13100   this.tryStartGesture = false;
13101   this.tryStartScrolling = false;
13102  },
13103  PerformStart: function (value) {
13104   if(this.start)
13105    this.start(value);
13106  },
13107  IsCompleteAllowed: function (value) {
13108   return !this.allowComplete || this.allowComplete(value);
13109  },
13110  PerformComplete: function (value) {
13111   if(this.complete)
13112    this.complete(value);
13113  },
13114  PerformCancel: function (value) {
13115   if(this.cancel)
13116    this.cancel(value);
13117  },
13118  RollbackGesture: function () {
13119   this.animationTween.Start(this.currentDistanceX, 0);
13120  },
13121  ResetGestureElementPosition: function () {
13122   if (this.currentDistanceX === 0) return;
13123   var container = AnimationHelper.getSlideAnimationContainer(this.getAnimationElement());
13124   var onComplete = function () { AnimationHelper.resetSlideAnimationContainerSize(container); };
13125   var animation = AnimationHelper.createSlideTransition(container, AnimationHelper.SLIDE_LEFT_DIRECTION, onComplete, this.animationEngineType, this.rtl);
13126   animation.Start(this.currentDistanceX, 0);
13127  },
13128  GetContainerElement: function () {
13129   return this.animationContainer;
13130  }
13131 });
13132 var GesturesHelper = {
13133  handlers: {},
13134  activeHandler: null,
13135  isAttachedEvents: false,
13136  isExecutedGesture: false,
13137  AddSwipeGestureHandler: function (id, getAnimationElement, canHandle, allowStart, start, allowComplete, complete, cancel, animationEngineType, rtl) {
13138   this.handlers[id] = new SwipeGestureHandler(getAnimationElement, canHandle, allowStart, start, allowComplete, complete, cancel, animationEngineType, rtl);
13139  },
13140  UpdateSwipeAnimationContainer: function (id) {
13141   if(this.handlers[id])
13142    this.handlers[id].UpdateAnimationContainer();
13143  },
13144  AddSwipeSlideGestureHandler: function (id, getAnimationElement, direction, canHandle, backward, forward, rollback, updatePosition) {
13145   if(updatePosition)
13146    this.handlers[id] = new SwipeSimpleSlideGestureHandler(getAnimationElement, direction, canHandle, backward, forward, rollback, updatePosition);
13147   else
13148    this.handlers[id] = new SwipeSlideGestureHandler(getAnimationElement, direction, canHandle, backward, forward, rollback);
13149  },
13150  getParentDXEditorWithSwipeGestures: function(element) {
13151     return ASPx.GetParent(element, function(parent) {
13152      var parentObj = ASPx.GetControlCollection().Get(parent.id);
13153      return parentObj && parentObj.supportGestures && parentObj.isSwipeGesturesEnabled();
13154   });
13155  },
13156  canHandleMouseDown: function(evt) {
13157   if(!ASPx.Evt.IsLeftButtonPressed(evt))
13158    return false;
13159   var element = ASPx.Evt.GetEventSource(evt);
13160   var dxFocusedEditor = ASPx.Ident.scripts.ASPxClientEdit && ASPx.GetFocusedEditor();
13161   if(dxFocusedEditor && dxFocusedEditor.IsEditorElement(element)) {
13162    var elementParentDXEditorWithSwipeGestures = GesturesHelper.getParentDXEditorWithSwipeGestures(element);
13163    if(!elementParentDXEditorWithSwipeGestures || !dxFocusedEditor.IsEditorElement(elementParentDXEditorWithSwipeGestures))
13164     return false;
13165   }
13166   var isTextEditor = element.tagName == "TEXTAREA" || element.tagName == "INPUT" && ASPx.Attr.GetAttribute(element, "type") == "text";
13167   if(isTextEditor && document.activeElement == element)
13168    return false;
13169   return true;  
13170  },
13171  OnDocumentDragStart: function(evt) {
13172   if(GesturesHelper.activeHandler)
13173    GesturesHelper.activeHandler.OnDragStart(evt);
13174  },
13175  OnDocumentSelectStart: function(evt) {
13176   if(GesturesHelper.activeHandler)
13177    GesturesHelper.activeHandler.OnSelectStart(evt);
13178  },
13179  OnDocumentMouseDown: function (evt) {
13180   if(!GesturesHelper.canHandleMouseDown(evt))
13181    return;
13182   GesturesHelper.activeHandler = GesturesHelper.FindHandler(evt);
13183   if(GesturesHelper.activeHandler)
13184    GesturesHelper.activeHandler.OnMouseDown(evt);
13185  },
13186  OnDocumentMouseMove: function (evt) {
13187   if(GesturesHelper.activeHandler) {
13188    GesturesHelper.isExecutedGesture = true;
13189    GesturesHelper.activeHandler.OnMouseMove(evt);
13190   }
13191  },
13192  OnDocumentMouseUp: function (evt) {
13193   if(GesturesHelper.activeHandler) {
13194    GesturesHelper.activeHandler.OnMouseUp(evt);
13195    GesturesHelper.activeHandler = null;
13196    window.setTimeout(function () { GesturesHelper.isExecutedGesture = false; }, 0);
13197   }
13198  },
13199  AttachEvents: function () {
13200   if(!GesturesHelper.isAttachedEvents) {
13201    GesturesHelper.Attach(ASPx.Evt.AttachEventToElement);
13202    GesturesHelper.isAttachedEvents = true;
13203   }
13204  },
13205  DetachEvents: function () {
13206   if(GesturesHelper.isAttachedEvents) {
13207    GesturesHelper.Attach(ASPx.Evt.DetachEventFromElement);
13208    GesturesHelper.isAttachedEvents = false;
13209   }
13210  },
13211  Attach: function (changeEventsMethod) {
13212   var doc = window.document;
13213   changeEventsMethod(doc, ASPx.TouchUIHelper.touchMouseDownEventName, GesturesHelper.OnDocumentMouseDown);
13214   changeEventsMethod(doc, ASPx.TouchUIHelper.touchMouseMoveEventName, GesturesHelper.OnDocumentMouseMove);
13215   changeEventsMethod(doc, ASPx.TouchUIHelper.touchMouseUpEventName, GesturesHelper.OnDocumentMouseUp);
13216   if(!ASPx.Browser.MobileUI) {
13217    changeEventsMethod(doc, "selectstart", GesturesHelper.OnDocumentSelectStart);
13218    changeEventsMethod(doc, "dragstart", GesturesHelper.OnDocumentDragStart);
13219   }
13220  },
13221  FindHandler: function (evt) {
13222   var handlers = [];
13223   for(var id in GesturesHelper.handlers) {
13224    if(GesturesHelper.handlers.hasOwnProperty(id)) {
13225     var handler = GesturesHelper.handlers[id];
13226     if(handler.CanHandleEvent && handler.CanHandleEvent(evt))
13227      handlers.push(handler);
13228    }
13229   }
13230   if(!handlers.length)
13231    return null;
13232   handlers.sort(function (a, b) {
13233    return ASPx.GetIsParent(a.getAnimationElement(), b.getAnimationElement()) ? 1 : -1;
13234   });
13235   return handlers[0];
13236  },
13237  IsExecutedGesture: function () {
13238   return GesturesHelper.isExecutedGesture;
13239  }
13240 };
13241 GesturesHelper.AttachEvents();
13242 var AnimationEngineType = {
13243  "JS": 0,
13244  "CSS": 1,
13245  "DEFAULT" : 2
13246 };
13247 ASPx.AnimationEngineType = AnimationEngineType;
13248 ASPx.AnimationHelper = AnimationHelper;
13249 ASPx.GesturesHelper = GesturesHelper;
13250})();
13251
13252(function () {
13253var ASPxClientHiddenField = ASPx.CreateClass(ASPxClientControl, {
13254 constructor: function (name) {
13255  this.constructor.prototype.constructor.call(this, name);
13256  this.syncWithServer = true;
13257  this.properties = {};
13258  this.typeInfoTable = {};
13259  this.typeNameTable = [];
13260 },
13261 IsDOMDisposed: function() { 
13262  return this.syncWithServer ? !ASPx.IsExistsElement(this.GetStateHiddenField()) : false;
13263 },
13264 UpdateStateObject: function () {
13265  if(!this.syncWithServer) 
13266   return;
13267  var serializedData = ASPx.GetHiddenFieldSerializer().Serialize(this);
13268  this.UpdateStateObjectWithObject({ data: serializedData });
13269 },
13270 GetStateHiddenField: function() {
13271  return ASPx.GetElementById(this.uniqueID);
13272 },
13273 EscapeSpecialCharacters: function (str) {
13274  str = str.replace(/\\/g, "\\\\");
13275  var specialChars = {};
13276  for(var i = 0; i < str.length; i++) {
13277   var char = str.charAt(i);
13278   var charCode = char.charCodeAt(0);
13279   if(charCode < 32) {
13280    var hexCharCode = charCode.toString(16);
13281    specialChars[char] = "\\u" + "0000".substr(0, 4 - hexCharCode.length) + hexCharCode;
13282   }
13283  }
13284  for(var ch in specialChars)
13285   if(specialChars.hasOwnProperty(ch))
13286    str = str.replace(new RegExp(ch, "g"), specialChars[ch]);
13287  return str;
13288 },
13289 PerformCallback: function (parameter) {
13290  this.CreateCallback(parameter);
13291 },
13292 OnCallback: function (result) {
13293  var callbackMarkupContainer = this.GetCallbackMarkupContainer();
13294  ASPx.SetInnerHtml(callbackMarkupContainer, result);
13295 },
13296 GetCallbackMarkupContainer: function () {
13297  var callbackMarkupContainer = ASPx.GetElementById(this.GetCallbackMarkupContainerID());
13298  if(!callbackMarkupContainer) {
13299   callbackMarkupContainer = this.CreateCallbackMarkupContainer();
13300   document.body.appendChild(callbackMarkupContainer);
13301  }
13302  return callbackMarkupContainer;
13303 },
13304 GetCallbackMarkupContainerID: function () {
13305  return this.name + ASPxClientHiddenField.CallbackMarkupContainerIDSuffix;
13306 },
13307 CreateCallbackMarkupContainer: function () {
13308  var callbackMarkupContainer = document.createElement("DIV");
13309  ASPx.SetElementDisplay(callbackMarkupContainer, false);
13310  callbackMarkupContainer.id = this.GetCallbackMarkupContainerID();
13311  return callbackMarkupContainer;
13312 },
13313 Add: function (propertyName, propertyValue) {
13314  var existentPropertyValue = this.Get(propertyName);
13315  if(typeof (existentPropertyValue) == "undefined")
13316   this.Set(propertyName, propertyValue);
13317  else
13318   ASPx.ShowErrorAlert("A property with the name '" + propertyName + "' has already been added.");
13319 },
13320 Get: function (propertyName) {
13321  var safeName = this.GetTopLevelPropertySafeName(propertyName);
13322  return this.properties[safeName];
13323 },
13324 Set: function (propertyName, propertyValue) {
13325  ASPxClientHiddenField.AssertKeyIsValid(propertyName);
13326  var safeName = this.GetTopLevelPropertySafeName(propertyName);
13327  if(typeof (propertyValue) == "undefined")
13328   this.Remove(propertyName);
13329  else
13330   this.properties[safeName] = propertyValue;
13331 },
13332 Remove: function (propertyName) {
13333  var safeName = this.GetTopLevelPropertySafeName(propertyName);
13334  delete this.properties[safeName];
13335  TypeInfoHelper.RemoveTypeInfoBranch(this.typeInfoTable, safeName);
13336 },
13337 Clear: function () {
13338  this.properties = {};
13339  this.typeInfoTable = {};
13340  this.typeNameTable = [];
13341 },
13342 Contains: function (propertyName) {
13343  var safeTopLevelPropertyName = this.GetTopLevelPropertySafeName(propertyName);
13344  for(var key in this.properties) {
13345   if(key == safeTopLevelPropertyName)
13346    return true;
13347  }
13348  return false;
13349 },
13350 GetTopLevelPropertySafeName: function (propertyName) {
13351  return ASPxClientHiddenField.TopLevelKeyPrefix + propertyName;
13352 }
13353});
13354ASPxClientHiddenField.AssertKeyIsValid = function(key) {
13355 if(!key)
13356  ASPx.ShowErrorAlert("HiddenField: It is not allowed to insert values with empty property names");
13357};
13358ASPxClientHiddenField.Cast = ASPxClientControl.Cast;
13359ASPxClientHiddenField.InputElementIDSuffix = "_I";
13360ASPxClientHiddenField.CallbackMarkupContainerIDSuffix = "_D";
13361ASPxClientHiddenField.TopLevelKeyPrefix = "dxp";
13362var TypeInfoHelper = ASPx.CreateClass(null, {
13363 constructor: function () {
13364  this.minUnknownTypeIndex = 1024;
13365  this.clientTypeConstructors = [
13366   null,
13367   Number,
13368   String,
13369   Date,
13370   Boolean,
13371   RegExp,
13372   Array,
13373   Object,
13374   Function
13375  ];
13376  this.clientTypeConstructorIndices = {};
13377  for(var i = 1; i < this.clientTypeConstructors.length; i++)
13378   this.clientTypeConstructorIndices[this.clientTypeConstructors[i]] = i;
13379 },
13380 EnsureTypeInfoTableCompliant: function (value, typeInfoTable, typeInfoKey) {
13381  if(typeInfoKey == "")
13382   return;
13383  var typeCode = typeInfoTable[typeInfoKey];
13384  if(typeof (typeCode) == "undefined")
13385   typeCode = this.GetArrayItemTypeCode(typeInfoTable, typeInfoKey);
13386  if(typeof (typeCode) != "undefined") {
13387   if(!this.IsValueTypeInfoCompliant(value, typeCode))
13388    TypeInfoHelper.RemoveTypeInfoBranch(typeInfoTable, typeInfoKey);
13389   else
13390    return;
13391  }
13392  typeCode = this.CreateTypeCode(value);
13393  if(typeof (typeCode) != "undefined")
13394   typeInfoTable[typeInfoKey] = typeCode;
13395  else
13396   delete typeInfoTable[typeInfoKey];
13397 },
13398 GetArrayItemTypeCode: function (typeInfoTable, typeInfoKey) {
13399  var separator = "|";
13400  var index = typeInfoKey.lastIndexOf(separator);
13401  if(index < 0)
13402   return;
13403  itemTypeKey = typeInfoKey.substr(0, index) + "_itemType";
13404  var typeCode = typeInfoTable[itemTypeKey];
13405  if(typeof (typeCode) != "undefined")
13406   typeInfoTable[typeInfoKey] = typeCode;
13407  return typeCode;
13408 },
13409 IsAtomValue: function (value, typeCode) {
13410  return typeCode == 0 || !(this.IsListValue(value, typeCode) || this.IsDictionaryValue(value, typeCode));
13411 },
13412 IsListValue: function (value, typeCode) {
13413  return this.IsKnownTypeCode(typeCode) ? this.GetConstructor(typeCode) === Array : value.constructor === Array;
13414 },
13415 IsDictionaryValue: function (value, typeCode) {
13416  return this.IsKnownTypeCode(typeCode) ? this.GetConstructor(typeCode) === Object : value.constructor === Object;
13417 },
13418 GetArrayTypeCode: function () {
13419  return this.clientTypeConstructorIndices[Array] << 1;
13420 },
13421 GetStringTypeCode: function () {
13422  return this.clientTypeConstructorIndices[String] << 1;
13423 },
13424 IsStringTypeCode: function (typeCode) {
13425  return typeCode == this.GetStringTypeCode();
13426 },
13427 IsValueTypeInfoCompliant: function (value, typeCode) {
13428  if(this.IsKnownTypeCode(typeCode))
13429   return value != null ? value.constructor === this.GetConstructor(typeCode) : this.IsNullable(typeCode);
13430  else
13431   return value == null || value.constructor === Array || value.constructor === Object;
13432 },
13433 CreateTypeCode: function (value) {
13434  if(value == null)
13435   return 1; 
13436  var clientTypeIndex = this.clientTypeConstructorIndices[value.constructor];
13437  var lowerBit = Number(
13438   clientTypeIndex == this.clientTypeConstructorIndices[RegExp] ||
13439   clientTypeIndex == this.clientTypeConstructorIndices[Array] ||
13440   clientTypeIndex == this.clientTypeConstructorIndices[Object]
13441  );
13442  return typeof (clientTypeIndex) != "undefined" ? ((clientTypeIndex << 1) + lowerBit) : void (0);
13443 },
13444 IsNullable: function (typeCode) {
13445  return (typeCode & 1) > 0;
13446 },
13447 GetConstructor: function (typeCode) {
13448  return this.clientTypeConstructors[(typeCode >>> 1) & 7];
13449 },
13450 IsKnownTypeCode: function (typeCode) {
13451  return typeCode < this.minUnknownTypeIndex;
13452 }
13453});
13454TypeInfoHelper.RemoveTypeInfoBranch = function (typeInfoTable, typeInfoKeyPrefix) {
13455 for(var key in typeInfoTable) {
13456  if(key.indexOf(typeInfoKeyPrefix) == 0)
13457   delete typeInfoTable[key];
13458 }
13459};
13460var HiddenFieldSerializer = ASPx.CreateClass(null, {
13461 constructor: function () {
13462  this.typeInfoHelper = new TypeInfoHelper();
13463  this.separator = "|";
13464  this.sentinel = "#";
13465  this.charCodes = this.CreateCharCodeList(["a", "z", "0", "9", "_", "$"]);
13466 },
13467 Serialize: function (hiddenField) {
13468  var sb = [];
13469  this.SerializeCore(hiddenField.typeNameTable, "", sb, null, null, null, false);
13470  this.SerializeCore(hiddenField.properties, "", sb, hiddenField.typeInfoTable, hiddenField.typeNameTable, ASPxClientHiddenField.TopLevelKeyPrefix, true);
13471  return sb.join("");
13472 },
13473 SerializeCore: function (value, pathInPropertiesTree, serializedData, typeInfoTable, typeNameTable, keyNamePrefix, validateKeys) {
13474  var metaTablesDefined = typeInfoTable != null && typeNameTable != null;
13475  var typeCode = null;
13476  if(metaTablesDefined) {
13477   this.typeInfoHelper.EnsureTypeInfoTableCompliant(value, typeInfoTable, pathInPropertiesTree);
13478   typeCode = typeInfoTable[pathInPropertiesTree];
13479  } else {
13480   typeCode = value.constructor === Array ?
13481    this.typeInfoHelper.GetArrayTypeCode() : this.typeInfoHelper.GetStringTypeCode();
13482  }
13483  if(typeof (typeCode) != "undefined")
13484   serializedData.push(typeCode);
13485  serializedData.push(this.separator);
13486  if(typeof (typeCode) == "undefined" || this.typeInfoHelper.IsDictionaryValue(value, typeCode)) {
13487   for(var key in value) {
13488    if(value.hasOwnProperty(key)) {
13489     var serializableKey = key;
13490     if(keyNamePrefix.length > 0)
13491      serializableKey = serializableKey.slice(keyNamePrefix.length);
13492     if(validateKeys)
13493      ASPxClientHiddenField.AssertKeyIsValid(serializableKey);
13494     serializedData.push(serializableKey);
13495     serializedData.push(this.separator);
13496     this.SerializeCore(value[key], pathInPropertiesTree.length > 0 ? (pathInPropertiesTree + this.separator + key) : key,
13497      serializedData, typeInfoTable, typeNameTable, "", validateKeys);
13498    }
13499   }
13500   serializedData.push(this.sentinel);
13501  } else if(this.typeInfoHelper.IsListValue(value, typeCode)) {
13502   for(var i = 0; i < value.length; i++)
13503    this.SerializeCore(value[i], pathInPropertiesTree.length > 0 ? (pathInPropertiesTree + this.separator + i) : i,
13504     serializedData, typeInfoTable, typeNameTable, "", validateKeys);
13505   serializedData.push(this.sentinel);
13506  } else if(this.typeInfoHelper.IsAtomValue(value, typeCode))
13507   this.SerializeAtomValue(value, serializedData, typeCode);
13508 },
13509 SerializeAtomValue: function (value, sb, typeCode) {
13510  var valueStr = this.SerializeAtomValueCore(value, typeCode);
13511  sb.push(valueStr.length.toString());
13512  sb.push(this.separator);
13513  sb.push(valueStr);
13514 },
13515 SerializeAtomValueCore: function (value, typeCode) {
13516  var isString = this.typeInfoHelper.IsStringTypeCode(typeCode);
13517  if(value == null)
13518   return isString ? "0" : "";
13519  else {
13520   if(isString) {
13521    return "1" + value.replace(/\r/g, ""); 
13522   } else {
13523    var ctor = value.constructor;
13524    if(ctor === String )
13525     return value;
13526    else if(ctor === Boolean)
13527     return value ? "1" : "0";
13528    else if(ctor === Number)
13529     return value.toString();
13530    else if(ctor === Date)
13531     return String(ASPx.DateUtils.ToLocalTime(value).valueOf());
13532    else if(ctor === RegExp) {
13533     var options = "";
13534     if(value.ignoreCase)
13535      options += "i";
13536     if(value.multiline)
13537      options += "m";
13538     return options + "," + value.source;
13539    }
13540   }
13541  }
13542  ASPx.ShowErrorAlert("Unable to serialize value " + value.toString() + " (Constructor: " + value.constructor.toString() + ").");
13543 },
13544 CreateCharCodeList: function (chars) {
13545  var charCodes = {};
13546  for(var i = 0; i < chars.length; i++) {
13547   var ch = chars[i];
13548   charCodes[ch] = ch.charCodeAt(0);
13549  }
13550  return charCodes;
13551 },
13552 IsLowercaseLetterCharCode: function (charCode) {
13553  return charCode >= this.charCodes["a"] && charCode <= this.charCodes["z"];
13554 }
13555});
13556var hiddenFieldSerializer;
13557ASPx.GetHiddenFieldSerializer = function() {
13558 if(!hiddenFieldSerializer)
13559  hiddenFieldSerializer = new HiddenFieldSerializer();
13560 return hiddenFieldSerializer;
13561};
13562ASPx.TypeInfoHelper = TypeInfoHelper;
13563window.ASPxClientHiddenField = ASPxClientHiddenField;
13564})();
13565
13566(function() {
13567var ASPxClientEditBase = ASPx.CreateClass(ASPxClientControl, {
13568 constructor: function(name) {
13569  this.constructor.prototype.constructor.call(this, name);
13570  this.EnabledChanged = new ASPxClientEvent();
13571  this.captionPosition = ASPx.Position.Left;
13572  this.showCaptionColon = true;
13573  this.scPrefix = "dxe";
13574 },
13575 InlineInitialize: function(){
13576  ASPxClientControl.prototype.InlineInitialize.call(this);
13577  this.InitializeEnabled(); 
13578 },
13579 InitializeEnabled: function() {
13580  this.SetEnabledInternal(this.clientEnabled, true);
13581 },
13582 AddDefaultReadOnlyStateControllerItem: function(cssClass, mainElementId) {
13583  ASPx.AddReadOnlyItems(mainElementId, [[[cssClass], [''], ['']]]);
13584 },
13585 AddDefaultDisabledStateControllerItem: function(cssClass, mainElementId) {
13586  ASPx.AddDisabledItems(mainElementId, [[[cssClass], [''], ['']]]);
13587 },
13588 GetValue: function() {
13589  var element = this.GetMainElement();
13590  if(ASPx.IsExistsElement(element))
13591   return element.innerHTML;
13592  return "";
13593 },
13594 GetValueString: function(){
13595  var value = this.GetValue();
13596  return (value == null) ? null : value.toString();
13597 },
13598 SetValue: function(value) {
13599  if(value == null)
13600   value = "";
13601  var element = this.GetMainElement();
13602  if(ASPx.IsExistsElement(element))
13603   element.innerHTML = value;
13604 },
13605 GetEnabled: function(){
13606  return this.enabled && this.clientEnabled;
13607 },
13608 SetEnabled: function(enabled){
13609  if(this.clientEnabled != enabled) {
13610   var errorFrameRequiresUpdate = this.GetIsValid && !this.GetIsValid();
13611   if(errorFrameRequiresUpdate && !enabled)
13612    this.UpdateErrorFrameAndFocus(false , null , true );
13613   this.clientEnabled = enabled;
13614   this.SetEnabledInternal(enabled, false);
13615   if(errorFrameRequiresUpdate && enabled)
13616    this.UpdateErrorFrameAndFocus(false );
13617   this.RaiseEnabledChangedEvent();
13618  }
13619 },
13620 SetEnabledInternal: function(enabled, initialization){
13621  if(!this.enabled) return;
13622  if(!initialization || !enabled)
13623   this.ChangeEnabledStateItems(enabled);
13624  this.ChangeEnabledAttributes(enabled);
13625  if(ASPx.Browser.Chrome) {   
13626   var mainElement = this.GetMainElement();
13627   if(mainElement)
13628    mainElement.className = mainElement.className;
13629  } 
13630 },
13631 ChangeEnabledAttributes: function(enabled){
13632 },
13633 ChangeEnabledStateItems: function(enabled){
13634 },
13635 RaiseEnabledChangedEvent: function(){
13636  if(!this.EnabledChanged.IsEmpty()){
13637   var args = new ASPxClientEventArgs();
13638   this.EnabledChanged.FireEvent(this, args);
13639  }
13640 },
13641 GetDecodeValue: function (value) { 
13642  if(typeof (value) == "string" && value.length > 1)
13643   value = this.SimpleDecodeHtml(value);
13644  return value;
13645 },
13646 SimpleDecodeHtml: function (html) {
13647  return ASPx.Str.ApplyReplacement(html, [
13648   [/&lt;/g, '<'],
13649   [/&amp;/g, '&'],
13650   [/&quot;/g, '"'],
13651   [/&#39;/g, '\''],
13652   [/&#32;/g, ' ']
13653  ]);
13654 },
13655 GetCachedElementById: function(idSuffix) {
13656  return ASPx.CacheHelper.GetCachedElementById(this, this.name + idSuffix);
13657 },
13658 GetCaptionCell: function() {
13659  return this.GetCachedElementById(EditElementSuffix.CaptionCell);
13660 },
13661 GetExternalTable: function() {
13662  return this.GetCachedElementById(EditElementSuffix.ExternalTable);
13663 },
13664 getCaptionRelatedCellCount: function() {
13665  if(!this.captionRelatedCellCount)
13666   this.captionRelatedCellCount = ASPx.GetNodesByClassName(this.GetExternalTable(), CaptionRelatedCellClassName).length;
13667  return this.captionRelatedCellCount;
13668 },
13669 addCssClassToCaptionRelatedCells: function() {
13670  if(this.captionPosition == ASPx.Position.Left || this.captionPosition == ASPx.Position.Right) {
13671   var captionRelatedCellsIndex = this.captionPosition == ASPx.Position.Left ? 0 : this.GetCaptionCell().cellIndex;
13672   for(var i = 0; i < this.GetExternalTable().rows.length; i++)
13673    ASPx.AddClassNameToElement(this.GetExternalTable().rows[i].cells[captionRelatedCellsIndex], CaptionRelatedCellClassName);
13674  }
13675  if(this.captionPosition == ASPx.Position.Top || this.captionPosition == ASPx.Position.Bottom)
13676   for(var i = 0; i < this.GetCaptionCell().parentNode.cells.length; i++)
13677    ASPx.AddClassNameToElement(this.GetCaptionCell().parentNode.cells[i], CaptionRelatedCellClassName);
13678 },
13679 GetCaption: function() {
13680  if(ASPx.IsExists(this.GetCaptionCell()))
13681   return this.getCaptionInternal();
13682  return "";
13683 },
13684 SetCaption: function(caption) {
13685  if(!ASPx.IsExists(this.GetCaptionCell()))
13686   return;
13687  if(this.getCaptionRelatedCellCount() == 0)
13688   this.addCssClassToCaptionRelatedCells();
13689  if(caption !== "")
13690   ASPx.RemoveClassNameFromElement(this.GetExternalTable(), ASPxEditExternalTableClassNames.TableWithEmptyCaptionClassName);
13691  else
13692   ASPx.AddClassNameToElement(this.GetExternalTable(), ASPxEditExternalTableClassNames.TableWithEmptyCaptionClassName);
13693  this.setCaptionInternal(caption);
13694 },
13695 getCaptionTextNode: function() {
13696  var captionElement = ASPx.GetNodesByPartialClassName(this.GetCaptionCell(), CaptionElementPartialClassName)[0];
13697  return ASPx.GetNormalizedTextNode(captionElement);
13698 },
13699 getCaptionInternal: function() {
13700  var captionText = this.getCaptionTextNode().nodeValue;
13701  if(captionText !== "" && captionText[captionText.length - 1] == ":")
13702   captionText = captionText.substring(0, captionText.length - 1);
13703  return captionText;
13704 },
13705 setCaptionInternal: function(caption) {
13706  caption = ASPx.Str.Trim(caption);
13707  var captionTextNode = this.getCaptionTextNode();
13708  if(this.showCaptionColon && caption[caption.length - 1] != ":" && caption !== "")
13709   caption += ":";
13710  captionTextNode.nodeValue = caption;
13711 },
13712 onVirtualKeyboardUITouchStart: function(evt) { }
13713});
13714var ValidationPattern = ASPx.CreateClass(null, {
13715 constructor: function(errorText) {
13716  this.errorText = errorText;
13717 }
13718});
13719var RequiredFieldValidationPattern = ASPx.CreateClass(ValidationPattern, {
13720 constructor: function(errorText) {
13721  this.constructor.prototype.constructor.call(this, errorText);
13722 },
13723 EvaluateIsValid: function(value) {
13724  return value != null && (value.constructor == Array || ASPx.Str.Trim(value.toString()) != "");
13725 }
13726});
13727var RegularExpressionValidationPattern = ASPx.CreateClass(ValidationPattern, {
13728 constructor: function(errorText, pattern) {
13729  this.constructor.prototype.constructor.call(this, errorText);
13730  this.pattern = pattern;
13731 },
13732 EvaluateIsValid: function(value) {
13733  if(value == null) 
13734   return true;
13735  var strValue = value.toString();
13736  if(ASPx.Str.Trim(strValue).length == 0)
13737   return true;
13738  var regEx = new RegExp(this.pattern);
13739  var matches = regEx.exec(strValue);
13740  return matches != null && strValue == matches[0];
13741 }
13742});
13743function _aspxIsEditorFocusable(inputElement) {
13744 return ASPx.IsFocusableCore(inputElement, function(container) {
13745  return container.getAttribute("errorFrame") == "errorFrame";
13746 });
13747}
13748var invalidEditorToBeFocused = null;
13749var ValidationType = {
13750 PersonalOnValueChanged: "ValueChanged",
13751 PersonalViaScript: "CalledViaScript",
13752 MassValidation: "MassValidation"
13753};
13754var ErrorFrameDisplay = {
13755 None: "None",
13756 Static: "Static",
13757 Dynamic: "Dynamic"
13758};
13759var EditElementSuffix = {
13760 ExternalTable: "_ET",
13761 ControlCell: "_CC",
13762 ErrorCell: "_EC",
13763 ErrorTextCell: "_ETC",
13764 ErrorImage: "_EI",
13765 CaptionCell: "_CapC",
13766 AccessibilityAdditionalTextRow: "_AHTR"
13767};
13768var ASPxEditExternalTableClassNames = {
13769 ValidStaticTableClassName: "dxeValidStEditorTable",
13770 ValidDynamicTableClassName: "dxeValidDynEditorTable",
13771 TableWithSeparateBordersClassName: "tableWithSeparateBorders",
13772 TableWithEmptyCaptionClassName: "tableWithEmptyCaption"
13773};
13774var CaptionRelatedCellClassName = "dxeCaptionRelatedCell";
13775var CaptionElementPartialClassName = "dxeCaption";
13776var AccessibilityAssistantID = "AcAs";
13777var ASPxClientEdit = ASPx.CreateClass(ASPxClientEditBase, {
13778 constructor: function(name) {
13779  this.constructor.prototype.constructor.call(this, name);
13780  this.isASPxClientEdit = true;
13781  this.inputElement = null;
13782  this.convertEmptyStringToNull = true;
13783  this.readOnly = false;
13784  this.clientReadOnly = false;
13785  this.focused = false;
13786  this.focusEventsLocked = false;
13787  this.receiveGlobalMouseWheel = true;
13788  this.styleDecoration = null;
13789  this.heightCorrectionRequired = false;
13790  this.customValidationEnabled = false;
13791  this.display = ErrorFrameDisplay.Static;
13792  this.initialErrorText = "";
13793  this.causesValidation = false;
13794  this.validateOnLeave = true;
13795  this.validationGroup = "";
13796  this.sendPostBackWithValidation = null;
13797  this.validationPatterns = [];
13798  this.setFocusOnError = false;
13799  this.errorDisplayMode = "it";
13800  this.errorText = "";
13801  this.isValid = true;
13802  this.errorImageIsAssigned = false;
13803  this.notifyValidationSummariesToAcceptNewError = false;
13804  this.isErrorFrameRequired = false;
13805  this.enterProcessed = false;
13806  this.keyDownHandlers = {};
13807  this.keyPressHandlers = {};
13808  this.keyUpHandlers = {};
13809  this.specialKeyboardHandlingUsed = false;
13810  this.onKeyDownHandler = null;
13811  this.onKeyPressHandler = null;
13812  this.onKeyUpHandler = null;
13813  this.onGotFocusHandler = null;
13814  this.onLostFocusHandler = null;
13815  this.GotFocus = new ASPxClientEvent();
13816  this.LostFocus = new ASPxClientEvent();
13817  this.Validation = new ASPxClientEvent();
13818  this.ValueChanged = new ASPxClientEvent();
13819  this.KeyDown = new ASPxClientEvent();
13820  this.KeyPress = new ASPxClientEvent();
13821  this.KeyUp = new ASPxClientEvent();
13822  this.eventHandlersInitialized = false;
13823  this.ariaExplanatoryTextManager = null;
13824 },
13825 SetData: function(data){
13826  if(data.decorationStyles){
13827   for(var i = 0; i < data.decorationStyles.length; i++)
13828    this.AddDecorationStyle(data.decorationStyles[i].key, 
13829     data.decorationStyles[i].className, 
13830     data.decorationStyles[i].cssText);
13831  }
13832 },
13833 Initialize: function() {
13834  this.initialErrorText = this.errorText;
13835  ASPxClientEditBase.prototype.Initialize.call(this);
13836  this.InitializeKeyHandlers();
13837  this.UpdateClientValidationState();
13838  this.UpdateValidationSummaries(null , true );
13839 },
13840 InlineInitialize: function() {
13841  ASPxClientEditBase.prototype.InlineInitialize.call(this);
13842  if(!this.eventHandlersInitialized)
13843   this.InitializeEvents();
13844  this.UpdateStyleDecorations();
13845  var externalTable = this.GetExternalTable();
13846  if(externalTable && ASPx.IsPercentageSize(externalTable.style.width)) {
13847   this.width = "100%";
13848   this.GetMainElement().style.width = "100%";
13849   if(this.isErrorFrameRequired)
13850    externalTable.setAttribute("errorFrame", "errorFrame");
13851  }
13852  this.ariaExplanatoryTextManager = this.CreateAriaExplanatoryTextManager();
13853  if(this.clientReadOnly)
13854   this.SetReadOnlyInternal(true);
13855 }, 
13856 AfterInitialize: function() {
13857  this.ariaExplanatoryTextManager.SetCaptionAssociating();
13858  this.ariaExplanatoryTextManager.UpdateText();
13859  this.ariaExplanatoryTextManager.UpdateValidationState();
13860  ASPxClientEditBase.prototype.AfterInitialize.call(this);
13861 },
13862 InitializeEvents: function() {
13863 },
13864 UpdateStyleDecorations: function() {
13865  if(this.styleDecoration)
13866   this.styleDecoration.Update();
13867 },
13868 InitSpecialKeyboardHandling: function(){
13869  var name = this.name;
13870  this.onKeyDownHandler = function(evt) { ASPx.KBSIKeyDown(name,evt); };
13871  this.onKeyPressHandler = function(evt) { ASPx.KBSIKeyPress(name, evt); };
13872  this.onKeyUpHandler = function(evt) { ASPx.KBSIKeyUp(name, evt); };
13873  this.onGotFocusHandler = function(evt) { ASPx.ESGotFocus(name); };
13874  this.onLostFocusHandler = function(evt) { ASPx.ESLostFocus(name); };
13875  this.specialKeyboardHandlingUsed = true;
13876  this.InitializeDelayedSpecialFocus();
13877 },
13878 InitializeKeyHandlers: function() {
13879 },
13880 AddKeyDownHandler: function(key, handler) {
13881  this.keyDownHandlers[key] = handler;
13882 },
13883 AddKeyPressHandler: function(key, handler) {
13884  this.keyPressHandlers[key] = handler;
13885 },
13886 ChangeSpecialInputEnabledAttributes: function(element, method, doNotChangeAutoComplete){
13887  if(!doNotChangeAutoComplete) 
13888   element.autocomplete = "off";
13889  if(this.onKeyDownHandler != null)
13890   method(element, "keydown", this.onKeyDownHandler);
13891  if(this.onKeyPressHandler != null)
13892   method(element, "keypress", this.onKeyPressHandler);
13893  if(this.onKeyUpHandler != null)
13894   method(element, "keyup", this.onKeyUpHandler);
13895  if(this.onGotFocusHandler != null)
13896   method(element, "focus", this.onGotFocusHandler);
13897  if(this.onLostFocusHandler != null)
13898   method(element, "blur", this.onLostFocusHandler);
13899 },
13900 CreateAriaExplanatoryTextManager: function() {
13901  if(this.accessibilityCompliant)
13902   return new EditAccessibilityExplanatoryTextManager(this);
13903  else 
13904   return new DisableAccessibilityExplanatoryTextManager(this);
13905 },
13906 UpdateClientValidationState: function() {
13907  if(!this.customValidationEnabled)
13908   return;
13909  var mainElement = this.GetMainElement();
13910  if(mainElement) {
13911   var validationState = !this.GetIsValid() ? ("-" + this.GetErrorText()) : "";
13912   this.UpdateStateObjectWithObject({ validationState: validationState });
13913  }
13914 },
13915 UpdateValidationSummaries: function(validationType, initializing) {
13916  if(ASPx.Ident.scripts.ASPxClientValidationSummary) {
13917   var summaryCollection = ASPx.GetClientValidationSummaryCollection();
13918   summaryCollection.OnEditorIsValidStateChanged(this, validationType, initializing && this.notifyValidationSummariesToAcceptNewError);
13919  }
13920 },
13921 FindInputElement: function(){
13922  return null;
13923 },
13924 GetInputElement: function(){
13925  if(!ASPx.IsExistsElement(this.inputElement))
13926   this.inputElement = this.FindInputElement();
13927  return this.inputElement;
13928 },
13929 GetFocusableInputElement: function() {
13930  return this.GetInputElement();
13931 },
13932 GetAccessibilityActiveElements: function() {
13933  return [this.GetInputElement()];
13934 },
13935 GetAccessibilityFirstActiveElement: function() {
13936  return this.accessibilityHelper ? 
13937    this.accessibilityHelper.getMainElement() : 
13938    this.GetAccessibilityActiveElements()[0];
13939 },
13940 GetAccessibilityAssistantElement: function() {
13941  return this.GetChildElement(AccessibilityAssistantID);
13942 },
13943 GetErrorImage: function() {
13944  return this.GetCachedElementById(EditElementSuffix.ErrorImage);
13945 },
13946 GetControlCell: function() {
13947  return this.GetCachedElementById(EditElementSuffix.ControlCell);
13948 },
13949 GetErrorCell: function() {
13950  return this.GetCachedElementById(EditElementSuffix.ErrorCell);
13951 },
13952 GetErrorTextCell: function() {
13953  return this.GetCachedElementById(this.errorImageIsAssigned ? EditElementSuffix.ErrorTextCell : EditElementSuffix.ErrorCell);
13954 },
13955 GetReadOnly: function() {
13956  return this.readOnly || this.clientReadOnly;
13957 },
13958 SetReadOnly: function(readOnly) {
13959  readOnly = !!readOnly;
13960  if(this.clientReadOnly === readOnly || this.readOnly)
13961   return;
13962  this.SetReadOnlyInternal(readOnly);
13963 },
13964 SetReadOnlyInternal: function(readOnly) {
13965  this.clientReadOnly = readOnly;
13966  this.ChangeReadOnlyStateItems(readOnly);
13967 },
13968 ChangeReadOnlyStateItems: function(readOnly) {
13969  ASPx.GetStateController().SetElementReadOnly(this.GetMainElement(), readOnly);
13970 },
13971 SetVisible: function (isVisible) {
13972  if(this.clientVisible == isVisible)
13973   return;
13974  var externalTable = this.GetExternalTable();
13975  if(externalTable) {
13976   ASPx.SetElementDisplay(externalTable, isVisible);
13977   if(this.customValidationEnabled) {
13978    var isValid = !isVisible ? true : void (0);
13979    this.UpdateErrorFrameAndFocus(false , true , isValid );
13980   }
13981  }
13982  ASPxClientControl.prototype.SetVisible.call(this, isVisible);
13983 },
13984 GetStateHiddenFieldName: function() {
13985  return this.uniqueID + "$State";
13986 },
13987 GetValueInputToValidate: function() {
13988  return this.GetInputElement();
13989 },
13990 IsVisible: function() {
13991  if(!this.clientVisible)
13992   return false;
13993  var element = this.GetMainElement();
13994  if(!element) 
13995   return false;
13996  while(element && element.tagName != "BODY") {
13997   if(element.getAttribute("errorFrame") != "errorFrame" && (!ASPx.GetElementVisibility(element) || !ASPx.GetElementDisplay(element)))
13998    return false;
13999   element = element.parentNode;
14000  }
14001  return true;
14002 },
14003 AdjustControlCore: function() {
14004  this.CollapseEditor();
14005  this.UnstretchInputElement();
14006  if(this.heightCorrectionRequired)
14007   this.CorrectEditorHeight();
14008 },
14009 CorrectEditorHeight: function() {
14010 },
14011 UnstretchInputElement: function() {
14012 },
14013 UseDelayedSpecialFocus: function() {
14014  return false;
14015 },
14016 GetDelayedSpecialFocusTriggers: function() {
14017  return [ this.GetMainElement() ];
14018 },
14019 InitializeDelayedSpecialFocus: function() {
14020  if(!this.UseDelayedSpecialFocus())
14021   return;
14022  this.specialFocusTimer = -1;    
14023  var handler = function(evt) { this.OnDelayedSpecialFocusMouseDown(evt); }.aspxBind(this);
14024  var triggers = this.GetDelayedSpecialFocusTriggers();
14025  for(var i = 0; i < triggers.length; i++)
14026   ASPx.Evt.AttachEventToElement(triggers[i], "mousedown", handler);
14027 },
14028 OnDelayedSpecialFocusMouseDown: function(evt) {
14029  window.setTimeout(function() { this.SetFocus(); }.aspxBind(this), 0);
14030 },
14031 IsFocusEventsLocked: function() {
14032  return this.focusEventsLocked;
14033 },
14034 LockFocusEvents: function() {
14035  if(!this.focused) return;
14036  this.focusEventsLocked = true;
14037 },
14038 UnlockFocusEvents: function() {
14039  this.focusEventsLocked = false;
14040 },
14041 ForceRefocusEditor: function(evt, isNativeFocus) {
14042  if(ASPx.Browser.VirtualKeyboardSupported && !this.ownerListBox) {
14043   var focusedEditor = ASPx.VirtualKeyboardUI.getFocusedEditor();
14044   if(ASPx.VirtualKeyboardUI.getInputNativeFocusLocked() && (!focusedEditor || focusedEditor === this))
14045     return;
14046   ASPx.VirtualKeyboardUI.setInputNativeFocusLocked(!isNativeFocus);
14047  }
14048  this.LockFocusEvents();
14049  this.BlurInputElement();
14050  window.setTimeout(function() { 
14051   if(ASPx.Browser.VirtualKeyboardSupported && !this.ownerListBox) {
14052    ASPx.VirtualKeyboardUI.setFocusEditorCore(this);
14053   } else {
14054    this.SetFocus();
14055   }
14056  }.aspxBind(this), 0);
14057 },
14058 BlurInputElement: function() {
14059  var inputElement = this.GetFocusableInputElement();
14060  if(inputElement && inputElement.blur)
14061   inputElement.blur();
14062 },
14063 IsEditorElement: function(element) {
14064  return this.GetMainElement() == element || ASPx.GetIsParent(this.GetMainElement(), element);
14065 },
14066 IsClearButtonElement: function(element) {
14067  return false;
14068 },
14069 IsElementBelongToInputElement: function(element) {
14070  return this.GetInputElement() == element;
14071 },
14072 OnFocusCore: function() {
14073  if(this.UseDelayedSpecialFocus())
14074   window.clearTimeout(this.specialFocusTimer);
14075  if(!this.IsFocusEventsLocked()){
14076   this.focused = true;
14077   ASPx.SetFocusedEditor(this);
14078   if(this.styleDecoration)
14079    this.styleDecoration.Update();
14080   if(this.isInitialized)
14081    this.RaiseFocus();
14082  }
14083  else
14084   this.UnlockFocusEvents();
14085 },
14086 OnLostFocusCore: function() {
14087  if(!this.IsFocusEventsLocked()){
14088   this.focused = false;
14089   if(ASPx.GetFocusedEditor() === this)
14090    ASPx.SetFocusedEditor(null);
14091   if(this.styleDecoration)
14092    this.styleDecoration.Update();
14093   this.RaiseLostFocus();
14094  }
14095 },
14096 OnFocus: function() {
14097  if(!this.specialKeyboardHandlingUsed)
14098   this.OnFocusCore();
14099 },
14100 OnLostFocus: function() {
14101  if(this.isInitialized && !this.specialKeyboardHandlingUsed)
14102   this.OnLostFocusCore();
14103 },
14104 OnSpecialFocus: function() {
14105  if(this.isInitialized)
14106   this.OnFocusCore();
14107 },
14108 OnSpecialLostFocus: function() {
14109  if(this.isInitialized)
14110   this.OnLostFocusCore();
14111 },
14112 OnMouseWheel: function(evt){
14113 },
14114 OnValidation: function(validationType) {
14115  if(this.customValidationEnabled && this.isInitialized && ASPx.IsExistsElement(this.GetMainElement()) &&
14116   (!this.IsErrorFrameDisplayed() || this.GetElementRequiredForErrorFrame())) {
14117   this.BeginErrorFrameUpdate();
14118   try {
14119    if(this.validateOnLeave || validationType != ValidationType.PersonalOnValueChanged) {
14120     this.SetIsValid(true, true );
14121     this.SetErrorText(this.initialErrorText, true );
14122     this.ValidateWithPatterns();
14123     this.RaiseValidation();
14124    }
14125    this.UpdateErrorFrameAndFocus(this.editorFocusingRequired(validationType));
14126   } finally {
14127    this.EndErrorFrameUpdate();
14128   }
14129   this.UpdateValidationSummaries(validationType);
14130   this.ariaExplanatoryTextManager.UpdateValidationState(validationType);
14131  }
14132 },
14133 GetElementRequiredForErrorFrame: function() {
14134  return this.GetExternalTable();
14135 },
14136 editorFocusingRequired: function(validationType) {
14137  return !this.GetIsValid() && ((validationType == ValidationType.PersonalOnValueChanged && this.validateOnLeave) ||
14138         (validationType == ValidationType.PersonalViaScript && this.setFocusOnError));
14139 },
14140 OnValueChanged: function() {
14141  if(this.getProcessOnServerOnValueChanged())
14142   this.SendPostBackInternal("");
14143 },
14144 getProcessOnServerOnValueChanged: function() {
14145  var processOnServer = this.RaiseValidationInternal();
14146  return this.RaiseValueChangedEvent() && processOnServer;
14147 },
14148 ParseValue: function() {
14149 },
14150 RaisePersonalStandardValidation: function() {
14151  if(ASPx.IsFunction(window.ValidatorOnChange)) {
14152   var inputElement = this.GetValueInputToValidate();
14153   if(inputElement && inputElement.Validators)
14154    window.ValidatorOnChange({ srcElement: inputElement });
14155  }
14156 },
14157 RaiseValidationInternal: function() {
14158  if(this.isPostBackAllowed() && this.causesValidation && this.validateOnLeave)
14159   return ASPxClientEdit.ValidateGroup(this.validationGroup);
14160  else {
14161   this.OnValidation(ValidationType.PersonalOnValueChanged);
14162   return this.GetIsValid();
14163  }
14164 },
14165 RaiseValueChangedEvent: function(){
14166  return this.RaiseValueChanged();
14167 },
14168 SendPostBackInternal: function(postBackArg) {
14169  if(ASPx.IsFunction(this.sendPostBackWithValidation))
14170   this.sendPostBackWithValidation(postBackArg);
14171  else
14172   this.SendPostBack(postBackArg);
14173 },
14174 SetElementToBeFocused: function() {
14175  if(this.IsVisible())
14176   invalidEditorToBeFocused = this;
14177 },
14178 GetFocusSelectAction: function() {
14179  return null;
14180 },
14181 SetFocus: function() {
14182  var inputElement = this.GetFocusableInputElement();
14183  if(!inputElement) return; 
14184  var isIE9 = ASPx.Browser.IE && ASPx.Browser.Version >= 9;
14185  if((ASPx.GetActiveElement() != inputElement || isIE9) && _aspxIsEditorFocusable(inputElement))
14186   ASPx.SetFocus(inputElement, this.GetFocusSelectAction());
14187 },
14188 SetFocusOnError: function() {
14189  if(invalidEditorToBeFocused == this) {
14190   this.SetFocus();
14191   invalidEditorToBeFocused = null;
14192  }
14193 },
14194 BeginErrorFrameUpdate: function() {
14195  if(!this.errorFrameUpdateLocked)
14196   this.errorFrameUpdateLocked = true;
14197 },
14198 EndErrorFrameUpdate: function() {
14199  this.errorFrameUpdateLocked = false;
14200  var args = this.updateErrorFrameAndFocusLastCallArgs;
14201  if(args) {
14202   this.UpdateErrorFrameAndFocus(args[0], args[1]);
14203   delete this.updateErrorFrameAndFocusLastCallArgs;
14204  }
14205 },
14206 UpdateErrorFrameAndFocus: function(setFocusOnError, ignoreVisibilityCheck, isValid) {
14207  if(!this.GetEnabled() || !ignoreVisibilityCheck && !this.GetVisible())
14208   return;
14209  if(this.errorFrameUpdateLocked) {
14210   this.updateErrorFrameAndFocusLastCallArgs = [ setFocusOnError, ignoreVisibilityCheck ];
14211   return;
14212  }
14213  if(this.styleDecoration)
14214   this.styleDecoration.Update();
14215  if(typeof(isValid) == "undefined")
14216   isValid = this.GetIsValid();
14217  var externalTable = this.GetExternalTable();
14218  var isStaticDisplay = this.display == ErrorFrameDisplay.Static;
14219  if(isValid && this.IsErrorFrameDisplayed()) {
14220   if(isStaticDisplay) {
14221    this.HideErrorCell(true);
14222    ASPx.AddClassNameToElement(externalTable, ASPxEditExternalTableClassNames.ValidStaticTableClassName);
14223   } else {
14224    this.HideErrorCell();
14225    this.SaveControlCellStyles();
14226    this.ClearControlCellStyles();
14227    ASPx.AddClassNameToElement(externalTable, ASPxEditExternalTableClassNames.ValidDynamicTableClassName);
14228   }
14229  } else {
14230   var editorLocatedWithinVisibleContainer = this.IsVisible();
14231   if(this.IsErrorFrameDisplayed()) {
14232    this.UpdateErrorCellContent();
14233    if(isStaticDisplay) {
14234     this.ShowErrorCell(true);
14235     ASPx.RemoveClassNameFromElement(externalTable, ASPxEditExternalTableClassNames.ValidStaticTableClassName);
14236    } else {
14237     this.EnsureControlCellStylesLoaded();
14238     this.RestoreControlCellStyles();
14239     this.ShowErrorCell();
14240     ASPx.RemoveClassNameFromElement(externalTable, ASPxEditExternalTableClassNames.ValidDynamicTableClassName);
14241    }
14242   }
14243   if(editorLocatedWithinVisibleContainer) {
14244    if(setFocusOnError && this.setFocusOnError && invalidEditorToBeFocused == null) {
14245     this.SetElementToBeFocused();
14246     this.SetFocusOnError();
14247    }
14248   }
14249  }
14250 },
14251 ShowErrorCell: function (useVisibilityAttribute) {
14252  var errorCell = this.GetErrorCell();
14253  if(errorCell) {
14254   if(useVisibilityAttribute)
14255    ASPx.SetElementVisibility(errorCell, true);
14256   else
14257    ASPx.SetElementDisplay(errorCell, true);
14258  }
14259 },
14260 HideErrorCell: function(useVisibilityAttribute) {
14261  var errorCell = this.GetErrorCell();
14262  if(errorCell) {
14263   if(useVisibilityAttribute)
14264    ASPx.SetElementVisibility(errorCell, false);
14265   else
14266    ASPx.SetElementDisplay(errorCell, false);
14267  }
14268 },
14269 SaveControlCellStyles: function() {
14270  this.EnsureControlCellStylesLoaded();
14271 },
14272 EnsureControlCellStylesLoaded: function() {
14273  if(typeof(this.controlCellStyles) == "undefined") {
14274   var controlCell = this.GetControlCell();
14275   this.controlCellStyles = {
14276    cssClass: controlCell.className,
14277    style: this.ExtractElementStyleStringIgnoringVisibilityProps(controlCell)
14278   };
14279  }
14280 },
14281 ClearControlCellStyles: function() {
14282  this.ClearElementStyle(this.GetControlCell());
14283 },
14284 RestoreControlCellStyles: function() {
14285  var controlCell = this.GetControlCell();
14286  var externalTable = this.GetExternalTable();
14287  if(ASPx.Browser.WebKitFamily)
14288   this.MakeBorderSeparateForTable(externalTable);
14289  controlCell.className = this.controlCellStyles.cssClass;
14290  controlCell.style.cssText = this.controlCellStyles.style;
14291  if(ASPx.Browser.WebKitFamily)
14292   this.UndoBorderSeparateForTable(externalTable);
14293 },
14294 MakeBorderSeparateForTable: function(table) {
14295  ASPx.AddClassNameToElement(table, ASPxEditExternalTableClassNames.TableWithSeparateBordersClassName);
14296 },
14297 UndoBorderSeparateForTable: function(table) {
14298  setTimeout(function () {
14299   ASPx.RemoveClassNameFromElement(table, ASPxEditExternalTableClassNames.TableWithSeparateBordersClassName);
14300  }, 0);
14301 },
14302 ExtractElementStyleStringIgnoringVisibilityProps: function(element) {
14303  var savedVisibility = element.style.visibility;
14304  var savedDisplay = element.style.display;
14305  element.style.visibility = "";
14306  element.style.display = "";
14307  var styleStr = element.style.cssText;
14308  element.style.visibility = savedVisibility;
14309  element.style.display = savedDisplay;
14310  return styleStr;
14311 },
14312 ClearElementStyle: function(element) {
14313  if(!element)
14314   return;
14315  element.className = "";
14316  var excludedAttrNames = [
14317   "width", "display", "visibility",
14318   "position", "left", "top", "z-index",
14319   "margin", "margin-top", "margin-right", "margin-bottom", "margin-left",
14320   "float", "clear"
14321  ];
14322  var savedAttrValues = { };
14323  for(var i = 0; i < excludedAttrNames.length; i++) {
14324   var attrName = excludedAttrNames[i];
14325   var attrValue = element.style[attrName];
14326   if(attrValue)
14327    savedAttrValues[attrName] = attrValue;
14328  }
14329  element.style.cssText = "";
14330  for(var styleAttrName in savedAttrValues)
14331   if(savedAttrValues.hasOwnProperty(styleAttrName))
14332    element.style[styleAttrName] = savedAttrValues[styleAttrName];
14333 },
14334 Clear: function() {
14335  this.SetValue(null);
14336  this.SetIsValid(true);
14337  return true;
14338 },
14339 UpdateErrorCellContent: function() {
14340  if(this.errorDisplayMode.indexOf("t") > -1)
14341   this.UpdateErrorText();
14342  if(this.errorDisplayMode == "i")
14343   this.UpdateErrorImage();
14344 },
14345 UpdateErrorImage: function() {
14346  var image = this.GetErrorImage();
14347  if(ASPx.IsExistsElement(image)) {
14348   if(this.accessibilityCompliant) {
14349    ASPx.Attr.SetAttribute(image, "aria-label", this.errorText);
14350    var innerImg = ASPx.GetNodeByTagName(image, "IMG", 0);
14351    if(ASPx.IsExists(innerImg))
14352     innerImg.alt = this.errorText;
14353   }
14354   image.alt = this.errorText;
14355   image.title = this.errorText;
14356  } else {
14357   this.UpdateErrorText();
14358  }
14359 },
14360 UpdateErrorText: function() {
14361  var errorTextCell = this.GetErrorTextCell();
14362  if(ASPx.IsExistsElement(errorTextCell))
14363   errorTextCell.innerHTML = this.HtmlEncode(this.errorText);
14364 },
14365 ValidateWithPatterns: function() {
14366  if(this.validationPatterns.length > 0) {
14367   var value = this.GetValue();
14368   for(var i = 0; i < this.validationPatterns.length; i++) {
14369    var validator = this.validationPatterns[i];
14370    if(!validator.EvaluateIsValid(value)) {
14371     this.SetIsValid(false, true );
14372     this.SetErrorText(validator.errorText, true );
14373     return;
14374    }
14375   }
14376  }
14377 },
14378 OnSpecialKeyDown: function(evt){
14379  this.RaiseKeyDown(evt);
14380  var handler = this.keyDownHandlers[evt.keyCode];
14381  if(handler) 
14382   return this[handler](evt);
14383  return false;
14384 },
14385 OnSpecialKeyPress: function(evt){
14386  this.RaiseKeyPress(evt);
14387  var handler = this.keyPressHandlers[evt.keyCode];
14388  if(handler) 
14389   return this[handler](evt);
14390  if(ASPx.Browser.NetscapeFamily || ASPx.Browser.Opera){
14391   if(evt.keyCode == ASPx.Key.Enter)
14392    return this.enterProcessed;
14393  }
14394  return false;
14395 },
14396 OnSpecialKeyUp: function(evt){
14397  this.RaiseKeyUp(evt);
14398  var handler = this.keyUpHandlers[evt.keyCode];
14399  if(handler) 
14400   return this[handler](evt);
14401  return false;
14402 },
14403 OnKeyDown: function(evt) {
14404  if(!this.specialKeyboardHandlingUsed)
14405   this.RaiseKeyDown(evt);
14406 },
14407 OnKeyPress: function(evt) {
14408  if(!this.specialKeyboardHandlingUsed)
14409   this.RaiseKeyPress(evt);
14410 },
14411 OnKeyUp: function(evt) {
14412  if(!this.specialKeyboardHandlingUsed)
14413   this.RaiseKeyUp(evt);
14414 },
14415 RaiseKeyDown: function(evt){
14416  if(!this.KeyDown.IsEmpty()){
14417   var args = new ASPxClientEditKeyEventArgs(evt);
14418   this.KeyDown.FireEvent(this, args);
14419  }
14420 },
14421 RaiseKeyPress: function(evt){
14422  if(!this.KeyPress.IsEmpty()){
14423   var args = new ASPxClientEditKeyEventArgs(evt);
14424   this.KeyPress.FireEvent(this, args);
14425  }
14426 },
14427 RaiseKeyUp: function(evt){
14428  if(!this.KeyUp.IsEmpty()){
14429   var args = new ASPxClientEditKeyEventArgs(evt);
14430   this.KeyUp.FireEvent(this, args);
14431  }
14432 },
14433 RaiseFocus: function(){
14434  if(!this.GotFocus.IsEmpty()){
14435   var args = new ASPxClientEventArgs();
14436   this.GotFocus.FireEvent(this, args);
14437  }
14438 },
14439 RaiseLostFocus: function(){
14440  if(!this.LostFocus.IsEmpty()){
14441   var args = new ASPxClientEventArgs();
14442   this.LostFocus.FireEvent(this, args);
14443  }
14444 },
14445 RaiseValidation: function() {
14446  if(this.customValidationEnabled && !this.Validation.IsEmpty()) {
14447   var currentValue = this.GetValue();
14448   var args = new ASPxClientEditValidationEventArgs(currentValue, this.errorText, this.GetIsValid());
14449   this.Validation.FireEvent(this, args);
14450   this.SetErrorText(args.errorText, true );
14451   this.SetIsValid(args.isValid, true );
14452   if(args.value != currentValue)
14453    this.SetValue(args.value);
14454  }
14455 },
14456 RaiseValueChanged: function(){
14457  var processOnServer = this.isPostBackAllowed();
14458  if(!this.ValueChanged.IsEmpty()){
14459   var args = new ASPxClientProcessingModeEventArgs(processOnServer);
14460   this.ValueChanged.FireEvent(this, args);
14461   processOnServer = args.processOnServer;
14462  }
14463  return processOnServer;  
14464 },
14465 isPostBackAllowed: function() {
14466  return this.autoPostBack;
14467 },
14468 AddDecorationStyle: function(key, className, cssText) {
14469  if(!this.styleDecoration) 
14470   this.RequireStyleDecoration();
14471  this.styleDecoration.AddStyle(key, className, cssText);
14472 }, 
14473 RequireStyleDecoration: function() {
14474  this.styleDecoration = this.CreateStyleDecoration();
14475  this.PopulateStyleDecorationPostfixes();
14476 },
14477 CreateStyleDecoration: function() {
14478  return new ASPx.EditorStyleDecoration(this);
14479 },
14480 PopulateStyleDecorationPostfixes: function() {
14481  this.styleDecoration.AddPostfix("");
14482 },
14483 LockStyleDecorationUpdate: function() {
14484  if(this.styleDecoration)
14485   this.styleDecoration.LockUpdate();
14486 },
14487 UnlockStyleDecorationUpdate: function() {
14488  if(this.styleDecoration)
14489   this.styleDecoration.UnlockUpdate();
14490 },
14491 Focus: function(){
14492  this.SetFocus();
14493 },
14494 GetIsValid: function() {
14495  var hasRequiredInputElement = !this.RequireInputElementToValidate() || ASPx.IsExistsElement(this.GetInputElement());
14496  if(!hasRequiredInputElement || this.IsErrorFrameDisplayed() && !ASPx.IsExistsElement(this.GetElementRequiredForErrorFrame()))
14497   return true;
14498  return this.isValid;
14499 },
14500 RequireInputElementToValidate: function() {
14501  return true;
14502 },
14503 IsErrorFrameDisplayed: function() {
14504  return this.display !== ErrorFrameDisplay.None;
14505 },
14506 GetErrorText: function(){
14507  return this.errorText;
14508 },
14509 SetIsValid: function(isValid, validating){
14510  if(this.customValidationEnabled && this.isValid != isValid) {
14511   this.isValid = isValid;
14512   this.UpdateErrorFrameAndFocus(false );
14513   this.UpdateClientValidationState();
14514   if(!validating)
14515    this.UpdateValidationSummaries(ValidationType.PersonalViaScript);
14516  }
14517 },
14518 SetErrorText: function(errorText, validating){
14519  if(this.customValidationEnabled && this.errorText != errorText) {
14520   this.errorText = errorText;
14521   this.UpdateErrorFrameAndFocus(false );
14522   this.UpdateClientValidationState();
14523   if(!validating)
14524    this.UpdateValidationSummaries(ValidationType.PersonalViaScript);
14525  }
14526 },
14527 Validate: function(){
14528  this.ParseValue();
14529  this.OnValidation(ValidationType.PersonalViaScript);
14530 },
14531 GetModifyEvent: function() {
14532  return this.ValueChanged;
14533 },
14534 EnsureRequiredNativeAttributesExists: function() { }
14535});
14536ASPx.Ident.scripts.ASPxClientEdit = true;
14537ASPx.focusedEditorName = "";
14538ASPx.GetFocusedEditor = function() {
14539 var focusedEditor = ASPx.GetControlCollection().Get(ASPx.focusedEditorName);
14540 if(focusedEditor && !focusedEditor.focused){
14541  ASPx.SetFocusedEditor(null);
14542  focusedEditor = null;
14543 }
14544 return focusedEditor;
14545};
14546ASPx.SetFocusedEditor = function(editor) {
14547 ASPx.focusedEditorName = editor ? editor.name : "";
14548};
14549ASPx.FindAssociatedLabelElements = function(editor) {
14550 var assocciatedLabels = [];
14551 var inputElement = editor.GetInputElement();
14552 if(!ASPx.IsExists(inputElement) || !inputElement.id) 
14553  return assocciatedLabels;
14554 var labels = ASPx.GetNodesByTagName(document, "LABEL");
14555 for(var i = 0; i < labels.length; i++) {
14556  if(!!labels[i].htmlFor && labels[i].htmlFor === inputElement.id)
14557   assocciatedLabels.push(labels[i]);
14558 }
14559 return assocciatedLabels;
14560};
14561var DisableAccessibilityExplanatoryTextManager = ASPx.CreateClass(null, {
14562 constructor: function(editor) {
14563  this.editor = editor;
14564 },
14565 GetAdditionalTextRowId: function() {
14566  return this.editor.name + EditElementSuffix.AccessibilityAdditionalTextRow;
14567 },
14568 GetErrorTextElement: function () {
14569  return !!this.editor.GetErrorTextCell() ? this.editor.GetErrorTextCell() : this.editor.GetErrorImage();
14570 },
14571 GetTextElement: function() { return null; },
14572 SetCaptionAssociating: function() { },
14573 UpdateText: function() { },
14574 UpdateValidationState: function(validationType) { },
14575 ToggleErrorAlert: function() { },
14576 SetOrRemoveText: function(accessibilityElements, textElement, setText, isLabel, isFirst) { }
14577});
14578var EditAccessibilityExplanatoryTextManager = ASPx.CreateClass(DisableAccessibilityExplanatoryTextManager, {
14579 constructor: function(editor) {
14580  this.constructor.prototype.constructor.call(this, editor);
14581  this.invisibleRowCssClassName = "dxAIR";
14582 },
14583 GetTextElement: function() {
14584  var mainElement = this.editor.GetMainElement();
14585  if(!mainElement) return null;
14586  var explanatoryText = "";
14587  var explanatoryTextElement = null;
14588  if(!!this.editor.nullText)
14589   explanatoryText = this.editor.nullText;
14590  else if(!!this.editor.helpTextObj)
14591   explanatoryTextElement = this.editor.helpTextObj.helpTextElement;
14592  else if(!!mainElement.title)
14593   explanatoryText = mainElement.title;
14594  if(explanatoryText && mainElement.tagName == "TABLE") {
14595   var assistantElement = this.editor.GetAccessibilityFirstActiveElement();
14596   if(assistantElement)
14597    ASPx.Attr.Aria.AppendLabel(assistantElement, explanatoryText, true);
14598  }
14599  return explanatoryTextElement;
14600 },
14601 SetCaptionAssociating: function() {
14602  var captionCell = this.editor.GetCaptionCell();
14603  if(!captionCell || captionCell.childNodes[0].tagName == "LABEL") return;
14604  var labelElement = captionCell.childNodes[0];
14605  ASPx.EditAccessibilityExplanatoryTextManager.SetLabelAssociating(this.editor, this.editor.GetAccessibilityFirstActiveElement(), labelElement);
14606 },
14607 UpdateText: function() {
14608  var additionalTextElement = this.GetTextElement();
14609  if(ASPx.IsExists(additionalTextElement)) {
14610   var pronounceElement = this.editor.GetAccessibilityFirstActiveElement();
14611   var hasAnyLabel = !!ASPx.Attr.GetAttribute(pronounceElement, "aria-label") || 
14612    !!ASPx.Attr.GetAttribute(pronounceElement, "aria-labelledby") ||
14613    ASPx.FindAssociatedLabelElements(this.editor).length > 0;
14614   this.SetOrRemoveText([pronounceElement], additionalTextElement, true, !hasAnyLabel, false);
14615  }
14616 },
14617 UpdateValidationState: function(validationType) {
14618  if(validationType == ValidationType.PersonalOnValueChanged && this.editor.accessibilityHelper) return;
14619  var accessibilityElements = this.editor.GetAccessibilityActiveElements();
14620  var errorTextElement = this.GetErrorTextElement();
14621  this.SetOrRemoveText(accessibilityElements, errorTextElement, !this.editor.isValid, false, true);
14622  if(accessibilityElements.length > 0 && !!errorTextElement) {
14623   for(var i = 0; i < accessibilityElements.length; i++) {
14624    if(!ASPx.IsExists(accessibilityElements[i])) continue;
14625    ASPx.Attr.SetOrRemoveAttribute(accessibilityElements[i], "aria-invalid", !this.editor.isValid);
14626   }
14627  }
14628 },
14629 ToggleErrorAlert: function() {
14630  var errorTextElement = this.GetErrorTextElement();
14631  ASPx.SetElementDisplay(errorTextElement, false);
14632  ASPx.Attr.SetAttribute(errorTextElement, 'role', 'alert');
14633  ASPx.SetElementDisplay(errorTextElement, true);
14634  setTimeout(function() { ASPx.Attr.RemoveAttribute(errorTextElement, 'role'); }, 500);
14635 },
14636 SetOrRemoveText: function(accessibilityElements, textElement, setText, isLabel, isFirst) {
14637  var idsRefAttribute = isLabel ? ASPx.Attr.Aria.labelled : ASPx.Attr.Aria.described;
14638  if(!textElement) return;
14639  var textId = !!textElement.id ? textElement.id : textElement.parentNode.id;
14640  for(var i = 0; i < accessibilityElements.length; i++) {
14641   if(!accessibilityElements[i]) continue;
14642   var descRefString = ASPx.Attr.GetAttribute(accessibilityElements[i], idsRefAttribute);
14643   var descRefIds = !!descRefString ? descRefString.split(" ") : [ ];
14644   var descIndex = descRefIds.indexOf(textId);
14645   if(setText && descIndex == -1) {
14646    if(isFirst)
14647     descRefIds.unshift(textId);
14648    else
14649     descRefIds.push(textId);
14650   }
14651   else if(!setText && descIndex > -1)
14652    descRefIds.splice(descIndex, 1);
14653   ASPx.Attr.SetOrRemoveAttribute(accessibilityElements[i], idsRefAttribute, descRefIds.join(" "));
14654  }
14655 }
14656});
14657ASPx.DisableAccessibilityExplanatoryTextManager = DisableAccessibilityExplanatoryTextManager;
14658ASPx.EditAccessibilityExplanatoryTextManager = EditAccessibilityExplanatoryTextManager;
14659ASPx.EditAccessibilityExplanatoryTextManager.SetLabelAssociating = function(editor, activeElement, labelElement) {
14660 var clickHandler = function(evt) {
14661  if(editor && editor.OnAssociatedLabelClick)
14662   editor.OnAssociatedLabelClick(evt);
14663  else
14664   activeElement.click();
14665 };
14666 ASPx.Evt.AttachEventToElement(labelElement, "click", clickHandler);
14667 if(!!editor) {
14668  var hasAriaLabel = !!ASPx.Attr.GetAttribute(activeElement, "aria-label");
14669  editor.ariaExplanatoryTextManager.SetOrRemoveText([activeElement], labelElement, true, !hasAriaLabel, true);
14670 }
14671};
14672ASPxClientEdit.ClearEditorsInContainer = function(container, validationGroup, clearInvisibleEditors) {
14673 invalidEditorToBeFocused = null;
14674 ASPx.ProcessEditorsInContainer(container, ASPx.ClearProcessingProc, ASPx.ClearChoiceCondition, validationGroup, clearInvisibleEditors, true );
14675 ASPxClientEdit.ClearExternalControlsInContainer(container, validationGroup, clearInvisibleEditors, true );
14676};
14677ASPxClientEdit.ClearEditorsInContainerById = function(containerId, validationGroup, clearInvisibleEditors) {
14678 var container = document.getElementById(containerId);
14679 this.ClearEditorsInContainer(container, validationGroup, clearInvisibleEditors);
14680};
14681ASPxClientEdit.ClearGroup = function(validationGroup, clearInvisibleEditors) {
14682 return this.ClearEditorsInContainer(null, validationGroup, clearInvisibleEditors);
14683};
14684ASPxClientEdit.ValidateEditorsInContainer = function(container, validationGroup, validateInvisibleEditors) {
14685 var summaryCollection;
14686 if(ASPx.Ident.scripts.ASPxClientValidationSummary) {
14687  summaryCollection = ASPx.GetClientValidationSummaryCollection();
14688  summaryCollection.AllowNewErrorsAccepting(validationGroup);
14689 }
14690 var validationResult = ASPx.ProcessEditorsInContainer(container, ASPx.ValidateProcessingProc, _aspxValidateChoiceCondition, validationGroup, validateInvisibleEditors,
14691  false );
14692 validationResult.isValid = ASPxClientEdit.ValidateExternalControlsInContainer(container, validationGroup, validateInvisibleEditors,
14693  false ) && validationResult.isValid;
14694 if(typeof(validateInvisibleEditors) == "undefined")
14695  validateInvisibleEditors = false;
14696 if(typeof(validationGroup) == "undefined")
14697  validationGroup = null;    
14698 ASPx.GetControlCollection().RaiseValidationCompleted(container, validationGroup,
14699 validateInvisibleEditors, validationResult.isValid, validationResult.firstInvalid, validationResult.firstVisibleInvalid);
14700 if(summaryCollection)
14701  summaryCollection.ForbidNewErrorsAccepting(validationGroup);
14702 if(!validationResult.isValid && !!validationResult.firstVisibleInvalid && validationResult.firstVisibleInvalid.accessibilityCompliant && !validationResult.firstVisibleInvalid.setFocusOnError) {
14703  var accessInvalidControl = validationResult.firstVisibleInvalid;
14704  if(!summaryCollection && !accessInvalidControl.focused) {
14705   var beforeDelayActiveElement = ASPx.GetActiveElement();
14706   setTimeout(function() {
14707    var currentActiveElement = ASPx.GetActiveElement();
14708    if(accessInvalidControl.focused || (currentActiveElement != beforeDelayActiveElement && ASPx.Attr.IsExistsAttribute(currentActiveElement, 'role')))
14709     return;
14710    accessInvalidControl.ariaExplanatoryTextManager.ToggleErrorAlert();
14711   }, 500);    
14712  }
14713 }
14714 return validationResult.isValid;
14715};
14716ASPxClientEdit.ValidateEditorsInContainerById = function(containerId, validationGroup, validateInvisibleEditors) {
14717 var container = document.getElementById(containerId);
14718 return this.ValidateEditorsInContainer(container, validationGroup, validateInvisibleEditors);
14719};
14720ASPxClientEdit.ValidateGroup = function(validationGroup, validateInvisibleEditors) {
14721 return this.ValidateEditorsInContainer(null, validationGroup, validateInvisibleEditors);
14722};
14723ASPxClientEdit.AreEditorsValid = function(containerOrContainerId, validationGroup, checkInvisibleEditors) {
14724 var container = typeof(containerOrContainerId) == "string" ? document.getElementById(containerOrContainerId) : containerOrContainerId;
14725 var checkResult = ASPx.ProcessEditorsInContainer(container, ASPx.EditorsValidProcessingProc, _aspxEditorsValidChoiceCondition, validationGroup,
14726  checkInvisibleEditors, false );
14727 checkResult.isValid = ASPxClientEdit.AreExternalControlsValidInContainer(containerOrContainerId, validationGroup,
14728  checkInvisibleEditors, false ) && checkResult.isValid;
14729 return checkResult.isValid;
14730};
14731ASPxClientEdit.AreExternalControlsValidInContainer = function(containerId, validationGroup, validateInvisibleEditors, processDisabledEditors) {
14732 if(ASPx.Ident.scripts.ASPxClientHtmlEditor)
14733  return ASPxClientHtmlEditor.AreEditorsValidInContainer(containerId, validationGroup, validateInvisibleEditors, processDisabledEditors);
14734 return true;
14735};
14736ASPxClientEdit.ClearExternalControlsInContainer = function(containerId, validationGroup, validateInvisibleEditors, processDisabledEditors) {
14737 if(ASPx.Ident.scripts.ASPxClientHtmlEditor)
14738  return ASPxClientHtmlEditor.ClearEditorsInContainer(containerId, validationGroup, validateInvisibleEditors, processDisabledEditors);
14739 return true;
14740};
14741ASPxClientEdit.ValidateExternalControlsInContainer = function(containerId, validationGroup, validateInvisibleEditors, processDisabledEditors) {
14742 if(ASPx.Ident.scripts.ASPxClientHtmlEditor)
14743  return ASPxClientHtmlEditor.ValidateEditorsInContainer(containerId, validationGroup, validateInvisibleEditors, processDisabledEditors);
14744 return true;
14745};
14746ASPxClientEdit.AttachEditorModificationListener = function(handler, predicate) {
14747 var processAction = function(event) { event.AddHandler(handler); };
14748 ASPxClientEdit.ProcessEditorModificationListener(handler, processAction, predicate);
14749};
14750ASPxClientEdit.DetachEditorModificationListener = function(handler, predicate) {
14751 var processAction = function(event) { event.RemoveHandler(handler); };
14752 ASPxClientEdit.ProcessEditorModificationListener(handler, processAction, predicate);
14753};
14754ASPxClientEdit.ProcessEditorModificationListener = function(handler, action, predicate) {
14755 ASPx.GetControlCollection().ForEachControl(function(control) {
14756  if(control.GetModifyEvent && predicate(control)) {
14757   if(control.isNative)
14758    control.EnsureRequiredNativeAttributesExists();
14759   action(control.GetModifyEvent());
14760  }
14761 });
14762};
14763var ASPxClientEditKeyEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
14764 constructor: function(htmlEvent) {
14765  this.constructor.prototype.constructor.call(this);
14766  this.htmlEvent = htmlEvent;
14767 }
14768});
14769var ASPxClientEditValidationEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
14770 constructor: function(value, errorText, isValid) {
14771  this.constructor.prototype.constructor.call(this);
14772  this.errorText = errorText;
14773  this.isValid = isValid;
14774  this.value = value;
14775 }
14776});
14777ASPx.ProcessEditorsInContainer = function(container, processingProc, choiceCondition, validationGroup, processInvisibleEditors, processDisabledEditors) {
14778 var allProcessedSuccessfull = true;
14779 var firstInvalid = null;
14780 var firstVisibleInvalid = null;
14781 var invalidEditorToBeFocused = null;
14782 ASPx.GetControlCollection().ForEachControl(function(control) {
14783  var needToProcessRatingControl = window.ASPxClientRatingControl && (control instanceof ASPxClientRatingControl) && processingProc === ASPx.ClearProcessingProc;
14784  if(!ASPx.Ident.isDialogInvisibleControl(control) && (ASPx.Ident.IsASPxClientEdit(control) || needToProcessRatingControl) && (processDisabledEditors || control.GetEnabled())) {
14785   var mainElement = control.GetMainElement();
14786   if(mainElement &&
14787    (container == null || ASPx.GetIsParent(container, mainElement)) &&
14788    (processInvisibleEditors || control.IsVisible()) &&
14789    (!choiceCondition || choiceCondition(control, validationGroup))) {
14790    var isSuccess = processingProc(control);
14791    if(!isSuccess) {
14792     allProcessedSuccessfull = false;
14793     if(firstInvalid == null)
14794      firstInvalid = control;
14795     var isVisible = control.IsVisible();
14796     if(isVisible && firstVisibleInvalid == null)
14797      firstVisibleInvalid = control;
14798     if(control.setFocusOnError && invalidEditorToBeFocused == null && isVisible)
14799      invalidEditorToBeFocused = control;
14800    }
14801   }
14802  }
14803 }, this);
14804 if(invalidEditorToBeFocused != null)
14805  invalidEditorToBeFocused.SetFocus();
14806 return new ASPxValidationResult(allProcessedSuccessfull, firstInvalid, firstVisibleInvalid);
14807};
14808var ASPxValidationResult = ASPx.CreateClass(null, {
14809 constructor: function(isValid, firstInvalid, firstVisibleInvalid) {
14810  this.isValid = isValid;
14811  this.firstInvalid = firstInvalid;
14812  this.firstVisibleInvalid = firstVisibleInvalid;
14813 }
14814});
14815ASPx.ClearChoiceCondition = function(edit, validationGroup) {
14816 return !ASPx.IsExists(validationGroup) || (edit.validationGroup == validationGroup);
14817};
14818function _aspxValidateChoiceCondition(edit, validationGroup) {
14819 return ASPx.ClearChoiceCondition(edit, validationGroup) && edit.customValidationEnabled;
14820}
14821function _aspxEditorsValidChoiceCondition(edit, validationGroup) {
14822 return _aspxValidateChoiceCondition(edit, validationGroup);
14823}
14824function wrapLostFocusHandler(handler) {
14825 if(ASPx.Browser.Edge) {
14826  return function(name) {
14827   var edit = ASPx.GetControlCollection().Get(name);
14828   if(edit && !ASPx.IsElementVisible(edit.GetMainElement()))
14829    setTimeout(handler, 0, name);
14830   else
14831    handler(name);
14832  };
14833 }
14834 return handler;
14835}
14836ASPx.EGotFocus = function(name) {
14837 var edit = ASPx.GetControlCollection().Get(name); 
14838 if(!edit) return;
14839 if(!edit.isInitialized){
14840  var inputElement = edit.GetFocusableInputElement();
14841  if(inputElement && inputElement === document.activeElement) {
14842   if(ASPx.Browser.Firefox)
14843    window.setTimeout(function() { document.activeElement.blur(); }, 0);
14844   else
14845    document.activeElement.blur();
14846  }
14847  return;
14848 }
14849 if(ASPx.Browser.VirtualKeyboardSupported && !edit.ownerListBox)
14850  ASPx.VirtualKeyboardUI.onCallingVirtualKeyboard(edit, false);
14851 else
14852  edit.OnFocus();
14853};
14854ASPx.ELostFocusCore = function(name) {
14855 var edit = ASPx.GetControlCollection().Get(name);
14856 if(ASPx.Browser.VirtualKeyboardSupported && (!edit || !edit.ownerListBox)) {
14857  var supressLostFocus = ASPx.VirtualKeyboardUI.isInputNativeBluring();
14858  if(supressLostFocus)
14859   return;
14860  ASPx.VirtualKeyboardUI.resetFocusedEditor();
14861 }
14862 if(edit != null)
14863  edit.OnLostFocus();
14864};
14865ASPx.ELostFocus = wrapLostFocusHandler(ASPx.ELostFocusCore);
14866ASPx.ESGotFocus = function(name) {
14867 var edit = ASPx.GetControlCollection().Get(name); 
14868 if(!edit) return;
14869   if(ASPx.Browser.VirtualKeyboardSupported && !edit.ownerListBox) {
14870  ASPx.VirtualKeyboardUI.onCallingVirtualKeyboard(edit, true);
14871 } else {
14872  edit.OnSpecialFocus();
14873 }
14874};
14875ASPx.ESLostFocusCore = function(name) {
14876 var edit = ASPx.GetControlCollection().Get(name);
14877 if(ASPx.Browser.VirtualKeyboardSupported && (!edit || !edit.ownerListBox)) {
14878  var supressLostFocus = ASPx.VirtualKeyboardUI.isInputNativeBluring();
14879  if(supressLostFocus)
14880   return;
14881  ASPx.VirtualKeyboardUI.resetFocusedEditor();
14882 }
14883 if(!edit) return;
14884 if(edit.UseDelayedSpecialFocus())
14885  edit.specialFocusTimer = window.setTimeout(function() { edit.OnSpecialLostFocus(); }, 30);
14886 else
14887  edit.OnSpecialLostFocus();
14888};
14889ASPx.ESLostFocus = wrapLostFocusHandler(ASPx.ESLostFocusCore);
14890ASPx.EValueChanged = function(name) {
14891 var edit = ASPx.GetControlCollection().Get(name);
14892 if(edit != null)
14893  edit.OnValueChanged();
14894};
14895ASPx.VirtualKeyboardUI = (function() {
14896 var focusedEditor = null;
14897 var inputNativeFocusLocked = false;
14898 function elementBelongsToEditor(element) {
14899  if(!element) return false;
14900  var isBelongsToEditor = false;
14901  ASPx.GetControlCollection().ForEachControl(function(control) {
14902   if(ASPx.Ident.IsASPxClientEdit(control) && control.IsEditorElement(element)) {
14903    isBelongsToEditor = true;
14904    return true;
14905   }
14906  }, this);
14907  return isBelongsToEditor;
14908 }
14909 function elementBelongsToFocusedEditor(element) {
14910  return focusedEditor && focusedEditor.IsEditorElement(element);
14911 }
14912 return {
14913  onTouchStart: function (evt) {
14914   if (!ASPx.Browser.VirtualKeyboardSupported || this.isGooglePlaceAutocompleteElementTap(evt)) return;
14915   inputNativeFocusLocked = false;
14916   if(focusedEditor)
14917    focusedEditor.onVirtualKeyboardUITouchStart(evt);
14918   if(ASPx.TouchUIHelper.pointerEnabled) {
14919    if(evt.pointerType != ASPx.TouchUIHelper.pointerType.Touch)
14920     return;
14921    this.processFocusEditorControl(evt);
14922   } else
14923    ASPx.TouchUIHelper.handleFastTapIfRequired(evt,  function(){ this.processFocusEditorControl(evt); }.aspxBind(this), false);
14924  },
14925  processFocusEditorControl: function(evt) {
14926   var evtSource = ASPx.Evt.GetEventSource(evt);
14927   var timeEditHasAppliedFocus = focusedEditor && (ASPx.Ident.IsASPxClientTimeEdit && ASPx.Ident.IsASPxClientTimeEdit(focusedEditor));
14928   var focusedTimeEditBelongsToDateEdit = timeEditHasAppliedFocus && focusedEditor.OwnerDateEdit && focusedEditor.OwnerDateEdit.GetShowTimeSection();
14929   if(focusedTimeEditBelongsToDateEdit) {
14930    focusedEditor.OwnerDateEdit.ForceRefocusTimeSectionTimeEdit(evtSource);
14931    return;
14932   }
14933   var elementWithNativeFocus = ASPx.GetActiveElement();
14934   var someEditorInputIsFocused = elementBelongsToEditor(elementWithNativeFocus);
14935   var touchKeyboardIsVisible = someEditorInputIsFocused;
14936   var tapOutsideEditorAndInputs = !elementBelongsToEditor(evtSource) && !ASPx.Ident.IsFocusableElementRegardlessTabIndex(evtSource);
14937   var blurToHideTouchKeyboard = touchKeyboardIsVisible && tapOutsideEditorAndInputs;
14938   if(blurToHideTouchKeyboard) {
14939    elementWithNativeFocus.blur();
14940    return;
14941   }
14942   var tapOutsideFocusedEditor = focusedEditor && !elementBelongsToFocusedEditor(evtSource);
14943   if(tapOutsideFocusedEditor) {
14944    var focusedEditorWithBluredInput = !elementBelongsToFocusedEditor(elementWithNativeFocus);
14945    if(focusedEditorWithBluredInput) 
14946     this.lostAppliedFocusOfEditor();
14947   }
14948  },
14949  smartFocusEditor: function(edit) {
14950   if(!edit.focused) {
14951    this.setInputNativeFocusLocked(true);
14952    this.setFocusEditorCore(edit);
14953   } else {
14954    edit.ForceRefocusEditor();
14955   }
14956  },
14957  setFocusEditorCore: function(edit) {
14958   if(ASPx.Browser.MacOSMobilePlatform) {
14959    var timeoutDuration = ASPx.Browser.Chrome ? 250 : 30;
14960    window.setTimeout(function(){ edit.SetFocus(); }, timeoutDuration);
14961   } else {
14962    edit.SetFocus();
14963   }
14964  },
14965  onCallingVirtualKeyboard: function(edit, isSpecial) {
14966   this.setAppliedFocusOfEditor(edit, isSpecial);
14967   if(edit.specialKeyboardHandlingUsed == isSpecial && inputNativeFocusLocked)
14968    edit.BlurInputElement();
14969  },
14970  isInputNativeBluring: function() {
14971   return focusedEditor && inputNativeFocusLocked;
14972  },
14973  setInputNativeFocusLocked: function(locked) {
14974   inputNativeFocusLocked = locked;
14975  },
14976  getInputNativeFocusLocked: function() {
14977   return inputNativeFocusLocked;
14978  },
14979  setAppliedFocusOfEditor: function(edit, isSpecial) {
14980   if(focusedEditor === edit) {
14981    if(edit.specialKeyboardHandlingUsed == isSpecial) {
14982     focusedEditor.UnlockFocusEvents();
14983     if(focusedEditor.EnsureClearButtonVisibility)
14984      focusedEditor.EnsureClearButtonVisibility();
14985    }
14986    return;
14987   }
14988   if(edit.specialKeyboardHandlingUsed == isSpecial) {
14989    this.lostAppliedFocusOfEditor();
14990    focusedEditor = edit;
14991    ASPx.SetFocusedEditor(edit);
14992   }
14993   if(isSpecial)
14994    edit.OnSpecialFocus();
14995   else
14996    edit.OnFocus();
14997  },
14998  lostAppliedFocusOfEditor: function() {
14999   if(!focusedEditor) return;
15000   var curEditorName = focusedEditor.name; 
15001   var skbdHandlingUsed = focusedEditor.specialKeyboardHandlingUsed;
15002   var focusedEditorInputElementExists = focusedEditor.GetInputElement();
15003   focusedEditor = null;
15004   if(!focusedEditorInputElementExists)
15005    return;
15006   ASPx.ELostFocusCore(curEditorName);
15007   if(skbdHandlingUsed)
15008    ASPx.ESLostFocusCore(curEditorName);
15009  },
15010  getFocusedEditor: function() {
15011   return focusedEditor;
15012  },
15013  resetFocusedEditor: function() {
15014   focusedEditor = null;
15015  },
15016  focusableInputElementIsActive: function(edit) {
15017   var inputElement = edit.GetFocusableInputElement();
15018   return !!inputElement ? ASPx.GetActiveElement() === inputElement : false;
15019  },
15020  isGooglePlaceAutocompleteElementTap: function(evt) {
15021   var googlePlaceAutocompleteContainer = ASPx.GetNodeByClassName(document.body, "pac-container", 0);
15022   if(!googlePlaceAutocompleteContainer)
15023    return false;
15024   return ASPx.GetParentByClassName(ASPx.Evt.GetEventSource(evt), "pac-container") != null;
15025  }
15026 };
15027})();
15028if(ASPx.Browser.VirtualKeyboardSupported) {
15029 var touchEventName = ASPx.TouchUIHelper.pointerEnabled ? ASPx.TouchUIHelper.pointerDownEventName : 'touchstart';
15030 ASPx.Evt.AttachEventToDocument(touchEventName, function(evt){ ASPx.VirtualKeyboardUI.onTouchStart(evt); });
15031}
15032ASPx.Evt.AttachEventToDocument("mousedown", function(evt) {
15033 var editor = ASPx.GetFocusedEditor();
15034 if(!editor) 
15035  return;
15036 var evtSource = ASPx.Evt.GetEventSource(evt);
15037 if(editor.IsClearButtonElement(evtSource))
15038  return;
15039 if(editor.OwnerDateEdit && editor.OwnerDateEdit.GetShowTimeSection()) {
15040  editor.OwnerDateEdit.ForceRefocusTimeSectionTimeEdit(evtSource);
15041  return;
15042 }
15043 if(editor.ownerListBox && editor.ownerListBox.IsEditorElement(evtSource) && !editor.IsEditorElement(evtSource)) {
15044  editor.ownerListBox.ForceRefocusEditor(evt);
15045  ASPx.SetFocusedEditor(editor.ownerListBox);
15046  return;
15047 }
15048 if(editor.IsEditorElement(evtSource) && !editor.IsElementBelongToInputElement(evtSource))
15049  editor.ForceRefocusEditor(evt);
15050});
15051ASPx.Evt.AttachEventToDocument(ASPx.Evt.GetMouseWheelEventName(), function(evt) {
15052 var editor = ASPx.GetFocusedEditor();
15053 if(editor != null && ASPx.IsExistsElement(editor.GetMainElement()) && editor.focused && editor.receiveGlobalMouseWheel)
15054  editor.OnMouseWheel(evt);
15055});
15056ASPx.KBSIKeyDown = function(name, evt){
15057 var control = ASPx.GetControlCollection().Get(name);
15058 if(control != null){
15059  var isProcessed = control.OnSpecialKeyDown(evt);
15060  if(isProcessed)
15061   return ASPx.Evt.PreventEventAndBubble(evt);
15062 }
15063};
15064ASPx.KBSIKeyPress = function(name, evt){
15065 var control = ASPx.GetControlCollection().Get(name);
15066 if(control != null){
15067  var isProcessed = control.OnSpecialKeyPress(evt);
15068  if(isProcessed)
15069   return ASPx.Evt.PreventEventAndBubble(evt);
15070 }
15071};
15072ASPx.KBSIKeyUp = function(name, evt){
15073 var control = ASPx.GetControlCollection().Get(name);
15074 if(control != null){
15075  var isProcessed = control.OnSpecialKeyUp(evt);
15076  if(isProcessed)
15077   return ASPx.Evt.PreventEventAndBubble(evt);
15078 }
15079};
15080ASPx.ClearProcessingProc = function(edit) {
15081 return edit.Clear();
15082};
15083ASPx.ValidateProcessingProc = function(edit) {
15084 edit.OnValidation(ValidationType.MassValidation);
15085 return edit.GetIsValid();
15086};
15087ASPx.EditorsValidProcessingProc = function(edit) {
15088 return edit.GetIsValid();
15089};
15090var CheckEditElementHelper = ASPx.CreateClass(ASPx.CheckableElementHelper, {
15091 AttachToMainElement: function(internalCheckBox) {
15092  ASPx.CheckableElementHelper.prototype.AttachToMainElement.call(this, internalCheckBox);
15093  this.AttachToLabelElement(this.GetLabelElement(internalCheckBox.container), internalCheckBox);
15094 },
15095 AttachToLabelElement: function(labelElement, internalCheckBox) {
15096  var _this = this;
15097  if(labelElement) {
15098   ASPx.Evt.AttachEventToElement(labelElement, "click", 
15099    function (evt) { 
15100     _this.InvokeClick(internalCheckBox, evt);
15101    }
15102   );
15103   ASPx.Evt.AttachEventToElement(labelElement, "mousedown",
15104    function (evt) {
15105     internalCheckBox.Refocus();
15106    }
15107   );
15108  }
15109 },
15110 GetLabelElement: function(container) {
15111  var labelElement = ASPx.GetNodeByTagName(container, "LABEL", 0);
15112  if(!labelElement) {
15113   var labelCell = ASPx.GetNodeByClassName(container, "dxichTextCellSys", 0);
15114   labelElement = ASPx.GetNodeByTagName(labelCell, "SPAN", 0);
15115  }
15116  return labelElement;
15117 }
15118});
15119CheckEditElementHelper.Instance = new CheckEditElementHelper();
15120var CalendarSharedParameters = ASPx.CreateClass(null, {
15121 updateCalendarCallbackCommand: "UPDATE",
15122 constructor: function() {
15123  this.minDate = null;
15124  this.maxDate = null;
15125  this.disabledDates = [];
15126  this.calendarCustomDraw = false;
15127  this.hasCustomDisabledDatesViaCallback = false;
15128  this.dateRangeMode = false;
15129  this.currentDateEdit = null;
15130  this.DaysSelectingOnMouseOver = new ASPxClientEvent();
15131  this.VisibleDaysMouseOut = new ASPxClientEvent();
15132  this.CalendarSelectionChangedInternal = new ASPxClientEvent();
15133 },
15134 Assign: function(source) {
15135  this.minDate = source.minDate ? source.minDate : null;
15136  this.maxDate = source.maxDate ? source.maxDate : null;
15137  this.calendarCustomDraw = source.calendarCustomDraw ? source.calendarCustomDraw : false;
15138  this.hasCustomDisabledDatesViaCallback = source.hasCustomDisabledDatesViaCallback ? source.hasCustomDisabledDatesViaCallback : false;
15139  this.disabledDates = source.disabledDates ? source.disabledDates : [];
15140  this.currentDateEdit = source.currentDateEdit ? source.currentDateEdit : null;
15141 },
15142 GetUpdateCallbackParameters: function() {
15143  var callbackArgs = this.GetCallbackArgs();
15144  callbackArgs = this.FormatCallbackArg(this.updateCalendarCallbackCommand, callbackArgs);
15145  return callbackArgs;
15146 },
15147 GetCallbackArgs: function() {
15148  var args = {};
15149  if(this.minDate)
15150   args.clientMinDate = ASPx.DateUtils.GetInvariantDateString(this.minDate);
15151  if(this.maxDate)
15152   args.clientMaxDate = ASPx.DateUtils.GetInvariantDateString(this.maxDate);
15153  if(args.clientMinDate || args.clientMaxDate) {
15154   var jsonArgs = JSON.stringify(args);
15155   return ASPx.Str.EncodeHtml(jsonArgs);
15156  }
15157  return null;
15158 },
15159 FormatCallbackArg: function(prefix, arg) {
15160  if(!arg) return prefix;
15161  return [prefix, '|', arg.length, ';', arg, ';'].join('');
15162 }
15163});
15164ASPx.CalendarSharedParameters = CalendarSharedParameters;
15165ASPx.ValidationType = ValidationType;
15166ASPx.ErrorFrameDisplay = ErrorFrameDisplay;
15167ASPx.EditElementSuffix = EditElementSuffix;
15168ASPx.ValidationPattern = ValidationPattern;
15169ASPx.RequiredFieldValidationPattern = RequiredFieldValidationPattern;
15170ASPx.RegularExpressionValidationPattern = RegularExpressionValidationPattern;
15171ASPx.CheckEditElementHelper = CheckEditElementHelper;
15172ASPx.IsEditorFocusable = _aspxIsEditorFocusable;
15173window.ASPxClientEditBase = ASPxClientEditBase;
15174window.ASPxClientEdit = ASPxClientEdit;
15175window.ASPxClientEditKeyEventArgs = ASPxClientEditKeyEventArgs;
15176window.ASPxClientEditValidationEventArgs = ASPxClientEditValidationEventArgs;
15177})();
15178
15179(function() {
15180ASPx.TEInputSuffix = "_I";
15181ASPx.PasteCheckInterval = 50;
15182ASPx.CheckUserInputInterval = 10;
15183ASPx.TEHelpTextElementSuffix = "_HTE";
15184var passwordInputClonedSuffix = "_CLND";
15185var BrowserHelper = {
15186 SAFARI_SYSTEM_CLASS_NAME: "dxeSafariSys",
15187 MOBILE_SAFARI_SYSTEM_CLASS_NAME: "dxeIPadSys",
15188 GetBrowserSpecificSystemClassName: function() {
15189  if(ASPx.Browser.Safari)
15190   return ASPx.Browser.MacOSMobilePlatform ? this.MOBILE_SAFARI_SYSTEM_CLASS_NAME : this.SAFARI_SYSTEM_CLASS_NAME;
15191  return "";
15192 }
15193};
15194var focusedNullTextClassName = "dxeFNTextSys";
15195var NullTextDisplayMode = {
15196 Unfocused: "Unfocused",
15197 UnfocusedAndFocused: "UnfocusedAndFocused"
15198};
15199ASPx.NullTextDisplayMode = NullTextDisplayMode;
15200var ASPxClientTextEdit = ASPx.CreateClass(ASPxClientEdit, {
15201 constructor: function(name) {
15202  this.constructor.prototype.constructor.call(this, name);      
15203  this.isASPxClientTextEdit = true;
15204  this.nullText = "";
15205  this.nullTextDisplayMode = NullTextDisplayMode.Unfocused;
15206  this.nullTextOnFocusCssText = "";
15207  this.focusedNullTextTimerID = -1;
15208  this.escCount = 0;
15209  this.raiseValueChangedOnEnter = true;
15210  this.autoResizeWithContainer = false;
15211  this.lastChangedValue = null;
15212  this.autoCompleteAttribute = null;
15213  this.isTextSelectionOnClickEnabled = false;
15214  this.passwordNullTextIntervalID = -1;
15215  this.nullTextInputElement = null;
15216  this.helpText = "";
15217  this.helpTextObj = null;  
15218  this.helpTextStyle = [];
15219  this.externalTableStyle = [];
15220  this.helpTextPosition = ASPx.Position.Right;
15221  this.helpTextMargins = null;
15222  this.helpTextHAlign = ASPxClientTextEditHelpTextHAlign.Left;
15223  this.helpTextVAlign = ASPxClientTextEditHelpTextVAlign.Top;
15224  this.enableHelpTextPopupAnimation = true;
15225  this.helpTextDisplayMode = ASPxClientTextEditHelpTextDisplayMode.Inline;
15226  this.maskInfo = null;  
15227  this.maskValueBeforeUserInput = "";
15228  this.maskPasteTimerID = -1;
15229  this.maskPasteLock = false;    
15230  this.maskPasteCounter = 0;
15231  this.maskTextBeforePaste = "";    
15232  this.maskHintHtml = "";
15233  this.maskHintTimerID = -1;
15234  this.errorCellPosition = ASPx.Position.Right;
15235  this.inlineInitializeInputValue = null;
15236  this.initializeInputValue = null;
15237  this.displayFormat = null;
15238  this.TextChanged = new ASPxClientEvent();
15239  this.UserInput = new ASPxClientEvent();
15240  this.userInputEventTimerID = -1;
15241 },
15242 AddDefaultReadOnlyStateControllerItem: function(cssClass, mainElementId) {
15243  ASPx.AddReadOnlyItems(mainElementId, [[[cssClass], [''], ['', 'I']]]);
15244 },
15245 AddDefaultDisabledStateControllerItem: function(cssClass, mainElementId) {
15246  ASPx.AddDisabledItems(mainElementId, [[[cssClass], [''], ['', 'I']]]);
15247 },
15248 SetData: function(data){
15249  ASPxClientEdit.prototype.SetData.call(this, data);
15250  if(data.maskInfo) {
15251   var maskProperties = data.maskInfo.properties;
15252   var useInvariantCultureDecimalSymbol = maskProperties && maskProperties.useInvariantCultureDecimalSymbol || false;
15253   this.maskInfo = ASPx.MaskInfo.Create(data.maskInfo.maskText, data.maskInfo.dateTimeOnly, data.maskInfo.allowEscapingInEnums, useInvariantCultureDecimalSymbol);
15254   this.SetProperties(data.maskInfo.properties, this.maskInfo);
15255  }
15256 },
15257 InlineInitialize: function() {
15258  this.SaveInputValue(true);
15259  ASPxClientEdit.prototype.InlineInitialize.call(this);
15260  if(this.maskInfo != null)
15261   this.InitMask();
15262  this.ApplyBrowserSpecificClassName();
15263  this.helpTextInitialize();
15264  if(ASPx.Browser.IE && ASPx.Browser.Version >= 10 && this.nullText != "")
15265   this.addIEXButtonEventHandler();
15266 },
15267 Initialize: function(){
15268  this.SaveInputValue(false);
15269  this.SaveChangedValue();
15270  ASPxClientEdit.prototype.Initialize.call(this);
15271  this.CorrectInputMaxLength();
15272  this.SubscribeToIeDropEvent();
15273  if(ASPx.Browser.WebKitFamily)  
15274   this.CorrectMainElementWhiteSpaceStyle();
15275  this.InitializeTextDecoration();
15276  this.InitializeAutocompleteAttribute();
15277  if(this.IsValueRestoredByBrowser())
15278   this.SynchronizeRestoredValue();
15279 },
15280 InitializeEvents: function() {
15281  ASPxClientEdit.prototype.InitializeEvents.call(this);
15282  ASPx.Evt.AttachEventToElement(this.GetInputElement(), "keydown", this.OnKeyDown.aspxBind(this));
15283  ASPx.Evt.AttachEventToElement(this.GetInputElement(), "keyup", this.OnKeyUp.aspxBind(this));
15284  ASPx.Evt.AttachEventToElement(this.GetInputElement(), "keypress", this.OnKeyPress.aspxBind(this));
15285  if(this.isTextSelectionOnClickEnabled) {
15286   ASPx.Evt.AttachEventToElement(this.GetInputElement(), ASPx.TouchUIHelper.touchMouseDownEventName, this.OnMouseDown.aspxBind(this));
15287   ASPx.Evt.AttachEventToElement(this.GetInputElement(), "click", this.OnClick.aspxBind(this));
15288  }
15289  this.Unload.AddHandler(this.OnUnload.aspxBind(this));
15290 },
15291 InitializeTextDecoration: function() {
15292  if(this.GetInputElement().type == "password")
15293   this.ToggleTextDecoration();
15294 },
15295 OnMouseDown: function() {
15296  this.trySelectInputTextOnClick = ASPx.GetActiveElement() !== this.GetInputElement();
15297 },
15298 OnClick: function() {
15299  if(this.trySelectInputTextOnClick) {
15300   var input = this.GetInputElement();
15301   setTimeout(function() {
15302    var inputSelection = ASPx.Selection.GetInfo(input);
15303    if (inputSelection.startPos === inputSelection.endPos)
15304     ASPx.Selection.Set(input);
15305   }, 0);
15306  }
15307 },
15308 InitializeAutocompleteAttribute: function() {
15309  var input = this.GetInputElement();
15310  if(this.IsVCardAttributeRequired())
15311   ASPx.Attr.SetAttribute(input, this.autoCompleteAttribute.name, this.autoCompleteAttribute.value);
15312  else if(this.IsAutocompleteOffRequiredOnInitialize())
15313   ASPx.Attr.SetAttribute(input, "autocomplete", "off");
15314 },
15315 SaveInputValue: function(isInlineInitialize) {
15316  var input = this.GetInputElement();
15317  if(!input)
15318   return;
15319  var inputValue = input.value;
15320  if(inputValue === null)
15321   inputValue = "";
15322  if(isInlineInitialize)
15323   this.inlineInitializeInputValue = inputValue;
15324  else
15325   this.initializeInputValue = inputValue;
15326 },
15327 IsValueRestoredByBrowser: function() {
15328  if(this.displayFormat || this.isNative || this.inlineInitializeInputValue === null || this.initializeInputValue === null)
15329   return false;
15330  return this.IsValueChangedBeforeInitialize() || this.IsClientValueNotExists() || this.IsValueChangedOnMaskInitialize();
15331 },
15332 IsValueChangedBeforeInitialize: function() {
15333  return this.inlineInitializeInputValue !== this.initializeInputValue;
15334 },
15335 IsClientValueNotExists: function() {
15336  return this.inlineInitializeInputValue !== "" &&
15337      this.inlineInitializeInputValue !== this.nullText &&
15338      this.inlineInitializeInputValue !== this.GetValue() &&
15339      this.inlineInitializeInputValue !== this.GetText();
15340 },
15341 IsValueChangedOnMaskInitialize: function() {
15342  return this.maskInfo && this.inlineInitializeInputValue !== this.GetInputElement().value;
15343 },
15344 SynchronizeRestoredValue: function() {
15345  this.SetText(this.initializeInputValue);
15346 },
15347 AdjustControl: function() {
15348  ASPxClientEdit.prototype.AdjustControl.call(this);
15349  if(ASPx.Browser.IE && ASPx.Browser.Version > 8 && !this.isNative)
15350   this.correctInputElementHeight();
15351  this.ensureAdjustFocusedNullTextElement();
15352 },
15353 correctInputElementHeight: function() {
15354  var mainElement = this.GetMainElement();
15355  if(mainElement) {
15356   var mainElementHeight = mainElement.style.height;
15357   var mainElementHeightSpecified = mainElementHeight && mainElementHeight.indexOf('px') !== -1; 
15358   if(mainElementHeightSpecified) {
15359    var inputElement = this.GetInputElement();
15360    var inputElementHeight = this.getInputElementHeight();
15361    inputElement.style.height = inputElementHeight + "px";
15362    if(!ASPx.Ident.IsASPxClientMemo(this))
15363     inputElement.style.lineHeight = inputElementHeight + "px";
15364   }
15365  }
15366 },
15367 getInputElementHeight: function() {
15368  var mainElement = this.GetMainElement(),
15369   inputElement = this.GetInputElement();
15370  var inputElementHeight = ASPx.PxToInt(mainElement.style.height) - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(mainElement);
15371  var inputElementContainer = inputElement.parentNode,
15372   inputContainerStyle = ASPx.GetCurrentStyle(inputElementContainer);
15373  inputElementHeight -= ASPx.GetTopBottomBordersAndPaddingsSummaryValue(inputElementContainer, inputContainerStyle) 
15374   + ASPx.GetTopBottomMargins(inputElementContainer, inputContainerStyle);
15375  var mainElementCellspacing = ASPx.GetCellSpacing(mainElement);
15376  if(mainElementCellspacing)
15377   inputElementHeight -= mainElementCellspacing * 2;
15378  var inputStyle = ASPx.GetCurrentStyle(inputElement);
15379  inputElementHeight -= ASPx.GetTopBottomBordersAndPaddingsSummaryValue(inputElement, inputStyle) 
15380   + ASPx.GetTopBottomMargins(inputElement, inputStyle);
15381  return inputElementHeight;
15382 },
15383 addIEXButtonEventHandler: function() {
15384  var inputElement = this.GetInputElement();
15385  if(ASPx.IsExists(inputElement)) {
15386   this.isDeleteOrBackspaceKeyClick = false;
15387   ASPx.Evt.AttachEventToElement(inputElement, "input", function (evt) {
15388    if(this.isDeleteOrBackspaceKeyClick) {
15389     this.isDeleteOrBackspaceKeyClick = false;
15390     return;
15391    }
15392    if(inputElement.value === '') {
15393     this.SyncRawValue();
15394    }
15395   }.aspxBind(this));
15396   ASPx.Evt.AttachEventToElement(inputElement, "keydown", function (evt) {
15397    this.isDeleteOrBackspaceKeyClick = (evt.keyCode == ASPx.Key.Delete || evt.keyCode == ASPx.Key.Backspace);
15398   }.aspxBind(this));
15399  }   
15400 },
15401 ensureOutOfRangeWarningManager: function (minValue, maxValue, defaultMinValue, defaultMaxValue, valueFormatter) {
15402  if (!this.outOfRangeWarningManager)
15403   this.outOfRangeWarningManager = new ASPxOutOfRangeWarningManager(this, minValue, maxValue, defaultMinValue, defaultMaxValue,
15404    this.showOutOfRangeWarningElementAtBottom() ? ASPx.Position.Bottom : ASPx.Position.Right, valueFormatter);
15405 },
15406 showOutOfRangeWarningElementAtBottom: function() {
15407  return this.hasRightPopupHelpText();
15408 },
15409 GetOutOfRangeWarningElementPrevSibling: function() {
15410  return this.GetMainElement();
15411 },
15412 helpTextInitialize: function () {
15413  if(this.helpText) {
15414   this.helpTextObj = new ASPxClientTextEditHelpText(this, this.helpTextStyle, this.helpText, this.helpTextPosition,
15415    this.helpTextHAlign, this.helpTextVAlign, this.helpTextMargins, this.enableHelpTextPopupAnimation, this.helpTextDisplayMode);
15416  }
15417 },
15418 hasPopupHelpText: function() {
15419  return this.helpText && this.helpTextDisplayMode === ASPxClientTextEditHelpTextDisplayMode.Popup;
15420 },
15421 hasRightPopupHelpText: function() {
15422  return this.hasPopupHelpText() && this.helpTextPosition === ASPx.Position.Right;
15423 },
15424 showHelpText: function () {
15425  if(this.helpTextObj)
15426   this.helpTextObj.show();
15427 },
15428 hideHelpText: function () {
15429  if(this.helpTextObj)
15430   this.helpTextObj.hide();
15431 },
15432 ApplyBrowserSpecificClassName: function() {
15433  var mainElement = this.GetMainElement();
15434  if(ASPx.IsExistsElement(mainElement)) {
15435   var className = BrowserHelper.GetBrowserSpecificSystemClassName();
15436   if(className)
15437    mainElement.className += " " + className;
15438  }
15439 },
15440  CorrectMainElementWhiteSpaceStyle: function() {
15441  var inputElement = this.GetInputElement();
15442  if(inputElement && inputElement.parentNode) {
15443   if(this.IsElementHasWhiteSpaceStyle(inputElement.parentNode))
15444    inputElement.parentNode.style.whiteSpace = "normal";
15445  }
15446 },
15447 IsElementHasWhiteSpaceStyle: function(element) {
15448  var currentStyle = ASPx.GetCurrentStyle(element);
15449  return currentStyle.whiteSpace == "nowrap" || currentStyle.whiteSpace == "pre";  
15450 },
15451 FindInputElement: function(){
15452  return this.isNative ? this.GetMainElement() : ASPx.GetElementById(this.name + ASPx.TEInputSuffix);
15453 },
15454 DecodeRawInputValue: function(value) {
15455  return value;
15456 },
15457 GetRawValue: function(value){
15458  return ASPx.IsExists(this.stateObject) ? this.stateObject.rawValue : null;
15459 },
15460 SetRawValue: function(value){
15461  if(ASPx.IsExists(value))
15462   value = value.toString();
15463  this.UpdateStateObjectWithObject({ rawValue: value });
15464 },
15465 SyncRawValue: function() {
15466  if(this.maskInfo != null)
15467   this.SetRawValue(this.maskInfo.GetValue(true));
15468  else
15469   this.SetRawValue(this.GetInputElement().value);
15470 },
15471 HasTextDecorators: function() {
15472  return this.nullText != "" || this.displayFormat != null;
15473 },
15474 CanApplyTextDecorators: function(){
15475  return !this.focused;
15476 },
15477 CreateStyleDecoration: function () {
15478  return new ASPx.TextEditorStyleDecoration(this);
15479 },
15480 CanApplyNullTextDecoration: function() {
15481  var value = this.GetValue();
15482  return this.IsNull(value);
15483 },
15484 GetDecoratedText: function(value) {
15485  var result = value;
15486  if(this.IsNull(value) && this.nullText != "" && this.CanApplyNullTextDecoration())
15487   result = this.nullText;
15488  else if(this.displayFormat != null)
15489   result = this.GetDisplayFormatText(value);
15490  else if(this.maskInfo != null)
15491   result = this.maskInfo.GetText();
15492  else if(value == null)
15493   result = "";
15494  return result;
15495 },
15496 GetDisplayFormatText: function(value) {
15497  return ASPx.Formatter.Format(this.displayFormat, value);
15498 },
15499 ToggleTextDecoration: function() {
15500  if(this.HasTextDecorators()) {
15501   if(this.focused) {
15502    var input = this.GetInputElement();
15503    var oldValue = input.value;
15504    var sel = ASPx.Selection.GetExtInfo(input);
15505    this.ToggleTextDecorationCore();
15506    this.ensureActivateFocusedNullTextMechanism();
15507    if(oldValue != input.value || !ASPx.Selection.AreEqual(sel, ASPx.Selection.GetExtInfo(input))) {
15508     if(sel.startPos == 0 && sel.endPos == oldValue.length)
15509      sel.endPos = input.value.length;
15510     else
15511      sel.endPos = sel.startPos;
15512     if(!this.accessibilityCompliant || ASPx.GetActiveElement() == input)
15513      this.SetSelectionOnToggleTextDecoration(input, sel);
15514    }
15515   } else {
15516    this.ToggleTextDecorationCore();
15517    this.ensureDeactivateFocusedNullTextMechanism();
15518   }
15519  }
15520 },
15521 SetSelectionOnToggleTextDecoration: function(input, sel) {
15522  ASPx.Selection.Set(input, sel.startPos, sel.endPos);
15523 },
15524 ToggleTextDecorationCore: function() {
15525  if(this.maskInfo != null) {   
15526   this.ApplyMaskInfo(false);
15527  } else {
15528   var input = this.GetInputElement();
15529   var rawValue = this.GetRawValue();
15530   var value = this.CanApplyTextDecorators() ? this.GetDecoratedText(rawValue) : rawValue;
15531   if(input.value != value) {
15532    if(input.type == "password")
15533     this.TogglePasswordInputTextDecoration(value);
15534    else
15535     input.value = value;
15536   }
15537  }
15538 },
15539 GetPasswordNullTextInputElement: function() {
15540  if(!this.isPasswordNullTextInputElementExists())
15541   this.nullTextInputElement = this.createPasswordNullTextInputElement();
15542  return this.nullTextInputElement;
15543 },
15544 createPasswordNullTextInputElement: function() {
15545  var inputElement = this.GetInputElement(),
15546   nullTextInputElement = document.createElement("INPUT");
15547  nullTextInputElement.className = inputElement.className;
15548  nullTextInputElement.style.cssText = inputElement.style.cssText;
15549  nullTextInputElement.id = inputElement.id + passwordInputClonedSuffix;
15550  nullTextInputElement.type = "text";
15551  if(ASPx.IsExists(inputElement.tabIndex))
15552   nullTextInputElement.tabIndex = inputElement.tabIndex;
15553  var onFocusEventHandler = function() {
15554   var inputElement = this.GetInputElement(),
15555    nullTextInputElement = this.GetPasswordNullTextInputElement();
15556   if(inputElement) {
15557    this.LockFocusEvents();  
15558    ASPx.SetElementDisplay(inputElement, true);
15559    inputElement.focus();
15560    ASPx.SetElementDisplay(nullTextInputElement, false);
15561    this.ensureAdjustFocusedNullTextElement();
15562    this.ReplaceAssociatedIdInLabels(nullTextInputElement.id, inputElement.id);
15563   }
15564  }.aspxBind(this);
15565  ASPx.Evt.AttachEventToElement(nullTextInputElement, "focus", onFocusEventHandler);
15566  return nullTextInputElement;
15567 },
15568 isPasswordNullTextInputElementExists: function() {
15569  return ASPx.IsExistsElement(this.nullTextInputElement);
15570 },
15571 TogglePasswordNullTextTimeoutChecker: function() {
15572  if(this.passwordNullTextIntervalID < 0) {
15573   var timeoutChecker = function() {
15574    var inputElement = this.GetInputElement();
15575    if(ASPx.GetControlCollection().GetByName(this.name) !== this || inputElement == null) {
15576     window.clearTimeout(this.passwordNullTextIntervalID);
15577     this.passwordNullTextIntervalID = -1;
15578     return;
15579    } else {
15580     if(!this.focused) {
15581      var passwordNullTextInputElement = this.GetPasswordNullTextInputElement();
15582      if(passwordNullTextInputElement.value != this.nullText && inputElement.value == "") { 
15583       passwordNullTextInputElement.value = this.nullText;
15584       this.SetValue(null);
15585      }
15586      if(inputElement.value != "") {
15587       if(inputElement.style.display == "none") {
15588        this.SetValue(inputElement.value);
15589        this.UnhidePasswordInput();
15590       }
15591      } else {
15592       if(inputElement.style.display != "none") {
15593        this.SetValue(null);
15594        this.HidePasswordInput();
15595       }
15596      }
15597     }
15598    }
15599   }.aspxBind(this);
15600   timeoutChecker(); 
15601   this.passwordNullTextIntervalID = window.setInterval(timeoutChecker, 100);
15602  }
15603 },
15604 TogglePasswordInputTextDecoration: function(value) {
15605  var inputElement = this.GetInputElement();
15606  var nullTextInputElement = this.GetPasswordNullTextInputElement();
15607  nullTextInputElement.value = value;
15608  var parentNode = inputElement.parentNode;
15609  if(ASPx.Data.ArrayIndexOf(parentNode.childNodes, nullTextInputElement) < 0) {
15610   ASPx.Attr.ChangeStyleAttribute(nullTextInputElement, "display", "none");
15611   parentNode.appendChild(nullTextInputElement);
15612  }
15613  this.HidePasswordInput();
15614  this.TogglePasswordNullTextTimeoutChecker();
15615 },
15616 HidePasswordInput: function() {
15617  ASPx.Attr.ChangeStyleAttribute(this.GetInputElement(), "display", "none");
15618  ASPx.Attr.ChangeStyleAttribute(this.GetPasswordNullTextInputElement(), "display", "");
15619  this.ReplaceAssociatedIdInLabels(this.GetInputElement().id, this.GetPasswordNullTextInputElement().id);
15620 },
15621 UnhidePasswordInput: function() {
15622  ASPx.Attr.ChangeStyleAttribute(this.GetInputElement(), "display", "");
15623  ASPx.Attr.ChangeStyleAttribute(this.GetPasswordNullTextInputElement(), "display", "none");
15624  this.ReplaceAssociatedIdInLabels(this.GetPasswordNullTextInputElement().id, this.GetInputElement().id);
15625 },
15626 ReplaceAssociatedIdInLabels: function(oldId, newId) {
15627  var labels = document.getElementsByTagName("LABEL");
15628  for(var i = 0; i < labels.length; i++) {
15629   if(labels[i].attributes["for"] && labels[i].attributes["for"].value == oldId)
15630    labels[i].attributes["for"].value = newId;
15631  }
15632 },
15633 GetFormattedText: function() {
15634  var value = this.GetValue();
15635  if(this.IsNull(value) && this.nullText != "")
15636   return this.GetText();
15637  return this.GetDecoratedText(value);
15638 },
15639 IsNull: function(value) {
15640  return value == null || value === "";
15641 },
15642 PopulateStyleDecorationPostfixes: function() {
15643  ASPxClientEdit.prototype.PopulateStyleDecorationPostfixes.call(this);
15644  this.styleDecoration.AddPostfix(ASPx.TEInputSuffix);
15645 },
15646 GetValue: function() {
15647  var value = null;
15648  if(this.maskInfo != null)
15649   value = this.maskInfo.GetValue();
15650  else if(this.HasTextDecorators())
15651   value = this.GetRawValue();
15652  else {
15653   var input = this.GetInputElement();
15654   value = input ? input.value : null;
15655  }
15656  return (value == "" && this.convertEmptyStringToNull) ? null : value;
15657 },
15658 SetValue: function(value) {
15659  if(value == null || value === undefined) 
15660   value = "";
15661  if(this.maskInfo != null) {
15662   this.maskInfo.SetValue(value.toString());
15663   this.ApplyMaskInfo(false);
15664   this.SavePrevMaskValue();
15665  } 
15666  else if(this.HasTextDecorators()) {
15667   this.SetRawValue(value);
15668   this.GetInputElement().value = this.CanApplyTextDecorators() && this.GetInputElement().type != "password" ? this.GetDecoratedText(value) : value;
15669  }
15670  else
15671   this.GetInputElement().value = value;
15672  this.UpdateStyleDecorations(); 
15673  this.SaveChangedValue();   
15674 },
15675 SetVisible: function(visible) {
15676  ASPxClientEdit.prototype.SetVisible.call(this, visible);
15677  if(this.helpTextDisplayMode === ASPxClientTextEditHelpTextDisplayMode.Inline) {
15678   if(visible)
15679    this.showHelpText();
15680   else
15681    this.hideHelpText();
15682  }
15683 },
15684 UnstretchInputElement: function(){
15685  var inputElement = this.GetInputElement();
15686  var mainElement = this.GetMainElement();
15687  var mainElementCurStyle = ASPx.GetCurrentStyle(mainElement);
15688  if(ASPx.IsExistsElement(mainElement) && ASPx.IsExistsElement(inputElement) && ASPx.IsExists(mainElementCurStyle) && 
15689   inputElement.style.width == "100%" &&
15690   (mainElementCurStyle.width == "" || mainElementCurStyle.width == "auto"))
15691   inputElement.style.width = "";
15692 },
15693 RestoreActiveElement: function(activeElement) {
15694  if(activeElement && activeElement.setActive && activeElement.tagName != "IFRAME")
15695   activeElement.setActive();
15696 },
15697 RaiseValueChangedEvent: function() {
15698  var processOnServer = ASPxClientEdit.prototype.RaiseValueChangedEvent.call(this);
15699  processOnServer = this.RaiseTextChanged(processOnServer);
15700  return processOnServer;
15701 },
15702 InitMask: function() {
15703  var rawValue = this.GetRawValue();
15704  this.SetValue(rawValue.length ? this.DecodeRawInputValue(rawValue) : this.maskInfo.GetValue());
15705  this.validationPatterns.unshift(new MaskValidationPattern(this.maskInfo.errorText, this.maskInfo));
15706 },
15707 SetMaskPasteTimer: function() {
15708  this.ClearMaskPasteTimer();
15709  this.maskPasteTimerID = ASPx.Timer.SetControlBoundInterval(this.MaskPasteTimerProc, this, ASPx.PasteCheckInterval);
15710 },
15711 ClearMaskPasteTimer: function() {
15712  this.maskPasteTimerID = ASPx.Timer.ClearInterval(this.maskPasteTimerID);
15713 },
15714 SavePrevMaskValue: function() {
15715  this.maskValueBeforeUserInput = this.maskInfo.GetValue();
15716 },
15717 FillMaskInfo: function() {
15718  var input = this.GetInputElement();
15719  if(!input) return; 
15720  var sel = ASPx.Selection.GetInfo(input);
15721  this.maskInfo.SetCaret(sel.startPos, sel.endPos - sel.startPos);  
15722 },
15723 ApplyMaskInfo: function(applyCaret) {
15724  this.SyncRawValue();
15725  var input = this.GetInputElement();
15726  var text = this.GetMaskDisplayText();
15727  this.maskTextBeforePaste = text;
15728  if(input.value != text)
15729   input.value = text;
15730  if(applyCaret)
15731   ASPx.Selection.Set(input, this.maskInfo.caretPos, this.maskInfo.caretPos + this.maskInfo.selectionLength);
15732 },
15733 GetMaskDisplayText: function() {
15734  if(!this.focused && this.HasTextDecorators())
15735   return this.GetDecoratedText(this.maskInfo.GetValue());
15736  return this.maskInfo.GetText();
15737 },
15738 ShouldCancelMaskKeyProcessing: function(htmlEvent, keyDownInfo) {
15739  return ASPx.Evt.IsEventPrevented(htmlEvent);
15740 }, 
15741 HandleMaskKeyDown: function(evt) {
15742  var keyInfo = ASPx.MaskManager.CreateKeyInfoByEvent(evt);
15743  ASPx.MaskManager.keyCancelled = this.ShouldCancelMaskKeyProcessing(evt, keyInfo);
15744  if(ASPx.MaskManager.keyCancelled) {
15745   ASPx.Evt.PreventEvent(evt);
15746   return;
15747  }
15748  this.maskPasteLock = true;
15749  this.FillMaskInfo();  
15750  var canHandle = ASPx.MaskManager.CanHandleControlKey(keyInfo);   
15751  ASPx.MaskManager.savedKeyDownKeyInfo = keyInfo;
15752  if(canHandle) {   
15753   ASPx.MaskManager.OnKeyDown(this.maskInfo, keyInfo);
15754   this.ApplyMaskInfo(true);
15755   ASPx.Evt.PreventEvent(evt);
15756  }
15757  ASPx.MaskManager.keyDownHandled = canHandle;
15758  this.maskPasteLock = false;
15759  this.UpdateMaskHintHtml();
15760 },
15761 HandleMaskKeyPress: function(evt) {
15762  var keyInfo = ASPx.MaskManager.CreateKeyInfoByEvent(evt);
15763  ASPx.MaskManager.keyCancelled = ASPx.MaskManager.keyCancelled || this.ShouldCancelMaskKeyProcessing(evt, ASPx.MaskManager.savedKeyDownKeyInfo);
15764  if(ASPx.MaskManager.keyCancelled) {
15765   ASPx.Evt.PreventEvent(evt);
15766   return;
15767  }
15768  this.maskPasteLock = true;  
15769  var printable = ASPx.MaskManager.savedKeyDownKeyInfo != null && ASPx.MaskManager.IsPrintableKeyCode(ASPx.MaskManager.savedKeyDownKeyInfo);
15770  if(printable) {
15771   ASPx.MaskManager.OnKeyPress(this.maskInfo, keyInfo);
15772   this.ApplyMaskInfo(true);
15773  }
15774  if(printable || ASPx.MaskManager.keyDownHandled)   
15775   ASPx.Evt.PreventEvent(evt); 
15776  this.maskPasteLock = false;
15777  this.UpdateMaskHintHtml();
15778 },
15779 MaskPasteTimerProc: function() {
15780  if(this.maskPasteLock || !this.maskInfo) return;
15781  this.maskPasteCounter++;
15782  var inputElement = this.inputElement;
15783  if(!inputElement || this.maskPasteCounter > 40) {
15784   this.maskPasteCounter = 0;
15785   inputElement = this.GetInputElement();
15786   if(!ASPx.IsExistsElement(inputElement)) {
15787    this.ClearMaskPasteTimer();
15788    return;
15789   }
15790  }
15791  if(this.maskTextBeforePaste !== inputElement.value)
15792   this.ProcessInputValueChangedOnTimer();
15793  if(!this.focused)
15794   this.ClearMaskPasteTimer();
15795 },
15796 ProcessInputValueChangedOnTimer: function() {
15797  var inputElement = this.inputElement;
15798  var selectionInfo = ASPx.Selection.GetInfo(inputElement);
15799  var startCaretPosition = selectionInfo.startPos;
15800  var endCaretPosition = selectionInfo.endPos;
15801  var oldText = this.maskTextBeforePaste;
15802  var newText = inputElement.value;
15803  var isAndroidBackSpacePressed = this.isAndroidBackSpacePressed(oldText, newText, startCaretPosition, endCaretPosition);
15804  var isLastTypedCharacter = newText.indexOf(oldText) == 0 && newText.length > oldText.length;
15805  if(isAndroidBackSpacePressed || isLastTypedCharacter) {
15806   this.SetText(newText);
15807   this.SetCaretPosition(endCaretPosition);
15808  } else {
15809   this.maskInfo.ProcessPaste(newText, endCaretPosition);
15810   this.ApplyMaskInfo(true);
15811  }
15812 },
15813 isAndroidBackSpacePressed: function(oldText, newText, startCaretPosition, endCaretPosition) {
15814  if(!ASPx.Browser.AndroidMobilePlatform || startCaretPosition !== endCaretPosition || newText.length >= oldText.length)
15815   return false;
15816  var startSubstring = newText.substring(0, startCaretPosition);
15817  var endSubstring = newText.substring(startCaretPosition);
15818  var isStartSubstringMatches = oldText.indexOf(startSubstring) == 0;
15819  var isEndSubstringMatches = endSubstring == "" || oldText.lastIndexOf(endSubstring) == oldText.length - endSubstring.length;
15820  return isStartSubstringMatches && isEndSubstringMatches;
15821 },
15822 BeginShowMaskHint: function() {
15823  if(!this.GetReadOnly() && this.maskHintTimerID == -1)
15824   this.maskHintTimerID = window.setInterval(ASPx.MaskHintTimerProc, 500);
15825 },
15826 EndShowMaskHint: function() {
15827  window.clearInterval(this.maskHintTimerID);
15828  this.maskHintTimerID = -1;
15829 },
15830 MaskHintTimerProc: function() {  
15831  if(this.maskInfo) {
15832   this.FillMaskInfo();
15833   this.UpdateMaskHintHtml();
15834  } else {
15835   this.EndShowMaskHint();
15836  }
15837 },
15838 UpdateMaskHintHtml: function() {  
15839  var hint =  this.GetMaskHintElement();
15840  if(!ASPx.IsExistsElement(hint))
15841   return;
15842  var html = ASPx.MaskManager.GetHintHtml(this.maskInfo);
15843  if(html == this.maskHintHtml)
15844   return;
15845  if(html != "") {
15846   var mainElement = this.GetMainElement();
15847   if(ASPx.IsExistsElement(mainElement)) {
15848    hint.innerHTML = html;
15849    hint.style.position = "absolute";  
15850    hint.style.left = ASPx.PrepareClientPosForElement(ASPx.GetAbsoluteX(mainElement), mainElement, true) + "px";
15851    hint.style.top = (ASPx.PrepareClientPosForElement(ASPx.GetAbsoluteY(mainElement), mainElement, false) + mainElement.offsetHeight + 2) + "px";
15852    hint.style.display = "block";    
15853   }   
15854  } else {
15855   hint.style.display = "none";
15856  }
15857  this.maskHintHtml = html;
15858 },
15859 HideMaskHint: function() {
15860  var hint =  this.GetMaskHintElement();
15861  if(ASPx.IsExistsElement(hint))
15862   hint.style.display = "none";
15863  this.maskHintHtml = "";
15864 },
15865 GetMaskHintElement: function() {
15866  return ASPx.GetElementById(this.name + "_MaskHint");
15867 },
15868 OnFocus: function() {
15869  if (this.maskInfo != null && !ASPx.GetControlCollection().InCallback()) {
15870   this.TrySetCursorToStartPosition();
15871   this.SetMaskPasteTimer();
15872  }
15873  if(this.IsAutocompleteDropDownListRequiredOnFocus())
15874   ASPx.Attr.RemoveAttribute(this.GetInputElement(), "autocomplete");
15875  ASPxClientEdit.prototype.OnFocus.call(this);
15876 },
15877 OnLostFocus: function() {
15878  if(this.IsAutocompleteOffRequiredOnLostFocus())
15879   ASPx.Attr.SetAttribute(this.GetInputElement(), "autocomplete", "off");
15880  ASPxClientEdit.prototype.OnLostFocus.call(this);
15881 },
15882 OnMouseWheel: function(evt){
15883  if(this.GetReadOnly() || this.maskInfo == null) return;
15884  this.FillMaskInfo();
15885  ASPx.MaskManager.OnMouseWheel(this.maskInfo, ASPx.Evt.GetWheelDelta(evt) < 0 ? -1 : 1);
15886  this.ApplyMaskInfo(true);
15887  ASPx.Evt.PreventEvent(evt);
15888  this.UpdateMaskHintHtml();
15889 }, 
15890 OnBrowserWindowResize: function(e) {
15891  if(!this.autoResizeWithContainer)
15892   this.AdjustControl();
15893 },
15894 IsValueChanged: function() {
15895  return this.GetValue() != this.lastChangedValue; 
15896 },
15897 OnKeyDown: function(evt) {        
15898  if(this.NeedPreventBrowserUndoBehaviour(evt))
15899   return ASPx.Evt.PreventEvent(evt);
15900  if(this.RequireHandleMaxlenManually()) {
15901   this.onKeyDownInputValue = this.GetInputElement().value;
15902   var selectionInfo = ASPx.Selection.GetExtInfo(this.GetInputElement());
15903   this.onKeyDownCursorPos = selectionInfo.startPos;
15904  }
15905  if(ASPx.Browser.IE && ASPx.Evt.GetKeyCode(evt) == ASPx.Key.Esc) {   
15906   if(++this.escCount > 1) {
15907    ASPx.Evt.PreventEvent(evt);
15908    return;
15909   }
15910  } else 
15911   this.escCount = 0;
15912  ASPxClientEdit.prototype.OnKeyDown.call(this, evt);
15913  if(!this.IsRaiseStandardOnChange(evt)) {
15914   if(!this.GetReadOnly() && this.maskInfo != null)
15915    this.HandleMaskKeyDown(evt);
15916  }
15917 },
15918 IsCtrlZ: function(evt) {
15919  return evt.ctrlKey && !evt.altKey && !evt.shiftKey && (ASPx.Evt.GetKeyCode(evt) == 122 || ASPx.Evt.GetKeyCode(evt) == 90);
15920 },
15921 NeedPreventBrowserUndoBehaviour: function(evt) {
15922  var inputElement = this.GetInputElement();
15923  return this.IsCtrlZ(evt) && !!inputElement && !inputElement.value;
15924 },
15925 OnKeyPress: function(evt) {
15926  ASPxClientEdit.prototype.OnKeyPress.call(this, evt);
15927  if(!this.GetReadOnly() && this.maskInfo != null && !this.IsRaiseStandardOnChange(evt))
15928   this.HandleMaskKeyPress(evt);
15929  if(this.NeedOnKeyEventEnd(evt, true))
15930   this.OnKeyEventEnd(evt);
15931 },
15932 OnKeyUp: function(evt) {
15933  if(ASPx.Browser.Firefox && !this.focused && ASPx.Evt.GetKeyCode(evt) === ASPx.Key.Tab)
15934   return;
15935  if(this.NeedOnKeyEventEnd(evt, false)) {
15936   var proccessNextCommingPress = ASPx.Evt.GetKeyCode(evt) === ASPx.Key.Alt; 
15937   this.OnKeyEventEnd(evt, proccessNextCommingPress);
15938  }
15939  if(this.RequireHandleMaxlenManually()) {
15940   var inputValueLength = this.GetInputElement().value.length;
15941   var maxLength = this.GetInputMaxLength();
15942   if(inputValueLength > maxLength && inputValueLength > this.onKeyDownInputValue.length) {
15943    this.GetInputElement().value = this.onKeyDownInputValue;
15944    this.SetCaretPosition(this.onKeyDownCursorPos);
15945   }
15946  }
15947  ASPxClientEdit.prototype.OnKeyUp.call(this, evt);
15948 },
15949 RequireHandleMaxlenManually: function() { 
15950  return ASPx.Browser.AndroidMobilePlatform && ASPx.Browser.SamsungAndroidDevice && ASPx.Browser.PlaformMajorVersion < 6 && this.GetInputMaxLength() !== -1;
15951 },
15952 GetInputMaxLength: function() {
15953  var input = this.GetInputElement();
15954  if(ASPx.Attr.IsExistsAttribute(input, "maxlength"))
15955   return input.maxLength;
15956  return -1;
15957 },
15958 NeedOnKeyEventEnd: function(evt, isKeyPress) { 
15959  var handleKeyPress = this.maskInfo != null && evt.keyCode == ASPx.Key.Enter;
15960  return handleKeyPress == isKeyPress;
15961 },
15962 OnKeyEventEnd: function(evt, withDelay){
15963  if(!this.GetReadOnly()) {
15964   if(this.IsRaiseStandardOnChange(evt))
15965    this.RaiseStandardOnChange();
15966   this.SyncRawValueIfHasTextDecorators(withDelay);
15967  }
15968 },
15969 SyncRawValueIfHasTextDecorators: function(withDelay) {
15970  if(this.HasTextDecorators()) {
15971   if(withDelay) {
15972    window.setTimeout(function() {
15973     this.SyncRawValue();
15974    }.aspxBind(this), 0);
15975   } else 
15976    this.SyncRawValue();
15977  }
15978 },
15979 IsRaiseStandardOnChange: function(evt){
15980  return !this.specialKeyboardHandlingUsed && this.raiseValueChangedOnEnter && evt.keyCode == ASPx.Key.Enter;
15981 },
15982 GetFocusSelectAction: function() {
15983  if (this.maskInfo)
15984   return this.maskInfo.IsEmpty() ? null : "start";
15985  return "all"; 
15986 },
15987 CorrectFocusWhenDisabled: function() {
15988  if(!this.GetEnabled()) {
15989   var inputElement = this.GetInputElement();
15990   if(inputElement)
15991    inputElement.blur();
15992   return true;
15993  }
15994  return false;
15995 },
15996 EnsureShowPopupHelpText: function() {
15997  if(this.helpTextDisplayMode === ASPxClientTextEditHelpTextDisplayMode.Popup)
15998   this.showHelpText();
15999 },
16000 EnsureHidePopupHelpText: function() {
16001  if(this.helpTextDisplayMode === ASPxClientTextEditHelpTextDisplayMode.Popup)
16002   this.hideHelpText();
16003 },
16004 OnFocusCore: function() {
16005  if(this.CorrectFocusWhenDisabled())
16006   return;
16007  var wasLocked = this.IsFocusEventsLocked();
16008  ASPxClientEdit.prototype.OnFocusCore.call(this);
16009  this.CorrectInputMaxLength(true);
16010  if(this.maskInfo != null) {
16011   this.SavePrevMaskValue();
16012   this.BeginShowMaskHint();
16013  }
16014  if(!wasLocked) {
16015   this.ToggleTextDecoration();
16016   this.startUserInputEventTimerIfRequired();
16017  }
16018  if(this.isPasswordNullTextInputElementExists())
16019   setTimeout(function() { this.EnsureShowPopupHelpText(); }.aspxBind(this), 0);
16020  else
16021   this.EnsureShowPopupHelpText();
16022 },
16023 startUserInputEventTimerIfRequired: function () {
16024  if(this.shouldStartUserInputTimer() && this.userInputEventTimerID === -1) {
16025   this.prevInputValue = this.GetInputElement().value;
16026   this.userInputEventTimerID = ASPx.Timer.SetControlBoundInterval(this.processUserInputEventTimer, this, ASPx.CheckUserInputInterval);
16027  }
16028 },
16029 shouldStartUserInputTimer: function() {
16030  return !this.UserInput.IsEmpty();
16031 },
16032 restartCurrentUserInputTimer: function() {
16033  if(this.userInputEventTimerID !== -1) {
16034   this.processUserInputEventTimer(true);
16035   this.clearUserInputEventTimerIfRequired();
16036   this.startUserInputEventTimerIfRequired();
16037  }
16038 },
16039 clearUserInputEventTimerIfRequired: function () {
16040  if (this.userInputEventTimerID !== -1)
16041   this.userInputEventTimerID = ASPx.Timer.ClearInterval(this.userInputEventTimerID);
16042 },
16043 processUserInputEventTimer: function(onRestart) {
16044  var currentInputValue = this.GetInputElement().value;
16045  if(currentInputValue !== this.prevInputValue) {
16046   this.onInputChangedOnUserInputTimer(onRestart);
16047   this.prevInputValue = currentInputValue;
16048  }
16049 },
16050 onInputChangedOnUserInputTimer: function(onRestart) {
16051  if(this.raiseUserInputTimeout > -1)
16052   clearTimeout(this.raiseUserInputTimeout);
16053  this.raiseUserInputTimeout = setTimeout(function() {
16054   this.RaiseUserInput();
16055   this.raiseUserInputTimeout = -1;
16056  }.bind(this), 0);
16057 },
16058 ensureFocusedNullTextElement: function () {
16059  if(!this.focusedNullTextElement)
16060   this.createFocusedNullTextElement();
16061 },
16062 getFocusedNullTextElementClassName: function() {
16063  return focusedNullTextClassName;
16064 },
16065 getFocusedNullTextElementTagName: function() {
16066  return "INPUT";
16067 },
16068 getCopyFromInputElementStyles: function() {
16069  return [ "paddingLeft", "paddingTop", "paddingRight", "paddingBottom", "borderCollapse", "borderLeftWidth", "borderTopWidth", "borderRightWidth", "borderBottomWidth" ];
16070 },
16071 copyStylesFromInputElementToFocusedNullTextElement: function() {
16072  var input = this.GetInputElement();
16073  var inputStyle = ASPx.GetCurrentStyle(input);
16074  var stylesToCopy = this.getCopyFromInputElementStyles();
16075  for(var i = 0; i < stylesToCopy.length; i++)
16076   this.focusedNullTextElement.style[stylesToCopy[i]] = inputStyle[stylesToCopy[i]];
16077 },
16078 createFocusedNullTextElement: function() {
16079  this.focusedNullTextElement = document.createElement(this.getFocusedNullTextElementTagName());
16080  this.focusedNullTextElement.value = this.nullText;
16081  this.focusedNullTextElement.className = this.getFocusedNullTextElementClassName();
16082  this.focusedNullTextElement.tabIndex = -1;
16083  ASPx.SetElementDisplay(this.focusedNullTextElement, false);
16084  this.copyStylesFromInputElementToFocusedNullTextElement();
16085  if (this.nullTextOnFocusCssText) {
16086   var styleSheet = ASPx.GetCurrentStyleSheet();
16087   this.focusedNullTextElement.className += " " + ASPx.CreateImportantStyleRule(styleSheet, this.nullTextOnFocusCssText);
16088  }
16089  var inputElement = this.GetInputElement();
16090  inputElement.parentNode.insertBefore(this.focusedNullTextElement, inputElement.nextSibling);
16091 },
16092 ensureActivateFocusedNullTextMechanism: function() {
16093  if (this.nullTextDisplayMode === NullTextDisplayMode.UnfocusedAndFocused) {
16094   if(this.IsNull(this.GetValue()))
16095    this.changeFocusedNullTextElementVisibility(true);
16096   this.setFocusedNullTextTimer();
16097  }
16098 },
16099 ensureDeactivateFocusedNullTextMechanism: function () {
16100  if (this.nullTextDisplayMode === NullTextDisplayMode.UnfocusedAndFocused) {
16101   this.clearFocusedNullTextTimer();
16102   this.changeFocusedNullTextElementVisibility(false);
16103  }
16104 },
16105 setFocusedNullTextTimer: function () {
16106  if(this.focusedNullTextTimerID === -1)
16107   this.focusedNullTextTimerID = ASPx.Timer.SetControlBoundInterval(this.onFocusedNullTextVisibilityCheck, this, ASPx.PasteCheckInterval);
16108 },
16109 clearFocusedNullTextTimer: function () {
16110  this.focusedNullTextTimerID = ASPx.Timer.ClearInterval(this.focusedNullTextTimerID);
16111 },
16112 onFocusedNullTextVisibilityCheck: function (evt) {
16113  if(!this.needShowFocusedNullText() && this.isFocusedNullTextElementDisplayed())
16114   this.changeFocusedNullTextElementVisibility(false);
16115  else if(this.needShowFocusedNullText() && !this.isFocusedNullTextElementDisplayed())
16116   this.changeFocusedNullTextElementVisibility(true);
16117 },
16118 isFocusedNullTextElementDisplayed: function() {
16119  return this.focusedNullTextElement && ASPx.GetElementDisplay(this.focusedNullTextElement);
16120 },
16121 needShowFocusedNullText: function() {
16122  if(this.focusedNullTextTimerID === -1)
16123   return this.IsNull(this.GetValue());
16124  var result = this.GetInputElement().value === "";
16125  if(this.CanApplyNullTextDecoration)
16126   result = result && this.CanApplyNullTextDecoration();
16127  return result;
16128 }, 
16129 changeFocusedNullTextElementVisibility: function (visible) {
16130  this.ensureFocusedNullTextElement();
16131  ASPx.SetElementDisplay(this.focusedNullTextElement, visible);
16132  if(visible)
16133   this.adjustFocusedNullTextElement();  
16134 },
16135 getInputElementAbsoluteX: function(input) {
16136  var result = ASPx.GetAbsoluteX(input);
16137  if(ASPx.Browser.Opera || ASPx.Browser.AndroidMobilePlatform) 
16138   result++;
16139  return result;
16140 },
16141 getInputElementAbsoluteY: function (input) {
16142  var result = ASPx.GetAbsoluteY(input);
16143  if(ASPx.Browser.Opera || ASPx.Browser.AndroidMobilePlatform) 
16144   result++;
16145  return result;
16146 },
16147 adjustFocusedNullTextElement: function() {
16148  var input = this.GetInputElement();
16149  this.focusedNullTextElement.style.width = input.offsetWidth + "px";
16150  this.focusedNullTextElement.style.height = input.offsetHeight + "px";
16151  var inputXPos = this.getInputElementAbsoluteX(input);
16152  var inputYPos = this.getInputElementAbsoluteY(input);
16153  ASPx.SetAbsoluteX(this.focusedNullTextElement, inputXPos);
16154  ASPx.SetAbsoluteY(this.focusedNullTextElement, inputYPos);
16155  var shiftByX = inputXPos - ASPx.GetAbsoluteX(this.focusedNullTextElement);
16156  var shiftByY = inputYPos - ASPx.GetAbsoluteY(this.focusedNullTextElement);
16157  if (shiftByX !== 0)
16158   this.focusedNullTextElement.style.left = ASPx.PxToFloat(this.focusedNullTextElement.style.left) + shiftByX + "px";
16159  if (shiftByY !== 0)
16160   this.focusedNullTextElement.style.top = ASPx.PxToFloat(this.focusedNullTextElement.style.top) + shiftByY + "px";
16161 },
16162 ensureAdjustFocusedNullTextElement: function () {
16163  if(this.isFocusedNullTextElementDisplayed())
16164   this.adjustFocusedNullTextElement(this.focusedNullTextElement);
16165 },
16166 TrySetCursorToStartPosition: function() {
16167  var input = this.GetInputElement();
16168  var sel = ASPx.Selection.GetInfo(input);
16169  if (sel.startPos === sel.endPos && this.IsMaskInfoEmpty()) {
16170   var pos = this.maskInfo.GetFirstNonLiteralPosition();
16171   var setCaret = ASPx.Selection.SetCaretPosition.bind(this, input, pos);
16172   setTimeout(function() {
16173    if (document.activeElement === input) {
16174     setCaret();
16175     setTimeout(setCaret, 50);
16176    }
16177   }, 0);
16178  }
16179 },
16180 IsMaskInfoEmpty: function() {
16181  return this.maskInfo.IsEmpty();
16182 },
16183 OnLostFocusCore: function() {
16184  var wasLocked = this.IsFocusEventsLocked();
16185  ASPxClientEdit.prototype.OnLostFocusCore.call(this);
16186  this.CorrectInputMaxLength();
16187  if(this.maskInfo != null) {
16188   this.EndShowMaskHint();
16189   this.HideMaskHint();   
16190   if(this.maskInfo.ApplyFixes(null))
16191    this.ApplyMaskInfo(false);
16192   this.RaiseStandardOnChange();
16193  }
16194  if(!wasLocked) {
16195   this.clearUserInputEventTimerIfRequired();
16196   this.ToggleTextDecoration();
16197  }
16198  this.escCount = 0;
16199  this.EnsureHidePopupHelpText();
16200 },
16201 InputMaxLengthCorrectionRequired: function () {
16202  return ASPx.Browser.IE && ASPx.Browser.Version >= 10 && (!this.isNative || this.nullText != "");
16203 },
16204 CorrectInputMaxLength: function (onFocus) {
16205  if(this.InputMaxLengthCorrectionRequired()) {
16206   var input = this.GetInputElement();
16207   if(!ASPx.IsExists(this.inputMaxLength))
16208    this.inputMaxLength = input.maxLength;
16209   input.maxLength = onFocus ? this.inputMaxLength : -1;
16210  }
16211 },
16212 SubscribeToIeDropEvent: function() {
16213  if(this.InputMaxLengthCorrectionRequired()) {
16214   var input = this.GetInputElement();
16215   ASPx.Evt.AttachEventToElement(input, "drop", function(e) { this.CorrectInputMaxLength(true); }.aspxBind(this));
16216  }
16217 },
16218 SetFocus: function() {
16219  if(this.isPasswordNullTextInputElementExists()) {
16220   this.GetPasswordNullTextInputElement().focus();
16221  } else {
16222     ASPxClientEdit.prototype.SetFocus.call(this);
16223  }
16224 },
16225 OnValueChanged: function() {
16226  if(this.maskInfo != null) {
16227   if(this.maskInfo.GetValue() == this.maskValueBeforeUserInput && !this.IsValueChangeForced())
16228    return;
16229   this.SavePrevMaskValue();
16230  }
16231  if(this.HasTextDecorators())
16232   this.SyncRawValue();
16233  if(!this.IsValueChanged() && !this.IsValueChangeForced())
16234   return;
16235  this.SaveChangedValue(); 
16236  ASPxClientEdit.prototype.OnValueChanged.call(this);
16237 },
16238 IsValueChangeForced: function() {
16239  return false;
16240 },
16241 OnTextChanged: function() {
16242 },
16243 SaveChangedValue: function() {
16244  this.lastChangedValue = this.GetValue();
16245 },
16246 RaiseStandardOnChange: function(){
16247  var element = this.GetInputElement();
16248  if(element && element.onchange) {
16249   element.onchange({ target: this.GetInputElement() });
16250  }
16251  else if(this.ValueChanged) {
16252   this.ValueChanged.FireEvent(this);
16253  }
16254 },
16255 RaiseTextChanged: function(processOnServer){
16256  if(!this.TextChanged.IsEmpty()){
16257   var args = new ASPxClientProcessingModeEventArgs(processOnServer);
16258   this.TextChanged.FireEvent(this, args);
16259   processOnServer = args.processOnServer;
16260  }
16261  return processOnServer;  
16262 },
16263 RaiseUserInput: function () {
16264  if(!this.UserInput.IsEmpty()) {
16265   var args = new ASPxClientEventArgs();
16266   this.UserInput.FireEvent(this, args);
16267  }
16268 },
16269 GetText: function(){
16270  if(this.maskInfo != null) {
16271   return this.maskInfo.GetText();
16272  } else {
16273   var value = this.GetValue();
16274   return value != null ? value : "";
16275  }
16276 },
16277 SetText: function (value){
16278  if(this.maskInfo != null) {
16279   this.maskInfo.SetText(value);
16280   this.ApplyMaskInfo(false);
16281   this.SavePrevMaskValue();
16282  } else {
16283   this.SetValue(value);
16284  }
16285 },
16286 SelectAll: function() {
16287  this.SetSelection(0, -1, false);
16288 },
16289 SetCaretPosition: function(pos) {
16290  var inputElement = this.GetInputElement();
16291  ASPx.Selection.SetCaretPosition(inputElement, pos);
16292 },
16293 GetCaretPosition: function() {
16294  var inputElement = this.GetInputElement();
16295  return ASPx.Selection.GetCaretPosition(inputElement);
16296 },
16297 SetSelection: function(startPos, endPos, scrollToSelection) { 
16298  var inputElement = this.GetInputElement();
16299  ASPx.Selection.Set(inputElement, startPos, endPos, scrollToSelection);
16300 },
16301 ChangeEnabledAttributes: function(enabled){
16302  var inputElement = this.GetInputElement();
16303  if(inputElement){
16304   this.ChangeInputEnabledAttributes(inputElement, ASPx.Attr.ChangeAttributesMethod(enabled), enabled);
16305   if(this.specialKeyboardHandlingUsed)
16306    this.ChangeSpecialInputEnabledAttributes(inputElement, ASPx.Attr.ChangeEventsMethod(enabled), true);
16307   this.ChangeInputEnabled(inputElement, enabled, this.GetReadOnly());
16308  }
16309 },
16310 SetReadOnlyInternal: function(readOnly) {
16311  ASPxClientEdit.prototype.SetReadOnlyInternal.call(this, readOnly);
16312  this.ChangeInputReadOnly(readOnly);
16313 },
16314 ChangeReadOnlyStateItems: function(readOnly) {
16315  ASPxClientEdit.prototype.ChangeReadOnlyStateItems.call(this, readOnly);
16316  ASPx.GetStateController().SetElementReadOnly(this.GetInputElement(), readOnly);
16317 },
16318 ChangeInputReadOnly: function(readOnly) {
16319  var inputElement = this.GetInputElement();
16320  if(inputElement)
16321   inputElement.readOnly = readOnly || !this.GetEnabled() && this.UseReadOnlyForDisabled();
16322 },
16323 ChangeEnabledStateItems: function(enabled){
16324  if(!this.isNative) {
16325   var sc = ASPx.GetStateController();
16326   sc.SetElementEnabled(this.GetMainElement(), enabled);
16327   sc.SetElementEnabled(this.GetInputElement(), enabled);
16328  }
16329 },
16330 ChangeInputEnabled: function(element, enabled, readOnly) {
16331  if(this.UseReadOnlyForDisabled())
16332   element.readOnly = !enabled || readOnly;
16333  else
16334   element.disabled = !enabled;
16335 },
16336 ChangeInputEnabledAttributes: function(element, method, enabled) {
16337  var ieTabIndexFix = enabled && ASPx.Browser.IE && element.setAttribute && ASPx.Attr.IsExistsAttribute(element, "savedtabIndex");
16338  method(element, "tabIndex");
16339  if(!enabled) element.tabIndex = -1;
16340  if(ieTabIndexFix) { 
16341   window.setTimeout(function() {
16342    if(element && element.parentNode)
16343     element.parentNode.replaceChild(element, element); 
16344   }, 0);
16345  }
16346  method(element, "onclick");
16347  if(!this.NeedFocusCorrectionWhenDisabled())
16348   method(element, "onfocus");
16349  method(element, "onblur");
16350  method(element, "onkeydown");
16351  method(element, "onkeypress");
16352  method(element, "onkeyup");
16353 },
16354 UseReadOnlyForDisabled: function() {
16355  return (ASPx.Browser.IE && ASPx.Browser.Version < 10) && !this.isNative;
16356 },
16357 NeedFocusCorrectionWhenDisabled: function(){
16358  return (ASPx.Browser.IE && ASPx.Browser.Version < 10) && !this.isNative;
16359 },
16360 OnPostFinalization: function(args) {
16361  this.TryRestoreDisabledOnPost(args);
16362  this.TryClearInputTextDecorationOnPost(args);
16363 },
16364 TryRestoreDisabledOnPost: function(args) { 
16365  if(this.GetEnabled() || !this.UseReadOnlyForDisabled() || args.isDXCallback)
16366   return;
16367  var inputElement = this.GetInputElement();
16368  if(inputElement) {
16369   var inputDisabled = inputElement.disabled;
16370   inputElement.disabled = true;
16371   window.setTimeout(function() {
16372    inputElement.disabled = inputDisabled;
16373   }, 0);
16374  }
16375 },
16376 TryClearInputTextDecorationOnPost: function(args) {
16377  if(this.HasTextDecorators() && !this.GetValue()) {
16378   var inputElement = this.GetInputElement();
16379   if(inputElement) {
16380    var hiddenInput = ASPx.CreateHiddenField(ASPx.Attr.GetAttribute(inputElement, "name"), undefined, inputElement.parentNode);
16381    ASPx.Attr.ChangeAttribute(inputElement, "name", "");
16382    setTimeout(function() {
16383     ASPx.Attr.RestoreAttribute(inputElement, "name");
16384     ASPx.RemoveElement(hiddenInput);
16385    }, 0);
16386   }
16387  }
16388 },
16389 OnUnload: function() {
16390  var input = this.GetInputElement();
16391  if(!input)
16392   return;
16393  if(this.IsAutocompleteOffNotRequiredOnUnload())
16394   ASPx.Attr.RemoveAttribute(input, "autocomplete");
16395  if(this.focusedNullTextElement)
16396   ASPx.RemoveElement(this.focusedNullTextElement);
16397 },
16398 IsVCardAttributeRequired: function() {
16399  return this.autoCompleteAttribute && this.autoCompleteAttribute.name !== "autocomplete";
16400 },
16401 IsAutocompleteDropDownListRequiredOnFocus: function() {
16402  return !this.autoCompleteAttribute || this.IsVCardAttributeRequired();
16403 },
16404 IsAutocompleteOffRequiredOnInitialize: function() {
16405  return !this.isNative && (this.autoCompleteAttribute && this.autoCompleteAttribute.name === "autocomplete" || ASPx.Browser.WebKitFamily);
16406 },
16407 IsAutocompleteOffRequiredOnLostFocus: function() {
16408  return !this.autoCompleteAttribute && this.IsNullTextVisible() && !this.IsVCardAttributeRequired();
16409 },
16410 IsAutocompleteOffNotRequiredOnUnload: function() {
16411  return !this.IsNullTextVisible() || this.IsVCardAttributeRequired() || (this.maskInfo != null && this.GetValue() == null);
16412 },
16413 IsNullTextVisible: function() {
16414  return this.nullText && !this.GetValue() && !this.GetText();
16415 },
16416 GetModifyEvent: function() {
16417  return this.UserInput;
16418 },
16419 EnsureRequiredNativeAttributesExists: function() {
16420  var input = this.GetInputElement();
16421  if(!input.onfocus)
16422   ASPx.Evt.AttachEventToElement(input, "focus", function() { ASPx.EGotFocus(this.name); }.aspxBind(this));
16423  if(!input.onblur)
16424   ASPx.Evt.AttachEventToElement(input, "blur", function() { ASPx.ELostFocus(this.name); }.aspxBind(this));
16425 }
16426});
16427MaskValidationPattern = ASPx.CreateClass(ASPx.ValidationPattern, {
16428 constructor: function(errorText, maskInfo) {
16429  this.constructor.prototype.constructor.call(this, errorText);
16430  this.maskInfo = maskInfo;
16431 },
16432 EvaluateIsValid: function(value) {
16433  return this.maskInfo.IsValid();
16434 }
16435});
16436ASPx.Ident.IsASPxClientTextEdit = function(obj) {
16437 return !!obj.isASPxClientTextEdit;
16438};
16439var ASPxClientTextBoxBase = ASPx.CreateClass(ASPxClientTextEdit, {
16440 constructor: function(name) {
16441  this.constructor.prototype.constructor.call(this, name);
16442  this.sizingConfig.allowSetHeight = false;
16443  this.sizingConfig.adjustControl = true;
16444 }
16445});
16446var ASPxClientTextBox = ASPx.CreateClass(ASPxClientTextBoxBase, {
16447 constructor: function(name) {
16448  this.constructor.prototype.constructor.call(this, name);
16449  this.isASPxClientTextBox = true;
16450  this.isCaptchaTextBox = false;
16451 },
16452 NeedProcessUnload: function() {
16453  return ASPxClientTextBoxBase.prototype.NeedProcessUnload.call(this) && !this.isCaptchaTextBox;
16454 },
16455 IsValueRestoredByBrowser: function() {
16456  if(this.isCaptchaTextBox)
16457   return this.initializeInputValue !== "" && this.initializeInputValue !== this.nullText;
16458  return  ASPxClientTextBoxBase.prototype.IsValueRestoredByBrowser.call(this);
16459 },
16460 SynchronizeRestoredValue: function() {
16461  if(this.isCaptchaTextBox)
16462   this.SetText(null);
16463  else
16464   ASPxClientTextBoxBase.prototype.SynchronizeRestoredValue.call(this);
16465 },
16466});
16467ASPxClientTextBox.Cast = ASPxClientControl.Cast;
16468ASPx.Ident.IsASPxClientTextBox = function(obj) {
16469 return !!obj.isASPxClientTextBox;
16470};
16471var ASPxClientMemo = ASPx.CreateClass(ASPxClientTextEdit, { 
16472 constructor: function(name) {
16473  this.constructor.prototype.constructor.call(this, name);        
16474  this.isASPxClientMemo = true;
16475  this.raiseValueChangedOnEnter = false;
16476  this.maxLength = 0;
16477  this.pasteTimerID = -1;
16478  this.pasteTimerActivatorCount = 0;
16479 },
16480 Initialize: function() {
16481  ASPxClientTextEdit.prototype.Initialize.call(this);
16482  this.SaveChangedValue();
16483  this.maxLengthRestricted = this.maxLength > 0;
16484 },
16485 CutString: function() {
16486  var text = this.GetText();
16487  if(text.length > this.maxLength) {
16488   text = text.substring(0, this.maxLength);
16489   this.SetText(text);
16490  }
16491 },
16492 EventKeyCodeChangesTheInput: function(evt) {
16493  if(ASPx.IsPasteShortcut(evt))
16494   return true;
16495  else if(evt.ctrlKey)
16496   return false;
16497  var keyCode = ASPx.Evt.GetKeyCode(evt);
16498  var isSystemKey = ASPx.Key.Windows <= keyCode && keyCode <= ASPx.Key.ContextMenu;
16499  var isFKey = ASPx.Key.F1 <= keyCode && keyCode <= 127; 
16500  return ASPx.Key.Delete < keyCode && !isSystemKey && !isFKey || keyCode == ASPx.Key.Enter || keyCode == ASPx.Key.Space;
16501 },
16502 OnTextChangingCheck: function() {
16503  if(this.maxLengthRestricted)  
16504   this.CutString(); 
16505 },
16506 StartTextChangingTimer: function() {
16507  if(this.maxLengthRestricted) {
16508   if(this.pasteTimerActivatorCount == 0) 
16509    this.SetTextChangingTimer();
16510   this.pasteTimerActivatorCount ++;
16511  }
16512 },
16513 EndTextChangingTimer: function() {
16514  if(this.maxLengthRestricted) {
16515   this.pasteTimerActivatorCount --;
16516   if(this.pasteTimerActivatorCount == 0) 
16517    this.ClearTextChangingTimer();
16518  }
16519 },
16520 CollapseEditor: function() {
16521  if(!this.IsAdjustmentRequired()) return;
16522  var mainElement = this.GetMainElement();
16523  var inputElement = this.GetInputElement();
16524  if(!ASPx.IsExistsElement(mainElement) || !ASPx.IsExistsElement(inputElement))
16525   return;
16526  ASPxClientTextEdit.prototype.CollapseEditor.call(this);
16527  var mainElementCurStyle = ASPx.GetCurrentStyle(mainElement);
16528  if(this.heightCorrectionRequired && mainElement && inputElement) {
16529   if(mainElement.style.height == "100%" || mainElementCurStyle.height == "100%") {
16530    mainElement.style.height = "0";
16531    mainElement.wasCollapsed = true;
16532   }
16533   inputElement.style.height = "0";
16534  }
16535 },
16536 SetWidth: function(width) {
16537  ASPxClientTextEdit.prototype.SetWidth.call(this, width);
16538  if(ASPx.Browser.IE)
16539   this.AdjustControl();
16540 },
16541 SetHeight: function(height) {
16542  var textarea = this.GetInputElement();
16543  textarea.style.height = "1px";
16544  ASPxClientTextEdit.prototype.SetHeight.call(this, height);
16545  textarea.style.height = ASPx.GetClearClientHeight(this.GetMainElement()) - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(textarea) + "px";
16546 },
16547 ClearErrorFrameElementsStyles: function() {
16548  var textarea = this.GetInputElement();
16549  if(!textarea)
16550   return;
16551  var scrollBarPosition = textarea.scrollTop;
16552  ASPxClientTextEdit.prototype.ClearErrorFrameElementsStyles.call(this);
16553  if(ASPx.Browser.Firefox)
16554   textarea.scrollTop = scrollBarPosition;
16555 },
16556 OnMouseOver: function() {
16557  this.StartTextChangingTimer();
16558 },  
16559 OnMouseOut: function() {
16560  this.EndTextChangingTimer();
16561 },   
16562 OnFocus: function() {  
16563  this.StartTextChangingTimer();
16564  ASPxClientTextEdit.prototype.OnFocus.call(this);
16565 },
16566 OnLostFocus: function() {
16567  this.EndTextChangingTimer();
16568  ASPxClientTextEdit.prototype.OnLostFocus.call(this);
16569 },
16570 OnKeyDown: function(evt) { 
16571  if(this.NeedPreventBrowserUndoBehaviour(evt))
16572   return ASPx.Evt.PreventEvent(evt);
16573  if(this.maxLengthRestricted){
16574   var selection = ASPx.Selection.GetInfo(this.GetInputElement()); 
16575   var noCharToReplace = selection.startPos == selection.endPos;
16576   if(this.GetText().length >= this.maxLength && noCharToReplace && this.EventKeyCodeChangesTheInput(evt)) {
16577    return ASPx.Evt.PreventEvent(evt);
16578   }
16579  }
16580  ASPxClientEdit.prototype.OnKeyDown.call(this, evt);
16581 },
16582 SetTextChangingTimer: function() {
16583  this.pasteTimerID = ASPx.Timer.SetControlBoundInterval(this.OnTextChangingCheck, this, ASPx.PasteCheckInterval);
16584 },
16585 ClearTextChangingTimer: function() {
16586  this.pasteTimerID = ASPx.Timer.ClearInterval(this.pasteTimerID);
16587 },
16588 getFocusedNullTextElementTagName: function() {
16589  return "TEXTAREA";
16590 },
16591 getCopyFromInputElementStyles: function() {
16592  var result = ASPxClientTextEdit.prototype.getCopyFromInputElementStyles.call(this);
16593  result.push("resize");
16594  return result;
16595 }
16596});
16597ASPxClientMemo.Cast = ASPxClientControl.Cast;
16598ASPx.Ident.IsASPxClientMemo = function(obj) { return obj && !!obj.isASPxClientMemo; };
16599var CLEAR_BUTTON_INDEX = -100;
16600var HIDE_CONTENT_CSS_CLASS_NAME = "dxHideContent";
16601var setContentVisibility = function(clearButtonElement, value) {
16602 var action = value ? ASPx.RemoveClassNameFromElement : ASPx.AddClassNameToElement;
16603 action(clearButtonElement, HIDE_CONTENT_CSS_CLASS_NAME);
16604};
16605var CLEAR_BUTTON_DISPLAY_MODE = {
16606 AUTO: 'Auto',
16607 ALWAYS: 'Always',
16608 NEVER: 'Never',
16609 ON_HOVER: 'OnHover'
16610};
16611var AccessibilityFocusedButtonClassName = "dxAFB";
16612var ASPxClientButtonEditBase = ASPx.CreateClass(ASPxClientTextBoxBase, {
16613 constructor: function(name) {
16614  this.constructor.prototype.constructor.call(this, name);        
16615  this.allowUserInput = true;
16616  this.isValueChanging = false;
16617  this.allowMouseWheel = true;
16618  this.isMouseOver = false;
16619  this.buttonCount = 0;
16620  this.emptyValueMaskDisplayText = "";
16621  this.clearButtonDisplayMode = CLEAR_BUTTON_DISPLAY_MODE.AUTO;
16622  this.forceShowClearButtonAlways = false;
16623  this.recoverClearButtonVisibility = false;
16624  this.ButtonClick = new ASPxClientEvent();
16625 },
16626 Initialize: function() {
16627  ASPxClientTextBoxBase.prototype.Initialize.call(this);
16628  this.EnsureEmptyValueMaskDisplayText();
16629  if(this.HasClearButton())
16630   this.InitializeClearButton();
16631  this.InitAccessibilityCompliant();
16632 },
16633 InlineInitialize: function() {
16634  ASPxClientTextBoxBase.prototype.InlineInitialize.call(this);
16635  if(this.clearButtonDisplayMode === CLEAR_BUTTON_DISPLAY_MODE.AUTO) {
16636   this.clearButtonDisplayMode = this.IsClearButtonVisibleAuto() || this.forceShowClearButtonAlways ?
16637    CLEAR_BUTTON_DISPLAY_MODE.ALWAYS : CLEAR_BUTTON_DISPLAY_MODE.NEVER;
16638  }
16639  this.EnsureClearButtonVisibility();
16640 },
16641 InitializeClearButton: function() {
16642  if(this.clearButtonDisplayMode === CLEAR_BUTTON_DISPLAY_MODE.ON_HOVER) {
16643   ASPx.Evt.AttachMouseEnterToElement(this.GetHoverElementToShowClearButton(), this.OnMouseOver.aspxBind(this), this.OnMouseOut.aspxBind(this));
16644  }
16645 },
16646 GetHoverElementToShowClearButton: function() {
16647  return this.GetMainElement();
16648 },
16649 IsClearButtonVisibleAuto: function() {
16650  return ASPx.Browser.MobileUI;
16651 },
16652 SetEnabled: function(enabled) {
16653  ASPxClientTextBoxBase.prototype.SetEnabled.call(this, enabled);
16654  this.EnsureClearButtonVisibility();
16655 },
16656 EnsureEmptyValueMaskDisplayText: function() {
16657  if(this.maskInfo && this.HasClearButton()) {
16658   var savedText = this.maskInfo.GetText();
16659   this.maskInfo.SetText("");
16660   this.emptyValueMaskDisplayText = this.maskInfo.GetText();
16661   this.maskInfo.SetText(savedText);
16662  }
16663 },
16664 GetButton: function(number) {
16665  return this.GetChildElement("B" + number);
16666 },
16667 GetCustomButtonCollection: function() {
16668  var buttonElements = [];
16669  for(var i = 0; i < this.buttonCount; i++) {
16670   var button =  this.GetButton(i);
16671   if(!!button)
16672    buttonElements.push(button);
16673  }
16674  return buttonElements;
16675 },
16676 GetButtonCollection: function() {
16677  var buttonElements = [];
16678  var clearButton = this.GetClearButton();
16679  if(!!clearButton)
16680   buttonElements.push(clearButton);
16681  return buttonElements.concat(this.GetCustomButtonCollection());
16682 },
16683 GetAccessibilityAnchor: function(buttonElement) {
16684  var firstChild = buttonElement.firstElementChild;
16685  var isExistsAnchorElement = ASPx.Attr.GetAttribute(firstChild, "role") === "button";
16686  return isExistsAnchorElement ? firstChild : null;
16687 },
16688 GetButtonByAccessibilityAnchor: function(anchorElement) {
16689  return anchorElement.parentNode;
16690 },
16691 SetAccessibilityAnchorEnabled: function(buttonElement, enabled) {
16692  var anchorElement = this.GetAccessibilityAnchor(buttonElement);
16693  if(ASPx.IsExists(anchorElement))
16694   ASPx.Attr.SetOrRemoveAttribute(anchorElement, "tabindex", enabled ? "0" : "");
16695 },
16696 InitAccessibilityCompliant: function() {
16697  if(!this.accessibilityCompliant) return;
16698  var buttonElements = this.GetButtonCollection();
16699  var labelElements = ASPx.FindAssociatedLabelElements(this);
16700  for(var i = 0; i < buttonElements.length; i++)
16701   this.InitAccessibilityAnchor(this.GetAccessibilityAnchor(buttonElements[i]), labelElements);     
16702 },
16703 InitAccessibilityAnchor: function(anchorElement, labelElements) {
16704  if(!ASPx.IsExists(anchorElement))
16705   return;
16706  for(var i = 0; i < labelElements.length; i++)
16707   this.ariaExplanatoryTextManager.SetOrRemoveText([anchorElement], labelElements[i], true, false, false);
16708  this.InitAccessibilityAnchorEvents(anchorElement);
16709 },
16710 InitAccessibilityAnchorEvents: function(anchorElement) {
16711  ASPx.Evt.AttachEventToElement(anchorElement, "keydown", function(evt) { this.OnButtonKeysHandling(evt); }.aspxBind(this));
16712  ASPx.Evt.AttachEventToElement(anchorElement, "keyup", function(evt) { this.OnButtonKeysHandling(evt); }.aspxBind(this));
16713  ASPx.Evt.AttachEventToElement(anchorElement, "focus", function(evt) { this.OnButtonGotFocus(evt); }.aspxBind(this));
16714  ASPx.Evt.AttachEventToElement(anchorElement, "blur", function(evt) { this.OnButtonLostFocus(evt); }.aspxBind(this));
16715 },
16716 EmulateButtonMouseEvent: function(sourceElement) {
16717  var buttonElement = this.GetButtonByAccessibilityAnchor(sourceElement);
16718  var mouseEvent = buttonElement.onclick || buttonElement.onmousedown || buttonElement.ontouchstart || buttonElement.onpointerdown;
16719  var emulateMouseEvtArgs = { button: 0, which: 1, srcElement: buttonElement, target: buttonElement };
16720  if(!!mouseEvent) {
16721   ASPx.Attr.SetAttribute(sourceElement, "aria-pressed", true);
16722   setTimeout(function() {
16723    mouseEvent(emulateMouseEvtArgs);
16724    ASPx.Attr.RemoveAttribute(sourceElement, "aria-pressed");
16725   }, 300);
16726  }
16727 },
16728 OnButtonKeysHandling: function(evt) {
16729  var isKeyUp = evt.type == "keyup";
16730  var keyCode = ASPx.Evt.GetKeyCode(evt);
16731  var sourceElement = ASPx.Evt.GetEventSource(evt);
16732  if((keyCode == ASPx.Key.Space && isKeyUp) || (keyCode == ASPx.Key.Enter && !isKeyUp))
16733   this.EmulateButtonMouseEvent(sourceElement);
16734  if(keyCode != ASPx.Key.Tab) {
16735   evt.cancelBubble = true;
16736   evt.preventDefault();
16737  }
16738  return false;
16739 },
16740 OnButtonGotFocus: function(evt) {
16741  var editor = ASPx.GetControlCollection().Get(this.name);
16742  var sourceElement = ASPx.Evt.GetEventSource(evt);
16743  if(!!editor && !editor.CorrectAccessibilityButtonFocus(sourceElement)) {
16744   var buttonElement = editor.GetButtonByAccessibilityAnchor(sourceElement);
16745   ASPx.AddClassNameToElement(buttonElement, this.GetAccessibilityFocusedButtonClassName());
16746   ASPx.EGotFocus(editor.name);
16747   if(editor.specialKeyboardHandlingUsed)
16748    ASPx.ESGotFocus(editor.name);
16749  }
16750 },
16751 OnButtonLostFocus: function(evt) {
16752  var editor = ASPx.GetControlCollection().Get(this.name);
16753  var sourceElement = ASPx.Evt.GetEventSource(evt);
16754  if(!!editor) {
16755   var buttonElement = editor.GetButtonByAccessibilityAnchor(sourceElement);
16756   ASPx.RemoveClassNameFromElement(buttonElement, this.GetAccessibilityFocusedButtonClassName());
16757  }
16758  setTimeout(function() {
16759   if(!!editor && !editor.IsEditorElement(ASPx.GetActiveElement())) {
16760    ASPx.ELostFocus(editor.name);
16761    if(editor.specialKeyboardHandlingUsed)
16762     ASPx.ESLostFocus(editor.name);
16763   }
16764  }.aspxBind(this), 0);
16765 },
16766 ForceRefocusEditor: function(evt, isNativeFocus) {
16767  if(this.accessibilityCompliant) {
16768   var srcElement = ASPx.Evt.GetEventSource(evt);
16769   var customButtons = this.GetCustomButtonCollection();
16770   for(var i = 0; i < customButtons.length; i++)
16771    if(customButtons[i] == srcElement || ASPx.GetIsParent(customButtons[i], srcElement))
16772     return;
16773  }
16774  ASPxClientEdit.prototype.ForceRefocusEditor.call(this, evt, isNativeFocus);
16775  if(this.GetInputElement().type == "password") {
16776   window.setTimeout(function() { this.GetInputElement().focus(); }.bind(this), 0);
16777  }
16778 },
16779 CorrectAccessibilityButtonFocus: function(sourceElement) {
16780  if(ASPx.Attr.IsExistsAttribute(sourceElement, "tabindex"))
16781   return false;
16782  setTimeout(function() {
16783   var buttonElements = this.GetButtonCollection();
16784   for(var i = 0; i < buttonElements.length; i++)
16785    if(ASPx.GetIsParent(buttonElements[i], sourceElement))
16786     this.GetAccessibilityAnchor(buttonElements[i]).focus();
16787  }.aspxBind(this), 0);
16788  return true;
16789 },
16790 OnKeyDown: function(evt) { 
16791  if(this.NeedEnsureClearButtonVisibilityOnKeyDown()) {
16792   var hasClearButtonOnHover = this.HasClearButton() && this.clearButtonDisplayMode === CLEAR_BUTTON_DISPLAY_MODE.ON_HOVER;
16793   this.recoverClearButtonVisibility = hasClearButtonOnHover && ASPx.Evt.GetKeyCode(evt) == ASPx.Key.Tab && !evt.shiftKey;
16794  }
16795  ASPxClientTextBoxBase.prototype.OnKeyDown.call(this, evt);
16796 },
16797 NeedEnsureClearButtonVisibilityOnKeyDown: function() {
16798  return this.accessibilityCompliant;
16799 },
16800 GetAccessibilityFocusedButtonClassName: function() {
16801  return AccessibilityFocusedButtonClassName;
16802 },
16803 SetButtonVisible: function(number, value) {
16804  var button = this.GetButton(number);
16805  if(!button)
16806   return;
16807  var isAlwaysShownClearButton = number === CLEAR_BUTTON_INDEX && this.clearButtonDisplayMode === CLEAR_BUTTON_DISPLAY_MODE.ALWAYS;
16808  var visibilityModifier = isAlwaysShownClearButton ? setContentVisibility : ASPx.SetElementDisplay;
16809  if(isAlwaysShownClearButton && this.accessibilityCompliant && this.enabled)
16810   this.SetAccessibilityAnchorEnabled(button, value);
16811  visibilityModifier(button, value);
16812 },
16813 GetButtonVisible: function(number) {
16814  var button = this.GetButton(number);
16815  if(number === CLEAR_BUTTON_INDEX && this.clearButtonDisplayMode === CLEAR_BUTTON_DISPLAY_MODE.ALWAYS)
16816   return button && !ASPx.ElementHasCssClass(button, this.GetHideContentCssClassName());
16817  return button && ASPx.IsElementVisible(button);
16818 },
16819 GetHideContentCssClassName: function() {
16820  return HIDE_CONTENT_CSS_CLASS_NAME;
16821 },
16822 ProcessInternalButtonClick: function(buttonIndex) {
16823  return false;
16824 },
16825 OnButtonClick: function(number) {
16826  var processOnServer = this.RaiseButtonClick(number);
16827  if(!this.ProcessInternalButtonClick(number) && processOnServer)
16828   this.SendPostBack('BC:' + number);
16829 },
16830 GetLastSuccesfullValue: function() {
16831  return this.lastChangedValue;
16832 },
16833 OnClear: function() {
16834  this.startUserInputEventTimerIfRequired();
16835  this.ClearEditorValueAndForceOnChange();
16836  this.ForceRefocusEditor(null, true);
16837  window.setTimeout(this.EnsureClearButtonVisibility.aspxBind(this), 0);
16838 },
16839 ClearEditorValueAndForceOnChange: function() {
16840  if(this.GetReadOnly() || !this.GetButtonVisible(CLEAR_BUTTON_INDEX))
16841   return;
16842  var raiseOnChange = this.ClearEditorValueByClearButton();
16843  if(raiseOnChange)
16844   this.ForceStandardOnChange();
16845 },
16846 ClearEditorValueByClearButton: function() {
16847  var prevValue = this.GetLastSuccesfullValue();
16848  this.ClearEditorValueByClearButtonCore();
16849  return prevValue !== this.GetValue();
16850 },
16851 ClearEditorValueByClearButtonCore: function() {
16852  this.Clear();
16853  this.GetInputElement().value = '';
16854 },
16855 ForceStandardOnChange: function() {
16856  this.forceValueChanged = true;
16857  this.RaiseStandardOnChange();
16858  this.forceValueChanged = false;
16859 },
16860 IsValueChangeForced: function() {
16861  return this.forceValueChanged || ASPxClientTextBoxBase.prototype.IsValueChangeForced.call(this);
16862 },
16863 IsValueChanging: function() { return this.isValueChanging; },
16864 StartValueChanging: function() { this.isValueChanging = true; },
16865 EndValueChanging: function() { this.isValueChanging = false; },
16866 IsClearButtonElement: function(element) {
16867  return ASPx.GetIsParent(this.GetClearButton(), element);
16868 },
16869 OnFocusCore: function() {
16870  ASPxClientTextBoxBase.prototype.OnFocusCore.call(this);
16871  this.EnsureClearButtonVisibility();
16872 },
16873 OnLostFocusCore: function() {
16874  ASPxClientTextBoxBase.prototype.OnLostFocusCore.call(this);
16875  this.EnsureClearButtonVisibility();
16876  this.recoverClearButtonVisibility = false;
16877 },
16878 GetClearButton: function() {
16879  return this.GetButton(CLEAR_BUTTON_INDEX);
16880 },
16881 HasClearButton: function() {
16882  return !!this.GetClearButton();
16883 },
16884 RequireShowClearButton: function() {
16885  return !this.IsClearButtonDisabled() && !this.IsClearButtonNotRequired() && this.RequireShowClearButtonInternal();
16886 },
16887 IsClearButtonDisabled: function() {
16888  return !this.clientEnabled || !this.HasClearButton() || this.clearButtonDisplayMode === CLEAR_BUTTON_DISPLAY_MODE.NEVER;
16889 },
16890 IsClearButtonNotRequired: function() {
16891  return !this.IsFocused() && !this.isMouseOver && this.clearButtonDisplayMode !== CLEAR_BUTTON_DISPLAY_MODE.ALWAYS && !this.recoverClearButtonVisibility;
16892 },
16893 RequireShowClearButtonInternal: function () {
16894  return this.IsFocused() && this.RequireShowClearButtonCore() || !this.IsNullState();
16895 },
16896 RequireShowClearButtonCore: function() {
16897  var inputText = this.GetInputElement().value;
16898  return inputText !== this.GetEmptyValueDisplayText();
16899 },
16900 IsFocused: function() {
16901  return this === ASPx.GetFocusedEditor();
16902 },
16903 IsNullState: function() {
16904  var value = this.GetValue();
16905  return this.IsNull(value) || value === this.GetEmptyValueDisplayText();
16906 },
16907 GetEmptyValueDisplayText: function() { 
16908  return this.maskInfo ? this.emptyValueMaskDisplayText : "";
16909 },
16910 EnsureClearButtonVisibility: function() {
16911  this.SetButtonVisible(CLEAR_BUTTON_INDEX, this.RequireShowClearButton());
16912 },
16913 OnMouseOver: function() {
16914  this.isMouseOver = true;
16915  this.EnsureClearButtonVisibility();
16916 },
16917 OnMouseOut: function() {
16918  this.isMouseOver = false;
16919  this.EnsureClearButtonVisibility();
16920 },
16921 OnKeyPress: function(evt) {
16922  if(this.allowUserInput)
16923   ASPxClientTextBoxBase.prototype.OnKeyPress.call(this, evt);
16924 },
16925 OnKeyEventEnd: function(evt, withDelay) {
16926  ASPxClientTextBoxBase.prototype.OnKeyEventEnd.call(this, evt, withDelay);
16927  this.EnsureClearButtonVisibility();
16928 },
16929 RaiseButtonClick: function(number){
16930  var processOnServer = this.autoPostBack || this.IsServerEventAssigned("ButtonClick");
16931  if(!this.ButtonClick.IsEmpty()){
16932   var args = new ASPxClientButtonEditClickEventArgs(processOnServer, number);
16933   this.ButtonClick.FireEvent(this, args);
16934   processOnServer = args.processOnServer;
16935  }
16936  return processOnServer;
16937 },
16938 ChangeEnabledAttributes: function(enabled){
16939  ASPxClientTextEdit.prototype.ChangeEnabledAttributes.call(this, enabled);
16940  for(var i = 0; i < this.buttonCount; i++){
16941   var element = this.GetButton(i);
16942   if(element)
16943    this.ChangeButtonEnabledAttributes(element, this.GetChangeButtonEnabledAttributesMethod(enabled));
16944  }
16945  if(this.accessibilityCompliant)
16946   this.ChangeAccessibilityButtonEnabledAttributes(enabled);
16947 },
16948 ChangeEnabledStateItems: function(enabled){
16949  ASPxClientTextEdit.prototype.ChangeEnabledStateItems.call(this, enabled);
16950  for(var i = 0; i < this.buttonCount; i++){
16951   var element = this.GetButton(i);
16952   if(element) 
16953    ASPx.GetStateController().SetElementEnabled(element, enabled);
16954  }
16955 },
16956 GetChangeButtonEnabledAttributesMethod: function(enabled) {
16957  return ASPx.Attr.ChangeAttributesMethod(enabled);
16958 },
16959 ChangeButtonEnabledAttributes: function(element, method){
16960  method(element, "onclick");
16961  method(element, "ondblclick");
16962  if(ASPx.Browser.Edge)
16963   method(element, "onmousedown");
16964  method(element, "on" + ASPx.TouchUIHelper.touchMouseDownEventName);
16965  method(element, "on" + ASPx.TouchUIHelper.touchMouseUpEventName);
16966 },
16967 ChangeInputEnabled: function(element, enabled, readOnly) {
16968  ASPxClientTextEdit.prototype.ChangeInputEnabled.call(this, element, enabled, readOnly || !this.allowUserInput);
16969 },
16970 ChangeAccessibilityButtonEnabledAttributes: function(enabled) {
16971  var buttonElements = this.GetButtonCollection();
16972  for(var i = 0; i < buttonElements.length; i++)
16973   this.SetAccessibilityAnchorEnabled(buttonElements[i], enabled);
16974 },
16975 SetValue: function(value) {
16976  ASPxClientTextEdit.prototype.SetValue.call(this, value);
16977  if(!this.IsFocused())
16978   this.EnsureClearButtonVisibility();
16979 },
16980 OnAssociatedLabelClick: function(focusableElement) {
16981  var isValidElement = focusableElement && ASPx.IsActionElement(focusableElement) && ASPx.GetIsParent(this.GetMainElement(), focusableElement) && ASPx.IsElementVisible(focusableElement);
16982  if(isValidElement)
16983   focusableElement.focus();
16984  else
16985   this.SetFocus();
16986 }
16987});
16988var ASPxClientButtonEdit = ASPx.CreateClass(ASPxClientButtonEditBase, {
16989});
16990ASPxClientButtonEdit.Cast = ASPxClientControl.Cast;
16991var ASPxClientButtonEditClickEventArgs = ASPx.CreateClass(ASPxClientProcessingModeEventArgs, {
16992 constructor: function(processOnServer, buttonIndex){
16993  this.constructor.prototype.constructor.call(this, processOnServer);
16994  this.buttonIndex = buttonIndex;
16995 }
16996});
16997var ASPxClientTextEditHelpTextHAlign = {
16998 Left: "Left",
16999 Right: "Right",
17000 Center: "Center"
17001};
17002var ASPxClientTextEditHelpTextVAlign = {
17003 Top: "Top",
17004 Bottom: "Bottom",
17005 Middle: "Middle"
17006};
17007var ASPxClientTextEditHelpTextDisplayMode = {
17008 Inline: "Inline",
17009 Popup: "Popup"
17010};
17011var ASPxClientTextEditHelpTextConsts = {
17012 VERTICAL_ORIENTATION_CLASS_NAME: "dxeVHelpTextSys",
17013 HORIZONTAL_ORIENTATION_CLASS_NAME: "dxeHHelpTextSys"
17014};
17015var ASPxClientTextEditHelpText = ASPx.CreateClass(null, {
17016 constructor: function (editor, helpTextStyle, helpText, position, hAlign, vAlign, margins, animationEnabled, helpTextDisplayMode) {
17017  this.hAlign = hAlign;
17018  this.vAlign = vAlign;
17019  this.animationEnabled = animationEnabled;
17020  this.displayMode = helpTextDisplayMode;
17021  this.editor = editor;
17022  this.editorMainElement = editor.GetMainElement();
17023  this.margins = margins ? { Top: margins[0], Right: margins[1], Bottom: margins[2], Left: margins[3] } : null;
17024  this.defaultMargins = { Top: 10, Right: 10, Bottom: 10, Left: 10 };
17025  this.position = position;
17026  this.helpTextElement = this.createHelpTextElement();
17027  this.setHelpTextZIndex(true);
17028  this.prepareHelpTextElement(helpTextStyle, helpText);
17029 },
17030 getRows: function (table) {
17031  return ASPx.GetChildNodesByTagName(table, "TR");
17032 },
17033 getCells: function (row) {
17034  return ASPx.GetChildNodesByTagName(row, "TD");
17035 },
17036 getCellByIndex: function(row, cellIndex) {
17037  return this.getCells(row)[cellIndex];
17038 },
17039 getCellIndex: function(row, cell) {
17040  var cells = this.getCells(row);
17041  for(var i = 0; i < cells.length; i++) {
17042   if(cells[i] === cell)
17043    return i;
17044  }
17045 },
17046 isHorizontal: function(position) {
17047  return position === ASPx.Position.Left || position === ASPx.Position.Right;
17048 },
17049 isVertical: function (position) {
17050  return position === ASPx.Position.Top || position === ASPx.Position.Bottom;
17051 },
17052 createEmptyCell: function(assignClassName) {
17053  var cell = document.createElement("TD");
17054  if(assignClassName)
17055   cell.className = "dxeFakeEmptyCell";
17056  return cell;
17057 },
17058 addHelpTextCellToExternalTableWithTwoCells: function (captionCell, errorCell, helpTextCell, errorTableBody, tableRows) {
17059  var captionPosition = this.editor.captionPosition;
17060  var errorCellPosition = this.editor.errorCellPosition;
17061  var helpTextRow = this.isVertical(this.position) ? document.createElement("TR") : null;
17062  if(captionPosition === ASPx.Position.Left && this.position === ASPx.Position.Left && this.isHorizontal(errorCellPosition))
17063   captionCell.parentNode.insertBefore(helpTextCell, captionCell.nextSibling);
17064  if(captionPosition === ASPx.Position.Right && this.position === ASPx.Position.Right && this.isHorizontal(errorCellPosition))
17065   captionCell.parentNode.insertBefore(helpTextCell, captionCell);
17066  if(captionPosition === ASPx.Position.Left && this.position === ASPx.Position.Right && this.isHorizontal(errorCellPosition))
17067   tableRows[0].appendChild(helpTextCell);
17068  if(captionPosition === ASPx.Position.Right && this.position === ASPx.Position.Left && this.isHorizontal(errorCellPosition))
17069   tableRows[0].insertBefore(helpTextCell, tableRows[0].childNodes[0]);
17070  if(captionPosition === ASPx.Position.Top && this.position === ASPx.Position.Bottom && this.isVertical(errorCellPosition)) {
17071   helpTextRow.appendChild(helpTextCell);
17072   errorTableBody.appendChild(helpTextRow);
17073  }
17074  if(captionPosition === ASPx.Position.Bottom && this.position === ASPx.Position.Top && this.isVertical(errorCellPosition)) {
17075   helpTextRow.appendChild(helpTextCell);
17076   errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
17077  }
17078  if(captionPosition === ASPx.Position.Top && this.position === ASPx.Position.Top && this.isVertical(errorCellPosition)) {
17079   helpTextRow.appendChild(helpTextCell);
17080   errorTableBody.insertBefore(helpTextRow, captionCell.parentNode.nextSibling);
17081  }
17082  if(captionPosition === ASPx.Position.Bottom && this.position === ASPx.Position.Bottom && this.isVertical(errorCellPosition)) {
17083   helpTextRow.appendChild(helpTextCell);
17084   errorTableBody.insertBefore(helpTextRow, captionCell.parentNode);
17085  }
17086  if(captionPosition === ASPx.Position.Right && this.position === ASPx.Position.Top && this.isVertical(errorCellPosition)) {
17087   helpTextRow.appendChild(helpTextCell);
17088   helpTextRow.appendChild(this.createEmptyCell());
17089   errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
17090  }
17091  if(this.position === ASPx.Position.Bottom) {
17092   if(captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Top || captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Right) {
17093    helpTextRow.appendChild(helpTextCell);
17094    helpTextRow.appendChild(this.createEmptyCell());
17095    errorTableBody.appendChild(helpTextRow);
17096   }
17097  }
17098  if(captionPosition === ASPx.Position.Left && this.position === ASPx.Position.Top && this.isVertical(errorCellPosition)) {
17099   helpTextRow.appendChild(this.createEmptyCell());
17100   helpTextRow.appendChild(helpTextCell);
17101   errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
17102  }
17103  if(captionPosition === ASPx.Position.Left && this.position === ASPx.Position.Bottom && this.isVertical(errorCellPosition)) {
17104   helpTextRow.appendChild(this.createEmptyCell());
17105   helpTextRow.appendChild(helpTextCell);
17106   errorTableBody.appendChild(helpTextRow);
17107  }
17108  if(this.position === ASPx.Position.Right) {
17109   if(captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Left || captionPosition === ASPx.Position.Left && errorCellPosition === ASPx.Position.Top
17110    || captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Right) {
17111    tableRows[1].appendChild(helpTextCell);
17112    tableRows[0].appendChild(this.createEmptyCell());
17113   }
17114   if(captionPosition === ASPx.Position.Left && errorCellPosition === ASPx.Position.Bottom || captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Left) {
17115    tableRows[0].appendChild(helpTextCell);
17116    tableRows[1].appendChild(this.createEmptyCell());
17117   }
17118  }
17119  if(this.position === ASPx.Position.Left) {
17120   if(captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Top || captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Right
17121    || captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Left) {
17122    tableRows[1].insertBefore(helpTextCell, tableRows[1].childNodes[0]);
17123    tableRows[0].insertBefore(this.createEmptyCell(), tableRows[0].childNodes[0]);
17124   }
17125   if(captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Top || captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Bottom) {
17126    tableRows[1].insertBefore(helpTextCell, tableRows[1].childNodes[0]);
17127    tableRows[0].insertBefore(this.createEmptyCell(errorCellPosition === ASPx.Position.Top), tableRows[0].childNodes[0]);
17128    tableRows[2].insertBefore(this.createEmptyCell(errorCellPosition !== ASPx.Position.Top), tableRows[2].childNodes[0]);
17129   }
17130   if(captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Top) {
17131    tableRows[2].insertBefore(helpTextCell, tableRows[2].childNodes[0]);
17132    tableRows[0].insertBefore(this.createEmptyCell(false), tableRows[0].childNodes[0]);
17133    tableRows[1].insertBefore(this.createEmptyCell(true), tableRows[1].childNodes[0]);
17134   }
17135   if(captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Bottom) {
17136    tableRows[0].insertBefore(helpTextCell, tableRows[0].childNodes[0]);
17137    tableRows[1].insertBefore(this.createEmptyCell(true), tableRows[1].childNodes[0]);
17138    tableRows[2].insertBefore(this.createEmptyCell(false), tableRows[2].childNodes[0]);
17139   }
17140   if(captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Left || captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Bottom
17141    || captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Right) {
17142    tableRows[0].insertBefore(helpTextCell, tableRows[0].childNodes[0]);
17143    tableRows[1].insertBefore(this.createEmptyCell(), tableRows[1].childNodes[0]);
17144   }
17145   if(captionPosition === ASPx.Position.Left && this.isVertical(errorCellPosition)) {
17146    captionCell.parentNode.insertBefore(helpTextCell, captionCell.nextSibling);
17147    var emptyCellParentRow = errorCellPosition === ASPx.Position.Top ? tableRows[0] : tableRows[1];
17148    var helpTextCellIndex = this.getCellIndex(helpTextCell.parentNode, helpTextCell);
17149    emptyCellParentRow.insertBefore(this.createEmptyCell(), this.getCellByIndex(emptyCellParentRow, helpTextCellIndex));
17150   }
17151  }
17152  if(this.position === ASPx.Position.Right) {
17153   if(captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Top || captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Bottom) {
17154    tableRows[1].appendChild(helpTextCell);
17155    tableRows[0].appendChild(this.createEmptyCell(errorCellPosition === ASPx.Position.Top));
17156    tableRows[2].appendChild(this.createEmptyCell(errorCellPosition !== ASPx.Position.Top));
17157   }
17158   if(captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Top) {
17159    tableRows[2].appendChild(helpTextCell);
17160    tableRows[0].appendChild(this.createEmptyCell(false));
17161    tableRows[1].appendChild(this.createEmptyCell(true));
17162   }
17163   if(captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Bottom) {
17164    tableRows[0].appendChild(helpTextCell);
17165    tableRows[1].appendChild(this.createEmptyCell(true));
17166    tableRows[2].appendChild(this.createEmptyCell(false));
17167   }
17168   if(captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Right) {
17169    tableRows[0].appendChild(helpTextCell);
17170    tableRows[1].appendChild(this.createEmptyCell());
17171   }
17172   if(captionPosition === ASPx.Position.Right && this.isVertical(errorCellPosition)) {
17173    captionCell.parentNode.insertBefore(helpTextCell, captionCell);
17174    var emptyCellParentRow = errorCellPosition === ASPx.Position.Top ? tableRows[0] : tableRows[1];
17175    var helpTextCellIndex = this.getCellIndex(helpTextCell.parentNode, helpTextCell);
17176    emptyCellParentRow.insertBefore(this.createEmptyCell(), this.getCellByIndex(emptyCellParentRow, helpTextCellIndex));
17177   }
17178  }
17179  if(captionPosition === ASPx.Position.Top && this.position === ASPx.Position.Top && this.isHorizontal(errorCellPosition)) {
17180   if(errorCellPosition === ASPx.Position.Left) {
17181    helpTextRow.appendChild(this.createEmptyCell(true));
17182    helpTextRow.appendChild(helpTextCell);
17183   }
17184   else {
17185    helpTextRow.appendChild(helpTextCell);
17186    helpTextRow.appendChild(this.createEmptyCell());
17187   }
17188   errorTableBody.insertBefore(helpTextRow, captionCell.parentNode.nextSibling);
17189  }
17190  if(captionPosition === ASPx.Position.Bottom && this.position === ASPx.Position.Top && this.isHorizontal(errorCellPosition)) {
17191   if(errorCellPosition === ASPx.Position.Left) {
17192    helpTextRow.appendChild(this.createEmptyCell(true));
17193    helpTextRow.appendChild(helpTextCell);
17194   }
17195   else {
17196    helpTextRow.appendChild(helpTextCell);
17197    helpTextRow.appendChild(this.createEmptyCell());
17198   }
17199   errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
17200  }
17201  if(captionPosition === ASPx.Position.Bottom && this.position === ASPx.Position.Bottom && this.isHorizontal(errorCellPosition)) {
17202   if(errorCellPosition === ASPx.Position.Left) {
17203    helpTextRow.appendChild(this.createEmptyCell(true));
17204    helpTextRow.appendChild(helpTextCell);
17205   }
17206   else {
17207    helpTextRow.appendChild(helpTextCell);
17208    helpTextRow.appendChild(this.createEmptyCell());
17209   }
17210   errorTableBody.insertBefore(helpTextRow, captionCell.parentNode);
17211  }
17212  if(captionPosition === ASPx.Position.Top && this.position === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Left) {
17213   helpTextRow.appendChild(this.createEmptyCell(true));
17214   helpTextRow.appendChild(helpTextCell);
17215   errorTableBody.appendChild(helpTextRow);
17216  }
17217  if(captionPosition === ASPx.Position.Right && this.position === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Bottom) {
17218   helpTextRow.appendChild(helpTextCell);
17219   helpTextRow.appendChild(this.createEmptyCell());
17220   errorTableBody.appendChild(helpTextRow);
17221  }
17222  if(this.position === ASPx.Position.Bottom) {
17223   if(captionPosition === ASPx.Position.Left && errorCellPosition === ASPx.Position.Right || captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Left) {
17224    helpTextRow.appendChild(this.createEmptyCell(errorCellPosition !== ASPx.Position.Right));
17225    helpTextRow.appendChild(helpTextCell);
17226    helpTextRow.appendChild(this.createEmptyCell(errorCellPosition === ASPx.Position.Right));
17227    errorTableBody.appendChild(helpTextRow);
17228   }
17229   if(captionPosition === ASPx.Position.Left && errorCellPosition === ASPx.Position.Left) {
17230    helpTextRow.appendChild(this.createEmptyCell(false));
17231    helpTextRow.appendChild(this.createEmptyCell(true));
17232    helpTextRow.appendChild(helpTextCell);
17233    errorTableBody.appendChild(helpTextRow);
17234   }
17235   if(captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Right) {
17236    helpTextRow.appendChild(helpTextCell);
17237    helpTextRow.appendChild(this.createEmptyCell(true));
17238    helpTextRow.appendChild(this.createEmptyCell(false));
17239    errorTableBody.appendChild(helpTextRow);
17240   }   
17241  }
17242  if(this.position === ASPx.Position.Top) {
17243   if(captionPosition === ASPx.Position.Left && errorCellPosition === ASPx.Position.Right || captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Left) {
17244    helpTextRow.appendChild(this.createEmptyCell(errorCellPosition !== ASPx.Position.Right));
17245    helpTextRow.appendChild(helpTextCell);
17246    helpTextRow.appendChild(this.createEmptyCell(errorCellPosition === ASPx.Position.Right));
17247    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
17248   }
17249   if(captionPosition === ASPx.Position.Left && errorCellPosition === ASPx.Position.Left) {
17250    helpTextRow.appendChild(this.createEmptyCell(false));
17251    helpTextRow.appendChild(this.createEmptyCell(true));
17252    helpTextRow.appendChild(helpTextCell);
17253    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
17254   }
17255   if(captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Right) {
17256    helpTextRow.appendChild(helpTextCell);
17257    helpTextRow.appendChild(this.createEmptyCell(true));
17258    helpTextRow.appendChild(this.createEmptyCell(false));
17259    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
17260   }
17261  }
17262 },
17263 addHelpTextCellToExternalTableWithErrorCell: function (errorCell, helpTextCell, errorTableBody, tableRows) {
17264  var errorCellPosition = this.editor.errorCellPosition;
17265  var helpTextRow = document.createElement("TR");
17266  if(this.position === ASPx.Position.Left && this.isHorizontal(errorCellPosition))
17267   tableRows[0].insertBefore(helpTextCell, tableRows[0].childNodes[0]);
17268  if(this.position === ASPx.Position.Right && this.isHorizontal(errorCellPosition))
17269   tableRows[0].appendChild(helpTextCell);
17270  if(this.position === ASPx.Position.Top && this.isVertical(errorCellPosition)) {
17271   helpTextRow.appendChild(helpTextCell);
17272   
17272errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
17273  }
17274  if(this.position === ASPx.Position.Bottom && this.isVertical(errorCellPosition)) {
17275   helpTextRow.appendChild(helpTextCell);
17276   errorTableBody.appendChild(helpTextRow);
17277  }
17278  if(errorCellPosition === ASPx.Position.Left && this.isVertical(this.position)) {
17279   helpTextRow.appendChild(this.createEmptyCell(true));
17280   helpTextRow.appendChild(helpTextCell);
17281   if(this.position === ASPx.Position.Top)
17282    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
17283   else
17284    errorTableBody.appendChild(helpTextRow);
17285  }
17286  if(errorCellPosition === ASPx.Position.Right && this.isVertical(this.position)) {
17287   helpTextRow.appendChild(helpTextCell);
17288   helpTextRow.appendChild(this.createEmptyCell(true));
17289   if(this.position === ASPx.Position.Top)
17290    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
17291   else
17292    errorTableBody.appendChild(helpTextRow);
17293  }
17294  if(this.position === ASPx.Position.Left && this.isVertical(errorCellPosition)) {
17295   var helpTextParentRowIndex = errorCellPosition === ASPx.Position.Top ? 1 : 0;
17296   var emptyCellRowIndex = helpTextParentRowIndex === 0 ? 1 : 0;
17297   tableRows[helpTextParentRowIndex].insertBefore(helpTextCell, tableRows[helpTextParentRowIndex].childNodes[0]);
17298   tableRows[emptyCellRowIndex].insertBefore(this.createEmptyCell(true), tableRows[emptyCellRowIndex].childNodes[0]);
17299  }
17300  if(this.position === ASPx.Position.Right && this.isVertical(errorCellPosition)) {
17301   var helpTextParentRowIndex = errorCellPosition === ASPx.Position.Top ? 1 : 0;
17302   var emptyCellRowIndex = helpTextParentRowIndex === 0 ? 1 : 0;
17303   tableRows[helpTextParentRowIndex].appendChild(helpTextCell);
17304   tableRows[emptyCellRowIndex].appendChild(this.createEmptyCell(true));
17305  }
17306 },
17307 addHelpTextCellToExternalTableWithCaption: function (captionCell, helpTextCell, errorTableBody, tableRows) {
17308  var captionPosition = this.editor.captionPosition;
17309  var helpTextRow = document.createElement("TR");
17310  if(captionPosition === ASPx.Position.Left && this.isVertical(this.position)) {
17311   helpTextRow.appendChild(this.createEmptyCell());
17312   helpTextRow.appendChild(helpTextCell);
17313   if(this.position === ASPx.Position.Top)
17314    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
17315   else
17316    errorTableBody.appendChild(helpTextRow);
17317  }
17318  if(this.position === ASPx.Position.Left && this.isVertical(captionPosition)) {
17319   var helpTextParentRowIndex = captionPosition === ASPx.Position.Top ? 1 : 0;
17320   var emptyCellParentRowIndex = helpTextParentRowIndex === 0 ? 1 : 0;
17321   tableRows[helpTextParentRowIndex].insertBefore(helpTextCell, tableRows[helpTextParentRowIndex].childNodes[0]);
17322   tableRows[emptyCellParentRowIndex].insertBefore(this.createEmptyCell(), tableRows[emptyCellParentRowIndex].childNodes[0]);
17323  }
17324  if(this.position === ASPx.Position.Right && this.isVertical(captionPosition)) {
17325   var helpTextParentRowIndex = captionPosition === ASPx.Position.Top ? 1 : 0;
17326   var emptyCellParentRowIndex = helpTextParentRowIndex === 0 ? 1 : 0;
17327   tableRows[helpTextParentRowIndex].appendChild(helpTextCell);
17328   tableRows[emptyCellParentRowIndex].appendChild(this.createEmptyCell());
17329  }
17330  if(captionPosition === ASPx.Position.Right && this.isVertical(this.position)) {
17331   helpTextRow.appendChild(helpTextCell);
17332   helpTextRow.appendChild(this.createEmptyCell());
17333   if(this.position === ASPx.Position.Top)
17334    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
17335   else
17336    errorTableBody.appendChild(helpTextRow);
17337  }
17338  if(this.isVertical(captionPosition) && this.isVertical(this.position)) {
17339   helpTextRow.appendChild(helpTextCell);
17340   if(captionPosition === ASPx.Position.Top && this.position === ASPx.Position.Top)
17341    errorTableBody.insertBefore(helpTextRow, captionCell.parentNode.nextSibling);
17342   if(captionPosition === ASPx.Position.Top && this.position === ASPx.Position.Bottom)
17343    errorTableBody.appendChild(helpTextRow);
17344   if(captionPosition === ASPx.Position.Bottom && this.position === ASPx.Position.Top)
17345    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
17346   if(captionPosition === ASPx.Position.Bottom && this.position === ASPx.Position.Bottom)
17347    errorTableBody.insertBefore(helpTextRow, captionCell.parentNode);
17348  }
17349  if(captionPosition === ASPx.Position.Left && this.position === ASPx.Position.Left)
17350   captionCell.parentNode.insertBefore(helpTextCell, captionCell.nextSibling);
17351  if(captionPosition === ASPx.Position.Right && this.position === ASPx.Position.Right)
17352   captionCell.parentNode.insertBefore(helpTextCell, captionCell);
17353  if(captionPosition === ASPx.Position.Left && this.position === ASPx.Position.Right)
17354   tableRows[0].appendChild(helpTextCell);
17355  if(captionPosition === ASPx.Position.Right && this.position === ASPx.Position.Left)
17356   tableRows[0].insertBefore(helpTextCell, tableRows[0].childNodes[0]);
17357 },
17358 addHelpTextCellToExternalTableWithEditorOnly: function (helpTextCell, errorTableBody, tableRows) {
17359  if(this.isHorizontal(this.position)) {
17360   if(this.position === ASPx.Position.Left)
17361    tableRows[0].insertBefore(helpTextCell, tableRows[0].childNodes[0]);
17362   else
17363    tableRows[0].appendChild(helpTextCell);
17364  }
17365  else {
17366   var helpTextRow = document.createElement("TR");
17367   helpTextRow.appendChild(helpTextCell);
17368   if(this.position === ASPx.Position.Top)
17369    errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]);
17370   else
17371    errorTableBody.appendChild(helpTextRow);
17372  }
17373 },
17374 addHelpTextCellToExternalTable: function (errorTable, helpTextCell) {
17375  var errorTableBody = ASPx.GetNodeByTagName(errorTable, "TBODY", 0);
17376  var tableRows = this.getRows(errorTableBody);
17377  var captionCell = this.editor.GetCaptionCell();
17378  var errorCell = this.editor.GetErrorCell();
17379  if(captionCell) {
17380   if(errorCell)
17381    this.addHelpTextCellToExternalTableWithTwoCells(captionCell, errorCell, helpTextCell, errorTableBody, tableRows);
17382   else
17383    this.addHelpTextCellToExternalTableWithCaption(captionCell, helpTextCell, errorTableBody, tableRows);
17384  }
17385  else if(errorCell)
17386   this.addHelpTextCellToExternalTableWithErrorCell(errorCell, helpTextCell, errorTableBody, tableRows);
17387  else
17388   this.addHelpTextCellToExternalTableWithEditorOnly(helpTextCell, errorTableBody, tableRows);
17389 },
17390 createExternalTable: function () {
17391  var externalTable = document.createElement("TABLE");
17392  externalTable.id = this.editor.name + ASPx.EditElementSuffix.ExternalTable;
17393  externalTable.cellPadding = 0;
17394  externalTable.cellSpacing = 0;
17395  this.applyExternalTableStyle(externalTable);
17396  var editorWidth = this.editorMainElement.style.width;
17397  if(ASPx.IsPercentageSize(editorWidth)) {
17398   externalTable.style.width = editorWidth;
17399   this.editorMainElement.style.width = "100%";
17400   this.editor.width = "100%";
17401  }
17402  var externalTableBody = document.createElement("TBODY");
17403  var externalTableRow = document.createElement("TR");
17404  var externalTableCell = document.createElement("TD");
17405  externalTable.appendChild(externalTableBody);
17406  externalTableBody.appendChild(externalTableRow);
17407  externalTableRow.appendChild(externalTableCell);
17408  this.editorMainElement.parentNode.appendChild(externalTable);
17409  ASPx.ChangeElementContainer(this.editorMainElement, externalTableCell, true);
17410  if(this.editor.accessibilityCompliant)
17411   ASPx.Attr.SetAttribute(externalTable, "role", "presentation");
17412  return externalTable;
17413 },
17414 applyExternalTableStyle: function (externalTable) {
17415  var externalTableStyle = this.editor.externalTableStyle;
17416  if(externalTableStyle.length > 0) {
17417   this.applyStyleToElement(externalTable, externalTableStyle);
17418  }
17419 },
17420 applyStyleToElement: function(element, style) {
17421  element.className = style[0];
17422  if(style[1]) {
17423   var styleSheet = ASPx.GetCurrentStyleSheet();
17424   element.className += " " + ASPx.CreateImportantStyleRule(styleSheet, style[1]);
17425  }
17426 },
17427 createInlineHelpTextElement: function () {
17428  var helpTextElement = document.createElement("TD");
17429  var externalTable = this.editor.GetExternalTable();
17430  if(!externalTable)
17431   externalTable = this.createExternalTable();
17432  this.addHelpTextCellToExternalTable(externalTable, helpTextElement);
17433  return helpTextElement;
17434 },
17435 createPopupHelpTextElement: function () {
17436  var helpTextElement = document.createElement("DIV");
17437  ASPx.InsertElementAfter(helpTextElement, this.editor.GetMainElement());
17438  ASPx.AnimationHelper.setOpacity(helpTextElement, 0);
17439  ASPx.SetElementDisplay(helpTextElement, false);
17440  return helpTextElement;
17441 },
17442 createHelpTextElement: function () {
17443  return this.displayMode === ASPxClientTextEditHelpTextDisplayMode.Popup ?
17444   this.createPopupHelpTextElement() : this.createInlineHelpTextElement();
17445 },
17446 prepareHelpTextElement: function (helpTextStyle, helpText) {
17447  this.helpTextElement.id = this.getHelpTextElementId();
17448  this.applyStyleToElement(this.helpTextElement, helpTextStyle);
17449  ASPx.SetInnerHtml(this.helpTextElement, "<SPAN>" + helpText + "</SPAN>");
17450  if(this.displayMode === ASPxClientTextEditHelpTextDisplayMode.Popup)
17451   this.updatePopupHelpTextPosition();
17452  else {
17453   var isVerticalOrientation = this.position === ASPx.Position.Top || this.position === ASPx.Position.Bottom;
17454   var orientationClassName = isVerticalOrientation ? ASPxClientTextEditHelpTextConsts.VERTICAL_ORIENTATION_CLASS_NAME :
17455    ASPxClientTextEditHelpTextConsts.HORIZONTAL_ORIENTATION_CLASS_NAME;
17456   this.helpTextElement.className += " " + orientationClassName;
17457   this.setInlineHelpTextElementAlign();
17458   ASPx.SetElementDisplay(this.helpTextElement, this.editor.clientVisible);
17459  }
17460 },
17461 getHelpTextElementId: function() {
17462  return this.editor.name + ASPx.TEHelpTextElementSuffix;
17463 },
17464 setInlineHelpTextElementAlign: function() {
17465  var hAlignValue = "", vAlignValue = "";
17466  switch(this.hAlign) {
17467   case ASPxClientTextEditHelpTextHAlign.Left: hAlignValue = "left"; break;
17468   case ASPxClientTextEditHelpTextHAlign.Right: hAlignValue = "right"; break;
17469   case ASPxClientTextEditHelpTextHAlign.Center: hAlignValue = "center"; break;
17470  }
17471  switch(this.vAlign) {
17472   case ASPxClientTextEditHelpTextVAlign.Top: vAlignValue = "top"; break;
17473   case ASPxClientTextEditHelpTextVAlign.Bottom: vAlignValue = "bottom"; break;
17474   case ASPxClientTextEditHelpTextVAlign.Middle: vAlignValue = "middle"; break;
17475  }
17476  this.helpTextElement.style.textAlign = hAlignValue;
17477  this.helpTextElement.style.verticalAlign = vAlignValue;
17478 },
17479 getHelpTextMargins: function() {
17480  if(this.margins)
17481   return this.margins;
17482  var result = this.defaultMargins;
17483  if(this.position === ASPx.Position.Top || this.position === ASPx.Position.Bottom)
17484   result.Left = result.Right = 0;
17485  else
17486   result.Top = result.Bottom = 0;
17487  return result;
17488 },
17489 updatePopupHelpTextPosition: function (editorMainElement) {
17490  var editorWidth = this.editorMainElement.offsetWidth;
17491  var editorHeight = this.editorMainElement.offsetHeight;
17492  var helpTextWidth = this.helpTextElement.offsetWidth;
17493  var helpTextHeight = this.helpTextElement.offsetHeight;
17494  var editorX = ASPx.GetAbsoluteX(this.editorMainElement);
17495  var editorY = ASPx.GetAbsoluteY(this.editorMainElement);
17496  var helpTextX = 0, helpTextY = 0;
17497  var margins = this.getHelpTextMargins();
17498  if(this.position === ASPx.Position.Top || this.position === ASPx.Position.Bottom) {
17499   if(this.position === ASPx.Position.Top)
17500    helpTextY = editorY - margins.Bottom - helpTextHeight;
17501   else if(this.position === ASPx.Position.Bottom)
17502    helpTextY = editorY + editorHeight + margins.Top;
17503   if(this.hAlign === ASPxClientTextEditHelpTextHAlign.Left)
17504    helpTextX = editorX + margins.Left;
17505   else if(this.hAlign === ASPxClientTextEditHelpTextHAlign.Right)
17506    helpTextX = editorX + editorWidth - helpTextWidth - margins.Right;
17507   else if(this.hAlign === ASPxClientTextEditHelpTextHAlign.Center) {
17508    var editorCenterX = editorX + editorWidth / 2;
17509    var helpTextWidthWithMargins = helpTextWidth + margins.Left + margins.Right;
17510    helpTextX = editorCenterX - helpTextWidthWithMargins / 2 + margins.Left;
17511   }
17512  } else {
17513   if(this.position === ASPx.Position.Left)
17514    helpTextX = editorX - margins.Right - helpTextWidth;
17515   else if(this.position === ASPx.Position.Right)
17516    helpTextX = editorX + editorWidth + margins.Left;
17517   if(this.vAlign === ASPxClientTextEditHelpTextVAlign.Top)
17518    helpTextY = editorY + margins.Top;
17519   else if(this.vAlign === ASPxClientTextEditHelpTextVAlign.Bottom)
17520    helpTextY = editorY + editorHeight - helpTextHeight - margins.Bottom;
17521   else if(this.vAlign === ASPxClientTextEditHelpTextVAlign.Middle) {
17522    var editorCenterY = editorY + editorHeight / 2;
17523    var helpTextHeightWithMargins = helpTextHeight + margins.Top + margins.Bottom;
17524    helpTextY = editorCenterY - helpTextHeightWithMargins / 2 + margins.Top;
17525   }
17526  }
17527  helpTextX = helpTextX < 0 ? 0 : helpTextX;
17528  helpTextY = helpTextY < 0 ? 0 : helpTextY;
17529  ASPx.SetAbsoluteX(this.helpTextElement, helpTextX);
17530  ASPx.SetAbsoluteY(this.helpTextElement, helpTextY);
17531 },
17532 setHelpTextZIndex: function (hide) { 
17533  var newZIndex = 41998 * (hide ? -1 : 1);
17534  if(this.helpTextElement.style.zIndex != newZIndex)
17535   this.helpTextElement.style.zIndex = newZIndex;
17536 },
17537 hide: function () {
17538  if(this.displayMode === ASPxClientTextEditHelpTextDisplayMode.Inline) {
17539   ASPx.SetElementDisplay(this.helpTextElement, false);
17540  }
17541  else
17542   this.hidePopupHelpText();
17543 },
17544 hidePopupHelpText: function() {
17545  var onHidePopupHelpTextComplete = function () {
17546   this.setHelpTextZIndex(true);
17547   ASPx.SetElementDisplay(this.helpTextElement, false);
17548  }.aspxBind(this);
17549  if(this.animationEnabled)
17550   ASPx.AnimationHelper.fadeOut(this.helpTextElement, onHidePopupHelpTextComplete);
17551  else {
17552   ASPx.AnimationHelper.setOpacity(this.helpTextElement, 0);
17553   onHidePopupHelpTextComplete();
17554  }    
17555 },
17556 show: function () {
17557  if(this.displayMode === ASPxClientTextEditHelpTextDisplayMode.Inline) {
17558   ASPx.SetElementDisplay(this.helpTextElement, true);
17559  }
17560  else
17561   this.showPopupHelpText();
17562 },
17563 showPopupHelpText: function () {
17564  ASPx.SetElementDisplay(this.helpTextElement, true);
17565  this.updatePopupHelpTextPosition();
17566  if(this.animationEnabled)
17567   ASPx.AnimationHelper.fadeIn(this.helpTextElement);
17568  else
17569   ASPx.AnimationHelper.setOpacity(this.helpTextElement, 1);
17570  this.setHelpTextZIndex(false);
17571 }
17572});
17573var ASPxOutOfRangeWarningManager = ASPx.CreateClass(null, {
17574 constructor: function (editor, minValue, maxValue, defaultMinValue, defaultMaxValue, outOfRangeWarningElementPosition, valueFormatter) {
17575  this.editor = editor;
17576  this.outOfRangeWarningElementPosition = outOfRangeWarningElementPosition;
17577  this.minValue = minValue;
17578  this.maxValue = maxValue;
17579  this.defaultMinValue = defaultMinValue;
17580  this.defaultMaxValue = defaultMaxValue;
17581  this.minMaxValueFormatter = valueFormatter;
17582  this.animationDuration = 150;
17583  this.CreateOutOfRangeWarningElement();
17584 },
17585 SetMinValue: function (minValue) {
17586  this.minValue = minValue;
17587  this.UpdateOutOfRangeWarningElementText();
17588 },
17589 SetMaxValue: function (maxValue) {
17590  this.maxValue = maxValue;
17591  this.UpdateOutOfRangeWarningElementText();
17592 },
17593 CreateOutOfRangeWarningElement: function () {
17594  this.outOfRangeWarningElement = document.createElement("DIV");
17595  this.outOfRangeWarningElement.id = this.editor.name + "OutOfRWarn";
17596  ASPx.InsertElementAfter(this.outOfRangeWarningElement, this.editor.GetOutOfRangeWarningElementPrevSibling());
17597  ASPx.AnimationHelper.setOpacity(this.outOfRangeWarningElement, 0);
17598  this.outOfRangeWarningElement.className = this.editor.outOfRangeWarningClassName;
17599  this.UpdateOutOfRangeWarningElementText();
17600 },
17601 IsValueInRange: function (value) {
17602  return (!this.IsMinValueExists() || value >= this.minValue)
17603   && (!this.IsMaxValueExists() || value <= this.maxValue);
17604 },
17605 IsMinValueExists: function() {
17606  return ASPx.IsExists(this.minValue) && !isNaN(this.minValue) && this.minValue !== this.defaultMinValue;
17607 },
17608 IsMaxValueExists: function () {
17609  return ASPx.IsExists(this.maxValue) && !isNaN(this.maxValue) && this.maxValue !== this.defaultMaxValue;
17610 },
17611 GetFormattedTextByValue: function(value) {
17612  if (this.minMaxValueFormatter)
17613   return this.minMaxValueFormatter.Format(value);
17614  return value;
17615 },
17616 GetWarningText: function() {
17617  var textTemplate = arguments[0];
17618  var valueTexts = [];
17619  for (var i = 1; i < arguments.length; i++) {
17620   var valueText = this.GetFormattedTextByValue(arguments[i]);
17621   valueTexts.push(valueText);
17622  }
17623  return ASPx.Formatter.Format(textTemplate, valueTexts);
17624 },
17625 UpdateOutOfRangeWarningElementText: function () {
17626  var text = "";
17627  if (this.IsMinValueExists() && this.IsMaxValueExists())
17628   text = this.GetWarningText(this.editor.outOfRangeWarningMessages[0], this.minValue, this.maxValue);
17629  if (this.IsMinValueExists() && !this.IsMaxValueExists())
17630   text = this.GetWarningText(this.editor.outOfRangeWarningMessages[1], this.minValue);
17631  if (!this.IsMinValueExists() && this.IsMaxValueExists())
17632   text = this.GetWarningText(this.editor.outOfRangeWarningMessages[2], this.maxValue);
17633  ASPx.SetInnerHtml(this.outOfRangeWarningElement, "<LABEL>" + text + "</LABEL>");
17634 },
17635 UpdateOutOfRangeWarningElementVisibility: function (currentValue) {
17636  var isValidValue = currentValue == null || this.IsValueInRange(currentValue);
17637  if (!isValidValue && !this.outOfRangeWarningElementShown)
17638   this.ShowOutOfRangeWarningElement();
17639  if (isValidValue && this.outOfRangeWarningElementShown)
17640   this.HideOutOfRangeWarningElement();
17641 },
17642 GetOutOfRangeWarningElementCoordinates: function() {
17643  var editorMainElement = this.editor.GetMainElement();
17644  var editorWidth = editorMainElement.offsetWidth;
17645  var editorHeight = editorMainElement.offsetHeight;
17646  var editorX = ASPx.GetAbsoluteX(editorMainElement);
17647  var editorY = ASPx.GetAbsoluteY(editorMainElement);
17648  var outOfRangeWarningElementX = this.outOfRangeWarningElementPosition === ASPx.Position.Right ? editorX + editorWidth : editorX;
17649  var outOfRangeWarningElementY = this.outOfRangeWarningElementPosition === ASPx.Position.Right ? editorY : editorY + editorHeight;
17650  outOfRangeWarningElementX = outOfRangeWarningElementX < 0 ? 0 : outOfRangeWarningElementX;
17651  outOfRangeWarningElementY = outOfRangeWarningElementY < 0 ? 0 : outOfRangeWarningElementY;
17652  return {
17653   x: outOfRangeWarningElementX,
17654   y: outOfRangeWarningElementY
17655  };
17656 },
17657 ShowOutOfRangeWarningElement: function () {
17658  this.outOfRangeWarningElement.style.display = "inline";
17659  var outOfRangeWarningElementCoordinates = this.GetOutOfRangeWarningElementCoordinates();
17660  ASPx.SetAbsoluteX(this.outOfRangeWarningElement, outOfRangeWarningElementCoordinates.x);
17661  ASPx.SetAbsoluteY(this.outOfRangeWarningElement, outOfRangeWarningElementCoordinates.y);
17662  ASPx.AnimationHelper.fadeIn(this.outOfRangeWarningElement, null, this.animationDuration);
17663  this.ScrollToWarningElementIfRequired(outOfRangeWarningElementCoordinates);
17664  this.outOfRangeWarningElementShown = true;
17665 },
17666 HideOutOfRangeWarningElement: function () {
17667  ASPx.AnimationHelper.fadeOut(this.outOfRangeWarningElement, function () {
17668   ASPx.SetElementDisplay(this.outOfRangeWarningElement, false);
17669  }.aspxBind(this), this.animationDuration);
17670  this.outOfRangeWarningElementShown = false;
17671 },
17672 ScrollToWarningElementIfRequired: function (outOfRangeWarningElementCoordinates) {
17673  if(this.outOfRangeWarningElementPosition === ASPx.Position.Right) {
17674   var warnElementRightPos = outOfRangeWarningElementCoordinates.x
17675    + ASPx.PxToInt(ASPx.GetCurrentStyle(this.outOfRangeWarningElement).marginLeft)
17676    + this.outOfRangeWarningElement.offsetWidth;
17677   if(warnElementRightPos > ASPx.GetDocumentClientWidth() + ASPx.GetDocumentScrollLeft())
17678    ASPx.SetDocumentScrollLeft(warnElementRightPos - ASPx.GetDocumentClientWidth());
17679  }
17680  if(this.outOfRangeWarningElementPosition === ASPx.Position.Bottom) {
17681   var warnElementBottomPos = outOfRangeWarningElementCoordinates.y
17682    + ASPx.PxToInt(ASPx.GetCurrentStyle(this.outOfRangeWarningElement).marginTop)
17683    + this.outOfRangeWarningElement.offsetHeight;
17684   if(warnElementBottomPos > ASPx.GetDocumentClientHeight() + ASPx.GetDocumentScrollTop())
17685    ASPx.SetDocumentScrollTop(warnElementBottomPos - ASPx.GetDocumentClientHeight());
17686  }
17687 }
17688});
17689ASPx.MMMouseOut = function(name, evt) {
17690 var edit = ASPx.GetControlCollection().Get(name);
17691 if(edit != null) edit.OnMouseOut(evt);
17692};
17693ASPx.MMMouseOver = function(name, evt) {
17694 var edit = ASPx.GetControlCollection().Get(name);
17695 if(edit != null) edit.OnMouseOver(evt);
17696};
17697ASPx.MaskHintTimerProc = function() {
17698 var focusedEditor = ASPx.GetFocusedEditor();
17699 if(focusedEditor != null && ASPx.IsFunction(focusedEditor.MaskHintTimerProc))
17700  focusedEditor.MaskHintTimerProc();
17701};
17702ASPx.ETextChanged = function(name) {
17703 var edit = ASPx.GetControlCollection().Get(name);
17704 if(edit != null) edit.OnTextChanged(); 
17705};
17706ASPx.BEClick = function(name,number){
17707 var edit = ASPx.GetControlCollection().Get(name);
17708 if(edit != null) edit.OnButtonClick(number);
17709};
17710ASPx.BEClear = function(name, evt) {
17711 var edit = ASPx.GetControlCollection().Get(name);
17712 if(edit && (evt.button === 0 || ASPx.Browser.TouchUI)) {
17713  var requireFocus = !ASPx.Browser.VirtualKeyboardSupported || ASPx.Browser.MSTouchUI;
17714  (function performOnClean() {
17715   if(edit.ownerListBox)
17716    edit.ownerListBox.ForceLockFocusEvents();
17717   if(requireFocus && !edit.IsFocused())
17718    edit.GetInputElement().focus();
17719   if(edit.IsFocused() || !requireFocus) {
17720    if(edit.ownerListBox)
17721     edit.ownerListBox.UnlockFocusEvents();
17722    edit.OnClear();
17723   }
17724   else
17725    window.setTimeout(performOnClean, 100);
17726  })();
17727 }
17728};
17729ASPx.SetFocusToTextEditWithDelay = function(name) {
17730 window.setTimeout(function() {
17731  var edit = ASPx.GetControlCollection().Get(name);
17732  if(!edit)
17733   return;
17734  if(ASPx.Browser.IE)
17735   edit.SetCaretPosition(0);
17736  else
17737   edit.SetFocus();
17738 }, 500);
17739};
17740window.ASPxClientTextEdit = ASPxClientTextEdit;
17741window.ASPxClientTextBoxBase = ASPxClientTextBoxBase;
17742window.ASPxClientTextBox = ASPxClientTextBox;
17743window.ASPxClientMemo = ASPxClientMemo;
17744window.ASPxClientButtonEditBase = ASPxClientButtonEditBase;
17745window.ASPxClientButtonEdit = ASPxClientButtonEdit;
17746window.ASPxClientButtonEditClickEventArgs = ASPxClientButtonEditClickEventArgs;
17747})();
17748
17749(function() {
17750var ASPxClientButton = ASPx.CreateClass(ASPxClientControl, {
17751 constructor: function(name) {
17752  this.constructor.prototype.constructor.call(this, name);
17753  this.isASPxClientButton = true;
17754  this.allowFocus = true;
17755  this.autoPostBackFunction = null;
17756  this.causesValidation = true;
17757  this.checked = false;
17758  this.clickLocked = false;
17759  this.groupName = "";
17760  this.focusElementSelected = false;
17761  this.pressed = false;
17762  this.useSubmitBehavior = true;
17763  this.validationGroup = "";
17764  this.validationContainerID = null;
17765  this.validateInvisibleEditors = false;
17766  this.originalWidth = null;
17767  this.originalHeight = null;
17768  this.needUpdateBounds = true;
17769  this.isTextEmpty = false;
17770  this.CheckedChanged = new ASPxClientEvent();
17771  this.GotFocus = new ASPxClientEvent();
17772  this.LostFocus = new ASPxClientEvent();
17773  this.Click = new ASPxClientEvent();
17774 },
17775 InlineInitialize: function() {
17776  var mainElement = this.GetMainElement();
17777  this.originalWidth = mainElement.style.width;
17778  this.originalHeight = mainElement.style.height;
17779  ASPxClientControl.prototype.InlineInitialize.call(this);
17780  this.InitializeElementIDs();
17781  this.InitializeEvents();
17782  this.InitializeEnabled();
17783  this.InitializeChecked();
17784  if(this.IsLink())
17785   this.InitializeLink();
17786  this.PreventButtonImageDragging();
17787  this.EnsureBoundsAdjusted();
17788 },
17789 InitializeElementIDs: function(){
17790  var mainElement = this.GetMainElement();
17791  var contentElement = ASPx.GetNodeByTagName(mainElement, "DIV", 0);
17792  if(contentElement) contentElement.id = this.name + "_CD";
17793  var imageElement = ASPx.GetNodeByTagName(mainElement, "IMG", 0);
17794  if(imageElement) imageElement.id = this.name + "Img";
17795 },
17796 InitializeEnabled: function(){
17797  this.SetEnabledInternal(this.clientEnabled, true);
17798 },
17799 InitializeChecked: function(){
17800  this.SetCheckedInternal(this.checked, true);
17801 },
17802 InitializeLink: function(){
17803  var mainElement = this.GetMainElement();
17804  if(this.enabled)
17805   mainElement.href = "javascript:;";
17806  if(!this.allowFocus)
17807   mainElement.style.outline = 0;
17808  if(!this.GetTextContainer())
17809   mainElement.style.fontSize = "0pt";
17810 },
17811 InitializeEvents: function(){
17812  if(!this.isNative && !this.IsLink()) {
17813   var element = this.GetInternalButton();
17814   if(element)
17815    element.onfocus = null;
17816   var textControl = this.GetTextControl();
17817   if(textControl) {
17818    if(ASPx.Browser.IE)
17819     ASPx.Evt.AttachEventToElement(textControl, "mouseup", ASPx.Selection.Clear);
17820    ASPx.Evt.PreventElementDragAndSelect(textControl, false);
17821   }    
17822  }
17823  this.onClick = function(evt) {
17824   var processOnServer = ASPx.BClick(this.name, evt);
17825   if(!processOnServer)
17826    ASPx.Evt.PreventEvent(evt);
17827   return processOnServer;
17828  }.aspxBind(this);
17829  this.onImageMoseDown = function() { var el = ASPx.GetFocusedElement(); if(el) el.blur(); };
17830  this.onGotFocus = function() { this.OnFocus(); }.aspxBind(this);
17831  this.onLostFocus = function() { this.OnLostFocus(); }.aspxBind(this);
17832  this.onKeyUp = function(evt) { this.OnKeyUp(evt); }.aspxBind(this);
17833  this.onKeyDown = function(evt) { this.OnKeyDown(evt); }.aspxBind(this); 
17834  if(!this.isNative && !this.IsLink())
17835   this.InitializeNativeHandlers();
17836 },
17837 InitializeNativeHandlers: function() {
17838  this.AttachNativeHandlerToMainElement("focus", "SetFocus");
17839  this.AttachNativeHandlerToMainElement("click", "DoClick");
17840 },
17841 EnsureBoundsAdjusted: function() {
17842  var mainElement = this.GetMainElement();
17843  this.needUpdateBounds = ASPx.GetCurrentStyle(mainElement).display === "block";
17844  if(this.needUpdateBounds) 
17845   mainElement.className = mainElement.className.replace("dxbTSys", "");
17846 },
17847 AdjustControlCore: function () {
17848  if(this.isNative || this.IsLink()) return;
17849  var buttonImage = this.GetButtonImage();  
17850  if(buttonImage && buttonImage.offsetHeight === 0 && buttonImage.offsetWidth === 0)
17851   buttonImage.onload = function() { this.UpdateSize(); }.aspxBind(this);
17852  else
17853   this.UpdateSize();
17854  this.UpdateVerticalAlign();
17855 },
17856 UpdateSize: function() {
17857  if(this.needUpdateBounds) {
17858   this.UpdateWidth();
17859   this.UpdateHeight();
17860  } else
17861   this.CorrectWrappedText(this.GetContentDiv, "Text", true);
17862 },
17863 UpdateVerticalAlign: function() {
17864  var contentElement = this.GetContentDiv();
17865  var verticalAlign = this.GetMainElement().style.verticalAlign;
17866  if(ASPx.IsExistsElement(contentElement) && verticalAlign)
17867   contentElement.style.verticalAlign = verticalAlign;
17868 },
17869 UpdateHeight: function(){
17870  if(this.isNative || this.IsLink() || this.originalHeight === null || ASPx.IsPercentageSize(this.originalHeight)) return;
17871  var height;
17872  var mainElement = this.GetMainElement();
17873  var contentDiv = this.GetContentDiv();
17874  var borderAndPadding = ASPx.GetTopBottomBordersAndPaddingsSummaryValue(mainElement);
17875  var contentHasExcessiveHeight = contentDiv.offsetHeight > mainElement.offsetHeight - borderAndPadding;
17876  var needSetAutoHeight = !this.originalHeight || (ASPx.Browser.Safari && contentHasExcessiveHeight);
17877  if(needSetAutoHeight) {
17878   mainElement.style.height = "";
17879   height = mainElement.offsetHeight - borderAndPadding;
17880  }
17881  else
17882   height = (ASPx.PxToInt(this.originalHeight) - borderAndPadding);
17883  if(height){
17884   mainElement.style.height = height + "px";
17885   if(contentDiv && contentDiv.offsetHeight > 0){
17886    var contentDivCurrentStyle = ASPx.GetCurrentStyle(contentDiv);
17887    var paddingTop = parseInt(contentDivCurrentStyle.paddingTop) || 0;
17888    var paddingBottom = parseInt(contentDivCurrentStyle.paddingBottom) || 0;
17889    var clientHeightDiff = height - contentDiv.offsetHeight;
17890    var verticalAlign = ASPx.GetCurrentStyle(mainElement).verticalAlign;
17891    if(verticalAlign == "top")
17892     paddingBottom = paddingBottom + clientHeightDiff;
17893    else if(verticalAlign == "bottom")
17894     paddingTop = paddingTop + clientHeightDiff;
17895    else {
17896     var halfClientHeightDiff = Math.floor(clientHeightDiff / 2);
17897     paddingTop = paddingTop + halfClientHeightDiff;
17898     paddingBottom = paddingBottom + (clientHeightDiff - halfClientHeightDiff);
17899    }
17900    contentDiv.style.paddingTop = (paddingTop > 0 ? paddingTop : 0) + "px";
17901    contentDiv.style.paddingBottom = (paddingBottom > 0 ? paddingBottom : 0) + "px";
17902   }
17903  }
17904 },
17905 UpdateWidth: function(){
17906  if(this.isNative || this.IsLink() || this.originalWidth === null) return;
17907  if(!ASPx.IsPercentageSize(this.originalWidth)) {
17908   var mainElement = this.GetMainElement();
17909   var borderAndPadding = ASPx.GetLeftRightBordersAndPaddingsSummaryValue(mainElement);
17910   if(this.originalWidth && ASPx.IsTextWrapped(this.GetTextContainer()))
17911    mainElement.style.width = (ASPx.PxToInt(this.originalWidth) - borderAndPadding) + "px";
17912   else
17913    mainElement.style.width = "auto";
17914   var width = mainElement.offsetWidth - borderAndPadding;
17915   if(this.originalWidth && width < ASPx.PxToInt(this.originalWidth) - borderAndPadding) 
17916    width = ASPx.PxToInt(this.originalWidth) - borderAndPadding;
17917   if(width)
17918    mainElement.style.width = (width > 0 ? width : 0)  + "px";
17919  }
17920  this.CorrectWrappedText(this.GetContentDiv, "Text", true);
17921 },
17922 GetAdjustedSizes: function() {
17923  var sizes = ASPxClientControl.prototype.GetAdjustedSizes.call(this);
17924  var image = this.GetButtonImage();
17925  if(image) {
17926   sizes.imageWidth = image.offsetWidth;
17927   sizes.imageHeight = image.offsetHeight;
17928  }
17929  return sizes;
17930 },
17931 PreventButtonImageDragging: function() {
17932  ASPx.Evt.PreventImageDragging(this.GetButtonImage());
17933 },
17934 AttachNativeHandlerToMainElement: function(handlerName, correspondingMethodName) {
17935  var mainElement = this.GetMainElement();
17936  if(!ASPx.IsExistsElement(mainElement))
17937   return;
17938  mainElement[handlerName] = function() { _aspxBCallButtonMethod(this.name, correspondingMethodName); }.aspxBind(this);
17939 },
17940 GetContentDiv: function(){
17941  return this.GetChildElement("CD");
17942 },       
17943 GetButtonImage: function(){
17944  return ASPx.CacheHelper.GetCachedElement(this, "buttonImage", 
17945   function() { 
17946    return ASPx.GetNodeByTagName(this.GetMainElement(), "IMG", 0); 
17947   });
17948 },
17949 GetInternalButton: function() {
17950  return ASPx.CacheHelper.GetCachedElement(this, "internalButton", 
17951   function() { 
17952    return this.isNative || this.IsLink() ? this.GetMainElement() : ASPx.GetNodeByTagName(this.GetMainElement(), "INPUT", 0);
17953   });
17954 },
17955 GetTextContainer: function() {
17956  return ASPx.CacheHelper.GetCachedElement(this, "textContainer", 
17957   function() { 
17958    if(this.isNative)
17959     return this.GetMainElement();
17960    else{
17961     var textElement = this.IsLink() ? this.GetMainElement() : this.GetContentDiv();
17962     return this.accessibilityCompliant ? ASPx.GetElementById(this.name + "_BTC") : ASPx.GetNodeByTagName(textElement, "SPAN", 0);
17963    }
17964   });
17965 },
17966 GetTextControl: function(){
17967  return ASPx.CacheHelper.GetCachedElement(this, "textControl", 
17968   function() { 
17969    var element = ASPx.GetParentByTagName(this.GetContentDiv(), "DIV");
17970    if(!ASPx.IsExistsElement(element) || (element.id == this.name))
17971     element = this.GetContentDiv();
17972    return element;
17973   });
17974 },
17975 IsLink: function(){
17976  if (this.GetMainElement())
17977   return this.GetMainElement().tagName === "A";
17978  return false;
17979 },   
17980 IsHovered: function(){
17981  var hoverElement = this.GetMainElement();
17982  return ASPx.GetStateController().currentHoverItemName == hoverElement.id;
17983 },   
17984 SetEnabledInternal: function(enabled, initialization) {
17985  if(!this.enabled)
17986   return;
17987  if(!initialization || !enabled)
17988   this.ChangeEnabledStateItems(enabled);
17989  this.ChangeEnabledAttributes(enabled);
17990 },
17991 ChangeEnabledAttributes: function(enabled) {
17992  var element = this.GetInternalButton();
17993  if(element) {
17994   if(this.IsLink()){
17995    var method = ASPx.Attr.ChangeAttributesMethod(enabled);
17996    var link = this.GetMainElement();
17997    method(link, "href");
17998    if(this.accessibilityCompliant)
17999     ASPx.Attr.SetOrRemoveAttribute(link, ASPx.Attr.GetTabIndexAttributeName(), enabled ? null : "0");
18000   } else
18001    element.disabled = !enabled;
18002  }
18003  this.ChangeEnabledEventsAttributes(ASPx.Attr.ChangeEventsMethod(enabled));
18004 },
18005 ChangeEnabledEventsAttributes: function(method) {
18006  var element = this.GetMainElement();
18007  method(element, "click", this.onClick);
18008  if(this.allowFocus){
18009   if(!this.isNative && !this.IsLink()) 
18010    element = this.GetInternalButton();
18011   if(element) {
18012    method(element, "focus", this.onGotFocus);
18013    method(element, "blur", this.onLostFocus);
18014    if(!this.isNative && !this.IsLink()){
18015     method(element, "keyup", this.onKeyUp);
18016     method(element, "blur", this.onKeyUp);
18017     method(element, "keydown", this.onKeyDown);
18018    }
18019   }
18020   if(ASPx.Browser.Firefox){
18021    var image = this.GetButtonImage();
18022    if(image)
18023     method(image, "mousedown", this.onImageMoseDown); 
18024   }
18025  }
18026 },
18027 ChangeEnabledStateItems: function(enabled){
18028  if(this.isNative) return;
18029  ASPx.GetStateController().SetElementEnabled(this.GetMainElement(), enabled);
18030  this.UpdateFocusedStyle();
18031 },
18032 RequiredPreventDoublePostback: function(){
18033  return ASPx.Browser.Firefox && !this.isNative; 
18034 },
18035 OnFocus: function() {
18036  if(!this.allowFocus)
18037   return false;
18038  this.focused = true;
18039  if(this.isInitialized)
18040   this.RaiseFocus();
18041  this.UpdateFocusedStyle();
18042 },  
18043 OnLostFocus: function() {
18044  if(!this.allowFocus)
18045   return false;
18046  this.focused = false;
18047  if(this.isInitialized)
18048   this.RaiseLostFocus();
18049  this.UpdateFocusedStyle();
18050 },
18051 CauseValidation: function() {
18052  if(this.causesValidation && ASPx.Ident.scripts.ASPxClientEdit)
18053   return this.validationContainerID != null ?
18054    ASPxClientEdit.ValidateEditorsInContainerById(this.validationContainerID, this.validationGroup, this.validateInvisibleEditors) :
18055    ASPxClientEdit.ValidateGroup(this.validationGroup, this.validateInvisibleEditors);
18056  else
18057   return true;
18058 },
18059 OnClick: function(evt) {
18060  if(this.clickLocked) return true;
18061  if(this.checked && this.groupName != "" && this.GetCheckedGroupList().length > 1) return;
18062  this.SetFocus();
18063  var isValid = this.CauseValidation();
18064  var processOnServer = this.autoPostBack;
18065  if(this.groupName != "") {
18066   if(this.GetCheckedGroupList().length == 1)
18067    this.SetCheckedInternal(!this.checked, false);
18068   else {
18069    this.SetCheckedInternal(true, false);
18070    this.ClearButtonGroupChecked(true);
18071   }
18072   processOnServer = this.RaiseCheckedChanged();
18073   if(processOnServer && isValid)
18074    this.SendPostBack("CheckedChanged");
18075  }
18076  var params = this.RaiseClick();
18077  if(evt && params.cancelEventAndBubble)
18078   ASPx.Evt.PreventEventAndBubble(evt);
18079  if(params.processOnServer && isValid) {
18080   var requiredPreventDoublePostback = this.RequiredPreventDoublePostback();
18081   var postponePostback = ASPx.Browser.AndroidMobilePlatform; 
18082   if(requiredPreventDoublePostback || postponePostback)
18083    window.setTimeout(function() { _aspxBCallButtonMethod(this.name, "SendPostBack", "Click"); }.aspxBind(this), 0); 
18084   else
18085    this.SendPostBack("Click");
18086   return !requiredPreventDoublePostback;
18087  }
18088  return false;
18089 },
18090 OnKeyUp: function(evt) {
18091  if(!this.pressed)
18092   return;
18093  this.pressed = false;
18094  ASPx.GetStateController().OnKeyUpOnElement(evt);
18095 },
18096 OnKeyDown: function(evt) {
18097  if(evt.keyCode == ASPx.Key.Enter || evt.keyCode == ASPx.Key.Space)
18098   this.SetPressed();
18099 },
18100 GetCheckedGroupList: function(){
18101  var result = [ ];
18102  ASPx.GetControlCollection().ForEachControl(function(control) {
18103   if(ASPx.Ident.IsASPxClientButton(control) && (control.groupName == this.groupName) && !control.IsDOMDisposed())
18104    result.push(control);
18105  }, this);
18106  return result;
18107 },
18108 ClearButtonGroupChecked: function(raiseCheckedChanged){
18109  var list = this.GetCheckedGroupList();
18110  for(var i = 0; i < list.length; i ++){
18111   if(list[i] != this && list[i].checked) {
18112    list[i].SetCheckedInternal(false, false);
18113    if(raiseCheckedChanged)
18114     list[i].RaiseCheckedChanged();
18115   }
18116  }
18117 },
18118 ApplyCheckedStyle: function(){
18119  var stateController = ASPx.GetStateController();
18120  if(this.IsHovered()) 
18121   stateController.SetCurrentHoverElement(null);  
18122  stateController.SelectElementBySrcElement(this.GetMainElement());
18123 }, 
18124 ApplyUncheckedStyle: function(){
18125  var stateController = ASPx.GetStateController();
18126  if(this.IsHovered()) 
18127   stateController.SetCurrentHoverElement(null);
18128  stateController.DeselectElementBySrcElement(this.GetMainElement());
18129 },  
18130 SetCheckedInternal: function(checked, initialization){
18131  if(initialization && checked || (this.checked != checked)){
18132   this.checked = checked;
18133   if(checked)
18134    this.ApplyCheckedStyle();
18135   else
18136    this.ApplyUncheckedStyle();
18137  }
18138 },
18139 UpdateStateObject: function(){
18140  if(this.groupName != "")
18141   this.UpdateStateObjectWithObject({ checked: this.checked });
18142 },
18143 GetStateHiddenFieldName: function() {
18144  return this.uniqueID + "$State";
18145 },
18146 ApplyPressedStyle: function(){
18147  ASPx.GetStateController().OnMouseDownOnElement(this.GetMainElement());
18148 },
18149 ApplyUnpressedStyle: function(){ 
18150  ASPx.GetStateController().OnMouseUpOnElement(this.GetMainElement());
18151 },
18152 SetPressed: function(){
18153  this.pressed = true;
18154  this.ApplyPressedStyle();
18155 }, 
18156 SetUnpressed: function(){
18157  this.pressed = false;
18158  this.ApplyUnpressedStyle();
18159 },
18160 SetFocus: function(){
18161  if(!this.allowFocus || this.focused)
18162   return;
18163  var element = this.GetInternalButton();
18164  if(element) {
18165   var hiddenInternalButtonRequiresVisibilityToGetFocused = ASPx.Browser.WebKitFamily  && !this.isNative  && !this.IsLink();
18166   if(hiddenInternalButtonRequiresVisibilityToGetFocused)
18167    ASPxClientButton.MakeHiddenElementFocusable(element);
18168   if(ASPx.IsFocusable(element) && ASPx.GetActiveElement() != element)
18169    element.focus();
18170   if(hiddenInternalButtonRequiresVisibilityToGetFocused)
18171    ASPxClientButton.RestoreHiddenElementAppearance(element);
18172  }
18173 },
18174 ApplyFocusedStyle: function(){
18175  if(this.focusElementSelected) return;
18176  if(typeof(ASPx.GetStateController) != "undefined")
18177   ASPx.GetStateController().SelectElementBySrcElement(this.GetContentDiv());
18178  this.focusElementSelected = true;
18179 },
18180 ApplyUnfocusedStyle: function(){ 
18181  if(!this.focusElementSelected) return;
18182  if(typeof(ASPx.GetStateController) != "undefined")
18183   ASPx.GetStateController().DeselectElementBySrcElement(this.GetContentDiv());
18184  this.focusElementSelected = false;
18185 },
18186 UpdateFocusedStyle: function(){
18187  if(this.isNative || this.IsLink()) return;
18188  if(this.enabled && this.clientEnabled && this.allowFocus && this.focused)
18189   this.ApplyFocusedStyle();
18190  else
18191   this.ApplyUnfocusedStyle();
18192 },
18193 SendPostBack: function(postBackArg){
18194  if(!this.enabled || !this.clientEnabled)
18195   return;
18196  var arg = postBackArg || "";
18197  if(this.autoPostBackFunction)
18198   this.autoPostBackFunction(arg);
18199  else if(!this.useSubmitBehavior || this.IsLink())
18200   ASPxClientControl.prototype.SendPostBack.call(this, arg);
18201  if(this.useSubmitBehavior && !this.isNative) 
18202   this.ClickInternalButton();
18203 },
18204 ClickInternalButton: function(){
18205  var element = this.GetInternalButton();
18206  if(element) {
18207   this.clickLocked = true;
18208   if(ASPx.Browser.NetscapeFamily)
18209    this.CreateUniqueIDCarrier(); 
18210   var postHandler = ASPx.GetPostHandler();
18211   postHandler.SetLastSubmitElementName(element.name);
18212   ASPx.Evt.DoElementClick(element);
18213   postHandler.SetLastSubmitElementName(null);
18214   if(ASPx.Browser.NetscapeFamily)
18215    this.RemoveUniqueIDCarrier(); 
18216   this.clickLocked = false;
18217  }
18218 },
18219 CreateUniqueIDCarrier: function() {
18220  var name = this.uniqueID;
18221  var id = this.GetUniqueIDCarrierID();
18222  var field = ASPx.CreateHiddenField(name, id);
18223  var form = this.GetParentForm();
18224  if(form) form.appendChild(field);
18225 },
18226 RemoveUniqueIDCarrier: function() {
18227  var field = document.getElementById(this.GetUniqueIDCarrierID());
18228  if(field)
18229   field.parentNode.removeChild(field);
18230 },
18231 GetUniqueIDCarrierID: function() {
18232  return this.uniqueID + "_UIDC";
18233 },
18234 DoClick: function(){
18235  if(!this.enabled || !this.clientEnabled)
18236   return;
18237  var button = (this.isNative || this.IsLink()) ? this.GetMainElement() : this.GetInternalButton();
18238  if(button)
18239   ASPx.Evt.DoElementClick(button);
18240  else 
18241   this.OnClick();   
18242 },
18243 GetChecked: function(){
18244  return this.checked;
18245 },
18246 SetChecked: function(checked){
18247  this.SetCheckedInternal(checked, false);
18248  this.ClearButtonGroupChecked(false);
18249 },
18250 GetText: function(){
18251  if(!this.isTextEmpty)
18252   return this.isNative ? this.GetTextContainer().value : this.GetTextContainer().innerHTML;
18253  return "";
18254 },
18255 SetText: function(text){
18256  this.isTextEmpty = (text == null || text == "");
18257  var textContainer = this.GetTextContainer();
18258  if(textContainer){
18259   if(this.isNative)
18260    textContainer.value = (text != null) ? text : "";
18261   else {
18262    var value = this.isTextEmpty ? "&nbsp;" : text;
18263      textContainer.innerHTML = value;
18264    var element = this.GetInternalButton();
18265    if(element)
18266     element.value = value;
18267    if(this.clientVisible && ASPx.Browser.IE && ASPx.Browser.Version >= 9) 
18268     ASPx.SetElementDisplay(this.GetMainElement(), true);
18269   }
18270   this.UpdateSize();
18271  }
18272 },
18273 GetImageUrl: function(){
18274  var img = this.GetButtonImage();
18275  return img ?  img.src : "";
18276 },
18277 SetImageUrl: function(url){
18278  var img = this.GetButtonImage();
18279  if(img) {
18280   img.src = url;
18281   this.UpdateSize();
18282  }
18283 },
18284 SetEnabled: function(enabled){
18285  if(this.clientEnabled != enabled) {
18286   if(!enabled && this.focused)
18287    this.OnLostFocus();
18288   this.clientEnabled = enabled;
18289   this.SetEnabledInternal(enabled, false);
18290  }
18291 },
18292 GetEnabled: function(){
18293  return this.enabled && this.clientEnabled;
18294 },
18295 Focus: function(){
18296  this.SetFocus();
18297 },
18298 RaiseCheckedChanged: function(){
18299  var processOnServer = this.autoPostBack || this.IsServerEventAssigned("CheckedChanged");
18300  if(!this.CheckedChanged.IsEmpty()){
18301   var args = new ASPxClientProcessingModeEventArgs(processOnServer);
18302   this.CheckedChanged.FireEvent(this, args);
18303   processOnServer = args.processOnServer;
18304  }
18305  return processOnServer;
18306 },
18307 RaiseFocus: function(){
18308  if(!this.GotFocus.IsEmpty()){
18309   var args = new ASPxClientEventArgs();
18310   this.GotFocus.FireEvent(this, args);
18311  }
18312 },
18313 RaiseLostFocus: function(){
18314  if(!this.LostFocus.IsEmpty()){
18315   var args = new ASPxClientEventArgs();
18316   this.LostFocus.FireEvent(this, args);
18317  }
18318 },
18319 RaiseClick: function() {
18320  var processOnServer = this.autoPostBack || this.IsServerEventAssigned("Click");
18321  var cancelEventAndBubble = false;
18322  if(!this.Click.IsEmpty()) {
18323   var args = new ASPxClientButtonClickEventArgs(processOnServer, cancelEventAndBubble);
18324   this.Click.FireEvent(this, args);
18325   cancelEventAndBubble = args.cancelEventAndBubble;
18326   processOnServer = args.processOnServer;
18327  }
18328  return {
18329   processOnServer: processOnServer,
18330   cancelEventAndBubble: cancelEventAndBubble
18331  };
18332 }
18333});
18334ASPxClientButton.Cast = ASPxClientControl.Cast;
18335var ASPxClientButtonClickEventArgs = ASPx.CreateClass(ASPxClientProcessingModeEventArgs, {
18336 constructor: function(processOnServer, cancelEventAndBubble) {
18337  this.constructor.prototype.constructor.call(this, processOnServer);
18338  this.cancelEventAndBubble = cancelEventAndBubble;
18339 }
18340});
18341ASPxClientButton.MakeHiddenElementFocusable = function(element) {
18342 element.__dxHiddenElementState = {
18343  parentDisplay: element.parentNode.style.display,
18344  height: element.style.height,
18345  width: element.style.width
18346 };
18347 element.parentNode.style.display = "block";
18348 element.style.height = "1px";
18349 element.style.width = "1px";
18350};
18351ASPxClientButton.RestoreHiddenElementAppearance = function(element) {
18352 var state = element.__dxHiddenElementState;
18353 element.parentNode.style.display = state.parentDisplay;
18354 element.style.height = state.height;
18355 element.style.width = state.width;
18356 delete element.__dxHiddenElementState;
18357};
18358ASPx.Ident.IsASPxClientButton = function(obj) {
18359 return !!obj.isASPxClientButton;
18360};
18361function _aspxBCallButtonMethod(name, methodName, arg) {
18362 var button = ASPx.GetControlCollection().Get(name); 
18363 if(button != null)
18364  button[methodName](arg);
18365}
18366ASPx.BClick = function(name, evt) {
18367 var button = ASPx.GetControlCollection().Get(name); 
18368 if(button != null)
18369  return button.OnClick(evt);
18370};
18371window.ASPxClientButton = ASPxClientButton;
18372})();
18373
18374(function() {
18375var DateFormatter = ASPx.CreateClass(null, {
18376 constructor: function() {
18377  this.date = new Date(2000, 0, 1);
18378  this.mask = "";
18379  this.specifiers = {};     
18380  this.spPositions = [];    
18381  this.parserKeys = [];
18382  this.knownSpecifiers = ["d", "M", "y", "H", "h", "m", "s", "f", "F", "g", "t"];
18383  this.savedYear = -1;
18384  this.isYearParsed = false;
18385  this.parsedMonth = -1;
18386  this.replacers = {
18387   "d": this.ReplaceDay,
18388   "M": this.ReplaceMonth,
18389   "y": this.ReplaceYear,
18390   "H": this.ReplaceHours23,
18391   "h": this.ReplaceHours12,
18392   "m": this.ReplaceMinutes,
18393   "s": this.ReplaceSeconds,
18394   "F": this.ReplaceMsTrimmed,
18395   "f": this.ReplaceMs,
18396   "g": this.ReplaceEra,
18397   "t": this.ReplaceAmPm
18398  };
18399  this.parsers = {
18400   "d": this.ParseDay,
18401   "M": this.ParseMonth,
18402   "y": this.ParseYear,
18403   "H": this.ParseHours,
18404   "h": this.ParseHours,
18405   "m": this.ParseMinutes,
18406   "s": this.ParseSeconds,
18407   "F": this.ParseMs,
18408   "f": this.ParseMs,
18409   "g": this.ParseEra,
18410   "t": this.ParseAmPm
18411  };
18412 },
18413 Format: function(date) {
18414  this.date = date;
18415  var sp;
18416  var pos;
18417  var replacerKey;
18418  var result = this.mask;
18419  for(var i = 0; i < this.spPositions.length; i++) {
18420   pos = this.spPositions[i];
18421   sp = this.specifiers[pos];
18422   replacerKey = sp.substr(0, 1);
18423   if(this.replacers[replacerKey]) {
18424    result = result.substr(0, pos) + this.replacers[replacerKey].call(this, sp.length) + result.substr(pos + sp.length);
18425   }
18426  }
18427  return result;
18428 }, 
18429 Parse: function(str, rememberParserKeys) {
18430  var now = new Date();  
18431  this.savedYear = now.getFullYear();
18432  this.isYearParsed = false;
18433  this.parsedMonth = -1;
18434  this.date = new Date(2000, 0, now.getDate());    
18435  this.strToParse = str;
18436  this.catchNumbers(str);  
18437  var parserKey;
18438  var sp;
18439  var pos;
18440  var parseResult;
18441  var error = false;
18442  this.hasAmPm = false;
18443  for(var i = 0; i < this.spPositions.length; i++) {
18444   pos = this.spPositions[i];
18445   sp = this.specifiers[pos];
18446   parserKey = sp.substr(0, 1);
18447   if(this.parsers[parserKey]) {
18448    if(rememberParserKeys)
18449     this.parserKeys.push(parserKey);
18450    parseResult = this.parsers[parserKey].call(this, sp.length);
18451    if(!parseResult) {
18452     error = true;
18453     break;
18454    }
18455   }
18456  }
18457  if(error)
18458   return false;
18459  if(this.hasAmPm) {
18460   if(!this.fixHours())
18461    return false;
18462  }
18463  if(!this.isYearParsed)
18464   this.date.setYear(this.savedYear);
18465  if(this.parsedMonth < 0)
18466   this.parsedMonth = now.getMonth();   
18467  this.ApplyMonth();
18468  return this.date;  
18469 },
18470 ParseAndMergeWithDate: function(str, sourceDate) {
18471  this.parserKeys = [];
18472  var date = this.Parse(str, true);
18473  if(date && sourceDate)
18474   date = new Date(
18475        this.HasYear() ? date.getFullYear() : sourceDate.getFullYear(),
18476        this.HasMonth() ? date.getMonth() : sourceDate.getMonth(),
18477        this.HasDay() ? date.getDate() : sourceDate.getDate(),
18478        this.HasHours() ? date.getHours() : sourceDate.getHours(),
18479        this.HasMinutes() ? date.getMinutes() : sourceDate.getMinutes(),
18480        this.HasSeconds() ? date.getSeconds() : sourceDate.getSeconds(),
18481        this.HasMilliseconds() ? date.getMilliseconds() : sourceDate.getMilliseconds()
18482        );
18483  this.parserKeys = [];
18484  return date;
18485 },
18486 HasYear: function() { return this.HasParserKey("y"); },
18487 HasMonth: function() { return this.HasParserKey("M"); },
18488 HasDay: function() { return this.HasParserKey("d"); },
18489 HasHours: function() { return this.HasParserKey("h") || this.HasParserKey("H"); },
18490 HasMinutes: function() { return this.HasParserKey("m"); },
18491 HasSeconds: function() { return this.HasParserKey("s"); },
18492 HasMilliseconds: function() { return this.HasParserKey("f") || this.HasParserKey("F"); },
18493 HasParserKey: function(key) { return ASPx.Data.ArrayIndexOf(this.parserKeys, key) !== -1; },
18494 ApplyMonth: function() {
18495  var trial;
18496  var day = this.date.getDate();
18497  while(true) {
18498   trial = new Date();
18499   trial.setTime(this.date.getTime());   
18500   trial.setMonth(this.parsedMonth);
18501   if(trial.getMonth() == this.parsedMonth)
18502    break;
18503   --day;
18504   this.date.setDate(day);
18505  }
18506  ASPx.DateUtils.FixTimezoneGap(this.date, trial);
18507  this.date = trial;
18508 },
18509 SetFormatString: function(mask) {
18510  if(mask.length == 2 && mask.charAt(0) == "%")
18511   mask = mask.charAt(1);
18512  var stringContainsDateSeparator = mask && mask.indexOf(ASPx.CultureInfo.ds) !== -1;
18513  this.specifiers = {}; 
18514  this.spPositions = [];
18515  this.mask = "";
18516  var subt = 0;
18517  var pos = 0;
18518  var startPos = 0;
18519  var ch;
18520  var prevCh = "";
18521  var skip = false;
18522  var backslash = false;
18523  var sp = "";
18524  while(true) {
18525   ch = mask.charAt(pos);
18526   if(ch == "") {
18527    if(sp.length > 0)
18528     this.RegisterSpecifier(startPos, sp, stringContainsDateSeparator);
18529    break;
18530   }
18531   if(ch == "\\" && !backslash) {
18532    backslash = true;
18533    subt++;
18534   } else {
18535    if(!backslash && (ch == "'" || ch == '"')) {
18536     skip = !skip;
18537     subt++;
18538    } else {     
18539     if(!skip) {
18540      if(ch == "/")
18541       ch = ASPx.CultureInfo.ds;
18542      else if(ch == ":")
18543       ch = ASPx.CultureInfo.ts;
18544      else if(this.IsKnownSpecifier(ch)) {
18545       if(prevCh.length == 0)
18546        prevCh = ch;
18547       if(ch == prevCh)
18548        sp += ch;
18549       else {
18550        if(sp.length > 0)
18551         this.RegisterSpecifier(startPos, sp, stringContainsDateSeparator);
18552        sp = ch;
18553        startPos = pos - subt;
18554       }
18555      }
18556     }     
18557     this.mask += ch;
18558    }      
18559    backslash = false;
18560   }            
18561   prevCh = ch;
18562   pos++;
18563  }
18564  this.spPositions.reverse();
18565 },
18566 RegisterSpecifier: function (pos, sp, stringContainsDateSeparator) {
18567  if(ASPx.CultureInfo.ds.length > 1 && this.mask && !stringContainsDateSeparator) {
18568   var dateParts = this.mask.split(ASPx.CultureInfo.ds);
18569   if(dateParts) {
18570    if(dateParts.length > 0 && dateParts[dateParts.length - 1] == "")
18571     dateParts.pop();
18572    pos += (dateParts.length - 1) * (ASPx.CultureInfo.ds.length - 1);
18573   }
18574  }
18575  this.spPositions.push(pos);
18576  this.specifiers[pos] = sp; 
18577 },
18578 ReplaceDay: function(length) {
18579  if(length < 3) {
18580   var value = this.date.getDate().toString();
18581   return length == 2 ? this.padLeft(value, 2) : value;  
18582  } else if(length == 3) {
18583   return ASPx.CultureInfo.abbrDayNames[this.date.getDay()];
18584  } else {
18585   return ASPx.CultureInfo.dayNames[this.date.getDay()];
18586  }
18587 }, 
18588 ReplaceMonth: function(length) {
18589  var value = 1 + this.date.getMonth();
18590  switch(length) {
18591   case 1:
18592    return value.toString();
18593   case 2:
18594    return this.padLeft(value.toString(), 2);
18595   case 3:
18596    return ASPx.CultureInfo.abbrMonthNames[value - 1];
18597   default:
18598    for(var i in this.specifiers) {
18599     if(this.specifiers.hasOwnProperty(i)) {
18600      var spec = this.specifiers[i];
18601      if(spec == "d" || spec == "dd")
18602       return ASPx.CultureInfo.genMonthNames[value - 1];
18603     }
18604    }
18605    return ASPx.CultureInfo.monthNames[value - 1];
18606  }
18607 },
18608 ReplaceYear: function(length) {
18609  var value = this.date.getFullYear();
18610  if(length <= 2)
18611   value = value % 100;
18612  return this.padLeft(value.toString(), length);
18613 },
18614 ReplaceHours23: function(length) {
18615  var value = this.date.getHours().toString();
18616  return length > 1 ? this.padLeft(value, 2) : value;
18617 },
18618 ReplaceHours12: function(length) {
18619  var value = this.date.getHours() % 12;
18620  if(value == 0)
18621   value = 12;
18622  value = value.toString();
18623  return length > 1 ? this.padLeft(value, 2) : value;
18624 },
18625 ReplaceMinutes: function(length) {
18626  var value = this.date.getMinutes().toString();
18627  return length > 1 ? this.padLeft(value, 2) : value;
18628 },
18629 ReplaceSeconds: function(length) {
18630  var value = this.date.getSeconds().toString();
18631  return length > 1 ? this.padLeft(value, 2) : value;
18632 },
18633 ReplaceMsTrimmed: function(length) {   
18634  return this.formatMs(length, true);
18635 },
18636 ReplaceMs: function(length) { 
18637  return this.formatMs(length, false);
18638 },
18639 ReplaceEra: function(length) {
18640  return "A.D.";
18641 },
18642 ReplaceAmPm: function(length) {
18643  var value = this.date.getHours() < 12 ? ASPx.CultureInfo.am : ASPx.CultureInfo.pm;
18644  return length < 2 ? value.charAt(0) : value;
18645 },
18646 catchNumbers: function(str) {
18647  this.parseNumbers = [];  
18648  var regex = /\d+/g;  
18649  var match;
18650  for(;;) {
18651   match = regex.exec(str);
18652   if(!match)
18653    break;
18654   this.parseNumbers.push(this.parseDecInt(match[0]));
18655  }  
18656  var spCount = 0;
18657  var now = new Date();
18658  for(var i in this.specifiers) {
18659   if(this.specifiers.hasOwnProperty(i)) {
18660    var sp = this.specifiers[i];
18661    if (sp.constructor != String || !this.IsNumericSpecifier(sp)) continue;
18662    spCount++;
18663    if(this.parseNumbers.length < spCount) {
18664     var defaultValue = 0;
18665     if (sp.charAt(0) == "y") defaultValue = now.getFullYear();
18666     this.parseNumbers.push(defaultValue);
18667    }
18668   }
18669  }
18670  var excess = this.parseNumbers.length - spCount;
18671  if(excess > 0)
18672   this.parseNumbers.splice(spCount, excess);  
18673  this.currentParseNumber = this.parseNumbers.length - 1;
18674 },
18675 popParseNumber: function() {
18676  return this.parseNumbers[this.currentParseNumber--];
18677 },
18678 findAbbrMonth: function() {
18679  return this.findMonthCore(ASPx.CultureInfo.abbrMonthNames);
18680 },
18681 findFullMonth: function() {
18682  return this.findMonthCore(ASPx.CultureInfo.genMonthNames);
18683 }, 
18684 findMonthCore: function(monthNames) {
18685  var inputLower = this.strToParse.toLowerCase();
18686  for(var i = 0; i < monthNames.length; i++) {
18687   var monthName = monthNames[i].toLowerCase();
18688   if(monthName.length > 0 &&  inputLower.indexOf(monthName) > -1) {
18689    var empty = "";
18690    for(var j = 0; j < monthName.length; j++) empty += " ";
18691    this.strToParse = this.strToParse.replace(new RegExp(monthName, "gi"), empty);
18692    return 1 + parseInt(i);
18693   }
18694  }
18695  return false;
18696 },
18697 ParseDay: function(length) {
18698  if(length < 3) {
18699   var value = this.popParseNumber();
18700   if(value < 1 || value > 31)
18701    return false;
18702   this.date.setDate(value);
18703  }
18704  return true;
18705 },
18706 ParseMonth: function(length) {
18707  var value;
18708  switch(length){
18709   case 1:
18710   case 2:
18711    value = this.popParseNumber();
18712    break; 
18713   case 3:
18714    value = this.findAbbrMonth();
18715    break;
18716   default:
18717    value = this.findFullMonth();
18718    break;
18719  }
18720  if(value < 1 || value > 12)
18721   return false;
18722  this.parsedMonth = value - 1;
18723  return true;
18724 }, 
18725 ParseYear: function(length) {  
18726  var value = this.popParseNumber();
18727  if(value > 9999)
18728   return false;
18729  if(value < 100)
18730   value = ASPx.DateUtils.ExpandTwoDigitYear(value);
18731  this.date.setFullYear(value);
18732  this.isYearParsed = true;
18733  return true;
18734 },
18735 ParseHours: function(length) {
18736  var value = this.popParseNumber();
18737  if(value > 23)
18738   return false;
18739  this.date.setHours(value);
18740  return true;
18741 },
18742 ParseMinutes: function(length) {
18743  var value = this.parseMinSecCore();
18744  if(value == -1)
18745   return false;
18746  this.date.setMinutes(value);
18747  return true;
18748 },
18749 ParseSeconds: function(length) {
18750  var value = this.parseMinSecCore();
18751  if(value == -1)
18752   return false;
18753  this.date.setSeconds(value);
18754  return true;
18755 },
18756 ParseMs: function(length) {
18757  if(length > 3)
18758   length = 3;
18759  var thr = 1;
18760  for(var i = 0; i < length; i++)
18761   thr *= 10;
18762  thr -= 1;
18763  var value = this.popParseNumber();
18764  while(value > thr)
18765   value /= 10;
18766  this.date.setMilliseconds(Math.round(value));
18767  return true;
18768 },
18769 ParseEra: function(length) {
18770  return true;
18771 },
18772 ParseAmPm: function(length) {
18773  this.hasAmPm = ASPx.CultureInfo.am.length > 0 && ASPx.CultureInfo.pm.length > 0;
18774  return true;
18775 },
18776 parseDecInt: function(str) {
18777  return parseInt(str, 10);
18778 },
18779 padLeft: function(str, length) {
18780  while(str.length < length)
18781   str = "0" + str;
18782  return str;
18783 },
18784 formatMs: function(length, trim) {
18785  var value = Math.floor(this.date.getMilliseconds() * Math.pow(10, length - 3));
18786  value = this.padLeft(value.toString(), length);    
18787  if(trim) {
18788   var pos = value.length - 1;
18789   var req = false;
18790   while(value.charAt(pos) == "0") {
18791    req = true;
18792    pos--;
18793   }
18794   if(req)
18795    value = value.substring(0, pos + 1);   
18796  }
18797  return value;
18798 },
18799 parseMinSecCore: function() {
18800  var value = this.popParseNumber();
18801  return value > 59 ? -1 : value;
18802 },
18803 fixHours: function() {
18804  var state = this.getAmPmState(this.strToParse);
18805  if(!state) return true;
18806  var h = this.date.getHours();
18807  switch(state) {
18808   case "P":
18809    if(h > 12) return false;
18810    if(h < 12)
18811     this.date.setHours(12 + h);
18812    break;
18813   case "A":
18814    if(h == 12)
18815     this.date.setHours(0);
18816  }
18817  return true;
18818 },
18819 getAmPmState: function(str, skipCorrection) {
18820  var am = ASPx.CultureInfo.am.charAt(0).toLowerCase();
18821  var pm = ASPx.CultureInfo.pm.charAt(0).toLowerCase();
18822  var amMatches = new RegExp(am, "gi").exec(str);
18823  var pmMatches = new RegExp(pm, "gi").exec(str);
18824  var amCount = amMatches ? amMatches.length : 0;
18825  var pmCount = pmMatches ? pmMatches.length : 0;
18826  var hasAm = amCount > 0;
18827  var hasPm = pmCount > 0;
18828  if(hasAm ^ hasPm && amCount < 2 && pmCount < 2)
18829   return hasAm ? "A" : "P";
18830  if(!skipCorrection) {
18831   str = str.replace(new RegExp(this.getDayMonthNameReplacePattern(), "gi"), "");
18832   return this.getAmPmState(str, true);
18833  }
18834  return null;
18835 },
18836 getDayMonthNameReplacePattern: function() {
18837  if(!this.dayMonthNameReplacePattern)
18838   return this.createDayMonthNameReplacePattern();
18839  return this.dayMonthNameReplacePattern;
18840 },
18841 createDayMonthNameReplacePattern: function() {
18842  var parts = [ ] ;
18843  parts.push("(?:");
18844  parts.push(this.createReplacePattern(ASPx.CultureInfo.monthNames));
18845  parts.push(this.createReplacePattern(ASPx.CultureInfo.genMonthNames));
18846  parts.push(this.createReplacePattern(ASPx.CultureInfo.abbrMonthNames));
18847  parts.push(this.createReplacePattern(ASPx.CultureInfo.abbrDayNames));
18848  parts.push(this.createReplacePattern(ASPx.CultureInfo.dayNames));
18849  parts.push(")");
18850  return parts.join("");
18851 },
18852 createReplacePattern: function(names) {
18853  return names && names.length > 0 ? "\\b" + names.join("\\b|\\b") + "\\b" : "";
18854 },
18855 IsNumericSpecifier: function(sp) {
18856  var ch = sp.charAt(0);
18857  if(ch == "g" || ch == "t" || ((ch == "M" || ch == "d") && sp.length > 2))
18858   return false;
18859  return true;
18860 },
18861 IsKnownSpecifier: function(sp) {
18862  if(sp.length > 1)
18863   sp = sp.charAt(0);
18864  for(var i = 0; i < this.knownSpecifiers.length; i++) {
18865   if(this.knownSpecifiers[i] == sp)
18866    return true;
18867  }
18868  return false;
18869 }
18870});
18871DateFormatter.Create = function(format) {
18872 var instance = new DateFormatter();
18873 instance.SetFormatString(format);
18874 return instance;
18875};
18876DateFormatter.ExpandPredefinedFormat = function(format) {
18877 switch(format) {
18878  case "d":
18879   return ASPx.CultureInfo.shortDate;
18880  case "D":
18881   return ASPx.CultureInfo.longDate;
18882  case "t":
18883   return ASPx.CultureInfo.shortTime;
18884  case "T":
18885   return ASPx.CultureInfo.longTime;
18886  case "g":
18887   return ASPx.CultureInfo.shortDate + " " + ASPx.CultureInfo.shortTime;   
18888  case "f":
18889   return ASPx.CultureInfo.longDate + " " + ASPx.CultureInfo.shortTime;
18890  case "G":
18891   return ASPx.CultureInfo.shortDate + " " + ASPx.CultureInfo.longTime;
18892  case "F":
18893  case "U":
18894   return ASPx.CultureInfo.longDate + " " + ASPx.CultureInfo.longTime;   
18895  case "M":
18896  case "m":
18897   return ASPx.CultureInfo.monthDay;
18898  case "Y":
18899  case "y":
18900   return ASPx.CultureInfo.yearMonth;   
18901  case "O":
18902  case "o":
18903   return "yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffff";
18904  case "R":
18905  case "r":
18906   return "ddd, dd MMM yyyy HH':'mm':'ss 'GMT'";
18907  case "s":
18908   return "yyyy'-'MM'-'dd'T'HH':'mm':'ss";
18909  case "u":
18910    return "yyyy'-'MM'-'dd HH':'mm':'ss'Z'";
18911 }
18912 return format;
18913};
18914ASPx.DateFormatter = DateFormatter;
18915})();
18916(function() {
18917ASPx.Formatter = {
18918 Format: function() {
18919  if(arguments.length < 1) 
18920   return "";
18921  var format = arguments[0];
18922  if(format == null)
18923   return "";
18924  var args;
18925  if(arguments.length > 1 && arguments[1] != null && arguments[1].constructor == Array) {
18926   args = arguments[1];
18927  } else {
18928   args = [ ];
18929   for(var i = 1; i < arguments.length; i++)
18930    args.push(arguments[i]);
18931  }
18932  var bag = [ ];
18933  var pos = 0;
18934  var savedPos = 0;  
18935  while(pos < format.length) {
18936   var ch = format.charAt(pos);
18937   pos++;
18938   if(ch == '{') {
18939    bag.push(format.substr(savedPos, pos - savedPos - 1));    
18940    if(format.charAt(pos) == "{") {
18941     savedPos = pos;
18942     pos++;
18943     continue;
18944    }
18945    var spec = this.ParseSpec(format, pos);
18946    var pos = spec.pos;
18947    var arg = args[spec.index];
18948    var argString;
18949    if(arg == null) {
18950     argString = "";
18951    } else if(typeof arg == "number") {
18952     argString = ASPx.NumberFormatter.Format(spec.format, arg);
18953    } else if(arg.constructor == Date) {     
18954     if(spec.format != this.activeDateFormat) {
18955      this.activeDateFormat = spec.format;
18956      if(spec.format == "")
18957       spec.format = "G";      
18958      if(spec.format.length == 1)
18959       spec.format = ASPx.DateFormatter.ExpandPredefinedFormat(spec.format);
18960      this.GetDateFormatter().SetFormatString(spec.format);
18961     }
18962     if(this.activeDateFormat == "U")
18963      arg = ASPx.DateUtils.ToUtcTime(arg);
18964     argString = this.GetDateFormatter().Format(arg);
18965    } else {
18966     argString = String(arg);     
18967     if(spec.format != "" && argString.length > 0) {
18968      var num = Number(argString.replace(",", "."));
18969      if(!isNaN(num))
18970       argString = ASPx.NumberFormatter.Format(spec.format, num);
18971     }
18972    }
18973    var padLen = spec.width - argString.length;
18974    if(padLen > 0) {
18975     if(spec.left)
18976      bag.push(argString);
18977     for(var i = 0; i < padLen; i++)
18978      bag.push(" ");
18979     if(!spec.left)
18980      bag.push(argString);
18981    } else {
18982     bag.push(argString);
18983    }
18984    savedPos = pos;
18985   }
18986   else if(ch == "}" && pos < format.length && format.charAt(pos) == "}") {
18987    bag.push(format.substr(savedPos, pos - savedPos - 1));
18988    savedPos = pos;
18989    pos++;
18990   }
18991   else if (ch == "}") {
18992    return "";
18993   }
18994  }
18995  if(savedPos < format.length)
18996   bag.push(format.substr(savedPos));   
18997  return bag.join("");
18998 },
18999 ParseSpec: function(format, pos) {
19000  var result = {
19001   index: -1,   
19002   left: false,
19003   width: 0,
19004   format: "",
19005   pos: 0
19006  };
19007  var savedPos, ch;
19008  savedPos = pos;
19009  while(true) {   
19010   ch = format.charAt(pos);
19011   if(ch < "0" || ch > "9")
19012    break;
19013   pos++;
19014  }  
19015  if(pos > savedPos)
19016   result.index = Number(format.substr(savedPos, pos - savedPos));  
19017  if(format.charAt(pos) == ",") {
19018   pos++;
19019   while(true) {
19020    ch = format.charAt(pos);
19021    if(ch != " " && ch != "\t")
19022     break;
19023    pos++;
19024   }
19025   result.left = format.charAt(pos) == "-";
19026   if(result.left)
19027    pos++;   
19028   savedPos = pos;
19029   while(true) {
19030    ch = format.charAt(pos);
19031    if(ch < "0" || ch > "9")
19032     break;
19033    pos++;
19034   }
19035   if(pos > savedPos)
19036    result.width = Number(format.substr(savedPos, pos - savedPos));
19037  }
19038  if(format.charAt(pos) == ":") {
19039   pos++;
19040   savedPos = pos;
19041   while(format.charAt(pos) != "}")
19042    pos++;
19043   result.format = format.substr(savedPos, pos - savedPos);
19044  }
19045  pos++;
19046  result.pos = pos;
19047  return result;
19048 },
19049 activeDateFormat: null,
19050 GetDateFormatter: function() {
19051  if(!this.__dateFormatter)
19052   this.__dateFormatter = new ASPx.DateFormatter();
19053  return this.__dateFormatter;
19054 }
19055};
19056ASPx.NumberFormatter = {
19057 Format: function(format, value) {
19058  if(isNaN(value))
19059   return ASPx.CultureInfo.numNan;
19060  if(!isFinite(value)) {
19061   return value > 0 
19062    ? ASPx.CultureInfo.numPosInf 
19063    : ASPx.CultureInfo.numNegInf;
19064  }
19065  this.FillFormatInfo(format);
19066  if(this.spec == "X")
19067   return this.FormatHex(value);
19068  this.FillDigitInfo(value);  
19069  switch(this.spec) {
19070   case "C":
19071    return this.FormatCurrency();
19072   case "D":
19073    return this.FormatDecimal();
19074   case "E":
19075    return this.FormatExp();
19076   case "F":
19077    return this.FormatFixed();
19078   case "G":   
19079    return this.FormatGeneral();
19080   case "N":
19081    return this.FormatNumber();
19082   case "P":
19083    return this.FormatPercent();
19084   default:
19085    if(this.custom)
19086     return this.FormatCustom(format);
19087    return "?";
19088  }
19089 },
19090 positive: true,
19091 digits: null,
19092 pointPos: 0, 
19093 spec: "",
19094 prec: -1,  
19095 upper: true,
19096 custom: false,
19097 FormatCurrency: function() {  
19098  if(this.prec < 0)
19099   this.prec = ASPx.CultureInfo.currPrec;
19100  this.Round(this.prec);
19101  var bag = [ ];
19102  if(this.positive) {
19103   switch(ASPx.CultureInfo.currPosPattern) {
19104    case 0:
19105     bag.push(ASPx.CultureInfo.currency);
19106     break;
19107    case 2:
19108     bag.push(ASPx.CultureInfo.currency, " ");     
19109     break;     
19110   }
19111  } else {
19112   switch(ASPx.CultureInfo.currNegPattern) {
19113    case 0:
19114     bag.push("(", ASPx.CultureInfo.currency);
19115     break;
19116    case 1:
19117     bag.push("-", ASPx.CultureInfo.currency);
19118     break;
19119    case 2:
19120     bag.push(ASPx.CultureInfo.currency, "-");
19121     break;
19122    case 3:
19123     bag.push(ASPx.CultureInfo.currency);
19124     break;
19125    case 4:
19126     bag.push("(");
19127     break;
19128    case 5:
19129    case 8:
19130     bag.push("-");
19131     break;
19132    case 9:
19133     bag.push("-", ASPx.CultureInfo.currency, " ");
19134     break;
19135    case 11:
19136     bag.push(ASPx.CultureInfo.currency, " ");
19137     break;
19138    case 12:
19139     bag.push(ASPx.CultureInfo.currency, " -");
19140     break;
19141    case 14:
19142     bag.push("(", ASPx.CultureInfo.currency, " ");
19143     break;
19144    case 15:
19145     bag.push("(");
19146     break;
19147   }
19148  }
19149  this.AppendGroupedInteger(bag, ASPx.CultureInfo.currGroups, ASPx.CultureInfo.currGroupSeparator);
19150  if(this.prec > 0) {
19151   bag.push(ASPx.CultureInfo.currDecimalPoint);
19152   this.AppendDigits(bag, this.pointPos, this.pointPos + this.prec);
19153  }
19154  if(this.positive) {
19155   switch(ASPx.CultureInfo.currPosPattern) {
19156    case 1:
19157     bag.push(ASPx.CultureInfo.currency);
19158     break;
19159    case 3:
19160     bag.push(" ", ASPx.CultureInfo.currency);
19161     break;     
19162   }   
19163  } else {
19164   switch(ASPx.CultureInfo.currNegPattern) {
19165    case 0:
19166    case 14:
19167     bag.push(")");
19168     break;
19169    case 3:
19170     bag.push("-");
19171     break;
19172    case 4:
19173     bag.push(ASPx.CultureInfo.currency, ")");
19174     break;
19175    case 5:
19176     bag.push(ASPx.CultureInfo.currency);
19177     break;
19178    case 6:
19179     bag.push("-", ASPx.CultureInfo.currency);
19180     break;
19181    case 7:
19182     bag.push(ASPx.CultureInfo.currency, "-");
19183     break;
19184    case 8:
19185     bag.push(" ", ASPx.CultureInfo.currency);
19186     break;
19187    case 10:
19188     bag.push(" ", ASPx.CultureInfo.currency, "-");
19189     break;
19190    case 11:
19191     bag.push("-");
19192     break;
19193    case 13:
19194     bag.push("- ", ASPx.CultureInfo.currency);
19195     break;
19196    case 15:
19197     bag.push(" ", ASPx.CultureInfo.currency, ")");
19198     break;
19199   }
19200  }
19201  return bag.join("");
19202 }, 
19203 FormatDecimal: function() {
19204  if(this.prec < this.pointPos)
19205   this.prec = this.pointPos;
19206  if(this.prec < 1)
19207   return "0";
19208  var bag = [ ];
19209  if(!this.positive)
19210   bag.push("-");
19211  this.AppendDigits(bag, this.pointPos - this.prec, this.pointPos);
19212  return bag.join("");
19213 },
19214 FormatExp: function() {  
19215  if(this.prec < 0)
19216   this.prec = 6;
19217  this.Round(1 - this.pointPos + this.prec);
19218  return this.FormatExpCore(3);
19219 },
19220 FormatExpCore: function(minExpDigits) {
19221  var bag = [ ];
19222  if(!this.positive)
19223   bag.push("-");
19224  this.AppendDigits(bag, 0, 1);
19225  if(this.prec > 0) {
19226   bag.push(ASPx.CultureInfo.numDecimalPoint);
19227   this.AppendDigits(bag, 1, 1 + this.prec);
19228  }
19229  bag.push(this.upper ? "E" : "e");
19230  var order = this.pointPos - 1;  
19231  if(order >= 0) {
19232   bag.push("+");
19233  } else {
19234   bag.push("-");
19235   order = -order;
19236  }
19237  var orderStr = String(order);
19238  for(var i = orderStr.length; i < minExpDigits; i++)
19239   bag.push(0);
19240  bag.push(orderStr);
19241  return bag.join("");
19242 },
19243 FormatFixed: function() {
19244  if(this.prec < 0)
19245   this.prec = ASPx.CultureInfo.numPrec;
19246  this.Round(this.prec);
19247  var bag = [ ];
19248  if(!this.positive)
19249   bag.push("-");
19250  if(this.pointPos < 1)
19251   bag.push(0);
19252  else
19253   this.AppendDigits(bag, 0, this.pointPos);
19254  if(this.prec > 0) {
19255   bag.push(ASPx.CultureInfo.numDecimalPoint);
19256   this.AppendDigits(bag, this.pointPos, this.pointPos + this.prec);
19257  }
19258  return bag.join(""); 
19259 },
19260 FormatGeneral: function() {
19261  var hasFrac = this.pointPos < this.digits.length;
19262  var allowExp;
19263  if(this.prec < 0) {
19264   allowExp = hasFrac;
19265   this.prec = hasFrac ? 15 : 10;
19266  } else {   
19267   allowExp = true;
19268   if(this.prec < 1)
19269    this.prec = hasFrac ? 15 : 10;
19270   this.Round(this.prec - this.pointPos);
19271  }
19272  if(allowExp) {
19273   if(this.pointPos > this.prec || this.pointPos <= -4) {
19274    this.prec = this.digits.length - 1;
19275    return this.FormatExpCore(2);
19276   }
19277  }
19278  this.prec = Math.min(this.prec, Math.max(1, this.digits.length)) - this.pointPos;
19279  return this.FormatFixed();
19280 },
19281 FormatNumber: function() {
19282  if(this.prec < 0)
19283   this.prec = ASPx.CultureInfo.numPrec;
19284  this.Round(this.prec);
19285  var bag = [ ];
19286  if(!this.positive) {
19287   switch(ASPx.CultureInfo.numNegPattern) {
19288    case 0:
19289     bag.push("(");
19290     break;
19291    case 1:
19292     bag.push("-");
19293     break;
19294    case 2:
19295     bag.push("- ");
19296     break;
19297   }
19298  }
19299  this.AppendGroupedInteger(bag, ASPx.CultureInfo.numGroups, ASPx.CultureInfo.numGroupSeparator);
19300  if(this.prec > 0) {
19301   bag.push(ASPx.CultureInfo.numDecimalPoint);
19302   this.AppendDigits(bag, this.pointPos, this.pointPos + this.prec);
19303  }
19304  if(!this.positive) {
19305   switch(ASPx.CultureInfo.numNegPattern) {
19306    case 0:
19307     bag.push(")");
19308     break;
19309    case 3:
19310     bag.push("-");
19311     break;
19312    case 4:
19313     bag.push(" -");
19314     break;
19315   }
19316  }
19317  return bag.join("");
19318 },
19319 FormatPercent: function() {
19320  if(this.prec < 0)
19321   this.prec = ASPx.CultureInfo.numPrec;
19322  if(this.digits.length > 0)
19323   this.pointPos += 2;
19324  this.Round(this.prec);
19325  var bag = [ ];
19326  if(!this.positive)
19327   bag.push("-");
19328  if(ASPx.CultureInfo.percentPattern == 2)
19329   bag.push("%");    
19330  this.AppendGroupedInteger(bag, ASPx.CultureInfo.numGroups, ASPx.CultureInfo.numGroupSeparator);
19331  if(this.prec > 0) {
19332   bag.push(ASPx.CultureInfo.numDecimalPoint);
19333   this.AppendDigits(bag, this.pointPos, this.pointPos + this.prec);
19334  }  
19335  switch(ASPx.CultureInfo.percentPattern) {
19336   case 0:
19337    bag.push(" %");
19338    break;
19339   case 1:
19340    bag.push("%");
19341    break;
19342  }  
19343  return bag.join("");
19344 },
19345 FormatHex: function(value) {
19346  var result = value.toString(16);
19347  if(result.indexOf("(") > -1)
19348   return result;
19349  result = this.upper ? result.toUpperCase() : result.toLowerCase();
19350  if(this.prec <= result.length)
19351   return result;
19352  var bag = [ ];
19353  for(var i = result.length; i < this.prec; i++)
19354   bag.push(0);
19355  bag.push(result);
19356  return bag.join("");
19357 },
19358 FormatCustom: function(format) {
19359  var sectionList = this.GetCustomFormatSections(format);
19360  var section = this.SelectCustomFormatSection(sectionList);
19361  if(section == "")
19362   return this.positive ? "" : "-";
19363  var info = this.ParseCustomFormatSection(section);
19364  var lists = this.CreateCustomFormatLists(info);
19365  if(sectionList.length > 2 && section != sectionList[2]) {
19366   var zero = lists.i.concat(lists.f).join("").split(0).join("") == "";
19367   if(zero) {
19368    section = sectionList[2];
19369    info = this.ParseCustomFormatSection(section);
19370    lists = this.CreateCustomFormatLists(info);   
19371   }   
19372  }
19373  return this.FormatCustomCore(section, info, lists);
19374 },
19375 GetCustomFormatSections: function(format) {
19376  var sections = [ ];
19377  var escaping = false;
19378  var quote = "";
19379  var length = 0;
19380  var prevPos = 0;
19381  for(var i = 0; i < format.length; i++) {
19382   var ch = format.charAt(i);
19383   if(!escaping && quote == "" && ch == ";") {
19384    sections.push(format.substr(prevPos, length));
19385    length = 0;
19386    prevPos = i + 1;
19387    if(sections.length > 2)
19388     break;
19389   } else {
19390    if(escaping)
19391     escaping = false;
19392    else if(ch == quote)
19393     quote = quote == "" ? ch : "";
19394    else if(ch == "\\")
19395     escaping = true;
19396    else if(ch == "'" || ch == '"')
19397     quote = ch;
19398    ++length;
19399   }
19400  }
19401  if(length > 0)
19402   sections.push(format.substr(prevPos, length));
19403  if(sections.length < 1)
19404   sections.push(format);
19405  return sections;
19406 },
19407 SelectCustomFormatSection: function(sections) {
19408  if(!this.positive && sections.length > 1 && sections[1] != "") {
19409   this.positive = true;
19410   return sections[1];
19411  }
19412  if(this.digits.length < 1 && sections.length > 2 && sections[2] != "")
19413   return sections[2];
19414  return sections[0];
19415 },
19416 CreateCustomFormatInfo: function() {
19417  return {
19418   pointPos: -1,
19419   grouping: false,
19420   exp: false,
19421   expShowPlus: false,
19422   percent: false,
19423   scaling: 0,
19424   intDigits: 0,
19425   fracDigits: 0,
19426   expDigits: 0,
19427   intSharps: 0,
19428   fracSharps: 0, 
19429   expSharps: 0
19430  };
19431 },
19432 ParseCustomFormatSection: function(section) {  
19433  var quote = "";
19434  var area = "i"; 
19435  var canParseIntSharps = true;
19436  var result = this.CreateCustomFormatInfo();
19437  var groupSeparators = 0;  
19438  for(var i = 0; i < section.length; i++) {
19439   var ch = section.charAt(i);   
19440   if(ch == quote) {
19441    quote = "";    
19442    continue;
19443   }
19444   if(quote != "")
19445    continue;
19446   if(area == "e" && ch != "0" && ch != "#") {
19447    area = result.pointPos < 0 ? "i" : "f";
19448    i--;
19449    continue;
19450   }
19451   switch(ch) {
19452    case "\\":
19453     i++;
19454     continue;
19455    case "'":
19456    case '"':
19457     quote = ch;
19458     continue;
19459    case "#":
19460    case "0":
19461     if(ch == "#") {
19462      switch(area) {
19463       case "i":
19464        if(canParseIntSharps)
19465         result.intSharps++;
19466        break;
19467       case "f":
19468        result.fracSharps++;
19469        break;
19470       case "e":
19471        result.expSharps++;
19472        break;
19473      }
19474     } else {
19475      canParseIntSharps = false;
19476      switch(area) {
19477       case "f":
19478        result.fracSharps = 0;        
19479        break;
19480       case "e":
19481        result.expSharps = 0;
19482        break;
19483      }
19484     }
19485     switch(area) {
19486      case "i":
19487       result.intDigits++;
19488       if(groupSeparators > 0)
19489        result.grouping = true;
19490       groupSeparators = 0;
19491       break;
19492      case "f":
19493       result.fracDigits++;  
19494       break;
19495      case "e":
19496       result.expDigits++;
19497       break;
19498     }
19499     break;
19500    case "e":
19501    case "E":
19502     if(result.exp)
19503      break;
19504     result.exp = true;     
19505     area = "e"; 
19506     if(i < section.length - 1) {
19507      var next = section.charAt(1 + i);
19508      if(next == "+" || next == "-") {
19509       if(next == "+")
19510        result.expShowPlus = true;
19511       i++;
19512      }
19513      else if(next != "0" && next != "#") {
19514       result.exp = false;
19515       if(result.pointPos < 0)
19516        area = "i";       
19517      }
19518     }
19519     break;
19520    case ".":
19521     area = "f";
19522     if(result.pointPos < 0)
19523      result.pointPos = i;
19524     break;
19525    case "%":
19526     result.percent = true;     
19527     break;
19528    case ",":
19529     if(area == "i" && result.intDigits > 0)
19530      groupSeparators++;
19531     break;
19532    default:
19533     break;
19534   }
19535  }
19536  if(result.expDigits < 1)
19537   result.exp = false;
19538  else
19539   result.intSharps = 0;
19540  if(result.fracDigits < 1)
19541   result.pointPos = -1;
19542  result.scaling = 3 * groupSeparators;  
19543  return result;
19544 },
19545 CreateCustomFormatLists: function(info) {
19546  var intList = [ ];
19547  var fracList = [ ];
19548  var expList = [ ];
19549  if(this.digits.length > 0) {
19550   if(info.percent)
19551    this.pointPos += 2;
19552   this.pointPos -= info.scaling;
19553  }
19554  var expPositive = true;
19555  if(info.exp && (info.intDigits > 0 || info.fracDigits > 0)) {
19556   var diff = 0;
19557   if(this.digits.length > 0) {
19558    this.Round(info.intDigits + info.fracDigits - this.pointPos);
19559    diff -= this.pointPos - info.intDigits;
19560    this.pointPos = info.intDigits;
19561   }
19562   expPositive = diff <= 0;   
19563   expList = String(diff < 0 ? -diff : diff).split("");
19564  } else {
19565   this.Round(info.fracDigits);
19566  }
19567  if(this.digits.length < 1 || this.pointPos < 1)
19568   intList = [ 0 ];
19569  else
19570   this.AppendDigits(intList, 0, this.pointPos);
19571  this.AppendDigits(fracList, this.pointPos, this.digits.length);
19572  if(info.exp) {
19573   while(intList.length < info.intDigits)
19574    intList.unshift(0);
19575   while(expList.length < info.expDigits - info.expSharps)
19576    expList.unshift(0);
19577   if(expPositive && info.expShowPlus)
19578    expList.unshift("+");
19579   else if(!expPositive)
19580    expList.unshift("-");
19581  } else {
19582   while(intList.length < info.intDigits - info.intSharps)
19583    intList.unshift(0);    
19584   if(info.intSharps >= info.intDigits) {
19585    var zero = true;
19586    for(var i = 0; i < intList.length; i++) {
19587     if(intList[i] != 0) {
19588      zero = false;
19589      break;
19590     }
19591    }
19592    if(zero)
19593     intList = [ ];
19594   }
19595  }
19596  while(fracList.length < info.fracDigits - info.fracSharps)
19597   fracList.push(0);
19598  return {
19599   i: intList,
19600   f: fracList,
19601   e: expList
19602  };
19603 },
19604 FormatCustomCore: function(section, info, lists) {
19605  var intLen = 0; 
19606  var total = 0;
19607  var groupIndex = 0; 
19608  var counter = 0;
19609  var groupSize = 0;
19610  if(info.grouping && ASPx.CultureInfo.numGroups.length > 0) {
19611   intLen = lists.i.length;
19612   for(var i = 0; i < ASPx.CultureInfo.numGroups.length; i++) {
19613    if(total + ASPx.CultureInfo.numGroups[i] <= intLen) {
19614     total += ASPx.CultureInfo.numGroups[i];
19615     groupIndex = i;
19616    }
19617   }
19618   groupSize = ASPx.CultureInfo.numGroups[groupIndex];
19619   var fraction = intLen > total ? intLen - total : 0;
19620   if(groupSize == 0) {
19621    while(groupIndex >= 0 && ASPx.CultureInfo.numGroups[groupIndex] == 0)
19622     groupIndex--;
19623    groupSize = fraction > 0 ? fraction : ASPx.CultureInfo.numGroups[groupIndex];
19624   }
19625   if(fraction == 0) {
19626    counter = groupSize;
19627   } else {
19628    groupIndex += Math.floor(fraction / groupSize);
19629    counter = fraction % groupSize;
19630    if(counter == 0)
19631     counter = groupSize;
19632    else
19633     groupIndex++;
19634   }
19635  } else {
19636   info.grouping = false;
19637  }
19638  var bag = [ ];
19639  var area = "i";
19640  var intSharps = 0;
19641  var intListIndex = 0;
19642  var fracListIndex = 0;
19643  var savedCh = "";
19644  for(var i = 0; i < section.length; i++) {
19645   var ch = section.charAt(i);
19646   if(ch == savedCh) {
19647    savedCh = "";
19648    continue;
19649   }
19650   if(savedCh != "") {
19651    bag.push(ch);
19652    continue;
19653   }
19654   switch(ch) {
19655    case "\\":
19656     ++i;
19657     if(i < section.length)
19658      bag.push(section.charAt(i));
19659     continue;
19660    case "'":
19661    case '"':     
19662     savedCh = ch;
19663     continue;
19664    case "#":     
19665    case "0":
19666     if(area == "i") {
19667      intSharps++;
19668      if(ch == "0" || info.intDigits - intSharps < lists.i.length + intListIndex) {
19669       while(info.intDigits - intSharps + intListIndex < lists.i.length) {
19670        bag.push(lists.i[intListIndex]);
19671        intListIndex++;
19672        if(info.grouping && --intLen > 0 && --counter == 0) {
19673         bag.push(ASPx.CultureInfo.numGroupSeparator);
19674         if(--groupIndex < ASPx.CultureInfo.numGroups.length && groupIndex >= 0)
19675          groupSize = ASPx.CultureInfo.numGroups[groupIndex];
19676         counter = groupSize;
19677        }
19678       }
19679      }
19680     } else if(area == "f") {
19681      if(fracListIndex < lists.f.length) {
19682       bag.push(lists.f[fracListIndex]);
19683       fracListIndex++;
19684      }
19685     }
19686     break;
19687    case "e":
19688    case "E":
19689     if(lists.e == null || !info.exp) {
19690      bag.push(ch);
19691      break;
19692     }
19693     for(var q = i + 1; q < section.length; q++) {
19694      if(q == i + 1 && (section.charAt(q) == "+" || section.charAt(q) == "-"))
19695       continue;                   
19696      if(section.charAt(q) == "0" || section.charAt(q) == "#")
19697       continue;
19698      break;
19699     }
19700     i = q - 1;
19701     area = info.pointPos < 0 ? "i" : "f";
19702     bag.push(ch);
19703     bag = bag.concat(lists.e);
19704     lists.e = null;      
19705     break;
19706    case ".":
19707     if(info.pointPos == i && lists.f.length > 0)
19708      bag.push(ASPx.CultureInfo.numDecimalPoint);
19709     area = "f";
19710     break;
19711    case ",":
19712     break;
19713    default:
19714     bag.push(ch);
19715     break;
19716   }
19717  }
19718  if(!this.positive)
19719   bag.unshift("-");
19720  return bag.join("");
19721 },
19722 FillDigitInfo: function(value) {
19723  this.positive = true;
19724  if(value < 0) {
19725   value = -value;
19726   this.positive = false;   
19727  }
19728  this.digits = [ ];
19729  this.pointPos = 0;    
19730  if(value == 0 || !isFinite(value) || isNaN(value)) {
19731   this.pointPos = 1;
19732   return;
19733  }
19734  var list = String(value).split("e");
19735  var str = list[0];
19736  if(list.length > 1) {   
19737   this.pointPos = Number(list[1]);
19738  }
19739  var frac = false;
19740  var decimalCount = 0;
19741  for(var i = 0; i < str.length; i++) {
19742   var ch = str.charAt(i);
19743   if(ch == ".") {
19744    frac = true;
19745   } else {
19746    if(frac)
19747     decimalCount++;     
19748    if(ch != "0" || this.digits.length > 0)
19749     this.digits.push(Number(ch));
19750   }
19751  }
19752  this.pointPos += this.digits.length - decimalCount;
19753 },
19754 FillFormatInfo: function(format) {
19755  this.upper = true;
19756  this.custom = false;
19757  this.prec = -1;
19758  var spec;
19759  if(format == null || format.length < 1)
19760   spec = "G";
19761  else
19762   spec = format.charAt(0);
19763  if(spec >= "a" && spec <= "z") {
19764   spec = spec.toUpperCase();
19765   this.upper = false;
19766  }
19767  if(spec >= "A" && spec <= "Z") {   
19768   if(format != null && format.length > 1) {
19769    var prec = Number(format.substr(1));
19770    if(!isNaN(prec))
19771     this.prec = prec;
19772    else
19773     this.custom = true;
19774   }
19775  } else {
19776   this.custom = true;   
19777  }  
19778  this.spec = this.custom ? "0" : spec;
19779 },
19780 Round: function(shift) {
19781  var amount = this.digits.length - this.pointPos - shift;
19782  if(amount <= 0) 
19783   return;
19784  var cutPos = this.pointPos + shift;
19785  if(cutPos < 0) {
19786   this.digits = [ ];
19787   this.pointPos = 0;
19788   return;
19789  }
19790  var digit = this.digits[cutPos];
19791  if(digit > 4) { 
19792   for(var i = 0; i < amount; i++) {
19793    var index = cutPos - 1 - i;
19794    if(index < 0) {
19795     this.digits.unshift(0);
19796     this.pointPos++;
19797     cutPos++;
19798     index++;
19799    }
19800    digit = this.digits[index];    
19801    if(digit < 9) {
19802     this.digits[index] = 1 + digit;
19803     break;
19804    } else {
19805     this.digits[index] = 0;
19806     amount++;
19807    }
19808   }
19809  }
19810  for(var i = cutPos - 1; i >= 0; i--) {
19811   if(this.digits[i] > 0) break;
19812   cutPos--;
19813  }
19814  this.digits.splice(cutPos, this.digits.length - cutPos);
19815 },
19816 AppendGroupedInteger: function(list, groups, separator) { 
19817  if(this.pointPos < 1) {
19818   list.push(0);
19819   return;
19820  }
19821  var total = 0;
19822  var groupIndex = 0;
19823  for(var i = 0; i < groups.length; i++) {
19824   if(total + groups[i] <= this.pointPos) {
19825    total += groups[i];
19826    groupIndex = i;
19827   }
19828   else
19829    break;
19830  }
19831  if(groups.length > 0 && total > 0) {
19832   var counter;
19833   var groupSize = groups[groupIndex];
19834   var fraction = this.pointPos > total ? this.pointPos - total : 0;
19835   if(groupSize == 0) {
19836    while(groupIndex >= 0 && groups[groupIndex] == 0)
19837     groupIndex--;
19838    groupSize = fraction > 0 ? fraction : groups[groupIndex];
19839   }
19840   if(fraction == 0) {
19841    counter = groupSize;
19842   } else {
19843    groupIndex += Math.floor(fraction / groupSize);
19844    counter = fraction % groupSize;
19845    if(counter == 0)
19846     counter = groupSize;
19847    else
19848     groupIndex++;
19849   }
19850   var i = 0;
19851   while(true) {
19852    if(this.pointPos - i <= counter || counter == 0) {
19853     this.AppendDigits(list, i, this.pointPos);
19854     break;
19855    }
19856    this.AppendDigits(list, i, i + counter);
19857    list.push(separator);
19858    i += counter;    
19859    groupIndex--;     
19860    if(groupIndex < groups.length && groupIndex >= 0)
19861     groupSize = groups[groupIndex];
19862    counter = groupSize;
19863   }
19864  } else {
19865   this.AppendDigits(list, 0, this.pointPos);   
19866  }  
19867 },
19868 AppendDigits: function(list, start, end) {
19869  for(var i = start; i < end; i++) {
19870   if(i < 0 || i >= this.digits.length)
19871    list.push(0);
19872   else
19873    list.push(this.digits[i]);
19874  }
19875 }
19876};
19877})();
19878(function() {
19879var dropDownNameSuffix = "_DDD";
19880var itemImageCellClassName = "dxeIIC";
19881var ASPxClientDropDownEditBase = ASPx.CreateClass(ASPxClientButtonEditBase, {
19882 constructor: function(name) {
19883  this.constructor.prototype.constructor.call(this, name);
19884  this.DropDown = new ASPxClientEvent();
19885  this.CloseUp = new ASPxClientEvent();
19886  this.QueryCloseUp = new ASPxClientEvent();
19887  this.ddHeightCache = ASPx.InvalidDimension;
19888  this.ddWidthCache = ASPx.InvalidDimension;
19889  this.mainElementWidthCache = ASPx.InvalidDimension;
19890  this.dropDownButtonIndex = -1;
19891  this.droppedDown = false;
19892  this.ddButtonPushed = false;
19893  this.lastSuccessText = "";
19894  this.isToolbarItem = false;
19895  this.allowFocusDropDownWindow = false;
19896  this.pcIsShowingNow = false;
19897  this.needTimeoutForInputElementFocusEvent = false;
19898  aspxGetDropDownCollection().Add(this);
19899 },
19900 Initialize: function(){
19901  var pc = this.GetPopupControl();
19902  if(pc) {
19903   pc.usedInDropDown = true;
19904   pc.dropDownEditName = this.name;
19905   if(this.accessibilityCompliant)
19906    pc.setFocusOnCallback = false;
19907  }
19908  this.AssignClientAttributes();
19909  this.InitLastSuccessText();
19910  if(this.RefocusOnClickRequired()){ 
19911   ASPx.Evt.AttachEventToElement(this.GetMainElement(), "click", function(evt) {
19912    if(this.GetInputElement() && ASPx.Evt.GetEventSource(evt).id != this.GetInputElement().id) 
19913     this.ForceRefocusEditor(evt);
19914   }.aspxBind(this));
19915  }
19916  if(this.accessibilityCompliant && ASPx.IsExists(this.GetAccessibilityAssistantElement())) {
19917   this.GotFocus.AddHandler(function() { 
19918    this.ariaExplanatoryTextManager.SetHelperLabel(); 
19919   }.aspxBind(this));
19920  }
19921  ASPxClientButtonEditBase.prototype.Initialize.call(this);
19922 },
19923 InitLastSuccessText: function(){
19924  var rawText = this.GetTextInternal();
19925  this.SetLastSuccessText(rawText);
19926 },
19927 AssignClientAttributes: function(){
19928  var element = this.GetDropDownButton();
19929  if(ASPx.IsExistsElement(element))
19930   ASPx.Evt.PreventElementDragAndSelect(element, true);
19931 },
19932 RefocusOnClickRequired: function(){
19933  return false;
19934 },
19935 GetDropDownButton: function(){
19936  return this.GetButton(this.dropDownButtonIndex);
19937 },
19938 GetButtonCollection: function(){
19939  var buttonElements = ASPxClientButtonEditBase.prototype.GetButtonCollection.call(this);
19940  var dropDownButtonElement = this.GetDropDownButton();
19941  if(ASPx.IsExists(dropDownButtonElement))
19942   buttonElements.push(dropDownButtonElement);
19943  return buttonElements;
19944 },
19945 GetPopupControl: function(){
19946  var pc = ASPx.GetControlCollection().Get(this.name + dropDownNameSuffix);
19947  if(pc && pc.GetWindowElement(-1))
19948   return pc;
19949  else
19950   return null;
19951 },
19952 GetDropDownWindow: function() {
19953  var pc = this.GetPopupControl();
19954  if(pc)
19955   return pc.GetWindowElement(-1);
19956  return null;
19957 },
19958 GetDropDownInnerControlName: function(suffix){
19959  var pc = this.GetPopupControl();
19960  if(pc)
19961   return this.GetPopupControl().name + suffix;
19962  return "";
19963 },
19964 GetDropDownItemImageCell: function() {
19965  return ASPx.GetNodesByPartialClassName(this.GetMainElement(), itemImageCellClassName)[0];
19966 },
19967 GetIsControlWidthWasChanged: function(){
19968  return this.mainElementWidthCache == ASPx.InvalidDimension || this.mainElementWidthCache != this.GetMainElement().clientWidth;
19969 },
19970 GetDropDownHeight: function(){
19971  return null;
19972 },
19973 GetDropDownWidth: function(){
19974  return null;
19975 },
19976 GetDropDownIsWindowElement: function(id, pcPostfix) {
19977  var pos = id.lastIndexOf(pcPostfix);
19978  if(pos != -1) {
19979   var name = id.substring(0, pos);
19980   var pc = ASPx.GetPopupControlCollection().Get(name);
19981   if(pc && pc.dropDownEditName)
19982    return aspxGetDropDownCollection().Get(pc.dropDownEditName);
19983  }
19984  return null;
19985 },
19986 GetDropDownParents: function() {
19987  var parents = [ ];
19988  var mainElement = this.GetMainElement();
19989  var element = mainElement.parentNode;
19990  while(element != null){
19991   if(element.tagName == "BODY")
19992    break;
19993   var dropDown = this.GetElementIsDropDownParent(element);
19994   if(dropDown != null)
19995    parents.push(dropDown);
19996   element = element.parentNode;
19997  }
19998  return parents.reverse();
19999 },
20000 GetElementIsDropDownParent: function(element) {
20001  return ASPx.Attr.IsExistsAttribute(element, "id") 
20002   ? this.GetDropDownIsWindowElement(ASPx.Attr.GetAttribute(element, "id"), ASPx.PCWIdSuffix + "-1") : null;
20003 },
20004 BeforePopupControlResizing: function() {
20005 },
20006 AfterPopupControlResizing: function() {
20007 },
20008 ShowDropDownArea: function(isRaiseEvent, forceSize) {
20009  this.SetPCIsShowingNow(true);
20010  aspxGetDropDownCollection().RegisterDroppedDownControl(this, this.GetDropDownParents());
20011  if(!this.droppedDown) 
20012   this.SetLockListBoxClick();
20013  this.lockClosing = true; 
20014  var pc = this.GetPopupControl();
20015  var element = this.GetMainElement();
20016  var pcwElement = pc.GetCurrentWindowElement();
20017  pc.OnBeforeDropdownShow();
20018  if(ASPx.Browser.Chrome && pcwElement.clientHeight <= 0) 
20019   this.RestorePopupInsideNonStaticPositionedContainer();
20020  var height = forceSize ? forceSize.height : this.GetDropDownHeight();
20021  var width = forceSize ? forceSize.width : this.GetDropDownWidth();
20022  this.BeforePopupControlResizing();
20023  if(this.ddHeightCache != height || this.ddWidthCache != width || forceSize) {
20024   pc.SetSize(width, height);
20025   if(!forceSize) {
20026    this.ddHeightCache = height;
20027    this.ddWidthCache = width;
20028   }
20029  }
20030  this.AfterPopupControlResizing();
20031  if(ASPx.Browser.Chrome && pcwElement.clientHeight <= 0) 
20032   this.RestorePopupInsideNonStaticPositionedContainer();
20033  pc.popupVerticalOffset = - ASPx.GetClientTop(element);
20034  this.RaiseDropDownEventRequired = isRaiseEvent;
20035  pc.ShowAtElement(element);
20036  this.droppedDown = true;
20037  this.lockClosing = false;
20038 },
20039 HideDropDownArea: function(isRaiseEvent){
20040  if(this.lockClosing || !this.droppedDown) return;
20041  if(!this.RaiseQueryCloseUp()) {
20042   return;
20043  }
20044  this.RemoveLockListBoxClick();
20045  this.DropDownButtonPop();
20046  var pc = this.GetPopupControl();
20047  if(pc){
20048   aspxGetDropDownCollection().UnregisterDroppedDownControl(this);
20049   pc.Hide();
20050   if(isRaiseEvent)
20051    this.RaiseCloseUp();
20052   this.droppedDown = false;
20053  }
20054 },
20055 RestorePopupInsideNonStaticPositionedContainer: function() {
20056  var pc = this.GetPopupControl();
20057  var pcwElement = pc.GetCurrentWindowElement();
20058  var pcwParentElement = pcwElement.parentNode;
20059  var offsetParentElement = pcwElement.offsetParent;
20060  if(!offsetParentElement || offsetParentElement.tagName == "BODY") return;
20061  pcwParentElement.style.position = "relative";
20062  setTimeout(
20063   function() { 
20064    pcwParentElement.style.position = "";
20065    if(this.focused)
20066     pc.ShowAtElement(this.GetMainElement());
20067   }.aspxBind(this), 0);
20068 },
20069 SetLockListBoxClick: function() {
20070  this.lockListBoxClick = true;
20071 },
20072 RemoveLockListBoxClick: function() {
20073  delete this.lockListBoxClick;
20074 },
20075 ProcessInternalButtonClick: function(buttonIndex) {
20076  return this.dropDownButtonIndex == buttonIndex;
20077 },
20078 ToggleDropDown: function(){
20079  this.OnApplyChanges();
20080  if(this.droppedDown)
20081   this.HideDropDownArea(true);
20082  else
20083   this.ShowDropDownArea(true);  
20084 },
20085 GetTextInternal: function(){
20086  var text = ASPxClientButtonEditBase.prototype.GetValue.call(this);
20087  return text != null ? text : "";
20088 },
20089 SetTextInternal: function(text){
20090  if(!this.GetReadOnly())
20091   this.SetTextBase(text);
20092 },
20093 SetTextBase: function(text) {
20094  ASPxClientButtonEditBase.prototype.SetValue.call(this, text);
20095 },
20096 SetValue: function(value) {
20097  ASPxClientButtonEditBase.prototype.SetValue.call(this, value);
20098  this.SetLastSuccessText(this.GetTextInternal());
20099 },
20100 SetLastSuccessText: function(text){
20101  var tmpText = text;
20102  if(text == null) tmpText = "";
20103  else if(typeof(text) != "string")
20104     tmpText = text.toString();
20105  this.lastSuccessText = tmpText;
20106 },
20107 SetVisible: function(visible) {
20108  ASPxClientButtonEditBase.prototype.SetVisible.call(this, visible);
20109  if(!visible)
20110   this.HideDropDown();
20111 },
20112 RollbackTextInputValue: function () {
20113  this.SetTextBase(this.lastSuccessText);
20114 },
20115 SetPCIsShowingNow: function(value){
20116  this.pcIsShowingNow = value;
20117 },
20118 GetLastSuccesfullValue: function() {
20119  return this.lastSuccessText !== '' ? this.lastSuccessText : null;
20120 },
20121 CreateAriaExplanatoryTextManager: function() {
20122  if(this.accessibilityCompliant)
20123   return new DropDownAccessibilityExplanatoryTextManager(this);
20124  else 
20125   return new ASPx.DisableAccessibilityExplanatoryTextManager(this);
20126 },
20127 GetAccessibilityText: function() {
20128  var labelText = "";
20129  var helperContainer = this.GetAccessibilityAssistantElement();
20130  if(ASPx.IsExists(helperContainer))
20131   labelText = ASPx.Attr.GetAttribute(helperContainer, "aria-label");
20132  return !!labelText ? labelText : this.GetTextInternal();
20133 },
20134 GetAccessibilityActiveElements: function() {
20135  var helperContainer = this.GetAccessibilityAssistantElement();
20136  if(!this.accessibilityCompliant || !ASPx.IsExists(helperContainer))
20137   return [this.GetInputElement()];
20138  else if(ASPx.IsExists(this.accessibilityHelper))
20139   return [this.accessibilityHelper.GetActiveElement(true)];
20140  else 
20141   return [helperContainer];
20142 },
20143 OnValueChanged: function() {
20144  this.SetLastSuccessText(this.GetTextInternal());
20145  ASPxClientEdit.prototype.OnValueChanged.call(this);
20146 },
20147 OnApplyChanges: function(){
20148 },
20149 OnCancelChanges: function(){
20150  var isCancelProcessed = (this.GetTextInternal() != this.lastSuccessText);
20151  this.SetTextInternal(this.lastSuccessText);
20152  return isCancelProcessed;
20153 },
20154 OnFocus: function () {
20155  if(this.CorrectFocusWhenDisabled())
20156   return;
20157  if(ASPx.Browser.IE && this.needTimeoutForInputElementFocusEvent) {
20158   setTimeout(function () {
20159    this.OnFocusInternal();
20160    this.needTimeoutForInputElementFocusEvent = false;
20161   }.aspxBind(this), 0);
20162  } else
20163   this.OnFocusInternal();
20164 },
20165 OnFocusInternal: function() {
20166  this.OnSetFocus(true);
20167  ASPxClientButtonEditBase.prototype.OnFocus.call(this);
20168 },
20169 OnLostFocus: function(){
20170  this.OnSetFocus(false);
20171  ASPxClientButtonEditBase.prototype.OnLostFocus.call(this);
20172 },
20173 OnSetFocus: function(isFocused){
20174  aspxGetDropDownCollection().SetFocusedDropDownName(isFocused ? this.name : "");
20175 },
20176 IsEditorElement: function(element) {
20177  if(ASPxClientButtonEditBase.prototype.IsEditorElement.call(this, element))
20178   return true;
20179  if(this.allowFocusDropDownWindow)
20180   return false;
20181  var pc = this.GetPopupControl();
20182  if(pc != null) {
20183   var windowElement = pc.GetCurrentWindowElement();
20184   return windowElement == element || ASPx.GetIsParent(windowElement, element);
20185  }
20186  return false;
20187 },
20188 OnPopupControlShown: function(){
20189  this.SetPCIsShowingNow(false);
20190  if(this.RaiseDropDownEventRequired){
20191   this.RaiseDropDownEventRequired = false;
20192   window.setTimeout(function() { this.RaiseDropDown(); }.aspxBind(this), 0);
20193  }
20194 },
20195 IsCanToDropDown: function(){
20196  return true;
20197 },
20198 OnDropDown: function(evt) { 
20199  if(!this.isInitialized) 
20200   return true;
20201  if(!this.IsCanToDropDown()) {
20202   this.ForceRefocusEditor(evt);
20203   return true;
20204  }
20205  if(ASPx.Browser.IE && ASPx.Browser.Version < 9 || ASPx.Browser.Opera){
20206   if(!this.droppedDown) {
20207    ASPx.Evt.EmulateOnMouseDown(this.GetMainElement(), evt);
20208    ASPx.GetStateController().ClearSavedCurrentPressedElement();
20209   }
20210  }
20211  this.OnDropDownCore(evt);
20212  return ASPx.Evt.CancelBubble(evt); 
20213 },
20214 OnDropDownCore: function(evt) {
20215  if(!this.droppedDown)
20216   this.DropDownButtonPush();
20217  this.ToggleDropDown();
20218  var inputElement = this.GetInputElement();
20219  var isNativeFocus = !!inputElement ? this.IsElementBelongToInputElement(ASPx.Evt.GetEventSource(evt)) : false;
20220  this.ForceRefocusEditor(evt, isNativeFocus);
20221 },
20222 DropDownButtonPush: function(){
20223  if(this.droppedDown || this.ddButtonPushed) return;
20224  this.ddButtonPushed = true;
20225  if(ASPx.Browser.IE && ASPx.Browser.Version < 9 || ASPx.Browser.Opera)
20226   this.DropDownButtonPushPop(true);
20227  else
20228   this.DropDownButtonPushMozilla();
20229 }, 
20230 DropDownButtonPop: function(force){
20231  if((!this.droppedDown || !this.ddButtonPushed) && !force) return;
20232  this.ddButtonPushed = false;
20233  if(ASPx.Browser.IE && ASPx.Browser.Version < 9 || ASPx.Browser.Opera)
20234   this.DropDownButtonPushPop(false);
20235  else
20236   this.DropDownButtonPopMozilla();
20237 },
20238 DropDownButtonPushPop: function(isPush){
20239  var buttonElement = this.GetDropDownButton();
20240  if(buttonElement){
20241   var controller = ASPx.GetStateController();
20242   var element = controller.GetPressedElement(buttonElement);
20243   if(element){
20244    if(isPush){
20245     controller.SetCurrentHoverElement(null);
20246     controller.DoSetPressedState(element);
20247    } else {
20248     controller.DoClearPressedState(element);
20249     controller.SetCurrentPressedElement(null);
20250     controller.SetCurrentHoverElement(element);
20251    }
20252   }
20253  }
20254 },
20255 DropDownButtonPushMozilla: function(){
20256  this.DisableStyleControllerForDDButton();
20257  var controller = ASPx.GetStateController();
20258  controller.savedCurrentPressedElement = null;
20259 },
20260 DropDownButtonPopMozilla: function(){
20261  this.EnableStyleControllerForDDButton();
20262  var controller = ASPx.GetStateController();
20263  var buttonElement = this.GetDropDownButton();
20264  if(buttonElement){
20265   var element = controller.GetPressedElement(buttonElement);
20266   if(element)
20267    controller.DoClearPressedState(element);
20268   controller.currentPressedElement = null;
20269   element = controller.GetHoverElement(buttonElement);
20270   if(element)
20271    controller.SetCurrentHoverElement(element);
20272  }
20273 },
20274 EnableStyleControllerForDDButton: function(){
20275  var element = this.GetDropDownButton();
20276  if(element){
20277   var controller = ASPx.GetStateController();
20278   this.ReplaceElementControlStyleItem(controller.hoverItems, ASPx.HoverItemKind, element, this.ddButtonHoverStyle);
20279   this.ReplaceElementControlStyleItem(controller.pressedItems, ASPx.PressedItemKind, element, this.ddButtonPressedStyle);
20280   this.ReplaceElementControlStyleItem(controller.selectedItems, ASPx.SelectedItemKind, element, this.ddButtonSelectedStyle);
20281  }
20282 },
20283 DisableStyleControllerForDDButton: function(){
20284  var element = this.GetDropDownButton();
20285  if(element){
20286   var controller = ASPx.GetStateController();
20287   this.ddButtonHoverStyle = this.ReplaceElementControlStyleItem(controller.hoverItems, ASPx.HoverItemKind, element, null);
20288   this.ddButtonPressedStyle = this.ReplaceElementControlStyleItem(controller.pressedItems, ASPx.PressedItemKind, element, null);
20289   this.ddButtonSelectedStyle = this.ReplaceElementControlStyleItem(controller.selectedItems, ASPx.SelectedItemKind, element, null);
20290  }
20291 },
20292 ReplaceElementControlStyleItem: function(items, kind, element, newStyleItem){
20293  var styleItem = items[element.id];
20294  items[element.id] = newStyleItem;
20295  element[kind] = newStyleItem;
20296  return styleItem;
20297 },
20298 CloseDropDownByDocumentOrWindowEvent: function(causedByWindowResizing){
20299  if(!causedByWindowResizing || !this.pcIsShowingNow)
20300   this.HideDropDownArea(true);
20301 },
20302 OnDocumentMouseUp: function() {
20303  this.DropDownButtonPop();
20304 },
20305 OnDDButtonMouseMove: function(evt){
20306 },
20307 ShouldCloseOnMCMouseDown: function () {
20308  return true;
20309 },
20310 OnMainCellMouseDown: function (evt) {
20311  if(this.ShouldCloseOnMCMouseDown())
20312   this.OnCloseUp(evt);
20313 },
20314 OnCloseUp: function (evt) {
20315  if(ASPx.Browser.IE) {
20316   this.needTimeoutForInputElementFocusEvent = true;
20317   setTimeout(function () { this.HideDropDownArea(true); }.aspxBind(this), 0);
20318  } else {
20319   this.HideDropDownArea(true);
20320  }
20321 },
20322 OnOpenAnotherDropDown: function(){
20323  this.HideDropDownArea(true);
20324 },
20325 OnTextChanged: function() {
20326  if(!this.ChangedByEnterKeyPress())
20327   this.OnTextChangedInternal();
20328 },
20329 OnTextChangedInternal: function() {
20330  this.ParseValue();
20331 },
20332 ChangedByEnterKeyPress: function() {
20333  if(ASPx.Browser.Firefox || ASPx.Browser.WebKitFamily) 
20334   if(this.enterKeyPressed) {
20335    this.enterKeyPressed = false;
20336    return true;
20337   } 
20338  return false;
20339 },
20340 ChangeEnabledAttributes: function(enabled){
20341  ASPxClientButtonEditBase.prototype.ChangeEnabledAttributes.call(this, enabled);
20342  var btnElement = this.GetDropDownButton();
20343  if(btnElement)
20344   this.ChangeButtonEnabledAttributes(btnElement, this.GetChangeButtonEnabledAttributesMethod(enabled));
20345  var inputElement = this.GetInputElement();
20346  if(inputElement)
20347   this.ChangeInputCellEnabledAttributes(inputElement.parentNode, ASPx.Attr.ChangeAttributesMethod(enabled));
20348  var imageCell = this.GetDropDownItemImageCell();
20349  if(ASPx.IsExists(imageCell))
20350   this.ChangeImageCellEnabledAttributes(imageCell, ASPx.Attr.ChangeAttributesMethod(enabled));
20351 },
20352 ChangeEnabledStateItems: function(enabled){
20353  ASPxClientButtonEditBase.prototype.ChangeEnabledStateItems.call(this, enabled);
20354  var btnElement = this.GetDropDownButton();
20355  if(btnElement)
20356   ASPx.GetStateController().SetElementEnabled(btnElement, enabled);
20357 },
20358 ChangeInputCellEnabledAttributes: function(element, method){
20359  method(element, "onclick");
20360  method(element, "onkeyup");
20361  if(ASPx.Browser.Edge)
20362   method(element, "onmousedown");
20363  method(element, "on" + ASPx.TouchUIHelper.touchMouseDownEventName);
20364  method(element, "on" + ASPx.TouchUIHelper.touchMouseUpEventName);
20365 },
20366 ChangeImageCellEnabledAttributes: function(imageCell, method){
20367  method(imageCell, "onmousedown");
20368 },
20369 InitializeKeyHandlers: function() {
20370  this.AddKeyDownHandler(ASPx.Key.Enter, "OnEnter");
20371  this.AddKeyDownHandler(ASPx.Key.Esc, "OnEscape");
20372  this.AddKeyDownHandler(ASPx.Key.PageUp, "OnPageUp");
20373  this.AddKeyDownHandler(ASPx.Key.PageDown, "OnPageDown");
20374  this.AddKeyDownHandler(ASPx.Key.End, "OnEndKeyDown");
20375  this.AddKeyDownHandler(ASPx.Key.Home, "OnHomeKeyDown");
20376  this.AddKeyDownHandler(ASPx.Key.Left, "OnArrowLeft");
20377  this.AddKeyDownHandler(ASPx.Key.Right, "OnArrowRight");
20378  this.AddKeyDownHandler(ASPx.Key.Up, "OnArrowUp");
20379  this.AddKeyDownHandler(ASPx.Key.Down, "OnArrowDown");
20380  this.AddKeyDownHandler(ASPx.Key.Tab, "OnTab");
20381 },
20382 OnArrowUp: function(evt){
20383  if(evt.altKey) {
20384   this.ToggleDropDown();
20385   return true;
20386  }
20387  return false;
20388 },
20389 OnArrowDown: function(evt){
20390  if(evt.altKey) {
20391   this.ToggleDropDown();
20392   return true;
20393  }
20394  return false;
20395 },
20396 OnPageUp: function(evt){
20397  return false;
20398 }, 
20399 OnPageDown: function(evt){
20400  return false;
20401 },
20402 OnEndKeyDown: function(evt){
20403  return false;
20404 },
20405 OnHomeKeyDown: function(evt){
20406  return false;
20407 },
20408 OnArrowLeft: function(evt){
20409  return false;
20410 },
20411 OnArrowRight: function(evt){
20412  return false;
20413 },
20414 OnEscape: function(evt){
20415  return this.OnEscapeInternal();
20416 },
20417 OnEscapeInternal: function() {
20418  var isCancelProcessed = this.OnCancelChanges() || this.droppedDown;
20419  this.HideDropDownArea(true);
20420  return isCancelProcessed;
20421 },
20422 OnEnter: function(evt){
20423  return false;
20424 },
20425 OnTab: function(evt){
20426  return false;
20427 },
20428 RaiseCloseUp: function(){
20429  if(!this.CloseUp.IsEmpty()){
20430   var args = new ASPxClientEventArgs();
20431   this.CloseUp.FireEvent(this, args);
20432  }
20433 },
20434 RaiseDropDown: function(){
20435  if(!this.DropDown.IsEmpty() && this.isInitialized){
20436   var args = new ASPxClientEventArgs();
20437   this.DropDown.FireEvent(this, args);
20438  }
20439 },
20440 RaiseQueryCloseUp: function(){
20441  if(!this.QueryCloseUp.IsEmpty() && this.isInitialized) {
20442   var args = new ASPxClientCancelEventArgs();
20443   this.QueryCloseUp.FireEvent(this, args);
20444   return !args.cancel;
20445  }
20446  return true;
20447 },
20448 AdjustDropDownWindow: function(){
20449  var pc = this.GetPopupControl();
20450  if(pc) {
20451   if(ASPx.Browser.IE)
20452    ASPx.GetPopupControlCollection().LockWindowResizeByBodyScrollVisibilityChanging();
20453   pc.AdjustSize();
20454   pc.UpdatePositionAtElement(this.GetMainElement());
20455   if(ASPx.Browser.IE)
20456    ASPx.GetPopupControlCollection().UnlockWindowResizeByBodyScrollVisibilityChanging();
20457  }
20458 },
20459 ResetDropDownSizeCache: function(){
20460  this.ddHeightCache = ASPx.InvalidDimension;
20461  this.ddWidthCache = ASPx.InvalidDimension;
20462 },
20463 ShowDropDown: function(){
20464  if(!this.droppedDown)
20465   this.ShowDropDownArea(false);
20466 },
20467 HideDropDown: function(){
20468  if(this.droppedDown)
20469   this.HideDropDownArea(false);
20470 }
20471});
20472var ASPxClientDropDownEdit = ASPx.CreateClass(ASPxClientDropDownEditBase, {
20473 constructor: function(name) {
20474  this.constructor.prototype.constructor.call(this, name);
20475  this.LostFocusInternal = new ASPxClientEvent();
20476  this.dropDownWindowHeight = "";
20477  this.dropDownWindowWidth = "";
20478  this.allowFocusDropDownWindow = true;
20479  this.needAdjustControlsInDropDownWindow = true;
20480 },
20481 InlineInitialize: function(){
20482  this.InitSpecialKeyboardHandling();
20483  this.InitializeEvents();
20484  this.eventHandlersInitialized = true;
20485  ASPxClientDropDownEditBase.prototype.InlineInitialize.call(this);
20486 },
20487 InitializeEvents: function() {
20488  this.LostFocus.AddHandler(this.ProcessLostFocus.aspxBind(this));
20489  this.QueryCloseUp.AddHandler(this.ProcessQueryCloseUp.aspxBind(this));
20490  ASPxClientDropDownEditBase.prototype.InitializeEvents.call(this);
20491 },
20492 RefocusOnClickRequired: function(){
20493  return ASPx.Browser.IE;
20494 },
20495 BeforePopupControlResizing: function() {
20496  var divContainer = this.GetDropDownDivContainer();
20497  if(divContainer && this.needAdjustControlsInDropDownWindow) {
20498   this.AdjustControlsInDropDownWindow();
20499   ASPx.SetElementDisplay(divContainer, false);
20500  }
20501 },
20502 AfterPopupControlResizing: function() {
20503  var divContainer = this.GetDropDownDivContainer();
20504  if(divContainer && this.needAdjustControlsInDropDownWindow) {
20505   ASPx.SetElementDisplay(divContainer, true);
20506   this.AdjustControlsInDropDownWindow();
20507   this.needAdjustControlsInDropDownWindow = false;
20508  }
20509 },
20510 AdjustControlsInDropDownWindow: function() {
20511  var pc = this.GetPopupControl();
20512  var pcwElement = pc.GetCurrentWindowElement();
20513  ASPx.GetControlCollection().ProcessControlsInContainer(pcwElement, function(control) {
20514   control.AdjustControl(false);
20515  });
20516 },
20517 GetDropDownDivContainer: function() {
20518  return ASPx.GetElementById(this.name + dropDownNameSuffix + "_DDDC");
20519 },
20520 GetDropDownHeight: function(){
20521  if(this.dropDownWindowHeight != "")
20522   return this.dropDownWindowHeight;
20523  return ASPxClientDropDownEditBase.prototype.GetDropDown
20523Height.call(this);
20524 },
20525 GetDropDownWidth: function(){
20526  if(this.dropDownWindowWidth != "")
20527   return this.dropDownWindowWidth;
20528  return this.GetMainElement().offsetWidth;
20529 },
20530 CloseDropDownByDocumentOrWindowEvent: function(causedByWindowResizing){
20531  if(!ASPx.GetPopupControlCollection().WindowResizeByBodyScrollVisibilityChangingLocked())
20532   ASPxClientDropDownEditBase.prototype.CloseDropDownByDocumentOrWindowEvent.call(this, causedByWindowResizing);
20533 },
20534 OnBrowserWindowResize: function(e){
20535  this.needAdjustControlsInDropDownWindow = true;
20536 },
20537 OnEnter: function(evt){
20538  return this.droppedDown;
20539 },
20540 OnEscape: function(evt){
20541  var isCancelProcessed = this.droppedDown;
20542  this.HideDropDownArea(true);
20543  return isCancelProcessed;
20544 },
20545 OnTextChanged: function() {
20546  this.OnValueChanged();
20547 },
20548 ProcessLostFocus: function() {
20549  if(!this.droppedDown)
20550   this.RaiseLostFocusInternal();
20551 },
20552 ProcessQueryCloseUp: function() {
20553  if(this.focused)
20554   return;
20555  var forceRefocusTimeout = 150;
20556  setTimeout(function() {
20557   if(!this.IsDropDownContainsFocus())
20558    this.RaiseLostFocusInternal();
20559  }.aspxBind(this), forceRefocusTimeout);
20560 },
20561 IsDropDownContainsFocus: function() {
20562  return ASPx.GetIsParent(this.GetDropDownWindow(), ASPx.GetActiveElement());
20563 },
20564 GetKeyValueInternal: function(){
20565  if(ASPx.IsExists(this.stateObject))
20566   return this.stateObject.keyValue;
20567  return null;
20568 },
20569 SetKeyValueInternal: function(keyValue){
20570  this.UpdateStateObjectWithObject({ keyValue: keyValue });
20571 },
20572 GetValueString: function() {
20573  var value = this.GetKeyValue();
20574  return (value == null) ? ASPxClientDropDownEditBase.prototype.GetValueString.call(this) : value.toString();
20575 },
20576 GetKeyValue: function(){
20577  return this.GetKeyValueInternal();
20578 },
20579 SetKeyValue: function(keyValue){
20580  this.SetKeyValueInternal(keyValue);
20581 },
20582 RaiseLostFocusInternal: function() {
20583  if(this.LostFocusInternal.IsEmpty() || !this.isInitialized)
20584   return;
20585  var args = new ASPxClientEventArgs();
20586  this.LostFocusInternal.FireEvent(this, args);
20587 }
20588});
20589ASPxClientDropDownEdit.Cast = ASPxClientControl.Cast;
20590var ASPxClientDropDownCollection = ASPx.CreateClass(ASPxClientControlCollection, {
20591 constructor: function() {
20592  this.constructor.prototype.constructor.call(this);
20593  this.droppedControlName = "";
20594  this.droppedParentNames = [ ];
20595  this.focusedControlName = "";
20596 },
20597 GetCollectionType: function(){
20598  return "DropDown";
20599 },
20600 SetFocusedDropDownName: function(name){
20601  this.focusedControlName = name;
20602 },
20603 ResetDroppedDownControl: function(){
20604  this.droppedControlName = "";
20605 },
20606 ResetDroppedDownParentCollection: function(startDroppedDownControlName) {
20607  var regArray = [ ];
20608  for(var i = 0; i < this.droppedParentNames.length; i++) {
20609   if(this.droppedParentNames[i] == startDroppedDownControlName)
20610    break;
20611   regArray.push(this.droppedParentNames[i]);
20612  }
20613  this.droppedParentNames = regArray;
20614  if(this.droppedParentNames.length > 0) {
20615   this.droppedControlName = this.droppedParentNames[this.droppedParentNames.length - 1];
20616   ASPx.Data.ArrayRemoveAt(this.droppedParentNames, this.droppedParentNames.length - 1);
20617  }
20618 },
20619 ResetFocusedControl: function(){
20620  this.focusedControlName = "";
20621 },
20622 GetFocusedDropDown: function(){
20623  var control = this.GetDropDownControlInternal(this.focusedControlName);
20624  if(control == null) this.ResetFocusedControl();
20625  return control;
20626 },
20627 GetDroppedDropDown: function(){
20628  var control = this.GetDropDownControlInternal(this.droppedControlName);
20629  if(control == null) this.ResetDroppedDownControl();
20630  return control;
20631 },
20632 GetDroppedDropDownParents: function(startDroppedDownControlName) {
20633  var dropDownArray = [ ];
20634  var isNeedGetControl = false;
20635  for(var i = 0; i < this.droppedParentNames.length; i++) {
20636   if(this.droppedParentNames[i] == startDroppedDownControlName) isNeedGetControl = true;
20637   if(isNeedGetControl) {
20638    var control = this.GetDropDownControlInternal(this.droppedParentNames[i]);
20639    if(control != null)
20640     dropDownArray.push(control);
20641   }
20642  }
20643  return dropDownArray;
20644 },
20645 FindFirstNameForClose: function(newDroppedDownParentArray) {
20646  var firstNameToClose = newDroppedDownParentArray.length > 0 ? "" : this.droppedParentNames[i];
20647  for(var i = 0; i < this.droppedParentNames.length; i++) {
20648   if(ASPx.Data.ArrayIndexOf(newDroppedDownParentArray, this.Get(this.droppedParentNames[i])) == -1) {
20649    firstNameToClose = this.droppedParentNames[i];
20650    break;
20651   }
20652  }
20653  return firstNameToClose;
20654 },
20655 GetDropDownControlInternal: function(name){
20656  var control = this.Get(name);
20657  var isControlExists = control && !control.IsDOMDisposed();
20658  if(!isControlExists)
20659   control = null;
20660  return control;
20661 },
20662 IsDroppedDropDownParentExist: function(name) {
20663  for(var i = 0; i < this.droppedParentNames.length; i++) {
20664   if(this.droppedParentNames[i] == name)
20665    return true;
20666  }
20667  return false;
20668 },
20669 OnDDButtonMouseMove: function(evt){
20670  var dropDownControl = this.GetDroppedDropDown();
20671  if(dropDownControl != null)
20672   dropDownControl.OnDDButtonMouseMove(evt);
20673 },
20674 OnDocumentMouseDown: function(evt){
20675  if(ASPxClientControl.documentDropDownMouseDownLocked) return; 
20676  if(!ASPx.TouchUIHelper.handleFastTapIfRequired(evt, function(){ this.CloseDropDownByDocumentOrWindowEvent(evt, false); }.aspxBind(this), false))
20677   this.CloseDropDownByDocumentOrWindowEvent(evt, false);
20678 },
20679 OnDocumentMouseUp: function(evt){
20680  var dropDownControl = this.GetDroppedDropDown();
20681  if(dropDownControl != null)
20682   dropDownControl.OnDocumentMouseUp();
20683 },
20684 OnBrowserWindowResize: function(e){
20685  if(typeof(ASPx.GetPopupControlCollection) != "undefined" && !ASPx.GetPopupControlCollection().WindowResizeByBodyScrollVisibilityChangingLocked()){
20686   this.CloseDropDownByDocumentOrWindowEvent(e.htmlEvent, true);
20687   this.AdjustControls();
20688  }
20689 },
20690 CloseDropDownByDocumentOrWindowEvent: function(evt, causedByWindowResizing){
20691  var dropDownControl = this.GetDroppedDropDown();
20692  if(dropDownControl != null && (this.IsEventNotFromControlSelf(evt, dropDownControl) || causedByWindowResizing))
20693   dropDownControl.CloseDropDownByDocumentOrWindowEvent(causedByWindowResizing);
20694  var childrenDropDownsToClose = this.GetDroppedDropDownParents(this.droppedParentNames[0]);
20695  if(childrenDropDownsToClose.length != 0) {
20696   childrenDropDownsToClose = childrenDropDownsToClose.reverse();
20697   this.ResetDroppedDownParentCollection(this.droppedParentNames[0]);
20698   var rollbackDroppedDownNames = [ ];
20699   for(var c = 0; c < childrenDropDownsToClose.length; c++) {
20700    if(this.IsEventNotFromControlSelf(evt, childrenDropDownsToClose[c]))
20701     childrenDropDownsToClose[c].CloseDropDownByDocumentOrWindowEvent(causedByWindowResizing);
20702    else
20703     rollbackDroppedDownNames.push(childrenDropDownsToClose[c].name);
20704   }
20705   if(rollbackDroppedDownNames != 0) {
20706    rollbackDroppedDownNames = rollbackDroppedDownNames.reverse();
20707    this.droppedParentNames = rollbackDroppedDownNames;
20708   }
20709  }
20710 },
20711 AdjustControls: function(){
20712  this.ForEachControl(function(control) {
20713   control.AdjustControl(false);
20714  });
20715 },
20716 IsEventNotFromControlSelf: function(evt, control){
20717  var srcElement = ASPx.Evt.GetEventSource(evt);
20718  var mainElement = control.GetMainElement();
20719  var dropDownWindow = control.GetDropDownWindow();
20720  if(!srcElement || !mainElement || !dropDownWindow) return true;
20721  return (!ASPx.GetIsParent(mainElement, srcElement) &&
20722   !ASPx.GetIsParent(dropDownWindow, srcElement) &&
20723   !this.IsEventFromSharedPopupOfInnerEditor(dropDownWindow, srcElement));
20724 },
20725 IsEventFromSharedPopupOfInnerEditor: function(dropDownWindow, srcElement) {
20726  var eventFromPopupOfInnerEditor = false;
20727  ASPx.GetControlCollection().ProcessControlsInContainer(dropDownWindow,
20728   function(control){
20729    if(control.calendarOwnerName) {
20730     var sharedCalendarPopup = control.GetCalendarOwner().GetDropDownWindow();
20731     if(ASPx.GetIsParent(sharedCalendarPopup, srcElement))
20732      eventFromPopupOfInnerEditor = true;
20733    }
20734  });
20735  return eventFromPopupOfInnerEditor;
20736 },
20737 RegisterDroppedDownControl: function(dropDownControl, droppedDownParentArray){
20738  var prevDropDownControl = this.GetDroppedDropDown();
20739  var areDroppedDownsCollectionParents = ASPx.Data.ArrayIndexOf(droppedDownParentArray, prevDropDownControl) != -1;
20740  if(prevDropDownControl != null && prevDropDownControl != dropDownControl && !areDroppedDownsCollectionParents)
20741   prevDropDownControl.OnOpenAnotherDropDown();
20742  if(this.droppedParentNames.length > 0) {
20743   var firstDropDownsNameToClose = this.FindFirstNameForClose(droppedDownParentArray);
20744   if(firstDropDownsNameToClose != "") {
20745    var childrenDropDownsToClose = this.GetDroppedDropDownParents(firstDropDownsNameToClose);
20746    this.ResetDroppedDownParentCollection(firstDropDownsNameToClose);
20747    this.CloseDroppedDownCollection(childrenDropDownsToClose.reverse());
20748   }
20749  }
20750  this.droppedControlName = dropDownControl.name;
20751  this.droppedParentNames = [ ];
20752  for(var i = 0; i < droppedDownParentArray.length; i++)
20753   this.droppedParentNames.push(droppedDownParentArray[i].name);
20754 },
20755 UnregisterDroppedDownControl: function(dropDownControl){
20756  if(this.droppedControlName == dropDownControl.name)
20757   this.ResetDroppedDownControl();
20758  if(this.IsDroppedDropDownParentExist(dropDownControl.name)) {
20759   var prevDropDownControl = this.GetDroppedDropDown();
20760   if(prevDropDownControl != null)
20761    prevDropDownControl.OnOpenAnotherDropDown();
20762   var childrenDropDownsToClose = this.GetDroppedDropDownParents(dropDownControl.name);
20763   this.ResetDroppedDownParentCollection(dropDownControl.name);
20764   ASPx.Data.ArrayRemoveAt(childrenDropDownsToClose, 0);
20765   this.CloseDroppedDownCollection(childrenDropDownsToClose.reverse());
20766  }
20767 },
20768 CloseDroppedDownCollection: function(dropDownParentArray) {
20769  for(var c = 0; c < dropDownParentArray.length; c++)
20770   dropDownParentArray[c].OnOpenAnotherDropDown();
20771 }
20772});
20773var DropDownAccessibilityExplanatoryTextManager = ASPx.CreateClass(ASPx.EditAccessibilityExplanatoryTextManager , {
20774 constructor: function(editor) {
20775  this.constructor.prototype.constructor.call(this, editor);
20776 },
20777 SetHelperLabel: function() {
20778  var pronounceText = this.editor.GetAccessibilityText();
20779  var labelElements = ASPx.FindAssociatedLabelElements(this.editor);
20780  if(labelElements.length > 0) {
20781   var labelText = labelElements.map(function(label) { return ASPx.GetInnerText(label); }).join(" ");
20782   if(pronounceText.indexOf(labelText) < 0)
20783    pronounceText = labelText + " " + pronounceText;
20784  }
20785  var pronounceElement = !!this.editor.accessibilityHelper ? 
20786   this.editor.accessibilityHelper.getItem(true) : 
20787   this.editor.GetAccessibilityAssistantElement();
20788  ASPx.Attr.SetAttribute(pronounceElement, "aria-label", pronounceText);
20789  var textElement = this.GetTextElement();
20790  if(ASPx.IsExists(textElement)) {
20791   if(!ASPx.IsExists(ASPx.Attr.GetAttribute(this.editor.GetInputElement(), 'aria-activedescendant')))
20792    pronounceElement = this.editor.GetInputElement();
20793   this.SetOrRemoveText([pronounceElement], textElement, true, false, false);
20794   setTimeout(function() {
20795    this.SetOrRemoveText([pronounceElement], textElement, false, false, false);
20796   }.aspxBind(this), 500);
20797  }
20798 }
20799});
20800var dropDownCollection = null;
20801function aspxGetDropDownCollection() {
20802 if(dropDownCollection == null)
20803  dropDownCollection  = new ASPxClientDropDownCollection();
20804 return dropDownCollection;
20805}
20806ASPx.Ident.IsASPxClientDateEdit = function(obj) {
20807 return !!obj.isASPxClientDateEdit;
20808};
20809ASPx.DDDropDown = function(name, evt){
20810 if(ASPx.Evt.IsLeftButtonPressed(evt)){
20811  var dd = ASPx.GetControlCollection().Get(name);
20812  if(dd)
20813   return dd.OnDropDown(evt);
20814 }
20815};
20816ASPx.DDMC_MD = function(name, evt) {
20817 var dd = ASPx.GetControlCollection().Get(name);
20818 if(dd)
20819  dd.OnMainCellMouseDown(evt);
20820};
20821ASPx.DDBPCShown = function(name){
20822 var cb = ASPx.GetControlCollection().Get(name);
20823 if(cb != null) cb.OnPopupControlShown();
20824};
20825ASPx.CBLBSelectedIndexChanged = function(name, evt){
20826 var cb = ASPx.GetControlCollection().Get(name);
20827 if(cb != null) cb.OnLBSelectedIndexChanged();
20828};
20829ASPx.CBLBItemMouseUp = function(name, evt){
20830 var cb = ASPx.GetControlCollection().Get(name);
20831 if(cb != null) cb.OnListBoxItemMouseUp(evt);
20832};
20833ASPx.Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseDownEventName, function(evt) {
20834 return aspxGetDropDownCollection().OnDocumentMouseDown(evt);
20835});
20836ASPx.Evt.AttachEventToDocument("mouseup", function(evt) {
20837 return aspxGetDropDownCollection().OnDocumentMouseUp(evt);
20838});
20839window.ASPxClientDropDownEditBase = ASPxClientDropDownEditBase;
20840window.ASPxClientDropDownEdit = ASPxClientDropDownEdit;
20841ASPx.GetDropDownCollection = aspxGetDropDownCollection;
20842})();
20843
20844(function() {
20845var calendarNameSuffix = "_C";
20846var timeEditNameSiffix = calendarNameSuffix + "_TE";
20847var clockNameSiffix = calendarNameSuffix + "_CL";
20848var verticalTimeSectionClassName = "dxeCalendarVerticalDETS";
20849var timeSectionFooterClassName = "dxeDETSF";
20850var calendarWithFullWidthChildsClassName = "dxeCalendarFullWidth";
20851var calendarWithAutoWidthChildsClassName = "dxeCalendarCollapsed";
20852var DefaultMinMaxRangeValues = {
20853 Min: -1,
20854 Max: 922337203685477
20855};
20856var ASPxDateRangeHelper = {
20857 GetCurrentRangeRestrictions: function(dateRangePair) {
20858  if (dateRangePair.isInRangeMode)
20859  return {
20860   startDate: dateRangePair.startDateEdit.GetDate(),
20861   endDate: dateRangePair.endDateEdit.GetDate()
20862  };
20863  else
20864   return {
20865    startDate: null,
20866    endDate: null
20867   };
20868 },
20869 IsBothRangeRestrictionsExist: function (rangeRestricts) {
20870  return rangeRestricts.startDate && rangeRestricts.endDate;
20871 },
20872 IsNegativeRange: function (rangeRestricts) {
20873  return this.IsBothRangeRestrictionsExist(rangeRestricts)
20874   && rangeRestricts.startDate > rangeRestricts.endDate;
20875 },
20876 IsOneRestrictionExistsOnly: function (rangeRestricts) {
20877  return this.IsStartRestrictionExistsOnly(rangeRestricts)
20878   || this.IsEndRestrictionExistsOnly(rangeRestricts);
20879 },
20880 IsStartRestrictionExistsOnly: function (rangeRestricts) {
20881  return rangeRestricts.startDate && !rangeRestricts.endDate;
20882 },
20883 IsEndRestrictionExistsOnly: function (rangeRestricts) {
20884  return !rangeRestricts.startDate && rangeRestricts.endDate;
20885 },
20886 AreRestrictionsOfSameMonth: function (rangeRestricts) {
20887  return this.IsBothRangeRestrictionsExist(rangeRestricts)
20888   && ASPxClientCalendar.AreDatesOfSameMonth(rangeRestricts.startDate, rangeRestricts.endDate);
20889 },
20890 GetFullDaysInCurrentRange: function (dateRangePair) {
20891  var result = -1;
20892  var rangeRestricts = this.GetCurrentRangeRestrictions(dateRangePair);
20893  if (this.IsBothRangeRestrictionsExist(rangeRestricts) && !this.IsNegativeRange(rangeRestricts)) {
20894   var timezoneOffsetDifference = ASPx.DateUtils.GetTimeZoneOffset(rangeRestricts.startDate)
20895    - ASPx.DateUtils.GetTimeZoneOffset(rangeRestricts.endDate);
20896   var rangeLength = rangeRestricts.endDate - rangeRestricts.startDate + timezoneOffsetDifference;
20897   result = Math.floor(rangeLength / ASPx.calendarMsPerDay);
20898  }
20899  return result;
20900 },
20901 NeedCorrectSecondDateOnDateChanging: function (rangeRestricts, isStartDateChanged, minRange) {
20902  if (this.IsNegativeRange(rangeRestricts))
20903   return true;
20904  var isSecondDateEmpty = isStartDateChanged && this.IsStartRestrictionExistsOnly(rangeRestricts)
20905   || !isStartDateChanged && this.IsEndRestrictionExistsOnly(rangeRestricts);
20906  return isSecondDateEmpty && minRange > DefaultMinMaxRangeValues.Min;
20907 },
20908 GetDateEditPair: function(currentDateEdit) {
20909  if(currentDateEdit.IsInDateRangeMode()) {
20910   var startDE = currentDateEdit.GetStartDateEdit();
20911   startDE = (startDE == null) ? currentDateEdit : startDE;
20912   var endDE = startDE.endDateEdit;
20913   var isCurrentDateEditStart = currentDateEdit === startDE;
20914   return {
20915    startDateEdit: startDE,
20916    endDateEdit: endDE,
20917    isStart: isCurrentDateEditStart,
20918    isInRangeMode: true
20919   };
20920  }
20921  else
20922   return {
20923    startDateEdit: currentDateEdit,
20924    endDateEdit: null,
20925    isStart: true,
20926    isInRangeMode: false
20927   };
20928 }
20929};
20930var DateRangeValidationPattern = ASPx.CreateClass(ASPx.ValidationPattern, {
20931 constructor: function (startDateEdit, endDateEdit) {
20932  this.constructor.prototype.constructor.call(this, endDateEdit.
20932invalidDateRangeErrorText);
20933  this.startDateEdit = startDateEdit;
20934  this.endDateEdit = endDateEdit;
20935 },
20936 EvaluateIsValid: function(value) {
20937  var dateEditPair = ASPxDateRangeHelper.GetDateEditPair(this.startDateEdit);
20938  var rangeRestricts = ASPxDateRangeHelper.GetCurrentRangeRestrictions(dateEditPair);
20939  if (this.endDateEdit.IsDateChangeProcessing()
20940   && ASPxDateRangeHelper.NeedCorrectSecondDateOnDateChanging(rangeRestricts, false, this.endDateEdit.minRange))
20941   return true;
20942  if (ASPxDateRangeHelper.IsOneRestrictionExistsOnly(rangeRestricts))
20943   return false;
20944  if (ASPxDateRangeHelper.IsBothRangeRestrictionsExist(rangeRestricts)) {
20945   var currentDateRange = rangeRestricts.endDate - rangeRestricts.startDate;
20946   return currentDateRange >= this.endDateEdit.minRange && currentDateRange <= this.endDateEdit.maxRange;
20947  }
20948  return true;
20949 }
20950});
20951var ASPxClientDateEdit = ASPx.CreateClass(ASPxClientDropDownEditBase, {
20952 constructor: function(name) {
20953  this.constructor.prototype.constructor.call(this, name);
20954  this.dateFormatter = null;
20955  this.isASPxClientDateEdit = true;
20956  this.date = null;
20957  this.dateOnError = "u";
20958  this.allowNull = true;
20959  this.calendarOwnerName = null;
20960  this.calendarConsumerName = null;
20961  this.textWasLastTemporaryChanged = false;
20962  this.showTimeSection = false;
20963  this.enableAdaptiveTimeSection = true;
20964  this.adjustInnerControls = true;
20965  this.pasteTimerID = -1;
20966  this.keyUpProcessing = false;
20967  this.showOutOfRangeWarning = true;
20968  this.startDateEditName = "";
20969  this.minRange = DefaultMinMaxRangeValues.Min;
20970  this.maxRange = DefaultMinMaxRangeValues.Max;
20971  this.sharedParameters = new ASPx.CalendarSharedParameters();
20972  this.endDateEdit = null;
20973  this.DateChanged = new ASPxClientEvent();
20974  this.ParseDate = new ASPxClientEvent();
20975  this.CalendarCustomDisabledDate = new ASPxClientEvent();
20976  this.CalendarShowing = new ASPxClientEvent();
20977  this.ValueSet = new ASPxClientEvent();
20978 },
20979 SetData: function(data){
20980  ASPxClientTextEdit.prototype.SetData.call(this, data);
20981  if(data.sharedParameters)
20982   this.SetProperties(data.sharedParameters, this.sharedParameters);
20983 },
20984 Initialize: function() {
20985  if(this.HasOwnedCalendar()) {
20986   this.InitializeCalendarHandlers();
20987   this.InitializeTimeEditHandlers();
20988  } else 
20989   this.RegisterSharedCalendar();  
20990  ASPxClientDropDownEditBase.prototype.Initialize.call(this);
20991  var startDateEdit = this.GetStartDateEdit();
20992  if(startDateEdit) {
20993   if(this.MinOrMaxRangeExist())
20994    this.validationPatterns.push(new DateRangeValidationPattern(startDateEdit, this));
20995   this.AssignDateRangeMode(startDateEdit);
20996  }
20997  this.AttachToDateEditClientEvents();
20998  this.InitializeSharedParameters();
20999  var calendar = this.GetCalendar();
21000  if (calendar)
21001   calendar.customDraw = calendar.customDraw || this.sharedParameters.calendarCustomDraw;
21002 },
21003 AssignDateRangeMode: function(startDateEdit) {
21004  this.PrepareCalendarsToDateRangeMode(startDateEdit);
21005  this.ownMinDate = this.GetMinDate();
21006  this.SetActualMinDate();
21007 },
21008 PrepareCalendarsToDateRangeMode: function(startDateEdit) {
21009  startDateEdit.endDateEdit = this;
21010  this.SetCalendarDateRangeMode(startDateEdit);
21011  this.SetCalendarDateRangeMode(this);
21012 },
21013 SetCalendarDateRangeMode: function(dateEdit) {
21014  var isOperaOrIEVersionHigher8 = ASPx.Browser.IE && ASPx.Browser.Version > 8 || ASPx.Browser.Opera;
21015  dateEdit.sharedParameters.dateRangeMode = true;
21016  var calendar = dateEdit.GetCalendar();
21017  calendar.updateDayStylesTwiceOnMouseOver = isOperaOrIEVersionHigher8 && this.DateEditHasParentWithRelativePosition(this);
21018 },
21019 IsInDateRangeMode: function() {
21020  var startDateEdit = this.GetStartDateEdit();
21021  return startDateEdit !== null || this.endDateEdit !== null;
21022 },
21023 DateEditHasParentWithRelativePosition: function(dateEdit) {
21024  return ASPx.GetParent(dateEdit.GetMainElement(),
21025   function (element) { return ASPx.GetCurrentStyle(element).position === "relative"; }) != null;
21026 },
21027 MinOrMaxRangeExist: function() {
21028  return this.minRange !== DefaultMinMaxRangeValues.Min || this.maxRange !== DefaultMinMaxRangeValues.Max;
21029 },
21030 AttachToDateEditClientEvents: function() {
21031  this.DateChanged.AddHandler(function(s, e) {
21032   if(!e.isInternal)
21033    this.OnRangeRestrictionChanged(s);
21034  }.aspxBind(this));
21035  this.CalendarShowing.AddHandler(function(s, e) {
21036   this.OnCalendarShowing(s);
21037  }.aspxBind(this));
21038  this.ValueSet.AddHandler(function(s, e) {
21039   this.SetActualMinDate();
21040  }.aspxBind(this));
21041 },
21042 InitializeSharedParameters: function() {
21043  this.sharedParameters.currentDateEdit = this;
21044  this.sharedParameters.DaysSelectingOnMouseOver.AddHandler(function(s, e) {
21045   this.OnCalendarDayMouseOver(s, e);
21046  }.aspxBind(this));
21047  this.sharedParameters.VisibleDaysMouseOut.AddHandler(function(s, e) {
21048   this.SelectRangeInCalendar(s, false);
21049  }.aspxBind(this));
21050  if(this.GetShowTimeSection())
21051   this.sharedParameters.CalendarSelectionChangedInternal.AddHandler(function(s, e) {
21052    this.SelectRangeInCalendar(s, false);
21053   }.aspxBind(this));
21054 },
21055 OnCalendarDayMouseOver: function(targetCalendar, e) {
21056  var dateRangePair = ASPxDateRangeHelper.GetDateEditPair(ASPxClientDateEdit.active);
21057  if(!dateRangePair.isInRangeMode) {
21058   e.cancel = true;
21059   return;
21060  }
21061  var rangeRestricts = ASPxDateRangeHelper.GetCurrentRangeRestrictions(dateRangePair);
21062  var isRangeNegative = ASPxDateRangeHelper.IsNegativeRange(rangeRestricts);
21063  var isOverDateCorrectForSelection = false;
21064  if (!isRangeNegative) {
21065   var requiredStartDate = dateRangePair.isStart ? rangeRestricts.endDate : rangeRestricts.startDate;
21066   e.selectionStartDate = requiredStartDate ? ASPxClientCalendar.CloneDate(requiredStartDate) : null;
21067   isOverDateCorrectForSelection = e.selectionStartDate
21068    && (dateRangePair.isStart && e.selectionStartDate >= e.overDate
21069    || !dateRangePair.isStart && e.selectionStartDate <= e.overDate);
21070  }
21071  e.cancel = isRangeNegative || !e.selectionStartDate || !isOverDateCorrectForSelection;
21072 },
21073 OnCalendarShowing: function() {
21074  var dateRangePair = ASPxDateRangeHelper.GetDateEditPair(ASPxClientDateEdit.active);
21075  if(!dateRangePair.isInRangeMode)
21076   return;
21077  var targetCalendar = ASPxClientDateEdit.active.GetCalendar();
21078  if(!targetCalendar)
21079   return;
21080  this.UpdateCalendarVisibleDate(targetCalendar, dateRangePair);
21081  this.SetActualMinDate();
21082  this.SelectRangeInCalendar(targetCalendar, true);
21083 },
21084 GetRangeToSelectInCalendar: function(targetCalendar, dateRangePair, isCalendarShowing) {
21085  var rangeRestricts = ASPxDateRangeHelper.GetCurrentRangeRestrictions(dateRangePair);
21086  var calendarHasOwnSelectedDate = targetCalendar.lastSelectedDate != null;
21087  var correctRangeRestrictsForSelection = !isCalendarShowing && calendarHasOwnSelectedDate;
21088  if (correctRangeRestrictsForSelection) {
21089   var calendarLastSelectedDate = ASPxClientCalendar.CloneDate(targetCalendar.lastSelectedDate);
21090   if (dateRangePair.isStart)
21091    rangeRestricts.startDate = calendarLastSelectedDate;
21092   else
21093    rangeRestricts.endDate = calendarLastSelectedDate;
21094  }
21095  return rangeRestricts;
21096 },
21097 SelectRangeInCalendar: function(targetCalendar, isCalendarShowing) {
21098  var dateRangePair = ASPxDateRangeHelper.GetDateEditPair(ASPxClientDateEdit.active);
21099  if(!dateRangePair.isInRangeMode)
21100   return;
21101  var rangeRestrictsToSelect = this.GetRangeToSelectInCalendar(targetCalendar, dateRangePair, isCalendarShowing);
21102  if(ASPxDateRangeHelper.IsNegativeRange(rangeRestrictsToSelect))
21103   return;
21104  targetCalendar.clientUpdate = true;
21105  targetCalendar.LockUpdateAnimation();
21106  targetCalendar.ClearSelection();
21107  if(ASPxDateRangeHelper.IsBothRangeRestrictionsExist(rangeRestrictsToSelect))
21108   targetCalendar.SelectRange(rangeRestrictsToSelect.startDate, rangeRestrictsToSelect.endDate);
21109  if(ASPxDateRangeHelper.IsEndRestrictionExistsOnly(rangeRestrictsToSelect))
21110   targetCalendar.SelectDate(rangeRestrictsToSelect.endDate);
21111  if(ASPxDateRangeHelper.IsStartRestrictionExistsOnly(rangeRestrictsToSelect))
21112   targetCalendar.SelectDate(rangeRestrictsToSelect.startDate);
21113  targetCalendar.UnlockUpdateAnimation();
21114  targetCalendar.Update();
21115  targetCalendar.clientUpdate = false;
21116 },
21117 UpdateCalendarVisibleDate: function(targetCalendar, dateRangePair) {
21118  var rangeRestricts = ASPxDateRangeHelper.GetCurrentRangeRestrictions(dateRangePair);
21119  targetCalendar.visibleDateColumnOffset = 0;
21120  if (ASPxDateRangeHelper.IsStartRestrictionExistsOnly(rangeRestricts) && !dateRangePair.isStart) {
21121   targetCalendar.SetVisibleDate(rangeRestricts.startDate);
21122  }
21123  if (ASPxDateRangeHelper.IsEndRestrictionExistsOnly(rangeRestricts)
21124   || ASPxDateRangeHelper.IsBothRangeRestrictionsExist(rangeRestricts) && !dateRangePair.isStart) {
21125   targetCalendar.SetVisibleDate(rangeRestricts.endDate);
21126   if (!ASPxDateRangeHelper.AreRestrictionsOfSameMonth(rangeRestricts))
21127    targetCalendar.OnShiftMonth(-1 * (targetCalendar.columns - 1), true);
21128  }
21129 },
21130 SetActualMinDate: function() {
21131  var dateRangePair = ASPxDateRangeHelper.GetDateEditPair(this);
21132  if(!dateRangePair.isInRangeMode) return;
21133  var rangeRestricts = ASPxDateRangeHelper.GetCurrentRangeRestrictions(dateRangePair);
21134  if(!dateRangePair.isStart)
21135   dateRangePair.endDateEdit.SetMinDateCore(rangeRestricts.startDate ? rangeRestricts.startDate : dateRangePair.endDateEdit.ownMinDate);
21136 },
21137 OnRangeRestrictionChanged: function() {
21138  var dateRangePair = ASPxDateRangeHelper.GetDateEditPair(this);
21139  if(!dateRangePair.isInRangeMode) return;
21140  var rangeRestricts = ASPxDateRangeHelper.GetCurrentRangeRestrictions(dateRangePair);
21141  if (ASPxDateRangeHelper.NeedCorrectSecondDateOnDateChanging(rangeRestricts, dateRangePair.isStart, dateRangePair.endDateEdit.minRange))
21142   this.CorrestSecondRangeDate(dateRangePair);
21143  if(dateRangePair.isStart)
21144   dateRangePair.endDateEdit.Validate();
21145  else {
21146   dateRangePair.endDateEdit.SetActualMinDate();
21147   dateRangePair.startDateEdit.Validate();
21148  }
21149 },
21150 CorrestSecondRangeDate: function(dateRangePair) {
21151  var changedDate = (dateRangePair.isStart) ? dateRangePair.startDateEdit.GetDate() : dateRangePair.endDateEdit.GetDate();
21152  var secondDate = ASPxClientCalendar.CloneDate(changedDate);
21153  var endDateMinRange = Math.max(dateRangePair.endDateEdit.minRange, 0);
21154  var dateDifference = dateRangePair.isStart ? endDateMinRange : -endDateMinRange;
21155  var secondDateEdit = dateRangePair.isStart ? dateRangePair.endDateEdit : dateRangePair.startDateEdit;
21156  secondDate.setMilliseconds(secondDate.getMilliseconds() + dateDifference);
21157  secondDateEdit.SetDate(secondDate);
21158  secondDateEdit.RaiseValueChangedEvent(true);
21159 },
21160 InitializeCalendarHandlers: function() {
21161  var calendar = this.GetCalendar();
21162  if (calendar) {
21163   calendar.SelectionChanging.AddHandler(ASPxClientDateEdit.HandleCalendarSelectionChanging);
21164   calendar.MainElementClick.AddHandler(ASPxClientDateEdit.HandleCalendarMainElementClick);
21165   this.AssignCalendarDisabledDateHandler(calendar);
21166   var calendarMainElement = calendar.GetMainElement();
21167   if(ASPx.Browser.NetscapeFamily && ASPx.IsExistsElement(calendarMainElement))
21168    calendarMainElement.style.borderCollapse = "separate";
21169  }
21170 },
21171 AssignCalendarDisabledDateHandler: function(calendar) {
21172  calendar.CustomDisabledDate.AddHandler(ASPxClientDateEdit.HandleCalendarCustomDisabledDate.aspxBind(this));
21173 },
21174 InitializeTimeEditHandlers: function() {
21175  var timeEdit = this.GetTimeEdit();
21176  if(timeEdit) {
21177   timeEdit.InternalValueChanging.AddHandler(ASPxClientDateEdit.HandleTimeEditInternalValueChanging);
21178   timeEdit.OwnerDateEdit = this;
21179  }
21180 },
21181 RegisterSharedCalendar: function() {
21182  var calendar = this.GetCalendar();
21183  if(calendar) {
21184   ASPxClientDateEdit.SharedCalendarCollection.registerCalendarId(calendar.name);
21185  }   
21186 },
21187 HasOwnedCalendar: function() {
21188  return this.calendarOwnerName == null;
21189 },
21190 InlineInitialize: function(){
21191  this.InitSpecialKeyboardHandling();
21192  ASPxClientDropDownEditBase.prototype.InlineInitialize.call(this);
21193  this.lastValue = this.GetInputElement().value;
21194  if (this.UseRestrictions() && this.showOutOfRangeWarning)
21195   this.EnsureOutOfRangeWarningManager();
21196 },
21197 GetStartDateEdit: function() {
21198  return this.startDateEditName ? ASPx.GetControlCollection().Get(this.startDateEditName) : null;
21199 },
21200 CloseDropDownByDocumentOrWindowEvent: function(causedByWindowResizing) {
21201  if((!causedByWindowResizing || !this.pcIsShowingNow) && this.GetShowTimeSection())
21202   this.ApplyTimeSectionDateChanges();
21203  ASPxClientDropDownEditBase.prototype.CloseDropDownByDocumentOrWindowEvent.call(this, causedByWindowResizing);
21204 },
21205 UseRestrictions: function() {
21206  return this.GetMinDate() || this.GetMaxDate();
21207 },
21208 OnDropDownCore: function(evt) {
21209  var cal = this.GetCalendar();
21210  if(!cal) return;
21211  ASPxClientDropDownEditBase.prototype.OnDropDownCore.call(this, evt);
21212  if(this.droppedDown) {
21213     cal.forceMouseDown = true;
21214  }
21215 },
21216 SetCalendarAndTimeSectionValues: function() {
21217  this.SetCurrentStateToCalendar();
21218  this.SetCurrentStateToTimeSection();
21219 },
21220 SetCurrentStateToCalendar: function() {
21221  var calendar = this.GetCalendar();
21222  if(!calendar) return;
21223  calendar.sharedParameters = this.sharedParameters;
21224  if(this.IsCalendarShared()) {
21225   calendar.CustomDisabledDate.ClearHandlers();
21226   this.AssignCalendarDisabledDateHandler(calendar);
21227  }
21228  calendar.forceUpdate = true;
21229  if (!this.date) {
21230   calendar.SetValue(null);
21231   var currentDate = new Date();
21232   currentDateWithoutTime = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate());
21233   calendar.SetVisibleDate(currentDateWithoutTime);
21234  }
21235  else {
21236   var dateWithoutTime = new Date(this.date.getFullYear(), this.date.getMonth(), this.date.getDate());
21237   calendar.SetValue(dateWithoutTime);
21238  }
21239 },
21240 CreateUpdateCallback: function(result) {
21241  this.CreateCallback(this.sharedParameters.GetUpdateCallbackParameters());
21242 },
21243 OnCallback: function(result) {
21244  var calendar = this.GetCalendar();
21245  if(calendar != null)
21246   calendar.OnCallback(result);
21247 },
21248 SetCurrentStateToTimeSection: function() {
21249  if(this.GetShowTimeSection()) {
21250   var timeEdit = this.GetTimeEdit();
21251   if(timeEdit)
21252    timeEdit.SetValue(this.date);
21253  }
21254 },
21255 ShowDropDownArea: function(isRaiseEvent){
21256  this.dropDownShowing = true;
21257  this.SetActiveControl();
21258  this.SetCalendarAndTimeSectionValues();
21259  this.CalendarShowing.FireEvent(this);
21260  var calendar = this.GetCalendar();
21261  if(calendar)
21262   calendar.ShowSlideAnimationContent();
21263  ASPxClientDropDownEditBase.prototype.ShowDropDownArea.call(this, isRaiseEvent);
21264  if(calendar)
21265   calendar.HideSlideAnimationContent();
21266  var calendarOwner = this.GetCalendarOwner();
21267  if(calendarOwner != null)
21268   calendarOwner.calendarConsumerName = this.name;
21269  this.calendarConsumerName = null;
21270  if(!this.GetCalendar().isSlideCallbackAnimationEnabled() || this.GetCalendar().customDraw) {
21271   this.AdjustTimeSectionLayoutOnShowDropDown();
21272   this.dropDownShowing = false;
21273  }
21274 },
21275 OnCalendarFinishAnimation: function() {
21276  if (this.dropDownShowing && this.GetCalendar().isSlideCallbackAnimationEnabled() && !this.GetCalendar().customDraw) {
21277   this.AdjustTimeSectionLayoutOnShowDropDown();
21278   this.dropDownShowing = false;
21279  }
21280 },
21281 AdjustTimeSectionLayoutOnShowDropDown: function() {
21282  if(this.IsAdaptiveTimeSectionEnabled()) {
21283   this.dropDownPosition = ASPx.GetAbsoluteX(this.GetPopupControl().GetCurrentWindowElement());
21284   this.AdjustTimeSectionLayout();
21285  }
21286 },
21287 AdjustTimeSectionLayout: function () {
21288  this.EnsureCalendarMaxWidth();
21289  var requiredTimeSectionPos = this.GetRequiredTimeSectionPosition();
21290  var currentTimeSectionPos = this.GetCurrentTimeSectionPosition();
21291  if(requiredTimeSectionPos !== currentTimeSectionPos) {
21292   if(requiredTimeSectionPos === ASPx.Position.Bottom)
21293    this.SwitchToVerticalTimeSectionLayout();
21294   else
21295    this.SwitchToHorizontalTimeSectionLayout();
21296   this.GetClock().RecreateRectBag();
21297  }
21298 },
21299 EnsureCalendarMaxWidth: function () {
21300  var calendarMainElement = this.GetCalendar().GetMainElement();
21301  if (!calendarMainElement.style.maxWidth)
21302   calendarMainElement.style.maxWidth = this.GetCalendarWithHorizontalTimeSectionWidth() + "px";
21303 },
21304 GetRequiredTimeSectionPosition: function() {
21305  var horizontalTimeSectionRightPos = this.GetCalendarWithHorizontalTimeSectionWidth() + this.dropDownPosition;
21306  var verticalScrollBarWidth = ASPx.GetCurrentDocumentWidth() > ASPx.GetDocumentClientWidth() ? ASPx.GetVerticalScrollBarWidth() : 0;
21307  return horizontalTimeSectionRightPos <= ASPx.GetDocumentScrollLeft() + window.innerWidth - verticalScrollBarWidth ? ASPx.Position.Right : ASPx.Position.Bottom;
21308 },
21309 GetCurrentTimeSectionPosition: function() {
21310  var calendarMainElement = this.GetCalendar().GetMainElement();
21311  return ASPx.ElementHasCssClass(calendarMainElement, verticalTimeSectionClassName) ? ASPx.Position.Bottom : ASPx.Position.Right;
21312 },
21313 SwitchToVerticalTimeSectionLayout: function() {
21314  var calendarMainElement = this.GetCalendar().GetMainElement();
21315  ASPx.AddClassNameToElement(calendarMainElement, verticalTimeSectionClassName);
21316  calendarMainElement.style.maxWidth = this.GetCalendarWithVerticalTimeSectionWidth() + "px";
21317  ASPx.AddClassNameToElement(calendarMainElement, calendarWithFullWidthChildsClassName);
21318  ASPx.SetElementDisplay(this.GetPopupControl().GetWindowElement(-1), true);
21319 },
21320 SwitchToHorizontalTimeSectionLayout: function () {
21321  var calendarMainElement = this.GetCalendar().GetMainElement();
21322  ASPx.RemoveClassNameFromElement(calendarMainElement, verticalTimeSectionClassName);
21323  ASPx.RemoveClassNameFromElement(calendarMainElement, calendarWithFullWidthChildsClassName);
21324  calendarMainElement.style.maxWidth = this.GetCalendarWithHorizontalTimeSectionWidth() + "px";
21325  ASPx.SetElementDisplay(this.GetPopupControl().GetWindowElement(-1), true);
21326 },
21327 GetCalendarWithHorizontalTimeSectionWidth: function () {
21328  if (!this.calendarWithHorizontalTimeSectionWidth) {
21329   this.calendarWithHorizontalTimeSectionWidth = 0;
21330   var calendarMainElement = this.GetCalendar().GetMainElement();
21331   for (var i = 0; i < calendarMainElement.childNodes.length; i++) {
21332    var calendarChildElement = calendarMainElement.childNodes[i];
21333    if (calendarChildElement.tagName == "DIV" && !ASPx.ElementHasCssClass(calendarChildElement, timeSectionFooterClassName)) {
21334     this.calendarWithHorizontalTimeSectionWidth += calendarChildElement.offsetWidth;
21335    }
21336   }
21337   this.calendarWithHorizontalTimeSectionWidth += ASPx.GetLeftRightPaddings(calendarMainElement);
21338   var calendarMainElementHorizontalBordersWidth = ASPx.GetHorizontalBordersWidth(calendarMainElement);
21339   var calendarMainElementCurrentStyle = ASPx.GetCurrentStyle(calendarMainElement);
21340   if(calendarMainElementCurrentStyle && calendarMainElementCurrentStyle.borderCollapse == "collapse")
21341    calendarMainElementHorizontalBordersWidth *= 2;
21342   this.calendarWithHorizontalTimeSectionWidth += calendarMainElementHorizontalBordersWidth;
21343  }
21344  return this.calendarWithHorizontalTimeSectionWidth;
21345 },
21346 GetCalendarWithVerticalTimeSectionWidth: function () {
21347  if (!this.calendarWithVerticalTimeSectionWidth) {
21348   this.calendarWithVerticalTimeSectionWidth = 0;
21349   var calendarMainElement = this.GetCalendar().GetMainElement();
21350   var maxChildElementWidth = 0;
21351   ASPx.AddClassNameToElement(calendarMainElement, calendarWithAutoWidthChildsClassName);
21352   for (var i = 0; i < calendarMainElement.childNodes.length; i++) {
21353    var calendarChildElement = calendarMainElement.childNodes[i];
21354    if (calendarChildElement.tagName == "DIV" && calendarChildElement.offsetWidth > maxChildElementWidth) {
21355     maxChildElementWidth = calendarChildElement.offsetWidth;
21356    }
21357   }
21358   ASPx.RemoveClassNameFromElement(calendarMainElement, calendarWithAutoWidthChildsClassName);
21359   this.calendarWithVerticalTimeSectionWidth = maxChildElementWidth + ASPx.GetLeftRightBordersAndPaddingsSummaryValue(calendarMainElement);
21360  }
21361  return this.calendarWithVerticalTimeSectionWidth;
21362 },
21363 BrowserWindowResizeSubscriber: function() {
21364  return this.droppedDown && this.IsAdaptiveTimeSectionEnabled();
21365 },
21366 OnBrowserWindowResize: function(e) {
21367  this.AdjustTimeSectionLayout();
21368 },
21369 IsCalendarShared: function () {
21370  var calendar = this.GetCalendar();
21371  var calendarName = calendar != null ? calendar.name : ""; 
21372  return ASPxClientDateEdit.SharedCalendarCollection.calendarIsShared(calendarName);
21373 },
21374 SetActiveControl: function() {
21375  var calendar = this.GetCalendar();
21376  ASPx.activeCalendar = calendar;
21377  ASPxClientDateEdit.active = this;
21378 },
21379 BeforePopupControlResizing: function() {
21380  var calendarOwner = this;
21381  if(this.calendarOwnerName)
21382   calendarOwner = this.GetCalendarOwner();
21383  if(calendarOwner.adjustInnerControls && calendarOwner.GetTimeEdit()){
21384   calendarOwner.GetClock().AdjustControl();
21385   calendarOwner.GetTimeEdit().AdjustControl();
21386   calendarOwner.adjustInnerControls = false;
21387  }
21388 },
21389 GetPopupControl: function() { 
21390  var calendarOwner = this.GetCalendarOwner();
21391  if(calendarOwner != null)
21392   return calendarOwner.GetPopupControl();
21393  return ASPxClientDropDownEditBase.prototype.GetPopupControl.call(this);
21394 },
21395 OnPopupControlShown: function() {
21396  if(this.calendarConsumerName != null)
21397   ASPx.GetControlCollection().Get(this.calendarConsumerName).OnPopupControlShown();
21398  else  
21399   ASPxClientDropDownEditBase.prototype.OnPopupControlShown.call(this);
21400 },
21401 GetCalendar: function() { 
21402  var name = this.GetDropDownInnerControlName(calendarNameSuffix);
21403  return ASPx.GetControlCollection().Get(name);
21404 },
21405 GetTimeEdit: function() { 
21406  var name = this.GetDropDownInnerControlName(timeEditNameSiffix);
21407  return ASPx.GetControlCollection().Get(name);
21408 },
21409 GetClock: function() {
21410  var name = this.GetDropDownInnerControlName(clockNameSiffix);
21411  return ASPx.GetControlCollection().Get(name);
21412 },
21413 GetCalendarOwner: function() {
21414  if(!this.calendarOwnerName)
21415   return null;
21416  return ASPx.GetControlCollection().Get(this.calendarOwnerName);
21417 },
21418 GetShowTimeSection: function(){
21419  var calendarOwner = this.GetCalendarOwner();
21420  if(calendarOwner)
21421   return calendarOwner.showTimeSection;
21422  return this.showTimeSection;
21423 },
21424 IsAdaptiveTimeSectionEnabled: function() {
21425  if(!this.GetShowTimeSection())
21426   return false;
21427  var calendarOwner = this.GetCalendarOwner();
21428  if(calendarOwner)
21429   return calendarOwner.enableAdaptiveTimeSection;
21430  return this.enableAdaptiveTimeSection;
21431 },
21432 GetFormattedDate: function() {
21433  if(this.maskInfo != null)
21434   return this.maskInfo.GetValue();
21435  if(this.date == null)
21436   return this.focused ? "" : this.nullText;
21437  return this.dateFormatter.Format(this.date);
21438 },
21439 SetTextWasLastTemporaryChanged: function(value){
21440  this.textWasLastTemporaryChanged = value;
21441 },
21442 GetTextWasLastTemporaryChanged: function(){
21443  return this.textWasLastTemporaryChanged;
21444 },
21445 RaiseValueChangedEvent: function(isInternal) {
21446  if(!this.isInitialized) return false;
21447  var processOnServer = ASPxClientEdit.prototype.RaiseValueChangedEvent.call(this);
21448  processOnServer = this.RaiseDateChanged(processOnServer, isInternal);
21449  return processOnServer;
21450 },
21451 OnApplyChanges: function(){
21452  if(this.focused)
21453   this.OnTextChanged();
21454 },
21455 OnCalendarSelectionChanging: function(date, select) {
21456  if(this.GetShowTimeSection())
21457   return;
21458  if(!this.GetCalendar().isDateChangingByKeyboard) {
21459   this.HideDropDownArea(true);
21460   if(date != null)
21461    this.ApplyExistingTime(date);
21462   this.ChangeDate(date);
21463   if(select)
21464    ASPx.Selection.Set(this.GetInputElement());
21465   this.lastValue = this.GetInputElement().value;
21466  }
21467 },
21468 OnCalendarCustomDisabledDate: function(e) {
21469  this.RaiseCalendarCustomDisabledDate(e);
21470 },
21471 OnCustomDisabledDate: function(date) {
21472  return this.RaiseCustomDisabledDateEvent(date);
21473 },
21474 RaiseCustomDisabledDateEvent: function(date) {
21475  var args = new ASPxClientCalendarCustomDisabledDateEventArgs(date);
21476  this.CalendarCustomDisabledDate.FireEvent(this, args);
21477  return args;
21478 },
21479 ForceRefocusTimeSectionTimeEdit: function(mouseDownSource) {
21480  var dateEdit = this;
21481  if(this.calendarConsumerName)
21482   dateEdit = ASPx.GetControlCollection().Get(this.calendarConsumerName);
21483  var timeEdit = dateEdit.GetTimeEdit();
21484  var isTimeEditElement = timeEdit.IsEditorElement(mouseDownSource);
21485  if(isTimeEditElement && !timeEdit.IsElementBelongToInputElement(mouseDownSource)) { 
21486   if(!ASPx.Browser.VirtualKeyboardSupported) 
21487    timeEdit.ForceRefocusEditor();
21488   return;
21489  }
21490  if(!dateEdit.IsEditorElement(mouseDownSource)) {
21491   if(ASPx.Browser.VirtualKeyboardSupported && !isTimeEditElement) {
21492    this.lockLostFocus = false;
21493    if(ASPx.VirtualKeyboardUI.focusableInputElementIsActive(timeEdit)) {
21494     timeEdit.GetInputElement().blur();
21495    } else {
21496     ASPx.VirtualKeyboardUI.lostAppliedFocusOfEditor();
21497    }
21498   }
21499   return;
21500  }
21501  if(ASPx.Browser.VirtualKeyboardSupported) {
21502   this.lockLostFocus = true;
21503  } else {
21504   dateEdit.ForceRefocusEditor();
21505   var input = timeEdit.GetInputElement();
21506   if(input)
21507    input.blur();
21508   window.setTimeout(function() { ASPx.SetFocusedEditor(dateEdit); }, 0);
21509  }
21510 },
21511 EnsureCalendarSelectedDateIsActual: function() {
21512  var calendar = this.GetCalendar();
21513  if (calendar.sharedParameters.dateRangeMode && (calendar.lastSelectedDate || !this.date))
21514   calendar.SetSelectedDate(calendar.lastSelectedDate);
21515 },
21516 ApplyTimeSectionDateChanges: function() {
21517  var hours = 0, minutes = 0, seconds = 0, milliseconds = 0;
21518  this.EnsureCalendarSelectedDateIsActual();
21519  var date = this.GetCalendar().GetSelectedDate();
21520  this.GetTimeEdit().ParseValue();
21521  var timeEditDate = this.GetTimeEdit().GetDate();
21522  if(timeEditDate) {
21523   hours = timeEditDate.getHours();
21524   minutes = timeEditDate.getMinutes();
21525   seconds = timeEditDate.getSeconds();
21526   milliseconds = timeEditDate.getMilliseconds();
21527  }
21528  if(!date && timeEditDate)
21529   date = new Date(100, 0, 1);
21530  if(date) {
21531   date.setHours(hours);
21532   date.setMinutes(minutes);
21533   date.setSeconds(seconds);
21534   date.setMilliseconds(milliseconds);
21535  }
21536  this.ApplyParsedDate(date, true);
21537 },
21538 IsEditorElement: function(element) {
21539  var timeEdit = this.GetTimeEdit();
21540  if(this.GetShowTimeSection() && timeEdit && ASPx.GetIsParent(timeEdit.GetMainElement(), element)) {
21541   this.lockLostFocus = true;
21542   return false;
21543  }
21544  return ASPxClientDropDownEditBase.prototype.IsEditorElement.call(this, element);
21545 },
21546 OnFocus: function() {
21547  this.SetActiveControl();
21548  ASPxClientDropDownEditBase.prototype.OnFocus.call(this);
21549  if(!ASPx.GetControlCollection().InCallback())
21550   this.SetTextChangingTimer();
21551 },
21552 OnLostFocusCore: function() {
21553  if(this.GetShowTimeSection() && this.lockLostFocus) {
21554   this.lockLostFocus = false;
21555   return;
21556  }
21557  ASPxClientDropDownEditBase.prototype.OnLostFocusCore.call(this);
21558  this.ClearTextChangingTimer();
21559  if(this.outOfRangeWarningManager)
21560   this.outOfRangeWarningManager.HideOutOfRangeWarningElement();
21561 },
21562 OnTimeEditLostFocus: function() {
21563  this.OnLostFocusCore();
21564 },
21565 OnTimeEditEnter: function() {
21566  this.ForceRefocusEditor();
21567  this.ApplyTimeSectionDateChanges();
21568  this.HideDropDownArea(true);
21569  ASPx.Selection.Set(this.GetInputElement());
21570 },
21571 OnTimeEditEsc: function() {
21572  this.ForceRefocusEditor();
21573  this.HideDropDownArea(true);
21574 },
21575 OnTimeEditTab: function(shiftKey) {
21576  if(shiftKey && !this.GetCalendarOwner())
21577   this.ForceRefocusEditor();
21578  this.ApplyTimeSectionDateChanges();
21579  this.HideDropDownArea(true);
21580 },
21581 OnTimeSectionOkClick: function() {
21582  this.ApplyTimeSectionDateChanges();
21583  this.HideDropDownArea(true);
21584 },
21585 OnTimeSectionCancelClick: function() {
21586  this.HideDropDownArea(true);
21587 },
21588 OnTimeSectionClearClick: function() {
21589  this.ChangeDate(null);
21590  this.GetCalendar().ResetLastSelectedDate();
21591  this.HideDropDownArea(true);
21592 },
21593 OnTimeEditInternalValueChanging: function(date) {
21594  var clock = this.GetClock();
21595  if(clock)
21596   clock.SetDate(date);
21597 },
21598 OnArrowUp: function(evt){ 
21599  var isProcessed = ASPxClientDropDownEditBase.prototype.OnArrowUp.call(this, evt);
21600  if(!isProcessed && this.droppedDown)
21601   return this.OnCalendarMethod("OnArrowUp", evt);       
21602  return false;
21603 },
21604 OnArrowDown: function(evt){
21605  var isProcessed = ASPxClientDropDownEditBase.prototype.OnArrowDown.call(this, evt);
21606  if(!isProcessed && this.droppedDown)
21607   return this.OnCalendarMethod("OnArrowDown", evt);
21608  return false;
21609 },
21610 OnArrowLeft: function(evt){
21611  if(this.droppedDown) {
21612   this.OnCalendarMethod("OnArrowLeft", evt);
21613   return true;
21614  }
21615  return false;
21616 },
21617 OnArrowRight: function(evt){
21618  if(this.droppedDown) { 
21619   this.OnCalendarMethod("OnArrowRight", evt);
21620   return true;
21621  }
21622  return false;
21623 },
21624 OnPageUp: function(evt){
21625  if(this.droppedDown) { 
21626   this.OnCalendarMethod("OnPageUp", evt);
21627   return true;
21628  }
21629  return false;  
21630 },
21631 OnPageDown: function(evt){
21632  if(this.droppedDown) {
21633   this.OnCalendarMethod("OnPageDown", evt);
21634   return true;
21635  }
21636  return false;  
21637 },
21638 OnEndKeyDown: function(evt) {
21639  if(this.droppedDown) {
21640   this.OnCalendarMethod("OnEndKeyDown", evt);
21641   return true;
21642  }
21643  return false;
21644 },
21645 OnHomeKeyDown: function(evt) {
21646  if(this.droppedDown) {
21647   this.OnCalendarMethod("OnHomeKeyDown", evt);
21648   return true;
21649  }
21650  return false; 
21651 },
21652 OnCalendarMethod: function(methodName, evt){
21653  var calendar = this.GetCalendar();
21654  if(!calendar.IsFastNavigationActive())
21655   this.SetTextWasLastTemporaryChanged(false);
21656  return calendar[methodName](evt);
21657 },
21658 GetDateByCurrentValueString: function(valueString) {
21659  var inputValueParseResult = this.dateFormatter.Parse(valueString);
21660  return inputValueParseResult ? inputValueParseResult : null;
21661 },
21662 OnKeyDown: function(evt) {
21663  ASPxClientDropDownEditBase.prototype.OnKeyDown.call(this, evt);
21664  this.keyUpProcessing = true;
21665 },
21666 OnKeyUp: function(evt) {
21667  if(ASPx.FilteringUtils.EventKeyCodeChangesTheInput(evt)){
21668   this.SetTextWasLastTemporaryChanged(true);
21669   if (this.UseRestrictions() && this.outOfRangeWarningManager) {
21670    var valueString = this.GetInputElement().value;
21671    this.lastValue = valueString;
21672    var currentDate = this.GetDateByCurrentValueString(valueString);
21673    this.outOfRangeWarningManager.UpdateOutOfRangeWarningElementVisibility(currentDate);
21674   }
21675  }
21676  this.keyUpProcessing = false;
21677  this.EnsureClearButtonVisibility();
21678 },
21679 SetTextChangingTimer: function () {
21680  if(this.pasteTimerID === -1)
21681   this.pasteTimerID = ASPx.Timer.SetControlBoundInterval(this.OnTextChangingCheck, this, ASPx.PasteCheckInterval);
21682 },
21683 ClearTextChangingTimer: function () {
21684  this.pasteTimerID = ASPx.Timer.ClearInterval(this.pasteTimerID);
21685 },
21686 OnTextChangingCheck: function (evt) {
21687  var input = this.GetInputElement();
21688  if (!input)
21689   return;
21690  var curValueString = input.value.toString();
21691  if (this.lastValue != curValueString && !this.keyUpProcessing) {
21692   var isChromeOnAndroid = ASPx.Browser.AndroidMobilePlatform && ASPx.Browser.Chrome;
21693   if (!isChromeOnAndroid)
21694    this.OnPaste(curValueString);
21695  }
21696 },
21697 OnPaste: function (valueString) {
21698  this.lastValue = valueString;
21699  if (this.UseRestrictions() && this.outOfRangeWarningManager) {
21700   var currentDate = this.GetDateByCurrentValueString(valueString);
21701   this.outOfRangeWarningManager.UpdateOutOfRangeWarningElementVisibility(currentDate);
21702  }
21703 },
21704 OnEnter: function() {
21705  this.enterProcessed = false; 
21706  if(this.droppedDown) {
21707   var calendar = this.GetCalendar();
21708   if(calendar.IsFastNavigationActive())
21709    calendar.GetFastNavigation().OnEnter();
21710   else if(this.GetTextWasLastTemporaryChanged()){
21711    this.ParseValue();
21712    this.HideDropDownArea(true);
21713   } else {
21714    var calendarSelection = this.GetCalendar().GetValue();
21715    if(this.GetShowTimeSection()) {
21716     if(calendarSelection) {
21717      this.ApplyTimeSectionDateChanges();
21718      ASPx.Selection.Set(this.GetInputElement());
21719     } 
21720     this.HideDropDownArea(true);
21721    } else
21722     this.OnCalendarSelectionChanging(calendarSelection, true);
21723   }
21724   this.enterProcessed = true;
21725  }
21726  else
21727   this.OnApplyChanges();
21728  this.SetTextWasLastTemporaryChanged(false);
21729  return this.enterProcessed;
21730 },
21731 OnEscape: function() {
21732  if(this.droppedDown){
21733   if(this.GetCalendar().IsFastNavigationActive())
21734    this.GetCalendar().OnEscape();
21735   else
21736    this.HideDropDownArea(true);
21737  } else {
21738   this.ChangeDate(this.date);  
21739  }
21740  this.SetTextWasLastTemporaryChanged(false);
21741  return true;
21742 },
21743 OnTab: function(evt){
21744  if(!this.droppedDown) return;
21745  var calendar = this.GetCalendar();
21746  if(calendar.IsFastNavigationActive()) 
21747   calendar.GetFastNavigation().Hide();
21748  if(this.GetShowTimeSection()) {
21749   this.lockLostFocus = true;
21750   if(this.GetCalendarOwner()) {
21751    ASPx.Evt.PreventEvent(evt);  
21752    this.GetTimeEdit().SetFocus();
21753   }
21754   return;
21755  }
21756  if(this.GetTextWasLastTemporaryChanged()){
21757   this.ParseValue();
21758   this.HideDropDownArea(true);
21759  } else 
21760   this.OnCalendarSelectionChanging(this.GetCalendar().GetValue(), false);
21761  this.SetTextWasLastTemporaryChanged(false);
21762 },
21763 HideDropDownArea: function(isRaiseEvent) {
21764  if(this.accessibilityCompliant && this.focused)
21765   this.OnHideCalendarAccessible();
21766  var calendar = this.GetCalendar();
21767  if(calendar)
21768   calendar.EnsureHideFastNavigation();
21769  ASPxClientDropDownEditBase.prototype.HideDropDownArea.call(this, isRaiseEvent);
21770 },
21771 OnTextChanged: function() {
21772  if(!this.IsFocusEventsLocked() || !this.droppedDown) {
21773   ASPxClientDropDownEditBase.prototype.OnTextChanged.call(this);
21774   var newText = this.GetInputElement().value;
21775   if(this.accessibilityCompliant) {
21776    if(!newText)
21777     newText = ASPx.AccessibilitySR.BlankEditorText;
21778    var accessibilityElement = this.GetAccessibilityAssistantElement();
21779    ASPx.Attr.SetAttribute(accessibilityElement, "aria-label", newText);
21780   }
21781  }
21782 },
21783 IsMaskInfoEmpty: function() {
21784  return this.maskInfo && (this.maskInfo.IsEmpty() || this.GetValue() == null);
21785 },
21786 ParseValue: function() { 
21787  this.ParseValueCore(true);
21788 },
21789 ParseValueCore: function(raiseChangedEvent) {
21790  var date;
21791  if(this.maskInfo != null) {   
21792   date = ASPx.MaskDateTimeHelper.GetDate(this.maskInfo, this.date);
21793  } else {
21794   var text = this.GetInputElement().value;
21795   var userParseResult = this.GetUserParsedDate(text);
21796   if(userParseResult !== false) {
21797    date = userParseResult;
21798   } else {
21799    if(text == null || text == "" || text == this.nullText)
21800     date = null;
21801    else
21802     date = !this.focused && raiseChangedEvent ? this.date : this.dateFormatter.ParseAndMergeWithDate(text, this.date);
21803   }   
21804  }
21805  if(this.GetShowTimeSection() && !this.HasTimeInEditFormat() && date)
21806   this.ApplyExistingTime(date);
21807  this.ApplyParsedDate(date, raiseChangedEvent);
21808  this.lastValue = this.GetInputElement().value;
21809 },
21810 GetUserParsedDate: function(text) {
21811  if(!this.ParseDate.IsEmpty()) {
21812   var args = new ASPxClientParseDateEventArgs(text);
21813   this.ParseDate.FireEvent(this, args);
21814   if(args.handled)
21815    return args.date;
21816  }
21817  return false;
21818 },
21819 ApplyParsedDate: function(date, raiseChangedEvent) {
21820  if(date === false || !ASPxClientCalendarDateDisabledHelper.IsDateInRange(this.sharedParameters, date) ||
21821   this.IsDateDisabled(date)) {
21822   switch(this.dateOnError) {
21823    case "n":
21824     date = null;
21825     break;
21826    case "t":
21827     date = new Date();
21828     break;
21829    default:
21830     date = this.date;
21831     break;
21832   }
21833  }
21834  if(!this.allowNull && date == null)
21835   date = this.date;
21836  if(raiseChangedEvent)
21837   this.ChangeDate(date);  
21838  else
21839   this.SetValue(date);
21840 },
21841 SetSelectionOnToggleTextDecoration: function(input, sel) {
21842  if(this.maskInfo != null && this.GetValue() === null)
21843   sel.endPos = sel.startPos = 0;
21844  ASPxClientDropDownEditBase.prototype.SetSelectionOnToggleTextDecoration.call(this, input, sel);
21845 },
21846 IsDateDisabled: function(date) {
21847  return ASPxClientCalendarDateDisabledHelper.IsDateDisabled(this.sharedParameters, date, function(d) { return this.OnCustomDisabledDate(d); }.aspxBind(this));
21848 },
21849 HasTimeInEditFormat: function() {
21850  if(this.maskInfo) {
21851   for(var i = 0; i < this.maskInfo.parts.length; i++) {
21852    var part = this.maskInfo.parts[i];
21853    if(part.dateTimeRole && part.dateTimeRole.toLowerCase() == "h")
21854     return true;
21855   }
21856   return false;
21857  }
21858  return this.dateFormatter.mask.toLowerCase().indexOf("h") != -1;
21859 },
21860 ApplyExistingTime: function(date) {
21861  if(this.date == null)  return;  
21862  var savedDay = date.getDate();
21863  date.setHours(this.date.getHours());
21864  var diff = date.getDate() - savedDay;
21865  if(diff != 0) {
21866   var sign = (diff == 1 || date.getDate() == 1) ? -1 : 1;
21867   date.setTime(date.getTime() + sign * 3600000);
21868  }
21869  date.setMinutes(this.date.getMinutes());
21870  date.setSeconds(this.date.getSeconds());
21871  date.setMilliseconds(this.date.getMilliseconds());
21872 },
21873 GetValue: function() {
21874  return this.date;
21875 },
21876 GetLastSuccesfullValue: function() {
21877  return this.GetValue();
21878 },
21879 GetValueString: function() {
21880  return this.date != null ? ASPx.DateUtils.GetInvariantDateTimeString(this.date) : null;
21881 },
21882 SetValue: function(date) {  
21883  this.date = date;
21884  if(this.maskInfo != null) {
21885   ASPx.MaskDateTimeHelper.SetDate(this.maskInfo, date);
21886   this.ApplyMaskInfo(false);
21887   this.SavePrevMaskValue();
21888  } else {
21889   this.GetInputElement().value = this.GetFormattedDate();
21890   this.SyncRawValue();
21891   if(this.CanApplyTextDecorators())
21892    this.ToggleTextDecoration();
21893  }
21894  if(this.styleDecoration)
21895   this.styleDecoration.Update();
21896  this.RaiseValueSet();
21897 },
21898 RaiseValueSet: function() {
21899  if (!this.ValueSet.IsEmpty())
21900   this.ValueSet.FireEvent(this);
21901 },
21902 ChangeDate: function(date) { 
21903  var changed = !ASPx.DateUtils.AreDatesEqualExact(this.date, date);
21904  this.SetValue(date);
21905  var forceValueChanged = this.IsValueChangeForced() && !this.IsValueChanging();
21906  if(changed || forceValueChanged) {
21907   try {
21908    this.StartValueChanging();
21909    this.dateChangeProcessing = true;
21910    this.RaisePersonalStandardValidation();
21911    this.OnValueChanged();
21912   }
21913   finally {
21914    this.dateChangeProcessing = false;
21915    this.EndValueChanging();
21916   }
21917  }
21918 },
21919 IsDateChangeProcessing: function() {
21920  return this.dateChangeProcessing;
21921 },
21922 getProcessOnServerOnValueChanged: function() {
21923  var dateRangePair = ASPxDateRangeHelper.GetDateEditPair(ASPxClientDateEdit.active);
21924  if(!dateRangePair.isInRangeMode)
21925   return ASPxClientDropDownEditBase.prototype.getProcessOnServerOnValueChanged.call(this);
21926  var processOnServer = this.RaiseValueChangedEvent();
21927  return this.RaiseValidationInternal() && processOnServer;
21928 },
21929 GetText: function() {
21930  return this.GetFormattedDate();
21931 },
21932 SetText: function(value) {
21933  ASPxClientTextEdit.prototype.SetValue.call(this, value);
21934  if(this.maskInfo == null)
21935   this.ParseValueCore(false);
21936 },
21937 GetFormattedText: function() {
21938  if(this.maskInfo != null)
21939   return this.GetMaskDisplayText();
21940  if(this.date == null)
21941   return this.nullText;
21942  if(this.displayFormat != null)
21943   return ASPx.Formatter.Format(this.displayFormat, this.date);
21944  return this.GetFormattedDate();
21945 },
21946 ClearEditorValueByClearButtonCore: function() {
21947  if(this.allowNull === false) 
21948   this.SetValue(this.GetLastSuccesfullValue());
21949  else
21950   ASPxClientDropDownEditBase.prototype.ClearEditorValueByClearButtonCore.call(this);
21951 },
21952 ShouldCancelMaskKeyProcessing: function(htmlEvent, keyDownInfo) {
21953  if(htmlEvent.altKey)
21954   return true;
21955  if(ASPxClientDropDownEditBase.prototype.ShouldCancelMaskKeyProcessing.call(this, htmlEvent, keyDownInfo))
21956   return true;  
21957  if(!this.droppedDown)
21958   return false;
21959  if(this.GetShowTimeSection() && htmlEvent.keyCode == ASPx.Key.Tab)
21960   return false;
21961  return !ASPx.MaskManager.IsPrintableKeyCode(keyDownInfo) 
21962   && keyDownInfo.keyCode != ASPx.Key.Backspace
21963   && keyDownInfo.keyCode != ASPx.Key.Delete;
21964 },
21965 DecodeRawInputValue: function(value) {
21966  if(value == "N") return null;
21967  var date = new Date();
21968  date.setTime(Number(value));
21969  var result = ASPx.DateUtils.ToUtcTime(date);
21970  var offsetDiff = ASPx.DateUtils.GetTimeZoneOffset(result) - ASPx.DateUtils.GetTimeZoneOffset(date);
21971  if(offsetDiff !== 0)
21972   result.setTime(result.valueOf() + offsetDiff);
21973  return result;
21974 },
21975 SyncRawValue: function() {
21976  this.SetRawValue(this.date == null ? "N" : ASPx.DateUtils.ToLocalTime(this.date).valueOf());
21977 }, 
21978 HasTextDecorators: function() {
21979  return (this.maskInfo != null && this.date == null) || ASPxClientDropDownEditBase.prototype.HasTextDecorators.call(this);
21980 },
21981 GetMaskDisplayText: function() {
21982  if(!this.focused) {
21983   if(this.date == null)
21984    return this.nullText;
21985   if(this.HasTextDecorators())
21986    return this.GetDecoratedText(this.date);
21987  }
21988  return this.maskInfo.GetText();
21989 },
21990 ToggleTextDecorationCore: function() {
21991  if(this.maskInfo != null) {
21992   this.ApplyMaskInfo(false);
21993  } else {
21994   var text = this.focused ? this.GetFormattedDate() : this.GetFormattedText();
21995   var input = this.GetInputElement();
21996   if(input.value != text)
21997    input.value = text;
21998  }
21999 },
22000 BeginShowMaskHint: function() {
22001 },
22002 EnsureOutOfRangeWarningManager: function () {
22003  this.ensureOutOfRangeWarningManager(this.GetMinDate(), this.GetMaxDate(), null, null, this.dateFormatter);
22004 },
22005 SetReadOnlyInternal: function(readOnly) {
22006  ASPxClientDropDownEditBase.prototype.SetReadOnlyInternal.call(this, readOnly);
22007  var calendar = this.GetCalendar();
22008  if(calendar)
22009   calendar.SetReadOnly(readOnly);
22010  var timeEdit = this.GetTimeEdit();
22011  if(timeEdit)
22012   timeEdit.SetReadOnly(readOnly);
22013 },
22014 OnHideCalendarAccessible: function() {
22015  var inputElement = this.GetInputElement();
22016  var accessibilityElement = this.GetAccessibilityAssistantElement();
22017  var pronounceTimeout = 300;
22018  ASPx.Attr.RemoveAttribute(inputElement, "aria-activedescendant");
22019  window.setTimeout(function() { 
22020   ASPx.Attr.SetAttribute(accessibilityElement, "aria-label", inputElement.value);
22021   ASPx.Attr.SetAttribute(inputElement, "aria-activedescendant", accessibilityElement.id);
22022  }, pronounceTimeout);
22023 },
22024 RaiseDateChanged: function(processOnServer, isInternal) {
22025  if(!this.DateChanged.IsEmpty()) {
22026   var args = new ASPxClientProcessingModeEventArgs(processOnServer);
22027   if (isInternal)
22028    args.isInternal = true;
22029   this.DateChanged.FireEvent(this, args);
22030   processOnServer = args.processOnServer;
22031  }
22032  return processOnServer;
22033 },
22034 RaiseCalendarCustomDisabledDate: function(e) {
22035  this.CalendarCustomDisabledDate.FireEvent(this, e);
22036 },
22037 SetDate: function(date) {
22038  this.SetValue(date);
22039  if(this.droppedDown)
22040   this.SetCalendarAndTimeSectionValues();
22041 },
22042 GetDate: function() {
22043  return this.date ? new Date(this.date.valueOf()) : null;
22044 },
22045 GetRangeDayCount: function () {
22046  var dateRangePair = ASPxDateRangeHelper.GetDateEditPair(this);
22047  return dateRangePair.isStart ? -1 : ASPxDateRangeHelper.GetFullDaysInCurrentRange(dateRangePair);
22048 },
22049 GetMinDate: function() {
22050  return this.sharedParameters.minDate;
22051 },
22052 SetMinDate: function(date) {
22053  this.SetMinDateCore(date);
22054  this.ownMinDate = date;
22055 },
22056 SetMinDateCore: function (date) {
22057  this.sharedParameters.minDate = date;
22058  if(this.droppedDown) {
22059   var calendar = this.GetCalendar();
22060   if(calendar)
22061    calendar.SetMinDate(date);
22062  }
22063  if(this.showOutOfRangeWarning) {
22064   this.EnsureOutOfRangeWarningManager();
22065   this.outOfRangeWarningManager.SetMinValue(this.GetMinDate());
22066  }    
22067 },
22068 GetMaxDate: function() {
22069  return this.sharedParameters.maxDate;
22070 },
22071 SetMaxDate: function (date) {
22072  this.sharedParameters.maxDate = date;
22073  if(this.droppedDown) {
22074   var calendar = this.GetCalendar();
22075   if(calendar)
22076    calendar.SetMaxDate(date);
22077  }
22078  if(this.showOutOfRangeWarning) {
22079   this.EnsureOutOfRangeWarningManager();
22080   this.outOfRangeWarningManager.SetMaxValue(this.GetMaxDate());
22081  }
22082 }
22083});
22084ASPxClientDateEdit.SharedCalendarCollection = (function(){
22085 var sharedCalendarIdCollection = [];
22086 return {
22087  registerCalendarId: function(calendarId) {
22088   if(ASPx.Data.ArrayIndexOf(sharedCalendarIdCollection, calendarId) == -1)
22089    sharedCalendarIdCollection.push(calendarId);
22090  },
22091  calendarIsShared: function(calendarId) {
22092   return ASPx.Data.ArrayIndexOf(sharedCalendarIdCollection, calendarId) != -1;
22093  }
22094 };
22095})();
22096ASPxClientDateEdit.Cast = ASPxClientControl.Cast;
22097ASPxClientDateEdit.active = null;
22098ASPxClientDateEdit.HandleCalendarSelectionChanging = function(s, e) {
22099 if(ASPxClientDateEdit.active == null) return;
22100 ASPxClientDateEdit.active.OnCalendarSelectionChanging(e.selection.GetFirstDate(), true);
22101};
22102ASPxClientDateEdit.HandleCalendarCustomDisabledDate = function(s, e) {
22103 this.OnCalendarCustomDisabledDate(e);
22104};
22105ASPxClientDateEdit.HandleTimeEditInternalValueChanging = function(s, date) {
22106 if(ASPxClientDateEdit.active == null) return;
22107 ASPxClientDateEdit.active.OnTimeEditInternalValueChanging(date);
22108};
22109ASPxClientDateEdit.HandleCalendarMainElementClick = function(s, e) {
22110 var dateEdit = ASPxClientDateEdit.active;
22111 if(dateEdit == null) 
22112  return;
22113 var focusEditor = true;
22114 if(dateEdit.GetShowTimeSection())
22115  focusEditor = !ASPx.GetIsParent(dateEdit.GetTimeEdit().GetMainElement(), ASPx.Evt.GetEventSource(e));
22116 if(focusEditor) {
22117  if(ASPx.Browser.VirtualKeyboardSupported)
22118   ASPx.VirtualKeyboardUI.smartFocusEditor(dateEdit);
22119  else 
22120   dateEdit.SetFocus();
22121 }
22122};
22123var ASPxClientParseDateEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
22124 constructor: function(value) {
22125  this.constructor.prototype.constructor.call(this);
22126  this.value = value;
22127  this.date = null;
22128  this.handled = false;
22129 } 
22130});
22131ASPx.DECalOkClick = function() {
22132 var edit = ASPxClientDateEdit.active;
22133 if(edit)
22134  edit.OnTimeSectionOkClick();
22135};
22136ASPx.DECalCancelClick = function() {
22137 var edit = ASPxClientDateEdit.active;
22138 if(edit)
22139  edit.OnTimeSectionCancelClick();
22140};
22141ASPx.DECalClearClick = function() {
22142 var edit = ASPxClientDateEdit.active;
22143 if(edit)
22144  edit.OnTimeSectionClearClick();
22145};
22146ASPx.DETimeEditKeyDown = function(s,e) {
22147 var edit = ASPxClientDateEdit.active;
22148 if(!edit) return;
22149 switch(e.htmlEvent.keyCode) {
22150  case ASPx.Key.Enter:
22151   edit.OnTimeEditEnter();
22152   break;
22153  case ASPx.Key.Esc:
22154   edit.OnTimeEditEsc();
22155   break;
22156  case ASPx.Key.Tab:
22157   edit.OnTimeEditTab(e.htmlEvent.shiftKey);
22158   break;
22159 }
22160};
22161ASPx.DETimeEditLostFocus = function() {
22162 var edit = ASPxClientDateEdit.active;
22163 if(!edit) return;
22164 edit.OnTimeEditLostFocus();
22165};
22166window.ASPxClientDateEdit = ASPxClientDateEdit;
22167window.ASPxClientParseDateEventArgs = ASPxClientParseDateEventArgs;
22168ASPx.DateRangeValidationPattern = DateRangeValidationPattern;
22169})();
22170
22171(function () {
22172var PopupUtils = {
22173 NotSetAlignIndicator: "NotSet",
22174 InnerAlignIndicator: "Sides",
22175 OutsideLeftAlignIndicator: "OutsideLeft",
22176 LeftSidesAlignIndicator: "LeftSides",
22177 RightSidesAlignIndicator: "RightSides",
22178 OutsideRightAlignIndicator: "OutsideRight",
22179 CenterAlignIndicator: "Center",
22180 AboveAlignIndicator: "Above",
22181 TopSidesAlignIndicator: "TopSides",
22182 MiddleAlignIndicator: "Middle",
22183 BottomSidesAlignIndicator: "BottomSides",
22184 BelowAlignIndicator: "Below",
22185 WindowCenterAlignIndicator: "WindowCenter",
22186 LeftAlignIndicator: "Left",
22187 RightAlignIndicator: "Right",
22188 TopAlignIndicator: "Top",
22189 BottomAlignIndicator: "Bottom",
22190 WindowLeftAlignIndicator: "WindowLeft",
22191 WindowRightAlignIndicator: "WindowRight",
22192 WindowTopAlignIndicator: "WindowTop",
22193 WindowBottomAlignIndicator: "WindowBottom",
22194 IsAlignNotSet: function (align) {
22195  return align == PopupUtils.NotSetAlignIndicator;
22196 },
22197 IsInnerAlign: function (align) {
22198  return align.indexOf(PopupUtils.InnerAlignIndicator) != -1;
22199 },
22200 IsRightSidesAlign: function(align) {
22201  return align == PopupUtils.RightSidesAlignIndicator;
22202 },
22203 IsOutsideRightAlign: function(align) {
22204  return align == PopupUtils.OutsideRightAlignIndicator;
22205 },
22206 IsCenterAlign: function(align) {
22207  return align == PopupUtils.CenterAlignIndicator;
22208 },
22209 FindPopupElementById: function (id) {
22210  if(id == "")
22211   return null; 
22212  var popupElement = ASPx.GetElementById(id);
22213  if(!ASPx.IsExistsElement(popupElement)) {
22214   var idParts = id.split("_");
22215   var uniqueId = idParts.join("$");
22216   popupElement = ASPx.GetElementById(uniqueId);
22217  }
22218  return popupElement;
22219 },
22220 FindEventSourceParentByTestFunc: function (evt, testFunc) {
22221  return ASPx.GetParent(ASPx.Evt.GetEventSource(evt), testFunc);
22222 },
22223 PreventContextMenu: function (evt) {
22224  if(evt.stopPropagation)
22225   evt.stopPropagation();
22226  if(evt.preventDefault)
22227   evt.preventDefault();
22228  if(ASPx.Browser.WebKitFamily)
22229   evt.returnValue = false;
22230 },
22231 GetDocumentClientWidthForPopup: function() {
22232  return ASPx.Browser.WebKitTouchUI ? document.body.offsetWidth : ASPx.GetDocumentClientWidth();
22233 },
22234 GetDocumentClientHeightForPopup: function() {
22235  return ASPx.Browser.WebKitTouchUI ? document.body.offsetHeight : ASPx.GetDocumentClientHeight();
22236 },
22237 AdjustPositionToClientScreen: function (element, pos, rtl, isX) {
22238  var min = isX ? ASPx.GetDocumentScrollLeft() : ASPx.GetDocumentScrollTop(),
22239   max = min + (isX ? ASPx.GetDocumentClientWidth() : ASPx.GetDocumentClientHeight());
22240  max -= (isX ? element.offsetWidth : element.offsetHeight);
22241  if(rtl) {
22242   if(pos < min) pos = min;
22243   if(pos > max) pos = max;
22244  } else {
22245   if(pos > max) pos = max;
22246   if(pos < min) pos = min;
22247  }
22248  return pos;
22249 },
22250 GetPopupAbsoluteX: function(element, popupElement, hAlign, hOffset, x, left, rtl, isPopupFullCorrectionOn) {
22251  return PopupUtils.getPopupAbsolutePos(element, popupElement, hAlign, hOffset, x, left, rtl, isPopupFullCorrectionOn, false, true);
22252 },
22253 GetPopupAbsoluteY: function (element, popupElement, vAlign, vOffset, y, top, isPopupFullCorrectionOn, ignoreAlignWithoutScrollReserve) {
22254  return PopupUtils.getPopupAbsolutePos(element, popupElement, vAlign, vOffset, y, top, false, isPopupFullCorrectionOn, ignoreAlignWithoutScrollReserve, false);
22255 },
22256 getPopupAbsolutePos: function(element, popupElement, align, offset, startPos, startPosInit, rtl, isPopupFullCorrectionOn, ignoreAlignWithoutScrollReserve, isHorizontal) {
22257  var calculator = getPositionCalculator();
22258  calculator.applyParams(element, popupElement, align, offset, startPos, startPosInit, rtl, isPopupFullCorrectionOn, ignoreAlignWithoutScrollReserve, isHorizontal);
22259  var position = calculator.getPopupAbsolutePos();
22260  calculator.disposeState();
22261  return position;
22262 },
22263 RemoveFocus: function (parent) {
22264  var div = document.createElement('div');
22265  div.tabIndex = "-1";
22266  PopupUtils.ConcealDivElement(div);
22267  parent.appendChild(div);
22268  if(ASPx.IsFocusable(div))
22269   div.focus();
22270  ASPx.RemoveElement(div);
22271 },
22272 ConcealDivElement: function (div) {
22273  div.style.position = "absolute";
22274  div.style.left = 0;
22275  div.style.top = 0;
22276  if(ASPx.Browser.WebKitFamily) {
22277   div.style.opacity = 0;
22278   div.style.width = 1;
22279   div.style.height = 1;
22280  } else {
22281   div.style.border = 0;
22282   div.style.width = 0;
22283   div.style.height = 0;
22284  }
22285 },
22286 InitAnimationProperties: function(element, onAnimStopCallString) {
22287  element.popuping = true;
22288  element.onAnimStopCallString = onAnimStopCallString;
22289 },
22290 InitAnimationDiv: function (element, x, y, onAnimStopCallString, skipSizeInit) {
22291  PopupUtils.InitAnimationProperties(element, onAnimStopCallString);
22292  PopupUtils.InitAnimationDivCore(element);
22293  if(!skipSizeInit)
22294   ASPx.SetStyles(element, { width: element.offsetWidth, height: element.offsetHeight });
22295  ASPx.SetStyles(element, { left: x, top: y });
22296 },
22297 InitAnimationDivCore: function (element) {
22298  ASPx.SetStyles(element, {
22299   overflow: "hidden",
22300   position: "absolute"
22301  });
22302 },
22303 StartSlideAnimation: function (animationDivElement, element, iframeElement, duration, preventChangingWidth, preventChangingHeight) {
22304  if(iframeElement) {
22305   var endLeft = ASPx.PxToInt(iframeElement.style.left);
22306   var endTop = ASPx.PxToInt(iframeElement.style.top);
22307   var startLeft = ASPx.PxToInt(element.style.left) < 0 ? endLeft : animationDivElement.offsetLeft + animationDivElement.offsetWidth;
22308   var startTop = ASPx.PxToInt(element.style.top) < 0 ? endTop : animationDivElement.offsetTop + animationDivElement.offsetHeight;
22309   var properties = {
22310    left: { from: startLeft, to: endLeft, unit: "px" },
22311    top: { from: startTop, to: endTop, unit: "px" }
22312   };
22313   if(!preventChangingWidth)
22314    properties.width = { to: element.offsetWidth, unit: "px" };
22315   if(!preventChangingHeight)
22316    properties.height = { to: element.offsetHeight, unit: "px" };
22317   ASPx.AnimationHelper.createMultipleAnimationTransition(iframeElement, {
22318    duration: duration
22319   }).Start(properties);
22320  }
22321  ASPx.AnimationHelper.createMultipleAnimationTransition(element, {
22322   duration: duration,
22323   onComplete: function () { PopupUtils.AnimationFinished(animationDivElement, element); }
22324  }).Start({
22325   left: { to: 0, unit: "px" },
22326   top: { to: 0, unit: "px" }
22327  });
22328 },
22329 AnimationFinished: function (animationDivElement, element) {
22330  if(PopupUtils.StopAnimation(animationDivElement, element) && ASPx.IsExists(animationDivElement.onAnimStopCallString) &&
22331   animationDivElement.onAnimStopCallString !== "") {
22332   window.setTimeout(animationDivElement.onAnimStopCallString, 0);
22333  }
22334 },
22335 StopAnimation: function (animationDivElement, element) {
22336  if(animationDivElement.popuping) {
22337   ASPx.AnimationHelper.cancelAnimation(element);
22338   animationDivElement.popuping = false;
22339   animationDivElement.style.overflow = "visible";
22340   return true;
22341  }
22342  return false;
22343 },
22344 GetAnimationHorizontalDirection: function (popupPosition, horizontalAlign, verticalAlign, rtl) {
22345  if(PopupUtils.IsInnerAlign(horizontalAlign)
22346   && !PopupUtils.IsInnerAlign(verticalAlign)
22347   && !PopupUtils.IsAlignNotSet(verticalAlign))
22348   return 0;
22349  var toTheLeft = (horizontalAlign == PopupUtils.OutsideLeftAlignIndicator || horizontalAlign == PopupUtils.RightSidesAlignIndicator || (horizontalAlign == PopupUtils.NotSetAlignIndicator && rtl)) ^ popupPosition.isInverted;
22350  return toTheLeft ? 1 : -1;
22351 },
22352 GetAnimationVerticalDirection: function (popupPosition, horizontalAlign, verticalAlign) {
22353  if(PopupUtils.IsInnerAlign(verticalAlign)
22354   && !PopupUtils.IsInnerAlign(horizontalAlign)
22355   && !PopupUtils.IsAlignNotSet(horizontalAlign))
22356   return 0;
22357  var toTheTop = (verticalAlign == PopupUtils.AboveAlignIndicator || verticalAlign == PopupUtils.BottomSidesAlignIndicator) ^ popupPosition.isInverted;
22358  return toTheTop ? 1 : -1;
22359 },
22360 IsVerticalScrollExists: function () {
22361  var scrollIsNotHidden = ASPx.GetCurrentStyle(document.body).overflowY !== "hidden" && ASPx.GetCurrentStyle(document.documentElement).overflowY !== "hidden";
22362  return (scrollIsNotHidden && ASPx.GetDocumentHeight() > ASPx.GetDocumentClientHeight());
22363 },
22364 CoordinatesInDocumentRect: function (x, y) {
22365  var docScrollLeft = ASPx.GetDocumentScrollLeft();
22366  var docScrollTop = ASPx.GetDocumentScrollTop();
22367  return (x > docScrollLeft && y > docScrollTop &&
22368   x < ASPx.GetDocumentClientWidth() + docScrollLeft &&
22369   y < ASPx.GetDocumentClientHeight() + docScrollTop);
22370 },
22371 GetElementZIndexArray: function (element) {
22372  var currentElement = element;
22373  var zIndexesArray = [0];
22374  while(currentElement && currentElement.tagName != "BODY") {
22375   if(currentElement.style) {
22376    if(typeof (currentElement.style.zIndex) != "undefined" && currentElement.style.zIndex != "")
22377     zIndexesArray.unshift(currentElement.style.zIndex);
22378   }
22379   currentElement = currentElement.parentNode;
22380  }
22381  return zIndexesArray;
22382 },
22383 IsHigher: function (higherZIndexArrat, zIndexArray) {
22384  if(zIndexArray == null) return true;
22385  var count = (higherZIndexArrat.length >= zIndexArray.length) ? higherZIndexArrat.length : zIndexArray.length;
22386  for(var i = 0; i < count; i++)
22387   if(typeof (higherZIndexArrat[i]) != "undefined" && typeof (zIndexArray[i]) != "undefined") {
22388    var higherZIndexArrayCurrentElement = parseInt(higherZIndexArrat[i].toString());
22389    var zIndexArrayCurrentElement = parseInt(zIndexArray[i].toString());
22390    if(higherZIndexArrayCurrentElement != zIndexArrayCurrentElement)
22391     return higherZIndexArrayCurrentElement > zIndexArrayCurrentElement;
22392   } else return typeof (zIndexArray[i]) == "undefined";
22393  return true;
22394 },
22395 TestIsPopupElement: function (element) {
22396  return !!element.DXPopupElementControl;
22397 },
22398 adjustViewportScrollWrapper: function(wrapper, wrapperScroll, windowElement) {
22399  var document = wrapper.ownerDocument;
22400  var window = document.defaultView || document.parentWindow;
22401  var isWindowElementDisplayed = ASPx.IsElementDisplayed(windowElement);
22402  if(!isWindowElementDisplayed) {
22403   wrapper.style.cssText = "";
22404   wrapperScroll.style.cssText = "";
22405   return; 
22406  }
22407  var windowRect = windowElement.getBoundingClientRect();
22408  var yAxis = this.calculateViewPortScrollDataByAxis(wrapper.style.top, windowRect.top, windowElement.offsetHeight, window.innerHeight, wrapper.scrollTop);
22409  var xAxis = this.calculateViewPortScrollDataByAxis(wrapper.style.left, windowRect.left, windowElement.offsetWidth, window.innerWidth, wrapper.scrollLeft);
22410  this.prepareViewPortScrollData(xAxis, yAxis);
22411  ASPx.SetStyles(windowElement, {
22412   top: yAxis.windowOffset,
22413   left: xAxis.windowOffset
22414  });
22415  ASPx.SetStyles(wrapper, {
22416   width: xAxis.wrapperSize,
22417   height: yAxis.wrapperSize,
22418   position: "absolute",
22419   overflow: ASPx.Browser.MobileUI ? "scroll" : "auto",
22420   zIndex: windowElement.style.zIndex
22421  });
22422  ASPx.SetAbsoluteX(wrapper, ASPx.GetDocumentScrollLeft());
22423  ASPx.SetAbsoluteY(wrapper, ASPx.GetDocumentScrollTop());
22424  ASPx.SetStyles(wrapperScroll, {
22425   width: xAxis.wrapperScrollSize,
22426   height: yAxis.wrapperScrollSize,
22427   position: "absolute",
22428   overflow: "hidden"
22429  });
22430  wrapper.scrollLeft = xAxis.scrollSize;
22431  wrapper.scrollTop = yAxis.scrollSize;
22432 },
22433 calculateViewPortScrollDataByAxis: function(wrapperOffsetStyle, windowOffset, windowSize, viewPortSize, scrollSize) {
22434  var isWindowOffsetNegative = windowOffset < 0;
22435  windowOffset = isWindowOffsetNegative ? 0 : windowOffset;
22436  var wrapperScrollSize = Math.max(viewPortSize + Math.abs(Math.min(0, windowOffset)), windowSize + Math.abs(windowOffset));
22437  return { 
22438   windowOffset: isWindowOffsetNegative ? 0 : windowOffset,
22439   wrapperSize: viewPortSize,
22440   wrapperScrollSize: wrapperScrollSize,
22441   scrollSize: isWindowOffsetNegative ? scrollSize + Math.abs(windowOffset) : 0,
22442   hasScroll: wrapperScrollSize > viewPortSize
22443  };
22444 },
22445 prepareViewPortScrollData: function(xAxis, yAxis) {
22446  var scrollBarSize = ASPx.GetVerticalScrollBarWidth();
22447  if(yAxis.hasScroll && !xAxis.hasScroll) {
22448   xAxis.wrapperScrollSize = Math.min(xAxis.wrapperSize - scrollBarSize, xAxis.wrapperScrollSize);
22449  } else if(xAxis.hasScroll && !yAxis.hasScroll) {
22450   yAxis.wrapperScrollSize = Math.min(yAxis.wrapperSize - scrollBarSize, yAxis.wrapperScrollSize);
22451  } else if(yAxis.hasScroll && xAxis.hasScroll) {
22452   yAxis.wrapperScrollSize -= scrollBarSize;
22453   xAxis.wrapperScrollSize -= scrollBarSize;
22454  }
22455 }
22456};
22457PopupUtils.OverControl = {
22458 GetPopupElementByEvt: function (evt) {
22459  return PopupUtils.FindEventSourceParentByTestFunc(evt, PopupUtils.TestIsPopupElement);
22460 },
22461 OnMouseEvent: function (evt, mouseOver) {
22462  var popupElement = PopupUtils.OverControl.GetPopupElementByEvt(evt);
22463  if(mouseOver)
22464   popupElement.DXPopupElementControl.OnPopupElementMouseOver(evt, popupElement);
22465  else
22466   popupElement.DXPopupElementControl.OnPopupElementMouseOut(evt, popupElement);
22467 },
22468 OnMouseOut: function (evt) {
22469  PopupUtils.OverControl.OnMouseEvent(evt, false);
22470 },
22471 OnMouseOver: function (evt) {
22472  PopupUtils.OverControl.OnMouseEvent(evt, true);
22473 }
22474};
22475PopupUtils.BodyScrollHelper = (function () {
22476 var windowScrollLock = {},
22477  windowScroll = {},
22478  hideScrollbarsClassName = "dxpc-hideScrollbars";
22479 function lockWindowScroll(windowId) {
22480  windowScrollLock[windowId] = true;
22481 }
22482 function unlockWindowScroll(windowId) {
22483  delete windowScrollLock[windowId];
22484 }
22485 function isLocked(windowId) {
22486  return !!windowScrollLock[windowId];
22487 }
22488 function isAnyWindowScrollLocked() {
22489  for(var key in windowScrollLock) 
22490   if (windowScrollLock.hasOwnProperty(key) && windowScrollLock[key] === true)
22491    return true;
22492  return false;
22493 }
22494 function replaceVerticalScrollByMargin() {
22495  var currentBodyStyle = ASPx.GetCurrentStyle(document.body),
22496   marginWidth = ASPx.GetVerticalScrollBarWidth() + ASPx.PxToInt(currentBodyStyle.paddingRight);
22497  ASPx.Attr.ChangeStyleAttribute(document.body, "padding-right", marginWidth + "px");
22498 }
22499 function restoreBodyScroll(windowId) {
22500  unlockWindowScroll(windowId);
22501  if(isAnyWindowScrollLocked())
22502   return;
22503  if(ASPx.Browser.IE) {
22504   ASPx.Attr.RestoreAttribute(document.body, "scroll");
22505   ASPx.Attr.RestoreStyleAttribute(document.documentElement, "overflow");
22506  } else if(ASPx.Browser.WebKitTouchUI) {
22507   ASPx.Attr.RestoreStyleAttribute(document.body, "position");
22508   ASPx.Attr.RestoreStyleAttribute(document.body, "height");
22509   ASPx.Attr.RestoreStyleAttribute(document.body, "margin");
22510   ASPx.RemoveClassNameFromElement(document.documentElement, hideScrollbarsClassName);
22511   ASPx.Attr.RestoreStyleAttribute(document.body, "overflow");
22512   var currentWindowScroll = windowScroll[windowId];
22513   if(!!currentWindowScroll)
22514    window.scrollTo(currentWindowScroll.x, currentWindowScroll.y);
22515  } else
22516   ASPx.Attr.RestoreStyleAttribute(document.documentElement, "overflow");
22517  ASPx.Attr.RestoreStyleAttribute(document.body, "padding-right");
22518  ASPx.Attr.RestoreStyleAttribute(document.body, "height");
22519  ASPx.Attr.RestoreStyleAttribute(document.body, "width");
22520 }
22521 return {
22522  RestoreIfLocked: function(windowId) {
22523   if(isLocked(windowId))
22524    restoreBodyScroll(windowId);
22525  },
22526  HideBodyScroll: function(windowId) {
22527   if(isAnyWindowScrollLocked()) { 
22528    lockWindowScroll(windowId);
22529    return;
22530   }
22531   lockWindowScroll(windowId);
22532   if(PopupUtils.IsVerticalScrollExists())
22533    replaceVerticalScrollByMargin();
22534   if(ASPx.Browser.IE) {
22535    ASPx.Attr.ChangeAttribute(document.body, "scroll", "no");
22536    ASPx.Attr.ChangeStyleAttribute(document.documentElement, "overflow", "hidden");
22537   } else if(ASPx.Browser.WebKitTouchUI) {
22538    windowScroll[windowId] = { 
22539     x: window.scrollX,
22540     y: window.scrollY
22541    };
22542    ASPx.Attr.ChangeStyleAttribute(document.body, "overflow", "hidden");
22543    ASPx.Attr.ChangeStyleAttribute(document.body, "position", "relative");
22544    ASPx.Attr.ChangeStyleAttribute(document.body, "height", "100%");
22545    ASPx.Attr.ChangeStyleAttribute(document.body, "margin", "0");
22546    ASPx.AddClassNameToElement(document.documentElement, hideScrollbarsClassName);
22547   } else {
22548    ASPx.Attr.ChangeStyleAttribute(document.documentElement, "overflow", "hidden");
22549    var documentHeight = ASPx.GetDocumentHeight();
22550    var documentWidth = ASPx.GetDocumentWidth();
22551    if(window.pageYOffset > 0 && ASPx.PxToInt(window.getComputedStyle(document.body, null)) != documentHeight)
22552     ASPx.Attr.ChangeStyleAttribute(document.body, "height", documentHeight + "px");
22553    if(window.pageXOffset > 0 && ASPx.PxToInt(window.getComputedStyle(document.body, null)) != documentWidth)
22554     ASPx.Attr.ChangeStyleAttribute(document.body, "width", documentWidth + "px");
22555   }
22556  },
22557  RestoreBodyScroll: restoreBodyScroll
22558 };
22559})();
22560var PositionAlignConsts = {
22561 NOT_SET: 0,
22562 OUTSIDE_START: 1,
22563 NEAR_BOUND_START: 2,
22564 INNER_START: 3,
22565 CENTER: 4,
22566 INNER_END: 5,
22567 NEAR_BOUND_END: 6,
22568 OUTSIDE_END: 7,
22569 WINDOW_CENTER: 8,
22570 WINDOW_START: 9,
22571 WINDOW_END: 10
22572};
22573var AlignIndicatorTable = {};
22574var PositionCalculator = ASPx.CreateClass(null, {
22575 constructor: function() {
22576  this.element = null;
22577  this.popupElement = null;
22578  this.align = 0;
22579  this.offset = 0;
22580  this.startPos = 0;
22581  this.startPosInit = 0;
22582  this.rtl = false;
22583  this.isPopupFullCorrectionOn = false;
22584  this.isHorizontal = true;
22585  this.size = 0;
22586  this.bodySize = 0;
22587  this.actualBodySize = 0;
22588  this.elementStartPos = 0;
22589  this.scrollStartPos = 0;
22590  this.isInverted = false;
22591  this.popupElementSize = 0;
22592  this.boundStartPos = 0;
22593  this.boundEndPos = 0;
22594  this.innerBoundStartPos = 0;
22595  this.innerBoundEndPos = 0;
22596  this.isMoreFreeSpaceLeft = false;
22597  this.nearBoundOverlapRate = 0.25;
22598  this.functionsTable = {};
22599  this.initializeFunctionsTable();
22600 },
22601 applyParams: function(element, popupElement, align, offset, startPos, startPosInit, rtl, isPopupFullCorrectionOn, ignoreAlignWithoutScrollReserve, isHorizontal) {
22602  this.isHorizontal = isHorizontal;
22603  this.element = element;
22604  this.popupElement = popupElement;
22605  this.align = this.getAlignValueFromIndicator(align);
22606  this.offset = offset;
22607  this.startPos = startPos;
22608  this.startPosInit = startPosInit;
22609  this.rtl = rtl;
22610  this.isPopupFullCorrectionOn = isPopupFullCorrectionOn;
22611  this.ignoreAlignWithoutScrollReserve = ignoreAlignWithoutScrollReserve;
22612  this.calculateParams();
22613 },
22614 disposeState: function() {
22615  this.element = null;
22616  this.popupElement = null;
22617 },
22618 getPopupAbsolutePos: function() {
22619  if(this.isWindowAlign()) {
22620   var showAtPos = this.startPos != ASPx.InvalidPosition && !this.popupElement;
22621   if(showAtPos)
22622    this.align = PositionAlignConsts.NOT_SET;
22623   else
22624    return this.getWindowAlignPos();
22625  }
22626  if(this.popupElement)
22627   this.calculatePopupElement();
22628  else
22629   this.align = PositionAlignConsts.NOT_SET;
22630  return this.getPopupAbsolutePosCore();
22631 },
22632 initializeFunctionsTable: function() {
22633  var table = this.functionsTable;
22634  table[PositionAlignConsts.NOT_SET] = this.calculateNotSet;
22635  table[PositionAlignConsts.OUTSIDE_START] = this.calculateOutsideStart;
22636  table[PositionAlignConsts.INNER_START] = this.calculateInnerStart;
22637  table[PositionAlignConsts.CENTER] = this.calculateCenter;
22638  table[PositionAlignConsts.INNER_END] = this.calculateInnerEnd;
22639  table[PositionAlignConsts.OUTSIDE_END] = this.calculateOutsideEnd;
22640  table[PositionAlignConsts.NEAR_BOUND_START] = this.calculateNearBoundStart;
22641  table[PositionAlignConsts.NEAR_BOUND_END] = this.calculateNearBoundEnd;
22642  table[PositionAlignConsts.WINDOW_CENTER] = this.calculateWindowCenter;
22643  table[PositionAlignConsts.WINDOW_START] = this.calculateWindowStart;
22644  table[PositionAlignConsts.WINDOW_END] = this.calculateWindowEnd;
22645 },
22646 calculateParams: function() {
22647  this.size = this.getElementSize();
22648  if(this.isHorizontal) {
22649   this.bodySize = ASPx.GetDocumentClientWidth();
22650   this.elementStartPos = ASPx.GetAbsoluteX(this.popupElement);
22651   this.scrollStartPos = ASPx.GetDocumentScrollLeft();
22652  }
22653  else {
22654   this.bodySize = ASPx.GetDocumentClientHeight();
22655   this.elementStartPos = ASPx.GetAbsoluteY(this.popupElement);
22656   this.scrollStartPos = ASPx.GetDocumentScrollTop();
22657  }
22658 },
22659 isWindowAlign: function() {
22660  return this.align == PositionAlignConsts.WINDOW_CENTER || this.align == PositionAlignConsts.WINDOW_START ||
22661   this.align == PositionAlignConsts.WINDOW_END;
22662 },
22663 getWindowAlignPos: function() {
22664  this.actualBodySize = ASPx.Browser.WebKitTouchUI ? this.getWindowInnerSize() : this.bodySize;
22665  return this.getPopupAbsolutePosCore();
22666 },
22667 getPopupAbsolutePosCore: function() {
22668  var calculationFunc = this.functionsTable[this.align];
22669  calculationFunc.call(this);
22670  return new ASPx.PopupPosition(this.startPos, this.isInverted);
22671 },
22672 calculateWindowCenter: function() {
22673  this.startPos = Math.max(Math.ceil(this.actualBodySize / 2 - this.size / 2), 0) + this.scrollStartPos + this.offset;
22674 },
22675 calculateWindowStart: function() {
22676  this.startPos = this.scrollStartPos + this.offset;
22677 },
22678 calculateWindowEnd: function() {
22679  this.startPos = this.scrollStartPos + this.actualBodySize - this.size + this.offset;
22680 },
22681 calculatePopupElement: function() {
22682  this.popupElementSize = this.getPopupElementSize();
22683  this.boundStartPos = this.elementStartPos - this.size;
22684  this.boundEndPos = this.elementStartPos + this.popupElementSize;
22685  this.innerBoundStartPos = this.elementStartPos;
22686  this.innerBoundEndPos = this.elementStartPos + this.popupElementSize - this.size;
22687  var hasLeftScrollReserve = this.boundStartPos >= 0;
22688  this.isMoreFreeSpaceLeft = (this.bodySize - (this.boundEndPos + this.size) < this.boundStartPos - 2 * this.scrollStartPos) && (!this.ignoreAlignWithoutScrollReserve || hasLeftScrollReserve);
22689 },
22690 calculateOutsideStart: function() {
22691  this.isInverted = this.isPopupFullCorrectionOn && (!(this.boundStartPos - this.scrollStartPos > 0 || this.isMoreFreeSpaceLeft));
22692  if(this.isInverted)
22693   this.startPos = this.boundEndPos - this.offset;
22694  else
22695   this.startPos = this.boundStartPos + this.offset;
22696 },
22697 calculateInnerStart: function() {
22698  this.startPos = this.innerBoundStartPos + this.offset;
22699  if(this.isPopupFullCorrectionOn)
22700   this.startPos = PopupUtils.AdjustPositionToClientScreen(this.element, this.startPos, this.rtl, this.isHorizontal);
22701 },
22702 calculateCenter: function() {
22703  this.startPos = this.elementStartPos + Math.round((this.popupElementSize - this.size) / 2) + this.offset;
22704 },
22705 calculateInnerEnd: function() {
22706  this.startPos = this.innerBoundEndPos + this.offset;
22707  if(this.isPopupFullCorrectionOn)
22708   this.startPos = PopupUtils.AdjustPositionToClientScreen(this.element, this.startPos, this.rtl, this.isHorizontal);
22709 },
22710 calculateOutsideEnd: function() {
22711  this.isInverted = this.isPopupFullCorrectionOn && (!(this.boundEndPos + this.size < this.bodySize + this.scrollStartPos || !this.isMoreFreeSpaceLeft));
22712  if(this.isInverted)
22713   this.startPos = this.boundStartPos - this.offset;
22714  else
22715   this.startPos = this.boundEndPos + this.offset;
22716 },
22717 calculateNotSet: function() {
22718  if(this.rtl)
22719   this.calculateNotSetRightToLeft();
22720  else
22721   this.calculateNotSetLeftToRight();
22722 },
22723 calculateNotSetLeftToRight: function() {
22724  if(!ASPx.IsValidPosition(this.startPos)) {
22725   if(this.popupElement)
22726    this.startPos = this.elementStartPos;
22727   else if(this.offset)
22728    this.startPos = 0;
22729   else
22730    this.startPos = this.startPosInit;
22731  }
22732  this.isInverted = this.isPopupFullCorrectionOn && (this.startPos - this.scrollStartPos + this.size > this.bodySize && this.startPos - this.scrollStartPos > this.bodySize / 2);
22733  if(this.isInverted)
22734   this.startPos = this.startPos - this.size - this.offset;
22735  else
22736   this.startPos = this.startPos + this.offset;
22737 },
22738 calculateNotSetRightToLeft: function() {
22739  if(!ASPx.IsValidPosition(this.startPos)) {
22740   if(this.popupElement)
22741    this.startPos = this.innerBoundEndPos;
22742   else if(this.offset)
22743    this.startPos = 0;
22744   else
22745    this.startPos = this.startPosInit;
22746  }
22747  else
22748   this.startPos -= this.size;
22749  this.isInverted = this.isPopupFullCorrectionOn && (this.startPos < this.scrollStartPos && this.startPos - this.scrollStartPos < this.bodySize / 2);
22750  if(this.isInverted)
22751   this.startPos = this.startPos + this.size + this.offset;
22752  else
22753   this.startPos = this.startPos - this.offset;
22754 },
22755 calculateNearBoundStart: function() {
22756  this.startPos = this.boundStartPos + this.offset + this.size * this.nearBoundOverlapRate;
22757  if(this.isPopupFullCorrectionOn)
22758   this.startPos = PopupUtils.AdjustPositionToClientScreen(this.element, this.startPos, this.rtl, this.isHorizontal);
22759 },
22760 calculateNearBoundEnd: function() {
22761  this.startPos = this.boundEndPos + this.offset - this.size * this.nearBoundOverlapRate;
22762  if(this.isPopupFullCorrectionOn)
22763   this.startPos = PopupUtils.AdjustPositionToClientScreen(this.element, this.startPos, this.rtl, this.isHorizontal);
22764 },
22765 getAlignValueFromIndicator: function(alignIndicator) {
22766  var alignValue = AlignIndicatorTable[alignIndicator];
22767  if(alignValue === undefined)
22768   throw "Incorrect align indicator.";
22769  return alignValue;
22770 },
22771 getElementSize: function() {
22772  return this.getCustomElementSize(this.element);
22773 },
22774 getPopupElementSize: function() {
22775  return this.getCustomElementSize(this.popupElement);
22776 },
22777 getCustomElementSize: function(customElement) {
22778  return this.isHorizontal ? customElement.offsetWidth : customElement.offsetHeight;
22779 },
22780 getWindowInnerSize: function() {
22781  return this.isHorizontal ? window.innerWidth : window.innerHeight;
22782 }
22783});
22784var positionCalculator = null;
22785function getPositionCalculator() {
22786 if(positionCalculator == null)
22787  positionCalculator = new PositionCalculator();
22788 return positionCalculator;
22789}
22790function initializeAlignIndicatorTable() {
22791 AlignIndicatorTable[PopupUtils.NotSetAlignIndicator] = PositionAlignConsts.NOT_SET;
22792 AlignIndicatorTable[PopupUtils.OutsideLeftAlignIndicator] = PositionAlignConsts.OUT
22792SIDE_START;
22793 AlignIndicatorTable[PopupUtils.AboveAlignIndicator] = PositionAlignConsts.OUTSIDE_START;
22794 AlignIndicatorTable[PopupUtils.LeftAlignIndicator] = PositionAlignConsts.NEAR_BOUND_START;
22795 AlignIndicatorTable[PopupUtils.TopAlignIndicator] = PositionAlignConsts.NEAR_BOUND_START;
22796 AlignIndicatorTable[PopupUtils.LeftSidesAlignIndicator] = PositionAlignConsts.INNER_START;
22797 AlignIndicatorTable[PopupUtils.TopSidesAlignIndicator] = PositionAlignConsts.INNER_START;
22798 AlignIndicatorTable[PopupUtils.CenterAlignIndicator] = PositionAlignConsts.CENTER;
22799 AlignIndicatorTable[PopupUtils.MiddleAlignIndicator] = PositionAlignConsts.CENTER;
22800 AlignIndicatorTable[PopupUtils.RightSidesAlignIndicator] = PositionAlignConsts.INNER_END;
22801 AlignIndicatorTable[PopupUtils.BottomSidesAlignIndicator] = PositionAlignConsts.INNER_END;
22802 AlignIndicatorTable[PopupUtils.RightAlignIndicator] = PositionAlignConsts.NEAR_BOUND_END;
22803 AlignIndicatorTable[PopupUtils.BottomAlignIndicator] = PositionAlignConsts.NEAR_BOUND_END;
22804 AlignIndicatorTable[PopupUtils.OutsideRightAlignIndicator] = PositionAlignConsts.OUTSIDE_END;
22805 AlignIndicatorTable[PopupUtils.BelowAlignIndicator] = PositionAlignConsts.OUTSIDE_END;
22806 AlignIndicatorTable[PopupUtils.WindowCenterAlignIndicator] = PositionAlignConsts.WINDOW_CENTER;
22807 AlignIndicatorTable[PopupUtils.WindowLeftAlignIndicator] = PositionAlignConsts.WINDOW_START;
22808 AlignIndicatorTable[PopupUtils.WindowTopAlignIndicator] = PositionAlignConsts.WINDOW_START;
22809 AlignIndicatorTable[PopupUtils.WindowRightAlignIndicator] = PositionAlignConsts.WINDOW_END;
22810 AlignIndicatorTable[PopupUtils.WindowBottomAlignIndicator] = PositionAlignConsts.WINDOW_END;
22811}
22812initializeAlignIndicatorTable();
22813ASPx.PopupPosition = function(position, isInverted) {
22814 this.position = position;
22815 this.isInverted = isInverted;
22816};
22817ASPx.PopupSize = function(width, height) {
22818 this.width = width;
22819 this.height = height;
22820};
22821ASPx.PopupUtils = PopupUtils;
22822})();
22823(function() {
22824ASPx.PCWIdSuffix = "_PW";
22825var popupControlZIndex = 11998;
22826var defaultZIndexFromServer = "10000";
22827var ModalAlign = {
22828 WindowLeft: "WindowLeft",
22829 WindowCenter: "WindowCenter",
22830 WindowRight: "WindowRight",
22831 WindowTop: "WindowTop",
22832 WindowBottom: "WindowBottom"
22833};
22834function PCResizeCursorInfo(horizontalDirection, verticalDirection, horizontalOffset, verticalOffset) {
22835 this.horizontalDirection = horizontalDirection;
22836 this.verticalDirection = verticalDirection;
22837 this.horizontalOffset = horizontalOffset;
22838 this.verticalOffset = verticalOffset;
22839 this.course = verticalDirection + horizontalDirection;
22840}
22841var PopupControlCssClasses = {};
22842PopupControlCssClasses.Prefix = "dxpc-";
22843PopupControlCssClasses.SizeGripLiteCssClassName = PopupControlCssClasses.Prefix + "sizeGrip";
22844PopupControlCssClasses.LinkCssClassName = PopupControlCssClasses.Prefix + "link";
22845PopupControlCssClasses.ShadowLiteCssClassName = PopupControlCssClasses.Prefix + "shadow";
22846PopupControlCssClasses.MainDivLiteCssClass = PopupControlCssClasses.Prefix + "mainDiv";
22847PopupControlCssClasses.ContentWrapperCssClassName = PopupControlCssClasses.Prefix + "contentWrapper";
22848PopupControlCssClasses.ContentCssClassName = PopupControlCssClasses.Prefix + "content";
22849PopupControlCssClasses.HeaderContentCssClassName = PopupControlCssClasses.Prefix + "headerContent";
22850PopupControlCssClasses.WindowWrapperCssClassName = PopupControlCssClasses.Prefix + "win-wrapper";
22851PopupControlCssClasses.WindowWrapperScrollCssClassName = PopupControlCssClasses.WindowWrapperCssClassName + "-scroll";
22852PopupControlCssClasses.HeaderCssClassName = "dxpc-header";
22853var LoadContentViaCallback = {
22854 Default: "Default",
22855 OnFirstShow: "OnFirstShow",
22856 OnPageLoad: "OnPageLoad"
22857};
22858var constants = {
22859 DEFAULT_WINDOW_WIDTH: 200,
22860 DEFAULT_WINDOW_HEIGHT: 0
22861};
22862var ASPxClientPopupControlBase = ASPx.CreateClass(ASPxClientControl, {
22863 constructor: function(name) {
22864  this.constructor.prototype.constructor.call(this, name);
22865  this.leadingAfterInitCall = ASPxClientControl.LeadingAfterInitCallConsts.Direct; 
22866  this.adjustInnerControlsSizeOnShow = true;
22867  this.shadowVisible = true;
22868  this.cookieName = "";
22869  this.popupAnimationType = "none";
22870  this.closeAnimationType = "none";
22871  this.closeAction = "OuterMouseClick";
22872  this.isPopupFullCorrectionOn = true;
22873  this.forceAdjustPositionToClientScreen = false;
22874  this.usedInDropDown = false; 
22875  this.popupHorizontalOffset = 0;
22876  this.popupVerticalOffset = 0;
22877  this.popupHorizontalAlign = ASPx.PopupUtils.NotSetAlignIndicator;
22878  this.popupVerticalAlign = ASPx.PopupUtils.NotSetAlignIndicator;
22879  this.contentLoadingMode = LoadContentViaCallback.Default;
22880  this.slideAnimationDuration = 80;
22881  this.fadeAnimationDuration = 400;
22882  this.enableAnimation = true;
22883  this.showOnPageLoad = false;
22884  this.isDragged = false;
22885  this.closeOnEscape = false;
22886  this.savedCallbackWindowIndex = null;
22887  this.animationLockCount = 0;
22888  this.windowRequestCount = [];
22889  this.lpTimers = [];
22890  this.callbackAnimationProcessings = [];
22891  this.isCallbackFinishedStates = [];
22892  this.savedCallbackResults = [];
22893  this.loadingPanels = [];
22894  this.loadingDivs = [];
22895  this.left = 0;
22896  this.top = 0;
22897  this.height = constants.DEFAULT_WINDOW_HEIGHT;
22898  this.width = constants.DEFAULT_WINDOW_WIDTH;
22899  this.minHeight = null;
22900  this.minWidth = null;
22901  this.maxHeight = null;
22902  this.maxWidth = null;
22903  this.isResized = false;
22904  this.cachedSize = null;
22905  this.enableContentScrolling = false;
22906  this.contentOverflowX = "None";
22907  this.contentOverflowY = "None";
22908  this.contentUrl = "";
22909  this.contentUrlIFrameTitle = "";
22910  this.iframeLoading = false;
22911  this.iframeAdjustingPostponed = false;
22912  this.isPopupPositionCorrectionOn = true;
22913  this.resizeSessionCache = {};
22914  this.ResizeBorderSize = ASPx.Browser.TouchUI ? 10 : 6;
22915  this.ResizeCornerBorderSize = 20;
22916  this.isLiveResizingMode = true;
22917  this.allowResize = false;
22918  this.allowDragging = false;
22919  this.allowDraggingInAdaptiveMode = false;
22920  this.isWindowDragging = false;
22921  this.prohibitClearSelectionOnMouseDown = false;
22922  this.windowElements = {};
22923  this.windowContentElements = {};
22924  this.zIndex = -1;
22925  this.appearAfter = 300;
22926  this.disappearAfter = 500;
22927  this.popupAction = "LeftMouseClick";
22928  this.autoUpdatePosition = false;
22929  this.defaultIsPopuped = false;
22930  this.defaultLastUsedPopupElementInfo = {};
22931  this.defaultWindowPopupElementList = [];
22932  this.defaultWindowPopupElementIDList = [];
22933  this.firstFocusableElement = null;
22934  this.lastFocusableElement = null;
22935  this.focusLastElementHandler = function(e) { this.loopFocusHandler(e, false); }.aspxBind(this);
22936  this.focusFirstElementHandler = function(e) { this.loopFocusHandler(e, true); }.aspxBind(this);
22937  this.setFocusOnCallback = true;
22938  this.accessibleFocusElement = null;
22939  this.CloseButtonClick = new ASPxClientEvent();
22940  this.CloseUp = new ASPxClientEvent();
22941  this.Closing = new ASPxClientEvent();
22942  this.PopUp = new ASPxClientEvent();
22943  this.Shown = new ASPxClientEvent();
22944  this.Resize = new ASPxClientEvent();
22945  this.BeforeResizing = new ASPxClientEvent();
22946  this.AfterResizing = new ASPxClientEvent();
22947  aspxGetPopupControlCollection().Add(this);
22948 },
22949 WindowElementIDAssignmentMap: [
22950  { cssClass: PopupControlCssClasses.HeaderCssClassName, prefix: "_PWH" },
22951  { cssClass: "dxpc-headerText", prefix: "_PWH", postfix: "T" },
22952  { cssClass: "dxpc-headerImg", prefix: "_PWH", postfix: "I" },
22953  { cssClass: "dxpc-closeBtn", prefix: "_HCB" },
22954  { cssClass: "dxpc-pinBtn", prefix: "_HPB" },
22955  { cssClass: "dxpc-refreshBtn", prefix: "_HRB" },
22956  { cssClass: "dxpc-collapseBtn", prefix: "_HMNB" },
22957  { cssClass: "dxpc-maximizeBtn", prefix: "_HMXB" },
22958  { cssClass: "dxpc-content", prefix: "_PWC" },
22959  { cssClass: "dxpc-iFrame", prefix: "_CIF" },
22960  { cssClass: "dxpc-footer", prefix: "_PWF" },
22961  { cssClass: "dxpc-footerText", prefix: "_PWF", postfix: "T" },
22962  { cssClass: "dxpc-footerImg", prefix: "_PWF", postfix: "I" }
22963 ],
22964 Initialize: function() {
22965  this.InitializeBeforeAnyShow();
22966  ASPxClientControl.prototype.Initialize.call(this);
22967  if(this.accessibilityCompliant)
22968   this.InitializeAccessibleNavigation();
22969 },
22970 InitializeWindow: function(index) {
22971  ASPx.PopupUtils.BodyScrollHelper.RestoreIfLocked(this.GetWindowElementId(index));
22972  this.RemoveWindowAllPopupElements(index);
22973  this.PopulatePopupElements(index);
22974  var element = this.GetWindowElement(index);
22975  if(element != null) {
22976   this.AssignWindowElementsID(index, element);
22977   this.AssignWindowElementsEvents(index, element);
22978   element.DXPopupWindowElement = true;
22979   if(ASPx.Browser.IE)
22980    this.AttachOnDragStartEventToWindowImages(index);
22981   this.EnsureWindowContentUrl(index);
22982   element.isHiding = false;
22983   element.isPopupPositionCorrectionOn = this.isPopupPositionCorrectionOn || !this.GetShowOnPageLoad(index);
22984   if(this.GetShowOnPageLoad(index) && this.GetZIndex(index) > 0) {
22985    this.FirstShowWindow(index, false);
22986    this.SetWindowElementZIndex(element, this.GetZIndex(index));
22987    element.isPopupPositionCorrectionOn = true;
22988   }
22989   this.InitializeWindowEscKeyHandler(element, index);
22990   if(this.GetCanScrollViewPort(index))
22991    ensureViewPortSizeInterval();
22992  }
22993 },
22994 InitializeBeforeAnyShow: function() {
22995  this.InitializeEnableContentScrolling();
22996 },
22997 InitializeEnableContentScrolling: function() {
22998  this.enableContentScrolling = this.contentOverflowX != "None" || this.contentOverflowY != "None";
22999 },
23000 InitializeWindowEscKeyHandler: function(element, index) {
23001  if(!this.GetEnableCloseByEsc(index)) return;
23002  this.AddKeyDownHandler("ESC", this.OnEscKeyDown.aspxBind(this));
23003 },
23004 AfterInitialize: function() {
23005  if(this.HasDefaultWindow())
23006   this.AfterInitializeWindow(-1);
23007  for(var i = 0; i < this.GetWindowCount(); i++)
23008   this.AfterInitializeWindow(i);
23009  ASPxClientControl.prototype.AfterInitialize.call(this);
23010 },
23011 AfterInitializeWindow: function(index) {
23012  if(this.GetShowOnPageLoad(index) && this.GetZIndex(index) < 0) {
23013   this.FirstShowWindow(index, true);
23014   var element = this.GetWindowElement(index);
23015   if(element != null)
23016    element.isPopupPositionCorrectionOn = true;
23017  }
23018  this.EnsureContent(index, true);
23019 },
23020 AssignWindowElementsID: function(index, windowElement) {
23021  for(var i = 0; i < this.WindowElementIDAssignmentMap.length; i++) {
23022   var elementClass = this.WindowElementIDAssignmentMap[i].cssClass;
23023   var elements = ASPx.GetNodesByClassName(windowElement, elementClass);
23024   for(var j = 0; j < elements.length; j++) {
23025    var element = elements[j];
23026    if(this.GetFirstParentWindow(element) === windowElement)
23027     this.AssignElementID(element, index, this.WindowElementIDAssignmentMap[i].prefix, this.WindowElementIDAssignmentMap[i].postfix);
23028   }
23029  }
23030 },
23031 AssignElementID: function(element, index, prefix, postfix) {
23032  element.id = this.name + prefix + index + (postfix ? postfix : "");
23033 },
23034 AssignWindowElementsEvents: function(index, element) {
23035  var header = this.GetWindowHeaderElement(index);
23036  if(header && this.allowDragging && !this.isWindowDragging)
23037   ASPx.Evt.AttachEventToElement(header, ASPx.TouchUIHelper.touchMouseDownEventName, this.GetWindowHeaderElementMouseDownEventHandler(index), true);
23038  this.AssignHeaderButtonsEvents(index);
23039  var mdEventName = ASPx.TouchUIHelper.touchMouseDownEventName;
23040  ASPx.Evt.AttachEventToElement(element, mdEventName, this.GetWindowElementMouseDownEventHandler(index));
23041  if(this.IsResizeAllowed(index)) {
23042   var mmEventName = ASPx.TouchUIHelper.touchMouseMoveEventName;
23043   ASPx.Evt.AttachEventToElement(element, mmEventName, this.GetWindowElementMouseMoveEventHandler(index));
23044  }
23045  var sizeGrip = this.GetWindowSizeGripElement(index);
23046  if(sizeGrip) {
23047   var instance = this;
23048   ASPx.Evt.AttachEventToElement(sizeGrip, mdEventName, function(evt) {
23049    ASPx.PWGripMDown(evt, instance.name, index);
23050    ASPx.Evt.PreventEvent(evt);
23051   });
23052  }
23053 },
23054 AssignHeaderButtonsEvents: function(index) {
23055  this.AttachClickToHeaderButton(index, this.GetWindowCloseButton(index), "ASPx.PWCBClick");
23056  this.AttachClickToHeaderButton(index, this.GetWindowRefreshButton(index), "ASPx.PWRBClick");
23057 },
23058 AttachClickToHeaderButton: function(index, headerButton, eventFuncName) {
23059  var instance = this;
23060  if(headerButton) {
23061   ASPx.Evt.AttachEventToElement(headerButton, "click", function(evt) {
23062    eval(eventFuncName)(evt, instance.name, index);
23063   });
23064  }
23065 },
23066 AttachOnDragStartEventToWindowImages: function(index) {
23067  this.AttachChildImagesPreventDragStartEvent(this.GetWindowHeaderElement(index));
23068  this.AttachChildImagesPreventDragStartEvent(this.GetWindowFooterElement(index));
23069 },
23070 AttachChildImagesPreventDragStartEvent: function(parentElem) {
23071  var images = parentElem == null ? null : ASPx.GetNodesByTagName(parentElem, "img");
23072  if(images != null) {
23073   for(var i = 0; i < images.length; i++)
23074    ASPx.Evt.AttachEventToElement(images[i], "dragstart", ASPx.Evt.PreventDragStart);
23075  }
23076 },
23077 GetPropertyValue: function(index, propName) {
23078  return this[propName];
23079 },
23080 SetPropertyValue: function(index, propName, value) {
23081  this[propName] = value;
23082 },
23083 GetStretchVerticallyByIndex: function(index) {
23084  return this.GetPropertyValue(index, "stretchVertically");
23085 },
23086 GetModalMaxWidth: function(index) {
23087  return this.GetPropertyValue(index, "modalMaxWidth");
23088 },
23089 SetAdaptiveMaxWidthByIndex: function(index, value) {
23090  value = this.ConvertDimensionValueToString(value);
23091  this.SetPropertyValue(index, "modalMaxWidth", value);
23092  this.GetWindowElement(index).style["maxWidth"] = value;
23093 },
23094 GetModalMinWidth: function(index) {
23095  return this.GetPropertyValue(index, "modalMinWidth");
23096 },
23097 SetAdaptiveMinWidthByIndex: function(index, value) {
23098  value = this.ConvertDimensionValueToString(value);
23099  this.SetPropertyValue(index, "modalMinWidth", value);
23100  this.GetWindowElement(index).style["minWidth"] = value;
23101 },
23102 GetModalMinHeight: function(index) {
23103  return this.GetPropertyValue(index, "modalMinHeight");
23104 },
23105 SetAdaptiveMinHeightByIndex: function(index, value) {
23106  this.StretchVerticallyByIndex(index, false);
23107  this.SetPropertyValue(index, "modalMinHeight", value);
23108  this.SetAdaptiveHeightDimension(index, "minHeight", value);
23109 },
23110 GetModalMaxHeight: function(index) {
23111  return this.GetPropertyValue(index, "modalMaxHeight");
23112 },
23113 SetAdaptiveMaxHeightByIndex: function(index, value) {
23114  this.SetPropertyValue(index, "modalMaxHeight", value);
23115  this.SetAdaptiveHeightDimension(index, "maxHeight", value);
23116 },
23117 GetFixedHeader: function(index) {
23118  return this.GetPropertyValue(index, "fixedHeader");
23119 },
23120 GetFixedFooter: function(index) {
23121  return this.GetPropertyValue(index, "fixedFooter");
23122 },
23123 GetWindowWidthInternal: function(index) {
23124  return this.GetPropertyValue(index, "width");
23125 },
23126 GetWindowHeightInternal: function(index) {
23127  return this.GetPropertyValue(index, "height");
23128 },
23129 SetWindowHeight: function(index, height) {
23130  this.SetPropertyValue(index, "height", height);
23131 },
23132 SetWindowWidth: function(index, width) {
23133  this.SetPropertyValue(index, "width", width);
23134 },
23135 GetWindowMinWidth: function(index) {
23136  return this.GetPropertyValue(index, "minWidth");
23137 },
23138 GetWindowMaxWidth: function(index) {
23139  return this.GetPropertyValue(index, "maxWidth");
23140 },
23141 GetWindowMinHeight: function(index) {
23142  return this.GetPropertyValue(index, "minHeight");
23143 },
23144 GetWindowMaxHeight: function(index) {
23145  return this.GetPropertyValue(index, "maxHeight");
23146 },
23147 SetWindowCachedSize: function(index, width, height) {
23148  this.SetPropertyValue(index, "cachedSize", new ASPx.PopupSize(width, height));
23149 },
23150 GetWindowCachedSize: function(index) {
23151  return this.GetPropertyValue(index, "cachedSize");
23152 },
23153 ResetWindowCachedSize: function(index) {
23154  this.SetPropertyValue(index, "cachedSize", null);
23155 },
23156 GetPosition: function(index, isLeft) {
23157  return this.GetPropertyValue(index, isLeft ? "left" : "top");
23158 },
23159 GetWindowTop: function(index) {
23160  return this.GetPropertyValue(index, "top");
23161 },
23162 SetWindowTop: function(index, top) {
23163  this.SetPropertyValue(index, "top", top);
23164 },
23165 GetWindowLeft: function(index) {
23166  return this.GetPropertyValue(index, "left");
23167 },
23168 SetWindowLeft: function(index, left) {
23169  this.SetPropertyValue(index, "left", left);
23170 },
23171 GetEnableCloseByEsc: function(index) {
23172  return this.GetPropertyValue(index, "closeOnEscape");
23173 },
23174 GetIsDragged: function(index) {
23175  return this.GetPropertyValue(index, "isDragged");
23176 },
23177 GetWindowContentIFrameUrl: function(index) {
23178  return this.GetPropertyValue(index, "contentUrl");
23179 },
23180 GetWindowContentIFrameTitle: function(index) {
23181  return this.GetPropertyValue(index, "contentUrlIFrameTitle");
23182 },
23183 GetWindowCloseAction: function(index) {
23184  return this.GetPropertyValue(index, "closeAction");
23185 },
23186 GetShowOnPageLoad: function(index) {
23187  return this.GetPropertyValue(index, "showOnPageLoad");
23188 },
23189 GetZIndex: function(index) {
23190  return this.GetPropertyValue(index, "zIndex");
23191 },
23192 GetIframeLoading: function(index) {
23193  return this.GetPropertyValue(index, "iframeLoading");
23194 },
23195 SetIframeLoading: function(index, value) {
23196  this.SetPropertyValue(index, "iframeLoading", value);
23197 },
23198 SetIsDragged: function(index, value) {
23199  this.SetPropertyValue(index, "isDragged", value);
23200 },
23201 GetIsResized: function(index) {
23202  return this.GetPropertyValue(index, "isResized");
23203 },
23204 SetIsResized: function(index, value) {
23205  this.SetPropertyValue(index, "isResized", value);
23206 },
23207 SetIframeAdjustingPostponed: function(index, value) {
23208  this.SetPropertyValue(index, "iframeAdjustingPostponed", value);
23209 },
23210 GetIframeAdjustingPostponed: function(index) {
23211  return this.GetPropertyValue(index, "iframeAdjustingPostponed");
23212 },
23213 GetWindowPopupAction: function(index) {
23214  return this.GetPropertyValue(index, "popupAction");
23215 },
23216 GetWindowElementMouseMoveEventHandler: function(index) {
23217  var instance = this;
23218  return function(evt) { ASPx.PWMMove(evt, instance.name, index); };
23219 },
23220 GetWindowElementMouseDownEventHandler: function(index) {
23221  var instance = this;
23222  return function(evt) {
23223   if(instance.AllowMouseDown(evt, index))
23224    ASPx.PWMDown(evt, instance.name, index, instance.isWindowDragging);
23225  };
23226 },
23227 GetWindowHeaderElementMouseDownEventHandler: function(index) {
23228  var instance = this;
23229  return function(evt) {
23230   if(instance.AllowMouseDown(evt, index))
23231    ASPx.PWDGMDown(evt, instance.name, index);
23232  };
23233 },
23234 AllowMouseDown: function(evt, index) {
23235  return !this.PreventHeaderButtonMouseDownBubbling(evt, this.GetWindowCloseButton(index)) &&
23236   !this.PreventHeaderButtonMouseDownBubbling(evt, this.GetWindowRefreshButton(index));
23237 },
23238 PreventHeaderButtonMouseDownBubbling: function(evt, hdrButton) {
23239  if(hdrButton) {
23240   var source = ASPx.Evt.GetEventSource(evt);
23241   if(ASPx.GetIsParent(hdrButton, source)) {
23242    ASPx.PWHMDown(evt);
23243    return true;
23244   }
23245  }
23246  return false;
23247 },
23248 PrepareToAdjustContentOnShow: function(index) {
23249  if(this.adjustInnerControlsSizeOnShow) {
23250   var windowContent = this.GetContentContainer(index),
23251    collection = ASPx.GetControlCollection();
23252   collection.CollapseControls(windowContent);
23253  }
23254 },
23255 AdjustContentOnShow: function(index) {
23256  if(this.adjustInnerControlsSizeOnShow) {
23257   var windowElement = this.GetWindowElement(index);
23258   ASPx.GetControlCollection().AdjustControls(windowElement);
23259  }
23260 },
23261 AdjustSize: function() {
23262  if(this.enableContentScrolling)
23263   return;
23264  this.SetSize(0, 0);
23265 },
23266 GetFirstParentWindow: function(el) {
23267  while(el && el.tagName != "BODY") {
23268   if(el.nodeType == 1 && el.className.indexOf("dxpclW") > -1 && !isNaN(this.GetWindowIndex(el)))
23269    return el;
23270   el = el.parentNode;
23271  }
23272 },
23273 getParentPopupControl: function(index) {
23274  var parentPopupWindowElement = this.GetFirstParentWindow(this.GetWindowElement(index).parentNode);
23275  if(parentPopupWindowElement)
23276   return aspxGetPopupControlCollection().GetPopupWindowFromID(parentPopupWindowElement.id);
23277 },
23278 registerAndActivateWindow: function(windowElement, index, allowChangeZIndex) {
23279  aspxGetPopupControlCollection().RegisterVisibleWindow(windowElement, this, index);
23280  if(allowChangeZIndex)
23281   aspxGetPopupControlCollection().ActivateWindowElement(windowElement, undefined, this.GetPopupType(), this.GetDefaultZIndexFromServer(), this.GetPopupControlZIndex());
23282 },
23283 HasCloseAnimation: function() {
23284  return this.closeAnimationType != ASPxClientPopupControlBase.AnimationType.None;
23285 },
23286 AddKeyDownHandler: function(shortcutString, handler) {
23287  if(typeof(this.keyDownHandlers) === "undefined")
23288   this.keyDownHandlers = [];
23289  this.keyDownHandlers[ASPx.ParseShortcutString(shortcutString)] = handler;
23290 },
23291 InternalIsWindowDisplayed: function(index) {
23292  var element = this.GetWindowElement(index);
23293  return (element != null) ? ASPx.GetElementDisplay(element) : false;
23294 },
23295 InternalIsWindowVisible: function(index) {
23296  var element = this.GetWindowElement(index);
23297  if(!element)
23298   return false;
23299  if(this.HasCloseAnimation() && !element.closeAnimationCompleted)
23300   return false;
23301  var currentStyle = ASPx.GetCurrentStyle(element);
23302  return ((currentStyle && currentStyle.visibility != "hidden") && ASPx.GetElementDisplay(element, true) ? true : false);
23303 },
23304 IsWindowVisible: function(window) {
23305  var index = (window != null) ? window.index : -1;
23306  return this.InternalIsWindowVisible(index);
23307 },
23308 IsVisible: function() {
23309  return this.InternalIsWindowVisible(-1);
23310 },
23311 UpdateWindowsStateCookie: function() {
23312  if(this.cookieName == "") return;
23313  ASPx.Cookie.DelCookie(this.cookieName);
23314  ASPx.Cookie.SetCookie(this.cookieName, this.GetWindowsState());
23315 },
23316 SetWindowElementZIndex: function(element, zIndex) {
23317  element.style.zIndex = zIndex;
23318  var iFrame = element.overflowElement;
23319  if(iFrame)
23320   iFrame.style.zIndex = zIndex - 1;
23321  var modalElement = element.modalElement;
23322  if(modalElement)
23323   modalElement.style.zIndex = zIndex - 1;
23324  this.UpdateWindowsStateCookie();
23325 },
23326 SetWindowContentHtmlCore: function(index, html, useAnimation) {
23327  var element = this.GetContentContainer(index);
23328  if(element != null) {
23329   ASPx.SetInnerHtml(element, html);
23330   this.AfterSetWindowContentHtml(index, element, useAnimation);
23331  }
23332 },
23333 SetContentHtml: function(html, useAnimation) {
23334  this.SetWindowContentHtml(null, html, useAnimation);
23335  if(html && this.accessibilityCompliant)
23336   ASPx.GetControlCollection().ControlsInitialized.AddHandler(this.OnControlsInitialized, this);
23337 },
23338 SetWindowContentHtml: function(window, html, useAnimation) {
23339  var index = (window != null) ? window.index : -1;
23340  this.SetWindowContentHtmlCore(index, html, useAnimation);
23341 },
23342 GetContentHtml: function() {
23343  return this.GetWindowContentHtml(null);
23344 },
23345 AfterSetWindowContentHtml: function(index, contentContainer, useAnimation) {
23346  if(useAnimation && typeof (ASPx.AnimationHelper) != "undefined")
23347   ASPx.AnimationHelper.fadeIn(contentContainer, function() { this.ResizeWindowIFrame(index); }.aspxBind(this));
23348  else
23349   this.ResizeWindowIFrame(index);
23350 },
23351 ResizeWindowIFrame: function(index) {
23352  if(!this.renderIFrameForPopupElements) return;
23353  if(!this.InternalIsWindowVisible(index)) return;
23354  var iFrame = this.GetWindowIFrame(index);
23355  if(iFrame) {
23356   var cell = this.GetWindowMainCell(this.GetWindowElement(index));
23357   ASPx.SetStyles(iFrame, { width: cell.offsetWidth, height: cell.offsetHeight });
23358  }
23359 },
23360 DoHideWindow: function(index, dontRaiseClosing, closeReason) {
23361  if(!this.InternalIsWindowVisible(index)) return;
23362  var cancel = !dontRaiseClosing && this.RaiseClosing(index, closeReason);
23363  if(!cancel) {
23364   if(this.HasCloseAnimation())
23365    this.DoHideWindowCoreWithAnimation(index, closeReason);
23366   else {
23367    this.DoHideWindowCore(index, closeReason);
23368    this.RaiseCloseUp(index, closeReason);
23369   }
23370  }
23371  return cancel;
23372 },
23373 HasAnyScrollBars: function(index) {
23374  var contentElement = this.GetWindowContentElement(index);
23375  var hasBothScrollBars = contentElement.style.overflow == "scroll" || contentElement.style.overflow == "auto";
23376  return hasBothScrollBars || contentElement.style.overflowX == "scroll" ||
23377   contentElement.style.overflowY == "scroll" || contentElement.style.overflowX == "auto" ||
23378   contentElement.style.overflowY == "auto";
23379 },
23380 DoHideWindowModalElement: function(element, closeReason) {
23381  var modalElement = element.modalElement;
23382  if(modalElement && ASPx.GetElementVisibility(modalElement, true)) {
23383   var closeModalElement = function () {
23384    ASPx.SetStyles(modalElement, { width: 1, height: 1, zIndex: defaultZIndexFromServer - 1 });
23385    ASPx.SetElementVisibility(modalElement, false);
23386    ASPx.SetElementDisplay(modalElement, false);
23387   };
23388   aspxGetPopupControlCollection().UnregisterVisibleModalElement(modalElement);
23389   if(this.GetHideBodyScrollWhenModal(this.GetWindowIndex(element))) {
23390    if(ASPx.Browser.WebKitFamily)
23391     aspxGetPopupControlCollection().LockScrollEvent();
23392    if(!ASPx.Browser.WebKitTouchUI)
23393     ASPx.PopupUtils.BodyScrollHelper.RestoreBodyScroll(element.id);
23394    if(ASPx.Browser.WebKitFamily)
23395     aspxGetPopupControlCollection().UnlockScrollEvent();
23396   }
23397   if(closeReason == ASPxClientPopupControlCloseReason.OuterMouseClick) {     
23398    ASPx.SetStyles(modalElement, { opacity: 0 });
23399    if(!modalElement.mouseHandler) {
23400     modalElement.mouseHandler = function() {
23401      ASPx.SetStyles(modalElement, { opacity: "" });
23402      closeModalElement();
23403      ASPx.Evt.DetachEventFromElement(modalElement, "mouseup", modalElement.mouseHandler);
23404      ASPx.Evt.DetachEventFromElement(modalElement, "mouseout", modalElement.mouseHandler);
23405     };
23406    }
23407    ASPx.Evt.AttachEventToElement(modalElement, "mouseup", modalElement.mouseHandler);
23408    ASPx.Evt.AttachEventToElement(modalElement, "mouseout", modalElement.mouseHandler);
23409   } else
23410    closeModalElement();
23411  }
23412 },
23413 IncreaseWindowRequestCount: function (index) {
23414  if(!this.windowRequestCount[index])
23415   this.windowRequestCount[index] = 1;
23416  else
23417   this.windowRequestCount[index]++;
23418 },
23419 DecreaseWindowRequestCount: function(index) {
23420  this.windowRequestCount[index]--;
23421 },
23422 IsLoadingContainerVisible: function() {
23423  return true;
23424 },
23425 ShouldHideExistingLoadingElements: function() {
23426  return false;
23427 },
23428 GetModalElementEndAnimationOpacity: function(index) {
23429  if(typeof (this.modalElementOpacity) == "undefined")
23430   this.modalElementOpacity = [];
23431  if(typeof (this.modalElementOpacity[index]) == "undefined")
23432   this.modalElementOpacity[index] = ASPx.GetElementOpacity(this.GetWindowModalElement(index));
23433  return this.modalElementOpacity[index];
23434 },
23435 SetModalElementVisibilityWithAnimation: function(modalElement, index) {
23436  if(this.AllowModalElementAnimation(index)) {
23437   var endOpacity = this.GetModalElementEndAnimationOpacity(index);
23438   ASPx.AnimationHelper.setOpacity(modalElement, 0);
23439   ASPx.SetElementVisibility(modalElement, true);
23440   ASPx.AnimationHelper.fadeTo(modalElement, { to: endOpacity });
23441  } else
23442   ASPx.SetElementVisibility(modalElement, true);
23443 },
23444 AllowModalElementAnimation: function(index) {
23445  return this.popupAnimationType === ASPxClientPopupControlBase.AnimationType.Fade;
23446 },
23447 SetVisibleWithAnimation: function(element, isMoving, index, horizontalPopupPosition, verticalPopupPosition) {
23448  var isAnimationNeed = this.IsAnimationAllowed() && !isMoving;
23449  if(isAnimationNeed && this.popupAnimationType !== "none") {
23450   switch(this.popupAnimationType) {
23451    case ASPxClientPopupControlBase.AnimationType.Slide:
23452     this.StartSlideAnimation(element, index, horizontalPopupPosition, verticalPopupPosition);
23453     break;
23454    case ASPxClientPopupControlBase.AnimationType.Fade:
23455     this.StartFadeAnimation(element, index);
23456     break;
23457    case ASPxClientPopupControlBase.AnimationType.Auto:
23458     this.StartAutoAnimation(element, index, horizontalPopupPosition, verticalPopupPosition);
23459     break;
23460   }
23461  }
23462  else
23463   ASPx.SetElementVisibility(element, true);
23464 },
23465 StartAutoAnimation: function(element, index, horizontalPopupPosition, verticalPopupPosition) {
23466  ASPx.SetElementVisibility(element, true);
23467 },
23468 StartFadeAnimation: function(element, index) {
23469  ASPx.AnimationHelper.setOpacity(element, 0);
23470  ASPx.SetElementVisibility(element, true);
23471  var callback = function() {
23472   this.OnAnimationStop(index);
23473  }.aspxBind(this);
23474  ASPx.AnimationHelper.fadeIn(element, callback, this.fadeAnimationDuration);
23475 },
23476 StartSlideAnimation: function (animationDivElement, index, horizontalPopupPosition, verticalPopupPosition) {
23477  var element = this.GetWindowMainCell(animationDivElement);
23478  var clientX = horizontalPopupPosition.position;
23479  var clientY = verticalPopupPosition.position;
23480  var args = "(\"" + this.name + "\", " + index + ")";
23481  var onAnimStopCallString = "ASPx.PCAStop" + args;
23482  this.InitDivPosForShowSlideAnimation(index, animationDivElement, clientX, clientY, onAnimStopCallString);
23483  var horizontalDirection = this.GetAnimationHorizontalDirection(index, horizontalPopupPosition);
23484  var verticalDirection = this.GetAnimationVerticalDirection(index, verticalPopupPosition);
23485  var offsetCoefficient = this.GetSlideOffsetCoefficient(index);
23486  var xPos = horizontalDirection * animationDivElement.offsetWidth * offsetCoefficient;
23487  var yPos = verticalDirection * animationDivElement.offsetHeight * offsetCoefficient;
23488  neddToForceAnimation = xPos === 0 && yPos === 0;
23489  if(neddToForceAnimation) 
23490   yPos = 1;
23491  ASPx.SetStyles(element, { left: xPos, top: yPos });
23492  ASPx.SetElementVisibility(animationDivElement, true);
23493  this.DoShowWindowIFrame(index, clientX, clientY, 0, 0);
23494  ASPx.PopupUtils.StartSlideAnimation(animationDivElement, element, this.GetWindowIFrame(index), this.GetSlideAnimationDuration(index));
23495 },
23496 GetSlideAnimationDuration: function(index) {
23497  return this.slideAnimationDuration;
23498 },
23499 GetSlideOffsetCoefficient: function(index) {
23500  return 1;
23501 },
23502 InitDivPosForShowSlideAnimation: function(index, animationDivElement, clientX, clientY, onAnimStopCallString) {
23503  ASPx.PopupUtils.InitAnimationDiv(animationDivElement, clientX, clientY, onAnimStopCallString, true);
23504 },
23505 InitDivPosForHideSlideAnimation: function(animationDivElement) {
23506 },
23507 StopShowAnimation: function(index) {
23508  if(this.popupAnimationType != "none") {
23509   var windowElement = this.GetWindowElement(index);
23510   if(this.popupAnimationType === 'slide')
23511    ASPx.PopupUtils.StopAnimation(windowElement, this.GetWindowMainCell(windowElement));
23512   else
23513    ASPx.AnimationHelper.cancelAnimation(windowElement);
23514  }
23515 },
23516 StopCloseAnimation: function(index) {
23517  var element = this.GetWindowElement(index);
23518  if(this.HasCloseAnimation() && !element.closeAnimationCompleted) {
23519   ASPx.AnimationHelper.cancelAnimation(element);
23520   this.DoHideWindowCore(index);
23521  }
23522 },
23523 IsFadeCloseAnimation: function(index) {
23524  return this.closeAnimationType === ASPxClientPopupControlBase.AnimationType.Fade;
23525 },
23526 PrepareElementAfterCloseAnimation: function(index, element) {
23527  element.closeAnimationCompleted = true;
23528  if(this.IsFadeCloseAnimation(index))
23529   ASPx.SetStyles(element, { opacity: 1 });
23530  else
23531   ASPx.SetStyles(this.GetWindowMainCell(element), {
23532    left: 0,
23533    top: 0
23534   });
23535 },
23536 DoHideWindowCoreWithAnimation: function(index, closeReason) {
23537  this.StopShowAnimation(index);
23538  var element = this.GetWindowElement(index);
23539  element.closeAnimationCompleted = false;
23540  if(this.AllowModalElementAnimation(index) && this.CanManipulateWithModalElement(index))
23541   ASPx.AnimationHelper.fadeOut(element.modalElement, null, this.fadeAnimationDuration);
23542  switch(this.closeAnimationType) {
23543   case ASPxClientPopupControlBase.AnimationType.Slide:
23544    this.DoHideWindowWithSlideAnimation(index, closeReason);
23545    break;
23546   case ASPxClientPopupControlBase.AnimationType.Fade:
23547    this.DoHideWindowWithFadeAnimation(index, element, closeReason);
23548    break;
23549   case ASPxClientPopupControlBase.AnimationType.Auto:
23550    this.DoHideWindowWithAutoAnimation(index, element, closeReason);
23551    break;
23552  }
23553 },
23554 DoHideWindowWithAutoAnimation: function(index, element, closeReason) {
23555 },
23556 DoHideWindowWithFadeAnimation: function(index, element, closeReason) {
23557  ASPx.AnimationHelper.fadeOut(element, function() {
23558   this.DoHideWindowCore(index);
23559   this.RaiseCloseUp(index, closeReason);
23560  }.aspxBind(this), this.fadeAnimationDuration);
23561 },
23562 DoHideWindowWithSlideAnimation: function(index, closeReason) {
23563  var element = this.GetWindowElement(index);
23564  var horizontalPopupPosition = this.GetSlideAnimationPosition(element, true);
23565  var verticalPopupPosition = this.GetSlideAnimationPosition(element, false);
23566  var horizontalDirection = this.GetAnimationHorizontalDirection(index, horizontalPopupPosition);
23567  var verticalDirection = this.GetAnimationVerticalDirection(index, verticalPopupPosition);
23568  this.InitDivPosForHideSlideAnimation(element);
23569  var offsetCoefficient = this.GetSlideOffsetCoefficient(index);
23570  ASPx.AnimationHelper.createMultipleAnimationTransition(this.GetWindowMainCell(element), {
23571   duration: this.GetSlideAnimationDuration(index),
23572   onComplete: function(element) {
23573    this.DoHideWindowCore(index);
23574    this.RaiseCloseUp(index, closeReason);
23575   }.aspxBind(this)
23576  }).Start({
23577   left: { to: horizontalDirection * element.offsetWidth * offsetCoefficient, unit: "px" },
23578   top: { to: verticalDirection * element.offsetHeight * offsetCoefficient, unit: "px" }
23579  });
23580 },
23581 GetSlideAnimationPosition: function(element, isX) {
23582  return this.GetClientPopupPos(element, null, ASPx.InvalidPosition, isX, true);
23583 },
23584 GetAnimationHorizontalDirection: function(index, horizontalPopupPosition) {
23585  return ASPx.PopupUtils.GetAnimationHorizontalDirection(horizontalPopupPosition, this.popupHorizontalAlign, this.popupVerticalAlign, this.rtl);
23586 },
23587 GetAnimationVerticalDirection: function(index, verticalPopupPosition) {
23588  return ASPx.PopupUtils.GetAnimationVerticalDirection(verticalPopupPosition, this.popupHorizontalAlign, this.popupVerticalAlign);
23589 },
23590 OnAnimationStop: function(index) {
23591  this.OnWindowShown(index);
23592 },
23593 PerformCallback: function(parameter, onSuccess) {
23594  this.PerformWindowCallback(null, parameter, onSuccess);
23595 },
23596 PerformWindowCallback: function(window, parameter, onSuccess) {
23597  parameter = ASPx.IsExists(parameter) ? parameter.toString() : "";
23598  var index = (window != null) ? window.index : -1;
23599  if(!this.InWindowCallback(index)) {
23600   var windowCallbackArguments = index + ";" + parameter;
23601   this.CreateWindowCallback(index, windowCallbackArguments, onSuccess);
23602  }
23603 },
23604 InWindowCallback: function(windowIndex) {
23605  return this.windowRequestCount[windowIndex] > 0;
23606 },
23607 CreateWindowCallback: function(windowIndex, argument, handler) {
23608  this.IncreaseWindowRequestCount(windowIndex);
23609  var element = this.GetWindowElement(windowIndex);
23610  if(this.contentLoadingMode != LoadContentViaCallback.OnPageLoad || !element.loading || this.GetShowOnPageLoad(windowIndex))
23611   this.ShowWindowLoadingElements(windowIndex);
23612  this.CreateCallback(argument, null, handler);
23613 },
23614 OnCallback: function(result) {
23615  this.OnCallbackInternal(result.html, result.index, false);
23616 },
23617 OnCallbackError: function(result, data) {
23618  this.OnCallbackInternal(result, ASPx.IsExists(data) ? data : -1, true);
23619 },
23620 OnCallbackErrorAfterUserHandle: function(result, data) {
23621  this.DecreaseWindowRequestCount(data);
23622 },
23623 OnCallbackInternal: function(html, windowIndex, isError) {
23624  var element = this.GetWindowElement(windowIndex);
23625  element.loaded = !isError;
23626  element.loading = false;
23627  this.DecreaseWindowRequestCount(windowIndex);
23628  this.HideWindowLoadingPanel(windowIndex);
23629  this.SetWindowContentHtmlCore(windowIndex, html);
23630  this.UpdatePositionAfterCallback(windowIndex);
23631  this.savedCallbackWindowIndex = windowIndex;
23632  this.UpdateWindowsStateCookie();
23633 },
23634 RaiseCallbackError: function(message) {
23635  var result = ASPxClientControl.prototype.RaiseCallbackError.call(this, message);
23636  if(result.isHandled)
23637   this.HideAllLoadingPanels();
23638  return result;
23639 },
23640 StartWindowBeginCallbackAnimation: function(windowIndex) {
23641  this.callbackAnimationProcessings[windowIndex] = true;
23642  this.isCallbackFinishedStates[windowIndex] = false;
23643  ASPx.AnimationHelper.fadeOut(this.GetWindowContentElement(windowIndex), function() { this.FinishWindowBeginCallbackAnimation(windowIndex); }.aspxBind(this));
23644 },
23645 FinishWindowBeginCallbackAnimation: function(windowIndex) {
23646  this.callbackAnimationProcessings[windowIndex] = false;
23647  if(!this.isCallbackFinishedStates[windowIndex])
23648   this.ShowWindowLoadingElementsInternal(windowIndex);
23649  else
23650   this.DoCallback(this.savedCallbackResults[windowIndex]);
23651 },
23652 CheckBeginCallbackAnimationInProgress: function(callbackResult) {
23653  var result;
23654  try {
23655   result = this.EvalCallbackResult(callbackResult).result;
23656  } catch(e) {
23657   return false;
23658  }
23659  var windowIndex = result.index;
23660  if(this.enableCallbackAnimation && this.callbackAnimationProcessings[windowIndex]) {
23661   this.savedCallbackResults[windowIndex] = callbackResult;
23662   this.isCallbackFinishedStates[windowIndex] = true;
23663   return true;
23664  }
23665  return false;
23666 },
23667 StartWindowEndCallbackAnimation: function(windowIndex) {
23668  this.callbackAnimationProcessings[windowIndex] = true;
23669  ASPx.AnimationHelper.fadeIn(this.GetWindowContentElement(windowIndex), function() { this.FinishWindowEndCallbackAnimation(windowIndex); }.aspxBind(this));
23670 },
23671 FinishWindowEndCallbackAnimation: function(windowIndex) {
23672  this.DoEndCallback();
23673  this.callbackAnimationProcessings[windowIndex] = false;
23674 },
23675 CheckEndCallbackAnimationNeeded: function() {
23676  var windowIndex = this.savedCallbackWindowIndex;
23677  this.savedCallbackWindowIndex = null;
23678  if(windowIndex !== null && !this.callbackAnimationProcessings[windowIndex]) {
23679   this.StartWindowEndCallbackAnimation(windowIndex);
23680   return true;
23681  }
23682  return false;
23683 },
23684 EnsureContent: function(windowIndex, isInit) {
23685  var element = this.GetWindowElement(windowIndex);
23686  if(element && !element.loaded && !element.loading) {
23687   var shouldLoad = this.contentLoadingMode == LoadContentViaCallback.OnPageLoad || this.contentLoadingMode == LoadContentViaCallback.OnFirstShow && !isInit;
23688   if(shouldLoad) {
23689    element.loading = true;
23690    this.CreateWindowCallback(windowIndex, windowIndex);
23691   } else if(this.contentLoadingMode == LoadContentViaCallback.Default)
23692    element.loaded = true;
23693  }
23694 },
23695 HideAllLoadingPanels: function() {
23696  if(this.HasDefaultWindow())
23697   this.HideWindowLoadingPanel(-1);
23698  for(var i = 0; i < this.GetWindowCount() ; i++)
23699   this.HideWindowLoadingPanel(i);
23700 },
23701 HideWindowLoadingPanel: function(windowIndex) {
23702  this.ClearWindowLoadingPanelTimer(windowIndex);
23703  if(this.loadingDivs[windowIndex]) {
23704   ASPx.RemoveElement(this.loadingDivs[windowIndex]);
23705   this.loadingDivs[windowIndex] = null;
23706  }
23707  if(this.loadingPanels[windowIndex]) {
23708   ASPx.RemoveElement(this.loadingPanels[windowIndex]);
23709   this.loadingPanels[windowIndex] = null;
23710  }
23711 },
23712 ShowWindowLoadingElements: function(windowIndex) {
23713  if(this.lpTimers[windowIndex] && this.lpTimers[windowIndex] > -1) return;
23714  if(this.enableCallbackAnimation)
23715   this.StartWindowBeginCallbackAnimation(windowIndex);
23716  else
23717   this.ShowWindowLoadingElementsInternal(windowIndex);
23718 },
23719 ShowWindowLoadingPanelOnTimer: function(windowIndex) {
23720  this.ClearWindowLoadingPanelTimer(windowIndex);
23721  this.ShowWindowLoadingPanel(windowIndex);
23722 },
23723 ClearWindowLoadingPanelTimer: function(windowIndex) {
23724  this.lpTimers[windowIndex] = ASPx.Timer.ClearTimer(this.lpTimers[windowIndex]);
23725 },
23726 ShowWindowLoadingElementsInternal: function(windowIndex) {
23727  if(this.lpDelay > 1 && !this.enableCallbackAnimation) {
23728   var _this = this;
23729   this.lpTimers[windowIndex] = window.setTimeout(function() { _this.ShowWindowLoadingPanelOnTimer(windowIndex); }, this.lpDelay);
23730  }
23731  else
23732   this.ShowWindowLoadingPanel(windowIndex);
23733 },
23734 ShowWindowLoadingPanel: function(windowIndex) {
23735  if(!this.IsExistLoadingPanel())
23736   return;
23737  if(!this.loadingPanels[windowIndex] && this.InternalIsWindowVisible(windowIndex)) {
23738   var parentElement = this.GetWindowElement(windowIndex).parentNode;
23739   var offsetElement = this.GetLoadingPanelOffsetElement(windowIndex);
23740   this.loadingDivs[windowIndex] = this.CreateLoadingDiv(parentElement, offsetElement, windowIndex);
23741   this.loadingPanels[windowIndex] = this.CreateLoadingPanelWithAbsolutePosition(parentElement, offsetElement, windowIndex);
23742  }
23743 },
23744 GetLoadingPanelOffsetElement: function(windowIndex) {
23745  return this.GetWindowContentWrapperElement(windowIndex);
23746 },
23747 IsExistLoadingPanel: function() {
23748  return !!this.GetLoadingDiv();
23749 },
23750 LockAnimation: function() {
23751  this.animationLockCount++;
23752 },
23753 UnlockAnimation: function() {
23754  this.animationLockCount--;
23755 },
23756 IsAnimationLocked: function() {
23757  return this.animationLockCount > 0;
23758 },
23759 IsAnimationAllowed: function() {
23760  return this.enableAnimation && !this.IsAnimationLocked();
23761 },
23762 SetWindowSizeByIndexCore: function(index, width, height, isWindowCollapsed) {
23763  this.SetClientWindowSizeLite(index, width, height, isWindowCollapsed);
23764  var iFrame = this.GetWindowIFrame(index);
23765  if(iFrame && !isWindowCollapsed) {
23766   var winElememnt = this.GetWindowElement(index);
23767   var realWidth = winElememnt.offsetWidth;
23768   var realHeight = winElememnt.offsetHeight;
23769   ASPx.SetStyles(iFrame, { width: realWidth, height: realHeight });
23770  }
23771  this.UpdateWindowsStateCookie();
23772 },
23773 SetWindowSizeByIndex: function(index, width, height) {
23774  var minWidth = this.GetWindowMinWidth(index);
23775  var minHeight = this.GetWindowMinHeight(index);
23776  var maxWidth = this.GetWindowMaxWidth(index);
23777  var maxHeight = this.GetWindowMaxHeight(index);
23778  if(minWidth)
23779   width = Math.max(width, minWidth);
23780  if(minHeight)
23781   height = Math.max(height, minHeight);
23782  if(maxWidth)
23783   width = Math.min(width, maxWidth);
23784  if(maxHeight)
23785   height = Math.min(height, maxHeight);
23786  var isWindowMaximized = this.GetIsMaximized(index);
23787  var isWindowCollapsed = this.GetIsCollapsed(index);
23788  var isWindowMaximizedAndCollapsed = (isWindowMaximized && isWindowCollapsed);
23789  if(this.SizeCanBeSet(index, isWindowMaximizedAndCollapsed)) {
23790   if(!this.CollapseExecuting() && !this.MaximizationExecuting() && !this.ResizingForMaxWindowLocked()) {
23791    this.SetWindowCachedSize(index, width, height);
23792    this.SetIsResized(index, true);
23793   }
23794   if(isWindowCollapsed && !this.MaximizationExecuting() && !this.ResizingForMaxWindowLocked()) {
23795    this.SetWindowCachedSize(index, width, height);
23796    this.UpdateRestoredWindowSize(index, width, height);
23797    height = 0;
23798   }
23799   if(isWindowMaximized && !this.CollapseExecuting() && !this.ResizingForMaxWindowLocked()) {
23800    this.SetWindowCachedSize(index, width, height);
23801    this.UpdateRestoredWindowSize(index, width, height);
23802   } else {
23803    this.SetWindowSizeByIndexCore(index, width, height, isWindowCollapsed);
23804   }
23805  } else
23806   this.SetWindowCachedSize(index, width, height);
23807 },
23808 SizeCanBeSet: function(index, isWindowMaximizedAndCollapsed) {
23809  return this.InternalIsWindowDisplayed(index) && this.IsWindowElementsIDAssigned(index) && (!isWindowMaximizedAndCollapsed || this.ResizingForMaxWindowLocked());
23810 },
23811 RestoreWindowSizeFromCache: function(index) {
23812  var cachedSize = this.GetWindowCachedSize(index);
23813  if(cachedSize != null) {
23814   this.SetWindowSizeByIndex(index, cachedSize.width, cachedSize.height);
23815   this.ResetWindowCachedSize(index);
23816  }
23817 },
23818 CollapseExecuting: function() {
23819  return false;
23820 },
23821 MaximizationExecuting: function() {
23822  return false;
23823 },
23824 ResizingForMaxWindowLocked: function() {
23825  return false;
23826 },
23827 IsResizeAllowed: function(index) {
23828  return this.allowResize;
23829 },
23830 GetWindowDimensionByIndex: function(index, isWidth, forceFromCache) {
23831  var cachedSize = this.GetWindowCachedSize(index);
23832  var dimensionValue = null;
23833  if(forceFromCache == undefined && !this.GetWindowElement(index))
23834   forceFromCache = true;
23835  if(cachedSize && forceFromCache)
23836   dimensionValue = isWidth ? cachedSize.width : cachedSize.height;
23837  if(dimensionValue)
23838   return dimensionValue;
23839  else {
23840   var element = this.GetWindowElement(index);
23841   var sizeFromDOM = 0;
23842   if(this.GetIsCollapsed(index)) {
23843    var headerCell = this.GetWindowHeaderElement(index);
23844    sizeFromDOM = isWidth ? headerCell.offsetWidth : headerCell.offsetHeight;
23845   }
23846   else {
23847    var mainCell = this.GetWindowMainCell(element);
23848    sizeFromDOM = isWidth ? mainCell.offsetWidth : mainCell.offsetHeight;
23849   }
23850   if(sizeFromDOM === 0 && cachedSize)
23851    sizeFromDOM = isWidth ? cachedSize.width : cachedSize.height;
23852   return sizeFromDOM;
23853  }
23854 },
23855 SetWindowSize: function(window, width, height) {
23856  var index = (window != null) ? window.index : -1;
23857  this.SetWindowSizeByIndex(index, width, height);
23858 },
23859 SetSize: function(width, height) {
23860  this.SetWindowSize(null, width, height);
23861 },
23862 SetWidth: function(width) {
23863  var height = this.GetHeight();
23864  this.SetSize(width, height);
23865 },
23866 SetHeight: function(height) {
23867  var width = this.GetWidth();
23868  this.SetSize(width, height);
23869 },
23870 GetHeight: function() {
23871  return this.GetWindowDimensionByIndex(-1, false, false);
23872 },
23873 GetWidth: function() {
23874  return this.GetWindowDimensionByIndex(-1, true, false);
23875 },
23876 CanBeClosedByClickOnElement: function(index, srcElement, posX, id) {
23877  return srcElement === null || ASPx.GetParentById(srcElement, id) === null;
23878 },
23879 OnMouseDown: function(evt, index, isDraggingAllowed, pointOnScrollBar) {
23880  if(ASPx.Evt.IsLeftButtonPressed(evt)) {
23881   if((this.IsResizeAllowed(index) || isDraggingAllowed) && !this.prohibitClearSelectionOnMouseDown) 
23882    ASPx.Selection.Clear();
23883   var isResizing = this.ProcessResizeOnMouseDown(evt, index);
23884   var clickedOnScroll = pointOnScrollBar && this.GetEnableContentScrolling(index);
23885   if(isDraggingAllowed && !isResizing && !clickedOnScroll && !this.GetIsPinned(index) && !this.GetIsMaximized(index))
23886    this.OnDragStart(evt, index);
23887  }
23888 },
23889 OnMouseMove: function(evt, index) {
23890  if(this.allowResize && !this.GetIsCollapsed(index) && !this.GetIsMaximized(index))
23891   this.CreateResizeCursorInfo(evt, index);
23892 },
23893 CreateResizeCursorInfo: function(evt, index) {
23894  var element = this.GetWindowElement(index);
23895  var mainCell = this.GetWindowMainCell(element);
23896  var clientWindow = this.GetWindowClientTable(index);
23897  var headerElement = this.GetWindowHeaderElement(index);
23898  var left = ASPx.GetAbsoluteX(mainCell);
23899  var top = ASPx.GetAbsoluteY(mainCell);
23900  var x = ASPx.Evt.GetEventX(evt);
23901  var y = ASPx.Evt.GetEventY(evt);
23902  var mainCellWidth = mainCell.offsetWidth;
23903  var mainCellHeight = mainCell.offsetHeight;
23904  var leftOffset = Math.abs(x - left);
23905  var rightOffset = Math.abs(x - left - mainCellWidth);
23906  var topOffset = Math.abs(y - top);
23907  var bottomOffset = Math.abs(y - top - mainCellHeight);
23908  var cursorInfo = this.CreateResizeBorderCursorInfo(index, leftOffset, rightOffset, topOffset, bottomOffset);
23909  var grip = this.GetWindowSizeGripElement(index);
23910  if(grip) {
23911   var gripCursorInfo = this.CreateGripCursorInfo(index, mainCell, grip, leftOffset, rightOffset, bottomOffset);
23912   if(gripCursorInfo)
23913    cursorInfo = gripCursorInfo;
23914  }
23915  this.UpdateResizeCursor(index, clientWindow, cursorInfo.verticalDirection, cursorInfo.horizontalDirection);
23916  this.UpdateResizeCursor(index, mainCell, cursorInfo.verticalDirection, cursorInfo.horizontalDirection);
23917  if(headerElement)
23918   this.UpdateResizeCursor(index, headerElement, cursorInfo.verticalDirection, cursorInfo.horizontalDirection);
23919  return cursorInfo;
23920 },
23921 UpdateResizeCursor: function(index, element, verticalDirection, horizontalDirection) {
23922  var cursor = verticalDirection + horizontalDirection;
23923  if(cursor == "")
23924   this.HideTemporaryCursor(element);
23925  else {
23926   cursor += "-resize";
23927   this.ShowTemporaryCursor(element, cursor);
23928  }
23929 },
23930 CreateGripCursorInfo: function(index, mainCell, grip, leftOffset, rightOffset, bottomOffset) {
23931  var gripWidth = this.rtl
23932   ? ASPx.GetAbsoluteX(grip) - ASPx.GetAbsoluteX(mainCell) + grip.offsetWidth
23933   : mainCell.offsetWidth - (ASPx.GetAbsoluteX(grip) - ASPx.GetAbsoluteX(mainCell));
23934  var gripHeight = mainCell.offsetHeight - (ASPx.GetAbsoluteY(grip) - ASPx.GetAbsoluteY(mainCell));
23935  if(gripHeight > bottomOffset) {
23936   if(this.rtl && gripWidth > leftOffset)
23937    return new PCResizeCursorInfo("w", "s", leftOffset, bottomOffset);
23938   if(gripWidth > rightOffset)
23939    return new PCResizeCursorInfo("e", "s", rightOffset, bottomOffset);
23940  }
23941  return null;
23942 },
23943 CreateResizeBorderCursorInfo: function(index, leftOffset, rightOffset, topOffset, bottomOffset) {
23944  var ResizeBorderSize = this.ResizeBorderSize;
23945  var verticalDirection = this.GetResizeVerticalCourse(ResizeBorderSize, topOffset, bottomOffset);
23946  ResizeBorderSize = verticalDirection != "" ? this.ResizeCornerBorderSize : this.ResizeBorderSize;
23947  var horizontalDirection = this.GetResizeHorizontalCourse(ResizeBorderSize, leftOffset, rightOffset);
23948  if(verticalDirection == "" && horizontalDirection != "")
23949   verticalDirection = this.GetResizeVerticalCourse(this.ResizeCornerBorderSize, topOffset, bottomOffset);
23950  var horizontalOffset = leftOffset < rightOffset ? leftOffset : rightOffset;
23951  var verticalOffset = topOffset < bottomOffset ? topOffset : bottomOffset;
23952  return new PCResizeCursorInfo(horizontalDirection, verticalDirection, horizontalOffset, verticalOffset);
23953 },
23954 GetResizeVerticalCourse: function(ResizeBorderSize, topOffset, bottomOffset) {
23955  if(ResizeBorderSize > topOffset) return "n";
23956  if(ResizeBorderSize > bottomOffset) return "s";
23957  return "";
23958 },
23959 GetResizeHorizontalCourse: function(ResizeBorderSize, leftOffset, rightOffset) {
23960  if(ResizeBorderSize > leftOffset) return "w";
23961  if(ResizeBorderSize > rightOffset) return "e";
23962  return "";
23963 },
23964 ProcessResizeOnMouseDown: function(evt, index) {
23965  var isResizing = false;
23966  if(this.IsResizeAllowed(index) && !this.GetIsCollapsed(index) && !this.GetIsMaximized(index)) {
23967   var eventSourceControl = ASPx.Evt.GetEventSource(evt);
23968   var eventFromPopupContainer = ASPx.ElementHasCssClass(eventSourceControl, PopupControlCssClasse
23968s.ContentCssClassName) ||
23969    !ASPx.GetParentByClassName(eventSourceControl, PopupControlCssClasses.ContentCssClassName) ||
23970    this.eventFromOwnPopupContent(eventSourceControl);
23971   if(eventFromPopupContainer && getComputedStyle(evt.target).cursor !== "pointer")
23972    isResizing = this.OnResizeStart(evt, index);
23973  }
23974  if(isResizing && ASPx.Browser.WebKitTouchUI)
23975   aspxGetPopupControlCollection().OverStop();
23976  return isResizing;
23977 },
23978 eventFromOwnPopupContent: function(element) {
23979  while(element != null) {
23980   if(element.tagName == "BODY")
23981    return false;
23982   if(element.style.position == "absolute") {
23983    var windowIndex = this.GetWindowIndex(element);
23984    var isPopupWindow = !isNaN(windowIndex);
23985    if(isPopupWindow) {
23986     if(this.GetWindowElementId(windowIndex) == element.id)
23987      return true;
23988     return false;
23989    } else {
23990     var elementIsOtherPopup = element.style.zIndex >= this.GetPopupControlZIndex(); 
23991     if(elementIsOtherPopup)
23992      return false;
23993    }
23994   }
23995   element = element.parentNode;
23996  }
23997  return false;
23998 },
23999 OnResizeStart: function(evt, index) {
24000  if(!aspxGetPopupControlCollection().IsResizeInint()) {
24001   var cursor = this.CreateResizeCursorInfo(evt, index);
24002   if(cursor.course != "") {
24003    aspxGetPopupControlCollection().setIframesMouseMoveEnabled(false);
24004    this.EnsureWindowCoverDiv(index);
24005    this.SetIsResized(index, true);
24006    var resizePanel = this.CreateResizePanel(index);
24007    this.UpdateResizeCursor(index, resizePanel, cursor.verticalDirection, cursor.horizontalDirection);
24008    aspxGetPopupControlCollection().InitResizeObject(this, index, cursor, resizePanel);
24009    this.OnResize(evt, index, cursor, resizePanel);
24010   }
24011  }
24012  return aspxGetPopupControlCollection().IsResizeInint();
24013 },
24014 OnResizeStop: function(evt, index, cursor, resizePanel) {
24015  if(this.IsResizeAllowed(index)) {
24016   aspxGetPopupControlCollection().setIframesMouseMoveEnabled(true);
24017   this.RemoveWindowCoverDiv();
24018   var windowElement;
24019   if(!this.isLiveResizingMode) {
24020    windowElement = this.GetWindowElement(index);
24021    ASPx.GetControlCollection().CollapseControls(windowElement);
24022    this.OnResizeWindow(index, cursor, resizePanel);
24023   }
24024   this.CreateResizeCursorInfo(evt, index);
24025   this.UpdateWindowsStateCookie();
24026   this.RaiseResize(index);
24027   if(!this.isLiveResizingMode)
24028    ASPx.GetControlCollection().AdjustControls(windowElement, true);
24029  }
24030  this.ResetResizeSessionCache();
24031 },
24032 OnResizeWindow: function(index, cursor, resizePanel) {
24033  var windowElement = this.GetWindowElement(index);
24034  var resizePanelDimensions = this.GetResizePanelDimensions();
24035  var left = resizePanelDimensions.left;
24036  var top = resizePanelDimensions.top;
24037  this.SetClientWindowSizeLite(index, resizePanelDimensions.offsetWidth, resizePanelDimensions.offsetHeight);
24038  if(this.fixedBottom)
24039   top = this.fixedBottom - windowElement.offsetHeight;
24040  if(this.fixedRight)
24041   left = this.fixedRight - windowElement.offsetWidth;
24042  this.fixedBottom = null;
24043  this.fixedRight = null;
24044  if(cursor.verticalDirection === "n")
24045   this.ChangePosOnResizeWindow(top, windowElement, false);
24046  if(cursor.horizontalDirection === "w")
24047   this.ChangePosOnResizeWindow(left, windowElement, true);
24048  if(this.InternalIsWindowVisible(index)) 
24049   this.DoShowWindowIFrame(index, left, top, ASPx.InvalidDimension, ASPx.InvalidDimension);
24050 },
24051 ChangePosOnResizeWindow: function(pos, windowElement, isX) {
24052  if(ASPx.Browser.IE && ASPx.Browser.Version >= 10)
24053   pos = Math.round(pos);
24054  windowElement.style[isX ? "left" : "top"] = pos + "px";
24055 },
24056 SetClientWindowSizeLite: function(index, width, height, isWindowCollapsed) {
24057  this.RaiseBeforeResizing(index);
24058  this.SetClientWindowSizeCoreLite(index, width, height, isWindowCollapsed);
24059  if(!this.IsRaiseAfterResizingLocked())
24060   this.RaiseAfterResizing(index);
24061 },
24062 SetClientWindowSizeCoreLite: function(index, width, height, isWindowCollapsed) {
24063  var contentUrl = this.GetWindowContentIFrameUrl(index);
24064  var needToHideContent = !contentUrl;
24065  var element = this.GetWindowElement(index);
24066  var contentWrapper = this.GetWindowContentWrapperElement(index);
24067  var contentElement = this.GetWindowContentElement(index);
24068  var scrollTop = null,
24069   scrollLeft = null;
24070  if(ASPx.Browser.IE && this.GetEnableContentScrolling(index)) {
24071   scrollTop = contentElement.scrollTop;
24072   scrollLeft = contentElement.scrollLeft;
24073  }
24074  var contentIframeElement = this.GetWindowContentIFrameElement(index);
24075  var iframeHeightCorrectionOnFirstShow = height > 0;
24076  if(contentIframeElement && (this.GetWindowIsShown(index) || iframeHeightCorrectionOnFirstShow))
24077   contentIframeElement.style.height = "0px";
24078  contentWrapper.style.height = "";
24079  contentWrapper.style.width = "";
24080  contentElement.style.height = "";
24081  contentElement.style.width = "";
24082  var hasAnyScrollBars = this.HasAnyScrollBars(index);
24083  var expectedHeight = (!ASPx.IsExists(height) && hasAnyScrollBars) ? this.GetExpectedHeight(index) : null;
24084  var contentElementChildrenScroll = null,
24085   contentElementChildren = null;
24086  if(needToHideContent) {
24087   if(ASPx.Browser.IE) {
24088    var contentElementChildren = this.GetContentElementChildren(index, contentElement),
24089     contentElementChildrenScroll = this.GetContentElementChildrenScroll(index, contentElementChildren);
24090   }
24091   contentElement.style.display = "none";
24092  }
24093  var elementsDisplayValue = this.GetWindowElementDisplayValue(hasAnyScrollBars, height);
24094  element.style.display = elementsDisplayValue;
24095  if(!this.GetIsCollapsed(index))
24096   contentWrapper.style.display = elementsDisplayValue;
24097  if(ASPx.IsExists(width)) {
24098   var actualWidth = width - this.GetElementBordersAndPaddings(index, element, true);
24099   if(actualWidth <= 0)
24100    actualWidth = ASPx.Browser.WebKitFamily ? 1 : 0; 
24101   element.style.width = actualWidth + "px";
24102  }
24103  var actualHeight;
24104  if(ASPx.IsExists(height)) {
24105   actualHeight = height - this.GetElementBordersAndPaddings(index, element, false);
24106   if(actualHeight < 0)
24107    actualHeight = 0;
24108   element.style.height = actualHeight + "px";
24109  } else {
24110   if(ASPx.IsExists(expectedHeight)) {
24111    actualHeight = expectedHeight;
24112    element.style.height = actualHeight + "px";
24113   }
24114  }
24115  this.CorrectWindowSizeGripPositionLite(index);
24116  this.CorrectWindowHeaderText(index);
24117  this.SetContentWrapperHeightLite(index, actualHeight, element, contentWrapper);
24118  var correctContentElementSize = hasAnyScrollBars || contentElement.style.overflow == "hidden" || contentElement.style.overflowX == "hidden" || contentElement.style.overflowY == "hidden";
24119  if((correctContentElementSize || contentUrl) && (height || expectedHeight)) {
24120   if(contentElement !== contentWrapper) {
24121    var contentHeight = ASPx.GetClearClientHeight(contentWrapper);
24122    if(contentHeight < 0)
24123     contentHeight = 0;
24124    contentElement.style.height = contentHeight + "px";
24125   }
24126  }
24127  if(correctContentElementSize && width && contentElement !== contentWrapper)
24128   contentElement.style.width = ASPx.GetClearClientWidth(contentWrapper) + "px";
24129  contentElement.style.display = this.getContentElementDisplay(correctContentElementSize, contentUrl);
24130  if(ASPx.IsExists(contentElementChildrenScroll) && contentElementChildrenScroll.length > 0) {
24131   for(var i = 0; i < contentElementChildrenScroll.length; i++) {
24132    var childScroll = contentElementChildrenScroll[i],
24133     childIndex = childScroll[0],
24134     childScrollLeft = childScroll[1],
24135     childScrollTop = childScroll[2];
24136    if(!!childScrollLeft)
24137     contentElementChildren[childIndex].scrollLeft = childScrollLeft;
24138    if(!!childScrollTop)
24139     contentElementChildren[childIndex].scrollTop = childScrollTop;
24140   }
24141  }
24142  if(ASPx.Browser.IE && this.GetEnableContentScrolling(index)) {
24143   contentElement.scrollTop = scrollTop;
24144   contentElement.scrollLeft = scrollLeft;
24145  }
24146  if(contentIframeElement)
24147   contentIframeElement.style.height = "100%";
24148  this.SetWindowWidth(index, width);
24149  this.SetWindowHeight(index, height);
24150  if(isWindowCollapsed)
24151   this.ResetWindowHeight(index);
24152 },
24153 GetExpectedHeight: function(index) {
24154  var height = this.GetWindowHeightInternal(index) || 0;
24155  height = Math.max(height, this.GetWindowMinHeight(index));
24156  if(this.HasAnyScrollBars(index)) {
24157   var windowHeight = this.GetWindowContentElement(index).offsetHeight + this.GetWindowHeightWithoutContent(index);
24158   height = Math.max(height, windowHeight);
24159  }
24160  var maxHeight = this.GetWindowMaxHeight(index);
24161  if(maxHeight)
24162   height = Math.min(height, maxHeight);
24163  return height;
24164 },
24165 IsRaiseAfterResizingLocked: function() {
24166  return false;
24167 },
24168 CreateResizePanel: function(index) {
24169  var element = this.GetWindowElement(index);
24170  var resizePanel = document.createElement("DIV");
24171  element.parentNode.appendChild(resizePanel);
24172  resizePanel.style.overflow = "hidden";
24173  resizePanel.style.position = "absolute";
24174  resizePanel.style.zIndex = this.GetPopupControlZIndex() + aspxGetPopupControlCollection().visiblePopupWindowIds.length * 2 + 2;
24175  if(!this.isLiveResizingMode)
24176   resizePanel.style.border = "black 1px dotted";
24177  return resizePanel;
24178 },
24179 OnResize: function(evt, index, cursor, resizePanel) {
24180  this.OnResizePanelLite(evt, index, cursor, resizePanel);
24181  if(this.isLiveResizingMode)
24182   this.OnResizeWindow(index, cursor, resizePanel);
24183  ASPx.Selection.Clear();
24184  if(ASPx.Browser.WebKitTouchUI)
24185   evt.preventDefault();
24186  if(this.GetIsPinned(index))
24187   this.HoldPosition(index, true, resizePanel);
24188 },
24189 OnResizePanelLite: function(evt, index, cursor, resizePanel) {
24190  var x = ASPx.Evt.GetEventX(evt);
24191  var y = ASPx.Evt.GetEventY(evt);
24192  var element = this.GetWindowElement(index);
24193  if(ASPx.Browser.IE && ASPx.Browser.Version >= 10) {
24194   x = Math.round(x);
24195   y = Math.round(y);
24196  }
24197  var elementTop = ASPx.GetAbsoluteY(element);
24198  var elementLeft = ASPx.GetAbsoluteX(element);
24199  var newLeft = ASPx.PxToInt(element.style.left);
24200  var newTop = ASPx.PxToInt(element.style.top);
24201  var newWidth = element.offsetWidth;
24202  var newHeight = element.offsetHeight;
24203  if(cursor.verticalDirection == "n") {
24204   if(!this.fixedBottom)
24205    this.fixedBottom = newTop + newHeight;
24206   newHeight += elementTop - y + cursor.verticalOffset;
24207   newTop = ASPx.PrepareClientPosForElement(y - cursor.verticalOffset, element, false);
24208  }
24209  if(cursor.verticalDirection == "s") {
24210   newHeight = y - elementTop + cursor.verticalOffset;
24211   this.fixedBottom = null;
24212  }
24213  if(cursor.horizontalDirection == "w") {
24214   if(!this.fixedRight)
24215    this.fixedRight = newLeft + newWidth;
24216   newWidth += elementLeft - x + cursor.horizontalOffset;
24217   newLeft = ASPx.PrepareClientPosForElement(x - cursor.horizontalOffset, element, true);
24218  }
24219  if(cursor.horizontalDirection == "e") {
24220   newWidth = x - elementLeft + cursor.horizontalOffset;
24221   this.fixedRight = null;
24222  }
24223  if(newWidth > 0 && newHeight > 0) {
24224   var minWidth = this.GetWindowMinWidth(index);
24225   var maxWidth = this.GetWindowMaxWidth(index);
24226   if(minWidth && newWidth < minWidth)
24227    newWidth = minWidth;
24228   if(maxWidth && newWidth > maxWidth)
24229    newWidth = maxWidth;
24230   var minHeight = this.GetWindowMinHeight(index);
24231   var maxHeight = this.GetWindowMaxHeight(index);
24232   if(minHeight && newHeight < minHeight)
24233    newHeight = minHeight;
24234   if(maxHeight && newHeight > maxHeight)
24235    newHeight = maxHeight;
24236   if(ASPx.Browser.IE && ASPx.Browser.Version >= 10) {
24237    newLeft = Math.round(newLeft);
24238    newTop = Math.round(newTop);
24239    newHeight = Math.round(newHeight);
24240    newWidth = Math.round(newWidth);
24241   }
24242   this.SetResizePanelDimensions(newLeft, newTop, newWidth, newHeight);
24243   var widthWithoutBorders = newWidth - this.getLeftRightBordersAndPaddingsSummaryValue(resizePanel);
24244   var heightWithoutBorders = newHeight - this.getTopBottomBordersAndPaddingsSummaryValue(resizePanel);
24245   ASPx.SetStyles(resizePanel, {
24246    left: newLeft, top: newTop,
24247    width: widthWithoutBorders, height: heightWithoutBorders
24248   });
24249   this.SetWindowLeft(index, elementLeft);
24250   this.SetWindowTop(index, elementTop);
24251  }
24252 },
24253 SetResizePanelDimensions: function(left, top, offsetWidth, offsetHeight) {
24254  var cache = this.GetResizeSessionCache();
24255  cache.resizePanelDimensions = {
24256   left: left,
24257   top: top,
24258   offsetWidth: offsetWidth,
24259   offsetHeight: offsetHeight
24260  };
24261 },
24262 GetResizePanelDimensions: function() {
24263  var cache = this.GetResizeSessionCache();
24264  return cache.resizePanelDimensions;
24265 },
24266 ResetResizeSessionCache: function() {
24267  this.resizeSessionCache = {};
24268 },
24269 GetResizeSessionCache: function() {
24270  return aspxGetPopupControlCollection().IsResizeInint() ? this.resizeSessionCache : {};
24271 },
24272 EnsureWindowCoverDiv: function(index) {
24273  this.windowCoverDiv = this.CreateCoverDiv(index);
24274  var windowElement = this.GetWindowElement(index);
24275  windowElement.parentNode.appendChild(this.windowCoverDiv);
24276 },
24277 CreateCoverDiv: function(index) {
24278  var coverDiv = document.createElement("DIV");
24279  ASPx.SetStyles(coverDiv, {
24280   position: "fixed",
24281   left: 0,
24282   top: 0,
24283   width: "100%",
24284   height: "100%"
24285  });
24286  return coverDiv;
24287 },
24288 RemoveWindowCoverDiv: function() {
24289  if(!!this.windowCoverDiv) {
24290   this.windowCoverDiv.parentNode.removeChild(this.windowCoverDiv);
24291   this.windowCoverDiv = null;
24292  }
24293 },
24294 OnDrag: function(index, x, y, xClientCorrection, yClientCorrection) {
24295  var element = this.GetWindowElement(index);
24296  if(element != null) {
24297   ASPx.SetStyles(element, { left: x, top: y });
24298   xClientCorrection = typeof (xClientCorrection) != "undefined" ? xClientCorrection : 0;
24299   yClientCorrection = typeof (yClientCorrection) != "undefined" ? yClientCorrection : 0;
24300   this.SetWindowLeft(index, x + xClientCorrection);
24301   this.SetWindowTop(index, y + yClientCorrection);
24302   var iFrame = element.overflowElement;
24303   if(iFrame)
24304    ASPx.SetStyles(iFrame, { left: x, top: y });
24305   if(ASPx.Browser.Opera)
24306    ASPx.Selection.Clear();
24307  }
24308 },
24309 OnDragStop: function(index) {
24310  this.HideDragCursor(index);
24311  this.UpdateWindowsStateCookie();
24312  if(this.GetWindowContentIFrameElement(index))
24313   this.SetIframeVisibleForDragging(index, true);
24314 },
24315 OnDragStart: function(evt, index) {
24316  this.SetIsDragged(index, true);
24317  this.ShowDragCursor(index);
24318  if(this.GetWindowContentIFrameElement(index))
24319   this.SetIframeVisibleForDragging(index, false);
24320  this.InitDragInfo(index, evt);
24321 },
24322 HideIframeElementBeforeDragging: function() {
24323 },
24324 InitDragInfo: function(index, evt) {
24325  var element = this.GetWindowElement(index);
24326  var gragXOffset = ASPx.GetAbsoluteX(element) - ASPx.Evt.GetEventX(evt);
24327  var gragYOffset = ASPx.GetAbsoluteY(element) - ASPx.Evt.GetEventY(evt);
24328  var xClientCorrection = this.GetDragCorrection(index, element, true);
24329  var yClientCorrection = this.GetDragCorrection(index, element, false);
24330  gragXOffset -= xClientCorrection;
24331  gragYOffset -= yClientCorrection;
24332  aspxGetPopupControlCollection().InitDragObject(this, index, gragXOffset, gragYOffset, xClientCorrection, yClientCorrection);
24333 },
24334 GetDragCorrection: function(index, element, isX) {
24335  return ASPx.GetPositionElementOffset(element, isX);
24336 },
24337 ShowDragCursor: function(index) {
24338  var dragElement = this.GetDragElement(index);
24339  if(dragElement)
24340   this.ShowTemporaryCursor(dragElement, "move");
24341 },
24342 ShowTemporaryCursor: function(element, cursor) {
24343  ASPx.Attr.ChangeStyleAttribute(element, "cursor", cursor);
24344 },
24345 HideDragCursor: function(index) {
24346  var dragElement = this.GetDragElement(index);
24347  if(dragElement != null)
24348   this.HideTemporaryCursor(dragElement);
24349 },
24350 GetDragElement: function(index) {
24351  var headerElement = this.GetWindowHeaderElement(index);
24352  var element = this.GetWindowElement(index);
24353  if(element != null)
24354   return (headerElement != null ? headerElement : this.GetWindowMainCell(element));
24355  return null;
24356 },
24357 HideTemporaryCursor: function(element) {
24358  ASPx.Attr.RestoreStyleAttribute(element, "cursor");
24359 },
24360 OnDocumentKeyDown: function(evt, popupWindow) {
24361  var handler = this.keyDownHandlers && this.keyDownHandlers[ASPx.GetShortcutCode(evt.keyCode, evt.ctrlKey, evt.shiftKey, evt.altKey)];
24362  if(handler)
24363   handler(this.GetWindowIndex(popupWindow));
24364 },
24365 OnEscKeyDown: function(index) {
24366  if(this.GetEnableCloseByEsc(index))
24367   this.DoHideWindow(index, false, ASPxClientPopupControlCloseReason.Escape);
24368 },
24369 OnRefreshButtonClick: function(index) {
24370  var contentIFrame = this.GetWindowContentIFrameElement(index);
24371  if(contentIFrame)
24372   this.RefreshWindowContentUrl(this.GetWindow(index));
24373  else
24374   this.PerformWindowCallback(this.GetWindow(index));
24375 },
24376 OnCloseButtonClick: function(index) {
24377  this.RaiseCloseButtonClick(index);
24378  if(this.GetWindowCloseAction(index) != "None")
24379   this.DoHideWindow(index, false, ASPxClientPopupControlCloseReason.CloseButton);
24380 },
24381 Show: function(popupElementIndex) {
24382  this.ShowWindowByIndex(-1, popupElementIndex);
24383 },
24384 Hide: function() {
24385  this.HideWindow(null);
24386 },
24387 HideWindow: function(window) {
24388  var index = (window != null) ? window.index : -1;
24389  this.DoHideWindow(index, false, ASPxClientPopupControlCloseReason.API);
24390 },
24391 RaiseEventByIndex: function(index, event, argsName) {
24392  if(!event.IsEmpty()) {
24393   var window = index < 0 ? null : this.GetWindow(index),
24394    args = new argsName(window);
24395   event.FireEvent(this, args);
24396  }
24397 },
24398 RaiseCloseButtonClick: function(index) {
24399  this.RaiseEventByIndex(index, this.CloseButtonClick, ASPxClientPopupWindowEventArgs);
24400 },
24401 RaiseShown: function(index) {
24402  this.RaiseEventByIndex(index, this.Shown, ASPxClientPopupWindowEventArgs);
24403 },
24404 RaisePopUp: function(index) {
24405  this.RaiseEventByIndex(index, this.PopUp, ASPxClientPopupWindowEventArgs);
24406 },
24407 RaiseBeforeResizing: function(index) {
24408  this.RaiseEventByIndex(index, this.BeforeResizing, ASPxClientPopupWindowEventArgs);
24409 },
24410 RaiseAfterResizing: function(index) {
24411  this.RaiseEventByIndex(index, this.AfterResizing, ASPxClientPopupWindowEventArgs);
24412 },
24413 RaiseClosing: function(index, closeReason) {
24414  var window = index < 0 ? null : this.GetWindow(index);
24415  var cancel = false;
24416  if(!this.Closing.IsEmpty()) {
24417   var args = new ASPxClientPopupWindowCancelEventArgs(window, closeReason);
24418   this.Closing.FireEvent(this, args);
24419   cancel = args.cancel;
24420  }
24421  return cancel;
24422 },
24423 RaiseCloseUp: function(index, closeReason) {
24424  var window = index < 0 ? null : this.GetWindow(index);
24425  if(!this.CloseUp.IsEmpty()) {
24426   var args = new ASPxClientPopupWindowCloseUpEventArgs(window, closeReason);
24427   this.CloseUp.FireEvent(this, args);
24428  }
24429 },
24430 RaiseResize: function(index, resizeState) {
24431  var window = index < 0 ? null : this.GetWindow(index);
24432  if(!this.Resize.IsEmpty()) {
24433   if(!resizeState)
24434    resizeState = ASPxClientPopupControlResizeState.Resized;
24435   var args = new ASPxClientPopupWindowResizeEventArgs(window, resizeState);
24436   this.Resize.FireEvent(this, args);
24437  }
24438 },
24439 RaisePopupOnShow: function(isMoving, index) {
24440  if(!isMoving) {
24441   this.RaisePopUp(index);
24442   if(!this.IsAnimationAllowed())
24443    this.OnWindowShown(index);
24444  }
24445 },
24446 OnActivate: function(index, evt) {
24447  var element = this.GetWindowElement(index);
24448  if(element != null)
24449   aspxGetPopupControlCollection().ActivateWindowElement(element, evt, this.GetPopupType(), this.GetDefaultZIndexFromServer(), this.GetPopupControlZIndex());
24450 },
24451 OnPWHBClickCore: function(evt, index, method) {
24452  this.OnActivate(index, evt);
24453  if(ASPx.TouchUIHelper.handleFastTapIfRequired(evt,
24454   function() { this[method](index); }.aspxBind(this), true)) {
24455   return;
24456  }
24457  if(ASPx.Browser.Opera)
24458   ASPx.Evt.EmulateDocumentOnMouseDown(evt);
24459  this[method](index);
24460 },
24461 OnScroll: function(evt, index) {
24462  if(this.HasIframeOnIos(index))
24463   this.ResetWebkitScrolling(this.getTouchScrollerElement(index), 0);
24464  if(!this.GetIsPinned(index) || (this.lockScroll > 0)) return;
24465  this.AdjustPinPositionWhileScroll(index);
24466 },
24467 ResetWebkitScrolling: function(scrollElement, timeout) {
24468  if(scrollElement.scrollTop === 0) {
24469   var styleName = "-webkit-overflow-scrolling";
24470   scrollElement.style[styleName] = "auto";
24471   window.setTimeout(function() {
24472    scrollElement.style[styleName] = "touch";
24473   }.aspxBind(this), timeout);
24474  }
24475 },
24476 HaveSpecialDivForAnimation: function() {
24477  return this.enableAnimation;
24478 },
24479 HasIframeOnIos: function(index) {
24480  return ASPx.Browser.MacOSMobilePlatform && !!this.GetWindowContentIFrameElement(index);
24481 },
24482 WindowIsModal: function(index) {
24483  return this.GetPropertyValue(index, "modal");
24484 },
24485 GetIsPopuped: function(index) {
24486  if(0 <= index && index < this.GetWindowCountCore())
24487   return this.windowsIsPopupedList[index];
24488  return this.defaultIsPopuped;
24489 },
24490 SetIsPopuped: function(index, isPopuped) {
24491  if(0 <= index && index < this.GetWindowCountCore())
24492   this.windowsIsPopupedList[index] = isPopuped;
24493  this.defaultIsPopuped = isPopuped;
24494 },
24495 GetIsMaximized: function(index) {
24496  return false;
24497 },
24498 GetIsMaximizedInit: function(index) {
24499  return false;
24500 },
24501 GetCurrentLeft: function(index) {
24502  return this.GetPosition(index, true);
24503 },
24504 GetCurrentTop: function(index) {
24505  return this.GetPosition(index, false);
24506 },
24507 GetIsPinned: function(index) {
24508  return false;
24509 },
24510 GetIsCollapsed: function(index) {
24511  return false;
24512 }, 
24513 needToHidePinnedOutFromViewPort: function(index) {
24514  return false;
24515 },
24516 GetHideBodyScrollWhenModal: function(index) {
24517  return false;
24518 },
24519 GetCanScrollViewPort: function(index) {
24520  return false;
24521 },
24522 GetEnableContentScrolling: function(index) {
24523  return false;
24524 },
24525 AutoUpdateElementsPosition: function() {
24526 },
24527 GetWindowChild: function(index, idPostfix) {
24528  var elem = this.GetWindowElement(index);
24529  if(elem)
24530   return ASPx.GetChildById(elem, this.name + idPostfix);
24531  return null;
24532 },
24533 GetWindowIndex: function(element) {
24534  var id = element.id;
24535  var pos = id.lastIndexOf(ASPx.PCWIdSuffix);
24536  return parseInt(id.substr(pos + ASPx.PCWIdSuffix.length));
24537 },
24538 GetWindow: function(index) {
24539  return (0 <= index && index < this.windows.length) ? this.windows[index] : null;
24540 },
24541 DoShowWindowIFrame: function(index, x, y, width, height) {
24542  if(!this.renderIFrameForPopupElements) return;
24543  var element = this.GetWindowElement(index);
24544  var iFrame = this.GetWindowIFrame(index);
24545  if(element && iFrame) {
24546   var cell = this.GetWindowMainCell(element);
24547   if(width < 0)
24548    width = cell.offsetWidth;
24549   if(height < 0)
24550    height = cell.offsetHeight;
24551   ASPx.SetStyles(iFrame, { width: width, height: height });
24552   if(this.IsValidPosition(x) && this.IsValidPosition(y))
24553    ASPx.SetStyles(iFrame, { left: x, top: y });
24554   if(ASPx.Browser.IE || ASPx.Browser.Firefox)
24555    this.ClearWindowIframeBodyInnerHtml(iFrame);
24556   ASPx.SetElementDisplay(iFrame, true);
24557  }
24558 },
24559 IsValidPosition: function(pos) {
24560  return pos !== ASPx.InvalidPosition;
24561 },
24562 DoHideWindowIFrame: function(element) {
24563  if(!this.renderIFrameForPopupElements) return;
24564  var iFrame = element.overflowElement;
24565  if(iFrame)
24566   ASPx.SetElementDisplay(iFrame, false);
24567 },
24568 GetIframeBody: function(iFrame) {
24569  var document = iFrame.contentDocument || iFrame.contentWindow.document;
24570  if(document)
24571   return document.getElementsByTagName('body')[0];
24572 },
24573 ClearWindowIframeBodyInnerHtml: function(iFrame) {
24574  var iFrameBody = this.GetIframeBody(iFrame);
24575  if(iFrameBody)
24576   iFrameBody.innerHTML = "";
24577 },
24578 FindWindowIFrame: function(index) {
24579  return ASPx.GetElementById(this.name + "_DXPWIF" + index);
24580 },
24581 GetWindowIFrame: function(index) {
24582  var element = this.GetWindowElement(index);
24583  var iFrame = element.overflowElement;
24584  if(!iFrame) {
24585   iFrame = this.FindWindowIFrame(index);
24586   element.overflowElement = iFrame;
24587  }
24588  return iFrame;
24589 },
24590 CreateFakeDivForIframe: function(iframe) {
24591  var fakeDiv = document.createElement("div");
24592  ASPx.SetStyles(fakeDiv, { width: iframe.offsetWidth, height: iframe.offsetHeight });
24593  return fakeDiv;
24594 },
24595 CreateIframeCoverDiv: function(iframe, index) {
24596  if(!this.iframeCoverDiv)
24597   this.iframeCoverDiv = [];
24598  if(!this.iframeCoverDiv[index])
24599   this.iframeCoverDiv[index] = this.CreateFakeDivForIframe(iframe);
24600  this.iframeCoverDiv[index].style.position = "absolute";
24601  iframe.parentElement.appendChild(this.iframeCoverDiv[index]);
24602  ASPx.SetAbsoluteX(this.iframeCoverDiv[index], ASPx.GetAbsoluteX(iframe));
24603  ASPx.SetAbsoluteY(this.iframeCoverDiv[index], ASPx.GetAbsoluteY(iframe));
24604 },
24605 RemoveIframeCoverDiv: function(iframe, index) {
24606  iframe.parentElement.removeChild(this.iframeCoverDiv[index]);
24607  this.iframeCoverDiv[index] = null;
24608 },
24609 GetWindowBorderOwnerElement: function(windowElement) {
24610  if(ASPx.ElementHasCssClass(windowElement, PopupControlCssClasses.MainDivLiteCssClass))
24611   return windowElement;
24612  else
24613   return ASPx.GetNodeByClassName(windowElement, PopupControlCssClasses.MainDivLiteCssClass);
24614 },
24615 GetWindowContentIFrameElement: function(index) {
24616  return this.GetWindowChild(index, "_CIF" + index);
24617 },
24618 GetWindowContentElement: function(index) {
24619  return this.GetWindowChild(index, "_PWC" + index);
24620 },
24621 GetWindowContentIFrameElementId: function(index) {
24622  return this.name + "_CIF" + index;
24623 },
24624 GetContentContainer: function(index) {
24625  return this.GetWindowContentElement(index);
24626 },
24627 getTouchScrollerElement: function(index) {
24628  return this.GetContentContainer(index);
24629 },
24630 GetWindowHeaderElement: function(index) {
24631  return this.GetWindowChild(index, "_PWH" + index);
24632 },
24633 GetWindowFooterElement: function(index) {
24634  return this.GetWindowChild(index, "_PWF" + index);
24635 },
24636 GetWindowSizeGripElement: function(index) {
24637  var footer = this.GetWindowFooterElement(index);
24638  if(!footer)
24639   return null;
24640  var descendants = ASPx.GetNodesByClassName(footer, PopupControlCssClasses.SizeGripLiteCssClassName);
24641  return descendants.length > 0 ? descendants[0] : null;
24642 },
24643 GetWindowContentWrapperElement: function(index) {
24644  if(!ASPx.IsExistsElement(this.windowContentElements[index])) {
24645   var windowElem = this.GetWindowElement(index);
24646   var contentWrapperParent = this.GetWindowMainCell(windowElem);
24647   this.windowContentElements[index] = ASPx.GetChildByClassName(contentWrapperParent, PopupControlCssClasses.ContentWrapperCssClassName);
24648  }
24649  return this.windowContentElements[index];
24650 },
24651 GetWindowMainCell: function(element) {
24652  return this.HaveSpecialDivForAnimation() ? ASPx.GetNodeByTagName(element, "DIV", 0) : element;
24653 },
24654 GetWindowModalElement: function(index) {
24655  var element = this.GetWindowElement(index);
24656  if(!element) return;
24657  var modalElement = element.modalElement;
24658  if(!modalElement) {
24659   modalElement = this.FindWindowModalElement(index);
24660   element.modalElement = modalElement;
24661   if(modalElement) {
24662    modalElement.DXModalPopupControl = this;
24663    modalElement.DXModalPopupWindowIndex = index;
24664   }
24665  }
24666  return modalElement;
24667 },
24668 CanManipulateWithModalElement: function(index) {
24669  return this.WindowIsModal(index);
24670 },
24671 GetCurrentZIndex: function(index) {
24672  var element = this.GetWindowElement(index);
24673  if(element != null) {
24674   if(element.style.zIndex != "" && element.style.zIndex != this.GetDefaultZIndexFromServer())
24675    return element.style.zIndex;
24676   return this.GetZIndex(index);
24677  }
24678 },
24679 GetWindowsState: function() {
24680  var state = "";
24681  if(this.HasDefaultWindow()) {
24682   state += this.GetWindowState(-1);
24683  }
24684  return state;
24685 },
24686 GetWindowState: function(index) {
24687  var element = this.GetWindowElement(index);
24688  if(element != null) {
24689   var visibleFlag = (!this.InternalIsWindowVisible(index) || element.isHiding) ? "0" : "1";
24690   var isDraggedFlag = this.GetIsDragged(index) ? "1" : "0";
24691   var zIndex = this.GetCurrentZIndex(index);
24692   var isResized = this.GetIsResized(index);
24693   var isResizedFlag = isResized ? "1" : "0";
24694   var width = null, height=null;
24695   if(isResized) {
24696    width = this.GetWindowWidthInternal(index);
24697    height = this.GetIsCollapsed(index) ? this.GetWindowDimensionByIndex(index, false, true) : this.GetWindowHeightInternal(index);
24698   } else {
24699    width = ASPx.InvalidDimension;
24700    height = ASPx.InvalidDimension;
24701   }
24702   var contentWasLoaded = element.loaded ? "1" : "0";
24703   var left, top;
24704   var isMaximized = this.GetIsMaximized(index);
24705   if(isMaximized && !this.MaximizationExecuting()) {
24706    var restoredWindowData = this.GetRestoredWindowData(index);
24707    left = restoredWindowData.left;
24708    top = restoredWindowData.top;
24709   } else {
24710    left = this.GetCurrentLeft(index);
24711    top = this.GetCurrentTop(index);
24712   }
24713   var isPinned = this.GetIsPinned(index);
24714   if(isPinned) {
24715    left -= ASPx.GetDocumentScrollLeft();
24716    top -= ASPx.GetDocumentScrollTop();
24717   }
24718   left = Math.ceil(left);
24719   top = Math.ceil(top);
24720   var pinFlag = isPinned ? "1" : "0";
24721   var minFlag = this.GetIsCollapsed(index) ? "1" : "0";
24722   var maxFlag = isMaximized || this.GetIsMaximizedInit(index) ? "1" : "0";
24723   return [visibleFlag, isDraggedFlag, zIndex, left, top, isResizedFlag, width, height, contentWasLoaded, pinFlag, minFlag, maxFlag].join(":");
24724  }
24725  return "";
24726 },
24727 UpdateStateObject: function(){
24728  this.UpdateStateObjectWithObject({ windowsState: this.GetWindowsState() });
24729 },
24730 GetStateHiddenFieldOrigin: function() {
24731  return this.GetWindowElement(this.GetWindowCountCore() - 1);
24732 },
24733 GetPopupType: function() {
24734  return "aspxpopup";
24735 },
24736 GetDefaultZIndexFromServer: function() {
24737  return defaultZIndexFromServer;
24738 },
24739 GetPopupControlZIndex: function() {
24740  return popupControlZIndex;
24741 },
24742 FindWindowModalElement: function(index) {
24743  return ASPx.GetElementById(this.name + "_DXPWMB" + index);
24744 },
24745 GetWindowCloseButton: function(index) {
24746  return ASPx.GetElementById(this.name + "_HCB" + index);
24747 },
24748 GetWindowRefreshButton: function(index) {
24749  return ASPx.GetElementById(this.name + "_HRB" + index);
24750 },
24751 FirstShowWindow: function(index, allowChangeZIndex) {
24752  var popupHorizontalOffsetBackup = -1;
24753  var popupVerticalOffsetBackup = -1;
24754  var isFreeWindow = this.GetIsDragged(index);
24755  var x = ASPx.InvalidPosition;
24756  var y = ASPx.InvalidPosition;
24757  if(isFreeWindow) {
24758   x = this.GetWindowLeft(index);
24759   y = this.GetWindowTop(index);
24760   popupHorizontalOffsetBackup = this.popupHorizontalOffset;
24761   popupVerticalOffsetBackup = this.popupVerticalOffset;
24762   this.popupHorizontalOffset = 0;
24763   this.popupVerticalOffset = 0;
24764  }
24765  this.LockAnimation();
24766  this.DoShowWindowCore(index, x, y, isFreeWindow ? -1 : 0, false, allowChangeZIndex);
24767  this.UnlockAnimation();
24768  if(isFreeWindow) {
24769   this.popupHorizontalOffset = popupHorizontalOffsetBackup;
24770   this.popupVerticalOffset = popupVerticalOffsetBackup;
24771  }
24772  this.CorrectElementVerticalAlignment(ASPx.AdjustVerticalMarginsInContainer, this.GetWindowHeaderElement(index));
24773 },
24774 HasDefaultWindow: function() {
24775  return true;
24776 },
24777 GetWindowCount: function() {
24778  return 0;
24779 },
24780 GetWindowContentHtml: function(window) {
24781  var index = (window != null) ? window.index : -1;
24782  var element = this.GetContentContainer(index);
24783  return (element != null) ? element.innerHTML : "";
24784 },
24785 GetWindowElementId: function(index) {
24786  return this.name + ASPx.PCWIdSuffix + index;
24787 },
24788 GetWindowElement: function(index) {
24789  if(!ASPx.IsExistsElement(this.windowElements[index]))
24790   this.windowElements[index] = ASPx.GetElementById(this.GetWindowElementId(index));
24791  return this.windowElements[index];
24792 },
24793 GetWindowClientTable: function(index) {
24794  return this.GetWindowElement(index);
24795 },
24796 GetCurrentWindowElement: function() {
24797  return this.GetWindowElement(-1);
24798 },
24799 ShowWindowContentUrl: function(index) {
24800  var contentIFrame = this.GetWindowContentIFrameElement(index);
24801  this.LoadWindowContentUrl(index);
24802  if(contentIFrame && contentIFrame.DXReloadAfterShowRequired) {
24803   this.RefreshWindowContentUrl(this.GetWindow(index));
24804   contentIFrame.DXReloadAfterShowRequired = false;
24805  }
24806 },
24807 RefreshWindowContentUrl: function(window) {
24808  var index = (window != null) ? window.index : -1;
24809  if(ASPx.Browser.IE)
24810   this.RefreshWindowContentUrlIE(index, window);
24811  else
24812   this.RefreshWindowContentUrlCommon(window);
24813 },
24814 RefreshContentUrl: function() {
24815  this.RefreshWindowContentUrl(null);
24816 },
24817 RefreshWindowContentUrlIE: function(index, window) {
24818  var windowVisible = this.InternalIsWindowVisible(index);
24819  if(windowVisible)
24820   this.RefreshWindowContentUrlIECore(index, window);
24821  else {
24822   var iframe = this.GetWindowContentIFrameElement(index);
24823   if(iframe)
24824    iframe.DXReloadAfterShowRequired = true;
24825  }
24826 },
24827 RefreshWindowContentUrlIECore: function(index, window) {
24828  try {
24829   if(!this.GetIframeLoading(index)) {
24830    var iframe = this.GetWindowContentIFrameElement(index);
24831    if(iframe)
24832     iframe.contentWindow.location.reload();
24833   }
24834  } catch (e) {
24835   this.RefreshWindowContentUrlCommon(window);
24836  }
24837 },
24838 RefreshWindowContentUrlCommon: function(window) {
24839  this.SetWindowContentUrl(window, this.GetWindowContentUrl(window));
24840 },
24841 GetContentUrl: function() {
24842  return this.GetWindowContentUrl(null);
24843 },
24844 GetWindowContentUrl: function(window) {
24845  var index = (window != null) ? window.index : -1;
24846  if(!this.IsWindowVisible(window))
24847   return this.GetWindowContentIFrameUrl(index);
24848  var element = this.GetWindowContentIFrameElement(index);
24849  return (element != null) ? element.src : "";
24850 },
24851 GetContentIFrame: function(window) {
24852  return this.GetWindowContentIFrame(null);
24853 },
24854 GetWindowContentIFrame: function(window) {
24855  var index = (window != null) ? window.index : -1;
24856  return this.GetWindowContentIFrameElement(index);
24857 },
24858 GetContentIFrameWindow: function() {
24859  var iframeElement = this.GetContentIFrame();
24860  return iframeElement.contentWindow;
24861 },
24862 SetContentUrl: function(url) {
24863  this.SetWindowContentUrl(null, url);
24864 },
24865 SetWindowContentUrl: function(window, url) {
24866  var index = (window != null) ? window.index : -1;
24867  this.SetWindowContentUrlInternal(index, url);
24868 },
24869 LoadWindowContentUrl: function(index) {
24870  var url = this.GetWindowContentIFrameUrl(index);
24871  this.LoadWindowContentFromUrl(index, url);
24872 },
24873 LoadWindowContentFromUrl: function(index, url) {
24874  var element = this.GetWindowContentIFrameElement(index);
24875  if(element && element.src != url && element.DXSrcRaw != url) {
24876   this.SetSrcToIframeElement(index, element, url);
24877   this.SetWindowContentIFrameUrl(index, element.src); 
24878  }
24879 },
24880 SetWindowContentIFrameUrl: function(index, url) {
24881  this.SetPropertyValue(index, "contentUrl", url);
24882 },
24883 SetWindowContentUrlInternal: function(index, url) {
24884  var element = this.GetWindowContentIFrameElement(index);
24885  var windowVisible = this.InternalIsWindowVisible(index);
24886  if(windowVisible && element != null)
24887   this.SetIframeVisibleForDragging(index, true);
24888  this.SetWindowContentIFrameUrl(index, url);
24889  var src = !windowVisible ? ASPx.SSLSecureBlankUrl : url;
24890  if(element == null) {
24891   this.CreateWindowContentIFrameElement(index, src);
24892   this.RefreshDimensionsAfterCreateIframe(index);
24893  }
24894  else
24895   this.SetSrcToIframeElement(index, element, src);
24896  this.ReinitScrollForIframe(index);
24897 },
24898 ReinitScrollForIframe: function(index) {
24899  if(this.HasIframeOnIos(index)) {
24900   var scrollElement = this.getTouchScrollerElement(index);
24901   if(scrollElement) {
24902    var options = this.GetWindowTouchScrollOptions(index);
24903    ASPx.TouchUIHelper.InitNativeScrolling(scrollElement, options);
24904    if(!!this.touchUIScrollers[index]) {
24905     this.touchUIScrollers[index].Destroy();
24906     this.touchUIScrollers[index] = null;
24907    }
24908   }
24909  }
24910 },
24911 EnsureWindowContentUrl: function(index) {
24912  var contentUrl = this.GetWindowContentIFrameUrl(index);
24913  if(contentUrl != "")
24914   this.SetWindowContentUrlInternal(index, contentUrl);
24915 },
24916 CreateWindowContentIFrameElement: function(index, src) {
24917  var content = this.GetContentContainer(index);
24918  var iframeParent = content;
24919  content.innerHTML = "";
24920  content.style.display = "block";
24921  var iframe = this.CreateContentIFrameElement(index, src);
24922  this.RequireIFrameHeightAdjusting(index, iframe);
24923  iframeParent.appendChild(iframe);
24924  this.InitIFrame(index);
24925  return iframe;
24926 },
24927 InitIFrame: function(index) {
24928  var contentIFrameElement = this.GetWindowContentIFrameElement(index);
24929  if(contentIFrameElement) {
24930   contentIFrameElement.popupControlName = this.name;
24931   contentIFrameElement.pcWndIndex = index;
24932   ASPx.Evt.AttachEventToElement(contentIFrameElement, "load", ASPx.PCIframeLoad);
24933  }
24934 },
24935 OnIFrameLoad: function(index) {
24936  this.SetIframeLoading(index, false);
24937 },
24938 RequireIFrameHeightAdjusting: function(index, iframe) {
24939  if(this.InternalIsWindowVisible(index))
24940   this.AdjustIFrameHeight(index, iframe);
24941  else
24942   this.PostponeIframeAdjusting(index);
24943 },
24944 PostponeIframeAdjusting: function(index) {
24945  this.SetIframeAdjustingPostponed(index, true);
24946 },
24947 EnsureIFrameHeightAdjusted: function(index) {
24948  if(this.GetIframeAdjustingPostponed(index)) {
24949   var iframe = this.GetWindowContentIFrameElement(index);
24950   this.AdjustIFrameHeight(index, iframe);
24951  }
24952 },
24953 AdjustIFrameHeight: function(index, iframe) {
24954 },
24955 CreateContentIFrameElement: function(index, src) {
24956  var iframe = document.createElement("IFRAME");
24957  iframe.id = this.GetWindowContentIFrameElementId(index);
24958  iframe.scrolling = "auto";
24959  iframe.frameBorder = 0;
24960  iframe.style.width = "100%";
24961  iframe.style.height = "100%";
24962  iframe.style.overflow = "auto";
24963  if(ASPx.Browser.Chrome) iframe.style.webkitBackfaceVisibility = "hidden";
24964  if(ASPx.Browser.IE || ASPx.Browser.Edge)
24965   iframe.style["-ms-user-select"] = "text";
24966  var titleText = this.GetWindowContentIFrameTitle(index);
24967  if(!!titleText)
24968   iframe.title = titleText;
24969  this.SetSrcToIframeElement(index, iframe, src);
24970  return iframe;
24971 },
24972 SetSrcToIframeElement: function(index, iframeElement, src) {
24973  this.SetIframeLoading(index, true);
24974  iframeElement.src = src;
24975  if(ASPx.Browser.Chrome && src.indexOf("#"))
24976   this.PreventScrollingAfterIframeLoaded(iframeElement);
24977  iframeElement.DXSrcRaw = src;
24978 },
24979 PreventScrollingAfterIframeLoaded: function(iframeElement) {
24980  var docScrollTop = ASPx.GetDocumentScrollTop();
24981  var onIframeLoadedHandler = function() {
24982   window.setTimeout(function() {
24983    ASPx.SetDocumentScrollTop(docScrollTop);
24984    ASPx.Evt.DetachEventFromElement(iframeElement, "load", onIframeLoadedHandler);
24985   }, 0);
24986  };
24987  ASPx.Evt.AttachEventToElement(iframeElement, "load", onIframeLoadedHandler);
24988 },
24989 GetWindowHeaderTextCell: function(index) {
24990  return this.GetWindowChild(index, "_PWH" + index + "T");
24991 },
24992 GetWindowHeaderTextElement: function(index) {
24993  var element = this.GetWindowHeaderTextCell(index);
24994  if(element != null) {
24995   var link = ASPx.GetNodeByTagName(element, "A", 0);
24996   return link || element;
24997  }
24998  return null;
24999 },
25000 GetWindowHeaderLinkElement: function(index) {
25001  var element = this.GetWindowHeaderElement(index);
25002  return element ? ASPx.GetNodeByClassName(element, PopupControlCssClasse
25002s.LinkCssClassName) : null;
25003 },
25004 GetWindowHeaderImageCell: function(index) {
25005  return this.GetWindowChild(index, "_PWH" + index + "I");
25006 },
25007 GetWindowFooterTextCell: function(index) {
25008  return this.GetWindowChild(index, "_PWF" + index + "T");
25009 },
25010 GetWindowFooterTextElement: function(index) {
25011  var element = this.GetWindowFooterTextCell(index);
25012  if(element != null) {
25013   var link = ASPx.GetNodeByTagName(element, "A", 0);
25014   return link || element;
25015  }
25016  return null;
25017 },
25018 GetWindowFooterLinkElement: function(index) {
25019  var element = this.GetWindowFooterElement(index);
25020  return element ? ASPx.GetNodeByClassName(element, PopupControlCssClasses.LinkCssClassName) : null;
25021 },
25022 GetWindowFooterImageCell: function(index) {
25023  return this.GetWindowChild(index, "_PWF" + index + "I");
25024 },
25025 GetWindowHeaderImageUrl: function(index) {
25026  var element = this.GetWindowHeaderImageCell(index);
25027  return element ? element.src : "";
25028 },
25029 SetWindowHeaderImageUrl: function(index, url) {
25030  var element = this.GetWindowHeaderImageCell(index);
25031  if(element != null) {
25032   element.onload = function() { this.CorrectHeaderContentElementHeight(index); }.aspxBind(this);
25033   element.src = url;
25034  }
25035 },
25036 GetWindowFooterImageUrl: function(index) {
25037  var element = this.GetWindowFooterImageCell(index);
25038  return element ? element.src : "";
25039 },
25040 SetWindowFooterImageUrl: function(index, url) {
25041  var element = this.GetWindowFooterImageCell(index);
25042  if(element != null) {
25043   element.src = url;
25044   this.CorrectWindowSizeGripPositionLite(index);
25045  }
25046 },
25047 GetWindowHeaderNavigateUrl: function(index) {
25048  var link = this.GetWindowHeaderLinkElement(index);
25049  if(link)
25050   return link.href || ASPx.Attr.GetAttribute(linkEl, "savedhref");
25051  return "";
25052 },
25053 SetWindowHeaderNavigateUrl: function(index, url) {
25054  var link = this.GetWindowHeaderLinkElement(index);
25055  if(link) {
25056   if(ASPx.Attr.IsExistsAttribute(link, "savedhref"))
25057    ASPx.Attr.SetAttribute(link, "savedhref", url);
25058   else if(ASPx.Attr.IsExistsAttribute(link, "href"))
25059    link.href = url;
25060  }
25061 },
25062 GetWindowFooterNavigateUrl: function(index) {
25063  var link = this.GetWindowFooterLinkElement(index);
25064  if(link)
25065   return link.href || ASPx.Attr.GetAttribute(linkEl, "savedhref");
25066  return "";
25067 },
25068 SetWindowFooterNavigateUrl: function(index, url) {
25069  var link = this.GetWindowFooterLinkElement(index);
25070  if(link) {
25071   if(ASPx.Attr.IsExistsAttribute(link, "savedhref"))
25072    ASPx.Attr.SetAttribute(link, "savedhref", url);
25073   else if (ASPx.Attr.IsExistsAttribute(link, "href"))
25074    link.href = url;
25075  }
25076 },
25077 GetWindowHeaderText: function(index) {
25078  var element = this.GetWindowHeaderTextElement(index);
25079  if(element != null) 
25080    return element.innerHTML;
25081  return "";
25082 },
25083 SetWindowHeaderText: function(index, text) {
25084  var element = this.GetWindowHeaderTextElement(index);
25085  if(element != null) {
25086   element.innerHTML = text;
25087   this.CorrectHeaderContentElementHeight(index);
25088   this.CorrectElementVerticalAlignment(ASPx.AdjustVerticalMarginsInContainer, this.GetWindowHeaderElement(index), true);
25089  }
25090 },
25091 GetWindowFooterText: function(index) {
25092  var element = this.GetWindowFooterTextElement(index);
25093  if(element != null) 
25094   return element.innerHTML;
25095  return "";
25096 },
25097 SetWindowFooterText: function(index, text) {
25098  var element = this.GetWindowFooterTextElement(index);
25099  if(element != null) {
25100   element.innerHTML = text;
25101   this.CorrectWindowSizeGripPositionLite(index);
25102  }
25103 },
25104 CorrectWindowSizeGripPositionLite: function(index) {
25105  var sizeGrip = this.GetWindowSizeGripElement(index);
25106  if(!sizeGrip || sizeGrip.corrected) return;
25107  sizeGrip.style[this.rtl ? "marginRight" : "marginLeft"] = "-" + sizeGrip.offsetWidth + "px";
25108  sizeGrip.style.marginTop = "-" + sizeGrip.offsetHeight + "px";
25109  sizeGrip.corrected = true;
25110 },
25111 GetHeaderFooterHeightCore: function(index) {
25112  var extenders = [
25113   this.GetWindowHeaderElement(index),
25114   this.GetWindowFooterElement(index)
25115  ], height = 0;
25116  for(var i = 0; i < extenders.length; i++) {
25117   if(extenders[i])
25118    height += extenders[i].offsetHeight;
25119  }
25120  return height;
25121 },
25122 GetHeaderImageUrl: function() {
25123  return this.GetWindowHeaderImageUrl(-1);
25124 },
25125 SetHeaderImageUrl: function(value) {
25126  this.SetWindowHeaderImageUrl(-1, value);
25127 },
25128 GetFooterImageUrl: function() {
25129  return this.GetWindowFooterImageUrl(-1);
25130 },
25131 SetFooterImageUrl: function(value) {
25132  this.SetWindowFooterImageUrl(-1, value);
25133 },
25134 GetHeaderNavigateUrl: function() {
25135  return this.GetWindowHeaderNavigateUrl(-1);
25136 },
25137 SetHeaderNavigateUrl: function(value) {
25138  this.SetWindowHeaderNavigateUrl(-1, value);
25139 },
25140 GetFooterNavigateUrl: function() {
25141  return this.GetWindowFooterNavigateUrl(-1);
25142 },
25143 SetFooterNavigateUrl: function(value) {
25144  this.SetWindowFooterNavigateUrl(-1, value);
25145 },
25146 GetHeaderText: function() {
25147  return this.GetWindowHeaderText(-1);
25148 },
25149 SetHeaderText: function(value) {
25150  this.SetWindowHeaderText(-1, value);
25151 },
25152 GetFooterText: function() {
25153  return this.GetWindowFooterText(-1);
25154 },
25155 SetFooterText: function(value) {
25156  this.SetWindowFooterText(-1, value);
25157 },
25158 GetVisible: function() {
25159  return this.IsVisible();
25160 },
25161 SetVisible: function(visible) {
25162  if(visible && !this.IsVisible())
25163   this.Show();
25164  else if(!visible && this.IsVisible())
25165   this.Hide();
25166 },
25167 GetStateHiddenFieldName: function() {
25168  return this.uniqueID + "State";
25169 },
25170 GetWindowCountCore: function() {
25171  return 0; 
25172 },
25173 IsWindowElementsIDAssigned: function(index) {
25174  var contentElement = this.GetWindowContentElement(index);
25175  return ASPx.IsExistsElement(contentElement);
25176 },
25177 InitializeDOM: function () {
25178  var windowElement = this.GetWindowElement(this.GetWindowCountCore() - 1);
25179  if(windowElement)
25180   windowElement.dxinit = true;
25181 },
25182 IsDOMInitialized: function() {
25183  var windowElement = this.GetWindowElement(this.GetWindowCountCore() - 1);
25184  return windowElement && windowElement.dxinit;
25185 },
25186 IsDOMDisposed: function() { 
25187  var windowElement = this.GetWindowElement(this.GetWindowCountCore() - 1);
25188  return !ASPx.IsExistsElement(windowElement);
25189 },
25190 OnDispose: function() {
25191  ASPxClientControl.prototype.OnDispose.call(this);
25192  this.ClearPopupElementConnection();
25193 },
25194 RegisterInControlTree: function(tree) {
25195  var mainNode = tree.createNode(null, this);
25196  if(this.HasDefaultWindow())
25197   this.RegisterRelatedNodeForWindowElement(tree, -1, mainNode);
25198  for(var i = 0; i < this.GetWindowCount() ; i++)
25199   this.RegisterRelatedNodeForWindowElement(tree, i, mainNode);
25200 },
25201 RegisterRelatedNodeForWindowElement: function(tree, windowElementIndex, mainNode) {
25202  var windowElement = this.GetWindowElement(windowElementIndex);
25203  if(windowElement) {
25204   var childNode = tree.createNode(windowElement.id, null);
25205   tree.addRelatedNode(mainNode, childNode);
25206  }
25207 },
25208 CorrectWindowHeaderText: function(index) {
25209  var headerElement = this.GetWindowHeaderElement(index);
25210  if(!headerElement || headerElement.corrected) return;
25211  var leftChildrenWidth = 0, rightChildrenWidth = 0, headerContentElement;
25212  for(var i = 0; i < headerElement.childNodes.length; i++) {
25213   var child = headerElement.childNodes[i];
25214   if(!child.offsetWidth) continue;
25215   if(ASPx.GetElementFloat(child) === "right")
25216    rightChildrenWidth += child.offsetWidth + ASPx.GetLeftRightMargins(child);
25217   else if(ASPx.GetElementFloat(child) === "left")
25218    leftChildrenWidth += child.offsetWidth + ASPx.GetLeftRightMargins(child);
25219   else if(!headerContentElement)
25220    headerContentElement = child;
25221  }
25222  if(headerContentElement && (leftChildrenWidth > 0 || rightChildrenWidth > 0)) {
25223   var headerContentElementStyle = ASPx.GetCurrentStyle(headerContentElement);
25224   var originalPaddingLeft = parseInt(headerContentElementStyle.paddingLeft);
25225   var originalPaddingRight = parseInt(headerContentElementStyle.paddingRight);
25226   ASPx.SetStyles(headerContentElement, {
25227    paddingLeft: leftChildrenWidth + originalPaddingLeft,
25228    paddingRight: rightChildrenWidth + originalPaddingRight
25229   }, true);
25230   this.CorrectHeaderContentElementHeight(index);
25231  }
25232  headerElement.corrected = true;
25233 },
25234 CorrectHeaderContentElementHeight: function(index) {
25235  var headerElement = this.GetWindowHeaderElement(index),
25236   headerContentElement = ASPx.GetChildByClassName(headerElement, PopupControlCssClasses.HeaderContentCssClassName);
25237  if(!headerElement || !headerContentElement) return;
25238  if(headerContentElement.style.height)
25239   headerContentElement.style.height = "";
25240  var contentElementHeight = ASPx.GetClearClientHeight(headerElement) - this.getTopBottomBordersAndPaddingsSummaryValue(headerContentElement),
25241   lineHeightForTextVerticalAlign = contentElementHeight,
25242   windowHeaderTextCell = this.GetWindowHeaderTextCell(index);
25243  if(windowHeaderTextCell)
25244   lineHeightForTextVerticalAlign -= this.getTopBottomBordersAndPaddingsSummaryValue(windowHeaderTextCell);
25245  ASPx.SetStyles(headerContentElement, { lineHeight: lineHeightForTextVerticalAlign, height: contentElementHeight }, false);
25246 },
25247 OnBeforeDropdownShow: function() {
25248  var element = this.GetWindowElement(-1);
25249  if(!ASPx.GetElementDisplay(element)) {
25250   element.style.visibility = "hidden";
25251  }
25252  this.SetWindowDisplay(-1, true);
25253 },
25254 SetWindowDisplay: function(index, value) {
25255  var pcwElement = this.GetWindowElement(index);
25256  ASPx.SetElementDisplay(pcwElement, value);
25257 },
25258 getWindowHorizontalAlign: function(element) {
25259  return this.popupHorizontalAlign;
25260 },
25261 getWindowVerticalAlign: function(element) {
25262  return this.popupVerticalAlign;
25263 },
25264 getWindowHorizontalOffset: function(element) {
25265  return this.popupHorizontalOffset;
25266 },
25267 getWindowVerticalOffset: function(element) {
25268  return this.popupVerticalOffset;
25269 },
25270 GetHorizontalAlign: function() {
25271  return this.popupHorizontalAlign;
25272 },
25273 GetVerticalAlign: function() {
25274  return this.popupVerticalAlign;
25275 },
25276 GetPopupHorizontalOffset: function() {
25277  return this.popupHorizontalOffset;
25278 },
25279 SetPopupHorizontalOffset: function(offset) {
25280  this.popupHorizontalOffset = offset;
25281 },
25282 SetPopupVerticalOffset: function(offset) {
25283  this.popupVerticalOffset = offset;
25284 },
25285 GetPopupVerticalOffset: function() {
25286  return this.popupVerticalOffset;
25287 },
25288 ShowAtElement: function(htmlElement) {
25289  this.ShowWindowAtElementByIndex(-1, htmlElement);
25290 },
25291 ShowAtElementByID: function(id) {
25292  var htmlElement = document.getElementById(id);
25293  this.ShowAtElement(htmlElement);
25294 },
25295 ShowWindowAtElementByIndex: function(index, htmlElement) {
25296  var lastIndexBackup = this.GetLastShownPopupElementIndex(index);
25297  this.ShowWindowByIndex(index, this.AddPopupElementInternal(index, htmlElement));
25298  this.RemovePopupElementInternal(index, htmlElement);
25299  this.SetLastShownPopupElementIndex(index, lastIndexBackup);
25300 },
25301 ShowWindowByIndex: function(index, popupElementIndex) {
25302  if(!this.isInitialized)
25303   return;
25304  if(popupElementIndex === undefined)
25305   popupElementIndex = this.GetLastShownPopupElementIndex(index);
25306  this.DoShowWindowCore(index, ASPx.InvalidPosition, ASPx.InvalidPosition, popupElementIndex, false, true);
25307 },
25308 DoShowWindowCore: function(index, x, y, popupElementIndex, closeOtherWindows, allowChangeZIndex, evt, closeOtherReason) {
25309 },
25310 DoShowWindow: function(index, popupElementIndex, evt) {
25311  if(!this.InternalIsWindowVisible(index)) {
25312   var x = ASPx.Evt.GetEventX(evt);
25313   var y = ASPx.Evt.GetEventY(evt);
25314   this.DoShowWindowCore(index, x, y, popupElementIndex, true, true, evt, ASPxClientPopupControlCloseReason.OuterMouseClick);
25315  }
25316 },
25317 SetWindowPos: function(index, element, x, y) {
25318  ASPx.SetStyles(element, { left: x, top: y });
25319  this.DoShowWindowIFrame(index, x, y, ASPx.InvalidDimension, ASPx.InvalidDimension);
25320  this.SetIsDragged(index, true);
25321  this.SetWindowLeft(index, ASPx.GetAbsoluteX(element));
25322  this.SetWindowTop(index, ASPx.GetAbsoluteY(element));
25323  this.UpdateWindowsStateCookie();
25324 },
25325 CorrectPopupPositionForClientWindow: function(element, popupPosition, isX) {
25326  if(element.isPopupPositionCorrectionOn && this.isPopupFullCorrectionOn || this.forceAdjustPositionToClientScreen) {
25327   popupPosition.position = ASPx.PopupUtils.AdjustPositionToClientScreen(element, popupPosition.position, this.rtl, isX);
25328  }
25329  return popupPosition;
25330 },
25331 GetClientPopupPos: function(element, popupElement, pos, isX, isDragged) {
25332  var index = this.GetWindowIndex(element);
25333  var popupPosition = null;
25334  if(this.GetIsMaximizedOnWebKitTouch(index))
25335   return new ASPx.PopupPosition(ASPx.PrepareClientPosForElement(0, element, isX), false);
25336  if(isDragged)
25337   popupPosition = new ASPx.PopupPosition(!this.IsValidPosition(pos) ? this.GetPosition(index, isX) : pos, false);
25338  else
25339   popupPosition = isX ? this.GetClientPopupPosX(element, popupElement, pos) : this.GetClientPopupPosY(element, popupElement, pos);
25340  popupPosition.position = ASPx.PrepareClientPosForElement(popupPosition.position, element, isX);
25341  if(ASPx.Browser.Firefox && ASPx.Browser.Version < 3 && this.GetWindowModalElement(index))
25342   popupPosition.position -= isX ? ASPx.GetDocumentScrollLeft() : ASPx.GetDocumentScrollTop();
25343  return popupPosition;
25344 },
25345 GetClientPopupPosX: function(element, popupElement, x) {
25346  var mainElement = this.GetWindowMainCell(element);
25347  var popupPosition = ASPx.PopupUtils.GetPopupAbsoluteX(mainElement, popupElement, this.getWindowHorizontalAlign(element), this.getWindowHorizontalOffset(element),
25348   x, this.GetWindowLeft(this.GetWindowIndex(element)), this.rtl, this.isPopupFullCorrectionOn);
25349  return this.CorrectPopupPositionForClientWindow(element, popupPosition, true);
25350 },
25351 GetClientPopupPosY: function(element, popupElement, y) {
25352  var mainElement = this.GetWindowMainCell(element);
25353  var popupPosition = ASPx.PopupUtils.GetPopupAbsoluteY(mainElement, popupElement, this.getWindowVerticalAlign(element), this.getWindowVerticalOffset(element),
25354   y, this.GetWindowTop(this.GetWindowIndex(element)), this.isPopupFullCorrectionOn, this.usedInDropDown);
25355  return this.usedInDropDown ? popupPosition : this.CorrectPopupPositionForClientWindow(element, popupPosition, false);
25356 },
25357 UpdateWindowPositionInternal: function(index, popupElement) {
25358  var positionUpdated = false,
25359   element = this.GetWindowElement(index);
25360  if(this.InternalIsWindowVisible(index) && element != null) {
25361   var horizontalPopupPosition = this.GetClientPopupPos(element, popupElement, ASPx.InvalidPosition, true, false);
25362   var verticalPopupPosition = this.GetClientPopupPos(element, popupElement, ASPx.InvalidPosition, false, false);
25363   this.SetWindowPos(index, element, horizontalPopupPosition.position, verticalPopupPosition.position);
25364   positionUpdated = true;
25365  }
25366  return positionUpdated;
25367 },
25368 UpdatePositionAtElement: function(popupElement) {
25369  this.UpdateWindowPositionAtElement(null, popupElement);
25370 },
25371 UpdateWindowPositionAtElement: function(window, popupElement) {
25372  var index = (window != null) ? window.index : -1;
25373  this.UpdateWindowPositionInternal(index, popupElement);
25374 },
25375 TryAutoUpdatePosition: function(index) {
25376  if(this.GetAutoUpdatePosition(index))
25377   this.UpdateWindowPositionInternal(index, this.GetPopupElement(index, this.GetLastShownPopupElementIndex(index)));
25378 },
25379 GetLastShownPopupElementIndex: function(windowIndex) {
25380  var info = this.GetLastUsedPopupElementInfo(windowIndex);
25381  return ASPx.GetDefinedValue(info.shownPEIndex, 0);
25382 },
25383 SetLastShownPopupElementIndex: function(windowIndex, popupElementIndex) {
25384  var info = this.GetLastUsedPopupElementInfo(windowIndex);
25385  info.shownPEIndex = popupElementIndex;
25386 },
25387 GetLastUsedPopupElementInfo: function(index) {
25388  if(0 <= index && index < this.GetWindowCountCore())
25389   return this.windowsLastUsedPopupElementInfoList[index];
25390  return this.defaultLastUsedPopupElementInfo;
25391 },
25392 GetPopupElement: function(index, popupElementIndex) {
25393  var popupElement = this.GetPopupElementList(index)[popupElementIndex];
25394  return popupElement ? popupElement : null;
25395 },
25396 GetPopupElementList: function(index) {
25397  if(0 <= index && index < this.GetWindowCountCore())
25398   return this.windowsPopupElementList[index];
25399  return this.defaultWindowPopupElementList;
25400 },
25401 PopulatePopupElementsByIds: function(index) {
25402  var ids = this.GetPopupElementIDList(index);
25403  for(var i = 0; i < ids.length; i++) {
25404   var popupElement = ASPx.PopupUtils.FindPopupElementById(ids[i]);
25405   if(popupElement)
25406    this.AddWindowPopupElement(index, popupElement);
25407  }
25408 },
25409 PopulatePopupElements: function(index) {
25410  this.PopulatePopupElementsByIds(index);
25411 },
25412 SetPopupElementIDByIndex: function(index, popupElementId) {
25413  this.RemoveWindowAllPopupElements(index);
25414  this.SetPopupElementIDs(index, popupElementId.split(';'));
25415  if(aspxGetPopupControlCollection().IsDisappearTimerActive()) {
25416   aspxGetPopupControlCollection().ClearDisappearTimer();
25417   this.Hide(index);
25418  }
25419  this.PopulatePopupElements(index);
25420 },
25421 RefreshPopupElementConnection: function() {
25422  this.ClearPopupElementConnection();
25423  var index = this.HasDefaultWindow() ? -1 : 0;
25424  for(; index < this.GetWindowCount(); index++)
25425   this.PopulatePopupElements(index);
25426 },
25427 ClearPopupElementConnection: function() {
25428  var index = this.HasDefaultWindow() ? -1 : 0;
25429  for(; index < this.GetWindowCount(); index++)
25430   this.RemoveWindowAllPopupElements(index);
25431 },
25432 GetPopupElementIDList: function(index) {
25433  if(0 <= index && index < this.GetWindowCountCore())
25434   return this.windowsPopupElementIDList[index];
25435  return this.defaultWindowPopupElementIDList;
25436 },
25437 SetPopupElementIDs: function(index, ids) {
25438  if(0 <= index && index < this.GetWindowCountCore())
25439   this.windowsPopupElementIDList[index] = ids;
25440  this.defaultWindowPopupElementIDList = ids;
25441 },
25442 AddPopupElementInternal: function(index, element) {
25443  var popupElements = this.GetPopupElementList(index);
25444  for(var i = 0; i < popupElements.length; i++) {
25445   if(!popupElements[i]) {
25446    popupElements[i] = element;
25447    return i;
25448   }
25449  }
25450  popupElements.push(element);
25451  return popupElements.length - 1;
25452 },
25453 RemovePopupElementInternal: function(index, element) {
25454  var popupElements = this.GetPopupElementList(index);
25455  for(var i = 0; i < popupElements.length; i++) {
25456   if(popupElements[i] == element) {
25457    popupElements[i] = null;
25458    return;
25459   }
25460  }
25461 },
25462 AddPopupElement: function(popupElement) {
25463  this.AddWindowPopupElement(-1, popupElement);
25464 },
25465 AddWindowPopupElement: function(index, popupElement) {
25466  var popupElementIndex = this.AddPopupElementInternal(index, popupElement);
25467  this.SetPopupElementReference(index, popupElement, popupElementIndex, true);
25468 },
25469 RemovePopupElement: function(popupElement) {
25470  this.RemoveWindowPopupElement(-1, popupElement);
25471 },
25472 RemoveWindowPopupElement: function(index, popupElement) {
25473  this.RemovePopupElementInternal(index, popupElement);
25474  this.SetPopupElementReference(index, popupElement, null, false);
25475 },
25476 SetPopupElementReference: function(index, popupElement, popupElementIndex, attach) {
25477  if(!ASPx.IsExistsElement(popupElement)) return;
25478  var setReferenceFunction = attach ? ASPx.Evt.AttachEventToElement : ASPx.Evt.DetachEventFromElement;
25479  var setContextMenuReferenceFunction = attach ? ASPx.Evt.AttachContextMenuToElement : ASPx.Evt.DetachContextMenuFromElement;
25480  var windowPopupAction = this.GetWindowPopupAction(index);
25481  if(windowPopupAction == "LeftMouseClick")
25482   setReferenceFunction(popupElement, "mouseup", aspxPEMEvent);
25483  else if(windowPopupAction == "RightMouseClick")
25484   setContextMenuReferenceFunction(popupElement, aspxPEMEvent);
25485  else if(windowPopupAction == "MouseOver") {
25486   var windowElement = this.GetWindowElement(index);
25487   setReferenceFunction(popupElement, "mouseover", ASPx.PopupUtils.OverControl.OnMouseOver);
25488   setReferenceFunction(windowElement, "mouseover", aspxPWEMOver);
25489   if(attach)
25490    this.SetMSTouchMouseOverReference(popupElement, windowElement, this.name, index, this.appearAfter);
25491  }
25492  if(windowPopupAction == "LeftMouseClick" || windowPopupAction == "RightMouseClick") {
25493   setReferenceFunction(popupElement, "mousedown", aspxPEMEvent);
25494  }
25495  if(attach) {
25496   popupElement.DXPopupElementControl = this;
25497   popupElement.DXPopupWindowIndex = index;
25498   popupElement.DXPopupElementIndex = popupElementIndex;
25499  } else
25500   popupElement.DXPopupElementControl = popupElement.DXPopupWindowIndex = popupElement.DXPopupElementIndex = undefined;
25501 },
25502 SetMSTouchMouseOverReference: function(popupElement, windowElement, popupName, index, appearAfter) {
25503  if(!ASPx.TouchUIHelper.pointerEnabled) return;
25504  popupElement.dxMsTouchGesture = popupElement.dxMsTouchGesture ||
25505   ASPx.TouchUIHelper.msTouchCreateGesturesWrapper(popupElement, function(evt) {
25506    window.setTimeout(function() {
25507     aspxGetPopupControlCollection().SetAppearTimer(popupName, index, popupElement.DXPopupElementIndex, appearAfter, evt);
25508    }, 0);
25509   });
25510  windowElement.dxMsTouchGesture = windowElement.dxMsTouchGesture || ASPx.TouchUIHelper.msTouchCreateGesturesWrapper(windowElement, function(evt) {
25511   window.setTimeout(function() {
25512    aspxGetPopupControlCollection().ClearDisappearTimer();
25513   }, 0);
25514  });
25515 },
25516 GetLastOverPopupElementIndex: function(windowIndex) {
25517  var info = this.GetLastUsedPopupElementInfo(windowIndex);
25518  return ASPx.GetDefinedValue(info.overPEIndex, -1);
25519 },
25520 SetLastOverPopupElementIndex: function(windowIndex, popupElementIndex) {
25521  var info = this.GetLastUsedPopupElementInfo(windowIndex);
25522  info.overPEIndex = popupElementIndex;
25523 },
25524 OnPopupElementMouseOver: function(evt, popupElement) {
25525  if(popupElement != null) {
25526   var index = popupElement.DXPopupWindowIndex;
25527   var isVisible = this.InternalIsWindowVisible(index);
25528   var popupElementIndex = popupElement.DXPopupElementIndex;
25529   if(this.GetLastOverPopupElementIndex(index) != popupElementIndex) {
25530    if(aspxGetPopupControlCollection().IsAppearTimerActive())
25531     aspxGetPopupControlCollection().ClearAppearTimer();
25532    if(aspxGetPopupControlCollection().IsDisappearTimerActive())
25533     aspxGetPopupControlCollection().ClearDisappearTimer();
25534    if(isVisible) {
25535     this.DoHideWindow(index, false, ASPxClientPopupControlCloseReason.MouseOut);
25536     isVisible = false;
25537    }
25538   }
25539   if(!isVisible) {
25540    aspxGetPopupControlCollection().SetAppearTimer(this.name, index, popupElement.DXPopupElementIndex, this.appearAfter, evt);
25541    aspxGetPopupControlCollection().InitOverObject(this, index, evt);
25542   }
25543   this.SetLastOverPopupElementIndex(index, popupElementIndex);
25544  }
25545 },
25546 OnPopupElementMouseOut: function(evt, popupElement) {
25547 },
25548 RemoveAllPopupElements: function() {
25549  this.RemoveWindowAllPopupElements(-1);
25550 },
25551 RemoveWindowAllPopupElements: function(index) {
25552  var popupElements = this.GetPopupElementList(index);
25553  for(var i = 0; i < popupElements.length; i++)
25554   this.RemoveWindowPopupElement(index, popupElements[i]);
25555 },
25556 GetWindowCurrentPopupElementByIndex: function(index) {
25557  var popupElement = this.GetPopupElement(index, this.GetLastShownPopupElementIndex(index));
25558  if(popupElement && popupElement.DXPopupElementControl)
25559   return popupElement;
25560  return null;
25561 },
25562 GetWindowCurrentPopupElementIndexByWindowIndex: function(windowIndex) {
25563  var popupElement = this.GetWindowCurrentPopupElementByIndex(windowIndex);
25564  return popupElement ? popupElement.DXPopupElementIndex : -1;
25565 },
25566 GetIsMaximizedOnWebKitTouch: function(index) {
25567  return false;
25568 },
25569 ProcessAccessibleElementOnHide: function() {
25570  if(this.accessibilityCompliant) {
25571   var focusElement = this.accessibleFocusElement ? this.accessibleFocusElement : this.GetCurrentPopupElement();
25572   ASPx.AccessibilityUtils.SetFocusAccessibleCore(focusElement);
25573   this.accessibleFocusElement = null;
25574  }
25575 },
25576 OnControlsInitialized: function() {
25577  this.InitializeAccessibleNavigationCore();
25578  setTimeout(function() {
25579   ASPx.GetControlCollection().ControlsInitialized.RemoveHandler(this.OnControlsInitialized, this);
25580  }.aspxBind(this), 0);
25581 },
25582 InitializeAccessibleNavigation: function() {
25583  this.Shown.AddHandler(this.InitializeAccessibleNavigationCore.aspxBind(this));
25584 },
25585 InitializeAccessibleNavigationCore: function() {
25586  this.resetFocusableElements();
25587  var focusableElement = this.getFirstFocusableElement();
25588  if(focusableElement) {
25589   var currentWindowContentCell = this.GetWindowContentElement(-1);
25590   var contentFirstActionElement = ASPx.FindFirstChildActionElement(currentWindowContentCell);
25591   if(contentFirstActionElement && contentFirstActionElement !== focusableElement)
25592    focusableElement = contentFirstActionElement;
25593   ASPx.AccessibilityUtils.SetFocusAccessible(focusableElement);
25594   this.SetLoopingFocusHandlers();
25595  }
25596 },
25597 resetFocusableElements: function() {
25598  if(this.firstFocusableElement)
25599   ASPx.Evt.DetachEventFromElement(this.firstFocusableElement, "keydown", this.focusLastElementHandler);
25600  if(this.lastFocusableElement)
25601   ASPx.Evt.DetachEventFromElement(this.lastFocusableElement, "keydown", this.focusFirstElementHandler);
25602  this.firstFocusableElement = null;
25603  this.lastFocusableElement = null;
25604 },
25605 getFirstFocusableElement: function() {
25606  if(!this.firstFocusableElement)
25607   this.firstFocusableElement = ASPx.FindFirstChildActionElement(this.GetCurrentWindowElement());
25608  return this.firstFocusableElement;
25609 },
25610 getLastFocusableElement: function() {
25611  if(!this.lastFocusableElement)
25612   this.lastFocusableElement = ASPx.FindLastChildActionElement(this.GetCurrentWindowElement());
25613  return this.lastFocusableElement;
25614 },
25615 SetLoopingFocusHandlers: function() {
25616  ASPx.Evt.AttachEventToElement(this.getFirstFocusableElement(), "ke
25616ydown", this.focusLastElementHandler);
25617  ASPx.Evt.AttachEventToElement(this.getLastFocusableElement(), "keydown", this.focusFirstElementHandler);
25618 },
25619 loopFocusHandler: function(evt, isLastFocusableElement) {
25620  var keyCode = ASPx.Evt.GetKeyCode(evt);
25621  if(keyCode !== ASPx.Key.Tab)
25622   return;
25623  var elementToFocus = null;
25624  if(!isLastFocusableElement && evt.shiftKey)
25625   elementToFocus = this.getLastFocusableElement();
25626  else if(isLastFocusableElement && !evt.shiftKey)
25627   elementToFocus = this.getFirstFocusableElement();
25628  if(elementToFocus) {
25629   ASPx.AccessibilityUtils.SetFocusAccessible(elementToFocus);
25630   ASPx.Evt.PreventEventAndBubble(evt);
25631  }
25632 },
25633 getLeftRightBordersAndPaddingsSummaryValue: function(element, currentStyle) {
25634  return ASPx.GetLeftRightBordersAndPaddingsSummaryValue(element, currentStyle);
25635 },
25636 getTopBottomBordersAndPaddingsSummaryValue: function(element, currentStyle) {
25637  return ASPx.GetTopBottomBordersAndPaddingsSummaryValue(element, currentStyle);
25638 },
25639 AdjustModalElementBounds: function(element) {
25640 },
25641 RefreshDimensionsAfterCreateIframe: function(index) {
25642 },
25643 UpdatePositionAfterCallback: function(windowIndex) {
25644 }
25645});
25646ASPxClientPopupControlBase.AnimationType = {
25647 Fade: "fade",
25648 Slide: "slide",
25649 Auto: "auto",
25650 None: "none"
25651};
25652var ASPxClientPopupControl = ASPx.CreateClass(ASPxClientPopupControlBase, {
25653 constructor: function(name) {
25654  this.constructor.prototype.constructor.call(this, name);
25655  this.popupActionArray = [];
25656  this.windowsPopupElementIDList = [];
25657  this.windowsPopupElementList = [];
25658  this.windowsLastUsedPopupElementInfoList = [];
25659  this.windowsIsPopupedList = [];
25660  this.windowsPopupReasonMouseEventList = [];
25661  this.defaultPopupReasonMouseEvent = null;
25662  this.modal = false;
25663  this.modalArray = [];
25664  this.isDraggedArray = [];
25665  this.closeActionArray = [];
25666  this.showOnPageLoadArray = [];
25667  this.windows = [];
25668  this.windowCount = 0;
25669  this.closeOnEscapeArray = [];
25670  this.leftArray = [];
25671  this.contentUrlArray = [];
25672  this.contentUrlIFrameTitleArray = [];
25673  this.iframeLoadingArray = [];
25674  this.iframeAdjustingPostponedArray = [];
25675  this.isResizedArray = [];
25676  this.zIndexArray = [];
25677  this.topArray = [];
25678  this.shownArray = [];
25679  this.heightArray = [];
25680  this.widthArray = [];
25681  this.widthFromServer = false;
25682  this.widthFromServerArray = [];
25683  this.minHeightArray = [];
25684  this.minWidthArray = [];
25685  this.maxHeightArray = [];
25686  this.maxWidthArray = [];
25687  this.hideBodyScrollWhenModal = true;
25688  this.hideBodyScrollWhenModalArray = [];
25689  this.hideBodyScrollWhenMaximized = true;
25690  this.canScrollViewPort = false;
25691  this.canScrollViewPortArray = [];
25692  this.autoUpdatePositionArray = [];
25693  this.cachedSizeArray = [];
25694  this.enableContentScrollingArray = [];
25695  this.contentOverflowXArray = [];
25696  this.contentOverflowYArray = [];
25697  this.isPinned = false;
25698  this.isPinnedArray = [];
25699  this.pinX = 0;
25700  this.pinXArray = [];
25701  this.pinY = 0;
25702  this.pinYArray = [];
25703  this.lockScroll = 0;
25704  this.isCollapsed = false;
25705  this.isCollapsedArray = [];
25706  this.isCollapsedInit = false;
25707  this.isCollapsedInitArray = [];
25708  this.collapseExecutingLockCount = 0;
25709  this.isMaximized = false;
25710  this.isMaximizedArray = [];
25711  this.isMaximizedInit = false;
25712  this.isMaximizedInitArray = [];
25713  this.maximizationExecutingLockCount = 0;
25714  this.restoredWindowValues = {};
25715  this.restoredWindowValuesArray = [];
25716  this.browserResizingForMaxWindowLockCount = 0;
25717  this.updateRestoredWindowSizeLockCount = 0;
25718  this.touchUIScrollers = {};
25719  this.adaptivityEnabled = false;
25720  this.DefaultModalMaxWidth = 500;
25721  this.DefaultModalMinWidth = 0;
25722  this.stretchVertically = false;
25723  this.stretchVerticallyArray = [];
25724  this.fixedHeader = true;
25725  this.fixedHeaderArray = [];
25726  this.fixedFooter = true;
25727  this.fixedFooterArray = [];
25728  this.modalMinHeight = null;
25729  this.modalMinHeightArray = [];
25730  this.modalMinWidth = null;
25731  this.modalMinWidthArray = [];
25732  this.modalMaxHeight = null;
25733  this.modalMaxHeightArray = [];
25734  this.modalMaxWidth = null;
25735  this.modalMaxWidthArray = [];
25736  this.modalVerticalAlign = ModalAlign.WindowTop;
25737  this.modalHorizontalAlign = ModalAlign.WindowCenter;
25738  this.adaptiveModalMode = false;
25739  this.adaptiveModalModeArray = [];
25740  this.switchAtWindowInnerWidth = ASPx.MaxMobileWindowWidth;
25741  this.PinnedChanged = new ASPxClientEvent();
25742 },
25743 SetData: function(data){
25744  if(data.windows)
25745   this.CreateWindows(data.windows);
25746 },
25747 InlineInitialize: function() {
25748  ASPxClientControl.prototype.InlineInitialize.call(this);
25749  this.InitializeArrayCores();
25750 },
25751 Initialize: function() {
25752  ASPxClientPopupControlBase.prototype.Initialize.call(this);
25753  aspxGetPopupControlCollection().EnsureSaveScrollState();
25754  if(this.HasDefaultWindow())
25755   this.InitializeWindow(-1);
25756  for(var i = 0; i < this.GetWindowCount() ; i++)
25757   this.InitializeWindow(i);
25758  this.InitializeScrollbars();
25759 },
25760 InitializeEnableContentScrolling: function() {
25761  for(var windowIndex = 0; windowIndex < this.GetWindowCount() ; windowIndex++) {
25762   var contentOverflowX = this.GetWindowOverflowX(windowIndex);
25763   var contentOverflowY = this.GetWindowOverflowY(windowIndex);
25764   this.enableContentScrollingArray.push(contentOverflowX != "None" || contentOverflowY != "None");
25765  }
25766  ASPxClientPopupControlBase.prototype.InitializeEnableContentScrolling.call(this);
25767 },
25768 InitializeScrollbars: function() {
25769  if(!ASPx.Browser.WebKitTouchUI && !ASPx.Browser.MSTouchUI && (!ASPx.Browser.WindowsPhonePlatform || !ASPx.Browser.IE))
25770   return;
25771  this.ForEachWindow(function(windowIndex) {
25772   if(this.GetEnableContentScrolling(windowIndex)) {
25773    var scrollElement = this.getTouchScrollerElement(windowIndex);
25774    if(scrollElement) {
25775     if(ASPx.Browser.MSTouchUI)
25776      scrollElement.style.touchAction = "auto";
25777     else {
25778      var options = this.GetWindowTouchScrollOptions(windowIndex);
25779      if(!this.HasIframeOnIos(windowIndex))
25780       this.touchUIScrollers[windowIndex] = ASPx.TouchUIHelper.MakeScrollable(scrollElement, options);
25781     }
25782    }
25783   }
25784  }.aspxBind(this));
25785 },
25786 GetWindowTouchScrollOptions: function (index) {
25787  var contentOverflowX = this.GetWindowOverflowX(index),
25788   contentOverflowY = this.GetWindowOverflowY(index);
25789  return {
25790   showHorizontalScrollbar: contentOverflowX === "Auto" || contentOverflowX === "Scroll",
25791   showVerticalScrollbar: contentOverflowY === "Auto" || contentOverflowY === "Scroll"
25792  };
25793 },
25794 ForEachWindow: function(callback) {
25795  var indices = [];
25796  if(this.HasDefaultWindow())
25797   indices.push(-1);
25798  else {
25799   for(var i = 0; i < this.GetWindowCount(); i++)
25800    indices.push(i);
25801  }
25802  ASPx.Data.ForEach(indices, callback);
25803 },
25804 GetMainElementId: function() {
25805  return null;
25806 },
25807 preventParentOverlowOnIos: function(index) {
25808  if(!ASPx.Browser.MacOSMobilePlatform) return;
25809  var parent = this.getParentPopupControl(index);
25810  if(parent) 
25811   parent.popupControl.changeContentOverflow(parent.windowIndex);
25812 },
25813 restoreParentOverflowOnIos: function(index) {
25814  if(!ASPx.Browser.MacOSMobilePlatform) return;
25815  var parent = this.getParentPopupControl(index);
25816  if(parent) 
25817   parent.popupControl.restoreContentOverflow(parent.windowIndex);
25818 },
25819 changeContentOverflow: function(index) {
25820  var scrollerElement = this.getTouchScrollerElement(index);
25821  if(!scrollerElement) return;
25822  ASPx.Attr.ChangeStyleAttribute(scrollerElement, "overflow", "visible");
25823  ASPx.Attr.ChangeStyleAttribute(scrollerElement, "overflowX", "visible");
25824  ASPx.Attr.ChangeStyleAttribute(scrollerElement, "overflowY", "visible");
25825 },
25826 restoreContentOverflow: function(index) {
25827  var scrollerElement = this.getTouchScrollerElement(index);
25828  if(!scrollerElement) return;
25829  ASPx.Attr.RestoreStyleAttribute(scrollerElement, "overflow");
25830  ASPx.Attr.RestoreStyleAttribute(scrollerElement, "overflowX");
25831  ASPx.Attr.RestoreStyleAttribute(scrollerElement, "overflowY");
25832 },
25833 UpdateScrollbar: function(index) {
25834  var touchUIScroller = this.touchUIScrollers[index];
25835  if(!touchUIScroller)
25836   return;
25837  var scrollElement = this.GetContentContainer(index);
25838  if(scrollElement)
25839   touchUIScroller.ChangeElement(scrollElement);
25840 },
25841 InitializeArrayCores: function() {
25842  if(this.GetWindowCountCore() > 0) {
25843   this.InitializeWindowPopupElementList();
25844   this.InitializeWindowPopupElementIDList();
25845   this.InitializeWindowLastUsedPopupElementInfoList();
25846   this.InitializeArray(this.shownArray);
25847   this.InitializeArray(this.windowsPopupReasonMouseEventList, null);
25848   this.InitializeArray(this.windowsIsPopupedList, false);
25849   this.InitializeArray(this.contentUrlArray, "");
25850   this.InitializeArray(this.contentUrlIFrameTitleArray, "");
25851   this.InitializeArray(this.popupActionArray, this.popupAction);
25852   this.InitializeArray(this.closeActionArray, this.closeAction);
25853   this.InitializeArray(this.showOnPageLoadArray, false);
25854   this.InitializeArray(this.isDraggedArray, false);
25855   this.InitializeArray(this.isPinnedArray, false);
25856   this.InitializeArray(this.isCollapsedArray, false);
25857   this.InitializeArray(this.isCollapsedInitArray, false);
25858   this.InitializeArray(this.isMaximizedArray, false);
25859   this.InitializeArray(this.isMaximizedInitArray, false);
25860   this.InitializeArray(this.restoredWindowValuesArray, {});
25861   this.InitializeArray(this.iframeAdjustingPostponedArray, {});
25862   this.InitializeArray(this.isResizedArray, false);
25863   this.InitializeArray(this.zIndexArray, -1);
25864   this.InitializeArray(this.leftArray, 0);
25865   this.InitializeArray(this.topArray, 0);
25866   this.InitializeArray(this.widthArray, constants.DEFAULT_WINDOW_WIDTH);
25867   this.InitializeArray(this.heightArray, constants.DEFAULT_WINDOW_HEIGHT);
25868   this.InitializeArray(this.widthFromServerArray, false);
25869   this.InitializeArray(this.pinXArray, 0);
25870   this.InitializeArray(this.pinYArray, 0);
25871   this.InitializeArray(this.minWidthArray, null);
25872   this.InitializeArray(this.minHeightArray, null);
25873   this.InitializeArray(this.maxWidthArray, null);
25874   this.InitializeArray(this.maxHeightArray, null);
25875   this.InitializeArray(this.cachedSizeArray, null);
25876   this.InitializeArray(this.iframeLoadingArray, false);
25877   this.InitializeArray(this.autoUpdatePositionArray, false);
25878   this.InitializeArray(this.hideBodyScrollWhenModalArray, true);
25879   this.InitializeArray(this.canScrollViewPortArray, false);
25880   this.InitializeArray(this.closeOnEscapeArray, this.closeOnEscape);
25881   this.InitializeArray(this.modalArray, false);
25882   this.InitializeArray(this.adaptiveModalModeArray, false);
25883   this.InitializeArray(this.fixedHeaderArray, true);
25884   this.InitializeArray(this.fixedFooterArray, true);
25885   this.InitializeArray(this.modalMinWidthArray, null);
25886   this.InitializeArray(this.modalMinHeightArray, null);
25887   this.InitializeArray(this.modalMaxWidthArray, null);
25888   this.InitializeArray(this.modalMaxHeightArray, null);
25889   this.InitializeArray(this.stretchVerticallyArray, false);
25890  }
25891 },
25892 InitializeArray: function(array, defaultValue) {
25893  if(array.length == 0) {
25894   for(var i = 0; i < this.GetWindowCountCore() ; i++)
25895    array[i] = defaultValue;
25896  }
25897 },
25898 InitializeWindowPopupElementIDList: function() {
25899  for(var i = 0; i < this.GetWindowCountCore() ; i++) {
25900   if(!this.windowsPopupElementIDList[i])
25901    this.windowsPopupElementIDList[i] = [];
25902  }
25903 },
25904 InitializeWindowPopupElementList: function() {
25905  for(var i = 0; i < this.GetWindowCountCore() ; i++) {
25906   if(!this.windowsPopupElementList[i])
25907    this.windowsPopupElementList[i] = [];
25908  }
25909 },
25910 InitializeWindowLastUsedPopupElementInfoList: function() {
25911  for(var i = 0; i < this.GetWindowCountCore() ; i++) {
25912   if(!this.windowsLastUsedPopupElementInfoList[i])
25913    this.windowsLastUsedPopupElementInfoList[i] = {};
25914  }
25915 },
25916 AllowMouseDown: function(evt, index) {
25917  return ASPxClientPopupControlBase.prototype.AllowMouseDown.call(this, evt, index) &&
25918   !this.PreventHeaderButtonMouseDownBubbling(evt, this.GetWindowPinButton(index)) &&
25919   !this.PreventHeaderButtonMouseDownBubbling(evt, this.GetWindowCollapseButton(index)) &&
25920   !this.PreventHeaderButtonMouseDownBubbling(evt, this.GetWindowMaximizeButton(index));
25921 },
25922 AssignHeaderButtonsEvents: function(index) {
25923  ASPxClientPopupControlBase.prototype.AssignHeaderButtonsEvents.call(this, index);
25924  this.AttachClickToHeaderButton(index, this.GetWindowPinButton(index), "ASPx.PWPBClick");
25925  this.AttachClickToHeaderButton(index, this.GetWindowCollapseButton(index), "ASPx.PWMNBClick");
25926  this.AttachClickToHeaderButton(index, this.GetWindowMaximizeButton(index), "ASPx.PWMXBClick");
25927 },
25928 InitializeWindow: function(index) {
25929  ASPxClientPopupControlBase.prototype.InitializeWindow.call(this, index);
25930  if(this.adaptivityEnabled) {
25931   ASPx.Evt.AttachEventToElement(this.GetModalWrapperElement(index), "scroll", function(e) { this.OnModalWrapperScroll(e, index); }.aspxBind(this));
25932   if(ASPx.Browser.WebKitTouchUI) {
25933    ASPx.Evt.AttachEventToElement(this.GetModalWrapperElement(index), "touchstart", function(e) { this.OnModalWrapperTouchStart(e); }.aspxBind(this));
25934    ASPx.Evt.AttachEventToElement(this.GetModalWrapperElement(index), "touchmove", function(e) { this.OnModalWrapperTouchMove(e, index); }.aspxBind(this));
25935   }
25936  } else {
25937   var modalElement = this.GetWindowModalElement(index);
25938   if(modalElement)
25939    ASPx.Evt.AttachEventToElement(modalElement, "mousedown", aspxPWMEMDown);
25940  }
25941 },
25942 BrowserWindowResizeSubscriber: function() {
25943  return true;
25944 },
25945 OnBrowserWindowResize: function(e) {
25946  window.setTimeout(this.SetPopupMaximizedPositionOnBrowserResize.aspxBind(this), 0);
25947  this.ForEachWindow(this.updateContentScrollIfNeeded.aspxBind(this));
25948 },
25949 SetPopupMaximizedPositionOnBrowserResize: function() {
25950  this.ForEachWindow(this.SetMaximizedPositionOnBrowserResize.aspxBind(this));
25951 },
25952 UpdateResizeCursor: function(index, element, verticalDirection, horizontalDirection) {
25953  if(this.GetAdaptiveModalMode(index))
25954   this.HideTemporaryCursor(element);
25955  else
25956   ASPxClientPopupControlBase.prototype.UpdateResizeCursor.call(this, index, element, verticalDirection, horizontalDirection);
25957 },
25958 SetMaximizedPositionOnBrowserResize: function(index) {
25959  var element = this.GetWindowElement(index);
25960  if(element && this.GetIsMaximized(index) && this.InternalIsWindowVisible(index)) {
25961   var left = this.GetMaximizedPosition(element, true);
25962   var top = this.GetMaximizedPosition(element, false);
25963   this.SetWindowPos(index, element, left, top);
25964  }
25965 },
25966 InitCollapsedWindows: function(index) {
25967  if((this.isCollapsedInit && index == -1) || (index >= 0 && index < this.isCollapsedInitArray.length && this.isCollapsedInitArray[index])) {
25968   if(this.InternalIsWindowVisible(index)) {
25969    this.DoCollapse(index, true);
25970    if(index == -1)
25971     this.isCollapsedInit = false;
25972    else
25973     this.isCollapsedInitArray[index] = false;
25974   }
25975  }
25976 },
25977 InitMaximizedWindows: function(index) {
25978  if(this.GetIsMaximizedInit(index) && this.InternalIsWindowVisible(index)) {
25979   this.DoMaximize(index, true);
25980   this.SetIsMaximizedInit(index, false);
25981  }
25982 },
25983 InitPinnedWindows: function(index) {
25984  if((this.isPinned && index == -1) || (index >= 0 && index < this.isPinnedArray.length && this.isPinnedArray[index]))
25985   this.HoldPosition(index, true);
25986 },
25987 AfterInitializeWindow: function(index) {
25988  if(this.contentOverflowX !== "None" && !this.GetWindowWidthFromServer(index))
25989   this.SetWindowWidth(index, 0);
25990  ASPxClientPopupControlBase.prototype.AfterInitializeWindow.call(this, index);
25991  this.InitPinnedWindows(index);
25992  this.InitMaximizedWindows(index);
25993  this.InitCollapsedWindows(index);
25994 },
25995 OnDragStop: function(index) {
25996  ASPxClientPopupControlBase.prototype.OnDragStop.call(this, index);
25997  if(this.adaptivityEnabled)
25998   ASPxClientPopupControl.WindowResizeHelper.Initialize(this.GetWindowElement(index));
25999  else
26000   this.updateContentScrollIfNeeded(index);
26001 },
26002 GetPropertyValue: function(index, propName) {
26003  if(0 <= index && index < this.GetWindowCountCore())
26004   return this[propName + "Array"][index];
26005  return ASPxClientPopupControlBase.prototype.GetPropertyValue.call(this, index, propName);
26006 },
26007 SetPropertyValue: function(index, propName, value) {
26008  if(0 <= index && index < this.GetWindowCountCore())
26009   this[propName + "Array"][index] = value;
26010  else
26011   ASPxClientPopupControlBase.prototype.SetPropertyValue.call(this, index, propName, value);
26012 },
26013 GetAdaptiveModalMode: function(index) {
26014  return this.GetPropertyValue(index, "adaptiveModalMode");
26015 },
26016 GetAutoUpdatePosition: function(index) {
26017  return this.GetPropertyValue(index, "autoUpdatePosition") && !this.GetAdaptiveModalMode(index);
26018 },
26019 SetAdaptiveModalMode: function(index, value) {
26020  var func = value ? ASPx.AddClassNameToElement : ASPx.RemoveClassNameFromElement;
26021  func(this.GetModalWrapperElement(index), this.GetModalSystemCssClass());
26022  this.SetPropertyValue(index, "adaptiveModalMode", value);
26023 },
26024 GetIsPinned: function(index) {
26025  return this.GetPropertyValue(index, "isPinned");
26026 },
26027 SetIsPinned: function(index, value) {
26028  this.SetPropertyValue(index, "isPinned", value);
26029 },
26030 GetPinPosX: function(index) {
26031  return this.GetPropertyValue(index, "pinX");
26032 },
26033 SetPinPosX: function(index, pinX) {
26034  this.SetPropertyValue(index, "pinX", pinX);
26035 },
26036 GetPinPosY: function(index) {
26037  return this.GetPropertyValue(index, "pinY");
26038 },
26039 SetPinPosY: function(index, pinY) {
26040  this.SetPropertyValue(index, "pinY", pinY);
26041 },
26042 GetIsCollapsed: function(index) {
26043  return this.GetPropertyValue(index, "isCollapsed");
26044 },
26045 SetIsCollapsed: function(index, value) {
26046  this.SetPropertyValue(index, "isCollapsed", value);
26047 },
26048 GetIsMaximized: function(index) {
26049  return this.GetPropertyValue(index, "isMaximized");
26050 },
26051 GetIsMaximizedOnWebKitTouch: function(index) {
26052  return this.GetIsMaximized(index) && ASPx.Browser.WebKitTouchUI;
26053 },
26054 SetIsMaximized: function(index, value) {
26055  this.SetPropertyValue(index, "isMaximized", value);
26056 },
26057 GetIsMaximizedInit: function(index) {
26058  return this.GetPropertyValue(index, "isMaximizedInit");
26059 },
26060 SetIsMaximizedInit: function(index, value) {
26061  this.SetPropertyValue(index, "isMaximizedInit", value);
26062 },
26063 GetRestoredWindowData: function(index) {
26064  return ASPx.CloneObject(this.GetPropertyValue(index, "restoredWindowValues"));
26065 },
26066 GetEnableContentScrolling: function(index) {
26067  return this.GetPropertyValue(index, "enableContentScrolling");
26068 },
26069 GetWindowOverflowX: function(index) {
26070  return this.GetPropertyValue(index, "contentOverflowX");
26071 },
26072 GetWindowOverflowY: function(index) {
26073  return this.GetPropertyValue(index, "contentOverflowY");
26074 },
26075 SetRestoredWindowData: function(index, value) {
26076  this.SetPropertyValue(index, "restoredWindowValues", value);
26077 },
26078 GetWindowIsShown: function(index) {
26079  return this.GetPropertyValue(index, "shown");
26080 },
26081 SetWindowIsShown: function(index, shown) {
26082  this.SetPropertyValue(index, "shown", shown);
26083 },
26084 GetWindowWidthFromServer: function(index) {
26085  return this.GetPropertyValue(index, "widthFromServer");
26086 },
26087 GetHideBodyScrollWhenModal: function(index) {
26088  return this.GetPropertyValue(index, "hideBodyScrollWhenModal");
26089 },
26090 SetHideBodyScrollWhenModal: function(index, value) {
26091  this.SetPropertyValue(index, "hideBodyScrollWhenModal", value);
26092 },
26093 GetCanScrollViewPort: function(index) {
26094  return this.GetPropertyValue(index, "canScrollViewPort");
26095 },
26096 HasDefaultWindow: function() {
26097  return this.GetWindowCountCore() === 0;
26098 },
26099 GetWindowFooterHeightLite: function(index) {
26100  var footer = this.GetWindowFooterElement(index);
26101  if(footer)
26102   return footer.offsetHeight;
26103  return null;
26104 },
26105 SetWindowPopUpReasonMouseEvent: function(index, evt) {
26106  evt = ASPx.CloneObject(evt);
26107  if(evt === undefined)
26108   evt = null;
26109  if(0 <= index && index < this.GetWindowCountCore())
26110   this.windowsPopupReasonMouseEventList[index] = evt;
26111  this.defaultPopupReasonMouseEvent = evt;
26112 },
26113 GetPopUpReasonMouseEvent: function() {
26114  return this.GetWindowPopUpReasonMouseEvent(null);
26115 },
26116 GetWindowPopUpReasonMouseEvent: function(window) {
26117  var index = (window != null) ? window.index : -1;
26118  if(0 <= index && index < this.GetWindowCountCore())
26119   return this.windowsPopupReasonMouseEventList[index];
26120  return this.defaultPopupReasonMouseEvent;
26121 },
26122 GetWindowCountCore: function() {
26123  return (this.windows.length > 0) ? this.windows.length : this.windowCount;
26124 },
26125 SetClientModality: function(isModal) {
26126  this.SetWindowClientModality(-1, isModal);
26127 },
26128 SetWindowClientModality: function(index, isModal) {
26129  var modalElement = this.GetWindowModalElement(index);
26130  if(isModal && !ASPx.IsElementVisible(modalElement))
26131   this.DoShowWindowModalElement(index);
26132  if(!isModal && ASPx.IsElementVisible(modalElement)) {
26133   var element = this.GetWindowElement(index);
26134   this.DoHideWindowModalElement(element);
26135  }
26136 },
26137 GetWindowPinButton: function(index) {
26138  return ASPx.GetElementById(this.name + "_HPB" + index);
26139 },
26140 GetWindowCollapseButton: function(index) {
26141  return ASPx.GetElementById(this.name + "_HMNB" + index);
26142 },
26143 GetWindowMaximizeButton: function(index) {
26144  return ASPx.GetElementById(this.name + "_HMXB" + index);
26145 },
26146 GetWindowScrollDiv: function(index) {
26147  return this.GetWindowChild(index, "_CSD" + index);
26148 },
26149 GetWindowElementDisplayValue: function(windowHasAnyScrollbars, windowHeight) {
26150  return windowHasAnyScrollbars && windowHeight ? "block" : "table";
26151 },
26152 GetMainWindowWidth: function(index, noCache) {
26153  return this.GetClientWindowWidth(index, true, noCache);
26154 },
26155 GetClientWindowWidth: function(index, outerSize, noCache) {
26156  if(!noCache && (this.GetIsCollapsed(index) || this.GetIsMaximized(index))) {
26157   var cachedSize = this.GetWindowCachedSize(index);
26158   if(cachedSize != null)
26159    return cachedSize.width;
26160  }
26161  var element = this.GetWindowElement(index);
26162  if(element != null)
26163   return element.offsetWidth;
26164 },
26165 GetMainWindowHeight: function(index, noCache) {
26166  return this.GetClientWindowHeight(index, true, noCache);
26167 },
26168 GetClientWindowHeight: function(index, outerSize, noCache) {
26169  if(!noCache && (this.GetIsCollapsed(index) || this.GetIsMaximized(index))) {
26170   var cachedSize = this.GetWindowCachedSize(index);
26171   if(cachedSize != null)
26172    return cachedSize.height;
26173  }
26174  var element = this.GetWindowElement(index);
26175  if(element != null)
26176   return element.offsetHeight;
26177 },
26178 ShowModal: function() {
26179  this.ShowModalByIndex(-1);
26180 },
26181 ShowModalByIndex: function(index) {
26182  if(this.adaptivityEnabled) {
26183   this.SetAdaptiveModalMode(index, true);
26184   this.ResetModalStyles(index);
26185   this.ResetPopupStyles(index);
26186   this.DoShowModal(index, ASPx.InvalidPosition, ASPx.InvalidPosition, this.GetLastShownPopupElementIndex(index));
26187  }
26188 },
26189 DoShowWindowCore: function(index, x, y, popupElementIndex, closeOtherWindows, allowChangeZIndex, evt, closeOtherReason) {
26190  if(this.IsDOMDisposed()) return;
26191  this.SetWindowPopUpReasonMouseEvent(index, evt);
26192  if(this.adaptivityEnabled) {
26193   this.SetAdaptiveModalMode(index, this.NeedAdaptiveModalMode());
26194   this.ResetModalStyles(index);
26195   if(this.GetAdaptiveModalMode(index)) {
26196    this.ResetPopupStyles(index);
26197    this.DoShowModal(index, x, y, popupElementIndex);
26198    return;
26199   }
26200  }
26201  this.DoShowWindowAtPos(index, x, y, popupElementIndex, closeOtherWindows, allowChangeZIndex, evt, closeOtherReason);
26202 },
26203 NeedAdaptiveModalMode: function() {
26204  return window.innerWidth < this.GetSwitchAtWindowInnerWidth();
26205 },
26206 GetSwitchAtWindowInnerWidth: function() {
26207  return this.switchAtWindowInnerWidth;
26208 },
26209 GetModalSystemCssClass: function() {
26210  return "dxmodalSys";
26211 },
26212 DoShowWindowAtPos: function(index, x, y, popupElementIndex, closeOtherWindows, allowChangeZIndex, evt, closeOtherReason) {
26213  if(!this.isInitialized)
26214   this.PopulatePopupElements(index);
26215  var element = this.GetWindowElement(index);
26216  if(element != null && this.IsWindowElementsIDAssigned(index)) {
26217   this.StopCloseAnimation(index);
26218   this.PrepareToAdjustContentOnShow(index);
26219   if(closeOtherWindows)
26220    aspxGetPopupControlCollection().DoHideAllWindows(element, this.GetWindowElementId(index), false, closeOtherReason, 0);
26221   var isMoving = this.InternalIsWindowVisible(index);
26222   ASPx.SetElementDisplay(element, true);
26223   element.style.display = this.GetWindowElementDisplayValue(this.HasAnyScrollBars(index), this.GetPopupWindowDimensionFromCache(index, false));
26224   element.style.position = "absolute";
26225   var scrollDiv = this.GetWindowScrollDiv(index),
26226    shouldResetScrollSize = scrollDiv && this.GetEnableContentScrolling(index) && ASPx.GetDocumentMaxClientHeight() <= element.offsetHeight,
26227    savedScrollDivHeight = shouldResetScrollSize && scrollDiv.style.height;
26228   if(shouldResetScrollSize)
26229    scrollDiv.style.height = 0;
26230   this.RestoreWindowSizeFromCache(index);
26231   if(!this.GetWindowIsShown(index)) {
26232    var width = this.GetPopupWindowDimensionFromCache(index, true),
26233     height = this.GetPopupWindowDimensionFromCache(index, false);
26234    this.SetClientWindowSizeCoreLite(index, width, height);
26235    this.SetWindowIsShown(index, true);
26236   }
26237   var popupElement = this.GetPopupElement(index, popupElementIndex);
26238   if(popupElement)
26239    this.SetLastShownPopupElementIndex(index, popupElementIndex);
26240   if(this.GetIsMaximized(index)) {
26241    if(this.hideBodyScrollWhenMaximized)
26242     ASPx.PopupUtils.BodyScrollHelper.HideBodyScroll(element.id);
26243    this.NormalizeMaximizedWindowSize(index);
26244   }
26245   var isDragged = this.GetIsDragged(index);
26246   var horizontalPopupPosition = this.GetClientPopupPos(element, popupElement, x, true, isDragged);
26247   var verticalPopupPosition = this.GetClientPopupPos(element, popupElement, y, false, isDragged);
26248   var clientX = horizontalPopupPosition.position;
26249   var clientY = verticalPopupPosition.position;
26250   this.SetWindowPos(index, element, clientX, clientY);
26251   if(shouldResetScrollSize)
26252    scrollDiv.style.height = savedScrollDivHeight;
26253   this.DoShowWindowModalElement(index);
26254   this.SetVisibleWithAnimation(element, isMoving, index, horizontalPopupPosition, verticalPopupPosition);
26255   this.ShowWindowContentUrl(index);
26256   this.AdjustContentOnShow(index);
26257   scrollDiv = this.GetWindowScrollDiv(index);
26258   if(scrollDiv && this.GetEnableContentScrolling(index)) {
26259    var dimension = null;
26260    var windowMainCell = this.GetWindowMainCell(element);
26261    if(windowMainCell.style.width && windowMainCell.style.height)
26262     dimension = 'both';
26263    else if(windowMainCell.style.width)
26264     dimension = 'width';
26265    else if(windowMainCell.style.height)
26266     dimension = 'height';
26267    if(!dimension)
26268     return;
26269    ASPx.SetElementDisplay(scrollDiv, false);
26270    this.SetWindowScrollDivSize(scrollDiv, index, dimension);
26271    ASPx.SetElementDisplay(scrollDiv, true);
26272   }
26273   this.registerAndActivateWindow(element, index, allowChangeZIndex);
26274   this.RaisePopupOnShow(isMoving, index);
26275   this.CorrectWindowSizeGripPositionLite(index);
26276   this.CorrectWindowHeaderText(index);
26277   this.InitMaximizedWindows(index);
26278   this.InitCollapsedWindows(index);
26279   if(this.GetIsPinned(index)) window.setTimeout(function() { this.HoldPosition(index, true); }.aspxBind(this), 0);
26280   if(!this.GetShowOnPageLoad(index))
26281    this.CorrectElementVerticalAlignment(ASPx.AdjustVerticalMarginsInContainer, this.GetWindowHeaderElement(index));
26282   if(element.style.width.indexOf("px") > -1) {
26283    element.style.width = ASPx.GetCurrentStyle(element).width;
26284   }
26285   this.updateContentScrollIfNeeded(index);
26286  }
26287 },
26288 DoShowModal: function(index, x, y, popupElementIndex) {
26289  var element = this.GetWindowElement(index);
26290  if(element != null) {
26291   this.StopCloseAnimation(index);
26292   this.PrepareToAdjustContentOnShow(index);
26293   if(!ASPx.Browser.WebKitTouchUI)
26294    ASPx.PopupUtils.BodyScrollHelper.HideBodyScroll(element.id);
26295   this.DoShowWindowModalElement(index);
26296   var isMoving = this.InternalIsWindowVisible(index);
26297   ASPx.SetElementDisplay(this.GetModalWrapperElement(index), true, true);
26298   this.ResetScroll(index);
26299   ASPx.SetElementDisplay(element, true, true);
26300   this.SetSizeBeforeShow(index);
26301   this.UpdateAlignment(index);
26302   var popupElement = this.GetPopupElement(index, popupElementIndex);
26303   if(popupElement)
26304    this.SetLastShownPopupElementIndex(index, popupElementIndex);
26305   var horizontalPopupPosition = this.GetClientPopupPos(element, popupElement, x, true, false),
26306    verticalPopupPosition = this.GetClientPopupPos(element, popupElement, y, false, false);
26307   this.SetVisibleWithAnimation(element, isMoving, index, horizontalPopupPosition, verticalPopupPosition);
26308   this.ShowWindowContentUrl(index);
26309   this.AdjustContentOnShow(index);
26310   this.registerAndActivateWindow(element, index, true);
26311   this.RaisePopupOnShow(isMoving, index);
26312   this.CorrectWindowHeaderText(index);
26313   if(!this.GetShowOnPageLoad(index))
26314    this.CorrectElementVerticalAlignment(ASPx.AdjustVerticalMarginsInContainer, this.GetWindowHeaderElement(index));
26315  }
26316 },
26317 SetWindowElementZIndex: function(element, zIndex) {
26318  ASPxClientPopupControlBase.prototype.SetWindowElementZIndex.call(this, element, zIndex);
26319  if(this.adaptivityEnabled)
26320   this.SetModalWrapperZIndex(this.GetWindowIndex(element), zIndex);
26321  else
26322   this.updateContentScrollIfNeeded(this.GetWindowIndex(element));
26323 },
26324 SetModalWrapperZIndex: function(index, zIndex) {
26325  if(!this.GetAdaptiveModalMode(index)) return;
26326  ASPx.SetStyles(this.GetModalWrapperElement(index), {
26327   zIndex: zIndex
26328  });
26329 },
26330 updateContentScrollIfNeeded: function(index) {
26331  var windowElement = this.GetWindowElement(index);
26332  var wrapper = this.getWindowWrapper(windowElement);
26333  var wrapperScroll = this.getWindowWrapperScroll(windowElement);
26334  if(!wrapper || !this.WindowIsModal(index) || !this.GetHideBodyScrollWhenModal(index))
26335   return;
26336  ASPx.PopupUtils.adjustViewportScrollWrapper(wrapper, wrapperScroll, windowElement);
26337 },
26338 getWindowWrapper: function(windowElement) {
26339  return ASPx.GetParentByClassName(windowElement, PopupControlCssClasses.WindowWrapperCssClassName);
26340 },
26341 getWindowWrapperScroll: function(windowElement) {
26342  return ASPx.GetParentByClassName(windowElement, PopupControlCssClasses.WindowWrapperScrollCssClassName);
26343 },
26344 SizeCanBeSet: function(index, isWindowMaximizedAndCollapsed) {
26345  return ASPxClientPopupControlBase.prototype.SizeCanBeSet.call(this, index, isWindowMaximizedAndCollapsed) && !this.GetAdaptiveModalMode(index);
26346 },
26347 GetPopupWindowDimensionFromCache: function(index, isWidth) {
26348  var dimension;
26349  if(isWidth) {
26350   dimension = this.GetWindowWidthInternal(index);
26351   if(ASPx.IsExists(dimension)) {
26352    dimension = Math.max(dimension, this.GetWindowMinWidth(index));
26353    var maxWidth = this.GetWindowMaxWidth(index);
26354    if(maxWidth)
26355     dimension = Math.min(dimension, maxWidth);
26356   }
26357  }
26358  else {
26359   dimension = this.GetWindowHeightInternal(index);
26360   if(ASPx.IsExists(dimension)) {
26361    if(this.HasAnyScrollBars(index) && dimension === constants.DEFAULT_WINDOW_HEIGHT)
26362     return undefined;
26363    dimension = Math.max(dimension, this.GetWindowMinHeight(index));
26364    var maxHeight = this.GetWindowMaxHeight(index);
26365    if(maxHeight)
26366     dimension = Math.min(dimension, maxHeight);
26367   }
26368  }
26369  return dimension;
26370 },
26371 NormalizeMaximizedWindowSize: function(index) {
26372  var width = this.GetPopupWindowDimensionFromCache(index, true),
26373   height = this.GetPopupWindowDimensionFromCache(index, false),
26374   dimensions = this.getDocumentDimensions(index),
26375   sizeNormalizationIsNeeded = width < dimensions.width || height < dimensions.height;
26376  if(sizeNormalizationIsNeeded)
26377   this.NormalizeWindowSize(index, true);
26378 },
26379 NormalizeWindowSize: function(index, isMaximized) {
26380  var width = this.GetClientWindowWidth(index),
26381   height = this.GetClientWindowHeight(index),
26382   normWidth = width,
26383   normHeight = height,
26384   maxWidth = this.GetWindowMaxWidth(index),
26385   minWidth = this.GetWindowMinWidth(index),
26386   maxHeight = this.GetWindowMaxHeight(index),
26387   minHeight = this.GetWindowMinHeight(index);
26388  if(maxWidth)
26389   normWidth = Math.min(normWidth, maxWidth);
26390  if(minWidth)
26391   normWidth = Math.max(normWidth, minWidth);
26392  if(maxHeight)
26393   normHeight = Math.min(normHeight, maxHeight);
26394  if(minHeight)
26395   normHeight = Math.max(normHeight, minHeight);
26396  if(normWidth !== width || normHeight !== height)
26397   this.SetWindowSize(this.GetWindow(index), normWidth, normHeight);
26398  if(isMaximized) {
26399   var dimensions = this.getDocumentDimensions(index);
26400   if(this.GetIsCollapsed(index)) {
26401    if(normWidth != dimensions.width) {
26402     this.SetWindowSizeByIndexCore(index, dimensions.width, normHeight, true);
26403    }
26404   } else {
26405    if(normWidth != dimensions.width || normHeight != dimensions.height) {
26406     this.SetWindowSizeByIndexCore(index, dimensions.width, dimensions.height, false);
26407    }
26408   }
26409  }
26410 },
26411 DoShowWindowModalElement: function(index) {
26412  if(this.CanManipulateWithModalElement(index)) {
26413   if(this.adaptivityEnabled) {
26414    this.DoShowWindowModalElementWithAdaptivity(index);
26415    return;
26416   }
26417   var modalElement = this.GetWindowModalElement(index);
26418   var bodyScrollHasJustBeingHidden = false;
26419   if(this.GetHideBodyScrollWhenModal(index) && (!this.IsWindowVisible(this.GetWindow(index)) || !ASPx.IsElementVisible(modalElement))) {
26420    bodyScrollHasJustBeingHidden = true;
26421    aspxGetPopupControlCollection().LockWindowResizeByBodyScrollVisibilityChanging();
26422    if(!ASPx.Browser.WebKitTouchUI)
26423     ASPx.PopupUtils.BodyScrollHelper.HideBodyScroll(this.GetWindowElementId(index));
26424   }
26425   if(ASPx.Browser.IE && this.GetHideBodyScrollWhenModal(index))
26426    ASPx.Evt.AttachEventToElement(modalElement, ASPx.Evt.GetMouseWheelEventName(), function(evt) { return ASPx.Evt.PreventEventAndBubble(evt); });
26427   ASPx.SetElementDisplay(modalElement, true);
26428   this.AdjustModalElementBounds(modalElement);
26429   this.SetModalElementVisibilityWithAnimation(modalElement, index);
26430   aspxGetPopupControlCollection().RegisterVisibleModalElement(modalElement);
26431   if(bodyScrollHasJustBeingHidden)
26432    aspxGetPopupControlCollection().UnlockWindowResizeByBodyScrollVisibilityChanging();
26433  }
26434 },
26435 DoShowWindowModalElementWithAdaptivity: function(index) {
26436  var overlayElement = this.GetOverlayElement(index);
26437  if(!overlayElement) return;
26438  ASPx.SetStyles(overlayElement, {
26439   right: 0,
26440   bottom: 0,
26441   width: "",
26442   height: ""
26443  });
26444  ASPx.SetElementDisplay(overlayElement, true);
26445  this.SetModalElementVisibilityWithAnimation(overlayElement, index);
26446  ASPx.GetPopupControlCollection().RegisterVisibleModalElement(overlayElement);
26447 },
26448 SetSizeBeforeShow: function(index) {
26449  if(this.GetModalMaxWidth(index) && this.GetModalMaxWidth(index) !== this.DefaultModalMaxWidth)
26450   this.SetAdaptiveMaxWidthByIndex(index, this.GetModalMaxWidth(index));
26451  if(this.GetModalMinWidth(index) !== this.DefaultModalMinWidth)
26452   this.SetAdaptiveMinWidthByIndex(index, this.GetModalMinWidth(index));
26453  this.UpdateHeightDimensions(index);
26454 },
26455 UpdateHeightDimensions: function(index) {
26456  this.UpdateAdaptiveMinHeight(index);
26457  this.UpdateAdaptiveMaxHeight(index);
26458 },
26459 UpdateAdaptiveMinHeight: function(index) {
26460  if(this.GetModalMinHeight(index) !== null)
26461   this.SetAdaptiveHeightDimension(index, "minHeight", this.GetModalMinHeight(index));
26462 },
26463 UpdateAdaptiveMaxHeight: function(index) {
26464  if(this.GetModalMaxHeight(index) !== null)
26465   this.SetAdaptiveHeightDimension(index, "maxHeight", this.GetModalMaxHeight(index));
26466 },
26467 GetClientPopupPos: function(element, popupElement, pos, isX, isDragged) {
26468  if(!this.GetAdaptiveModalMode(this.GetWindowIndex(element)))
26469   return ASPxClientPopupControlBase.prototype.GetClientPopupPos.call(this, element, popupElement, pos, isX, isDragged);
26470  var getPosFunc = isX ? ASPx.GetAbsolutePositionX : ASPx.GetAbsolutePositionY;
26471  return { position: getPosFunc(element) };
26472 },
26473 GetAnimationVerticalDirection: function(index, verticalPopupPosition) {
26474  if(!this.GetAdaptiveModalMode(index))
26475   return ASPxClientPopupControlBase.prototype.GetAnimationVerticalDirection.call(this, index, verticalPopupPosition);
26476  return ASPxClientPopupControl.Animation.GetVerticalDirection(this.modalVerticalAlign, this.modalHorizontalAlign);
26477 },
26478 GetAnimationHorizontalDirection: function(index, horizontalPopupPosition) {
26479  if(!this.GetAdaptiveModalMode(index))
26480   return ASPxClientPopupControlBase.prototype.GetAnimationHorizontalDirection.call(this, index, horizontalPopupPosition);
26481  return ASPxClientPopupControl.Animation.GetHorizontalDirection(this.modalHorizontalAlign);
26482 },
26483 GetDefaultVerticalOffset: function() {
26484  return this.IsSmallDisplay() ? 10 : 30;
26485 },
26486 IsSmallDisplay: function() {
26487  return window.innerWidth < this.GetScreenLimitForCss();
26488 },
26489 GetScreenLimitForCss: function() {
26490  return ASPx.MaxMobileWindowWidth;
26491 },
26492 StartAutoAnimation: function(element, index, horizontalPopupPosition, verticalPopupPosition) {
26493  if(this.adaptivityEnabled) {
26494   if(this.NeedFadeAnimation(index, this.popupAnimationType))
26495    this.StartFadeAnimation(element, index);
26496   else
26497    this.StartSlideAnimation(element, index, horizontalPopupPosition, verticalPopupPosition);
26498  } else 
26499   ASPxClientPopupControlBase.prototype.StartAutoAnimation.call(this, element, index, horizontalPopupPosition, verticalPopupPosition);
26500 },
26501 DoHideWindowWithAutoAnimation: function(index, element, closeReason) {
26502  if(this.NeedFadeAnimation(index, this.closeAnimationType))
26503   this.DoHideWindowWithFadeAnimation(index, element, closeReason);
26504  else
26505   this.DoHideWindowWithSlideAnimation(index, closeReason);
26506 },
26507 IsDraggingAllowed: function(index) {
26508  return this.allowDragging && (!this.GetAdaptiveModalMode(index) || this.allowDraggingInAdaptiveMode);
26509 },
26510 IsResizeAllowed: function(index) {
26511  return ASPxClientPopupControlBase.prototype.IsResizeAllowed.call(this, index) && !this.GetAdaptiveModalMode(index);
26512 },
26513 IsFadeCloseAnimation: function(index) {
26514  return ASPxClientPopupControlBase.prototype.IsFadeCloseAnimation.call(this, index) || this.NeedFadeAnimation(index, this.closeAnimationType);
26515 },
26516 NeedFadeAnimation: function(index, animationType) {
26517  return ASPxClientPopupControl.Animation.NeedFadeAnimation(this.modalHorizontalAlign, this.modalVerticalAlign,
26518   animationType, this.popupHorizontalAlign, this.popupVerticalAlign, this.GetAdaptiveModalMode(index));
26519 },
26520 AllowModalElementAnimation: function(index) {
26521  if(this.GetAdaptiveModalMode(index))
26522   return this.popupAnimationType !== ASPxClientPopupControlBase.AnimationType.None;
26523  return ASPxClientPopupControlBase.prototype.AllowModalElementAnimation.call(this, index);
26524 },
26525 DoHideWindowCore: function(index, closeReason) {
26526  var element = this.GetWindowElement(index);
26527  if(element != null) {
26528   if(this.HasCloseAnimation())
26529    this.PrepareElementAfterCloseAnimation(index, element);
26530   element.isHiding = true;
26531   element.style.zIndex = this.GetDefaultZIndexFromServer();
26532   this.SetIsDragged(index, false);
26533   this.UpdateWindowsStateCookie();
26534   element.isHiding = false;
26535   this.StopShowAnimation(index);
26536   if(ASPx.Browser.WebKitTouchUI || ASPx.Browser.Safari) {
26537    var dummy = element.offsetWidth; 
26538   }
26539   ASPx.SetElementDisplay(element, false);
26540   ASPx.SetElementVisibility(element, false);
26541   if(this.adaptivityEnabled) {
26542    ASPx.SetElementDisplay(this.GetModalWrapperElement(index), "", true);
26543    if(!ASPx.Browser.WebKitTouchUI)
26544     ASPx.PopupUtils.BodyScrollHelper.RestoreBodyScroll(element.i
26544d);
26545    this.SetWrapperScrollVisible(index, true);
26546    this.SetIsDragged(index, false);
26547   }
26548   if(this.hideBodyScrollWhenMaximized && this.GetIsMaximized(index))
26549    ASPx.PopupUtils.BodyScrollHelper.RestoreBodyScroll(element.id);
26550   this.DoHideWindowModalElement(element, closeReason);
26551   this.DoHideWindowIFrame(element);
26552   aspxGetPopupControlCollection().UnregisterVisibleWindow(element);
26553   this.ProcessAccessibleElementOnHide();
26554   this.HideWindowLoadingPanel(index);
26555  }
26556 },
26557 OnAnimationStop: function(index) {
26558  if(this.adaptivityEnabled) {
26559   this.SetWrapperScrollVisible(index, true);
26560   this.UnlockWrapperScrollEventEvent();
26561  }
26562  ASPxClientPopupControlBase.prototype.OnAnimationStop.call(this, index);
26563  if(!this.adaptivityEnabled && ASPx.Browser.Firefox)
26564   this.GetWindowElement(index).style.display = "table";
26565 },
26566 ResetModalStyles: function(index) {
26567  var element = this.GetWindowElement(index);
26568  if(element != null) {
26569   ASPx.SetStyles(element, {
26570    minWidth: "",
26571    maxWidth: "",
26572    marginTop: "",
26573    marginLeft: "",
26574    marginRight: "",
26575    position: ""
26576   });
26577   ASPx.SetStyles(this.GetWindowContentElement(index), {
26578    minHeight: "",
26579    maxHeight: "",
26580   });
26581   this.FixateFooter(index, false, 0);
26582   this.FixateHeader(index, false, 0);
26583   this.SetIsDragged(false);
26584   this.DoHideWindowModalElement(element);
26585  }
26586 },
26587 ResetPopupStyles: function(index) {
26588  var element = this.GetWindowElement(index);
26589  if(element != null) {
26590   ASPx.SetStyles(element, {
26591    left: "",
26592    top: "",
26593    width: "",
26594    height: "",
26595   });
26596   ASPx.SetStyles(this.GetWindowContentWrapperElement(index), {
26597    height: "",
26598    width: "",
26599    display: ""
26600   });
26601   ASPx.SetStyles(this.GetWindowContentElement(index), {
26602    display: "",
26603    width: "",
26604    height: ""
26605   });
26606   this.SetWindowIsShown(index, false);
26607  }
26608 },
26609 InitDivPosForHideSlideAnimation: function(animationDivElement) {
26610  ASPx.PopupUtils.InitAnimationDivCore(animationDivElement);
26611 },
26612 DoHideWindow: function(index, dontRaiseClosing, closeReason) {
26613  var cancel = ASPxClientPopupControlBase.prototype.DoHideWindow.call(this, index, dontRaiseClosing, closeReason);
26614  this.updateContentScrollIfNeeded(index);
26615  return cancel;
26616 },
26617 OnWindowShown: function(windowIndex) {
26618  this.EnsureContent(windowIndex, false);
26619  this.EnsureIFrameHeightAdjusted(windowIndex);
26620  if(this.GetAdaptiveModalMode(windowIndex))
26621   this.ChangeFooterFixed(windowIndex);
26622  else {
26623   var isMaximized = this.GetIsMaximized(windowIndex);
26624   if(isMaximized || this.HasAnyScrollBars(windowIndex))
26625    this.NormalizeWindowSize(windowIndex, isMaximized);
26626  }
26627  this.RaiseShown(windowIndex);
26628  var loadingElementsWillNotBeShown = !this.lpTimers[windowIndex] || this.lpTimers[windowIndex] < 0;
26629  if(this.InWindowCallback(windowIndex) && loadingElementsWillNotBeShown) {
26630   this.ShowWindowLoadingElementsInternal(windowIndex);
26631  }
26632  if(this.GetAdaptiveModalMode(windowIndex))
26633   this.UpdateAdaptiveMinHeight(windowIndex);
26634 },
26635 SetWrapperScrollVisible: function(index, visible) {
26636  if(!this.GetAdaptiveModalMode(index)) return;
26637  var modalWrapper = this.GetModalWrapperElement(index);
26638  if(visible) {
26639   ASPx.Attr.RestoreStyleAttribute(modalWrapper, "overflow-x");
26640   ASPx.Attr.RestoreStyleAttribute(modalWrapper, "overflow-y");
26641  } else {
26642   if(this.modalVerticalAlign === ModalAlign.WindowBottom && this.GetWindowElement(index).offsetHeight <= window.innerHeight)
26643    ASPx.Attr.ChangeStyleAttribute(modalWrapper, "overflow-y", "hidden");
26644   if(this.modalHorizontalAlign === ModalAlign.WindowRight)
26645    ASPx.Attr.ChangeStyleAttribute(modalWrapper, "overflow-x", "hidden");
26646  }
26647 },
26648 GetDragCorrection: function(index, element, isX) {
26649  if(this.adaptivityEnabled) {
26650   var offset = isX ? element.offsetLeft : element.offsetTop;
26651   offset -= ASPx.PxToInt(element.style[isX ? "left" : "top"]);
26652   return ASPx.GetPositionElementOffset(this.GetModalWrapperElement(index), isX) + offset;
26653  } else
26654   return ASPxClientPopupControlBase.prototype.GetDragCorrection.call(this, index, element, isX);
26655 },
26656 GetSlideAnimationDuration: function(index) {
26657  return !this.GetAdaptiveModalMode(index) ? ASPxClientPopupControlBase.prototype.GetSlideAnimationDuration.call(this, index) : 300;
26658 },
26659 GetSlideOffsetCoefficient: function(index) {
26660  return !this.GetAdaptiveModalMode(index) ? ASPxClientPopupControlBase.prototype.GetSlideOffsetCoefficient.call(this, index) : 0.25;
26661 },
26662 InitDivPosForShowSlideAnimation: function(index, animationDivElement, clientX, clientY, onAnimStopCallString) {
26663  if(!this.GetAdaptiveModalMode(index))
26664   ASPxClientPopupControlBase.prototype.InitDivPosForShowSlideAnimation.call(this, index, animationDivElement, clientX, clientY, onAnimStopCallString);
26665  else
26666   ASPx.PopupUtils.InitAnimationProperties(animationDivElement, onAnimStopCallString);
26667 },
26668 BeforeAnySlideAnimation: function(index) {
26669  this.FixateFooter(index, false, 0);
26670  this.FixateHeader(index, false, 0);
26671  this.SetWrapperScrollVisible(index, false);
26672 },
26673 StartSlideAnimation: function(animationDivElement, index, horizontalPopupPosition, verticalPopupPosition) {
26674  if(this.adaptivityEnabled) {
26675   this.LockWrapperScrollEvent();
26676   this.BeforeAnySlideAnimation(index);
26677  }
26678  ASPxClientPopupControlBase.prototype.StartSlideAnimation.call(this, animationDivElement, index, horizontalPopupPosition, verticalPopupPosition);
26679 },
26680 DoHideWindowWithSlideAnimation: function(index, closeReason) {
26681  if(this.adaptivityEnabled)
26682   this.BeforeAnySlideAnimation(index);
26683  ASPxClientPopupControlBase.prototype.DoHideWindowWithSlideAnimation.call(this, index, closeReason);
26684 },
26685 UpdatePositionAfterCallback: function(windowIndex) {
26686  if(this.adaptivityEnabled)
26687   this.TryAutoUpdatePosition(windowIndex);
26688  else if(this.contentLoadingMode === LoadContentViaCallback.OnFirstShow && this.InternalIsWindowVisible(windowIndex))
26689   this.UpdateWindowPositionInternal(windowIndex, this.GetPopupElement(windowIndex, this.GetLastShownPopupElementIndex(windowIndex)));
26690 },
26691 CreateLoadingDiv: function(parentElement, offsetElement, windowIndex) {
26692  if(typeof (windowIndex) != "undefined") { 
26693   var loadingDiv = ASPxClientControl.prototype.CreateLoadingDiv.call(this, parentElement, offsetElement);
26694   loadingDiv.id += windowIndex;
26695   return loadingDiv;
26696  }
26697 },
26698 CreateLoadingPanelWithAbsolutePosition: function(parentElement, offsetElement, windowIndex) {
26699  if(typeof (windowIndex) != "undefined") { 
26700   var loadingPanel = ASPxClientControl.prototype.CreateLoadingPanelWithAbsolutePosition.call(this, parentElement, offsetElement);
26701   loadingPanel.id += windowIndex;
26702   return loadingPanel;
26703  }
26704 },
26705 PerformWindowCallback: function(window, parameter, onSuccess) {
26706  ASPxClientPopupControlBase.prototype.PerformWindowCallback.call(this, window, parameter, onSuccess);
26707 },
26708 SetIframeVisibleForDragging: function(index, visible) {
26709  var iframeElement = this.GetWindowContentIFrameElement(index);
26710  if(ASPx.Browser.IE || ASPx.Browser.Edge) {
26711   if(ASPx.Browser.Edge || ASPx.Browser.Version >= 11)
26712    iframeElement.style.pointerEvents = visible ? "" : "none";
26713   else {
26714    if(visible)
26715     this.RemoveIframeCoverDiv(iframeElement, index);
26716    else
26717     this.CreateIframeCoverDiv(iframeElement, index);
26718   }
26719  }
26720  ASPx.SetElementVisibility(iframeElement, visible);
26721 },
26722 OnResizeStop: function(evt, index, cursor, resizePanel) {
26723  ASPxClientPopupControlBase.prototype.OnResizeStop.call(this, evt, index, cursor, resizePanel);
26724  if(this.IsResizeAllowed(index))
26725   this.SetWindowCachedSize(index, this.GetClientWindowWidth(index), this.GetClientWindowHeight(index));
26726  this.updateContentScrollIfNeeded(index);
26727 },
26728 OnMouseDownModalElement: function(evt, index) {
26729  aspxGetPopupControlCollection().DoHideAllWindows(ASPx.Evt.GetEventSource(evt), "", false, ASPxClientPopupControlCloseReason.OuterMouseClick, evt.offsetX);
26730  this.SetIsPopuped(index, true);
26731 },
26732 IsRaiseAfterResizingLocked: function() {
26733  return this.CollapseExecuting() || this.MaximizationExecuting();
26734 },
26735 GetContentElementChildren: function(index, contentElement) {
26736  var cache = this.GetResizeSessionCache();
26737  if(!cache.contentElementChildren || !cache.contentElementChildren[index]) {
26738   cache.contentElementChildren = [];
26739   cache.contentElementChildren[index] = contentElement.getElementsByTagName("*");
26740  }
26741  return cache.contentElementChildren[index];
26742 },
26743 GetContentElementChildrenScroll: function(index, contentElementChildren) {
26744  var cache = this.GetResizeSessionCache();
26745  if(!cache.contentElementChildrenScroll || !cache.contentElementChildrenScroll[index]) {
26746   cache.contentElementChildrenScroll = [];
26747   cache.contentElementChildrenScroll[index] = [];
26748   for(var i = 0, len = contentElementChildren.length; i < len; i++) {
26749    var child = contentElementChildren[i];
26750    if(!!child.scrollLeft || !!child.scrollTop)
26751     cache.contentElementChildrenScroll[index].push([i, child.scrollLeft, child.scrollTop]);
26752   }
26753  }
26754  return cache.contentElementChildrenScroll[index];
26755 },
26756 GetElementBordersAndPaddings: function(index, element, leftRight) {
26757  var cache = this.GetResizeSessionCache();
26758  if(!cache.elementBordersAndPaddings || !cache.elementBordersAndPaddings[index]) {
26759   cache.elementBordersAndPaddings = [];
26760   var style = ASPx.GetCurrentStyle(element);
26761   cache.elementBordersAndPaddings[index] = {
26762    leftRight: this.getLeftRightBordersAndPaddingsSummaryValue(element, style),
26763    topBottom: this.getLeftRightBordersAndPaddingsSummaryValue(element, style)
26764   };
26765  }
26766  return leftRight ? cache.elementBordersAndPaddings[index].leftRight : cache.elementBordersAndPaddings[index].topBottom;
26767 },
26768 GetHeaderFooterHeight: function(index) {
26769  var cache = this.GetResizeSessionCache();
26770  if(!cache.headerFooterHeight || !cache.headerFooterHeight[index]) {
26771   cache.headerFooterHeight = [];
26772   cache.headerFooterHeight[index] = this.GetHeaderFooterHeightCore(index);
26773  }
26774  return cache.headerFooterHeight[index];
26775 },
26776 getContentElementDisplay: function(correctContentElementSize, contentUrl) {
26777  return correctContentElementSize || contentUrl ? "block" : "table-cell";
26778 },
26779 SetContentWrapperHeightLite: function(index, actualHeight, windowElem, contentWrapper) {
26780  if(!windowElem.style.height || ASPx.IsPercentageSize(windowElem.style.height))
26781   return;
26782  var borderOwner = this.GetWindowBorderOwnerElement(windowElem);
26783  var height = borderOwner == windowElem ? actualHeight : actualHeight - (borderOwner ? ASPx.GetTopBottomBordersAndPaddingsSummaryValue(borderOwner) : 0);
26784  height -= this.GetHeaderFooterHeight(index);
26785  if(height > 0)
26786   contentWrapper.style.height = height + "px";
26787 },
26788 SetWindowScrollDivSize: function(scrollDiv, index, dimension) {
26789  var windowClientTable = this.GetWindowClientTable(index);
26790  var headerElement = this.GetWindowHeaderElement(index);
26791  var height = windowClientTable.offsetHeight;
26792  if(headerElement)
26793   height -= headerElement.offsetHeight;
26794  height -= this.GetWindowFooterHeightLite(index);
26795  if(dimension == 'height' || dimension == 'both')
26796   ASPx.SetOffsetHeight(scrollDiv, height);
26797  if(dimension == 'width' || dimension == 'both') {
26798   var width = windowClientTable.offsetWidth;
26799   var contentElement = this.GetWindowContentElement(index);
26800   width -= this.getLeftRightBordersAndPaddingsSummaryValue(scrollDiv) + ASPx.GetHorizontalBordersWidth(contentElement);
26801   if(width > -1)
26802    scrollDiv.style.width = width + "px";
26803  }
26804  scrollDiv.style.marginRight = "0px";
26805 },
26806 AdjustIFrameHeight: function(index, iframe) {
26807  ASPxClientPopupControlBase.prototype.AdjustIFrameHeight.call(this, index, iframe);
26808  if(!this.InternalIsWindowVisible(index) || !iframe || this.GetAdaptiveModalMode(index)) return;
26809  this.SetIframeAdjustingPostponed(index, false);
26810  var content = this.GetContentContainer(index);
26811  var contentWrapper = this.GetWindowContentWrapperElement(index);
26812  iframe.style.verticalAlign = "text-bottom";
26813  var iframeHeight = contentWrapper.offsetHeight - this.getTopBottomBordersAndPaddingsSummaryValue(content);
26814  if(iframeHeight >= 0)
26815   iframe.style.height = iframeHeight + "px";
26816 },
26817 OnPinButtonClick: function(index) {
26818  var value = this.GetIsPinned(index);
26819  this.SetPinCore(index, !value);
26820 },
26821 SetPinCore: function(index, value) {
26822  if(this.GetIsPinned(index) != value) {
26823   this.SetIsPinned(index, value);
26824   this.HoldPosition(index, value);
26825   this.UpdateWindowsStateCookie();
26826   this.OnPinned(index, value);
26827  }
26828 },
26829 OnPinned: function(index, pinned) {
26830  this.RaisePinnedChanged(index, pinned);
26831 },
26832 HoldPosition: function(index, hold, element) {
26833  if(hold) {
26834   element = element || this.GetWindowElement(index);
26835   if(!element) return;
26836   var x = ASPx.GetAbsoluteX(element);
26837   var y = ASPx.GetAbsoluteY(element);
26838   scrollX = ASPx.GetDocumentScrollLeft();
26839   scrollY = ASPx.GetDocumentScrollTop();
26840   this.SetPinPosX(index, x - scrollX);
26841   this.SetPinPosY(index, y - scrollY);
26842  }
26843  this.UpdateHeaderButtonSelected(index, "GetWindowPinButton", hold);
26844  this.CheckHeaderCursor(index);
26845 },
26846 GetBodyWidth: function() {
26847  return aspxGetPopupControlCollection().GetSavedBodyWidth();
26848 },
26849 GetBodyHeight: function() {
26850  return aspxGetPopupControlCollection().GetSavedBodyHeight();
26851 },
26852 GetIsOutFromViewPort: function(index) {
26853  var element = this.GetWindowElement(index);
26854  if(!element) return false;
26855  var pinXTarget = this.GetPinPosX(index);
26856  var pinYTarget = this.GetPinPosY(index);
26857  var popupWindowWidth = this.GetClientWindowWidth(index);
26858  var docClientWidth = ASPx.GetDocumentClientWidth();
26859  var rightOutOffset = (pinXTarget + popupWindowWidth) - docClientWidth;
26860  var popupWindowHeight = this.GetClientWindowHeight(index);
26861  var docClientHeight = ASPx.GetDocumentClientHeight();
26862  var bottomOutOffset = (pinYTarget + popupWindowHeight) - docClientHeight;
26863  return (rightOutOffset > 0 || bottomOutOffset > 0);
26864 },
26865 needToHidePinnedOutFromViewPort: function(index) {
26866  return this.GetIsPinned(index) && this.GetIsOutFromViewPort(index);
26867 },
26868 AdjustPinPositionWhileScroll: function(index) {
26869  var element = this.GetWindowElement(index);
26870  if(!element) return;
26871  var x = ASPx.GetAbsoluteX(element);
26872  var y = ASPx.GetAbsoluteY(element);
26873  var scrollX = ASPx.GetDocumentScrollLeft();
26874  var scrollY = ASPx.GetDocumentScrollTop();
26875  var pinX = x - scrollX;
26876  var pinY = y - scrollY;
26877  var pinXTarget = this.GetPinPosX(index);
26878  var pinYTarget = this.GetPinPosY(index);
26879  if((pinX != pinXTarget) || (pinY != pinYTarget)) {
26880   this.lockScroll++;
26881   var xNew = pinXTarget + scrollX;
26882   var yNew = pinYTarget + scrollY;
26883   var bodyWidth = this.GetBodyWidth();
26884   var bodyHeight = this.GetBodyHeight();
26885   var popupWindowWidth = this.GetClientWindowWidth(index);
26886   var docClientWidth = ASPx.GetDocumentClientWidth();
26887   var rightOutOffset = (pinXTarget + popupWindowWidth) - docClientWidth;
26888   var popupWindowHeight = this.GetClientWindowHeight(index);
26889   var docClientHeight = ASPx.GetDocumentClientHeight();
26890   var bottomOutOffset = (pinYTarget + popupWindowHeight) - docClientHeight;
26891   var cancelScrollX = false;
26892   if(xNew + (popupWindowWidth - rightOutOffset) > bodyWidth) {
26893    xNew -= (xNew + (popupWindowWidth - rightOutOffset) - bodyWidth);
26894    cancelScrollX = true;
26895   }
26896   var cancelScrollY = false;
26897   if(yNew + (popupWindowHeight - bottomOutOffset) > bodyHeight) {
26898    yNew -= (yNew + (popupWindowHeight - bottomOutOffset) - bodyHeight);
26899    cancelScrollY = true;
26900   }
26901   xNew = ASPx.PrepareClientPosForElement(xNew, element, true);
26902   yNew = ASPx.PrepareClientPosForElement(yNew, element, false);
26903   this.SetWindowPos(index, element, xNew, yNew);
26904   if(cancelScrollX) {
26905    var scrollLeftMax = bodyWidth - ASPx.GetDocumentClientWidth();
26906    if((rightOutOffset > 0) && (scrollX > scrollLeftMax)) {
26907     this.lockScroll++;
26908     ASPx.SetDocumentScrollLeft(scrollLeftMax);
26909     this.lockScroll--;
26910    }
26911   }
26912   if(cancelScrollY) {
26913    var scrollTopMax = bodyHeight - ASPx.GetDocumentClientHeight();
26914    if((bottomOutOffset > 0) && (scrollY > scrollTopMax)) {
26915     this.lockScroll++;
26916     ASPx.SetDocumentScrollTop(scrollTopMax);
26917     this.lockScroll--;
26918    }
26919   }
26920   this.lockScroll--;
26921  }
26922 },
26923 OnCollapseButtonClick: function(index) {
26924  this.SetCollapsedCore(index, !this.GetIsCollapsed(index));
26925 },
26926 SetCollapsedCore: function(index, minimization) {
26927  if(this.GetIsCollapsed(index) == minimization) return;
26928  this.DoCollapse(index, minimization);
26929  this.OnCollapsed(index, minimization);
26930 },
26931 DoCollapse: function(index, minimization) {
26932  if(this.GetIsCollapsed(index) == minimization) return;
26933  this.StartCollapse();
26934  if(minimization) {
26935   var cachedWidth = this.GetClientWindowWidth(index);
26936   var cachedHeight = this.GetClientWindowHeight(index);
26937   var shouldUpdateRestoredSize = this.ShoulUpdatedRestoredWindowSizeOnCollapse(index);
26938   var width = this.GetMainWindowWidth(index, !shouldUpdateRestoredSize);
26939   var height = this.GetMainWindowHeight(index, !shouldUpdateRestoredSize);
26940   this.SetWindowSizeByIndex(index, width, 0);
26941   this.SetWindowContentVisible(index, false);
26942   this.SetWindowFooterVisible(index, false);
26943   this.ResetWindowHeight(index);
26944   this.SetIsCollapsed(index, minimization);
26945   this.SetWindowCachedSize(index, cachedWidth, cachedHeight);
26946   if(shouldUpdateRestoredSize)
26947    this.UpdateRestoredWindowSize(index, width, height);
26948  }
26949  else {
26950   if(this.MaximizationExecuting()) {
26951    var element = this.GetWindowElement(index);
26952    if(element) {
26953     element.style.left = ASPx.GetDocumentScrollLeft();
26954     element.style.top = ASPx.GetDocumentScrollTop();
26955    }
26956   }
26957   this.SetWindowContentVisible(index, true);
26958   this.SetWindowFooterVisible(index, true);
26959   this.SetIsCollapsed(index, minimization);
26960   if(this.GetIsMaximized(index)) {
26961    var documentClientWidth = ASPx.PopupUtils.GetDocumentClientWidthForPopup();
26962    var documentClientHeight = ASPx.PopupUtils.GetDocumentClientHeightForPopup();
26963    this.SetWindowSizeByIndex(index, documentClientWidth, documentClientHeight);
26964   } else {
26965    var restoredWindowData = this.GetRestoredWindowData(index);
26966    this.SetWindowSizeByIndex(index, restoredWindowData.width, restoredWindowData.height);
26967   }
26968   ASPx.GetControlCollection().AdjustControls(this.GetWindowElement(index));
26969  }
26970  this.UpdateHeaderButtonSelected(index, "GetWindowCollapseButton", minimization);
26971  this.EndCollapse();
26972  this.UpdateWindowsStateCookie();
26973 },
26974 ResetWindowHeight: function(index) {
26975  var element = this.GetWindowElement(index);
26976  if(element)
26977   element.style.height = "";
26978 },
26979 ShoulUpdatedRestoredWindowSizeOnCollapse: function(index) {
26980  return !this.GetIsMaximized(index);
26981 },
26982 OnCollapsed: function(index, value) {
26983  if(value)
26984   this.RaiseCollapsed(index);
26985  else
26986   this.RaiseExpanded(index);
26987  this.RaiseAfterResizing(index);
26988 },
26989 OnMaximizeButtonClick: function(index) {
26990  this.SetMaximizedCore(index, !this.GetIsMaximized(index));
26991 },
26992 SetMaximizedCore: function(index, maximization) {
26993  if(this.GetIsMaximized(index) == maximization) return;
26994  this.DoMaximize(index, maximization);
26995  this.OnMaximizedChanged(index, maximization);
26996 },
26997 GetMaximizedPosition: function(element, isX) {
26998  if(ASPx.Browser.WebKitTouchUI)
26999   return ASPx.PrepareClientPosForElement(0, element, isX);
27000  return ASPx.PrepareClientPosForElement(isX ? ASPx.GetDocumentScrollLeft() : ASPx.GetDocumentScrollTop(), element, isX);
27001 },
27002 PerformMaximaze: function (index, maximization, element) {
27003  if (this.hideBodyScrollWhenMaximized)
27004   ASPx.PopupUtils.BodyScrollHelper.HideBodyScroll(element.id);
27005  if (this.GetIsCollapsed(index))
27006   this.DoCollapse(index, false);
27007  var cachedWidth = this.GetClientWindowWidth(index);
27008  var cachedHeight = this.GetClientWindowHeight(index);
27009  var restoredWindowData = this.GetInitRestoredWindowData(index);
27010  var documentClientWidth = ASPx.PopupUtils.GetDocumentClientWidthForPopup();
27011  var documentClientHeight = ASPx.PopupUtils.GetDocumentClientHeightForPopup();
27012  var windowClientTable = this.GetWindowClientTable(index);
27013  var windowClientTableParent = windowClientTable.parentNode;
27014  childStyle = ASPx.GetCurrentStyle(windowClientTableParent);
27015  var left = this.GetMaximizedPosition(element, true);
27016  var top = this.GetMaximizedPosition(element, false);
27017  this.SetWindowPos(index, element, left, top);
27018  this.SetWindowSizeByIndex(index, documentClientWidth, documentClientHeight);
27019  this.SetWindowCachedSize(index, cachedWidth, cachedHeight);
27020  this.SetRestoredWindowData(index, restoredWindowData);
27021  this.SetIsMaximized(index, maximization);
27022 },
27023 PerformMinimize: function (index, maximization, element) {
27024  var restoredWindowData = this.GetRestoredWindowData(index);
27025  var width = restoredWindowData.width || this.GetMainWindowWidth(index);
27026  var height = restoredWindowData.height || this.GetMainWindowHeight(index);
27027  this.SetIsMaximized(index, maximization);
27028  var left = ASPx.PrepareClientPosForElement(restoredWindowData.left, element, true);
27029  var top = ASPx.PrepareClientPosForElement(restoredWindowData.top, element, false);
27030  this.SetWindowPos(index, element, left, top);
27031  this.SetWindowSizeByIndex(index, width, height);
27032  if (this.GetIsCollapsed(index)) {
27033   this.SetIsCollapsed(index, false);
27034   this.UpdateRestoredWindowSizeLock();
27035   this.DoCollapse(index, true);
27036   this.UpdateRestoredWindowSizeUnlock();
27037  }
27038  if (this.hideBodyScrollWhenMaximized)
27039   ASPx.PopupUtils.BodyScrollHelper.RestoreBodyScroll(element.id);
27040 },
27041 DoMaximize: function(index, maximization) {
27042  if(this.GetIsMaximized(index) == maximization) return;
27043  var element = this.GetWindowElement(index);
27044  if(!element) return;
27045  this.StartMaximization();
27046  if(maximization)
27047   this.PerformMaximaze(index, maximization, element);
27048  else
27049   this.PerformMinimize(index, maximization, element);
27050  if(this.GetIsPinned(index))
27051   this.HoldPosition(index, true, element);
27052  this.UpdateHeaderButtonSelected(index, "GetWindowMaximizeButton", maximization);
27053  this.EndMaximization();
27054  this.UpdateWindowsStateCookie();
27055  this.CheckHeaderCursor(index);
27056 },
27057 OnMaximizedChanged: function(index, value) {
27058  if(value)
27059   this.RaiseMaximized(index);
27060  else
27061   this.RaiseRestoredAfterMaximized(index);
27062  this.RaiseAfterResizing(index);
27063 },
27064 GetInitRestoredWindowData: function(index) {
27065  var restoredWindowData = this.GetRestoredWindowData(index);
27066  restoredWindowData.left = this.GetCurrentLeft(index);
27067  restoredWindowData.top = this.GetCurrentTop(index);
27068  restoredWindowData.width = this.GetMainWindowWidth(index);
27069  restoredWindowData.height = this.GetMainWindowHeight(index);
27070  return restoredWindowData;
27071 },
27072 getDocumentDimensions: function(index) {
27073  var documentClientWidth = ASPx.PopupUtils.GetDocumentClientWidthForPopup(),
27074   documentClientHeight = ASPx.PopupUtils.GetDocumentClientHeightForPopup();
27075  return { width: documentClientWidth, height: documentClientHeight };
27076 }, 
27077 UpdateMaximizedWindowSizeOnResize: function(index) {
27078  this.StartUpdateMaximizedWindowSizeOnResize();
27079  var dimensions = this.getDocumentDimensions(index);
27080  if(this.GetIsCollapsed(index)) dimensions.height = 0;
27081  this.SetWindowSizeByIndex(index, dimensions.width, dimensions.height);
27082  if(this.GetIsCollapsed(index)) {
27083   this.CorrectCollapsedSize(index);
27084  }
27085  window.setTimeout(function() { this.SetMaximizedWindowSizeAfterOnResize(index); }.aspxBind(this), 0);
27086  this.EndUpdateMaximizedWindowSizeOnResize();
27087 },
27088 SetMaximizedWindowSizeAfterOnResize: function(index) {
27089  this.StartUpdateMaximizedWindowSizeOnResize();
27090  var dimensions = this.getDocumentDimensions(index);
27091  windowWidthCurrent = this.GetMainWindowWidth(index, true);
27092  windowHeightCurrent = this.GetMainWindowHeight(index, true);
27093  if(this.GetIsCollapsed(index))
27094   dimensions.height = 0;
27095  if(dimensions.width != windowWidthCurrent || dimensions.height != windowHeightCurrent) {
27096   this.SetWindowSizeByIndex(index, dimensions.width, dimensions.height);
27097   if(this.GetIsCollapsed(index)) {
27098    this.CorrectCollapsedSize(index);
27099   }
27100  }
27101  this.EndUpdateMaximizedWindowSizeOnResize();
27102 },
27103 CorrectCollapsedSize: function(index) {
27104  var contentWrapper = this.GetWindowContentWrapperElement(index);
27105  if(contentWrapper && ASPx.IsElementVisible(contentWrapper))
27106   contentWrapper.style.display = 'none';
27107 },
27108 UpdateHeaderButtonSelected: function(index, methodGetWindowButton, flagSelected) {
27109  if(typeof (ASPx.GetStateController) != "undefined") {
27110   button = this[methodGetWindowButton](index);
27111   var method = flagSelected ? "SelectElementBySrcElement" : "DeselectElementBySrcElement";
27112   ASPx.GetStateController()[method](button);
27113  }
27114 },
27115 CheckHeaderCursor: function(index) {
27116  if(!this.allowDragging) return;
27117  var dragElement = this.GetDragElement(index);
27118  if(!dragElement) return;
27119  var styleCursor = dragElement.style.cursor;
27120  var isPinned = this.GetIsPinned(index);
27121  var isMaximized = this.GetIsMaximized(index);
27122  if((isPinned || isMaximized) && styleCursor != "default")
27123   dragElement.style.cursor = "default";
27124  else if(!isPinned && !isMaximized && styleCursor != "move")
27125   dragElement.style.cursor = "move";
27126 },
27127 StartCollapse: function() {
27128  this.collapseExecutingLockCount++;
27129 },
27130 EndCollapse: function() {
27131  this.collapseExecutingLockCount--;
27132 },
27133 CollapseExecuting: function() {
27134  return this.collapseExecutingLockCount > 0;
27135 },
27136 StartMaximization: function() {
27137  this.maximizationExecutingLockCount++;
27138 },
27139 EndMaximization: function() {
27140  this.maximizationExecutingLockCount--;
27141 },
27142 MaximizationExecuting: function() {
27143  return this.maximizationExecutingLockCount > 0;
27144 },
27145 StartUpdateMaximizedWindowSizeOnResize: function() {
27146  this.browserResizingForMaxWindowLockCount++;
27147 },
27148 EndUpdateMaximizedWindowSizeOnResize: function() {
27149  this.browserResizingForMaxWindowLockCount--;
27150 },
27151 ResizingForMaxWindowLocked: function() {
27152  return this.browserResizingForMaxWindowLockCount > 0;
27153 },
27154 UpdateRestoredWindowSizeLock: function() {
27155  this.updateRestoredWindowSizeLockCount++;
27156 },
27157 UpdateRestoredWindowSizeUnlock: function() {
27158  this.updateRestoredWindowSizeLockCount--;
27159 },
27160 UpdateRestoredWindowSizeLocked: function() {
27161  return this.updateRestoredWindowSizeLockCount > 0;
27162 },
27163 UpdateRestoredWindowSize: function(index, width, height) {
27164  if(!this.UpdateRestoredWindowSizeLocked()) {
27165   restoredMinWindowData = this.GetRestoredWindowData(index);
27166   restoredMinWindowData.width = width;
27167   restoredMinWindowData.height = height;
27168   this.SetRestoredWindowData(index, restoredMinWindowData);
27169  }
27170 },
27171 GetWindowsState: function() {
27172  var state = ASPxClientPopupControlBase.prototype.GetWindowsState.call(this);
27173  for(var i = 0; i < this.GetWindowCountCore() ; i++) {
27174   state += this.GetWindowState(i);
27175   if(i < this.GetWindowCountCore() - 1) state += ";";
27176  }
27177  return state;
27178 },
27179 CreateWindows: function(windowsNames) {
27180  for(var i = 0; i < windowsNames.length; i++) {
27181   var window = new ASPxClientPopupWindow(this, i, windowsNames[i]);
27182   this.windows.push(window);
27183  }
27184 },
27185 RaiseCloseButtonClick: function(index) {
27186  ASPxClientPopupControlBase.prototype.RaiseCloseButtonClick.call(this, index);
27187 },
27188 RaisePinnedChanged: function(index, pinned) {
27189  var window = index < 0 ? null : this.GetWindow(index);
27190  if(!this.PinnedChanged.IsEmpty()) {
27191   var args = new ASPxClientPopupWindowPinnedChangedEventArgs(window, pinned);
27192   this.PinnedChanged.FireEvent(this, args);
27193  }
27194 },
27195 RaiseCollapsed: function(index) {
27196  this.RaiseResize(index, ASPxClientPopupControlResizeState.Collapsed);
27197 },
27198 RaiseExpanded: function(index) {
27199  this.RaiseResize(index, ASPxClientPopupControlResizeState.Expanded);
27200 },
27201 RaiseMaximized: function(index) {
27202  this.RaiseResize(index, ASPxClientPopupControlResizeState.Maximized);
27203 },
27204 RaiseRestoredAfterMaximized: function(index) {
27205  this.RaiseResize(index, ASPxClientPopupControlResizeState.RestoredAfterMaximized);
27206 },
27207 GetContentWidth: function() {
27208  return this.GetWindowContentWidth(null);
27209 },
27210 GetContentHeight: function() {
27211  return this.GetWindowContentHeight(null);
27212 },
27213 SetSize: function(width, height) {
27214  ASPxClientPopupControlBase.prototype.SetSize.call(this, width, height);
27215 },
27216 GetWindowDimension: function(window, isWidth, forceFromCache) {
27217  var index = (window != null) ? window.index : -1;
27218  return this.GetWindowDimensionByIndex(index, isWidth, forceFromCache);
27219 },
27220 GetWindowContentDimension: function(window, isWidth) {
27221  var index = (window != null) ? window.index : -1,
27222   contentElem = this.GetWindowContentElement(index),
27223   dimensionHolder = contentElem.parentNode,
27224   paddingsHolder = contentElem;
27225  return isWidth ?
27226  (dimensionHolder.offsetWidth - this.getLeftRightBordersAndPaddingsSummaryValue(paddingsHolder)) :
27227  (dimensionHolder.offsetHeight - this.getTopBottomBordersAndPaddingsSummaryValue(paddingsHolder));
27228 },
27229 GetWindowContentWidth: function(window) {
27230  return this.GetWindowContentDimension(window, true);
27231 },
27232 GetWindowContentHeight: function(window) {
27233  return this.GetWindowContentDimension(window, false);
27234 },
27235 GetWindowHeight: function(window) {
27236  return this.GetWindowDimension(window, false);
27237 },
27238 GetWindowWidth: function(window) {
27239  return this.GetWindowDimension(window, true);
27240 },
27241 SetWindowSize: function(window, width, height) {
27242  return ASPxClientPopupControlBase.prototype.SetWindowSize.call(this, window, width, height);
27243 },
27244 GetContentHTML: function() {
27245  return this.GetContentHtml();
27246 },
27247 SetContentHTML: function(html) {
27248  this.SetContentHtml(html);
27249 },
27250 SetWindowPopupElementID: function(window, popupElementId) {
27251  var index = (window != null) ? window.index : -1;
27252  this.SetPopupElementIDByIndex(index, popupElementId);
27253 },
27254 SetPopupElementID: function(popupElementId) {
27255  this.SetPopupElementIDByIndex(-1, popupElementId);
27256 },
27257 GetCurrentPopupElementIndex: function() {
27258  return this.GetWindowCurrentPopupElementIndexByWindowIndex(-1);
27259 },
27260 GetWindowCurrentPopupElementIndex: function(window) {
27261  var index = (window != null) ? window.index : -1;
27262  return this.GetWindowCurrentPopupElementIndexByWindowIndex(index);
27263 },
27264 GetCurrentPopupElement: function() {
27265  return this.GetWindowCurrentPopupElementByIndex(-1);
27266 },
27267 GetWindowCurrentPopupElement: function(window) {
27268  var index = (window != null) ? window.index : -1;
27269  return this.GetWindowCurrentPopupElementByIndex(index);
27270 },
27271 ShowAtPos: function(x, y) {
27272  this.ShowWindowAtPos(null, Math.round(x), Math.round(y));
27273 },
27274 BringToFront: function() {
27275  this.BringWindowToFront(null);
27276 },
27277 IsWindowVisible: function(window) {
27278  return ASPxClientPopupControlBase.prototype.IsWindowVisible.call(this, window);
27279 },
27280 GetWindow: function(index) {
27281  return ASPxClientPopupControlBase.prototype.GetWindow.call(this, index);
27282 },
27283 GetWindowByName: function(name) {
27284  for(var i = 0; i < this.windows.length; i++)
27285   if(this.windows[i].name == name) return this.windows[i];
27286  return null;
27287 },
27288 GetWindowCount: function() {
27289  return this.GetWindowCountCore();
27290 },
27291 ShowWindow: function(window, popupElementIndex) {
27292  var index = (window != null) ? window.index : -1;
27293  this.ShowWindowByIndex(index, popupElementIndex);
27294 },
27295 ShowWindowAtElement: function(window, htmlElement) {
27296  var index = (window != null) ? window.index : -1;
27297  this.ShowWindowAtElementByIndex(index, htmlElement);
27298 },
27299 ShowWindowAtElementByID: function(window, id) {
27300  var htmlElement = document.getElementById(id);
27301  this.ShowWindowAtElement(window, htmlElement);
27302 },
27303 ShowWindowAtPos: function(window, x, y) {
27304  if(!this.isInitialized)
27305   return;
27306  var index = (window != null) ? window.index : -1;
27307  this.DoShowWindowCore(index, x, y, -1, false, true);
27308 },
27309 BringWindowToFront: function(window) {
27310  var index = (window != null) ? window.index : -1;
27311  var element = this.GetWindowElement(index);
27312  aspxGetPopupControlCollection().ActivateWindowElement(element, undefined, this.GetPopupType(), this.GetDefaultZIndexFromServer(), this.GetPopupControlZIndex());
27313 },
27314 HideWindow: function(window) {
27315  ASPxClientPopupControlBase.prototype.HideWindow.call(this, window);
27316 },
27317 GetWindowContentHTML: function(window) {
27318  return this.GetWindowContentHtml(window);
27319 },
27320 SetWindowContentHTML: function(window, html) {
27321  this.SetWindowContentHtml(window, html);
27322 },
27323 GetWindowContentHtml: function(window) {
27324  return ASPxClientPopupControlBase.prototype.GetWindowContentHtml.call(this, window);
27325 },
27326 SetWindowContentHtml: function(window, html, useAnimation) {
27327  ASPxClientPopupControlBase.prototype.SetWindowContentHtml.call(this, window, html, useAnimation);
27328 },
27329 AfterSetWindowContentHtml: function(index, contentContainer, useAnimation) {
27330  if(this.GetAdaptiveModalMode(index))
27331   this.TryAutoUpdatePosition(index);
27332  else
27333   this.RecalculateWindowSize(index);
27334  ASPxClientPopupControlBase.prototype.AfterSetWindowContentHtml.call(this, index, contentContainer, useAnimation);
27335  this.UpdateScrollbar(index);
27336 },
27337 UpdateAlignment: function(index) {
27338  if(this.GetIsDragged(index)) return;
27339  var element = this.GetWindowElement(index),
27340   wrapperStyle = getComputedStyle(this.GetModalWrapperElement(index)),
27341   top = ASPxClientPopupControl.AligmentCalculator.CalculateTopMargin(this.modalVerticalAlign, element.offsetHeight, this.GetDefaultVerticalOffset()),
27342   left = ASPxClientPopupControl.AligmentCalculator.CalculateLeftRightMargin(this.modalHorizontalAlign, ModalAlign.WindowLeft, wrapperStyle.paddingLeft),
27343   right = ASPxClientPopupControl.AligmentCalculator.CalculateLeftRightMargin(this.modalHorizontalAlign, ModalAlign.WindowRight, wrapperStyle.paddingRight);
27344  ASPx.SetStyles(element, {
27345   marginTop: top,
27346   marginLeft: left,
27347   marginRight: right
27348  });
27349 },
27350 GetOverlayElement: function(index) {
27351  return this.GetWindowModalElement(index);
27352 },
27353 GetModalWrapperElement: function(index) {
27354  if(!this.adaptivityEnabled) return null;
27355  var windowElement = this.GetWindowElement(index);
27356  return !!windowElement ? windowElement.parentNode : null;
27357 },
27358 GetWindowHeightWithoutContent: function(index) {
27359  var element = this.GetWindowElement(index),
27360   borderOwner = this.GetWindowBorderOwnerElement(element);
27361  return this.GetHeaderFooterHeightCore(index) + ASPx.GetVerticalBordersWidth(borderOwner);
27362 },
27363 StretchVertically: function() {
27364  this.StretchVerticallyByIndex(-1, true);
27365 },
27366 WindowStretchVertically: function(window) {
27367  var index = (window != null) ? window.index : -1;
27368  this.StretchVerticallyByIndex(index, true);
27369 },
27370 StretchVerticallyByIndex: function(index, value) {
27371  if(this.GetStretchVerticallyByIndex(index) !== value) {
27372   this.SetPropertyValue(index, "stretchVertically", value);
27373   var oldMinHeight = !!this.GetModalMinHeight(index) ? this.GetModalMinHeight(index) : 0;
27374   this.SetPropertyValue(index, "modalMinHeight", value ? "100vh" : this.minHeightBackup);
27375   this.minHeightBackup = oldMinHeight;
27376   this.UpdateHeightDimensions(index);
27377  }
27378 },
27379 SetAdaptiveMinWidth: function(minWidth) {
27380  this.SetAdaptiveMinWidthByIndex(-1, minWidth);
27381 },
27382 SetWindowAdaptiveMinWidth: function(window, minWidth) {
27383  var index = (window != null) ? window.index : -1;
27384  this.SetAdaptiveMinWidthByIndex(index, minWidth);
27385 },
27386 SetAdaptiveMaxWidth: function(maxWidth) {
27387  this.SetAdaptiveMaxWidthByIndex(-1, maxWidth);
27388 },
27389 SetWindowAdaptiveMaxWidth: function(window, maxWidth) {
27390  var index = (window != null) ? window.index : -1;
27391  this.SetAdaptiveMaxWidthByIndex(index, maxWidth);
27392 },
27393 SetAdaptiveMinHeight: function(minHeight) {
27394  this.SetAdaptiveMinHeightByIndex(-1, minHeight);
27395 },
27396 SetWindowAdaptiveMinHeight: function(window, minHeight) {
27397  var index = (window != null) ? window.index : -1;
27398  this.SetAdaptiveMinHeightByIndex(index, minHeight);
27399 },
27400 SetAdaptiveMaxHeight: function(maxHeight) {
27401  this.SetAdaptiveMaxHeightByIndex(-1, maxHeight);
27402 },
27403 SetWindowAdaptiveMaxHeight: function(window, maxHeight) {
27404  var index = (window != null) ? window.index : -1;
27405  this.SetAdaptiveMaxHeightByIndex(index, maxHeight);
27406 },
27407 SetAdaptiveHeightDimension: function(index, propertyName, value) {
27408  value = this.ConvertDimensionValueToString(value);
27409  value = value.indexOf("%") > -1 ? value.replace("%", "vh") : value;
27410  var margins = 0;
27411  if(this.stretchVertically && propertyName === "minHeight")
27412   margins = ASPx.GetTopBottomMargins(this.GetWindowElement(index));
27413  var additionalHeight = this.GetWindowHeightWithoutContent(index) + margins,
27414   contentElement = this.GetWindowContentElement(index);
27415  contentElement.style[propertyName] = "calc(" + value + " - " + additionalHeight + "px)";
27416  var iframe = this.GetWindowContentIFrameElement(index);
27417  if(!!contentElement.style.minHeight) {
27418   if(!iframe)
27419    contentElement.style.height = "auto";
27420   if(!!iframe || contentElement.offsetHeight <= ASPx.PxToInt(getComputedStyle(contentElement).minHeight) || this.HasAnyScrollBars(index))
27421    contentElement.style.height = "1px";
27422  }
27423  if(!!iframe) {
27424   iframe.style.verticalAlign = "text-bottom";
27425   iframe.style.height = "100%";
27426  }
27427 },
27428 ConvertDimensionValueToString: function(value) {
27429  if(typeof value === "number")
27430   return value + "px";
27431  if(typeof value === "string")
27432   return value;
27433 },
27434 CanBeClosedByClickOnElement: function(index, srcElement, posX, id) {
27435  return ASPxClientPopupControlBase.prototype.CanBeClosedByClickOnElement.call(this, index, srcElement, posX, id) &&
27436   (!this.GetAdaptiveModalMode(index) || srcElement != this.GetModalWrapperElement(index) || posX < srcElement.offsetWidth - ASPx.GetVerticalScrollBarWidth());
27437 },
27438 SetWindowDisplay: function(index, value) {
27439  ASPxClientPopupControlBase.prototype.SetWindowDisplay.call(this, index, value);
27440  if(this.GetAdaptiveModalMode(index)) {
27441   var wrapper = this.GetModalWrapperElement(index);
27442   ASPx.SetElementDisplay(wrapper, value, true);
27443  }
27444 },
27445 HaveSpecialDivForAnimation: function() {
27446  return ASPxClientPopupControlBase.prototype.HaveSpecialDivForAnimation.call(this) || this.adaptivityEnabled;
27447 },
27448 WindowIsModal: function(index) {
27449  return ASPxClientPopupControlBase.prototype.WindowIsModal.call(this, index) || this.GetAdaptiveModalMode(index);
27450 },
27451 RecalculateWindowSize: function(index) {
27452  var window = this.GetWindowElement(index);
27453  var displayAfterSetSize = window.style.display;
27454  this.SetClientWindowSizeCoreLite(index, this.GetWindowWidthInternal(index), this.GetWindowHeightInternal(index), this.GetIsCollapsed(index));
27455  window.style.display = displayAfterSetSize;
27456  if(this.HasAnyScrollBars(index))
27457   this.NormalizeWindowSize(index, this.GetIsMaximized(index));
27458 },
27459 GetWindowContentIFrame: function(window) {
27460  return ASPxClientPopupControlBase.prototype.GetWindowContentIFrame.call(this, window);
27461 },
27462 GetWindowContentUrl: function(window) {
27463  return ASPxClientPopupControlBase.prototype.GetWindowContentUrl.call(this, window);
27464 },
27465 SetWindowContentUrl: function(window, url) {
27466  ASPxClientPopupControlBase.prototype.SetWindowContentUrl.call(this, window, url);
27467 },
27468 RefreshDimensionsAfterCreateIframe: function(index) {
27469  if(ASPx.IsElementVisible(this.GetWindowElement(index), true)) {
27470   var windowWidth = this.GetWindowDimensionByIndex(index, true, false);
27471   var windowHeight = this.GetWindowDimensionByIndex(index, false, false);
27472   this.SetClientWindowSizeCoreLite(index, windowWidth, windowHeight);
27473  }
27474 },
27475 GetPinned: function() {
27476  return this.GetIsPinned(-1);
27477 },
27478 SetPinned: function(value) {
27479  this.SetPinCore(-1, value);
27480 },
27481 GetWindowPinned: function(window) {
27482  var index = (window != null) ? window.index : -1;
27483  return this.GetIsPinned(index);
27484 },
27485 SetWindowPinned: function(window, value) {
27486  var index = (window != null) ? window.index : -1;
27487  this.SetPinCore(index, value);
27488 },
27489 GetMaximized: function() {
27490  return this.GetIsMaximized(-1);
27491 },
27492 SetMaximized: function(value) {
27493  this.SetMaximizedCore(-1, value);
27494 },
27495 GetWindowMaximized: function(window) {
27496  var index = (window != null) ? window.index : -1;
27497  return this.GetIsMaximized(index);
27498 },
27499 SetWindowMaximized: function(window, value) {
27500  var index = (window != null) ? window.index : -1;
27501  this.SetMaximizedCore(index, value);
27502 },
27503 GetCollapsed: function() {
27504  return this.GetIsCollapsed(-1);
27505 },
27506 SetCollapsed: function(value) {
27507  this.SetCollapsedCore(-1, value);
27508 },
27509 GetWindowCollapsed: function(window) {
27510  var index = (window != null) ? window.index : -1;
27511  return this.GetIsCollapsed(index);
27512 },
27513 SetWindowCollapsed: function(window, value) {
27514  var index = (window != null) ? window.index : -1;
27515  this.SetCollapsedCore(index, value);
27516 },
27517 RefreshWindowContentUrl: function(window) {
27518  ASPxClientPopupControlBase.prototype.RefreshWindowContentUrl.call(this, window);
27519 },
27520 SetWindowContentVisible: function(index, visible) {
27521  var contentElement = this.GetWindowContentWrapperElement(index);
27522  if(contentElement)
27523   this.SetWindowPartVisibleCore(contentElement, "DXPopupWindowContentDisplay", visible);
27524 },
27525 SetWindowFooterVisible: function(index, visible) {
27526  var footerElement = this.GetWindowFooterElement(index);
27527  if(footerElement)
27528   this.SetWindowPartVisibleCore(footerElement, "DXPopupWindowFooterDisplay", visible);
27529 },
27530 SetWindowPartVisibleCore: function(partElement, displayCacheName, visible) {
27531  var nothingChanged = ASPx.IsElementVisible(partElement) && visible;
27532  if(nothingChanged) return;
27533  if(!(ASPx.IsExists(partElement[displayCacheName])))
27534   partElement[displayCacheName] = partElement.style.display;
27535  partElement.style.display = visible ? partElement[displayCacheName] : 'none';
27536 },
27537 UpdatePosition: function() {
27538  this.UpdatePositionAtElement(this.GetPopupElement(-1, this.GetLastShownPopupElementIndex(-1)));
27539 },
27540 UpdatePositionAtElement: function(popupElement) {
27541  ASPxClientPopupControlBase.prototype.UpdatePositionAtElement.call(this, popupElement);
27542 },
27543 UpdateWindowPosition: function(window) {
27544  var index = (window != null) ? window.index : -1;
27545  this.UpdateWindowPositionAtElement(window, this.GetPopupElement(index, this.GetLastShownPopupElementIndex(index)));
27546 },
27547 UpdateWindowPositionAtElement: function(window, popupElement) {
27548  ASPxClientPopupControlBase.prototype.UpdateWindowPositionAtElement.call(this, window, popupElement);
27549 },
27550 UpdateWindowPositionInternal: function(index, popupElement) {
27551  if(this.GetAdaptiveModalMode(index)) {
27552   this.TryAutoUpdatePosition(index);
27553   return;
27554  }
27555  if(!ASPxClientPopupControlBase.prototype.UpdateWindowPositionInternal.call(this, index, popupElement))
27556   this.DoShowWindowAtPos(index, ASPx.InvalidDimension, ASPx.InvalidDimension, this.GetLastShownPopupElementIndex(index), false, false);
27557 },
27558 UpdateMode: function(index) {
27559  if(!this.adaptivityEnabled) return;
27560  var currentMode = this.GetAdaptiveModalMode(index),
27561   newMode = this.NeedAdaptiveModalMode();
27562  if(currentMode != newMode) {
27563   this.SetAdaptiveModalMode(index, newMode);
27564   this.ShowWindowByIndex(-1);
27565  }
27566 },
27567 TryAutoUpdatePosition: function(index) {
27568  this.UpdateMode(index);
27569  ASPxClientPopupControlBase.prototype.TryAutoUpdatePosition.call(this, index);
27570  if(this.GetAdaptiveModalMode(index)) {
27571   this.CorrectScrollPositionOnAndroid(index, false);
27572   this.ResetWebkitScrolling(this.GetModalWrapperElement(index), 100);
27573   this.UpdateHeightDimensions(index);
27574   this.ChangeHeaderFixed(index);
27575   this.UpdateAlignment(index);
27576   this.ChangeFooterFixed(index);
27577   if(this.GetIsDragged(index) &&
27578    ASPxClientPopupControl.WindowResizeHelper.AdjustModalOnWindowResize(this.GetWindowElement(index)))
27579    this.SetIsDragged(index, false);
27580  }
27581  if(this.GetIsMaximized(index)) {
27582   this.CorrectScrollPositionOnAndroid(index, true);
27583   this.UpdateMaximizedWindowSizeOnResize(index);
27584  }
27585 },
27586 CorrectScrollPositionOnAndroid: function(index, checkElementIsInPopup) {
27587  if(ASPx.Browser.AndroidMobilePlatform) {
27588   var activeElement = this.GetActiveElementIncludingIframes();
27589   if(activeElement && (activeElement.tagName === "INPUT" || activeElement.tagName === "TEXTAREA") &&
27590    (!checkElementIsInPopup || this.GetWindowElement(index).contains(activeElement)))
27591    window.setTimeout(function() {
27592     if(activeElement.scrollIntoViewIfNeeded)
27593      activeElement.scrollIntoViewIfNeeded();
27594    }, 100);
27595  }
27596 },
27597 GetActiveElementIncludingIframes: function(document) {
27598  document = document || window.document;
27599  if(document.body === document.activeElement || document.activeElement.tagName === "IFRAME") {
27600   var iframes = document.getElementsByTagName("iframe");
27601   for(var i = 0; i < iframes.length; i++) {
27602    var focused = this.GetActiveElementIncludingIframes(iframes[i].contentWindow.document);
27603    if(focused !== false) {
27604     return focused;
27605    }
27606   }
27607  } else 
27608   return document.activeElement;
27609  return false;
27610 },
27611 OnModalWrapperScroll: function(e, index) {
27612  if(!this.GetAdaptiveModalMode(index) || this.IsWrapperScrollEventLocked()) return;
27613  this.ChangeHeaderFixed(index);
27614  this.ChangeFooterFixed(index);
27615 },
27616 OnModalWrapperTouchStart: function(e) {
27617  this.touchStartY = e.touches[0].clientY;
27618 },
27619 OnModalWrapperTouchMove: function (e, index) {
27620  if(e.touches.length > 1)
27621   return;
27622  var preventScroll = this.RequirePreventScrollForAdaptiveMode(e, index);
27623  if(preventScroll)
27624   e.preventDefault();
27625  this.touchStartY = e.touches[0].clientY;
27626 },
27627 RequirePreventScrollForAdaptiveMode: function(e, index) {
27628  var modalWrapper = this.GetModalWrapperElement(index),
27629   zoom = modalWrapper.offsetWidth / window.innerWidth,
27630   activeElement = document.activeElement,
27631   activeTyping = !!activeElement && (activeElement["type"] === "text" || activeElement["type"] === "textarea"); 
27632  if(zoom !== 1 || activeTyping)
27633   return false;
27634  var currentY = e.touches[0].clientY,
27635   preventScroll = currentY > this.touchStartY && modalWrapper.scrollTop === 0 ||
27636    currentY < this.touchStartY && modalWrapper.scrollTop + modalWrapper.clientHeight >= modalWrapper.scrollHeight;
27637  if(!preventScroll)
27638   return false;
27639  var targetElement = ASPx.Evt.GetEventSource(e),
27640   contentWrapper = this.GetWindowContentWrapperElement(index);
27641  while(targetElement && targetElement !== contentWrapper && targetElement.tagName !== 'BODY') {
27642   if(this.ElementHasScroll(targetElement))
27643    return false;
27644   targetElement = targetElement.parentNode;
27645  }
27646  return true;
27647 },
27648 ElementHasScroll: function(elem) {
27649  var style = window.getComputedStyle(elem);
27650  return ["overflow", "overflow-x", "overflow-y"].some(function(prop) {
27651   return ASPx.Data.ArrayContains(["scroll","auto"], style[prop]);
27652  });
27653 },
27654 GetFixedHeaderMaxBottom: function(index) {
27655  var contentWrapper = this.GetWindowContentWrapperElement(index);
27656  return ASPx.GetAbsolutePositionY(contentWrapper) + contentWrapper.offsetHeight;
27657 },
27658 GetFixedFooterMaxTop: function(index) {
27659  var header = this.GetWindowHeaderElement(index),
27660   contentWrapper = this.GetWindowContentWrapperElement(index),
27661   headerBottom = !!header ? ASPx.GetAbsolutePositionY(header) + header.offsetHeight : ASPx.GetAbsolutePositionY(contentWrapper);
27662  return window.innerHeight - headerBottom;
27663 },
27664 ChangeHeaderFixed: function(index) {
27665  if(!this.GetFixedHeader(index)) return;
27666  var element = this.GetWindowElement(index),
27667   modalWrapper = this.GetModalWrapperElement(index),
27668   isHeaderPartiallyHidden = modalWrapper.scrollTop > element.offsetTop,
27669   maxBottom = isHeaderPartiallyHidden ? this.GetFixedHeaderMaxBottom(index) : 0;
27670  this.FixateHeader(index, isHeaderPartiallyHidden, maxBottom);
27671 },
27672 ChangeFooterFixed: function(index) {
27673  if(!this.GetFixedFooter(index) || !this.GetWindowFooterElement(index)) return;
27674  var element = this.GetWindowElement(index),
27675   modalWrapper = this.GetModalWrapperElement(index),
27676   isFooterPartiallyHidden = element.offsetTop + element.offsetHeight - modalWrapper.scrollTop > window.innerHeight,
27677   maxTop = isFooterPartiallyHidden ? this.GetFixedFooterMaxTop(index) : 0;
27678  this.FixateFooter(index, isFooterPartiallyHidden, maxTop);
27679 },
27680 ChangeHeaderFooterFixed: function(index, elementToFix, isFixed, fixedClassName, offsetName, maxPos) {
27681  if(!elementToFix) return;
27682  var element = this.GetWindowElement(index),
27683   contentWrapper = this.GetWindowContentWrapperElement(index),
27684   changeClassNameFunc = isFixed ? ASPx.AddClassNameToElement : ASPx.RemoveClassNameFromElement,
27685   elementToFixHeight = elementToFix.offsetHeight;
27686  if(isFixed) {
27687   var borderOwner = this.GetWindowBorderOwnerElement(element),
27688    width = ASPx.GetClearClientWidth(borderOwner);
27689   ASPx.SetOffsetWidth(elementToFix, width);
27690   elementToFix.style[offsetName] = maxPos < elementToFixHeight ? maxPos - elementToFixHeight + "px" : "";
27691  } else
27692   elementToFix.style.width = "";
27693  contentWrapper.style["margin-" + offsetName] = isFixed ? elementToFixHeight + "px" : 0;
27694  changeClassNameFunc(elementToFix, fixedClassName);
27695 },
27696 FixateFooter: function(index, isFixed, maxTop) {
27697  this.ChangeHeaderFooterFixed(index, this.GetWindowFooterElement(index), isFixed, "dxFixedFooter", "bottom", maxTop);
27698 },
27699 FixateHeader: function(index, isFixed, maxBottom) {
27700  this.ChangeHeaderFooterFixed(index, this.GetWindowHeaderElement(index), isFixed, "dxFixedHeader", "top", maxBottom);
27701 },
27702 LockWrapperScrollEvent: function() {
27703  this.wrapperScrollEventLocked = true;
27704 },
27705 UnlockWrapperScrollEventEvent: function() {
27706  this.wrapperScrollEventLocked = false;
27707 },
27708 IsWrapperScrollEventLocked: function() {
27709  return this.wrapperScrollEventLocked;
27710 },
27711 ResetScroll: function(index) {
27712  if(!this.GetAdaptiveModalMode(index)) return;
27713  this.LockWrapperScrollEvent();
27714  this.GetModalWrapperElement(index).scrollTop = 0;
27715  this.UnlockWrapperScrollEventEvent();
27716 },
27717 AdjustModalElementBounds: function(element) {
27718  if(!ASPx.IsExistsElement(element)) return;
27719  ASPx.SetStyles(element, {
27720   left: 0,
27721   top: 0,
27722   right: 0,
27723   bottom: 0,
27724   width: "",
27725   height: ""
27726  });
27727 },
27728 RefreshPopupElementConnection: function() {
27729  ASPxClientPopupControlBase.prototype.RefreshPopupElementConnection.call(this);
27730 }
27731});
27732ASPxClientPopupControl.AligmentCalculator = (function() {
27733 function CalculateTopMargin(verticalAlign, elementHeight, defaultOffset) {
27734  if(verticalAlign === ModalAlign.WindowTop)
27735   return "";
27736  if(elementHeight < window.innerHeight) {
27737   var freeSpace = window.innerHeight - elementHeight;
27738   switch(verticalAlign) {
27739    case ModalAlign.WindowCenter:
27740     return freeSpace / 2;
27741    case ModalAlign.WindowBottom:
27742     return freeSpace - defaultOffset;
27743   }
27744  }
27745  return "";
27746 }
27747 function CalculateLeftRightMargin(horizontalAlign, forAligmenment, wrapperPadding) {
27748  if(horizontalAlign === forAligmenment) {
27749   if(ASPx.PxToInt(wrapperPadding) !== 0)
27750    return 0;
27751   return 10;
27752  }
27753  return "";
27754 }
27755 return {
27756  CalculateTopMargin: CalculateTopMargin,
27757  CalculateLeftRightMargin: CalculateLeftRightMargin
27758 };
27759})();
27760ASPxClientPopupControl.Animation = (function() {
27761 function GetVerticalDirection(verticalAlign, horizontalAlign) {
27762  switch(verticalAlign) {
27763   case ModalAlign.WindowTop:
27764    return -1;
27765   case ModalAlign.WindowCenter:
27766    if(horizontalAlign === ModalAlign.WindowCenter)
27767     return -1;
27768    return 0;
27769   case ModalAlign.WindowBottom:
27770    return 1;
27771  }
27772 }
27773 function GetHorizontalDirection(horizontalAlign) {
27774  switch(horizontalAlign) {
27775   case ModalAlign.WindowLeft:
27776    return -1;
27777   case ModalAlign.WindowCenter:
27778    return 0;
27779   case ModalAlign.WindowRight:
27780    return 1;
27781  }
27782 }
27783 function NeedFadeAnimation(horizontalAlign, verticalAlign, animationType, popupHorizontalAlign, popupVerticalAlign, adaptiveModalMode) {
27784  if(animationType === ASPxClientPopupControlBase.AnimationType.Auto) {
27785   if(adaptiveModalMode)
27786    return horizontalAlign === ModalAlign.WindowCenter && verticalAlign === ModalAlign.WindowCenter;
27787   else
27788    return popupHorizontalAlign === ASPx.PopupUtils.WindowCenterAlignIndicator && popupVerticalAlign === ASPx.PopupUtils.WindowCenterAlignIndicator;
27789  }
27790  return false;
27791 }
27792 return {
27793  GetVerticalDirection: GetVerticalDirection,
27794  GetHorizontalDirection: GetHorizontalDirection,
27795  NeedFadeAnimation: NeedFadeAnimation
27796 };
27797})();
27798ASPxClientPopupControl.WindowResizeHelper = (function() {
27799 var previousInnerWidth = 0,
27800  previousMargin = 0;
27801 function AdjustModalOnWindowResize(element) {
27802  var offsetLeft = element.offsetLeft,
27803   offsetWidth = element.offsetWidth,
27804   windowWidth = window.innerWidth,
27805   expectedLeft = windowWidth / 2 - offsetWidth / 2,
27806   toTheRightOfCenter = offsetLeft > expectedLeft,
27807   dw = windowWidth - previousInnerWidth,
27808   computedStyle = getComputedStyle(element),
27809   left = ASPx.PxToFloat(computedStyle.left),
27810   currentMargin = ASPx.PxToFloat(computedStyle.marginLeft),
27811   dm = currentMargin - previousMargin,
27812   newLeft = left - dm;
27813  if(toTheRightOfCenter)
27814   newLeft += dw;
27815  ASPx.SetStyles(element, { left: newLeft + "px" });
27816  if(Math.abs(offsetLeft - expectedLeft) <= 10 || dw < 0 && toTheRightOfCenter !== (element.offsetLeft > expectedLeft)) {
27817   ASPx.SetStyles(element, { left: "" });
27818   ASPx.Attr.RestoreStyleAttribute(element, "top");
27819   ASPx.Attr.RestoreStyleAttribute(element, "margin-top");
27820   return true;
27821  }
27822  previousMargin = currentMargin;
27823  previousInnerWidth = windowWidth;
27824  return false;
27825 }
27826 function Initialize(element) {
27827  previousInnerWidth = window.innerWidth;
27828  ASPx.Attr.ChangeStyleAttribute(element, "top", element.offsetTop + "px");
27829  ASPx.Attr.ChangeStyleAttribute(element, "margin-top", "0");
27830  previousMargin = ASPx.PxToFloat(getComputedStyle(element).marginLeft);
27831 }
27832 return {
27833  Initialize: Initialize,
27834  AdjustModalOnWindowResize: AdjustModalOnWindowResize
27835 };
27836})();
27837ASPxClientPopupControl.Cast = ASPxClientControl.Cast;
27838ASPxClientPopupControl.GetPopupControlCollection = function() {
27839 return aspxGetPopupControlCollection();
27840};
27841var ASPxClientPopupWindow = ASPx.CreateClass(null, {
27842 constructor: function(popupControl, index, name) {
27843  this.popupControl = popupControl;
27844  this.index = index;
27845  this.name = name;
27846 },
27847 GetHeaderImageUrl: function() {
27848  return this.popupControl.GetWindowHeaderImageUrl(this.index);
27849 },
27850 SetHeaderImageUrl: function(value) {
27851  this.popupControl.SetWindowHeaderImageUrl(this.index, value);
27852 },
27853 GetFooterImageUrl: function() {
27854  return this.popupControl.GetWindowFooterImageUrl(this.index);
27855 },
27856 SetFooterImageUrl: function(value) {
27857  this.popupControl.SetWindowFooterImageUrl(this.index, value);
27858 },
27859 GetHeaderNavigateUrl: function() {
27860  return this.popupControl.GetWindowHeaderNavigateUrl(this.index);
27861 },
27862 SetHeaderNavigateUrl: function(value) {
27863  this.popupControl.SetWindowHeaderNavigateUrl(this.index, value);
27864 },
27865 GetFooterNavigateUrl: function() {
27866  return this.popupControl.GetWindowFooterNavigateUrl(this.index);
27867 },
27868 SetFooterNavigateUrl: function(value) {
27869  this.popupControl.SetWindowFooterNavigateUrl(this.index, value);
27870 },
27871 GetHeaderText: function() {
27872  return this.popupControl.GetWindowHeaderText(this.index);
27873 },
27874 SetHeaderText: function(value) {
27875  this.popupControl.SetWindowHeaderText(this.index, value);
27876 },
27877 GetFooterText: function() {
27878  return this.popupControl.GetWindowFooterText(this.index);
27879 },
27880 SetFooterText: function(value) {
27881  this.popupControl.SetWindowFooterText(this.index, value);
27882 }
27883});
27884var ASPxClientPopupWindowEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
27885 constructor: function(window) {
27886  this.constructor.prototype.constructor.call(this);
27887  this.window = window;
27888 }
27889});
27890var ASPxClientPopupWindowCancelEventArgs = ASPx.CreateClass(ASPxClientCancelEventArgs, {
27891 constructor: function(window, closeReason) {
27892  this.constructor.prototype.constructor.call(this);
27893  this.window = window;
27894  this.closeReason = closeReason;
27895 }
27896});
27897var ASPxClientPopupWindowCloseUpEventArgs = ASPx.CreateClass(ASPxClientPopupWindowEventArgs, {
27898 constructor: function(window, closeReason) {
27899  this.constructor.prototype.constructor.call(this, window);
27900  this.closeReason = closeReason;
27901 }
27902});
27903var ASPxClientPopupWindowResizeEventArgs = ASPx.CreateClass(ASPxClientPopupWindowEventArgs, {
27904 constructor: function(window, resizeState) {
27905  this.constructor.prototype.constructor.call(this, window);
27906  this.resizeState = resizeState;
27907 }
27908});
27909var ASPxClientPopupWindowPinnedChangedEventArgs = ASPx.CreateClass(ASPxClientPopupWindowEventArgs, {
27910 constructor: function(window, pinned) {
27911  this.constructor.prototype.constructor.call(this, window);
27912  this.pinned = pinned;
27913 }
27914});
27915var ASPxClientPopupControlCollection = ASPx.CreateClass(ASPxClientControlCollection, {
27916 constructor: function() {
27917  this.constructor.prototype.constructor.call(this);
27918  this.draggingControl = null;
27919  this.draggingWindowIndex = -1;
27920  this.gragXOffset = 0;
27921  this.gragYOffset = 0;
27922  this.visibleModalElements = [];
27923  this.visiblePopupWindowIds = [];
27924  this.windowResizeByBodyScrollVisibilityChangingLockCount = 0;
27925  this.savedBodyWidth = 0;
27926  this.savedBodyHeight = 0;
27927  this.overControl = null;
27928  this.overWindowIndex = -1;
27929  this.overXPos = ASPx.InvalidPosition;
27930  this.overYPos = ASPx.InvalidPosition;
27931  this.appearTimerID = -1;
27932  this.disappearTimerID = -1;
27933  this.scrollEventLockCount = 0;
27934  this.currentActiveWindowElement = null;
27935  this.resizeControl = null;
27936  this.resizeIndex = -2;
27937  this.resizeCursor = "";
27938  this.resizePanel = null;
27939  this.selectBanned = false;
27940  this.pcWindowsAreRestrictedByDocumentWindow = true;
27941  this.docScrollLeft = -1;
27942  this.docScrollTop = -1;
27943  this.EnsureSaveScrollState();
27944 },
27945 GetCollectionType: function(){
27946  return "Popup";
27947 },
27948 Remove: function(popupControl) {
27949  for(var i = this.visibleModalElements.length - 1; i >= 0; i--) {
27950   var modalElement = this.visibleModalElements[i];
27951   if(modalElement && modalElement.DXModalPopupControl === popupControl)
27952    this.UnregisterVisibleModalElement(modalElement);
27953  }
27954  for(var j = this.visiblePopupWindowIds.length - 1; j >= 0; j--) {
27955   var id = this.visiblePopupWindowIds[j];
27956   if(!ASPx.IsExists(id)) continue;
27957   var popupWindow = this.GetPopupWindowFromID(id);
27958   if(popupWindow.popupControl === popupControl) {
27959    var windowElement = popupControl.GetWindowElement(popupWindow.windowIndex);
27960    if(windowElement)
27961     this.UnregisterVisibleWindow(windowElement);
27962    else
27963     ASPx.Data.ArrayRemove(this.visiblePopupWindowIds, id);
27964   }
27965  }
27966  ASPxClientControlCollection.prototype.Remove.call(this, popupControl);
27967 },
27968 EnsureSaveScrollState: function() {
27969  if(ASPx.documentLoaded && this.docScrollLeft < 0 && this.docScrollTop < 0)
27970   this.SaveScrollState();
27971 },
27972 GetPopupWindowFromID: function(id) {
27973  var pos = id.lastIndexOf(ASPx.PCWIdSuffix);
27974  var name = id.substring(0, pos);
27975  var index = id.substr(pos + ASPx.PCWIdSuffix.length);
27976  var popupControl = aspxGetPopupControlCollection().Get(name);
27977  return { popupControl: popupControl, windowIndex: index };
27978 },
27979 DoHideAllWindows: function(srcElement, excptId, applyToAll, closeReason, posX) {
27980  for(var i = this.visiblePopupWindowIds.length - 1; i >= 0; i--) {
27981   var id = this.visiblePopupWindowIds[i];
27982   if(id == excptId) continue;
27983   var popupWindow = this.GetPopupWindowFromID(id),
27984    windowIndex = popupWindow.windowIndex,
27985    popupControl = popupWindow.popupControl;
27986   if(!popupControl.CanBeClosedByClickOnElement(windowIndex, srcElement, posX, id)) continue;
27987   if(popupControl != null) {
27988    var popupWindowZIndexArray = ASPx.PopupUtils.GetElementZIndexArray(popupControl.GetWindowElement(windowIndex));
27989    var isPopupHigherSrcElement = ASPx.PopupUtils.IsHigher(popupWindowZIndexArray, ASPx.PopupUtils.GetElementZIndexArray(srcElement)) || !popupControl.HasDefaultWindow();
27990    var windowCloseAction = popupControl.GetWindowCloseAction(windowIndex);
27991    if ((windowCloseAction != "CloseButton" && windowCloseAction != "None") && isPopupHigherSrcElement || applyToAll)
27992     popupControl.DoHideWindow(parseInt(windowIndex), false, closeReason);
27993   }
27994  }
27995 },
27996 DoShowAtCurrentPos: function(name, index, popupElementIndex, evtClone) {
27997  var pc = this.Get(name);
27998  if(pc != null && !pc.InternalIsWindowVisible(index))
27999   pc.DoShowWindowCore(index, this.overXPos, this.overYPos, popupElementIndex, true, true, evtClone, ASPxClientPopupControlCloseReason.MouseOut);
28000 },
28001 WindowZIndexWasInitialized: function(zIndex, pcZIndex) {
28002  return pcZIndex <= zIndex;
28003 },
28004 ActivateWindowElement: function(element, evt, popupType, defZIndex, zIndex) {
28005  var maxZIndex = this.GetMaxZIndex(popupType, defZIndex),
28006   topZIndex = this.WindowZIndexWasInitialized(maxZIndex, zIndex) ? parseInt(maxZIndex) : zIndex;
28007  if(this.WindowZIndexWasInitialized(element.style.zIndex, zIndex) && element.style.zIndex != topZIndex) {
28008   this.DeleteWindowFromZIndexOrder(element);
28009  }
28010  if(!this.WindowZIndexWasInitialized(element.style.zIndex, zIndex))
28011   topZIndex += 2;
28012  var popupWindow = this.GetPopupWindowFromID(element.id);
28013  popupWindow.popupControl.SetWindowElementZIndex(element, topZIndex);
28014  var pcWElementEventSource = ASPx.PopupUtils.FindEventSourceParentByTestFunc(evt, aspxTestPopupWindowElement);
28015  if(!evt || (evt && pcWElementEventSource == element)) { 
28016   if(this.GetCurrentActiveWindowElement() != element) {
28017    this.RefreshTabIndexes(false);
28018    this.SaveCurrentActiveWindowElement(element);
28019   }
28020  }
28021 },
28022 RefreshTabIndexes: function(forceRecalculate) {
28023  var topModalWindow = this.GetTopModalWindow();
28024  if(topModalWindow != null || forceRecalculate) {
28025   var topModalWindowZIndexArray = ASPx.PopupUtils.GetElementZIndexArray(topModalWindow);
28026   this.CalculateTabIndexes(topModalWindowZIndexArray);
28027  }
28028 },
28029 ElementHasTabIndex: function(element) {
28030  return ASPx.IsExists(ASPx.Attr.GetAttribute(element, "tabindex"));
28031 },
28032 IsElementCanBeActive: function(element) { 
28033  return element.tagName === "INPUT" || element.tagName === "A" ||
28034   element.tagName === "BUTTON" || element.tagName === "TEXTAREA" ||
28035   element.tagName === "SELECT" || this.ElementHasTabIndex(element);
28036 },
28037 GetCanBeActiveElements: function() { 
28038  var elements = document.getElementsByTagName("*"),
28039   canBeActiveElements = [];
28040  for(var i = 0; i < elements.length; i++) {
28041   if(this.IsElementCanBeActive(elements[i]))
28042    canBeActiveElements.push(elements[i]);
28043  }
28044  return canBeActiveElements;
28045 },
28046 GetEditableDivs: function(){
28047  if(document.querySelectorAll)
28048   return document.querySelectorAll("div[contenteditable=true]");
28049  var editableDivs = [ ];
28050  var allDivs = document.getElementsByTagName("DIV");
28051  for(var i = 0; i < allDivs.length; i++){
28052   var div = allDivs[i];
28053   if(div.getAttribute("contenteditable") == 'true')
28054    editableDivs.push(div);
28055  }
28056  return editableDivs;
28057 },
28058 CalculateTabIndexes: function(topModalWindowZIndexArray) {
28059  var elements = this.GetCanBeActiveElements();
28060  for(var i = 0; i < elements.length; i++) {
28061   var currentElementZIndexArray = ASPx.PopupUtils.GetElementZIndexArray(elements[i]);
28062   if(ASPx.PopupUtils.IsHigher(currentElementZIndexArray, topModalWindowZIndexArray))
28063    ASPx.Attr.RestoreTabIndexAttribute(elements[i]);
28064   else
28065    ASPx.Attr.ChangeTabIndexAttribute(elements[i]);
28066  }
28067 },
28068 PopupWindowIsModalByVisibleIndex: function(visiblePopupWindowIndex) {
28069  return this.PopupWindowIsModalByID(this.visiblePopupWindowIds[visiblePopupWindowIndex]);
28070 },
28071 PopupWindowIsModalByID: function(windowElementID) {
28072  var popupWindow = this.GetPopupWindowFromID(windowElementID);
28073  return popupWindow.popupControl.WindowIsModal(popupWindow.windowIndex);
28074 },
28075 SaveCurrentActiveWindowElement: function(windowElement) {
28076  this.currentActiveWindowElement = windowElement;
28077 },
28078 SkipCurrentActiveWindowElement: function(element) {
28079  if(element == this.GetCurrentActiveWindowElement())
28080   this.SaveCurrentActiveWindowElement(null);
28081 },
28082 GetCurrentActiveWindowElement: function() {
28083  return this.currentActiveWindowElement;
28084 },
28085 GetMaxZIndex: function (type, defaultZIndex) {
28086  var maxZIndex = defaultZIndex;
28087  for(var i = 0; i < this.visiblePopupWindowIds.length; i++) {
28088   var id = this.visiblePopupWindowIds[i];
28089   if(type !== undefined && this.GetPopupWindowFromID(id).popupControl.GetPopupType() !== type)
28090    continue;
28091   var currentWindow = ASPx.GetElementById(id);
28092   if(!!currentWindow && ASPx.IsElementVisible(currentWindow) && currentWindow.style && currentWindow.style.zIndex > maxZIndex)
28093    maxZIndex = currentWindow.style.zIndex;
28094  }
28095  return maxZIndex;
28096 },
28097 GetTopModalWindow: function() {
28098  return this.GetTopWindow(true);
28099 },
28100 GetTopWindow: function(onlyModal) {
28101  var topWindow = null;
28102  var topWindowZIndexArray = null;
28103  for(var i = 0; i < this.visiblePopupWindowIds.length; i++) {
28104   var currentWindow = ASPx.GetElementById(this.visiblePopupWindowIds[i]);
28105   if(onlyModal && !this.PopupWindowIsModalByVisibleIndex(i))
28106    continue;
28107   if(ASPx.IsElementVisible(currentWindow)) {
28108    var currentWindowZIndexArray = ASPx.PopupUtils.GetElementZIndexArray(currentWindow);
28109    if(topWindow == null || ASPx.PopupUtils.IsHigher(currentWindowZIndexArray, topWindowZIndexArray)) {
28110     topWindow = currentWindow;
28111     topWindowZIndexArray = currentWindowZIndexArray;
28112    }
28113   }
28114  }
28115  return topWindow;
28116 },
28117 DeleteWindowFromZIndexOrder: function(element) {
28118  for(var i = this.visiblePopupWindowIds.length - 1; i >= 0; i--) {
28119   var windowElement = ASPx.GetElementById(this.visiblePopupWindowIds[i]);
28120   if(!windowElement)
28121    ASPx.Data.ArrayRemoveAt(this.visiblePopupWindowIds, i);
28122   else if(windowElement.style.zIndex > element.style.zIndex) {
28123    var popupWindow = this.GetPopupWindowFromID(this.visiblePopupWindowIds[i]);
28124    popupWindow.popupControl.SetWindowElementZIndex(windowElement, windowElement.style.zIndex - 2);
28125   }
28126  }
28127 },
28128 AdjustModalElementsBounds: function() {
28129  for(var i = 0; i < this.visibleModalElements.length; i++)
28130   this.visibleModalElements[i].DXModalPopupControl.AdjustModalElementBounds(this.visibleModalElements[i]);
28131 },
28132 ClearAppearTimer: function() {
28133  this.appearTimerID = ASPx.Timer.ClearTimer(this.appearTimerID);
28134 },
28135 ClearDisappearTimer: function() {
28136  this.disappearTimerID = ASPx.Timer.ClearTimer(this.disappearTimerID);
28137 },
28138 IsAppearTimerActive: function() {
28139  return this.appearTimerID > -1;
28140 },
28141 IsDisappearTimerActive: function() {
28142  return this.disappearTimerID > -1;
28143 },
28144 SetAppearTimer: function(name, index, popupElementIndex, timeout, evt) {
28145  var evtClone = ASPx.CloneObject(evt);
28146  this.appearTimerID = window.setTimeout(function() {
28147   aspxGetPopupControlCollection().DoShowAtCurrentPos(name, index, popupElementIndex, evtClone);
28148  }, timeout);
28149 },
28150 SetDisappearTimer: function(name, index, timeout) {
28151  this.disappearTimerID = window.setTimeout(function() {
28152   aspxGetPopupControlCollection().OnPWDisappearTimer(name, index);
28153  }, timeout);
28154 },
28155 GetDocScrollDifference: function() {
28156  return new _aspxScrollDifference(ASPx.GetDocumentScrollLeft() - this.docScrollLeft, ASPx.GetDocumentScrollTop() - this.docScrollTop);
28157 },
28158 IsDocScrolled: function(scroll) {
28159  return scroll.horizontal != 0 || scroll.vertical != 0;
28160 },
28161 SaveScrollState: function() {
28162  this.docScrollLeft = ASPx.GetDocumentScrollLeft();
28163  this.docScrollTop = ASPx.GetDocumentScrollTop();
28164 },
28165 InitDragObject: function(control, index, x, y, xClientCorrection, yClientCorrection) {
28166  this.draggingControl = control;
28167  this.draggingWindowIndex = index;
28168  this.gragXOffset = x;
28169  this.gragYOffset = y;
28170  this.xClientCorrection = xClientCorrection;
28171  this.yClientCorrection = yClientCorrection;
28172  this.SetDocumentSelectionBan(true);
28173 },
28174 InitOverObject: function(control, index, evt) {
28175  this.overControl = control;
28176  this.overWindowIndex = index;
28177  if(evt)
28178   this.SaveCurrentMouseOverPos(evt);
28179 },
28180 InitResizeObject: function(control, index, cursor, resizePanel) {
28181  this.resizeControl = control;
28182  this.resizeIndex = index;
28183  this.resizeCursor = cursor;
28184  this.resizePanel = resizePanel;
28185  this.SetDocumentSelectionBan(true);
28186 },
28187 SetDocumentSelectionBan: function(value) {
28188  if(this.selectBanned === value)
28189   return;
28190  this.selectBanned = value;
28191  if(ASPx.Browser.WebKitFamily) {
28192   if(value) {
28193    if(!this.webkitUserSelectBackup && document.body.style.webkitUserSelect)
28194     this.webkitUserSelectBackup = document.body.style.webkitUserSelect;
28195    document.body.style.webkitUserSelect = "none";
28196   } else {
28197    if(this.webkitUserSelectBackup) {
28198     document.body.style.webkitUserSelect = this.webkitUserSelectBackup;
28199     delete this.webkitUserSelectBackup;
28200    } else
28201     document.body.style.webkitUserSelect = "auto";
28202   }
28203  }
28204 },
28205 IsResizeInint: function() {
28206  return this.resizeControl != null;
28207 },
28208 ClearDragObject: function() {
28209  this.draggingControl = null;
28210  this.draggingWindowIndex = -1;
28211  this.gragXOffset = 0;
28212  this.gragYOffset = 0;
28213  this.SetDocumentSelectionBan(this.resizeControl != null);
28214 },
28215 ClearResizeObject: function() {
28216  this.resizeControl = null;
28217  this.resizeIndex = -2;
28218  this.resizeCursor = "";
28219  this.SetDocumentSelectionBan(this.draggingControl != null);
28220  this.resizePanel.parentNode.removeChild(this.resizePanel);
28221 },
28222 Drag: function(evt) {
28223  if(ASPx.tableColumnResizing || ASPx.currentDragHelper || !ASPx.Evt.IsLeftButtonPressed(evt)) return;
28224  var x = ASPx.Evt.GetEventX(evt);
28225  var y = ASPx.Evt.GetEventY(evt);
28226  if(this.pcWindowsAreRestrictedByDocumentWindow && ASPx.PopupUtils.CoordinatesInDocumentRect(x, y)) {
28227   x += this.gragXOffset;
28228   y += this.gragYOffset;
28229   this.draggingControl.OnDrag(this.draggingWindowIndex, x, y, this.xClientCorrection, this.yClientCorrection, evt);
28230   if(ASPx.Browser.WebKitTouchUI)
28231    evt.preventDefault();
28232  }
28233 },
28234 DragStop: function() {
28235  this.draggingControl.OnDragStop(this.draggingWindowIndex);
28236  this.ClearDragObject();
28237 },
28238 ResizeStop: function(evt) {
28239  this.resizeControl.OnResizeStop(evt, this.resizeIndex, this.resizeCursor, this.resizePanel);
28240  aspxGetPopupControlCollection().ClearResizeObject();
28241 },
28242 setIframesMouseMoveEnabled: function(enabled) {
28243  for(var i = 0; i < this.visiblePopupWindowIds.length; i++) {
28244   var popupWindow = this.GetPopupWindowFromID(this.visiblePopupWindowIds[i]);
28245   var popupControl = popupWindow.popupControl;
28246   if(popupControl) {
28247    var iframe = popupControl.GetWindowContentIFrameElement(popupWindow.windowIndex);
28248    if(iframe) {
28249     iframe.style.pointerEvents = enabled ? "" : "none";
28250     if(ASPx.Browser.IE && ASPx.Browser.MajorVersion < 11) {
28251      if(enabled)
28252       popupControl.RemoveIframeCoverDiv(iframe, popupWindow.windowIndex);
28253      else
28254       popupControl.CreateIframeCoverDiv(iframe, popupWindow.windowIndex);
28255     }
28256    }
28257   }
28258  }
28259 },
28260 OnPWMouseMove: function(evt, name, index) {
28261  if(this.draggingControl == null &&
28262   this.overControl == null &&
28263   this.resizeControl == null) {
28264   var pc = aspxGetPopupControlCollection().Get(name);
28265   if(pc != null) pc.OnMouseMove(evt, index);
28266  }
28267 },
28268 OnPWMouseOver: function(evt) {
28269  if(!this.overControl || this.draggingControl) return;
28270  if(this.IsOverPopupWindow(evt))
28271   this.ClearDisappearTimer();
28272 },
28273 IsOverPopupWindow: function(evt) {
28274  return ASPx.PopupUtils.FindEventSourceParentByTestFunc(evt, aspxTestPopupControlOverElement) != null;
28275 },
28276 OnDocumentKeyDown: function(evt) {
28277  var windowElement = this.GetTopWindow(false);
28278  if(windowElement) {
28279   var window = this.GetPopupWindowFromID(windowElement.id);
28280   if(window.popupControl);
28281    window.popupControl.OnDocumentKeyDown(evt, windowElement);
28282  }
28283 },
28284 OnDocumentMouseDown: function(evt) {
28285  var popupElement = ASPx.PopupUtils.FindEventSourceParentByTestFunc(evt, aspxTestPopupControlElement);
28286  var excptId = popupElement == null ? "" :
28287   popupElement.DXPopupElementControl.GetWindowElementId(popupElement.DXPopupWindowIndex);
28288  this.OnMouseDownCore(evt, excptId);
28289 },
28290 OnMouseDown: function(evt) {
28291  this.OnMouseDownCore(evt, "");
28292 },
28293 OnMouseDownCore: function(evt, excptId) {
28294  var srcElement = ASPx.Evt.GetEventSource(evt);
28295  this.DoHideAllWindows(srcElement, excptId, false, ASPxClientPopupControlCloseReason.OuterMouseClick, ASPx.Evt.GetEventX(evt));
28296  aspxGetPopupControlCollection().ClearAppearTimer();
28297 },
28298 OnMouseMove: function(evt) {
28299  if(ASPx.Browser.WebKitTouchUI && ASPx.TouchUIHelper.isGesture)
28300   return;
28301  if(this.draggingControl != null) {
28302   this.Drag(evt);
28303  }
28304  else if(this.overControl != null) {
28305   this.OnMouseOver(evt);
28306  }
28307  else if(this.resizeControl != null) {
28308   if(ASPx.Browser.IE && !ASPx.Evt.IsLeftButtonPressed(evt))
28309    this.ResizeStop(evt);
28310   else
28311    this.resizeControl.OnResize(evt, this.resizeIndex, this.resizeCursor, this.resizePanel);
28312  }
28313 },
28314 OnMouseOver: function(evt) {
28315  var element = ASPx.PopupUtils.FindEventSourceParentByTestFunc(evt, aspxTestPopupControlOverElement);
28316  var curPopupElement = this.overControl.GetWindowCurrentPopupElementByIndex(this.overWindowIndex);
28317  var popup = element != null ? element.DXPopupElementControl : null;
28318  var isPopupActionMouseOver = popup && popup.GetWindowPopupAction(this.overWindowIndex) == 'MouseOver';
28319  var isCurPopupElement = element !== null && element === curPopupElement;
28320  var isCurPopupWindow = element != null && element.id === this.overControl.GetWindowElementId(this.overWindowIndex);
28321  var isCurPopupElementOrCurPopupWindow = isCurPopupElement || isCurPopupWindow || isPopupActionMouseOver;
28322  if(isCurPopupElementOrCurPopupWindow) {
28323   var clearTimer = true;
28324   popup = element.DXPopupElementControl;
28325   if(popup && popup.GetLastShownPopupElementIndex(element.DXPopupWindowIndex) != element.DXPopupElementIndex)
28326    clearTimer = false;
28327   if(clearTimer)
28328    this.ClearDisappearTimer();
28329   this.SaveCurrentMouseOverPos(evt);
28330   return;
28331  }
28332  this.OnMouseOut();
28333 },
28334 OnMouseOut: function(evt) {
28335  if(!this.overControl || this.draggingControl) return;
28336  this.ClearAppearTimer();
28337  var windowCloseAction = this.overControl.GetWindowCloseAction(this.overWindowIndex);
28338  if(windowCloseAction == "MouseOut" && this.overControl.InternalIsWindowVisible(this.overWindowIndex)) {
28339   if(!this.IsDisappearTimerActive() && this.IsDisappearAllowedByMouseOut(evt))
28340    this.SetDisappearTimer(this.overControl.name, this.overWindowIndex, this.overControl.disappearAfter);
28341  }
28342  else
28343   this.OverStop();
28344 },
28345 IsDisappearAllowedByMouseOut: function(evt) {
28346  return ASPx.Browser.Firefox ? !this.IsOverPopupWindow(evt) : true;  
28347 },
28348 OnMouseUp: function(evt) {
28349  if(this.draggingControl != null)
28350   this.DragStop();
28351  if(this.resizeControl != null)
28352   this.ResizeStop(evt);
28353 },
28354 OnResize: function(evt) {
28355  this.AutoUpdateElementsPosition();
28356  this.AdjustModalElementsBounds();
28357 },
28358 OnScroll: function(evt) {
28359  if(this.scrollEventLockCount > 0)
28360   return;
28361  var scroll = this.GetDocScrollDifference();
28362  if(this.IsDocScrolled(scroll)) { 
28363   this.CorrectPositionAtScroll(scroll);
28364   this.AdjustModalElementsBounds();
28365   this.SaveScrollState();
28366  }
28367  this.CalculateDocumentDimensionsWithoutPinnedWindows(evt);
28368  this.FireScrollEventToWindows(evt);
28369 },
28370 GetSavedBodyWidth: function() {
28371  if(this.savedBodyWidth == 0)
28372   this.CalculateDocumentDimensionsWithoutPinnedWindows();
28373  return this.savedBodyWidth;
28374 },
28375 GetSavedBodyHeight: function() {
28376  if(this.savedBodyHeight == 0)
28377   this.CalculateDocumentDimensionsWithoutPinnedWindows();
28378  return this.savedBodyHeight;
28379 },
28380 HidePinnedPopupsThatOutFromViewPort: function() {
28381  var popupsToRestoreVisible = [];
28382  for(var i = 0; i < this.visiblePopupWindowIds.length; i++) {
28383   var popupWindow = this.GetPopupWindowFromID(this.visiblePopupWindowIds[i]);
28384   var popupControl = popupWindow.popupControl;
28385   if(!popupControl.needToHidePinnedOutFromViewPort(popupWindow.windowIndex))
28386    continue;
28387   var element = popupControl.GetWindowElement(popupWindow.windowIndex);
28388   if(!element) continue;
28389   var restoreData = {};
28390   restoreData.element = element;
28391   restoreData.display = element.style.display;
28392   element.style.display = "none";
28393   popupsToRestoreVisible.push(restoreData);
28394  }
28395  return popupsToRestoreVisible;
28396 },
28397 RestorePinnedPopupsThatOutFromViewPort: function(popupsToRestoreVisible) {
28398  if(popupsToRestoreVisible.length > 0) {
28399   for(var i = 0; i < popupsToRestoreVisible.length; i++) {
28400    var restoreData = popupsToRestoreVisible[i];
28401    restoreData.element.style.display = restoreData.display;
28402   }
28403  }
28404 },
28405 CalculateDocumentDimensionsWithoutPinnedWindows: function(evt) { 
28406  var popupsToRestoreVisible = [];
28407  var needToHideRestorePopupsThatOutFromViewPort = !!evt && ASPx.Evt.GetEventSource(evt) == document;
28408  if(needToHideRestorePopupsThatOutFromViewPort)
28409   popupsToRestoreVisible = this.HidePinnedPopupsThatOutFromViewPort();
28410  this.savedBodyWidth = ASPx.GetDocumentWidth();
28411  this.savedBodyHeight = ASPx.GetDocumentHeight();
28412  if(needToHideRestorePopupsThatOutFromViewPort)
28413   this.RestorePinnedPopupsThatOutFromViewPort(popupsToRestoreVisible);
28414 },
28415 FireScrollEventToWindows: function(evt) {
28416  for(var i = 0; i < this.visiblePopupWindowIds.length; i++) {
28417   var popupWindow = this.GetPopupWindowFromID(this.visiblePopupWindowIds[i]);
28418   var popupControl = popupWindow.popupControl;
28419   popupControl.OnScroll(evt, popupWindow.windowIndex);
28420  }
28421 },
28422 CalculateDocumentDimensionsWithoutPinnedWindowsOldIE: function(onCalculateFinished, evt) {  
28423  var popupsToRestoreVisible = [];
28424  var needToHideRestorePopupsThatOutFromViewPort = !!evt && ASPx.Evt.GetEventSource(evt) == document;
28425  if(needToHideRestorePopupsThatOutFromViewPort)
28426   popupsToRestoreVisible = this.HidePinnedPopupsThatOutFromViewPort();
28427  this.scrollEventLockCount++;
28428  window.setTimeout(function() {
28429   this.savedBodyWidth = ASPx.GetDocumentWidth();
28430   this.savedBodyHeight = ASPx.GetDocumentHeight();
28431   if(needToHideRestorePopupsThatOutFromViewPort)
28432    this.RestorePinnedPopupsThatOutFromViewPort(popupsToRestoreVisible);
28433   if(onCalculateFinished)
28434    window.setTimeout(function() { onCalculateFinished(); }.aspxBind(this), 0);
28435   this.scrollEventLockCount--;
28436  }.aspxBind(this), 0);
28437 },
28438 FireScrollEventToWindowsOldIE: function(evt) {
28439  this.scrollEventLockCount++;
28440  this.FireScrollEventToWindows(evt);
28441  this.scrollEventLockCount--;
28442 },
28443 LockScrollEvent: function() {
28444  this.scrollEventLockCount++;
28445 },
28446 UnlockScrollEvent: function() {
28447  this.scrollEventLockCount--;
28448 },
28449 CorrectPositionAtScroll: function(scroll) {
28450  for(var i = 0; i < this.visiblePopupWindowIds.length; i++) {
28451   var popupWindow = this.GetPopupWindowFromID(this.visiblePopupWindowIds[i]);
28452   var popupControl = popupWindow.popupControl;
28453   if(popupControl != null && popupControl.InternalIsWindowVisible(popupWindow.windowIndex)) {
28454    if(popupControl.GetAutoUpdatePosition(popupWindow.windowIndex))
28455     popupWindow.popupControl.TryAutoUpdatePosition(popupWindow.windowIndex);
28456   }
28457  }
28458 },
28459 OnSelectStart: function() {
28460  return !this.selectBanned;
28461 },
28462 OverStop: function() {
28463  this.overControl = null;
28464  this.overWindowIndex = -1;
28465 },
28466 OnPWDisappearTimer: function(name, index) {
28467  var pc = this.Get(name);
28468  if(pc != null) {
28469   if(!pc.DoHideWindow(index, false, ASPxClientPopupControlCloseReason.MouseOut))
28470    this.OverStop();
28471   this.ClearDisappearTimer();
28472  }
28473 },
28474 SaveCurrentMouseOverPos: function(evt) {
28475  this.overXPos = ASPx.Evt.GetEventX(evt);
28476  this.overYPos = ASPx.Evt.GetEventY(evt);
28477 },
28478 RegisterVisibleModalElement: function(element) {
28479  if(ASPx.Data.ArrayIndexOf(this.visibleModalElements, element) == -1)
28480   this.visibleModalElements.push(element);
28481 },
28482 UnregisterVisibleModalElement: function(element) {
28483  ASPx.Data.ArrayRemove(this.visibleModalElements, element);
28484 },
28485 RegisterVisibleWindow: function(element, popupControl, index) {
28486  if(ASPx.Data.ArrayIndexOf(this.visiblePopupWindowIds, element.id) == -1) {
28487   this.visiblePopupWindowIds.push(element.id);
28488   if(popupControl && popupControl.GetWindowCloseAction(index) == "MouseOut")
28489    aspxGetPopupControlCollection().InitOverObject(popupControl, index, null);
28490   this.OnRegisteredVisibleWindow(element);
28491  }
28492 },
28493 OnRegisteredVisibleWindow: function(element) {
28494  var elementIndex = ASPx.Data.ArrayIndexOf(this.visiblePopupWindowIds, element.id);
28495  if(this.PopupWindowIsModalByVisibleIndex(elementIndex))
28496   ASPx.PopupUtils.RemoveFocus(element);
28497 },
28498 UnregisterVisibleWindow: function(element) {
28499  this.DeleteWindowFromZIndexOrder(element);
28500  ASPx.Data.ArrayRemove(this.visiblePopupWindowIds, element.id);
28501  var forceRecalculate = this.PopupWindowIsModalByID(element.id);
28502  this.RefreshTabIndexes(forceRecalculate);
28503  this.SkipCurrentActiveWindowElement(element);
28504 },
28505 AutoUpdateElementsPosition: function() {
28506  for(var i = 0; i < this.visiblePopupWindowIds.length; i++) {
28507   var popupWindow = this.GetPopupWindowFromID(this.visiblePopupWindowIds[i]);
28508   var popupControl = popupWindow.popupControl;
28509   if(popupControl != null && popupControl.InternalIsWindowVisible(popupWindow.windowIndex))
28510    popupControl.TryAutoUpdatePosition(popupWindow.windowIndex);
28511  }
28512 },
28513 LockWindowResizeByBodyScrollVisibilityChanging: function() {
28514  this.windowResizeByBodyScrollVisibilityChangingLockCount++;
28515 },
28516 UnlockWindowResizeByBodyScrollVisibilityChanging: function() {
28517  this.windowResizeByBodyScrollVisibilityChangingLockCount--;
28518 },
28519 WindowResizeByBodyScrollVisibilityChangingLocked: function() {
28520  return this.windowResizeByBodyScrollVisibilityChangingLockCount > 0;
28521 },
28522 HideAllWindows: function() {
28523  this.DoHideAllWindows(null, "", true, ASPxClientPopupControlCloseReason.API, 0);
28524 }
28525});
28526var ASPxClientPopupControlResizeState = {
28527 Resized: 0,
28528 Collapsed: 1,
28529 Expanded: 2,
28530 Maximized: 3,
28531 RestoredAfterMaximized: 4
28532};
28533var ASPxClientPopupControlCloseReason = {
28534 API: "API",
28535 CloseButton: "CloseButton",
28536 OuterMouseClick: "OuterMouseClick",
28537 MouseOut: "MouseOut",
28538 Escape: "Escape"
28539};
28540var popupControlCollection = null;
28541function aspxGetPopupControlCollection() {
28542 if(popupControlCollection == null)
28543  popupControlCollection = new ASPxClientPopupControlCollection();
28544 return popupControlCollection;
28545}
28546function _aspxScrollDifference(horizontal, vertical) {
28547 this.horizontal = horizontal;
28548 this.vertical = vertical;
28549}
28550function aspxPWEMOver(evt) {
28551 aspxGetPopupControlCollection().OnPWMouseOver(evt);
28552}
28553ASPx.PWHMDown = function(evt) {
28554 return ASPx.Evt.CancelBubble(evt);
28555};
28556ASPx.PWCBClick = function(evt, name, index) {
28557 var pc = aspxGetPopupControlCollection().Get(name);
28558 if(pc != null) pc.OnPWHBClickCore(evt, index, "OnCloseButtonClick");
28559};
28560ASPx.PWPBClick = function(evt, name, index) {
28561 var pc = aspxGetPopupControlCollection().Get(name);
28562 if(pc != null) pc.OnPWHBClickCore(evt, index, "OnPinButtonClick");
28563};
28564ASPx.PWRBClick = function(evt, name, index) {
28565 var pc = aspxGetPopupControlCollection().Get(name);
28566 if(pc != null) pc.OnPWHBClickCore(evt, index, "OnRefreshButtonClick");
28567};
28568ASPx.PWMNBClick = function(evt, name, index) {
28569 var pc = aspxGetPopupControlCollection().Get(name);
28570 if(pc != null) pc.OnPWHBClickCore(evt, index, "OnCollapseButtonClick");
28571};
28572ASPx.PWMXBClick = function(evt, name, index) {
28573 var pc = aspxGetPopupControlCollection().Get(name);
28574 if(pc != null) pc.OnPWHBClickCore(evt, index, "OnMaximizeButtonClick");
28575};
28576ASPx.PWDGMDown = function (evt, name, index) {
28577 var pc = aspxGetPopupControlCollection().Get(name);
28578 return ASPx.PWMDown(evt, name, index, pc.IsDraggingAllowed(index));
28579};
28580ASPx.PWGripMDown = function(evt, name, index) {
28581 aspxPWMDownCore(evt, name, index, false);
28582 return ASPx.PWHMDown(evt);
28583};
28584ASPx.PWMMove = function(evt, name, index) {
28585 aspxGetPopupControlCollection().OnPWMouseMove(evt, name, index);
28586};
28587ASPx.PWMDown = function(evt, name, index, isWindowContentDraggingAllowed) { 
28588 var pointOnScrollBar = false;
28589 var pc = aspxGetPopupControlCollection().Get(name);
28590 if(pc && pc.GetEnableContentScrolling(index)) {
28591  var rtl = pc.rtl && (ASPx.Browser.IE || ASPx.Browser.Firefox || ASPx.Browser.Opera);
28592  pointOnScrollBar = aspxPointOnElementScrollBar(pc.GetContentContainer(index), evt.clientX, evt.clientY, rtl);
28593 }
28594 aspxPWMDownCore(evt, name, index, isWindowContentDraggingAllowed, pointOnScrollBar);
28595 if(isWindowContentDraggingAllowed) { 
28596  aspxGetPopupControlCollection().OnDocumentMouseDown(evt); 
28597  if(typeof (ASPx.GetDropDownCollection) == "function")
28598   ASPx.GetDropDownCollection().OnDocumentMouseDown(evt); 
28599  if(!pointOnScrollBar) {
28600   if(!ASPx.Browser.WebKitTouchUI && ASPx.Evt.GetEventSource(evt).tagName == "IMG") 
28601    ASPx.Evt.PreventEvent(evt);
28602  }
28603 }
28604};
28605function aspxPWMDownCore(evt, name, index, isDraggingAllowed, pointOnScrollBar) {
28606 var pc = aspxGetPopupControlCollection().Get(name);
28607 if(pc != null) {
28608  pc.OnActivate(index, evt);
28609  pc.OnMouseDown(evt, index, isDraggingAllowed, pointOnScrollBar);
28610 }
28611}
28612function aspxPWMEMDown(evt) {
28613 var internalScrollableModalDiv = ASPx.Browser.AndroidDefaultBrowser ? ASPx.Evt.GetEventSource(evt) : null;
28614 var modalDiv = internalScrollableModalDiv ? internalScrollableModalDiv.parentNode : ASPx.Evt.GetEventSource(evt);
28615 if(modalDiv != null) 
28616  modalDiv.DXModalPopupControl.OnMouseDownModalElement(evt, modalDiv.DXModalPopupWindowIndex);
28617}
28618function aspxPEMEvent(evt) {
28619 var element = ASPx.PopupUtils.FindEventSourceParentByTestFunc(evt, aspxTestPopupControlElement);
28620 if(element != null) {
28621  var popupControl = element.DXPopupElementControl;
28622  var index = element.DXPopupWindowIndex;
28623  if(evt.type == "mousedown") {
28624   popupControl.SetIsPopuped(index, popupControl.InternalIsWindowVisible(index));
28625   aspxGetPopupControlCollection().OnMouseDown(evt);
28626  }
28627  else {
28628   var windowPopupAction = popupControl.GetWindowPopupAction(element.DXPopupWindowIndex);
28629   var leftMouseButtonAction = windowPopupAction == "LeftMouseClick" && ASPx.Evt.IsLeftButtonPressed(evt);
28630   var isAccessibleKeyboardAction = popupControl.accessibilityCompliant && ASPx.Evt.IsActionKeyPressed(evt);
28631   var rightMouseButtonAction = windowPopupAction == "RightMouseClick" && !ASPx.Evt.IsLeftButtonPressed(evt);
28632   if(leftMouseButtonAction || rightMouseButtonAction || isAccessibleKeyboardAction) {
28633    if(rightMouseButtonAction)
28634     ASPx.PopupUtils.PreventContextMenu(evt);
28635    var windowCloseAction = popupControl.GetWindowCloseAction(index);
28636    var isPopuped = popupControl.GetIsPopuped(index);
28637    var isNewPopupElement = popupControl.GetLastShownPopupElementIndex(index) != element.DXPopupElementIndex;
28638    if(isPopuped && isNewPopupElement) {
28639     popupControl.DoHideWindow(index, false, ASPxClientPopupControlCloseReason.OuterMouseClick);
28640     aspxGetPopupControlCollection().ClearDisappearTimer();
28641     isPopuped = false;
28642    }
28643    if(!(isPopuped && windowCloseAction == "OuterMouseClick")) {
28644     popupControl.DoShowWindow(index, element.DXPopupElementIndex, evt);
28645    }
28646    if(windowCloseAction == "MouseOut")
28647     aspxGetPopupControlCollection().InitOverObject(popupControl, element.DXPopupWindowIndex, evt);
28648    return false;
28649   }
28650  }
28651 }
28652}
28653ASPx.PopupElementMouseEvent = aspxPEMEvent;
28654function aspxPointOnElementScrollBar(element, x, y, rtl) {
28655 var scrollWidth = ASPx.GetVerticalScrollBarWidth();
28656 var hasHorizontalScroll = element.scrollWidth > element.clientWidth;
28657 var hasVerticalScroll = element.scrollHeight > element.clientHeight;
28658 var ceilX = rtl ? ASPx.GetAbsoluteX(element) + scrollWidth :
28659  ASPx.GetAbsoluteX(element) + (element.offsetWidth - ASPx.GetHorizontalBordersWidth(element));
28660 var ceilY = ASPx.GetAbsoluteY(element) + (element.offsetHeight - ASPx.GetVerticalBordersWidth(element));
28661 return (hasVerticalScroll && x >= ceilX - scrollWidth && x <= ceilX) ||
28662   (hasHorizontalScroll && y >= ceilY - scrollWidth && y <= ceilY);
28663}
28664ASPx.PCAStop = function(name, index) {
28665 var pc = aspxGetPopupControlCollection().Get(name);
28666 if(pc != null) pc.OnAnimationStop(index);
28667};
28668ASPx.PCIframeLoad = function(evt) {
28669 var srcElement = ASPx.Evt.GetEventSource(evt);
28670 if(srcElement) {
28671  var pcName = srcElement.popupControlName;
28672  var pcWndIndex = srcElement.pcWndIndex;
28673  if(pcName) {
28674   var pc = aspxGetPopupControlCollection().Get(pcName);
28675   if(pc) pc.OnIFrameLoad(pcWndIndex);
28676  }
28677 }
28678};
28679function aspxTestPopupWindowElement(element) {
28680 return !!element.DXPopupWindowElement;
28681}
28682function aspxTestPopupControlElement(element) {
28683 return element.DXPopupElementControl && ASPx.IsExists(element.DXPopupWindowIndex);
28684}
28685function aspxTestPopupControlOverElement(element) {
28686 var collection = aspxGetPopupControlCollection();
28687 var popupControl = collection.overControl;
28688 var index = collection.overWindowIndex;
28689 var windowId = popupControl.GetWindowElementId(index);
28690 if(element.id == windowId)
28691  return true;
28692 var popupElements = popupControl.GetPopupElementList(index);
28693 for(var i = 0; i < popupElements.length; i++)
28694  if(popupElements[i] == element)
28695   return true;
28696 return false;
28697}
28698ASPx.Evt.AttachEventToDocument("keydown", function(evt) {
28699 aspxGetPopupControlCollection().OnDocumentKeyDown(evt);
28700});
28701ASPx.Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseDownEventName, function(evt) {
28702 aspxGetPopupControlCollection().OnDocumentMouseDown(evt);
28703});
28704ASPx.Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseUpEventName, function(evt) {
28705 return aspxGetPopupControlCollection().OnMouseUp(evt);
28706});
28707window.addEventListener(ASPx.TouchUIHelper.touchMouseMoveEventName, function(evt) {
28708 if(typeof(aspxGetPopupControlCollection) != "undefined")
28709  aspxGetPopupControlCollection().OnMouseMove(evt);
28710}, { capture: true, passive: !ASPx.Browser.WebKitTouchUI });
28711ASPx.Evt.AttachEventToDocument("mouseout", function(evt) {
28712 if(typeof (aspxGetPopupControlCollection) != "undefined")
28713  aspxGetPopupControlCollection().OnMouseOut(evt);
28714});
28715ASPx.Evt.AttachEventToElement(window, ASPx.Browser.MacOSMobilePlatform ? "orientationchange" : "resize", function(evt) {
28716 aspxGetPopupControlCollection().OnResize(evt);
28717});
28718ASPx.Evt.AttachEventToElement(window, "scroll", function(evt) {
28719 aspxGetPopupControlCollection().OnScroll(evt);
28720});
28721ASPx.Evt.AttachEventToDocument("selectstart", function(evt) {
28722 var ret = aspxGetPopupControlCollection().OnSelectStart(evt);
28723 if(!ret) return false; 
28724});
28725var currViewPortSize = getViewPortSize();
28726var viewPortSizeInterval = null;
28727function getViewPortSize() {
28728 return { 
28729  w: window.innerWidth, 
28730  h: window.innerHeight,
28731  x: window.pageXOffset,
28732  y: window.pageYOffset
28733 }; 
28734}
28735function ensureViewPortSizeInterval() {
28736 if(!!viewPortSizeInterval) return;
28737 viewPortSizeInterval = setInterval(function() {
28738  var size = getViewPortSize();
28739  if(size.w != currViewPortSize.w || size.h != currViewPortSize.h || size.x != currViewPortSize.x || size.y != currViewPortSize.y) {
28740   currViewPortSize = size;
28741   var controlCollection = aspxGetPopupControlCollection();
28742   controlCollection.ForEachControl(function(popupControl) {
28743    if(popupControl.GetCanScrollViewPort(-1) && popupControl.IsVisible()) {
28744     popupControl.updateContentScrollIfNeeded(-1);
28745     popupControl.UpdatePosition();
28746    }
28747   });
28748  }
28749 }, 50);
28750}
28751window.ASPxClientPopupControlBase = ASPxClientPopupControlBase;
28752window.ASPxClientPopupControl = ASPxClientPopupControl;
28753window.ASPxClientPopupWindow = ASPxClientPopupWindow;
28754window.ASPxClientPopupWindowEventArgs = ASPxClientPopupWindowEventArgs;
28755window.ASPxClientPopupWindowCancelEventArgs = ASPxClientPopupWindowCancelEventArgs;
28756window.ASPxClientPopupWindowResizeEventArgs = ASPxClientPopupWindowResizeEventArgs;
28757window.ASPxClientPopupWindowPinnedChangedEventArgs = ASPxClientPopupWindowPinnedChangedEventArgs;
28758window.ASPxClientPopupControlCollection = ASPxClientPopupControlCollection;
28759window.ASPxClientPopupControlResizeState = ASPxClientPopupControlResizeState;
28760window.ASPxClientPopupControlCloseReason = ASPxClientPopupControlCloseReason;
28761ASPx.GetPopupControlCollection = aspxGetPopupControlCollection;
28762ASPx.PopupControlCssClasses = PopupControlCssClasses;
28763})();
28764
28765(function() {
28766ASPx.activeCalendar = null;
28767ASPx.calendarMsPerDay = 86400000;
28768var calendarWeekCount = 6;
28769var viewsContainerClassName = "dxeCVC";
28770var ASPxClientCalendar = ASPx.CreateClass(ASPxClientEdit, {
28771 constructor: function(name) {
28772  this.constructor.prototype.constructor.call(this, name);
28773  this.SelectionChanging = new ASPxClientEvent();
28774  this.SelectionChanged = new ASPxClientEvent();
28775  this.VisibleMonthChanged = new ASPxClientEvent();
28776  this.CustomDisabledDate = new ASPxClientEvent();
28777  this.isMouseDown = false;  
28778  this.forceMouseDown = false;
28779  this.supportGestures = true;
28780  this.swipeGestureStated = false;
28781  this.updateAnimationProcessing = false;
28782  this.selection = new ASPxClientCalendarSelection();
28783  this.selectionTransaction = null;  
28784  this.selectionStartDate = null;
28785  this.selectionPrevStartDate = null;
28786  this.lastSelectedDate = null;
28787  this.selectionCtrl = false;
28788  this.selectionByWeeks = false;  
28789  this.titleFormatter = null;
28790  this.updateAnimationLockCount = 0;
28791  this.forceUpdate = false;
28792  this.needToSetCursor = true;
28793  this.visibleDate = new Date();
28794  this.firstDayOfWeek = 0;    
28795  this.columns = 1;
28796  this.rows = 1;
28797  this.switchToSingleMonthAtWindowInnerWidth = 0;
28798  this.enableFast = true;
28799  this.showFastPopup = true;
28800  this.fastNavMinZoomLevel = "Century";
28801  this.enablePeriodNavigation = true;
28802  this.enableFastNavInlineAnimation = true;
28803  this.enableMulti = false;
28804  this.customDraw = false;  
28805  this.showWeekNumbers = true;
28806  this.showDayHeaders = true;
28807  this.isDateEditCalendar = false;
28808  this.sharedParameters = new ASPx.CalendarSharedParameters();
28809  this.visibleDateColumnOffset = 0;
28810  this.accessibilityHelper = null;
28811  this.sizingConfig.allowSetHeight = false;
28812  this.isDateChangingByKeyboard = false;
28813  this.MainElementClick = new ASPxClientEvent();
28814 },
28815 SetData: function(data){
28816  ASPxClientEdit.prototype.SetData.call(this, data);
28817  if(data.selection)
28818   this.selection.AddArray(data.selection);
28819  if(data.sharedParameters)
28820   this.SetProperties(data.sharedParameters, this.sharedParameters);
28821 },
28822 Initialize: function() {
28823  this.selectionTransaction = new ASPxClientCalendarSelectionTransaction(this);
28824  this.selectionPrevStartDate = this.selection.GetFirstDate();
28825  ASPxClientEdit.prototype.Initialize.call(this);
28826  var mainElement = this.GetMainElement();
28827  ASPx.Evt.PreventElementDragAndSelect(mainElement, false, false);
28828  if(ASPx.Browser.Opera && !ASPx.Browser.WebKitFamily)
28829   ASPx.Selection.SetElementAsUnselectable(mainElement, true, true);
28830  this.EnsureTodayStyle();
28831  if(this.accessibilityCompliant)
28832   this.accessibilityHelper = new AccessibilityHelperCalendar(this);
28833  this.AttachEventHandlers();
28834 },
28835 InlineInitialize: function() {
28836  this.customDraw = this.sharedParameters.calendarCustomDraw;
28837  this.CreateViews();
28838  if(this.enableFast)
28839   this.InitializeFastNavigation();
28840  this.InitSpecialKeyboardHandling();
28841  if(this.isSlideCallbackAnimationEnabled() && !this.isSwipeGesturesEnabled() && typeof(ASPx.AnimationHelper) != "undefined")
28842   ASPx.AnimationHelper.getSlideAnimationContainer(this.GetCallbackAnimationElement(), true, false);
28843  ASPxClientEdit.prototype.InlineInitialize.call(this);
28844  if(!this.CustomDisabledDate.IsEmpty())
28845   this.Update();
28846  this.SetInitialVisibleDate();
28847  this.CreateAdaptivityCssRules();
28848 },
28849 InitializeFastNavigation: function() {
28850  if(!this.IsMultiViewFastNavigation())
28851   this.fastNavigation = this.CreateFastNavigation();
28852 },
28853 AttachEventHandlers: function() {
28854  this.AttachArrowButtonHandler(this.GetArrowButton("Y", false), -12);
28855  this.AttachArrowButtonHandler(this.GetArrowButton("M", false), -1);
28856  this.AttachArrowButtonHandler(this.GetArrowButton("M", true), 1);
28857  this.AttachArrowButtonHandler(this.GetArrowButton("Y", true), 12);
28858  this.AttachArrowButtonHandler(this.GetArrowButton("TP", false), -1);
28859  this.AttachArrowButtonHandler(this.GetArrowButton("TP", true), 1);
28860  if(this.IsMultiView()) {
28861   this.AttachArrowButtonHandler(this.GetArrowButton("M", true, "0x0"), 1, true);
28862   this.AttachArrowButtonHandler(this.GetArrowButton("Y", true, "0x0"), 12, true);
28863   this.AttachArrowButtonHandler(this.GetArrowButton("TP", true, "0x0"), 1, true);
28864   var lastColumn = this.columns - 1;
28865   this.AttachArrowButtonHandler(this.GetArrowButton("M", false, "0x" + lastColumn), -1, true);
28866   this.AttachArrowButtonHandler(this.GetArrowButton("Y", false, "0x" + lastColumn), -12, true);
28867   this.AttachArrowButtonHandler(this.GetArrowButton("TP", false, "0x" + lastColumn), -1, true);
28868  }
28869  this.AttachMonthTitleHandler();
28870 },
28871 AttachMonthTitleHandler: function() {
28872  if (!this.enableFast)
28873   return;
28874  for (var key in this.views) {
28875   if (!this.views.hasOwnProperty(key)) continue;
28876   var view = this.views[key];
28877   var title = view.GetTitleElement();
28878   if(title)
28879    ASPx.Evt.AttachEventToElement(title, "click", this.OnTitleClick.bind(this, view.row, view.column));
28880  }
28881 },
28882 CreateAdaptivityCssRules: function() {
28883  if (this.switchToSingleMonthAtWindowInnerWidth <= 0)
28884   return;
28885  var styleSheet = ASPx.GetCurrentStyleSheet();
28886  if (!styleSheet || !styleSheet.insertRule) return;
28887  var lastColumn = this.columns - 1;
28888  var rule =
28889  "@media all and (max-width: " + this.switchToSingleMonthAtWindowInnerWidth + "px) { " +
28890   "#" + this.name + ".dxeCVC > tbody > tr > td:not(.view-visible):not(#" + this.name + "_F) > * { display: none; }" +
28891   "#" + this.name + " .dxeCVC > tbody > tr > td:not(.view-visible):not(#" + this.name + "_F) > * { display: none; }" +
28892   ".view-visible #" + this.name + "_" + this.GetArrowButtonID("M", true, "0x0") + "," +
28893   ".view-visible #" + this.name + "_" + this.GetArrowButtonID("M", false, "0x" + lastColumn) + "," +
28894   ".view-visible #" + this.name + "_" + this.GetArrowButtonID("Y", true, "0x0") + "," +
28895   ".view-visible #" + this.name + "_" + this.GetArrowButtonID("Y", false, "0x" + lastColumn) + "," +
28896   ".view-visible #" + this.name + "_" + this.GetArrowButtonID("TP", true, "0x0") + "," +
28897   ".view-visible #" + this.name + "_" + this.GetArrowButtonID("TP", false, "0x" + lastColumn) +
28898    " { visibility: visible!important; } " +
28899   "}";
28900  styleSheet.insertRule(rule, styleSheet.cssRules.length);
28901 },
28902 AttachArrowButtonHandler: function(button, monthOffset, singleViewOnly) {
28903  if (!button) return;
28904  ASPx.Evt.AttachEventToElement(button, "click", function() {
28905   if (!singleViewOnly || (this.switchToSingleMonthAtWindowInnerWidth > 0 && window.innerWidth <= this.switchToSingleMonthAtWindowInnerWidth))
28906    this.OnShiftMonth(monthOffset);
28907  }.bind(this));
28908 },
28909 SetInitialVisibleDate: function() {
28910  this.initialVisibleDate = this.GetVisibleDate();
28911 },
28912 EnsureTodayStyle: function() {
28913  if(!ASPxClientCalendar.AreDatesEqual(this.serverCurrentDate, new Date())) {
28914   for(var key in this.views) {
28915    if(this.views.hasOwnProperty(key)) {
28916     var view = this.views[key];
28917     view.EnsureTodayStyle();
28918    }
28919   }
28920  }
28921 },
28922 CreateFastNavigation: function() {
28923  return new ASPxClientCalendarFastNavigation(this);
28924 },
28925 GetCalendarRowElements: function() {
28926  if(!this.viewsContainer) {
28927   var mainElement = this.GetMainElement();
28928   var mainElementIsViewsContainer = ASPx.ElementHasCssClass(this.GetMainElement(), viewsContainerClassName);
28929   this.viewsContainer = mainElementIsViewsContainer ? mainElement : ASPx.GetNodeByClassName(mainElement, viewsContainerClassName);
28930  }
28931  return this.viewsContainer.rows;
28932 },
28933 GetCalendarViewCellElements: function(rowElement) {
28934  return rowElement.cells;
28935 },
28936 GetMonthTable: function(viewIdPostfix) {
28937  return this.GetChildElement("mt" + viewIdPostfix);
28938 },
28939 GetFastNavCell: function(viewIdPostfix) {
28940  return this.GetChildElement("fnc" + viewIdPostfix);
28941 },
28942 GetMonthCell: function(viewIdPostfix) {
28943  return this.GetChildElement("mc" + viewIdPostfix);
28944 },
28945 GetViewCell: function(viewIdPostfix) {
28946  if (this.switchToSingleMonthAtWindowInnerWidth <= 0)
28947   throw new Error("Not Implemented");
28948  return this.GetChildElement("v" + viewIdPostfix);
28949 },
28950 GetArrowButton: function(type, isNext, viewID) {
28951  return this.GetChildElement(this.GetArrowButtonID(type, isNext, viewID));
28952 },
28953 GetArrowButtonID: function(type, isNext, viewID) {
28954  var id = (isNext ? "N" : "P") + type.toUpperCase() + "C";
28955  if(this.IsMultiView() && viewID === undefined)
28956   id += "_0x" + (isNext ? this.columns - 1 : 0);
28957  else if (viewID)
28958   id += "_" + viewID;
28959  return id + "Img";
28960 },
28961 SetMonthTableCellContent: function(cell, content, isWeekNumber) {
28962  cell.innerHTML = content;
28963 },
28964 FindInputElement: function() {
28965  return this.accessibilityCompliant ? this.GetAccessibilityAssistantElement() : this.GetChildElement("KBS");
28966 },
28967 GetAccessibilityActiveElements: function() {
28968  return this.accessibilityCompliant ? [this.accessibilityHelper.GetActiveElement()] : [this.GetInputElement()];
28969 },
28970 GetClearButton: function() {
28971  return this.GetChildElement("BC");
28972 },
28973 GetTodayButton: function() {
28974  return this.GetChildElement("BT");
28975 },
28976 GetFooter: function() {
28977  return this.GetChildElement("F");
28978 },
28979 GetValue: function() {
28980  return this.selection.GetFirstDate();
28981 },
28982 GetValueString: function() {
28983  var value = this.GetValue();
28984  return value == null ? null : ASPx.DateUtils.GetInvariantDateString(value);
28985 },
28986 SetValue: function(date) {  
28987  if(date) {
28988   date = ASPxClientCalendarDateDisabledHelper.GetCorrectedDate(date);
28989   this.SetVisibleDate(date);
28990  }
28991  this.SetSelectedDate(date);
28992 },
28993 GetFastNavigation: function() {
28994  return this.fastNavViewKey ? this.views[this.fastNavViewKey].fastNavigation : this.fastNavigation;
28995 },
28996 SetFastNavigationViewKey: function(viewKey) {
28997  if(this.fastNavViewKey != viewKey)
28998   this.fastNavViewKey = viewKey;
28999 },    
29000 GetViewKey: function(row, column) {
29001  return row + "x" + column;
29002 },
29003 GetView: function(row, column) {
29004  var key = this.GetViewKey(row, column);
29005  return this.views[key];
29006 },
29007 CreateViews: function() {
29008  this.views = { };
29009  var key;
29010  for(var row = 0 ; row < this.rows; row++) {   
29011   for(var col = 0; col < this.columns; col++) {
29012    key = this.GetViewKey(row, col);
29013    var view = new ASPxClientCalendarView(this, row, col);
29014    view.Initialize();
29015    this.views[key] = view;
29016   }
29017  }
29018  if (this.switchToSingleMonthAtWindowInnerWidth)
29019   this.views["0x0"].EnsureVisible(true);
29020 },
29021 IsFastNavigationActive: function() {
29022  var fastNavigation = this.GetFastNavigation();
29023  if(fastNavigation)
29024   return fastNavigation.IsActive();
29025  return false;
29026 },
29027 IsMultiViewFastNavigation: function() {
29028  return !this.showFastPopup && this.IsMultiView();
29029 },
29030 IsDateSelected: function(date) {
29031  return this.selection.Contains(date);
29032 },
29033 IsDateVisible: function(date) {
29034  var startDate = ASPxClientCalendar.CloneDate(this.GetView(0, 0).visibleDate);
29035  startDate.setDate(1);  
29036  var endDate = ASPxClientCalendar.CloneDate(this.GetView(this.rows - 1, this.columns - 1).visibleDate);
29037  endDate.setDate(ASPxClientCalendar.GetDaysInMonth(endDate.getMonth(), endDate.getFullYear()));
29038  return (date >= startDate) && (date < endDate);
29039 },
29040 IsDateWeekend: function(date) {
29041  var day = date.getDay();
29042  return day == 0 || day == 6;
29043 },
29044 IsCustomDisabledDatesViaCallback: function(){
29045  return (this.callBack && this.IsCustomDisabledDateEventEmpty() && this.sharedParameters.disabledDates.length > 0);
29046 },
29047 HasCallback: function () {
29048  if (this.isDateEditCalendar)
29049   return this.customDraw;
29050  else
29051   return this.callBack;
29052 },
29053 IsCustomDisabledDateEventEmpty: function() {
29054  if(this.isDateEditCalendar)
29055   return ASPxClientDateEdit.active == null || ASPxClientDateEdit.active.CalendarCustomDisabledDate.IsEmpty();
29056  return this.CustomDisabledDate.IsEmpty();
29057 },
29058 IsDateDisabled: function(date) {
29059  return ASPxClientCalendarDateDisabledHelper.IsDateDisabled(this.sharedParameters, date, function(d) { return this.OnCustomDisabledDate(d); }.aspxBind(this));
29060 },
29061 IsMultiView: function() {
29062  return this.columns > 1 || this.rows > 1;
29063 },
29064 AddCallbackCustomDisabledDates: function(dates) {
29065  var callbackCustomDisabledDates = eval(dates);
29066  for(var i = 0; i < callbackCustomDisabledDates.length; i++) {
29067   var contains = false;
29068   var date = callbackCustomDisabledDates[i];
29069   for(var j = 0; j < this.sharedParameters.disabledDates.length; j++) {
29070    var disabledDate = this.sharedParameters.disabledDates[j];
29071    if(disabledDate.getDate() == date.getDate() &&
29072     disabledDate.getMonth() == date.getMonth() &&
29073     disabledDate.getFullYear() == date.getFullYear()) {
29074     contains = true;
29075     break;
29076    }
29077   }
29078   if(!contains)
29079    this.sharedParameters.disabledDates.push(date);
29080  }
29081 },
29082 ShowLoadingPanel: function(){
29083  this.CreateLoadingPanelWithAbsolutePosition(this.GetMainElement().parentNode, this.GetLoadingPanelOffsetElement(this.GetMainElement()));
29084 },
29085 ShowLoadingDiv: function () {
29086  this.CreateLoadingDiv(this.GetMainElement().parentNode, this.GetMainElement());
29087 },
29088 GetCallbackAnimationElement: function() {
29089  if(this.columns === 1 && this.rows === 1) {
29090   var view = this.views[this.GetViewKey(0, 0)];
29091   return this.IsFastNavigationActive() && !this.showFastPopup ? view.GetFastNavCell() : view.GetMonthTable();
29092  }
29093  return this.GetMainElement();
29094 },
29095 CanHandleGesture: function(evt) {
29096  var isInlineFastNavigationActive = this.IsFastNavigationActive() && !this.showFastPopup;
29097  if(!this.enablePeriodNavigation && isInlineFastNavigationActive)
29098   return false;
29099  var source = ASPx.Evt.GetEventSource(evt);
29100  var element = this.GetMainElement();
29101  if(this.columns === 1 && this.rows === 1) {
29102   var view = this.views[this.GetViewKey(0, 0)];
29103   element = isInlineFastNavigationActive ? view.GetFastNavCell() : view.GetMonthCell();
29104  }
29105  return ASPx.GetIsParent(element, source);
29106 },
29107 AllowStartGesture: function() {
29108  return ASPxClientControl.prototype.AllowStartGesture.call(this) && (!this.enableMulti || !this.selectionTransaction.isActive) && !this.updateAnimationProcessing;
29109 },
29110 StartGesture: function() {
29111  this.swipeGestureStated = true;
29112 },
29113 AllowExecuteGesture: function(value) {
29114  return true;
29115 },
29116 ExecuteGesture: function(value, count) {
29117  if(!count) count = 1;
29118  this.OnShiftMonth((value > 0 ? -1 : 1) * count);
29119 },
29120 Update: function() {
29121  if(this.customDraw && !this.clientUpdate) {
29122   if(!this.isDateEditCalendar)
29123    this.UpdateFromServer();
29124   else if (this.sharedParameters.currentDateEdit != null)
29125    this.sharedParameters.currentDateEdit.CreateUpdateCallback();
29126  }
29127  else {
29128   if(this.IsAnimationEnabled() && !this.forceUpdatingOnMouseOver)
29129    this.StartBeforeUpdateAnimation();
29130   else
29131    this.UpdateInternal();
29132  }
29133 },
29134 UpdateFromServer: function() {
29135  if(this.callBack) {
29136   this.ShowLoadingElements();
29137   this.CreateCallback(this.sharedParameters.GetUpdateCallbackParameters());
29138  }
29139  else {
29140   this.SendPostBack("");
29141  }
29142 },
29143 UpdateInternal: function() {
29144  if(this.NeedCalculateSelectionOnUpdating())
29145   this.selection.Clear();
29146  for(var key in this.views) {
29147   if(this.views.hasOwnProperty(key)) {
29148    var view = this.views[key];
29149    if(!view.isASPxClientCalendarView) continue;
29150    view.Update();
29151    if (this.switchToSingleMonthAtWindowInnerWidth)
29152     view.EnsureVisible(view.GetIndex() === this.visibleDateColumnOffset);
29153   }
29154  }
29155  if(this.IsAnimationEnabled() && !this.forceUpdatingOnMouseOver)
29156   this.StartAfterUpdateAnimation();
29157 },
29158 IsAnimationEnabled: function() {
29159  return (this.isSlideCallbackAnimationEnabled() || this.enableCallbackAnimation) && !this.IsUpdateAnimationLocked();
29160 },
29161 LockUpdateAnimation: function() {
29162  this.updateAnimationLockCount++;
29163 },
29164 UnlockUpdateAnimation: function() {
29165  this.updateAnimationLockCount--;
29166 },
29167 IsUpdateAnimationLocked: function() {
29168  return this.updateAnimationLockCount > 0;
29169 },
29170 StartBeforeUpdateAnimation: function() {
29171  this.updateAnimationProcessing = true;
29172  var element = this.GetCallbackAnimationElement();
29173  if(this.isSlideCallbackAnimationEnabled() && this.slideAnimationDirection) 
29174   ASPx.AnimationHelper.slideOut(element, this.slideAnimationDirection, this.FinishBeforeUpdateAnimation.aspxBind(this), ASPx.AnimationEngineType.JS, this.rtl);
29175  else if(this.enableCallbackAnimation) 
29176   ASPx.AnimationHelper.fadeOut(element, this.FinishBeforeUpdateAnimation.aspxBind(this));
29177  else
29178   this.FinishBeforeUpdateAnimation();
29179 },
29180 FinishBeforeUpdateAnimation: function() {
29181  this.UpdateInternal();
29182 },
29183 StartAfterUpdateAnimation: function() {
29184  var element = this.GetCallbackAnimationElement();
29185  if (this.isSlideCallbackAnimationEnabled() && this.slideAnimationDirection)
29186   ASPx.AnimationHelper.slideIn(element, this.slideAnimationDirection, this.FinishAfterUpdateAnimation.aspxBind(this), ASPx.AnimationEngineType.JS, this.rtl);
29187  else if(this.enableCallbackAnimation) 
29188   ASPx.AnimationHelper.fadeIn(element, this.FinishAfterUpdateAnimation.aspxBind(this));
29189  else
29190   this.FinishAfterUpdateAnimation();
29191 },
29192 FinishAfterUpdateAnimation: function() {
29193  this.updateAnimationProcessing = false;
29194  this.slideAnimationDirection = null;
29195  this.CheckRepeatGesture();
29196  if(this.isDateEditCalendar && ASPxClientDateEdit.active)
29197   ASPxClientDateEdit.active.OnCalendarFinishAnimation();
29198 },
29199 HideSlideAnimationContent: function() {
29200  if(this.isSlideCallbackAnimationEnabled()) {
29201   var container = ASPx.AnimationHelper.getSlideAnimationContainer(this.GetCallbackAnimationElement(), true, false);
29202   ASPx.Attr.RestoreStyleAttribute(container, "overflow");
29203   ASPx.Attr.RestoreStyleAttribute(container, "width");
29204   ASPx.Attr.RestoreStyleAttribute(container, "height");
29205   ASPx.Attr.RestoreStyleAttribute(container.firstChild, "width");
29206   ASPx.Attr.RestoreStyleAttribute(container.firstChild, "height");
29207  }
29208 },
29209 ShowSlideAnimationContent: function() {
29210  if(this.isSlideCallbackAnimationEnabled()) {
29211   var container = ASPx.AnimationHelper.getSlideAnimationContainer(this.GetCallbackAnimationElement(), true, false);
29212   ASPx.Attr.ChangeStyleAttribute(container, "overflow", "visible");
29213   ASPx.Attr.ChangeStyleAttribute(container, "width", "");
29214   ASPx.Attr.ChangeStyleAttribute(container, "height", "");
29215   ASPx.Attr.ChangeStyleAttribute(container.firstChild, "width", "");
29216   ASPx.Attr.ChangeStyleAttribute(container.firstChild, "height", "");
29217  }
29218 },
29219 ApplySelectionByDiff: function(selection, save) {
29220  var toShow = [ ];
29221  var toHide = [ ];
29222  var dates =  selection.GetDates();
29223  var oldDates = this.selection.GetDates();
29224  var selectionEdges = this.sharedParameters.dateRangeMode ? ASPx.Data.ArrayGetIntegerEdgeValues(dates) : null;
29225  var oldSelectionEdges = this.sharedParameters.dateRangeMode ? ASPx.Data.ArrayGetIntegerEdgeValues(oldDates) : null;
29226  var date;
29227  for(var i = 0; i < dates.length; i++) {
29228   date = dates[i];
29229   var isEdgeDateInSelection = selectionEdges
29230    && ASPxClientCalendar.IsFirstDateEqualToAnyOther(dates[i], selectionEdges.start, selectionEdges.end);
29231   var isEdgeDateInOldSelection = oldSelectionEdges
29232    && ASPxClientCalendar.IsFirstDateEqualToAnyOther(dates[i], oldSelectionEdges.start, oldSelectionEdges.end);
29233   if (!this.selection.Contains(date)
29234    || isEdgeDateInSelection && !isEdgeDateInOldSelection
29235    || !isEdgeDateInSelection && isEdgeDateInOldSelection)
29236    toShow.push(date);
29237  }
29238  for(var i = 0; i < oldDates.length; i++) {
29239   date = oldDates[i];
29240   if(!selection.Contains(date))
29241    toHide.push(date);
29242  }
29243  for(var key in this.views) {
29244   if(this.views.hasOwnProperty(key)) {
29245    var view = this.views[key];
29246    if(!view.isASPxClientCalendarView) continue;
29247    view.UpdateSelection(toHide, false, selectionEdges);
29248    view.UpdateSelection(toShow, true, selectionEdges);
29249   }
29250  }
29251  this.selection.Assign(selection);
29252  if(this.accessibilityCompliant)
29253   this.accessibilityHelper.PronounceDates(dates);
29254 },
29255 GetDayInRangeClassName: function() {
29256  return ASPxClientCalendarView.DayInRangeClassName;
29257 },
29258 NeedApplySelectionToDayInRange: function() {
29259  return true;
29260 },
29261 ImportEtalonStyle: function(info, suffix) {
29262  var cell = this.GetEtalonStyleCell(suffix);
29263  if(ASPx.IsExistsElement(cell))
29264   info.Import(cell);   
29265 },
29266 GetEtalonStyleCell: function(name) {
29267  return ASPx.CacheHelper.GetCachedElementById(this, this.name + "_EC_" + name);
29268 },
29269 CanApplyDayCellStyle: function(suffix, isCurrentMonthDay) {
29270  return true;
29271 },
29272 UpdateStateObject: function() {
29273  var stateObject = { };
29274  var visibleDate = ASPxClientCalendarDateDisabledHelper.GetCorrectedDate(this.visibleDate);
29275  var initialVisibleDate = ASPxClientCalendarDateDisabledHelper.GetCorrectedDate(this.initialVisibleDate);
29276  stateObject.visibleDate = ASPx.DateUtils.GetInvariantDateString(visibleDate);
29277  stateObject.initialVisibleDate = ASPx.DateUtils.GetInvariantDateString(initialVisibleDate);
29278  stateObject.selectedDates = [];
29279  if(this.selection.count > 0) {
29280   var dates = this.selection.GetDates();
29281   for(var i = 0; i < dates.length; i++)
29282    stateObject.selectedDates.push(ASPx.DateUtils.GetInvariantDateString(dates[i]));
29283  }
29284  this.UpdateStateObjectWithObject(stateObject);
29285 },
29286 GetStateHiddenFieldName: function() {
29287  return this.uniqueID;
29288 },  
29289 FormatDates: function(dates, separator) {
29290  var result = "";
29291  for(var i = 0; i < dates.length; i++) {
29292   if(result.length > 0)
29293    result += separator;
29294   result += ASPx.DateUtils.GetInvariantDateString(dates[i]);     
29295  }
29296  return result;
29297 },
29298 InitializeKeyHandlers: function() {
29299  this.AddKeyDownHandler(ASPx.Key.Enter, "OnEnterDown");
29300  this.AddKeyDownHandler(ASPx.Key.Esc, "OnEscape");
29301  this.AddKeyDownHandler(ASPx.Key.PageUp, "OnPageUp");
29302  this.AddKeyDownHandler(ASPx.Key.PageDown, "OnPageDown");
29303  this.AddKeyDownHandler(ASPx.Key.End, "OnEndKeyDown");
29304  this.AddKeyDownHandler(ASPx.Key.Home, "OnHomeKeyDown");
29305  this.AddKeyDownHandler(ASPx.Key.Left, this.rtl ? "OnArrowRight" : "OnArrowLeft");
29306  this.AddKeyDownHandler(ASPx.Key.Right, this.rtl ? "OnArrowLeft" : "OnArrowRight");
29307  this.AddKeyDownHandler(ASPx.Key.Up, "OnArrowUp");
29308  this.AddKeyDownHandler(ASPx.Key.Down, "OnArrowDown");
29309  this.AddKeyPressHandler(ASPx.Key.Enter, "OnEnterPressed");
29310 },
29311 OnArrowUp: function(evt) {
29312  if(this.IsFastNavigationActive()) {
29313   if(this.fastNavigation) {
29314    var result = this.fastNavigation.OnArrowUp(evt);
29315    if(result && !this.showFastPopup && this.IsAnimationEnabled())
29316     this.StartBeforeFastNavigationShiftPeriodAnimation(function () { }, -1);
29317   }
29318   else {
29319    var currentFastNavigation = this.GetFastNavigation();
29320    var visiblePeriodsChanged = currentFastNavigation.OnArrowUp(evt);
29321    if(visiblePeriodsChanged) {
29322     var shiftPeriodFunction = function () {
29323      for(var key in this.views) {
29324       if(this.views.hasOwnProperty(key)) {
29325        var fastNavigation = this.views[key].fastNavigation;
29326        if(fastNavigation != currentFastNavigation)
29327         fastNavigation.ShiftVisibleNavigationPeriod(-1, true);
29328       }
29329      }
29330     }.aspxBind(this);
29331     if(this.IsAnimationEnabled())
29332      this.StartBeforeFastNavigationShiftPeriodAnimation(shiftPeriodFunction, -1);
29333     else
29334      shiftPeriodFunction();
29335    }
29336   }
29337  }
29338  else if(!this.GetReadOnly()) {
29339   var newDate = this.GetNearestDayForToday();
29340   if(this.lastSelectedDate)
29341    newDate = ASPxClientCalendar.GetPrevWeekDate(this.lastSelectedDate);
29342   if(!ASPxClientCalendarDateDisabledHelper.IsDateWithinBoundaries(newDate))
29343    return true;
29344   this.CorrectVisibleMonth(newDate, false);
29345   this.DoKeyboardSelection(newDate, evt.shiftKey, "up");
29346  }
29347  return true;
29348 },
29349 OnArrowDown: function(evt) {
29350  if(this.IsFastNavigationActive()) {
29351   if(this.fastNavigation) {
29352    var result = this.fastNavigation.OnArrowDown(evt);
29353    if(result && !this.showFastPopup && this.IsAnimationEnabled())
29354     this.StartBeforeFastNavigationShiftPeriodAnimation(function () { }, 1);
29355   }
29356   else {
29357    var currentFastNavigation = this.GetFastNavigation();
29358    var visiblePeriodsChanged = currentFastNavigation.OnArrowDown(evt);
29359    if(visiblePeriodsChanged) {
29360     var shiftPeriodFunction = function () {
29361      for(var key in this.views) {
29362       if(this.views.hasOwnProperty(key)) {
29363        var fastNavigation = this.views[key].fastNavigation;
29364        if(fastNavigation != currentFastNavigation)
29365         fastNavigation.ShiftVisibleNavigationPeriod(1, true);
29366       }
29367      }
29368     }.aspxBind(this);
29369     if(this.IsAnimationEnabled())
29370      this.StartBeforeFastNavigationShiftPeriodAnimation(shiftPeriodFunction, 1);
29371     else
29372      shiftPeriodFunction();
29373    }
29374   }
29375  }
29376  else if(!this.GetReadOnly()) {
29377   var newDate = this.GetNearestDayForToday();
29378   if(this.lastSelectedDate)  
29379    newDate = ASPxClientCalendar.GetNextWeekDate(this.lastSelectedDate);
29380   this.CorrectVisibleMonth(newDate, true);
29381   this.DoKeyboardSelection(newDate, evt.shiftKey, "down");
29382  }
29383  return true;
29384 },
29385 OnArrowLeft: function(evt) { 
29386  if(this.IsFastNavigationActive()) {
29387   if(this.fastNavigation) {
29388    var result = this.fastNavigation.OnArrowLeft(evt);
29389    if(result && !this.showFastPopup && this.IsAnimationEnabled())
29390     this.StartBeforeFastNavigationShiftPeriodAnimation(function() { }, -1);
29391   }
29392   else {
29393    var currentFastNavigation = this.GetFastNavigation();
29394    var visiblePeriodsChanged = currentFastNavigation.OnArrowLeft(evt);
29395    if(visiblePeriodsChanged) {
29396     var shiftPeriodFunction = function () {
29397      for (var key in this.views) {
29398       if (this.views.hasOwnProperty(key)) {
29399        var fastNavigation = this.views[key].fastNavigation;
29400        if (fastNavigation != currentFastNavigation)
29401         fastNavigation.ShiftVisibleNavigationPeriod(-1, true);
29402       }
29403      }
29404     }.aspxBind(this);
29405     if(this.IsAnimationEnabled())
29406      this.StartBeforeFastNavigationShiftPeriodAnimation(shiftPeriodFunction, -1);
29407     else
29408      shiftPeriodFunction();
29409    }
29410   }
29411  }
29412  else if(!this.GetReadOnly()) {  
29413   var newDate = this.GetNearestDayForToday();
29414   if(this.lastSelectedDate) 
29415    newDate = ASPxClientCalendar.GetYesterDate(this.lastSelectedDate);
29416   if(!ASPxClientCalendarDateDisabledHelper.IsDateWithinBoundaries(newDate))
29417    return true;
29418   this.CorrectVisibleMonth(newDate, false);
29419   this.DoKeyboardSelection(newDate, evt.shiftKey, "left");
29420  }
29421  return true;
29422 },
29423 OnArrowRight: function(evt) {
29424  if(this.IsFastNavigationActive()) {
29425   if (this.fastNavigation) {
29426    var result = this.fastNavigation.OnArrowRight(evt);
29427    if(result && !this.showFastPopup && this.IsAnimationEnabled())
29428     this.StartBeforeFastNavigationShiftPeriodAnimation(function () { }, 1);
29429   }
29430   else {
29431    var currentFastNavigation = this.GetFastNavigation();
29432    var visiblePeriodsChanged = currentFastNavigation.OnArrowRight(evt);
29433    if(visiblePeriodsChanged) {
29434     var shiftPeriodFunction = function() {
29435      for(var key in this.views) {
29436       if(this.views.hasOwnProperty(key)) {
29437        var fastNavigation = this.views[key].fastNavigation;
29438        if(fastNavigation != currentFastNavigation)
29439         fastNavigation.ShiftVisibleNavigationPeriod(1, true);
29440       }
29441      }
29442     }.aspxBind(this);
29443     if(this.IsAnimationEnabled())
29444      this.StartBeforeFastNavigationShiftPeriodAnimation(shiftPeriodFunction, 1);
29445     else
29446      shiftPeriodFunction();
29447    }
29448   }
29449  }
29450  else if(!this.GetReadOnly()) {  
29451   var newDate = this.GetNearestDayForToday();
29452   if(this.lastSelectedDate)
29453    newDate = ASPxClientCalendar.GetTomorrowDate(this.lastSelectedDate);
29454   this.CorrectVisibleMonth(newDate, true);
29455   this.DoKeyboardSelection(newDate, evt.shiftKey, "right");
29456  }
29457  return true;
29458 },
29459 OnCallback: function(result){
29460  var rowElements = this.GetCalendarRowElements();
29461  for(var rowIndex = 0; rowIndex < this.rows; rowIndex++) {
29462   var viewCellElements = this.GetCalendarViewCellElements(rowElements[rowIndex]);
29463   for(var cellIndex = 0; cellIndex < this.columns; cellIndex++)
29464    ASPx.SetInnerHtml(viewCellElements[cellIndex], result[rowIndex * this.columns + cellIndex]);
29465  }
29466  if(this.sharedParameters.hasCustomDisabledDatesViaCallback) {
29467    this.AddCallbackCustomDisabledDates(result[result.length - 1]);
29468  }
29469  if(!this.IsMultiView() && this.enableFast && !this.showFastPopup)
29470   this.CreateFastNavigation();
29471  this.CreateViews();
29472  this.InitializeGestures();
29473  this.InitializeEnabled();
29474  this.AttachEventHandlers();
29475  if(!this.isDateEditCalendar)
29476   this.SetFocus();
29477  if(!this.sharedParameters.calendarCustomDraw)
29478   this.UpdateInternal();
29479  this.EnsureTodayStyle();
29480  this.SetInitialVisibleDate();
29481 },
29482 OnPageUp: function(evt) {
29483  if(this.IsFastNavigationActive()) {
29484   if(this.fastNavigation) {
29485    var result = this.fastNavigation.OnPageUp(evt);
29486    if(result && !this.showFastPopup && this.IsAnimationEnabled())
29487     this.StartBeforeFastNavigationShiftPeriodAnimation(function () { }, -1);
29488   }
29489   else {
29490    var currentFastNavigation = this.GetFastNavigation();
29491    var success = currentFastNavigation.OnPageUp(evt);
29492    var currentFastNavChanged = !currentFastNavigation.IsViewActivated();
29493    if (success && !currentFastNavChanged) {
29494     var shiftPeriodFunction = function () {
29495      for(var key in this.views) {
29496       if(this.views.hasOwnProperty(key)) {
29497        var fastNavigation = this.views[key].fastNavigation;
29498        if(fastNavigation != currentFastNavigation)
29499         fastNavigation.OnPageUp(evt);
29500       }
29501      }
29502     }.aspxBind(this);
29503     if(this.IsAnimationEnabled())
29504      this.StartBeforeFastNavigationShiftPeriodAnimation(shiftPeriodFunction, -1);
29505     else
29506      shiftPeriodFunction();
29507    }
29508   }
29509  }
29510  else if(!this.GetReadOnly()) {
29511   var newDate = this.GetNearestDayForToday();
29512   if(this.lastSelectedDate) {
29513    if(evt.ctrlKey)
29514     newDate = ASPxClientCalendar.GetPrevYearDate(this.lastSelectedDate);
29515    else
29516     newDate = ASPxClientCalendar.GetPrevMonthDate(this.lastSelectedDate);   
29517   }
29518   if(!ASPxClientCalendarDateDisabledHelper.IsDateWithinBoundaries(newDate))
29519    return true;
29520   this.CorrectVisibleMonth(newDate, false);  
29521   this.DoKeyboardSelection(newDate);
29522  }
29523  return true; 
29524 },
29525 OnPageDown: function(evt) {
29526  if(this.IsFastNavigationActive()) {
29527   if(this.fastNavigation) {
29528    var result = this.fastNavigation.OnPageDown(evt);
29529    if(result && !this.showFastPopup && this.IsAnimationEnabled())
29530     this.StartBeforeFastNavigationShiftPeriodAnimation(function () { }, 1);
29531   }
29532   else {
29533    var currentFastNavigation = this.GetFastNavigation();
29534    var success = currentFastNavigation.OnPageDown(evt);
29535    var currentFastNavChanged = !currentFastNavigation.IsViewActivated();
29536    if (success && !currentFastNavChanged) {
29537     var shiftPeriodFunction = function() {
29538      for(var key in this.views) {
29539       if(this.views.hasOwnProperty(key)) {
29540        var fastNavigation = this.views[key].fastNavigation;
29541        if(fastNavigation != currentFastNavigation)
29542         fastNavigation.OnPageDown(evt);
29543       }
29544      }
29545     }.aspxBind(this);
29546     if(this.IsAnimationEnabled())
29547      this.StartBeforeFastNavigationShiftPeriodAnimation(shiftPeriodFunction, 1);
29548     else
29549      shiftPeriodFunction();
29550    }
29551   }
29552  }
29553  else if(!this.GetReadOnly()) {
29554   var newDate = this.GetNearestDayForToday();
29555   if(this.lastSelectedDate) {
29556    if(evt.ctrlKey)
29557     newDate = ASPxClientCalendar.GetNextYearDate(this.lastSelectedDate);
29558    else
29559     newDate = ASPxClientCalendar.GetNextMonthDate(this.lastSelectedDate);
29560   }
29561   this.CorrectVisibleMonth(newDate, true);
29562   this.DoKeyboardSelection(newDate);
29563  }
29564  return true;
29565 },
29566 OnEndKeyDown: function(evt) {
29567  if(!this.GetReadOnly() && !this.IsFastNavigationActive()) { 
29568   var newDate = this.GetNearestDayForToday();
29569   if(this.lastSelectedDate)   
29570    newDate = ASPxClientCalendar.CloneDate(this.lastSelectedDate);
29571   newDate = ASPxClientCalendar.GetLastDayInMonthDate(newDate);
29572   this.CorrectVisibleMonth(newDate, false);
29573   this.DoKeyboardSelection(newDate, evt.shiftKey);
29574  }
29575  return true;
29576 },
29577 OnHomeKeyDown: function(evt) {
29578  if(!this.GetReadOnly() && !this.IsFastNavigationActive()) {
29579   var newDate = this.GetNearestDayForToday();
29580   if(this.lastSelectedDate)   
29581    newDate = ASPxClientCalendar.CloneDate(this.lastSelectedDate);
29582   newDate = ASPxClientCalendar.GetFirstDayInMonthDate(newDate);   
29583   this.CorrectVisibleMonth(newDate, false);
29584   this.DoKeyboardSelection(newDate, evt.shiftKey);
29585  }
29586  return true; 
29587 },
29588 OnEnterDown: function() {
29589  if(this.IsFastNavigationActive()) {
29590   if(this.fastNavigation)
29591    this.fastNavigation.OnEnter();
29592   else {
29593    for(var key in this.views) {
29594     if(this.views.hasOwnProperty(key))
29595      this.views[key].fastNavigation.OnEnter();
29596    }
29597   }
29598   return true;
29599  }
29600  return false;
29601 },
29602 OnEnterPressed: function() {
29603  return true;
29604 },
29605 OnEscape: function() {
29606  if(this.IsFastNavigationActive())
29607   this.CancelFastNavigation();
29608  return true;
29609 },
29610 CancelFastNavigation: function() {
29611  if(this.fastNavigation)
29612   this.fastNavigation.CancelChanges();
29613  else {
29614   for(var key in this.views) {
29615    if(this.views.hasOwnProperty(key))
29616     this.views[key].fastNavigation.CancelChanges();
29617   }
29618  }
29619 },
29620 OnShiftMonth: function(offset, keepVisibleInSingleMode) {
29621  if(offset) {
29622   if(!this.IsFastNavigationActive() || this.showFastPopup) {
29623    var date = ASPxClientCalendar.AddMonths(this.visibleDate, offset);     
29624    this.OnVisibleMonthChanged(date);
29625   }
29626   else {
29627    this.OnFastNavigationShiftPeriod(offset);
29628   }
29629   if (keepVisibleInSingleMode)
29630    this.visibleDateColumnOffset = Math.min(Math.abs(offset), this.columns - 1);
29631  }
29632 },
29633 OnFastNavigationShiftPeriod: function(offset) {
29634  if(this.IsAnimationEnabled())
29635   this.StartBeforeFastNavigationShiftPeriodAnimation(this.OnFastNavigationShiftPeriodInternal.aspxBind(this), offset);
29636  else
29637   this.OnFastNavigationShiftPeriodInternal(offset);
29638 },
29639 StartBeforeFastNavigationShiftPeriodAnimation: function (action, offset) {
29640  this.slideAnimationDirection = offset > 0 ?
29641   ASPx.AnimationHelper.SLIDE_LEFT_DIRECTION : ASPx.AnimationHelper.SLIDE_RIGHT_DIRECTION;
29642  this.updateAnimationProcessing = true;
29643  var element = this.GetCallbackAnimationElement();
29644  var onFinishBeforeAnimation = function() {
29645   action(offset);
29646   if(this.IsAnimationEnabled())
29647    this.StartAfterFastNavigationShiftPeriodAnimation();
29648  }.aspxBind(this);
29649  if (this.isSlideCallbackAnimationEnabled() && this.slideAnimationDirection)
29650   ASPx.AnimationHelper.slideOut(element, this.slideAnimationDirection, onFinishBeforeAnimation, ASPx.AnimationEngineType.JS);
29651  else if (this.enableCallbackAnimation)
29652   ASPx.AnimationHelper.fadeOut(element, onFinishBeforeAnimation);
29653  else
29654   action(offset);
29655 },
29656 OnFastNavigationShiftPeriodInternal: function (offset) {
29657  if (this.fastNavigation)
29658   this.fastNavigation.ShiftVisibleNavigationPeriod(offset, true);
29659  else {
29660   for (var key in this.views) {
29661    if (this.views.hasOwnProperty(key)) {
29662     this.views[key].fastNavigation.ShiftVisibleNavigationPeriod(offset, true);
29663    }
29664   }
29665  }
29666 },
29667 StartAfterFastNavigationShiftPeriodAnimation: function () {
29668  var element = this.GetCallbackAnimationElement();
29669  if(this.isSlideCallbackAnimationEnabled() && this.slideAnimationDirection)
29670   ASPx.AnimationHelper.slideIn(element, this.slideAnimationDirection, this.FinishAfterFastNavigationShiftPeriodAnimation.aspxBind(this), ASPx.AnimationEngineType.JS);
29671  else if(this.enableCallbackAnimation)
29672   ASPx.AnimationHelper.fadeIn(element, this.FinishAfterFastNavigationShiftPeriodAnimation.aspxBind(this));
29673  else
29674   this.FinishAfterFastNavigationShiftPeriodAnimation();
29675 },
29676 FinishAfterFastNavigationShiftPeriodAnimation: function () {
29677  this.updateAnimationProcessing = false;
29678  this.slideAnimationDirection = null;
29679  this.CheckRepeatGesture();
29680 },
29681 OnDayMouseDown: function(date, shift, ctrl, byWeeks) {
29682  this.isMouseDown = true;
29683  this.selectionByWeeks = byWeeks;
29684  if(!this.enableMulti && this.isSwipeGesturesEnabled())
29685   return;
29686  this.selectionTransaction.Start();
29687  if(this.enableMulti) {
29688   if(ctrl) {
29689    this.selectionCtrl = true;
29690    this.selectionTransaction.CopyFromBackup();
29691   } else
29692    this.selectionCtrl = false;
29693   if(shift && this.selectionPrevStartDate) {
29694    this.selectionStartDate = this.selectionPrevStartDate;         
29695    this.selectionTransaction.selection.AddRange(this.selectionStartDate, date);
29696    if(byWeeks)
29697     this.selectionTransaction.selection.AddWeek(date);
29698   } else {
29699    this.selectionStartDate = date;
29700    this.selectionPrevStartDate = date;
29701    if(byWeeks)
29702     this.selectionTransaction.selection.AddWeek(date);
29703    else
29704     this.selectionTransaction.selection.Add(date);
29705   }
29706  } 
29707  else 
29708   this.selectionTransaction.selection.Add(date);
29709  if(!ASPxClientCalendarDateDisabledHelper.IsDateWithinBoundaries(date))
29710   this.selectionTransaction.CopyFromBackup();
29711  if(this.enableMulti)
29712   this.RemoveDisabledDatesFromSelection(this.selectionTransaction.selection);
29713  this.ApplySelectionByDiff(this.selectionTransaction.selection, false);
29714 },
29715 OnDayMouseOver: function (date) {
29716  if (!this.sharedParameters.DaysSelectingOnMouseOver.IsEmpty()) {
29717   var args = new ASPxDaysSelectingOnMouseOverEventArgs(date);
29718   this.sharedParameters.DaysSelectingOnMouseOver.FireEvent(this, args);
29719   if (args.cancel)
29720    return;
29721   this.selectionStartDate = args.selectionStartDate;
29722   date = args.overDate;
29723  }
29724  if (!this.enableMulti && this.isSwipeGesturesEnabled() && !this.sharedParameters.dateRangeMode)
29725   return;
29726  if (this.enableMulti || this.sharedParameters.dateRangeMode) {
29727   if(this.selectionCtrl)
29728    this.selectionTransaction.CopyFromBackup();
29729   else
29730    this.selectionTransaction.selection.Clear();
29731   if(this.sharedParameters.dateRangeMode)
29732    this.CalculateRangeSelectionOnMouseOver(date);
29733   else
29734    this.selectionTransaction.selection.AddRange(this.selectionStartDate, date);
29735   if(this.selectionByWeeks) {
29736    this.selectionTransaction.selection.AddWeek(date);
29737    this.selectionTransaction.selection.AddWeek(this.selectionStartDate);
29738   }
29739  } 
29740  else {
29741   this.selectionTransaction.selection.Clear();
29742   this.selectionTransaction.selection.Add(date);
29743  }
29744  if (this.enableMulti || this.sharedParameters.dateRangeMode)
29745   this.RemoveDisabledDatesFromSelection(this.selectionTransaction.selection);
29746  this.ApplySelectionByDiff(this.selectionTransaction.selection, false);
29747  if (this.updateDayStylesTwiceOnMouseOver)
29748   this.ForceUpdateOnMouseOver();
29749 },
29750 ForceUpdateOnMouseOver: function() {
29751  this.forceUpdatingOnMouseOver = true;
29752  try {
29753   this.Update();
29754  }
29755  finally {
29756   this.forceUpdatingOnMouseOver = false;
29757  }
29758 },
29759 CalculateRangeSelectionOnMouseOver: function(overDate) {
29760  var selectedRangeRestrictions = {
29761   start: ASPxClientCalendar.GetMinDate(this.selectionStartDate, overDate),
29762   end: ASPxClientCalendar.GetMaxDate(this.selectionStartDate, overDate)
29763  };
29764  var visibleRangeRestrictions = this.GetVisibleRangeRestrictions();
29765  ASPxClientCalendar.AddSelectedRangeVisiblePartToSelection(this.selectionTransaction.selection, selectedRangeRestrictions, visibleRangeRestrictions);
29766 },
29767 RaiseVisibleDaysMouseOut: function() {
29768  if (!this.sharedParameters.VisibleDaysMouseOut.IsEmpty())
29769   this.sharedParameters.VisibleDaysMouseOut.FireEvent(this);
29770 },
29771 OnDayMouseUp: function(date) {
29772  if(!ASPx.Browser.IE && this.isMouseDown)
29773   this.OnMainElementClick();
29774  this.isMouseDown = false;
29775  if(!this.enableMulti && this.isSwipeGesturesEnabled() && this.swipeGestureStated)
29776   this.swipeGestureStated = false;
29777  if(this.enableMulti) {
29778   if(this.selectionCtrl && this.selectionTransaction.backup.Contains(date) &&
29779    ASPxClientCalendar.AreDatesEqual(date, this.selectionStartDate)) {
29780    if(this.selectionByWeeks)
29781     this.selectionTransaction.selection.RemoveWeek(date);
29782    else
29783     this.selectionTransaction.selection.Remove(date);
29784   }
29785  }
29786  else if(this.sharedParameters.dateRangeMode) {
29787   this.selectionTransaction.selection.Clear();
29788   this.selectionTransaction.selection.Add(date);
29789  }
29790  else if(this.isSwipeGesturesEnabled() && !this.swipeGestureStated) {
29791   this.selectionTransaction.selection.Add(date);
29792   if(!ASPxClientCalendarDateDisabledHelper.IsDateWithinBoundaries(date))
29793    this.selectionTransaction.CopyFromBackup();
29794   this.ApplySelectionByDiff(this.selectionTransaction.selection, false);
29795  }
29796  this.lastSelectedDate = ASPxClientCalendar.CloneDate(date);
29797  this.OnSelectionChanging();
29798 },
29799 GetTodayDate: function() {
29800  var parentSchedulerTodayDate = this.GetParentSchedulerTodayDate();
29801  if(parentSchedulerTodayDate)
29802   return parentSchedulerTodayDate;
29803  var now = new Date(); 
29804  var date = new Date(now.getFullYear(), now.getMonth(), now.getDate());
29805  return date;
29806 },
29807 GetParentSchedulerTodayDate: function() {
29808  return this.actualTodayDate;
29809 },
29810 EnsureHideFastNavigation: function() {
29811  if (this.IsFastNavigationActive()) {
29812   if (this.fastNavigation)
29813    this.fastNavigation.Hide();
29814   else {
29815    for (var key in this.views) {
29816     if (this.views.hasOwnProperty(key))
29817      this.views[key].fastNavigation.Hide();
29818    }
29819    this.SetFastNavigationViewKey("");
29820   }
29821  }
29822 },
29823 OnTodayClick: function() {
29824  this.EnsureHideFastNavigation();
29825  var todayDate = this.GetTodayDate();
29826  if(ASPxClientCalendarDateDisabledHelper.IsDateInRange(this.sharedParameters, todayDate)) {
29827   if(!this.IsDateDisabled(todayDate)) {
29828    this.selectionTransaction.Start();
29829    this.selectionTransaction.selection.Add(todayDate);
29830    this.lastSelectedDate = ASPxClientCalendar.CloneDate(todayDate);
29831    this.OnSelectionChanging();
29832   }
29833   if(!ASPxClientCalendar.AreDatesOfSameMonth(todayDate, this.visibleDate))
29834    this.OnVisibleMonthChanged(todayDate);  
29835  }
29836 },
29837 OnClearClick: function() {
29838  this.selectionTransaction.Start();
29839  this.OnSelectionChanging();
29840  this.selectionStartDate = null;
29841  this.selectionPrevStartDate = null;    
29842  this.ResetLastSelectedDate();
29843 },
29844 ResetLastSelectedDate: function() {
29845  this.lastSelectedDate = null;
29846 },
29847 OnSelectMonth: function(row, column) {  
29848  var txn = this.selectionTransaction;
29849  txn.Start();
29850  var date = ASPxClientCalendar.CloneDate(this.GetView(row, column).visibleDate);
29851  date.setDate(1);
29852  do {  
29853   if(ASPxClientCalendarDateDisabledHelper.IsDateInRange(this.sharedParameters, date) &&
29854    !this.IsDateDisabled(date))
29855    txn.selection.Add(date);
29856   date = ASPxClientCalendar.AddDays(date, 1);
29857  } while(date.getDate() > 1);
29858  this.OnSelectionChanging();
29859 },
29860 OnTitleClick: function(row, column) {
29861  if(!this.AllowProcessTitleClick())
29862   return;
29863  var activeView = this.GetView(row, column);
29864  if(this.fastNavigation) {
29865   this.fastNavigation.activeView = activeView;
29866   this.fastNavigation.Show();
29867  }
29868  else {
29869   this.SetFastNavigationViewKey(this.GetViewKey(activeView.row, activeView.column));
29870   for(var key in this.views) {
29871    if(this.views.hasOwnProperty(key))
29872     this.views[key].fastNavigation.Show();
29873   }
29874  }
29875 },
29876 AllowProcessTitleClick: function() {
29877  if(this.fastNavigation)
29878   return this.fastNavigation.AllowProcessTitleClick();
29879  else {
29880   for(var key in this.views)
29881    if(this.views.hasOwnProperty(key))
29882     return this.views[key].fastNavigation.AllowProcessTitleClick();
29883  }
29884  return true;
29885 },
29886 OnMainElementClick: function(mouseEvt) {
29887  this.MainElementClick.FireEvent(this, mouseEvt);
29888 },
29889 OnSelectionChanging: function() {
29890  if(!this.SelectionChanging.IsEmpty()){
29891   var args = new ASPxClientCalendarSelectionEventArgs(false, this.selectionTransaction.selection);
29892   this.SelectionChanging.FireEvent(this, args);  
29893  }
29894  var changed = this.selectionTransaction.IsChanged();
29895  this.selectionTransaction.Commit();
29896  if(changed)
29897   this.OnValueChanged();  
29898 },
29899 OnVisibleMonthChanged: function(date) {
29900  var offsetInternal = ASPxClientCalendar.GetOffsetInMonths(this.visibleDate, date);
29901  this.SetVisibleDate(date);
29902  var processOnServer = this.RaiseVisibleMonthChanged(offsetInternal);
29903  if(processOnServer && !this.customDraw)
29904   this.SendPostBackInternal("");
29905 },
29906 OnSelectionCancelled: function() {
29907  this.isMouseDown = false;  
29908  this.selectionTransaction.Rollback();
29909 },
29910 OnCustomDisabledDate: function(date) {
29911  return this.RaiseCustomDisabledDate(date);
29912 },
29913 RaiseCustomDisabledDate: function(date) {
29914  var args = new ASPxClientCalendarCustomDisabledDateEventArgs(date);
29915  this.CustomDisabledDate.FireEvent(this, args);
29916  return args;
29917 },
29918 RaiseValueChangedEvent: function() {
29919  var processOnServer = ASPxClientEdit.prototype.RaiseValueChangedEvent.call(this);
29920  processOnServer = this.RaiseSelectionChanged(processOnServer);
29921  return processOnServer;
29922 },
29923 SetVisibleDate: function (date) {
29924  var old = this.visibleDate;
29925  date = ASPxClientCalendarDateDisabledHelper.GetCorrectedDate(date);
29926  this.visibleDate = date;
29927  var leftDir = this.rtl ? ASPx.AnimationHelper.SLIDE_LEFT_DIRECTION : ASPx.AnimationHelper.SLIDE_RIGHT_DIRECTION;
29928  var rightDir = this.rtl ? ASPx.AnimationHelper.SLIDE_RIGHT_DIRECTION : ASPx.AnimationHelper.SLIDE_LEFT_DIRECTION;
29929  this.slideAnimationDirection = this.IsAnimationEnabled() ? ((old < this.visibleDate) ? rightDir : leftDir) : null;
29930  if(!ASPxClientCalendar.AreDatesOfSameMonth(date, old) || this.forceUpdate) {
29931   this.forceUpdate = false;
29932   this.Update(); 
29933  }
29934 },
29935 SetSelectedDate: function(date) {
29936  if(ASPxClientCalendarDateDisabledHelper.IsDateInRange(this.sharedParameters, date) &&
29937   !this.IsDateDisabled(date)) {
29938   var selection = new ASPxClientCalendarSelection();
29939   if(date != null) {
29940    selection.Add(date);
29941    this.lastSelectedDate = ASPxClientCalendar.CloneDate(date);
29942   }
29943   this.ApplySelectionByDiff(selection, true);
29944  }
29945 },
29946 CorrectVisibleMonth: function(newDate, isForwardDirection) {
29947  var offset = ASPxClientCalendar.GetOffsetInMonths(this.visibleDate, newDate);
29948  if(this.IsMultiView() && offset != 0) {
29949   var view = isForwardDirection ? this.GetView(this.rows - 1, this.columns - 1) : 
29950            this.GetView(0, 0);
29951   offset = this.IsDateVisible(newDate) ? 0 :
29952       ASPxClientCalendar.GetOffsetInMonths(view.visibleDate, newDate);
29953  }
29954  if(!ASPxClientCalendarDateDisabledHelper.IsDateInRange(this.sharedParameters, newDate) ||
29955   this.IsDateDisabled(newDate))
29956   offset = 0;
29957  if(offset != 0)
29958   this.OnShiftMonth(offset);
29959 },
29960 DoKeyboardSelection: function(date, shift, direction) {
29961  if(ASPxClientCalendarDateDisabledHelper.IsDateInRange(this.sharedParameters, date)) {
29962   this.isDateChangingByKeyboard = true;
29963   var existDate = this.IsDateDisabled(date) ? this.GetNearestDayForDate(date, direction) : date;
29964   if(existDate != null) {
29965    this.selectionTransaction.Start();
29966    if(this.enableMulti && shift && this.selectionStartDate) {
29967     this.selectionTransaction.selection.AddRange(this.selectionStartDate, existDate);
29968     this.RemoveDisabledDatesFromSelection(this.selectionTransaction.selection);
29969    } else {
29970     this.selectionTransaction.selection.Add(existDate);
29971     this.selectionStartDate = existDate;
29972    }
29973    this.lastSelectedDate = ASPxClientCalendar.CloneDate(existDate);
29974    this.OnSelectionChanging();
29975   }
29976   this.isDateChangingByKeyboard = false;
29977  }
29978 },
29979 RemoveDisabledDatesFromSelection: function(selection) {
29980  var selectedDates = selection.GetDates();
29981  for(var i = 0; i < selectedDates.length; i++) {
29982   if(this.IsDateDisabled(selectedDates[i]))
29983    selection.Remove(selectedDates[i]);
29984  }
29985 },
29986 GetNearestDayForToday: function() {
29987  var todayDate = this.GetTodayDate();
29988  if(this.sharedParameters.minDate && !ASPxClientCalendarDateDisabledHelper.IsDateInRange(this.sharedParameters, todayDate))
29989   todayDate = ASPxClientCalendar.CloneDate(this.IsDateDisabled(this.sharedParameters.minDate) ? this.GetNearestDayForDate(this.sharedParameters.minDate, "left") : this.sharedParameters.minDate);
29990  return todayDate;
29991 },
29992 GetNearestDayForDate: function(date, direction) {
29993  var nearestDate = null;
29994  var nextDate = date;
29995  while(nearestDate == null) {
29996   switch(direction) {
29997    case "up":
29998     nextDate = new Date(nextDate.getTime() - (7 * 24 * 60 * 60 * 1000));
29999     break;
30000    case "down":
30001     nextDate = new Date(nextDate.getTime() + (7 * 24 * 60 * 60 * 1000));
30002     break;
30003    case "left":
30004     nextDate = new Date(nextDate.getTime() - (1 * 24 * 60 * 60 * 1000));
30005     break;
30006    case "right":
30007     nextDate = new Date(nextDate.getTime() + (1 * 24 * 60 * 60 * 1000));
30008     break;
30009   }
30010   if(!ASPxClientCalendarDateDisabledHelper.IsDateInRange(this.sharedParameters, nextDate))
30011    return null;
30012   nearestDate = this.IsDateDisabled(nextDate) ? null : nextDate;
30013  }
30014  return nearestDate;
30015 },
30016 UseDelayedSpecialFocus: function() { 
30017  return true;
30018 },
30019 GetDelayedSpecialFocusTriggers: function() {
30020  var list = ASPxClientEdit.prototype.GetDelayedSpecialFocusTriggers.call(this);
30021  if(this.enableFast && this.showFastPopup)
30022   list.push(this.GetFastNavigation().GetPopupWindowElement());
30023  return list;
30024 },
30025 GetSelectedDate: function() {
30026  return this.GetValue();
30027 },
30028 GetVisibleDate: function() {
30029  return this.visibleDate;
30030 },
30031 SelectDate: function(date) {
30032  if(date) {
30033   date = ASPxClientCalendarDateDisabledHelper.GetCorrectedDate(date);
30034   this.selection.Add(date);
30035   this.Update();
30036  }
30037 },
30038 GetVisibleRangeRestrictions: function() {
30039  return {
30040   start: this.GetView(0, 0).GetVisibleRangeRestrictions().start,
30041   end: this.GetView(this.rows - 1, this.columns - 1).GetVisibleRangeRestrictions().end
30042  };
30043 },
30044 NeedCalculateSelectionOnUpdating: function() {
30045  return this.sharedParameters.dateRangeMode && this.selection.startDate && this.selection.endDate && !this.forceUpdatingOnMouseOver;
30046 },
30047 SelectRange: function(start, end) {
30048  if(start && end) {
30049   start = ASPxClientCalendarDateDisabledHelper.GetCorrectedDate(start);
30050   end = ASPxClientCalendarDateDisabledHelper.GetCorrectedDate(end);
30051   if(this.sharedParameters.dateRangeMode)
30052    this.selection.SetRestrictions(start, end);
30053   else
30054    this.selection.AddRange(start, end);
30055   this.Update();
30056  }
30057 },
30058 DeselectDate: function(date) {
30059  if(date) {
30060   this.selection.Remove(date);
30061   this.Update(); 
30062  }
30063 },
30064 DeselectRange: function(start, end) {
30065  if(start && end) {
30066   this.selection.RemoveRange(start, end);
30067   this.Update();
30068  }
30069 },
30070 ClearSelection: function() {
30071  this.selection.Clear();
30072  if(this.sharedParameters.dateRangeMode)
30073   this.selection.ResetRestrictions();
30074  this.Update();
30075 },
30076 GetSelectedDates: function() {
30077  return this.selection.GetDates();
30078 },
30079 RaiseSelectionChangedInternal: function(processOnServer) {
30080  if(!this.sharedParameters.CalendarSelectionChangedInternal.IsEmpty()) {
30081   var args = new ASPxClientProcessingModeEventArgs(processOnServer);
30082   this.sharedParameters.CalendarSelectionChangedInternal.FireEvent(this, args);
30083   processOnServer = args.processOnServer;
30084  }
30085  return processOnServer;
30086 },
30087 RaiseSelectionChanged: function(processOnServer) {
30088  processOnServer = this.RaiseSelectionChangedInternal(processOnServer);
30089  if(!this.SelectionChanged.IsEmpty()){
30090   var args = new ASPxClientProcessingModeEventArgs(processOnServer);  
30091   this.SelectionChanged.FireEvent(this, args);
30092   processOnServer = args.processOnServer;
30093  }
30094  return processOnServer;
30095 },
30096 RaiseVisibleMonthChanged: function(offsetInternal){
30097  var processOnServer = this.autoPostBack;
30098  if(!this.VisibleMonthChanged.IsEmpty()){
30099   var args = new ASPxClientProcessingModeEventArgs(processOnServer);
30100   args.offsetInternal = offsetInternal;
30101   this.VisibleMonthChanged.FireEvent(this, args);
30102   processOnServer = args.processOnServer;
30103  }
30104  return processOnServer;
30105 },
30106 SetReadOnlyInternal: function(readOnly) {
30107  ASPxClientEdit.prototype.SetReadOnlyInternal.call(this, readOnly);
30108  this.ChangeReadOnlyAttributes(readOnly);
30109  var footer = this.GetFooter();
30110  if(footer)
30111   footer.style.display = readOnly ? "none" : "";
30112 },
30113 ChangeEnabledAttributes: function(enabled){ 
30114  ASPx.Attr.ChangeDocumentEventsMethod(enabled)("mouseup", aspxCalDocMouseUp);
30115  ASPx.Attr.ChangeEventsMethod(enabled)(this.GetMainElement(), "click", ASPxClientCalendar.AnonymousHandlers.MainElementClick(this.name));
30116  var inputElement = this.GetInputElement();
30117  if(inputElement) {
30118   this.ChangeSpecialInputEnabledAttributes(inputElement, ASPx.Attr.ChangeEventsMethod(enabled));
30119   if(!this.accessibilityCompliant) {
30120    var changeMethod = enabled ? ASPx.Attr.RestoreTabIndexAttribute : ASPx.Attr.SaveTabIndexAttributeAndReset;
30121    changeMethod(inputElement);
30122   }
30123  }
30124  var btnElement = this.GetTodayButton();
30125  if(btnElement)
30126   this.ChangeButtonEnabledAttributes(btnElement, this.GetChangeButtonEnabledAttributesMethod(enabled));
30127  btnElement = this.GetClearButton();
30128  if(btnElement)
30129   this.ChangeButtonEnabledAttributes(btnElement, this.GetChangeButtonEnabledAttributesMethod(enabled));
30130  var readOnly = this.GetReadOnly();
30131  var editable = !readOnly ? enabled : undefined;
30132  for(var key in this.views) {
30133   if(this.views.hasOwnProperty(key)) {
30134    var view = this.views[key];
30135    if(!view.isASPxClientCalendarView) continue;
30136    view.ChangeEnabledAttributes(enabled);
30137    if(editable !== undefined)
30138     view.ChangeEditableAttributes(editable);
30139   }
30140  }
30141 },
30142 ChangeReadOnlyAttributes: function(readOnly) {
30143  if(!this.GetEnabled())
30144   return;
30145  for(var key in this.views) {
30146   if(this.views.hasOwnProperty(key)) {
30147    var view = this.views[key];
30148    if(!view.isASPxClientCalendarView) continue;
30149    view.ChangeEditableAttributes(!readOnly);
30150   }
30151  }
30152 },
30153 ChangeEnabledStateItems: function(enabled){
30154  ASPx.GetStateController().SetElementEnabled(this.GetMainElement(), enabled);
30155  var btnElement = this.GetTodayButton();
30156  if(btnElement)
30157   ASPx.GetStateController().SetElementEnabled(btnElement, enabled);
30158  btnElement = this.GetClearButton();
30159  if(btnElement)
30160   ASPx.GetStateController().SetElementEnabled(btnElement, enabled);
30161  for(var key in this.views) {
30162   if(this.views.hasOwnProperty(key)) {
30163    var view = this.views[key];
30164    if(!view.isASPxClientCalendarView) continue;
30165    view.ChangeEnabledStateItems(enabled);
30166   }
30167  }
30168  this.EnsureHideFastNavigation();
30169  this.UpdateInternal();   
30170 },
30171 ChangeButtonEnabledAttributes: function(element, method){
30172  method(element, "onclick");
30173  method(element, "ondblclick");
30174 },
30175 GetChangeButtonEnabledAttributesMethod: function(enabled) {
30176  return ASPx.Attr.ChangeAttributesMethod(enabled);
30177 },
30178 GetMinDate: function() {
30179  return this.sharedParameters.minDate;
30180 },
30181 SetMinDate: function(date) {
30182  date = ASPxClientCalendarDateDisabledHelper.GetCorrectedDate(date);
30183  this.sharedParameters.minDate = date;
30184  this.Update();
30185 },
30186 GetMaxDate: function() {
30187  return this.sharedParameters.maxDate;
30188 },
30189 SetMaxDate: function(date) {
30190  date = ASPxClientCalendarDateDisabledHelper.GetCorrectedDate(date);
30191  this.sharedParameters.maxDate = date;
30192  this.Update();
30193 },
30194 CheckDateEnabled: function(date){
30195  return !this.IsDateDisabled(date);
30196 },
30197 CanMouseDown: function(evt, date){
30198  if(!evt) return false;
30199  return ASPx.Evt.IsLeftButtonPressed(evt) && !this.IsDateDisabled(date);
30200 },
30201 CanMouseOver: function(date){
30202  if(this.forceMouseDown || this.isMouseDown || this.sharedParameters.dateRangeMode)
30203   return !this.IsDateDisabled(date);
30204  return false;
30205 },
30206 OnAssociatedLabelClick: function(evt) {
30207  ASPxClientCalendar.prototype.OnDelayedSpecialFocusMouseDown.call(this, evt);
30208 }
30209});
30210ASPxClientCalendar.Cast = ASPxClientControl.Cast;
30211var AccessibilityHelperCalendar = ASPx.CreateClass(ASPx.AccessibilityHelperBase, {
30212 constructor: function(calendar) {
30213  this.constructor.prototype.constructor.call(this, calendar);
30214  this.control.GotFocus.AddHandler(function() { this.PronounceDates(this.control.GetSelectedDates(), true); }.aspxBind(this));
30215  this.control.LostFocus.AddHandler(function() { 
30216   setTimeout(function() { this.changeActivityAttributes(this.getMainElement(), { "aria-activedescendant": "" }); }.aspxBind(this), 200); 
30217  }.aspxBind(this));
30218 },
30219 PronounceDates: function(dates, useDescriptionText) {
30220  var datesText = this.getDatesText(dates);
30221  var dateEditInput = null;
30222  var activeItemArgs = null;
30223  var inactiveItemArgs = null;
30224  if(this.control.isDateEditCalendar) {
30225   var dateEdit = this.control.sharedParameters.currentDateEdit;
30226   if(dateEdit)
30227    dateEditInput = dateEdit.GetInputElement();
30228   activeItemArgs = {
30229    "role"    : "option",
30230    "aria-selected" : true
30231   };
30232   inactiveItemArgs = {
30233    "role"    : "",
30234    "aria-selected" : ""
30235   };
30236  }
30237  if(!this.control.isDateEditCalendar && useDescriptionText) 
30238   datesText = ASPx.AccessibilitySR.CalendarDescription + " " + datesText;
30239  this.PronounceMessage(datesText, activeItemArgs, inactiveItemArgs, null, dateEditInput);
30240 },
30241 getDatesText: function(dates) {
30242  var datesText = "";
30243  if(dates.length == 0)
30244   datesText = this.control.isDateEditCalendar ? ASPx.AccessibilitySR.CalendarDescription : ASPx.AccessibilitySR.BlankEditorText;
30245  else {
30246   dates.sort(function(x, y) { return x.valueOf() - y.valueOf(); });
30247   var ranges = this.getDateRanges(dates);
30248   datesText = this.getRangesText(ranges);
30249  }
30250  return datesText;
30251 },
30252 GetActiveElement: function(inputIsMainElement) {
30253  var activeElement = ASPx.AccessibilityHelperBase.prototype.GetActiveElement.call(this, inputIsMainElement);
30254  var mainElement = inputIsMainElement ? this.control.GetInputElement() : this.getMainElement();
30255  return activeElement == mainElement ? null : activeElement;
30256 },
30257 getRangesText: function(ranges) {
30258  var dateText = "";
30259  var hasMultiSelect = ranges.length > 1 || ranges.length === 1 && ranges[0].count > 1;
30260  if(hasMultiSelect)
30261   dateText = ASPx.AccessibilitySR.CalendarMultiSelectText;
30262  var rangesLength = ranges.length;
30263  var rangeDatesTextArray = [ ];
30264  for(var i = 0; i < rangesLength; i++)
30265   rangeDatesTextArray.push(this.getRangeText(ranges[i]));
30266  return dateText + rangeDatesTextArray.join(', ');
30267 },
30268 getRangeText: function(range) {
30269  var rangeFormatString = ASPx.AccessibilitySR.CalendarRangeFormatString;
30270  var startDateString = this.getDateString(range.start);
30271  if(range.count === 1)
30272   return startDateString;
30273  var endDateString = this.getDateString(ASPxClientCalendar.AddDays(range.start, range.count - 1));
30274  return ASPx.Str.ApplyReplacement(rangeFormatString, [["{0}", startDateString], ["{1}", endDateString]]);
30275 },
30276 getDateString: function(date) {
30277  var dateStringArray = [ ];
30278  dateStringArray.push(ASPx.CultureInfo.dayNames[date.getDay()]);
30279  dateStringArray.push(ASPx.CultureInfo.monthNames[date.getMonth()]);
30280  dateStringArray.push(date.getDate());
30281  dateStringArray.push(date.getFullYear());
30282  return dateStringArray.join(' ');
30283 },
30284 getDateRanges: function(dates) {
30285  var ranges = [ ];
30286  var start = null;
30287  var end = null;
30288  for(var i = 0; i < dates.length; i++) {
30289   var d1 = dates[i];
30290   var d2 = i < dates.length ? dates[i + 1] : d1;
30291   if(!start)
30292    start = end = d1;
30293   if(this.isNeibourDates(d1, d2)) {
30294    end = d2;
30295   } else {
30296    ranges.push({ start: start, count: ASPxClientCalendar.GetDaysInRange(start, end) });
30297    start = end = null;
30298   }
30299  }
30300  return ranges;
30301 },
30302 isNeibourDates: function(date1, date2) {
30303  var nextDay = ASPxClientCalendar.AddDays(date1, 1);
30304  return ASPxClientCalendar.AreDatesEqual(nextDay, date2);
30305 }
30306});
30307var ASPxClientCalendarCustomDisabledDateEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
30308 constructor: function(date) {
30309  this.constructor.prototype.constructor.call(this);
30310  this.date = date;
30311  this.isDisabled = false;
30312 }
30313});
30314ASPxClientCalendar.AnonymousHandlers = { 
30315 MainElementClick: function(name) {
30316  return function(e) {
30317   var cal = ASPx.GetControlCollection().Get(name);
30318   if(cal)
30319    cal.OnMainElementClick(e);
30320  };
30321 },
30322 SelectMonth: function(name, row, column) {
30323  return function() {
30324   var cal = ASPx.GetControlCollection().Get(name);
30325   if(cal)
30326    cal.OnSelectMonth(row, column);
30327  };
30328 },
30329 DayMouseEvent: function(name, row, column, index, byWeeks) {
30330  return function(e) {
30331   var cal = ASPx.GetControlCollection().Get(name);
30332   if(!cal)
30333    return;
30334   var view = cal.GetView(row, column);
30335   var date = view.GetDateByIndex(index);
30336   if(byWeeks)
30337    date = ASPxClientCalendar.AddDays(date, cal.firstDayOfWeek - date.getDay());
30338   var allowed = ASPxClientCalendarDateDisabledHelper.IsDateInRange(cal.sharedParameters, date) && (view.IsDateVisible(date) || byWeeks);
30339   switch(e.type) {
30340    case "mousedown":
30341     if(allowed && cal.CanMouseDown(e, date)) {
30342      var ctrl = e.ctrlKey || ASPx.Browser.MacOSPlatform && e.metaKey;
30343      cal.OnDayMouseDown(date, e.shiftKey, ctrl, byWeeks);
30344     }
30345     break;
30346    case "mouseover":
30347     if(allowed && cal.CanMouseOver(date)) {
30348      if(cal.forceMouseDown)
30349       cal.OnDayMouseDown(date, false, false, false);
30350      else if (cal.isMouseDown || cal.sharedParameters.dateRangeMode)
30351       cal.OnDayMouseOver(date);
30352     }
30353     break;
30354    case "mouseup":
30355     if(cal.isMouseDown) {
30356      if(allowed && !cal.IsDateDisabled(date))
30357       cal.OnDayMouseUp(date);
30358      else
30359       cal.OnSelectionCancelled();
30360     }
30361     break;
30362    case "mouseout":
30363     if (cal.sharedParameters.dateRangeMode) {
30364      var isAllowedOverDate = false;
30365      var overCell = ASPx.Evt.GetEventRelatedTarget(e, false);
30366      var overCellIndex = view.GetDayCellIndex(overCell);
30367      if (ASPx.IsExists(overCellIndex)) {
30368       var overDate = view.GetDateByIndex(overCellIndex);
30369       isAllowedOverDate = overDate && ASPxClientCalendarDateDisabledHelper.IsDateInRange(cal.sharedParameters, overDate) && view.IsDateVisible(overDate) && !cal.IsDateDisabled(overDate);
30370      }
30371      if (!isAllowedOverDate) {
30372       cal.RaiseVisibleDaysMouseOut();
30373      }
30374     }
30375     break;
30376   }     
30377  };
30378 },
30379 FastNavItemClick: function(name, index, row, column) {
30380  return function() {
30381   var cal = ASPx.GetControlCollection().Get(name);
30382   if(cal) {
30383    if(cal.fastNavigation)
30384     cal.fastNavigation.OnNavigationItemClick(index);
30385    else {
30386     var viewKey = cal.GetViewKey(row, column);
30387     cal.SetFastNavigationViewKey(viewKey);
30388     cal.views[viewKey].fastNavigation.OnNavigationItemClick(index);
30389     for(var key in cal.views) {
30390      if(cal.views.hasOwnProperty(key) && key != viewKey)
30391       cal.views[key].fastNavigation.SwitchToPrevMode();
30392     }
30393    }
30394   }
30395  };
30396 },
30397 FastNavMonthClick: function(name, month) {
30398  return function() {
30399   var cal = ASPx.GetControlCollection().Get(name);
30400   if(cal) {
30401    cal.fastNavigation.OnMonthClick(month);
30402   }
30403  };
30404 },
30405 FastNavYearClick: function(name, index) {
30406  return function() {
30407   var cal = ASPx.GetControlCollection().Get(name);
30408   if(cal)
30409    cal.fastNavigation.OnYearClick(index);
30410  };
30411 }
30412};
30413ASPxClientCalendar.GetMinDate = function(date1, date2) {
30414 return date1 < date2 ? date1 : date2;
30415};
30416ASPxClientCalendar.GetMaxDate = function(date1, date2) {
30417 return date1 > date2 ? date1 : date2;
30418};
30419ASPxClientCalendar.AddSelectedRangeVisiblePartToSelection = function(selection, selectedRangeRestrictions, visibleRangeRestrictions) {
30420 selection.Add(selectedRangeRestrictions.start);
30421 selection.Add(selectedRangeRestrictions.end);
30422 var bothRangeRestrictsLessThanVisibleStartDate = selectedRangeRestrictions.start < visibleRangeRestrictions.start
30423  && selectedRangeRestrictions.end < visibleRangeRestrictions.start;
30424 var bothRangeRestrictsGreaterThanVisibleEndDate = selectedRangeRestrictions.start > visibleRangeRestrictions.end
30425  && selectedRangeRestrictions.end > visibleRangeRestrictions.end;
30426 var rangeHasVisiblePart = !bothRangeRestrictsLessThanVisibleStartDate && !bothRangeRestrictsGreaterThanVisibleEndDate;
30427 if(rangeHasVisiblePart) {
30428  var requiredSelectionStart = ASPxClientCalendar.GetMaxDate(selectedRangeRestrictions.start, visibleRangeRestrictions.start);
30429  var requiredSelectionEnd = ASPxClientCalendar.GetMinDate(selectedRangeRestrictions.end, visibleRangeRestrictions.end);
30430  selection.AddRange(requiredSelectionStart, requiredSelectionEnd);
30431 }
30432};
30433ASPxClientCalendar.AreDatesEqual = function(date1, date2) {
30434 if(date1 == date2)  
30435  return true;
30436 if(!date1 || !date2)
30437  return false;
30438 return date1.getFullYear() == date2.getFullYear() && date1.getMonth() == date2.getMonth() && date1.getDate() == date2.getDate();
30439};
30440ASPxClientCalendar.IsFirstDateEqualToAnyOther = function () {
30441 var actualDate = arguments[0];
30442 for (var i = 1; i < arguments.length; i++)
30443  if (ASPxClientCalendar.AreDatesEqual(actualDate, arguments[i]))
30444   return true;
30445 return false;
30446};
30447ASPxClientCalendar.AreDatesOfSameMonth = function(date1, date2) {
30448 if(!date1 || !date2)
30449  return false;
30450 return date1.getFullYear() == date2.getFullYear() && date1.getMonth() == date2.getMonth();
30451};
30452ASPxClientCalendar.GetUTCTime = function(date) {
30453 return Date.UTC(date.getFullYear(), date.getMonth(), date.getDate());
30454};
30455ASPxClientCalendar.GetFirstDayOfYear = function(date) {
30456 return new Date(date.getFullYear(), 0, 1);  
30457};
30458ASPxClientCalendar.GetDayOfYear = function(date) {
30459 var ms = ASPxClientCalendar.GetUTCTime(date) - 
30460  ASPxClientCalendar.GetUTCTime(ASPxClientCalendar.GetFirstDayOfYear(date));
30461 return 1 + Math.floor(ms / ASPx.calendarMsPerDay);
30462};
30463ASPxClientCalendar.GetISO8601WeekOfYear = function(date) {
30464 var firstDate = new Date(date.getFullYear(), 0, 1);
30465 var firstDayOfWeek = firstDate.getDay();
30466 if(firstDayOfWeek == 0)
30467  firstDayOfWeek = 7;
30468 var daysInFirstWeek = 8 - firstDayOfWeek;
30469 var lastDate = new Date(date.getFullYear(), 11, 31);   
30470 var lastDayOfWeek = lastDate.getDay();
30471 if(lastDayOfWeek == 0)
30472  lastDayOfWeek = 7;
30473 var fullWeeks = Math.ceil((ASPxClientCalendar.GetDayOfYear(date) - daysInFirstWeek) / 7);
30474 var result = fullWeeks;   
30475 if(daysInFirstWeek > 3)
30476  result++;
30477 var isThursday = firstDayOfWeek == 4 || lastDayOfWeek == 4;
30478 if(result > 52 && !isThursday)
30479  result = 1;
30480 if(result == 0)
30481  return ASPxClientCalendar.GetISO8601WeekOfYear(new Date(date.getFullYear() - 1, 11, 31));
30482 return result;
30483};
30484ASPxClientCalendar.GetNextWeekDate = function(date) {
30485 var ret = new Date(date.getTime()); 
30486 var newDay = date.getDate() + 7;
30487 ret.setDate(newDay);
30488 return ret;
30489};
30490ASPxClientCalendar.GetPrevWeekDate = function(date) {
30491 var ret = new Date(date.getTime());
30492 var newDay = date.getDate() - 7;
30493 ret.setDate(newDay);
30494 return ret;
30495};
30496ASPxClientCalendar.GetYesterDate = function(date) {
30497 var ret = new Date(date.getTime());
30498 ret.setDate(ret.getDate() - 1);
30499 return ret;
30500};
30501ASPxClientCalendar.GetTomorrowDate = function(date) {
30502 var ret = new Date(date.getTime());
30503 ret.setDate(ret.getDate() + 1);
30504 return ret;
30505};
30506ASPxClientCalendar.GetNextMonthDate = function(date) {
30507 var ret = new Date(date.getTime());
30508 var maxDateInNextMonth = ASPxClientCalendar.GetDaysInMonth(ret.getMonth() + 1, ret.getFullYear());
30509 if(ret.getDate() > maxDateInNextMonth)
30510  ret.setDate(maxDateInNextMonth);
30511 ret.setMonth(ret.getMonth() + 1);
30512 return ret;
30513};
30514ASPxClientCalendar.GetNextYearDate = function(date) {
30515 var ret = new Date(date.getTime());
30516 var maxDateInPrevYearMonth = ASPxClientCalendar.GetDaysInMonth(ret.getMonth(), ret.getFullYear() + 1);
30517 if(ret.getDate() > maxDateInPrevYearMonth)
30518  ret.setDate(maxDateInPrevYearMonth);
30519 ret.setFullYear(ret.getFullYear() + 1);
30520 return ret;
30521};
30522ASPxClientCalendar.GetPrevMonthDate = function(date) {
30523 var ret = new Date(date.getTime());
30524 var maxDateInPrevMonth = ASPxClientCalendar.GetDaysInMonth(ret.getMonth() - 1, ret.getFullYear());
30525 if(ret.getDate() > maxDateInPrevMonth)
30526  ret.setDate(maxDateInPrevMonth);
30527 ret.setMonth(ret.getMonth() - 1);
30528 return ret;
30529};
30530ASPxClientCalendar.GetPrevYearDate = function(date) {
30531 var ret = new Date(date.getTime());
30532 var maxDateInPrevYearMonth = ASPxClientCalendar.GetDaysInMonth(ret.getMonth(), ret.getFullYear() - 1);
30533 if(ret.getDate() > maxDateInPrevYearMonth)
30534  ret.setDate(maxDateInPrevYearMonth);
30535 ret.setFullYear(ret.getFullYear() - 1);
30536 return ret;
30537};
30538ASPxClientCalendar.GetFirstDayInMonthDate = function(date) {
30539 var ret = new Date(date.getTime());
30540 ret.setDate(1);
30541 return ret;
30542};
30543ASPxClientCalendar.GetLastDayInMonthDate = function(date) {
30544 var ret = new Date(date.getTime());
30545 var maxDateInYearMonth = ASPxClientCalendar.GetDaysInMonth(ret.getMonth(), ret.getFullYear());
30546 ret.setDate(maxDateInYearMonth);
30547 return ret;
30548};
30549ASPxClientCalendar.AddDays = function(startDate, dayCount) {
30550 var date = ASPxClientCalendar.CloneDate(startDate);
30551 var dayDiff = 0;
30552 var hourInc = 3600000;
30553 if(dayCount < 0)
30554  hourInc = -1 * hourInc;
30555 dayCount = Math.abs(dayCount);
30556 while(true) {
30557  if(dayDiff == dayCount && startDate.getHours() == date.getHours())
30558   return date;
30559  if(dayDiff > dayCount) {
30560   date.setTime(-1 * hourInc + date.getTime());
30561   return date;
30562  }
30563  var day = date.getDate();
30564  date.setTime(hourInc + date.getTime());
30565  if(day != date.getDate())
30566   dayDiff++;
30567 }
30568 return date;
30569};
30570ASPxClientCalendar.AddMonths = function(date, count) {
30571 var newDate = ASPxClientCalendar.CloneDate(date);
30572 newDate.setMonth(count + newDate.getMonth());
30573 ASPx.DateUtils.FixTimezoneGap(date, newDate);
30574 if(newDate.getDate() < date.getDate())
30575  newDate = ASPxClientCalendar.AddDays(newDate, -newDate.getDate()); 
30576 return newDate;
30577};
30578ASPxClientCalendar.CloneDate = function(date) {
30579 var cloned = new Date();
30580 cloned.setTime(date.getTime());
30581 return cloned;
30582};
30583ASPxClientCalendar.GetDecadeStartYear = function(year) {
30584 return 10 * Math.floor(year / 10);
30585};
30586ASPxClientCalendar.GetCenturyStartYear = function(year) {
30587 return 100 * Math.floor(year / 100);
30588};
30589ASPxClientCalendar.GetDaysInRange = function(start, end) {
30590 return 1 + (ASPxClientCalendar.GetUTCTime(end) - ASPxClientCalendar.GetUTCTime(start)) / ASPx.calendarMsPerDay;
30591};
30592ASPxClientCalendar.GetDaysInMonth = function(month, year) {
30593 var d = new Date(year, month + 1, 0);
30594 return d.getDate();
30595};
30596ASPxClientCalendar.GetOffsetInMonths = function(start, end) {
30597 return end.getMonth() - start.getMonth() + 12 * (end.getFullYear() - start.getFullYear());
30598};
30599var ASPxClientCalendarDateDisabledHelper = {
30600 MinDate: new Date(100, 0, 1, 0, 0, 0, 0),
30601 MaxDate: new Date(9999, 11, 31, 23, 59, 59, 999),
30602 GetUpperLimitDate: function() {
30603  return this.MaxDate;
30604 },
30605 GetLowerLimitDate: function() {
30606  return this.MinDate;
30607 },
30608 IsDateWithinBoundaries: function(date) {
30609  return date >= this.GetLowerLimitDate() && date <= this.GetUpperLimitDate();
30610 },
30611 GetCorrectedDate: function(date) {
30612  if(!date)
30613   return null;
30614  if(this.IsDateWithinBoundaries(date))
30615   return date;
30616  else
30617   return date > this.GetUpperLimitDate() ? this.GetUpperLimitDate() : this.GetLowerLimitDate();
30618 },
30619 IsDateInRange: function(sharedParameters, date) {
30620  return date == null ||
30621   ((sharedParameters.minDate == null || date >= sharedParameters.minDate) &&
30622    (sharedParameters.maxDate == null || date <= sharedParameters.maxDate) &&
30623    this.IsDateWithinBoundaries(date));
30624 },
30625 IsDateDisabled: function(sharedParameters, date, OnCustomDisabledDate) {
30626  if(date != null) {
30627   var length = sharedParameters.disabledDates.length;
30628   if(length > 0 && date != null) {
30629    for(var i = 0; i < length; i++) {
30630     var disabledDate = sharedParameters.disabledDates[i];
30631     if(disabledDate.getDate() == date.getDate() &&
30632      disabledDate.getMonth() == date.getMonth() &&
30633      disabledDate.getFullYear() == date.getFullYear())
30634      return true;
30635    }
30636   }
30637   if(OnCustomDisabledDate(date).isDisabled)
30638    return true;
30639  }
30640  return false;
30641 }
30642};
30643var ASPxClientCalendarSelection = ASPx.CreateClass(null, {
30644 constructor: function() {
30645  this.dates = { };
30646  this.count = 0;  
30647 },
30648 Assign: function(source) {
30649  this.Clear();
30650  for(var key in source.dates) {
30651   if(source.dates.hasOwnProperty(key)) {
30652    var item = source.dates[key];
30653    if(item.constructor != Date) continue;
30654    this.Add(item);
30655   }
30656  }
30657 },
30658 Clear: function() {
30659  if(this.count > 0) {
30660   this.dates = { };
30661   this.count = 0;
30662  }
30663 },
30664 Equals: function(selection) {
30665  if(this.count != selection.count)
30666   return false;
30667  for(var key in this.dates) {
30668   if(this.dates.hasOwnProperty(key)) {
30669    if(this.dates[key].constructor != Date) continue;
30670    if(!selection.ContainsKey(key))
30671     return false;
30672   }
30673  }
30674  return true;
30675 },
30676 Contains: function(date) {
30677  var key = this.GetKey(date);
30678  return this.ContainsKey(key);
30679 },
30680 ContainsKey: function(key) {
30681  return !!this.dates[key];
30682 },
30683 Add: function(date) {
30684  var key = this.GetKey(date);
30685  if(!this.ContainsKey(key)) {
30686   this.dates[key] = ASPxClientCalendar.CloneDate(date);
30687   this.count++;
30688  }
30689 },
30690 AddArray: function(dates) {
30691  for(var i = 0; i < dates.length; i++)
30692   this.Add(dates[i]);
30693 },
30694 AddRange: function(start, end)  {
30695  if(end < start) {
30696   this.AddRange(end, start);
30697   return;
30698  }
30699  var count = ASPxClientCalendar.GetDaysInRange(start, end);
30700  var date = ASPxClientCalendar.CloneDate(start);  
30701  for(var i = 0; i < count; i++) {
30702   this.Add(date);
30703   date = ASPxClientCalendar.AddDays(date, 1);
30704  }
30705 },
30706 AddWeek: function(startDate) {
30707  this.AddRange(startDate, ASPxClientCalendar.AddDays(startDate, 6));
30708 },
30709 SetRestrictions: function(start, end) {
30710  this.startDate = ASPxClientCalendar.CloneDate(start);
30711  this.endDate = ASPxClientCalendar.CloneDate(end);
30712 },
30713 ResetRestrictions: function() {
30714  this.startDate = null;
30715  this.endDate = null;
30716 },
30717 Remove: function(date) {
30718  var key = this.GetKey(date);
30719  if(this.ContainsKey(key)) {
30720   delete this.dates[key];
30721   this.count--;
30722  }
30723 },
30724 RemoveArray: function(dates) {
30725  for(var i = 0; i < dates.length; i++)
30726   this.Remove(dates[i]);
30727 },
30728 RemoveRange: function(start, end) {
30729  if(end < start) {
30730   this.RemoveRange(end, start);
30731   return;
30732  }
30733  var count = ASPxClientCalendar.GetDaysInRange(start, end);
30734  var date = ASPxClientCalendar.CloneDate(start);  
30735  for(var i = 0; i < count; i++) {
30736   this.Remove(date);
30737   date = ASPxClientCalendar.AddDays(date, 1);
30738  }
30739 },
30740 RemoveWeek: function(startDate) {
30741  this.RemoveRange(startDate, ASPxClientCalendar.AddDays(startDate, 6));
30742 },
30743 GetDates: function() {
30744  var result = [ ];
30745  for(var key in this.dates) {
30746   if(this.dates.hasOwnProperty(key)) {
30747    var item = this.dates[key];
30748    if(item.constructor != Date) continue;
30749    result.push(ASPxClientCalendar.CloneDate(item));
30750   }
30751  }
30752  return result;  
30753 },
30754 GetFirstDate: function() {
30755  if(this.count == 0)
30756   return null;
30757  for(var key in this.dates) {
30758   if(this.dates.hasOwnProperty(key)) {
30759    var item = this.dates[key];
30760    if(item.constructor != Date) continue;
30761    return ASPxClientCalendar.CloneDate(item);
30762   }
30763  }
30764  return null;
30765 },
30766 GetKey: function(date) {  
30767  return ASPx.DateUtils.GetInvariantDateString(date);
30768 }
30769});
30770var ASPxClientCalendarSelectionTransaction = ASPx.CreateClass(null, {
30771 constructor: function(calendar) {
30772  this.calendar = calendar;
30773  this.isActive = false;
30774  this.backup = new ASPxClientCalendarSelection();
30775  this.selection = new ASPxClientCalendarSelection();
30776 },
30777 Start: function() {
30778  if(this.isActive)
30779   this.Rollback();
30780  this.backup.Assign(this.calendar.selection);
30781  this.selection.Clear();
30782  this.isActive = true;
30783  ASPx.activeCalendar = this.calendar;
30784 },
30785 Commit: function() {  
30786  this.calendar.ApplySelectionByDiff(this.selection, true);
30787  this.Reset();
30788 },
30789 Rollback: function() {
30790  this.calendar.ApplySelectionByDiff(this.backup);  
30791  this.Reset();
30792 },
30793 Reset: function() {
30794  this.backup.Clear();
30795  this.selection.Clear();
30796  this.isActive = false;
30797  ASPx.activeCalendar = null;
30798 },
30799 CopyFromBackup: function() {
30800  this.selection.Assign(this.backup);
30801 },
30802 IsChanged: function() {
30803  return !this.backup.Equals(this.selection);
30804 }
30805});
30806var ASPxClientCalendarView = ASPx.CreateClass(null, {
30807 constructor: function(calendar, row, column) {
30808  this.row = row;
30809  this.column = column;
30810  this.calendar = calendar;
30811  this.isASPxClientCalendarView = true;
30812  var temp = column + row;
30813  this.isLowBoundary = temp == 0;
30814  this.isHighBoundary = temp == calendar.rows + calendar.columns - 2;
30815  this.visibleDate = null;
30816  this.startDate = null;
30817  this.dayFunctions = {};
30818  this.dayFunctionsWithWeekSelection = {};
30819  this.fastNavigation = this.CreateFastNavigation();
30820 },
30821 CreateFastNavigation: function() {
30822  return this.calendar.IsMultiViewFastNavigation() ? this.calendar.CreateFastNavigation() : null;
30823 },
30824 Initialize: function() {
30825  this.dayCellCache = {};
30826  this.dayStyleCache = {};
30827  this.UpdateDate();
30828  this.EnsureSelection();
30829  this.MakeDisabledStateItems();
30830  if(this.fastNavigation != null) {
30831   this.fastNavigation.activeView = this;
30832   this.fastNavigation.partialId += this.GetIDPostfix();
30833   this.fastNavigation.InitializeUI();
30834  }
30835 },
30836 AttachMouseEvents: function(eventMethod, styleMethod) {
30837  var index;
30838  var cell;
30839  if(this.calendar.showDayHeaders) {
30840   var headCells = this.GetMonthTable().rows[0].cells;
30841   var dayNameIndex = 0;
30842   if(this.calendar.showWeekNumbers) {
30843    dayNameIndex++;
30844    cell = headCells[0];
30845    if(this.calendar.enableMulti) {
30846     eventMethod(cell, "click", ASPxClientCalendar.AnonymousHandlers.SelectMonth(this.calendar.name, this.row, this.column));
30847     if(this.calendar.needToSetCursor)
30848      styleMethod(cell, "cursor", ASPx.GetPointerCursor());
30849    }
30850    this.AttachCancelSelect(eventMethod, cell);
30851   }
30852   for(var j = 0; j < 7; j++)
30853    this.AttachCancelSelect(eventMethod, headCells[dayNameIndex++]);
30854  }
30855  for(var i = 0; i < calendarWeekCount; i++) {
30856   if(this.calendar.showWeekNumbers) {
30857    cell = this.GetWeekNumberCell(i);
30858    if(this.calendar.enableMulti)
30859     this.AttachDayMouseEvents(eventMethod, cell, this.GetDayMouseEventFunction(7 * i, true));
30860    else
30861     this.AttachCancelSelect(eventMethod, cell);
30862   }
30863   var date;
30864   for(var j = 0; j < 7; j++) {
30865    index = i * 7 + j;
30866    cell = this.GetDayCell(index);
30867    date = this.GetDateByIndex(index);
30868    var cal = this.calendar;
30869    if(!this.calendar.enableMulti && this.IsDateVisible(date) &&
30870     ASPxClientCalendarDateDisabledHelper.IsDateInRange(cal.sharedParameters, date) &&
30871     !cal.IsDateDisabled(date)) {
30872     if(this.calendar.needToSetCursor && (!cell.style.cursor || cell.style.cursor == ASPx.GetPointerCursor()))
30873      styleMethod(cell, "cursor", ASPx.GetPointerCursor());
30874    }
30875    this.AttachDayMouseEvents(eventMethod, cell, this.GetDayMouseEventFunction(index, false));
30876   }
30877  }
30878 },
30879 AttachDayMouseEvents: function(method, cell, handler) {
30880  var types = ["down", "up", "over", "out"];
30881  for(var i = 0; i < types.length; i++)
30882   method(cell, "mouse" + types[i], handler);
30883 },
30884 AttachCancelSelect: function(method, element) {
30885  method(element, "mouseup", aspxCalCancelSelect);
30886 },
30887 GetDayMouseEventFunction: function(index, selectWeeks) {
30888  var hash = selectWeeks ? this.dayFunctionsWithWeekSelection : this.dayFunctions;
30889  if(!hash[index])
30890   hash[index] = ASPxClientCalendar.AnonymousHandlers.DayMouseEvent(this.calendar.name, this.row, this.column, index, selectWeeks);
30891  return hash[index];
30892 },
30893 GetIndex: function() {
30894  return this.row * this.calendar.columns + this.column;
30895 },
30896 UpdateDate: function() {
30897  this.visibleDate = ASPxClientCalendar.AddMonths(this.calendar.visibleDate, this.GetIndex());
30898  var date = ASPxClientCalendar.CloneDate(this.visibleDate);
30899  date.setDate(1);
30900  this.UpdatePreviousMonthCells(date);
30901  this.UpdateNextMonthCells(date);
30902  var offset = date.getDay() - this.calendar.firstDayOfWeek;
30903  if(offset < 0)
30904   offset += 7;
30905  this.startDate = ASPxClientCalendar.AddDays(date, -offset);
30906 },
30907 UpdatePreviousMonthCells: function(date) { 
30908  var prevYearCell = this.GetPrevYearCell();
30909  var prevMonthCell = this.GetPrevMonthCell();
30910  var isEnabledDate = date.getFullYear() > 100;
30911  if(prevYearCell && ASPx.GetElementVisibility(prevYearCell) != isEnabledDate) {
30912   ASPx.SetElementVisibility(prevYearCell, isEnabledDate);
30913  }
30914  if(prevMonthCell) {
30915   var isEnabledDate = isEnabledDate || (date.getFullYear() == 100 && date.getMonth() > 0);
30916   if(ASPx.GetElementVisibility(prevMonthCell) != isEnabledDate)
30917    ASPx.SetElementVisibility(prevMonthCell, isEnabledDate);
30918  }
30919 },
30920 UpdateNextMonthCells: function(date) {
30921  var nextYearCell = this.GetNextYearCell();
30922  var nextMonthCell = this.GetNextMonthCell();
30923  var isEnabledDate = date.getFullYear() < 9999;
30924  if(nextYearCell && ASPx.GetElementVisibility(nextYearCell) != isEnabledDate) {
30925   ASPx.SetElementVisibility(nextYearCell, isEnabledDate);
30926  }
30927  if(nextMonthCell) {
30928   var isEnabledDate = isEnabledDate || (date.getFullYear() == 9999 && date.getMonth() < 11);
30929   if(ASPx.GetElementVisibility(nextMonthCell) != isEnabledDate)
30930    ASPx.SetElementVisibility(nextMonthCell, isEnabledDate);
30931  }
30932 },
30933 GetDateByIndex: function(index) {
30934  return ASPxClientCalendar.AddDays(this.startDate, index);
30935 },
30936 GetIndexByDate: function(date) {
30937  return ASPxClientCalendar.GetDaysInRange(this.startDate, date) - 1;
30938 },
30939 IsDateOtherMonth: function(date) {
30940  if(date == null)
30941   return false;
30942  return date.getMonth() != this.visibleDate.getMonth() ||
30943   date.getFullYear() != this.visibleDate.getFullYear();
30944 },
30945 GetDayCell: function(index) {
30946  if(ASPx.IsExistsElement(this.dayCellCache[index]))
30947   return this.dayCellCache[index];
30948  var mt = this.GetMonthTable();
30949  var colIndex = index % 7;
30950  var rowIndex = (index - colIndex) / 7;
30951  if(this.calendar.showDayHeaders)
30952   rowIndex++;
30953  if(this.calendar.showWeekNumbers)
30954   colIndex++;
30955  var cell = mt.rows[rowIndex].cells[colIndex];
30956  this.dayCellCache[index] = cell;
30957  return cell;
30958 },
30959 GetDayCellIndex: function (cell) {
30960  var currentDate = ASPxClientCalendar.CloneDate(this.startDate);
30961  var maxIndex = this.GetMaxIndex();
30962  var currentIndex = 0;
30963  do {
30964   currentIndex = this.GetIndexByDate(currentDate);
30965   if (this.GetDayCell(currentIndex) === cell)
30966    return currentIndex;
30967   currentDate = ASPxClientCalendar.AddDays(currentDate, 1);
30968  }
30969  while (currentIndex < maxIndex);
30970  return null;
30971 },
30972 GetMaxIndex: function() {
30973  return 7 * calendarWeekCount - 1;
30974 },
30975 GetMonthTable: function() {
30976  return this.calendar.GetMonthTable(this.calendar.IsMultiView() ? this.GetIDPostfix() : "");
30977 },
30978 GetMonthCell: function() {
30979  return this.calendar.GetMonthCell(this.calendar.IsMultiView() ? this.GetIDPostfix() : "");
30980 },
30981 GetViewCell: function() {
30982  return this.calendar.GetViewCell(this.calendar.IsMultiView() ? this.GetIDPostfix() : "");
30983 },
30984 GetFastNavCell: function() {
30985  return this.calendar.GetFastNavCell(this.calendar.IsMultiView() ? this.GetIDPostfix() : "");
30986 },
30987 GetWeekNumberCell: function(index) {
30988  if(this.calendar.showDayHeaders)
30989   index++;
30990  return this.GetMonthTable().rows[index].cells[0];
30991 },
30992 GetPrevYearCell: function() {
30993  return this.GetChildElement("PYC");
30994 },
30995 GetPrevMonthCell: function() {
30996  return this.GetChildElement("PMC");
30997 },
30998 GetPrevTimePeriodCell: function () {
30999  return this.GetChildElement("PTPC");
31000 },
31001 GetTitleCell: function() {
31002  return this.GetChildElement("TC");
31003 },
31004 GetTitleElement: function() {
31005  return this.GetChildElement("T") || this.GetTitleCell();
31006 },
31007 GetNextMonthCell: function() {
31008  return this.GetChildElement("NMC");
31009 },
31010 GetNextYearCell: function() {
31011  return this.GetChildElement("NYC");
31012 },
31013 GetNextTimePeriodCell: function () {
31014  return this.GetChildElement("NTPC");
31015 },
31016 GetVisibleRangeRestrictions: function() {
31017  return {
31018   start: this.GetDateByIndex(0),
31019   end: this.GetDateByIndex(this.GetMaxIndex())
31020  };
31021 },
31022 Update: function() {
31023  this.dayStyleCache = {};
31024  this.UpdateDate();
31025  this.UpdateDays();
31026  this.UpdateTitle();
31027  this.EnsureSelection();
31028 },
31029 EnsureSelection: function() {
31030  var selection = this.calendar.selection;
31031  var selectedRangeRestrictions = this.calendar.sharedParameters.dateRangeMode ? ASPx.Data.ArrayGetIntegerEdgeValues(selection.GetDates()) : null;
31032  if(this.calendar.NeedCalculateSelectionOnUpdating()) {
31033   selectedRangeRestrictions.start = ASPxClientCalendar.CloneDate(selection.startDate);
31034   selectedRangeRestrictions.end = ASPxClientCalendar.CloneDate(selection.endDate);
31035   var visibleRangeRestrictions = this.GetVisibleRangeRestrictions();
31036   ASPxClientCalendar.AddSelectedRangeVisiblePartToSelection(selection, selectedRangeRestrictions, visibleRangeRestrictions);
31037  }
31038  this.UpdateSelection(selection.GetDates(), true, selectedRangeRestrictions);
31039 },
31040 UpdateDays: function() {
31041  var date = ASPxClientCalendar.CloneDate(this.startDate);
31042  var offset = this.calendar.firstDayOfWeek - 1;
31043  if(offset < 0)
31044   offset += 7;
31045  var weekNumber = ASPxClientCalendar.GetISO8601WeekOfYear(ASPxClientCalendar.AddDays(date, offset));
31046  var cell;
31047  for(var i = 0; i < calendarWeekCount; i++) {
31048   if(this.calendar.showWeekNumbers)
31049    this.calendar.SetMonthTableCellContent(this.GetWeekNumberCell(i), (weekNumber < 10 ? "0" : "") + weekNumber.toString(), true);
31050   for(var j = 0; j < 7; j++) {
31051    cell = this.GetDayCell(i * 7 + j);
31052    this.calendar.SetMonthTableCellContent(cell, this.IsDateVisible(date) ? date.getDate() : "&nbsp;");
31053    this.ApplyDayCellStyle(cell, date);
31054    date = ASPxClientCalendar.AddDays(date, 1);
31055   }
31056   if(++weekNumber > 52)
31057    weekNumber = ASPxClientCalendar.GetISO8601WeekOfYear(ASPxClientCalendar.AddDays(date, offset));
31058  }
31059 },
31060 UpdateTitle: function() {
31061  var el = this.GetTitleElement();
31062  if(!el) return;
31063  if(!this.titleFormatter) {
31064   this.titleFormatter = new ASPx.DateFormatter();
31065   this.titleFormatter.SetFormatString(this.calendar.rtl ? "MMMM yyyy" : ASPx.CultureInfo.yearMonth);
31066  }
31067  el.innerHTML = this.titleFormatter.Format(this.visibleDate);
31068 },
31069 UpdateSelection: function(dates, showSelection, totalSelectionEdges) {
31070  var index;
31071  for(var i = 0; i < dates.length; i++) {
31072   index = this.GetIndexByDate(dates[i]);
31073   if(!this.IsValidIndex(index) || !this.IsDateVisible(dates[i]))
31074    continue;
31075   var applyDateInRangeStyle = totalSelectionEdges
31076    && !ASPxClientCalendar.IsFirstDateEqualToAnyOther(dates[i], totalSelectionEdges.start, totalSelectionEdges.end);
31077   this.ApplySelectionToCell(index, showSelection, applyDateInRangeStyle);
31078  }
31079 },
31080 IsValidIndex: function(index) {
31081  return index >= 0 && index <= this.GetMaxIndex();
31082 },
31083 EnsureVisible: function(visible) {
31084  if (this.calendar.switchToSingleMonthAtWindowInnerWidth <= 0) return;
31085  var cell = this.GetViewCell();
31086  ASPx.ToggleClassNameToElement(cell, "view-visible", visible);
31087 },
31088 ApplySelectionToCell: function (index, showSelection, applyDateInRangeStyle) {
31089  var cell = this.GetDayCell(index);
31090  var info;
31091  if(showSelection) {
31092   if(!this.dayStyleCache[index]) {
31093    var backup = new ASPxClientCalendarStyleInfo();
31094    backup.Import(cell);
31095    this.dayStyleCache[index] = backup;
31096    info = backup.Clone();
31097   } else
31098    info = this.dayStyleCache[index].Clone();
31099   if(!applyDateInRangeStyle || this.calendar.NeedApplySelectionToDayInRange())
31100    this.calendar.ImportEtalonStyle(info, "DS");
31101  } else
31102   info = this.dayStyleCache[index];
31103  info.Apply(cell);
31104  if (applyDateInRangeStyle) {
31105   if (showSelection)
31106    ASPx.AddClassNameToElement(cell, this.calendar.GetDayInRangeClassName());
31107   else
31108    ASPx.RemoveClassNameFromElement(cell, this.calendar.GetDayInRangeClassName());
31109  }
31110 },
31111 ApplyDayCellStyle: function(cell, date) {
31112  cell.style.cursor = "";
31113  var cal = this.calendar;
31114  var info = new ASPxClientCalendarStyleInfo();
31115  var needPointer = false;
31116  var readOnly = cal.GetReadOnly();
31117  cal.ImportEtalonStyle(info, "D");
31118  var isDateDisabled = false;
31119  if(this.IsDateVisible(date)) {
31120   var isCurrentMonthDate = !this.IsDateOtherMonth(date);
31121   if(cal.IsDateWeekend(date) && cal.CanApplyDayCellStyle("DW", isCurrentMonthDate))
31122    cal.ImportEtalonStyle(info, "DW");
31123   if(!isCurrentMonthDate)
31124    cal.ImportEtalonStyle(info, "DA");
31125   if(!ASPxClientCalendarDateDisabledHelper.IsDateInRange(cal.sharedParameters, date)
31126    && cal.CanApplyDayCellStyle("DO", isCurrentMonthDate))
31127    cal.ImportEtalonStyle(info, "DO");
31128   if(cal.IsDateDisabled(date) && cal.CanApplyDayCellStyle("DDD", isCurrentMonthDate)) {
31129    cal.ImportEtalonStyle(info, "DDD");
31130    isDateDisabled = true;
31131   }
31132   if(ASPxClientCalendar.AreDatesEqual(this.GetActualTodayDate(), date) && cal.CanApplyDayCellStyle("DT", isCurrentMonthDate))
31133    cal.ImportEtalonStyle(info, "DT");
31134   if(!cal.clientEnabled && cal.CanApplyDayCellStyle("DD", isCurrentMonthDate))
31135    cal.ImportEtalonStyle(info, "DD");
31136   else if(!cal.enableMulti && !isDateDisabled && !readOnly)
31137    needPointer = true;
31138  }
31139  info.Apply(cell);
31140  if(needPointer && cal.needToSetCursor)
31141   ASPx.SetPointerCursor(cell);
31142 },
31143 RemoveDayCellStyle: function(cell, suffix) {
31144  var info = new ASPxClientCalendarStyleInfo();
31145  this.calendar.ImportEtalonStyle(info, suffix);
31146  info.Remove(cell);
31147 },
31148 EnsureTodayStyle: function() {
31149  var serverCurrentDateIndex = this.GetIndexByDate(this.calendar.serverCurrentDate);
31150  var clientCurrentDateIndex = this.GetIndexByDate(new Date());
31151  if(this.IsValidIndex(serverCurrentDateIndex))
31152   this.RemoveDayCellStyle(this.GetDayCell(serverCurrentDateIndex), "DT");
31153  if(this.IsValidIndex(clientCurrentDateIndex))
31154   this.ApplyDayCellStyle(this.GetDayCell(clientCurrentDateIndex), new Date());
31155  this.dayStyleCache[serverCurrentDateIndex] = null;
31156  this.dayStyleCache[clientCurrentDateIndex] = null;
31157  this.EnsureSelection();
31158 },
31159 GetActualTodayDate: function() {
31160  if(!this.calendar || !this.calendar.actualTodayDate)
31161   return new Date();
31162  return this.calendar.actualTodayDate;
31163 },
31164 GetIDPostfix: function() {
31165  return "_" + this.row.toString() + "x" + this.column.toString();
31166 },
31167 GetChildElement: function(postfix) {
31168  if(this.calendar.IsMultiView())
31169   postfix += this.GetIDPostfix();
31170  return this.calendar.GetChildElement(postfix);
31171 },
31172 IsDateVisible: function(date) {
31173  var result = !this.calendar.IsMultiView() || !this.IsDateOtherMonth(date);
31174  if(!result) {
31175   result = result || this.isLowBoundary && date <= this.visibleDate ||
31176    this.isHighBoundary && date >= this.visibleDate;
31177  }
31178  return result;
31179 },
31180 MakeDisabledStateItems: function() {
31181  var cells = this.GetAuxCells();
31182  for(var i = 0; i < cells.length; i++)
31183   this.AddAuxDisabledStateItem(cells[i], this.GetAuxId(i));
31184  var element = this.GetTitleCell();
31185  if(element)
31186   this.AddHeaderDisabledStateItem(element);
31187  var element = this.GetTitleElement();
31188  if(element)
31189   this.AddHeaderDisabledStateItem(element);
31190 },
31191 AddAuxDisabledStateItem: function(element, id) {
31192  var cell = this.calendar.GetEtalonStyleCell("DD");
31193  if(cell) {
31194   element.id = id;
31195   ASPx.GetStateController().AddDisabledItem(id, cell.className, cell.style.cssText, null, null, null);
31196  }
31197 },
31198 AddHeaderDisabledStateItem: function(element) {
31199  var cell = this.calendar.GetEtalonStyleCell("DD");
31200  if(cell)
31201   ASPx.GetStateController().AddDisabledItem(element.id, cell.className, cell.style.cssText, null, null, null);
31202 },
31203 ChangeEnabledAttributes: function(enabled) {
31204  var element = this.GetPrevYearCell();
31205  if(element)
31206   this.calendar.ChangeButtonEnabledAttributes(element, this.calendar.GetChangeButtonEnabledAttributesMethod(enabled));
31207  var element = this.GetPrevMonthCell();
31208  if(element)
31209   this.calendar.ChangeButtonEnabledAttributes(element, this.calendar.GetChangeButtonEnabledAttributesMethod(enabled));
31210  var element = this.GetTitleElement();
31211  if(element) {
31212   this.calendar.ChangeButtonEnabledAttributes(element, this.calendar.GetChangeButtonEnabledAttributesMethod(enabled));
31213   this.ChangeTitleElementEnabledAttributes(element, ASPx.Attr.ChangeStyleAttributesMethod(enabled));
31214  }
31215  var element = this.GetNextMonthCell();
31216  if(element)
31217   this.calendar.ChangeButtonEnabledAttributes(element, this.calendar.GetChangeButtonEnabledAttributesMethod(enabled));
31218  var element = this.GetNextYearCell();
31219  if(element)
31220   this.calendar.ChangeButtonEnabledAttributes(element, this.calendar.GetChangeButtonEnabledAttributesMethod(enabled));
31221 },
31222 ChangeEditableAttributes: function(editable) {
31223  if(this.calendar.enabled && !this.calendar.readOnly)
31224   this.AttachMouseEvents(ASPx.Attr.ChangeEventsMethod(editable), ASPx.Attr.InitiallyChangeStyleAttributesMethod(editable));
31225 },
31226 ChangeEnabledStateItems: function(enabled) {
31227  this.SetAuxCellsEnabled(enabled);
31228  this.SetHeaderCellsEnabled(enabled);
31229 },
31230 ChangeTitleElementEnabledAttributes: function(element, method) {
31231  method(element, "cursor");
31232 },
31233 ChangeButtonEnabledAttributes: function(element, method) {
31234  method(element, "onclick");
31235  method(element, "ondblclick");
31236 },
31237 SetAuxCellsEnabled: function(enabled) {
31238  var cells = this.GetAuxCells();
31239  for(var i = 0; i < cells.length; i++)
31240   ASPx.GetStateController().SetElementEnabled(cells[i], enabled);
31241 },
31242 SetHeaderCellsEnabled: function(enabled) {
31243  var element = this.GetPrevYearCell();
31244  if(element)
31245   ASPx.GetStateController().SetElementEnabled(element, enabled);
31246  var element = this.GetPrevMonthCell();
31247  if(element)
31248   ASPx.GetStateController().SetElementEnabled(element, enabled);
31249  var element = this.GetTitleCell();
31250  if(element)
31251   ASPx.GetStateController().SetElementEnabled(element, enabled);
31252  var element = this.GetTitleElement();
31253  if(element)
31254   ASPx.GetStateController().SetElementEnabled(element, enabled);
31255  var element = this.GetNextMonthCell();
31256  if(element)
31257   ASPx.GetStateController().SetElementEnabled(element, enabled);
31258  var element = this.GetNextYearCell();
31259  if(element)
31260   ASPx.GetStateController().SetElementEnabled(element, enabled);
31261 },
31262 GetAuxCells: function() {
31263  if(this.auxCells == null) {
31264   this.auxCells = [];
31265   var table = this.GetMonthTable();
31266   for(var i = 0; i < table.rows.length; i++) {
31267    var row = table.rows[i];
31268    if(i == 0 && this.calendar.showDayHeaders) {
31269     for(var j = 0; j < row.cells.length; j++)
31270      this.auxCells.push(row.cells[j]);
31271    }
31272    if(i > 0 && this.calendar.showWeekNumbers)
31273     this.auxCells.push(row.cells[0]);
31274   }
31275  }
31276  return this.auxCells;
31277 },
31278 GetAuxId: function(index) {
31279  return this.calendar.name + "_AUX_" + this.row + "_" + this.column + "_" + index;
31280 }
31281});
31282ASPxClientCalendarView.DayInRangeClassName = "dxeDayInRange";
31283FastNavigationMode = {
31284 Hidden: "Hidden",
31285 Months: "Months",
31286 Years: "Years",
31287 Decades: "Decades"
31288};
31289var ASPxClientCalendarFastNavigation = ASPx.CreateClass(null, {
31290 constructor: function(calendar) {
31291  this.calendar = calendar;
31292  this.showInPopup = calendar.showFastPopup;
31293  this.currentMode = FastNavigationMode.Hidden;
31294  this.activeMonth = -1;
31295  this.activeYear = -1;
31296  this.startYear = -1;
31297  this.activeView = null;
31298  this.partialId = this.showInPopup ? "FNP" : "FN";
31299  if(this.showInPopup || !this.calendar.IsMultiView())
31300   this.InitializeUI();  
31301 },
31302 InitializeUI: function() {
31303  var item;
31304  var prefix = this.GetId();
31305  if(this.showInPopup) {
31306   for(var m = 0; m < 12; m++) {
31307    item = this.GetMonthItem(m);
31308    if(!ASPx.IsExistsElement(item))
31309     break;
31310    item.id = prefix + "_M" + m;
31311    ASPx.Evt.AttachEventToElement(item, "click", ASPxClientCalendar.AnonymousHandlers.FastNavMonthClick(this.calendar.name, m));
31312   }
31313   for(var i = 0; i < 10; i++) {
31314    item = this.GetYearItem(i);
31315    if(!ASPx.IsExistsElement(item))
31316     break;   
31317    item.id = prefix + "_Y" + i;
31318    ASPx.Evt.AttachEventToElement(item, "click", ASPxClientCalendar.AnonymousHandlers.FastNavYearClick(this.calendar.name, i));
31319   }
31320   ASPx.Evt.AttachEventToElement(this.GetPopupWindowElement(), "click", ASPxClientCalendar.AnonymousHandlers.MainElementClick(this.calendar.name));
31321   this.InitializePopup();
31322  }
31323  else {
31324   var stateController = typeof (ASPx.GetStateController) != "undefined" ? ASPx.GetStateController() : null;
31325   var hoverStyleInfo = new ASPxClientCalendarStyleInfo();
31326   this.calendar.ImportEtalonStyle(hoverStyleInfo, "FNIH");
31327   var viewRow = this.activeView ? this.activeView.row : 0;
31328   var viewColumn = this.activeView ? this.activeView.column : 0;
31329   for(var ni = 0; ni < 12; ni++) {
31330    item = this.GetNavigationItem(ni);
31331    if(!ASPx.IsExistsElement(item))
31332     break;
31333    if(!item.id) {
31334     var itemID = prefix + "_I" + ni;
31335     item.id = itemID;
31336     if(stateController)
31337      ASPx.GetStateController().AddHoverItem(itemID, [hoverStyleInfo.className], [hoverStyleInfo.cssText], null, null, null);
31338     ASPx.Evt.AttachEventToElement(item, "click", ASPxClientCalendar.AnonymousHandlers.FastNavItemClick(this.calendar.name, ni, viewRow, viewColumn));
31339    }
31340   }
31341  }
31342 },
31343 InitializePopup: function() {
31344  var popup = this.GetPopup();
31345  if(popup)
31346   popup.CloseUp.AddHandler(function(s, e) { this.Hide(); }.aspxBind(this));
31347 },
31348 IsCurrent: function() {
31349  return !this.calendar.IsMultiViewFastNavigation() || this.IsViewActivated();
31350 },
31351 IsViewActivated: function() {
31352  return this.calendar.fastNavViewKey == this.calendar.GetViewKey(this.activeView.row, this.activeView.column);
31353 },
31354 IsActive: function() {
31355  return this.currentMode != FastNavigationMode.Hidden;
31356 },
31357 GetPrevMode: function() {
31358  switch(this.currentMode) {
31359   case FastNavigationMode.Hidden:
31360   case FastNavigationMode.Months:
31361    return FastNavigationMode.Hidden;
31362   case FastNavigationMode.Years:
31363    return FastNavigationMode.Months;
31364   case FastNavigationMode.Decades:
31365    return FastNavigationMode.Years;
31366  }
31367 },
31368 GetNextMode: function() {
31369  switch(this.currentMode) {
31370   case FastNavigationMode.Hidden:
31371    return FastNavigationMode.Months;
31372   case FastNavigationMode.Months:
31373    return !this.showInPopup ? FastNavigationMode.Years : FastNavigationMode.Months;
31374   case FastNavigationMode.Years:
31375   case FastNavigationMode.Decades:
31376    return FastNavigationMode.Decades;
31377  }
31378 },
31379 SetMode: function(mode, applyChanges, toNextMode) {
31380  if(this.currentMode != mode) {
31381   var visible = this.IsActive();
31382   if(!visible) {
31383    this.Prepare();
31384    this.ShowInternal();
31385   }
31386   this.currentMode = mode;
31387   this.UpdateTitleCursor();
31388   var needUpdateTitles = !this.showInPopup;
31389   var isCurrent = this.IsCurrent();
31390   var isRollbackToPrevMode = !applyChanges && !toNextMode;
31391   switch(mode) {
31392    case FastNavigationMode.Hidden:
31393     this.HideInternal();
31394     if(applyChanges) {
31395      this.ApplyChanges();
31396     }
31397     this.monthsViewLastSelectedMonth = null;
31398     this.monthsViewLastSelectedYear = null;
31399     this.yearsViewLastSelectedYear = null;
31400     break;
31401    case FastNavigationMode.Months:
31402     if(isRollbackToPrevMode) {
31403      if(this.monthsViewLastSelectedYear)
31404       this.activeYear = this.monthsViewLastSelectedYear;
31405      if(this.monthsViewLastSelectedMonth)
31406       this.activeMonth = this.monthsViewLastSelectedMonth;
31407     }
31408     else if (visible && !isCurrent)
31409      this.activeYear = this.calendar.GetFastNavigation().activeYear + this.GetOffsetFromCurrent();
31410     this.PrepareMonthList();
31411     if(this.showInPopup)
31412      this.PrepareYearList();
31413     break;
31414    case FastNavigationMode.Years:
31415     if(toNextMode) {
31416      this.monthsViewLastSelectedYear = this.activeYear;
31417      this.monthsViewLastSelectedMonth = this.activeMonth;
31418     }
31419     if(isRollbackToPrevMode && this.yearsViewLastSelectedYear)
31420      this.activeYear = this.yearsViewLastSelectedYear;
31421     else if(visible && !isCurrent)
31422      this.activeYear = this.calendar.GetFastNavigation().activeYear + this.GetOffsetFromCurrent() * 10;
31423     this.startYear = ASPxClientCalendar.GetDecadeStartYear(this.activeYear);
31424     this.PrepareYearList();
31425     break;
31426    case FastNavigationMode.Decades:
31427     if(toNextMode)
31428      this.yearsViewLastSelectedYear = this.activeYear;
31429     if(!isCurrent)
31430      this.activeYear = this.calendar.GetFastNavigation().activeYear + this.GetOffsetFromCurrent() * 100;
31431     this.startYear = ASPxClientCalendar.GetCenturyStartYear(this.activeYear);
31432     this.PrepareDecadesList();
31433     break;
31434   }
31435   if(needUpdateTitles) {
31436    this.UpdateActiveViewTitle();
31437    this.UpdateRollbackButtonText();
31438    if(mode != FastNavigationMode.Hidden && this.calendar.enableFastNavInlineAnimation)
31439     ASPx.AnimationHelper.fadeIn(this.activeView.GetFastNavCell());
31440   }
31441  }
31442 },
31443 AllowProcessTitleClick: function() {
31444  return this.showInPopup || !this.IsForbiddenMode(this.GetNextMode()) && this.currentMode !== FastNavigationMode.Decades;
31445 },
31446 IsForbiddenMode: function(mode) {
31447  return mode == FastNavigationMode.Years && this.calendar.fastNavMinZoomLevel == "Year"
31448   || mode == FastNavigationMode.Decades && this.calendar.fastNavMinZoomLevel == "Decade";
31449 },
31450 UpdateTitleCursor: function () {
31451  var actualTitleElementCursor = this.GetActualTitleElementCursor();
31452  for(var key in this.calendar.views) {
31453   if(this.calendar.views.hasOwnProperty(key)) {
31454    var view = this.calendar.views[key];
31455    var viewTitleElement = view.GetTitleElement();
31456    if(viewTitleElement)
31457     viewTitleElement.style.cursor = actualTitleElementCursor;
31458   }
31459  }
31460 },
31461 GetActualTitleElementCursor: function() {
31462  if(this.currentMode == FastNavigationMode.Months && this.calendar.fastNavMinZoomLevel == "Year")
31463   return "default";
31464  if(this.currentMode == FastNavigationMode.Years && this.calendar.fastNavMinZoomLevel == "Decade")
31465   return "default";
31466  if(this.currentMode == FastNavigationMode.Decades)
31467   return "default";
31468  return ASPx.GetPointerCursor();
31469 },
31470 RollbackToPrevMode: function() {
31471  this.SetMode(this.GetPrevMode(), false);
31472 },
31473 SwitchToPrevMode: function() {
31474  this.SetMode(this.GetPrevMode(), true);
31475 },
31476 SwitchToNextMode: function() {
31477  this.SetMode(this.GetNextMode(), false, true);
31478 },
31479 Show: function() {
31480  this.SwitchToNextMode();
31481 },
31482 ShowInternal: function() {
31483  if(this.showInPopup)
31484   this.ShowPopup();
31485  else {
31486   this.SetActiveViewElementsVisibility(true);
31487   ASPx.SetElementDisplay(this.calendar.GetClearButton(), false, true);
31488  }
31489 },
31490 ShowPopup: function() {
31491  this.GetPopup().ShowAtElement(this.activeView.GetTitleElement());
31492 },
31493 Hide: function() {
31494  this.SetMode(FastNavigationMode.Hidden, false);
31495 },
31496 HideInternal: function() {
31497  if(this.showInPopup)
31498   this.HidePopup();
31499  else {
31500   this.SetActiveViewElementsVisibility(false);
31501   ASPx.SetElementDisplay(this.calendar.GetClearButton(), true, true);
31502  }
31503 },
31504 HidePopup: function() {
31505  this.GetPopup().Hide();
31506 },
31507 SetActiveViewElementsVisibility: function(showFastNavCell) {
31508  var inlineFastNavCell = this.activeView.GetFastNavCell();
31509  var monthCell = this.activeView.GetMonthCell();
31510  inlineFastNavCell.style.width = showFastNavCell ? monthCell.offsetWidth + "px" : "";
31511  inlineFastNavCell.style.height = showFastNavCell ? monthCell.offsetHeight + "px" : "";
31512  this.SetElementVisible(inlineFastNavCell, showFastNavCell);
31513  this.SetElementVisible(monthCell, !showFastNavCell);
31514  this.SetPeriodCellParentsVisibility(inlineFastNavCell, monthCell, showFastNavCell);
31515  if(this.calendar.enableFastNavInlineAnimation)
31516   ASPx.AnimationHelper.fadeIn(showFastNavCell ? inlineFastNavCell : monthCell);
31517  this.PrepareNavigationCells(showFastNavCell);
31518  var spacers = ASPx.GetNodesByClassName(this.calendar.GetMainElement(), "dxeCHS");
31519  spacers.forEach(function(spacer) { this.SetElementVisible(spacer, !showFastNavCell); }.aspxBind(this));
31520 },
31521 SetPeriodCellParentsVisibility: function(inlineFastNavCell, monthCell, showFastNavCell) {
31522  this.SetElementVisible(inlineFastNavCell.parentNode, showFastNavCell);
31523  this.SetElementVisible(monthCell.parentNode, !showFastNavCell);
31524 },
31525 SetElementVisible: function(element, visible) {
31526  ASPx.SetElementDisplay(element, visible, true);
31527 },
31528 UpdateActiveViewTitle: function() {
31529  switch(this.currentMode) {
31530   case FastNavigationMode.Hidden:
31531    this.activeView.UpdateTitle();
31532    break;
31533   case FastNavigationMode.Months:
31534    this.SetActiveViewTitle(this.activeYear);
31535    break;
31536   case FastNavigationMode.Years:
31537    this.SetActiveViewTitle(this.startYear + " - " + (this.startYear + 9));
31538    break;
31539   case FastNavigationMode.Decades:
31540    this.SetActiveViewTitle(this.startYear + " - " + (this.startYear + 99));
31541    break;
31542  }
31543  var lastViewIndex = this.calendar.rows * this.calendar.columns - 1;
31544  if(this.activeView.GetIndex() == lastViewIndex) {
31545   var isPrevVisible = this.CanShiftVisibleNavigationPeriod(false);
31546   var isNextVisible = this.CanShiftVisibleNavigationPeriod(true);
31547   if(!this.calendar.IsMultiView()) {
31548    ASPx.SetElementVisibility(this.activeView.GetPrevTimePeriodCell(), isPrevVisible);
31549    ASPx.SetElementVisibility(this.activeView.GetNextTimePeriodCell(), isNextVisible);
31550   }
31551   else {
31552    for(var key in this.calendar.views) {
31553     if(this.calendar.views.hasOwnProperty(key)) {
31554      var view = this.calendar.views[key];
31555      ASPx.SetElementVisibility(view.GetPrevTimePeriodCell(), isPrevVisible);
31556      ASPx.SetElementVisibility(view.GetNextTimePeriodCell(), isNextVisible);
31557     }
31558    }
31559   }
31560  }
31561 },
31562 CanShiftVisibleNavigationPeriod: function(isForwardDirection) {
31563  var needUseStartYear = true;
31564  var periodOffset = 0;
31565  switch(this.currentMode) {
31566   case FastNavigationMode.Months:
31567    needUseStartYear = false;
31568    break;
31569   case FastNavigationMode.Years:
31570    periodOffset = 9;
31571    break;
31572   case FastNavigationMode.Decades:
31573    periodOffset = 99;
31574    break;
31575  }
31576  if(!this.calendar.IsMultiView())
31577   return this.CanShiftVisibleNavigationPeriodCore(needUseStartYear ? this.startYear : this.activeYear, periodOffset, isForwardDirection);
31578  else {
31579   for(var key in this.calendar.views) {
31580    if(this.calendar.views.hasOwnProperty(key)) {
31581     var fastNavigation = this.calendar.views[key].fastNavigation;
31582     if(fastNavigation) {
31583      var year = needUseStartYear ? fastNavigation.startYear : fastNavigation.activeYear;
31584      if(!this.CanShiftVisibleNavigationPeriodCore(year, periodOffset, isForwardDirection))
31585       return false;
31586     }
31587    }
31588   }
31589   return true;
31590  }
31591 },
31592 CanShiftVisibleNavigationPeriodCore: function (year, periodOffset, isForwardDirection) {
31593  if (!this.calendar.enablePeriodNavigation)
31594   return false;
31595  return isForwardDirection ? year + periodOffset < 9999 : year > 100;
31596 },
31597 UpdateRollbackButtonText: function() {
31598  var textIndex = -1;
31599  switch(this.currentMode) {
31600   case FastNavigationMode.Months:
31601    textIndex = 0;
31602    break;
31603   case FastNavigationMode.Years:
31604    textIndex = 1;
31605    break;
31606   case FastNavigationMode.Decades:
31607    textIndex = 2;
31608    break;
31609   default:
31610    break;
31611  }
31612  this.SetRollbackButtonText(this.calendar.fastNavRollbackTexts[textIndex] || "");
31613 },
31614 GetActiveNavigationItemIndex: function() {
31615  switch(this.currentMode) {
31616   case FastNavigationMode.Months:
31617    return this.GetActiveMonthIndex();
31618   case FastNavigationMode.Years:
31619    return this.GetActiveYearIndex();
31620   case FastNavigationMode.Decades:
31621    return this.GetActiveDecadeIndex();
31622   default:
31623    return -1;
31624  }
31625 },
31626 SelectNavigationItem: function(itemIndex) {
31627  switch(this.currentMode) {
31628   case FastNavigationMode.Months:
31629    this.SetMonth(itemIndex);
31630    break;
31631   case FastNavigationMode.Years:
31632    this.SetYearIndex(itemIndex);
31633    this.activeMonth = 0;
31634    if(itemIndex < 1)
31635     this.OnYearShuffle(-10);
31636    else if(itemIndex > 10)
31637     this.OnYearShuffle(10);
31638    break;
31639   case FastNavigationMode.Decades:
31640    this.SetDecadeIndex(itemIndex);
31641    if(itemIndex < 1)
31642     this.OnYearShuffle(-100);
31643    else if(itemIndex > 10)
31644     this.OnYearShuffle(100);
31645    break;
31646   default:
31647    break;
31648  }
31649 },
31650 ShiftNavigationItem: function(offset, force) {
31651  switch(this.currentMode) {
31652   case FastNavigationMode.Months:
31653    return this.ShiftMonth(offset);
31654   case FastNavigationMode.Years:
31655    return this.ShiftYear(offset, force);
31656   case FastNavigationMode.Decades:
31657    return this.ShiftDecade(offset, force);
31658   default:
31659    return false;
31660  }
31661 },
31662 TryShiftToOtherViewFastNavigation: function(offset) {
31663  if(this.calendar.IsMultiViewFastNavigation() && this.IsViewActivated()) { 
31664   for(var key in this.calendar.views) {
31665    if(this.calendar.views.hasOwnProperty(key)) {
31666     var fastNavigation = this.calendar.views[key].fastNavigation;
31667     if(fastNavigation.GetOffsetFromCurrent() == offset) {
31668      this.calendar.SetFastNavigationViewKey(key);
31669      var activeIndex = this.GetActiveNavigationItemIndex();
31670      this.ResetItemSelection(this.GetNavigationItem(activeIndex), false, "I");
31671      if(fastNavigation.GetActiveNavigationItemIndex() != activeIndex)
31672       fastNavigation.SelectNavigationItem(activeIndex);
31673      else {
31674       var currentItem = fastNavigation.GetNavigationItem(activeIndex);
31675       fastNavigation.ApplyItemStyle(currentItem, true, false, "I");
31676      }
31677      return true;
31678     }
31679    }
31680   }
31681  }
31682  return false;
31683 },
31684 ShiftVisibleNavigationPeriod: function(offset, force) {
31685  if(!offset || !force && this.TryShiftToOtherViewFastNavigation(offset))
31686   return false;
31687  var periodOffset = offset > 0 ? 1 : -1;
31688  switch(this.currentMode) {
31689   case FastNavigationMode.Months:
31690    return this.ShiftYear(periodOffset, true);
31691   case FastNavigationMode.Years:
31692    return this.ShiftYear(periodOffset * 10, force);
31693   case FastNavigationMode.Decades:
31694    return this.ShiftDecade(periodOffset * 10, force);
31695   default:
31696    return false;
31697  }
31698 },
31699 GetActiveMonthIndex: function() {
31700  return this.activeMonth;
31701 },
31702 SetMonth: function(month) {
31703  if(month != this.activeMonth) {
31704   var prevCell = this.GetMonthItem(this.GetActiveMonthIndex());
31705   var cell = this.GetMonthItem(month);
31706   this.ResetItemSelection(prevCell, false, "M");
31707   this.ApplyItemStyle(cell, true, false, "M");
31708   this.activeMonth = month;   
31709  } 
31710 },
31711 ShiftMonth: function(offset) {
31712  var visiblePeriodsChanged = false;
31713  if(!this.showInPopup) {
31714   var isPrevYearMonth = this.activeMonth + offset < 0;
31715   var isNextYearMonth = this.activeMonth + offset > 11;
31716   if(isPrevYearMonth || isNextYearMonth) {
31717    var periodOffset = isPrevYearMonth ? -1 : 1;
31718    if(!this.CanShiftVisibleNavigationPeriod(isNextYearMonth)) {
31719     if(!this.TryShiftToOtherViewFastNavigation(periodOffset))
31720      return false;
31721    }
31722    else
31723     visiblePeriodsChanged = this.ShiftVisibleNavigationPeriod(isPrevYearMonth ? -1 : 1);
31724   }
31725  }
31726  var month = (this.activeMonth + offset) % 12;
31727  month = (month < 0) ? month + 12 : month;
31728  if(this.IsCurrent())
31729   this.SetMonth(month);
31730  else {
31731   var fastNavigation = this.calendar.GetFastNavigation();
31732   if(fastNavigation.activeMonth != month)
31733    fastNavigation.SetMonth(month);
31734   else
31735    fastNavigation.PrepareMonthList();
31736  }
31737  return visiblePeriodsChanged;
31738 },
31739 IsValidYear: function(year) {
31740  return year > 99 && year <= 9999;
31741 },
31742 SetYear: function(year) {
31743  var startYear = Math.floor(year / 10) * 10;
31744  var visiblePeriodsChanged = this.SetStartYear(startYear);
31745  var startYearIndex = this.showInPopup ? 0 : 1;
31746  this.SetYearIndex(startYearIndex + year - startYear);
31747  return visiblePeriodsChanged;
31748 },
31749 GetActiveYearIndex: function() {
31750  var startYearIndex = this.showInPopup ? 0 : 1;
31751  return startYearIndex + this.activeYear - this.startYear;
31752 },
31753 SetYearIndex: function(index) {
31754  var prevIndex = this.GetActiveYearIndex();
31755  if(index != prevIndex) {
31756   if(this.showInPopup || this.currentMode == FastNavigationMode.Years) {
31757    var prevCell = this.GetYearItem(prevIndex);
31758    if(ASPx.IsExistsElement(prevCell)) {
31759     var prevCellIsOutOfRange = prevIndex < 1 || prevIndex > 10;
31760     this.ResetItemSelection(prevCell, prevCellIsOutOfRange, "Y");
31761    }
31762    var cell = this.GetYearItem(index);
31763    this.ApplyItemStyle(cell, true, false, "Y");
31764   }
31765   var startYearIndex = this.showInPopup ? 0 : 1;
31766   this.activeYear = index - startYearIndex + this.startYear;
31767  } 
31768 },
31769 SetDecade: function(decadeYear) {
31770  var visiblePeriodsChanged = this.SetStartYear(ASPxClientCalendar.GetCenturyStartYear(decadeYear));
31771  var startDecadeIndex = 1;
31772  this.SetDecadeIndex(startDecadeIndex + Math.floor((decadeYear - this.startYear) / 10));
31773  return visiblePeriodsChanged;
31774 },
31775 GetActiveDecadeIndex: function() {
31776  var startDecadeIndex = 1;
31777  return startDecadeIndex + Math.floor((this.activeYear - this.startYear) / 10);
31778 },
31779 SetDecadeIndex: function(index) {
31780  if(this.showInPopup)
31781   return;
31782  var prevIndex = this.GetActiveDecadeIndex();
31783  if(index != prevIndex) {
31784   var startDecadeIndex = 1;
31785   var year = (index - startDecadeIndex) * 10 + this.startYear;
31786   if(!this.IsValidYear(year))
31787    return;
31788   if (this.currentMode == FastNavigationMode.Decades) {
31789    var prevCell = this.GetNavigationItem(prevIndex);
31790    if(ASPx.IsExistsElement(prevCell)) {
31791     var prevCellIsOutOfRange = prevIndex < 1 || prevIndex > 10;
31792     this.ResetItemSelection(prevCell, prevCellIsOutOfRange, "I");
31793    }
31794    var cell = this.GetNavigationItem(index);
31795    this.ApplyItemStyle(cell, true, false, "I");
31796   }
31797   this.activeYear = year;
31798  }
31799 },
31800 SetStartYear: function(year) {
31801  if(this.startYear == year)
31802   return false;
31803  this.startYear = year;
31804  if(this.showInPopup || this.currentMode == FastNavigationMode.Years)
31805   this.PrepareYearList();
31806  else if(this.currentMode == FastNavigationMode.Decades)
31807   this.PrepareDecadesList();
31808  return true;
31809 },
31810 ShiftYear: function(offset, force) {
31811  var year = this.activeYear + offset;
31812  if (this.IsValidYear(year)) {
31813   var decadeStartYear = ASPxClientCalendar.GetDecadeStartYear(year);
31814   var isOtherPeriod = decadeStartYear != this.startYear;
31815   if(!force && this.calendar.IsMultiViewFastNavigation()) {    
31816    if(isOtherPeriod && this.TryShiftToOtherViewFastNavigation(decadeStartYear > this.startYear ? 1 : -1)) {
31817     var fastNavigation = this.calendar.GetFastNavigation();
31818     fastNavigation.SetYear(year);
31819     fastNavigation.ApplyItemStyle(fastNavigation.GetNavigationItem(fastNavigation.GetActiveYearIndex()), true, false, "I");
31820     return false;
31821    }
31822   }
31823   if (isOtherPeriod && !this.calendar.enablePeriodNavigation)
31824    return false;
31825   var visiblePeriodsChanged = this.SetYear(year);
31826   if(!this.showInPopup)
31827    this.UpdateActiveViewTitle();
31828   return force || visiblePeriodsChanged;
31829  }
31830  return false;
31831 },
31832 ShiftStartYear: function(offset) {
31833  this.SetStartYear(this.startYear + offset);
31834 },
31835 ShiftDecade: function(offset, force) {
31836  var decadeYear = this.activeYear + offset * 10;
31837  if (this.IsValidYear(decadeYear)) {
31838   var centuryStartYear = ASPxClientCalendar.GetCenturyStartYear(decadeYear);
31839   var isOtherPeriod = centuryStartYear != this.startYear;
31840   if(!force && this.calendar.IsMultiViewFastNavigation()) {    
31841    if(isOtherPeriod && this.TryShiftToOtherViewFastNavigation(centuryStartYear > this.startYear ? 1 : -1)) {
31842     var fastNavigation = this.calendar.GetFastNavigation();
31843     fastNavigation.SetDecade(decadeYear);
31844     fastNavigation.ApplyItemStyle(fastNavigation.GetNavigationItem(fastNavigation.GetActiveDecadeIndex()), true, false, "I");
31845     return false;
31846    }
31847   }
31848   if (isOtherPeriod && !this.calendar.enablePeriodNavigation)
31849    return false;
31850   var visiblePeriodsChanged = this.SetDecade(decadeYear);
31851   this.UpdateActiveViewTitle();
31852   return force || visiblePeriodsChanged;
31853  }
31854  return false;
31855 },
31856 ApplyChanges: function() { 
31857  if(!this.IsCurrent())
31858   return;
31859  var offset = ASPxClientCalendar.GetOffsetInMonths(this.calendar.visibleDate, new Date(this.activeYear, this.activeMonth, 1));
31860  offset -= this.activeView.GetIndex();
31861  if(offset != 0) {
31862   var date = ASPxClientCalendar.AddMonths(this.calendar.visibleDate, offset);
31863   this.calendar.OnVisibleMonthChanged(date);  
31864  }
31865  this.calendar.OnMainElementClick();
31866 },
31867 CancelChanges: function() {
31868  this.RollbackToPrevMode();
31869  if(!this.IsActive())
31870   this.calendar.OnMainElementClick();
31871 },
31872 GetOffsetFromCurrent: function() {
31873  var currentView = this.calendar.views[this.calendar.fastNavViewKey];
31874  return currentView ? this.activeView.GetIndex() - currentView.GetIndex() : 0;
31875 },
31876 Prepare: function() {
31877  var date;
31878  if(this.IsCurrent())
31879   date = this.activeView.visibleDate;
31880  else {
31881   var currentViewDate = this.calendar.views[this.calendar.fastNavViewKey].visibleDate;
31882   var yearOffset = 1;
31883   date = new Date(currentViewDate.getFullYear() + this.GetOffsetFromCurrent() * yearOffset, 1, 0);
31884  }
31885  this.activeYear = date.getFullYear();
31886  this.activeMonth = date.getMonth();
31887  this.startYear = ASPxClientCalendar.GetDecadeStartYear(this.activeYear);
31888 },
31889 PrepareNavigationCells: function (isActivating) {
31890  var regularCells = [];
31891  var fastNavCells = [];
31892  for (var key in this.calendar.views) {
31893   if (!this.calendar.views.hasOwnProperty(key))
31894    continue;
31895   var view = this.calendar.views[key];
31896   regularCells.push(view.GetPrevMonthCell());
31897   regularCells.push(view.GetPrevYearCell());
31898   regularCells.push(view.GetNextMonthCell());
31899   regularCells.push(view.GetNextYearCell());
31900   fastNavCells.push(view.GetPrevTimePeriodCell());
31901   fastNavCells.push(view.GetNextTimePeriodCell());
31902  }
31903  regularCells.forEach(function(cell) { if(cell) { this.SetElementVisible(cell, !isActivating); } }.aspxBind(this));
31904  fastNavCells.forEach(function(cell) { if(cell) { this.SetElementVisible(cell, isActivating); } }.aspxBind(this));
31905 },
31906 PrepareMonthList: function() { 
31907  var item;
31908  for(var month = 0; month < 12; month++) {
31909   item = this.GetMonthItem(month);
31910   if(item == null)
31911    return;
31912   if(!this.showInPopup)
31913    item.innerHTML = ASPx.CultureInfo.abbrMonthNames[month];
31914   this.ApplyItemStyle(item, month == this.activeMonth, false, "M");
31915  }  
31916 },
31917 PrepareYearList: function() {
31918  var year = this.showInPopup ? this.startYear : (this.startYear - 1);
31919  var item;
31920  var itemsCount = this.showInPopup ? 10 : 12;
31921  for(var index = 0; index < itemsCount; index++) {
31922   item = this.GetYearItem(index);
31923   if(item == null)
31924    return;
31925   item.innerHTML = this.IsItemVisible(index) && this.IsValidYear(year) ? year : "";
31926   var isOutOfRange = !this.showInPopup && (index == 0 || index == itemsCount - 1);
31927   this.ApplyItemStyle(item, year == this.activeYear, isOutOfRange, "Y");
31928   year++;
31929  }
31930  if(this.showInPopup) {
31931   this.PreparePreviousYearListCell();
31932   this.PrepareNextYearListCell();
31933  }
31934 },
31935 PreparePreviousYearListCell: function() {
31936  var yearListTable = this.GetChildElement("y");
31937  if(!ASPx.IsExistsElement(yearListTable))
31938   return;
31939  var isEnabledDate = this.startYear > 100;
31940  var prevYearListCell = yearListTable.rows[0].cells[0];
31941  var isPrevYearListCellVisible = ASPx.GetElementVisibility(prevYearListCell);
31942  if(isPrevYearListCellVisible != isEnabledDate)
31943   ASPx.SetElementVisibility(prevYearListCell, isEnabledDate);
31944 },
31945 PrepareDecadesList: function() {
31946  if(this.showInPopup)
31947   return;
31948  var decadeFirstYear = this.startYear - 10;
31949  var decadeLastYear;
31950  var item;
31951  for(var index = 0; index < 12; index++) {
31952   item = this.GetNavigationItem(index);
31953   if(item == null)
31954    return;
31955   decadeLastYear = decadeFirstYear + 9;
31956   item.innerHTML = this.IsItemVisible(index) && this.IsValidYear(decadeFirstYear) && this.IsValidYear(decadeLastYear)
31957    ? decadeFirstYear + " - " + decadeLastYear : "";
31958   this.ApplyItemStyle(item, this.activeYear >= decadeFirstYear && this.activeYear <= decadeLastYear,
31959    index == 0 || index == 11, "I");
31960   decadeFirstYear += 10;
31961  }
31962 },
31963 PrepareNextYearListCell: function() {
31964  var yearListTable = this.GetChildElement("y");
31965  if(!ASPx.IsExistsElement(yearListTable))
31966   return;
31967  var firstYearListRow = yearListTable.rows[0];
31968  var nextYearListCell = firstYearListRow.cells[firstYearListRow.cells.length - 1];
31969  var isLastYear = this.startYear + 9 == 9999;
31970  ASPx.SetElementVisibility(nextYearListCell, !isLastYear);  
31971 },
31972 SetActiveViewTitle: function(title) {
31973  var titleElement = this.activeView.GetTitleElement();
31974  if(ASPx.IsExistsElement(titleElement))
31975   titleElement.innerHTML = title;
31976 },
31977 SetRollbackButtonText: function(text) {
31978  var textElement = this.GetChildElement("rt");
31979  if(ASPx.IsExistsElement(textElement))
31980   textElement.innerHTML = text;
31981 },
31982 GetNavigationItem: function(item) {
31983  var t = this.GetChildElement("n");
31984  if(!ASPx.IsExistsElement(t))
31985   return null;
31986  var colIndex = item % 4;
31987  var rowIndex = (item - colIndex) / 4;
31988  var row = t.rows[rowIndex];
31989  return ASPx.IsExistsElement(row) ? row.cells[colIndex] : null;
31990 },
31991 GetMonthItem: function(month) {
31992  if(!this.showInPopup)
31993   return this.GetNavigationItem(month);
31994  var t = this.GetChildElement("m");
31995  if(!ASPx.IsExistsElement(t))
31996   return null;
31997  var colIndex = month % 4;
31998  var rowIndex = (month - colIndex) / 4;
31999  return t.rows[rowIndex].cells[colIndex];
32000 },
32001 GetYearItem: function(index) {
32002  if(!this.showInPopup)
32003   return this.GetNavigationItem(index);
32004  var t = this.GetChildElement("y");
32005  if(!ASPx.IsExistsElement(t) || index < 0 || index > 9)
32006   return null;
32007  var colIndex = index % 5;
32008  var rowIndex = (index - colIndex) / 5;
32009  if(rowIndex == 0)
32010   colIndex++;
32011  return t.rows[rowIndex].cells[colIndex];
32012 },
32013 GetPopup: function() {
32014  return ASPx.GetControlCollection().Get(this.GetId());
32015 },
32016 GetPopupWindowElement: function() {
32017  return this.GetPopup().GetWindowElement(-1);
32018 },
32019 IsItemVisible: function(itemIndex) {
32020  switch(this.currentMode) {
32021   case FastNavigationMode.Years:
32022   case FastNavigationMode.Decades:
32023    var isPrevPeriodItem = itemIndex < 1;
32024    var isNextPeriodItem = itemIndex > 10;
32025    var isCurrentPeriodItem = !isPrevPeriodItem && !isNextPeriodItem;
32026    return !this.calendar.IsMultiView() || isCurrentPeriodItem || isPrevPeriodItem && this.activeView.isLowBoundary ||
32027     isNextPeriodItem && this.activeView.isHighBoundary;
32028   default:
32029    return true;
32030  }
32031 },
32032 ResetItemSelection: function(item, isOutOfRange, type) {
32033  if(ASPx.IsExistsElement(item))
32034   this.ApplyItemStyle(item, false, isOutOfRange, type);
32035 },
32036 ApplyItemStyle: function(item, isSelected, isOutOfRange, type) {
32037  var info = new ASPxClientCalendarStyleInfo();
32038  var itemType = this.showInPopup ? type : "I";
32039  this.calendar.ImportEtalonStyle(info, "FN" + itemType);
32040  if(isSelected && this.IsCurrent())
32041   this.calendar.ImportEtalonStyle(info, "FN" + itemType + "S");
32042  if(isOutOfRange)
32043   this.calendar.ImportEtalonStyle(info, "FNIA");
32044  info.Apply(item);  
32045 },
32046 GetChildElement: function(postfix) {
32047  return ASPx.CacheHelper.GetCachedElementById(this.calendar, this.calendar.name + "_" + this.partialId + "_" + postfix);
32048 },
32049 GetId: function() {
32050  return this.calendar.name + "_" + this.partialId;
32051 },
32052 OnArrowUp: function(evt) {
32053  if(this.showInPopup)
32054   return evt.shiftKey ? this.ShiftMonth(-4) : this.ShiftYear(-5);
32055  else
32056   return this.ShiftNavigationItem(-4);
32057 },
32058 OnArrowDown: function(evt) {
32059  if(this.showInPopup)
32060   return evt.shiftKey ? this.ShiftMonth(4) : this.ShiftYear(5);
32061  else
32062   return this.ShiftNavigationItem(4);
32063 },
32064 OnArrowLeft: function(evt) {
32065  if(this.showInPopup)
32066   return evt.shiftKey ? this.ShiftMonth(-1) : this.ShiftYear(-1);
32067  else
32068   return this.ShiftNavigationItem(-1);
32069 },
32070 OnArrowRight: function(evt) {
32071  if(this.showInPopup)
32072   return evt.shiftKey ? this.ShiftMonth(1) : this.ShiftYear(1);
32073  else
32074   return this.ShiftNavigationItem(1);
32075 },
32076 OnPageUp: function(evt) {
32077  if(this.showInPopup)
32078   this.ShiftYear(-10);
32079  else {
32080   if(this.IsCurrent()) {
32081    if(!this.CanShiftVisibleNavigationPeriod(false)) { 
32082     this.TryShiftToOtherViewFastNavigation(-1);
32083     return false;
32084    }
32085   }
32086   this.ShiftVisibleNavigationPeriod(-1);
32087  }
32088  return true;
32089 },
32090 OnPageDown: function(evt) {
32091  if(this.showInPopup)
32092   this.ShiftYear(10);
32093  else {
32094   if(this.IsCurrent()) {
32095    if(!this.CanShiftVisibleNavigationPeriod(true)) {
32096     this.TryShiftToOtherViewFastNavigation(1);
32097     return false;
32098    }
32099   }
32100   this.ShiftVisibleNavigationPeriod(1);
32101  }
32102  return true;
32103 },
32104 OnEnter: function() {
32105  if(this.currentMode !== FastNavigationMode.Months)
32106   this.activeMonth = 0;
32107  this.SwitchToPrevMode();
32108 },
32109 OnNavigationItemClick: function(itemIndex) {
32110  if(itemIndex !== this.GetActiveNavigationItemIndex())
32111   this.SelectNavigationItem(itemIndex);
32112  this.SwitchToPrevMode();
32113 },
32114 OnMonthClick: function(month) {
32115  this.SetMonth(month);
32116 },
32117 OnYearClick: function(index) {
32118  this.SetYearIndex(index);
32119 },
32120 OnYearShuffle: function(offset) {
32121  this.ShiftStartYear(offset);
32122 },
32123 OnOkClick: function() {
32124  this.SwitchToPrevMode();
32125 },
32126});
32127ASPx.ASPxClientCalendarFastNavigation = ASPxClientCalendarFastNavigation;
32128var ASPxClientCalendarStyleInfo = ASPx.CreateClass(null, {
32129 constructor: function() {
32130  this.className = "";
32131  this.cssText = "";
32132 },
32133 Clone: function() {
32134  var clone = new ASPxClientCalendarStyleInfo();
32135  clone.className = this.className;
32136  clone.cssText = this.cssText;
32137  return clone;
32138 },
32139 Apply: function(element) {
32140  if(element.className != this.className)
32141   element.className = this.className;
32142  if(element._style != this.cssText) {
32143   element.style.cssText = this.cssText; 
32144   element._style = this.cssText; 
32145  } 
32146 },
32147 Remove: function(element) {
32148  ASPx.RemoveClassNameFromElement(element, this.className);
32149  var styleRules = this.cssText.split(";");
32150  for(var i = 0; i < styleRules.length; i++) {
32151   var styleRule = styleRules[i];
32152   if(styleRule && element.style.cssText.indexOf(styleRule) !== -1)
32153    element.style.cssText = element.style.cssText.replace(styleRule, "");
32154  }
32155  element.style.cssText = element.style.cssText.replace(new RegExp(";+"), ";");
32156 },
32157 Import: function(element) {
32158  if(element.className.length > 0) {
32159   if(this.className.length > 1)
32160    this.className += " ";
32161   this.className +=  element.className;
32162  }  
32163  var cssText = element.style.cssText;
32164  if(cssText.length > 0) {
32165   var pos = cssText.length - 1;
32166   while(pos > -1 && cssText.charAt(pos) == " ")
32167    --pos;
32168   if(cssText.charAt(pos) != ";")
32169    cssText += ";";
32170   this.cssText += cssText;
32171  }
32172 }  
32173});
32174var ASPxClientCalendarSelectionEventArgs = ASPx.CreateClass(ASPxClientProcessingModeEventArgs, {
32175 constructor: function(processOnServer, selection){
32176  this.constructor.prototype.constructor.call(this, processOnServer);
32177  this.selection = selection;
32178 }
32179});
32180var ASPxDaysSelectingOnMouseOverEventArgs = ASPx.CreateClass(ASPxClientEventArgs, {
32181 constructor: function (overDate) {
32182  this.constructor.prototype.constructor.call(this);
32183  this.overDate = overDate;
32184 }
32185});
32186function aspxCalDocMouseUp(evt) {
32187 var target = ASPx.Evt.GetEventSource(evt);
32188 if(ASPx.activeCalendar != null && ASPx.IsExistsElement(target)) {
32189  ASPx.activeCalendar.forceMouseDown = false;
32190  if(ASPx.activeCalendar.isMouseDown) {   
32191   for(var key in ASPx.activeCalendar.views) {
32192    if(ASPx.activeCalendar.views.hasOwnProperty(key)) {
32193     var view = ASPx.activeCalendar.views[key];
32194     if(!view.isASPxClientCalendarView) continue;
32195     var monthCell = view.GetMonthCell();
32196     var parent = target.parentNode;
32197     while(ASPx.IsExistsElement(parent)) {
32198      if(parent == monthCell)
32199       return;
32200      parent = parent.parentNode;
32201     }
32202    }
32203   }
32204   ASPx.activeCalendar.OnSelectionCancelled();   
32205  }
32206  ASPx.activeCalendar = null;
32207 }
32208}
32209function aspxCalCancelSelect() {
32210 if(ASPx.activeCalendar != null) {
32211  ASPx.activeCalendar.forceMouseDown = false;
32212  ASPx.activeCalendar.OnSelectionCancelled();  
32213 }
32214}
32215ASPx.CalTodayClick = function(name) { 
32216 var edit = ASPx.GetControlCollection().Get(name);
32217 if(edit != null)
32218  edit.OnTodayClick();
32219};
32220ASPx.CalClearClick = function(name) { 
32221 var edit = ASPx.GetControlCollection().Get(name);
32222 if(edit != null)
32223  edit.OnClearClick();
32224};
32225ASPx.CalFNYShuffle = function(name, offset) {
32226 var edit = ASPx.GetControlCollection().Get(name);
32227 if(edit != null)
32228  edit.fastNavigation.OnYearShuffle(offset);
32229};
32230ASPx.CalFNBClick = function(name, action) {
32231 var edit = ASPx.GetControlCollection().Get(name);
32232 if(edit != null) {
32233  switch(action) {
32234   case "ok":
32235    if(edit.fastNavigation)
32236     edit.fastNavigation.OnOkClick();
32237    else {
32238     for(var key in edit.views) {
32239      if(edit.views.hasOwnProperty(key))
32240       view = edit.views[key].fastNavigation.OnOkClick();
32241     }
32242    }
32243    break;
32244   case "cancel":
32245    edit.CancelFastNavigation();
32246    break;
32247  }    
32248 }
32249};
32250window.ASPxClientCalendar = ASPxClientCalendar;
32251window.ASPxClientCalendarCustomDisabledDateEventArgs = ASPxClientCalendarCustomDisabledDateEventArgs;
32252window.ASPxClientCalendarSelection = ASPxClientCalendarSelection;
32253window.ASPxClientCalendarDateDisabledHelper = ASPxClientCalendarDateDisabledHelper;
32254window.ASPxClientCalendarStyleInfo = ASPxClientCalendarStyleInfo;
32255window.ASPxClientCalendarSelectionEventArgs = ASPxClientCalendarSelectionEventArgs;
32256})();
32257

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.